From 22ce859e65da2a0770d6966e0c1a3f32192cb54d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 13 Oct 2024 14:06:45 +0200 Subject: [PATCH 1/3] Fix BootMap not having any effect when loaded from the addon menu --- src/deh_soc.c | 2 ++ src/dehacked.c | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index c0e646f60..a2be99fa0 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3549,6 +3549,8 @@ void readmaincfg(MYFILE *f) char *tmp; INT32 value; + bootmap = 0; // reset bootmap so we don't warp to the wrong map if another maincfg had set this before + do { if (myfgets(s, MAXLINELEN, f)) diff --git a/src/dehacked.c b/src/dehacked.c index 2050a117f..8743a482e 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -587,7 +587,12 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) if (gamestate == GS_TITLESCREEN) { - if (introchanged) + if (bootmap) + { + menuactive = false; + D_MapChange(bootmap, gametype, ultimatemode, true, 0, false, false); + } + else if (introchanged) { menuactive = false; I_UpdateMouseGrab(); From 0b2202e5cbc9f1139598e88cd68345bddf6d5000 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 13 Oct 2024 16:50:41 +0200 Subject: [PATCH 2/3] Fix bootmap not resetting properly after reload --- src/deh_soc.c | 2 -- src/dehacked.c | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index a2be99fa0..c0e646f60 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3549,8 +3549,6 @@ void readmaincfg(MYFILE *f) char *tmp; INT32 value; - bootmap = 0; // reset bootmap so we don't warp to the wrong map if another maincfg had set this before - do { if (myfgets(s, MAXLINELEN, f)) diff --git a/src/dehacked.c b/src/dehacked.c index 8743a482e..505c7ed1f 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -196,6 +196,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) deh_num_warning = 0; + bootmap = 0; gamedataadded = titlechanged = introchanged = false; // it doesn't test the version of SRB2 and version of dehacked file From 0dac4ed492fd78d801f939a8fef27fcf7a7c3655 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gustaf=20Alh=C3=A4ll?= Date: Sun, 13 Oct 2024 17:47:56 +0200 Subject: [PATCH 3/3] Fix (hopufully) all remaining edge cases --- src/deh_soc.c | 1 + src/dehacked.c | 6 +++--- src/dehacked.h | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/deh_soc.c b/src/deh_soc.c index c0e646f60..80a5358c0 100644 --- a/src/deh_soc.c +++ b/src/deh_soc.c @@ -3925,6 +3925,7 @@ void readmaincfg(MYFILE *f) value = get_number(word2); bootmap = (INT16)value; + bootmapchanged = true; //titlechanged = true; } else if (fastcmp(word, "STARTCHAR")) diff --git a/src/dehacked.c b/src/dehacked.c index 505c7ed1f..473e77e55 100644 --- a/src/dehacked.c +++ b/src/dehacked.c @@ -20,6 +20,7 @@ boolean deh_loaded = false; boolean gamedataadded = false; boolean titlechanged = false; boolean introchanged = false; +boolean bootmapchanged = false; static int dbg_line; static INT32 deh_num_warning = 0; @@ -196,8 +197,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) deh_num_warning = 0; - bootmap = 0; - gamedataadded = titlechanged = introchanged = false; + gamedataadded = titlechanged = introchanged = bootmapchanged = false; // it doesn't test the version of SRB2 and version of dehacked file dbg_line = -1; // start at -1 so the first line is 0. @@ -588,7 +588,7 @@ static void DEH_LoadDehackedFile(MYFILE *f, boolean mainfile) if (gamestate == GS_TITLESCREEN) { - if (bootmap) + if (bootmapchanged && bootmap) { menuactive = false; D_MapChange(bootmap, gametype, ultimatemode, true, 0, false, false); diff --git a/src/dehacked.h b/src/dehacked.h index d985b14b0..e7b9b4656 100644 --- a/src/dehacked.h +++ b/src/dehacked.h @@ -39,6 +39,7 @@ extern boolean deh_loaded; extern boolean gamedataadded; extern boolean titlechanged; extern boolean introchanged; +extern boolean bootmapchanged; #define MAX_ACTION_RECURSION 30 extern const char *luaactions[MAX_ACTION_RECURSION];