From 72f8c5784f8e9c53d3ade7438f2c43af5a1f9a77 Mon Sep 17 00:00:00 2001 From: avirox Date: Sun, 29 Jan 2006 14:16:28 +0000 Subject: [PATCH] - Health no longer regenerates for targets with 2 HP or less - Tried to fix bug where players with 2 health see the dead player view offset quickly and then see the normal offset. git-svn-id: svn://svn.icculus.org/nexuiz/trunk@915 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- TeamNexuiz/game/gamec/cl_client.c | 2 +- TeamNexuiz/game/gamec/cl_player.c | 42 +++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/TeamNexuiz/game/gamec/cl_client.c b/TeamNexuiz/game/gamec/cl_client.c index 2bb1ba552..f778e3be1 100644 --- a/TeamNexuiz/game/gamec/cl_client.c +++ b/TeamNexuiz/game/gamec/cl_client.c @@ -919,7 +919,7 @@ void player_powerups (void) void player_regen_health (float maxh, float regen_rate_mod) { - if (self.health < maxh && time > self.health_regen_delay) + if (self.health < maxh && time > self.health_regen_delay && self.health > 2) // dont regen is HP is 2 self.health = bound(0, self.health + regen_rate_mod*(maxh- self.health) * cvar("g_balance_health_regen") * frametime, 1000); } void player_rot_health (float maxh, float rot_rate_mod) diff --git a/TeamNexuiz/game/gamec/cl_player.c b/TeamNexuiz/game/gamec/cl_player.c index 82456e674..7bef241f0 100644 --- a/TeamNexuiz/game/gamec/cl_player.c +++ b/TeamNexuiz/game/gamec/cl_player.c @@ -365,6 +365,48 @@ void PlayerDamage (entity inflictor, entity attacker, float damage, float deatht if (self.health <= 2) { PlayerKilled(FALSE, inflictor, attacker, damage, deathtype, hitloc, force); + + // make the corpse upright (not tilted) + self.angles_x = 0; + self.angles_z = 0; + // don't spin + self.avelocity = '0 0 0'; + // no weapon when dead + self.weaponmodel = ""; + w_clear(); + // view from the floor + self.view_ofs = '0 0 -8'; + // toss the corpse + self.movetype = MOVETYPE_TOSS; + // shootable corpse + self.solid = SOLID_CORPSE; + // don't stick to the floor + self.flags = self.flags - (self.flags & FL_ONGROUND); + // dying animation + self.deadflag = DEAD_DYING; + // when to allow respawn + self.death_time = time + 0.5; + // when to switch to the dead_frame + self.dead_time = time + 2; + if (random() < 0.5) + { + self.die_frame = $die1; + self.dead_frame = $dead1; + } + else + { + self.die_frame = $die2; + self.dead_frame = $dead2; + } + // start the animation + player_anim(); + // set damage function to corpse damage + self.event_damage = PlayerCorpseDamage; + // call the corpse damage function just in case it wants to gib + self.event_damage(inflictor, attacker, 0, deathtype, hitloc, force); + // set up to fade out later + SUB_SetFade (self, time + 12 + random () * 4, 1); + } } -- 2.39.2