From 8a2445820e3a0f81603a1abe05922af31bc2392b Mon Sep 17 00:00:00 2001 From: toaster Date: Thu, 7 Dec 2023 23:11:05 +0000 Subject: [PATCH] General clearup relating to Goner Setup - Clean up handling of goner_levelworking to retry current dialogue if something changes gamedata->gonerlevel - Create wrapper func for resetting ALL text - Gamedata-modifying cheats will set to GDGONER_DONE --- src/m_cheat.c | 5 +++++ src/menus/main-goner.cpp | 30 +++++++++++++++++++++++------- 2 files changed, 28 insertions(+), 7 deletions(-) diff --git a/src/m_cheat.c b/src/m_cheat.c index 7ef09b6d0..677e9e610 100644 --- a/src/m_cheat.c +++ b/src/m_cheat.c @@ -94,7 +94,10 @@ static UINT8 cheatf_warp(void) // Goofy, but this call needs to be before M_ClearMenus because that path // calls G_LoadLevel, which will trigger a gamedata save. Garbage factory if (success) + { + gamedata->gonerlevel = GDGONER_DONE; G_SetUsedCheats(); + } M_ClearMenus(true); @@ -181,6 +184,8 @@ static UINT8 cheatf_devmode(void) mapheaderinfo[i]->records.mapvisited = MV_MAX; } + gamedata->gonerlevel = GDGONER_DONE; + M_ClearMenus(true); // This is a developer feature, you know how to delete ringdata diff --git a/src/menus/main-goner.cpp b/src/menus/main-goner.cpp index 972b53a8a..d3301b130 100644 --- a/src/menus/main-goner.cpp +++ b/src/menus/main-goner.cpp @@ -370,6 +370,13 @@ void M_GonerHidePassword(void) S_StartSound(NULL, sfx_s3k5b); } +void M_GonerResetText(void) +{ + goner_typewriter.ClearText(); + LinesToDigest.clear(); + LinesOutput.clear(); +} + }; // namespace void M_GonerResetLooking(int type) @@ -383,8 +390,6 @@ void M_GonerResetLooking(int type) else if (goner_youactuallylooked > 2*TICRATE && goner_lasttypelooking == gamedata->gonerlevel) { - if (goner_levelworking > gamedata->gonerlevel) - goner_levelworking--; gamedata->gonerlevel++; LinesToDigest.clear(); } @@ -403,6 +408,7 @@ void M_GonerCheckLooking(void) void M_GonerTick(void) { static bool first = true; + static int lastseenlevel = GDGONER_INIT; if (goner_levelworking == GDGONER_INIT) { @@ -417,15 +423,23 @@ void M_GonerTick(void) first = true; // a lie, but only slightly... // Handle rewinding if you clear your gamedata. - goner_typewriter.ClearText(); - LinesToDigest.clear(); - LinesOutput.clear(); + M_GonerResetText(); goner_levelworking = GDGONER_INIT; } M_GonerResetLooking(GDGONER_INIT); + if (gamedata->gonerlevel != lastseenlevel) + { + if (goner_levelworking >= gamedata->gonerlevel) + { + // If the valid range has changed, try the current one again + goner_levelworking--; + } + lastseenlevel = gamedata->gonerlevel; + } + if (first) { first = goner_gdq = false; @@ -671,6 +685,8 @@ void M_GonerGDQ(boolean opinion) } LinesToDigest.reverse(); - goner_levelworking = GDGONER_TUTORIAL; - gamedata->gonerlevel = GDGONER_DONE; + if (gamedata->gonerlevel <= GDGONER_TUTORIAL) + { + goner_levelworking = gamedata->gonerlevel = GDGONER_TUTORIAL; + } }