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

Fix menu option, show textbox when save failed

In my last commit, I accidentally inverted whether the description says
ON or OFF.
This commit is contained in:
NyakoFox 2024-09-26 13:32:46 -03:00 committed by Misa Elizabeth Kai
parent e58fd606cf
commit 41d5e688e9
5 changed files with 23 additions and 7 deletions

View file

@ -2755,6 +2755,11 @@ bool entityclass::updateentities( int i )
bool success = game.savequick(); bool success = game.savequick();
game.gamesaved = success; game.gamesaved = success;
game.gamesavefailed = !success; game.gamesavefailed = !success;
if (game.gamesavefailed) {
game.show_save_fail();
graphics.textboxapplyposition();
}
} }
} }
break; break;

View file

@ -828,7 +828,7 @@ static void savetele_textbox_success(textboxclass* THIS)
THIS->pad(3, 3); THIS->pad(3, 3);
} }
static void savetele_textbox_fail(textboxclass* THIS) static void save_textbox_fail(textboxclass* THIS)
{ {
THIS->lines.clear(); THIS->lines.clear();
THIS->lines.push_back(loc::gettext("ERROR: Could not save game!")); THIS->lines.push_back(loc::gettext("ERROR: Could not save game!"));
@ -836,6 +836,15 @@ static void savetele_textbox_fail(textboxclass* THIS)
THIS->pad(1, 1); THIS->pad(1, 1);
} }
void Game::show_save_fail(void)
{
graphics.createtextboxflipme("", -1, 12, TEXT_COLOUR("red"));
graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxcenterx();
graphics.textboxtimer(50);
graphics.textboxtranslate(TEXTTRANSLATE_FUNCTION, save_textbox_fail);
}
void Game::savetele_textbox(void) void Game::savetele_textbox(void)
{ {
if (inspecial() || map.custommode) if (inspecial() || map.custommode)
@ -853,11 +862,7 @@ void Game::savetele_textbox(void)
} }
else else
{ {
graphics.createtextboxflipme("", -1, 12, TEXT_COLOUR("red")); show_save_fail();
graphics.textboxprintflags(PR_FONT_INTERFACE);
graphics.textboxcenterx();
graphics.textboxtimer(50);
graphics.textboxtranslate(TEXTTRANSLATE_FUNCTION, savetele_textbox_fail);
} }
graphics.textboxapplyposition(); graphics.textboxapplyposition();
} }

View file

@ -225,6 +225,7 @@ public:
void crewmate_textbox(const int color); void crewmate_textbox(const int color);
void remaining_textbox(void); void remaining_textbox(void);
void actionprompt_textbox(void); void actionprompt_textbox(void);
void show_save_fail(void);
void savetele_textbox(void); void savetele_textbox(void);
void setstate(int gamestate); void setstate(int gamestate);

View file

@ -1152,7 +1152,7 @@ static void menurender(void)
{ {
font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Checkpoint Saving"), tr, tg, tb); font::print(PR_2X | PR_CEN, -1, 30, loc::gettext("Checkpoint Saving"), tr, tg, tb);
int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Toggle if checkpoints should save the game."), tr, tg, tb); int next_y = font::print_wrap(PR_CEN, -1, 65, loc::gettext("Toggle if checkpoints should save the game."), tr, tg, tb);
if (game.checkpoint_saving) if (!game.checkpoint_saving)
{ {
font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Checkpoint saving is OFF"), tr / 2, tg / 2, tb / 2); font::print_wrap(PR_CEN, -1, next_y, loc::gettext("Checkpoint saving is OFF"), tr / 2, tg / 2, tb / 2);
} }

View file

@ -1212,6 +1212,11 @@ void scriptclass::run(void)
bool success = game.savequick(); bool success = game.savequick();
game.gamesaved = success; game.gamesaved = success;
game.gamesavefailed = !success; game.gamesavefailed = !success;
if (game.gamesavefailed) {
game.show_save_fail();
graphics.textboxapplyposition();
}
} }
} }
else if (words[0] == "gamestate") else if (words[0] == "gamestate")