diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/g_active.c | 8 | ||||
-rw-r--r-- | src/game/g_buildable.c | 8 | ||||
-rw-r--r-- | src/game/g_combat.c | 11 |
3 files changed, 22 insertions, 5 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c index a6d99691..a8888b50 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -795,8 +795,14 @@ void ClientTimerActions( gentity_t *ent, int msec ) } } - if( ent->health > client->ps.stats[ STAT_MAX_HEALTH ] ) + if( ent->health >= client->ps.stats[ STAT_MAX_HEALTH ] ) + { + int i; ent->health = client->ps.stats[ STAT_MAX_HEALTH ]; + for( i = 0; i < MAX_CLIENTS; i++ ) + ent->credits[ i ] = 0; + } + } // turn off life support when a team admits defeat diff --git a/src/game/g_buildable.c b/src/game/g_buildable.c index 46630229..33c1ca96 100644 --- a/src/game/g_buildable.c +++ b/src/game/g_buildable.c @@ -2475,8 +2475,14 @@ void G_BuildableThink( gentity_t *ent, int msec ) } } - if( ent->health > bHealth ) + if( ent->health >= bHealth ) + { + int i; ent->health = bHealth; + for( i = 0; i < MAX_CLIENTS; i++ ) + ent->credits[ i ] = 0; + } + } if( ent->lev1Grabbed && ent->lev1GrabTime + LEVEL1_GRAB_TIME < level.time ) diff --git a/src/game/g_combat.c b/src/game/g_combat.c index 3d2bcb21..cc2cb07a 100644 --- a/src/game/g_combat.c +++ b/src/game/g_combat.c @@ -138,7 +138,7 @@ Returns the total damage dealt. float G_RewardAttackers( gentity_t *self ) { float value, totalDamage = 0; - int team, i; + int team, i, maxHealth = 0; // Total up all the damage done by every client for( i = 0; i < MAX_CLIENTS; i++ ) @@ -152,6 +152,7 @@ float G_RewardAttackers( gentity_t *self ) { value = BG_GetValueOfPlayer( &self->client->ps ); team = self->client->pers.teamSelection; + maxHealth = self->client->ps.stats[ STAT_MAX_HEALTH ]; } else if( self->s.eType == ET_BUILDABLE ) { @@ -165,6 +166,7 @@ float G_RewardAttackers( gentity_t *self ) } team = self->buildableTeam; + maxHealth = BG_Buildable( self->s.modelindex )->health; } else return totalDamage; @@ -174,6 +176,9 @@ float G_RewardAttackers( gentity_t *self ) { gentity_t *player = g_entities + i; short num = value * self->credits[ i ] / totalDamage; + int stageValue = num; + if( totalDamage < maxHealth ) + stageValue *= totalDamage / maxHealth; if( !player->client || !self->credits[ i ] || player->client->ps.stats[ STAT_TEAM ] == team ) @@ -182,9 +187,9 @@ float G_RewardAttackers( gentity_t *self ) // add to stage counters if( player->client->ps.stats[ STAT_TEAM ] == TEAM_ALIENS ) - trap_Cvar_Set( "g_alienCredits", va( "%d", g_alienCredits.integer + num ) ); + trap_Cvar_Set( "g_alienCredits", va( "%d", g_alienCredits.integer + stageValue ) ); else if( player->client->ps.stats[ STAT_TEAM ] == TEAM_HUMANS ) - trap_Cvar_Set( "g_humanCredits", va( "%d", g_humanCredits.integer + num ) ); + trap_Cvar_Set( "g_humanCredits", va( "%d", g_humanCredits.integer + stageValue ) ); self->credits[ i ] = 0; } |