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
This commit is contained in:
toaster 2023-12-07 23:11:05 +00:00
parent ae8db80a75
commit 8a2445820e
2 changed files with 28 additions and 7 deletions

View file

@ -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

View file

@ -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;
}
}