Add cheats menu.
This commit is contained in:
committed by
KiritoDev
parent
dae8035314
commit
25468cf722
@@ -27,6 +27,7 @@ namespace Game {
|
||||
const std::string AudioSection = AUDIO_SECTION;
|
||||
const std::string ControllerSection = CONTROLLER_SECTION;
|
||||
const std::string EnhancementSection = ENHANCEMENTS_SECTION;
|
||||
const std::string CheatSection = CHEATS_SECTION;
|
||||
|
||||
void UpdateAudio() {
|
||||
Audio_SetGameVolume(SEQ_BGM_MAIN, Settings.audio.music_main);
|
||||
@@ -57,9 +58,7 @@ namespace Game {
|
||||
Settings.enhancements.animated_pause_menu = stob(Conf[EnhancementSection]["animated_pause_menu"]);
|
||||
CVar_SetS32(const_cast<char*>("gPauseLiveLink"), Settings.enhancements.animated_pause_menu);
|
||||
|
||||
Settings.enhancements.debug_mode = stob(Conf[EnhancementSection]["debug_mode"]);
|
||||
CVar_SetS32(const_cast<char*>("gDebugEnabled"), Settings.enhancements.debug_mode);
|
||||
|
||||
// Audio
|
||||
Settings.audio.master = Ship::stof(Conf[AudioSection]["master"]);
|
||||
CVar_SetFloat(const_cast<char*>("gGameMasterVolume"), Settings.audio.master);
|
||||
|
||||
@@ -75,6 +74,7 @@ namespace Game {
|
||||
Settings.audio.fanfare = Ship::stof(Conf[AudioSection]["fanfare"]);
|
||||
CVar_SetFloat(const_cast<char*>("gFanfareVolume"), Settings.audio.fanfare);
|
||||
|
||||
// Controllers
|
||||
Settings.controller.gyro_sensitivity = Ship::stof(Conf[ControllerSection]["gyro_sensitivity"]);
|
||||
CVar_SetFloat(const_cast<char*>("gGyroSensitivity"), Settings.controller.gyro_sensitivity);
|
||||
|
||||
@@ -86,6 +86,34 @@ namespace Game {
|
||||
|
||||
Settings.controller.input_enabled = stob(Conf[ControllerSection]["input_enabled"]);
|
||||
CVar_SetS32(const_cast<char*>("gInputEnabled"), Settings.controller.input_enabled);
|
||||
|
||||
// Cheats
|
||||
Settings.cheats.debug_mode = stob(Conf[CheatSection]["debug_mode"]);
|
||||
CVar_SetS32(const_cast<char*>("gDebugEnabled"), Settings.cheats.debug_mode);
|
||||
|
||||
Settings.cheats.infinite_money = stob(Conf[CheatSection]["infinite_money"]);
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteMoney"), Settings.cheats.infinite_money);
|
||||
|
||||
Settings.cheats.infinite_health = stob(Conf[CheatSection]["infinite_health"]);
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteHealth"), Settings.cheats.infinite_health);
|
||||
|
||||
Settings.cheats.infinite_ammo = stob(Conf[CheatSection]["infinite_ammo"]);
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteAmmo"), Settings.cheats.infinite_ammo);
|
||||
|
||||
Settings.cheats.infinite_magic = stob(Conf[CheatSection]["infinite_magic"]);
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteMagic"), Settings.cheats.infinite_magic);
|
||||
|
||||
Settings.cheats.no_clip = stob(Conf[CheatSection]["no_clip"]);
|
||||
CVar_SetS32(const_cast<char*>("gNoClip"), Settings.cheats.no_clip);
|
||||
|
||||
Settings.cheats.climb_everything = stob(Conf[CheatSection]["climb_everything"]);
|
||||
CVar_SetS32(const_cast<char*>("gClimbEverything"), Settings.cheats.climb_everything);
|
||||
|
||||
Settings.cheats.moon_jump_on_l = stob(Conf[CheatSection]["moon_jump_on_l"]);
|
||||
CVar_SetS32(const_cast<char*>("gMoonJumpOnL"), Settings.cheats.moon_jump_on_l);
|
||||
|
||||
Settings.cheats.super_tunic = stob(Conf[CheatSection]["super_tunic"]);
|
||||
CVar_SetS32(const_cast<char*>("gSuperTunic"), Settings.cheats.super_tunic);
|
||||
|
||||
UpdateAudio();
|
||||
}
|
||||
@@ -111,13 +139,25 @@ namespace Game {
|
||||
Conf[EnhancementSection]["fast_text"] = std::to_string(Settings.enhancements.fast_text);
|
||||
Conf[EnhancementSection]["disable_lod"] = std::to_string(Settings.enhancements.disable_lod);
|
||||
Conf[EnhancementSection]["animated_pause_menu"] = std::to_string(Settings.enhancements.animated_pause_menu);
|
||||
Conf[EnhancementSection]["debug_mode"] = std::to_string(Settings.enhancements.debug_mode);
|
||||
|
||||
|
||||
// Controllers
|
||||
Conf[ControllerSection]["gyro_sensitivity"] = std::to_string(Settings.controller.gyro_sensitivity);
|
||||
Conf[ControllerSection]["rumble_strength"] = std::to_string(Settings.controller.rumble_strength);
|
||||
Conf[ControllerSection]["input_scale"] = std::to_string(Settings.controller.input_scale);
|
||||
Conf[ControllerSection]["input_enabled"] = std::to_string(Settings.controller.input_enabled);
|
||||
|
||||
// Cheats
|
||||
Conf[CheatSection]["debug_mode"] = std::to_string(Settings.cheats.debug_mode);
|
||||
Conf[CheatSection]["infinite_money"] = std::to_string(Settings.cheats.infinite_money);
|
||||
Conf[CheatSection]["infinite_health"] = std::to_string(Settings.cheats.infinite_health);
|
||||
Conf[CheatSection]["infinite_ammo"] = std::to_string(Settings.cheats.infinite_ammo);
|
||||
Conf[CheatSection]["infinite_magic"] = std::to_string(Settings.cheats.infinite_magic);
|
||||
Conf[CheatSection]["no_clip"] = std::to_string(Settings.cheats.no_clip);
|
||||
Conf[CheatSection]["climb_everything"] = std::to_string(Settings.cheats.climb_everything);
|
||||
Conf[CheatSection]["moon_jump_on_l"] = std::to_string(Settings.cheats.moon_jump_on_l);
|
||||
Conf[CheatSection]["super_tunic"] = std::to_string(Settings.cheats.super_tunic);
|
||||
|
||||
Conf.Save();
|
||||
}
|
||||
|
||||
|
||||
@@ -23,15 +23,28 @@ struct SoHConfigType {
|
||||
bool fast_text = false;
|
||||
bool disable_lod = false;
|
||||
bool animated_pause_menu = false;
|
||||
bool debug_mode = false;
|
||||
} enhancements;
|
||||
|
||||
// Controller
|
||||
struct {
|
||||
float gyro_sensitivity = 1.0f;
|
||||
float rumble_strength = 1.0f;
|
||||
float input_scale = 1.0f;
|
||||
bool input_enabled = false;
|
||||
} controller;
|
||||
|
||||
// Cheats
|
||||
struct {
|
||||
bool debug_mode = false;
|
||||
bool infinite_money = false;
|
||||
bool infinite_health = false;
|
||||
bool infinite_ammo = false;
|
||||
bool infinite_magic = false;
|
||||
bool no_clip = false;
|
||||
bool climb_everything = false;
|
||||
bool moon_jump_on_l = false;
|
||||
bool super_tunic = false;
|
||||
} cheats;
|
||||
};
|
||||
|
||||
enum SeqPlayers {
|
||||
@@ -46,6 +59,7 @@ enum SeqPlayers {
|
||||
#define AUDIO_SECTION "AUDIO SETTINGS"
|
||||
#define CONTROLLER_SECTION "CONTROLLER SECTION"
|
||||
#define ENHANCEMENTS_SECTION "ENHANCEMENT SETTINGS"
|
||||
#define CHEATS_SECTION "CHEATS SETTINGS"
|
||||
|
||||
namespace Game {
|
||||
extern SoHConfigType Settings;
|
||||
|
||||
@@ -350,20 +350,65 @@ namespace SohImGui {
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
ImGui::Text("Debugging");
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Checkbox("Debug Mode", &Game::Settings.enhancements.debug_mode)) {
|
||||
CVar_SetS32(const_cast<char*>("gDebugEnabled"), Game::Settings.enhancements.debug_mode);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Developer Tools")) {
|
||||
HOOK(ImGui::MenuItem("Stats", nullptr, &Game::Settings.debug.soh));
|
||||
HOOK(ImGui::MenuItem("Console", nullptr, &console->opened));
|
||||
|
||||
ImGui::Text("Debug");
|
||||
ImGui::Separator();
|
||||
|
||||
if (ImGui::Checkbox("Debug Mode", &Game::Settings.cheats.debug_mode)) {
|
||||
CVar_SetS32(const_cast<char*>("gDebugEnabled"), Game::Settings.cheats.debug_mode);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
if (ImGui::BeginMenu("Cheats")) {
|
||||
if (ImGui::Checkbox("Infinite Money", &Game::Settings.cheats.infinite_money)) {
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteMoney"), Game::Settings.cheats.infinite_money);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Infinite Health", &Game::Settings.cheats.infinite_health)) {
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteHealth"), Game::Settings.cheats.infinite_health);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Infinite Ammo", &Game::Settings.cheats.infinite_ammo)) {
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteAmmo"), Game::Settings.cheats.infinite_ammo);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Infinite Magic", &Game::Settings.cheats.infinite_magic)) {
|
||||
CVar_SetS32(const_cast<char*>("gInfiniteMagic"), Game::Settings.cheats.infinite_magic);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("No Clip", &Game::Settings.cheats.no_clip)) {
|
||||
CVar_SetS32(const_cast<char*>("gNoClip"), Game::Settings.cheats.no_clip);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Climb Everything", &Game::Settings.cheats.climb_everything)) {
|
||||
CVar_SetS32(const_cast<char*>("gClimbEverything"), Game::Settings.cheats.climb_everything);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Moon Jump on L", &Game::Settings.cheats.moon_jump_on_l)) {
|
||||
CVar_SetS32(const_cast<char*>("gMoonJumpOnL"), Game::Settings.cheats.moon_jump_on_l);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("Super Tunic", &Game::Settings.cheats.super_tunic)) {
|
||||
CVar_SetS32(const_cast<char*>("gSuperTunic"), Game::Settings.cheats.super_tunic);
|
||||
needs_save = true;
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user