diff --git a/Source/control.cpp b/Source/control.cpp index f8429003a..85c9d9880 100644 --- a/Source/control.cpp +++ b/Source/control.cpp @@ -462,11 +462,49 @@ std::string TextCmdInspect(const string_view parameter) return ret; } +std::string TextCmdLevelSeed(const string_view parameter) +{ + string_view levelType = setlevel ? "set level" : "dungeon level"; + + char gameId[] = { + static_cast((sgGameInitInfo.programid >> 24) & 0xFF), + static_cast((sgGameInitInfo.programid >> 16) & 0xFF), + static_cast((sgGameInitInfo.programid >> 8) & 0xFF), + static_cast(sgGameInitInfo.programid & 0xFF), + '\0' + }; + + string_view mode = gbIsMultiplayer ? "MP" : "SP"; + + string_view questPool; + if (UseMultiplayerQuests()) + questPool = "MP"; + else if (*sgOptions.Gameplay.randomizeQuests) + questPool = "Random"; + else + questPool = "All"; + + return StrCat( + "Seedinfo for ", levelType, " ", currlevel, "\n", + "seed: ", glSeedTbl[currlevel], "\n", +#ifdef _DEBUG + "Mid1: ", glMid1Seed[currlevel], "\n", + "Mid2: ", glMid2Seed[currlevel], "\n", + "Mid3: ", glMid3Seed[currlevel], "\n", + "End: ", glEndSeed[currlevel], "\n", +#endif + "\n", + gameId, " ", mode, "\n", + questPool, " quests: ", glSeedTbl[15], "\n", + "Storybook: ", glSeedTbl[16]); +} + std::vector TextCmdList = { { N_("/help"), N_("Prints help overview or help for a specific command."), N_("({command})"), &TextCmdHelp }, { N_("/arena"), N_("Enter a PvP Arena."), N_("{arena-number}"), &TextCmdArena }, { N_("/arenapot"), N_("Gives Arena Potions."), N_("{number}"), &TextCmdArenaPot }, { N_("/inspect"), N_("Inspects stats and equipment of another player."), N_("{player name}"), &TextCmdInspect }, + { N_("/seedinfo"), N_("Show seed infos for current level."), "", &TextCmdLevelSeed }, }; bool CheckTextCommand(const string_view text) diff --git a/Source/debug.cpp b/Source/debug.cpp index 7ab027409..5e1eff9f2 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -24,7 +24,6 @@ #include "lighting.h" #include "monstdat.h" #include "monster.h" -#include "options.h" #include "plrmsg.h" #include "quests.h" #include "spells.h" @@ -49,6 +48,12 @@ std::unordered_map DebugCoordsMap; bool DebugScrollViewEnabled = false; std::string debugTRN; +// Used for debugging level generation +uint32_t glMid1Seed[NUMLEVELS]; +uint32_t glMid2Seed[NUMLEVELS]; +uint32_t glMid3Seed[NUMLEVELS]; +uint32_t glEndSeed[NUMLEVELS]; + namespace { enum class DebugGridTextItem : uint16_t { @@ -89,12 +94,6 @@ std::vector SearchMonsters; std::vector SearchItems; std::vector SearchObjects; -// Used for debugging level generation -uint32_t glMid1Seed[NUMLEVELS]; -uint32_t glMid2Seed[NUMLEVELS]; -uint32_t glMid3Seed[NUMLEVELS]; -uint32_t glEndSeed[NUMLEVELS]; - void PrintDebugMonster(const Monster &monster) { EventPlrMsg(StrCat( @@ -650,41 +649,6 @@ std::string DebugCmdShowGrid(const string_view parameter) return "Back to boring."; } -std::string DebugCmdLevelSeed(const string_view parameter) -{ - string_view levelType = setlevel ? "set level" : "dungeon level"; - - char gameId[] = { - static_cast((sgGameInitInfo.programid >> 24) & 0xFF), - static_cast((sgGameInitInfo.programid >> 16) & 0xFF), - static_cast((sgGameInitInfo.programid >> 8) & 0xFF), - static_cast(sgGameInitInfo.programid & 0xFF), - '\0' - }; - - string_view mode = gbIsMultiplayer ? "MP" : "SP"; - - string_view questPool; - if (UseMultiplayerQuests()) - questPool = "MP"; - else if (*sgOptions.Gameplay.randomizeQuests) - questPool = "Random"; - else - questPool = "All"; - - return StrCat( - "Seedinfo for ", levelType, " ", currlevel, "\n", - "seed: ", glSeedTbl[currlevel], "\n", - "Mid1: ", glMid1Seed[currlevel], "\n", - "Mid2: ", glMid2Seed[currlevel], "\n", - "Mid3: ", glMid3Seed[currlevel], "\n", - "End: ", glEndSeed[currlevel], "\n", - "\n", - gameId, " ", mode, "\n", - questPool, " quests: ", glSeedTbl[15], "\n", - "Storybook: ", glSeedTbl[16]); -} - std::string DebugCmdSpawnUniqueMonster(const string_view parameter) { if (leveltype == DTYPE_TOWN) @@ -1101,7 +1065,6 @@ std::vector DebugCmdList = { { "exit", "Exits the game.", "", &DebugCmdExit }, { "arrow", "Changes arrow effect (normal, fire, lightning, explosion).", "{effect}", &DebugCmdArrow }, { "grid", "Toggles showing grid.", "", &DebugCmdShowGrid }, - { "seedinfo", "Show seed infos for current level.", "", &DebugCmdLevelSeed }, { "spawnu", "Spawns unique monster {name}.", "{name} ({count})", &DebugCmdSpawnUniqueMonster }, { "spawn", "Spawns monster {name}.", "{name} ({count})", &DebugCmdSpawnMonster }, { "tiledata", "Toggles showing tile data {name} (leave name empty to see a list).", "{name}", &DebugCmdShowTileData }, diff --git a/Source/debug.h b/Source/debug.h index c0d6494d7..050d05c67 100644 --- a/Source/debug.h +++ b/Source/debug.h @@ -8,6 +8,7 @@ #include #include +#include "diablo.h" #include "engine.h" #include "engine/clx_sprite.hpp" #include "utils/stdcompat/string_view.hpp" @@ -24,6 +25,10 @@ extern bool DebugGrid; extern std::unordered_map DebugCoordsMap; extern bool DebugScrollViewEnabled; extern std::string debugTRN; +extern uint32_t glMid1Seed[NUMLEVELS]; +extern uint32_t glMid2Seed[NUMLEVELS]; +extern uint32_t glMid3Seed[NUMLEVELS]; +extern uint32_t glEndSeed[NUMLEVELS]; void FreeDebugGFX(); void LoadDebugGFX();