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

Add mapexplored(), mapreveal() commands

This commit is contained in:
mothbeanie 2023-08-23 13:03:23 -07:00 committed by Misa Elizabeth Kai
parent c04c6bc552
commit 8a00ea7aab
4 changed files with 50 additions and 5 deletions

View file

@ -5930,6 +5930,10 @@ void Game::customloadquick(const std::string& savfile)
{ {
map.customshowmm = help.Int(pText); map.customshowmm = help.Int(pText);
} }
else if (SDL_strcmp(pKey, "mapreveal") == 0)
{
map.revealmap = help.Int(pText);
}
else if (SDL_strcmp(pKey, "disabletemporaryaudiopause") == 0) else if (SDL_strcmp(pKey, "disabletemporaryaudiopause") == 0)
{ {
disabletemporaryaudiopause = help.Int(pText); disabletemporaryaudiopause = help.Int(pText);
@ -6369,6 +6373,8 @@ bool Game::customsavequick(const std::string& savfile)
xml::update_tag(msgs, "showminimap", (int) map.customshowmm); xml::update_tag(msgs, "showminimap", (int) map.customshowmm);
xml::update_tag(msgs, "mapreveal", (int) map.revealmap);
xml::update_tag(msgs, "disabletemporaryaudiopause", (int) disabletemporaryaudiopause); xml::update_tag(msgs, "disabletemporaryaudiopause", (int) disabletemporaryaudiopause);
xml::update_tag(msgs, "showtrinkets", (int) map.showtrinkets); xml::update_tag(msgs, "showtrinkets", (int) map.showtrinkets);

View file

@ -55,6 +55,7 @@ mapclass::mapclass(void)
custommmxoff=0; custommmyoff=0; custommmxsize=0; custommmysize=0; custommmxoff=0; custommmyoff=0; custommmxsize=0; custommmysize=0;
customzoom=0; customzoom=0;
customshowmm=true; customshowmm=true;
revealmap = true;
rcol = 0; rcol = 0;
@ -198,6 +199,12 @@ void mapclass::resetmap(void)
SDL_memset(explored, 0, sizeof(explored)); SDL_memset(explored, 0, sizeof(explored));
} }
void mapclass::fullmap(void)
{
//mark the whole map as explored
SDL_memset(explored, 1, sizeof(explored));
}
void mapclass::updateroomnames(void) void mapclass::updateroomnames(void)
{ {
if (roomnameset) if (roomnameset)
@ -1304,6 +1311,8 @@ static void copy_short_to_int(int* dest, const short* src, const size_t size)
void mapclass::loadlevel(int rx, int ry) void mapclass::loadlevel(int rx, int ry)
{ {
int t; int t;
if (revealmap)
{
if (!finalmode) if (!finalmode)
{ {
setexplored(rx - 100, ry - 100, true); setexplored(rx - 100, ry - 100, true);
@ -1312,6 +1321,7 @@ void mapclass::loadlevel(int rx, int ry)
exploretower(); exploretower();
} }
} }
}
roomtexton = false; roomtexton = false;

View file

@ -58,6 +58,8 @@ public:
void resetmap(void); void resetmap(void);
void fullmap(void);
void updateroomnames(void); void updateroomnames(void);
void initmapdata(void); void initmapdata(void);
@ -125,6 +127,8 @@ public:
bool isexplored(const int rx, const int ry); bool isexplored(const int rx, const int ry);
void setexplored(const int rx, const int ry, const bool status); void setexplored(const int rx, const int ry, const bool status);
bool revealmap;
int background; int background;
int rcol; int rcol;
int tileset; int tileset;

View file

@ -1330,6 +1330,28 @@ void scriptclass::run(void)
map.setexplored(19, 7, false); map.setexplored(19, 7, false);
map.setexplored(19, 8, false); map.setexplored(19, 8, false);
} }
else if (words[0] == "mapexplored")
{
if (words[1] == "none")
{
map.resetmap();
}
else if (words[1] == "all")
{
map.fullmap();
}
}
else if (words[0] == "mapreveal")
{
if (words[1] == "on")
{
map.revealmap = true;
}
else if (words[1] == "off")
{
map.revealmap = false;
}
}
else if (words[0] == "showteleporters") else if (words[0] == "showteleporters")
{ {
map.showteleporters = true; map.showteleporters = true;
@ -2830,6 +2852,7 @@ void scriptclass::startgamemode(const enum StartMode mode)
map.custommode = true; map.custommode = true;
map.custommodeforreal = false; map.custommodeforreal = false;
map.customshowmm = true; map.customshowmm = true;
map.revealmap = true;
if (cl.levmusic > 0) if (cl.levmusic > 0)
{ {
@ -2856,6 +2879,7 @@ void scriptclass::startgamemode(const enum StartMode mode)
cl.findstartpoint(); cl.findstartpoint();
map.customshowmm = true; map.customshowmm = true;
map.revealmap = true;
music.fadeout(); music.fadeout();
game.customstart(); game.customstart();
@ -3229,6 +3253,7 @@ void scriptclass::hardreset(void)
map.resumedelay = 0; map.resumedelay = 0;
graphics.towerbg.scrolldir = 0; graphics.towerbg.scrolldir = 0;
map.customshowmm = true; map.customshowmm = true;
map.revealmap = true;
SDL_memset(map.roomdeaths, 0, sizeof(map.roomdeaths)); SDL_memset(map.roomdeaths, 0, sizeof(map.roomdeaths));
SDL_memset(map.roomdeathsfinal, 0, sizeof(map.roomdeathsfinal)); SDL_memset(map.roomdeathsfinal, 0, sizeof(map.roomdeathsfinal));