1
0
Fork 0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2025-01-02 23:19:44 +01:00

Checkpoint autosaving

This commit is contained in:
NyakoFox 2024-06-05 09:17:04 -03:00 committed by Misa Elizabeth Kai
parent c870df4e5b
commit 8aec83daec
4 changed files with 27 additions and 0 deletions

View file

@ -2749,6 +2749,13 @@ bool entityclass::updateentities( int i )
game.savedir = entities[player].dir; game.savedir = entities[player].dir;
} }
entities[i].state = 0; entities[i].state = 0;
if (game.checkpoint_saving)
{
bool success = game.savequick();
game.gamesaved = success;
game.gamesavefailed = !success;
}
} }
break; break;
case 9: //Gravity Lines case 9: //Gravity Lines

View file

@ -377,6 +377,12 @@ void Game::init(void)
screenshot_border_timer = 0; screenshot_border_timer = 0;
screenshot_saved_success = false; screenshot_saved_success = false;
#ifdef __ANDROID__
checkpoint_saving = true;
#else
checkpoint_saving = false;
#endif
setdefaultcontrollerbuttons(); setdefaultcontrollerbuttons();
} }
@ -4940,6 +4946,10 @@ void Game::deserializesettings(tinyxml2::XMLElement* dataNode, struct ScreenSett
roomname_translator::set_enabled(help.Int(pText)); roomname_translator::set_enabled(help.Int(pText));
} }
if (SDL_strcmp(pKey, "checkpoint_saving") == 0)
{
checkpoint_saving = help.Int(pText);
}
} }
setdefaultcontrollerbuttons(); setdefaultcontrollerbuttons();
@ -5198,6 +5208,8 @@ void Game::serializesettings(tinyxml2::XMLElement* dataNode, const struct Screen
xml::update_tag(dataNode, "english_sprites", (int) loc::english_sprites); xml::update_tag(dataNode, "english_sprites", (int) loc::english_sprites);
xml::update_tag(dataNode, "new_level_font", loc::new_level_font.c_str()); xml::update_tag(dataNode, "new_level_font", loc::new_level_font.c_str());
xml::update_tag(dataNode, "roomname_translator", (int) roomname_translator::enabled); xml::update_tag(dataNode, "roomname_translator", (int) roomname_translator::enabled);
xml::update_tag(dataNode, "checkpoint_saving", (int) checkpoint_saving);
} }
static bool settings_loaded = false; static bool settings_loaded = false;

View file

@ -363,6 +363,7 @@ public:
int savetrinkets; int savetrinkets;
bool startscript; bool startscript;
std::string newscript; std::string newscript;
bool checkpoint_saving;
bool menustart; bool menustart;

View file

@ -1206,6 +1206,13 @@ void scriptclass::run(void)
{ {
game.savedir = obj.entities[i].dir; game.savedir = obj.entities[i].dir;
} }
if (game.checkpoint_saving)
{
bool success = game.savequick();
game.gamesaved = success;
game.gamesavefailed = !success;
}
} }
else if (words[0] == "gamestate") else if (words[0] == "gamestate")
{ {