mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 18:39:45 +01:00
Add error message if quicksave fails
This commit is contained in:
parent
5dbb90c7fd
commit
4ebf89e844
5 changed files with 29 additions and 20 deletions
|
@ -225,6 +225,7 @@ void Game::init(void)
|
||||||
minutes = 0;
|
minutes = 0;
|
||||||
hours = 0;
|
hours = 0;
|
||||||
gamesaved = false;
|
gamesaved = false;
|
||||||
|
gamesavefailed = false;
|
||||||
savetime = "00:00";
|
savetime = "00:00";
|
||||||
savearea = "nowhere";
|
savearea = "nowhere";
|
||||||
savetrinkets = 0;
|
savetrinkets = 0;
|
||||||
|
@ -5724,12 +5725,12 @@ bool Game::savetele()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Game::savequick()
|
bool Game::savequick()
|
||||||
{
|
{
|
||||||
if (map.custommode || inspecial())
|
if (map.custommode || inspecial())
|
||||||
{
|
{
|
||||||
//Don't trash save data!
|
//Don't trash save data!
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
tinyxml2::XMLDocument doc;
|
tinyxml2::XMLDocument doc;
|
||||||
|
@ -5740,16 +5741,14 @@ void Game::savequick()
|
||||||
}
|
}
|
||||||
quicksummary = writemaingamesave(doc);
|
quicksummary = writemaingamesave(doc);
|
||||||
|
|
||||||
if(FILESYSTEM_saveTiXml2Document("saves/qsave.vvv", doc))
|
if(!FILESYSTEM_saveTiXml2Document("saves/qsave.vvv", doc))
|
||||||
{
|
|
||||||
printf("Game saved\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
printf("Could Not Save game!\n");
|
printf("Could Not Save game!\n");
|
||||||
printf("Failed: %s%s\n", saveFilePath.c_str(), "qsave.vvv");
|
printf("Failed: %s%s\n", saveFilePath.c_str(), "qsave.vvv");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
printf("Game saved\n");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns summary of save
|
// Returns summary of save
|
||||||
|
@ -5869,7 +5868,7 @@ std::string Game::writemaingamesave(tinyxml2::XMLDocument& doc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Game::customsavequick(std::string savfile)
|
bool Game::customsavequick(std::string savfile)
|
||||||
{
|
{
|
||||||
const std::string levelfile = savfile.substr(7);
|
const std::string levelfile = savfile.substr(7);
|
||||||
|
|
||||||
|
@ -5998,15 +5997,14 @@ void Game::customsavequick(std::string savfile)
|
||||||
|
|
||||||
customquicksummary = summary;
|
customquicksummary = summary;
|
||||||
|
|
||||||
if(FILESYSTEM_saveTiXml2Document(("saves/"+levelfile+".vvv").c_str(), doc))
|
if(!FILESYSTEM_saveTiXml2Document(("saves/"+levelfile+".vvv").c_str(), doc))
|
||||||
{
|
|
||||||
printf("Game saved\n");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
printf("Could Not Save game!\n");
|
printf("Could Not Save game!\n");
|
||||||
printf("Failed: %s%s%s\n", saveFilePath.c_str(), levelfile.c_str(), ".vvv");
|
printf("Failed: %s%s%s\n", saveFilePath.c_str(), levelfile.c_str(), ".vvv");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
printf("Game saved\n");
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -97,8 +97,8 @@ public:
|
||||||
|
|
||||||
void resetgameclock();
|
void resetgameclock();
|
||||||
|
|
||||||
void customsavequick(std::string savfile);
|
bool customsavequick(std::string savfile);
|
||||||
void savequick();
|
bool savequick();
|
||||||
|
|
||||||
void gameclock();
|
void gameclock();
|
||||||
|
|
||||||
|
@ -204,6 +204,7 @@ public:
|
||||||
|
|
||||||
int frames, seconds, minutes, hours;
|
int frames, seconds, minutes, hours;
|
||||||
bool gamesaved;
|
bool gamesaved;
|
||||||
|
bool gamesavefailed;
|
||||||
std::string savetime;
|
std::string savetime;
|
||||||
std::string savearea;
|
std::string savearea;
|
||||||
int savetrinkets;
|
int savetrinkets;
|
||||||
|
|
|
@ -2010,6 +2010,7 @@ void gameinput()
|
||||||
//Quit menu, same conditions as in game menu
|
//Quit menu, same conditions as in game menu
|
||||||
game.gamestate = MAPMODE;
|
game.gamestate = MAPMODE;
|
||||||
game.gamesaved = false;
|
game.gamesaved = false;
|
||||||
|
game.gamesavefailed = false;
|
||||||
graphics.resumegamemode = false;
|
graphics.resumegamemode = false;
|
||||||
game.menupage = 20; // The Map Page
|
game.menupage = 20; // The Map Page
|
||||||
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
|
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
|
||||||
|
@ -2040,6 +2041,7 @@ void gameinput()
|
||||||
map.cursordelay = 0;
|
map.cursordelay = 0;
|
||||||
map.cursorstate = 0;
|
map.cursorstate = 0;
|
||||||
game.gamesaved = false;
|
game.gamesaved = false;
|
||||||
|
game.gamesavefailed = false;
|
||||||
graphics.resumegamemode = false;
|
graphics.resumegamemode = false;
|
||||||
game.menupage = 0; // The Map Page
|
game.menupage = 0; // The Map Page
|
||||||
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
|
BlitSurfaceStandard(graphics.menubuffer,NULL,graphics.backBuffer, NULL);
|
||||||
|
@ -2058,6 +2060,7 @@ void gameinput()
|
||||||
//Quit menu, same conditions as in game menu
|
//Quit menu, same conditions as in game menu
|
||||||
game.gamestate = MAPMODE;
|
game.gamestate = MAPMODE;
|
||||||
game.gamesaved = false;
|
game.gamesaved = false;
|
||||||
|
game.gamesavefailed = false;
|
||||||
graphics.resumegamemode = false;
|
graphics.resumegamemode = false;
|
||||||
game.menupage = 30; // Pause screen
|
game.menupage = 30; // Pause screen
|
||||||
|
|
||||||
|
@ -2291,12 +2294,11 @@ void mapmenuactionpress()
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
if (!game.gamesaved && !game.inspecial())
|
if (!game.gamesaved && !game.gamesavefailed && !game.inspecial())
|
||||||
{
|
{
|
||||||
game.flashlight = 5;
|
game.flashlight = 5;
|
||||||
game.screenshake = 10;
|
game.screenshake = 10;
|
||||||
music.playef(18);
|
music.playef(18);
|
||||||
game.gamesaved = true;
|
|
||||||
|
|
||||||
game.savetime = game.timestring();
|
game.savetime = game.timestring();
|
||||||
game.savearea = map.currentarea(map.area(game.roomx, game.roomy));
|
game.savearea = map.currentarea(map.area(game.roomx, game.roomy));
|
||||||
|
@ -2304,16 +2306,19 @@ void mapmenuactionpress()
|
||||||
|
|
||||||
if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111) game.savearea = "The Ship";
|
if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111) game.savearea = "The Ship";
|
||||||
|
|
||||||
|
bool success;
|
||||||
#if !defined(NO_CUSTOM_LEVELS)
|
#if !defined(NO_CUSTOM_LEVELS)
|
||||||
if(map.custommodeforreal)
|
if(map.custommodeforreal)
|
||||||
{
|
{
|
||||||
game.customsavequick(ed.ListOfMetaData[game.playcustomlevel].filename);
|
success = game.customsavequick(ed.ListOfMetaData[game.playcustomlevel].filename);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
game.savequick();
|
success = game.savequick();
|
||||||
}
|
}
|
||||||
|
game.gamesaved = success;
|
||||||
|
game.gamesavefailed = !success;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -2215,6 +2215,10 @@ void maprender()
|
||||||
{
|
{
|
||||||
graphics.Print(0, 115, "Cannot Save in Secret Lab", 146, 146, 180, true);
|
graphics.Print(0, 115, "Cannot Save in Secret Lab", 146, 146, 180, true);
|
||||||
}
|
}
|
||||||
|
else if (game.gamesavefailed)
|
||||||
|
{
|
||||||
|
graphics.Print(0, 115, "ERROR: Could not save game!", 146, 146, 180, true);
|
||||||
|
}
|
||||||
else if (map.custommode)
|
else if (map.custommode)
|
||||||
{
|
{
|
||||||
if (game.gamesaved)
|
if (game.gamesaved)
|
||||||
|
|
|
@ -3614,6 +3614,7 @@ void scriptclass::hardreset()
|
||||||
game.minutes = 0;
|
game.minutes = 0;
|
||||||
game.hours = 0;
|
game.hours = 0;
|
||||||
game.gamesaved = false;
|
game.gamesaved = false;
|
||||||
|
game.gamesavefailed = false;
|
||||||
game.savetime = "00:00";
|
game.savetime = "00:00";
|
||||||
game.savearea = "nowhere";
|
game.savearea = "nowhere";
|
||||||
game.savetrinkets = 0;
|
game.savetrinkets = 0;
|
||||||
|
|
Loading…
Reference in a new issue