mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Simplify mapclass::currentarea()
It used to take a single int: the area number returned by mapclass::area(roomx, roomy). All uses of currentarea() were called with an extra area() call as its argument. Additionally, there's a good reason why currentarea() should have the room coordinates: in one of the cases that it's called, there's a special case for the ship's coordinates. This results in the SAVE screen in the map menu being able to show "The Ship", while the continue screen shows "Dimension VVVVVV" instead. Therefore, why not put that exception inside currentarea() instead, and remove a few callsite map.area() wrappers by making currentarea() take the room x and y coordinates?
This commit is contained in:
parent
73911a7ada
commit
89a165722e
4 changed files with 11 additions and 12 deletions
|
@ -5689,9 +5689,7 @@ void Game::loadsummary(void)
|
||||||
summary.seconds
|
summary.seconds
|
||||||
);
|
);
|
||||||
map.finalmode = summary.finalmode;
|
map.finalmode = summary.finalmode;
|
||||||
tele_currentarea = map.currentarea(
|
tele_currentarea = map.currentarea(summary.savex, summary.savey);
|
||||||
map.area(summary.savex, summary.savey)
|
|
||||||
);
|
|
||||||
SDL_memcpy(tele_crewstats, summary.crewstats, sizeof(tele_crewstats));
|
SDL_memcpy(tele_crewstats, summary.crewstats, sizeof(tele_crewstats));
|
||||||
tele_trinkets = summary.trinkets;
|
tele_trinkets = summary.trinkets;
|
||||||
}
|
}
|
||||||
|
@ -5714,9 +5712,7 @@ void Game::loadsummary(void)
|
||||||
summary.seconds
|
summary.seconds
|
||||||
);
|
);
|
||||||
map.finalmode = summary.finalmode;
|
map.finalmode = summary.finalmode;
|
||||||
quick_currentarea = map.currentarea(
|
quick_currentarea = map.currentarea(summary.savex, summary.savey);
|
||||||
map.area(summary.savex, summary.savey)
|
|
||||||
);
|
|
||||||
SDL_memcpy(quick_crewstats, summary.crewstats, sizeof(quick_crewstats));
|
SDL_memcpy(quick_crewstats, summary.crewstats, sizeof(quick_crewstats));
|
||||||
quick_trinkets = summary.trinkets;
|
quick_trinkets = summary.trinkets;
|
||||||
}
|
}
|
||||||
|
|
|
@ -3068,11 +3068,9 @@ static void mapmenuactionpress(const bool version2_2)
|
||||||
music.playef(Sound_GAMESAVED);
|
music.playef(Sound_GAMESAVED);
|
||||||
|
|
||||||
game.savetime = game.timestring();
|
game.savetime = game.timestring();
|
||||||
game.savearea = map.currentarea(map.area(game.roomx, game.roomy));
|
game.savearea = map.currentarea(game.roomx, game.roomy);
|
||||||
game.savetrinkets = game.trinkets();
|
game.savetrinkets = game.trinkets();
|
||||||
|
|
||||||
if (game.roomx >= 102 && game.roomx <= 104 && game.roomy >= 110 && game.roomy <= 111) game.savearea = loc::gettext_roomname_special("The Ship");
|
|
||||||
|
|
||||||
bool success;
|
bool success;
|
||||||
|
|
||||||
if(map.custommodeforreal)
|
if(map.custommodeforreal)
|
||||||
|
|
|
@ -1240,9 +1240,14 @@ void mapclass::spawncompanion(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* mapclass::currentarea(int t)
|
const char* mapclass::currentarea(const int roomx, const int roomy)
|
||||||
{
|
{
|
||||||
switch(t)
|
if (roomx >= 102 && roomx <= 104 && roomy >= 110 && roomy <= 111)
|
||||||
|
{
|
||||||
|
return loc::gettext_roomname_special("The Ship");
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (area(roomx, roomy))
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
return loc::gettext_roomname_special("Dimension VVVVVV");
|
return loc::gettext_roomname_special("Dimension VVVVVV");
|
||||||
|
|
|
@ -108,7 +108,7 @@ public:
|
||||||
|
|
||||||
void spawncompanion(void);
|
void spawncompanion(void);
|
||||||
|
|
||||||
const char* currentarea(int t);
|
const char* currentarea(int roomx, int roomy);
|
||||||
|
|
||||||
void loadlevel(int rx, int ry);
|
void loadlevel(int rx, int ry);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue