1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-12-22 17:49:43 +01:00

Add being able to delete a custom level quicksave

Custom level quicksaves are NOT affected by the clear data menu, so the
player should be able to delete quicksaves this way. The quicksave
confirmation menu now has an extra option to delete the save (and that
option also has its own confirmation menu before deleting).
This commit is contained in:
Misa 2021-08-11 20:26:58 -07:00
parent 12e8924efc
commit 3a2265ef0d
4 changed files with 45 additions and 0 deletions

View file

@ -6033,9 +6033,15 @@ void Game::createmenu( enum Menu::MenuName t, bool samemenu/*= false*/ )
case Menu::quickloadlevel:
option("continue from save");
option("start from beginning");
option("delete save");
option("back to levels");
menuyoff = -30;
break;
case Menu::deletequicklevel:
option("no! don't delete");
option("yes, delete save");
menuyoff = 64;
break;
case Menu::youwannaquit:
option("yes, quit");
option("no, return");
@ -6537,6 +6543,16 @@ void Game::deletetele(void)
telesummary = "";
}
void Game::customdeletequick(const std::string& file)
{
const std::string path = "saves/" + file.substr(7) + ".vvv";
if (!FILESYSTEM_delete(path.c_str()))
{
printf("Error deleting %s\n", path.c_str());
}
}
void Game::swnpenalty(void)
{
//set the SWN clock back to the closest 5 second interval

View file

@ -32,6 +32,7 @@ namespace Menu
playerworlds,
levellist,
quickloadlevel,
deletequicklevel,
youwannaquit,
errornostart,
errorsavingsettings,
@ -197,6 +198,8 @@ public:
void customloadquick(std::string savfile);
void loadquick(void);
void customdeletequick(const std::string& file);
void loadsummary(void);
void readmaingamesave(tinyxml2::XMLDocument& doc);

View file

@ -473,6 +473,11 @@ static void menuactionpress(void)
startmode(22);
break;
case 2:
music.playef(11);
game.createmenu(Menu::deletequicklevel);
map.nexttowercolour();
break;
default:
music.playef(11);
game.returnmenu();
map.nexttowercolour();
@ -480,6 +485,23 @@ static void menuactionpress(void)
}
break;
#if !defined(NO_CUSTOM_LEVELS)
case Menu::deletequicklevel:
switch (game.currentmenuoption)
{
default:
music.playef(11);
game.returnmenu();
break;
case 1:
game.customdeletequick(ed.ListOfMetaData[game.playcustomlevel].filename);
game.returntomenu(Menu::levellist);
game.flashlight = 5;
game.screenshake = 15;
music.playef(23);
break;
}
map.nexttowercolour();
break;
case Menu::playerworlds:
#if defined(NO_EDITOR)
#define OFFSET -1

View file

@ -546,6 +546,10 @@ static void menurender(void)
graphics.Print( -1, 100, "Are you sure you want to", tr, tg, tb, true);
graphics.Print( -1, 110, "delete all your saved data?", tr, tg, tb, true);
break;
case Menu::deletequicklevel:
graphics.Print(-1, 100, "Are you sure you want to", tr, tg, tb, true);
graphics.Print(-1, 110, "delete your quicksave?", tr, tg, tb, true);
break;
case Menu::startnodeathmode:
graphics.Print( -1, 45, "Good luck!", tr, tg, tb, true);
graphics.Print( -1, 80, "You cannot save in this mode.", tr, tg, tb, true);