mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-11-05 10:49:41 +01:00
Abstract checkpoint saving to its own function
This also makes the save failed textbox not appear in special modes, and allows custom levels to quicksave from checkpoints as well.
This commit is contained in:
parent
41d5e688e9
commit
c04c6bc552
4 changed files with 19 additions and 22 deletions
|
@ -2750,17 +2750,7 @@ bool entityclass::updateentities( int i )
|
||||||
}
|
}
|
||||||
entities[i].state = 0;
|
entities[i].state = 0;
|
||||||
|
|
||||||
if (game.checkpoint_saving)
|
game.checkpoint_save();
|
||||||
{
|
|
||||||
bool success = game.savequick();
|
|
||||||
game.gamesaved = success;
|
|
||||||
game.gamesavefailed = !success;
|
|
||||||
|
|
||||||
if (game.gamesavefailed) {
|
|
||||||
game.show_save_fail();
|
|
||||||
graphics.textboxapplyposition();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 9: //Gravity Lines
|
case 9: //Gravity Lines
|
||||||
|
|
|
@ -845,6 +845,22 @@ void Game::show_save_fail(void)
|
||||||
graphics.textboxtranslate(TEXTTRANSLATE_FUNCTION, save_textbox_fail);
|
graphics.textboxtranslate(TEXTTRANSLATE_FUNCTION, save_textbox_fail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::checkpoint_save(void)
|
||||||
|
{
|
||||||
|
if (checkpoint_saving && !inspecial())
|
||||||
|
{
|
||||||
|
bool success = map.custommode ? customsavequick(cl.ListOfMetaData[playcustomlevel].filename) : savequick();
|
||||||
|
gamesaved = success;
|
||||||
|
gamesavefailed = !success;
|
||||||
|
|
||||||
|
if (gamesavefailed)
|
||||||
|
{
|
||||||
|
show_save_fail();
|
||||||
|
graphics.textboxapplyposition();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Game::savetele_textbox(void)
|
void Game::savetele_textbox(void)
|
||||||
{
|
{
|
||||||
if (inspecial() || map.custommode)
|
if (inspecial() || map.custommode)
|
||||||
|
|
|
@ -226,6 +226,7 @@ public:
|
||||||
void remaining_textbox(void);
|
void remaining_textbox(void);
|
||||||
void actionprompt_textbox(void);
|
void actionprompt_textbox(void);
|
||||||
void show_save_fail(void);
|
void show_save_fail(void);
|
||||||
|
void checkpoint_save(void);
|
||||||
void savetele_textbox(void);
|
void savetele_textbox(void);
|
||||||
|
|
||||||
void setstate(int gamestate);
|
void setstate(int gamestate);
|
||||||
|
|
|
@ -1207,17 +1207,7 @@ void scriptclass::run(void)
|
||||||
game.savedir = obj.entities[i].dir;
|
game.savedir = obj.entities[i].dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (game.checkpoint_saving)
|
game.checkpoint_save();
|
||||||
{
|
|
||||||
bool success = game.savequick();
|
|
||||||
game.gamesaved = success;
|
|
||||||
game.gamesavefailed = !success;
|
|
||||||
|
|
||||||
if (game.gamesavefailed) {
|
|
||||||
game.show_save_fail();
|
|
||||||
graphics.textboxapplyposition();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (words[0] == "gamestate")
|
else if (words[0] == "gamestate")
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue