Skip to content
This repository
Browse code

allow maps to override buildpoint limits

note: this implementation uses the crappy write-cvar-and-revert-upon-exit solution
  • Loading branch information...
commit 5008ce8a7449221b05529761ec6367239a791b1c 1 parent 66770c3
authored June 18, 2012 dsalt committed June 23, 2012
9  src/gamelogic/gpp/src/game/g_main.c
@@ -187,6 +187,9 @@ vmCvar_t           g_combatCooldown;
187 187
 static char        cv_gravity[ MAX_CVAR_VALUE_STRING ];
188 188
 static char        cv_humanMaxStage[ MAX_CVAR_VALUE_STRING ];
189 189
 static char        cv_alienMaxStage[ MAX_CVAR_VALUE_STRING ];
  190
+static char        cv_humanRepeaterBuildPoints[ MAX_CVAR_VALUE_STRING ];
  191
+static char        cv_humanBuildPoints[ MAX_CVAR_VALUE_STRING ];
  192
+static char        cv_alienBuildPoints[ MAX_CVAR_VALUE_STRING ];
190 193
 
191 194
 static cvarTable_t gameCvarTable[] =
192 195
 {
@@ -262,11 +265,11 @@ static cvarTable_t gameCvarTable[] =
262 265
 	{ &pmove_fixed,                   "pmove_fixed",                   "0",                                CVAR_SYSTEMINFO,                                 0, qfalse           },
263 266
 	{ &pmove_msec,                    "pmove_msec",                    "8",                                CVAR_SYSTEMINFO,                                 0, qfalse           },
264 267
 
265  
-	{ &g_alienBuildPoints,            "g_alienBuildPoints",            DEFAULT_ALIEN_BUILDPOINTS,          0,                                               0, qfalse           },
  268
+	{ &g_alienBuildPoints,            "g_alienBuildPoints",            DEFAULT_ALIEN_BUILDPOINTS,          0,                                               0, qfalse, cv_alienBuildPoints},
266 269
 	{ &g_alienBuildQueueTime,         "g_alienBuildQueueTime",         DEFAULT_ALIEN_QUEUE_TIME,           CVAR_ARCHIVE,                                    0, qfalse           },
267  
-	{ &g_humanBuildPoints,            "g_humanBuildPoints",            DEFAULT_HUMAN_BUILDPOINTS,          0,                                               0, qfalse           },
  270
+	{ &g_humanBuildPoints,            "g_humanBuildPoints",            DEFAULT_HUMAN_BUILDPOINTS,          0,                                               0, qfalse, cv_humanBuildPoints},
268 271
 	{ &g_humanBuildQueueTime,         "g_humanBuildQueueTime",         DEFAULT_HUMAN_QUEUE_TIME,           CVAR_ARCHIVE,                                    0, qfalse           },
269  
-	{ &g_humanRepeaterBuildPoints,    "g_humanRepeaterBuildPoints",    DEFAULT_HUMAN_REPEATER_BUILDPOINTS, CVAR_ARCHIVE,                                    0, qfalse           },
  272
+	{ &g_humanRepeaterBuildPoints,    "g_humanRepeaterBuildPoints",    DEFAULT_HUMAN_REPEATER_BUILDPOINTS, CVAR_ARCHIVE,                                    0, qfalse, cv_humanRepeaterBuildPoints},
270 273
 	{ &g_humanRepeaterMaxZones,       "g_humanRepeaterMaxZones",       DEFAULT_HUMAN_REPEATER_MAX_ZONES,   CVAR_ARCHIVE,                                    0, qfalse           },
271 274
 	{ &g_humanRepeaterBuildQueueTime, "g_humanRepeaterBuildQueueTime", DEFAULT_HUMAN_REPEATER_QUEUE_TIME,  CVAR_ARCHIVE,                                    0, qfalse           },
272 275
 	{ &g_humanStage,                  "g_humanStage",                  "0",                                0,                                               0, qfalse           },
9  src/gamelogic/gpp/src/game/g_spawn.c
@@ -621,6 +621,15 @@ void SP_worldspawn( void )
621 621
 		trap_Cvar_Set( "g_alienMaxStage", s );
622 622
 	}
623 623
 
  624
+	if ( G_SpawnString( "humanRepeaterBuildPoints", "", &s ) )
  625
+		trap_Cvar_Set( "g_humanRepeaterBuildPoints", s );
  626
+
  627
+	if ( G_SpawnString( "humanBuildPoints", "", &s ) )
  628
+		trap_Cvar_Set( "g_humanBuildPoints", s );
  629
+
  630
+	if ( G_SpawnString( "alienBuildPoints", "", &s ) )
  631
+		trap_Cvar_Set( "g_alienBuildPoints", s );
  632
+
624 633
 	G_SpawnString( "disabledEquipment", "", &s );
625 634
 	trap_Cvar_Set( "g_disabledEquipment", s );
626 635
 

0 notes on commit 5008ce8

Please sign in to comment.
Something went wrong with that request. Please try again.