diff options
author | Roman Tetelman <kevlarman@gmail.com> | 2009-10-03 13:07:38 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:16:29 +0000 |
commit | 8230fd582a135ac6d83cea335895657c283f923c (patch) | |
tree | bf8a6365a1c554253e6ba8699669bbb4d66fecc4 /src | |
parent | 993c2651e6ad67a052927afa859a4837f4238737 (diff) |
Fix camper credits
* The time clients are alive is recorded in seconds.
* Award free funds regardless of death. Funds will be given
- when the client is alive every g_freeFundPeriod if
g_freeFundPeriod is positive (otherwise no free funds are
given).
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_active.c | 29 | ||||
-rw-r--r-- | src/game/g_client.c | 1 | ||||
-rw-r--r-- | src/game/g_local.h | 6 | ||||
-rw-r--r-- | src/game/g_main.c | 4 | ||||
-rw-r--r-- | src/game/tremulous.h | 2 |
5 files changed, 20 insertions, 22 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c index 097370d2..318ed915 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -741,6 +741,20 @@ void ClientTimerActions( gentity_t *ent, int msec ) client->voiceEnthusiasm -= VOICE_ENTHUSIASM_DECAY; else client->voiceEnthusiasm = 0.0f; + + client->pers.aliveSeconds++; + if( g_freeFundPeriod.integer > 0 && + client->pers.aliveSeconds % g_freeFundPeriod.integer == 0 ) + { + // Give clients some credit periodically + if( G_TimeTilSuddenDeath( ) > 0 ) + { + if( client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) + G_AddCreditToClient( client, FREEKILL_ALIEN, qtrue ); + else if( client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) + G_AddCreditToClient( client, FREEKILL_HUMAN, qtrue ); + } + } } while( client->time10000 >= 10000 ) @@ -1748,21 +1762,6 @@ void ClientThink_real( gentity_t *ent ) if( client->ps.persistant[ PERS_BP ] < 0 ) client->ps.persistant[ PERS_BP ] = 0; - // Give clients some credit periodically - if( ent->client->lastKillTime + g_freeKillPeriod.integer < level.time ) - { - if( G_TimeTilSuddenDeath( ) <= 0 ) - { - //gotta love logic like this eh? - } - else if( ent->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) - G_AddCreditToClient( ent->client, FREEKILL_ALIEN, qtrue ); - else if( ent->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) - G_AddCreditToClient( ent->client, FREEKILL_HUMAN, qtrue ); - - ent->client->lastKillTime = level.time; - } - // perform once-a-second actions ClientTimerActions( ent, msec ); diff --git a/src/game/g_client.c b/src/game/g_client.c index 911d9792..1f1f7029 100644 --- a/src/game/g_client.c +++ b/src/game/g_client.c @@ -1605,7 +1605,6 @@ void ClientSpawn( gentity_t *ent, gentity_t *spawn, vec3_t origin, vec3_t angles client->ps.pm_time = 100; client->respawnTime = level.time; - client->lastKillTime = level.time; ent->nextRegenTime = level.time; client->inactivityTime = level.time + g_inactivity.integer * 1000; diff --git a/src/game/g_local.h b/src/game/g_local.h index 9d82c72b..05b9701b 100644 --- a/src/game/g_local.h +++ b/src/game/g_local.h @@ -318,6 +318,8 @@ typedef struct qboolean joinedATeam; // used to tell when a PTR code is valid connectionRecord_t *connection; + int aliveSeconds; // time player has been alive in seconds + int nameChangeTime; int nameChanges; @@ -399,8 +401,6 @@ struct gclient_s int airOutTime; - int lastKillTime; // for multiple kill rewards - qboolean fireHeld; // used for hook qboolean fire2Held; // used for alt fire gentity_t *hook; // grapple hook if out @@ -1097,7 +1097,7 @@ extern vmCvar_t g_alienCredits; extern vmCvar_t g_alienMaxStage; extern vmCvar_t g_alienStage2Threshold; extern vmCvar_t g_alienStage3Threshold; -extern vmCvar_t g_freeKillPeriod; +extern vmCvar_t g_freeFundPeriod; extern vmCvar_t g_unlagged; diff --git a/src/game/g_main.c b/src/game/g_main.c index cc11ee5c..8d350202 100644 --- a/src/game/g_main.c +++ b/src/game/g_main.c @@ -104,7 +104,7 @@ vmCvar_t g_alienCredits; vmCvar_t g_alienMaxStage; vmCvar_t g_alienStage2Threshold; vmCvar_t g_alienStage3Threshold; -vmCvar_t g_freeKillPeriod; +vmCvar_t g_freeFundPeriod; vmCvar_t g_unlagged; @@ -243,7 +243,7 @@ static cvarTable_t gameCvarTable[ ] = { &g_alienMaxStage, "g_alienMaxStage", DEFAULT_ALIEN_MAX_STAGE, 0, 0, qfalse }, { &g_alienStage2Threshold, "g_alienStage2Threshold", DEFAULT_ALIEN_STAGE2_THRESH, 0, 0, qfalse }, { &g_alienStage3Threshold, "g_alienStage3Threshold", DEFAULT_ALIEN_STAGE3_THRESH, 0, 0, qfalse }, - { &g_freeKillPeriod, "g_freeKillPeriod", DEFAULT_FREEKILL_PERIOD, CVAR_ARCHIVE, 0, qtrue }, + { &g_freeFundPeriod, "g_freeFundPeriod", DEFAULT_FREEKILL_PERIOD, CVAR_ARCHIVE, 0, qtrue }, { &g_unlagged, "g_unlagged", "1", CVAR_SERVERINFO | CVAR_ARCHIVE, 0, qfalse }, diff --git a/src/game/tremulous.h b/src/game/tremulous.h index 8f66ac24..465f56c3 100644 --- a/src/game/tremulous.h +++ b/src/game/tremulous.h @@ -657,7 +657,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #define MAX_FALL_DISTANCE 120.0f //the fall distance at which maximum damage is dealt #define AVG_FALL_DISTANCE ((MIN_FALL_DISTANCE+MAX_FALL_DISTANCE)/2.0f) -#define DEFAULT_FREEKILL_PERIOD "120000" //msec +#define DEFAULT_FREEKILL_PERIOD "120" //seconds #define FREEKILL_ALIEN ALIEN_CREDITS_PER_KILL #define FREEKILL_HUMAN LEVEL0_VALUE |