summaryrefslogtreecommitdiff
path: root/src/game/g_combat.c
diff options
context:
space:
mode:
authorBen Millwood <thebenmachine@gmail.com>2009-10-03 11:39:12 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:15:12 +0000
commita13e8058f45894a05f3f9d086e42ed1b16b12694 (patch)
tree6b912f5ccdc8349427580163200ddbd2c60f8769 /src/game/g_combat.c
parent9be2d1add7fe8a18d1e7dc20bd25c33f0cd03ad2 (diff)
Credit based stages
Diffstat (limited to 'src/game/g_combat.c')
-rw-r--r--src/game/g_combat.c20
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,