diff --git a/src/game/client/c_baseanimating.cpp b/src/game/client/c_baseanimating.cpp index 5e9b73c0ed..6b7a2a563c 100644 --- a/src/game/client/c_baseanimating.cpp +++ b/src/game/client/c_baseanimating.cpp @@ -3271,18 +3271,10 @@ int C_BaseAnimating::DrawModel( int flags ) auto pTargetPlayer = C_NEO_Player::GetVisionTargetNEOPlayer(); const bool inMotionVision = pTargetPlayer->IsInVision() && pTargetPlayer->GetClass() == NEO_CLASS_ASSAULT; auto rootMoveParent = GetRootMoveParent(); - Vector vel; - if (IsRagdoll()) + Vector vel = rootMoveParent->GetAbsVelocity(); + if (vel == vec3_origin) { - vel = m_pRagdoll->m_vecLastVelocity; - } - else - { - vel = rootMoveParent->GetAbsVelocity(); - if (vel == vec3_origin) - { - rootMoveParent->EstimateAbsVelocity(vel); - } + rootMoveParent->EstimateAbsVelocity(vel); } bool isMoving = false; bool isHot = false; diff --git a/src/game/client/hl2mp/c_hl2mp_player.cpp b/src/game/client/hl2mp/c_hl2mp_player.cpp index dc77c0e509..484186b986 100644 --- a/src/game/client/hl2mp/c_hl2mp_player.cpp +++ b/src/game/client/hl2mp/c_hl2mp_player.cpp @@ -1233,6 +1233,9 @@ IMPLEMENT_CLIENTCLASS_DT_NOBASE( C_HL2MPRagdoll, DT_HL2MPRagdoll, CHL2MPRagdoll RecvPropInt( RECVINFO(m_nForceBone) ), RecvPropVector( RECVINFO(m_vecForce) ), RecvPropVector( RECVINFO( m_vecRagdollVelocity ) ) +#ifdef NEO + ,RecvPropInt(RECVINFO(m_iRagdollModel)) +#endif // NEO END_RECV_TABLE() @@ -1241,6 +1244,7 @@ C_HL2MPRagdoll::C_HL2MPRagdoll() { #ifdef NEO m_flNeoCreateTime = gpGlobals->curtime; + m_iRagdollModel = -1; #endif // NEO } @@ -1321,7 +1325,12 @@ void C_HL2MPRagdoll::CreateHL2MPRagdoll( void ) // then we can make ourselves start out exactly where the player is. C_HL2MP_Player *pPlayer = dynamic_cast< C_HL2MP_Player* >( m_hPlayer.Get() ); +#ifdef NEO + SetModelIndex(m_iRagdollModel ? m_iRagdollModel : m_nModelIndex); + if ( pPlayer ) +#else if ( pPlayer && !pPlayer->IsDormant() ) +#endif // NEO { // move my current model instance to the ragdoll's so decals are preserved. pPlayer->SnatchModelInstance( this ); @@ -1330,8 +1339,10 @@ void C_HL2MPRagdoll::CreateHL2MPRagdoll( void ) // Copy all the interpolated vars from the player entity. // The entity uses the interpolated history to get bone velocity. +#ifndef NEO bool bRemotePlayer = (pPlayer != C_BasePlayer::GetLocalPlayer()); if ( bRemotePlayer ) +#endif // NEO { Interp_Copy( pPlayer ); @@ -1342,6 +1353,7 @@ void C_HL2MPRagdoll::CreateHL2MPRagdoll( void ) SetSequence( pPlayer->GetSequence() ); m_flPlaybackRate = pPlayer->GetPlaybackRate(); } +#ifndef NEO else { // This is the local player, so set them in a default @@ -1363,7 +1375,8 @@ void C_HL2MPRagdoll::CreateHL2MPRagdoll( void ) SetCycle( 0.0 ); Interp_Reset( varMap ); - } + } +#endif // NEO } else { @@ -1378,7 +1391,9 @@ void C_HL2MPRagdoll::CreateHL2MPRagdoll( void ) } +#ifndef NEO SetModelIndex( m_nModelIndex ); +#endif // NEO // Make us a ragdoll.. m_nRenderFX = kRenderFxRagdoll; @@ -1406,13 +1421,6 @@ void C_HL2MPRagdoll::CreateHL2MPRagdoll( void ) } InitAsClientRagdoll( boneDelta0, boneDelta1, currentBones, boneDt ); -#ifdef NEO - if (m_pRagdoll) - { - m_pRagdoll->SetInitialVelocity(GetInitialRagdollVelocity()); - m_pRagdoll->SetLastOrigin(GetInitialRagdollOrigin()); - } -#endif // NEO } diff --git a/src/game/client/hl2mp/c_hl2mp_player.h b/src/game/client/hl2mp/c_hl2mp_player.h index 17303638ce..d319c3679f 100644 --- a/src/game/client/hl2mp/c_hl2mp_player.h +++ b/src/game/client/hl2mp/c_hl2mp_player.h @@ -233,6 +233,10 @@ class C_HL2MPRagdoll : public C_BaseAnimatingOverlay EHANDLE m_hPlayer; CNetworkVector( m_vecRagdollVelocity ); CNetworkVector( m_vecRagdollOrigin ); +public: +#ifdef NEO + CNetworkVar(int, m_iRagdollModel); +#endif // NEO }; #endif //HL2MP_PLAYER_H diff --git a/src/game/client/neo/c_neo_player.cpp b/src/game/client/neo/c_neo_player.cpp index f610ee76a3..478ff074b5 100644 --- a/src/game/client/neo/c_neo_player.cpp +++ b/src/game/client/neo/c_neo_player.cpp @@ -1962,11 +1962,7 @@ void C_NEO_Player::PreDataUpdate(DataUpdateType_t updateType) { if (updateType == DATA_UPDATE_DATATABLE_CHANGED) { - if (gpGlobals->tickcount - m_nVisionLastTick < TIME_TO_TICKS(0.1f)) - { - return; - } - else + if (gpGlobals->tickcount - m_nVisionLastTick >= TIME_TO_TICKS(0.1f)) { m_bIsAllowedToToggleVision = true; } diff --git a/src/game/client/neo/ui/neo_hud_friendly_marker.cpp b/src/game/client/neo/ui/neo_hud_friendly_marker.cpp index 214af06ba2..eff25e76b0 100644 --- a/src/game/client/neo/ui/neo_hud_friendly_marker.cpp +++ b/src/game/client/neo/ui/neo_hud_friendly_marker.cpp @@ -13,7 +13,7 @@ #include "neo_gamerules.h" #include "c_neo_player.h" - +#include "c_playerresource.h" #include "c_team.h" // memdbgon must be the last include file in a .cpp file!!! @@ -179,7 +179,7 @@ void CNEOHud_FriendlyMarker::DrawPlayerForTeam(C_Team *team, const C_NEO_Player for (int i = 0; i < memberCount; ++i) { auto player = static_cast(team->GetPlayer(i)); - if (player && localPlayer->entindex() != player->entindex() && player->IsAlive()) + if (player && localPlayer->entindex() != player->entindex() && g_PR->IsAlive(player->entindex())) { if (pTargetPlayer && player->entindex() == pTargetPlayer->entindex()) { diff --git a/src/game/client/proxyplayer.cpp b/src/game/client/proxyplayer.cpp index b9d38ede7d..c8c4fbedbb 100644 --- a/src/game/client/proxyplayer.cpp +++ b/src/game/client/proxyplayer.cpp @@ -275,14 +275,7 @@ void CEntitySpeedProxy::OnBind( void *pC_BaseEntity ) C_BaseAnimating *baseAnimating = pEntity->GetBaseAnimating(); C_BaseEntity *rootMoveParent = pEntity->GetRootMoveParent(); Vector velocity = vec3_origin; - if (baseAnimating && baseAnimating->IsRagdoll()) - { - velocity = baseAnimating->m_pRagdoll->m_vecLastVelocity; - } - else - { - rootMoveParent->EstimateAbsVelocity(velocity); - } + rootMoveParent->EstimateAbsVelocity(velocity); m_pResult->SetFloatValue(velocity.Length()); #else m_pResult->SetFloatValue( pEntity->GetLocalVelocity().Length() ); diff --git a/src/game/client/ragdoll.cpp b/src/game/client/ragdoll.cpp index de2248854c..35a9161787 100644 --- a/src/game/client/ragdoll.cpp +++ b/src/game/client/ragdoll.cpp @@ -257,9 +257,6 @@ bool CRagdoll::TransformVectorToWorld(int iBoneIndex, const Vector *vPosition, V //----------------------------------------------------------------------------- void CRagdoll::PhysForceRagdollToSleep() { -#ifdef NEO - m_vecLastVelocity = vec3_origin; -#endif // NEO for ( int i = 0; i < m_ragdoll.listCount; i++ ) { if ( m_ragdoll.list[i].pObject ) @@ -276,12 +273,6 @@ static ConVar ragdoll_sleepaftertime( "ragdoll_sleepaftertime", "5.0f", 0, "Afte void CRagdoll::CheckSettleStationaryRagdoll() { Vector delta = GetRagdollOrigin() - m_vecLastOrigin; -#ifdef NEO - if (gpGlobals->frametime > 0) - { - m_vecLastVelocity = delta / (gpGlobals->frametime); - } -#endif // NEO m_vecLastOrigin = GetRagdollOrigin(); for ( int i = 0; i < 3; ++i ) { diff --git a/src/game/client/ragdoll.h b/src/game/client/ragdoll.h index f060e38571..5ee9dfcb3b 100644 --- a/src/game/client/ragdoll.h +++ b/src/game/client/ragdoll.h @@ -88,11 +88,6 @@ class CRagdoll : public IRagdoll void ResetRagdollSleepAfterTime( void ); float GetLastVPhysicsUpdateTime() const { return m_lastUpdate; } -#ifdef NEO - void SetInitialVelocity(const Vector& velocity) { m_vecInitialVelocity = velocity; } - void SetLastOrigin(const Vector& velocity) { m_vecLastOrigin = velocity; } - -#endif // NEO private: void CheckSettleStationaryRagdoll(); @@ -106,12 +101,6 @@ class CRagdoll : public IRagdoll bool m_allAsleep; Vector m_vecLastOrigin; float m_flLastOriginChangeTime; -#ifdef NEO -public: - Vector m_vecLastVelocity; -private: - Vector m_vecInitialVelocity; -#endif // NEO #if RAGDOLL_VISUALIZE matrix3x4_t m_savedBone1[MAXSTUDIOBONES]; diff --git a/src/game/server/hl2mp/hl2mp_player.cpp b/src/game/server/hl2mp/hl2mp_player.cpp index d2de71d2cc..5f762d93af 100644 --- a/src/game/server/hl2mp/hl2mp_player.cpp +++ b/src/game/server/hl2mp/hl2mp_player.cpp @@ -1245,6 +1245,9 @@ class CHL2MPRagdoll : public CBaseAnimatingOverlay CNetworkHandle( CBaseEntity, m_hPlayer ); // networked entity handle CNetworkVector( m_vecRagdollVelocity ); CNetworkVector( m_vecRagdollOrigin ); +#ifdef NEO + CNetworkVar(int, m_iRagdollModel) +#endif // NEO }; LINK_ENTITY_TO_CLASS( hl2mp_ragdoll, CHL2MPRagdoll ); @@ -1256,6 +1259,9 @@ IMPLEMENT_SERVERCLASS_ST_NOBASE( CHL2MPRagdoll, DT_HL2MPRagdoll ) SendPropInt ( SENDINFO(m_nForceBone), 8, 0 ), SendPropVector ( SENDINFO(m_vecForce), -1, SPROP_NOSCALE ), SendPropVector( SENDINFO( m_vecRagdollVelocity ) ) +#ifdef NEO + ,SendPropInt ( SENDINFO(m_iRagdollModel)) +#endif // NEO END_SEND_TABLE() @@ -1291,6 +1297,18 @@ void CHL2MP_Player::CreateRagdollEntity( void ) m_hRagdoll = pRagdoll; } +#ifdef NEO +void CHL2MP_Player::SetRagdollModel( const int modelIndex ) +{ + CHL2MPRagdoll *pRagdoll = dynamic_cast< CHL2MPRagdoll* >( m_hRagdoll.Get() ); + + if ( pRagdoll ) + { + pRagdoll->m_iRagdollModel = modelIndex; + } +} +#endif // NEO + //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- int CHL2MP_Player::FlashlightIsOn( void ) @@ -1390,6 +1408,7 @@ void CHL2MP_Player::Event_Killed( const CTakeDamageInfo &info ) BaseClass::Event_Killed( subinfo ); +#ifndef NEO if ( info.GetDamageType() & DMG_DISSOLVE ) { if ( m_hRagdoll ) @@ -1409,10 +1428,9 @@ void CHL2MP_Player::Event_Killed( const CTakeDamageInfo &info ) iScoreToAdd = -1; } -#ifndef NEO GetGlobalTeam( pAttacker->GetTeamNumber() )->AddScore( iScoreToAdd ); -#endif } +#endif FlashlightTurnOff(); diff --git a/src/game/server/hl2mp/hl2mp_player.h b/src/game/server/hl2mp/hl2mp_player.h index 6343c9c15c..1f09ce42c6 100644 --- a/src/game/server/hl2mp/hl2mp_player.h +++ b/src/game/server/hl2mp/hl2mp_player.h @@ -163,6 +163,9 @@ class CHL2MP_Player : public CHL2_Player // Tracks our ragdoll entity. CNetworkHandle( CBaseEntity, m_hRagdoll ); // networked entity handle +#ifdef NEO + void SetRagdollModel(const int modelIndex); +#endif // NEO virtual bool CanHearAndReadChatFrom( CBasePlayer *pPlayer ); diff --git a/src/game/server/neo/neo_model_manager.cpp b/src/game/server/neo/neo_model_manager.cpp index a00df2c923..2500b79f08 100644 --- a/src/game/server/neo/neo_model_manager.cpp +++ b/src/game/server/neo/neo_model_manager.cpp @@ -485,7 +485,7 @@ static inline int GetTeamArrOffset(int iTeam) // Returns a third person corpse, or if defined, a related gib body part. const char* CNEOModelManager::GetCorpseModel(NeoSkin nSkin, NeoClass nClass, - int iTeam, NeoGib nGib) const + int iTeam, NeoGib nGib) { if (nClass == NEO_CLASS_VIP) { @@ -509,7 +509,7 @@ const char* CNEOModelManager::GetCorpseModel(NeoSkin nSkin, NeoClass nClass, // Returns a gib body part. const char* CNEOModelManager::GetGibModel(NeoSkin nSkin, NeoClass nClass, - int iTeam, NeoGibLimb nGib) const + int iTeam, NeoGibLimb nGib) { // NEO FIXME (Rain): Shouldn't we get the "models/nt/vipgib..." variants here? if (nClass == NEO_CLASS_VIP) @@ -541,7 +541,7 @@ const char* CNEOModelManager::GetGibModel(NeoSkin nSkin, NeoClass nClass, // Returns a third person player model. // NEO FIXME (Rain): this is sometimes off. Are we indexing incorrectly, or is the cvar logic flawed? const char *CNEOModelManager::GetPlayerModel(NeoSkin nSkin, - NeoClass nClass, int iTeam) const + NeoClass nClass, int iTeam) { if (nClass == NEO_CLASS_VIP) { @@ -586,7 +586,7 @@ const char *CNEOModelManager::GetPlayerModel(NeoSkin nSkin, } // Returns a first person view model. -const char *CNEOModelManager::GetViewModel(NeoViewmodel nWepVm, int iTeam) const +const char *CNEOModelManager::GetViewModel(NeoViewmodel nWepVm, int iTeam) { if (nWepVm == NEO_VM_VIP_SMAC) { @@ -605,7 +605,7 @@ const char *CNEOModelManager::GetViewModel(NeoViewmodel nWepVm, int iTeam) const } // Returns a third person weapon model. -const char *CNEOModelManager::GetWeaponModel(NeoWeaponModel nWep) const +const char *CNEOModelManager::GetWeaponModel(NeoWeaponModel nWep) { if (nWep < 0 || nWep >= ARRAYSIZE(weapons)) { diff --git a/src/game/server/neo/neo_model_manager.h b/src/game/server/neo/neo_model_manager.h index 1d0d5571cc..c140befa4b 100644 --- a/src/game/server/neo/neo_model_manager.h +++ b/src/game/server/neo/neo_model_manager.h @@ -139,18 +139,18 @@ class CNEOModelManager void Precache(void) const; - const char *GetCorpseModel(NeoSkin nSkin, NeoClass nClass, - int iTeam, NeoGib nGib = NEO_GIB_ALL) const; + static const char *GetCorpseModel(NeoSkin nSkin, NeoClass nClass, + int iTeam, NeoGib nGib = NEO_GIB_ALL); - const char* GetGibModel(NeoSkin nSkin, NeoClass nClass, - int iTeam, NeoGibLimb nGib = NEO_GIB_LIMB_HEAD) const; + static const char* GetGibModel(NeoSkin nSkin, NeoClass nClass, + int iTeam, NeoGibLimb nGib = NEO_GIB_LIMB_HEAD); - const char *GetPlayerModel(NeoSkin nSkin, - NeoClass nClass, int iTeam) const; + static const char *GetPlayerModel(NeoSkin nSkin, + NeoClass nClass, int iTeam); - const char *GetViewModel(NeoViewmodel nWepVm, int iTeam = TEAM_JINRAI) const; + static const char *GetViewModel(NeoViewmodel nWepVm, int iTeam = TEAM_JINRAI); - const char *GetWeaponModel(NeoWeaponModel nWep) const; + static const char *GetWeaponModel(NeoWeaponModel nWep); private: // We are singleton diff --git a/src/game/server/neo/neo_player.cpp b/src/game/server/neo/neo_player.cpp index 29e027c611..99fc3cd719 100644 --- a/src/game/server/neo/neo_player.cpp +++ b/src/game/server/neo/neo_player.cpp @@ -1,5 +1,6 @@ #include "cbase.h" #include "neo_player.h" +#include "hl2mp_player.h" #include "neo_predicted_viewmodel.h" #include "neo_predicted_viewmodel_muzzleflash.h" @@ -39,6 +40,8 @@ #include "neo_player_shared.h" #include "bot/neo_bot.h" +#include + // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" @@ -494,7 +497,6 @@ CNEO_Player::CNEO_Player() m_mapPlayerFogCache.SetLessFunc( DefLessFunc(int) ); m_bFirstDeathTick = true; - m_bCorpseSet = false; m_bPreviouslyReloading = false; m_bLastTickInThermOpticCamo = false; m_bIsPendingSpawnForThisRound = false; @@ -580,7 +582,6 @@ void CNEO_Player::Spawn(void) m_bInVision = false; m_nVisionLastTick = 0; m_bInLean = NEO_LEAN_NONE; - m_bCorpseSet = false; m_bAllowGibbing = true; m_bIneligibleForLoadoutPick = false; @@ -2013,14 +2014,19 @@ void CNEO_Player::AddPoints(int score, bool bAllowNegativeScore, bool bIgnorePla void CNEO_Player::Event_Killed( const CTakeDamageInfo &info ) { + Weapon_DropAllOnDeath(info); + + BaseClass::Event_Killed(info); + if (!m_bForceServerRagdoll && GetClass() != NEO_CLASS_JUGGERNAUT) { CreateRagdollEntity(); } - StopWaterDeathSounds(); + // Handle Corpse and Gibs + SetDeadModel(info); - Weapon_DropAllOnDeath(info); + StopWaterDeathSounds(); if (GetClass() == NEO_CLASS_JUGGERNAUT) { @@ -2037,14 +2043,6 @@ void CNEO_Player::Event_Killed( const CTakeDamageInfo &info ) GetGlobalTeam(NEORules()->GetOpposingTeam(this))->AddScore(1); } - 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); - } - if (sv_neo_bot_cmdr_enable.GetBool()) { // If teamkilled by commander, other subordinates stop following commander @@ -2120,7 +2118,6 @@ void CNEO_Player::Weapon_DropOnDeath(CNEOBaseCombatWeapon* pNeoWeapon, Vector da if (pNeoWeapon->IsEffectActive( EF_BONEMERGE )) { - //int iBIndex = LookupBone("valveBiped.Bip01_R_Hand"); NEOTODO (Adam) Should mimic the behaviour in basecombatcharacter that places the weapon such that the bones used in the bonemerge overlap Vector vFacingDir = BodyDirection2D(); pNeoWeapon->SetAbsOrigin(Weapon_ShootPosition() + vFacingDir); } @@ -2143,90 +2140,47 @@ void CNEO_Player::Weapon_DropOnDeath(CNEOBaseCombatWeapon* pNeoWeapon, Vector da void CNEO_Player::SetDeadModel(const CTakeDamageInfo& info) { - m_bCorpseSet = true; - - int deadModelType = -1; - if (!m_bAllowGibbing || m_bForceServerRagdoll) // Prevent gibbing if a custom player model has been set via I/O or the ragdoll is serverside { return; } + constexpr const int NUM_MODELS_WITHOUT_GIB = 1; + std::map HITGROUP_TO_MODEL = { + {HITGROUP_GENERIC, -1}, + {HITGROUP_HEAD, NEO_GIB_LIMB_HEAD + NUM_MODELS_WITHOUT_GIB}, + {HITGROUP_CHEST, -1}, + {HITGROUP_STOMACH, -1}, + {HITGROUP_LEFTARM, NEO_GIB_LIMB_LARM + NUM_MODELS_WITHOUT_GIB}, + {HITGROUP_RIGHTARM, NEO_GIB_LIMB_RARM + NUM_MODELS_WITHOUT_GIB}, + {HITGROUP_LEFTLEG, NEO_GIB_LIMB_LLEG + NUM_MODELS_WITHOUT_GIB}, + {HITGROUP_RIGHTLEG, NEO_GIB_LIMB_RLEG + NUM_MODELS_WITHOUT_GIB}, + {HITGROUP_GEAR, -1}, + }; + + char deadModelType = HITGROUP_TO_MODEL.contains(LastHitGroup()) ? HITGROUP_TO_MODEL[LastHitGroup()] : -1; if (info.GetDamageType() & DMG_BLAST) { - deadModelType = 0; + deadModelType = NEO_GIB_ALL; } - else - { // Set model based on last hitgroup - switch (LastHitGroup()) - { - case 1: // Head - deadModelType = 1; - break; - case 4: // Left Arm - deadModelType = 2; - break; - case 5: // Right Arm - deadModelType = 4; - break; - case 6: // Left Leg - deadModelType = 3; - break; - case 7: // Right Leg - deadModelType = 5; - break; - } - } - if (deadModelType == -1) return; - CNEOModelManager* modelManager = CNEOModelManager::Instance(); - if (!modelManager) - { - Assert(false); - Warning("Failed to get Neo model manager\n"); - return; - } - - if (deadModelType == 0) + if (deadModelType == NEO_GIB_ALL) { for (int i = 0; i < NEO_GIB_LIMB__ENUM_COUNT; i++) { - SpawnSpecificGibs(10, 1000, modelManager->GetGibModel((NeoSkin)GetSkin(), (NeoClass)GetClass(), GetTeamNumber(), NeoGibLimb(i))); + SpawnSpecificGibs(10, 1000, CNEOModelManager::GetGibModel((NeoSkin)GetSkin(), (NeoClass)GetClass(), GetTeamNumber(), NeoGibLimb(i))); } UTIL_BloodSpray(info.GetDamagePosition(), info.GetDamageForce(), BLOOD_COLOR_RED, 10, FX_BLOODSPRAY_ALL); } else { - SpawnSpecificGibs(10, 1000, modelManager->GetGibModel((NeoSkin)GetSkin(), (NeoClass)GetClass(), GetTeamNumber(), NeoGibLimb(deadModelType - 1))); + SpawnSpecificGibs(10, 1000, CNEOModelManager::GetGibModel((NeoSkin)GetSkin(), (NeoClass)GetClass(), GetTeamNumber(), NeoGibLimb(deadModelType - NUM_MODELS_WITHOUT_GIB))); UTIL_BloodSpray(info.GetDamagePosition(), info.GetDamageForce(), BLOOD_COLOR_RED, 10, FX_BLOODSPRAY_GORE | FX_BLOODSPRAY_DROPS); } - SetPlayerCorpseModel(deadModelType); -} - -void CNEO_Player::SetPlayerCorpseModel(int type) -{ - CNEOModelManager* modelManager = CNEOModelManager::Instance(); - if (!modelManager) - { - Assert(false); - Warning("Failed to get Neo model manager\n"); - return; - } - const char* model = modelManager->GetCorpseModel((NeoSkin)GetSkin(), (NeoClass)GetClass(), GetTeamNumber(), NeoGib(type)); - if (!*model) - { - Assert(false); - Warning("Failed to find model string for Neo player corpse\n"); - return; - } - - if (m_hRagdoll) - { - m_hRagdoll->SetModel(model); - } + SetRagdollModel(modelinfo->GetModelIndex(CNEOModelManager::GetCorpseModel((NeoSkin)GetSkin(), (NeoClass)GetClass(), GetTeamNumber(), NeoGib(deadModelType)))); } void CNEO_Player::SpawnSpecificGibs(float vMinVelocity, float vMaxVelocity, const char* cModelName) @@ -3531,6 +3485,17 @@ int CNEO_Player::ShouldTransmit(const CCheckTransmitInfo* pInfo) { if (!pInfo) return BaseClass::ShouldTransmit(pInfo); + + const auto* otherNeoPlayer = assert_cast(Instance(pInfo->m_pClientEnt)); + if (otherNeoPlayer == this) + return FL_EDICT_ALWAYS; + + // NEO JANK (Adam) We don't transmit the player the moment they die so that their ragdoll spawns + // smoothly client side, but we need to network at some point so the client knows this player is + // dead, but also NEO TODO once this fact is transmitted we should stop transmitting dead players + // in line with CBasePlayer::ShouldTransmit which we don't reach in many cases when dead + if (IsDead() && GetDeathTime() >= gpGlobals->curtime) + return FL_EDICT_DONTSEND; // This player is the ghoster, so their location should be networked always, even to enemies, // because we need to be able to draw the warning beacon for them even outside PVS. @@ -3543,8 +3508,6 @@ int CNEO_Player::ShouldTransmit(const CCheckTransmitInfo* pInfo) if (NEORules()->GetJuggernautPlayer() == entindex()) return FL_EDICT_ALWAYS; - const auto* otherNeoPlayer = assert_cast(Instance(pInfo->m_pClientEnt)); - if (otherNeoPlayer->GetTeamNumber() == TEAM_SPECTATOR || #ifdef GLOWS_ENABLE otherNeoPlayer->IsDead() || @@ -3909,7 +3872,6 @@ void CNEO_Player::SpectatorTakeoverPlayerPreThink() m_flLastSuperJumpTime = pPlayerTakeoverTarget->m_flLastSuperJumpTime; m_botThermOpticCamoDisruptedTimer.Invalidate(); // taken over by player m_bFirstDeathTick = pPlayerTakeoverTarget->m_bFirstDeathTick; - m_bCorpseSet = pPlayerTakeoverTarget->m_bCorpseSet; m_bPreviouslyReloading = pPlayerTakeoverTarget->m_bPreviouslyReloading; m_bLastTickInThermOpticCamo = pPlayerTakeoverTarget->m_bLastTickInThermOpticCamo; m_bIsPendingSpawnForThisRound = pPlayerTakeoverTarget->m_bIsPendingSpawnForThisRound; diff --git a/src/game/server/neo/neo_player.h b/src/game/server/neo/neo_player.h index d963989fa5..2fca9b7a4d 100644 --- a/src/game/server/neo/neo_player.h +++ b/src/game/server/neo/neo_player.h @@ -321,7 +321,6 @@ class CNEO_Player : public CHL2MP_Player private: bool m_bFirstDeathTick; - bool m_bCorpseSet; bool m_bPreviouslyReloading; bool m_szNeoNameHasSet;