aboutsummaryrefslogtreecommitdiff
path: root/src/hud.c
diff options
context:
space:
mode:
authorGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-04-05 16:41:32 +0100
committerGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-04-06 20:59:36 +0100
commit7ac57c976d95bce5a7a98e0f269e4cd3d61f3055 (patch)
treefb31a7fa5716579dadf437ebcf799fac62634a2d /src/hud.c
parent44eb8344a000dd315d5e21039871f353441601af (diff)
downloadsst-7ac57c976d95bce5a7a98e0f269e4cd3d61f3055.tar.gz
sst-7ac57c976d95bce5a7a98e0f269e4cd3d61f3055.zip
Pass screen width and height into HudPaint events
This makes it unnecessary to call hud_screensize in basically every handler.
Diffstat (limited to 'src/hud.c')
-rw-r--r--src/hud.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/hud.c b/src/hud.c
index f95acbc..dc69a36 100644
--- a/src/hud.c
+++ b/src/hud.c
@@ -58,7 +58,7 @@ REQUIRE_GAMEDATA(vtidx_GetIScheme)
// IScheme
REQUIRE_GAMEDATA(vtidx_GetFont)
-DEF_EVENT(HudPaint)
+DEF_EVENT(HudPaint, int /*width*/, int /*height*/)
// we just use ulongs for API, but keep a struct for vcalls to ensure we get the
// right calling convention (x86 Windows/MSVC is funny about passing structs...)
@@ -96,10 +96,9 @@ static void *matsurf, *toolspanel, *scheme;
typedef void (*VCALLCONV Paint_func)(void *);
static Paint_func orig_Paint;
void VCALLCONV hook_Paint(void *this) {
- // hopefully a smart branch predictor can figure this out - but we still
- // want it to be the "slow" path, so that every other path does *not* need a
- // prediction record. or.. I dunno, in theory that does make sense. shrug.
- if_cold (this == toolspanel) EMIT_HudPaint();
+ int width, height;
+ hud_screensize(&width, &height);
+ if (this == toolspanel) EMIT_HudPaint(width, height);
orig_Paint(this);
}