diff options
Diffstat (limited to 'src/game/g_active.c')
-rw-r--r-- | src/game/g_active.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c index 0ebb30ec..49c23a43 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -676,6 +676,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) { ent->client->medKitHealthToRestore--; ent->health++; + ent->client->ps.stats[ STAT_HEALTH ] = ent->health; } else ent->client->ps.stats[ STAT_STATE ] &= ~SS_HEALING_2X; @@ -691,6 +692,7 @@ void ClientTimerActions( gentity_t *ent, int msec ) { ent->client->medKitHealthToRestore--; ent->health++; + ent->client->ps.stats[ STAT_HEALTH ] = ent->health; client->medKitIncrementTime = level.time + ( remainingStartupTime / MEDKIT_STARTUP_SPEED ); @@ -1462,16 +1464,20 @@ void ClientThink_real( gentity_t *ent ) interval = 1000 / ( regenRate * modifier ); // if recovery interval is less than frametime, compensate count = 1 + ( level.time - ent->nextRegenTime ) / interval; - - ent->health += count; ent->nextRegenTime += count * interval; - // if at max health, clear damage counters - if( ent->health >= client->ps.stats[ STAT_MAX_HEALTH ] ) + if( ent->health < client->ps.stats[ STAT_MAX_HEALTH ] ) { - ent->health = client->ps.stats[ STAT_MAX_HEALTH ]; - for( i = 0; i < MAX_CLIENTS; i++ ) - ent->credits[ i ] = 0; + ent->health += count; + client->ps.stats[ STAT_HEALTH ] = ent->health; + + // if at max health, clear damage counters + if( ent->health >= client->ps.stats[ STAT_MAX_HEALTH ] ) + { + ent->health = client->ps.stats[ STAT_HEALTH ] = client->ps.stats[ STAT_MAX_HEALTH ]; + for( i = 0; i < MAX_CLIENTS; i++ ) + ent->credits[ i ] = 0; + } } } } @@ -1845,12 +1851,6 @@ void ClientEndFrame( gentity_t *ent ) else ent->s.eFlags &= ~EF_CONNECTION; - if( ent->client->ps.stats[ STAT_HEALTH ] != ent->health ) - { - ent->client->ps.stats[ STAT_HEALTH ] = ent->health; // FIXME: get rid of ent->health... - ent->client->pers.infoChangeTime = level.time; - } - // respawn if dead if( ent->client->ps.stats[ STAT_HEALTH ] <= 0 && level.time >= ent->client->respawnTime ) respawn( ent ); |