From 821b952edb6d7247d181357b7d9ce672e78573d9 Mon Sep 17 00:00:00 2001 From: Julia Nechaevskaya Date: Tue, 7 Nov 2023 19:10:09 +0300 Subject: [PATCH 1/5] Preparation: move `demogotonextlvl` to `crispy->` structure Next commit will introduce another operator: "demogotoidclev", and since there are more than one operator, it might be a good idea to make them global, i.e. not hide in depths of g_game.c. --- src/crispy.h | 1 + src/doom/g_game.c | 2 -- src/doom/g_game.h | 1 - src/doom/m_menu.c | 2 +- src/doom/p_mobj.c | 6 +++--- src/doom/s_sound.c | 5 ++--- 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/crispy.h b/src/crispy.h index 773bd30f02..40aabcc320 100644 --- a/src/crispy.h +++ b/src/crispy.h @@ -101,6 +101,7 @@ typedef struct boolean havessg; boolean singleplayer; boolean stretchsky; + boolean demogotonextlvl; // [crispy] custom difficulty parameters boolean autohealth; diff --git a/src/doom/g_game.c b/src/doom/g_game.c index 82d71dce89..608d8b3287 100644 --- a/src/doom/g_game.c +++ b/src/doom/g_game.c @@ -3378,8 +3378,6 @@ boolean G_CheckDemoStatus (void) // [crispy] fast forward to next level while demo playback // -boolean demo_gotonextlvl; - void G_DemoGotoNextLevel (boolean start) { // disable screen rendering while fast forwarding diff --git a/src/doom/g_game.h b/src/doom/g_game.h index c819fed5ff..c3cedf7934 100644 --- a/src/doom/g_game.h +++ b/src/doom/g_game.h @@ -60,7 +60,6 @@ boolean G_CheckDemoStatus (void); // [crispy] fast forward to next level while demo playback extern boolean netdemo; -extern boolean demo_gotonextlvl; void G_DoPlayDemo (void); void G_DemoGotoNextLevel (boolean start); diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c index b19a91d11e..0d97aab0a2 100644 --- a/src/doom/m_menu.c +++ b/src/doom/m_menu.c @@ -2769,7 +2769,7 @@ boolean M_Responder (event_t* ev) if (demoplayback) { // [crispy] go to next level - demo_gotonextlvl = true; + crispy->demogotonextlvl = true; G_DemoGotoNextLevel(true); return true; } diff --git a/src/doom/p_mobj.c b/src/doom/p_mobj.c index bf3aaf1d51..c42eb70e1e 100644 --- a/src/doom/p_mobj.c +++ b/src/doom/p_mobj.c @@ -33,7 +33,7 @@ #include "s_musinfo.h" // [crispy] S_ParseMusInfo() #include "i_swap.h" // [crispy] SHORT() #include "w_wad.h" // [crispy] W_CacheLumpNum() -#include "g_game.h" // [crispy] demo_gotonextlvl +#include "g_game.h" // [crispy] G_DemoGotoNextLevel() #include "doomstat.h" @@ -891,9 +891,9 @@ void P_SpawnPlayer (mapthing_t* mthing) int i; // [crispy] stop fast forward after entering new level while demo playback - if (demo_gotonextlvl) + if (crispy->demogotonextlvl) { - demo_gotonextlvl = false; + crispy->demogotonextlvl = false; G_DemoGotoNextLevel(false); } diff --git a/src/doom/s_sound.c b/src/doom/s_sound.c index 23cfda75b1..0f7fc4010c 100644 --- a/src/doom/s_sound.c +++ b/src/doom/s_sound.c @@ -37,7 +37,6 @@ #include "p_local.h" #include "w_wad.h" #include "z_zone.h" -#include "g_game.h" // [crispy] demo_gotonextlvl // when to clip out sounds // Does not fit the large outdoor areas. @@ -441,7 +440,7 @@ void S_Start(void) { const short curmap = (gameepisode << 8) + gamemap; - if (prevmap == curmap || (nodrawers && singletics && !demo_gotonextlvl)) + if (prevmap == curmap || (nodrawers && singletics && !crispy->demogotonextlvl)) return; prevmap = curmap; @@ -934,7 +933,7 @@ void S_ChangeMusic(int musicnum, int looping) musinfo.current_item = -1; // [crispy] play no music if this is not the right map - if (nodrawers && singletics && !demo_gotonextlvl) + if (nodrawers && singletics && !crispy->demogotonextlvl) return; // [crispy] restart current music if IDMUS00 is entered From 24f295d43b843aa0d9f21545f1abe2ef9a19e336 Mon Sep 17 00:00:00 2001 From: Julia Nechaevskaya Date: Tue, 7 Nov 2023 19:24:00 +0300 Subject: [PATCH 2/5] Move to any previous map by using IDCLEV --- src/crispy.h | 1 + src/doom/g_game.c | 7 +++++++ src/doom/p_setup.c | 1 + src/doom/st_stuff.c | 9 ++++++--- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/src/crispy.h b/src/crispy.h index 40aabcc320..c627d3fa7d 100644 --- a/src/crispy.h +++ b/src/crispy.h @@ -102,6 +102,7 @@ typedef struct boolean singleplayer; boolean stretchsky; boolean demogotonextlvl; + boolean demogotoidclev; // [crispy] custom difficulty parameters boolean autohealth; diff --git a/src/doom/g_game.c b/src/doom/g_game.c index 608d8b3287..9eb8747924 100644 --- a/src/doom/g_game.c +++ b/src/doom/g_game.c @@ -3031,6 +3031,13 @@ void G_DoPlayDemo (void) } } + // [crispy] enable fast forward mode until reached IDCLEVed level + if (crispy->demogotoidclev) + { + nodrawers = true; + singletics = true; + } + skill = *demo_p++; episode = *demo_p++; map = *demo_p++; diff --git a/src/doom/p_setup.c b/src/doom/p_setup.c index 17d84618a9..ea2b6a359a 100644 --- a/src/doom/p_setup.c +++ b/src/doom/p_setup.c @@ -1168,6 +1168,7 @@ P_SetupLevel crispy->demowarp = 0; nodrawers = false; singletics = false; + crispy->demogotoidclev = false; // [crispy] stop fast forward if reached IDCLEVed map } // [crispy] don't load map's default music if loaded from a savegame with MUSINFO data diff --git a/src/doom/st_stuff.c b/src/doom/st_stuff.c index a4393e09a6..4ea786f580 100644 --- a/src/doom/st_stuff.c +++ b/src/doom/st_stuff.c @@ -1337,17 +1337,20 @@ ST_Responder (event_t* ev) // [crisp] allow IDCLEV during demo playback and warp to the requested map if (demoplayback) { + crispy->demowarp = map; + if (map > gamemap) { - crispy->demowarp = map; nodrawers = true; singletics = true; - return true; } else { - return false; + crispy->demogotoidclev = true; + G_DoPlayDemo(); } + + return true; } else G_DeferedInitNew(gameskill, epsd, map); From 7cb949c2a5187bb19b69e6a36e672859f26f0385 Mon Sep 17 00:00:00 2001 From: Julia Nechaevskaya Date: Tue, 7 Nov 2023 20:04:39 +0300 Subject: [PATCH 3/5] Comment: it's "level", not "map" As it's "id-change-level". --- src/doom/p_setup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/doom/p_setup.c b/src/doom/p_setup.c index ea2b6a359a..7df1f71e96 100644 --- a/src/doom/p_setup.c +++ b/src/doom/p_setup.c @@ -1168,7 +1168,7 @@ P_SetupLevel crispy->demowarp = 0; nodrawers = false; singletics = false; - crispy->demogotoidclev = false; // [crispy] stop fast forward if reached IDCLEVed map + crispy->demogotoidclev = false; // [crispy] stop fast forward if reached IDCLEVed level } // [crispy] don't load map's default music if loaded from a savegame with MUSINFO data From 4003df97b44517a220eeec74291361749439f75e Mon Sep 17 00:00:00 2001 From: Julia Nechaevskaya Date: Wed, 8 Nov 2023 09:12:22 +0300 Subject: [PATCH 4/5] Simplify matters --- src/crispy.h | 1 - src/doom/g_game.c | 7 ------- src/doom/p_setup.c | 1 - src/doom/st_stuff.c | 10 +++------- 4 files changed, 3 insertions(+), 16 deletions(-) diff --git a/src/crispy.h b/src/crispy.h index c627d3fa7d..40aabcc320 100644 --- a/src/crispy.h +++ b/src/crispy.h @@ -102,7 +102,6 @@ typedef struct boolean singleplayer; boolean stretchsky; boolean demogotonextlvl; - boolean demogotoidclev; // [crispy] custom difficulty parameters boolean autohealth; diff --git a/src/doom/g_game.c b/src/doom/g_game.c index 9eb8747924..608d8b3287 100644 --- a/src/doom/g_game.c +++ b/src/doom/g_game.c @@ -3031,13 +3031,6 @@ void G_DoPlayDemo (void) } } - // [crispy] enable fast forward mode until reached IDCLEVed level - if (crispy->demogotoidclev) - { - nodrawers = true; - singletics = true; - } - skill = *demo_p++; episode = *demo_p++; map = *demo_p++; diff --git a/src/doom/p_setup.c b/src/doom/p_setup.c index 7df1f71e96..17d84618a9 100644 --- a/src/doom/p_setup.c +++ b/src/doom/p_setup.c @@ -1168,7 +1168,6 @@ P_SetupLevel crispy->demowarp = 0; nodrawers = false; singletics = false; - crispy->demogotoidclev = false; // [crispy] stop fast forward if reached IDCLEVed level } // [crispy] don't load map's default music if loaded from a savegame with MUSINFO data diff --git a/src/doom/st_stuff.c b/src/doom/st_stuff.c index 4ea786f580..58574ff1da 100644 --- a/src/doom/st_stuff.c +++ b/src/doom/st_stuff.c @@ -1338,15 +1338,11 @@ ST_Responder (event_t* ev) if (demoplayback) { crispy->demowarp = map; + nodrawers = true; + singletics = true; - if (map > gamemap) + if (map <= gamemap) { - nodrawers = true; - singletics = true; - } - else - { - crispy->demogotoidclev = true; G_DoPlayDemo(); } From ccf760044beca31ec5ebece320beb95bb8967934 Mon Sep 17 00:00:00 2001 From: Julia Nechaevskaya Date: Wed, 8 Nov 2023 09:24:21 +0300 Subject: [PATCH 5/5] Revert unnecessary changes --- src/crispy.h | 1 - src/doom/g_game.c | 2 ++ src/doom/g_game.h | 1 + src/doom/m_menu.c | 2 +- src/doom/p_mobj.c | 6 +++--- src/doom/s_sound.c | 5 +++-- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/crispy.h b/src/crispy.h index 40aabcc320..773bd30f02 100644 --- a/src/crispy.h +++ b/src/crispy.h @@ -101,7 +101,6 @@ typedef struct boolean havessg; boolean singleplayer; boolean stretchsky; - boolean demogotonextlvl; // [crispy] custom difficulty parameters boolean autohealth; diff --git a/src/doom/g_game.c b/src/doom/g_game.c index 608d8b3287..82d71dce89 100644 --- a/src/doom/g_game.c +++ b/src/doom/g_game.c @@ -3378,6 +3378,8 @@ boolean G_CheckDemoStatus (void) // [crispy] fast forward to next level while demo playback // +boolean demo_gotonextlvl; + void G_DemoGotoNextLevel (boolean start) { // disable screen rendering while fast forwarding diff --git a/src/doom/g_game.h b/src/doom/g_game.h index c3cedf7934..c819fed5ff 100644 --- a/src/doom/g_game.h +++ b/src/doom/g_game.h @@ -60,6 +60,7 @@ boolean G_CheckDemoStatus (void); // [crispy] fast forward to next level while demo playback extern boolean netdemo; +extern boolean demo_gotonextlvl; void G_DoPlayDemo (void); void G_DemoGotoNextLevel (boolean start); diff --git a/src/doom/m_menu.c b/src/doom/m_menu.c index 0d97aab0a2..b19a91d11e 100644 --- a/src/doom/m_menu.c +++ b/src/doom/m_menu.c @@ -2769,7 +2769,7 @@ boolean M_Responder (event_t* ev) if (demoplayback) { // [crispy] go to next level - crispy->demogotonextlvl = true; + demo_gotonextlvl = true; G_DemoGotoNextLevel(true); return true; } diff --git a/src/doom/p_mobj.c b/src/doom/p_mobj.c index c42eb70e1e..bf3aaf1d51 100644 --- a/src/doom/p_mobj.c +++ b/src/doom/p_mobj.c @@ -33,7 +33,7 @@ #include "s_musinfo.h" // [crispy] S_ParseMusInfo() #include "i_swap.h" // [crispy] SHORT() #include "w_wad.h" // [crispy] W_CacheLumpNum() -#include "g_game.h" // [crispy] G_DemoGotoNextLevel() +#include "g_game.h" // [crispy] demo_gotonextlvl #include "doomstat.h" @@ -891,9 +891,9 @@ void P_SpawnPlayer (mapthing_t* mthing) int i; // [crispy] stop fast forward after entering new level while demo playback - if (crispy->demogotonextlvl) + if (demo_gotonextlvl) { - crispy->demogotonextlvl = false; + demo_gotonextlvl = false; G_DemoGotoNextLevel(false); } diff --git a/src/doom/s_sound.c b/src/doom/s_sound.c index 0f7fc4010c..23cfda75b1 100644 --- a/src/doom/s_sound.c +++ b/src/doom/s_sound.c @@ -37,6 +37,7 @@ #include "p_local.h" #include "w_wad.h" #include "z_zone.h" +#include "g_game.h" // [crispy] demo_gotonextlvl // when to clip out sounds // Does not fit the large outdoor areas. @@ -440,7 +441,7 @@ void S_Start(void) { const short curmap = (gameepisode << 8) + gamemap; - if (prevmap == curmap || (nodrawers && singletics && !crispy->demogotonextlvl)) + if (prevmap == curmap || (nodrawers && singletics && !demo_gotonextlvl)) return; prevmap = curmap; @@ -933,7 +934,7 @@ void S_ChangeMusic(int musicnum, int looping) musinfo.current_item = -1; // [crispy] play no music if this is not the right map - if (nodrawers && singletics && !crispy->demogotonextlvl) + if (nodrawers && singletics && !demo_gotonextlvl) return; // [crispy] restart current music if IDMUS00 is entered