summaryrefslogtreecommitdiff
path: root/src/game/g_combat.c
diff options
context:
space:
mode:
authorMichael Levin <risujin@fastmail.fm>2009-10-03 11:18:02 +0000
committerTim Angus <tim@ngus.net>2013-01-03 00:14:51 +0000
commit6bff95c5978a0d4e0cb7e99232a1e61678fcf81b (patch)
tree6a6788b2b51c50707bc7f2dbdccb8cc40aab4e9c /src/game/g_combat.c
parent75002f6c61b3e7e3521819df0216d52c14374520 (diff)
* Per Lakitu7's suggestion, changed spectator bounding box to match the dretch bounding box. Prevents spectators from getting stuck in the floor.
* Buildables round their health up when encoding health information for transmission, no more 0 hp buildables that aren't dead * Removed the devmap credits hack I put in earlier * Can now use \itemact weapon to switch to weapon, also \itemact weapon/blaster will not repeatedly force a weapon change if that weapon is already selected * Options menu entry for "Sprint" changed to "Sprint / Dodge" with correct bind (+button6) Norfenstein decided to switch to fractional "frags" (aka evos) for Aliens: * BG_ClassCanEvolveFromTo rewritten to be more robust in case classes are shuffled around later * CG_AtHighestClass and BG_UpgradeClassAvailable merged into BG_AlienCanEvolve * Changed BG_GetValueOfHuman to BG_GetValueOfPlayer which now accomodates Aliens too * Aliens now must receive 400 credits per frag point (9 evos = 3600 credits!) * Aliens can only spend whole points * TK/Suicide penalties moved to tremulous.h and converted to credit values * Complex nasty Alien land goes bye-bye
Diffstat (limited to 'src/game/g_combat.c')
-rw-r--r--src/game/g_combat.c112
1 files changed, 15 insertions, 97 deletions
diff --git a/src/game/g_combat.c b/src/game/g_combat.c
index 3991adf4..6acc12e2 100644
--- a/src/game/g_combat.c
+++ b/src/game/g_combat.c
@@ -210,9 +210,9 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
//punish team kills and suicides
if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- G_AddCreditToClient( attacker->client, -1, qtrue );
+ G_AddCreditToClient( attacker->client, -ALIEN_TK_SUICIDE_PENALTY, qtrue );
else if( attacker->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
- G_AddCreditToClient( attacker->client, -ASPAWN_VALUE, qtrue );
+ G_AddCreditToClient( attacker->client, -HUMAN_TK_SUICIDE_PENALTY, qtrue );
}
else
{
@@ -237,109 +237,27 @@ void player_die( gentity_t *self, gentity_t *inflictor, gentity_t *attacker, int
trap_Cvar_Set( "g_humanKills", va( "%d", g_humanKills.integer + 1 ) );
}
+ // distribute rewards for the kill by fraction of damage dealt
if( totalDamage > 0.0f )
{
- if( self->client->ps.stats[ STAT_PTEAM ] == PTE_ALIENS )
- {
- //nice simple happy bouncy human land
- float classValue = BG_FindValueOfClass( self->client->ps.stats[ STAT_PCLASS ] );
-
- for( i = 0; i < MAX_CLIENTS; i++ )
- {
- player = g_entities + i;
-
- if( !player->client )
- continue;
+ float value = BG_GetValueOfPlayer( &self->client->ps );
- if( player->client->ps.stats[ STAT_PTEAM ] != PTE_HUMANS )
- continue;
-
- if( !self->credits[ i ] )
- continue;
-
- //add credit
- G_AddCreditToClient( player->client,
- (int)( classValue * ( (float)self->credits[ i ] / totalDamage ) ), qtrue );
- }
- }
- else if( self->client->ps.stats[ STAT_PTEAM ] == PTE_HUMANS )
+ for( i = 0; i < MAX_CLIENTS; i++ )
{
- //horribly complex nasty alien land
- float humanValue = BG_GetValueOfHuman( &self->client->ps );
- int frags;
- int unclaimedFrags = (int)humanValue;
-
- for( i = 0; i < MAX_CLIENTS; i++ )
- {
- player = g_entities + i;
-
- if( !player->client )
- continue;
+ player = g_entities + i;
- if( player->client->ps.stats[ STAT_PTEAM ] != PTE_ALIENS )
- continue;
-
- //this client did no damage
- if( !self->credits[ i ] )
- continue;
-
- //nothing left to claim
- if( !unclaimedFrags )
- break;
-
- frags = (int)floor( humanValue * ( (float)self->credits[ i ] / totalDamage ) );
-
- if( frags > 0 )
- {
- //add kills
- G_AddCreditToClient( player->client, frags, qtrue );
-
- //can't revist this account later
- self->credits[ i ] = 0;
+ if( !player->client )
+ continue;
- //reduce frags left to be claimed
- unclaimedFrags -= frags;
- }
- }
+ if( player->client->ps.stats[ STAT_PTEAM ] ==
+ self->client->ps.stats[ STAT_PTEAM ] )
+ continue;
- //there are frags still to be claimed
- if( unclaimedFrags )
- {
- //the clients remaining at this point do not
- //have enough credit to claim even one frag
- //so simply give the top <unclaimedFrags> clients
- //a frag each
+ if( !self->credits[ i ] )
+ continue;
- for( i = 0; i < unclaimedFrags; i++ )
- {
- int maximum = 0;
- int topClient = 0;
-
- for( j = 0; j < MAX_CLIENTS; j++ )
- {
- //this client did no damage
- if( !self->credits[ j ] )
- continue;
-
- if( self->credits[ j ] > maximum )
- {
- maximum = self->credits[ j ];
- topClient = j;
- }
- }
-
- if( maximum > 0 )
- {
- player = g_entities + topClient;
-
- //add kills
- G_AddCreditToClient( player->client, 1, qtrue );
-
- //can't revist this account again
- self->credits[ topClient ] = 0;
- }
- }
- }
+ G_AddCreditToClient( player->client,
+ value * self->credits[ i ] / totalDamage, qtrue );
}
}