diff options
author | Paweł Redman <pawel.redman@gmail.com> | 2017-04-13 11:30:00 +0000 |
---|---|---|
committer | /dev/humancontroller <devhc@example.com> | 2017-04-15 17:24:20 +0200 |
commit | 90094e0e71e05b155a6a1edb1835607e1202a8bc (patch) | |
tree | 166fded6a2a5ddb99eeff239efa5379679c28679 /src/game/g_active.c | |
parent | ecdfd00b5bff42afacd4f5267bdef9ae61bfc154 (diff) |
Improve g_gradualFreeFunds.
g_gradualFreeFunds values:
0 - disabled
1 - vanilla behavior
2 - 1 and counters don't reset on death or evolution
3 - 2 and funds are given even during SD
Diffstat (limited to 'src/game/g_active.c')
-rw-r--r-- | src/game/g_active.c | 47 |
1 files changed, 37 insertions, 10 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c index e909ca6..ec92c97 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -1534,6 +1534,42 @@ static void G_UnlaggedDetectCollisions( gentity_t *ent ) /* ============== +ClientGradualFunds + +g_gradualFreeFunds values: +0 - disabled +1 - vanilla behavior +2 - 1 and counters don't reset on death or evolution +3 - 2 and funds are given even during SD +============== +*/ +static void ClientGradualFunds( gentity_t *ent ) +{ + if( !g_gradualFreeFunds.integer ) + return; + + if( ent->client->pers.lastFreekillTime + FREEKILL_PERIOD >= level.time ) + return; + + if( g_suddenDeath.integer && g_gradualFreeFunds.integer < 3 ) + return; + + switch ( ent->client->ps.stats[ STAT_PTEAM ] ) + { + case PTE_ALIENS: + G_AddCreditToClient( ent->client, FREEKILL_ALIEN, qtrue ); + break; + + case PTE_HUMANS: + G_AddCreditToClient( ent->client, FREEKILL_HUMAN, qtrue ); + break; + } + + ent->client->pers.lastFreekillTime += FREEKILL_PERIOD; +} + +/* +============== ClientThink This will be called once for each client frame, which will @@ -1989,16 +2025,7 @@ void ClientThink_real( gentity_t *ent ) } // Give clients some credit periodically - if( ent->client->pers.lastFreekillTime + FREEKILL_PERIOD < level.time ) - { - if( !g_suddenDeath.integer || g_gradualFreeFunds.integer ) { - if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) - G_AddCreditToClient( ent->client, FREEKILL_ALIEN, qtrue ); - if( ent->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) - G_AddCreditToClient( ent->client, FREEKILL_HUMAN, qtrue ); - } - ent->client->pers.lastFreekillTime += FREEKILL_PERIOD; - } + ClientGradualFunds( ent ); // perform once-a-second actions ClientTimerActions( ent, msec ); |