From c66c874549007b50c1646373b47b14edc796ccfb Mon Sep 17 00:00:00 2001 From: Nicholas Estelami Date: Fri, 29 Apr 2022 11:49:28 -0400 Subject: [PATCH] Fixed merge issues --- libultraship/libultraship/GameSettings.cpp | 4 - libultraship/libultraship/GameSettings.h | 6 - libultraship/libultraship/SDLController.cpp | 20 +- libultraship/libultraship/SohImGuiImpl.cpp | 301 ++++++++------------ soh/soh/OTRGlobals.cpp | 8 +- soh/src/code/z_player_lib.c | 24 +- 6 files changed, 144 insertions(+), 219 deletions(-) diff --git a/libultraship/libultraship/GameSettings.cpp b/libultraship/libultraship/GameSettings.cpp index 799681d59..9b7543b7d 100644 --- a/libultraship/libultraship/GameSettings.cpp +++ b/libultraship/libultraship/GameSettings.cpp @@ -60,10 +60,6 @@ namespace Game { for (const auto& [i, controllers] : Ship::Window::Controllers) { for (const auto& controller : controllers) { if (auto padConfSection = controller->GetPadConfSection()) { - Settings.controller.extra[i].gyro_sensitivity = Ship::stof(Conf[*padConfSection]["gyro_sensitivity"]); - Settings.controller.extra[i].rumble_strength = Ship::stof(Conf[*padConfSection]["rumble_strength"]); - Settings.controller.extra[i].gyro_drift_x = Ship::stof(Conf[*padConfSection]["gyro_drift_x"], 0.0f); - Settings.controller.extra[i].gyro_drift_y = Ship::stof(Conf[*padConfSection]["gyro_drift_y"], 0.0f); } } } diff --git a/libultraship/libultraship/GameSettings.h b/libultraship/libultraship/GameSettings.h index 1678eaf3f..4b9956d17 100644 --- a/libultraship/libultraship/GameSettings.h +++ b/libultraship/libultraship/GameSettings.h @@ -8,12 +8,6 @@ struct SoHConfigType { bool soh_sink = true; } debug; - // Controller - struct { - float gyroDriftX = 0.0f; - float gyroDriftY = 0.0f; - } controller; - // Graphics struct { bool show = false; diff --git a/libultraship/libultraship/SDLController.cpp b/libultraship/libultraship/SDLController.cpp index 445037010..c6892edbe 100644 --- a/libultraship/libultraship/SDLController.cpp +++ b/libultraship/libultraship/SDLController.cpp @@ -6,6 +6,7 @@ #include "stox.h" #include "Window.h" #include "Cvar.h" +#include extern "C" uint8_t __osMaxControllers; @@ -189,16 +190,15 @@ namespace Ship { if (SDL_GameControllerHasSensor(Cont, SDL_SENSOR_GYRO)) { size_t contNumber = GetControllerNumber(); - float& gyro_drift_x = Game::Settings.controller.extra[contNumber].gyro_drift_x; - float& gyro_drift_y = Game::Settings.controller.extra[contNumber].gyro_drift_y; - const float gyro_sensitivity = Game::Settings.controller.extra[contNumber].gyro_sensitivity; - + float gyroData[3]; SDL_GameControllerGetSensorData(Cont, SDL_SENSOR_GYRO, gyroData, 3); const char* contName = SDL_GameControllerName(Cont); const int isSpecialController = !strcmp("PS5 Controller", contName); - const float gyroSensitivity = CVar_GetFloat("gGyroSensitivity", 1.0f); + float gyro_drift_x = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX").c_str(), 0.0f); + float gyro_drift_y = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY").c_str(), 0.0f); + const float gyro_sensitivity = CVar_GetFloat(StringHelper::Sprintf("gCont%i_GyroSensitivity").c_str(), 1.0f); if (gyro_drift_x == 0) { gyro_drift_x = gyroData[0]; @@ -213,6 +213,9 @@ namespace Ship { } } + CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX").c_str(), gyro_drift_x); + CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY").c_str(), gyro_drift_y); + if (isSpecialController == 1) { wGyroX = gyroData[0] - gyro_drift_x; wGyroY = -gyroData[2] - gyro_drift_y; @@ -346,7 +349,7 @@ namespace Ship { { if (SDL_GameControllerHasRumble(Cont)) { if (controller->rumble > 0) { - float rumble_strength = Game::Settings.controller.extra[GetControllerNumber()].rumble_strength; + float rumble_strength = CVar_GetFloat(StringHelper::Sprintf("gCont%i_RumbleStrength", GetControllerNumber()).c_str(), 1.0f); SDL_GameControllerRumble(Cont, 0xFFFF * rumble_strength, 0xFFFF * rumble_strength, 0); } else { SDL_GameControllerRumble(Cont, 0, 0, 0); @@ -414,11 +417,6 @@ namespace Ship { std::shared_ptr pConf = GlobalCtx2::GetInstance()->GetConfig(); ConfigFile& Conf = *pConf.get(); - Conf[ConfSection]["gyro_sensitivity"] = std::to_string(1.0f); - Conf[ConfSection]["rumble_strength"] = std::to_string(1.0f); - Conf[ConfSection]["gyro_drift_x"] = std::to_string(0.0f); - Conf[ConfSection]["gyro_drift_y"] = std::to_string(0.0f); - Conf.Save(); } diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 364b56bff..fb4841ee9 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -84,49 +84,51 @@ namespace SohImGui { ImGui_ImplWin32_Init(impl.dx11.window); break; } - kokiri_col[0] = std::clamp((float) CVar_GetS32("gTunic_Kokiri_Red", 30)/255, 0.0f, 1.0f); - kokiri_col[1] = std::clamp((float)CVar_GetS32("gTunic_Kokiri_Green", 105) / 255, 0.0f, 1.0f); - kokiri_col[2] = std::clamp((float)CVar_GetS32("gTunic_Kokiri_Blue", 27) / 255, 0.0f, 1.0f); - - goron_col[0] = std::clamp((float)CVar_GetS32("gTunic_Goron_Red", 100) / 255, 0.0f, 1.0f); - goron_col[1] = std::clamp((float)CVar_GetS32("gTunic_Goron_Green", 20) / 255, 0.0f, 1.0f); - goron_col[2] = std::clamp((float)CVar_GetS32("gTunic_Goron_Blue", 0) / 255, 0.0f, 1.0f); - zora_col[0] = std::clamp((float)CVar_GetS32("gTunic_Zora_Red", 0) / 255, 0.0f, 1.0f); - zora_col[1] = std::clamp((float)CVar_GetS32("gTunic_Zora_Green", 60) / 255, 0.0f, 1.0f); - zora_col[2] = std::clamp((float)CVar_GetS32("gTunic_Zora_Blue", 100) / 255, 0.0f, 1.0f); + // OTRTODO: This gameplay specific stuff should not be in libultraship. This needs to be moved to soh and use sTunicColors + kokiri_col[0] = 30 / 255.0f; + kokiri_col[1] = 105 / 255.0f; + kokiri_col[2] = 27 / 255.0f; - navi_idle_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_Idle_Inner_Red", 0) / 255, 0.0f, 1.0f); - navi_idle_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_Idle_Inner_Green", 0) / 255, 0.0f, 1.0f); - navi_idle_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_Idle_Inner_Blue", 0) / 255, 0.0f, 1.0f); + goron_col[0] = 100 / 255.0f; + goron_col[1] = 20 / 255.0f; + goron_col[2] = 0; + + zora_col[0] = 0; + zora_col[1] = 60 / 255.0f; + zora_col[2] = 100 / 255.0f; - navi_idle_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_Idle_Outer_Red", 0) / 255, 0.0f, 1.0f); - navi_idle_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_Idle_Outer_Green", 0) / 255, 0.0f, 1.0f); - navi_idle_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_Idle_Outer_Blue", 0) / 255, 0.0f, 1.0f); + navi_idle_i_col[0] = 0; + navi_idle_i_col[1] = 0; + navi_idle_i_col[2] = 0; - navi_npc_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_NPC_Inner_Red", 0) / 255, 0.0f, 1.0f); - navi_npc_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_NPC_Inner_Green", 0) / 255, 0.0f, 1.0f); - navi_npc_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_NPC_Inner_Blue", 0) / 255, 0.0f, 1.0f); + navi_idle_o_col[0] = 0; + navi_idle_o_col[1] = 0; + navi_idle_o_col[2] = 0; - navi_npc_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_NPC_Outer_Red", 0) / 255, 0.0f, 1.0f); - navi_npc_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_NPC_Outer_Green", 0) / 255, 0.0f, 1.0f); - navi_npc_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_NPC_Outer_Blue", 0) / 255, 0.0f, 1.0f); + navi_npc_i_col[0] = 0; + navi_npc_i_col[1] = 0; + navi_npc_i_col[2] = 0; - navi_enemy_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Inner_Red", 0) / 255, 0.0f, 1.0f); - navi_enemy_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Inner_Green", 0) / 255, 0.0f, 1.0f); - navi_enemy_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Inner_Blue", 0) / 255, 0.0f, 1.0f); + navi_npc_o_col[0] = 0; + navi_npc_o_col[1] = 0; + navi_npc_o_col[2] = 0; - navi_enemy_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Outer_Red", 0) / 255, 0.0f, 1.0f); - navi_enemy_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Outer_Green", 0) / 255, 0.0f, 1.0f); - navi_enemy_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_Enemy_Outer_Blue", 0) / 255, 0.0f, 1.0f); + navi_enemy_i_col[0] = 0; + navi_enemy_i_col[1] = 0; + navi_enemy_i_col[2] = 0; - navi_prop_i_col[0] = std::clamp((float)CVar_GetS32("gNavi_Prop_Inner_Red", 0) / 255, 0.0f, 1.0f); - navi_prop_i_col[1] = std::clamp((float)CVar_GetS32("gNavi_Prop_Inner_Green", 0) / 255, 0.0f, 1.0f); - navi_prop_i_col[2] = std::clamp((float)CVar_GetS32("gNavi_Prop_Inner_Blue", 0) / 255, 0.0f, 1.0f); + navi_enemy_o_col[0] = 0; + navi_enemy_o_col[1] = 0; + navi_enemy_o_col[2] = 0; - navi_prop_o_col[0] = std::clamp((float)CVar_GetS32("gNavi_Prop_Outer_Red", 0) / 255, 0.0f, 1.0f); - navi_prop_o_col[1] = std::clamp((float)CVar_GetS32("gNavi_Prop_Outer_Green", 0) / 255, 0.0f, 1.0f); - navi_prop_o_col[2] = std::clamp((float)CVar_GetS32("gNavi_Prop_Outer_Blue", 0) / 255, 0.0f, 1.0f); + navi_prop_i_col[0] = 0; + navi_prop_i_col[1] = 0; + navi_prop_i_col[2] = 0; + + navi_prop_o_col[0] = 0; + navi_prop_o_col[1] = 0; + navi_prop_o_col[2] = 0; } void ImGuiBackendInit() { @@ -373,11 +375,14 @@ namespace SohImGui { } } - void EnhancementSliderFloat(std::string text, std::string id, std::string cvarName, float min, float max, std::string format, float defaultValue) + void EnhancementSliderFloat(std::string text, std::string id, std::string cvarName, float min, float max, std::string format, float defaultValue, bool isPercentage) { float val = CVar_GetFloat(cvarName.c_str(), defaultValue); - ImGui::Text(text.c_str(), static_cast(100 * val)); + if (!isPercentage) + ImGui::Text(text.c_str(), val); + else + ImGui::Text(text.c_str(), static_cast(100 * val)); if (ImGui::SliderFloat(id.c_str(), &val, min, max, format.c_str())) { @@ -400,6 +405,28 @@ namespace SohImGui { } } + void EnhancementColor3(std::string text, std::string cvarName, float defaultColors[3]) + { + int r = CVar_GetS32((cvarName + "_Red").c_str(), (defaultColors[0] * 255.0f)); + int g = CVar_GetS32((cvarName + "_Green").c_str(), (defaultColors[1] * 255.0f)); + int b = CVar_GetS32((cvarName + "_Blue").c_str(), (defaultColors[2] * 255.0f)); + + float colors[3]; + colors[0] = r / 255.0f; + colors[1] = g / 255.0f; + colors[2] = b / 255.0f; + + { + if (ImGui::ColorEdit3(text.c_str(), colors)) + { + CVar_SetS32((cvarName + "_Red").c_str(), (int)(colors[0] * 255)); + CVar_SetS32((cvarName + "_Green").c_str(), (int)(colors[1] * 255)); + CVar_SetS32((cvarName + "_Blue").c_str(), (int)(colors[2] * 255)); + needs_save = true; + } + } + } + void DrawMainMenuAndCalculateGameSize() { console->Update(); ImGuiBackendNewFrame(); @@ -455,7 +482,7 @@ namespace SohImGui { ImGui::Separator(); if (ImGui::BeginMenu("Audio")) { - EnhancementSliderFloat("Master Volume: %d %%", "##Master_Vol", "gGameMasterVolume", 0.0f, 1.0f, "", 1.0f); + EnhancementSliderFloat("Master Volume: %d %%", "##Master_Vol", "gGameMasterVolume", 0.0f, 1.0f, "", 1.0f, true); BindAudioSlider("Main Music Volume: %d %%", "gMainMusicVolume", 1.0f, SEQ_BGM_MAIN); BindAudioSlider("Sub Music Volume: %d %%", "gSubMusicVolume", 1.0f, SEQ_BGM_SUB); @@ -465,26 +492,41 @@ namespace SohImGui { ImGui::EndMenu(); } - if (ImGui::BeginMenu("Controller")) + if (ImGui::BeginMenu("Controller")) { - EnhancementSliderFloat("Gyro Sensitivity: %d %%", "##GYROSCOPE", "gGyroSensitivity", 0.0f, 1.0f, "", 1.0f); - - if (ImGui::Button("Recalibrate Gyro")) { - Game::Settings.controller.gyroDriftX = 0; - Game::Settings.controller.gyroDriftY = 0; + for (const auto& [i, controllers] : Ship::Window::Controllers) + { + bool hasPad = std::find_if(controllers.begin(), controllers.end(), [](const auto& c) { + return c->HasPadConf() && c->Connected(); + }) != controllers.end(); + + if (!hasPad) continue; + + auto menuLabel = "Controller " + std::to_string(i + 1); + if (ImGui::BeginMenu(menuLabel.c_str())) + { + EnhancementSliderFloat("Gyro Sensitivity: %d %%", "##GYROSCOPE", StringHelper::Sprintf("gCont%i_GyroSensitivity", i), 0.0f, 1.0f, "", 1.0f, true); + + if (ImGui::Button("Recalibrate Gyro")) + { + CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftX").c_str(), 0); + CVar_SetFloat(StringHelper::Sprintf("gCont%i_GyroDriftY").c_str(), 0); + needs_save = true; + } + + ImGui::Separator(); + + EnhancementSliderFloat("Rumble Strength: %d %%", "##RUMBLE", StringHelper::Sprintf("gCont%i_RumbleStrength", i), 0.0f, 1.0f, "", 1.0f, true); + + ImGui::EndMenu(); + } + ImGui::Separator(); } - ImGui::Separator(); - - EnhancementSliderFloat("Rumble Strength: %d %%", "##RUMBLE", "gRumbleStrength", 0.0f, 1.0f, "", 1.0f); - EnhancementCheckbox("Show Inputs", "gInputEnabled"); - if (ImGui::Checkbox("Rumble Enabled", &Game::Settings.controller.rumble_enabled)) { - CVar_SetS32("gRumbleEnabled", Game::Settings.controller.rumble_enabled); - needs_save = true; - } + EnhancementCheckbox("Rumble Enabled", "gRumbleEnabled"); - EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f); + EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false); ImGui::Separator(); @@ -495,7 +537,8 @@ namespace SohImGui { ImGui::EndMenu(); } - if (ImGui::BeginMenu("Enhancements")) { + if (ImGui::BeginMenu("Enhancements")) + { ImGui::Text("Gameplay"); ImGui::Separator(); @@ -520,7 +563,8 @@ namespace SohImGui { ImGui::EndMenu(); } - if (ImGui::BeginMenu("Developer Tools")) { + if (ImGui::BeginMenu("Developer Tools")) + { HOOK(ImGui::MenuItem("Stats", nullptr, &Game::Settings.debug.soh)); HOOK(ImGui::MenuItem("Console", nullptr, &console->opened)); @@ -532,12 +576,14 @@ namespace SohImGui { ImGui::EndMenu(); } - if (ImGui::BeginMenu("Graphics")) { + if (ImGui::BeginMenu("Graphics")) + { HOOK(ImGui::MenuItem("Anti-aliasing", nullptr, &Game::Settings.graphics.show)); ImGui::EndMenu(); } - if (ImGui::BeginMenu("Cheats")) { + if (ImGui::BeginMenu("Cheats")) + { if (ImGui::BeginMenu("Infinite...")) { EnhancementCheckbox("Money", "gInfiniteMoney"); EnhancementCheckbox("Health", "gInfiniteHealth"); @@ -559,139 +605,26 @@ namespace SohImGui { ImGui::EndMenu(); } - if (ImGui::BeginMenu("Cosmetics")) { + if (ImGui::BeginMenu("Cosmetics")) + { ImGui::Text("Tunics"); ImGui::Separator(); - if (ImGui::ColorEdit3("Kokiri Tunic", kokiri_col)) { - Game::Settings.cosmetic.tunic_kokiri_red = (int)(kokiri_col[0] * 255); - Game::Settings.cosmetic.tunic_kokiri_green = (int)(kokiri_col[1] * 255); - Game::Settings.cosmetic.tunic_kokiri_blue = (int)(kokiri_col[2] * 255); - CVar_SetS32("gTunic_Kokiri_Red", Game::Settings.cosmetic.tunic_kokiri_red); - CVar_SetS32("gTunic_Kokiri_Green", Game::Settings.cosmetic.tunic_kokiri_green); - CVar_SetS32("gTunic_Kokiri_Blue", Game::Settings.cosmetic.tunic_kokiri_blue); - needs_save = true; - } - if (ImGui::ColorEdit3("Goron Tunic", goron_col)) { - Game::Settings.cosmetic.tunic_goron_red = (int)(goron_col[0] * 255); - Game::Settings.cosmetic.tunic_goron_green = (int)(goron_col[1] * 255); - Game::Settings.cosmetic.tunic_goron_blue = (int)(goron_col[2] * 255); - CVar_SetS32("gTunic_Goron_Red", Game::Settings.cosmetic.tunic_goron_red); - CVar_SetS32("gTunic_Goron_Green", Game::Settings.cosmetic.tunic_goron_green); - CVar_SetS32("gTunic_Goron_Blue", Game::Settings.cosmetic.tunic_goron_blue); - needs_save = true; - } - if (ImGui::ColorEdit3("Zora Tunic", zora_col)) { - Game::Settings.cosmetic.tunic_zora_red = (int)(zora_col[0] * 255); - Game::Settings.cosmetic.tunic_zora_green = (int)(zora_col[1] * 255); - Game::Settings.cosmetic.tunic_zora_blue = (int)(zora_col[2] * 255); - CVar_SetS32("gTunic_Zora_Red", Game::Settings.cosmetic.tunic_zora_red); - CVar_SetS32("gTunic_Zora_Green", Game::Settings.cosmetic.tunic_zora_green); - CVar_SetS32("gTunic_Zora_Blue", Game::Settings.cosmetic.tunic_zora_blue); - needs_save = true; - } + + EnhancementColor3("Kokiri Tunic", "gTunic_Kokiri", kokiri_col); + EnhancementColor3("Goron Tunic", "gTunic_Goron", goron_col); + EnhancementColor3("Zora Tunic", "gTunic_Zora", zora_col); + ImGui::Text("Navi"); ImGui::Separator(); - if (ImGui::ColorEdit3("Navi Idle Inner", navi_idle_i_col)) { - Game::Settings.cosmetic.navi_idle_inner_red = (int)(navi_idle_i_col[0] * 255); - Game::Settings.cosmetic.navi_idle_inner_green = (int)(navi_idle_i_col[1] * 255); - Game::Settings.cosmetic.navi_idle_inner_blue = (int)(navi_idle_i_col[2] * 255); - CVar_SetS32("gNavi_Idle_Inner_Red", Game::Settings.cosmetic.navi_idle_inner_red); - CVar_SetS32("gNavi_Idle_Inner_Green", Game::Settings.cosmetic.navi_idle_inner_green); - CVar_SetS32("gNavi_Idle_Inner_Blue", Game::Settings.cosmetic.navi_idle_inner_blue); - needs_save = true; - } - if (ImGui::ColorEdit3("Navi Idle Outer", navi_idle_o_col)) { - Game::Settings.cosmetic.navi_idle_outer_red = (int)(navi_idle_o_col[0] * 255); - Game::Settings.cosmetic.navi_idle_outer_green = (int)(navi_idle_o_col[1] * 255); - Game::Settings.cosmetic.navi_idle_outer_blue = (int)(navi_idle_o_col[2] * 255); - CVar_SetS32("gNavi_Idle_Outer_Red", Game::Settings.cosmetic.navi_idle_outer_red); - CVar_SetS32("gNavi_Idle_Outer_Green", Game::Settings.cosmetic.navi_idle_outer_green); - CVar_SetS32("gNavi_Idle_Outer_Blue", Game::Settings.cosmetic.navi_idle_outer_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi NPC Inner", navi_npc_i_col)) { - Game::Settings.cosmetic.navi_npc_inner_red = (int)(navi_npc_i_col[0] * 255); - Game::Settings.cosmetic.navi_npc_inner_green = (int)(navi_npc_i_col[1] * 255); - Game::Settings.cosmetic.navi_npc_inner_blue = (int)(navi_npc_i_col[2] * 255); - CVar_SetS32("gNavi_NPC_Inner_Red", Game::Settings.cosmetic.navi_npc_inner_red); - CVar_SetS32("gNavi_NPC_Inner_Green", Game::Settings.cosmetic.navi_npc_inner_green); - CVar_SetS32("gNavi_NPC_Inner_Blue", Game::Settings.cosmetic.navi_npc_inner_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi NPC Outer", navi_npc_o_col)) { - Game::Settings.cosmetic.navi_npc_outer_red = (int)(navi_npc_o_col[0] * 255); - Game::Settings.cosmetic.navi_npc_outer_green = (int)(navi_npc_o_col[1] * 255); - Game::Settings.cosmetic.navi_npc_outer_blue = (int)(navi_npc_o_col[2] * 255); - CVar_SetS32("gNavi_NPC_Outer_Red", Game::Settings.cosmetic.navi_npc_outer_red); - CVar_SetS32("gNavi_NPC_Outer_Green", Game::Settings.cosmetic.navi_npc_outer_green); - CVar_SetS32("gNavi_NPC_Outer_Blue", Game::Settings.cosmetic.navi_npc_outer_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi Enemy Inner", navi_enemy_i_col)) { - Game::Settings.cosmetic.navi_enemy_inner_red = (int)(navi_enemy_i_col[0] * 255); - Game::Settings.cosmetic.navi_enemy_inner_green = (int)(navi_enemy_i_col[1] * 255); - Game::Settings.cosmetic.navi_enemy_inner_blue = (int)(navi_enemy_i_col[2] * 255); - CVar_SetS32("gNavi_Enemy_Inner_Red", Game::Settings.cosmetic.navi_enemy_inner_red); - CVar_SetS32("gNavi_Enemy_Inner_Green", Game::Settings.cosmetic.navi_enemy_inner_green); - CVar_SetS32("gNavi_Enemy_Inner_Blue", Game::Settings.cosmetic.navi_enemy_inner_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi Enemy Outer", navi_enemy_o_col)) { - Game::Settings.cosmetic.navi_enemy_outer_red = (int)(navi_enemy_o_col[0] * 255); - Game::Settings.cosmetic.navi_enemy_outer_green = (int)(navi_enemy_o_col[1] * 255); - Game::Settings.cosmetic.navi_enemy_outer_blue = (int)(navi_enemy_o_col[2] * 255); - CVar_SetS32("gNavi_Enemy_Outer_Red", Game::Settings.cosmetic.navi_enemy_outer_red); - CVar_SetS32("gNavi_Enemy_Outer_Green", Game::Settings.cosmetic.navi_enemy_outer_green); - CVar_SetS32("gNavi_Enemy_Outer_Blue", Game::Settings.cosmetic.navi_enemy_outer_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi Prop Inner", navi_prop_i_col)) { - Game::Settings.cosmetic.navi_prop_inner_red = (int)(navi_prop_i_col[0] * 255); - Game::Settings.cosmetic.navi_prop_inner_green = (int)(navi_prop_i_col[1] * 255); - Game::Settings.cosmetic.navi_prop_inner_blue = (int)(navi_prop_i_col[2] * 255); - CVar_SetS32("gNavi_Prop_Inner_Red", Game::Settings.cosmetic.navi_prop_inner_red); - CVar_SetS32("gNavi_Prop_Inner_Green", Game::Settings.cosmetic.navi_prop_inner_green); - CVar_SetS32("gNavi_Prop_Inner_Blue", Game::Settings.cosmetic.navi_prop_inner_blue); - needs_save = true; - } - - if (ImGui::ColorEdit3("Navi Prop Outer", navi_prop_o_col)) { - Game::Settings.cosmetic.navi_prop_outer_red = (int)(navi_prop_o_col[0] * 255); - Game::Settings.cosmetic.navi_prop_outer_green = (int)(navi_prop_o_col[1] * 255); - Game::Settings.cosmetic.navi_prop_outer_blue = (int)(navi_prop_o_col[2] * 255); - CVar_SetS32("gNavi_Prop_Outer_Red", Game::Settings.cosmetic.navi_prop_outer_red); - CVar_SetS32("gNavi_Prop_Outer_Green", Game::Settings.cosmetic.navi_prop_outer_green); - CVar_SetS32("gNavi_Prop_Outer_Blue", Game::Settings.cosmetic.navi_prop_outer_blue); - 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)); - if (ImGui::Checkbox("Easy ISG", &Game::Settings.cheats.ez_isg)) { - CVar_SetS32("gEzISG", Game::Settings.cheats.ez_isg); - needs_save = true; - } - - if (ImGui::Checkbox("Unrestricted Items", &Game::Settings.cheats.no_restrict_item)) { - CVar_SetS32("gNoRestrictItems", Game::Settings.cheats.no_restrict_item); - needs_save = true; - } - - if (ImGui::Checkbox("Freeze Time", &Game::Settings.cheats.freeze_time)) { - CVar_SetS32("gFreezeTime", Game::Settings.cheats.freeze_time); - needs_save = true; - } + EnhancementColor3("Navi Idle Inner", "gNavi_Idle_Inner", navi_idle_i_col); + EnhancementColor3("Navi Idle Outer", "gNavi_Idle_Outer", navi_idle_o_col); + EnhancementColor3("Navi NPC Inner", "gNavi_NPC_Inner", navi_npc_i_col); + EnhancementColor3("Navi NPC Outer", "gNavi_NPC_Outer", navi_npc_o_col); + EnhancementColor3("Navi Enemy Inner", "gNavi_Enemy_Inner", navi_enemy_i_col); + EnhancementColor3("Navi Enemy Outer", "gNavi_Enemy_Outer", navi_enemy_o_col); + EnhancementColor3("Navi Prop Inner", "gNavi_Prop_Inner", navi_prop_i_col); + EnhancementColor3("Navi Prop Outer", "gNavi_Prop_Outer", navi_prop_o_col); ImGui::EndMenu(); } diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index f125437ab..69917e8ac 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -26,6 +26,7 @@ #include "../soh/Enhancements/debugger/debugger.h" #include "Utils/BitConverter.h" #include "variables.h" +#include OTRGlobals* OTRGlobals::Instance; @@ -888,8 +889,11 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) { } extern "C" int Controller_ShouldRumble(size_t i) { - for (const auto& controller : Ship::Window::Controllers.at(i)) { - if (controller->CanRumble() && Game::Settings.controller.extra[i].rumble_strength > 0.001f) { + for (const auto& controller : Ship::Window::Controllers.at(i)) + { + float rumble_strength = CVar_GetFloat(StringHelper::Sprintf("gCont%i_RumbleStrength", i).c_str(), 1.0f); + + if (controller->CanRumble() && rumble_strength > 0.001f) { return 1; } } diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 0251ee498..7f3507abd 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -744,24 +744,24 @@ void func_8008F470(GlobalContext* globalCtx, void** skeleton, Vec3s* jointTable, gSPSegment(POLY_OPA_DISP++, 0x09, SEGMENTED_TO_VIRTUAL(sMouthTextures[eyeIndex])); #endif if (tunic == PLAYER_TUNIC_KOKIRI) { - Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", &sTunicColors[PLAYER_TUNIC_KOKIRI].r), - CVar_GetS32("gTunic_Kokiri_Green", &sTunicColors[PLAYER_TUNIC_KOKIRI].g), - CVar_GetS32("gTunic_Kokiri_Blue", &sTunicColors[PLAYER_TUNIC_KOKIRI].b) }; + Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", sTunicColors[PLAYER_TUNIC_KOKIRI].r), + CVar_GetS32("gTunic_Kokiri_Green", sTunicColors[PLAYER_TUNIC_KOKIRI].g), + CVar_GetS32("gTunic_Kokiri_Blue", sTunicColors[PLAYER_TUNIC_KOKIRI].b) }; color = &sTemp; } else if (tunic == PLAYER_TUNIC_GORON) { - Color_RGB8 sTemp = { CVar_GetS32("gTunic_Goron_Red", &sTunicColors[PLAYER_TUNIC_GORON].r), - CVar_GetS32("gTunic_Goron_Green", &sTunicColors[PLAYER_TUNIC_GORON].g), - CVar_GetS32("gTunic_Goron_Blue", &sTunicColors[PLAYER_TUNIC_GORON].b) }; + Color_RGB8 sTemp = { CVar_GetS32("gTunic_Goron_Red", sTunicColors[PLAYER_TUNIC_GORON].r), + CVar_GetS32("gTunic_Goron_Green", sTunicColors[PLAYER_TUNIC_GORON].g), + CVar_GetS32("gTunic_Goron_Blue", sTunicColors[PLAYER_TUNIC_GORON].b) }; color = &sTemp; } else if (tunic == PLAYER_TUNIC_ZORA) { - Color_RGB8 sTemp = { CVar_GetS32("gTunic_Zora_Red", &sTunicColors[PLAYER_TUNIC_ZORA].r), - CVar_GetS32("gTunic_Zora_Green", &sTunicColors[PLAYER_TUNIC_ZORA].g), - CVar_GetS32("gTunic_Zora_Blue", &sTunicColors[PLAYER_TUNIC_ZORA].b) }; + Color_RGB8 sTemp = { CVar_GetS32("gTunic_Zora_Red", sTunicColors[PLAYER_TUNIC_ZORA].r), + CVar_GetS32("gTunic_Zora_Green", sTunicColors[PLAYER_TUNIC_ZORA].g), + CVar_GetS32("gTunic_Zora_Blue", sTunicColors[PLAYER_TUNIC_ZORA].b) }; color = &sTemp; } else { - Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", &sTunicColors[PLAYER_TUNIC_KOKIRI].r), - CVar_GetS32("gTunic_Kokiri_Green", &sTunicColors[PLAYER_TUNIC_KOKIRI].g), - CVar_GetS32("gTunic_Kokiri_Blue", &sTunicColors[PLAYER_TUNIC_KOKIRI].b) }; + Color_RGB8 sTemp = { CVar_GetS32("gTunic_Kokiri_Red", sTunicColors[PLAYER_TUNIC_KOKIRI].r), + CVar_GetS32("gTunic_Kokiri_Green", sTunicColors[PLAYER_TUNIC_KOKIRI].g), + CVar_GetS32("gTunic_Kokiri_Blue", sTunicColors[PLAYER_TUNIC_KOKIRI].b) }; color = &sTemp; } gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0);