From dac878f0d984227099c086e2c5b8218bbfd91292 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 22 Nov 2021 11:38:31 +0100 Subject: [PATCH 1/6] only compose etxtures of patches that are in the range of known patches Fixes a crash at startup with t-drought_RC2.wad --- Source/r_data.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Source/r_data.c b/Source/r_data.c index a4a58993f..1bfd9b2ec 100644 --- a/Source/r_data.c +++ b/Source/r_data.c @@ -674,9 +674,17 @@ void R_InitTextures (void) for (j=0 ; jpatchcount ; j++, mpatch++, patch++) { + short p = SHORT(mpatch->patch); patch->originx = SHORT(mpatch->originx); patch->originy = SHORT(mpatch->originy); - patch->patch = patchlookup[SHORT(mpatch->patch)]; + if (p >= 0 && p < nummappatches) + { + patch->patch = patchlookup[p]; + } + else + { + patch->patch = -1; + } if (patch->patch == -1) { // killough 8/8/98 printf("\nR_InitTextures: Missing patch %d in texture %.8s", From 88c93e2fe639671df5e0f09e6c5eef52d00643be Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 22 Nov 2021 11:41:53 +0100 Subject: [PATCH 2/6] add Crispy comment --- Source/r_data.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/r_data.c b/Source/r_data.c index 1bfd9b2ec..83cd3f71a 100644 --- a/Source/r_data.c +++ b/Source/r_data.c @@ -674,9 +674,11 @@ void R_InitTextures (void) for (j=0 ; jpatchcount ; j++, mpatch++, patch++) { - short p = SHORT(mpatch->patch); + short p; patch->originx = SHORT(mpatch->originx); patch->originy = SHORT(mpatch->originy); + p = SHORT(mpatch->patch); + // [crispy] catch out-of-range patches if (p >= 0 && p < nummappatches) { patch->patch = patchlookup[p]; From a36744b5161a77f4086e92bec385866348cfe84b Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 22 Nov 2021 11:58:50 +0100 Subject: [PATCH 3/6] let max screenwidth correspond to 21:9 width in hires mode Also, account for the fact that I_GetScreenDimensions() works entirely in the lores regime and adapt SCREENWIDTH calculation accordingly. --- Source/i_video.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Source/i_video.c b/Source/i_video.c index ea12133a1..307d29e94 100644 --- a/Source/i_video.c +++ b/Source/i_video.c @@ -1259,9 +1259,16 @@ void I_GetScreenDimensions(void) { SCREENWIDTH = w * ah / h; // [crispy] make sure SCREENWIDTH is an integer multiple of 4 ... - SCREENWIDTH = (SCREENWIDTH + (hires ? 0 : 3)) & (int)~3; - // [crispy] ... but never exceeds MAXWIDTH (array size!) - SCREENWIDTH = MIN(SCREENWIDTH, MAX_SCREENWIDTH); + if (hires) + { + SCREENWIDTH = ((2 * SCREENWIDTH) & (int)~3) / 2; + } + else + { + SCREENWIDTH = (SCREENWIDTH + 3) & (int)~3; + } + // [crispy] ... but never exceeds MAX_SCREENWIDTH (array size!) + SCREENWIDTH = MIN(SCREENWIDTH, MAX_SCREENWIDTH / 2); } WIDESCREENDELTA = (SCREENWIDTH - NONWIDEWIDTH) / 2; From 7dc92387dd9aefedebe3cdd9c075bf60fd93ff32 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 22 Nov 2021 11:59:45 +0100 Subject: [PATCH 4/6] header addendum --- Source/doomdef.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/doomdef.h b/Source/doomdef.h index 347a8265b..8fe513319 100644 --- a/Source/doomdef.h +++ b/Source/doomdef.h @@ -111,7 +111,7 @@ extern int bfgedition; #define ORIGWIDTH 320 // [crispy] #define ORIGHEIGHT 200 // [crispy] -#define MAX_SCREENWIDTH (ORIGWIDTH << 2) // [crispy] +#define MAX_SCREENWIDTH 1120 // [FG] corresponds to 21:9 in hires mode #define MAX_SCREENHEIGHT (ORIGHEIGHT << 1) // [crispy] // The maximum number of players, multiplayer/networking. From 87e9b8d2e4174087629772dc6b315932c2f42036 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Mon, 22 Nov 2021 19:06:11 +0700 Subject: [PATCH 5/6] bring implementation of soul bounce fix inline with PrBoom+ (#358) * add new line * bring implementation of soul bounce fix inline with PrBoom+ * use P_SetTarget * add comments --- Source/p_enemy.c | 4 ++-- Source/p_mobj.c | 14 ++++++++++++-- Source/w_wad.c | 2 +- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/Source/p_enemy.c b/Source/p_enemy.c index ec603ed5a..045eafe95 100644 --- a/Source/p_enemy.c +++ b/Source/p_enemy.c @@ -3011,7 +3011,7 @@ void A_FindTracer(mobj_t *actor) fov = FixedToAngle(actor->state->args[0]); dist = (actor->state->args[1]); - actor->tracer = P_RoughTargetSearch(actor, fov, dist); + P_SetTarget(&actor->tracer, P_RoughTargetSearch(actor, fov, dist)); } // @@ -3023,7 +3023,7 @@ void A_ClearTracer(mobj_t *actor) if (!mbf21 || !actor) return; - actor->tracer = NULL; + P_SetTarget(&actor->tracer, NULL); } // diff --git a/Source/p_mobj.c b/Source/p_mobj.c index 2660007e6..99a509413 100644 --- a/Source/p_mobj.c +++ b/Source/p_mobj.c @@ -507,7 +507,8 @@ static void P_ZMovement (mobj_t* mo) // hit the floor // [FG] game version specific differences - int correct_lost_soul_bounce = !demo_compatibility || gameversion >= exe_ultimate; + int correct_lost_soul_bounce = !comp[comp_soul] || !demo_compatibility || + gameversion >= exe_ultimate; if (correct_lost_soul_bounce && mo->flags & MF_SKULLFLY) { @@ -567,6 +568,11 @@ static void P_ZMovement (mobj_t* mo) if (mo->z + mo->height > mo->ceilingz) { + // cph 2001/04/15 - + // Lost souls were meant to bounce off of ceilings + if (!comp[comp_soul] && mo->flags & MF_SKULLFLY) + mo->momz = -mo->momz; // the skull slammed into something + // hit the ceiling if (mo->momz > 0) @@ -574,7 +580,11 @@ static void P_ZMovement (mobj_t* mo) mo->z = mo->ceilingz - mo->height; - if (mo->flags & MF_SKULLFLY) + // cph 2001/04/15 - + // We might have hit a ceiling but had downward momentum (e.g. ceiling is + // lowering on us), so for old demos we must still do the buggy + // momentum reversal here + if (comp[comp_soul] && mo->flags & MF_SKULLFLY) mo->momz = -mo->momz; // the skull slammed into something if (!((mo->flags ^ MF_MISSILE) & (MF_MISSILE | MF_NOCLIP))) diff --git a/Source/w_wad.c b/Source/w_wad.c index 0b203b947..eedc7d611 100644 --- a/Source/w_wad.c +++ b/Source/w_wad.c @@ -75,7 +75,7 @@ void ExtractFileBase(const char *path, char *dest) if (++length == 9) { // [FG] remove length check - printf ("Filename base of %s >8 chars",path); + printf ("Filename base of %s >8 chars\n",path); break; } else From c06a477a8b7bc42ecbd26b683690ff0ef9ac26d8 Mon Sep 17 00:00:00 2001 From: Roman Fomin Date: Tue, 23 Nov 2021 14:43:17 +0700 Subject: [PATCH 6/6] fix comp_soul option for boom/mbf complevel --- Source/g_game.c | 2 ++ Source/p_mobj.c | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/g_game.c b/Source/g_game.c index 85566f1d1..cf0ed00c0 100644 --- a/Source/g_game.c +++ b/Source/g_game.c @@ -2435,6 +2435,7 @@ static int G_GetWadComplevel(void) static void G_MBFComp() { comp[comp_respawn] = 1; + comp[comp_soul] = 1; comp[comp_ledgeblock] = 0; comp[comp_friendlyspawn] = 1; comp[comp_voodooscroller] = 1; @@ -2451,6 +2452,7 @@ static void G_BoomComp() comp[comp_zombie] = 1; comp[comp_infcheat] = 1; comp[comp_respawn] = 1; + comp[comp_soul] = 1; comp[comp_ledgeblock] = 0; comp[comp_friendlyspawn] = 1; comp[comp_voodooscroller] = 0; diff --git a/Source/p_mobj.c b/Source/p_mobj.c index 99a509413..cd4d04544 100644 --- a/Source/p_mobj.c +++ b/Source/p_mobj.c @@ -507,10 +507,9 @@ static void P_ZMovement (mobj_t* mo) // hit the floor // [FG] game version specific differences - int correct_lost_soul_bounce = !comp[comp_soul] || !demo_compatibility || - gameversion >= exe_ultimate; + int correct_lost_soul_bounce = !demo_compatibility || gameversion >= exe_ultimate; - if (correct_lost_soul_bounce && mo->flags & MF_SKULLFLY) + if ((!comp[comp_soul] || correct_lost_soul_bounce) && mo->flags & MF_SKULLFLY) { mo->momz = -mo->momz; // the skull slammed into something }