diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2015-04-07 16:06:46 +0200 |
---|---|---|
committer | Paweł Redman <pawel.redman@gmail.com> | 2015-04-07 16:06:46 +0200 |
commit | eb2a53e0296771246e953cc6e0ac940cb846e438 (patch) | |
tree | df4fc0a36a6e954abd67d20cea45c32d3bebc1aa /src | |
parent | 84788917d2deb14f07c5710f2f9eaaae3f0b50a2 (diff) |
Initial implementation of build point deletion.
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_buildable.c | 26 | ||||
-rw-r--r-- | src/game/g_local.h | 4 | ||||
-rw-r--r-- | src/game/g_main.c | 10 |
3 files changed, 35 insertions, 5 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 62aa7c7..21f5424 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -401,11 +401,11 @@ int G_GetBuildPoints( const vec3_t pos, team_t team ) switch(team) { case TEAM_ALIENS: if ( !G_Overmind( ) ) return 0; - value = level.alienBuildPoints; + value = level.alienBuildPoints - level.alienDeletedBuildPoints; break; case TEAM_HUMANS: if ( !G_Reactor( ) ) return 0; - value = level.humanBuildPoints; + value = level.humanBuildPoints - level.humanDeletedBuildPoints; break; default: return 0; @@ -3313,6 +3313,28 @@ void G_QueueBuildPoints( gentity_t *self ) gentity_t *powerEntity; int queuePoints; + // if using build point deletion mode then delete BP permanently + // instead of queuing it + if( g_buildPointDeletion.integer ) + { + int points = BG_Buildable( self->s.modelindex )->buildPoints; + + switch( self->buildableTeam ) + { + case TEAM_ALIENS: + level.alienDeletedBuildPoints += points; + level.alienNoBPFlash = qtrue; + break; + + case TEAM_HUMANS: + level.humanDeletedBuildPoints += points; + level.humanNoBPFlash = qtrue; + break; + } + + return; + } + queuePoints = G_QueueValue( self ); if( !queuePoints ) diff --git a/src/game/g_local.h b/src/game/g_local.h index b4f6d81..85f43fc 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -691,10 +691,12 @@ typedef struct int numAlienBuilders; int numHumanBuilders; int alienBuildPoints; + int alienDeletedBuildPoints; int alienExtraBuildPoints; int alienBuildPointQueue; int alienNextQueueTime; int humanBuildPoints; + int humanDeletedBuildPoints; int humanExtraBuildPoints; int humanBuildPointQueue; int humanNextQueueTime; @@ -1394,6 +1396,8 @@ extern vmCvar_t g_MinHumanExtraBuildPoints; extern vmCvar_t g_MaxHumanExtraBuildPoints; extern vmCvar_t g_BuildingCreditsFactor; +extern vmCvar_t g_buildPointDeletion; + void trap_Print( 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 4a966b3..18f4f50 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -209,6 +209,8 @@ vmCvar_t g_MinHumanExtraBuildPoints; vmCvar_t g_MaxHumanExtraBuildPoints; vmCvar_t g_BuildingCreditsFactor; +vmCvar_t g_buildPointDeletion; + // copy cvars that can be set in worldspawn so they can be restored later static char cv_gravity[ MAX_CVAR_VALUE_STRING ]; static char cv_humanMaxStage[ MAX_CVAR_VALUE_STRING ]; @@ -385,7 +387,9 @@ static cvarTable_t gameCvarTable[ ] = { &g_MaxAlienExtraBuildPoints, "g_MaxAlienExtraBuildPoints", "800", CVAR_ARCHIVE, 0, qfalse }, { &g_MinHumanExtraBuildPoints, "g_MinHumanExtraBuildPoints", "-800", CVAR_ARCHIVE, 0, qfalse }, { &g_MaxHumanExtraBuildPoints, "g_MaxHumanExtraBuildPoints", "800", CVAR_ARCHIVE, 0, qfalse }, - { &g_BuildingCreditsFactor, "g_BuildingCreditsFactor", "0.25", CVAR_ARCHIVE, 0, qfalse } + { &g_BuildingCreditsFactor, "g_BuildingCreditsFactor", "0.25", CVAR_ARCHIVE, 0, qfalse }, + + { &g_buildPointDeletion, "g_buildPointDeletion", "1", CVAR_ARCHIVE, 0, qfalse } }; static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] ); @@ -1440,10 +1444,10 @@ void G_CalculateBuildPoints( void ) } trap_SetConfigstring( CS_BUILD_POOLS, va( "%d %d %d %d %d %d", - g_alienBuildPoints.integer + level.alienExtraBuildPoints, + g_alienBuildPoints.integer + level.alienExtraBuildPoints - level.alienDeletedBuildPoints, g_alienBuildPoints.integer, level.alienNoBPFlashTime, - g_humanBuildPoints.integer + level.humanExtraBuildPoints, + g_humanBuildPoints.integer + level.humanExtraBuildPoints - level.humanDeletedBuildPoints, g_humanBuildPoints.integer, level.humanNoBPFlashTime ) ); |