1
0
mirror of https://github.com/TerryCavanagh/VVVVVV.git synced 2024-06-01 10:33:32 +02:00

Refactor how "hidden names" work

By "hidden names", I'm referring to "Dimension VVVVVV" and "The Ship"
popping up on the quit/pause/teleporter screens, even though those rooms
don't have any roomnames.

Apparently my commit to fix roomname re-draw bleed on the
quit/pause/teleporter screens exposed yet another hardreset()-caused
bug. The issue here is that since hardreset() sets game.roomx and
game.roomy to 0, map.area() will no longer work properly, and since the
hidden roomname check is based on map.area(), it will no longer display
"Dimension VVVVVV" or "The Ship" once you press ACTION to quit. It used
to do this due to the re-draw bleed, but now it doesn't.

I saw that roomnames didn't get reset in hardreset(), so the solution
here is to re-factor hidden names to be an actual variable, instead of
being implicit. map.hiddenname is a variable that's set in
mapclass::loadlevel(), and if isn't empty, it will be drawn on the
quit/pause/teleporter screens. That way it will still display "Dimension
VVVVVV" and "The Ship" when you press ACTION to quit to the menu.

EDIT: Since PR #230 got merged, this commit is no longer strictly
necessary, but it's still good to refactor hidden names like this.
This commit is contained in:
Misa 2020-05-02 14:10:22 -07:00 committed by Ethan Lee
parent c009ab67d9
commit ad6adcb3c0
3 changed files with 14 additions and 18 deletions

View File

@ -1144,6 +1144,7 @@ void mapclass::loadlevel(int rx, int ry)
obj.vertplatforms = false;
obj.horplatforms = false;
roomname = "";
hiddenname = "";
background = 1;
warpx = false;
warpy = false;
@ -1283,6 +1284,15 @@ void mapclass::loadlevel(int rx, int ry)
roomtexton = true;
roomtext = std::vector<Roomtext>(otherlevel.roomtext);
}
if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111)
{
hiddenname = "The Ship";
}
else
{
hiddenname = "Dimension VVVVVV";
}
break;
case 2: //The Lab
contents = lablevel.loadlevel(rx, ry);

View File

@ -94,6 +94,7 @@ public:
std::string roomname;
std::string hiddenname;
//Special tower stuff
bool towermode;

View File

@ -1631,17 +1631,9 @@ void maprender()
//draw screen alliteration
//Roomname:
int temp = map.area(game.roomx, game.roomy);
if (temp < 2 && !map.custommode && graphics.fademode==0)
if (map.hiddenname != "")
{
if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111)
{
graphics.Print(5, 2, "The Ship", 196, 196, 255 - help.glow, true);
}
else
{
graphics.Print(5, 2, "Dimension VVVVVV", 196, 196, 255 - help.glow, true);
}
graphics.Print(5, 2, map.hiddenname, 196, 196, 255 - help.glow, true);
}
else
{
@ -2402,14 +2394,7 @@ void teleporterrender()
int temp = map.area(game.roomx, game.roomy);
if (temp < 2 && !map.custommode && graphics.fademode==0)
{
if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111)
{
graphics.Print(5, 2, "The Ship", 196, 196, 255 - help.glow, true);
}
else
{
graphics.Print(5, 2, "Dimension VVVVVV", 196, 196, 255 - help.glow, true);
}
graphics.Print(5, 2, map.hiddenname, 196, 196, 255 - help.glow, true);
}
else
{