Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Checkpoint autosaving #1174

Merged
merged 4 commits into from
Sep 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions desktop_version/src/Entity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2732,6 +2732,13 @@ bool entityclass::updateentities( int i )
game.savedir = entities[player].dir;
}
entities[i].state = 0;

if (game.checkpoint_saving)
{
bool success = game.savequick();
game.gamesaved = success;
game.gamesavefailed = !success;
}
}
break;
case 9: //Gravity Lines
Expand Down
12 changes: 12 additions & 0 deletions desktop_version/src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,12 @@ void Game::init(void)
screenshot_border_timer = 0;
screenshot_saved_success = false;

#ifdef __ANDROID__
checkpoint_saving = true;
#else
checkpoint_saving = false;
#endif

setdefaultcontrollerbuttons();
}

Expand Down Expand Up @@ -4936,6 +4942,10 @@ void Game::deserializesettings(tinyxml2::XMLElement* dataNode, struct ScreenSett
roomname_translator::set_enabled(help.Int(pText));
}

if (SDL_strcmp(pKey, "checkpoint_saving") == 0)
{
checkpoint_saving = help.Int(pText);
}
}

setdefaultcontrollerbuttons();
Expand Down Expand Up @@ -5194,6 +5204,8 @@ void Game::serializesettings(tinyxml2::XMLElement* dataNode, const struct Screen
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, "roomname_translator", (int) roomname_translator::enabled);

xml::update_tag(dataNode, "checkpoint_saving", (int) checkpoint_saving);
}

static bool settings_loaded = false;
Expand Down
1 change: 1 addition & 0 deletions desktop_version/src/Game.h
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ class Game
int savetrinkets;
bool startscript;
std::string newscript;
bool checkpoint_saving;

bool menustart;

Expand Down
7 changes: 7 additions & 0 deletions desktop_version/src/Script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1206,6 +1206,13 @@ void scriptclass::run(void)
{
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")
{
Expand Down
Loading