summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2009-10-03 11:23:19 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:14:56 +0000
commit2e7cfc74d0f20940cb457605dccee7f1616e5d1e (patch)
tree16d1d6180c602fd213992fcd7a7b25e6f9b61d46 /src/game
parentd47dcc40898465ccbaa7f3c60ea23e84ed93b908 (diff)
* Renamed some enum stuff to be more descriptive
* Fiddled with Cmd_Build_f so some (more) build errors will give a red blueprint
Diffstat (limited to 'src/game')
-rw-r--r--src/game/bg_public.h24
-rw-r--r--src/game/g_buildable.c52
-rw-r--r--src/game/g_cmds.c37
-rw-r--r--src/game/g_local.h22
4 files changed, 69 insertions, 66 deletions
diff --git a/src/game/bg_public.h b/src/game/bg_public.h
index 6a23595e..6a6869c9 100644
--- a/src/game/bg_public.h
+++ b/src/game/bg_public.h
@@ -585,14 +585,14 @@ typedef enum
MN_A_NOOVMND_EVOLVE,
//alien build
- MN_A_SPWNWARN,
- MN_A_OVERMIND,
- MN_A_NOASSERT,
+ MN_A_SPWNWARN, // not currently used
+ MN_A_ONEOVERMIND,
+ MN_A_NOBP,
MN_A_NOCREEP,
MN_A_NOOVMND,
MN_A_NOROOM,
- MN_A_NORMAL,
- MN_A_HOVEL,
+ MN_A_NORMAL, // too steep
+ MN_A_ONEHOVEL,
MN_A_HOVEL_EXIT,
MN_A_TEAMCHANGEBUILDTIMER,
MN_A_EVOLVEBUILDTIMER,
@@ -610,16 +610,16 @@ typedef enum
MN_H_NOROOMBSUITOFF,
//human build
- MN_H_REPEATER,
- MN_H_NOPOWER,
+ MN_H_NOPOWERHERE,
+ MN_H_NOBP,
MN_H_NOTPOWERED,
MN_H_NODCC,
- MN_H_REACTOR,
+ MN_H_ONEREACTOR,
MN_H_NOROOM,
- MN_H_NORMAL,
- MN_H_TNODEWARN,
- MN_H_RPTWARN,
- MN_H_RPTWARN2,
+ MN_H_NORMAL, // too steep
+ MN_H_TNODEWARN, // not currently used
+ MN_H_RPTNOREAC,
+ MN_H_RPTPOWERHERE,
MN_H_TEAMCHANGEBUILDTIMER,
MN_H_ARMOURYBUILDTIMER
} dynMenu_t;
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c
index 133559d7..5c905484 100644
--- a/src/game/g_buildable.c
+++ b/src/game/g_buildable.c
@@ -2806,7 +2806,7 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable,
{
remainingBP = level.alienBuildPoints;
remainingSpawns = level.numAlienSpawns;
- bpError = IBE_NOASSERT;
+ bpError = IBE_NOALIENBP;
spawn = BA_A_SPAWN;
core = BA_A_OVERMIND;
}
@@ -2814,7 +2814,7 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable,
{
remainingBP = level.humanBuildPoints;
remainingSpawns = level.numHumanSpawns;
- bpError = IBE_NOPOWER;
+ bpError = IBE_NOHUMANBP;
spawn = BA_H_SPAWN;
core = BA_H_REACTOR;
}
@@ -2941,7 +2941,7 @@ static itemBuildError_t G_SufficientBPAvailable( buildable_t buildable,
// There are one or more repeaters we can't remove
if( repeaterInRangeCount > 0 )
- return IBE_RPTWARN2;
+ return IBE_RPTPOWERHERE;
// Sort the list
cmpBuildable = buildable;
@@ -3092,7 +3092,7 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
{
//tell player to build a repeater to provide power
if( buildable != BA_H_REACTOR && buildable != BA_H_REPEATER )
- reason = IBE_REPEATER;
+ reason = IBE_NOPOWERHERE;
}
//this buildable requires a DCC
@@ -3105,11 +3105,11 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
tempent = G_FindBuildable( BA_H_REACTOR );
if( tempent == NULL ) // No reactor
- reason = IBE_RPTWARN;
+ reason = IBE_RPTNOREAC;
else if( g_markDeconstruct.integer && G_IsPowered( entity_origin ) == BA_H_REACTOR )
- reason = IBE_RPTWARN2;
+ reason = IBE_RPTPOWERHERE;
else if( !g_markDeconstruct.integer && G_IsPowered( entity_origin ) )
- reason = IBE_RPTWARN2;
+ reason = IBE_RPTPOWERHERE;
}
// Check permission to build here
@@ -3130,15 +3130,15 @@ itemBuildError_t G_CanBuild( gentity_t *ent, buildable_t buildable, int distance
switch( buildable )
{
case BA_A_OVERMIND:
- reason = IBE_OVERMIND;
+ reason = IBE_ONEOVERMIND;
break;
case BA_A_HOVEL:
- reason = IBE_HOVEL;
+ reason = IBE_ONEHOVEL;
break;
case BA_H_REACTOR:
- reason = IBE_REACTOR;
+ reason = IBE_ONEREACTOR;
break;
default:
@@ -3420,8 +3420,8 @@ qboolean G_BuildIfValid( gentity_t *ent, buildable_t buildable )
G_Build( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
- case IBE_NOASSERT:
- G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOASSERT );
+ case IBE_NOALIENBP:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOBP );
return qfalse;
case IBE_NOOVERMIND:
@@ -3432,12 +3432,12 @@ qboolean G_BuildIfValid( gentity_t *ent, buildable_t buildable )
G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOCREEP );
return qfalse;
- case IBE_OVERMIND:
- G_TriggerMenu( ent->client->ps.clientNum, MN_A_OVERMIND );
+ case IBE_ONEOVERMIND:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_ONEOVERMIND );
return qfalse;
- case IBE_HOVEL:
- G_TriggerMenu( ent->client->ps.clientNum, MN_A_HOVEL );
+ case IBE_ONEHOVEL:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_ONEHOVEL );
return qfalse;
case IBE_HOVELEXIT:
@@ -3458,12 +3458,12 @@ qboolean G_BuildIfValid( gentity_t *ent, buildable_t buildable )
G_TriggerMenu( ent->client->ps.clientNum, MN_A_NORMAL );
return qfalse;
- case IBE_REACTOR:
- G_TriggerMenu( ent->client->ps.clientNum, MN_H_REACTOR );
+ case IBE_ONEREACTOR:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_ONEREACTOR );
return qfalse;
- case IBE_REPEATER:
- G_TriggerMenu( ent->client->ps.clientNum, MN_H_REPEATER );
+ case IBE_NOPOWERHERE:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOPOWERHERE );
return qfalse;
case IBE_NOROOM:
@@ -3473,8 +3473,8 @@ qboolean G_BuildIfValid( gentity_t *ent, buildable_t buildable )
G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOROOM );
return qfalse;
- case IBE_NOPOWER:
- G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOPOWER );
+ case IBE_NOHUMANBP:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOBP);
return qfalse;
case IBE_NODCC:
@@ -3491,13 +3491,13 @@ qboolean G_BuildIfValid( gentity_t *ent, buildable_t buildable )
G_Build( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
- case IBE_RPTWARN:
- G_TriggerMenu( ent->client->ps.clientNum, MN_H_RPTWARN );
+ case IBE_RPTNOREAC:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_RPTNOREAC );
G_Build( ent, buildable, origin, ent->s.apos.trBase );
return qtrue;
- case IBE_RPTWARN2:
- G_TriggerMenu( ent->client->ps.clientNum, MN_H_RPTWARN2 );
+ case IBE_RPTPOWERHERE:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_RPTPOWERHERE );
return qfalse;
default:
diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c
index 05925bd4..83bfc76c 100644
--- a/src/game/g_cmds.c
+++ b/src/game/g_cmds.c
@@ -2363,37 +2363,40 @@ void Cmd_Build_f( gentity_t *ent )
//these are the errors displayed when the builder first selects something to use
switch( G_CanBuild( ent, buildable, dist, origin ) )
{
+ // can place right away, set the blueprint and the valid togglebit
case IBE_NONE:
case IBE_TNODEWARN:
- case IBE_RPTWARN:
- case IBE_RPTWARN2:
+ case IBE_RPTNOREAC:
+ case IBE_RPTPOWERHERE:
case IBE_SPWNWARN:
- case IBE_NOROOM:
- case IBE_NORMAL:
- case IBE_HOVELEXIT:
- case IBE_REPEATER:
- case IBE_NOCREEP:
ent->client->ps.stats[ STAT_BUILDABLE ] = ( buildable | SB_VALID_TOGGLEBIT );
break;
- case IBE_NOASSERT:
- G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOASSERT );
+ // can't place yet but maybe soon: start with valid togglebit off
+ case IBE_NORMAL:
+ case IBE_HOVELEXIT:
+ case IBE_NOCREEP:
+ case IBE_NOROOM:
+ case IBE_NOOVERMIND:
+ case IBE_NOPOWERHERE:
+ ent->client->ps.stats[ STAT_BUILDABLE ] = buildable;
break;
- case IBE_NOOVERMIND:
- G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOOVMND );
+ // more serious errors just pop a menu
+ case IBE_NOALIENBP:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_NOBP );
break;
- case IBE_OVERMIND:
- G_TriggerMenu( ent->client->ps.clientNum, MN_A_OVERMIND );
+ case IBE_ONEOVERMIND:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_A_ONEOVERMIND );
break;
- case IBE_REACTOR:
- G_TriggerMenu( ent->client->ps.clientNum, MN_H_REACTOR );
+ case IBE_ONEREACTOR:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_ONEREACTOR );
break;
- case IBE_NOPOWER:
- G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOPOWER );
+ case IBE_NOHUMANBP:
+ G_TriggerMenu( ent->client->ps.clientNum, MN_H_NOBP);
break;
case IBE_NODCC:
diff --git a/src/game/g_local.h b/src/game/g_local.h
index 932a79c1..db97d8a1 100644
--- a/src/game/g_local.h
+++ b/src/game/g_local.h
@@ -718,22 +718,22 @@ typedef enum
IBE_NONE,
IBE_NOOVERMIND,
- IBE_OVERMIND,
- IBE_NOASSERT,
- IBE_SPWNWARN,
+ IBE_ONEOVERMIND,
+ IBE_NOALIENBP,
+ IBE_SPWNWARN, // not currently used
IBE_NOCREEP,
- IBE_HOVEL,
+ IBE_ONEHOVEL,
IBE_HOVELEXIT,
- IBE_REACTOR,
- IBE_REPEATER,
- IBE_TNODEWARN,
- IBE_RPTWARN,
- IBE_RPTWARN2,
- IBE_NOPOWER,
+ IBE_ONEREACTOR,
+ IBE_NOPOWERHERE,
+ IBE_TNODEWARN, // not currently sued
+ IBE_RPTNOREAC,
+ IBE_RPTPOWERHERE,
+ IBE_NOHUMANBP,
IBE_NODCC,
- IBE_NORMAL,
+ IBE_NORMAL, // too steep
IBE_NOROOM,
IBE_PERMISSION,