From 1f58b66a75ffd928689aa1689a5745901bf6475d Mon Sep 17 00:00:00 2001 From: avirox Date: Mon, 16 Jan 2006 21:13:43 +0000 Subject: [PATCH] - Fixed most body damage death messages - Added ability to change class while dead - Added back the pain animation - Added crouch animation for players mid-air git-svn-id: svn://svn.icculus.org/nexuiz/trunk@840 f962a42d-fe04-0410-a3ab-8c8b0445ebaa --- TeamNexuiz/game/gamec/cl_client.c | 2 ++ TeamNexuiz/game/gamec/cl_player.c | 7 ++++++- TeamNexuiz/game/gamec/class.c | 6 +++--- TeamNexuiz/game/gamec/g_damage.c | 8 ++++---- TeamNexuiz/game/gamec/tfcombat.c | 33 +++++++++++++++++++++++++++++++ TeamNexuiz/game/gamec/w_common.c | 22 +++++++++++---------- 6 files changed, 60 insertions(+), 18 deletions(-) diff --git a/TeamNexuiz/game/gamec/cl_client.c b/TeamNexuiz/game/gamec/cl_client.c index 24547a55f..f9ba71e94 100644 --- a/TeamNexuiz/game/gamec/cl_client.c +++ b/TeamNexuiz/game/gamec/cl_client.c @@ -1302,6 +1302,8 @@ void SV_ParseClientCommand (string s) { self.playermodel = strcat("models/class/",cname,"_mechanical.zym"); } + if (self.is_dead == 1) // if player is dead, can change class + CheckForClassChange(); } } else // if no class is chosen diff --git a/TeamNexuiz/game/gamec/cl_player.c b/TeamNexuiz/game/gamec/cl_player.c index afb180fb1..6154f4d9d 100644 --- a/TeamNexuiz/game/gamec/cl_player.c +++ b/TeamNexuiz/game/gamec/cl_player.c @@ -135,7 +135,12 @@ void player_anim (void) self.frame = $idle; if (!(self.flags & FL_ONGROUND)) - self.frame = $jump; + { + if (self.crouch) + self.frame = $duckwalk; + else + self.frame = $jump; + } } //End change by Supajoe on 11:44 PM EST 11/16/03 (Subject: Player animations) diff --git a/TeamNexuiz/game/gamec/class.c b/TeamNexuiz/game/gamec/class.c index 68193931b..9d8cf4ea5 100644 --- a/TeamNexuiz/game/gamec/class.c +++ b/TeamNexuiz/game/gamec/class.c @@ -290,10 +290,10 @@ float CheckForClassChange() // don't monitor the player's model when he's dead. // this means he can change class when dead and respawn as the new class. - if(self.health <= 0) // fixme: or if player is an observer - return 0; + //if(self.health <= 0) // fixme: or if player is an observer + // return 0; - //bprint("healthy\n"); + bprint("healthy\n"); if(self.playermodel == self.mdl) return 0; // haven't changed models since last legitimate change diff --git a/TeamNexuiz/game/gamec/g_damage.c b/TeamNexuiz/game/gamec/g_damage.c index 4b26940c6..e82a5cafd 100644 --- a/TeamNexuiz/game/gamec/g_damage.c +++ b/TeamNexuiz/game/gamec/g_damage.c @@ -100,17 +100,17 @@ void Obituary (entity attacker, entity targ, float deathtypeN) // Renamed "death else if (deathtypeN == RAILGUN_HEADSHOT) bprint ("^1",s, "'s head gets blown away by ", attacker.netname, "'s railgun shot\n"); else if (deathtypeN == RAILGUN_CHESTSHOT) - bprint ("^1",s, " gets shot in the chese by ", attacker.netname, "'s railgun shot\n"); + bprint ("^1",s, " gets shot in the chest by ", attacker.netname, "'s railgun shot\n"); else if (deathtypeN == RAILGUN_BODYSHOT) bprint ("^1",s, " is swiss-cheesed by ", attacker.netname, "'s railgun shot\n"); else if (deathtypeN == RAILGUN_LEGSHOT) bprint ("^1",s, "'s legs are blown off by ", attacker.netname, "'s railgun shot\n"); else if (deathtypeN == PISTOL_LEGSHOT) - bprint ("^1",s, " knee-caps ", attacker.netname, " with his postol\n"); + bprint ("^1",s, " is knee-capped by ", attacker.netname, "'s pistol\n"); else if (deathtypeN == PISTOL_BODYSHOT) - bprint ("^1",s, " is hot up by ", attacker.netname, "'s postol\n"); + bprint ("^1",s, " is shot up by ", attacker.netname, "'s pistol\n"); else if (deathtypeN == PISTOL_HEADSHOT) - bprint ("^1",s, "'s head is popped by ", attacker.netname, "'s postol\n"); + bprint ("^1",s, "'s head is popped by ", attacker.netname, "'s pistol\n"); else bprint ("^1",s, " was killed by ", attacker.netname, "\n"); diff --git a/TeamNexuiz/game/gamec/tfcombat.c b/TeamNexuiz/game/gamec/tfcombat.c index 21a35e345..af76f66be 100644 --- a/TeamNexuiz/game/gamec/tfcombat.c +++ b/TeamNexuiz/game/gamec/tfcombat.c @@ -154,6 +154,26 @@ void (entity targ, entity inflictor, entity attacker, float damage) T_Damage = } return; }*/ + if (targ.pain_finished < time) //Don't switch pain sequences like crazy + { + if (random() > 0.5) + targ.pain_frame = $pain1; + else + targ.pain_frame = $pain2; + targ.pain_finished = time + 0.5; //Supajoe + } + if(targ.class == CLASS_MEDIC) + { + if(deathmsg == DEATH_BURNING) + damage = 0; // being on fire or near burning targets does nothing to medics + // the flame thrower, flame rockets, and hotbombs also do minimal damage + else if(deathmsg == WEP_FLAMER || + deathmsg == WEP_ROCKET_INCENDIARY || + deathmsg == WEP_HOTBOMBS) + damage = damage * cvar("g_balance_class_medic_flame_takedamage"); + } + + if (!targ.takedamage) { return; @@ -265,6 +285,19 @@ void (entity targ, entity inflictor, entity attacker, float damage) T_Damage = targ.armorvalue = targ.armorvalue - damagearmor; DelayArmorRegen(targ); + // if being telefragged or killed by a death trigger etc, don't block that +/* if(PlayerShouldDie(inflictor, attacker, damage, deathtype)) + { + if(take < damage) + take = damage; // deal full damage + } + else + {*/ + // keep the damage the armor allowed through, and further reduce it if the player is using the shield + if(targ.class == CLASS_SCOUT) + take = SpecialShieldProtect(take); +// } + if (((take < 1) && (take != 0))) { take = 1; diff --git a/TeamNexuiz/game/gamec/w_common.c b/TeamNexuiz/game/gamec/w_common.c index f2a412345..e1ba64055 100644 --- a/TeamNexuiz/game/gamec/w_common.c +++ b/TeamNexuiz/game/gamec/w_common.c @@ -555,6 +555,7 @@ void FireRailgunBullet (vector start, vector end, float bdamage, float deathtype { sprint (trace_ent, "Leg injury!\n"); sprint (self, "Leg shot - that'll slow him down!\n"); + deathmsg = RAILGUN_LEGSHOT; } } //return; @@ -712,7 +713,7 @@ float (entity a, vector start, vector end, float flt, entity b) FindBodyDamage = // TeamFortress_SetSpeed (trace_ent); return LEGSHOT; } - if ((trace_ent.health > 0)) +/* if ((trace_ent.health > 0)) { if ((trace_ent.team_no == self.team_no)) { @@ -723,7 +724,7 @@ float (entity a, vector start, vector end, float flt, entity b) FindBodyDamage = sprint (trace_ent, "Leg injury!\n"); sprint (self, "Leg shot - that'll slow him down!\n"); } - } + }*/ } else { @@ -733,11 +734,11 @@ float (entity a, vector start, vector end, float flt, entity b) FindBodyDamage = stuffcmd (trace_ent, "bf\n"); if ((trace_ent.health > 0)) { - if ((trace_ent.team_no == self.team_no)) + /*if ((trace_ent.team_no == self.team_no)) { sprint (self, "Stop shooting team mates!!!\n"); } - else + else*/ { trace_ent.head_shot_vector = (trace_ent.origin - self.origin); deathmsg = 29; @@ -759,12 +760,13 @@ float (entity a, vector start, vector end, float flt, entity b) FindBodyDamage = } } else { // Damage standing enemy - if (zdif < 0) +// if (zdif < 0) + if (zdif < 3) { dam_mult = 0.5; if ((trace_ent.team_no != self.team_no)) { - trace_ent.leg_damage = (trace_ent.leg_damage + 1); + //trace_ent.leg_damage = (trace_ent.leg_damage + 1); // no leg dmg? // TeamFortress_SetSpeed (trace_ent); return LEGSHOT; } @@ -789,11 +791,11 @@ float (entity a, vector start, vector end, float flt, entity b) FindBodyDamage = stuffcmd (trace_ent, "bf\n"); if ((trace_ent.health > 0)) { - if ((trace_ent.team_no == self.team_no)) + /*if ((trace_ent.team_no == self.team_no)) { sprint (self, "Stop shooting team mates!!!\n"); } - else + else*/ { trace_ent.head_shot_vector = (trace_ent.origin - self.origin); if (zdif > 31) @@ -829,12 +831,12 @@ void fireBullet2 (vector start, vector dir, float spread, float damage, float dt end = start + dir * 4096; traceline_hitcorpse (self, start, end, FALSE, self); - if (dtype = WEP_PISTOL) // if pistol weapon, apply area damage + if (dtype == WEP_PISTOL) // if pistol weapon, apply area damage { bdamage = FindBodyDamage (self, start, end, FALSE, self); if (bdamage == HEADSHOT) { - damage = damage * 3; + damage = damage * 2.5; dtype = PISTOL_HEADSHOT; } else if (bdamage == LEGSHOT) -- 2.39.2