diff options
author | Petr Pudlak <petr.mvd@gmail.com> | 2014-08-19 22:24:50 +0200 |
---|---|---|
committer | Petr Pudlak <petr.mvd@gmail.com> | 2014-08-19 22:24:50 +0200 |
commit | 943539a1a7741d395667f2830b31cfdfea5e0816 (patch) | |
tree | e76f922ef468a6230cb97e26f5a72d135eca0e67 /src/game/g_active.c | |
parent | a7ca0aa8c8a66adce30b8ac21d4849b91e4fc75b (diff) |
The head-shot mod: headshots on humans splash blood around
.. using the particle system. Blood drops splat on impact.
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 ); |