From 79332fff899fb58669103a7de862bde780124bfa Mon Sep 17 00:00:00 2001 From: NagyD Date: Sat, 20 Mar 2021 18:39:19 +0100 Subject: [PATCH] Added a debug cheat to quickload but keep the currently loaded level. (Shift+F9) --- doc/ChangeLog.txt | 2 ++ doc/Readme.txt | 6 ++++++ src/seg000.c | 10 +++++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/doc/ChangeLog.txt b/doc/ChangeLog.txt index 2db6db35..3cb853ec 100644 --- a/doc/ChangeLog.txt +++ b/doc/ChangeLog.txt @@ -613,3 +613,5 @@ FIXED: Make it possible to go through a certain closed gate on level 11 of Demo Testcase: replays-testcases/Demo by Suave Prince level 11.p1r FIXED: When the prince jumps up at the bottom of a big pillar split between two rooms, a part near the top of the screen disappears. Example: The top row in the first room of the original level 5. +DONE: Added a debug cheat to quickload but keep the currently loaded level. (Shift+F9) + Motivation: https://forum.princed.org/viewtopic.php?p=32556#p32556 diff --git a/doc/Readme.txt b/doc/Readme.txt index ea84adc8..6af1ed62 100644 --- a/doc/Readme.txt +++ b/doc/Readme.txt @@ -218,6 +218,12 @@ See SDLPoP.ini for details. * [: shift kid 1 pixel to the left * ]: shift kid 1 pixel to the right * T: Toggle timer (remaining minutes:seconds:ticks). Also shows the total elapsed ticks during playback. +* Shift+F9: Quickload but keep the currently loaded level. + * Intended use: Suppose you made a quicksave after you got the prince or a guard into a specific position needed for a trick. + Then you try to do the trick, but you realize that you need to change the level slightly to make the trick work. So you edit the level. + But you can't use a (regular) quickload to get back to the saved position, because that would load the previous version of the level from the quicksave file. + In this situation, press Ctrl+A to load the new version of the level, then press Shift+F9 to load the quicksave onto this new level. + * Motivation: https://forum.princed.org/viewtopic.php?p=32556#p32556 Where is the music? ---------------------- diff --git a/src/seg000.c b/src/seg000.c index e9a084a8..a318c54e 100644 --- a/src/seg000.c +++ b/src/seg000.c @@ -254,7 +254,15 @@ int quick_process(process_func_type process_func) { int ok = 1; #define process(x) ok = ok && process_func(&(x), sizeof(x)) // level - process(level); +#ifdef USE_DEBUG_CHEATS + // Don't load the level if the user holds either Shift key while pressing F9. + if (debug_cheats_enabled && (key_states[SDL_SCANCODE_LSHIFT] || key_states[SDL_SCANCODE_RSHIFT])) { + fseek(quick_fp, sizeof(level), SEEK_CUR); + } else +#endif + { + process(level); + } process(checkpoint); process(upside_down); process(drawn_room);