1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-18 10:38:31 +02:00

Switch all flippable text boxes to use createtextboxflipme

This ensures that if the player decides to toggle Flip Mode while one of
these text boxes is up, they won't be oriented improperly. Additionally,
it also de-duplicates a bunch of Flip Mode check code, which is also a
win.
This commit is contained in:
Misa 2021-03-19 20:07:14 -07:00 committed by Ethan Lee
parent c7cc2f4adc
commit 6939563e6d

View File

@ -636,14 +636,7 @@ void Game::savecustomlevelstats(void)
void Game::levelcomplete_textbox(void) void Game::levelcomplete_textbox(void)
{ {
if (graphics.flipmode) graphics.createtextboxflipme("", -1, 12, 165, 165, 255);
{
graphics.createtextbox("", -1, 180, 165, 165, 255);
}
else
{
graphics.createtextbox("", -1, 12, 165, 165, 255);
}
graphics.addline(" "); graphics.addline(" ");
graphics.addline(""); graphics.addline("");
graphics.addline(""); graphics.addline("");
@ -652,14 +645,7 @@ void Game::levelcomplete_textbox(void)
void Game::crewmate_textbox(const int r, const int g, const int b) void Game::crewmate_textbox(const int r, const int g, const int b)
{ {
if (graphics.flipmode) graphics.createtextboxflipme("", -1, 64 + 8 + 16, r, g, b);
{
graphics.createtextbox("", -1, 104, r, g, b);
}
else
{
graphics.createtextbox("", -1, 64 + 8 + 16, r, g, b);
}
graphics.addline(" You have rescued "); graphics.addline(" You have rescued ");
graphics.addline(" a crew member! "); graphics.addline(" a crew member! ");
graphics.addline(""); graphics.addline("");
@ -690,27 +676,13 @@ void Game::remaining_textbox(void)
string = " All Crew Members Rescued! "; string = " All Crew Members Rescued! ";
} }
if (graphics.flipmode) graphics.createtextboxflipme(string, -1, 128 + 16, 174, 174, 174);
{
graphics.createtextbox(string, -1, 72, 174, 174, 174);
}
else
{
graphics.createtextbox(string, -1, 128 + 16, 174, 174, 174);
}
graphics.textboxcenterx(); graphics.textboxcenterx();
} }
void Game::actionprompt_textbox(void) void Game::actionprompt_textbox(void)
{ {
if (graphics.flipmode) graphics.createtextboxflipme(" Press ACTION to continue ", -1, 196, 164, 164, 255);
{
graphics.createtextbox(" Press ACTION to continue ", -1, 20, 164, 164, 255);
}
else
{
graphics.createtextbox(" Press ACTION to continue ", -1, 196, 164, 164, 255);
}
graphics.textboxcenterx(); graphics.textboxcenterx();
} }
@ -1839,45 +1811,22 @@ void Game::updatestate(void)
//Found a trinket! //Found a trinket!
advancetext = true; advancetext = true;
state++; state++;
if (graphics.flipmode) graphics.createtextboxflipme(" Congratulations! ", 50, 85, 174, 174, 174);
{ graphics.addline("");
graphics.createtextbox(" Congratulations! ", 50, 105, 174, 174, 174); graphics.addline("You have found a shiny trinket!");
graphics.addline(""); graphics.textboxcenterx();
graphics.addline("You have found a shiny trinket!");
graphics.textboxcenterx();
#if !defined(NO_CUSTOM_LEVELS) #if !defined(NO_CUSTOM_LEVELS)
if(map.custommode) if(map.custommode)
{ {
graphics.createtextbox(" " + help.number(trinkets()) + " out of " + help.number(ed.numtrinkets())+ " ", 50, 65, 174, 174, 174); graphics.createtextboxflipme(" " + help.number(trinkets()) + " out of " + help.number(ed.numtrinkets())+ " ", 50, 135, 174, 174, 174);
graphics.textboxcenterx(); graphics.textboxcenterx();
}
else
#endif
{
graphics.createtextbox(" " + help.number(trinkets()) + " out of Twenty ", 50, 65, 174, 174, 174);
graphics.textboxcenterx();
}
} }
else else
{
graphics.createtextbox(" Congratulations! ", 50, 85, 174, 174, 174);
graphics.addline("");
graphics.addline("You have found a shiny trinket!");
graphics.textboxcenterx();
#if !defined(NO_CUSTOM_LEVELS)
if(map.custommode)
{
graphics.createtextbox(" " + help.number(trinkets()) + " out of " + help.number(ed.numtrinkets())+ " ", 50, 135, 174, 174, 174);
graphics.textboxcenterx();
}
else
#endif #endif
{ {
graphics.createtextbox(" " + help.number(trinkets()) + " out of Twenty ", 50, 135, 174, 174, 174); graphics.createtextboxflipme(" " + help.number(trinkets()) + " out of Twenty ", 50, 135, 174, 174, 174);
graphics.textboxcenterx(); graphics.textboxcenterx();
}
} }
break; break;
case 1002: case 1002:
@ -1909,49 +1858,24 @@ void Game::updatestate(void)
//Found a crewmate! //Found a crewmate!
advancetext = true; advancetext = true;
state++; state++;
if (graphics.flipmode) graphics.createtextboxflipme(" Congratulations! ", 50, 85, 174, 174, 174);
graphics.addline("");
graphics.addline("You have found a lost crewmate!");
graphics.textboxcenterx();
if(ed.numcrewmates()-crewmates()==0)
{ {
graphics.createtextbox(" Congratulations! ", 50, 105, 174, 174, 174); graphics.createtextboxflipme(" All crewmates rescued! ", 50, 135, 174, 174, 174);
graphics.addline(""); }
graphics.addline("You have found a lost crewmate!"); else if(ed.numcrewmates()-crewmates()==1)
graphics.textboxcenterx(); {
graphics.createtextboxflipme(" " + help.number(ed.numcrewmates()-crewmates())+ " remains ", 50, 135, 174, 174, 174);
if(ed.numcrewmates()-crewmates()==0)
{
graphics.createtextbox(" All crewmates rescued! ", 50, 65, 174, 174, 174);
}
else if(ed.numcrewmates()-crewmates()==1)
{
graphics.createtextbox(" " + help.number(ed.numcrewmates()-crewmates())+ " remains ", 50, 65, 174, 174, 174);
}
else
{
graphics.createtextbox(" " + help.number(ed.numcrewmates()-crewmates())+ " remain ", 50, 65, 174, 174, 174);
}
graphics.textboxcenterx();
} }
else else
{ {
graphics.createtextbox(" Congratulations! ", 50, 85, 174, 174, 174); graphics.createtextboxflipme(" " + help.number(ed.numcrewmates()-crewmates())+ " remain ", 50, 135, 174, 174, 174);
graphics.addline("");
graphics.addline("You have found a lost crewmate!");
graphics.textboxcenterx();
if(ed.numcrewmates()-crewmates()==0)
{
graphics.createtextbox(" All crewmates rescued! ", 50, 135, 174, 174, 174);
}
else if(ed.numcrewmates()-crewmates()==1)
{
graphics.createtextbox(" " + help.number(ed.numcrewmates()-crewmates())+ " remains ", 50, 135, 174, 174, 174);
}
else
{
graphics.createtextbox(" " + help.number(ed.numcrewmates()-crewmates())+ " remain ", 50, 135, 174, 174, 174);
}
graphics.textboxcenterx();
} }
graphics.textboxcenterx();
break; break;
case 1012: case 1012:
if (!advancetext) if (!advancetext)
@ -2644,14 +2568,7 @@ void Game::updatestate(void)
statedelay = 75; statedelay = 75;
music.play(7); music.play(7);
if (graphics.flipmode) graphics.createtextboxflipme("", -1, 12, 164, 165, 255);
{
graphics.createtextbox("", -1, 180, 164, 165, 255);
}
else
{
graphics.createtextbox("", -1, 12, 164, 165, 255);
}
graphics.addline(" "); graphics.addline(" ");
graphics.addline(""); graphics.addline("");
graphics.addline(""); graphics.addline("");
@ -2661,14 +2578,7 @@ void Game::updatestate(void)
state++; state++;
statedelay = 45+15; statedelay = 45+15;
if (graphics.flipmode) graphics.createtextboxflipme(" All Crew Members Rescued! ", -1, 64, 0, 0, 0);
{
graphics.createtextbox(" All Crew Members Rescued! ", -1, 175-24, 0, 0, 0);
}
else
{
graphics.createtextbox(" All Crew Members Rescued! ", -1, 64, 0, 0, 0);
}
savetime = timestring(); savetime = timestring();
savetime += "." + help.twodigits(frames*100 / 30); savetime += "." + help.twodigits(frames*100 / 30);
break; break;
@ -2678,16 +2588,8 @@ void Game::updatestate(void)
statedelay = 45; statedelay = 45;
std::string tempstring = help.number(trinkets()); std::string tempstring = help.number(trinkets());
if (graphics.flipmode) graphics.createtextboxflipme("Trinkets Found:", 48, 84, 0,0,0);
{ graphics.createtextboxflipme(tempstring, 180, 84, 0, 0, 0);
graphics.createtextbox("Trinkets Found:", 48, 155-24, 0,0,0);
graphics.createtextbox(tempstring, 180, 155-24, 0, 0, 0);
}
else
{
graphics.createtextbox("Trinkets Found:", 48, 84, 0,0,0);
graphics.createtextbox(tempstring, 180, 84, 0, 0, 0);
}
break; break;
} }
case 3504: case 3504:
@ -2696,65 +2598,32 @@ void Game::updatestate(void)
statedelay = 45+15; statedelay = 45+15;
std::string tempstring = savetime; std::string tempstring = savetime;
if (graphics.flipmode) graphics.createtextboxflipme(" Game Time:", 64, 96, 0,0,0);
{ graphics.createtextboxflipme(tempstring, 180, 96, 0, 0, 0);
graphics.createtextbox(" Game Time:", 64, 143-24, 0,0,0);
graphics.createtextbox(tempstring, 180, 143-24, 0, 0, 0);
}
else
{
graphics.createtextbox(" Game Time:", 64, 96, 0,0,0);
graphics.createtextbox(tempstring, 180, 96, 0, 0, 0);
}
break; break;
} }
case 3505: case 3505:
state++; state++;
statedelay = 45; statedelay = 45;
if (graphics.flipmode) graphics.createtextboxflipme(" Total Flips:", 64, 123, 0,0,0);
{ graphics.createtextboxflipme(help.String(totalflips), 180, 123, 0, 0, 0);
graphics.createtextbox(" Total Flips:", 64, 116-24, 0,0,0);
graphics.createtextbox(help.String(totalflips), 180, 116-24, 0, 0, 0);
}
else
{
graphics.createtextbox(" Total Flips:", 64, 123, 0,0,0);
graphics.createtextbox(help.String(totalflips), 180, 123, 0, 0, 0);
}
break; break;
case 3506: case 3506:
state++; state++;
statedelay = 45+15; statedelay = 45+15;
if (graphics.flipmode) graphics.createtextboxflipme("Total Deaths:", 64, 135, 0,0,0);
{ graphics.createtextboxflipme(help.String(deathcounts), 180, 135, 0, 0, 0);
graphics.createtextbox("Total Deaths:", 64, 104-24, 0,0,0);
graphics.createtextbox(help.String(deathcounts), 180, 104-24, 0, 0, 0);
}
else
{
graphics.createtextbox("Total Deaths:", 64, 135, 0,0,0);
graphics.createtextbox(help.String(deathcounts), 180, 135, 0, 0, 0);
}
break; break;
case 3507: case 3507:
{ {
state++; state++;
statedelay = 45+15; statedelay = 45+15;
if (graphics.flipmode) std::string tempstring = "Hardest Room (with " + help.String(hardestroomdeaths) + " deaths)";
{ graphics.createtextboxflipme(tempstring, -1, 158, 0,0,0);
std::string tempstring = "Hardest Room (with " + help.String(hardestroomdeaths) + " deaths)"; graphics.createtextboxflipme(hardestroom, -1, 170, 0, 0, 0);
graphics.createtextbox(tempstring, -1, 81-24, 0,0,0);
graphics.createtextbox(hardestroom, -1, 69-24, 0, 0, 0);
}
else
{
std::string tempstring = "Hardest Room (with " + help.String(hardestroomdeaths) + " deaths)";
graphics.createtextbox(tempstring, -1, 158, 0,0,0);
graphics.createtextbox(hardestroom, -1, 170, 0, 0, 0);
}
break; break;
} }
case 3508: case 3508: