diff options
-rw-r--r-- | src/game/g_buildable.c | 42 | ||||
-rw-r--r-- | src/game/g_local.h | 10 | ||||
-rw-r--r-- | src/game/g_main.c | 48 |
3 files changed, 51 insertions, 49 deletions
diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 7052a67e..40bdefcc 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -243,8 +243,8 @@ qboolean G_FindPower( gentity_t *self ) } } - if( self->usesZone && level.powerZones[ ent->zone ].active ) - buildPoints -= level.powerZones[ ent->zone ].queuedBuildPoints; + if( self->usesBuildPointZone && level.buildPointZones[ ent->buildPointZone ].active ) + buildPoints -= level.buildPointZones[ ent->buildPointZone ].queuedBuildPoints; buildPoints -= BG_Buildable( self->s.modelindex )->buildPoints; @@ -362,10 +362,10 @@ int G_GetBuildPoints( const vec3_t pos, team_t team, int extraDistance ) return level.humanBuildPoints; if( powerPoint && powerPoint->s.modelindex == BA_H_REPEATER && - powerPoint->usesZone && level.powerZones[ powerPoint->zone ].active ) + powerPoint->usesBuildPointZone && level.buildPointZones[ powerPoint->buildPointZone ].active ) { - return level.powerZones[ powerPoint->zone ].totalBuildPoints - - level.powerZones[ powerPoint->zone ].queuedBuildPoints; + return level.buildPointZones[ powerPoint->buildPointZone ].totalBuildPoints - + level.buildPointZones[ powerPoint->buildPointZone ].queuedBuildPoints; } // Return the BP of the main zone by default @@ -406,9 +406,9 @@ int G_GetBuildPoints( const vec3_t pos, team_t team, int extraDistance ) } else if( ent->s.modelindex == BA_H_REPEATER && distance <= REPEATER_BASESIZE + extraDistance ) { - if( ent->usesZone && level.powerZones[ent->zone].active ) + if( ent->usesBuildPointZone && level.buildPointZones[ent->buildPointZone].active ) { - zone_t *zone = &level.powerZones[ent->zone]; + buildPointZone_t *zone = &level.buildPointZones[ent->buildPointZone]; zoneFound = qtrue; @@ -1820,12 +1820,12 @@ static void HRepeater_Die( gentity_t *self, gentity_t *inflictor, gentity_t *att G_LogDestruction( self, attacker, mod ); - if( self->usesZone ) + if( self->usesBuildPointZone ) { - zone_t *zone = &level.powerZones[self->zone]; + buildPointZone_t *zone = &level.buildPointZones[self->buildPointZone]; zone->active = qfalse; - self->usesZone = qfalse; + self->usesBuildPointZone = qfalse; } } @@ -1838,10 +1838,10 @@ Think for human power repeater */ void HRepeater_Think( gentity_t *self ) { - int i; - qboolean reactor = qfalse; - gentity_t *ent; - zone_t *zone; + int i; + qboolean reactor = qfalse; + gentity_t *ent; + buildPointZone_t *zone; if( self->spawned ) { @@ -1865,12 +1865,12 @@ void HRepeater_Think( gentity_t *self ) self->powered = reactor; // Initialise the zone once the repeater has spawned - if( self->spawned && ( !self->usesZone || !level.powerZones[ self->zone ].active ) ) + if( self->spawned && ( !self->usesBuildPointZone || !level.buildPointZones[ self->buildPointZone ].active ) ) { // See if a free zone exists for( i = 0; i < g_humanRepeaterMaxZones.integer; i++ ) { - zone = &level.powerZones[ i ]; + zone = &level.buildPointZones[ i ]; if( !zone->active ) { @@ -1879,8 +1879,8 @@ void HRepeater_Think( gentity_t *self ) zone->nextQueueTime = level.time; zone->active = qtrue; - self->zone = zone - level.powerZones; - self->usesZone = qtrue; + self->buildPointZone = zone - level.buildPointZones; + self->usesBuildPointZone = qtrue; break; } @@ -2673,10 +2673,10 @@ void G_QueueBuildPoints( gentity_t *self ) break; case BA_H_REPEATER: - if( powerEntity->usesZone && - level.powerZones[ powerEntity->zone ].active ) + if( powerEntity->usesBuildPointZone && + level.buildPointZones[ powerEntity->buildPointZone ].active ) { - zone_t *zone = &level.powerZones[ powerEntity->zone ]; + buildPointZone_t *zone = &level.buildPointZones[ powerEntity->buildPointZone ]; nqt = G_NextQueueTime( zone->queuedBuildPoints, zone->totalBuildPoints, diff --git a/src/game/g_local.h b/src/game/g_local.h index ba47dcbc..46a75c62 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -250,8 +250,8 @@ struct gentity_s qboolean pointAgainstWorld; // don't use the bbox for map collisions - int zone; // index for zone - int usesZone; // does it use a zone? + int buildPointZone; // index for zone + int usesBuildPointZone; // does it use a zone? }; typedef enum @@ -469,7 +469,7 @@ void G_PrintSpawnQueue( spawnQueue_t *sq ); #define MAX_DAMAGE_REGION_TEXT 8192 #define MAX_DAMAGE_REGIONS 16 -// power zone +// build point zone typedef struct { int active; @@ -477,7 +477,7 @@ typedef struct int totalBuildPoints; int queuedBuildPoints; int nextQueueTime; -} zone_t; +} buildPointZone_t; // store locational damage regions typedef struct damageRegion_s @@ -603,7 +603,7 @@ typedef struct int humanBuildPointQueue; int humanNextQueueTime; - zone_t *powerZones; + buildPointZone_t *buildPointZones; gentity_t *markedBuildables[ MAX_GENTITIES ]; int numBuildablesForRemoval; diff --git a/src/game/g_main.c b/src/game/g_main.c index 4450b96f..d1eb0c68 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -1071,9 +1071,9 @@ Recalculate the quantity of building points available to the teams */ void G_CalculateBuildPoints( void ) { - int i; - buildable_t buildable; - zone_t *zone; + int i; + buildable_t buildable; + buildPointZone_t *zone; // BP queue updates while( level.alienBuildPointQueue > 0 && @@ -1148,10 +1148,10 @@ void G_CalculateBuildPoints( void ) level.humanBuildPoints = g_humanBuildPoints.integer - level.humanBuildPointQueue; level.alienBuildPoints = g_alienBuildPoints.integer - level.alienBuildPointQueue; - // Reset powerZones + // Reset buildPointZones for( i = 0; i < g_humanRepeaterMaxZones.integer; i++ ) { - zone_t *zone = &level.powerZones[ i ]; + buildPointZone_t *zone = &level.buildPointZones[ i ]; zone->active = qfalse; zone->totalBuildPoints = g_humanRepeaterBuildPoints.integer; @@ -1160,20 +1160,20 @@ void G_CalculateBuildPoints( void ) // Iterate through entities for( i = MAX_CLIENTS; i < level.num_entities; i++ ) { - gentity_t *ent = &g_entities[ i ]; - zone_t *zone; - buildable_t buildable; - int cost; + gentity_t *ent = &g_entities[ i ]; + buildPointZone_t *zone; + buildable_t buildable; + int cost; if( ent->s.eType != ET_BUILDABLE || ent->s.eFlags & EF_DEAD ) continue; // mark a zone as active - if( ent->usesZone ) + if( ent->usesBuildPointZone ) { - assert( ent->zone >= 0 && ent->zone < g_humanRepeaterMaxZones.integer ); + assert( ent->buildPointZone >= 0 && ent->buildPointZone < g_humanRepeaterMaxZones.integer ); - zone = &level.powerZones[ ent->zone ]; + zone = &level.buildPointZones[ ent->buildPointZone ]; zone->active = qtrue; } @@ -1193,8 +1193,8 @@ void G_CalculateBuildPoints( void ) { if( power->s.modelindex == BA_H_REACTOR ) level.humanBuildPoints -= cost; - else if( power->s.modelindex == BA_H_REPEATER && power->usesZone ) - level.powerZones[ power->zone ].totalBuildPoints -= cost; + else if( power->s.modelindex == BA_H_REPEATER && power->usesBuildPointZone ) + level.buildPointZones[ power->buildPointZone ].totalBuildPoints -= cost; } } } @@ -1214,9 +1214,9 @@ void G_CalculateBuildPoints( void ) if( buildable != BA_H_REPEATER ) continue; - if( ent->usesZone && level.powerZones[ ent->zone ].active ) + if( ent->usesBuildPointZone && level.buildPointZones[ ent->buildPointZone ].active ) { - zone = &level.powerZones[ ent->zone ]; + zone = &level.buildPointZones[ ent->buildPointZone ]; if( !level.suddenDeath ) { @@ -2368,16 +2368,18 @@ void CheckCvars( void ) // If the number of zones changes, we need a new array if( g_humanRepeaterMaxZones.integer != lastNumZones ) { - zone_t *newZones; - size_t newsize = g_humanRepeaterMaxZones.integer * sizeof( zone_t ); - size_t oldsize = lastNumZones * sizeof( zone_t ); + buildPointZone_t *newZones; + size_t newsize = g_humanRepeaterMaxZones.integer * sizeof( buildPointZone_t ); + size_t oldsize = lastNumZones * sizeof( buildPointZone_t ); + newZones = BG_Alloc( newsize ); - if( level.powerZones ) + if( level.buildPointZones ) { - Com_Memcpy( newZones, level.powerZones, MIN( oldsize, newsize ) ); - BG_Free( level.powerZones ); + Com_Memcpy( newZones, level.buildPointZones, MIN( oldsize, newsize ) ); + BG_Free( level.buildPointZones ); } - level.powerZones = newZones; + + level.buildPointZones = newZones; lastNumZones = g_humanRepeaterMaxZones.integer; } |