Skip to content
Open
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
8 changes: 8 additions & 0 deletions src/game/client/c_baseentity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3246,7 +3246,11 @@ void C_BaseEntity::InterpolateServerEntities()
s_bInterpolate = cl_interpolate.GetBool();

// Don't interpolate during timedemo playback
#ifdef NEO
if ( engine->IsPlayingTimeDemo() )
#else
if ( engine->IsPlayingTimeDemo() || engine->IsPaused() )
#endif // NEO
{
s_bInterpolate = false;
}
Expand Down Expand Up @@ -3277,7 +3281,11 @@ void C_BaseEntity::InterpolateServerEntities()
// Enable extrapolation?
CInterpolationContext context;
context.SetLastTimeStamp( engine->GetLastTimeStamp() );
#ifdef NEO
if ( cl_extrapolate.GetBool() )
#else
if ( cl_extrapolate.GetBool() && !engine->IsPaused() )
#endif // NEO
{
context.EnableExtrapolation( true );
}
Expand Down
23 changes: 23 additions & 0 deletions src/game/client/cdll_client_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2658,6 +2658,29 @@ void OnRenderStart()
MDLCACHE_CRITICAL_SECTION();
MDLCACHE_COARSE_LOCK();

#ifdef NEO
if (engine->IsPaused())
{
Rope_ResetCounters();

{
PREDICTION_TRACKVALUECHANGESCOPE( "interpolation" );
C_BaseEntity::InterpolateServerEntities();
}

{
C_BaseAnimating::PushAllowBoneAccess( true, false, "OnRenderStart->CViewRender::SetUpView" ); // pops in CViewRender::SetUpView
}

input->CAM_Think();
view->OnRenderStart();

RopeManager()->OnRenderStart();

return;
}
#endif // NEO

#ifdef PORTAL
g_pPortalRender->UpdatePortalPixelVisibility(); //updating this one or two lines before querying again just isn't cutting it. Update as soon as it's cheap to do so.
#endif
Expand Down
52 changes: 49 additions & 3 deletions src/game/client/hltvcamera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "neo_gamerules.h"
#include "c_neo_player.h"
#include "shareddefs.h"
#include "input.h"
#endif // NEO

ConVar spec_autodirector( "spec_autodirector", "1", FCVAR_CLIENTDLL | FCVAR_CLIENTCMD_CAN_EXECUTE, "Auto-director chooses best view modes while spectating" );
Expand Down Expand Up @@ -106,6 +107,10 @@ void C_HLTVCamera::Reset()
m_flOffset = 0;
m_bEntityPacketReceived = false;

#ifdef NEO
m_flLastRealTime = 0;
#endif // NEO

m_vCamOrigin.Init();
m_aCamAngle.Init();

Expand Down Expand Up @@ -372,7 +377,11 @@ void C_HLTVCamera::CalcInEyeCamView( Vector& eyeOrigin, QAngle& eyeAngles, float
}
}

#ifdef NEO
void C_HLTVCamera::Accelerate( Vector& wishdir, float wishspeed, float accel, float flDeltaTime )
#else
void C_HLTVCamera::Accelerate( Vector& wishdir, float wishspeed, float accel )
#endif // NEO
{
float addspeed, accelspeed, currentspeed;

Expand All @@ -387,7 +396,11 @@ void C_HLTVCamera::Accelerate( Vector& wishdir, float wishspeed, float accel )
return;

// Determine amount of acceleration.
#ifdef NEO
accelspeed = accel * flDeltaTime * wishspeed;
#else
accelspeed = accel * gpGlobals->frametime * wishspeed;
#endif // NEO

// Cap at addspeed
if (accelspeed > addspeed)
Expand All @@ -407,10 +420,18 @@ extern ConVar neo_fov;
// movement code is a copy of CGameMovement::FullNoClipMove()
void C_HLTVCamera::CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float& fov)
{
#ifdef NEO
const float flDeltaTime = gpGlobals->realtime - m_flLastRealTime;

// if (engine->IsPaused()) // When running a demo back at very slow speeds, movement is delayed, just do this always
{
input->CreateMove(m_LastCmd.command_number, flDeltaTime, true); // or false and use sv_noclipduringpause, default it to true?
}
#endif // NEO

// only if PVS isn't locked by auto-director
if ( !IsPVSLocked() )
{

Vector wishvel;
Vector forward, right, up;
Vector wishdir;
Expand All @@ -428,7 +449,7 @@ void C_HLTVCamera::CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float&
// Copy movement amounts
float fmove = m_LastCmd.forwardmove * factor;
float smove = m_LastCmd.sidemove * factor;

#ifdef NEO
const bool bDroneMove = m_LastCmd.buttons & IN_WALK;
if (bDroneMove)
Expand Down Expand Up @@ -466,7 +487,11 @@ void C_HLTVCamera::CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float&
if ( sv_specaccelerate.GetFloat() > 0.0 )
{
// Set move velocity
#ifdef NEO
Accelerate ( wishdir, wishspeed, sv_specaccelerate.GetFloat(), flDeltaTime );
#else
Accelerate ( wishdir, wishspeed, sv_specaccelerate.GetFloat() );
#endif // NEO

float spd = VectorLength( m_vecVelocity );
if (spd < 1.0f)
Expand All @@ -482,7 +507,11 @@ void C_HLTVCamera::CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float&
float friction = sv_friction.GetFloat();

// Add the amount to the drop amount.
#ifdef NEO
float drop = control * friction * flDeltaTime;
#else
float drop = control * friction * gpGlobals->frametime;
#endif // NEO

// scale the velocity
float newspeed = spd - drop;
Expand All @@ -500,8 +529,12 @@ void C_HLTVCamera::CalcRoamingView(Vector& eyeOrigin, QAngle& eyeAngles, float&
}

// Just move ( don't clip or anything )
#ifdef NEO
VectorMA( m_vCamOrigin, flDeltaTime, m_vecVelocity, m_vCamOrigin );
#else
VectorMA( m_vCamOrigin, gpGlobals->frametime, m_vecVelocity, m_vCamOrigin );

#endif // NEO

// get camera angle directly from engine
engine->GetViewAngles( m_aCamAngle );

Expand Down Expand Up @@ -597,6 +630,9 @@ void C_HLTVCamera::CalcView(Vector& origin, QAngle& angles, float& fov)
case OBS_MODE_CHASE : CalcChaseCamView( origin, angles, fov );
break;
}
#ifdef NEO
m_flLastRealTime = gpGlobals->realtime;
#endif // NEO
}

#ifdef NEO
Expand All @@ -614,6 +650,16 @@ void C_HLTVCamera::SetMode(int iMode)
m_nCameraMode = iMode;

#ifdef NEO
// If we pause demo playback while in eye view, the observer target will be invisible when switching observer mode because we also pause simulation etc, update visibility here
if (iOldMode == OBS_MODE_IN_EYE && engine->IsPaused())
{
if ( C_BaseEntity* target = ClientEntityList().GetEnt( m_iTraget1 ) )
{
target->UpdateVisibility();
target->CreateShadow(); // Iterate through all children to update their shadows too?
}
}

if (cl_neo_hltvcamera_spectate_next_target_on_set_mode.GetBool() && (iMode == OBS_MODE_IN_EYE || iMode == OBS_MODE_CHASE) && !GetPrimaryTarget())
{
bAllowChangingModeWhenSettingPrimaryTarget = false;
Expand Down
7 changes: 7 additions & 0 deletions src/game/client/hltvcamera.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ class C_HLTVCamera : CGameEventListener

void SmoothCameraAngle( QAngle& targetAngle );
void SetCameraAngle( QAngle& targetAngle );
#ifdef NEO
void Accelerate( Vector& wishdir, float wishspeed, float accel, float flDeltaTime );
#else
void Accelerate( Vector& wishdir, float wishspeed, float accel );
#endif

int m_nCameraMode; // current camera mode
int m_iCameraMan; // camera man entindex or 0
Expand All @@ -80,6 +84,9 @@ class C_HLTVCamera : CGameEventListener
char m_szTitleText[64];
CUserCmd m_LastCmd;
Vector m_vecVelocity;
#ifdef NEO
float m_flLastRealTime = 0; // use realtime instead of frametime to process movement even while paused
#endif
};


Expand Down
4 changes: 2 additions & 2 deletions src/game/client/neo/ui/neo_hud_childelement.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ class CNEOHud_ChildElement
}
else if (frequency > 0)
{
const float deltaTime = gpGlobals->curtime - m_flLastUpdateTime;
const float deltaTime = gpGlobals->realtime - m_flLastUpdateTime;
if ((m_flLastUpdateTime > 0.0f) && (deltaTime < frequency))
{
return false;
}
else
{
m_flLastUpdateTime = gpGlobals->curtime;
m_flLastUpdateTime = gpGlobals->realtime;
return true;
}
}
Expand Down
5 changes: 3 additions & 2 deletions src/game/client/neo/ui/neo_hud_ghost_marker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "ienginevgui.h"
#include "prediction.h"
#include "weapon_ghost.h"
#include "view.h"

// memdbgon must be the last include file in a .cpp file!!!
#include "neo_hud_worldpos_marker.h"
Expand Down Expand Up @@ -99,7 +100,7 @@ void CNEOHud_GhostMarker::UpdateStateForNeoHudElementDraw()
{
if (!NEORules()->GetGhosterPlayer())
{
const float flDistMeters = METERS_PER_INCH * C_NEO_Player::GetLocalPlayer()->GetAbsOrigin().DistTo(NEORules()->GetGhostPos());
const float flDistMeters = METERS_PER_INCH * MainViewOrigin().DistTo(NEORules()->GetGhostPos());
if (cl_neo_hud_worldpos_verbose.GetBool())
{
V_snwprintf(m_wszMarkerTextUnicode, ARRAYSIZE(m_wszMarkerTextUnicode), L"GHOST DISTANCE: %.0fm", flDistMeters);
Expand All @@ -114,7 +115,7 @@ void CNEOHud_GhostMarker::UpdateStateForNeoHudElementDraw()
{
if (!NEORules()->GetJuggernautPlayer())
{
const float flDistMeters = METERS_PER_INCH * C_NEO_Player::GetLocalPlayer()->GetAbsOrigin().DistTo(NEORules()->GetJuggernautMarkerPos());
const float flDistMeters = METERS_PER_INCH * MainViewOrigin().DistTo(NEORules()->GetJuggernautMarkerPos());
if (cl_neo_hud_worldpos_verbose.GetBool())
{
V_snwprintf(m_wszMarkerTextUnicode, ARRAYSIZE(m_wszMarkerTextUnicode), L"JUGGERNAUT DISTANCE: %.0fm", flDistMeters);
Expand Down
Loading