From c8737bd43f35d7af2c5436d6afcaf9d3292043e3 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 6 Jan 2025 22:50:15 +0100 Subject: [PATCH 1/2] make this more complicated due to a "-" --- src/st_stuff.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/st_stuff.c b/src/st_stuff.c index 64e244b78..d189e2c23 100644 --- a/src/st_stuff.c +++ b/src/st_stuff.c @@ -656,18 +656,19 @@ static void ST_drawLevelTitle(void) // returns the actual button name for any gamecontrol // if unbound is set, it returns "Unbound" as a string should there be no button bound to a gamecontrol -static const char *ST_GetButtonName(INT32 control, const char *inputtext, boolean unbound) +// if gamectrl is set, it adds an extra "-" for cases where theres also a hardcoded button like accelerate +static const char *ST_GetButtonName(INT32 control, const char *inputtext, boolean unbound, boolean gamectrl) { static char buttname[32] = ""; const char *butt1 = (gamecontrol[control][0] != 0 ? G_KeynumToString(gamecontrol[control][0]) : NULL); const char *butt2 = (gamecontrol[control][1] != 0 ? G_KeynumToString(gamecontrol[control][1]) : NULL); // alternative bind if (butt1 == NULL && butt2 == NULL) // not bound to a button - snprintf(buttname, 32, (unbound ? "%s - %s" : "- %s - %s"), (unbound ? "Unbound" : ""), inputtext); + snprintf(buttname, 32, (unbound ? "%s - %s" : (gamectrl ? "-%s - %s" : "%s - %s")), (unbound ? "Unbound" : ""), inputtext); else if (butt1 != NULL && butt2 != NULL) // bound to two buttons snprintf(buttname, 32, "%s/%s - %s", butt1, butt2, inputtext); else // bound to only one - snprintf(buttname, 32, "- %s - %s", (butt1 != NULL ? butt1 : butt2 != NULL ? butt2 : ""), inputtext); + snprintf(buttname, 32, (gamectrl ? "-%s - %s" : "%s - %s"), (butt1 != NULL ? butt1 : butt2 != NULL ? butt2 : ""), inputtext); return buttname; } @@ -796,16 +797,16 @@ static void ST_overlayDrawer(void) { V_DrawString(2, BASEVIDHEIGHT-50, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -")); V_DrawString(2, BASEVIDHEIGHT-40, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, itemtxt); - V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, va("Accelerate %s", ST_GetButtonName(gc_camfloat, "Float", false))); - V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, va("Brake %s", ST_GetButtonName(gc_camsink, "Sink", false))); - V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, ST_GetButtonName(gc_director, "Toggle Director", true)); + V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, va("Accelerate %s", ST_GetButtonName(gc_camfloat, "Float", false, true))); + V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, va("Brake %s", ST_GetButtonName(gc_camsink, "Sink", false, true))); + V_DrawString(2, BASEVIDHEIGHT-10, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, ST_GetButtonName(gc_director, "Toggle Director", true, false)); } else { V_DrawString(2, BASEVIDHEIGHT-40, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF|V_YELLOWMAP, M_GetText("- SPECTATING -")); V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, itemtxt); - V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, va("Accelerate %s", ST_GetButtonName(gc_camfloat, "Float", false))); - V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, va("Brake %s", ST_GetButtonName(gc_camsink, "Sink", false))); + V_DrawString(2, BASEVIDHEIGHT-30, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, va("Accelerate %s", ST_GetButtonName(gc_camfloat, "Float", false, true))); + V_DrawString(2, BASEVIDHEIGHT-20, V_SNAPTOBOTTOM|V_SNAPTOLEFT|V_HUDTRANSHALF, va("Brake %s", ST_GetButtonName(gc_camsink, "Sink", false, true))); } } } From 03e45f459008315749cecc8a04c0c83be10ae039 Mon Sep 17 00:00:00 2001 From: Alug Date: Tue, 7 Jan 2025 16:28:38 +0100 Subject: [PATCH 2/2] check for cam subsector since we can move it around and i added this to freecam mode, subsector may be null for reason so better be safe than sorry --- src/p_mobj.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/p_mobj.c b/src/p_mobj.c index 46fb35f65..2b120b99c 100644 --- a/src/p_mobj.c +++ b/src/p_mobj.c @@ -3141,7 +3141,7 @@ static boolean P_CameraCheckHeat(camera_t *thiscam) sector_t *sector; fixed_t halfheight; - if (!thiscam) + if (!thiscam || !thiscam->subsector) return false; halfheight = thiscam->z + (thiscam->height >> 1); @@ -3179,7 +3179,7 @@ static boolean P_CameraCheckWater(camera_t *thiscam) sector_t *sector; fixed_t halfheight; - if (!thiscam) + if (!thiscam || !thiscam->subsector) return false; halfheight = thiscam->z + (thiscam->height >> 1);