Improved cl_show* commands
This commit is contained in:
parent
d1c62bb858
commit
73845dfe4c
9 changed files with 248 additions and 114 deletions
|
@ -103,22 +103,6 @@ ForEachMacros:
|
||||||
- BOOST_FOREACH
|
- BOOST_FOREACH
|
||||||
IfMacros:
|
IfMacros:
|
||||||
- KJ_IF_MAYBE
|
- KJ_IF_MAYBE
|
||||||
IncludeBlocks: Preserve
|
|
||||||
IncludeCategories:
|
|
||||||
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
|
|
||||||
Priority: 2
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
|
|
||||||
Priority: 3
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
- Regex: '.*'
|
|
||||||
Priority: 1
|
|
||||||
SortPriority: 0
|
|
||||||
CaseSensitive: false
|
|
||||||
IncludeIsMainRegex: '(Test)?$'
|
|
||||||
IncludeIsMainSourceRegex: ''
|
|
||||||
IndentAccessModifiers: false
|
IndentAccessModifiers: false
|
||||||
IndentCaseBlocks: false
|
IndentCaseBlocks: false
|
||||||
IndentCaseLabels: true
|
IndentCaseLabels: true
|
||||||
|
|
|
@ -5574,6 +5574,49 @@ static Vector hullcolor[8] =
|
||||||
Vector( 1.0, 1.0, 1.0 )
|
Vector( 1.0, 1.0, 1.0 )
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void C_BaseAnimating::RecordClientHitboxes()
|
||||||
|
{
|
||||||
|
CStudioHdr *pStudioHdr = GetModelPtr();
|
||||||
|
if ( !pStudioHdr )
|
||||||
|
return;
|
||||||
|
|
||||||
|
mstudiohitboxset_t *set =pStudioHdr->pHitboxSet( m_nHitboxSet );
|
||||||
|
if ( !set )
|
||||||
|
return;
|
||||||
|
|
||||||
|
for ( int i = 0; i < set->numhitboxes; i++ )
|
||||||
|
{
|
||||||
|
mstudiobbox_t *pbox = set->pHitbox( i );
|
||||||
|
|
||||||
|
GetBonePosition( pbox->bone, m_vecHitboxClientPositions[pbox->bone], m_angHitboxClientAngles[pbox->bone] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void C_BaseAnimating::DrawClientRecordedHitboxes( float duration /*= 0.0f*/, bool monocolor /*= false*/ )
|
||||||
|
{
|
||||||
|
CStudioHdr *pStudioHdr = GetModelPtr();
|
||||||
|
if ( !pStudioHdr )
|
||||||
|
return;
|
||||||
|
|
||||||
|
mstudiohitboxset_t *set =pStudioHdr->pHitboxSet( m_nHitboxSet );
|
||||||
|
if ( !set )
|
||||||
|
return;
|
||||||
|
|
||||||
|
Vector position;
|
||||||
|
QAngle angles;
|
||||||
|
|
||||||
|
int r = 0;
|
||||||
|
int g = 255;
|
||||||
|
int b = 0;
|
||||||
|
|
||||||
|
for ( int i = 0; i < set->numhitboxes; i++ )
|
||||||
|
{
|
||||||
|
mstudiobbox_t *pbox = set->pHitbox( i );
|
||||||
|
|
||||||
|
debugoverlay->AddBoxOverlay( m_vecHitboxClientPositions[pbox->bone], pbox->bbmin, pbox->bbmax, m_angHitboxClientAngles[pbox->bone], r, g, b, 127 ,duration );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Purpose: Draw the current hitboxes
|
// Purpose: Draw the current hitboxes
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -369,7 +369,9 @@ public:
|
||||||
int GetHitboxSet( void );
|
int GetHitboxSet( void );
|
||||||
char const *GetHitboxSetName( void );
|
char const *GetHitboxSetName( void );
|
||||||
int GetHitboxSetCount( void );
|
int GetHitboxSetCount( void );
|
||||||
|
void RecordClientHitboxes();
|
||||||
void DrawClientHitboxes( float duration = 0.0f, bool monocolor = false );
|
void DrawClientHitboxes( float duration = 0.0f, bool monocolor = false );
|
||||||
|
void DrawClientRecordedHitboxes( float duration = 0.0f, bool monocolor = false );
|
||||||
void DrawServerHitboxes( float duration = 0.0f, bool monocolor = false );
|
void DrawServerHitboxes( float duration = 0.0f, bool monocolor = false );
|
||||||
|
|
||||||
C_BaseAnimating* FindFollowedEntity();
|
C_BaseAnimating* FindFollowedEntity();
|
||||||
|
@ -644,6 +646,8 @@ private:
|
||||||
public:
|
public:
|
||||||
Vector m_vecHitboxServerPositions[MAXSTUDIOBONES];
|
Vector m_vecHitboxServerPositions[MAXSTUDIOBONES];
|
||||||
QAngle m_angHitboxServerAngles[MAXSTUDIOBONES];
|
QAngle m_angHitboxServerAngles[MAXSTUDIOBONES];
|
||||||
|
Vector m_vecHitboxClientPositions[MAXSTUDIOBONES];
|
||||||
|
QAngle m_angHitboxClientAngles[MAXSTUDIOBONES];
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
|
|
|
@ -2145,67 +2145,192 @@ void C_BasePlayer::Simulate()
|
||||||
static ConVarRef cl_showfirebullethitboxes("cl_showfirebullethitboxes");
|
static ConVarRef cl_showfirebullethitboxes("cl_showfirebullethitboxes");
|
||||||
static ConVarRef cl_showimpacts("cl_showimpacts");
|
static ConVarRef cl_showimpacts("cl_showimpacts");
|
||||||
static ConVarRef cl_showhitboxes("cl_showhitboxes");
|
static ConVarRef cl_showhitboxes("cl_showhitboxes");
|
||||||
|
static ConVarRef debug_screenshot_bullet_position("debug_screenshot_bullet_position");
|
||||||
|
|
||||||
|
static auto DrawBullet = [&](Vector src, Vector endpos, int r, int g, int b, int a, float duration)
|
||||||
|
{
|
||||||
|
NDebugOverlay::SweptBox(src,
|
||||||
|
endpos,
|
||||||
|
Vector(-m_lastBulletDiameter, -m_lastBulletDiameter, -m_lastBulletDiameter) / 2,
|
||||||
|
Vector(m_lastBulletDiameter, m_lastBulletDiameter, m_lastBulletDiameter) / 2,
|
||||||
|
QAngle(0, 0, 0),
|
||||||
|
r,
|
||||||
|
g,
|
||||||
|
b,
|
||||||
|
a,
|
||||||
|
duration);
|
||||||
|
NDebugOverlay::Box(endpos,
|
||||||
|
Vector(-m_lastBulletDiameter, -m_lastBulletDiameter, -m_lastBulletDiameter) / 2,
|
||||||
|
Vector(m_lastBulletDiameter, m_lastBulletDiameter, m_lastBulletDiameter) / 2,
|
||||||
|
r,
|
||||||
|
g,
|
||||||
|
b,
|
||||||
|
a,
|
||||||
|
duration);
|
||||||
|
};
|
||||||
|
|
||||||
|
// HACK: Server var is always more delayed than client, should be safe.
|
||||||
if (m_bDebugServerBullets && IsLocalPlayer())
|
if (m_bDebugServerBullets && IsLocalPlayer())
|
||||||
{
|
{
|
||||||
if (cl_showimpacts.GetInt() == 1 || cl_showimpacts.GetInt() == 3)
|
bool shouldDrawClientBullets = cl_showimpacts.GetInt() == 1 || cl_showimpacts.GetInt() == 3;
|
||||||
|
bool shouldDrawServerBullets = cl_showimpacts.GetInt() == 1 || cl_showimpacts.GetInt() == 2;
|
||||||
|
static constexpr float flShowDuration = 60.f;
|
||||||
|
|
||||||
|
if (shouldDrawClientBullets)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < m_vecServerShootPositions.Count(); i++)
|
for (int i = 0; i < m_vecClientShootPositions.Count(); i++)
|
||||||
{
|
{
|
||||||
NDebugOverlay::SweptBox(m_vecServerShootPositions[i],
|
DrawBullet(m_vecClientShootPositions[i],
|
||||||
m_vecBulletServerPositions[i],
|
m_vecBulletClientPositions[i],
|
||||||
Vector(-m_lastBulletDiameter, -m_lastBulletDiameter, -m_lastBulletDiameter) / 2,
|
0,
|
||||||
Vector(m_lastBulletDiameter, m_lastBulletDiameter, m_lastBulletDiameter) / 2,
|
255,
|
||||||
QAngle(0, 0, 0),
|
0,
|
||||||
0,
|
127,
|
||||||
0,
|
flShowDuration);
|
||||||
255,
|
|
||||||
127,
|
|
||||||
60.f);
|
|
||||||
NDebugOverlay::Box(m_vecBulletServerPositions[i],
|
|
||||||
Vector(-m_lastBulletDiameter, -m_lastBulletDiameter, -m_lastBulletDiameter) / 2,
|
|
||||||
Vector(m_lastBulletDiameter, m_lastBulletDiameter, m_lastBulletDiameter) / 2,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
255,
|
|
||||||
127,
|
|
||||||
60.f);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cl_showfirebullethitboxes.GetBool())
|
if (shouldDrawServerBullets)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_vecServerShootPositions.Count(); i++)
|
||||||
|
{
|
||||||
|
DrawBullet(m_vecServerShootPositions[i],
|
||||||
|
m_vecBulletServerPositions[i],
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
255,
|
||||||
|
127,
|
||||||
|
flShowDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool shouldDrawClientSS = debug_screenshot_bullet_position.GetInt() == 1 || debug_screenshot_bullet_position.GetInt() == 3;
|
||||||
|
bool shouldDrawServerSS = debug_screenshot_bullet_position.GetInt() == 1 || debug_screenshot_bullet_position.GetInt() == 2;
|
||||||
|
|
||||||
|
if (shouldDrawClientSS)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_vecClientShootPositions.Count(); i++)
|
||||||
|
{
|
||||||
|
DrawBullet(m_vecClientShootPositions[i],
|
||||||
|
m_vecBulletClientPositions[i],
|
||||||
|
0,
|
||||||
|
255,
|
||||||
|
0,
|
||||||
|
127,
|
||||||
|
gpGlobals->frametime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldDrawServerSS)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_vecServerShootPositions.Count(); i++)
|
||||||
|
{
|
||||||
|
DrawBullet(m_vecServerShootPositions[i],
|
||||||
|
m_vecBulletServerPositions[i],
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
255,
|
||||||
|
127,
|
||||||
|
gpGlobals->frametime);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool shouldDrawClientBulletPlayerHitbox = cl_showfirebullethitboxes.GetInt() == 1 || cl_showfirebullethitboxes.GetInt() == 3;
|
||||||
|
bool shouldDrawServerBulletPlayerHitbox = cl_showfirebullethitboxes.GetInt() == 1 || cl_showfirebullethitboxes.GetInt() == 2;
|
||||||
|
|
||||||
|
if (shouldDrawClientBulletPlayerHitbox || shouldDrawServerBulletPlayerHitbox)
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||||
{
|
{
|
||||||
auto player = UTIL_PlayerByIndex(i);
|
auto player = UTIL_PlayerByIndex(i);
|
||||||
|
|
||||||
if (player && !player->IsLocalPlayer())
|
if (!player || player->IsLocalPlayer())
|
||||||
{
|
{
|
||||||
player->DrawServerHitboxes(60.0f, true);
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldDrawClientBulletPlayerHitbox)
|
||||||
|
{
|
||||||
|
player->DrawClientRecordedHitboxes(flShowDuration, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldDrawServerBulletPlayerHitbox)
|
||||||
|
{
|
||||||
|
player->DrawServerHitboxes(flShowDuration, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else if (shouldDrawClientBullets || shouldDrawServerBullets)
|
||||||
{
|
{
|
||||||
for (auto&& entityIndex : m_touchedEntitiesWithBullet)
|
for (auto&& entityIndex : m_touchedEntitiesWithBullet)
|
||||||
{
|
{
|
||||||
auto player = UTIL_PlayerByIndex(entityIndex);
|
auto player = UTIL_PlayerByIndex(entityIndex);
|
||||||
|
|
||||||
if (player && !player->IsLocalPlayer())
|
if (!player || player->IsLocalPlayer())
|
||||||
{
|
{
|
||||||
player->DrawServerHitboxes(60.0f, true);
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldDrawClientBullets)
|
||||||
|
{
|
||||||
|
player->DrawClientRecordedHitboxes(flShowDuration, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldDrawServerBullets)
|
||||||
|
{
|
||||||
|
player->DrawServerHitboxes(flShowDuration, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shouldDrawClientSS || shouldDrawServerSS)
|
||||||
|
{
|
||||||
|
for (auto&& entityIndex : m_touchedEntitiesWithBullet)
|
||||||
|
{
|
||||||
|
auto player = UTIL_PlayerByIndex(entityIndex);
|
||||||
|
|
||||||
|
if (!player || player->IsLocalPlayer())
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldDrawClientSS)
|
||||||
|
{
|
||||||
|
player->DrawClientRecordedHitboxes(gpGlobals->frametime, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldDrawServerSS)
|
||||||
|
{
|
||||||
|
player->DrawServerHitboxes(gpGlobals->frametime, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldDrawClientSS || shouldDrawServerSS)
|
||||||
|
{
|
||||||
|
gpGlobals->client_taking_screenshot = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Remove accumulated client bullets.
|
||||||
|
m_vecBulletClientPositions.RemoveAll();
|
||||||
|
m_vecClientShootPositions.RemoveAll();
|
||||||
m_bDebugServerBullets = false;
|
m_bDebugServerBullets = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cl_showhitboxes.GetBool() && IsPlayer() && this != GetLocalPlayer())
|
bool shouldShowClientHitboxes = cl_showhitboxes.GetInt() == 1 || cl_showhitboxes.GetInt() == 3;
|
||||||
|
bool shouldShowServerHitboxes = cl_showhitboxes.GetInt() == 1 || cl_showhitboxes.GetInt() == 2;
|
||||||
|
bool shouldShowHitboxes = IsPlayer() && this != GetLocalPlayer();
|
||||||
|
|
||||||
|
if (shouldShowClientHitboxes && shouldShowHitboxes)
|
||||||
|
{
|
||||||
|
RecordClientHitboxes();
|
||||||
|
DrawClientRecordedHitboxes(gpGlobals->frametime, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldShowServerHitboxes && shouldShowHitboxes)
|
||||||
{
|
{
|
||||||
DrawClientHitboxes(gpGlobals->frametime, true);
|
|
||||||
DrawServerHitboxes(gpGlobals->frametime, true);
|
DrawServerHitboxes(gpGlobals->frametime, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
|
@ -645,6 +645,8 @@ public:
|
||||||
CUtlVector<Vector> m_vecBulletServerPositions;
|
CUtlVector<Vector> m_vecBulletServerPositions;
|
||||||
CUtlVector<Vector> m_vecServerShootPositions;
|
CUtlVector<Vector> m_vecServerShootPositions;
|
||||||
CUtlVector<int> m_touchedEntitiesWithBullet;
|
CUtlVector<int> m_touchedEntitiesWithBullet;
|
||||||
|
CUtlVector<Vector> m_vecBulletClientPositions;
|
||||||
|
CUtlVector<Vector> m_vecClientShootPositions;
|
||||||
};
|
};
|
||||||
|
|
||||||
EXTERN_RECV_TABLE(DT_BasePlayer);
|
EXTERN_RECV_TABLE(DT_BasePlayer);
|
||||||
|
|
|
@ -1315,7 +1315,8 @@ void CInput::CreateMove ( int sequence_number, float input_sample_frametime, boo
|
||||||
}
|
}
|
||||||
|
|
||||||
static ConVarRef cl_showhitboxes("cl_showhitboxes");
|
static ConVarRef cl_showhitboxes("cl_showhitboxes");
|
||||||
|
static ConVarRef debug_screenshot_bullet_position("debug_screenshot_bullet_position");
|
||||||
|
|
||||||
cmd->debug_hitboxes = CUserCmd::DEBUG_HITBOXES_OFF;
|
cmd->debug_hitboxes = CUserCmd::DEBUG_HITBOXES_OFF;
|
||||||
|
|
||||||
if (cl_showhitboxes.GetBool())
|
if (cl_showhitboxes.GetBool())
|
||||||
|
@ -1328,12 +1329,11 @@ void CInput::CreateMove ( int sequence_number, float input_sample_frametime, boo
|
||||||
cmd->debug_hitboxes |= CUserCmd::DEBUG_HITBOXES_ON_FIRE;
|
cmd->debug_hitboxes |= CUserCmd::DEBUG_HITBOXES_ON_FIRE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cl_showimpacts.GetInt() == 1 || cl_showimpacts.GetInt() == 3)
|
if (cl_showimpacts.GetBool() || debug_screenshot_bullet_position.GetBool())
|
||||||
{
|
{
|
||||||
cmd->debug_hitboxes |= CUserCmd::DEBUG_HITBOXES_ON_HIT;
|
cmd->debug_hitboxes |= CUserCmd::DEBUG_HITBOXES_ON_HIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pVerified->m_cmd = *cmd;
|
pVerified->m_cmd = *cmd;
|
||||||
pVerified->m_crc = cmd->GetChecksum();
|
pVerified->m_crc = cmd->GetChecksum();
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "con_nprint.h"
|
#include "con_nprint.h"
|
||||||
#include "hud_pdump.h"
|
#include "hud_pdump.h"
|
||||||
#include "datacache/imdlcache.h"
|
#include "datacache/imdlcache.h"
|
||||||
|
#include "util_shared.h"
|
||||||
|
|
||||||
#ifdef HL2_CLIENT_DLL
|
#ifdef HL2_CLIENT_DLL
|
||||||
#include "c_basehlplayer.h"
|
#include "c_basehlplayer.h"
|
||||||
|
@ -895,7 +896,9 @@ void CPrediction::RunCommand( C_BasePlayer *player, CUserCmd *ucmd, IMoveHelper
|
||||||
{
|
{
|
||||||
player->SetLocalViewAngles( ucmd->viewangles );
|
player->SetLocalViewAngles( ucmd->viewangles );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Always record for debugging.
|
||||||
|
// Sometimes the hitbox wasn't hit by the player client side!
|
||||||
RunPostThink( player );
|
RunPostThink( player );
|
||||||
|
|
||||||
// TODO
|
// TODO
|
||||||
|
|
|
@ -489,35 +489,28 @@ void CCSPlayer::FireBullet(
|
||||||
CBasePlayer *lastPlayerHit = NULL;
|
CBasePlayer *lastPlayerHit = NULL;
|
||||||
MDLCACHE_CRITICAL_SECTION();
|
MDLCACHE_CRITICAL_SECTION();
|
||||||
|
|
||||||
#ifdef CLIENT_DLL
|
bool shouldTakeAllPlayers = m_pCurrentCommand->debug_hitboxes & CUserCmd::DEBUG_HITBOXES_ON_FIRE;
|
||||||
static ConVarRef cl_showfirebullethitboxes("cl_showfirebullethitboxes");
|
bool shouldTakeHitPlayer = m_pCurrentCommand->debug_hitboxes & CUserCmd::DEBUG_HITBOXES_ON_HIT;
|
||||||
|
|
||||||
if (cl_showfirebullethitboxes.GetBool() && IsLocalPlayer())
|
if ( shouldTakeAllPlayers && !shouldTakeHitPlayer )
|
||||||
{
|
|
||||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
|
||||||
{
|
|
||||||
CBasePlayer* lagPlayer = UTIL_PlayerByIndex(i);
|
|
||||||
|
|
||||||
if ( lagPlayer && !lagPlayer->IsLocalPlayer() && IsLocalPlayer())
|
|
||||||
{
|
|
||||||
lagPlayer->DrawClientHitboxes(60, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
if ( m_pCurrentCommand->debug_hitboxes & CUserCmd::DEBUG_HITBOXES_ON_FIRE )
|
|
||||||
{
|
{
|
||||||
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
for (int i = 1; i <= gpGlobals->maxClients; i++)
|
||||||
{
|
{
|
||||||
CBasePlayer* lagPlayer = UTIL_PlayerByIndex(i);
|
CBasePlayer* lagPlayer = UTIL_PlayerByIndex(i);
|
||||||
|
|
||||||
if( lagPlayer )
|
if( lagPlayer )
|
||||||
{
|
{
|
||||||
lagPlayer->RecordServerHitboxes(this);
|
#ifdef CLIENT_DLL
|
||||||
|
if (!m_pCurrentCommand->hasbeenpredicted)
|
||||||
|
{
|
||||||
|
lagPlayer->RecordClientHitboxes();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
lagPlayer->RecordServerHitboxes(this);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
while ( fCurrentDamage > 0 )
|
while ( fCurrentDamage > 0 )
|
||||||
{
|
{
|
||||||
|
@ -563,56 +556,34 @@ void CCSPlayer::FireBullet(
|
||||||
flDamageModifier = 0.99f;
|
flDamageModifier = 0.99f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (shouldTakeHitPlayer)
|
||||||
#ifdef CLIENT_DLL
|
|
||||||
m_lastBulletDiameter = flBulletDiameter;
|
|
||||||
|
|
||||||
static ConVarRef cl_showimpacts("cl_showimpacts");
|
|
||||||
|
|
||||||
if ((cl_showimpacts.GetInt() == 1 || cl_showimpacts.GetInt() == 2) && IsLocalPlayer())
|
|
||||||
{
|
|
||||||
NDebugOverlay::SweptBox(vecSrc,
|
|
||||||
tr.endpos,
|
|
||||||
vecBulletRadiusMins,
|
|
||||||
vecBulletRadiusMaxs,
|
|
||||||
QAngle(0, 0, 0),
|
|
||||||
255,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
127,
|
|
||||||
60.0f);
|
|
||||||
NDebugOverlay::Box(tr.endpos, vecBulletRadiusMins, vecBulletRadiusMaxs, 255, 0, 0, 127, 60.f);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tr.m_pEnt && tr.m_pEnt->IsPlayer())
|
|
||||||
{
|
|
||||||
C_BasePlayer* player = ToBasePlayer(tr.m_pEnt);
|
|
||||||
|
|
||||||
if ((cl_showimpacts.GetInt() == 1 || cl_showimpacts.GetInt() == 2) && IsLocalPlayer())
|
|
||||||
{
|
|
||||||
player->DrawClientHitboxes(60.0f, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
bool shouldShowServerHitRegistration = m_pCurrentCommand->debug_hitboxes & CUserCmd::DEBUG_HITBOXES_ON_HIT;
|
|
||||||
|
|
||||||
if (shouldShowServerHitRegistration)
|
|
||||||
{
|
{
|
||||||
|
#ifndef CLIENT_DLL
|
||||||
m_vecBulletServerPositions.AddToTail(tr.endpos);
|
m_vecBulletServerPositions.AddToTail(tr.endpos);
|
||||||
m_vecServerShootPositions.AddToTail(vecSrc);
|
m_vecServerShootPositions.AddToTail(vecSrc);
|
||||||
|
#else
|
||||||
|
m_vecBulletClientPositions.AddToTail(tr.endpos);
|
||||||
|
m_vecClientShootPositions.AddToTail(vecSrc);
|
||||||
|
#endif
|
||||||
if (tr.m_pEnt)
|
if (tr.m_pEnt)
|
||||||
{
|
{
|
||||||
|
#ifndef CLIENT_DLL
|
||||||
m_touchedEntitiesWithBullet.AddToTail(tr.m_pEnt->entindex());
|
m_touchedEntitiesWithBullet.AddToTail(tr.m_pEnt->entindex());
|
||||||
}
|
#endif
|
||||||
|
if (tr.m_pEnt->IsPlayer() && !shouldTakeAllPlayers)
|
||||||
if (tr.m_pEnt && tr.m_pEnt->IsPlayer())
|
{
|
||||||
{
|
CBasePlayer* player = ToBasePlayer(tr.m_pEnt);
|
||||||
CBasePlayer* player = ToBasePlayer(tr.m_pEnt);
|
#ifdef CLIENT_DLL
|
||||||
player->RecordServerHitboxes(this);
|
if (!m_pCurrentCommand->hasbeenpredicted)
|
||||||
|
{
|
||||||
|
player->RecordClientHitboxes();
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
player->RecordServerHitboxes(this);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
//calculate the damage based on the distance the bullet travelled.
|
//calculate the damage based on the distance the bullet travelled.
|
||||||
flCurrentDistance += tr.fraction * flDistance;
|
flCurrentDistance += tr.fraction * flDistance;
|
||||||
|
|
|
@ -300,11 +300,13 @@ void FX_FireBullets(
|
||||||
|
|
||||||
for ( int iBullet=0; iBullet < pWeaponInfo->m_iBullets; iBullet++ )
|
for ( int iBullet=0; iBullet < pWeaponInfo->m_iBullets; iBullet++ )
|
||||||
{
|
{
|
||||||
|
// Still take the screenshot where we shooted, make a screenshot when we received the server bullet hits too.
|
||||||
#ifdef CLIENT_DLL
|
#ifdef CLIENT_DLL
|
||||||
if (debug_screenshot_bullet_position.GetBool())
|
static ConVarRef debug_screenshot_bullet_position("debug_screenshot_bullet_position");
|
||||||
|
if (pPlayer->IsLocalPlayer() && debug_screenshot_bullet_position.GetBool())
|
||||||
{
|
{
|
||||||
gpGlobals->client_taking_screenshot = true;
|
gpGlobals->client_taking_screenshot = true;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
pPlayer->FireBullet(
|
pPlayer->FireBullet(
|
||||||
iBullet,
|
iBullet,
|
||||||
|
|
Loading…
Reference in a new issue