diff --git a/Source/debug.cpp b/Source/debug.cpp index d5573f675..bd5cc33b4 100644 --- a/Source/debug.cpp +++ b/Source/debug.cpp @@ -16,6 +16,7 @@ #include "setmaps.h" #include "spells.h" #include "utils/language.h" +#include "quests.h" namespace devilution { @@ -214,6 +215,24 @@ std::string DebugCmdVision(const std::string_view parameter) return "My path is set."; } +std::string DebugCmdQuest(const std::string_view parameter) +{ + if (parameter.empty()) + return "You must provide an id"; + + int questId = atoi(parameter.data()); + + if (questId >= MAXQUESTS) + return fmt::format("Quest {} is not known. Do you want to write a mod?", questId); + + if (IsNoneOf(Quests[questId]._qactive, QUEST_NOTAVAIL, QUEST_INIT)) + return fmt::format("{} was already given.", QuestData[questId]._qlstr); + + Quests[questId]._qactive = QUEST_ACTIVE; + + return fmt::format("{} enabled.", QuestData[questId]._qlstr); +} + std::string DebugCmdLevelUp(const std::string_view parameter) { int levels = std::max(1, atoi(parameter.data())); @@ -271,6 +290,7 @@ std::vector DebugCmdList = { { "give spells", "Add all spells to player.", "", &DebugCmdGetAllSpells }, { "give spells 10", "Set spell level to 10 for all spells.", "", &DebugCmdMaxSpellLevel }, { "take gold", "Removes all gold from inventory.", "", &DebugCmdTakeGoldCheat }, + { "give quest", "Enable a given quest.", "({id})", &DebugCmdQuest }, { "changelevel", "Moves to specifided {level} (use 0 for town).", "{level}", &DebugCmdWarpToLevel }, { "map", "Load a quest level {level}.", "{level}", &DebugCmdLoadMap }, { "restart", "Resets specified {level}.", "{level}", &DebugCmdResetLevel }, diff --git a/Source/diablo.cpp b/Source/diablo.cpp index def7f86ca..94ca38cde 100644 --- a/Source/diablo.cpp +++ b/Source/diablo.cpp @@ -101,7 +101,6 @@ bool gbForceWindowed = false; bool monstdebug = false; _monster_id DebugMonsters[10]; int debugmonsttypes = 0; -int questdebug = -1; bool debug_mode_key_inverted_v = false; bool debug_mode_key_i = false; #endif @@ -852,7 +851,6 @@ void RunGameLoop(interface_mode uMsg) printInConsole(" %-20s %-30s\n", "-^", "Enable debug tools"); printInConsole(" %-20s %-30s\n", "-i", "Ignore network timeout"); printInConsole(" %-20s %-30s\n", "-m <##>", "Add debug monster, up to 10 allowed"); - printInConsole(" %-20s %-30s\n", "-q <#>", "Force a certain quest"); printInConsole(" %-20s %-30s\n", "-r <##########>", "Set map seed"); #endif printInConsole("%s", _("\nReport bugs at https://github.com/diasurgical/devilutionX/\n")); @@ -913,8 +911,6 @@ void DiabloParseFlags(int argc, char **argv) } else if (strcasecmp("-m", argv[i]) == 0) { monstdebug = true; DebugMonsters[debugmonsttypes++] = (_monster_id)SDL_atoi(argv[++i]); - } else if (strcasecmp("-q", argv[i]) == 0) { - questdebug = SDL_atoi(argv[++i]); } else if (strcasecmp("-r", argv[i]) == 0) { setseed = SDL_atoi(argv[++i]); #endif diff --git a/Source/diablo.h b/Source/diablo.h index b99199088..dbb9a88cb 100644 --- a/Source/diablo.h +++ b/Source/diablo.h @@ -105,7 +105,6 @@ extern bool gbForceWindowed; extern bool monstdebug; extern _monster_id DebugMonsters[10]; extern int debugmonsttypes; -extern int questdebug; extern bool debug_mode_key_inverted_v; extern bool debug_mode_key_i; #endif diff --git a/Source/quests.cpp b/Source/quests.cpp index 7fa789315..4362dec3e 100644 --- a/Source/quests.cpp +++ b/Source/quests.cpp @@ -318,10 +318,6 @@ void InitQuests() // Quests are set from the seed used to generate level 16. InitialiseQuestPools(glSeedTbl[15], Quests); } -#ifdef _DEBUG - if (questdebug != -1) - Quests[questdebug]._qactive = QUEST_ACTIVE; -#endif if (gbIsSpawn) { for (auto &quest : Quests) {