diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/cgame/cg_draw.c | 8 | ||||
-rw-r--r-- | src/game/g_active.c | 30 | ||||
-rw-r--r-- | src/game/g_buildable.c | 31 | ||||
-rw-r--r-- | src/game/g_local.h | 4 | ||||
-rw-r--r-- | src/game/g_main.c | 21 | ||||
-rw-r--r-- | src/game/g_weapon.c | 16 |
6 files changed, 78 insertions, 32 deletions
diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index eb098793..6ca952e0 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -731,6 +731,10 @@ static void CG_DrawPlayerClipsRing( rectDef_t *rect, vec4_t color, qhandle_t sha case WP_HBUILD: case WP_HBUILD2: maxDelay = (float)BG_FindBuildDelayForWeapon( cent->currentState.weapon ); + + if( buildTime > maxDelay ) + buildTime = maxDelay; + progress = ( maxDelay - buildTime ) / maxDelay; color[ 3 ] = HH_MIN_ALPHA + ( progress * HH_ALPHA_DIFF ); @@ -768,6 +772,10 @@ static void CG_DrawPlayerBuildTimerRing( rectDef_t *rect, vec4_t color, qhandle_ cent = &cg_entities[ cg.snap->ps.clientNum ]; maxDelay = (float)BG_FindBuildDelayForWeapon( cent->currentState.weapon ); + + if( buildTime > maxDelay ) + buildTime = maxDelay; + progress = ( maxDelay - buildTime ) / maxDelay; color[ 3 ] = AH_MIN_ALPHA + ( progress * AH_ALPHA_DIFF ); diff --git a/src/game/g_active.c b/src/game/g_active.c index 0bbe5c82..dc00b0a7 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -369,6 +369,21 @@ void SpectatorThink( gentity_t *ent, usercmd_t *ucmd ) G_TriggerMenu( client->ps.clientNum, MN_H_SPAWN ); } } + + //set the queue position for the client side + if( client->ps.pm_flags & PMF_QUEUED ) + { + if( client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + { + client->ps.persistant[ PERS_QUEUEPOS ] = + G_GetPosInSpawnQueue( &level.alienSpawnQueue, client->ps.clientNum ); + } + else if( client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + { + client->ps.persistant[ PERS_QUEUEPOS ] = + G_GetPosInSpawnQueue( &level.humanSpawnQueue, client->ps.clientNum ); + } + } } if( ( client->buttons & BUTTON_USE_HOLDABLE ) && !( client->oldbuttons & BUTTON_USE_HOLDABLE ) ) @@ -986,21 +1001,6 @@ void ClientThink_real( gentity_t *ent ) } } - //set the queue position for the client side - if( client->ps.pm_flags & PMF_QUEUED ) - { - if( client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) - { - client->ps.persistant[ PERS_QUEUEPOS ] = - G_GetPosInSpawnQueue( &level.alienSpawnQueue, client->ps.clientNum ); - } - else if( client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) - { - client->ps.persistant[ PERS_QUEUEPOS ] = - G_GetPosInSpawnQueue( &level.humanSpawnQueue, client->ps.clientNum ); - } - } - // set speed client->ps.speed = g_speed.value * BG_FindSpeedForClass( client->ps.stats[ STAT_PCLASS ] ); diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index f8e83826..ad3b4c29 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -177,12 +177,12 @@ static qboolean findPower( gentity_t *self ) /* ================ -isPower +G_isPower -simple wrapper to findPower to check if a location has power +Simple wrapper to findPower to check if a location has power ================ */ -static qboolean isPower( vec3_t origin ) +qboolean G_isPower( vec3_t origin ) { gentity_t dummy; @@ -251,12 +251,12 @@ static qboolean findDCC( gentity_t *self ) /* ================ -isDCC +G_isDCC simple wrapper to findDCC to check for a dcc ================ */ -static qboolean isDCC( ) +qboolean G_isDCC( void ) { gentity_t dummy; @@ -307,6 +307,23 @@ static qboolean findOvermind( gentity_t *self ) /* ================ +G_isOvermind + +Simple wrapper to findOvermind to check if a location has an overmind +================ +*/ +qboolean G_isOvermind( void ) +{ + gentity_t dummy; + + dummy.overmindNode = NULL; + dummy.biteam = BIT_ALIENS; + + return findOvermind( &dummy ); +} + +/* +================ findCreep attempt to find creep for self, return qtrue if successful @@ -2374,7 +2391,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) { //human criteria - if( !isPower( entity_origin ) ) + if( !G_isPower( entity_origin ) ) { //tell player to build a repeater to provide power if( buildable != BA_H_REACTOR && buildable != BA_H_REPEATER ) @@ -2386,7 +2403,7 @@ itemBuildError_t G_itemFits( gentity_t *ent, buildable_t buildable, int distance } //this buildable requires a DCC - if( BG_FindDCCTestForBuildable( buildable ) && !isDCC( ) ) + if( BG_FindDCCTestForBuildable( buildable ) && !G_isDCC( ) ) reason = IBE_NODCC; //check that there is a parent reactor when building a repeater diff --git a/src/game/g_local.h b/src/game/g_local.h index 38d7f6b6..8d891279 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -608,6 +608,10 @@ typedef enum qboolean AHovel_Blocked( gentity_t *hovel, gentity_t *player, qboolean provideExit ); gentity_t *G_CheckSpawnPoint( vec3_t origin, vec3_t normal, buildable_t spawn, vec3_t spawnOrigin ); + +qboolean G_isPower( vec3_t origin ); +qboolean G_isDCC( void ); +qboolean G_isOvermind( void ); void G_BuildableThink( gentity_t *ent, int msec ); qboolean G_BuildableRange( vec3_t origin, float r, buildable_t buildable ); diff --git a/src/game/g_main.c b/src/game/g_main.c index c5546168..0fd433b7 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -717,13 +717,15 @@ Remove from front element from a spawn queue */ int G_PopSpawnQueue( spawnQueue_t *sq ) { - int popee = sq->front; + int clientNum = sq->clients[ sq->front ]; if( G_GetSpawnQueueLength( sq ) > 0 ) { + sq->clients[ sq->front ] = -1; sq->front = QUEUE_PLUS1( sq->front ); - g_entities[ sq->clients[ popee ] ].client->ps.pm_flags &= ~PMF_QUEUED; - return sq->clients[ popee ]; + g_entities[ clientNum ].client->ps.pm_flags &= ~PMF_QUEUED; + + return clientNum; } else return -1; @@ -769,7 +771,7 @@ qboolean G_RemoveFromSpawnQueue( spawnQueue_t *sq, int clientNum ) sq->clients[ i ] = sq->clients[ QUEUE_PLUS1( i ) ]; i = QUEUE_PLUS1( i ); - } while( i != sq->back ); + } while( i != QUEUE_PLUS1( sq->back ) ); sq->back = QUEUE_MINUS1( sq->back ); g_entities[ clientNum ].client->ps.pm_flags &= ~PMF_QUEUED; @@ -802,9 +804,9 @@ int G_GetPosInSpawnQueue( spawnQueue_t *sq, int clientNum ) if( sq->clients[ i ] == clientNum ) { if( i < sq->front ) - return i + MAX_CLIENTS - sq->front + 1; + return i + MAX_CLIENTS - sq->front; else - return i - sq->front + 1; + return i - sq->front; } i = QUEUE_PLUS1( i ); @@ -826,13 +828,16 @@ void G_PrintSpawnQueue( spawnQueue_t *sq ) int i = sq->front; int length = G_GetSpawnQueueLength( sq ); - G_Printf( "l: %d f: %d b: %d c: ", length, sq->front, sq->back ); + G_Printf( "l:%d f:%d b:%d :", length, sq->front, sq->back ); if( length > 0 ) { do { - G_Printf( "%d ", sq->clients[ i ] ); + if( sq->clients[ i ] == -1 ) + G_Printf( "*:" ); + else + G_Printf( "%d:", sq->clients[ i ] ); i = QUEUE_PLUS1( i ); } while( i != QUEUE_PLUS1( sq->back ) ); diff --git a/src/game/g_weapon.c b/src/game/g_weapon.c index 1aa7504c..9b6eb706 100644 --- a/src/game/g_weapon.c +++ b/src/game/g_weapon.c @@ -631,8 +631,20 @@ void buildFire( gentity_t *ent, dynMenu_t menu ) if( G_ValidateBuild( ent, ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) ) { ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE; - ent->client->ps.stats[ STAT_MISC ] += - BG_FindBuildDelayForWeapon( ent->s.weapon ); + + if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS && !G_isOvermind( ) ) + { + ent->client->ps.stats[ STAT_MISC ] += + BG_FindBuildDelayForWeapon( ent->s.weapon ) * 2; + } + else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS && !G_isPower( muzzle ) ) + { + ent->client->ps.stats[ STAT_MISC ] += + BG_FindBuildDelayForWeapon( ent->s.weapon ) * 2; + } + else + ent->client->ps.stats[ STAT_MISC ] += + BG_FindBuildDelayForWeapon( ent->s.weapon ); } return; } |