diff --git a/desktop_version/src/Game.cpp b/desktop_version/src/Game.cpp index 035070cf..7f8020a3 100644 --- a/desktop_version/src/Game.cpp +++ b/desktop_version/src/Game.cpp @@ -5887,6 +5887,10 @@ void Game::customloadquick(const std::string& savfile) { map.customshowmm = help.Int(pText); } + else if (SDL_strcmp(pKey, "mapreveal") == 0) + { + map.revealmap = help.Int(pText); + } else if (SDL_strcmp(pKey, "disabletemporaryaudiopause") == 0) { disabletemporaryaudiopause = help.Int(pText); @@ -6326,6 +6330,8 @@ bool Game::customsavequick(const std::string& savfile) 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, "showtrinkets", (int) map.showtrinkets); diff --git a/desktop_version/src/Map.cpp b/desktop_version/src/Map.cpp index 747ebc38..15e832f1 100644 --- a/desktop_version/src/Map.cpp +++ b/desktop_version/src/Map.cpp @@ -55,6 +55,7 @@ mapclass::mapclass(void) custommmxoff=0; custommmyoff=0; custommmxsize=0; custommmysize=0; customzoom=0; customshowmm=true; + revealmap = true; rcol = 0; @@ -198,6 +199,12 @@ void mapclass::resetmap(void) 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) { if (roomnameset) @@ -1304,12 +1311,15 @@ static void copy_short_to_int(int* dest, const short* src, const size_t size) void mapclass::loadlevel(int rx, int ry) { int t; - if (!finalmode) + if (revealmap) { - setexplored(rx - 100, ry - 100, true); - if (rx == 109 && !custommode) + if (!finalmode) { - exploretower(); + setexplored(rx - 100, ry - 100, true); + if (rx == 109 && !custommode) + { + exploretower(); + } } } diff --git a/desktop_version/src/Map.h b/desktop_version/src/Map.h index d809c2e7..243938c6 100644 --- a/desktop_version/src/Map.h +++ b/desktop_version/src/Map.h @@ -58,6 +58,8 @@ public: void resetmap(void); + void fullmap(void); + void updateroomnames(void); void initmapdata(void); @@ -125,6 +127,8 @@ public: bool isexplored(const int rx, const int ry); void setexplored(const int rx, const int ry, const bool status); + bool revealmap; + int background; int rcol; int tileset; diff --git a/desktop_version/src/Script.cpp b/desktop_version/src/Script.cpp index d97fa9cf..c13be012 100644 --- a/desktop_version/src/Script.cpp +++ b/desktop_version/src/Script.cpp @@ -1328,6 +1328,28 @@ void scriptclass::run(void) map.setexplored(19, 7, 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") { map.showteleporters = true; @@ -2818,6 +2840,7 @@ void scriptclass::startgamemode(const enum StartMode mode) map.custommode = true; map.custommodeforreal = false; map.customshowmm = true; + map.revealmap = true; if (cl.levmusic > 0) { @@ -2844,6 +2867,7 @@ void scriptclass::startgamemode(const enum StartMode mode) cl.findstartpoint(); map.customshowmm = true; + map.revealmap = true; music.fadeout(); game.customstart(); @@ -3215,7 +3239,8 @@ void scriptclass::hardreset(void) map.cameraseekframe = 0; map.resumedelay = 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.roomdeathsfinal, 0, sizeof(map.roomdeathsfinal));