diff --git a/game/client/c_baseplayer.cpp b/game/client/c_baseplayer.cpp index a233ea4f6b..605b458802 100644 --- a/game/client/c_baseplayer.cpp +++ b/game/client/c_baseplayer.cpp @@ -249,7 +249,8 @@ END_RECV_TABLE() RecvPropFloat ( RECVINFO( m_flLaggedMovementValue )), RecvPropArray3 ( RECVINFO_ARRAY(m_vecBulletServerPositions), RecvPropVector( RECVINFO(m_vecBulletServerPositions[0])) ), RecvPropInt(RECVINFO(m_iBulletServerPositionCount)), - END_RECV_TABLE() + RecvPropVector(RECVINFO(m_vecServerShootPosition)), +END_RECV_TABLE() // -------------------------------------------------------------------------------- // diff --git a/game/client/c_baseplayer.h b/game/client/c_baseplayer.h index 0b6b86d7b1..cc391b5f8e 100644 --- a/game/client/c_baseplayer.h +++ b/game/client/c_baseplayer.h @@ -642,6 +642,7 @@ public: int m_nTickBaseFireBullet; Vector m_vecBulletServerPositions[MAX_PLAYER_BULLET_SERVER_POSITIONS]; int m_iBulletServerPositionCount; + Vector m_vecServerShootPosition; }; EXTERN_RECV_TABLE(DT_BasePlayer); diff --git a/game/client/cstrike/c_cs_player.cpp b/game/client/cstrike/c_cs_player.cpp index 14f01daf03..51b9a26c3d 100644 --- a/game/client/cstrike/c_cs_player.cpp +++ b/game/client/cstrike/c_cs_player.cpp @@ -2230,7 +2230,7 @@ void C_CSPlayer::Simulate( void ) static ConVarRef cl_showimpacts("cl_showimpacts"); - if ((cl_showimpacts.GetInt() == 1 || cl_showimpacts.GetInt() == 3) && m_lastBulletDiameter != -1.0f && m_iBulletServerPositionCount > 0) + if ((cl_showimpacts.GetInt() == 1 || cl_showimpacts.GetInt() == 3) && m_iBulletServerPositionCount > 0 && m_lastBulletDiameter != -1.0f) { auto weaponInfo = GetActiveWeapon(); @@ -2241,7 +2241,7 @@ void C_CSPlayer::Simulate( void ) for (int i = 0; i < m_iBulletServerPositionCount; i++) { - debugoverlay->AddSweptBoxOverlay(Weapon_ShootPosition(), + debugoverlay->AddSweptBoxOverlay(m_vecServerShootPosition, m_vecBulletServerPositions[i], Vector(-m_lastBulletDiameter, -m_lastBulletDiameter, @@ -2254,7 +2254,7 @@ void C_CSPlayer::Simulate( void ) 0, 255, 127, - 60); + 60.f); } m_lastBulletDiameter = -1.0f; diff --git a/game/server/player.cpp b/game/server/player.cpp index d561c9a366..f68bef0332 100644 --- a/game/server/player.cpp +++ b/game/server/player.cpp @@ -7973,6 +7973,7 @@ void CMovementSpeedMod::InputSpeedMod(inputdata_t &data) SendPropFloat ( SENDINFO( m_flLaggedMovementValue ), 0, SPROP_NOSCALE ), SendPropArray3( SENDINFO_ARRAY3(m_vecBulletServerPositions), SendPropVector(SENDINFO_ARRAY(m_vecBulletServerPositions))), SendPropInt(SENDINFO(m_iBulletServerPositionCount)), + SendPropVector(SENDINFO(m_vecServerShootPosition)) END_SEND_TABLE() diff --git a/game/server/player.h b/game/server/player.h index 089085d3a9..cbb7859691 100644 --- a/game/server/player.h +++ b/game/server/player.h @@ -1212,6 +1212,7 @@ public: virtual unsigned int PlayerSolidMask( bool brushOnly = false ) const; // returns the solid mask for the given player, so bots can have a more-restrictive set CNetworkArray(Vector, m_vecBulletServerPositions, MAX_PLAYER_BULLET_SERVER_POSITIONS); CNetworkVar(int, m_iBulletServerPositionCount); + CNetworkVar(Vector, m_vecServerShootPosition); }; typedef CHandle CBasePlayerHandle; diff --git a/game/shared/cstrike/cs_player_shared.cpp b/game/shared/cstrike/cs_player_shared.cpp index a2366d416a..cb26fe2e5d 100644 --- a/game/shared/cstrike/cs_player_shared.cpp +++ b/game/shared/cstrike/cs_player_shared.cpp @@ -452,7 +452,6 @@ void CCSPlayer::FireBullet( float flDamageModifier = 0.5; // default modification of bullets power after they go through a wall. float flPenetrationModifier = 1.f; float flBulletDiameter = 0.0f; - int iPenetrationCount = 0; GetBulletTypeParameters( iBulletType, flPenetrationPower, flPenetrationDistance, flBulletDiameter ); @@ -608,11 +607,10 @@ void CCSPlayer::FireBullet( player->RecordServerHitboxes( this ); } - if (iPenetrationCount < MAX_PLAYER_BULLET_SERVER_POSITIONS) + if (m_iBulletServerPositionCount.Get() < MAX_PLAYER_BULLET_SERVER_POSITIONS) { - m_vecBulletServerPositions.Set(iPenetrationCount, tr.endpos); - iPenetrationCount++; - m_iBulletServerPositionCount.Set(iPenetrationCount); + m_vecBulletServerPositions.Set(m_iBulletServerPositionCount.Get(), tr.endpos); + m_iBulletServerPositionCount.Set(m_iBulletServerPositionCount.Get() + 1); } #endif } diff --git a/game/shared/cstrike/fx_cs_shared.cpp b/game/shared/cstrike/fx_cs_shared.cpp index 9bef1a943b..b5b8196b6b 100644 --- a/game/shared/cstrike/fx_cs_shared.cpp +++ b/game/shared/cstrike/fx_cs_shared.cpp @@ -292,11 +292,16 @@ void FX_FireBullets( y1[iBullet] = fRadius1 * sinf(fTheta1); } +#ifndef CLIENT_DLL + pPlayer->m_iBulletServerPositionCount.Set(0); + pPlayer->m_vecServerShootPosition.Set(vOrigin); +#endif for ( int iBullet=0; iBullet < pWeaponInfo->m_iBullets; iBullet++ ) { +#ifdef CLIENT_DLL if (debug_screenshot_bullet_position.GetBool()) gpGlobals->client_taking_screenshot = true; - +#endif pPlayer->FireBullet( vOrigin, vAngles,