From 95bb5cb8a5e6c3246769b3f5fa41e92baff66920 Mon Sep 17 00:00:00 2001 From: Kamay Xutax Date: Tue, 16 Jul 2024 00:19:52 +0200 Subject: [PATCH] vecSrc bullet should be taken into an array --- game/client/c_baseplayer.cpp | 2 +- game/client/c_baseplayer.h | 2 +- game/client/cstrike/c_cs_player.cpp | 2 +- game/server/player.cpp | 4 ++-- game/server/player.h | 2 +- game/shared/cstrike/cs_player_shared.cpp | 24 +----------------------- game/shared/cstrike/fx_cs_shared.cpp | 1 - 7 files changed, 7 insertions(+), 30 deletions(-) diff --git a/game/client/c_baseplayer.cpp b/game/client/c_baseplayer.cpp index 605b458802..be3c7cbdbc 100644 --- a/game/client/c_baseplayer.cpp +++ b/game/client/c_baseplayer.cpp @@ -249,7 +249,7 @@ END_RECV_TABLE() RecvPropFloat ( RECVINFO( m_flLaggedMovementValue )), RecvPropArray3 ( RECVINFO_ARRAY(m_vecBulletServerPositions), RecvPropVector( RECVINFO(m_vecBulletServerPositions[0])) ), RecvPropInt(RECVINFO(m_iBulletServerPositionCount)), - RecvPropVector(RECVINFO(m_vecServerShootPosition)), + RecvPropArray3 ( RECVINFO_ARRAY(m_vecServerShootPosition), RecvPropVector( RECVINFO(m_vecServerShootPosition[0])) ), END_RECV_TABLE() diff --git a/game/client/c_baseplayer.h b/game/client/c_baseplayer.h index cc391b5f8e..7a6a61338a 100644 --- a/game/client/c_baseplayer.h +++ b/game/client/c_baseplayer.h @@ -642,7 +642,7 @@ public: int m_nTickBaseFireBullet; Vector m_vecBulletServerPositions[MAX_PLAYER_BULLET_SERVER_POSITIONS]; int m_iBulletServerPositionCount; - Vector m_vecServerShootPosition; + Vector m_vecServerShootPosition[MAX_PLAYER_BULLET_SERVER_POSITIONS]; }; EXTERN_RECV_TABLE(DT_BasePlayer); diff --git a/game/client/cstrike/c_cs_player.cpp b/game/client/cstrike/c_cs_player.cpp index 51b9a26c3d..ebbd6e92c8 100644 --- a/game/client/cstrike/c_cs_player.cpp +++ b/game/client/cstrike/c_cs_player.cpp @@ -2241,7 +2241,7 @@ void C_CSPlayer::Simulate( void ) for (int i = 0; i < m_iBulletServerPositionCount; i++) { - debugoverlay->AddSweptBoxOverlay(m_vecServerShootPosition, + debugoverlay->AddSweptBoxOverlay(m_vecServerShootPosition[i], m_vecBulletServerPositions[i], Vector(-m_lastBulletDiameter, -m_lastBulletDiameter, diff --git a/game/server/player.cpp b/game/server/player.cpp index f68bef0332..9940a3ddc1 100644 --- a/game/server/player.cpp +++ b/game/server/player.cpp @@ -7973,8 +7973,8 @@ 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() + SendPropArray3( SENDINFO_ARRAY3(m_vecServerShootPosition), SendPropVector(SENDINFO_ARRAY(m_vecServerShootPosition))), +END_SEND_TABLE() // -------------------------------------------------------------------------------- // diff --git a/game/server/player.h b/game/server/player.h index cbb7859691..b62f228d46 100644 --- a/game/server/player.h +++ b/game/server/player.h @@ -1212,7 +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); + CNetworkArray(Vector, m_vecServerShootPosition, MAX_PLAYER_BULLET_SERVER_POSITIONS); }; typedef CHandle CBasePlayerHandle; diff --git a/game/shared/cstrike/cs_player_shared.cpp b/game/shared/cstrike/cs_player_shared.cpp index cb26fe2e5d..bd8a7aa55d 100644 --- a/game/shared/cstrike/cs_player_shared.cpp +++ b/game/shared/cstrike/cs_player_shared.cpp @@ -478,29 +478,6 @@ void CCSPlayer::FireBullet( VectorNormalize( vecDir ); - //Adrian: visualize server/client player positions - //This is used to show where the lag compesator thinks the player should be at. -#if 0 - for ( int k = 1; k <= gpGlobals->maxClients; k++ ) - { - CBasePlayer *clientClass = (CBasePlayer *)CBaseEntity::Instance( k ); - - if ( clientClass == NULL ) - continue; - - if ( k == entindex() ) - continue; - -#ifdef CLIENT_DLL - debugoverlay->AddBoxOverlay( clientClass->GetAbsOrigin(), clientClass->WorldAlignMins(), clientClass->WorldAlignMaxs(), QAngle( 0, 0, 0), 255,0,0,127, 4 ); -#else - NDebugOverlay::Box( clientClass->GetAbsOrigin(), clientClass->WorldAlignMins(), clientClass->WorldAlignMaxs(), 0,0,255,127, 4 ); -#endif - - } - -#endif - //============================================================================= // HPE_BEGIN: @@ -610,6 +587,7 @@ void CCSPlayer::FireBullet( if (m_iBulletServerPositionCount.Get() < MAX_PLAYER_BULLET_SERVER_POSITIONS) { m_vecBulletServerPositions.Set(m_iBulletServerPositionCount.Get(), tr.endpos); + m_vecServerShootPosition.Set(m_iBulletServerPositionCount.Get(), vecSrc); 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 b5b8196b6b..1faa4293d4 100644 --- a/game/shared/cstrike/fx_cs_shared.cpp +++ b/game/shared/cstrike/fx_cs_shared.cpp @@ -294,7 +294,6 @@ void FX_FireBullets( #ifndef CLIENT_DLL pPlayer->m_iBulletServerPositionCount.Set(0); - pPlayer->m_vecServerShootPosition.Set(vOrigin); #endif for ( int iBullet=0; iBullet < pWeaponInfo->m_iBullets; iBullet++ ) {