summaryrefslogtreecommitdiff
path: root/src/game/g_active.c
diff options
context:
space:
mode:
authorIronClawTrem <louie.nutman@gmail.com>2019-08-27 01:15:15 +0100
committerIronClawTrem <louie.nutman@gmail.com>2019-08-27 01:19:50 +0100
commit1c970daca1c62539325df935b7afce0ecc08823b (patch)
tree3dd1bed6ba84a98d5280f67e50fb405385c45749 /src/game/g_active.c
parentdef759fd4110b4f58ea54f3024fec5bf9112b4c2 (diff)
Implement g_gradualFreeFunds to improve time funds mechanic
Diffstat (limited to 'src/game/g_active.c')
-rw-r--r--src/game/g_active.c47
1 files changed, 37 insertions, 10 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c
index f171617..b5df273 100644
--- a/src/game/g_active.c
+++ b/src/game/g_active.c
@@ -1407,6 +1407,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
@@ -1852,16 +1888,7 @@ void ClientThink_real( gentity_t *ent )
}
// Give clients some credit periodically
- if( ent->client->lastKillTime + FREEKILL_PERIOD < level.time )
- {
- if( !g_suddenDeath.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->lastKillTime = level.time;
- }
+ ClientGradualFunds( ent );
// perform once-a-second actions
ClientTimerActions( ent, msec );