From 9fab46b7d70181608df01644f6105e8bf12ef8b9 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 22 Feb 2020 08:56:36 +0100 Subject: [PATCH] - initialize the secret hint system for each level. --- source/blood/src/blood.cpp | 2 ++ source/common/secrets.cpp | 1 + source/duke3d/src/premap.cpp | 5 ++++- source/rr/src/premap.cpp | 5 ++++- source/sw/src/game.cpp | 4 +++- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/source/blood/src/blood.cpp b/source/blood/src/blood.cpp index 56016d61f..f825cdc00 100644 --- a/source/blood/src/blood.cpp +++ b/source/blood/src/blood.cpp @@ -73,6 +73,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "menu/menu.h" #include "sound/s_soundinternal.h" #include "nnexts.h" +#include"secrets.h" BEGIN_BLD_NS @@ -557,6 +558,7 @@ void StartLevel(GAMEOPTIONS *gameOptions) } char levelName[BMAX_PATH]; currentLevel = &mapList[gGameOptions.nEpisode * kMaxLevels + gGameOptions.nLevel]; + SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); STAT_NewLevel(gameOptions->zLevelName); G_LoadMapHack(levelName, gameOptions->zLevelName); wsrand(gameOptions->uMapCRC); diff --git a/source/common/secrets.cpp b/source/common/secrets.cpp index 8348e7fc1..06347ca95 100644 --- a/source/common/secrets.cpp +++ b/source/common/secrets.cpp @@ -161,6 +161,7 @@ bool SECRET_Load() void SECRET_SetMapName(const char *filename, const char *_maptitle) { + discovered_secrets.Clear(); mapfile = filename; maptitle = _maptitle; } diff --git a/source/duke3d/src/premap.cpp b/source/duke3d/src/premap.cpp index ac833b89d..4b09873e6 100644 --- a/source/duke3d/src/premap.cpp +++ b/source/duke3d/src/premap.cpp @@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mapinfo.h" #include "cmdlib.h" #include "v_2ddrawer.h" +#include "secrets.h" BEGIN_DUKE_NS @@ -1779,6 +1780,7 @@ int G_EnterLevel(int gameMode) userMapRecord.name = ""; userMapRecord.SetFileName(boardfilename); currentLevel = &userMapRecord; + SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); STAT_NewLevel(boardfilename); G_LoadMapHack(levelName, boardfilename); @@ -1792,7 +1794,8 @@ int G_EnterLevel(int gameMode) else { currentLevel = &mm; - STAT_NewLevel(mm.fileName); + SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); + STAT_NewLevel(mm.fileName); G_LoadMapHack(levelName, mm.fileName); } diff --git a/source/rr/src/premap.cpp b/source/rr/src/premap.cpp index cf6f4e28c..59ca8ed49 100644 --- a/source/rr/src/premap.cpp +++ b/source/rr/src/premap.cpp @@ -32,6 +32,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. #include "mapinfo.h" #include "cmdlib.h" #include "v_2ddrawer.h" +#include "secrets.h" BEGIN_RR_NS @@ -2329,6 +2330,7 @@ int G_EnterLevel(int gameMode) userMapRecord.name = ""; userMapRecord.SetFileName(boardfilename); currentLevel = &userMapRecord; + SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); STAT_NewLevel(boardfilename); G_LoadMapHack(levelName, boardfilename); userMapRecord.music = G_SetupFilenameBasedMusic(boardfilename, !RR? "dethtoll.mid" : nullptr); @@ -2341,7 +2343,8 @@ int G_EnterLevel(int gameMode) else { currentLevel = &mi; - STAT_NewLevel(mi.fileName); + SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); + STAT_NewLevel(mi.fileName); G_LoadMapHack(levelName, mi.fileName); } diff --git a/source/sw/src/game.cpp b/source/sw/src/game.cpp index df410702b..5cda617d8 100644 --- a/source/sw/src/game.cpp +++ b/source/sw/src/game.cpp @@ -98,6 +98,7 @@ Things required to make savegames work: #include "mapinfo.h" #include "rendering/v_video.h" #include "sound/s_soundinternal.h" +#include "secrets.h" #include "osdcmds.h" @@ -622,7 +623,8 @@ bool LoadLevel(const char *filename) return false; } currentLevel = &mapList[Level]; - STAT_NewLevel(currentLevel->labelName); + SECRET_SetMapName(currentLevel->DisplayName(), currentLevel->name); + STAT_NewLevel(currentLevel->labelName); return true; }