Better bullet debug

This commit is contained in:
Kamay Xutax 2024-07-16 00:01:44 +02:00
parent 204d296ca0
commit 449017c859
7 changed files with 17 additions and 10 deletions

View file

@ -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()
// -------------------------------------------------------------------------------- //

View file

@ -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);

View file

@ -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;

View file

@ -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()

View file

@ -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<CBasePlayer> CBasePlayerHandle;

View file

@ -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
}

View file

@ -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,