mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2025-01-09 18:39:45 +01:00
De-duplicate "Game Saved" telesave textbox
The "Game Saved" text box, along with its associated telesave() call, exists in both Game.cpp and Script.cpp, so one of them is the copy-paste of the other. Unfortunately this copy-paste resulted in an inconsistency where both of them don't check for the same things when deciding whether or not the telesave should actually happen (this is why you don't copy-paste, kids... it's scary!). Either way, de-duplicating this now is less work for me later.
This commit is contained in:
parent
5de884f584
commit
30719b87db
3 changed files with 23 additions and 31 deletions
|
@ -714,6 +714,25 @@ void Game::actionprompt_textbox(void)
|
||||||
graphics.textboxcenterx();
|
graphics.textboxcenterx();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Game::savetele_textbox(void)
|
||||||
|
{
|
||||||
|
if (inspecial() || map.custommode)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (savetele())
|
||||||
|
{
|
||||||
|
graphics.createtextboxflipme(" Game Saved ", -1, 12, 174, 174, 174);
|
||||||
|
graphics.textboxtimer(25);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
graphics.createtextboxflipme(" ERROR: Could not save game! ", -1, 12, 255, 60, 60);
|
||||||
|
graphics.textboxtimer(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Game::updatestate(void)
|
void Game::updatestate(void)
|
||||||
{
|
{
|
||||||
statedelay--;
|
statedelay--;
|
||||||
|
@ -2000,24 +2019,8 @@ void Game::updatestate(void)
|
||||||
|
|
||||||
case 2000:
|
case 2000:
|
||||||
//Game Saved!
|
//Game Saved!
|
||||||
if (inspecial() || map.custommode)
|
savetele_textbox();
|
||||||
{
|
state = 0;
|
||||||
state = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (savetele())
|
|
||||||
{
|
|
||||||
graphics.createtextbox(" Game Saved ", -1, graphics.flipmode ? 202 : 12, 174, 174, 174);
|
|
||||||
graphics.textboxtimer(25);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
graphics.createtextbox(" ERROR: Could not save game! ", -1, graphics.flipmode ? 202 : 12, 255, 60, 60);
|
|
||||||
graphics.textboxtimer(50);
|
|
||||||
}
|
|
||||||
state = 0;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2500:
|
case 2500:
|
||||||
|
|
|
@ -133,6 +133,7 @@ public:
|
||||||
void crewmate_textbox(const int r, const int g, const int b);
|
void crewmate_textbox(const int r, const int g, const int b);
|
||||||
void remaining_textbox(void);
|
void remaining_textbox(void);
|
||||||
void actionprompt_textbox(void);
|
void actionprompt_textbox(void);
|
||||||
|
void savetele_textbox(void);
|
||||||
|
|
||||||
void updatestate(void);
|
void updatestate(void);
|
||||||
|
|
||||||
|
|
|
@ -3506,19 +3506,7 @@ void scriptclass::teleport(void)
|
||||||
{
|
{
|
||||||
music.changemusicarea(game.teleport_to_x, game.teleport_to_y);
|
music.changemusicarea(game.teleport_to_x, game.teleport_to_y);
|
||||||
}
|
}
|
||||||
if (!game.intimetrial && !game.nodeathmode && !game.inintermission)
|
game.savetele_textbox();
|
||||||
{
|
|
||||||
if (game.savetele())
|
|
||||||
{
|
|
||||||
graphics.createtextbox(" Game Saved ", -1, graphics.flipmode ? 202 : 12, 174, 174, 174);
|
|
||||||
graphics.textboxtimer(25);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
graphics.createtextbox(" ERROR: Could not save game! ", -1, graphics.flipmode ? 202 : 12, 255, 60, 60);
|
|
||||||
graphics.textboxtimer(50);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue