From 890779713ac34ebd469fae41924cda18543ece5e Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 5 Jan 2025 21:23:45 +0100 Subject: [PATCH 1/5] turn off any active menus when using demo play commands --- src/d_netcmd.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index a6943fe6a..dfd8eda5e 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2435,6 +2435,9 @@ static void Command_Playdemo_f(void) return; } + // turn off any open menus + M_ClearMenus(true); + // disconnect from server here? if (demo.playback) G_StopDemo(); @@ -2480,6 +2483,9 @@ static void Command_Timedemo_f(void) return; } + // turn off any open menus + M_ClearMenus(true); + // disconnect from server here? if (demo.playback) G_StopDemo(); From e796f7e81fa91e9ee95ff4819436d22ae0af2c6e Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 5 Jan 2025 21:24:48 +0100 Subject: [PATCH 2/5] thats not timedemo lel --- src/d_netcmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index dfd8eda5e..eaec437fe 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -2431,7 +2431,7 @@ static void Command_Playdemo_f(void) if (!demo.playback && gamestate == GS_LEVEL) // special case: allow starting another demo while watching a demo { - CONS_Printf(M_GetText("You can't time a demo while in a game.\n")); + CONS_Printf(M_GetText("You can't play a demo while in a game.\n")); return; } From 7177b396e05ab3a94045b3abca05b55b0c8eeb7d Mon Sep 17 00:00:00 2001 From: Alug Date: Sun, 5 Jan 2025 23:02:27 +0100 Subject: [PATCH 3/5] any of those may be NULL in MakePatch no idea but this crap keeps crashing in some other place every single time i add a check somewhere else --- src/hardware/hw_cache.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hardware/hw_cache.c b/src/hardware/hw_cache.c index ad140c025..65e120002 100644 --- a/src/hardware/hw_cache.c +++ b/src/hardware/hw_cache.c @@ -410,6 +410,16 @@ static void HWR_GenerateTexture(INT32 texnum, GLMapTexture_t *gltex, boolean noe // patch may be NULL if glMipmap has been initialised already and makebitmap is false void HWR_MakePatch (patch_t *patch, GLPatch_t *glPatch, GLMipmap_t *glMipmap, boolean makebitmap) { + if (glMipmap == NULL) + return; + + if (patch == NULL || glPatch == NULL) + { + Z_Free(glMipmap->data); + glMipmap->data = NULL; + return; + } + // don't do it twice (like a cache) if (glMipmap->width == 0) { From afa66d0418681237d2f32f0b9944cd2490ff101c Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 6 Jan 2025 19:01:58 +0100 Subject: [PATCH 4/5] double the slack for slep --- src/sdl/i_system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 2c8b59ce1..ff1651c3b 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2124,7 +2124,7 @@ void I_SleepDuration(precise_t duration) #if defined(__linux__) || defined(__FreeBSD__) || defined(__HAIKU__) UINT64 precision = I_GetPrecisePrecision(); precise_t dest = I_GetPreciseTime() + duration; - precise_t slack = (precision / 10000); // 0.1 ms slack + precise_t slack = (precision / 5000); // 0.2 ms slack if (duration > slack) { duration -= slack; From dbb5c1482b59550a44792b2a74478e26cf26bc57 Mon Sep 17 00:00:00 2001 From: Alug Date: Mon, 6 Jan 2025 19:49:29 +0100 Subject: [PATCH 5/5] add a little extra safety here ig this crashed on levelload once so idk maybe player was null ig --- src/d_main.c | 4 ++-- src/r_main.c | 19 ++++++++++++------- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/d_main.c b/src/d_main.c index 9bbaa6017..95f7c895d 100644 --- a/src/d_main.c +++ b/src/d_main.c @@ -485,11 +485,11 @@ static boolean D_Display(void) { PS_START_TIMING(ps_rendercalltime); - R_ApplyLevelInterpolators(R_UsingFrameInterpolation() ? rendertimefrac : FRACUNIT); + R_ApplyLevelInterpolators(rendertimefrac); for (i = 0; i <= splitscreen; i++) { - if (players[displayplayers[i]].mo || players[displayplayers[i]].playerstate == PST_DEAD) + if (!P_MobjWasRemoved(players[displayplayers[i]].mo) || players[displayplayers[i]].playerstate == PST_DEAD) { viewssnum = i; diff --git a/src/r_main.c b/src/r_main.c index 9541fef41..511bbe293 100644 --- a/src/r_main.c +++ b/src/r_main.c @@ -1060,11 +1060,13 @@ subsector_t *R_IsPointInSubsector(fixed_t x, fixed_t y) mobj_t *viewmobj; -static void -R_SetupCommonFrame -( player_t * player, - subsector_t * subsector) +static void R_SetupCommonFrame(player_t * player, subsector_t * subsector) { + if (!player) + { + return; + } + newview->player = player; newview->x += quake.x; @@ -1073,7 +1075,7 @@ R_SetupCommonFrame newview->roll = R_ViewRollAngle(player); - if (subsector) + if (subsector != NULL) newview->sector = subsector->sector; else newview->sector = R_PointInSubsector(newview->x, newview->y)->sector; @@ -1214,7 +1216,7 @@ void R_SetupFrame(int s, boolean skybox) { player_t *player = &players[displayplayers[s]]; camera_t *thiscam = &camera[s]; - boolean chasecam = (cv_chasecam[s].value != 0); + boolean chasecam = (cv_chasecam[s].value); subsector_t * subsector = NULL; R_SetViewContext(VIEWCONTEXT_PLAYER1 + s); @@ -1263,7 +1265,10 @@ void R_SetupFrame(int s, boolean skybox) newview->y = thiscam->y; newview->z = thiscam->z + (thiscam->height>>1); - R_SetupCommonFrame(player, thiscam->subsector); + if (thiscam != NULL) + subsector = thiscam->subsector; + + R_SetupCommonFrame(player, subsector); } else // use the player's eyes view {