diff options
author | Mikko Tiusanen <ams@daug.net> | 2014-08-20 20:32:12 +0300 |
---|---|---|
committer | Mikko Tiusanen <ams@daug.net> | 2014-08-20 20:32:12 +0300 |
commit | 613030b05c409cef42b0e98d5180a41f8f67c661 (patch) | |
tree | 480cdbf625d7dcce1bb5477ab1dca6c9d8102106 /src/game/g_active.c | |
parent | 7ad16ee1fea76bab54d97a78c1063b7c2c2adef6 (diff) | |
parent | 0a382e146ac52e111c90ad1e093ade77b710d993 (diff) |
Merge branch 'master' of https://github.com/mtiusane/new-edge
Diffstat (limited to 'src/game/g_active.c')
-rw-r--r-- | src/game/g_active.c | 48 |
1 files changed, 47 insertions, 1 deletions
diff --git a/src/game/g_active.c b/src/game/g_active.c index 2f7f906..3c888a6 100644 --- a/src/game/g_active.c +++ b/src/game/g_active.c @@ -76,8 +76,14 @@ void P_DamageFeedback( gentity_t *player ) // play an apropriate pain sound if( ( level.time > player->pain_debounce_time ) && !( player->flags & FL_GODMODE ) ) { + int param; player->pain_debounce_time = level.time + 700; - G_AddEvent( player, EV_PAIN, player->health > 255 ? 255 : player->health ); + param = player->health; + if( param >= EVENT_HEADSHOT_BIT ) + param = EVENT_HEADSHOT_BIT - 1; + if( client->damage_headshot ) + param |= EVENT_HEADSHOT_BIT; + G_AddEvent( player, EV_PAIN, param ); client->ps.damageEvent++; } @@ -90,11 +96,48 @@ void P_DamageFeedback( gentity_t *player ) client->damage_blood = 0; client->damage_armor = 0; client->damage_knockback = 0; + client->damage_headshot = 0; } /* +=============== +P_WoundsBleed + +=============== +*/ +void P_WoundsBleed( gentity_t *player ) +{ + gclient_t *client; + int maxHealth; + int health; + + if( player->nextBleedTime > level.time ) + return; + + client = player->client; + health = player->health; + maxHealth = client->ps.stats[ STAT_MAX_HEALTH ]; + if( maxHealth > 100 ) + maxHealth = 100; + maxHealth = maxHealth * 3 / 4; + if( ( health > maxHealth ) || ( health < 0 ) ) { + player->nextBleedTime = level.time + 2000; + return; + } + + G_AddEvent( player, EV_BLEED, ( health > 255 ) ? 255 : health ); + + if( health < 20 ) + health = 20; + player->nextBleedTime = level.time + 2000 * health / maxHealth; +} + + + + +/* ============= P_WorldEffects @@ -2292,6 +2335,9 @@ void ClientEndFrame( gentity_t *ent ) // burn from lava, etc P_WorldEffects( ent ); + // bleeding wounds + P_WoundsBleed( ent ); + // apply all the damage taken this frame P_DamageFeedback( ent ); |