From 628b86da4c7a91440cc553423186c766479cfbb5 Mon Sep 17 00:00:00 2001 From: Sally Coolatta Date: Sun, 11 Dec 2022 14:14:12 -0500 Subject: [PATCH] Clear clipping rectangle before each hook call Prevents Lua from being able to make a mess. --- src/d_main.cpp | 3 +++ src/lua_hooklib.c | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/d_main.cpp b/src/d_main.cpp index 1ae89e800..e3a492cf5 100644 --- a/src/d_main.cpp +++ b/src/d_main.cpp @@ -371,6 +371,9 @@ static bool D_Display(void) if (dedicated) //bail out after wipe logic return false; + // Catch runaway clipping rectangles. + V_ClearClipRect(); + // do buffered drawing switch (gamestate) { diff --git a/src/lua_hooklib.c b/src/lua_hooklib.c index f186ccabf..f1439c889 100644 --- a/src/lua_hooklib.c +++ b/src/lua_hooklib.c @@ -27,6 +27,8 @@ #include "d_netcmd.h" // for cv_perfstats #include "i_system.h" // I_GetPreciseTime +#include "v_video.h" // V_ClearClipRect + /* ========================================================================= ABSTRACTION ========================================================================= */ @@ -672,8 +674,13 @@ void LUA_HookHUD(huddrawlist_h list, int hook_type) hud_interpcounter = 0; hud_running = true; // local hook + + // Catch runaway clipping rectangles. + V_ClearClipRect(); + init_hook_call(&hook, 0, res_none); call_mapped_hud(&hook, map); + hud_running = false; } }