Skip to content

Commit

Permalink
Fix DrawOverlay happening outside scene render
Browse files Browse the repository at this point in the history
  • Loading branch information
luttje committed Aug 24, 2024
1 parent 1deb5db commit 622d472
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/game/client/cdll_client_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -516,7 +516,7 @@ class CHLVoiceStatusHelper : public IVoiceStatusHelper
LUA_CALL_HOOK_BEGIN( "GetPlayerTextColor", "Allows overriding the color of the player's name in the scoreboard." );
CBasePlayer::PushLuaInstanceSafe( L, entity ); // doc: player
lua_pushcolor( L, color ); // doc: color (the color of the player's name in the scoreboard)
LUA_CALL_HOOK_END( 1, 1 ); // doc: color (return a replacement color to override the default color)
LUA_CALL_HOOK_END( 2, 1 ); // doc: color (return a replacement color to override the default color)

if ( lua_iscolor( L, -1 ) )
{
Expand Down
14 changes: 5 additions & 9 deletions src/game/client/viewrender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,6 @@
// Projective textures
#include "C_Env_Projected_Texture.h"

#ifdef LUA_SDK
#include <mathlib/lvector.h>
#endif

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

Expand Down Expand Up @@ -2362,6 +2358,11 @@ void CViewRender::RenderView( const CViewSetup &view, int nClearFlags, int whatT

Render2DEffectsPostHUD( view );

#ifdef LUA_SDK
LUA_CALL_HOOK_BEGIN( "DrawOverlay" );
LUA_CALL_HOOK_END( 0, 0 );
#endif

g_bRenderingView = false;

// We can no longer use the 'current view' stuff set up in ViewDrawScene
Expand All @@ -2372,11 +2373,6 @@ void CViewRender::RenderView( const CViewSetup &view, int nClearFlags, int whatT
CDebugViewRender::GenerateOverdrawForTesting();
}

#ifdef LUA_SDK
LUA_CALL_HOOK_BEGIN( "DrawOverlay" );
LUA_CALL_HOOK_END( 0, 0 );
#endif

render->PopView( GetFrustum() );
g_WorldListCache.Flush();
}
Expand Down
11 changes: 4 additions & 7 deletions src/game/shared/lrender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@
LUA_REGISTRATION_INIT( Renders );

#ifdef CLIENT_DLL
// Frustrums for PushView2D and -3D functions
static Frustum renderFrustum3D;
static Frustum renderFrustum2D;

// Minifaction and magnification filter stacks
static CUtlStack< ShaderAPITextureHandle_t > filterTextureHandlesMinification;
Expand Down Expand Up @@ -177,30 +174,30 @@ LUA_BINDING_BEGIN( Renders, PushView3D, "library", "Push a 3D view.", "client" )
viewSetup.zNear = zNear;
viewSetup.zFar = zFar;

render->Push3DView( viewSetup, 0, NULL, renderFrustum3D );
render->Push3DView( viewSetup, 0, NULL, view->GetFrustum() );

return 0;
}
LUA_BINDING_END()

LUA_BINDING_BEGIN( Renders, PopView3D, "library", "Pop a 3D view.", "client" )
{
render->PopView( renderFrustum3D );
render->PopView( view->GetFrustum() );
return 0;
}
LUA_BINDING_END()

LUA_BINDING_BEGIN( Renders, PushView2D, "library", "Push a 2D view.", "client" )
{
CViewSetup viewSetup = *view->GetPlayerViewSetup();
render->Push2DView( viewSetup, 0, NULL, renderFrustum2D );
render->Push2DView( viewSetup, 0, NULL, view->GetFrustum() );
return 0;
}
LUA_BINDING_END()

LUA_BINDING_BEGIN( Renders, PopView2D, "library", "Pop a 2D view.", "client" )
{
render->PopView( renderFrustum2D );
render->PopView( view->GetFrustum() );
return 0;
}
LUA_BINDING_END()
Expand Down

0 comments on commit 622d472

Please sign in to comment.