diff --git a/src/game/client/c_baseentity.cpp b/src/game/client/c_baseentity.cpp index ff9efcda1b..4bc8295e84 100644 --- a/src/game/client/c_baseentity.cpp +++ b/src/game/client/c_baseentity.cpp @@ -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; } @@ -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 ); } diff --git a/src/game/client/cdll_client_int.cpp b/src/game/client/cdll_client_int.cpp index 787f134aae..1a58d6f11a 100644 --- a/src/game/client/cdll_client_int.cpp +++ b/src/game/client/cdll_client_int.cpp @@ -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 diff --git a/src/game/client/hltvcamera.cpp b/src/game/client/hltvcamera.cpp index 04109bd846..9b2214fb3a 100644 --- a/src/game/client/hltvcamera.cpp +++ b/src/game/client/hltvcamera.cpp @@ -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" ); @@ -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(); @@ -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; @@ -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) @@ -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; @@ -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) @@ -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) @@ -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; @@ -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 ); @@ -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 @@ -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; diff --git a/src/game/client/hltvcamera.h b/src/game/client/hltvcamera.h index 5cfe354b13..d5f6b44752 100644 --- a/src/game/client/hltvcamera.h +++ b/src/game/client/hltvcamera.h @@ -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 @@ -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 }; diff --git a/src/game/client/neo/ui/neo_hud_childelement.h b/src/game/client/neo/ui/neo_hud_childelement.h index ae0fe4a9b5..896c3f41c2 100644 --- a/src/game/client/neo/ui/neo_hud_childelement.h +++ b/src/game/client/neo/ui/neo_hud_childelement.h @@ -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; } } diff --git a/src/game/client/neo/ui/neo_hud_ghost_marker.cpp b/src/game/client/neo/ui/neo_hud_ghost_marker.cpp index bfb9372712..84f8be0c3f 100644 --- a/src/game/client/neo/ui/neo_hud_ghost_marker.cpp +++ b/src/game/client/neo/ui/neo_hud_ghost_marker.cpp @@ -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" @@ -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); @@ -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);