Add reset/randomize all SFX and Cosmetic commands to console (#2378)

* add reset/randomize all commands to debug console for sfx and cosmetic editor

* fix cvar func
This commit is contained in:
Adam Bird
2023-01-22 03:51:23 -05:00
committed by GitHub
parent 52a976489b
commit 37f31116b3
5 changed files with 132 additions and 31 deletions
+46
View File
@@ -8,6 +8,8 @@
#include <string>
#include "soh/OTRGlobals.h"
#include <soh/Enhancements/item-tables/ItemTableManager.h>
#include "soh/Enhancements/cosmetics/CosmeticsEditor.h"
#include "soh/Enhancements/sfx-editor/SfxEditor.h"
#define Path _Path
@@ -906,6 +908,42 @@ static bool CuccoStormHandler(std::shared_ptr<Ship::Console> Console, const std:
return CMD_SUCCESS;
}
static bool CosmeticsHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() != 2) {
SohImGui::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed");
return CMD_FAILED;
}
if (args[1].compare("reset") == 0) {
CosmeticsEditor_ResetAll();
} else if (args[1].compare("randomize") == 0) {
CosmeticsEditor_RandomizeAll();
} else {
SohImGui::GetConsole()->SendErrorMessage("[SOH] Invalid argument passed, must be 'reset' or 'randomize'");
return CMD_FAILED;
}
return CMD_SUCCESS;
}
static bool SfxHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args) {
if (args.size() != 2) {
SohImGui::GetConsole()->SendErrorMessage("[SOH] Unexpected arguments passed");
return CMD_FAILED;
}
if (args[1].compare("reset") == 0) {
SfxEditor_ResetAll();
} else if (args[1].compare("randomize") == 0) {
SfxEditor_RandomizeAll();
} else {
SohImGui::GetConsole()->SendErrorMessage("[SOH] Invalid argument passed, must be 'reset' or 'randomize'");
return CMD_FAILED;
}
return CMD_SUCCESS;
}
#define VARTYPE_INTEGER 0
#define VARTYPE_FLOAT 1
#define VARTYPE_STRING 2
@@ -1159,5 +1197,13 @@ void DebugConsole_Init(void) {
CMD_REGISTER("cucco_storm", { CuccoStormHandler, "Cucco Storm" });
CMD_REGISTER("cosmetics", { CosmeticsHandler, "Change cosmetics.", {
{ "reset|randomize", Ship::ArgumentType::TEXT },
}});
CMD_REGISTER("sfx", { SfxHandler, "Change SFX.", {
{ "reset|randomize", Ship::ArgumentType::TEXT },
}});
CVarLoad();
}