From 1a59a05174d3ed6e6b75b8d9e2b5b074ebf41b38 Mon Sep 17 00:00:00 2001 From: Mikko Tiusanen Date: Tue, 2 Dec 2014 21:59:52 +0200 Subject: Added support for configuring refinery/colony effects on own and enemy team's bp pool. --- src/game/edge_version.h | 2 +- src/game/g_buildable.c | 32 +++++++++++--------------------- src/game/g_local.h | 2 ++ src/game/g_main.c | 10 +++++++--- 4 files changed, 21 insertions(+), 25 deletions(-) (limited to 'src') diff --git a/src/game/edge_version.h b/src/game/edge_version.h index 12518ab..d5e3ab5 100644 --- a/src/game/edge_version.h +++ b/src/game/edge_version.h @@ -1,3 +1,3 @@ #ifndef EDGE_MOD_VERSION -#define EDGE_MOD_VERSION "7.5d" +#define EDGE_MOD_VERSION "7.5e" #endif diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 841038f..d132890 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -398,30 +398,20 @@ Note: 'pos' can be NULL, in this case return the overall BP of the team. int G_GetBuildPoints( const vec3_t pos, team_t team ) { int value = 0; - - if( !G_Overmind( ) && team == TEAM_ALIENS ) - { - return 0; - } - else if( team == TEAM_ALIENS ) - { + switch(team) { + case TEAM_ALIENS: + if ( !G_Overmind( ) ) return 0; value = level.alienBuildPoints; - } - else if( !G_Reactor( ) && team == TEAM_HUMANS ) - { - return 0; - } - else if( team == TEAM_HUMANS ) - { + break; + case TEAM_HUMANS: + if ( !G_Reactor( ) ) return 0; value = level.humanBuildPoints; - } - else - return 0; - - if( ( value > 0 ) && ( G_TimeTilSuddenDeath( ) <= 0 ) ) + break; + default: return 0; - else - return value; + } + if( ( value > 0 ) && ( G_TimeTilSuddenDeath( ) <= 0 ) ) return 0; + return value; } /* diff --git a/src/game/g_local.h b/src/game/g_local.h index 1b120a8..32b6075 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -1300,6 +1300,8 @@ extern vmCvar_t g_AutoLevelMinTeamSize; extern vmCvar_t g_RageQuitScorePenalty; extern vmCvar_t g_DretchTurretDamage; extern vmCvar_t g_DretchBuildingDamage; +extern vmCvar_t g_OwnTeamBPFactor; +extern vmCvar_t g_EnemyTeamBPFactor; void trap_Print( const char *fmt ); void trap_Error( const char *fmt ); diff --git a/src/game/g_main.c b/src/game/g_main.c index 65e5d41..10df6c0 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -203,6 +203,8 @@ vmCvar_t g_AutoLevelMinTeamSize; vmCvar_t g_RageQuitScorePenalty; vmCvar_t g_DretchTurretDamage; vmCvar_t g_DretchBuildingDamage; +vmCvar_t g_OwnTeamBPFactor; +vmCvar_t g_EnemyTeamBPFactor; // copy cvars that can be set in worldspawn so they can be restored later static char cv_gravity[ MAX_CVAR_VALUE_STRING ]; @@ -372,7 +374,9 @@ static cvarTable_t gameCvarTable[ ] = { &g_AutoLevelMinTeamSize, "g_AutoLevelMinTeamSize", "3", CVAR_ARCHIVE, 0, qfalse }, { &g_RageQuitScorePenalty, "g_RageQuitScorePenalty", "2000", CVAR_ARCHIVE, 0, qfalse }, { &g_DretchTurretDamage, "g_DretchTurretDamage", "1", CVAR_ARCHIVE, 0, qfalse }, - { &g_DretchBuildingDamage, "g_DretchBuildingDamage", "0.5", CVAR_ARCHIVE, 0, qfalse } + { &g_DretchBuildingDamage, "g_DretchBuildingDamage", "0.5", CVAR_ARCHIVE, 0, qfalse }, + { &g_OwnTeamBPFactor, "g_OwnTeamBPFactor", "1.0", CVAR_ARCHIVE, 0, qfalse }, + { &g_EnemyTeamBPFactor, "g_EnemyTeamBPFactor", "0.0", CVAR_ARCHIVE, 0, qfalse } }; static int gameCvarTableSize = sizeof( gameCvarTable ) / sizeof( gameCvarTable[ 0 ] ); void G_InitGame( int levelTime, int randomSeed, int restart ); @@ -1394,8 +1398,8 @@ void G_CalculateBuildPoints( void ) hFixed = h_refineries * g_humanRefineryBuildPoints.value; // LimitSum( g_maxFixedBuildPoints.value, 1.0f, &aFixed, &hFixed ); - level.alienExtraBuildPoints = aVar + aFixed; - level.humanExtraBuildPoints = hVar + hFixed; + level.alienExtraBuildPoints = g_OwnTeamBPFactor.value * (aVar + aFixed) + g_EnemyTeamBPFactor.value * (hVar + hFixed); + level.humanExtraBuildPoints = g_OwnTeamBPFactor.value * (hVar + hFixed) + g_EnemyTeamBPFactor.value * (aVar + aFixed); level.humanBuildPoints += level.humanExtraBuildPoints; level.alienBuildPoints += level.alienExtraBuildPoints; -- cgit