diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_public.h | 6 | ||||
-rw-r--r-- | src/game/g_local.h | 5 | ||||
-rw-r--r-- | src/game/g_main.c | 44 | ||||
-rw-r--r-- | src/game/g_spawn.c | 6 |
4 files changed, 41 insertions, 20 deletions
diff --git a/src/game/bg_public.h b/src/game/bg_public.h index 01ea379e..f5e5cef1 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -90,11 +90,7 @@ #define CS_ITEMS 27 // string of 0's and 1's that tell which items are present //TA: extra stuff: -#define CS_DBPOINTS 28 -#define CS_DTBPOINTS 29 -#define CS_HBPOINTS 30 -#define CS_HTBPOINTS 31 -#define CS_HPBPOINTS 32 +#define CS_BUILDPOINTS 28 #define CS_MODELS 33 #define CS_SOUNDS (CS_MODELS+MAX_MODELS) diff --git a/src/game/g_local.h b/src/game/g_local.h index a176e444..bd77686e 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -471,9 +471,7 @@ typedef struct { int numLiveHumanClients; int droidBuildPoints; - int droidBuildPointsTotal; int humanBuildPoints; - int humanBuildPointsTotal; int humanBuildPointsPowered; } level_locals_t; @@ -844,6 +842,9 @@ extern vmCvar_t g_enableDust; extern vmCvar_t g_enableBreath; extern vmCvar_t g_singlePlayer; +extern vmCvar_t g_humanBuildPoints; +extern vmCvar_t g_droidBuildPoints; + void trap_Printf( const char *fmt ); void trap_Error( const char *fmt ); int trap_Milliseconds( void ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 06505ce5..f1877acf 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -86,6 +86,9 @@ vmCvar_t pmove_msec; vmCvar_t g_rankings; vmCvar_t g_listEntity; +//TA +vmCvar_t g_humanBuildPoints; +vmCvar_t g_droidBuildPoints; static cvarTable_t gameCvarTable[] = { // don't override the cheat state set by the system @@ -154,6 +157,9 @@ static cvarTable_t gameCvarTable[] = { { &g_smoothClients, "g_smoothClients", "1", 0, 0, qfalse}, { &pmove_fixed, "pmove_fixed", "0", CVAR_SYSTEMINFO, 0, qfalse}, { &pmove_msec, "pmove_msec", "8", CVAR_SYSTEMINFO, 0, qfalse}, + + { &g_humanBuildPoints, "g_humanBuildPoints", "1000", 0, 0, qtrue }, + { &g_droidBuildPoints, "g_droidBuildPoints", "1000", 0, 0, qtrue }, { &g_rankings, "g_rankings", "0", 0, 0, qfalse} }; @@ -500,10 +506,6 @@ void G_InitGame( int levelTime, int randomSeed, int restart ) { //TA: so the server counts the spawns without a client attached countSpawns( ); - - //TA: FIXME: grab these values from a worldspawn variable - level.humanBuildPoints = level.humanBuildPointsTotal = 1000; - level.droidBuildPoints = level.droidBuildPointsTotal = 1000; } @@ -793,12 +795,14 @@ Recalculate the quantity of building points available to the teams */ void calculateBuildPoints( void ) { - int i; - int bclass; + int i; + int bclass; gentity_t *ent; + int localHTP = g_humanBuildPoints.integer, + localDTP = g_droidBuildPoints.integer; - level.humanBuildPoints = level.humanBuildPointsPowered = level.humanBuildPointsTotal; - level.droidBuildPoints = level.droidBuildPointsTotal; + level.humanBuildPoints = level.humanBuildPointsPowered = localHTP; + level.droidBuildPoints = localDTP; for ( i = 1, ent = g_entities + i ; i < level.num_entities ; i++, ent++ ) { @@ -822,12 +826,26 @@ void calculateBuildPoints( void ) } } } + + if( level.humanBuildPoints < 0 ) + { + localHTP -= level.humanBuildPoints; + level.humanBuildPointsPowered -= level.humanBuildPoints; + level.humanBuildPoints = 0; + } + + if( level.humanBuildPoints < 0 ) + { + localDTP -= level.droidBuildPoints; + level.droidBuildPoints = 0; + } - trap_SetConfigstring( CS_DBPOINTS, va("%i", level.droidBuildPoints ) ); - trap_SetConfigstring( CS_DTBPOINTS, va("%i", level.droidBuildPointsTotal ) ); - trap_SetConfigstring( CS_HBPOINTS, va("%i", level.humanBuildPoints ) ); - trap_SetConfigstring( CS_HTBPOINTS, va("%i", level.humanBuildPointsTotal ) ); - trap_SetConfigstring( CS_HPBPOINTS, va("%i", level.humanBuildPointsPowered ) ); + trap_SetConfigstring( CS_BUILDPOINTS, + va( "%d %d %d %d %d", level.droidBuildPoints, + localDTP, + level.humanBuildPoints, + localHTP, + level.humanBuildPointsPowered ) ); } diff --git a/src/game/g_spawn.c b/src/game/g_spawn.c index 7655e442..101a1acb 100644 --- a/src/game/g_spawn.c +++ b/src/game/g_spawn.c @@ -619,6 +619,12 @@ void SP_worldspawn( void ) { G_SpawnString( "gravity", "800", &s ); trap_Cvar_Set( "g_gravity", s ); + G_SpawnString( "humanBuildPoints", "1000", &s ); + trap_Cvar_Set( "g_humanBuildPoints", s ); + + G_SpawnString( "droidBuildPoints", "1000", &s ); + trap_Cvar_Set( "g_droidBuildPoints", s ); + G_SpawnString( "enableDust", "0", &s ); trap_Cvar_Set( "g_enableDust", s ); |