From cead718d8192fafc8a6055438a4a01882d0b0146 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 13 Oct 2019 11:53:53 +0100 Subject: [PATCH 1/5] Additional crash fix for papersprites. --- src/r_things.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/r_things.c b/src/r_things.c index 2ecd116ea..62a8100d9 100644 --- a/src/r_things.c +++ b/src/r_things.c @@ -1230,7 +1230,7 @@ static void R_ProjectSprite(mobj_t *thing) else range = 1; - scalestep = (yscale2 - yscale)/range; + scalestep = (yscale2 - yscale)/range ?: 1; // The following two are alternate sorting methods which might be more applicable in some circumstances. TODO - maybe enable via MF2? // sortscale = max(yscale, yscale2); From 9cf3bd2e74b26e3cf16659f2860574b86194cd3e Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 13 Oct 2019 11:55:50 +0100 Subject: [PATCH 2/5] Revert stupid 2.1-compat fuckup I did in slopes code. --- src/p_map.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/p_map.c b/src/p_map.c index ac5459fed..810d85e34 100644 --- a/src/p_map.c +++ b/src/p_map.c @@ -2733,8 +2733,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->eflags |= MFE_JUSTSTEPPEDDOWN; } #ifdef ESLOPE - // HACK TO FIX DSZ2: apply only if slopes are involved - else if (tmceilingslope && tmceilingz < thingtop && thingtop - tmceilingz <= maxstep) + else if (tmceilingz < thingtop && thingtop - tmceilingz <= maxstep) { thing->z = (thing->ceilingz = thingtop = tmceilingz) - thing->height; thing->ceilingrover = tmceilingrover; @@ -2749,8 +2748,7 @@ boolean P_TryMove(mobj_t *thing, fixed_t x, fixed_t y, boolean allowdropoff) thing->eflags |= MFE_JUSTSTEPPEDDOWN; } #ifdef ESLOPE - // HACK TO FIX DSZ2: apply only if slopes are involved - else if (tmfloorslope && tmfloorz > thing->z && tmfloorz - thing->z <= maxstep) + else if (tmfloorz > thing->z && tmfloorz - thing->z <= maxstep) { thing->z = thing->floorz = tmfloorz; thing->floorrover = tmfloorrover; From 4a7ed2d9ec796e889756bebaf7c6ea7202d09227 Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 13 Oct 2019 11:59:38 +0100 Subject: [PATCH 3/5] MD2 crash fix. --- src/hardware/hw_md2.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/hardware/hw_md2.c b/src/hardware/hw_md2.c index cd1b957f0..b847fdbc3 100644 --- a/src/hardware/hw_md2.c +++ b/src/hardware/hw_md2.c @@ -1277,6 +1277,7 @@ void HWR_DrawMD2(gr_vissprite_t *spr) // MD2 colormap fix // colormap test + if (spr->mobj->subsector) { sector_t *sector = spr->mobj->subsector->sector; UINT8 lightlevel = 255; @@ -1308,6 +1309,8 @@ void HWR_DrawMD2(gr_vissprite_t *spr) else Surf.FlatColor.rgba = HWR_Lighting(lightlevel, NORMALFOG, FADEFOG, false, false); } + else + Surf.FlatColor.rgba = 0xFFFFFFFF; // Look at HWR_ProjectSprite for more { From 6a045930faa856c3a4f59c7ceee25d9ac382e29b Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 13 Oct 2019 12:05:12 +0100 Subject: [PATCH 4/5] Better cpusleep command. Sal said it better than I can, so in her words: * Default to 1, which means potential for a 1-frame loss every once in a while but no longer a complete cpu hog * New minimum is 0, since -1 just did the exact same thing as 0 except slightly more optimized. --- src/d_netcmd.c | 4 ++-- src/sdl/i_system.c | 2 +- src/win32/win_sys.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index bd57c2481..3e9a37078 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -187,7 +187,7 @@ static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"}, static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}}; static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}}; -static CV_PossibleValue_t sleeping_cons_t[] = {{-1, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t sleeping_cons_t[] = {{0, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}}; static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"}, //{2, "Teleport"}, {3, "None"}, {0, NULL}}; @@ -363,7 +363,7 @@ consvar_t cv_runscripts = {"runscripts", "Yes", 0, CV_YesNo, NULL, 0, NULL, NULL consvar_t cv_pause = {"pausepermission", "Server", CV_NETVAR, pause_cons_t, NULL, 0, NULL, NULL, 0, 0, NULL}; consvar_t cv_mute = {"mute", "Off", CV_NETVAR|CV_CALL, CV_OnOff, Mute_OnChange, 0, NULL, NULL, 0, 0, NULL}; -consvar_t cv_sleep = {"cpusleep", "-1", CV_SAVE, sleeping_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL}; +consvar_t cv_sleep = {"cpusleep", "1", CV_SAVE, sleeping_cons_t, NULL, -1, NULL, NULL, 0, 0, NULL}; INT16 gametype = GT_COOP; boolean splitscreen = false; diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index d7926e5b2..461652b67 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2135,7 +2135,7 @@ void I_StartupTimer(void) void I_Sleep(void) { - if (cv_sleep.value != -1) + if (cv_sleep.value > 0) SDL_Delay(cv_sleep.value); } diff --git a/src/win32/win_sys.c b/src/win32/win_sys.c index 93b3ff523..0e2deea1d 100644 --- a/src/win32/win_sys.c +++ b/src/win32/win_sys.c @@ -261,7 +261,7 @@ tic_t I_GetTime(void) void I_Sleep(void) { - if (cv_sleep.value != -1) + if (cv_sleep.value > 0) Sleep(cv_sleep.value); } From fd1a880805d2825fdb729013d43389c92eec8e4e Mon Sep 17 00:00:00 2001 From: toaster Date: Sun, 13 Oct 2019 13:12:07 +0100 Subject: [PATCH 5/5] On the recommendation of Sryder, revert everything relating to the `cpusleep` changes except for the new default value of 1. --- src/d_netcmd.c | 2 +- src/sdl/i_system.c | 2 +- src/win32/win_sys.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_netcmd.c b/src/d_netcmd.c index 3e9a37078..597c05d09 100644 --- a/src/d_netcmd.c +++ b/src/d_netcmd.c @@ -187,7 +187,7 @@ static CV_PossibleValue_t joyport_cons_t[] = {{1, "/dev/js0"}, {2, "/dev/js1"}, static CV_PossibleValue_t teamscramble_cons_t[] = {{0, "Off"}, {1, "Random"}, {2, "Points"}, {0, NULL}}; static CV_PossibleValue_t startingliveslimit_cons_t[] = {{1, "MIN"}, {99, "MAX"}, {0, NULL}}; -static CV_PossibleValue_t sleeping_cons_t[] = {{0, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}}; +static CV_PossibleValue_t sleeping_cons_t[] = {{-1, "MIN"}, {1000/TICRATE, "MAX"}, {0, NULL}}; static CV_PossibleValue_t competitionboxes_cons_t[] = {{0, "Normal"}, {1, "Mystery"}, //{2, "Teleport"}, {3, "None"}, {0, NULL}}; diff --git a/src/sdl/i_system.c b/src/sdl/i_system.c index 461652b67..d7926e5b2 100644 --- a/src/sdl/i_system.c +++ b/src/sdl/i_system.c @@ -2135,7 +2135,7 @@ void I_StartupTimer(void) void I_Sleep(void) { - if (cv_sleep.value > 0) + if (cv_sleep.value != -1) SDL_Delay(cv_sleep.value); } diff --git a/src/win32/win_sys.c b/src/win32/win_sys.c index 0e2deea1d..93b3ff523 100644 --- a/src/win32/win_sys.c +++ b/src/win32/win_sys.c @@ -261,7 +261,7 @@ tic_t I_GetTime(void) void I_Sleep(void) { - if (cv_sleep.value > 0) + if (cv_sleep.value != -1) Sleep(cv_sleep.value); }