From 42f7c82029e148ed30c7d46d653919094747adb1 Mon Sep 17 00:00:00 2001 From: Marco Cawthorne Date: Wed, 6 Mar 2024 19:09:40 -0800 Subject: [PATCH] FX_Corpse: transfer player bbox to corpse, so we can handle crouching etc. --- src/server/gamerules_multiplayer.qc | 7 ++++++- src/shared/fx_corpse.qc | 8 ++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/server/gamerules_multiplayer.qc b/src/server/gamerules_multiplayer.qc index 87171f0..679db5c 100644 --- a/src/server/gamerules_multiplayer.qc +++ b/src/server/gamerules_multiplayer.qc @@ -158,7 +158,12 @@ HLMultiplayerRules::PlayerDeath(NSClientPlayer pl) break; } - FX_Corpse_Spawn((player)pl, deathAnimation); + NSEntity newCorpse = (NSEntity)FX_Corpse_Spawn((player)pl, deathAnimation); + + /* if we were crouching, adjust the bbox (thx 2 lack of crouch death animation) */ + if (pl.flags & FL_CROUCHING) { + newCorpse.SetSize(VEC_HULL_MIN, [16, 16, -16]); + } } /* now let's make the real client invisible */ diff --git a/src/shared/fx_corpse.qc b/src/shared/fx_corpse.qc index 34614c9..37abeb2 100644 --- a/src/shared/fx_corpse.qc +++ b/src/shared/fx_corpse.qc @@ -58,6 +58,9 @@ entity FX_Corpse_Spawn(player pl, float anim) { NSRenderableEntity body_next = (NSRenderableEntity)FX_Corpse_Next(); + body_next.SetMovetype(MOVETYPE_BOUNCE); + body_next.SetSolid(SOLID_CORPSE); + body_next.SetModel(pl.GetModel()); if (pl.flags & FL_CROUCHING) { body_next.SetOrigin(pl.GetOrigin() + [0,0,32]); @@ -65,10 +68,7 @@ FX_Corpse_Spawn(player pl, float anim) body_next.SetOrigin(pl.GetOrigin()); } - body_next.SetMovetype(MOVETYPE_BOUNCE); - body_next.SetSolid(SOLID_CORPSE); - body_next.SetModel(pl.GetModel()); - body_next.SetSize(VEC_HULL_MIN, [16, 16, -16]); + body_next.SetSize(pl.GetMins(), pl.GetMaxs()); body_next.SetAngles(pl.GetAngles()); body_next.SetVelocity(pl.GetVelocity() + [0,0,120]); body_next.SetFrame(anim);