diff options
author | Ben Millwood <thebenmachine@gmail.com> | 2009-10-03 11:39:12 +0000 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2013-01-03 00:15:12 +0000 |
commit | a13e8058f45894a05f3f9d086e42ed1b16b12694 (patch) | |
tree | 6b912f5ccdc8349427580163200ddbd2c60f8769 /src/game/g_combat.c | |
parent | 9be2d1add7fe8a18d1e7dc20bd25c33f0cd03ad2 (diff) |
Credit based stages
Diffstat (limited to 'src/game/g_combat.c')
-rw-r--r-- | src/game/g_combat.c | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 31c80bd1..74feaa2c 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -165,12 +165,19 @@ float G_RewardAttackers( gentity_t *self ) for( i = 0; i < MAX_CLIENTS; i++ ) { gentity_t *player = g_entities + i; + short num = value * self->credits[ i ] / totalDamage; if( !player->client || !self->credits[ i ] || player->client->ps.stats[ STAT_PTEAM ] == team ) continue; - G_AddCreditToClient( player->client, - value * self->credits[ i ] / totalDamage, qtrue ); + G_AddCreditToClient( player->client, num, qtrue ); + + // add to stage counters + if( player->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) + trap_Cvar_Set( "g_alienCredits", va( "%d", g_alienCredits.integer + num ) ); + else if( player->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) + trap_Cvar_Set( "g_humanCredits", va( "%d", g_humanCredits.integer + num ) ); + self->credits[ i ] = 0; } @@ -274,15 +281,6 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int // give credits for killing this player totalDamage = G_RewardAttackers( self ); - // if players did more than DAMAGE_FRACTION_FOR_KILL increment the stage counters - if( !OnSameTeam( self, attacker ) && totalDamage >= ( self->client->ps.stats[ STAT_MAX_HEALTH ] * DAMAGE_FRACTION_FOR_KILL ) ) - { - if( self->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS ) - trap_Cvar_Set( "g_alienKills", va( "%d", g_alienKills.integer + 1 ) ); - else if( self->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS ) - trap_Cvar_Set( "g_humanKills", va( "%d", g_humanKills.integer + 1 ) ); - } - ScoreboardMessage( self ); // show scores // send updated scores to any clients that are following this one, |