Skip to content

Commit

Permalink
Corpses A posing (#815)
Browse files Browse the repository at this point in the history
* call SetModel on the player ragdoll after it is created, instead of on the player before the ragdoll is created

* unused import
  • Loading branch information
AdamTadeusz authored Feb 6, 2025
1 parent dcfa687 commit c47a477
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
26 changes: 14 additions & 12 deletions mp/src/game/server/neo/neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ CNEO_Player::CNEO_Player()
m_flLastSuperJumpTime = 0;

m_bFirstDeathTick = true;
m_bCorpseSpawned = false;
m_bCorpseSet = false;
m_bPreviouslyReloading = false;
m_bLastTickInThermOpticCamo = false;
m_bIsPendingSpawnForThisRound = false;
Expand Down Expand Up @@ -540,7 +540,7 @@ void CNEO_Player::Spawn(void)
m_bInVision = false;
m_nVisionLastTick = 0;
m_bInLean = NEO_LEAN_NONE;
m_bCorpseSpawned = false;
m_bCorpseSet = false;
m_bAllowGibbing = true;
m_bIneligibleForLoadoutPick = false;

Expand Down Expand Up @@ -1637,12 +1637,6 @@ void CNEO_Player::Event_Killed( const CTakeDamageInfo &info )
}
}

// Handle Corpse and Gibs
if (!m_bCorpseSpawned) // Event_Killed can be called multiple times, only spawn the dead model once
{
SpawnDeadModel(info);
}

if (!IsBot() && !IsHLTV())
{
StartShowDmgStats(&info);
Expand All @@ -1654,6 +1648,12 @@ void CNEO_Player::Event_Killed( const CTakeDamageInfo &info )
}

BaseClass::Event_Killed(info);

// Handle Corpse and Gibs
if (!m_bCorpseSet) // Event_Killed can be called multiple times, only set the dead model and spawn gibs once
{
SetDeadModel(info);
}
}

void CNEO_Player::Weapon_DropOnDeath(CBaseCombatWeapon* pWeapon, Vector velocity, CBaseEntity *pAttacker)
Expand Down Expand Up @@ -1708,9 +1708,9 @@ void CNEO_Player::Weapon_DropOnDeath(CBaseCombatWeapon* pWeapon, Vector velocity
Weapon_Detach(pWeapon);
}

void CNEO_Player::SpawnDeadModel(const CTakeDamageInfo& info)
void CNEO_Player::SetDeadModel(const CTakeDamageInfo& info)
{
m_bCorpseSpawned = true;
m_bCorpseSet = true;

int deadModelType = -1;

Expand Down Expand Up @@ -1808,8 +1808,10 @@ void CNEO_Player::SetPlayerCorpseModel(int type)
return;
}

SetModel(model);
SetPlaybackRate(1.0f);
if (m_hRagdoll)
{
m_hRagdoll->SetModel(model);
}
}

float CNEO_Player::GetReceivedDamageScale(CBaseEntity* pAttacker)
Expand Down
4 changes: 2 additions & 2 deletions mp/src/game/server/neo/neo_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class CNEO_Player : public CHL2MP_Player

void GiveLoadoutWeapon(void);
void SetPlayerTeamModel(void);
void SpawnDeadModel(const CTakeDamageInfo& info);
void SetDeadModel(const CTakeDamageInfo& info);
void SetPlayerCorpseModel(int type);
virtual void PickDefaultSpawnTeam(void) OVERRIDE;

Expand Down Expand Up @@ -276,7 +276,7 @@ class CNEO_Player : public CHL2MP_Player

private:
bool m_bFirstDeathTick;
bool m_bCorpseSpawned;
bool m_bCorpseSet;
bool m_bPreviouslyReloading;
bool m_szNeoNameHasSet;

Expand Down

0 comments on commit c47a477

Please sign in to comment.