Skip to content

Commit

Permalink
Pseudo-fix for crash when viewing DEMO
Browse files Browse the repository at this point in the history
  • Loading branch information
Elinsrc committed Oct 26, 2024
1 parent d47945d commit 0f6cd04
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cl_dll/ui/hud/OpenAG/hud_strafeguide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#include "pm_movevars.h"
#include "ref_params.h"

#include "demo_api.h"

enum border {
RED_GREEN,
GREEN_WHITE,
Expand Down Expand Up @@ -36,7 +38,7 @@ int CHudStrafeGuide::VidInit()

int CHudStrafeGuide::Draw(float time)
{
if (hud_strafeguide->value == 0)
if (hud_strafeguide->value == 0 || gEngfuncs.pDemoAPI->IsPlayingback())
return 0;

double fov = CVAR_GET_FLOAT( "default_fov" ) / 180 * M_PI / 2;
Expand Down
7 changes: 6 additions & 1 deletion cl_dll/view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
#include "hltv.h"
#include "view.h"

#include "demo_api.h"

// Spectator Mode
extern "C"
{
Expand Down Expand Up @@ -1644,7 +1646,10 @@ void DLLEXPORT V_CalcRefdef( struct ref_params_s *pparams )
// OpenAG
gHUD.m_Speedometer.UpdateSpeed(pparams->simvel);
gHUD.m_Jumpspeed.UpdateSpeed(pparams->simvel);
gHUD.m_StrafeGuide.Update(pparams);

// FIXME: Why does an error occur when viewing DEMO?
if (!gEngfuncs.pDemoAPI->IsPlayingback())
gHUD.m_StrafeGuide.Update(pparams);

// intermission / finale rendering
if( pparams->intermission )
Expand Down

0 comments on commit 0f6cd04

Please sign in to comment.