Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions src/game/client/neo/c_neo_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -823,6 +823,52 @@ void C_NEO_Player::ItemPreFrame( void )
Weapon_Drop(neoWep);
}
}

// Debug reload timing
if (prediction && prediction->IsFirstTimePredicted())
{
static ConVarRef host_timescale("host_timescale");
float ts = host_timescale.IsValid() ? host_timescale.GetFloat() : 1.0f;
if (ts <= 0.0f) ts = 1.0f;

if (m_afButtonPressed & IN_RELOAD)
{
Msg("[Client] RELOAD KEY PRESSED: GameTime: %.4f (ts: %.2f)\n", gpGlobals->curtime, ts);
}

if (auto pWep = static_cast<CNEOBaseCombatWeapon *>(GetActiveWeapon()))
{
if (pWep->m_bInReload)
{
bool bIsStart = false;
if (pWep->m_flReloadStartTime == 0.0f)
{
pWep->m_flReloadStartTime = gpGlobals->curtime;
bIsStart = true;
}

float gameTime = gpGlobals->curtime - pWep->m_flReloadStartTime;
float realTime = gameTime / ts;

if (bIsStart)
{
Msg("[Client] RELOAD START (m_bInReload) - %s: GameTime: %.4f, Perceived: %.4f (ts: %.2f)\n", pWep->GetClassname(), gameTime, realTime, ts);
}
else
{
Msg("[Client] Reloading %s: GameTime: %.4f, Perceived: %.4f (ts: %.2f)\n", pWep->GetClassname(), gameTime, realTime, ts);
}
}
else if (pWep->m_flReloadStartTime != 0.0f)
{
float gameTime = gpGlobals->curtime - pWep->m_flReloadStartTime;
float realTime = gameTime / ts;

Msg("[Client] RELOAD STOP - %s: Total GameTime: %.4f, Total Perceived: %.4f\n", pWep->GetClassname(), gameTime, realTime);
pWep->m_flReloadStartTime = 0.0f;
}
}
}
}

void C_NEO_Player::ItemPostFrame( void )
Expand Down
1 change: 1 addition & 0 deletions src/game/shared/neo/weapons/weapon_neobasecombatweapon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ static const WeaponHandlingInfo_t handlingTable[] = {
CNEOBaseCombatWeapon::CNEOBaseCombatWeapon( void )
{
m_bTriggerReset = true;
m_flReloadStartTime = 0.0f;
}

void CNEOBaseCombatWeapon::Precache()
Expand Down
3 changes: 3 additions & 0 deletions src/game/shared/neo/weapons/weapon_neobasecombatweapon.h
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,9 @@ class CNEOBaseCombatWeapon : public CBaseHL2MPCombatWeapon
CNetworkVar(int, m_nNumShotsFired);
CNetworkVar(bool, m_bTriggerReset);

public:
float m_flReloadStartTime;

private:
CNEOBaseCombatWeapon(const CNEOBaseCombatWeapon &other);

Expand Down
Loading