diff options
Diffstat (limited to 'src/game')
-rw-r--r-- | src/game/bg_public.h | 4 | ||||
-rw-r--r-- | src/game/g_buildable.c | 46 | ||||
-rw-r--r-- | src/game/g_cmds.c | 8 | ||||
-rw-r--r-- | src/game/g_main.c | 13 |
4 files changed, 40 insertions, 31 deletions
diff --git a/src/game/bg_public.h b/src/game/bg_public.h index d67d5a90..70652f23 100644 --- a/src/game/bg_public.h +++ b/src/game/bg_public.h @@ -522,7 +522,9 @@ typedef enum MN_HBUILD, MN_MCU, MN_INFEST, - MN_NOROOM, + MN_DNOROOM, + MN_HNOROOM, + MN_HNOPOWER, MN_NOCREEP, MN_REACTOR, MN_MCUPOWER diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 286b792a..b8ddc67c 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -24,6 +24,7 @@ #include "g_local.h" +#define REFRESH_TIME 2000 /* ================ @@ -41,6 +42,9 @@ qboolean findPower( gentity_t *self ) int minDistance = 10000; vec3_t temp_v; + //reset parent + self->parentNode = NULL; + for ( i = 1, ent = g_entities + i; i < level.num_entities; i++, ent++ ) { if( !Q_stricmp( ent->classname, "team_human_reactor" ) || @@ -60,29 +64,27 @@ qboolean findPower( gentity_t *self ) !Q_stricmp( closestPower->classname, "team_human_reactor" ) && ( minDistance <= REACTOR_BASESIZE ) ) - || + || ( !Q_stricmp( closestPower->classname, "team_human_repeater" ) && + !Q_stricmp( self->classname, "team_human_spawn" ) && ( minDistance <= REPEATER_BASESIZE ) && - closestPower->active + closestPower->powered ) - || + || ( !Q_stricmp( closestPower->classname, "team_human_repeater" ) && - !Q_stricmp( self->classname, "team_human_spawn" ) && - ( minDistance <= REPEATER_BASESIZE ) + ( minDistance <= REPEATER_BASESIZE ) && + closestPower->active && + closestPower->powered ) ) { - self->powered = qtrue; self->parentNode = closestPower; return qtrue; } else - { - self->powered = qfalse; return qfalse; - } } /* @@ -280,16 +282,19 @@ void HRpt_Think( gentity_t *self ) { if( !Q_stricmp( ent->classname, "team_human_spawn" ) && ent->parentNode == self ) count++; + if( !Q_stricmp( ent->classname, "team_human_reactor" ) ) reactor = qtrue; } if( count && reactor ) - self->active = self->powered = qtrue; + self->active = qtrue; else - self->active = self->powered = qfalse; + self->active = qfalse; - self->nextthink = level.time + 10000; + self->powered = reactor; + + self->nextthink = level.time + REFRESH_TIME; } /* @@ -318,14 +323,13 @@ Think for mcu */ void HMCU_Think( gentity_t *self ) { - self->nextthink = level.time + 1000; + self->nextthink = level.time + REFRESH_TIME; if( ( self->parentNode == NULL ) || !self->parentNode->inuse || !self->parentNode->active ) { - if( !findPower( self ) ) - self->nextthink = level.time + 10000; + self->powered = !findPower( self ); } } @@ -490,9 +494,10 @@ void HDef1_Think( gentity_t *self ) !self->parentNode->inuse || !self->parentNode->active ) { - if( !findPower( self ) ) + self->powered = findPower( self ); + if( !self->powered ) { - self->nextthink = level.time + 10000; + self->nextthink = level.time + REFRESH_TIME; return; } } @@ -559,14 +564,13 @@ Think for human spawn */ void HSpawn_Think( gentity_t *self ) { - self->nextthink = level.time + 1000; - + self->nextthink = level.time + REFRESH_TIME; + if( ( self->parentNode == NULL ) || !self->parentNode->inuse || !self->parentNode->active ) { - if( !findPower( self ) ) - self->nextthink = level.time + 10000; + self->powered = findPower( self ); } } diff --git a/src/game/g_cmds.c b/src/game/g_cmds.c index 7735ee12..228a0af1 100644 --- a/src/game/g_cmds.c +++ b/src/game/g_cmds.c @@ -1929,7 +1929,7 @@ void Cmd_Build_f( gentity_t *ent ) break; case IBE_NOROOM: - G_AddPredictableEvent( ent, EV_MENU, MN_NOROOM ); + G_AddPredictableEvent( ent, EV_MENU, MN_DNOROOM ); break; } } @@ -1955,7 +1955,11 @@ void Cmd_Build_f( gentity_t *ent ) break; case IBE_NOROOM: - G_AddPredictableEvent( ent, EV_MENU, MN_NOROOM ); + G_AddPredictableEvent( ent, EV_MENU, MN_HNOROOM ); + break; + + case IBE_NOPOWER: + G_AddPredictableEvent( ent, EV_MENU, MN_HNOPOWER ); break; } } diff --git a/src/game/g_main.c b/src/game/g_main.c index 4da1a4b1..897a1c89 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -818,6 +818,12 @@ void calculateBuildPoints( void ) } } } + + 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 ) ); } @@ -938,12 +944,6 @@ void CalculateRanks( void ) { } } - 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 ) ); - // set the CS_SCORES1/2 configstrings, which will be visible to everyone if ( g_gametype.integer >= GT_TEAM ) { trap_SetConfigstring( CS_SCORES1, va("%i", level.teamScores[TEAM_HUMANS] ) ); @@ -1904,7 +1904,6 @@ end = trap_Milliseconds(); //TA: countSpawns(); calculateBuildPoints(); - Com_Printf( "%d %d %d\n", level.humanBuildPointsTotal, level.humanBuildPoints, level.humanBuildPointsPowered ); // see if it is time to end the level CheckExitRules(); |