diff --git a/BUILDING.md b/BUILDING.md index 5e4836d8e..32e682705 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -60,7 +60,7 @@ To build you'll need to follow the instructions from the building section. _Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._ -_Experimental: You can also use another build system entirely rathen than MSVC like [Ninja](https://ninja-build.org/) for possibly better performance._ +_Experimental: You can also use another build system entirely rather than MSVC like [Ninja](https://ninja-build.org/) for possibly better performance._ ### Generating the distributable diff --git a/CMakeLists.txt b/CMakeLists.txt index 38739bc8c..5ad05e72f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -195,6 +195,11 @@ install(DIRECTORY ${CMAKE_BINARY_DIR}/assets PERMISSIONS ${PROGRAM_PERMISSIONS_EXECUTE} ) +install(CODE " + include(BundleUtilities) + fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/soh-macos\" \"\" \"${dirs}\") + ") + endif() if(CMAKE_SYSTEM_NAME MATCHES "Windows|NintendoSwitch|CafeOS") diff --git a/ZAPDTR/ZAPDUtils/Vec3f.h b/ZAPDTR/ZAPDUtils/Vec3f.h index d6e9c5568..844b1522c 100644 --- a/ZAPDTR/ZAPDUtils/Vec3f.h +++ b/ZAPDTR/ZAPDUtils/Vec3f.h @@ -1,7 +1,5 @@ #pragma once -#include - struct Vec3f { float x, y, z; diff --git a/libultraship/libultraship/Archive.h b/libultraship/libultraship/Archive.h index 0eeaa4021..1cd6fb78e 100644 --- a/libultraship/libultraship/Archive.h +++ b/libultraship/libultraship/Archive.h @@ -10,7 +10,6 @@ #include #include #include "Resource.h" -//#include "Lib/StrHash64.h" #include "StormLib.h" diff --git a/libultraship/libultraship/CMakeLists.txt b/libultraship/libultraship/CMakeLists.txt index 49c6ff9b4..8f365162d 100644 --- a/libultraship/libultraship/CMakeLists.txt +++ b/libultraship/libultraship/CMakeLists.txt @@ -133,8 +133,6 @@ source_group("Source Files\\CustomImpl\\Utils" FILES ${Source_Files__CustomImpl_ set(Source_Files__Globals "Cvar.cpp" "Cvar.h" - "GlobalCtx2.cpp" - "GlobalCtx2.h" "LUSMacros.h" "Window.cpp" "Window.h" @@ -569,6 +567,10 @@ target_include_directories(${PROJECT_NAME} PRIVATE if(MSVC) if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") target_compile_options(${PROJECT_NAME} PRIVATE + $<$: + /Od; + /Oi- + > $<$: /std:c++latest; /Oi; diff --git a/libultraship/libultraship/Console.cpp b/libultraship/libultraship/Console.cpp index 79064838e..846e6e0a0 100644 --- a/libultraship/libultraship/Console.cpp +++ b/libultraship/libultraship/Console.cpp @@ -1,12 +1,12 @@ #include "Console.h" #include "Cvar.h" -#include "GlobalCtx2.h" #include "ImGuiImpl.h" #include "Lib/ImGui/imgui.h" #include "Utils/StringHelper.h" #include "Lib/ImGui/imgui_internal.h" #include "Utils.h" +#include namespace Ship { std::string BuildUsage(const CommandEntry& entry) { diff --git a/libultraship/libultraship/Console.h b/libultraship/libultraship/Console.h index f0b78aac9..4f846a2c5 100644 --- a/libultraship/libultraship/Console.h +++ b/libultraship/libultraship/Console.h @@ -6,8 +6,6 @@ #include #include "Lib/ImGui/imgui.h" -#define NOGDI -#define WIN32_LEAN_AND_MEAN #include "spdlog/spdlog.h" namespace Ship { diff --git a/libultraship/libultraship/ControlDeck.cpp b/libultraship/libultraship/ControlDeck.cpp index 36e581fc7..7c4708ab2 100644 --- a/libultraship/libultraship/ControlDeck.cpp +++ b/libultraship/libultraship/ControlDeck.cpp @@ -96,7 +96,7 @@ namespace Ship { #define NESTED(key, ...) StringHelper::Sprintf("Controllers.%s.Slot_%d." key, device->GetGuid().c_str(), virtualSlot, __VA_ARGS__) void ControlDeck::LoadControllerSettings() { - std::shared_ptr Config = GlobalCtx2::GetInstance()->GetConfig(); + std::shared_ptr Config = Window::GetInstance()->GetConfig(); for (auto const& val : Config->rjson["Controllers"]["Deck"].items()) { int32_t slot = std::stoi(val.key().substr(5)); @@ -182,7 +182,7 @@ namespace Ship { } void ControlDeck::SaveControllerSettings() { - std::shared_ptr Config = GlobalCtx2::GetInstance()->GetConfig(); + std::shared_ptr Config = Window::GetInstance()->GetConfig(); for (size_t i = 0; i < virtualDevices.size(); i++) { std::shared_ptr backend = physicalDevices[virtualDevices[i]]; diff --git a/libultraship/libultraship/Cvar.cpp b/libultraship/libultraship/Cvar.cpp index 242b4c913..42be25619 100644 --- a/libultraship/libultraship/Cvar.cpp +++ b/libultraship/libultraship/Cvar.cpp @@ -5,7 +5,7 @@ #include #include #include -#include "GlobalCtx2.h" +#include "Window.h" std::map, std::less<>> cvars; @@ -144,7 +144,7 @@ template bool is_number(const std::string& s) { } void CVar_LoadLegacy() { - auto cvarsConfig = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("cvars.cfg"); + auto cvarsConfig = Ship::Window::GetPathRelativeToAppDirectory("cvars.cfg"); if (File::Exists(cvarsConfig)) { const auto lines = File::ReadAllLines(cvarsConfig); @@ -191,7 +191,7 @@ void CVar_LoadLegacy() { extern "C" void CVar_Load() { - std::shared_ptr pConf = Ship::GlobalCtx2::GetInstance()->GetConfig(); + std::shared_ptr pConf = Ship::Window::GetInstance()->GetConfig(); pConf->reload(); for (const auto& item : pConf->rjson["CVars"].items()) { @@ -235,7 +235,7 @@ extern "C" void CVar_Load() { extern "C" void CVar_Save() { - std::shared_ptr pConf = Ship::GlobalCtx2::GetInstance()->GetConfig(); + std::shared_ptr pConf = Ship::Window::GetInstance()->GetConfig(); for (const auto& cvar : cvars) { const std::string key = StringHelper::Sprintf("CVars.%s", cvar.first.c_str()); diff --git a/libultraship/libultraship/File.h b/libultraship/libultraship/File.h index b5d484d2d..03f08c80f 100644 --- a/libultraship/libultraship/File.h +++ b/libultraship/libultraship/File.h @@ -2,7 +2,8 @@ #include #include -#include "GlobalCtx2.h" +#include +#include namespace Ship { class Archive; diff --git a/libultraship/libultraship/GameOverlay.cpp b/libultraship/libultraship/GameOverlay.cpp index e4a160a50..b5225e22e 100644 --- a/libultraship/libultraship/GameOverlay.cpp +++ b/libultraship/libultraship/GameOverlay.cpp @@ -45,7 +45,7 @@ namespace Ship { void GameOverlay::LoadFont(const std::string& name, const std::string& path, float fontSize) { ImGuiIO& io = ImGui::GetIO(); - std::shared_ptr base = GlobalCtx2::GetInstance()->GetResourceManager()->GetArchive(); + std::shared_ptr base = Window::GetInstance()->GetResourceManager()->GetArchive(); std::shared_ptr font = std::make_shared(); base->LoadFile(path, false, font); if (font->bIsLoaded) { diff --git a/libultraship/libultraship/GlobalCtx2.cpp b/libultraship/libultraship/GlobalCtx2.cpp deleted file mode 100644 index 148a062ef..000000000 --- a/libultraship/libultraship/GlobalCtx2.cpp +++ /dev/null @@ -1,149 +0,0 @@ -#include "GlobalCtx2.h" -#include -#include -#include "ResourceMgr.h" -#include "Window.h" -#include "spdlog/async.h" -#include "spdlog/sinks/rotating_file_sink.h" -#include "spdlog/sinks/stdout_color_sinks.h" -#include "spdlog/sinks/sohconsole_sink.h" -#ifdef __APPLE__ -#include "OSXFolderManager.h" -#elif defined(__SWITCH__) -#include "SwitchImpl.h" -#elif defined(__WIIU__) -#include "WiiUImpl.h" -#endif - -namespace Ship { - std::weak_ptr GlobalCtx2::Context; - std::shared_ptr GlobalCtx2::GetInstance() { - return Context.lock(); - } - - std::shared_ptr GlobalCtx2::CreateInstance(const std::string& Name) { - if (Context.expired()) { - auto Shared = std::make_shared(Name); - Context = Shared; - Shared->InitWindow(); - return Shared; - } else { - SPDLOG_DEBUG("Trying to create a context when it already exists."); - } - - return GetInstance(); - } - - std::string GlobalCtx2::GetAppDirectoryPath() { - #ifdef __APPLE__ - FolderManager folderManager; - std::string fpath = std::string(folderManager.pathForDirectory(NSApplicationSupportDirectory, NSUserDomainMask)); - fpath.append("/com.shipofharkinian.soh"); - return fpath; - #endif - - return "."; - - } - - std::string GlobalCtx2::GetPathRelativeToAppDirectory(const char* path) { - return GlobalCtx2::GetAppDirectoryPath() + "/" + path; - } - - GlobalCtx2::GlobalCtx2(std::string Name) : Name(std::move(Name)) { - - } - - GlobalCtx2::~GlobalCtx2() { - SPDLOG_INFO("destruct GlobalCtx2"); - } - - void GlobalCtx2::InitWindow() { - InitLogging(); - Config = std::make_shared(GetPathRelativeToAppDirectory("shipofharkinian.json")); - - MainPath = Config->getString("Game.Main Archive", GetPathRelativeToAppDirectory("oot.otr")); - PatchesPath = Config->getString("Game.Patches Archive", GetAppDirectoryPath() + "/mods"); - - ResMan = std::make_shared(GetInstance(), MainPath, PatchesPath); - Win = std::make_shared(GetInstance()); - - if (!ResMan->DidLoadSuccessfully()) - { -#ifdef _WIN32 - MessageBox(nullptr, L"Main OTR file not found!", L"Uh oh", MB_OK); -#elif defined(__SWITCH__) - printf("Main OTR file not found!\n"); -#elif defined(__WIIU__) - Ship::WiiU::ThrowMissingOTR(MainPath.c_str()); -#else - SPDLOG_ERROR("Main OTR file not found!"); -#endif - exit(1); - } - #ifdef __SWITCH__ - Ship::Switch::Init(PostInitPhase); - #endif - } - - void GlobalCtx2::InitLogging() { - try { - // Setup Logging - spdlog::init_thread_pool(8192, 1); - std::vector Sinks; - - auto SohConsoleSink = std::make_shared(); - SohConsoleSink->set_level(spdlog::level::trace); - Sinks.push_back(SohConsoleSink); - -#if (!defined(_WIN32) && !defined(__WIIU__)) || defined(_DEBUG) - auto ConsoleSink = std::make_shared(); - ConsoleSink->set_level(spdlog::level::trace); - Sinks.push_back(ConsoleSink); -#endif - -#ifndef __WIIU__ - auto logPath = GetPathRelativeToAppDirectory(("logs/" + GetName() + ".log").c_str()); - auto FileSink = std::make_shared(logPath, 1024 * 1024 * 10, 10); - FileSink->set_level(spdlog::level::trace); - Sinks.push_back(FileSink); -#endif - - Logger = std::make_shared(GetName(), Sinks.begin(), Sinks.end(), spdlog::thread_pool(), spdlog::async_overflow_policy::block); - GetLogger()->set_level(spdlog::level::trace); - -#ifndef __WIIU__ - GetLogger()->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%@] [%l] %v"); -#else - GetLogger()->set_pattern("[%s:%#] [%l] %v"); -#endif - - spdlog::register_logger(GetLogger()); - spdlog::set_default_logger(GetLogger()); - } - catch (const spdlog::spdlog_ex& ex) { - std::cout << "Log initialization failed: " << ex.what() << std::endl; - } - } - - void GlobalCtx2::WriteSaveFile(const std::filesystem::path& savePath, const uintptr_t addr, void* dramAddr, const size_t size) { - std::ofstream saveFile = std::ofstream(savePath, std::fstream::in | std::fstream::out | std::fstream::binary); - saveFile.seekp(addr); - saveFile.write((char*)dramAddr, size); - saveFile.close(); - } - - void GlobalCtx2::ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size) { - std::ifstream saveFile = std::ifstream(savePath, std::fstream::in | std::fstream::out | std::fstream::binary); - - // If the file doesn't exist, initialize DRAM - if (saveFile.good()) { - saveFile.seekg(addr); - saveFile.read((char*)dramAddr, size); - } else { - memset(dramAddr, 0, size); - } - - saveFile.close(); - } -} diff --git a/libultraship/libultraship/GlobalCtx2.h b/libultraship/libultraship/GlobalCtx2.h deleted file mode 100644 index 21402070d..000000000 --- a/libultraship/libultraship/GlobalCtx2.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef GLOBAL_CTX_2 -#define GLOBAL_CTX_2 - -#pragma once - -#ifdef __cplusplus -#include -#include -#include -#include "spdlog/spdlog.h" -#include "Lib/Mercury/Mercury.h" - -namespace Ship { - class ResourceMgr; - class Window; - - class GlobalCtx2 { - public: - static std::shared_ptr GetInstance(); - static std::shared_ptr CreateInstance(const std::string& Name); - - std::string GetName() { return Name; } - std::shared_ptr GetWindow() { return Win; } - std::shared_ptr GetResourceManager() { return ResMan; } - std::shared_ptr GetLogger() { return Logger; } - std::shared_ptr GetConfig() { return Config; } - - static std::string GetAppDirectoryPath(); - static std::string GetPathRelativeToAppDirectory(const char* path); - - void WriteSaveFile(const std::filesystem::path& savePath, uintptr_t addr, void* dramAddr, size_t size); - void ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size); - - GlobalCtx2(std::string Name); - ~GlobalCtx2(); - - protected: - void InitWindow(); - void InitLogging(); - - private: - static std::weak_ptr Context; - std::shared_ptr Logger; - std::shared_ptr Win; - std::shared_ptr Config; // Config needs to be after the Window because we call the Window during it's destructor. - std::shared_ptr ResMan; - std::string Name; - std::string MainPath; - std::string PatchesPath; - }; -} -#endif - -#endif diff --git a/libultraship/libultraship/ImGuiImpl.cpp b/libultraship/libultraship/ImGuiImpl.cpp index cac675a93..60a89def5 100644 --- a/libultraship/libultraship/ImGuiImpl.cpp +++ b/libultraship/libultraship/ImGuiImpl.cpp @@ -18,7 +18,6 @@ #include "Hooks.h" #define IMGUI_DEFINE_MATH_OPERATORS #include "Lib/ImGui/imgui_internal.h" -#include "GlobalCtx2.h" #include "ResourceMgr.h" #include "Window.h" #include "Cvar.h" @@ -42,8 +41,10 @@ #if __APPLE__ #include +#include #else #include +#include #endif #ifdef __SWITCH__ @@ -164,8 +165,14 @@ namespace SohImGui { } else { console->Close(); } - SohImGui::controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0); - UpdateAudio(); + + if (CVar_GetS32("gControllerConfigurationEnabled", 0)) { + controller->Open(); + } else { + controller->Close(); + } + + UpdateAudio(); }); } @@ -338,6 +345,8 @@ namespace SohImGui { switch (impl.backend) { case Backend::DX11: return true; + case Backend::SDL: + return true; default: return false; } @@ -345,27 +354,27 @@ namespace SohImGui { void ShowCursor(bool hide, Dialogues d) { if (d == Dialogues::dLoadSettings) { - GlobalCtx2::GetInstance()->GetWindow()->ShowCursor(hide); + Window::GetInstance()->ShowCursor(hide); return; } if (d == Dialogues::dConsole && CVar_GetS32("gOpenMenuBar", 0)) { return; } - if (!GlobalCtx2::GetInstance()->GetWindow()->IsFullscreen()) { + if (!Window::GetInstance()->IsFullscreen()) { oldCursorState = false; return; } if (oldCursorState != hide) { oldCursorState = hide; - GlobalCtx2::GetInstance()->GetWindow()->ShowCursor(hide); + Window::GetInstance()->ShowCursor(hide); } } void LoadTexture(const std::string& name, const std::string& path) { GfxRenderingAPI* api = gfx_get_current_rendering_api(); - const auto res = GlobalCtx2::GetInstance()->GetResourceManager()->LoadFile(path); + const auto res = Window::GetInstance()->GetResourceManager()->LoadFile(path); const auto asset = new GameAsset{ api->new_texture() }; uint8_t* img_data = stbi_load_from_memory(reinterpret_cast(res->buffer.get()), res->dwBufferSize, &asset->width, &asset->height, nullptr, 4); @@ -401,7 +410,7 @@ namespace SohImGui { void LoadResource(const std::string& name, const std::string& path, const ImVec4& tint) { GfxRenderingAPI* api = gfx_get_current_rendering_api(); - const auto res = static_cast(GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(path).get()); + const auto res = static_cast(Window::GetInstance()->GetResourceManager()->LoadResource(path).get()); std::vector texBuffer; texBuffer.reserve(res->width * res->height * 4); @@ -466,7 +475,7 @@ namespace SohImGui { io->DisplaySize.y = window_impl.gx2.height; #endif - lastBackendID = GetBackendID(GlobalCtx2::GetInstance()->GetConfig()); + lastBackendID = GetBackendID(Window::GetInstance()->GetConfig()); if (CVar_GetS32("gOpenMenuBar", 0) != 1) { #if defined(__SWITCH__) || defined(__WIIU__) SohImGui::overlay->TextDrawNotification(30.0f, true, "Press - to access enhancements menu"); @@ -475,8 +484,8 @@ namespace SohImGui { #endif } - auto imguiIniPath = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("imgui.ini"); - auto imguiLogPath = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("imgui_log.txt"); + auto imguiIniPath = Ship::Window::GetPathRelativeToAppDirectory("imgui.ini"); + auto imguiLogPath = Ship::Window::GetPathRelativeToAppDirectory("imgui_log.txt"); io->IniFilename = strcpy(new char[imguiIniPath.length() + 1], imguiIniPath.c_str()); io->LogFilename = strcpy(new char[imguiLogPath.length() + 1], imguiLogPath.c_str()); @@ -500,7 +509,7 @@ namespace SohImGui { #endif Ship::RegisterHook([] { - if (GlobalCtx2::GetInstance()->GetWindow()->IsFullscreen()) + if (Window::GetInstance()->IsFullscreen()) ShowCursor(CVar_GetS32("gOpenMenuBar", 0), Dialogues::dLoadSettings); LoadTexture("Game_Icon", "assets/ship_of_harkinian/icons/gSohIcon.png"); @@ -600,13 +609,101 @@ namespace SohImGui { ImGui::Text("%s", text); } - void EnhancementCheckbox(const char* text, const char* cvarName) + void RenderCross(ImDrawList* draw_list, ImVec2 pos, ImU32 col, float sz) { + float thickness = ImMax(sz / 5.0f, 1.0f); + sz -= thickness * 0.5f; + pos += ImVec2(thickness * 0.25f, thickness * 0.25f); + + draw_list->PathLineTo(ImVec2(pos.x, pos.y)); + draw_list->PathLineTo(ImVec2(pos.x + sz, pos.y + sz)); + draw_list->PathStroke(col, 0, thickness); + + draw_list->PathLineTo(ImVec2(pos.x + sz, pos.y)); + draw_list->PathLineTo(ImVec2(pos.x, pos.y + sz)); + draw_list->PathStroke(col, 0, thickness); + } + + bool CustomCheckbox(const char* label, bool* v, bool disabled, ImGuiCheckboxGraphics disabledGraphic) { + ImGuiWindow* window = ImGui::GetCurrentWindow(); + if (window->SkipItems) + return false; + + ImGuiContext& g = *GImGui; + const ImGuiStyle& style = g.Style; + const ImGuiID id = window->GetID(label); + const ImVec2 label_size = ImGui::CalcTextSize(label, NULL, true); + + const float square_sz = ImGui::GetFrameHeight(); + const ImVec2 pos = window->DC.CursorPos; + const ImRect total_bb(pos, pos + ImVec2(square_sz + (label_size.x > 0.0f ? style.ItemInnerSpacing.x + label_size.x : 0.0f), label_size.y + style.FramePadding.y * 2.0f)); + ImGui::ItemSize(total_bb, style.FramePadding.y); + if (!ImGui::ItemAdd(total_bb, id)) + { + IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0)); + return false; + } + + bool hovered, held; + bool pressed = ImGui::ButtonBehavior(total_bb, id, &hovered, &held); + if (pressed) + { + *v = !(*v); + ImGui::MarkItemEdited(id); + } + + const ImRect check_bb(pos, pos + ImVec2(square_sz, square_sz)); + ImGui::RenderNavHighlight(total_bb, id); + ImGui::RenderFrame(check_bb.Min, check_bb.Max, ImGui::GetColorU32((held && hovered) ? ImGuiCol_FrameBgActive : hovered ? ImGuiCol_FrameBgHovered : ImGuiCol_FrameBg), true, style.FrameRounding); + ImU32 check_col = ImGui::GetColorU32(ImGuiCol_CheckMark); + ImU32 cross_col = ImGui::GetColorU32(ImVec4(0.50f, 0.50f, 0.50f, 1.00f)); + bool mixed_value = (g.LastItemData.InFlags & ImGuiItemFlags_MixedValue) != 0; + if (mixed_value) + { + // Undocumented tristate/mixed/indeterminate checkbox (#2644) + // This may seem awkwardly designed because the aim is to make ImGuiItemFlags_MixedValue supported by all widgets (not just checkbox) + ImVec2 pad(ImMax(1.0f, IM_FLOOR(square_sz / 3.6f)), ImMax(1.0f, IM_FLOOR(square_sz / 3.6f))); + window->DrawList->AddRectFilled(check_bb.Min + pad, check_bb.Max - pad, check_col, style.FrameRounding); + } + else if ((!disabled && *v) || (disabled && disabledGraphic == ImGuiCheckboxGraphics::Checkmark)) + { + const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f)); + ImGui::RenderCheckMark(window->DrawList, check_bb.Min + ImVec2(pad, pad), check_col, square_sz - pad * 2.0f); + } + else if (disabled && disabledGraphic == ImGuiCheckboxGraphics::Cross) { + const float pad = ImMax(1.0f, IM_FLOOR(square_sz / 6.0f)); + RenderCross(window->DrawList, check_bb.Min + ImVec2(pad, pad), cross_col, square_sz - pad * 2.0f); + } + + ImVec2 label_pos = ImVec2(check_bb.Max.x + style.ItemInnerSpacing.x, check_bb.Min.y + style.FramePadding.y); + if (g.LogEnabled) + ImGui::LogRenderedText(&label_pos, mixed_value ? "[~]" : *v ? "[x]" : "[ ]"); + if (label_size.x > 0.0f) + ImGui::RenderText(label_pos, label); + + IMGUI_TEST_ENGINE_ITEM_INFO(id, label, g.LastItemData.StatusFlags | ImGuiItemStatusFlags_Checkable | (*v ? ImGuiItemStatusFlags_Checked : 0)); + return pressed; + } + + void EnhancementCheckbox(const char* text, const char* cvarName, bool disabled, const char* disabledTooltipText, ImGuiCheckboxGraphics disabledGraphic) + { + if (disabled) { + ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true); + ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f); + } bool val = (bool)CVar_GetS32(cvarName, 0); - if (ImGui::Checkbox(text, &val)) { + if (CustomCheckbox(text, &val, disabled, disabledGraphic)) { CVar_SetS32(cvarName, val); needs_save = true; } + + if (disabled) { + ImGui::PopStyleVar(1); + if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && disabledTooltipText != "") { + ImGui::SetTooltip("%s", disabledTooltipText); + } + ImGui::PopItemFlag(); + } } void EnhancementButton(const char* text, const char* cvarName) @@ -753,12 +850,7 @@ namespace SohImGui { } void RandomizeColor(const char* cvarName, ImVec4* colors) { - std::string Cvar_Red = cvarName; - Cvar_Red += "R"; - std::string Cvar_Green = cvarName; - Cvar_Green += "G"; - std::string Cvar_Blue = cvarName; - Cvar_Blue += "B"; + Color_RGBA8 NewColors = {0,0,0,255}; std::string Cvar_RBM = cvarName; Cvar_RBM += "RBM"; std::string MakeInvisible = "##"; @@ -773,9 +865,10 @@ namespace SohImGui { colors->x = (float)RND_R / 255; colors->y = (float)RND_G / 255; colors->z = (float)RND_B / 255; - CVar_SetS32(Cvar_Red.c_str(), ClampFloatToInt(colors->x * 255, 0, 255)); - CVar_SetS32(Cvar_Green.c_str(), ClampFloatToInt(colors->y * 255, 0, 255)); - CVar_SetS32(Cvar_Blue.c_str(), ClampFloatToInt(colors->z * 255, 0, 255)); + NewColors.r = ClampFloatToInt(colors->x * 255, 0, 255); + NewColors.g = ClampFloatToInt(colors->y * 255, 0, 255); + NewColors.b = ClampFloatToInt(colors->z * 255, 0, 255); + CVar_SetRGBA(cvarName, NewColors); CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode. needs_save = true; } @@ -802,16 +895,16 @@ namespace SohImGui { MakeInvisible += cvarName; MakeInvisible += "Reset"; if (ImGui::Button(MakeInvisible.c_str())) { - colors->x = defaultcolors.x / 255; - colors->y = defaultcolors.y / 255; - colors->z = defaultcolors.z / 255; - if (has_alpha) { colors->w = defaultcolors.w / 255; }; + colors->x = defaultcolors.x; + colors->y = defaultcolors.y; + colors->z = defaultcolors.z; + if (has_alpha) { colors->w = defaultcolors.w; }; Color_RGBA8 colorsRGBA; - colorsRGBA.r = defaultcolors.x / 255; - colorsRGBA.g = defaultcolors.y / 255; - colorsRGBA.b = defaultcolors.z / 255; - if (has_alpha) { colorsRGBA.a = defaultcolors.w / 255; }; + colorsRGBA.r = defaultcolors.x; + colorsRGBA.g = defaultcolors.y; + colorsRGBA.b = defaultcolors.z; + if (has_alpha) { colorsRGBA.a = defaultcolors.w; }; CVar_SetRGBA(cvarName, colorsRGBA); CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode. @@ -883,8 +976,8 @@ namespace SohImGui { ImGuiWMNewFrame(); ImGui::NewFrame(); - const std::shared_ptr wnd = GlobalCtx2::GetInstance()->GetWindow(); - const std::shared_ptr pConf = GlobalCtx2::GetInstance()->GetConfig(); + const std::shared_ptr wnd = Window::GetInstance(); + const std::shared_ptr pConf = Window::GetInstance()->GetConfig(); ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | @@ -921,9 +1014,9 @@ namespace SohImGui { bool menu_bar = CVar_GetS32("gOpenMenuBar", 0); CVar_SetS32("gOpenMenuBar", !menu_bar); needs_save = true; - GlobalCtx2::GetInstance()->GetWindow()->SetMenuBar(menu_bar); + Window::GetInstance()->SetMenuBar(menu_bar); ShowCursor(menu_bar, Dialogues::dMenubar); - GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->SaveControllerSettings(); + Window::GetInstance()->GetControlDeck()->SaveControllerSettings(); if (CVar_GetS32("gControlNav", 0) && CVar_GetS32("gOpenMenuBar", 0)) { io->ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad | ImGuiConfigFlags_NavEnableKeyboard; } else { @@ -1009,7 +1102,11 @@ namespace SohImGui { bool currentValue = CVar_GetS32("gControllerConfigurationEnabled", 0); CVar_SetS32("gControllerConfigurationEnabled", !currentValue); needs_save = true; - controller->Opened = CVar_GetS32("gControllerConfigurationEnabled", 0); + if (CVar_GetS32("gControllerConfigurationEnabled", 0)) { + controller->Open(); + } else { + controller->Close(); + } } ImGui::PopStyleColor(1); ImGui::PopStyleVar(3); @@ -1214,6 +1311,8 @@ namespace SohImGui { Tooltip("The default response to Kaepora Gaebora is always that you understood what he said"); PaddedEnhancementCheckbox("Fast Ocarina Playback", "gFastOcarinaPlayback", true, false); Tooltip("Skip the part where the Ocarina playback is called when you play a song"); + PaddedEnhancementCheckbox("Skip Scarecrow Song", "gSkipScarecrow", true, false); + Tooltip("Pierre appears when Ocarina is pulled out. Requires learning scarecrow song."); PaddedEnhancementCheckbox("Instant Putaway", "gInstantPutaway", true, false); Tooltip("Allow Link to put items away without having to wait around"); PaddedEnhancementCheckbox("Instant Boomerang Recall", "gFastBoomerang", true, false); @@ -1268,6 +1367,8 @@ namespace SohImGui { ); PaddedEnhancementCheckbox("No Random Drops", "gNoRandomDrops", true, false); Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses"); + PaddedEnhancementCheckbox("Enable Bombchu Drops", "gBombchuDrops", true, false); + Tooltip("Bombchus will sometimes drop in place of bombs"); PaddedEnhancementCheckbox("No Heart Drops", "gNoHeartDrops", true, false); Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off\nThis simulates Hero Mode from other games in the series"); PaddedEnhancementCheckbox("Always Win Goron Pot", "gGoronPot", true, false); @@ -1502,6 +1603,7 @@ namespace SohImGui { Tooltip("Restores N64 Weird Frames allowing weirdshots to behave the same as N64"); PaddedEnhancementCheckbox("Bombchus out of bounds", "gBombchusOOB", true, false); Tooltip("Allows bombchus to explode out of bounds\nSimilar to GameCube and Wii VC"); + PaddedEnhancementCheckbox("Restore old Gold Skulltula cutscene", "gGsCutscene", true, false); ImGui::EndMenu(); } @@ -2157,6 +2259,8 @@ namespace SohImGui { CVar_SetS32("gNoRandomDrops", 0); // No Heart Drops CVar_SetS32("gNoHeartDrops", 0); + // Enable Bombchu Drops + CVar_SetS32("gBombchuDrops", 0); // Always Win Goron Pot CVar_SetS32("gGoronPot", 0); @@ -2288,6 +2392,7 @@ namespace SohImGui { // Bombchus out of bounds CVar_SetS32("gBombchusOOB", 0); + CVar_SetS32("gGsCutscene", 0); // Autosave CVar_SetS32("gAutosave", 0); } @@ -2407,6 +2512,8 @@ namespace SohImGui { CVar_SetS32("gVisualAgony", 1); // Pull grave during the day CVar_SetS32("gDayGravePull", 1); + // Pull out Ocarina to Summon Scarecrow + CVar_SetS32("gSkipScarecrow", 0); // Pause link animation (0 to 16) CVar_SetS32("gPauseLiveLink", 16); @@ -2418,8 +2525,18 @@ namespace SohImGui { ImGui::Render(); ImGuiRenderDrawData(ImGui::GetDrawData()); if (UseViewports()) { - ImGui::UpdatePlatformWindows(); - ImGui::RenderPlatformWindowsDefault(); + if (impl.backend == Backend::SDL) { + SDL_Window* backup_current_window = SDL_GL_GetCurrentWindow(); + SDL_GLContext backup_current_context = SDL_GL_GetCurrentContext(); + + ImGui::UpdatePlatformWindows(); + ImGui::RenderPlatformWindowsDefault(); + + SDL_GL_MakeCurrent(backup_current_window, backup_current_context); + } else { + ImGui::UpdatePlatformWindows(); + ImGui::RenderPlatformWindowsDefault(); + } } } @@ -2650,11 +2767,11 @@ namespace SohImGui { } } - void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop, bool padBottom) { + void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop, bool padBottom, bool disabled, const char* disabledTooltipText, ImGuiCheckboxGraphics disabledGraphic) { if (padTop) { ImGui::Dummy(ImVec2(0.0f, 0.0f)); } - EnhancementCheckbox(text, cvarName); + EnhancementCheckbox(text, cvarName, disabled, disabledTooltipText, disabledGraphic); if (padBottom) { ImGui::Dummy(ImVec2(0.0f, 0.0f)); } diff --git a/libultraship/libultraship/ImGuiImpl.h b/libultraship/libultraship/ImGuiImpl.h index 3d6c6e4f9..733e9d1cf 100644 --- a/libultraship/libultraship/ImGuiImpl.h +++ b/libultraship/libultraship/ImGuiImpl.h @@ -34,6 +34,14 @@ namespace SohImGui { dLoadSettings, }; + // Enumeration for disabled checkbox graphics + enum class ImGuiCheckboxGraphics + { + Cross, + Checkmark, + None + }; + typedef struct { Backend backend; union { @@ -86,7 +94,7 @@ namespace SohImGui { void Tooltip(const char* text); void EnhancementRadioButton(const char* text, const char* cvarName, int id); - void EnhancementCheckbox(const char* text, const char* cvarName); + void EnhancementCheckbox(const char* text, const char* cvarName, bool disabled = false, const char* disabledTooltipText = "", ImGuiCheckboxGraphics disabledGraphic = ImGuiCheckboxGraphics::Cross); void EnhancementButton(const char* text, const char* cvarName); void EnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false); void EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage, bool PlusMinusButton = false); @@ -123,7 +131,7 @@ namespace SohImGui { void InsertPadding(float extraVerticalPadding = 0.0f); void PaddedSeparator(bool padTop = true, bool padBottom = true, float extraVerticalTopPadding = 0.0f, float extraVerticalBottomPadding = 0.0f); void PaddedEnhancementSliderInt(const char* text, const char* id, const char* cvarName, int min, int max, const char* format, int defaultValue = 0, bool PlusMinusButton = false, bool padTop = true, bool padBottom = true); - void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop = true, bool padBottom = true); + void PaddedEnhancementCheckbox(const char* text, const char* cvarName, bool padTop = true, bool padBottom = true, bool disabled = false, const char* disabledTooltipText = "", ImGuiCheckboxGraphics disabledGraphic = ImGuiCheckboxGraphics::Cross); void PaddedText(const char* text, bool padTop = true, bool padBottom = true); std::string GetWindowButtonText(const char* text, bool menuOpen); } diff --git a/libultraship/libultraship/InputEditor.cpp b/libultraship/libultraship/InputEditor.cpp index 7fc7bc404..156eafae3 100644 --- a/libultraship/libultraship/InputEditor.cpp +++ b/libultraship/libultraship/InputEditor.cpp @@ -16,11 +16,11 @@ namespace Ship { } std::shared_ptr GetControllerPerSlot(int slot) { - auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + auto controlDeck = Ship::Window::GetInstance()->GetControlDeck(); return controlDeck->GetPhysicalDeviceFromVirtualSlot(slot); } - void InputEditor::DrawButton(const char* label, int n64Btn) { + void InputEditor::DrawButton(const char* label, int32_t n64Btn) { const std::shared_ptr backend = GetControllerPerSlot(CurrentPort); float size = 40; @@ -85,7 +85,7 @@ namespace Ship { } void InputEditor::DrawControllerSchema() { - auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + auto controlDeck = Ship::Window::GetInstance()->GetControlDeck(); auto Backend = controlDeck->GetPhysicalDeviceFromVirtualSlot(CurrentPort); auto profile = Backend->getProfile(CurrentPort); bool IsKeyboard = Backend->GetGuid() == "Keyboard" || Backend->GetGuid() == "Auto" || !Backend->Connected(); @@ -357,4 +357,16 @@ namespace Ship { ImGui::End(); } + + bool InputEditor::IsOpened() { + return Opened; + } + + void InputEditor::Open() { + Opened = true; + } + + void InputEditor::Close() { + Opened = false; + } } diff --git a/libultraship/libultraship/InputEditor.h b/libultraship/libultraship/InputEditor.h index 81b1997ec..50b059e2d 100644 --- a/libultraship/libultraship/InputEditor.h +++ b/libultraship/libultraship/InputEditor.h @@ -1,18 +1,22 @@ #pragma once +#include "stdint.h" #include "Lib/ImGui/imgui.h" namespace Ship { class InputEditor { - int CurrentPort = 0; - int BtnReading = -1; - public: + int32_t CurrentPort = 0; + int32_t BtnReading = -1; bool Opened = false; + public: void Init(); - void DrawButton(const char* label, int n64Btn); + void DrawButton(const char* label, int32_t n64Btn); void DrawVirtualStick(const char* label, ImVec2 stick); void DrawControllerSchema(); void DrawHud(); + bool IsOpened(); + void Open(); + void Close(); }; } diff --git a/libultraship/libultraship/KeyboardController.cpp b/libultraship/libultraship/KeyboardController.cpp index 7df244d9c..ff0b72b70 100644 --- a/libultraship/libultraship/KeyboardController.cpp +++ b/libultraship/libultraship/KeyboardController.cpp @@ -7,7 +7,7 @@ #endif #include "Hooks.h" -#include "GlobalCtx2.h" + #include "Window.h" namespace Ship { @@ -70,7 +70,7 @@ namespace Ship { }); if (find == Mappings.end()) return "Unknown"; - const char* name = GlobalCtx2::GetInstance()->GetWindow()->GetKeyName(find->first); + const char* name = Window::GetInstance()->GetKeyName(find->first); return strlen(name) == 0 ? "Unknown" : name; } diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_gx2.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_gx2.cpp index dddc0fa85..876375169 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_gx2.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_gx2.cpp @@ -16,7 +16,6 @@ #include "gfx_cc.h" #include "gfx_rendering_api.h" -#include "../../GlobalCtx2.h" #include "gfx_pc.h" #include "gfx_wiiu.h" diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp index 7b70ba11b..7d2428a45 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_opengl.cpp @@ -44,7 +44,7 @@ #include "gfx_cc.h" #include "gfx_rendering_api.h" #include "../../ImGuiImpl.h" -#include "../../GlobalCtx2.h" +#include "../../Window.h" #include "gfx_pc.h" using namespace std; diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp index fc35f6f7f..cca872f99 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.cpp @@ -15,6 +15,7 @@ #ifndef _LANGUAGE_C #define _LANGUAGE_C #endif +#include #include #include #include @@ -36,6 +37,7 @@ #include "../../ResourceMgr.h" #include "../../Utils.h" + // OTRTODO: fix header files for these extern "C" { const char* ResourceMgr_GetNameByCRC(uint64_t crc); @@ -2171,7 +2173,7 @@ static void gfx_run_dl(Gfx* cmd) { uintptr_t mtxAddr = cmd->words.w1; // OTRTODO: Temp way of dealing with gMtxClear. Need something more elegant in the future... - uint32_t gameVersion = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->GetGameVersion(); + uint32_t gameVersion = Ship::Window::GetInstance()->GetResourceManager()->GetGameVersion(); if (gameVersion == OOT_PAL_GC) { if (mtxAddr == SEG_ADDR(0, 0x0FBC20)) { mtxAddr = clearMtx; diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h index feab8e3d9..2804c7010 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_pc.h +++ b/libultraship/libultraship/Lib/Fast3D/gfx_pc.h @@ -8,6 +8,7 @@ #include #include +#include "U64/PR/ultra64/gbi.h" #include "U64/PR/ultra64/types.h" // TODO figure out why changing these to 640x480 makes the game only render in a quarter of the window diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp index 76573c084..fa657e40c 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp @@ -189,6 +189,7 @@ static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen, uint32 } #endif + SDL_GL_MakeCurrent(wnd, ctx); SDL_GL_SetSwapInterval(1); SohImGui::WindowImpl window_impl; diff --git a/libultraship/libultraship/Material.h b/libultraship/libultraship/Material.h index 2d9e70327..ec45dcb91 100644 --- a/libultraship/libultraship/Material.h +++ b/libultraship/libultraship/Material.h @@ -1,4 +1,5 @@ #include "Resource.h" +#include "StrHash.h" namespace Ship { diff --git a/libultraship/libultraship/Resource.h b/libultraship/libultraship/Resource.h index f7ea98e93..9e89d19f5 100644 --- a/libultraship/libultraship/Resource.h +++ b/libultraship/libultraship/Resource.h @@ -3,15 +3,14 @@ #include #include "Utils/BinaryReader.h" #include "Utils/BinaryWriter.h" -#include "GlobalCtx2.h" -#include "StrHash.h" #include "File.h" #include "Lib/tinyxml2/tinyxml2.h" +#include "spdlog/spdlog.h" -namespace Ship -{ - enum class ResourceType - { +namespace Ship { + class ResourceMgr; + + enum class ResourceType { Archive = 0x4F415243, // OARC (UNUSED) Model = 0x4F4D444C, // OMDL (WIP) Texture = 0x4F544558, // OTEX @@ -36,8 +35,7 @@ namespace Ship AudioSequence = 0x4F534551, // OSEQ }; - enum class DataType - { + enum class DataType { U8 = 0, S8 = 1, U16 = 2, @@ -51,8 +49,7 @@ namespace Ship F64 = 10 }; - enum class Version - { + enum class Version { // BR Deckard = 0, Roy = 1, @@ -61,15 +58,13 @@ namespace Ship // ... }; - struct Patch - { + struct Patch { uint64_t crc; uint32_t index; uintptr_t origData; }; - class Resource - { + class Resource { public: ResourceMgr* resMgr; uint64_t id; // Unique Resource ID @@ -81,8 +76,7 @@ namespace Ship virtual ~Resource(); }; - class ResourceFile - { + class ResourceFile { public: Endianness endianness; // 0x00 - Endianness of the file uint32_t resourceType; // 0x01 - 4 byte MAGIC diff --git a/libultraship/libultraship/ResourceMgr.cpp b/libultraship/libultraship/ResourceMgr.cpp index 4c517b39d..4ca77708a 100644 --- a/libultraship/libultraship/ResourceMgr.cpp +++ b/libultraship/libultraship/ResourceMgr.cpp @@ -9,13 +9,14 @@ namespace Ship { - ResourceMgr::ResourceMgr(std::shared_ptr Context, const std::string& MainPath, const std::string& PatchesPath) : Context(Context), bIsRunning(false), FileLoadThread(nullptr) { + ResourceMgr::ResourceMgr(std::shared_ptr Context, const std::string& MainPath, const std::string& PatchesPath) : Context(Context), bIsRunning(false), FileLoadThread(nullptr) { OTR = std::make_shared(MainPath, PatchesPath, false); gameVersion = OOT_UNKNOWN; - if (OTR->IsMainMPQValid()) + if (OTR->IsMainMPQValid()) { Start(); + } } ResourceMgr::~ResourceMgr() { @@ -87,10 +88,11 @@ namespace Ship { OTR->LoadFile(ToLoad->path, true, ToLoad); - if (!ToLoad->bHasLoadError) + if (!ToLoad->bHasLoadError) { FileCache[ToLoad->path] = ToLoad->bIsLoaded && !ToLoad->bHasLoadError ? ToLoad : nullptr; + } - SPDLOG_DEBUG("Loaded File {} on ResourceMgr thread", ToLoad->path); + SPDLOG_TRACE("Loaded File {} on ResourceMgr thread", ToLoad->path); ToLoad->FileLoadNotifier.notify_all(); } @@ -123,12 +125,10 @@ namespace Ship { } } - if (!ToLoad->file->bHasLoadError) - { + if (!ToLoad->file->bHasLoadError) { auto UnmanagedRes = ResourceLoader::LoadResource(ToLoad->file); - if (UnmanagedRes != nullptr) - { + if (UnmanagedRes != nullptr) { UnmanagedRes->resMgr = this; auto Res = std::shared_ptr(UnmanagedRes); @@ -142,17 +142,14 @@ namespace Ship { SPDLOG_DEBUG("Loaded Resource {} on ResourceMgr thread", ToLoad->file->path); Res->file = nullptr; - } - else { + } else { ToLoad->bHasResourceLoaded = false; ToLoad->resource = nullptr; SPDLOG_ERROR("Resource load FAILED {} on ResourceMgr thread", ToLoad->file->path); } } - } - else - { + } else { ToLoad->bHasResourceLoaded = false; ToLoad->resource = nullptr; } @@ -163,13 +160,11 @@ namespace Ship { SPDLOG_INFO("Resource Manager LoadResourceThread ended"); } - uint32_t ResourceMgr::GetGameVersion() - { + uint32_t ResourceMgr::GetGameVersion() { return gameVersion; } - void ResourceMgr::SetGameVersion(uint32_t newGameVersion) - { + void ResourceMgr::SetGameVersion(uint32_t newGameVersion) { gameVersion = newGameVersion; } @@ -206,24 +201,23 @@ namespace Ship { auto resCacheFind = ResourceCache.find(FilePath); if (resCacheFind != ResourceCache.end() && - resCacheFind->second.use_count() > 0) - { + resCacheFind->second.use_count() > 0) { return resCacheFind->second; - } - else + } else { return nullptr; + } } std::shared_ptr ResourceMgr::LoadResource(const char* FilePath) { auto Res = LoadResourceAsync(FilePath); - if (std::holds_alternative>(Res)) + if (std::holds_alternative>(Res)) { return std::get>(Res); + } auto& Promise = std::get>(Res); - if (!Promise->bHasResourceLoaded) - { + if (!Promise->bHasResourceLoaded) { std::unique_lock Lock(Promise->resourceLoadMutex); while (!Promise->bHasResourceLoaded) { Promise->resourceLoadNotifier.wait(Lock); @@ -234,8 +228,9 @@ namespace Ship { } std::variant, std::shared_ptr> ResourceMgr::LoadResourceAsync(const char* FilePath) { - if (FilePath[0] == '_' && FilePath[1] == '_' && FilePath[2] == 'O' && FilePath[3] == 'T' && FilePath[4] == 'R' && FilePath[5] == '_' && FilePath[6] == '_') + if (FilePath[0] == '_' && FilePath[1] == '_' && FilePath[2] == 'O' && FilePath[3] == 'T' && FilePath[4] == 'R' && FilePath[5] == '_' && FilePath[6] == '_') { FilePath += 7; + } const std::lock_guard ResLock(ResourceLoadMutex); auto resCacheFind = ResourceCache.find(FilePath); @@ -248,21 +243,16 @@ namespace Ship { std::shared_ptr FileData = LoadFile(FilePath); Promise->file = FileData; - if (Promise->file->bHasLoadError) - { + if (Promise->file->bHasLoadError) { Promise->bHasResourceLoaded = true; - } - else - { + } else { Promise->bHasResourceLoaded = false; ResourceLoadQueue.push(Promise); ResourceLoadNotifier.notify_all(); } return Promise; - } - else - { + } else { return resCacheFind->second; } } @@ -273,8 +263,7 @@ namespace Ship { for (DWORD i = 0; i < fileList.size(); i++) { auto resource = LoadResourceAsync(fileList.operator[](i).cFileName); - if (std::holds_alternative>(resource)) - { + if (std::holds_alternative>(resource)) { auto promise = std::make_shared(); promise->bHasResourceLoaded = true; promise->resource = std::get>(resource); @@ -304,8 +293,7 @@ namespace Ship { return LoadedList; } - std::shared_ptr>> ResourceMgr::DirtyDirectory(std::string SearchMask) - { + std::shared_ptr>> ResourceMgr::DirtyDirectory(const std::string& SearchMask) { auto PromiseList = CacheDirectoryAsync(SearchMask); auto LoadedList = std::make_shared>>(); @@ -317,8 +305,9 @@ namespace Ship { Promise->resourceLoadNotifier.wait(Lock); } - if (Promise->resource != nullptr) + if (Promise->resource != nullptr) { Promise->resource->isDirty = true; + } LoadedList->push_back(Promise->resource); } @@ -326,8 +315,7 @@ namespace Ship { return LoadedList; } - std::shared_ptr> ResourceMgr::ListFiles(std::string SearchMask) - { + std::shared_ptr> ResourceMgr::ListFiles(std::string SearchMask) { auto result = std::make_shared>(); auto fileList = OTR->ListFiles(SearchMask); diff --git a/libultraship/libultraship/ResourceMgr.h b/libultraship/libultraship/ResourceMgr.h index 5604552d5..e0b0c07cf 100644 --- a/libultraship/libultraship/ResourceMgr.h +++ b/libultraship/libultraship/ResourceMgr.h @@ -5,26 +5,26 @@ #include #include #include +#include "Window.h" #include "Resource.h" -#include "GlobalCtx2.h" +#include "Archive.h" +#include "File.h" -namespace Ship -{ - class Archive; - class File; +namespace Ship { + class Window; // Resource manager caches any and all files it comes across into memory. This will be unoptimal in the future when modifications have gigabytes of assets. // It works with the original game's assets because the entire ROM is 64MB and fits into RAM of any semi-modern PC. class ResourceMgr { public: - ResourceMgr(std::shared_ptr Context, const std::string& MainPath, const std::string& PatchesPath); + ResourceMgr(std::shared_ptr Context, const std::string& MainPath, const std::string& PatchesPath); ~ResourceMgr(); bool IsRunning(); bool DidLoadSuccessfully(); std::shared_ptr GetArchive() { return OTR; } - std::shared_ptr GetContext() { return Context.lock(); } + std::shared_ptr GetContext() { return Context; } const std::string* HashToString(uint64_t Hash) const; @@ -34,13 +34,13 @@ namespace Ship void SetGameVersion(uint32_t newGameVersion); std::shared_ptr LoadFileAsync(const std::string& FilePath); std::shared_ptr LoadFile(const std::string& FilePath); - std::shared_ptr GetCachedFile(const char* FilePath) const; + std::shared_ptr GetCachedFile(const char* FilePath) const; std::shared_ptr LoadResource(const char* FilePath); std::shared_ptr LoadResource(const std::string& FilePath) { return LoadResource(FilePath.c_str()); } std::variant, std::shared_ptr> LoadResourceAsync(const char* FilePath); std::shared_ptr>> CacheDirectory(const std::string& SearchMask); std::shared_ptr>> CacheDirectoryAsync(const std::string& SearchMask); - std::shared_ptr>> DirtyDirectory(std::string SearchMask); + std::shared_ptr>> DirtyDirectory(const std::string& SearchMask); std::shared_ptr> ListFiles(std::string SearchMask); protected: @@ -50,7 +50,7 @@ namespace Ship void LoadResourceThread(); private: - std::weak_ptr Context; + std::shared_ptr Context; volatile bool bIsRunning; std::unordered_map> FileCache; std::unordered_map> ResourceCache; diff --git a/libultraship/libultraship/SDLController.cpp b/libultraship/libultraship/SDLController.cpp index 97a9a019f..d0bb8e1f7 100644 --- a/libultraship/libultraship/SDLController.cpp +++ b/libultraship/libultraship/SDLController.cpp @@ -1,5 +1,5 @@ #include "SDLController.h" -#include "GlobalCtx2.h" + #include "spdlog/spdlog.h" #include "Window.h" #include diff --git a/libultraship/libultraship/WiiUController.cpp b/libultraship/libultraship/WiiUController.cpp index 19835a548..de5c33633 100644 --- a/libultraship/libultraship/WiiUController.cpp +++ b/libultraship/libultraship/WiiUController.cpp @@ -1,6 +1,5 @@ #ifdef __WIIU__ #include "WiiUController.h" -#include "GlobalCtx2.h" #include "Window.h" #include "ImGuiImpl.h" diff --git a/libultraship/libultraship/WiiUGamepad.cpp b/libultraship/libultraship/WiiUGamepad.cpp index 64ef9e90f..ac1558e08 100644 --- a/libultraship/libultraship/WiiUGamepad.cpp +++ b/libultraship/libultraship/WiiUGamepad.cpp @@ -1,6 +1,5 @@ #ifdef __WIIU__ #include "WiiUGamepad.h" -#include "GlobalCtx2.h" #include "ImGuiImpl.h" #include "WiiUImpl.h" diff --git a/libultraship/libultraship/WiiUImpl.cpp b/libultraship/libultraship/WiiUImpl.cpp index 06cd3ec60..41439542a 100644 --- a/libultraship/libultraship/WiiUImpl.cpp +++ b/libultraship/libultraship/WiiUImpl.cpp @@ -114,7 +114,7 @@ void Update() { // rescan devices if connection state changed if (rescan) { - Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->ScanPhysicalDevices(); + Window::GetInstance()->GetControlDeck()->ScanPhysicalDevices(); } } diff --git a/libultraship/libultraship/Window.cpp b/libultraship/libultraship/Window.cpp index 7a543d1d8..666c1e0c0 100644 --- a/libultraship/libultraship/Window.cpp +++ b/libultraship/libultraship/Window.cpp @@ -1,23 +1,18 @@ +#include +#include +#include +#include #include "Window.h" -#include "spdlog/spdlog.h" -#include "KeyboardController.h" -#include "GlobalCtx2.h" -#include "DisplayList.h" -#include "Vertex.h" -#include "Array.h" #include "ResourceMgr.h" +#include "KeyboardController.h" +#include "UltraController.h" +#include "DisplayList.h" +#include "Console.h" +#include "Array.h" #include "Texture.h" #include "Blob.h" #include "Matrix.h" -#include "AudioPlayer.h" #include "Hooks.h" -#include "UltraController.h" -#include -#include -#include -#include "Console.h" -#include "ImGuiImpl.h" -#include "PR/ultra64/gbi.h" #include "Lib/Fast3D/gfx_pc.h" #include "Lib/Fast3D/gfx_sdl.h" #include "Lib/Fast3D/gfx_dxgi.h" @@ -27,12 +22,25 @@ #include "Lib/Fast3D/gfx_direct3d12.h" #include "Lib/Fast3D/gfx_wiiu.h" #include "Lib/Fast3D/gfx_gx2.h" +#include "Lib/Fast3D/gfx_rendering_api.h" #include "Lib/Fast3D/gfx_window_manager_api.h" -#include +#include +#include "ImGuiImpl.h" +#include "spdlog/async.h" +#include "spdlog/sinks/rotating_file_sink.h" +#include "spdlog/sinks/stdout_color_sinks.h" +#include "spdlog/sinks/sohconsole_sink.h" +#include "PR/ultra64/gbi.h" +#ifdef __APPLE__ +#include "OSXFolderManager.h" +#elif defined(__SWITCH__) +#include "SwitchImpl.h" +#elif defined(__WIIU__) +#include "WiiUImpl.h" +#endif -#include -#define LOAD_TEX(texPath) static_cast(Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(texPath).get()); +#define LOAD_TEX(texPath) static_cast(Ship::Window::GetInstance()->GetResourceManager()->LoadResource(texPath).get()); extern "C" { struct OSMesgQueue; @@ -59,7 +67,7 @@ extern "C" { #endif #endif - Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->Init(controllerBits); + Ship::Window::GetInstance()->GetControlDeck()->Init(controllerBits); return 0; } @@ -78,22 +86,22 @@ extern "C" { pad->gyro_x = 0; pad->gyro_y = 0; - if (SohImGui::controller->Opened) return; + if (SohImGui::controller->IsOpened()) return; - Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck()->WriteToPad(pad); + Ship::Window::GetInstance()->GetControlDeck()->WriteToPad(pad); Ship::ExecuteHooks(pad); } const char* ResourceMgr_GetNameByCRC(uint64_t crc) { - const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(crc); + const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(crc); return hashStr != nullptr ? hashStr->c_str() : nullptr; } Vtx* ResourceMgr_LoadVtxByCRC(uint64_t crc) { - const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(crc); + const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(crc); if (hashStr != nullptr) { - auto res = std::static_pointer_cast(Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str())); + auto res = std::static_pointer_cast(Ship::Window::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str())); return (Vtx*)res->vertices.data(); } @@ -101,10 +109,10 @@ extern "C" { } int32_t* ResourceMgr_LoadMtxByCRC(uint64_t crc) { - const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(crc); + const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(crc); if (hashStr != nullptr) { - auto res = std::static_pointer_cast(Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str())); + auto res = std::static_pointer_cast(Ship::Window::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str())); return (int32_t*)res->mtx.data(); } @@ -112,10 +120,10 @@ extern "C" { } Gfx* ResourceMgr_LoadGfxByCRC(uint64_t crc) { - const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(crc); + const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(crc); if (hashStr != nullptr) { - auto res = std::static_pointer_cast(Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str())); + auto res = std::static_pointer_cast(Ship::Window::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str())); return (Gfx*)&res->instructions[0]; } else { return nullptr; @@ -123,7 +131,7 @@ extern "C" { } char* ResourceMgr_LoadTexByCRC(uint64_t crc) { - const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(crc); + const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(crc); if (hashStr != nullptr) { const auto res = LOAD_TEX(hashStr->c_str()); @@ -137,11 +145,11 @@ extern "C" { void ResourceMgr_RegisterResourcePatch(uint64_t hash, uint32_t instrIndex, uintptr_t origData) { - const std::string* hashStr = Ship::GlobalCtx2::GetInstance()->GetResourceManager()->HashToString(hash); + const std::string* hashStr = Ship::Window::GetInstance()->GetResourceManager()->HashToString(hash); if (hashStr != nullptr) { - auto res = (Ship::Texture*)Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str()).get(); + auto res = (Ship::Texture*)Ship::Window::GetInstance()->GetResourceManager()->LoadResource(hashStr->c_str()).get(); Ship::Patch patch; patch.crc = hash; @@ -201,7 +209,7 @@ extern "C" { } char* ResourceMgr_LoadBlobByName(char* blobPath) { - auto res = (Ship::Blob*)Ship::GlobalCtx2::GetInstance()->GetResourceManager()->LoadResource(blobPath).get(); + auto res = (Ship::Blob*)Ship::Window::GetInstance()->GetResourceManager()->LoadResource(blobPath).get(); return (char*)res->data.data(); } @@ -217,7 +225,26 @@ extern "C" { namespace Ship { - Window::Window(std::shared_ptr Context) : Context(Context), APlayer(nullptr), ControllerApi(nullptr) { + std::weak_ptr Window::Context; + + std::shared_ptr Window::GetInstance() { + return Context.lock(); + } + + std::shared_ptr Window::CreateInstance(const std::string Name) { + if (Context.expired()) { + auto Shared = std::make_shared(Name); + Context = Shared; + Shared->Initialize(); + return Shared; + } + + SPDLOG_DEBUG("Trying to create a context when it already exists. Returning existing."); + + return GetInstance(); + } + + Window::Window(std::string Name) : Name(std::move(Name)), APlayer(nullptr), ControllerApi(nullptr), ResMan(nullptr), Logger(nullptr), Config(nullptr) { WmApi = nullptr; RenderingApi = nullptr; bIsFullscreen = false; @@ -226,77 +253,91 @@ namespace Ship { } Window::~Window() { - SPDLOG_INFO("destruct window"); + SPDLOG_DEBUG("destruct window"); } void Window::CreateDefaults() { - const std::shared_ptr pConf = GlobalCtx2::GetInstance()->GetConfig(); - if (pConf->isNewInstance) { - pConf->setInt("Window.Width", 640); - pConf->setInt("Window.Height", 480); - pConf->setBool("Window.Options", false); - pConf->setString("Window.GfxBackend", ""); + if (GetConfig()->isNewInstance) { + GetConfig()->setInt("Window.Width", 640); + GetConfig()->setInt("Window.Height", 480); + GetConfig()->setBool("Window.Options", false); + GetConfig()->setString("Window.GfxBackend", ""); - pConf->setBool("Window.Fullscreen.Enabled", false); - pConf->setInt("Window.Fullscreen.Width", 1920); - pConf->setInt("Window.Fullscreen.Height", 1080); + GetConfig()->setBool("Window.Fullscreen.Enabled", false); + GetConfig()->setInt("Window.Fullscreen.Width", 1920); + GetConfig()->setInt("Window.Fullscreen.Height", 1080); - pConf->setString("Game.SaveName", ""); - pConf->setString("Game.Main Archive", ""); - pConf->setString("Game.Patches Archive", ""); + GetConfig()->setString("Game.SaveName", ""); + GetConfig()->setString("Game.Main Archive", ""); + GetConfig()->setString("Game.Patches Archive", ""); - pConf->setInt("Shortcuts.Fullscreen", 0x044); - pConf->setInt("Shortcuts.Console", 0x029); - pConf->save(); + GetConfig()->setInt("Shortcuts.Fullscreen", 0x044); + GetConfig()->setInt("Shortcuts.Console", 0x029); + GetConfig()->save(); } } - void Window::Init() { - std::shared_ptr pConf = GlobalCtx2::GetInstance()->GetConfig(); - + void Window::Initialize() { + InitializeLogging(); + InitializeConfiguration(); + InitializeResourceManager(); CreateDefaults(); InitializeAudioPlayer(); InitializeControlDeck(); - bIsFullscreen = pConf->getBool("Window.Fullscreen.Enabled", false); + bIsFullscreen = GetConfig()->getBool("Window.Fullscreen.Enabled", false); if (bIsFullscreen) { - dwWidth = pConf->getInt("Window.Fullscreen.Width", 1920); - dwHeight = pConf->getInt("Window.Fullscreen.Height", 1080); + dwWidth = GetConfig()->getInt("Window.Fullscreen.Width", 1920); + dwHeight = GetConfig()->getInt("Window.Fullscreen.Height", 1080); } else { - dwWidth = pConf->getInt("Window.Width", 640); - dwHeight = pConf->getInt("Window.Height", 480); + dwWidth = GetConfig()->getInt("Window.Width", 640); + dwHeight = GetConfig()->getInt("Window.Height", 480); } - dwMenubar = pConf->getBool("Window.Options", false); - gfxBackend = pConf->getString("Window.GfxBackend"); + dwMenubar = GetConfig()->getBool("Window.Options", false); + const std::string& gfx_backend = GetConfig()->getString("Window.GfxBackend"); InitializeWindowManager(); - gfx_init(WmApi, RenderingApi, GetContext()->GetName().c_str(), bIsFullscreen, dwWidth, dwHeight); + gfx_init(WmApi, RenderingApi, GetName().c_str(), bIsFullscreen, dwWidth, dwHeight); WmApi->set_fullscreen_changed_callback(OnFullscreenChanged); WmApi->set_keyboard_callbacks(KeyDown, KeyUp, AllKeysUp); - Ship::RegisterHook([this]() { + Ship::RegisterHook([this]() { ControllerApi->SaveControllerSettings(); }); } + std::string Window::GetAppDirectoryPath() { +#ifdef __APPLE__ + FolderManager folderManager; + std::string fpath = std::string(folderManager.pathForDirectory(NSApplicationSupportDirectory, NSUserDomainMask)); + fpath.append("/com.shipofharkinian.soh"); + return fpath; +#endif + +#ifdef __linux__ + char* fpath = std::getenv("SHIP_HOME"); + if (fpath != NULL) + return std::string(fpath); +#endif + + return "."; + } + + std::string Window::GetPathRelativeToAppDirectory(const char* path) { + return GetAppDirectoryPath() + "/" + path; + } + void Window::StartFrame() { gfx_start_frame(); } - void Window::RunCommands(Gfx* Commands, const std::vector>& mtx_replacements) { - for (const auto& m : mtx_replacements) { - gfx_run(Commands, m); - gfx_end_frame(); - } - } - - void Window::SetTargetFps(int fps) { + void Window::SetTargetFps(int32_t fps) { gfx_set_target_fps(fps); } - void Window::SetMaximumFrameLatency(int latency) { + void Window::SetMaximumFrameLatency(int32_t latency) { gfx_set_maximum_frame_latency(latency); } @@ -329,17 +370,17 @@ namespace Ship { void Window::MainLoop(void (*MainFunction)(void)) { WmApi->main_loop(MainFunction); } - bool Window::KeyUp(int32_t dwScancode) { - std::shared_ptr pConf = GlobalCtx2::GetInstance()->GetConfig(); - if (dwScancode == pConf->getInt("Shortcuts.Fullscreen", 0x044)) { - GlobalCtx2::GetInstance()->GetWindow()->ToggleFullscreen(); + bool Window::KeyUp(int32_t dwScancode) { + if (dwScancode == GetInstance()->GetConfig()->getInt("Shortcuts.Fullscreen", 0x044)) { + GetInstance()->ToggleFullscreen(); } - GlobalCtx2::GetInstance()->GetWindow()->SetLastScancode(-1); + GetInstance()->SetLastScancode(-1); + bool bIsProcessed = false; - auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + auto controlDeck = GetInstance()->GetControlDeck(); const auto pad = dynamic_cast(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get()); if (pad != nullptr) { if (pad->ReleaseButton(dwScancode)) { @@ -352,7 +393,7 @@ namespace Ship { bool Window::KeyDown(int32_t dwScancode) { bool bIsProcessed = false; - auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + auto controlDeck = GetInstance()->GetControlDeck(); const auto pad = dynamic_cast(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get()); if (pad != nullptr) { if (pad->PressButton(dwScancode)) { @@ -360,14 +401,14 @@ namespace Ship { } } - GlobalCtx2::GetInstance()->GetWindow()->SetLastScancode(dwScancode); + GetInstance()->SetLastScancode(dwScancode); return bIsProcessed; } void Window::AllKeysUp(void) { - auto controlDeck = GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + auto controlDeck = Window::GetInstance()->GetControlDeck(); const auto pad = dynamic_cast(controlDeck->GetPhysicalDevice(controlDeck->GetNumPhysicalDevices() - 2).get()); if (pad != nullptr) { pad->ReleaseAllButtons(); @@ -375,15 +416,13 @@ namespace Ship { } void Window::OnFullscreenChanged(bool bIsFullscreen) { - std::shared_ptr pConf = GlobalCtx2::GetInstance()->GetConfig(); + std::shared_ptr pConf = Window::GetInstance()->GetConfig(); - GlobalCtx2::GetInstance()->GetWindow()->bIsFullscreen = bIsFullscreen; + Window::GetInstance()->bIsFullscreen = bIsFullscreen; pConf->setBool("Window.Fullscreen.Enabled", bIsFullscreen); - GlobalCtx2::GetInstance()->GetWindow()->ShowCursor(!bIsFullscreen); + Window::GetInstance()->ShowCursor(!bIsFullscreen); } - - uint32_t Window::GetCurrentWidth() { WmApi->get_dimensions(&dwWidth, &dwHeight); return dwWidth; @@ -453,4 +492,93 @@ namespace Ship { void Window::InitializeControlDeck() { ControllerApi = std::make_shared(); } + + void Window::InitializeLogging() { + try { + // Setup Logging + spdlog::init_thread_pool(8192, 1); + std::vector Sinks; + + auto SohConsoleSink = std::make_shared(); + SohConsoleSink->set_level(spdlog::level::trace); + Sinks.push_back(SohConsoleSink); + +#if (!defined(_WIN32) && !defined(__WIIU__)) || defined(_DEBUG) + auto ConsoleSink = std::make_shared(); + ConsoleSink->set_level(spdlog::level::trace); + Sinks.push_back(ConsoleSink); +#endif + +#ifndef __WIIU__ + auto logPath = GetPathRelativeToAppDirectory(("logs/" + GetName() + ".log").c_str()); + auto FileSink = std::make_shared(logPath, 1024 * 1024 * 10, 10); + FileSink->set_level(spdlog::level::trace); + Sinks.push_back(FileSink); +#endif + + Logger = std::make_shared(GetName(), Sinks.begin(), Sinks.end(), spdlog::thread_pool(), spdlog::async_overflow_policy::block); + GetLogger()->set_level(spdlog::level::trace); + +#ifndef __WIIU__ + GetLogger()->set_pattern("[%Y-%m-%d %H:%M:%S.%e] [%@] [%l] %v"); +#else + GetLogger()->set_pattern("[%s:%#] [%l] %v"); +#endif + + spdlog::register_logger(GetLogger()); + spdlog::set_default_logger(GetLogger()); + } + catch (const spdlog::spdlog_ex& ex) { + std::cout << "Log initialization failed: " << ex.what() << std::endl; + } + } + + void Window::InitializeResourceManager() { + MainPath = Config->getString("Game.Main Archive", GetPathRelativeToAppDirectory("oot.otr")); + PatchesPath = Config->getString("Game.Patches Archive", GetAppDirectoryPath() + "/mods"); + ResMan = std::make_shared(GetInstance(), MainPath, PatchesPath); + + if (!ResMan->DidLoadSuccessfully()) + { +#ifdef _WIN32 + MessageBox(nullptr, L"Main OTR file not found!", L"Uh oh", MB_OK); +#elif defined(__SWITCH__) + printf("Main OTR file not found!\n"); +#elif defined(__WIIU__) + Ship::WiiU::ThrowMissingOTR(MainPath.c_str()); +#else + SPDLOG_ERROR("Main OTR file not found!"); +#endif + exit(1); + } +#ifdef __SWITCH__ + Ship::Switch::Init(PostInitPhase); +#endif + } + + void Window::InitializeConfiguration() { + Config = std::make_shared(GetPathRelativeToAppDirectory("shipofharkinian.json")); + } + + void Window::WriteSaveFile(const std::filesystem::path& savePath, const uintptr_t addr, void* dramAddr, const size_t size) { + std::ofstream saveFile = std::ofstream(savePath, std::fstream::in | std::fstream::out | std::fstream::binary); + saveFile.seekp(addr); + saveFile.write((char*)dramAddr, size); + saveFile.close(); + } + + void Window::ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size) { + std::ifstream saveFile = std::ifstream(savePath, std::fstream::in | std::fstream::out | std::fstream::binary); + + // If the file doesn't exist, initialize DRAM + if (saveFile.good()) { + saveFile.seekg(addr); + saveFile.read((char*)dramAddr, size); + } + else { + memset(dramAddr, 0, size); + } + + saveFile.close(); + } } diff --git a/libultraship/libultraship/Window.h b/libultraship/libultraship/Window.h index 54488f4c9..6a0e68899 100644 --- a/libultraship/libultraship/Window.h +++ b/libultraship/libultraship/Window.h @@ -1,27 +1,36 @@ #pragma once -#include -#include "PR/ultra64/gbi.h" -#include "Lib/Fast3D/gfx_pc.h" -#include "Controller.h" -#include "GlobalCtx2.h" -#include "ControlDeck.h" +#include +#include +#include "spdlog/spdlog.h" +#include "ControlDeck.h" +#include "AudioPlayer.h" #include "Lib/Fast3D/gfx_window_manager_api.h" +#include "Lib/Mercury/Mercury.h" + +struct GfxRenderingAPI; +struct GfxWindowManagerAPI; namespace Ship { - class AudioPlayer; + class ResourceMgr; class Window { public: - Window(std::shared_ptr Context); + static std::shared_ptr GetInstance(); + static std::shared_ptr CreateInstance(const std::string Name); + static std::string GetAppDirectoryPath(); + static std::string GetPathRelativeToAppDirectory(const char* path); + + Window(std::string Name); ~Window(); + void WriteSaveFile(const std::filesystem::path& savePath, uintptr_t addr, void* dramAddr, size_t size); + void ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, void* dramAddr, size_t size); void CreateDefaults(); void MainLoop(void (*MainFunction)(void)); - void Init(); + void Initialize(); void StartFrame(); - void RunCommands(Gfx* Commands, const std::vector>& mtx_replacements); - void SetTargetFps(int fps); - void SetMaximumFrameLatency(int latency); + void SetTargetFps(int32_t fps); + void SetMaximumFrameLatency(int32_t latency); void GetPixelDepthPrepare(float x, float y); uint16_t GetPixelDepth(float x, float y); void ToggleFullscreen(); @@ -32,29 +41,39 @@ namespace Ship { uint32_t GetCurrentHeight(); uint32_t GetMenuBar() { return dwMenubar; } void SetMenuBar(uint32_t dwMenuBar) { this->dwMenubar = dwMenuBar; } + std::string GetName() { return Name; } std::shared_ptr GetControlDeck() { return ControllerApi; }; - std::shared_ptr GetContext() { return Context.lock(); } std::shared_ptr GetAudioPlayer() { return APlayer; } - const char* GetKeyName(int scancode) { return WmApi->get_key_name(scancode); } - int32_t GetLastScancode() { return lastScancode; }; - void SetLastScancode(int32_t scanCode) { lastScancode = scanCode; }; + std::shared_ptr GetResourceManager() { return ResMan; } + std::shared_ptr GetConfig() { return Config; } + std::shared_ptr GetLogger() { return Logger; } + const char* GetKeyName(int32_t scancode) { return WmApi->get_key_name(scancode); } + int32_t GetLastScancode() { return lastScancode; } + void SetLastScancode(int32_t scanCode) { lastScancode = scanCode; } protected: + Window() = default; private: static bool KeyDown(int32_t dwScancode); static bool KeyUp(int32_t dwScancode); static void AllKeysUp(void); static void OnFullscreenChanged(bool bIsNowFullscreen); + static std::weak_ptr Context; + void InitializeConfiguration(); void InitializeControlDeck(); void InitializeAudioPlayer(); + void InitializeLogging(); + void InitializeResourceManager(); void InitializeWindowManager(); - std::weak_ptr Context; + std::shared_ptr Logger; + std::shared_ptr Config; // Config needs to be after the Window because we call the Window during it's destructor. + std::shared_ptr ResMan; std::shared_ptr APlayer; std::shared_ptr ControllerApi; - std::string gfxBackend; + std::string gfxBackend; GfxRenderingAPI* RenderingApi; GfxWindowManagerAPI* WmApi; bool bIsFullscreen; @@ -62,5 +81,8 @@ namespace Ship { uint32_t dwHeight; uint32_t dwMenubar; int32_t lastScancode; + std::string Name; + std::string MainPath; + std::string PatchesPath; }; } diff --git a/scripts/linux/appimage/soh.sh b/scripts/linux/appimage/soh.sh index f3b563cc7..120d775c0 100644 --- a/scripts/linux/appimage/soh.sh +++ b/scripts/linux/appimage/soh.sh @@ -5,14 +5,18 @@ export PATH="$HERE"/bin:"$HERE"/usr/bin:"$PATH" export LD_LIBRARY_PATH="$HERE"/usr/lib:"$LD_LIBRARY_PATH" export ZENITY=$(command -v zenity) -while [[ ! -e "$PWD"/oot.otr ]]; do +if [ -z ${SHIP_HOME+x} ]; then +export SHIP_HOME=$PWD +fi + +while [[ ! -e "$SHIP_HOME"/oot.otr ]]; do export ASSETDIR="$(mktemp -d /tmp/assets-XXXXX)" ln -s "$HERE"/usr/bin/{assets,soh.elf,OTRGui} "$ASSETDIR" export OLDPWD="$PWD" mkdir -p "$ASSETDIR"/tmp mkdir -p "$ASSETDIR"/Extract/assets - if [ -e "$PWD"/*.*64 ]; then - ln -s "$OLDPWD"/*.*64 "$ASSETDIR"/tmp/rom.z64 + if [ -e "$SHIP_HOME"/*.*64 ]; then + ln -s "$SHIP_HOME"/*.*64 "$ASSETDIR"/tmp/rom.z64 cp -r "$ASSETDIR"/assets/game/ship_of_harkinian "$ASSETDIR"/Extract/assets/ cd "$ASSETDIR" ROMHASH=$(sha1sum -b "$ASSETDIR"/tmp/rom.z64 | awk '{ print $1 }') @@ -36,22 +40,19 @@ while [[ ! -e "$PWD"/oot.otr ]]; do echo "Processing..." fi assets/extractor/ZAPD.out ed -eh -i assets/extractor/xmls/"${ROM}" -b tmp/rom.z64 -fl assets/extractor/filelists -o placeholder -osf placeholder -gsf 1 -rconf assets/extractor/Config_"${ROM}".xml -se OTR > /dev/null 2>&1 - cp "$ASSETDIR"/oot.otr "$OLDPWD" + cp "$ASSETDIR"/oot.otr "$SHIP_HOME" echo "Restart $APPIMAGE to play!" sleep 3 rm -r "$ASSETDIR" break else if [ -n "$ZENITY" ]; then - zenity --error --timeout=5 --text="Place ROM in $OWD" --title="Missing ROM file" --width=500 --width=200 + zenity --error --timeout=5 --text="Place ROM in $SHIP_HOME" --title="Missing ROM file" --width=500 --width=200 else echo -e "\nPlace ROM in this folder\n" fi exit fi done - cd "$OWD" - ln -s "$HERE"/usr/bin/gamecontrollerdb.txt "$PWD" - "$HERE"/usr/bin/soh.elf - unlink "$PWD"/gamecontrollerdb.txt + (cd "$HERE/usr/bin"; ./soh.elf) exit diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index a8693eb35..514c607ba 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -1758,15 +1758,15 @@ if(MSVC) if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") target_compile_options(${PROJECT_NAME} PRIVATE $<$: - /sdl-; - /w + /w; + /Od > $<$: /Oi; - /sdl-; /Gy; /W3 > + /sdl-; /permissive-; /MP; ${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT}; @@ -2003,14 +2003,6 @@ elseif(NOT "${CMAKE_SYSTEM_NAME}" MATCHES "NintendoSwitch|CafeOS") INSTALL(FILES ${CMAKE_BINARY_DIR}/gamecontrollerdb.txt DESTINATION . COMPONENT ship) endif() -if("${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin") -install(CODE " - include(InstallRequiredSystemLibraries) - include(BundleUtilities) - fixup_bundle(\"\${CMAKE_INSTALL_PREFIX}/soh-macos\" \"\" \"${dirs}\") - ") -endif() - if(CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS") if (NOT TARGET pathconf) add_library(pathconf OBJECT platform/pathconf.c) diff --git a/soh/include/z64actor.h b/soh/include/z64actor.h index cd58ac20b..01eb28a1d 100644 --- a/soh/include/z64actor.h +++ b/soh/include/z64actor.h @@ -271,7 +271,8 @@ typedef enum { /* 0x16 */ ITEM00_SHIELD_HYLIAN, /* 0x17 */ ITEM00_TUNIC_ZORA, /* 0x18 */ ITEM00_TUNIC_GORON, - /* 0x19 */ ITEM00_BOMBS_SPECIAL + /* 0x19 */ ITEM00_BOMBS_SPECIAL, + /* 0x20 */ ITEM00_BOMBCHU, } Item00Type; struct EnItem00; diff --git a/soh/include/z64player.h b/soh/include/z64player.h index 72d28e7c2..b910ce3e2 100644 --- a/soh/include/z64player.h +++ b/soh/include/z64player.h @@ -359,7 +359,7 @@ typedef struct { /* 0x00 */ s32 active; /* 0x04 */ Vec3f tip; /* 0x10 */ Vec3f base; -} WeaponInfo; // size = 0x1C\ +} WeaponInfo; // size = 0x1C typedef enum { FLAG_NONE, diff --git a/soh/soh/Enhancements/bootcommands.c b/soh/soh/Enhancements/bootcommands.c index fc6d043e2..05381b446 100644 --- a/soh/soh/Enhancements/bootcommands.c +++ b/soh/soh/Enhancements/bootcommands.c @@ -25,6 +25,7 @@ void BootCommands_Init() CVar_RegisterS32("gDebugEnabled", 0); CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom + CVar_RegisterS32("gInvertYAxis", 1); #if defined(__SWITCH__) || defined(__WIIU__) CVar_RegisterS32("gControlNav", 1); // always enable controller nav on switch/wii u #endif diff --git a/soh/soh/Enhancements/controls/GameControlEditor.cpp b/soh/soh/Enhancements/controls/GameControlEditor.cpp index dc8d992e8..ee8e33dea 100644 --- a/soh/soh/Enhancements/controls/GameControlEditor.cpp +++ b/soh/soh/Enhancements/controls/GameControlEditor.cpp @@ -216,7 +216,27 @@ namespace GameControlEditor { ImGui::EndTable(); } - void DrawUI(bool& open) { + void DrawCameraControlPanel() { + if (!ImGui::CollapsingHeader("Camera Controls")) { + return; + } + + ImVec2 cursor = ImGui::GetCursorPos(); + ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); + SohImGui::PaddedEnhancementCheckbox("Invert Camera X Axis", "gInvertXAxis"); + SohImGui::Tooltip("Inverts the Camera X Axis in:\n-Free camera\n-C-Up view\n-Weapon Aiming"); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5); + SohImGui::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis"); + SohImGui::Tooltip("Inverts the Camera Y Axis in:\n-Free camera\n-C-Up view\n-Weapon Aiming"); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5); + SohImGui::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming"); + SohImGui::Tooltip("Allows for aiming with the rights stick when:\n-Aiming in the C-Up view\n-Aiming with weapons"); + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5); + SohImGui::PaddedEnhancementCheckbox("Auto-Center First Person View", "gAutoCenterView"); + SohImGui::Tooltip("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming"); + } + + void DrawUI(bool& open) { if (!open) { CVar_SetS32("gGameControlEditorEnabled", false); return; @@ -225,6 +245,7 @@ namespace GameControlEditor { ImGui::SetNextWindowSize(ImVec2(465, 430), ImGuiCond_FirstUseEver); if (ImGui::Begin("Game Controls Configuration", &open)) { DrawOcarinaControlPanel(); + DrawCameraControlPanel(); } ImGui::End(); } diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 52e81ea24..b8bae4d17 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -3,83 +3,14 @@ #include #include +#include +#include #include -/** - * Colors variables - */ -float TablesCellsWidth = 300.0f; //1 Col -ImVec4 hearts_colors; -ImVec4 hearts_dd_colors; -ImVec4 hearts_ddi_colors; //DD inner colors -ImVec4 a_btn_colors; -ImVec4 b_btn_colors; -ImVec4 c_btn_colors; -ImVec4 start_btn_colors; -ImVec4 magic_border_colors; -ImVec4 magic_remaining_colors; -ImVec4 magic_use_colors; -ImVec4 minimap_colors; -ImVec4 rupee_colors; -ImVec4 smolekey_colors; -ImVec4 fileselect_colors; -ImVec4 fileselect_text_colors; -ImVec4 kokiri_col; -ImVec4 goron_col; -ImVec4 zora_col; -ImVec4 navi_idle_i_col; -ImVec4 navi_idle_o_col; -ImVec4 navi_npc_i_col; -ImVec4 navi_npc_o_col; -ImVec4 navi_enemy_i_col; -ImVec4 navi_enemy_o_col; -ImVec4 navi_prop_i_col; -ImVec4 navi_prop_o_col; -ImVec4 trailscol; -ImVec4 c_btn_u_colors; -ImVec4 c_btn_l_colors; -ImVec4 c_btn_d_colors; -ImVec4 c_btn_r_colors; -ImVec4 magic_bordern_colors; -ImVec4 firearrow_col; -ImVec4 icearrow_col; -ImVec4 lightarrow_col; -ImVec4 firearrow_colenv; -ImVec4 icearrow_colenv; -ImVec4 lightarrow_colenv; -ImVec4 charged1_col; -ImVec4 charged2_col; -ImVec4 charged1_colenv; -ImVec4 charged2_colenv; -ImVec4 Keese1_primcol; -ImVec4 Keese2_primcol; -ImVec4 Keese1_envcol; -ImVec4 Keese2_envcol; -ImVec4 doggo1col; -ImVec4 doggo2col; -ImVec4 df_col; -ImVec4 df_colenv; -ImVec4 nl_diam_col; -ImVec4 nl_diam_colenv; -ImVec4 nl_orb_col; -ImVec4 nl_orb_colenv; -ImVec4 dgn_minimap_colors; -ImVec4 cp_minimap_colors; -ImVec4 le_minimap_colors; -ImVec4 tc_ou_colors; -ImVec4 tc_bu_colors; -ImVec4 dpad_colors; -ImVec4 visualagony_colors; -/*ImVec4 menu_equips_colors; -ImVec4 menu_items_colors; -ImVec4 menu_map_colors; -ImVec4 menu_quest_colors; -ImVec4 menu_save_colors; -ImVec4 menu_gameover_colors;*/ const char* RainbowColorCvarList[] = { //This is the list of possible CVars that has rainbow effect. - "gTunic_Kokiri_", "gTunic_Goron_", "gTunic_Zora_", - "gFireArrowCol", "gIceArrowCol", "gTunic_Zora_", + "gTunic_Kokiri", "gTunic_Goron", "gTunic_Zora", + "gFireArrowCol", "gIceArrowCol", "gFireArrowColEnv", "gIceArrowColEnv", "gLightArrowColEnv", "gCCHeartsPrim", "gDDCCHeartsPrim", "gLightArrowCol", "gCCDDHeartsPrim", "gCCABtnPrim", "gCCBBtnPrim", "gCCCBtnPrim", "gCCStartBtnPrim", @@ -88,11 +19,11 @@ const char* RainbowColorCvarList[] = { "gCCMinimapPrim", "gCCMinimapDGNPrim", "gCCMinimapCPPrim", "gCCMinimapLEPrim", "gCCRupeePrim", "gCCKeysPrim", "gDog1Col", "gDog2Col", "gCCVSOAPrim", "gKeese1_Ef_Prim","gKeese2_Ef_Prim","gKeese1_Ef_Env","gKeese2_Ef_Env", - "gDF_Col", "gDF_Env", + "gDF_Col", "gDF_Env", "gNL_Diamond_Col", "gNL_Diamond_Env", "gNL_Orb_Col", "gNL_Orb_Env", "gTrailCol", "gCharged1Col", "gCharged1ColEnv", "gCharged2Col", "gCharged2ColEnv", "gCCFileChoosePrim", "gCCFileChooseTextPrim", "gCCEquipmentsPrim", "gCCItemsPrim", - "gCCMapsPrim", "gCCQuestsPrim", "gCCSavePrim", "gCCGameoverPrim", + "gCCMapsPrim", "gCCQuestsPrim", "gCCSavePrim", "gCCGameoverPrim" }; const char* MarginCvarList[] { "gHearts", "gMagicBar", "gVSOA", "gBBtn", "gABtn", "gStartBtn", @@ -100,6 +31,57 @@ const char* MarginCvarList[] { "gSKC", "gRC", "gCarrots", "gTimers", "gAS", "gTCM", "gTCB" }; +ImVec4 GetRandomValue(int MaximumPossible){ + ImVec4 NewColor; + unsigned long range = 255 - 0; + std::random_device rd; + std::mt19937 rng(rd()); + std::uniform_int_distribution dist(0, 255 - 1); + + NewColor.x = (float)(dist(rng)) / 255; + NewColor.y = (float)(dist(rng)) / 255; + NewColor.z = (float)(dist(rng)) / 255; + return NewColor; +} +void GetRandomColorRGB(CosmeticsColorSection* ColorSection, int SectionSize){ + //std::random_shuffle(ColorSection, ColorSection + SectionSize); + for (int i = 0; i < SectionSize; i++){ + CosmeticsColorIndividual* Element = ColorSection[i].Element; + ImVec4 colors = Element->ModifiedColor; + Color_RGBA8 NewColors = { 0, 0, 0, 255 }; + std::string cvarName = Element->CvarName; + std::string Cvar_RBM = cvarName + "RBM"; + colors = RANDOMIZE_32(255); + NewColors.r = SohImGui::ClampFloatToInt(colors.x * 255, 0, 255); + NewColors.g = SohImGui::ClampFloatToInt(colors.y * 255, 0, 255); + NewColors.b = SohImGui::ClampFloatToInt(colors.z * 255, 0, 255); + Element->ModifiedColor = colors; + CVar_SetRGBA(cvarName.c_str(), NewColors); + CVar_SetS32(Cvar_RBM.c_str(), 0); + } +} +void GetDefaultColorRGB(CosmeticsColorSection* ColorSection, int SectionSize){ + for (int i = 0; i < SectionSize; i++){ + CosmeticsColorIndividual* Element = ColorSection[i].Element; + ImVec4 colors = Element->ModifiedColor; + ImVec4 defaultcolors = Element->DefaultColor; + std::string cvarName = Element->CvarName; + std::string Cvar_RBM = cvarName + "RBM"; + colors.x = defaultcolors.x; + colors.y = defaultcolors.y; + colors.z = defaultcolors.z; + if (Element->hasAlpha) { colors.w = defaultcolors.w; }; + Element->ModifiedColor = colors; + Color_RGBA8 colorsRGBA; + colorsRGBA.r = defaultcolors.x; + colorsRGBA.g = defaultcolors.y; + colorsRGBA.b = defaultcolors.z; + if (Element->hasAlpha) { colorsRGBA.a = defaultcolors.w; }; + CVar_SetRGBA(cvarName.c_str(), colorsRGBA); + CVar_SetS32(Cvar_RBM.c_str(), 0); //On click disable rainbow mode. + + } +} void SetMarginAll(const char* ButtonName, bool SetActivated) { if (ImGui::Button(ButtonName)) { u8 arrayLength = sizeof(MarginCvarList) / sizeof(*MarginCvarList); @@ -142,12 +124,6 @@ void LoadRainbowColor(bool& open) { u8 arrayLength = sizeof(RainbowColorCvarList) / sizeof(*RainbowColorCvarList); for (u8 s = 0; s < arrayLength; s++) { std::string cvarName = RainbowColorCvarList[s]; - std::string Cvar_Red = cvarName; - Cvar_Red += "R"; - std::string Cvar_Green = cvarName; - Cvar_Green += "G"; - std::string Cvar_Blue = cvarName; - Cvar_Blue += "B"; std::string Cvar_RBM = cvarName; Cvar_RBM += "RBM"; std::string RBM_HUE = cvarName; @@ -173,11 +149,14 @@ void LoadRainbowColor(bool& open) { case 5: NewColor.x = b; NewColor.y = 0; NewColor.z = 255; break; case 6: NewColor.x = 255; NewColor.y = 0; NewColor.z = a; break; } - + Color_RGBA8 NewColorRGB = { + SohImGui::ClampFloatToInt(NewColor.x, 0, 255), + SohImGui::ClampFloatToInt(NewColor.y, 0, 255), + SohImGui::ClampFloatToInt(NewColor.z, 0, 255), + 255 + }; if (CVar_GetS32(Cvar_RBM.c_str(), 0) != 0) { - CVar_SetS32(Cvar_Red.c_str(), SohImGui::ClampFloatToInt(NewColor.x, 0, 255)); - CVar_SetS32(Cvar_Green.c_str(), SohImGui::ClampFloatToInt(NewColor.y, 0, 255)); - CVar_SetS32(Cvar_Blue.c_str(), SohImGui::ClampFloatToInt(NewColor.z, 0, 255)); + CVar_SetRGBA(cvarName.c_str(), NewColorRGB); } } } @@ -190,7 +169,7 @@ void Table_InitHeader(bool has_header = true) { ImGui::TableNextColumn(); ImGui::AlignTextToFramePadding(); //This is to adjust Vertical pos of item in a cell to be normlized. ImGui::SetCursorPosX(ImGui::GetCursorPosX() - 2); - ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); + ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x-60); } void Table_NextCol() { ImGui::TableNextColumn(); @@ -216,161 +195,244 @@ void Draw_HelpIcon(const std::string& helptext, bool sameline = true, int Pos = } ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); } +void DrawUseMarginsSlider(const std::string ElementName, const std::string CvarName){ + std::string CvarLabel = CvarName + "UseMargins"; + std::string Label = ElementName + " use margins"; + SohImGui::EnhancementCheckbox(Label.c_str(), CvarLabel.c_str()); + SohImGui::Tooltip("Using this allow you move the element with General margins sliders"); +} +void DrawPositionsRadioBoxes(const std::string CvarName, bool NoAnchorEnabled = true){ + std::string CvarLabel = CvarName + "PosType"; + SohImGui::EnhancementRadioButton("Original position", CvarLabel.c_str(), 0); + SohImGui::Tooltip("This will use original intended elements position"); + SohImGui::EnhancementRadioButton("Anchor to the left", CvarLabel.c_str(), 1); + SohImGui::Tooltip("This will make your elements follow the left side of your game window"); + SohImGui::EnhancementRadioButton("Anchor to the right", CvarLabel.c_str(), 2); + SohImGui::Tooltip("This will make your elements follow the right side of your game window"); + if (NoAnchorEnabled) { + SohImGui::EnhancementRadioButton("No anchors", CvarLabel.c_str(), 3); + SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements"); + } + SohImGui::EnhancementRadioButton("Hidden", CvarLabel.c_str(), 4); + SohImGui::Tooltip("This will make your elements hidden"); +} +void DrawTransitions(const std::string CvarName){ + SohImGui::EnhancementRadioButton("Really slow fade (white)", CvarName.c_str(), 8); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Really slow fade (black)", CvarName.c_str(), 7); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Slow fade (white)", CvarName.c_str(), 10); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Slow fade (black)", CvarName.c_str(), 9); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Normal fade (white)", CvarName.c_str(), 3); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Normal fade (black)", CvarName.c_str(), 2); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Fast fade (white)", CvarName.c_str(), 5); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Fast fade (black)", CvarName.c_str(), 4); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Fast circle (white)", CvarName.c_str(), 40); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Normal circle (black)", CvarName.c_str(), 32); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Slow circle (white)", CvarName.c_str(), 41); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Slow circle (black)", CvarName.c_str(), 33); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Fast noise circle (white)", CvarName.c_str(), 42); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Fast noise circle (black)", CvarName.c_str(), 34); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Slow noise circle (white)", CvarName.c_str(), 43); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Slow noise circle (black)", CvarName.c_str(), 35); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Normal waves circle (white)", CvarName.c_str(), 44); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Normal waves circle (black)", CvarName.c_str(), 36); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Slow waves circle (white)", CvarName.c_str(), 45); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Slow waves circle (black)", CvarName.c_str(), 37); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Normal close circle (white)", CvarName.c_str(), 46); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Normal close circle (black)", CvarName.c_str(), 38); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Slow close circle (white)", CvarName.c_str(), 47); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Slow close circle (black)", CvarName.c_str(), 39); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Super fast circle (white)", CvarName.c_str(), 56); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Super fast circle (black)", CvarName.c_str(), 58); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Super fast noise circle (white)", CvarName.c_str(), 57); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Super fast noise circle (black)", CvarName.c_str(), 59); +} +void DrawPositionSlider(const std::string CvarName, int MinY, int MaxY, int MinX, int MaxX){ + std::string PosXCvar = CvarName+"PosX"; + std::string PosYCvar = CvarName+"PosY"; + std::string InvisibleLabelX = "##"+PosXCvar; + std::string InvisibleLabelY = "##"+PosYCvar; + SohImGui::EnhancementSliderInt("Up <-> Down : %d", InvisibleLabelY.c_str(), PosYCvar.c_str(), MinY, MaxY, "", 0, true); + SohImGui::Tooltip("This slider is used to move Up and Down your elements."); + SohImGui::EnhancementSliderInt("Left <-> Right : %d", InvisibleLabelX.c_str(), PosXCvar.c_str(), MinX, MaxX, "", 0, true); + SohImGui::Tooltip("This slider is used to move Left and Right your elements."); +} +void DrawScaleSlider(const std::string CvarName,float DefaultValue){ + std::string InvisibleLabel = "##"+CvarName; + std::string CvarLabel = CvarName+"Scale"; + //Disabled for now. feature not done and several fixes needed to be merged. + //SohImGui::EnhancementSliderFloat("Scale : %dx", InvisibleLabel.c_str(), CvarLabel.c_str(), 0.1f, 3.0f,"",DefaultValue,true,true); +} +void DrawColorSection(CosmeticsColorSection* ColorSection, int SectionSize) { + for (s16 i = 0; i < SectionSize; i++) { + CosmeticsColorIndividual* ThisElement = ColorSection[i].Element; + const std::string Tooltip = ThisElement->ToolTip; + const std::string Name = ThisElement->Name; + const std::string Cvar = ThisElement->CvarName; + ImVec4 ModifiedColor = ThisElement->ModifiedColor; + ImVec4 DefaultColor = ThisElement->DefaultColor; + bool canRainbow = ThisElement->canRainbow; + bool hasAlpha = ThisElement->hasAlpha; + bool sameLine = ThisElement->sameLine; + bool Nextcol = ColorSection[i].Nextcol; + bool NextLine = ColorSection[i].NextLine; + if (Nextcol){ + Table_NextCol(); + } + if (NextLine){ + Table_NextLine(); + } + Draw_HelpIcon(Tooltip.c_str()); + SohImGui::EnhancementColor(Name.c_str(), Cvar.c_str(), ModifiedColor, DefaultColor, canRainbow, hasAlpha, sameLine); + } +} +void DrawRandomizeResetButton(const std::string Identifier, CosmeticsColorSection* ColorSection, int SectionSize, bool isAllCosmetics = false){ + std::string TableName = Identifier+"_Table"; + std::string Col1Name = Identifier+"_Col1"; + std::string Col2Name = Identifier+"_Col2"; + std::string Tooltip_RNG = "Affect "+Identifier+" colors"; + std::string RNG_BtnText = "Randomize : "+Identifier; + std::string Reset_BtnText = "Reset : "+Identifier; + if (ImGui::BeginTable(TableName.c_str(), 2, FlagsTable)) { + ImGui::TableSetupColumn(Col1Name.c_str(), FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn(Col2Name.c_str(), FlagsCell, TablesCellsWidth/2); + Table_InitHeader(false); + if(ImGui::Button(RNG_BtnText.c_str(), ImVec2( ImGui::GetContentRegionAvail().x, 20.0f))){ + CVar_SetS32("gHudColors", 2); + CVar_SetS32("gUseNaviCol", 1); + CVar_SetS32("gUseKeeseCol", 1); + CVar_SetS32("gUseDogsCol", 1); + CVar_SetS32("gUseTunicsCol", 1); + CVar_SetS32("gUseArrowsCol", 1); + CVar_SetS32("gUseSpellsCol", 1); + CVar_SetS32("gUseChargedCol", 1); + CVar_SetS32("gUseTrailsCol", 1); + CVar_SetS32("gCCparated", 1); + GetRandomColorRGB(ColorSection, SectionSize); + } + SohImGui::Tooltip(Tooltip_RNG.c_str()); + Table_NextCol(); + if(ImGui::Button(Reset_BtnText.c_str(), ImVec2( ImGui::GetContentRegionAvail().x, 20.0f))){ + GetDefaultColorRGB(ColorSection, SectionSize); + } + SohImGui::Tooltip("Enable/Disable custom Link's tunics colors\nIf disabled you will have original colors for Link's tunics."); + SohImGui::Tooltip(Tooltip_RNG.c_str()); + ImGui::EndTable(); + } +} + void Draw_Npcs(){ + DrawRandomizeResetButton("all NPCs", NPCs_section, SECTION_SIZE(NPCs_section)); SohImGui::EnhancementCheckbox("Custom colors for Navi", "gUseNaviCol"); SohImGui::Tooltip("Enable/Disable custom Navi colors\nIf disabled, default colors will be used\nColors go into effect when Navi goes back into your pockets"); - if (CVar_GetS32("gUseNaviCol",0) && ImGui::BeginTable("tableNavi", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Inner colors##Navi", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); - ImGui::TableSetupColumn("Outer colors##Navi", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); + if (CVar_GetS32("gUseNaviCol",0)) { + DrawRandomizeResetButton("Navi's", Navi_Section, SECTION_SIZE(Navi_Section)); + }; + if (CVar_GetS32("gUseNaviCol",0) && ImGui::BeginTable("tableNavi", 2, FlagsTable)) { + ImGui::TableSetupColumn("Inner colors##Navi", FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn("Outer colors##Navi", FlagsCell, TablesCellsWidth/2); Table_InitHeader(); - Draw_HelpIcon("Inner color for Navi (idle flying around)"); - SohImGui::EnhancementColor("Navi Idle (Primary)", "gNavi_Idle_Inner", navi_idle_i_col, ImVec4(255, 255, 255, 255), false); - Table_NextCol(); - Draw_HelpIcon("Outer color for Navi (idle flying around)"); - SohImGui::EnhancementColor("Navi Idle (Secondary)", "gNavi_Idle_Outer", navi_idle_o_col, ImVec4(0, 0, 255, 255), false); - Table_NextLine(); - Draw_HelpIcon("Inner color for Navi (when Navi fly around NPCs)"); - SohImGui::EnhancementColor("Navi NPC (Primary)", "gNavi_NPC_Inner", navi_npc_i_col, ImVec4(150, 150, 255, 255), false); - Table_NextCol(); - Draw_HelpIcon("Outer color for Navi (when Navi fly around NPCs)"); - SohImGui::EnhancementColor("Navi NPC (Secondary)", "gNavi_NPC_Outer", navi_npc_o_col, ImVec4(150, 150, 255, 255), false); - Table_NextLine(); - Draw_HelpIcon("Inner color for Navi (when Navi fly around Enemies or Bosses)"); - SohImGui::EnhancementColor("Navi Enemy", "gNavi_Enemy_Inner", navi_enemy_i_col, ImVec4(255, 255, 0, 255), false); - Table_NextCol(); - Draw_HelpIcon("Outer color for Navi (when Navi fly around Enemies or Bosses)"); - SohImGui::EnhancementColor("Navi Enemy (Secondary)", "gNavi_Enemy_Outer", navi_enemy_o_col, ImVec4(220, 155, 0, 255), false); - Table_NextLine(); - Draw_HelpIcon("Inner color for Navi (when Navi fly around props (signs etc))"); - SohImGui::EnhancementColor("Navi Prop (Primary)", "gNavi_Prop_Inner", navi_prop_i_col, ImVec4(0, 255, 0, 255), false); - Table_NextCol(); - Draw_HelpIcon("Outer color for Navi (when Navi fly around props (signs etc))"); - SohImGui::EnhancementColor("Navi Prop (Secondary)", "gNavi_Prop_Outer", navi_prop_o_col, ImVec4(0, 255, 0, 255), false); + DrawColorSection(Navi_Section, SECTION_SIZE(Navi_Section)); ImGui::EndTable(); } SohImGui::EnhancementCheckbox("Custom colors for Keese", "gUseKeeseCol"); SohImGui::Tooltip("Enable/Disable custom Keese element colors\nIf disabled, default element colors will be used\nColors go into effect when Keese respawn (or when the room is reloaded)"); - if (CVar_GetS32("gUseKeeseCol",0) && ImGui::BeginTable("tableKeese", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Fire colors##Keese", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); - ImGui::TableSetupColumn("Ice colors##Keese", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); - Table_InitHeader(false); - Draw_HelpIcon("Affects the primary color of the Fire itself of the Keese"); - SohImGui::EnhancementColor("Fire Primary color", "gKeese1_Ef_Prim", Keese1_primcol, ImVec4(255, 255, 100, 255)); - Table_NextCol(); - Draw_HelpIcon("Affects the primary color of the Ice itself of the Keese"); - SohImGui::EnhancementColor("Ice Primary color", "gKeese2_Ef_Prim", Keese2_primcol, ImVec4(100, 200, 255, 255)); - Table_NextLine(); - Draw_HelpIcon("Affects the secondary color of the Fire itself of the Keese"); - SohImGui::EnhancementColor("Fire Secondary color", "gKeese1_Ef_Env", Keese1_envcol, ImVec4(255, 50, 0, 255)); - Table_NextCol(); - Draw_HelpIcon("Affects the secondary color of the Ice itself of the Keese"); - SohImGui::EnhancementColor("Ice Secondary color", "gKeese2_Ef_Env", Keese2_envcol, ImVec4(0, 0, 255, 255)); + if (CVar_GetS32("gUseKeeseCol",0) && ImGui::BeginTable("tableKeese", 2, FlagsTable)) { + ImGui::TableSetupColumn("Fire colors##Keese", FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn("Ice colors##Keese", FlagsCell, TablesCellsWidth/2); + Table_InitHeader(); + DrawColorSection(Keese_Section, SECTION_SIZE(Keese_Section)); ImGui::EndTable(); } SohImGui::EnhancementCheckbox("Custom colors for Dogs", "gUseDogsCol"); SohImGui::Tooltip("Enable/Disable custom colors for the two Dog variants\nIf disabled, default colors will be used"); - if (CVar_GetS32("gUseDogsCol",0) && ImGui::BeginTable("tableDogs", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Dog N.1 color", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); - ImGui::TableSetupColumn("Dog N.2 color", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); + if (CVar_GetS32("gUseDogsCol",0) && ImGui::BeginTable("tableDogs", 2, FlagsTable)) { + ImGui::TableSetupColumn("White Dog color", FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn("Brown Dog color", FlagsCell, TablesCellsWidth/2); Table_InitHeader(); - Draw_HelpIcon("Affects the colors of the white dog"); - SohImGui::EnhancementColor("Dog white", "gDog1Col", doggo1col, ImVec4(255,255,200,255), true, false, true); - Table_NextCol(); - Draw_HelpIcon("Affects the colors of the brown dog"); - SohImGui::EnhancementColor("Dog brown", "gDog2Col", doggo2col, ImVec4(150,100,50,255), true, false, true); + DrawColorSection(Dogs_Section, SECTION_SIZE(Dogs_Section)); ImGui::EndTable(); } } void Draw_ItemsSkills(){ + DrawRandomizeResetButton("all skills and items", AllItemsSkills_section, SECTION_SIZE(AllItemsSkills_section)); SohImGui::EnhancementCheckbox("Custom tunics color", "gUseTunicsCol"); SohImGui::Tooltip("Enable/Disable custom Link's tunics colors\nIf disabled you will have original colors for Link's tunics."); - if (CVar_GetS32("gUseTunicsCol",0) && ImGui::BeginTable("tableTunics", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Kokiri Tunic", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/3); - ImGui::TableSetupColumn("Goron Tunic", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/3); - ImGui::TableSetupColumn("Zora Tunic", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/3); + if (CVar_GetS32("gUseTunicsCol",0)) { + DrawRandomizeResetButton("Link's tunics", Tunics_Section, SECTION_SIZE(Tunics_Section)); + }; + if (CVar_GetS32("gUseTunicsCol",0) && ImGui::BeginTable("tableTunics", 3, FlagsTable)) { + ImGui::TableSetupColumn("Kokiri Tunic", FlagsCell, TablesCellsWidth/3); + ImGui::TableSetupColumn("Goron Tunic", FlagsCell, TablesCellsWidth/3); + ImGui::TableSetupColumn("Zora Tunic", FlagsCell, TablesCellsWidth/3); Table_InitHeader(); - Draw_HelpIcon("Affects Kokiri Tunic color", false); - SohImGui::EnhancementColor("Kokiri Tunic", "gTunic_Kokiri_", kokiri_col, ImVec4(30, 105, 27, 255), true, false, true); - Table_NextCol(); - Draw_HelpIcon("Affects Goron Tunic color", false); - SohImGui::EnhancementColor("Goron Tunic", "gTunic_Goron_", goron_col, ImVec4(100, 20, 0, 255), true, false, true); - Table_NextCol(); - Draw_HelpIcon("Affects Zora Tunic color", false); - SohImGui::EnhancementColor("Zora Tunic", "gTunic_Zora_", zora_col, ImVec4(0, 60, 100, 255), true, false, true); + DrawColorSection(Tunics_Section, SECTION_SIZE(Tunics_Section)); ImGui::EndTable(); } SohImGui::EnhancementCheckbox("Custom arrows colors", "gUseArrowsCol"); - if (CVar_GetS32("gUseArrowsCol",0) && ImGui::BeginTable("tableArrows", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Primary colors##Arrows", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); - ImGui::TableSetupColumn("Env colors##Arrows", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); + if (CVar_GetS32("gUseArrowsCol",0)) { + DrawRandomizeResetButton("elemental arrows", Arrows_section, SECTION_SIZE(Arrows_section)); + } + if (CVar_GetS32("gUseArrowsCol",0) && ImGui::BeginTable("tableArrows", 2, FlagsTable)) { + ImGui::TableSetupColumn("Primary colors##Arrows", FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn("Env colors##Arrows", FlagsCell, TablesCellsWidth/2); Table_InitHeader(); - Draw_HelpIcon("Affects Primary color"); - SohImGui::EnhancementColor("Fire Arrows (primary)", "gFireArrowCol", firearrow_col, ImVec4(255,200,0,255)); - Table_NextCol(); - Draw_HelpIcon("Affects Secondary color"); - SohImGui::EnhancementColor("Fire Arrows", "gFireArrowColEnv", firearrow_colenv, ImVec4(255,0,0,255)); - Table_NextLine(); - Draw_HelpIcon("Affects Primary color"); - SohImGui::EnhancementColor("Ice Arrows (primary)", "gIceArrowCol", icearrow_col, ImVec4(170,255,255,255)); - Table_NextCol(); - Draw_HelpIcon("Affects Secondary color"); - SohImGui::EnhancementColor("Ice Arrows", "gIceArrowColEnv", icearrow_colenv, ImVec4(0,0,255,255)); - Table_NextLine(); - Draw_HelpIcon("Affects Primary color"); - SohImGui::EnhancementColor("Light Arrows (primary)", "gLightArrowCol", lightarrow_col, ImVec4(255,255,170,255)); - Table_NextCol(); - Draw_HelpIcon("Affects Secondary color"); - SohImGui::EnhancementColor("Light Arrows", "gLightArrowColEnv", lightarrow_colenv, ImVec4(255,255,0,255)); + DrawColorSection(Arrows_section, SECTION_SIZE(Arrows_section)); ImGui::EndTable(); } SohImGui::EnhancementCheckbox("Custom spells colors", "gUseSpellsCol"); - if (CVar_GetS32("gUseSpellsCol",0) && ImGui::BeginTable("tableSpells", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Inner colors##Spells", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); - ImGui::TableSetupColumn("Outer colors##Spells", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); + if (CVar_GetS32("gUseSpellsCol",0)) { + DrawRandomizeResetButton("spells", Spells_section, SECTION_SIZE(Spells_section)); + } + if (CVar_GetS32("gUseSpellsCol",0) && ImGui::BeginTable("tableSpells", 2, FlagsTable)) { + ImGui::TableSetupColumn("Inner colors##Spells", FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn("Outer colors##Spells", FlagsCell, TablesCellsWidth/2); Table_InitHeader(); - Draw_HelpIcon("Affects Primary color"); - SohImGui::EnhancementColor("Din's Fire (primary)", "gDF_Col", df_col, ImVec4(255,200,0,255)); - Table_NextCol(); - Draw_HelpIcon("Affects Secondary color"); - SohImGui::EnhancementColor("Din's Fire", "gDF_Env", df_colenv, ImVec4(255,0,0,255)); - Table_NextLine(); - Draw_HelpIcon("Affects Primary color"); - SohImGui::EnhancementColor("Nayru's Love Diamond (primary)", "gNL_Diamond_Col", nl_diam_col, ImVec4(170,255,255,255)); - Table_NextCol(); - Draw_HelpIcon("Affects Secondary color"); - SohImGui::EnhancementColor("Nayru's Love Diamond", "gNL_Diamond_Env", nl_diam_colenv, ImVec4(100,255,128,255)); - Table_NextLine(); - Draw_HelpIcon("Affects Primary color"); - SohImGui::EnhancementColor("Nayru's Love Orb (primary)", "gNL_Orb_Col", nl_orb_col, ImVec4(170,255,255,255)); - Table_NextCol(); - Draw_HelpIcon("Affects Secondary color"); - SohImGui::EnhancementColor("Nayru's Love Orb", "gNL_Orb_Env", nl_orb_colenv, ImVec4(150,255,255,255)); + DrawColorSection(Spells_section, SECTION_SIZE(Spells_section)); ImGui::EndTable(); } SohImGui::EnhancementCheckbox("Custom spin attack colors", "gUseChargedCol"); - if (CVar_GetS32("gUseChargedCol",0) && ImGui::BeginTable("tableChargeAtk", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Primary colors##Charge", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); - ImGui::TableSetupColumn("Env colors##Charge", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); + if (CVar_GetS32("gUseChargedCol",0)) { + DrawRandomizeResetButton("spins attack", SpinAtk_section, SECTION_SIZE(SpinAtk_section)); + } + if (CVar_GetS32("gUseChargedCol",0) && ImGui::BeginTable("tableChargeAtk", 2, FlagsTable)) { + ImGui::TableSetupColumn("Primary colors##Charge", FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn("Env colors##Charge", FlagsCell, TablesCellsWidth/2); Table_InitHeader(); - Draw_HelpIcon("Affects Primary color"); - SohImGui::EnhancementColor("Level 1 color (primary)", "gCharged1Col", charged1_col, ImVec4(170,255,255,255)); - Table_NextCol(); - Draw_HelpIcon("Affects Secondary color"); - SohImGui::EnhancementColor("Level 1 color", "gCharged1ColEnv", charged1_colenv, ImVec4(0,100,255,255)); - Table_NextLine(); - Draw_HelpIcon("Affects Primary color"); - SohImGui::EnhancementColor("Level 2 color (primary)", "gCharged2Col", charged2_col, ImVec4(255,255,170,255)); - Table_NextCol(); - Draw_HelpIcon("Affects Secondary color"); - SohImGui::EnhancementColor("Level 2 color", "gCharged2ColEnv", charged2_colenv, ImVec4(255,100,0,255)); + DrawColorSection(SpinAtk_section, SECTION_SIZE(SpinAtk_section)); ImGui::EndTable(); } SohImGui::EnhancementCheckbox("Custom trails color", "gUseTrailsCol"); - if (CVar_GetS32("gUseTrailsCol",0) && ImGui::BeginTable("tabletrails", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Custom Trails", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (CVar_GetS32("gUseTrailsCol",0) && ImGui::BeginTable("tabletrails", 1, FlagsTable)) { + ImGui::TableSetupColumn("Custom Trails", FlagsCell, TablesCellsWidth); Table_InitHeader(); - Draw_HelpIcon("Affects Swords slash, boomerang and Bombchu trails color"); - SohImGui::EnhancementColor("Trails color", "gTrailCol", trailscol, ImVec4(255,255,255,255)); + DrawColorSection(Trails_section, SECTION_SIZE(Trails_section)); SohImGui::EnhancementSliderInt("Trails duration: %dx", "##TrailsMul", "gTrailDurantion", 1, 5, ""); SohImGui::Tooltip("The longer the trails the weirder it become"); ImGui::NewLine(); @@ -379,48 +441,20 @@ void Draw_ItemsSkills(){ } void Draw_Menus(){ if (CVar_GetS32("gHudColors",0) ==2 ){ - if (ImGui::BeginTable("tableFileChoose", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("File Choose color", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); - ImGui::TableSetupColumn("Bottom text color", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); + if (ImGui::BeginTable("tableFileChoose", 2, FlagsTable)) { + ImGui::TableSetupColumn("File Choose color", FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn("Bottom text color", FlagsCell, TablesCellsWidth/2); Table_InitHeader(); - Draw_HelpIcon("Affects the File Select menu background."); - SohImGui::EnhancementColor("File Choose color", "gCCFileChoosePrim", fileselect_colors, ImVec4(100, 150, 255, 255), true, false, true); - Table_NextCol(); - Draw_HelpIcon("Affects the File Select texts."); - SohImGui::EnhancementColor("Bottom text color", "gCCFileChooseTextPrim", fileselect_text_colors, ImVec4(100, 255, 255, 255), true, false, true); + DrawColorSection(FileChoose_section, SECTION_SIZE(FileChoose_section)); ImGui::EndTable(); } - /* - if (ImGui::BeginTable("tablePauseMenu", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Kaleido pages (Non working atm)", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); - Table_InitHeader(); - Draw_HelpIcon("Affect the Equipments menu background."); - SohImGui::EnhancementColor("Equipments", "gCCEquipmentsPrim", menu_equips_colors, ImVec4(0, 100, 255, 255), true, true); - Table_NextLine(); - Draw_HelpIcon("Affect the Select items menu background."); - SohImGui::EnhancementColor("Items", "gCCItemsPrim", menu_items_colors, ImVec4(0, 100, 255, 255), true, true); - Table_NextLine(); - Draw_HelpIcon("Affect the Map menu background."); - SohImGui::EnhancementColor("Maps", "gCCMapsPrim", menu_map_colors, ImVec4(0, 100, 255, 255), true, true); - Table_NextLine(); - Draw_HelpIcon("Affect the Quests statut menu background."); - SohImGui::EnhancementColor("Quests", "gCCQuestsPrim", menu_quest_colors, ImVec4(0, 100, 255, 255), true, true); - Table_NextLine(); - Draw_HelpIcon("Affect the Save menu background."); - SohImGui::EnhancementColor("Save", "gCCSavePrim", menu_save_colors, ImVec4(0, 100, 255, 255), true, true); - Table_NextLine(); - Draw_HelpIcon("Affect the Gameover screen background."); - SohImGui::EnhancementColor("Gameover", "gCCGameoverPrim", menu_gameover_colors, ImVec4(0, 100, 255, 255), true, true); - ImGui::EndTable(); - } - */ } else { ImGui::Text("To modify menus colors you need \"Custom Colors\" scheme\nto be selected in \"General\" tab.\nOnce enabled you will be able to modify the following colors:\nFile Choose color\nBottom text color"); } } void Draw_Placements(){ - if (ImGui::BeginTable("tableMargins", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("General margins settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableMargins", 1, FlagsTable)) { + ImGui::TableSetupColumn("General margins settings", FlagsCell, TablesCellsWidth); Table_InitHeader(); SohImGui::EnhancementSliderInt("Top : %dx", "##UIMARGINT", "gHUDMargin_T", (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0, true); SohImGui::EnhancementSliderInt("Left: %dx", "##UIMARGINL", "gHUDMargin_L", -25, ImGui::GetWindowViewport()->Size.x, "", 0, true); @@ -438,174 +472,90 @@ void Draw_Placements(){ ImGui::EndTable(); } if (ImGui::CollapsingHeader("Hearts count position")) { - if (ImGui::BeginTable("tableHeartsCounts", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Hearts counts settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableHeartsCounts", 1, FlagsTable)) { + ImGui::TableSetupColumn("Hearts counts settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Hearts count use margins", "gHeartsUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gHeartsCountPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gHeartsCountPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gHeartsCountPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gHeartsCountPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gHeartsCountPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##HeartCountPosY", "gHeartsPosY", -22, ImGui::GetWindowViewport()->Size.y, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##HeartCountPosX", "gHeartsPosX", -25, ImGui::GetWindowViewport()->Size.x, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("Hearts counts", "gHearts"); + DrawPositionsRadioBoxes("gHeartsCount"); + DrawPositionSlider("gHeartsCount",-22,ImGui::GetWindowViewport()->Size.y,-25,ImGui::GetWindowViewport()->Size.x); + DrawScaleSlider("gHeartsCount",0.7f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Magic Meter position")) { - if (ImGui::BeginTable("tablemmpos", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Magic meter settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tablemmpos", 1, FlagsTable)) { + ImGui::TableSetupColumn("Magic meter settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Magic meter use margins", "gMagicBarUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gMagicBarPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gMagicBarPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gMagicBarPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gMagicBarPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gMagicBarPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##MagicBarPosY", "gMagicBarPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##MagicBarPosX", "gMagicBarPosX", -5, ImGui::GetWindowViewport()->Size.x/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("Magic meter", "gMagicBar"); + DrawPositionsRadioBoxes("gMagicBar"); + DrawPositionSlider("gMagicBar", 0, ImGui::GetWindowViewport()->Size.y/2, -5, ImGui::GetWindowViewport()->Size.x/2); + DrawScaleSlider("gMagicBar",1.0f); ImGui::NewLine(); ImGui::EndTable(); } } if (CVar_GetS32("gVisualAgony",0) && ImGui::CollapsingHeader("Visual stone of agony position")) { - if (ImGui::BeginTable("tabledvisualstoneofagony", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Visual stone of agony settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tabledvisualstoneofagony", 1, FlagsTable)) { + ImGui::TableSetupColumn("Visual stone of agony settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Visual stone of agony use margins", "gVSOAUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gVSOAPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gVSOAPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gVSOAPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gVSOAPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gVSOAPosType", 4); //in case you want only SFX - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##VSOAPosY", "gVSOAPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - s16 Min_X_Dpad = 0; - s16 Max_X_Dpad = ImGui::GetWindowViewport()->Size.x/2; + DrawUseMarginsSlider("Visual stone of agony", "gVSOA"); + DrawPositionsRadioBoxes("gVSOA"); + s16 Min_X_VSOA = 0; + s16 Max_X_VSOA = ImGui::GetWindowViewport()->Size.x/2; if(CVar_GetS32("gVSOAPosType",0) == 2){ - Max_X_Dpad = 290; + Max_X_VSOA = 290; } else if(CVar_GetS32("gVSOAPosType",0) == 4){ - Min_X_Dpad = (ImGui::GetWindowViewport()->Size.x/2)*-1; + Min_X_VSOA = (ImGui::GetWindowViewport()->Size.x/2)*-1; } - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##VSOAPosX", "gVSOAPosX", Min_X_Dpad, Max_X_Dpad, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawPositionSlider("gVSOA", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_VSOA, Max_X_VSOA); + DrawScaleSlider("gVSOA",1.0f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("B Button position")) { - if (ImGui::BeginTable("tablebbtn", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("B Button settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tablebbtn", 1, FlagsTable)) { + ImGui::TableSetupColumn("B Button settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("B Button use margins", "gBBtnUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gBBtnPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gBBtnPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gBBtnPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gBBtnPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gBBtnPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##BBtnPosY", "gBBtnPosY", 0, ImGui::GetWindowViewport()->Size.y/4+50, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##BBtnPosX", "gBBtnPosX", -1, ImGui::GetWindowViewport()->Size.x-50, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("B Button", "gBBtn"); + DrawPositionsRadioBoxes("gBBtn"); + DrawPositionSlider("gBBtn", 0, ImGui::GetWindowViewport()->Size.y/4+50, -1, ImGui::GetWindowViewport()->Size.x-50); + DrawScaleSlider("gBBtn",0.95f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("A Button position")) { - if (ImGui::BeginTable("tableabtn", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("A Button settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableabtn", 1, FlagsTable)) { + ImGui::TableSetupColumn("A Button settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("A Button use margins", "gABtnUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gABtnPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gABtnPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gABtnPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gABtnPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gABtnPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##ABtnPosY", "gABtnPosY", -10, ImGui::GetWindowViewport()->Size.y/4+50, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##ABtnPosX", "gABtnPosX", -20, ImGui::GetWindowViewport()->Size.x-50, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("A Button", "gABtn"); + DrawPositionsRadioBoxes("gABtn"); + DrawPositionSlider("gABtn", -10, ImGui::GetWindowViewport()->Size.y/4+50, -20, ImGui::GetWindowViewport()->Size.x-50); + DrawScaleSlider("gABtn",0.95f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Start Button position")) { - if (ImGui::BeginTable("tablestartbtn", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Start Button settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tablestartbtn", 1, FlagsTable)) { + ImGui::TableSetupColumn("Start Button settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Start Button use margins", "gStartBtnUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gStartBtnPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gStartBtnPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gStartBtnPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gStartBtnPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gStartBtnPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##StartBtnPosY", "gStartBtnPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##StartBtnPosX", "gStartBtnPosX", 0, ImGui::GetWindowViewport()->Size.x/2+70, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("Start Button", "gStartBtn"); + DrawPositionsRadioBoxes("gStartBtn"); + DrawPositionSlider("gStartBtn", 0, ImGui::GetWindowViewport()->Size.y/2, 0, ImGui::GetWindowViewport()->Size.x/2+70); + DrawScaleSlider("gStartBtn",0.75f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("C Button Up position")) { - if (ImGui::BeginTable("tablecubtn", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("C Button Up settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tablecubtn", 1, FlagsTable)) { + ImGui::TableSetupColumn("C Button Up settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("C Button Up use margins", "gCBtnUUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gCBtnUPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gCBtnUPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gCBtnUPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gCBtnUPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gCBtnUPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##CBtnUPosY", "gCBtnUPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); + DrawUseMarginsSlider("C Button Up", "gCBtnU"); + DrawPositionsRadioBoxes("gCBtnU"); s16 Min_X_CU = 0; s16 Max_X_CU = ImGui::GetWindowViewport()->Size.x/2; if(CVar_GetS32("gCBtnUPosType",0) == 2){ @@ -615,30 +565,18 @@ void Draw_Placements(){ } else if(CVar_GetS32("gCBtnUPosType",0) == 4){ Min_X_CU = (ImGui::GetWindowViewport()->Size.x/2)*-1; } - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##CBtnUPosX", "gCBtnUPosX", Min_X_CU, Max_X_CU, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawPositionSlider("gCBtnU", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_CU, Max_X_CU); + DrawScaleSlider("gCBtnU",0.5f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("C Button Down position")) { - if (ImGui::BeginTable("tablecdbtn", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("C Button Down settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tablecdbtn", 1, FlagsTable)) { + ImGui::TableSetupColumn("C Button Down settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("C Button Down use margins", "gCBtnDUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gCBtnDPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gCBtnDPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gCBtnDPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gCBtnDPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gCBtnDPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##CBtnDPosY", "gCBtnDPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); + DrawUseMarginsSlider("C Button Down", "gCBtnD"); + DrawPositionsRadioBoxes("gCBtnD"); s16 Min_X_CD = 0; s16 Max_X_CD = ImGui::GetWindowViewport()->Size.x/2; if(CVar_GetS32("gCBtnDPosType",0) == 2){ @@ -648,63 +586,39 @@ void Draw_Placements(){ } else if(CVar_GetS32("gCBtnDPosType",0) == 4){ Min_X_CD = (ImGui::GetWindowViewport()->Size.x/2)*-1; } - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##CBtnDPosX", "gCBtnDPosX", Min_X_CD, Max_X_CD, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawPositionSlider("gCBtnD", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_CD, Max_X_CD); + DrawScaleSlider("gCBtnD",0.87f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("C Button Left position")) { - if (ImGui::BeginTable("tableclbtn", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("C Button Left settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableclbtn", 1, FlagsTable)) { + ImGui::TableSetupColumn("C Button Left settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("C Button Left use margins", "gCBtnLUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gCBtnLPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gCBtnLPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gCBtnLPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gCBtnLPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gCBtnLPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##CBtnLPosY", "gCBtnLPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); + DrawUseMarginsSlider("C Button Left", "gCBtnL"); + DrawPositionsRadioBoxes("gCBtnL"); s16 Min_X_CL = 0; s16 Max_X_CL = ImGui::GetWindowViewport()->Size.x/2; - if(CVar_GetS32("gCBtnDPosType",0) == 2){ + if(CVar_GetS32("gCBtnLPosType",0) == 2){ Max_X_CL = 294; - } else if(CVar_GetS32("gCBtnDPosType",0) == 3){ + } else if(CVar_GetS32("gCBtnLPosType",0) == 3){ Max_X_CL = ImGui::GetWindowViewport()->Size.x/2; - } else if(CVar_GetS32("gCBtnDPosType",0) == 4){ + } else if(CVar_GetS32("gCBtnLPosType",0) == 4){ Min_X_CL = (ImGui::GetWindowViewport()->Size.x/2)*-1; } - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##CBtnLPosX", "gCBtnLPosX", Min_X_CL, Max_X_CL, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawPositionSlider("gCBtnL", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_CL, Max_X_CL); + DrawScaleSlider("gCBtnL",0.87f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("C Button Right position")) { - if (ImGui::BeginTable("tablecrnbtn", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("C Button Right settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tablecrnbtn", 1, FlagsTable)) { + ImGui::TableSetupColumn("C Button Right settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("C Button Right use margins", "gCBtnRUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gCBtnRPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gCBtnRPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gCBtnRPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gCBtnRPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gCBtnRPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##CBtnRPosY", "gCBtnRPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); + DrawUseMarginsSlider("C Button Right", "gCBtnR"); + DrawPositionsRadioBoxes("gCBtnR"); s16 Min_X_CR = 0; s16 Max_X_CR = ImGui::GetWindowViewport()->Size.x/2; if(CVar_GetS32("gCBtnRPosType",0) == 2){ @@ -714,30 +628,18 @@ void Draw_Placements(){ } else if(CVar_GetS32("gCBtnRPosType",0) == 4){ Min_X_CR = (ImGui::GetWindowViewport()->Size.x/2)*-1; } - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##CBtnRPosX", "gCBtnRPosX", Min_X_CR, Max_X_CR, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawPositionSlider("gCBtnR", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_CR, Max_X_CR); + DrawScaleSlider("gCBtnR",0.87f); ImGui::NewLine(); ImGui::EndTable(); } } if (CVar_GetS32("gDpadEquips",0) && ImGui::CollapsingHeader("DPad items position")) { - if (ImGui::BeginTable("tabledpaditems", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("DPad items settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tabledpaditems", 1, FlagsTable)) { + ImGui::TableSetupColumn("DPad items settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("DPad items use margins", "gDPadUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gDPadPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gDPadPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gDPadPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gDPadPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gDPadPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##DPadPosY", "gDPadPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); + DrawUseMarginsSlider("DPad items", "gDPad"); + DrawPositionsRadioBoxes("gDPad"); s16 Min_X_Dpad = 0; s16 Max_X_Dpad = ImGui::GetWindowViewport()->Size.x/2; if(CVar_GetS32("gDPadPosType",0) == 2){ @@ -745,200 +647,104 @@ void Draw_Placements(){ } else if(CVar_GetS32("gDPadPosType",0) == 4){ Min_X_Dpad = (ImGui::GetWindowViewport()->Size.x/2)*-1; } - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##DPadPosX", "gDPadPosX", Min_X_Dpad, Max_X_Dpad, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawPositionSlider("gDPad", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_Dpad, Max_X_Dpad); + DrawScaleSlider("gDPad",1.0f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Minimaps position")) { - if (ImGui::BeginTable("tableminimapspos", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("minimaps settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableminimapspos", 1, FlagsTable)) { + ImGui::TableSetupColumn("minimaps settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Minimap Button use margins", "gMinimapUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gMinimapPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gMinimapPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gMinimapPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - //SohImGui::EnhancementRadioButton("No anchors", "gMinimapPosType", 3); //currently bugged - //SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gMinimapPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##MinimapPosY", "gMinimapPosY", (ImGui::GetWindowViewport()->Size.y/3)*-1, ImGui::GetWindowViewport()->Size.y/3, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##MinimapPosX", "gMinimapPosX", ImGui::GetWindowViewport()->Size.x*-1, ImGui::GetWindowViewport()->Size.x/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("Minimap", "gMinimap"); + DrawPositionsRadioBoxes("gMinimap", false); + DrawPositionSlider("gMinimap", (ImGui::GetWindowViewport()->Size.y/3)*-1, ImGui::GetWindowViewport()->Size.y/3, ImGui::GetWindowViewport()->Size.x*-1, ImGui::GetWindowViewport()->Size.x/2); + DrawScaleSlider("gMinimap",1.0f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Small Keys counter position")) { - if (ImGui::BeginTable("tablesmolekeys", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Small Keys counter settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tablesmolekeys", 1, FlagsTable)) { + ImGui::TableSetupColumn("Small Keys counter settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Small Keys counter use margins", "gSKCUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gSKCPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gSKCPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gSKCPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gSKCPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gSKCPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##SKCPosY", "gSKCPosY", 0, ImGui::GetWindowViewport()->Size.y/3, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##SKCPosX", "gSKCPosX", -1, ImGui::GetWindowViewport()->Size.x/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("Small Keys counter", "gSKC"); + DrawPositionsRadioBoxes("gSKC"); + DrawPositionSlider("gSKC", 0, ImGui::GetWindowViewport()->Size.y/3, -1, ImGui::GetWindowViewport()->Size.x/2); + DrawScaleSlider("gSKC",1.0f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Rupee counter position")) { - if (ImGui::BeginTable("tablerupeecount", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Rupee counter settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tablerupeecount", 1, FlagsTable)) { + ImGui::TableSetupColumn("Rupee counter settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Rupee counter use margins", "gRCUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gRCPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gRCPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gRCPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gRCPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gRCPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##RCPosY", "gRCPosY", -2, ImGui::GetWindowViewport()->Size.y/3, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##RCPosX", "gRCPosX", -3, ImGui::GetWindowViewport()->Size.x/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("Rupee counter", "gRC"); + DrawPositionsRadioBoxes("gRC"); + DrawPositionSlider("gRC", -2, ImGui::GetWindowViewport()->Size.y/3, -3, ImGui::GetWindowViewport()->Size.x/2); + DrawScaleSlider("gRC",1.0f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Carrots position")) { - if (ImGui::BeginTable("tableCarrots", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Carrots settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableCarrots", 1, FlagsTable)) { + ImGui::TableSetupColumn("Carrots settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Carrots use margins", "gCarrotsUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gCarrotsPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gCarrotsPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gCarrotsPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gCarrotsPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gCarrotsPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##CarrotsPosY", "gCarrotsPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##CarrotsPosX", "gCarrotsPosX", -50, ImGui::GetWindowViewport()->Size.x/2+25, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("Carrots", "gCarrots"); + DrawPositionsRadioBoxes("gCarrots"); + DrawPositionSlider("gCarrots", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+25); + DrawScaleSlider("gCarrots",1.0f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Timers position")) { - if (ImGui::BeginTable("tabletimers", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Timers settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tabletimers", 1, FlagsTable)) { + ImGui::TableSetupColumn("Timers settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Timers use margins", "gTimersUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gTimersPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gTimersPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gTimersPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gTimersPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gTimersPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##TimersPosY", "gTimersPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##TimersPosX", "gTimersPosX", -50, ImGui::GetWindowViewport()->Size.x/2-50, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("Timers", "gTimers"); + DrawPositionsRadioBoxes("gTimers"); + DrawPositionSlider("gTimers", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2-50); + DrawScaleSlider("gTimers",1.0f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Archery Scores position")) { - if (ImGui::BeginTable("tablearchery", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Archery Scores settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tablearchery", 1, FlagsTable)) { + ImGui::TableSetupColumn("Archery Scores settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Archery Scores use margins", "gASUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gASPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gASPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gASPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - //SohImGui::EnhancementRadioButton("No anchors", "gASPosType", 3); //currently bugged - //SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gASPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##ASPosY", "gASPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##ASPosX", "gASPosX", -50, ImGui::GetWindowViewport()->Size.x/2-50, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("Archery scores", "gAS"); + DrawPositionsRadioBoxes("gAS", false); + DrawPositionSlider("gAS", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2-50); + DrawScaleSlider("gAS",1.0f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Title cards (Maps) position")) { - if (ImGui::BeginTable("tabletcmaps", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Titlecard maps settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tabletcmaps", 1, FlagsTable)) { + ImGui::TableSetupColumn("Titlecard maps settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Title cards (Maps) use margins", "gTCMUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gTCMPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gTCMPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gTCMPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gTCMPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gTCMPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##TCMPosY", "gTCMPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##TCMPosX", "gTCMPosX", -50, ImGui::GetWindowViewport()->Size.x/2+10, ""), true; - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("Title cards (overworld)", "gTCM"); + DrawPositionsRadioBoxes("gTCM"); + DrawPositionSlider("gTCM", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+10); + DrawScaleSlider("gTCM",1.0f); ImGui::NewLine(); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Title cards (Bosses) position")) { - if (ImGui::BeginTable("tabletcbosses", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Title cards (Bosses) settings", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tabletcbosses", 1, FlagsTable)) { + ImGui::TableSetupColumn("Title cards (Bosses) settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - SohImGui::EnhancementCheckbox("Title cards (Bosses) use margins", "gTCBUseMargins"); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Original position", "gTCBPosType", 0); - SohImGui::Tooltip("This will use original intended elements position."); - SohImGui::EnhancementRadioButton("Anchor to the left", "gTCBPosType", 1); - SohImGui::Tooltip("This will make your elements follow the left side of your game window."); - SohImGui::EnhancementRadioButton("Anchor to the right", "gTCBPosType", 2); - SohImGui::Tooltip("This will make your elements follow the right side of your game window."); - SohImGui::EnhancementRadioButton("No anchors", "gTCBPosType", 3); - SohImGui::Tooltip("This will make your elements to not follow any side\nBetter used for center elements."); - SohImGui::EnhancementRadioButton("Hidden", "gTCBPosType", 4); - SohImGui::Tooltip("This will make your elements hidden"); - SohImGui::EnhancementSliderInt("Up <-> Down : %d", "##TCBPosY", "gTCBPosY", 0, ImGui::GetWindowViewport()->Size.y/2, "", 0, true); - SohImGui::Tooltip("This slider is used to move Up and Down your elements."); - SohImGui::EnhancementSliderInt("Left <-> Right : %d", "##TCBPosX", "gTCBPosX", -50, ImGui::GetWindowViewport()->Size.x/2+10, "", 0, true); - SohImGui::Tooltip("This slider is used to move Left and Right your elements."); + DrawUseMarginsSlider("Title cards (Bosses)", "gTCB"); + DrawPositionsRadioBoxes("gTCB"); + DrawPositionSlider("gTCB", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+10); + DrawScaleSlider("gTCB",1.0f); ImGui::NewLine(); ImGui::EndTable(); } @@ -946,67 +752,53 @@ void Draw_Placements(){ } void Draw_HUDButtons(){ if (CVar_GetS32("gHudColors",0) ==2 ){ + DrawRandomizeResetButton("every buttons", Buttons_section, SECTION_SIZE(Buttons_section)); if (ImGui::CollapsingHeader("A Button colors & A Cursors")) { - if (ImGui::BeginTable("tableBTN_A", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("A Button colors", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableBTN_A", 1, FlagsTable)) { + ImGui::TableSetupColumn("A Button colors", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - Draw_HelpIcon("Affects the A button colors (and various cursors that use the same theme)", false); - SohImGui::EnhancementColor("A Buttons", "gCCABtnPrim", a_btn_colors, ImVec4(0, 200, 50, 255), true, false, true); + DrawColorSection(A_Btn_section, SECTION_SIZE(A_Btn_section)); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("B Button color")) { - if (ImGui::BeginTable("tableBTN_B", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("B button color", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableBTN_B", 1, FlagsTable)) { + ImGui::TableSetupColumn("B button color", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - Draw_HelpIcon("Affects the B button color", false); - SohImGui::EnhancementColor("B Button", "gCCBBtnPrim", b_btn_colors, ImVec4(255, 30, 30, 255), true, false, true); + DrawColorSection(B_Btn_section, SECTION_SIZE(B_Btn_section)); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("C-Buttons & C Cursor")) { - if (ImGui::BeginTable("tableBTN_C", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Button C colors & C Cursor colors", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableBTN_C", 1, FlagsTable)) { + ImGui::TableSetupColumn("Button C colors & C Cursor colors", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - Draw_HelpIcon("Affects the C Buttons' color (if not using separate colors)\nAnd various cursor that use C-Buttons colors", false); - SohImGui::EnhancementColor("C-Buttons", "gCCCBtnPrim", c_btn_colors, ImVec4(255, 160, 0, 255), true, false, true); + DrawColorSection(C_Btn_Unified_section, SECTION_SIZE(C_Btn_Unified_section)); ImGui::EndTable(); } SohImGui::EnhancementCheckbox("C-Buttons use separate colors", "gCCparated"); if (CVar_GetS32("gCCparated",0) && ImGui::CollapsingHeader("C Button individual colors")) { - if (ImGui::BeginTable("tableBTN_CSep", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("C-Buttons individual colors", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableBTN_CSep", 1, FlagsTable)) { + ImGui::TableSetupColumn("C-Buttons individual colors", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - Draw_HelpIcon("Affects C-Buttons Up colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top"); - SohImGui::EnhancementColor("C Buttons Up", "gCCCUBtnPrim", c_btn_u_colors, ImVec4(255,160,0,255)); - Table_NextLine(); - Draw_HelpIcon("Affects C-Buttons Down colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top"); - SohImGui::EnhancementColor("C Buttons Down", "gCCCDBtnPrim", c_btn_d_colors, ImVec4(255,160,0,255)); - Table_NextLine(); - Draw_HelpIcon("Affects C-Buttons Left colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top"); - SohImGui::EnhancementColor("C Buttons Left", "gCCCLBtnPrim", c_btn_l_colors, ImVec4(255,160,0,255)); - Table_NextLine(); - Draw_HelpIcon("Affects C-Buttons Right colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top"); - SohImGui::EnhancementColor("C Buttons Right", "gCCCRBtnPrim", c_btn_r_colors, ImVec4(255,160,0,255)); + DrawColorSection(C_Btn_Separated_section, SECTION_SIZE(C_Btn_Separated_section)); ImGui::EndTable(); } } } if (ImGui::CollapsingHeader("Start button colors")) { - if (ImGui::BeginTable("tableBTN_Start", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Start button colors", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableBTN_Start", 1, FlagsTable)) { + ImGui::TableSetupColumn("Start button colors", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - Draw_HelpIcon("Affects the Start button color", false); - SohImGui::EnhancementColor("Start Buttons", "gCCStartBtnPrim", start_btn_colors, ImVec4(200, 0, 0, 255), true, false, true); + DrawColorSection(Start_Btn_section, SECTION_SIZE(Start_Btn_section)); ImGui::EndTable(); } } if (CVar_GetS32("gDpadEquips",0) && ImGui::CollapsingHeader("DPad colors")) { - if (ImGui::BeginTable("tableDpadHud", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("DPad color", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableDpadHud", 1, FlagsTable)) { + ImGui::TableSetupColumn("DPad color", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - Draw_HelpIcon("DPad background color, White is the default value"); - SohImGui::EnhancementColor("DPad background color", "gCCDpadPrim", dpad_colors, ImVec4(255, 255, 255, 255)); + DrawColorSection(DPad_section, SECTION_SIZE(DPad_section)); ImGui::EndTable(); } } @@ -1015,10 +807,11 @@ void Draw_HUDButtons(){ } } void Draw_General(){ - if (ImGui::BeginTable("tableScheme", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV | ImGuiTableFlags_Hideable)) { - ImGui::TableSetupColumn("N64 Scheme", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); - ImGui::TableSetupColumn("GameCube Scheme", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); - ImGui::TableSetupColumn("Custom Schemes", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + DrawRandomizeResetButton("all cosmetics", Everything_Section, SECTION_SIZE(Everything_Section), true); + if (ImGui::BeginTable("tableScheme", 3, FlagsTable | ImGuiTableFlags_Hideable)) { + ImGui::TableSetupColumn("N64 Scheme", FlagsCell, TablesCellsWidth); + ImGui::TableSetupColumn("GameCube Scheme", FlagsCell, TablesCellsWidth); + ImGui::TableSetupColumn("Custom Schemes", FlagsCell, TablesCellsWidth); Table_InitHeader(); Draw_HelpIcon("Change interface color to N64 style"); SohImGui::EnhancementRadioButton("N64 Colors", "gHudColors", 0); @@ -1031,86 +824,83 @@ void Draw_General(){ ImGui::EndTable(); } if (CVar_GetS32("gHudColors",0) ==2 ){ + DrawRandomizeResetButton("interface (excluding buttons)", Misc_Interface_section, SECTION_SIZE(Misc_Interface_section)); if (ImGui::CollapsingHeader("Hearts colors")) { SohImGui::Tooltip("Hearts colors in general\nDD stand for Double Defense"); - if (ImGui::BeginTable("tableHearts", 3, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV | ImGuiTableFlags_Hideable)) { + if (ImGui::BeginTable("tableHearts", 3, FlagsTable | ImGuiTableFlags_Hideable)) { ImGui::TableSetupColumn("Hearts (normal)", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable, TablesCellsWidth/3); ImGui::TableSetupColumn("Hearts (DD)", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable, TablesCellsWidth/3); ImGui::TableSetupColumn("Hearts Outline (DD)", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable, TablesCellsWidth/3); Table_InitHeader(); - Draw_HelpIcon("Affects the inner color", false); - SohImGui::EnhancementColor("Inner normal", "gCCHeartsPrim", hearts_colors, ImVec4(255,70,50,255), true, false, true); - Table_NextCol(); - Draw_HelpIcon("Affects the inner color", false); - SohImGui::EnhancementColor("Inner DD", "gCCDDHeartsPrim", hearts_ddi_colors, ImVec4(255,70,50,255), true, false, true); - Table_NextCol(); - Draw_HelpIcon("Affects the outline color of hearts when you have Double Defense\nWhite is the default value", false); - SohImGui::EnhancementColor("Outline DD", "gDDCCHeartsPrim", hearts_dd_colors, ImVec4(255,255,255,255), true, false, true); + DrawColorSection(Hearts_section, SECTION_SIZE(Hearts_section)); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Magic Meter colors")) { - if (ImGui::BeginTable("tableMagicmeter", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV | ImGuiTableFlags_Hideable)) { - ImGui::TableSetupColumn("Magic meter", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); - ImGui::TableSetupColumn("Magic meter in use", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); + if (ImGui::BeginTable("tableMagicmeter", 2, FlagsTable | ImGuiTableFlags_Hideable)) { + ImGui::TableSetupColumn("Magic meter", FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn("Magic meter in use", FlagsCell, TablesCellsWidth/2); Table_InitHeader(); - Draw_HelpIcon("Affects the border of the magic meter\nWhite is the default value, color change only when used one time"); - SohImGui::EnhancementColor("Borders", "gCCMagicBorderNormPrim", magic_bordern_colors, ImVec4(255,255,255,255), false); - Table_NextCol(); - Draw_HelpIcon("Affects the border of the magic meter when being used\nWhite is the default value"); - SohImGui::EnhancementColor("Borders in use", "gCCMagicBorderPrim", magic_border_colors, ImVec4(255,255,255,255), false); - Table_NextLine(); - Draw_HelpIcon("Affects the magic meter color\nGreen is the default value"); - SohImGui::EnhancementColor("Main color", "gCCMagicPrim", magic_remaining_colors, ImVec4(0,200,0,255)); - Table_NextCol(); - Draw_HelpIcon("Affects the magic meter when being used\nYellow is the default value"); - SohImGui::EnhancementColor("Main color in use", "gCCMagicUsePrim", magic_use_colors, ImVec4(250,250,0,255)); + DrawColorSection(Magic_Meter_section, SECTION_SIZE(Magic_Meter_section)); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Minimap and compass colors")) { - if (ImGui::BeginTable("tableMinimapCol", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV)) { - ImGui::TableSetupColumn("Minimap color", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableMinimapCol", 1, FlagsTable)) { + ImGui::TableSetupColumn("Minimap color", FlagsCell, TablesCellsWidth); Table_InitHeader(); - Draw_HelpIcon("Affects the Overworld minimaps"); - SohImGui::EnhancementColor("Overworlds", "gCCMinimapPrim", minimap_colors, ImVec4(0, 255, 255, 255)); - Table_NextLine(); - Draw_HelpIcon("Affects the Dungeon minimaps"); - SohImGui::EnhancementColor("Dungeons", "gCCMinimapDGNPrim", dgn_minimap_colors, ImVec4(100, 255, 255, 255)); - Table_NextLine(); - Draw_HelpIcon("Affects the current position arrow on the minimap\nYellow is the default value"); - SohImGui::EnhancementColor("Current position arrow", "gCCMinimapCPPrim", cp_minimap_colors, ImVec4(200, 255, 0, 255)); - Table_NextLine(); - Draw_HelpIcon("Affects the last entrance position arrow on the minimap\nRed is the default value"); - SohImGui::EnhancementColor("Last entrance arrow", "gCCMinimapLEPrim", le_minimap_colors, ImVec4(200, 0, 0, 255)); + DrawColorSection(Minimap_section, SECTION_SIZE(Minimap_section)); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Title cards colors")) { - if (ImGui::BeginTable("tableTitleCards", 2, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV | ImGuiTableFlags_Hideable)) { - ImGui::TableSetupColumn("Title cards Overworld", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); - ImGui::TableSetupColumn("Title cards Bosses", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth/2); + if (ImGui::BeginTable("tableTitleCards", 2, FlagsTable | ImGuiTableFlags_Hideable)) { + ImGui::TableSetupColumn("Title cards Overworld", FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn("Title cards Bosses", FlagsCell, TablesCellsWidth/2); Table_InitHeader(); - Draw_HelpIcon("Affects all the overworld title cards color, white is the default value"); - SohImGui::EnhancementColor("Main color", "gCCTC_OW_U_Prim", tc_ou_colors, ImVec4(255, 255, 255, 255), false); - Table_NextCol(); - Draw_HelpIcon("Affects all the bosses title cards color, white is the default value"); - SohImGui::EnhancementColor("Main color", "gCCTC_B_U_Prim", tc_bu_colors, ImVec4(255, 255, 255, 255), false); + DrawColorSection(TitleCards_section, SECTION_SIZE(TitleCards_section)); ImGui::EndTable(); } } if (ImGui::CollapsingHeader("Misc. interface colors")) { - if (ImGui::BeginTable("tableMiscHudCol", 1, ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV | ImGuiTableFlags_Hideable)) { - ImGui::TableSetupColumn("Misc HUD colors", ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort, TablesCellsWidth); + if (ImGui::BeginTable("tableMiscHudCol", 1, FlagsTable | ImGuiTableFlags_Hideable)) { + ImGui::TableSetupColumn("Misc HUD colors", FlagsCell, TablesCellsWidth); Table_InitHeader(); - Draw_HelpIcon("Affects the Rupee icon on interface\nGreen is the default value"); - SohImGui::EnhancementColor("Rupee icon", "gCCRupeePrim", rupee_colors, ImVec4(200, 255, 100, 255)); + DrawColorSection(Misc_section, SECTION_SIZE(Misc_section)); + ImGui::EndTable(); + } + } + if (ImGui::CollapsingHeader("Scenes transitions")) { + if (ImGui::BeginTable("tabletransitionotherCol", 2, FlagsTable | ImGuiTableFlags_Hideable)) { + ImGui::TableSetupColumn("transitionother1", FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn("transitionother2", FlagsCell, TablesCellsWidth/2); + Table_InitHeader(false); + SohImGui::EnhancementRadioButton("Originals", "gSceneTransitions", 255); + SohImGui::Tooltip("This will make the game use original scenes transitions"); + Table_NextCol(); + SohImGui::EnhancementRadioButton("None", "gSceneTransitions", 11); + SohImGui::Tooltip("This will make the game use no any scenes transitions"); Table_NextLine(); - Draw_HelpIcon("Affects the Small keys icon on interface\nGray is the default value"); - SohImGui::EnhancementColor("Small Keys icon", "gCCKeysPrim", smolekey_colors, ImVec4(200, 230, 255, 255)); + SohImGui::EnhancementRadioButton("Desert mode (persistant)", "gSceneTransitions", 14); + SohImGui::Tooltip("This will make the game use the sand storm scenes transitions that will persist in map"); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Desert mode (non persistant)", "gSceneTransitions", 15); + SohImGui::Tooltip("This will make the game use the sand storm scenes transitions"); Table_NextLine(); - Draw_HelpIcon("Affects the Stone of Agony icon on interface\nWhite is the default value"); - SohImGui::EnhancementColor("Stone of agony icon", "gCCVSOAPrim", visualagony_colors, ImVec4(255, 255, 255, 255)); + SohImGui::EnhancementRadioButton("Normal fade (green)", "gSceneTransitions", 18); + SohImGui::Tooltip("This will make the game use a greenish fade in/out scenes transitions"); + Table_NextCol(); + SohImGui::EnhancementRadioButton("Normal fade (blue)", "gSceneTransitions", 19); + SohImGui::Tooltip("This will make the game use a blue fade in/out scenes transitions"); + Table_NextLine(); + SohImGui::EnhancementRadioButton("Triforce", "gSceneTransitions", 1); + ImGui::EndTable(); + } + if (ImGui::BeginTable("tabletransitionCol", 2, FlagsTable | ImGuiTableFlags_Hideable)) { + ImGui::TableSetupColumn("White color", FlagsCell, TablesCellsWidth/2); + ImGui::TableSetupColumn("Black color", FlagsCell, TablesCellsWidth/2); + Table_InitHeader(); + DrawTransitions("gSceneTransitions"); ImGui::EndTable(); } } @@ -1123,7 +913,8 @@ void DrawCosmeticsEditor(bool& open) { CVar_SetS32("gCosmeticsEditorEnabled", 0); return; } - ImGui::SetNextWindowSize(ImVec2(465, 430), ImGuiCond_FirstUseEver); + + ImGui::SetNextWindowSize(ImVec2(620, 430), ImGuiCond_FirstUseEver); if (!ImGui::Begin("Cosmetics Editor", &open)) { ImGui::End(); return; @@ -1150,7 +941,7 @@ void DrawCosmeticsEditor(bool& open) { Draw_Menus(); ImGui::EndTabItem(); } - if (ImGui::BeginTabItem("Placements")) { + if (ImGui::BeginTabItem("Placements & Scale")) { Draw_Placements(); ImGui::EndTabItem(); } @@ -1165,4 +956,4 @@ void InitCosmeticsEditor() { SohImGui::AddWindow("Enhancements", "Rainbowfunction", LoadRainbowColor, true, true); //Draw the bar in the menu. SohImGui::AddWindow("Enhancements", "Cosmetics Editor", DrawCosmeticsEditor); -} +} \ No newline at end of file diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h index 9bfeee91d..4b6ea249b 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h @@ -1,4 +1,407 @@ #pragma once +#include "../libultraship/ImGuiImpl.h" +#define SECTION_SIZE(arr) (s32)(sizeof(arr) / sizeof(arr[0])) +#define RANDOMIZE_32(Max) GetRandomValue(Max); +#define CATEGORY_NPC 0 +#define CATEGORY_ITEMS 1 +#define CATEGORY_MENU 2 +#define CATEGORY_HUD 3 +#define CATEGORY_MISC 4 + +typedef struct { + const std::string Name; + const std::string ToolTip; + const std::string CvarName; + ImVec4 ModifiedColor; + ImVec4 DefaultColor; + bool canRainbow; + bool hasAlpha; + bool sameLine; +} CosmeticsColorIndividual; + +typedef struct { + CosmeticsColorIndividual* Element; + bool Nextcol; + bool NextLine; +} CosmeticsColorSection; + +static float TablesCellsWidth = 300.0f; +static ImGuiTableColumnFlags FlagsTable = ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV; +static ImGuiTableColumnFlags FlagsCell = ImGuiTableColumnFlags_WidthStretch | ImGuiTableColumnFlags_IndentEnable | ImGuiTableColumnFlags_NoSort; +static ImVec4 hearts_colors; static ImVec4 hearts_dd_colors; static ImVec4 hearts_ddi_colors; +static ImVec4 a_btn_colors; static ImVec4 b_btn_colors; static ImVec4 c_btn_colors; static ImVec4 start_btn_colors; +static ImVec4 c_btn_u_colors; static ImVec4 c_btn_l_colors; static ImVec4 c_btn_d_colors; static ImVec4 c_btn_r_colors; +static ImVec4 magic_border_colors; static ImVec4 magic_remaining_colors; static ImVec4 magic_use_colors; +static ImVec4 minimap_colors; static ImVec4 dgn_minimap_colors; +static ImVec4 cp_minimap_colors; static ImVec4 le_minimap_colors; +static ImVec4 rupee_colors; static ImVec4 smolekey_colors; static ImVec4 magic_bordern_colors; +static ImVec4 fileselect_colors; static ImVec4 fileselect_text_colors; +static ImVec4 kokiri_col; static ImVec4 goron_col; static ImVec4 zora_col; +static ImVec4 navi_idle_i_col; static ImVec4 navi_idle_o_col; +static ImVec4 navi_npc_i_col; static ImVec4 navi_npc_o_col; +static ImVec4 navi_enemy_i_col; static ImVec4 navi_enemy_o_col; +static ImVec4 navi_prop_i_col; static ImVec4 navi_prop_o_col; +static ImVec4 trailscol; +static ImVec4 crtfilter; +static ImVec4 firearrow_col; static ImVec4 icearrow_col; static ImVec4 lightarrow_col; +static ImVec4 firearrow_colenv; static ImVec4 icearrow_colenv; static ImVec4 lightarrow_colenv; +static ImVec4 charged1_col; static ImVec4 charged2_col; +static ImVec4 charged1_colenv; static ImVec4 charged2_colenv; +static ImVec4 Keese1_primcol; static ImVec4 Keese2_primcol; +static ImVec4 Keese1_envcol; static ImVec4 Keese2_envcol; +static ImVec4 doggo1col; static ImVec4 doggo2col; +static ImVec4 df_col; static ImVec4 df_colenv; +static ImVec4 nl_diam_col; static ImVec4 nl_diam_colenv; +static ImVec4 nl_orb_col; static ImVec4 nl_orb_colenv; +static ImVec4 tc_ou_colors; static ImVec4 tc_bu_colors; +static ImVec4 dpad_colors; +static ImVec4 visualagony_colors; +static ImVec4 tc_fire_colors; static ImVec4 tc_fire_colors_env; +/*ImVec4 menu_equips_colors; +ImVec4 menu_items_colors; +ImVec4 menu_map_colors; +ImVec4 menu_quest_colors; +ImVec4 menu_save_colors; +ImVec4 menu_gameover_colors;*/ + +//Navi +static CosmeticsColorIndividual Navi_Idle_Inner = { "Navi Idle (Primary)", "Inner color for Navi (idle flying around)", "gNavi_Idle_Inner_", navi_idle_i_col, ImVec4(255, 255, 255, 255), false, false, false }; +static CosmeticsColorIndividual Navi_Idle_Outer = { "Navi Idle (Secondary)", "Outer color for Navi (idle flying around)", "gNavi_Idle_Outer_", navi_idle_o_col, ImVec4(0, 0, 255, 255), false, false, false }; +static CosmeticsColorIndividual Navi_Npc_Inner = { "Navi NPC (Primary)", "Inner color for Navi (when Navi fly around NPCs)", "gNavi_NPC_Inner_", navi_npc_i_col, ImVec4(150, 150, 255, 255), false, false, false }; +static CosmeticsColorIndividual Navi_Npc_Outer = { "Navi NPC (Secondary)", "Outer color for Navi (when Navi fly around NPCs)", "gNavi_NPC_Outer_", navi_npc_o_col, ImVec4(150, 150, 255, 255), false, false, false }; +static CosmeticsColorIndividual Navi_Enemy_Inner = { "Navi Enemy (Primary)", "Inner color for Navi (when Navi fly around Enemies or Bosses)", "gNavi_Enemy_Inner_", navi_enemy_i_col, ImVec4(255, 255, 0, 255), false, false, false }; +static CosmeticsColorIndividual Navi_Enemy_Outer = { "Navi Enemy (Secondary)", "Outer color for Navi (when Navi fly around Enemies or Bosses)", "gNavi_Enemy_Outer_", navi_enemy_o_col, ImVec4(220, 155, 0, 255), false, false, false }; +static CosmeticsColorIndividual Navi_Prop_Inner = { "Navi Enemy (Primary)", "Inner color for Navi (when Navi fly around props (signs etc))", "gNavi_Prop_Inner_", navi_prop_i_col, ImVec4(0, 255, 0, 255), false, false, false }; +static CosmeticsColorIndividual Navi_Prop_Outer = { "Navi Enemy (Secondary)", "Outer color for Navi (when Navi fly around props (signs etc))", "gNavi_Prop_Outer_", navi_prop_o_col, ImVec4(0, 255, 0, 255), false, false, false }; + +//Keese +static CosmeticsColorIndividual Keese1_prim = { "Fire Primary color", "Affects the primary color of the Fire itself of the Keese", "gKeese1_Ef_Prim", Keese1_primcol, ImVec4(255, 255, 100, 255), true, false, false }; +static CosmeticsColorIndividual Keese2_prim = { "Ice Primary color", "Affects the primary color of the Ice itself of the Keese", "gKeese2_Ef_Prim", Keese2_primcol, ImVec4(100, 200, 255, 255), true, false, false }; +static CosmeticsColorIndividual Keese1_env = { "Fire Secondary color", "Affects the secondary color of the Fire itself of the Keese", "gKeese1_Ef_Env", Keese1_envcol, ImVec4(255, 50, 0, 255), true, false, false }; +static CosmeticsColorIndividual Keese2_env = { "Ice Secondary color", "Affects the secondary color of the Ice itself of the Keese", "gKeese2_Ef_Env", Keese2_envcol, ImVec4(0, 0, 255, 255), true, false, false }; + +//Good old Dogs, we all love them +static CosmeticsColorIndividual DogN1 = { "Dog white", "Affects the colors of the white dog", "gDog1Col", doggo1col, ImVec4(255,255,200,255), true, false, true }; +static CosmeticsColorIndividual DogN2 = { "Dog brown", "Affects the colors of the brown dog", "gDog2Col", doggo2col, ImVec4(150,100,50,255), true, false, true }; + +//Tunics colors +static CosmeticsColorIndividual KokiriTunic = { "Kokiri Tunic", "Affects Kokiri Tunic color", "gTunic_Kokiri", kokiri_col, ImVec4(30, 105, 27, 255), true, false, true }; +static CosmeticsColorIndividual GoronTunic = { "Goron Tunic", "Affects Goron Tunic color", "gTunic_Goron", goron_col, ImVec4(100, 20, 0, 255), true, false, true }; +static CosmeticsColorIndividual ZoraTunic = { "Zora Tunic", "Affects Zora Tunic color", "gTunic_Zora", zora_col, ImVec4(0, 60, 100, 255), true, false, true }; + +//Arrows (Fire -> Ice -> Light) +static CosmeticsColorIndividual Fire_Arrow_Prim = { "Fire Arrows (primary)", "Affects Primary color", "gFireArrowCol", firearrow_col, ImVec4(255,200,0,255), true, false, false }; +static CosmeticsColorIndividual Fire_Arrow_Env = { "Fire Arrows (Secondary)", "Affects Secondary color", "gFireArrowColEnv", firearrow_colenv, ImVec4(255,0,0,255), true, false, false }; +static CosmeticsColorIndividual Ice_Arrow_Prim = { "Ice Arrows (Primary)", "Affects Primary color", "gIceArrowCol", icearrow_col, ImVec4(170,255,255,255), true, false, false }; +static CosmeticsColorIndividual Ice_Arrow_Env = { "Ice Arrows (Secondary)", "Affects Secondary color", "gIceArrowColEnv", icearrow_colenv, ImVec4(0,0,255,255), true, false, false }; +static CosmeticsColorIndividual Light_Arrow_Prim = { "Light Arrows (Primary)", "Affects Primary color", "gLightArrowCol", lightarrow_col, ImVec4(255,255,170,255), true, false, false }; +static CosmeticsColorIndividual Light_Arrow_Env = { "Light Arrows (Secondary)", "Affects Secondary color", "gLightArrowColEnv", lightarrow_colenv, ImVec4(255,255,0,255), true, false, false }; + +//Spells +static CosmeticsColorIndividual Din_Fire_Prim = { "Din's Fire (primary)", "Affects Primary color", "gDF_Col", df_col, ImVec4(255,200,0,255), true, false, false }; +static CosmeticsColorIndividual Din_Fire_Env = { "Din's Fire (Secondary)", "Affects Secondary color", "gDF_Env", df_colenv, ImVec4(255,0,0,255), true, false, false }; +static CosmeticsColorIndividual Nayru_Diamond_Prim = { "Nayru's Love Diamond (primary)", "Affects Primary color", "gNL_Diamond_Col", nl_diam_col, ImVec4(170,255,255,255), true, false, false }; +static CosmeticsColorIndividual Nayru_Diamond_Env = { "Nayru's Love Diamond (Secondary)", "Affects Secondary color", "gNL_Diamond_Env", nl_diam_colenv, ImVec4(100,255,128,255), true, false, false }; +static CosmeticsColorIndividual Nayru_Orb_Prim = { "Nayru's Love Orb (primary)", "Affects Primary color", "gNL_Orb_Col", nl_orb_col, ImVec4(170,255,255,255), true, false, false }; +static CosmeticsColorIndividual Nayru_Orb_Env = { "Nayru's Love Orb (Secondary)", "Affects Secondary color", "gNL_Orb_Env", nl_orb_colenv, ImVec4(150,255,255,255), true, false, false }; + +//Spin attacks colors +static CosmeticsColorIndividual Spin_Lv1_Prim = { "Level 1 (primary)", "Affects Primary color", "gCharged1Col", charged1_col, ImVec4(170,255,255,255), true, false, false }; +static CosmeticsColorIndividual Spin_Lv1_Env = { "Level 1 (Secondary)", "Affects Secondary color", "gCharged1ColEnv", charged1_colenv, ImVec4(0,100,255,255), true, false, false }; +static CosmeticsColorIndividual Spin_Lv2_Prim = { "Level 2 (primary)", "Affects Primary color", "gCharged2Col", charged2_col, ImVec4(255,255,170,255), true, false, false }; +static CosmeticsColorIndividual Spin_Lv2_Env = { "Level 2 (Secondary)", "Affects Secondary color", "gCharged2ColEnv", charged2_colenv, ImVec4(255,100,0,255), true, false, false }; + +//Trails +static CosmeticsColorIndividual Trails_col = { "Trails color", "Affects Swords slash, boomerang and Bombchu trails color", "gTrailCol", trailscol, ImVec4(255,255,255,255), true, false, false }; + +//Menus - File Choose +static CosmeticsColorIndividual FileChoose_Background = { "Main menu color", "Affects the File Select menu background.", "gCCFileChoosePrim", fileselect_colors, ImVec4(100, 150, 255, 255), true, false, false }; +static CosmeticsColorIndividual FileChoose_BottomText = { "Bottom texts color", "Affects the File Select texts.", "gCCFileChooseTextPrim", fileselect_text_colors, ImVec4(100, 255, 255, 255), true, false, false }; + +//Hud Stuff (Dpad, Buttons etc) +static CosmeticsColorIndividual A_Btn = { "A Button", "Affects the A button colors (and various cursors that use the same theme)", "gCCABtnPrim", a_btn_colors, ImVec4(0, 200, 50, 255), true, false, false }; +static CosmeticsColorIndividual B_Btn = { "B Button", "Affects the B button color", "gCCBBtnPrim", b_btn_colors, ImVec4(255, 30, 30, 255), true, false, false }; +static CosmeticsColorIndividual C_Btn = { "C-Buttons", "Affects the C Buttons' color (if not using separate colors)\nAnd various cursor that use C-Buttons colors", "gCCCBtnPrim", c_btn_colors, ImVec4(255, 160, 0, 255), true, false, false }; +static CosmeticsColorIndividual C_Btn_U = { "C-Buttons Up", "Affects C-Buttons Up colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top", "gCCCUBtnPrim", c_btn_u_colors, ImVec4(255,160,0,255), true, false, false }; +static CosmeticsColorIndividual C_Btn_D = { "C-Buttons Down", "Affects C-Buttons Down colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top", "gCCCDBtnPrim", c_btn_d_colors, ImVec4(255,160,0,255), true, false, false }; +static CosmeticsColorIndividual C_Btn_L = { "C-Buttons Left", "Affects C-Buttons Left colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top", "gCCCLBtnPrim", c_btn_l_colors, ImVec4(255,160,0,255), true, false, false }; +static CosmeticsColorIndividual C_Btn_R = { "C-Buttons Right", "Affects C-Buttons Right colors, but not C cursor colors\nTo edit C Cursor check C-Buttons color on top", "gCCCRBtnPrim", c_btn_r_colors, ImVec4(255,160,0,255), true, false, false }; +static CosmeticsColorIndividual Start_btn = { "Start Button", "Affects the Start button color", "gCCStartBtnPrim", start_btn_colors, ImVec4(200, 0, 0, 255), true, false, false }; +static CosmeticsColorIndividual DPad_Items = { "DPad background", "DPad background color, White is the default value", "gCCDpadPrim", dpad_colors, ImVec4(255, 255, 255, 255), true, false, false }; + +//Hearts colors +static CosmeticsColorIndividual Hearts_NInner = { "Inner (Normal)", "Affects the inner color", "gCCHeartsPrim", hearts_colors, ImVec4(255,70,50,255), true, false, false }; +static CosmeticsColorIndividual Hearts_DDInner = { "Inner (Double defense)", "Affects the inner color", "gCCDDHeartsPrim", hearts_ddi_colors, ImVec4(255,70,50,255), true, false, false }; +static CosmeticsColorIndividual Hearts_DDOutline = { "Outline (Double defense)", "Affects the outline color of hearts when you have Double Defense\nWhite is the default value", "gDDCCHeartsPrim", hearts_dd_colors, ImVec4(255,255,255,255), true, false, false }; + +//Magic Meter colors +static CosmeticsColorIndividual Magic_Borders = { "Borders", "Affects the border of the magic meter\nWhite is the default value, color change only when used one time", "gCCMagicBorderNormPrim", magic_bordern_colors, ImVec4(255,255,255,255), false, false, false }; +static CosmeticsColorIndividual Magic_InUse_Borders = { "Borders in use", "Affects the border of the magic meter when being used\nWhite is the default value", "gCCMagicBorderPrim", magic_border_colors, ImVec4(255,255,255,255), false, false, false }; +static CosmeticsColorIndividual Magic_Meter = { "Main color", "Affects the magic meter color\nGreen is the default value", "gCCMagicPrim", magic_remaining_colors, ImVec4(0,200,0,255), true, false, false }; +static CosmeticsColorIndividual Magic_InUse_Meter = { "Main color in use", "Affects the magic meter when being used\nYellow is the default value", "gCCMagicUsePrim", magic_use_colors, ImVec4(250,250,0,255), true, false, false }; + +//Minimap and it's arrow colors +static CosmeticsColorIndividual Minimap_OW = { "Overworlds", "Affects the Overworld minimaps", "gCCMinimapPrim", minimap_colors, ImVec4(0, 255, 255, 255), true, false, false }; +static CosmeticsColorIndividual Minimap_DG = { "Dungeons", "Affects the Dungeon minimaps", "gCCMinimapDGNPrim", dgn_minimap_colors, ImVec4(100, 255, 255, 255), true, false, false }; +static CosmeticsColorIndividual Minimap_CP = { "Current position arrow", "Affects the current position arrow on the minimap\nYellow is the default value", "gCCMinimapCPPrim", cp_minimap_colors, ImVec4(200, 255, 0, 255), true, false, false }; +static CosmeticsColorIndividual Minimap_LE = { "Last entrance arrow", "Affects the last entrance position arrow on the minimap\nRed is the default value", "gCCMinimapLEPrim", le_minimap_colors, ImVec4(200, 0, 0, 255), true, false, false }; + +//Title Cards colors +static CosmeticsColorIndividual TitleCards_OW = { "Main color (Overworld)", "Affects all the overworld title cards color, white is the default value", "gCCTC_OW_U_Prim", tc_ou_colors, ImVec4(255, 255, 255, 255), false, false, false }; +static CosmeticsColorIndividual TitleCards_DG = { "Main color (Dungeon)", "Affects all the bosses title cards color, white is the default value", "gCCTC_B_U_Prim", tc_bu_colors, ImVec4(255, 255, 255, 255), false, false, false }; + +//Misc. colors, the one I have no clue where to put nor that aren't that important +#ifdef MASTER_QUEST +static CosmeticsColorIndividual TitleScreen_fire_Prim = { "Opening logo fire (Primary)", "Affects the fire behind the title screen logo", "gCCTCFirePrim", tc_fire_colors, ImVec4(170, 255, 255, 255), false, false, false }; +static CosmeticsColorIndividual TitleScreen_fire_Env = { "Opening logo fire (Secondary)", "Affects the fire behind the title screen logo", "gCCTCFireEnv", tc_fire_colors_env, ImVec4(200, 255, 0, 255), false, false, false }; +#else +static CosmeticsColorIndividual TitleScreen_fire_Prim = { "Opening logo fire (Primary)", "Affects the fire behind the title screen logo", "gCCTCFirePrim", tc_fire_colors, ImVec4(255, 255, 170, 255), false, false, false }; +static CosmeticsColorIndividual TitleScreen_fire_Env = { "Opening logo fire (Secondary)", "Affects the fire behind the title screen logo", "gCCTCFireEnv", tc_fire_colors_env, ImVec4(255, 100, 0, 255), false, false, false }; +#endif +static CosmeticsColorIndividual Rupee_Icon = { "Rupee icon", "Affects the Rupee icon on interface\nGreen is the default value", "gCCRupeePrim", rupee_colors, ImVec4(200, 255, 100, 255), true, false, false }; +static CosmeticsColorIndividual SmallKeys_Icon = { "Small Keys icon", "Affects the Small keys icon on interface\nGray is the default value", "gCCKeysPrim", smolekey_colors, ImVec4(200, 230, 255, 255), true, false, false }; +static CosmeticsColorIndividual VSOA_Icon = { "Visual Stone of agony icon", "Affects the Stone of Agony icon on interface\nWhite is the default value\nRequire room reload or activation", "gCCVSOAPrim", visualagony_colors, ImVec4(255, 255, 255, 255), true, false, false }; + +//Sections creation, here I regroup them in some sort of a Theme, all navi stuff together etc. It will be used to create the menu. +static CosmeticsColorSection Navi_Section[] = { + { &Navi_Idle_Inner, false, false }, + { &Navi_Idle_Outer, true, false }, + { &Navi_Npc_Inner, false, true }, + { &Navi_Npc_Outer, true, false }, + { &Navi_Enemy_Inner, false, true }, + { &Navi_Enemy_Outer, true, false }, + { &Navi_Prop_Inner, false, true }, + { &Navi_Prop_Outer, true, false } +}; +static CosmeticsColorSection Keese_Section[] = { + { &Keese1_prim, false, false }, + { &Keese2_prim, true, false }, + { &Keese1_env, false, true }, + { &Keese2_env, true, false } +}; +static CosmeticsColorSection Dogs_Section[] = { + { &DogN1, false, false }, + { &DogN2, true, false } +}; +static CosmeticsColorSection Tunics_Section[] = { + { &KokiriTunic, false, false }, + { &GoronTunic, true, false }, + { &ZoraTunic, true, false } +}; +static CosmeticsColorSection Arrows_section[] = { + { &Fire_Arrow_Prim, false, false }, + { &Fire_Arrow_Env, true, false }, + { &Ice_Arrow_Prim, false, true }, + { &Ice_Arrow_Env, true, false }, + { &Light_Arrow_Prim, false, true }, + { &Light_Arrow_Env, true, false } +}; +static CosmeticsColorSection Spells_section[] = { + { &Din_Fire_Prim, false, false }, + { &Din_Fire_Env, true, false }, + { &Nayru_Diamond_Prim, false, true }, + { &Nayru_Diamond_Env, true, false }, + { &Nayru_Orb_Prim, false, true }, + { &Nayru_Orb_Env, true, false } +}; +static CosmeticsColorSection SpinAtk_section[] = { + { &Spin_Lv1_Prim, false, false }, + { &Spin_Lv1_Env, true, false }, + { &Spin_Lv2_Prim, false, true }, + { &Spin_Lv2_Env, true, false } +}; +static CosmeticsColorSection Trails_section[] = { + { &Trails_col, false, false } +}; +static CosmeticsColorSection FileChoose_section[] = { + { &FileChoose_Background, false, false }, + { &FileChoose_BottomText, true, false } +}; +static CosmeticsColorSection A_Btn_section[] = { + { &A_Btn, false, false } +}; +static CosmeticsColorSection B_Btn_section[] = { + { &B_Btn, false, false } +}; +static CosmeticsColorSection C_Btn_Unified_section[] = { + { &C_Btn, false, false } +}; +static CosmeticsColorSection C_Btn_Separated_section[] = { + { &C_Btn_U, false, false }, + { &C_Btn_D, false, true }, + { &C_Btn_L, false, true }, + { &C_Btn_R, false, true } +}; +static CosmeticsColorSection Start_Btn_section[] = { + { &Start_btn, false, false } +}; +static CosmeticsColorSection DPad_section[] = { + { &DPad_Items, false, false } +}; +static CosmeticsColorSection Hearts_section[] = { + { &Hearts_NInner, false, false }, + { &Hearts_DDInner, true, false }, + { &Hearts_DDOutline, true, false } +}; +static CosmeticsColorSection Magic_Meter_section[] = { + { &Magic_Borders, false, false }, + { &Magic_InUse_Borders, true, false }, + { &Magic_Meter, false, true }, + { &Magic_InUse_Meter, true, false } +}; +static CosmeticsColorSection Minimap_section[] = { + { &Minimap_OW, false, false }, + { &Minimap_DG, false, true }, + { &Minimap_CP, false, true }, + { &Minimap_LE, false, true } +}; +static CosmeticsColorSection TitleCards_section[] = { + { &TitleCards_OW, false, false }, + { &TitleCards_DG, true, false } +}; +static CosmeticsColorSection Misc_section[] = { + { &Rupee_Icon, false, false }, + { &SmallKeys_Icon, false, true }, + { &VSOA_Icon, false, true }, + { &TitleScreen_fire_Prim, false, true }, + { &TitleScreen_fire_Env, false, true } +}; + +//Randomizer specific stuff (by randomizer I mean within cosmetics, these section are there just for the purpose of randomizing their colors) +static CosmeticsColorSection Everything_Section[] = { + { &TitleScreen_fire_Prim, false, true }, + { &TitleScreen_fire_Env, false, true }, + { &Navi_Idle_Inner, false, false }, + { &Navi_Idle_Outer, true, false }, + { &Navi_Npc_Inner, false, true }, + { &Navi_Npc_Outer, true, false }, + { &Navi_Enemy_Inner, false, true }, + { &Navi_Enemy_Outer, true, false }, + { &Navi_Prop_Inner, false, true }, + { &Navi_Prop_Outer, true, false }, + { &Keese1_prim, false, false }, + { &Keese2_prim, true, false }, + { &Keese1_env, false, true }, + { &Keese2_env, true, false }, + { &DogN1, false, false }, + { &DogN2, true, false }, + { &KokiriTunic, false, false }, + { &GoronTunic, true, false }, + { &ZoraTunic, true, false }, + { &Fire_Arrow_Prim, false, false }, + { &Fire_Arrow_Env, true, false }, + { &Ice_Arrow_Prim, false, true }, + { &Ice_Arrow_Env, true, false }, + { &Light_Arrow_Prim, false, true }, + { &Light_Arrow_Env, true, false }, + { &Din_Fire_Prim, false, false }, + { &Din_Fire_Env, true, false }, + { &Nayru_Diamond_Prim, false, true }, + { &Nayru_Diamond_Env, true, false }, + { &Nayru_Orb_Prim, false, true }, + { &Nayru_Orb_Env, true, false }, + { &Spin_Lv1_Prim, false, false }, + { &Spin_Lv1_Env, true, false }, + { &Spin_Lv2_Prim, false, true }, + { &Spin_Lv2_Env, true, false }, + { &Trails_col, false, false }, + { &FileChoose_Background, false, false }, + { &FileChoose_BottomText, true, false }, + { &A_Btn, false, false }, + { &B_Btn, false, false }, + { &C_Btn, false, false }, + { &C_Btn_U, false, false }, + { &C_Btn_D, false, true }, + { &C_Btn_L, false, true }, + { &C_Btn_R, false, true }, + { &Start_btn, false, false }, + { &DPad_Items, false, false }, + { &Hearts_NInner, false, false }, + { &Hearts_DDInner, true, false }, + { &Hearts_DDOutline, true, false }, + { &Magic_Borders, false, false }, + { &Magic_InUse_Borders, true, false }, + { &Magic_Meter, false, true }, + { &Magic_InUse_Meter, true, false }, + { &Minimap_OW, false, false }, + { &Minimap_DG, false, true }, + { &Minimap_CP, false, true }, + { &Minimap_LE, false, true }, + { &TitleCards_OW, false, false }, + { &TitleCards_DG, true, false }, + { &Rupee_Icon, false, false }, + { &SmallKeys_Icon, false, true }, + { &VSOA_Icon, false, true } +}; +static CosmeticsColorSection Buttons_section[]{ + { &DPad_Items, false, false }, + { &C_Btn_U, false, false }, + { &C_Btn_D, false, true }, + { &C_Btn_L, false, true }, + { &C_Btn_R, false, true }, + { &C_Btn, false, false }, + { &B_Btn, false, false }, + { &A_Btn, false, false }, + { &Start_btn, false, false } +}; +static CosmeticsColorSection Misc_Interface_section[]{ + { &Hearts_NInner, false, false }, + { &Hearts_DDInner, true, false }, + { &Hearts_DDOutline, true, false }, + { &Magic_Borders, false, false }, + { &Magic_InUse_Borders, true, false }, + { &Magic_Meter, false, true }, + { &Magic_InUse_Meter, true, false }, + { &Minimap_OW, false, false }, + { &Minimap_DG, false, true }, + { &Minimap_CP, false, true }, + { &Minimap_LE, false, true }, + { &TitleCards_OW, false, false }, + { &TitleCards_DG, true, false }, + { &Rupee_Icon, false, false }, + { &SmallKeys_Icon, false, true }, + { &VSOA_Icon, false, true }, + { &TitleScreen_fire_Prim, false, true }, + { &TitleScreen_fire_Env, false, true } +}; +static CosmeticsColorSection NPCs_section[]{ + { &Navi_Idle_Inner, false, false }, + { &Navi_Idle_Outer, true, false }, + { &Navi_Npc_Inner, false, true }, + { &Navi_Npc_Outer, true, false }, + { &Navi_Enemy_Inner, false, true }, + { &Navi_Enemy_Outer, true, false }, + { &Navi_Prop_Inner, false, true }, + { &Navi_Prop_Outer, true, false }, + { &Keese1_prim, false, false }, + { &Keese2_prim, true, false }, + { &Keese1_env, false, true }, + { &Keese2_env, true, false }, + { &DogN1, false, false }, + { &DogN2, true, false } +}; +static CosmeticsColorSection AllItemsSkills_section[]{ + { &KokiriTunic, false, false }, + { &GoronTunic, true, false }, + { &ZoraTunic, true, false }, + { &Fire_Arrow_Prim, false, false }, + { &Fire_Arrow_Env, true, false }, + { &Ice_Arrow_Prim, false, true }, + { &Ice_Arrow_Env, true, false }, + { &Light_Arrow_Prim, false, true }, + { &Light_Arrow_Env, true, false }, + { &Din_Fire_Prim, false, false }, + { &Din_Fire_Env, true, false }, + { &Nayru_Diamond_Prim, false, true }, + { &Nayru_Diamond_Env, true, false }, + { &Nayru_Orb_Prim, false, true }, + { &Nayru_Orb_Env, true, false }, + { &Spin_Lv1_Prim, false, false }, + { &Spin_Lv1_Env, true, false }, + { &Spin_Lv2_Prim, false, true }, + { &Spin_Lv2_Env, true, false }, + { &Trails_col, false, false } +}; void InitCosmeticsEditor();//Init the menu itself void LoadRainbowColor(); diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index 8e72392ca..409f2e4b5 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -1,7 +1,3 @@ -#ifdef _MSC_VER -#define NOGDI -#endif - #include "debugconsole.h" #include "../libultraship/ImGuiImpl.h" #include "savestates.h" @@ -313,6 +309,69 @@ static bool EntranceHandler(std::shared_ptr Console, const std::v gSaveContext.nextTransition = 11; } +static bool VoidHandler(std::shared_ptr Console, const std::vector& args) { + if (gGlobalCtx != nullptr) { + gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = gGlobalCtx->actorCtx.flags.tempSwch; + gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = gGlobalCtx->actorCtx.flags.tempCollect; + gSaveContext.respawnFlag = 1; + gGlobalCtx->sceneLoadFlag = 0x14; + gGlobalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex; + gGlobalCtx->fadeTransition = 2; + gSaveContext.nextTransition = 2; + } else { + SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr"); + return CMD_FAILED; + } + return CMD_SUCCESS; +} + +static bool ReloadHandler(std::shared_ptr Console, const std::vector& args) { + if (gGlobalCtx != nullptr) { + gGlobalCtx->nextEntranceIndex = gSaveContext.entranceIndex; + gGlobalCtx->sceneLoadFlag = 0x14; + gGlobalCtx->fadeTransition = 11; + gSaveContext.nextTransition = 11; + } else { + SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr"); + return CMD_FAILED; + } + return CMD_SUCCESS; +} + +static bool FWHandler(std::shared_ptr Console, const std::vector& args) { + if (gGlobalCtx != nullptr) { + if (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 0) { + gGlobalCtx->sceneLoadFlag = 0x14; + gGlobalCtx->nextEntranceIndex = gSaveContext.respawn[RESPAWN_MODE_TOP].entranceIndex; + gGlobalCtx->fadeTransition = 5; + } else { + SohImGui::console->SendErrorMessage("Farore's wind not set!"); + } + } + else { + SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr"); + return CMD_FAILED; + } + + return CMD_SUCCESS; +} + +static bool FileSelectHandler(std::shared_ptr Console, const std::vector& args) { + if (gGlobalCtx != nullptr) { + SET_NEXT_GAMESTATE(&gGlobalCtx->state, FileChoose_Init, FileChooseContext); + gGlobalCtx->state.running = 0; + } else { + SohImGui::console->SendErrorMessage("gGlobalCtx == nullptr"); + return CMD_FAILED; + } + return CMD_SUCCESS; +} + +static bool QuitHandler(std::shared_ptr Console, const std::vector& args) { + gGlobalCtx->state.running = 0; + return CMD_SUCCESS; +} + static bool SaveStateHandler(std::shared_ptr Console, const std::vector& args) { unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot(); const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::SAVE }); @@ -500,6 +559,11 @@ void DebugConsole_Init(void) { CMD_REGISTER("entrance", { EntranceHandler, "Sends player to the entered entrance (hex)", { { "entrance", Ship::ArgumentType::NUMBER } } }); + CMD_REGISTER("void", {VoidHandler, "Voids out of the current map.",}); + CMD_REGISTER("reload", {ReloadHandler, "Reloads the current map.",}); + CMD_REGISTER("file_select", {FileSelectHandler, "Returns to the file select.",}); + CMD_REGISTER("fw", {FWHandler,"Spawns the player where Farore's Wind is set.", }); + CMD_REGISTER("quit", {QuitHandler, "Quits the game.",}); CMD_REGISTER("save_state", { SaveStateHandler, "Save a state." }); CMD_REGISTER("load_state", { LoadStateHandler, "Load a state." }); diff --git a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp index 56e84dd1e..da91fcd9b 100644 --- a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp @@ -6,9 +6,7 @@ #include "rando_main.hpp" // #include #include -#define NOGDI -#define WIN32_LEAN_AND_MEAN -#include +#include #include #define TICKS_PER_SEC 268123480.0 @@ -21,10 +19,10 @@ void RandoMain::GenerateRando(std::unordered_map cvarS // std::string settingsFileName = "./randomizer/latest_settings.json"; // CVar_SetString("gLoadedPreset", settingsFileName.c_str()); - std::string fileName = Ship::GlobalCtx2::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations).c_str()); + std::string fileName = Ship::Window::GetPathRelativeToAppDirectory(GenerateRandomizer(cvarSettings, excludedLocations).c_str()); CVar_SetString("gSpoilerLog", fileName.c_str()); CVar_Save(); CVar_Load(); CVar_SetS32("gNewSeedGenerated", 1); -} \ No newline at end of file +} diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index 22d1f196d..675f28cae 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -26,9 +26,7 @@ #include #include -#define NOGDI -#define WIN32_LEAN_AND_MEAN -#include "GlobalCtx2.h" +#include "Window.h" using json = nlohmann::json; @@ -728,12 +726,12 @@ const char* SpoilerLog_Write(int language) { //WriteShuffledEntrances(spoilerLog); WriteAllLocations(language); - if (!std::filesystem::exists(Ship::GlobalCtx2::GetPathRelativeToAppDirectory("Randomizer"))) { - std::filesystem::create_directory(Ship::GlobalCtx2::GetPathRelativeToAppDirectory("Randomizer")); + if (!std::filesystem::exists(Ship::Window::GetPathRelativeToAppDirectory("Randomizer"))) { + std::filesystem::create_directory(Ship::Window::GetPathRelativeToAppDirectory("Randomizer")); } std::string jsonString = jsonData.dump(4); - std::ofstream jsonFile(Ship::GlobalCtx2::GetPathRelativeToAppDirectory( + std::ofstream jsonFile(Ship::Window::GetPathRelativeToAppDirectory( (std::string("Randomizer/") + std::string(Settings::seed) + std::string(".json")).c_str())); jsonFile << std::setw(4) << jsonString << std::endl; jsonFile.close(); diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 805e866da..dd2126815 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -3,8 +3,8 @@ #include #include #include -#include -#include "GlobalCtx2.h" +#include + #include "ResourceMgr.h" #include "DisplayList.h" #include "PlayerAnimation.h" @@ -42,6 +42,9 @@ #include "Hooks.h" #include +#include "Lib/Fast3D/gfx_pc.h" +#include "Lib/Fast3D/gfx_rendering_api.h" + #ifdef __APPLE__ #include #else @@ -65,10 +68,9 @@ CustomMessageManager* CustomMessageManager::Instance; ItemTableManager* ItemTableManager::Instance; OTRGlobals::OTRGlobals() { - context = Ship::GlobalCtx2::CreateInstance("Ship of Harkinian"); + context = Ship::Window::CreateInstance("Ship of Harkinian"); gSaveStateMgr = std::make_shared(); gRandomizer = std::make_shared(); - context->GetWindow()->Init(); } OTRGlobals::~OTRGlobals() { @@ -380,14 +382,14 @@ extern "C" uint64_t GetPerfCounter() { // C->C++ Bridge extern "C" void Graph_ProcessFrame(void (*run_one_game_iter)(void)) { - OTRGlobals::Instance->context->GetWindow()->MainLoop(run_one_game_iter); + OTRGlobals::Instance->context->MainLoop(run_one_game_iter); } extern "C" void Graph_StartFrame() { #ifndef __WIIU__ // Why -1? - int32_t dwScancode = OTRGlobals::Instance->context->GetWindow()->GetLastScancode(); - OTRGlobals::Instance->context->GetWindow()->SetLastScancode(-1); + int32_t dwScancode = OTRGlobals::Instance->context->GetLastScancode(); + OTRGlobals::Instance->context->SetLastScancode(-1); switch (dwScancode - 1) { case SDL_SCANCODE_F5: { @@ -443,7 +445,14 @@ extern "C" void Graph_StartFrame() { } } #endif - OTRGlobals::Instance->context->GetWindow()->StartFrame(); + OTRGlobals::Instance->context->StartFrame(); +} + +void RunCommands(Gfx* Commands, const std::vector>& mtx_replacements) { + for (const auto& m : mtx_replacements) { + gfx_run(Commands, m); + gfx_end_frame(); + } } // C->C++ Bridge @@ -484,12 +493,12 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) { time -= fps; - OTRGlobals::Instance->context->GetWindow()->SetTargetFps(fps); + OTRGlobals::Instance->context->SetTargetFps(fps); int threshold = CVar_GetS32("gExtraLatencyThreshold", 80); - OTRGlobals::Instance->context->GetWindow()->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1); + OTRGlobals::Instance->context->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1); - OTRGlobals::Instance->context->GetWindow()->RunCommands(commands, mtx_replacements); + RunCommands(commands, mtx_replacements); last_fps = fps; last_update_rate = R_UPDATE_RATE; @@ -502,19 +511,19 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) { } // OTRTODO: FIGURE OUT END FRAME POINT - /* if (OTRGlobals::Instance->context->GetWindow()->lastScancode != -1) - OTRGlobals::Instance->context->GetWindow()->lastScancode = -1;*/ + /* if (OTRGlobals::Instance->context->lastScancode != -1) + OTRGlobals::Instance->context->lastScancode = -1;*/ } float divisor_num = 0.0f; extern "C" void OTRGetPixelDepthPrepare(float x, float y) { - OTRGlobals::Instance->context->GetWindow()->GetPixelDepthPrepare(x, y); + OTRGlobals::Instance->context->GetPixelDepthPrepare(x, y); } extern "C" uint16_t OTRGetPixelDepth(float x, float y) { - return OTRGlobals::Instance->context->GetWindow()->GetPixelDepth(x, y); + return OTRGlobals::Instance->context->GetPixelDepth(x, y); } extern "C" uint32_t ResourceMgr_GetGameVersion() @@ -1326,7 +1335,7 @@ extern "C" s32* ResourceMgr_LoadCSByName(const char* path) } std::filesystem::path GetSaveFile(std::shared_ptr Conf) { - const std::string fileName = Conf->getString("Game.SaveName", Ship::GlobalCtx2::GetPathRelativeToAppDirectory("oot_save.sav")); + const std::string fileName = Conf->getString("Game.SaveName", Ship::Window::GetPathRelativeToAppDirectory("oot_save.sav")); std::filesystem::path saveFile = std::filesystem::absolute(fileName); if (!exists(saveFile.parent_path())) { @@ -1457,15 +1466,15 @@ extern "C" void OTRGfxPrint(const char* str, void* printer, void (*printImpl)(vo } extern "C" uint32_t OTRGetCurrentWidth() { - return OTRGlobals::Instance->context->GetWindow()->GetCurrentWidth(); + return OTRGlobals::Instance->context->GetCurrentWidth(); } extern "C" uint32_t OTRGetCurrentHeight() { - return OTRGlobals::Instance->context->GetWindow()->GetCurrentHeight(); + return OTRGlobals::Instance->context->GetCurrentHeight(); } extern "C" void OTRControllerCallback(ControllerCallback* controller) { - auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + auto controlDeck = Ship::Window::GetInstance()->GetControlDeck(); for (int i = 0; i < controlDeck->GetNumVirtualDevices(); ++i) { auto physicalDevice = controlDeck->GetPhysicalDeviceFromVirtualSlot(i); @@ -1497,33 +1506,33 @@ extern "C" int16_t OTRGetRectDimensionFromRightEdge(float v) { } extern "C" bool AudioPlayer_Init(void) { - if (OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer() != nullptr) { - return OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer()->Init(); + if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { + return OTRGlobals::Instance->context->GetAudioPlayer()->Init(); } return false; } extern "C" int AudioPlayer_Buffered(void) { - if (OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer() != nullptr) { - return OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer()->Buffered(); + if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { + return OTRGlobals::Instance->context->GetAudioPlayer()->Buffered(); } } extern "C" int AudioPlayer_GetDesiredBuffered(void) { - if (OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer() != nullptr) { - return OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer()->GetDesiredBuffered(); + if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { + return OTRGlobals::Instance->context->GetAudioPlayer()->GetDesiredBuffered(); } } extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) { - if (OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer() != nullptr) { - OTRGlobals::Instance->context->GetWindow()->GetAudioPlayer()->Play(buf, len); + if (OTRGlobals::Instance->context->GetAudioPlayer() != nullptr) { + OTRGlobals::Instance->context->GetAudioPlayer()->Play(buf, len); } } extern "C" int Controller_ShouldRumble(size_t i) { - auto controlDeck = Ship::GlobalCtx2::GetInstance()->GetWindow()->GetControlDeck(); + auto controlDeck = Ship::Window::GetInstance()->GetControlDeck(); for (int i = 0; i < controlDeck->GetNumVirtualDevices(); ++i) { auto physicalDevice = controlDeck->GetPhysicalDeviceFromVirtualSlot(i); @@ -1604,7 +1613,7 @@ extern "C" CustomMessageEntry Randomizer_GetHintFromCheck(RandomizerCheck check) } extern "C" GetItemEntry ItemTable_Retrieve(int16_t getItemID) { - GetItemEntry giEntry = ItemTableManager::Instance->RetrieveItemEntry(MOD_NONE, getItemID); + GetItemEntry giEntry = ItemTableManager::Instance->RetrieveItemEntry(OTRGlobals::Instance->getItemModIndex, getItemID); return giEntry; } @@ -1635,12 +1644,12 @@ extern "C" GetItemEntry Randomizer_GetItemFromKnownCheck(RandomizerCheck randomi return ItemTable_RetrieveEntry(getItemModIndex, itemID); } -extern "C" u32 Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor) { +extern "C" bool Randomizer_ObtainedFreestandingIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId, Actor* actor) { return gSaveContext.n64ddFlag && (actor->parent != NULL) && Randomizer_GetItemFromKnownCheck(randomizerCheck, ogId).getItemId == RG_ICE_TRAP; } -extern "C" u32 Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId) { +extern "C" bool Randomizer_ItemIsIceTrap(RandomizerCheck randomizerCheck, GetItemID ogId) { return gSaveContext.n64ddFlag && Randomizer_GetItemFromKnownCheck(randomizerCheck, ogId).getItemId == RG_ICE_TRAP; } diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 069707cd9..dc304358d 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -3,11 +3,11 @@ #pragma once -#include "GlobalCtx2.h" #include "SaveManager.h" #include #ifdef __cplusplus +#include "Window.h" #include "Enhancements/savestates.h" #include "Enhancements/randomizer/randomizer.h" @@ -18,7 +18,7 @@ class OTRGlobals public: static OTRGlobals* Instance; - std::shared_ptr context; + std::shared_ptr context; std::shared_ptr gSaveStateMgr; std::shared_ptr gRandomizer; uint16_t getItemModIndex; diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 9f93a777d..e8f73d0c5 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -16,7 +16,7 @@ extern "C" SaveContext gSaveContext; std::filesystem::path SaveManager::GetFileName(int fileNum) { - const std::filesystem::path sSavePath(Ship::GlobalCtx2::GetPathRelativeToAppDirectory("Save")); + const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save")); return sSavePath / ("file" + std::to_string(fileNum + 1) + ".sav"); } @@ -137,10 +137,10 @@ void SaveManager::SaveRandomizer() { } void SaveManager::Init() { - const std::filesystem::path sSavePath(Ship::GlobalCtx2::GetPathRelativeToAppDirectory("Save")); + const std::filesystem::path sSavePath(Ship::Window::GetPathRelativeToAppDirectory("Save")); const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav"); - auto sOldSavePath = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("oot_save.sav"); - auto sOldBackupSavePath = Ship::GlobalCtx2::GetPathRelativeToAppDirectory("oot_save.bak"); + auto sOldSavePath = Ship::Window::GetPathRelativeToAppDirectory("oot_save.sav"); + auto sOldBackupSavePath = Ship::Window::GetPathRelativeToAppDirectory("oot_save.bak"); // If the save directory does not exist, create it if (!std::filesystem::exists(sSavePath)) { diff --git a/soh/soh/z_play_otr.cpp b/soh/soh/z_play_otr.cpp index 8e7b21003..d0137644c 100644 --- a/soh/soh/z_play_otr.cpp +++ b/soh/soh/z_play_otr.cpp @@ -69,7 +69,7 @@ void OTRGameplay_InitScene(GlobalContext* globalCtx, s32 spawn) { gSaveContext.worldMapArea = 0; OTRScene_ExecuteCommands(globalCtx, globalCtx->sceneSegment); Gameplay_InitEnvironment(globalCtx, globalCtx->skyboxId); - /* auto data = static_cast(Ship::GlobalCtx2::GetInstance() + /* auto data = static_cast(Ship::Window::GetInstance() ->GetResourceManager() ->LoadResource("object_link_child\\object_link_childVtx_01FE08") .get()); diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 055db0e9f..bf34412cb 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -1009,20 +1009,15 @@ void TitleCard_InitPlaceName(GlobalContext* globalCtx, TitleCardContext* titleCt } void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) { - s16* TitleCard_Colors[3] = {255,255,255}; - if (titleCtx->isBossCard && CVar_GetS32("gHudColors", 1) == 2) {//Bosses cards. - TitleCard_Colors[0] = CVar_GetS32("gCCTC_B_U_PrimR", 255); - TitleCard_Colors[1] = CVar_GetS32("gCCTC_B_U_PrimG", 255); - TitleCard_Colors[2] = CVar_GetS32("gCCTC_B_U_PrimB", 255); - } else if (!titleCtx->isBossCard && CVar_GetS32("gHudColors", 1) == 2) { - TitleCard_Colors[0] = CVar_GetS32("gCCTC_OW_U_PrimR", 255); - TitleCard_Colors[1] = CVar_GetS32("gCCTC_OW_U_PrimG", 255); - TitleCard_Colors[2] = CVar_GetS32("gCCTC_OW_U_PrimB", 255); - } else { - TitleCard_Colors[0] = 255; - TitleCard_Colors[1] = 255; - TitleCard_Colors[2] = 255; - } + const Color_RGB8 TitleCard_Colors_ori = {255,255,255}; + Color_RGB8 TitleCard_Colors = {255,255,255}; + if (titleCtx->isBossCard && CVar_GetS32("gHudColors", 1) == 2) {//Bosses cards. + TitleCard_Colors = CVar_GetRGB("gCCTC_B_U_Prim", TitleCard_Colors_ori); + } else if (!titleCtx->isBossCard && CVar_GetS32("gHudColors", 1) == 2) { + TitleCard_Colors = CVar_GetRGB("gCCTC_OW_U_Prim", TitleCard_Colors_ori); + } else { + TitleCard_Colors = TitleCard_Colors_ori; + } if (DECR(titleCtx->delayTimer) == 0) { if (DECR(titleCtx->durationTimer) == 0) { @@ -1032,9 +1027,9 @@ void TitleCard_Update(GlobalContext* globalCtx, TitleCardContext* titleCtx) { Math_StepToS(&titleCtx->intensityB, 0, 70); } else { Math_StepToS(&titleCtx->alpha, 255, 10); - Math_StepToS(&titleCtx->intensityR, TitleCard_Colors[0], 20); - Math_StepToS(&titleCtx->intensityG, TitleCard_Colors[1], 20); - Math_StepToS(&titleCtx->intensityB, TitleCard_Colors[2], 20); + Math_StepToS(&titleCtx->intensityR, TitleCard_Colors.r, 20); + Math_StepToS(&titleCtx->intensityG, TitleCard_Colors.g, 20); + Math_StepToS(&titleCtx->intensityB, TitleCard_Colors.b, 20); } } } @@ -1195,7 +1190,8 @@ void Actor_Init(Actor* actor, GlobalContext* globalCtx) { actor->uncullZoneDownward = 700.0f; if (CVar_GetS32("gDisableDrawDistance", 0) != 0 && actor->id != ACTOR_EN_TORCH2 && actor->id != ACTOR_EN_BLKOBJ // Extra check for Dark Link and his room && actor->id != ACTOR_EN_HORSE // Check for Epona, else if we call her she will spawn at the other side of the map + we can hear her during the title screen sequence - && actor->id != ACTOR_EN_HORSE_GANON && actor->id != ACTOR_EN_HORSE_ZELDA) { // check for Zelda's and Ganondorf's horses that will always be scene during cinematic whith camera paning + && actor->id != ACTOR_EN_HORSE_GANON && actor->id != ACTOR_EN_HORSE_ZELDA // check for Zelda's and Ganondorf's horses that will always be scene during cinematic whith camera paning + && (globalCtx->sceneNum != SCENE_DDAN && actor->id != ACTOR_EN_ZF)) { // Check for DC and Lizalfos for the case where the miniboss music would still play under certains conditions and changing room actor->uncullZoneForward = 32767.0f; actor->uncullZoneScale = 32767.0f; actor->uncullZoneDownward = 32767.0f; @@ -2840,7 +2836,8 @@ s32 func_800314D4(GlobalContext* globalCtx, Actor* actor, Vec3f* arg2, f32 arg3) if (CVar_GetS32("gDisableDrawDistance", 0) != 0 && actor->id != ACTOR_EN_TORCH2 && actor->id != ACTOR_EN_BLKOBJ // Extra check for Dark Link and his room && actor->id != ACTOR_EN_HORSE // Check for Epona, else if we call her she will spawn at the other side of the map + we can hear her during the title screen sequence - && actor->id != ACTOR_EN_HORSE_GANON && actor->id != ACTOR_EN_HORSE_ZELDA) { // check for Zelda's and Ganondorf's horses that will always be scene during cinematic whith camera paning + && actor->id != ACTOR_EN_HORSE_GANON && actor->id != ACTOR_EN_HORSE_ZELDA // check for Zelda's and Ganondorf's horses that will always be scene during cinematic whith camera paning + && (globalCtx->sceneNum != SCENE_DDAN && actor->id != ACTOR_EN_ZF)) { // Check for DC and Lizalfos for the case where the miniboss music would still play under certains conditions and changing room return true; } diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index ea37cab1a..5cb01d052 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -1488,8 +1488,8 @@ s32 Camera_Free(Camera* camera) { f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f; f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f; - camera->globalCtx->camX += newCamX; - camera->globalCtx->camY += newCamY; + camera->globalCtx->camX += newCamX * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1); + camera->globalCtx->camY += newCamY * (CVar_GetS32("gInvertYAxis", 0) ? 1 : -1); if (camera->globalCtx->camY > 0x32A4) { camera->globalCtx->camY = 0x32A4; diff --git a/soh/src/code/z_eff_blure.c b/soh/src/code/z_eff_blure.c index 47477f787..31efc7993 100644 --- a/soh/src/code/z_eff_blure.c +++ b/soh/src/code/z_eff_blure.c @@ -3,6 +3,8 @@ #include "soh/frame_interpolation.h" +const Color_RGB8 Trails_Color_ori = {255,255,255}; + void EffectBlure_AddVertex(EffectBlure* this, Vec3f* p1, Vec3f* p2) { EffectBlureElement* elem; s32 numElements; @@ -198,6 +200,7 @@ s32 EffectBlure_Update(void* thisx) { s16 GreenColor; s16 BlueColor; s16 TrailDuration; + Color_RGB8 Trails_col = CVar_GetRGB("gTrailCol", Trails_Color_ori); if (this == NULL) { return 0; @@ -208,16 +211,17 @@ s32 EffectBlure_Update(void* thisx) { } if (CVar_GetS32("gUseTrailsCol", 0) !=0) { - RedColor = CVar_GetS32("gTrailColR",255); - GreenColor = CVar_GetS32("gTrailColG",255); - BlueColor = CVar_GetS32("gTrailColB",255); - TrailDuration = 4.0f*CVar_GetS32("gTrailDurantion",1); + RedColor = Trails_col.r; + GreenColor = Trails_col.g; + BlueColor = Trails_col.b; + TrailDuration = 4.0f * CVar_GetS32("gTrailDurantion",1); } else { - RedColor = 255; - GreenColor = 255; - BlueColor = 255; + RedColor = Trails_Color_ori.r; + GreenColor = Trails_Color_ori.g; + BlueColor = Trails_Color_ori.b; TrailDuration=4.0f; } + this->p1StartColor.r = RedColor; this->p2StartColor.r = RedColor; this->p1EndColor.r = RedColor; diff --git a/soh/src/code/z_en_item00.c b/soh/src/code/z_en_item00.c index a50c74e87..54beafdab 100644 --- a/soh/src/code/z_en_item00.c +++ b/soh/src/code/z_en_item00.c @@ -70,6 +70,7 @@ static void* sItemDropTex[] = { gDropRecoveryHeartTex, gDropBombTex, gDropArrows1Tex, gDropArrows2Tex, gDropArrows3Tex, gDropBombTex, gDropDekuNutTex, gDropDekuStickTex, gDropMagicLargeTex, gDropMagicSmallTex, gDropDekuSeedsTex, gDropKeySmallTex, + // OTRTODO: use 2D bombchu texture }; static u8 sItemDropIds[] = { @@ -390,6 +391,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { case ITEM00_RUPEE_ORANGE: case ITEM00_RUPEE_PURPLE: case ITEM00_FLEXIBLE: + case ITEM00_BOMBCHU: yOffset = 500.0f; Actor_SetScale(&this->actor, 0.01f); this->scale = 0.01f; @@ -507,6 +509,9 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { case ITEM00_TUNIC_GORON: case ITEM00_BOMBS_SPECIAL: break; + case ITEM00_BOMBCHU: + Item_Give(globalCtx, ITEM_BOMBCHUS_5); + break; } if (!Actor_HasParent(&this->actor, globalCtx)) { @@ -537,7 +542,8 @@ void func_8001DFC8(EnItem00* this, GlobalContext* globalCtx) { (this->actor.params == ITEM00_HEART_PIECE)) { this->actor.shape.rot.y += 960; } else { - if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) { + if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL) && + (this->actor.params != ITEM00_BOMBCHU)) { if (this->unk_15A == -1) { if (Math_SmoothStepToS(&this->actor.shape.rot.x, this->actor.world.rot.x - 0x4000, 2, 3000, 1500) == 0) { @@ -640,7 +646,8 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { if (this->actor.params <= ITEM00_RUPEE_RED) { this->actor.shape.rot.y += 960; - } else if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL)) { + } else if ((this->actor.params >= ITEM00_SHIELD_DEKU) && (this->actor.params != ITEM00_BOMBS_SPECIAL) && + (this->actor.params != ITEM00_BOMBCHU)) { this->actor.world.rot.x -= 700; this->actor.shape.rot.y += 400; this->actor.shape.rot.x = this->actor.world.rot.x - 0x4000; @@ -722,7 +729,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { EnItem00* this = (EnItem00*)thisx; s32 pad; - if (CVar_GetS32("gNewDrops", 0)) { //set the rotation system on selected model only :) + // OTRTODO: remove special case for bombchu when its 2D drop is implemented + if (CVar_GetS32("gNewDrops", 0) || this->actor.params == ITEM00_BOMBCHU) { //set the rotation system on selected model only :) if ((this->actor.params == ITEM00_RUPEE_GREEN) || (this->actor.params == ITEM00_RUPEE_BLUE) || (this->actor.params == ITEM00_RUPEE_RED) || (this->actor.params == ITEM00_ARROWS_SINGLE) || (this->actor.params == ITEM00_ARROWS_SMALL) || (this->actor.params == ITEM00_ARROWS_MEDIUM) || @@ -730,7 +738,8 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { (this->actor.params == ITEM00_BOMBS_B) || (this->actor.params == ITEM00_NUTS) || (this->actor.params == ITEM00_MAGIC_SMALL) || (this->actor.params == ITEM00_SEEDS) || (this->actor.params == ITEM00_MAGIC_LARGE) || (this->actor.params == ITEM00_HEART) || - (this->actor.params == ITEM00_BOMBS_SPECIAL) || this->actor.params == ITEM00_HEART_PIECE) { + (this->actor.params == ITEM00_BOMBS_SPECIAL) || this->actor.params == ITEM00_HEART_PIECE || + (this->actor.params == ITEM00_BOMBCHU)) { this->actor.shape.rot.y += 960; } if (this->actor.params == ITEM00_SMALL_KEY && !gSaveContext.n64ddFlag) { @@ -891,6 +900,9 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { break; case ITEM00_BOMBS_SPECIAL: break; + case ITEM00_BOMBCHU: + Item_Give(globalCtx, ITEM_BOMBCHUS_5); + break; } params = &this->actor.params; @@ -1212,6 +1224,15 @@ void EnItem00_Draw(Actor* thisx, GlobalContext* globalCtx) { EnItem00_DrawCollectible(this, globalCtx); break; } + case ITEM00_BOMBCHU: + // OTRTODO: Stop forcing chu drops to be 3D when the texture is added + Actor_SetScale(&this->actor, 0.2f); + this->scale = 0.2f; + this->actor.shape.yOffset = 50.0f; + this->actor.world.rot.x = 0x4000; + this->actor.shape.shadowScale = 0.3f; + GetItem_Draw(globalCtx, GID_BOMBCHU); + break; case ITEM00_SHIELD_DEKU: GetItem_Draw(globalCtx, GID_SHIELD_DEKU); break; @@ -1370,6 +1391,9 @@ void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) { if (this->actor.params == ITEM00_BOMBS_SPECIAL) { texIndex = 1; + // OTRTODO: 2D bombchu drops + //} else if (this->actor.params == ITEM00_BOMBCHU) { + // texIndex = 12; } else if (this->actor.params >= ITEM00_ARROWS_SMALL) { texIndex -= 3; } @@ -1435,6 +1459,36 @@ void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) { } } +/** + * Sometimes convert the given drop ID into a bombchu. + * Returns the new drop type ID. + */ +s16 EnItem00_ConvertBombDropToBombchu(s16 dropId) { + if (INV_CONTENT(ITEM_BOMBCHU) == ITEM_NONE) { + return dropId; + } + + if (INV_CONTENT(ITEM_BOMB) == ITEM_NONE) { + return ITEM00_BOMBCHU; + } + + if (AMMO(ITEM_BOMB) <= 15) { + // Player needs bombs and might need chus, so drop whichever has less + if (AMMO(ITEM_BOMB) <= AMMO(ITEM_BOMBCHU)) { + return dropId; + } else { + return ITEM00_BOMBCHU; + } + } else { + // Player has enough bombs, so drop chus if they need some, else it's 50/50 + if (AMMO(ITEM_BOMBCHU) <= 15) { + return ITEM00_BOMBCHU; + } else { + return Rand_Next() % 2 ? dropId : ITEM00_BOMBCHU; + } + } +} + /** * Converts a given drop type ID based on link's current age, health and owned items. * Returns a new drop type ID or -1 to cancel the drop. @@ -1452,6 +1506,11 @@ s16 func_8001F404(s16 dropId) { } } + if (CVar_GetS32("gBombchuDrops", 0) && + (dropId == ITEM00_BOMBS_A || dropId == ITEM00_BOMBS_B || dropId == ITEM00_BOMBS_SPECIAL)) { + dropId = EnItem00_ConvertBombDropToBombchu(dropId); + } + // This is convoluted but it seems like it must be a single condition to match // clang-format off if (((dropId == ITEM00_BOMBS_A || dropId == ITEM00_BOMBS_SPECIAL || dropId == ITEM00_BOMBS_B) && INV_CONTENT(ITEM_BOMB) == ITEM_NONE) || diff --git a/soh/src/code/z_lifemeter.c b/soh/src/code/z_lifemeter.c index 3c402a58b..04e70159a 100644 --- a/soh/src/code/z_lifemeter.c +++ b/soh/src/code/z_lifemeter.c @@ -112,9 +112,12 @@ static s16 sHeartsDDEnvFactors[3][3] = { }; // Current colors for the double defense hearts -s16 HeartInner[3] = {HEARTS_PRIM_R,HEARTS_PRIM_G,HEARTS_PRIM_B}; -s16 HeartDDOutline[3] = {HEARTS_DD_PRIM_R,HEARTS_DD_PRIM_G,HEARTS_DD_PRIM_B}; -s16 HeartDDInner[3] = {HEARTS_DD_ENV_R,HEARTS_DD_ENV_G,HEARTS_DD_ENV_B}; +Color_RGB8 HeartInner_ori = {HEARTS_PRIM_R,HEARTS_PRIM_G,HEARTS_PRIM_B}; +Color_RGB8 HeartDDOutline_ori = {HEARTS_DD_PRIM_R,HEARTS_DD_PRIM_G,HEARTS_DD_PRIM_B}; +Color_RGB8 HeartDDInner_ori = {HEARTS_DD_ENV_R,HEARTS_DD_ENV_G,HEARTS_DD_ENV_B}; +Color_RGB8 HeartInner; +Color_RGB8 HeartDDOutline; +Color_RGB8 HeartDDInner; s16 sBeatingHeartsDDPrim[3]; s16 sBeatingHeartsDDEnv[3]; s16 sHeartsDDPrim[2][3]; @@ -123,19 +126,13 @@ s16 sHeartsDDEnv[2][3]; void HealthMeter_Init(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; if (CVar_GetS32("gHudColors", 1) == 2) { - HeartInner[0] = CVar_GetS32("gCCHeartsPrimR", 90); - HeartInner[1] = CVar_GetS32("gCCHeartsPrimG", 90); - HeartInner[2] = CVar_GetS32("gCCHeartsPrimB", 90); - HeartDDOutline[0] = CVar_GetS32("gDDCCHeartsPrimR", 90); - HeartDDOutline[1] = CVar_GetS32("gDDCCHeartsPrimG", 90); - HeartDDOutline[2] = CVar_GetS32("gDDCCHeartsPrimB", 90); + HeartInner = CVar_GetRGB("gCCHeartsPrim", HeartInner_ori); + HeartDDInner = CVar_GetRGB("gCCDDHeartsPrim", HeartDDInner_ori); + HeartDDOutline = CVar_GetRGB("gDDCCHeartsPrim", HeartDDOutline_ori); } else { - HeartInner[0] = HEARTS_PRIM_R; - HeartInner[1] = HEARTS_PRIM_G; - HeartInner[2] = HEARTS_PRIM_B; - HeartDDOutline[0] = HEARTS_DD_PRIM_R; - HeartDDOutline[1] = HEARTS_DD_PRIM_G; - HeartDDOutline[2] = HEARTS_DD_PRIM_B; + HeartInner = HeartInner_ori; + HeartDDInner = HeartDDInner_ori; + HeartDDOutline = HeartDDOutline_ori; } interfaceCtx->unk_228 = 0x140; @@ -143,33 +140,33 @@ void HealthMeter_Init(GlobalContext* globalCtx) { interfaceCtx->unk_22A = interfaceCtx->unk_1FE = 0; interfaceCtx->unk_22C = interfaceCtx->unk_200 = 0; - interfaceCtx->heartsPrimR[0] = HeartInner[0]; - interfaceCtx->heartsPrimG[0] = HeartInner[1]; - interfaceCtx->heartsPrimB[0] = HeartInner[2]; + interfaceCtx->heartsPrimR[0] = HeartInner.r; + interfaceCtx->heartsPrimG[0] = HeartInner.g; + interfaceCtx->heartsPrimB[0] = HeartInner.b; interfaceCtx->heartsEnvR[0] = HEARTS_ENV_R; interfaceCtx->heartsEnvG[0] = HEARTS_ENV_G; interfaceCtx->heartsEnvB[0] = HEARTS_ENV_B; - interfaceCtx->heartsPrimR[1] = HeartInner[0]; - interfaceCtx->heartsPrimG[1] = HeartInner[1]; - interfaceCtx->heartsPrimB[1] = HeartInner[2]; + interfaceCtx->heartsPrimR[1] = HeartInner.r; + interfaceCtx->heartsPrimG[1] = HeartInner.g; + interfaceCtx->heartsPrimB[1] = HeartInner.b; interfaceCtx->heartsEnvR[1] = HEARTS_ENV_R; interfaceCtx->heartsEnvG[1] = HEARTS_ENV_G; interfaceCtx->heartsEnvB[1] = HEARTS_ENV_B; - sHeartsDDPrim[0][0] = sHeartsDDPrim[1][0] = HeartDDOutline[0]; - sHeartsDDPrim[0][1] = sHeartsDDPrim[1][1] = HeartDDOutline[1]; - sHeartsDDPrim[0][2] = sHeartsDDPrim[1][2] = HeartDDOutline[2]; + sHeartsDDPrim[0][0] = sHeartsDDPrim[1][0] = HeartDDOutline.r; + sHeartsDDPrim[0][1] = sHeartsDDPrim[1][1] = HeartDDOutline.b; + sHeartsDDPrim[0][2] = sHeartsDDPrim[1][2] = HeartDDOutline.b; // sHeartsDDPrim[2][0] = HeartInner[0]; // sHeartsDDPrim[2][1] = HeartInner[1]; // sHeartsDDPrim[2][2] = HeartInner[2]; - sHeartsDDEnv[0][0] = sHeartsDDEnv[1][0] = HeartDDInner[0]; - sHeartsDDEnv[0][1] = sHeartsDDEnv[1][1] = HeartDDInner[1]; - sHeartsDDEnv[0][2] = sHeartsDDEnv[1][2] = HeartDDInner[2]; + sHeartsDDEnv[0][0] = sHeartsDDEnv[1][0] = HeartDDInner.r; + sHeartsDDEnv[0][1] = sHeartsDDEnv[1][1] = HeartDDInner.g; + sHeartsDDEnv[0][2] = sHeartsDDEnv[1][2] = HeartDDInner.b; } void HealthMeter_Update(GlobalContext* globalCtx) { @@ -188,19 +185,13 @@ void HealthMeter_Update(GlobalContext* globalCtx) { Bottom_LM_Margin = CVar_GetS32("gHUDMargin_B", 0); if (CVar_GetS32("gHudColors", 1) == 2) { - HeartInner[0] = CVar_GetS32("gCCHeartsPrimR", sHeartsPrimColors[0][0]); - HeartInner[1] = CVar_GetS32("gCCHeartsPrimG", sHeartsPrimColors[0][1]); - HeartInner[2] = CVar_GetS32("gCCHeartsPrimB", sHeartsPrimColors[0][2]); - HeartDDOutline[0] = CVar_GetS32("gDDCCHeartsPrimR", sHeartsDDPrim[0][0]); - HeartDDOutline[1] = CVar_GetS32("gDDCCHeartsPrimG", sHeartsDDPrim[0][1]); - HeartDDOutline[2] = CVar_GetS32("gDDCCHeartsPrimB", sHeartsDDPrim[0][2]); + HeartInner = CVar_GetRGB("gCCHeartsPrim", HeartInner_ori); + HeartDDInner = CVar_GetRGB("gCCDDHeartsPrim", HeartDDInner_ori); + HeartDDOutline = CVar_GetRGB("gDDCCHeartsPrim", HeartDDOutline_ori); } else { - HeartInner[0] = HEARTS_PRIM_R; - HeartInner[1] = HEARTS_PRIM_G; - HeartInner[2] = HEARTS_PRIM_B; - HeartDDOutline[0] = HEARTS_DD_PRIM_R; - HeartDDOutline[1] = HEARTS_DD_PRIM_G; - HeartDDOutline[2] = HEARTS_DD_PRIM_B; + HeartInner = HeartInner_ori; + HeartDDInner = HeartDDInner_ori; + HeartDDOutline = HeartDDOutline_ori; } if (interfaceCtx->unk_200 != 0) { @@ -219,18 +210,18 @@ void HealthMeter_Update(GlobalContext* globalCtx) { ddFactor = factor; - interfaceCtx->heartsPrimR[0] = HeartInner[0]; - interfaceCtx->heartsPrimG[0] = HeartInner[1]; - interfaceCtx->heartsPrimB[0] = HeartInner[2]; + interfaceCtx->heartsPrimR[0] = HeartInner.r; + interfaceCtx->heartsPrimG[0] = HeartInner.g; + interfaceCtx->heartsPrimB[0] = HeartInner.b; interfaceCtx->heartsEnvR[0] = HEARTS_ENV_R; interfaceCtx->heartsEnvG[0] = HEARTS_ENV_G; interfaceCtx->heartsEnvB[0] = HEARTS_ENV_B; if (CVar_GetS32("gHudColors", 1) == 2) { - interfaceCtx->heartsPrimR[1] = HeartInner[0]; - interfaceCtx->heartsPrimG[1] = HeartInner[1]; - interfaceCtx->heartsPrimB[1] = HeartInner[2]; + interfaceCtx->heartsPrimR[1] = HeartInner.r; + interfaceCtx->heartsPrimG[1] = HeartInner.g; + interfaceCtx->heartsPrimB[1] = HeartInner.b; } else { interfaceCtx->heartsPrimR[1] = sHeartsPrimColors[type][0]; interfaceCtx->heartsPrimG[1] = sHeartsPrimColors[type][1]; @@ -245,9 +236,9 @@ void HealthMeter_Update(GlobalContext* globalCtx) { gFactor = sHeartsPrimFactors[0][1] * factor; bFactor = sHeartsPrimFactors[0][2] * factor; - interfaceCtx->beatingHeartPrim[0] = (u8)(rFactor + HeartInner[0]) & 0xFF; - interfaceCtx->beatingHeartPrim[1] = (u8)(gFactor + HeartInner[1]) & 0xFF; - interfaceCtx->beatingHeartPrim[2] = (u8)(bFactor + HeartInner[2]) & 0xFF; + interfaceCtx->beatingHeartPrim[0] = (u8)(rFactor + HeartInner.r) & 0xFF; + interfaceCtx->beatingHeartPrim[1] = (u8)(gFactor + HeartInner.g) & 0xFF; + interfaceCtx->beatingHeartPrim[2] = (u8)(bFactor + HeartInner.b) & 0xFF; rFactor = sHeartsEnvFactors[0][0] * factor; gFactor = sHeartsEnvFactors[0][1] * factor; @@ -259,50 +250,48 @@ void HealthMeter_Update(GlobalContext* globalCtx) { ddType = type; - sHeartsDDPrim[0][0] = HeartDDOutline[0]; - sHeartsDDPrim[0][1] = HeartDDOutline[1]; - sHeartsDDPrim[0][2] = HeartDDOutline[2]; + sHeartsDDPrim[0][0] = HeartDDOutline.r; + sHeartsDDPrim[0][1] = HeartDDOutline.g; + sHeartsDDPrim[0][2] = HeartDDOutline.b; - sHeartsDDEnv[0][0] = HeartDDInner[0]; - sHeartsDDEnv[0][1] = HeartDDInner[1]; - sHeartsDDEnv[0][2] = HeartDDInner[2]; + sHeartsDDEnv[0][0] = HeartDDInner.r; + sHeartsDDEnv[0][1] = HeartDDInner.g; + sHeartsDDEnv[0][2] = HeartDDInner.b; if (CVar_GetS32("gHudColors", 1) == 2) { - sHeartsDDPrim[2][0] = CVar_GetS32("gCCDDHeartsPrimR", 255); - sHeartsDDPrim[2][1] = CVar_GetS32("gCCDDHeartsPrimG", 70); - sHeartsDDPrim[2][2] = CVar_GetS32("gCCDDHeartsPrimB", 50); + sHeartsDDPrim[2][0] = HeartDDInner.r; + sHeartsDDPrim[2][1] = HeartDDInner.g; + sHeartsDDPrim[2][2] = HeartDDInner.b; - sHeartsDDPrim[1][0] = HeartDDOutline[0]; - sHeartsDDPrim[1][1] = HeartDDOutline[1]; - sHeartsDDPrim[1][2] = HeartDDOutline[2]; + sHeartsDDPrim[1][0] = HeartDDOutline.r; + sHeartsDDPrim[1][1] = HeartDDOutline.g; + sHeartsDDPrim[1][2] = HeartDDOutline.b; - sHeartsDDEnv[1][0] = CVar_GetS32("gCCDDHeartsPrimR", 255); - sHeartsDDEnv[1][1] = CVar_GetS32("gCCDDHeartsPrimG", 70); - sHeartsDDEnv[1][2] = CVar_GetS32("gCCDDHeartsPrimB", 50); + sHeartsDDEnv[1][0] = HeartDDInner.r; + sHeartsDDEnv[1][1] = HeartDDInner.g; + sHeartsDDEnv[1][2] = HeartDDInner.b; - HeartDDInner[0] = CVar_GetS32("gCCDDHeartsPrimR", 255); - HeartDDInner[1] = CVar_GetS32("gCCDDHeartsPrimG", 70); - HeartDDInner[2] = CVar_GetS32("gCCDDHeartsPrimB", 50); + HeartDDInner = CVar_GetRGB("gCCDDHeartsPrim", HeartDDInner_ori); - sHeartsDDEnv[0][0] = CVar_GetS32("gCCDDHeartsPrimR", 255); - sHeartsDDEnv[0][1] = CVar_GetS32("gCCDDHeartsPrimG", 70); - sHeartsDDEnv[0][2] = CVar_GetS32("gCCDDHeartsPrimB", 0); + sHeartsDDEnv[0][0] = HeartDDInner.r; + sHeartsDDEnv[0][1] = HeartDDInner.g; + sHeartsDDEnv[0][2] = HeartDDInner.b; rFactor = sHeartsDDPrimFactors[ddType][0] * ddFactor; gFactor = sHeartsDDPrimFactors[ddType][1] * ddFactor; bFactor = sHeartsDDPrimFactors[ddType][2] * ddFactor; - sBeatingHeartsDDPrim[0] = (u8)(rFactor + HeartDDOutline[0]) & 0xFF; - sBeatingHeartsDDPrim[1] = (u8)(gFactor + HeartDDOutline[1]) & 0xFF; - sBeatingHeartsDDPrim[2] = (u8)(bFactor + HeartDDOutline[2]) & 0xFF; + sBeatingHeartsDDPrim[0] = (u8)(rFactor + HeartDDOutline.r) & 0xFF; + sBeatingHeartsDDPrim[1] = (u8)(gFactor + HeartDDOutline.g) & 0xFF; + sBeatingHeartsDDPrim[2] = (u8)(bFactor + HeartDDOutline.b) & 0xFF; rFactor = sHeartsDDEnvFactors[ddType][0] * ddFactor; gFactor = sHeartsDDEnvFactors[ddType][1] * ddFactor; bFactor = sHeartsDDEnvFactors[ddType][2] * ddFactor; - sBeatingHeartsDDEnv[0] = (u8)(rFactor + HeartDDInner[0]) & 0xFF; - sBeatingHeartsDDEnv[1] = (u8)(gFactor + HeartDDInner[1]) & 0xFF; - sBeatingHeartsDDEnv[2] = (u8)(bFactor + HeartDDInner[2]) & 0xFF; + sBeatingHeartsDDEnv[0] = (u8)(rFactor + HeartDDInner.r) & 0xFF; + sBeatingHeartsDDEnv[1] = (u8)(gFactor + HeartDDInner.g) & 0xFF; + sBeatingHeartsDDEnv[2] = (u8)(bFactor + HeartDDInner.b) & 0xFF; } else { sHeartsDDPrim[0][0] = HEARTS_DD_PRIM_R; sHeartsDDPrim[0][1] = HEARTS_DD_PRIM_G; @@ -413,6 +402,12 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { s32 curCombineModeSet = 0; u8* curBgImgLoaded = NULL; s32 ddHeartCountMinusOne = gSaveContext.inventory.defenseHearts - 1; + float HeartsScale = 0.7f; + if (CVar_GetS32("gHeartsCountPosType", 0) != 0) { + HeartsScale = CVar_GetFloat("gHeartsCountScale", 0.7f); + } + static u32 epoch = 0; + epoch++; OPEN_DISPS(gfxCtx); @@ -433,14 +428,14 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { s16 PosX_original = OTRGetDimensionFromLeftEdge(0.0f)+X_Margins; s16 PosY_original = 0.0f+Y_Margins; if (CVar_GetS32("gHeartsCountPosType", 0) != 0) { - offsetY = CVar_GetS32("gHeartsPosY", 0)+Y_Margins; + offsetY = CVar_GetS32("gHeartsCountPosY", 0)+Y_Margins+(HeartsScale*15); if (CVar_GetS32("gHeartsCountPosType", 0) == 1) {//Anchor Left - offsetX = OTRGetDimensionFromLeftEdge(CVar_GetS32("gHeartsPosX", 0)+X_Margins); + offsetX = OTRGetDimensionFromLeftEdge(CVar_GetS32("gHeartsCountPosX", 0)+X_Margins+70.0f); } else if (CVar_GetS32("gHeartsCountPosType", 0) == 2) {//Anchor Right X_Margins = Right_LM_Margin; - offsetX = OTRGetDimensionFromRightEdge(CVar_GetS32("gHeartsPosX", 0)+X_Margins); + offsetX = OTRGetDimensionFromRightEdge(CVar_GetS32("gHeartsCountPosX", 0)+X_Margins+70.0f); } else if (CVar_GetS32("gHeartsCountPosType", 0) == 3) {//Anchor None - offsetX = CVar_GetS32("gHeartsPosX", 0); + offsetX = CVar_GetS32("gHeartsCountPosX", 0)+70.0f; } else if (CVar_GetS32("gHeartsCountPosType", 0) == 4) {//Hidden offsetX = -9999; } @@ -568,16 +563,27 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { } } - temp3 = 26.0f + offsetY; - temp2 = 30.0f + offsetX; - temp4 = 1.0f; - temp4 /= 0.68f; + temp3 = offsetY; + temp2 = offsetX; + temp4 = 1.0f;//Heart texture size + temp4 /= 0.68f; //Hearts Scaled size temp4 *= 1 << 10; temp1 = 8.0f; temp1 *= 0.68f; - gSPWideTextureRectangle(OVERLAY_DISP++, (s32)((temp2 - temp1) * 4), (s32)((temp3 - temp1) * 4), + /*gSPWideTextureRectangle(OVERLAY_DISP++, (s32)((temp2 - temp1) * 4), (s32)((temp3 - temp1) * 4), (s32)((temp2 + temp1) * 4), (s32)((temp3 + temp1) * 4), G_TX_RENDERTILE, 0, 0, - (s32)temp4, (s32)temp4); + (s32)temp4, (s32)temp4);*/ + Mtx* matrix = Graph_Alloc(gfxCtx, sizeof(Mtx)); + Matrix_SetTranslateScaleMtx2(matrix, + HeartsScale, //Scale X + HeartsScale, //Scale Y + HeartsScale, //Scale Z + -130+offsetX, //Pos X + (-94+offsetY) *-1, //Pos Y + 0.0f); //Pos Z + gSPMatrix(OVERLAY_DISP++, matrix, G_MTX_MODELVIEW | G_MTX_LOAD); + gSPVertex(OVERLAY_DISP++, sp154, 4, 0); + gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); } else { if ((ddHeartCountMinusOne < 0) || (i > ddHeartCountMinusOne)) { if (curCombineModeSet != 2) { @@ -597,28 +603,33 @@ void HealthMeter_Draw(GlobalContext* globalCtx) { { Mtx* matrix = Graph_Alloc(gfxCtx, sizeof(Mtx)); - Matrix_SetTranslateScaleMtx2(matrix, 1.0f - (0.32f * sp144), 1.0f - (0.32f * sp144), - 1.0f - (0.32f * sp144), -130.0f + offsetX, - 94.5f - offsetY, 0.0f); + Matrix_SetTranslateScaleMtx2(matrix, + HeartsScale+(HeartsScale/3) - ((HeartsScale/3) * sp144), + HeartsScale+(HeartsScale/3) - ((HeartsScale/3) * sp144), + HeartsScale+(HeartsScale/3) - ((HeartsScale/3) * sp144), + -130+offsetX, //Pos X + (-94+offsetY) *-1, //Pos Y + 0.0f); gSPMatrix(OVERLAY_DISP++, matrix, G_MTX_MODELVIEW | G_MTX_LOAD); gSPVertex(OVERLAY_DISP++, sp154, 4, 0); gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); } } - offsetX += 10.0f; + //offsetX += 10.0f; + offsetX += (HeartsScale*14.5f); if (i == 9) { PosX_original = OTRGetDimensionFromLeftEdge(0.0f)+X_Margins; - PosY_original = 10.0f+Y_Margins; + PosY_original = (HeartsScale*15)+Y_Margins; if (CVar_GetS32("gHeartsCountPosType", 0) != 0) { - offsetY = CVar_GetS32("gHeartsPosY", 0)+Y_Margins+10.0f; + offsetY = CVar_GetS32("gHeartsCountPosY", 0)+((HeartsScale*15)*2)+Y_Margins; if (CVar_GetS32("gHeartsCountPosType", 0) == 1) {//Anchor Left - offsetX = OTRGetDimensionFromLeftEdge(CVar_GetS32("gHeartsPosX", 0)+X_Margins); + offsetX = OTRGetDimensionFromLeftEdge(CVar_GetS32("gHeartsCountPosX", 0)+X_Margins+70.0f); } else if (CVar_GetS32("gHeartsCountPosType", 0) == 2) {//Anchor Right X_Margins = Right_LM_Margin; - offsetX = OTRGetDimensionFromRightEdge(CVar_GetS32("gHeartsPosX", 0)+X_Margins); + offsetX = OTRGetDimensionFromRightEdge(CVar_GetS32("gHeartsCountPosX", 0)+X_Margins+70.0f); } else if (CVar_GetS32("gHeartsCountPosType", 0) == 3) {//Anchor None - offsetX = CVar_GetS32("gHeartsPosX", 0); + offsetX = CVar_GetS32("gHeartsCountPosX", 0)+70.0f; } else if (CVar_GetS32("gHeartsCountPosType", 0) == 4) {//Hidden offsetX = -9999; } diff --git a/soh/src/code/z_map_exp.c b/soh/src/code/z_map_exp.c index c9b927730..0866b5332 100644 --- a/soh/src/code/z_map_exp.c +++ b/soh/src/code/z_map_exp.c @@ -601,6 +601,8 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { s32 pad; Player* player = GET_PLAYER(globalCtx); s16 tempX, tempZ; + const Color_RGB8 LastEntrance_arrow = { 200, 0, 0 }; + const Color_RGB8 CurrentPosition_arrow = { 200, 255, 0 }; s16 X_Margins_Minimap; s16 Y_Margins_Minimap; if (CVar_GetS32("gMinimapUseMargins", 0) != 0) { @@ -658,9 +660,9 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, CVar_GetS32("gCCMinimapCPPrimR", 200), CVar_GetS32("gCCMinimapCPPrimG", 255), CVar_GetS32("gCCMinimapCPPrimB", 0), 255); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, CVar_GetRGB("gCCMinimapCPPrim", CurrentPosition_arrow).r, CVar_GetRGB("gCCMinimapCPPrim", CurrentPosition_arrow).g, CVar_GetRGB("gCCMinimapCPPrim", CurrentPosition_arrow).b, 255); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, 200, 255, 0, 255); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, CurrentPosition_arrow.r, CurrentPosition_arrow.g, CurrentPosition_arrow.b, 255); } gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL); @@ -699,9 +701,9 @@ void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, CVar_GetS32("gCCMinimapLEPrimR", 200), CVar_GetS32("gCCMinimapLEPrimG", 0), CVar_GetS32("gCCMinimapLEPrimB", 0), 255); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, CVar_GetRGB("gCCMinimapLEPrim", LastEntrance_arrow).r,CVar_GetRGB("gCCMinimapLEPrim", LastEntrance_arrow).g,CVar_GetRGB("gCCMinimapLEPrim", LastEntrance_arrow).b, 255); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, 200, 0, 0, 255); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0xFF, LastEntrance_arrow.r, LastEntrance_arrow.g, LastEntrance_arrow.b, 255); } gSPDisplayList(OVERLAY_DISP++, gCompassArrowDL); } @@ -713,6 +715,8 @@ void Minimap_Draw(GlobalContext* globalCtx) { s32 pad[2]; InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s32 mapIndex = gSaveContext.mapIndex; + const Color_RGB8 Dungeon_minimap = {100, 255, 255}; + const Color_RGB8 Overworld_minimap = {R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2)}; OPEN_DISPS(globalCtx->state.gfxCtx); @@ -751,9 +755,9 @@ void Minimap_Draw(GlobalContext* globalCtx) { if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, mapIndex)) { if (CVar_GetS32("gHudColors", 1) == 2) { //Dungeon minimap - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCMinimapDGNPrimR", R_MINIMAP_COLOR(0)), CVar_GetS32("gCCMinimapDGNPrimG", R_MINIMAP_COLOR(1)), CVar_GetS32("gCCMinimapDGNPrimB", R_MINIMAP_COLOR(2)), interfaceCtx->minimapAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCMinimapDGNPrim", Dungeon_minimap).r,CVar_GetRGB("gCCMinimapDGNPrim", Dungeon_minimap).g,CVar_GetRGB("gCCMinimapDGNPrim", Dungeon_minimap).b, interfaceCtx->minimapAlpha); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 100, 255, 255, interfaceCtx->minimapAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Dungeon_minimap.r, Dungeon_minimap.g, Dungeon_minimap.b, interfaceCtx->minimapAlpha); } gSPInvalidateTexCache(OVERLAY_DISP++, interfaceCtx->mapSegment); @@ -826,9 +830,9 @@ void Minimap_Draw(GlobalContext* globalCtx) { gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (CVar_GetS32("gHudColors", 1) == 2) {//Overworld minimap - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCMinimapPrimR", R_MINIMAP_COLOR(0)), CVar_GetS32("gCCMinimapPrimG", R_MINIMAP_COLOR(1)), CVar_GetS32("gCCMinimapPrimB", R_MINIMAP_COLOR(2)), interfaceCtx->minimapAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCMinimapPrim", Overworld_minimap).r,CVar_GetRGB("gCCMinimapPrim", Overworld_minimap).g,CVar_GetRGB("gCCMinimapPrim", Overworld_minimap).b, interfaceCtx->minimapAlpha); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2), interfaceCtx->minimapAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Overworld_minimap.r, Overworld_minimap.g, Overworld_minimap.b, interfaceCtx->minimapAlpha); } gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->mapSegment, G_IM_FMT_IA, @@ -858,7 +862,7 @@ void Minimap_Draw(GlobalContext* globalCtx) { 0, 1 << 10, 1 << 10); if (CVar_GetS32("gHudColors", 1) != 2) {//This need to be added else it will color dungeon entrance icon too. (it re-init prim color to default color) - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MINIMAP_COLOR(0), R_MINIMAP_COLOR(1), R_MINIMAP_COLOR(2), interfaceCtx->minimapAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Overworld_minimap.r, Overworld_minimap.g, Overworld_minimap.b, interfaceCtx->minimapAlpha); } if (((globalCtx->sceneNum != SCENE_SPOT01) && (globalCtx->sceneNum != SCENE_SPOT04) && diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 215fa3f1b..bc8fa8149 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -166,9 +166,8 @@ static u16 sCUpTimer = 0; s16 gSpoilingItems[] = { ITEM_ODD_MUSHROOM, ITEM_FROG, ITEM_EYEDROPS }; s16 gSpoilingItemReverts[] = { ITEM_COJIRO, ITEM_PRESCRIPTION, ITEM_PRESCRIPTION }; -static s16 sMagicBorderR = 255; -static s16 sMagicBorderG = 255; -static s16 sMagicBorderB = 255; +static Color_RGB8 sMagicBorder = {255,255,255}; +static Color_RGB8 sMagicBorder_ori = {255,255,255}; static s16 sExtraItemBases[] = { ITEM_STICK, ITEM_STICK, ITEM_NUT, ITEM_NUT, ITEM_BOMB, ITEM_BOMB, ITEM_BOMB, ITEM_BOMB, ITEM_BOW, @@ -2964,23 +2963,27 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { { 255, 255, 150 }, { 255, 255, 50 }, }; + Color_RGB8 MagicBorder_0 = { 255, 255, 255 }; + Color_RGB8 MagicBorder_1 = { 150, 150, 150 }; + Color_RGB8 MagicBorder_2 = { 255, 255, 150 }; + Color_RGB8 MagicBorder_3 = { 255, 255, 50 }; if (CVar_GetS32("gHudColors", 1) == 2) { //This will make custom color based on users selected colors. - sMagicBorderColors[0][0] = CVar_GetS32("gCCMagicBorderPrimR", 255); - sMagicBorderColors[0][1] = CVar_GetS32("gCCMagicBorderPrimG", 255); - sMagicBorderColors[0][2] = CVar_GetS32("gCCMagicBorderPrimB", 255); + sMagicBorderColors[0][0] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_0).r; + sMagicBorderColors[0][1] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_0).g; + sMagicBorderColors[0][2] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_0).b; - sMagicBorderColors[1][0] = CVar_GetS32("gCCMagicBorderPrimR", 255)/2; - sMagicBorderColors[1][1] = CVar_GetS32("gCCMagicBorderPrimG", 255)/2; - sMagicBorderColors[1][2] = CVar_GetS32("gCCMagicBorderPrimB", 255)/2; + sMagicBorderColors[1][0] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_1).r/2; + sMagicBorderColors[1][1] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_1).g/2; + sMagicBorderColors[1][2] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_1).b/2; - sMagicBorderColors[2][0] = CVar_GetS32("gCCMagicBorderPrimR", 255)/3; - sMagicBorderColors[2][1] = CVar_GetS32("gCCMagicBorderPrimG", 255)/3; - sMagicBorderColors[2][2] = CVar_GetS32("gCCMagicBorderPrimB", 255)/3; + sMagicBorderColors[2][0] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_2).r/2.5; + sMagicBorderColors[2][1] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_2).g/2.5; + sMagicBorderColors[2][2] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_2).b/2.5; - sMagicBorderColors[3][0] = CVar_GetS32("gCCMagicBorderPrimR", 255)/2; - sMagicBorderColors[3][1] = CVar_GetS32("gCCMagicBorderPrimG", 255)/2; - sMagicBorderColors[3][2] = CVar_GetS32("gCCMagicBorderPrimB", 255)/2; + sMagicBorderColors[3][0] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_3).r/3; + sMagicBorderColors[3][1] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_3).g/3; + sMagicBorderColors[3][2] = CVar_GetRGB("gCCMagicBorderPrim", MagicBorder_3).b/3; } static s16 sMagicBorderIndexes[] = { 0, 1, 1, 0 }; @@ -3041,53 +3044,49 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { gSaveContext.magic = 0; gSaveContext.unk_13F0 = 3; if (CVar_GetS32("gHudColors", 1) == 2) { - sMagicBorderR = CVar_GetS32("gCCMagicBorderNormPrimR", 255); - sMagicBorderG = CVar_GetS32("gCCMagicBorderNormPrimG", 255); - sMagicBorderB = CVar_GetS32("gCCMagicBorderNormPrimB", 255); + sMagicBorder = CVar_GetRGB("gCCMagicBorderNormPrim", sMagicBorder_ori); } else { - sMagicBorderR = sMagicBorderG = sMagicBorderB = 255; + sMagicBorder = sMagicBorder_ori; } } else if (gSaveContext.magic == gSaveContext.unk_13F8) { gSaveContext.unk_13F0 = 3; if (CVar_GetS32("gHudColors", 1) == 2) { - sMagicBorderR = CVar_GetS32("gCCMagicBorderNormPrimR", 255); - sMagicBorderG = CVar_GetS32("gCCMagicBorderNormPrimG", 255); - sMagicBorderB = CVar_GetS32("gCCMagicBorderNormPrimB", 255); + sMagicBorder = CVar_GetRGB("gCCMagicBorderNormPrim", sMagicBorder_ori); } else { - sMagicBorderR = sMagicBorderG = sMagicBorderB = 255; + sMagicBorder = sMagicBorder_ori; } } case 3: case 4: case 6: temp = sMagicBorderIndexes[sMagicBorderStep]; - borderChangeR = ABS(sMagicBorderR - sMagicBorderColors[temp][0]) / sMagicBorderRatio; - borderChangeG = ABS(sMagicBorderG - sMagicBorderColors[temp][1]) / sMagicBorderRatio; - borderChangeB = ABS(sMagicBorderB - sMagicBorderColors[temp][2]) / sMagicBorderRatio; + borderChangeR = ABS(sMagicBorder.r - sMagicBorderColors[temp][0]) / sMagicBorderRatio; + borderChangeG = ABS(sMagicBorder.g - sMagicBorderColors[temp][1]) / sMagicBorderRatio; + borderChangeB = ABS(sMagicBorder.b - sMagicBorderColors[temp][2]) / sMagicBorderRatio; - if (sMagicBorderR >= sMagicBorderColors[temp][0]) { - sMagicBorderR -= borderChangeR; + if (sMagicBorder.r >= sMagicBorderColors[temp][0]) { + sMagicBorder.r -= borderChangeR; } else { - sMagicBorderR += borderChangeR; + sMagicBorder.r += borderChangeR; } - if (sMagicBorderG >= sMagicBorderColors[temp][1]) { - sMagicBorderG -= borderChangeG; + if (sMagicBorder.g >= sMagicBorderColors[temp][1]) { + sMagicBorder.g -= borderChangeG; } else { - sMagicBorderG += borderChangeG; + sMagicBorder.g += borderChangeG; } - if (sMagicBorderB >= sMagicBorderColors[temp][2]) { - sMagicBorderB -= borderChangeB; + if (sMagicBorder.b >= sMagicBorderColors[temp][2]) { + sMagicBorder.b -= borderChangeB; } else { - sMagicBorderB += borderChangeB; + sMagicBorder.b += borderChangeB; } sMagicBorderRatio--; if (sMagicBorderRatio == 0) { - sMagicBorderR = sMagicBorderColors[temp][0]; - sMagicBorderG = sMagicBorderColors[temp][1]; - sMagicBorderB = sMagicBorderColors[temp][2]; + sMagicBorder.r = sMagicBorderColors[temp][0]; + sMagicBorder.g = sMagicBorderColors[temp][1]; + sMagicBorder.b = sMagicBorderColors[temp][2]; sMagicBorderRatio = YREG(40 + sMagicBorderStep); sMagicBorderStep++; if (sMagicBorderStep >= 4) { @@ -3098,11 +3097,9 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { case 5: if (CVar_GetS32("gHudColors", 1) == 2) { - sMagicBorderR = CVar_GetS32("gCCMagicBorderNormPrimR", 255); - sMagicBorderG = CVar_GetS32("gCCMagicBorderNormPrimG", 255); - sMagicBorderB = CVar_GetS32("gCCMagicBorderNormPrimB", 255); + sMagicBorder = CVar_GetRGB("gCCMagicBorderNormPrim", sMagicBorder_ori); } else { - sMagicBorderR = sMagicBorderG = sMagicBorderB = 255; + sMagicBorder = sMagicBorder_ori; } gSaveContext.unk_13F0 = 0; break; @@ -3126,11 +3123,9 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { &D_801333E8); gSaveContext.unk_13F0 = 0; if (CVar_GetS32("gHudColors", 1) == 2) { - sMagicBorderR = CVar_GetS32("gCCMagicBorderNormPrimR", 255); - sMagicBorderG = CVar_GetS32("gCCMagicBorderNormPrimG", 255); - sMagicBorderB = CVar_GetS32("gCCMagicBorderNormPrimB", 255); + sMagicBorder = CVar_GetRGB("gCCMagicBorderNormPrim", sMagicBorder_ori); } else { - sMagicBorderR = sMagicBorderG = sMagicBorderB = 255; + sMagicBorder = sMagicBorder_ori; } break; } @@ -3143,33 +3138,33 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { } temp = sMagicBorderIndexes[sMagicBorderStep]; - borderChangeR = ABS(sMagicBorderR - sMagicBorderColors[temp][0]) / sMagicBorderRatio; - borderChangeG = ABS(sMagicBorderG - sMagicBorderColors[temp][1]) / sMagicBorderRatio; - borderChangeB = ABS(sMagicBorderB - sMagicBorderColors[temp][2]) / sMagicBorderRatio; + borderChangeR = ABS(sMagicBorder.r - sMagicBorderColors[temp][0]) / sMagicBorderRatio; + borderChangeG = ABS(sMagicBorder.g - sMagicBorderColors[temp][1]) / sMagicBorderRatio; + borderChangeB = ABS(sMagicBorder.b - sMagicBorderColors[temp][2]) / sMagicBorderRatio; - if (sMagicBorderR >= sMagicBorderColors[temp][0]) { - sMagicBorderR -= borderChangeR; + if (sMagicBorder.r >= sMagicBorderColors[temp][0]) { + sMagicBorder.r -= borderChangeR; } else { - sMagicBorderR += borderChangeR; + sMagicBorder.r += borderChangeR; } - if (sMagicBorderG >= sMagicBorderColors[temp][1]) { - sMagicBorderG -= borderChangeG; + if (sMagicBorder.g >= sMagicBorderColors[temp][1]) { + sMagicBorder.g -= borderChangeG; } else { - sMagicBorderG += borderChangeG; + sMagicBorder.g += borderChangeG; } - if (sMagicBorderB >= sMagicBorderColors[temp][2]) { - sMagicBorderB -= borderChangeB; + if (sMagicBorder.b >= sMagicBorderColors[temp][2]) { + sMagicBorder.b -= borderChangeB; } else { - sMagicBorderB += borderChangeB; + sMagicBorder.b += borderChangeB; } sMagicBorderRatio--; if (sMagicBorderRatio == 0) { - sMagicBorderR = sMagicBorderColors[temp][0]; - sMagicBorderG = sMagicBorderColors[temp][1]; - sMagicBorderB = sMagicBorderColors[temp][2]; + sMagicBorder.r = sMagicBorderColors[temp][0]; + sMagicBorder.g = sMagicBorderColors[temp][1]; + sMagicBorder.b = sMagicBorderColors[temp][2]; sMagicBorderRatio = YREG(40 + sMagicBorderStep); sMagicBorderStep++; if (sMagicBorderStep >= 4) { @@ -3197,6 +3192,8 @@ void Interface_UpdateMagicBar(GlobalContext* globalCtx) { void Interface_DrawMagicBar(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s16 magicBarY; + Color_RGB8 magicbar_yellow = {250,250,0}; //Magic bar being used + Color_RGB8 magicbar_green = {R_MAGIC_FILL_COLOR(0),R_MAGIC_FILL_COLOR(1),R_MAGIC_FILL_COLOR(2)}; //Magic bar fill OPEN_DISPS(globalCtx->state.gfxCtx); @@ -3265,7 +3262,7 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) { } else { gDPSetEnvColor(OVERLAY_DISP++, 100, 50, 50, 255); } - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMagicBorderR, sMagicBorderG, sMagicBorderB, interfaceCtx->magicAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, sMagicBorder.r, sMagicBorder.g, sMagicBorder.b, interfaceCtx->magicAlpha); OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gMagicBarEndTex, 8, 16, PosX_Start, magicBarY, 8, 16, 1 << 10, 1 << 10); @@ -3286,9 +3283,9 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) { if (gSaveContext.unk_13F0 == 4) { // Yellow part of the bar indicating the amount of magic to be subtracted if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCMagicUsePrimR", 250), CVar_GetS32("gCCMagicUsePrimG", 250), CVar_GetS32("gCCMagicUsePrimB", 0), interfaceCtx->magicAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCMagicUsePrim", magicbar_yellow).r, CVar_GetRGB("gCCMagicUsePrim", magicbar_yellow).g, CVar_GetRGB("gCCMagicUsePrim", magicbar_yellow).b, interfaceCtx->magicAlpha); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 250, 250, 0, interfaceCtx->magicAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_yellow.r, magicbar_yellow.g, magicbar_yellow.b, interfaceCtx->magicAlpha); } gDPLoadMultiBlock_4b(OVERLAY_DISP++, gMagicBarFillTex, 0, G_TX_RENDERTILE, G_IM_FMT_I, 16, 16, 0, @@ -3302,9 +3299,9 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) { // Fill the rest of the bar with the normal magic color gDPPipeSync(OVERLAY_DISP++); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCMagicPrimR", 0), CVar_GetS32("gCCMagicPrimG", 200), CVar_GetS32("gCCMagicPrimB", 0), interfaceCtx->magicAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCMagicPrim", magicbar_green).r, CVar_GetRGB("gCCMagicPrim", magicbar_green).g, CVar_GetRGB("gCCMagicPrim", magicbar_green).b, interfaceCtx->magicAlpha); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), R_MAGIC_FILL_COLOR(2), interfaceCtx->magicAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_green.r, magicbar_green.g, magicbar_green.b, interfaceCtx->magicAlpha); } gSPWideTextureRectangle(OVERLAY_DISP++, rMagicFillX << 2, (magicBarY + 3) << 2, @@ -3313,9 +3310,9 @@ void Interface_DrawMagicBar(GlobalContext* globalCtx) { } else { // Fill the whole bar with the normal magic color if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCMagicPrimR", 0), CVar_GetS32("gCCMagicPrimG", 200), CVar_GetS32("gCCMagicPrimB", 0), interfaceCtx->magicAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCMagicPrim", magicbar_green).r, CVar_GetRGB("gCCMagicPrim", magicbar_green).g, CVar_GetRGB("gCCMagicPrim", magicbar_green).b, interfaceCtx->magicAlpha); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_MAGIC_FILL_COLOR(0), R_MAGIC_FILL_COLOR(1), R_MAGIC_FILL_COLOR(2), interfaceCtx->magicAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, magicbar_green.r, magicbar_green.g, magicbar_green.b, interfaceCtx->magicAlpha); } gDPLoadMultiBlock_4b(OVERLAY_DISP++, gMagicBarFillTex, 0, G_TX_RENDERTILE, G_IM_FMT_I, 16, 16, 0, @@ -3389,10 +3386,28 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { s16 dxdy; s16 width; s16 height; + Color_RGB8 A_button_ori = {R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2)}; + Color_RGB8 A_button = CVar_GetRGB("gCCABtnPrim", A_button_ori); + Color_RGB8 B_button_ori = {R_B_BTN_COLOR(0), R_B_BTN_COLOR(1), R_B_BTN_COLOR(2)}; + Color_RGB8 B_button = CVar_GetRGB("gCCBBtnPrim", B_button_ori); + Color_RGB8 Start_button_ori = {120, 120, 120}; + Color_RGB8 Start_button = CVar_GetRGB("gCCStartBtnPrim", Start_button_ori); + Color_RGB8 C_button_ori = {R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2)}; + Color_RGB8 C_button_uni = CVar_GetRGB("gCCCBtnPrim", C_button_ori); + Color_RGB8 C_button_U = CVar_GetRGB("gCCCUBtnPrim", C_button_ori); + Color_RGB8 C_button_D = CVar_GetRGB("gCCCDBtnPrim", C_button_ori); + Color_RGB8 C_button_L = CVar_GetRGB("gCCCLBtnPrim", C_button_ori); + Color_RGB8 C_button_R = CVar_GetRGB("gCCCRBtnPrim", C_button_ori); //B Button s16 X_Margins_BtnB; s16 Y_Margins_BtnB; + s16 BBtn_Size = 32; + int BBtnScaled = BBtn_Size * 0.95f; + if (CVar_GetS32("gBBtnPosType", 0) != 0) { + BBtnScaled = BBtn_Size * CVar_GetFloat("gBBtnScale", 0.95f); + } + int BBtn_factor = (1 << 10) * BBtn_Size / BBtnScaled; if (CVar_GetS32("gBBtnUseMargins", 0) != 0) { if (CVar_GetS32("gBBtnPosType", 0) == 0) {X_Margins_BtnB = Right_HUD_Margin;}; Y_Margins_BtnB = (Top_HUD_Margin*-1); @@ -3435,49 +3450,40 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { } s16 StartBtn_Icon_H = 32; s16 StartBtn_Icon_W = 32; - int StartBTN_H_Scaled = StartBtn_Icon_H * 0.75f; - int StartBTN_W_Scaled = StartBtn_Icon_W * 0.75f; + float Start_BTN_Scale = 0.75f; + if (CVar_GetS32("gStartBtnPosType", 0) != 0) { + Start_BTN_Scale = CVar_GetFloat("gStartBtnScale", 0.75f); + } + int StartBTN_H_Scaled = StartBtn_Icon_H * Start_BTN_Scale; + int StartBTN_W_Scaled = StartBtn_Icon_W * Start_BTN_Scale; int StartBTN_W_factor = (1 << 10) * StartBtn_Icon_W / StartBTN_W_Scaled; int StartBTN_H_factor = (1 << 10) * StartBtn_Icon_H / StartBTN_H_Scaled; - const s16 rStartLabelX_ori = OTRGetRectDimensionFromRightEdge(R_START_LABEL_X(gSaveContext.language)+X_Margins_StartBtn); - const s16 rStartLabelY_ori = R_START_LABEL_Y(gSaveContext.language)+Y_Margins_StartBtn; const s16 PosX_StartBtn_ori = OTRGetRectDimensionFromRightEdge(startButtonLeftPos[gSaveContext.language]+X_Margins_StartBtn); const s16 PosY_StartBtn_ori = 16+Y_Margins_StartBtn; s16 StartBTN_Label_W = DO_ACTION_TEX_WIDTH(); s16 StartBTN_Label_H = DO_ACTION_TEX_HEIGHT(); - int StartBTN_Label_H_Scaled = StartBTN_Label_H * 1.0f; - int StartBTN_Label_W_Scaled = StartBTN_Label_W * 1.0f; - int StartBTN_Label_W_factor = (1 << 10) * StartBTN_Label_W / StartBTN_Label_W_Scaled; - int StartBTN_Label_H_factor = (1 << 10) * StartBTN_Label_H / StartBTN_Label_H_Scaled; - const s16 StartBtn_Label_W_ori = StartBTN_Label_W / (R_START_LABEL_DD(gSaveContext.language) / 100.0f); - const s16 StartBtn_Label_H_ori = StartBTN_Label_H / (R_START_LABEL_DD(gSaveContext.language) / 100.0f); s16 PosX_StartBtn; s16 PosY_StartBtn; - s16 rStartLabelX; - s16 rStartLabelY; if (CVar_GetS32("gStartBtnPosType", 0) != 0) { - PosY_StartBtn = CVar_GetS32("gStartBtnPosY", 0)+Y_Margins_StartBtn; - rStartLabelY = CVar_GetS32("gStartBtnPosY", 0)+Y_Margins_StartBtn+3; + PosY_StartBtn = CVar_GetS32("gStartBtnPosY", 0)-(Start_BTN_Scale*13)+Y_Margins_StartBtn; if (CVar_GetS32("gStartBtnPosType", 0) == 1) {//Anchor Left if (CVar_GetS32("gStartBtnUseMargins", 0) != 0) {X_Margins_StartBtn = Left_HUD_Margin;}; - PosX_StartBtn = OTRGetDimensionFromLeftEdge(CVar_GetS32("gStartBtnPosX", 0)+X_Margins_StartBtn); - rStartLabelX = OTRGetDimensionFromLeftEdge(CVar_GetS32("gStartBtnPosX", 0)+X_Margins_StartBtn-12); + PosX_StartBtn = OTRGetDimensionFromLeftEdge(CVar_GetS32("gStartBtnPosX", 0)-(Start_BTN_Scale*13)+X_Margins_StartBtn); } else if (CVar_GetS32("gStartBtnPosType", 0) == 2) {//Anchor Right if (CVar_GetS32("gStartBtnUseMargins", 0) != 0) {X_Margins_StartBtn = Right_HUD_Margin;}; - PosX_StartBtn = OTRGetDimensionFromRightEdge(CVar_GetS32("gStartBtnPosX", 0)+X_Margins_StartBtn); - rStartLabelX = OTRGetDimensionFromRightEdge(CVar_GetS32("gStartBtnPosX", 0)+X_Margins_StartBtn-12); + PosX_StartBtn = OTRGetDimensionFromRightEdge(CVar_GetS32("gStartBtnPosX", 0)-(Start_BTN_Scale*13)+X_Margins_StartBtn); } else if (CVar_GetS32("gStartBtnPosType", 0) == 3) {//Anchor None PosX_StartBtn = CVar_GetS32("gStartBtnPosX", 0); - rStartLabelX = CVar_GetS32("gStartBtnPosX", 0)-12; } else if (CVar_GetS32("gStartBtnPosType", 0) == 4) {//Hidden PosX_StartBtn = -9999; - rStartLabelX = -9999; } } else { + StartBTN_H_Scaled = StartBtn_Icon_H * 0.75f; + StartBTN_W_Scaled = StartBtn_Icon_W * 0.75f; + StartBTN_W_factor = (1 << 10) * StartBtn_Icon_W / StartBTN_W_Scaled; + StartBTN_H_factor = (1 << 10) * StartBtn_Icon_H / StartBTN_H_Scaled; PosY_StartBtn = PosY_StartBtn_ori; PosX_StartBtn = PosX_StartBtn_ori; - rStartLabelY = rStartLabelY_ori; - rStartLabelX = rStartLabelX_ori; } //C Buttons position s16 X_Margins_CL; @@ -3527,6 +3533,13 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { s16 C_Up_BTN_Pos[2]; s16 C_Down_BTN_Pos[2]; //C button Left + s16 C_Left_BTN_Size = 32; + float CLeftScale = CVar_GetFloat("gCBtnLScale", 0.87f); + int CLeftScaled = C_Left_BTN_Size * 0.87f; + if (CVar_GetS32("gCBtnLPosType", 0) != 0) { + CLeftScaled = C_Left_BTN_Size * CLeftScale; + } + int CLeft_factor = (1 << 10) * C_Left_BTN_Size / CLeftScaled; if (CVar_GetS32("gCBtnLPosType", 0) != 0) { C_Left_BTN_Pos[1] = CVar_GetS32("gCBtnLPosY", 0)+Y_Margins_CL; if (CVar_GetS32("gCBtnLPosType", 0) == 1) {//Anchor Left @@ -3545,6 +3558,13 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { C_Left_BTN_Pos[0] = OTRGetRectDimensionFromRightEdge(C_Left_BTN_Pos_ori[0]); } //C button Right + s16 C_Right_BTN_Size = 32; + float CRightScale = CVar_GetFloat("gCBtnRScale", 0.87f); + int CRightScaled = C_Right_BTN_Size * 0.87f; + if (CVar_GetS32("gCBtnRPosType", 0) != 0) { + CRightScaled = C_Right_BTN_Size * CRightScale; + } + int CRight_factor = (1 << 10) * C_Right_BTN_Size / CRightScaled; if (CVar_GetS32("gCBtnRPosType", 0) != 0) { C_Right_BTN_Pos[1] = CVar_GetS32("gCBtnRPosY", 0)+Y_Margins_CR; if (CVar_GetS32("gCBtnRPosType", 0) == 1) {//Anchor Left @@ -3563,16 +3583,23 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { C_Right_BTN_Pos[0] = OTRGetRectDimensionFromRightEdge(C_Right_BTN_Pos_ori[0]); } //C Button Up + s16 C_Up_BTN_Size = 32; + int CUpScaled = C_Up_BTN_Size * 0.5f; + float CUpScale = CVar_GetFloat("gCBtnUScale", 0.5f); if (CVar_GetS32("gCBtnUPosType", 0) != 0) { - C_Up_BTN_Pos[1] = CVar_GetS32("gCBtnUPosY", 0)+Y_Margins_CU; + CUpScaled = C_Up_BTN_Size * CUpScale; + } + int CUp_factor = (1 << 10) * C_Up_BTN_Size / CUpScaled; + if (CVar_GetS32("gCBtnUPosType", 0) != 0) { + C_Up_BTN_Pos[1] = CVar_GetS32("gCBtnUPosY", 0)-(CUpScale*13)+Y_Margins_CU; if (CVar_GetS32("gCBtnUPosType", 0) == 1) {//Anchor Left if (CVar_GetS32("gCBtnUUseMargins", 0) != 0) {X_Margins_CU = Left_HUD_Margin;}; - C_Up_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnUPosX", 0)+X_Margins_CU); + C_Up_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnUPosX", 0)-(CUpScale*13)+X_Margins_CU); } else if (CVar_GetS32("gCBtnUPosType", 0) == 2) {//Anchor Right if (CVar_GetS32("gCBtnUUseMargins", 0) != 0) {X_Margins_CU = Right_HUD_Margin;}; - C_Up_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnUPosX", 0)+X_Margins_CU); + C_Up_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnUPosX", 0)-(CUpScale*13)+X_Margins_CU); } else if (CVar_GetS32("gCBtnUPosType", 0) == 3) {//Anchor None - C_Up_BTN_Pos[0] = CVar_GetS32("gCBtnUPosX", 0); + C_Up_BTN_Pos[0] = CVar_GetS32("gCBtnUPosX", 0)-(CUpScale*13); } else if (CVar_GetS32("gCBtnUPosType", 0) == 4) {//Hidden C_Up_BTN_Pos[0] = -9999; } @@ -3581,16 +3608,24 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { C_Up_BTN_Pos[0] = OTRGetRectDimensionFromRightEdge(C_Up_BTN_Pos_ori[0]); } //C Button down + s16 C_Down_BTN_Size = 32; + float CDownScale = CVar_GetFloat("gCBtnDScale", 0.87f); + if (CVar_GetS32("gCBtnDPosType", 0) == 0) { + CDownScale = 0.87f; + } + int CDownScaled = C_Down_BTN_Size * CDownScale; + int CDown_factor = (1 << 10) * C_Down_BTN_Size / CDownScaled; + int PositionAdjustment = CDownScaled/2; if (CVar_GetS32("gCBtnDPosType", 0) != 0) { - C_Down_BTN_Pos[1] = CVar_GetS32("gCBtnDPosY", 0)+Y_Margins_CD; + C_Down_BTN_Pos[1] = CVar_GetS32("gCBtnDPosY", 0)-PositionAdjustment+Y_Margins_CD; if (CVar_GetS32("gCBtnDPosType", 0) == 1) {//Anchor Left if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; - C_Down_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD); + C_Down_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)-PositionAdjustment+X_Margins_CD); } else if (CVar_GetS32("gCBtnDPosType", 0) == 2) {//Anchor Right if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; - C_Down_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD); + C_Down_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)-PositionAdjustment+X_Margins_CD); } else if (CVar_GetS32("gCBtnDPosType", 0) == 3) {//Anchor None - C_Down_BTN_Pos[0] = CVar_GetS32("gCBtnDPosX", 0); + C_Down_BTN_Pos[0] = CVar_GetS32("gCBtnDPosX", 0)-PositionAdjustment; } else if (CVar_GetS32("gCBtnDPosType", 0) == 4) {//Hidden C_Down_BTN_Pos[0] = -9999; } @@ -3608,59 +3643,59 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { if (CVar_GetS32("gHudColors", 1) == 0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 0, 150, 0, interfaceCtx->bAlpha); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_B_BTN_COLOR(0), R_B_BTN_COLOR(1), R_B_BTN_COLOR(2), interfaceCtx->bAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, B_button_ori.r,B_button_ori.g,B_button_ori.b, interfaceCtx->bAlpha); } else if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCBBtnPrimR", R_B_BTN_COLOR(0)), CVar_GetS32("gCCBBtnPrimG", R_B_BTN_COLOR(1)), CVar_GetS32("gCCBBtnPrimB", R_B_BTN_COLOR(2)), interfaceCtx->bAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, B_button.r,B_button.g,B_button.b, interfaceCtx->bAlpha); } gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); - OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gButtonBackgroundTex, 32, 32, PosX_BtnB, PosY_BtnB, R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_WIDTH(0), R_ITEM_BTN_DD(0) << 1, R_ITEM_BTN_DD(0) << 1); + OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gButtonBackgroundTex, BBtn_Size, BBtn_Size, PosX_BtnB, PosY_BtnB, BBtnScaled, BBtnScaled, BBtn_factor, BBtn_factor); // C-Left Button Color & Texture gDPPipeSync(OVERLAY_DISP++); if (CVar_GetS32("gHudColors", 1) == 0) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cLeftAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cLeftAlpha); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cLeftAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cLeftAlpha); } else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated",0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cLeftAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, interfaceCtx->cLeftAlpha); } else if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated",0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCLBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCLBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cLeftAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, interfaceCtx->cLeftAlpha); } gSPWideTextureRectangle(OVERLAY_DISP++, C_Left_BTN_Pos[0] << 2, C_Left_BTN_Pos[1] << 2, - (C_Left_BTN_Pos[0] + R_ITEM_BTN_WIDTH(1)) << 2, - (C_Left_BTN_Pos[1] + R_ITEM_BTN_WIDTH(1)) << 2, - G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(1) << 1, R_ITEM_BTN_DD(1) << 1); + (C_Left_BTN_Pos[0] + CLeftScaled) << 2, + (C_Left_BTN_Pos[1] + CLeftScaled) << 2, + G_TX_RENDERTILE, 0, 0, CLeft_factor, CLeft_factor); // C-Down Button Color & Texture if (CVar_GetS32("gHudColors", 1) == 0) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cDownAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cDownAlpha); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cDownAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cDownAlpha); } else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated",0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cDownAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, interfaceCtx->cDownAlpha); } else if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated",0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCDBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCDBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cDownAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, interfaceCtx->cDownAlpha); } gSPWideTextureRectangle(OVERLAY_DISP++, C_Down_BTN_Pos[0] << 2, C_Down_BTN_Pos[1] << 2, - (C_Down_BTN_Pos[0] + R_ITEM_BTN_WIDTH(2)) << 2, - (C_Down_BTN_Pos[1] + R_ITEM_BTN_WIDTH(2)) << 2, - G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(2) << 1, R_ITEM_BTN_DD(2) << 1); + (C_Down_BTN_Pos[0] + CDownScaled) << 2, + (C_Down_BTN_Pos[1] + CDownScaled) << 2, + G_TX_RENDERTILE, 0, 0, CDown_factor, CDown_factor); // C-Right Button Color & Texture if (CVar_GetS32("gHudColors", 1) == 0) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cRightAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cRightAlpha); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), interfaceCtx->cRightAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cRightAlpha); } else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated",0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cRightAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, interfaceCtx->cRightAlpha); } else if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated",0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCRBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCRBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cRightAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, interfaceCtx->cRightAlpha); } gSPWideTextureRectangle(OVERLAY_DISP++, C_Right_BTN_Pos[0] << 2, C_Right_BTN_Pos[1] << 2, - (C_Right_BTN_Pos[0] + R_ITEM_BTN_WIDTH(3)) << 2, - (C_Right_BTN_Pos[1] + R_ITEM_BTN_WIDTH(3)) << 2, - G_TX_RENDERTILE, 0, 0, R_ITEM_BTN_DD(3) << 1, R_ITEM_BTN_DD(3) << 1); + (C_Right_BTN_Pos[0] + CRightScaled) << 2, + (C_Right_BTN_Pos[1] + CRightScaled) << 2, + G_TX_RENDERTILE, 0, 0, CRight_factor, CRight_factor); if ((pauseCtx->state < 8) || (pauseCtx->state >= 18)) { if ((globalCtx->pauseCtx.state != 0) || (globalCtx->pauseCtx.debugState != 0)) { @@ -3670,9 +3705,9 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { if (CVar_GetS32("gHudColors", 1) == 0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 0, 0, interfaceCtx->startAlpha); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 120, 120, 120, interfaceCtx->startAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Start_button_ori.r, Start_button_ori.g, Start_button_ori.b, interfaceCtx->startAlpha); } else if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCStartBtnPrimR", 120), CVar_GetS32("gCCStartBtnPrimG", 120), CVar_GetS32("gCCStartBtnPrimB", 120), interfaceCtx->startAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, Start_button.r, Start_button.g, Start_button.b, interfaceCtx->startAlpha); } gSPWideTextureRectangle(OVERLAY_DISP++, PosX_StartBtn << 2, PosY_StartBtn << 2, (PosX_StartBtn + StartBTN_W_Scaled) << 2, (PosY_StartBtn + StartBTN_H_Scaled) << 2, @@ -3707,11 +3742,19 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { DO_ACTION_TEX_WIDTH(), DO_ACTION_TEX_HEIGHT(), 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - //const s16 rStartLabelX = OTRGetRectDimensionFromRightEdge(R_START_LABEL_X(gSaveContext.language)+Right_HUD_Margin); - gSPWideTextureRectangle( - OVERLAY_DISP++, rStartLabelX << 2, rStartLabelY << 2, - (rStartLabelX + StartBTN_Label_W) << 2, - (rStartLabelY + StartBTN_Label_H) << 2, G_TX_RENDERTILE, 0, 0, StartBTN_Label_W_factor, StartBTN_Label_H_factor); + gDPPipeSync(OVERLAY_DISP++); + gSPSetGeometryMode(OVERLAY_DISP++, G_CULL_BACK); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, + PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->startAlpha); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); + Matrix_Translate(PosX_StartBtn-160+((Start_BTN_Scale+Start_BTN_Scale/3)*11.5f), (PosY_StartBtn-120+((Start_BTN_Scale+Start_BTN_Scale/3)*11.5f)) * -1, 1.0f, MTXMODE_NEW); + Matrix_Scale(Start_BTN_Scale+(Start_BTN_Scale/3), Start_BTN_Scale+(Start_BTN_Scale/3), Start_BTN_Scale+(Start_BTN_Scale/3), MTXMODE_APPLY); + gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), + G_MTX_MODELVIEW | G_MTX_LOAD); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[4], 4, 0); + Interface_DrawActionLabel(globalCtx->state.gfxCtx, interfaceCtx->doActionSegment + DO_ACTION_TEX_SIZE() * 2); + gDPPipeSync(OVERLAY_DISP++); } } @@ -3731,13 +3774,13 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { } if (CVar_GetS32("gHudColors", 1) == 0) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), temp); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, temp); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), temp); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, temp); } else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated",0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), temp); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, temp); } else if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated",0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCUBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCUBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCUBtnPrimB", R_C_BTN_COLOR(2)), temp); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_U.r, C_button_U.g, C_button_U.b, temp); } gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gSPWideTextureRectangle(OVERLAY_DISP++, C_Up_BTN_Pos[0] << 2, C_Up_BTN_Pos[1] << 2, (C_Up_BTN_Pos[0] + 16) << 2, @@ -3796,6 +3839,11 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { X_Margins_CD = 0; Y_Margins_CD = 0; } + const s16 ItemIconWidthFactor[3][2] = { + { CLeftScaled, CLeft_factor }, + { CDownScaled, CDown_factor }, + { CRightScaled, CRight_factor }, + }; const s16 ItemIconPos_ori[3][2] = { { R_ITEM_ICON_X(1)+X_Margins_CL, R_ITEM_ICON_Y(1)+Y_Margins_CL }, { R_ITEM_ICON_X(2)+X_Margins_CD, R_ITEM_ICON_Y(2)+Y_Margins_CD }, @@ -3858,40 +3906,34 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { } if (temp == 1) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), - interfaceCtx->cLeftAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cLeftAlpha); } else if (temp == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), - interfaceCtx->cDownAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cDownAlpha); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), - interfaceCtx->cRightAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, interfaceCtx->cRightAlpha); } if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), interfaceCtx->cRightAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, interfaceCtx->cRightAlpha); } else if (temp == 1 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCLBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCLBtnPrimB", R_C_BTN_COLOR(2)), - interfaceCtx->cLeftAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, interfaceCtx->cLeftAlpha); } else if (temp == 2 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCDBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCDBtnPrimB", R_C_BTN_COLOR(2)), - interfaceCtx->cDownAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, interfaceCtx->cDownAlpha); } else if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCRBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCRBtnPrimB", R_C_BTN_COLOR(2)), - interfaceCtx->cRightAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, interfaceCtx->cRightAlpha); } OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, ((u8*)gButtonBackgroundTex), 32, 32, - ItemIconPos[temp-1][0], ItemIconPos[temp-1][1], R_ITEM_BTN_WIDTH(temp), - R_ITEM_BTN_WIDTH(temp), R_ITEM_BTN_DD(temp) << 1, R_ITEM_BTN_DD(temp) << 1); + ItemIconPos[temp-1][0], ItemIconPos[temp-1][1], ItemIconWidthFactor[temp-1][0], + ItemIconWidthFactor[temp-1][0], ItemIconWidthFactor[temp-1][1], ItemIconWidthFactor[temp-1][1]); const char* cButtonIcons[] = { gButtonBackgroundTex, gEquippedItemOutlineTex, gEmptyCLeftArrowTex, gEmptyCDownArrowTex, gEmptyCRightArrowTex }; OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, cButtonIcons[(temp + 1)], 32, 32, - ItemIconPos[temp-1][0], ItemIconPos[temp-1][1], R_ITEM_BTN_WIDTH(temp), - R_ITEM_BTN_WIDTH(temp), R_ITEM_BTN_DD(temp) << 1, R_ITEM_BTN_DD(temp) << 1); + ItemIconPos[temp-1][0], ItemIconPos[temp-1][1], ItemIconWidthFactor[temp-1][0], + ItemIconWidthFactor[temp-1][0], ItemIconWidthFactor[temp-1][1], ItemIconWidthFactor[temp-1][1]); } } @@ -3903,6 +3945,8 @@ int16_t gItemIconDD[] = { 550, 680, 680, 680, 1024, 1024, 1024, 1024 }; void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 button) { OPEN_DISPS(globalCtx->state.gfxCtx); + GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; + InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s16 X_Margins_CL; s16 X_Margins_CR; s16 X_Margins_CD; @@ -3948,15 +3992,52 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 X_Margins_DPad_Items = 0; Y_Margins_DPad_Items = 0; } + const float ItemsScale_offset[8][2] = { + // Y X + { 104.0f, 144.0f }, //B + { 108.0f, 148.0f }, //C L + { 108.0f, 148.0f }, //C D + { 108.0f, 148.0f }, //C R + { 112.0f, 152.0f }, //Dpad ^ + { 112.0f, 152.0f }, //Dpad V + { 112.0f, 152.0f }, //Dpad < + { 112.0f, 152.0f } //Dpad > + }; + float ItemScale_ori[8] = { + 1.0f, //B BTN + 0.87f, 0.87f, 0.87f, //C BTNs L / D / R + 0.6f, 0.6f, 0.6f, 0.6f //Dpad U/D/L/R + }; const s16 ItemIconPos_ori[8][2] = { - { B_BUTTON_X+X_Margins_BtnB, B_BUTTON_Y+Y_Margins_BtnB }, - { C_LEFT_BUTTON_X+X_Margins_CL, C_LEFT_BUTTON_Y+Y_Margins_CL }, - { C_DOWN_BUTTON_X+X_Margins_CD, C_DOWN_BUTTON_Y+Y_Margins_CD }, - { C_RIGHT_BUTTON_X+X_Margins_CR, C_RIGHT_BUTTON_Y+Y_Margins_CR }, - { DPAD_UP_X+X_Margins_DPad_Items, DPAD_UP_Y+Y_Margins_DPad_Items }, - { DPAD_DOWN_X+X_Margins_DPad_Items, DPAD_DOWN_Y+Y_Margins_DPad_Items }, - { DPAD_LEFT_X+X_Margins_DPad_Items, DPAD_LEFT_Y+Y_Margins_DPad_Items }, - { DPAD_RIGHT_X+X_Margins_DPad_Items, DPAD_RIGHT_Y+Y_Margins_DPad_Items } + { B_BUTTON_X+X_Margins_BtnB-ItemsScale_offset[0][1], B_BUTTON_Y+Y_Margins_BtnB-ItemsScale_offset[0][0] }, + { C_LEFT_BUTTON_X+X_Margins_CL-ItemsScale_offset[1][1], C_LEFT_BUTTON_Y+Y_Margins_CL-ItemsScale_offset[1][0] }, + { C_DOWN_BUTTON_X+X_Margins_CD-ItemsScale_offset[2][1], C_DOWN_BUTTON_Y+Y_Margins_CD-ItemsScale_offset[2][0] }, + { C_RIGHT_BUTTON_X+X_Margins_CR-ItemsScale_offset[3][1], C_RIGHT_BUTTON_Y+Y_Margins_CR-ItemsScale_offset[3][0] }, + { DPAD_UP_X+X_Margins_DPad_Items-ItemsScale_offset[4][1], DPAD_UP_Y+Y_Margins_DPad_Items-ItemsScale_offset[4][0] }, + { DPAD_DOWN_X+X_Margins_DPad_Items-ItemsScale_offset[5][1], DPAD_DOWN_Y+Y_Margins_DPad_Items-ItemsScale_offset[5][0] }, + { DPAD_LEFT_X+X_Margins_DPad_Items-ItemsScale_offset[6][1], DPAD_LEFT_Y+Y_Margins_DPad_Items-ItemsScale_offset[6][0] }, + { DPAD_RIGHT_X+X_Margins_DPad_Items-ItemsScale_offset[7][1], DPAD_RIGHT_Y+Y_Margins_DPad_Items-ItemsScale_offset[7][0] } + }; + float ItemScale[8] = { + CVar_GetFloat("gBBtnScale", 1.0f), + CVar_GetFloat("gCBtnLScale", 0.87f), + CVar_GetFloat("gCBtnDScale", 0.87f), + CVar_GetFloat("gCBtnRScale", 0.87f), + CVar_GetFloat("gDPadScale", 0.425f), + CVar_GetFloat("gDPadScale", 0.425f), + CVar_GetFloat("gDPadScale", 0.425f), + CVar_GetFloat("gDPadScale", 0.425f), + }; + float ItemScaleCurrent[8]; //Hold the array with modified scale + u16 ItemsSlotsAlpha[8] = { + interfaceCtx->bAlpha, + interfaceCtx->cLeftAlpha, + interfaceCtx->cRightAlpha, + interfaceCtx->cDownAlpha, + interfaceCtx->dpadUpAlpha, + interfaceCtx->dpadDownAlpha, + interfaceCtx->dpadLeftAlpha, + interfaceCtx->dpadRightAlpha }; s16 DPad_ItemsOffset[4][2] = { { 7,-8},//Up @@ -3967,6 +4048,10 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 s16 ItemIconPos[8][2]; //(X,Y) //DPadItems if (CVar_GetS32("gDPadPosType", 0) != 0) { + ItemScaleCurrent[4] = ItemScale[4]; + ItemScaleCurrent[5] = ItemScale[5]; + ItemScaleCurrent[6] = ItemScale[6]; + ItemScaleCurrent[7] = ItemScale[7]; ItemIconPos[4][1] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[0][1];//Up ItemIconPos[5][1] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[1][1];//Down ItemIconPos[6][1] = CVar_GetS32("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[2][1];//Left @@ -3995,6 +4080,10 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 ItemIconPos[7][0] = -9999; } } else { + ItemScaleCurrent[4] = ItemScale_ori[4]; + ItemScaleCurrent[5] = ItemScale_ori[5]; + ItemScaleCurrent[6] = ItemScale_ori[6]; + ItemScaleCurrent[7] = ItemScale_ori[7]; ItemIconPos[4][0] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[4][0]); ItemIconPos[5][0] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[5][0]); ItemIconPos[6][0] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[6][0]); @@ -4006,73 +4095,81 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 } //B Button if (CVar_GetS32("gBBtnPosType", 0) != 0) { - ItemIconPos[0][1] = CVar_GetS32("gBBtnPosY", 0)+Y_Margins_BtnB; + ItemScaleCurrent[0] = ItemScale[0]; + ItemIconPos[0][1] = CVar_GetS32("gBBtnPosY", 0)+Y_Margins_BtnB-ItemsScale_offset[0][0]; if (CVar_GetS32("gBBtnPosType", 0) == 1) {//Anchor Left if (CVar_GetS32("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Left_HUD_Margin;}; - ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB); + ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB-ItemsScale_offset[0][1]); } else if (CVar_GetS32("gBBtnPosType", 0) == 2) {//Anchor Right if (CVar_GetS32("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Right_HUD_Margin;}; - ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB); + ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gBBtnPosX", 0)+X_Margins_BtnB-ItemsScale_offset[0][1]); } else if (CVar_GetS32("gBBtnPosType", 0) == 3) {//Anchor None - ItemIconPos[0][0] = CVar_GetS32("gBBtnPosX", 0); + ItemIconPos[0][0] = CVar_GetS32("gBBtnPosX", 0)-ItemsScale_offset[0][1]; } else if (CVar_GetS32("gBBtnPosType", 0) == 4) {//Hidden ItemIconPos[0][0] = -9999; } } else { + ItemScaleCurrent[0] = ItemScale_ori[0]; ItemIconPos[0][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[0][0]); ItemIconPos[0][1] = ItemIconPos_ori[0][1]; } //C button Left if (CVar_GetS32("gCBtnLPosType", 0) != 0) { - ItemIconPos[1][1] = CVar_GetS32("gCBtnLPosY", 0)+Y_Margins_CL; + ItemScaleCurrent[1] = ItemScale[1]; + ItemIconPos[1][1] = CVar_GetS32("gCBtnLPosY", 0)+Y_Margins_CL-ItemsScale_offset[1][0]; if (CVar_GetS32("gCBtnLPosType", 0) == 1) {//Anchor Left if (CVar_GetS32("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Left_HUD_Margin;}; - ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL); + ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL-ItemsScale_offset[1][1]); } else if (CVar_GetS32("gCBtnLPosType", 0) == 2) {//Anchor Right if (CVar_GetS32("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Right_HUD_Margin;}; - ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL); + ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnLPosX", 0)+X_Margins_CL-ItemsScale_offset[1][1]); } else if (CVar_GetS32("gCBtnLPosType", 0) == 3) {//Anchor None - ItemIconPos[1][0] = CVar_GetS32("gCBtnLPosX", 0); + ItemIconPos[1][0] = CVar_GetS32("gCBtnLPosX", 0)-ItemsScale_offset[1][1]; } else if (CVar_GetS32("gCBtnLPosType", 0) == 4) {//Hidden ItemIconPos[1][0] = -9999; } } else { + ItemScaleCurrent[1] = ItemScale_ori[1]; ItemIconPos[1][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[1][0]); ItemIconPos[1][1] = ItemIconPos_ori[1][1]; } //C Button down if (CVar_GetS32("gCBtnDPosType", 0) != 0) { - ItemIconPos[2][1] = CVar_GetS32("gCBtnDPosY", 0)+Y_Margins_CD; + ItemScaleCurrent[2] = ItemScale[2]; + ItemIconPos[2][1] = CVar_GetS32("gCBtnDPosY", 0)+Y_Margins_CD-ItemsScale_offset[2][0]; if (CVar_GetS32("gCBtnDPosType", 0) == 1) {//Anchor Left if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; - ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD); + ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD-ItemsScale_offset[2][1]); } else if (CVar_GetS32("gCBtnDPosType", 0) == 2) {//Anchor Right if (CVar_GetS32("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; - ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD); + ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnDPosX", 0)+X_Margins_CD-ItemsScale_offset[2][1]); } else if (CVar_GetS32("gCBtnDPosType", 0) == 3) {//Anchor None - ItemIconPos[2][0] = CVar_GetS32("gCBtnDPosX", 0); + ItemIconPos[2][0] = CVar_GetS32("gCBtnDPosX", 0)-ItemsScale_offset[2][1]; } else if (CVar_GetS32("gCBtnDPosType", 0) == 4) {//Hidden ItemIconPos[2][0] = -9999; } } else { + ItemScaleCurrent[2] = ItemScale_ori[2]; ItemIconPos[2][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[2][0]); ItemIconPos[2][1] = ItemIconPos_ori[2][1]; } //C button Right if (CVar_GetS32("gCBtnRPosType", 0) != 0) { - ItemIconPos[3][1] = CVar_GetS32("gCBtnRPosY", 0)+Y_Margins_CR; + ItemScaleCurrent[3] = ItemScale[3]; + ItemIconPos[3][1] = CVar_GetS32("gCBtnRPosY", 0)+Y_Margins_CR-ItemsScale_offset[3][0]; if (CVar_GetS32("gCBtnRPosType", 0) == 1) {//Anchor Left if (CVar_GetS32("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Left_HUD_Margin;}; - ItemIconPos[3][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR); + ItemIconPos[3][0] = OTRGetDimensionFromLeftEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR-ItemsScale_offset[3][1]); } else if (CVar_GetS32("gCBtnRPosType", 0) == 2) {//Anchor Right if (CVar_GetS32("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Right_HUD_Margin;}; - ItemIconPos[3][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR); + ItemIconPos[3][0] = OTRGetDimensionFromRightEdge(CVar_GetS32("gCBtnRPosX", 0)+X_Margins_CR-ItemsScale_offset[3][1]); } else if (CVar_GetS32("gCBtnRPosType", 0) == 3) {//Anchor None - ItemIconPos[3][0] = CVar_GetS32("gCBtnRPosX", 0); + ItemIconPos[3][0] = CVar_GetS32("gCBtnRPosX", 0)-ItemsScale_offset[3][1]; } else if (CVar_GetS32("gCBtnRPosType", 0) == 4) {//Hidden ItemIconPos[3][0] = -9999; } } else { + ItemScaleCurrent[3] = ItemScale_ori[3]; ItemIconPos[3][0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[3][0]); ItemIconPos[3][1] = ItemIconPos_ori[3][1]; } @@ -4080,10 +4177,23 @@ void Interface_DrawItemIconTexture(GlobalContext* globalCtx, void* texture, s16 gDPLoadTextureBlock(OVERLAY_DISP++, texture, G_IM_FMT_RGBA, G_IM_SIZ_32b, 32, 32, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); - gSPWideTextureRectangle(OVERLAY_DISP++, ItemIconPos[button][0] << 2, ItemIconPos[button][1] << 2, - (ItemIconPos[button][0] + gItemIconWidth[button]) << 2, - (ItemIconPos[button][1] + gItemIconWidth[button]) << 2, G_TX_RENDERTILE, 0, 0, - gItemIconDD[button] << 1, gItemIconDD[button] << 1); + gDPPipeSync(OVERLAY_DISP++); + gSPSetGeometryMode(OVERLAY_DISP++, G_CULL_BACK); + gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, ItemsSlotsAlpha[button]); + gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); + Matrix_Translate( + ItemIconPos[button][0], + ItemIconPos[button][1] * -1, 1.0f, MTXMODE_NEW); + + Matrix_Scale( + ItemScaleCurrent[button]/1, + ItemScaleCurrent[button]/1, + ItemScaleCurrent[button]/1, MTXMODE_APPLY); + gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); + gSPVertex(OVERLAY_DISP++, &interfaceCtx->actionVtx[0], 4, 0); + gSP1Quadrangle(OVERLAY_DISP++, 0, 2, 3, 1, 0); + gDPPipeSync(OVERLAY_DISP++); CLOSE_DISPS(globalCtx->state.gfxCtx); } @@ -4495,7 +4605,12 @@ void Interface_Draw(GlobalContext* globalCtx) { { 0x82, 0x82, 0xFF }, // Adult's Wallet (Blue) { 0xFF, 0x64, 0x64 }, // Giant's Wallet (Red) }; - s16 rColor[3] = { 200, 255, 100 }; + Color_RGB8 rColor_ori = { 200, 255, 100 }; + Color_RGB8 rColor; + Color_RGB8 keyColor_ori = { 200, 230, 255 }; + Color_RGB8 keyColor; + Color_RGB8 DPad_colors_ori = {255, 255, 255}; + Color_RGB8 DPad_colors = CVar_GetRGB("gCCDpadPrim", DPad_colors_ori); static s16 spoilingItemEntrances[] = { 0x01AD, 0x0153, 0x0153 }; static f32 D_80125B54[] = { -40.0f, -35.0f }; // unused static s16 D_80125B5C[] = { 91, 91 }; // unused @@ -4542,25 +4657,23 @@ void Interface_Draw(GlobalContext* globalCtx) { //Custom Color is on but check if Dynamic Wallet is on. if (CVar_GetS32("gDynamicWalletIcon", 0) != 0) { //if on let's use Dynamic Colors - rColor[0] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][0]; - rColor[1] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][1]; - rColor[2] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][2]; + rColor.r = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][0]; + rColor.g = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][1]; + rColor.b = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][2]; } else { //else use our custom color - rColor[0] = CVar_GetS32("gCCRupeePrimR", &rupeeWalletColors[0][0]); - rColor[1] = CVar_GetS32("gCCRupeePrimG", &rupeeWalletColors[0][1]); - rColor[2] = CVar_GetS32("gCCRupeePrimB", &rupeeWalletColors[0][2]); + rColor = CVar_GetRGB("gCCRupeePrim", rColor_ori); } } else { //Custom colors is off so check if Dynamic Wallet is on. if (CVar_GetS32("gDynamicWalletIcon", 0) != 0) { - rColor[0] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][0]; - rColor[1] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][1]; - rColor[2] = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][2]; + rColor.r = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][0]; + rColor.g = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][1]; + rColor.b = rupeeWalletColors[CUR_UPG_VALUE(UPG_WALLET)][2]; } else { - rColor[0] = rupeeWalletColors[0][0]; - rColor[1] = rupeeWalletColors[0][1]; - rColor[2] = rupeeWalletColors[0][2]; + rColor.r = rupeeWalletColors[0][0]; + rColor.g = rupeeWalletColors[0][1]; + rColor.b = rupeeWalletColors[0][2]; } } if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gDynamicWalletIcon", 0) != 1) { @@ -4598,7 +4711,7 @@ void Interface_Draw(GlobalContext* globalCtx) { PosY_RC = PosY_RC_ori; PosX_RC = PosX_RC_ori; } - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, rColor[0], rColor[1], rColor[2], interfaceCtx->magicAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, rColor.r, rColor.g, rColor.b, interfaceCtx->magicAlpha); OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gRupeeCounterIconTex, 16, 16, PosX_RC, PosY_RC, 16, 16, 1 << 10, 1 << 10); switch (globalCtx->sceneNum) { @@ -4651,10 +4764,10 @@ void Interface_Draw(GlobalContext* globalCtx) { gDPPipeSync(OVERLAY_DISP++); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCKeysPrimR", 200), CVar_GetS32("gCCKeysPrimG", 230), CVar_GetS32("gCCKeysPrimB", 255), interfaceCtx->magicAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCKeysPrim", keyColor_ori).r,CVar_GetRGB("gCCKeysPrim", keyColor_ori).g,CVar_GetRGB("gCCKeysPrim", keyColor_ori).b, interfaceCtx->magicAlpha); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); //We reset this here so it match user color :) } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 200, 230, 255, interfaceCtx->magicAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, keyColor_ori.r, keyColor_ori.g, keyColor_ori.b, interfaceCtx->magicAlpha); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 20, 255); } OVERLAY_DISP = Gfx_TextureIA8(OVERLAY_DISP, gSmallKeyCounterIconTex, 16, 16, PosX_SKC, PosY_SKC, 16, 16, @@ -4909,9 +5022,9 @@ void Interface_Draw(GlobalContext* globalCtx) { gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCDpadPrimR", 255), CVar_GetS32("gCCDpadPrimG", 255), CVar_GetS32("gCCDpadPrimB", 255), dpadAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, DPad_colors.r,DPad_colors.g,DPad_colors.b, dpadAlpha); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, dpadAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, DPad_colors_ori.r,DPad_colors_ori.g,DPad_colors_ori.b, dpadAlpha); } if (fullUi) { gDPLoadTextureBlock(OVERLAY_DISP++, ResourceMgr_LoadFileRaw("assets/ship_of_harkinian/buttons/dpad.bin"), @@ -4969,6 +5082,7 @@ void Interface_Draw(GlobalContext* globalCtx) { // A Button func_80094A14(globalCtx->state.gfxCtx); + const Color_RGB8 A_Button_Colors = {R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2)}; s16 X_Margins_BtnA; s16 Y_Margins_BtnA; if (CVar_GetS32("gABtnUseMargins", 0) != 0) { @@ -5015,9 +5129,9 @@ void Interface_Draw(GlobalContext* globalCtx) { if (CVar_GetS32("gHudColors", 1) == 0) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 90, 90, 255, interfaceCtx->aAlpha); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, R_A_BTN_COLOR(0), R_A_BTN_COLOR(1), R_A_BTN_COLOR(2), interfaceCtx->aAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, A_Button_Colors.r, A_Button_Colors.g, A_Button_Colors.b, interfaceCtx->aAlpha); } else if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", R_A_BTN_COLOR(0)), CVar_GetS32("gCCABtnPrimG", R_A_BTN_COLOR(1)), CVar_GetS32("gCCABtnPrimB", R_A_BTN_COLOR(2)), interfaceCtx->aAlpha); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCABtnPrim", A_Button_Colors).r,CVar_GetRGB("gCCABtnPrim", A_Button_Colors).g,CVar_GetRGB("gCCABtnPrim", A_Button_Colors).b, interfaceCtx->aAlpha); } if (fullUi) { Interface_DrawActionButton(globalCtx, PosX_BtnA, PosY_BtnA); diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index eec0ce208..0da3685a6 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -415,6 +415,13 @@ void Gameplay_Init(GameState* thisx) { PreRender_SetValues(&globalCtx->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0); gTrnsnUnkState = 0; globalCtx->transitionMode = 0; + + if (CVar_GetS32("gSceneTransitions", 255)!= 255){ + globalCtx->transitionMode = CVar_GetS32("gSceneTransitions", 0); + gSaveContext.nextTransition = CVar_GetS32("gSceneTransitions", 0); + globalCtx->fadeTransition = CVar_GetS32("gSceneTransitions", 0); + } + FrameAdvance_Init(&globalCtx->frameAdvCtx); Rand_Seed((u32)osGetTime()); Matrix_Init(&globalCtx->state); diff --git a/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index 3674167d5..e6bf1026a 100644 --- a/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/soh/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -194,6 +194,10 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { u32 stateFrames; EnArrow* arrow; Actor* tranform; + Color_RGB8 Arrow_env_ori = {255,0,0}; + Color_RGB8 Arrow_col_ori = {255,200,0}; + Color_RGB8 Arrow_env = CVar_GetRGB("gFireArrowColEnv", Arrow_env_ori); + Color_RGB8 Arrow_col = CVar_GetRGB("gFireArrowCol", Arrow_col_ori); stateFrames = globalCtx->state.frames; arrow = (EnArrow*)this->actor.parent; @@ -214,9 +218,9 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP); if (CVar_GetS32("gUseArrowsCol", 0)) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, - (s32)(CVar_GetS32("gFireArrowColEnvR", 40) * this->unk_15C) & 0xFF, - (s32)(CVar_GetS32("gFireArrowColEnvG", 0) * this->unk_15C) & 0xFF, - (s32)(CVar_GetS32("gFireArrowColEnvB", 0) * this->unk_15C) & 0xFF, + (s32)(Arrow_env.r * this->unk_15C) & 0xFF, + (s32)(Arrow_env.g * this->unk_15C) & 0xFF, + (s32)(Arrow_env.b * this->unk_15C) & 0xFF, (s32)(30.0f * this->unk_15C) & 0xFF); //Intentionnally made Alpha lower. } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s32)(40.0f * this->unk_15C) & 0xFF, 0, 0, @@ -230,11 +234,11 @@ void ArrowFire_Draw(Actor* thisx, GlobalContext* globalCtx2) { // Draw fire on the arrow func_80093D84(globalCtx->state.gfxCtx); if (CVar_GetS32("gUseArrowsCol", 0)) { - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, CVar_GetS32("gFireArrowColR", 255), CVar_GetS32("gFireArrowColG", 200), CVar_GetS32("gFireArrowColB", 0), this->alpha); - gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gFireArrowColEnvR", 255), CVar_GetS32("gFireArrowColEnvG", 0), CVar_GetS32("gFireArrowColEnvB", 0), 128); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128); } else { - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, this->alpha); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 128); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col_ori.r, Arrow_col_ori.g, Arrow_col_ori.b, this->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env_ori.r, Arrow_env_ori.g, Arrow_env_ori.b, 128); } Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); if (this->timer != 0) { diff --git a/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index 1af27f3ec..a55a4ac4a 100644 --- a/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/soh/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -195,6 +195,10 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { Actor* tranform; u32 stateFrames = globalCtx->state.frames; EnArrow* arrow = (EnArrow*)this->actor.parent; + Color_RGB8 Arrow_env_ori = {0,0,255}; + Color_RGB8 Arrow_col_ori = {170, 255, 255}; + Color_RGB8 Arrow_env = CVar_GetRGB("gIceArrowColEnv", Arrow_env_ori); + Color_RGB8 Arrow_col = CVar_GetRGB("gIceArrowCol", Arrow_col_ori); if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; @@ -212,9 +216,9 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP); if (CVar_GetS32("gUseArrowsCol", 0)) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, - (s32)(CVar_GetS32("gIceArrowColEnvR", 0) * this->unk_164) & 0xFF, - (s32)(CVar_GetS32("gIceArrowColEnvG", 10) * this->unk_164) & 0xFF, - (s32)(CVar_GetS32("gIceArrowColEnvB", 50) * this->unk_164) & 0xFF, + (s32)(Arrow_env.r * this->unk_164) & 0xFF, + (s32)(Arrow_env.g * this->unk_164) & 0xFF, + (s32)(Arrow_env.b * this->unk_164) & 0xFF, (s32)(30.0f * this->unk_164) & 0xFF); //Intentionnally made Alpha lower. } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 0, (s32)(10.0f * this->unk_164) & 0xFF, @@ -228,11 +232,11 @@ void ArrowIce_Draw(Actor* thisx, GlobalContext* globalCtx) { // Draw ice on the arrow func_80093D84(globalCtx->state.gfxCtx); if (CVar_GetS32("gUseArrowsCol", 0)) { - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, CVar_GetS32("gIceArrowColR", 170), CVar_GetS32("gIceArrowColG", 255), CVar_GetS32("gIceArrowColB", 255), this->alpha); - gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gIceArrowColEnvR", 0), CVar_GetS32("gIceArrowColEnvG", 0), CVar_GetS32("gIceArrowColEnvB", 255), 128); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128); } else { - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 170, 255, 255, this->alpha); - gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 128); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col_ori.r, Arrow_col_ori.g, Arrow_col_ori.b, this->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env_ori.r, Arrow_env_ori.g, Arrow_env_ori.b, 128); } Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); if (this->timer != 0) { diff --git a/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index f756b4544..093cef89e 100644 --- a/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/soh/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -193,6 +193,10 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { u32 stateFrames = globalCtx->state.frames; EnArrow* arrow = (EnArrow*)this->actor.parent; Actor* tranform; + Color_RGB8 Arrow_env_ori = {255, 255, 0}; + Color_RGB8 Arrow_col_ori = {255, 255, 170}; + Color_RGB8 Arrow_env = CVar_GetRGB("gLightArrowColEnv", Arrow_env_ori); + Color_RGB8 Arrow_col = CVar_GetRGB("gLightArrowCol", Arrow_col_ori); if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { tranform = (arrow->hitFlags & 2) ? &this->actor : &arrow->actor; @@ -210,9 +214,9 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP); if (CVar_GetS32("gUseArrowsCol", 0)) { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, - (s32)(CVar_GetS32("gLightArrowColEnvR", 30) * this->unk_164) & 0xFF, - (s32)(CVar_GetS32("gLightArrowColEnvG", 40) * this->unk_164) & 0xFF, - (s32)(CVar_GetS32("gLightArrowColEnvB", 0) * this->unk_164) & 0xFF, + (s32)(Arrow_env.r * this->unk_164) & 0xFF, + (s32)(Arrow_env.g * this->unk_164) & 0xFF, + (s32)(Arrow_env.b * this->unk_164) & 0xFF, (s32)(30.0f * this->unk_164) & 0xFF); //Intentionnally made Alpha lower. } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, (s32)(30.0f * this->unk_164) & 0xFF, @@ -226,11 +230,11 @@ void ArrowLight_Draw(Actor* thisx, GlobalContext* globalCtx) { // Draw light on the arrow func_80093D84(globalCtx->state.gfxCtx); if (CVar_GetS32("gUseArrowsCol", 0)) { - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, CVar_GetS32("gLightArrowColR", 255), CVar_GetS32("gLightArrowColG", 255), CVar_GetS32("gLightArrowColB", 170), this->alpha); - gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gLightArrowColEnvR", 255), CVar_GetS32("gLightArrowColEnvG", 255), CVar_GetS32("gLightArrowColEnvB", 0), 128); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col.r, Arrow_col.g, Arrow_col.b, this->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env.r, Arrow_env.g, Arrow_env.b, 128); } else { - gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 170, this->alpha); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 255, 0, 128); + gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, Arrow_col_ori.r, Arrow_col_ori.g, Arrow_col_ori.b, this->alpha); + gDPSetEnvColor(POLY_XLU_DISP++, Arrow_env_ori.r, Arrow_env_ori.g, Arrow_env_ori.b, 128); } Matrix_RotateZYX(0x4000, 0x0, 0x0, MTXMODE_APPLY); if (this->timer != 0) { diff --git a/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.c b/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.c index 77d2a2db0..199e8cafd 100644 --- a/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.c +++ b/soh/src/overlays/actors/ovl_En_Dog/z_en_dog.c @@ -472,6 +472,10 @@ void EnDog_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve void EnDog_Draw(Actor* thisx, GlobalContext* globalCtx) { EnDog* this = (EnDog*)thisx; Color_RGBA8 colors[] = { { 255, 255, 200, 0 }, { 150, 100, 50, 0 } }; + Color_RGB8 Dog1_ori = {colors[0].r, colors[0].g, colors[0].b}; + Color_RGB8 Dog2_ori = {colors[1].r, colors[1].g, colors[1].b}; + Color_RGB8 Dog1 = CVar_GetRGB("gDog1Col", Dog1_ori); + Color_RGB8 Dog2 = CVar_GetRGB("gDog2Col", Dog2_ori); OPEN_DISPS(globalCtx->state.gfxCtx); @@ -479,19 +483,19 @@ void EnDog_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_OPA_DISP++); if (CVar_GetS32("gUseDogsCol",0)) { - colors[0].r = CVar_GetS32("gDog1ColR", 255); - colors[0].g = CVar_GetS32("gDog1ColG", 255); - colors[0].b = CVar_GetS32("gDog1ColB", 200); - colors[1].r = CVar_GetS32("gDog2ColR", 150); - colors[1].g = CVar_GetS32("gDog2ColG", 100); - colors[1].b = CVar_GetS32("gDog2ColB", 50); + colors[0].r = Dog1.r; + colors[0].g = Dog1.g; + colors[0].b = Dog1.b; + colors[1].r = Dog2.r; + colors[1].g = Dog2.g; + colors[1].b = Dog2.b; } else { - colors[0].r = 255; - colors[0].g = 255; - colors[0].b = 200; - colors[1].r = 150; - colors[1].g = 100; - colors[1].b = 50; + colors[0].r = Dog1_ori.r; + colors[0].g = Dog1_ori.g; + colors[0].b = Dog1_ori.b; + colors[1].r = Dog2_ori.r; + colors[1].g = Dog2_ori.g; + colors[1].b = Dog2_ori.b; } gDPSetEnvColor(POLY_OPA_DISP++, colors[this->actor.params & 0xF].r, colors[this->actor.params & 0xF].g, colors[this->actor.params & 0xF].b, colors[this->actor.params & 0xF].a); diff --git a/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 1e0b4a4b2..65f16bc3c 100644 --- a/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -735,6 +735,11 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList static Color_RGBA8 fireAuraEnvColor = { 255, 50, 0, 0 }; static Color_RGBA8 iceAuraPrimColor = { 100, 200, 255, 255 }; static Color_RGBA8 iceAuraEnvColor = { 0, 0, 255, 0 }; + static Color_RGB8 fireAuraPrimColor_ori = { 255, 255, 100 }; + static Color_RGB8 fireAuraEnvColor_ori = { 255, 50, 0 }; + static Color_RGB8 iceAuraPrimColor_ori = { 100, 200, 255 }; + static Color_RGB8 iceAuraEnvColor_ori = { 0, 0, 255 }; + static Vec3f effVelocity = { 0.0f, 0.5f, 0.0f }; static Vec3f effAccel = { 0.0f, 0.5f, 0.0f }; static Vec3f limbSrc = { 0.0f, 0.0f, 0.0f }; @@ -747,20 +752,20 @@ void EnFirefly_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList s16 effLife; EnFirefly* this = (EnFirefly*)thisx; if (CVar_GetS32("gUseKeeseCol", 0)) { - Color_RGBA8 fireAuraPrimColor_custom = { CVar_GetS32("gKeese1_Ef_PrimR", 255), CVar_GetS32("gKeese1_Ef_PrimG", 255), CVar_GetS32("gKeese1_Ef_PrimB", 100), 255 }; - Color_RGBA8 fireAuraEnvColor_custom = { CVar_GetS32("gKeese1_Ef_EnvR", 255), CVar_GetS32("gKeese1_Ef_Env", 50), CVar_GetS32("gKeese1_Ef_EnvB", 0), 0 }; - Color_RGBA8 iceAuraPrimColor_custom = { CVar_GetS32("gKeese2_Ef_PrimR", 100), CVar_GetS32("gKeese2_Ef_PrimG", 200), CVar_GetS32("gKeese2_Ef_PrimB", 255), 255 }; - Color_RGBA8 iceAuraEnvColor_custom = { CVar_GetS32("gKeese2_Ef_EnvR", 0), CVar_GetS32("gKeese2_Ef_Env", 0), CVar_GetS32("gKeese2_Ef_EnvB", 255), 0 }; + Color_RGBA8 fireAuraPrimColor_custom = { CVar_GetRGB("gKeese1_Ef_Prim", fireAuraPrimColor_ori).r,CVar_GetRGB("gKeese1_Ef_Prim", fireAuraPrimColor_ori).g,CVar_GetRGB("gKeese1_Ef_Prim", fireAuraPrimColor_ori).b, 255 }; + Color_RGBA8 fireAuraEnvColor_custom = { CVar_GetRGB("gKeese1_Ef_Env", fireAuraEnvColor_ori).r,CVar_GetRGB("gKeese1_Ef_Env", fireAuraEnvColor_ori).g,CVar_GetRGB("gKeese1_Ef_Env", fireAuraEnvColor_ori).b, 0 }; + Color_RGBA8 iceAuraPrimColor_custom = { CVar_GetRGB("gKeese2_Ef_Prim", iceAuraPrimColor_ori).r,CVar_GetRGB("gKeese2_Ef_Prim", iceAuraPrimColor_ori).g,CVar_GetRGB("gKeese2_Ef_Prim", iceAuraPrimColor_ori).b, 255 }; + Color_RGBA8 iceAuraEnvColor_custom = { CVar_GetRGB("gKeese2_Ef_Env", iceAuraEnvColor_ori).r,CVar_GetRGB("gKeese2_Ef_Env", iceAuraEnvColor_ori).g,CVar_GetRGB("gKeese2_Ef_Env", iceAuraEnvColor_ori).b, 0 }; fireAuraPrimColor = fireAuraPrimColor_custom; fireAuraEnvColor = fireAuraEnvColor_custom; iceAuraPrimColor = iceAuraPrimColor_custom; iceAuraEnvColor = iceAuraEnvColor_custom; } else { //Original colors are back there - Color_RGBA8 fireAuraPrimColor_custom = { 255, 255, 100, 255 }; - Color_RGBA8 fireAuraEnvColor_custom = { 255, 50, 0, 0 }; - Color_RGBA8 iceAuraPrimColor_custom = { 100, 200, 255, 255 }; - Color_RGBA8 iceAuraEnvColor_custom = { 0, 0, 255, 0 }; + Color_RGBA8 fireAuraPrimColor_custom = { fireAuraPrimColor_ori.r, fireAuraPrimColor_ori.g, fireAuraPrimColor_ori.b, 255 }; + Color_RGBA8 fireAuraEnvColor_custom = { fireAuraEnvColor_ori.r, fireAuraEnvColor_ori.g, fireAuraEnvColor_ori.b, 0 }; + Color_RGBA8 iceAuraPrimColor_custom = { iceAuraPrimColor_ori.r, iceAuraPrimColor_ori.g, iceAuraPrimColor_ori.b, 255 }; + Color_RGBA8 iceAuraEnvColor_custom = { iceAuraEnvColor_ori.r, iceAuraEnvColor_ori.g, iceAuraEnvColor_ori.b, 0 }; fireAuraPrimColor = fireAuraPrimColor_custom; fireAuraEnvColor = fireAuraEnvColor_custom; iceAuraPrimColor = iceAuraPrimColor_custom; diff --git a/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index 3469d4d6b..a7be7866d 100644 --- a/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/soh/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -118,9 +118,10 @@ void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) { this->unk_194++; - if ((BREG(1) != 0) && (this->actor.xzDistToPlayer < this->maxSpawnDistance.x) && - (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < this->maxSpawnDistance.y)) { - + if (((BREG(1) != 0) || ((CVar_GetS32("gSkipScarecrow", 0) != 0) && + (globalCtx->msgCtx.ocarinaAction == OCARINA_ACTION_FREE_PLAY) && gSaveContext.scarecrowSpawnSongSet)) && + (this->actor.xzDistToPlayer < this->maxSpawnDistance.x) && + (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < this->maxSpawnDistance.y)){ this->actor.draw = func_80A90948; Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &sCylinderInit); diff --git a/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index 84b5fd654..4d7880dc1 100644 --- a/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -341,7 +341,8 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) { switch (this->unk_1C6) { case 0: if (CVar_GetS32("gUseChargedCol",0)) { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gCharged2ColR",255), CVar_GetS32("gCharged2ColG",255), CVar_GetS32("gCharged2ColB",170), (u8)(this->unk_1B0 * 255)); + Color_RGB8 SpinColor = {255, 255, 170}; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetRGB("gCharged2Col", SpinColor).r, CVar_GetRGB("gCharged2Col", SpinColor).g, CVar_GetRGB("gCharged2Col", SpinColor).b, (u8)(this->unk_1B0 * 255)); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, (u8)(this->unk_1B0 * 255)); } @@ -350,7 +351,8 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) { break; case 1: if (CVar_GetS32("gUseChargedCol",0)) { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gCharged1ColR",170), CVar_GetS32("gCharged1ColG",255), CVar_GetS32("gCharged1ColB",255), (u8)(this->unk_1B0 * 255)); + Color_RGB8 SpinColor = {255, 255, 170}; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetRGB("gCharged1Col", SpinColor).r, CVar_GetRGB("gCharged1Col", SpinColor).g, CVar_GetRGB("gCharged1Col", SpinColor).b, (u8)(this->unk_1B0 * 255)); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, (u8)(this->unk_1B0 * 255)); } @@ -382,8 +384,10 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) { if (this->unk_1B8 >= 0.85f) { phi_f14 = (D_80AA046C[(globalCtx->gameplayFrames & 7)] * 6.0f) + 1.0f; if (CVar_GetS32("gUseChargedCol",0)) { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gCharged2ColR",255), CVar_GetS32("gCharged2ColG",255), CVar_GetS32("gCharged2ColB",170), this->unk_1C8); - gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gCharged2ColEnvR",255), CVar_GetS32("gCharged2ColEnvG",100), CVar_GetS32("gCharged2ColEnvB",0), 128); + Color_RGB8 SpinColor1 = {255, 255, 170}; + Color_RGB8 SpinColor2 = {255, 100, 0}; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetRGB("gCharged2Col", SpinColor1).r, CVar_GetRGB("gCharged2Col", SpinColor1).g, CVar_GetRGB("gCharged2Col", SpinColor1).b, this->unk_1C8); + gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetRGB("gCharged2ColEnv", SpinColor2).r, CVar_GetRGB("gCharged2ColEnv", SpinColor2).g, CVar_GetRGB("gCharged2ColEnv", SpinColor2).b, 128); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, this->unk_1C8); gDPSetEnvColor(POLY_XLU_DISP++, 255, 100, 0, 128); @@ -393,8 +397,10 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) { } else { phi_f14 = (D_80AA046C[globalCtx->gameplayFrames & 7] * 2.0f) + 1.0f; if (CVar_GetS32("gUseChargedCol",0)) { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gCharged1ColR",170), CVar_GetS32("gCharged1ColG",255), CVar_GetS32("gCharged1ColB",255), this->unk_1C8); - gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gCharged1ColEnvR",0), CVar_GetS32("gCharged1ColEnvG",100), CVar_GetS32("gCharged1ColEnvB",255), 128); + Color_RGB8 SpinColor1 = {170, 255, 255}; + Color_RGB8 SpinColor2 = {20, 100, 255}; + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetRGB("gCharged1Col", SpinColor1).r, CVar_GetRGB("gCharged1Col", SpinColor1).g, CVar_GetRGB("gCharged1Col", SpinColor1).b, this->unk_1C8); + gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetRGB("gCharged1ColEnv", SpinColor2).r, CVar_GetRGB("gCharged1ColEnv", SpinColor2).g, CVar_GetRGB("gCharged1ColEnv", SpinColor2).b, 128); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, this->unk_1C8); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 128); diff --git a/soh/src/overlays/actors/ovl_En_Mag/z_en_mag.c b/soh/src/overlays/actors/ovl_En_Mag/z_en_mag.c index c42020435..88fff9caa 100644 --- a/soh/src/overlays/actors/ovl_En_Mag/z_en_mag.c +++ b/soh/src/overlays/actors/ovl_En_Mag/z_en_mag.c @@ -101,6 +101,8 @@ void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) { #else void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) { EnMag* this = (EnMag*)thisx; + Color_RGB8 Original_Prim = { 255, 255, 170 }; + Color_RGB8 Original_Env = { 255, 100, 0 }; YREG(1) = 63; YREG(3) = 80; @@ -127,12 +129,21 @@ void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) { this->effectScroll = 0; this->unk_E30C = 0; - this->effectPrimColor[0] = 0.0f; - this->effectPrimColor[1] = 100.0f; - this->effectPrimColor[2] = 170.0f; - this->effectEnvColor[0] = 0.0f; - this->effectEnvColor[1] = 100.0f; - this->effectEnvColor[2] = 0.0f; + if (CVar_GetS32("gHudColors",0) == 2 ){ + this->effectPrimColor[0] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).r; + this->effectPrimColor[1] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).g; + this->effectPrimColor[2] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).b; + this->effectEnvColor[0] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).r; + this->effectEnvColor[1] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).g; + this->effectEnvColor[2] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).b; + } else { + this->effectPrimColor[0] = 0.0f; + this->effectPrimColor[1] = 100.0f; + this->effectPrimColor[2] = 170.0f; + this->effectEnvColor[0] = 0.0f; + this->effectEnvColor[1] = 100.0f; + this->effectEnvColor[2] = 0.0f; + } this->effectFadeInTimer = 40; @@ -147,11 +158,21 @@ void EnMag_Init(Actor* thisx, GlobalContext* globalCtx) { this->effectPrimLodFrac = 128.0f; this->effectAlpha = 255.0f; - this->effectPrimColor[0] = 255.0f; - this->effectPrimColor[1] = 255.0f; - this->effectPrimColor[2] = 170; - this->effectEnvColor[0] = 255.0f; - this->effectEnvColor[1] = 100; + if (CVar_GetS32("gHudColors",0) == 2 ){ + this->effectPrimColor[0] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).r; + this->effectPrimColor[1] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).g; + this->effectPrimColor[2] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).b; + this->effectEnvColor[0] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).r; + this->effectEnvColor[1] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).g; + this->effectEnvColor[2] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).b; + } else { + this->effectPrimColor[0] = (float)Original_Prim.r; + this->effectPrimColor[1] = (float)Original_Prim.g; + this->effectPrimColor[2] = (float)Original_Prim.b; + this->effectEnvColor[0] = (float)Original_Env.r; + this->effectEnvColor[1] = (float)Original_Env.g; + this->effectEnvColor[2] = (float)Original_Env.b; + } gSaveContext.unk_13E7 = 0; this->globalState = MAG_STATE_DISPLAY; @@ -336,6 +357,8 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad[2]; EnMag* this = (EnMag*)thisx; + Color_RGB8 Original_Prim = { 255, 255, 170 }; + Color_RGB8 Original_Env = { 255, 100, 0 }; if (gSaveContext.fileNum != 0xFEDC) { if (this->globalState < MAG_STATE_DISPLAY) { @@ -352,11 +375,21 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { this->effectPrimLodFrac = 128.0f; this->effectAlpha = 255.0f; - this->effectPrimColor[0] = 255.0f; - this->effectPrimColor[1] = 255.0f; - this->effectPrimColor[2] = 170; - this->effectEnvColor[0] = 255.0f; - this->effectEnvColor[1] = 100; + if (CVar_GetS32("gHudColors",0) == 2 ){ + this->effectPrimColor[0] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).r; + this->effectPrimColor[1] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).g; + this->effectPrimColor[2] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).b; + this->effectEnvColor[0] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).r; + this->effectEnvColor[1] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).g; + this->effectEnvColor[2] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).b; + } else { + this->effectPrimColor[0] = (float)Original_Prim.r; + this->effectPrimColor[1] = (float)Original_Prim.g; + this->effectPrimColor[2] = (float)Original_Prim.b; + this->effectEnvColor[0] = (float)Original_Env.r; + this->effectEnvColor[1] = (float)Original_Env.g; + this->effectEnvColor[2] = (float)Original_Env.b; + } this->globalState = MAG_STATE_DISPLAY; sDelayTimer = 20; @@ -395,11 +428,13 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { this->effectAlpha += 6.375f; this->effectPrimLodFrac += 0.8f; - this->effectPrimColor[0] += 6.375f; - this->effectPrimColor[1] += 3.875f; - this->effectPrimColor[2] += 2.125f; - this->effectEnvColor[0] += 6.375f; - this->effectEnvColor[1] += 3.875f; + if (CVar_GetS32("gHudColors",0) != 2 ){ + this->effectPrimColor[0] += 6.375f; + this->effectPrimColor[1] += 3.875f; + this->effectPrimColor[2] += 2.125f; + this->effectEnvColor[0] += 6.375f; + this->effectEnvColor[1] += 3.875f; + } this->effectFadeInTimer--; @@ -407,18 +442,22 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { this->effectPrimLodFrac = 32.0f; this->effectAlpha = 255.0f; - this->effectPrimColor[0] = 255.0f; - this->effectPrimColor[1] = 255.0f; - this->effectPrimColor[2] = 255.0f; - this->effectEnvColor[0] = 255.0f; - this->effectEnvColor[1] = 255.0f; + if (CVar_GetS32("gHudColors",0) != 2 ){ + this->effectPrimColor[0] = 255.0f; + this->effectPrimColor[1] = 255.0f; + this->effectPrimColor[2] = 255.0f; + this->effectEnvColor[0] = 255.0f; + this->effectEnvColor[1] = 255.0f; + } this->effectFadeInTimer = 40; this->effectFadeInState = 1; } } else if (this->effectFadeInState == 1) { - this->effectPrimColor[2] += -2.125f; - this->effectEnvColor[1] += -3.875f; + if (CVar_GetS32("gHudColors",0) != 2 ){ + this->effectPrimColor[2] += -2.125f; + this->effectEnvColor[1] += -3.875f; + } this->effectPrimLodFrac += 2.4f; @@ -427,8 +466,17 @@ void EnMag_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->effectFadeInTimer == 0) { this->effectPrimLodFrac = 128.0f; - this->effectPrimColor[2] = 170.0f; - this->effectEnvColor[1] = 100.0f; + if (CVar_GetS32("gHudColors",0) == 2 ){ + this->effectPrimColor[0] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).r; + this->effectPrimColor[1] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).g; + this->effectPrimColor[2] = (float)CVar_GetRGB("gCCTCFirePrim", Original_Prim).b; + this->effectEnvColor[0] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).r; + this->effectEnvColor[1] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).g; + this->effectEnvColor[2] = (float)CVar_GetRGB("gCCTCFireEnv", Original_Env).b; + } else { + this->effectPrimColor[2] = 170.0f; + this->effectEnvColor[1] = 100.0f; + } this->effectFadeInTimer = 32; this->effectFadeInState = 2; diff --git a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 79a2d7010..1e154ef3b 100644 --- a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -1875,6 +1875,8 @@ void EnOssan_UpdateItemSelectedProperty(EnOssan* this) { } void EnOssan_UpdateCursorAnim(EnOssan* this) { + Color_RGB8 A_button_ori = {0,255,80}; + Color_RGB8 A_button = CVar_GetRGB("gCCABtnPrim", A_button_ori); f32 t; t = this->cursorAnimTween; @@ -1896,13 +1898,13 @@ void EnOssan_UpdateCursorAnim(EnOssan* this) { this->cursorColorG = ColChanMix(80, 80.0f, t); this->cursorColorB = ColChanMix(255, 0.0f, t); } else if (CVar_GetS32("gHudColors", 1) == 1) { - this->cursorColorR = ColChanMix(0, 0.0f, t); - this->cursorColorG = ColChanMix(255, 80.0f, t); - this->cursorColorB = ColChanMix(80, 0.0f, t); + this->cursorColorR = ColChanMix(A_button_ori.r, 0.0f, t); + this->cursorColorG = ColChanMix(A_button_ori.b, 80.0f, t); + this->cursorColorB = ColChanMix(A_button_ori.r, 0.0f, t); } else if (CVar_GetS32("gHudColors", 1) == 2) { - this->cursorColorR = ColChanMix(CVar_GetS32("gCCABtnPrimR", 90), ((CVar_GetS32("gCCABtnPrimR", 90)/255)*100), t); - this->cursorColorG = ColChanMix(CVar_GetS32("gCCABtnPrimG", 90), ((CVar_GetS32("gCCABtnPrimG", 90)/255)*100), t); - this->cursorColorB = ColChanMix(CVar_GetS32("gCCABtnPrimB", 90), ((CVar_GetS32("gCCABtnPrimB", 90)/255)*100), t); + this->cursorColorR = ColChanMix(A_button.r, ((A_button.r/255)*100), t); + this->cursorColorG = ColChanMix(A_button.g, ((A_button.g/255)*100), t); + this->cursorColorB = ColChanMix(A_button.b, ((A_button.b/255)*100), t); } this->cursorColorA = ColChanMix(255, 0.0f, t); this->cursorAnimTween = t; diff --git a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c index bc804abc9..6e77f31b8 100644 --- a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -331,6 +331,9 @@ s32 func_80B0C9F0(EnSw* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALTU_DAMAGE); return true; } + if(CVar_GetS32("gGsCutscene", 0)) { + OnePointCutscene_Init(globalCtx, 2200, 90, &this->actor, MAIN_CAM); + } Enemy_StartFinishingBlow(globalCtx, &this->actor); if (((this->actor.params & 0xE000) >> 0xD) != 0) { this->skelAnime.playSpeed = 8.0f; diff --git a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c index 30ab5d06e..ba4e62585 100644 --- a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -2492,4 +2492,4 @@ void EnXc_Reset(void) { sEnXcFlameSpawned = false; D_80B41DA8 = 1; D_80B41DAC = 1; -} \ No newline at end of file +} diff --git a/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index 3ae6cbfa1..374cecea1 100644 --- a/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/soh/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -198,6 +198,10 @@ void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx) { MagicDark* this = (MagicDark*)thisx; s32 pad; u16 gameplayFrames = globalCtx->gameplayFrames; + Color_RGB8 Spell_env_ori = {0, 100, 255}; + Color_RGB8 Spell_col_ori = {170, 255, 255}; + Color_RGB8 Spell_env = CVar_GetRGB("gNL_Diamond_Env", Spell_env_ori); + Color_RGB8 Spell_col = CVar_GetRGB("gNL_Diamond_Col", Spell_col_ori); OPEN_DISPS(globalCtx->state.gfxCtx); @@ -221,8 +225,8 @@ void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (CVar_GetS32("gUseSpellsCol",0)) { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gNL_Diamond_ColR",170), CVar_GetS32("gNL_Diamond_ColG",255), CVar_GetS32("gNL_Diamond_ColB",255), (s32)(this->primAlpha * 0.6f) & 0xFF); - gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gNL_Diamond_EnvR",100), CVar_GetS32("gNL_Diamond_EnvG",100), CVar_GetS32("gNL_Diamond_EnvB",255), 128); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col.r, Spell_col.g, Spell_col.b, (s32)(this->primAlpha * 0.6f) & 0xFF); + gDPSetEnvColor(POLY_XLU_DISP++, Spell_env.r, Spell_env.g, Spell_env.b, 128); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 170, 255, 255, (s32)(this->primAlpha * 0.6f) & 0xFF); gDPSetEnvColor(POLY_XLU_DISP++, 0, 100, 255, 128); diff --git a/soh/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c b/soh/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c index 279d88f8f..7fbd62cdd 100644 --- a/soh/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/soh/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -216,7 +216,11 @@ void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad2; s32 i; u8 alpha; - + Color_RGB8 Spell_env_ori = {255, 0, 0}; + Color_RGB8 Spell_col_ori = {255, 200, 0}; + Color_RGB8 Spell_env = CVar_GetRGB("gDF_Env", Spell_env_ori); + Color_RGB8 Spell_col = CVar_GetRGB("gDF_Col", Spell_col_ori); + if (this->action > 0) { OPEN_DISPS(globalCtx->state.gfxCtx); POLY_XLU_DISP = func_800937C0(POLY_XLU_DISP); @@ -228,11 +232,11 @@ void MagicFire_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPFillRectangle(POLY_XLU_DISP++, 0, 0, 319, 239); func_80093D84(globalCtx->state.gfxCtx); if (CVar_GetS32("gUseSpellsCol",0)) { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, CVar_GetS32("gDF_ColR",255), CVar_GetS32("gDF_ColG",200), CVar_GetS32("gDF_ColB",0), (u8)(this->alphaMultiplier * 255)); - gDPSetEnvColor(POLY_XLU_DISP++, CVar_GetS32("gDF_EnvR",255), CVar_GetS32("gDF_EnvG",0), CVar_GetS32("gDF_EnvB",0), (u8)(this->alphaMultiplier * 255)); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col.r, Spell_col.g, Spell_col.b, (u8)(this->alphaMultiplier * 255)); + gDPSetEnvColor(POLY_XLU_DISP++, Spell_env.r, Spell_env.g, Spell_env.b, (u8)(this->alphaMultiplier * 255)); } else { - gDPSetPrimColor(POLY_XLU_DISP++, 0, 128, 255, 200, 0, (u8)(this->alphaMultiplier * 255)); - gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, (u8)(this->alphaMultiplier * 255)); + gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, Spell_col_ori.r, Spell_col_ori.g, Spell_col_ori.b, (u8)(this->alphaMultiplier * 255)); + gDPSetEnvColor(POLY_XLU_DISP++, Spell_env_ori.r, Spell_env_ori.g, Spell_env_ori.b, (u8)(this->alphaMultiplier * 255)); } Matrix_Scale(0.15f, 0.15f, 0.15f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(globalCtx->state.gfxCtx), diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index 195da7945..619627651 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -10372,6 +10372,7 @@ void func_80848EF8(Player* this, GlobalContext* globalCtx) { /*Prevent it on horse, while jumping and on title screen. If you fly around no stone of agony for you! */ + Color_RGB8 StoneOfAgony_ori = { 255, 255, 255 }; if (CVar_GetS32("gVisualAgony", 0) !=0 && !this->stateFlags1) { s16 Top_Margins = (CVar_GetS32("gHUDMargin_T", 0)*-1); s16 Left_Margins = CVar_GetS32("gHUDMargin_L", 0); @@ -10417,30 +10418,34 @@ void func_80848EF8(Player* this, GlobalContext* globalCtx) { gDPPipeSync(OVERLAY_DISP++); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCVSOAPrimR", 255), CVar_GetS32("gCCVSOAPrimG", 255), CVar_GetS32("gCCVSOAPrimB", 255), DefaultIconA); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).r,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).g,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).b, DefaultIconA); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, StoneOfAgony_ori.r, StoneOfAgony_ori.g, StoneOfAgony_ori.b, DefaultIconA); } gDPSetCombineLERP(OVERLAY_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); if (this->unk_6A0 > 4000000.0f) { if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCVSOAPrimR", 255), CVar_GetS32("gCCVSOAPrimG", 255), CVar_GetS32("gCCVSOAPrimB", 255), 255); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).r,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).g,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).b, 255); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, StoneOfAgony_ori.r, StoneOfAgony_ori.g, StoneOfAgony_ori.b, 255); } } else { if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetS32("gCCVSOAPrimR", 255), CVar_GetS32("gCCVSOAPrimG", 255), CVar_GetS32("gCCVSOAPrimB", 255), DefaultIconA); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).r,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).g,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).b, DefaultIconA); } else { - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA); + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, StoneOfAgony_ori.r, StoneOfAgony_ori.g, StoneOfAgony_ori.b, DefaultIconA); } } if (temp == 0 || temp <= 0.1f) { - /*Fail check, it is used to draw off the icon when - link is standing out range but do not refresh unk_6A0. - Also used to make a default value in my case.*/ - gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, DefaultIconA); + /*Fail check, it is used to draw off the icon when + link is standing out range but do not refresh unk_6A0. + Also used to make a default value in my case.*/ + if (CVar_GetS32("gHudColors", 1) == 2) { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).r,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).g,CVar_GetRGB("gCCVSOAPrim", StoneOfAgony_ori).b, DefaultIconA); + } else { + gDPSetPrimColor(OVERLAY_DISP++, 0, 0, StoneOfAgony_ori.r, StoneOfAgony_ori.g, StoneOfAgony_ori.b, DefaultIconA); + } } gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 255); gDPSetOtherMode(OVERLAY_DISP++, G_AD_DISABLE | G_CD_DISABLE | G_CK_NONE | G_TC_FILT | G_TF_POINT | G_TT_IA16 | G_TL_TILE | G_TD_CLAMP | G_TP_NONE | G_CYC_1CYCLE | G_PM_NPRIMITIVE, G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2); @@ -11182,42 +11187,83 @@ void Player_Destroy(Actor* thisx, GlobalContext* globalCtx) { } s16 func_8084ABD8(GlobalContext* globalCtx, Player* this, s32 arg2, s16 arg3) { - s32 temp1; - s16 temp2; - s16 temp3; + s32 temp1; + s16 temp2; + s16 temp3; - if (!func_8002DD78(this) && !func_808334B4(this) && (arg2 == 0)) { - temp2 = sControlInput->rel.stick_y * 240.0f; - Math_SmoothStepToS(&this->actor.focus.rot.x, temp2, 14, 4000, 30); + if (!func_8002DD78(this) && !func_808334B4(this) && (arg2 == 0)) { + if (CVar_GetS32("gAutoCenterView", 0) != 0) { + temp2 = sControlInput->rel.stick_y * 240.0f * (CVar_GetS32("gInvertYAxis", 0) ? -1 : 1); + Math_SmoothStepToS(&this->actor.focus.rot.x, temp2, 14, 4000, 30); - temp2 = sControlInput->rel.stick_x * -16.0f; - temp2 = CLAMP(temp2, -3000, 3000); - this->actor.focus.rot.y += temp2; - } - else { - temp1 = (this->stateFlags1 & PLAYER_STATE1_23) ? 3500 : 14000; - temp3 = ((sControlInput->rel.stick_y >= 0) ? 1 : -1) * - (s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f); - this->actor.focus.rot.x += temp3; + temp2 = sControlInput->rel.stick_x * -16.0f * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1); + temp2 = CLAMP(temp2, -3000, 3000); + this->actor.focus.rot.y += temp2; + } else { + temp1 = (this->stateFlags1 & PLAYER_STATE1_23) ? 3500 : 14000; + temp3 = ((sControlInput->rel.stick_y >= 0) ? 1 : -1) * + (s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f * (CVar_GetS32("gInvertYAxis", 0) ? 1 : -1)); + this->actor.focus.rot.x += temp3; - if (fabsf(sControlInput->cur.gyro_x) > 0.01f) { - this->actor.focus.rot.x -= (sControlInput->cur.gyro_x) * 750.0f; - } + if (fabsf(sControlInput->cur.gyro_x) > 0.01f) { + this->actor.focus.rot.x -= (sControlInput->cur.gyro_x) * 750.0f; + } + + if (fabsf(sControlInput->cur.right_stick_y) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) { + this->actor.focus.rot.x -= (sControlInput->cur.right_stick_y) * 10.0f * (CVar_GetS32("gInvertYAxis", 0) ? -1 : 1); + } - this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -temp1, temp1); + this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -temp1, temp1); - temp1 = 19114; - temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y; - temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) * - (s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f); - temp2 += temp3; + temp1 = 19114; + temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y; + temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) * + (s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1)); + temp2 += temp3; - this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y; + this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y; - if (fabsf(sControlInput->cur.gyro_y) > 0.01f) { - this->actor.focus.rot.y += (sControlInput->cur.gyro_y) * 750.0f; - } - } + if (fabsf(sControlInput->cur.gyro_y) > 0.01f) { + this->actor.focus.rot.y += (sControlInput->cur.gyro_y) * 750.0f; + } + + if (fabsf(sControlInput->cur.right_stick_x) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) { + this->actor.focus.rot.y += (sControlInput->cur.right_stick_x) * 10.0f * (CVar_GetS32("gInvertXAxis", 0) ? 1 : -1); + } + } +} + else { + temp1 = (this->stateFlags1 & PLAYER_STATE1_23) ? 3500 : 14000; + temp3 = ((sControlInput->rel.stick_y >= 0) ? 1 : -1) * + (s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f * (CVar_GetS32("gInvertYAxis", 0) ? 1 : -1)); + this->actor.focus.rot.x += temp3; + + if (fabsf(sControlInput->cur.gyro_x) > 0.01f) { + this->actor.focus.rot.x -= (sControlInput->cur.gyro_x) * 750.0f; + } + + if (fabsf(sControlInput->cur.right_stick_y) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) { + this->actor.focus.rot.x -= (sControlInput->cur.right_stick_y) * 10.0f * (CVar_GetS32("gInvertYAxis", 0) ? -1 : 1); + } + + this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -temp1, temp1); + + temp1 = 19114; + temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y; + temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) * + (s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f * (CVar_GetS32("gInvertXAxis", 0) ? -1 : 1)); + temp2 += temp3; + + this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y; + + if (fabsf(sControlInput->cur.gyro_y) > 0.01f) { + this->actor.focus.rot.y += (sControlInput->cur.gyro_y) * 750.0f; + } + + if (fabsf(sControlInput->cur.right_stick_x) > 15.0f && CVar_GetS32("gRightStickAiming", 0) != 0) { + this->actor.focus.rot.y += (sControlInput->cur.right_stick_x) * 10.0f * (CVar_GetS32("gInvertXAxis", 0) ? 1 : -1); + } + } this->unk_6AE |= 2; return func_80836AB8(this, (globalCtx->shootingGalleryStatus != 0) || func_8002DD78(this) || func_808334B4(this)) - @@ -12604,6 +12650,7 @@ s32 func_8084DFF4(GlobalContext* globalCtx, Player* this) { giEntry.itemId == RG_MAGIC_DOUBLE) { Audio_PlayFanfare(NA_BGM_HEART_GET | 0x900); } else { + // Just in case something weird happens with MOD_INDEX Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); } } else { diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 2aef4bc64..75cc7ca27 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1155,6 +1155,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) { s16 quadVtxIndex; s16 isActive; s16 pad; + Color_RGB8 Background_Color = { this->windowColor[0], this->windowColor[1], this->windowColor[2] }; OPEN_DISPS(this->state.gfxCtx); @@ -1187,11 +1188,9 @@ void FileChoose_DrawWindowContents(GameState* thisx) { gDPPipeSync(POLY_OPA_DISP++); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150), - CVar_GetS32("gCCFileChoosePrimB", 255), this->fileInfoAlpha[fileIndex]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->fileInfoAlpha[fileIndex]); } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], - this->fileInfoAlpha[fileIndex]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, Background_Color.r, Background_Color.g, Background_Color.b, this->fileInfoAlpha[fileIndex]); } gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[temp], 20, 0); @@ -1210,8 +1209,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) { isActive = 0; if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150), - CVar_GetS32("gCCFileChoosePrimB", 255), this->fileButtonAlpha[i]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->fileButtonAlpha[i]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], sWindowContentColors[isActive][2], this->fileButtonAlpha[i]); @@ -1224,8 +1222,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) { // draw file name box if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150), - CVar_GetS32("gCCFileChoosePrimB", 255), this->nameBoxAlpha[i]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->nameBoxAlpha[i]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], sWindowContentColors[isActive][2], this->nameBoxAlpha[i]); @@ -1239,9 +1236,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) { // draw disk label for 64DD if (Save_GetSaveMetaInfo(i)->randoSave) { if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), - CVar_GetS32("gCCFileChoosePrimG", 150), CVar_GetS32("gCCFileChoosePrimB", 255), - this->nameAlpha[i]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->nameAlpha[i]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], sWindowContentColors[isActive][2], @@ -1255,9 +1250,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) { // draw connectors if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), - CVar_GetS32("gCCFileChoosePrimG", 150), CVar_GetS32("gCCFileChoosePrimB", 255), - this->connectorAlpha[i]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->connectorAlpha[i]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, sWindowContentColors[isActive][0], sWindowContentColors[isActive][1], sWindowContentColors[isActive][2], this->connectorAlpha[i]); @@ -1289,8 +1282,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) { gDPPipeSync(POLY_OPA_DISP++); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150), - CVar_GetS32("gCCFileChoosePrimB", 255), this->actionButtonAlpha[i]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->actionButtonAlpha[i]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], this->actionButtonAlpha[i]); @@ -1308,8 +1300,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) { temp = this->confirmButtonTexIndices[i]; if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150), - CVar_GetS32("gCCFileChoosePrimB", 255), this->confirmButtonAlpha[i]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->confirmButtonAlpha[i]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], this->confirmButtonAlpha[i]); @@ -1324,8 +1315,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) { gDPPipeSync(POLY_OPA_DISP++); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150), - CVar_GetS32("gCCFileChoosePrimB", 255), this->optionButtonAlpha); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->optionButtonAlpha); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], this->optionButtonAlpha); @@ -1346,9 +1336,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) { PRIMITIVE, 0); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 155), - CVar_GetS32("gCCFileChoosePrimG", 255), CVar_GetS32("gCCFileChoosePrimB", 255), - this->highlightColor[3]); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->highlightColor[3]); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->highlightColor[0], this->highlightColor[1], this->highlightColor[2], this->highlightColor[3]); @@ -1383,6 +1371,7 @@ void FileChoose_ConfigModeDraw(GameState* thisx) { f32 eyeX; f32 eyeY; f32 eyeZ; + Color_RGB8 Background_Color = {this->windowColor[0], this->windowColor[1], this->windowColor[2]}; OPEN_DISPS(this->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); @@ -1409,8 +1398,7 @@ void FileChoose_ConfigModeDraw(GameState* thisx) { gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150), - CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->windowAlpha); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], this->windowAlpha); @@ -1447,8 +1435,7 @@ void FileChoose_ConfigModeDraw(GameState* thisx) { gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150), - CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->windowAlpha); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], this->windowAlpha); @@ -1481,8 +1468,7 @@ void FileChoose_ConfigModeDraw(GameState* thisx) { gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150), - CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->windowAlpha); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], this->windowAlpha); @@ -1819,6 +1805,7 @@ void FileChoose_SelectModeDraw(GameState* thisx) { f32 eyeX; f32 eyeY; f32 eyeZ; + Color_RGB8 Background_Color = { this->windowColor[0], this->windowColor[1], this->windowColor[2] }; OPEN_DISPS(this->state.gfxCtx); @@ -1842,8 +1829,7 @@ void FileChoose_SelectModeDraw(GameState* thisx) { gDPSetCombineMode(POLY_OPA_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChoosePrimR", 100), CVar_GetS32("gCCFileChoosePrimG", 150), - CVar_GetS32("gCCFileChoosePrimB", 255), this->windowAlpha); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChoosePrim", Background_Color).r, CVar_GetRGB("gCCFileChoosePrim", Background_Color).g, CVar_GetRGB("gCCFileChoosePrim", Background_Color).b, this->windowAlpha); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->windowColor[0], this->windowColor[1], this->windowColor[2], this->windowAlpha); @@ -1892,6 +1878,7 @@ void FileChoose_Main(GameState* thisx) { gFileSelControlsGERTex, gFileSelControlsFRATex, }; + Color_RGB8 Text_Color = { 100, 255, 255 }; FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; @@ -2028,11 +2015,9 @@ void FileChoose_Main(GameState* thisx) { PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetS32("gCCFileChooseTextPrimR", 100), - CVar_GetS32("gCCFileChooseTextPrimG", 255), CVar_GetS32("gCCFileChooseTextPrimB", 255), - this->controlsAlpha); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, CVar_GetRGB("gCCFileChooseTextPrim", Text_Color).r, CVar_GetRGB("gCCFileChooseTextPrim", Text_Color).g, CVar_GetRGB("gCCFileChooseTextPrim", Text_Color).b, this->controlsAlpha); } else { - gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 100, 255, 255, this->controlsAlpha); + gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, Text_Color.r, Text_Color.g, Text_Color.b, this->controlsAlpha); } gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 0); gDPLoadTextureBlock(POLY_OPA_DISP++, controlsTextures[gSaveContext.language], G_IM_FMT_IA, G_IM_SIZ_8b, 144, 16, diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c index 163f8c5e4..db0c10360 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_collect.c @@ -5,6 +5,14 @@ extern const char* digitTextures[]; void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { + Color_RGB8 A_button_ori = {80, 255, 150}; + Color_RGB8 A_button = CVar_GetRGB("gCCABtnPrim", A_button_ori); + Color_RGB8 C_button_ori = {255, 255, 50}; + Color_RGB8 C_button_uni = CVar_GetRGB("gCCCBtnPrim", C_button_ori); + Color_RGB8 C_button_U = CVar_GetRGB("gCCCUBtnPrim", C_button_ori); + Color_RGB8 C_button_D = CVar_GetRGB("gCCCDBtnPrim", C_button_ori); + Color_RGB8 C_button_L = CVar_GetRGB("gCCCLBtnPrim", C_button_ori); + Color_RGB8 C_button_R = CVar_GetRGB("gCCCRBtnPrim", C_button_ori); static s16 D_8082A070[][4] = { { 255, 0, 0, 255 }, { 255, 70, 0, 150 }, @@ -493,29 +501,30 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx gDPPipeSync(POLY_KAL_DISP++); + s16 Notes_alpha = D_8082A150[sp218]; if (D_8082A124[sp218] == 0) { if (CVar_GetS32("gHudColors", 1) == 0) { // A Button notes - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, D_8082A150[sp218]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, Notes_alpha); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 255, 150, D_8082A150[sp218]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button_ori.r, A_button_ori.g, A_button_ori.b, Notes_alpha); } else if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", 80), CVar_GetS32("gCCABtnPrimG", 255), CVar_GetS32("gCCABtnPrimB", 150), D_8082A150[sp218]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, Notes_alpha); } } else { if (CVar_GetS32("gHudColors", 1) == 0) { // C Buttons notes - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 50, D_8082A150[sp218]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 50, D_8082A150[sp218]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha); } else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", 255), CVar_GetS32("gCCCBtnPrimG", 160), CVar_GetS32("gCCCBtnPrimB", 0), D_8082A150[sp218]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, Notes_alpha); } else if (D_8082A124[sp218] == OCARINA_NOTE_D5 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCUBtnPrimR", 255), CVar_GetS32("gCCCUBtnPrimG", 160), CVar_GetS32("gCCCUBtnPrimB", 0), D_8082A150[sp218]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_U.r, C_button_U.g, C_button_U.b, Notes_alpha); } else if (D_8082A124[sp218] == OCARINA_NOTE_B4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", 255), CVar_GetS32("gCCCLBtnPrimG", 160), CVar_GetS32("gCCCLBtnPrimB", 0), D_8082A150[sp218]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, Notes_alpha); } else if (D_8082A124[sp218] == OCARINA_NOTE_A4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", 255), CVar_GetS32("gCCCRBtnPrimG", 160), CVar_GetS32("gCCCRBtnPrimB", 0), D_8082A150[sp218]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, Notes_alpha); } else if (D_8082A124[sp218] == OCARINA_NOTE_F4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", 255), CVar_GetS32("gCCCDBtnPrimG", 160), CVar_GetS32("gCCCDBtnPrimB", 0), D_8082A150[sp218]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, Notes_alpha); } } @@ -543,29 +552,30 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx gDPPipeSync(POLY_KAL_DISP++); if (pauseCtx->unk_1E4 == 8) { + s16 Notes_alpha = 200; if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == 0) { - if (CVar_GetS32("gHudColors", 1) == 0) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, 200); + if (CVar_GetS32("gHudColors", 1) == 0) { // A Button notes + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, Notes_alpha); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 255, 150, 200); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button_ori.r, A_button_ori.g, A_button_ori.b, Notes_alpha); } else if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", 80), CVar_GetS32("gCCABtnPrimG", 255), CVar_GetS32("gCCABtnPrimB", 150), 200); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, Notes_alpha); } } else { - if (CVar_GetS32("gHudColors", 1) == 0) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 50, 200); + if (CVar_GetS32("gHudColors", 1) == 0) { // C Buttons notes + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 50, 200); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha); } else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", 255), CVar_GetS32("gCCCBtnPrimG", 160), CVar_GetS32("gCCCBtnPrimB", 0), 200); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, Notes_alpha); } else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_D5 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCUBtnPrimR", 255), CVar_GetS32("gCCCUBtnPrimG", 160), CVar_GetS32("gCCCUBtnPrimB", 0), 200); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_U.r, C_button_U.g, C_button_U.b, Notes_alpha); } else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_B4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", 255), CVar_GetS32("gCCCLBtnPrimG", 160), CVar_GetS32("gCCCLBtnPrimB", 0), 200); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, Notes_alpha); } else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_A4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", 255), CVar_GetS32("gCCCRBtnPrimG", 160), CVar_GetS32("gCCCRBtnPrimB", 0), 200); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, Notes_alpha); } else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_F4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", 255), CVar_GetS32("gCCCDBtnPrimG", 160), CVar_GetS32("gCCCDBtnPrimB", 0), 200); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, Notes_alpha); } } } else { @@ -618,27 +628,28 @@ void KaleidoScope_DrawQuestStatus(GlobalContext* globalCtx, GraphicsContext* gfx gDPPipeSync(POLY_KAL_DISP++); + s16 Notes_alpha = D_8082A150[phi_s3]; if (D_8082A124[phi_s3] == 0) { - if (CVar_GetS32("gHudColors", 1) == 0) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, 200); + if (CVar_GetS32("gHudColors", 1) == 0) { // A Button notes + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 150, 255, Notes_alpha); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 80, 255, 150, D_8082A150[phi_s3]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button_ori.r, A_button_ori.g, A_button_ori.b, Notes_alpha); } else if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", 80), CVar_GetS32("gCCABtnPrimG", 255), CVar_GetS32("gCCABtnPrimB", 150), D_8082A150[phi_s3]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, Notes_alpha); } } else { - if (CVar_GetS32("gHudColors", 1) == 0) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 255, 255, 50, 200); + if (CVar_GetS32("gHudColors", 1) == 0) { // C Buttons notes + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha); + } else if (CVar_GetS32("gHudColors", 1) == 1) { + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, Notes_alpha); } else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", 255), CVar_GetS32("gCCCBtnPrimG", 255), CVar_GetS32("gCCCBtnPrimB", 0), D_8082A150[phi_s3]); - } else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_D5 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCUBtnPrimR", 255), CVar_GetS32("gCCCUBtnPrimG", 255), CVar_GetS32("gCCCUBtnPrimB", 0), D_8082A150[phi_s3]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, Notes_alpha); } else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_B4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", 255), CVar_GetS32("gCCCLBtnPrimG", 255), CVar_GetS32("gCCCLBtnPrimB", 0), D_8082A150[phi_s3]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, Notes_alpha); } else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_A4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", 255), CVar_GetS32("gCCCRBtnPrimG", 255), CVar_GetS32("gCCCRBtnPrimB", 0), D_8082A150[phi_s3]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, Notes_alpha); } else if (gOcarinaSongNotes[sp224].notesIdx[phi_s3] == OCARINA_NOTE_F4 && CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", 255), CVar_GetS32("gCCCDBtnPrimG", 255), CVar_GetS32("gCCCDBtnPrimB", 0), D_8082A150[phi_s3]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, Notes_alpha); } } diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index e3e093129..923dafba7 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -761,6 +761,13 @@ static s16 sCursorColors[][3] = { { 0, 255, 50 }, }; +const Color_RGB8 Cursor_ABTN_ori = {0, 255, 50}; +const Color_RGB8 Cursor_ABTNN64_ori = {0, 50, 255}; +const Color_RGB8 Cursor_CBTN_ori = {255, 255, 0}; +const Color_RGB8 Cursor_StartBTN_ori = {255, 255, 255}; +Color_RGB8 Cursor_ABTN; +Color_RGB8 Cursor_CBTN; + static void* sSavePromptTexs[] = { gPauseSavePromptENGTex, gPauseSavePromptGERTex, @@ -987,26 +994,27 @@ void KaleidoScope_DrawCursor(GlobalContext* globalCtx, u16 pageIndex) { temp = pauseCtx->unk_1E4; if (CVar_GetS32("gHudColors", 1) == 0) { - sCursorColors[1][0] = 255; - sCursorColors[1][1] = 255; - sCursorColors[1][2] = 0; - sCursorColors[2][0] = 0; - sCursorColors[2][1] = 50; - sCursorColors[2][2] = 255; + //Will be converted to ColorRGB later. + sCursorColors[1][0] = Cursor_CBTN_ori.r; + sCursorColors[1][1] = Cursor_CBTN_ori.g; + sCursorColors[1][2] = Cursor_CBTN_ori.b; + sCursorColors[2][0] = Cursor_ABTNN64_ori.r; + sCursorColors[2][1] = Cursor_ABTNN64_ori.g; + sCursorColors[2][2] = Cursor_ABTNN64_ori.b; } else if (CVar_GetS32("gHudColors", 1) == 1) { - sCursorColors[1][0] = 255; - sCursorColors[1][1] = 255; - sCursorColors[1][2] = 0; - sCursorColors[2][0] = 0; - sCursorColors[2][1] = 255; - sCursorColors[2][2] = 50; + sCursorColors[1][0] = Cursor_CBTN_ori.r; + sCursorColors[1][1] = Cursor_CBTN_ori.g; + sCursorColors[1][2] = Cursor_CBTN_ori.b; + sCursorColors[2][0] = Cursor_ABTN_ori.r; + sCursorColors[2][1] = Cursor_ABTN_ori.g; + sCursorColors[2][2] = Cursor_ABTN_ori.b; } else if (CVar_GetS32("gHudColors", 1) == 2) { - sCursorColors[1][0] = CVar_GetS32("gCCCBtnPrimR", 255); - sCursorColors[1][1] = CVar_GetS32("gCCCBtnPrimG", 255); - sCursorColors[1][2] = CVar_GetS32("gCCCBtnPrimB", 0); - sCursorColors[2][0] = CVar_GetS32("gCCABtnPrimR", 0); - sCursorColors[2][1] = CVar_GetS32("gCCABtnPrimG", 255); - sCursorColors[2][2] = CVar_GetS32("gCCABtnPrimB", 50); + sCursorColors[1][0] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).r; + sCursorColors[1][1] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).g; + sCursorColors[1][2] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).b; + sCursorColors[2][0] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).r; + sCursorColors[2][1] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).g; + sCursorColors[2][2] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).b; } if ((((pauseCtx->unk_1E4 == 0) || (temp == 8)) && (pauseCtx->state == 6)) || @@ -1079,45 +1087,46 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 255, 255, 0 }, { 0, 0, 0 }, { 0, 0, 0 }, { 255, 255, 0 }, { 0, 255, 50 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 255, 50 }, }; + const Color_RGB8 A_BTN_ori = {100, 255, 100}; if (CVar_GetS32("gHudColors", 1) == 0) { - D_8082ACF4[4][0] = 255; - D_8082ACF4[4][1] = 255; - D_8082ACF4[4][2] = 0; - D_8082ACF4[7][0] = 255; - D_8082ACF4[7][1] = 255; - D_8082ACF4[7][2] = 0; - D_8082ACF4[8][0] = 0; - D_8082ACF4[8][1] = 50; - D_8082ACF4[8][2] = 255; - D_8082ACF4[11][0] = 0; - D_8082ACF4[11][1] = 50; - D_8082ACF4[11][2] = 255; + D_8082ACF4[4][0] = Cursor_CBTN_ori.r; + D_8082ACF4[4][1] = Cursor_CBTN_ori.g; + D_8082ACF4[4][2] = Cursor_CBTN_ori.b; + D_8082ACF4[7][0] = Cursor_CBTN_ori.r; + D_8082ACF4[7][1] = Cursor_CBTN_ori.g; + D_8082ACF4[7][2] = Cursor_CBTN_ori.b; + D_8082ACF4[8][0] = Cursor_ABTNN64_ori.r; + D_8082ACF4[8][1] = Cursor_ABTNN64_ori.g; + D_8082ACF4[8][2] = Cursor_ABTNN64_ori.b; + D_8082ACF4[11][0] = Cursor_ABTNN64_ori.r; + D_8082ACF4[11][1] = Cursor_ABTNN64_ori.g; + D_8082ACF4[11][2] = Cursor_ABTNN64_ori.b; } else if (CVar_GetS32("gHudColors", 1) == 1) { - D_8082ACF4[4][0] = 255; - D_8082ACF4[4][1] = 255; - D_8082ACF4[4][2] = 0; - D_8082ACF4[7][0] = 255; - D_8082ACF4[7][1] = 255; - D_8082ACF4[7][2] = 0; - D_8082ACF4[8][0] = 0; - D_8082ACF4[8][1] = 255; - D_8082ACF4[8][2] = 50; - D_8082ACF4[11][0] = 0; - D_8082ACF4[11][1] = 255; - D_8082ACF4[11][2] = 50; + D_8082ACF4[4][0] = Cursor_CBTN_ori.r; + D_8082ACF4[4][1] = Cursor_CBTN_ori.g; + D_8082ACF4[4][2] = Cursor_CBTN_ori.b; + D_8082ACF4[7][0] = Cursor_CBTN_ori.r; + D_8082ACF4[7][1] = Cursor_CBTN_ori.g; + D_8082ACF4[7][2] = Cursor_CBTN_ori.b; + D_8082ACF4[8][0] = Cursor_ABTN_ori.r; + D_8082ACF4[8][1] = Cursor_ABTN_ori.g; + D_8082ACF4[8][2] = Cursor_ABTN_ori.b; + D_8082ACF4[11][0] = Cursor_ABTN_ori.r; + D_8082ACF4[11][1] = Cursor_ABTN_ori.g; + D_8082ACF4[11][2] = Cursor_ABTN_ori.b; } else if (CVar_GetS32("gHudColors", 1) == 2) { - D_8082ACF4[4][0] = CVar_GetS32("gCCCBtnPrimR", 255); - D_8082ACF4[4][1] = CVar_GetS32("gCCCBtnPrimG", 255); - D_8082ACF4[4][2] = CVar_GetS32("gCCCBtnPrimB", 0); - D_8082ACF4[7][0] = CVar_GetS32("gCCCBtnPrimR", 255); - D_8082ACF4[7][1] = CVar_GetS32("gCCCBtnPrimG", 255); - D_8082ACF4[7][2] = CVar_GetS32("gCCCBtnPrimB", 0); - D_8082ACF4[8][0] = CVar_GetS32("gCCABtnPrimR", 0); - D_8082ACF4[8][1] = CVar_GetS32("gCCABtnPrimG", 255); - D_8082ACF4[8][2] = CVar_GetS32("gCCABtnPrimB", 50); - D_8082ACF4[11][0] = CVar_GetS32("gCCABtnPrimR", 0); - D_8082ACF4[11][1] = CVar_GetS32("gCCABtnPrimG", 255); - D_8082ACF4[11][2] = CVar_GetS32("gCCABtnPrimB", 50); + D_8082ACF4[4][0] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).r; + D_8082ACF4[4][1] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).g; + D_8082ACF4[4][2] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).b; + D_8082ACF4[7][0] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).r; + D_8082ACF4[7][1] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).g; + D_8082ACF4[7][2] = CVar_GetRGB("gCCCBtnPrim", Cursor_CBTN_ori).b; + D_8082ACF4[8][0] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).r; + D_8082ACF4[8][1] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).g; + D_8082ACF4[8][2] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).b; + D_8082ACF4[11][0] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).r; + D_8082ACF4[11][1] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).g; + D_8082ACF4[11][2] = CVar_GetRGB("gCCABtnPrim", Cursor_ABTN_ori).b; } static s16 D_8082AD3C = 20; static s16 D_8082AD40 = 0; @@ -1499,7 +1508,7 @@ void KaleidoScope_DrawPages(GlobalContext* globalCtx, GraphicsContext* gfxCtx) { } else if (CVar_GetS32("gHudColors", 1) == 1) { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 100, 255, 100, VREG(61)); } else if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", 100), CVar_GetS32("gCCABtnPrimG", 255), CVar_GetS32("gCCABtnPrimB", 100), VREG(61)); //Save prompt cursor colour + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetRGB("gCCABtnPrim", A_BTN_ori).r, CVar_GetRGB("gCCABtnPrim", A_BTN_ori).g, CVar_GetRGB("gCCABtnPrim", A_BTN_ori).b, VREG(61)); //Save prompt cursor colour } if (pauseCtx->promptChoice == 0) { @@ -1563,6 +1572,14 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { { 0, 255, 100, 255 },//Gamecube { 0, 100, 255, 255 },//Original N64 }; + Color_RGB8 A_button_ori = {gABtnTexColour[0][0],gABtnTexColour[0][1],gABtnTexColour[0][2]}; + Color_RGB8 A_button = CVar_GetRGB("gCCABtnPrim", A_button_ori); + Color_RGB8 C_button_ori = {R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2)}; + Color_RGB8 C_button_uni = CVar_GetRGB("gCCCBtnPrim", C_button_ori); + Color_RGB8 C_button_U = CVar_GetRGB("gCCCUBtnPrim", C_button_ori); + Color_RGB8 C_button_D = CVar_GetRGB("gCCCDBtnPrim", C_button_ori); + Color_RGB8 C_button_L = CVar_GetRGB("gCCCLBtnPrim", C_button_ori); + Color_RGB8 C_button_R = CVar_GetRGB("gCCCRBtnPrim", C_button_ori); static const void* sToEquipTextures[3] = { gPauseToEquipENGTex, gPauseToEquipGERTex, @@ -1889,11 +1906,11 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { pauseCtx->infoPanelVtx[21].v.tc[0] = pauseCtx->infoPanelVtx[23].v.tc[0] = D_8082ADE0[gSaveContext.language] << 5; if (CVar_GetS32("gHudColors", 1) == 0) {//A icon to decide in save prompt - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[1][0], gABtnTexColour[1][1], gABtnTexColour[1][2], gABtnTexColour[1][3]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[1][0], gABtnTexColour[1][1], gABtnTexColour[1][2], gABtnTexColour[1][3]); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[0][0], gABtnTexColour[0][1], gABtnTexColour[0][2], gABtnTexColour[0][3]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[0][0], gABtnTexColour[0][1], gABtnTexColour[0][2], gABtnTexColour[0][3]); } else if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", gABtnTexColour[0][0]), CVar_GetS32("gCCABtnPrimG", gABtnTexColour[0][1]), CVar_GetS32("gCCABtnPrimB", gABtnTexColour[0][2]), gABtnTexColour[0][3]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, gABtnTexColour[0][3]); } //gSPDisplayList(POLY_KAL_DISP++, gAButtonIconDL);//This is changed to load the texture only so we can prim color it. gDPLoadTextureBlock(POLY_KAL_DISP++, gABtnSymbolTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 4, G_TX_NOLOD, G_TX_NOLOD); @@ -1962,17 +1979,17 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { int height_factor = (1 << 10) * icon_h / height; int width_factor = (1 << 10) * icon_w / width; if (CVar_GetS32("gHudColors", 1) == 2 && CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), 255); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, 255); for (s16 i=0; i < 3; i++) { if (i == 0) { icon_x_offset = width_crop*3-3; - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCRBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCRBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCRBtnPrimB", R_C_BTN_COLOR(2)), 255); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_R.r, C_button_R.g, C_button_R.b, 255); } else if (i == 1) { icon_x_offset = width_crop*2-3; - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCDBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCDBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCDBtnPrimB", R_C_BTN_COLOR(2)), 255); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_D.r, C_button_D.g, C_button_D.b, 255); } else if (i == 2) { icon_x_offset = width_crop; - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCLBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCLBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCLBtnPrimB", R_C_BTN_COLOR(2)), 255); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_L.r, C_button_L.g, C_button_L.b, 255); } gDPLoadTextureBlock(POLY_KAL_DISP++, gCBtnSymbolsTex, G_IM_FMT_IA, G_IM_SIZ_8b, icon_w, icon_h, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); //gSPScisTextureRectangle(POLY_KAL_DISP++,PosX << 2, PosY << 2, (PosX + icon_x_offset) << 2, (PosY + height) << 2, G_TX_RENDERTILE, 0, 0, width_factor, height_factor); @@ -1980,11 +1997,11 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { } } else { if (CVar_GetS32("gHudColors", 1) == 0) {//To equip text C button icon - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), 255); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, 255); } else if (CVar_GetS32("gHudColors", 1) == 1) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, R_C_BTN_COLOR(0), R_C_BTN_COLOR(1), R_C_BTN_COLOR(2), 255); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_ori.r, C_button_ori.g, C_button_ori.b, 255); } else if (CVar_GetS32("gHudColors", 1) == 2 && !CVar_GetS32("gCCparated", 0)) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCCBtnPrimR", R_C_BTN_COLOR(0)), CVar_GetS32("gCCCBtnPrimG", R_C_BTN_COLOR(1)), CVar_GetS32("gCCCBtnPrimB", R_C_BTN_COLOR(2)), 255); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, C_button_uni.r, C_button_uni.g, C_button_uni.b, 255); } gDPLoadTextureBlock(POLY_KAL_DISP++, gCBtnSymbolsTex, G_IM_FMT_IA, G_IM_SIZ_8b, icon_w, icon_h, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSPWideTextureRectangle(POLY_KAL_DISP++, PosX << 2, PosY << 2, (PosX + width) << 2, (PosY + height) << 2, G_TX_RENDERTILE, 0, 0, width_factor, height_factor); @@ -2025,7 +2042,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { } else if (CVar_GetS32("gHudColors", 1) == 1) { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[0][0], gABtnTexColour[0][1], gABtnTexColour[0][2], gABtnTexColour[0][3]); } else if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", gABtnTexColour[0][0]), CVar_GetS32("gCCABtnPrimG", gABtnTexColour[0][1]), CVar_GetS32("gCCABtnPrimB", gABtnTexColour[0][2]), gABtnTexColour[0][3]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, gABtnTexColour[0][3]); } //gSPDisplayList(POLY_KAL_DISP++, gAButtonIconDL); gDPLoadTextureBlock(POLY_KAL_DISP++, gABtnSymbolTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 4, G_TX_NOLOD, G_TX_NOLOD); @@ -2065,7 +2082,7 @@ void KaleidoScope_DrawInfoPanel(GlobalContext* globalCtx) { } else if (CVar_GetS32("gHudColors", 1) == 1) { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, gABtnTexColour[0][0], gABtnTexColour[0][1], gABtnTexColour[0][2], gABtnTexColour[0][3]); } else if (CVar_GetS32("gHudColors", 1) == 2) { - gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, CVar_GetS32("gCCABtnPrimR", gABtnTexColour[0][0]), CVar_GetS32("gCCABtnPrimG", gABtnTexColour[0][1]), CVar_GetS32("gCCABtnPrimB", gABtnTexColour[0][2]), gABtnTexColour[0][3]); + gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, A_button.r, A_button.g, A_button.b, gABtnTexColour[0][3]); } gDPLoadTextureBlock(POLY_KAL_DISP++, gABtnSymbolTex, G_IM_FMT_IA, G_IM_SIZ_8b, 24, 16, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 4, 4, G_TX_NOLOD, G_TX_NOLOD); gSP1Quadrangle(POLY_KAL_DISP++, 0, 2, 3, 1, 0);