diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 2cad63503..648c07705 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -745,6 +745,7 @@ set (PCH_SOURCES common/openaudio.cpp common/optionmenu/optionmenu.cpp common/statistics.cpp + common/secrets.cpp common/2d/v_2ddrawer.cpp common/2d/v_draw.cpp diff --git a/source/blood/src/eventq.cpp b/source/blood/src/eventq.cpp index 855da5259..dc9a21e17 100644 --- a/source/blood/src/eventq.cpp +++ b/source/blood/src/eventq.cpp @@ -380,6 +380,7 @@ void evSend(int nIndex, int nType, int rxId, COMMAND_ID command, short causedBy) else viewSetSystemMessage("Invalid Total-Secrets command by xobject #%d (object type %d)", nIndex, nType); break; case kChannelSecretFound: + Printf(PRINT_NONOTIFY, "Secret trigger %d\n", nIndex * 65536 + nType); if (command >= kCmdNumberic) levelTriggerSecret(command - kCmdNumberic); else viewSetSystemMessage("Invalid Trigger-Secret command by xobject #%d (object type %d)", nIndex, nType); break; diff --git a/source/common/secrets.cpp b/source/common/secrets.cpp new file mode 100644 index 000000000..64a244e95 --- /dev/null +++ b/source/common/secrets.cpp @@ -0,0 +1,84 @@ +#include "c_dispatch.h" +#include "cache1d.h" +#include "printf.h" +#include "v_text.h" + + +//============================================================================ +// +// Print secret hints +// +//============================================================================ + +CCMD(secret) +{ + const char *mapname = argv.argc() < 2? primaryLevel->MapName.GetChars() : argv[1]; + bool thislevel = !stricmp(mapname, primaryLevel->MapName); + bool foundsome = false; + + int lumpno=Wads.CheckNumForName("SECRETS"); + if (lumpno < 0) return; + + auto lump = Wads.OpenLumpReader(lumpno); + FString maphdr; + maphdr.Format("[%s]", mapname); + + FString linebuild; + char readbuffer[1024]; + bool inlevel = false; + + while (lump.Gets(readbuffer, 1024)) + { + if (!inlevel) + { + if (readbuffer[0] == '[') + { + inlevel = !strnicmp(readbuffer, maphdr, maphdr.Len()); + if (!foundsome) + { + FString levelname; + level_info_t *info = FindLevelInfo(mapname); + const char *ln = !(info->flags & LEVEL_LOOKUPLEVELNAME)? info->LevelName.GetChars() : GStrings[info->LevelName.GetChars()]; + levelname.Format("%s - %s", mapname, ln); + Printf(TEXTCOLOR_YELLOW "%s\n", levelname.GetChars()); + size_t llen = levelname.Len(); + levelname = ""; + for(size_t ii=0; iilotag = 0; P_DoQuote(QUOTE_FOUND_SECRET, pPlayer); + Printf(PRINT_NONOTIFY, "Secret in sector %d\n", pPlayer->cursectnum); pPlayer->secret_rooms++; return; diff --git a/source/rr/src/sector.cpp b/source/rr/src/sector.cpp index 162b8268e..d827fbe01 100644 --- a/source/rr/src/sector.cpp +++ b/source/rr/src/sector.cpp @@ -4284,7 +4284,8 @@ void P_CheckSectors(int playerNum) if (RR && !RRRA) g_canSeePlayer = 0; P_DoQuote(QUOTE_FOUND_SECRET, pPlayer); - pPlayer->secret_rooms++; + Printf(PRINT_NONOTIFY, "Secret in sector %d\n", pPlayer->cursectnum); + pPlayer->secret_rooms++; return; case UINT16_MAX: