1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-22 20:48:29 +02:00

Prevent other cases of losing unsaved levels by returning to menu

2.3 already made it so that if you ran the `rollcredits` command during
in-editor playtesting, you wouldn't be returned to the title screen
while losing unsaved level changes. But there are plenty of other ways
to go back to the title screen from in-editor playtesting too. Namely,
gamestate 1015 (the gamestate after completing a level) and 82 (time
trial complete).

So just add the appropriate checks to those gamestates, and add a
catch-all check in Game::quittomenu(). Additionally,
Game::updatecustomlevelstats() should not update custom level stats
during in-editor playtesting (otherwise it would still happen even if
the game didn't bring you back to the title screen).

Editor notes will also be shown if the game prevents you from going to
the title screen.

Also, just to make things clear, I also added a level note for when the
level is completed during in-editor playtesting. This is just to make it
clear in cases where it might not be obvious that the game returned you
to the editor for this reason. E.g. you have a terminal that calls
gamestate(1013) in a level with 0 custom crewmates, but when you
activate it, it looks like the terminal didn't work for some reason and
just brought you back to the editor. But that's just only because you
literally just completed the level.
This commit is contained in:
Misa 2023-05-18 19:58:23 -07:00
parent dea77e98fa
commit 24ef59c65e
13 changed files with 71 additions and 0 deletions

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="ERROR: No hi ha cap punt de control|on aparèixer" explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="ERROR: El nombre màxim de lluentons|és 100" explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="ERROR: El nombre màxim de tripulants|és 100" explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="Shan mostrat crèdits" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2},{cen|digits=2}" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="{min}:{sec|digits=2}" explanation="time format M:SS"/>

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="FEHLER: kein Checkpoint zum Spawnen" explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="FEHLER: maximale Anzahl von Dingsdas ist 100" explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="FEHLER: maximale Anzahl von Crewmitgliedern ist 100" explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="Abspann gezeigt" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="{min}:{sec|digits=2}" explanation="time format M:SS"/>

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="" explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="" explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="" explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="" explanation="time format M:SS"/>

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="ERARO: Ne estas konservpunkto ĉi-ĉambre" explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="ERARO: Altlimo de kolektaĵoj estas 100" explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="ERARO: Altlimo de skipanoj estas 100" explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="Agnoskoj montriĝis" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2},{cen|digits=2}" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="{min}:{sec|digits=2}" explanation="time format M:SS"/>

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="ERROR: No hay punto de control por el que aparecer" explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="ERROR: El máximo de baratijas es 100" explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="ERROR: El máximo de tripulantes es 100" explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="Créditos" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2},{cen|digits=2}" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="{min}:{sec|digits=2}" explanation="time format M:SS"/>

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="ERREUR : aucun point de contrôle pour réapparaître" explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="ERREUR : 100 bidules maximum" explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="ERREUR : 100 membres d&apos;équipage maximum" explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="Générique défilé" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="{min}:{sec|digits=2}" explanation="time format M:SS"/>

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="ERRORE: Nessun checkpoint in cui generarsi" explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="ERRORE: Il numero massimo di gingilli è 100" explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="ERRORE: Il numero massimo di compagni è 100" explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="Riconoscimenti mostrati" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2},{cen|digits=2}" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="{min}:{sec|digits=2}" explanation="time format M:SS"/>

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="FOUT: Geen checkpoint om op te starten" explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="FOUT: Maximumaantal trinkets is 100" explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="FOUT: Maximumaantal bemanningsleden is 100" explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="Credits getoond" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2},{cen|digits=2}" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="{min}:{sec|digits=2}" explanation="time format M:SS"/>

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="ERRO: nenhum ponto de controle para gerar" explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="ERRO: o número máximo de trecos é 100" explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="ERRO: o número máximo de membros é 100" explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="Créditos rolados" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="{min}:{sec|digits=2}" explanation="time format M:SS"/>

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="ERRO: Não há ponto de controlo para colocação." explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="ERRO: O limite de fichas é 100." explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="ERRO: O limite de tripulantes é 100." explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="Créditos apresentados" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="{min}:{sec|digits=2}" explanation="time format M:SS"/>

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="ОШИБКА: Нет точки сохранения, с которой можно начать" explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="ОШИБКА: Количество штучек не может превышать 100" explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="ОШИБКА: Количество членов экипажа не может превышать 100" explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="Титры запущены" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="{min}:{sec|digits=2}" explanation="time format M:SS"/>

View File

@ -648,7 +648,10 @@
<string english="ERROR: No checkpoint to spawn at" translation="HATA: Canlanılacak kayıt noktası yok" explanation="we cannot playtest because there is no checkpoint in this room that the player could start (be spawned) at" max="38*3"/>
<string english="ERROR: Max number of trinkets is 100" translation="HATA: Maksimum eşya sayısı 100&apos;dür" explanation="editor, user tried to place another trinket" max="38*3"/>
<string english="ERROR: Max number of crewmates is 100" translation="HATA: Maksimum ekip üyesi sayısı 100&apos;dür" explanation="editor, user tried to place another crewmate" max="38*3"/>
<string english="Level quits to menu" translation="" explanation="editor message, user would have been forcefully returned to title screen but wasn&apos;t" max="38*3"/>
<string english="Level completed" translation="" explanation="editor message, user would have been returned to levels list but wasn&apos;t" max="38*3"/>
<string english="Rolled credits" translation="Jenerik kısmı" explanation="editor message, credits would have been shown but weren&apos;t" max="38*3"/>
<string english="Time trial completed" translation="" explanation="editor message, time trial complete screen would have been shown but wasn&apos;t" max="38*3"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}" explanation="time format H:MM:SS"/>
<string english="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" translation="{hrs}:{min|digits=2}:{sec|digits=2}.{cen|digits=2}" explanation="time format H:MM:SS.CC"/>
<string english="{min}:{sec|digits=2}" translation="{min}:{sec|digits=2}" explanation="time format M:SS"/>

View File

@ -442,6 +442,12 @@ void Game::clearcustomlevelstats(void)
void Game::updatecustomlevelstats(std::string clevel, int cscore)
{
if (!map.custommodeforreal)
{
/* We are playtesting, don't update level stats */
return;
}
if (clevel.find("levels/") != std::string::npos)
{
clevel = clevel.substr(7);
@ -1573,6 +1579,14 @@ void Game::updatestate(void)
case 82:
//Time Trial Complete!
obj.removetrigger(82);
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
if (map.custommode && !map.custommodeforreal)
{
returntoeditor();
ed.show_note(loc::gettext("Time trial completed"));
break;
}
#endif
if (translator_exploring)
{
translator_exploring_allowtele = true;
@ -2151,6 +2165,7 @@ void Game::updatestate(void)
else
{
returntoeditor();
ed.show_note(loc::gettext("Level completed"));
}
#endif
}
@ -7150,8 +7165,28 @@ static void hardreset(void)
script.hardreset();
}
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
static void returntoeditor_callback(void)
{
extern Game game;
game.returntoeditor();
ed.show_note(loc::gettext("Level quits to menu"));
}
#endif
void Game::quittomenu(void)
{
#if !defined(NO_CUSTOM_LEVELS) && !defined(NO_EDITOR)
if (map.custommode && !map.custommodeforreal)
{
/* We are playtesting! Go back to the editor
* instead of losing unsaved changes. */
/* This needs to be deferred, otherwise some state would persist. */
DEFER_CALLBACK(returntoeditor_callback);
return;
}
#endif
gamestate = TITLEMODE;
graphics.fademode = FADE_START_FADEIN;
FILESYSTEM_unmountAssets();