From 457ca505f507922c7470e9e8daef5d8482f664b0 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Mon, 20 Jan 2020 11:32:27 +0100 Subject: [PATCH] make "3-key doors work with only 2 keys" bug optional (#45) * make "3-key doors work with only 2 keys" bug optional, fixes #38 * Introduce a compatibility flag for MBF's most famous bug and add it to the second menu page in the Doom Compatibility section. * reverse comp[] logic * add (config_t *) pointer casts * improve menu item description * rename 3keydoors to 3keydoor, matching the menu item * comments --- Source/doomstat.h | 3 +++ Source/m_menu.c | 8 ++++++++ Source/m_misc.c | 9 +++++++++ Source/p_spec.c | 4 +++- 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Source/doomstat.h b/Source/doomstat.h index e93986e9..b096ccda 100644 --- a/Source/doomstat.h +++ b/Source/doomstat.h @@ -111,6 +111,9 @@ enum { comp_stairs, comp_infcheat, comp_zerotags, + // [FG] 3-key door works with only 2 keys + // http://prboom.sourceforge.net/mbf-bugs.html + comp_3keydoor, COMP_TOTAL=32 // Some extra room for additional variables }; diff --git a/Source/m_menu.c b/Source/m_menu.c index 7f422156..4d1ca1d7 100644 --- a/Source/m_menu.c +++ b/Source/m_menu.c @@ -3185,6 +3185,9 @@ enum compat_model, compat_zerotags, compat_menu, + // [FG] 3-key door works with only 2 keys + // http://prboom.sourceforge.net/mbf-bugs.html + compat_3keydoor, }; setup_menu_t comp_settings1[] = // Compatibility Settings screen #1 @@ -3260,6 +3263,11 @@ setup_menu_t comp_settings2[] = // Compatibility Settings screen #2 {"Use Doom's main menu ordering", S_YESNO, m_null, C_X, C_Y + compat_menu * COMP_SPC, {"traditional_menu"}, 0, 0, M_ResetMenu}, + // [FG] 3-key door works with only 2 keys + // http://prboom.sourceforge.net/mbf-bugs.html + {"Fix 3-key door works with only 2 keys", S_YESNO, m_null, C_X, + C_Y + compat_3keydoor * COMP_SPC, {"comp_3keydoor"}}, + {"<- PREV", S_SKIP|S_PREV, m_null, KB_PREV, C_Y+C_NEXTPREV,{comp_settings1}}, // Final entry diff --git a/Source/m_misc.c b/Source/m_misc.c index df963bdc..c3e50eb3 100644 --- a/Source/m_misc.c +++ b/Source/m_misc.c @@ -570,6 +570,15 @@ default_t defaults[] = { "Linedef effects work with sector tag = 0" }, + // [FG] 3-key door works with only 2 keys + // http://prboom.sourceforge.net/mbf-bugs.html + { + "comp_3keydoor", + (config_t *) &default_comp[comp_3keydoor], (config_t *) &comp[comp_3keydoor], + {0}, {0,1}, number, ss_comp, wad_yes, + "Fix 3-key door works with only 2 keys" + }, + // For key bindings, the values stored in the key_* variables // phares // are the internal Doom Codes. The values stored in the default.cfg // file are the keyboard codes. I_ScanCode2DoomCode converts from diff --git a/Source/p_spec.c b/Source/p_spec.c index 1f358281..a060e245 100644 --- a/Source/p_spec.c +++ b/Source/p_spec.c @@ -803,7 +803,9 @@ boolean P_CanUnlockGenDoor(line_t *line, player_t *player) if (skulliscard && (!(player->cards[it_redcard] | player->cards[it_redskull]) || !(player->cards[it_bluecard] | player->cards[it_blueskull]) || - !(player->cards[it_yellowcard] | !player->cards[it_yellowskull]))) + // [FG] 3-key door works with only 2 keys + // http://prboom.sourceforge.net/mbf-bugs.html + !(player->cards[it_yellowcard] | (!comp[comp_3keydoor] ? !player->cards[it_yellowskull] : player->cards[it_yellowskull])))) { player->message = s_PD_ALL3; // Ty 03/27/98 - externalized S_StartSound(player->mo,sfx_oof); // killough 3/20/98