/* =============== buildFire =============== */ void buildFire( gentity_t *ent, dynMenu_t menu ) { //TODO find a solution to move dependency of ent->s.number and &ent->eventTime outside this function playerState_t *ps=&ent->client->ps; buildable_t buildable = ( ps->stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ); if ( buildable > BA_NONE ) { if ( ps->stats[ STAT_MISC ] > 0 ) { G_AddPlayerEvent( ps, EV_BUILD_DELAY, ps->clientNum, ent->s.number, &ent->eventTime ); return; } if ( G_BuildIfValid( ent, buildable ) ) { if ( !g_cheats.integer ) { ps->stats[ STAT_MISC ] += BG_Buildable( buildable )->buildTime; } ps->stats[ STAT_BUILDABLE ] = BA_NONE; } return; } G_TriggerMenu( ps->clientNum, menu ); }
/* =============== buildFire =============== */ void buildFire( gentity_t *ent, dynMenu_t menu ) { buildable_t buildable = ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ); if( buildable > BA_NONE ) { if( ent->client->ps.stats[ STAT_BUILD_TIMER ] > 0 ) { G_AddEvent( ent, EV_BUILD_DELAY, ent->client->ps.clientNum ); return; } if( G_BuildIfValid( ent, buildable ) ) { if( !g_cheats.integer ) { ent->client->ps.stats[ STAT_BUILD_TIMER ] += BG_Buildable( buildable )->buildTime; } ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE; } return; } G_TriggerMenu( ent->client->ps.clientNum, menu ); }
static void FireBuild( gentity_t *self, dynMenu_t menu ) { buildable_t buildable; if ( !self->client ) { return; } buildable = (buildable_t) ( self->client->ps.stats[ STAT_BUILDABLE ] & SB_BUILDABLE_MASK ); // open build menu if ( buildable <= BA_NONE ) { G_TriggerMenu( self->client->ps.clientNum, menu ); return; } // can't build just yet if ( self->client->ps.stats[ STAT_MISC ] > 0 ) { G_AddEvent( self, EV_BUILD_DELAY, self->client->ps.clientNum ); return; } // build if ( G_BuildIfValid( self, buildable ) ) { if ( !g_cheats.integer ) { int buildTime = BG_Buildable( buildable )->buildTime; switch ( self->client->ps.persistant[ PERS_TEAM ] ) { case TEAM_ALIENS: buildTime *= ALIEN_BUILDDELAY_MOD; break; case TEAM_HUMANS: buildTime *= HUMAN_BUILDDELAY_MOD; break; default: break; } self->client->ps.stats[ STAT_MISC ] += buildTime; } self->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE; } }
/* =============== buildFire =============== */ void buildFire( gentity_t *ent, dynMenu_t menu ) { if( ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) > BA_NONE ) { if( ent->client->ps.stats[ STAT_MISC ] > 0 ) { G_AddEvent( ent, EV_BUILD_DELAY, ent->client->ps.clientNum ); return; } if( G_BuildIfValid( ent, ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) ) { if( g_cheats.integer ) { ent->client->ps.stats[ STAT_MISC ] = 0; } else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS && !G_IsOvermindBuilt( ) ) { ent->client->ps.stats[ STAT_MISC ] += BG_FindBuildDelayForWeapon( ent->s.weapon ) * 2; } else if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS && !G_IsPowered( muzzle ) && ( ent->client->ps.stats[ STAT_BUILDABLE ] & ~SB_VALID_TOGGLEBIT ) != BA_H_REPEATER ) //hack { ent->client->ps.stats[ STAT_MISC ] += BG_FindBuildDelayForWeapon( ent->s.weapon ) * 2; } else ent->client->ps.stats[ STAT_MISC ] += BG_FindBuildDelayForWeapon( ent->s.weapon ); ent->client->ps.stats[ STAT_BUILDABLE ] = BA_NONE; // don't want it bigger than 32k if( ent->client->ps.stats[ STAT_MISC ] > 30000 ) ent->client->ps.stats[ STAT_MISC ] = 30000; } return; } G_TriggerMenu( ent->client->ps.clientNum, menu ); }