diff --git a/.github/workflows/apt-deps.txt b/.github/workflows/apt-deps.txt index e9f7e07e1..c06068ab4 100644 --- a/.github/workflows/apt-deps.txt +++ b/.github/workflows/apt-deps.txt @@ -1 +1 @@ -libusb-dev libusb-1.0-0-dev libsdl2-dev libsdl2-net-dev libpng-dev libglew-dev libzip-dev zipcmp zipmerge ziptool ninja-build +libusb-dev libusb-1.0-0-dev libsdl2-dev libsdl2-net-dev libpng-dev libglew-dev libzip-dev zipcmp zipmerge ziptool nlohmann-json3-dev libtinyxml2-dev libspdlog-dev ninja-build diff --git a/.github/workflows/generate-builds.yml b/.github/workflows/generate-builds.yml index 3e1c68852..5c1930ede 100644 --- a/.github/workflows/generate-builds.yml +++ b/.github/workflows/generate-builds.yml @@ -47,6 +47,20 @@ jobs: make -j 10 sudo make install sudo cp -av /usr/local/lib/libSDL* /lib/x86_64-linux-gnu/ + - name: Install latest tinyxml2 + run: | + sudo apt-get remove libtinyxml2-dev + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + if [ ! -d "tinyxml2-10.0.0" ]; then + wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz + tar -xzf 10.0.0.tar.gz + fi + cd tinyxml2-10.0.0 + mkdir build + cd build + cmake .. + make + sudo make install - name: Generate soh.otr run: | export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" @@ -92,8 +106,8 @@ jobs: if [ -d /opt/local/ ]; then echo "MacPorts already installed" else - wget https://github.com/macports/macports-base/releases/download/v2.9.1/MacPorts-2.9.1-12-Monterey.pkg - sudo installer -pkg ./MacPorts-2.9.1-12-Monterey.pkg -target / + wget https://github.com/macports/macports-base/releases/download/v2.9.3/MacPorts-2.9.3-12-Monterey.pkg + sudo installer -pkg ./MacPorts-2.9.3-12-Monterey.pkg -target / fi echo "/opt/local/bin:/opt/local/sbin" >> $GITHUB_PATH - name: Install dependencies @@ -190,6 +204,36 @@ jobs: cmake .. make sudo make install + - name: Install latest nlohmann + if: ${{ (matrix.os == 'ubuntu-20.04' && !vars.LINUX_COMPATIBILITY_RUNNER) }} + run: | + sudo apt-get remove nlohmann-json3-dev + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + if [ ! -d "json-3.11.3" ]; then + wget https://github.com/nlohmann/json/archive/refs/tags/v3.11.3.tar.gz + tar -xzvf v3.11.3.tar.gz + fi + cd json-3.11.3 + mkdir build + cd build + cmake .. + make + sudo make install + - name: Install latest tinyxml2 + if: ${{ (matrix.os == 'ubuntu-20.04' && !vars.LINUX_COMPATIBILITY_RUNNER) || (matrix.os == 'ubuntu-22.04' && !vars.LINUX_PERFORMANCE_RUNNER) }} + run: | + sudo apt-get remove libtinyxml2-dev + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + if [ ! -d "tinyxml2-10.0.0" ]; then + wget https://github.com/leethomason/tinyxml2/archive/refs/tags/10.0.0.tar.gz + tar -xzf 10.0.0.tar.gz + fi + cd tinyxml2-10.0.0 + mkdir build + cd build + cmake .. + make + sudo make install - name: Install latest SDL_net if: ${{ (matrix.os == 'ubuntu-20.04' && !vars.LINUX_COMPATIBILITY_RUNNER) || (matrix.os == 'ubuntu-22.04' && !vars.LINUX_PERFORMANCE_RUNNER) }} run: | @@ -226,114 +270,6 @@ jobs: path: | soh.appimage readme.txt - build-switch: - needs: generate-soh-otr - runs-on: ${{ (vars.LINUX_RUNNER && fromJSON(vars.LINUX_RUNNER)) || 'ubuntu-latest' }} - container: - image: devkitpro/devkita64:20240120 - steps: - - name: Install dependencies - run: | - sudo apt-get update - sudo apt-get install -y ninja-build - sudo apt-get remove -y cmake - wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.sh -O /tmp/cmake.sh - sudo sh /tmp/cmake.sh --prefix=/usr/local/ --exclude-subdir - wget https://libzip.org/download/libzip-1.10.1.tar.gz - tar -xzvf libzip-1.10.1.tar.gz - cd libzip-1.10.1 - mkdir build - cd build - cmake -H.. -B. -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake - make - make install - - name: Fix dubious ownership error - if: ${{ vars.LINUX_RUNNER }} - run: git config --global --add safe.directory '*' - - uses: actions/checkout@v3 - with: - submodules: true - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2.11 - with: - key: ${{ runner.os }}-switch-ccache-${{ github.ref }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-switch-ccache-${{ github.ref }} - ${{ runner.os }}-switch-ccache- - - name: Build SoH - run: | - cmake -H. -Bbuild-switch -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache - cmake --build build-switch --target soh_nro -j3 - - mv build-switch/soh/*.nro soh.nro - mv README.md readme.txt - - name: Download soh.otr - uses: actions/download-artifact@v4 - with: - name: soh.otr - - name: Upload build - uses: actions/upload-artifact@v4 - with: - name: soh-switch - path: | - soh.nro - soh.otr - readme.txt - build-wiiu: - needs: generate-soh-otr - runs-on: ${{ (vars.LINUX_RUNNER && fromJSON(vars.LINUX_RUNNER)) || 'ubuntu-latest' }} - container: - image: devkitpro/devkitppc:20230110 - steps: - - name: Install dependencies - if: ${{ !vars.LINUX_RUNNER }} - run: | - sudo apt-get install -y ninja-build - sudo apt-get remove -y cmake - wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.sh -O /tmp/cmake.sh - sudo sh /tmp/cmake.sh --prefix=/usr/local/ --exclude-subdir - wget https://libzip.org/download/libzip-1.10.1.tar.gz - tar -xzvf libzip-1.10.1.tar.gz - cd libzip-1.10.1 - mkdir build - cd build - cmake -H.. -B. -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/WiiU.cmake - make - make install - - uses: actions/checkout@v3 - with: - submodules: true - - name: ccache - uses: hendrikmuhs/ccache-action@v1.2.11 - with: - key: ${{ runner.os }}-wiiu-ccache-${{ github.ref }}-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-wiiu-ccache-${{ github.ref }} - ${{ runner.os }}-wiiu-ccache- - - name: Build SoH - run: | - cmake -H. -Bbuild-wiiu -GNinja -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/WiiU.cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache - cmake --build build-wiiu --target soh_wuhb --config Release -j3 - - mv build-wiiu/soh/*.rpx soh.rpx - mv build-wiiu/soh/*.wuhb soh.wuhb - mv README.md readme.txt - env: - DEVKITPRO: /opt/devkitpro - DEVKITPPC: /opt/devkitpro/devkitPPC - - name: Download soh.otr - uses: actions/download-artifact@v4 - with: - name: soh.otr - - name: Upload build - uses: actions/upload-artifact@v4 - with: - name: soh-wiiu - path: | - soh.rpx - soh.wuhb - soh.otr - readme.txt build-windows: needs: generate-soh-otr runs-on: ${{ (vars.WINDOWS_RUNNER && fromJSON(vars.WINDOWS_RUNNER)) || 'windows-latest' }} diff --git a/.github/workflows/macports-deps.txt b/.github/workflows/macports-deps.txt index 084428d16..d15039078 100644 --- a/.github/workflows/macports-deps.txt +++ b/.github/workflows/macports-deps.txt @@ -1 +1 @@ -libsdl2 +universal libsdl2_net +universal libpng +universal glew +universal libzip +universal \ No newline at end of file +libsdl2 +universal libsdl2_net +universal libpng +universal glew +universal libzip +universal nlohmann-json +universal tinyxml2 +universal \ No newline at end of file diff --git a/.github/workflows/test-builds-on-distros.yml b/.github/workflows/test-builds-on-distros.yml index 190599a44..36bbc67a9 100644 --- a/.github/workflows/test-builds-on-distros.yml +++ b/.github/workflows/test-builds-on-distros.yml @@ -1,3 +1,8 @@ +# todo: +# nlohmann +# tinyxml2 +# spdlog + name: test-builds-on-distros on: workflow_dispatch: # by request diff --git a/.gitignore b/.gitignore index 3848a1bd8..09f29ab48 100644 --- a/.gitignore +++ b/.gitignore @@ -448,5 +448,5 @@ _packages */extract_assets_cmake* /build* -soh/build.c +soh/src/boot/build.c soh/properties.h diff --git a/CMake/lus-cvars.cmake b/CMake/lus-cvars.cmake new file mode 100644 index 000000000..e7376cfe2 --- /dev/null +++ b/CMake/lus-cvars.cmake @@ -0,0 +1,24 @@ +set(CVAR_VSYNC_ENABLED "${CVAR_PREFIX_SETTING}.VsyncEnabled" CACHE STRING "") +set(CVAR_Z_FIGHTING_MODE "${CVAR_PREFIX_SETTING}.ZFightingMode" CACHE STRING "") +set(CVAR_NEW_FILE_DROPPED "${CVAR_PREFIX_GENERAL}.NewFileDropped" CACHE STRING "") +set(CVAR_DROPPED_FILE "${CVAR_PREFIX_GENERAL}.DroppedFile" CACHE STRING "") +set(CVAR_INTERNAL_RESOLUTION "${CVAR_PREFIX_SETTING}.InternalResolution" CACHE STRING "") +set(CVAR_MSAA_VALUE "${CVAR_PREFIX_SETTING}.MSAAValue" CACHE STRING "") +set(CVAR_SDL_WINDOWED_FULLSCREEN "${CVAR_PREFIX_SETTING}.SdlWindowedFullscreen" CACHE STRING "") +set(CVAR_TEXTURE_FILTER "${CVAR_PREFIX_SETTING}.TextureFilter" CACHE STRING "") +set(CVAR_IMGUI_CONTROLLER_NAV "${CVAR_PREFIX_SETTING}.ControlNav" CACHE STRING "") +set(CVAR_CONSOLE_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.Console" CACHE STRING "") +set(CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.ControllerConfiguration" CACHE STRING "") +set(CVAR_CONTROLLER_DISCONNECTED_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.ControllerDisconnected" CACHE STRING "") +set(CVAR_CONTROLLER_REORDERING_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.ControllerReordering" CACHE STRING "") +set(CVAR_GFX_DEBUGGER_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.GfxDebugger" CACHE STRING "") +set(CVAR_STATS_WINDOW_OPEN "${CVAR_PREFIX_WINDOW}.Stats" CACHE STRING "") +set(CVAR_ENABLE_MULTI_VIEWPORTS "${CVAR_PREFIX_SETTING}.EnableMultiViewports" CACHE STRING "") +set(CVAR_LOW_RES_MODE "${CVAR_PREFIX_SETTING}.LowResMode" CACHE STRING "") +set(CVAR_SIMULATED_INPUT_LAG "${CVAR_PREFIX_SETTING}.SimulatedInputLag" CACHE STRING "") +set(CVAR_ALT_ASSETS "${CVAR_PREFIX_ENHANCEMENT}.AltAssets" CACHE STRING "") +set(CVAR_GAME_OVERLAY_FONT "${CVAR_PREFIX_SETTING}.OverlayFont" CACHE STRING "") +set(CVAR_MENU_BAR_OPEN "${CVAR_PREFIX_SETTING}.OpenMenuBar" CACHE STRING "") +set(CVAR_PREFIX_CONTROLLERS "${CVAR_PREFIX_SETTING}.Controllers" CACHE STRING "") +set(CVAR_PREFIX_ADVANCED_RESOLUTION "${CVAR_PREFIX_SETTING}.AdvancedResolution" CACHE STRING "") +include("libultraship/cmake/cvars.cmake") \ No newline at end of file diff --git a/CMake/soh-cvars.cmake b/CMake/soh-cvars.cmake new file mode 100644 index 000000000..e5ff8a384 --- /dev/null +++ b/CMake/soh-cvars.cmake @@ -0,0 +1,26 @@ +set(CVAR_PREFIX_RANDOMIZER_ENHANCEMENT "gRandoEnhancements") +set(CVAR_PREFIX_RANDOMIZER_SETTING "gRandoSettings") +set(CVAR_PREFIX_COSMETIC "gCosmetics") +set(CVAR_PREFIX_AUDIO "gAudioEditor") +set(CVAR_PREFIX_CHEAT "gCheats") +set(CVAR_PREFIX_ENHANCEMENT "gEnhancements") +set(CVAR_PREFIX_SETTING "gSettings") +set(CVAR_PREFIX_WINDOW "gOpenWindows") +set(CVAR_PREFIX_TRACKER "gTrackers") +set(CVAR_PREFIX_DEVELOPER_TOOLS "gDeveloperTools") +set(CVAR_PREFIX_GENERAL "gGeneral") +set(CVAR_PREFIX_REMOTE "gRemote") +add_compile_definitions( + CVAR_PREFIX_RANDOMIZER_ENHANCEMENT="${CVAR_PREFIX_RANDOMIZER_ENHANCEMENT}" + CVAR_PREFIX_RANDOMIZER_SETTING="${CVAR_PREFIX_RANDOMIZER_SETTING}" + CVAR_PREFIX_COSMETIC="${CVAR_PREFIX_COSMETIC}" + CVAR_PREFIX_AUDIO="${CVAR_PREFIX_AUDIO}" + CVAR_PREFIX_CHEAT="${CVAR_PREFIX_CHEAT}" + CVAR_PREFIX_ENHANCEMENT="${CVAR_PREFIX_ENHANCEMENT}" + CVAR_PREFIX_SETTING="${CVAR_PREFIX_SETTING}" + CVAR_PREFIX_WINDOW="${CVAR_PREFIX_WINDOW}" + CVAR_PREFIX_TRACKER="${CVAR_PREFIX_TRACKER}" + CVAR_PREFIX_DEVELOPER_TOOLS="${CVAR_PREFIX_DEVELOPER_TOOLS}" + CVAR_PREFIX_GENERAL="${CVAR_PREFIX_GENERAL}" + CVAR_PREFIX_REMOTE="${CVAR_PREFIX_REMOTE}" +) \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index f5227169d..891d6ad26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,6 +6,8 @@ set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version") project(Ship VERSION 8.0.5 LANGUAGES C CXX) +include(CMake/soh-cvars.cmake) +include(CMake/lus-cvars.cmake) set(PROJECT_BUILD_NAME "MacReady Foxtrot" CACHE STRING "") set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "") @@ -20,7 +22,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") set(VCPKG_TARGET_TRIPLET x64-windows-static) vcpkg_bootstrap() - vcpkg_install_packages(zlib bzip2 libzip libpng sdl2 sdl2-net glew glfw3) + vcpkg_install_packages(zlib bzip2 libzip libpng sdl2 sdl2-net glew glfw3 nlohmann-json tinyxml2 spdlog) if (CMAKE_C_COMPILER_LAUNCHER MATCHES "ccache|sccache") set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT Embedded) diff --git a/OTRExporter b/OTRExporter index e93bd2be0..3cea9ee7c 160000 --- a/OTRExporter +++ b/OTRExporter @@ -1 +1 @@ -Subproject commit e93bd2be062b13106fdb29d98cf4ada4d7ad6827 +Subproject commit 3cea9ee7c017d842aa4d9ceeb8d3ffbf29c6effb diff --git a/ZAPDTR b/ZAPDTR index 9f9d0be3c..f38a9c92e 160000 --- a/ZAPDTR +++ b/ZAPDTR @@ -1 +1 @@ -Subproject commit 9f9d0be3c914354ecabab3695581f1123c13ac20 +Subproject commit f38a9c92eb99368c0607acf356d5651ebdc96f51 diff --git a/libultraship b/libultraship index 493639d5d..7d71a2906 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 493639d5daf75c8fa5d374f96fc95b652714299f +Subproject commit 7d71a290657a2d3b09a83e8b33025e807f4fb38e diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index f653c5de5..f8ee476b8 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -92,10 +92,6 @@ if (NOT TARGET libultraship) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../libultraship ${CMAKE_BINARY_DIR}/libultraship) endif() -if (NOT TARGET ZAPDUtils) - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils ${CMAKE_BINARY_DIR}/ZAPDUtils) -endif() - if (NOT TARGET ZAPDLib) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD ${CMAKE_BINARY_DIR}/ZAPD) endif() @@ -105,8 +101,8 @@ set(PROJECT_NAME soh) ################################################################################ # Sources ################################################################################ -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/build.c.in ${CMAKE_BINARY_DIR}/build.c @ONLY) -configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/properties.h.in ${CMAKE_CURRENT_SOURCE_DIR}/properties.h @ONLY) +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/build.c.in ${CMAKE_CURRENT_SOURCE_DIR}/src/boot/build.c @ONLY) +configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/properties.h.in ${CMAKE_CURRENT_SOURCE_DIR}/properties.h @ONLY) set(Header_Files "resource.h") source_group("headers" FILES ${Header_Files}) @@ -217,8 +213,6 @@ source_group("soh\\resource\\importer\\scenecommand" REGULAR_EXPRESSION "soh/res # src (decomp) {{{ file(GLOB_RECURSE src__ RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "src/*.c" "src/*.h") -list(APPEND src__ ${CMAKE_BINARY_DIR}/build.c) -list(APPEND src__ ${CMAKE_CURRENT_SOURCE_DIR}/properties.h) list(APPEND src__ ${CMAKE_CURRENT_SOURCE_DIR}/Resource.rc) list(FILTER src__ EXCLUDE REGEX "src/dmadata/*") list(FILTER src__ EXCLUDE REGEX "src/elf_message/*") @@ -238,7 +232,6 @@ list(REMOVE_ITEM src__ "src/libultra/gu/sqrtf.c") list(REMOVE_ITEM src__ "src/libultra/gu/us2dex.c") source_group("src" REGULAR_EXPRESSION "src/*") -source_group("src\\build" FILES ${CMAKE_BINARY_DIR}/build.c ${CMAKE_CURRENT_SOURCE_DIR}/properties.h ${CMAKE_CURRENT_SOURCE_DIR}/Resource.rc) source_group("src\\boot" REGULAR_EXPRESSION "src/boot/*") source_group("src\\buffers" REGULAR_EXPRESSION "src/buffers/*") source_group("src\\code" REGULAR_EXPRESSION "src/code/*") @@ -391,10 +384,8 @@ target_include_directories(${PROJECT_NAME} PRIVATE assets ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/extern/tinyxml2 ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/ ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/libjpeg/include/ - ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/libultraship/Lib/spdlog/include/ ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic/Fast3D/U64/PR ${CMAKE_CURRENT_SOURCE_DIR}/../libultraship/src/graphic - ${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPDUtils ${CMAKE_CURRENT_SOURCE_DIR}/../ZAPDTR/ZAPD/resource/type ${SDL2-INCLUDE} ${SDL2-NET-INCLUDE} @@ -420,6 +411,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") "_UNICODE" STORMLIB_NO_AUTO_LINK "_CRT_SECURE_NO_WARNINGS;" + NOMINMAX ) elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") target_compile_definitions(${PROJECT_NAME} PRIVATE @@ -437,6 +429,7 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") "UNICODE;" "_UNICODE" STORMLIB_NO_AUTO_LINK + NOMINMAX ) endif() elseif (CMAKE_SYSTEM_NAME STREQUAL "CafeOS") @@ -650,15 +643,6 @@ endif() ################################################################################ # Pre build events ################################################################################ -if (CMAKE_SYSTEM_NAME STREQUAL "Windows") - add_custom_command_if( - TARGET ${PROJECT_NAME} - PRE_BUILD - COMMANDS - COMMAND $ copy /b $build.c +,, - ) -endif() - if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS") add_custom_command( TARGET ${PROJECT_NAME} @@ -677,7 +661,6 @@ endif() # Dependencies ################################################################################ add_dependencies(${PROJECT_NAME} - ZAPDUtils libultraship ) if(NOT CMAKE_SYSTEM_NAME MATCHES "NintendoSwitch|CafeOS") @@ -691,7 +674,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64") set(ADDITIONAL_LIBRARY_DEPENDENCIES "libultraship;" - "ZAPDUtils;" "ZAPDLib;" "glu32;" "SDL2::SDL2;" @@ -706,7 +688,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Windows") elseif("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "Win32") set(ADDITIONAL_LIBRARY_DEPENDENCIES "libultraship;" - "ZAPDUtils;" "ZAPDLib;" "glu32;" "SDL2::SDL2;" @@ -724,7 +705,6 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "NintendoSwitch") find_package(Threads REQUIRED) set(ADDITIONAL_LIBRARY_DEPENDENCIES "libultraship;" - "ZAPDUtils;" SDL2::SDL2 -lglad Threads::Threads @@ -746,7 +726,6 @@ else() find_package(Threads REQUIRED) set(ADDITIONAL_LIBRARY_DEPENDENCIES "libultraship;" - "ZAPDUtils;" "ZAPDLib;" SDL2::SDL2 "$<$:SDL2_net::SDL2_net>" diff --git a/soh/src/boot/properties.h.in b/soh/properties.h.in similarity index 100% rename from soh/src/boot/properties.h.in rename to soh/properties.h.in diff --git a/soh/soh/Enhancements/audio/AudioCollection.cpp b/soh/soh/Enhancements/audio/AudioCollection.cpp index 9da742f91..dadcbf2ac 100644 --- a/soh/soh/Enhancements/audio/AudioCollection.cpp +++ b/soh/soh/Enhancements/audio/AudioCollection.cpp @@ -2,9 +2,10 @@ #include "sequence.h" #include "sfx.h" #include -#include +#include #include #include +#include #include #include @@ -330,11 +331,13 @@ AudioCollection::AudioCollection() { } std::string AudioCollection::GetCvarKey(std::string sfxKey) { - return "gAudioEditor.ReplacedSequences." + sfxKey + ".value"; + auto prefix = CVAR_AUDIO("ReplacedSequences."); + return prefix + sfxKey + ".value"; } std::string AudioCollection::GetCvarLockKey(std::string sfxKey) { - return "gAudioEditor.ReplacedSequences." + sfxKey + ".locked"; + auto prefix = std::string(CVAR_AUDIO("ReplacedSequences.")); + return prefix + sfxKey + ".locked"; } void AudioCollection::AddToCollection(char* otrPath, uint16_t seqNum) { @@ -362,7 +365,7 @@ uint16_t AudioCollection::GetReplacementSequence(uint16_t seqId) { // for Hyrule Field instead. Otherwise, leave it alone, so that without any sfx editor modifications we will // play the normal track as usual. if (seqId == NA_BGM_FIELD_MORNING) { - if (CVarGetInteger("gAudioEditor.ReplacedSequences.NA_BGM_FIELD_LOGIC.value", NA_BGM_FIELD_LOGIC) != NA_BGM_FIELD_LOGIC) { + if (CVarGetInteger(CVAR_AUDIO("ReplacedSequences.NA_BGM_FIELD_LOGIC.value"), NA_BGM_FIELD_LOGIC) != NA_BGM_FIELD_LOGIC) { seqId = NA_BGM_FIELD_LOGIC; } } @@ -381,19 +384,19 @@ uint16_t AudioCollection::GetReplacementSequence(uint16_t seqId) { } void AudioCollection::RemoveFromShufflePool(SequenceInfo* seqInfo) { - const std::string cvarKey = "gAudioEditor.Excluded." + seqInfo->sfxKey; + const std::string cvarKey = std::string(CVAR_AUDIO("Excluded.")) + seqInfo->sfxKey; excludedSequences.insert(seqInfo); includedSequences.erase(seqInfo); CVarSetInteger(cvarKey.c_str(), 1); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } void AudioCollection::AddToShufflePool(SequenceInfo* seqInfo) { - const std::string cvarKey = "gAudioEditor.Excluded." + seqInfo->sfxKey; + const std::string cvarKey = std::string(CVAR_AUDIO("Excluded.")) + seqInfo->sfxKey; includedSequences.insert(seqInfo); excludedSequences.erase(seqInfo); CVarClear(cvarKey.c_str()); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } void AudioCollection::InitializeShufflePool() { @@ -401,7 +404,7 @@ void AudioCollection::InitializeShufflePool() { for (auto& [seqId, seqInfo] : sequenceMap) { if (!seqInfo.canBeUsedAsReplacement) continue; - const std::string cvarKey = "gAudioEditor.Excluded." + seqInfo.sfxKey; + const std::string cvarKey = std::string(CVAR_AUDIO("Excluded.")) + seqInfo.sfxKey; if (CVarGetInteger(cvarKey.c_str(), 0)) { excludedSequences.insert(&seqInfo); } else { diff --git a/soh/soh/Enhancements/audio/AudioCollection.h b/soh/soh/Enhancements/audio/AudioCollection.h index 1d53777e7..f3fd964bc 100644 --- a/soh/soh/Enhancements/audio/AudioCollection.h +++ b/soh/soh/Enhancements/audio/AudioCollection.h @@ -1,3 +1,4 @@ +#pragma once #ifdef __cplusplus #include #include diff --git a/soh/soh/Enhancements/audio/AudioEditor.cpp b/soh/soh/Enhancements/audio/AudioEditor.cpp index 8c0d415a3..3b0c2bb12 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.cpp +++ b/soh/soh/Enhancements/audio/AudioEditor.cpp @@ -9,7 +9,7 @@ #include #include "../randomizer/3drando/random.hpp" #include "../../OTRGlobals.h" -#include +#include #include "../../UIWidgets.hpp" #include "AudioCollection.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" @@ -163,17 +163,17 @@ void DrawPreviewButton(uint16_t sequenceId, std::string sfxKey, SeqType sequence const std::string stopButton = ICON_FA_STOP + hiddenKey; const std::string previewButton = ICON_FA_PLAY + hiddenKey; - if (CVarGetInteger("gAudioEditor.Playing", 0) == sequenceId) { + if (CVarGetInteger(CVAR_AUDIO("Playing"), 0) == sequenceId) { if (ImGui::Button(stopButton.c_str())) { func_800F5C2C(); - CVarSetInteger("gAudioEditor.Playing", 0); + CVarSetInteger(CVAR_AUDIO("Playing"), 0); } UIWidgets::Tooltip("Stop Preview"); } else { if (ImGui::Button(previewButton.c_str())) { - if (CVarGetInteger("gAudioEditor.Playing", 0) != 0) { + if (CVarGetInteger(CVAR_AUDIO("Playing"), 0) != 0) { func_800F5C2C(); - CVarSetInteger("gAudioEditor.Playing", 0); + CVarSetInteger(CVAR_AUDIO("Playing"), 0); } else { if (sequenceType == SEQ_SFX || sequenceType == SEQ_VOICE) { Audio_PlaySoundGeneral(sequenceId, &pos, 4, &freqScale, &freqScale, &reverbAdd); @@ -183,7 +183,7 @@ void DrawPreviewButton(uint16_t sequenceId, std::string sfxKey, SeqType sequence } else { // TODO: Cant do both here, so have to click preview button twice PreviewSequence(sequenceId); - CVarSetInteger("gAudioEditor.Playing", sequenceId); + CVarSetInteger(CVAR_AUDIO("Playing"), sequenceId); } } } @@ -203,7 +203,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); ResetGroup(map, type); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { ReplayCurrentBGM(); @@ -214,7 +214,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); RandomizeGroup(type); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { ReplayCurrentBGM(); @@ -225,7 +225,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); LockGroup(map, type); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { ReplayCurrentBGM(); @@ -236,7 +236,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); auto prevReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); UnlockGroup(map, type); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); auto curReplacement = AudioCollection::Instance->GetReplacementSequence(currentBGM); if (type == SEQ_BGM_WORLD && prevReplacement != curReplacement) { ReplayCurrentBGM(); @@ -281,7 +281,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { if (ImGui::Selectable(seqData.label.c_str())) { CVarSetInteger(cvarKey.c_str(), value); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); UpdateCurrentBGM(defaultValue, type); } @@ -301,7 +301,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { if (ImGui::Button(resetButton.c_str())) { CVarClear(cvarKey.c_str()); CVarClear(cvarLockKey.c_str()); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); UpdateCurrentBGM(defaultValue, seqData.category); } UIWidgets::Tooltip("Reset to default"); @@ -322,7 +322,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { if (locked) { CVarClear(cvarLockKey.c_str()); } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); UpdateCurrentBGM(defaultValue, type); } } @@ -335,7 +335,7 @@ void Draw_SfxTab(const std::string& tabId, SeqType type) { } else { CVarSetInteger(cvarLockKey.c_str(), 1); } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } UIWidgets::Tooltip(locked ? "Sound locked" : "Sound unlocked"); } @@ -411,7 +411,7 @@ void DrawTypeChip(SeqType type) { void AudioEditorRegisterOnSceneInitHook() { GameInteractor::Instance->RegisterGameHook([](int16_t sceneNum) { - if (CVarGetInteger("gAudioEditor.RandomizeAllOnNewScene", 0)) { + if (CVarGetInteger(CVAR_AUDIO("RandomizeAllOnNewScene"), 0)) { AudioEditor_RandomizeAll(); } }); @@ -492,18 +492,18 @@ void AudioEditor::DrawElement() { ImGui::TableNextColumn(); if (ImGui::BeginChild("SfxOptions", ImVec2(0, -8))) { ImGui::PushItemWidth(-FLT_MIN); - UIWidgets::EnhancementCheckbox("Disable Enemy Proximity Music", "gEnemyBGMDisable"); + UIWidgets::EnhancementCheckbox("Disable Enemy Proximity Music", CVAR_AUDIO("EnemyBGMDisable")); UIWidgets::InsertHelpHoverText( "Disables the music change when getting close to enemies. Useful for hearing " "your custom music for each scene more often."); - UIWidgets::EnhancementCheckbox("Disable Leading Music in Lost Woods", "gLostWoodsConsistentVolume"); + UIWidgets::EnhancementCheckbox("Disable Leading Music in Lost Woods", CVAR_AUDIO("LostWoodsConsistentVolume")); UIWidgets::InsertHelpHoverText( "Disables the volume shifting in the Lost Woods. Useful for hearing " "your custom music in the Lost Woods if you don't need the navigation assitance " "the volume changing provides. If toggling this while in the Lost Woods, reload " "the area for the effect to kick in." ); - UIWidgets::EnhancementCheckbox("Display Sequence Name on Overlay", "gSeqNameOverlay"); + UIWidgets::EnhancementCheckbox("Display Sequence Name on Overlay", CVAR_AUDIO("SeqNameOverlay")); UIWidgets::InsertHelpHoverText( "Displays the name of the current sequence in the corner of the screen whenever a new sequence " "is loaded to the main sequence player (does not apply to fanfares or enemy BGM)." @@ -511,28 +511,28 @@ void AudioEditor::DrawElement() { ImGui::SameLine(); ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); UIWidgets::EnhancementSliderInt("Overlay Duration: %d seconds", "##SeqNameOverlayDuration", - "gSeqNameOverlayDuration", 1, 10, "", 5); + CVAR_AUDIO("SeqNameOverlayDuration"), 1, 10, "", 5); ImGui::PopItemWidth(); ImGui::NewLine(); ImGui::PopItemWidth(); UIWidgets::EnhancementSliderFloat("Link's voice pitch multiplier: %.1f %%", "##linkVoiceFreqMultiplier", - "gLinkVoiceFreqMultiplier", 0.4, 2.5, "", 1.0, true, true); + CVAR_AUDIO("LinkVoiceFreqMultiplier"), 0.4, 2.5, "", 1.0, true, true); ImGui::SameLine(); const std::string resetButton = "Reset##linkVoiceFreqMultiplier"; if (ImGui::Button(resetButton.c_str())) { - CVarSetFloat("gLinkVoiceFreqMultiplier", 1.0f); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetFloat(CVAR_AUDIO("LinkVoiceFreqMultiplier"), 1.0f); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::NewLine(); - UIWidgets::EnhancementCheckbox("Randomize All Music and Sound Effects on New Scene", "gAudioEditor.RandomizeAllOnNewScene"); + UIWidgets::EnhancementCheckbox("Randomize All Music and Sound Effects on New Scene", CVAR_AUDIO("RandomizeAllOnNewScene")); UIWidgets::Tooltip("Enables randomizing all unlocked music and sound effects when you enter a new scene."); ImGui::NewLine(); ImGui::PushItemWidth(-FLT_MIN); UIWidgets::PaddedSeparator(); UIWidgets::PaddedText("The following options are experimental and may cause music\nto sound odd or have other undesireable effects."); - UIWidgets::EnhancementCheckbox("Lower Octaves of Unplayable High Notes", "gExperimentalOctaveDrop"); + UIWidgets::EnhancementCheckbox("Lower Octaves of Unplayable High Notes", CVAR_AUDIO("ExperimentalOctaveDrop")); UIWidgets::InsertHelpHoverText("Some custom sequences may have notes that are too high for the game's audio " "engine to play. Enabling this checkbox will cause these notes to drop a " "couple of octaves so they can still harmonize with the other notes of the " @@ -710,7 +710,14 @@ void AudioEditor_RandomizeAll() { RandomizeGroup(type); } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + ReplayCurrentBGM(); +} + +void AudioEditor_RandomizeGroup(SeqType group) { + RandomizeGroup(group); + + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ReplayCurrentBGM(); } @@ -719,7 +726,14 @@ void AudioEditor_ResetAll() { ResetGroup(AudioCollection::Instance->GetAllSequences(), type); } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + ReplayCurrentBGM(); +} + +void AudioEditor_ResetGroup(SeqType group) { + ResetGroup(AudioCollection::Instance->GetAllSequences(), group); + + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ReplayCurrentBGM(); } @@ -728,7 +742,7 @@ void AudioEditor_LockAll() { LockGroup(AudioCollection::Instance->GetAllSequences(), type); } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } void AudioEditor_UnlockAll() { @@ -736,5 +750,5 @@ void AudioEditor_UnlockAll() { UnlockGroup(AudioCollection::Instance->GetAllSequences(), type); } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } diff --git a/soh/soh/Enhancements/audio/AudioEditor.h b/soh/soh/Enhancements/audio/AudioEditor.h index 9cca94efe..93ae3c440 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.h +++ b/soh/soh/Enhancements/audio/AudioEditor.h @@ -7,11 +7,12 @@ #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif -#include +#include +#include "AudioCollection.h" -class AudioEditor : public LUS::GuiWindow { +class AudioEditor : public Ship::GuiWindow { public: - using LUS::GuiWindow::GuiWindow; + using GuiWindow::GuiWindow; void DrawElement() override; void InitElement() override; @@ -20,7 +21,9 @@ class AudioEditor : public LUS::GuiWindow { }; void AudioEditor_RandomizeAll(); +void AudioEditor_RandomizeGroup(SeqType group); void AudioEditor_ResetAll(); +void AudioEditor_ResetGroup(SeqType group); void AudioEditor_LockAll(); void AudioEditor_UnlockAll(); diff --git a/soh/soh/Enhancements/bootcommands.c b/soh/soh/Enhancements/bootcommands.c index 385a544a6..16ad651fc 100644 --- a/soh/soh/Enhancements/bootcommands.c +++ b/soh/soh/Enhancements/bootcommands.c @@ -9,6 +9,7 @@ #include #include #include +#include "soh/OTRGlobals.h" uint8_t gLoadFileSelect = 0, gSkipLogoTest = 0; @@ -21,15 +22,15 @@ static BootCommand sCommands[] = { { "--skiplogo", BootCommands_Command_SkipLogo void BootCommands_Init() { // Clears vars to prevent randomizer menu from being disabled - CVarClear("gRandoGenerating"); // Clear when a crash happened during rando seed generation - CVarClear("gNewSeedGenerated"); - CVarClear("gOnFileSelectNameEntry"); // Clear when soh is killed on the file name entry page - CVarClear("gBetterDebugWarpScreenMQMode"); - CVarClear("gBetterDebugWarpScreenMQModeScene"); - CVarClear("gCheatEasyPauseBufferLastInputs"); - CVarClear("gCheatEasyPauseBufferTimer"); + CVarClear(CVAR_GENERAL("RandoGenerating")); // Clear when a crash happened during rando seed generation + CVarClear(CVAR_GENERAL("NewSeedGenerated")); + CVarClear(CVAR_GENERAL("OnFileSelectNameEntry")); // Clear when soh is killed on the file name entry page + CVarClear(CVAR_GENERAL("BetterDebugWarpScreenMQMode")); + CVarClear(CVAR_GENERAL("BetterDebugWarpScreenMQModeScene")); + CVarClear(CVAR_GENERAL("CheatEasyPauseBufferLastInputs")); + CVarClear(CVAR_GENERAL("CheatEasyPauseBufferTimer")); #if defined(__SWITCH__) || defined(__WIIU__) - CVarRegisterInteger("gControlNav", 1); // always enable controller nav on switch/wii u + CVarRegisterInteger(CVAR_IMGUI_CONTROLLER_NAV, 1); // always enable controller nav on switch/wii u #endif } diff --git a/soh/soh/Enhancements/cheat_hook_handlers.cpp b/soh/soh/Enhancements/cheat_hook_handlers.cpp index c8565e8ab..a5a1a0d5a 100644 --- a/soh/soh/Enhancements/cheat_hook_handlers.cpp +++ b/soh/soh/Enhancements/cheat_hook_handlers.cpp @@ -15,13 +15,13 @@ extern PlayState* gPlayState; void CheatsOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* opt) { switch (id) { case VB_DEKU_STICK_BREAK: { - if (CVarGetInteger("gDekuStickCheat", DEKU_STICK_NORMAL) != DEKU_STICK_NORMAL) { + if (CVarGetInteger(CVAR_CHEAT("DekuStickCheat"), DEKU_STICK_NORMAL) != DEKU_STICK_NORMAL) { *should = false; } break; } case VB_DEKU_STICK_BE_ON_FIRE: { - if (CVarGetInteger("gDekuStickCheat", DEKU_STICK_NORMAL) == DEKU_STICK_UNBREAKABLE_AND_ALWAYS_ON_FIRE) { + if (CVarGetInteger(CVAR_CHEAT("DekuStickCheat"), DEKU_STICK_NORMAL) == DEKU_STICK_UNBREAKABLE_AND_ALWAYS_ON_FIRE) { Player* player = GET_PLAYER(gPlayState); player->unk_860 = 200; // Keeps the stick's flame lit player->unk_85C = 1.0f; // Ensures the stick is the proper length @@ -30,13 +30,13 @@ void CheatsOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* op break; } case VB_DEKU_STICK_BURN_OUT: { - if (CVarGetInteger("gDekuStickCheat", DEKU_STICK_NORMAL) != DEKU_STICK_NORMAL) { + if (CVarGetInteger(CVAR_CHEAT("DekuStickCheat"), DEKU_STICK_NORMAL) != DEKU_STICK_NORMAL) { *should = false; } break; } case VB_DEKU_STICK_BURN_DOWN: { - if (CVarGetInteger("gDekuStickCheat", DEKU_STICK_NORMAL) != DEKU_STICK_NORMAL) { + if (CVarGetInteger(CVAR_CHEAT("DekuStickCheat"), DEKU_STICK_NORMAL) != DEKU_STICK_NORMAL) { *should = false; } break; diff --git a/soh/soh/Enhancements/controls/InputViewer.cpp b/soh/soh/Enhancements/controls/InputViewer.cpp index 6b25589c6..93727b5fa 100644 --- a/soh/soh/Enhancements/controls/InputViewer.cpp +++ b/soh/soh/Enhancements/controls/InputViewer.cpp @@ -3,10 +3,11 @@ #include "public/bridge/consolevariablebridge.h" #include "libultraship/libultra/controller.h" #include "Context.h" +#include "soh/OTRGlobals.h" #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif -#include +#include #include #include @@ -46,77 +47,77 @@ void InputViewer::RenderButton(std::string btnTexture, std::string btnOutlineTex // Render Outline based on settings if (outlineMode == BUTTON_OUTLINE_ALWAYS_SHOWN || (outlineMode == BUTTON_OUTLINE_NOT_PRESSED && !state) || (outlineMode == BUTTON_OUTLINE_PRESSED && state)) { - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnOutlineTexture), size, + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnOutlineTexture), size, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); } // Render button if pressed if (state) { ImGui::SetCursorPos(pos); ImGui::SetNextItemAllowOverlap(); - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnTexture), size, + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnTexture), size, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); } } void InputViewer::DrawElement() { - if (CVarGetInteger("gOpenWindows.InputViewer", 0)) { + if (CVarGetInteger(CVAR_WINDOW("InputViewer"), 0)) { static bool sButtonTexturesLoaded = false; if (!sButtonTexturesLoaded) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage( + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage( "Input-Viewer-Background", "textures/buttons/InputViewerBackground.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn", "textures/buttons/ABtn.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn", "textures/buttons/BBtn.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn", "textures/buttons/LBtn.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn", "textures/buttons/RBtn.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn", "textures/buttons/ZBtn.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Start-Btn", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn", "textures/buttons/ABtn.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn", "textures/buttons/BBtn.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn", "textures/buttons/LBtn.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn", "textures/buttons/RBtn.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn", "textures/buttons/ZBtn.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Start-Btn", "textures/buttons/StartBtn.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left", "textures/buttons/CLeft.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right", "textures/buttons/CRight.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up", "textures/buttons/CUp.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down", "textures/buttons/CDown.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Analog-Stick", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left", "textures/buttons/CLeft.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right", "textures/buttons/CRight.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up", "textures/buttons/CUp.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down", "textures/buttons/CDown.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Analog-Stick", "textures/buttons/AnalogStick.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Left", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Left", "textures/buttons/DPadLeft.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Right", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Right", "textures/buttons/DPadRight.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up", "textures/buttons/DPadUp.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Down", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up", "textures/buttons/DPadUp.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Down", "textures/buttons/DPadDown.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Right-Stick", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Right-Stick", "textures/buttons/RightStick.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn Outline", "textures/buttons/ABtnOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn Outline", "textures/buttons/BBtnOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn Outline", "textures/buttons/LBtnOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn Outline", "textures/buttons/RBtnOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn Outline", "textures/buttons/ZBtnOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Start-Btn Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Start-Btn Outline", "textures/buttons/StartBtnOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left Outline", "textures/buttons/CLeftOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right Outline", "textures/buttons/CRightOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up Outline", "textures/buttons/CUpOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down Outline", "textures/buttons/CDownOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Analog-Stick Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Analog-Stick Outline", "textures/buttons/AnalogStickOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Left Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Left Outline", "textures/buttons/DPadLeftOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Right Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Right Outline", "textures/buttons/DPadRightOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up Outline", "textures/buttons/DPadUpOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Down Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Down Outline", "textures/buttons/DPadDownOutline.png"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Right-Stick Outline", + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Right-Stick Outline", "textures/buttons/RightStickOutline.png"); sButtonTexturesLoaded = true; } @@ -125,23 +126,23 @@ void InputViewer::DrawElement() { ImVec2 size = ImGui::GetContentRegionAvail(); #ifdef __WIIU__ - const float scale = CVarGetFloat("gInputViewer.Scale", 1.0f) * 2.0f; + const float scale = CVarGetFloat(CVAR_INPUT_VIEWER("Scale"), 1.0f) * 2.0f; #else - const float scale = CVarGetFloat("gInputViewer.Scale", 1.0f); + const float scale = CVarGetFloat(CVAR_INPUT_VIEWER("Scale"), 1.0f); #endif - const int showAnalogAngles = CVarGetInteger("gInputViewer.AnalogAngles.Enabled", 0); - const int buttonOutlineMode = CVarGetInteger("gInputViewer.ButtonOutlineMode", BUTTON_OUTLINE_NOT_PRESSED); + const int showAnalogAngles = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Enabled"), 0); + const int buttonOutlineMode = CVarGetInteger(CVAR_INPUT_VIEWER("ButtonOutlineMode"), BUTTON_OUTLINE_NOT_PRESSED); - ImVec2 bgSize = LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureSize("Input-Viewer-Background"); + ImVec2 bgSize = Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureSize("Input-Viewer-Background"); ImVec2 scaledBGSize = ImVec2(bgSize.x * scale, bgSize.y * scale); ImGui::SetNextWindowSize(ImVec2( scaledBGSize.x + 20, scaledBGSize.y + - (showAnalogAngles ? ImGui::CalcTextSize("X").y : 0) * scale * CVarGetFloat("gInputViewer.AnalogAngles.Scale", 1.0f) + 20)); + (showAnalogAngles ? ImGui::CalcTextSize("X").y : 0) * scale * CVarGetFloat(CVAR_INPUT_VIEWER("AnalogAngles.Scale"), 1.0f) + 20)); ImGui::SetNextWindowContentSize( ImVec2(scaledBGSize.x, scaledBGSize.y + (showAnalogAngles ? 15 : 0) * scale * - CVarGetFloat("gInputViewer.AnalogAngles.Scale", 1.0f))); + CVarGetFloat(CVAR_INPUT_VIEWER("AnalogAngles.Scale"), 1.0f))); ImGui::SetNextWindowPos( ImVec2(mainPos.x + size.x - scaledBGSize.x - 30, mainPos.y + size.y - scaledBGSize.y - 30), ImGuiCond_FirstUseEver); @@ -149,13 +150,13 @@ void InputViewer::DrawElement() { ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0)); ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f)); - OSContPad* pads = LUS::Context::GetInstance()->GetControlDeck()->GetPads(); + OSContPad* pads = Ship::Context::GetInstance()->GetControlDeck()->GetPads(); ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoFocusOnAppearing; - if (!CVarGetInteger("gInputViewer.EnableDragging", 1)) { + if (!CVarGetInteger(CVAR_INPUT_VIEWER("EnableDragging"), 1)) { windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove; } @@ -163,68 +164,68 @@ void InputViewer::DrawElement() { ImGui::SetCursorPos(ImVec2(10, 10)); const ImVec2 aPos = ImGui::GetCursorPos(); - if (CVarGetInteger("gInputViewer.ShowBackground", 1)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("ShowBackground"), 1)) { ImGui::SetNextItemAllowOverlap(); // Background ImGui::Image( - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Input-Viewer-Background"), + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Input-Viewer-Background"), scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); } // A/B - if (CVarGetInteger("gInputViewer.BBtn", 1)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("BBtn"), 1)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); RenderButton("B-Btn", "B-Btn Outline", pads[0].button & BTN_B, scaledBGSize, buttonOutlineMode); } - if (CVarGetInteger("gInputViewer.ABtn", 1)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("ABtn"), 1)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); RenderButton("A-Btn", "A-Btn Outline", pads[0].button & BTN_A, scaledBGSize, buttonOutlineMode); } // C buttons - if (CVarGetInteger("gInputViewer.CUp", 1)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("CUp"), 1)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); RenderButton("C-Up", "C-Up Outline", pads[0].button & BTN_CUP, scaledBGSize, buttonOutlineMode); } - if (CVarGetInteger("gInputViewer.CLeft", 1)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("CLeft"), 1)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); RenderButton("C-Left", "C-Left Outline", pads[0].button & BTN_CLEFT, scaledBGSize, buttonOutlineMode); } - if (CVarGetInteger("gInputViewer.CRight", 1)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("CRight"), 1)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); RenderButton("C-Right", "C-Right Outline", pads[0].button & BTN_CRIGHT, scaledBGSize, buttonOutlineMode); } - if (CVarGetInteger("gInputViewer.CDown", 1)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("CDown"), 1)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); RenderButton("C-Down", "C-Down Outline", pads[0].button & BTN_CDOWN, scaledBGSize, buttonOutlineMode); } // L/R/Z - if (CVarGetInteger("gInputViewer.LBtn", 1)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("LBtn"), 1)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); RenderButton("L-Btn", "L-Btn Outline", pads[0].button & BTN_L, scaledBGSize, buttonOutlineMode); } - if (CVarGetInteger("gInputViewer.RBtn", 1)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("RBtn"), 1)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); RenderButton("R-Btn", "R-Btn Outline", pads[0].button & BTN_R, scaledBGSize, buttonOutlineMode); } - if (CVarGetInteger("gInputViewer.ZBtn", 1)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("ZBtn"), 1)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); RenderButton("Z-Btn", "Z-Btn Outline", pads[0].button & BTN_Z, scaledBGSize, buttonOutlineMode); } // Start - if (CVarGetInteger("gInputViewer.StartBtn", 1)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("StartBtn"), 1)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); RenderButton("Start-Btn", "Start-Btn Outline", pads[0].button & BTN_START, scaledBGSize, @@ -232,7 +233,7 @@ void InputViewer::DrawElement() { } // Dpad - if (CVarGetInteger("gInputViewer.Dpad", 0)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("Dpad"), 0)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); RenderButton("Dpad-Left", "Dpad-Left Outline", pads[0].button & BTN_DLEFT, scaledBGSize, @@ -255,84 +256,84 @@ void InputViewer::DrawElement() { // Analog Stick const int analogOutlineMode = - CVarGetInteger("gInputViewer.AnalogStick.OutlineMode", STICK_MODE_ALWAYS_SHOWN); - const float maxStickDistance = CVarGetInteger("gInputViewer.AnalogStick.Movement", 12); + CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.OutlineMode"), STICK_MODE_ALWAYS_SHOWN); + const float maxStickDistance = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.Movement"), 12); if (analogOutlineMode == STICK_MODE_ALWAYS_SHOWN || (analogOutlineMode == STICK_MODE_HIDDEN_IN_DEADZONE && !analogStickIsInDeadzone)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); ImGui::Image( - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick Outline"), + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick Outline"), scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); } const int analogStickMode = - CVarGetInteger("gInputViewer.AnalogStick.VisibilityMode", STICK_MODE_ALWAYS_SHOWN); + CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.VisibilityMode"), STICK_MODE_ALWAYS_SHOWN); if (analogStickMode == STICK_MODE_ALWAYS_SHOWN || (analogStickMode == STICK_MODE_HIDDEN_IN_DEADZONE && !analogStickIsInDeadzone)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos( ImVec2(aPos.x + maxStickDistance * ((float)(pads[0].stick_x) / MAX_AXIS_RANGE) * scale, aPos.y - maxStickDistance * ((float)(pads[0].stick_y) / MAX_AXIS_RANGE) * scale)); - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick"), + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick"), scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); } // Right Stick - const float maxRightStickDistance = CVarGetInteger("gInputViewer.RightStick.Movement", 7); + const float maxRightStickDistance = CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.Movement"), 7); const int rightOutlineMode = - CVarGetInteger("gInputViewer.RightStick.OutlineMode", STICK_MODE_ALWAYS_HIDDEN); + CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.OutlineMode"), STICK_MODE_ALWAYS_HIDDEN); if (rightOutlineMode == STICK_MODE_ALWAYS_SHOWN || (rightOutlineMode == STICK_MODE_HIDDEN_IN_DEADZONE && !rightStickIsInDeadzone)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos(aPos); ImGui::Image( - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick Outline"), + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick Outline"), scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); } const int rightStickMode = - CVarGetInteger("gInputViewer.RightStick.VisibilityMode", STICK_MODE_ALWAYS_HIDDEN); + CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.VisibilityMode"), STICK_MODE_ALWAYS_HIDDEN); if (rightStickMode == STICK_MODE_ALWAYS_SHOWN || (rightStickMode == STICK_MODE_HIDDEN_IN_DEADZONE && !rightStickIsInDeadzone)) { ImGui::SetNextItemAllowOverlap(); ImGui::SetCursorPos( ImVec2(aPos.x + maxRightStickDistance * ((float)(pads[0].right_stick_x) / MAX_AXIS_RANGE) * scale, aPos.y - maxRightStickDistance * ((float)(pads[0].right_stick_y) / MAX_AXIS_RANGE) * scale)); - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick"), + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick"), scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); } // Analog stick angle text if (showAnalogAngles) { - ImGui::SetCursorPos(ImVec2(aPos.x + 10 + CVarGetInteger("gInputViewer.AnalogAngles.Offset", 0) * scale, + ImGui::SetCursorPos(ImVec2(aPos.x + 10 + CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Offset"), 0) * scale, scaledBGSize.y + aPos.y + 10)); // Scale font with input viewer scale float oldFontScale = ImGui::GetFont()->Scale; - ImGui::GetFont()->Scale *= scale * CVarGetFloat("gInputViewer.AnalogAngles.Scale", 1.0f); + ImGui::GetFont()->Scale *= scale * CVarGetFloat(CVAR_INPUT_VIEWER("AnalogAngles.Scale"), 1.0f); ImGui::PushFont(ImGui::GetFont()); // Calculate polar R coordinate from X and Y angles, squared to avoid sqrt const float rSquared = pads[0].stick_x * pads[0].stick_x + pads[0].stick_y * pads[0].stick_y; // ESS range - const int range1Min = CVarGetInteger("gInputViewer.AnalogAngles.Range1.Min", 8); - const int range1Max = CVarGetInteger("gInputViewer.AnalogAngles.Range1.Max", 27); + const int range1Min = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Min"), 8); + const int range1Max = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Max"), 27); // Walking speed range - const int range2Min = CVarGetInteger("gInputViewer.AnalogAngles.Range2.Min", 27); - const int range2Max = CVarGetInteger("gInputViewer.AnalogAngles.Range2.Max", 62); + const int range2Min = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Min"), 27); + const int range2Max = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Max"), 62); // Push color based on angle ranges - if (CVarGetInteger("gInputViewer.AnalogAngles.Range1.Enabled", 0) && + if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Enabled"), 0) && (rSquared >= (range1Min * range1Min)) && (rSquared < (range1Max * range1Max))) { ImGui::PushStyleColor( ImGuiCol_Text, - color2Vec(CVarGetColor("gInputViewer.AnalogAngles.Range1.Color", vec2Color(range1Color)))); - } else if (CVarGetInteger("gInputViewer.AnalogAngles.Range2.Enabled", 0) && + color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Color"), vec2Color(range1Color)))); + } else if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Enabled"), 0) && (rSquared >= (range2Min * range2Min)) && (rSquared < (range2Max * range2Max))) { ImGui::PushStyleColor( ImGuiCol_Text, - color2Vec(CVarGetColor("gInputViewer.AnalogAngles.Range2.Color", vec2Color(range2Color)))); + color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Color"), vec2Color(range2Color)))); } else { - ImGui::PushStyleColor(ImGuiCol_Text, color2Vec(CVarGetColor("gInputViewer.AnalogAngles.TextColor", + ImGui::PushStyleColor(ImGuiCol_Text, color2Vec(CVarGetColor(CVAR_INPUT_VIEWER("AnalogAngles.TextColor"), vec2Color(textColor)))); } @@ -363,60 +364,60 @@ void InputViewerSettingsWindow::DrawElement() { if (ImGui::Begin("Input Viewer Settings", &mIsVisible)) { // gInputViewer.Scale - UIWidgets::EnhancementSliderFloat("Input Viewer Scale: %.2f", "##Input", "gInputViewer.Scale", 0.1f, 5.0f, "", + UIWidgets::EnhancementSliderFloat("Input Viewer Scale: %.2f", "##Input", CVAR_INPUT_VIEWER("Scale"), 0.1f, 5.0f, "", 1.0f, false, true); UIWidgets::Tooltip("Sets the on screen size of the input viewer"); // gInputViewer.EnableDragging - UIWidgets::EnhancementCheckbox("Enable Dragging", "gInputViewer.EnableDragging", false, "", + UIWidgets::EnhancementCheckbox("Enable Dragging", CVAR_INPUT_VIEWER("EnableDragging"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::PaddedSeparator(true, true); // gInputViewer.ShowBackground - UIWidgets::EnhancementCheckbox("Show Background Layer", "gInputViewer.ShowBackground", false, "", + UIWidgets::EnhancementCheckbox("Show Background Layer", CVAR_INPUT_VIEWER("ShowBackground"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); UIWidgets::PaddedSeparator(true, true); if (ImGui::CollapsingHeader("Buttons")) { // gInputViewer.ABtn - UIWidgets::EnhancementCheckbox("Show A-Button Layers", "gInputViewer.ABtn", false, "", + UIWidgets::EnhancementCheckbox("Show A-Button Layers", CVAR_INPUT_VIEWER("ABtn"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); // gInputViewer.BBtn - UIWidgets::EnhancementCheckbox("Show B-Button Layers", "gInputViewer.BBtn", false, "", + UIWidgets::EnhancementCheckbox("Show B-Button Layers", CVAR_INPUT_VIEWER("BBtn"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); // gInputViewer.CUp - UIWidgets::EnhancementCheckbox("Show C-Up Layers", "gInputViewer.CUp", false, "", + UIWidgets::EnhancementCheckbox("Show C-Up Layers", CVAR_INPUT_VIEWER("CUp"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); // gInputViewer.CRight - UIWidgets::EnhancementCheckbox("Show C-Right Layers", "gInputViewer.CRight", false, "", + UIWidgets::EnhancementCheckbox("Show C-Right Layers", CVAR_INPUT_VIEWER("CRight"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); // gInputViewer.CDown - UIWidgets::EnhancementCheckbox("Show C-Down Layers", "gInputViewer.CDown", false, "", + UIWidgets::EnhancementCheckbox("Show C-Down Layers", CVAR_INPUT_VIEWER("CDown"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); // gInputViewer.CLeft - UIWidgets::EnhancementCheckbox("Show C-Left Layers", "gInputViewer.CLeft", false, "", + UIWidgets::EnhancementCheckbox("Show C-Left Layers", CVAR_INPUT_VIEWER("CLeft"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); // gInputViewer.LBtn - UIWidgets::EnhancementCheckbox("Show L-Button Layers", "gInputViewer.LBtn", false, "", + UIWidgets::EnhancementCheckbox("Show L-Button Layers", CVAR_INPUT_VIEWER("LBtn"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); // gInputViewer.RBtn - UIWidgets::EnhancementCheckbox("Show R-Button Layers", "gInputViewer.RBtn", false, "", + UIWidgets::EnhancementCheckbox("Show R-Button Layers", CVAR_INPUT_VIEWER("RBtn"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); // gInputViewer.ZBtn - UIWidgets::EnhancementCheckbox("Show Z-Button Layers", "gInputViewer.ZBtn", false, "", + UIWidgets::EnhancementCheckbox("Show Z-Button Layers", CVAR_INPUT_VIEWER("ZBtn"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); // gInputViewer.StartBtn - UIWidgets::EnhancementCheckbox("Show Start Button Layers", "gInputViewer.StartBtn", false, "", + UIWidgets::EnhancementCheckbox("Show Start Button Layers", CVAR_INPUT_VIEWER("StartBtn"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); // gInputViewer.Dpad - UIWidgets::EnhancementCheckbox("Show D-Pad Layers", "gInputViewer.Dpad", false, "", + UIWidgets::EnhancementCheckbox("Show D-Pad Layers", CVAR_INPUT_VIEWER("Dpad"), false, "", UIWidgets::CheckboxGraphics::Checkmark, false); // gInputViewer.ButtonOutlineMode UIWidgets::PaddedText("Button Outlines/Backgrounds", true, false); - UIWidgets::EnhancementCombobox("gInputViewer.ButtonOutlineMode", buttonOutlineOptions, + UIWidgets::EnhancementCombobox(CVAR_INPUT_VIEWER("ButtonOutlineMode"), buttonOutlineOptions, BUTTON_OUTLINE_NOT_PRESSED); UIWidgets::Tooltip( "Sets the desired visibility behavior for the button outline/background layers. Useful for " @@ -428,21 +429,21 @@ void InputViewerSettingsWindow::DrawElement() { if (ImGui::CollapsingHeader("Analog Stick")) { // gInputViewer.AnalogStick.VisibilityMode UIWidgets::PaddedText("Analog Stick Visibility", true, false); - UIWidgets::EnhancementCombobox("gInputViewer.AnalogStick.VisibilityMode", stickModeOptions, + UIWidgets::EnhancementCombobox(CVAR_INPUT_VIEWER("AnalogStick.VisibilityMode"), stickModeOptions, STICK_MODE_ALWAYS_SHOWN); UIWidgets::Tooltip( "Determines the conditions under which the moving layer of the analog stick texture is visible."); // gInputViewer.AnalogStick.OutlineMode UIWidgets::PaddedText("Analog Stick Outline/Background Visibility", true, false); - UIWidgets::EnhancementCombobox("gInputViewer.AnalogStick.OutlineMode", stickModeOptions, + UIWidgets::EnhancementCombobox(CVAR_INPUT_VIEWER("AnalogStick.OutlineMode"), stickModeOptions, STICK_MODE_ALWAYS_SHOWN); UIWidgets::Tooltip( "Determines the conditions under which the analog stick outline/background texture is visible."); // gInputViewer.AnalogStick.Movement UIWidgets::EnhancementSliderInt("Analog Stick Movement: %dpx", "##AnalogMovement", - "gInputViewer.AnalogStick.Movement", 0, 200, "", 12, true); + CVAR_INPUT_VIEWER("AnalogStick.Movement"), 0, 200, "", 12, true); UIWidgets::Tooltip( "Sets the distance to move the analog stick in the input viewer. Useful for custom input viewers."); UIWidgets::PaddedSeparator(true, true); @@ -451,21 +452,21 @@ void InputViewerSettingsWindow::DrawElement() { if (ImGui::CollapsingHeader("Additional (\"Right\") Stick")) { // gInputViewer.RightStick.VisibilityMode UIWidgets::PaddedText("Right Stick Visibility", true, false); - UIWidgets::EnhancementCombobox("gInputViewer.RightStick.VisibilityMode", stickModeOptions, + UIWidgets::EnhancementCombobox(CVAR_INPUT_VIEWER("RightStick.VisibilityMode"), stickModeOptions, STICK_MODE_HIDDEN_IN_DEADZONE); UIWidgets::Tooltip( "Determines the conditions under which the moving layer of the right stick texture is visible."); // gInputViewer.RightStick.OutlineMode UIWidgets::PaddedText("Right Stick Outline/Background Visibility", true, false); - UIWidgets::EnhancementCombobox("gInputViewer.RightStick.OutlineMode", stickModeOptions, + UIWidgets::EnhancementCombobox(CVAR_INPUT_VIEWER("RightStick.OutlineMode"), stickModeOptions, STICK_MODE_HIDDEN_IN_DEADZONE); UIWidgets::Tooltip( "Determines the conditions under which the right stick outline/background texture is visible."); // gInputViewer.RightStick.Movement UIWidgets::EnhancementSliderInt("Right Stick Movement: %dpx", "##RightMovement", - "gInputViewer.RightStick.Movement", 0, 200, "", 7, true); + CVAR_INPUT_VIEWER("RightStick.Movement"), 0, 200, "", 7, true); UIWidgets::Tooltip( "Sets the distance to move the right stick in the input viewer. Useful for custom input viewers."); UIWidgets::PaddedSeparator(true, true); @@ -473,42 +474,42 @@ void InputViewerSettingsWindow::DrawElement() { if (ImGui::CollapsingHeader("Analog Angle Values")) { // gAnalogAngles - UIWidgets::EnhancementCheckbox("Show Analog Stick Angle Values", "gInputViewer.AnalogAngles.Enabled"); + UIWidgets::EnhancementCheckbox("Show Analog Stick Angle Values", CVAR_INPUT_VIEWER("AnalogAngles.Enabled")); UIWidgets::Tooltip("Displays analog stick angle values in the input viewer"); - if (CVarGetInteger("gInputViewer.AnalogAngles.Enabled", 0)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Enabled"), 0)) { // gInputViewer.AnalogAngles.TextColor if (ImGui::ColorEdit4("Text Color", (float*)&textColor)) { - CVarSetColor("gInputViewer.AnalogAngles.TextColor", vec2Color(textColor)); + CVarSetColor(CVAR_INPUT_VIEWER("AnalogAngles.TextColor"), vec2Color(textColor)); } // gAnalogAngleScale UIWidgets::EnhancementSliderFloat("Angle Text Scale: %.2f%%", "##AnalogAngleScale", - "gInputViewer.AnalogAngles.Scale", 0.1f, 5.0f, "", 1.0f, true, true); + CVAR_INPUT_VIEWER("AnalogAngles.Scale"), 0.1f, 5.0f, "", 1.0f, true, true); // gInputViewer.AnalogAngles.Offset UIWidgets::EnhancementSliderInt("Angle Text Offset: %dpx", "##AnalogAngleOffset", - "gInputViewer.AnalogAngles.Offset", 0, 400, "", 0, true); + CVAR_INPUT_VIEWER("AnalogAngles.Offset"), 0, 400, "", 0, true); UIWidgets::PaddedSeparator(true, true); // gInputViewer.AnalogAngles.Range1.Enabled - UIWidgets::EnhancementCheckbox("Highlight ESS Position", "gInputViewer.AnalogAngles.Range1.Enabled"); + UIWidgets::EnhancementCheckbox("Highlight ESS Position", CVAR_INPUT_VIEWER("AnalogAngles.Range1.Enabled")); UIWidgets::Tooltip( "Highlights the angle value text when the analog stick is in ESS position (on flat ground)"); - if (CVarGetInteger("gInputViewer.AnalogAngles.Range1.Enabled", 0)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Enabled"), 0)) { // gInputViewer.AnalogAngles.Range1.Color if (ImGui::ColorEdit4("ESS Color", (float*)&range1Color)) { - CVarSetColor("gInputViewer.AnalogAngles.Range1.Color", vec2Color(range1Color)); + CVarSetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Color"), vec2Color(range1Color)); } } UIWidgets::PaddedSeparator(true, true); // gInputViewer.AnalogAngles.Range2.Enabled UIWidgets::EnhancementCheckbox("Highlight Walking Speed Angles", - "gInputViewer.AnalogAngles.Range2.Enabled"); + CVAR_INPUT_VIEWER("AnalogAngles.Range2.Enabled")); UIWidgets::Tooltip("Highlights the angle value text when the analog stick is at an angle that would " "produce a walking speed (on flat ground)\n\n" "Useful for 1.0 Empty Jumpslash Quick Put Away"); - if (CVarGetInteger("gInputViewer.AnalogAngles.Range2.Enabled", 0)) { + if (CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Enabled"), 0)) { // gInputViewer.AnalogAngles.Range2.Color if (ImGui::ColorEdit4("Walking Speed Color", (float*)&range2Color)) { - CVarSetColor("gInputViewer.AnalogAngles.Range2.Color", vec2Color(range2Color)); + CVarSetColor(CVAR_INPUT_VIEWER("AnalogAngles.Range2.Color"), vec2Color(range2Color)); } } } diff --git a/soh/soh/Enhancements/controls/InputViewer.h b/soh/soh/Enhancements/controls/InputViewer.h index 6f2e2c587..3e1e9c987 100644 --- a/soh/soh/Enhancements/controls/InputViewer.h +++ b/soh/soh/Enhancements/controls/InputViewer.h @@ -2,6 +2,8 @@ #include +#define CVAR_INPUT_VIEWER(var) "gInputViewer." var + typedef enum { BUTTON_OUTLINE_ALWAYS_SHOWN, BUTTON_OUTLINE_NOT_PRESSED, @@ -15,9 +17,9 @@ typedef enum { STICK_MODE_ALWAYS_HIDDEN, } StickMode; -class InputViewer : public LUS::GuiWindow { +class InputViewer : public Ship::GuiWindow { public: - using LUS::GuiWindow::GuiWindow; + using GuiWindow::GuiWindow; void InitElement() override {}; void DrawElement() override; @@ -32,9 +34,9 @@ public: void RenderButton(std::string btn, std::string btnOutline, int state, ImVec2 size, int outlineMode); }; -class InputViewerSettingsWindow : public LUS::GuiWindow { +class InputViewerSettingsWindow : public Ship::GuiWindow { public: - using LUS::GuiWindow::GuiWindow; + using GuiWindow::GuiWindow; void InitElement() override {}; void DrawElement() override; diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp index a1290c238..667d96c18 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp @@ -1,5 +1,5 @@ #include "SohInputEditorWindow.h" -#include +#include #include "soh/OTRGlobals.h" #include "../../UIWidgets.hpp" #include "z64.h" @@ -57,7 +57,7 @@ void SohInputEditorWindow::UpdateElement() { } if (mInputEditorPopupOpen && ImGui::IsPopupOpen("", ImGuiPopupFlags_AnyPopupId)) { - LUS::Context::GetInstance()->GetControlDeck()->BlockGameInput(INPUT_EDITOR_WINDOW_GAME_INPUT_BLOCK_ID); + Ship::Context::GetInstance()->GetControlDeck()->BlockGameInput(INPUT_EDITOR_WINDOW_GAME_INPUT_BLOCK_ID); // continue to block input for a third of a second after getting the mapping mGameInputBlockTimer = ImGui::GetIO().Framerate / 3; @@ -69,24 +69,24 @@ void SohInputEditorWindow::UpdateElement() { } } - LUS::Context::GetInstance()->GetWindow()->GetGui()->BlockImGuiGamepadNavigation(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->BlockImGuiGamepadNavigation(); } else { if (mGameInputBlockTimer != INT32_MAX) { mGameInputBlockTimer--; if (mGameInputBlockTimer <= 0) { - LUS::Context::GetInstance()->GetControlDeck()->UnblockGameInput( + Ship::Context::GetInstance()->GetControlDeck()->UnblockGameInput( INPUT_EDITOR_WINDOW_GAME_INPUT_BLOCK_ID); mGameInputBlockTimer = INT32_MAX; } } - if (LUS::Context::GetInstance()->GetWindow()->GetGui()->ImGuiGamepadNavigationEnabled()) { + if (Ship::Context::GetInstance()->GetWindow()->GetGui()->ImGuiGamepadNavigationEnabled()) { mMappingInputBlockTimer = ImGui::GetIO().Framerate / 3; } else { mMappingInputBlockTimer = INT32_MAX; } - LUS::Context::GetInstance()->GetWindow()->GetGui()->UnblockImGuiGamepadNavigation(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->UnblockImGuiGamepadNavigation(); } } @@ -176,26 +176,26 @@ void SohInputEditorWindow::DrawAnalogPreview(const char* label, ImVec2 stick, fl #define BUTTON_COLOR_GAMEPAD_PURPLE ImVec4(0.431f, 0.369f, 0.706f, 0.5f) #define BUTTON_COLOR_GAMEPAD_PURPLE_HOVERED ImVec4(0.431f, 0.369f, 0.706f, 1.0f) -void SohInputEditorWindow::GetButtonColorsForLUSDeviceIndex(LUS::LUSDeviceIndex lusIndex, ImVec4& buttonColor, +void SohInputEditorWindow::GetButtonColorsForLUSDeviceIndex(Ship::ShipDeviceIndex lusIndex, ImVec4& buttonColor, ImVec4& buttonHoveredColor) { switch (lusIndex) { - case LUS::LUSDeviceIndex::Keyboard: + case Ship::ShipDeviceIndex::Keyboard: buttonColor = BUTTON_COLOR_KEYBOARD_BEIGE; buttonHoveredColor = BUTTON_COLOR_KEYBOARD_BEIGE_HOVERED; break; - case LUS::LUSDeviceIndex::Blue: + case Ship::ShipDeviceIndex::Blue: buttonColor = BUTTON_COLOR_GAMEPAD_BLUE; buttonHoveredColor = BUTTON_COLOR_GAMEPAD_BLUE_HOVERED; break; - case LUS::LUSDeviceIndex::Red: + case Ship::ShipDeviceIndex::Red: buttonColor = BUTTON_COLOR_GAMEPAD_RED; buttonHoveredColor = BUTTON_COLOR_GAMEPAD_RED_HOVERED; break; - case LUS::LUSDeviceIndex::Orange: + case Ship::ShipDeviceIndex::Orange: buttonColor = BUTTON_COLOR_GAMEPAD_ORANGE; buttonHoveredColor = BUTTON_COLOR_GAMEPAD_ORANGE_HOVERED; break; - case LUS::LUSDeviceIndex::Green: + case Ship::ShipDeviceIndex::Green: buttonColor = BUTTON_COLOR_GAMEPAD_GREEN; buttonHoveredColor = BUTTON_COLOR_GAMEPAD_GREEN_HOVERED; break; @@ -230,7 +230,7 @@ void SohInputEditorWindow::DrawButtonLineAddMappingButton(uint8_t port, uint16_t ImGui::CloseCurrentPopup(); } // todo: figure out why optional params (using id = "" in the definition) wasn't working - if (mMappingInputBlockTimer == INT32_MAX && LUS::Context::GetInstance() + if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetButton(bitmask) @@ -243,7 +243,7 @@ void SohInputEditorWindow::DrawButtonLineAddMappingButton(uint8_t port, uint16_t } void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, uint16_t bitmask, std::string id) { - auto mapping = LUS::Context::GetInstance() + auto mapping = Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetButton(bitmask) @@ -269,7 +269,7 @@ void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, uint16_ auto buttonHoveredColor = ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered); auto physicalInputDisplayName = StringHelper::Sprintf("%s %s", icon.c_str(), mapping->GetPhysicalInputName().c_str()); - GetButtonColorsForLUSDeviceIndex(mapping->GetLUSDeviceIndex(), buttonColor, buttonHoveredColor); + GetButtonColorsForLUSDeviceIndex(mapping->GetShipDeviceIndex(), buttonColor, buttonHoveredColor); ImGui::PushStyleColor(ImGuiCol_Button, buttonColor); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, buttonHoveredColor); auto popupId = StringHelper::Sprintf("editButtonMappingPopup##%s", id.c_str()); @@ -292,7 +292,7 @@ void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, uint16_ mInputEditorPopupOpen = false; ImGui::CloseCurrentPopup(); } - if (mMappingInputBlockTimer == INT32_MAX && LUS::Context::GetInstance() + if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetButton(bitmask) @@ -307,18 +307,18 @@ void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, uint16_ ImGui::SameLine(0, 0); #ifndef __WIIU__ - auto sdlAxisDirectionToButtonMapping = std::dynamic_pointer_cast(mapping); - auto indexMapping = LUS::Context::GetInstance() + auto sdlAxisDirectionToButtonMapping = std::dynamic_pointer_cast(mapping); + auto indexMapping = Ship::Context::GetInstance() ->GetControlDeck() ->GetDeviceIndexMappingManager() - ->GetDeviceIndexMappingFromLUSDeviceIndex(mapping->GetLUSDeviceIndex()); - auto sdlIndexMapping = std::dynamic_pointer_cast(indexMapping); + ->GetDeviceIndexMappingFromShipDeviceIndex(mapping->GetShipDeviceIndex()); + auto sdlIndexMapping = std::dynamic_pointer_cast(indexMapping); if (sdlIndexMapping != nullptr && sdlAxisDirectionToButtonMapping != nullptr) { ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.5f)); auto buttonColor = ImGui::GetStyleColorVec4(ImGuiCol_Button); auto buttonHoveredColor = ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered); - GetButtonColorsForLUSDeviceIndex(mapping->GetLUSDeviceIndex(), buttonColor, buttonHoveredColor); + GetButtonColorsForLUSDeviceIndex(mapping->GetShipDeviceIndex(), buttonColor, buttonHoveredColor); ImGui::PushStyleColor(ImGuiCol_Button, buttonColor); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, buttonHoveredColor); ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(1.0f, 0.5f)); @@ -433,7 +433,7 @@ void SohInputEditorWindow::DrawButtonLineEditMappingButton(uint8_t port, uint16_ ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(1.0f, 0.5f)); if (ImGui::Button(StringHelper::Sprintf("%s###removeButtonMappingButton%s", ICON_FA_TIMES, id.c_str()).c_str(), ImVec2(ImGui::CalcTextSize(ICON_FA_TIMES).x + SCALE_IMGUI_SIZE(10.0f), 0.0f))) { - LUS::Context::GetInstance() + Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetButton(bitmask) @@ -459,7 +459,7 @@ void SohInputEditorWindow::DrawButtonLine(const char* buttonName, uint8_t port, } void SohInputEditorWindow::DrawStickDirectionLineAddMappingButton(uint8_t port, uint8_t stick, - LUS::Direction direction) { + Ship::Direction direction) { ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(1.0f, 0.5f)); auto popupId = StringHelper::Sprintf("addStickDirectionMappingPopup##%d-%d-%d", port, stick, direction); if (ImGui::Button( @@ -477,9 +477,9 @@ void SohInputEditorWindow::DrawStickDirectionLineAddMappingButton(uint8_t port, mInputEditorPopupOpen = false; ImGui::CloseCurrentPopup(); } - if (stick == LUS::LEFT) { + if (stick == Ship::LEFT) { if (mMappingInputBlockTimer == INT32_MAX && - LUS::Context::GetInstance() + Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetLeftStick() @@ -489,7 +489,7 @@ void SohInputEditorWindow::DrawStickDirectionLineAddMappingButton(uint8_t port, } } else { if (mMappingInputBlockTimer == INT32_MAX && - LUS::Context::GetInstance() + Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetRightStick() @@ -502,16 +502,16 @@ void SohInputEditorWindow::DrawStickDirectionLineAddMappingButton(uint8_t port, } void SohInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port, uint8_t stick, - LUS::Direction direction, std::string id) { - std::shared_ptr mapping = nullptr; - if (stick == LUS::LEFT) { - mapping = LUS::Context::GetInstance() + Ship::Direction direction, std::string id) { + std::shared_ptr mapping = nullptr; + if (stick == Ship::LEFT) { + mapping = Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetLeftStick() ->GetAxisDirectionMappingById(direction, id); } else { - mapping = LUS::Context::GetInstance() + mapping = Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetRightStick() @@ -539,7 +539,7 @@ void SohInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port, auto buttonHoveredColor = ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered); auto physicalInputDisplayName = StringHelper::Sprintf("%s %s", icon.c_str(), mapping->GetPhysicalInputName().c_str()); - GetButtonColorsForLUSDeviceIndex(mapping->GetLUSDeviceIndex(), buttonColor, buttonHoveredColor); + GetButtonColorsForLUSDeviceIndex(mapping->GetShipDeviceIndex(), buttonColor, buttonHoveredColor); ImGui::PushStyleColor(ImGuiCol_Button, buttonColor); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, buttonHoveredColor); auto popupId = StringHelper::Sprintf("editStickDirectionMappingPopup##%s", id.c_str()); @@ -564,9 +564,9 @@ void SohInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port, ImGui::CloseCurrentPopup(); } - if (stick == LUS::LEFT) { + if (stick == Ship::LEFT) { if (mMappingInputBlockTimer == INT32_MAX && - LUS::Context::GetInstance() + Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetLeftStick() @@ -576,7 +576,7 @@ void SohInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port, } } else { if (mMappingInputBlockTimer == INT32_MAX && - LUS::Context::GetInstance() + Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetRightStick() @@ -595,14 +595,14 @@ void SohInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port, if (ImGui::Button( StringHelper::Sprintf("%s###removeStickDirectionMappingButton%s", ICON_FA_TIMES, id.c_str()).c_str(), ImVec2(ImGui::CalcTextSize(ICON_FA_TIMES).x + SCALE_IMGUI_SIZE(10.0f), 0.0f))) { - if (stick == LUS::LEFT) { - LUS::Context::GetInstance() + if (stick == Ship::LEFT) { + Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetLeftStick() ->ClearAxisDirectionMapping(direction, id); } else { - LUS::Context::GetInstance() + Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetRightStick() @@ -616,7 +616,7 @@ void SohInputEditorWindow::DrawStickDirectionLineEditMappingButton(uint8_t port, } void SohInputEditorWindow::DrawStickDirectionLine(const char* axisDirectionName, uint8_t port, uint8_t stick, - LUS::Direction direction, ImVec4 color = CHIP_COLOR_N64_GREY) { + Ship::Direction direction, ImVec4 color = CHIP_COLOR_N64_GREY) { ImGui::NewLine(); ImGui::SameLine(); ImGui::BeginDisabled(); @@ -634,21 +634,21 @@ void SohInputEditorWindow::DrawStickDirectionLine(const char* axisDirectionName, void SohInputEditorWindow::DrawStickSection(uint8_t port, uint8_t stick, int32_t id, ImVec4 color = CHIP_COLOR_N64_GREY) { static int8_t sX, sY; - std::shared_ptr controllerStick = nullptr; - if (stick == LUS::LEFT) { - controllerStick = LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLeftStick(); + std::shared_ptr controllerStick = nullptr; + if (stick == Ship::LEFT) { + controllerStick = Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLeftStick(); } else { - controllerStick = LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetRightStick(); + controllerStick = Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetRightStick(); } controllerStick->Process(sX, sY); DrawAnalogPreview(StringHelper::Sprintf("##AnalogPreview%d", id).c_str(), ImVec2(sX, sY)); ImGui::SameLine(); ImGui::BeginGroup(); - DrawStickDirectionLine(ICON_FA_ARROW_UP, port, stick, LUS::UP, color); - DrawStickDirectionLine(ICON_FA_ARROW_DOWN, port, stick, LUS::DOWN, color); - DrawStickDirectionLine(ICON_FA_ARROW_LEFT, port, stick, LUS::LEFT, color); - DrawStickDirectionLine(ICON_FA_ARROW_RIGHT, port, stick, LUS::RIGHT, color); + DrawStickDirectionLine(ICON_FA_ARROW_UP, port, stick, Ship::UP, color); + DrawStickDirectionLine(ICON_FA_ARROW_DOWN, port, stick, Ship::DOWN, color); + DrawStickDirectionLine(ICON_FA_ARROW_LEFT, port, stick, Ship::LEFT, color); + DrawStickDirectionLine(ICON_FA_ARROW_RIGHT, port, stick, Ship::RIGHT, color); ImGui::EndGroup(); ImGui::SetNextItemOpen(true, ImGuiCond_Once); if (ImGui::TreeNode(StringHelper::Sprintf("Analog Stick Options##%d", id).c_str())) { @@ -776,7 +776,7 @@ void SohInputEditorWindow::UpdateBitmaskToMappingIds(uint8_t port) { // todo: do we need this now that ControllerButton exists? for (auto [bitmask, button] : - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetAllButtons()) { + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetAllButtons()) { for (auto [id, mapping] : button->GetAllButtonMappings()) { // using a vector here instead of a set because i want newly added mappings // to go to the end of the list instead of autosorting @@ -791,12 +791,12 @@ void SohInputEditorWindow::UpdateBitmaskToMappingIds(uint8_t port) { void SohInputEditorWindow::UpdateStickDirectionToMappingIds(uint8_t port) { // todo: do we need this? for (auto stick : - { std::make_pair>( - LUS::LEFT, LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLeftStick()), - std::make_pair>( - LUS::RIGHT, - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetRightStick()) }) { - for (auto direction : { LUS::LEFT, LUS::RIGHT, LUS::UP, LUS::DOWN }) { + { std::make_pair>( + Ship::LEFT, Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLeftStick()), + std::make_pair>( + Ship::RIGHT, + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetRightStick()) }) { + for (auto direction : { Ship::LEFT, Ship::RIGHT, Ship::UP, Ship::DOWN }) { for (auto [id, mapping] : stick.second->GetAllAxisDirectionMappingByDirection(direction)) { // using a vector here instead of a set because i want newly added mappings // to go to the end of the list instead of autosorting @@ -815,7 +815,7 @@ void SohInputEditorWindow::DrawRemoveRumbleMappingButton(uint8_t port, std::stri ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(1.0f, 0.5f)); if (ImGui::Button(StringHelper::Sprintf("%s###removeRumbleMapping%s", ICON_FA_TIMES, id.c_str()).c_str(), ImVec2(SCALE_IMGUI_SIZE(20.0f), SCALE_IMGUI_SIZE(20.0f)))) { - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetRumble()->ClearRumbleMapping(id); + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetRumble()->ClearRumbleMapping(id); } ImGui::PopStyleVar(); } @@ -838,7 +838,7 @@ void SohInputEditorWindow::DrawAddRumbleMappingButton(uint8_t port) { ImGui::CloseCurrentPopup(); } - if (mMappingInputBlockTimer == INT32_MAX && LUS::Context::GetInstance() + if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetRumble() @@ -855,7 +855,7 @@ bool SohInputEditorWindow::TestingRumble() { } void SohInputEditorWindow::DrawRumbleSection(uint8_t port) { - for (auto [id, mapping] : LUS::Context::GetInstance() + for (auto [id, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetRumble() @@ -864,7 +864,7 @@ void SohInputEditorWindow::DrawRumbleSection(uint8_t port) { ImGui::SetNextItemOpen(true, ImGuiCond_Once); auto buttonColor = ImGui::GetStyleColorVec4(ImGuiCol_Button); auto buttonHoveredColor = ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered); - GetButtonColorsForLUSDeviceIndex(mapping->GetLUSDeviceIndex(), buttonColor, buttonHoveredColor); + GetButtonColorsForLUSDeviceIndex(mapping->GetShipDeviceIndex(), buttonColor, buttonHoveredColor); // begin hackaround https://github.com/ocornut/imgui/issues/282#issuecomment-123763192 // spaces to have background color for text in a tree node std::string spaces = ""; @@ -998,7 +998,7 @@ void SohInputEditorWindow::DrawRemoveLEDMappingButton(uint8_t port, std::string ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(1.0f, 0.5f)); if (ImGui::Button(StringHelper::Sprintf("%s###removeLEDMapping%s", ICON_FA_TIMES, id.c_str()).c_str(), ImVec2(SCALE_IMGUI_SIZE(20.0f), SCALE_IMGUI_SIZE(20.0f)))) { - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLED()->ClearLEDMapping(id); + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLED()->ClearLEDMapping(id); } ImGui::PopStyleVar(); } @@ -1021,7 +1021,7 @@ void SohInputEditorWindow::DrawAddLEDMappingButton(uint8_t port) { ImGui::CloseCurrentPopup(); } - if (mMappingInputBlockTimer == INT32_MAX && LUS::Context::GetInstance() + if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetLED() @@ -1035,7 +1035,7 @@ void SohInputEditorWindow::DrawAddLEDMappingButton(uint8_t port) { void SohInputEditorWindow::DrawLEDSection(uint8_t port) { for (auto [id, mapping] : - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLED()->GetAllLEDMappings()) { + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetLED()->GetAllLEDMappings()) { ImGui::AlignTextToFramePadding(); ImGui::SetNextItemOpen(true, ImGuiCond_Once); auto open = ImGui::TreeNode( @@ -1070,15 +1070,15 @@ void SohInputEditorWindow::DrawLEDSection(uint8_t port) { "Original Navi Targeting Colors", "Cosmetics Navi Targeting Colors", "Custom" }; UIWidgets::PaddedText("Source"); - UIWidgets::EnhancementCombobox("gLedColorSource", ledSources, LED_SOURCE_TUNIC_ORIGINAL); + UIWidgets::EnhancementCombobox(CVAR_SETTING("LEDColorSource"), ledSources, LED_SOURCE_TUNIC_ORIGINAL); UIWidgets::Tooltip("Health\n- Red when health critical (13-20% depending on max health)\n- Yellow when " "health < 40%. Green otherwise.\n\n" "Tunics: colors will mirror currently equipped tunic, whether original or the current " "values in Cosmetics Editor.\n\n" "Custom: single, solid color"); - if (CVarGetInteger("gLedColorSource", 1) == LED_SOURCE_CUSTOM) { + if (CVarGetInteger(CVAR_SETTING("LEDColorSource"), 1) == LED_SOURCE_CUSTOM) { UIWidgets::Spacer(3); - auto port1Color = CVarGetColor24("gLedPort1Color", { 255, 255, 255 }); + auto port1Color = CVarGetColor24(CVAR_SETTING("LEDPort1Color"), { 255, 255, 255 }); ImVec4 colorVec = { port1Color.r / 255.0f, port1Color.g / 255.0f, port1Color.b / 255.0f, 1.0f }; if (ImGui::ColorEdit3("", (float*)&colorVec, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel)) { @@ -1087,18 +1087,18 @@ void SohInputEditorWindow::DrawLEDSection(uint8_t port) { color.g = colorVec.y * 255.0; color.b = colorVec.z * 255.0; - CVarSetColor24("gLedPort1Color", color); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetColor24(CVAR_SETTING("LEDPort1Color"), color); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); ImGui::Text("Custom Color"); } - UIWidgets::PaddedEnhancementSliderFloat("Brightness: %.1f %%", "##LED_Brightness", "gLedBrightness", 0.0f, + UIWidgets::PaddedEnhancementSliderFloat("Brightness: %.1f %%", "##LED_Brightness", CVAR_SETTING("LEDBrightness"), 0.0f, 1.0f, "", 1.0f, true, true); UIWidgets::Tooltip("Sets the brightness of controller LEDs. 0% brightness = LEDs off."); UIWidgets::PaddedEnhancementCheckbox( - "Critical Health Override", "gLedCriticalOverride", true, true, - CVarGetInteger("gLedColorSource", LED_SOURCE_TUNIC_ORIGINAL) == LED_SOURCE_HEALTH, + "Critical Health Override", CVAR_SETTING("LEDCriticalOverride"), true, true, + CVarGetInteger(CVAR_SETTING("LEDColorSource"), LED_SOURCE_TUNIC_ORIGINAL) == LED_SOURCE_HEALTH, "Override redundant for health source.", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip("Shows red color when health is critical, otherwise displays according to color source."); } @@ -1116,7 +1116,7 @@ void SohInputEditorWindow::DrawRemoveGyroMappingButton(uint8_t port, std::string ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(1.0f, 0.5f)); if (ImGui::Button(StringHelper::Sprintf("%s###removeGyroMapping%s", ICON_FA_TIMES, id.c_str()).c_str(), ImVec2(SCALE_IMGUI_SIZE(20.0f), SCALE_IMGUI_SIZE(20.0f)))) { - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetGyro()->ClearGyroMapping(); + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetGyro()->ClearGyroMapping(); } ImGui::PopStyleVar(); } @@ -1139,7 +1139,7 @@ void SohInputEditorWindow::DrawAddGyroMappingButton(uint8_t port) { ImGui::CloseCurrentPopup(); } - if (mMappingInputBlockTimer == INT32_MAX && LUS::Context::GetInstance() + if (mMappingInputBlockTimer == INT32_MAX && Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(port) ->GetGyro() @@ -1153,7 +1153,7 @@ void SohInputEditorWindow::DrawAddGyroMappingButton(uint8_t port) { void SohInputEditorWindow::DrawGyroSection(uint8_t port) { auto mapping = - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetGyro()->GetGyroMapping(); + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(port)->GetGyro()->GetGyroMapping(); if (mapping != nullptr) { auto id = mapping->GetGyroMappingId(); ImGui::AlignTextToFramePadding(); @@ -1236,28 +1236,28 @@ void SohInputEditorWindow::DrawGyroSection(uint8_t port) { } void SohInputEditorWindow::DrawButtonDeviceIcons(uint8_t portIndex, std::set bitmasks) { - std::set allLusDeviceIndices; - allLusDeviceIndices.insert(LUS::LUSDeviceIndex::Keyboard); - for (auto [lusIndex, mapping] : LUS::Context::GetInstance() + std::set allLusDeviceIndices; + allLusDeviceIndices.insert(Ship::ShipDeviceIndex::Keyboard); + for (auto [lusIndex, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetDeviceIndexMappingManager() ->GetAllDeviceIndexMappingsFromConfig()) { allLusDeviceIndices.insert(lusIndex); } - std::vector> lusDeviceIndiciesWithMappings; + std::vector> lusDeviceIndiciesWithMappings; for (auto lusIndex : allLusDeviceIndices) { for (auto [bitmask, button] : - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetAllButtons()) { + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetAllButtons()) { if (!bitmasks.contains(bitmask)) { continue; } - if (button->HasMappingsForLUSDeviceIndex(lusIndex)) { + if (button->HasMappingsForShipDeviceIndex(lusIndex)) { for (auto [id, mapping] : button->GetAllButtonMappings()) { - if (mapping->GetLUSDeviceIndex() == lusIndex) { + if (mapping->GetShipDeviceIndex() == lusIndex) { lusDeviceIndiciesWithMappings.push_back( - std::pair(lusIndex, mapping->PhysicalDeviceIsConnected())); + std::pair(lusIndex, mapping->PhysicalDeviceIsConnected())); break; } } @@ -1273,7 +1273,7 @@ void SohInputEditorWindow::DrawButtonDeviceIcons(uint8_t portIndex, std::set allLusDeviceIndices; - allLusDeviceIndices.insert(LUS::LUSDeviceIndex::Keyboard); - for (auto [lusIndex, mapping] : LUS::Context::GetInstance() +void SohInputEditorWindow::DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::Stick stick) { + std::set allLusDeviceIndices; + allLusDeviceIndices.insert(Ship::ShipDeviceIndex::Keyboard); + for (auto [lusIndex, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetDeviceIndexMappingManager() ->GetAllDeviceIndexMappingsFromConfig()) { allLusDeviceIndices.insert(lusIndex); } - std::vector> lusDeviceIndiciesWithMappings; + std::vector> lusDeviceIndiciesWithMappings; for (auto lusIndex : allLusDeviceIndices) { auto controllerStick = - stick == LUS::Stick::LEFT_STICK - ? LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetLeftStick() - : LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetRightStick(); - if (controllerStick->HasMappingsForLUSDeviceIndex(lusIndex)) { + stick == Ship::Stick::LEFT_STICK + ? Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetLeftStick() + : Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetRightStick(); + if (controllerStick->HasMappingsForShipDeviceIndex(lusIndex)) { for (auto [direction, mappings] : controllerStick->GetAllAxisDirectionMappings()) { bool foundMapping = false; for (auto [id, mapping] : mappings) { - if (mapping->GetLUSDeviceIndex() == lusIndex) { + if (mapping->GetShipDeviceIndex() == lusIndex) { foundMapping = true; lusDeviceIndiciesWithMappings.push_back( - std::pair(lusIndex, mapping->PhysicalDeviceIsConnected())); + std::pair(lusIndex, mapping->PhysicalDeviceIsConnected())); break; } } @@ -1324,7 +1324,7 @@ void SohInputEditorWindow::DrawAnalogStickDeviceIcons(uint8_t portIndex, LUS::St ImGui::PushStyleColor(ImGuiCol_Button, buttonColor); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, buttonHoveredColor); ImGui::SameLine(); - if (lusIndex == LUS::LUSDeviceIndex::Keyboard) { + if (lusIndex == Ship::ShipDeviceIndex::Keyboard) { ImGui::SmallButton(ICON_FA_KEYBOARD_O); } else { ImGui::SmallButton(connected ? ICON_FA_GAMEPAD : ICON_FA_CHAIN_BROKEN); @@ -1335,29 +1335,29 @@ void SohInputEditorWindow::DrawAnalogStickDeviceIcons(uint8_t portIndex, LUS::St } void SohInputEditorWindow::DrawRumbleDeviceIcons(uint8_t portIndex) { - std::set allLusDeviceIndices; - for (auto [lusIndex, mapping] : LUS::Context::GetInstance() + std::set allLusDeviceIndices; + for (auto [lusIndex, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetDeviceIndexMappingManager() ->GetAllDeviceIndexMappingsFromConfig()) { allLusDeviceIndices.insert(lusIndex); } - std::vector> lusDeviceIndiciesWithMappings; + std::vector> lusDeviceIndiciesWithMappings; for (auto lusIndex : allLusDeviceIndices) { - if (LUS::Context::GetInstance() + if (Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(portIndex) ->GetRumble() - ->HasMappingsForLUSDeviceIndex(lusIndex)) { - for (auto [id, mapping] : LUS::Context::GetInstance() + ->HasMappingsForShipDeviceIndex(lusIndex)) { + for (auto [id, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(portIndex) ->GetRumble() ->GetAllRumbleMappings()) { - if (mapping->GetLUSDeviceIndex() == lusIndex) { + if (mapping->GetShipDeviceIndex() == lusIndex) { lusDeviceIndiciesWithMappings.push_back( - std::pair(lusIndex, mapping->PhysicalDeviceIsConnected())); + std::pair(lusIndex, mapping->PhysicalDeviceIsConnected())); break; } } @@ -1379,14 +1379,14 @@ void SohInputEditorWindow::DrawRumbleDeviceIcons(uint8_t portIndex) { void SohInputEditorWindow::DrawGyroDeviceIcons(uint8_t portIndex) { auto mapping = - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetGyro()->GetGyroMapping(); + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->GetGyro()->GetGyroMapping(); if (mapping == nullptr) { return; } auto buttonColor = ImGui::GetStyleColorVec4(ImGuiCol_Button); auto buttonHoveredColor = ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered); - GetButtonColorsForLUSDeviceIndex(mapping->GetLUSDeviceIndex(), buttonColor, buttonHoveredColor); + GetButtonColorsForLUSDeviceIndex(mapping->GetShipDeviceIndex(), buttonColor, buttonHoveredColor); ImGui::PushStyleColor(ImGuiCol_Button, buttonColor); ImGui::PushStyleColor(ImGuiCol_ButtonHovered, buttonHoveredColor); ImGui::SameLine(); @@ -1396,29 +1396,29 @@ void SohInputEditorWindow::DrawGyroDeviceIcons(uint8_t portIndex) { } void SohInputEditorWindow::DrawLEDDeviceIcons(uint8_t portIndex) { - std::set allLusDeviceIndices; - for (auto [lusIndex, mapping] : LUS::Context::GetInstance() + std::set allLusDeviceIndices; + for (auto [lusIndex, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetDeviceIndexMappingManager() ->GetAllDeviceIndexMappingsFromConfig()) { allLusDeviceIndices.insert(lusIndex); } - std::vector> lusDeviceIndiciesWithMappings; + std::vector> lusDeviceIndiciesWithMappings; for (auto lusIndex : allLusDeviceIndices) { - if (LUS::Context::GetInstance() + if (Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(portIndex) ->GetRumble() - ->HasMappingsForLUSDeviceIndex(lusIndex)) { - for (auto [id, mapping] : LUS::Context::GetInstance() + ->HasMappingsForShipDeviceIndex(lusIndex)) { + for (auto [id, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(portIndex) ->GetLED() ->GetAllLEDMappings()) { - if (mapping->GetLUSDeviceIndex() == lusIndex) { + if (mapping->GetShipDeviceIndex() == lusIndex) { lusDeviceIndiciesWithMappings.push_back( - std::pair(lusIndex, mapping->PhysicalDeviceIsConnected())); + std::pair(lusIndex, mapping->PhysicalDeviceIsConnected())); break; } } @@ -1478,14 +1478,14 @@ void SohInputEditorWindow::addButtonName(N64ButtonMask mask, const char* name) { } // Ocarina button maps -static CustomButtonMap ocarinaD5 = {"D5", "gOcarinaD5BtnMap", BTN_CUP}; -static CustomButtonMap ocarinaB4 = {"B4", "gOcarinaB4BtnMap", BTN_CLEFT}; -static CustomButtonMap ocarinaA4 = {"A4", "gOcarinaA4BtnMap", BTN_CRIGHT}; -static CustomButtonMap ocarinaF4 = {"F4", "gOcarinaF4BtnMap", BTN_CDOWN}; -static CustomButtonMap ocarinaD4 = {"D4", "gOcarinaD4BtnMap", BTN_A}; -static CustomButtonMap ocarinaSongDisable = {"Disable songs", "gOcarinaDisableBtnMap", BTN_L}; -static CustomButtonMap ocarinaSharp = {"Pitch up", "gOcarinaSharpBtnMap", BTN_R}; -static CustomButtonMap ocarinaFlat = {"Pitch down", "gOcarinaFlatBtnMap", BTN_Z}; +static CustomButtonMap ocarinaD5 = {"D5", CVAR_SETTING("CustomOcarina.D5Button"), BTN_CUP}; +static CustomButtonMap ocarinaB4 = {"B4", CVAR_SETTING("CustomOcarina.B4Button"), BTN_CLEFT}; +static CustomButtonMap ocarinaA4 = {"A4", CVAR_SETTING("CustomOcarina.A4Button"), BTN_CRIGHT}; +static CustomButtonMap ocarinaF4 = {"F4", CVAR_SETTING("CustomOcarina.F4Button"), BTN_CDOWN}; +static CustomButtonMap ocarinaD4 = {"D4", CVAR_SETTING("CustomOcarina.D4Button"), BTN_A}; +static CustomButtonMap ocarinaSongDisable = {"Disable songs", CVAR_SETTING("CustomOcarina.DisableButton"), BTN_L}; +static CustomButtonMap ocarinaSharp = {"Pitch up", CVAR_SETTING("CustomOcarina.SharpButton"), BTN_R}; +static CustomButtonMap ocarinaFlat = {"Pitch down", CVAR_SETTING("CustomOcarina.FlatButton"), BTN_Z}; // Draw a button mapping setting consisting of a padded label and button dropdown. // excludedButtons indicates which buttons are unavailable to choose from. @@ -1516,7 +1516,7 @@ void SohInputEditorWindow::DrawMapping(CustomButtonMap& mapping, float labelWidt } if (ImGui::Selectable(i->second, i->first == currentButton)) { CVarSetInteger(mapping.cVarName, i->first); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } ImGui::EndCombo(); @@ -1534,13 +1534,13 @@ void SohInputEditorWindow::DrawOcarinaControlPanel() { ImVec2 cursor = ImGui::GetCursorPos(); ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); - UIWidgets::EnhancementCheckbox("Customize Ocarina Controls", "gCustomOcarinaControls"); + UIWidgets::EnhancementCheckbox("Customize Ocarina Controls", CVAR_SETTING("CustomOcarina.Enabled")); - if (CVarGetInteger("gCustomOcarinaControls", 0) == 1) { + if (CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0) == 1) { if (ImGui::BeginTable("tableCustomMainOcarinaControls", 2, ImGuiTableFlags_SizingStretchProp)) { float labelWidth; N64ButtonMask disableMask = BTN_B; - if (CVarGetInteger("gDpadOcarina", 0)) { + if (CVarGetInteger(CVAR_SETTING("OcarinaControl.Dpad"), 0)) { disableMask |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } @@ -1548,7 +1548,7 @@ void SohInputEditorWindow::DrawOcarinaControlPanel() { ImGui::TableSetupColumn("Modifiers##CustomOcaranaModifiers", PANEL_TABLE_COLUMN_FLAGS); TableHelper::InitHeader(false); - LUS::GuiWindow::BeginGroupPanel("Notes", ImGui::GetContentRegionAvail()); + Ship::GuiWindow::BeginGroupPanel("Notes", ImGui::GetContentRegionAvail()); labelWidth = ImGui::CalcTextSize("D5").x + 10; DrawMapping(ocarinaD5, labelWidth, disableMask); DrawMapping(ocarinaB4, labelWidth, disableMask); @@ -1557,16 +1557,16 @@ void SohInputEditorWindow::DrawOcarinaControlPanel() { DrawMapping(ocarinaD4, labelWidth, disableMask); ImGui::Dummy(ImVec2(0, 5)); float cursorY = ImGui::GetCursorPosY(); - LUS::GuiWindow::EndGroupPanel(0); + Ship::GuiWindow::EndGroupPanel(0); TableHelper::NextCol(); - LUS::GuiWindow::BeginGroupPanel("Modifiers", ImGui::GetContentRegionAvail()); + Ship::GuiWindow::BeginGroupPanel("Modifiers", ImGui::GetContentRegionAvail()); labelWidth = ImGui::CalcTextSize(ocarinaSongDisable.label).x + 10; DrawMapping(ocarinaSongDisable, labelWidth, disableMask); DrawMapping(ocarinaSharp, labelWidth, disableMask); DrawMapping(ocarinaFlat, labelWidth, disableMask); - LUS::GuiWindow::EndGroupPanel(cursorY - ImGui::GetCursorPosY() + 2); + Ship::GuiWindow::EndGroupPanel(cursorY - ImGui::GetCursorPosY() + 2); ImGui::EndTable(); } @@ -1577,19 +1577,19 @@ void SohInputEditorWindow::DrawOcarinaControlPanel() { UIWidgets::Spacer(0); } - LUS::GuiWindow::BeginGroupPanel("Alternate controls", ImGui::GetContentRegionAvail()); + Ship::GuiWindow::BeginGroupPanel("Alternate controls", ImGui::GetContentRegionAvail()); if (ImGui::BeginTable("tableOcarinaAlternateControls", 2, ImGuiTableFlags_SizingFixedSame)) { ImGui::TableSetupColumn("D-pad", PANEL_TABLE_COLUMN_FLAGS); ImGui::TableSetupColumn("Right stick", PANEL_TABLE_COLUMN_FLAGS); TableHelper::InitHeader(false); ImGui::SetCursorPosX(ImGui::GetCursorPosX() + 5); - UIWidgets::EnhancementCheckbox("Play with D-pad", "gDpadOcarina"); + UIWidgets::EnhancementCheckbox("Play with D-pad", CVAR_SETTING("OcarinaControl.Dpad")); TableHelper::NextCol(); - UIWidgets::EnhancementCheckbox("Play with camera stick", "gRStickOcarina"); + UIWidgets::EnhancementCheckbox("Play with camera stick", CVAR_SETTING("OcarinaControl.RStick")); UIWidgets::Spacer(0); ImGui::EndTable(); } - LUS::GuiWindow::EndGroupPanel(0); + Ship::GuiWindow::EndGroupPanel(0); ImGui::EndTable(); } @@ -1597,112 +1597,112 @@ void SohInputEditorWindow::DrawOcarinaControlPanel() { void SohInputEditorWindow::DrawCameraControlPanel() { ImVec2 cursor = ImGui::GetCursorPos(); ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); - LUS::GuiWindow::BeginGroupPanel("Aiming/First-Person Camera", ImGui::GetContentRegionAvail()); - UIWidgets::PaddedEnhancementCheckbox("Right Stick Aiming", "gRightStickAiming"); + Ship::GuiWindow::BeginGroupPanel("Aiming/First-Person Camera", ImGui::GetContentRegionAvail()); + UIWidgets::PaddedEnhancementCheckbox("Right Stick Aiming", CVAR_SETTING("Controls.RightStickAim")); UIWidgets::Tooltip("Allows for aiming with the right stick in:\n-First-Person/C-Up view\n-Weapon Aiming"); - if (CVarGetInteger("gRightStickAiming", 0)) { - UIWidgets::PaddedEnhancementCheckbox("Allow moving while in first person mode", "gMoveWhileFirstPerson"); + if (CVarGetInteger(CVAR_SETTING("Controls.RightStickAim"), 0)) { + UIWidgets::PaddedEnhancementCheckbox("Allow moving while in first person mode", CVAR_SETTING("MoveInFirstPerson")); UIWidgets::Tooltip("Changes the left stick to move the player while in first person mode"); } - UIWidgets::PaddedEnhancementCheckbox("Invert Aiming X Axis", "gInvertAimingXAxis"); + UIWidgets::PaddedEnhancementCheckbox("Invert Aiming X Axis", CVAR_SETTING("Controls.InvertAimingXAxis")); UIWidgets::Tooltip("Inverts the Camera X Axis in:\n-First-Person/C-Up view\n-Weapon Aiming"); - UIWidgets::PaddedEnhancementCheckbox("Invert Aiming Y Axis", "gInvertAimingYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::PaddedEnhancementCheckbox("Invert Aiming Y Axis", CVAR_SETTING("Controls.InvertAimingYAxis"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip("Inverts the Camera Y Axis in:\n-First-Person/C-Up view\n-Weapon Aiming"); - UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming Y Axis", "gInvertShieldAimingYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming Y Axis", CVAR_SETTING("Controls.InvertShieldAimingYAxis"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip("Inverts the Shield Aiming Y Axis"); - UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming X Axis", "gInvertShieldAimingXAxis"); + UIWidgets::PaddedEnhancementCheckbox("Invert Shield Aiming X Axis", CVAR_SETTING("Controls.InvertShieldAimingYAxis")); UIWidgets::Tooltip("Inverts the Shield Aiming X Axis"); - UIWidgets::PaddedEnhancementCheckbox("Invert Z-Weapon Aiming Y Axis", "gInvertZAimingYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::PaddedEnhancementCheckbox("Invert Z-Weapon Aiming Y Axis", CVAR_SETTING("Controls.InvertZAimingYAxis"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip("Inverts the Camera Y Axis in:\n-Z-Weapon Aiming"); - UIWidgets::PaddedEnhancementCheckbox("Disable Auto-Centering in First-Person View", "gDisableAutoCenterViewFirstPerson"); + UIWidgets::PaddedEnhancementCheckbox("Disable Auto-Centering in First-Person View", CVAR_SETTING("DisableFirstPersonAutoCenterView")); UIWidgets::Tooltip("Prevents the C-Up view from auto-centering, allowing for Gyro Aiming"); - if (UIWidgets::PaddedEnhancementCheckbox("Enable Custom Aiming/First-Person sensitivity", "gEnableFirstPersonSensitivity", true, false)) { - if (!CVarGetInteger("gEnableFirstPersonSensitivity", 0)) { - CVarClear("gFirstPersonCameraSensitivityX"); - CVarClear("gFirstPersonCameraSensitivityY"); + if (UIWidgets::PaddedEnhancementCheckbox("Enable Custom Aiming/First-Person sensitivity", CVAR_SETTING("FirstPersonCameraSensitivity.Enabled"), true, false)) { + if (!CVarGetInteger(CVAR_SETTING("FirstPersonCameraSensitivity.Enabled"), 0)) { + CVarClear(CVAR_SETTING("FirstPersonCameraSensitivity.X")); + CVarClear(CVAR_SETTING("FirstPersonCameraSensitivity.Y")); } } - if (CVarGetInteger("gEnableFirstPersonSensitivity", 0)) { + if (CVarGetInteger(CVAR_SETTING("FirstPersonCameraSensitivity.Enabled"), 0)) { UIWidgets::EnhancementSliderFloat("Aiming/First-Person Horizontal Sensitivity: %.0f %%", "##FirstPersonSensitivity Horizontal", - "gFirstPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true); + CVAR_SETTING("FirstPersonCameraSensitivity.X"), 0.01f, 5.0f, "", 1.0f, true); UIWidgets::EnhancementSliderFloat("Aiming/First-Person Vertical Sensitivity: %.0f %%", "##FirstPersonSensitivity Vertical", - "gFirstPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true); + CVAR_SETTING("FirstPersonCameraSensitivity.Y"), 0.01f, 5.0f, "", 1.0f, true); } UIWidgets::Spacer(0); - LUS::GuiWindow::EndGroupPanel(0); + Ship::GuiWindow::EndGroupPanel(0); UIWidgets::Spacer(0); cursor = ImGui::GetCursorPos(); ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); - LUS::GuiWindow::BeginGroupPanel("Third-Person Camera", ImGui::GetContentRegionAvail()); + Ship::GuiWindow::BeginGroupPanel("Third-Person Camera", ImGui::GetContentRegionAvail()); - UIWidgets::PaddedEnhancementCheckbox("Free Camera", "gFreeCamera"); - UIWidgets::Tooltip("Enables free camera control\nNote: You must remap C buttons off of the right stick in the " + UIWidgets::PaddedEnhancementCheckbox("Free Look", CVAR_SETTING("FreeLook.Enabled")); + UIWidgets::Tooltip("Enables free look camera control\nNote: You must remap C buttons off of the right stick in the " "controller config menu, and map the camera stick to the right stick."); - UIWidgets::PaddedEnhancementCheckbox("Invert Camera X Axis", "gInvertXAxis"); - UIWidgets::Tooltip("Inverts the Camera X Axis in:\n-Free camera"); - UIWidgets::PaddedEnhancementCheckbox("Invert Camera Y Axis", "gInvertYAxis", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true); - UIWidgets::Tooltip("Inverts the Camera Y Axis in:\n-Free camera"); + UIWidgets::PaddedEnhancementCheckbox("Invert Camera X Axis", CVAR_SETTING("FreeLook.InvertXAxis")); + UIWidgets::Tooltip("Inverts the Camera X Axis in:\n-Free look"); + UIWidgets::PaddedEnhancementCheckbox("Invert Camera Y Axis", CVAR_SETTING("FreeLook.InvertYAxis"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::Tooltip("Inverts the Camera Y Axis in:\n-Free look"); UIWidgets::Spacer(0); UIWidgets::PaddedEnhancementSliderFloat("Third-Person Horizontal Sensitivity: %.0f %%", "##ThirdPersonSensitivity Horizontal", - "gThirdPersonCameraSensitivityX", 0.01f, 5.0f, "", 1.0f, true, true, false, true); + CVAR_SETTING("FreeLook.CameraSensitivity.X"), 0.01f, 5.0f, "", 1.0f, true, true, false, true); UIWidgets::PaddedEnhancementSliderFloat("Third-Person Vertical Sensitivity: %.0f %%", "##ThirdPersonSensitivity Vertical", - "gThirdPersonCameraSensitivityY", 0.01f, 5.0f, "", 1.0f, true, true, false, true); + CVAR_SETTING("FreeLook.CameraSensitivity.Y"), 0.01f, 5.0f, "", 1.0f, true, true, false, true); UIWidgets::PaddedEnhancementSliderInt("Camera Distance: %d", "##CamDist", - "gFreeCameraDistMax", 100, 900, "", 185, true, false, true); + CVAR_SETTING("FreeLook.MaxCameraDistance"), 100, 900, "", 185, true, false, true); UIWidgets::PaddedEnhancementSliderInt("Camera Transition Speed: %d", "##CamTranSpeed", - "gFreeCameraTransitionSpeed", 0, 900, "", 25, true, false, true); - LUS::GuiWindow::EndGroupPanel(0); + CVAR_SETTING("FreeLook.TransitionSpeed"), 0, 900, "", 25, true, false, true); + Ship::GuiWindow::EndGroupPanel(0); } void SohInputEditorWindow::DrawDpadControlPanel() { ImVec2 cursor = ImGui::GetCursorPos(); ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); - LUS::GuiWindow::BeginGroupPanel("D-Pad Options", ImGui::GetContentRegionAvail()); - UIWidgets::PaddedEnhancementCheckbox("D-pad Support on Pause Screen", "gDpadPause"); + Ship::GuiWindow::BeginGroupPanel("D-Pad Options", ImGui::GetContentRegionAvail()); + UIWidgets::PaddedEnhancementCheckbox("D-pad Support on Pause Screen", CVAR_SETTING("DPadOnPause")); UIWidgets::Tooltip("Navigate Pause with the D-pad\nIf used with D-pad as Equip Items, you must hold C-Up to equip instead of navigate\n" - "To make the cursor only move a single space no matter how long a direction is held, manually set gDpadHoldChange to 0"); - UIWidgets::PaddedEnhancementCheckbox("D-pad Support in Text Boxes", "gDpadText"); + "To make the cursor only move a single space no matter how long a direction is held, manually set gSettings.DpadHoldChange to 0"); + UIWidgets::PaddedEnhancementCheckbox("D-pad Support in Text Boxes", CVAR_SETTING("DpadInText")); UIWidgets::Tooltip("Navigate choices in text boxes, shop item selection, and the file select / name entry screens with the D-pad\n" - "To make the cursor only move a single space during name entry no matter how long a direction is held, manually set gDpadHoldChange to 0"); - UIWidgets::PaddedEnhancementCheckbox("D-pad as Equip Items", "gDpadEquips"); + "To make the cursor only move a single space during name entry no matter how long a direction is held, manually set gSettings.DpadHoldChange to 0"); + UIWidgets::PaddedEnhancementCheckbox("D-pad as Equip Items", CVAR_SETTING("DpadEquips")); UIWidgets::Tooltip("Equip items and equipment on the D-pad\nIf used with D-pad on Pause Screen, you must hold C-Up to equip instead of navigate"); - LUS::GuiWindow::EndGroupPanel(0); + Ship::GuiWindow::EndGroupPanel(0); } void SohInputEditorWindow::DrawMiscControlPanel() { ImVec2 cursor = ImGui::GetCursorPos(); ImGui::SetCursorPos(ImVec2(cursor.x + 5, cursor.y + 5)); - LUS::GuiWindow::BeginGroupPanel("Misc Controls", ImGui::GetContentRegionAvail()); + Ship::GuiWindow::BeginGroupPanel("Misc Controls", ImGui::GetContentRegionAvail()); UIWidgets::PaddedText("Allow the cursor to be on any slot"); static const char* cursorOnAnySlot[3] = { "Only in Rando", "Always", "Never" }; - UIWidgets::EnhancementCombobox("gPauseAnyCursor", cursorOnAnySlot, PAUSE_ANY_CURSOR_RANDO_ONLY); + UIWidgets::EnhancementCombobox(CVAR_SETTING("PauseAnyCursor"), cursorOnAnySlot, PAUSE_ANY_CURSOR_RANDO_ONLY); UIWidgets::Tooltip("Allows the cursor on the pause menu to be over any slot. Sometimes required in rando to select " "certain items."); UIWidgets::Spacer(0); - ImGui::BeginDisabled(CVarGetInteger("gDisableChangingSettings", 0)); - UIWidgets::PaddedEnhancementCheckbox("Enable speed modifiers", "gEnableWalkModify", true, false); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); + UIWidgets::PaddedEnhancementCheckbox("Enable speed modifiers", CVAR_SETTING("WalkModifier.Enabled"), true, false); UIWidgets::Tooltip("Hold the assigned button to change the maximum walking or swimming speed"); - if (CVarGetInteger("gEnableWalkModify", 0)) { + if (CVarGetInteger(CVAR_SETTING("WalkModifier.Enabled"), 0)) { UIWidgets::Spacer(5); - LUS::GuiWindow::BeginGroupPanel("Speed Modifier", ImGui::GetContentRegionAvail()); - UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", "gWalkSpeedToggle", true, false); - LUS::GuiWindow::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail()); - UIWidgets::PaddedEnhancementCheckbox("Don't affect jump distance/velocity", "gWalkModifierDoesntChangeJump", true, false); - UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 1: %.0f %%", "##WalkMod1", "gWalkModifierOne", 0.0f, 5.0f, "", 1.0f, true, true, false, true); - UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 2: %.0f %%", "##WalkMod2", "gWalkModifierTwo", 0.0f, 5.0f, "", 1.0f, true, true, false, true); - LUS::GuiWindow::EndGroupPanel(0); - LUS::GuiWindow::BeginGroupPanel("Swim Modifier", ImGui::GetContentRegionAvail()); - UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 1: %.0f %%", "##SwimMod1", "gSwimModifierOne", 0.0f, 5.0f, "", 1.0f, true, true, false, true); - UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 2: %.0f %%", "##SwimMod2", "gSwimModifierTwo", 0.0f, 5.0f, "", 1.0f, true, true, false, true); - LUS::GuiWindow::EndGroupPanel(0); - LUS::GuiWindow::EndGroupPanel(0); + Ship::GuiWindow::BeginGroupPanel("Speed Modifier", ImGui::GetContentRegionAvail()); + UIWidgets::PaddedEnhancementCheckbox("Toggle modifier instead of holding", CVAR_SETTING("WalkModifier.SpeedToggle"), true, false); + Ship::GuiWindow::BeginGroupPanel("Walk Modifier", ImGui::GetContentRegionAvail()); + UIWidgets::PaddedEnhancementCheckbox("Don't affect jump distance/velocity", CVAR_SETTING("WalkModifier.DoesntChangeJump"), true, false); + UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 1: %.0f %%", "##WalkMod1", CVAR_SETTING("WalkModifier.Mapping1"), 0.0f, 5.0f, "", 1.0f, true, true, false, true); + UIWidgets::PaddedEnhancementSliderFloat("Walk Modifier 2: %.0f %%", "##WalkMod2", CVAR_SETTING("WalkModifier.Mapping2"), 0.0f, 5.0f, "", 1.0f, true, true, false, true); + Ship::GuiWindow::EndGroupPanel(0); + Ship::GuiWindow::BeginGroupPanel("Swim Modifier", ImGui::GetContentRegionAvail()); + UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 1: %.0f %%", "##SwimMod1", CVAR_SETTING("WalkModifier.SwimMapping1"), 0.0f, 5.0f, "", 1.0f, true, true, false, true); + UIWidgets::PaddedEnhancementSliderFloat("Swim Modifier 2: %.0f %%", "##SwimMod2", CVAR_SETTING("WalkModifier.SwimMapping2"), 0.0f, 5.0f, "", 1.0f, true, true, false, true); + Ship::GuiWindow::EndGroupPanel(0); + Ship::GuiWindow::EndGroupPanel(0); } ImGui::EndDisabled(); UIWidgets::Spacer(0); - UIWidgets::PaddedEnhancementCheckbox("Answer Navi Prompt with L Button", "gNaviOnL"); + UIWidgets::PaddedEnhancementCheckbox("Answer Navi Prompt with L Button", CVAR_SETTING("NaviOnL")); UIWidgets::Tooltip("Speak to Navi with L but enter first-person camera with C-Up"); - LUS::GuiWindow::EndGroupPanel(0); + Ship::GuiWindow::EndGroupPanel(0); } void SohInputEditorWindow::DrawLinkTab() { @@ -1749,17 +1749,17 @@ void SohInputEditorWindow::DrawLinkTab() { } if (ImGui::CollapsingHeader("Analog Stick", NULL, ImGuiTreeNodeFlags_DefaultOpen)) { - DrawAnalogStickDeviceIcons(portIndex, LUS::LEFT_STICK); - DrawStickSection(portIndex, LUS::LEFT, 0); + DrawAnalogStickDeviceIcons(portIndex, Ship::LEFT_STICK); + DrawStickSection(portIndex, Ship::LEFT, 0); } else { - DrawAnalogStickDeviceIcons(portIndex, LUS::LEFT_STICK); + DrawAnalogStickDeviceIcons(portIndex, Ship::LEFT_STICK); } if (ImGui::CollapsingHeader("Additional (\"Right\") Stick")) { - DrawAnalogStickDeviceIcons(portIndex, LUS::RIGHT_STICK); - DrawStickSection(portIndex, LUS::RIGHT, 1, CHIP_COLOR_N64_YELLOW); + DrawAnalogStickDeviceIcons(portIndex, Ship::RIGHT_STICK); + DrawStickSection(portIndex, Ship::RIGHT, 1, CHIP_COLOR_N64_YELLOW); } else { - DrawAnalogStickDeviceIcons(portIndex, LUS::RIGHT_STICK); + DrawAnalogStickDeviceIcons(portIndex, Ship::RIGHT_STICK); } if (ImGui::CollapsingHeader("Rumble")) { @@ -1839,7 +1839,7 @@ void SohInputEditorWindow::DrawLinkTab() { } void SohInputEditorWindow::DrawIvanTab() { - if (CVarGetInteger("gDebugEnabled", 0)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) { DrawDebugPortTab(1, "Ivan (P2)"); return; } @@ -1884,10 +1884,10 @@ void SohInputEditorWindow::DrawIvanTab() { } if (ImGui::CollapsingHeader("Analog Stick", NULL, ImGuiTreeNodeFlags_DefaultOpen)) { - DrawAnalogStickDeviceIcons(portIndex, LUS::LEFT_STICK); - DrawStickSection(portIndex, LUS::LEFT, 0); + DrawAnalogStickDeviceIcons(portIndex, Ship::LEFT_STICK); + DrawStickSection(portIndex, Ship::LEFT, 0); } else { - DrawAnalogStickDeviceIcons(portIndex, LUS::LEFT_STICK); + DrawAnalogStickDeviceIcons(portIndex, Ship::LEFT_STICK); } ImGui::PopStyleColor(); @@ -1942,10 +1942,10 @@ void SohInputEditorWindow::DrawDebugPortTab(uint8_t portIndex, std::string custo } if (ImGui::CollapsingHeader("Analog Stick", NULL, ImGuiTreeNodeFlags_DefaultOpen)) { - DrawAnalogStickDeviceIcons(portIndex, LUS::LEFT_STICK); - DrawStickSection(portIndex, LUS::LEFT, 0); + DrawAnalogStickDeviceIcons(portIndex, Ship::LEFT_STICK); + DrawStickSection(portIndex, Ship::LEFT, 0); } else { - DrawAnalogStickDeviceIcons(portIndex, LUS::LEFT_STICK); + DrawAnalogStickDeviceIcons(portIndex, Ship::LEFT_STICK); } ImGui::PopStyleColor(); @@ -1965,7 +1965,7 @@ void SohInputEditorWindow::DrawClearAllButton(uint8_t portIndex) { ImGui::CloseCurrentPopup(); } if (ImGui::Button("Clear All")) { - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->ClearAllMappings(); + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->ClearAllMappings(); ImGui::CloseCurrentPopup(); } ImGui::EndPopup(); @@ -1983,12 +1983,12 @@ void SohInputEditorWindow::DrawSetDefaultsButton(uint8_t portIndex) { ImGui::PopStyleVar(); if (ImGui::BeginPopup(popupId.c_str())) { - std::map> indexMappings; - for (auto [lusIndex, mapping] : LUS::Context::GetInstance() + std::map> indexMappings; + for (auto [lusIndex, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetDeviceIndexMappingManager() ->GetAllDeviceIndexMappings()) { - auto wiiuIndexMapping = std::static_pointer_cast(mapping); + auto wiiuIndexMapping = std::static_pointer_cast(mapping); if (wiiuIndexMapping == nullptr) { continue; } @@ -2025,11 +2025,11 @@ void SohInputEditorWindow::DrawSetDefaultsButton(uint8_t portIndex) { ImGui::CloseCurrentPopup(); } if (ImGui::Button("Set defaults")) { - LUS::Context::GetInstance() + Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(portIndex) ->ClearAllMappingsForDevice(lusIndex); - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->AddDefaultMappings( + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->AddDefaultMappings( lusIndex); shouldClose = true; ImGui::CloseCurrentPopup(); @@ -2048,12 +2048,12 @@ void SohInputEditorWindow::DrawSetDefaultsButton(uint8_t portIndex) { void SohInputEditorWindow::DrawDevicesTab() { if (ImGui::BeginTabItem("Devices")) { - std::map> indexMappings; - for (auto [lusIndex, mapping] : LUS::Context::GetInstance() + std::map> indexMappings; + for (auto [lusIndex, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetDeviceIndexMappingManager() ->GetAllDeviceIndexMappingsFromConfig()) { - auto wiiuIndexMapping = std::static_pointer_cast(mapping); + auto wiiuIndexMapping = std::static_pointer_cast(mapping); if (wiiuIndexMapping == nullptr) { continue; } @@ -2061,11 +2061,11 @@ void SohInputEditorWindow::DrawDevicesTab() { indexMappings[lusIndex] = { wiiuIndexMapping->GetWiiUControllerName(), -1 }; } - for (auto [lusIndex, mapping] : LUS::Context::GetInstance() + for (auto [lusIndex, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetDeviceIndexMappingManager() ->GetAllDeviceIndexMappings()) { - auto wiiuIndexMapping = std::static_pointer_cast(mapping); + auto wiiuIndexMapping = std::static_pointer_cast(mapping); if (wiiuIndexMapping == nullptr) { continue; } @@ -2108,12 +2108,12 @@ void SohInputEditorWindow::DrawSetDefaultsButton(uint8_t portIndex) { } if (ImGui::BeginPopup(popupId.c_str())) { - std::map> indexMappings; - for (auto [lusIndex, mapping] : LUS::Context::GetInstance() + std::map> indexMappings; + for (auto [lusIndex, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetDeviceIndexMappingManager() ->GetAllDeviceIndexMappings()) { - auto sdlIndexMapping = std::static_pointer_cast(mapping); + auto sdlIndexMapping = std::static_pointer_cast(mapping); if (sdlIndexMapping == nullptr) { continue; } @@ -2136,12 +2136,12 @@ void SohInputEditorWindow::DrawSetDefaultsButton(uint8_t portIndex) { ImGui::CloseCurrentPopup(); } if (ImGui::Button("Set defaults")) { - LUS::Context::GetInstance() + Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(portIndex) - ->ClearAllMappingsForDevice(LUS::LUSDeviceIndex::Keyboard); - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->AddDefaultMappings( - LUS::LUSDeviceIndex::Keyboard); + ->ClearAllMappingsForDevice(Ship::ShipDeviceIndex::Keyboard); + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->AddDefaultMappings( + Ship::ShipDeviceIndex::Keyboard); shouldClose = true; ImGui::CloseCurrentPopup(); } @@ -2171,11 +2171,11 @@ void SohInputEditorWindow::DrawSetDefaultsButton(uint8_t portIndex) { ImGui::CloseCurrentPopup(); } if (ImGui::Button("Set defaults")) { - LUS::Context::GetInstance() + Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(portIndex) ->ClearAllMappingsForDevice(lusIndex); - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->AddDefaultMappings( + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(portIndex)->AddDefaultMappings( lusIndex); shouldClose = true; ImGui::CloseCurrentPopup(); @@ -2194,12 +2194,12 @@ void SohInputEditorWindow::DrawSetDefaultsButton(uint8_t portIndex) { void SohInputEditorWindow::DrawDevicesTab() { if (ImGui::BeginTabItem("Devices")) { - std::map> indexMappings; - for (auto [lusIndex, mapping] : LUS::Context::GetInstance() + std::map> indexMappings; + for (auto [lusIndex, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetDeviceIndexMappingManager() ->GetAllDeviceIndexMappingsFromConfig()) { - auto sdlIndexMapping = std::static_pointer_cast(mapping); + auto sdlIndexMapping = std::static_pointer_cast(mapping); if (sdlIndexMapping == nullptr) { continue; } @@ -2207,11 +2207,11 @@ void SohInputEditorWindow::DrawDevicesTab() { indexMappings[lusIndex] = { sdlIndexMapping->GetSDLControllerName(), -1 }; } - for (auto [lusIndex, mapping] : LUS::Context::GetInstance() + for (auto [lusIndex, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetDeviceIndexMappingManager() ->GetAllDeviceIndexMappings()) { - auto sdlIndexMapping = std::static_pointer_cast(mapping); + auto sdlIndexMapping = std::static_pointer_cast(mapping); if (sdlIndexMapping == nullptr) { continue; } @@ -2246,7 +2246,7 @@ void SohInputEditorWindow::DrawElement() { ImGui::BeginTabBar("##ControllerConfigPortTabs"); DrawLinkTab(); DrawIvanTab(); - if (CVarGetInteger("gDebugEnabled", 0)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) { DrawDebugPortTab(2); DrawDebugPortTab(3); } diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.h b/soh/soh/Enhancements/controls/SohInputEditorWindow.h index e96b5b09a..b418a041e 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.h +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.h @@ -5,7 +5,7 @@ #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif -#include +#include #include #include #include @@ -20,7 +20,7 @@ typedef struct { N64ButtonMask defaultBtn; } CustomButtonMap; -class SohInputEditorWindow : public LUS::GuiWindow { +class SohInputEditorWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; ~SohInputEditorWindow(); @@ -38,14 +38,14 @@ class SohInputEditorWindow : public LUS::GuiWindow { void UpdateElement() override; private: - void DrawStickDirectionLine(const char* axisDirectionName, uint8_t port, uint8_t stick, LUS::Direction direction, + void DrawStickDirectionLine(const char* axisDirectionName, uint8_t port, uint8_t stick, Ship::Direction direction, ImVec4 color); void DrawButtonLine(const char* buttonName, uint8_t port, uint16_t bitmask, ImVec4 color); void DrawButtonLineEditMappingButton(uint8_t port, uint16_t bitmask, std::string id); void DrawButtonLineAddMappingButton(uint8_t port, uint16_t bitmask); - void DrawStickDirectionLineEditMappingButton(uint8_t port, uint8_t stick, LUS::Direction direction, std::string id); - void DrawStickDirectionLineAddMappingButton(uint8_t port, uint8_t stick, LUS::Direction direction); + void DrawStickDirectionLineEditMappingButton(uint8_t port, uint8_t stick, Ship::Direction direction, std::string id); + void DrawStickDirectionLineAddMappingButton(uint8_t port, uint8_t stick, Ship::Direction direction); void DrawStickSection(uint8_t port, uint8_t stick, int32_t id, ImVec4 color); void DrawRumbleSection(uint8_t port); @@ -74,20 +74,20 @@ class SohInputEditorWindow : public LUS::GuiWindow { int32_t mGameInputBlockTimer; int32_t mMappingInputBlockTimer; int32_t mRumbleTimer; - std::shared_ptr mRumbleMappingToTest; + std::shared_ptr mRumbleMappingToTest; // mBitmaskToMappingIds[port][bitmask] = { id0, id1, ... } std::unordered_map>> mBitmaskToMappingIds; // mStickDirectionToMappingIds[port][stick][direction] = { id0, id1, ... } std::unordered_map>>> + std::unordered_map>>> mStickDirectionToMappingIds; void UpdateBitmaskToMappingIds(uint8_t port); void UpdateStickDirectionToMappingIds(uint8_t port); - void GetButtonColorsForLUSDeviceIndex(LUS::LUSDeviceIndex lusIndex, ImVec4& buttonColor, + void GetButtonColorsForLUSDeviceIndex(Ship::ShipDeviceIndex lusIndex, ImVec4& buttonColor, ImVec4& buttonHoveredColor); void DrawLinkTab(); void DrawIvanTab(); @@ -97,7 +97,7 @@ class SohInputEditorWindow : public LUS::GuiWindow { std::set mDpadBitmasks; std::set mModifierButtonsBitmasks; void DrawButtonDeviceIcons(uint8_t portIndex, std::set bitmasks); - void DrawAnalogStickDeviceIcons(uint8_t portIndex, LUS::Stick stick); + void DrawAnalogStickDeviceIcons(uint8_t portIndex, Ship::Stick stick); void DrawRumbleDeviceIcons(uint8_t portIndex); void DrawGyroDeviceIcons(uint8_t portIndex); void DrawLEDDeviceIcons(uint8_t portIndex); diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 4f04bc64b..b932d24cc 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -13,6 +13,7 @@ #include #include "soh/UIWidgets.hpp" +#include "soh/OTRGlobals.h" extern "C" { #include @@ -57,46 +58,24 @@ u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey); #define dgEndGrayscaleAndEndDlistDL "__OTR__helpers/cosmetics/gEndGrayscaleAndEndDlistDL" static const ALIGN_ASSET(2) char gEndGrayscaleAndEndDlistDL[] = dgEndGrayscaleAndEndDlistDL; -// Not to be confused with tabs, groups are 1:1 with the boxes shown in the UI, grouping them allows us to reset/randomize -// every item in a group at once. If you are looking for tabs they are rendered manually in ImGui in `DrawCosmeticsEditor` -typedef enum { - GROUP_LINK, - GROUP_MIRRORSHIELD, - GROUP_SWORDS, - GROUP_GLOVES, - GROUP_EQUIPMENT, - GROUP_CONSUMABLE, - GROUP_HUD, - GROUP_KALEIDO, - GROUP_TITLE, - GROUP_NPC, - GROUP_WORLD, - GROUP_MAGIC, - GROUP_ARROWS, - GROUP_SPIN_ATTACK, - GROUP_TRAILS, - GROUP_NAVI, - GROUP_IVAN, -} CosmeticGroup; - std::map groupLabels = { - { GROUP_LINK, "Link" }, - { GROUP_MIRRORSHIELD, "Mirror Shield" }, - { GROUP_SWORDS, "Swords" }, - { GROUP_GLOVES, "Gloves" }, - { GROUP_EQUIPMENT, "Equipment" }, - { GROUP_CONSUMABLE, "Consumables" }, - { GROUP_HUD, "HUD" }, - { GROUP_KALEIDO, "Pause Menu" }, - { GROUP_TITLE, "Title Screen" }, - { GROUP_NPC, "NPCs" }, - { GROUP_WORLD, "World" }, - { GROUP_MAGIC, "Magic Effects" }, - { GROUP_ARROWS, "Arrow Effects" }, - { GROUP_SPIN_ATTACK, "Spin Attack" }, - { GROUP_TRAILS, "Trails" }, - { GROUP_NAVI, "Navi" }, - { GROUP_IVAN, "Ivan" } + { COSMETICS_GROUP_LINK, "Link" }, + { COSMETICS_GROUP_MIRRORSHIELD, "Mirror Shield" }, + { COSMETICS_GROUP_SWORDS, "Swords" }, + { COSMETICS_GROUP_GLOVES, "Gloves" }, + { COSMETICS_GROUP_EQUIPMENT, "Equipment" }, + { COSMETICS_GROUP_CONSUMABLE, "Consumables" }, + { COSMETICS_GROUP_HUD, "HUD" }, + { COSMETICS_GROUP_KALEIDO, "Pause Menu" }, + { COSMETICS_GROUP_TITLE, "Title Screen" }, + { COSMETICS_GROUP_NPC, "NPCs" }, + { COSMETICS_GROUP_WORLD, "World" }, + { COSMETICS_GROUP_MAGIC, "Magic Effects" }, + { COSMETICS_GROUP_ARROWS, "Arrow Effects" }, + { COSMETICS_GROUP_SPIN_ATTACK, "Spin Attack" }, + { COSMETICS_GROUP_TRAILS, "Trails" }, + { COSMETICS_GROUP_NAVI, "Navi" }, + { COSMETICS_GROUP_IVAN, "Ivan" } }; typedef struct { @@ -115,7 +94,7 @@ typedef struct { #define COSMETIC_OPTION(id, label, group, defaultColor, supportsAlpha, supportsRainbow, advancedOption) \ { id, { \ - "gCosmetics." id ".Value", "gCosmetics." id ".Rainbow", "gCosmetics." id ".Locked", "gCosmetics." id ".Changed", label, group, \ + CVAR_COSMETIC(id ".Value"), CVAR_COSMETIC(id ".Rainbow"), CVAR_COSMETIC(id ".Locked"), CVAR_COSMETIC(id ".Changed"), label, group, \ defaultColor, defaultColor, \ supportsAlpha, supportsRainbow, advancedOption \ } } @@ -174,8 +153,8 @@ typedef struct { gDPSetEnvColor(POLY_OPA_DISP++, 80, 70, 20, alpha); // with cosmetics change - if (CVarGetInteger("gCosmetics.World_Moon.Changed", 0)) { - Color_RGB8 moonColor = CVarGetColor24("gCosmetics.World_Moon.Value", (Color_RGB8){ 0, 0, 240 }); + if (CVarGetInteger(CVAR_COSMETIC("World.Moon.Changed"), 0)) { + Color_RGB8 moonColor = CVarGetColor24(CVAR_COSMETIC("World.Moon.Value"), (Color_RGB8){ 0, 0, 240 }); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, moonColor.r, moonColor.g, moonColor.b, alpha); gDPSetEnvColor(POLY_OPA_DISP++, moonColor.r / 2, moonColor.g / 2, moonColor.b / 2, alpha); } else { @@ -194,188 +173,189 @@ typedef struct { colors were darker than the gDPSetPrimColor. You will see many more examples of this below in the `ApplyOrResetCustomGfxPatches` method */ static std::map cosmeticOptions = { - COSMETIC_OPTION("Link_KokiriTunic", "Kokiri Tunic", GROUP_LINK, ImVec4( 30, 105, 27, 255), false, true, false), - COSMETIC_OPTION("Link_GoronTunic", "Goron Tunic", GROUP_LINK, ImVec4(100, 20, 0, 255), false, true, false), - COSMETIC_OPTION("Link_ZoraTunic", "Zora Tunic", GROUP_LINK, ImVec4( 0, 60, 100, 255), false, true, false), - COSMETIC_OPTION("Link_Hair", "Hair", GROUP_LINK, ImVec4(255, 173, 27, 255), false, true, true), - COSMETIC_OPTION("Link_Linen", "Linen", GROUP_LINK, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("Link_Boots", "Boots", GROUP_LINK, ImVec4( 93, 44, 18, 255), false, true, true), + COSMETIC_OPTION("Link.KokiriTunic", "Kokiri Tunic", COSMETICS_GROUP_LINK, ImVec4( 30, 105, 27, 255), false, true, false), + COSMETIC_OPTION("Link.GoronTunic", "Goron Tunic", COSMETICS_GROUP_LINK, ImVec4(100, 20, 0, 255), false, true, false), + COSMETIC_OPTION("Link.ZoraTunic", "Zora Tunic", COSMETICS_GROUP_LINK, ImVec4( 0, 60, 100, 255), false, true, false), + COSMETIC_OPTION("Link.Hair", "Hair", COSMETICS_GROUP_LINK, ImVec4(255, 173, 27, 255), false, true, true), + COSMETIC_OPTION("Link.Linen", "Linen", COSMETICS_GROUP_LINK, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("Link.Boots", "Boots", COSMETICS_GROUP_LINK, ImVec4( 93, 44, 18, 255), false, true, true), - COSMETIC_OPTION("MirrorShield_Body", "Body", GROUP_MIRRORSHIELD, ImVec4(215, 0, 0, 255), false, true, false), - COSMETIC_OPTION("MirrorShield_Mirror", "Mirror", GROUP_MIRRORSHIELD, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("MirrorShield_Emblem", "Emblem", GROUP_MIRRORSHIELD, ImVec4(205, 225, 255, 255), false, true, true), + COSMETIC_OPTION("MirrorShield.Body", "Body", COSMETICS_GROUP_MIRRORSHIELD, ImVec4(215, 0, 0, 255), false, true, false), + COSMETIC_OPTION("MirrorShield.Mirror", "Mirror", COSMETICS_GROUP_MIRRORSHIELD, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("MirrorShield.Emblem", "Emblem", COSMETICS_GROUP_MIRRORSHIELD, ImVec4(205, 225, 255, 255), false, true, true), - COSMETIC_OPTION("Swords_KokiriBlade", "Kokiri Sword Blade", GROUP_SWORDS, ImVec4(255, 255, 255, 255), false, true, false), - // COSMETIC_OPTION("Swords_KokiriHilt", "Kokiri Sword Hilt", GROUP_SWORDS, ImVec4(160, 100, 15, 255), false, true, true), // Todo (Cosmetics): Broken, need a better way to grayscale - COSMETIC_OPTION("Swords_MasterBlade", "Master Sword Blade", GROUP_SWORDS, ImVec4(255, 255, 255, 255), false, true, false), - // COSMETIC_OPTION("Swords_MasterHilt", "Master Sword Hilt", GROUP_SWORDS, ImVec4( 80, 80, 168, 255), false, true, true), // Todo (Cosmetics): Broken, need a better way to grayscale - COSMETIC_OPTION("Swords_BiggoronBlade", "Biggoron Sword Blade", GROUP_SWORDS, ImVec4(255, 255, 255, 255), false, true, false), - // COSMETIC_OPTION("Swords_BiggoronHilt", "Biggoron Sword Hilt", GROUP_SWORDS, ImVec4( 80, 80, 168, 255), false, true, true), // Todo (Cosmetics): Broken, need a better way to grayscale + COSMETIC_OPTION("Swords.KokiriBlade", "Kokiri Sword Blade", COSMETICS_GROUP_SWORDS, ImVec4(255, 255, 255, 255), false, true, false), + // COSMETIC_OPTION("Swords.KokiriHilt", "Kokiri Sword Hilt", COSMETICS_GROUP_SWORDS, ImVec4(160, 100, 15, 255), false, true, true), // Todo (Cosmetics): Broken, need a better way to grayscale + COSMETIC_OPTION("Swords.MasterBlade", "Master Sword Blade", COSMETICS_GROUP_SWORDS, ImVec4(255, 255, 255, 255), false, true, false), + // COSMETIC_OPTION("Swords.MasterHilt", "Master Sword Hilt", COSMETICS_GROUP_SWORDS, ImVec4( 80, 80, 168, 255), false, true, true), // Todo (Cosmetics): Broken, need a better way to grayscale + COSMETIC_OPTION("Swords.BiggoronBlade", "Biggoron Sword Blade", COSMETICS_GROUP_SWORDS, ImVec4(255, 255, 255, 255), false, true, false), + // COSMETIC_OPTION("Swords.BiggoronHilt", "Biggoron Sword Hilt", COSMETICS_GROUP_SWORDS, ImVec4( 80, 80, 168, 255), false, true, true), // Todo (Cosmetics): Broken, need a better way to grayscale - COSMETIC_OPTION("Gloves_GoronBracelet", "Goron Bracelet", GROUP_GLOVES, ImVec4(255, 255, 170, 255), false, true, false), - COSMETIC_OPTION("Gloves_SilverGauntlets", "Silver Gauntlets", GROUP_GLOVES, ImVec4(255, 255, 255, 255), false, true, false), - COSMETIC_OPTION("Gloves_GoldenGauntlets", "Golden Gauntlets", GROUP_GLOVES, ImVec4(254, 207, 15, 255), false, true, false), - COSMETIC_OPTION("Gloves_GauntletsGem", "Gauntlets Gem", GROUP_GLOVES, ImVec4(255, 60, 100, 255), false, true, true), + COSMETIC_OPTION("Gloves.GoronBracelet", "Goron Bracelet", COSMETICS_GROUP_GLOVES, ImVec4(255, 255, 170, 255), false, true, false), + COSMETIC_OPTION("Gloves.SilverGauntlets", "Silver Gauntlets", COSMETICS_GROUP_GLOVES, ImVec4(255, 255, 255, 255), false, true, false), + COSMETIC_OPTION("Gloves.GoldenGauntlets", "Golden Gauntlets", COSMETICS_GROUP_GLOVES, ImVec4(254, 207, 15, 255), false, true, false), + COSMETIC_OPTION("Gloves.GauntletsGem", "Gauntlets Gem", COSMETICS_GROUP_GLOVES, ImVec4(255, 60, 100, 255), false, true, true), - COSMETIC_OPTION("Equipment_BoomerangBody", "Boomerang Body", GROUP_EQUIPMENT, ImVec4(160, 100, 0, 255), false, true, false), - COSMETIC_OPTION("Equipment_BoomerangGem", "Boomerang Gem", GROUP_EQUIPMENT, ImVec4(255, 50, 150, 255), false, true, true), - // COSMETIC_OPTION("Equipment_SlingshotBody", "Slingshot Body", GROUP_EQUIPMENT, ImVec4(160, 100, 0, 255), false, true, true), // Todo (Cosmetics): Broken, need a better way to grayscale - COSMETIC_OPTION("Equipment_SlingshotString", "Slingshot String", GROUP_EQUIPMENT, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("Equipment_HammerHead", "Hammer Head", GROUP_EQUIPMENT, ImVec4(155, 192, 201, 255), false, true, false), - COSMETIC_OPTION("Equipment_HammerHandle", "Hammer Handle", GROUP_EQUIPMENT, ImVec4(110, 60, 0, 255), false, true, true), - // COSMETIC_OPTION("Equipment_HookshotChain", "Hookshot Chain", GROUP_EQUIPMENT, ImVec4(255, 255, 255, 255), false, true, true), // Todo (Cosmetics): Implement - // COSMETIC_OPTION("Equipment_HookshotTip", "Hookshot Tip", GROUP_EQUIPMENT, ImVec4(255, 255, 255, 255), false, true, false), // Todo (Cosmetics): Implement - COSMETIC_OPTION("HookshotReticle_Target", "Hookshotable Reticle", GROUP_EQUIPMENT, ImVec4( 0, 255, 0, 255), false, false, false), - COSMETIC_OPTION("HookshotReticle_NonTarget", "Non-Hookshotable Reticle", GROUP_EQUIPMENT, ImVec4(255, 0, 0, 255), false, false, false), - COSMETIC_OPTION("Equipment_BowTips", "Bow Tips", GROUP_EQUIPMENT, ImVec4(200, 0, 0, 255), false, true, true), - COSMETIC_OPTION("Equipment_BowString", "Bow String", GROUP_EQUIPMENT, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("Equipment_BowBody", "Bow Body", GROUP_EQUIPMENT, ImVec4(140, 90, 10, 255), false, true, false), - COSMETIC_OPTION("Equipment_BowHandle", "Bow Handle", GROUP_EQUIPMENT, ImVec4( 50, 150, 255, 255), false, true, true), - COSMETIC_OPTION("Equipment_ChuFace", "Bombchu Face", GROUP_EQUIPMENT, ImVec4( 0, 100, 150, 255), false, true, true), - COSMETIC_OPTION("Equipment_ChuBody", "Bombchu Body", GROUP_EQUIPMENT, ImVec4(180, 130, 50, 255), false, true, true), - COSMETIC_OPTION("Equipment_BunnyHood", "Bunny Hood", GROUP_EQUIPMENT, ImVec4(255, 235, 109, 255), false, true, true), + COSMETIC_OPTION("Equipment.BoomerangBody", "Boomerang Body", COSMETICS_GROUP_EQUIPMENT, ImVec4(160, 100, 0, 255), false, true, false), + COSMETIC_OPTION("Equipment.BoomerangGem", "Boomerang Gem", COSMETICS_GROUP_EQUIPMENT, ImVec4(255, 50, 150, 255), false, true, true), + // COSMETIC_OPTION("Equipment.SlingshotBody", "Slingshot Body", COSMETICS_GROUP_EQUIPMENT, ImVec4(160, 100, 0, 255), false, true, true), // Todo (Cosmetics): Broken, need a better way to grayscale + COSMETIC_OPTION("Equipment.SlingshotString", "Slingshot String", COSMETICS_GROUP_EQUIPMENT, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("Equipment.HammerHead", "Hammer Head", COSMETICS_GROUP_EQUIPMENT, ImVec4(155, 192, 201, 255), false, true, false), + COSMETIC_OPTION("Equipment.HammerHandle", "Hammer Handle", COSMETICS_GROUP_EQUIPMENT, ImVec4(110, 60, 0, 255), false, true, true), + // COSMETIC_OPTION("Equipment.HookshotChain", "Hookshot Chain", COSMETICS_GROUP_EQUIPMENT, ImVec4(255, 255, 255, 255), false, true, true), // Todo (Cosmetics): Implement + // COSMETIC_OPTION("Equipment.HookshotTip", "Hookshot Tip", COSMETICS_GROUP_EQUIPMENT, ImVec4(255, 255, 255, 255), false, true, false), // Todo (Cosmetics): Implement + COSMETIC_OPTION("HookshotReticle.Target", "Hookshotable Reticle", COSMETICS_GROUP_EQUIPMENT, ImVec4( 0, 255, 0, 255), false, false, false), + COSMETIC_OPTION("HookshotReticle.NonTarget", "Non-Hookshotable Reticle", COSMETICS_GROUP_EQUIPMENT, ImVec4(255, 0, 0, 255), false, false, false), + COSMETIC_OPTION("Equipment.BowTips", "Bow Tips", COSMETICS_GROUP_EQUIPMENT, ImVec4(200, 0, 0, 255), false, true, true), + COSMETIC_OPTION("Equipment.BowString", "Bow String", COSMETICS_GROUP_EQUIPMENT, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("Equipment.BowBody", "Bow Body", COSMETICS_GROUP_EQUIPMENT, ImVec4(140, 90, 10, 255), false, true, false), + COSMETIC_OPTION("Equipment.BowHandle", "Bow Handle", COSMETICS_GROUP_EQUIPMENT, ImVec4( 50, 150, 255, 255), false, true, true), + COSMETIC_OPTION("Equipment.ChuFace", "Bombchu Face", COSMETICS_GROUP_EQUIPMENT, ImVec4( 0, 100, 150, 255), false, true, true), + COSMETIC_OPTION("Equipment.ChuBody", "Bombchu Body", COSMETICS_GROUP_EQUIPMENT, ImVec4(180, 130, 50, 255), false, true, true), + COSMETIC_OPTION("Equipment.BunnyHood", "Bunny Hood", COSMETICS_GROUP_EQUIPMENT, ImVec4(255, 235, 109, 255), false, true, true), - COSMETIC_OPTION("Consumable_Hearts", "Hearts", GROUP_CONSUMABLE, ImVec4(255, 70, 50, 255), false, true, false), - COSMETIC_OPTION("Consumable_HeartBorder", "Heart Border", GROUP_CONSUMABLE, ImVec4( 50, 40, 60, 255), false, true, true), - COSMETIC_OPTION("Consumable_DDHearts", "DD Hearts", GROUP_CONSUMABLE, ImVec4(200, 0, 0, 255), false, true, false), - COSMETIC_OPTION("Consumable_DDHeartBorder", "DD Heart Border", GROUP_CONSUMABLE, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("Consumable_Magic", "Magic", GROUP_CONSUMABLE, ImVec4( 0, 200, 0, 255), false, true, false), - COSMETIC_OPTION("Consumable_MagicActive", "Magic Active", GROUP_CONSUMABLE, ImVec4(250, 250, 0, 255), false, true, true), - COSMETIC_OPTION("Consumable_MagicBorder", "Magic Border", GROUP_CONSUMABLE, ImVec4(255, 255, 255, 255), false, false, true), - COSMETIC_OPTION("Consumable_MagicBorderActive", "Magic Border Active", GROUP_CONSUMABLE, ImVec4(255, 255, 255, 255), false, false, true), - COSMETIC_OPTION("Consumable_GreenRupee", "Green Rupee", GROUP_CONSUMABLE, ImVec4( 50, 255, 50, 255), false, true, true), - COSMETIC_OPTION("Consumable_BlueRupee", "Blue Rupee", GROUP_CONSUMABLE, ImVec4( 50, 50, 255, 255), false, true, true), - COSMETIC_OPTION("Consumable_RedRupee", "Red Rupee", GROUP_CONSUMABLE, ImVec4(255, 50, 50, 255), false, true, true), - COSMETIC_OPTION("Consumable_PurpleRupee", "Purple Rupee", GROUP_CONSUMABLE, ImVec4(150, 50, 255, 255), false, true, true), - COSMETIC_OPTION("Consumable_GoldRupee", "Gold Rupee", GROUP_CONSUMABLE, ImVec4(255, 190, 55, 255), false, true, true), - COSMETIC_OPTION("Consumable_SilverRupee", "Silver Rupee", GROUP_CONSUMABLE, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("Consumable.Hearts", "Hearts", COSMETICS_GROUP_CONSUMABLE, ImVec4(255, 70, 50, 255), false, true, false), + COSMETIC_OPTION("Consumable.HeartBorder", "Heart Border", COSMETICS_GROUP_CONSUMABLE, ImVec4( 50, 40, 60, 255), false, true, true), + COSMETIC_OPTION("Consumable.DDHearts", "DD Hearts", COSMETICS_GROUP_CONSUMABLE, ImVec4(200, 0, 0, 255), false, true, false), + COSMETIC_OPTION("Consumable.DDHeartBorder", "DD Heart Border", COSMETICS_GROUP_CONSUMABLE, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("Consumable.Magic", "Magic", COSMETICS_GROUP_CONSUMABLE, ImVec4( 0, 200, 0, 255), false, true, false), + COSMETIC_OPTION("Consumable.MagicActive", "Magic Active", COSMETICS_GROUP_CONSUMABLE, ImVec4(250, 250, 0, 255), false, true, true), + COSMETIC_OPTION("Consumable.MagicBorder", "Magic Border", COSMETICS_GROUP_CONSUMABLE, ImVec4(255, 255, 255, 255), false, false, true), + COSMETIC_OPTION("Consumable.MagicBorderActive", "Magic Border Active", COSMETICS_GROUP_CONSUMABLE, ImVec4(255, 255, 255, 255), false, false, true), + COSMETIC_OPTION("Consumable.GreenRupee", "Green Rupee", COSMETICS_GROUP_CONSUMABLE, ImVec4( 50, 255, 50, 255), false, true, true), + COSMETIC_OPTION("Consumable.BlueRupee", "Blue Rupee", COSMETICS_GROUP_CONSUMABLE, ImVec4( 50, 50, 255, 255), false, true, true), + COSMETIC_OPTION("Consumable.RedRupee", "Red Rupee", COSMETICS_GROUP_CONSUMABLE, ImVec4(255, 50, 50, 255), false, true, true), + COSMETIC_OPTION("Consumable.PurpleRupee", "Purple Rupee", COSMETICS_GROUP_CONSUMABLE, ImVec4(150, 50, 255, 255), false, true, true), + COSMETIC_OPTION("Consumable.GoldRupee", "Gold Rupee", COSMETICS_GROUP_CONSUMABLE, ImVec4(255, 190, 55, 255), false, true, true), + COSMETIC_OPTION("Consumable.SilverRupee", "Silver Rupee", COSMETICS_GROUP_CONSUMABLE, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("Hud_AButton", "A Button", GROUP_HUD, ImVec4( 90, 90, 255, 255), false, true, false), - COSMETIC_OPTION("Hud_BButton", "B Button", GROUP_HUD, ImVec4( 0, 150, 0, 255), false, true, false), - COSMETIC_OPTION("Hud_CButtons", "C Buttons", GROUP_HUD, ImVec4(255, 160, 0, 255), false, true, false), - COSMETIC_OPTION("Hud_CUpButton", "C Up Button", GROUP_HUD, ImVec4(255, 160, 0, 255), false, true, true), - COSMETIC_OPTION("Hud_CDownButton", "C Down Button", GROUP_HUD, ImVec4(255, 160, 0, 255), false, true, true), - COSMETIC_OPTION("Hud_CLeftButton", "C Left Button", GROUP_HUD, ImVec4(255, 160, 0, 255), false, true, true), - COSMETIC_OPTION("Hud_CRightButton", "C Right Button", GROUP_HUD, ImVec4(255, 160, 0, 255), false, true, true), - COSMETIC_OPTION("Hud_StartButton", "Start Button", GROUP_HUD, ImVec4(200, 0, 0, 255), false, true, false), - COSMETIC_OPTION("Hud_Dpad", "Dpad", GROUP_HUD, ImVec4(255, 255, 255, 255), false, true, false), - COSMETIC_OPTION("Hud_KeyCount", "Key Count", GROUP_HUD, ImVec4(200, 230, 255, 255), false, true, true), - COSMETIC_OPTION("Hud_StoneOfAgony", "Stone of Agony", GROUP_HUD, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("Hud_Minimap", "Minimap", GROUP_HUD, ImVec4( 0, 255, 255, 255), false, true, false), - COSMETIC_OPTION("Hud_MinimapPosition", "Minimap Position", GROUP_HUD, ImVec4(200, 255, 0, 255), false, true, true), - COSMETIC_OPTION("Hud_MinimapEntrance", "Minimap Entrance", GROUP_HUD, ImVec4(200, 0, 0, 255), false, true, true), - COSMETIC_OPTION("Hud_EnemyHealthBar", "Enemy Health Bar", GROUP_HUD, ImVec4(255, 0, 0, 255), true, true, false), - COSMETIC_OPTION("Hud_EnemyHealthBorder", "Enemy Health Border", GROUP_HUD, ImVec4(255, 255, 255, 255), true, false, true), - COSMETIC_OPTION("Hud_NameTagActorText", "Nametag Text", GROUP_HUD, ImVec4(255, 255, 255, 255), true, true, false), - COSMETIC_OPTION("Hud_NameTagActorBackground", "Nametag Background", GROUP_HUD, ImVec4(0, 0, 0, 80), true, false, true), + COSMETIC_OPTION("HUD.AButton", "A Button", COSMETICS_GROUP_HUD, ImVec4( 90, 90, 255, 255), false, true, false), + COSMETIC_OPTION("HUD.BButton", "B Button", COSMETICS_GROUP_HUD, ImVec4( 0, 150, 0, 255), false, true, false), + COSMETIC_OPTION("HUD.CButtons", "C Buttons", COSMETICS_GROUP_HUD, ImVec4(255, 160, 0, 255), false, true, false), + COSMETIC_OPTION("HUD.CUpButton", "C Up Button", COSMETICS_GROUP_HUD, ImVec4(255, 160, 0, 255), false, true, true), + COSMETIC_OPTION("HUD.CDownButton", "C Down Button", COSMETICS_GROUP_HUD, ImVec4(255, 160, 0, 255), false, true, true), + COSMETIC_OPTION("HUD.CLeftButton", "C Left Button", COSMETICS_GROUP_HUD, ImVec4(255, 160, 0, 255), false, true, true), + COSMETIC_OPTION("HUD.CRightButton", "C Right Button", COSMETICS_GROUP_HUD, ImVec4(255, 160, 0, 255), false, true, true), + COSMETIC_OPTION("HUD.StartButton", "Start Button", COSMETICS_GROUP_HUD, ImVec4(200, 0, 0, 255), false, true, false), + COSMETIC_OPTION("HUD.Dpad", "Dpad", COSMETICS_GROUP_HUD, ImVec4(255, 255, 255, 255), false, true, false), + COSMETIC_OPTION("HUD.KeyCount", "Key Count", COSMETICS_GROUP_HUD, ImVec4(200, 230, 255, 255), false, true, true), + COSMETIC_OPTION("HUD.StoneOfAgony", "Stone of Agony", COSMETICS_GROUP_HUD, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("HUD.Minimap", "Minimap", COSMETICS_GROUP_HUD, ImVec4( 0, 255, 255, 255), false, true, false), + COSMETIC_OPTION("HUD.MinimapPosition", "Minimap Position", COSMETICS_GROUP_HUD, ImVec4(200, 255, 0, 255), false, true, true), + COSMETIC_OPTION("HUD.MinimapEntrance", "Minimap Entrance", COSMETICS_GROUP_HUD, ImVec4(200, 0, 0, 255), false, true, true), + COSMETIC_OPTION("HUD.EnemyHealthBar", "Enemy Health Bar", COSMETICS_GROUP_HUD, ImVec4(255, 0, 0, 255), true, true, false), + COSMETIC_OPTION("HUD.EnemyHealthBorder", "Enemy Health Border", COSMETICS_GROUP_HUD, ImVec4(255, 255, 255, 255), true, false, true), + COSMETIC_OPTION("HUD.NameTagActorText", "Nametag Text", COSMETICS_GROUP_HUD, ImVec4(255, 255, 255, 255), true, true, false), + COSMETIC_OPTION("HUD.NameTagActorBackground", "Nametag Background", COSMETICS_GROUP_HUD, ImVec4(0, 0, 0, 80), true, false, true), + // Todo (Cosmetics): re-implement title card colors - COSMETIC_OPTION("Kal_ItemSelA", "Item Select Color", GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, false), - COSMETIC_OPTION("Kal_ItemSelB", "Item Select Color B", GROUP_KALEIDO, ImVec4(70, 100, 130, 255), false, true, true), - COSMETIC_OPTION("Kal_ItemSelC", "Item Select Color C", GROUP_KALEIDO, ImVec4(70, 100, 130, 255), false, true, true), - COSMETIC_OPTION("Kal_ItemSelD", "Item Select Color D", GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, true), + COSMETIC_OPTION("Kaleido.ItemSelA", "Item Select Color", COSMETICS_GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, false), + COSMETIC_OPTION("Kaleido.ItemSelB", "Item Select Color B", COSMETICS_GROUP_KALEIDO, ImVec4(70, 100, 130, 255), false, true, true), + COSMETIC_OPTION("Kaleido.ItemSelC", "Item Select Color C", COSMETICS_GROUP_KALEIDO, ImVec4(70, 100, 130, 255), false, true, true), + COSMETIC_OPTION("Kaleido.ItemSelD", "Item Select Color D", COSMETICS_GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, true), - COSMETIC_OPTION("Kal_EquipSelA", "Equip Select Color", GROUP_KALEIDO, ImVec4(10, 50, 40, 255), false, true, false), - COSMETIC_OPTION("Kal_EquipSelB", "Equip Select Color B", GROUP_KALEIDO, ImVec4(90, 100, 60, 255), false, true, true), - COSMETIC_OPTION("Kal_EquipSelC", "Equip Select Color C", GROUP_KALEIDO, ImVec4(90, 100, 60, 255), false, true, true), - COSMETIC_OPTION("Kal_EquipSelD", "Equip Select Color D", GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, true), + COSMETIC_OPTION("Kaleido.EquipSelA", "Equip Select Color", COSMETICS_GROUP_KALEIDO, ImVec4(10, 50, 40, 255), false, true, false), + COSMETIC_OPTION("Kaleido.EquipSelB", "Equip Select Color B", COSMETICS_GROUP_KALEIDO, ImVec4(90, 100, 60, 255), false, true, true), + COSMETIC_OPTION("Kaleido.EquipSelC", "Equip Select Color C", COSMETICS_GROUP_KALEIDO, ImVec4(90, 100, 60, 255), false, true, true), + COSMETIC_OPTION("Kaleido.EquipSelD", "Equip Select Color D", COSMETICS_GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, true), - COSMETIC_OPTION("Kal_MapSelDunA", "Map Dungeon Color", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, true), - COSMETIC_OPTION("Kal_MapSelDunB", "Map Dungeon Color B", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), - COSMETIC_OPTION("Kal_MapSelDunC", "Map Dungeon Color C", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), - COSMETIC_OPTION("Kal_MapSelDunD", "Map Dungeon Color D", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, true), + COSMETIC_OPTION("Kaleido.MapSelDunA", "Map Dungeon Color", COSMETICS_GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, true), + COSMETIC_OPTION("Kaleido.MapSelDunB", "Map Dungeon Color B", COSMETICS_GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), + COSMETIC_OPTION("Kaleido.MapSelDunC", "Map Dungeon Color C", COSMETICS_GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), + COSMETIC_OPTION("Kaleido.MapSelDunD", "Map Dungeon Color D", COSMETICS_GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, true), - COSMETIC_OPTION("Kal_QuestStatusA", "Quest Status Color", GROUP_KALEIDO, ImVec4(80, 80, 50, 255), false, true, false), - COSMETIC_OPTION("Kal_QuestStatusB", "Quest Status Color B", GROUP_KALEIDO, ImVec4(120, 120, 70, 255), false, true, true), - COSMETIC_OPTION("Kal_QuestStatusC", "Quest Status Color C", GROUP_KALEIDO, ImVec4(120, 120, 70, 255), false, true, true), - COSMETIC_OPTION("Kal_QuestStatusD", "Quest Status Color D", GROUP_KALEIDO, ImVec4(80, 80, 50, 255), false, true, true), + COSMETIC_OPTION("Kaleido.QuestStatusA", "Quest Status Color", COSMETICS_GROUP_KALEIDO, ImVec4(80, 80, 50, 255), false, true, false), + COSMETIC_OPTION("Kaleido.QuestStatusB", "Quest Status Color B", COSMETICS_GROUP_KALEIDO, ImVec4(120, 120, 70, 255), false, true, true), + COSMETIC_OPTION("Kaleido.QuestStatusC", "Quest Status Color C", COSMETICS_GROUP_KALEIDO, ImVec4(120, 120, 70, 255), false, true, true), + COSMETIC_OPTION("Kaleido.QuestStatusD", "Quest Status Color D", COSMETICS_GROUP_KALEIDO, ImVec4(80, 80, 50, 255), false, true, true), - COSMETIC_OPTION("Kal_MapSelectA", "Map Color", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, false), - COSMETIC_OPTION("Kal_MapSelectB", "Map Color B", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), - COSMETIC_OPTION("Kal_MapSelectC", "Map Color C", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), - COSMETIC_OPTION("Kal_MapSelectD", "Map Color D", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, true), + COSMETIC_OPTION("Kaleido.MapSelectA", "Map Color", COSMETICS_GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, false), + COSMETIC_OPTION("Kaleido.MapSelectB", "Map Color B", COSMETICS_GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), + COSMETIC_OPTION("Kaleido.MapSelectC", "Map Color C", COSMETICS_GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), + COSMETIC_OPTION("Kaleido.MapSelectD", "Map Color D", COSMETICS_GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, true), - COSMETIC_OPTION("Kal_SaveA", "Save Color", GROUP_KALEIDO, ImVec4(50, 50, 50, 255), false, true, false), - COSMETIC_OPTION("Kal_SaveB", "Save Color B", GROUP_KALEIDO, ImVec4(110, 110, 110, 255), false, true, true), - COSMETIC_OPTION("Kal_SaveC", "Save Color C", GROUP_KALEIDO, ImVec4(110, 110, 110, 255), false, true, true), - COSMETIC_OPTION("Kal_SaveD", "Save Color D", GROUP_KALEIDO, ImVec4(50, 50, 50, 255), false, true, true), + COSMETIC_OPTION("Kaleido.SaveA", "Save Color", COSMETICS_GROUP_KALEIDO, ImVec4(50, 50, 50, 255), false, true, false), + COSMETIC_OPTION("Kaleido.SaveB", "Save Color B", COSMETICS_GROUP_KALEIDO, ImVec4(110, 110, 110, 255), false, true, true), + COSMETIC_OPTION("Kaleido.SaveC", "Save Color C", COSMETICS_GROUP_KALEIDO, ImVec4(110, 110, 110, 255), false, true, true), + COSMETIC_OPTION("Kaleido.SaveD", "Save Color D", COSMETICS_GROUP_KALEIDO, ImVec4(50, 50, 50, 255), false, true, true), - COSMETIC_OPTION("Kal_NamePanel", "Name Panel", GROUP_KALEIDO, ImVec4(90,100,130,255), true, true, false), + COSMETIC_OPTION("Kaleido.NamePanel", "Name Panel", COSMETICS_GROUP_KALEIDO, ImVec4(90,100,130,255), true, true, false), - COSMETIC_OPTION("Title_FileChoose", "File Choose", GROUP_TITLE, ImVec4(100, 150, 255, 255), false, true, false), - COSMETIC_OPTION("Title_NintendoLogo", "Nintendo Logo", GROUP_TITLE, ImVec4( 0, 0, 255, 255), false, true, true), - COSMETIC_OPTION("Title_N64LogoRed", "N64 Red", GROUP_TITLE, ImVec4(150, 0, 0, 255), false, true, true), - COSMETIC_OPTION("Title_N64LogoBlue", "N64 Blue", GROUP_TITLE, ImVec4( 0, 50, 150, 255), false, true, true), - COSMETIC_OPTION("Title_N64LogoGreen", "N64 Green", GROUP_TITLE, ImVec4( 50, 100, 0, 255), false, true, true), - COSMETIC_OPTION("Title_N64LogoYellow", "N64 Yellow", GROUP_TITLE, ImVec4(200, 150, 0, 255), false, true, true), - // COSMETIC_OPTION("Title_FirePrimary", "Title Fire Primary", GROUP_TITLE, ImVec4(255, 255, 170, 255), false, true, false), // Todo (Cosmetics): Kinda complicated - // COSMETIC_OPTION("Title_FireSecondary", "Title Fire Secondary", GROUP_TITLE, ImVec4(255, 100, 0, 255), false, true, true), // Todo (Cosmetics): Kinda complicated + COSMETIC_OPTION("Title.FileChoose", "File Choose", COSMETICS_GROUP_TITLE, ImVec4(100, 150, 255, 255), false, true, false), + COSMETIC_OPTION("Title.NintendoLogo", "Nintendo Logo", COSMETICS_GROUP_TITLE, ImVec4( 0, 0, 255, 255), false, true, true), + COSMETIC_OPTION("Title.N64LogoRed", "N64 Red", COSMETICS_GROUP_TITLE, ImVec4(150, 0, 0, 255), false, true, true), + COSMETIC_OPTION("Title.N64LogoBlue", "N64 Blue", COSMETICS_GROUP_TITLE, ImVec4( 0, 50, 150, 255), false, true, true), + COSMETIC_OPTION("Title.N64LogoGreen", "N64 Green", COSMETICS_GROUP_TITLE, ImVec4( 50, 100, 0, 255), false, true, true), + COSMETIC_OPTION("Title.N64LogoYellow", "N64 Yellow", COSMETICS_GROUP_TITLE, ImVec4(200, 150, 0, 255), false, true, true), + // COSMETIC_OPTION("Title.FirePrimary", "Title Fire Primary", COSMETICS_GROUP_TITLE, ImVec4(255, 255, 170, 255), false, true, false), // Todo (Cosmetics): Kinda complicated + // COSMETIC_OPTION("Title.FireSecondary", "Title Fire Secondary", COSMETICS_GROUP_TITLE, ImVec4(255, 100, 0, 255), false, true, true), // Todo (Cosmetics): Kinda complicated - COSMETIC_OPTION("Arrows_NormalPrimary", "Normal Primary", GROUP_ARROWS, ImVec4( 0, 150, 0, 0), false, true, false), - COSMETIC_OPTION("Arrows_NormalSecondary", "Normal Secondary", GROUP_ARROWS, ImVec4(255, 255, 170, 255), false, true, true), - COSMETIC_OPTION("Arrows_FirePrimary", "Fire Primary", GROUP_ARROWS, ImVec4(255, 200, 0, 0), false, true, false), - COSMETIC_OPTION("Arrows_FireSecondary", "Fire Secondary", GROUP_ARROWS, ImVec4(255, 0, 0, 255), false, true, true), - COSMETIC_OPTION("Arrows_IcePrimary", "Ice Primary", GROUP_ARROWS, ImVec4( 0, 0, 255, 255), false, true, false), - COSMETIC_OPTION("Arrows_IceSecondary", "Ice Secondary", GROUP_ARROWS, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("Arrows_LightPrimary", "Light Primary", GROUP_ARROWS, ImVec4(255, 255, 0, 255), false, true, false), - COSMETIC_OPTION("Arrows_LightSecondary", "Light Secondary", GROUP_ARROWS, ImVec4(255, 255, 170, 0), false, true, true), + COSMETIC_OPTION("Arrows.NormalPrimary", "Normal Primary", COSMETICS_GROUP_ARROWS, ImVec4( 0, 150, 0, 0), false, true, false), + COSMETIC_OPTION("Arrows.NormalSecondary", "Normal Secondary", COSMETICS_GROUP_ARROWS, ImVec4(255, 255, 170, 255), false, true, true), + COSMETIC_OPTION("Arrows.FirePrimary", "Fire Primary", COSMETICS_GROUP_ARROWS, ImVec4(255, 200, 0, 0), false, true, false), + COSMETIC_OPTION("Arrows.FireSecondary", "Fire Secondary", COSMETICS_GROUP_ARROWS, ImVec4(255, 0, 0, 255), false, true, true), + COSMETIC_OPTION("Arrows.IcePrimary", "Ice Primary", COSMETICS_GROUP_ARROWS, ImVec4( 0, 0, 255, 255), false, true, false), + COSMETIC_OPTION("Arrows.IceSecondary", "Ice Secondary", COSMETICS_GROUP_ARROWS, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("Arrows.LightPrimary", "Light Primary", COSMETICS_GROUP_ARROWS, ImVec4(255, 255, 0, 255), false, true, false), + COSMETIC_OPTION("Arrows.LightSecondary", "Light Secondary", COSMETICS_GROUP_ARROWS, ImVec4(255, 255, 170, 0), false, true, true), - // COSMETIC_OPTION("Magic_DinsPrimary", "Din's Primary", GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, false), // Todo (Cosmetics): Replace gDF_Col - // COSMETIC_OPTION("Magic_DinsSecondary", "Din's Secondary", GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, true), // Todo (Cosmetics): Replace gDF_Env - // COSMETIC_OPTION("Magic_FaroresPrimary", "Farore's Primary", GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, false), // Todo (Cosmetics): Implement - // COSMETIC_OPTION("Magic_FaroresSecondary", "Farore's Secondary", GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, true), // Todo (Cosmetics): Implement - // COSMETIC_OPTION("Magic_NayrusPrimary", "Nayru's Primary", GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, false), // Todo (Cosmetics): Replace gNL_Diamond_Col / gNL_Orb_Col - // COSMETIC_OPTION("Magic_NayrusSecondary", "Nayru's Secondary", GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, true), // Todo (Cosmetics): Replace gNL_Diamond_Env / gNL_Orb_Env + // COSMETIC_OPTION("Magic.DinsPrimary", "Din's Primary", COSMETICS_GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, false), + // COSMETIC_OPTION("Magic.DinsSecondary", "Din's Secondary", COSMETICS_GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, true), + // COSMETIC_OPTION("Magic.FaroresPrimary", "Farore's Primary", COSMETICS_GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, false), // Todo (Cosmetics): Implement + // COSMETIC_OPTION("Magic.FaroresSecondary", "Farore's Secondary", COSMETICS_GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, true), // Todo (Cosmetics): Implement + // COSMETIC_OPTION("Magic.NayrusPrimary", "Nayru's Primary", COSMETICS_GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, false), + // COSMETIC_OPTION("Magic.NayrusSecondary", "Nayru's Secondary", COSMETICS_GROUP_MAGIC, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("SpinAttack_Level1Primary", "Level 1 Primary", GROUP_SPIN_ATTACK, ImVec4(170, 255, 255, 255), false, true, true), - COSMETIC_OPTION("SpinAttack_Level1Secondary", "Level 1 Secondary", GROUP_SPIN_ATTACK, ImVec4( 0, 100, 255, 255), false, true, false), - COSMETIC_OPTION("SpinAttack_Level2Primary", "Level 2 Primary", GROUP_SPIN_ATTACK, ImVec4(255, 255, 170, 255), false, true, true), - COSMETIC_OPTION("SpinAttack_Level2Secondary", "Level 2 Secondary", GROUP_SPIN_ATTACK, ImVec4(255, 100, 0, 255), false, true, false), + COSMETIC_OPTION("SpinAttack.Level1Primary", "Level 1 Primary", COSMETICS_GROUP_SPIN_ATTACK, ImVec4(170, 255, 255, 255), false, true, true), + COSMETIC_OPTION("SpinAttack.Level1Secondary", "Level 1 Secondary", COSMETICS_GROUP_SPIN_ATTACK, ImVec4( 0, 100, 255, 255), false, true, false), + COSMETIC_OPTION("SpinAttack.Level2Primary", "Level 2 Primary", COSMETICS_GROUP_SPIN_ATTACK, ImVec4(255, 255, 170, 255), false, true, true), + COSMETIC_OPTION("SpinAttack.Level2Secondary", "Level 2 Secondary", COSMETICS_GROUP_SPIN_ATTACK, ImVec4(255, 100, 0, 255), false, true, false), - COSMETIC_OPTION("Trails_Bombchu", "Bombchu", GROUP_TRAILS, ImVec4(250, 0, 0, 255), false, true, true), - COSMETIC_OPTION("Trails_Boomerang", "Boomerang", GROUP_TRAILS, ImVec4(255, 255, 100, 255), false, true, true), - COSMETIC_OPTION("Trails_KokiriSword", "Kokiri Sword", GROUP_TRAILS, ImVec4(255, 255, 255, 255), false, true, false), - COSMETIC_OPTION("Trails_MasterSword", "Master Sword", GROUP_TRAILS, ImVec4(255, 255, 255, 255), false, true, false), - COSMETIC_OPTION("Trails_BiggoronSword", "Biggoron Sword", GROUP_TRAILS, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("Trails_Stick", "Stick", GROUP_TRAILS, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("Trails_Hammer", "Hammer", GROUP_TRAILS, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("Trails.Bombchu", "Bombchu", COSMETICS_GROUP_TRAILS, ImVec4(250, 0, 0, 255), false, true, true), + COSMETIC_OPTION("Trails.Boomerang", "Boomerang", COSMETICS_GROUP_TRAILS, ImVec4(255, 255, 100, 255), false, true, true), + COSMETIC_OPTION("Trails.KokiriSword", "Kokiri Sword", COSMETICS_GROUP_TRAILS, ImVec4(255, 255, 255, 255), false, true, false), + COSMETIC_OPTION("Trails.MasterSword", "Master Sword", COSMETICS_GROUP_TRAILS, ImVec4(255, 255, 255, 255), false, true, false), + COSMETIC_OPTION("Trails.BiggoronSword", "Biggoron Sword", COSMETICS_GROUP_TRAILS, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("Trails.Stick", "Stick", COSMETICS_GROUP_TRAILS, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("Trails.Hammer", "Hammer", COSMETICS_GROUP_TRAILS, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("World_BlockOfTime", "Block of Time", GROUP_WORLD, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("World_Moon", "Moon", GROUP_WORLD, ImVec4(240, 255, 180, 255), false, true, true), - COSMETIC_OPTION("World_GossipStone", "Gossip Stone", GROUP_WORLD, ImVec4(200, 200, 200, 255), false, true, true), - COSMETIC_OPTION("World_RedIce", "Red Ice", GROUP_WORLD, ImVec4(255, 0, 0, 255), false, true, false), + COSMETIC_OPTION("World.BlockOfTime", "Block of Time", COSMETICS_GROUP_WORLD, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("World.Moon", "Moon", COSMETICS_GROUP_WORLD, ImVec4(240, 255, 180, 255), false, true, true), + COSMETIC_OPTION("World.GossipStone", "Gossip Stone", COSMETICS_GROUP_WORLD, ImVec4(200, 200, 200, 255), false, true, true), + COSMETIC_OPTION("World.RedIce", "Red Ice", COSMETICS_GROUP_WORLD, ImVec4(255, 0, 0, 255), false, true, false), - COSMETIC_OPTION("Navi_IdlePrimary", "Idle Primary", GROUP_NAVI, ImVec4(255, 255, 255, 255), false, true, false), - COSMETIC_OPTION("Navi_IdleSecondary", "Idle Secondary", GROUP_NAVI, ImVec4( 0, 0, 255, 0), false, true, true), - COSMETIC_OPTION("Navi_NPCPrimary", "NPC Primary", GROUP_NAVI, ImVec4(150, 150, 255, 255), false, true, false), - COSMETIC_OPTION("Navi_NPCSecondary", "NPC Secondary", GROUP_NAVI, ImVec4(150, 150, 255, 0), false, true, true), - COSMETIC_OPTION("Navi_EnemyPrimary", "Enemy Primary", GROUP_NAVI, ImVec4(255, 255, 0, 255), false, true, false), - COSMETIC_OPTION("Navi_EnemySecondary", "Enemy Secondary", GROUP_NAVI, ImVec4(200, 155, 0, 0), false, true, true), - COSMETIC_OPTION("Navi_PropsPrimary", "Props Primary", GROUP_NAVI, ImVec4( 0, 255, 0, 255), false, true, false), - COSMETIC_OPTION("Navi_PropsSecondary", "Props Secondary", GROUP_NAVI, ImVec4( 0, 255, 0, 0), false, true, true), + COSMETIC_OPTION("Navi.IdlePrimary", "Idle Primary", COSMETICS_GROUP_NAVI, ImVec4(255, 255, 255, 255), false, true, false), + COSMETIC_OPTION("Navi.IdleSecondary", "Idle Secondary", COSMETICS_GROUP_NAVI, ImVec4( 0, 0, 255, 0), false, true, true), + COSMETIC_OPTION("Navi.NPCPrimary", "NPC Primary", COSMETICS_GROUP_NAVI, ImVec4(150, 150, 255, 255), false, true, false), + COSMETIC_OPTION("Navi.NPCSecondary", "NPC Secondary", COSMETICS_GROUP_NAVI, ImVec4(150, 150, 255, 0), false, true, true), + COSMETIC_OPTION("Navi.EnemyPrimary", "Enemy Primary", COSMETICS_GROUP_NAVI, ImVec4(255, 255, 0, 255), false, true, false), + COSMETIC_OPTION("Navi.EnemySecondary", "Enemy Secondary", COSMETICS_GROUP_NAVI, ImVec4(200, 155, 0, 0), false, true, true), + COSMETIC_OPTION("Navi.PropsPrimary", "Props Primary", COSMETICS_GROUP_NAVI, ImVec4( 0, 255, 0, 255), false, true, false), + COSMETIC_OPTION("Navi.PropsSecondary", "Props Secondary", COSMETICS_GROUP_NAVI, ImVec4( 0, 255, 0, 0), false, true, true), - COSMETIC_OPTION("Ivan_IdlePrimary", "Ivan Idle Primary", GROUP_IVAN, ImVec4(255, 255, 255, 255), false, true, false), - COSMETIC_OPTION("Ivan_IdleSecondary", "Ivan Idle Secondary", GROUP_IVAN, ImVec4( 0, 255, 0, 255), false, true, true), + COSMETIC_OPTION("Ivan.IdlePrimary", "Ivan Idle Primary", COSMETICS_GROUP_IVAN, ImVec4(255, 255, 255, 255), false, true, false), + COSMETIC_OPTION("Ivan.IdleSecondary", "Ivan Idle Secondary", COSMETICS_GROUP_IVAN, ImVec4( 0, 255, 0, 255), false, true, true), - COSMETIC_OPTION("NPC_FireKeesePrimary", "Fire Keese Primary", GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, false), - COSMETIC_OPTION("NPC_FireKeeseSecondary", "Fire Keese Secondary", GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("NPC_IceKeesePrimary", "Ice Keese Primary", GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, false), - COSMETIC_OPTION("NPC_IceKeeseSecondary", "Ice Keese Secondary", GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("NPC.FireKeesePrimary", "Fire Keese Primary", COSMETICS_GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, false), + COSMETIC_OPTION("NPC.FireKeeseSecondary", "Fire Keese Secondary", COSMETICS_GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("NPC.IceKeesePrimary", "Ice Keese Primary", COSMETICS_GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, false), + COSMETIC_OPTION("NPC.IceKeeseSecondary", "Ice Keese Secondary", COSMETICS_GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, true), // Todo (Cosmetics): Health fairy - COSMETIC_OPTION("NPC_Dog1", "Dog 1", GROUP_NPC, ImVec4(255, 255, 200, 255), false, true, true), - COSMETIC_OPTION("NPC_Dog2", "Dog 2", GROUP_NPC, ImVec4(150, 100, 50, 255), false, true, true), - COSMETIC_OPTION("NPC_GoldenSkulltula", "Golden Skulltula", GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, false), - COSMETIC_OPTION("NPC_Kokiri", "Kokiri", GROUP_NPC, ImVec4( 0, 130, 70, 255), false, true, false), - COSMETIC_OPTION("NPC_Gerudo", "Gerudo", GROUP_NPC, ImVec4( 90, 0, 140, 255), false, true, false), - COSMETIC_OPTION("NPC_MetalTrap", "Metal Trap", GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, true), - COSMETIC_OPTION("NPC_IronKnuckles", "Iron Knuckles", GROUP_NPC, ImVec4(245, 255, 205, 255), false, true, false), + COSMETIC_OPTION("NPC.Dog1", "Dog 1", COSMETICS_GROUP_NPC, ImVec4(255, 255, 200, 255), false, true, true), + COSMETIC_OPTION("NPC.Dog2", "Dog 2", COSMETICS_GROUP_NPC, ImVec4(150, 100, 50, 255), false, true, true), + COSMETIC_OPTION("NPC.GoldenSkulltula", "Golden Skulltula", COSMETICS_GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, false), + COSMETIC_OPTION("NPC.Kokiri", "Kokiri", COSMETICS_GROUP_NPC, ImVec4( 0, 130, 70, 255), false, true, false), + COSMETIC_OPTION("NPC.Gerudo", "Gerudo", COSMETICS_GROUP_NPC, ImVec4( 90, 0, 140, 255), false, true, false), + COSMETIC_OPTION("NPC.MetalTrap", "Metal Trap", COSMETICS_GROUP_NPC, ImVec4(255, 255, 255, 255), false, true, true), + COSMETIC_OPTION("NPC.IronKnuckles", "Iron Knuckles", COSMETICS_GROUP_NPC, ImVec4(245, 255, 205, 255), false, true, false), }; static const char* MarginCvarList[] { - "gHearts", "gHeartsCount", "gMagicBar", "gVSOA", "gBBtn", "gABtn", "gStartBtn", - "gCBtnU", "gCBtnD", "gCBtnL", "gCBtnR", "gDPad", "gMinimap", - "gSKC", "gRC", "gCarrots", "gTimers", "gAS", "gTCM", "gTCB", "gIGT" + CVAR_COSMETIC("HUD.Hearts"), CVAR_COSMETIC("HUD.HeartsCount"), CVAR_COSMETIC("HUD.MagicBar"), CVAR_COSMETIC("HUD.VisualSoA"), CVAR_COSMETIC("HUD.BButton"), CVAR_COSMETIC("HUD.AButton"), CVAR_COSMETIC("HUD.StartButton"), + CVAR_COSMETIC("HUD.CUpButton"), CVAR_COSMETIC("HUD.CDownButton"), CVAR_COSMETIC("HUD.CLeftButton"), CVAR_COSMETIC("HUD.CRightButton"), CVAR_COSMETIC("HUD.Dpad"), CVAR_COSMETIC("HUD.Minimap"), + CVAR_COSMETIC("HUD.SmallKey"), CVAR_COSMETIC("HUD.Rupees"), CVAR_COSMETIC("HUD.Carrots"), CVAR_COSMETIC("HUD.Timers"), CVAR_COSMETIC("HUD.ArcheryScore"), CVAR_COSMETIC("HUD.TitleCard.Map"), CVAR_COSMETIC("HUD.TitleCard.Boss"), CVAR_COSMETIC("HUD.IGT") }; -static const char* MarginCvarNonAnchor[]{ "gCarrots", "gTimers", "gAS", "gTCM","gTCB" }; +static const char* MarginCvarNonAnchor[]{ CVAR_COSMETIC("HUD.Carrots"), CVAR_COSMETIC("HUD.Timers"), CVAR_COSMETIC("HUD.ArcheryScore"), CVAR_COSMETIC("HUD.TitleCard.Map"),CVAR_COSMETIC("HUD.TitleCard.Boss") }; ImVec4 GetRandomValue(int MaximumPossible){ ImVec4 NewColor; @@ -400,8 +380,8 @@ void SetMarginAll(const char* ButtonName, bool SetActivated) { //MarginCvarNonAnchor is an array that list every element that has No anchor by default, because if that the case this function will not touch it with pose type 0. u8 arrayLengthNonMargin = sizeof(MarginCvarNonAnchor) / sizeof(*MarginCvarNonAnchor); for (auto cvarName : MarginCvarList) { - std::string cvarPosType = std::string(cvarName).append("PosType"); - std::string cvarNameMargins = std::string(cvarName).append("UseMargins"); + std::string cvarPosType = std::string(cvarName).append(".PosType"); + std::string cvarNameMargins = std::string(cvarName).append(".UseMargins"); if (CVarGetInteger(cvarPosType.c_str(),0) <= 2 && SetActivated) { //Our element is not Hidden or Non anchor for (int i = 0; i < arrayLengthNonMargin; i++){ if ((strcmp(cvarName, MarginCvarNonAnchor[i]) == 0) && (CVarGetInteger(cvarPosType.c_str(), 0) == 0)) { //Our element is both in original position and do not have anchor by default so we skip it. @@ -424,8 +404,8 @@ void SetMarginAll(const char* ButtonName, bool SetActivated) { void ResetPositionAll() { if (ImGui::Button("Reset all positions")) { for (auto cvarName : MarginCvarList) { - std::string cvarPosType = std::string(cvarName).append("PosType"); - std::string cvarNameMargins = std::string(cvarName).append("UseMargins"); + std::string cvarPosType = std::string(cvarName).append(".PosType"); + std::string cvarNameMargins = std::string(cvarName).append(".UseMargins"); CVarSetInteger(cvarPosType.c_str(), 0); CVarSetInteger(cvarNameMargins.c_str(), false); //Turn margin off to everythings as that original position. } @@ -437,7 +417,7 @@ int hue = 0; // Runs every frame to update rainbow hue, a potential future optimization is to only run this a once or twice a second and increase the speed of the rainbow hue rotation. void CosmeticsUpdateTick() { int index = 0; - float rainbowSpeed = CVarGetFloat("gCosmetics.RainbowSpeed", 0.6f); + float rainbowSpeed = CVarGetFloat(CVAR_COSMETIC("RainbowSpeed"), 0.6f); for (auto& [id, cosmeticOption] : cosmeticOptions) { if (cosmeticOption.supportsRainbow && CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { float frequency = 2 * M_PI / (360 * rainbowSpeed); @@ -461,7 +441,7 @@ void CosmeticsUpdateTick() { // If we don't want the rainbow color on items to be synced, offset the index for each item in the loop. // Technically this would work if you replaced "60" with 1 but the hue would be so close it's // indistinguishable, 60 gives us a big enough gap to notice the difference. - if (!CVarGetInteger("gCosmetics.RainbowSync", 0)) { + if (!CVarGetInteger(CVAR_COSMETIC("RainbowSync"), 0)) { index+= (60 * rainbowSpeed); } } @@ -480,7 +460,7 @@ void CosmeticsUpdateTick() { 5. GFX Command: The GFX command you want to insert */ void ApplyOrResetCustomGfxPatches(bool manualChange) { - static CosmeticOption& linkGoronTunic = cosmeticOptions.at("Link_GoronTunic"); + static CosmeticOption& linkGoronTunic = cosmeticOptions.at("Link.GoronTunic"); if (manualChange || CVarGetInteger(linkGoronTunic.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {linkGoronTunic.defaultColor.x, linkGoronTunic.defaultColor.y, linkGoronTunic.defaultColor.z, linkGoronTunic.defaultColor.w}; Color_RGBA8 color = CVarGetColor(linkGoronTunic.cvar, defaultColor); @@ -490,7 +470,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGiGoronCollarColorDL, "Link_GoronTunic4", linkGoronTunic.changedCvar, 4, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); } - static CosmeticOption& linkZoraTunic = cosmeticOptions.at("Link_ZoraTunic"); + static CosmeticOption& linkZoraTunic = cosmeticOptions.at("Link.ZoraTunic"); if (manualChange || CVarGetInteger(linkZoraTunic.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {linkZoraTunic.defaultColor.x, linkZoraTunic.defaultColor.y, linkZoraTunic.defaultColor.z, linkZoraTunic.defaultColor.w}; Color_RGBA8 color = CVarGetColor(linkZoraTunic.cvar, defaultColor); @@ -500,7 +480,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGiZoraCollarColorDL, "Link_ZoraTunic4", linkZoraTunic.changedCvar, 4, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); } - static CosmeticOption& linkHair = cosmeticOptions.at("Link_Hair"); + static CosmeticOption& linkHair = cosmeticOptions.at("Link.Hair"); if (manualChange || CVarGetInteger(linkHair.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {linkHair.defaultColor.x, linkHair.defaultColor.y, linkHair.defaultColor.z, linkHair.defaultColor.w}; Color_RGBA8 color = CVarGetColor(linkHair.cvar, defaultColor); @@ -523,7 +503,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { } } - static CosmeticOption& linkLinen = cosmeticOptions.at("Link_Linen"); + static CosmeticOption& linkLinen = cosmeticOptions.at("Link.Linen"); if (manualChange || CVarGetInteger(linkLinen.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {linkLinen.defaultColor.x, linkLinen.defaultColor.y, linkLinen.defaultColor.z, linkLinen.defaultColor.w}; Color_RGBA8 color = CVarGetColor(linkLinen.cvar, defaultColor); @@ -565,7 +545,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { } } - static CosmeticOption& linkBoots = cosmeticOptions.at("Link_Boots"); + static CosmeticOption& linkBoots = cosmeticOptions.at("Link.Boots"); if (manualChange || CVarGetInteger(linkBoots.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {linkBoots.defaultColor.x, linkBoots.defaultColor.y, linkBoots.defaultColor.z, linkBoots.defaultColor.w}; Color_RGBA8 color = CVarGetColor(linkBoots.cvar, defaultColor); @@ -602,7 +582,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { } } - static CosmeticOption& mirrorShieldBody = cosmeticOptions.at("MirrorShield_Body"); + static CosmeticOption& mirrorShieldBody = cosmeticOptions.at("MirrorShield.Body"); if (manualChange || CVarGetInteger(mirrorShieldBody.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {mirrorShieldBody.defaultColor.x, mirrorShieldBody.defaultColor.y, mirrorShieldBody.defaultColor.z, mirrorShieldBody.defaultColor.w}; Color_RGBA8 color = CVarGetColor(mirrorShieldBody.cvar, defaultColor); @@ -615,7 +595,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkAdultRightHandHoldingMirrorShieldNearDL, "MirrorShield_Body7", mirrorShieldBody.changedCvar, 28, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gLinkAdultRightHandHoldingMirrorShieldFarDL, "MirrorShield_Body8", mirrorShieldBody.changedCvar, 95, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& mirrorShieldMirror = cosmeticOptions.at("MirrorShield_Mirror"); + static CosmeticOption& mirrorShieldMirror = cosmeticOptions.at("MirrorShield.Mirror"); if (manualChange || CVarGetInteger(mirrorShieldMirror.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {mirrorShieldMirror.defaultColor.x, mirrorShieldMirror.defaultColor.y, mirrorShieldMirror.defaultColor.z, mirrorShieldMirror.defaultColor.w}; Color_RGBA8 color = CVarGetColor(mirrorShieldMirror.cvar, defaultColor); @@ -628,7 +608,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkAdultRightHandHoldingMirrorShieldNearDL, "MirrorShield_Mirror7", mirrorShieldMirror.changedCvar, 17, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gLinkAdultRightHandHoldingMirrorShieldFarDL, "MirrorShield_Mirror8", mirrorShieldMirror.changedCvar, 111, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& mirrorShieldEmblem = cosmeticOptions.at("MirrorShield_Emblem"); + static CosmeticOption& mirrorShieldEmblem = cosmeticOptions.at("MirrorShield.Emblem"); if (manualChange || CVarGetInteger(mirrorShieldEmblem.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {mirrorShieldEmblem.defaultColor.x, mirrorShieldEmblem.defaultColor.y, mirrorShieldEmblem.defaultColor.z, mirrorShieldEmblem.defaultColor.w}; Color_RGBA8 color = CVarGetColor(mirrorShieldEmblem.cvar, defaultColor); @@ -642,7 +622,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkAdultRightHandHoldingMirrorShieldFarDL, "MirrorShield_Emblem8", mirrorShieldEmblem.changedCvar, 133, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& swordsKokiriBlade = cosmeticOptions.at("Swords_KokiriBlade"); + static CosmeticOption& swordsKokiriBlade = cosmeticOptions.at("Swords.KokiriBlade"); if (manualChange || CVarGetInteger(swordsKokiriBlade.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {swordsKokiriBlade.defaultColor.x, swordsKokiriBlade.defaultColor.y, swordsKokiriBlade.defaultColor.z, swordsKokiriBlade.defaultColor.w}; Color_RGBA8 color = CVarGetColor(swordsKokiriBlade.cvar, defaultColor); @@ -651,7 +631,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGiKokiriSwordDL, "Swords_KokiriBlade3", swordsKokiriBlade.changedCvar, 5, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gGiKokiriSwordDL, "Swords_KokiriBlade4", swordsKokiriBlade.changedCvar, 6, gsDPSetEnvColor(color.r / 4, color.g / 4, color.b / 4, 255)); } - // static CosmeticOption& swordsKokiriHilt = cosmeticOptions.at("Swords_KokiriHilt"); + // static CosmeticOption& swordsKokiriHilt = cosmeticOptions.at("Swords.KokiriHilt"); // if (manualChange || CVarGetInteger(swordsKokiriHilt.rainbowCvar, 0)) { // static Color_RGBA8 defaultColor = {swordsKokiriHilt.defaultColor.x, swordsKokiriHilt.defaultColor.y, swordsKokiriHilt.defaultColor.z, swordsKokiriHilt.defaultColor.w}; // Color_RGBA8 color = CVarGetColor(swordsKokiriHilt.cvar, defaultColor); @@ -692,7 +672,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { // PATCH_GFX(gLinkChildHylianShieldSwordAndSheathFarDL, "Swords_KokiriHilt33", swordsKokiriHilt.changedCvar, 118, gsSPGrayscale(false)); // } // } - static CosmeticOption& swordsMasterBlade = cosmeticOptions.at("Swords_MasterBlade"); + static CosmeticOption& swordsMasterBlade = cosmeticOptions.at("Swords.MasterBlade"); if (manualChange || CVarGetInteger(swordsMasterBlade.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {swordsMasterBlade.defaultColor.x, swordsMasterBlade.defaultColor.y, swordsMasterBlade.defaultColor.z, swordsMasterBlade.defaultColor.w}; Color_RGBA8 color = CVarGetColor(swordsMasterBlade.cvar, defaultColor); @@ -703,7 +683,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGanonMasterSwordDL, "Swords_MasterBlade5", swordsMasterBlade.changedCvar, 13, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gGanonMasterSwordDL, "Swords_MasterBlade6", swordsMasterBlade.changedCvar, 14, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); } - // static CosmeticOption& swordsMasterHilt = cosmeticOptions.at("Swords_MasterHilt"); + // static CosmeticOption& swordsMasterHilt = cosmeticOptions.at("Swords.MasterHilt"); // if (manualChange || CVarGetInteger(swordsMasterHilt.rainbowCvar, 0)) { // static Color_RGBA8 defaultColor = {swordsMasterHilt.defaultColor.x, swordsMasterHilt.defaultColor.y, swordsMasterHilt.defaultColor.z, swordsMasterHilt.defaultColor.w}; // Color_RGBA8 color = CVarGetColor(swordsMasterHilt.cvar, defaultColor); @@ -750,7 +730,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { // PATCH_GFX(gGanonMasterSwordDL, "Swords_MasterHilt39", swordsMasterHilt.changedCvar, 280, gsSPEndDisplayList()); // } // } - static CosmeticOption& swordsBiggoronBlade = cosmeticOptions.at("Swords_BiggoronBlade"); + static CosmeticOption& swordsBiggoronBlade = cosmeticOptions.at("Swords.BiggoronBlade"); if (manualChange || CVarGetInteger(swordsBiggoronBlade.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {swordsBiggoronBlade.defaultColor.x, swordsBiggoronBlade.defaultColor.y, swordsBiggoronBlade.defaultColor.z, swordsBiggoronBlade.defaultColor.w}; Color_RGBA8 color = CVarGetColor(swordsBiggoronBlade.cvar, defaultColor); @@ -759,7 +739,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGiBiggoronSwordDL, "Swords_BiggoronBlade3", swordsBiggoronBlade.changedCvar, 5, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gGiBiggoronSwordDL, "Swords_BiggoronBlade4", swordsBiggoronBlade.changedCvar, 6, gsDPSetEnvColor(color.r / 3, color.g / 3, color.b / 3, 255)); } - // static CosmeticOption& swordsBiggoronHilt = cosmeticOptions.at("Swords_BiggoronHilt"); + // static CosmeticOption& swordsBiggoronHilt = cosmeticOptions.at("Swords.BiggoronHilt"); // if (manualChange || CVarGetInteger(swordsBiggoronHilt.rainbowCvar, 0)) { // static Color_RGBA8 defaultColor = {swordsBiggoronHilt.defaultColor.x, swordsBiggoronHilt.defaultColor.y, swordsBiggoronHilt.defaultColor.z, swordsBiggoronHilt.defaultColor.w}; // Color_RGBA8 color = CVarGetColor(swordsBiggoronHilt.cvar, defaultColor); @@ -779,7 +759,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { // } // } - static CosmeticOption& glovesGoronBracelet = cosmeticOptions.at("Gloves_GoronBracelet"); + static CosmeticOption& glovesGoronBracelet = cosmeticOptions.at("Gloves.GoronBracelet"); if (manualChange || CVarGetInteger(glovesGoronBracelet.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {glovesGoronBracelet.defaultColor.x, glovesGoronBracelet.defaultColor.y, glovesGoronBracelet.defaultColor.z, glovesGoronBracelet.defaultColor.w}; Color_RGBA8 color = CVarGetColor(glovesGoronBracelet.cvar, defaultColor); @@ -792,21 +772,21 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkChildGoronBraceletDL, "Gloves_GoronBracelet5", glovesGoronBracelet.changedCvar, 39, gsSPGrayscale(false)); } } - static CosmeticOption& glovesSilverGauntlets = cosmeticOptions.at("Gloves_SilverGauntlets"); + static CosmeticOption& glovesSilverGauntlets = cosmeticOptions.at("Gloves.SilverGauntlets"); if (manualChange || CVarGetInteger(glovesSilverGauntlets.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {glovesSilverGauntlets.defaultColor.x, glovesSilverGauntlets.defaultColor.y, glovesSilverGauntlets.defaultColor.z, glovesSilverGauntlets.defaultColor.w}; Color_RGBA8 color = CVarGetColor(glovesSilverGauntlets.cvar, defaultColor); PATCH_GFX(gGiSilverGauntletsColorDL, "Gloves_SilverGauntlets1", glovesSilverGauntlets.changedCvar, 3, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gGiSilverGauntletsColorDL, "Gloves_SilverGauntlets2", glovesSilverGauntlets.changedCvar, 4, gsDPSetEnvColor(color.r / 3, color.g / 3, color.b / 3, 255)); } - static CosmeticOption& glovesGoldenGauntlets = cosmeticOptions.at("Gloves_GoldenGauntlets"); + static CosmeticOption& glovesGoldenGauntlets = cosmeticOptions.at("Gloves.GoldenGauntlets"); if (manualChange || CVarGetInteger(glovesGoldenGauntlets.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {glovesGoldenGauntlets.defaultColor.x, glovesGoldenGauntlets.defaultColor.y, glovesGoldenGauntlets.defaultColor.z, glovesGoldenGauntlets.defaultColor.w}; Color_RGBA8 color = CVarGetColor(glovesGoldenGauntlets.cvar, defaultColor); PATCH_GFX(gGiGoldenGauntletsColorDL, "Gloves_GoldenGauntlets1", glovesGoldenGauntlets.changedCvar, 3, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gGiGoldenGauntletsColorDL, "Gloves_GoldenGauntlets2", glovesGoldenGauntlets.changedCvar, 4, gsDPSetEnvColor(color.r / 3, color.g / 3, color.b / 3, 255)); } - static CosmeticOption& glovesGauntletsGem = cosmeticOptions.at("Gloves_GauntletsGem"); + static CosmeticOption& glovesGauntletsGem = cosmeticOptions.at("Gloves.GauntletsGem"); if (manualChange || CVarGetInteger(glovesGauntletsGem.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {glovesGauntletsGem.defaultColor.x, glovesGauntletsGem.defaultColor.y, glovesGauntletsGem.defaultColor.z, glovesGauntletsGem.defaultColor.w}; Color_RGBA8 color = CVarGetColor(glovesGauntletsGem.cvar, defaultColor); @@ -818,7 +798,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkAdultRightGauntletPlate3DL, "Gloves_GauntletsGem6", glovesGauntletsGem.changedCvar, 42, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& equipmentBoomerangBody = cosmeticOptions.at("Equipment_BoomerangBody"); + static CosmeticOption& equipmentBoomerangBody = cosmeticOptions.at("Equipment.BoomerangBody"); if (manualChange || CVarGetInteger(equipmentBoomerangBody.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentBoomerangBody.defaultColor.x, equipmentBoomerangBody.defaultColor.y, equipmentBoomerangBody.defaultColor.z, equipmentBoomerangBody.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentBoomerangBody.cvar, defaultColor); @@ -828,7 +808,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkChildLeftFistAndBoomerangFarDL, "Equipment_BoomerangBody4", equipmentBoomerangBody.changedCvar, 9, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gBoomerangDL, "Equipment_BoomerangBody5", equipmentBoomerangBody.changedCvar, 39, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& equipmentBoomerangGem = cosmeticOptions.at("Equipment_BoomerangGem"); + static CosmeticOption& equipmentBoomerangGem = cosmeticOptions.at("Equipment.BoomerangGem"); if (manualChange || CVarGetInteger(equipmentBoomerangGem.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentBoomerangGem.defaultColor.x, equipmentBoomerangGem.defaultColor.y, equipmentBoomerangGem.defaultColor.z, equipmentBoomerangGem.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentBoomerangGem.cvar, defaultColor); @@ -840,7 +820,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { // PATCH_GFX(gLinkChildLeftFistAndBoomerangFarDL, "Equipment_BoomerangGem5", equipmentBoomerangGem.changedCvar, 32, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - // static CosmeticOption& equipmentSlingshotBody = cosmeticOptions.at("Equipment_SlingshotBody"); + // static CosmeticOption& equipmentSlingshotBody = cosmeticOptions.at("Equipment.SlingshotBody"); // if (manualChange || CVarGetInteger(equipmentSlingshotBody.rainbowCvar, 0)) { // static Color_RGBA8 defaultColor = {equipmentSlingshotBody.defaultColor.x, equipmentSlingshotBody.defaultColor.y, equipmentSlingshotBody.defaultColor.z, equipmentSlingshotBody.defaultColor.w}; // Color_RGBA8 color = CVarGetColor(equipmentSlingshotBody.cvar, defaultColor); @@ -864,7 +844,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { // PATCH_GFX(gLinkChildRightHandHoldingSlingshotNearDL, "Equipment_SlingshotBody16",equipmentSlingshotBody.changedCvar, 138, gsSPEndDisplayList()); // } // } - static CosmeticOption& equipmentSlingshotString = cosmeticOptions.at("Equipment_SlingshotString"); + static CosmeticOption& equipmentSlingshotString = cosmeticOptions.at("Equipment.SlingshotString"); if (manualChange || CVarGetInteger(equipmentSlingshotString.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentSlingshotString.defaultColor.x, equipmentSlingshotString.defaultColor.y, equipmentSlingshotString.defaultColor.z, equipmentSlingshotString.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentSlingshotString.cvar, defaultColor); @@ -873,7 +853,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkChildSlinghotStringDL, "Equipment_SlingshotString3",equipmentSlingshotString.changedCvar, 9, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& equipmentBowTips = cosmeticOptions.at("Equipment_BowTips"); + static CosmeticOption& equipmentBowTips = cosmeticOptions.at("Equipment.BowTips"); if (manualChange || CVarGetInteger(equipmentBowTips.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentBowTips.defaultColor.x, equipmentBowTips.defaultColor.y, equipmentBowTips.defaultColor.z, equipmentBowTips.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentBowTips.cvar, defaultColor); @@ -883,7 +863,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkAdultRightHandHoldingBowNearDL, "Equipment_BowTips4", equipmentBowTips.changedCvar, 26, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gLinkAdultRightHandHoldingBowFarDL, "Equipment_BowTips5", equipmentBowTips.changedCvar, 25, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& equipmentBowString = cosmeticOptions.at("Equipment_BowString"); + static CosmeticOption& equipmentBowString = cosmeticOptions.at("Equipment.BowString"); if (manualChange || CVarGetInteger(equipmentBowString.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentBowString.defaultColor.x, equipmentBowString.defaultColor.y, equipmentBowString.defaultColor.z, equipmentBowString.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentBowString.cvar, defaultColor); @@ -891,7 +871,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGiBowDL, "Equipment_BowString2", equipmentBowString.changedCvar, 106, gsDPSetEnvColor(color.r / 3, color.g / 3, color.b / 3, 255)); PATCH_GFX(gLinkAdultBowStringDL, "Equipment_BowString3", equipmentBowString.changedCvar, 9, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& equipmentBowBody = cosmeticOptions.at("Equipment_BowBody"); + static CosmeticOption& equipmentBowBody = cosmeticOptions.at("Equipment.BowBody"); if (manualChange || CVarGetInteger(equipmentBowBody.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentBowBody.defaultColor.x, equipmentBowBody.defaultColor.y, equipmentBowBody.defaultColor.z, equipmentBowBody.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentBowBody.cvar, defaultColor); @@ -901,7 +881,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkAdultRightHandHoldingBowNearDL, "Equipment_BowBody4", equipmentBowBody.changedCvar, 33, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gLinkAdultRightHandHoldingBowFarDL, "Equipment_BowBody5", equipmentBowBody.changedCvar, 31, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& equipmentBowHandle = cosmeticOptions.at("Equipment_BowHandle"); + static CosmeticOption& equipmentBowHandle = cosmeticOptions.at("Equipment.BowHandle"); if (manualChange || CVarGetInteger(equipmentBowHandle.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentBowHandle.defaultColor.x, equipmentBowHandle.defaultColor.y, equipmentBowHandle.defaultColor.z, equipmentBowHandle.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentBowHandle.cvar, defaultColor); @@ -912,7 +892,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkAdultRightHandHoldingBowFarDL, "Equipment_BowHandle5", equipmentBowHandle.changedCvar, 18, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& equipmentHammerHead = cosmeticOptions.at("Equipment_HammerHead"); + static CosmeticOption& equipmentHammerHead = cosmeticOptions.at("Equipment.HammerHead"); if (manualChange || CVarGetInteger(equipmentHammerHead.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentHammerHead.defaultColor.x, equipmentHammerHead.defaultColor.y, equipmentHammerHead.defaultColor.z, equipmentHammerHead.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentHammerHead.cvar, defaultColor); @@ -923,7 +903,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkAdultLeftHandHoldingHammerNearDL, "Equipment_HammerHead5", equipmentHammerHead.changedCvar, 38, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gLinkAdultLeftHandHoldingHammerFarDL, "Equipment_HammerHead6", equipmentHammerHead.changedCvar, 38, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& equipmentHammerHandle = cosmeticOptions.at("Equipment_HammerHandle"); + static CosmeticOption& equipmentHammerHandle = cosmeticOptions.at("Equipment.HammerHandle"); if (manualChange || CVarGetInteger(equipmentHammerHandle.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentHammerHandle.defaultColor.x, equipmentHammerHandle.defaultColor.y, equipmentHammerHandle.defaultColor.z, equipmentHammerHandle.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentHammerHandle.cvar, defaultColor); @@ -933,7 +913,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gLinkAdultLeftHandHoldingHammerFarDL, "Equipment_HammerHandle6", equipmentHammerHandle.changedCvar, 18, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& equipmentChuFace = cosmeticOptions.at("Equipment_ChuFace"); + static CosmeticOption& equipmentChuFace = cosmeticOptions.at("Equipment.ChuFace"); if (manualChange || CVarGetInteger(equipmentChuFace.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentChuFace.defaultColor.x, equipmentChuFace.defaultColor.y, equipmentChuFace.defaultColor.z, equipmentChuFace.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentChuFace.cvar, defaultColor); @@ -946,7 +926,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gBombchuDL, "Equipment_ChuFace5", equipmentChuFace.changedCvar, 27, gsSPGrayscale(false)); } } - static CosmeticOption& equipmentChuBody = cosmeticOptions.at("Equipment_ChuBody"); + static CosmeticOption& equipmentChuBody = cosmeticOptions.at("Equipment.ChuBody"); if (manualChange || CVarGetInteger(equipmentChuBody.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentChuBody.defaultColor.x, equipmentChuBody.defaultColor.y, equipmentChuBody.defaultColor.z, equipmentChuBody.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentChuBody.cvar, defaultColor); @@ -957,7 +937,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gBombchuDL, "Equipment_ChuBody5", equipmentChuBody.changedCvar, 46, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& equipmentBunnyHood = cosmeticOptions.at("Equipment_BunnyHood"); + static CosmeticOption& equipmentBunnyHood = cosmeticOptions.at("Equipment.BunnyHood"); if (manualChange || CVarGetInteger(equipmentBunnyHood.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {equipmentBunnyHood.defaultColor.x, equipmentBunnyHood.defaultColor.y, equipmentBunnyHood.defaultColor.z, equipmentBunnyHood.defaultColor.w}; Color_RGBA8 color = CVarGetColor(equipmentBunnyHood.cvar, defaultColor); @@ -977,7 +957,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { } } - static CosmeticOption& consumableGreenRupee = cosmeticOptions.at("Consumable_GreenRupee"); + static CosmeticOption& consumableGreenRupee = cosmeticOptions.at("Consumable.GreenRupee"); if (manualChange || CVarGetInteger(consumableGreenRupee.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {consumableGreenRupee.defaultColor.x, consumableGreenRupee.defaultColor.y, consumableGreenRupee.defaultColor.z, consumableGreenRupee.defaultColor.w}; Color_RGBA8 color = CVarGetColor(consumableGreenRupee.cvar, defaultColor); @@ -997,7 +977,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { ResourceMgr_UnpatchGfxByName(gRainbowBridgeDL, "RainbowBridge_EndGrayscaleAndEndDlist"); } } - static CosmeticOption& consumableBlueRupee = cosmeticOptions.at("Consumable_BlueRupee"); + static CosmeticOption& consumableBlueRupee = cosmeticOptions.at("Consumable.BlueRupee"); if (manualChange || CVarGetInteger(consumableBlueRupee.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {consumableBlueRupee.defaultColor.x, consumableBlueRupee.defaultColor.y, consumableBlueRupee.defaultColor.z, consumableBlueRupee.defaultColor.w}; Color_RGBA8 color = CVarGetColor(consumableBlueRupee.cvar, defaultColor); @@ -1006,7 +986,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGiBlueRupeeOuterColorDL, "Consumable_BlueRupee3", consumableBlueRupee.changedCvar, 3, gsDPSetPrimColor(0, 0, MIN(color.r + 100, 255), MIN(color.g + 100, 255), MIN(color.b + 100, 255), 255)); PATCH_GFX(gGiBlueRupeeOuterColorDL, "Consumable_BlueRupee4", consumableBlueRupee.changedCvar, 4, gsDPSetEnvColor(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, 255)); } - static CosmeticOption& consumableRedRupee = cosmeticOptions.at("Consumable_RedRupee"); + static CosmeticOption& consumableRedRupee = cosmeticOptions.at("Consumable.RedRupee"); if (manualChange || CVarGetInteger(consumableRedRupee.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {consumableRedRupee.defaultColor.x, consumableRedRupee.defaultColor.y, consumableRedRupee.defaultColor.z, consumableRedRupee.defaultColor.w}; Color_RGBA8 color = CVarGetColor(consumableRedRupee.cvar, defaultColor); @@ -1015,7 +995,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGiRedRupeeOuterColorDL, "Consumable_RedRupee3", consumableRedRupee.changedCvar, 3, gsDPSetPrimColor(0, 0, MIN(color.r + 100, 255), MIN(color.g + 100, 255), MIN(color.b + 100, 255), 255)); PATCH_GFX(gGiRedRupeeOuterColorDL, "Consumable_RedRupee4", consumableRedRupee.changedCvar, 4, gsDPSetEnvColor(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, 255)); } - static CosmeticOption& consumablePurpleRupee = cosmeticOptions.at("Consumable_PurpleRupee"); + static CosmeticOption& consumablePurpleRupee = cosmeticOptions.at("Consumable.PurpleRupee"); if (manualChange || CVarGetInteger(consumablePurpleRupee.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {consumablePurpleRupee.defaultColor.x, consumablePurpleRupee.defaultColor.y, consumablePurpleRupee.defaultColor.z, consumablePurpleRupee.defaultColor.w}; Color_RGBA8 color = CVarGetColor(consumablePurpleRupee.cvar, defaultColor); @@ -1024,7 +1004,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGiPurpleRupeeOuterColorDL, "Consumable_PurpleRupee3", consumablePurpleRupee.changedCvar, 3, gsDPSetPrimColor(0, 0, MIN(color.r + 100, 255), MIN(color.g + 100, 255), MIN(color.b + 100, 255), 255)); PATCH_GFX(gGiPurpleRupeeOuterColorDL, "Consumable_PurpleRupee4", consumablePurpleRupee.changedCvar, 4, gsDPSetEnvColor(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, 255)); } - static CosmeticOption& consumableGoldRupee = cosmeticOptions.at("Consumable_GoldRupee"); + static CosmeticOption& consumableGoldRupee = cosmeticOptions.at("Consumable.GoldRupee"); if (manualChange || CVarGetInteger(consumableGoldRupee.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {consumableGoldRupee.defaultColor.x, consumableGoldRupee.defaultColor.y, consumableGoldRupee.defaultColor.z, consumableGoldRupee.defaultColor.w}; Color_RGBA8 color = CVarGetColor(consumableGoldRupee.cvar, defaultColor); @@ -1034,7 +1014,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGiGoldRupeeOuterColorDL, "Consumable_GoldRupee4", consumableGoldRupee.changedCvar, 4, gsDPSetEnvColor(color.r * 0.75f, color.g * 0.75f, color.b * 0.75f, 255)); } - static CosmeticOption& consumableHearts = cosmeticOptions.at("Consumable_Hearts"); + static CosmeticOption& consumableHearts = cosmeticOptions.at("Consumable.Hearts"); if (manualChange || CVarGetInteger(consumableHearts.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {consumableHearts.defaultColor.x, consumableHearts.defaultColor.y, consumableHearts.defaultColor.z, consumableHearts.defaultColor.w}; Color_RGBA8 color = CVarGetColor(consumableHearts.cvar, defaultColor); @@ -1049,7 +1029,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGiRedPotColorDL, "Consumable_Hearts9", consumableHearts.changedCvar, 3, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); PATCH_GFX(gGiRedPotColorDL, "Consumable_Hearts10", consumableHearts.changedCvar, 4, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); } - static CosmeticOption& consumableMagic = cosmeticOptions.at("Consumable_Magic"); + static CosmeticOption& consumableMagic = cosmeticOptions.at("Consumable.Magic"); if (manualChange || CVarGetInteger(consumableMagic.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {consumableMagic.defaultColor.x, consumableMagic.defaultColor.y, consumableMagic.defaultColor.z, consumableMagic.defaultColor.w}; Color_RGBA8 color = CVarGetColor(consumableMagic.cvar, defaultColor); @@ -1061,7 +1041,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGiGreenPotColorDL, "Consumable_Magic6", consumableMagic.changedCvar, 4, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); } - static CosmeticOption& npcGoldenSkulltula = cosmeticOptions.at("NPC_GoldenSkulltula"); + static CosmeticOption& npcGoldenSkulltula = cosmeticOptions.at("NPC.GoldenSkulltula"); if (manualChange || CVarGetInteger(npcGoldenSkulltula.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {npcGoldenSkulltula.defaultColor.x, npcGoldenSkulltula.defaultColor.y, npcGoldenSkulltula.defaultColor.z, npcGoldenSkulltula.defaultColor.w}; Color_RGBA8 color = CVarGetColor(npcGoldenSkulltula.cvar, defaultColor); @@ -1077,7 +1057,7 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(object_st_DL_003FB0, "NPC_GoldenSkulltula10", npcGoldenSkulltula.changedCvar, 119, gsDPSetEnvColor(color.r / 4, color.g / 4, color.b / 4, 255)); } - static CosmeticOption& npcGerudo = cosmeticOptions.at("NPC_Gerudo"); + static CosmeticOption& npcGerudo = cosmeticOptions.at("NPC.Gerudo"); if (manualChange || CVarGetInteger(npcGerudo.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {npcGerudo.defaultColor.x, npcGerudo.defaultColor.y, npcGerudo.defaultColor.z, npcGerudo.defaultColor.w}; Color_RGBA8 color = CVarGetColor(npcGerudo.cvar, defaultColor); @@ -1091,35 +1071,35 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { PATCH_GFX(gGerudoPurpleRightHandDL, "NPC_Gerudo8", npcGerudo.changedCvar, 17, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& npcMetalTrap = cosmeticOptions.at("NPC_MetalTrap"); + static CosmeticOption& npcMetalTrap = cosmeticOptions.at("NPC.MetalTrap"); if (manualChange || CVarGetInteger(npcMetalTrap.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {npcMetalTrap.defaultColor.x, npcMetalTrap.defaultColor.y, npcMetalTrap.defaultColor.z, npcMetalTrap.defaultColor.w}; Color_RGBA8 color = CVarGetColor(npcMetalTrap.cvar, defaultColor); PATCH_GFX(gSlidingBladeTrapDL, "NPC_MetalTrap1", npcMetalTrap.changedCvar, 59, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - static CosmeticOption& n64LogoRed = cosmeticOptions.at("Title_N64LogoRed"); + static CosmeticOption& n64LogoRed = cosmeticOptions.at("Title.N64LogoRed"); if (manualChange || CVarGetInteger(n64LogoRed.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {n64LogoRed.defaultColor.x, n64LogoRed.defaultColor.y, n64LogoRed.defaultColor.z, n64LogoRed.defaultColor.w}; Color_RGBA8 color = CVarGetColor(n64LogoRed.cvar, defaultColor); PATCH_GFX(gNintendo64LogoDL, "Title_N64LogoRed1", n64LogoRed.changedCvar, 17, gsDPSetPrimColor(0, 0, 255, 255, 255, 255)) PATCH_GFX(gNintendo64LogoDL, "Title_N64LogoRed2", n64LogoRed.changedCvar, 18, gsDPSetEnvColor(color.r, color.g, color.b, 128)); } - static CosmeticOption& n64LogoBlue = cosmeticOptions.at("Title_N64LogoBlue"); + static CosmeticOption& n64LogoBlue = cosmeticOptions.at("Title.N64LogoBlue"); if (manualChange || CVarGetInteger(n64LogoBlue.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {n64LogoBlue.defaultColor.x, n64LogoBlue.defaultColor.y, n64LogoBlue.defaultColor.z, n64LogoBlue.defaultColor.w}; Color_RGBA8 color = CVarGetColor(n64LogoBlue.cvar, defaultColor); PATCH_GFX(gNintendo64LogoDL, "Title_N64LogoBlue1", n64LogoBlue.changedCvar, 29, gsDPSetPrimColor(0, 0, 255, 255, 255, 255)) PATCH_GFX(gNintendo64LogoDL, "Title_N64LogoBlue2", n64LogoBlue.changedCvar, 30, gsDPSetEnvColor(color.r, color.g, color.b, 128)); } - static CosmeticOption& n64LogoGreen = cosmeticOptions.at("Title_N64LogoGreen"); + static CosmeticOption& n64LogoGreen = cosmeticOptions.at("Title.N64LogoGreen"); if (manualChange || CVarGetInteger(n64LogoGreen.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {n64LogoGreen.defaultColor.x, n64LogoGreen.defaultColor.y, n64LogoGreen.defaultColor.z, n64LogoGreen.defaultColor.w}; Color_RGBA8 color = CVarGetColor(n64LogoGreen.cvar, defaultColor); PATCH_GFX(gNintendo64LogoDL, "Title_N64LogoGreen1", n64LogoGreen.changedCvar, 56, gsDPSetPrimColor(0, 0, 255, 255, 255, 255)) PATCH_GFX(gNintendo64LogoDL, "Title_N64LogoGreen2", n64LogoGreen.changedCvar, 57, gsDPSetEnvColor(color.r, color.g, color.b, 128)); } - static CosmeticOption& n64LogoYellow = cosmeticOptions.at("Title_N64LogoYellow"); + static CosmeticOption& n64LogoYellow = cosmeticOptions.at("Title.N64LogoYellow"); if (manualChange || CVarGetInteger(n64LogoYellow.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {n64LogoYellow.defaultColor.x, n64LogoYellow.defaultColor.y, n64LogoYellow.defaultColor.z, n64LogoYellow.defaultColor.w}; Color_RGBA8 color = CVarGetColor(n64LogoYellow.cvar, defaultColor); @@ -1128,9 +1108,9 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { } if (gPlayState != nullptr) { - if (CVarGetInteger("gCosmetics.Link_BodyScale.Changed", 0)) { + if (CVarGetInteger(CVAR_COSMETIC("Link.BodyScale.Changed"), 0)) { static Player* player = GET_PLAYER(gPlayState); - float scale = CVarGetFloat("gCosmetics.Link_BodyScale.Value", 0.01f); + float scale = CVarGetFloat(CVAR_COSMETIC("Link.BodyScale.Value"), 0.01f); player->actor.scale.x = scale; player->actor.scale.y = scale; player->actor.scale.z = scale; @@ -1149,13 +1129,13 @@ void Table_InitHeader(bool has_header = true) { ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x-60); } void DrawUseMarginsSlider(const std::string ElementName, const std::string CvarName){ - std::string CvarLabel = CvarName + "UseMargins"; + std::string CvarLabel = CvarName + ".UseMargins"; std::string Label = ElementName + " use margins"; UIWidgets::EnhancementCheckbox(Label.c_str(), CvarLabel.c_str()); UIWidgets::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"; + std::string CvarLabel = CvarName + ".PosType"; UIWidgets::EnhancementRadioButton("Original position", CvarLabel.c_str(), 0); UIWidgets::Tooltip("This will use original intended elements position"); UIWidgets::EnhancementRadioButton("Anchor to the left", CvarLabel.c_str(), 1); @@ -1170,8 +1150,8 @@ void DrawPositionsRadioBoxes(const std::string CvarName, bool NoAnchorEnabled = UIWidgets::Tooltip("This will make your elements hidden"); } 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 PosXCvar = CvarName + ".PosX"; + std::string PosYCvar = CvarName + ".PosY"; std::string InvisibleLabelX = "##"+PosXCvar; std::string InvisibleLabelY = "##"+PosYCvar; UIWidgets::EnhancementSliderInt("Up <-> Down : %d", InvisibleLabelY.c_str(), PosYCvar.c_str(), MinY, MaxY, "", 0); @@ -1181,7 +1161,7 @@ void DrawPositionSlider(const std::string CvarName, int MinY, int MaxY, int MinX } void DrawScaleSlider(const std::string CvarName,float DefaultValue){ std::string InvisibleLabel = "##"+CvarName; - std::string CvarLabel = CvarName+"Scale"; + std::string CvarLabel = CvarName + ".Scale"; //Disabled for now. feature not done and several fixes needed to be merged. //UIWidgets::EnhancementSliderFloat("Scale : %dx", InvisibleLabel.c_str(), CvarLabel.c_str(), 0.1f, 3.0f,"",DefaultValue,true); } @@ -1226,10 +1206,10 @@ void Draw_Placements(){ if (ImGui::BeginTable("tableMargins", 1, FlagsTable)) { ImGui::TableSetupColumn("General margins settings", FlagsCell, TablesCellsWidth); Table_InitHeader(); - UIWidgets::EnhancementSliderInt("Top : %dx", "##UIMARGINT", "gHUDMargin_T", (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0); - UIWidgets::EnhancementSliderInt("Left: %dx", "##UIMARGINL", "gHUDMargin_L", -25, ImGui::GetWindowViewport()->Size.x, "", 0); - UIWidgets::EnhancementSliderInt("Right: %dx", "##UIMARGINR", "gHUDMargin_R", (ImGui::GetWindowViewport()->Size.x)*-1, 25, "", 0); - UIWidgets::EnhancementSliderInt("Bottom: %dx", "##UIMARGINB", "gHUDMargin_B", (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0); + UIWidgets::EnhancementSliderInt("Top : %dx", "##UIMARGINT", CVAR_COSMETIC("HUD.Margin.T"), (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0); + UIWidgets::EnhancementSliderInt("Left: %dx", "##UIMARGINL", CVAR_COSMETIC("HUD.Margin.L"), -25, ImGui::GetWindowViewport()->Size.x, "", 0); + UIWidgets::EnhancementSliderInt("Right: %dx", "##UIMARGINR", CVAR_COSMETIC("HUD.Margin.R"), (ImGui::GetWindowViewport()->Size.x)*-1, 25, "", 0); + UIWidgets::EnhancementSliderInt("Bottom: %dx", "##UIMARGINB", CVAR_COSMETIC("HUD.Margin.B"), (ImGui::GetWindowViewport()->Size.y/2)*-1, 25, "", 0); SetMarginAll("All margins on",true); UIWidgets::Tooltip("Set most of the elements to use margins\nSome elements with default position will not be affected\nElements without Anchor or Hidden will not be turned on"); ImGui::SameLine(); @@ -1245,11 +1225,11 @@ void Draw_Placements(){ if (ImGui::BeginTable("tableHeartsCounts", 1, FlagsTable)) { ImGui::TableSetupColumn("Hearts counts settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - DrawUseMarginsSlider("Hearts counts", "gHearts"); - DrawPositionsRadioBoxes("gHeartsCount"); - DrawPositionSlider("gHeartsCount",-22,ImGui::GetWindowViewport()->Size.y,-125,ImGui::GetWindowViewport()->Size.x); - DrawScaleSlider("gHeartsCount",0.7f); - UIWidgets::EnhancementSliderInt("Heart line length : %d", "##HeartLineLength", "gHeartsLineLength", 0, 20, "", 10); + DrawUseMarginsSlider("Hearts counts", CVAR_COSMETIC("HUD.Hearts")); + DrawPositionsRadioBoxes(CVAR_COSMETIC("HUD.HeartsCount")); + DrawPositionSlider(CVAR_COSMETIC("HUD.HeartsCount"),-22,ImGui::GetWindowViewport()->Size.y,-125,ImGui::GetWindowViewport()->Size.x); + DrawScaleSlider(CVAR_COSMETIC("HUD.HeartsCount"),0.7f); + UIWidgets::EnhancementSliderInt("Heart line length : %d", "##HeartLineLength", CVAR_COSMETIC("HUD.Hearts.LineLength"), 0, 20, "", 10); UIWidgets::Tooltip("This will set the length of a row of hearts. Set to 0 for unlimited length."); ImGui::NewLine(); ImGui::EndTable(); @@ -1259,91 +1239,91 @@ void Draw_Placements(){ if (ImGui::BeginTable("tablemmpos", 1, FlagsTable)) { ImGui::TableSetupColumn("Magic meter settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - DrawUseMarginsSlider("Magic meter", "gMagicBar"); - DrawPositionsRadioBoxes("gMagicBar"); - UIWidgets::EnhancementRadioButton("Anchor to life bar", "gMagicBarPosType", 5); + DrawUseMarginsSlider("Magic meter", CVAR_COSMETIC("HUD.MagicBar")); + DrawPositionsRadioBoxes(CVAR_COSMETIC("HUD.MagicBar")); + UIWidgets::EnhancementRadioButton("Anchor to life bar", CVAR_COSMETIC("HUD.MagicBar.PosType"), 5); UIWidgets::Tooltip("This will make your elements follow the bottom of the life meter"); - DrawPositionSlider("gMagicBar", 0, ImGui::GetWindowViewport()->Size.y/2, -5, ImGui::GetWindowViewport()->Size.x/2); - DrawScaleSlider("gMagicBar",1.0f); + DrawPositionSlider(CVAR_COSMETIC("HUD.MagicBar"), 0, ImGui::GetWindowViewport()->Size.y/2, -5, ImGui::GetWindowViewport()->Size.x/2); + DrawScaleSlider(CVAR_COSMETIC("HUD.MagicBar"),1.0f); ImGui::NewLine(); ImGui::EndTable(); } } - if (CVarGetInteger("gVisualAgony",0) && ImGui::CollapsingHeader("Visual stone of agony position")) { + if (CVarGetInteger(CVAR_ENHANCEMENT("VisualAgony"),0) && ImGui::CollapsingHeader("Visual stone of agony position")) { if (ImGui::BeginTable("tabledvisualstoneofagony", 1, FlagsTable)) { ImGui::TableSetupColumn("Visual stone of agony settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - DrawUseMarginsSlider("Visual stone of agony", "gVSOA"); - DrawPositionsRadioBoxes("gVSOA"); + DrawUseMarginsSlider("Visual stone of agony", CVAR_COSMETIC("HUD.VisualSoA")); + DrawPositionsRadioBoxes(CVAR_COSMETIC("HUD.VisualSoA")); s16 Min_X_VSOA = 0; s16 Max_X_VSOA = ImGui::GetWindowViewport()->Size.x/2; - if(CVarGetInteger("gVSOAPosType",0) == 2){ + if(CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosType"),0) == 2){ Max_X_VSOA = 290; - } else if(CVarGetInteger("gVSOAPosType",0) == 4){ + } else if(CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosType"),0) == 4){ Min_X_VSOA = (ImGui::GetWindowViewport()->Size.x/2)*-1; } - DrawPositionSlider("gVSOA", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_VSOA, Max_X_VSOA); - DrawScaleSlider("gVSOA",1.0f); + DrawPositionSlider(CVAR_COSMETIC("HUD.VisualSoA"), 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_VSOA, Max_X_VSOA); + DrawScaleSlider(CVAR_COSMETIC("HUD.VisualSoA"),1.0f); ImGui::NewLine(); ImGui::EndTable(); } } - Draw_Table_Dropdown("B Button position", "tablebbtn", "B Button settings", "B Button", "gBBtn", 0, ImGui::GetWindowViewport()->Size.y/4+50, -1, ImGui::GetWindowViewport()->Size.x-50, 0.95f); - Draw_Table_Dropdown("A Button position", "tableabtn", "A Button settings", "A Button", "gABtn", -10, ImGui::GetWindowViewport()->Size.y/4+50, -20, ImGui::GetWindowViewport()->Size.x-50, 0.95f); - Draw_Table_Dropdown("Start Button position", "tablestartbtn", "Start Button settings", "Start Button", "gStartBtn", 0, ImGui::GetWindowViewport()->Size.y/2, 0, ImGui::GetWindowViewport()->Size.x/2+70, 0.75f); - C_Button_Dropdown("C Button Up position", "tablecubtn", "C Button Up settings", "C Button Up", "gCBtnU", "gCBtnUPosType", 0.5f); - C_Button_Dropdown("C Button Down position", "tablecdbtn", "C Button Down settings", "C Button Down", "gCBtnD", "gCBtnDPosType", 0.87f); - C_Button_Dropdown("C Button Left position", "tableclbtn", "C Button Left settings", "C Button Left", "gCBtnL", "gCBtnLPosType", 0.87f); - C_Button_Dropdown("C Button Right position", "tablecrbtn", "C Button Right settings", "C Button Right", "gCBtnR", "gCBtnRPosType", 0.87f); - if (CVarGetInteger("gDpadEquips",0) && ImGui::CollapsingHeader("DPad items position")) { + Draw_Table_Dropdown("B Button position", "tablebbtn", "B Button settings", "B Button", CVAR_COSMETIC("HUD.BButton"), 0, ImGui::GetWindowViewport()->Size.y/4+50, -1, ImGui::GetWindowViewport()->Size.x-50, 0.95f); + Draw_Table_Dropdown("A Button position", "tableabtn", "A Button settings", "A Button", CVAR_COSMETIC("HUD.AButton"), -10, ImGui::GetWindowViewport()->Size.y/4+50, -20, ImGui::GetWindowViewport()->Size.x-50, 0.95f); + Draw_Table_Dropdown("Start Button position", "tablestartbtn", "Start Button settings", "Start Button", CVAR_COSMETIC("HUD.StartButton"), 0, ImGui::GetWindowViewport()->Size.y/2, 0, ImGui::GetWindowViewport()->Size.x/2+70, 0.75f); + C_Button_Dropdown("C Button Up position", "tablecubtn", "C Button Up settings", "C Button Up", CVAR_COSMETIC("HUD.CUpButton"), CVAR_COSMETIC("HUD.CUpButton.PosType"), 0.5f); + C_Button_Dropdown("C Button Down position", "tablecdbtn", "C Button Down settings", "C Button Down", CVAR_COSMETIC("HUD.CDownButton"), CVAR_COSMETIC("HUD.CDownButton.PosType"), 0.87f); + C_Button_Dropdown("C Button Left position", "tableclbtn", "C Button Left settings", "C Button Left", CVAR_COSMETIC("HUD.CLeftButton"), CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0.87f); + C_Button_Dropdown("C Button Right position", "tablecrbtn", "C Button Right settings", "C Button Right", CVAR_COSMETIC("HUD.CRightButton"), CVAR_COSMETIC("HUD.CRightButton.PosType"), 0.87f); + if (CVarGetInteger(CVAR_SETTING("DpadEquips"),0) && ImGui::CollapsingHeader("DPad items position")) { if (ImGui::BeginTable("tabledpaditems", 1, FlagsTable)) { ImGui::TableSetupColumn("DPad items settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - DrawUseMarginsSlider("DPad items", "gDPad"); - DrawPositionsRadioBoxes("gDPad"); + DrawUseMarginsSlider("DPad items", CVAR_COSMETIC("HUD.Dpad")); + DrawPositionsRadioBoxes(CVAR_COSMETIC("HUD.Dpad")); s16 Min_X_Dpad = 0; s16 Max_X_Dpad = ImGui::GetWindowViewport()->Size.x/2; - if(CVarGetInteger("gDPadPosType",0) == 2){ + if(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"),0) == 2){ Max_X_Dpad = 290; - } else if(CVarGetInteger("gDPadPosType",0) == 4){ + } else if(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"),0) == 4){ Min_X_Dpad = (ImGui::GetWindowViewport()->Size.x/2)*-1; } - DrawPositionSlider("gDPad", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_Dpad, Max_X_Dpad); - DrawScaleSlider("gDPad",1.0f); + DrawPositionSlider(CVAR_COSMETIC("HUD.Dpad"), 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_Dpad, Max_X_Dpad); + DrawScaleSlider(CVAR_COSMETIC("HUD.Dpad"),1.0f); ImGui::NewLine(); ImGui::EndTable(); } } - Draw_Table_Dropdown("Minimaps position", "tableminimapspos", "minimaps settings", "Minimap", "gMinimap", (ImGui::GetWindowViewport()->Size.y/3)*-1, ImGui::GetWindowViewport()->Size.y/3, ImGui::GetWindowViewport()->Size.x*-1, ImGui::GetWindowViewport()->Size.x/2, 1.0f); - Draw_Table_Dropdown("Small Keys counter position", "tablesmolekeys", "Small Keys counter settings", "Small Keys counter", "gSKC", 0, ImGui::GetWindowViewport()->Size.y/3, -1, ImGui::GetWindowViewport()->Size.x/2, 1.0f); - Draw_Table_Dropdown("Rupee counter position", "tablerupeecount", "Rupee counter settings", "Rupee counter", "gRC", -2, ImGui::GetWindowViewport()->Size.y/3, -3, ImGui::GetWindowViewport()->Size.x/2, 1.0f); - Draw_Table_Dropdown("Carrots position", "tableCarrots", "Carrots settings", "Carrots", "gCarrots", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+25, 1.0f); - Draw_Table_Dropdown("Timers position", "tabletimers", "Timers settings", "Timers", "gTimers", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2-50, 1.0f); - Draw_Table_Dropdown("Archery Scores position", "tablearchery", "Archery Scores settings", "Archery scores", "gAS", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2-50, 1.0f); - Draw_Table_Dropdown("Title cards (Maps) position", "tabletcmaps", "Titlecard maps settings", "Title cards (overworld)", "gTCM", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+10, 1.0f); - Draw_Table_Dropdown("Title cards (Bosses) position", "tabletcbosses", "Title cards (Bosses) settings", "Title cards (Bosses)", "gTCB", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+10, 1.0f); - Draw_Table_Dropdown("In-game Gameplay Timer position", "tablegameplaytimer", "In-game Gameplay Timer settings", "In-game Gameplay Timer", "gIGT", 0, ImGui::GetWindowViewport()->Size.y / 2, -50, ImGui::GetWindowViewport()->Size.x / 2 + 10, 1.0f); + Draw_Table_Dropdown("Minimaps position", "tableminimapspos", "minimaps settings", "Minimap", CVAR_COSMETIC("HUD.Minimap"), (ImGui::GetWindowViewport()->Size.y/3)*-1, ImGui::GetWindowViewport()->Size.y/3, ImGui::GetWindowViewport()->Size.x*-1, ImGui::GetWindowViewport()->Size.x/2, 1.0f); + Draw_Table_Dropdown("Small Keys counter position", "tablesmolekeys", "Small Keys counter settings", "Small Keys counter", CVAR_COSMETIC("HUD.SmallKey"), 0, ImGui::GetWindowViewport()->Size.y/3, -1, ImGui::GetWindowViewport()->Size.x/2, 1.0f); + Draw_Table_Dropdown("Rupee counter position", "tablerupeecount", "Rupee counter settings", "Rupee counter", CVAR_COSMETIC("HUD.Rupees"), -2, ImGui::GetWindowViewport()->Size.y/3, -3, ImGui::GetWindowViewport()->Size.x/2, 1.0f); + Draw_Table_Dropdown("Carrots position", "tableCarrots", "Carrots settings", "Carrots", CVAR_COSMETIC("HUD.Carrots"), 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+25, 1.0f); + Draw_Table_Dropdown("Timers position", "tabletimers", "Timers settings", "Timers", CVAR_COSMETIC("HUD.Timers"), 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2-50, 1.0f); + Draw_Table_Dropdown("Archery Scores position", "tablearchery", "Archery Scores settings", "Archery scores", CVAR_COSMETIC("HUD.ArcheryScore"), 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2-50, 1.0f); + Draw_Table_Dropdown("Title cards (Maps) position", "tabletcmaps", "Titlecard maps settings", "Title cards (overworld)", CVAR_COSMETIC("HUD.TitleCard.Map"), 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+10, 1.0f); + Draw_Table_Dropdown("Title cards (Bosses) position", "tabletcbosses", "Title cards (Bosses) settings", "Title cards (Bosses)", CVAR_COSMETIC("HUD.TitleCard.Boss"), 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+10, 1.0f); + Draw_Table_Dropdown("In-game Gameplay Timer position", "tablegameplaytimer", "In-game Gameplay Timer settings", "In-game Gameplay Timer", CVAR_COSMETIC("HUD.IGT"), 0, ImGui::GetWindowViewport()->Size.y / 2, -50, ImGui::GetWindowViewport()->Size.x / 2 + 10, 1.0f); if (ImGui::CollapsingHeader("Enemy Health Bar position")) { if (ImGui::BeginTable("enemyhealthbar", 1, FlagsTable)) { ImGui::TableSetupColumn("Enemy Health Bar settings", FlagsCell, TablesCellsWidth); Table_InitHeader(false); - std::string posTypeCVar = "gCosmetics.Hud_EnemyHealthBarPosType"; + std::string posTypeCVar = CVAR_COSMETIC("HUD.EnemyHealthBar.PosType"); UIWidgets::EnhancementRadioButton("Anchor to Enemy", posTypeCVar.c_str(), ENEMYHEALTH_ANCHOR_ACTOR); UIWidgets::Tooltip("This will use enemy on screen position"); UIWidgets::EnhancementRadioButton("Anchor to the top", posTypeCVar.c_str(), ENEMYHEALTH_ANCHOR_TOP); UIWidgets::Tooltip("This will make your elements follow the top edge of your game window"); UIWidgets::EnhancementRadioButton("Anchor to the bottom", posTypeCVar.c_str(), ENEMYHEALTH_ANCHOR_BOTTOM); UIWidgets::Tooltip("This will make your elements follow the bottom edge of your game window"); - DrawPositionSlider("gCosmetics.Hud_EnemyHealthBar", -SCREEN_HEIGHT, SCREEN_HEIGHT, -ImGui::GetWindowViewport()->Size.x / 2, ImGui::GetWindowViewport()->Size.x / 2); - if (UIWidgets::EnhancementSliderInt("Health Bar Width: %d", "##EnemyHealthBarWidth", "gCosmetics.Hud_EnemyHealthBarWidth.Value", 32, 128, "", 64)) { - CVarSetInteger("gCosmetics.Hud_EnemyHealthBarWidth.Changed", 1); + DrawPositionSlider(CVAR_COSMETIC("HUD.EnemyHealthBar."), -SCREEN_HEIGHT, SCREEN_HEIGHT, -ImGui::GetWindowViewport()->Size.x / 2, ImGui::GetWindowViewport()->Size.x / 2); + if (UIWidgets::EnhancementSliderInt("Health Bar Width: %d", "##EnemyHealthBarWidth", CVAR_COSMETIC("HUD.EnemyHealthBar.Width.Value"), 32, 128, "", 64)) { + CVarSetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar.Width.Changed"), 1); } UIWidgets::Tooltip("This will change the width of the health bar"); ImGui::SameLine(); if (ImGui::Button("Reset##EnemyHealthBarWidth")) { - CVarClear("gCosmetics.Hud_EnemyHealthBarWidth.Value"); - CVarClear("gCosmetics.Hud_EnemyHealthBarWidth.Changed"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarClear(CVAR_COSMETIC("HUD.EnemyHealthBar.Width.Value")); + CVarClear(CVAR_COSMETIC("HUD.EnemyHealthBar.Width.Changed")); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::NewLine(); ImGui::EndTable(); @@ -1354,7 +1334,7 @@ void Reset_Option_Single(const char* Button_Title, const char* name) { ImGui::SameLine(); if (ImGui::Button(Button_Title)) { CVarClear(name); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } void Reset_Option_Double(const char* Button_Title, const char* name) { @@ -1362,24 +1342,24 @@ void Reset_Option_Double(const char* Button_Title, const char* name) { if (ImGui::Button(Button_Title)) { CVarClear((std::string(name) + ".Value").c_str()); CVarClear((std::string(name) + ".Changed").c_str()); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } void DrawSillyTab() { - ImGui::BeginDisabled(CVarGetInteger("gDisableChangingSettings", 0)); - if (CVarGetInteger("gLetItSnow", 0)) { - if (UIWidgets::EnhancementCheckbox("Let It Snow", "gLetItSnow")) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); + if (CVarGetInteger(CVAR_GENERAL("LetItSnow"), 0)) { + if (UIWidgets::EnhancementCheckbox("Let It Snow", CVAR_GENERAL("LetItSnow"))) { + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } - if (UIWidgets::EnhancementSliderFloat("Link Body Scale: %.3fx", "##Link_BodyScale", "gCosmetics.Link_BodyScale.Value", 0.001f, 0.025f, "", 0.01f, true)) { - CVarSetInteger("gCosmetics.Link_BodyScale.Changed", 1); + if (UIWidgets::EnhancementSliderFloat("Link Body Scale: %.3fx", "##Link_BodyScale", CVAR_COSMETIC("Link.BodyScale.Value"), 0.001f, 0.025f, "", 0.01f, true)) { + CVarSetInteger(CVAR_COSMETIC("Link.BodyScale.Changed"), 1); } ImGui::SameLine(); if (ImGui::Button("Reset##Link_BodyScale")) { - CVarClear("gCosmetics.Link_BodyScale.Value"); - CVarClear("gCosmetics.Link_BodyScale.Changed"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarClear(CVAR_COSMETIC("Link.BodyScale.Value")); + CVarClear(CVAR_COSMETIC("Link.BodyScale.Changed")); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); if (gPlayState != nullptr) { static Player* player = GET_PLAYER(gPlayState); player->actor.scale.x = 0.01f; @@ -1387,31 +1367,31 @@ void DrawSillyTab() { player->actor.scale.z = 0.01f; } } - if (UIWidgets::EnhancementSliderFloat("Link Head Scale: %.2fx", "##Link_HeadScale", "gCosmetics.Link_HeadScale.Value", 0.4f, 4.0f, "", 1.0f, false)) { - CVarSetInteger("gCosmetics.Link_HeadScale.Changed", 1); + if (UIWidgets::EnhancementSliderFloat("Link Head Scale: %.2fx", "##Link_HeadScale", CVAR_COSMETIC("Link.HeadScale.Value"), 0.4f, 4.0f, "", 1.0f, false)) { + CVarSetInteger(CVAR_COSMETIC("Link.HeadScale.Changed"), 1); } - Reset_Option_Double("Reset##Link_HeadScale", "gCosmetics.Link_HeadScale"); - if (UIWidgets::EnhancementSliderFloat("Link Sword Scale: %f", "##Link_SwordScale", "gCosmetics.Link_SwordScale.Value", 1.0f, 2.5f, "", 1.0f, false)) { - CVarSetInteger("gCosmetics.Link_SwordScale.Changed", 1); + Reset_Option_Double("Reset##Link_HeadScale", CVAR_COSMETIC("Link.HeadScale")); + if (UIWidgets::EnhancementSliderFloat("Link Sword Scale: %f", "##Link_SwordScale", CVAR_COSMETIC("Link.SwordScale.Value"), 1.0f, 2.5f, "", 1.0f, false)) { + CVarSetInteger(CVAR_COSMETIC("Link.SwordScale.Changed"), 1); } - Reset_Option_Double("Reset##Link_SwordScale", "gCosmetics.Link_SwordScale"); - UIWidgets::EnhancementSliderFloat("Bunny Hood Length: %f", "##BunnyHood_EarLength", "gCosmetics.BunnyHood_EarLength", -300.0f, 1000.0f, "", 0.0f, false); - Reset_Option_Single("Reset##BunnyHood_EarLength", "gCosmetics.BunnyHood_EarLength"); - UIWidgets::EnhancementSliderFloat("Bunny Hood Spread: %f", "##BunnyHood_EarSpread", "gCosmetics.BunnyHood_EarSpread", -300.0f, 500.0f, "", 0.0f, false); - Reset_Option_Single("Reset##BunnyHood_EarSpread", "gCosmetics.BunnyHood_EarSpread"); - UIWidgets::EnhancementSliderFloat("Goron Neck Length: %f", "##Goron_NeckLength", "gCosmetics.Goron_NeckLength", 0.0f, 1000.0f, "", 0.0f, false); - Reset_Option_Single("Reset##Goron_NeckLength", "gCosmetics.Goron_NeckLength"); - UIWidgets::EnhancementCheckbox("Unfix Goron Spin", "gUnfixGoronSpin"); - UIWidgets::EnhancementSliderFloat("Fairies Size: %f", "##Fairies_Size", "gCosmetics.Fairies_Size", 0.25f, 5.0f, "", 1.0f, false); - Reset_Option_Single("Reset##Fairies_Size", "gCosmetics.Fairies_Size"); - UIWidgets::EnhancementSliderFloat("N64 Logo Spin Speed: %f", "##N64Logo_SpinSpeed", "gCosmetics.N64Logo_SpinSpeed", 0.25f, 5.0f, "", 1.0f, false); - Reset_Option_Single("Reset##N64Logo_SpinSpeed", "gCosmetics.N64Logo_SpinSpeed"); - UIWidgets::EnhancementSliderFloat("Moon Size: %f", "##Moon_Size", "gCosmetics.Moon_Size", 0.5f, 2.0f, "", 1.0f, false); - Reset_Option_Single("Reset##Moon_Size", "gCosmetics.Moon_Size"); - if (UIWidgets::EnhancementSliderFloat("Kak Windmill Speed: %f", "##Kak_Windmill_Speed", "gCosmetics.Kak_Windmill_Speed.Value", 100.0f, 6000.0f, "", 100.0f, false)) { - CVarSetInteger("gCosmetics.Kak_Windmill_Speed.Changed", 1); + Reset_Option_Double("Reset##Link_SwordScale", CVAR_COSMETIC("Link.SwordScale")); + UIWidgets::EnhancementSliderFloat("Bunny Hood Length: %f", "##BunnyHood_EarLength", CVAR_COSMETIC("BunnyHood.EarLength"), -300.0f, 1000.0f, "", 0.0f, false); + Reset_Option_Single("Reset##BunnyHood_EarLength", CVAR_COSMETIC("BunnyHood.EarLength")); + UIWidgets::EnhancementSliderFloat("Bunny Hood Spread: %f", "##BunnyHood_EarSpread", CVAR_COSMETIC("BunnyHood.EarSpread"), -300.0f, 500.0f, "", 0.0f, false); + Reset_Option_Single("Reset##BunnyHood_EarSpread", CVAR_COSMETIC("BunnyHood.EarSpread")); + UIWidgets::EnhancementSliderFloat("Goron Neck Length: %f", "##Goron_NeckLength", CVAR_COSMETIC("Goron.NeckLength"), 0.0f, 1000.0f, "", 0.0f, false); + Reset_Option_Single("Reset##Goron_NeckLength", CVAR_COSMETIC("Goron.NeckLength")); + UIWidgets::EnhancementCheckbox("Unfix Goron Spin", CVAR_COSMETIC("UnfixGoronSpin")); + UIWidgets::EnhancementSliderFloat("Fairies Size: %f", "##Fairies_Size", CVAR_COSMETIC("Fairies.Size"), 0.25f, 5.0f, "", 1.0f, false); + Reset_Option_Single("Reset##Fairies_Size", CVAR_COSMETIC("Fairies.Size")); + UIWidgets::EnhancementSliderFloat("N64 Logo Spin Speed: %f", "##N64Logo_SpinSpeed", CVAR_COSMETIC("N64Logo.SpinSpeed"), 0.25f, 5.0f, "", 1.0f, false); + Reset_Option_Single("Reset##N64Logo_SpinSpeed", CVAR_COSMETIC("N64Logo.SpinSpeed")); + UIWidgets::EnhancementSliderFloat("Moon Size: %f", "##Moon_Size", CVAR_COSMETIC("Moon.Size"), 0.5f, 2.0f, "", 1.0f, false); + Reset_Option_Single("Reset##Moon_Size", CVAR_COSMETIC("Moon.Size")); + if (UIWidgets::EnhancementSliderFloat("Kak Windmill Speed: %f", "##Kak_Windmill_Speed", CVAR_COSMETIC("Kak.Windmill_Speed.Value"), 100.0f, 6000.0f, "", 100.0f, false)) { + CVarSetInteger(CVAR_COSMETIC("Kak.Windmill_Speed.Changed"), 1); } - Reset_Option_Double("Reset##Kak_Windmill_Speed", "gCosmetics.Kak_Windmill_Speed"); + Reset_Option_Double("Reset##Kak_Windmill_Speed", CVAR_COSMETIC("Kak.Windmill_Speed")); ImGui::EndDisabled(); } @@ -1445,89 +1425,89 @@ void ToggleRainbow(CosmeticOption& cosmeticOption, bool state) { } void ApplySideEffects(CosmeticOption& cosmeticOption) { - if (CVarGetInteger("gCosmetics.AdvancedMode", 0)) { + if (CVarGetInteger(CVAR_COSMETIC("AdvancedMode"), 0)) { return; } // This bit is kind of experimental, not sure how I feel about it yet, but it allows for // advanced cosmetic options to be changed based on a non-advanced option. if (cosmeticOption.label == "Bow Body") { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Equipment_BowTips"), 0.5f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Equipment_BowHandle"), 1.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Equipment.BowTips"), 0.5f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Equipment.BowHandle"), 1.0f); CopyMultipliedColor(cosmeticOption, cosmeticOption, 4.0f); } else if (cosmeticOption.label == "Idle Primary") { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Navi_IdleSecondary"), 0.5f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Navi.IdleSecondary"), 0.5f); } else if (cosmeticOption.label == "Enemy Primary") { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Navi_EnemySecondary"), 0.5f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Navi.EnemySecondary"), 0.5f); } else if (cosmeticOption.label == "NPC Primary") { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Navi_NPCSecondary"), 1.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Navi.NPCSecondary"), 1.0f); } else if (cosmeticOption.label == "Props Primary") { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Navi_PropsSecondary"), 1.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Navi.PropsSecondary"), 1.0f); } else if (cosmeticOption.label == "Ivan Idle Primary") { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Ivan_IdleSecondary"), 0.5f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Ivan.IdleSecondary"), 0.5f); } else if (cosmeticOption.label == "Level 1 Secondary") { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("SpinAttack_Level1Primary"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("SpinAttack.Level1Primary"), 2.0f); } else if (cosmeticOption.label == "Level 2 Secondary") { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("SpinAttack_Level2Primary"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("SpinAttack.Level2Primary"), 2.0f); } else if (cosmeticOption.label == "Item Select Color") { if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { - ToggleRainbow(cosmeticOptions.at("Kal_ItemSelB"), true); - ToggleRainbow(cosmeticOptions.at("Kal_ItemSelC"), true); - ToggleRainbow(cosmeticOptions.at("Kal_ItemSelD"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.ItemSelB"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.ItemSelC"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.ItemSelD"), true); } else { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_ItemSelB"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_ItemSelC"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_ItemSelD"), 1.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.ItemSelB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.ItemSelC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.ItemSelD"), 1.0f); } } else if (cosmeticOption.label == "Equip Select Color") { if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { - ToggleRainbow(cosmeticOptions.at("Kal_EquipSelB"), true); - ToggleRainbow(cosmeticOptions.at("Kal_EquipSelC"), true); - ToggleRainbow(cosmeticOptions.at("Kal_EquipSelD"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.EquipSelB"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.EquipSelC"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.EquipSelD"), true); } else { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_EquipSelB"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_EquipSelC"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_EquipSelD"), 1.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.EquipSelB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.EquipSelC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.EquipSelD"), 1.0f); } } else if (cosmeticOption.label == "Map Dungeon Color") { if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { - ToggleRainbow(cosmeticOptions.at("Kal_MapSelDunB"), true); - ToggleRainbow(cosmeticOptions.at("Kal_MapSelDunC"), true); - ToggleRainbow(cosmeticOptions.at("Kal_MapSelDunD"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.MapSelDunB"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.MapSelDunC"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.MapSelDunD"), true); } else { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelDunB"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelDunC"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelDunD"), 1.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.MapSelDunB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.MapSelDunC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.MapSelDunD"), 1.0f); } } else if (cosmeticOption.label == "Quest Status Color") { if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { - ToggleRainbow(cosmeticOptions.at("Kal_QuestStatusB"), true); - ToggleRainbow(cosmeticOptions.at("Kal_QuestStatusC"), true); - ToggleRainbow(cosmeticOptions.at("Kal_QuestStatusD"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.QuestStatusB"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.QuestStatusC"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.QuestStatusD"), true); } else { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_QuestStatusB"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_QuestStatusC"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_QuestStatusD"), 1.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.QuestStatusB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.QuestStatusC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.QuestStatusD"), 1.0f); } } else if (cosmeticOption.label == "Map Color") { if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { - ToggleRainbow(cosmeticOptions.at("Kal_MapSelectB"), true); - ToggleRainbow(cosmeticOptions.at("Kal_MapSelectC"), true); - ToggleRainbow(cosmeticOptions.at("Kal_MapSelectD"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.MapSelectB"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.MapSelectC"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.MapSelectD"), true); } else { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelectB"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelectC"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelectD"), 1.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.MapSelectB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.MapSelectC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.MapSelectD"), 1.0f); } } else if (cosmeticOption.label == "Save Color") { if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { - ToggleRainbow(cosmeticOptions.at("Kal_SaveB"), true); - ToggleRainbow(cosmeticOptions.at("Kal_SaveC"), true); - ToggleRainbow(cosmeticOptions.at("Kal_SaveD"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.SaveB"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.SaveC"), true); + ToggleRainbow(cosmeticOptions.at("Kaleido.SaveD"), true); } else { - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_SaveB"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_SaveC"), 2.0f); - CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_SaveD"), 1.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.SaveB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.SaveC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kaleido.SaveD"), 1.0f); } } } @@ -1573,44 +1553,44 @@ void ResetColor(CosmeticOption& cosmeticOption) { // This portion should match 1:1 the multiplied colors in `ApplySideEffect()` if (cosmeticOption.label == "Bow Body") { - ResetColor(cosmeticOptions.at("Equipment_BowTips")); - ResetColor(cosmeticOptions.at("Equipment_BowHandle")); + ResetColor(cosmeticOptions.at("Equipment.BowTips")); + ResetColor(cosmeticOptions.at("Equipment.BowHandle")); } else if (cosmeticOption.label == "Idle Primary") { - ResetColor(cosmeticOptions.at("Navi_IdleSecondary")); + ResetColor(cosmeticOptions.at("Navi.IdleSecondary")); } else if (cosmeticOption.label == "Enemy Primary") { - ResetColor(cosmeticOptions.at("Navi_EnemySecondary")); + ResetColor(cosmeticOptions.at("Navi.EnemySecondary")); } else if (cosmeticOption.label == "NPC Primary") { - ResetColor(cosmeticOptions.at("Navi_NPCSecondary")); + ResetColor(cosmeticOptions.at("Navi.NPCSecondary")); } else if (cosmeticOption.label == "Props Primary") { - ResetColor(cosmeticOptions.at("Navi_PropsSecondary")); + ResetColor(cosmeticOptions.at("Navi.PropsSecondary")); } else if (cosmeticOption.label == "Level 1 Secondary") { - ResetColor(cosmeticOptions.at("SpinAttack_Level1Primary")); + ResetColor(cosmeticOptions.at("SpinAttack.Level1Primary")); } else if (cosmeticOption.label == "Level 2 Secondary") { - ResetColor(cosmeticOptions.at("SpinAttack_Level2Primary")); + ResetColor(cosmeticOptions.at("SpinAttack.Level2Primary")); } else if (cosmeticOption.label == "Item Select Color") { - ResetColor(cosmeticOptions.at("Kal_ItemSelB")); - ResetColor(cosmeticOptions.at("Kal_ItemSelC")); - ResetColor(cosmeticOptions.at("Kal_ItemSelD")); + ResetColor(cosmeticOptions.at("Kaleido.ItemSelB")); + ResetColor(cosmeticOptions.at("Kaleido.ItemSelC")); + ResetColor(cosmeticOptions.at("Kaleido.ItemSelD")); } else if (cosmeticOption.label == "Equip Select Color") { - ResetColor(cosmeticOptions.at("Kal_EquipSelB")); - ResetColor(cosmeticOptions.at("Kal_EquipSelC")); - ResetColor(cosmeticOptions.at("Kal_EquipSelD")); + ResetColor(cosmeticOptions.at("Kaleido.EquipSelB")); + ResetColor(cosmeticOptions.at("Kaleido.EquipSelC")); + ResetColor(cosmeticOptions.at("Kaleido.EquipSelD")); } else if (cosmeticOption.label == "Map Dungeon Color") { - ResetColor(cosmeticOptions.at("Kal_MapSelDunB")); - ResetColor(cosmeticOptions.at("Kal_MapSelDunC")); - ResetColor(cosmeticOptions.at("Kal_MapSelDunD")); + ResetColor(cosmeticOptions.at("Kaleido.MapSelDunB")); + ResetColor(cosmeticOptions.at("Kaleido.MapSelDunC")); + ResetColor(cosmeticOptions.at("Kaleido.MapSelDunD")); } else if (cosmeticOption.label == "Quest Status Color") { - ResetColor(cosmeticOptions.at("Kal_QuestStatusB")); - ResetColor(cosmeticOptions.at("Kal_QuestStatusC")); - ResetColor(cosmeticOptions.at("Kal_QuestStatusD")); + ResetColor(cosmeticOptions.at("Kaleido.QuestStatusB")); + ResetColor(cosmeticOptions.at("Kaleido.QuestStatusC")); + ResetColor(cosmeticOptions.at("Kaleido.QuestStatusD")); } else if (cosmeticOption.label == "Map Color") { - ResetColor(cosmeticOptions.at("Kal_MapSelectB")); - ResetColor(cosmeticOptions.at("Kal_MapSelectC")); - ResetColor(cosmeticOptions.at("Kal_MapSelectD")); + ResetColor(cosmeticOptions.at("Kaleido.MapSelectB")); + ResetColor(cosmeticOptions.at("Kaleido.MapSelectC")); + ResetColor(cosmeticOptions.at("Kaleido.MapSelectD")); } else if (cosmeticOption.label == "Save Color") { - ResetColor(cosmeticOptions.at("Kal_SaveB")); - ResetColor(cosmeticOptions.at("Kal_SaveC")); - ResetColor(cosmeticOptions.at("Kal_SaveD")); + ResetColor(cosmeticOptions.at("Kaleido.SaveB")); + ResetColor(cosmeticOptions.at("Kaleido.SaveC")); + ResetColor(cosmeticOptions.at("Kaleido.SaveD")); } } @@ -1633,7 +1613,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) { CVarSetInteger((cosmeticOption.changedCvar), 1); ApplySideEffects(cosmeticOption); ApplyOrResetCustomGfxPatches(); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); ImGui::Text("%s", cosmeticOption.label.c_str()); @@ -1641,7 +1621,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) { if (ImGui::Button(("Random##" + cosmeticOption.label).c_str())) { RandomizeColor(cosmeticOption); ApplyOrResetCustomGfxPatches(); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (cosmeticOption.supportsRainbow) { ImGui::SameLine(); @@ -1651,21 +1631,21 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) { CVarSetInteger((cosmeticOption.changedCvar), 1); ApplySideEffects(cosmeticOption); ApplyOrResetCustomGfxPatches(); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } ImGui::SameLine(); bool isLocked = (bool)CVarGetInteger((cosmeticOption.lockedCvar), 0); if (ImGui::Checkbox(("Locked##" + cosmeticOption.label).c_str(), &isLocked)) { CVarSetInteger((cosmeticOption.lockedCvar), isLocked); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (CVarGetInteger((cosmeticOption.changedCvar), 0)) { ImGui::SameLine(); if (ImGui::Button(("Reset##" + cosmeticOption.label).c_str())) { ResetColor(cosmeticOption); ApplyOrResetCustomGfxPatches(); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } } @@ -1676,12 +1656,12 @@ void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) { ImGui::SameLine((ImGui::CalcTextSize("Mirror Shield Mirror").x * 1.0f) + 60.0f); if (ImGui::Button(("Random##" + label).c_str())) { for (auto& [id, cosmeticOption] : cosmeticOptions) { - if (cosmeticOption.group == cosmeticGroup && (!cosmeticOption.advancedOption || CVarGetInteger("gCosmetics.AdvancedMode", 0)) && !CVarGetInteger(cosmeticOption.lockedCvar, 0)) { + if (cosmeticOption.group == cosmeticGroup && (!cosmeticOption.advancedOption || CVarGetInteger(CVAR_COSMETIC("AdvancedMode"), 0)) && !CVarGetInteger(cosmeticOption.lockedCvar, 0)) { RandomizeColor(cosmeticOption); } } ApplyOrResetCustomGfxPatches(); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); if (ImGui::Button(("Reset##" + label).c_str())) { @@ -1691,10 +1671,10 @@ void DrawCosmeticGroup(CosmeticGroup cosmeticGroup) { } } ApplyOrResetCustomGfxPatches(); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } for (auto& [id, cosmeticOption] : cosmeticOptions) { - if (cosmeticOption.group == cosmeticGroup && (!cosmeticOption.advancedOption || CVarGetInteger("gCosmetics.AdvancedMode", 0))) { + if (cosmeticOption.group == cosmeticGroup && (!cosmeticOption.advancedOption || CVarGetInteger(CVAR_COSMETIC("AdvancedMode"), 0))) { DrawCosmeticRow(cosmeticOption); } } @@ -1714,20 +1694,20 @@ void CosmeticsEditorWindow::DrawElement() { ImGui::Text("Color Scheme"); ImGui::SameLine(); - UIWidgets::EnhancementCombobox("gCosmetics.DefaultColorScheme", colorSchemes, COLORSCHEME_N64); - UIWidgets::EnhancementCheckbox("Advanced Mode", "gCosmetics.AdvancedMode"); + UIWidgets::EnhancementCombobox(CVAR_COSMETIC("DefaultColorScheme"), colorSchemes, COLORSCHEME_N64); + UIWidgets::EnhancementCheckbox("Advanced Mode", CVAR_COSMETIC("AdvancedMode")); UIWidgets::InsertHelpHoverText( "Some cosmetic options may not apply if you have any mods that provide custom models for the cosmetic option.\n\n" "For example, if you have custom Link model, then the Link's Hair color option will most likely not apply." ); - if (CVarGetInteger("gCosmetics.AdvancedMode", 0)) { + if (CVarGetInteger(CVAR_COSMETIC("AdvancedMode"), 0)) { if (ImGui::Button("Lock All Advanced", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) { for (auto& [id, cosmeticOption] : cosmeticOptions) { if (cosmeticOption.advancedOption) { CVarSetInteger(cosmeticOption.lockedCvar, 1); } } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); if (ImGui::Button("Unlock All Advanced", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) { @@ -1736,12 +1716,12 @@ void CosmeticsEditorWindow::DrawElement() { CVarSetInteger(cosmeticOption.lockedCvar, 0); } } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } - UIWidgets::EnhancementCheckbox("Sync Rainbow colors", "gCosmetics.RainbowSync"); - UIWidgets::EnhancementSliderFloat("Rainbow Speed: %.3f", "##rainbowSpeed", "gCosmetics.RainbowSpeed", 0.03f, 1.0f, "", 0.6f, false, true); - UIWidgets::EnhancementCheckbox("Randomize All on New Scene", "gCosmetics.RandomizeAllOnNewScene"); + UIWidgets::EnhancementCheckbox("Sync Rainbow colors", CVAR_COSMETIC("RainbowSync")); + UIWidgets::EnhancementSliderFloat("Rainbow Speed: %.3f", "##rainbowSpeed", CVAR_COSMETIC("RainbowSpeed"), 0.03f, 1.0f, "", 0.6f, false, true); + UIWidgets::EnhancementCheckbox("Randomize All on New Scene", CVAR_COSMETIC("RandomizeAllOnNewScene")); UIWidgets::Tooltip("Enables randomizing all unlocked cosmetics when you enter a new scene."); if (ImGui::Button("Randomize All", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) { @@ -1755,58 +1735,58 @@ void CosmeticsEditorWindow::DrawElement() { } } ApplyOrResetCustomGfxPatches(); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (ImGui::Button("Lock All", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) { for (auto& [id, cosmeticOption] : cosmeticOptions) { - if (!cosmeticOption.advancedOption || CVarGetInteger("gCosmetics.AdvancedMode", 0)) { + if (!cosmeticOption.advancedOption || CVarGetInteger(CVAR_COSMETIC("AdvancedMode"), 0)) { CVarSetInteger(cosmeticOption.lockedCvar, 1); } } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); if (ImGui::Button("Unlock All", ImVec2(ImGui::GetContentRegionAvail().x, 30.0f))) { for (auto& [id, cosmeticOption] : cosmeticOptions) { - if (!cosmeticOption.advancedOption || CVarGetInteger("gCosmetics.AdvancedMode", 0)) { + if (!cosmeticOption.advancedOption || CVarGetInteger(CVAR_COSMETIC("AdvancedMode"), 0)) { CVarSetInteger(cosmeticOption.lockedCvar, 0); } } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (ImGui::BeginTabBar("CosmeticsContextTabBar", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Link & Items")) { - DrawCosmeticGroup(GROUP_LINK); - DrawCosmeticGroup(GROUP_GLOVES); - DrawCosmeticGroup(GROUP_MIRRORSHIELD); - DrawCosmeticGroup(GROUP_EQUIPMENT); - DrawCosmeticGroup(GROUP_SWORDS); - DrawCosmeticGroup(GROUP_CONSUMABLE); + DrawCosmeticGroup(COSMETICS_GROUP_LINK); + DrawCosmeticGroup(COSMETICS_GROUP_GLOVES); + DrawCosmeticGroup(COSMETICS_GROUP_MIRRORSHIELD); + DrawCosmeticGroup(COSMETICS_GROUP_EQUIPMENT); + DrawCosmeticGroup(COSMETICS_GROUP_SWORDS); + DrawCosmeticGroup(COSMETICS_GROUP_CONSUMABLE); ImGui::EndTabItem(); } if (ImGui::BeginTabItem("Effects")) { - // DrawCosmeticGroup(GROUP_MAGIC); // Cosmetics TODO: Implement magic effect colors - DrawCosmeticGroup(GROUP_ARROWS); - DrawCosmeticGroup(GROUP_SPIN_ATTACK); - DrawCosmeticGroup(GROUP_TRAILS); - if (UIWidgets::EnhancementSliderInt("Trails Duration: %d", "##Trails_Duration", "gCosmetics.Trails_Duration.Value", 2, 20, "", 4)) { - CVarSetInteger("gCosmetics.Trails_Duration.Changed", 1); + // DrawCosmeticGroup(COSMETICS_GROUP_MAGIC); // Cosmetics TODO: Implement magic effect colors + DrawCosmeticGroup(COSMETICS_GROUP_ARROWS); + DrawCosmeticGroup(COSMETICS_GROUP_SPIN_ATTACK); + DrawCosmeticGroup(COSMETICS_GROUP_TRAILS); + if (UIWidgets::EnhancementSliderInt("Trails Duration: %d", "##Trails_Duration", CVAR_COSMETIC("Trails.Duration.Value"), 2, 20, "", 4)) { + CVarSetInteger(CVAR_COSMETIC("Trails.Duration.Changed"), 1); } ImGui::SameLine(); if (ImGui::Button("Reset##Trails_Duration")) { - CVarClear("gCosmetics.Trails_Duration.Value"); - CVarClear("gCosmetics.Trails_Duration.Changed"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarClear(CVAR_COSMETIC("Trails.Duration.Value")); + CVarClear(CVAR_COSMETIC("Trails.Duration.Changed")); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::EndTabItem(); } if (ImGui::BeginTabItem("World & NPCs")) { - DrawCosmeticGroup(GROUP_WORLD); - DrawCosmeticGroup(GROUP_NAVI); - DrawCosmeticGroup(GROUP_IVAN); - DrawCosmeticGroup(GROUP_NPC); + DrawCosmeticGroup(COSMETICS_GROUP_WORLD); + DrawCosmeticGroup(COSMETICS_GROUP_NAVI); + DrawCosmeticGroup(COSMETICS_GROUP_IVAN); + DrawCosmeticGroup(COSMETICS_GROUP_NPC); ImGui::EndTabItem(); } if (ImGui::BeginTabItem("Silly")) { @@ -1814,8 +1794,8 @@ void CosmeticsEditorWindow::DrawElement() { ImGui::EndTabItem(); } if (ImGui::BeginTabItem("HUD")) { - DrawCosmeticGroup(GROUP_HUD); - DrawCosmeticGroup(GROUP_TITLE); + DrawCosmeticGroup(COSMETICS_GROUP_HUD); + DrawCosmeticGroup(COSMETICS_GROUP_TITLE); ImGui::EndTabItem(); } @@ -1825,7 +1805,7 @@ void CosmeticsEditorWindow::DrawElement() { } if (ImGui::BeginTabItem("Pause Menu")) { - DrawCosmeticGroup(GROUP_KALEIDO); + DrawCosmeticGroup(COSMETICS_GROUP_KALEIDO); ImGui::EndTabItem(); } ImGui::EndTabBar(); @@ -1847,7 +1827,7 @@ void RegisterOnGameFrameUpdateHook() { void Cosmetics_RegisterOnSceneInitHook() { GameInteractor::Instance->RegisterGameHook([](int16_t sceneNum) { - if (CVarGetInteger("gCosmetics.RandomizeAllOnNewScene", 0)) { + if (CVarGetInteger(CVAR_COSMETIC("RandomizeAllOnNewScene"), 0)) { CosmeticsEditor_RandomizeAll(); } }); @@ -1864,7 +1844,7 @@ void CosmeticsEditorWindow::InitElement() { cosmeticOption.currentColor.z = cvarColor.b / 255.0; cosmeticOption.currentColor.w = cvarColor.a / 255.0; } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ApplyOrResetCustomGfxPatches(); ApplyAuthenticGfxPatches(); @@ -1876,12 +1856,25 @@ void CosmeticsEditorWindow::InitElement() { void CosmeticsEditor_RandomizeAll() { for (auto& [id, cosmeticOption] : cosmeticOptions) { if (!CVarGetInteger(cosmeticOption.lockedCvar, 0) && - (!cosmeticOption.advancedOption || CVarGetInteger("gCosmetics.AdvancedMode", 0))) { + (!cosmeticOption.advancedOption || CVarGetInteger(CVAR_COSMETIC("AdvancedMode"), 0))) { RandomizeColor(cosmeticOption); } } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + ApplyOrResetCustomGfxPatches(); +} + +void CosmeticsEditor_RandomizeGroup(CosmeticGroup group) { + for (auto& [id, cosmeticOption] : cosmeticOptions) { + if (!CVarGetInteger(cosmeticOption.lockedCvar, 0) && + (!cosmeticOption.advancedOption || CVarGetInteger(CVAR_COSMETIC("AdvancedMode"), 0)) && + cosmeticOption.group == group) { + RandomizeColor(cosmeticOption); + } + } + + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ApplyOrResetCustomGfxPatches(); } @@ -1892,6 +1885,17 @@ void CosmeticsEditor_ResetAll() { } } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + ApplyOrResetCustomGfxPatches(); +} + +void CosmeticsEditor_ResetGroup(CosmeticGroup group) { + for (auto& [id, cosmeticOption] : cosmeticOptions) { + if (!CVarGetInteger(cosmeticOption.lockedCvar, 0) && cosmeticOption.group == group) { + ResetColor(cosmeticOption); + } + } + + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ApplyOrResetCustomGfxPatches(); } diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h index b22a51ba7..88f60c76c 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.h @@ -8,6 +8,29 @@ ResourceMgr_UnpatchGfxByName(path, name); \ } +// Not to be confused with tabs, groups are 1:1 with the boxes shown in the UI, grouping them allows us to reset/randomize +// every item in a group at once. If you are looking for tabs they are rendered manually in ImGui in `DrawCosmeticsEditor` +typedef enum { + COSMETICS_GROUP_LINK, + COSMETICS_GROUP_MIRRORSHIELD, + COSMETICS_GROUP_SWORDS, + COSMETICS_GROUP_GLOVES, + COSMETICS_GROUP_EQUIPMENT, + COSMETICS_GROUP_CONSUMABLE, + COSMETICS_GROUP_HUD, + COSMETICS_GROUP_KALEIDO, + COSMETICS_GROUP_TITLE, + COSMETICS_GROUP_NPC, + COSMETICS_GROUP_WORLD, + COSMETICS_GROUP_MAGIC, + COSMETICS_GROUP_ARROWS, + COSMETICS_GROUP_SPIN_ATTACK, + COSMETICS_GROUP_TRAILS, + COSMETICS_GROUP_NAVI, + COSMETICS_GROUP_IVAN, + COSMETICS_GROUP_MAX +} CosmeticGroup; + typedef struct { const std::string Name; const std::string ToolTip; @@ -26,10 +49,12 @@ static ImGuiTableColumnFlags FlagsCell = ImGuiTableColumnFlags_WidthStretch | Im void InitCosmeticsEditor();//Init the menu itself ImVec4 GetRandomValue(int MaximumPossible); void CosmeticsEditor_RandomizeAll(); +void CosmeticsEditor_RandomizeGroup(CosmeticGroup group); void CosmeticsEditor_ResetAll(); +void CosmeticsEditor_ResetGroup(CosmeticGroup group); void ApplyOrResetCustomGfxPatches(bool manualChange = true); -class CosmeticsEditorWindow : public LUS::GuiWindow { +class CosmeticsEditorWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; diff --git a/soh/soh/Enhancements/cosmetics/authenticGfxPatches.cpp b/soh/soh/Enhancements/cosmetics/authenticGfxPatches.cpp index 709854c35..f31eedd2c 100644 --- a/soh/soh/Enhancements/cosmetics/authenticGfxPatches.cpp +++ b/soh/soh/Enhancements/cosmetics/authenticGfxPatches.cpp @@ -1,5 +1,6 @@ #include #include +#include "soh/OTRGlobals.h" extern "C" { #include @@ -81,7 +82,7 @@ void PatchDekuStickTextureOverflow() { const char* dlist = gLinkChildLinkDekuStickDL; int start = 5; - if (!CVarGetInteger("gFixTexturesOOB", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("FixTexturesOOB"), 0)) { // Unpatch the other texture fix for (size_t i = 0; i < 7; i++) { int instruction = start + (i == 0 ? 0 : i + 1); @@ -121,7 +122,7 @@ void PatchFreezardTextureOverflow() { char patchNameBuf[24]; // Patch using custom overflowed texture - if (!CVarGetInteger("gFixTexturesOOB", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("FixTexturesOOB"), 0)) { // Unpatch the other texture fix for (size_t i = 0; i < 7; i++) { int instruction = start + (i == 0 ? 0 : i + 1); @@ -163,7 +164,7 @@ void PatchIronKnuckleTextureOverflow() { // Until this is solved, Iron Knuckle will be hardcoded to always display with the "authentic" texture fix // Patch using custom overflowed texture - // if (!CVarGetInteger("gFixTexturesOOB", 0)) { + // if (!CVarGetInteger(CVAR_ENHANCEMENT("FixTexturesOOB"), 0)) { // Unpatch the other texture fix for (size_t i = 0; i < 7; i++) { int instruction = start + (i == 0 ? 0 : i + 1); @@ -222,7 +223,7 @@ void PatchMirroredSoldOutGI() { G_TX_NOMIRROR | G_TX_CLAMP, 5, 5, G_TX_NOLOD, G_TX_NOLOD), }; - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { if (mirroredSoldOutVtx == nullptr) { // Copy the original vertices that we want to modify (4 at the beginning of the resource) mirroredSoldOutVtx = (Vtx*)malloc(sizeof(Vtx) * 4); @@ -269,7 +270,7 @@ void PatchMirroredSunSongEtching() { G_TX_NOMIRROR | G_TX_CLAMP, 7, 5, G_TX_NOLOD, G_TX_NOLOD) }; - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { if (mirroredSunSongVtx == nullptr) { // Copy the original vertices that we want to modify (4 at the beginning of the resource) mirroredSunSongVtx = (Vtx*)malloc(sizeof(Vtx) * 4); diff --git a/soh/soh/Enhancements/crowd-control/CrowdControl.cpp b/soh/soh/Enhancements/crowd-control/CrowdControl.cpp index 9c0d5cb2d..6443a7ff3 100644 --- a/soh/soh/Enhancements/crowd-control/CrowdControl.cpp +++ b/soh/soh/Enhancements/crowd-control/CrowdControl.cpp @@ -179,7 +179,7 @@ CrowdControl::EffectResult CrowdControl::TranslateGiEnum(GameInteractionEffectQu CrowdControl::Effect* CrowdControl::ParseMessage(nlohmann::json dataReceived) { if (!dataReceived.contains("id") || !dataReceived.contains("type")) { - SPDLOG_ERROR("[CrowdControl] Invalid payload received:\n{}", dataReceived); + SPDLOG_ERROR("[CrowdControl] Invalid payload received:\n{}", dataReceived.dump()); return nullptr; } diff --git a/soh/soh/Enhancements/debugconsole.cpp b/soh/soh/Enhancements/debugconsole.cpp index 2c910a067..ad51f1e4b 100644 --- a/soh/soh/Enhancements/debugconsole.cpp +++ b/soh/soh/Enhancements/debugconsole.cpp @@ -13,15 +13,15 @@ #define Path _Path #define PATH_HACK -#include +#include #include #include #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif -#include -#include +#include +#include #undef PATH_HACK #undef Path @@ -36,12 +36,12 @@ extern PlayState* gPlayState; #include #include -#define CMD_REGISTER LUS::Context::GetInstance()->GetConsole()->AddCommand +#define CMD_REGISTER Ship::Context::GetInstance()->GetConsole()->AddCommand // TODO: Commands should be using the output passed in. -#define ERROR_MESSAGE std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->SendErrorMessage -#define INFO_MESSAGE std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->SendInfoMessage +#define ERROR_MESSAGE std::reinterpret_pointer_cast(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->SendErrorMessage +#define INFO_MESSAGE std::reinterpret_pointer_cast(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->SendInfoMessage -static bool ActorSpawnHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool ActorSpawnHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if ((args.size() != 9) && (args.size() != 3) && (args.size() != 6)) { ERROR_MESSAGE("Not enough arguments passed to actorspawn"); return 1; @@ -101,7 +101,7 @@ static bool ActorSpawnHandler(std::shared_ptr Console, const std:: return 0; } -static bool KillPlayerHandler(std::shared_ptr Console, const std::vector&, std::string* output) { +static bool KillPlayerHandler(std::shared_ptr Console, const std::vector&, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::SetPlayerHealth(); dynamic_cast(effect)->parameters[0] = 0; GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); @@ -114,7 +114,7 @@ static bool KillPlayerHandler(std::shared_ptr Console, const std:: } } -static bool SetPlayerHealthHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool SetPlayerHealthHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -145,7 +145,7 @@ static bool SetPlayerHealthHandler(std::shared_ptr Console, const } } -static bool LoadSceneHandler(std::shared_ptr Console, const std::vector&, std::string* output) { +static bool LoadSceneHandler(std::shared_ptr Console, const std::vector&, std::string* output) { gSaveContext.respawnFlag = 0; gSaveContext.seqId = 0xFF; gSaveContext.gameMode = 0; @@ -153,7 +153,7 @@ static bool LoadSceneHandler(std::shared_ptr Console, const std::v return 0; } -static bool RupeeHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool RupeeHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { return 1; } @@ -178,7 +178,7 @@ static bool RupeeHandler(std::shared_ptr Console, const std::vecto return 0; } -static bool SetPosHandler(std::shared_ptr Console, const std::vector args, std::string* output) { +static bool SetPosHandler(std::shared_ptr Console, const std::vector args, std::string* output) { if (gPlayState == nullptr) { ERROR_MESSAGE("PlayState == nullptr"); return 1; @@ -205,7 +205,7 @@ static bool SetPosHandler(std::shared_ptr Console, const std::vect return 0; } -static bool ResetHandler(std::shared_ptr Console, std::vector args, std::string* output) { +static bool ResetHandler(std::shared_ptr Console, std::vector args, std::string* output) { if (gPlayState == nullptr) { ERROR_MESSAGE("PlayState == nullptr"); return 1; @@ -225,7 +225,7 @@ const static std::map ammoItems{ { "beans", ITEM_BEAN } }; -static bool AddAmmoHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool AddAmmoHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 3) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -264,7 +264,7 @@ static bool AddAmmoHandler(std::shared_ptr Console, const std::vec } } -static bool TakeAmmoHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool TakeAmmoHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 3) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -311,7 +311,7 @@ const static std::map bottleItems{ { "big_poe", ITEM_BIG_POE }, { "blue_fire", ITEM_BLUE_FIRE }, { "rutos_letter", ITEM_LETTER_RUTO }, }; -static bool BottleHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool BottleHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 3) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -343,7 +343,7 @@ static bool BottleHandler(std::shared_ptr Console, const std::vect return 0; } -static bool BHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool BHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -353,7 +353,7 @@ static bool BHandler(std::shared_ptr Console, const std::vector Console, const std::vector& args, std::string* output) { +static bool ItemHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 3) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -364,7 +364,7 @@ static bool ItemHandler(std::shared_ptr Console, const std::vector return 0; } -static bool GiveItemHandler(std::shared_ptr Console, const std::vector args, std::string* output) { +static bool GiveItemHandler(std::shared_ptr Console, const std::vector args, std::string* output) { if (args.size() < 3) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -385,7 +385,7 @@ static bool GiveItemHandler(std::shared_ptr Console, const std::ve return 0; } -static bool EntranceHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool EntranceHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -406,7 +406,7 @@ static bool EntranceHandler(std::shared_ptr Console, const std::ve gSaveContext.nextTransitionType = TRANS_TYPE_INSTANT; } -static bool VoidHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool VoidHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (gPlayState != nullptr) { gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags = gPlayState->actorCtx.flags.tempSwch; gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags = gPlayState->actorCtx.flags.tempCollect; @@ -422,7 +422,7 @@ static bool VoidHandler(std::shared_ptr Console, const std::vector return 0; } -static bool ReloadHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool ReloadHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (gPlayState != nullptr) { gPlayState->nextEntranceIndex = gSaveContext.entranceIndex; gPlayState->transitionTrigger = TRANS_TRIGGER_START; @@ -439,7 +439,7 @@ const static std::map fw_options { { "clear", 0}, {"warp", 1}, {"backup", 2} }; -static bool FWHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool FWHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -471,7 +471,7 @@ static bool FWHandler(std::shared_ptr Console, const std::vector Console, const std::vector Console, const std::vector& args, std::string* output) { +static bool FileSelectHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (gPlayState != nullptr) { SET_NEXT_GAMESTATE(&gPlayState->state, FileChoose_Init, FileChooseContext); gPlayState->state.running = 0; @@ -502,12 +502,12 @@ static bool FileSelectHandler(std::shared_ptr Console, const std:: return 0; } -static bool QuitHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { - LUS::Context::GetInstance()->GetWindow()->Close(); +static bool QuitHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { + Ship::Context::GetInstance()->GetWindow()->Close(); return 0; } -static bool SaveStateHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool SaveStateHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot(); const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::SAVE }); @@ -521,7 +521,7 @@ static bool SaveStateHandler(std::shared_ptr Console, const std::v } } -static bool LoadStateHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool LoadStateHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { unsigned int slot = OTRGlobals::Instance->gSaveStateMgr->GetCurrentSlot(); const SaveStateReturn rtn = OTRGlobals::Instance->gSaveStateMgr->AddRequest({ slot, RequestType::LOAD }); @@ -542,7 +542,7 @@ static bool LoadStateHandler(std::shared_ptr Console, const std::v } -static bool StateSlotSelectHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool StateSlotSelectHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -567,7 +567,7 @@ static bool StateSlotSelectHandler(std::shared_ptr Console, const return 0; } -static bool InvisibleHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool InvisibleHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -594,7 +594,7 @@ static bool InvisibleHandler(std::shared_ptr Console, const std::v } } -static bool GiantLinkHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool GiantLinkHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -622,7 +622,7 @@ static bool GiantLinkHandler(std::shared_ptr Console, const std::v } } -static bool MinishLinkHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool MinishLinkHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -650,7 +650,7 @@ static bool MinishLinkHandler(std::shared_ptr Console, const std:: } } -static bool AddHeartContainerHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool AddHeartContainerHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -681,7 +681,7 @@ static bool AddHeartContainerHandler(std::shared_ptr Console, cons } } -static bool RemoveHeartContainerHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool RemoveHeartContainerHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -712,7 +712,7 @@ static bool RemoveHeartContainerHandler(std::shared_ptr Console, c } } -static bool GravityHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool GravityHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -721,7 +721,7 @@ static bool GravityHandler(std::shared_ptr Console, const std::vec GameInteractionEffectBase* effect = new GameInteractionEffect::ModifyGravity(); try { - dynamic_cast(effect)->parameters[0] = LUS::Math::clamp(std::stoi(args[1], nullptr, 10), GI_GRAVITY_LEVEL_LIGHT, GI_GRAVITY_LEVEL_HEAVY); + dynamic_cast(effect)->parameters[0] = Ship::Math::clamp(std::stoi(args[1], nullptr, 10), GI_GRAVITY_LEVEL_LIGHT, GI_GRAVITY_LEVEL_HEAVY); } catch (std::invalid_argument const& ex) { ERROR_MESSAGE("[SOH] Gravity value must be a number."); return 1; @@ -737,7 +737,7 @@ static bool GravityHandler(std::shared_ptr Console, const std::vec } } -static bool NoUIHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool NoUIHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -765,7 +765,7 @@ static bool NoUIHandler(std::shared_ptr Console, const std::vector } } -static bool FreezeHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool FreezeHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::FreezePlayer(); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); @@ -778,7 +778,7 @@ static bool FreezeHandler(std::shared_ptr Console, const std::vect } } -static bool DefenseModifierHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool DefenseModifierHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -802,7 +802,7 @@ static bool DefenseModifierHandler(std::shared_ptr Console, const } } -static bool DamageHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool DamageHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -832,7 +832,7 @@ static bool DamageHandler(std::shared_ptr Console, const std::vect } } -static bool HealHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool HealHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -862,7 +862,7 @@ static bool HealHandler(std::shared_ptr Console, const std::vector } } -static bool FillMagicHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool FillMagicHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::FillMagic(); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); @@ -875,7 +875,7 @@ static bool FillMagicHandler(std::shared_ptr Console, const std::v } } -static bool EmptyMagicHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool EmptyMagicHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::EmptyMagic(); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); @@ -888,7 +888,7 @@ static bool EmptyMagicHandler(std::shared_ptr Console, const std:: } } -static bool NoZHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool NoZHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -916,7 +916,7 @@ static bool NoZHandler(std::shared_ptr Console, const std::vector< } } -static bool OneHitKOHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool OneHitKOHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -944,7 +944,7 @@ static bool OneHitKOHandler(std::shared_ptr Console, const std::ve } } -static bool PacifistHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool PacifistHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -972,7 +972,7 @@ static bool PacifistHandler(std::shared_ptr Console, const std::ve } } -static bool PaperLinkHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool PaperLinkHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -1001,7 +1001,7 @@ static bool PaperLinkHandler(std::shared_ptr Console, const std::v } } -static bool RainstormHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool RainstormHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -1029,7 +1029,7 @@ static bool RainstormHandler(std::shared_ptr Console, const std::v } } -static bool ReverseControlsHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool ReverseControlsHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -1058,7 +1058,7 @@ static bool ReverseControlsHandler(std::shared_ptr Console, const } } -static bool UpdateRupeesHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool UpdateRupeesHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -1082,7 +1082,7 @@ static bool UpdateRupeesHandler(std::shared_ptr Console, const std } } -static bool SpeedModifierHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool SpeedModifierHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -1112,7 +1112,7 @@ const static std::map boots { { "hover", EQUIP_VALUE_BOOTS_HOVER }, }; -static bool BootsHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool BootsHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -1143,7 +1143,7 @@ const static std::map shields { { "mirror", ITEM_SHIELD_MIRROR }, }; -static bool GiveShieldHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool GiveShieldHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -1168,7 +1168,7 @@ static bool GiveShieldHandler(std::shared_ptr Console, const std:: } } -static bool TakeShieldHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool TakeShieldHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -1193,7 +1193,7 @@ static bool TakeShieldHandler(std::shared_ptr Console, const std:: } } -static bool KnockbackHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool KnockbackHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; @@ -1223,7 +1223,7 @@ static bool KnockbackHandler(std::shared_ptr Console, const std::v } } -static bool ElectrocuteHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool ElectrocuteHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::ElectrocutePlayer(); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); @@ -1236,7 +1236,7 @@ static bool ElectrocuteHandler(std::shared_ptr Console, const std: } } -static bool BurnHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool BurnHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectBase* effect = new GameInteractionEffect::BurnPlayer(); GameInteractionEffectQueryResult result = GameInteractor::ApplyEffect(effect); @@ -1249,7 +1249,7 @@ static bool BurnHandler(std::shared_ptr Console, const std::vector } } -static bool CuccoStormHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool CuccoStormHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { GameInteractionEffectQueryResult result = GameInteractor::RawAction::SpawnActor(ACTOR_EN_NIW, 0); if (result == GameInteractionEffectQueryResult::Possible) { @@ -1261,7 +1261,7 @@ static bool CuccoStormHandler(std::shared_ptr Console, const std:: } } -static bool GenerateRandoHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static bool GenerateRandoHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() == 1) { if (GenerateRandomizer()) { return 0; @@ -1289,16 +1289,58 @@ static bool GenerateRandoHandler(std::shared_ptr Console, const st return 1; } -static bool CosmeticsHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static constexpr std::array, COSMETICS_GROUP_MAX> cosmetic_groups = {{ + {"link", COSMETICS_GROUP_LINK}, + {"mirror_shield", COSMETICS_GROUP_MIRRORSHIELD}, + {"swords", COSMETICS_GROUP_SWORDS}, + {"gloves", COSMETICS_GROUP_GLOVES}, + {"equipment", COSMETICS_GROUP_EQUIPMENT}, + {"consumable", COSMETICS_GROUP_CONSUMABLE}, + {"hud", COSMETICS_GROUP_HUD}, + {"kaleido", COSMETICS_GROUP_KALEIDO}, + {"title", COSMETICS_GROUP_TITLE}, + {"npc", COSMETICS_GROUP_NPC}, + {"world", COSMETICS_GROUP_WORLD}, + {"magic", COSMETICS_GROUP_MAGIC}, + {"arrows", COSMETICS_GROUP_ARROWS}, + {"spin_attack", COSMETICS_GROUP_SPIN_ATTACK}, + {"trials", COSMETICS_GROUP_TRAILS}, + {"navi", COSMETICS_GROUP_NAVI}, + {"ivan", COSMETICS_GROUP_IVAN}, +}}; + +static bool CosmeticsHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; } if (args[1].compare("reset") == 0) { - CosmeticsEditor_ResetAll(); + if (args.size() == 2) { + CosmeticsEditor_ResetAll(); + } else { + for (const auto& [key, value] : cosmetic_groups) { + if (args[2].compare(key) == 0) { + CosmeticsEditor_ResetGroup(value); + return 0; + } + } + ERROR_MESSAGE("[SOH] Invalid argument passed, unrecognized group name"); + return 1; + } } else if (args[1].compare("randomize") == 0) { - CosmeticsEditor_RandomizeAll(); + if (args.size() == 2) { + CosmeticsEditor_RandomizeAll(); + } else { + for (const auto& [key, value] : cosmetic_groups) { + if (args[2].compare(key) == 0) { + CosmeticsEditor_RandomizeGroup(value); + return 0; + } + } + ERROR_MESSAGE("[SOH] Invalid argument passed, unrecognized group name"); + return 1; + } } else { ERROR_MESSAGE("[SOH] Invalid argument passed, must be 'reset' or 'randomize'"); return 1; @@ -1307,16 +1349,50 @@ static bool CosmeticsHandler(std::shared_ptr Console, const std::v return 0; } -static bool SfxHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { +static std::map sfx_groups = { + {"bgm", SEQ_BGM_WORLD}, + {"fanfares", SEQ_FANFARE}, + {"events", SEQ_BGM_EVENT}, + {"battle", SEQ_BGM_BATTLE}, + {"ocarina", SEQ_OCARINA}, + {"instruments", SEQ_INSTRUMENT}, + {"sfx", SEQ_SFX}, + {"voices", SEQ_VOICE}, + {"custom", SEQ_BGM_CUSTOM}, +}; + +static bool SfxHandler(std::shared_ptr Console, const std::vector& args, std::string* output) { if (args.size() < 2) { ERROR_MESSAGE("[SOH] Unexpected arguments passed"); return 1; } if (args[1].compare("reset") == 0) { - AudioEditor_ResetAll(); + if (args.size() == 2) { + AudioEditor_ResetAll(); + } else { + for (const auto& [key, value] : sfx_groups) { + if (args[2].compare(key) == 0) { + AudioEditor_ResetGroup(value); + return 0; + } + } + ERROR_MESSAGE("[SOH] Invalid argument passed, unrecognized group name"); + return 1; + } } else if (args[1].compare("randomize") == 0) { - AudioEditor_RandomizeAll(); + if (args.size() == 2) { + AudioEditor_RandomizeAll(); + } else { + for (const auto& [key, value] : sfx_groups) { + if (args[2].compare(key) == 0) { + AudioEditor_RandomizeGroup(value); + return 0; + } + } + ERROR_MESSAGE("[SOH] Invalid argument passed, unrecognized group name"); + return 1; + } } else { ERROR_MESSAGE("[SOH] Invalid argument passed, must be 'reset' or 'randomize'"); return 1; @@ -1335,17 +1411,17 @@ void DebugConsole_Init(void) { CMD_REGISTER("save_state", {SaveStateHandler, "Save a state."}); CMD_REGISTER("load_state", {LoadStateHandler, "Load a state."}); CMD_REGISTER("set_slot", {StateSlotSelectHandler, "Selects a SaveState slot", { - {"Slot number", LUS::ArgumentType::NUMBER,} + {"Slot number", Ship::ArgumentType::NUMBER,} }}); // Map & Location CMD_REGISTER("void", {VoidHandler, "Voids out of the current map."}); CMD_REGISTER("reload", {ReloadHandler, "Reloads the current map."}); CMD_REGISTER("fw", {FWHandler, "Spawns the player where Farore's Wind is set.", { - {"clear|warp|backup", LUS::ArgumentType::TEXT} + {"clear|warp|backup", Ship::ArgumentType::TEXT} }}); CMD_REGISTER("entrance", {EntranceHandler, "Sends player to the entered entrance (hex)", { - {"entrance", LUS::ArgumentType::NUMBER} + {"entrance", Ship::ArgumentType::NUMBER} }}); // Gameplay @@ -1354,64 +1430,64 @@ void DebugConsole_Init(void) { CMD_REGISTER("map", {LoadSceneHandler, "Load up kak?"}); CMD_REGISTER("rupee", {RupeeHandler, "Set your rupee counter.", { - {"amount", LUS::ArgumentType::NUMBER} + {"amount", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("bItem", {BHandler, "Set an item to the B button.", { - {"Item ID", LUS::ArgumentType::NUMBER} + {"Item ID", Ship::ArgumentType::NUMBER} }}); - CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", { { "actor name/id", LUS::ArgumentType::NUMBER }, // TODO there should be an actor_id arg type - {"data", LUS::ArgumentType::NUMBER}, - {"x", LUS::ArgumentType::NUMBER, true}, - {"y", LUS::ArgumentType::NUMBER, true}, - {"z", LUS::ArgumentType::NUMBER, true}, - {"rx", LUS::ArgumentType::NUMBER, true}, - {"ry", LUS::ArgumentType::NUMBER, true}, - {"rz", LUS::ArgumentType::NUMBER, true} + CMD_REGISTER("spawn", { ActorSpawnHandler, "Spawn an actor.", { { "actor name/id", Ship::ArgumentType::NUMBER }, // TODO there should be an actor_id arg type + {"data", Ship::ArgumentType::NUMBER}, + {"x", Ship::ArgumentType::NUMBER, true}, + {"y", Ship::ArgumentType::NUMBER, true}, + {"z", Ship::ArgumentType::NUMBER, true}, + {"rx", Ship::ArgumentType::NUMBER, true}, + {"ry", Ship::ArgumentType::NUMBER, true}, + {"rz", Ship::ArgumentType::NUMBER, true} }}); CMD_REGISTER("pos", {SetPosHandler, "Sets the position of the player.", { - {"x", LUS::ArgumentType::NUMBER, true}, - {"y", LUS::ArgumentType::NUMBER, true}, - {"z", LUS::ArgumentType::NUMBER, true} + {"x", Ship::ArgumentType::NUMBER, true}, + {"y", Ship::ArgumentType::NUMBER, true}, + {"z", Ship::ArgumentType::NUMBER, true} }}); CMD_REGISTER("addammo", {AddAmmoHandler, "Adds ammo of an item.", { - {"sticks|nuts|bombs|seeds|arrows|bombchus|beans", LUS::ArgumentType::TEXT}, - {"count", LUS::ArgumentType::NUMBER} + {"sticks|nuts|bombs|seeds|arrows|bombchus|beans", Ship::ArgumentType::TEXT}, + {"count", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("takeammo", {TakeAmmoHandler, "Removes ammo of an item.", { - {"sticks|nuts|bombs|seeds|arrows|bombchus|beans", LUS::ArgumentType::TEXT}, - {"count", LUS::ArgumentType::NUMBER} + {"sticks|nuts|bombs|seeds|arrows|bombchus|beans", Ship::ArgumentType::TEXT}, + {"count", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("bottle", {BottleHandler, "Changes item in a bottle slot.", { - {"item", LUS::ArgumentType::TEXT}, - {"slot", LUS::ArgumentType::NUMBER} + {"item", Ship::ArgumentType::TEXT}, + {"slot", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("give_item", {GiveItemHandler, "Gives an item to the player as if it was given from an actor", { - {"vanilla|randomizer", LUS::ArgumentType::TEXT}, - {"giveItemID", LUS::ArgumentType::NUMBER} + {"vanilla|randomizer", Ship::ArgumentType::TEXT}, + {"giveItemID", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("item", {ItemHandler, "Sets item ID in arg 1 into slot arg 2. No boundary checks. Use with caution.", { - {"slot", LUS::ArgumentType::NUMBER}, - {"item id", LUS::ArgumentType::NUMBER} + {"slot", Ship::ArgumentType::NUMBER}, + {"item id", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("invisible", {InvisibleHandler, "Activate Link's Elvish cloak, making him appear invisible.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("giant_link", {GiantLinkHandler, "Turn Link into a giant Lonky boi.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("minish_link", {MinishLinkHandler, "Turn Link into a minish boi.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("add_heart_container", @@ -1421,25 +1497,25 @@ void DebugConsole_Init(void) { {RemoveHeartContainerHandler, "Remove a heart from Link. The minimal amount of hearts is 3."}); CMD_REGISTER("gravity", {GravityHandler, "Set gravity level.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("no_ui", {NoUIHandler, "Disables the UI.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("freeze", {FreezeHandler, "Freezes Link in place"}); CMD_REGISTER("defense_modifier", {DefenseModifierHandler, "Sets the defense modifier.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("damage", {DamageHandler, "Deal damage to Link.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("heal", {HealHandler, "Heals Link.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("fill_magic", {FillMagicHandler, "Fills magic."}); @@ -1447,50 +1523,50 @@ void DebugConsole_Init(void) { CMD_REGISTER("empty_magic", {EmptyMagicHandler, "Empties magic."}); CMD_REGISTER("no_z", {NoZHandler, "Disables Z-button presses.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("ohko", {OneHitKOHandler, "Activates one hit KO. Any damage kills Link and he cannot gain health in this mode.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("pacifist", {PacifistHandler, "Activates pacifist mode. Prevents Link from using his weapon.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("paper_link", {PaperLinkHandler, "Link but made out of paper.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("rainstorm", {RainstormHandler, "Activates rainstorm."}); CMD_REGISTER("reverse_controls", {ReverseControlsHandler, "Reverses the controls.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("update_rupees", {UpdateRupeesHandler, "Adds rupees.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("speed_modifier", {SpeedModifierHandler, "Sets the speed modifier.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("boots", {BootsHandler, "Activates boots.", { - {"kokiri|iron|hover", LUS::ArgumentType::TEXT}, + {"kokiri|iron|hover", Ship::ArgumentType::TEXT}, }}); CMD_REGISTER("giveshield", {GiveShieldHandler, "Gives a shield and equips it when Link is the right age for it.", { - {"deku|hylian|mirror", LUS::ArgumentType::TEXT}, + {"deku|hylian|mirror", Ship::ArgumentType::TEXT}, }}); CMD_REGISTER("takeshield", {TakeShieldHandler, "Takes a shield and unequips it if Link is wearing it.", { - {"deku|hylian|mirror", LUS::ArgumentType::TEXT}, + {"deku|hylian|mirror", Ship::ArgumentType::TEXT}, }}); CMD_REGISTER("knockback", {KnockbackHandler, "Knocks Link back.", { - {"value", LUS::ArgumentType::NUMBER} + {"value", Ship::ArgumentType::NUMBER} }}); CMD_REGISTER("electrocute", {ElectrocuteHandler, "Electrocutes Link."}); @@ -1500,16 +1576,18 @@ void DebugConsole_Init(void) { CMD_REGISTER("cucco_storm", {CuccoStormHandler, "Cucco Storm"}); CMD_REGISTER("gen_rando", {GenerateRandoHandler, "Generate a randomizer seed", { - {"seed|count", LUS::ArgumentType::NUMBER, true}, - {"testing", LUS::ArgumentType::NUMBER, true}, + {"seed|count", Ship::ArgumentType::NUMBER, true}, + {"testing", Ship::ArgumentType::NUMBER, true}, }}); CMD_REGISTER("cosmetics", {CosmeticsHandler, "Change cosmetics.", { - {"reset|randomize", LUS::ArgumentType::TEXT}, + {"reset|randomize", Ship::ArgumentType::TEXT}, + {"group name", Ship::ArgumentType::TEXT, true}, }}); CMD_REGISTER("sfx", {SfxHandler, "Change SFX.", { - {"reset|randomize", LUS::ArgumentType::TEXT}, + {"reset|randomize", Ship::ArgumentType::TEXT}, + {"group_name", Ship::ArgumentType::TEXT, true}, }}); CVarSave(); diff --git a/soh/soh/Enhancements/debugger/MessageViewer.cpp b/soh/soh/Enhancements/debugger/MessageViewer.cpp index 92ae5070d..db0585b99 100644 --- a/soh/soh/Enhancements/debugger/MessageViewer.cpp +++ b/soh/soh/Enhancements/debugger/MessageViewer.cpp @@ -121,7 +121,7 @@ void FindMessage(PlayState* play, const uint16_t textId, const uint8_t language) Font* font; u16 bufferId = textId; // Use the better owl message if better owl is enabled - if (CVarGetInteger("gBetterOwl", 0) != 0 && (bufferId == 0x2066 || bufferId == 0x607B || + if (CVarGetInteger(CVAR_ENHANCEMENT("BetterOwl"), 0) != 0 && (bufferId == 0x2066 || bufferId == 0x607B || bufferId == 0x10C2 || bufferId == 0x10C6 || bufferId == 0x206A)) { bufferId = 0x71B3; diff --git a/soh/soh/Enhancements/debugger/MessageViewer.h b/soh/soh/Enhancements/debugger/MessageViewer.h index 702693793..43ae55aa7 100644 --- a/soh/soh/Enhancements/debugger/MessageViewer.h +++ b/soh/soh/Enhancements/debugger/MessageViewer.h @@ -26,7 +26,7 @@ void MessageDebug_DisplayCustomMessage(const char* customMessage); } -class MessageViewer : public LUS::GuiWindow { +class MessageViewer : public Ship::GuiWindow { public: static inline const char* TABLE_ID = "MessageViewer"; using GuiWindow::GuiWindow; diff --git a/soh/soh/Enhancements/debugger/actorViewer.cpp b/soh/soh/Enhancements/debugger/actorViewer.cpp index e2b45a419..3e4d271a8 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.cpp +++ b/soh/soh/Enhancements/debugger/actorViewer.cpp @@ -12,6 +12,7 @@ #include #include #include +#include "soh/OTRGlobals.h" extern "C" { #include @@ -887,7 +888,7 @@ std::vector GetActorsWithDescriptionContainingString(std::string s) { } void ActorViewer_AddTagForActor(Actor* actor) { - int val = CVarGetInteger("gDebugActorViewerNameTags", ACTORVIEWER_NAMETAGS_NONE); + int val = CVarGetInteger(CVAR_DEVELOPER_TOOLS("ActorViewer.NameTags"), ACTORVIEWER_NAMETAGS_NONE); auto entry = ActorDB::Instance->RetrieveEntry(actor->id); std::string tag; @@ -1129,10 +1130,10 @@ void ActorViewerWindow::DrawElement() { newActor.params = 0; } - UIWidgets::EnhancementCheckbox("Advanced mode", "gActorViewerAdvancedParams"); + UIWidgets::EnhancementCheckbox("Advanced mode", CVAR_DEVELOPER_TOOLS("ActorViewer.AdvancedParams")); UIWidgets::InsertHelpHoverText("Changes the actor specific param menus with a direct input"); - if (CVarGetInteger("gActorViewerAdvancedParams", 0)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ActorViewer.AdvancedParams"), 0)) { ImGui::InputScalar("params", ImGuiDataType_S16, &newActor.params, &one); } else if (std::find(noParamsActors.begin(), noParamsActors.end(), newActor.id) == noParamsActors.end()) { CreateActorSpecificData(); @@ -1214,7 +1215,7 @@ void ActorViewerWindow::DrawElement() { UIWidgets::Spacer(0); ImGui::Text("Actor Name Tags"); - if (UIWidgets::EnhancementCombobox("gDebugActorViewerNameTags", nameTagOptions, ACTORVIEWER_NAMETAGS_NONE)) { + if (UIWidgets::EnhancementCombobox(CVAR_DEVELOPER_TOOLS("ActorViewer.NameTags"), nameTagOptions, ACTORVIEWER_NAMETAGS_NONE)) { NameTag_RemoveAllByTag(DEBUG_ACTOR_NAMETAG_TAG); ActorViewer_AddTagForAllActors(); } diff --git a/soh/soh/Enhancements/debugger/actorViewer.h b/soh/soh/Enhancements/debugger/actorViewer.h index 6eceaa92d..2f4ca680a 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.h +++ b/soh/soh/Enhancements/debugger/actorViewer.h @@ -2,7 +2,7 @@ #include -class ActorViewerWindow : public LUS::GuiWindow { +class ActorViewerWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; diff --git a/soh/soh/Enhancements/debugger/colViewer.cpp b/soh/soh/Enhancements/debugger/colViewer.cpp index 135dcb0f0..159e27128 100644 --- a/soh/soh/Enhancements/debugger/colViewer.cpp +++ b/soh/soh/Enhancements/debugger/colViewer.cpp @@ -7,6 +7,7 @@ #include #include #include +#include "soh/OTRGlobals.h" extern "C" { #include @@ -57,17 +58,17 @@ void ColViewerWindow::DrawElement() { ImGui::End(); return; } - UIWidgets::EnhancementCheckbox("Enabled", "gColViewerEnabled"); + UIWidgets::EnhancementCheckbox("Enabled", CVAR_DEVELOPER_TOOLS("ColViewer.Enabled")); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", "gColViewerScene", ColRenderSettingNames, COLVIEW_DISABLED); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Bg Actors", "gColViewerBgActors", ColRenderSettingNames, COLVIEW_DISABLED); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Col Check", "gColViewerColCheck", ColRenderSettingNames, COLVIEW_DISABLED); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Waterbox", "gColViewerWaterbox", ColRenderSettingNames, COLVIEW_DISABLED); + UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), ColRenderSettingNames, COLVIEW_DISABLED); + UIWidgets::LabeledRightAlignedEnhancementCombobox("Bg Actors", CVAR_DEVELOPER_TOOLS("ColViewer.BGActors"), ColRenderSettingNames, COLVIEW_DISABLED); + UIWidgets::LabeledRightAlignedEnhancementCombobox("Col Check", CVAR_DEVELOPER_TOOLS("ColViewer.ColCheck"), ColRenderSettingNames, COLVIEW_DISABLED); + UIWidgets::LabeledRightAlignedEnhancementCombobox("Waterbox", CVAR_DEVELOPER_TOOLS("ColViewer.Waterbox"), ColRenderSettingNames, COLVIEW_DISABLED); - UIWidgets::EnhancementCheckbox("Apply as decal", "gColViewerDecal"); + UIWidgets::EnhancementCheckbox("Apply as decal", CVAR_DEVELOPER_TOOLS("ColViewer.Decal")); UIWidgets::InsertHelpHoverText("Applies the collision as a decal display. This can be useful if there is z-fighting occuring " "with the scene geometry, but can cause other artifacts."); - UIWidgets::EnhancementCheckbox("Shaded", "gColViewerShaded"); + UIWidgets::EnhancementCheckbox("Shaded", CVAR_DEVELOPER_TOOLS("ColViewer.Shaded")); UIWidgets::InsertHelpHoverText("Applies the scene's shading to the collision display."); // This has to be duplicated in both code paths due to the nature of ImGui::IsItemHovered() @@ -75,20 +76,20 @@ void ColViewerWindow::DrawElement() { if (ImGui::TreeNode("Colors")) { UIWidgets::InsertHelpHoverText(colorHelpText); - UIWidgets::EnhancementColor("Normal", "gColViewerColorNormal", scene_col, ImVec4(255, 255, 255, 255), false); - UIWidgets::EnhancementColor("Hookshot", "gColViewerColorHookshot", hookshot_col, ImVec4(128, 128, 255, 255), + UIWidgets::EnhancementColor("Normal", CVAR_DEVELOPER_TOOLS("ColViewer.ColorNormal"), scene_col, ImVec4(255, 255, 255, 255), false); + UIWidgets::EnhancementColor("Hookshot", CVAR_DEVELOPER_TOOLS("ColViewer.ColorHookshot"), hookshot_col, ImVec4(128, 128, 255, 255), false); - UIWidgets::EnhancementColor("Entrance", "gColViewerColorEntrance", entrance_col, ImVec4(0, 255, 0, 255), false); - UIWidgets::EnhancementColor("Special Surface (Grass/Sand/Etc)", "gColViewerColorSpecialSurface", + UIWidgets::EnhancementColor("Entrance", CVAR_DEVELOPER_TOOLS("ColViewer.ColorEntrance"), entrance_col, ImVec4(0, 255, 0, 255), false); + UIWidgets::EnhancementColor("Special Surface (Grass/Sand/Etc)", CVAR_DEVELOPER_TOOLS("ColViewer.ColorSpecialSurface"), specialSurface_col, ImVec4(192, 255, 192, 255), false); - UIWidgets::EnhancementColor("Interactable (Vines/Crawlspace/Etc)", "gColViewerColorInteractable", + UIWidgets::EnhancementColor("Interactable (Vines/Crawlspace/Etc)", CVAR_DEVELOPER_TOOLS("ColViewer.ColorInteractable"), interactable_col, ImVec4(192, 0, 192, 255), false); - UIWidgets::EnhancementColor("Slope", "gColViewerColorSlope", slope_col, ImVec4(255, 255, 128, 255), false); - UIWidgets::EnhancementColor("Void", "gColViewerColorVoid", void_col, ImVec4(255, 0, 0, 255), false); - UIWidgets::EnhancementColor("OC", "gColViewerColorOC", oc_col, ImVec4(255, 255, 255, 255), false); - UIWidgets::EnhancementColor("AC", "gColViewerColorAC", ac_col, ImVec4(0, 0, 255, 255), false); - UIWidgets::EnhancementColor("AT", "gColViewerColorAT", at_col, ImVec4(255, 0, 0, 255), false); - UIWidgets::EnhancementColor("Waterbox", "gColViewerColorWaterbox", waterbox_col, ImVec4(0, 0, 255, 255), false); + UIWidgets::EnhancementColor("Slope", CVAR_DEVELOPER_TOOLS("ColViewer.ColorSlope"), slope_col, ImVec4(255, 255, 128, 255), false); + UIWidgets::EnhancementColor("Void", CVAR_DEVELOPER_TOOLS("ColViewer.ColorVoid"), void_col, ImVec4(255, 0, 0, 255), false); + UIWidgets::EnhancementColor("OC", CVAR_DEVELOPER_TOOLS("ColViewer.ColorOC"), oc_col, ImVec4(255, 255, 255, 255), false); + UIWidgets::EnhancementColor("AC", CVAR_DEVELOPER_TOOLS("ColViewer.ColorAC"), ac_col, ImVec4(0, 0, 255, 255), false); + UIWidgets::EnhancementColor("AT", CVAR_DEVELOPER_TOOLS("ColViewer.ColorAT"), at_col, ImVec4(255, 0, 0, 255), false); + UIWidgets::EnhancementColor("Waterbox", CVAR_DEVELOPER_TOOLS("ColViewer.ColorWaterbox"), waterbox_col, ImVec4(0, 0, 255, 255), false); ImGui::TreePop(); } else { @@ -308,7 +309,7 @@ void InitGfx(std::vector& gfx, ColRenderSetting setting) { alpha = 0xFF; } - if (CVarGetInteger("gColViewerDecal", 0) != 0) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Decal"), 0) != 0) { rm |= ZMODE_DEC; } else if (setting == ColRenderSetting::Transparent) { rm |= ZMODE_XLU; @@ -320,7 +321,7 @@ void InitGfx(std::vector& gfx, ColRenderSetting setting) { gfx.push_back(gsDPSetCycleType(G_CYC_1CYCLE)); gfx.push_back(gsDPSetRenderMode(rm | blc1, rm | blc2)); - if (CVarGetInteger("gColViewerShaded", 0) != 0) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Shaded"), 0) != 0) { gfx.push_back(gsDPSetCombineMode(G_CC_MODULATERGB_PRIM_ENVA, G_CC_MODULATERGB_PRIM_ENVA)); gfx.push_back(gsSPLoadGeometryMode(G_CULL_BACK | G_ZBUFFER | G_LIGHTING)); } else { @@ -333,16 +334,13 @@ void InitGfx(std::vector& gfx, ColRenderSetting setting) { // Draws a dynapoly structure (scenes or Bg Actors) void DrawDynapoly(std::vector& dl, CollisionHeader* col, int32_t bgId) { - uint32_t colorR = CVarGetInteger("gColViewerColorNormalR", 255); - uint32_t colorG = CVarGetInteger("gColViewerColorNormalG", 255); - uint32_t colorB = CVarGetInteger("gColViewerColorNormalB", 255); - uint32_t colorA = 255; + Color_RGBA8 color = {255, 255, 255, 255}; - uint32_t lastColorR = colorR; - uint32_t lastColorG = colorG; - uint32_t lastColorB = colorB; + uint32_t lastColorR = color.r; + uint32_t lastColorG = color.g; + uint32_t lastColorB = color.b; - dl.push_back(gsDPSetPrimColor(0, 0, colorR, colorG, colorB, colorA)); + dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); // This keeps track of if we have processed a poly, but not drawn it yet so we can batch them. // This saves several hundred commands in larger scenes @@ -352,49 +350,35 @@ void DrawDynapoly(std::vector& dl, CollisionHeader* col, int32_t bgId) { CollisionPoly* poly = &col->polyList[i]; if (SurfaceType_IsHookshotSurface(&gPlayState->colCtx, poly, bgId)) { - colorR = CVarGetInteger("gColViewerColorHookshotR", 128); - colorG = CVarGetInteger("gColViewerColorHookshotG", 128); - colorB = CVarGetInteger("gColViewerColorHookshotB", 255); + color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorHookshot"), { 128, 128, 255, 255 }); } else if (func_80041D94(&gPlayState->colCtx, poly, bgId) > 0x01) { - colorR = CVarGetInteger("gColViewerColorInteractableR", 192); - colorG = CVarGetInteger("gColViewerColorInteractableG", 0); - colorB = CVarGetInteger("gColViewerColorInteractableB", 192); + color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorInteractable"), {192, 0, 192, 255}); } else if (func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x0C) { - colorR = CVarGetInteger("gColViewerColorVoidR", 255); - colorG = CVarGetInteger("gColViewerColorVoidG", 0); - colorB = CVarGetInteger("gColViewerColorVoidB", 0); + color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorVoid"), { 255, 0, 0, 255 }); } else if (SurfaceType_GetSceneExitIndex(&gPlayState->colCtx, poly, bgId) || func_80041E80(&gPlayState->colCtx, poly, bgId) == 0x05) { - colorR = CVarGetInteger("gColViewerColorEntranceR", 0); - colorG = CVarGetInteger("gColViewerColorEntranceG", 255); - colorB = CVarGetInteger("gColViewerColorEntranceB", 0); + color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorEntrance"), { 0, 255, 0, 255 }); } else if (func_80041D4C(&gPlayState->colCtx, poly, bgId) != 0 || SurfaceType_IsWallDamage(&gPlayState->colCtx, poly, bgId)) { - colorR = CVarGetInteger("gColViewerColorSpecialSurfaceR", 192); - colorG = CVarGetInteger("gColViewerColorSpecialSurfaceG", 255); - colorB = CVarGetInteger("gColViewerColorSpecialSurfaceB", 192); + color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorSpecialSurface"), { 192, 255, 192, 255 }); } else if (SurfaceType_GetSlope(&gPlayState->colCtx, poly, bgId) == 0x01) { - colorR = CVarGetInteger("gColViewerColorSlopeR", 255); - colorG = CVarGetInteger("gColViewerColorSlopeG", 255); - colorB = CVarGetInteger("gColViewerColorSlopeB", 128); + color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorSlope"), { 255, 255, 128, 255 }); } else { - colorR = CVarGetInteger("gColViewerColorNormalR", 255); - colorG = CVarGetInteger("gColViewerColorNormalG", 255); - colorB = CVarGetInteger("gColViewerColorNormalB", 255); + color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorNormal"), { 255, 255, 255, 255 }); } - if (colorR != lastColorR || colorG != lastColorG || colorB != lastColorB) { + if (color.r != lastColorR || color.g != lastColorG || color.b != lastColorB) { // Color changed, flush previous poly if (previousPoly) { dl.push_back(gsSPVertex((uintptr_t)&vtxDl.at(vtxDl.size() - 3), 3, 0)); dl.push_back(gsSP1Triangle(0, 1, 2, 0)); previousPoly = false; } - dl.push_back(gsDPSetPrimColor(0, 0, colorR, colorG, colorB, colorA)); + dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); } - lastColorR = colorR; - lastColorG = colorG; - lastColorB = colorB; + lastColorR = color.r; + lastColorG = color.g; + lastColorB = color.b; Vec3s* va = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIA)]; Vec3s* vb = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIB)]; @@ -428,9 +412,9 @@ void DrawDynapoly(std::vector& dl, CollisionHeader* col, int32_t bgId) { // Draws the scene void DrawSceneCollision() { - ColRenderSetting showSceneColSetting = (ColRenderSetting)CVarGetInteger("gColViewerScene", COLVIEW_DISABLED); + ColRenderSetting showSceneColSetting = (ColRenderSetting)CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), COLVIEW_DISABLED); - if (showSceneColSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { + if (showSceneColSetting == ColRenderSetting::Disabled || !CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"), 0)) { return; } @@ -443,8 +427,8 @@ void DrawSceneCollision() { // Draws all Bg Actors void DrawBgActorCollision() { - ColRenderSetting showBgActorSetting = (ColRenderSetting)CVarGetInteger("gColViewerBgActors", COLVIEW_DISABLED); - if (showBgActorSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { + ColRenderSetting showBgActorSetting = (ColRenderSetting)CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.BGActors"), COLVIEW_DISABLED); + if (showBgActorSetting == ColRenderSetting::Disabled || !CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"), 0)) { return; } @@ -568,8 +552,8 @@ void DrawColCheckList(std::vector& dl, Collider** objects, int32_t count) { // Draws all Col Check objects void DrawColCheckCollision() { - ColRenderSetting showColCheckSetting = (ColRenderSetting)CVarGetInteger("gColViewerColCheck", COLVIEW_DISABLED); - if (showColCheckSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { + ColRenderSetting showColCheckSetting = (ColRenderSetting)CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.ColCheck"), COLVIEW_DISABLED); + if (showColCheckSetting == ColRenderSetting::Disabled || !CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"), 0)) { return; } @@ -578,15 +562,14 @@ void DrawColCheckCollision() { dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH)); CollisionCheckContext& col = gPlayState->colChkCtx; - - dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorOCR", 255), CVarGetInteger("gColViewerColorOCG", 255), - CVarGetInteger("gColViewerColorOCB", 255), 255)); + Color_RGBA8 color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorOC"), { 255, 255, 255, 255 }); + dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); DrawColCheckList(dl, col.colOC, col.colOCCount); - dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorACR", 0), CVarGetInteger("gColViewerColorACG", 0), - CVarGetInteger("gColViewerColorACB", 255), 255)); + color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorAC"), { 0, 0, 255, 255 }); + dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); DrawColCheckList(dl, col.colAC, col.colACCount); - dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorATR", 255), CVarGetInteger("gColViewerColorATG", 0), - CVarGetInteger("gColViewerColorATB", 0), 255)); + color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorAT"), { 0, 0, 255, 255 }); + dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); DrawColCheckList(dl, col.colAT, col.colATCount); } @@ -621,8 +604,8 @@ extern "C" f32 zdWaterBoxMinY; // Draws all waterboxes void DrawWaterboxList() { - ColRenderSetting showWaterboxSetting = (ColRenderSetting)CVarGetInteger("gColViewerWaterbox", COLVIEW_DISABLED); - if (showWaterboxSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { + ColRenderSetting showWaterboxSetting = (ColRenderSetting)CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Waterbox"), COLVIEW_DISABLED); + if (showWaterboxSetting == ColRenderSetting::Disabled || !CVarGetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"), 0)) { return; } @@ -630,9 +613,9 @@ void DrawWaterboxList() { InitGfx(dl, showWaterboxSetting); dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH)); - dl.push_back(gsDPSetPrimColor(0, 0, CVarGetInteger("gColViewerColorWaterboxR", 0), - CVarGetInteger("gColViewerColorWaterboxG", 0), - CVarGetInteger("gColViewerColorWaterboxB", 255), 255)); + Color_RGBA8 color = CVarGetColor(CVAR_DEVELOPER_TOOLS("ColViewer.ColorWaterbox"), { 0, 0, 255, 255 }); + + dl.push_back(gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); CollisionHeader* col = gPlayState->colCtx.colHeader; for (int32_t waterboxIndex = 0; waterboxIndex < col->numWaterBoxes; waterboxIndex++) { @@ -693,7 +676,7 @@ extern "C" void DrawColViewer() { OPEN_DISPS(gPlayState->state.gfxCtx); - uint8_t mirroredWorld = CVarGetInteger("gMirroredWorld", 0); + uint8_t mirroredWorld = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0); // Col viewer needs inverted culling in mirror mode for both OPA and XLU buffers if (mirroredWorld) { gSPSetExtraGeometryMode(POLY_OPA_DISP++, G_EX_INVERT_CULLING); diff --git a/soh/soh/Enhancements/debugger/colViewer.h b/soh/soh/Enhancements/debugger/colViewer.h index 98f0b6f0a..5252bc950 100644 --- a/soh/soh/Enhancements/debugger/colViewer.h +++ b/soh/soh/Enhancements/debugger/colViewer.h @@ -14,7 +14,7 @@ typedef enum { } ColViewerRenderSetting; #ifdef __cplusplus -class ColViewerWindow : public LUS::GuiWindow { +class ColViewerWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index 468a46aca..660bda7d8 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -614,7 +614,7 @@ void DrawInfoTab() { void DrawBGSItemFlag(uint8_t itemID) { const ItemMapEntry& slotEntry = itemMapping[itemID]; - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1)); + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1)); ImGui::SameLine(); int tradeIndex = itemID - ITEM_POCKET_EGG; bool hasItem = (gSaveContext.adultTradeItems & (1 << tradeIndex)) != 0; @@ -656,7 +656,7 @@ void DrawInventoryTab() { uint8_t item = gSaveContext.inventory.items[index]; if (item != ITEM_NONE) { const ItemMapEntry& slotEntry = itemMapping.find(item)->second; - if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), + if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { selectedIndex = index; ImGui::OpenPopup(itemPopupPicker); @@ -704,7 +704,7 @@ void DrawInventoryTab() { ImGui::SameLine(); } const ItemMapEntry& slotEntry = possibleItems[pickerIndex]; - if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), + if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { gSaveContext.inventory.items[selectedIndex] = slotEntry.id; // Set adult trade item flag if you're playing adult trade shuffle in rando @@ -742,7 +742,7 @@ void DrawInventoryTab() { ImGui::PushItemWidth(32.0f); ImGui::BeginGroup(); - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[item].name), ImVec2(32.0f, 32.0f)); + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[item].name), ImVec2(32.0f, 32.0f)); ImGui::InputScalar("##ammoInput", ImGuiDataType_S8, &AMMO(item)); ImGui::EndGroup(); @@ -1187,7 +1187,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const uint8_t item = items[CUR_UPG_VALUE(categoryId)]; if (item != ITEM_NONE) { const ItemMapEntry& slotEntry = itemMapping[item]; - if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), + if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { ImGui::OpenPopup(upgradePopupPicker); } @@ -1215,7 +1215,7 @@ void DrawUpgradeIcon(const std::string& categoryName, int32_t categoryId, const UIWidgets::SetLastItemHoverText("None"); } else { const ItemMapEntry& slotEntry = itemMapping[items[pickerIndex]]; - if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), + if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(slotEntry.name), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { Inventory_ChangeUpgrade(categoryId, pickerIndex); ImGui::CloseCurrentPopup(); @@ -1252,7 +1252,7 @@ void DrawEquipmentTab() { bool hasEquip = (bitMask & gSaveContext.inventory.equipment) != 0; const ItemMapEntry& entry = itemMapping[equipmentValues[i]]; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded), + if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip ? entry.name : entry.nameFaded), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { if (hasEquip) { gSaveContext.inventory.equipment &= ~bitMask; @@ -1351,7 +1351,7 @@ void DrawQuestItemButton(uint32_t item) { uint32_t bitMask = 1 << entry.id; bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), + if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { if (hasQuestItem) { gSaveContext.inventory.questItems &= ~bitMask; @@ -1369,7 +1369,7 @@ void DrawDungeonItemButton(uint32_t item, uint32_t scene) { uint32_t bitMask = 1 << (entry.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential bool hasItem = (bitMask & gSaveContext.inventory.dungeonItems[scene]) != 0; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded), + if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem ? entry.name : entry.nameFaded), ImVec2(32.0f, 32.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { if (hasItem) { gSaveContext.inventory.dungeonItems[scene] &= ~bitMask; @@ -1416,7 +1416,7 @@ void DrawQuestStatusTab() { uint32_t bitMask = 1 << entry.id; bool hasQuestItem = (bitMask & gSaveContext.inventory.questItems) != 0; ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0, 0, 0, 0)); - if (ImGui::ImageButton(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), + if (ImGui::ImageButton(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem ? entry.name : entry.nameFaded), ImVec2(16.0f, 24.0f), ImVec2(0, 0), ImVec2(1, 1), 0)) { if (hasQuestItem) { gSaveContext.inventory.questItems &= ~bitMask; @@ -1479,7 +1479,7 @@ void DrawQuestStatusTab() { if (dungeonItemsScene != SCENE_JABU_JABU_BOSS) { float lineHeight = ImGui::GetTextLineHeightWithSpacing(); - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[ITEM_KEY_SMALL].name), ImVec2(lineHeight, lineHeight)); + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(itemMapping[ITEM_KEY_SMALL].name), ImVec2(lineHeight, lineHeight)); ImGui::SameLine(); if (ImGui::InputScalar("##Keys", ImGuiDataType_S8, gSaveContext.inventory.dungeonKeys + dungeonItemsScene)) { gSaveContext.sohStats.dungeonKeys[dungeonItemsScene] = gSaveContext.inventory.dungeonKeys[dungeonItemsScene]; @@ -1735,7 +1735,7 @@ void DrawPlayerTab() { ImGui::SameLine(); ImGui::InputScalar("C Right", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[3], &one, NULL); - if (CVarGetInteger("gDpadEquips", 0)) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0)) { ImGui::NewLine(); ImGui::Text("Current D-pad Equips"); ImGui::InputScalar("D-pad Up ", ImGuiDataType_U8, &gSaveContext.equips.buttonItems[4], &one, NULL); // Two spaces at the end for aligning, not elegant but it's working @@ -1823,34 +1823,34 @@ void SaveEditorWindow::DrawElement() { void SaveEditorWindow::InitElement() { // Load item icons into ImGui for (const auto& entry : itemMapping) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1)); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1)); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); } for (const auto& entry : gregMapping) { ImVec4 gregGreen = ImVec4(42.0f / 255.0f, 169.0f / 255.0f, 40.0f / 255.0f, 1.0f); ImVec4 gregFadedGreen = gregGreen; gregFadedGreen.w = 0.3f; - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, gregGreen); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, gregGreen); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, gregFadedGreen); } for (const auto& entry : triforcePieceMapping) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1)); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1)); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); } for (const auto& entry : questMapping) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1)); - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.name, entry.second.texturePath, ImVec4(1, 1, 1, 1)); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.second.nameFaded, entry.second.texturePath, ImVec4(1, 1, 1, 0.3f)); } for (const auto& entry : songMapping) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color); ImVec4 fadedCol = entry.color; fadedCol.w = 0.3f; - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol); } for (const auto& entry : vanillaSongMapping) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.name, gSongNoteTex, entry.color); ImVec4 fadedCol = entry.color; fadedCol.w = 0.3f; - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadGuiTexture(entry.nameFaded, gSongNoteTex, fadedCol); } } diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.h b/soh/soh/Enhancements/debugger/debugSaveEditor.h index 53cd4b7ae..e5086f5b8 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.h +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.h @@ -691,7 +691,7 @@ const std::vector state3 = { "Travelling to Hook Target" }; -class SaveEditorWindow : public LUS::GuiWindow { +class SaveEditorWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; diff --git a/soh/soh/Enhancements/debugger/dlViewer.cpp b/soh/soh/Enhancements/debugger/dlViewer.cpp index 028234fc1..790f426df 100644 --- a/soh/soh/Enhancements/debugger/dlViewer.cpp +++ b/soh/soh/Enhancements/debugger/dlViewer.cpp @@ -65,7 +65,7 @@ std::map cmdMap = { }; void PerformDisplayListSearch() { - auto result = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles("*" + std::string(searchString) + "*DL*"); + auto result = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles("*" + std::string(searchString) + "*DL*"); displayListSearchResults.clear(); @@ -127,7 +127,7 @@ void DLViewerWindow::DrawElement() { } try { - auto res = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(activeDisplayList)); + auto res = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(activeDisplayList)); if (res->GetInitData()->Type != static_cast(LUS::ResourceType::DisplayList)) { ImGui::Text("Resource type is not a Display List. Please choose another."); diff --git a/soh/soh/Enhancements/debugger/dlViewer.h b/soh/soh/Enhancements/debugger/dlViewer.h index 348372a49..9d2785456 100644 --- a/soh/soh/Enhancements/debugger/dlViewer.h +++ b/soh/soh/Enhancements/debugger/dlViewer.h @@ -2,7 +2,7 @@ #include -class DLViewerWindow : public LUS::GuiWindow { +class DLViewerWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; diff --git a/soh/soh/Enhancements/debugger/valueViewer.cpp b/soh/soh/Enhancements/debugger/valueViewer.cpp index 213c81cfa..100ad6943 100644 --- a/soh/soh/Enhancements/debugger/valueViewer.cpp +++ b/soh/soh/Enhancements/debugger/valueViewer.cpp @@ -1,5 +1,6 @@ #include "valueViewer.h" #include "../../UIWidgets.hpp" +#include "soh/OTRGlobals.h" extern "C" { #include @@ -109,7 +110,7 @@ void ValueViewerWindow::DrawElement() { return; } - UIWidgets::PaddedEnhancementCheckbox("Enable Printing", "gValueViewer.EnablePrinting"); + UIWidgets::PaddedEnhancementCheckbox("Enable Printing", CVAR_DEVELOPER_TOOLS("ValueViewerEnablePrinting")); ImGui::BeginGroup(); static int selectedElement = -1; @@ -189,7 +190,7 @@ void ValueViewerWindow::DrawElement() { } ImGui::BeginGroup(); - if (CVarGetInteger("gValueViewer.EnablePrinting", 0)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ValueViewerEnablePrinting"), 0)) { ImGui::Checkbox(("Print##" + std::string(element.name)).c_str(), &element.isPrinted); if (element.isPrinted) { char* prefix = (char*)element.prefix.c_str(); diff --git a/soh/soh/Enhancements/debugger/valueViewer.h b/soh/soh/Enhancements/debugger/valueViewer.h index 7631b8c3f..747d39018 100644 --- a/soh/soh/Enhancements/debugger/valueViewer.h +++ b/soh/soh/Enhancements/debugger/valueViewer.h @@ -33,7 +33,7 @@ typedef struct { uint32_t y; } ValueTableElement; -class ValueViewerWindow : public LUS::GuiWindow { +class ValueViewerWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; diff --git a/soh/soh/Enhancements/enemyrandomizer.cpp b/soh/soh/Enhancements/enemyrandomizer.cpp index 65dfb5f0d..ac3df3ce8 100644 --- a/soh/soh/Enhancements/enemyrandomizer.cpp +++ b/soh/soh/Enhancements/enemyrandomizer.cpp @@ -5,6 +5,7 @@ #include "soh/Enhancements/randomizer/context.h" #include "soh/Enhancements/enhancementTypes.h" #include "variables.h" +#include "soh/OTRGlobals.h" extern "C" { #include @@ -234,7 +235,7 @@ extern "C" uint8_t GetRandomizedEnemy(PlayState* play, int16_t *actorId, f32 *po } EnemyEntry GetRandomizedEnemyEntry(uint32_t seed) { - if (CVarGetInteger("gRandomizedEnemies", ENEMY_RANDOMIZER_OFF) == ENEMY_RANDOMIZER_RANDOM_SEEDED) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), ENEMY_RANDOMIZER_OFF) == ENEMY_RANDOMIZER_RANDOM_SEEDED) { uint32_t finalSeed = seed + (IS_RANDO ? Rando::Context::GetInstance()->GetSettings()->GetSeed() : gSaveContext.sohStats.fileCreatedAt); Random_Init(finalSeed); } diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp index 6d66d1c8b..5e61f704d 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp @@ -353,19 +353,19 @@ void GameInteractor::RawAction::SetTimeOfDay(uint32_t time) { } void GameInteractor::RawAction::SetCollisionViewer(bool active) { - CVarSetInteger("gColViewerEnabled", active); - CVarSetInteger("gColViewerDecal", active); + CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Enabled"), active); + CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Decal"), active); if (active) { - CVarSetInteger("gColViewerScene", COLVIEW_TRANSPARENT); - CVarSetInteger("gColViewerBgActors", COLVIEW_TRANSPARENT); - CVarSetInteger("gColViewerColCheck", COLVIEW_TRANSPARENT); - CVarSetInteger("gColViewerWaterbox", COLVIEW_TRANSPARENT); + CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), COLVIEW_TRANSPARENT); + CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.BGActors"), COLVIEW_TRANSPARENT); + CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.ColCheck"), COLVIEW_TRANSPARENT); + CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Waterbox"), COLVIEW_TRANSPARENT); } else { - CVarSetInteger("gColViewerScene", COLVIEW_DISABLED); - CVarSetInteger("gColViewerBgActors", COLVIEW_DISABLED); - CVarSetInteger("gColViewerColCheck", COLVIEW_DISABLED); - CVarSetInteger("gColViewerWaterbox", COLVIEW_DISABLED); + CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Scene"), COLVIEW_DISABLED); + CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.BGActors"), COLVIEW_DISABLED); + CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.ColCheck"), COLVIEW_DISABLED); + CVarSetInteger(CVAR_DEVELOPER_TOOLS("ColViewer.Waterbox"), COLVIEW_DISABLED); } } @@ -428,55 +428,55 @@ void GameInteractor::RawAction::SetCosmeticsColor(uint8_t cosmeticCategory, uint switch (cosmeticCategory) { case GI_COSMETICS_TUNICS: - CVarSetColor("gCosmetics.Link_KokiriTunic.Value", newColor); - CVarSetInteger("gCosmetics.Link_KokiriTunic.Changed", 1); - CVarSetColor("gCosmetics.Link_GoronTunic.Value", newColor); - CVarSetInteger("gCosmetics.Link_GoronTunic.Changed", 1); - CVarSetColor("gCosmetics.Link_ZoraTunic.Value", newColor); - CVarSetInteger("gCosmetics.Link_ZoraTunic.Changed", 1); + CVarSetColor(CVAR_COSMETIC("Link.KokiriTunic.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Link.KokiriTunic.Changed"), 1); + CVarSetColor(CVAR_COSMETIC("Link.GoronTunic.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Link.GoronTunic.Changed"), 1); + CVarSetColor(CVAR_COSMETIC("Link.ZoraTunic.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Link.ZoraTunic.Changed"), 1); break; case GI_COSMETICS_NAVI: - CVarSetColor("gCosmetics.Navi_EnemyPrimary.Value", newColor); - CVarSetInteger("gCosmetics.Navi_EnemyPrimary.Changed", 1); - CVarSetColor("gCosmetics.Navi_EnemySecondary.Value", newColor); - CVarSetInteger("gCosmetics.Navi_EnemySecondary.Changed", 1); - CVarSetColor("gCosmetics.Navi_IdlePrimary.Value", newColor); - CVarSetInteger("gCosmetics.Navi_IdlePrimary.Changed", 1); - CVarSetColor("gCosmetics.Navi_IdleSecondary.Value", newColor); - CVarSetInteger("gCosmetics.Navi_IdleSecondary.Changed", 1); - CVarSetColor("gCosmetics.Navi_NPCPrimary.Value", newColor); - CVarSetInteger("gCosmetics.Navi_NPCPrimary.Changed", 1); - CVarSetColor("gCosmetics.Navi_NPCSecondary.Value", newColor); - CVarSetInteger("gCosmetics.Navi_NPCSecondary.Changed", 1); - CVarSetColor("gCosmetics.Navi_PropsPrimary.Value", newColor); - CVarSetInteger("gCosmetics.Navi_PropsPrimary.Changed", 1); - CVarSetColor("gCosmetics.Navi_PropsSecondary.Value", newColor); - CVarSetInteger("gCosmetics.Navi_PropsSecondary.Changed", 1); + CVarSetColor(CVAR_COSMETIC("Navi.EnemyPrimary.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Navi.EnemyPrimary.Changed"), 1); + CVarSetColor(CVAR_COSMETIC("Navi.EnemySecondary.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Navi.EnemySecondary.Changed"), 1); + CVarSetColor(CVAR_COSMETIC("Navi.IdlePrimary.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Navi.IdlePrimary.Changed"), 1); + CVarSetColor(CVAR_COSMETIC("Navi.IdleSecondary.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Navi.IdleSecondary.Changed"), 1); + CVarSetColor(CVAR_COSMETIC("Navi.NPCPrimary.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Navi.NPCPrimary.Changed"), 1); + CVarSetColor(CVAR_COSMETIC("Navi.NPCSecondary.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Navi.NPCSecondary.Changed"), 1); + CVarSetColor(CVAR_COSMETIC("Navi.PropsPrimary.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Navi.PropsPrimary.Changed"), 1); + CVarSetColor(CVAR_COSMETIC("Navi.PropsSecondary.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Navi.PropsSecondary.Changed"), 1); break; case GI_COSMETICS_HAIR: - CVarSetColor("gCosmetics.Link_Hair.Value", newColor); - CVarSetInteger("gCosmetics.Link_Hair.Changed", 1); + CVarSetColor(CVAR_COSMETIC("Link.Hair.Value"), newColor); + CVarSetInteger(CVAR_COSMETIC("Link.Hair.Changed"), 1); break; } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ApplyOrResetCustomGfxPatches(); } void GameInteractor::RawAction::RandomizeCosmeticsColors(bool excludeBiddingWarColors) { const char* cvarsToLock[12] = { - "gCosmetics.Link_KokiriTunic.Locked", - "gCosmetics.Link_GoronTunic.Locked", - "gCosmetics.Link_ZoraTunic.Locked", - "gCosmetics.Navi_EnemyPrimary.Locked", - "gCosmetics.Navi_EnemySecondary.Locked", - "gCosmetics.Navi_IdlePrimary.Locked", - "gCosmetics.Navi_IdleSecondary.Locked", - "gCosmetics.Navi_NPCPrimary.Locked", - "gCosmetics.Navi_NPCSecondary.Locked", - "gCosmetics.Navi_PropsPrimary.Locked", - "gCosmetics.Navi_PropsSecondary.Locked", - "gCosmetics.Link_Hair.Locked" + CVAR_COSMETIC("Link.KokiriTunic.Locked"), + CVAR_COSMETIC("Link.GoronTunic.Locked"), + CVAR_COSMETIC("Link.ZoraTunic.Locked"), + CVAR_COSMETIC("Navi.EnemyPrimary.Locked"), + CVAR_COSMETIC("Navi.EnemySecondary.Locked"), + CVAR_COSMETIC("Navi.IdlePrimary.Locked"), + CVAR_COSMETIC("Navi.IdleSecondary.Locked"), + CVAR_COSMETIC("Navi.NPCPrimary.Locked"), + CVAR_COSMETIC("Navi.NPCSecondary.Locked"), + CVAR_COSMETIC("Navi.PropsPrimary.Locked"), + CVAR_COSMETIC("Navi.PropsSecondary.Locked"), + CVAR_COSMETIC("Link.Hair.Locked") }; if (excludeBiddingWarColors) { diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Remote.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_Remote.cpp index 2cbd6b379..662d2ea78 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Remote.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Remote.cpp @@ -2,12 +2,13 @@ #include "GameInteractor.h" #include -#include -#include +#include +#include #include #include #include #include +#include "soh/OTRGlobals.h" // MARK: - Remote @@ -16,7 +17,7 @@ void GameInteractor::EnableRemoteInteractor() { return; } - if (SDLNet_ResolveHost(&remoteIP, CVarGetString("gRemote.IP", "127.0.0.1"), CVarGetInteger("gRemote.Port", 43384)) == -1) { + if (SDLNet_ResolveHost(&remoteIP, CVarGetString(CVAR_REMOTE("IP"), "127.0.0.1"), CVarGetInteger(CVAR_REMOTE("Port"), 43384)) == -1) { SPDLOG_ERROR("[GameInteractor] SDLNet_ResolveHost: {}", SDLNet_GetError()); } diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Sail.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_Sail.cpp index a209d8c50..77d48dc80 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Sail.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Sail.cpp @@ -66,7 +66,7 @@ void GameInteractorSail::HandleRemoteJson(nlohmann::json payload) { } std::string command = payload["command"].get(); - std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch(command); + std::reinterpret_pointer_cast(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch(command); responsePayload["status"] = "success"; GameInteractor::Instance->TransmitJsonToRemote(responsePayload); return; @@ -88,7 +88,7 @@ void GameInteractorSail::HandleRemoteJson(nlohmann::json payload) { } std::string command = payload["effect"]["command"].get(); - std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch(command); + std::reinterpret_pointer_cast(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch(command); responsePayload["status"] = "success"; GameInteractor::Instance->TransmitJsonToRemote(responsePayload); return; diff --git a/soh/soh/Enhancements/gameplaystats.cpp b/soh/soh/Enhancements/gameplaystats.cpp index efcf44efb..61eb88a6f 100644 --- a/soh/soh/Enhancements/gameplaystats.cpp +++ b/soh/soh/Enhancements/gameplaystats.cpp @@ -14,6 +14,7 @@ extern "C" { #include #include #include "soh/Enhancements/enhancementTypes.h" +#include "soh/OTRGlobals.h" extern "C" { #include @@ -387,7 +388,7 @@ void GameplayStatsRow(const char* label, const std::string& value, ImVec4 color } bool compareTimestampInfoByTime(const TimestampInfo& a, const TimestampInfo& b) { - return CVarGetInteger("gGameplayStats.TimestampsReverse", 0) ? a.time > b.time : a.time < b.time; + return CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.ReverseTimestamps"), 0) ? a.time > b.time : a.time < b.time; } const char* ResolveSceneID(int sceneID, int roomID){ @@ -442,13 +443,13 @@ void DrawGameplayStatsHeader() { } else { GameplayStatsRow("Total Game Time:", formatTimestampGameplayStat(GAMEPLAYSTAT_TOTAL_TIME), gSaveContext.sohStats.gameComplete ? COLOR_GREEN : COLOR_WHITE); } - if (CVarGetInteger("gGameplayStats.ShowAdditionalTimers", 0)) { // !Only display total game time + if (CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.ShowAdditionalTimers"), 0)) { // !Only display total game time GameplayStatsRow("Gameplay Time:", formatTimestampGameplayStat(gSaveContext.sohStats.playTimer / 2), COLOR_GREY); GameplayStatsRow("Pause Menu Time:", formatTimestampGameplayStat(gSaveContext.sohStats.pauseTimer / 3), COLOR_GREY); GameplayStatsRow("Time in scene:", formatTimestampGameplayStat(gSaveContext.sohStats.sceneTimer / 2), COLOR_LIGHT_BLUE); GameplayStatsRow("Time in room:", formatTimestampGameplayStat(gSaveContext.sohStats.roomTimer / 2), COLOR_LIGHT_BLUE); } - if (gPlayState != NULL && CVarGetInteger("gGameplayStats.ShowDebugInfo", 0)) { // && display debug info + if (gPlayState != NULL && CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.ShowDebugInfo"), 0)) { // && display debug info GameplayStatsRow("play->sceneNum:", formatHexGameplayStat(gPlayState->sceneNum), COLOR_YELLOW); GameplayStatsRow("gSaveContext.entranceIndex:", formatHexGameplayStat(gSaveContext.entranceIndex), COLOR_YELLOW); GameplayStatsRow("gSaveContext.cutsceneIndex:", formatHexOnlyGameplayStat(gSaveContext.cutsceneIndex), COLOR_YELLOW); @@ -538,7 +539,7 @@ void DrawGameplayStatsCountsTab() { GameplayStatsRow("Sword Swings:", formatIntGameplayStat(gSaveContext.sohStats.count[COUNT_SWORD_SWINGS])); GameplayStatsRow("Steps Taken:", formatIntGameplayStat(gSaveContext.sohStats.count[COUNT_STEPS])); // If using MM Bunny Hood enhancement, show how long it's been equipped (not counting pause time) - if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA || gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] > 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA || gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] > 0) { GameplayStatsRow("Bunny Hood Time:", formatTimestampGameplayStat(gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] / 2)); } GameplayStatsRow("Rolls:", formatIntGameplayStat(gSaveContext.sohStats.count[COUNT_ROLLS])); @@ -566,13 +567,13 @@ void DrawGameplayStatsBreakdownTab() { for (int i = 0; i < gSaveContext.sohStats.tsIdx; i++) { std::string sceneName = ResolveSceneID(gSaveContext.sohStats.sceneTimestamps[i].scene, gSaveContext.sohStats.sceneTimestamps[i].room); std::string name; - if (CVarGetInteger("gGameplayStats.RoomBreakdown", 0) && gSaveContext.sohStats.sceneTimestamps[i].scene != SCENE_GROTTOS) { + if (CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), 0) && gSaveContext.sohStats.sceneTimestamps[i].scene != SCENE_GROTTOS) { name = fmt::format("{:s} Room {:d}", sceneName, gSaveContext.sohStats.sceneTimestamps[i].room); } else { name = sceneName; } strcpy(sceneTimestampDisplay[i].name, name.c_str()); - sceneTimestampDisplay[i].time = CVarGetInteger("gGameplayStats.RoomBreakdown", 0) ? + sceneTimestampDisplay[i].time = CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), 0) ? gSaveContext.sohStats.sceneTimestamps[i].roomTime : gSaveContext.sohStats.sceneTimestamps[i].sceneTime; sceneTimestampDisplay[i].color = COLOR_GREY; sceneTimestampDisplay[i].isRoom = gSaveContext.sohStats.sceneTimestamps[i].isRoom; @@ -583,13 +584,13 @@ void DrawGameplayStatsBreakdownTab() { ImGui::TableSetupColumn("stat", ImGuiTableColumnFlags_WidthStretch); for (int i = 0; i < gSaveContext.sohStats.tsIdx; i++) { TimestampInfo tsInfo = sceneTimestampDisplay[i]; - bool canShow = !tsInfo.isRoom || CVarGetInteger("gGameplayStats.RoomBreakdown", 0); + bool canShow = !tsInfo.isRoom || CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), 0); if (tsInfo.time > 0 && strnlen(tsInfo.name, 40) > 1 && canShow) { GameplayStatsRow(tsInfo.name, formatTimestampGameplayStat(tsInfo.time), tsInfo.color); } } std::string toPass; - if (CVarGetInteger("gGameplayStats.RoomBreakdown", 0) && gSaveContext.sohStats.sceneNum != SCENE_GROTTOS) { + if (CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), 0) && gSaveContext.sohStats.sceneNum != SCENE_GROTTOS) { toPass = fmt::format("{:s} Room {:d}", ResolveSceneID(gSaveContext.sohStats.sceneNum, gSaveContext.sohStats.roomNum), gSaveContext.sohStats.roomNum); } else { toPass = ResolveSceneID(gSaveContext.sohStats.sceneNum, gSaveContext.sohStats.roomNum); @@ -600,21 +601,21 @@ void DrawGameplayStatsBreakdownTab() { } void DrawGameplayStatsOptionsTab() { - UIWidgets::PaddedEnhancementCheckbox("Show in-game total timer", "gGameplayStats.ShowIngameTimer", true, false); + UIWidgets::PaddedEnhancementCheckbox("Show in-game total timer", CVAR_ENHANCEMENT("GameplayStats.ShowIngameTimer"), true, false); UIWidgets::InsertHelpHoverText("Keep track of the timer as an in-game HUD element. The position of the timer can be changed in the Cosmetics Editor."); - UIWidgets::PaddedEnhancementCheckbox("Show latest timestamps on top", "gGameplayStats.TimestampsReverse", true, false); - UIWidgets::PaddedEnhancementCheckbox("Room Breakdown", "gGameplayStats.RoomBreakdown", true, false); + UIWidgets::PaddedEnhancementCheckbox("Show latest timestamps on top", CVAR_ENHANCEMENT("GameplayStats.ReverseTimestamps"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Room Breakdown", CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), true, false); ImGui::SameLine(); UIWidgets::InsertHelpHoverText("Allows a more in-depth perspective of time spent in a certain map."); - UIWidgets::PaddedEnhancementCheckbox("RTA Timing on new files", "gGameplayStats.RTATiming", true, false); + UIWidgets::PaddedEnhancementCheckbox("RTA Timing on new files", CVAR_ENHANCEMENT("GameplayStats.RTATiming"), true, false); ImGui::SameLine(); UIWidgets::InsertHelpHoverText( "Timestamps are relative to starting timestamp rather than in game time, usually necessary for races/speedruns.\n\n" "Starting timestamp is on first non-c-up input after intro cutscene.\n\n" "NOTE: THIS NEEDS TO BE SET BEFORE CREATING A FILE TO TAKE EFFECT" ); - UIWidgets::PaddedEnhancementCheckbox("Show additional detail timers", "gGameplayStats.ShowAdditionalTimers", true, false); - UIWidgets::PaddedEnhancementCheckbox("Show Debug Info", "gGameplayStats.ShowDebugInfo"); + UIWidgets::PaddedEnhancementCheckbox("Show additional detail timers", CVAR_ENHANCEMENT("GameplayStats.ShowAdditionalTimers"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Show Debug Info", CVAR_ENHANCEMENT("GameplayStats.ShowDebugInfo")); } void GameplayStatsWindow::DrawElement() { @@ -656,7 +657,7 @@ void InitStats(bool isDebug) { for (int dungeon = 0; dungeon < ARRAY_COUNT(gSaveContext.sohStats.dungeonKeys); dungeon++) { gSaveContext.sohStats.dungeonKeys[dungeon] = isDebug ? 8 : 0; } - gSaveContext.sohStats.rtaTiming = CVarGetInteger("gGameplayStats.RTATiming", 0); + gSaveContext.sohStats.rtaTiming = CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RTATiming"), 0); gSaveContext.sohStats.fileCreatedAt = 0; gSaveContext.sohStats.playTimer = 0; gSaveContext.sohStats.pauseTimer = 0; diff --git a/soh/soh/Enhancements/gameplaystats.h b/soh/soh/Enhancements/gameplaystats.h index 8772dd37f..528da33f9 100644 --- a/soh/soh/Enhancements/gameplaystats.h +++ b/soh/soh/Enhancements/gameplaystats.h @@ -12,7 +12,7 @@ (!gSaveContext.sohStats.fileCreatedAt ? 0 : ((GetUnixTimestamp() - gSaveContext.sohStats.fileCreatedAt) / 100)) :\ (gSaveContext.sohStats.itemTimestamp[TIMESTAMP_DEFEAT_GANON])) :\ (gSaveContext.sohStats.playTimer / 2 + gSaveContext.sohStats.pauseTimer / 3)) -#define CURRENT_MODE_TIMER (CVarGetInteger("gGameplayStats.RoomBreakdown", 0) ?\ +#define CURRENT_MODE_TIMER (CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.RoomBreakdown"), 0) ?\ gSaveContext.sohStats.roomTimer :\ gSaveContext.sohStats.sceneTimer) diff --git a/soh/soh/Enhancements/gameplaystatswindow.h b/soh/soh/Enhancements/gameplaystatswindow.h index 2a3786415..453b24559 100644 --- a/soh/soh/Enhancements/gameplaystatswindow.h +++ b/soh/soh/Enhancements/gameplaystatswindow.h @@ -1,7 +1,7 @@ #include #include "gameplaystats.h" -class GameplayStatsWindow : public LUS::GuiWindow { +class GameplayStatsWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 6e93bf94b..f12b12174 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -72,7 +72,7 @@ void ReloadSceneTogglingLinkAge() { void RegisterInfiniteMoney() { GameInteractor::Instance->RegisterGameHook([]() { if (!GameInteractor::IsSaveLoaded(true)) return; - if (CVarGetInteger("gInfiniteMoney", 0) != 0 && (!IS_RANDO || Flags_GetRandomizerInf(RAND_INF_HAS_WALLET))) { + if (CVarGetInteger(CVAR_CHEAT("InfiniteMoney"), 0) != 0 && (!IS_RANDO || Flags_GetRandomizerInf(RAND_INF_HAS_WALLET))) { if (gSaveContext.rupees < CUR_CAPACITY(UPG_WALLET)) { gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET); } @@ -83,7 +83,7 @@ void RegisterInfiniteMoney() { void RegisterInfiniteHealth() { GameInteractor::Instance->RegisterGameHook([]() { if (!GameInteractor::IsSaveLoaded(true)) return; - if (CVarGetInteger("gInfiniteHealth", 0) != 0) { + if (CVarGetInteger(CVAR_CHEAT("InfiniteHealth"), 0) != 0) { if (gSaveContext.health < gSaveContext.healthCapacity) { gSaveContext.health = gSaveContext.healthCapacity; } @@ -94,7 +94,7 @@ void RegisterInfiniteHealth() { void RegisterInfiniteAmmo() { GameInteractor::Instance->RegisterGameHook([]() { if (!GameInteractor::IsSaveLoaded(true)) return; - if (CVarGetInteger("gInfiniteAmmo", 0) != 0) { + if (CVarGetInteger(CVAR_CHEAT("InfiniteAmmo"), 0) != 0) { // Deku Sticks if (AMMO(ITEM_STICK) < CUR_CAPACITY(UPG_STICKS)) { AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); @@ -131,7 +131,7 @@ void RegisterInfiniteAmmo() { void RegisterInfiniteMagic() { GameInteractor::Instance->RegisterGameHook([]() { if (!GameInteractor::IsSaveLoaded(true)) return; - if (CVarGetInteger("gInfiniteMagic", 0) != 0) { + if (CVarGetInteger(CVAR_CHEAT("InfiniteMagic"), 0) != 0) { if (gSaveContext.isMagicAcquired && gSaveContext.magic != (gSaveContext.isDoubleMagicAcquired + 1) * 0x30) { gSaveContext.magic = (gSaveContext.isDoubleMagicAcquired + 1) * 0x30; } @@ -142,7 +142,7 @@ void RegisterInfiniteMagic() { void RegisterInfiniteNayrusLove() { GameInteractor::Instance->RegisterGameHook([]() { if (!GameInteractor::IsSaveLoaded(true)) return; - if (CVarGetInteger("gInfiniteNayru", 0) != 0) { + if (CVarGetInteger(CVAR_CHEAT("InfiniteNayru"), 0) != 0) { gSaveContext.nayrusLoveTimer = 0x44B; } }); @@ -152,7 +152,7 @@ void RegisterMoonJumpOnL() { GameInteractor::Instance->RegisterGameHook([]() { if (!GameInteractor::IsSaveLoaded(true)) return; - if (CVarGetInteger("gMoonJumpOnL", 0) != 0) { + if (CVarGetInteger(CVAR_CHEAT("MoonJumpOnL"), 0) != 0) { Player* player = GET_PLAYER(gPlayState); if (CHECK_BTN_ANY(gPlayState->state.input[0].cur.button, BTN_L)) { @@ -167,7 +167,7 @@ void RegisterInfiniteISG() { GameInteractor::Instance->RegisterGameHook([]() { if (!GameInteractor::IsSaveLoaded(true)) return; - if (CVarGetInteger("gEzISG", 0) != 0) { + if (CVarGetInteger(CVAR_CHEAT("EasyISG"), 0) != 0) { Player* player = GET_PLAYER(gPlayState); player->meleeWeaponState = 1; } @@ -179,7 +179,7 @@ void RegisterEzQPA() { GameInteractor::Instance->RegisterGameHook([]() { if (!GameInteractor::IsSaveLoaded(true)) return; - if (CVarGetInteger("gEzQPA", 0) != 0) { + if (CVarGetInteger(CVAR_CHEAT("EasyQPA"), 0) != 0) { Player* player = GET_PLAYER(gPlayState); player->meleeWeaponQuads[0].info.toucher.dmgFlags = 0x16171617; player->meleeWeaponQuads[1].info.toucher.dmgFlags = 0x16171617; @@ -191,7 +191,7 @@ void RegisterUnrestrictedItems() { GameInteractor::Instance->RegisterGameHook([]() { if (!GameInteractor::IsSaveLoaded(true)) return; - if (CVarGetInteger("gNoRestrictItems", 0) != 0) { + if (CVarGetInteger(CVAR_CHEAT("NoRestrictItems"), 0) != 0) { u8 sunsBackup = gPlayState->interfaceCtx.restrictions.sunsSong; memset(&gPlayState->interfaceCtx.restrictions, 0, sizeof(gPlayState->interfaceCtx.restrictions)); gPlayState->interfaceCtx.restrictions.sunsSong = sunsBackup; @@ -201,15 +201,15 @@ void RegisterUnrestrictedItems() { void RegisterFreezeTime() { GameInteractor::Instance->RegisterGameHook([]() { - if (CVarGetInteger("gFreezeTime", 0) != 0) { - if (CVarGetInteger("gPrevTime", -1) == -1) { - CVarSetInteger("gPrevTime", gSaveContext.dayTime); + if (CVarGetInteger(CVAR_CHEAT("FreezeTime"), 0) != 0) { + if (CVarGetInteger(CVAR_GENERAL("PrevTime"), -1) == -1) { + CVarSetInteger(CVAR_GENERAL("PrevTime"), gSaveContext.dayTime); } - int32_t prevTime = CVarGetInteger("gPrevTime", gSaveContext.dayTime); + int32_t prevTime = CVarGetInteger(CVAR_GENERAL("PrevTime"), gSaveContext.dayTime); gSaveContext.dayTime = prevTime; } else { - CVarClear("gPrevTime"); + CVarClear(CVAR_GENERAL("PrevTime")); } }); } @@ -220,7 +220,7 @@ void RegisterSwitchAge() { static bool warped = false; if (!GameInteractor::IsSaveLoaded(true)) { - CVarClear("gSwitchAge"); + CVarClear(CVAR_GENERAL("SwitchAge")); warped = false; return; } @@ -230,7 +230,7 @@ void RegisterSwitchAge() { static RoomContext* roomCtx; static s32 roomNum; - if (CVarGetInteger("gSwitchAge", 0) && !warped) { + if (CVarGetInteger(CVAR_GENERAL("SwitchAge"), 0) && !warped) { playerPos = GET_PLAYER(gPlayState)->actor.world.pos; playerYaw = GET_PLAYER(gPlayState)->actor.shape.rot.y; roomCtx = &gPlayState->roomCtx; @@ -249,7 +249,7 @@ void RegisterSwitchAge() { func_80097534(gPlayState, roomCtx); // load map for new room (unloading the previous room) } warped = false; - CVarClear("gSwitchAge"); + CVarClear(CVAR_GENERAL("SwitchAge")); } }); } @@ -259,7 +259,7 @@ void RegisterOcarinaTimeTravel() { GameInteractor::Instance->RegisterGameHook([]() { if (!GameInteractor::IsSaveLoaded(true)) { - CVarClear("gTimeTravel"); + CVarClear(CVAR_ENHANCEMENT("TimeTravel")); return; } @@ -273,16 +273,16 @@ void RegisterOcarinaTimeTravel() { uint8_t hasOcarinaOfTime = (INV_CONTENT(ITEM_OCARINA_TIME) == ITEM_OCARINA_TIME); // If TimeTravel + Player have the Ocarina of Time + Have Master Sword + is in proper range // TODO: Once Swordless Adult is fixed: Remove the Master Sword check - if (((CVarGetInteger("gTimeTravel", 0) == 1 && hasOcarinaOfTime) || CVarGetInteger("gTimeTravel", 0) == 2) && hasMasterSword && + if (((CVarGetInteger(CVAR_ENHANCEMENT("TimeTravel"), 0) == 1 && hasOcarinaOfTime) || CVarGetInteger(CVAR_ENHANCEMENT("TimeTravel"), 0) == 2) && hasMasterSword && gPlayState->msgCtx.lastPlayedSong == OCARINA_SONG_TIME && !nearbyTimeBlockEmpty && !nearbyTimeBlock && !nearbyOcarinaSpot && !nearbyFrogs) { if (IS_RANDO) { - CVarSetInteger("gSwitchTimeline", 1); + CVarSetInteger(CVAR_GENERAL("SwitchTimeline"), 1); } else if (!IS_RANDO && !nearbyDoorOfTime) { // This check is made for when Link is learning the Song Of Time in a vanilla save file that load a // Temple of Time scene where the only object present is the Door of Time - CVarSetInteger("gSwitchTimeline", 1); + CVarSetInteger(CVAR_GENERAL("SwitchTimeline"), 1); } ReloadSceneTogglingLinkAge(); } @@ -295,13 +295,13 @@ void AutoSave(GetItemEntry itemEntry) { // Don't autosave immediately after buying items from shops to prevent getting them for free! // Don't autosave in the Chamber of Sages since resuming from that map breaks the game // Don't autosave during the Ganon fight when picking up the Master Sword - if ((CVarGetInteger("gAutosave", AUTOSAVE_OFF) != AUTOSAVE_OFF) && (gPlayState != NULL) && (gSaveContext.pendingSale == ITEM_NONE) && + if ((CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) != AUTOSAVE_OFF) && (gPlayState != NULL) && (gSaveContext.pendingSale == ITEM_NONE) && (gPlayState->gameplayFrames > 60 && gSaveContext.cutsceneIndex < 0xFFF0) && (gPlayState->sceneNum != SCENE_GANON_BOSS) && (gPlayState->sceneNum != SCENE_CHAMBER_OF_THE_SAGES)) { - if (((CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_ALL_ITEMS) || (CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_ALL_ITEMS)) && (item != ITEM_NONE)) { + if (((CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_ALL_ITEMS) || (CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_ALL_ITEMS)) && (item != ITEM_NONE)) { // Autosave for all items performSave = true; - } else if (((CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_MAJOR_ITEMS) || (CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_MAJOR_ITEMS)) && (item != ITEM_NONE)) { + } else if (((CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_MAJOR_ITEMS) || (CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_MAJOR_ITEMS)) && (item != ITEM_NONE)) { // Autosave for major items if (itemEntry.modIndex == 0) { switch (item) { @@ -341,7 +341,7 @@ void AutoSave(GetItemEntry itemEntry) { case ITEM_BOMBCHU: case ITEM_BOMBCHUS_5: case ITEM_BOMBCHUS_20: - if (!CVarGetInteger("gBombchuDrops", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("BombchuDrops"), 0)) { performSave = true; } break; @@ -352,9 +352,9 @@ void AutoSave(GetItemEntry itemEntry) { } else if (itemEntry.modIndex == 1 && item != RG_ICE_TRAP) { performSave = true; } - } else if (CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_MAJOR_ITEMS || - CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_ALL_ITEMS || - CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION) { + } else if (CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_MAJOR_ITEMS || + CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_ALL_ITEMS || + CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) == AUTOSAVE_LOCATION) { performSave = true; } if (performSave) { @@ -372,13 +372,13 @@ void RegisterAutoSave() { void RegisterRupeeDash() { GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger("gRupeeDash", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("RupeeDash"), 0)) { return; } // Initialize Timer static uint16_t rupeeDashTimer = 0; - uint16_t rdmTime = CVarGetInteger("gDashInterval", 5) * 20; + uint16_t rdmTime = CVarGetInteger(CVAR_ENHANCEMENT("RupeeDashInterval"), 5) * 20; // Did time change by DashInterval? if (rupeeDashTimer >= rdmTime) { @@ -400,7 +400,7 @@ void RegisterShadowTag() { static uint16_t delayTimer = 60; GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger("gShadowTag", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("ShadowTag"), 0)) { return; } if (gPlayState->sceneNum == SCENE_FOREST_TEMPLE && // Forest Temple Scene @@ -431,7 +431,7 @@ static bool hasAffectedHealth = false; void UpdatePermanentHeartLossState() { if (!GameInteractor::IsSaveLoaded()) return; - if (!CVarGetInteger("gPermanentHeartLoss", 0) && hasAffectedHealth) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("PermanentHeartLoss"), 0) && hasAffectedHealth) { uint8_t heartContainers = gSaveContext.sohStats.heartContainers; // each worth 16 health uint8_t heartPieces = gSaveContext.sohStats.heartPieces; // each worth 4 health, but only in groups of 4 uint8_t startingHealth = 16 * 3; @@ -451,7 +451,7 @@ void RegisterPermanentHeartLoss() { }); GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger("gPermanentHeartLoss", 0) || !GameInteractor::IsSaveLoaded()) return; + if (!CVarGetInteger(CVAR_ENHANCEMENT("PermanentHeartLoss"), 0) || !GameInteractor::IsSaveLoaded()) return; if (gSaveContext.healthCapacity > 16 && gSaveContext.healthCapacity - gSaveContext.health >= 16) { gSaveContext.healthCapacity -= 16; @@ -463,12 +463,12 @@ void RegisterPermanentHeartLoss() { void RegisterDeleteFileOnDeath() { GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger("gDeleteFileOnDeath", 0) || !GameInteractor::IsSaveLoaded() || &gPlayState->gameOverCtx == NULL || &gPlayState->pauseCtx == NULL) return; + if (!CVarGetInteger(CVAR_ENHANCEMENT("DeleteFileOnDeath"), 0) || !GameInteractor::IsSaveLoaded() || &gPlayState->gameOverCtx == NULL || &gPlayState->pauseCtx == NULL) return; if (gPlayState->gameOverCtx.state == GAMEOVER_DEATH_MENU && gPlayState->pauseCtx.state == 9) { SaveManager::Instance->DeleteZeldaFile(gSaveContext.fileNum); hasAffectedHealth = false; - std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset"); + std::reinterpret_pointer_cast(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset"); } }); } @@ -484,7 +484,7 @@ using DayTimeGoldSkulltulasList = std::vector; void RegisterDaytimeGoldSkultullas() { GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger("gNightGSAlwaysSpawn", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("NightGSAlwaysSpawn"), 0)) { return; } @@ -530,7 +530,7 @@ void RegisterDaytimeGoldSkultullas() { } bool IsHyperBossesActive() { - return CVarGetInteger("gHyperBosses", 0) || + return CVarGetInteger(CVAR_ENHANCEMENT("HyperBosses"), 0) || (IS_BOSS_RUSH && gSaveContext.bossRushOptions[BR_OPTIONS_HYPERBOSSES] == BR_CHOICE_HYPERBOSSES_YES); } @@ -598,7 +598,7 @@ void UpdateHyperEnemiesState() { actorUpdateHookId = 0; } - if (CVarGetInteger("gHyperEnemies", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("HyperEnemies"), 0)) { actorUpdateHookId = GameInteractor::Instance->RegisterGameHook([](void* refActor) { // Run the update function a second time to make enemies and minibosses move and act twice as fast. @@ -610,7 +610,7 @@ void UpdateHyperEnemiesState() { bool isExcludedEnemy = actor->id == ACTOR_EN_FIRE_ROCK || actor->id == ACTOR_EN_ENCOUNT2; // Don't apply during cutscenes because it causes weird behaviour and/or crashes on some cutscenes. - if (CVarGetInteger("gHyperEnemies", 0) && isEnemy && !isExcludedEnemy && + if (CVarGetInteger(CVAR_ENHANCEMENT("HyperEnemies"), 0) && isEnemy && !isExcludedEnemy && !Player_InBlockingCsMode(gPlayState, player)) { GameInteractor::RawAction::UpdateActor(actor); } @@ -620,7 +620,7 @@ void UpdateHyperEnemiesState() { void RegisterBonkDamage() { GameInteractor::Instance->RegisterGameHook([]() { - uint8_t bonkOption = CVarGetInteger("gBonkDamageMul", BONK_DAMAGE_NONE); + uint8_t bonkOption = CVarGetInteger(CVAR_ENHANCEMENT("BonkDamageMult"), BONK_DAMAGE_NONE); if (bonkOption == BONK_DAMAGE_NONE) { return; } @@ -666,10 +666,10 @@ void UpdateDirtPathFixState(int32_t sceneNum) { case SCENE_HYRULE_FIELD: case SCENE_KOKIRI_FOREST: case SCENE_HYRULE_CASTLE: - CVarSetInteger("gZFightingMode", CVarGetInteger("gSceneSpecificDirtPathFix", ZFIGHT_FIX_DISABLED)); + CVarSetInteger(CVAR_Z_FIGHTING_MODE, CVarGetInteger(CVAR_ENHANCEMENT("SceneSpecificDirtPathFix"), ZFIGHT_FIX_DISABLED)); return; default: - CVarClear("gZFightingMode"); + CVarClear(CVAR_Z_FIGHTING_MODE); } } @@ -683,7 +683,7 @@ void UpdateMirrorModeState(int32_t sceneNum) { static bool prevMirroredWorld = false; bool nextMirroredWorld = false; - int16_t mirroredMode = CVarGetInteger("gMirroredWorldMode", MIRRORED_WORLD_OFF); + int16_t mirroredMode = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorldMode"), MIRRORED_WORLD_OFF); int16_t inDungeon = (sceneNum >= SCENE_DEKU_TREE && sceneNum <= SCENE_INSIDE_GANONS_CASTLE_COLLAPSE && sceneNum != SCENE_THIEVES_HIDEOUT) || (sceneNum >= SCENE_DEKU_TREE_BOSS && sceneNum <= SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR) || (sceneNum == SCENE_GANON_BOSS); @@ -706,10 +706,10 @@ void UpdateMirrorModeState(int32_t sceneNum) { ((mirroredMode == MIRRORED_WORLD_DUNGEONS_RANDOM || mirroredMode == MIRRORED_WORLD_DUNGEONS_RANDOM_SEEDED) && randomMirror))) ) { nextMirroredWorld = true; - CVarSetInteger("gMirroredWorld", 1); + CVarSetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 1); } else { nextMirroredWorld = false; - CVarClear("gMirroredWorld"); + CVarClear(CVAR_ENHANCEMENT("MirroredWorld")); } if (prevMirroredWorld != nextMirroredWorld) { @@ -725,7 +725,7 @@ void RegisterMirrorModeHandler() { } void UpdatePatchHand() { - if ((CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && LINK_IS_CHILD) { + if ((CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) && LINK_IS_CHILD) { ResourceMgr_PatchGfxByName(gLinkAdultLeftHandHoldingHammerNearDL, "childHammer1", 92, gsSPDisplayListOTRFilePath(gLinkChildLeftFistNearDL)); ResourceMgr_PatchGfxByName(gLinkAdultLeftHandHoldingHammerNearDL, "childHammer2", 93, gsSPEndDisplayList()); ResourceMgr_PatchGfxByName(gLinkAdultRightHandHoldingHookshotNearDL, "childHookshot1", 84, gsSPDisplayListOTRFilePath(gLinkChildRightHandClosedNearDL)); @@ -753,7 +753,7 @@ void UpdatePatchHand() { ResourceMgr_UnpatchGfxByName(gLinkAdultHandHoldingBrokenGiantsKnifeDL, "childBrokenGiantsKnife1"); ResourceMgr_UnpatchGfxByName(gLinkAdultHandHoldingBrokenGiantsKnifeDL, "childBrokenGiantsKnife2"); } - if ((CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && LINK_IS_ADULT) { + if ((CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) && LINK_IS_ADULT) { ResourceMgr_PatchGfxByName(gLinkChildLeftFistAndKokiriSwordNearDL, "adultKokiriSword", 13, gsSPDisplayListOTRFilePath(gLinkAdultLeftHandClosedNearDL)); ResourceMgr_PatchGfxByName(gLinkChildRightHandHoldingSlingshotNearDL, "adultSlingshot", 13, gsSPDisplayListOTRFilePath(gLinkAdultRightHandClosedNearDL)); ResourceMgr_PatchGfxByName(gLinkChildLeftFistAndBoomerangNearDL, "adultBoomerang", 50, gsSPDisplayListOTRFilePath(gLinkAdultLeftHandClosedNearDL)); @@ -774,7 +774,7 @@ void RegisterPatchHandHandler() { void RegisterResetNaviTimer() { GameInteractor::Instance->RegisterGameHook([](int32_t sceneNum) { - if (CVarGetInteger("gEnhancements.ResetNaviTimer", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("ResetNaviTimer"), 0)) { gSaveContext.naviTimer = 0; } }); @@ -1028,16 +1028,16 @@ typedef enum { } AltTrapType; const char* altTrapTypeCvars[] = { - "gAddTraps.Ice", - "gAddTraps.Burn", - "gAddTraps.Shock", - "gAddTraps.Knock", - "gAddTraps.Speed", - "gAddTraps.Bomb", - "gAddTraps.Void", - "gAddTraps.Ammo", - "gAddTraps.Kill", - "gAddTraps.Tele" + CVAR_ENHANCEMENT("ExtraTraps.Ice"), + CVAR_ENHANCEMENT("ExtraTraps.Burn"), + CVAR_ENHANCEMENT("ExtraTraps.Shock"), + CVAR_ENHANCEMENT("ExtraTraps.Knockback"), + CVAR_ENHANCEMENT("ExtraTraps.Speed"), + CVAR_ENHANCEMENT("ExtraTraps.Bomb"), + CVAR_ENHANCEMENT("ExtraTraps.Void"), + CVAR_ENHANCEMENT("ExtraTraps.Ammo"), + CVAR_ENHANCEMENT("ExtraTraps.Kill"), + CVAR_ENHANCEMENT("ExtraTraps.Teleport") }; std::vector getEnabledAddTraps () { @@ -1059,7 +1059,7 @@ void RegisterAltTrapTypes() { static int eventTimer = -1; GameInteractor::Instance->RegisterGameHook([](GetItemEntry itemEntry) { - if (!CVarGetInteger("gAddTraps.enabled", 0) || itemEntry.modIndex != MOD_RANDOMIZER || itemEntry.getItemId != RG_ICE_TRAP) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("ExtraTraps.Enabled"), 0) || itemEntry.modIndex != MOD_RANDOMIZER || itemEntry.getItemId != RG_ICE_TRAP) { return; } roll = RandomElement(getEnabledAddTraps()); @@ -1257,7 +1257,7 @@ void UpdateHurtContainerModeState(bool newState) { void RegisterHurtContainerModeHandler() { GameInteractor::Instance->RegisterGameHook([](int32_t fileNum) { - UpdateHurtContainerModeState(CVarGetInteger("gHurtContainer", 0)); + UpdateHurtContainerModeState(CVarGetInteger(CVAR_ENHANCEMENT("HurtContainer"), 0)); }); } @@ -1276,7 +1276,7 @@ void RegisterRandomizedEnemySizes() { actor->id == ACTOR_BOSS_FD2 || actor->id == ACTOR_EN_DH; // Only apply to enemies and bosses. - if (!CVarGetInteger("gRandomizedEnemySizes", 0) || (actor->category != ACTORCAT_ENEMY && actor->category != ACTORCAT_BOSS) || excludedEnemy) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemySizes"), 0) || (actor->category != ACTORCAT_ENEMY && actor->category != ACTORCAT_BOSS) || excludedEnemy) { return; } @@ -1299,7 +1299,7 @@ void RegisterRandomizedEnemySizes() { Actor_SetScale(actor, actor->scale.z * randomScale); - if (CVarGetInteger("gEnemySizeScalesHealth", 0) && (actor->category == ACTORCAT_ENEMY)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("EnemySizeScalesHealth"), 0) && (actor->category == ACTORCAT_ENEMY)) { // Scale the health based on a smaller factor than randomScale float healthScalingFactor = 0.8f; // Adjust this factor as needed float scaledHealth = actor->colChkInfo.health * (randomScale * healthScalingFactor); @@ -1316,7 +1316,7 @@ void RegisterOpenAllHours() { GameInteractor::Instance->RegisterGameHook([](void* refActor) { Actor* actor = static_cast(refActor); - if (CVarGetInteger("gEnhancements.OpenAllHours", 0) && (actor->id == ACTOR_EN_DOOR)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("OpenAllHours"), 0) && (actor->id == ACTOR_EN_DOOR)) { switch (actor->params) { case 4753: // Night Market Bazaar case 1678: // Night Potion Shop @@ -1343,7 +1343,7 @@ void RegisterOpenAllHours() { void PatchToTMedallions() { // TODO: Refactor the DemoEffect_UpdateJewelAdult and DemoEffect_UpdateJewelChild from z_demo_effect // effects to take effect in there - if (CVarGetInteger("gToTMedallionsColors", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("ToTMedallionsColors"), 0)) { ResourceMgr_PatchGfxByName(tokinoma_room_0DL_007A70, "ToTMedallions_StartGrayscale", 7, gsSPGrayscale(true)); ResourceMgr_PatchGfxByName(tokinoma_room_0DL_007FD0, "ToTMedallions_2_StartGrayscale", 7, gsSPGrayscale(true)); @@ -1409,13 +1409,13 @@ void PatchToTMedallions() { void RegisterToTMedallions() { GameInteractor::Instance->RegisterGameHook([](GetItemEntry _unused) { - if (!CVarGetInteger("gToTMedallionsColors", 0) || !gPlayState || gPlayState->sceneNum != SCENE_TEMPLE_OF_TIME) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("ToTMedallionsColors"), 0) || !gPlayState || gPlayState->sceneNum != SCENE_TEMPLE_OF_TIME) { return; } PatchToTMedallions(); }); GameInteractor::Instance->RegisterGameHook([](int16_t sceneNum) { - if (!CVarGetInteger("gToTMedallionsColors", 0) || sceneNum != SCENE_TEMPLE_OF_TIME) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("ToTMedallionsColors"), 0) || sceneNum != SCENE_TEMPLE_OF_TIME) { return; } PatchToTMedallions(); @@ -1426,7 +1426,7 @@ void RegisterToTMedallions() { void RegisterFloorSwitchesHook() { GameInteractor::Instance->RegisterGameHook([](void* refActor) { Actor* actor = static_cast(refActor); - if (actor->id != ACTOR_OBJ_SWITCH || !CVarGetInteger("gEnhancements.FixFloorSwitches", 0)) { + if (actor->id != ACTOR_OBJ_SWITCH || !CVarGetInteger(CVAR_ENHANCEMENT("FixFloorSwitches"), 0)) { return; } @@ -1442,7 +1442,7 @@ void RegisterFloorSwitchesHook() { void RegisterPauseMenuHooks() { static bool pauseWarpHooksRegistered = false; GameInteractor::Instance->RegisterGameHook([&]() { - if (!GameInteractor::IsSaveLoaded() || !CVarGetInteger("gPauseWarp", 0)) { + if (!GameInteractor::IsSaveLoaded() || !CVarGetInteger(CVAR_ENHANCEMENT("PauseWarp"), 0)) { pauseWarpHooksRegistered = false; return; } @@ -1695,7 +1695,7 @@ extern "C" u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey); void PatchCompasses() { s8 compassesCanBeOutsideDungeon = IS_RANDO && DUNGEON_ITEMS_CAN_BE_OUTSIDE_DUNGEON(RSK_SHUFFLE_MAPANDCOMPASS); - s8 isColoredCompassesEnabled = compassesCanBeOutsideDungeon && CVarGetInteger("gRandoEnhancement.MatchCompassColors", 1); + s8 isColoredCompassesEnabled = compassesCanBeOutsideDungeon && CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MatchCompassColors"), 1); if (isColoredCompassesEnabled) { ResourceMgr_PatchGfxByName(gGiCompassDL, "Compass_PrimColor", 5, gsDPNoOp()); ResourceMgr_PatchGfxByName(gGiCompassDL, "Compass_EnvColor", 6, gsDPNoOp()); diff --git a/soh/soh/Enhancements/nametag.cpp b/soh/soh/Enhancements/nametag.cpp index 038ba4e1f..2adc3fffb 100644 --- a/soh/soh/Enhancements/nametag.cpp +++ b/soh/soh/Enhancements/nametag.cpp @@ -5,6 +5,7 @@ #include "soh/frame_interpolation.h" #include "soh/Enhancements/custom-message/CustomMessageInterfaceAddon.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/OTRGlobals.h" extern "C" { #include "z64.h" @@ -70,11 +71,11 @@ void DrawNameTag(PlayState* play, const NameTag* nameTag) { Color_RGBA8 textboxColor = { 0, 0, 0, 80}; Color_RGBA8 textColor = { 255, 255, 255, 255 }; - if (CVarGetInteger("gCosmetics.Hud_NameTagActorBackground.Changed", 0)) { - textboxColor = CVarGetColor("gCosmetics.Hud_NameTagActorBackground.Value", textboxColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.NameTagActorBackground.Changed"), 0)) { + textboxColor = CVarGetColor(CVAR_COSMETIC("HUD.NameTagActorBackground.Value"), textboxColor); } - if (CVarGetInteger("gCosmetics.Hud_NameTagActorText.Changed", 0)) { - textColor = CVarGetColor("gCosmetics.Hud_NameTagActorText.Value", textColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.NameTagActorText.Changed"), 0)) { + textColor = CVarGetColor(CVAR_COSMETIC("HUD.NameTagActorText.Value"), textColor); } FrameInterpolation_RecordOpenChild(nameTag->actor, 10); @@ -90,7 +91,7 @@ void DrawNameTag(PlayState* play, const NameTag* nameTag) { // Set position, billboard effect, scale (with mirror mode), then center nametag Matrix_Translate(nameTag->actor->world.pos.x, posY, nameTag->actor->world.pos.z, MTXMODE_NEW); Matrix_ReplaceRotation(&play->billboardMtxF); - Matrix_Scale(scale * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1), -scale, 1.0f, MTXMODE_APPLY); + Matrix_Scale(scale * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1), -scale, 1.0f, MTXMODE_APPLY); Matrix_Translate(-(float)nameTag->width / 2, -nameTag->height, 0, MTXMODE_APPLY); Matrix_ToMtx(nameTag->mtx, (char*)__FILE__, __LINE__); diff --git a/soh/soh/Enhancements/pausewarp.c b/soh/soh/Enhancements/pausewarp.c index e0fd97e24..5538e7ad4 100644 --- a/soh/soh/Enhancements/pausewarp.c +++ b/soh/soh/Enhancements/pausewarp.c @@ -85,7 +85,8 @@ void PauseWarp_HandleSelection() { if (gSaveContext.inventory.items[SLOT_OCARINA] != ITEM_NONE) { int aButtonPressed = CHECK_BTN_ALL(gPlayState->state.input->press.button, BTN_A); int song = gPlayState->pauseCtx.cursorPoint[PAUSE_QUEST]; - if (aButtonPressed && CHECK_QUEST_ITEM(song) && song >= QUEST_SONG_MINUET && song <= QUEST_SONG_PRELUDE) { + if (aButtonPressed && CHECK_QUEST_ITEM(song) && song >= QUEST_SONG_MINUET && song <= QUEST_SONG_PRELUDE && + gPlayState->pauseCtx.pageIndex == PAUSE_QUEST && gPlayState->pauseCtx.state == 6) { ActivateWarp(&gPlayState->pauseCtx, song); } } diff --git a/soh/soh/Enhancements/presets.cpp b/soh/soh/Enhancements/presets.cpp index 726863e05..57bfd689c 100644 --- a/soh/soh/Enhancements/presets.cpp +++ b/soh/soh/Enhancements/presets.cpp @@ -40,7 +40,7 @@ void applyPreset(std::vector entries) { } void DrawPresetSelector(PresetType presetTypeId) { - const std::string presetTypeCvar = "gPreset" + std::to_string(presetTypeId); + const std::string presetTypeCvar = CVAR_GENERAL("SelectedPresets.") + std::to_string(presetTypeId); const PresetTypeDefinition presetTypeDef = presetTypes.at(presetTypeId); const uint16_t selectedPresetId = CVarGetInteger(presetTypeCvar.c_str(), 0); const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(selectedPresetId); @@ -70,7 +70,7 @@ void DrawPresetSelector(PresetType presetTypeId) { if (selectedPresetId != 0) { applyPreset(selectedPresetDef.entries); } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::PopStyleVar(1); } diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index d9f55bc59..1f2888809 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -7,6 +7,7 @@ #include #include "soh/Enhancements/randomizer/randomizerTypes.h" #include "soh/Enhancements/enhancementTypes.h" +#include "soh/OTRGlobals.h" enum PresetEntryType { PRESET_ENTRY_TYPE_S32, @@ -59,1114 +60,1080 @@ void applyPreset(std::vector entries); // TODO: Ideally everything below this point will come from one/many JSON files const std::vector enhancementsCvars = { - "gDpadPause", - "gDpadText", - "gDpadOcarina", - "gRStickOcarina", - "gDpadEquips", - "gPauseAnyCursor", - "gDpadNoDropOcarinaInput", - "gNaviOnL", - "gInvertXAxis", - "gInvertYAxis", - "gRightStickAiming", - "gDisableAutoCenterViewFirstPerson", - "gTextSpeed", - "gMweepSpeed", - "gForgeTime", - "gClimbSpeed", - "gFasterBlockPush", - "gCrawlSpeed", - "gFasterHeavyBlockLift", - "gNoForcedNavi", - "gSkulltulaFreeze", - "gMMBunnyHood", - "gAdultBunnyHood", - "gFastChests", - "gChestSizeAndTextureMatchesContents", - "gFastDrops", - "gBetterOwl", - "gFastOcarinaPlayback", - "gInstantPutaway", - "gFastBoomerang", - "gAskToEquip", - "gMaskSelect", - "gRememberSaveLocation", - "gDamageMul", - "gFallDamageMul", - "gVoidDamageMul", - "gBonkDamageMul", - "gNoRandomDrops", - "gNoHeartDrops", - "gBombchuDrops", - "gGoronPot", - "gFullHealthSpawn", - "gDampeWin", - "gRedPotionEffect", - "gRedPotionHealth", - "gRedPercentRestore", - "gGreenPotionEffect", - "gGreenPotionMana", - "gGreenPercentRestore", - "gBluePotionEffects", - "gBluePotionHealth", - "gBlueHealthPercentRestore", - "gBluePotionMana", - "gBlueManaPercentRestore", - "gMilkEffect", - "gMilkHealth", - "gMilkPercentRestore", - "gSeparateHalfMilkEffect", - "gHalfMilkHealth", - "gHalfMilkPercentRestore", - "gFairyEffect", - "gFairyHealth", - "gFairyPercentRestore", - "gFairyReviveEffect", - "gFairyReviveHealth", - "gFairyRevivePercentRestore", - "gCustomizeFishing", - "gInstantFishing", - "gGuaranteeFishingBite", - "gFishNeverEscape", - "gLoachesAlwaysAppear", - "gSkipKeepConfirmation", - "gChildMinimumWeightFish", - "gAdultMinimumWeightFish", - "gLowHpAlarm", - "gMinimalUI", - "gDisableNaviCallAudio", - "gVisualAgony", - "gAssignableTunicsAndBoots", - "gEquipmentCanBeRemoved", - "gCowOfTime", - "gGuardVision", - "gTimeFlowFileSelect", - "gInjectItemCounts", - "gDayGravePull", - "gDampeAllNight", - "gQuitFishingAtDoor", - "gSkipSwimDeepEndAnim", - "gSkipScarecrow", - "gBlueFireArrows", - "gSunlightArrows", - "gPauseLiveLinkRotation", - "gPauseLiveLink", - "gMinFrameCount", - "gN64Mode", - "gNewDrops", - "gDisableBlackBars", - "gDynamicWalletIcon", - "gAlwaysShowDungeonMinimapIcon", - "gUniformLR", - "gNGCKaleidoSwitcher", - "gFixDungeonMinimapIcon", - "gTwoHandedIdle", - "gGravediggingTourFix", - "gDekuNutUpgradeFix", - "gNaviTextFix", - "gAnubisFix", - "gCrouchStabHammerFix", - "gCrouchStabFix", - "gGerudoWarriorClothingFix", - "gFixCameraDrift", - "gFixCameraSwing", - "gFixHangingLedgeSwingRate", - "gRedGanonBlood", - "gHoverFishing", - "gN64WeirdFrames", - "gBombchusOOB", - "gQuickPutaway", - "gGsCutscene", - "gRestoreRBAValues", - "gSkipSaveConfirmation", - "gAutosave", - "gDisableCritWiggle", - "gChestSizeDependsStoneOfAgony", - "gSkipArrowAnimation", - "gSeparateArrows", - "gCustomizeShootingGallery", - "gInstantShootingGalleryWin", - "gConstantAdultGallery", - "gChildShootingGalleryAmmunition", - "gAdultShootingGalleryAmmunition", - "gCustomizeBombchuBowling", - "gBombchuBowlingNoSmallCucco", - "gBombchuBowlingNoBigCucco", - "gBombchuBowlingAmmunition", - "gCustomizeOcarinaGame", - "gInstantOcarinaGameWin", - "gOcarinaGameNoteSpeed", - "gOcarinaUnlimitedFailTime", - "gOcarinaGameStartingNotes", - "gOcarinaGameRoundOneNotes", - "gOcarinaGameRoundTwoNotes", - "gOcarinaGameRoundThreeNotes", - "gCreditsFix", - "gSilverRupeeJingleExtend", - "gStaticExplosionRadius", - "gNoInputForCredits", - "gFastFarores", - "gNightGSAlwaysSpawn", - "gSkipText", - "gLinkDefaultName", - "gMarketSneak", - "gTimeTravel", - "gNutsExplodeBombs", - "gBowSlingShotAmmoFix", - "gBetterFW", - "gDisableFirstPersonChus", - "gHyperBosses", - "gRupeeDash", - "gDashInterval", - "gDogFollowsEverywhere", - "gDisableTunicWarningText", - "gDisableLOD", - "gDisableDrawDistance", - "gDisableKokiriDrawDistance", - "gLowResMode", - "gDrawLineupTick", - "gQuickBongoKill", - "gFPSGauntlets", - "gSceneSpecificDirtPathFix", - "gZFightingMode", - "gAuthenticLogo", - "gPauseLiveLinkRotationSpeed", - "gBowReticle", - "gFixTexturesOOB", - "gIvanCoopModeEnabled", - "gEnemySpawnsOverWaterboxes", - "gTreeStickDrops", - "gShadowTag", - "gRandomizedEnemySizes", - "gRandomizedEnemies", - "gMirroredWorldMode", - "gMirroredWorld", - "gHyperEnemies", - "gHookshotableReticle", - "gHideBunnyHood", - "gFixVineFall", - "gFileSelectMoreInfo", - "gEnemyHealthBar", - "gBushDropFix", - "gAllDogsRichard", - "gAddTraps.enabled", - "gAddTraps.Ammo", - "gAddTraps.Bomb", - "gAddTraps.Burn", - "gAddTraps.Ice", - "gAddTraps.Kill", - "gAddTraps.Knock", - "gAddTraps.Shock", - "gAddTraps.Speed", - "gAddTraps.Tele", - "gAddTraps.Void", - "gToTMedallionsColors", - "gCuccoStayDurationMultiplier", - "gDeleteFileOnDeath", - "gEnemySizeScalesHealth", - "gEnhancements.BetterAmmoRendering", - "gEnhancements.EquimentAlwaysVisible", - "gEnhancements.FixDaruniaDanceSpeed", - "gEnhancements.OpenAllHours", - "gEnhancements.ResetNaviTimer", - "gEnhancements.ScaleAdultEquimentAsChild", - "gEnhancements.LeeverSpawnRate", - "gEnhancements.SwordToggle", - "gEnhancements.FixFloorSwitches", - "gFixZoraHintDialogue", - "gHurtContainer", - "gPauseWarp", - "gPermanentHeartLoss", - "gRemoveExplosiveLimit", - "gToggleStrength", - "gTimeSavers.SkipCutscene.Intro", - "gTimeSavers.SkipCutscene.Entrances", - "gTimeSavers.SkipCutscene.Story", - "gTimeSavers.SkipCutscene.LearnSong", - "gTimeSavers.SkipCutscene.BossIntro", - "gTimeSavers.SkipCutscene.GlitchAiding", - "gTimeSavers.SkipCutscene.OnePoint", - "gTimeSavers.NoForcedDialog", - "gTimeSavers.SkipOwlInteractions", - "gTimeSavers.SkipMiscInteractions", - "gTimeSavers.DisableTitleCard", - "gTimeSavers.SkipGetItemAnimation", - "gTimeSavers.SkipChildStealth", - "gTimeSavers.SkipTowerEscape", + CVAR_SETTING("DPadOnPause"), + CVAR_SETTING("DpadInText"), + CVAR_SETTING("OcarinaControl.Dpad"), + CVAR_SETTING("OcarinaControl.RStick"), + CVAR_SETTING("DpadEquips"), + CVAR_SETTING("PauseAnyCursor"), + CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), + CVAR_SETTING("NaviOnL"), + CVAR_SETTING("FreeLook.InvertXAxis"), + CVAR_SETTING("FreeLook.InvertYAxis"), + CVAR_SETTING("Controls.RightStickAim"), + CVAR_SETTING("DisableFirstPersonAutoCenterView"), + CVAR_ENHANCEMENT("TextSpeed"), + CVAR_ENHANCEMENT("MweepSpeed"), + CVAR_ENHANCEMENT("ForgeTime"), + CVAR_ENHANCEMENT("ClimbSpeed"), + CVAR_ENHANCEMENT("FasterBlockPush"), + CVAR_ENHANCEMENT("CrawlSpeed"), + CVAR_ENHANCEMENT("FasterHeavyBlockLift"), + CVAR_ENHANCEMENT("NoForcedNavi"), + CVAR_ENHANCEMENT("SkulltulaFreeze"), + CVAR_ENHANCEMENT("MMBunnyHood"), + CVAR_ENHANCEMENT("AdultBunnyHood"), + CVAR_ENHANCEMENT("FastChests"), + CVAR_ENHANCEMENT("ChestSizeAndTextureMatchContents"), + CVAR_ENHANCEMENT("FastDrops"), + CVAR_ENHANCEMENT("BetterOwl"), + CVAR_ENHANCEMENT("FastOcarinaPlayback"), + CVAR_ENHANCEMENT("InstantPutaway"), + CVAR_ENHANCEMENT("FastBoomerang"), + CVAR_ENHANCEMENT("AskToEquip"), + CVAR_ENHANCEMENT("MaskSelect"), + CVAR_ENHANCEMENT("RememberSaveLocation"), + CVAR_ENHANCEMENT("DamageMult"), + CVAR_ENHANCEMENT("FallDamageMult"), + CVAR_ENHANCEMENT("VoidDamageMult"), + CVAR_ENHANCEMENT("BonkDamageMult"), + CVAR_ENHANCEMENT("NoRandomDrops"), + CVAR_ENHANCEMENT("NoHeartDrops"), + CVAR_ENHANCEMENT("BombchuDrops"), + CVAR_ENHANCEMENT("GoronPot"), + CVAR_ENHANCEMENT("FullHealthSpawn"), + CVAR_ENHANCEMENT("DampeWin"), + CVAR_ENHANCEMENT("RedPotionEffect"), + CVAR_ENHANCEMENT("RedPotionHealth"), + CVAR_ENHANCEMENT("RedPercentRestore"), + CVAR_ENHANCEMENT("GreenPotionEffect"), + CVAR_ENHANCEMENT("GreenPotionMana"), + CVAR_ENHANCEMENT("GreenPercentRestore"), + CVAR_ENHANCEMENT("BluePotionEffects"), + CVAR_ENHANCEMENT("BluePotionHealth"), + CVAR_ENHANCEMENT("BlueHealthPercentRestore"), + CVAR_ENHANCEMENT("BluePotionMana"), + CVAR_ENHANCEMENT("BlueManaPercentRestore"), + CVAR_ENHANCEMENT("MilkEffect"), + CVAR_ENHANCEMENT("MilkHealth"), + CVAR_ENHANCEMENT("MilkPercentRestore"), + CVAR_ENHANCEMENT("SeparateHalfMilkEffect"), + CVAR_ENHANCEMENT("HalfMilkHealth"), + CVAR_ENHANCEMENT("HalfMilkPercentRestore"), + CVAR_ENHANCEMENT("FairyEffect"), + CVAR_ENHANCEMENT("FairyHealth"), + CVAR_ENHANCEMENT("FairyPercentRestore"), + CVAR_ENHANCEMENT("FairyReviveEffect"), + CVAR_ENHANCEMENT("FairyReviveHealth"), + CVAR_ENHANCEMENT("FairyRevivePercentRestore"), + CVAR_ENHANCEMENT("CustomizeFishing"), + CVAR_ENHANCEMENT("InstantFishing"), + CVAR_ENHANCEMENT("GuaranteeFishingBite"), + CVAR_ENHANCEMENT("FishNeverEscape"), + CVAR_ENHANCEMENT("MinimumFishWeightChild"), + CVAR_ENHANCEMENT("MinimumFishWeightAdult"), + CVAR_ENHANCEMENT("LowHpAlarm"), + CVAR_ENHANCEMENT("MinimalUI"), + CVAR_ENHANCEMENT("DisableNaviCallAudio"), + CVAR_ENHANCEMENT("VisualAgony"), + CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), + CVAR_ENHANCEMENT("EquipmentCanBeRemoved"), + CVAR_ENHANCEMENT("CowOfTime"), + CVAR_ENHANCEMENT("GuardVision"), + CVAR_ENHANCEMENT("TimeFlowFileSelect"), + CVAR_ENHANCEMENT("InjectItemCounts"), + CVAR_ENHANCEMENT("DayGravePull"), + CVAR_ENHANCEMENT("DampeAllNight"), + CVAR_ENHANCEMENT("QuitFishingAtDoor"), + CVAR_ENHANCEMENT("SkipSwimDeepEndAnim"), + CVAR_ENHANCEMENT("InstantScarecrow"), + CVAR_ENHANCEMENT("BlueFireArrows"), + CVAR_ENHANCEMENT("SunlightArrows"), + CVAR_ENHANCEMENT("PauseLiveLinkRotation"), + CVAR_ENHANCEMENT("PauseLiveLink"), + CVAR_ENHANCEMENT("MinFrameCount"), + CVAR_ENHANCEMENT("NewDrops"), + CVAR_ENHANCEMENT("DisableBlackBars"), + CVAR_ENHANCEMENT("DynamicWalletIcon"), + CVAR_ENHANCEMENT("AlwaysShowDungeonMinimapIcon"), + CVAR_ENHANCEMENT("FixMenuLR"), + CVAR_ENHANCEMENT("NGCKaleidoSwitcher"), + CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), + CVAR_ENHANCEMENT("TwoHandedIdle"), + CVAR_ENHANCEMENT("GravediggingTourFix"), + CVAR_ENHANCEMENT("DekuNutUpgradeFix"), + CVAR_ENHANCEMENT("NaviTextFix"), + CVAR_ENHANCEMENT("AnubixFix"), + CVAR_ENHANCEMENT("CrouchStabHammerFix"), + CVAR_ENHANCEMENT("CrouchStabFix"), + CVAR_ENHANCEMENT("GerudoWarriorClothingFix"), + CVAR_ENHANCEMENT("FixCameraDrift"), + CVAR_ENHANCEMENT("FixCameraSwing"), + CVAR_ENHANCEMENT("FixHangingLedgeSwingRate"), + CVAR_ENHANCEMENT("RedGanonBlood"), + CVAR_ENHANCEMENT("HoverFishing"), + CVAR_ENHANCEMENT("N64WeirdFrames"), + CVAR_ENHANCEMENT("BombchusOOB"), + CVAR_ENHANCEMENT("QuickPutaway"), + CVAR_ENHANCEMENT("GSCutscene"), + CVAR_ENHANCEMENT("RestoreRBAValues"), + CVAR_ENHANCEMENT("SkipSaveConfirmation"), + CVAR_ENHANCEMENT("Autosave"), + CVAR_ENHANCEMENT("DisableCritWiggle"), + CVAR_ENHANCEMENT("ChestSizeDependsStoneOfAgony"), + CVAR_ENHANCEMENT("SkipArrowAnimation"), + CVAR_ENHANCEMENT("SeparateArrows"), + CVAR_ENHANCEMENT("CustomizeShootingGallery"), + CVAR_ENHANCEMENT("InstantShootingGalleryWin"), + CVAR_ENHANCEMENT("ConstantAdultGallery"), + CVAR_ENHANCEMENT("ShootingGalleryAmmoChild"), + CVAR_ENHANCEMENT("ShootingGalleryAmmoAdult"), + CVAR_ENHANCEMENT("CustomizeBombchuBowling"), + CVAR_ENHANCEMENT("BombchuBowlingNoSmallCucco"), + CVAR_ENHANCEMENT("BombchuBowlingNoBigCucco"), + CVAR_ENHANCEMENT("BombchuBowlingAmmo"), + CVAR_ENHANCEMENT("CustomizeOcarinaGame"), + CVAR_ENHANCEMENT("InstantOcarinaGameWin"), + CVAR_ENHANCEMENT("OcarinaGame.NoteSpeed"), + CVAR_ENHANCEMENT("OcarinaUnlimitedFailTime"), + CVAR_ENHANCEMENT("OcarinaGame.StartingNotes"), + CVAR_ENHANCEMENT("OcarinaGame.RoundOneNotes"), + CVAR_ENHANCEMENT("OcarinaGame.RoundTwoNotes"), + CVAR_ENHANCEMENT("OcarinaGame.RoundThreeNotes"), + CVAR_ENHANCEMENT("CreditsFix"), + CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), + CVAR_ENHANCEMENT("StaticExplosionRadius"), + CVAR_ENHANCEMENT("NoInputForCredits"), + CVAR_ENHANCEMENT("FastFarores"), + CVAR_ENHANCEMENT("NightGSAlwaysSpawn"), + CVAR_ENHANCEMENT("SkipText"), + CVAR_ENHANCEMENT("LinkDefaultName"), + CVAR_ENHANCEMENT("MarketSneak"), + CVAR_ENHANCEMENT("TimeTravel"), + CVAR_ENHANCEMENT("NutsExplodeBombs"), + CVAR_ENHANCEMENT("BowSlingshotAmmoFix"), + CVAR_ENHANCEMENT("BetterFarore"), + CVAR_ENHANCEMENT("DisableFirstPersonChus"), + CVAR_ENHANCEMENT("HyperBosses"), + CVAR_ENHANCEMENT("RupeeDash"), + CVAR_ENHANCEMENT("RupeeDashInterval"), + CVAR_ENHANCEMENT("DogFollowsEverywhere"), + CVAR_ENHANCEMENT("DisableTunicWarningText"), + CVAR_ENHANCEMENT("DisableLOD"), + CVAR_ENHANCEMENT("DisableDrawDistance"), + CVAR_ENHANCEMENT("DisableKokiriDrawDistance"), + CVAR_LOW_RES_MODE, + CVAR_ENHANCEMENT("DrawLineupTick"), + CVAR_ENHANCEMENT("QuickBongoKill"), + CVAR_ENHANCEMENT("FirstPersonGauntlets"), + CVAR_ENHANCEMENT("SceneSpecificDirtPathFix"), + CVAR_Z_FIGHTING_MODE, + CVAR_ENHANCEMENT("AuthenticLogo"), + CVAR_ENHANCEMENT("PauseLiveLinkRotationSpeed"), + CVAR_ENHANCEMENT("BowReticle"), + CVAR_ENHANCEMENT("FixTexturesOOB"), + CVAR_ENHANCEMENT("IvanCoopModeEnabled"), + CVAR_ENHANCEMENT("EnemySpawnsOverWaterboxes"), + CVAR_ENHANCEMENT("TreesDropSticks"), + CVAR_ENHANCEMENT("ShadowTag"), + CVAR_ENHANCEMENT("RandomizedEnemySizes"), + CVAR_ENHANCEMENT("RandomizedEnemies"), + CVAR_ENHANCEMENT("MirroredWorldMode"), + CVAR_ENHANCEMENT("MirroredWorld"), + CVAR_ENHANCEMENT("HyperEnemies"), + CVAR_ENHANCEMENT("HookshotableReticle"), + CVAR_ENHANCEMENT("HideBunnyHood"), + CVAR_ENHANCEMENT("FixVineFall"), + CVAR_ENHANCEMENT("FileSelectMoreInfo"), + CVAR_ENHANCEMENT("EnemyHealthBar"), + CVAR_ENHANCEMENT("BushDropFix"), + CVAR_ENHANCEMENT("AllDogsRichard"), + CVAR_ENHANCEMENT("ExtraTraps.Enabled"), + CVAR_ENHANCEMENT("ExtraTraps.Ammo"), + CVAR_ENHANCEMENT("ExtraTraps.Bomb"), + CVAR_ENHANCEMENT("ExtraTraps.Burn"), + CVAR_ENHANCEMENT("ExtraTraps.Ice"), + CVAR_ENHANCEMENT("ExtraTraps.Kill"), + CVAR_ENHANCEMENT("ExtraTraps.Knockback"), + CVAR_ENHANCEMENT("ExtraTraps.Shock"), + CVAR_ENHANCEMENT("ExtraTraps.Speed"), + CVAR_ENHANCEMENT("ExtraTraps.Teleport"), + CVAR_ENHANCEMENT("ExtraTraps.Void"), + CVAR_ENHANCEMENT("ToTMedallionsColors"), + CVAR_ENHANCEMENT("CuccoStayDurationMult"), + CVAR_ENHANCEMENT("DeleteFileOnDeath"), + CVAR_ENHANCEMENT("EnemySizeScalesHealth"), + CVAR_ENHANCEMENT("BetterAmmoRendering"), + CVAR_ENHANCEMENT("EquimentAlwaysVisible"), + CVAR_ENHANCEMENT("FixDaruniaDanceSpeed"), + CVAR_ENHANCEMENT("OpenAllHours"), + CVAR_ENHANCEMENT("ResetNaviTimer"), + CVAR_ENHANCEMENT("ScaleAdultEquimentAsChild"), + CVAR_ENHANCEMENT("LeeverSpawnRate"), + CVAR_ENHANCEMENT("SwordToggle"), + CVAR_ENHANCEMENT("FixFloorSwitches"), + CVAR_ENHANCEMENT("FixZoraHintDialogue"), + CVAR_ENHANCEMENT("HurtContainer"), + CVAR_ENHANCEMENT("PauseWarp"), + CVAR_ENHANCEMENT("PermanentHeartLoss"), + CVAR_ENHANCEMENT("RemoveExplosiveLimit"), + CVAR_ENHANCEMENT("ToggleStrength"), + CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), + CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), + CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), + CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), + CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), + CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.GlitchAiding"), + CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), + CVAR_ENHANCEMENT("TimeSavers.NoForcedDialog"), + CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), + CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), + CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), + CVAR_ENHANCEMENT("TimeSavers.SkipGetItemAnimation"), + CVAR_ENHANCEMENT("TimeSavers.SkipChildStealth"), + CVAR_ENHANCEMENT("TimeSavers.SkipTowerEscape"), }; const std::vector cheatCvars = { - "gConsoleEnabled", - "gActorViewerEnabled", - "gCollisionViewerEnabled", - "gDLViewerEnabled", - "gSaveEditorEnabled", - "gEnableWalkModify", - "gWalkSpeedToggle", - "gWalkModifierOne", - "gWalkModifierTwo", - "gSwimModifierOne", - "gSwimModifierTwo", - "gGoronPot", - "gDampeWin", - "gCustomizeShootingGallery", - "gCustomizeBombchuBowling", - "gCustomizeFishing", - "gInfiniteAmmo", - "gInfiniteEpona", - "gInfiniteHealth", - "gInfiniteMagic", - "gInfiniteMoney", - "gInfiniteNayru", - "gNoClip", - "gClimbEverything", - "gHookshotEverything", - "gCheatHookshotReachMultiplier", - "gMoonJumpOnL", - "gSuperTunic", - "gEzISG", - "gEzQPA", - "gTimelessEquipment", - "gCheatEasyPauseBufferEnabled", - "gCheatEasyInputBufferingEnabled", - "gNoRestrictItems", - "gFreezeTime", - "gPrevTime", - "gDropsDontDie", - "gFireproofDekuShield", - "gShieldTwoHanded", - "gTimeSync", - "gDebugEnabled", - "gSkulltulaDebugEnabled", - "gSkipLogoTitle", - "gSaveFileID", - "gEnableBetaQuest", - "gBetterDebugWarpScreen", - "gSwitchAge", - "gSwitchTimeline", - "gNoRedeadFreeze", - "gNoKeeseGuayTarget", - "gBombTimerMultiplier", - "gNoFishDespawn", - "gNoBugsDespawn", - "gWalkModifierDoesntChangeJump", - "gStatsEnabled", - "gSaveStatesEnabled", - "gSaveStatePromise", - "gRegEditEnabled", - "gPreset0", - "gPreset1", - "gDekuStickCheat", - "gDebugWarpScreenTranslation", - "gDebugSaveFileMode", - "gCosmetics.Link_BodyScale.Changed", - "gCosmetics.Link_BodyScale.Value", - "gCosmetics.Link_HeadScale.Changed", - "gCosmetics.Link_HeadScale.Value", - "gCosmetics.Link_SwordScale.Changed", - "gCosmetics.Link_SwordScale.Value", - "gEnhancements.RememberMapToggleState", + CVAR_CONSOLE_WINDOW_OPEN, + CVAR_WINDOW("ActorViewer"), + CVAR_WINDOW("CollisionViewer"), + CVAR_WINDOW("DLViewer"), + CVAR_WINDOW("SaveEditor"), + CVAR_SETTING("WalkModifier.Enabled"), + CVAR_SETTING("WalkModifier.SpeedToggle"), + CVAR_SETTING("WalkModifier.Mapping1"), + CVAR_SETTING("WalkModifier.Mapping2"), + CVAR_SETTING("WalkModifier.SwimMapping1"), + CVAR_SETTING("WalkModifier.SwimMapping2"), + CVAR_ENHANCEMENT("GoronPot"), + CVAR_ENHANCEMENT("DampeWin"), + CVAR_ENHANCEMENT("CustomizeShootingGallery"), + CVAR_ENHANCEMENT("CustomizeBombchuBowling"), + CVAR_ENHANCEMENT("CustomizeFishing"), + CVAR_CHEAT("InfiniteAmmo"), + CVAR_CHEAT("InfiniteEponaBoost"), + CVAR_CHEAT("InfiniteHealth"), + CVAR_CHEAT("InfiniteMagic"), + CVAR_CHEAT("InfiniteMoney"), + CVAR_CHEAT("InfiniteNayru"), + CVAR_CHEAT("NoClip"), + CVAR_CHEAT("ClimbEverything"), + CVAR_CHEAT("HookshotEverything"), + CVAR_CHEAT("HookshotReachMultiplier"), + CVAR_CHEAT("MoonJumpOnL"), + CVAR_CHEAT("SuperTunic"), + CVAR_CHEAT("EasyISG"), + CVAR_CHEAT("EasyQPA"), + CVAR_CHEAT("TimelessEquipment"), + CVAR_CHEAT("EasyPauseBuffer"), + CVAR_CHEAT("EasyInputBuffer"), + CVAR_CHEAT("NoRestrictItems"), + CVAR_CHEAT("FreezeTime"), + CVAR_GENERAL("PrevTime"), + CVAR_CHEAT("DropsDontDie"), + CVAR_CHEAT("FireproofDekuShield"), + CVAR_CHEAT("ShieldTwoHanded"), + CVAR_CHEAT("TimeSync"), + CVAR_DEVELOPER_TOOLS("DebugEnabled"), + CVAR_DEVELOPER_TOOLS("SkulltulaDebugEnabled"), + CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), + CVAR_DEVELOPER_TOOLS("SaveFileID"), + CVAR_CHEAT("EnableBetaQuest"), + CVAR_DEVELOPER_TOOLS("BetterDebugWarpScreen"), + CVAR_GENERAL("SwitchAge"), + CVAR_GENERAL("SwitchTimeline"), + CVAR_CHEAT("NoRedeadFreeze"), + CVAR_CHEAT("NoKeeseGuayTarget"), + CVAR_CHEAT("BombTimerMultiplier"), + CVAR_CHEAT("NoFishDespawn"), + CVAR_CHEAT("NoBugsDespawn"), + CVAR_SETTING("WalkModifier.DoesntChangeJump"), + CVAR_STATS_WINDOW_OPEN, + CVAR_CHEAT("SaveStatesEnabled"), + CVAR_CHEAT("SaveStatePromise"), + CVAR_DEVELOPER_TOOLS("RegEditEnabled"), + CVAR_CHEAT("DekuStick"), + CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), + CVAR_DEVELOPER_TOOLS("DebugSaveFileMode"), + CVAR_COSMETIC("Link.BodyScale.Changed"), + CVAR_COSMETIC("Link.BodyScale.Value"), + CVAR_COSMETIC("Link.HeadScale.Changed"), + CVAR_COSMETIC("Link.HeadScale.Value"), + CVAR_COSMETIC("Link.SwordScale.Changed"), + CVAR_COSMETIC("Link.SwordScale.Value"), + CVAR_ENHANCEMENT("RememberMapToggleState"), }; const std::vector randomizerCvars = { - "gRandomize10GSHint", - "gRandomize20GSHint", - "gRandomize30GSHint", - "gRandomize40GSHint", - "gRandomize50GSHint", - "gRandomizeAllLocationsReachable", - "gRandomizeAltarHint", - "gRandomizeBigPoeTargetCount", - "gRandomizeBlueFireArrows", - "gRandomizeBombchusInLogic", - "gRandomizeBossKeysanity", - "gRandomizeBridgeRewardOptions", - "gRandomizeCompleteMaskQuest", - "gRandomizeCuccosToReturn", - "gRandomizeDampeHint", - "gRandomizeDecoupleEntrances", - "gRandomizeDoorOfTime", - "gRandomizeDungeonCount", - "gRandomizeEnableBombchuDrops", - "gRandomizeEnableGlitchCutscenes", - "gRandomizeEnabledGlitches", - "gRandomizeEnabledTricks", - "gRandomizeExcludedLocations", - "gRandomizeForest", - "gRandomizeFullWallets", - "gRandomizeFishingPoleHint", - "gRandomizeFishsanity", - "gRandomizeFishsanityPondCount", - "gRandomizeFishsanityAgeSplit", - "gRandomizeGanonTrial", - "gRandomizeGanonTrialCount", - "gRandomizeGerudoFortress", - "gRandomizeGerudoKeys", - "gRandomizeGossipStoneHints", - "gRandomizeGsExpectSunsSong", - "gRandomizeHintClarity", - "gRandomizeHintDistribution", - "gRandomizeIceTraps", - "gRandomizeItemPool", - "gRandomizeKakarikoGate", - "gRandomizeKeysanity", - "gRandomizeLacsDungeonCount", - "gRandomizeLacsMedallionCount", - "gRandomizeLacsRewardCount", - "gRandomizeLacsRewardOptions", - "gRandomizeLacsStoneCount", - "gRandomizeLacsTokenCount", - "gRandomizeGanondorfHint", - "gRandomizeSheikLAHint", - "gRandomizeLinksPocket", - "gRandomizeLogicRules", - "gRandomizeMedallionCount", - "gRandomizeMixDungeons", - "gRandomizeMixedEntrances", - "gRandomizeMixGrottos", - "gRandomizeMixInteriors", - "gRandomizeMixOverworld", - "gRandomizeMqDungeonCount", - "gRandomizeMqDungeons", - "gRandomizeRainbowBridge", - "gRandomizeRewardCount", - "gRandomizeScrubText", - "gRandomizeShopsanity", - "gRandomizeShopsanityPrices", - "gRandomizeShopsanityPricesAffordable", - "gRandomizeShuffleAdultTrade", - "gRandomizeShuffleBeans", - "gRandomizeShuffleBossEntrances", - "gRandomizeShuffleCows", - "gRandomizeShuffleDungeonReward", - "gRandomizeShuffleDungeonsEntrances", - "gRandomizeShuffleFishingPole", - "gRandomizeShuffleFrogSongRupees", - "gRandomizeShuffleGanonBossKey", - "gRandomizeShuffleGerudoToken", - "gRandomizeShuffleGrottosEntrances", - "gRandomizeShuffleInteriorsEntrances", - "gRandomizeShuffleKeyRings", - "gRandomizeShuffleKeyRingsBottomOfTheWell", - "gRandomizeShuffleKeyRingsFireTemple", - "gRandomizeShuffleKeyRingsForestTemple", - "gRandomizeShuffleKeyRingsGanonsCastle", - "gRandomizeShuffleKeyRingsGerudoFortress", - "gRandomizeShuffleKeyRingsGTG", - "gRandomizeShuffleKeyRingsRandomCount", - "gRandomizeShuffleKeyRingsShadowTemple", - "gRandomizeShuffleKeyRingsSpiritTemple", - "gRandomizeShuffleKeyRingsWaterTemple", - "gRandomizeShuffleKokiriSword", - "gRandomizeShuffleMerchants", - "gRandomizeShuffleOcarinas", - "gRandomizeShuffleOverworldEntrances", - "gRandomizeShuffleOverworldSpawns", - "gRandomizeShuffleOwlDrops", - "gRandomizeShuffleScrubs", - "gRandomizeShuffleSongs", - "gRandomizeShuffleTokens", - "gRandomizeShuffleWarpSongs", - "gRandomizeShuffleWeirdEgg", - "gRandomizeSkipChildStealth", - "gRandomizeSkipChildZelda", - "gRandomizeSkipEponaRace", - "gRandomizeSkipScarecrowsSong", - "gRandomizeSkipTowerEscape", - "gRandomizeStartingAge", - "gRandomizeStartingConsumables", - "gRandomizeStartingBoleroOfFire", - "gRandomizeStartingDekuShield", - "gRandomizeStartingEponasSong", - "gRandomizeStartingKokiriSword", - "gRandomizeStartingMapsCompasses", - "gRandomizeStartingMinuetOfForest", - "gRandomizeStartingNocturneOfShadow", - "gRandomizeStartingOcarina", - "gRandomizeStartingPreludeOfLight", - "gRandomizeStartingRequiemOfSpirit", - "gRandomizeStartingSariasSong", - "gRandomizeStartingSerenadeOfWater", - "gRandomizeStartingSkulltulaToken", - "gRandomizeStartingSongOfStorms", - "gRandomizeStartingSongOfTime", - "gRandomizeStartingSunsSong", - "gRandomizeStartingZeldasLullaby", - "gRandomizeStoneCount", - "gRandomizeSunlightArrows", - "gRandomizeTokenCount", - "gRandomizeWarpSongText", - "gRandomizeZorasFountain", - "gRandomizeShuffle100GSReward", - "gRandomizeGregHint", - "gRandoManualSeedEntry", - "gRandomizerSettingsEnabled", - "gRandomizeTriforceHuntTotalPieces", - "gRandomizeTriforceHuntRequiredPieces", - "gRandomizeTriforceHunt", - "gRandomizeShuffleMasterSword", - "gRandomizeSariaHint", - "gRandomizeRupeeNames", - "gRandomizeFrogsHint", - "gRandoRelevantNavi", - "gRandoQuestItemFanfares", + CVAR_RANDOMIZER_SETTING("10GSHint"), + CVAR_RANDOMIZER_SETTING("20GSHint"), + CVAR_RANDOMIZER_SETTING("30GSHint"), + CVAR_RANDOMIZER_SETTING("40GSHint"), + CVAR_RANDOMIZER_SETTING("50GSHint"), + CVAR_RANDOMIZER_SETTING("AllLocationsReachable"), + CVAR_RANDOMIZER_SETTING("AltarHint"), + CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), + CVAR_RANDOMIZER_SETTING("BlueFireArrows"), + CVAR_RANDOMIZER_SETTING("BombchusInLogic"), + CVAR_RANDOMIZER_SETTING("BossKeysanity"), + CVAR_RANDOMIZER_SETTING("BridgeRewardOptions"), + CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), + CVAR_RANDOMIZER_SETTING("CuccosToReturn"), + CVAR_RANDOMIZER_SETTING("DampeHint"), + CVAR_RANDOMIZER_SETTING("DecoupleEntrances"), + CVAR_RANDOMIZER_SETTING("DoorOfTime"), + CVAR_RANDOMIZER_SETTING("DungeonCount"), + CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), + CVAR_RANDOMIZER_SETTING("EnableGlitchCutscenes"), + CVAR_RANDOMIZER_SETTING("EnabledGlitches"), + CVAR_RANDOMIZER_SETTING("EnabledTricks"), + CVAR_RANDOMIZER_SETTING("ExcludedLocations"), + CVAR_RANDOMIZER_SETTING("Forest"), + CVAR_RANDOMIZER_SETTING("FullWallets"), + CVAR_RANDOMIZER_SETTING("FishingPoleHint"), + CVAR_RANDOMIZER_SETTING("Fishsanity"), + CVAR_RANDOMIZER_SETTING("FishsanityPondCount"), + CVAR_RANDOMIZER_SETTING("FishsanityAgeSplit"), + CVAR_RANDOMIZER_SETTING("GanonTrial"), + CVAR_RANDOMIZER_SETTING("GanonTrialCount"), + CVAR_RANDOMIZER_SETTING("GerudoFortress"), + CVAR_RANDOMIZER_SETTING("GerudoKeys"), + CVAR_RANDOMIZER_SETTING("GossipStoneHints"), + CVAR_RANDOMIZER_SETTING("GsExpectSunsSong"), + CVAR_RANDOMIZER_SETTING("HintClarity"), + CVAR_RANDOMIZER_SETTING("HintDistribution"), + CVAR_RANDOMIZER_SETTING("IceTraps"), + CVAR_RANDOMIZER_SETTING("ItemPool"), + CVAR_RANDOMIZER_SETTING("KakarikoGate"), + CVAR_RANDOMIZER_SETTING("Keysanity"), + CVAR_RANDOMIZER_SETTING("LacsDungeonCount"), + CVAR_RANDOMIZER_SETTING("LacsMedallionCount"), + CVAR_RANDOMIZER_SETTING("LacsRewardCount"), + CVAR_RANDOMIZER_SETTING("LacsRewardOptions"), + CVAR_RANDOMIZER_SETTING("LacsStoneCount"), + CVAR_RANDOMIZER_SETTING("LacsTokenCount"), + CVAR_RANDOMIZER_SETTING("GanondorfHint"), + CVAR_RANDOMIZER_SETTING("LAHint"), + CVAR_RANDOMIZER_SETTING("LinksPocket"), + CVAR_RANDOMIZER_SETTING("LogicRules"), + CVAR_RANDOMIZER_SETTING("MedallionCount"), + CVAR_RANDOMIZER_SETTING("MixDungeons"), + CVAR_RANDOMIZER_SETTING("MixedEntrances"), + CVAR_RANDOMIZER_SETTING("MixGrottos"), + CVAR_RANDOMIZER_SETTING("MixInteriors"), + CVAR_RANDOMIZER_SETTING("MixOverworld"), + CVAR_RANDOMIZER_SETTING("MQDungeonCount"), + CVAR_RANDOMIZER_SETTING("MQDungeons"), + CVAR_RANDOMIZER_SETTING("RainbowBridge"), + CVAR_RANDOMIZER_SETTING("RewardCount"), + CVAR_RANDOMIZER_SETTING("ScrubText"), + CVAR_RANDOMIZER_SETTING("Shopsanity"), + CVAR_RANDOMIZER_SETTING("ShopsanityPrices"), + CVAR_RANDOMIZER_SETTING("ShopsanityPricesAffordable"), + CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), + CVAR_RANDOMIZER_SETTING("ShuffleBeans"), + CVAR_RANDOMIZER_SETTING("ShuffleBossEntrances"), + CVAR_RANDOMIZER_SETTING("ShuffleCows"), + CVAR_RANDOMIZER_SETTING("ShuffleDungeonReward"), + CVAR_RANDOMIZER_SETTING("ShuffleDungeonsEntrances"), + CVAR_RANDOMIZER_SETTING("ShuffleFishingPole"), + CVAR_RANDOMIZER_SETTING("ShuffleFrogSongRupees"), + CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), + CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), + CVAR_RANDOMIZER_SETTING("ShuffleGrottosEntrances"), + CVAR_RANDOMIZER_SETTING("ShuffleInteriorsEntrances"), + CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), + CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsBottomOfTheWell"), + CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsFireTemple"), + CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsForestTemple"), + CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGanonsCastle"), + CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGerudoFortress"), + CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGTG"), + CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsRandomCount"), + CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsShadowTemple"), + CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsSpiritTemple"), + CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsWaterTemple"), + CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), + CVAR_RANDOMIZER_SETTING("ShuffleMerchants"), + CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), + CVAR_RANDOMIZER_SETTING("ShuffleOverworldEntrances"), + CVAR_RANDOMIZER_SETTING("ShuffleOverworldSpawns"), + CVAR_RANDOMIZER_SETTING("ShuffleOwlDrops"), + CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), + CVAR_RANDOMIZER_SETTING("ShuffleSongs"), + CVAR_RANDOMIZER_SETTING("ShuffleTokens"), + CVAR_RANDOMIZER_SETTING("ShuffleWarpSongs"), + CVAR_RANDOMIZER_SETTING("ShuffleWeirdEgg"), + CVAR_RANDOMIZER_SETTING("SkipChildStealth"), + CVAR_RANDOMIZER_SETTING("SkipChildZelda"), + CVAR_RANDOMIZER_SETTING("SkipEponaRace"), + CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), + CVAR_RANDOMIZER_SETTING("SkipTowerEscape"), + CVAR_RANDOMIZER_SETTING("StartingAge"), + CVAR_RANDOMIZER_SETTING("StartingConsumables"), + CVAR_RANDOMIZER_SETTING("StartingBoleroOfFire"), + CVAR_RANDOMIZER_SETTING("StartingDekuShield"), + CVAR_RANDOMIZER_SETTING("StartingEponasSong"), + CVAR_RANDOMIZER_SETTING("StartingKokiriSword"), + CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), + CVAR_RANDOMIZER_SETTING("StartingMinuetOfForest"), + CVAR_RANDOMIZER_SETTING("StartingNocturneOfShadow"), + CVAR_RANDOMIZER_SETTING("StartingOcarina"), + CVAR_RANDOMIZER_SETTING("StartingPreludeOfLight"), + CVAR_RANDOMIZER_SETTING("StartingRequiemOfSpirit"), + CVAR_RANDOMIZER_SETTING("StartingSariasSong"), + CVAR_RANDOMIZER_SETTING("StartingSerenadeOfWater"), + CVAR_RANDOMIZER_SETTING("StartingSkulltulaToken"), + CVAR_RANDOMIZER_SETTING("StartingSongOfStorms"), + CVAR_RANDOMIZER_SETTING("StartingSongOfTime"), + CVAR_RANDOMIZER_SETTING("StartingSunsSong"), + CVAR_RANDOMIZER_SETTING("StartingZeldasLullaby"), + CVAR_RANDOMIZER_SETTING("StoneCount"), + CVAR_RANDOMIZER_SETTING("SunlightArrows"), + CVAR_RANDOMIZER_SETTING("TokenCount"), + CVAR_RANDOMIZER_SETTING("WarpSongText"), + CVAR_RANDOMIZER_SETTING("ZorasFountain"), + CVAR_RANDOMIZER_SETTING("Shuffle100GSReward"), + CVAR_RANDOMIZER_SETTING("GregHint"), + CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), + CVAR_RANDOMIZER_SETTING("TriforceHuntTotalPieces"), + CVAR_RANDOMIZER_SETTING("TriforceHuntRequiredPieces"), + CVAR_RANDOMIZER_SETTING("TriforceHunt"), + CVAR_RANDOMIZER_SETTING("ShuffleMasterSword"), + CVAR_RANDOMIZER_SETTING("SariaHint"), + CVAR_RANDOMIZER_ENHANCEMENT("RandomizeRupeeNames"), + CVAR_RANDOMIZER_SETTING("FrogsHint"), + CVAR_RANDOMIZER_ENHANCEMENT("RandoRelevantNavi"), + CVAR_RANDOMIZER_ENHANCEMENT("QuestItemFanfares"), }; const std::vector vanillaPlusPresetEntries = { // D-pad Support in text and file select - PRESET_ENTRY_S32("gDpadText", 1), + PRESET_ENTRY_S32(CVAR_SETTING("DpadInText"), 1), // Play Ocarina with D-pad - PRESET_ENTRY_S32("gDpadOcarina", 1), + PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.Dpad"), 1), // Play Ocarina with Right Stick - PRESET_ENTRY_S32("gRStickOcarina", 1), + PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.RStick"), 1), // D-pad as Equip Items - PRESET_ENTRY_S32("gDpadEquips", 1), + PRESET_ENTRY_S32(CVAR_SETTING("DpadEquips"), 1), // Prevent Dropped Ocarina Inputs - PRESET_ENTRY_S32("gDpadNoDropOcarinaInput", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), // Right Stick Aiming - PRESET_ENTRY_S32("gRightStickAiming", 1), + PRESET_ENTRY_S32(CVAR_SETTING("Controls.RightStickAim"), 1), // Text Speed (1 to 5) - PRESET_ENTRY_S32("gTextSpeed", 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TextSpeed"), 5), // Skip Text - PRESET_ENTRY_S32("gSkipText", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipText"), 1), // King Zora Speed (1 to 5) - PRESET_ENTRY_S32("gMweepSpeed", 2), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MweepSpeed"), 2), // Faster Block Push (+0 to +5) - PRESET_ENTRY_S32("gFasterBlockPush", 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterBlockPush"), 5), // Better Owl - PRESET_ENTRY_S32("gBetterOwl", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterOwl"), 1), // Assignable Tunics and Boots - PRESET_ENTRY_S32("gAssignableTunicsAndBoots", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 1), // Enable passage of time on file select - PRESET_ENTRY_S32("gTimeFlowFileSelect", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeFlowFileSelect"), 1), // Inject Item Counts in messages - PRESET_ENTRY_S32("gInjectItemCounts", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts"), 1), // Pause link animation (0 to 16) - PRESET_ENTRY_S32("gPauseLiveLink", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseLiveLink"), 1), // Dynamic Wallet Icon - PRESET_ENTRY_S32("gDynamicWalletIcon", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DynamicWalletIcon"), 1), // Always show dungeon entrances - PRESET_ENTRY_S32("gAlwaysShowDungeonMinimapIcon", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AlwaysShowDungeonMinimapIcon"), 1), // Fix L&R Pause menu - PRESET_ENTRY_S32("gUniformLR", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixMenuLR"), 1), // Fix Dungeon entrances - PRESET_ENTRY_S32("gFixDungeonMinimapIcon", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), 1), // Fix Two Handed idle animations - PRESET_ENTRY_S32("gTwoHandedIdle", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TwoHandedIdle"), 1), // Fix the Gravedigging Tour Glitch - PRESET_ENTRY_S32("gGravediggingTourFix", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GravediggingTourFix"), 1), // Fix Deku Nut upgrade - PRESET_ENTRY_S32("gDekuNutUpgradeFix", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DekuNutUpgradeFix"), 1), // Fix Navi text HUD position - PRESET_ENTRY_S32("gNaviTextFix", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NaviTextFix"), 1), // Extend Silver Rupee Jingle - PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), 1), // Fix some Floor Switches - PRESET_ENTRY_S32("gEnhancements.FixFloorSwitches", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixFloorSwitches"), 1), // Red Ganon blood - PRESET_ENTRY_S32("gRedGanonBlood", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RedGanonBlood"), 1), // Fish while hovering - PRESET_ENTRY_S32("gHoverFishing", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("HoverFishing"), 1), // N64 Weird Frames - PRESET_ENTRY_S32("gN64WeirdFrames", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("N64WeirdFrames"), 1), // Bombchus out of bounds - PRESET_ENTRY_S32("gBombchusOOB", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BombchusOOB"), 1), // Quick Putaway - PRESET_ENTRY_S32("gQuickPutaway", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuickPutaway"), 1), // Skip save confirmation - PRESET_ENTRY_S32("gSkipSaveConfirmation", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 1), }; const std::vector enhancedPresetEntries = { // D-pad Support in text and file select - PRESET_ENTRY_S32("gDpadText", 1), + PRESET_ENTRY_S32(CVAR_SETTING("DpadInText"), 1), // Play Ocarina with D-pad - PRESET_ENTRY_S32("gDpadOcarina", 1), + PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.Dpad"), 1), // Play Ocarina with Right Stick - PRESET_ENTRY_S32("gRStickOcarina", 1), + PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.RStick"), 1), // D-pad as Equip Items - PRESET_ENTRY_S32("gDpadEquips", 1), + PRESET_ENTRY_S32(CVAR_SETTING("DpadEquips"), 1), // Prevent Dropped Ocarina Inputs - PRESET_ENTRY_S32("gDpadNoDropOcarinaInput", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), // Right Stick Aiming - PRESET_ENTRY_S32("gRightStickAiming", 1), + PRESET_ENTRY_S32(CVAR_SETTING("Controls.RightStickAim"), 1), // Text Speed (1 to 5) - PRESET_ENTRY_S32("gTextSpeed", 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TextSpeed"), 5), // Skip Text - PRESET_ENTRY_S32("gSkipText", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipText"), 1), // King Zora Speed (1 to 5) - PRESET_ENTRY_S32("gMweepSpeed", 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MweepSpeed"), 5), // Faster Block Push (+0 to +5) - PRESET_ENTRY_S32("gFasterBlockPush", 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterBlockPush"), 5), // Better Owl - PRESET_ENTRY_S32("gBetterOwl", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterOwl"), 1), // Assignable Tunics and Boots - PRESET_ENTRY_S32("gAssignableTunicsAndBoots", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 1), // Enable passage of time on file select - PRESET_ENTRY_S32("gTimeFlowFileSelect", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeFlowFileSelect"), 1), // Inject Item Counts in messages - PRESET_ENTRY_S32("gInjectItemCounts", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts"), 1), // Pause link animation (0 to 16) - PRESET_ENTRY_S32("gPauseLiveLink", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseLiveLink"), 1), // Dynamic Wallet Icon - PRESET_ENTRY_S32("gDynamicWalletIcon", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DynamicWalletIcon"), 1), // Always show dungeon entrances - PRESET_ENTRY_S32("gAlwaysShowDungeonMinimapIcon", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AlwaysShowDungeonMinimapIcon"), 1), // Fix L&R Pause menu - PRESET_ENTRY_S32("gUniformLR", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixMenuLR"), 1), // Fix Dungeon entrances - PRESET_ENTRY_S32("gFixDungeonMinimapIcon", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), 1), // Fix Two Handed idle animations - PRESET_ENTRY_S32("gTwoHandedIdle", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TwoHandedIdle"), 1), // Fix the Gravedigging Tour Glitch - PRESET_ENTRY_S32("gGravediggingTourFix", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GravediggingTourFix"), 1), // Fix Deku Nut upgrade - PRESET_ENTRY_S32("gDekuNutUpgradeFix", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DekuNutUpgradeFix"), 1), // Fix Navi text HUD position - PRESET_ENTRY_S32("gNaviTextFix", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NaviTextFix"), 1), // Extend Silver Rupee Jingle - PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), 1), // Fix enemies not spawning on ground over water - PRESET_ENTRY_S32("gEnemySpawnsOverWaterboxes", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EnemySpawnsOverWaterboxes"), 1), // Fix some Floor Switches - PRESET_ENTRY_S32("gEnhancements.FixFloorSwitches", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixFloorSwitches"), 1), // Red Ganon blood - PRESET_ENTRY_S32("gRedGanonBlood", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RedGanonBlood"), 1), // Fish while hovering - PRESET_ENTRY_S32("gHoverFishing", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("HoverFishing"), 1), // N64 Weird Frames - PRESET_ENTRY_S32("gN64WeirdFrames", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("N64WeirdFrames"), 1), // Bombchus out of bounds - PRESET_ENTRY_S32("gBombchusOOB", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BombchusOOB"), 1), // Quick Putaway - PRESET_ENTRY_S32("gQuickPutaway", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuickPutaway"), 1), // Skip save confirmation - PRESET_ENTRY_S32("gSkipSaveConfirmation", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 1), // Biggoron Forge Time (0 to 3) - PRESET_ENTRY_S32("gForgeTime", 0), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ForgeTime"), 0), // Vine/Ladder Climb speed (+0 to +12) - PRESET_ENTRY_S32("gClimbSpeed", 3), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ClimbSpeed"), 3), // Faster Heavy Block Lift - PRESET_ENTRY_S32("gFasterHeavyBlockLift", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 1), // No Forced Navi - PRESET_ENTRY_S32("gNoForcedNavi", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoForcedNavi"), 1), // No Skulltula Freeze - PRESET_ENTRY_S32("gSkulltulaFreeze", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkulltulaFreeze"), 1), // MM Bunny Hood - PRESET_ENTRY_S32("gMMBunnyHood", BUNNY_HOOD_FAST_AND_JUMP), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_FAST_AND_JUMP), // Adult Bunny Hood - PRESET_ENTRY_S32("gAdultBunnyHood", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AdultBunnyHood"), 1), // Fast Chests - PRESET_ENTRY_S32("gFastChests", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastChests"), 1), // Fast Drops - PRESET_ENTRY_S32("gFastDrops", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastDrops"), 1), // Fast Ocarina Playback - PRESET_ENTRY_S32("gFastOcarinaPlayback", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 1), // Instant Putaway - PRESET_ENTRY_S32("gInstantPutaway", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantPutaway"), 1), // Instant Boomerang Recall - PRESET_ENTRY_S32("gFastBoomerang", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastBoomerang"), 1), // Nuts Explode Bombs - PRESET_ENTRY_S32("gNutsExplodeBombs", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NutsExplodeBombs"), 1), // Ask to Equip New Items - PRESET_ENTRY_S32("gAskToEquip", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AskToEquip"), 1), // Mask Select in Inventory - PRESET_ENTRY_S32("gMaskSelect", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MaskSelect"), 1), // Always Win Goron Pot - PRESET_ENTRY_S32("gGoronPot", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GoronPot"), 1), // Always Win Dampe Digging - PRESET_ENTRY_S32("gDampeWin", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DampeWin"), 1), // Skip Magic Arrow Equip Animation - PRESET_ENTRY_S32("gSkipArrowAnimation", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipArrowAnimation"), 1), // Equip arrows on multiple slots - PRESET_ENTRY_S32("gSeparateArrows", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SeparateArrows"), 1), // Disable Navi Call Audio - PRESET_ENTRY_S32("gDisableNaviCallAudio", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableNaviCallAudio"), 1), // Equipment Toggle - PRESET_ENTRY_S32("gEquipmentCanBeRemoved", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EquipmentCanBeRemoved"), 1), // Link's Cow in Both Time Periods - PRESET_ENTRY_S32("gCowOfTime", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CowOfTime"), 1), // Enable 3D Dropped items/projectiles - PRESET_ENTRY_S32("gNewDrops", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NewDrops"), 1), // Fix Anubis fireballs - PRESET_ENTRY_S32("gAnubisFix", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AnubixFix"), 1), // Autosave - PRESET_ENTRY_S32("gAutosave", AUTOSAVE_LOCATION_AND_MAJOR_ITEMS), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_LOCATION_AND_MAJOR_ITEMS), }; const std::vector randomizerPresetEntries = { // D-pad Support in text and file select - PRESET_ENTRY_S32("gDpadText", 1), + PRESET_ENTRY_S32(CVAR_SETTING("DpadInText"), 1), // Play Ocarina with D-pad - PRESET_ENTRY_S32("gDpadOcarina", 1), + PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.Dpad"), 1), // Play Ocarina with Right Stick - PRESET_ENTRY_S32("gRStickOcarina", 1), + PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.RStick"), 1), // D-pad as Equip Items - PRESET_ENTRY_S32("gDpadEquips", 1), + PRESET_ENTRY_S32(CVAR_SETTING("DpadEquips"), 1), // Prevent Dropped Ocarina Inputs - PRESET_ENTRY_S32("gDpadNoDropOcarinaInput", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), // Right Stick Aiming - PRESET_ENTRY_S32("gRightStickAiming", 1), + PRESET_ENTRY_S32(CVAR_SETTING("Controls.RightStickAim"), 1), // Text Speed (1 to 5) - PRESET_ENTRY_S32("gTextSpeed", 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TextSpeed"), 5), // Skip Text - PRESET_ENTRY_S32("gSkipText", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipText"), 1), // King Zora Speed (1 to 5) - PRESET_ENTRY_S32("gMweepSpeed", 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MweepSpeed"), 5), // Faster Block Push (+0 to +5) - PRESET_ENTRY_S32("gFasterBlockPush", 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterBlockPush"), 5), // Better Owl - PRESET_ENTRY_S32("gBetterOwl", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterOwl"), 1), // Assignable Tunics and Boots - PRESET_ENTRY_S32("gAssignableTunicsAndBoots", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 1), // Enable passage of time on file select - PRESET_ENTRY_S32("gTimeFlowFileSelect", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeFlowFileSelect"), 1), // Inject Item Counts in messages - PRESET_ENTRY_S32("gInjectItemCounts", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts"), 1), // Dynamic Wallet Icon - PRESET_ENTRY_S32("gDynamicWalletIcon", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DynamicWalletIcon"), 1), // Always show dungeon entrances - PRESET_ENTRY_S32("gAlwaysShowDungeonMinimapIcon", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AlwaysShowDungeonMinimapIcon"), 1), // Fix L&R Pause menu - PRESET_ENTRY_S32("gUniformLR", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixMenuLR"), 1), // Fix Dungeon entrances - PRESET_ENTRY_S32("gFixDungeonMinimapIcon", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), 1), // Fix Two Handed idle animations - PRESET_ENTRY_S32("gTwoHandedIdle", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TwoHandedIdle"), 1), // Fix the Gravedigging Tour Glitch - PRESET_ENTRY_S32("gGravediggingTourFix", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GravediggingTourFix"), 1), // Fix Deku Nut upgrade - PRESET_ENTRY_S32("gDekuNutUpgradeFix", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DekuNutUpgradeFix"), 1), // Fix Navi text HUD position - PRESET_ENTRY_S32("gNaviTextFix", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NaviTextFix"), 1), // Extend Silver Rupee Jingle - PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), 1), // Fix some Floor Switches - PRESET_ENTRY_S32("gEnhancements.FixFloorSwitches", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixFloorSwitches"), 1), // Red Ganon blood - PRESET_ENTRY_S32("gRedGanonBlood", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RedGanonBlood"), 1), // Fish while hovering - PRESET_ENTRY_S32("gHoverFishing", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("HoverFishing"), 1), // N64 Weird Frames - PRESET_ENTRY_S32("gN64WeirdFrames", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("N64WeirdFrames"), 1), // Bombchus out of bounds - PRESET_ENTRY_S32("gBombchusOOB", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BombchusOOB"), 1), // Quick Putaway - PRESET_ENTRY_S32("gQuickPutaway", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuickPutaway"), 1), // Skip save confirmation - PRESET_ENTRY_S32("gSkipSaveConfirmation", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 1), // Biggoron Forge Time (0 to 3) - PRESET_ENTRY_S32("gForgeTime", 0), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ForgeTime"), 0), // Vine/Ladder Climb speed (+0 to +12) - PRESET_ENTRY_S32("gClimbSpeed", 3), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ClimbSpeed"), 3), // Faster Heavy Block Lift - PRESET_ENTRY_S32("gFasterHeavyBlockLift", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 1), // No Forced Navi - PRESET_ENTRY_S32("gNoForcedNavi", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoForcedNavi"), 1), // No Skulltula Freeze - PRESET_ENTRY_S32("gSkulltulaFreeze", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkulltulaFreeze"), 1), // MM Bunny Hood - PRESET_ENTRY_S32("gMMBunnyHood", BUNNY_HOOD_FAST_AND_JUMP), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_FAST_AND_JUMP), // Adult Bunny Hood - PRESET_ENTRY_S32("gAdultBunnyHood", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AdultBunnyHood"), 1), // Fast Chests - PRESET_ENTRY_S32("gFastChests", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastChests"), 1), // Fast Drops - PRESET_ENTRY_S32("gFastDrops", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastDrops"), 1), // Fast Ocarina Playback - PRESET_ENTRY_S32("gFastOcarinaPlayback", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 1), // Instant Putaway - PRESET_ENTRY_S32("gInstantPutaway", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantPutaway"), 1), // Instant Boomerang Recall - PRESET_ENTRY_S32("gFastBoomerang", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastBoomerang"), 1), // Nuts Explode Bombs - PRESET_ENTRY_S32("gNutsExplodeBombs", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NutsExplodeBombs"), 1), // Ask to Equip New Items - PRESET_ENTRY_S32("gAskToEquip", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AskToEquip"), 1), // Mask Select in Inventory - PRESET_ENTRY_S32("gMaskSelect", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MaskSelect"), 1), // Always Win Goron Pot - PRESET_ENTRY_S32("gGoronPot", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GoronPot"), 1), // Always Win Dampe Digging - PRESET_ENTRY_S32("gDampeWin", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DampeWin"), 1), // Skip Magic Arrow Equip Animation - PRESET_ENTRY_S32("gSkipArrowAnimation", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipArrowAnimation"), 1), // Exit Market at Night - PRESET_ENTRY_S32("gMarketSneak", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MarketSneak"), 1), // Equip arrows on multiple slots - PRESET_ENTRY_S32("gSeparateArrows", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SeparateArrows"), 1), // Disable Navi Call Audio - PRESET_ENTRY_S32("gDisableNaviCallAudio", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableNaviCallAudio"), 1), // Equipment Toggle - PRESET_ENTRY_S32("gEquipmentCanBeRemoved", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EquipmentCanBeRemoved"), 1), // Link's Cow in Both Time Periods - PRESET_ENTRY_S32("gCowOfTime", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CowOfTime"), 1), // Enable 3D Dropped items/projectiles - PRESET_ENTRY_S32("gNewDrops", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NewDrops"), 1), // Fix Anubis fireballs - PRESET_ENTRY_S32("gAnubisFix", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AnubixFix"), 1), // Autosave - PRESET_ENTRY_S32("gAutosave", AUTOSAVE_LOCATION_AND_MAJOR_ITEMS), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_LOCATION_AND_MAJOR_ITEMS), // Customize Fishing Behaviour - PRESET_ENTRY_S32("gCustomizeFishing", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFishing"), 1), // Guarantee Bite - PRESET_ENTRY_S32("gGuaranteeFishingBite", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GuaranteeFishingBite"), 1), // Fish Never Escape - PRESET_ENTRY_S32("gFishNeverEscape", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FishNeverEscape"), 1), // Child Minimum Weight (6 to 10) - PRESET_ENTRY_S32("gChildMinimumWeightFish", 3), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MinimumFishWeightChild"), 3), // Adult Minimum Weight (8 to 13) - PRESET_ENTRY_S32("gAdultMinimumWeightFish", 6), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MinimumFishWeightAdult"), 6), // Customize Lost Woods Ocarina Game Behavior - PRESET_ENTRY_S32("gCustomizeOcarinaGame", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 1), // Start With Five Notes - PRESET_ENTRY_S32("gOcarinaGameStartingNotes", 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("OcarinaGame.StartingNotes"), 5), // Round One Notes - PRESET_ENTRY_S32("gOcarinaGameRoundOneNotes", 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("OcarinaGame.RoundOneNotes"), 5), // Visual Stone of Agony - PRESET_ENTRY_S32("gVisualAgony", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("VisualAgony"), 1), // Pull grave during the day - PRESET_ENTRY_S32("gDayGravePull", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DayGravePull"), 1), // Pull out Ocarina to Summon Scarecrow - PRESET_ENTRY_S32("gSkipScarecrow", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantScarecrow"), 1), // Chest size & texture matches contents - PRESET_ENTRY_S32("gChestSizeAndTextureMatchesContents", CSMC_BOTH), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ChestSizeAndTextureMatchContents"), CSMC_BOTH), // Color Temple of Time's Medallions - PRESET_ENTRY_S32("gToTMedallionsColors", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ToTMedallionsColors"), 1), // Pause link animation (0 to 16) - PRESET_ENTRY_S32("gPauseLiveLink", 16), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseLiveLink"), 16), // Frames to wait - PRESET_ENTRY_S32("gMinFrameCount", 200), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MinFrameCount"), 200), - PRESET_ENTRY_S32("gNoInputForCredits", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoInputForCredits"), 1), - PRESET_ENTRY_S32("gFastFarores", 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastFarores"), 1), }; const std::vector spockRacePresetEntries = { - PRESET_ENTRY_S32("gRandomizeLogicRules", 0), - PRESET_ENTRY_S32("gGameplayStats.RTATiming", 1), - PRESET_ENTRY_S32("gTextSpeed", 5), - PRESET_ENTRY_S32("gMweepSpeed", 5), - PRESET_ENTRY_S32("gClimbSpeed", 4), - PRESET_ENTRY_S32("gFasterBlockPush", 5), - PRESET_ENTRY_S32("gFasterHeavyBlockLift", 1), - PRESET_ENTRY_S32("gNoForcedNavi", 1), - PRESET_ENTRY_S32("gDisableLOD", 1), - PRESET_ENTRY_S32("gDisableNaviCallAudio", 1), - PRESET_ENTRY_S32("gFastChests", 1), - PRESET_ENTRY_S32("gFastDrops", 1), - PRESET_ENTRY_S32("gDpadText", 1), - PRESET_ENTRY_S32("gDpadOcarina", 1), - PRESET_ENTRY_S32("gRStickOcarina", 1), - PRESET_ENTRY_S32("gDpadEquips", 1), - PRESET_ENTRY_S32("gFastOcarinaPlayback", 1), - PRESET_ENTRY_S32("gSkipScarecrow", 1), - PRESET_ENTRY_S32("gMarketSneak", 1), - PRESET_ENTRY_S32("gInstantPutaway", 1), - PRESET_ENTRY_S32("gFastBoomerang", 1), - PRESET_ENTRY_S32("gDpadNoDropOcarinaInput", 1), - PRESET_ENTRY_S32("gAdultBunnyHood", 1), - PRESET_ENTRY_S32("gMMBunnyHood", BUNNY_HOOD_FAST), - PRESET_ENTRY_S32("gSeparateArrows", 1), - PRESET_ENTRY_S32("gAssignableTunicsAndBoots", 1), - PRESET_ENTRY_S32("gEquipmentCanBeRemoved", 1), - PRESET_ENTRY_S32("gDayGravePull", 1), - PRESET_ENTRY_S32("gDrawLineupTick", 1), - PRESET_ENTRY_S32("gNewDrops", 1), - PRESET_ENTRY_S32("gCreditsFix", 1), - PRESET_ENTRY_S32("gSkipText", 1), - PRESET_ENTRY_S32("gSkulltulaFreeze", 1), - PRESET_ENTRY_S32("gPauseAnyCursor", 1), - PRESET_ENTRY_S32("gHideBuildInfo", 1), - PRESET_ENTRY_S32("gSkipLogoTitle", 1), - PRESET_ENTRY_S32("gSaveFileID", 4), - PRESET_ENTRY_S32("gFastFarores", 1), - PRESET_ENTRY_S32("gNoInputForCredits", 1), - PRESET_ENTRY_S32("gMaskSelect", 1), - PRESET_ENTRY_S32("gInjectItemCounts", 1), - PRESET_ENTRY_S32("gCustomizeFishing", 1), - PRESET_ENTRY_S32("gFishNeverEscape", 1), - PRESET_ENTRY_S32("gInstantFishing", 1), - PRESET_ENTRY_S32("gGuaranteeFishingBite", 1), - PRESET_ENTRY_S32("gAdultMinimumWeightFish", 6), - PRESET_ENTRY_S32("gChildMinimumWeightFish", 3), - PRESET_ENTRY_S32("gGoronPot", 1), - PRESET_ENTRY_S32("gForgeTime", 0), - PRESET_ENTRY_S32("gDisableFirstPersonChus", 1), - PRESET_ENTRY_S32("gCheatEasyPauseBufferEnabled", 1), - PRESET_ENTRY_S32("gDampeAllNight", 1), - PRESET_ENTRY_S32("gRandomize10GSHint", 1), - PRESET_ENTRY_S32("gRandomize20GSHint", 1), - PRESET_ENTRY_S32("gRandomize30GSHint", 1), - PRESET_ENTRY_S32("gRandomize40GSHint", 1), - PRESET_ENTRY_S32("gRandomize50GSHint", 1), - PRESET_ENTRY_S32("gRandomizeAllLocationsReachable", 0), - PRESET_ENTRY_S32("gRandomizeBlueFireArrows", 1), - PRESET_ENTRY_S32("gRandomizeBombchusInLogic", 1), - PRESET_ENTRY_S32("gRandomizeCompleteMaskQuest", 1), - PRESET_ENTRY_S32("gRandomizeCuccosToReturn", 1), - PRESET_ENTRY_S32("gRandomizeDampeHint", 1), - PRESET_ENTRY_S32("gRandomizeDoorOfTime", RO_DOOROFTIME_OPEN), - PRESET_ENTRY_S32("gRandomizeEnableBombchuDrops", 1), - PRESET_ENTRY_CPP_STRING("gRandomizeExcludedLocations", FormatLocations( + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LogicRules"), 0), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TextSpeed"), 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MweepSpeed"), 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ClimbSpeed"), 4), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterBlockPush"), 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoForcedNavi"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableNaviCallAudio"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastChests"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastDrops"), 1), + PRESET_ENTRY_S32(CVAR_SETTING("DpadInText"), 1), + PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.Dpad"), 1), + PRESET_ENTRY_S32(CVAR_SETTING("OcarinaControl.RStick"), 1), + PRESET_ENTRY_S32(CVAR_SETTING("DpadEquips"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantScarecrow"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MarketSneak"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantPutaway"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastBoomerang"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AdultBunnyHood"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_FAST), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SeparateArrows"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EquipmentCanBeRemoved"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DayGravePull"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NewDrops"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CreditsFix"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipText"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkulltulaFreeze"), 1), + PRESET_ENTRY_S32(CVAR_SETTING("PauseAnyCursor"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastFarores"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoInputForCredits"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MaskSelect"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFishing"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FishNeverEscape"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantFishing"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GuaranteeFishingBite"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MinimumFishWeightAdult"), 6), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MinimumFishWeightChild"), 3), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GoronPot"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ForgeTime"), 0), + PRESET_ENTRY_S32(CVAR_CHEAT("EasyPauseBuffer"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DampeAllNight"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("10GSHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("20GSHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("30GSHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("40GSHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("50GSHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("AllLocationsReachable"), 0), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BombchusInLogic"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DampeHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), RO_DOOROFTIME_OPEN), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), + PRESET_ENTRY_CPP_STRING(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), FormatLocations( { RC_MARKET_10_BIG_POES, RC_KAK_40_GOLD_SKULLTULA_REWARD, RC_KAK_50_GOLD_SKULLTULA_REWARD, RC_ZR_FROGS_OCARINA_GAME })), - PRESET_ENTRY_S32("gRandomizeForest", RO_FOREST_OPEN), - PRESET_ENTRY_S32("gRandomizeFullWallets", 1), - PRESET_ENTRY_S32("gRandomizeGanonTrial", RO_GANONS_TRIALS_SKIP), - PRESET_ENTRY_S32("gRandomizeGerudoFortress", RO_GF_FAST), - PRESET_ENTRY_S32("gRandomizeGregHint", 1), - PRESET_ENTRY_S32("gRandomizeGsExpectSunsSong", 1), - PRESET_ENTRY_S32("gRandomizeKakarikoGate", RO_KAK_GATE_OPEN), - PRESET_ENTRY_S32("gRandomizeLacsRewardCount", 5), - PRESET_ENTRY_S32("gRandomizeRainbowBridge", RO_BRIDGE_GREG), - PRESET_ENTRY_S32("gRandomizeScrubText", 1), - PRESET_ENTRY_S32("gRandomizeShopsanity", RO_SHOPSANITY_RANDOM), - PRESET_ENTRY_S32("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_LACS_REWARDS), - PRESET_ENTRY_S32("gRandomizeShuffleKeyRings", RO_KEYRINGS_COUNT), - PRESET_ENTRY_S32("gRandomizeShuffleKokiriSword", 1), - PRESET_ENTRY_S32("gRandomizeShuffleOcarinas", 1), - PRESET_ENTRY_S32("gRandomizeShuffleScrubs", RO_SCRUBS_AFFORDABLE), - PRESET_ENTRY_S32("gRandomizeSkipChildStealth", 1), - PRESET_ENTRY_S32("gRandomizeSkipChildZelda", 1), - PRESET_ENTRY_S32("gRandomizeSkipEponaRace", 1), - PRESET_ENTRY_S32("gRandomizeSkipScarecrowsSong", 1), - PRESET_ENTRY_S32("gRandomizeSkipTowerEscape", 1), - PRESET_ENTRY_S32("gRandomizeStartingConsumables", 1), - PRESET_ENTRY_S32("gRandomizeStartingMapsCompasses", RO_DUNGEON_ITEM_LOC_STARTWITH), - PRESET_ENTRY_S32("gRandomizeStartingOcarina", 1), - PRESET_ENTRY_S32("gRandomizeSunlightArrows", 1), - PRESET_ENTRY_S32("gRandomizerSettingsEnabled", 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Forest"), RO_FOREST_OPEN), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FullWallets"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SKIP), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_FAST), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GregHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GsExpectSunsSong"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), RO_KAK_GATE_OPEN), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardCount"), 5), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_GREG), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubText"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_RANDOM), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_REWARDS), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), RO_KEYRINGS_COUNT), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), RO_SCRUBS_AFFORDABLE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildStealth"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipTowerEscape"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingConsumables"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_STARTWITH), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingOcarina"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), 1), }; const std::vector spockRaceNoLogicPresetEntries = { - PRESET_ENTRY_S32("gAdultBunnyHood", 1), - PRESET_ENTRY_S32("gAdultMinimumWeightFish", 6), - PRESET_ENTRY_S32("gAssignableTunicsAndBoots", 1), - PRESET_ENTRY_S32("gCheatEasyPauseBufferEnabled", 1), - PRESET_ENTRY_S32("gChildMinimumWeightFish", 3), - PRESET_ENTRY_S32("gClimbSpeed", 4), - PRESET_ENTRY_S32("gCosmetics.Goron_NeckLength", 1000), - PRESET_ENTRY_S32("gCreditsFix", 1), - PRESET_ENTRY_S32("gCustomizeFishing", 1), - PRESET_ENTRY_S32("gDampeAllNight", 1), - PRESET_ENTRY_S32("gDayGravePull", 1), - PRESET_ENTRY_S32("gDisableFirstPersonChus", 1), - PRESET_ENTRY_S32("gDisableLOD", 1), - PRESET_ENTRY_S32("gDisableNaviCallAudio", 1), - PRESET_ENTRY_S32("gDpadEquips", 1), - PRESET_ENTRY_S32("gDpadNoDropOcarinaInput", 1), - PRESET_ENTRY_S32("gDpadOcarina", 1), - PRESET_ENTRY_S32("gDpadText", 1), - PRESET_ENTRY_S32("gDrawLineupTick", 1), - PRESET_ENTRY_S32("gEquipmentCanBeRemoved", 1), - PRESET_ENTRY_S32("gFastBoomerang", 1), - PRESET_ENTRY_S32("gFastChests", 1), - PRESET_ENTRY_S32("gFastDrops", 1), - PRESET_ENTRY_S32("gFastFarores", 1), - PRESET_ENTRY_S32("gFastOcarinaPlayback", 1), - PRESET_ENTRY_S32("gFasterBlockPush", 5), - PRESET_ENTRY_S32("gFasterHeavyBlockLift", 1), - PRESET_ENTRY_S32("gFishNeverEscape", 1), - PRESET_ENTRY_S32("gForgeTime", 0), - PRESET_ENTRY_S32("gGameplayStats.RTATiming", 1), - PRESET_ENTRY_S32("gGameplayStats.ShowIngameTimer", 1), - PRESET_ENTRY_S32("gGoronPot", 1), - PRESET_ENTRY_S32("gGuaranteeFishingBite", 1), - PRESET_ENTRY_S32("gHideBuildInfo", 1), - PRESET_ENTRY_S32("gInjectItemCounts", 1), - PRESET_ENTRY_S32("gInstantFishing", 1), - PRESET_ENTRY_S32("gInstantPutaway", 1), - PRESET_ENTRY_S32("gMMBunnyHood", BUNNY_HOOD_FAST), - PRESET_ENTRY_S32("gMarketSneak", 1), - PRESET_ENTRY_S32("gMaskSelect", 1), - PRESET_ENTRY_S32("gMweepSpeed", 5), - PRESET_ENTRY_S32("gNewDrops", 1), - PRESET_ENTRY_S32("gNoForcedNavi", 1), - PRESET_ENTRY_S32("gNoInputForCredits", 1), - PRESET_ENTRY_S32("gOnFileSelectNameEntry", 0), - PRESET_ENTRY_S32("gOpenMenuBar", 1), - PRESET_ENTRY_S32("gPauseAnyCursor", 1), - PRESET_ENTRY_S32("gRStickOcarina", 1), - PRESET_ENTRY_S32("gRandomize10GSHint", 1), - PRESET_ENTRY_S32("gRandomize20GSHint", 1), - PRESET_ENTRY_S32("gRandomize30GSHint", 1), - PRESET_ENTRY_S32("gRandomize40GSHint", 1), - PRESET_ENTRY_S32("gRandomize50GSHint", 1), - PRESET_ENTRY_S32("gRandomizeAllLocationsReachable", 0), - PRESET_ENTRY_S32("gRandomizeBlueFireArrows", 1), - PRESET_ENTRY_S32("gRandomizeBombchusInLogic", 1), - PRESET_ENTRY_S32("gRandomizeBossKeysanity", RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32("gRandomizeCompleteMaskQuest", 1), - PRESET_ENTRY_S32("gRandomizeCuccosToReturn", 1), - PRESET_ENTRY_S32("gRandomizeDampeHint", 1), - PRESET_ENTRY_S32("gRandomizeDoorOfTime", RO_DOOROFTIME_OPEN), - PRESET_ENTRY_S32("gRandomizeEnableBombchuDrops", 1), - PRESET_ENTRY_CPP_STRING("gRandomizeExcludedLocations", FormatLocations( + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AdultBunnyHood"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MinimumFishWeightAdult"), 6), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 1), + PRESET_ENTRY_S32(CVAR_CHEAT("EasyPauseBuffer"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MinimumFishWeightChild"), 3), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ClimbSpeed"), 4), + PRESET_ENTRY_S32(CVAR_COSMETIC("Goron.NeckLength"), 1000), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CreditsFix"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFishing"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DampeAllNight"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DayGravePull"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableNaviCallAudio"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EquipmentCanBeRemoved"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastBoomerang"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastChests"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastDrops"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastFarores"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterBlockPush"), 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FishNeverEscape"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ForgeTime"), 0), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GoronPot"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GuaranteeFishingBite"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantFishing"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantPutaway"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_FAST), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MarketSneak"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MaskSelect"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MweepSpeed"), 5), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoForcedNavi"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoInputForCredits"), 1), + PRESET_ENTRY_S32(CVAR_SETTING("PauseAnyCursor"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("10GSHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("20GSHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("30GSHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("40GSHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("50GSHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("AllLocationsReachable"), 0), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BombchusInLogic"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DampeHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), RO_DOOROFTIME_OPEN), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), + PRESET_ENTRY_CPP_STRING(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), FormatLocations( { RC_MARKET_10_BIG_POES, RC_KAK_40_GOLD_SKULLTULA_REWARD, RC_KAK_50_GOLD_SKULLTULA_REWARD, RC_ZR_FROGS_OCARINA_GAME })), - PRESET_ENTRY_S32("gRandomizeForest", RO_FOREST_OPEN), - PRESET_ENTRY_S32("gRandomizeFullWallets", 1), - PRESET_ENTRY_S32("gRandomizeGanonTrial", RO_GANONS_TRIALS_SKIP), - PRESET_ENTRY_S32("gRandomizeGerudoFortress", RO_GF_FAST), - PRESET_ENTRY_S32("gRandomizeGerudoKeys", RO_GERUDO_KEYS_ANYWHERE), - PRESET_ENTRY_S32("gRandomizeGregHint", 1), - PRESET_ENTRY_S32("gRandomizeGsExpectSunsSong", 0), - PRESET_ENTRY_S32("gRandomizeKakarikoGate", RO_KAK_GATE_OPEN), - PRESET_ENTRY_S32("gRandomizeKeysanity", RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32("gRandomizeLacsRewardCount", 5), - PRESET_ENTRY_S32("gRandomizeLogicRules", RO_LOGIC_NO_LOGIC), - PRESET_ENTRY_S32("gRandomizeRainbowBridge", RO_BRIDGE_GREG), - PRESET_ENTRY_S32("gRandomizeScrubText", 1), - PRESET_ENTRY_S32("gRandomizeShopsanity", RO_SHOPSANITY_RANDOM), - PRESET_ENTRY_S32("gRandomizeShuffleAdultTrade", 0), - PRESET_ENTRY_S32("gRandomizeShuffleBeans", 1), - PRESET_ENTRY_S32("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_LACS_REWARDS), - PRESET_ENTRY_S32("gRandomizeShuffleGerudoToken", 1), - PRESET_ENTRY_S32("gRandomizeShuffleKeyRings", RO_KEYRINGS_COUNT), - PRESET_ENTRY_S32("gRandomizeShuffleKokiriSword", 1), - PRESET_ENTRY_S32("gRandomizeShuffleOcarinas", 1), - PRESET_ENTRY_S32("gRandomizeShuffleScrubs", 1), - PRESET_ENTRY_S32("gRandomizeShuffleSongs", RO_SONG_SHUFFLE_ANYWHERE), - PRESET_ENTRY_S32("gRandomizeShuffleTokens", RO_TOKENSANITY_ALL), - PRESET_ENTRY_S32("gRandomizeSkipChildStealth", 1), - PRESET_ENTRY_S32("gRandomizeSkipChildZelda", 1), - PRESET_ENTRY_S32("gRandomizeSkipEponaRace", 1), - PRESET_ENTRY_S32("gRandomizeSkipScarecrowsSong", 1), - PRESET_ENTRY_S32("gRandomizeSkipTowerEscape", 1), - PRESET_ENTRY_S32("gRandomizeStartingConsumables", 1), - PRESET_ENTRY_S32("gRandomizeStartingMapsCompasses", RO_DUNGEON_ITEM_LOC_STARTWITH), - PRESET_ENTRY_S32("gRandomizeStartingOcarina", 1), - PRESET_ENTRY_S32("gRandomizeSunlightArrows", 1), - PRESET_ENTRY_S32("gRandomizerSettingsEnabled", 1), - PRESET_ENTRY_S32("gSaveFileID", 4), - PRESET_ENTRY_S32("gSeparateArrows", 1), - PRESET_ENTRY_S32("gSkipLogoTitle", 1), - PRESET_ENTRY_S32("gSkipScarecrow", 1), - PRESET_ENTRY_S32("gSkipText", 1), - PRESET_ENTRY_S32("gSkulltulaFreeze", 1), - PRESET_ENTRY_S32("gTextSpeed", 5), - PRESET_ENTRY_S32("gZFightingMode", 0), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Forest"), RO_FOREST_OPEN), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FullWallets"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SKIP), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_FAST), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_ANYWHERE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GregHint"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GsExpectSunsSong"), 0), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), RO_KAK_GATE_OPEN), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardCount"), 5), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_NO_LOGIC), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_GREG), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubText"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_RANDOM), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), 0), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBeans"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_REWARDS), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), RO_KEYRINGS_COUNT), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleSongs"), RO_SONG_SHUFFLE_ANYWHERE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_ALL), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildStealth"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipTowerEscape"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingConsumables"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_STARTWITH), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingOcarina"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SeparateArrows"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantScarecrow"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkulltulaFreeze"), 1), }; const std::vector s6PresetEntries = { - PRESET_ENTRY_S32("gChestSizeAndTextureMatchesContents", CSMC_BOTH), - PRESET_ENTRY_S32("gFastChests", 1), - PRESET_ENTRY_S32("gMMBunnyHood", BUNNY_HOOD_FAST), - PRESET_ENTRY_S32("gAdultBunnyHood", 1), - PRESET_ENTRY_S32("gRandomizeBigPoeTargetCount", 1), - PRESET_ENTRY_S32("gRandomizeCuccosToReturn", 4), - PRESET_ENTRY_S32("gRandomizeDoorOfTime", RO_DOOROFTIME_OPEN), - PRESET_ENTRY_CPP_STRING("gRandomizeExcludedLocations", FormatLocations({ RC_DEKU_THEATER_MASK_OF_TRUTH })), - PRESET_ENTRY_S32("gRandomizeForest", RO_FOREST_CLOSED_DEKU), - PRESET_ENTRY_S32("gRandomizeGanonTrial", RO_GANONS_TRIALS_SKIP), - PRESET_ENTRY_S32("gRandomizeGerudoFortress", RO_GF_FAST), - PRESET_ENTRY_S32("gRandomizeIceTraps", RO_ICE_TRAPS_OFF), - PRESET_ENTRY_S32("gRandomizeKakarikoGate", RO_KAK_GATE_OPEN), - PRESET_ENTRY_S32("gRandomizeMedallionCount", 6), - PRESET_ENTRY_S32("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE), - PRESET_ENTRY_S32("gRandomizeRainbowBridge", RO_BRIDGE_MEDALLIONS), - PRESET_ENTRY_S32("gRandomizeShuffleAdultTrade", 1), - PRESET_ENTRY_S32("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON), - PRESET_ENTRY_S32("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_STARTWITH), - PRESET_ENTRY_S32("gRandomizeShuffleKokiriSword", 1), - PRESET_ENTRY_S32("gRandomizeShuffleOverworldSpawns", RO_GENERIC_ON), - PRESET_ENTRY_S32("gRandomizeSkipChildStealth", 1), - PRESET_ENTRY_S32("gRandomizeSkipChildZelda", 1), - PRESET_ENTRY_S32("gRandomizeSkipEponaRace", 1), - PRESET_ENTRY_S32("gRandomizeSkipTowerEscape", 1), - PRESET_ENTRY_S32("gRandomizeStartingAge", RO_AGE_RANDOM), - PRESET_ENTRY_S32("gRandomizeStartingConsumables", 1), - PRESET_ENTRY_S32("gRandomizeStartingDekuShield", 1), - PRESET_ENTRY_S32("gRandomizeStartingMapsCompasses", RO_DUNGEON_ITEM_LOC_STARTWITH), - PRESET_ENTRY_S32("gRandomizeStartingOcarina", 1), - PRESET_ENTRY_S32("gRandomizeZorasFountain", 0), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ChestSizeAndTextureMatchContents"), CSMC_BOTH), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastChests"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_FAST), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AdultBunnyHood"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 4), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), RO_DOOROFTIME_OPEN), + PRESET_ENTRY_CPP_STRING(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), FormatLocations({ RC_DEKU_THEATER_MASK_OF_TRUTH })), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Forest"), RO_FOREST_CLOSED_DEKU), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SKIP), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_FAST), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("IceTraps"), RO_ICE_TRAPS_OFF), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), RO_KAK_GATE_OPEN), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MedallionCount"), 6), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MQDungeons"), RO_MQ_DUNGEONS_NONE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_MEDALLIONS), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDungeonReward"), RO_DUNGEON_REWARDS_END_OF_DUNGEON), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_STARTWITH), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOverworldSpawns"), RO_GENERIC_ON), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildStealth"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipTowerEscape"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingAge"), RO_AGE_RANDOM), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingConsumables"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingDekuShield"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_STARTWITH), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingOcarina"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ZorasFountain"), 0), }; const std::vector hellModePresetEntries = { - PRESET_ENTRY_S32("gChestSizeAndTextureMatchesContents", CSMC_BOTH), - PRESET_ENTRY_S32("gFastChests", 1), - PRESET_ENTRY_S32("gMMBunnyHood", BUNNY_HOOD_FAST), - PRESET_ENTRY_S32("gAdultBunnyHood", 1), - PRESET_ENTRY_S32("gRandomizeBigPoeTargetCount", 1), - PRESET_ENTRY_S32("gRandomizeBlueFireArrows", 1), - PRESET_ENTRY_S32("gRandomizeBossKeysanity", RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32("gRandomizeCompleteMaskQuest", 1), - PRESET_ENTRY_S32("gRandomizeCuccosToReturn", 1), - PRESET_ENTRY_S32("gRandomizeDoorOfTime", RO_DOOROFTIME_OPEN), - PRESET_ENTRY_S32("gRandomizeEnableBombchuDrops", 1), - PRESET_ENTRY_S32("gRandomizeEnableGlitchCutscenes", 1), - PRESET_ENTRY_S32("gRandomizeForest", RO_FOREST_OPEN), - PRESET_ENTRY_S32("gRandomizeGanonTrial", RO_GANONS_TRIALS_SET_NUMBER), - PRESET_ENTRY_S32("gRandomizeGanonTrialCount", 6), - PRESET_ENTRY_S32("gRandomizeGerudoKeys", RO_GERUDO_KEYS_ANYWHERE), - PRESET_ENTRY_S32("gRandomizeGsExpectSunsSong", 1), - PRESET_ENTRY_S32("gRandomizeIceTraps", RO_ICE_TRAPS_ONSLAUGHT), - PRESET_ENTRY_S32("gRandomizeItemPool", RO_ITEM_POOL_MINIMAL), - PRESET_ENTRY_S32("gRandomizeKakarikoGate", RO_KAK_GATE_OPEN), - PRESET_ENTRY_S32("gRandomizeKeysanity", RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32("gRandomizeLinksPocket", RO_LINKS_POCKET_NOTHING), - PRESET_ENTRY_S32("gRandomizeMqDungeons", RO_MQ_DUNGEONS_RANDOM_NUMBER), - PRESET_ENTRY_S32("gRandomizeRainbowBridge", RO_BRIDGE_DUNGEON_REWARDS), - PRESET_ENTRY_S32("gRandomizeShopsanity", RO_SHOPSANITY_FOUR_ITEMS), - PRESET_ENTRY_S32("gRandomizeShopsanityPrices", RO_SHOPSANITY_PRICE_TYCOON), - PRESET_ENTRY_S32("gRandomizeShuffleAdultTrade", 1), - PRESET_ENTRY_S32("gRandomizeShuffleBeans", 1), - PRESET_ENTRY_S32("gRandomizeShuffleCows", 1), - PRESET_ENTRY_S32("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_ANYWHERE), - PRESET_ENTRY_S32("gRandomizeShuffleFrogSongRupees", 1), - PRESET_ENTRY_S32("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_LACS_DUNGEONS), - PRESET_ENTRY_S32("gRandomizeShuffleGerudoToken", 1), - PRESET_ENTRY_S32("gRandomizeShuffleKeyRings", RO_KEYRINGS_RANDOM), - PRESET_ENTRY_S32("gRandomizeShuffleKokiriSword", 1), - PRESET_ENTRY_S32("gRandomizeShuffleMasterSword", 1), - PRESET_ENTRY_S32("gRandomizeShuffleOcarinas", 1), - PRESET_ENTRY_S32("gRandomizeShuffleScrubs", RO_SCRUBS_RANDOM), - PRESET_ENTRY_S32("gRandomizeShuffleSongs", RO_SONG_SHUFFLE_ANYWHERE), - PRESET_ENTRY_S32("gRandomizeShuffleTokens", RO_TOKENSANITY_ALL), - PRESET_ENTRY_S32("gRandomizeShuffleWeirdEgg", 1), - PRESET_ENTRY_S32("gRandomizeSkipChildStealth", 1), - PRESET_ENTRY_S32("gRandomizeSkipEponaRace", 1), - PRESET_ENTRY_S32("gRandomizeSkipScarecrowsSong", 1), - PRESET_ENTRY_S32("gRandomizeSkipTowerEscape", 1), - PRESET_ENTRY_S32("gRandomizeStartingAge", RO_AGE_RANDOM), - PRESET_ENTRY_S32("gRandomizeStartingMapsCompasses", RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32("gRandomizeSunlightArrows", 1), - PRESET_ENTRY_S32("gRandomizeZorasFountain", 2), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ChestSizeAndTextureMatchContents"), CSMC_BOTH), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastChests"), 1), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_FAST), + PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AdultBunnyHood"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), RO_DOOROFTIME_OPEN), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableGlitchCutscenes"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Forest"), RO_FOREST_OPEN), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SET_NUMBER), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrialCount"), 6), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_ANYWHERE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GsExpectSunsSong"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("IceTraps"), RO_ICE_TRAPS_ONSLAUGHT), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ItemPool"), RO_ITEM_POOL_MINIMAL), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), RO_KAK_GATE_OPEN), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LinksPocket"), RO_LINKS_POCKET_NOTHING), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MQDungeons"), RO_MQ_DUNGEONS_RANDOM_NUMBER), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_DUNGEON_REWARDS), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_FOUR_ITEMS), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityPrices"), RO_SHOPSANITY_PRICE_TYCOON), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBeans"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleCows"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDungeonReward"), RO_DUNGEON_REWARDS_ANYWHERE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFrogSongRupees"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_DUNGEONS), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), RO_KEYRINGS_RANDOM), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMasterSword"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), RO_SCRUBS_RANDOM), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleSongs"), RO_SONG_SHUFFLE_ANYWHERE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_ALL), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleWeirdEgg"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildStealth"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipTowerEscape"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingAge"), RO_AGE_RANDOM), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_ANYWHERE), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), 1), + PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ZorasFountain"), 2), }; typedef struct PresetDefinition { diff --git a/soh/soh/Enhancements/randomizer/3drando/playthrough.cpp b/soh/soh/Enhancements/randomizer/3drando/playthrough.cpp index d29b6e8a6..ef6561205 100644 --- a/soh/soh/Enhancements/randomizer/3drando/playthrough.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/playthrough.cpp @@ -8,7 +8,8 @@ #include "random.hpp" #include "spoiler_log.hpp" #include "soh/Enhancements/randomizer/randomizerTypes.h" -#include +#include "variables.h" +#include "soh/OTRGlobals.h" #include "../option.h" namespace Playthrough { @@ -44,7 +45,7 @@ int Playthrough_Init(uint32_t seed, std::set excludedLocations, } } - if (CVarGetInteger("gRandomizerDontGenerateSpoiler", 0)) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) { settingsStr += (char*)gBuildVersion; } diff --git a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp index e3c757ba5..509c6f852 100644 --- a/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/rando_main.cpp @@ -8,12 +8,13 @@ #include #include #include +#include "soh/OTRGlobals.h" void RandoMain::GenerateRando(std::set excludedLocations, std::set enabledTricks, std::string seedString) { // std::string settingsFileName = "./randomizer/latest_settings.json"; - // CVarSetString("gLoadedPreset", settingsFileName.c_str()); + // CVarSetString(CVAR_RANDOMIZER_SETTING("LoadedPreset"), settingsFileName.c_str()); Rando::Context::GetInstance()->SetSeedGenerated(GenerateRandomizer(excludedLocations, enabledTricks, seedString)); diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index 1835dfe03..c40031e74 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -29,6 +29,7 @@ #include #include +#include #include "consolevariablebridge.h" @@ -638,8 +639,8 @@ const char* SpoilerLog_Write() { WriteShuffledEntrances(); WriteAllLocations(); - if (!std::filesystem::exists(LUS::Context::GetPathRelativeToAppDirectory("Randomizer"))) { - std::filesystem::create_directory(LUS::Context::GetPathRelativeToAppDirectory("Randomizer")); + if (!std::filesystem::exists(Ship::Context::GetPathRelativeToAppDirectory("Randomizer"))) { + std::filesystem::create_directory(Ship::Context::GetPathRelativeToAppDirectory("Randomizer")); } std::string jsonString = jsonData.dump(4); @@ -654,12 +655,12 @@ const char* SpoilerLog_Write() { fileNameStream << std::to_string(ctx->hashIconIndexes[i]); } std::string fileName = fileNameStream.str(); - std::ofstream jsonFile(LUS::Context::GetPathRelativeToAppDirectory( + std::ofstream jsonFile(Ship::Context::GetPathRelativeToAppDirectory( (std::string("Randomizer/") + fileName + std::string(".json")).c_str())); jsonFile << std::setw(4) << jsonString << std::endl; jsonFile.close(); - CVarSetString("gSpoilerLog", (std::string("./Randomizer/") + fileName + std::string(".json")).c_str()); + CVarSetString(CVAR_GENERAL("SpoilerLog"), (std::string("./Randomizer/") + fileName + std::string(".json")).c_str()); // Note: probably shouldn't return this without making sure this string is stored somewhere, but // this return value is currently only used in playthrough.cpp as a true/false. Even if the pointer diff --git a/soh/soh/Enhancements/randomizer/3drando/tinyxml2.cpp b/soh/soh/Enhancements/randomizer/3drando/tinyxml2.cpp deleted file mode 100644 index 3187ad558..000000000 --- a/soh/soh/Enhancements/randomizer/3drando/tinyxml2.cpp +++ /dev/null @@ -1,2956 +0,0 @@ -/* -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#include "tinyxml2.h" - -#include // yes, this one new style header, is in the Android SDK. -#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__) -# include -# include -#else -# include -# include -#endif - -#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE) - // Microsoft Visual Studio, version 2005 and higher. Not WinCE. - /*int _snprintf_s( - char *buffer, - size_t sizeOfBuffer, - size_t count, - const char *format [, - argument] ... - );*/ - static inline int TIXML_SNPRINTF( char* buffer, size_t size, const char* format, ... ) - { - va_list va; - va_start( va, format ); - const int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va ); - va_end( va ); - return result; - } - - static inline int TIXML_VSNPRINTF( char* buffer, size_t size, const char* format, va_list va ) - { - const int result = vsnprintf_s( buffer, size, _TRUNCATE, format, va ); - return result; - } - - #define TIXML_VSCPRINTF _vscprintf - #define TIXML_SSCANF sscanf_s -#elif defined _MSC_VER - // Microsoft Visual Studio 2003 and earlier or WinCE - #define TIXML_SNPRINTF _snprintf - #define TIXML_VSNPRINTF _vsnprintf - #define TIXML_SSCANF sscanf - #if (_MSC_VER < 1400 ) && (!defined WINCE) - // Microsoft Visual Studio 2003 and not WinCE. - #define TIXML_VSCPRINTF _vscprintf // VS2003's C runtime has this, but VC6 C runtime or WinCE SDK doesn't have. - #else - // Microsoft Visual Studio 2003 and earlier or WinCE. - static inline int TIXML_VSCPRINTF( const char* format, va_list va ) - { - int len = 512; - for (;;) { - len = len*2; - char* str = new char[len](); - const int required = _vsnprintf(str, len, format, va); - delete[] str; - if ( required != -1 ) { - TIXMLASSERT( required >= 0 ); - len = required; - break; - } - } - TIXMLASSERT( len >= 0 ); - return len; - } - #endif -#else - // GCC version 3 and higher - //#warning( "Using sn* functions." ) - #define TIXML_SNPRINTF snprintf - #define TIXML_VSNPRINTF vsnprintf - static inline int TIXML_VSCPRINTF( const char* format, va_list va ) - { - int len = vsnprintf( 0, 0, format, va ); - TIXMLASSERT( len >= 0 ); - return len; - } - #define TIXML_SSCANF sscanf -#endif - - -static const char LINE_FEED = static_cast(0x0a); // all line endings are normalized to LF -static const char LF = LINE_FEED; -static const char CARRIAGE_RETURN = static_cast(0x0d); // CR gets filtered out -static const char CR = CARRIAGE_RETURN; -static const char SINGLE_QUOTE = '\''; -static const char DOUBLE_QUOTE = '\"'; - -// Bunch of unicode info at: -// http://www.unicode.org/faq/utf_bom.html -// ef bb bf (Microsoft "lead bytes") - designates UTF-8 - -static const unsigned char TIXML_UTF_LEAD_0 = 0xefU; -static const unsigned char TIXML_UTF_LEAD_1 = 0xbbU; -static const unsigned char TIXML_UTF_LEAD_2 = 0xbfU; - -namespace tinyxml2 -{ - -struct Entity { - const char* pattern; - int length; - char value; -}; - -static const int NUM_ENTITIES = 5; -static const Entity entities[NUM_ENTITIES] = { - { "quot", 4, DOUBLE_QUOTE }, - { "amp", 3, '&' }, - { "apos", 4, SINGLE_QUOTE }, - { "lt", 2, '<' }, - { "gt", 2, '>' } -}; - - -StrPair::~StrPair() -{ - Reset(); -} - - -void StrPair::TransferTo( StrPair* other ) -{ - if ( this == other ) { - return; - } - // This in effect implements the assignment operator by "moving" - // ownership (as in auto_ptr). - - TIXMLASSERT( other != 0 ); - TIXMLASSERT( other->_flags == 0 ); - TIXMLASSERT( other->_start == 0 ); - TIXMLASSERT( other->_end == 0 ); - - other->Reset(); - - other->_flags = _flags; - other->_start = _start; - other->_end = _end; - - _flags = 0; - _start = 0; - _end = 0; -} - - -void StrPair::Reset() -{ - if ( _flags & NEEDS_DELETE ) { - delete [] _start; - } - _flags = 0; - _start = 0; - _end = 0; -} - - -void StrPair::SetStr( const char* str, int flags ) -{ - TIXMLASSERT( str ); - Reset(); - size_t len = strlen( str ); - TIXMLASSERT( _start == 0 ); - _start = new char[ len+1 ]; - memcpy( _start, str, len+1 ); - _end = _start + len; - _flags = flags | NEEDS_DELETE; -} - - -char* StrPair::ParseText( char* p, const char* endTag, int strFlags, int* curLineNumPtr ) -{ - TIXMLASSERT( p ); - TIXMLASSERT( endTag && *endTag ); - TIXMLASSERT(curLineNumPtr); - - char* start = p; - const char endChar = *endTag; - size_t length = strlen( endTag ); - - // Inner loop of text parsing. - while ( *p ) { - if ( *p == endChar && strncmp( p, endTag, length ) == 0 ) { - Set( start, p, strFlags ); - return p + length; - } else if (*p == '\n') { - ++(*curLineNumPtr); - } - ++p; - TIXMLASSERT( p ); - } - return 0; -} - - -char* StrPair::ParseName( char* p ) -{ - if ( !p || !(*p) ) { - return 0; - } - if ( !XMLUtil::IsNameStartChar( *p ) ) { - return 0; - } - - char* const start = p; - ++p; - while ( *p && XMLUtil::IsNameChar( *p ) ) { - ++p; - } - - Set( start, p, 0 ); - return p; -} - - -void StrPair::CollapseWhitespace() -{ - // Adjusting _start would cause undefined behavior on delete[] - TIXMLASSERT( ( _flags & NEEDS_DELETE ) == 0 ); - // Trim leading space. - _start = XMLUtil::SkipWhiteSpace( _start, 0 ); - - if ( *_start ) { - const char* p = _start; // the read pointer - char* q = _start; // the write pointer - - while( *p ) { - if ( XMLUtil::IsWhiteSpace( *p )) { - p = XMLUtil::SkipWhiteSpace( p, 0 ); - if ( *p == 0 ) { - break; // don't write to q; this trims the trailing space. - } - *q = ' '; - ++q; - } - *q = *p; - ++q; - ++p; - } - *q = 0; - } -} - - -const char* StrPair::GetStr() -{ - TIXMLASSERT( _start ); - TIXMLASSERT( _end ); - if ( _flags & NEEDS_FLUSH ) { - *_end = 0; - _flags ^= NEEDS_FLUSH; - - if ( _flags ) { - const char* p = _start; // the read pointer - char* q = _start; // the write pointer - - while( p < _end ) { - if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == CR ) { - // CR-LF pair becomes LF - // CR alone becomes LF - // LF-CR becomes LF - if ( *(p+1) == LF ) { - p += 2; - } - else { - ++p; - } - *q = LF; - ++q; - } - else if ( (_flags & NEEDS_NEWLINE_NORMALIZATION) && *p == LF ) { - if ( *(p+1) == CR ) { - p += 2; - } - else { - ++p; - } - *q = LF; - ++q; - } - else if ( (_flags & NEEDS_ENTITY_PROCESSING) && *p == '&' ) { - // Entities handled by tinyXML2: - // - special entities in the entity table [in/out] - // - numeric character reference [in] - // 中 or 中 - - if ( *(p+1) == '#' ) { - const int buflen = 10; - char buf[buflen] = { 0 }; - int len = 0; - const char* adjusted = const_cast( XMLUtil::GetCharacterRef( p, buf, &len ) ); - if ( adjusted == 0 ) { - *q = *p; - ++p; - ++q; - } - else { - TIXMLASSERT( 0 <= len && len <= buflen ); - TIXMLASSERT( q + len <= adjusted ); - p = adjusted; - memcpy( q, buf, len ); - q += len; - } - } - else { - bool entityFound = false; - for( int i = 0; i < NUM_ENTITIES; ++i ) { - const Entity& entity = entities[i]; - if ( strncmp( p + 1, entity.pattern, entity.length ) == 0 - && *( p + entity.length + 1 ) == ';' ) { - // Found an entity - convert. - *q = entity.value; - ++q; - p += entity.length + 2; - entityFound = true; - break; - } - } - if ( !entityFound ) { - // fixme: treat as error? - ++p; - ++q; - } - } - } - else { - *q = *p; - ++p; - ++q; - } - } - *q = 0; - } - // The loop below has plenty going on, and this - // is a less useful mode. Break it out. - if ( _flags & NEEDS_WHITESPACE_COLLAPSING ) { - CollapseWhitespace(); - } - _flags = (_flags & NEEDS_DELETE); - } - TIXMLASSERT( _start ); - return _start; -} - - - - -// --------- XMLUtil ----------- // - -const char* XMLUtil::writeBoolTrue = "true"; -const char* XMLUtil::writeBoolFalse = "false"; - -void XMLUtil::SetBoolSerialization(const char* writeTrue, const char* writeFalse) -{ - static const char* defTrue = "true"; - static const char* defFalse = "false"; - - writeBoolTrue = (writeTrue) ? writeTrue : defTrue; - writeBoolFalse = (writeFalse) ? writeFalse : defFalse; -} - - -const char* XMLUtil::ReadBOM( const char* p, bool* bom ) -{ - TIXMLASSERT( p ); - TIXMLASSERT( bom ); - *bom = false; - const unsigned char* pu = reinterpret_cast(p); - // Check for BOM: - if ( *(pu+0) == TIXML_UTF_LEAD_0 - && *(pu+1) == TIXML_UTF_LEAD_1 - && *(pu+2) == TIXML_UTF_LEAD_2 ) { - *bom = true; - p += 3; - } - TIXMLASSERT( p ); - return p; -} - - -void XMLUtil::ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ) -{ - const unsigned long BYTE_MASK = 0xBF; - const unsigned long BYTE_MARK = 0x80; - const unsigned long FIRST_BYTE_MARK[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC }; - - if (input < 0x80) { - *length = 1; - } - else if ( input < 0x800 ) { - *length = 2; - } - else if ( input < 0x10000 ) { - *length = 3; - } - else if ( input < 0x200000 ) { - *length = 4; - } - else { - *length = 0; // This code won't convert this correctly anyway. - return; - } - - output += *length; - - // Scary scary fall throughs are annotated with carefully designed comments - // to suppress compiler warnings such as -Wimplicit-fallthrough in gcc - switch (*length) { - case 4: - --output; - *output = static_cast((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - //fall through - case 3: - --output; - *output = static_cast((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - //fall through - case 2: - --output; - *output = static_cast((input | BYTE_MARK) & BYTE_MASK); - input >>= 6; - //fall through - case 1: - --output; - *output = static_cast(input | FIRST_BYTE_MARK[*length]); - break; - default: - TIXMLASSERT( false ); - } -} - - -const char* XMLUtil::GetCharacterRef( const char* p, char* value, int* length ) -{ - // Presume an entity, and pull it out. - *length = 0; - - if ( *(p+1) == '#' && *(p+2) ) { - unsigned long ucs = 0; - TIXMLASSERT( sizeof( ucs ) >= 4 ); - ptrdiff_t delta = 0; - unsigned mult = 1; - static const char SEMICOLON = ';'; - - if ( *(p+2) == 'x' ) { - // Hexadecimal. - const char* q = p+3; - if ( !(*q) ) { - return 0; - } - - q = strchr( q, SEMICOLON ); - - if ( !q ) { - return 0; - } - TIXMLASSERT( *q == SEMICOLON ); - - delta = q-p; - --q; - - while ( *q != 'x' ) { - unsigned int digit = 0; - - if ( *q >= '0' && *q <= '9' ) { - digit = *q - '0'; - } - else if ( *q >= 'a' && *q <= 'f' ) { - digit = *q - 'a' + 10; - } - else if ( *q >= 'A' && *q <= 'F' ) { - digit = *q - 'A' + 10; - } - else { - return 0; - } - TIXMLASSERT( digit < 16 ); - TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit ); - const unsigned int digitScaled = mult * digit; - TIXMLASSERT( ucs <= ULONG_MAX - digitScaled ); - ucs += digitScaled; - TIXMLASSERT( mult <= UINT_MAX / 16 ); - mult *= 16; - --q; - } - } - else { - // Decimal. - const char* q = p+2; - if ( !(*q) ) { - return 0; - } - - q = strchr( q, SEMICOLON ); - - if ( !q ) { - return 0; - } - TIXMLASSERT( *q == SEMICOLON ); - - delta = q-p; - --q; - - while ( *q != '#' ) { - if ( *q >= '0' && *q <= '9' ) { - const unsigned int digit = *q - '0'; - TIXMLASSERT( digit < 10 ); - TIXMLASSERT( digit == 0 || mult <= UINT_MAX / digit ); - const unsigned int digitScaled = mult * digit; - TIXMLASSERT( ucs <= ULONG_MAX - digitScaled ); - ucs += digitScaled; - } - else { - return 0; - } - TIXMLASSERT( mult <= UINT_MAX / 10 ); - mult *= 10; - --q; - } - } - // convert the UCS to UTF-8 - ConvertUTF32ToUTF8( ucs, value, length ); - return p + delta + 1; - } - return p+1; -} - - -void XMLUtil::ToStr( int v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%d", v ); -} - - -void XMLUtil::ToStr( unsigned v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%u", v ); -} - - -void XMLUtil::ToStr( bool v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%s", v ? writeBoolTrue : writeBoolFalse); -} - -/* - ToStr() of a number is a very tricky topic. - https://github.com/leethomason/tinyxml2/issues/106 -*/ -void XMLUtil::ToStr( float v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%.8g", v ); -} - - -void XMLUtil::ToStr( double v, char* buffer, int bufferSize ) -{ - TIXML_SNPRINTF( buffer, bufferSize, "%.17g", v ); -} - - -void XMLUtil::ToStr( int64_t v, char* buffer, int bufferSize ) -{ - // horrible syntax trick to make the compiler happy about %lld - TIXML_SNPRINTF(buffer, bufferSize, "%lld", static_cast(v)); -} - -void XMLUtil::ToStr( uint64_t v, char* buffer, int bufferSize ) -{ - // horrible syntax trick to make the compiler happy about %llu - TIXML_SNPRINTF(buffer, bufferSize, "%llu", (long long)v); -} - -bool XMLUtil::ToInt( const char* str, int* value ) -{ - if ( TIXML_SSCANF( str, "%d", value ) == 1 ) { - return true; - } - return false; -} - -bool XMLUtil::ToUnsigned( const char* str, unsigned *value ) -{ - if ( TIXML_SSCANF( str, "%u", value ) == 1 ) { - return true; - } - return false; -} - -bool XMLUtil::ToBool( const char* str, bool* value ) -{ - int ival = 0; - if ( ToInt( str, &ival )) { - *value = (ival==0) ? false : true; - return true; - } - static const char* TRUE_VALS[] = { "true", "True", "TRUE", 0 }; - static const char* FALSE_VALS[] = { "false", "False", "FALSE", 0 }; - - for (int i = 0; TRUE_VALS[i]; ++i) { - if (StringEqual(str, TRUE_VALS[i])) { - *value = true; - return true; - } - } - for (int i = 0; FALSE_VALS[i]; ++i) { - if (StringEqual(str, FALSE_VALS[i])) { - *value = false; - return true; - } - } - return false; -} - - -bool XMLUtil::ToFloat( const char* str, float* value ) -{ - if ( TIXML_SSCANF( str, "%f", value ) == 1 ) { - return true; - } - return false; -} - - -bool XMLUtil::ToDouble( const char* str, double* value ) -{ - if ( TIXML_SSCANF( str, "%lf", value ) == 1 ) { - return true; - } - return false; -} - - -bool XMLUtil::ToInt64(const char* str, int64_t* value) -{ - long long v = 0; // horrible syntax trick to make the compiler happy about %lld - if (TIXML_SSCANF(str, "%lld", &v) == 1) { - *value = static_cast(v); - return true; - } - return false; -} - - -bool XMLUtil::ToUnsigned64(const char* str, uint64_t* value) { - unsigned long long v = 0; // horrible syntax trick to make the compiler happy about %llu - if(TIXML_SSCANF(str, "%llu", &v) == 1) { - *value = (uint64_t)v; - return true; - } - return false; -} - - -char* XMLDocument::Identify( char* p, XMLNode** node ) -{ - TIXMLASSERT( node ); - TIXMLASSERT( p ); - char* const start = p; - int const startLine = _parseCurLineNum; - p = XMLUtil::SkipWhiteSpace( p, &_parseCurLineNum ); - if( !*p ) { - *node = 0; - TIXMLASSERT( p ); - return p; - } - - // These strings define the matching patterns: - static const char* xmlHeader = { "( _commentPool ); - returnNode->_parseLineNum = _parseCurLineNum; - p += xmlHeaderLen; - } - else if ( XMLUtil::StringEqual( p, commentHeader, commentHeaderLen ) ) { - returnNode = CreateUnlinkedNode( _commentPool ); - returnNode->_parseLineNum = _parseCurLineNum; - p += commentHeaderLen; - } - else if ( XMLUtil::StringEqual( p, cdataHeader, cdataHeaderLen ) ) { - XMLText* text = CreateUnlinkedNode( _textPool ); - returnNode = text; - returnNode->_parseLineNum = _parseCurLineNum; - p += cdataHeaderLen; - text->SetCData( true ); - } - else if ( XMLUtil::StringEqual( p, dtdHeader, dtdHeaderLen ) ) { - returnNode = CreateUnlinkedNode( _commentPool ); - returnNode->_parseLineNum = _parseCurLineNum; - p += dtdHeaderLen; - } - else if ( XMLUtil::StringEqual( p, elementHeader, elementHeaderLen ) ) { - returnNode = CreateUnlinkedNode( _elementPool ); - returnNode->_parseLineNum = _parseCurLineNum; - p += elementHeaderLen; - } - else { - returnNode = CreateUnlinkedNode( _textPool ); - returnNode->_parseLineNum = _parseCurLineNum; // Report line of first non-whitespace character - p = start; // Back it up, all the text counts. - _parseCurLineNum = startLine; - } - - TIXMLASSERT( returnNode ); - TIXMLASSERT( p ); - *node = returnNode; - return p; -} - - -bool XMLDocument::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - if ( visitor->VisitEnter( *this ) ) { - for ( const XMLNode* node=FirstChild(); node; node=node->NextSibling() ) { - if ( !node->Accept( visitor ) ) { - break; - } - } - } - return visitor->VisitExit( *this ); -} - - -// --------- XMLNode ----------- // - -XMLNode::XMLNode( XMLDocument* doc ) : - _document( doc ), - _parent( 0 ), - _value(), - _parseLineNum( 0 ), - _firstChild( 0 ), _lastChild( 0 ), - _prev( 0 ), _next( 0 ), - _userData( 0 ), - _memPool( 0 ) -{ -} - - -XMLNode::~XMLNode() -{ - DeleteChildren(); - if ( _parent ) { - _parent->Unlink( this ); - } -} - -const char* XMLNode::Value() const -{ - // Edge case: XMLDocuments don't have a Value. Return null. - if ( this->ToDocument() ) - return 0; - return _value.GetStr(); -} - -void XMLNode::SetValue( const char* str, bool staticMem ) -{ - if ( staticMem ) { - _value.SetInternedStr( str ); - } - else { - _value.SetStr( str ); - } -} - -XMLNode* XMLNode::DeepClone(XMLDocument* target) const -{ - XMLNode* clone = this->ShallowClone(target); - if (!clone) return 0; - - for (const XMLNode* child = this->FirstChild(); child; child = child->NextSibling()) { - XMLNode* childClone = child->DeepClone(target); - TIXMLASSERT(childClone); - clone->InsertEndChild(childClone); - } - return clone; -} - -void XMLNode::DeleteChildren() -{ - while( _firstChild ) { - TIXMLASSERT( _lastChild ); - DeleteChild( _firstChild ); - } - _firstChild = _lastChild = 0; -} - - -void XMLNode::Unlink( XMLNode* child ) -{ - TIXMLASSERT( child ); - TIXMLASSERT( child->_document == _document ); - TIXMLASSERT( child->_parent == this ); - if ( child == _firstChild ) { - _firstChild = _firstChild->_next; - } - if ( child == _lastChild ) { - _lastChild = _lastChild->_prev; - } - - if ( child->_prev ) { - child->_prev->_next = child->_next; - } - if ( child->_next ) { - child->_next->_prev = child->_prev; - } - child->_next = 0; - child->_prev = 0; - child->_parent = 0; -} - - -void XMLNode::DeleteChild( XMLNode* node ) -{ - TIXMLASSERT( node ); - TIXMLASSERT( node->_document == _document ); - TIXMLASSERT( node->_parent == this ); - Unlink( node ); - TIXMLASSERT(node->_prev == 0); - TIXMLASSERT(node->_next == 0); - TIXMLASSERT(node->_parent == 0); - DeleteNode( node ); -} - - -XMLNode* XMLNode::InsertEndChild( XMLNode* addThis ) -{ - TIXMLASSERT( addThis ); - if ( addThis->_document != _document ) { - TIXMLASSERT( false ); - return 0; - } - InsertChildPreamble( addThis ); - - if ( _lastChild ) { - TIXMLASSERT( _firstChild ); - TIXMLASSERT( _lastChild->_next == 0 ); - _lastChild->_next = addThis; - addThis->_prev = _lastChild; - _lastChild = addThis; - - addThis->_next = 0; - } - else { - TIXMLASSERT( _firstChild == 0 ); - _firstChild = _lastChild = addThis; - - addThis->_prev = 0; - addThis->_next = 0; - } - addThis->_parent = this; - return addThis; -} - - -XMLNode* XMLNode::InsertFirstChild( XMLNode* addThis ) -{ - TIXMLASSERT( addThis ); - if ( addThis->_document != _document ) { - TIXMLASSERT( false ); - return 0; - } - InsertChildPreamble( addThis ); - - if ( _firstChild ) { - TIXMLASSERT( _lastChild ); - TIXMLASSERT( _firstChild->_prev == 0 ); - - _firstChild->_prev = addThis; - addThis->_next = _firstChild; - _firstChild = addThis; - - addThis->_prev = 0; - } - else { - TIXMLASSERT( _lastChild == 0 ); - _firstChild = _lastChild = addThis; - - addThis->_prev = 0; - addThis->_next = 0; - } - addThis->_parent = this; - return addThis; -} - - -XMLNode* XMLNode::InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ) -{ - TIXMLASSERT( addThis ); - if ( addThis->_document != _document ) { - TIXMLASSERT( false ); - return 0; - } - - TIXMLASSERT( afterThis ); - - if ( afterThis->_parent != this ) { - TIXMLASSERT( false ); - return 0; - } - if ( afterThis == addThis ) { - // Current state: BeforeThis -> AddThis -> OneAfterAddThis - // Now AddThis must disappear from it's location and then - // reappear between BeforeThis and OneAfterAddThis. - // So just leave it where it is. - return addThis; - } - - if ( afterThis->_next == 0 ) { - // The last node or the only node. - return InsertEndChild( addThis ); - } - InsertChildPreamble( addThis ); - addThis->_prev = afterThis; - addThis->_next = afterThis->_next; - afterThis->_next->_prev = addThis; - afterThis->_next = addThis; - addThis->_parent = this; - return addThis; -} - - - - -const XMLElement* XMLNode::FirstChildElement( const char* name ) const -{ - for( const XMLNode* node = _firstChild; node; node = node->_next ) { - const XMLElement* element = node->ToElementWithName( name ); - if ( element ) { - return element; - } - } - return 0; -} - - -const XMLElement* XMLNode::LastChildElement( const char* name ) const -{ - for( const XMLNode* node = _lastChild; node; node = node->_prev ) { - const XMLElement* element = node->ToElementWithName( name ); - if ( element ) { - return element; - } - } - return 0; -} - - -const XMLElement* XMLNode::NextSiblingElement( const char* name ) const -{ - for( const XMLNode* node = _next; node; node = node->_next ) { - const XMLElement* element = node->ToElementWithName( name ); - if ( element ) { - return element; - } - } - return 0; -} - - -const XMLElement* XMLNode::PreviousSiblingElement( const char* name ) const -{ - for( const XMLNode* node = _prev; node; node = node->_prev ) { - const XMLElement* element = node->ToElementWithName( name ); - if ( element ) { - return element; - } - } - return 0; -} - - -char* XMLNode::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) -{ - // This is a recursive method, but thinking about it "at the current level" - // it is a pretty simple flat list: - // - // - // - // With a special case: - // - // - // - // - // Where the closing element (/foo) *must* be the next thing after the opening - // element, and the names must match. BUT the tricky bit is that the closing - // element will be read by the child. - // - // 'endTag' is the end tag for this node, it is returned by a call to a child. - // 'parentEnd' is the end tag for the parent, which is filled in and returned. - - XMLDocument::DepthTracker tracker(_document); - if (_document->Error()) - return 0; - - while( p && *p ) { - XMLNode* node = 0; - - p = _document->Identify( p, &node ); - TIXMLASSERT( p ); - if ( node == 0 ) { - break; - } - - const int initialLineNum = node->_parseLineNum; - - StrPair endTag; - p = node->ParseDeep( p, &endTag, curLineNumPtr ); - if ( !p ) { - DeleteNode( node ); - if ( !_document->Error() ) { - _document->SetError( XML_ERROR_PARSING, initialLineNum, 0); - } - break; - } - - const XMLDeclaration* const decl = node->ToDeclaration(); - if ( decl ) { - // Declarations are only allowed at document level - // - // Multiple declarations are allowed but all declarations - // must occur before anything else. - // - // Optimized due to a security test case. If the first node is - // a declaration, and the last node is a declaration, then only - // declarations have so far been added. - bool wellLocated = false; - - if (ToDocument()) { - if (FirstChild()) { - wellLocated = - FirstChild() && - FirstChild()->ToDeclaration() && - LastChild() && - LastChild()->ToDeclaration(); - } - else { - wellLocated = true; - } - } - if ( !wellLocated ) { - _document->SetError( XML_ERROR_PARSING_DECLARATION, initialLineNum, "XMLDeclaration value=%s", decl->Value()); - DeleteNode( node ); - break; - } - } - - XMLElement* ele = node->ToElement(); - if ( ele ) { - // We read the end tag. Return it to the parent. - if ( ele->ClosingType() == XMLElement::CLOSING ) { - if ( parentEndTag ) { - ele->_value.TransferTo( parentEndTag ); - } - node->_memPool->SetTracked(); // created and then immediately deleted. - DeleteNode( node ); - return p; - } - - // Handle an end tag returned to this level. - // And handle a bunch of annoying errors. - bool mismatch = false; - if ( endTag.Empty() ) { - if ( ele->ClosingType() == XMLElement::OPEN ) { - mismatch = true; - } - } - else { - if ( ele->ClosingType() != XMLElement::OPEN ) { - mismatch = true; - } - else if ( !XMLUtil::StringEqual( endTag.GetStr(), ele->Name() ) ) { - mismatch = true; - } - } - if ( mismatch ) { - _document->SetError( XML_ERROR_MISMATCHED_ELEMENT, initialLineNum, "XMLElement name=%s", ele->Name()); - DeleteNode( node ); - break; - } - } - InsertEndChild( node ); - } - return 0; -} - -/*static*/ void XMLNode::DeleteNode( XMLNode* node ) -{ - if ( node == 0 ) { - return; - } - TIXMLASSERT(node->_document); - if (!node->ToDocument()) { - node->_document->MarkInUse(node); - } - - MemPool* pool = node->_memPool; - node->~XMLNode(); - pool->Free( node ); -} - -void XMLNode::InsertChildPreamble( XMLNode* insertThis ) const -{ - TIXMLASSERT( insertThis ); - TIXMLASSERT( insertThis->_document == _document ); - - if (insertThis->_parent) { - insertThis->_parent->Unlink( insertThis ); - } - else { - insertThis->_document->MarkInUse(insertThis); - insertThis->_memPool->SetTracked(); - } -} - -const XMLElement* XMLNode::ToElementWithName( const char* name ) const -{ - const XMLElement* element = this->ToElement(); - if ( element == 0 ) { - return 0; - } - if ( name == 0 ) { - return element; - } - if ( XMLUtil::StringEqual( element->Name(), name ) ) { - return element; - } - return 0; -} - -// --------- XMLText ---------- // -char* XMLText::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) -{ - if ( this->CData() ) { - p = _value.ParseText( p, "]]>", StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); - if ( !p ) { - _document->SetError( XML_ERROR_PARSING_CDATA, _parseLineNum, 0 ); - } - return p; - } - else { - int flags = _document->ProcessEntities() ? StrPair::TEXT_ELEMENT : StrPair::TEXT_ELEMENT_LEAVE_ENTITIES; - if ( _document->WhitespaceMode() == COLLAPSE_WHITESPACE ) { - flags |= StrPair::NEEDS_WHITESPACE_COLLAPSING; - } - - p = _value.ParseText( p, "<", flags, curLineNumPtr ); - if ( p && *p ) { - return p-1; - } - if ( !p ) { - _document->SetError( XML_ERROR_PARSING_TEXT, _parseLineNum, 0 ); - } - } - return 0; -} - - -XMLNode* XMLText::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLText* text = doc->NewText( Value() ); // fixme: this will always allocate memory. Intern? - text->SetCData( this->CData() ); - return text; -} - - -bool XMLText::ShallowEqual( const XMLNode* compare ) const -{ - TIXMLASSERT( compare ); - const XMLText* text = compare->ToText(); - return ( text && XMLUtil::StringEqual( text->Value(), Value() ) ); -} - - -bool XMLText::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - return visitor->Visit( *this ); -} - - -// --------- XMLComment ---------- // - -XMLComment::XMLComment( XMLDocument* doc ) : XMLNode( doc ) -{ -} - - -XMLComment::~XMLComment() -{ -} - - -char* XMLComment::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) -{ - // Comment parses as text. - p = _value.ParseText( p, "-->", StrPair::COMMENT, curLineNumPtr ); - if ( p == 0 ) { - _document->SetError( XML_ERROR_PARSING_COMMENT, _parseLineNum, 0 ); - } - return p; -} - - -XMLNode* XMLComment::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLComment* comment = doc->NewComment( Value() ); // fixme: this will always allocate memory. Intern? - return comment; -} - - -bool XMLComment::ShallowEqual( const XMLNode* compare ) const -{ - TIXMLASSERT( compare ); - const XMLComment* comment = compare->ToComment(); - return ( comment && XMLUtil::StringEqual( comment->Value(), Value() )); -} - - -bool XMLComment::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - return visitor->Visit( *this ); -} - - -// --------- XMLDeclaration ---------- // - -XMLDeclaration::XMLDeclaration( XMLDocument* doc ) : XMLNode( doc ) -{ -} - - -XMLDeclaration::~XMLDeclaration() -{ - //printf( "~XMLDeclaration\n" ); -} - - -char* XMLDeclaration::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) -{ - // Declaration parses as text. - p = _value.ParseText( p, "?>", StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); - if ( p == 0 ) { - _document->SetError( XML_ERROR_PARSING_DECLARATION, _parseLineNum, 0 ); - } - return p; -} - - -XMLNode* XMLDeclaration::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLDeclaration* dec = doc->NewDeclaration( Value() ); // fixme: this will always allocate memory. Intern? - return dec; -} - - -bool XMLDeclaration::ShallowEqual( const XMLNode* compare ) const -{ - TIXMLASSERT( compare ); - const XMLDeclaration* declaration = compare->ToDeclaration(); - return ( declaration && XMLUtil::StringEqual( declaration->Value(), Value() )); -} - - - -bool XMLDeclaration::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - return visitor->Visit( *this ); -} - -// --------- XMLUnknown ---------- // - -XMLUnknown::XMLUnknown( XMLDocument* doc ) : XMLNode( doc ) -{ -} - - -XMLUnknown::~XMLUnknown() -{ -} - - -char* XMLUnknown::ParseDeep( char* p, StrPair*, int* curLineNumPtr ) -{ - // Unknown parses as text. - p = _value.ParseText( p, ">", StrPair::NEEDS_NEWLINE_NORMALIZATION, curLineNumPtr ); - if ( !p ) { - _document->SetError( XML_ERROR_PARSING_UNKNOWN, _parseLineNum, 0 ); - } - return p; -} - - -XMLNode* XMLUnknown::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLUnknown* text = doc->NewUnknown( Value() ); // fixme: this will always allocate memory. Intern? - return text; -} - - -bool XMLUnknown::ShallowEqual( const XMLNode* compare ) const -{ - TIXMLASSERT( compare ); - const XMLUnknown* unknown = compare->ToUnknown(); - return ( unknown && XMLUtil::StringEqual( unknown->Value(), Value() )); -} - - -bool XMLUnknown::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - return visitor->Visit( *this ); -} - -// --------- XMLAttribute ---------- // - -const char* XMLAttribute::Name() const -{ - return _name.GetStr(); -} - -const char* XMLAttribute::Value() const -{ - return _value.GetStr(); -} - -char* XMLAttribute::ParseDeep( char* p, bool processEntities, int* curLineNumPtr ) -{ - // Parse using the name rules: bug fix, was using ParseText before - p = _name.ParseName( p ); - if ( !p || !*p ) { - return 0; - } - - // Skip white space before = - p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); - if ( *p != '=' ) { - return 0; - } - - ++p; // move up to opening quote - p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); - if ( *p != '\"' && *p != '\'' ) { - return 0; - } - - const char endTag[2] = { *p, 0 }; - ++p; // move past opening quote - - p = _value.ParseText( p, endTag, processEntities ? StrPair::ATTRIBUTE_VALUE : StrPair::ATTRIBUTE_VALUE_LEAVE_ENTITIES, curLineNumPtr ); - return p; -} - - -void XMLAttribute::SetName( const char* n ) -{ - _name.SetStr( n ); -} - - -XMLError XMLAttribute::QueryIntValue( int* value ) const -{ - if ( XMLUtil::ToInt( Value(), value )) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryUnsignedValue( unsigned int* value ) const -{ - if ( XMLUtil::ToUnsigned( Value(), value )) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryInt64Value(int64_t* value) const -{ - if (XMLUtil::ToInt64(Value(), value)) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryUnsigned64Value(uint64_t* value) const -{ - if(XMLUtil::ToUnsigned64(Value(), value)) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryBoolValue( bool* value ) const -{ - if ( XMLUtil::ToBool( Value(), value )) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryFloatValue( float* value ) const -{ - if ( XMLUtil::ToFloat( Value(), value )) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -XMLError XMLAttribute::QueryDoubleValue( double* value ) const -{ - if ( XMLUtil::ToDouble( Value(), value )) { - return XML_SUCCESS; - } - return XML_WRONG_ATTRIBUTE_TYPE; -} - - -void XMLAttribute::SetAttribute( const char* v ) -{ - _value.SetStr( v ); -} - - -void XMLAttribute::SetAttribute( int v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - - -void XMLAttribute::SetAttribute( unsigned v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - - -void XMLAttribute::SetAttribute(int64_t v) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr(v, buf, BUF_SIZE); - _value.SetStr(buf); -} - -void XMLAttribute::SetAttribute(uint64_t v) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr(v, buf, BUF_SIZE); - _value.SetStr(buf); -} - - -void XMLAttribute::SetAttribute( bool v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - -void XMLAttribute::SetAttribute( double v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - -void XMLAttribute::SetAttribute( float v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - _value.SetStr( buf ); -} - - -// --------- XMLElement ---------- // -XMLElement::XMLElement( XMLDocument* doc ) : XMLNode( doc ), - _closingType( OPEN ), - _rootAttribute( 0 ) -{ -} - - -XMLElement::~XMLElement() -{ - while( _rootAttribute ) { - XMLAttribute* next = _rootAttribute->_next; - DeleteAttribute( _rootAttribute ); - _rootAttribute = next; - } -} - - -const XMLAttribute* XMLElement::FindAttribute( const char* name ) const -{ - for( XMLAttribute* a = _rootAttribute; a; a = a->_next ) { - if ( XMLUtil::StringEqual( a->Name(), name ) ) { - return a; - } - } - return 0; -} - - -const char* XMLElement::Attribute( const char* name, const char* value ) const -{ - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return 0; - } - if ( !value || XMLUtil::StringEqual( a->Value(), value )) { - return a->Value(); - } - return 0; -} - -int XMLElement::IntAttribute(const char* name, int defaultValue) const -{ - int i = defaultValue; - QueryIntAttribute(name, &i); - return i; -} - -unsigned XMLElement::UnsignedAttribute(const char* name, unsigned defaultValue) const -{ - unsigned i = defaultValue; - QueryUnsignedAttribute(name, &i); - return i; -} - -int64_t XMLElement::Int64Attribute(const char* name, int64_t defaultValue) const -{ - int64_t i = defaultValue; - QueryInt64Attribute(name, &i); - return i; -} - -uint64_t XMLElement::Unsigned64Attribute(const char* name, uint64_t defaultValue) const -{ - uint64_t i = defaultValue; - QueryUnsigned64Attribute(name, &i); - return i; -} - -bool XMLElement::BoolAttribute(const char* name, bool defaultValue) const -{ - bool b = defaultValue; - QueryBoolAttribute(name, &b); - return b; -} - -double XMLElement::DoubleAttribute(const char* name, double defaultValue) const -{ - double d = defaultValue; - QueryDoubleAttribute(name, &d); - return d; -} - -float XMLElement::FloatAttribute(const char* name, float defaultValue) const -{ - float f = defaultValue; - QueryFloatAttribute(name, &f); - return f; -} - -const char* XMLElement::GetText() const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - return FirstChild()->Value(); - } - return 0; -} - - -void XMLElement::SetText( const char* inText ) -{ - if ( FirstChild() && FirstChild()->ToText() ) - FirstChild()->SetValue( inText ); - else { - XMLText* theText = GetDocument()->NewText( inText ); - InsertFirstChild( theText ); - } -} - - -void XMLElement::SetText( int v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText( unsigned v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText(int64_t v) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr(v, buf, BUF_SIZE); - SetText(buf); -} - -void XMLElement::SetText(uint64_t v) { - char buf[BUF_SIZE]; - XMLUtil::ToStr(v, buf, BUF_SIZE); - SetText(buf); -} - - -void XMLElement::SetText( bool v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText( float v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -void XMLElement::SetText( double v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - SetText( buf ); -} - - -XMLError XMLElement::QueryIntText( int* ival ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->Value(); - if ( XMLUtil::ToInt( t, ival ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryUnsignedText( unsigned* uval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->Value(); - if ( XMLUtil::ToUnsigned( t, uval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryInt64Text(int64_t* ival) const -{ - if (FirstChild() && FirstChild()->ToText()) { - const char* t = FirstChild()->Value(); - if (XMLUtil::ToInt64(t, ival)) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryUnsigned64Text(uint64_t* ival) const -{ - if(FirstChild() && FirstChild()->ToText()) { - const char* t = FirstChild()->Value(); - if(XMLUtil::ToUnsigned64(t, ival)) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryBoolText( bool* bval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->Value(); - if ( XMLUtil::ToBool( t, bval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryDoubleText( double* dval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->Value(); - if ( XMLUtil::ToDouble( t, dval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - - -XMLError XMLElement::QueryFloatText( float* fval ) const -{ - if ( FirstChild() && FirstChild()->ToText() ) { - const char* t = FirstChild()->Value(); - if ( XMLUtil::ToFloat( t, fval ) ) { - return XML_SUCCESS; - } - return XML_CAN_NOT_CONVERT_TEXT; - } - return XML_NO_TEXT_NODE; -} - -int XMLElement::IntText(int defaultValue) const -{ - int i = defaultValue; - QueryIntText(&i); - return i; -} - -unsigned XMLElement::UnsignedText(unsigned defaultValue) const -{ - unsigned i = defaultValue; - QueryUnsignedText(&i); - return i; -} - -int64_t XMLElement::Int64Text(int64_t defaultValue) const -{ - int64_t i = defaultValue; - QueryInt64Text(&i); - return i; -} - -uint64_t XMLElement::Unsigned64Text(uint64_t defaultValue) const -{ - uint64_t i = defaultValue; - QueryUnsigned64Text(&i); - return i; -} - -bool XMLElement::BoolText(bool defaultValue) const -{ - bool b = defaultValue; - QueryBoolText(&b); - return b; -} - -double XMLElement::DoubleText(double defaultValue) const -{ - double d = defaultValue; - QueryDoubleText(&d); - return d; -} - -float XMLElement::FloatText(float defaultValue) const -{ - float f = defaultValue; - QueryFloatText(&f); - return f; -} - - -XMLAttribute* XMLElement::FindOrCreateAttribute( const char* name ) -{ - XMLAttribute* last = 0; - XMLAttribute* attrib = 0; - for( attrib = _rootAttribute; - attrib; - last = attrib, attrib = attrib->_next ) { - if ( XMLUtil::StringEqual( attrib->Name(), name ) ) { - break; - } - } - if ( !attrib ) { - attrib = CreateAttribute(); - TIXMLASSERT( attrib ); - if ( last ) { - TIXMLASSERT( last->_next == 0 ); - last->_next = attrib; - } - else { - TIXMLASSERT( _rootAttribute == 0 ); - _rootAttribute = attrib; - } - attrib->SetName( name ); - } - return attrib; -} - - -void XMLElement::DeleteAttribute( const char* name ) -{ - XMLAttribute* prev = 0; - for( XMLAttribute* a=_rootAttribute; a; a=a->_next ) { - if ( XMLUtil::StringEqual( name, a->Name() ) ) { - if ( prev ) { - prev->_next = a->_next; - } - else { - _rootAttribute = a->_next; - } - DeleteAttribute( a ); - break; - } - prev = a; - } -} - - -char* XMLElement::ParseAttributes( char* p, int* curLineNumPtr ) -{ - XMLAttribute* prevAttribute = 0; - - // Read the attributes. - while( p ) { - p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); - if ( !(*p) ) { - _document->SetError( XML_ERROR_PARSING_ELEMENT, _parseLineNum, "XMLElement name=%s", Name() ); - return 0; - } - - // attribute. - if (XMLUtil::IsNameStartChar( *p ) ) { - XMLAttribute* attrib = CreateAttribute(); - TIXMLASSERT( attrib ); - attrib->_parseLineNum = _document->_parseCurLineNum; - - const int attrLineNum = attrib->_parseLineNum; - - p = attrib->ParseDeep( p, _document->ProcessEntities(), curLineNumPtr ); - if ( !p || Attribute( attrib->Name() ) ) { - DeleteAttribute( attrib ); - _document->SetError( XML_ERROR_PARSING_ATTRIBUTE, attrLineNum, "XMLElement name=%s", Name() ); - return 0; - } - // There is a minor bug here: if the attribute in the source xml - // document is duplicated, it will not be detected and the - // attribute will be doubly added. However, tracking the 'prevAttribute' - // avoids re-scanning the attribute list. Preferring performance for - // now, may reconsider in the future. - if ( prevAttribute ) { - TIXMLASSERT( prevAttribute->_next == 0 ); - prevAttribute->_next = attrib; - } - else { - TIXMLASSERT( _rootAttribute == 0 ); - _rootAttribute = attrib; - } - prevAttribute = attrib; - } - // end of the tag - else if ( *p == '>' ) { - ++p; - break; - } - // end of the tag - else if ( *p == '/' && *(p+1) == '>' ) { - _closingType = CLOSED; - return p+2; // done; sealed element. - } - else { - _document->SetError( XML_ERROR_PARSING_ELEMENT, _parseLineNum, 0 ); - return 0; - } - } - return p; -} - -void XMLElement::DeleteAttribute( XMLAttribute* attribute ) -{ - if ( attribute == 0 ) { - return; - } - MemPool* pool = attribute->_memPool; - attribute->~XMLAttribute(); - pool->Free( attribute ); -} - -XMLAttribute* XMLElement::CreateAttribute() -{ - TIXMLASSERT( sizeof( XMLAttribute ) == _document->_attributePool.ItemSize() ); - XMLAttribute* attrib = new (_document->_attributePool.Alloc() ) XMLAttribute(); - TIXMLASSERT( attrib ); - attrib->_memPool = &_document->_attributePool; - attrib->_memPool->SetTracked(); - return attrib; -} - - -XMLElement* XMLElement::InsertNewChildElement(const char* name) -{ - XMLElement* node = _document->NewElement(name); - return InsertEndChild(node) ? node : 0; -} - -XMLComment* XMLElement::InsertNewComment(const char* comment) -{ - XMLComment* node = _document->NewComment(comment); - return InsertEndChild(node) ? node : 0; -} - -XMLText* XMLElement::InsertNewText(const char* text) -{ - XMLText* node = _document->NewText(text); - return InsertEndChild(node) ? node : 0; -} - -XMLDeclaration* XMLElement::InsertNewDeclaration(const char* text) -{ - XMLDeclaration* node = _document->NewDeclaration(text); - return InsertEndChild(node) ? node : 0; -} - -XMLUnknown* XMLElement::InsertNewUnknown(const char* text) -{ - XMLUnknown* node = _document->NewUnknown(text); - return InsertEndChild(node) ? node : 0; -} - - - -// -// -// foobar -// -char* XMLElement::ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ) -{ - // Read the element name. - p = XMLUtil::SkipWhiteSpace( p, curLineNumPtr ); - - // The closing element is the form. It is - // parsed just like a regular element then deleted from - // the DOM. - if ( *p == '/' ) { - _closingType = CLOSING; - ++p; - } - - p = _value.ParseName( p ); - if ( _value.Empty() ) { - return 0; - } - - p = ParseAttributes( p, curLineNumPtr ); - if ( !p || !*p || _closingType != OPEN ) { - return p; - } - - p = XMLNode::ParseDeep( p, parentEndTag, curLineNumPtr ); - return p; -} - - - -XMLNode* XMLElement::ShallowClone( XMLDocument* doc ) const -{ - if ( !doc ) { - doc = _document; - } - XMLElement* element = doc->NewElement( Value() ); // fixme: this will always allocate memory. Intern? - for( const XMLAttribute* a=FirstAttribute(); a; a=a->Next() ) { - element->SetAttribute( a->Name(), a->Value() ); // fixme: this will always allocate memory. Intern? - } - return element; -} - - -bool XMLElement::ShallowEqual( const XMLNode* compare ) const -{ - TIXMLASSERT( compare ); - const XMLElement* other = compare->ToElement(); - if ( other && XMLUtil::StringEqual( other->Name(), Name() )) { - - const XMLAttribute* a=FirstAttribute(); - const XMLAttribute* b=other->FirstAttribute(); - - while ( a && b ) { - if ( !XMLUtil::StringEqual( a->Value(), b->Value() ) ) { - return false; - } - a = a->Next(); - b = b->Next(); - } - if ( a || b ) { - // different count - return false; - } - return true; - } - return false; -} - - -bool XMLElement::Accept( XMLVisitor* visitor ) const -{ - TIXMLASSERT( visitor ); - if ( visitor->VisitEnter( *this, _rootAttribute ) ) { - for ( const XMLNode* node=FirstChild(); node; node=node->NextSibling() ) { - if ( !node->Accept( visitor ) ) { - break; - } - } - } - return visitor->VisitExit( *this ); -} - - -// --------- XMLDocument ----------- // - -// Warning: List must match 'enum XMLError' -const char* XMLDocument::_errorNames[XML_ERROR_COUNT] = { - "XML_SUCCESS", - "XML_NO_ATTRIBUTE", - "XML_WRONG_ATTRIBUTE_TYPE", - "XML_ERROR_FILE_NOT_FOUND", - "XML_ERROR_FILE_COULD_NOT_BE_OPENED", - "XML_ERROR_FILE_READ_ERROR", - "XML_ERROR_PARSING_ELEMENT", - "XML_ERROR_PARSING_ATTRIBUTE", - "XML_ERROR_PARSING_TEXT", - "XML_ERROR_PARSING_CDATA", - "XML_ERROR_PARSING_COMMENT", - "XML_ERROR_PARSING_DECLARATION", - "XML_ERROR_PARSING_UNKNOWN", - "XML_ERROR_EMPTY_DOCUMENT", - "XML_ERROR_MISMATCHED_ELEMENT", - "XML_ERROR_PARSING", - "XML_CAN_NOT_CONVERT_TEXT", - "XML_NO_TEXT_NODE", - "XML_ELEMENT_DEPTH_EXCEEDED" -}; - - -XMLDocument::XMLDocument( bool processEntities, Whitespace whitespaceMode ) : - XMLNode( 0 ), - _writeBOM( false ), - _processEntities( processEntities ), - _errorID(XML_SUCCESS), - _whitespaceMode( whitespaceMode ), - _errorStr(), - _errorLineNum( 0 ), - _charBuffer( 0 ), - _parseCurLineNum( 0 ), - _parsingDepth(0), - _unlinked(), - _elementPool(), - _attributePool(), - _textPool(), - _commentPool() -{ - // avoid VC++ C4355 warning about 'this' in initializer list (C4355 is off by default in VS2012+) - _document = this; -} - - -XMLDocument::~XMLDocument() -{ - Clear(); -} - - -void XMLDocument::MarkInUse(const XMLNode* const node) -{ - TIXMLASSERT(node); - TIXMLASSERT(node->_parent == 0); - - for (int i = 0; i < _unlinked.Size(); ++i) { - if (node == _unlinked[i]) { - _unlinked.SwapRemove(i); - break; - } - } -} - -void XMLDocument::Clear() -{ - DeleteChildren(); - while( _unlinked.Size()) { - DeleteNode(_unlinked[0]); // Will remove from _unlinked as part of delete. - } - -#ifdef TINYXML2_DEBUG - const bool hadError = Error(); -#endif - ClearError(); - - delete [] _charBuffer; - _charBuffer = 0; - _parsingDepth = 0; - -#if 0 - _textPool.Trace( "text" ); - _elementPool.Trace( "element" ); - _commentPool.Trace( "comment" ); - _attributePool.Trace( "attribute" ); -#endif - -#ifdef TINYXML2_DEBUG - if ( !hadError ) { - TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() ); - TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() ); - TIXMLASSERT( _textPool.CurrentAllocs() == _textPool.Untracked() ); - TIXMLASSERT( _commentPool.CurrentAllocs() == _commentPool.Untracked() ); - } -#endif -} - - -void XMLDocument::DeepCopy(XMLDocument* target) const -{ - TIXMLASSERT(target); - if (target == this) { - return; // technically success - a no-op. - } - - target->Clear(); - for (const XMLNode* node = this->FirstChild(); node; node = node->NextSibling()) { - target->InsertEndChild(node->DeepClone(target)); - } -} - -XMLElement* XMLDocument::NewElement( const char* name ) -{ - XMLElement* ele = CreateUnlinkedNode( _elementPool ); - ele->SetName( name ); - return ele; -} - - -XMLComment* XMLDocument::NewComment( const char* str ) -{ - XMLComment* comment = CreateUnlinkedNode( _commentPool ); - comment->SetValue( str ); - return comment; -} - - -XMLText* XMLDocument::NewText( const char* str ) -{ - XMLText* text = CreateUnlinkedNode( _textPool ); - text->SetValue( str ); - return text; -} - - -XMLDeclaration* XMLDocument::NewDeclaration( const char* str ) -{ - XMLDeclaration* dec = CreateUnlinkedNode( _commentPool ); - dec->SetValue( str ? str : "xml version=\"1.0\" encoding=\"UTF-8\"" ); - return dec; -} - - -XMLUnknown* XMLDocument::NewUnknown( const char* str ) -{ - XMLUnknown* unk = CreateUnlinkedNode( _commentPool ); - unk->SetValue( str ); - return unk; -} - -static FILE* callfopen( const char* filepath, const char* mode ) -{ - TIXMLASSERT( filepath ); - TIXMLASSERT( mode ); -#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && (!defined WINCE) - FILE* fp = 0; - const errno_t err = fopen_s( &fp, filepath, mode ); - if ( err ) { - return 0; - } -#else - FILE* fp = fopen( filepath, mode ); -#endif - return fp; -} - -void XMLDocument::DeleteNode( XMLNode* node ) { - TIXMLASSERT( node ); - TIXMLASSERT(node->_document == this ); - if (node->_parent) { - node->_parent->DeleteChild( node ); - } - else { - // Isn't in the tree. - // Use the parent delete. - // Also, we need to mark it tracked: we 'know' - // it was never used. - node->_memPool->SetTracked(); - // Call the static XMLNode version: - XMLNode::DeleteNode(node); - } -} - - -XMLError XMLDocument::LoadFile( const char* filename ) -{ - if ( !filename ) { - TIXMLASSERT( false ); - SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=" ); - return _errorID; - } - - Clear(); - FILE* fp = callfopen( filename, "rb" ); - if ( !fp ) { - SetError( XML_ERROR_FILE_NOT_FOUND, 0, "filename=%s", filename ); - return _errorID; - } - LoadFile( fp ); - fclose( fp ); - return _errorID; -} - -// This is likely overengineered template art to have a check that unsigned long value incremented -// by one still fits into size_t. If size_t type is larger than unsigned long type -// (x86_64-w64-mingw32 target) then the check is redundant and gcc and clang emit -// -Wtype-limits warning. This piece makes the compiler select code with a check when a check -// is useful and code with no check when a check is redundant depending on how size_t and unsigned long -// types sizes relate to each other. -template -= sizeof(size_t))> -struct LongFitsIntoSizeTMinusOne { - static bool Fits( unsigned long value ) - { - return value < static_cast(-1); - } -}; - -template <> -struct LongFitsIntoSizeTMinusOne { - static bool Fits( unsigned long ) - { - return true; - } -}; - -XMLError XMLDocument::LoadFile( FILE* fp ) -{ - Clear(); - - fseek( fp, 0, SEEK_SET ); - if ( fgetc( fp ) == EOF && ferror( fp ) != 0 ) { - SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); - return _errorID; - } - - fseek( fp, 0, SEEK_END ); - const long filelength = ftell( fp ); - fseek( fp, 0, SEEK_SET ); - if ( filelength == -1L ) { - SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); - return _errorID; - } - TIXMLASSERT( filelength >= 0 ); - - if ( !LongFitsIntoSizeTMinusOne<>::Fits( filelength ) ) { - // Cannot handle files which won't fit in buffer together with null terminator - SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); - return _errorID; - } - - if ( filelength == 0 ) { - SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); - return _errorID; - } - - const size_t size = filelength; - TIXMLASSERT( _charBuffer == 0 ); - _charBuffer = new char[size+1]; - const size_t read = fread( _charBuffer, 1, size, fp ); - if ( read != size ) { - SetError( XML_ERROR_FILE_READ_ERROR, 0, 0 ); - return _errorID; - } - - _charBuffer[size] = 0; - - Parse(); - return _errorID; -} - - -XMLError XMLDocument::SaveFile( const char* filename, bool compact ) -{ - if ( !filename ) { - TIXMLASSERT( false ); - SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=" ); - return _errorID; - } - - FILE* fp = callfopen( filename, "w" ); - if ( !fp ) { - SetError( XML_ERROR_FILE_COULD_NOT_BE_OPENED, 0, "filename=%s", filename ); - return _errorID; - } - SaveFile(fp, compact); - fclose( fp ); - return _errorID; -} - - -XMLError XMLDocument::SaveFile( FILE* fp, bool compact ) -{ - // Clear any error from the last save, otherwise it will get reported - // for *this* call. - ClearError(); - XMLPrinter stream( fp, compact ); - Print( &stream ); - return _errorID; -} - - -XMLError XMLDocument::Parse( const char* p, size_t len ) -{ - Clear(); - - if ( len == 0 || !p || !*p ) { - SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); - return _errorID; - } - if ( len == static_cast(-1) ) { - len = strlen( p ); - } - TIXMLASSERT( _charBuffer == 0 ); - _charBuffer = new char[ len+1 ]; - memcpy( _charBuffer, p, len ); - _charBuffer[len] = 0; - - Parse(); - if ( Error() ) { - // clean up now essentially dangling memory. - // and the parse fail can put objects in the - // pools that are dead and inaccessible. - DeleteChildren(); - _elementPool.Clear(); - _attributePool.Clear(); - _textPool.Clear(); - _commentPool.Clear(); - } - return _errorID; -} - - -void XMLDocument::Print( XMLPrinter* streamer ) const -{ - if ( streamer ) { - Accept( streamer ); - } - else { - XMLPrinter stdoutStreamer( stdout ); - Accept( &stdoutStreamer ); - } -} - - -void XMLDocument::SetError( XMLError error, int lineNum, const char* format, ... ) -{ - TIXMLASSERT( error >= 0 && error < XML_ERROR_COUNT ); - _errorID = error; - _errorLineNum = lineNum; - _errorStr.Reset(); - - const size_t BUFFER_SIZE = 1000; - char* buffer = new char[BUFFER_SIZE]; - - TIXMLASSERT(sizeof(error) <= sizeof(int)); - TIXML_SNPRINTF(buffer, BUFFER_SIZE, "Error=%s ErrorID=%d (0x%x) Line number=%d", ErrorIDToName(error), int(error), int(error), lineNum); - - if (format) { - size_t len = strlen(buffer); - TIXML_SNPRINTF(buffer + len, BUFFER_SIZE - len, ": "); - len = strlen(buffer); - - va_list va; - va_start(va, format); - TIXML_VSNPRINTF(buffer + len, BUFFER_SIZE - len, format, va); - va_end(va); - } - _errorStr.SetStr(buffer); - delete[] buffer; -} - - -/*static*/ const char* XMLDocument::ErrorIDToName(XMLError errorID) -{ - TIXMLASSERT( errorID >= 0 && errorID < XML_ERROR_COUNT ); - const char* errorName = _errorNames[errorID]; - TIXMLASSERT( errorName && errorName[0] ); - return errorName; -} - -const char* XMLDocument::ErrorStr() const -{ - return _errorStr.Empty() ? "" : _errorStr.GetStr(); -} - - -void XMLDocument::PrintError() const -{ - printf("%s\n", ErrorStr()); -} - -const char* XMLDocument::ErrorName() const -{ - return ErrorIDToName(_errorID); -} - -void XMLDocument::Parse() -{ - TIXMLASSERT( NoChildren() ); // Clear() must have been called previously - TIXMLASSERT( _charBuffer ); - _parseCurLineNum = 1; - _parseLineNum = 1; - char* p = _charBuffer; - p = XMLUtil::SkipWhiteSpace( p, &_parseCurLineNum ); - p = const_cast( XMLUtil::ReadBOM( p, &_writeBOM ) ); - if ( !*p ) { - SetError( XML_ERROR_EMPTY_DOCUMENT, 0, 0 ); - return; - } - ParseDeep(p, 0, &_parseCurLineNum ); -} - -void XMLDocument::PushDepth() -{ - _parsingDepth++; - if (_parsingDepth == TINYXML2_MAX_ELEMENT_DEPTH) { - SetError(XML_ELEMENT_DEPTH_EXCEEDED, _parseCurLineNum, "Element nesting is too deep." ); - } -} - -void XMLDocument::PopDepth() -{ - TIXMLASSERT(_parsingDepth > 0); - --_parsingDepth; -} - -XMLPrinter::XMLPrinter( FILE* file, bool compact, int depth ) : - _elementJustOpened( false ), - _stack(), - _firstElement( true ), - _fp( file ), - _depth( depth ), - _textDepth( -1 ), - _processEntities( true ), - _compactMode( compact ), - _buffer() -{ - for( int i=0; i(entityValue); - TIXMLASSERT( flagIndex < ENTITY_RANGE ); - _entityFlag[flagIndex] = true; - } - _restrictedEntityFlag[static_cast('&')] = true; - _restrictedEntityFlag[static_cast('<')] = true; - _restrictedEntityFlag[static_cast('>')] = true; // not required, but consistency is nice - _buffer.Push( 0 ); -} - - -void XMLPrinter::Print( const char* format, ... ) -{ - va_list va; - va_start( va, format ); - - if ( _fp ) { - vfprintf( _fp, format, va ); - } - else { - const int len = TIXML_VSCPRINTF( format, va ); - // Close out and re-start the va-args - va_end( va ); - TIXMLASSERT( len >= 0 ); - va_start( va, format ); - TIXMLASSERT( _buffer.Size() > 0 && _buffer[_buffer.Size() - 1] == 0 ); - char* p = _buffer.PushArr( len ) - 1; // back up over the null terminator. - TIXML_VSNPRINTF( p, len+1, format, va ); - } - va_end( va ); -} - - -void XMLPrinter::Write( const char* data, size_t size ) -{ - if ( _fp ) { - fwrite ( data , sizeof(char), size, _fp); - } - else { - char* p = _buffer.PushArr( static_cast(size) ) - 1; // back up over the null terminator. - memcpy( p, data, size ); - p[size] = 0; - } -} - - -void XMLPrinter::Putc( char ch ) -{ - if ( _fp ) { - fputc ( ch, _fp); - } - else { - char* p = _buffer.PushArr( sizeof(char) ) - 1; // back up over the null terminator. - p[0] = ch; - p[1] = 0; - } -} - - -void XMLPrinter::PrintSpace( int depth ) -{ - for( int i=0; i 0 && *q < ENTITY_RANGE ) { - // Check for entities. If one is found, flush - // the stream up until the entity, write the - // entity, and keep looking. - if ( flag[static_cast(*q)] ) { - while ( p < q ) { - const size_t delta = q - p; - const int toPrint = ( INT_MAX < delta ) ? INT_MAX : static_cast(delta); - Write( p, toPrint ); - p += toPrint; - } - bool entityPatternPrinted = false; - for( int i=0; i(delta); - Write( p, toPrint ); - } - } - else { - Write( p ); - } -} - - -void XMLPrinter::PushHeader( bool writeBOM, bool writeDec ) -{ - if ( writeBOM ) { - static const unsigned char bom[] = { TIXML_UTF_LEAD_0, TIXML_UTF_LEAD_1, TIXML_UTF_LEAD_2, 0 }; - Write( reinterpret_cast< const char* >( bom ) ); - } - if ( writeDec ) { - PushDeclaration( "xml version=\"1.0\"" ); - } -} - - -void XMLPrinter::OpenElement( const char* name, bool compactMode ) -{ - SealElementIfJustOpened(); - _stack.Push( name ); - - if ( _textDepth < 0 && !_firstElement && !compactMode ) { - Putc( '\n' ); - PrintSpace( _depth ); - } - - Write ( "<" ); - Write ( name ); - - _elementJustOpened = true; - _firstElement = false; - ++_depth; -} - - -void XMLPrinter::PushAttribute( const char* name, const char* value ) -{ - TIXMLASSERT( _elementJustOpened ); - Putc ( ' ' ); - Write( name ); - Write( "=\"" ); - PrintString( value, false ); - Putc ( '\"' ); -} - - -void XMLPrinter::PushAttribute( const char* name, int v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::PushAttribute( const char* name, unsigned v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::PushAttribute(const char* name, int64_t v) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr(v, buf, BUF_SIZE); - PushAttribute(name, buf); -} - - -void XMLPrinter::PushAttribute(const char* name, uint64_t v) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr(v, buf, BUF_SIZE); - PushAttribute(name, buf); -} - - -void XMLPrinter::PushAttribute( const char* name, bool v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::PushAttribute( const char* name, double v ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( v, buf, BUF_SIZE ); - PushAttribute( name, buf ); -} - - -void XMLPrinter::CloseElement( bool compactMode ) -{ - --_depth; - const char* name = _stack.Pop(); - - if ( _elementJustOpened ) { - Write( "/>" ); - } - else { - if ( _textDepth < 0 && !compactMode) { - Putc( '\n' ); - PrintSpace( _depth ); - } - Write ( "" ); - } - - if ( _textDepth == _depth ) { - _textDepth = -1; - } - if ( _depth == 0 && !compactMode) { - Putc( '\n' ); - } - _elementJustOpened = false; -} - - -void XMLPrinter::SealElementIfJustOpened() -{ - if ( !_elementJustOpened ) { - return; - } - _elementJustOpened = false; - Putc( '>' ); -} - - -void XMLPrinter::PushText( const char* text, bool cdata ) -{ - _textDepth = _depth-1; - - SealElementIfJustOpened(); - if ( cdata ) { - Write( "" ); - } - else { - PrintString( text, true ); - } -} - - -void XMLPrinter::PushText( int64_t value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( uint64_t value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr(value, buf, BUF_SIZE); - PushText(buf, false); -} - - -void XMLPrinter::PushText( int value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( unsigned value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( bool value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( float value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushText( double value ) -{ - char buf[BUF_SIZE]; - XMLUtil::ToStr( value, buf, BUF_SIZE ); - PushText( buf, false ); -} - - -void XMLPrinter::PushComment( const char* comment ) -{ - SealElementIfJustOpened(); - if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Putc( '\n' ); - PrintSpace( _depth ); - } - _firstElement = false; - - Write( "" ); -} - - -void XMLPrinter::PushDeclaration( const char* value ) -{ - SealElementIfJustOpened(); - if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Putc( '\n' ); - PrintSpace( _depth ); - } - _firstElement = false; - - Write( "" ); -} - - -void XMLPrinter::PushUnknown( const char* value ) -{ - SealElementIfJustOpened(); - if ( _textDepth < 0 && !_firstElement && !_compactMode) { - Putc( '\n' ); - PrintSpace( _depth ); - } - _firstElement = false; - - Write( "' ); -} - - -bool XMLPrinter::VisitEnter( const XMLDocument& doc ) -{ - _processEntities = doc.ProcessEntities(); - if ( doc.HasBOM() ) { - PushHeader( true, false ); - } - return true; -} - - -bool XMLPrinter::VisitEnter( const XMLElement& element, const XMLAttribute* attribute ) -{ - const XMLElement* parentElem = 0; - if ( element.Parent() ) { - parentElem = element.Parent()->ToElement(); - } - const bool compactMode = parentElem ? CompactMode( *parentElem ) : _compactMode; - OpenElement( element.Name(), compactMode ); - while ( attribute ) { - PushAttribute( attribute->Name(), attribute->Value() ); - attribute = attribute->Next(); - } - return true; -} - - -bool XMLPrinter::VisitExit( const XMLElement& element ) -{ - CloseElement( CompactMode(element) ); - return true; -} - - -bool XMLPrinter::Visit( const XMLText& text ) -{ - PushText( text.Value(), text.CData() ); - return true; -} - - -bool XMLPrinter::Visit( const XMLComment& comment ) -{ - PushComment( comment.Value() ); - return true; -} - -bool XMLPrinter::Visit( const XMLDeclaration& declaration ) -{ - PushDeclaration( declaration.Value() ); - return true; -} - - -bool XMLPrinter::Visit( const XMLUnknown& unknown ) -{ - PushUnknown( unknown.Value() ); - return true; -} - -} // namespace tinyxml2 diff --git a/soh/soh/Enhancements/randomizer/3drando/tinyxml2.h b/soh/soh/Enhancements/randomizer/3drando/tinyxml2.h deleted file mode 100644 index 093de69bf..000000000 --- a/soh/soh/Enhancements/randomizer/3drando/tinyxml2.h +++ /dev/null @@ -1,2365 +0,0 @@ -/* -Original code by Lee Thomason (www.grinninglizard.com) - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any -damages arising from the use of this software. - -Permission is granted to anyone to use this software for any -purpose, including commercial applications, and to alter it and -redistribute it freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must -not claim that you wrote the original software. If you use this -software in a product, an acknowledgment in the product documentation -would be appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and -must not be misrepresented as being the original software. - -3. This notice may not be removed or altered from any source -distribution. -*/ - -#ifndef TINYXML2_INCLUDED -#define TINYXML2_INCLUDED - -#if defined(ANDROID_NDK) || defined(__BORLANDC__) || defined(__QNXNTO__) -# include -# include -# include -# include -# include -# if defined(__PS3__) -# include -# endif -#else -# include -# include -# include -# include -# include -#endif -#include - -/* - TODO: intern strings instead of allocation. -*/ -/* - gcc: - g++ -Wall -DTINYXML2_DEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe - - Formatting, Artistic Style: - AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h -*/ - -#if defined( _DEBUG ) || defined (__DEBUG__) -# ifndef TINYXML2_DEBUG -# define TINYXML2_DEBUG -# endif -#endif - -#ifdef _MSC_VER -# pragma warning(push) -# pragma warning(disable: 4251) -#endif - -#ifdef _WIN32 -# ifdef TINYXML2_EXPORT -# define TINYXML2_LIB __declspec(dllexport) -# elif defined(TINYXML2_IMPORT) -# define TINYXML2_LIB __declspec(dllimport) -# else -# define TINYXML2_LIB -# endif -#elif __GNUC__ >= 4 -# define TINYXML2_LIB __attribute__((visibility("default"))) -#else -# define TINYXML2_LIB -#endif - - -#if defined(TINYXML2_DEBUG) -# if defined(_MSC_VER) -# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like -# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); } -# elif defined (ANDROID_NDK) -# include -# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); } -# else -# include -# define TIXMLASSERT assert -# endif -#else -# define TIXMLASSERT( x ) {} -#endif - - -/* Versioning, past 1.0.14: - http://semver.org/ -*/ -static const int TIXML2_MAJOR_VERSION = 8; -static const int TIXML2_MINOR_VERSION = 0; -static const int TIXML2_PATCH_VERSION = 0; - -#define TINYXML2_MAJOR_VERSION 8 -#define TINYXML2_MINOR_VERSION 0 -#define TINYXML2_PATCH_VERSION 0 - -// A fixed element depth limit is problematic. There needs to be a -// limit to avoid a stack overflow. However, that limit varies per -// system, and the capacity of the stack. On the other hand, it's a trivial -// attack that can result from ill, malicious, or even correctly formed XML, -// so there needs to be a limit in place. -static const int TINYXML2_MAX_ELEMENT_DEPTH = 100; - -namespace tinyxml2 -{ -class XMLDocument; -class XMLElement; -class XMLAttribute; -class XMLComment; -class XMLText; -class XMLDeclaration; -class XMLUnknown; -class XMLPrinter; - -/* - A class that wraps strings. Normally stores the start and end - pointers into the XML file itself, and will apply normalization - and entity translation if actually read. Can also store (and memory - manage) a traditional char[] - - Isn't clear why TINYXML2_LIB is needed; but seems to fix #719 -*/ -class TINYXML2_LIB StrPair -{ -public: - enum { - NEEDS_ENTITY_PROCESSING = 0x01, - NEEDS_NEWLINE_NORMALIZATION = 0x02, - NEEDS_WHITESPACE_COLLAPSING = 0x04, - - TEXT_ELEMENT = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, - TEXT_ELEMENT_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, - ATTRIBUTE_NAME = 0, - ATTRIBUTE_VALUE = NEEDS_ENTITY_PROCESSING | NEEDS_NEWLINE_NORMALIZATION, - ATTRIBUTE_VALUE_LEAVE_ENTITIES = NEEDS_NEWLINE_NORMALIZATION, - COMMENT = NEEDS_NEWLINE_NORMALIZATION - }; - - StrPair() : _flags( 0 ), _start( 0 ), _end( 0 ) {} - ~StrPair(); - - void Set( char* start, char* end, int flags ) { - TIXMLASSERT( start ); - TIXMLASSERT( end ); - Reset(); - _start = start; - _end = end; - _flags = flags | NEEDS_FLUSH; - } - - const char* GetStr(); - - bool Empty() const { - return _start == _end; - } - - void SetInternedStr( const char* str ) { - Reset(); - _start = const_cast(str); - } - - void SetStr( const char* str, int flags=0 ); - - char* ParseText( char* in, const char* endTag, int strFlags, int* curLineNumPtr ); - char* ParseName( char* in ); - - void TransferTo( StrPair* other ); - void Reset(); - -private: - void CollapseWhitespace(); - - enum { - NEEDS_FLUSH = 0x100, - NEEDS_DELETE = 0x200 - }; - - int _flags; - char* _start; - char* _end; - - StrPair( const StrPair& other ); // not supported - void operator=( const StrPair& other ); // not supported, use TransferTo() -}; - - -/* - A dynamic array of Plain Old Data. Doesn't support constructors, etc. - Has a small initial memory pool, so that low or no usage will not - cause a call to new/delete -*/ -template -class DynArray -{ -public: - DynArray() : - _mem( _pool ), - _allocated( INITIAL_SIZE ), - _size( 0 ) - { - } - - ~DynArray() { - if ( _mem != _pool ) { - delete [] _mem; - } - } - - void Clear() { - _size = 0; - } - - void Push( T t ) { - TIXMLASSERT( _size < INT_MAX ); - EnsureCapacity( _size+1 ); - _mem[_size] = t; - ++_size; - } - - T* PushArr( int count ) { - TIXMLASSERT( count >= 0 ); - TIXMLASSERT( _size <= INT_MAX - count ); - EnsureCapacity( _size+count ); - T* ret = &_mem[_size]; - _size += count; - return ret; - } - - T Pop() { - TIXMLASSERT( _size > 0 ); - --_size; - return _mem[_size]; - } - - void PopArr( int count ) { - TIXMLASSERT( _size >= count ); - _size -= count; - } - - bool Empty() const { - return _size == 0; - } - - T& operator[](int i) { - TIXMLASSERT( i>= 0 && i < _size ); - return _mem[i]; - } - - const T& operator[](int i) const { - TIXMLASSERT( i>= 0 && i < _size ); - return _mem[i]; - } - - const T& PeekTop() const { - TIXMLASSERT( _size > 0 ); - return _mem[ _size - 1]; - } - - int Size() const { - TIXMLASSERT( _size >= 0 ); - return _size; - } - - int Capacity() const { - TIXMLASSERT( _allocated >= INITIAL_SIZE ); - return _allocated; - } - - void SwapRemove(int i) { - TIXMLASSERT(i >= 0 && i < _size); - TIXMLASSERT(_size > 0); - _mem[i] = _mem[_size - 1]; - --_size; - } - - const T* Mem() const { - TIXMLASSERT( _mem ); - return _mem; - } - - T* Mem() { - TIXMLASSERT( _mem ); - return _mem; - } - -private: - DynArray( const DynArray& ); // not supported - void operator=( const DynArray& ); // not supported - - void EnsureCapacity( int cap ) { - TIXMLASSERT( cap > 0 ); - if ( cap > _allocated ) { - TIXMLASSERT( cap <= INT_MAX / 2 ); - const int newAllocated = cap * 2; - T* newMem = new T[newAllocated]; - TIXMLASSERT( newAllocated >= _size ); - memcpy( newMem, _mem, sizeof(T)*_size ); // warning: not using constructors, only works for PODs - if ( _mem != _pool ) { - delete [] _mem; - } - _mem = newMem; - _allocated = newAllocated; - } - } - - T* _mem; - T _pool[INITIAL_SIZE]; - int _allocated; // objects allocated - int _size; // number objects in use -}; - - -/* - Parent virtual class of a pool for fast allocation - and deallocation of objects. -*/ -class MemPool -{ -public: - MemPool() {} - virtual ~MemPool() {} - - virtual int ItemSize() const = 0; - virtual void* Alloc() = 0; - virtual void Free( void* ) = 0; - virtual void SetTracked() = 0; -}; - - -/* - Template child class to create pools of the correct type. -*/ -template< int ITEM_SIZE > -class MemPoolT : public MemPool -{ -public: - MemPoolT() : _blockPtrs(), _root(0), _currentAllocs(0), _nAllocs(0), _maxAllocs(0), _nUntracked(0) {} - ~MemPoolT() { - MemPoolT< ITEM_SIZE >::Clear(); - } - - void Clear() { - // Delete the blocks. - while( !_blockPtrs.Empty()) { - Block* lastBlock = _blockPtrs.Pop(); - delete lastBlock; - } - _root = 0; - _currentAllocs = 0; - _nAllocs = 0; - _maxAllocs = 0; - _nUntracked = 0; - } - - virtual int ItemSize() const { - return ITEM_SIZE; - } - int CurrentAllocs() const { - return _currentAllocs; - } - - virtual void* Alloc() { - if ( !_root ) { - // Need a new block. - Block* block = new Block(); - _blockPtrs.Push( block ); - - Item* blockItems = block->items; - for( int i = 0; i < ITEMS_PER_BLOCK - 1; ++i ) { - blockItems[i].next = &(blockItems[i + 1]); - } - blockItems[ITEMS_PER_BLOCK - 1].next = 0; - _root = blockItems; - } - Item* const result = _root; - TIXMLASSERT( result != 0 ); - _root = _root->next; - - ++_currentAllocs; - if ( _currentAllocs > _maxAllocs ) { - _maxAllocs = _currentAllocs; - } - ++_nAllocs; - ++_nUntracked; - return result; - } - - virtual void Free( void* mem ) { - if ( !mem ) { - return; - } - --_currentAllocs; - Item* item = static_cast( mem ); -#ifdef TINYXML2_DEBUG - memset( item, 0xfe, sizeof( *item ) ); -#endif - item->next = _root; - _root = item; - } - void Trace( const char* name ) { - printf( "Mempool %s watermark=%d [%dk] current=%d size=%d nAlloc=%d blocks=%d\n", - name, _maxAllocs, _maxAllocs * ITEM_SIZE / 1024, _currentAllocs, - ITEM_SIZE, _nAllocs, _blockPtrs.Size() ); - } - - void SetTracked() { - --_nUntracked; - } - - int Untracked() const { - return _nUntracked; - } - - // This number is perf sensitive. 4k seems like a good tradeoff on my machine. - // The test file is large, 170k. - // Release: VS2010 gcc(no opt) - // 1k: 4000 - // 2k: 4000 - // 4k: 3900 21000 - // 16k: 5200 - // 32k: 4300 - // 64k: 4000 21000 - // Declared public because some compilers do not accept to use ITEMS_PER_BLOCK - // in private part if ITEMS_PER_BLOCK is private - enum { ITEMS_PER_BLOCK = (4 * 1024) / ITEM_SIZE }; - -private: - MemPoolT( const MemPoolT& ); // not supported - void operator=( const MemPoolT& ); // not supported - - union Item { - Item* next; - char itemData[ITEM_SIZE]; - }; - struct Block { - Item items[ITEMS_PER_BLOCK]; - }; - DynArray< Block*, 10 > _blockPtrs; - Item* _root; - - int _currentAllocs; - int _nAllocs; - int _maxAllocs; - int _nUntracked; -}; - - - -/** - Implements the interface to the "Visitor pattern" (see the Accept() method.) - If you call the Accept() method, it requires being passed a XMLVisitor - class to handle callbacks. For nodes that contain other nodes (Document, Element) - you will get called with a VisitEnter/VisitExit pair. Nodes that are always leafs - are simply called with Visit(). - - If you return 'true' from a Visit method, recursive parsing will continue. If you return - false, no children of this node or its siblings will be visited. - - All flavors of Visit methods have a default implementation that returns 'true' (continue - visiting). You need to only override methods that are interesting to you. - - Generally Accept() is called on the XMLDocument, although all nodes support visiting. - - You should never change the document from a callback. - - @sa XMLNode::Accept() -*/ -class TINYXML2_LIB XMLVisitor -{ -public: - virtual ~XMLVisitor() {} - - /// Visit a document. - virtual bool VisitEnter( const XMLDocument& /*doc*/ ) { - return true; - } - /// Visit a document. - virtual bool VisitExit( const XMLDocument& /*doc*/ ) { - return true; - } - - /// Visit an element. - virtual bool VisitEnter( const XMLElement& /*element*/, const XMLAttribute* /*firstAttribute*/ ) { - return true; - } - /// Visit an element. - virtual bool VisitExit( const XMLElement& /*element*/ ) { - return true; - } - - /// Visit a declaration. - virtual bool Visit( const XMLDeclaration& /*declaration*/ ) { - return true; - } - /// Visit a text node. - virtual bool Visit( const XMLText& /*text*/ ) { - return true; - } - /// Visit a comment node. - virtual bool Visit( const XMLComment& /*comment*/ ) { - return true; - } - /// Visit an unknown node. - virtual bool Visit( const XMLUnknown& /*unknown*/ ) { - return true; - } -}; - -// WARNING: must match XMLDocument::_errorNames[] -enum XMLError { - XML_SUCCESS = 0, - XML_NO_ATTRIBUTE, - XML_WRONG_ATTRIBUTE_TYPE, - XML_ERROR_FILE_NOT_FOUND, - XML_ERROR_FILE_COULD_NOT_BE_OPENED, - XML_ERROR_FILE_READ_ERROR, - XML_ERROR_PARSING_ELEMENT, - XML_ERROR_PARSING_ATTRIBUTE, - XML_ERROR_PARSING_TEXT, - XML_ERROR_PARSING_CDATA, - XML_ERROR_PARSING_COMMENT, - XML_ERROR_PARSING_DECLARATION, - XML_ERROR_PARSING_UNKNOWN, - XML_ERROR_EMPTY_DOCUMENT, - XML_ERROR_MISMATCHED_ELEMENT, - XML_ERROR_PARSING, - XML_CAN_NOT_CONVERT_TEXT, - XML_NO_TEXT_NODE, - XML_ELEMENT_DEPTH_EXCEEDED, - - XML_ERROR_COUNT -}; - - -/* - Utility functionality. -*/ -class TINYXML2_LIB XMLUtil -{ -public: - static const char* SkipWhiteSpace( const char* p, int* curLineNumPtr ) { - TIXMLASSERT( p ); - - while( IsWhiteSpace(*p) ) { - if (curLineNumPtr && *p == '\n') { - ++(*curLineNumPtr); - } - ++p; - } - TIXMLASSERT( p ); - return p; - } - static char* SkipWhiteSpace( char* const p, int* curLineNumPtr ) { - return const_cast( SkipWhiteSpace( const_cast(p), curLineNumPtr ) ); - } - - // Anything in the high order range of UTF-8 is assumed to not be whitespace. This isn't - // correct, but simple, and usually works. - static bool IsWhiteSpace( char p ) { - return !IsUTF8Continuation(p) && isspace( static_cast(p) ); - } - - inline static bool IsNameStartChar( unsigned char ch ) { - if ( ch >= 128 ) { - // This is a heuristic guess in attempt to not implement Unicode-aware isalpha() - return true; - } - if ( isalpha( ch ) ) { - return true; - } - return ch == ':' || ch == '_'; - } - - inline static bool IsNameChar( unsigned char ch ) { - return IsNameStartChar( ch ) - || isdigit( ch ) - || ch == '.' - || ch == '-'; - } - - inline static bool StringEqual( const char* p, const char* q, int nChar=INT_MAX ) { - if ( p == q ) { - return true; - } - TIXMLASSERT( p ); - TIXMLASSERT( q ); - TIXMLASSERT( nChar >= 0 ); - return strncmp( p, q, nChar ) == 0; - } - - inline static bool IsUTF8Continuation( const char p ) { - return ( p & 0x80 ) != 0; - } - - static const char* ReadBOM( const char* p, bool* hasBOM ); - // p is the starting location, - // the UTF-8 value of the entity will be placed in value, and length filled in. - static const char* GetCharacterRef( const char* p, char* value, int* length ); - static void ConvertUTF32ToUTF8( unsigned long input, char* output, int* length ); - - // converts primitive types to strings - static void ToStr( int v, char* buffer, int bufferSize ); - static void ToStr( unsigned v, char* buffer, int bufferSize ); - static void ToStr( bool v, char* buffer, int bufferSize ); - static void ToStr( float v, char* buffer, int bufferSize ); - static void ToStr( double v, char* buffer, int bufferSize ); - static void ToStr(int64_t v, char* buffer, int bufferSize); - static void ToStr(uint64_t v, char* buffer, int bufferSize); - - // converts strings to primitive types - static bool ToInt( const char* str, int* value ); - static bool ToUnsigned( const char* str, unsigned* value ); - static bool ToBool( const char* str, bool* value ); - static bool ToFloat( const char* str, float* value ); - static bool ToDouble( const char* str, double* value ); - static bool ToInt64(const char* str, int64_t* value); - static bool ToUnsigned64(const char* str, uint64_t* value); - // Changes what is serialized for a boolean value. - // Default to "true" and "false". Shouldn't be changed - // unless you have a special testing or compatibility need. - // Be careful: static, global, & not thread safe. - // Be sure to set static const memory as parameters. - static void SetBoolSerialization(const char* writeTrue, const char* writeFalse); - -private: - static const char* writeBoolTrue; - static const char* writeBoolFalse; -}; - - -/** XMLNode is a base class for every object that is in the - XML Document Object Model (DOM), except XMLAttributes. - Nodes have siblings, a parent, and children which can - be navigated. A node is always in a XMLDocument. - The type of a XMLNode can be queried, and it can - be cast to its more defined type. - - A XMLDocument allocates memory for all its Nodes. - When the XMLDocument gets deleted, all its Nodes - will also be deleted. - - @verbatim - A Document can contain: Element (container or leaf) - Comment (leaf) - Unknown (leaf) - Declaration( leaf ) - - An Element can contain: Element (container or leaf) - Text (leaf) - Attributes (not on tree) - Comment (leaf) - Unknown (leaf) - - @endverbatim -*/ -class TINYXML2_LIB XMLNode -{ - friend class XMLDocument; - friend class XMLElement; -public: - - /// Get the XMLDocument that owns this XMLNode. - const XMLDocument* GetDocument() const { - TIXMLASSERT( _document ); - return _document; - } - /// Get the XMLDocument that owns this XMLNode. - XMLDocument* GetDocument() { - TIXMLASSERT( _document ); - return _document; - } - - /// Safely cast to an Element, or null. - virtual XMLElement* ToElement() { - return 0; - } - /// Safely cast to Text, or null. - virtual XMLText* ToText() { - return 0; - } - /// Safely cast to a Comment, or null. - virtual XMLComment* ToComment() { - return 0; - } - /// Safely cast to a Document, or null. - virtual XMLDocument* ToDocument() { - return 0; - } - /// Safely cast to a Declaration, or null. - virtual XMLDeclaration* ToDeclaration() { - return 0; - } - /// Safely cast to an Unknown, or null. - virtual XMLUnknown* ToUnknown() { - return 0; - } - - virtual const XMLElement* ToElement() const { - return 0; - } - virtual const XMLText* ToText() const { - return 0; - } - virtual const XMLComment* ToComment() const { - return 0; - } - virtual const XMLDocument* ToDocument() const { - return 0; - } - virtual const XMLDeclaration* ToDeclaration() const { - return 0; - } - virtual const XMLUnknown* ToUnknown() const { - return 0; - } - - /** The meaning of 'value' changes for the specific type. - @verbatim - Document: empty (NULL is returned, not an empty string) - Element: name of the element - Comment: the comment text - Unknown: the tag contents - Text: the text string - @endverbatim - */ - const char* Value() const; - - /** Set the Value of an XML node. - @sa Value() - */ - void SetValue( const char* val, bool staticMem=false ); - - /// Gets the line number the node is in, if the document was parsed from a file. - int GetLineNum() const { return _parseLineNum; } - - /// Get the parent of this node on the DOM. - const XMLNode* Parent() const { - return _parent; - } - - XMLNode* Parent() { - return _parent; - } - - /// Returns true if this node has no children. - bool NoChildren() const { - return !_firstChild; - } - - /// Get the first child node, or null if none exists. - const XMLNode* FirstChild() const { - return _firstChild; - } - - XMLNode* FirstChild() { - return _firstChild; - } - - /** Get the first child element, or optionally the first child - element with the specified name. - */ - const XMLElement* FirstChildElement( const char* name = 0 ) const; - - XMLElement* FirstChildElement( const char* name = 0 ) { - return const_cast(const_cast(this)->FirstChildElement( name )); - } - - /// Get the last child node, or null if none exists. - const XMLNode* LastChild() const { - return _lastChild; - } - - XMLNode* LastChild() { - return _lastChild; - } - - /** Get the last child element or optionally the last child - element with the specified name. - */ - const XMLElement* LastChildElement( const char* name = 0 ) const; - - XMLElement* LastChildElement( const char* name = 0 ) { - return const_cast(const_cast(this)->LastChildElement(name) ); - } - - /// Get the previous (left) sibling node of this node. - const XMLNode* PreviousSibling() const { - return _prev; - } - - XMLNode* PreviousSibling() { - return _prev; - } - - /// Get the previous (left) sibling element of this node, with an optionally supplied name. - const XMLElement* PreviousSiblingElement( const char* name = 0 ) const ; - - XMLElement* PreviousSiblingElement( const char* name = 0 ) { - return const_cast(const_cast(this)->PreviousSiblingElement( name ) ); - } - - /// Get the next (right) sibling node of this node. - const XMLNode* NextSibling() const { - return _next; - } - - XMLNode* NextSibling() { - return _next; - } - - /// Get the next (right) sibling element of this node, with an optionally supplied name. - const XMLElement* NextSiblingElement( const char* name = 0 ) const; - - XMLElement* NextSiblingElement( const char* name = 0 ) { - return const_cast(const_cast(this)->NextSiblingElement( name ) ); - } - - /** - Add a child node as the last (right) child. - If the child node is already part of the document, - it is moved from its old location to the new location. - Returns the addThis argument or 0 if the node does not - belong to the same document. - */ - XMLNode* InsertEndChild( XMLNode* addThis ); - - XMLNode* LinkEndChild( XMLNode* addThis ) { - return InsertEndChild( addThis ); - } - /** - Add a child node as the first (left) child. - If the child node is already part of the document, - it is moved from its old location to the new location. - Returns the addThis argument or 0 if the node does not - belong to the same document. - */ - XMLNode* InsertFirstChild( XMLNode* addThis ); - /** - Add a node after the specified child node. - If the child node is already part of the document, - it is moved from its old location to the new location. - Returns the addThis argument or 0 if the afterThis node - is not a child of this node, or if the node does not - belong to the same document. - */ - XMLNode* InsertAfterChild( XMLNode* afterThis, XMLNode* addThis ); - - /** - Delete all the children of this node. - */ - void DeleteChildren(); - - /** - Delete a child of this node. - */ - void DeleteChild( XMLNode* node ); - - /** - Make a copy of this node, but not its children. - You may pass in a Document pointer that will be - the owner of the new Node. If the 'document' is - null, then the node returned will be allocated - from the current Document. (this->GetDocument()) - - Note: if called on a XMLDocument, this will return null. - */ - virtual XMLNode* ShallowClone( XMLDocument* document ) const = 0; - - /** - Make a copy of this node and all its children. - - If the 'target' is null, then the nodes will - be allocated in the current document. If 'target' - is specified, the memory will be allocated is the - specified XMLDocument. - - NOTE: This is probably not the correct tool to - copy a document, since XMLDocuments can have multiple - top level XMLNodes. You probably want to use - XMLDocument::DeepCopy() - */ - XMLNode* DeepClone( XMLDocument* target ) const; - - /** - Test if 2 nodes are the same, but don't test children. - The 2 nodes do not need to be in the same Document. - - Note: if called on a XMLDocument, this will return false. - */ - virtual bool ShallowEqual( const XMLNode* compare ) const = 0; - - /** Accept a hierarchical visit of the nodes in the TinyXML-2 DOM. Every node in the - XML tree will be conditionally visited and the host will be called back - via the XMLVisitor interface. - - This is essentially a SAX interface for TinyXML-2. (Note however it doesn't re-parse - the XML for the callbacks, so the performance of TinyXML-2 is unchanged by using this - interface versus any other.) - - The interface has been based on ideas from: - - - http://www.saxproject.org/ - - http://c2.com/cgi/wiki?HierarchicalVisitorPattern - - Which are both good references for "visiting". - - An example of using Accept(): - @verbatim - XMLPrinter printer; - tinyxmlDoc.Accept( &printer ); - const char* xmlcstr = printer.CStr(); - @endverbatim - */ - virtual bool Accept( XMLVisitor* visitor ) const = 0; - - /** - Set user data into the XMLNode. TinyXML-2 in - no way processes or interprets user data. - It is initially 0. - */ - void SetUserData(void* userData) { _userData = userData; } - - /** - Get user data set into the XMLNode. TinyXML-2 in - no way processes or interprets user data. - It is initially 0. - */ - void* GetUserData() const { return _userData; } - -protected: - explicit XMLNode( XMLDocument* ); - virtual ~XMLNode(); - - virtual char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr); - - XMLDocument* _document; - XMLNode* _parent; - mutable StrPair _value; - int _parseLineNum; - - XMLNode* _firstChild; - XMLNode* _lastChild; - - XMLNode* _prev; - XMLNode* _next; - - void* _userData; - -private: - MemPool* _memPool; - void Unlink( XMLNode* child ); - static void DeleteNode( XMLNode* node ); - void InsertChildPreamble( XMLNode* insertThis ) const; - const XMLElement* ToElementWithName( const char* name ) const; - - XMLNode( const XMLNode& ); // not supported - XMLNode& operator=( const XMLNode& ); // not supported -}; - - -/** XML text. - - Note that a text node can have child element nodes, for example: - @verbatim - This is bold - @endverbatim - - A text node can have 2 ways to output the next. "normal" output - and CDATA. It will default to the mode it was parsed from the XML file and - you generally want to leave it alone, but you can change the output mode with - SetCData() and query it with CData(). -*/ -class TINYXML2_LIB XMLText : public XMLNode -{ - friend class XMLDocument; -public: - virtual bool Accept( XMLVisitor* visitor ) const; - - virtual XMLText* ToText() { - return this; - } - virtual const XMLText* ToText() const { - return this; - } - - /// Declare whether this should be CDATA or standard text. - void SetCData( bool isCData ) { - _isCData = isCData; - } - /// Returns true if this is a CDATA text element. - bool CData() const { - return _isCData; - } - - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - explicit XMLText( XMLDocument* doc ) : XMLNode( doc ), _isCData( false ) {} - virtual ~XMLText() {} - - char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); - -private: - bool _isCData; - - XMLText( const XMLText& ); // not supported - XMLText& operator=( const XMLText& ); // not supported -}; - - -/** An XML Comment. */ -class TINYXML2_LIB XMLComment : public XMLNode -{ - friend class XMLDocument; -public: - virtual XMLComment* ToComment() { - return this; - } - virtual const XMLComment* ToComment() const { - return this; - } - - virtual bool Accept( XMLVisitor* visitor ) const; - - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - explicit XMLComment( XMLDocument* doc ); - virtual ~XMLComment(); - - char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr); - -private: - XMLComment( const XMLComment& ); // not supported - XMLComment& operator=( const XMLComment& ); // not supported -}; - - -/** In correct XML the declaration is the first entry in the file. - @verbatim - - @endverbatim - - TinyXML-2 will happily read or write files without a declaration, - however. - - The text of the declaration isn't interpreted. It is parsed - and written as a string. -*/ -class TINYXML2_LIB XMLDeclaration : public XMLNode -{ - friend class XMLDocument; -public: - virtual XMLDeclaration* ToDeclaration() { - return this; - } - virtual const XMLDeclaration* ToDeclaration() const { - return this; - } - - virtual bool Accept( XMLVisitor* visitor ) const; - - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - explicit XMLDeclaration( XMLDocument* doc ); - virtual ~XMLDeclaration(); - - char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); - -private: - XMLDeclaration( const XMLDeclaration& ); // not supported - XMLDeclaration& operator=( const XMLDeclaration& ); // not supported -}; - - -/** Any tag that TinyXML-2 doesn't recognize is saved as an - unknown. It is a tag of text, but should not be modified. - It will be written back to the XML, unchanged, when the file - is saved. - - DTD tags get thrown into XMLUnknowns. -*/ -class TINYXML2_LIB XMLUnknown : public XMLNode -{ - friend class XMLDocument; -public: - virtual XMLUnknown* ToUnknown() { - return this; - } - virtual const XMLUnknown* ToUnknown() const { - return this; - } - - virtual bool Accept( XMLVisitor* visitor ) const; - - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - explicit XMLUnknown( XMLDocument* doc ); - virtual ~XMLUnknown(); - - char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); - -private: - XMLUnknown( const XMLUnknown& ); // not supported - XMLUnknown& operator=( const XMLUnknown& ); // not supported -}; - - - -/** An attribute is a name-value pair. Elements have an arbitrary - number of attributes, each with a unique name. - - @note The attributes are not XMLNodes. You may only query the - Next() attribute in a list. -*/ -class TINYXML2_LIB XMLAttribute -{ - friend class XMLElement; -public: - /// The name of the attribute. - const char* Name() const; - - /// The value of the attribute. - const char* Value() const; - - /// Gets the line number the attribute is in, if the document was parsed from a file. - int GetLineNum() const { return _parseLineNum; } - - /// The next attribute in the list. - const XMLAttribute* Next() const { - return _next; - } - - /** IntValue interprets the attribute as an integer, and returns the value. - If the value isn't an integer, 0 will be returned. There is no error checking; - use QueryIntValue() if you need error checking. - */ - int IntValue() const { - int i = 0; - QueryIntValue(&i); - return i; - } - - int64_t Int64Value() const { - int64_t i = 0; - QueryInt64Value(&i); - return i; - } - - uint64_t Unsigned64Value() const { - uint64_t i = 0; - QueryUnsigned64Value(&i); - return i; - } - - /// Query as an unsigned integer. See IntValue() - unsigned UnsignedValue() const { - unsigned i=0; - QueryUnsignedValue( &i ); - return i; - } - /// Query as a boolean. See IntValue() - bool BoolValue() const { - bool b=false; - QueryBoolValue( &b ); - return b; - } - /// Query as a double. See IntValue() - double DoubleValue() const { - double d=0; - QueryDoubleValue( &d ); - return d; - } - /// Query as a float. See IntValue() - float FloatValue() const { - float f=0; - QueryFloatValue( &f ); - return f; - } - - /** QueryIntValue interprets the attribute as an integer, and returns the value - in the provided parameter. The function will return XML_SUCCESS on success, - and XML_WRONG_ATTRIBUTE_TYPE if the conversion is not successful. - */ - XMLError QueryIntValue( int* value ) const; - /// See QueryIntValue - XMLError QueryUnsignedValue( unsigned int* value ) const; - /// See QueryIntValue - XMLError QueryInt64Value(int64_t* value) const; - /// See QueryIntValue - XMLError QueryUnsigned64Value(uint64_t* value) const; - /// See QueryIntValue - XMLError QueryBoolValue( bool* value ) const; - /// See QueryIntValue - XMLError QueryDoubleValue( double* value ) const; - /// See QueryIntValue - XMLError QueryFloatValue( float* value ) const; - - /// Set the attribute to a string value. - void SetAttribute( const char* value ); - /// Set the attribute to value. - void SetAttribute( int value ); - /// Set the attribute to value. - void SetAttribute( unsigned value ); - /// Set the attribute to value. - void SetAttribute(int64_t value); - /// Set the attribute to value. - void SetAttribute(uint64_t value); - /// Set the attribute to value. - void SetAttribute( bool value ); - /// Set the attribute to value. - void SetAttribute( double value ); - /// Set the attribute to value. - void SetAttribute( float value ); - -private: - enum { BUF_SIZE = 200 }; - - XMLAttribute() : _name(), _value(),_parseLineNum( 0 ), _next( 0 ), _memPool( 0 ) {} - virtual ~XMLAttribute() {} - - XMLAttribute( const XMLAttribute& ); // not supported - void operator=( const XMLAttribute& ); // not supported - void SetName( const char* name ); - - char* ParseDeep( char* p, bool processEntities, int* curLineNumPtr ); - - mutable StrPair _name; - mutable StrPair _value; - int _parseLineNum; - XMLAttribute* _next; - MemPool* _memPool; -}; - - -/** The element is a container class. It has a value, the element name, - and can contain other elements, text, comments, and unknowns. - Elements also contain an arbitrary number of attributes. -*/ -class TINYXML2_LIB XMLElement : public XMLNode -{ - friend class XMLDocument; -public: - /// Get the name of an element (which is the Value() of the node.) - const char* Name() const { - return Value(); - } - /// Set the name of the element. - void SetName( const char* str, bool staticMem=false ) { - SetValue( str, staticMem ); - } - - virtual XMLElement* ToElement() { - return this; - } - virtual const XMLElement* ToElement() const { - return this; - } - virtual bool Accept( XMLVisitor* visitor ) const; - - /** Given an attribute name, Attribute() returns the value - for the attribute of that name, or null if none - exists. For example: - - @verbatim - const char* value = ele->Attribute( "foo" ); - @endverbatim - - The 'value' parameter is normally null. However, if specified, - the attribute will only be returned if the 'name' and 'value' - match. This allow you to write code: - - @verbatim - if ( ele->Attribute( "foo", "bar" ) ) callFooIsBar(); - @endverbatim - - rather than: - @verbatim - if ( ele->Attribute( "foo" ) ) { - if ( strcmp( ele->Attribute( "foo" ), "bar" ) == 0 ) callFooIsBar(); - } - @endverbatim - */ - const char* Attribute( const char* name, const char* value=0 ) const; - - /** Given an attribute name, IntAttribute() returns the value - of the attribute interpreted as an integer. The default - value will be returned if the attribute isn't present, - or if there is an error. (For a method with error - checking, see QueryIntAttribute()). - */ - int IntAttribute(const char* name, int defaultValue = 0) const; - /// See IntAttribute() - unsigned UnsignedAttribute(const char* name, unsigned defaultValue = 0) const; - /// See IntAttribute() - int64_t Int64Attribute(const char* name, int64_t defaultValue = 0) const; - /// See IntAttribute() - uint64_t Unsigned64Attribute(const char* name, uint64_t defaultValue = 0) const; - /// See IntAttribute() - bool BoolAttribute(const char* name, bool defaultValue = false) const; - /// See IntAttribute() - double DoubleAttribute(const char* name, double defaultValue = 0) const; - /// See IntAttribute() - float FloatAttribute(const char* name, float defaultValue = 0) const; - - /** Given an attribute name, QueryIntAttribute() returns - XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion - can't be performed, or XML_NO_ATTRIBUTE if the attribute - doesn't exist. If successful, the result of the conversion - will be written to 'value'. If not successful, nothing will - be written to 'value'. This allows you to provide default - value: - - @verbatim - int value = 10; - QueryIntAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 - @endverbatim - */ - XMLError QueryIntAttribute( const char* name, int* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryIntValue( value ); - } - - /// See QueryIntAttribute() - XMLError QueryUnsignedAttribute( const char* name, unsigned int* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryUnsignedValue( value ); - } - - /// See QueryIntAttribute() - XMLError QueryInt64Attribute(const char* name, int64_t* value) const { - const XMLAttribute* a = FindAttribute(name); - if (!a) { - return XML_NO_ATTRIBUTE; - } - return a->QueryInt64Value(value); - } - - /// See QueryIntAttribute() - XMLError QueryUnsigned64Attribute(const char* name, uint64_t* value) const { - const XMLAttribute* a = FindAttribute(name); - if(!a) { - return XML_NO_ATTRIBUTE; - } - return a->QueryUnsigned64Value(value); - } - - /// See QueryIntAttribute() - XMLError QueryBoolAttribute( const char* name, bool* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryBoolValue( value ); - } - /// See QueryIntAttribute() - XMLError QueryDoubleAttribute( const char* name, double* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryDoubleValue( value ); - } - /// See QueryIntAttribute() - XMLError QueryFloatAttribute( const char* name, float* value ) const { - const XMLAttribute* a = FindAttribute( name ); - if ( !a ) { - return XML_NO_ATTRIBUTE; - } - return a->QueryFloatValue( value ); - } - - /// See QueryIntAttribute() - XMLError QueryStringAttribute(const char* name, const char** value) const { - const XMLAttribute* a = FindAttribute(name); - if (!a) { - return XML_NO_ATTRIBUTE; - } - *value = a->Value(); - return XML_SUCCESS; - } - - - - /** Given an attribute name, QueryAttribute() returns - XML_SUCCESS, XML_WRONG_ATTRIBUTE_TYPE if the conversion - can't be performed, or XML_NO_ATTRIBUTE if the attribute - doesn't exist. It is overloaded for the primitive types, - and is a generally more convenient replacement of - QueryIntAttribute() and related functions. - - If successful, the result of the conversion - will be written to 'value'. If not successful, nothing will - be written to 'value'. This allows you to provide default - value: - - @verbatim - int value = 10; - QueryAttribute( "foo", &value ); // if "foo" isn't found, value will still be 10 - @endverbatim - */ - XMLError QueryAttribute( const char* name, int* value ) const { - return QueryIntAttribute( name, value ); - } - - XMLError QueryAttribute( const char* name, unsigned int* value ) const { - return QueryUnsignedAttribute( name, value ); - } - - XMLError QueryAttribute(const char* name, int64_t* value) const { - return QueryInt64Attribute(name, value); - } - - XMLError QueryAttribute(const char* name, uint64_t* value) const { - return QueryUnsigned64Attribute(name, value); - } - - XMLError QueryAttribute( const char* name, bool* value ) const { - return QueryBoolAttribute( name, value ); - } - - XMLError QueryAttribute( const char* name, double* value ) const { - return QueryDoubleAttribute( name, value ); - } - - XMLError QueryAttribute( const char* name, float* value ) const { - return QueryFloatAttribute( name, value ); - } - - /// Sets the named attribute to value. - void SetAttribute( const char* name, const char* value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, int value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, unsigned value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - - /// Sets the named attribute to value. - void SetAttribute(const char* name, int64_t value) { - XMLAttribute* a = FindOrCreateAttribute(name); - a->SetAttribute(value); - } - - /// Sets the named attribute to value. - void SetAttribute(const char* name, uint64_t value) { - XMLAttribute* a = FindOrCreateAttribute(name); - a->SetAttribute(value); - } - - /// Sets the named attribute to value. - void SetAttribute( const char* name, bool value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, double value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - /// Sets the named attribute to value. - void SetAttribute( const char* name, float value ) { - XMLAttribute* a = FindOrCreateAttribute( name ); - a->SetAttribute( value ); - } - - /** - Delete an attribute. - */ - void DeleteAttribute( const char* name ); - - /// Return the first attribute in the list. - const XMLAttribute* FirstAttribute() const { - return _rootAttribute; - } - /// Query a specific attribute in the list. - const XMLAttribute* FindAttribute( const char* name ) const; - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, GetText() is limited compared to getting the XMLText child - and accessing it directly. - - If the first child of 'this' is a XMLText, the GetText() - returns the character string of the Text node, else null is returned. - - This is a convenient method for getting the text of simple contained text: - @verbatim - This is text - const char* str = fooElement->GetText(); - @endverbatim - - 'str' will be a pointer to "This is text". - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then the value of str would be null. The first child node isn't a text node, it is - another element. From this XML: - @verbatim - This is text - @endverbatim - GetText() will return "This is ". - */ - const char* GetText() const; - - /** Convenience function for easy access to the text inside an element. Although easy - and concise, SetText() is limited compared to creating an XMLText child - and mutating it directly. - - If the first child of 'this' is a XMLText, SetText() sets its value to - the given string, otherwise it will create a first child that is an XMLText. - - This is a convenient method for setting the text of simple contained text: - @verbatim - This is text - fooElement->SetText( "Hullaballoo!" ); - Hullaballoo! - @endverbatim - - Note that this function can be misleading. If the element foo was created from - this XML: - @verbatim - This is text - @endverbatim - - then it will not change "This is text", but rather prefix it with a text element: - @verbatim - Hullaballoo!This is text - @endverbatim - - For this XML: - @verbatim - - @endverbatim - SetText() will generate - @verbatim - Hullaballoo! - @endverbatim - */ - void SetText( const char* inText ); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( int value ); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( unsigned value ); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText(int64_t value); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText(uint64_t value); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( bool value ); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( double value ); - /// Convenience method for setting text inside an element. See SetText() for important limitations. - void SetText( float value ); - - /** - Convenience method to query the value of a child text node. This is probably best - shown by example. Given you have a document is this form: - @verbatim - - 1 - 1.4 - - @endverbatim - - The QueryIntText() and similar functions provide a safe and easier way to get to the - "value" of x and y. - - @verbatim - int x = 0; - float y = 0; // types of x and y are contrived for example - const XMLElement* xElement = pointElement->FirstChildElement( "x" ); - const XMLElement* yElement = pointElement->FirstChildElement( "y" ); - xElement->QueryIntText( &x ); - yElement->QueryFloatText( &y ); - @endverbatim - - @returns XML_SUCCESS (0) on success, XML_CAN_NOT_CONVERT_TEXT if the text cannot be converted - to the requested type, and XML_NO_TEXT_NODE if there is no child text to query. - - */ - XMLError QueryIntText( int* ival ) const; - /// See QueryIntText() - XMLError QueryUnsignedText( unsigned* uval ) const; - /// See QueryIntText() - XMLError QueryInt64Text(int64_t* uval) const; - /// See QueryIntText() - XMLError QueryUnsigned64Text(uint64_t* uval) const; - /// See QueryIntText() - XMLError QueryBoolText( bool* bval ) const; - /// See QueryIntText() - XMLError QueryDoubleText( double* dval ) const; - /// See QueryIntText() - XMLError QueryFloatText( float* fval ) const; - - int IntText(int defaultValue = 0) const; - - /// See QueryIntText() - unsigned UnsignedText(unsigned defaultValue = 0) const; - /// See QueryIntText() - int64_t Int64Text(int64_t defaultValue = 0) const; - /// See QueryIntText() - uint64_t Unsigned64Text(uint64_t defaultValue = 0) const; - /// See QueryIntText() - bool BoolText(bool defaultValue = false) const; - /// See QueryIntText() - double DoubleText(double defaultValue = 0) const; - /// See QueryIntText() - float FloatText(float defaultValue = 0) const; - - /** - Convenience method to create a new XMLElement and add it as last (right) - child of this node. Returns the created and inserted element. - */ - XMLElement* InsertNewChildElement(const char* name); - /// See InsertNewChildElement() - XMLComment* InsertNewComment(const char* comment); - /// See InsertNewChildElement() - XMLText* InsertNewText(const char* text); - /// See InsertNewChildElement() - XMLDeclaration* InsertNewDeclaration(const char* text); - /// See InsertNewChildElement() - XMLUnknown* InsertNewUnknown(const char* text); - - - // internal: - enum ElementClosingType { - OPEN, // - CLOSED, // - CLOSING // - }; - ElementClosingType ClosingType() const { - return _closingType; - } - virtual XMLNode* ShallowClone( XMLDocument* document ) const; - virtual bool ShallowEqual( const XMLNode* compare ) const; - -protected: - char* ParseDeep( char* p, StrPair* parentEndTag, int* curLineNumPtr ); - -private: - XMLElement( XMLDocument* doc ); - virtual ~XMLElement(); - XMLElement( const XMLElement& ); // not supported - void operator=( const XMLElement& ); // not supported - - XMLAttribute* FindOrCreateAttribute( const char* name ); - char* ParseAttributes( char* p, int* curLineNumPtr ); - static void DeleteAttribute( XMLAttribute* attribute ); - XMLAttribute* CreateAttribute(); - - enum { BUF_SIZE = 200 }; - ElementClosingType _closingType; - // The attribute list is ordered; there is no 'lastAttribute' - // because the list needs to be scanned for dupes before adding - // a new attribute. - XMLAttribute* _rootAttribute; -}; - - -enum Whitespace { - PRESERVE_WHITESPACE, - COLLAPSE_WHITESPACE -}; - - -/** A Document binds together all the functionality. - It can be saved, loaded, and printed to the screen. - All Nodes are connected and allocated to a Document. - If the Document is deleted, all its Nodes are also deleted. -*/ -class TINYXML2_LIB XMLDocument : public XMLNode -{ - friend class XMLElement; - // Gives access to SetError and Push/PopDepth, but over-access for everything else. - // Wishing C++ had "internal" scope. - friend class XMLNode; - friend class XMLText; - friend class XMLComment; - friend class XMLDeclaration; - friend class XMLUnknown; -public: - /// constructor - XMLDocument( bool processEntities = true, Whitespace whitespaceMode = PRESERVE_WHITESPACE ); - ~XMLDocument(); - - virtual XMLDocument* ToDocument() { - TIXMLASSERT( this == _document ); - return this; - } - virtual const XMLDocument* ToDocument() const { - TIXMLASSERT( this == _document ); - return this; - } - - /** - Parse an XML file from a character string. - Returns XML_SUCCESS (0) on success, or - an errorID. - - You may optionally pass in the 'nBytes', which is - the number of bytes which will be parsed. If not - specified, TinyXML-2 will assume 'xml' points to a - null terminated string. - */ - XMLError Parse( const char* xml, size_t nBytes=static_cast(-1) ); - - /** - Load an XML file from disk. - Returns XML_SUCCESS (0) on success, or - an errorID. - */ - XMLError LoadFile( const char* filename ); - - /** - Load an XML file from disk. You are responsible - for providing and closing the FILE*. - - NOTE: The file should be opened as binary ("rb") - not text in order for TinyXML-2 to correctly - do newline normalization. - - Returns XML_SUCCESS (0) on success, or - an errorID. - */ - XMLError LoadFile( FILE* ); - - /** - Save the XML file to disk. - Returns XML_SUCCESS (0) on success, or - an errorID. - */ - XMLError SaveFile( const char* filename, bool compact = false ); - - /** - Save the XML file to disk. You are responsible - for providing and closing the FILE*. - - Returns XML_SUCCESS (0) on success, or - an errorID. - */ - XMLError SaveFile( FILE* fp, bool compact = false ); - - bool ProcessEntities() const { - return _processEntities; - } - Whitespace WhitespaceMode() const { - return _whitespaceMode; - } - - /** - Returns true if this document has a leading Byte Order Mark of UTF8. - */ - bool HasBOM() const { - return _writeBOM; - } - /** Sets whether to write the BOM when writing the file. - */ - void SetBOM( bool useBOM ) { - _writeBOM = useBOM; - } - - /** Return the root element of DOM. Equivalent to FirstChildElement(). - To get the first node, use FirstChild(). - */ - XMLElement* RootElement() { - return FirstChildElement(); - } - const XMLElement* RootElement() const { - return FirstChildElement(); - } - - /** Print the Document. If the Printer is not provided, it will - print to stdout. If you provide Printer, this can print to a file: - @verbatim - XMLPrinter printer( fp ); - doc.Print( &printer ); - @endverbatim - - Or you can use a printer to print to memory: - @verbatim - XMLPrinter printer; - doc.Print( &printer ); - // printer.CStr() has a const char* to the XML - @endverbatim - */ - void Print( XMLPrinter* streamer=0 ) const; - virtual bool Accept( XMLVisitor* visitor ) const; - - /** - Create a new Element associated with - this Document. The memory for the Element - is managed by the Document. - */ - XMLElement* NewElement( const char* name ); - /** - Create a new Comment associated with - this Document. The memory for the Comment - is managed by the Document. - */ - XMLComment* NewComment( const char* comment ); - /** - Create a new Text associated with - this Document. The memory for the Text - is managed by the Document. - */ - XMLText* NewText( const char* text ); - /** - Create a new Declaration associated with - this Document. The memory for the object - is managed by the Document. - - If the 'text' param is null, the standard - declaration is used.: - @verbatim - - @endverbatim - */ - XMLDeclaration* NewDeclaration( const char* text=0 ); - /** - Create a new Unknown associated with - this Document. The memory for the object - is managed by the Document. - */ - XMLUnknown* NewUnknown( const char* text ); - - /** - Delete a node associated with this document. - It will be unlinked from the DOM. - */ - void DeleteNode( XMLNode* node ); - - void ClearError() { - SetError(XML_SUCCESS, 0, 0); - } - - /// Return true if there was an error parsing the document. - bool Error() const { - return _errorID != XML_SUCCESS; - } - /// Return the errorID. - XMLError ErrorID() const { - return _errorID; - } - const char* ErrorName() const; - static const char* ErrorIDToName(XMLError errorID); - - /** Returns a "long form" error description. A hopefully helpful - diagnostic with location, line number, and/or additional info. - */ - const char* ErrorStr() const; - - /// A (trivial) utility function that prints the ErrorStr() to stdout. - void PrintError() const; - - /// Return the line where the error occurred, or zero if unknown. - int ErrorLineNum() const - { - return _errorLineNum; - } - - /// Clear the document, resetting it to the initial state. - void Clear(); - - /** - Copies this document to a target document. - The target will be completely cleared before the copy. - If you want to copy a sub-tree, see XMLNode::DeepClone(). - - NOTE: that the 'target' must be non-null. - */ - void DeepCopy(XMLDocument* target) const; - - // internal - char* Identify( char* p, XMLNode** node ); - - // internal - void MarkInUse(const XMLNode* const); - - virtual XMLNode* ShallowClone( XMLDocument* /*document*/ ) const { - return 0; - } - virtual bool ShallowEqual( const XMLNode* /*compare*/ ) const { - return false; - } - -private: - XMLDocument( const XMLDocument& ); // not supported - void operator=( const XMLDocument& ); // not supported - - bool _writeBOM; - bool _processEntities; - XMLError _errorID; - Whitespace _whitespaceMode; - mutable StrPair _errorStr; - int _errorLineNum; - char* _charBuffer; - int _parseCurLineNum; - int _parsingDepth; - // Memory tracking does add some overhead. - // However, the code assumes that you don't - // have a bunch of unlinked nodes around. - // Therefore it takes less memory to track - // in the document vs. a linked list in the XMLNode, - // and the performance is the same. - DynArray _unlinked; - - MemPoolT< sizeof(XMLElement) > _elementPool; - MemPoolT< sizeof(XMLAttribute) > _attributePool; - MemPoolT< sizeof(XMLText) > _textPool; - MemPoolT< sizeof(XMLComment) > _commentPool; - - static const char* _errorNames[XML_ERROR_COUNT]; - - void Parse(); - - void SetError( XMLError error, int lineNum, const char* format, ... ); - - // Something of an obvious security hole, once it was discovered. - // Either an ill-formed XML or an excessively deep one can overflow - // the stack. Track stack depth, and error out if needed. - class DepthTracker { - public: - explicit DepthTracker(XMLDocument * document) { - this->_document = document; - document->PushDepth(); - } - ~DepthTracker() { - _document->PopDepth(); - } - private: - XMLDocument * _document; - }; - void PushDepth(); - void PopDepth(); - - template - NodeType* CreateUnlinkedNode( MemPoolT& pool ); -}; - -template -inline NodeType* XMLDocument::CreateUnlinkedNode( MemPoolT& pool ) -{ - TIXMLASSERT( sizeof( NodeType ) == PoolElementSize ); - TIXMLASSERT( sizeof( NodeType ) == pool.ItemSize() ); - NodeType* returnNode = new (pool.Alloc()) NodeType( this ); - TIXMLASSERT( returnNode ); - returnNode->_memPool = &pool; - - _unlinked.Push(returnNode); - return returnNode; -} - -/** - A XMLHandle is a class that wraps a node pointer with null checks; this is - an incredibly useful thing. Note that XMLHandle is not part of the TinyXML-2 - DOM structure. It is a separate utility class. - - Take an example: - @verbatim - - - - - - - @endverbatim - - Assuming you want the value of "attributeB" in the 2nd "Child" element, it's very - easy to write a *lot* of code that looks like: - - @verbatim - XMLElement* root = document.FirstChildElement( "Document" ); - if ( root ) - { - XMLElement* element = root->FirstChildElement( "Element" ); - if ( element ) - { - XMLElement* child = element->FirstChildElement( "Child" ); - if ( child ) - { - XMLElement* child2 = child->NextSiblingElement( "Child" ); - if ( child2 ) - { - // Finally do something useful. - @endverbatim - - And that doesn't even cover "else" cases. XMLHandle addresses the verbosity - of such code. A XMLHandle checks for null pointers so it is perfectly safe - and correct to use: - - @verbatim - XMLHandle docHandle( &document ); - XMLElement* child2 = docHandle.FirstChildElement( "Document" ).FirstChildElement( "Element" ).FirstChildElement().NextSiblingElement(); - if ( child2 ) - { - // do something useful - @endverbatim - - Which is MUCH more concise and useful. - - It is also safe to copy handles - internally they are nothing more than node pointers. - @verbatim - XMLHandle handleCopy = handle; - @endverbatim - - See also XMLConstHandle, which is the same as XMLHandle, but operates on const objects. -*/ -class TINYXML2_LIB XMLHandle -{ -public: - /// Create a handle from any node (at any depth of the tree.) This can be a null pointer. - explicit XMLHandle( XMLNode* node ) : _node( node ) { - } - /// Create a handle from a node. - explicit XMLHandle( XMLNode& node ) : _node( &node ) { - } - /// Copy constructor - XMLHandle( const XMLHandle& ref ) : _node( ref._node ) { - } - /// Assignment - XMLHandle& operator=( const XMLHandle& ref ) { - _node = ref._node; - return *this; - } - - /// Get the first child of this handle. - XMLHandle FirstChild() { - return XMLHandle( _node ? _node->FirstChild() : 0 ); - } - /// Get the first child element of this handle. - XMLHandle FirstChildElement( const char* name = 0 ) { - return XMLHandle( _node ? _node->FirstChildElement( name ) : 0 ); - } - /// Get the last child of this handle. - XMLHandle LastChild() { - return XMLHandle( _node ? _node->LastChild() : 0 ); - } - /// Get the last child element of this handle. - XMLHandle LastChildElement( const char* name = 0 ) { - return XMLHandle( _node ? _node->LastChildElement( name ) : 0 ); - } - /// Get the previous sibling of this handle. - XMLHandle PreviousSibling() { - return XMLHandle( _node ? _node->PreviousSibling() : 0 ); - } - /// Get the previous sibling element of this handle. - XMLHandle PreviousSiblingElement( const char* name = 0 ) { - return XMLHandle( _node ? _node->PreviousSiblingElement( name ) : 0 ); - } - /// Get the next sibling of this handle. - XMLHandle NextSibling() { - return XMLHandle( _node ? _node->NextSibling() : 0 ); - } - /// Get the next sibling element of this handle. - XMLHandle NextSiblingElement( const char* name = 0 ) { - return XMLHandle( _node ? _node->NextSiblingElement( name ) : 0 ); - } - - /// Safe cast to XMLNode. This can return null. - XMLNode* ToNode() { - return _node; - } - /// Safe cast to XMLElement. This can return null. - XMLElement* ToElement() { - return ( _node ? _node->ToElement() : 0 ); - } - /// Safe cast to XMLText. This can return null. - XMLText* ToText() { - return ( _node ? _node->ToText() : 0 ); - } - /// Safe cast to XMLUnknown. This can return null. - XMLUnknown* ToUnknown() { - return ( _node ? _node->ToUnknown() : 0 ); - } - /// Safe cast to XMLDeclaration. This can return null. - XMLDeclaration* ToDeclaration() { - return ( _node ? _node->ToDeclaration() : 0 ); - } - -private: - XMLNode* _node; -}; - - -/** - A variant of the XMLHandle class for working with const XMLNodes and Documents. It is the - same in all regards, except for the 'const' qualifiers. See XMLHandle for API. -*/ -class TINYXML2_LIB XMLConstHandle -{ -public: - explicit XMLConstHandle( const XMLNode* node ) : _node( node ) { - } - explicit XMLConstHandle( const XMLNode& node ) : _node( &node ) { - } - XMLConstHandle( const XMLConstHandle& ref ) : _node( ref._node ) { - } - - XMLConstHandle& operator=( const XMLConstHandle& ref ) { - _node = ref._node; - return *this; - } - - const XMLConstHandle FirstChild() const { - return XMLConstHandle( _node ? _node->FirstChild() : 0 ); - } - const XMLConstHandle FirstChildElement( const char* name = 0 ) const { - return XMLConstHandle( _node ? _node->FirstChildElement( name ) : 0 ); - } - const XMLConstHandle LastChild() const { - return XMLConstHandle( _node ? _node->LastChild() : 0 ); - } - const XMLConstHandle LastChildElement( const char* name = 0 ) const { - return XMLConstHandle( _node ? _node->LastChildElement( name ) : 0 ); - } - const XMLConstHandle PreviousSibling() const { - return XMLConstHandle( _node ? _node->PreviousSibling() : 0 ); - } - const XMLConstHandle PreviousSiblingElement( const char* name = 0 ) const { - return XMLConstHandle( _node ? _node->PreviousSiblingElement( name ) : 0 ); - } - const XMLConstHandle NextSibling() const { - return XMLConstHandle( _node ? _node->NextSibling() : 0 ); - } - const XMLConstHandle NextSiblingElement( const char* name = 0 ) const { - return XMLConstHandle( _node ? _node->NextSiblingElement( name ) : 0 ); - } - - - const XMLNode* ToNode() const { - return _node; - } - const XMLElement* ToElement() const { - return ( _node ? _node->ToElement() : 0 ); - } - const XMLText* ToText() const { - return ( _node ? _node->ToText() : 0 ); - } - const XMLUnknown* ToUnknown() const { - return ( _node ? _node->ToUnknown() : 0 ); - } - const XMLDeclaration* ToDeclaration() const { - return ( _node ? _node->ToDeclaration() : 0 ); - } - -private: - const XMLNode* _node; -}; - - -/** - Printing functionality. The XMLPrinter gives you more - options than the XMLDocument::Print() method. - - It can: - -# Print to memory. - -# Print to a file you provide. - -# Print XML without a XMLDocument. - - Print to Memory - - @verbatim - XMLPrinter printer; - doc.Print( &printer ); - SomeFunction( printer.CStr() ); - @endverbatim - - Print to a File - - You provide the file pointer. - @verbatim - XMLPrinter printer( fp ); - doc.Print( &printer ); - @endverbatim - - Print without a XMLDocument - - When loading, an XML parser is very useful. However, sometimes - when saving, it just gets in the way. The code is often set up - for streaming, and constructing the DOM is just overhead. - - The Printer supports the streaming case. The following code - prints out a trivially simple XML file without ever creating - an XML document. - - @verbatim - XMLPrinter printer( fp ); - printer.OpenElement( "foo" ); - printer.PushAttribute( "foo", "bar" ); - printer.CloseElement(); - @endverbatim -*/ -class TINYXML2_LIB XMLPrinter : public XMLVisitor -{ -public: - /** Construct the printer. If the FILE* is specified, - this will print to the FILE. Else it will print - to memory, and the result is available in CStr(). - If 'compact' is set to true, then output is created - with only required whitespace and newlines. - */ - XMLPrinter( FILE* file=0, bool compact = false, int depth = 0 ); - virtual ~XMLPrinter() {} - - /** If streaming, write the BOM and declaration. */ - void PushHeader( bool writeBOM, bool writeDeclaration ); - /** If streaming, start writing an element. - The element must be closed with CloseElement() - */ - void OpenElement( const char* name, bool compactMode=false ); - /// If streaming, add an attribute to an open element. - void PushAttribute( const char* name, const char* value ); - void PushAttribute( const char* name, int value ); - void PushAttribute( const char* name, unsigned value ); - void PushAttribute( const char* name, int64_t value ); - void PushAttribute( const char* name, uint64_t value ); - void PushAttribute( const char* name, bool value ); - void PushAttribute( const char* name, double value ); - /// If streaming, close the Element. - virtual void CloseElement( bool compactMode=false ); - - /// Add a text node. - void PushText( const char* text, bool cdata=false ); - /// Add a text node from an integer. - void PushText( int value ); - /// Add a text node from an unsigned. - void PushText( unsigned value ); - /// Add a text node from a signed 64bit integer. - void PushText( int64_t value ); - /// Add a text node from an unsigned 64bit integer. - void PushText( uint64_t value ); - /// Add a text node from a bool. - void PushText( bool value ); - /// Add a text node from a float. - void PushText( float value ); - /// Add a text node from a double. - void PushText( double value ); - - /// Add a comment - void PushComment( const char* comment ); - - void PushDeclaration( const char* value ); - void PushUnknown( const char* value ); - - virtual bool VisitEnter( const XMLDocument& /*doc*/ ); - virtual bool VisitExit( const XMLDocument& /*doc*/ ) { - return true; - } - - virtual bool VisitEnter( const XMLElement& element, const XMLAttribute* attribute ); - virtual bool VisitExit( const XMLElement& element ); - - virtual bool Visit( const XMLText& text ); - virtual bool Visit( const XMLComment& comment ); - virtual bool Visit( const XMLDeclaration& declaration ); - virtual bool Visit( const XMLUnknown& unknown ); - - /** - If in print to memory mode, return a pointer to - the XML file in memory. - */ - const char* CStr() const { - return _buffer.Mem(); - } - /** - If in print to memory mode, return the size - of the XML file in memory. (Note the size returned - includes the terminating null.) - */ - int CStrSize() const { - return _buffer.Size(); - } - /** - If in print to memory mode, reset the buffer to the - beginning. - */ - void ClearBuffer( bool resetToFirstElement = true ) { - _buffer.Clear(); - _buffer.Push(0); - _firstElement = resetToFirstElement; - } - -protected: - virtual bool CompactMode( const XMLElement& ) { return _compactMode; } - - /** Prints out the space before an element. You may override to change - the space and tabs used. A PrintSpace() override should call Print(). - */ - virtual void PrintSpace( int depth ); - void Print( const char* format, ... ); - void Write( const char* data, size_t size ); - inline void Write( const char* data ) { Write( data, strlen( data ) ); } - void Putc( char ch ); - - void SealElementIfJustOpened(); - bool _elementJustOpened; - DynArray< const char*, 10 > _stack; - -private: - void PrintString( const char*, bool restrictedEntitySet ); // prints out, after detecting entities. - - bool _firstElement; - FILE* _fp; - int _depth; - int _textDepth; - bool _processEntities; - bool _compactMode; - - enum { - ENTITY_RANGE = 64, - BUF_SIZE = 200 - }; - bool _entityFlag[ENTITY_RANGE]; - bool _restrictedEntityFlag[ENTITY_RANGE]; - - DynArray< char, 20 > _buffer; - - // Prohibit cloning, intentionally not implemented - XMLPrinter( const XMLPrinter& ); - XMLPrinter& operator=( const XMLPrinter& ); -}; - - -} // tinyxml2 - -#if defined(_MSC_VER) -# pragma warning(pop) -#endif - -#endif // TINYXML2_INCLUDED diff --git a/soh/soh/Enhancements/randomizer/draw.cpp b/soh/soh/Enhancements/randomizer/draw.cpp index 4ee80d919..338bfdb33 100644 --- a/soh/soh/Enhancements/randomizer/draw.cpp +++ b/soh/soh/Enhancements/randomizer/draw.cpp @@ -29,7 +29,7 @@ extern "C" void Randomizer_DrawSmallKey(PlayState* play, GetItemEntry* getItemEn s8 keysCanBeOutsideDungeon = getItemEntry->getItemId == RG_GERUDO_FORTRESS_SMALL_KEY ? Randomizer_GetSettingValue(RSK_GERUDO_KEYS) != RO_GERUDO_KEYS_VANILLA : DUNGEON_ITEMS_CAN_BE_OUTSIDE_DUNGEON(RSK_KEYSANITY); - s8 isColoredKeysEnabled = keysCanBeOutsideDungeon && CVarGetInteger("gRandoMatchKeyColors", 1); + s8 isColoredKeysEnabled = keysCanBeOutsideDungeon && CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MatchKeyColors"), 1); s16 color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_SMALL_KEY; s16 colors[9][3] = { { 4, 195, 46 }, // Forest Temple @@ -111,7 +111,7 @@ extern "C" void Randomizer_DrawBossKey(PlayState* play, GetItemEntry* getItemEnt s8 keysCanBeOutsideDungeon = getItemEntry->getItemId == RG_GANONS_CASTLE_BOSS_KEY ? DUNGEON_ITEMS_CAN_BE_OUTSIDE_DUNGEON(RSK_GANONS_BOSS_KEY) : DUNGEON_ITEMS_CAN_BE_OUTSIDE_DUNGEON(RSK_BOSS_KEYSANITY); - s8 isColoredKeysEnabled = keysCanBeOutsideDungeon && CVarGetInteger("gRandoMatchKeyColors", 1); + s8 isColoredKeysEnabled = keysCanBeOutsideDungeon && CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("MatchKeyColors"), 1); s16 color_slot; color_slot = getItemEntry->getItemId - RG_FOREST_TEMPLE_BOSS_KEY; s16 colors[6][3] = { @@ -377,31 +377,31 @@ extern "C" void Randomizer_DrawBossSoul(PlayState* play, GetItemEntry* getItemEn extern "C" void Randomizer_DrawOcarinaButton(PlayState* play, GetItemEntry* getItemEntry) { Color_RGB8 aButtonColor = { 80, 150, 255 }; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + aButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), aButtonColor); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = { 80, 255, 150 }; } Color_RGB8 cButtonsColor = { 255, 255, 50 }; - if (CVarGetInteger("gCosmetics.Hud_CButtons.Changed", 0)) { - cButtonsColor = CVarGetColor24("gCosmetics.Hud_CButtons.Value", cButtonsColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CButtons.Changed"), 0)) { + cButtonsColor = CVarGetColor24(CVAR_COSMETIC("HUD.CButtons.Value"), cButtonsColor); } Color_RGB8 cUpButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CUpButton.Changed", 0)) { - cUpButtonColor = CVarGetColor24("gCosmetics.Hud_CUpButton.Value", cUpButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.Changed"), 0)) { + cUpButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CUpButton.Value"), cUpButtonColor); } Color_RGB8 cDownButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CDownButton.Changed", 0)) { - cDownButtonColor = CVarGetColor24("gCosmetics.Hud_CDownButton.Value", cDownButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.Changed"), 0)) { + cDownButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CDownButton.Value"), cDownButtonColor); } Color_RGB8 cLeftButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CLeftButton.Changed", 0)) { - cLeftButtonColor = CVarGetColor24("gCosmetics.Hud_CLeftButton.Value", cLeftButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.Changed"), 0)) { + cLeftButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CLeftButton.Value"), cLeftButtonColor); } Color_RGB8 cRightButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CRightButton.Changed", 0)) { - cRightButtonColor = CVarGetColor24("gCosmetics.Hud_CRightButton.Value", cRightButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.Changed"), 0)) { + cRightButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CRightButton.Value"), cRightButtonColor); } s16 slot = getItemEntry->drawItemId - RG_OCARINA_A_BUTTON; diff --git a/soh/soh/Enhancements/randomizer/fishsanity.cpp b/soh/soh/Enhancements/randomizer/fishsanity.cpp index 48ca2d703..52789f17e 100644 --- a/soh/soh/Enhancements/randomizer/fishsanity.cpp +++ b/soh/soh/Enhancements/randomizer/fishsanity.cpp @@ -167,9 +167,9 @@ namespace Rando { switch (optionsSource) { // Used in check tracker case FSO_SOURCE_CVARS: - options.mode = CVarGetInteger("gRandomizeFishsanity", RO_FISHSANITY_OFF); - options.numFish = CVarGetInteger("gRandomizeFishsanityPondCount", 0); - options.ageSplit = CVarGetInteger("gRandomizeFishsanityAgeSplit", 0) == 1; + options.mode = CVarGetInteger(CVAR_RANDOMIZER_SETTING("Fishsanity"), RO_FISHSANITY_OFF); + options.numFish = CVarGetInteger(CVAR_RANDOMIZER_SETTING("FishsanityPondCount"), 0); + options.ageSplit = CVarGetInteger(CVAR_RANDOMIZER_SETTING("FishsanityAgeSplit"), 0) == 1; break; case FSO_SOURCE_RANDO: default: diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index 8360ece10..db388ae1c 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -193,7 +193,7 @@ void RandomizerOnFlagSetHandler(int16_t flagType, int16_t flag) { auto loc = Rando::Context::GetInstance()->GetItemLocation(rc); if (loc == nullptr || loc->HasObtained()) return; - SPDLOG_INFO("Queuing RC: {}", rc); + SPDLOG_INFO("Queuing RC: {}", static_cast(rc)); randomizerQueuedChecks.push(rc); } @@ -211,7 +211,7 @@ void RandomizerOnSceneFlagSetHandler(int16_t sceneNum, int16_t flagType, int16_t auto loc = Rando::Context::GetInstance()->GetItemLocation(rc); if (loc == nullptr || loc->HasObtained()) return; - SPDLOG_INFO("Queuing RC: {}", rc); + SPDLOG_INFO("Queuing RC: {}", static_cast(rc)); randomizerQueuedChecks.push(rc); } @@ -235,11 +235,11 @@ void RandomizerOnPlayerUpdateForRCQueueHandler() { GetItemEntry getItemEntry = Rando::Context::GetInstance()->GetFinalGIEntry(rc, true, (GetItemID)Rando::StaticData::GetLocation(rc)->GetVanillaItem()); if (loc->HasObtained()) { - SPDLOG_INFO("RC {} already obtained, skipping", rc); + SPDLOG_INFO("RC {} already obtained, skipping", static_cast(rc)); } else { randomizerQueuedCheck = rc; randomizerQueuedItemEntry = getItemEntry; - SPDLOG_INFO("Queueing Item mod {} item {} from RC {}", getItemEntry.modIndex, getItemEntry.itemId, rc); + SPDLOG_INFO("Queueing Item mod {} item {} from RC {}", getItemEntry.modIndex, getItemEntry.itemId, static_cast(rc)); if ( // Skipping ItemGet animation incompatible with checks that require closing a text box to finish rc != RC_HF_OCARINA_OF_TIME_ITEM && @@ -250,9 +250,9 @@ void RandomizerOnPlayerUpdateForRCQueueHandler() { // Always show ItemGet animation for ice traps !(getItemEntry.modIndex == MOD_RANDOMIZER && getItemEntry.getItemId == RG_ICE_TRAP) && ( - CVarGetInteger("gTimeSavers.SkipGetItemAnimation", SGIA_DISABLED) == SGIA_ALL || + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipGetItemAnimation"), SGIA_DISABLED) == SGIA_ALL || ( - CVarGetInteger("gTimeSavers.SkipGetItemAnimation", SGIA_DISABLED) == SGIA_JUNK && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipGetItemAnimation"), SGIA_DISABLED) == SGIA_JUNK && ( getItemEntry.getItemCategory == ITEM_CATEGORY_JUNK || getItemEntry.getItemCategory == ITEM_CATEGORY_SKULLTULA_TOKEN || @@ -276,7 +276,7 @@ void RandomizerOnPlayerUpdateForItemQueueHandler() { return; } - SPDLOG_INFO("Attempting to give Item mod {} item {} from RC {}", randomizerQueuedItemEntry.modIndex, randomizerQueuedItemEntry.itemId, randomizerQueuedCheck); + SPDLOG_INFO("Attempting to give Item mod {} item {} from RC {}", randomizerQueuedItemEntry.modIndex, randomizerQueuedItemEntry.itemId, static_cast(randomizerQueuedCheck)); GiveItemEntryWithoutActor(gPlayState, randomizerQueuedItemEntry); if (player->stateFlags1 & PLAYER_STATE1_IN_WATER) { // Allow the player to receive the item while swimming @@ -290,7 +290,7 @@ void RandomizerOnItemReceiveHandler(GetItemEntry receivedItemEntry) { auto loc = Rando::Context::GetInstance()->GetItemLocation(randomizerQueuedCheck); if (randomizerQueuedItemEntry.modIndex == receivedItemEntry.modIndex && randomizerQueuedItemEntry.itemId == receivedItemEntry.itemId) { - SPDLOG_INFO("Item received mod {} item {} from RC {}", receivedItemEntry.modIndex, receivedItemEntry.itemId, randomizerQueuedCheck); + SPDLOG_INFO("Item received mod {} item {} from RC {}", receivedItemEntry.modIndex, receivedItemEntry.itemId, static_cast(randomizerQueuedCheck)); loc->MarkAsObtained(); randomizerQueuedCheck = RC_UNKNOWN_CHECK; randomizerQueuedItemEntry = GET_ITEM_NONE; @@ -311,7 +311,7 @@ void RandomizerOnItemReceiveHandler(GetItemEntry receivedItemEntry) { } } - if (loc->GetRandomizerCheck() == RC_SPIRIT_TEMPLE_SILVER_GAUNTLETS_CHEST && !CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) { + if (loc->GetRandomizerCheck() == RC_SPIRIT_TEMPLE_SILVER_GAUNTLETS_CHEST && !CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { static uint32_t updateHook; updateHook = GameInteractor::Instance->RegisterGameHook([]() { Player* player = GET_PLAYER(gPlayState); @@ -355,7 +355,7 @@ void EnExItem_WaitForObjectRandomized(EnExItem* enExItem, PlayState* play) { } void EnItem00_DrawRandomizedItem(EnItem00* enItem00, PlayState* play) { - f32 mtxScale = CVarGetFloat("gTimeSavers.SkipGetItemAnimationScale", 10.0f); + f32 mtxScale = CVarGetFloat(CVAR_ENHANCEMENT("TimeSavers.SkipGetItemAnimationScale"), 10.0f); Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); EnItem00_CustomItemsParticles(&enItem00->actor, play, enItem00->itemEntry); GetItemEntry_Draw(play, enItem00->itemEntry); @@ -1205,7 +1205,7 @@ void ObjComb_RandomizerChooseItemDrop(ObjComb* objComb, PlayState* play) { } else if (Rand_ZeroOne() < 0.5f) { params = -1; } - if (params >= 0 && !CVarGetInteger("gNoRandomDrops", 0)) { + if (params >= 0 && !CVarGetInteger(CVAR_ENHANCEMENT("NoRandomDrops"), 0)) { Item_DropCollectible(play, &objComb->actor.world.pos, params); } } diff --git a/soh/soh/Enhancements/randomizer/option.cpp b/soh/soh/Enhancements/randomizer/option.cpp index 950fa96cf..acccb9c5b 100644 --- a/soh/soh/Enhancements/randomizer/option.cpp +++ b/soh/soh/Enhancements/randomizer/option.cpp @@ -1,7 +1,7 @@ #include "option.h" #include "libultraship/bridge.h" #include -#include +#include #include "soh/UIWidgets.hpp" namespace Rando { @@ -198,7 +198,7 @@ bool Option::RenderCheckbox() const { if (CustomCheckbox(name.c_str(), &val, disabled, disabledGraphic)) { CVarSetInteger(cvarName.c_str(), val); changed = true; - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (!description.empty()) { UIWidgets::InsertHelpHoverText(description.c_str()); @@ -220,7 +220,7 @@ bool Option::RenderCombobox() const { selected--; CVarSetInteger(cvarName.c_str(), selected); changed = true; - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (!description.empty()) { UIWidgets::InsertHelpHoverText(description.c_str()); @@ -233,7 +233,7 @@ bool Option::RenderCombobox() const { CVarSetInteger(cvarName.c_str(), static_cast(i)); changed = true; selected = i; - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } } @@ -296,7 +296,7 @@ bool Option::RenderSlider() const { } if (changed) { CVarSetInteger(cvarName.c_str(), val); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } return changed; } diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index de0295b30..6f5820952 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -15,8 +15,9 @@ #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif -#include -#include +#include +#include +#include "../custom-message/CustomMessageTypes.h" #include "../item-tables/ItemTableManager.h" #include "../presets.h" #include "../../../src/overlays/actors/ovl_En_GirlA/z_en_girla.h" @@ -1680,7 +1681,7 @@ RandomizerCheck Randomizer::GetCheckFromRandomizerInf(RandomizerInf randomizerIn std::thread randoThread; void GenerateRandomizerImgui(std::string seed = "") { - CVarSetInteger("gRandoGenerating", 1); + CVarSetInteger(CVAR_GENERAL("RandoGenerating"), 1); CVarSave(); auto ctx = Rando::Context::GetInstance(); if (!ctx->IsSpoilerLoaded()) { @@ -1689,7 +1690,7 @@ void GenerateRandomizerImgui(std::string seed = "") { } // todo: this efficently when we build out cvar array support std::set excludedLocations; - std::stringstream excludedLocationStringStream(CVarGetString("gRandomizeExcludedLocations", "")); + std::stringstream excludedLocationStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), "")); std::string excludedLocationString; while (getline(excludedLocationStringStream, excludedLocationString, ',')) { excludedLocations.insert((RandomizerCheck)std::stoi(excludedLocationString)); @@ -1698,7 +1699,7 @@ void GenerateRandomizerImgui(std::string seed = "") { // todo: better way to sort out linking tricks rather than name std::set enabledTricks; - std::stringstream enabledTrickStringStream(CVarGetString("gRandomizeEnabledTricks", "")); + std::stringstream enabledTrickStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), "")); std::string enabledTrickString; while (getline(enabledTrickStringStream, enabledTrickString, ',')) { enabledTricks.insert((RandomizerTrick)std::stoi(enabledTrickString)); @@ -1718,7 +1719,7 @@ void GenerateRandomizerImgui(std::string seed = "") { RandoMain::GenerateRando(excludedLocations, enabledTricks, seed); - CVarSetInteger("gRandoGenerating", 0); + CVarSetInteger(CVAR_GENERAL("RandoGenerating"), 0); CVarSave(); CVarLoad(); @@ -1730,7 +1731,7 @@ bool GenerateRandomizer(std::string seed /*= ""*/) { generated = 0; randoThread.join(); } - if (CVarGetInteger("gRandoGenerating", 0) == 0) { + if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) == 0) { randoThread = std::thread(&GenerateRandomizerImgui, seed); return true; } @@ -1750,18 +1751,18 @@ void RandomizerSettingsWindow::DrawElement() { return; } - bool disableEditingRandoSettings = CVarGetInteger("gRandoGenerating", 0) || CVarGetInteger("gOnFileSelectNameEntry", 0); + bool disableEditingRandoSettings = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0); if (disableEditingRandoSettings) { UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); } - ImGui::BeginDisabled(CVarGetInteger("gDisableChangingSettings", 0)); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); DrawPresetSelector(PRESET_TYPE_RANDOMIZER); ImGui::EndDisabled(); UIWidgets::Spacer(0); - UIWidgets::EnhancementCheckbox("Manual seed entry", "gRandoManualSeedEntry", false, ""); - if (CVarGetInteger("gRandoManualSeedEntry", 0)) { + UIWidgets::EnhancementCheckbox("Manual seed entry", CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), false, ""); + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), 0)) { ImGui::Text("Seed"); ImGui::InputText("##RandomizerSeed", seedString, MAX_SEED_STRING_SIZE, ImGuiInputTextFlags_CallbackCharFilter, UIWidgets::TextFilters::FilterAlphaNum); UIWidgets::Tooltip( @@ -1780,27 +1781,27 @@ void RandomizerSettingsWindow::DrawElement() { } UIWidgets::Spacer(0); - ImGui::BeginDisabled(CVarGetInteger("gRandomizerDontGenerateSpoiler", 0) && gSaveContext.gameMode != GAMEMODE_FILE_SELECT); + ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0) && gSaveContext.gameMode != GAMEMODE_FILE_SELECT); if (ImGui::Button("Generate Randomizer")) { ctx->SetSpoilerLoaded(false); - GenerateRandomizer(CVarGetInteger("gRandoManualSeedEntry", 0) ? seedString : ""); + GenerateRandomizer(CVarGetInteger(CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), 0) ? seedString : ""); } UIWidgets::Tooltip("You can also press L on the Quest Select screen to generate a new seed"); ImGui::EndDisabled(); UIWidgets::Spacer(0); - if (!CVarGetInteger("gRandomizerDontGenerateSpoiler", 0)) { - std::string spoilerfilepath = CVarGetString("gSpoilerLog", ""); + if (!CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) { + std::string spoilerfilepath = CVarGetString(CVAR_GENERAL("SpoilerLog"), ""); ImGui::Text("Spoiler File: %s", spoilerfilepath.c_str()); } // RANDOTODO settings presets - // std::string presetfilepath = CVarGetString("gLoadedPreset", ""); + // std::string presetfilepath = CVarGetString(CVAR_RANDOMIZER_SETTING("LoadedPreset"), ""); // ImGui::Text("Settings File: %s", presetfilepath.c_str()); UIWidgets::PaddedSeparator(); - ImGui::BeginDisabled(CVarGetInteger("gDisableChangingSettings", 0)); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); ImGuiWindow* window = ImGui::GetCurrentWindow(); static ImVec2 cellPadding(8.0f, 8.0f); @@ -1815,10 +1816,10 @@ void RandomizerSettingsWindow::DrawElement() { ImGui::EndTabItem(); } - ImGui::BeginDisabled(CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); + ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); if (ImGui::BeginTabItem("Items")) { ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); - ImGui::BeginDisabled(CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); + ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); if (mSettings->GetOptionGroup(RSG_ITEMS_IMGUI_TABLE).RenderImGui()) { mNeedsUpdate = true; } @@ -1828,7 +1829,7 @@ void RandomizerSettingsWindow::DrawElement() { } ImGui::EndDisabled(); - ImGui::BeginDisabled(CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); + ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); if (ImGui::BeginTabItem("Gameplay")) { ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); if (mSettings->GetOptionGroup(RSG_GAMEPLAY_IMGUI_TABLE).RenderImGui()) { @@ -1839,7 +1840,7 @@ void RandomizerSettingsWindow::DrawElement() { } ImGui::EndDisabled(); - ImGui::BeginDisabled(CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); + ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); static bool locationsTabOpen = false; if (ImGui::BeginTabItem("Locations")) { ImGui::PushStyleVar(ImGuiStyleVar_CellPadding, cellPadding); @@ -1847,7 +1848,7 @@ void RandomizerSettingsWindow::DrawElement() { locationsTabOpen = true; RandomizerCheckObjects::UpdateImGuiVisibility(); // todo: this efficently when we build out cvar array support - std::stringstream excludedLocationStringStream(CVarGetString("gRandomizeExcludedLocations", "")); + std::stringstream excludedLocationStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), "")); std::string excludedLocationString; excludedLocations.clear(); while (getline(excludedLocationStringStream, excludedLocationString, ',')) { @@ -1897,8 +1898,8 @@ void RandomizerSettingsWindow::DrawElement() { excludedLocationString += std::to_string(excludedLocationIt); excludedLocationString += ","; } - CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str()); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), excludedLocationString.c_str()); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); ImGui::Text("%s", Rando::StaticData::GetLocation(location)->GetShortName().c_str()); @@ -1939,11 +1940,11 @@ void RandomizerSettingsWindow::DrawElement() { excludedLocationString += ","; } if (excludedLocationString == "") { - CVarClear("gRandomizeExcludedLocations"); + CVarClear(CVAR_RANDOMIZER_SETTING("ExcludedLocations")); } else { - CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str()); + CVarSetString(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), excludedLocationString.c_str()); } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); ImGui::Text("%s", Rando::StaticData::GetLocation(location)->GetShortName().c_str()); @@ -1970,13 +1971,13 @@ void RandomizerSettingsWindow::DrawElement() { tricksTabOpen = true; //RandomizerTricks::UpdateImGuiVisibility(); // todo: this efficently when we build out cvar array support - std::stringstream enabledTrickStringStream(CVarGetString("gRandomizeEnabledTricks", "")); + std::stringstream enabledTrickStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), "")); std::string enabledTrickString; enabledTricks.clear(); while (getline(enabledTrickStringStream, enabledTrickString, ',')) { enabledTricks.insert((RandomizerTrick)std::stoi(enabledTrickString)); } - std::stringstream enabledGlitchStringStream(CVarGetString("gRandomizeEnabledGlitches", "")); + std::stringstream enabledGlitchStringStream(CVarGetString(CVAR_RANDOMIZER_SETTING("EnabledGlitches"), "")); std::string enabledGlitchString; enabledGlitches.clear(); while (getline(enabledGlitchStringStream, enabledGlitchString, ',')) { @@ -1994,13 +1995,13 @@ void RandomizerSettingsWindow::DrawElement() { mNeedsUpdate = true; } // RANDOTODO: Implement Disalbling of Options for Vanilla Logic - if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_GLITCHLESS) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_GLITCHLESS) { ImGui::SameLine(); if (mSettings->GetOption(RSK_ALL_LOCATIONS_REACHABLE).RenderImGui()) { mNeedsUpdate = true; } } - if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA) { ImGui::SameLine(); ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "Heads up! This will disable all rando settings except for entrance shuffle and starter items"); } @@ -2015,7 +2016,7 @@ void RandomizerSettingsWindow::DrawElement() { ImGui::EndTable(); } - ImGui::BeginDisabled(CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); + ImGui::BeginDisabled(CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA); // Tricks static std::unordered_map areaTreeDisabled { @@ -2098,7 +2099,7 @@ void RandomizerSettingsWindow::DrawElement() { }; static ImGuiTextFilter trickSearch; trickSearch.Draw("Filter (inc,-exc)", 490.0f); - if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) != RO_LOGIC_NO_LOGIC) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) != RO_LOGIC_NO_LOGIC) { ImGui::SameLine(); if (ImGui::Button("Disable All")) { for (int i = 0; i < RT_MAX; i++) { @@ -2112,8 +2113,8 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += ","; } - CVarClear("gRandomizeEnabledTricks"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarClear(CVAR_RANDOMIZER_SETTING("EnabledTricks")); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); if (ImGui::Button("Enable All")) { @@ -2127,8 +2128,8 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += ","; } - CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str()); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } if (ImGui::BeginTable("trickTags", showTag.size(), ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders)) { @@ -2149,7 +2150,7 @@ void RandomizerSettingsWindow::DrawElement() { ImGui::PopItemFlag(); ImGui::TableNextRow(); - if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) != RO_LOGIC_NO_LOGIC) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) != RO_LOGIC_NO_LOGIC) { // COLUMN 1 - DISABLED TRICKS ImGui::TableNextColumn(); @@ -2190,8 +2191,8 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += ","; } - CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str()); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::BeginChild("ChildTricksDisabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar); @@ -2225,8 +2226,8 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += ","; } - CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str()); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } Rando::Tricks::DrawTagChips(option.GetTags()); ImGui::SameLine(); @@ -2284,8 +2285,8 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += ","; } - CVarClear("gRandomizeEnabledTricks"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarClear(CVAR_RANDOMIZER_SETTING("EnabledTricks")); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::BeginChild("ChildTricksEnabled", ImVec2(0, -8), false, ImGuiWindowFlags_HorizontalScrollbar); @@ -2320,11 +2321,11 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += ","; } if (enabledTrickString == "") { - CVarClear("gRandomizeEnabledTricks"); + CVarClear(CVAR_RANDOMIZER_SETTING("EnabledTricks")); } else { - CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); + CVarSetString(CVAR_RANDOMIZER_SETTING("EnabledTricks"), enabledTrickString.c_str()); } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } Rando::Tricks::DrawTagChips(option.GetTags()); ImGui::SameLine(); diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp index bbd4682ce..d6fc3fefd 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_objects.cpp @@ -5,6 +5,7 @@ #include #include #include "z64.h" +#include "soh/OTRGlobals.h" #include "fishsanity.h" std::map rcAreaNames = { @@ -111,36 +112,36 @@ void RandomizerCheckObjects::UpdateImGuiVisibility() { (location.GetRandomizerCheck() != RC_UNKNOWN_CHECK) && (!RandomizerCheckObjects::AreaIsDungeon(location.GetArea()) || location.GetQuest() == RCQUEST_BOTH || location.GetQuest() == RCQUEST_MQ && - ((CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_SET_NUMBER && - (CVarGetInteger("gRandomizeMqDungeonCount", 12) > 0) || // at least one MQ dungeon - CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_RANDOM_NUMBER)) || + ((CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeons"), RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_SET_NUMBER && + (CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeonCount"), 12) > 0) || // at least one MQ dungeon + CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeons"), RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_RANDOM_NUMBER)) || location.GetQuest() == RCQUEST_VANILLA && - (CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) != RO_MQ_DUNGEONS_SET_NUMBER || - CVarGetInteger("gRandomizeMqDungeonCount", 12) < 12) // at least one vanilla dungeon + (CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeons"), RO_MQ_DUNGEONS_NONE) != RO_MQ_DUNGEONS_SET_NUMBER || + CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeonCount"), 12) < 12) // at least one vanilla dungeon ) && (location.GetRCType() != RCTYPE_SHOP || - CVarGetInteger("gRandomizeShopsanity", RO_SHOPSANITY_OFF) > RO_SHOPSANITY_ZERO_ITEMS) && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_OFF) > RO_SHOPSANITY_ZERO_ITEMS) && (location.GetRCType() != RCTYPE_SCRUB || - CVarGetInteger("gRandomizeShuffleScrubs", RO_SCRUBS_OFF) != RO_SCRUBS_OFF || + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), RO_SCRUBS_OFF) != RO_SCRUBS_OFF || location.GetRandomizerCheck() == RC_HF_DEKU_SCRUB_GROTTO || location.GetRandomizerCheck() == RC_LW_DEKU_SCRUB_GROTTO_FRONT || location.GetRandomizerCheck() == RC_LW_DEKU_SCRUB_NEAR_BRIDGE) && // The 3 scrubs that are always randomized (location.GetRCType() != RCTYPE_MERCHANT || - CVarGetInteger("gRandomizeShuffleMerchants", RO_SHUFFLE_MERCHANTS_OFF) != RO_SHUFFLE_MERCHANTS_OFF) && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleMerchants"), RO_SHUFFLE_MERCHANTS_OFF) != RO_SHUFFLE_MERCHANTS_OFF) && (location.GetRCType() != RCTYPE_SONG_LOCATION || - CVarGetInteger("gRandomizeShuffleSongs", RO_SONG_SHUFFLE_SONG_LOCATIONS) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleSongs"), RO_SONG_SHUFFLE_SONG_LOCATIONS) != RO_SONG_SHUFFLE_SONG_LOCATIONS) && // song locations ((location.GetRCType() != RCTYPE_BOSS_HEART_OR_OTHER_REWARD && location.GetRandomizerCheck() != RC_SONG_FROM_IMPA && location.GetRandomizerCheck() != RC_SHEIK_IN_ICE_CAVERN) || - CVarGetInteger("gRandomizeShuffleSongs", RO_SONG_SHUFFLE_SONG_LOCATIONS) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleSongs"), RO_SONG_SHUFFLE_SONG_LOCATIONS) != RO_SONG_SHUFFLE_DUNGEON_REWARDS) && // song dungeon rewards (location.GetRCType() != RCTYPE_DUNGEON_REWARD || - CVarGetInteger("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleDungeonReward"), RO_DUNGEON_REWARDS_END_OF_DUNGEON) != RO_DUNGEON_REWARDS_END_OF_DUNGEON) && // dungeon rewards end of dungeons (location.GetRCType() != RCTYPE_OCARINA || - CVarGetInteger("gRandomizeShuffleOcarinas", RO_GENERIC_NO)) && // ocarina locations + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), RO_GENERIC_NO)) && // ocarina locations (location.GetRandomizerCheck() != RC_HC_ZELDAS_LETTER) && // don't show until we support shuffling letter (location.GetRCType() != RCTYPE_GOSSIP_STONE) && // don't show gossip stones (maybe gossipsanity will be a thing eventually?) @@ -148,63 +149,63 @@ void RandomizerCheckObjects::UpdateImGuiVisibility() { (location.GetRCType() != RCTYPE_CHEST_GAME) && // don't show non final reward chest game checks until we support shuffling them (location.GetRCType() != RCTYPE_SKULL_TOKEN || - (CVarGetInteger("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_ALL) || - ((CVarGetInteger("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_OVERWORLD) && + (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_OFF) == RO_TOKENSANITY_ALL) || + ((CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_OFF) == RO_TOKENSANITY_OVERWORLD) && RandomizerCheckObjects::AreaIsOverworld(location.GetArea())) || - ((CVarGetInteger("gRandomizeShuffleTokens", RO_TOKENSANITY_OFF) == RO_TOKENSANITY_DUNGEONS) && + ((CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleTokens"), RO_TOKENSANITY_OFF) == RO_TOKENSANITY_DUNGEONS) && RandomizerCheckObjects::AreaIsDungeon(location.GetArea()))) && - (location.GetRCType() != RCTYPE_BEEHIVE || CVarGetInteger("gRandomizeShuffleBeehives", RO_GENERIC_NO)) && - (location.GetRCType() != RCTYPE_COW || CVarGetInteger("gRandomizeShuffleCows", RO_GENERIC_NO)) && + (location.GetRCType() != RCTYPE_BEEHIVE || CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleBeehives"), RO_GENERIC_NO)) && + (location.GetRCType() != RCTYPE_COW || CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleCows"), RO_GENERIC_NO)) && (location.GetRCType() != RCTYPE_FISH || ctx->GetFishsanity()->GetFishLocationIncluded(&location, FSO_SOURCE_CVARS)) && (location.GetRCType() != RCTYPE_ADULT_TRADE || - CVarGetInteger("gRandomizeShuffleAdultTrade", RO_GENERIC_NO)) && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), RO_GENERIC_NO)) && (location.GetRandomizerCheck() != RC_KF_KOKIRI_SWORD_CHEST || - CVarGetInteger("gRandomizeShuffleKokiriSword", RO_GENERIC_NO)) && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), RO_GENERIC_NO)) && (location.GetRandomizerCheck() != RC_ZR_MAGIC_BEAN_SALESMAN || - CVarGetInteger("gRandomizeShuffleBeans", RO_GENERIC_NO)) && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleBeans"), RO_GENERIC_NO)) && (location.GetRandomizerCheck() != RC_HC_MALON_EGG || - CVarGetInteger("gRandomizeShuffleWeirdEgg", RO_GENERIC_NO)) && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleWeirdEgg"), RO_GENERIC_NO)) && (location.GetRCType() != RCTYPE_FROG_SONG || - CVarGetInteger("gRandomizeShuffleFrogSongRupees", RO_GENERIC_NO)) && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleFrogSongRupees"), RO_GENERIC_NO)) && (location.GetRCType() != RCTYPE_MAP_COMPASS || - CVarGetInteger("gRandomizeStartingMapsCompasses", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) && (location.GetRCType() != RCTYPE_SMALL_KEY || - CVarGetInteger("gRandomizeKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) && (location.GetRCType() != RCTYPE_BOSS_KEY || - CVarGetInteger("gRandomizeBossKeysanity", RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON) != RO_DUNGEON_ITEM_LOC_VANILLA) && (location.GetRCType() != RCTYPE_GANON_BOSS_KEY || - CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) != RO_GANON_BOSS_KEY_VANILLA) && // vanilla ganon boss key (location.GetRandomizerCheck() != RC_TOT_LIGHT_ARROWS_CUTSCENE || - (CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != + (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) != RO_GANON_BOSS_KEY_LACS_DUNGEONS && - CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) != RO_GANON_BOSS_KEY_LACS_MEDALLIONS && - CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) != RO_GANON_BOSS_KEY_LACS_REWARDS && - CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) != RO_GANON_BOSS_KEY_LACS_STONES && - CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) != RO_GANON_BOSS_KEY_LACS_TOKENS && - CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) != RO_GANON_BOSS_KEY_LACS_VANILLA)) && // LACS ganon boss key (location.GetRandomizerCheck() != RC_KAK_100_GOLD_SKULLTULA_REWARD || - CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) != + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) != RO_GANON_BOSS_KEY_KAK_TOKENS) && // 100 skull reward ganon boss key (location.GetRCType() != RCTYPE_GF_KEY && location.GetRandomizerCheck() != RC_GF_GERUDO_MEMBERSHIP_CARD || - (CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_OPEN && + (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) == RO_GF_OPEN && location.GetRCType() != RCTYPE_GF_KEY && location.GetRandomizerCheck() != RC_GF_GERUDO_MEMBERSHIP_CARD) || - (CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_FAST && + (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) == RO_GF_FAST && ((location.GetRandomizerCheck() == RC_GF_GERUDO_MEMBERSHIP_CARD && - CVarGetInteger("gRandomizeShuffleGerudoToken", RO_GENERIC_NO) == RO_GENERIC_YES) || + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), RO_GENERIC_NO) == RO_GENERIC_YES) || (location.GetRandomizerCheck() == RC_GF_NORTH_F1_CARPENTER && - CVarGetInteger("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA))) || - (CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_NORMAL && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA))) || + (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) == RO_GF_NORMAL && ((location.GetRandomizerCheck() == RC_GF_GERUDO_MEMBERSHIP_CARD && - CVarGetInteger("gRandomizeShuffleGerudoToken", RO_GENERIC_NO) == RO_GENERIC_YES) || + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), RO_GENERIC_NO) == RO_GENERIC_YES) || (location.GetRCType() == RCTYPE_GF_KEY && - CVarGetInteger("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA))))); + CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA))))); } } diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 1a78e8c5c..772d4d747 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -37,9 +37,9 @@ using json = nlohmann::json; void to_json(json& j, const RandomizerCheckTrackerData& rctd) { j = json { - { "status", rctd.status == RCSHOW_COLLECTED ? RCSHOW_SAVED : rctd.status }, - { "skipped", rctd.skipped }, - { "price", rctd.price }, + { "status", rctd.status == RCSHOW_COLLECTED ? RCSHOW_SAVED : rctd.status }, + { "skipped", rctd.skipped }, + { "price", rctd.price }, { "hintItem", rctd.hintItem }}; } @@ -144,6 +144,8 @@ RandomizerCheckArea currentArea = RCAREA_INVALID; OSContPad* trackerButtonsPressed; std::unordered_map checkNameOverrides; +bool passesTextFilter(ImGuiTextFilter& checkSearch, const RandomizerCheck check); +bool shouldHideArea(ImGuiTextFilter& checkSearch, std::map> checksByArea, const RandomizerCheckArea rcArea); void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flags = 0); bool CompareChecks(RandomizerCheck, RandomizerCheck); bool CheckByArea(RandomizerCheckArea); @@ -458,7 +460,7 @@ bool HasItemBeenCollected(RandomizerCheck rc) { case SpoilerCollectionCheckType::SPOILER_CHK_GRAVEDIGGER: // Gravedigger has a fix in place that means one of two save locations. Check both. return (gSaveContext.itemGetInf[1] & 0x1000) || // vanilla flag - ((IS_RANDO || CVarGetInteger("gGravediggingTourFix", 0)) && + ((IS_RANDO || CVarGetInteger(CVAR_ENHANCEMENT("GravediggingTourFix"), 0)) && gSaveContext.sceneFlags[scene].collect & (1 << flag) || (gPlayState->actorCtx.flags.collect & (1 << flag))); // rando/fix flag default: return false; @@ -864,12 +866,12 @@ void SetAreaSpoiled(RandomizerCheckArea rcArea) { void UpdateCheck(uint32_t check, RandomizerCheckTrackerData data) { auto area = Rando::StaticData::GetLocation(static_cast(check))->GetArea(); - if ((!gSaveContext.checkTrackerData[check].skipped && data.skipped) || - ((gSaveContext.checkTrackerData[check].status != RCSHOW_COLLECTED && gSaveContext.checkTrackerData[check].status != RCSHOW_SAVED) && + if ((!gSaveContext.checkTrackerData[check].skipped && data.skipped) || + ((gSaveContext.checkTrackerData[check].status != RCSHOW_COLLECTED && gSaveContext.checkTrackerData[check].status != RCSHOW_SAVED) && (data.status == RCSHOW_COLLECTED || data.status == RCSHOW_SAVED))) { areaChecksGotten[area]++; - } else if ((gSaveContext.checkTrackerData[check].skipped && !data.skipped) || - ((gSaveContext.checkTrackerData[check].status == RCSHOW_COLLECTED || gSaveContext.checkTrackerData[check].status == RCSHOW_SAVED) && + } else if ((gSaveContext.checkTrackerData[check].skipped && !data.skipped) || + ((gSaveContext.checkTrackerData[check].status == RCSHOW_COLLECTED || gSaveContext.checkTrackerData[check].status == RCSHOW_SAVED) && (data.status != RCSHOW_COLLECTED && data.status != RCSHOW_SAVED))) { areaChecksGotten[area]--; } @@ -880,15 +882,15 @@ void UpdateCheck(uint32_t check, RandomizerCheckTrackerData data) { void CheckTrackerWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver); - if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { - if (CVarGetInteger("gCheckTrackerShowOnlyPaused", 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) { + if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { + if (CVarGetInteger(CVAR_TRACKER_CHECK("ShowOnlyPaused"), 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) { return; } - if (CVarGetInteger("gCheckTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { - int comboButton1Mask = buttons[CVarGetInteger("gCheckTrackerComboButton1", TRACKER_COMBO_BUTTON_L)]; - int comboButton2Mask = buttons[CVarGetInteger("gCheckTrackerComboButton2", TRACKER_COMBO_BUTTON_R)]; - OSContPad* trackerButtonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads(); + if (CVarGetInteger(CVAR_TRACKER_CHECK("DisplayType"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { + int comboButton1Mask = buttons[CVarGetInteger(CVAR_TRACKER_CHECK("ComboButton1"), TRACKER_COMBO_BUTTON_L)]; + int comboButton2Mask = buttons[CVarGetInteger(CVAR_TRACKER_CHECK("ComboButton2"), TRACKER_COMBO_BUTTON_R)]; + OSContPad* trackerButtonsPressed = Ship::Context::GetInstance()->GetControlDeck()->GetPads(); bool comboButtonsHeld = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & comboButton1Mask && trackerButtonsPressed[0].button & comboButton2Mask; @@ -927,7 +929,7 @@ void CheckTrackerWindow::DrawElement() { ImGui::TableNextRow(0, headerHeight); ImGui::TableNextColumn(); UIWidgets::EnhancementCheckbox( - "Show Hidden Items", "gCheckTrackerOptionShowHidden", false, + "Show Hidden Items", CVAR_TRACKER_CHECK("ShowHidden"), false, "When active, items will show hidden checks by default when updated to this state."); UIWidgets::PaddedSeparator(); if (ImGui::Button("Expand All")) { @@ -940,6 +942,14 @@ void CheckTrackerWindow::DrawElement() { optExpandAll = false; optCollapseAll = true; } + ImGui::SameLine(); + static ImGuiTextFilter checkSearch; + if (ImGui::Button("Clear")) { + checkSearch.Clear(); + } + UIWidgets::Tooltip("Clear the search field"); + checkSearch.Draw(); + UIWidgets::PaddedSeparator(); //Checks Section Lead-in @@ -958,17 +968,17 @@ void CheckTrackerWindow::DrawElement() { RainbowTick(); bool doDraw = false; bool thisAreaFullyChecked = false; - bool showHidden = CVarGetInteger("gCheckTrackerOptionShowHidden", 0); - bool hideIncomplete = CVarGetInteger("gCheckTrackerAreaIncompleteHide", 0); - bool hideComplete = CVarGetInteger("gCheckTrackerAreaCompleteHide", 0); + bool showHidden = CVarGetInteger(CVAR_TRACKER_CHECK("ShowHidden"), 0); + bool hideIncomplete = CVarGetInteger(CVAR_TRACKER_CHECK("AreaIncomplete.Hide"), 0); + bool hideComplete = CVarGetInteger(CVAR_TRACKER_CHECK("AreaComplete.Hide"), 0); bool collapseLogic; bool doingCollapseOrExpand = optExpandAll || optCollapseAll; bool isThisAreaSpoiled; RandomizerCheckArea lastArea = RCAREA_INVALID; - Color_RGBA8 areaCompleteColor = CVarGetColor("gCheckTrackerAreaMainCompleteColor", Color_Main_Default); - Color_RGBA8 areaIncompleteColor = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default); - Color_RGBA8 extraCompleteColor = CVarGetColor("gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Extra_Default); - Color_RGBA8 extraIncompleteColor = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default); + Color_RGBA8 areaCompleteColor = CVarGetColor(CVAR_TRACKER_CHECK("AreaComplete.MainColor"), Color_Main_Default); + Color_RGBA8 areaIncompleteColor = CVarGetColor(CVAR_TRACKER_CHECK("AreaIncomplete.MainColor"), Color_Main_Default); + Color_RGBA8 extraCompleteColor = CVarGetColor(CVAR_TRACKER_CHECK("AreaComplete.ExtraColor"), Color_Area_Complete_Extra_Default); + Color_RGBA8 extraIncompleteColor = CVarGetColor(CVAR_TRACKER_CHECK("AreaIncomplete.ExtraColor"), Color_Area_Incomplete_Extra_Default); Color_RGBA8 mainColor; Color_RGBA8 extraColor; std::string stemp; @@ -986,10 +996,9 @@ void CheckTrackerWindow::DrawElement() { previousShowHidden = showHidden; doAreaScroll = true; } - if (!showHidden && ( - hideComplete && thisAreaFullyChecked || - hideIncomplete && !thisAreaFullyChecked - )) { + if (shouldHideArea(checkSearch, checksByArea, rcArea) || + (!showHidden && ((hideComplete && thisAreaFullyChecked) || (hideIncomplete && !thisAreaFullyChecked))) + ) { doDraw = false; } else { //Get the colour for the area @@ -1024,7 +1033,7 @@ void CheckTrackerWindow::DrawElement() { ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(extraColor.r / 255.0f, extraColor.g / 255.0f, extraColor.b / 255.0f, extraColor.a / 255.0f)); - isThisAreaSpoiled = IsAreaSpoiled(rcArea) || CVarGetInteger("gCheckTrackerOptionMQSpoilers", 0); + isThisAreaSpoiled = IsAreaSpoiled(rcArea) || CVarGetInteger(CVAR_TRACKER_CHECK("MQSpoilers"), 0); if (isThisAreaSpoiled) { if (showVOrMQ && RandomizerCheckObjects::AreaIsDungeon(rcArea)) { @@ -1047,10 +1056,11 @@ void CheckTrackerWindow::DrawElement() { doAreaScroll = false; } for (auto rc : checks) { - if (doDraw && isThisAreaSpoiled && IsVisibleInCheckTracker(rc)) { + if (doDraw && isThisAreaSpoiled && IsVisibleInCheckTracker(rc) && passesTextFilter(checkSearch, rc)) { DrawLocation(rc); } } + if (doDraw) { ImGui::TreePop(); } @@ -1066,6 +1076,28 @@ void CheckTrackerWindow::DrawElement() { } } +bool shouldHideArea(ImGuiTextFilter& checkSearch, std::map> checksByArea, RandomizerCheckArea rcArea) { + bool shouldHideFilteredAreas = CVarGetInteger(CVAR_TRACKER_CHECK("HideFilteredAreas"), 1); + if (!shouldHideFilteredAreas) { + return false; + } + + for (auto check : checksByArea[rcArea]) { + if (IsVisibleInCheckTracker(check) && passesTextFilter(checkSearch, check)) { + return false; + } + } + + return true; +} + +bool passesTextFilter(ImGuiTextFilter& checkSearch, RandomizerCheck check) { + return ( + checkSearch.PassFilter(RandomizerCheckObjects::GetRCAreaName(Rando::StaticData::GetLocation(check)->GetArea()).c_str()) || + checkSearch.PassFilter(Rando::StaticData::GetLocation(check)->GetShortName().c_str()) + ); +} + // Windowing stuff void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flags) { ImGuiWindowFlags windowFlags = flags; @@ -1075,12 +1107,12 @@ void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flag ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoFocusOnAppearing; } - if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { + if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID); windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar; - if (!CVarGetInteger("gCheckTrackerHudEditMode", 0)) { + if (!CVarGetInteger(CVAR_TRACKER_CHECK("Draggable"), 0)) { windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove; } } @@ -1354,10 +1386,10 @@ bool IsHeartPiece(GetItemID giid) { } void DrawLocation(RandomizerCheck rc) { - Color_RGBA8 mainColor; + Color_RGBA8 mainColor; Color_RGBA8 extraColor; std::string txt; - bool showHidden = CVarGetInteger("gCheckTrackerOptionShowHidden", 0); + bool showHidden = CVarGetInteger(CVAR_TRACKER_CHECK("ShowHidden"), 0); Rando::Location* loc = Rando::StaticData::GetLocation(rc); Rando::ItemLocation* itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); RandomizerCheckTrackerData checkData = gSaveContext.checkTrackerData[rc]; @@ -1369,61 +1401,61 @@ void DrawLocation(RandomizerCheck rc) { bool skipped = checkData.skipped; if (status == RCSHOW_COLLECTED) { - if (!showHidden && CVarGetInteger("gCheckTrackerCollectedHide", 0)) { + if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Collected.Hide"), 0)) { return; } mainColor = !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO - ? CVarGetColor("gCheckTrackerCollectedExtraColor", Color_Collected_Extra_Default) - : CVarGetColor("gCheckTrackerCollectedMainColor", Color_Main_Default); - extraColor = CVarGetColor("gCheckTrackerCollectedExtraColor", Color_Collected_Extra_Default); + ? CVarGetColor(CVAR_TRACKER_CHECK("Collected.ExtraColor"), Color_Collected_Extra_Default) + : CVarGetColor(CVAR_TRACKER_CHECK("Collected.MainColor"), Color_Main_Default); + extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Collected.ExtraColor"), Color_Collected_Extra_Default); } else if (status == RCSHOW_SAVED) { - if (!showHidden && CVarGetInteger("gCheckTrackerSavedHide", 0)) { + if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Saved.Hide"), 0)) { return; } mainColor = !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO - ? CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default) - : CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default); - extraColor = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default); + ? CVarGetColor(CVAR_TRACKER_CHECK("Saved.ExtraColor"), Color_Saved_Extra_Default) + : CVarGetColor(CVAR_TRACKER_CHECK("Saved.MainColor"), Color_Main_Default); + extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Saved.ExtraColor"), Color_Saved_Extra_Default); } else if (skipped) { - if (!showHidden && CVarGetInteger("gCheckTrackerSkippedHide", 0)) { + if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Skipped.Hide"), 0)) { return; } mainColor = !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO - ? CVarGetColor("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default) - : CVarGetColor("gCheckTrackerSkippedMainColor", Color_Main_Default); - extraColor = CVarGetColor("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default); + ? CVarGetColor(CVAR_TRACKER_CHECK("Skipped.ExtraColor"), Color_Skipped_Extra_Default) + : CVarGetColor(CVAR_TRACKER_CHECK("Skipped.MainColor"), Color_Main_Default); + extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Skipped.ExtraColor"), Color_Skipped_Extra_Default); } else if (status == RCSHOW_SEEN || status == RCSHOW_IDENTIFIED) { - if (!showHidden && CVarGetInteger("gCheckTrackerSeenHide", 0)) { + if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Seen.Hide"), 0)) { return; } mainColor = !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO - ? CVarGetColor("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default) - : CVarGetColor("gCheckTrackerSeenMainColor", Color_Main_Default); - extraColor = CVarGetColor("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default); + ? CVarGetColor(CVAR_TRACKER_CHECK("Seen.ExtraColor"), Color_Seen_Extra_Default) + : CVarGetColor(CVAR_TRACKER_CHECK("Seen.MainColor"), Color_Main_Default); + extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Seen.ExtraColor"), Color_Seen_Extra_Default); } else if (status == RCSHOW_SCUMMED) { - if (!showHidden && CVarGetInteger("gCheckTrackerScummedHide", 0)) { + if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Scummed.Hide"), 0)) { return; } mainColor = !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO - ? CVarGetColor("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default) - : CVarGetColor("gCheckTrackerScummedMainColor", Color_Main_Default); - extraColor = CVarGetColor("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default); + ? CVarGetColor(CVAR_TRACKER_CHECK("Scummed.ExtraColor"), Color_Scummed_Extra_Default) + : CVarGetColor(CVAR_TRACKER_CHECK("Scummed.MainColor"), Color_Main_Default); + extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Scummed.ExtraColor"), Color_Scummed_Extra_Default); } else if (status == RCSHOW_UNCHECKED) { - if (!showHidden && CVarGetInteger("gCheckTrackerUncheckedHide", 0)) { + if (!showHidden && CVarGetInteger(CVAR_TRACKER_CHECK("Unchecked.Hide"), 0)) { return; } mainColor = !IsHeartPiece((GetItemID)Rando::StaticData::RetrieveItem(loc->GetVanillaItem()).GetItemID()) && !IS_RANDO - ? CVarGetColor("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default) - : CVarGetColor("gCheckTrackerUncheckedMainColor", Color_Main_Default); - extraColor = CVarGetColor("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default); + ? CVarGetColor(CVAR_TRACKER_CHECK("Unchecked.ExtraColor"), Color_Unchecked_Extra_Default) + : CVarGetColor(CVAR_TRACKER_CHECK("Unchecked.MainColor"), Color_Main_Default); + extraColor = CVarGetColor(CVAR_TRACKER_CHECK("Unchecked.ExtraColor"), Color_Unchecked_Extra_Default); } - + //Main Text if (checkNameOverrides.contains(loc->GetRandomizerCheck())) { txt = checkNameOverrides[loc->GetRandomizerCheck()]; @@ -1434,7 +1466,7 @@ void DrawLocation(RandomizerCheck rc) { if (lastLocationChecked == loc->GetRandomizerCheck()) { txt = "* " + txt; } - + // Draw button - for Skipped/Seen/Scummed/Unchecked only if (status == RCSHOW_UNCHECKED || status == RCSHOW_SEEN || status == RCSHOW_IDENTIFIED || status == RCSHOW_SCUMMED || skipped) { if (UIWidgets::StateButton(std::to_string(rc).c_str(), skipped ? ICON_FA_PLUS : ICON_FA_TIMES)) { @@ -1521,31 +1553,31 @@ void DrawLocation(RandomizerCheck rc) { } static std::set rainbowCVars = { - "gCheckTrackerAreaMainIncompleteColor", "gCheckTrackerAreaExtraIncompleteColor", - "gCheckTrackerAreaMainCompleteColor", "gCheckTrackerAreaExtraCompleteColor", - "gCheckTrackerUncheckedMainColor", "gCheckTrackerUncheckedExtraColor", - "gCheckTrackerSkippedMainColor", "gCheckTrackerSkippedExtraColor", - "gCheckTrackerSeenMainColor", "gCheckTrackerSeenExtraColor", - "gCheckTrackerHintedMainColor", "gCheckTrackerHintedExtraColor", - "gCheckTrackerCollectedMainColor", "gCheckTrackerCollectedExtraColor", - "gCheckTrackerScummedMainColor", "gCheckTrackerScummedExtraColor", - "gCheckTrackerSavedMainColor", "gCheckTrackerSavedExtraColor", + CVAR_TRACKER_CHECK("AreaIncomplete.MainColor"), CVAR_TRACKER_CHECK("AreaIncomplete.ExtraColor"), + CVAR_TRACKER_CHECK("AreaComplete.MainColor"), CVAR_TRACKER_CHECK("AreaComplete.ExtraColor"), + CVAR_TRACKER_CHECK("Unchecked.MainColor"), CVAR_TRACKER_CHECK("Unchecked.ExtraColor"), + CVAR_TRACKER_CHECK("Skipped.MainColor"), CVAR_TRACKER_CHECK("Skipped.ExtraColor"), + CVAR_TRACKER_CHECK("Seen.MainColor"), CVAR_TRACKER_CHECK("Seen.ExtraColor"), + CVAR_TRACKER_CHECK("Hinted.MainColor"), CVAR_TRACKER_CHECK("Hinted.ExtraColor"), + CVAR_TRACKER_CHECK("Collected.MainColor"), CVAR_TRACKER_CHECK("Collected.ExtraColor"), + CVAR_TRACKER_CHECK("Scummed.MainColor"), CVAR_TRACKER_CHECK("Scummed.ExtraColor"), + CVAR_TRACKER_CHECK("Saved.MainColor"), CVAR_TRACKER_CHECK("Saved.ExtraColor"), }; int hue = 0; void RainbowTick() { - float freqHue = hue * 2 * M_PI / (360 * CVarGetFloat("gCosmetics.RainbowSpeed", 0.6f)); + float freqHue = hue * 2 * M_PI / (360 * CVarGetFloat(CVAR_COSMETIC("RainbowSpeed"), 0.6f)); for (auto& cvar : rainbowCVars) { if (CVarGetInteger((cvar + "RBM").c_str(), 0) == 0) { continue; } - + Color_RGBA8 newColor; newColor.r = sin(freqHue + 0) * 127 + 128; newColor.g = sin(freqHue + (2 * M_PI / 3)) * 127 + 128; newColor.b = sin(freqHue + (4 * M_PI / 3)) * 127 + 128; newColor.a = 255; - + CVarSetColor(cvar.c_str(), newColor); } @@ -1582,7 +1614,7 @@ void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName, main_color = CVarGetColor(cvarMainName, main_default_color); }; ImGui::PopItemWidth(); - + ImGui::TableNextColumn(); ImGui::AlignTextToFramePadding(); ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); @@ -1624,49 +1656,54 @@ void CheckTrackerSettingsWindow::DrawElement() { ImGui::TableNextRow(); ImGui::TableNextColumn(); ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); - if (UIWidgets::EnhancementColor("BG Color", "gCheckTrackerBgColor", + if (UIWidgets::EnhancementColor("BG Color", CVAR_TRACKER_CHECK("BgColor"), ImVec4(Color_Background.r, Color_Background.g, Color_Background.b, Color_Background.a), ImVec4(Color_Bg_Default.r, Color_Bg_Default.g, Color_Bg_Default.b, Color_Bg_Default.a), false, true)) { - Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default); + Color_Background = CVarGetColor(CVAR_TRACKER_CHECK("BgColor"), Color_Bg_Default); } ImGui::PopItemWidth(); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", "gCheckTrackerWindowType", windowType, TRACKER_WINDOW_WINDOW); - if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { - UIWidgets::EnhancementCheckbox("Enable Dragging", "gCheckTrackerHudEditMode"); - UIWidgets::EnhancementCheckbox("Only enable while paused", "gCheckTrackerShowOnlyPaused"); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", "gCheckTrackerDisplayType", displayType, 0); - if (CVarGetInteger("gCheckTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { - UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", "gCheckTrackerComboButton1", buttonStrings, TRACKER_COMBO_BUTTON_L); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", "gCheckTrackerComboButton2", buttonStrings, TRACKER_COMBO_BUTTON_R); + UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", CVAR_TRACKER_CHECK("WindowType"), windowType, TRACKER_WINDOW_WINDOW); + if (CVarGetInteger(CVAR_TRACKER_CHECK("WindowType"), TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { + UIWidgets::EnhancementCheckbox("Enable Dragging", CVAR_TRACKER_CHECK("Draggable")); + UIWidgets::EnhancementCheckbox("Only enable while paused", CVAR_TRACKER_CHECK("ShowOnlyPaused")); + UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", CVAR_TRACKER_CHECK("DisplayType"), displayType, 0); + if (CVarGetInteger(CVAR_TRACKER_CHECK("DisplayType"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { + UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", CVAR_TRACKER_CHECK("ComboButton1"), buttonStrings, TRACKER_COMBO_BUTTON_L); + UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", CVAR_TRACKER_CHECK("ComboButton2"), buttonStrings, TRACKER_COMBO_BUTTON_R); } } - UIWidgets::EnhancementCheckbox("Vanilla/MQ Dungeon Spoilers", "gCheckTrackerOptionMQSpoilers"); + UIWidgets::EnhancementCheckbox("Vanilla/MQ Dungeon Spoilers", CVAR_TRACKER_CHECK("MQSpoilers")); UIWidgets::Tooltip("If enabled, Vanilla/MQ dungeons will show on the tracker immediately. Otherwise, Vanilla/MQ dungeon locations must be unlocked."); - if (UIWidgets::EnhancementCheckbox("Hide right-side shop item checks", "gCheckTrackerOptionHideRightShopChecks", false, "", UIWidgets::CheckboxGraphics::Cross, true)) { + if (UIWidgets::EnhancementCheckbox("Hide right-side shop item checks", CVAR_TRACKER_CHECK("HideRightShopChecks"), false, "", UIWidgets::CheckboxGraphics::Cross, true)) { hideShopRightChecks = !hideShopRightChecks; RecalculateAreaTotals(); } UIWidgets::Tooltip("If enabled, will prevent the tracker from displaying slots 1-4 in all shops."); - if (UIWidgets::EnhancementCheckbox("Always show gold skulltulas", "gCheckTrackerOptionAlwaysShowGSLocs", false, "")) { + if (UIWidgets::EnhancementCheckbox("Always show gold skulltulas", CVAR_TRACKER_CHECK("AlwaysShowGSLocs"), false, "")) { alwaysShowGS = !alwaysShowGS; RecalculateAreaTotals(); } UIWidgets::Tooltip("If enabled, will show GS locations in the tracker regardless of tokensanity settings."); + // Filtering settings + UIWidgets::PaddedSeparator(); + UIWidgets::EnhancementCheckbox("Filter Empty Areas", CVAR_TRACKER_CHECK("HideFilteredAreas"), false, "", UIWidgets::CheckboxGraphics::Checkmark, true); + UIWidgets::Tooltip("If enabled, will hide area headers that have no locations matching filter"); + ImGui::TableNextColumn(); - CheckTracker::ImGuiDrawTwoColorPickerSection("Area Incomplete", "gCheckTrackerAreaMainIncompleteColor", "gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Main, Color_Area_Incomplete_Extra, Color_Main_Default, Color_Area_Incomplete_Extra_Default, "gCheckTrackerAreaIncompleteHide", ""); - CheckTracker::ImGuiDrawTwoColorPickerSection("Area Complete", "gCheckTrackerAreaMainCompleteColor", "gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Main, Color_Area_Complete_Extra, Color_Main_Default, Color_Area_Complete_Extra_Default, "gCheckTrackerAreaCompleteHide", ""); - CheckTracker::ImGuiDrawTwoColorPickerSection("Unchecked", "gCheckTrackerUncheckedMainColor", "gCheckTrackerUncheckedExtraColor", Color_Unchecked_Main, Color_Unchecked_Extra, Color_Main_Default, Color_Unchecked_Extra_Default, "gCheckTrackerUncheckedHide", "Checks you have not interacted with at all."); - CheckTracker::ImGuiDrawTwoColorPickerSection("Skipped", "gCheckTrackerSkippedMainColor", "gCheckTrackerSkippedExtraColor", Color_Skipped_Main, Color_Skipped_Extra, Color_Main_Default, Color_Skipped_Extra_Default, "gCheckTrackerSkippedHide", ""); - CheckTracker::ImGuiDrawTwoColorPickerSection("Seen", "gCheckTrackerSeenMainColor", "gCheckTrackerSeenExtraColor", Color_Seen_Main, Color_Seen_Extra, Color_Main_Default, Color_Seen_Extra_Default, "gCheckTrackerSeenHide", "Used for shops. Shows item names for shop slots when walking in, and prices when highlighting them in buy mode."); - CheckTracker::ImGuiDrawTwoColorPickerSection("Scummed", "gCheckTrackerScummedMainColor", "gCheckTrackerScummedExtraColor", Color_Scummed_Main, Color_Scummed_Extra, Color_Main_Default, Color_Scummed_Extra_Default, "gCheckTrackerScummedHide", "Checks you collect, but then reload before saving so you no longer have them."); - //CheckTracker::ImGuiDrawTwoColorPickerSection("Hinted (WIP)", "gCheckTrackerHintedMainColor", "gCheckTrackerHintedExtraColor", Color_Hinted_Main, Color_Hinted_Extra, Color_Main_Default, Color_Hinted_Extra_Default, "gCheckTrackerHintedHide", ""); - CheckTracker::ImGuiDrawTwoColorPickerSection("Collected", "gCheckTrackerCollectedMainColor", "gCheckTrackerCollectedExtraColor", Color_Collected_Main, Color_Collected_Extra, Color_Main_Default, Color_Collected_Extra_Default, "gCheckTrackerCollectedHide", "Checks you have collected without saving or reloading yet."); - CheckTracker::ImGuiDrawTwoColorPickerSection("Saved", "gCheckTrackerSavedMainColor", "gCheckTrackerSavedExtraColor", Color_Saved_Main, Color_Saved_Extra, Color_Main_Default, Color_Saved_Extra_Default, "gCheckTrackerSavedHide", "Checks that you saved the game while having collected."); + CheckTracker::ImGuiDrawTwoColorPickerSection("Area Incomplete", CVAR_TRACKER_CHECK("AreaIncomplete.MainColor"), CVAR_TRACKER_CHECK("AreaIncomplete.ExtraColor"), Color_Area_Incomplete_Main, Color_Area_Incomplete_Extra, Color_Main_Default, Color_Area_Incomplete_Extra_Default, CVAR_TRACKER_CHECK("AreaIncomplete.Hide"), ""); + CheckTracker::ImGuiDrawTwoColorPickerSection("Area Complete", CVAR_TRACKER_CHECK("AreaComplete.MainColor"), CVAR_TRACKER_CHECK("AreaComplete.ExtraColor"), Color_Area_Complete_Main, Color_Area_Complete_Extra, Color_Main_Default, Color_Area_Complete_Extra_Default, CVAR_TRACKER_CHECK("AreaComplete.Hide"), ""); + CheckTracker::ImGuiDrawTwoColorPickerSection("Unchecked", CVAR_TRACKER_CHECK("Unchecked.MainColor"), CVAR_TRACKER_CHECK("Unchecked.ExtraColor"), Color_Unchecked_Main, Color_Unchecked_Extra, Color_Main_Default, Color_Unchecked_Extra_Default, CVAR_TRACKER_CHECK("Unchecked.Hide"), "Checks you have not interacted with at all."); + CheckTracker::ImGuiDrawTwoColorPickerSection("Skipped", CVAR_TRACKER_CHECK("Skipped.MainColor"), CVAR_TRACKER_CHECK("Skipped.ExtraColor"), Color_Skipped_Main, Color_Skipped_Extra, Color_Main_Default, Color_Skipped_Extra_Default, CVAR_TRACKER_CHECK("Skipped.Hide"), ""); + CheckTracker::ImGuiDrawTwoColorPickerSection("Seen", CVAR_TRACKER_CHECK("Seen.MainColor"), CVAR_TRACKER_CHECK("Seen.ExtraColor"), Color_Seen_Main, Color_Seen_Extra, Color_Main_Default, Color_Seen_Extra_Default, CVAR_TRACKER_CHECK("Seen.Hide"), "Used for shops. Shows item names for shop slots when walking in, and prices when highlighting them in buy mode."); + CheckTracker::ImGuiDrawTwoColorPickerSection("Scummed", CVAR_TRACKER_CHECK("Scummed.MainColor"), CVAR_TRACKER_CHECK("Scummed.ExtraColor"), Color_Scummed_Main, Color_Scummed_Extra, Color_Main_Default, Color_Scummed_Extra_Default, CVAR_TRACKER_CHECK("Scummed.Hide"), "Checks you collect, but then reload before saving so you no longer have them."); + //CheckTracker::ImGuiDrawTwoColorPickerSection("Hinted (WIP)", CVAR_TRACKER_CHECK("Hinted.MainColor"), CVAR_TRACKER_CHECK("Hinted.ExtraColor"), Color_Hinted_Main, Color_Hinted_Extra, Color_Main_Default, Color_Hinted_Extra_Default, CVAR_TRACKER_CHECK("Hinted.Hide"), ""); + CheckTracker::ImGuiDrawTwoColorPickerSection("Collected", CVAR_TRACKER_CHECK("Collected.MainColor"), CVAR_TRACKER_CHECK("Collected.ExtraColor"), Color_Collected_Main, Color_Collected_Extra, Color_Main_Default, Color_Collected_Extra_Default, CVAR_TRACKER_CHECK("Collected.Hide"), "Checks you have collected without saving or reloading yet."); + CheckTracker::ImGuiDrawTwoColorPickerSection("Saved", CVAR_TRACKER_CHECK("Saved.MainColor"), CVAR_TRACKER_CHECK("Saved.ExtraColor"), Color_Saved_Main, Color_Saved_Extra, Color_Main_Default, Color_Saved_Extra_Default, CVAR_TRACKER_CHECK("Saved.Hide"), "Checks that you saved the game while having collected."); ImGui::PopStyleVar(1); ImGui::EndTable(); @@ -1674,25 +1711,25 @@ void CheckTrackerSettingsWindow::DrawElement() { } void CheckTrackerWindow::InitElement() { - Color_Background = CVarGetColor("gCheckTrackerBgColor", Color_Bg_Default); - Color_Area_Incomplete_Main = CVarGetColor("gCheckTrackerAreaMainIncompleteColor", Color_Main_Default); - Color_Area_Incomplete_Extra = CVarGetColor("gCheckTrackerAreaExtraIncompleteColor", Color_Area_Incomplete_Extra_Default); - Color_Area_Complete_Main = CVarGetColor("gCheckTrackerAreaMainCompleteColor", Color_Main_Default); - Color_Area_Complete_Extra = CVarGetColor("gCheckTrackerAreaExtraCompleteColor", Color_Area_Complete_Extra_Default); - Color_Unchecked_Main = CVarGetColor("gCheckTrackerUncheckedMainColor", Color_Main_Default); - Color_Unchecked_Extra = CVarGetColor("gCheckTrackerUncheckedExtraColor", Color_Unchecked_Extra_Default); - Color_Skipped_Main = CVarGetColor("gCheckTrackerSkippedMainColor", Color_Main_Default); - Color_Skipped_Extra = CVarGetColor("gCheckTrackerSkippedExtraColor", Color_Skipped_Extra_Default); - Color_Seen_Main = CVarGetColor("gCheckTrackerSeenMainColor", Color_Main_Default); - Color_Seen_Extra = CVarGetColor("gCheckTrackerSeenExtraColor", Color_Seen_Extra_Default); - Color_Hinted_Main = CVarGetColor("gCheckTrackerHintedMainColor", Color_Main_Default); - Color_Hinted_Extra = CVarGetColor("gCheckTrackerHintedExtraColor", Color_Hinted_Extra_Default); - Color_Collected_Main = CVarGetColor("gCheckTrackerCollectedMainColor", Color_Main_Default); - Color_Collected_Extra = CVarGetColor("gCheckTrackerCollectedExtraColor", Color_Collected_Extra_Default); - Color_Scummed_Main = CVarGetColor("gCheckTrackerScummedMainColor", Color_Main_Default); - Color_Scummed_Extra = CVarGetColor("gCheckTrackerScummedExtraColor", Color_Scummed_Extra_Default); - Color_Saved_Main = CVarGetColor("gCheckTrackerSavedMainColor", Color_Main_Default); - Color_Saved_Extra = CVarGetColor("gCheckTrackerSavedExtraColor", Color_Saved_Extra_Default); + Color_Background = CVarGetColor(CVAR_TRACKER_CHECK("BgColor"), Color_Bg_Default); + Color_Area_Incomplete_Main = CVarGetColor(CVAR_TRACKER_CHECK("AreaIncomplete.MainColor"), Color_Main_Default); + Color_Area_Incomplete_Extra = CVarGetColor(CVAR_TRACKER_CHECK("AreaIncomplete.ExtraColor"), Color_Area_Incomplete_Extra_Default); + Color_Area_Complete_Main = CVarGetColor(CVAR_TRACKER_CHECK("AreaComplete.MainColor"), Color_Main_Default); + Color_Area_Complete_Extra = CVarGetColor(CVAR_TRACKER_CHECK("AreaComplete.ExtraColor"), Color_Area_Complete_Extra_Default); + Color_Unchecked_Main = CVarGetColor(CVAR_TRACKER_CHECK("Unchecked.MainColor"), Color_Main_Default); + Color_Unchecked_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Unchecked.ExtraColor"), Color_Unchecked_Extra_Default); + Color_Skipped_Main = CVarGetColor(CVAR_TRACKER_CHECK("Skipped.MainColor"), Color_Main_Default); + Color_Skipped_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Skipped.ExtraColor"), Color_Skipped_Extra_Default); + Color_Seen_Main = CVarGetColor(CVAR_TRACKER_CHECK("Seen.MainColor"), Color_Main_Default); + Color_Seen_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Seen.ExtraColor"), Color_Seen_Extra_Default); + Color_Hinted_Main = CVarGetColor(CVAR_TRACKER_CHECK("Hinted.MainColor"), Color_Main_Default); + Color_Hinted_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Hinted.ExtraColor"), Color_Hinted_Extra_Default); + Color_Collected_Main = CVarGetColor(CVAR_TRACKER_CHECK("Collected.MainColor"), Color_Main_Default); + Color_Collected_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Collected.ExtraColor"), Color_Collected_Extra_Default); + Color_Scummed_Main = CVarGetColor(CVAR_TRACKER_CHECK("Scummed.MainColor"), Color_Main_Default); + Color_Scummed_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Scummed.ExtraColor"), Color_Scummed_Extra_Default); + Color_Saved_Main = CVarGetColor(CVAR_TRACKER_CHECK("Saved.MainColor"), Color_Main_Default); + Color_Saved_Extra = CVarGetColor(CVAR_TRACKER_CHECK("Saved.ExtraColor"), Color_Saved_Extra_Default); SaveManager::Instance->AddInitFunction(InitTrackerData); sectionId = SaveManager::Instance->AddSaveFunction("trackerData", 1, SaveFile, true, -1); @@ -1708,8 +1745,8 @@ void CheckTrackerWindow::InitElement() { // GameInteractor::Instance->RegisterGameHook(CheckTrackerSceneFlagSet); // GameInteractor::Instance->RegisterGameHook(CheckTrackerFlagSet); - hideShopRightChecks = CVarGetInteger("gCheckTrackerOptionHideRightShopChecks", 1); - alwaysShowGS = CVarGetInteger("gCheckTrackerOptionAlwaysShowGSLocs", 0); + hideShopRightChecks = CVarGetInteger(CVAR_TRACKER_CHECK("HideRightShopChecks"), 1); + alwaysShowGS = CVarGetInteger(CVAR_TRACKER_CHECK("AlwaysShowGSLocs"), 0); //LocationTable_Init(); } diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h index 503c3e3dd..9362bccc6 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h @@ -7,9 +7,9 @@ namespace CheckTracker { -class CheckTrackerSettingsWindow : public LUS::GuiWindow { +class CheckTrackerSettingsWindow : public Ship::GuiWindow { public: - using LUS::GuiWindow::GuiWindow; + using GuiWindow::GuiWindow; ~CheckTrackerSettingsWindow() {}; protected: @@ -18,9 +18,9 @@ class CheckTrackerSettingsWindow : public LUS::GuiWindow { void UpdateElement() override {}; }; -class CheckTrackerWindow : public LUS::GuiWindow { +class CheckTrackerWindow : public Ship::GuiWindow { public: - using LUS::GuiWindow::GuiWindow; + using GuiWindow::GuiWindow; ~CheckTrackerWindow() {}; protected: diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance.c b/soh/soh/Enhancements/randomizer/randomizer_entrance.c index 5fd348343..24bf8c03a 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance.c +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance.c @@ -396,7 +396,7 @@ void Entrance_SetSavewarpEntrance(void) { gSaveContext.entranceIndex = ENTR_THIEVES_HIDEOUT_0; // Gerudo Fortress -> Thieve's Hideout spawn 0 } else if (scene == SCENE_LINKS_HOUSE) { gSaveContext.entranceIndex = Entrance_OverrideNextIndex(ENTR_LINKS_HOUSE_0); - } else if (CVarGetInteger("gRememberSaveLocation", 0) && scene != SCENE_FAIRYS_FOUNTAIN && scene != SCENE_GROTTOS && + } else if (CVarGetInteger(CVAR_ENHANCEMENT("RememberSaveLocation"), 0) && scene != SCENE_FAIRYS_FOUNTAIN && scene != SCENE_GROTTOS && gSaveContext.entranceIndex != ENTR_LOAD_OPENING) { // Use the saved entrance value with remember save location, except when in grottos/fairy fountains or if // the entrance index is -1 (new save) diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp index 90b21e975..af484449d 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp @@ -668,25 +668,25 @@ void EntranceTrackerWindow::DrawElement() { ImGui::TableNextColumn(); ImGui::Text("Sort By"); - UIWidgets::EnhancementRadioButton("To", "gEntranceTrackerSortBy", 0); + UIWidgets::EnhancementRadioButton("To", CVAR_TRACKER_ENTRANCE("SortBy"), 0); UIWidgets::Tooltip("Sort entrances by the original source entrance"); - UIWidgets::EnhancementRadioButton("From", "gEntranceTrackerSortBy", 1); + UIWidgets::EnhancementRadioButton("From", CVAR_TRACKER_ENTRANCE("SortBy"), 1); UIWidgets::Tooltip("Sort entrances by the overrided destination"); UIWidgets::Spacer(2.0f); ImGui::Text("List Items"); - UIWidgets::PaddedEnhancementCheckbox("Auto scroll", "gEntranceTrackerAutoScroll", true, false); + UIWidgets::PaddedEnhancementCheckbox("Auto scroll", CVAR_TRACKER_ENTRANCE("AutoScroll"), true, false); UIWidgets::Tooltip("Automatically scroll to the first aviable entrance in the current scene"); - UIWidgets::PaddedEnhancementCheckbox("Highlight previous", "gEntranceTrackerHighlightPrevious", true, false); + UIWidgets::PaddedEnhancementCheckbox("Highlight previous", CVAR_TRACKER_ENTRANCE("HighlightPrevious"), true, false); UIWidgets::Tooltip("Highlight the previous entrance that Link came from"); - UIWidgets::PaddedEnhancementCheckbox("Highlight available", "gEntranceTrackerHighlightAvailable", true, false); + UIWidgets::PaddedEnhancementCheckbox("Highlight available", CVAR_TRACKER_ENTRANCE("HighlightAvailable"), true, false); UIWidgets::Tooltip("Highlight available entrances in the current scene"); - UIWidgets::PaddedEnhancementCheckbox("Hide undiscovered", "gEntranceTrackerCollapseUndiscovered", true, false); + UIWidgets::PaddedEnhancementCheckbox("Hide undiscovered", CVAR_TRACKER_ENTRANCE("CollapseUndiscovered"), true, false); UIWidgets::Tooltip("Collapse undiscovered entrances towards the bottom of each group"); bool disableHideReverseEntrances = OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_ON; static const char* disableHideReverseEntrancesText = "This option is disabled because \"Decouple Entrances\" is enabled."; - UIWidgets::PaddedEnhancementCheckbox("Hide reverse", "gEntranceTrackerHideReverseEntrances", true, false, + UIWidgets::PaddedEnhancementCheckbox("Hide reverse", CVAR_TRACKER_ENTRANCE("HideReverseEntrances"), true, false, disableHideReverseEntrances, disableHideReverseEntrancesText, UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip("Hide reverse entrance transitions when Decouple Entrances is off"); UIWidgets::Spacer(0); @@ -694,17 +694,17 @@ void EntranceTrackerWindow::DrawElement() { ImGui::TableNextColumn(); ImGui::Text("Group By"); - UIWidgets::EnhancementRadioButton("Area", "gEntranceTrackerGroupBy", 0); + UIWidgets::EnhancementRadioButton("Area", CVAR_TRACKER_ENTRANCE("GroupBy"), 0); UIWidgets::Tooltip("Group entrances by their area"); - UIWidgets::EnhancementRadioButton("Type", "gEntranceTrackerGroupBy", 1); + UIWidgets::EnhancementRadioButton("Type", CVAR_TRACKER_ENTRANCE("GroupBy"), 1); UIWidgets::Tooltip("Group entrances by their entrance type"); UIWidgets::Spacer(2.0f); ImGui::Text("Spoiler Reveal"); - UIWidgets::PaddedEnhancementCheckbox("Show \"To\"", "gEntranceTrackerShowTo", true, false); + UIWidgets::PaddedEnhancementCheckbox("Show \"To\"", CVAR_TRACKER_ENTRANCE("ShowTo"), true, false); UIWidgets::Tooltip("Reveal the \"To\" entrance for undiscovered entrances"); - UIWidgets::PaddedEnhancementCheckbox("Show \"From\"", "gEntranceTrackerShowFrom", true, false); + UIWidgets::PaddedEnhancementCheckbox("Show \"From\"", CVAR_TRACKER_ENTRANCE("ShowFrom"), true, false); UIWidgets::Tooltip("Reveal the \"From\" entrance for undiscovered entrances"); ImGui::EndTable(); @@ -752,8 +752,8 @@ void EntranceTrackerWindow::DrawElement() { nextTreeState = 2; } - uint8_t destToggle = CVarGetInteger("gEntranceTrackerSortBy", 0); - uint8_t groupToggle = CVarGetInteger("gEntranceTrackerGroupBy", 0); + uint8_t destToggle = CVarGetInteger(CVAR_TRACKER_ENTRANCE("SortBy"), 0); + uint8_t groupToggle = CVarGetInteger(CVAR_TRACKER_ENTRANCE("GroupBy"), 0); // Combine destToggle and groupToggle to get a range of 0-3 uint8_t groupType = destToggle + (groupToggle * 2); @@ -804,7 +804,7 @@ void EntranceTrackerWindow::DrawElement() { // However, if entrances are decoupled, then all transitions need to be displayed, so we proceed with the filtering if ((original->type == ENTRANCE_TYPE_DUNGEON || original->type == ENTRANCE_TYPE_GROTTO || original->type == ENTRANCE_TYPE_INTERIOR) && (original->oneExit != 1 && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_OFF) && - CVarGetInteger("gEntranceTrackerHideReverseEntrances", 1) == 1) { + CVarGetInteger(CVAR_TRACKER_ENTRANCE("HideReverseEntrances"), 1) == 1) { continue; } @@ -815,8 +815,8 @@ void EntranceTrackerWindow::DrawElement() { bool isDiscovered = IsEntranceDiscovered(entrance.index); - bool showOriginal = (!destToggle ? CVarGetInteger("gEntranceTrackerShowTo", 0) : CVarGetInteger("gEntranceTrackerShowFrom", 0)) || isDiscovered; - bool showOverride = (!destToggle ? CVarGetInteger("gEntranceTrackerShowFrom", 0) : CVarGetInteger("gEntranceTrackerShowTo", 0)) || isDiscovered; + bool showOriginal = (!destToggle ? CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowTo"), 0) : CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowFrom"), 0)) || isDiscovered; + bool showOverride = (!destToggle ? CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowFrom"), 0) : CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowTo"), 0)) || isDiscovered; const char* origSrcAreaName = spoilerEntranceGroupNames[original->srcGroup].c_str(); const char* origTypeName = groupTypeNames[original->type].c_str(); @@ -829,7 +829,7 @@ void EntranceTrackerWindow::DrawElement() { const char* rplcDstName = showOverride ? override->destination.c_str() : ""; // Filter for entrances by group name, type, source/destination names, and meta tags - if ((!locationSearch.IsActive() && (showOriginal || showOverride || !CVarGetInteger("gEntranceTrackerCollapseUndiscovered", 0))) || + if ((!locationSearch.IsActive() && (showOriginal || showOverride || !CVarGetInteger(CVAR_TRACKER_ENTRANCE("CollapseUndiscovered"), 0))) || ((showOriginal && (locationSearch.PassFilter(origSrcName) || locationSearch.PassFilter(origDstName) || locationSearch.PassFilter(origSrcAreaName) || locationSearch.PassFilter(origTypeName) || locationSearch.PassFilter(original->metaTag.c_str()))) || @@ -867,8 +867,8 @@ void EntranceTrackerWindow::DrawElement() { bool isDiscovered = IsEntranceDiscovered(entrance.index); - bool showOriginal = (!destToggle ? CVarGetInteger("gEntranceTrackerShowTo", 0) : CVarGetInteger("gEntranceTrackerShowFrom", 0)) || isDiscovered; - bool showOverride = (!destToggle ? CVarGetInteger("gEntranceTrackerShowFrom", 0) : CVarGetInteger("gEntranceTrackerShowTo", 0)) || isDiscovered; + bool showOriginal = (!destToggle ? CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowTo"), 0) : CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowFrom"), 0)) || isDiscovered; + bool showOverride = (!destToggle ? CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowFrom"), 0) : CVarGetInteger(CVAR_TRACKER_ENTRANCE("ShowTo"), 0)) || isDiscovered; const char* unknown = "???"; @@ -882,16 +882,16 @@ void EntranceTrackerWindow::DrawElement() { // Handle highlighting and auto scroll if ((original->index == lastEntranceIndex || (override->reverseIndex == lastEntranceIndex && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_DECOUPLED_ENTRANCES) == RO_GENERIC_OFF)) && - CVarGetInteger("gEntranceTrackerHighlightPrevious", 0)) { + CVarGetInteger(CVAR_TRACKER_ENTRANCE("HighlightPrevious"), 0)) { color = COLOR_ORANGE; } else if (LinkIsInArea(original) != -1) { - if (CVarGetInteger("gEntranceTrackerHighlightAvailable", 0)) { + if (CVarGetInteger(CVAR_TRACKER_ENTRANCE("HighlightAvailable"), 0)) { color = COLOR_GREEN; } if (doAreaScroll) { doAreaScroll = false; - if (CVarGetInteger("gEntranceTrackerAutoScroll", 0)) { + if (CVarGetInteger(CVAR_TRACKER_ENTRANCE("AutoScroll"), 0)) { ImGui::SetScrollHereY(0.0f); } } diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h index fc5346aa3..87d736058 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h @@ -85,7 +85,7 @@ s16 GetLastEntranceOverride(); s16 GetCurrentGrottoId(); const EntranceData* GetEntranceData(s16); -class EntranceTrackerWindow : public LUS::GuiWindow { +class EntranceTrackerWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index ffcffde5a..6371708d6 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -461,17 +461,17 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) { if (!GameInteractor::IsSaveLoaded()) { return; } - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); - int textSize = CVarGetInteger("gTrackers.ItemTracker.ItemTrackerTextSize", 13); + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + int textSize = CVarGetInteger(CVAR_TRACKER_ITEM("TextSize"), 13); ItemTrackerNumbers currentAndMax = GetItemCurrentAndMax(item); ImVec2 p = ImGui::GetCursorScreenPos(); - int32_t trackerNumberDisplayMode = CVarGetInteger("gItemTrackerCapacityTrack", ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY); - int32_t trackerKeyNumberDisplayMode = CVarGetInteger("gItemTrackerKeyTrack", KEYS_COLLECTED_MAX); + int32_t trackerNumberDisplayMode = CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY); + int32_t trackerKeyNumberDisplayMode = CVarGetInteger(CVAR_TRACKER_ITEM("KeyCounts"), KEYS_COLLECTED_MAX); float textScalingFactor = static_cast(iconSize) / 36.0f; uint32_t actualItemId = INV_CONTENT(item.id); bool hasItem = actualItemId != ITEM_NONE; - if (CVarGetInteger("gTrackers.ItemTracker.HookshotIdentifier", 0)) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("HookshotIdentifier"), 0)) { if ((actualItemId == ITEM_HOOKSHOT || actualItemId == ITEM_LONGSHOT) && hasItem) { // Calculate the scaled position for the text @@ -517,7 +517,7 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) { ImU32 currentColor = IM_COL_WHITE; ImU32 maxColor = item.id == QUEST_SKULL_TOKEN ? IM_COL_RED : IM_COL_GREEN; - bool shouldAlignToLeft = CVarGetInteger("gItemTrackerCurrentOnLeft", 0) && + bool shouldAlignToLeft = CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountAlignLeft"), 0) && trackerNumberDisplayMode != ITEM_TRACKER_NUMBER_CAPACITY && trackerNumberDisplayMode != ITEM_TRACKER_NUMBER_AMMO; @@ -577,7 +577,7 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) { uint8_t piecesTotal = (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_TOTAL) + 1); ImU32 currentColor = gSaveContext.triforcePiecesCollected >= piecesRequired ? IM_COL_GREEN : IM_COL_WHITE; ImU32 maxColor = IM_COL_GREEN; - int32_t trackerTriforcePieceNumberDisplayMode = CVarGetInteger("gItemTrackerTriforcePieceTrack", TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX); + int32_t trackerTriforcePieceNumberDisplayMode = CVarGetInteger(CVAR_TRACKER_ITEM("TriforcePieceCounts"), TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX); currentString += std::to_string(gSaveContext.triforcePiecesCollected); currentString += "/"; @@ -607,8 +607,8 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) { void DrawEquip(ItemTrackerItem item) { bool hasEquip = HasEquipment(item); - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded), + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasEquip && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id)); @@ -616,9 +616,9 @@ void DrawEquip(ItemTrackerItem item) { void DrawQuest(ItemTrackerItem item) { bool hasQuestItem = HasQuestItem(item); - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); ImGui::BeginGroup(); - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); if (item.id == QUEST_SKULL_TOKEN) { @@ -633,7 +633,7 @@ void DrawQuest(ItemTrackerItem item) { void DrawItem(ItemTrackerItem item) { uint32_t actualItemId = GameInteractor::IsSaveLoaded() ? INV_CONTENT(item.id) : ITEM_NONE; - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); bool hasItem = actualItemId != ITEM_NONE; std::string itemName = ""; @@ -766,7 +766,7 @@ void DrawItem(ItemTrackerItem item) { ImGui::BeginGroup(); - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); DrawItemCount(item, false); @@ -806,8 +806,8 @@ void DrawBottle(ItemTrackerItem item) { item = actualItemTrackerItemMap[actualItemId]; } - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); UIWidgets::SetLastItemHoverText(SohUtils::GetItemName(item.id)); @@ -817,16 +817,16 @@ void DrawDungeonItem(ItemTrackerItem item) { uint32_t itemId = item.id; ImU32 dungeonColor = IM_COL_WHITE; uint32_t bitMask = 1 << (item.id - ITEM_KEY_BOSS); // Bitset starts at ITEM_KEY_BOSS == 0. the rest are sequential - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); bool hasItem = GameInteractor::IsSaveLoaded() ? (bitMask & gSaveContext.inventory.dungeonItems[item.data]) : false; bool hasSmallKey = GameInteractor::IsSaveLoaded() ? ((gSaveContext.inventory.dungeonKeys[item.data]) >= 0) : false; ImGui::BeginGroup(); if (itemId == ITEM_KEY_SMALL) { - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSmallKey && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSmallKey && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); } else { - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasItem && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize, iconSize), ImVec2(0, 0), ImVec2(1, 1)); } @@ -863,19 +863,19 @@ void DrawDungeonItem(ItemTrackerItem item) { } void DrawSong(ItemTrackerItem item) { - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); ImVec2 p = ImGui::GetCursorScreenPos(); bool hasSong = HasSong(item); ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y)); - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded), + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(hasSong && IsValidSaveFile() ? item.name : item.nameFaded), ImVec2(iconSize / 1.5, iconSize), ImVec2(0, 0), ImVec2(1, 1)); UIWidgets::SetLastItemHoverText(SohUtils::GetQuestItemName(item.id)); } void DrawNotes(bool resizeable = false) { ImGui::BeginGroup(); - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); - int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); struct ItemTrackerNotes { static int TrackerNotesResizeCallback(ImGuiInputTextCallbackData* data) { @@ -920,11 +920,11 @@ void BeginFloatingWindows(std::string UniqueName, ImGuiWindowFlags flags = 0) { windowFlags |= ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoResize; } - if (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING) { ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID); windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar; - if (!CVarGetInteger("gItemTrackerHudEditMode", 0)) { + if (!CVarGetInteger(CVAR_TRACKER_ITEM("Draggable"), 0)) { windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove; } } @@ -945,9 +945,9 @@ void EndFloatingWindows() { * Takes in a vector of ItemTrackerItem and draws them in rows of N items */ void DrawItemsInRows(std::vector items, int columns = 6) { - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); - int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); - int topPadding = (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW) ? 20 : 0; + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); + int topPadding = (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW) ? 20 : 0; for (int i = 0; i < items.size(); i++) { int row = i / columns; @@ -962,8 +962,8 @@ void DrawItemsInRows(std::vector items, int columns = 6) { * Takes in a vector of ItemTrackerItem and draws them evenly spread across a circle */ void DrawItemsInACircle(std::vector items) { - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); - int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); ImVec2 max = ImGui::GetWindowContentRegionMax(); float radius = (iconSize + iconSpacing) * 2; @@ -972,7 +972,7 @@ void DrawItemsInACircle(std::vector items) { float angle = (float)i / items.size() * 2.0f * M_PI; float x = (radius / 2.0f) * cos(angle) + max.x / 2.0f; float y = (radius / 2.0f) * sin(angle) + max.y / 2.0f; - ImGui::SetCursorPos(ImVec2(x - (CVarGetInteger("gItemTrackerIconSize", 36) - 8) / 2.0f, y + 4)); + ImGui::SetCursorPos(ImVec2(x - (CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36) - 8) / 2.0f, y + 4)); items[i].drawFunc(items[i]); } } @@ -983,8 +983,8 @@ void DrawItemsInACircle(std::vector items) { * to then call DrawItemsInRows */ std::vector GetDungeonItemsVector(std::vector dungeons, int columns = 6) { - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); - int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); std::vector dungeonItems = {}; int rowCount = 0; @@ -1039,8 +1039,8 @@ void UpdateVectors() { dungeonRewards.insert(dungeonRewards.end(), dungeonRewardMedallions.begin(), dungeonRewardMedallions.end()); dungeonItems.clear(); - if (CVarGetInteger("gItemTrackerDisplayDungeonItemsHorizontal", 1) && CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { - if (CVarGetInteger("gItemTrackerDisplayDungeonItemsMaps", 1)) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonItems.Layout"), 1) && CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonItems.DisplayMaps"), 1)) { dungeonItems = GetDungeonItemsVector(itemTrackerDungeonsWithMapsHorizontal, 12); // Manually adding Thieves Hideout to an open spot so we don't get an additional row for one item dungeonItems[23] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_THIEVES_HIDEOUT, DrawDungeonItem); @@ -1050,7 +1050,7 @@ void UpdateVectors() { dungeonItems[15] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_THIEVES_HIDEOUT, DrawDungeonItem); } } else { - if (CVarGetInteger("gItemTrackerDisplayDungeonItemsMaps", 1)) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonItems.DisplayMaps"), 1)) { dungeonItems = GetDungeonItemsVector(itemTrackerDungeonsWithMapsCompact); // Manually adding Thieves Hideout to an open spot so we don't get an additional row for one item dungeonItems[35] = ITEM_TRACKER_ITEM(ITEM_KEY_SMALL, SCENE_THIEVES_HIDEOUT, DrawDungeonItem); @@ -1060,37 +1060,37 @@ void UpdateVectors() { } mainWindowItems.clear(); - if (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Inventory"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { mainWindowItems.insert(mainWindowItems.end(), inventoryItems.begin(), inventoryItems.end()); } - if (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Equipment"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { mainWindowItems.insert(mainWindowItems.end(), equipmentItems.begin(), equipmentItems.end()); } - if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { mainWindowItems.insert(mainWindowItems.end(), miscItems.begin(), miscItems.end()); } - if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { mainWindowItems.insert(mainWindowItems.end(), dungeonRewardStones.begin(), dungeonRewardStones.end()); mainWindowItems.insert(mainWindowItems.end(), dungeonRewardMedallions.begin(), dungeonRewardMedallions.end()); } - if (CVarGetInteger("gItemTrackerSongsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { - if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW && - CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) != SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Songs"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW && + CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) != SECTION_DISPLAY_MAIN_WINDOW) { mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem)); mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem)); mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem)); } mainWindowItems.insert(mainWindowItems.end(), songItems.begin(), songItems.end()); } - if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) { mainWindowItems.insert(mainWindowItems.end(), dungeonItems.begin(), dungeonItems.end()); } // if we're adding greg to the misc window, // and misc isn't on the main window, // and it doesn't already have greg, add him - if (CVarGetInteger("gItemTrackerGregDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MISC_WINDOW && - CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) != SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MISC_WINDOW && + CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) != SECTION_DISPLAY_MAIN_WINDOW) { if (std::none_of(miscItems.begin(), miscItems.end(), [](ItemTrackerItem item) { return item.id == ITEM_RUPEE_GREEN; })) miscItems.insert(miscItems.end(), gregItems.begin(), gregItems.end()); } else { @@ -1099,7 +1099,7 @@ void UpdateVectors() { bool newRowAdded = false; // if we're adding greg to the main window - if (CVarGetInteger("gItemTrackerGregDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) { if (!newRowAdded) { // insert empty items until we're on a new row for greg while (mainWindowItems.size() % 6) { @@ -1113,7 +1113,7 @@ void UpdateVectors() { } // If we're adding triforce pieces to the main window - if (CVarGetInteger("gItemTrackerTriforcePiecesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) { // If Greg isn't on the main window, add empty items to place the triforce pieces on a new row. if (!newRowAdded) { while (mainWindowItems.size() % 6) { @@ -1127,15 +1127,15 @@ void UpdateVectors() { } // if misc is separate and fishing pole isn't added, add fishing pole to misc - if (CVarGetInteger("gItemTrackerFishingPoleDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MISC_WINDOW && - CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) != SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.FishingPole"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MISC_WINDOW && + CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) != SECTION_DISPLAY_MAIN_WINDOW) { if (std::none_of(miscItems.begin(), miscItems.end(), [](ItemTrackerItem item) { return item.id == ITEM_FISHING_POLE; })) miscItems.insert(miscItems.end(), fishingPoleItems.begin(), fishingPoleItems.end()); } else { miscItems.erase(std::remove_if(miscItems.begin(), miscItems.end(), [](ItemTrackerItem i) { return i.id == ITEM_FISHING_POLE; }), miscItems.end()); } // add fishing pole to main window - if (CVarGetInteger("gItemTrackerFishingPoleDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.FishingPole"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) { if (!newRowAdded) { while (mainWindowItems.size() % 6) { mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem)); @@ -1147,7 +1147,7 @@ void UpdateVectors() { } //If we're adding boss souls to the main window... - if (CVarGetInteger("gItemTrackerBossSoulsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.BossSouls"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) { //...add empty items on the main window to get the souls on their own row. (Too many to sit with Greg/Triforce pieces) while (mainWindowItems.size() % 6) { mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem)); @@ -1158,7 +1158,7 @@ void UpdateVectors() { } //If we're adding ocarina buttons to the main window... - if (CVarGetInteger("gItemTrackerOcarinaButtonsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.OcarinaButtons"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) { //...add empty items on the main window to get the buttons on their own row. (Too many to sit with Greg/Triforce pieces/boss souls) while (mainWindowItems.size() % 6) { mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem)); @@ -1194,57 +1194,57 @@ void ItemTrackerLoadFile() { void ItemTrackerWindow::DrawElement() { UpdateVectors(); - int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); - int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); - int comboButton1Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton1", TRACKER_COMBO_BUTTON_L)]; - int comboButton2Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton2", TRACKER_COMBO_BUTTON_R)]; - OSContPad* buttonsPressed = LUS::Context::GetInstance()->GetControlDeck()->GetPads(); + int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); + int comboButton1Mask = buttonMap[CVarGetInteger(CVAR_TRACKER_ITEM("ComboButton1"), TRACKER_COMBO_BUTTON_L)]; + int comboButton2Mask = buttonMap[CVarGetInteger(CVAR_TRACKER_ITEM("ComboButton2"), TRACKER_COMBO_BUTTON_R)]; + OSContPad* buttonsPressed = Ship::Context::GetInstance()->GetControlDeck()->GetPads(); bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask; - bool isPaused = CVarGetInteger("gItemTrackerShowOnlyPaused", 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0; + bool isPaused = CVarGetInteger(CVAR_TRACKER_ITEM("ShowOnlyPaused"), 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0; - if (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW || isPaused && (CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS ? CVarGetInteger("gItemTrackerEnabled", 0) : comboButtonsHeld)) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW || isPaused && (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS ? CVarGetInteger(CVAR_WINDOW("ItemTracker"), 0) : comboButtonsHeld)) { if ( - (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || - (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || - (CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || - (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || - (CVarGetInteger("gItemTrackerSongsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || - (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) || - (CVarGetInteger("gItemTrackerGregDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) || - (CVarGetInteger("gItemTrackerTriforcePiecesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) || - (CVarGetInteger("gItemTrackerFishingPoleDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) || - (CVarGetInteger("gItemTrackerNotesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) + (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Inventory"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || + (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Equipment"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || + (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || + (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || + (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Songs"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) || + (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) || + (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) || + (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) || + (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.FishingPole"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) || + (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) ) { BeginFloatingWindows("Item Tracker##main window"); DrawItemsInRows(mainWindowItems, 6); - if (CVarGetInteger("gItemTrackerNotesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW && CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW && CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { DrawNotes(); } EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Inventory"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Inventory Items Tracker"); DrawItemsInRows(inventoryItems); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Equipment"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Equipment Items Tracker"); DrawItemsInRows(equipmentItems, 3); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Misc"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Misc Items Tracker"); DrawItemsInRows(miscItems, 4); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Dungeon Rewards Tracker"); - if (CVarGetInteger("gItemTrackerDungeonRewardsCircle", 0)) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonRewardsLayout"), 0)) { ImGui::BeginGroup(); DrawItemsInACircle(dungeonRewardMedallions); ImGui::EndGroup(); @@ -1257,16 +1257,16 @@ void ItemTrackerWindow::DrawElement() { EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerSongsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Songs"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Songs Tracker"); DrawItemsInRows(songItems); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Dungeon Items Tracker"); - if (CVarGetInteger("gItemTrackerDisplayDungeonItemsHorizontal", 1)) { - if (CVarGetInteger("gItemTrackerDisplayDungeonItemsMaps", 1)) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonItems.Layout"), 1)) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DungeonItems.DisplayMaps"), 1)) { DrawItemsInRows(dungeonItems, 12); } else { DrawItemsInRows(dungeonItems, 8); @@ -1277,37 +1277,37 @@ void ItemTrackerWindow::DrawElement() { EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerGregDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Greg"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_SEPARATE) { BeginFloatingWindows("Greg Tracker"); DrawItemsInRows(gregItems); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerTriforcePiecesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Triforce Piece Tracker"); DrawItemsInRows(triforcePieces); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerBossSoulsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.BossSouls"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Boss Soul Tracker"); DrawItemsInRows(bossSoulItems); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerOcarinaButtonsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.OcarinaButtons"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Ocarina Button Tracker"); DrawItemsInRows(ocarinaButtonItems); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerFishingPoleDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_SEPARATE) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.FishingPole"), SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_SEPARATE) { BeginFloatingWindows("Fishing Pole Tracker"); DrawItemsInRows(fishingPoleItems); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerNotesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE && CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE && CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { ImGui::SetNextWindowSize(ImVec2(400,300), ImGuiCond_FirstUseEver); BeginFloatingWindows("Personal Notes", ImGuiWindowFlags_NoFocusOnAppearing); DrawNotes(true); @@ -1344,50 +1344,50 @@ void ItemTrackerSettingsWindow::DrawElement() { ImGui::SameLine(); ImGui::PushItemWidth(ImGui::GetContentRegionAvail().x); if (ImGui::ColorEdit4("BG Color##gItemTrackerBgColor", (float*)&ChromaKeyBackground, ImGuiColorEditFlags_AlphaPreview | ImGuiColorEditFlags_AlphaBar | ImGuiColorEditFlags_NoLabel)) { - CVarSetFloat("gItemTrackerBgColorR", ChromaKeyBackground.x); - CVarSetFloat("gItemTrackerBgColorG", ChromaKeyBackground.y); - CVarSetFloat("gItemTrackerBgColorB", ChromaKeyBackground.z); - CVarSetFloat("gItemTrackerBgColorA", ChromaKeyBackground.w); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetFloat(CVAR_TRACKER_ITEM("BgColorR"), ChromaKeyBackground.x); + CVarSetFloat(CVAR_TRACKER_ITEM("BgColorG"), ChromaKeyBackground.y); + CVarSetFloat(CVAR_TRACKER_ITEM("BgColorB"), ChromaKeyBackground.z); + CVarSetFloat(CVAR_TRACKER_ITEM("BgColorA"), ChromaKeyBackground.w); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::PopItemWidth(); - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", "gItemTrackerWindowType", windowTypes, TRACKER_WINDOW_FLOATING)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", CVAR_TRACKER_ITEM("WindowType"), windowTypes, TRACKER_WINDOW_FLOATING)) { shouldUpdateVectors = true; } - if (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING) { - if (UIWidgets::PaddedEnhancementCheckbox("Enable Dragging", "gItemTrackerHudEditMode")) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING) { + if (UIWidgets::PaddedEnhancementCheckbox("Enable Dragging", CVAR_TRACKER_ITEM("Draggable"))) { shouldUpdateVectors = true; } - if (UIWidgets::PaddedEnhancementCheckbox("Only enable while paused", "gItemTrackerShowOnlyPaused")) { + if (UIWidgets::PaddedEnhancementCheckbox("Only enable while paused", CVAR_TRACKER_ITEM("ShowOnlyPaused"))) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", "gItemTrackerDisplayType", displayModes, TRACKER_DISPLAY_ALWAYS)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", CVAR_TRACKER_ITEM("DisplayType.Main"), displayModes, TRACKER_DISPLAY_ALWAYS)) { shouldUpdateVectors = true; } - if (CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", "gItemTrackerComboButton1", buttons, TRACKER_COMBO_BUTTON_L)) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", CVAR_TRACKER_ITEM("ComboButton1"), buttons, TRACKER_COMBO_BUTTON_L)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", "gItemTrackerComboButton2", buttons, TRACKER_COMBO_BUTTON_R)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", CVAR_TRACKER_ITEM("ComboButton2"), buttons, TRACKER_COMBO_BUTTON_R)) { shouldUpdateVectors = true; } } } UIWidgets::PaddedSeparator(); - UIWidgets::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", "gItemTrackerIconSize", 25, 128, "", 36); - UIWidgets::EnhancementSliderInt("Icon margins : %dpx", "##ITEMTRACKERSPACING", "gItemTrackerIconSpacing", -5, 50, "", 12); - UIWidgets::EnhancementSliderInt("Text size : %dpx", "##ITEMTRACKERTEXTSIZE", "gTrackers.ItemTracker.ItemTrackerTextSize", 1, 30, "", 13); + UIWidgets::EnhancementSliderInt("Icon size : %dpx", "##ITEMTRACKERICONSIZE", CVAR_TRACKER_ITEM("IconSize"), 25, 128, "", 36); + UIWidgets::EnhancementSliderInt("Icon margins : %dpx", "##ITEMTRACKERSPACING", CVAR_TRACKER_ITEM("IconSpacing"), -5, 50, "", 12); + UIWidgets::EnhancementSliderInt("Text size : %dpx", "##ITEMTRACKERTEXTSIZE", CVAR_TRACKER_ITEM("TextSize"), 1, 30, "", 13); UIWidgets::Spacer(0); ImGui::Text("Ammo/Capacity Tracking"); - UIWidgets::EnhancementCombobox("gItemTrackerCapacityTrack", itemTrackerCapacityTrackOptions, ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY); + UIWidgets::EnhancementCombobox(CVAR_TRACKER_ITEM("ItemCountType"), itemTrackerCapacityTrackOptions, ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY); UIWidgets::InsertHelpHoverText("Customize what the numbers under each item are tracking." "\n\nNote: items without capacity upgrades will track ammo even in capacity mode"); - if (CVarGetInteger("gItemTrackerCapacityTrack", ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY || CVarGetInteger("gItemTrackerCapacityTrack", ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY) { - if (UIWidgets::PaddedEnhancementCheckbox("Align count to left side", "gItemTrackerCurrentOnLeft")) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY || CVarGetInteger(CVAR_TRACKER_ITEM("ItemCountType"), ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY) == ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY) { + if (UIWidgets::PaddedEnhancementCheckbox("Align count to left side", CVAR_TRACKER_ITEM("ItemCountAlignLeft"))) { shouldUpdateVectors = true; } } @@ -1395,76 +1395,76 @@ void ItemTrackerSettingsWindow::DrawElement() { UIWidgets::Spacer(0); ImGui::Text("Key Count Tracking"); - UIWidgets::EnhancementCombobox("gItemTrackerKeyTrack", itemTrackerKeyTrackOptions, KEYS_COLLECTED_MAX); + UIWidgets::EnhancementCombobox(CVAR_TRACKER_ITEM("KeyCounts"), itemTrackerKeyTrackOptions, KEYS_COLLECTED_MAX); UIWidgets::InsertHelpHoverText("Customize what numbers are shown for key tracking."); UIWidgets::Spacer(0); ImGui::Text("Triforce Piece Count Tracking"); - UIWidgets::EnhancementCombobox("gItemTrackerTriforcePieceTrack", itemTrackerTriforcePieceTrackOptions, TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX); + UIWidgets::EnhancementCombobox(CVAR_TRACKER_ITEM("TriforcePieceCounts"), itemTrackerTriforcePieceTrackOptions, TRIFORCE_PIECE_COLLECTED_REQUIRED_MAX); UIWidgets::InsertHelpHoverText("Customize what numbers are shown for triforce piece tracking."); ImGui::TableNextColumn(); - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Inventory", "gItemTrackerInventoryItemsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Inventory", CVAR_TRACKER_ITEM("DisplayType.Inventory"), displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Equipment", "gItemTrackerEquipmentItemsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Equipment", CVAR_TRACKER_ITEM("DisplayType.Equipment"), displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Misc", "gItemTrackerMiscItemsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Misc", CVAR_TRACKER_ITEM("DisplayType.Misc"), displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Rewards", "gItemTrackerDungeonRewardsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Rewards", CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { shouldUpdateVectors = true; } - if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { - if (UIWidgets::PaddedEnhancementCheckbox("Circle display", "gItemTrackerDungeonRewardsCircle", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, false)) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonRewards"), SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { + if (UIWidgets::PaddedEnhancementCheckbox("Circle display", CVAR_TRACKER_ITEM("DungeonRewardsLayout"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, false)) { shouldUpdateVectors = true; } } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Songs", "gItemTrackerSongsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Songs", CVAR_TRACKER_ITEM("DisplayType.Songs"), displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Items", "gItemTrackerDungeonItemsDisplayType", displayTypes, SECTION_DISPLAY_HIDDEN)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Items", CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), displayTypes, SECTION_DISPLAY_HIDDEN)) { shouldUpdateVectors = true; } - if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) != SECTION_DISPLAY_HIDDEN) { - if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { - if (UIWidgets::PaddedEnhancementCheckbox("Horizontal display", "gItemTrackerDisplayDungeonItemsHorizontal", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) != SECTION_DISPLAY_HIDDEN) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.DungeonItems"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { + if (UIWidgets::PaddedEnhancementCheckbox("Horizontal display", CVAR_TRACKER_ITEM("DungeonItems.Layout"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) { shouldUpdateVectors = true; } } - if (UIWidgets::PaddedEnhancementCheckbox("Maps and compasses", "gItemTrackerDisplayDungeonItemsMaps", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) { + if (UIWidgets::PaddedEnhancementCheckbox("Maps and compasses", CVAR_TRACKER_ITEM("DungeonItems.DisplayMaps"), true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) { shouldUpdateVectors = true; } } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Greg", "gItemTrackerGregDisplayType", extendedDisplayTypes, SECTION_DISPLAY_EXTENDED_HIDDEN)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Greg", CVAR_TRACKER_ITEM("DisplayType.Greg"), extendedDisplayTypes, SECTION_DISPLAY_EXTENDED_HIDDEN)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Triforce Pieces", "gItemTrackerTriforcePiecesDisplayType", displayTypes, SECTION_DISPLAY_HIDDEN)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Triforce Pieces", CVAR_TRACKER_ITEM("DisplayType.TriforcePieces"), displayTypes, SECTION_DISPLAY_HIDDEN)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Boss Souls", "gItemTrackerBossSoulsDisplayType", displayTypes, SECTION_DISPLAY_HIDDEN)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Boss Souls", CVAR_TRACKER_ITEM("DisplayType.BossSouls"), displayTypes, SECTION_DISPLAY_HIDDEN)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Ocarina Buttons", "gItemTrackerOcarinaButtonsDisplayType", displayTypes, SECTION_DISPLAY_HIDDEN)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Ocarina Buttons", CVAR_TRACKER_ITEM("DisplayType.OcarinaButtons"), displayTypes, SECTION_DISPLAY_HIDDEN)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Fishing Pole", "gItemTrackerFishingPoleDisplayType", extendedDisplayTypes, SECTION_DISPLAY_EXTENDED_HIDDEN)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Fishing Pole", CVAR_TRACKER_ITEM("DisplayType.FishingPole"), extendedDisplayTypes, SECTION_DISPLAY_EXTENDED_HIDDEN)) { shouldUpdateVectors = true; } - if (CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Personal notes", "gItemTrackerNotesDisplayType", displayTypes, SECTION_DISPLAY_HIDDEN)) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Personal notes", CVAR_TRACKER_ITEM("DisplayType.Notes"), displayTypes, SECTION_DISPLAY_HIDDEN)) { shouldUpdateVectors = true; } } - UIWidgets::EnhancementCheckbox("Show Hookshot Identifiers", "gTrackers.ItemTracker.HookshotIdentifier"); + UIWidgets::EnhancementCheckbox("Show Hookshot Identifiers", CVAR_TRACKER_ITEM("HookshotIdentifier")); UIWidgets::InsertHelpHoverText("Shows an 'H' or an 'L' to more easiely distinguish between Hookshot and Longshot."); UIWidgets::Spacer(0); @@ -1476,10 +1476,10 @@ void ItemTrackerSettingsWindow::DrawElement() { } void ItemTrackerWindow::InitElement() { - float trackerBgR = CVarGetFloat("gItemTrackerBgColorR", 0); - float trackerBgG = CVarGetFloat("gItemTrackerBgColorG", 0); - float trackerBgB = CVarGetFloat("gItemTrackerBgColorB", 0); - float trackerBgA = CVarGetFloat("gItemTrackerBgColorA", 1); + float trackerBgR = CVarGetFloat(CVAR_TRACKER_ITEM("BgColorR"), 0); + float trackerBgG = CVarGetFloat(CVAR_TRACKER_ITEM("BgColorG"), 0); + float trackerBgB = CVarGetFloat(CVAR_TRACKER_ITEM("BgColorB"), 0); + float trackerBgA = CVarGetFloat(CVAR_TRACKER_ITEM("BgColorA"), 1); ChromaKeyBackground = { trackerBgR, trackerBgG, diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h index 8a0b754a8..3fba1cf93 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h @@ -34,7 +34,7 @@ typedef struct ItemTrackerDungeon { std::vector items; } ItemTrackerDungeon; -class ItemTrackerSettingsWindow : public LUS::GuiWindow { +class ItemTrackerSettingsWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; @@ -44,7 +44,7 @@ class ItemTrackerSettingsWindow : public LUS::GuiWindow { void UpdateElement() override {}; }; -class ItemTrackerWindow : public LUS::GuiWindow { +class ItemTrackerWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; diff --git a/soh/soh/Enhancements/randomizer/randomizer_settings_window.h b/soh/soh/Enhancements/randomizer/randomizer_settings_window.h index 01ce3b083..9f297c29d 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_settings_window.h +++ b/soh/soh/Enhancements/randomizer/randomizer_settings_window.h @@ -4,7 +4,7 @@ namespace Rando { class Settings; } -class RandomizerSettingsWindow : public LUS::GuiWindow { +class RandomizerSettingsWindow : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index 76cda498a..11a42aefb 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -42,171 +42,171 @@ Settings::Settings() : mExcludeLocationsOptionsGroups(SPOILER_COLLECTION_GROUP_C void Settings::CreateOptions() { CreateOptionDescriptions(); // clang-format off - mOptions[RSK_FOREST] = Option::U8("Forest", {"Closed", "Closed Deku", "Open"}, OptionCategory::Setting, "gRandomizeForest", mOptionDescriptions[RSK_FOREST], WidgetType::Combobox, RO_FOREST_CLOSED); - mOptions[RSK_KAK_GATE] = Option::U8("Kakariko Gate", {"Closed", "Open"}, OptionCategory::Setting, "gRandomizeKakarikoGate", mOptionDescriptions[RSK_KAK_GATE]); - mOptions[RSK_DOOR_OF_TIME] = Option::U8("Door of Time", {"Closed", "Song only", "Open"}, OptionCategory::Setting, "gRandomizeDoorOfTime", mOptionDescriptions[RSK_DOOR_OF_TIME], WidgetType::Combobox); - mOptions[RSK_ZORAS_FOUNTAIN] = Option::U8("Zora's Fountain", {"Closed", "Closed as child", "Open"}, OptionCategory::Setting, "gRandomizeZorasFountain", mOptionDescriptions[RSK_ZORAS_FOUNTAIN]); - mOptions[RSK_GERUDO_FORTRESS] = Option::U8("Gerudo Fortress", {"Normal", "Fast", "Open"}, OptionCategory::Setting, "gRandomizeGerudoFortress", mOptionDescriptions[RSK_GERUDO_FORTRESS]); - mOptions[RSK_RAINBOW_BRIDGE] = Option::U8("Rainbow Bridge", {"Vanilla", "Always open", "Stones", "Medallions", "Dungeon rewards", "Dungeons", "Tokens", "Greg"}, OptionCategory::Setting, "gRandomizeRainbowBridge", mOptionDescriptions[RSK_RAINBOW_BRIDGE], WidgetType::Combobox, RO_BRIDGE_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_RAINBOW_BRIDGE_STONE_COUNT] = Option::U8("Stone Count", {NumOpts(0, 4)}, OptionCategory::Setting, "gRandomizeStoneCount", "", WidgetType::Slider, 3, true); - mOptions[RSK_RAINBOW_BRIDGE_MEDALLION_COUNT] = Option::U8("Medallion Count", {NumOpts(0, 7)}, OptionCategory::Setting, "gRandomizeMedallionCount", "", WidgetType::Slider, 6, true); - mOptions[RSK_RAINBOW_BRIDGE_REWARD_COUNT] = Option::U8("Reward Count", {NumOpts(0, 10)}, OptionCategory::Setting, "gRandomizeRewardCount", "", WidgetType::Slider, 9, true); - mOptions[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT] = Option::U8("Dungeon Count", {NumOpts(0, 9)}, OptionCategory::Setting, "gRandomizeDungeonCount", "", WidgetType::Slider, 8, true); - mOptions[RSK_RAINBOW_BRIDGE_TOKEN_COUNT] = Option::U8("Token Count", {NumOpts(0, 100)}, OptionCategory::Setting, "gRandomizeTokenCount", "", WidgetType::Slider, 100, true); - mOptions[RSK_BRIDGE_OPTIONS] = Option::U8("Bridge Reward Options", {"Standard Rewards", "Greg as Reward", "Greg as Wildcard"}, OptionCategory::Setting, "gRandomizeBridgeRewardOptions", mOptionDescriptions[RSK_BRIDGE_OPTIONS], WidgetType::Combobox, RO_BRIDGE_STANDARD_REWARD, false, IMFLAG_NONE); - mOptions[RSK_GANONS_TRIALS] = Option::U8("Ganon's Trials", {"Skip", "Set Number", "Random Number"}, OptionCategory::Setting, "gRandomizeGanonTrial", mOptionDescriptions[RSK_GANONS_TRIALS], WidgetType::Combobox, RO_GANONS_TRIALS_SET_NUMBER); - mOptions[RSK_TRIAL_COUNT] = Option::U8("Ganon's Trials Count", {NumOpts(0, 6)}, OptionCategory::Setting, "gRandomizeGanonTrialCount", mOptionDescriptions[RSK_TRIAL_COUNT], WidgetType::Slider, 6, true); - mOptions[RSK_STARTING_AGE] = Option::U8("Starting Age", {"Child", "Adult", "Random"}, OptionCategory::Setting, "gRandomizeStartingAge", mOptionDescriptions[RSK_STARTING_AGE], WidgetType::Combobox, RO_AGE_CHILD); + mOptions[RSK_FOREST] = Option::U8("Forest", {"Closed", "Closed Deku", "Open"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("Forest"), mOptionDescriptions[RSK_FOREST], WidgetType::Combobox, RO_FOREST_CLOSED); + mOptions[RSK_KAK_GATE] = Option::U8("Kakariko Gate", {"Closed", "Open"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("KakarikoGate"), mOptionDescriptions[RSK_KAK_GATE]); + mOptions[RSK_DOOR_OF_TIME] = Option::U8("Door of Time", {"Closed", "Song only", "Open"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("DoorOfTime"), mOptionDescriptions[RSK_DOOR_OF_TIME], WidgetType::Combobox); + mOptions[RSK_ZORAS_FOUNTAIN] = Option::U8("Zora's Fountain", {"Closed", "Closed as child", "Open"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ZorasFountain"), mOptionDescriptions[RSK_ZORAS_FOUNTAIN]); + mOptions[RSK_GERUDO_FORTRESS] = Option::U8("Gerudo Fortress", {"Normal", "Fast", "Open"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("GerudoFortress"), mOptionDescriptions[RSK_GERUDO_FORTRESS]); + mOptions[RSK_RAINBOW_BRIDGE] = Option::U8("Rainbow Bridge", {"Vanilla", "Always open", "Stones", "Medallions", "Dungeon rewards", "Dungeons", "Tokens", "Greg"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("RainbowBridge"), mOptionDescriptions[RSK_RAINBOW_BRIDGE], WidgetType::Combobox, RO_BRIDGE_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_RAINBOW_BRIDGE_STONE_COUNT] = Option::U8("Stone Count", {NumOpts(0, 4)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("StoneCount"), "", WidgetType::Slider, 3, true); + mOptions[RSK_RAINBOW_BRIDGE_MEDALLION_COUNT] = Option::U8("Medallion Count", {NumOpts(0, 7)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MedallionCount"), "", WidgetType::Slider, 6, true); + mOptions[RSK_RAINBOW_BRIDGE_REWARD_COUNT] = Option::U8("Reward Count", {NumOpts(0, 10)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("RewardCount"), "", WidgetType::Slider, 9, true); + mOptions[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT] = Option::U8("Dungeon Count", {NumOpts(0, 9)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("DungeonCount"), "", WidgetType::Slider, 8, true); + mOptions[RSK_RAINBOW_BRIDGE_TOKEN_COUNT] = Option::U8("Token Count", {NumOpts(0, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("TokenCount"), "", WidgetType::Slider, 100, true); + mOptions[RSK_BRIDGE_OPTIONS] = Option::U8("Bridge Reward Options", {"Standard Rewards", "Greg as Reward", "Greg as Wildcard"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("BridgeRewardOptions"), mOptionDescriptions[RSK_BRIDGE_OPTIONS], WidgetType::Combobox, RO_BRIDGE_STANDARD_REWARD, false, IMFLAG_NONE); + mOptions[RSK_GANONS_TRIALS] = Option::U8("Ganon's Trials", {"Skip", "Set Number", "Random Number"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("GanonTrial"), mOptionDescriptions[RSK_GANONS_TRIALS], WidgetType::Combobox, RO_GANONS_TRIALS_SET_NUMBER); + mOptions[RSK_TRIAL_COUNT] = Option::U8("Ganon's Trials Count", {NumOpts(0, 6)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("GanonTrialCount"), mOptionDescriptions[RSK_TRIAL_COUNT], WidgetType::Slider, 6, true); + mOptions[RSK_STARTING_AGE] = Option::U8("Starting Age", {"Child", "Adult", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("StartingAge"), mOptionDescriptions[RSK_STARTING_AGE], WidgetType::Combobox, RO_AGE_CHILD); mOptions[RSK_SHUFFLE_ENTRANCES] = Option::Bool("Shuffle Entrances"); - mOptions[RSK_SHUFFLE_DUNGEON_ENTRANCES] = Option::U8("Dungeon Entrances", {"Off", "On", "On + Ganon"}, OptionCategory::Setting, "gRandomizeShuffleDungeonsEntrances", mOptionDescriptions[RSK_SHUFFLE_DUNGEON_ENTRANCES], WidgetType::Combobox, RO_DUNGEON_ENTRANCE_SHUFFLE_OFF); - mOptions[RSK_SHUFFLE_BOSS_ENTRANCES] = Option::U8("Boss Entrances", {"Off", "Age Restricted", "Full"}, OptionCategory::Setting, "gRandomizeShuffleBossEntrances", mOptionDescriptions[RSK_SHUFFLE_BOSS_ENTRANCES], WidgetType::Combobox, RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF); - mOptions[RSK_SHUFFLE_OVERWORLD_ENTRANCES] = Option::Bool("Overworld Entrances", "gRandomizeShuffleOverworldEntrances", mOptionDescriptions[RSK_SHUFFLE_OVERWORLD_ENTRANCES]); - mOptions[RSK_SHUFFLE_INTERIOR_ENTRANCES] = Option::U8("Interior Entrances", {"Off", "Simple", "All"}, OptionCategory::Setting, "gRandomizeShuffleInteriorsEntrances", mOptionDescriptions[RSK_SHUFFLE_INTERIOR_ENTRANCES], WidgetType::Combobox, RO_INTERIOR_ENTRANCE_SHUFFLE_OFF); - mOptions[RSK_SHUFFLE_GROTTO_ENTRANCES] = Option::Bool("Grottos Entrances", "gRandomizeShuffleGrottosEntrances", mOptionDescriptions[RSK_SHUFFLE_GROTTO_ENTRANCES]); - mOptions[RSK_SHUFFLE_OWL_DROPS] = Option::Bool("Owl Drops", "gRandomizeShuffleOwlDrops", mOptionDescriptions[RSK_SHUFFLE_OWL_DROPS]); - mOptions[RSK_SHUFFLE_WARP_SONGS] = Option::Bool("Warp Songs", "gRandomizeShuffleWarpSongs", mOptionDescriptions[RSK_SHUFFLE_WARP_SONGS]); - mOptions[RSK_SHUFFLE_OVERWORLD_SPAWNS] = Option::Bool("Overworld Spawns", "gRandomizeShuffleOverworldSpanws", mOptionDescriptions[RSK_SHUFFLE_OVERWORLD_SPAWNS]); - mOptions[RSK_MIXED_ENTRANCE_POOLS] = Option::Bool("Mixed Entrance Pools", "gRandomizeMixedEntrances", mOptionDescriptions[RSK_MIXED_ENTRANCE_POOLS]); - mOptions[RSK_MIX_DUNGEON_ENTRANCES] = Option::Bool("Mix Dungeons", "gRandomizeMixDungeons", mOptionDescriptions[RSK_MIX_DUNGEON_ENTRANCES], IMFLAG_NONE); - mOptions[RSK_MIX_BOSS_ENTRANCES] = Option::Bool("Mix Bosses", "gRandomizeMixBosses", mOptionDescriptions[RSK_MIX_BOSS_ENTRANCES], IMFLAG_NONE); - mOptions[RSK_MIX_OVERWORLD_ENTRANCES] = Option::Bool("Mix Overworld", "gRandomizeMixOverworld", mOptionDescriptions[RSK_MIX_OVERWORLD_ENTRANCES], IMFLAG_NONE); - mOptions[RSK_MIX_INTERIOR_ENTRANCES] = Option::Bool("Mix Interiors", "gRandomizeMixInteriors", mOptionDescriptions[RSK_MIX_INTERIOR_ENTRANCES], IMFLAG_NONE); - mOptions[RSK_MIX_GROTTO_ENTRANCES] = Option::Bool("Mix Grottos", "gRandomizeMixGrottos", mOptionDescriptions[RSK_MIX_GROTTO_ENTRANCES]); - mOptions[RSK_DECOUPLED_ENTRANCES] = Option::Bool("Decouple Entrances", "gRandomizeDecoupleEntrances", mOptionDescriptions[RSK_DECOUPLED_ENTRANCES]); - mOptions[RSK_BOMBCHUS_IN_LOGIC] = Option::Bool("Bombchus in Logic", "gRandomizeBombchusInLogic", mOptionDescriptions[RSK_BOMBCHUS_IN_LOGIC]); - mOptions[RSK_ENABLE_BOMBCHU_DROPS] = Option::U8("Bombchu Drops", {"No", "Yes"}, OptionCategory::Setting, "gRandomizeEnableBombchuDrops", mOptionDescriptions[RSK_ENABLE_BOMBCHU_DROPS], WidgetType::Combobox, RO_AMMO_DROPS_ON); + mOptions[RSK_SHUFFLE_DUNGEON_ENTRANCES] = Option::U8("Dungeon Entrances", {"Off", "On", "On + Ganon"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleDungeonsEntrances"), mOptionDescriptions[RSK_SHUFFLE_DUNGEON_ENTRANCES], WidgetType::Combobox, RO_DUNGEON_ENTRANCE_SHUFFLE_OFF); + mOptions[RSK_SHUFFLE_BOSS_ENTRANCES] = Option::U8("Boss Entrances", {"Off", "Age Restricted", "Full"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleBossEntrances"), mOptionDescriptions[RSK_SHUFFLE_BOSS_ENTRANCES], WidgetType::Combobox, RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF); + mOptions[RSK_SHUFFLE_OVERWORLD_ENTRANCES] = Option::Bool("Overworld Entrances", CVAR_RANDOMIZER_SETTING("ShuffleOverworldEntrances"), mOptionDescriptions[RSK_SHUFFLE_OVERWORLD_ENTRANCES]); + mOptions[RSK_SHUFFLE_INTERIOR_ENTRANCES] = Option::U8("Interior Entrances", {"Off", "Simple", "All"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleInteriorsEntrances"), mOptionDescriptions[RSK_SHUFFLE_INTERIOR_ENTRANCES], WidgetType::Combobox, RO_INTERIOR_ENTRANCE_SHUFFLE_OFF); + mOptions[RSK_SHUFFLE_GROTTO_ENTRANCES] = Option::Bool("Grottos Entrances", CVAR_RANDOMIZER_SETTING("ShuffleGrottosEntrances"), mOptionDescriptions[RSK_SHUFFLE_GROTTO_ENTRANCES]); + mOptions[RSK_SHUFFLE_OWL_DROPS] = Option::Bool("Owl Drops", CVAR_RANDOMIZER_SETTING("ShuffleOwlDrops"), mOptionDescriptions[RSK_SHUFFLE_OWL_DROPS]); + mOptions[RSK_SHUFFLE_WARP_SONGS] = Option::Bool("Warp Songs", CVAR_RANDOMIZER_SETTING("ShuffleWarpSongs"), mOptionDescriptions[RSK_SHUFFLE_WARP_SONGS]); + mOptions[RSK_SHUFFLE_OVERWORLD_SPAWNS] = Option::Bool("Overworld Spawns", CVAR_RANDOMIZER_SETTING("ShuffleOverworldSpanws"), mOptionDescriptions[RSK_SHUFFLE_OVERWORLD_SPAWNS]); + mOptions[RSK_MIXED_ENTRANCE_POOLS] = Option::Bool("Mixed Entrance Pools", CVAR_RANDOMIZER_SETTING("MixedEntrances"), mOptionDescriptions[RSK_MIXED_ENTRANCE_POOLS]); + mOptions[RSK_MIX_DUNGEON_ENTRANCES] = Option::Bool("Mix Dungeons", CVAR_RANDOMIZER_SETTING("MixDungeons"), mOptionDescriptions[RSK_MIX_DUNGEON_ENTRANCES], IMFLAG_NONE); + mOptions[RSK_MIX_BOSS_ENTRANCES] = Option::Bool("Mix Bosses", CVAR_RANDOMIZER_SETTING("MixBosses"), mOptionDescriptions[RSK_MIX_BOSS_ENTRANCES], IMFLAG_NONE); + mOptions[RSK_MIX_OVERWORLD_ENTRANCES] = Option::Bool("Mix Overworld", CVAR_RANDOMIZER_SETTING("MixOverworld"), mOptionDescriptions[RSK_MIX_OVERWORLD_ENTRANCES], IMFLAG_NONE); + mOptions[RSK_MIX_INTERIOR_ENTRANCES] = Option::Bool("Mix Interiors", CVAR_RANDOMIZER_SETTING("MixInteriors"), mOptionDescriptions[RSK_MIX_INTERIOR_ENTRANCES], IMFLAG_NONE); + mOptions[RSK_MIX_GROTTO_ENTRANCES] = Option::Bool("Mix Grottos", CVAR_RANDOMIZER_SETTING("MixGrottos"), mOptionDescriptions[RSK_MIX_GROTTO_ENTRANCES]); + mOptions[RSK_DECOUPLED_ENTRANCES] = Option::Bool("Decouple Entrances", CVAR_RANDOMIZER_SETTING("DecoupleEntrances"), mOptionDescriptions[RSK_DECOUPLED_ENTRANCES]); + mOptions[RSK_BOMBCHUS_IN_LOGIC] = Option::Bool("Bombchus in Logic", CVAR_RANDOMIZER_SETTING("BombchusInLogic"), mOptionDescriptions[RSK_BOMBCHUS_IN_LOGIC]); + mOptions[RSK_ENABLE_BOMBCHU_DROPS] = Option::U8("Bombchu Drops", {"No", "Yes"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), mOptionDescriptions[RSK_ENABLE_BOMBCHU_DROPS], WidgetType::Combobox, RO_AMMO_DROPS_ON); // TODO: AmmoDrops and/or HeartDropRefill, combine with/separate Ammo Drops from Bombchu Drops? - mOptions[RSK_TRIFORCE_HUNT] = Option::Bool("Triforce Hunt", "gRandomizeTriforceHunt", mOptionDescriptions[RSK_TRIFORCE_HUNT], IMFLAG_NONE); - mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL] = Option::U8("Triforce Hunt Total Pieces", {NumOpts(1, 100)}, OptionCategory::Setting, "gRandomizeTriforceHuntTotalPieces", mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL], WidgetType::Slider, 29, false, IMFLAG_NONE); - mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED] = Option::U8("Triforce Hunt Required Pieces", {NumOpts(1, 100)}, OptionCategory::Setting, "gRandomizeTriforceHuntRequiredPieces", mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED], WidgetType::Slider, 19); - mOptions[RSK_MQ_DUNGEON_RANDOM] = Option::U8("MQ Dungeon Setting", {"None", "Set Number", "Random", "Selection Only"}, OptionCategory::Setting, "gRandomizeMqDungeons", mOptionDescriptions[RSK_MQ_DUNGEON_RANDOM], WidgetType::Combobox, RO_MQ_DUNGEONS_NONE, true, IMFLAG_NONE); - mOptions[RSK_MQ_DUNGEON_COUNT] = Option::U8("MQ Dungeon Count", {NumOpts(0, 12)}, OptionCategory::Setting, "gRandomizeMqDungeonCount", "", WidgetType::Slider, 12, true, IMFLAG_NONE); - mOptions[RSK_MQ_DUNGEON_SET] = Option::Bool("Set Dungeon Quests", {"Off", "On"}, OptionCategory::Setting, "gRandomizeMqDungeonsSelection", mOptionDescriptions[RSK_MQ_DUNGEON_SET], WidgetType::Checkbox, false, false, IMFLAG_NONE); - mOptions[RSK_MQ_DEKU_TREE] = Option::U8("Deku Tree", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsDekuTree", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_MQ_DODONGOS_CAVERN] = Option::U8("Dodongo's Cavern", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsDodongosCavern", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_MQ_JABU_JABU] = Option::U8("Jabu-Jabu's Belly", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsJabuJabu", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_MQ_FOREST_TEMPLE] = Option::U8("Forest Temple", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsForestTemple", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_MQ_FIRE_TEMPLE] = Option::U8("Fire Temple", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsFireTemple", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_MQ_WATER_TEMPLE] = Option::U8("Water Temple", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsWaterTemple", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_MQ_SPIRIT_TEMPLE] = Option::U8("Spirit Temple", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsSpiritTemple", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_MQ_SHADOW_TEMPLE] = Option::U8("Shadow Temple", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsShadowTemple", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_MQ_BOTTOM_OF_THE_WELL] = Option::U8("Bottom of the Well", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsBottomOfTheWell", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_MQ_ICE_CAVERN] = Option::U8("Ice Cavern", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsIceCavern", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_MQ_GTG] = Option::U8("Gerudo Training Grounds", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsGTG", "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); - mOptions[RSK_MQ_GANONS_CASTLE] = Option::U8("Ganon's Castle", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, "gRandomizeMqDungeonsGanonsCastle", "", WidgetType::Combobox, RO_MQ_SET_VANILLA); - mOptions[RSK_SHUFFLE_DUNGEON_REWARDS] = Option::U8("Shuffle Dungeon Rewards", {"End of Dungeons", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, "gRandomizeShuffleDungeonReward", mOptionDescriptions[RSK_SHUFFLE_DUNGEON_REWARDS], WidgetType::Combobox, RO_DUNGEON_REWARDS_END_OF_DUNGEON); - mOptions[RSK_LINKS_POCKET] = Option::U8("Link's Pocket", {"Dungeon Reward", "Advancement", "Anything", "Nothing"}, OptionCategory::Setting, "gRandomizeLinksPocket", "", WidgetType::Combobox, RO_LINKS_POCKET_DUNGEON_REWARD); - mOptions[RSK_SHUFFLE_SONGS] = Option::U8("Shuffle Songs", {"Song Locations", "Dungeon Rewards", "Anywhere"}, OptionCategory::Setting, "gRandomizeShuffleSongs", mOptionDescriptions[RSK_SHUFFLE_SONGS], WidgetType::Combobox, RO_SONG_SHUFFLE_SONG_LOCATIONS); - mOptions[RSK_SHOPSANITY] = Option::U8("Shopsanity", {"Off", "0 Items", "1 Item", "2 Items", "3 Items", "4 Items", "Random"}, OptionCategory::Setting, "gRandomizeShopsanity", mOptionDescriptions[RSK_SHOPSANITY], WidgetType::Combobox, RO_SHOPSANITY_OFF); - mOptions[RSK_SHOPSANITY_PRICES] = Option::U8("Shopsanity Prices", {"Balanced", "Starting Wallet", "Adult Wallet", "Giant's Wallet", "Tycoon's Wallet"}, OptionCategory::Setting, "gRandomizeShopsanityPrices", mOptionDescriptions[RSK_SHOPSANITY_PRICES], WidgetType::Combobox, RO_SHOPSANITY_PRICE_BALANCED, false, IMFLAG_NONE); - mOptions[RSK_SHOPSANITY_PRICES_AFFORDABLE] = Option::Bool("Affordable Prices", "gRandomizeShopsanityPricesAffordable", mOptionDescriptions[RSK_SHOPSANITY_PRICES_AFFORDABLE]); - mOptions[RSK_SHUFFLE_TOKENS] = Option::U8("Tokensanity", {"Off", "Dungeons", "Overworld", "All Tokens"}, OptionCategory::Setting, "gRandomizeShuffleTokens", mOptionDescriptions[RSK_SHUFFLE_TOKENS], WidgetType::Combobox, RO_TOKENSANITY_OFF); - mOptions[RSK_SHUFFLE_SCRUBS] = Option::U8("Scrub Shuffle", {"Off", "Affordable", "Expensive", "Random Prices"}, OptionCategory::Setting, "gRandomizeShuffleScrubs", mOptionDescriptions[RSK_SHUFFLE_SCRUBS], WidgetType::Combobox, RO_SCRUBS_OFF); - mOptions[RSK_SHUFFLE_BEEHIVES] = Option::Bool("Shuffle Beehives", "gRandomizeShuffleBeehives", mOptionDescriptions[RSK_SHUFFLE_BEEHIVES]); - mOptions[RSK_SHUFFLE_COWS] = Option::Bool("Shuffle Cows", "gRandomizeShuffleCows", mOptionDescriptions[RSK_SHUFFLE_COWS]); - mOptions[RSK_SHUFFLE_KOKIRI_SWORD] = Option::Bool("Shuffle Kokiri Sword", "gRandomizeShuffleKokiriSword", mOptionDescriptions[RSK_SHUFFLE_KOKIRI_SWORD]); - mOptions[RSK_SHUFFLE_MASTER_SWORD] = Option::Bool("Shuffle Master Sword", "gRandomizeShuffleMasterSword", mOptionDescriptions[RSK_SHUFFLE_MASTER_SWORD]); - mOptions[RSK_SHUFFLE_CHILD_WALLET] = Option::Bool("Shuffle Child's Wallet", "gRandomizeShuffleChildWallet", mOptionDescriptions[RSK_SHUFFLE_CHILD_WALLET]); - mOptions[RSK_SHUFFLE_OCARINA] = Option::Bool("Shuffle Ocarinas", "gRandomizeShuffleOcarinas", mOptionDescriptions[RSK_SHUFFLE_OCARINA]); - mOptions[RSK_SHUFFLE_OCARINA_BUTTONS] = Option::Bool("Shuffle Ocarina Buttons", "gRandomizeShuffleOcarinaButtons", mOptionDescriptions[RSK_SHUFFLE_OCARINA_BUTTONS]); - mOptions[RSK_SHUFFLE_SWIM] = Option::Bool("Shuffle Swim", "gRandomizeShuffleSwim", mOptionDescriptions[RSK_SHUFFLE_SWIM]); - mOptions[RSK_SHUFFLE_WEIRD_EGG] = Option::Bool("Shuffle Weird Egg", "gRandomizeShuffleWeirdEgg", mOptionDescriptions[RSK_SHUFFLE_WEIRD_EGG]); - mOptions[RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD] = Option::Bool("Shuffle Gerudo Membership Card", "gRandomizeShuffleGerudoToken", mOptionDescriptions[RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD]); - mOptions[RSK_SHUFFLE_FISHING_POLE] = Option::Bool("Shuffle Fishing Pole", "gRandomizeShuffleFishingPole", mOptionDescriptions[RSK_SHUFFLE_FISHING_POLE]); - mOptions[RSK_SHUFFLE_MAGIC_BEANS] = Option::Bool("Shuffle Magic Beans", "gRandomizeShuffleBeans", mOptionDescriptions[RSK_SHUFFLE_MAGIC_BEANS]); - mOptions[RSK_SHUFFLE_MERCHANTS] = Option::U8("Shuffle Merchants", {"Off", "On (No Hints)", "On (With Hints)"}, OptionCategory::Setting, "gRandomizeShuffleMerchants", mOptionDescriptions[RSK_SHUFFLE_MERCHANTS], WidgetType::Combobox, RO_SHUFFLE_MERCHANTS_OFF); - mOptions[RSK_SHUFFLE_FROG_SONG_RUPEES] = Option::Bool("Shuffle Frog Song Rupees", "gRandomizeShuffleFrogSongRupees", mOptionDescriptions[RSK_SHUFFLE_FROG_SONG_RUPEES]); - mOptions[RSK_SHUFFLE_ADULT_TRADE] = Option::Bool("Shuffle Adult Trade", "gRandomizeShuffleAdultTrade", mOptionDescriptions[RSK_SHUFFLE_ADULT_TRADE]); + mOptions[RSK_TRIFORCE_HUNT] = Option::Bool("Triforce Hunt", CVAR_RANDOMIZER_SETTING("TriforceHunt"), mOptionDescriptions[RSK_TRIFORCE_HUNT], IMFLAG_NONE); + mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL] = Option::U8("Triforce Hunt Total Pieces", {NumOpts(1, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("TriforceHuntTotalPieces"), mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL], WidgetType::Slider, 29, false, IMFLAG_NONE); + mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED] = Option::U8("Triforce Hunt Required Pieces", {NumOpts(1, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("TriforceHuntRequiredPieces"), mOptionDescriptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED], WidgetType::Slider, 19); + mOptions[RSK_MQ_DUNGEON_RANDOM] = Option::U8("MQ Dungeon Setting", {"None", "Set Number", "Random", "Selection Only"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeons"), mOptionDescriptions[RSK_MQ_DUNGEON_RANDOM], WidgetType::Combobox, RO_MQ_DUNGEONS_NONE, true, IMFLAG_NONE); + mOptions[RSK_MQ_DUNGEON_COUNT] = Option::U8("MQ Dungeon Count", {NumOpts(0, 12)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonCount"), "", WidgetType::Slider, 12, true, IMFLAG_NONE); + mOptions[RSK_MQ_DUNGEON_SET] = Option::Bool("Set Dungeon Quests", {"Off", "On"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsSelection"), mOptionDescriptions[RSK_MQ_DUNGEON_SET], WidgetType::Checkbox, false, false, IMFLAG_NONE); + mOptions[RSK_MQ_DEKU_TREE] = Option::U8("Deku Tree", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsDekuTree"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_MQ_DODONGOS_CAVERN] = Option::U8("Dodongo's Cavern", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsDodongosCavern"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_MQ_JABU_JABU] = Option::U8("Jabu-Jabu's Belly", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsJabuJabu"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_MQ_FOREST_TEMPLE] = Option::U8("Forest Temple", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsForestTemple"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_MQ_FIRE_TEMPLE] = Option::U8("Fire Temple", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsFireTemple"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_MQ_WATER_TEMPLE] = Option::U8("Water Temple", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsWaterTemple"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_MQ_SPIRIT_TEMPLE] = Option::U8("Spirit Temple", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsSpiritTemple"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_MQ_SHADOW_TEMPLE] = Option::U8("Shadow Temple", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsShadowTemple"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_MQ_BOTTOM_OF_THE_WELL] = Option::U8("Bottom of the Well", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsBottomOfTheWell"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_MQ_ICE_CAVERN] = Option::U8("Ice Cavern", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsIceCavern"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_MQ_GTG] = Option::U8("Gerudo Training Grounds", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsGTG"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA, false, IMFLAG_NONE); + mOptions[RSK_MQ_GANONS_CASTLE] = Option::U8("Ganon's Castle", {"Vanilla", "Master Quest", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("MQDungeonsGanonsCastle"), "", WidgetType::Combobox, RO_MQ_SET_VANILLA); + mOptions[RSK_SHUFFLE_DUNGEON_REWARDS] = Option::U8("Shuffle Dungeon Rewards", {"End of Dungeons", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleDungeonReward"), mOptionDescriptions[RSK_SHUFFLE_DUNGEON_REWARDS], WidgetType::Combobox, RO_DUNGEON_REWARDS_END_OF_DUNGEON); + mOptions[RSK_LINKS_POCKET] = Option::U8("Link's Pocket", {"Dungeon Reward", "Advancement", "Anything", "Nothing"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LinksPocket"), "", WidgetType::Combobox, RO_LINKS_POCKET_DUNGEON_REWARD); + mOptions[RSK_SHUFFLE_SONGS] = Option::U8("Shuffle Songs", {"Song Locations", "Dungeon Rewards", "Anywhere"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleSongs"), mOptionDescriptions[RSK_SHUFFLE_SONGS], WidgetType::Combobox, RO_SONG_SHUFFLE_SONG_LOCATIONS); + mOptions[RSK_SHOPSANITY] = Option::U8("Shopsanity", {"Off", "0 Items", "1 Item", "2 Items", "3 Items", "4 Items", "Random"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("Shopsanity"), mOptionDescriptions[RSK_SHOPSANITY], WidgetType::Combobox, RO_SHOPSANITY_OFF); + mOptions[RSK_SHOPSANITY_PRICES] = Option::U8("Shopsanity Prices", {"Balanced", "Starting Wallet", "Adult Wallet", "Giant's Wallet", "Tycoon's Wallet"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShopsanityPrices"), mOptionDescriptions[RSK_SHOPSANITY_PRICES], WidgetType::Combobox, RO_SHOPSANITY_PRICE_BALANCED, false, IMFLAG_NONE); + mOptions[RSK_SHOPSANITY_PRICES_AFFORDABLE] = Option::Bool("Affordable Prices", CVAR_RANDOMIZER_SETTING("ShopsanityPricesAffordable"), mOptionDescriptions[RSK_SHOPSANITY_PRICES_AFFORDABLE]); + mOptions[RSK_SHUFFLE_TOKENS] = Option::U8("Tokensanity", {"Off", "Dungeons", "Overworld", "All Tokens"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleTokens"), mOptionDescriptions[RSK_SHUFFLE_TOKENS], WidgetType::Combobox, RO_TOKENSANITY_OFF); + mOptions[RSK_SHUFFLE_SCRUBS] = Option::U8("Scrub Shuffle", {"Off", "Affordable", "Expensive", "Random Prices"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), mOptionDescriptions[RSK_SHUFFLE_SCRUBS], WidgetType::Combobox, RO_SCRUBS_OFF); + mOptions[RSK_SHUFFLE_BEEHIVES] = Option::Bool("Shuffle Beehives", CVAR_RANDOMIZER_SETTING("ShuffleBeehives"), mOptionDescriptions[RSK_SHUFFLE_BEEHIVES]); + mOptions[RSK_SHUFFLE_COWS] = Option::Bool("Shuffle Cows", CVAR_RANDOMIZER_SETTING("ShuffleCows"), mOptionDescriptions[RSK_SHUFFLE_COWS]); + mOptions[RSK_SHUFFLE_KOKIRI_SWORD] = Option::Bool("Shuffle Kokiri Sword", CVAR_RANDOMIZER_SETTING("ShuffleKokiriSword"), mOptionDescriptions[RSK_SHUFFLE_KOKIRI_SWORD]); + mOptions[RSK_SHUFFLE_MASTER_SWORD] = Option::Bool("Shuffle Master Sword", CVAR_RANDOMIZER_SETTING("ShuffleMasterSword"), mOptionDescriptions[RSK_SHUFFLE_MASTER_SWORD]); + mOptions[RSK_SHUFFLE_CHILD_WALLET] = Option::Bool("Shuffle Child's Wallet", CVAR_RANDOMIZER_SETTING("ShuffleChildWallet"), mOptionDescriptions[RSK_SHUFFLE_CHILD_WALLET]); + mOptions[RSK_SHUFFLE_OCARINA] = Option::Bool("Shuffle Ocarinas", CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), mOptionDescriptions[RSK_SHUFFLE_OCARINA]); + mOptions[RSK_SHUFFLE_OCARINA_BUTTONS] = Option::Bool("Shuffle Ocarina Buttons", CVAR_RANDOMIZER_SETTING("ShuffleOcarinaButtons"), mOptionDescriptions[RSK_SHUFFLE_OCARINA_BUTTONS]); + mOptions[RSK_SHUFFLE_SWIM] = Option::Bool("Shuffle Swim", CVAR_RANDOMIZER_SETTING("ShuffleSwim"), mOptionDescriptions[RSK_SHUFFLE_SWIM]); + mOptions[RSK_SHUFFLE_WEIRD_EGG] = Option::Bool("Shuffle Weird Egg", CVAR_RANDOMIZER_SETTING("ShuffleWeirdEgg"), mOptionDescriptions[RSK_SHUFFLE_WEIRD_EGG]); + mOptions[RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD] = Option::Bool("Shuffle Gerudo Membership Card", CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), mOptionDescriptions[RSK_SHUFFLE_GERUDO_MEMBERSHIP_CARD]); + mOptions[RSK_SHUFFLE_FISHING_POLE] = Option::Bool("Shuffle Fishing Pole", CVAR_RANDOMIZER_SETTING("ShuffleFishingPole"), mOptionDescriptions[RSK_SHUFFLE_FISHING_POLE]); + mOptions[RSK_SHUFFLE_MAGIC_BEANS] = Option::Bool("Shuffle Magic Beans", CVAR_RANDOMIZER_SETTING("ShuffleBeans"), mOptionDescriptions[RSK_SHUFFLE_MAGIC_BEANS]); + mOptions[RSK_SHUFFLE_MERCHANTS] = Option::U8("Shuffle Merchants", {"Off", "On (No Hints)", "On (With Hints)"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleMerchants"), mOptionDescriptions[RSK_SHUFFLE_MERCHANTS], WidgetType::Combobox, RO_SHUFFLE_MERCHANTS_OFF); + mOptions[RSK_SHUFFLE_FROG_SONG_RUPEES] = Option::Bool("Shuffle Frog Song Rupees", CVAR_RANDOMIZER_SETTING("ShuffleFrogSongRupees"), mOptionDescriptions[RSK_SHUFFLE_FROG_SONG_RUPEES]); + mOptions[RSK_SHUFFLE_ADULT_TRADE] = Option::Bool("Shuffle Adult Trade", CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), mOptionDescriptions[RSK_SHUFFLE_ADULT_TRADE]); mOptions[RSK_SHUFFLE_CHEST_MINIGAME] = Option::U8("Shuffle Chest Minigame", {"Off", "On (Separate)", "On (Pack)"}); - mOptions[RSK_SHUFFLE_100_GS_REWARD] = Option::Bool("Shuffle 100 GS Reward", "gRandomizeShuffle100GSReward", mOptionDescriptions[RSK_SHUFFLE_100_GS_REWARD], IMFLAG_SEPARATOR_BOTTOM, WidgetType::Checkbox, RO_GENERIC_OFF); - mOptions[RSK_SHUFFLE_BOSS_SOULS] = Option::U8("Shuffle Boss Souls", {"Off", "On", "On + Ganon"}, OptionCategory::Setting, "gRandomizeShuffleBossSouls", mOptionDescriptions[RSK_SHUFFLE_BOSS_SOULS], WidgetType::Combobox); - mOptions[RSK_FISHSANITY] = Option::U8("Fishsanity", {"Off", "Shuffle Fishing Pond", "Shuffle Overworld Fish", "Shuffle Both"}, OptionCategory::Setting, "gRandomizeFishsanity", mOptionDescriptions[RSK_FISHSANITY], WidgetType::Combobox, RO_FISHSANITY_OFF); - mOptions[RSK_FISHSANITY_POND_COUNT] = Option::U8("Pond Fish Count", {NumOpts(0,17,1)}, OptionCategory::Setting, "gRandomizeFishsanityPondCount", mOptionDescriptions[RSK_FISHSANITY_POND_COUNT], WidgetType::Slider, 0, true, IMFLAG_NONE); - mOptions[RSK_FISHSANITY_AGE_SPLIT] = Option::Bool("Pond Age Split", "gRandomizeFishsanityAgeSplit", mOptionDescriptions[RSK_FISHSANITY_AGE_SPLIT]); - mOptions[RSK_SHUFFLE_MAPANDCOMPASS] = Option::U8("Maps/Compasses", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, "gRandomizeStartingMapsCompasses", mOptionDescriptions[RSK_SHUFFLE_MAPANDCOMPASS], WidgetType::Combobox, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON); - mOptions[RSK_KEYSANITY] = Option::U8("Small Keys", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, "gRandomizeKeysanity", mOptionDescriptions[RSK_KEYSANITY], WidgetType::Combobox, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON); - mOptions[RSK_GERUDO_KEYS] = Option::U8("Gerudo Fortress Keys", {"Vanilla", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, "gRandomizeGerudoKeys", mOptionDescriptions[RSK_GERUDO_KEYS], WidgetType::Combobox, RO_GERUDO_KEYS_VANILLA); - mOptions[RSK_BOSS_KEYSANITY] = Option::U8("Boss Keys", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, "gRandomizeBossKeysanity", mOptionDescriptions[RSK_BOSS_KEYSANITY], WidgetType::Combobox, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON); - mOptions[RSK_GANONS_BOSS_KEY] = Option::U8("Ganon's Boss Key", {"Vanilla", "Own Dungeon", "Start With", "Any Dungeon", "Overworld", "Anywhere", "LACS-Vanilla", "LACS-Stones", "LACS-Medallions", "LACS-Rewards", "LACS-Dungeons", "LACS-Tokens", "Triforce Hunt"}, OptionCategory::Setting, "gRandomizeShuffleGanonBossKey", mOptionDescriptions[RSK_GANONS_BOSS_KEY], WidgetType::Combobox, RO_GANON_BOSS_KEY_VANILLA); - mOptions[RSK_LACS_STONE_COUNT] = Option::U8("Stone Count", {NumOpts(0, 4)}, OptionCategory::Setting, "gRandomizeLacsStoneCount", "", WidgetType::Slider, 3, true); - mOptions[RSK_LACS_MEDALLION_COUNT] = Option::U8("Medallion Count", {NumOpts(0, 7)}, OptionCategory::Setting, "gRandomizeLacsMedallionCount", "", WidgetType::Slider, 6, true); - mOptions[RSK_LACS_REWARD_COUNT] = Option::U8("Reward Count", {NumOpts(0, 10)}, OptionCategory::Setting, "gRandomizeLacsRewardCount", "", WidgetType::Slider, 9, true); - mOptions[RSK_LACS_DUNGEON_COUNT] = Option::U8("Dungeon Count", {NumOpts(0, 9)}, OptionCategory::Setting, "gRandomizeLacsDungeonCount", "", WidgetType::Slider, 8, true); - mOptions[RSK_LACS_TOKEN_COUNT] = Option::U8("Token Count", {NumOpts(0, 100)}, OptionCategory::Setting, "gRandomizeLacsTokenCount", "", WidgetType::Slider, 100, true); - mOptions[RSK_LACS_OPTIONS] = Option::U8("LACS Reward Options", {"Standard Reward", "Greg as Reward", "Greg as Wildcard"}, OptionCategory::Setting, "gRandomizeLacsRewardOptions", "", WidgetType::Combobox, RO_LACS_STANDARD_REWARD); - mOptions[RSK_KEYRINGS] = Option::U8("Key Rings", {"Off", "Random", "Count", "Selection"}, OptionCategory::Setting, "gRandomizeShuffleKeyRings", mOptionDescriptions[RSK_KEYRINGS], WidgetType::Combobox, RO_KEYRINGS_OFF); - mOptions[RSK_KEYRINGS_RANDOM_COUNT] = Option::U8("Keyring Dungeon Count", {NumOpts(0, 9)}, OptionCategory::Setting, "gRandomizeShuffleKeyRingsRandomCount", "", WidgetType::Slider, 8); - mOptions[RSK_KEYRINGS_GERUDO_FORTRESS] = Option::Bool("Gerudo Fortress", "gRandomizeShuffleKeyRingsGerudoFortress", "", IMFLAG_NONE); - mOptions[RSK_KEYRINGS_FOREST_TEMPLE] = Option::Bool("Forest Temple", "gRandomizeShuffleKeyRingsForestTemple", "", IMFLAG_NONE); - mOptions[RSK_KEYRINGS_FIRE_TEMPLE] = Option::Bool("Fire Temple", "gRandomizeShuffleKeyRingsFireTemple", "", IMFLAG_NONE); - mOptions[RSK_KEYRINGS_WATER_TEMPLE] = Option::Bool("Water Temple", "gRandomizeShuffleKeyRingsWaterTemple", "", IMFLAG_NONE); - mOptions[RSK_KEYRINGS_SPIRIT_TEMPLE] = Option::Bool("Spirit Temple", "gRandomizeShuffleKeyRingsSpiritTemple", "", IMFLAG_NONE); - mOptions[RSK_KEYRINGS_SHADOW_TEMPLE] = Option::Bool("Shadow Temple", "gRandomizeShuffleKeyRingsShadowTemple", "", IMFLAG_NONE); - mOptions[RSK_KEYRINGS_BOTTOM_OF_THE_WELL] = Option::Bool("Bottom of the Well", "gRandomizeShuffleKeyRingsBottomOfTheWell", "", IMFLAG_NONE); - mOptions[RSK_KEYRINGS_GTG] = Option::Bool("Gerudo Training Grounds", "gRandomizeShuffleKeyRingsGTG", "", IMFLAG_NONE); - mOptions[RSK_KEYRINGS_GANONS_CASTLE] = Option::Bool("Ganon's Castle", "gRandomizeShuffleKeyRingsGanonsCastle"); - mOptions[RSK_SKIP_CHILD_STEALTH] = Option::Bool("Skip Child Stealth", {"Don't Skip", "Skip"}, OptionCategory::Setting, "gRandomizeSkipChildStealth", mOptionDescriptions[RSK_SKIP_CHILD_STEALTH], WidgetType::Checkbox, RO_GENERIC_DONT_SKIP); - mOptions[RSK_SKIP_CHILD_ZELDA] = Option::Bool("Skip Child Zelda", {"Don't Skip", "Skip"}, OptionCategory::Setting, "gRandomizeSkipChildZelda", mOptionDescriptions[RSK_SKIP_CHILD_ZELDA], WidgetType::Checkbox, RO_GENERIC_DONT_SKIP); - mOptions[RSK_SKIP_EPONA_RACE] = Option::Bool("Skip Epona Race", {"Don't Skip", "Skip"}, OptionCategory::Setting, "gRandomizeSkipEponaRace", mOptionDescriptions[RSK_SKIP_EPONA_RACE], WidgetType::Checkbox, RO_GENERIC_DONT_SKIP); - mOptions[RSK_SKIP_SCARECROWS_SONG] = Option::Bool("Skip Scarecrow's Song", "gRandomizeSkipScarecrowsSong", mOptionDescriptions[RSK_SKIP_SCARECROWS_SONG]); - mOptions[RSK_BIG_POE_COUNT] = Option::U8("Big Poe Target Count", {NumOpts(1, 10)}, OptionCategory::Setting, "gRandomizeBigPoeTargetCount", mOptionDescriptions[RSK_BIG_POE_COUNT], WidgetType::Slider, 9); - mOptions[RSK_CUCCO_COUNT] = Option::U8("Cuccos to return", {NumOpts(0, 7)}, OptionCategory::Setting, "gRandomizeCuccosToReturn", mOptionDescriptions[RSK_CUCCO_COUNT], WidgetType::Slider, 7); - mOptions[RSK_COMPLETE_MASK_QUEST] = Option::Bool("Complete Mask Quest", "gRandomizeCompleteMaskQuest", mOptionDescriptions[RSK_COMPLETE_MASK_QUEST]); - mOptions[RSK_ENABLE_GLITCH_CUTSCENES] = Option::Bool("Enable Glitch-Useful Cutscenes", "gRandomizeEnableGlitchCutscenes", mOptionDescriptions[RSK_ENABLE_GLITCH_CUTSCENES]); - mOptions[RSK_GOSSIP_STONE_HINTS] = Option::U8("Gossip Stone Hints", {"No Hints", "Need Nothing", "Mask of Truth", "Stone of Agony"}, OptionCategory::Setting, "gRandomizeGossipStoneHints", mOptionDescriptions[RSK_GOSSIP_STONE_HINTS], WidgetType::Combobox, RO_GOSSIP_STONES_NEED_NOTHING, false, IMFLAG_NONE); - mOptions[RSK_HINT_CLARITY] = Option::U8("Hint Clarity", {"Obscure", "Ambiguous", "Clear"}, OptionCategory::Setting, "gRandomizeHintClarity", mOptionDescriptions[RSK_HINT_CLARITY], WidgetType::Combobox, RO_HINT_CLARITY_CLEAR, true, IMFLAG_INDENT); - mOptions[RSK_HINT_DISTRIBUTION] = Option::U8("Hint Distribution", {"Useless", "Balanced", "Strong", "Very Strong"}, OptionCategory::Setting, "gRandomizeHintDistribution", mOptionDescriptions[RSK_HINT_DISTRIBUTION], WidgetType::Combobox, RO_HINT_DIST_BALANCED, true, IMFLAG_UNINDENT); - mOptions[RSK_TOT_ALTAR_HINT] = Option::Bool("ToT Altar Hint", {"Off", "On"}, OptionCategory::Setting, "gRandomizeAltarHint", mOptionDescriptions[RSK_TOT_ALTAR_HINT], WidgetType::Checkbox, RO_GENERIC_ON, false, IMFLAG_INDENT); - mOptions[RSK_GANONDORF_HINT] = Option::Bool("Ganondorf Hint", {"Off", "On"}, OptionCategory::Setting, "gRandomizeGanondorfHint", mOptionDescriptions[RSK_GANONDORF_HINT], WidgetType::Checkbox, RO_GENERIC_ON, false, IMFLAG_NONE); - mOptions[RSK_SHEIK_LA_HINT] = Option::Bool("Sheik Light Arrow Hint", {"Off", "On"}, OptionCategory::Setting, "gRandomizeSheikLAHint", mOptionDescriptions[RSK_SHEIK_LA_HINT], WidgetType::Checkbox, RO_GENERIC_ON, false, IMFLAG_NONE); - mOptions[RSK_DAMPES_DIARY_HINT] = Option::Bool("Dampe's Diary Hint", "gRandomizeDampeHint", mOptionDescriptions[RSK_DAMPES_DIARY_HINT], IMFLAG_NONE); - mOptions[RSK_GREG_HINT] = Option::Bool("Greg the Green Rupee Hint", "gRandomizeGregHint", mOptionDescriptions[RSK_GREG_HINT], IMFLAG_NONE); - mOptions[RSK_SARIA_HINT] = Option::Bool("Saria's Hint", "gRandomizeSariaHint", mOptionDescriptions[RSK_SARIA_HINT], IMFLAG_NONE); - mOptions[RSK_FISHING_POLE_HINT] = Option::Bool("Fishing Pole Hint", "gRandomizeFishingPoleHint", mOptionDescriptions[RSK_FISHING_POLE_HINT], IMFLAG_NONE); - mOptions[RSK_FROGS_HINT] = Option::Bool("Frog Ocarina Game Hint", "gRandomizeFrogsHint", mOptionDescriptions[RSK_FROGS_HINT], IMFLAG_NONE); - mOptions[RSK_BIGGORON_HINT] = Option::Bool("Biggoron's Hint", "gRandomizeBiggoronHint", mOptionDescriptions[RSK_BIGGORON_HINT], IMFLAG_NONE); - mOptions[RSK_BIG_POES_HINT] = Option::Bool("Big Poes Hint", "gRandomizeBigPoesHint", mOptionDescriptions[RSK_BIG_POES_HINT], IMFLAG_NONE); - mOptions[RSK_CHICKENS_HINT] = Option::Bool("Chickens Hint", "gRandomizeChickensHint", mOptionDescriptions[RSK_CHICKENS_HINT], IMFLAG_NONE); - mOptions[RSK_MALON_HINT] = Option::Bool("Malon Hint", "gRandomizeMalonHint", mOptionDescriptions[RSK_MALON_HINT], IMFLAG_NONE); - mOptions[RSK_HBA_HINT] = Option::Bool("Horseback Archery Hint", "gRandomizeHBAHint", mOptionDescriptions[RSK_HBA_HINT], IMFLAG_NONE); - mOptions[RSK_WARP_SONG_HINTS] = Option::Bool("Warp Song Hints", "gRandomizeWarpSongText", mOptionDescriptions[RSK_WARP_SONG_HINTS], IMFLAG_NONE, WidgetType::Checkbox, RO_GENERIC_ON); - mOptions[RSK_SCRUB_TEXT_HINT] = Option::Bool("Scrub Hint Text", "gRandomizeScrubText", mOptionDescriptions[RSK_SCRUB_TEXT_HINT], IMFLAG_NONE); - mOptions[RSK_KAK_10_SKULLS_HINT] = Option::Bool("10 GS Hint", "gRandomize10GSHint", mOptionDescriptions[RSK_KAK_10_SKULLS_HINT], IMFLAG_NONE); - mOptions[RSK_KAK_20_SKULLS_HINT] = Option::Bool("20 GS Hint", "gRandomize20GSHint", mOptionDescriptions[RSK_KAK_20_SKULLS_HINT], IMFLAG_NONE); - mOptions[RSK_KAK_30_SKULLS_HINT] = Option::Bool("30 GS Hint", "gRandomize30GSHint", mOptionDescriptions[RSK_KAK_30_SKULLS_HINT], IMFLAG_NONE); - mOptions[RSK_KAK_40_SKULLS_HINT] = Option::Bool("40 GS Hint", "gRandomize40GSHint", mOptionDescriptions[RSK_KAK_40_SKULLS_HINT], IMFLAG_NONE); - mOptions[RSK_KAK_50_SKULLS_HINT] = Option::Bool("50 GS Hint", "gRandomize50GSHint", mOptionDescriptions[RSK_KAK_50_SKULLS_HINT], IMFLAG_NONE); - mOptions[RSK_KAK_100_SKULLS_HINT] = Option::Bool("100 GS Hint", "gRandomize100GSHint", mOptionDescriptions[RSK_KAK_100_SKULLS_HINT]); + mOptions[RSK_SHUFFLE_100_GS_REWARD] = Option::Bool("Shuffle 100 GS Reward", CVAR_RANDOMIZER_SETTING("Shuffle100GSReward"), mOptionDescriptions[RSK_SHUFFLE_100_GS_REWARD], IMFLAG_SEPARATOR_BOTTOM, WidgetType::Checkbox, RO_GENERIC_OFF); + mOptions[RSK_SHUFFLE_BOSS_SOULS] = Option::U8("Shuffle Boss Souls", {"Off", "On", "On + Ganon"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleBossSouls"), mOptionDescriptions[RSK_SHUFFLE_BOSS_SOULS], WidgetType::Combobox); + mOptions[RSK_FISHSANITY] = Option::U8("Fishsanity", {"Off", "Shuffle Fishing Pond", "Shuffle Overworld Fish", "Shuffle Both"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("Fishsanity"), mOptionDescriptions[RSK_FISHSANITY], WidgetType::Combobox, RO_FISHSANITY_OFF); + mOptions[RSK_FISHSANITY_POND_COUNT] = Option::U8("Pond Fish Count", {NumOpts(0,17,1)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("FishsanityPondCount"), mOptionDescriptions[RSK_FISHSANITY_POND_COUNT], WidgetType::Slider, 0, true, IMFLAG_NONE); + mOptions[RSK_FISHSANITY_AGE_SPLIT] = Option::Bool("Pond Age Split", CVAR_RANDOMIZER_SETTING("FishsanityAgeSplit"), mOptionDescriptions[RSK_FISHSANITY_AGE_SPLIT]); + mOptions[RSK_SHUFFLE_MAPANDCOMPASS] = Option::U8("Maps/Compasses", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), mOptionDescriptions[RSK_SHUFFLE_MAPANDCOMPASS], WidgetType::Combobox, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON); + mOptions[RSK_KEYSANITY] = Option::U8("Small Keys", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("Keysanity"), mOptionDescriptions[RSK_KEYSANITY], WidgetType::Combobox, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON); + mOptions[RSK_GERUDO_KEYS] = Option::U8("Gerudo Fortress Keys", {"Vanilla", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("GerudoKeys"), mOptionDescriptions[RSK_GERUDO_KEYS], WidgetType::Combobox, RO_GERUDO_KEYS_VANILLA); + mOptions[RSK_BOSS_KEYSANITY] = Option::U8("Boss Keys", {"Start With", "Vanilla", "Own Dungeon", "Any Dungeon", "Overworld", "Anywhere"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("BossKeysanity"), mOptionDescriptions[RSK_BOSS_KEYSANITY], WidgetType::Combobox, RO_DUNGEON_ITEM_LOC_OWN_DUNGEON); + mOptions[RSK_GANONS_BOSS_KEY] = Option::U8("Ganon's Boss Key", {"Vanilla", "Own Dungeon", "Start With", "Any Dungeon", "Overworld", "Anywhere", "LACS-Vanilla", "LACS-Stones", "LACS-Medallions", "LACS-Rewards", "LACS-Dungeons", "LACS-Tokens", "Triforce Hunt"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), mOptionDescriptions[RSK_GANONS_BOSS_KEY], WidgetType::Combobox, RO_GANON_BOSS_KEY_VANILLA); + mOptions[RSK_LACS_STONE_COUNT] = Option::U8("Stone Count", {NumOpts(0, 4)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsStoneCount"), "", WidgetType::Slider, 3, true); + mOptions[RSK_LACS_MEDALLION_COUNT] = Option::U8("Medallion Count", {NumOpts(0, 7)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsMedallionCount"), "", WidgetType::Slider, 6, true); + mOptions[RSK_LACS_REWARD_COUNT] = Option::U8("Reward Count", {NumOpts(0, 10)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsRewardCount"), "", WidgetType::Slider, 9, true); + mOptions[RSK_LACS_DUNGEON_COUNT] = Option::U8("Dungeon Count", {NumOpts(0, 9)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsDungeonCount"), "", WidgetType::Slider, 8, true); + mOptions[RSK_LACS_TOKEN_COUNT] = Option::U8("Token Count", {NumOpts(0, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsTokenCount"), "", WidgetType::Slider, 100, true); + mOptions[RSK_LACS_OPTIONS] = Option::U8("LACS Reward Options", {"Standard Reward", "Greg as Reward", "Greg as Wildcard"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsRewardOptions"), "", WidgetType::Combobox, RO_LACS_STANDARD_REWARD); + mOptions[RSK_KEYRINGS] = Option::U8("Key Rings", {"Off", "Random", "Count", "Selection"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), mOptionDescriptions[RSK_KEYRINGS], WidgetType::Combobox, RO_KEYRINGS_OFF); + mOptions[RSK_KEYRINGS_RANDOM_COUNT] = Option::U8("Keyring Dungeon Count", {NumOpts(0, 9)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsRandomCount"), "", WidgetType::Slider, 8); + mOptions[RSK_KEYRINGS_GERUDO_FORTRESS] = Option::Bool("Gerudo Fortress", CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGerudoFortress"), "", IMFLAG_NONE); + mOptions[RSK_KEYRINGS_FOREST_TEMPLE] = Option::Bool("Forest Temple", CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsForestTemple"), "", IMFLAG_NONE); + mOptions[RSK_KEYRINGS_FIRE_TEMPLE] = Option::Bool("Fire Temple", CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsFireTemple"), "", IMFLAG_NONE); + mOptions[RSK_KEYRINGS_WATER_TEMPLE] = Option::Bool("Water Temple", CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsWaterTemple"), "", IMFLAG_NONE); + mOptions[RSK_KEYRINGS_SPIRIT_TEMPLE] = Option::Bool("Spirit Temple", CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsSpiritTemple"), "", IMFLAG_NONE); + mOptions[RSK_KEYRINGS_SHADOW_TEMPLE] = Option::Bool("Shadow Temple", CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsShadowTemple"), "", IMFLAG_NONE); + mOptions[RSK_KEYRINGS_BOTTOM_OF_THE_WELL] = Option::Bool("Bottom of the Well", CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsBottomOfTheWell"), "", IMFLAG_NONE); + mOptions[RSK_KEYRINGS_GTG] = Option::Bool("Gerudo Training Grounds", CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGTG"), "", IMFLAG_NONE); + mOptions[RSK_KEYRINGS_GANONS_CASTLE] = Option::Bool("Ganon's Castle", CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGanonsCastle")); + mOptions[RSK_SKIP_CHILD_STEALTH] = Option::Bool("Skip Child Stealth", {"Don't Skip", "Skip"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("SkipChildStealth"), mOptionDescriptions[RSK_SKIP_CHILD_STEALTH], WidgetType::Checkbox, RO_GENERIC_DONT_SKIP); + mOptions[RSK_SKIP_CHILD_ZELDA] = Option::Bool("Skip Child Zelda", {"Don't Skip", "Skip"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("SkipChildZelda"), mOptionDescriptions[RSK_SKIP_CHILD_ZELDA], WidgetType::Checkbox, RO_GENERIC_DONT_SKIP); + mOptions[RSK_SKIP_EPONA_RACE] = Option::Bool("Skip Epona Race", {"Don't Skip", "Skip"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("SkipEponaRace"), mOptionDescriptions[RSK_SKIP_EPONA_RACE], WidgetType::Checkbox, RO_GENERIC_DONT_SKIP); + mOptions[RSK_SKIP_SCARECROWS_SONG] = Option::Bool("Skip Scarecrow's Song", CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), mOptionDescriptions[RSK_SKIP_SCARECROWS_SONG]); + mOptions[RSK_BIG_POE_COUNT] = Option::U8("Big Poe Target Count", {NumOpts(1, 10)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), mOptionDescriptions[RSK_BIG_POE_COUNT], WidgetType::Slider, 9); + mOptions[RSK_CUCCO_COUNT] = Option::U8("Cuccos to return", {NumOpts(0, 7)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("CuccosToReturn"), mOptionDescriptions[RSK_CUCCO_COUNT], WidgetType::Slider, 7); + mOptions[RSK_COMPLETE_MASK_QUEST] = Option::Bool("Complete Mask Quest", CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), mOptionDescriptions[RSK_COMPLETE_MASK_QUEST]); + mOptions[RSK_ENABLE_GLITCH_CUTSCENES] = Option::Bool("Enable Glitch-Useful Cutscenes", CVAR_RANDOMIZER_SETTING("EnableGlitchCutscenes"), mOptionDescriptions[RSK_ENABLE_GLITCH_CUTSCENES]); + mOptions[RSK_GOSSIP_STONE_HINTS] = Option::U8("Gossip Stone Hints", {"No Hints", "Need Nothing", "Mask of Truth", "Stone of Agony"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("GossipStoneHints"), mOptionDescriptions[RSK_GOSSIP_STONE_HINTS], WidgetType::Combobox, RO_GOSSIP_STONES_NEED_NOTHING, false, IMFLAG_NONE); + mOptions[RSK_HINT_CLARITY] = Option::U8("Hint Clarity", {"Obscure", "Ambiguous", "Clear"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("HintClarity"), mOptionDescriptions[RSK_HINT_CLARITY], WidgetType::Combobox, RO_HINT_CLARITY_CLEAR, true, IMFLAG_INDENT); + mOptions[RSK_HINT_DISTRIBUTION] = Option::U8("Hint Distribution", {"Useless", "Balanced", "Strong", "Very Strong"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("HintDistribution"), mOptionDescriptions[RSK_HINT_DISTRIBUTION], WidgetType::Combobox, RO_HINT_DIST_BALANCED, true, IMFLAG_UNINDENT); + mOptions[RSK_TOT_ALTAR_HINT] = Option::Bool("ToT Altar Hint", {"Off", "On"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("AltarHint"), mOptionDescriptions[RSK_TOT_ALTAR_HINT], WidgetType::Checkbox, RO_GENERIC_ON, false, IMFLAG_INDENT); + mOptions[RSK_GANONDORF_HINT] = Option::Bool("Ganondorf Hint", {"Off", "On"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("GanondorfHint"), mOptionDescriptions[RSK_GANONDORF_HINT], WidgetType::Checkbox, RO_GENERIC_ON, false, IMFLAG_NONE); + mOptions[RSK_SHEIK_LA_HINT] = Option::Bool("Sheik Light Arrow Hint", {"Off", "On"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("SheikLAHint"), mOptionDescriptions[RSK_SHEIK_LA_HINT], WidgetType::Checkbox, RO_GENERIC_ON, false, IMFLAG_NONE); + mOptions[RSK_DAMPES_DIARY_HINT] = Option::Bool("Dampe's Diary Hint", CVAR_RANDOMIZER_SETTING("DampeHint"), mOptionDescriptions[RSK_DAMPES_DIARY_HINT], IMFLAG_NONE); + mOptions[RSK_GREG_HINT] = Option::Bool("Greg the Green Rupee Hint", CVAR_RANDOMIZER_SETTING("GregHint"), mOptionDescriptions[RSK_GREG_HINT], IMFLAG_NONE); + mOptions[RSK_SARIA_HINT] = Option::Bool("Saria's Hint", CVAR_RANDOMIZER_SETTING("SariaHint"), mOptionDescriptions[RSK_SARIA_HINT], IMFLAG_NONE); + mOptions[RSK_FISHING_POLE_HINT] = Option::Bool("Fishing Pole Hint", CVAR_RANDOMIZER_SETTING("FishingPoleHint"), mOptionDescriptions[RSK_FISHING_POLE_HINT], IMFLAG_NONE); + mOptions[RSK_FROGS_HINT] = Option::Bool("Frog Ocarina Game Hint", CVAR_RANDOMIZER_SETTING("FrogsHint"), mOptionDescriptions[RSK_FROGS_HINT], IMFLAG_NONE); + mOptions[RSK_BIGGORON_HINT] = Option::Bool("Biggoron's Hint", CVAR_RANDOMIZER_SETTING("BiggoronHint"), mOptionDescriptions[RSK_BIGGORON_HINT], IMFLAG_NONE); + mOptions[RSK_BIG_POES_HINT] = Option::Bool("Big Poes Hint", CVAR_RANDOMIZER_SETTING("BigPoesHint"), mOptionDescriptions[RSK_BIG_POES_HINT], IMFLAG_NONE); + mOptions[RSK_CHICKENS_HINT] = Option::Bool("Chickens Hint", CVAR_RANDOMIZER_SETTING("ChickensHint"), mOptionDescriptions[RSK_CHICKENS_HINT], IMFLAG_NONE); + mOptions[RSK_MALON_HINT] = Option::Bool("Malon Hint", CVAR_RANDOMIZER_SETTING("MalonHint"), mOptionDescriptions[RSK_MALON_HINT], IMFLAG_NONE); + mOptions[RSK_HBA_HINT] = Option::Bool("Horseback Archery Hint", CVAR_RANDOMIZER_SETTING("HBAHint"), mOptionDescriptions[RSK_HBA_HINT], IMFLAG_NONE); + mOptions[RSK_WARP_SONG_HINTS] = Option::Bool("Warp Song Hints", CVAR_RANDOMIZER_SETTING("WarpSongText"), mOptionDescriptions[RSK_WARP_SONG_HINTS], IMFLAG_NONE, WidgetType::Checkbox, RO_GENERIC_ON); + mOptions[RSK_SCRUB_TEXT_HINT] = Option::Bool("Scrub Hint Text", CVAR_RANDOMIZER_SETTING("ScrubText"), mOptionDescriptions[RSK_SCRUB_TEXT_HINT], IMFLAG_NONE); + mOptions[RSK_KAK_10_SKULLS_HINT] = Option::Bool("10 GS Hint", CVAR_RANDOMIZER_SETTING("10GSHint"), mOptionDescriptions[RSK_KAK_10_SKULLS_HINT], IMFLAG_NONE); + mOptions[RSK_KAK_20_SKULLS_HINT] = Option::Bool("20 GS Hint", CVAR_RANDOMIZER_SETTING("20GSHint"), mOptionDescriptions[RSK_KAK_20_SKULLS_HINT], IMFLAG_NONE); + mOptions[RSK_KAK_30_SKULLS_HINT] = Option::Bool("30 GS Hint", CVAR_RANDOMIZER_SETTING("30GSHint"), mOptionDescriptions[RSK_KAK_30_SKULLS_HINT], IMFLAG_NONE); + mOptions[RSK_KAK_40_SKULLS_HINT] = Option::Bool("40 GS Hint", CVAR_RANDOMIZER_SETTING("40GSHint"), mOptionDescriptions[RSK_KAK_40_SKULLS_HINT], IMFLAG_NONE); + mOptions[RSK_KAK_50_SKULLS_HINT] = Option::Bool("50 GS Hint", CVAR_RANDOMIZER_SETTING("50GSHint"), mOptionDescriptions[RSK_KAK_50_SKULLS_HINT], IMFLAG_NONE); + mOptions[RSK_KAK_100_SKULLS_HINT] = Option::Bool("100 GS Hint", CVAR_RANDOMIZER_SETTING("100GSHint"), mOptionDescriptions[RSK_KAK_100_SKULLS_HINT]); // TODO: Compasses show rewards/woth, maps show dungeon mode - mOptions[RSK_BLUE_FIRE_ARROWS] = Option::Bool("Blue Fire Arrows", "gRandomizeBlueFireArrows", mOptionDescriptions[RSK_BLUE_FIRE_ARROWS]); - mOptions[RSK_SUNLIGHT_ARROWS] = Option::Bool("Sunlight Arrows", "gRandomizeSunlightArrows", mOptionDescriptions[RSK_SUNLIGHT_ARROWS]); - mOptions[RSK_ITEM_POOL] = Option::U8("Item Pool", {"Plentiful", "Balanced", "Scarce", "Minimal"}, OptionCategory::Setting, "gRandomizeItemPool", mOptionDescriptions[RSK_ITEM_POOL], WidgetType::Combobox, RO_ITEM_POOL_BALANCED); - mOptions[RSK_ICE_TRAPS] = Option::U8("Ice Traps", {"Off", "Normal", "Extra", "Mayhem", "Onslaught"}, OptionCategory::Setting, "gRandomizeIceTraps", mOptionDescriptions[RSK_ICE_TRAPS], WidgetType::Combobox, RO_ICE_TRAPS_NORMAL); + mOptions[RSK_BLUE_FIRE_ARROWS] = Option::Bool("Blue Fire Arrows", CVAR_RANDOMIZER_SETTING("BlueFireArrows"), mOptionDescriptions[RSK_BLUE_FIRE_ARROWS]); + mOptions[RSK_SUNLIGHT_ARROWS] = Option::Bool("Sunlight Arrows", CVAR_RANDOMIZER_SETTING("SunlightArrows"), mOptionDescriptions[RSK_SUNLIGHT_ARROWS]); + mOptions[RSK_ITEM_POOL] = Option::U8("Item Pool", {"Plentiful", "Balanced", "Scarce", "Minimal"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ItemPool"), mOptionDescriptions[RSK_ITEM_POOL], WidgetType::Combobox, RO_ITEM_POOL_BALANCED); + mOptions[RSK_ICE_TRAPS] = Option::U8("Ice Traps", {"Off", "Normal", "Extra", "Mayhem", "Onslaught"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("IceTraps"), mOptionDescriptions[RSK_ICE_TRAPS], WidgetType::Combobox, RO_ICE_TRAPS_NORMAL); // TODO: Remove Double Defense, Progressive Goron Sword - mOptions[RSK_STARTING_OCARINA] = Option::U8("Start with Ocarina", {"Off", "Fairy Ocarina", "Ocarina of Time"}, OptionCategory::Setting, "gRandomizeStartingOcarina", "", WidgetType::Combobox, RO_STARTING_OCARINA_OFF); - mOptions[RSK_STARTING_DEKU_SHIELD] = Option::Bool("Start with Deku Shield", "gRandomizeStartingDekuShield"); - mOptions[RSK_STARTING_KOKIRI_SWORD] = Option::Bool("Start with Kokiri Sword", "gRandomizeStartingKokiriSword"); - mOptions[RSK_STARTING_MASTER_SWORD] = Option::Bool("Start with Master Sword", "gRandomizeStartingMasterSword"); - mOptions[RSK_STARTING_CONSUMABLES] = Option::Bool("Start with Consumables", {"No", "Yes"}, OptionCategory::Setting, "gRandomizeStartingConsumables", "", WidgetType::Checkbox, RO_GENERIC_OFF); - mOptions[RSK_FULL_WALLETS] = Option::Bool("Full Wallets", {"No", "Yes"}, OptionCategory::Setting, "gRandomizeFullWallets", mOptionDescriptions[RSK_FULL_WALLETS], WidgetType::Checkbox, RO_GENERIC_OFF); - mOptions[RSK_STARTING_ZELDAS_LULLABY] = Option::Bool("Start with Zelda's Lullaby", "gRandomizeStartingZeldasLullaby", "", IMFLAG_NONE); - mOptions[RSK_STARTING_EPONAS_SONG] = Option::Bool("Start with Epona's Song", "gRandomizeStartingEponasSong", "", IMFLAG_NONE); - mOptions[RSK_STARTING_SARIAS_SONG] = Option::Bool("Start with Saria's Song", "gRandomizeStartingSariasSong", "", IMFLAG_NONE); - mOptions[RSK_STARTING_SUNS_SONG] = Option::Bool("Start with Sun's Song", "gRandomizeStartingSunsSong", "", IMFLAG_NONE); - mOptions[RSK_STARTING_SONG_OF_TIME] = Option::Bool("Start with Song of Time", "gRandomizeStartingSongOfTime", "", IMFLAG_NONE); - mOptions[RSK_STARTING_SONG_OF_STORMS] = Option::Bool("Start with Song of Storms", "gRandomizeStartingSongOfStorms", "", IMFLAG_NONE); - mOptions[RSK_STARTING_MINUET_OF_FOREST] = Option::Bool("Start with Minuet of Forest", "gRandomizeStartingMinuetOfForest", "", IMFLAG_NONE); - mOptions[RSK_STARTING_BOLERO_OF_FIRE] = Option::Bool("Start with Bolero of Fire", "gRandomizeStartingBoleroOfFire", "", IMFLAG_NONE); - mOptions[RSK_STARTING_SERENADE_OF_WATER] = Option::Bool("Start with Serenade of Water", "gRandomizeStartingSerenadeOfWater", "", IMFLAG_NONE); - mOptions[RSK_STARTING_REQUIEM_OF_SPIRIT] = Option::Bool("Start with Requiem of Spirit", "gRandomizeStartingRequiemOfSpirit", "", IMFLAG_NONE); - mOptions[RSK_STARTING_NOCTURNE_OF_SHADOW] = Option::Bool("Start with Nocturne of Shadow", "gRandomizeStartingNocturneOfShadow", "", IMFLAG_NONE); - mOptions[RSK_STARTING_PRELUDE_OF_LIGHT] = Option::Bool("Start with Prelude of Light", "gRandomizeStartingPreludeOfLight"); - mOptions[RSK_STARTING_SKULLTULA_TOKEN] = Option::U8("Gold Skulltula Tokens", {NumOpts(0, 100)}, OptionCategory::Setting, "gRandomizeStartingSkulltulaToken", "", WidgetType::Slider); + mOptions[RSK_STARTING_OCARINA] = Option::U8("Start with Ocarina", {"Off", "Fairy Ocarina", "Ocarina of Time"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("StartingOcarina"), "", WidgetType::Combobox, RO_STARTING_OCARINA_OFF); + mOptions[RSK_STARTING_DEKU_SHIELD] = Option::Bool("Start with Deku Shield", CVAR_RANDOMIZER_SETTING("StartingDekuShield")); + mOptions[RSK_STARTING_KOKIRI_SWORD] = Option::Bool("Start with Kokiri Sword", CVAR_RANDOMIZER_SETTING("StartingKokiriSword")); + mOptions[RSK_STARTING_MASTER_SWORD] = Option::Bool("Start with Master Sword", CVAR_RANDOMIZER_SETTING("StartingMasterSword")); + mOptions[RSK_STARTING_CONSUMABLES] = Option::Bool("Start with Consumables", {"No", "Yes"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("StartingConsumables"), "", WidgetType::Checkbox, RO_GENERIC_OFF); + mOptions[RSK_FULL_WALLETS] = Option::Bool("Full Wallets", {"No", "Yes"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("FullWallets"), mOptionDescriptions[RSK_FULL_WALLETS], WidgetType::Checkbox, RO_GENERIC_OFF); + mOptions[RSK_STARTING_ZELDAS_LULLABY] = Option::Bool("Start with Zelda's Lullaby", CVAR_RANDOMIZER_SETTING("StartingZeldasLullaby"), "", IMFLAG_NONE); + mOptions[RSK_STARTING_EPONAS_SONG] = Option::Bool("Start with Epona's Song", CVAR_RANDOMIZER_SETTING("StartingEponasSong"), "", IMFLAG_NONE); + mOptions[RSK_STARTING_SARIAS_SONG] = Option::Bool("Start with Saria's Song", CVAR_RANDOMIZER_SETTING("StartingSariasSong"), "", IMFLAG_NONE); + mOptions[RSK_STARTING_SUNS_SONG] = Option::Bool("Start with Sun's Song", CVAR_RANDOMIZER_SETTING("StartingSunsSong"), "", IMFLAG_NONE); + mOptions[RSK_STARTING_SONG_OF_TIME] = Option::Bool("Start with Song of Time", CVAR_RANDOMIZER_SETTING("StartingSongOfTime"), "", IMFLAG_NONE); + mOptions[RSK_STARTING_SONG_OF_STORMS] = Option::Bool("Start with Song of Storms", CVAR_RANDOMIZER_SETTING("StartingSongOfStorms"), "", IMFLAG_NONE); + mOptions[RSK_STARTING_MINUET_OF_FOREST] = Option::Bool("Start with Minuet of Forest", CVAR_RANDOMIZER_SETTING("StartingMinuetOfForest"), "", IMFLAG_NONE); + mOptions[RSK_STARTING_BOLERO_OF_FIRE] = Option::Bool("Start with Bolero of Fire", CVAR_RANDOMIZER_SETTING("StartingBoleroOfFire"), "", IMFLAG_NONE); + mOptions[RSK_STARTING_SERENADE_OF_WATER] = Option::Bool("Start with Serenade of Water", CVAR_RANDOMIZER_SETTING("StartingSerenadeOfWater"), "", IMFLAG_NONE); + mOptions[RSK_STARTING_REQUIEM_OF_SPIRIT] = Option::Bool("Start with Requiem of Spirit", CVAR_RANDOMIZER_SETTING("StartingRequiemOfSpirit"), "", IMFLAG_NONE); + mOptions[RSK_STARTING_NOCTURNE_OF_SHADOW] = Option::Bool("Start with Nocturne of Shadow", CVAR_RANDOMIZER_SETTING("StartingNocturneOfShadow"), "", IMFLAG_NONE); + mOptions[RSK_STARTING_PRELUDE_OF_LIGHT] = Option::Bool("Start with Prelude of Light", CVAR_RANDOMIZER_SETTING("StartingPreludeOfLight")); + mOptions[RSK_STARTING_SKULLTULA_TOKEN] = Option::U8("Gold Skulltula Tokens", {NumOpts(0, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("StartingSkulltulaToken"), "", WidgetType::Slider); mOptions[RSK_STARTING_HEARTS] = Option::U8("Hearts", {NumOpts(1, 20)}, OptionCategory::Setting, "", "", WidgetType::Slider, 2); // TODO: Remainder of Starting Items - mOptions[RSK_LOGIC_RULES] = Option::U8("Logic", {"Glitchless", "Glitched", "No Logic", "Vanilla"}, OptionCategory::Setting, "gRandomizeLogicRules", mOptionDescriptions[RSK_LOGIC_RULES], WidgetType::Combobox, RO_LOGIC_GLITCHLESS); - mOptions[RSK_ALL_LOCATIONS_REACHABLE] = Option::Bool("All Locations Reachable", {"Off", "On"}, OptionCategory::Setting, "gRandomizeAllLocationsReachable", mOptionDescriptions[RSK_ALL_LOCATIONS_REACHABLE], WidgetType::Checkbox, RO_GENERIC_ON); - mOptions[RSK_SKULLS_SUNS_SONG] = Option::Bool("Night Skulltula's Expect Sun's Song", "gRandomizeGsExpectSunsSong", mOptionDescriptions[RSK_SKULLS_SUNS_SONG]); + mOptions[RSK_LOGIC_RULES] = Option::U8("Logic", {"Glitchless", "Glitched", "No Logic", "Vanilla"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LogicRules"), mOptionDescriptions[RSK_LOGIC_RULES], WidgetType::Combobox, RO_LOGIC_GLITCHLESS); + mOptions[RSK_ALL_LOCATIONS_REACHABLE] = Option::Bool("All Locations Reachable", {"Off", "On"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("AllLocationsReachable"), mOptionDescriptions[RSK_ALL_LOCATIONS_REACHABLE], WidgetType::Checkbox, RO_GENERIC_ON); + mOptions[RSK_SKULLS_SUNS_SONG] = Option::Bool("Night Skulltula's Expect Sun's Song", CVAR_RANDOMIZER_SETTING("GsExpectSunsSong"), mOptionDescriptions[RSK_SKULLS_SUNS_SONG]); mOptions[RSK_DAMAGE_MULTIPLIER] = Option::U8("Damage Multiplier", {"x1/2", "x1", "x2", "x4", "x8", "x16", "OHKO"}, OptionCategory::Setting, "", "", WidgetType::Slider, RO_DAMAGE_MULTIPLIER_DEFAULT); // clang-format on @@ -1299,7 +1299,7 @@ void Settings::UpdateOptionProperties() { mOptions[RSK_RAINBOW_BRIDGE_REWARD_COUNT].Hide(); mOptions[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT].Hide(); mOptions[RSK_RAINBOW_BRIDGE_TOKEN_COUNT].Hide(); - if (CVarGetInteger("gRandomizeLogicRules", RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("LogicRules"), RO_LOGIC_GLITCHLESS) == RO_LOGIC_VANILLA) { mOptionGroups[RSG_AREA_ACCESS_IMGUI].Disable(); mOptions[RSK_STARTING_AGE].Disable(""); mOptions[RSK_GERUDO_FORTRESS].Disable(""); @@ -1322,9 +1322,9 @@ void Settings::UpdateOptionProperties() { } else { mOptionGroups[RSG_AREA_ACCESS_IMGUI].Enable(); // Starting Age - Disabled when Forest is set to Closed or under very specific conditions - if (CVarGetInteger("gRandomizeForest", RO_FOREST_CLOSED) == RO_FOREST_CLOSED || - (CVarGetInteger("gRandomizeDoorOfTime", RO_DOOROFTIME_CLOSED) == RO_DOOROFTIME_CLOSED && - CVarGetInteger("gRandomizeShuffleOcarinas", RO_GENERIC_OFF) == RO_GENERIC_OFF)) /* closed door of time with ocarina shuffle off */ { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("Forest"), RO_FOREST_CLOSED) == RO_FOREST_CLOSED || + (CVarGetInteger(CVAR_RANDOMIZER_SETTING("DoorOfTime"), RO_DOOROFTIME_CLOSED) == RO_DOOROFTIME_CLOSED && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), RO_GENERIC_OFF) == RO_GENERIC_OFF)) /* closed door of time with ocarina shuffle off */ { mOptions[RSK_STARTING_AGE].Disable("This option is disabled due to other options making the game unbeatable"); } else { mOptions[RSK_STARTING_AGE].Enable(); @@ -1337,8 +1337,8 @@ void Settings::UpdateOptionProperties() { mOptions[RSK_RAINBOW_BRIDGE_REWARD_COUNT].Enable(); mOptions[RSK_RAINBOW_BRIDGE_DUNGEON_COUNT].Enable(); mOptions[RSK_RAINBOW_BRIDGE_TOKEN_COUNT].Enable(); - const uint8_t bridgeOpt = CVarGetInteger("gRandomizeBridgeRewardOptions", RO_BRIDGE_STANDARD_REWARD); - switch (CVarGetInteger("gRandomizeRainbowBridge", RO_BRIDGE_VANILLA)) { + const uint8_t bridgeOpt = CVarGetInteger(CVAR_RANDOMIZER_SETTING("BridgeRewardOptions"), RO_BRIDGE_STANDARD_REWARD); + switch (CVarGetInteger(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_VANILLA)) { case RO_BRIDGE_STONES: // Show Bridge Options and Stone Count slider mOptions[RSK_RAINBOW_BRIDGE].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM); @@ -1411,7 +1411,7 @@ void Settings::UpdateOptionProperties() { mOptions[RSK_GANONS_TRIALS].Enable(); mOptions[RSK_TRIAL_COUNT].Enable(); // Only show the trial count slider if Trials is set to Set Number - if (CVarGetInteger("gRandomizeGanonTrial", RO_GANONS_TRIALS_SKIP) == RO_GANONS_TRIALS_SET_NUMBER) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SKIP) == RO_GANONS_TRIALS_SET_NUMBER) { mOptions[RSK_GANONS_TRIALS].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM); mOptions[RSK_TRIAL_COUNT].Unhide(); } else { @@ -1422,7 +1422,7 @@ void Settings::UpdateOptionProperties() { mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Enable(); mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Enable(); // Remove the pieces required/total sliders and add a separator after Tirforce Hunt if Triforce Hunt is off - if (CVarGetInteger("gRandomizeTriforceHunt", RO_GENERIC_OFF) == RO_GENERIC_OFF) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("TriforceHunt"), RO_GENERIC_OFF) == RO_GENERIC_OFF) { mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].Hide(); mOptions[RSK_TRIFORCE_HUNT_PIECES_TOTAL].Hide(); mOptions[RSK_TRIFORCE_HUNT].AddFlag(IMFLAG_SEPARATOR_BOTTOM); @@ -1432,14 +1432,14 @@ void Settings::UpdateOptionProperties() { mOptions[RSK_TRIFORCE_HUNT].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM); } // Update triforce pieces required to be capped at the current value for pieces total. - const uint8_t triforceTotal = CVarGetInteger("gRandomizeTriforceHuntTotalPieces", 30); + const uint8_t triforceTotal = CVarGetInteger(CVAR_RANDOMIZER_SETTING("TriforceHuntTotalPieces"), 30); if (mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].GetOptionCount() != triforceTotal + 1) { mOptions[RSK_TRIFORCE_HUNT_PIECES_REQUIRED].ChangeOptions(NumOpts(1, triforceTotal + 1)); } mOptionGroups[RSG_ITEMS_IMGUI_TABLE].Enable(); mOptionGroups[RSG_GAMEPLAY_IMGUI_TABLE].Enable(); // Link's Pocket - Disabled when Dungeon Rewards are shuffled to End of Dungeon - if (CVarGetInteger("gRandomizeShuffleDungeonReward", RO_DUNGEON_REWARDS_END_OF_DUNGEON) == RO_DUNGEON_REWARDS_END_OF_DUNGEON) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleDungeonReward"), RO_DUNGEON_REWARDS_END_OF_DUNGEON) == RO_DUNGEON_REWARDS_END_OF_DUNGEON) { mOptions[RSK_LINKS_POCKET].Disable("This option is disabled because \"Dungeon Rewards\" are shuffled to \"End of Dungeons\"."); } else { mOptions[RSK_LINKS_POCKET].Enable(); @@ -1467,7 +1467,7 @@ void Settings::UpdateOptionProperties() { } else { // If any MQ Options are available, show the MQ Dungeon Randomization Combobox mOptions[RSK_MQ_DUNGEON_RANDOM].Unhide(); - switch(CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE)) { + switch(CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeons"), RO_MQ_DUNGEONS_NONE)) { // If No MQ Dungeons, add a separator after the combobx and hide // the count slider and the toggle for individual dungeon selections. case RO_MQ_DUNGEONS_NONE: @@ -1494,8 +1494,8 @@ void Settings::UpdateOptionProperties() { break; } // Controls whether or not to show the selectors for individual dungeons. - if (CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) != RO_MQ_DUNGEONS_NONE && - CVarGetInteger("gRandomizeMqDungeonsSelection", RO_GENERIC_OFF) == RO_GENERIC_ON) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeons"), RO_MQ_DUNGEONS_NONE) != RO_MQ_DUNGEONS_NONE && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeonsSelection"), RO_GENERIC_OFF) == RO_GENERIC_ON) { // if showing the dungeon selectors, remove the separator after the Set Dungeons checkbox. mOptions[RSK_MQ_DUNGEON_SET].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM); mOptions[RSK_MQ_DEKU_TREE].Unhide(); @@ -1528,13 +1528,13 @@ void Settings::UpdateOptionProperties() { } } // Disable interaction with Set Dungeons checkbox if MQ Dungeon Randomization is set to Selection Only. - if (CVarGetInteger("gRandomizeMqDungeons", RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_SELECTION) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("MqDungeons"), RO_MQ_DUNGEONS_NONE) == RO_MQ_DUNGEONS_SELECTION) { mOptions[RSK_MQ_DUNGEON_SET].Disable("This option is force-enabled because Master Quest Dungeons is set to Selection Only", UIWidgets::CheckboxGraphics::Checkmark); } else { mOptions[RSK_MQ_DUNGEON_SET].Enable(); } // Show mixed entrance pool options if mixed entrance pools are enabled at all. - if (CVarGetInteger("gRandomizeMixedEntrances", RO_GENERIC_OFF)) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("MixedEntrances"), RO_GENERIC_OFF)) { mOptions[RSK_MIXED_ENTRANCE_POOLS].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM); mOptions[RSK_MIX_DUNGEON_ENTRANCES].Unhide(); mOptions[RSK_MIX_BOSS_ENTRANCES].Unhide(); @@ -1550,13 +1550,13 @@ void Settings::UpdateOptionProperties() { mOptions[RSK_MIX_GROTTO_ENTRANCES].Hide(); } // Shuffle Weird Egg - Disabled when Skip Child Zelda is active - if (CVarGetInteger("gRandomizeSkipChildZelda", RO_GENERIC_DONT_SKIP)) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), RO_GENERIC_DONT_SKIP)) { mOptions[RSK_SHUFFLE_WEIRD_EGG].Disable("This option is disabled because \"Skip Child Zelda\" is enabled."); } else { mOptions[RSK_SHUFFLE_WEIRD_EGG].Enable(); } // Hide shopsanity prices if shopsanity is off or zero - switch (CVarGetInteger("gRandomizeShopsanity", RO_SHOPSANITY_OFF)) { + switch (CVarGetInteger(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_OFF)) { case RO_SHOPSANITY_OFF: case RO_SHOPSANITY_ZERO_ITEMS: mOptions[RSK_SHOPSANITY].AddFlag(IMFLAG_SEPARATOR_BOTTOM); @@ -1570,7 +1570,7 @@ void Settings::UpdateOptionProperties() { break; } // Hide fishing pond settings if we aren't shuffling the fishing pond - switch (CVarGetInteger("gRandomizeFishsanity", RO_FISHSANITY_OFF)) { + switch (CVarGetInteger(CVAR_RANDOMIZER_SETTING("Fishsanity"), RO_FISHSANITY_OFF)) { case RO_FISHSANITY_POND: case RO_FISHSANITY_BOTH: mOptions[RSK_FISHSANITY].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM); @@ -1583,13 +1583,13 @@ void Settings::UpdateOptionProperties() { mOptions[RSK_FISHSANITY_AGE_SPLIT].Hide(); } // Disable fishing pole hint if the fishing pole is not shuffled - if (CVarGetInteger("gRandomizeShuffleFishingPole", RO_GENERIC_OFF)) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleFishingPole"), RO_GENERIC_OFF)) { mOptions[RSK_FISHING_POLE_HINT].Enable(); } else { mOptions[RSK_FISHING_POLE_HINT].Disable("This option is disabled since the fishing pole is not shuffled."); } // Shuffle 100 GS Reward - Force-Enabled if Ganon's Boss Key is on the 100 GS Reward - if (CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA) == RO_GANON_BOSS_KEY_KAK_TOKENS) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA) == RO_GANON_BOSS_KEY_KAK_TOKENS) { mOptions[RSK_SHUFFLE_100_GS_REWARD].Disable("This option is force-enabled because \"Ganon's Boss Key\" is set to \"100 GS Reward.\"", UIWidgets::CheckboxGraphics::Checkmark); } else { mOptions[RSK_SHUFFLE_100_GS_REWARD].Enable(); @@ -1606,7 +1606,7 @@ void Settings::UpdateOptionProperties() { mOptions[RSK_KEYRINGS_BOTTOM_OF_THE_WELL].Hide(); mOptions[RSK_KEYRINGS_GTG].Hide(); mOptions[RSK_KEYRINGS_GANONS_CASTLE].Hide(); - switch (CVarGetInteger("gRandomizeShuffleKeyRings", RO_KEYRINGS_OFF)) { + switch (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), RO_KEYRINGS_OFF)) { case RO_KEYRINGS_COUNT: // Show count slider. mOptions[RSK_KEYRINGS].RemoveFlag(IMFLAG_SEPARATOR_BOTTOM); @@ -1627,20 +1627,20 @@ void Settings::UpdateOptionProperties() { default: break; } - const uint8_t maxKeyringCount = (CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL) == RO_GF_NORMAL && - CVarGetInteger("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA) ? 9 : 8; + const uint8_t maxKeyringCount = (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) == RO_GF_NORMAL && + CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_VANILLA) != RO_GERUDO_KEYS_VANILLA) ? 9 : 8; if (mOptions[RSK_KEYRINGS_RANDOM_COUNT].GetOptionCount() != maxKeyringCount + 1) { mOptions[RSK_KEYRINGS_RANDOM_COUNT].ChangeOptions(NumOpts(0, maxKeyringCount)); } - if (CVarGetInteger("gRandomizeGerudoFortress", RO_GF_NORMAL) != RO_GF_NORMAL || - CVarGetInteger("gRandomizeGerudoKeys", RO_GERUDO_KEYS_VANILLA) == RO_GERUDO_KEYS_VANILLA) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoFortress"), RO_GF_NORMAL) != RO_GF_NORMAL || + CVarGetInteger(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_VANILLA) == RO_GERUDO_KEYS_VANILLA) { mOptions[RSK_KEYRINGS_GERUDO_FORTRESS].Disable("Disabled because the currently selected Gerudo Fortress Carpenters\n" "setting and/or Gerudo Fortress Keys setting is incompatible with\n" "having a Gerudo Fortress Keyring."); } else { mOptions[RSK_KEYRINGS_GERUDO_FORTRESS].Enable(); } - if (CVarGetInteger("gRandomizeTriforceHunt", RO_GENERIC_OFF)) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("TriforceHunt"), RO_GENERIC_OFF)) { mOptions[RSK_GANONS_BOSS_KEY].Disable("This option is disabled because Triforce Hunt is enabled." "Ganon's Boss key\nwill instead be given to you after Triforce Hunt completion."); } else { @@ -1653,8 +1653,8 @@ void Settings::UpdateOptionProperties() { mOptions[RSK_LACS_REWARD_COUNT].Hide(); mOptions[RSK_LACS_DUNGEON_COUNT].Hide(); mOptions[RSK_LACS_TOKEN_COUNT].Hide(); - const uint8_t lacsOpts = CVarGetInteger("gRandomizeLacsRewardOptions", RO_LACS_STANDARD_REWARD); - switch (CVarGetInteger("gRandomizeShuffleGanonBossKey", RO_GANON_BOSS_KEY_VANILLA)) { + const uint8_t lacsOpts = CVarGetInteger(CVAR_RANDOMIZER_SETTING("LacsRewardOptions"), RO_LACS_STANDARD_REWARD); + switch (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_VANILLA)) { case RO_GANON_BOSS_KEY_LACS_STONES: mOptions[RSK_LACS_OPTIONS].Unhide(); mOptions[RSK_LACS_STONE_COUNT].Unhide(); @@ -1715,12 +1715,12 @@ void Settings::UpdateOptionProperties() { break; } // Skip Child Stealth - Disabled when Skip Child Zelda is active - if (CVarGetInteger("gRandomizeSkipChildZelda", RO_GENERIC_DONT_SKIP)) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), RO_GENERIC_DONT_SKIP)) { mOptions[RSK_SKIP_CHILD_STEALTH].Disable("This option is disabled because \"Skip Child Zelda\" is enabled."); } else { mOptions[RSK_SKIP_CHILD_STEALTH].Enable(); } - if (CVarGetInteger("gRandomizeGossipStoneHints", RO_GOSSIP_STONES_NEED_NOTHING) == RO_GOSSIP_STONES_NONE) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("GossipStoneHints"), RO_GOSSIP_STONES_NEED_NOTHING) == RO_GOSSIP_STONES_NONE) { mOptions[RSK_HINT_CLARITY].Hide(); mOptions[RSK_HINT_DISTRIBUTION].Hide(); } else { @@ -1728,19 +1728,19 @@ void Settings::UpdateOptionProperties() { mOptions[RSK_HINT_DISTRIBUTION].Unhide(); } - if (CVarGetInteger("gRandomizeShuffleCows", RO_GENERIC_OFF)) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ShuffleCows"), RO_GENERIC_OFF)) { mOptions[RSK_MALON_HINT].Enable(); } else { mOptions[RSK_MALON_HINT].Disable("Malon's hint points to a cow, so requires cows to be shuffled."); } - if (CVarGetInteger("gRandomizeShuffle100GSReward", RO_GENERIC_OFF)) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("Shuffle100GSReward"), RO_GENERIC_OFF)) { mOptions[RSK_KAK_100_SKULLS_HINT].Enable(); } else { mOptions[RSK_KAK_100_SKULLS_HINT].Disable("There is no point to hinting 100 skulls if it is not shuffled"); } - if (CVarGetInteger("gRandomizeCuccosToReturn", 7) == 0) { + if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 7) == 0) { mOptions[RSK_CHICKENS_HINT].Disable("Anju will just give you the item instead with 0 chickens"); } else { mOptions[RSK_CHICKENS_HINT].Enable(); diff --git a/soh/soh/Enhancements/resolution-editor/ResolutionEditor.cpp b/soh/soh/Enhancements/resolution-editor/ResolutionEditor.cpp index 892b5798a..f7eea0873 100644 --- a/soh/soh/Enhancements/resolution-editor/ResolutionEditor.cpp +++ b/soh/soh/Enhancements/resolution-editor/ResolutionEditor.cpp @@ -1,11 +1,12 @@ #include "ResolutionEditor.h" -#include +#include #include #include #include +#include "soh/OTRGlobals.h" -/* Console Variables are grouped under gAdvancedResolution. (e.g. "gAdvancedResolution.Enabled") +/* Console Variables are grouped under gAdvancedResolution. (e.g. CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled") The following cvars are used in Libultraship and can be edited here: - Enabled - Turns Advanced Resolution Mode on. @@ -83,25 +84,25 @@ void AdvancedResolutionSettingsWindow::DrawElement() { // Letting it go below 1 in this Editor will even allow for checking if screen bounds are being exceeded. if (default_maxIntegerScaleFactor < integerScale_maximumBounds) { max_integerScaleFactor = - integerScale_maximumBounds + CVarGetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0); + integerScale_maximumBounds + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0); } // Combo List defaults - static int item_aspectRatio = CVarGetInteger("gAdvancedResolution.UIComboItem.AspectRatio", 3); - static int item_pixelCount = CVarGetInteger("gAdvancedResolution.UIComboItem.PixelCount", default_pixelCount); + static int item_aspectRatio = CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.AspectRatio", 3); + static int item_pixelCount = CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", default_pixelCount); // Stored Values for non-UIWidgets elements static float aspectRatioX = - CVarGetFloat("gAdvancedResolution.AspectRatioX", aspectRatioPresetsX[item_aspectRatio]); + CVarGetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioX", aspectRatioPresetsX[item_aspectRatio]); static float aspectRatioY = - CVarGetFloat("gAdvancedResolution.AspectRatioY", aspectRatioPresetsY[item_aspectRatio]); + CVarGetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioY", aspectRatioPresetsY[item_aspectRatio]); static int verticalPixelCount = - CVarGetInteger("gAdvancedResolution.VerticalPixelCount", pixelCountPresets[item_pixelCount]); + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalPixelCount", pixelCountPresets[item_pixelCount]); // Additional settings static bool showHorizontalResField = false; static int horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX; // Disabling flags - const bool disabled_everything = !CVarGetInteger("gAdvancedResolution.Enabled", 0); - const bool disabled_pixelCount = !CVarGetInteger("gAdvancedResolution.VerticalResolutionToggle", 0); + const bool disabled_everything = !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0); + const bool disabled_pixelCount = !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0); #ifdef __APPLE__ // Display HiDPI warning. (Remove this once we can definitively say it's fixed.) @@ -112,21 +113,21 @@ void AdvancedResolutionSettingsWindow::DrawElement() { if (ImGui::CollapsingHeader("Original Settings", ImGuiTreeNodeFlags_DefaultOpen)) { // The original resolution slider (for convenience) - const bool disabled_resolutionSlider = (CVarGetInteger("gAdvancedResolution.VerticalResolutionToggle", 0) && - CVarGetInteger("gAdvancedResolution.Enabled", 0)) || - CVarGetInteger("gLowResMode", 0); - if (UIWidgets::EnhancementSliderFloat("Internal Resolution: %.1f%%", "##IMul", "gInternalResolution", 0.5f, + const bool disabled_resolutionSlider = (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0) && + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0)) || + CVarGetInteger(CVAR_LOW_RES_MODE, 0); + if (UIWidgets::EnhancementSliderFloat("Internal Resolution: %.1f%%", "##IMul", CVAR_INTERNAL_RESOLUTION, 0.5f, 2.0f, "", 1.0f, true, true, disabled_resolutionSlider)) { - LUS::Context::GetInstance()->GetWindow()->SetResolutionMultiplier( - CVarGetFloat("gInternalResolution", 1)); + Ship::Context::GetInstance()->GetWindow()->SetResolutionMultiplier( + CVarGetFloat(CVAR_INTERNAL_RESOLUTION, 1)); } UIWidgets::Tooltip("Multiplies your output resolution by the value entered."); // The original MSAA slider (also for convenience) #ifndef __WIIU__ - if (UIWidgets::PaddedEnhancementSliderInt("MSAA: %d", "##IMSAA", "gMSAAValue", 1, 8, "", 1, true, true, + if (UIWidgets::PaddedEnhancementSliderInt("MSAA: %d", "##IMSAA", CVAR_MSAA_VALUE, 1, 8, "", 1, true, true, false)) { - LUS::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger("gMSAAValue", 1)); + Ship::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger(CVAR_MSAA_VALUE, 1)); }; UIWidgets::Tooltip( "Activates multi-sample anti-aliasing when above 1x, up to 8x for 8 samples for every pixel.\n\n" @@ -135,15 +136,15 @@ void AdvancedResolutionSettingsWindow::DrawElement() { #endif // N64 Mode toggle (again for convenience) - // UIWidgets::PaddedEnhancementCheckbox("(Enhancements>Graphics) N64 Mode", "gLowResMode", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, false); + // UIWidgets::PaddedEnhancementCheckbox("(Enhancements>Graphics) N64 Mode", CVAR_LOW_RES_MODE, false, false, false, "", UIWidgets::CheckboxGraphics::Cross, false); } UIWidgets::PaddedSeparator(true, true, 3.0f, 3.0f); // Activator - UIWidgets::PaddedEnhancementCheckbox("Enable advanced settings.", "gAdvancedResolution.Enabled", false, false, + UIWidgets::PaddedEnhancementCheckbox("Enable advanced settings.", CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, false); // Error/Warning display - if (!CVarGetInteger("gLowResMode", 0)) { + if (!CVarGetInteger(CVAR_LOW_RES_MODE, 0)) { if (IsDroppingFrames()) { // Significant frame drop warning ImGui::TextColored(messageColor[MESSAGE_WARNING], ICON_FA_EXCLAMATION_TRIANGLE " Significant frame rate (FPS) drops may be occuring."); @@ -156,7 +157,7 @@ void AdvancedResolutionSettingsWindow::DrawElement() { ICON_FA_QUESTION_CIRCLE " \"N64 Mode\" is overriding these settings."); ImGui::SameLine(); if (ImGui::Button("Click to disable")) { - CVarSetInteger("gLowResMode", 0); + CVarSetInteger(CVAR_LOW_RES_MODE, 0); CVarSave(); } } @@ -185,9 +186,9 @@ void AdvancedResolutionSettingsWindow::DrawElement() { horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX; } - CVarSetFloat("gAdvancedResolution.AspectRatioX", aspectRatioX); - CVarSetFloat("gAdvancedResolution.AspectRatioY", aspectRatioY); - CVarSetInteger("gAdvancedResolution.UIComboItem.AspectRatio", item_aspectRatio); + CVarSetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioX", aspectRatioX); + CVarSetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioY", aspectRatioY); + CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.AspectRatio", item_aspectRatio); CVarSave(); } // Hide aspect ratio input fields if using one of the presets. @@ -217,7 +218,7 @@ void AdvancedResolutionSettingsWindow::DrawElement() { // Vertical Resolution UIWidgets::PaddedEnhancementCheckbox("Set fixed vertical resolution (disables Resolution slider)", - "gAdvancedResolution.VerticalResolutionToggle", true, false, + CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", true, false, disabled_everything, "", UIWidgets::CheckboxGraphics::Cross, false); UIWidgets::Tooltip( "Override the resolution scale slider and use the settings below, irrespective of window size."); @@ -233,8 +234,8 @@ void AdvancedResolutionSettingsWindow::DrawElement() { horizontalPixelCount = (verticalPixelCount / aspectRatioY) * aspectRatioX; } - CVarSetInteger("gAdvancedResolution.VerticalPixelCount", verticalPixelCount); - CVarSetInteger("gAdvancedResolution.UIComboItem.PixelCount", item_pixelCount); + CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalPixelCount", verticalPixelCount); + CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", item_pixelCount); CVarSave(); } // Horizontal Resolution, if visibility is enabled for it. @@ -290,43 +291,43 @@ void AdvancedResolutionSettingsWindow::DrawElement() { // Integer scaling settings group (Pixel-perfect Mode) static const ImGuiTreeNodeFlags IntegerScalingResolvedImGuiFlag = - CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0) ? ImGuiTreeNodeFlags_DefaultOpen + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0) ? ImGuiTreeNodeFlags_DefaultOpen : ImGuiTreeNodeFlags_None; if (ImGui::CollapsingHeader("Integer Scaling Settings", IntegerScalingResolvedImGuiFlag)) { const bool disabled_pixelPerfectMode = - !CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0) || disabled_everything; + !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0) || disabled_everything; // Pixel-perfect Mode - UIWidgets::PaddedEnhancementCheckbox("Pixel-perfect Mode", "gAdvancedResolution.PixelPerfectMode", true, + UIWidgets::PaddedEnhancementCheckbox("Pixel-perfect Mode", CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", true, true, disabled_pixelCount || disabled_everything, "", UIWidgets::CheckboxGraphics::Cross, false); UIWidgets::Tooltip("Don't scale image to fill window."); - if (disabled_pixelCount && CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0)) { - CVarSetInteger("gAdvancedResolution.PixelPerfectMode", 0); + if (disabled_pixelCount && CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0)) { + CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0); CVarSave(); } // Integer Scaling UIWidgets::EnhancementSliderInt( - "Integer scale factor: %d", "##ARSIntScale", "gAdvancedResolution.IntegerScale.Factor", 1, + "Integer scale factor: %d", "##ARSIntScale", CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.Factor", 1, max_integerScaleFactor, "%d", 1, true, - disabled_pixelPerfectMode || CVarGetInteger("gAdvancedResolution.IntegerScale.FitAutomatically", 0)); + disabled_pixelPerfectMode || CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.FitAutomatically", 0)); UIWidgets::Tooltip("Integer scales the image. Only available in pixel-perfect mode."); // Display warning if size is being clamped or if framebuffer is larger than viewport. if (!disabled_pixelPerfectMode && - (CVarGetInteger("gAdvancedResolution.IntegerScale.NeverExceedBounds", 1) && - CVarGetInteger("gAdvancedResolution.IntegerScale.Factor", 1) > integerScale_maximumBounds)) { + (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.NeverExceedBounds", 1) && + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.Factor", 1) > integerScale_maximumBounds)) { ImGui::SameLine(); ImGui::TextColored(messageColor[MESSAGE_WARNING], ICON_FA_EXCLAMATION_TRIANGLE " Window exceeded."); } UIWidgets::PaddedEnhancementCheckbox( - "Automatically scale image to fit viewport", "gAdvancedResolution.IntegerScale.FitAutomatically", true, + "Automatically scale image to fit viewport", CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.FitAutomatically", true, true, disabled_pixelPerfectMode, "", UIWidgets::CheckboxGraphics::Cross, false); UIWidgets::Tooltip("Automatically sets scale factor to fit window. Only available in pixel-perfect mode."); - if (CVarGetInteger("gAdvancedResolution.IntegerScale.FitAutomatically", 0)) { + if (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.FitAutomatically", 0)) { // This is just here to update the value shown on the slider. // The function in LUS to handle this setting will ignore IntegerScaleFactor while active. - CVarSetInteger("gAdvancedResolution.IntegerScale.Factor", integerScale_maximumBounds); + CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.Factor", integerScale_maximumBounds); // CVarSave(); } } // End of integer scaling settings @@ -344,19 +345,19 @@ void AdvancedResolutionSettingsWindow::DrawElement() { UIWidgets::PaddedEnhancementCheckbox("Disable aspect correction and stretch the output image.\n" "(Might be useful for 4:3 televisions!)\n" "Not available in Pixel Perfect Mode.", - "gAdvancedResolution.IgnoreAspectCorrection", false, true, - CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0) || + CVAR_PREFIX_ADVANCED_RESOLUTION ".IgnoreAspectCorrection", false, true, + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0) || disabled_everything, "", UIWidgets::CheckboxGraphics::Cross, false); #else - if (CVarGetInteger("gAdvancedResolution.IgnoreAspectCorrection", 0)) { + if (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IgnoreAspectCorrection", 0)) { // This setting is intentionally not exposed on PC platforms, // but may be accidentally activated for varying reasons. // Having this button should hopefully prevent support headaches. ImGui::TextColored(messageColor[MESSAGE_QUESTION], ICON_FA_QUESTION_CIRCLE " If the image is stretched and you don't know why, click this."); if (ImGui::Button("Click to reenable aspect correction.")) { - CVarSetInteger("gAdvancedResolution.IgnoreAspectCorrection", 0); + CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IgnoreAspectCorrection", 0); CVarSave(); } UIWidgets::Spacer(2); @@ -386,12 +387,12 @@ void AdvancedResolutionSettingsWindow::DrawElement() { // Integer Scaling - Never Exceed Bounds. const bool disabled_neverExceedBounds = - !CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0) || - CVarGetInteger("gAdvancedResolution.IntegerScale.FitAutomatically", 0) || disabled_everything; + !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0) || + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.FitAutomatically", 0) || disabled_everything; const bool checkbox_neverExceedBounds = UIWidgets::PaddedEnhancementCheckbox("Prevent integer scaling from exceeding screen bounds.\n" "(Makes screen bounds take priority over specified factor.)", - "gAdvancedResolution.IntegerScale.NeverExceedBounds", + CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.NeverExceedBounds", true, false, disabled_neverExceedBounds, "", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip( @@ -403,22 +404,22 @@ void AdvancedResolutionSettingsWindow::DrawElement() { // Initialise the (currently unused) "Exceed Bounds By" cvar if it's been changed. if (checkbox_neverExceedBounds && - CVarGetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0)) { - CVarSetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0); + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0)) { + CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0); CVarSave(); } // Integer Scaling - Exceed Bounds By 1x/Offset. // A popular feature in some retro frontends/upscalers, sometimes called "crop overscan" or "1080p 5x". /* - UIWidgets::PaddedEnhancementCheckbox("Allow integer scale factor to go +1 above maximum screen bounds.", "gAdvancedResolution.IntegerScale.ExceedBoundsBy", false, false, !CVarGetInteger("gAdvancedResolution.PixelPerfectMode", 0) || disabled_everything, "", UIWidgets::CheckboxGraphics::Cross, false); + UIWidgets::PaddedEnhancementCheckbox("Allow integer scale factor to go +1 above maximum screen bounds.", CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", false, false, !CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".PixelPerfectMode", 0) || disabled_everything, "", UIWidgets::CheckboxGraphics::Cross, false); */ // It does actually function as expected, but exceeding the bottom of the screen shows a scroll bar. // I've ended up commenting this one out because of the scroll bar, and for simplicity. // Display an info message about the scroll bar. - if (!CVarGetInteger("gAdvancedResolution.IntegerScale.NeverExceedBounds", 1) || - CVarGetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0)) { + if (!CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.NeverExceedBounds", 1) || + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0)) { if (disabled_neverExceedBounds) { // Dim this help text accordingly UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); } @@ -431,9 +432,9 @@ void AdvancedResolutionSettingsWindow::DrawElement() { // Another support helper button, to disable the unused "Exceed Bounds By" cvar. // (Remove this button if uncommenting the checkbox.) - if (CVarGetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0)) { + if (CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0)) { if (ImGui::Button("Click to reset a console variable that may be causing this.")) { - CVarSetInteger("gAdvancedResolution.IntegerScale.ExceedBoundsBy", 0); + CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".IntegerScale.ExceedBoundsBy", 0); CVarSave(); } } @@ -451,13 +452,13 @@ void AdvancedResolutionSettingsWindow::DrawElement() { if (aspectRatioX < 0.0f) { aspectRatioX = 0.0f; } - CVarSetFloat("gAdvancedResolution.AspectRatioX", aspectRatioX); + CVarSetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioX", aspectRatioX); } if (update[UPDATE_aspectRatioY]) { if (aspectRatioY < 0.0f) { aspectRatioY = 0.0f; } - CVarSetFloat("gAdvancedResolution.AspectRatioY", aspectRatioY); + CVarSetFloat(CVAR_PREFIX_ADVANCED_RESOLUTION ".AspectRatioY", aspectRatioY); } if (update[UPDATE_verticalPixelCount]) { // There's a upper and lower clamp on the Libultraship side too, @@ -468,10 +469,10 @@ void AdvancedResolutionSettingsWindow::DrawElement() { if (verticalPixelCount > maxVerticalPixelCount) { verticalPixelCount = maxVerticalPixelCount; } - CVarSetInteger("gAdvancedResolution.VerticalPixelCount", verticalPixelCount); + CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalPixelCount", verticalPixelCount); } - CVarSetInteger("gAdvancedResolution.UIComboItem.AspectRatio", item_aspectRatio); - CVarSetInteger("gAdvancedResolution.UIComboItem.PixelCount", item_pixelCount); + CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.AspectRatio", item_aspectRatio); + CVarSetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".UIComboItem.PixelCount", item_pixelCount); CVarSave(); } } @@ -484,7 +485,7 @@ void AdvancedResolutionSettingsWindow::UpdateElement() { bool AdvancedResolutionSettingsWindow::IsDroppingFrames() { // a rather imprecise way of checking for frame drops. // but it's mostly there to inform the player of large drops. - const short targetFPS = CVarGetInteger("gInterpolationFPS", 20); + const short targetFPS = CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20); const float threshold = targetFPS / 20.0f + 4.1f; return ImGui::GetIO().Framerate < targetFPS - threshold; } diff --git a/soh/soh/Enhancements/resolution-editor/ResolutionEditor.h b/soh/soh/Enhancements/resolution-editor/ResolutionEditor.h index 68680c824..f75931451 100644 --- a/soh/soh/Enhancements/resolution-editor/ResolutionEditor.h +++ b/soh/soh/Enhancements/resolution-editor/ResolutionEditor.h @@ -2,12 +2,12 @@ #include namespace AdvancedResolutionSettings { -class AdvancedResolutionSettingsWindow : public LUS::GuiWindow { +class AdvancedResolutionSettingsWindow : public Ship::GuiWindow { private: bool IsDroppingFrames(); public: - using LUS::GuiWindow::GuiWindow; + using GuiWindow::GuiWindow; void InitElement() override; void DrawElement() override; diff --git a/soh/soh/Enhancements/savestates.cpp b/soh/soh/Enhancements/savestates.cpp index 54dd56860..4d051911e 100644 --- a/soh/soh/Enhancements/savestates.cpp +++ b/soh/soh/Enhancements/savestates.cpp @@ -837,7 +837,7 @@ extern "C" void ProcessSaveStateRequests(void) { } void SaveStateMgr::SetCurrentSlot(unsigned int slot) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "slot %u set", slot); + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "slot %u set", slot); this->currentSlot = slot; } @@ -855,12 +855,12 @@ void SaveStateMgr::ProcessSaveStateRequests(void) { this->states[request.slot] = std::make_shared(OTRGlobals::Instance->gSaveStateMgr, request.slot); } this->states[request.slot]->Save(); - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "saved state %u", request.slot); + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "saved state %u", request.slot); break; case RequestType::LOAD: if (this->states.contains(request.slot)) { this->states[request.slot]->Load(); - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "loaded state %u", request.slot); + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "loaded state %u", request.slot); } else { SPDLOG_ERROR("Invalid SaveState slot: {}", request.type); } @@ -876,7 +876,7 @@ void SaveStateMgr::ProcessSaveStateRequests(void) { SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) { if (gPlayState == nullptr) { SPDLOG_ERROR("[SOH] Can not save or load a state outside of \"GamePlay\""); - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot); + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "states not available here", request.slot); return SaveStateReturn::FAIL_WRONG_GAMESTATE; } @@ -890,7 +890,7 @@ SaveStateReturn SaveStateMgr::AddRequest(const SaveStateRequest request) { return SaveStateReturn::SUCCESS; } else { SPDLOG_ERROR("Invalid SaveState slot: {}", request.type); - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot); + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(1.0f, true, "state slot %u empty", request.slot); return SaveStateReturn::FAIL_INVALID_SLOT; } [[unlikely]] default: diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index ad612a82e..569459c67 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -96,7 +96,7 @@ void EnZl4_SkipToGivingZeldasLetter(EnZl4* enZl4, PlayState* play) { void EnDntDemo_JudgeSkipToReward(EnDntDemo* enDntDemo, PlayState* play) { // todo: figure out a better way to handle toggling so we don't // need to double check cvars like this - if(!(IS_RANDO || CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO))) { + if(!(IS_RANDO || CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO))) { EnDntDemo_Judge(enDntDemo, play); return; } @@ -141,12 +141,12 @@ void TimeSaverOnGameFrameUpdateHandler() { void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* opt) { switch (id) { case VB_PLAY_TRANSITION_CS: { - if (CVarGetInteger("gTimeSavers.SkipCutscene.Intro", IS_RANDO) && gSaveContext.entranceIndex == ENTR_LINKS_HOUSE_0 && gSaveContext.cutsceneIndex == 0xFFF1) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), IS_RANDO) && gSaveContext.entranceIndex == ENTR_LINKS_HOUSE_0 && gSaveContext.cutsceneIndex == 0xFFF1) { gSaveContext.cutsceneIndex = 0; *should = false; } - if (CVarGetInteger("gTimeSavers.SkipCutscene.LearnSong", IS_RANDO) || IS_RANDO) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), IS_RANDO) || IS_RANDO) { // Song of Time if (gSaveContext.entranceIndex == ENTR_TEMPLE_OF_TIME_0 && gSaveContext.cutsceneIndex == 0xFFF7) { gSaveContext.entranceIndex = ENTR_HYRULE_FIELD_16; @@ -184,7 +184,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* } } - if (CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { uint8_t isBlueWarp = 0; // Deku Tree Blue warp if (gSaveContext.entranceIndex == ENTR_KOKIRI_FOREST_0 && gSaveContext.cutsceneIndex == 0xFFF1) { @@ -278,7 +278,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* } if (gSaveContext.entranceIndex == ENTR_GANONS_TOWER_COLLAPSE_EXTERIOR_0) { - if (CVarGetInteger("gTimeSavers.SkipTowerEscape", false) || IS_BOSS_RUSH) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipTowerEscape"), false) || IS_BOSS_RUSH) { Flags_SetEventChkInf(EVENTCHKINF_WATCHED_GANONS_CASTLE_COLLAPSE_CAUGHT_BY_GERUDO); gSaveContext.entranceIndex = ENTR_GANON_BOSS_0; *should = false; @@ -286,7 +286,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* } if (gSaveContext.entranceIndex == ENTR_CASTLE_COURTYARD_GUARDS_DAY_0) { - if (CVarGetInteger("gTimeSavers.SkipChildStealth", false)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipChildStealth"), false)) { gSaveContext.entranceIndex = ENTR_CASTLE_COURTYARD_ZELDA_0; *should = false; } @@ -295,13 +295,13 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* } case VB_PLAY_ENTRANCE_CS: { s32* entranceFlag = static_cast(opt); - if (CVarGetInteger("gTimeSavers.SkipCutscene.Entrances", IS_RANDO) && (*entranceFlag != EVENTCHKINF_EPONA_OBTAINED)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), IS_RANDO) && (*entranceFlag != EVENTCHKINF_EPONA_OBTAINED)) { *should = false; } break; } case VB_PLAY_ONEPOINT_CS: { - if (CVarGetInteger("gTimeSavers.SkipCutscene.OnePoint", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), IS_RANDO)) { s16* csId = static_cast(opt); switch (*csId) { case 4180: @@ -317,7 +317,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* break; } case VB_PLAY_ONEPOINT_ACTOR_CS: { - if (CVarGetInteger("gTimeSavers.SkipCutscene.OnePoint", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), IS_RANDO)) { Actor* actor = static_cast(opt); // there are a few checks throughout the game (such as chest spawns) that rely on this @@ -404,18 +404,18 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* break; } case VB_SHOW_TITLE_CARD: - if (CVarGetInteger("gTimeSavers.DisableTitleCard", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), IS_RANDO)) { *should = false; } break; case VB_WONDER_TALK: { - if (CVarGetInteger("gTimeSavers.NoForcedDialog", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.NoForcedDialog"), IS_RANDO)) { *should = false; } break; } case VB_NAVI_TALK: { - if (CVarGetInteger("gTimeSavers.NoForcedDialog", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.NoForcedDialog"), IS_RANDO)) { ElfMsg* naviTalk = static_cast(opt); Flags_SetSwitch(gPlayState, (naviTalk->actor.params >> 8) & 0x3F); Actor_Kill(&naviTalk->actor); @@ -424,14 +424,14 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* break; } case VB_NOT_BE_GREETED_BY_SARIA: - if (CVarGetInteger("gTimeSavers.SkipCutscene.Entrances", IS_RANDO) && !Flags_GetInfTable(INFTABLE_GREETED_BY_SARIA)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), IS_RANDO) && !Flags_GetInfTable(INFTABLE_GREETED_BY_SARIA)) { Flags_SetInfTable(INFTABLE_GREETED_BY_SARIA); *should = true; } break; case VB_MOVE_MIDO_IN_KOKIRI_FOREST: if ( - CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO) && !Flags_GetEventChkInf(EVENTCHKINF_SHOWED_MIDO_SWORD_SHIELD) && (CUR_EQUIP_VALUE(EQUIP_TYPE_SHIELD) == EQUIP_VALUE_SHIELD_DEKU) && (CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_KOKIRI) @@ -441,7 +441,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* } break; case VB_PLAY_DEKU_TREE_INTRO_CS: { - if (CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { BgTreemouth* treeMouth = static_cast(opt); Flags_SetEventChkInf(EVENTCHKINF_DEKU_TREE_OPENED_MOUTH); Audio_PlaySoundGeneral(NA_SE_EV_WOODDOOR_OPEN, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -453,7 +453,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* case VB_DEKU_JR_CONSIDER_FOREST_TEMPLE_FINISHED: { // We're overriding this so that the Deku JR doesn't despawn after skipping the forest temple blue warp cutscene. // It typically relies on the forest medallion being obtained, but that isn't given yet until after scene init - if (CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { *should = Flags_GetEventChkInf(EVENTCHKINF_USED_FOREST_TEMPLE_BLUE_WARP); } break; @@ -462,18 +462,18 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* case VB_PLAY_SHIEK_BLOCK_MASTER_SWORD_CS: case VB_GIVE_ITEM_FAIRY_OCARINA: case VB_GIVE_ITEM_LIGHT_ARROW: - if (CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { *should = false; } break; case VB_PLAY_NABOORU_CAPTURED_CS: - if (*should == true && CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) { + if (*should == true && CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { Flags_SetEventChkInf(EVENTCHKINF_NABOORU_CAPTURED_BY_TWINROVA); *should = false; } break; case VB_PLAY_PULL_MASTER_SWORD_CS: - if (CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { if (!Flags_GetEventChkInf(EVENTCHKINF_PULLED_MASTER_SWORD_FROM_PEDESTAL)) { // Normally, these would be done in the cutscene, but we're skipping it Flags_SetEventChkInf(EVENTCHKINF_PULLED_MASTER_SWORD_FROM_PEDESTAL); @@ -488,7 +488,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* } break; case VB_OWL_INTERACTION: { - if (CVarGetInteger("gTimeSavers.SkipOwlInteractions", IS_RANDO) && *should) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), IS_RANDO) && *should) { EnOwl* enOwl = static_cast(opt); s32 owlType = (enOwl->actor.params & 0xFC0) >> 6; @@ -502,7 +502,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* break; } case VB_OVERRIDE_LINK_THE_GORON_DIALOGUE: { - if (CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO)) { u16* textId = static_cast(opt); // If the doors are not open yet, prioritize opening them if (!Flags_GetInfTable(INFTABLE_GORON_CITY_DOORS_UNLOCKED)) { @@ -516,12 +516,12 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* case VB_PLAY_EYEDROPS_CS: case VB_PLAY_DROP_FISH_FOR_JABU_CS: case VB_PLAY_DARUNIAS_JOY_CS: - if (CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO)) { *should = false; } break; case VB_PLAY_ZELDAS_LULLABY_CS: { - if (CVarGetInteger("gTimeSavers.SkipCutscene.LearnSong", IS_RANDO) || IS_RANDO) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), IS_RANDO) || IS_RANDO) { DemoIm* demoIm = static_cast(opt); Player* player = GET_PLAYER(gPlayState); player->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; @@ -532,7 +532,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* static uint32_t demoImKillHook = 0; demoImUpdateHook = GameInteractor::Instance->RegisterGameHook([](void* actorRef) mutable { Actor* actor = static_cast(actorRef); - if (actor->id == ACTOR_DEMO_IM && (CVarGetInteger("gTimeSavers.SkipCutscene.LearnSong", IS_RANDO) || IS_RANDO)) { + if (actor->id == ACTOR_DEMO_IM && (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), IS_RANDO) || IS_RANDO)) { DemoIm* demoIm = static_cast(actorRef); Player* player = GET_PLAYER(gPlayState); player->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; @@ -571,7 +571,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* break; } case VB_PLAY_SARIAS_SONG_CS: { - if (CVarGetInteger("gTimeSavers.SkipCutscene.LearnSong", IS_RANDO) || IS_RANDO) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), IS_RANDO) || IS_RANDO) { EnSa* enSa = static_cast(opt); enSa->actionFunc = func_80AF6B20; *should = false; @@ -579,13 +579,13 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* break; } case VB_DESPAWN_HORSE_RACE_COW: { - if (Flags_GetEventChkInf(EVENTCHKINF_WON_COW_IN_MALONS_RACE) && CVarGetInteger("gCowOfTime", 0)) { + if (Flags_GetEventChkInf(EVENTCHKINF_WON_COW_IN_MALONS_RACE) && CVarGetInteger(CVAR_ENHANCEMENT("CowOfTime"), 0)) { *should = false; } break; } case VB_PLAY_DRAIN_WELL_CS: { - if (CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { *should = false; Flags_SetSwitch(gPlayState, 0x2); Flags_SetEventChkInf(EVENTCHKINF_PLAYED_SONG_OF_STORMS_IN_WINDMILL); @@ -594,7 +594,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* break; } case VB_PLAY_SUNS_SONG_CS: - if (CVarGetInteger("gTimeSavers.SkipCutscene.LearnSong", IS_RANDO) || IS_RANDO) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), IS_RANDO) || IS_RANDO) { *should = false; Flags_SetEventChkInf(EVENTCHKINF_LEARNED_SUNS_SONG); // SoH [Randomizer] TODO: Increment time X amount (find out X) @@ -603,19 +603,19 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* } break; case VB_PLAY_ROYAL_FAMILY_TOMB_CS: { - if (CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO)) { *should = false; } break; } case VB_PLAY_ROYAL_FAMILY_TOMB_EXPLODE: { - if (CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO)) { *should = Flags_GetEventChkInf(EVENTCHKINF_DESTROYED_ROYAL_FAMILY_TOMB); } break; } case VB_PLAY_DOOR_OF_TIME_CS: { - if (CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO)) { *should = false; Flags_SetEnv(gPlayState, 2); func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -638,41 +638,41 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* case VB_PLAY_BOLERO_OF_FIRE_CS: case VB_PLAY_SERENADE_OF_WATER_CS: case VB_PLAY_PRELUDE_OF_LIGHT_CS: - if (CVarGetInteger("gTimeSavers.SkipCutscene.LearnSong", IS_RANDO) || IS_RANDO) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), IS_RANDO) || IS_RANDO) { *should = false; } break; case VB_DAMPE_IN_GRAVEYARD_DESPAWN: - if (CVarGetInteger("gDampeAllNight", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DampeAllNight"), 0)) { *should = LINK_IS_ADULT || gPlayState->sceneNum != SCENE_GRAVEYARD; } break; case VB_BE_VALID_GRAVEDIGGING_SPOT: - if (CVarGetInteger("gDampeWin", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DampeWin"), 0)) { EnTk *enTk = static_cast(opt); enTk->validDigHere = true; *should = true; } break; case VB_BE_DAMPE_GRAVEDIGGING_GRAND_PRIZE: - if (CVarGetInteger("gDampeWin", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DampeWin"), 0)) { EnTk *enTk = static_cast(opt); enTk->currentReward = 3; *should = true; } break; case VB_DAMPE_GRAVEDIGGING_GRAND_PRIZE_BE_HEART_PIECE: - if (CVarGetInteger("gGravediggingTourFix", 0) || IS_RANDO) { + if (CVarGetInteger(CVAR_ENHANCEMENT("GravediggingTourFix"), 0) || IS_RANDO) { *should = !Flags_GetCollectible(gPlayState, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE); } break; case VB_FIX_SAW_SOFTLOCK: // Animation Count should be no more than 1 to guarantee putaway is complete after giving the saw // As this is vanilla behavior, it only applies with the Fix toggle or Skip Text enabled. - *should = (CVarGetInteger("gFixSawSoftlock", 0) != 0 || CVarGetInteger("gSkipText", 0) != 0) ? gPlayState->animationCtx.animationCount > 1 : *should; + *should = (CVarGetInteger(CVAR_ENHANCEMENT("FixSawSoftlock"), 0) != 0 || CVarGetInteger(CVAR_ENHANCEMENT("SkipText"), 0) != 0) ? gPlayState->animationCtx.animationCount > 1 : *should; break; case VB_BIGGORON_CONSIDER_SWORD_FORGED: - *should = Environment_GetBgsDayCount() >= CVarGetInteger("gForgeTime", 3); + *should = Environment_GetBgsDayCount() >= CVarGetInteger(CVAR_ENHANCEMENT("ForgeTime"), 3); break; case VB_BE_ELIGIBLE_FOR_GREAT_FAIRY_REWARD: { BgDyYoseizo* bgDyYoseizo = static_cast(opt); @@ -704,7 +704,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* } } - if (flag != RAND_INF_MAX && (IS_RANDO || CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO))) { + if (flag != RAND_INF_MAX && (IS_RANDO || CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO))) { if (IS_RANDO || *should) { Flags_SetRandomizerInf(flag); gSaveContext.healthAccumulator = 0x140; @@ -716,14 +716,14 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* break; } case VB_PLAY_RAINBOW_BRIDGE_CS: { - if (CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { *should = false; func_800F595C(NA_BGM_BRIDGE_TO_GANONS); } break; } case VB_PHANTOM_GANON_DEATH_SCENE: { - if (CVarGetInteger("gTimeSavers.SkipCutscene.QuickBossDeaths", IS_RANDO || IS_BOSS_RUSH)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths"), IS_RANDO || IS_BOSS_RUSH)) { *should = false; BossGanondrof* pg = static_cast(opt); Player* player = GET_PLAYER(gPlayState); @@ -749,7 +749,7 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, void* } case VB_NABOORU_KNUCKLE_DEATH_SCENE: { EnIk* ik = static_cast(opt); - if (CVarGetInteger("gTimeSavers.SkipCutscene.QuickBossDeaths", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths"), IS_RANDO)) { // Because no CS in rando, we hide the death of the knuckle by spawning flames and kill the actor if ((ik->actor.colChkInfo.health <= 10)) { s32 i; @@ -791,7 +791,7 @@ void TimeSaverOnActorInitHandler(void* actorRef) { if (actor->id == ACTOR_EN_KO && (actor->params & 0xFF) == ENKO_TYPE_CHILD_3) { enKoUpdateHook = GameInteractor::Instance->RegisterGameHook([](void* innerActorRef) mutable { Actor* innerActor = static_cast(innerActorRef); - if (innerActor->id == ACTOR_EN_KO && (innerActor->params & 0xFF) == ENKO_TYPE_CHILD_3 && (CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO) || IS_RANDO)) { + if (innerActor->id == ACTOR_EN_KO && (innerActor->params & 0xFF) == ENKO_TYPE_CHILD_3 && (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO) || IS_RANDO)) { EnKo* enKo = static_cast(innerActorRef); // They haven't moved yet, wrap their update function so we check every frame if (enKo->actionFunc == func_80A995CC) { @@ -817,7 +817,7 @@ void TimeSaverOnActorInitHandler(void* actorRef) { }); } - if (actor->id == ACTOR_ITEM_OCARINA && actor->params == 3 && CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) { + if (actor->id == ACTOR_ITEM_OCARINA && actor->params == 3 && CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { itemOcarinaframesSinceSpawn = 0; itemOcarinaUpdateHook = GameInteractor::Instance->RegisterGameHook([](void* innerActorRef) mutable { Actor* innerActor = static_cast(innerActorRef); @@ -835,7 +835,7 @@ void TimeSaverOnActorInitHandler(void* actorRef) { if (actor->id == ACTOR_EN_MA1 && gPlayState->sceneNum == SCENE_LON_LON_RANCH) { enMa1UpdateHook = GameInteractor::Instance->RegisterGameHook([](void* innerActorRef) mutable { Actor* innerActor = static_cast(innerActorRef); - if (innerActor->id == ACTOR_EN_MA1 && (CVarGetInteger("gTimeSavers.SkipCutscene.LearnSong", IS_RANDO) || IS_RANDO)) { + if (innerActor->id == ACTOR_EN_MA1 && (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), IS_RANDO) || IS_RANDO)) { EnMa1* enMa1 = static_cast(innerActorRef); if (enMa1->actionFunc == func_80AA106C) { enMa1->actionFunc = EnMa1_EndTeachSong; @@ -863,7 +863,7 @@ void TimeSaverOnActorInitHandler(void* actorRef) { if (actor->id == ACTOR_EN_FU) { enFuUpdateHook = GameInteractor::Instance->RegisterGameHook([](void* innerActorRef) mutable { Actor* innerActor = static_cast(innerActorRef); - if (innerActor->id == ACTOR_EN_FU && (CVarGetInteger("gTimeSavers.SkipCutscene.LearnSong", IS_RANDO) || IS_RANDO)) { + if (innerActor->id == ACTOR_EN_FU && (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), IS_RANDO) || IS_RANDO)) { EnFu* enFu = static_cast(innerActorRef); if (enFu->actionFunc == EnFu_TeachSong) { enFu->actionFunc = EnFu_EndTeachSong; @@ -885,7 +885,7 @@ void TimeSaverOnActorInitHandler(void* actorRef) { if (actor->id == ACTOR_BG_SPOT02_OBJECTS && actor->params == 2) { bgSpot02UpdateHook = GameInteractor::Instance->RegisterGameHook([](void* innerActorRef) mutable { Actor* innerActor = static_cast(innerActorRef); - if (innerActor->id == ACTOR_BG_SPOT02_OBJECTS && innerActor->params == 2 && (CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO))) { + if (innerActor->id == ACTOR_BG_SPOT02_OBJECTS && innerActor->params == 2 && (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO))) { BgSpot02Objects* bgSpot02 = static_cast(innerActorRef); if (bgSpot02->actionFunc == func_808ACC34) { bgSpot02->actionFunc = func_808AC908; @@ -904,14 +904,14 @@ void TimeSaverOnActorInitHandler(void* actorRef) { }); } - if (actor->id == ACTOR_EN_ZL4 && CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) { + if (actor->id == ACTOR_EN_ZL4 && CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { EnZl4* enZl4 = static_cast(actorRef); if (enZl4->actionFunc != EnZl4_Cutscene || enZl4->csState != 0) return; enZl4->actionFunc = EnZl4_SkipToGivingZeldasLetter; } - if (actor->id == ACTOR_EN_DNT_DEMO && (IS_RANDO || CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO))) { + if (actor->id == ACTOR_EN_DNT_DEMO && (IS_RANDO || CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO))) { EnDntDemo* enDntDemo = static_cast(actorRef); enDntDemo->actionFunc = EnDntDemo_JudgeSkipToReward; } @@ -921,7 +921,7 @@ void TimeSaverOnActorInitHandler(void* actorRef) { // or poes from which the cutscene is triggered until we can have a "BeforeActorInit" hook. // So for now we're just going to set the flag before they get to the room the cutscene is in if (gPlayState->sceneNum == SCENE_FOREST_TEMPLE && actor->id == ACTOR_EN_ST && !Flags_GetSwitch(gPlayState, 0x1B)) { - if (CVarGetInteger("gTimeSavers.SkipCutscene.GlitchAiding", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.GlitchAiding"), 0)) { Flags_SetSwitch(gPlayState, 0x1B); } } @@ -930,7 +930,7 @@ void TimeSaverOnActorInitHandler(void* actorRef) { if (actor->id == ACTOR_EN_PO_SISTERS && actor->params == 28) { enPoSistersUpdateHook = GameInteractor::Instance->RegisterGameHook([](void* innerActorRef) mutable { Actor* innerActor = static_cast(innerActorRef); - if (innerActor->id == ACTOR_EN_PO_SISTERS && innerActor->params == 28 && (CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO))) { + if (innerActor->id == ACTOR_EN_PO_SISTERS && innerActor->params == 28 && (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO))) { EnPoSisters* enPoSisters = static_cast(innerActorRef); if (enPoSisters->actionFunc == func_80ADB338) { enPoSisters->unk_19C = 0; @@ -947,7 +947,7 @@ void TimeSaverOnActorInitHandler(void* actorRef) { // Fire Temple Darunia cutscene if (actor->id == ACTOR_EN_DU && gPlayState->sceneNum == SCENE_FIRE_TEMPLE) { - if (CVarGetInteger("gTimeSavers.SkipCutscene.GlitchAiding", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.GlitchAiding"), 0)) { Flags_SetInfTable(INFTABLE_SPOKE_TO_DARUNIA_IN_FIRE_TEMPLE); Actor_Kill(actor); } @@ -957,63 +957,63 @@ void TimeSaverOnActorInitHandler(void* actorRef) { void TimeSaverOnSceneInitHandler(int16_t sceneNum) { switch (sceneNum) { case SCENE_HYRULE_CASTLE: - if (CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO) && !Flags_GetInfTable(INFTABLE_ENTERED_HYRULE_CASTLE)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO) && !Flags_GetInfTable(INFTABLE_ENTERED_HYRULE_CASTLE)) { Flags_SetInfTable(INFTABLE_ENTERED_HYRULE_CASTLE); Flags_SetInfTable(INFTABLE_MET_CHILD_MALON_AT_CASTLE_OR_MARKET); Flags_SetEventChkInf(EVENTCHKINF_SPOKE_TO_CHILD_MALON_AT_CASTLE_OR_MARKET); } break; case SCENE_LON_LON_RANCH: - if (CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO) && GameInteractor_Should(VB_MALON_RETURN_FROM_CASTLE, Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE), NULL)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO) && GameInteractor_Should(VB_MALON_RETURN_FROM_CASTLE, Flags_GetEventChkInf(EVENTCHKINF_TALON_RETURNED_FROM_CASTLE), NULL)) { Flags_SetEventChkInf(EVENTCHKINF_SPOKE_TO_CHILD_MALON_AT_RANCH); Flags_SetInfTable(INFTABLE_CHILD_MALON_SAID_EPONA_WAS_AFRAID_OF_YOU); Flags_SetEventChkInf(EVENTCHKINF_INVITED_TO_SING_WITH_CHILD_MALON); } break; case SCENE_DEKU_TREE_BOSS: - if (CVarGetInteger("gTimeSavers.SkipCutscene.BossIntro", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), IS_RANDO)) { if (!Flags_GetEventChkInf(EVENTCHKINF_BEGAN_GOHMA_BATTLE)) { Flags_SetEventChkInf(EVENTCHKINF_BEGAN_GOHMA_BATTLE); } } break; case SCENE_DODONGOS_CAVERN_BOSS: - if (CVarGetInteger("gTimeSavers.SkipCutscene.BossIntro", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), IS_RANDO)) { if (!Flags_GetEventChkInf(EVENTCHKINF_BEGAN_KING_DODONGO_BATTLE)) { Flags_SetEventChkInf(EVENTCHKINF_BEGAN_KING_DODONGO_BATTLE); } } break; case SCENE_JABU_JABU_BOSS: - if (CVarGetInteger("gTimeSavers.SkipCutscene.BossIntro", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), IS_RANDO)) { if (!Flags_GetEventChkInf(EVENTCHKINF_BEGAN_BARINA_BATTLE)) { Flags_SetEventChkInf(EVENTCHKINF_BEGAN_BARINA_BATTLE); } } break; case SCENE_FOREST_TEMPLE_BOSS: - if (CVarGetInteger("gTimeSavers.SkipCutscene.BossIntro", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), IS_RANDO)) { if (!Flags_GetEventChkInf(EVENTCHKINF_BEGAN_PHANTOM_GANON_BATTLE)) { Flags_SetEventChkInf(EVENTCHKINF_BEGAN_PHANTOM_GANON_BATTLE); } } break; case SCENE_FIRE_TEMPLE_BOSS: - if (CVarGetInteger("gTimeSavers.SkipCutscene.BossIntro", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), IS_RANDO)) { if (!Flags_GetEventChkInf(EVENTCHKINF_BEGAN_VOLVAGIA_BATTLE)) { Flags_SetEventChkInf(EVENTCHKINF_BEGAN_VOLVAGIA_BATTLE); } } break; case SCENE_WATER_TEMPLE_BOSS: - if (CVarGetInteger("gTimeSavers.SkipCutscene.BossIntro", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), IS_RANDO)) { if (!Flags_GetEventChkInf(EVENTCHKINF_BEGAN_MORPHA_BATTLE)) { Flags_SetEventChkInf(EVENTCHKINF_BEGAN_MORPHA_BATTLE); } } break; case SCENE_SPIRIT_TEMPLE_BOSS: - if (CVarGetInteger("gTimeSavers.SkipCutscene.BossIntro", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), IS_RANDO)) { if (!Flags_GetEventChkInf(EVENTCHKINF_BEGAN_TWINROVA_BATTLE)) { Flags_SetEventChkInf(EVENTCHKINF_BEGAN_TWINROVA_BATTLE); Flags_SetEventChkInf(EVENTCHKINF_BEGAN_NABOORU_BATTLE); @@ -1022,7 +1022,7 @@ void TimeSaverOnSceneInitHandler(int16_t sceneNum) { } break; case SCENE_SHADOW_TEMPLE_BOSS: - if (CVarGetInteger("gTimeSavers.SkipCutscene.BossIntro", IS_RANDO)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), IS_RANDO)) { if (!Flags_GetEventChkInf(EVENTCHKINF_BEGAN_BONGO_BONGO_BATTLE)) { Flags_SetEventChkInf(EVENTCHKINF_BEGAN_BONGO_BONGO_BATTLE); } @@ -1034,7 +1034,7 @@ void TimeSaverOnSceneInitHandler(int16_t sceneNum) { static GetItemEntry vanillaQueuedItemEntry = GET_ITEM_NONE; void TimeSaverOnFlagSetHandler(int16_t flagType, int16_t flag) { - if (!CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO)) return; + if (!CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) return; switch (flagType) { case FLAG_EVENT_CHECK_INF: diff --git a/soh/soh/Enhancements/tts/tts.cpp b/soh/soh/Enhancements/tts/tts.cpp index 3a375230f..593706dd6 100644 --- a/soh/soh/Enhancements/tts/tts.cpp +++ b/soh/soh/Enhancements/tts/tts.cpp @@ -92,7 +92,7 @@ std::string GetParameritizedText(std::string key, TextBank bank, const char* arg } const char* GetLanguageCode() { - switch (CVarGetInteger("gLanguages", 0)) { + switch (CVarGetInteger(CVAR_SETTING("Languages"), 0)) { case LANGUAGE_FRA: return "fr-FR"; break; @@ -116,7 +116,7 @@ static std::string titleCardText; void RegisterOnSceneInitHook() { GameInteractor::Instance->RegisterGameHook([](int16_t sceneNum) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; titleCardText = NameForSceneId(sceneNum); }); @@ -124,7 +124,7 @@ void RegisterOnSceneInitHook() { void RegisterOnPresentTitleCardHook() { GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; SpeechSynthesizer::Instance->Speak(titleCardText.c_str(), GetLanguageCode()); }); @@ -134,7 +134,7 @@ void RegisterOnPresentTitleCardHook() { void RegisterOnInterfaceUpdateHook() { GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; static uint32_t prevTimer = 0; static char ttsAnnounceBuf[32]; @@ -193,7 +193,7 @@ void RegisterOnInterfaceUpdateHook() { void RegisterOnKaleidoscopeUpdateHook() { GameInteractor::Instance->RegisterGameHook([](int16_t inDungeonScene) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; static int16_t prevCursorIndex = 0; static uint16_t prevCursorSpecialPos = 0; @@ -550,14 +550,14 @@ void RegisterOnKaleidoscopeUpdateHook() { void RegisterOnUpdateMainMenuSelection() { GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; auto translation = GetParameritizedText("file1", TEXT_BANK_FILECHOOSE, nullptr); SpeechSynthesizer::Instance->Speak(translation.c_str(), GetLanguageCode()); }); GameInteractor::Instance->RegisterGameHook([](uint16_t optionIndex) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; switch (optionIndex) { case FS_BTN_MAIN_FILE_1: { @@ -596,7 +596,7 @@ void RegisterOnUpdateMainMenuSelection() { }); GameInteractor::Instance->RegisterGameHook([](uint16_t optionIndex) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; switch (optionIndex) { case FS_BTN_CONFIRM_YES: { @@ -615,7 +615,7 @@ void RegisterOnUpdateMainMenuSelection() { }); GameInteractor::Instance->RegisterGameHook([](uint16_t optionIndex) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; switch (optionIndex) { case FS_BTN_COPY_FILE_1: { @@ -644,7 +644,7 @@ void RegisterOnUpdateMainMenuSelection() { }); GameInteractor::Instance->RegisterGameHook([](uint16_t optionIndex) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; switch (optionIndex) { case FS_BTN_CONFIRM_YES: { @@ -663,7 +663,7 @@ void RegisterOnUpdateMainMenuSelection() { }); GameInteractor::Instance->RegisterGameHook([](uint16_t optionIndex) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; switch (optionIndex) { case FS_BTN_ERASE_FILE_1: { @@ -692,7 +692,7 @@ void RegisterOnUpdateMainMenuSelection() { }); GameInteractor::Instance->RegisterGameHook([](uint16_t optionIndex) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; switch (optionIndex) { case FS_BTN_CONFIRM_YES: { @@ -711,7 +711,7 @@ void RegisterOnUpdateMainMenuSelection() { }); GameInteractor::Instance->RegisterGameHook([](uint8_t optionIndex) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; switch (optionIndex) { case FS_AUDIO_STEREO: { @@ -740,7 +740,7 @@ void RegisterOnUpdateMainMenuSelection() { }); GameInteractor::Instance->RegisterGameHook([](uint8_t optionIndex) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; switch (optionIndex) { case FS_TARGET_SWITCH: { @@ -759,7 +759,7 @@ void RegisterOnUpdateMainMenuSelection() { }); GameInteractor::Instance->RegisterGameHook([](uint8_t optionIndex) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; switch (optionIndex) { case LANGUAGE_ENG: { @@ -783,7 +783,7 @@ void RegisterOnUpdateMainMenuSelection() { }); GameInteractor::Instance->RegisterGameHook([](uint8_t questIndex) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; switch (questIndex) { case QUEST_NORMAL: { @@ -812,7 +812,7 @@ void RegisterOnUpdateMainMenuSelection() { }); GameInteractor::Instance->RegisterGameHook([](uint8_t optionIndex, uint8_t optionValue) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; auto optionName = BossRush_GetSettingName(optionIndex, gSaveContext.language); auto optionValueName = BossRush_GetSettingChoiceName(optionIndex, optionValue, gSaveContext.language); @@ -821,7 +821,7 @@ void RegisterOnUpdateMainMenuSelection() { }); GameInteractor::Instance->RegisterGameHook([](int16_t charCode) { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; char charVal[2]; std::string translation; @@ -958,7 +958,7 @@ std::string Message_TTS_Decode(uint8_t* sourceBuf, uint16_t startOfset, uint16_t void RegisterOnDialogMessageHook() { GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger("gA11yTTS", 0)) return; + if (!CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)) return; MessageContext *msgCtx = &gPlayState->msgCtx; @@ -1030,7 +1030,7 @@ void RegisterOnDialogMessageHook() { void InitTTSBank() { std::string languageSuffix = "_eng.json"; - switch (CVarGetInteger("gLanguages", 0)) { + switch (CVarGetInteger(CVAR_SETTING("Languages"), 0)) { case LANGUAGE_FRA: languageSuffix = "_fra.json"; break; @@ -1039,22 +1039,22 @@ void InitTTSBank() { break; } - auto initData = std::make_shared(); + auto initData = std::make_shared(); initData->Format = RESOURCE_FORMAT_BINARY; - initData->Type = static_cast(LUS::ResourceType::Json); + initData->Type = static_cast(Ship::ResourceType::Json); initData->ResourceVersion = 0; - sceneMap = std::static_pointer_cast( - LUS::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/scenes" + languageSuffix, true, initData))->Data; + sceneMap = std::static_pointer_cast( + Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/scenes" + languageSuffix, true, initData))->Data; - miscMap = std::static_pointer_cast( - LUS::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/misc" + languageSuffix, true, initData))->Data; + miscMap = std::static_pointer_cast( + Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/misc" + languageSuffix, true, initData))->Data; - kaleidoMap = std::static_pointer_cast( - LUS::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/kaleidoscope" + languageSuffix, true, initData))->Data; + kaleidoMap = std::static_pointer_cast( + Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/kaleidoscope" + languageSuffix, true, initData))->Data; - fileChooseMap = std::static_pointer_cast( - LUS::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/filechoose" + languageSuffix, true, initData))->Data; + fileChooseMap = std::static_pointer_cast( + Ship::Context::GetInstance()->GetResourceManager()->LoadResource("accessibility/texts/filechoose" + languageSuffix, true, initData))->Data; } void RegisterOnSetGameLanguageHook() { diff --git a/soh/soh/Extractor/Extract.cpp b/soh/soh/Extractor/Extract.cpp index b08783763..673afc8a6 100644 --- a/soh/soh/Extractor/Extract.cpp +++ b/soh/soh/Extractor/Extract.cpp @@ -6,7 +6,7 @@ #endif #include "Extract.h" #include "portable-file-dialogs.h" -#include +#include #include "variables.h" #ifdef unix diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 2f166ada0..41878bcce 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -22,11 +22,6 @@ #include #endif #include -#include -#define DRMP3_IMPLEMENTATION -#include -#define DRWAV_IMPLEMENTATION -#include #include #include "Enhancements/speechsynthesizer/SpeechSynthesizer.h" #include "Enhancements/controls/SohInputEditorWindow.h" @@ -49,7 +44,7 @@ #include "z64.h" #include "macros.h" #include "Fonts.h" -#include +#include #include "Enhancements/custom-message/CustomMessageManager.h" #include "Enhancements/presets.h" #include "util.h" @@ -94,6 +89,12 @@ GameInteractorSail* GameInteractorSail::Instance; #include // Resource Types/Factories +#include "resource/type/Array.h" +#include "resource/type/Blob.h" +#include "resource/type/DisplayList.h" +#include "resource/type/Matrix.h" +#include "resource/type/Texture.h" +#include "resource/type/Vertex.h" #include "soh/resource/type/SohResourceType.h" #include "soh/resource/type/Animation.h" #include "soh/resource/type/AudioSample.h" @@ -107,6 +108,12 @@ GameInteractorSail* GameInteractorSail::Instance; #include "soh/resource/type/Skeleton.h" #include "soh/resource/type/SkeletonLimb.h" #include "soh/resource/type/Text.h" +#include "resource/factory/ArrayFactory.h" +#include "resource/factory/BlobFactory.h" +#include "resource/factory/DisplayListFactory.h" +#include "resource/factory/MatrixFactory.h" +#include "resource/factory/TextureFactory.h" +#include "resource/factory/VertexFactory.h" #include "soh/resource/importer/AnimationFactory.h" #include "soh/resource/importer/AudioSampleFactory.h" #include "soh/resource/importer/AudioSequenceFactory.h" @@ -254,19 +261,19 @@ const char* constCameraStrings[] = { OTRGlobals::OTRGlobals() { std::vector OTRFiles; - std::string mqPath = LUS::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName); + std::string mqPath = Ship::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName); if (std::filesystem::exists(mqPath)) { OTRFiles.push_back(mqPath); } - std::string ootPath = LUS::Context::LocateFileAcrossAppDirs("oot.otr", appShortName); + std::string ootPath = Ship::Context::LocateFileAcrossAppDirs("oot.otr", appShortName); if (std::filesystem::exists(ootPath)) { OTRFiles.push_back(ootPath); } - std::string sohOtrPath = LUS::Context::GetPathRelativeToAppBundle("soh.otr"); + std::string sohOtrPath = Ship::Context::GetPathRelativeToAppBundle("soh.otr"); if (std::filesystem::exists(sohOtrPath)) { OTRFiles.push_back(sohOtrPath); } - std::string patchesPath = LUS::Context::LocateFileAcrossAppDirs("mods", appShortName); + std::string patchesPath = Ship::Context::LocateFileAcrossAppDirs("mods", appShortName); std::vector patchOTRs = {}; if (patchesPath.length() > 0 && std::filesystem::exists(patchesPath)) { if (std::filesystem::is_directory(patchesPath)) { @@ -308,7 +315,7 @@ OTRGlobals::OTRGlobals() { OOT_PAL_GC_DBG2 }; - context = LUS::Context::CreateUninitializedInstance("Ship of Harkinian", appShortName, "shipofharkinian.json"); + context = Ship::Context::CreateUninitializedInstance("Ship of Harkinian", appShortName, "shipofharkinian.json"); context->InitLogging(); context->InitGfxDebugger(); @@ -324,16 +331,32 @@ OTRGlobals::OTRGlobals() { context->InitCrashHandler(); context->InitConsole(); - auto sohInputEditorWindow = std::make_shared("gControllerConfigurationEnabled", "Input Editor"); - context->InitWindow(sohInputEditorWindow); + auto sohInputEditorWindow = std::make_shared(CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN, "Input Editor"); + context->InitWindow({ sohInputEditorWindow }); + + auto overlay = context->GetInstance()->GetWindow()->GetGui()->GetGameOverlay(); + overlay->LoadFont("Press Start 2P", "fonts/PressStart2P-Regular.ttf", 12.0f); + overlay->LoadFont("Fipps", "fonts/Fipps-Regular.otf", 32.0f); + overlay->SetCurrentFont(CVarGetString(CVAR_GAME_OVERLAY_FONT, "Press Start 2P")); + context->InitAudio(); SPDLOG_INFO("Starting Ship of Harkinian version {}", (char*)gBuildVersion); auto loader = context->GetResourceManager()->GetResourceLoader(); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Texture", static_cast(LUS::ResourceType::Texture), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Texture", static_cast(LUS::ResourceType::Texture), 1); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Vertex", static_cast(LUS::ResourceType::Vertex), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_XML, "Vertex", static_cast(LUS::ResourceType::Vertex), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "DisplayList", static_cast(LUS::ResourceType::DisplayList), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_XML, "DisplayList", static_cast(LUS::ResourceType::DisplayList), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Matrix", static_cast(LUS::ResourceType::Matrix), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Array", static_cast(LUS::ResourceType::Array), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Blob", static_cast(LUS::ResourceType::Blob), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Animation", static_cast(SOH::ResourceType::SOH_Animation), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "PlayerAnimation", static_cast(SOH::ResourceType::SOH_PlayerAnimation), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Room", static_cast(SOH::ResourceType::SOH_Room), 0); // Is room scene? maybe? + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_XML, "Room", static_cast(SOH::ResourceType::SOH_Room), 0); // Is room scene? maybe? loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "CollisionHeader", static_cast(SOH::ResourceType::SOH_CollisionHeader), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_XML, "CollisionHeader", static_cast(SOH::ResourceType::SOH_CollisionHeader), 0); loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Skeleton", static_cast(SOH::ResourceType::SOH_Skeleton), 0); @@ -382,7 +405,7 @@ OTRGlobals::OTRGlobals() { #if defined(__SWITCH__) SPDLOG_ERROR("Invalid OTR File!"); #elif defined(__WIIU__) - LUS::WiiU::ThrowInvalidOTR(); + Ship::WiiU::ThrowInvalidOTR(); #else SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, "Invalid OTR File", "Attempted to load an invalid OTR file. Try regenerating.", nullptr); @@ -420,7 +443,7 @@ OTRGlobals::~OTRGlobals() { } void OTRGlobals::ScaleImGui() { - float scale = imguiScaleOptionToValue[CVarGetInteger("gImGuiScale", defaultImGuiScale)]; + float scale = imguiScaleOptionToValue[CVarGetInteger(CVAR_SETTING("ImGuiScale"), defaultImGuiScale)]; float newScale = scale / previousImGuiScale; ImGui::GetStyle().ScaleAllSizes(newScale); ImGui::GetIO().FontGlobalScale = scale; @@ -454,15 +477,15 @@ bool OTRGlobals::HasOriginal() { } uint32_t OTRGlobals::GetInterpolationFPS() { - if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { - return CVarGetInteger("gInterpolationFPS", 20); + if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) { + return CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20); } - if (CVarGetInteger("gMatchRefreshRate", 0)) { - return LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + if (CVarGetInteger(CVAR_SETTING("MatchRefreshRate"), 0)) { + return Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); } - return std::min(LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), CVarGetInteger("gInterpolationFPS", 20)); + return std::min(Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(), CVarGetInteger(CVAR_SETTING("InterpolationFPS"), 20)); } struct ExtensionEntry { @@ -857,7 +880,7 @@ extern "C" RandomizerGet RetrieveRandomizerGetFromItemID(ItemID itemID) { } extern "C" void OTRExtScanner() { - auto lst = *LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles().get(); + auto lst = *Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles().get(); for (auto& rPath : lst) { std::vector raw = StringHelper::Split(rPath, "."); @@ -880,13 +903,13 @@ OTRVersion ReadPortVersionFromOTR(std::string otrPath) { OTRVersion version = {}; // Use a temporary archive instance to load the otr and read the version file - auto archive = LUS::OtrArchive(otrPath); + auto archive = Ship::OtrArchive(otrPath); if (archive.Open()) { - auto t = archive.LoadFile("portVersion", std::make_shared()); + auto t = archive.LoadFile("portVersion", std::make_shared()); if (t != nullptr && t->IsLoaded) { - auto stream = std::make_shared(t->Buffer->data(), t->Buffer->size()); - auto reader = std::make_shared(stream); - LUS::Endianness endianness = (LUS::Endianness)reader->ReadUByte(); + auto stream = std::make_shared(t->Buffer->data(), t->Buffer->size()); + auto reader = std::make_shared(stream); + Ship::Endianness endianness = (Ship::Endianness)reader->ReadUByte(); reader->SetEndianness(endianness); version.major = reader->ReadUInt16(); version.minor = reader->ReadUInt16(); @@ -917,7 +940,7 @@ void CheckSoHOTRVersion(std::string otrPath) { Extractor::ShowErrorBox("soh.otr file is missing", msg.c_str()); exit(1); #elif defined(__SWITCH__) - LUS::Switch::PrintErrorMessageToScreen(("\x1b[2;2HYou are missing the soh.otr file." + msg).c_str()); + Ship::Switch::PrintErrorMessageToScreen(("\x1b[2;2HYou are missing the soh.otr file." + msg).c_str()); #elif defined(__WIIU__) OSFatal(("You are missing the soh.otr file\n\n" + msg).c_str()); #endif @@ -930,7 +953,7 @@ void CheckSoHOTRVersion(std::string otrPath) { Extractor::ShowErrorBox("soh.otr file version does not match", msg.c_str()); exit(1); #elif defined(__SWITCH__) - LUS::Switch::PrintErrorMessageToScreen(("\x1b[2;2HYou have an old soh.otr file." + msg).c_str()); + Ship::Switch::PrintErrorMessageToScreen(("\x1b[2;2HYou have an old soh.otr file." + msg).c_str()); #elif defined(__WIIU__) OSFatal(("You have an old soh.otr file\n\n" + msg).c_str()); #endif @@ -941,7 +964,7 @@ void CheckSoHOTRVersion(std::string otrPath) { // For Windows/Mac/Linux if the version doesn't match, offer to void DetectOTRVersion(std::string fileName, bool isMQ) { bool isOtrOld = false; - std::string otrPath = LUS::Context::LocateFileAcrossAppDirs(fileName, appShortName); + std::string otrPath = Ship::Context::LocateFileAcrossAppDirs(fileName, appShortName); // Doesn't exist so nothing to do here if (!std::filesystem::exists(otrPath)) { @@ -971,7 +994,7 @@ void DetectOTRVersion(std::string fileName, bool isMQ) { fileName.c_str(), version); if (Extractor::ShowYesNoBox("Old OTR File Found", msgBuf) == IDYES) { - std::string installPath = LUS::Context::GetAppBundlePath(); + std::string installPath = Ship::Context::GetAppBundlePath(); if (!std::filesystem::exists(installPath + "/assets/extractor")) { Extractor::ShowErrorBox("Extractor assets not found", "Unable to regenerate. Missing assets/extractor folder needed to generate OTR file.\n\nExiting..."); @@ -979,17 +1002,17 @@ void DetectOTRVersion(std::string fileName, bool isMQ) { } Extractor extract; - if (!extract.Run(LUS::Context::GetAppDirectoryPath(appShortName), isMQ ? RomSearchMode::MQ : RomSearchMode::Vanilla)) { + if (!extract.Run(Ship::Context::GetAppDirectoryPath(appShortName), isMQ ? RomSearchMode::MQ : RomSearchMode::Vanilla)) { Extractor::ShowErrorBox("Error", "An error occured, no OTR file was generated.\n\nExiting..."); exit(1); } - extract.CallZapd(installPath, LUS::Context::GetAppDirectoryPath(appShortName)); + extract.CallZapd(installPath, Ship::Context::GetAppDirectoryPath(appShortName)); } else { exit(1); } #elif defined(__SWITCH__) - LUS::Switch::PrintErrorMessageToScreen("\x1b[2;2HYou've launched the Ship with an old game OTR file." + Ship::Switch::PrintErrorMessageToScreen("\x1b[2;2HYou've launched the Ship with an old game OTR file." "\x1b[4;2HPlease regenerate a new game OTR and relaunch." "\x1b[6;2HPress the Home button to exit..."); #elif defined(__WIIU__) @@ -1017,9 +1040,9 @@ bool PathTestCleanup(FILE* tfile) { extern "C" void InitOTR() { #ifdef __SWITCH__ - LUS::Switch::Init(LUS::PreInitPhase); + Ship::Switch::Init(Ship::PreInitPhase); #elif defined(__WIIU__) - LUS::WiiU::Init(appShortName); + Ship::WiiU::Init(appShortName); #endif #ifdef _WIN32 @@ -1059,13 +1082,13 @@ extern "C" void InitOTR() { } #endif - CheckSoHOTRVersion(LUS::Context::GetPathRelativeToAppBundle("soh.otr")); + CheckSoHOTRVersion(Ship::Context::GetPathRelativeToAppBundle("soh.otr")); - if (!std::filesystem::exists(LUS::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName)) && - !std::filesystem::exists(LUS::Context::LocateFileAcrossAppDirs("oot.otr", appShortName))){ + if (!std::filesystem::exists(Ship::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName)) && + !std::filesystem::exists(Ship::Context::LocateFileAcrossAppDirs("oot.otr", appShortName))){ #if not defined(__SWITCH__) && not defined(__WIIU__) - std::string installPath = LUS::Context::GetAppBundlePath(); + std::string installPath = Ship::Context::GetAppBundlePath(); if (!std::filesystem::exists(installPath + "/assets/extractor")) { Extractor::ShowErrorBox("Extractor assets not found", "No OTR files found. Missing assets/extractor folder needed to generate OTR file.\n\nExiting..."); @@ -1075,26 +1098,26 @@ extern "C" void InitOTR() { bool generatedOtrIsMQ = false; if (Extractor::ShowYesNoBox("No OTR Files", "No OTR files found. Generate one now?") == IDYES) { Extractor extract; - if (!extract.Run(LUS::Context::GetAppDirectoryPath(appShortName))) { + if (!extract.Run(Ship::Context::GetAppDirectoryPath(appShortName))) { Extractor::ShowErrorBox("Error", "An error occured, no OTR file was generated.\n\nExiting..."); exit(1); } - extract.CallZapd(installPath, LUS::Context::GetAppDirectoryPath(appShortName)); + extract.CallZapd(installPath, Ship::Context::GetAppDirectoryPath(appShortName)); generatedOtrIsMQ = extract.IsMasterQuest(); } else { exit(1); } if (Extractor::ShowYesNoBox("Extraction Complete", "ROM Extracted. Extract another?") == IDYES) { Extractor extract; - if (!extract.Run(LUS::Context::GetAppDirectoryPath(appShortName), generatedOtrIsMQ ? RomSearchMode::Vanilla : RomSearchMode::MQ)) { + if (!extract.Run(Ship::Context::GetAppDirectoryPath(appShortName), generatedOtrIsMQ ? RomSearchMode::Vanilla : RomSearchMode::MQ)) { Extractor::ShowErrorBox("Error", "An error occured, an OTR file may have been generated by a different step.\n\nContinuing..."); } else { - extract.CallZapd(installPath, LUS::Context::GetAppDirectoryPath(appShortName)); + extract.CallZapd(installPath, Ship::Context::GetAppDirectoryPath(appShortName)); } } #elif defined(__SWITCH__) - LUS::Switch::PrintErrorMessageToScreen("\x1b[2;2HYou've launched the Ship without a game OTR file." + Ship::Switch::PrintErrorMessageToScreen("\x1b[2;2HYou've launched the Ship without a game OTR file." "\x1b[4;2HPlease generate a game OTR and relaunch." "\x1b[6;2HPress the Home button to exit..."); #elif defined(__WIIU__) @@ -1141,24 +1164,24 @@ extern "C" void InitOTR() { InitMods(); ActorDB::AddBuiltInCustomActors(); // #region SOH [Randomizer] TODO: Remove these and refactor spoiler file handling for randomizer - CVarClear("gRandomizerNewFileDropped"); - CVarClear("gRandomizerDroppedFile"); + CVarClear(CVAR_GENERAL("RandomizerNewFileDropped")); + CVarClear(CVAR_GENERAL("RandomizerDroppedFile")); // #endregion GameInteractor::Instance->RegisterGameHook(SoH_ProcessDroppedFiles); time_t now = time(NULL); tm *tm_now = localtime(&now); if (tm_now->tm_mon == 11 && tm_now->tm_mday >= 24 && tm_now->tm_mday <= 25) { - CVarRegisterInteger("gLetItSnow", 1); + CVarRegisterInteger(CVAR_GENERAL("LetItSnow"), 1); } else { - CVarClear("gLetItSnow"); + CVarClear(CVAR_GENERAL("LetItSnow")); } srand(now); #ifdef ENABLE_REMOTE_CONTROL SDLNet_Init(); - if (CVarGetInteger("gRemote.Enabled", 0)) { - switch (CVarGetInteger("gRemote.Scheme", GI_SCHEME_SAIL)) { + if (CVarGetInteger(CVAR_REMOTE("Enabled"), 0)) { + switch (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL)) { case GI_SCHEME_SAIL: GameInteractorSail::Instance->Enable(); break; @@ -1169,9 +1192,9 @@ extern "C" void InitOTR() { } #endif - std::shared_ptr conf = OTRGlobals::Instance->context->GetConfig(); - conf->RegisterConfigVersionUpdater(std::make_shared()); - conf->RegisterConfigVersionUpdater(std::make_shared()); + std::shared_ptr conf = OTRGlobals::Instance->context->GetConfig(); + conf->RegisterConfigVersionUpdater(std::make_shared()); + conf->RegisterConfigVersionUpdater(std::make_shared()); conf->RunVersionUpdates(); } @@ -1183,8 +1206,8 @@ extern "C" void DeinitOTR() { SaveManager_ThreadPoolWait(); OTRAudio_Exit(); #ifdef ENABLE_REMOTE_CONTROL - if (CVarGetInteger("gRemote.Enabled", 0)) { - switch (CVarGetInteger("gRemote.Scheme", GI_SCHEME_SAIL)) { + if (CVarGetInteger(CVAR_REMOTE("Enabled"), 0)) { + switch (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL)) { case GI_SCHEME_SAIL: GameInteractorSail::Instance->Disable(); break; @@ -1249,14 +1272,14 @@ extern bool ToggleAltAssetsAtEndOfFrame; extern "C" void Graph_StartFrame() { #ifndef __WIIU__ - using LUS::KbScancode; + using Ship::KbScancode; int32_t dwScancode = OTRGlobals::Instance->context->GetWindow()->GetLastScancode(); OTRGlobals::Instance->context->GetWindow()->SetLastScancode(-1); switch (dwScancode) { case KbScancode::LUS_KB_F5: { - if (CVarGetInteger("gSaveStatesEnabled", 0) == 0) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()-> + if (CVarGetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0) == 0) { + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()-> TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu."); return; } @@ -1277,8 +1300,8 @@ extern "C" void Graph_StartFrame() { break; } case KbScancode::LUS_KB_F6: { - if (CVarGetInteger("gSaveStatesEnabled", 0) == 0) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()-> + if (CVarGetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0) == 0) { + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()-> TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu."); return; } @@ -1292,8 +1315,8 @@ extern "C" void Graph_StartFrame() { break; } case KbScancode::LUS_KB_F7: { - if (CVarGetInteger("gSaveStatesEnabled", 0) == 0) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()-> + if (CVarGetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0) == 0) { + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()-> TextDrawNotification(6.0f, true, "Save states not enabled. Check Cheats Menu."); return; } @@ -1323,7 +1346,7 @@ extern "C" void Graph_StartFrame() { #if defined(_WIN32) || defined(__APPLE__) case KbScancode::LUS_KB_F9: { // Toggle TTS - CVarSetInteger("gA11yTTS", !CVarGetInteger("gA11yTTS", 0)); + CVarSetInteger(CVAR_SETTING("A11yTTS"), !CVarGetInteger(CVAR_SETTING("A11yTTS"), 0)); break; } #endif @@ -1334,13 +1357,13 @@ extern "C" void Graph_StartFrame() { } #endif - if (CVarGetInteger("gNewFileDropped", 0)) { - std::string filePath = SohUtils::Sanitize(CVarGetString("gDroppedFile", "")); + if (CVarGetInteger(CVAR_NEW_FILE_DROPPED, 0)) { + std::string filePath = SohUtils::Sanitize(CVarGetString(CVAR_DROPPED_FILE, "")); if (!filePath.empty()) { GameInteractor::Instance->ExecuteHooks(filePath); } - CVarClear("gNewFileDropped"); - CVarClear("gDroppedFile"); + CVarClear(CVAR_NEW_FILE_DROPPED); + CVarClear(CVAR_DROPPED_FILE); } OTRGlobals::Instance->context->GetWindow()->StartFrame(); @@ -1393,7 +1416,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) { OTRGlobals::Instance->context->GetWindow()->SetTargetFps(fps); - int threshold = CVarGetInteger("gExtraLatencyThreshold", 80); + int threshold = CVarGetInteger(CVAR_SETTING("ExtraLatencyThreshold"), 80); OTRGlobals::Instance->context->GetWindow()->SetMaximumFrameLatency(threshold > 0 && target_fps >= threshold ? 2 : 1); RunCommands(commands, mtx_replacements); @@ -1412,7 +1435,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) { ToggleAltAssetsAtEndOfFrame = false; // Actually update the CVar now before runing the alt asset update listeners - CVarSetInteger("gAltAssets", !CVarGetInteger("gAltAssets", 0)); + CVarSetInteger(CVAR_ALT_ASSETS, !CVarGetInteger(CVAR_ALT_ASSETS, 0)); gfx_texture_cache_clear(); SOH::SkeletonPatcher::UpdateSkeletons(); GameInteractor::Instance->ExecuteHooks(); @@ -1435,15 +1458,15 @@ extern "C" uint16_t OTRGetPixelDepth(float x, float y) { } extern "C" uint32_t ResourceMgr_GetNumGameVersions() { - return LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size(); + return Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size(); } extern "C" uint32_t ResourceMgr_GetGameVersion(int index) { - return LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; + return Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; } extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) { - uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; + uint32_t version = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; switch (version) { case OOT_NTSC_US_10: @@ -1466,7 +1489,7 @@ extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) { } extern "C" uint32_t ResourceMgr_GetGameRegion(int index) { - uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; + uint32_t version = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; switch (version) { case OOT_NTSC_US_10: @@ -1490,7 +1513,7 @@ extern "C" uint32_t ResourceMgr_GetGameRegion(int index) { uint32_t IsSceneMasterQuest(s16 sceneNum) { uint32_t value = 0; - uint8_t mqMode = CVarGetInteger("gBetterDebugWarpScreenMQMode", WARP_MODE_OVERRIDE_OFF); + uint8_t mqMode = CVarGetInteger(CVAR_GENERAL("BetterDebugWarpScreenMQMode"), WARP_MODE_OVERRIDE_OFF); if (mqMode == WARP_MODE_OVERRIDE_MQ_AS_VANILLA) { return 1; } else if (mqMode == WARP_MODE_OVERRIDE_VANILLA_AS_MQ) { @@ -1536,10 +1559,10 @@ extern "C" uint32_t ResourceMgr_IsGameMasterQuest() { } extern "C" void ResourceMgr_LoadDirectory(const char* resName) { - LUS::Context::GetInstance()->GetResourceManager()->LoadDirectory(resName); + Ship::Context::GetInstance()->GetResourceManager()->LoadDirectory(resName); } extern "C" void ResourceMgr_DirtyDirectory(const char* resName) { - LUS::Context::GetInstance()->GetResourceManager()->DirtyDirectory(resName); + Ship::Context::GetInstance()->GetResourceManager()->DirtyDirectory(resName); } extern "C" void ResourceMgr_UnloadResource(const char* resName) { @@ -1547,13 +1570,13 @@ extern "C" void ResourceMgr_UnloadResource(const char* resName) { if (path.substr(0, 7) == "__OTR__") { path = path.substr(7); } - auto res = LUS::Context::GetInstance()->GetResourceManager()->UnloadResource(path); + auto res = Ship::Context::GetInstance()->GetResourceManager()->UnloadResource(path); } // OTRTODO: There is probably a more elegant way to go about this... // Kenix: This is definitely leaking memory when it's called. extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) { - auto lst = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(searchMask); + auto lst = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(searchMask); char** result = (char**)malloc(lst->size() * sizeof(char*)); for (size_t i = 0; i < lst->size(); i++) { @@ -1592,12 +1615,12 @@ extern "C" uint8_t ResourceMgr_FileAltExists(const char* filePath) { // Unloads a resource if an alternate version exists when alt assets are enabled // The resource is only removed from the internal cache to prevent it from used in the next resource lookup extern "C" void ResourceMgr_UnloadOriginalWhenAltExists(const char* resName) { - if (CVarGetInteger("gAltAssets", 0) && ResourceMgr_FileAltExists((char*) resName)) { + if (CVarGetInteger(CVAR_ALT_ASSETS, 0) && ResourceMgr_FileAltExists((char*) resName)) { ResourceMgr_UnloadResource((char*) resName); } } -std::shared_ptr GetResourceByNameHandlingMQ(const char* path) { +std::shared_ptr GetResourceByNameHandlingMQ(const char* path) { std::string Path = path; if (ResourceMgr_IsGameMasterQuest()) { size_t pos = 0; @@ -1605,7 +1628,7 @@ std::shared_ptr GetResourceByNameHandlingMQ(const char* path) { Path.replace(pos, 7, "/mq/"); } } - return LUS::Context::GetInstance()->GetResourceManager()->LoadResource(Path.c_str()); + return Ship::Context::GetInstance()->GetResourceManager()->LoadResource(Path.c_str()); } extern "C" char* GetResourceDataByNameHandlingMQ(const char* path) { @@ -1738,7 +1761,7 @@ std::unordered_map> origi // instead (When that is available). Index can be found using the commented out section below. extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction) { auto res = std::static_pointer_cast( - LUS::Context::GetInstance()->GetResourceManager()->LoadResource(path)); + Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path)); // Leaving this here for people attempting to find the correct Dlist index to patch /*if (strcmp("__OTR__objects/object_gi_longsword/gGiBiggoronSwordDL", path) == 0) { @@ -1777,7 +1800,7 @@ extern "C" void ResourceMgr_PatchGfxByName(const char* path, const char* patchNa extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const char* patchName, int destinationIndex, int sourceIndex) { auto res = std::static_pointer_cast( - LUS::Context::GetInstance()->GetResourceManager()->LoadResource(path)); + Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path)); // Do not patch custom assets as they most likely do not have the same instructions as authentic assets if (res->GetInitData()->IsCustom) { @@ -1800,7 +1823,7 @@ extern "C" void ResourceMgr_PatchGfxCopyCommandByName(const char* path, const ch extern "C" void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName) { if (originalGfx.contains(path) && originalGfx[path].contains(patchName)) { auto res = std::static_pointer_cast( - LUS::Context::GetInstance()->GetResourceManager()->LoadResource(path)); + Ship::Context::GetInstance()->GetResourceManager()->LoadResource(path)); Gfx* gfx = (Gfx*)&res->Instructions[originalGfx[path][patchName].index]; *gfx = originalGfx[path][patchName].instruction; @@ -1860,7 +1883,7 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) { ExtensionEntry entry = ExtensionCache[path]; - auto sampleRaw = LUS::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path); + auto sampleRaw = Ship::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path); uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get(); uint8_t* strem2 = (uint8_t*)strem; @@ -1948,10 +1971,10 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel pathStr = pathStr.substr(sOtr.length()); } - bool isAlt = CVarGetInteger("gAltAssets", 0); + bool isAlt = CVarGetInteger(CVAR_ALT_ASSETS, 0); if (isAlt) { - pathStr = LUS::IResource::gAltAssetPrefix + pathStr; + pathStr = Ship::IResource::gAltAssetPrefix + pathStr; } SkeletonHeader* skelHeader = (SkeletonHeader*) ResourceGetDataByName(pathStr.c_str()); @@ -1985,8 +2008,8 @@ extern "C" s32* ResourceMgr_LoadCSByName(const char* path) { return (s32*)GetResourceDataByNameHandlingMQ(path); } -std::filesystem::path GetSaveFile(std::shared_ptr Conf) { - const std::string fileName = Conf->GetString("Game.SaveName", LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav")); +std::filesystem::path GetSaveFile(std::shared_ptr Conf) { + const std::string fileName = Conf->GetString("Game.SaveName", Ship::Context::GetPathRelativeToAppDirectory("oot_save.sav")); std::filesystem::path saveFile = std::filesystem::absolute(fileName); if (!exists(saveFile.parent_path())) { @@ -1997,13 +2020,13 @@ std::filesystem::path GetSaveFile(std::shared_ptr Conf) { } std::filesystem::path GetSaveFile() { - const std::shared_ptr pConf = OTRGlobals::Instance->context->GetConfig(); + const std::shared_ptr pConf = OTRGlobals::Instance->context->GetConfig(); return GetSaveFile(pConf); } void OTRGlobals::CheckSaveFile(size_t sramSize) const { - const std::shared_ptr pConf = Instance->context->GetConfig(); + const std::shared_ptr pConf = Instance->context->GetConfig(); std::filesystem::path savePath = GetSaveFile(pConf); std::fstream saveFile(savePath, std::fstream::in | std::fstream::out | std::fstream::binary); @@ -2125,26 +2148,26 @@ extern "C" uint32_t OTRGetCurrentHeight() { } Color_RGB8 GetColorForControllerLED() { - auto brightness = CVarGetFloat("gLedBrightness", 1.0f) / 1.0f; + auto brightness = CVarGetFloat(CVAR_SETTING("LEDBrightness"), 1.0f) / 1.0f; Color_RGB8 color = { 0, 0, 0 }; if (brightness > 0.0f) { - LEDColorSource source = static_cast(CVarGetInteger("gLedColorSource", LED_SOURCE_TUNIC_ORIGINAL)); - bool criticalOverride = CVarGetInteger("gLedCriticalOverride", 1); + LEDColorSource source = static_cast(CVarGetInteger(CVAR_SETTING("LEDColorSource"), LED_SOURCE_TUNIC_ORIGINAL)); + bool criticalOverride = CVarGetInteger(CVAR_SETTING("LEDCriticalOverride"), 1); if (gPlayState && (source == LED_SOURCE_TUNIC_ORIGINAL || source == LED_SOURCE_TUNIC_COSMETICS)) { switch (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC)) { case EQUIP_VALUE_TUNIC_KOKIRI: color = source == LED_SOURCE_TUNIC_COSMETICS - ? CVarGetColor24("gCosmetics.Link_KokiriTunic.Value", kokiriColor) + ? CVarGetColor24(CVAR_COSMETIC("Link.KokiriTunic.Value"), kokiriColor) : kokiriColor; break; case EQUIP_VALUE_TUNIC_GORON: color = source == LED_SOURCE_TUNIC_COSMETICS - ? CVarGetColor24("gCosmetics.Link_GoronTunic.Value", goronColor) + ? CVarGetColor24(CVAR_COSMETIC("Link.GoronTunic.Value"), goronColor) : goronColor; break; case EQUIP_VALUE_TUNIC_ZORA: color = source == LED_SOURCE_TUNIC_COSMETICS - ? CVarGetColor24("gCosmetics.Link_ZoraTunic.Value", zoraColor) + ? CVarGetColor24(CVAR_COSMETIC("Link.ZoraTunic.Value"), zoraColor) : zoraColor; break; } @@ -2156,16 +2179,16 @@ Color_RGB8 GetColorForControllerLED() { switch (category) { case ACTORCAT_PLAYER: if (source == LED_SOURCE_NAVI_COSMETICS && - CVarGetInteger("gCosmetics.Navi_IdlePrimary.Changed", 0)) { - color = CVarGetColor24("gCosmetics.Navi_IdlePrimary.Value", defaultIdleColor.inner); + CVarGetInteger(CVAR_COSMETIC("Navi.IdlePrimary.Changed"), 0)) { + color = CVarGetColor24(CVAR_COSMETIC("Navi.IdlePrimary.Value"), defaultIdleColor.inner); break; } color = LEDColorDefaultNaviColorList[category].inner; break; case ACTORCAT_NPC: if (source == LED_SOURCE_NAVI_COSMETICS && - CVarGetInteger("gCosmetics.Navi_NPCPrimary.Changed", 0)) { - color = CVarGetColor24("gCosmetics.Navi_NPCPrimary.Value", defaultNPCColor.inner); + CVarGetInteger(CVAR_COSMETIC("Navi.NPCPrimary.Changed"), 0)) { + color = CVarGetColor24(CVAR_COSMETIC("Navi.NPCPrimary.Value"), defaultNPCColor.inner); break; } color = LEDColorDefaultNaviColorList[category].inner; @@ -2173,30 +2196,30 @@ Color_RGB8 GetColorForControllerLED() { case ACTORCAT_ENEMY: case ACTORCAT_BOSS: if (source == LED_SOURCE_NAVI_COSMETICS && - CVarGetInteger("gCosmetics.Navi_EnemyPrimary.Changed", 0)) { - color = CVarGetColor24("gCosmetics.Navi_EnemyPrimary.Value", defaultEnemyColor.inner); + CVarGetInteger(CVAR_COSMETIC("Navi.EnemyPrimary.Changed"), 0)) { + color = CVarGetColor24(CVAR_COSMETIC("Navi.EnemyPrimary.Value"), defaultEnemyColor.inner); break; } color = LEDColorDefaultNaviColorList[category].inner; break; default: if (source == LED_SOURCE_NAVI_COSMETICS && - CVarGetInteger("gCosmetics.Navi_PropsPrimary.Changed", 0)) { - color = CVarGetColor24("gCosmetics.Navi_PropsPrimary.Value", defaultPropsColor.inner); + CVarGetInteger(CVAR_COSMETIC("Navi.PropsPrimary.Changed"), 0)) { + color = CVarGetColor24(CVAR_COSMETIC("Navi.PropsPrimary.Value"), defaultPropsColor.inner); break; } color = LEDColorDefaultNaviColorList[category].inner; } } else { // No target actor. - if (source == LED_SOURCE_NAVI_COSMETICS && CVarGetInteger("gCosmetics.Navi_IdlePrimary.Changed", 0)) { - color = CVarGetColor24("gCosmetics.Navi_IdlePrimary.Value", defaultIdleColor.inner); + if (source == LED_SOURCE_NAVI_COSMETICS && CVarGetInteger(CVAR_COSMETIC("Navi.IdlePrimary.Changed"), 0)) { + color = CVarGetColor24(CVAR_COSMETIC("Navi.IdlePrimary.Value"), defaultIdleColor.inner); } else { color = LEDColorDefaultNaviColorList[ACTORCAT_PLAYER].inner; } } } if (source == LED_SOURCE_CUSTOM) { - color = CVarGetColor24("gLedPort1Color", { 255, 255, 255 }); + color = CVarGetColor24(CVAR_SETTING("LEDPort1Color"), { 255, 255, 255 }); } if (gPlayState && (criticalOverride || source == LED_SOURCE_HEALTH)) { if (HealthMeter_IsCritical()) { @@ -2220,19 +2243,19 @@ Color_RGB8 GetColorForControllerLED() { extern "C" void OTRControllerCallback(uint8_t rumble) { // We call this every tick, SDL accounts for this use and prevents driver spam // https://github.com/libsdl-org/SDL/blob/f17058b562c8a1090c0c996b42982721ace90903/src/joystick/SDL_joystick.c#L1114-L1144 - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetLED()->SetLEDColor(GetColorForControllerLED()); + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetLED()->SetLEDColor(GetColorForControllerLED()); static std::shared_ptr controllerConfigWindow = nullptr; if (controllerConfigWindow == nullptr) { - controllerConfigWindow = std::dynamic_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Input Editor")); + controllerConfigWindow = std::dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Input Editor")); } else if (controllerConfigWindow->TestingRumble()) { return; } if (rumble) { - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StartRumble(); + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StartRumble(); } else { - LUS::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StopRumble(); + Ship::Context::GetInstance()->GetControlDeck()->GetControllerByPort(0)->GetRumble()->StopRumble(); } } @@ -2272,7 +2295,7 @@ extern "C" void AudioPlayer_Play(const uint8_t* buf, uint32_t len) { } extern "C" int Controller_ShouldRumble(size_t slot) { - for (auto [id, mapping] : LUS::Context::GetInstance() + for (auto [id, mapping] : Ship::Context::GetInstance() ->GetControlDeck() ->GetControllerByPort(static_cast(slot)) ->GetRumble() @@ -2339,7 +2362,7 @@ extern "C" int GetEquipNowMessage(char* buffer, char* src, const int maxBufferSi } extern "C" void Randomizer_ParseSpoiler(const char* fileLoc) { - OTRGlobals::Instance->gRandoContext->ParseSpoiler(fileLoc, CVarGetInteger("gPlandoMode", 0)); + OTRGlobals::Instance->gRandoContext->ParseSpoiler(fileLoc, CVarGetInteger(CVAR_GENERAL("PlandoMode"), 0)); } extern "C" void Randomizer_LoadHintMessages() { @@ -2479,7 +2502,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { if (player->getItemEntry.getItemId == RG_ICE_TRAP) { u16 iceTrapTextId = Random(0, NUM_ICE_TRAP_MESSAGES); messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, iceTrapTextId); - if (CVarGetInteger("gLetItSnow", 0)) { + if (CVarGetInteger(CVAR_GENERAL("LetItSnow"), 0)) { messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::IceTrapRandoMessageTableID, NUM_ICE_TRAP_MESSAGES + 1); } } else if (player->getItemEntry.getItemId == RG_TRIFORCE_PIECE) { @@ -2579,12 +2602,12 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { RandomizerInf randoInf = (RandomizerInf)((textId - (TEXT_SHOP_ITEM_RANDOM + NUM_SHOP_ITEMS)) + RAND_INF_SHOP_ITEMS_KF_SHOP_ITEM_1); messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(randoInf, TEXT_SHOP_ITEM_RANDOM_CONFIRM); } - } else if (CVarGetInteger("gRandomizeRupeeNames", 1) && + } else if (CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("RandomizeRupeeNames"), 1) && (textId == TEXT_BLUE_RUPEE || textId == TEXT_RED_RUPEE || textId == TEXT_PURPLE_RUPEE || textId == TEXT_HUGE_RUPEE)) { messageEntry = Randomizer::GetRupeeMessage(textId); // In rando, replace Navi's general overworld hints with rando-related gameplay tips - } else if (CVarGetInteger("gRandoRelevantNavi", 1) && textId >= TEXT_NAVI_DEKU_TREE_SUMMONS && textId <= TEXT_NAVI_TRY_TO_KEEP_MOVING) { + } else if (CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("RandoRelevantNavi"), 1) && textId >= TEXT_NAVI_DEKU_TREE_SUMMONS && textId <= TEXT_NAVI_TRY_TO_KEEP_MOVING) { u16 naviTextId = Random(0, NUM_NAVI_MESSAGES); messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::NaviRandoMessageTableID, naviTextId); } @@ -2715,7 +2738,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { } } if (textId == TEXT_GS_NO_FREEZE || textId == TEXT_GS_FREEZE) { - if (CVarGetInteger("gInjectItemCounts", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("InjectItemCounts"), 0) != 0) { // The freeze text cannot be manually dismissed and must be auto-dismissed. // This is fine and even wanted when skull tokens are not shuffled, but when // when they are shuffled we don't want to be able to manually dismiss the box. @@ -2723,7 +2746,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { // animation until the text box auto-dismisses. // RANDOTODO: Implement a way to determine if an item came from a skulltula and // inject the auto-dismiss control code if it did. - if (CVarGetInteger("gSkulltulaFreeze", 0) != 0 && + if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && !(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF)) { textId = TEXT_GS_NO_FREEZE; } else { @@ -2736,18 +2759,18 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { messageEntry.Replace("[[gsCount]]", std::to_string(gsCount)); } } - if (textId == TEXT_HEART_CONTAINER && CVarGetInteger("gInjectItemCounts", 0)) { + if (textId == TEXT_HEART_CONTAINER && CVarGetInteger(CVAR_ENHANCEMENT("InjectItemCounts"), 0)) { messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_CONTAINER); messageEntry.Replace("[[heartContainerCount]]", std::to_string(gSaveContext.sohStats.heartContainers + 1)); } - if (textId == TEXT_HEART_PIECE && CVarGetInteger("gInjectItemCounts", 0)) { + if (textId == TEXT_HEART_PIECE && CVarGetInteger(CVAR_ENHANCEMENT("InjectItemCounts"), 0)) { messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_HEART_PIECE); messageEntry.Replace("[[heartPieceCount]]", std::to_string(gSaveContext.sohStats.heartPieces + 1)); } - if (textId == TEXT_MARKET_GUARD_NIGHT && CVarGetInteger("gMarketSneak", 0) && play->sceneNum == SCENE_MARKET_ENTRANCE_NIGHT) { + if (textId == TEXT_MARKET_GUARD_NIGHT && CVarGetInteger(CVAR_ENHANCEMENT("MarketSneak"), 0) && play->sceneNum == SCENE_MARKET_ENTRANCE_NIGHT) { messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_MARKET_GUARD_NIGHT); } - if (textId == TEXT_FISHERMAN_LEAVE && CVarGetInteger("gQuitFishingAtDoor", 0)) { + if (textId == TEXT_FISHERMAN_LEAVE && CVarGetInteger(CVAR_ENHANCEMENT("QuitFishingAtDoor"), 0)) { messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, TEXT_FISHERMAN_LEAVE); } font->charTexBuf[0] = (messageEntry.GetTextBoxType() << 4) | messageEntry.GetTextBoxPosition(); @@ -2767,12 +2790,12 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { } extern "C" void Overlay_DisplayText(float duration, const char* text) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text); + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text); } extern "C" void Overlay_DisplayText_Seconds(int seconds, const char* text) { float duration = seconds * OTRGlobals::Instance->GetInterpolationFPS() * 0.05; - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text); + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->TextDrawNotification(duration, true, text); } extern "C" void Entrance_ClearEntranceTrackingData(void) { @@ -2825,8 +2848,8 @@ void SoH_ProcessDroppedFiles(std::string filePath) { // #region SOH [Randomizer] TODO: Refactor spoiler file handling for randomizer if (configJson.contains("version") && configJson.contains("finalSeed")) { - CVarSetString("gRandomizerDroppedFile", filePath.c_str()); - CVarSetInteger("gRandomizerNewFileDropped", 1); + CVarSetString(CVAR_GENERAL("RandomizerDroppedFile"), filePath.c_str()); + CVarSetInteger(CVAR_GENERAL("RandomizerNewFileDropped"), 1); return; } // #endregion @@ -2858,14 +2881,14 @@ void SoH_ProcessDroppedFiles(std::string filePath) { } } - auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui(); + auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui(); gui->GetGuiWindow("Console")->Hide(); gui->GetGuiWindow("Actor Viewer")->Hide(); gui->GetGuiWindow("Collision Viewer")->Hide(); gui->GetGuiWindow("Save Editor")->Hide(); gui->GetGuiWindow("Display List Viewer")->Hide(); gui->GetGuiWindow("Stats")->Hide(); - std::dynamic_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->ClearBindings(); + std::dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->ClearBindings(); gui->SaveConsoleVariablesOnNextTick(); @@ -2873,12 +2896,12 @@ void SoH_ProcessDroppedFiles(std::string filePath) { gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Configuration Loaded. Hash: %d", finalHash); } catch (std::exception& e) { SPDLOG_ERROR("Failed to load config file: {}", e.what()); - auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui(); + auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui(); gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Failed to load config file"); return; } catch (...) { SPDLOG_ERROR("Failed to load config file"); - auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui(); + auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui(); gui->GetGameOverlay()->TextDrawNotification(30.0f, true, "Failed to load config file"); return; } diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 00b643bcb..2e566bbd2 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -38,7 +38,7 @@ class OTRGlobals public: static OTRGlobals* Instance; - std::shared_ptr context; + std::shared_ptr context; std::shared_ptr gSaveStateMgr; std::shared_ptr gRandomizer; std::shared_ptr gRandoContext; @@ -67,6 +67,22 @@ private: uint32_t IsGameMasterQuest(); #endif +#define CVAR_RANDOMIZER_ENHANCEMENT(var) CVAR_PREFIX_RANDOMIZER_ENHANCEMENT "." var +#define CVAR_RANDOMIZER_SETTING(var) CVAR_PREFIX_RANDOMIZER_SETTING "." var +#define CVAR_COSMETIC(var) CVAR_PREFIX_COSMETIC "." var +#define CVAR_AUDIO(var) CVAR_PREFIX_AUDIO "." var +#define CVAR_CHEAT(var) CVAR_PREFIX_CHEAT "." var +#define CVAR_ENHANCEMENT(var) CVAR_PREFIX_ENHANCEMENT "." var +#define CVAR_SETTING(var) CVAR_PREFIX_SETTING "." var +#define CVAR_WINDOW(var) CVAR_PREFIX_WINDOW "." var +#define CVAR_TRACKER(var) CVAR_PREFIX_TRACKER "." var +#define CVAR_TRACKER_ITEM(var) CVAR_TRACKER(".ItemTracker." var) +#define CVAR_TRACKER_CHECK(var) CVAR_TRACKER(".CheckTracker." var) +#define CVAR_TRACKER_ENTRANCE(var) CVAR_TRACKER(".EntranceTracker." var) +#define CVAR_DEVELOPER_TOOLS(var) CVAR_PREFIX_DEVELOPER_TOOLS "." var +#define CVAR_GENERAL(var) CVAR_PREFIX_GENERAL "." var +#define CVAR_REMOTE(var) CVAR_PREFIX_REMOTE "." var + #ifndef __cplusplus void InitOTR(void); void DeinitOTR(void); diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index c61c08100..0aaf32e7c 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -50,12 +50,12 @@ void SaveManager::ReadSaveFile(std::filesystem::path savePath, uintptr_t addr, v } std::filesystem::path SaveManager::GetFileName(int fileNum) { - const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save")); + const std::filesystem::path sSavePath(Ship::Context::GetPathRelativeToAppDirectory("Save")); return sSavePath / ("file" + std::to_string(fileNum + 1) + ".sav"); } std::filesystem::path SaveManager::GetFileTempName(int fileNum) { - const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save")); + const std::filesystem::path sSavePath(Ship::Context::GetPathRelativeToAppDirectory("Save")); return sSavePath / ("file" + std::to_string(fileNum + 1) + ".temp"); } @@ -445,7 +445,7 @@ void SaveManager::LoadRandomizerVersion3() { SaveManager::Instance->LoadArray("hintLocations", RH_MAX, [&](size_t i) { auto hint = RandomizerHint(i); - nlohmann::ordered_json json; + nlohmann::json json; SaveManager::Instance->LoadData("", json); randoContext->AddHint(hint, Rando::Hint(hint, json)); }); @@ -615,10 +615,10 @@ void SaveManager::SaveRandomizer(SaveContext* saveContext, int sectionID, bool f void SaveManager::Init() { // Wait on saves that snuck through the Wait in OnExitGame ThreadPoolWait(); - const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save")); + const std::filesystem::path sSavePath(Ship::Context::GetPathRelativeToAppDirectory("Save")); const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav"); - auto sOldSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.sav"); - auto sOldBackupSavePath = LUS::Context::GetPathRelativeToAppDirectory("oot_save.bak"); + auto sOldSavePath = Ship::Context::GetPathRelativeToAppDirectory("oot_save.sav"); + auto sOldBackupSavePath = Ship::Context::GetPathRelativeToAppDirectory("oot_save.bak"); // If the save directory does not exist, create it if (!std::filesystem::exists(sSavePath)) { @@ -877,10 +877,10 @@ void SaveManager::InitFileDebug() { //don't apply gDebugSaveFileMode on the title screen if (gSaveContext.fileNum != 0xFF) { - if (CVarGetInteger("gDebugSaveFileMode", 1) == 2) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugSaveFileMode"), 1) == 2) { InitFileMaxed(); return; - } else if (CVarGetInteger("gDebugSaveFileMode", 1) == 0) { + } else if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugSaveFileMode"), 1) == 0) { return; } } @@ -1266,7 +1266,7 @@ void SaveManager::SaveGlobal() { globalBlock["zTargetSetting"] = gSaveContext.zTargetSetting; globalBlock["language"] = gSaveContext.language; - const std::filesystem::path sSavePath(LUS::Context::GetPathRelativeToAppDirectory("Save")); + const std::filesystem::path sSavePath(Ship::Context::GetPathRelativeToAppDirectory("Save")); const std::filesystem::path sGlobalPath = sSavePath / std::string("global.sav"); std::ofstream output(sGlobalPath); @@ -1325,7 +1325,7 @@ void SaveManager::LoadFile(int fileNum) { GameInteractor::Instance->ExecuteHooks(fileNum); } catch (const std::exception& e) { input.close(); - std::filesystem::path newFile(LUS::Context::GetPathRelativeToAppDirectory("Save") + ("/file" + std::to_string(fileNum + 1) + "-" + std::to_string(GetUnixTimestamp()) + ".bak")); + std::filesystem::path newFile(Ship::Context::GetPathRelativeToAppDirectory("Save") + ("/file" + std::to_string(fileNum + 1) + "-" + std::to_string(GetUnixTimestamp()) + ".bak")); #if defined(__SWITCH__) || defined(__WIIU__) copy_file(fileName.c_str(), newFile.c_str()); #else @@ -1415,7 +1415,7 @@ int SaveManager::GetSaveSectionID(std::string& sectionName) { void SaveManager::CreateDefaultGlobal() { gSaveContext.audioSetting = 0; gSaveContext.zTargetSetting = 0; - gSaveContext.language = CVarGetInteger("gLanguages", LANGUAGE_ENG); + gSaveContext.language = CVarGetInteger(CVAR_SETTING("Languages"), LANGUAGE_ENG); SaveGlobal(); } @@ -2795,7 +2795,7 @@ void SaveManager::ConvertFromUnversioned() { gSaveContext.zTargetSetting = data[SRAM_HEADER_ZTARGET] & 1; gSaveContext.language = data[SRAM_HEADER_LANGUAGE]; if (gSaveContext.language >= LANGUAGE_MAX) { - gSaveContext.language = CVarGetInteger("gLanguages", LANGUAGE_ENG); + gSaveContext.language = CVarGetInteger(CVAR_SETTING("Languages"), LANGUAGE_ENG); } SaveGlobal(); diff --git a/soh/soh/SohGui.cpp b/soh/soh/SohGui.cpp index 4bfdc10b5..7fde4f351 100644 --- a/soh/soh/SohGui.cpp +++ b/soh/soh/SohGui.cpp @@ -11,8 +11,8 @@ #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif -#include -#include +#include +#include #include #include @@ -112,9 +112,9 @@ namespace SohGui { std::shared_ptr mSohMenuBar; - std::shared_ptr mConsoleWindow; - std::shared_ptr mStatsWindow; - std::shared_ptr mInputEditorWindow; + std::shared_ptr mConsoleWindow; + std::shared_ptr mStatsWindow; + std::shared_ptr mInputEditorWindow; std::shared_ptr mAudioEditorWindow; std::shared_ptr mInputViewer; @@ -137,10 +137,10 @@ namespace SohGui { std::shared_ptr mModalWindow; void SetupGuiElements() { - auto gui = LUS::Context::GetInstance()->GetWindow()->GetGui(); + auto gui = Ship::Context::GetInstance()->GetWindow()->GetGui(); - mSohMenuBar = std::make_shared("gOpenMenuBar", CVarGetInteger("gOpenMenuBar", 0)); - gui->SetMenuBar(std::reinterpret_pointer_cast(mSohMenuBar)); + mSohMenuBar = std::make_shared(CVAR_MENU_BAR_OPEN, CVarGetInteger(CVAR_MENU_BAR_OPEN, 0)); + gui->SetMenuBar(std::reinterpret_pointer_cast(mSohMenuBar)); if (gui->GetMenuBar() && !gui->GetMenuBar()->IsVisible()) { #if defined(__SWITCH__) || defined(__WIIU__) @@ -165,43 +165,43 @@ namespace SohGui { SPDLOG_ERROR("Could not find input editor window"); } - mAudioEditorWindow = std::make_shared("gAudioEditor.WindowOpen", "Audio Editor"); + mAudioEditorWindow = std::make_shared(CVAR_WINDOW("AudioEditor"), "Audio Editor"); gui->AddGuiWindow(mAudioEditorWindow); - mInputViewer = std::make_shared("gOpenWindows.InputViewer", "Input Viewer"); + mInputViewer = std::make_shared(CVAR_WINDOW("InputViewer"), "Input Viewer"); gui->AddGuiWindow(mInputViewer); - mInputViewerSettings = std::make_shared("gOpenWindows.InputViewerSettings", "Input Viewer Settings"); + mInputViewerSettings = std::make_shared(CVAR_WINDOW("InputViewerSettings"), "Input Viewer Settings"); gui->AddGuiWindow(mInputViewerSettings); - mCosmeticsEditorWindow = std::make_shared("gCosmeticsEditorEnabled", "Cosmetics Editor"); + mCosmeticsEditorWindow = std::make_shared(CVAR_WINDOW("CosmeticsEditor"), "Cosmetics Editor"); gui->AddGuiWindow(mCosmeticsEditorWindow); - mActorViewerWindow = std::make_shared("gActorViewerEnabled", "Actor Viewer"); + mActorViewerWindow = std::make_shared(CVAR_WINDOW("ActorViewer"), "Actor Viewer"); gui->AddGuiWindow(mActorViewerWindow); - mColViewerWindow = std::make_shared("gCollisionViewerEnabled", "Collision Viewer"); + mColViewerWindow = std::make_shared(CVAR_WINDOW("CollisionViewer"), "Collision Viewer"); gui->AddGuiWindow(mColViewerWindow); - mSaveEditorWindow = std::make_shared("gSaveEditorEnabled", "Save Editor"); + mSaveEditorWindow = std::make_shared(CVAR_WINDOW("SaveEditor"), "Save Editor"); gui->AddGuiWindow(mSaveEditorWindow); - mDLViewerWindow = std::make_shared("gDLViewerEnabled", "Display List Viewer"); + mDLViewerWindow = std::make_shared(CVAR_WINDOW("DLViewer"), "Display List Viewer"); gui->AddGuiWindow(mDLViewerWindow); - mValueViewerWindow = std::make_shared("gValueViewer.WindowOpen", "Value Viewer"); + mValueViewerWindow = std::make_shared(CVAR_WINDOW("ValueViewer"), "Value Viewer"); gui->AddGuiWindow(mValueViewerWindow); - mMessageViewerWindow = std::make_shared("gMessageViewerEnabled", "Message Viewer"); + mMessageViewerWindow = std::make_shared(CVAR_WINDOW("MessageViewer"), "Message Viewer"); gui->AddGuiWindow(mMessageViewerWindow); - mGameplayStatsWindow = std::make_shared("gGameplayStatsEnabled", "Gameplay Stats"); + mGameplayStatsWindow = std::make_shared(CVAR_WINDOW("GameplayStats"), "Gameplay Stats"); gui->AddGuiWindow(mGameplayStatsWindow); - mCheckTrackerWindow = std::make_shared("gCheckTrackerEnabled", "Check Tracker"); + mCheckTrackerWindow = std::make_shared(CVAR_WINDOW("CheckTracker"), "Check Tracker"); gui->AddGuiWindow(mCheckTrackerWindow); - mCheckTrackerSettingsWindow = std::make_shared("gCheckTrackerSettingsEnabled", "Check Tracker Settings"); + mCheckTrackerSettingsWindow = std::make_shared(CVAR_WINDOW("CheckTrackerSettings"), "Check Tracker Settings"); gui->AddGuiWindow(mCheckTrackerSettingsWindow); - mEntranceTrackerWindow = std::make_shared("gEntranceTrackerEnabled","Entrance Tracker"); + mEntranceTrackerWindow = std::make_shared(CVAR_WINDOW("EntranceTracker"),"Entrance Tracker"); gui->AddGuiWindow(mEntranceTrackerWindow); - mItemTrackerWindow = std::make_shared("gItemTrackerEnabled", "Item Tracker"); + mItemTrackerWindow = std::make_shared(CVAR_WINDOW("ItemTracker"), "Item Tracker"); gui->AddGuiWindow(mItemTrackerWindow); - mItemTrackerSettingsWindow = std::make_shared("gItemTrackerSettingsEnabled", "Item Tracker Settings"); + mItemTrackerSettingsWindow = std::make_shared(CVAR_WINDOW("ItemTrackerSettings"), "Item Tracker Settings"); gui->AddGuiWindow(mItemTrackerSettingsWindow); - mRandomizerSettingsWindow = std::make_shared("gRandomizerSettingsEnabled", "Randomizer Settings"); + mRandomizerSettingsWindow = std::make_shared(CVAR_WINDOW("RandomizerSettings"), "Randomizer Settings"); gui->AddGuiWindow(mRandomizerSettingsWindow); - mAdvancedResolutionSettingsWindow = std::make_shared("gAdvancedResolutionEditorEnabled", "Advanced Resolution Settings"); + mAdvancedResolutionSettingsWindow = std::make_shared(CVAR_WINDOW("AdvancedResolutionEditor"), "Advanced Resolution Settings"); gui->AddGuiWindow(mAdvancedResolutionSettingsWindow); - mModalWindow = std::make_shared("gOpenWindows.modalWindowEnabled", "Modal Window"); + mModalWindow = std::make_shared(CVAR_WINDOW("ModalWindow"), "Modal Window"); gui->AddGuiWindow(mModalWindow); mModalWindow->Show(); } diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 98de7a48c..7ac3e1e20 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -2,7 +2,7 @@ #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif -#include "ImGui/imgui.h" +#include #include "regex" #include "public/bridge/consolevariablebridge.h" #include @@ -42,14 +42,6 @@ extern bool isBetaQuestEnabled; extern "C" PlayState* gPlayState; -enum SeqPlayers { - /* 0 */ SEQ_BGM_MAIN, - /* 1 */ SEQ_FANFARE, - /* 2 */ SEQ_SFX, - /* 3 */ SEQ_BGM_SUB, - /* 4 */ SEQ_MAX -}; - std::string GetWindowButtonText(const char* text, bool menuOpen) { char buttonText[100] = ""; if (menuOpen) { @@ -116,11 +108,11 @@ namespace SohGui { void DrawMenuBarIcon() { static bool gameIconLoaded = false; if (!gameIconLoaded) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Game_Icon", "textures/icons/gIcon.png"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Game_Icon", "textures/icons/gIcon.png"); gameIconLoaded = true; } - if (LUS::Context::GetInstance()->GetWindow()->GetGui()->HasTextureByName("Game_Icon")) { + if (Ship::Context::GetInstance()->GetWindow()->GetGui()->HasTextureByName("Game_Icon")) { #ifdef __SWITCH__ ImVec2 iconSize = ImVec2(20.0f, 20.0f); float posScale = 1.0f; @@ -132,7 +124,7 @@ void DrawMenuBarIcon() { float posScale = 1.0f; #endif ImGui::SetCursorPos(ImVec2(5, 2.5f) * posScale); - ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon"), iconSize); + ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon"), iconSize); ImGui::SameLine(); ImGui::SetCursorPos(ImVec2(25, 0) * posScale); } @@ -147,12 +139,12 @@ void DrawShipMenu() { "[-]" #endif )) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetMenuBar()->ToggleVisibility(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetMenuBar()->ToggleVisibility(); } UIWidgets::Spacer(0); #if !defined(__SWITCH__) && !defined(__WIIU__) if (ImGui::MenuItem("Toggle Fullscreen", "F11")) { - LUS::Context::GetInstance()->GetWindow()->ToggleFullscreen(); + Ship::Context::GetInstance()->GetWindow()->ToggleFullscreen(); } UIWidgets::Spacer(0); #endif @@ -165,25 +157,25 @@ void DrawShipMenu() { "" #endif )) { - std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset"); + std::reinterpret_pointer_cast(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset"); } #if !defined(__SWITCH__) && !defined(__WIIU__) UIWidgets::Spacer(0); if (ImGui::MenuItem("Open App Files Folder")) { - std::string filesPath = LUS::Context::GetInstance()->GetAppDirectoryPath(); + std::string filesPath = Ship::Context::GetInstance()->GetAppDirectoryPath(); SDL_OpenURL(std::string("file:///" + std::filesystem::absolute(filesPath).string()).c_str()); } UIWidgets::Spacer(0); if (ImGui::MenuItem("Quit")) { - LUS::Context::GetInstance()->GetWindow()->Close(); + Ship::Context::GetInstance()->GetWindow()->Close(); } #endif ImGui::EndMenu(); } } -extern std::shared_ptr mInputEditorWindow; +extern std::shared_ptr mInputEditorWindow; extern std::shared_ptr mInputViewer; extern std::shared_ptr mInputViewerSettings; extern std::shared_ptr mAdvancedResolutionSettingsWindow; @@ -192,41 +184,41 @@ void DrawSettingsMenu() { if (ImGui::BeginMenu("Settings")) { if (ImGui::BeginMenu("Audio")) { - UIWidgets::PaddedEnhancementSliderFloat("Master Volume: %.1f %%", "##Master_Vol", "gGameMasterVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true); - if (UIWidgets::PaddedEnhancementSliderFloat("Main Music Volume: %.1f %%", "##Main_Music_Vol", "gMainMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { - Audio_SetGameVolume(SEQ_BGM_MAIN, CVarGetFloat("gMainMusicVolume", 1.0f)); + UIWidgets::PaddedEnhancementSliderFloat("Master Volume: %.1f %%", "##Master_Vol", CVAR_SETTING("Volume.Master"), 0.0f, 1.0f, "", 1.0f, true, true, false, true); + if (UIWidgets::PaddedEnhancementSliderFloat("Main Music Volume: %.1f %%", "##Main_Music_Vol", CVAR_SETTING("Volume.MainMusic"), 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { + Audio_SetGameVolume(SEQ_PLAYER_BGM_MAIN, CVarGetFloat(CVAR_SETTING("Volume.MainMusic"), 1.0f)); } - if (UIWidgets::PaddedEnhancementSliderFloat("Sub Music Volume: %.1f %%", "##Sub_Music_Vol", "gSubMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { - Audio_SetGameVolume(SEQ_BGM_SUB, CVarGetFloat("gSubMusicVolume", 1.0f)); + if (UIWidgets::PaddedEnhancementSliderFloat("Sub Music Volume: %.1f %%", "##Sub_Music_Vol", CVAR_SETTING("Volume.SubMusic"), 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { + Audio_SetGameVolume(SEQ_PLAYER_BGM_SUB, CVarGetFloat(CVAR_SETTING("Volume.SubMusic"), 1.0f)); } - if (UIWidgets::PaddedEnhancementSliderFloat("Sound Effects Volume: %.1f %%", "##Sound_Effect_Vol", "gSFXMusicVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { - Audio_SetGameVolume(SEQ_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f)); + if (UIWidgets::PaddedEnhancementSliderFloat("Sound Effects Volume: %.1f %%", "##Sound_Effect_Vol", CVAR_SETTING("Volume.SFX"), 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { + Audio_SetGameVolume(SEQ_PLAYER_SFX, CVarGetFloat(CVAR_SETTING("Volume.SFX"), 1.0f)); } - if (UIWidgets::PaddedEnhancementSliderFloat("Fanfare Volume: %.1f %%", "##Fanfare_Vol", "gFanfareVolume", 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { - Audio_SetGameVolume(SEQ_FANFARE, CVarGetFloat("gFanfareVolume", 1.0f)); + if (UIWidgets::PaddedEnhancementSliderFloat("Fanfare Volume: %.1f %%", "##Fanfare_Vol", CVAR_SETTING("Volume.Fanfare"), 0.0f, 1.0f, "", 1.0f, true, true, false, true)) { + Audio_SetGameVolume(SEQ_PLAYER_FANFARE, CVarGetFloat(CVAR_SETTING("Volume.Fanfare"), 1.0f)); } - static std::unordered_map audioBackendNames = { - { LUS::AudioBackend::WASAPI, "Windows Audio Session API" }, - { LUS::AudioBackend::SDL, "SDL" } + static std::unordered_map audioBackendNames = { + { Ship::AudioBackend::WASAPI, "Windows Audio Session API" }, + { Ship::AudioBackend::SDL, "SDL" } }; ImGui::Text("Audio API (Needs reload)"); - auto currentAudioBackend = LUS::Context::GetInstance()->GetAudio()->GetAudioBackend(); + auto currentAudioBackend = Ship::Context::GetInstance()->GetAudio()->GetAudioBackend(); - if (LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) { + if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) { UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); } if (ImGui::BeginCombo("##AApi", audioBackendNames[currentAudioBackend])) { - for (uint8_t i = 0; i < LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size(); i++) { - auto backend = LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->data()[i]; + for (uint8_t i = 0; i < Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size(); i++) { + auto backend = Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->data()[i]; if (ImGui::Selectable(audioBackendNames[backend], backend == currentAudioBackend)) { - LUS::Context::GetInstance()->GetAudio()->SetAudioBackend(backend); + Ship::Context::GetInstance()->GetAudio()->SetAudioBackend(backend); } } ImGui::EndCombo(); } - if (LUS::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) { + if (Ship::Context::GetInstance()->GetAudio()->GetAvailableAudioBackends()->size() <= 1) { UIWidgets::ReEnableComponent(""); } @@ -241,7 +233,7 @@ void DrawSettingsMenu() { ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); if (mInputEditorWindow) { - if (ImGui::Button(GetWindowButtonText("Controller Mapping", CVarGetInteger("gControllerConfigurationEnabled", 0)).c_str(), ImVec2 (-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Controller Mapping", CVarGetInteger(CVAR_CONTROLLER_CONFIGURATION_WINDOW_OPEN, 0)).c_str(), ImVec2 (-1.0f, 0.0f))) { mInputEditorWindow->ToggleVisibility(); } } @@ -249,7 +241,7 @@ void DrawSettingsMenu() { ImGui::PopStyleColor(1); ImGui::PopStyleVar(3); #ifndef __SWITCH__ - UIWidgets::EnhancementCheckbox("Menubar Controller Navigation", "gControlNav"); + UIWidgets::EnhancementCheckbox("Menubar Controller Navigation", CVAR_IMGUI_CONTROLLER_NAV); UIWidgets::Tooltip("Allows controller navigation of the SOH menu bar (Settings, Enhancements,...)\nCAUTION: This will disable game inputs while the menubar is visible.\n\nD-pad to move between items, A to select, and X to grab focus on the menu bar"); UIWidgets::PaddedSeparator(); #endif @@ -258,19 +250,19 @@ void DrawSettingsMenu() { ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); if (mInputViewer) { - if (ImGui::Button(GetWindowButtonText("Input Viewer", CVarGetInteger("gOpenWindows.InputViewer", 0)).c_str(), ImVec2 (-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Input Viewer", CVarGetInteger(CVAR_WINDOW("InputViewer"), 0)).c_str(), ImVec2 (-1.0f, 0.0f))) { mInputViewer->ToggleVisibility(); } } if (mInputViewerSettings) { - if (ImGui::Button(GetWindowButtonText("Input Viewer Settings", CVarGetInteger("gOpenWindows.InputViewerSettings", 0)).c_str(), ImVec2 (-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Input Viewer Settings", CVarGetInteger(CVAR_WINDOW("InputViewerSettings"), 0)).c_str(), ImVec2 (-1.0f, 0.0f))) { mInputViewerSettings->ToggleVisibility(); } } ImGui::PopStyleColor(1); ImGui::PopStyleVar(3); - UIWidgets::PaddedEnhancementSliderInt("Simulated Input Lag: %d frames", "##SimulatedInputLag", "gSimulatedInputLag", 0, 6, "", 0, true, true, false); + UIWidgets::PaddedEnhancementSliderInt("Simulated Input Lag: %d frames", "##SimulatedInputLag", CVAR_SIMULATED_INPUT_LAG, 0, 6, "", 0, true, true, false); UIWidgets::Tooltip("Buffers your inputs to be executed a specified amount of frames later"); ImGui::EndMenu(); @@ -280,11 +272,11 @@ void DrawSettingsMenu() { if (ImGui::BeginMenu("Graphics")) { #ifndef __APPLE__ - const bool disabled_resolutionSlider = CVarGetInteger("gAdvancedResolution.VerticalResolutionToggle", 0) && - CVarGetInteger("gAdvancedResolution.Enabled", 0); - if (UIWidgets::EnhancementSliderFloat("Internal Resolution: %.1f %%", "##IMul", "gInternalResolution", 0.5f, + const bool disabled_resolutionSlider = CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".VerticalResolutionToggle", 0) && + CVarGetInteger(CVAR_PREFIX_ADVANCED_RESOLUTION ".Enabled", 0); + if (UIWidgets::EnhancementSliderFloat("Internal Resolution: %.1f %%", "##IMul", CVAR_INTERNAL_RESOLUTION, 0.5f, 2.0f, "", 1.0f, true, true, disabled_resolutionSlider)) { - LUS::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(CVarGetFloat("gInternalResolution", 1)); + Ship::Context::GetInstance()->GetWindow()->SetResolutionMultiplier(CVarGetFloat(CVAR_INTERNAL_RESOLUTION, 1)); } UIWidgets::Tooltip("Resolution scale. Multiplies output resolution by this value, on each axis relative to window size.\n" "Lower values may improve performance.\n" @@ -297,7 +289,7 @@ void DrawSettingsMenu() { ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); UIWidgets::Spacer(0); - if (ImGui::Button(GetWindowButtonText("Advanced Resolution", CVarGetInteger("gAdvancedResolutionEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Advanced Resolution", CVarGetInteger(CVAR_WINDOW("AdvancedResolutionEditor"), 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mAdvancedResolutionSettingsWindow->ToggleVisibility(); } ImGui::PopStyleColor(1); @@ -315,9 +307,9 @@ void DrawSettingsMenu() { #ifndef __WIIU__ if (UIWidgets::PaddedEnhancementSliderInt( - (CVarGetInteger("gMSAAValue", 1) == 1) ? "Anti-aliasing (MSAA): Off" : "Anti-aliasing (MSAA): %d", - "##IMSAA", "gMSAAValue", 1, 8, "", 1, true, true, false)) { - LUS::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger("gMSAAValue", 1)); + (CVarGetInteger(CVAR_MSAA_VALUE, 1) == 1) ? "Anti-aliasing (MSAA): Off" : "Anti-aliasing (MSAA): %d", + "##IMSAA", CVAR_MSAA_VALUE, 1, 8, "", 1, true, true, false)) { + Ship::Context::GetInstance()->GetWindow()->SetMsaaLevel(CVarGetInteger(CVAR_MSAA_VALUE, 1)); } UIWidgets::Tooltip("Activates MSAA (multi-sample anti-aliasing) from 2x up to 8x, to smooth the edges of rendered geometry.\n" "Higher sample count will result in smoother edges on models, but may reduce performance.\n\n" @@ -328,10 +320,10 @@ void DrawSettingsMenu() { { // FPS Slider const int minFps = 20; static int maxFps; - if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { + if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) { maxFps = 360; } else { - maxFps = LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + maxFps = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); } int currentFps = fmax(fmin(OTRGlobals::Instance->GetInterpolationFPS(), maxFps), minFps); #ifdef __WIIU__ @@ -354,7 +346,7 @@ void DrawSettingsMenu() { fpsSlider = 3; } } - if (CVarGetInteger("gMatchRefreshRate", 0)) { + if (CVarGetInteger(CVAR_SETTING("MatchRefreshRate"), 0)) { UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); } @@ -376,7 +368,7 @@ void DrawSettingsMenu() { fpsSlider++; } - if (CVarGetInteger("gMatchRefreshRate", 0)) { + if (CVarGetInteger(CVAR_SETTING("MatchRefreshRate"), 0)) { UIWidgets::ReEnableComponent(""); } if (fpsSlider > 3) { @@ -392,16 +384,16 @@ void DrawSettingsMenu() { } else if (fpsSlider == 3) { currentFps = 60; } - CVarSetInteger("gInterpolationFPS", currentFps); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetInteger(CVAR_SETTING("InterpolationFPS"), currentFps); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); #else bool matchingRefreshRate = - CVarGetInteger("gMatchRefreshRate", 0) && LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() != LUS::WindowBackend::DX11; + CVarGetInteger(CVAR_SETTING("MatchRefreshRate"), 0) && Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() != Ship::WindowBackend::DX11; UIWidgets::PaddedEnhancementSliderInt( (currentFps == 20) ? "Frame Rate: Original (20 fps)" : "Frame Rate: %d fps", - "##FPSInterpolation", "gInterpolationFPS", minFps, maxFps, "", 20, true, true, false, matchingRefreshRate); + "##FPSInterpolation", CVAR_SETTING("InterpolationFPS"), minFps, maxFps, "", 20, true, true, false, matchingRefreshRate); #endif - if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { + if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) { UIWidgets::Tooltip( "Uses Matrix Interpolation to create extra frames, resulting in smoother graphics.\n" "This is purely visual and does not impact game logic, execution of glitches etc.\n" @@ -416,23 +408,23 @@ void DrawSettingsMenu() { } } // END FPS Slider - if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { + if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) { UIWidgets::Spacer(0); if (ImGui::Button("Match Frame Rate to Refresh Rate")) { - int hz = LUS::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); + int hz = Ship::Context::GetInstance()->GetWindow()->GetCurrentRefreshRate(); if (hz >= 20 && hz <= 360) { - CVarSetInteger("gInterpolationFPS", hz); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetInteger(CVAR_SETTING("InterpolationFPS"), hz); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } } else { - UIWidgets::PaddedEnhancementCheckbox("Match Frame Rate to Refresh Rate", "gMatchRefreshRate", true, false); + UIWidgets::PaddedEnhancementCheckbox("Match Frame Rate to Refresh Rate", CVAR_SETTING("MatchRefreshRate"), true, false); } UIWidgets::Tooltip("Matches interpolation value to the game window's current refresh rate."); - if (LUS::Context::GetInstance()->GetWindow()->GetWindowBackend() == LUS::WindowBackend::DX11) { - UIWidgets::PaddedEnhancementSliderInt(CVarGetInteger("gExtraLatencyThreshold", 80) == 0 ? "Jitter fix: Off" : "Jitter fix: >= %d FPS", - "##ExtraLatencyThreshold", "gExtraLatencyThreshold", 0, 360, "", 80, true, true, false); + if (Ship::Context::GetInstance()->GetWindow()->GetWindowBackend() == Ship::WindowBackend::DX11) { + UIWidgets::PaddedEnhancementSliderInt(CVarGetInteger(CVAR_SETTING("ExtraLatencyThreshold"), 80) == 0 ? "Jitter fix: Off" : "Jitter fix: >= %d FPS", + "##ExtraLatencyThreshold", CVAR_SETTING("ExtraLatencyThreshold"), 0, 360, "", 80, true, true, false); UIWidgets::Tooltip( "(For DirectX backend only)\n\n" "When Interpolation FPS (Frame Rate) setting is at least this threshold, add one frame of delay (e.g. 16.6 ms for 60 FPS) in order to avoid jitter." @@ -445,66 +437,66 @@ void DrawSettingsMenu() { ImGui::Text("ImGui Menu Scale"); ImGui::SameLine(); ImGui::TextColored({ 0.85f, 0.35f, 0.0f, 1.0f }, "(Experimental)"); - if (UIWidgets::EnhancementCombobox("gImGuiScale", imguiScaleOptions, 1)) { + if (UIWidgets::EnhancementCombobox(CVAR_SETTING("ImGuiScale"), imguiScaleOptions, 1)) { OTRGlobals::Instance->ScaleImGui(); } UIWidgets::Tooltip("Changes the scaling of the ImGui menu elements."); UIWidgets::PaddedSeparator(true, true, 3.0f, 3.0f); - static std::unordered_map windowBackendNames = { - { LUS::WindowBackend::DX11, "DirectX" }, - { LUS::WindowBackend::SDL_OPENGL, "OpenGL"}, - { LUS::WindowBackend::SDL_METAL, "Metal" }, - { LUS::WindowBackend::GX2, "GX2"} + static std::unordered_map windowBackendNames = { + { Ship::WindowBackend::DX11, "DirectX" }, + { Ship::WindowBackend::SDL_OPENGL, "OpenGL"}, + { Ship::WindowBackend::SDL_METAL, "Metal" }, + { Ship::WindowBackend::GX2, "GX2"} }; ImGui::Text("Renderer API (Needs reload)"); - LUS::WindowBackend runningWindowBackend = LUS::Context::GetInstance()->GetWindow()->GetWindowBackend(); - LUS::WindowBackend configWindowBackend; - int configWindowBackendId = LUS::Context::GetInstance()->GetConfig()->GetInt("Window.Backend.Id", -1); - if (configWindowBackendId != -1 && configWindowBackendId < static_cast(LUS::WindowBackend::BACKEND_COUNT)) { - configWindowBackend = static_cast(configWindowBackendId); + Ship::WindowBackend runningWindowBackend = Ship::Context::GetInstance()->GetWindow()->GetWindowBackend(); + Ship::WindowBackend configWindowBackend; + int configWindowBackendId = Ship::Context::GetInstance()->GetConfig()->GetInt("Window.Backend.Id", -1); + if (configWindowBackendId != -1 && configWindowBackendId < static_cast(Ship::WindowBackend::BACKEND_COUNT)) { + configWindowBackend = static_cast(configWindowBackendId); } else { configWindowBackend = runningWindowBackend; } - if (LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) { + if (Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) { UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); } if (ImGui::BeginCombo("##RApi", windowBackendNames[configWindowBackend])) { - for (size_t i = 0; i < LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size(); i++) { - auto backend = LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->data()[i]; + for (size_t i = 0; i < Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size(); i++) { + auto backend = Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->data()[i]; if (ImGui::Selectable(windowBackendNames[backend], backend == configWindowBackend)) { - LUS::Context::GetInstance()->GetConfig()->SetInt("Window.Backend.Id", static_cast(backend)); - LUS::Context::GetInstance()->GetConfig()->SetString("Window.Backend.Name", + Ship::Context::GetInstance()->GetConfig()->SetInt("Window.Backend.Id", static_cast(backend)); + Ship::Context::GetInstance()->GetConfig()->SetString("Window.Backend.Name", windowBackendNames[backend]); - LUS::Context::GetInstance()->GetConfig()->Save(); + Ship::Context::GetInstance()->GetConfig()->Save(); } } ImGui::EndCombo(); } - if (LUS::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) { + if (Ship::Context::GetInstance()->GetWindow()->GetAvailableWindowBackends()->size() <= 1) { UIWidgets::ReEnableComponent(""); } - if (LUS::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) { - UIWidgets::PaddedEnhancementCheckbox("Enable Vsync", "gVsyncEnabled", true, false); + if (Ship::Context::GetInstance()->GetWindow()->CanDisableVerticalSync()) { + UIWidgets::PaddedEnhancementCheckbox("Enable Vsync", CVAR_VSYNC_ENABLED, true, false); UIWidgets::Tooltip("Activate vertical sync, to prevent screen tearing."); } - if (LUS::Context::GetInstance()->GetWindow()->SupportsWindowedFullscreen()) { - UIWidgets::PaddedEnhancementCheckbox("Windowed fullscreen", "gSdlWindowedFullscreen", true, false); + if (Ship::Context::GetInstance()->GetWindow()->SupportsWindowedFullscreen()) { + UIWidgets::PaddedEnhancementCheckbox("Windowed fullscreen", CVAR_SDL_WINDOWED_FULLSCREEN, true, false); } - if (LUS::Context::GetInstance()->GetWindow()->GetGui()->SupportsViewports()) { - UIWidgets::PaddedEnhancementCheckbox("Allow multi-windows (Needs reload)", "gEnableMultiViewports", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); + if (Ship::Context::GetInstance()->GetWindow()->GetGui()->SupportsViewports()) { + UIWidgets::PaddedEnhancementCheckbox("Allow multi-windows (Needs reload)", CVAR_ENABLE_MULTI_VIEWPORTS, true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip("Allows windows to be able to be dragged off of the main game window. Requires a reload to take effect."); } // If more filters are added to LUS, make sure to add them to the filters list here ImGui::Text("Texture Filtering (Needs reload)"); - UIWidgets::EnhancementCombobox("gTextureFilter", filters, FILTER_THREE_POINT); + UIWidgets::EnhancementCombobox(CVAR_TEXTURE_FILTER, filters, FILTER_THREE_POINT); UIWidgets::Tooltip("Texture filtering, aka texture smoothing. Requires a reload to take effect.\n\n" "Three-Point: Replicates real N64 texture filtering.\n" "Bilinear: If Three-Point causes poor performance, try this.\n" @@ -513,7 +505,7 @@ void DrawSettingsMenu() { UIWidgets::PaddedSeparator(true, true, 3.0f, 3.0f); // Draw LUS settings menu (such as Overlays Text Font) - LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->DrawSettings(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGameOverlay()->DrawSettings(); ImGui::EndMenu(); } @@ -521,14 +513,14 @@ void DrawSettingsMenu() { UIWidgets::Spacer(0); if (ImGui::BeginMenu("Languages")) { - UIWidgets::PaddedEnhancementCheckbox("Translate Title Screen", "gTitleScreenTranslation"); - if (UIWidgets::EnhancementRadioButton("English", "gLanguages", LANGUAGE_ENG)) { + UIWidgets::PaddedEnhancementCheckbox("Translate Title Screen", CVAR_SETTING("TitleScreenTranslation")); + if (UIWidgets::EnhancementRadioButton("English", CVAR_SETTING("Languages"), LANGUAGE_ENG)) { GameInteractor::Instance->ExecuteHooks(); } - if (UIWidgets::EnhancementRadioButton("German", "gLanguages", LANGUAGE_GER)) { + if (UIWidgets::EnhancementRadioButton("German", CVAR_SETTING("Languages"), LANGUAGE_GER)) { GameInteractor::Instance->ExecuteHooks(); } - if (UIWidgets::EnhancementRadioButton("French", "gLanguages", LANGUAGE_FRA)) { + if (UIWidgets::EnhancementRadioButton("French", CVAR_SETTING("Languages"), LANGUAGE_FRA)) { GameInteractor::Instance->ExecuteHooks(); } ImGui::EndMenu(); @@ -538,10 +530,10 @@ void DrawSettingsMenu() { if (ImGui::BeginMenu("Accessibility")) { #if defined(_WIN32) || defined(__APPLE__) - UIWidgets::PaddedEnhancementCheckbox("Text to Speech", "gA11yTTS"); + UIWidgets::PaddedEnhancementCheckbox("Text to Speech", CVAR_SETTING("A11yTTS")); UIWidgets::Tooltip("Enables text to speech for in game dialog"); #endif - UIWidgets::PaddedEnhancementCheckbox("Disable Idle Camera Re-Centering", "gA11yDisableIdleCam"); + UIWidgets::PaddedEnhancementCheckbox("Disable Idle Camera Re-Centering", CVAR_SETTING("A11yDisableIdleCam")); UIWidgets::Tooltip("Disables the automatic re-centering of the camera when idle."); ImGui::EndMenu(); @@ -557,7 +549,7 @@ extern std::shared_ptr mGameplayStatsWindow; void DrawEnhancementsMenu() { if (ImGui::BeginMenu("Enhancements")) { - ImGui::BeginDisabled(CVarGetInteger("gDisableChangingSettings", 0)); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); DrawPresetSelector(PRESET_TYPE_ENHANCEMENTS); @@ -576,112 +568,112 @@ void DrawEnhancementsMenu() { ImGui::Text("Speed-ups:"); UIWidgets::PaddedSeparator(); bool allChecked = - CVarGetInteger("gTimeSavers.SkipCutscene.Intro", IS_RANDO) && - CVarGetInteger("gTimeSavers.SkipCutscene.Entrances", IS_RANDO) && - CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO) && - CVarGetInteger("gTimeSavers.SkipCutscene.LearnSong", IS_RANDO) && - CVarGetInteger("gTimeSavers.SkipCutscene.BossIntro", IS_RANDO) && - CVarGetInteger("gTimeSavers.SkipCutscene.QuickBossDeaths", IS_RANDO) && - CVarGetInteger("gTimeSavers.SkipCutscene.OnePoint", IS_RANDO) && - CVarGetInteger("gTimeSavers.NoForcedDialog", IS_RANDO) && - CVarGetInteger("gTimeSavers.SkipOwlInteractions", IS_RANDO) && - CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO) && - CVarGetInteger("gTimeSavers.DisableTitleCard", IS_RANDO); + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), IS_RANDO) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), IS_RANDO) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), IS_RANDO) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), IS_RANDO) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths"), IS_RANDO) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), IS_RANDO) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.NoForcedDialog"), IS_RANDO) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), IS_RANDO) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), IS_RANDO); bool someChecked = - CVarGetInteger("gTimeSavers.SkipCutscene.Intro", IS_RANDO) || - CVarGetInteger("gTimeSavers.SkipCutscene.Entrances", IS_RANDO) || - CVarGetInteger("gTimeSavers.SkipCutscene.Story", IS_RANDO) || - CVarGetInteger("gTimeSavers.SkipCutscene.LearnSong", IS_RANDO) || - CVarGetInteger("gTimeSavers.SkipCutscene.BossIntro", IS_RANDO) || - CVarGetInteger("gTimeSavers.SkipCutscene.QuickBossDeaths", IS_RANDO) || - CVarGetInteger("gTimeSavers.SkipCutscene.OnePoint", IS_RANDO) || - CVarGetInteger("gTimeSavers.NoForcedDialog", IS_RANDO) || - CVarGetInteger("gTimeSavers.SkipOwlInteractions", IS_RANDO) || - CVarGetInteger("gTimeSavers.SkipMiscInteractions", IS_RANDO) || - CVarGetInteger("gTimeSavers.DisableTitleCard", IS_RANDO); + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), IS_RANDO) || + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), IS_RANDO) || + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO) || + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), IS_RANDO) || + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), IS_RANDO) || + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths"), IS_RANDO) || + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), IS_RANDO) || + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.NoForcedDialog"), IS_RANDO) || + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), IS_RANDO) || + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO) || + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), IS_RANDO); ImGuiContext* g = ImGui::GetCurrentContext(); ImGuiItemFlags backup_item_flags = g->CurrentItemFlags; if (!allChecked && someChecked) g->CurrentItemFlags |= ImGuiItemFlags_MixedValue; if (ImGui::Checkbox("All", &allChecked)) { if (allChecked) { - CVarSetInteger("gTimeSavers.SkipCutscene.Intro", 1); - CVarSetInteger("gTimeSavers.SkipCutscene.Entrances", 1); - CVarSetInteger("gTimeSavers.SkipCutscene.Story", 1); - CVarSetInteger("gTimeSavers.SkipCutscene.LearnSong", 1); - CVarSetInteger("gTimeSavers.SkipCutscene.BossIntro", 1); - CVarSetInteger("gTimeSavers.SkipCutscene.QuickBossDeaths", 1); - CVarSetInteger("gTimeSavers.SkipCutscene.OnePoint", 1); - CVarSetInteger("gTimeSavers.NoForcedDialog", 1); - CVarSetInteger("gTimeSavers.SkipOwlInteractions", 1); - CVarSetInteger("gTimeSavers.SkipMiscInteractions", 1); - CVarSetInteger("gTimeSavers.DisableTitleCard", 1); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), 1); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), 1); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), 1); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), 1); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), 1); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths"), 1); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), 1); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.NoForcedDialog"), 1); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), 1); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), 1); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), 1); } else { - CVarSetInteger("gTimeSavers.SkipCutscene.Intro", 0); - CVarSetInteger("gTimeSavers.SkipCutscene.Entrances", 0); - CVarSetInteger("gTimeSavers.SkipCutscene.Story", 0); - CVarSetInteger("gTimeSavers.SkipCutscene.LearnSong", 0); - CVarSetInteger("gTimeSavers.SkipCutscene.BossIntro", 0); - CVarSetInteger("gTimeSavers.SkipCutscene.QuickBossDeaths", 0); - CVarSetInteger("gTimeSavers.SkipCutscene.OnePoint", 0); - CVarSetInteger("gTimeSavers.NoForcedDialog", 0); - CVarSetInteger("gTimeSavers.SkipOwlInteractions", 0); - CVarSetInteger("gTimeSavers.SkipMiscInteractions", 0); - CVarSetInteger("gTimeSavers.DisableTitleCard", 0); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), 0); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), 0); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), 0); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), 0); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), 0); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths"), 0); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), 0); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.NoForcedDialog"), 0); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), 0); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), 0); + CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), 0); } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } g->CurrentItemFlags = backup_item_flags; - UIWidgets::PaddedEnhancementCheckbox("Skip Intro", "gTimeSavers.SkipCutscene.Intro", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); - UIWidgets::PaddedEnhancementCheckbox("Skip Entrance Cutscenes", "gTimeSavers.SkipCutscene.Entrances", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); - UIWidgets::PaddedEnhancementCheckbox("Skip Story Cutscenes", "gTimeSavers.SkipCutscene.Story", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); - UIWidgets::PaddedEnhancementCheckbox("Skip Song Cutscenes", "gTimeSavers.SkipCutscene.LearnSong", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); - UIWidgets::PaddedEnhancementCheckbox("Skip Boss Introductions", "gTimeSavers.SkipCutscene.BossIntro", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); - UIWidgets::PaddedEnhancementCheckbox("Quick Boss Deaths", "gTimeSavers.SkipCutscene.QuickBossDeaths", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); - UIWidgets::PaddedEnhancementCheckbox("Skip One Point Cutscenes (Chests, Door Unlocks, etc)", "gTimeSavers.SkipCutscene.OnePoint", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); - UIWidgets::PaddedEnhancementCheckbox("No Forced Dialog", "gTimeSavers.NoForcedDialog", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); + UIWidgets::PaddedEnhancementCheckbox("Skip Intro", CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); + UIWidgets::PaddedEnhancementCheckbox("Skip Entrance Cutscenes", CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); + UIWidgets::PaddedEnhancementCheckbox("Skip Story Cutscenes", CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); + UIWidgets::PaddedEnhancementCheckbox("Skip Song Cutscenes", CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); + UIWidgets::PaddedEnhancementCheckbox("Skip Boss Introductions", CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); + UIWidgets::PaddedEnhancementCheckbox("Quick Boss Deaths", CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); + UIWidgets::PaddedEnhancementCheckbox("Skip One Point Cutscenes (Chests, Door Unlocks, etc)", CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); + UIWidgets::PaddedEnhancementCheckbox("No Forced Dialog", CVAR_ENHANCEMENT("TimeSavers.NoForcedDialog"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); UIWidgets::Tooltip("Prevent forced conversations with Navi or other NPCs"); - UIWidgets::PaddedEnhancementCheckbox("Skip Owl Interactions", "gTimeSavers.SkipOwlInteractions", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); - UIWidgets::PaddedEnhancementCheckbox("Skip Misc Interactions", "gTimeSavers.SkipMiscInteractions", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); - UIWidgets::PaddedEnhancementCheckbox("Disable Title Card", "gTimeSavers.DisableTitleCard", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); - UIWidgets::PaddedEnhancementCheckbox("Skip Glitch-Aiding Cutscenes", "gTimeSavers.SkipCutscene.GlitchAiding", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, 0); + UIWidgets::PaddedEnhancementCheckbox("Skip Owl Interactions", CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); + UIWidgets::PaddedEnhancementCheckbox("Skip Misc Interactions", CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); + UIWidgets::PaddedEnhancementCheckbox("Disable Title Card", CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, IS_RANDO); + UIWidgets::PaddedEnhancementCheckbox("Skip Glitch-Aiding Cutscenes", CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.GlitchAiding"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, 0); UIWidgets::Tooltip("Skip cutscenes that are associated with useful glitches, currently this is only the Fire Temple Darunia CS and Forest Temple Poe Sisters CS"); - UIWidgets::PaddedEnhancementCheckbox("Skip Child Stealth", "gTimeSavers.SkipChildStealth", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, false); + UIWidgets::PaddedEnhancementCheckbox("Skip Child Stealth", CVAR_ENHANCEMENT("TimeSavers.SkipChildStealth"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, false); UIWidgets::Tooltip("The crawlspace into Hyrule Castle goes straight to Zelda, skipping the guards."); - UIWidgets::PaddedEnhancementCheckbox("Skip Tower Escape", "gTimeSavers.SkipTowerEscape", false, false, false, "", UIWidgets::CheckboxGraphics::Cross, false); + UIWidgets::PaddedEnhancementCheckbox("Skip Tower Escape", CVAR_ENHANCEMENT("TimeSavers.SkipTowerEscape"), false, false, false, "", UIWidgets::CheckboxGraphics::Cross, false); UIWidgets::Tooltip("Skip the tower escape sequence between Ganondorf and Ganon."); UIWidgets::PaddedText("Skip Get Item Animations", true, false); - UIWidgets::EnhancementCombobox("gTimeSavers.SkipGetItemAnimation", skipGetItemAnimationOptions, SGIA_DISABLED); - if (CVarGetInteger("gTimeSavers.SkipGetItemAnimation", SGIA_DISABLED) != SGIA_DISABLED) { - UIWidgets::EnhancementSliderFloat("Item Scale: %f", "##ItemScale", "gTimeSavers.SkipGetItemAnimationScale", 5.0f, 15.0f, "", 10.0f, false); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("TimeSavers.SkipGetItemAnimation"), skipGetItemAnimationOptions, SGIA_DISABLED); + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipGetItemAnimation"), SGIA_DISABLED) != SGIA_DISABLED) { + UIWidgets::EnhancementSliderFloat("Item Scale: %f", "##ItemScale", CVAR_ENHANCEMENT("TimeSavers.SkipGetItemAnimationScale"), 5.0f, 15.0f, "", 10.0f, false); UIWidgets::Tooltip("The size of the item when it is picked up"); } - UIWidgets::PaddedEnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", "gTextSpeed", 1, 5, "", 1, true, false, true); - UIWidgets::PaddedEnhancementCheckbox("Skip Text", "gSkipText", false, true); + UIWidgets::PaddedEnhancementSliderInt("Text Speed: %dx", "##TEXTSPEED", CVAR_ENHANCEMENT("TextSpeed"), 1, 5, "", 1, true, false, true); + UIWidgets::PaddedEnhancementCheckbox("Skip Text", CVAR_ENHANCEMENT("SkipText"), false, true); UIWidgets::Tooltip("Holding down B skips text"); - UIWidgets::PaddedEnhancementSliderInt("King Zora Speed: %dx", "##MWEEPSPEED", "gMweepSpeed", 1, 5, "", 1, true, false, true); - UIWidgets::PaddedEnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", "gClimbSpeed", 0, 12, "", 0, true, false, true); - UIWidgets::PaddedEnhancementSliderInt("Block pushing speed +%d", "##BLOCKSPEED", "gFasterBlockPush", 0, 5, "", 0, true, false, true); - UIWidgets::PaddedEnhancementSliderInt("Crawl speed %dx", "##CRAWLSPEED", "gCrawlSpeed", 1, 5, "", 1, true, false, true); - UIWidgets::PaddedEnhancementCheckbox("Faster Heavy Block Lift", "gFasterHeavyBlockLift", false, false); + UIWidgets::PaddedEnhancementSliderInt("King Zora Speed: %dx", "##MWEEPSPEED", CVAR_ENHANCEMENT("MweepSpeed"), 1, 5, "", 1, true, false, true); + UIWidgets::PaddedEnhancementSliderInt("Vine/Ladder Climb speed +%d", "##CLIMBSPEED", CVAR_ENHANCEMENT("ClimbSpeed"), 0, 12, "", 0, true, false, true); + UIWidgets::PaddedEnhancementSliderInt("Block pushing speed +%d", "##BLOCKSPEED", CVAR_ENHANCEMENT("FasterBlockPush"), 0, 5, "", 0, true, false, true); + UIWidgets::PaddedEnhancementSliderInt("Crawl speed %dx", "##CRAWLSPEED", CVAR_ENHANCEMENT("CrawlSpeed"), 1, 5, "", 1, true, false, true); + UIWidgets::PaddedEnhancementCheckbox("Faster Heavy Block Lift", CVAR_ENHANCEMENT("FasterHeavyBlockLift"), false, false); UIWidgets::Tooltip("Speeds up lifting silver rocks and obelisks"); - UIWidgets::PaddedEnhancementCheckbox("Skip Pickup Messages", "gFastDrops", true, false); + UIWidgets::PaddedEnhancementCheckbox("Skip Pickup Messages", CVAR_ENHANCEMENT("FastDrops"), true, false); UIWidgets::Tooltip("Skip pickup messages for new consumable items and bottle swipes"); - UIWidgets::PaddedEnhancementCheckbox("Fast Ocarina Playback", "gFastOcarinaPlayback", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fast Ocarina Playback", CVAR_ENHANCEMENT("FastOcarinaPlayback"), true, false); UIWidgets::Tooltip("Skip the part where the Ocarina playback is called when you play a song"); bool forceSkipScarecrow = IS_RANDO && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SKIP_SCARECROWS_SONG); static const char* forceSkipScarecrowText = "This setting is forcefully enabled because a savefile\nwith \"Skip Scarecrow Song\" is loaded"; - UIWidgets::PaddedEnhancementCheckbox("Skip Scarecrow Song", "gSkipScarecrow", true, false, + UIWidgets::PaddedEnhancementCheckbox("Skip Scarecrow Song", CVAR_ENHANCEMENT("InstantScarecrow"), true, false, forceSkipScarecrow, forceSkipScarecrowText, UIWidgets::CheckboxGraphics::Checkmark); UIWidgets::Tooltip("Pierre appears when Ocarina is pulled out. Requires learning scarecrow song."); - UIWidgets::PaddedEnhancementCheckbox("Skip Magic Arrow Equip Animation", "gSkipArrowAnimation", true, false); - UIWidgets::PaddedEnhancementCheckbox("Skip save confirmation", "gSkipSaveConfirmation", true, false); + UIWidgets::PaddedEnhancementCheckbox("Skip Magic Arrow Equip Animation", CVAR_ENHANCEMENT("SkipArrowAnimation"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Skip save confirmation", CVAR_ENHANCEMENT("SkipSaveConfirmation"), true, false); UIWidgets::Tooltip("Skip the \"Game saved.\" confirmation screen"); - UIWidgets::PaddedEnhancementCheckbox("Faster Farore's Wind", "gFastFarores", true, false); + UIWidgets::PaddedEnhancementCheckbox("Faster Farore's Wind", CVAR_ENHANCEMENT("FastFarores"), true, false); UIWidgets::Tooltip("Greatly decreases cast time of Farore's Wind magic spell."); - UIWidgets::PaddedEnhancementCheckbox("Skip water take breath animation", "gSkipSwimDeepEndAnim", true, false); + UIWidgets::PaddedEnhancementCheckbox("Skip water take breath animation", CVAR_ENHANCEMENT("SkipSwimDeepEndAnim"), true, false); UIWidgets::Tooltip("Skips Link's taking breath animation after coming up from water. This setting does not interfere with getting items from underwater."); ImGui::TableNextColumn(); @@ -689,27 +681,27 @@ void DrawEnhancementsMenu() { ImGui::Text("Changes:"); UIWidgets::PaddedSeparator(); - UIWidgets::PaddedEnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", "gForgeTime", 0, 3, "", 3, true, false, true); + UIWidgets::PaddedEnhancementSliderInt("Biggoron Forge Time: %d days", "##FORGETIME", CVAR_ENHANCEMENT("ForgeTime"), 0, 3, "", 3, true, false, true); UIWidgets::Tooltip("Allows you to change the number of days it takes for Biggoron to forge the Biggoron Sword"); - UIWidgets::PaddedEnhancementCheckbox("Remember Save Location", "gRememberSaveLocation", false, false); + UIWidgets::PaddedEnhancementCheckbox("Remember Save Location", CVAR_ENHANCEMENT("RememberSaveLocation"), false, false); UIWidgets::Tooltip("When loading a save, places Link at the last entrance he went through.\n" "This doesn't work if the save was made in grottos/fairy fountains or dungeons."); - UIWidgets::PaddedEnhancementCheckbox("No Forced Navi", "gNoForcedNavi", true, false); + UIWidgets::PaddedEnhancementCheckbox("No Forced Navi", CVAR_ENHANCEMENT("NoForcedNavi"), true, false); UIWidgets::Tooltip("Prevent forced Navi conversations"); - UIWidgets::PaddedEnhancementCheckbox("Navi Timer Resets", "gEnhancements.ResetNaviTimer", true, false); + UIWidgets::PaddedEnhancementCheckbox("Navi Timer Resets", CVAR_ENHANCEMENT("ResetNaviTimer"), true, false); UIWidgets::Tooltip("Resets the Navi timer on scene change. If you have already talked to her, she will try and talk to you again, instead of needing a save warp or death. "); - UIWidgets::PaddedEnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze", true, false); + UIWidgets::PaddedEnhancementCheckbox("No Skulltula Freeze", CVAR_ENHANCEMENT("SkulltulaFreeze"), true, false); UIWidgets::Tooltip("Stops the game from freezing the player when picking up Gold Skulltulas"); - UIWidgets::PaddedEnhancementCheckbox("Nighttime GS Always Spawn", "gNightGSAlwaysSpawn", true, false); + UIWidgets::PaddedEnhancementCheckbox("Nighttime GS Always Spawn", CVAR_ENHANCEMENT("NightGSAlwaysSpawn"), true, false); UIWidgets::Tooltip("Nighttime Skulltulas will spawn during both day and night."); - UIWidgets::PaddedEnhancementCheckbox("Dampe Appears All Night", "gDampeAllNight", true, false); + UIWidgets::PaddedEnhancementCheckbox("Dampe Appears All Night", CVAR_ENHANCEMENT("DampeAllNight"), true, false); UIWidgets::Tooltip("Makes Dampe appear anytime during the night, not just his usual working hours."); - UIWidgets::PaddedEnhancementCheckbox("Fast Chests", "gFastChests", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fast Chests", CVAR_ENHANCEMENT("FastChests"), true, false); UIWidgets::Tooltip("Kick open every chest"); UIWidgets::PaddedText("Chest size & texture matches contents", true, false); - if (UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestStyleMatchesContentsOptions, CSMC_DISABLED)) { - if (CVarGetInteger("gChestSizeAndTextureMatchesContents", CSMC_DISABLED) == CSMC_DISABLED) { - CVarSetInteger("gChestSizeDependsStoneOfAgony", 0); + if (UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("ChestSizeAndTextureMatchContents"), chestStyleMatchesContentsOptions, CSMC_DISABLED)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("ChestSizeAndTextureMatchContents"), CSMC_DISABLED) == CSMC_DISABLED) { + CVarSetInteger(CVAR_ENHANCEMENT("ChestSizeDependsStoneOfAgony"), 0); } } UIWidgets::Tooltip( @@ -723,24 +715,24 @@ void DrawEnhancementsMenu() { "\n" "NOTE: Textures will not apply if you are using a mod pack with a custom chest model." ); - if (CVarGetInteger("gChestSizeAndTextureMatchesContents", CSMC_DISABLED) != CSMC_DISABLED) { - UIWidgets::PaddedEnhancementCheckbox("Chests of Agony", "gChestSizeDependsStoneOfAgony", true, false); + if (CVarGetInteger(CVAR_ENHANCEMENT("ChestSizeAndTextureMatchContents"), CSMC_DISABLED) != CSMC_DISABLED) { + UIWidgets::PaddedEnhancementCheckbox("Chests of Agony", CVAR_ENHANCEMENT("ChestSizeDependsStoneOfAgony"), true, false); UIWidgets::Tooltip("Only change the size/texture of chests if you have the Stone of Agony."); } - UIWidgets::PaddedEnhancementCheckbox("Ask to Equip New Items", "gAskToEquip", true, false); + UIWidgets::PaddedEnhancementCheckbox("Ask to Equip New Items", CVAR_ENHANCEMENT("AskToEquip"), true, false); UIWidgets::Tooltip("Adds a prompt to equip newly-obtained swords, shields and tunics"); - UIWidgets::PaddedEnhancementCheckbox("Better Owl", "gBetterOwl", true, false); + UIWidgets::PaddedEnhancementCheckbox("Better Owl", CVAR_ENHANCEMENT("BetterOwl"), true, false); UIWidgets::Tooltip("The default response to Kaepora Gaebora is always that you understood what he said"); - UIWidgets::PaddedEnhancementCheckbox("Exit Market at Night", "gMarketSneak", true, false); + UIWidgets::PaddedEnhancementCheckbox("Exit Market at Night", CVAR_ENHANCEMENT("MarketSneak"), true, false); UIWidgets::Tooltip("Allows exiting Hyrule Castle Market Town to Hyrule Field at night by speaking to the guard next to the gate."); - UIWidgets::PaddedEnhancementCheckbox("Shops and Games Always Open", "gEnhancements.OpenAllHours", true, false); + UIWidgets::PaddedEnhancementCheckbox("Shops and Games Always Open", CVAR_ENHANCEMENT("OpenAllHours"), true, false); UIWidgets::Tooltip("Shops and minigames are open both day and night. Requires scene reload to take effect."); - UIWidgets::PaddedEnhancementCheckbox("Link as default file name", "gLinkDefaultName", true, false); + UIWidgets::PaddedEnhancementCheckbox("Link as default file name", CVAR_ENHANCEMENT("LinkDefaultName"), true, false); UIWidgets::Tooltip("Allows you to have \"Link\" as a premade file name"); - UIWidgets::PaddedEnhancementCheckbox("Quit Fishing At Door", "gQuitFishingAtDoor", true, false); + UIWidgets::PaddedEnhancementCheckbox("Quit Fishing At Door", CVAR_ENHANCEMENT("QuitFishingAtDoor"), true, false); UIWidgets::Tooltip("Fisherman asks if you want to quit at the door when you still have the rod"); UIWidgets::PaddedText("Time Travel with the Song of Time", true, false); - UIWidgets::EnhancementCombobox("gTimeTravel", timeTravelOptions, 0); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("TimeTravel"), timeTravelOptions, 0); UIWidgets::Tooltip("Allows Link to freely change age by playing the Song of Time.\n" "Time Blocks can still be used properly.\n\n" "Requirements:\n" @@ -749,7 +741,7 @@ void DrawEnhancementsMenu() { "- Obtained the Master Sword\n" "- Not within range of Time Block\n" "- Not within range of Ocarina playing spots"); - UIWidgets::PaddedEnhancementCheckbox("Pause Warp", "gPauseWarp", true, false); + UIWidgets::PaddedEnhancementCheckbox("Pause Warp", CVAR_ENHANCEMENT("PauseWarp"), true, false); UIWidgets::Tooltip("Selection of warp song in pause menu initiates warp. Disables song playback."); ImGui::EndTable(); @@ -760,41 +752,41 @@ void DrawEnhancementsMenu() { if (ImGui::BeginMenu("Items")) { - UIWidgets::PaddedEnhancementCheckbox("Instant Putaway", "gInstantPutaway", true, false); + UIWidgets::PaddedEnhancementCheckbox("Instant Putaway", CVAR_ENHANCEMENT("InstantPutaway"), true, false); UIWidgets::Tooltip("Allow Link to put items away without having to wait around"); - UIWidgets::PaddedEnhancementCheckbox("Instant Boomerang Recall", "gFastBoomerang", true, false); + UIWidgets::PaddedEnhancementCheckbox("Instant Boomerang Recall", CVAR_ENHANCEMENT("FastBoomerang"), true, false); UIWidgets::Tooltip("Instantly return the boomerang to Link by pressing its item button while it's in the air"); - UIWidgets::PaddedEnhancementCheckbox("Prevent Dropped Ocarina Inputs", "gDpadNoDropOcarinaInput", true, false); + UIWidgets::PaddedEnhancementCheckbox("Prevent Dropped Ocarina Inputs", CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), true, false); UIWidgets::Tooltip("Prevent dropping inputs when playing the ocarina quickly"); UIWidgets::PaddedText("Bunny Hood Effect", true, false); - UIWidgets::EnhancementCombobox("gMMBunnyHood", bunnyHoodOptions, BUNNY_HOOD_VANILLA); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("MMBunnyHood"), bunnyHoodOptions, BUNNY_HOOD_VANILLA); UIWidgets::Tooltip( "Wearing the Bunny Hood grants a speed increase like in Majora's Mask. The longer jump option is not accounted for in randomizer logic.\n\n" "Also disables NPC's reactions to wearing the Bunny Hood." ); - UIWidgets::PaddedEnhancementCheckbox("Bunny Hood Equippable as Adult", "gAdultBunnyHood", true, false, (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) == BUNNY_HOOD_VANILLA), "Only available with increased bunny hood speed", UIWidgets::CheckboxGraphics::Cross, false); + UIWidgets::PaddedEnhancementCheckbox("Bunny Hood Equippable as Adult", CVAR_ENHANCEMENT("AdultBunnyHood"), true, false, (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) == BUNNY_HOOD_VANILLA), "Only available with increased bunny hood speed", UIWidgets::CheckboxGraphics::Cross, false); UIWidgets::Tooltip("Allows the bunny hood to be equipped normally from the pause menu as adult."); - UIWidgets::PaddedEnhancementCheckbox("Mask Select in Inventory", "gMaskSelect", true, false); + UIWidgets::PaddedEnhancementCheckbox("Mask Select in Inventory", CVAR_ENHANCEMENT("MaskSelect"), true, false); UIWidgets::Tooltip("After completing the mask trading sub-quest, press A and any direction on the mask slot to change masks"); - UIWidgets::PaddedEnhancementCheckbox("Nuts explode bombs", "gNutsExplodeBombs", true, false); + UIWidgets::PaddedEnhancementCheckbox("Nuts explode bombs", CVAR_ENHANCEMENT("NutsExplodeBombs"), true, false); UIWidgets::Tooltip("Makes nuts explode bombs, similar to how they interact with bombchus. This does not affect bombflowers."); - UIWidgets::PaddedEnhancementCheckbox("Equip Multiple Arrows at Once", "gSeparateArrows", true, false); + UIWidgets::PaddedEnhancementCheckbox("Equip Multiple Arrows at Once", CVAR_ENHANCEMENT("SeparateArrows"), true, false); UIWidgets::Tooltip("Allow the bow and magic arrows to be equipped at the same time on different slots. (Note this will disable the behaviour of the 'Equip Dupe' glitch)"); - UIWidgets::PaddedEnhancementCheckbox("Bow as Child/Slingshot as Adult", "gBowSlingShotAmmoFix", true, false); + UIWidgets::PaddedEnhancementCheckbox("Bow as Child/Slingshot as Adult", CVAR_ENHANCEMENT("BowSlingshotAmmoFix"), true, false); UIWidgets::Tooltip("Allows child to use bow with arrows.\nAllows adult to use slingshot with seeds.\n\nRequires glitches or 'Timeless Equipment' cheat to equip."); - UIWidgets::PaddedEnhancementCheckbox("Better Farore's Wind", "gBetterFW", true, false); + UIWidgets::PaddedEnhancementCheckbox("Better Farore's Wind", CVAR_ENHANCEMENT("BetterFarore"), true, false); UIWidgets::Tooltip("Helps FW persist between ages, gives child and adult separate FW points, and can be used in more places."); - UIWidgets::PaddedEnhancementCheckbox("Remove Explosive Limit", "gRemoveExplosiveLimit", true, false); + UIWidgets::PaddedEnhancementCheckbox("Remove Explosive Limit", CVAR_ENHANCEMENT("RemoveExplosiveLimit"), true, false); UIWidgets::Tooltip("Removes the cap of 3 active explosives being deployed at once."); - UIWidgets::PaddedEnhancementCheckbox("Static Explosion Radius", "gStaticExplosionRadius", true, false); + UIWidgets::PaddedEnhancementCheckbox("Static Explosion Radius", CVAR_ENHANCEMENT("StaticExplosionRadius"), true, false); UIWidgets::Tooltip("Explosions are now a static size, like in Majora's Mask and OoT3D. Makes bombchu hovering much easier."); - UIWidgets::PaddedEnhancementCheckbox("Prevent Bombchus Forcing First-Person", "gDisableFirstPersonChus", true, false); + UIWidgets::PaddedEnhancementCheckbox("Prevent Bombchus Forcing First-Person", CVAR_ENHANCEMENT("DisableFirstPersonChus"), true, false); UIWidgets::Tooltip("Prevent bombchus from forcing the camera into first-person mode when released."); - UIWidgets::PaddedEnhancementCheckbox("Aiming reticle for the bow/slingshot", "gBowReticle", true, false); + UIWidgets::PaddedEnhancementCheckbox("Aiming reticle for the bow/slingshot", CVAR_ENHANCEMENT("BowReticle"), true, false); UIWidgets::Tooltip("Aiming with a bow or slingshot will display a reticle as with the hookshot when the projectile is ready to fire."); - if (UIWidgets::PaddedEnhancementCheckbox("Allow strength equipment to be toggled", "gToggleStrength", true, false)) { - if (!CVarGetInteger("gToggleStrength", 0)) { - CVarSetInteger("gStrengthDisabled", 0); + if (UIWidgets::PaddedEnhancementCheckbox("Allow strength equipment to be toggled", CVAR_ENHANCEMENT("ToggleStrength"), true, false)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0)) { + CVarSetInteger(CVAR_ENHANCEMENT("StrengthDisabled"), 0); } } UIWidgets::Tooltip("Allows strength to be toggled on and off by pressing A on the strength upgrade in the equipment subscreen of the pause menu (This allows performing some glitches that require the player to not have strength)."); @@ -807,86 +799,86 @@ void DrawEnhancementsMenu() { { if (ImGui::BeginMenu("Potion Values")) { - UIWidgets::EnhancementCheckbox("Change Red Potion Effect", "gRedPotionEffect"); + UIWidgets::EnhancementCheckbox("Change Red Potion Effect", CVAR_ENHANCEMENT("RedPotionEffect")); UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Red Potions"); - bool disabledRedPotion = !CVarGetInteger("gRedPotionEffect", 0); + bool disabledRedPotion = !CVarGetInteger(CVAR_ENHANCEMENT("RedPotionEffect"), 0); static const char* disabledTooltipRedPotion = "This option is disabled because \"Change Red Potion Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Red Potion Health: %d", "##REDPOTIONHEALTH", "gRedPotionHealth", 1, 100, "", 0, true, disabledRedPotion, disabledTooltipRedPotion); + UIWidgets::EnhancementSliderInt("Red Potion Health: %d", "##REDPOTIONHEALTH", CVAR_ENHANCEMENT("RedPotionHealth"), 1, 100, "", 0, true, disabledRedPotion, disabledTooltipRedPotion); UIWidgets::Tooltip("Changes the amount of health restored by Red Potions"); - UIWidgets::EnhancementCheckbox("Red Potion Percent Restore", "gRedPercentRestore", disabledRedPotion, disabledTooltipRedPotion); + UIWidgets::EnhancementCheckbox("Red Potion Percent Restore", CVAR_ENHANCEMENT("RedPercentRestore"), disabledRedPotion, disabledTooltipRedPotion); UIWidgets::Tooltip("Toggles from Red Potions restoring a fixed amount of health to a percent of the player's current max health"); ImGui::Separator(); - UIWidgets::EnhancementCheckbox("Change Green Potion Effect", "gGreenPotionEffect"); + UIWidgets::EnhancementCheckbox("Change Green Potion Effect", CVAR_ENHANCEMENT("GreenPotionEffect")); UIWidgets::Tooltip("Enable the following changes to the amount of mana restored by Green Potions"); - bool disabledGreenPotion = !CVarGetInteger("gGreenPotionEffect", 0); + bool disabledGreenPotion = !CVarGetInteger(CVAR_ENHANCEMENT("GreenPotionEffect"), 0); static const char* disabledTooltipGreenPotion = "This option is disabled because \"Change Green Potion Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Green Potion Mana: %d", "##GREENPOTIONMANA", "gGreenPotionMana", 1, 100, "", 0, true, disabledGreenPotion, disabledTooltipGreenPotion); + UIWidgets::EnhancementSliderInt("Green Potion Mana: %d", "##GREENPOTIONMANA", CVAR_ENHANCEMENT("GreenPotionMana"), 1, 100, "", 0, true, disabledGreenPotion, disabledTooltipGreenPotion); UIWidgets::Tooltip("Changes the amount of mana restored by Green Potions, base max mana is 48, max upgraded mana is 96"); - UIWidgets::EnhancementCheckbox("Green Potion Percent Restore", "gGreenPercentRestore", disabledGreenPotion, disabledTooltipGreenPotion); + UIWidgets::EnhancementCheckbox("Green Potion Percent Restore", CVAR_ENHANCEMENT("GreenPercentRestore"), disabledGreenPotion, disabledTooltipGreenPotion); UIWidgets::Tooltip("Toggles from Green Potions restoring a fixed amount of mana to a percent of the player's current max mana"); ImGui::Separator(); - UIWidgets::EnhancementCheckbox("Change Blue Potion Effects", "gBluePotionEffects"); + UIWidgets::EnhancementCheckbox("Change Blue Potion Effects", CVAR_ENHANCEMENT("BluePotionEffects")); UIWidgets::Tooltip("Enable the following changes to the amount of health and mana restored by Blue Potions"); - bool disabledBluePotion = !CVarGetInteger("gBluePotionEffects", 0); + bool disabledBluePotion = !CVarGetInteger(CVAR_ENHANCEMENT("BluePotionEffects"), 0); static const char* disabledTooltipBluePotion = "This option is disabled because \"Change Blue Potion Effects\" is turned off"; - UIWidgets::EnhancementSliderInt("Blue Potion Health: %d", "##BLUEPOTIONHEALTH", "gBluePotionHealth", 1, 100, "", 0, true, disabledBluePotion, disabledTooltipBluePotion); + UIWidgets::EnhancementSliderInt("Blue Potion Health: %d", "##BLUEPOTIONHEALTH", CVAR_ENHANCEMENT("BluePotionHealth"), 1, 100, "", 0, true, disabledBluePotion, disabledTooltipBluePotion); UIWidgets::Tooltip("Changes the amount of health restored by Blue Potions"); - UIWidgets::EnhancementCheckbox("Blue Potion Health Percent Restore", "gBlueHealthPercentRestore", disabledBluePotion, disabledTooltipBluePotion); + UIWidgets::EnhancementCheckbox("Blue Potion Health Percent Restore", CVAR_ENHANCEMENT("BlueHealthPercentRestore"), disabledBluePotion, disabledTooltipBluePotion); UIWidgets::Tooltip("Toggles from Blue Potions restoring a fixed amount of health to a percent of the player's current max health"); ImGui::Separator(); - UIWidgets::EnhancementSliderInt("Blue Potion Mana: %d", "##BLUEPOTIONMANA", "gBluePotionMana", 1, 100, "", 0, true, disabledBluePotion, disabledTooltipBluePotion); + UIWidgets::EnhancementSliderInt("Blue Potion Mana: %d", "##BLUEPOTIONMANA", CVAR_ENHANCEMENT("BluePotionMana"), 1, 100, "", 0, true, disabledBluePotion, disabledTooltipBluePotion); UIWidgets::Tooltip("Changes the amount of mana restored by Blue Potions, base max mana is 48, max upgraded mana is 96"); - UIWidgets::EnhancementCheckbox("Blue Potion Mana Percent Restore", "gBlueManaPercentRestore", disabledBluePotion, disabledTooltipBluePotion); + UIWidgets::EnhancementCheckbox("Blue Potion Mana Percent Restore", CVAR_ENHANCEMENT("BlueManaPercentRestore"), disabledBluePotion, disabledTooltipBluePotion); UIWidgets::Tooltip("Toggles from Blue Potions restoring a fixed amount of mana to a percent of the player's current max mana"); ImGui::Separator(); - UIWidgets::EnhancementCheckbox("Change Milk Effect", "gMilkEffect"); + UIWidgets::EnhancementCheckbox("Change Milk Effect", CVAR_ENHANCEMENT("MilkEffect")); UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Milk"); - bool disabledMilk = !CVarGetInteger("gMilkEffect", 0); + bool disabledMilk = !CVarGetInteger(CVAR_ENHANCEMENT("MilkEffect"), 0); static const char* disabledTooltipMilk = "This option is disabled because \"Change Milk Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Milk Health: %d", "##MILKHEALTH", "gMilkHealth", 1, 100, "", 0, true, disabledMilk, disabledTooltipMilk); + UIWidgets::EnhancementSliderInt("Milk Health: %d", "##MILKHEALTH", CVAR_ENHANCEMENT("MilkHealth"), 1, 100, "", 0, true, disabledMilk, disabledTooltipMilk); UIWidgets::Tooltip("Changes the amount of health restored by Milk"); - UIWidgets::EnhancementCheckbox("Milk Percent Restore", "gMilkPercentRestore", disabledMilk, disabledTooltipMilk); + UIWidgets::EnhancementCheckbox("Milk Percent Restore", CVAR_ENHANCEMENT("MilkPercentRestore"), disabledMilk, disabledTooltipMilk); UIWidgets::Tooltip("Toggles from Milk restoring a fixed amount of health to a percent of the player's current max health"); ImGui::Separator(); - UIWidgets::EnhancementCheckbox("Separate Half Milk Effect", "gSeparateHalfMilkEffect", disabledMilk, disabledTooltipMilk); + UIWidgets::EnhancementCheckbox("Separate Half Milk Effect", CVAR_ENHANCEMENT("SeparateHalfMilkEffect"), disabledMilk, disabledTooltipMilk); UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Half Milk\nIf this is disabled, Half Milk will behave the same as Full Milk."); - bool disabledHalfMilk = disabledMilk || !CVarGetInteger("gSeparateHalfMilkEffect", 0); + bool disabledHalfMilk = disabledMilk || !CVarGetInteger(CVAR_ENHANCEMENT("SeparateHalfMilkEffect"), 0); static const char* disabledTooltipHalfMilk = "This option is disabled because \"Separate Half Milk Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Half Milk Health: %d", "##HALFMILKHEALTH", "gHalfMilkHealth", 1, 100, "", 0, true, disabledHalfMilk, disabledTooltipHalfMilk); + UIWidgets::EnhancementSliderInt("Half Milk Health: %d", "##HALFMILKHEALTH", CVAR_ENHANCEMENT("HalfMilkHealth"), 1, 100, "", 0, true, disabledHalfMilk, disabledTooltipHalfMilk); UIWidgets::Tooltip("Changes the amount of health restored by Half Milk"); - UIWidgets::EnhancementCheckbox("Half Milk Percent Restore", "gHalfMilkPercentRestore", disabledHalfMilk, disabledTooltipHalfMilk); + UIWidgets::EnhancementCheckbox("Half Milk Percent Restore", CVAR_ENHANCEMENT("HalfMilkPercentRestore"), disabledHalfMilk, disabledTooltipHalfMilk); UIWidgets::Tooltip("Toggles from Half Milk restoring a fixed amount of health to a percent of the player's current max health"); ImGui::Separator(); - UIWidgets::EnhancementCheckbox("Change Fairy Effect", "gFairyEffect"); + UIWidgets::EnhancementCheckbox("Change Fairy Effect", CVAR_ENHANCEMENT("FairyEffect")); UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairies"); - bool disabledFairy = !CVarGetInteger("gFairyEffect", 0); + bool disabledFairy = !CVarGetInteger(CVAR_ENHANCEMENT("FairyEffect"), 0); static const char* disabledTooltipFairy = "This option is disabled because \"Change Fairy Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Fairy: %d", "##FAIRYHEALTH", "gFairyHealth", 1, 100, "", 0, true, disabledFairy, disabledTooltipFairy); + UIWidgets::EnhancementSliderInt("Fairy: %d", "##FAIRYHEALTH", CVAR_ENHANCEMENT("FairyHealth"), 1, 100, "", 0, true, disabledFairy, disabledTooltipFairy); UIWidgets::Tooltip("Changes the amount of health restored by Fairies"); - UIWidgets::EnhancementCheckbox("Fairy Percent Restore", "gFairyPercentRestore", disabledFairy, disabledTooltipFairy); + UIWidgets::EnhancementCheckbox("Fairy Percent Restore", CVAR_ENHANCEMENT("FairyPercentRestore"), disabledFairy, disabledTooltipFairy); UIWidgets::Tooltip("Toggles from Fairies restoring a fixed amount of health to a percent of the player's current max health"); ImGui::Separator(); - UIWidgets::EnhancementCheckbox("Change Fairy Revive Effect", "gFairyReviveEffect"); + UIWidgets::EnhancementCheckbox("Change Fairy Revive Effect", CVAR_ENHANCEMENT("FairyReviveEffect")); UIWidgets::Tooltip("Enable the following changes to the amount of health restored by Fairy Revivals"); - bool disabledFairyRevive = !CVarGetInteger("gFairyReviveEffect", 0); + bool disabledFairyRevive = !CVarGetInteger(CVAR_ENHANCEMENT("FairyReviveEffect"), 0); static const char* disabledTooltipFairyRevive = "This option is disabled because \"Change Fairy Revive Effect\" is turned off"; - UIWidgets::EnhancementSliderInt("Fairy Revival: %d", "##FAIRYREVIVEHEALTH", "gFairyReviveHealth", 1, 100, "", 0, true, disabledFairyRevive, disabledTooltipFairyRevive); + UIWidgets::EnhancementSliderInt("Fairy Revival: %d", "##FAIRYREVIVEHEALTH", CVAR_ENHANCEMENT("FairyReviveHealth"), 1, 100, "", 0, true, disabledFairyRevive, disabledTooltipFairyRevive); UIWidgets::Tooltip("Changes the amount of health restored by Fairy Revivals"); - UIWidgets::EnhancementCheckbox("Fairy Revive Percent Restore", "gFairyRevivePercentRestore", disabledFairyRevive, disabledTooltipFairyRevive); + UIWidgets::EnhancementCheckbox("Fairy Revive Percent Restore", CVAR_ENHANCEMENT("FairyRevivePercentRestore"), disabledFairyRevive, disabledTooltipFairyRevive); UIWidgets::Tooltip("Toggles from Fairy Revivals restoring a fixed amount of health to a percent of the player's current max health"); ImGui::EndMenu(); @@ -895,17 +887,17 @@ void DrawEnhancementsMenu() { UIWidgets::Spacer(0); if (ImGui::BeginMenu("Shooting Gallery")) { - UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeShootingGallery"); + UIWidgets::EnhancementCheckbox("Customize Behavior", CVAR_ENHANCEMENT("CustomizeShootingGallery")); UIWidgets::Tooltip("Turn on/off changes to the shooting gallery behavior"); - bool disabled = !CVarGetInteger("gCustomizeShootingGallery", 0); + bool disabled = !CVarGetInteger(CVAR_ENHANCEMENT("CustomizeShootingGallery"), 0); static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off"; - UIWidgets::PaddedEnhancementCheckbox("Instant Win", "gInstantShootingGalleryWin", true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementCheckbox("Instant Win", CVAR_ENHANCEMENT("InstantShootingGalleryWin"), true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Skips the shooting gallery minigame"); - UIWidgets::PaddedEnhancementCheckbox("No Rupee Randomization", "gConstantAdultGallery", true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementCheckbox("No Rupee Randomization", CVAR_ENHANCEMENT("ConstantAdultGallery"), true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Forces the rupee order to not be randomized as adult, making it the same as chlid"); - UIWidgets::PaddedEnhancementSliderInt("Child Starting Ammunition: %d", "##cShootingGalleryAmmunition", "gChildShootingGalleryAmmunition", 10, 30, "", 15, true, true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementSliderInt("Child Starting Ammunition: %d", "##cShootingGalleryAmmunition", CVAR_ENHANCEMENT("ShootingGalleryAmmoChild"), 10, 30, "", 15, true, true, false, disabled, disabledTooltip); UIWidgets::Tooltip("The ammunition at the start of the shooting gallery minigame as a child"); - UIWidgets::PaddedEnhancementSliderInt("Adult Starting Ammunition: %d", "##aShootingGalleryAmmunition", "gAdultShootingGalleryAmmunition", 10, 30, "", 15, true, true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementSliderInt("Adult Starting Ammunition: %d", "##aShootingGalleryAmmunition", CVAR_ENHANCEMENT("ShootingGalleryAmmoAdult"), 10, 30, "", 15, true, true, false, disabled, disabledTooltip); UIWidgets::Tooltip("The ammunition at the start of the shooting gallery minigame as an adult"); ImGui::EndMenu(); } @@ -913,15 +905,15 @@ void DrawEnhancementsMenu() { UIWidgets::Spacer(0); if (ImGui::BeginMenu("Bombchu Bowling")) { - UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeBombchuBowling"); + UIWidgets::EnhancementCheckbox("Customize Behavior", CVAR_ENHANCEMENT("CustomizeBombchuBowling")); UIWidgets::Tooltip("Turn on/off changes to the bombchu bowling behavior"); - bool disabled = CVarGetInteger("gCustomizeBombchuBowling", 0) == 0; + bool disabled = CVarGetInteger(CVAR_ENHANCEMENT("CustomizeBombchuBowling"), 0) == 0; static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off"; - UIWidgets::PaddedEnhancementCheckbox("Remove Small Cucco", "gBombchuBowlingNoSmallCucco", true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementCheckbox("Remove Small Cucco", CVAR_ENHANCEMENT("BombchuBowlingNoSmallCucco"), true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Prevents the small cucco from appearing in the bombchu bowling minigame"); - UIWidgets::PaddedEnhancementCheckbox("Remove Big Cucco", "gBombchuBowlingNoBigCucco", true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementCheckbox("Remove Big Cucco", CVAR_ENHANCEMENT("BombchuBowlingNoBigCucco"), true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Prevents the big cucco from appearing in the bombchu bowling minigame"); - UIWidgets::PaddedEnhancementSliderInt("Bombchu Count: %d", "##cBombchuBowlingAmmunition", "gBombchuBowlingAmmunition", 3, 20, "", 10, true, true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementSliderInt("Bombchu Count: %d", "##cBombchuBowlingAmmunition", CVAR_ENHANCEMENT("BombchuBowlingAmmo"), 3, 20, "", 10, true, true, false, disabled, disabledTooltip); UIWidgets::Tooltip("The number of bombchus available at the start of the bombchu bowling minigame"); ImGui::EndMenu(); } @@ -929,55 +921,55 @@ void DrawEnhancementsMenu() { UIWidgets::Spacer(0); if (ImGui::BeginMenu("Fishing")) { - UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeFishing"); + UIWidgets::EnhancementCheckbox("Customize Behavior", CVAR_ENHANCEMENT("CustomizeFishing")); UIWidgets::Tooltip("Turn on/off changes to the fishing behavior"); - bool disabled = !CVarGetInteger("gCustomizeFishing", 0); + bool disabled = !CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0); static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off"; - UIWidgets::PaddedEnhancementCheckbox("Instant Fishing", "gInstantFishing", true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementCheckbox("Instant Fishing", CVAR_ENHANCEMENT("InstantFishing"), true, false, disabled, disabledTooltip); UIWidgets::Tooltip("All fish will be caught instantly"); - UIWidgets::PaddedEnhancementCheckbox("Guarantee Bite", "gGuaranteeFishingBite", true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementCheckbox("Guarantee Bite", CVAR_ENHANCEMENT("GuaranteeFishingBite"), true, false, disabled, disabledTooltip); UIWidgets::Tooltip("When a line is stable, guarantee bite. Otherwise use default logic"); - UIWidgets::PaddedEnhancementCheckbox("Fish Never Escape", "gFishNeverEscape", true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementCheckbox("Fish Never Escape", CVAR_ENHANCEMENT("FishNeverEscape"), true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Once a hook has been set, fish will never let go while being reeled in."); - UIWidgets::PaddedEnhancementCheckbox("Loaches Always Appear", "gLoachesAlwaysAppear", true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementCheckbox("Loaches Always Appear", CVAR_ENHANCEMENT("LoachesAlwaysAppear"), true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Loaches will always appear in the fishing pond instead of every four visits."); - UIWidgets::PaddedEnhancementCheckbox("Skip Keep Confirmation", "gSkipKeepConfirmation", true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementCheckbox("Skip Keep Confirmation", CVAR_ENHANCEMENT("SkipKeepConfirmation"), true, false, disabled, disabledTooltip); UIWidgets::Tooltip("The pond owner will not ask to confirm if you want to keep a smaller fish."); - UIWidgets::PaddedEnhancementSliderInt("Child Minimum Weight: %d", "##cMinimumWeight", "gChildMinimumWeightFish", 3, 10, "", 10, true, true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementSliderInt("Child Minimum Weight: %d", "##cMinimumWeight", CVAR_ENHANCEMENT("MinimumFishWeightChild"), 3, 10, "", 10, true, true, false, disabled, disabledTooltip); UIWidgets::Tooltip("The minimum weight for the unique fishing reward as a child"); - UIWidgets::PaddedEnhancementSliderInt("Adult Minimum Weight: %d", "##aMinimumWeight", "gAdultMinimumWeightFish", 6, 13, "", 13, true, true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementSliderInt("Adult Minimum Weight: %d", "##aMinimumWeight", CVAR_ENHANCEMENT("MinimumFishWeightAdult"), 6, 13, "", 13, true, true, false, disabled, disabledTooltip); UIWidgets::Tooltip("The minimum weight for the unique fishing reward as an adult"); ImGui::EndMenu(); } UIWidgets::Spacer(0); if (ImGui::BeginMenu("Lost Woods Ocarina Game")) { - UIWidgets::EnhancementCheckbox("Customize Behavior", "gCustomizeOcarinaGame"); + UIWidgets::EnhancementCheckbox("Customize Behavior", CVAR_ENHANCEMENT("CustomizeOcarinaGame")); UIWidgets::Tooltip("Turn on/off changes to the lost woods ocarina game behavior"); - bool disabled = !CVarGetInteger("gCustomizeOcarinaGame", 0); + bool disabled = !CVarGetInteger(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 0); static const char* disabledTooltip = "This option is disabled because \"Customize Behavior\" is turned off"; - UIWidgets::PaddedEnhancementCheckbox("Instant Win", "gInstantOcarinaGameWin", true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementCheckbox("Instant Win", CVAR_ENHANCEMENT("InstantOcarinaGameWin"), true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Skips the lost woods ocarina game"); - UIWidgets::PaddedEnhancementSliderInt("Note Play Speed: %dx", "##OcarinaGameNoteSpeed", "gOcarinaGameNoteSpeed", 1, 5, "", 1, true, true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementSliderInt("Note Play Speed: %dx", "##OcarinaGameNoteSpeed", CVAR_ENHANCEMENT("OcarinaGame.NoteSpeed"), 1, 5, "", 1, true, true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Adjust the speed that the skull kids play notes"); - UIWidgets::PaddedEnhancementCheckbox("Unlimited Playback Time", "gOcarinaUnlimitedFailTime", true, false, disabled, disabledTooltip); + UIWidgets::PaddedEnhancementCheckbox("Unlimited Playback Time", CVAR_ENHANCEMENT("OcarinaUnlimitedFailTime"), true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Removes the timer to play back the song"); - UIWidgets::PaddedEnhancementSliderInt("Number of Starting Notes: %d", "##OcarinaGameStartingNotes", "gOcarinaGameStartingNotes", 1, 8, "", 3, true, true, false, + UIWidgets::PaddedEnhancementSliderInt("Number of Starting Notes: %d", "##OcarinaGameStartingNotes", CVAR_ENHANCEMENT("OcarinaGame.StartingNotes"), 1, 8, "", 3, true, true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Adjust the number of notes the skull kids play to start the first round"); - int roundMin = CVarGetInteger("gOcarinaGameStartingNotes", 3); + int roundMin = CVarGetInteger(CVAR_ENHANCEMENT("OcarinaGame.StartingNotes"), 3); UIWidgets::PaddedEnhancementSliderInt("Round One Notes: %d", "##OcarinaGameRoundOne", - "gOcarinaGameRoundOneNotes", roundMin, 8, "", 5, true, true, + CVAR_ENHANCEMENT("OcarinaGame.RoundOneNotes"), roundMin, 8, "", 5, true, true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Adjust the number of notes you need to play to end the first round"); UIWidgets::PaddedEnhancementSliderInt("Round Two Notes: %d", "##OcarinaGameRoundTwoNotes", - "gOcarinaGameRoundTwoNotes", roundMin, 8, "", 6, true, true, + CVAR_ENHANCEMENT("OcarinaGame.RoundTwoNotes"), roundMin, 8, "", 6, true, true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Adjust the number of notes you need to play to end the second round"); UIWidgets::PaddedEnhancementSliderInt("Round Three Notes: %d", "##OcarinaGameRoundThreeNotes", - "gOcarinaGameRoundThreeNotes", roundMin, 8, "", 8, true, true, + CVAR_ENHANCEMENT("OcarinaGame.RoundThreeNotes"), roundMin, 8, "", 8, true, true, false, disabled, disabledTooltip); UIWidgets::Tooltip("Adjust the number of notes you need to play to end the third round"); @@ -986,16 +978,16 @@ void DrawEnhancementsMenu() { UIWidgets::Spacer(0); - UIWidgets::PaddedEnhancementCheckbox("Delete File On Death", "gDeleteFileOnDeath", true, false); + UIWidgets::PaddedEnhancementCheckbox("Delete File On Death", CVAR_ENHANCEMENT("DeleteFileOnDeath"), true, false); ImGui::PushStyleColor(ImGuiCol_Text, ImVec4(1.0f, 0.0f, 0.0f, 1.0f)); UIWidgets::Tooltip("Dying will delete your file\n\n " ICON_FA_EXCLAMATION_TRIANGLE " WARNING " ICON_FA_EXCLAMATION_TRIANGLE "\nTHIS IS NOT REVERSABLE\nUSE AT YOUR OWN RISK!"); ImGui::PopStyleColor(); - if (UIWidgets::PaddedEnhancementCheckbox("Permanent heart loss", "gPermanentHeartLoss", true, false)) { + if (UIWidgets::PaddedEnhancementCheckbox("Permanent heart loss", CVAR_ENHANCEMENT("PermanentHeartLoss"), true, false)) { UpdatePermanentHeartLossState(); } UIWidgets::Tooltip("When you lose 4 quarters of a heart you will permanently lose that heart container.\n\nDisabling this after the fact will restore your heart containers."); ImGui::Text("Damage Multiplier"); - UIWidgets::EnhancementCombobox("gDamageMul", allPowers, 0); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("DamageMult"), allPowers, 0); UIWidgets::Tooltip( "Modifies all sources of damage not affected by other sliders\n" "2x: Can survive all common attacks from the start of the game\n" @@ -1008,7 +1000,7 @@ void DrawEnhancementsMenu() { "256x: Cannot survive damage" ); UIWidgets::PaddedText("Fall Damage Multiplier", true, false); - UIWidgets::EnhancementCombobox("gFallDamageMul", subPowers, 0); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("FallDamageMult"), subPowers, 0); UIWidgets::Tooltip( "Modifies all fall damage\n" "2x: Can survive all fall damage from the start of the game\n" @@ -1020,7 +1012,7 @@ void DrawEnhancementsMenu() { "128x: Cannot survive fall damage" ); UIWidgets::PaddedText("Void Damage Multiplier", true, false); - UIWidgets::EnhancementCombobox("gVoidDamageMul", subSubPowers, 0); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("VoidDamageMult"), subSubPowers, 0); UIWidgets::Tooltip( "Modifies damage taken after falling into a void\n" "2x: Can survive void damage from the start of the game\n" @@ -1031,41 +1023,41 @@ void DrawEnhancementsMenu() { "64x: Cannot survive void damage" ); UIWidgets::PaddedText("Bonk Damage Multiplier", true, false); - UIWidgets::EnhancementCombobox("gBonkDamageMul", bonkDamageValues, BONK_DAMAGE_NONE); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("BonkDamageMult"), bonkDamageValues, BONK_DAMAGE_NONE); UIWidgets::Tooltip("Modifies damage taken after bonking."); - UIWidgets::PaddedEnhancementCheckbox("Spawn with full health", "gFullHealthSpawn", true, false); + UIWidgets::PaddedEnhancementCheckbox("Spawn with full health", CVAR_ENHANCEMENT("FullHealthSpawn"), true, false); UIWidgets::Tooltip("Respawn with full health instead of 3 Hearts"); - UIWidgets::PaddedEnhancementCheckbox("No Random Drops", "gNoRandomDrops", true, false); + UIWidgets::PaddedEnhancementCheckbox("No Random Drops", CVAR_ENHANCEMENT("NoRandomDrops"), true, false); UIWidgets::Tooltip("Disables random drops, except from the Goron Pot, Dampe, and bosses"); bool forceEnableBombchuDrops = IS_RANDO && OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_ENABLE_BOMBCHU_DROPS) == 1; static const char* forceEnableBombchuDropsText = "This setting is forcefully enabled because a savefile\nwith \"Enable Bombchu Drops\" is loaded."; - UIWidgets::PaddedEnhancementCheckbox("Enable Bombchu Drops", "gBombchuDrops", true, false, + UIWidgets::PaddedEnhancementCheckbox("Enable Bombchu Drops", CVAR_ENHANCEMENT("BombchuDrops"), true, false, forceEnableBombchuDrops, forceEnableBombchuDropsText, UIWidgets::CheckboxGraphics::Checkmark); UIWidgets::Tooltip("Bombchus will sometimes drop in place of bombs"); - UIWidgets::PaddedEnhancementCheckbox("Trees Drop Sticks", "gTreeStickDrops", true, false); + UIWidgets::PaddedEnhancementCheckbox("Trees Drop Sticks", CVAR_ENHANCEMENT("TreesDropSticks"), true, false); UIWidgets::Tooltip("Bonking into trees will have a chance to drop up to 3 sticks. Must already have obtained sticks."); - UIWidgets::PaddedEnhancementCheckbox("No Heart Drops", "gNoHeartDrops", true, false); + UIWidgets::PaddedEnhancementCheckbox("No Heart Drops", CVAR_ENHANCEMENT("NoHeartDrops"), true, false); UIWidgets::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"); - if (UIWidgets::PaddedEnhancementCheckbox("Hyper Bosses", "gHyperBosses", true, false)) { + if (UIWidgets::PaddedEnhancementCheckbox("Hyper Bosses", CVAR_ENHANCEMENT("HyperBosses"), true, false)) { UpdateHyperBossesState(); } UIWidgets::Tooltip("All major bosses move and act twice as fast."); - if (UIWidgets::PaddedEnhancementCheckbox("Hyper Enemies", "gHyperEnemies", true, false)) { + if (UIWidgets::PaddedEnhancementCheckbox("Hyper Enemies", CVAR_ENHANCEMENT("HyperEnemies"), true, false)) { UpdateHyperEnemiesState(); } UIWidgets::Tooltip("All regular enemies and mini-bosses move and act twice as fast."); - UIWidgets::PaddedEnhancementCheckbox("Always Win Goron Pot", "gGoronPot", true, false); + UIWidgets::PaddedEnhancementCheckbox("Always Win Goron Pot", CVAR_ENHANCEMENT("GoronPot"), true, false); UIWidgets::Tooltip("Always get the heart piece/purple rupee from the spinning Goron pot"); - UIWidgets::PaddedEnhancementCheckbox("Always Win Dampe Digging Game", "gDampeWin", true, false, SaveManager::Instance->IsRandoFile(), + UIWidgets::PaddedEnhancementCheckbox("Always Win Dampe Digging Game", CVAR_ENHANCEMENT("DampeWin"), true, false, SaveManager::Instance->IsRandoFile(), "This setting is always enabled in randomizer files", UIWidgets::CheckboxGraphics::Checkmark); UIWidgets::Tooltip("Always win the heart piece/purple rupee on the first dig in Dampe's grave digging game, just like in rando\nIn a rando file, this is unconditionally enabled"); - UIWidgets::PaddedEnhancementCheckbox("All Dogs are Richard", "gAllDogsRichard", true, false); + UIWidgets::PaddedEnhancementCheckbox("All Dogs are Richard", CVAR_ENHANCEMENT("AllDogsRichard"), true, false); UIWidgets::Tooltip("All dogs can be traded in and will count as Richard."); - UIWidgets::PaddedEnhancementSliderInt("Cuccos Stay Put Multiplier: %dx", "##CuccoStayDurationMultiplier", "gCuccoStayDurationMultiplier", 1, 5, "", 1, true, true, false); + UIWidgets::PaddedEnhancementSliderInt("Cuccos Stay Put Multiplier: %dx", "##CuccoStayDurationMultiplier", CVAR_ENHANCEMENT("CuccoStayDurationMult"), 1, 5, "", 1, true, true, false); UIWidgets::Tooltip("Cuccos will stay in place longer after putting them down, by a multiple of the value of the slider."); - UIWidgets::PaddedEnhancementSliderInt("Leever Spawn Rate: %d seconds", "##LeeverSpawnRate", "gEnhancements.LeeverSpawnRate", 0, 10, "", 0, true, true, false); + UIWidgets::PaddedEnhancementSliderInt("Leever Spawn Rate: %d seconds", "##LeeverSpawnRate", CVAR_ENHANCEMENT("LeeverSpawnRate"), 0, 10, "", 0, true, true, false); UIWidgets::Tooltip("The time between leever groups spawning."); ImGui::EndMenu(); @@ -1075,15 +1067,15 @@ void DrawEnhancementsMenu() { if (ImGui::BeginMenu("Reduced Clutter")) { - UIWidgets::EnhancementCheckbox("Mute Low HP Alarm", "gLowHpAlarm"); + UIWidgets::EnhancementCheckbox("Mute Low HP Alarm", CVAR_ENHANCEMENT("LowHpAlarm")); UIWidgets::Tooltip("Disable the low HP beeping sound"); - UIWidgets::PaddedEnhancementCheckbox("Minimal UI", "gMinimalUI", true, false); + UIWidgets::PaddedEnhancementCheckbox("Minimal UI", CVAR_ENHANCEMENT("MinimalUI"), true, false); UIWidgets::Tooltip("Hides most of the UI when not needed\nNote: Doesn't activate until after loading a new scene"); - UIWidgets::PaddedEnhancementCheckbox("Disable Navi Call Audio", "gDisableNaviCallAudio", true, false); + UIWidgets::PaddedEnhancementCheckbox("Disable Navi Call Audio", CVAR_ENHANCEMENT("DisableNaviCallAudio"), true, false); UIWidgets::Tooltip("Disables the voice audio when Navi calls you"); - UIWidgets::PaddedEnhancementCheckbox("Disable Hot/Underwater Warning Text", "gDisableTunicWarningText", true, false); + UIWidgets::PaddedEnhancementCheckbox("Disable Hot/Underwater Warning Text", CVAR_ENHANCEMENT("DisableTunicWarningText"), true, false); UIWidgets::Tooltip("Disables warning text when you don't have on the Goron/Zora Tunic in Hot/Underwater conditions."); - UIWidgets::PaddedEnhancementCheckbox("Remember Minimap State Between Areas", "gEnhancements.RememberMapToggleState"); + UIWidgets::PaddedEnhancementCheckbox("Remember Minimap State Between Areas", CVAR_ENHANCEMENT("RememberMapToggleState")); UIWidgets::Tooltip("Preserves the minimap visibility state when going between areas rather than defaulting it to \"on\" when going through loading zones."); ImGui::EndMenu(); @@ -1091,15 +1083,15 @@ void DrawEnhancementsMenu() { UIWidgets::Spacer(0); - UIWidgets::EnhancementCheckbox("Visual Stone of Agony", "gVisualAgony"); + UIWidgets::EnhancementCheckbox("Visual Stone of Agony", CVAR_ENHANCEMENT("VisualAgony")); UIWidgets::Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble"); - UIWidgets::PaddedEnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots", true, false); + UIWidgets::PaddedEnhancementCheckbox("Assignable Tunics and Boots", CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), true, false); UIWidgets::Tooltip("Allows equipping the tunic and boots to c-buttons"); - UIWidgets::PaddedEnhancementCheckbox("Equipment Toggle", "gEquipmentCanBeRemoved", true, false); + UIWidgets::PaddedEnhancementCheckbox("Equipment Toggle", CVAR_ENHANCEMENT("EquipmentCanBeRemoved"), true, false); UIWidgets::Tooltip("Allows equipment to be removed by toggling it off on\nthe equipment subscreen."); - if (CVarGetInteger("gEquipmentCanBeRemoved", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("EquipmentCanBeRemoved"), 0)) { UIWidgets::PaddedText("Sword Toggle Options", true, false); - UIWidgets::EnhancementCombobox("gEnhancements.SwordToggle", swordToggleModes, SWORD_TOGGLE_NONE); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("SwordToggle"), swordToggleModes, SWORD_TOGGLE_NONE); UIWidgets::Tooltip( "Introduces Options for unequipping Link's sword\n\n" "None: Only Biggoron's Sword/Giant's Knife can be toggled. Doing so will equip the Master Sword.\n\n" @@ -1108,17 +1100,17 @@ void DrawEnhancementsMenu() { ); } - UIWidgets::PaddedEnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime", true, false); + UIWidgets::PaddedEnhancementCheckbox("Link's Cow in Both Time Periods", CVAR_ENHANCEMENT("CowOfTime"), true, false); UIWidgets::Tooltip("Allows the Lon Lon Ranch obstacle course reward to be shared across time periods"); - UIWidgets::PaddedEnhancementCheckbox("Enable visible guard vision", "gGuardVision", true, false); - UIWidgets::PaddedEnhancementCheckbox("Enable passage of time on file select", "gTimeFlowFileSelect", true, false); - UIWidgets::PaddedEnhancementCheckbox("Item counts in messages", "gInjectItemCounts", true, false); + UIWidgets::PaddedEnhancementCheckbox("Enable visible guard vision", CVAR_ENHANCEMENT("GuardVision"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Enable passage of time on file select", CVAR_ENHANCEMENT("TimeFlowFileSelect"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Item counts in messages", CVAR_ENHANCEMENT("InjectItemCounts"), true, false); UIWidgets::Tooltip("Injects item counts in pickup messages, like golden skulltula tokens and heart pieces"); - UIWidgets::PaddedEnhancementCheckbox("Pull grave during the day", "gDayGravePull", true, false); + UIWidgets::PaddedEnhancementCheckbox("Pull grave during the day", CVAR_ENHANCEMENT("DayGravePull"), true, false); UIWidgets::Tooltip("Allows graves to be pulled when child during the day"); - UIWidgets::PaddedEnhancementCheckbox("Dogs follow you everywhere", "gDogFollowsEverywhere", true, false); + UIWidgets::PaddedEnhancementCheckbox("Dogs follow you everywhere", CVAR_ENHANCEMENT("DogFollowsEverywhere"), true, false); UIWidgets::Tooltip("Allows dogs to follow you anywhere you go, even if you leave the market"); - UIWidgets::PaddedEnhancementCheckbox("Don't require input for Credits sequence", "gNoInputForCredits", true, false); + UIWidgets::PaddedEnhancementCheckbox("Don't require input for Credits sequence", CVAR_ENHANCEMENT("NoInputForCredits"), true, false); UIWidgets::Tooltip("Removes the input requirement on textboxes after defeating Ganon, allowing Credits sequence to continue to progress"); // Blue Fire Arrows @@ -1126,7 +1118,7 @@ void DrawEnhancementsMenu() { OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_BLUE_FIRE_ARROWS); static const char* forceEnableBlueFireArrowsText = "This setting is forcefully enabled because a savefile\nwith \"Blue Fire Arrows\" is loaded."; - UIWidgets::PaddedEnhancementCheckbox("Blue Fire Arrows", "gBlueFireArrows", true, false, + UIWidgets::PaddedEnhancementCheckbox("Blue Fire Arrows", CVAR_ENHANCEMENT("BlueFireArrows"), true, false, forceEnableBlueFireArrows, forceEnableBlueFireArrowsText, UIWidgets::CheckboxGraphics::Checkmark); UIWidgets::Tooltip("Allows Ice Arrows to melt red ice.\nMay require a room reload if toggled during gameplay."); @@ -1135,16 +1127,16 @@ void DrawEnhancementsMenu() { OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_SUNLIGHT_ARROWS); static const char* forceEnableSunLightArrowsText = "This setting is forcefully enabled because a savefile\nwith \"Sunlight Arrows\" is loaded."; - UIWidgets::PaddedEnhancementCheckbox("Sunlight Arrows", "gSunlightArrows", true, false, + UIWidgets::PaddedEnhancementCheckbox("Sunlight Arrows", CVAR_ENHANCEMENT("SunlightArrows"), true, false, forceEnableSunLightArrows, forceEnableSunLightArrowsText, UIWidgets::CheckboxGraphics::Checkmark); UIWidgets::Tooltip("Allows Light Arrows to activate sun switches.\nMay require a room reload if toggled during gameplay."); - UIWidgets::PaddedEnhancementCheckbox("Disable Crit wiggle", "gDisableCritWiggle", true, false); + UIWidgets::PaddedEnhancementCheckbox("Disable Crit wiggle", CVAR_ENHANCEMENT("DisableCritWiggle"), true, false); UIWidgets::Tooltip("Disable random camera wiggle at low health"); - UIWidgets::PaddedEnhancementCheckbox("Enemy Health Bars", "gEnemyHealthBar", true, false); + UIWidgets::PaddedEnhancementCheckbox("Enemy Health Bars", CVAR_ENHANCEMENT("EnemyHealthBar"), true, false); UIWidgets::Tooltip("Renders a health bar for enemies when Z-Targeted"); - UIWidgets::PaddedEnhancementCheckbox("Targetable Hookshot Reticle", "gHookshotableReticle", true, false); + UIWidgets::PaddedEnhancementCheckbox("Targetable Hookshot Reticle", CVAR_ENHANCEMENT("HookshotableReticle"), true, false); UIWidgets::Tooltip("Use a different color when aiming at hookshotable collision"); ImGui::EndMenu(); @@ -1155,20 +1147,20 @@ void DrawEnhancementsMenu() { if (ImGui::BeginMenu("Graphics")) { if (ImGui::BeginMenu("Mods")) { - if (UIWidgets::PaddedEnhancementCheckbox("Use Alternate Assets", "gAltAssets", false, false)) { + if (UIWidgets::PaddedEnhancementCheckbox("Use Alternate Assets", CVAR_ALT_ASSETS, false, false)) { // The checkbox will flip the alt asset CVar, but we instead want it to change at the end of the game frame // We toggle it back while setting the flag to update the CVar later - CVarSetInteger("gAltAssets", !CVarGetInteger("gAltAssets", 0)); + CVarSetInteger(CVAR_ALT_ASSETS, !CVarGetInteger(CVAR_ALT_ASSETS, 0)); ToggleAltAssetsAtEndOfFrame = true; } UIWidgets::Tooltip("Toggle between standard assets and alternate assets. Usually mods will indicate if this setting has to be used or not."); - UIWidgets::PaddedEnhancementCheckbox("Disable Bomb Billboarding", "gDisableBombBillboarding", true, false); + UIWidgets::PaddedEnhancementCheckbox("Disable Bomb Billboarding", CVAR_ENHANCEMENT("DisableBombBillboarding"), true, false); UIWidgets::Tooltip("Disables bombs always rotating to face the camera. To be used in conjunction with mods that want to replace bombs with 3D objects."); - UIWidgets::PaddedEnhancementCheckbox("Disable Grotto Fixed Rotation", "gDisableGrottoRotation", true, false); + UIWidgets::PaddedEnhancementCheckbox("Disable Grotto Fixed Rotation", CVAR_ENHANCEMENT("DisableGrottoRotation"), true, false); UIWidgets::Tooltip("Disables grottos rotating with the camera. To be used in conjunction with mods that want to replace grottos with 3D objects."); - UIWidgets::PaddedEnhancementCheckbox("Invisible Bunny Hood", "gHideBunnyHood", true, false); + UIWidgets::PaddedEnhancementCheckbox("Invisible Bunny Hood", CVAR_ENHANCEMENT("HideBunnyHood"), true, false); UIWidgets::Tooltip("Turns Bunny Hood invisible while still maintaining its effects."); - UIWidgets::PaddedEnhancementCheckbox("Disable HUD Heart animations", "gNoHUDHeartAnimation", true, false); + UIWidgets::PaddedEnhancementCheckbox("Disable HUD Heart animations", CVAR_ENHANCEMENT("NoHUDHeartAnimation"), true, false); UIWidgets::Tooltip("Disables the beating animation of the hearts on the HUD."); ImGui::EndMenu(); @@ -1178,43 +1170,43 @@ void DrawEnhancementsMenu() { if (ImGui::BeginMenu("Animated Link in Pause Menu")) { ImGui::Text("Rotation"); - UIWidgets::EnhancementRadioButton("Disabled", "gPauseLiveLinkRotation", 0); - UIWidgets::EnhancementRadioButton("Rotate Link with D-pad", "gPauseLiveLinkRotation", 1); + UIWidgets::EnhancementRadioButton("Disabled", CVAR_ENHANCEMENT("PauseLiveLinkRotation"), 0); + UIWidgets::EnhancementRadioButton("Rotate Link with D-pad", CVAR_ENHANCEMENT("PauseLiveLinkRotation"), 1); UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the D-pad\nUse D-pad Up or D-pad Down to reset Link's rotation"); - UIWidgets::EnhancementRadioButton("Rotate Link with C-buttons", "gPauseLiveLinkRotation", 2); + UIWidgets::EnhancementRadioButton("Rotate Link with C-buttons", CVAR_ENHANCEMENT("PauseLiveLinkRotation"), 2); UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the C-buttons\nUse C-Up or C-Down to reset Link's rotation"); - UIWidgets::EnhancementRadioButton("Rotate Link with Right Stick", "gPauseLiveLinkRotation", 3); + UIWidgets::EnhancementRadioButton("Rotate Link with Right Stick", CVAR_ENHANCEMENT("PauseLiveLinkRotation"), 3); UIWidgets::Tooltip("Allow you to rotate Link on the Equipment menu with the Right Stick\nYou can zoom in by pointing up and reset Link's rotation by pointing down"); - if (CVarGetInteger("gPauseLiveLinkRotation", 0) != 0) { - UIWidgets::EnhancementSliderInt("Rotation Speed: %d", "##MinRotationSpeed", "gPauseLiveLinkRotationSpeed", 1, 20, "", 1); + if (CVarGetInteger(CVAR_ENHANCEMENT("PauseLiveLinkRotation"), 0) != 0) { + UIWidgets::EnhancementSliderInt("Rotation Speed: %d", "##MinRotationSpeed", CVAR_ENHANCEMENT("PauseLiveLinkRotationSpeed"), 1, 20, "", 1); } UIWidgets::PaddedSeparator(); ImGui::Text("Static loop"); - UIWidgets::EnhancementRadioButton("Disabled", "gPauseLiveLink", 0); - UIWidgets::EnhancementRadioButton("Idle (standing)", "gPauseLiveLink", 1); - UIWidgets::EnhancementRadioButton("Idle (look around)", "gPauseLiveLink", 2); - UIWidgets::EnhancementRadioButton("Idle (belt)", "gPauseLiveLink", 3); - UIWidgets::EnhancementRadioButton("Idle (shield)", "gPauseLiveLink", 4); - UIWidgets::EnhancementRadioButton("Idle (test sword)", "gPauseLiveLink", 5); - UIWidgets::EnhancementRadioButton("Idle (yawn)", "gPauseLiveLink", 6); - UIWidgets::EnhancementRadioButton("Battle Stance", "gPauseLiveLink", 7); - UIWidgets::EnhancementRadioButton("Walking (no shield)", "gPauseLiveLink", 8); - UIWidgets::EnhancementRadioButton("Walking (holding shield)", "gPauseLiveLink", 9); - UIWidgets::EnhancementRadioButton("Running (no shield)", "gPauseLiveLink", 10); - UIWidgets::EnhancementRadioButton("Running (holding shield)", "gPauseLiveLink", 11); - UIWidgets::EnhancementRadioButton("Hand on hip", "gPauseLiveLink", 12); - UIWidgets::EnhancementRadioButton("Spin attack charge", "gPauseLiveLink", 13); - UIWidgets::EnhancementRadioButton("Look at hand", "gPauseLiveLink", 14); + UIWidgets::EnhancementRadioButton("Disabled", CVAR_ENHANCEMENT("PauseLiveLink"), 0); + UIWidgets::EnhancementRadioButton("Idle (standing)", CVAR_ENHANCEMENT("PauseLiveLink"), 1); + UIWidgets::EnhancementRadioButton("Idle (look around)", CVAR_ENHANCEMENT("PauseLiveLink"), 2); + UIWidgets::EnhancementRadioButton("Idle (belt)", CVAR_ENHANCEMENT("PauseLiveLink"), 3); + UIWidgets::EnhancementRadioButton("Idle (shield)", CVAR_ENHANCEMENT("PauseLiveLink"), 4); + UIWidgets::EnhancementRadioButton("Idle (test sword)", CVAR_ENHANCEMENT("PauseLiveLink"), 5); + UIWidgets::EnhancementRadioButton("Idle (yawn)", CVAR_ENHANCEMENT("PauseLiveLink"), 6); + UIWidgets::EnhancementRadioButton("Battle Stance", CVAR_ENHANCEMENT("PauseLiveLink"), 7); + UIWidgets::EnhancementRadioButton("Walking (no shield)", CVAR_ENHANCEMENT("PauseLiveLink"), 8); + UIWidgets::EnhancementRadioButton("Walking (holding shield)", CVAR_ENHANCEMENT("PauseLiveLink"), 9); + UIWidgets::EnhancementRadioButton("Running (no shield)", CVAR_ENHANCEMENT("PauseLiveLink"), 10); + UIWidgets::EnhancementRadioButton("Running (holding shield)", CVAR_ENHANCEMENT("PauseLiveLink"), 11); + UIWidgets::EnhancementRadioButton("Hand on hip", CVAR_ENHANCEMENT("PauseLiveLink"), 12); + UIWidgets::EnhancementRadioButton("Spin attack charge", CVAR_ENHANCEMENT("PauseLiveLink"), 13); + UIWidgets::EnhancementRadioButton("Look at hand", CVAR_ENHANCEMENT("PauseLiveLink"), 14); UIWidgets::PaddedSeparator(); ImGui::Text("Randomize"); - UIWidgets::EnhancementRadioButton("Random", "gPauseLiveLink", 15); + UIWidgets::EnhancementRadioButton("Random", CVAR_ENHANCEMENT("PauseLiveLink"), 15); UIWidgets::Tooltip("Randomize the animation played each time you open the menu"); - UIWidgets::EnhancementRadioButton("Random cycle", "gPauseLiveLink", 16); + UIWidgets::EnhancementRadioButton("Random cycle", CVAR_ENHANCEMENT("PauseLiveLink"), 16); UIWidgets::Tooltip("Randomize the animation played on the menu after a certain time"); - UIWidgets::EnhancementRadioButton("Random cycle (Idle)", "gPauseLiveLink", 17); + UIWidgets::EnhancementRadioButton("Random cycle (Idle)", CVAR_ENHANCEMENT("PauseLiveLink"), 17); UIWidgets::Tooltip("Randomize the animation played on the menu after a certain time (Idle animations only)"); - if (CVarGetInteger("gPauseLiveLink", 0) >= 16) { - UIWidgets::EnhancementSliderInt("Frame to wait: %d", "##MinFrameCount", "gMinFrameCount", 1, 1000, "", 0); + if (CVarGetInteger(CVAR_ENHANCEMENT("PauseLiveLink"), 0) >= 16) { + UIWidgets::EnhancementSliderInt("Frame to wait: %d", "##MinFrameCount", CVAR_ENHANCEMENT("MinFrameCount"), 1, 1000, "", 0); } ImGui::EndMenu(); @@ -1222,59 +1214,59 @@ void DrawEnhancementsMenu() { UIWidgets::Spacer(0); - UIWidgets::PaddedEnhancementCheckbox("Disable LOD", "gDisableLOD", true, false); + UIWidgets::PaddedEnhancementCheckbox("Disable LOD", CVAR_ENHANCEMENT("DisableLOD"), true, false); UIWidgets::Tooltip("Turns off the Level of Detail setting, making models use their higher-poly variants at any distance"); - if (UIWidgets::PaddedEnhancementCheckbox("Disable Draw Distance", "gDisableDrawDistance", true, false)) { - if (CVarGetInteger("gDisableDrawDistance", 0) == 0) { - CVarSetInteger("gDisableKokiriDrawDistance", 0); + if (UIWidgets::PaddedEnhancementCheckbox("Disable Draw Distance", CVAR_ENHANCEMENT("DisableDrawDistance"), true, false)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableDrawDistance"), 0) == 0) { + CVarSetInteger(CVAR_ENHANCEMENT("DisableKokiriDrawDistance"), 0); } } UIWidgets::Tooltip("Turns off the objects draw distance, making objects being visible from a longer range"); - if (CVarGetInteger("gDisableDrawDistance", 0) == 1) { - UIWidgets::PaddedEnhancementCheckbox("Kokiri Draw Distance", "gDisableKokiriDrawDistance", true, false); + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableDrawDistance"), 0) == 1) { + UIWidgets::PaddedEnhancementCheckbox("Kokiri Draw Distance", CVAR_ENHANCEMENT("DisableKokiriDrawDistance"), true, false); UIWidgets::Tooltip("The Kokiri are mystical beings that fade into view when approached\nEnabling this will remove their draw distance"); } - if (UIWidgets::PaddedEnhancementCheckbox("Show Age-Dependent Equipment", "gEnhancements.EquimentAlwaysVisible", true, + if (UIWidgets::PaddedEnhancementCheckbox("Show Age-Dependent Equipment", CVAR_ENHANCEMENT("EquimentAlwaysVisible"), true, false)) { UpdatePatchHand(); } UIWidgets::Tooltip("Makes all equipment visible, regardless of Age."); - if (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0) == 1) { - UIWidgets::PaddedEnhancementCheckbox("Scale Adult Equipment as Child", "gEnhancements.ScaleAdultEquimentAsChild", true, false); + if (CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0) == 1) { + UIWidgets::PaddedEnhancementCheckbox("Scale Adult Equipment as Child", CVAR_ENHANCEMENT("ScaleAdultEquimentAsChild"), true, false); UIWidgets::Tooltip("Scales all of the Adult Equipment, as well and moving some a bit, to fit on Child Link Better. May not work properly with some mods."); } - UIWidgets::PaddedEnhancementCheckbox("N64 Mode", "gLowResMode", true, false); + UIWidgets::PaddedEnhancementCheckbox("N64 Mode", CVAR_LOW_RES_MODE, true, false); UIWidgets::Tooltip("Sets aspect ratio to 4:3 and lowers resolution to 240p, the N64's native resolution"); - UIWidgets::PaddedEnhancementCheckbox("Glitch line-up tick", "gDrawLineupTick", true, false); + UIWidgets::PaddedEnhancementCheckbox("Glitch line-up tick", CVAR_ENHANCEMENT("DrawLineupTick"), true, false); UIWidgets::Tooltip("Displays a tick in the top center of the screen to help with glitch line-ups in SoH, as traditional UI based line-ups do not work outside of 4:3"); - UIWidgets::PaddedEnhancementCheckbox("Enable 3D Dropped items/projectiles", "gNewDrops", true, false); + UIWidgets::PaddedEnhancementCheckbox("Enable 3D Dropped items/projectiles", CVAR_ENHANCEMENT("NewDrops"), true, false); UIWidgets::Tooltip("Change most 2D items and projectiles on the overworld to their 3D versions"); - UIWidgets::PaddedEnhancementCheckbox("Disable Black Bar Letterboxes", "gDisableBlackBars", true, false); + UIWidgets::PaddedEnhancementCheckbox("Disable Black Bar Letterboxes", CVAR_ENHANCEMENT("DisableBlackBars"), true, false); UIWidgets::Tooltip("Disables Black Bar Letterboxes during cutscenes and Z-targeting\nNote: there may be minor visual glitches that were covered up by the black bars\nPlease disable this setting before reporting a bug"); - UIWidgets::PaddedEnhancementCheckbox("Dynamic Wallet Icon", "gDynamicWalletIcon", true, false); + UIWidgets::PaddedEnhancementCheckbox("Dynamic Wallet Icon", CVAR_ENHANCEMENT("DynamicWalletIcon"), true, false); UIWidgets::Tooltip("Changes the rupee in the wallet icon to match the wallet size you currently have"); - UIWidgets::PaddedEnhancementCheckbox("Always show dungeon entrances", "gAlwaysShowDungeonMinimapIcon", true, false); + UIWidgets::PaddedEnhancementCheckbox("Always show dungeon entrances", CVAR_ENHANCEMENT("AlwaysShowDungeonMinimapIcon"), true, false); UIWidgets::Tooltip("Always shows dungeon entrance icons on the minimap"); - UIWidgets::PaddedEnhancementCheckbox("Show Gauntlets in First Person", "gFPSGauntlets", true, false); + UIWidgets::PaddedEnhancementCheckbox("Show Gauntlets in First Person", CVAR_ENHANCEMENT("FirstPersonGauntlets"), true, false); UIWidgets::Tooltip("Renders Gauntlets when using the Bow and Hookshot like in OOT3D"); - if (UIWidgets::PaddedEnhancementCheckbox("Color Temple of Time's Medallions", "gToTMedallionsColors", true, false)) { + if (UIWidgets::PaddedEnhancementCheckbox("Color Temple of Time's Medallions", CVAR_ENHANCEMENT("ToTMedallionsColors"), true, false)) { PatchToTMedallions(); } UIWidgets::Tooltip("When medallions are collected, the medallion imprints around the Master Sword pedestal in the Temple of Time will become colored"); - UIWidgets::PaddedEnhancementCheckbox("Show locked door chains on both sides of locked doors", "gShowDoorLocksOnBothSides", true, false); + UIWidgets::PaddedEnhancementCheckbox("Show locked door chains on both sides of locked doors", CVAR_ENHANCEMENT("ShowDoorLocksOnBothSides"), true, false); UIWidgets::PaddedText("Fix Vanishing Paths", true, false); - if (UIWidgets::EnhancementCombobox("gSceneSpecificDirtPathFix", zFightingOptions, ZFIGHT_FIX_DISABLED) && gPlayState != NULL) { + if (UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("SceneSpecificDirtPathFix"), zFightingOptions, ZFIGHT_FIX_DISABLED) && gPlayState != NULL) { UpdateDirtPathFixState(gPlayState->sceneNum); } UIWidgets::Tooltip("Disabled: Paths vanish more the higher the resolution (Z-fighting is based on resolution)\n" "Consistent: Certain paths vanish the same way in all resolutions\n" "No Vanish: Paths do not vanish, Link seems to sink in to some paths\n" "This might affect other decal effects\n"); - UIWidgets::PaddedEnhancementSliderInt("Text Spacing: %d", "##TEXTSPACING", "gTextSpacing", 4, 6, "", 6, true, true, true); + UIWidgets::PaddedEnhancementSliderInt("Text Spacing: %d", "##TEXTSPACING", CVAR_ENHANCEMENT("TextSpacing"), 4, 6, "", 6, true, true, true); UIWidgets::Tooltip("Space between text characters (useful for HD font textures)"); - UIWidgets::PaddedEnhancementCheckbox("More info in file select", "gFileSelectMoreInfo", true, false); + UIWidgets::PaddedEnhancementCheckbox("More info in file select", CVAR_ENHANCEMENT("FileSelectMoreInfo"), true, false); UIWidgets::Tooltip("Shows what items you have collected in the file select screen, like in N64 randomizer"); - UIWidgets::PaddedEnhancementCheckbox("Better ammo rendering in pause menu", "gEnhancements.BetterAmmoRendering", true, false); + UIWidgets::PaddedEnhancementCheckbox("Better ammo rendering in pause menu", CVAR_ENHANCEMENT("BetterAmmoRendering"), true, false); UIWidgets::Tooltip("Ammo counts in the pause menu will work correctly regardless of the position of items in the inventory"); ImGui::EndMenu(); } @@ -1283,70 +1275,70 @@ void DrawEnhancementsMenu() { if (ImGui::BeginMenu("Fixes")) { - UIWidgets::EnhancementCheckbox("Fix L&R Pause menu", "gUniformLR"); + UIWidgets::EnhancementCheckbox("Fix L&R Pause menu", CVAR_ENHANCEMENT("FixMenuLR")); UIWidgets::Tooltip("Makes the L and R buttons in the pause menu the same color"); - UIWidgets::PaddedEnhancementCheckbox("Fix L&Z Page switch in Pause menu", "gNGCKaleidoSwitcher", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix L&Z Page switch in Pause menu", CVAR_ENHANCEMENT("NGCKaleidoSwitcher"), true, false); UIWidgets::Tooltip("Makes L and R switch pages like on the GameCube\nZ opens the Debug Menu instead"); - UIWidgets::PaddedEnhancementCheckbox("Fix Dungeon entrances", "gFixDungeonMinimapIcon", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Dungeon entrances", CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), true, false); UIWidgets::Tooltip("Removes the dungeon entrance icon on the top-left corner of the screen when no dungeon is present on the current map"); - UIWidgets::PaddedEnhancementCheckbox("Fix Two Handed idle animations", "gTwoHandedIdle", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Two Handed idle animations", CVAR_ENHANCEMENT("TwoHandedIdle"), true, false); UIWidgets::Tooltip("Re-enables the two-handed idle animation, a seemingly finished animation that was disabled on accident in the original game"); - UIWidgets::PaddedEnhancementCheckbox("Fix the Gravedigging Tour Glitch", "gGravediggingTourFix", true, false, SaveManager::Instance->IsRandoFile(), + UIWidgets::PaddedEnhancementCheckbox("Fix the Gravedigging Tour Glitch", CVAR_ENHANCEMENT("GravediggingTourFix"), true, false, SaveManager::Instance->IsRandoFile(), "This setting is always enabled in randomizer files", UIWidgets::CheckboxGraphics::Checkmark); UIWidgets::Tooltip("Fixes a bug where the Gravedigging Tour Heart Piece disappears if the area reloads"); - UIWidgets::PaddedEnhancementCheckbox("Fix Deku Nut upgrade", "gDekuNutUpgradeFix", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Deku Nut upgrade", CVAR_ENHANCEMENT("DekuNutUpgradeFix"), true, false); UIWidgets::Tooltip("Prevents the Forest Stage Deku Nut upgrade from becoming unobtainable after receiving the Poacher's Saw"); - UIWidgets::PaddedEnhancementCheckbox("Fix Navi text HUD position", "gNaviTextFix", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Navi text HUD position", CVAR_ENHANCEMENT("NaviTextFix"), true, false); UIWidgets::Tooltip("Correctly centers the Navi text prompt on the HUD's C-Up button"); - UIWidgets::PaddedEnhancementCheckbox("Fix Anubis fireballs", "gAnubisFix", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Anubis fireballs", CVAR_ENHANCEMENT("AnubixFix"), true, false); UIWidgets::Tooltip("Make Anubis fireballs do fire damage when reflected back at them with the Mirror Shield"); - if (UIWidgets::PaddedEnhancementCheckbox("Fix Megaton Hammer crouch stab", "gCrouchStabHammerFix", true, false)) { - if (!CVarGetInteger("gCrouchStabHammerFix", 0)) { - CVarClear("gCrouchStabFix"); + if (UIWidgets::PaddedEnhancementCheckbox("Fix Megaton Hammer crouch stab", CVAR_ENHANCEMENT("CrouchStabHammerFix"), true, false)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("CrouchStabHammerFix"), 0)) { + CVarClear(CVAR_ENHANCEMENT("CrouchStabFix")); } } UIWidgets::Tooltip("Make the Megaton Hammer's crouch stab able to destroy rocks without first swinging it normally"); - if (CVarGetInteger("gCrouchStabHammerFix", 0)) { - UIWidgets::PaddedEnhancementCheckbox("Remove power crouch stab", "gCrouchStabFix", true, false); + if (CVarGetInteger(CVAR_ENHANCEMENT("CrouchStabHammerFix"), 0)) { + UIWidgets::PaddedEnhancementCheckbox("Remove power crouch stab", CVAR_ENHANCEMENT("CrouchStabFix"), true, false); UIWidgets::Tooltip("Make crouch stabbing always do the same damage as a regular slash"); } - UIWidgets::PaddedEnhancementCheckbox("Fix credits timing", "gCreditsFix", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix credits timing", CVAR_ENHANCEMENT("CreditsFix"), true, false); UIWidgets::Tooltip("Extend certain credits scenes so the music lines up properly with the visuals"); - UIWidgets::PaddedEnhancementCheckbox("Fix Gerudo Warrior's clothing colors", "gGerudoWarriorClothingFix", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Gerudo Warrior's clothing colors", CVAR_ENHANCEMENT("GerudoWarriorClothingFix"), true, false); UIWidgets::Tooltip("Prevent the Gerudo Warrior's clothes changing color when changing Link's tunic or using bombs in front of her"); - UIWidgets::PaddedEnhancementCheckbox("Fix Camera Drift", "gFixCameraDrift", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Camera Drift", CVAR_ENHANCEMENT("FixCameraDrift"), true, false); UIWidgets::Tooltip("Fixes camera slightly drifting to the left when standing still due to a math error"); - UIWidgets::PaddedEnhancementCheckbox("Fix Camera Swing", "gFixCameraSwing", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Camera Swing", CVAR_ENHANCEMENT("FixCameraSwing"), true, false); UIWidgets::Tooltip("Fixes camera getting stuck on collision when standing still, also fixes slight shift back in camera when stop moving"); - UIWidgets::PaddedEnhancementCheckbox("Fix Hanging Ledge Swing Rate", "gFixHangingLedgeSwingRate", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Hanging Ledge Swing Rate", CVAR_ENHANCEMENT("FixHangingLedgeSwingRate"), true, false); UIWidgets::Tooltip("Fixes camera swing rate when player falls off a ledge and camera swings around"); - UIWidgets::PaddedEnhancementCheckbox("Fix Missing Jingle after 5 Silver Rupees", "gSilverRupeeJingleExtend", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Missing Jingle after 5 Silver Rupees", CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), true, false); UIWidgets::Tooltip( "Adds 5 higher pitches for the Silver Rupee Jingle for the rooms with more than 5 Silver Rupees. " "Currently only relevant in Master Quest."); - if (UIWidgets::PaddedEnhancementCheckbox("Fix out of bounds textures", "gFixTexturesOOB", true, false)) { + if (UIWidgets::PaddedEnhancementCheckbox("Fix out of bounds textures", CVAR_ENHANCEMENT("FixTexturesOOB"), true, false)) { ApplyAuthenticGfxPatches(); } UIWidgets::Tooltip("Fixes authentic out of bounds texture reads, instead loading textures with the correct size"); - UIWidgets::PaddedEnhancementCheckbox("Fix Poacher's Saw Softlock", "gFixSawSoftlock", true, false, CVarGetInteger("gSkipText", 0), + UIWidgets::PaddedEnhancementCheckbox("Fix Poacher's Saw Softlock", CVAR_ENHANCEMENT("FixSawSoftlock"), true, false, CVarGetInteger(CVAR_ENHANCEMENT("SkipText"), 0), "This is disabled because it is forced on when Skip Text is enabled.", UIWidgets::CheckboxGraphics::Checkmark); UIWidgets::Tooltip("Prevents the Poacher's Saw softlock from mashing through the text, or with Skip Text enabled."); - UIWidgets::PaddedEnhancementCheckbox("Fix enemies not spawning near water", "gEnemySpawnsOverWaterboxes", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix enemies not spawning near water", CVAR_ENHANCEMENT("EnemySpawnsOverWaterboxes"), true, false); UIWidgets::Tooltip("Causes respawning enemies, like stalchildren, to appear on land near bodies of water. " "Fixes an incorrect calculation that acted like water underneath ground was above it."); - UIWidgets::PaddedEnhancementCheckbox("Fix Bush Item Drops", "gBushDropFix", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Bush Item Drops", CVAR_ENHANCEMENT("BushDropFix"), true, false); UIWidgets::Tooltip("Fixes the bushes to drop items correctly rather than spawning undefined items."); - UIWidgets::PaddedEnhancementCheckbox("Fix falling from vine edges", "gFixVineFall", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix falling from vine edges", CVAR_ENHANCEMENT("FixVineFall"), true, false); UIWidgets::Tooltip("Prevents immediately falling off climbable surfaces if climbing on the edges."); - UIWidgets::PaddedEnhancementCheckbox("Fix Link's eyes open while sleeping", "gFixEyesOpenWhileSleeping", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Link's eyes open while sleeping", CVAR_ENHANCEMENT("FixEyesOpenWhileSleeping"), true, false); UIWidgets::Tooltip("Fixes Link's eyes being open in the opening cutscene when he is supposed to be sleeping."); - UIWidgets::PaddedEnhancementCheckbox("Fix Darunia dancing too fast", "gEnhancements.FixDaruniaDanceSpeed", + UIWidgets::PaddedEnhancementCheckbox("Fix Darunia dancing too fast", CVAR_ENHANCEMENT("FixDaruniaDanceSpeed"), true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip("Fixes Darunia's dancing speed so he dances to the beat of Saria's Song, like in vanilla."); - UIWidgets::PaddedEnhancementCheckbox("Fix raised Floor Switches", "gEnhancements.FixFloorSwitches", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix raised Floor Switches", CVAR_ENHANCEMENT("FixFloorSwitches"), true, false); UIWidgets::Tooltip("Fixes the two raised floor switches, the one in Forest Temple Basement and the one at the top of Fire Temple. \n" "This will lower them, making activating them easier"); - UIWidgets::PaddedEnhancementCheckbox("Fix Zora hint dialogue", "gFixZoraHintDialogue", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fix Zora hint dialogue", CVAR_ENHANCEMENT("FixZoraHintDialogue"), true, false); UIWidgets::Tooltip("Fixes one Zora's dialogue giving a hint about bringing Ruto's Letter to King Zora to properly occur before moving King Zora rather than after"); ImGui::EndMenu(); @@ -1356,23 +1348,23 @@ void DrawEnhancementsMenu() { if (ImGui::BeginMenu("Restoration")) { - UIWidgets::EnhancementCheckbox("Authentic Logo Screen", "gAuthenticLogo"); + UIWidgets::EnhancementCheckbox("Authentic Logo Screen", CVAR_ENHANCEMENT("AuthenticLogo")); UIWidgets::Tooltip("Hide the game version and build details and display the authentic model and texture on the boot logo start screen"); - UIWidgets::PaddedEnhancementCheckbox("Red Ganon blood", "gRedGanonBlood", true, false); + UIWidgets::PaddedEnhancementCheckbox("Red Ganon blood", CVAR_ENHANCEMENT("RedGanonBlood"), true, false); UIWidgets::Tooltip("Restore the original red blood from NTSC 1.0/1.1. Disable for green blood"); - UIWidgets::PaddedEnhancementCheckbox("Fish while hovering", "gHoverFishing", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fish while hovering", CVAR_ENHANCEMENT("HoverFishing"), true, false); UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows casting the Fishing Rod while using the Hover Boots"); - UIWidgets::PaddedEnhancementCheckbox("N64 Weird Frames", "gN64WeirdFrames", true, false); + UIWidgets::PaddedEnhancementCheckbox("N64 Weird Frames", CVAR_ENHANCEMENT("N64WeirdFrames"), true, false); UIWidgets::Tooltip("Restores N64 Weird Frames allowing weirdshots to behave the same as N64"); - UIWidgets::PaddedEnhancementCheckbox("Bombchus out of bounds", "gBombchusOOB", true, false); + UIWidgets::PaddedEnhancementCheckbox("Bombchus out of bounds", CVAR_ENHANCEMENT("BombchusOOB"), true, false); UIWidgets::Tooltip("Allows bombchus to explode out of bounds\nSimilar to GameCube and Wii VC"); - UIWidgets::PaddedEnhancementCheckbox("Quick Putaway", "gQuickPutaway", true, false); + UIWidgets::PaddedEnhancementCheckbox("Quick Putaway", CVAR_ENHANCEMENT("QuickPutaway"), true, false); UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows putting away an item without an animation and performing Putaway Ocarina Items"); - UIWidgets::PaddedEnhancementCheckbox("Restore old Gold Skulltula cutscene", "gGsCutscene", true, false); + UIWidgets::PaddedEnhancementCheckbox("Restore old Gold Skulltula cutscene", CVAR_ENHANCEMENT("GSCutscene"), true, false); UIWidgets::Tooltip("Restore pre-release behavior where defeating a Gold Skulltula will play a cutscene showing it die."); - UIWidgets::PaddedEnhancementCheckbox("Quick Bongo Kill", "gQuickBongoKill", true, false); + UIWidgets::PaddedEnhancementCheckbox("Quick Bongo Kill", CVAR_ENHANCEMENT("QuickBongoKill"), true, false); UIWidgets::Tooltip("Restore a bug from NTSC 1.0 that allows bypassing Bongo Bongo's intro cutscene to quickly kill him"); - UIWidgets::PaddedEnhancementCheckbox("Original RBA Values", "gRestoreRBAValues", true, false); + UIWidgets::PaddedEnhancementCheckbox("Original RBA Values", CVAR_ENHANCEMENT("RestoreRBAValues"), true, false); UIWidgets::Tooltip("Restores the original outcomes when performing Reverse Bottle Adventure."); ImGui::EndMenu(); @@ -1382,7 +1374,7 @@ void DrawEnhancementsMenu() { if (ImGui::BeginMenu("Extra Modes")) { UIWidgets::PaddedText("Mirrored World", true, false); - if (UIWidgets::EnhancementCombobox("gMirroredWorldMode", mirroredWorldModes, MIRRORED_WORLD_OFF) && gPlayState != NULL) { + if (UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("MirroredWorldMode"), mirroredWorldModes, MIRRORED_WORLD_OFF) && gPlayState != NULL) { UpdateMirrorModeState(gPlayState->sceneNum); } UIWidgets::Tooltip( @@ -1398,7 +1390,7 @@ void DrawEnhancementsMenu() { ); UIWidgets::PaddedText("Enemy Randomizer", true, false); - UIWidgets::EnhancementCombobox("gRandomizedEnemies", enemyRandomizerModes, ENEMY_RANDOMIZER_OFF); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("RandomizedEnemies"), enemyRandomizerModes, ENEMY_RANDOMIZER_OFF); UIWidgets::Tooltip( "Replaces fixed enemies throughout the game with a random enemy. Bosses, mini-bosses and a few specific regular enemies are excluded.\n" "Enemies that need more than Deku Nuts + either Deku Sticks or a sword to kill are excluded from spawning in \"clear enemy\" rooms.\n\n" @@ -1406,66 +1398,66 @@ void DrawEnhancementsMenu() { "- Random (Seeded): Enemies are randomized based on the current randomizer seed/file\n" ); - UIWidgets::PaddedEnhancementCheckbox("Randomized Enemy Sizes", "gRandomizedEnemySizes", true, false); + UIWidgets::PaddedEnhancementCheckbox("Randomized Enemy Sizes", CVAR_ENHANCEMENT("RandomizedEnemySizes"), true, false); UIWidgets::Tooltip("Enemies and Bosses spawn with random sizes."); - if (CVarGetInteger("gRandomizedEnemySizes", 0)) { - UIWidgets::EnhancementCheckbox("Scale Health with Size", "gEnemySizeScalesHealth"); + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemySizes"), 0)) { + UIWidgets::EnhancementCheckbox("Scale Health with Size", CVAR_ENHANCEMENT("EnemySizeScalesHealth")); UIWidgets::Tooltip("Scales normal enemies health with their randomized size. *This will NOT affect bosses*"); } - UIWidgets::PaddedEnhancementCheckbox("Ivan the Fairy (Coop Mode)", "gIvanCoopModeEnabled", true, false); + UIWidgets::PaddedEnhancementCheckbox("Ivan the Fairy (Coop Mode)", CVAR_ENHANCEMENT("IvanCoopModeEnabled"), true, false); UIWidgets::Tooltip("Enables Ivan the Fairy upon the next map change. Player 2 can control Ivan and " "press the C-Buttons to use items and mess with Player 1!"); - UIWidgets::PaddedEnhancementCheckbox("Rupee Dash Mode", "gRupeeDash", true, false); + UIWidgets::PaddedEnhancementCheckbox("Rupee Dash Mode", CVAR_ENHANCEMENT("RupeeDash"), true, false); UIWidgets::Tooltip("Rupees reduced over time, Link suffers damage when the count hits 0."); - if (CVarGetInteger("gRupeeDash", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RupeeDash"), 0)) { UIWidgets::PaddedEnhancementSliderInt( - "Rupee Dash Interval: %d", "##DashInterval", "gDashInterval", 1, 10, "", 5, true, true, false, - !CVarGetInteger("gRupeeDash", 0), + "Rupee Dash Interval: %d", "##DashInterval", CVAR_ENHANCEMENT("RupeeDashInterval"), 1, 10, "", 5, true, true, false, + !CVarGetInteger(CVAR_ENHANCEMENT("RupeeDash"), 0), "This option is disabled because \"Rupee Dash Mode\" is turned off"); UIWidgets::Tooltip("Interval between Rupee reduction in Rupee Dash Mode"); } - UIWidgets::PaddedEnhancementCheckbox("Shadow Tag Mode", "gShadowTag", true, false); + UIWidgets::PaddedEnhancementCheckbox("Shadow Tag Mode", CVAR_ENHANCEMENT("ShadowTag"), true, false); UIWidgets::Tooltip("A wallmaster follows Link everywhere, don't get caught!"); - UIWidgets::PaddedEnhancementCheckbox("Additional Traps", "gAddTraps.enabled", true, false); + UIWidgets::PaddedEnhancementCheckbox("Additional Traps", CVAR_ENHANCEMENT("ExtraTraps.Enabled"), true, false); UIWidgets::Tooltip("Enables additional Trap variants."); - if (CVarGetInteger("gAddTraps.enabled", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("ExtraTraps.Enabled"), 0)) { UIWidgets::PaddedSeparator(); if (ImGui::BeginMenu("Trap Options")) { ImGui::Text("Tier 1 Traps:"); UIWidgets::Spacer(0); - UIWidgets::PaddedEnhancementCheckbox("Freeze Traps", "gAddTraps.Ice", true, false); - UIWidgets::PaddedEnhancementCheckbox("Burn Traps", "gAddTraps.Burn", true, false); - UIWidgets::PaddedEnhancementCheckbox("Shock Traps", "gAddTraps.Shock", true, false); + UIWidgets::PaddedEnhancementCheckbox("Freeze Traps", CVAR_ENHANCEMENT("ExtraTraps.Ice"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Burn Traps", CVAR_ENHANCEMENT("ExtraTraps.Burn"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Shock Traps", CVAR_ENHANCEMENT("ExtraTraps.Shock"), true, false); UIWidgets::PaddedSeparator(); ImGui::Text("Tier 2 Traps:"); UIWidgets::Spacer(0); - UIWidgets::PaddedEnhancementCheckbox("Knockback Traps", "gAddTraps.Knock", true, false); - UIWidgets::PaddedEnhancementCheckbox("Speed Traps", "gAddTraps.Speed", true, false); - UIWidgets::PaddedEnhancementCheckbox("Bomb Traps", "gAddTraps.Bomb", true, false); + UIWidgets::PaddedEnhancementCheckbox("Knockback Traps", CVAR_ENHANCEMENT("ExtraTraps.Knockback"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Speed Traps", CVAR_ENHANCEMENT("ExtraTraps.Speed"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Bomb Traps", CVAR_ENHANCEMENT("ExtraTraps.Bomb"), true, false); UIWidgets::PaddedSeparator(); ImGui::Text("Tier 3 Traps:"); UIWidgets::Spacer(0); - UIWidgets::PaddedEnhancementCheckbox("Void Traps", "gAddTraps.Void", true, false); - UIWidgets::PaddedEnhancementCheckbox("Ammo Traps", "gAddTraps.Ammo", true, false); - UIWidgets::PaddedEnhancementCheckbox("Death Traps", "gAddTraps.Kill", true, false); - UIWidgets::PaddedEnhancementCheckbox("Teleport Traps", "gAddTraps.Tele", true, false); + UIWidgets::PaddedEnhancementCheckbox("Void Traps", CVAR_ENHANCEMENT("ExtraTraps.Void"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Ammo Traps", CVAR_ENHANCEMENT("ExtraTraps.Ammo"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Death Traps", CVAR_ENHANCEMENT("ExtraTraps.Kill"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Teleport Traps", CVAR_ENHANCEMENT("ExtraTraps.Teleport"), true, false); ImGui::EndMenu(); } } UIWidgets::Spacer(0); - if (UIWidgets::PaddedEnhancementCheckbox("Hurt Container Mode", "gHurtContainer", true, false)) { - UpdateHurtContainerModeState(CVarGetInteger("gHurtContainer", 0)); + if (UIWidgets::PaddedEnhancementCheckbox("Hurt Container Mode", CVAR_ENHANCEMENT("HurtContainer"), true, false)) { + UpdateHurtContainerModeState(CVarGetInteger(CVAR_ENHANCEMENT("HurtContainer"), 0)); } UIWidgets::Tooltip("Changes Heart Piece and Heart Container functionality.\n\n" "- Each Heart Container or full Heart Piece reduces Links hearts by 1.\n" @@ -1478,7 +1470,7 @@ void DrawEnhancementsMenu() { // Autosave enum value of 1 is the default in presets and the old checkbox "on" state for backwards compatibility UIWidgets::PaddedText("Autosave", false, true); - UIWidgets::EnhancementCombobox("gAutosave", autosaveLabels, AUTOSAVE_OFF); + UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("Autosave"), autosaveLabels, AUTOSAVE_OFF); UIWidgets::Tooltip("Automatically save the game when changing locations and/or obtaining items\n" "Major items exclude rupees and health/magic/ammo refills (but include bombchus unless bombchu drops are enabled)"); @@ -1492,19 +1484,19 @@ void DrawEnhancementsMenu() { ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); if (mCosmeticsEditorWindow) { - if (ImGui::Button(GetWindowButtonText("Cosmetics Editor", CVarGetInteger("gCosmeticsEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Cosmetics Editor", CVarGetInteger(CVAR_WINDOW("CosmeticsEditor"), 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mCosmeticsEditorWindow->ToggleVisibility(); } } if (mAudioEditorWindow) { - if (ImGui::Button(GetWindowButtonText("Audio Editor", CVarGetInteger("gAudioEditor.WindowOpen", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Audio Editor", CVarGetInteger(CVAR_WINDOW("AudioEditor"), 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mAudioEditorWindow->ToggleVisibility(); } } if (mGameplayStatsWindow) { - if (ImGui::Button(GetWindowButtonText("Gameplay Stats", CVarGetInteger("gGameplayStatsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Gameplay Stats", CVarGetInteger(CVAR_WINDOW("GameplayStats"), 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mGameplayStatsWindow->ToggleVisibility(); } } @@ -1514,9 +1506,9 @@ void DrawEnhancementsMenu() { #ifdef __SWITCH__ UIWidgets::Spacer(0); ImGui::Text("Switch performance mode"); - if (UIWidgets::EnhancementCombobox("gSwitchPerfMode", SWITCH_CPU_PROFILES, (int)LUS::SwitchProfiles::STOCK)) { - SPDLOG_INFO("Profile:: %s", SWITCH_CPU_PROFILES[CVarGetInteger("gSwitchPerfMode", (int)LUS::SwitchProfiles::STOCK)]); - LUS::Switch::ApplyOverclock(); + if (UIWidgets::EnhancementCombobox(CVAR_ENHANCEMENT("SwitchPerfMode"), SWITCH_CPU_PROFILES, (int)Ship::SwitchProfiles::STOCK)) { + SPDLOG_INFO("Profile:: %s", SWITCH_CPU_PROFILES[CVarGetInteger(CVAR_ENHANCEMENT("SwitchPerfMode"), (int)Ship::SwitchProfiles::STOCK)]); + Ship::Switch::ApplyOverclock(); } #endif @@ -1527,7 +1519,7 @@ void DrawEnhancementsMenu() { void DrawCheatsMenu() { if (ImGui::BeginMenu("Cheats")) { - ImGui::BeginDisabled(CVarGetInteger("gDisableChangingSettings", 0)); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); ImGui::SetCursorPosY(ImGui::GetCursorPosY() - 8.0f); ImGui::BeginTable("##cheatsMenu", 2, ImGuiTableFlags_SizingFixedFit); ImGui::TableSetupColumn("", ImGuiTableColumnFlags_WidthStretch); @@ -1537,32 +1529,32 @@ void DrawCheatsMenu() { ImGui::Text("Inventory:"); UIWidgets::PaddedSeparator(); - UIWidgets::PaddedEnhancementCheckbox("Super Tunic", "gSuperTunic", true, false); + UIWidgets::PaddedEnhancementCheckbox("Super Tunic", CVAR_CHEAT("SuperTunic"), true, false); UIWidgets::Tooltip("Makes every tunic have the effects of every other tunic"); - UIWidgets::PaddedEnhancementCheckbox("Easy ISG", "gEzISG", true, false); + UIWidgets::PaddedEnhancementCheckbox("Easy ISG", CVAR_CHEAT("EasyISG"), true, false); UIWidgets::Tooltip("Passive Infinite Sword Glitch\nIt makes your sword's swing effect and hitbox stay active indefinitely"); - UIWidgets::PaddedEnhancementCheckbox("Easy QPA", "gEzQPA", true, false); + UIWidgets::PaddedEnhancementCheckbox("Easy QPA", CVAR_CHEAT("EasyQPA"), true, false); UIWidgets::Tooltip("Gives you the glitched damage value of the quick put away glitch."); - UIWidgets::PaddedEnhancementCheckbox("Timeless Equipment", "gTimelessEquipment", true, false); + UIWidgets::PaddedEnhancementCheckbox("Timeless Equipment", CVAR_CHEAT("TimelessEquipment"), true, false); UIWidgets::Tooltip("Allows any item to be equipped, regardless of age\nAlso allows Child to use Adult strength upgrades"); - UIWidgets::PaddedEnhancementCheckbox("Unrestricted Items", "gNoRestrictItems", true, false); + UIWidgets::PaddedEnhancementCheckbox("Unrestricted Items", CVAR_CHEAT("NoRestrictItems"), true, false); UIWidgets::Tooltip("Allows you to use any item at any location"); - UIWidgets::PaddedEnhancementCheckbox("Fireproof Deku Shield", "gFireproofDekuShield", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fireproof Deku Shield", CVAR_CHEAT("FireproofDekuShield"), true, false); UIWidgets::Tooltip("Prevents the Deku Shield from burning on contact with fire"); - UIWidgets::PaddedEnhancementCheckbox("Shield with Two-Handed Weapons", "gShieldTwoHanded", true, false); + UIWidgets::PaddedEnhancementCheckbox("Shield with Two-Handed Weapons", CVAR_CHEAT("ShieldTwoHanded"), true, false); UIWidgets::Tooltip("This allows you to put up your shield with any two-handed weapon in hand except for Deku Sticks"); UIWidgets::Spacer(2.0f); ImGui::Text("Deku Sticks:"); - UIWidgets::EnhancementCombobox("gDekuStickCheat", DekuStickCheat, DEKU_STICK_NORMAL); + UIWidgets::EnhancementCombobox(CVAR_CHEAT("DekuStick"), DekuStickCheat, DEKU_STICK_NORMAL); UIWidgets::Spacer(2.0f); - UIWidgets::EnhancementSliderFloat("Bomb Timer Multiplier: %.2fx", "##gBombTimerMultiplier", "gBombTimerMultiplier", 0.1f, 5.0f, "", 1.0f, false); - UIWidgets::PaddedEnhancementCheckbox("Hookshot Everything", "gHookshotEverything", true, false); + UIWidgets::EnhancementSliderFloat("Bomb Timer Multiplier: %.2fx", "##gBombTimerMultiplier", CVAR_CHEAT("BombTimerMultiplier"), 0.1f, 5.0f, "", 1.0f, false); + UIWidgets::PaddedEnhancementCheckbox("Hookshot Everything", CVAR_CHEAT("HookshotEverything"), true, false); UIWidgets::Tooltip("Makes every surface in the game hookshot-able"); UIWidgets::Spacer(0); - UIWidgets::EnhancementSliderFloat("Hookshot Reach Multiplier: %.2fx", "##gCheatHookshotReachMultiplier", "gCheatHookshotReachMultiplier", 1.0f, 5.0f, "", 1.0f, false); + UIWidgets::EnhancementSliderFloat("Hookshot Reach Multiplier: %.2fx", "##gCheatHookshotReachMultiplier", CVAR_CHEAT("HookshotReachMultiplier"), 1.0f, 5.0f, "", 1.0f, false); UIWidgets::Spacer(2.0f); if (ImGui::Button("Change Age")) { - CVarSetInteger("gSwitchAge", 1); + CVarSetInteger(CVAR_GENERAL("SwitchAge"), 1); } UIWidgets::Tooltip("Switches Link's age and reloads the area."); UIWidgets::Spacer(2.0f); @@ -1575,12 +1567,12 @@ void DrawCheatsMenu() { UIWidgets::Spacer(2.0f); if (ImGui::BeginMenu("Infinite...")) { - UIWidgets::EnhancementCheckbox("Money", "gInfiniteMoney"); - UIWidgets::PaddedEnhancementCheckbox("Health", "gInfiniteHealth", true, false); - UIWidgets::PaddedEnhancementCheckbox("Ammo", "gInfiniteAmmo", true, false); - UIWidgets::PaddedEnhancementCheckbox("Magic", "gInfiniteMagic", true, false); - UIWidgets::PaddedEnhancementCheckbox("Nayru's Love", "gInfiniteNayru", true, false); - UIWidgets::PaddedEnhancementCheckbox("Epona Boost", "gInfiniteEpona", true, false); + UIWidgets::EnhancementCheckbox("Money", CVAR_CHEAT("InfiniteMoney")); + UIWidgets::PaddedEnhancementCheckbox("Health", CVAR_CHEAT("InfiniteHealth"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Ammo", CVAR_CHEAT("InfiniteAmmo"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Magic", CVAR_CHEAT("InfiniteMagic"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Nayru's Love", CVAR_CHEAT("InfiniteNayru"), true, false); + UIWidgets::PaddedEnhancementCheckbox("Epona Boost", CVAR_CHEAT("InfiniteEponaBoost"), true, false); ImGui::EndMenu(); } @@ -1598,13 +1590,13 @@ void DrawCheatsMenu() { UIWidgets::PaddedText("they WILL break across transitions and", true, false); UIWidgets::PaddedText("load zones (like doors). Support for", true, false); UIWidgets::PaddedText("related issues will not be provided.", true, false); - if (UIWidgets::PaddedEnhancementCheckbox("I promise I have read the warning", "gSaveStatePromise", true, + if (UIWidgets::PaddedEnhancementCheckbox("I promise I have read the warning", CVAR_CHEAT("SaveStatePromise"), true, false)) { - CVarSetInteger("gSaveStatesEnabled", 0); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetInteger(CVAR_CHEAT("SaveStatesEnabled"), 0); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } - if (CVarGetInteger("gSaveStatePromise", 0) == 1) { - UIWidgets::PaddedEnhancementCheckbox("I understand, enable save states", "gSaveStatesEnabled", true, + if (CVarGetInteger(CVAR_CHEAT("SaveStatePromise"), 0) == 1) { + UIWidgets::PaddedEnhancementCheckbox("I understand, enable save states", CVAR_CHEAT("SaveStatesEnabled"), true, false); UIWidgets::Tooltip("F5 to save, F6 to change slots, F7 to load"); } @@ -1616,44 +1608,44 @@ void DrawCheatsMenu() { ImGui::Text("Behavior:"); UIWidgets::PaddedSeparator(); - UIWidgets::PaddedEnhancementCheckbox("No Clip", "gNoClip", true, false); + UIWidgets::PaddedEnhancementCheckbox("No Clip", CVAR_CHEAT("NoClip"), true, false); UIWidgets::Tooltip("Allows you to walk through walls"); - UIWidgets::PaddedEnhancementCheckbox("Climb Everything", "gClimbEverything", true, false); + UIWidgets::PaddedEnhancementCheckbox("Climb Everything", CVAR_CHEAT("ClimbEverything"), true, false); UIWidgets::Tooltip("Makes every surface in the game climbable"); - UIWidgets::PaddedEnhancementCheckbox("Moon Jump on L", "gMoonJumpOnL", true, false); + UIWidgets::PaddedEnhancementCheckbox("Moon Jump on L", CVAR_CHEAT("MoonJumpOnL"), true, false); UIWidgets::Tooltip("Holding L makes you float into the air"); - UIWidgets::PaddedEnhancementCheckbox("Easy Frame Advancing", "gCheatEasyPauseBufferEnabled", true, false); + UIWidgets::PaddedEnhancementCheckbox("Easy Frame Advancing", CVAR_CHEAT("EasyPauseBuffer"), true, false); UIWidgets::Tooltip("Continue holding START button when unpausing to only advance a single frame and then re-pause"); - const bool bEasyFrameAdvanceEnabled = CVarGetInteger("gCheatEasyPauseBufferEnabled", 0); - UIWidgets::PaddedEnhancementCheckbox("Easy Input Buffering", "gCheatEasyInputBufferingEnabled", true, false, bEasyFrameAdvanceEnabled, "Forced enabled when Easy Frame Advancing is enabled", UIWidgets::CheckboxGraphics::Checkmark); + const bool bEasyFrameAdvanceEnabled = CVarGetInteger(CVAR_CHEAT("EasyPauseBuffer"), 0); + UIWidgets::PaddedEnhancementCheckbox("Easy Input Buffering", CVAR_CHEAT("EasyInputBuffer"), true, false, bEasyFrameAdvanceEnabled, "Forced enabled when Easy Frame Advancing is enabled", UIWidgets::CheckboxGraphics::Checkmark); UIWidgets::Tooltip("Inputs that are held down while the Subscreen is closing will be pressed when the game is resumed"); - UIWidgets::PaddedEnhancementCheckbox("Drops Don't Despawn", "gDropsDontDie", true, false); + UIWidgets::PaddedEnhancementCheckbox("Drops Don't Despawn", CVAR_CHEAT("DropsDontDie"), true, false); UIWidgets::Tooltip("Drops from enemies, grass, etc. don't disappear after a set amount of time"); - UIWidgets::PaddedEnhancementCheckbox("Fish Don't despawn", "gNoFishDespawn", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fish Don't despawn", CVAR_CHEAT("NoFishDespawn"), true, false); UIWidgets::Tooltip("Prevents fish from automatically despawning after a while when dropped"); - UIWidgets::PaddedEnhancementCheckbox("Bugs Don't despawn", "gNoBugsDespawn", true, false); + UIWidgets::PaddedEnhancementCheckbox("Bugs Don't despawn", CVAR_CHEAT("NoBugsDespawn"), true, false); UIWidgets::Tooltip("Prevents bugs from automatically despawning after a while when dropped"); - UIWidgets::PaddedEnhancementCheckbox("Freeze Time", "gFreezeTime", true, false); + UIWidgets::PaddedEnhancementCheckbox("Freeze Time", CVAR_CHEAT("FreezeTime"), true, false); UIWidgets::Tooltip("Freezes the time of day"); - UIWidgets::PaddedEnhancementCheckbox("Time Sync", "gTimeSync", true, false); + UIWidgets::PaddedEnhancementCheckbox("Time Sync", CVAR_CHEAT("TimeSync"), true, false); UIWidgets::Tooltip("This syncs the ingame time with the real world time"); - UIWidgets::PaddedEnhancementCheckbox("No ReDead/Gibdo Freeze", "gNoRedeadFreeze", true, false); + UIWidgets::PaddedEnhancementCheckbox("No ReDead/Gibdo Freeze", CVAR_CHEAT("NoRedeadFreeze"), true, false); UIWidgets::Tooltip("Prevents ReDeads and Gibdos from being able to freeze you with their scream"); - UIWidgets::PaddedEnhancementCheckbox("Keese/Guay don't target you", "gNoKeeseGuayTarget", true, false); + UIWidgets::PaddedEnhancementCheckbox("Keese/Guay don't target you", CVAR_CHEAT("NoKeeseGuayTarget"), true, false); UIWidgets::Tooltip("Keese and Guay no longer target you and simply ignore you as if you were wearing the skull mask"); { - static int32_t betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0); + static int32_t betaQuestEnabled = CVarGetInteger(CVAR_CHEAT("EnableBetaQuest"), 0); static int32_t lastBetaQuestEnabled = betaQuestEnabled; - static int32_t betaQuestWorld = CVarGetInteger("gBetaQuestWorld", 0xFFEF); + static int32_t betaQuestWorld = CVarGetInteger(CVAR_CHEAT("BetaQuestWorld"), 0xFFEF); static int32_t lastBetaQuestWorld = betaQuestWorld; if (!isBetaQuestEnabled) { UIWidgets::DisableComponent(ImGui::GetStyle().Alpha * 0.5f); } - UIWidgets::PaddedEnhancementCheckbox("Enable Beta Quest", "gEnableBetaQuest", true, false); + UIWidgets::PaddedEnhancementCheckbox("Enable Beta Quest", CVAR_CHEAT("EnableBetaQuest"), true, false); UIWidgets::Tooltip("Turns on OoT Beta Quest. *WARNING* This will reset your game."); - betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0); + betaQuestEnabled = CVarGetInteger(CVAR_CHEAT("EnableBetaQuest"), 0); if (betaQuestEnabled) { if (betaQuestEnabled != lastBetaQuestEnabled) { betaQuestWorld = 0; @@ -1685,18 +1677,18 @@ void DrawCheatsMenu() { } else { lastBetaQuestWorld = betaQuestWorld = 0xFFEF; - CVarClear("gBetaQuestWorld"); + CVarClear(CVAR_CHEAT("BetaQuestWorld")); } if (betaQuestEnabled != lastBetaQuestEnabled || betaQuestWorld != lastBetaQuestWorld) { // Reset the game if the beta quest state or world changed because beta quest happens on redirecting the title screen cutscene. lastBetaQuestEnabled = betaQuestEnabled; lastBetaQuestWorld = betaQuestWorld; - CVarSetInteger("gEnableBetaQuest", betaQuestEnabled); - CVarSetInteger("gBetaQuestWorld", betaQuestWorld); + CVarSetInteger(CVAR_CHEAT("EnableBetaQuest"), betaQuestEnabled); + CVarSetInteger(CVAR_CHEAT("BetaQuestWorld"), betaQuestWorld); - std::reinterpret_pointer_cast(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + std::reinterpret_pointer_cast(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetGuiWindow("Console"))->Dispatch("reset"); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } if (!isBetaQuestEnabled) { @@ -1710,8 +1702,8 @@ void DrawCheatsMenu() { } } -extern std::shared_ptr mStatsWindow; -extern std::shared_ptr mConsoleWindow; +extern std::shared_ptr mStatsWindow; +extern std::shared_ptr mConsoleWindow; extern std::shared_ptr mSaveEditorWindow; extern std::shared_ptr mColViewerWindow; extern std::shared_ptr mActorViewerWindow; @@ -1721,15 +1713,15 @@ extern std::shared_ptr mMessageViewerWindow; void DrawDeveloperToolsMenu() { if (ImGui::BeginMenu("Developer Tools")) { - ImGui::BeginDisabled(CVarGetInteger("gDisableChangingSettings", 0)); + ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); - UIWidgets::EnhancementCheckbox("OoT Debug Mode", "gDebugEnabled"); + UIWidgets::EnhancementCheckbox("OoT Debug Mode", CVAR_DEVELOPER_TOOLS("DebugEnabled")); UIWidgets::Tooltip("Enables Debug Mode, allowing you to select maps with L + R + Z, noclip with L + D-pad Right, and open the debug menu with L on the pause screen"); - if (CVarGetInteger("gDebugEnabled", 0)) { - UIWidgets::EnhancementCheckbox("OoT Registry Editor", "gRegEditEnabled"); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) { + UIWidgets::EnhancementCheckbox("OoT Registry Editor", CVAR_DEVELOPER_TOOLS("RegEditEnabled")); UIWidgets::Tooltip("Enables the registry editor"); ImGui::Text("Debug Save File Mode:"); - UIWidgets::EnhancementCombobox("gDebugSaveFileMode", DebugSaveFileModes, 1); + UIWidgets::EnhancementCombobox(CVAR_DEVELOPER_TOOLS("DebugSaveFileMode"), DebugSaveFileModes, 1); UIWidgets::Tooltip( "Changes the behaviour of debug file select creation (creating a save file on slot 1 with debug mode on)\n" "- Off: The debug save file will be a normal savefile\n" @@ -1737,18 +1729,20 @@ void DrawDeveloperToolsMenu() { "- Maxed: The debug save file will be a save file with all of the items & upgrades" ); } - UIWidgets::PaddedEnhancementCheckbox("OoT Skulltula Debug", "gSkulltulaDebugEnabled", true, false); + UIWidgets::PaddedEnhancementCheckbox("OoT Skulltula Debug", CVAR_DEVELOPER_TOOLS("SkulltulaDebugEnabled"), true, false); UIWidgets::Tooltip("Enables Skulltula Debug, when moving the cursor in the menu above various map icons (boss key, compass, map screen locations, etc) will set the GS bits in that area.\nUSE WITH CAUTION AS IT DOES NOT UPDATE THE GS COUNT."); - UIWidgets::PaddedEnhancementCheckbox("Fast File Select", "gSkipLogoTitle", true, false); + UIWidgets::PaddedEnhancementCheckbox("Fast File Select", CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), true, false); UIWidgets::Tooltip("Load the game to the selected menu or file\n\"Zelda Map Select\" require debug mode else you will fallback to File choose menu\nUsing a file number that don't have save will create a save file only if you toggle on \"Create a new save if none ?\" else it will bring you to the File choose menu"); - if (CVarGetInteger("gSkipLogoTitle", 0)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), 0)) { ImGui::Text("Loading:"); - UIWidgets::EnhancementCombobox("gSaveFileID", FastFileSelect, 0); + UIWidgets::EnhancementCombobox(CVAR_DEVELOPER_TOOLS("SaveFileID"), FastFileSelect, 0); }; - UIWidgets::PaddedEnhancementCheckbox("Better Debug Warp Screen", "gBetterDebugWarpScreen", true, false); + UIWidgets::PaddedEnhancementCheckbox("Better Debug Warp Screen", CVAR_DEVELOPER_TOOLS("BetterDebugWarpScreen"), true, false); UIWidgets::Tooltip("Optimized debug warp screen, with the added ability to chose entrances and time of day"); - UIWidgets::PaddedEnhancementCheckbox("Debug Warp Screen Translation", "gDebugWarpScreenTranslation", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::PaddedEnhancementCheckbox("Debug Warp Screen Translation", CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip("Translate the Debug Warp Screen based on the game language"); + UIWidgets::PaddedEnhancementCheckbox("Resource logging", CVAR_DEVELOPER_TOOLS("ResourceLogging"), true, false); + UIWidgets::Tooltip("Logs some resources as XML when they're loaded in binary format"); if (gPlayState != NULL) { UIWidgets::PaddedSeparator(); ImGui::Checkbox("Frame Advance##frameAdvance", (bool*)&gPlayState->frameAdvCtx.enabled); @@ -1758,12 +1752,12 @@ void DrawDeveloperToolsMenu() { ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); if (ImGui::Button("Advance 1", ImVec2(ImGui::GetContentRegionAvail().x / 2.0f, 0.0f))) { - CVarSetInteger("gFrameAdvance", 1); + CVarSetInteger(CVAR_GENERAL("FrameAdvance"), 1); } ImGui::SameLine(); ImGui::Button("Advance (Hold)"); if (ImGui::IsItemActive()) { - CVarSetInteger("gFrameAdvance", 1); + CVarSetInteger(CVAR_GENERAL("FrameAdvance"), 1); } ImGui::PopStyleVar(3); ImGui::PopStyleColor(1); @@ -1775,51 +1769,51 @@ void DrawDeveloperToolsMenu() { ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); if (mStatsWindow) { - if (ImGui::Button(GetWindowButtonText("Stats", CVarGetInteger("gStatsEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Stats", CVarGetInteger(CVAR_STATS_WINDOW_OPEN, 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mStatsWindow->ToggleVisibility(); } UIWidgets::Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on"); } UIWidgets::Spacer(0); if (mConsoleWindow) { - if (ImGui::Button(GetWindowButtonText("Console", CVarGetInteger("gConsoleEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Console", CVarGetInteger(CVAR_CONSOLE_WINDOW_OPEN, 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mConsoleWindow->ToggleVisibility(); } UIWidgets::Tooltip("Enables the console window, allowing you to input commands, type help for some examples"); } UIWidgets::Spacer(0); if (mSaveEditorWindow) { - if (ImGui::Button(GetWindowButtonText("Save Editor", CVarGetInteger("gSaveEditorEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Save Editor", CVarGetInteger(CVAR_WINDOW("SaveEditor"), 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mSaveEditorWindow->ToggleVisibility(); } } UIWidgets::Spacer(0); if (mColViewerWindow) { - if (ImGui::Button(GetWindowButtonText("Collision Viewer", CVarGetInteger("gCollisionViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Collision Viewer", CVarGetInteger(CVAR_WINDOW("CollisionViewer"), 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mColViewerWindow->ToggleVisibility(); } } UIWidgets::Spacer(0); if (mActorViewerWindow) { - if (ImGui::Button(GetWindowButtonText("Actor Viewer", CVarGetInteger("gActorViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Actor Viewer", CVarGetInteger(CVAR_WINDOW("ActorViewer"), 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mActorViewerWindow->ToggleVisibility(); } } UIWidgets::Spacer(0); if (mDLViewerWindow) { - if (ImGui::Button(GetWindowButtonText("Display List Viewer", CVarGetInteger("gDLViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Display List Viewer", CVarGetInteger(CVAR_WINDOW("DLViewer"), 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mDLViewerWindow->ToggleVisibility(); } } UIWidgets::Spacer(0); if (mValueViewerWindow) { - if (ImGui::Button(GetWindowButtonText("Value Viewer", CVarGetInteger("gValueViewer.WindowOpen", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Value Viewer", CVarGetInteger(CVAR_WINDOW("ValueViewer"), 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mValueViewerWindow->ToggleVisibility(); } } UIWidgets::Spacer(0); if (mMessageViewerWindow) { - if (ImGui::Button(GetWindowButtonText("Message Viewer", CVarGetInteger("gMessageViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + if (ImGui::Button(GetWindowButtonText("Message Viewer", CVarGetInteger(CVAR_WINDOW("MessageViewer"), 0)).c_str(), ImVec2(-1.0f, 0.0f))) { mMessageViewerWindow->ToggleVisibility(); } } @@ -1849,27 +1843,28 @@ bool isStringEmpty(std::string str) { #ifdef ENABLE_REMOTE_CONTROL void DrawRemoteControlMenu() { if (ImGui::BeginMenu("Network")) { - static std::string ip = CVarGetString("gRemote.IP", "127.0.0.1"); - static uint16_t port = CVarGetInteger("gRemote.Port", 43384); - bool isFormValid = !isStringEmpty(CVarGetString("gRemote.IP", "127.0.0.1")) && port > 1024 && port < 65535; + static std::string ip = CVarGetString(CVAR_REMOTE("IP"), "127.0.0.1"); + static uint16_t port = CVarGetInteger(CVAR_REMOTE("Port"), 43384); + bool isFormValid = !isStringEmpty(CVarGetString(CVAR_REMOTE("IP"), "127.0.0.1")) && port > 1024 && port < 65535; const char* remoteOptions[2] = { "Sail", "Crowd Control"}; ImGui::BeginDisabled(GameInteractor::Instance->isRemoteInteractorEnabled); ImGui::Text("Remote Interaction Scheme"); - if (UIWidgets::EnhancementCombobox("gRemote.Scheme", remoteOptions, GI_SCHEME_SAIL)) { - switch (CVarGetInteger("gRemote.Scheme", GI_SCHEME_SAIL)) { + if (UIWidgets::EnhancementCombobox(CVAR_REMOTE("Scheme"), remoteOptions, GI_SCHEME_SAIL)) { + auto scheme = CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL); + switch (scheme) { case GI_SCHEME_SAIL: case GI_SCHEME_CROWD_CONTROL: - CVarSetString("gRemote.IP", "127.0.0.1"); - CVarSetInteger("gRemote.Port", 43384); + CVarSetString(CVAR_REMOTE("IP"), "127.0.0.1"); + CVarSetInteger(CVAR_REMOTE("Port"), 43384); ip = "127.0.0.1"; port = 43384; break; } - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } - switch (CVarGetInteger("gRemote.Scheme", GI_SCHEME_SAIL)) { + switch (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL)) { case GI_SCHEME_SAIL: UIWidgets::InsertHelpHoverText( "Sail is a networking protocol designed to facilitate remote " @@ -1902,15 +1897,15 @@ void DrawRemoteControlMenu() { ImGui::Text("Remote IP & Port"); if (ImGui::InputText("##gRemote.IP", (char*)ip.c_str(), ip.capacity() + 1)) { - CVarSetString("gRemote.IP", ip.c_str()); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetString(CVAR_REMOTE("IP"), ip.c_str()); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); ImGui::PushItemWidth(ImGui::GetFontSize() * 5); if (ImGui::InputScalar("##gRemote.Port", ImGuiDataType_U16, &port)) { - CVarSetInteger("gRemote.Port", port); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + CVarSetInteger(CVAR_REMOTE("Port"), port); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::PopItemWidth(); @@ -1922,9 +1917,10 @@ void DrawRemoteControlMenu() { const char* buttonLabel = GameInteractor::Instance->isRemoteInteractorEnabled ? "Disable" : "Enable"; if (ImGui::Button(buttonLabel, ImVec2(-1.0f, 0.0f))) { if (GameInteractor::Instance->isRemoteInteractorEnabled) { - CVarSetInteger("gRemote.Enabled", 0); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - switch (CVarGetInteger("gRemote.Scheme", GI_SCHEME_SAIL)) { + CVarClear(CVAR_REMOTE("Enabled")); + CVarClear(CVAR_REMOTE("CrowdControl")); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + switch (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL)) { case GI_SCHEME_SAIL: GameInteractorSail::Instance->Disable(); break; @@ -1933,9 +1929,9 @@ void DrawRemoteControlMenu() { break; } } else { - CVarSetInteger("gRemote.Enabled", 1); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - switch (CVarGetInteger("gRemote.Scheme", GI_SCHEME_SAIL)) { + CVarSetInteger(CVAR_REMOTE("Enabled"), 1); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + switch (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL)) { case GI_SCHEME_SAIL: GameInteractorSail::Instance->Enable(); break; @@ -1972,7 +1968,7 @@ extern "C" u8 Randomizer_GetSettingValue(RandomizerSettingKey randoSettingKey); void DrawRandomizerMenu() { if (ImGui::BeginMenu("Randomizer")) { - UIWidgets::EnhancementCheckbox("Plando Mode", "gPlandoMode"); + UIWidgets::EnhancementCheckbox("Plando Mode", CVAR_GENERAL("PlandoMode")); UIWidgets::Tooltip( "When dropping a spoiler file on the game window, parse the full spoiler file instead of just the " "necessary " @@ -1990,39 +1986,39 @@ void DrawRandomizerMenu() { static ImVec2 buttonSize(200.0f, 0.0f); #endif if (mRandomizerSettingsWindow) { - if (ImGui::Button(GetWindowButtonText("Randomizer Settings", CVarGetInteger("gRandomizerSettingsEnabled", 0)).c_str(), buttonSize)) { + if (ImGui::Button(GetWindowButtonText("Randomizer Settings", CVarGetInteger(CVAR_WINDOW("RandomizerSettings"), 0)).c_str(), buttonSize)) { mRandomizerSettingsWindow->ToggleVisibility(); } } UIWidgets::Spacer(0); if (mItemTrackerWindow) { - if (ImGui::Button(GetWindowButtonText("Item Tracker", CVarGetInteger("gItemTrackerEnabled", 0)).c_str(), buttonSize)) { + if (ImGui::Button(GetWindowButtonText("Item Tracker", CVarGetInteger(CVAR_WINDOW("ItemTracker"), 0)).c_str(), buttonSize)) { mItemTrackerWindow->ToggleVisibility(); } } UIWidgets::Spacer(0); if (mItemTrackerSettingsWindow) { - if (ImGui::Button(GetWindowButtonText("Item Tracker Settings", CVarGetInteger("gItemTrackerSettingsEnabled", 0)).c_str(), buttonSize)) { + if (ImGui::Button(GetWindowButtonText("Item Tracker Settings", CVarGetInteger(CVAR_WINDOW("ItemTrackerSettings"), 0)).c_str(), buttonSize)) { mItemTrackerSettingsWindow->ToggleVisibility(); } } UIWidgets::Spacer(0); if (mEntranceTrackerWindow) { - if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVarGetInteger("gEntranceTrackerEnabled", 0)).c_str(), buttonSize)) { + if (ImGui::Button(GetWindowButtonText("Entrance Tracker", CVarGetInteger(CVAR_WINDOW("EntranceTracker"), 0)).c_str(), buttonSize)) { mEntranceTrackerWindow->ToggleVisibility(); } } UIWidgets::Spacer(0); if (mCheckTrackerWindow) { - if (ImGui::Button(GetWindowButtonText("Check Tracker", CVarGetInteger("gCheckTrackerEnabled", 0)).c_str(), buttonSize)) { + if (ImGui::Button(GetWindowButtonText("Check Tracker", CVarGetInteger(CVAR_WINDOW("CheckTracker"), 0)).c_str(), buttonSize)) { mCheckTrackerWindow->ToggleVisibility(); } } UIWidgets::Spacer(0); if (mCheckTrackerSettingsWindow) { - if (ImGui::Button(GetWindowButtonText("Check Tracker Settings", CVarGetInteger("gCheckTrackerSettingsEnabled", 0)).c_str(), buttonSize)) { + if (ImGui::Button(GetWindowButtonText("Check Tracker Settings", CVarGetInteger(CVAR_WINDOW("CheckTrackerSettings"), 0)).c_str(), buttonSize)) { mCheckTrackerSettingsWindow->ToggleVisibility(); } } @@ -2033,11 +2029,11 @@ void DrawRandomizerMenu() { if (ImGui::BeginMenu("Rando Enhancements")) { - UIWidgets::EnhancementCheckbox("Rando-Relevant Navi Hints", "gRandoRelevantNavi", false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::EnhancementCheckbox("Rando-Relevant Navi Hints", CVAR_RANDOMIZER_ENHANCEMENT("RandoRelevantNavi"), false, "", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip( "Replace Navi's overworld quest hints with rando-related gameplay hints." ); - UIWidgets::PaddedEnhancementCheckbox("Random Rupee Names", "gRandomizeRupeeNames", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); + UIWidgets::PaddedEnhancementCheckbox("Random Rupee Names", CVAR_RANDOMIZER_ENHANCEMENT("RandomizeRupeeNames"), true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip( "When obtaining rupees, randomize what the rupee is called in the textbox." ); @@ -2063,7 +2059,7 @@ void DrawRandomizerMenu() { "This setting is disabled because a savefile is loaded without any key\n" "shuffle settings set to \"Any Dungeon\", \"Overworld\" or \"Anywhere\""; - UIWidgets::PaddedEnhancementCheckbox("Key Colors Match Dungeon", "gRandoMatchKeyColors", true, false, + UIWidgets::PaddedEnhancementCheckbox("Key Colors Match Dungeon", CVAR_RANDOMIZER_ENHANCEMENT("MatchKeyColors"), true, false, disableKeyColors, disableKeyColorsText, UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip( "Matches the color of small keys and boss keys to the dungeon they belong to. " @@ -2076,7 +2072,7 @@ void DrawRandomizerMenu() { "This setting is disabled because a savefile is loaded without the compass\n" "shuffle settings set to \"Any Dungeon\", \"Overworld\" or \"Anywhere\""; - if (UIWidgets::PaddedEnhancementCheckbox("Compass Colors Match Dungeon", "gRandoEnhancement.MatchCompassColors", true, false, + if (UIWidgets::PaddedEnhancementCheckbox("Compass Colors Match Dungeon", CVAR_RANDOMIZER_ENHANCEMENT("MatchCompassColors"), true, false, disableCompassColors, disableCompassColorsText, UIWidgets::CheckboxGraphics::Cross, true)) { PatchCompasses(); } @@ -2085,7 +2081,7 @@ void DrawRandomizerMenu() { "This helps identify compasses from afar and adds a little bit of flair.\n\nThis only " "applies to seeds with compasses shuffled to \"Any Dungeon\", \"Overworld\", or \"Anywhere\"."); - UIWidgets::PaddedEnhancementCheckbox("Quest Item Fanfares", "gRandoQuestItemFanfares", true, false); + UIWidgets::PaddedEnhancementCheckbox("Quest Item Fanfares", CVAR_RANDOMIZER_ENHANCEMENT("QuestItemFanfares"), true, false); UIWidgets::Tooltip( "Play unique fanfares when obtaining quest items " "(medallions/stones/songs). Note that these fanfares are longer than usual." diff --git a/soh/soh/SohMenuBar.h b/soh/soh/SohMenuBar.h index ce62344ad..99fb8a0ae 100644 --- a/soh/soh/SohMenuBar.h +++ b/soh/soh/SohMenuBar.h @@ -5,9 +5,9 @@ #include "window/gui/GuiElement.h" namespace SohGui { -class SohMenuBar : public LUS::GuiMenuBar { +class SohMenuBar : public Ship::GuiMenuBar { public: - using LUS::GuiMenuBar::GuiMenuBar; + using Ship::GuiMenuBar::GuiMenuBar; protected: void DrawElement() override; void InitElement() override {}; diff --git a/soh/soh/SohModals.cpp b/soh/soh/SohModals.cpp index 087bc8ab1..44dc93d74 100644 --- a/soh/soh/SohModals.cpp +++ b/soh/soh/SohModals.cpp @@ -1,5 +1,5 @@ #include "SohModals.h" -#include "ImGui/imgui.h" +#include #include #include #include diff --git a/soh/soh/SohModals.h b/soh/soh/SohModals.h index 6f5acb2c0..b64e180b6 100644 --- a/soh/soh/SohModals.h +++ b/soh/soh/SohModals.h @@ -4,9 +4,9 @@ #include "window/gui/GuiMenuBar.h" #include "window/gui/GuiElement.h" -class SohModalWindow : public LUS::GuiWindow { +class SohModalWindow : public Ship::GuiWindow { public: - using LUS::GuiWindow::GuiWindow; + using GuiWindow::GuiWindow; void InitElement() override {}; void DrawElement() override; diff --git a/soh/soh/UIWidgets.cpp b/soh/soh/UIWidgets.cpp index 4817e85fc..d1bf0967a 100644 --- a/soh/soh/UIWidgets.cpp +++ b/soh/soh/UIWidgets.cpp @@ -10,8 +10,8 @@ #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif -#include -#include +#include +#include #include #include @@ -208,7 +208,7 @@ namespace UIWidgets { bool val = (bool)CVarGetInteger(cvarName, defaultValue); if (CustomCheckbox(text, &val, disabled, disabledGraphic)) { CVarSetInteger(cvarName, val); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); changed = true; } @@ -248,7 +248,7 @@ namespace UIWidgets { CVarSetInteger(cvarName, i); selected = i; changed = true; - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } } @@ -261,7 +261,7 @@ namespace UIWidgets { if (disabledValue >= 0 && selected != disabledValue) { CVarSetInteger(cvarName, disabledValue); changed = true; - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } } @@ -351,7 +351,7 @@ namespace UIWidgets { if (changed && (oldVal != val)) { CVarSetInteger(cvarName, val); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } else { changed = false; } @@ -452,7 +452,7 @@ namespace UIWidgets { ss << std::setprecision(ticks + 1) << std::setiosflags(std::ios_base::fixed) << val; val = std::stof(ss.str()); CVarSetFloat(cvarName, val); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } else { changed = false; } @@ -486,14 +486,14 @@ namespace UIWidgets { bool EnhancementRadioButton(const char* text, const char* cvarName, int id) { /*Usage : - EnhancementRadioButton("My Visible Name","gMyCVarName", MyID); + EnhancementRadioButton("My Visible Name",CVAR_GROUP("MyCVarName"), MyID); First arg is the visible name of the Radio button Second is the cvar name where MyID will be saved. Note: the CVar name should be the same to each Buddies. Example : - EnhancementRadioButton("English", "gLanguages", LANGUAGE_ENG); - EnhancementRadioButton("German", "gLanguages", LANGUAGE_GER); - EnhancementRadioButton("French", "gLanguages", LANGUAGE_FRA); + EnhancementRadioButton("English", CVAR_SETTING("Languages"), LANGUAGE_ENG); + EnhancementRadioButton("German", CVAR_SETTING("Languages"), LANGUAGE_GER); + EnhancementRadioButton("French", CVAR_SETTING("Languages"), LANGUAGE_FRA); */ std::string make_invisible = "##" + std::string(text) + std::string(cvarName); @@ -501,7 +501,7 @@ namespace UIWidgets { int val = CVarGetInteger(cvarName, 0); if (ImGui::RadioButton(make_invisible.c_str(), id == val)) { CVarSetInteger(cvarName, id); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); ret = true; } ImGui::SameLine(); @@ -528,7 +528,7 @@ namespace UIWidgets { CVarSetColor(cvarName, colorsRGBA); CVarSetInteger(Cvar_RBM.c_str(), 0); //On click disable rainbow mode. - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); changed = true; } Tooltip("Revert colors to the game's original colors (GameCube version)\nOverwrites previously chosen color"); @@ -553,7 +553,7 @@ namespace UIWidgets { NewColors.b = fmin(fmax(colors->z * 255, 0), 255); CVarSetColor(cvarName, NewColors); CVarSetInteger(Cvar_RBM.c_str(), 0); // On click disable rainbow mode. - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); changed = true; } Tooltip("Chooses a random color\nOverwrites previously chosen color"); @@ -614,7 +614,7 @@ namespace UIWidgets { colors.a = 255.0; CVarSetColor(cvarName, colors); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); changed = true; } } @@ -630,7 +630,7 @@ namespace UIWidgets { colors.a = ColorRGBA.w * 255.0; CVarSetColor(cvarName, colors); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); changed = true; } } diff --git a/soh/soh/UIWidgets.hpp b/soh/soh/UIWidgets.hpp index f1086a944..70580340c 100644 --- a/soh/soh/UIWidgets.hpp +++ b/soh/soh/UIWidgets.hpp @@ -16,7 +16,7 @@ #ifndef IMGUI_DEFINE_MATH_OPERATORS #define IMGUI_DEFINE_MATH_OPERATORS #endif -#include +#include namespace UIWidgets { diff --git a/soh/soh/config/ConfigUpdaters.cpp b/soh/soh/config/ConfigUpdaters.cpp index 1951e78e1..b3d137c1f 100644 --- a/soh/soh/config/ConfigUpdaters.cpp +++ b/soh/soh/config/ConfigUpdaters.cpp @@ -1,11 +1,11 @@ #include "ConfigUpdaters.h" #include "soh/Enhancements/audio/AudioCollection.h" -namespace LUS { +namespace SOH { ConfigVersion1Updater::ConfigVersion1Updater() : ConfigVersionUpdater(1) {} ConfigVersion2Updater::ConfigVersion2Updater() : ConfigVersionUpdater(2) {} - void ConfigVersion1Updater::Update(Config* conf) { + void ConfigVersion1Updater::Update(Ship::Config* conf) { if (conf->GetInt("Window.Width", 640) == 640) { conf->Erase("Window.Width"); } @@ -36,10 +36,10 @@ namespace LUS { if (conf->GetInt("Window.Fullscreen.Height", 1080) == 1080) { conf->Erase("Window.Fullscreen.Height"); } - if (conf->GetInt("Shortcuts.Fullscreen", KbScancode::LUS_KB_F11) == KbScancode::LUS_KB_F10) { + if (conf->GetInt("Shortcuts.Fullscreen", Ship::KbScancode::LUS_KB_F11) == Ship::KbScancode::LUS_KB_F10) { conf->Erase("Shortcuts.Fullscreen"); } - if (conf->GetInt("Shortcuts.Console", KbScancode::LUS_KB_OEM_3) == KbScancode::LUS_KB_OEM_3) { + if (conf->GetInt("Shortcuts.Console", Ship::KbScancode::LUS_KB_OEM_3) == Ship::KbScancode::LUS_KB_OEM_3) { conf->Erase("Shortcuts.Console"); } if (conf->GetString("Game.SaveName", "") == "") { @@ -52,7 +52,7 @@ namespace LUS { conf->Erase("Game.Patches Archive"); } if (CVarGetInteger("gDirtPathFix", 0) != 0) { - CVarSetInteger("gZFightingMode", CVarGetInteger("gDirtPathFix", 0)); + CVarSetInteger(CVAR_Z_FIGHTING_MODE, CVarGetInteger("gDirtPathFix", 0)); CVarClear("gDirtPathFix"); } if (CVarGetInteger("gRandomizedEnemies", 0) != 0) { @@ -63,7 +63,7 @@ namespace LUS { CVarClear("gSeededRandomizedEnemies"); } - void ConfigVersion2Updater::Update(Config* conf) { + void ConfigVersion2Updater::Update(Ship::Config* conf) { for (auto seq : AudioCollection::Instance->GetAllSequences()) { CVarClear(std::string("gAudioEditor.ReplacedSequences." + seq.second.sfxKey).c_str()); } diff --git a/soh/soh/config/ConfigUpdaters.h b/soh/soh/config/ConfigUpdaters.h index cc8f6109a..4c9234476 100644 --- a/soh/soh/config/ConfigUpdaters.h +++ b/soh/soh/config/ConfigUpdaters.h @@ -1,15 +1,15 @@ #include "libultraship/libultraship.h" -namespace LUS { - class ConfigVersion1Updater : public ConfigVersionUpdater { +namespace SOH { + class ConfigVersion1Updater : public Ship::ConfigVersionUpdater { public: ConfigVersion1Updater(); - void Update(Config* conf); + void Update(Ship::Config* conf); }; - class ConfigVersion2Updater : public ConfigVersionUpdater { + class ConfigVersion2Updater : public Ship::ConfigVersionUpdater { public: ConfigVersion2Updater(); - void Update(Config* conf); + void Update(Ship::Config* conf); }; } \ No newline at end of file diff --git a/soh/soh/resource/importer/AnimationFactory.cpp b/soh/soh/resource/importer/AnimationFactory.cpp index 8e1aca9b7..13aa71c86 100644 --- a/soh/soh/resource/importer/AnimationFactory.cpp +++ b/soh/soh/resource/importer/AnimationFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr ResourceFactoryBinaryAnimationV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryAnimationV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto animation = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); AnimationType animType = (AnimationType)reader->ReadUInt32(); animation->type = animType; diff --git a/soh/soh/resource/importer/AnimationFactory.h b/soh/soh/resource/importer/AnimationFactory.h index 36dfceaae..ae27832b6 100644 --- a/soh/soh/resource/importer/AnimationFactory.h +++ b/soh/soh/resource/importer/AnimationFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAnimationV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryAnimationV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/AudioSampleFactory.cpp b/soh/soh/resource/importer/AudioSampleFactory.cpp index b45e698e5..0ec3f5260 100644 --- a/soh/soh/resource/importer/AudioSampleFactory.cpp +++ b/soh/soh/resource/importer/AudioSampleFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr ResourceFactoryBinaryAudioSampleV2::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryAudioSampleV2::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto audioSample = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); audioSample->sample.codec = reader->ReadUByte(); audioSample->sample.medium = reader->ReadUByte(); @@ -71,7 +71,7 @@ extern "C" SoundFontSample* ReadCustomSample(const char* path) { ExtensionEntry entry = ExtensionCache[path]; - auto sampleRaw = LUS::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path); + auto sampleRaw = Ship::Context::GetInstance()->GetResourceManager()->LoadFile(entry.path); uint32_t* strem = (uint32_t*)sampleRaw->Buffer.get(); uint8_t* strem2 = (uint8_t*)strem; diff --git a/soh/soh/resource/importer/AudioSampleFactory.h b/soh/soh/resource/importer/AudioSampleFactory.h index 2680ccdc2..372e8a310 100644 --- a/soh/soh/resource/importer/AudioSampleFactory.h +++ b/soh/soh/resource/importer/AudioSampleFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAudioSampleV2 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryAudioSampleV2 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/AudioSequenceFactory.cpp b/soh/soh/resource/importer/AudioSequenceFactory.cpp index ba2a36697..35da7f798 100644 --- a/soh/soh/resource/importer/AudioSequenceFactory.cpp +++ b/soh/soh/resource/importer/AudioSequenceFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto audioSequence = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); audioSequence->sequence.seqDataSize = reader->ReadInt32(); audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize); diff --git a/soh/soh/resource/importer/AudioSequenceFactory.h b/soh/soh/resource/importer/AudioSequenceFactory.h index fb4391d61..35fd1ebef 100644 --- a/soh/soh/resource/importer/AudioSequenceFactory.h +++ b/soh/soh/resource/importer/AudioSequenceFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAudioSequenceV2 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryAudioSequenceV2 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/AudioSoundFontFactory.cpp b/soh/soh/resource/importer/AudioSoundFontFactory.cpp index 6d7efc58c..534a7914c 100644 --- a/soh/soh/resource/importer/AudioSoundFontFactory.cpp +++ b/soh/soh/resource/importer/AudioSoundFontFactory.cpp @@ -4,13 +4,13 @@ #include "libultraship/libultraship.h" namespace SOH { -std::shared_ptr ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto audioSoundFont = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); audioSoundFont->soundFont.fntIndex = reader->ReadInt32(); audioSoundFont->medium = reader->ReadInt8(); @@ -67,7 +67,7 @@ std::shared_ptr ResourceFactoryBinaryAudioSoundFontV2::ReadResou if (sampleFileName.empty()) { drum.sound.sample = nullptr; } else { - auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); drum.sound.sample = static_cast(res ? res->GetRawPointer() : nullptr); } @@ -111,7 +111,7 @@ std::shared_ptr ResourceFactoryBinaryAudioSoundFontV2::ReadResou bool hasSampleRef = reader->ReadInt8(); std::string sampleFileName = reader->ReadString(); instrument.lowNotesSound.tuning = reader->ReadFloat(); - auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); instrument.lowNotesSound.sample = static_cast(res ? res->GetRawPointer() : nullptr); } else { instrument.lowNotesSound.sample = nullptr; @@ -123,7 +123,7 @@ std::shared_ptr ResourceFactoryBinaryAudioSoundFontV2::ReadResou bool hasSampleRef = reader->ReadInt8(); std::string sampleFileName = reader->ReadString(); instrument.normalNotesSound.tuning = reader->ReadFloat(); - auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); instrument.normalNotesSound.sample = static_cast(res ? res->GetRawPointer() : nullptr); } else { instrument.normalNotesSound.sample = nullptr; @@ -135,7 +135,7 @@ std::shared_ptr ResourceFactoryBinaryAudioSoundFontV2::ReadResou bool hasSampleRef = reader->ReadInt8(); std::string sampleFileName = reader->ReadString(); instrument.highNotesSound.tuning = reader->ReadFloat(); - auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); instrument.highNotesSound.sample = static_cast(res ? res->GetRawPointer() : nullptr); } else { instrument.highNotesSound.sample = nullptr; @@ -160,7 +160,7 @@ std::shared_ptr ResourceFactoryBinaryAudioSoundFontV2::ReadResou bool hasSampleRef = reader->ReadInt8(); std::string sampleFileName = reader->ReadString(); soundEffect.tuning = reader->ReadFloat(); - auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(sampleFileName.c_str()); soundEffect.sample = static_cast(res ? res->GetRawPointer() : nullptr); } diff --git a/soh/soh/resource/importer/AudioSoundFontFactory.h b/soh/soh/resource/importer/AudioSoundFontFactory.h index a63533db9..a80b8fe97 100644 --- a/soh/soh/resource/importer/AudioSoundFontFactory.h +++ b/soh/soh/resource/importer/AudioSoundFontFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAudioSoundFontV2 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryAudioSoundFontV2 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/BackgroundFactory.cpp b/soh/soh/resource/importer/BackgroundFactory.cpp index 07c47cbe9..6be484698 100644 --- a/soh/soh/resource/importer/BackgroundFactory.cpp +++ b/soh/soh/resource/importer/BackgroundFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr ResourceFactoryBinaryBackgroundV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryBackgroundV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto background = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); uint32_t dataSize = reader->ReadUInt32(); diff --git a/soh/soh/resource/importer/BackgroundFactory.h b/soh/soh/resource/importer/BackgroundFactory.h index 787ee509c..e74e897e9 100644 --- a/soh/soh/resource/importer/BackgroundFactory.h +++ b/soh/soh/resource/importer/BackgroundFactory.h @@ -4,8 +4,8 @@ #include "resource/ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryBackgroundV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryBackgroundV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/CollisionHeaderFactory.cpp b/soh/soh/resource/importer/CollisionHeaderFactory.cpp index c5372f249..4636d80c7 100644 --- a/soh/soh/resource/importer/CollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/CollisionHeaderFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr ResourceFactoryBinaryCollisionHeaderV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryCollisionHeaderV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto collisionHeader = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); collisionHeader->collisionHeaderData.minBounds.x = reader->ReadInt16(); collisionHeader->collisionHeaderData.minBounds.y = reader->ReadInt16(); @@ -123,7 +123,7 @@ std::shared_ptr ResourceFactoryBinaryCollisionHeaderV0::ReadReso return collisionHeader; } -std::shared_ptr ResourceFactoryXMLCollisionHeaderV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryXMLCollisionHeaderV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } diff --git a/soh/soh/resource/importer/CollisionHeaderFactory.h b/soh/soh/resource/importer/CollisionHeaderFactory.h index abd878909..dd438f9c3 100644 --- a/soh/soh/resource/importer/CollisionHeaderFactory.h +++ b/soh/soh/resource/importer/CollisionHeaderFactory.h @@ -5,13 +5,13 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinaryCollisionHeaderV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryCollisionHeaderV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class ResourceFactoryXMLCollisionHeaderV0 : public LUS::ResourceFactoryXML { +class ResourceFactoryXMLCollisionHeaderV0 : public Ship::ResourceFactoryXML { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/CutsceneFactory.cpp b/soh/soh/resource/importer/CutsceneFactory.cpp index 28f5e642b..49e44680c 100644 --- a/soh/soh/resource/importer/CutsceneFactory.cpp +++ b/soh/soh/resource/importer/CutsceneFactory.cpp @@ -2,19 +2,19 @@ #include "soh/resource/type/Cutscene.h" #include "spdlog/spdlog.h" -static inline uint32_t read_CMD_BBBB(std::shared_ptr reader) { +static inline uint32_t read_CMD_BBBB(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); return v; } -static inline uint32_t read_CMD_BBH(std::shared_ptr reader) { +static inline uint32_t read_CMD_BBH(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); // swap the half word to match endianness - if (reader->GetEndianness() != LUS::Endianness::Native) { + if (reader->GetEndianness() != Ship::Endianness::Native) { uint8_t* b = (uint8_t*)&v; uint8_t tmp = b[2]; b[2] = b[3]; @@ -24,12 +24,12 @@ static inline uint32_t read_CMD_BBH(std::shared_ptr reader) { return v; } -static inline uint32_t read_CMD_HBB(std::shared_ptr reader) { +static inline uint32_t read_CMD_HBB(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); // swap the half word to match endianness - if (reader->GetEndianness() != LUS::Endianness::Native) { + if (reader->GetEndianness() != Ship::Endianness::Native) { uint8_t* b = (uint8_t*)&v; uint8_t tmp = b[0]; b[0] = b[1]; @@ -39,12 +39,12 @@ static inline uint32_t read_CMD_HBB(std::shared_ptr reader) { return v; } -static inline uint32_t read_CMD_HH(std::shared_ptr reader) { +static inline uint32_t read_CMD_HH(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); // swap the half words to match endianness - if (reader->GetEndianness() != LUS::Endianness::Native) { + if (reader->GetEndianness() != Ship::Endianness::Native) { uint8_t* b = (uint8_t*)&v; uint8_t tmp = b[0]; b[0] = b[1]; @@ -58,13 +58,13 @@ static inline uint32_t read_CMD_HH(std::shared_ptr reader) { } namespace SOH { -std::shared_ptr ResourceFactoryBinaryCutsceneV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryCutsceneV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto cutscene = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); uint32_t numEntries = reader->ReadUInt32(); cutscene->commands.reserve(numEntries); diff --git a/soh/soh/resource/importer/CutsceneFactory.h b/soh/soh/resource/importer/CutsceneFactory.h index 8194615af..8afe98bb8 100644 --- a/soh/soh/resource/importer/CutsceneFactory.h +++ b/soh/soh/resource/importer/CutsceneFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryCutsceneV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryCutsceneV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/PathFactory.cpp b/soh/soh/resource/importer/PathFactory.cpp index 07fc86f40..00807b75a 100644 --- a/soh/soh/resource/importer/PathFactory.cpp +++ b/soh/soh/resource/importer/PathFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr ResourceFactoryBinaryPathV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryPathV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto path = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); path->numPaths = reader->ReadUInt32(); path->paths.reserve(path->numPaths); diff --git a/soh/soh/resource/importer/PathFactory.h b/soh/soh/resource/importer/PathFactory.h index aa8ae747c..ddbee772d 100644 --- a/soh/soh/resource/importer/PathFactory.h +++ b/soh/soh/resource/importer/PathFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryPathV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryPathV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/PlayerAnimationFactory.cpp b/soh/soh/resource/importer/PlayerAnimationFactory.cpp index 4c25d5e80..59610da46 100644 --- a/soh/soh/resource/importer/PlayerAnimationFactory.cpp +++ b/soh/soh/resource/importer/PlayerAnimationFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr ResourceFactoryBinaryPlayerAnimationV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryPlayerAnimationV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto playerAnimation = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); uint32_t numEntries = reader->ReadUInt32(); playerAnimation->limbRotData.reserve(numEntries); diff --git a/soh/soh/resource/importer/PlayerAnimationFactory.h b/soh/soh/resource/importer/PlayerAnimationFactory.h index 8b459a38b..3ee8b1d3a 100644 --- a/soh/soh/resource/importer/PlayerAnimationFactory.h +++ b/soh/soh/resource/importer/PlayerAnimationFactory.h @@ -4,8 +4,8 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryPlayerAnimationV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryPlayerAnimationV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/SceneFactory.cpp b/soh/soh/resource/importer/SceneFactory.cpp index 679d574cb..1bcf92e1c 100644 --- a/soh/soh/resource/importer/SceneFactory.cpp +++ b/soh/soh/resource/importer/SceneFactory.cpp @@ -58,7 +58,7 @@ ResourceFactoryBinarySceneV0::ResourceFactoryBinarySceneV0() { sceneCommandFactories[SceneCommandID::SetMesh] = std::make_shared(); } -void ResourceFactoryBinarySceneV0::ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader) { +void ResourceFactoryBinarySceneV0::ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader) { uint32_t commandCount = reader->ReadUInt32(); scene->commands.reserve(commandCount); @@ -68,16 +68,16 @@ void ResourceFactoryBinarySceneV0::ParseSceneCommands(std::shared_ptr sce } std::shared_ptr ResourceFactoryBinarySceneV0::ParseSceneCommand(std::shared_ptr scene, - std::shared_ptr reader, uint32_t index) { + std::shared_ptr reader, uint32_t index) { SceneCommandID cmdID = (SceneCommandID)reader->ReadInt32(); - reader->Seek(-sizeof(int32_t), LUS::SeekOffsetType::Current); + reader->Seek(-sizeof(int32_t), Ship::SeekOffsetType::Current); std::shared_ptr result = nullptr; auto commandFactory = ResourceFactoryBinarySceneV0::sceneCommandFactories[cmdID]; if (commandFactory != nullptr) { - auto initData = std::make_shared(); + auto initData = std::make_shared(); initData->Id = scene->GetInitData()->Id; initData->Type = static_cast(SOH::ResourceType::SOH_SceneCommand); initData->Path = scene->GetInitData()->Path + "/SceneCommand" + std::to_string(index); @@ -93,13 +93,136 @@ std::shared_ptr ResourceFactoryBinarySceneV0::ParseSceneCommand(s return result; } -std::shared_ptr ResourceFactoryBinarySceneV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinarySceneV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto scene = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); + + ParseSceneCommands(scene, reader); + + return scene; +}; + +ResourceFactoryXMLSceneV0::ResourceFactoryXMLSceneV0() { + sceneCommandFactories[SceneCommandID::SetLightingSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetWind] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetExitList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetTimeSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSkyboxModifier] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetEchoSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSoundSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSkyboxSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetRoomBehavior] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCsCamera] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCameraSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetRoomList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCollisionHeader] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetEntranceList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSpecialObjects] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetObjectList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetStartPositionList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetActorList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetTransitionActorList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::EndMarker] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetAlternateHeaders] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetPathways] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCutscenes] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetLightList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetMesh] = std::make_shared(); +} + +std::vector commandNames = { + "SetStartPositionList", + "SetActorList", + "SetCsCamera", + "SetCollisionHeader", + "SetRoomList", + "SetWind", + "SetEntranceList", + "SetSpecialObjects", + "SetRoomBehavior", + "Unused09", + "SetMesh", + "SetObjectList", + "SetLightList", + "SetPathways", + "SetTransitionActorList", + "SetLightingSettings", + "SetTimeSettings", + "SetSkyboxSettings", + "SetSkyboxModifier", + "SetExitList", + "EndMarker", + "SetSoundSettings", + "SetEchoSettings", + "SetCutscenes", + "SetAlternateHeaders", + "SetCameraSettings", +}; + +SceneCommandID GetCommandID(std::string commandName) { + for (int i = 0; i < commandNames.size(); i++) { + if (commandNames[i] == commandName) { + return (SceneCommandID)i; + } + } + + return SceneCommandID::Error; +} + +void ResourceFactoryXMLSceneV0::ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader) { + auto child = reader->RootElement()->FirstChildElement(); + + int i = 0; + + while (child != nullptr) { + scene->commands.push_back(ParseSceneCommand(scene, child, i)); + + child = child->NextSiblingElement(); + i += 1; + } +} + +std::shared_ptr ResourceFactoryXMLSceneV0::ParseSceneCommand(std::shared_ptr scene, + tinyxml2::XMLElement* child, uint32_t index) { + std::string commandName = child->Name(); + SceneCommandID cmdID = GetCommandID(commandName); + + if (cmdID == SceneCommandID::Error) { + SPDLOG_ERROR("Failed to load scene command with name {} in scene {}", commandName, scene->GetInitData()->Path); + return nullptr; + } + + std::shared_ptr result = nullptr; + auto commandFactory = ResourceFactoryXMLSceneV0::sceneCommandFactories[cmdID]; + + if (commandFactory != nullptr) { + auto initData = std::make_shared(); + initData->Id = scene->GetInitData()->Id; + initData->Type = static_cast(ResourceType::SOH_SceneCommand); + initData->Path = scene->GetInitData()->Path + "/SceneCommand" + std::to_string(index); + initData->ResourceVersion = scene->GetInitData()->ResourceVersion; + result = std::static_pointer_cast(commandFactory->ReadResource(initData, child)); + // Cache the resource? + } + + if (result == nullptr) { + SPDLOG_ERROR("Failed to load scene command of type {} in scene {}", (uint32_t)cmdID, scene->GetInitData()->Path); + } + + return result; +} + +std::shared_ptr ResourceFactoryXMLSceneV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto scene = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); ParseSceneCommands(scene, reader); diff --git a/soh/soh/resource/importer/SceneFactory.h b/soh/soh/resource/importer/SceneFactory.h index 5dfed2739..115c3f3f5 100644 --- a/soh/soh/resource/importer/SceneFactory.h +++ b/soh/soh/resource/importer/SceneFactory.h @@ -5,14 +5,15 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" #include "Resource.h" #include "ResourceFactoryBinary.h" +#include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinarySceneV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinarySceneV0 : public Ship::ResourceFactoryBinary { public: ResourceFactoryBinarySceneV0(); - std::shared_ptr ReadResource(std::shared_ptr file) override; - void ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader); + std::shared_ptr ReadResource(std::shared_ptr file) override; + void ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader); // Doing something very similar to what we do on the ResourceLoader. // Eventually, scene commands should be moved up to the ResourceLoader as well. @@ -20,6 +21,22 @@ class ResourceFactoryBinarySceneV0 : public LUS::ResourceFactoryBinary { // and the exporter does not export the commands with a proper OTR header. static inline std::unordered_map> sceneCommandFactories; protected: - std::shared_ptr ParseSceneCommand(std::shared_ptr scene, std::shared_ptr reader, uint32_t index); + std::shared_ptr ParseSceneCommand(std::shared_ptr scene, std::shared_ptr reader, uint32_t index); +}; + +class ResourceFactoryXMLSceneV0 : public Ship::ResourceFactoryXML { + public: + ResourceFactoryXMLSceneV0(); + + std::shared_ptr ReadResource(std::shared_ptr file) override; + void ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader); + + // Doing something very similar to what we do on the ResourceLoader. + // Eventually, scene commands should be moved up to the ResourceLoader as well. + // They can not right now because the exporter does not give them a proper resource type enum value, + // and the exporter does not export the commands with a proper OTR header. + static inline std::unordered_map> sceneCommandFactories; +protected: + std::shared_ptr ParseSceneCommand(std::shared_ptr scene, tinyxml2::XMLElement* child, uint32_t index); }; } // namespace SOH diff --git a/soh/soh/resource/importer/SkeletonFactory.cpp b/soh/soh/resource/importer/SkeletonFactory.cpp index fedfda400..d4cb965bf 100644 --- a/soh/soh/resource/importer/SkeletonFactory.cpp +++ b/soh/soh/resource/importer/SkeletonFactory.cpp @@ -4,13 +4,13 @@ #include namespace SOH { -std::shared_ptr ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto skeleton = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); skeleton->type = (SkeletonType)reader->ReadInt8(); skeleton->limbType = (LimbType)reader->ReadInt8(); @@ -43,7 +43,7 @@ std::shared_ptr ResourceFactoryBinarySkeletonV0::ReadResource(st for (size_t i = 0; i < skeleton->limbTable.size(); i++) { std::string limbStr = skeleton->limbTable[i]; - auto limb = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbStr.c_str()); + auto limb = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbStr.c_str()); skeleton->skeletonHeaderSegments.push_back(limb ? limb->GetRawPointer() : nullptr); } @@ -62,7 +62,7 @@ std::shared_ptr ResourceFactoryBinarySkeletonV0::ReadResource(st return skeleton; } -std::shared_ptr ResourceFactoryXMLSkeletonV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryXMLSkeletonV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } @@ -112,7 +112,7 @@ std::shared_ptr ResourceFactoryXMLSkeletonV0::ReadResource(std:: std::string limbName = child->Attribute("Path"); skel->limbTable.push_back(limbName); - auto limb = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbName.c_str()); + auto limb = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(limbName.c_str()); skel->skeletonHeaderSegments.push_back(limb ? limb->GetRawPointer() : nullptr); } diff --git a/soh/soh/resource/importer/SkeletonFactory.h b/soh/soh/resource/importer/SkeletonFactory.h index 5de02175f..24f92720a 100644 --- a/soh/soh/resource/importer/SkeletonFactory.h +++ b/soh/soh/resource/importer/SkeletonFactory.h @@ -5,13 +5,13 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinarySkeletonV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinarySkeletonV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class ResourceFactoryXMLSkeletonV0 : public LUS::ResourceFactoryXML { +class ResourceFactoryXMLSkeletonV0 : public Ship::ResourceFactoryXML { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/SkeletonLimbFactory.cpp b/soh/soh/resource/importer/SkeletonLimbFactory.cpp index 15ba92281..3f780e6d4 100644 --- a/soh/soh/resource/importer/SkeletonLimbFactory.cpp +++ b/soh/soh/resource/importer/SkeletonLimbFactory.cpp @@ -4,13 +4,13 @@ #include "libultraship/libultraship.h" namespace SOH { -std::shared_ptr ResourceFactoryBinarySkeletonLimbV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinarySkeletonLimbV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto skeletonLimb = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); skeletonLimb->limbType = (LimbType)reader->ReadInt8(); skeletonLimb->skinSegmentType = (ZLimbSkinType)reader->ReadInt8(); @@ -184,7 +184,7 @@ std::shared_ptr ResourceFactoryBinarySkeletonLimbV0::ReadResourc return skeletonLimb; } -std::shared_ptr ResourceFactoryXMLSkeletonLimbV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryXMLSkeletonLimbV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } diff --git a/soh/soh/resource/importer/SkeletonLimbFactory.h b/soh/soh/resource/importer/SkeletonLimbFactory.h index 125dde2b8..222cefa2c 100644 --- a/soh/soh/resource/importer/SkeletonLimbFactory.h +++ b/soh/soh/resource/importer/SkeletonLimbFactory.h @@ -5,13 +5,13 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinarySkeletonLimbV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinarySkeletonLimbV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class ResourceFactoryXMLSkeletonLimbV0 : public LUS::ResourceFactoryXML { +class ResourceFactoryXMLSkeletonLimbV0 : public Ship::ResourceFactoryXML { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/TextFactory.cpp b/soh/soh/resource/importer/TextFactory.cpp index 89d229f80..1da1d50db 100644 --- a/soh/soh/resource/importer/TextFactory.cpp +++ b/soh/soh/resource/importer/TextFactory.cpp @@ -3,13 +3,13 @@ #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr ResourceFactoryBinaryTextV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryBinaryTextV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } auto text = std::make_shared(file->InitData); - auto reader = std::get>(file->Reader); + auto reader = std::get>(file->Reader); uint32_t msgCount = reader->ReadUInt32(); text->messages.reserve(msgCount); @@ -27,7 +27,7 @@ std::shared_ptr ResourceFactoryBinaryTextV0::ReadResource(std::s return text; } -std::shared_ptr ResourceFactoryXMLTextV0::ReadResource(std::shared_ptr file) { +std::shared_ptr ResourceFactoryXMLTextV0::ReadResource(std::shared_ptr file) { if (!FileHasValidFormatAndReader(file)) { return nullptr; } diff --git a/soh/soh/resource/importer/TextFactory.h b/soh/soh/resource/importer/TextFactory.h index cb466204b..55a569366 100644 --- a/soh/soh/resource/importer/TextFactory.h +++ b/soh/soh/resource/importer/TextFactory.h @@ -5,13 +5,13 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinaryTextV0 : public LUS::ResourceFactoryBinary { +class ResourceFactoryBinaryTextV0 : public Ship::ResourceFactoryBinary { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class ResourceFactoryXMLTextV0 : public LUS::ResourceFactoryXML { +class ResourceFactoryXMLTextV0 : public Ship::ResourceFactoryXML { public: - std::shared_ptr ReadResource(std::shared_ptr file) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp index ffcf17410..6932117f1 100644 --- a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp @@ -1,14 +1,28 @@ #include "soh/resource/importer/scenecommand/EndMarkerFactory.h" #include "soh/resource/type/scenecommand/EndMarker.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -EndMarkerFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +EndMarkerFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto endMarker = std::make_shared(initData); ReadCommandId(endMarker, reader); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogEndMarkerAsXML(endMarker); + } + + return endMarker; +} + +std::shared_ptr EndMarkerFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto endMarker = std::make_shared(initData); + + endMarker->cmdId = SceneCommandID::EndMarker; + return endMarker; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h index 486aaa2fb..62dfcd7c4 100644 --- a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h +++ b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h @@ -5,6 +5,12 @@ namespace SOH { class EndMarkerFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class EndMarkerFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp index 9ab5d1611..8d7de5021 100644 --- a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp @@ -3,7 +3,7 @@ #include "spdlog/spdlog.h" namespace SOH { -void SceneCommandFactoryBinaryV0::ReadCommandId(std::shared_ptr command, std::shared_ptr reader) { +void SceneCommandFactoryBinaryV0::ReadCommandId(std::shared_ptr command, std::shared_ptr reader) { command->cmdId = (SceneCommandID)reader->ReadInt32(); } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h index 4cebc4a64..601996ea4 100644 --- a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h +++ b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h @@ -4,13 +4,22 @@ #include "Resource.h" #include "ResourceFactory.h" #include "soh/resource/type/scenecommand/SceneCommand.h" +#include "public/bridge/consolevariablebridge.h" namespace SOH { class SceneCommandFactoryBinaryV0 { public: - virtual std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) = 0; + virtual std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) = 0; protected: - void ReadCommandId(std::shared_ptr command, std::shared_ptr reader); + void ReadCommandId(std::shared_ptr command, std::shared_ptr reader); +}; + +class SceneCommandFactoryXMLV0 { + public: + virtual std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) = 0; + + protected: + void ReadCommandId(std::shared_ptr command, tinyxml2::XMLElement* reader); }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp index 86deea193..6c262e7af 100644 --- a/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetActorListFactory.h" #include "soh/resource/type/scenecommand/SetActorList.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetActorListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetActorListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setActorList = std::make_shared(initData); ReadCommandId(setActorList, reader); @@ -26,6 +27,41 @@ SetActorListFactory::ReadResource(std::shared_ptr initDat setActorList->actorList.push_back(entry); } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogActorListAsXML(setActorList); + } + + return setActorList; +} + +std::shared_ptr SetActorListFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setActorList = std::make_shared(initData); + + setActorList->cmdId = SceneCommandID::SetActorList; + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "ActorEntry") { + ActorEntry entry; + entry.id = child->IntAttribute("Id"); + entry.pos.x = child->IntAttribute("PosX"); + entry.pos.y = child->IntAttribute("PosY"); + entry.pos.z = child->IntAttribute("PosZ"); + entry.rot.x = child->IntAttribute("RotX"); + entry.rot.y = child->IntAttribute("RotY"); + entry.rot.z = child->IntAttribute("RotZ"); + entry.params = child->IntAttribute("Params"); + setActorList->actorList.push_back(entry); + } + + child = child->NextSiblingElement(); + } + + setActorList->numActors = setActorList->actorList.size(); + return setActorList; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetActorListFactory.h b/soh/soh/resource/importer/scenecommand/SetActorListFactory.h index 49a269cfe..703181c9a 100644 --- a/soh/soh/resource/importer/scenecommand/SetActorListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetActorListFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetActorListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetActorListFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp index 833d0af8c..c04f717c3 100644 --- a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp @@ -1,11 +1,12 @@ #include "soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h" #include "soh/resource/type/scenecommand/SetAlternateHeaders.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" #include "libultraship/libultraship.h" namespace SOH { -std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { +std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { auto setAlternateHeaders = std::make_shared(initData); ReadCommandId(setAlternateHeaders, reader); @@ -15,12 +16,45 @@ std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::sh for (uint32_t i = 0; i < setAlternateHeaders->numHeaders; i++) { auto headerName = reader->ReadString(); if (!headerName.empty()) { - setAlternateHeaders->headers.push_back(std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str()))); + setAlternateHeaders->headers.push_back(std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str()))); } else { setAlternateHeaders->headers.push_back(nullptr); } } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogAlternateHeadersAsXML(setAlternateHeaders); + } + + return setAlternateHeaders; +} + +std::shared_ptr SetAlternateHeadersFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setAlternateHeaders = std::make_shared(initData); + + setAlternateHeaders->cmdId = SceneCommandID::SetAlternateHeaders; + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "AlternateHeader") { + for (uint32_t i = 0; i < setAlternateHeaders->numHeaders; i++) { + auto headerName = std::string(child->Attribute("HeaderName")); + if (!headerName.empty()) { + setAlternateHeaders->headers.push_back(std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str()))); + } else { + setAlternateHeaders->headers.push_back(nullptr); + } + } + } + + child = child->NextSiblingElement(); + } + + setAlternateHeaders->numHeaders = setAlternateHeaders->headers.size(); + return setAlternateHeaders; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h index 2bc430c0b..7b1324a60 100644 --- a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetAlternateHeadersFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetAlternateHeadersFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp index 7e2911a17..58c6ab4e3 100644 --- a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetCameraSettingsFactory.h" #include "soh/resource/type/scenecommand/SetCameraSettings.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr SetCameraSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { +std::shared_ptr SetCameraSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { auto setCameraSettings = std::make_shared(initData); ReadCommandId(setCameraSettings, reader); @@ -12,6 +13,22 @@ std::shared_ptr SetCameraSettingsFactory::ReadResource(std::shar setCameraSettings->settings.cameraMovement = reader->ReadInt8(); setCameraSettings->settings.worldMapArea = reader->ReadInt32(); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogCameraSettingsAsXML(setCameraSettings); + } + + return setCameraSettings; +} + +std::shared_ptr SetCameraSettingsFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setCameraSettings = std::make_shared(initData); + + setCameraSettings->cmdId = SceneCommandID::SetCameraSettings; + + setCameraSettings->settings.cameraMovement = reader->IntAttribute("CameraMovement"); + setCameraSettings->settings.worldMapArea = reader->IntAttribute("WorldMapArea"); + return setCameraSettings; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h index 2f1db272f..a8c21f776 100644 --- a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetCameraSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetCameraSettingsFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp index bb83dc57b..a67778f63 100644 --- a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp @@ -1,17 +1,34 @@ #include "soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h" #include "soh/resource/type/scenecommand/SetCollisionHeader.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "libultraship/libultraship.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr SetCollisionHeaderFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { +std::shared_ptr SetCollisionHeaderFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { auto setCollisionHeader = std::make_shared(initData); ReadCommandId(setCollisionHeader, reader); setCollisionHeader->fileName = reader->ReadString(); - setCollisionHeader->collisionHeader = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCollisionHeader->fileName.c_str())); + setCollisionHeader->collisionHeader = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCollisionHeader->fileName.c_str())); + + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogSetCollisionHeaderAsXML(setCollisionHeader); + } + + return setCollisionHeader; +} + +std::shared_ptr SetCollisionHeaderFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setCollisionHeader = std::make_shared(initData); + + setCollisionHeader->cmdId = SceneCommandID::SetCollisionHeader; + + setCollisionHeader->fileName = reader->Attribute("FileName"); + setCollisionHeader->collisionHeader = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCollisionHeader->fileName.c_str())); return setCollisionHeader; } diff --git a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h index b80ee34b4..35902e7cb 100644 --- a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetCollisionHeaderFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetCollisionHeaderFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp index 84c277989..7ae8237bf 100644 --- a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetCsCameraFactory.h" #include "soh/resource/type/scenecommand/SetCsCamera.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetCsCameraFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetCsCameraFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setCsCamera = std::make_shared(initData); ReadCommandId(setCsCamera, reader); @@ -14,6 +15,19 @@ SetCsCameraFactory::ReadResource(std::shared_ptr initData // OTRTODO: FINISH! + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogCsCameraAsXML(setCsCamera); + } + + return setCsCamera; +} + +std::shared_ptr SetCsCameraFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setCsCamera = std::make_shared(initData); + + setCsCamera->cmdId = SceneCommandID::SetCsCamera; + return setCsCamera; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h index 08dc8e3c3..ad232a11d 100644 --- a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetCsCameraFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetCsCameraFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp index 30f72d168..7ca657403 100644 --- a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp @@ -1,17 +1,34 @@ #include "soh/resource/importer/scenecommand/SetCutscenesFactory.h" #include "soh/resource/type/scenecommand/SetCutscenes.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetCutscenesFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetCutscenesFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setCutscenes = std::make_shared(initData); ReadCommandId(setCutscenes, reader); setCutscenes->fileName = reader->ReadString(); - setCutscenes->cutscene = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str())); + setCutscenes->cutscene = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str())); + + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogCutscenesAsXML(setCutscenes); + } + + return setCutscenes; +} + +std::shared_ptr SetCutscenesFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setCutscenes = std::make_shared(initData); + + setCutscenes->cmdId = SceneCommandID::SetCutscenes; + + setCutscenes->fileName = reader->Attribute("FileName"); + setCutscenes->cutscene = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str())); return setCutscenes; } diff --git a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h index bbbe38c98..4bd76b563 100644 --- a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetCutscenesFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetCutscenesFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp index e9c3381cb..4038ea825 100644 --- a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp @@ -1,16 +1,32 @@ #include "soh/resource/importer/scenecommand/SetEchoSettingsFactory.h" #include "soh/resource/type/scenecommand/SetEchoSettings.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetEchoSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetEchoSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setEchoSettings = std::make_shared(initData); ReadCommandId(setEchoSettings, reader); setEchoSettings->settings.echo = reader->ReadInt8(); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogEchoSettingsAsXML(setEchoSettings); + } + + return setEchoSettings; +} + +std::shared_ptr SetEchoSettingsFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setEchoSettings = std::make_shared(initData); + + setEchoSettings->cmdId = SceneCommandID::SetEchoSettings; + + setEchoSettings->settings.echo = reader->IntAttribute("Echo"); + return setEchoSettings; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h index 99bda6eae..c76885cf9 100644 --- a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetEchoSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetEchoSettingsFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp index 766bb82da..0590bfeb7 100644 --- a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetEntranceListFactory.h" #include "soh/resource/type/scenecommand/SetEntranceList.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetEntranceListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetEntranceListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setEntranceList = std::make_shared(initData); ReadCommandId(setEntranceList, reader); @@ -20,6 +21,35 @@ SetEntranceListFactory::ReadResource(std::shared_ptr init setEntranceList->entrances.push_back(entranceEntry); } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogEntranceListAsXML(setEntranceList); + } + + return setEntranceList; +} + +std::shared_ptr SetEntranceListFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setEntranceList = std::make_shared(initData); + + setEntranceList->cmdId = SceneCommandID::SetEntranceList; + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "EntranceEntry") { + EntranceEntry entry; + entry.spawn = child->IntAttribute("Spawn"); + entry.room = child->IntAttribute("Room"); + setEntranceList->entrances.push_back(entry); + } + + child = child->NextSiblingElement(); + } + + setEntranceList->numEntrances = setEntranceList->entrances.size(); + return setEntranceList; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h index 35b7fba62..207e9f050 100644 --- a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetEntranceListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetEntranceListFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp index 5fef9d096..328b41d8a 100644 --- a/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetExitListFactory.h" #include "soh/resource/type/scenecommand/SetExitList.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetExitListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetExitListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setExitList = std::make_shared( initData); ReadCommandId(setExitList, reader); @@ -15,6 +16,32 @@ SetExitListFactory::ReadResource(std::shared_ptr initData setExitList->exits.push_back(reader->ReadUInt16()); } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogExitListAsXML(setExitList); + } + + return setExitList; +} + +std::shared_ptr SetExitListFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setExitList = std::make_shared(initData); + + setExitList->cmdId = SceneCommandID::SetExitList; + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "ExitEntry") { + setExitList->exits.push_back(child->IntAttribute("Id")); + } + + child = child->NextSiblingElement(); + } + + setExitList->numExits = setExitList->exits.size(); + return setExitList; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetExitListFactory.h b/soh/soh/resource/importer/scenecommand/SetExitListFactory.h index d82e8f04a..4b050f46f 100644 --- a/soh/soh/resource/importer/scenecommand/SetExitListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetExitListFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetExitListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetExitListFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp index 2d05631cd..e1cbd2122 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetLightListFactory.h" #include "soh/resource/type/scenecommand/SetLightList.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetLightListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetLightListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setLightList = std::make_shared(initData); ReadCommandId(setLightList, reader); @@ -30,6 +31,51 @@ SetLightListFactory::ReadResource(std::shared_ptr initDat setLightList->lightList.push_back(light); } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogLightListAsXML(setLightList); + } + + return setLightList; +} + +std::shared_ptr SetLightListFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setLightList = std::make_shared(initData); + + setLightList->cmdId = SceneCommandID::SetLightList; + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "LightInfo") { + LightInfo light; + light.type = child->IntAttribute("Type"); + if (false/*light.type == LIGHT_DIRECTIONAL*/) { + light.params.dir.x = child->IntAttribute("X"); + light.params.dir.y = child->IntAttribute("Y"); + light.params.dir.z = child->IntAttribute("Z"); + light.params.dir.color[0] = child->IntAttribute("ColorR"); + light.params.dir.color[1] = child->IntAttribute("ColorG"); + light.params.dir.color[2] = child->IntAttribute("ColorB"); + } else { + light.params.point.x = child->IntAttribute("X"); + light.params.point.y = child->IntAttribute("Y"); + light.params.point.z = child->IntAttribute("Z"); + light.params.point.color[0] = child->IntAttribute("ColorR"); + light.params.point.color[1] = child->IntAttribute("ColorG"); + light.params.point.color[2] = child->IntAttribute("ColorB"); + light.params.point.drawGlow = child->IntAttribute("DrawGlow"); + light.params.point.radius = child->IntAttribute("Radius"); + } + setLightList->lightList.push_back(light); + } + + child = child->NextSiblingElement(); + } + + setLightList->numLights = setLightList->lightList.size(); + return setLightList; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetLightListFactory.h b/soh/soh/resource/importer/scenecommand/SetLightListFactory.h index 1c4a6e9dc..0af868d17 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetLightListFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetLightListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetLightListFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp index d0a7b89d5..7e35a7ac0 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetLightingSettingsFactory.h" #include "soh/resource/type/scenecommand/SetLightingSettings.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr SetLightingSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { +std::shared_ptr SetLightingSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { auto setLightingSettings = std::make_shared(initData); ReadCommandId(setLightingSettings, reader); @@ -43,6 +44,54 @@ std::shared_ptr SetLightingSettingsFactory::ReadResource(std::sh setLightingSettings->settings.push_back(lightSettings); } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogLightingSettingsAsXML(setLightingSettings); + } + + return setLightingSettings; +} + +std::shared_ptr SetLightingSettingsFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setLightingSettings = std::make_shared(initData); + + setLightingSettings->cmdId = SceneCommandID::SetLightingSettings; + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "LightingSetting") { + EnvLightSettings lightSettings; + lightSettings.ambientColor[0] = child->IntAttribute("AmbientColorR"); + lightSettings.ambientColor[1] = child->IntAttribute("AmbientColorG"); + lightSettings.ambientColor[2] = child->IntAttribute("AmbientColorB"); + + lightSettings.light1Dir[0] = child->IntAttribute("Light1DirX"); + lightSettings.light1Dir[1] = child->IntAttribute("Light1DirY"); + lightSettings.light1Dir[2] = child->IntAttribute("Light1DirZ"); + lightSettings.light1Color[0] = child->IntAttribute("Light1ColorR"); + lightSettings.light1Color[1] = child->IntAttribute("Light1ColorG"); + lightSettings.light1Color[2] = child->IntAttribute("Light1ColorB"); + + lightSettings.light2Dir[0] = child->IntAttribute("Light2DirX"); + lightSettings.light2Dir[1] = child->IntAttribute("Light2DirY"); + lightSettings.light2Dir[2] = child->IntAttribute("Light2DirZ"); + lightSettings.light2Color[0] = child->IntAttribute("Light2ColorR"); + lightSettings.light2Color[1] = child->IntAttribute("Light2ColorG"); + lightSettings.light2Color[2] = child->IntAttribute("Light2ColorB"); + + lightSettings.fogColor[0] = child->IntAttribute("FogColorR"); + lightSettings.fogColor[1] = child->IntAttribute("FogColorG"); + lightSettings.fogColor[2] = child->IntAttribute("FogColorB"); + lightSettings.fogNear = child->IntAttribute("FogNear"); + lightSettings.fogFar = child->IntAttribute("FogFar"); + setLightingSettings->settings.push_back(lightSettings); + } + + child = child->NextSiblingElement(); + } + return setLightingSettings; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h index df25600e2..d5b3be279 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetLightingSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetLightingSettingsFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp index 8c17ecc07..bdc5a0106 100644 --- a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp @@ -1,11 +1,12 @@ #include "soh/resource/importer/scenecommand/SetMeshFactory.h" #include "soh/resource/type/scenecommand/SetMesh.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" #include "libultraship/libultraship.h" namespace SOH { -std::shared_ptr -SetMeshFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetMeshFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setMesh = std::make_shared(initData); ReadCommandId(setMesh, reader); @@ -40,11 +41,13 @@ SetMeshFactory::ReadResource(std::shared_ptr initData, st std::string meshOpa = reader->ReadString(); std::string meshXlu = reader->ReadString(); - auto opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); - auto xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); + auto opaRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); + auto xluRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; + setMesh->opaPaths.push_back(meshOpa); + setMesh->xluPaths.push_back(meshXlu); setMesh->dlists.push_back(dlist); } else if (setMesh->meshHeader.base.type == 1) { PolygonDlist pType; @@ -53,8 +56,8 @@ SetMeshFactory::ReadResource(std::shared_ptr initData, st std::string imgOpa = reader->ReadString(); std::string imgXlu = reader->ReadString(); - auto opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgOpa.c_str()); - auto xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgXlu.c_str()); + auto opaRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgOpa.c_str()); + auto xluRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgXlu.c_str()); pType.opa = imgOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; pType.xlu = imgXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; @@ -101,11 +104,13 @@ SetMeshFactory::ReadResource(std::shared_ptr initData, st std::string meshOpa = reader->ReadString(); std::string meshXlu = reader->ReadString(); - opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); - xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); + opaRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); + xluRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); pType.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; pType.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; + setMesh->opaPaths.push_back(meshOpa); + setMesh->xluPaths.push_back(meshXlu); setMesh->dlists.push_back(pType); } else if (setMesh->meshHeader.base.type == 2) { PolygonDlist2 dlist; @@ -119,11 +124,13 @@ SetMeshFactory::ReadResource(std::shared_ptr initData, st std::string meshOpa = reader->ReadString(); std::string meshXlu = reader->ReadString(); - auto opaRes = meshOpa != "" ? LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()) : nullptr; - auto xluRes = meshXlu != "" ? LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()) : nullptr; + auto opaRes = meshOpa != "" ? Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()) : nullptr; + auto xluRes = meshXlu != "" ? Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()) : nullptr; dlist.opa = (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr); dlist.xlu = (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr); + setMesh->opaPaths.push_back(meshOpa); + setMesh->xluPaths.push_back(meshXlu); setMesh->dlists2.push_back(dlist); } else { SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", setMesh->meshHeader.base.type); @@ -141,6 +148,175 @@ SetMeshFactory::ReadResource(std::shared_ptr initData, st SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", setMesh->meshHeader.base.type); } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogMeshAsXML(setMesh); + } + + return setMesh; +} + +std::shared_ptr SetMeshFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setMesh = std::make_shared(initData); + + setMesh->cmdId = SceneCommandID::SetMesh; + + setMesh->data = reader->IntAttribute("Data"); + + setMesh->meshHeader.base.type = reader->IntAttribute("MeshHeaderType"); + int32_t polyNum = 1; + + if (setMesh->meshHeader.base.type != 1) { + polyNum = reader->IntAttribute("PolyNum"); + if (setMesh->meshHeader.base.type == 0) { + setMesh->meshHeader.polygon0.num = polyNum; + } else if (setMesh->meshHeader.base.type == 2) { + setMesh->meshHeader.polygon2.num = polyNum; + } else { + SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", setMesh->meshHeader.base.type); + } + } + + if (setMesh->meshHeader.base.type == 2) { + setMesh->dlists2.reserve(polyNum); + } else { + setMesh->dlists.reserve(setMesh->meshHeader.polygon0.num); + } + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName != "Polygon") { + child = child->NextSiblingElement(); + continue; + } + + if (setMesh->meshHeader.base.type == 0) { + PolygonDlist dlist; + + int32_t polyType = child->IntAttribute("PolyType"); // Unused + std::string meshOpa = child->Attribute("MeshOpa"); + std::string meshXlu = child->Attribute("MeshXlu"); + + auto opaRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); + auto xluRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); + dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; + dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; + + setMesh->opaPaths.push_back(meshOpa); + setMesh->xluPaths.push_back(meshXlu); + setMesh->dlists.push_back(dlist); + } else if (setMesh->meshHeader.base.type == 1) { + PolygonDlist pType; + + setMesh->meshHeader.polygon1.format = child->IntAttribute("Format"); + std::string imgOpa = child->Attribute("ImgOpa"); + std::string imgXlu = child->Attribute("ImgXlu"); + + auto opaRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgOpa.c_str()); + auto xluRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(imgXlu.c_str()); + pType.opa = imgOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; + pType.xlu = imgXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; + + int32_t bgImageCount = child->IntAttribute("BgImageCount"); + setMesh->images.reserve(bgImageCount); + + auto grandChild = child->FirstChildElement(); + + while (grandChild != nullptr) { + std::string grandChildName = grandChild->Name(); + if (grandChildName != "BgImage") { + grandChild = grandChild->NextSiblingElement(); + continue; + } + BgImage image; + image.unk_00 = grandChild->IntAttribute("Unknown_00"); + image.id = grandChild->IntAttribute("Id"); + std::string imagePath = "__OTR__" + std::string(grandChild->Attribute("ImagePath")); + setMesh->imagePaths.push_back(imagePath); + image.source = (void*)setMesh->imagePaths.back().c_str(); + image.unk_0C = grandChild->IntAttribute("Unknown_0C"); + image.tlut = grandChild->IntAttribute("TLUT"); + image.width = grandChild->IntAttribute("Width"); + image.height = grandChild->IntAttribute("Height"); + image.fmt = grandChild->IntAttribute("Fmt"); + image.siz = grandChild->IntAttribute("Siz"); + image.mode0 = grandChild->IntAttribute("Mode0"); + image.tlutCount = grandChild->IntAttribute("TLUTCount"); + + if (setMesh->meshHeader.polygon1.format == 1) { + setMesh->meshHeader.polygon1.single.source = image.source; + setMesh->meshHeader.polygon1.single.unk_0C = image.unk_0C; + setMesh->meshHeader.polygon1.single.tlut = (void*)image.tlut; // OTRTODO: type of bgimage.tlut should be uintptr_t + setMesh->meshHeader.polygon1.single.width = image.width; + setMesh->meshHeader.polygon1.single.height = image.height; + setMesh->meshHeader.polygon1.single.fmt = image.fmt; + setMesh->meshHeader.polygon1.single.siz = image.siz; + setMesh->meshHeader.polygon1.single.mode0 = image.mode0; + setMesh->meshHeader.polygon1.single.tlutCount = image.tlutCount; + } else { + setMesh->images.push_back(image); + } + + grandChild = grandChild->NextSiblingElement(); + } + + if (setMesh->meshHeader.polygon1.format != 1) { + setMesh->meshHeader.polygon1.multi.count = bgImageCount; + } + + int32_t polyType = child->IntAttribute("PolyType"); // Unused?? + + std::string meshOpa = child->Attribute("MeshOpa"); + std::string meshXlu = child->Attribute("MeshXlu"); + + opaRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); + xluRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); + pType.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; + pType.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; + + setMesh->opaPaths.push_back(meshOpa); + setMesh->xluPaths.push_back(meshXlu); + setMesh->dlists.push_back(pType); + } else if (setMesh->meshHeader.base.type == 2) { + PolygonDlist2 dlist; + + int32_t polyType = child->IntAttribute("PolyType"); // Unused + dlist.pos.x = child->IntAttribute("PosX"); + dlist.pos.y = child->IntAttribute("PosY"); + dlist.pos.z = child->IntAttribute("PosZ"); + dlist.unk_06 = child->IntAttribute("Unknown"); + + std::string meshOpa = child->Attribute("MeshOpa"); + std::string meshXlu = child->Attribute("MeshXlu"); + + auto opaRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); + auto xluRes = Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); + dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; + dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; + + setMesh->opaPaths.push_back(meshOpa); + setMesh->xluPaths.push_back(meshXlu); + setMesh->dlists2.push_back(dlist); + } else { + SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", setMesh->meshHeader.base.type); + } + + child = child->NextSiblingElement(); + } + + if (setMesh->meshHeader.base.type == 2) { + setMesh->meshHeader.polygon2.start = setMesh->dlists2.data(); + } else if (setMesh->meshHeader.base.type == 0) { + setMesh->meshHeader.polygon0.start = setMesh->dlists.data(); + } else if (setMesh->meshHeader.base.type == 1) { + setMesh->meshHeader.polygon1.multi.list = setMesh->images.data(); + setMesh->meshHeader.polygon1.dlist = (Gfx*)setMesh->dlists.data(); + } else { + SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", setMesh->meshHeader.base.type); + } + return setMesh; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetMeshFactory.h b/soh/soh/resource/importer/scenecommand/SetMeshFactory.h index a912bdd37..c87123174 100644 --- a/soh/soh/resource/importer/scenecommand/SetMeshFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetMeshFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetMeshFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetMeshFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp index b84befb3b..0ba356f7b 100644 --- a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetObjectListFactory.h" #include "soh/resource/type/scenecommand/SetObjectList.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetObjectListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetObjectListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setObjectList = std::make_shared(initData); ReadCommandId(setObjectList, reader); @@ -15,6 +16,32 @@ SetObjectListFactory::ReadResource(std::shared_ptr initDa setObjectList->objects.push_back(reader->ReadUInt16()); } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogObjectListAsXML(setObjectList); + } + + return setObjectList; +} + +std::shared_ptr SetObjectListFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setObjectList = std::make_shared(initData); + + setObjectList->cmdId = SceneCommandID::SetObjectList; + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "ObjectEntry") { + setObjectList->objects.push_back(child->IntAttribute("Id")); + } + + child = child->NextSiblingElement(); + } + + setObjectList->numObjects = setObjectList->objects.size(); + return setObjectList; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h index 4c2f002c0..663ef2304 100644 --- a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetObjectListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetObjectListFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp index 61534ba48..65af2e0de 100644 --- a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp @@ -1,11 +1,12 @@ #include "soh/resource/importer/scenecommand/SetPathwaysFactory.h" #include "soh/resource/type/scenecommand/SetPathways.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" #include namespace SOH { -std::shared_ptr -SetPathwaysFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetPathwaysFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setPathways = std::make_shared(initData); ReadCommandId(setPathways, reader); @@ -14,10 +15,39 @@ SetPathwaysFactory::ReadResource(std::shared_ptr initData setPathways->paths.reserve(setPathways->numPaths); for (uint32_t i = 0; i < setPathways->numPaths; i++) { std::string pathFileName = reader->ReadString(); - auto path = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str())); + auto path = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str())); setPathways->paths.push_back(path->GetPointer()); } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogPathwaysAsXML(setPathways); + } + + return setPathways; +} + +std::shared_ptr SetPathwaysFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setPathways = std::make_shared(initData); + + setPathways->cmdId = SceneCommandID::SetPathways; + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "Pathway") { + std::string pathFileName = child->Attribute("FilePath"); + auto path = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str())); + setPathways->paths.push_back(path->GetPointer()); + setPathways->pathFileNames.push_back(pathFileName); + } + + child = child->NextSiblingElement(); + } + + setPathways->numPaths = setPathways->paths.size(); + return setPathways; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h index c622c820d..783c9f45c 100644 --- a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetPathwaysFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetPathwaysFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp index e4601e59c..14bb787ed 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h" #include "soh/resource/type/scenecommand/SetRoomBehavior.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetRoomBehaviorFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetRoomBehaviorFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setRoomBehavior = std::make_shared(initData); ReadCommandId(setRoomBehavior, reader); @@ -12,6 +13,22 @@ SetRoomBehaviorFactory::ReadResource(std::shared_ptr init setRoomBehavior->roomBehavior.gameplayFlags = reader->ReadInt8(); setRoomBehavior->roomBehavior.gameplayFlags2 = reader->ReadInt32(); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogRoomBehaviorAsXML(setRoomBehavior); + } + + return setRoomBehavior; +} + +std::shared_ptr SetRoomBehaviorFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setRoomBehavior = std::make_shared(initData); + + setRoomBehavior->cmdId = SceneCommandID::SetRoomBehavior; + + setRoomBehavior->roomBehavior.gameplayFlags = reader->IntAttribute("GameplayFlags1"); + setRoomBehavior->roomBehavior.gameplayFlags2 = reader->IntAttribute("GameplayFlags2"); + return setRoomBehavior; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h index 70a53ba1e..87e55194d 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetRoomBehaviorFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetRoomBehaviorFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp index 7726877a1..b19ac98d7 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetRoomListFactory.h" #include "soh/resource/type/scenecommand/SetRoomList.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetRoomListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetRoomListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setRoomList = std::make_shared(initData); ReadCommandId(setRoomList, reader); @@ -23,6 +24,40 @@ SetRoomListFactory::ReadResource(std::shared_ptr initData setRoomList->rooms.push_back(room); } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogRoomListAsXML(setRoomList); + } + + return setRoomList; +} + +std::shared_ptr SetRoomListFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setRoomList = std::make_shared(initData); + + setRoomList->cmdId = SceneCommandID::SetRoomList; + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "RoomEntry") { + RomFile room; + + setRoomList->fileNames.push_back(child->Attribute("Path")); + + room.fileName = (char*)setRoomList->fileNames.back().c_str(); + room.vromStart = child->IntAttribute("VromStart"); + room.vromEnd = child->IntAttribute("VromEnd"); + + setRoomList->rooms.push_back(room); + } + + child = child->NextSiblingElement(); + } + + setRoomList->numRooms = setRoomList->rooms.size(); + return setRoomList; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h index 6bf9eaa5c..1e05c7e03 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetRoomListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetRoomListFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp index 291ae578c..6c0ee1400 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h" #include "soh/resource/type/scenecommand/SetSkyboxModifier.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr SetSkyboxModifierFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { +std::shared_ptr SetSkyboxModifierFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { auto setSkyboxModifier = std::make_shared(initData); ReadCommandId(setSkyboxModifier, reader); @@ -12,6 +13,22 @@ std::shared_ptr SetSkyboxModifierFactory::ReadResource(std::shar setSkyboxModifier->modifier.skyboxDisabled = reader->ReadInt8(); setSkyboxModifier->modifier.sunMoonDisabled = reader->ReadInt8(); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogSkyboxModifierAsXML(setSkyboxModifier); + } + + return setSkyboxModifier; +} + +std::shared_ptr SetSkyboxModifierFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setSkyboxModifier = std::make_shared(initData); + + setSkyboxModifier->cmdId = SceneCommandID::SetSkyboxModifier; + + setSkyboxModifier->modifier.skyboxDisabled = reader->IntAttribute("SkyboxDisabled"); + setSkyboxModifier->modifier.sunMoonDisabled = reader->IntAttribute("SunMoonDisabled"); + return setSkyboxModifier; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h index d467cc73d..a4ef58150 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetSkyboxModifierFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetSkyboxModifierFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp index f3e726b07..607909d65 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h" #include "soh/resource/type/scenecommand/SetSkyboxSettings.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr SetSkyboxSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { +std::shared_ptr SetSkyboxSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { auto setSkyboxSettings = std::make_shared(initData); ReadCommandId(setSkyboxSettings, reader); @@ -14,6 +15,24 @@ std::shared_ptr SetSkyboxSettingsFactory::ReadResource(std::shar setSkyboxSettings->settings.weather = reader->ReadInt8(); setSkyboxSettings->settings.indoors = reader->ReadInt8(); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogSkyboxSettingsAsXML(setSkyboxSettings); + } + + return setSkyboxSettings; +} + +std::shared_ptr SetSkyboxSettingsFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setSkyboxSettings = std::make_shared(initData); + + setSkyboxSettings->cmdId = SceneCommandID::SetSkyboxSettings; + + setSkyboxSettings->settings.unk = reader->IntAttribute("Unknown"); + setSkyboxSettings->settings.skyboxId = reader->IntAttribute("SkyboxId"); + setSkyboxSettings->settings.weather = reader->IntAttribute("Weather"); + setSkyboxSettings->settings.indoors = reader->IntAttribute("Indoors"); + return setSkyboxSettings; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h index 581e56122..352275b58 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetSkyboxSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetSkyboxSettingsFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp index f85178e22..61c1892dd 100644 --- a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetSoundSettingsFactory.h" #include "soh/resource/type/scenecommand/SetSoundSettings.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr SetSoundSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { +std::shared_ptr SetSoundSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { auto setSoundSettings = std::make_shared(initData); ReadCommandId(setSoundSettings, reader); @@ -13,6 +14,23 @@ std::shared_ptr SetSoundSettingsFactory::ReadResource(std::share setSoundSettings->settings.natureAmbienceId = reader->ReadInt8(); setSoundSettings->settings.seqId = reader->ReadInt8(); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogSoundSettingsAsXML(setSoundSettings); + } + + return setSoundSettings; +} + +std::shared_ptr SetSoundSettingsFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setSoundSettings = std::make_shared(initData); + + setSoundSettings->cmdId = SceneCommandID::SetSoundSettings; + + setSoundSettings->settings.reverb = reader->IntAttribute("Reverb"); + setSoundSettings->settings.natureAmbienceId = reader->IntAttribute("NatureAmbienceId"); + setSoundSettings->settings.seqId = reader->IntAttribute("SeqId"); + return setSoundSettings; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h index e1c4efb03..14d1ebe84 100644 --- a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetSoundSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetSoundSettingsFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp index b7fd21aa4..f28393134 100644 --- a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h" #include "soh/resource/type/scenecommand/SetSpecialObjects.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr SetSpecialObjectsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { +std::shared_ptr SetSpecialObjectsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { auto setSpecialObjects = std::make_shared(initData); ReadCommandId(setSpecialObjects, reader); @@ -12,6 +13,22 @@ std::shared_ptr SetSpecialObjectsFactory::ReadResource(std::shar setSpecialObjects->specialObjects.elfMessage = reader->ReadInt8(); setSpecialObjects->specialObjects.globalObject = reader->ReadInt16(); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogSpecialObjectsAsXML(setSpecialObjects); + } + + return setSpecialObjects; +} + +std::shared_ptr SetSpecialObjectsFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setSpecialObjects = std::make_shared(initData); + + setSpecialObjects->cmdId = SceneCommandID::SetSpecialObjects; + + setSpecialObjects->specialObjects.elfMessage = reader->IntAttribute("ElfMessage"); + setSpecialObjects->specialObjects.globalObject = reader->IntAttribute("GlobalObject"); + return setSpecialObjects; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h index 503cfb61f..38b1ea511 100644 --- a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetSpecialObjectsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetSpecialObjectsFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp index 3165b4361..3dee5d992 100644 --- a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetStartPositionListFactory.h" #include "soh/resource/type/scenecommand/SetStartPositionList.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr SetStartPositionListFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { +std::shared_ptr SetStartPositionListFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { auto setStartPositionList = std::make_shared(initData); ReadCommandId(setStartPositionList, reader); @@ -26,6 +27,41 @@ std::shared_ptr SetStartPositionListFactory::ReadResource(std::s setStartPositionList->startPositions.push_back(entry); } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogStartPositionListAsXML(setStartPositionList); + } + + return setStartPositionList; +} + +std::shared_ptr SetStartPositionListFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setStartPositionList = std::make_shared(initData); + + setStartPositionList->cmdId = SceneCommandID::SetStartPositionList; + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "StartPositionEntry") { + ActorEntry entry; + entry.id = child->IntAttribute("Id"); + entry.pos.x = child->IntAttribute("PosX"); + entry.pos.y = child->IntAttribute("PosY"); + entry.pos.z = child->IntAttribute("PosZ"); + entry.rot.x = child->IntAttribute("RotX"); + entry.rot.y = child->IntAttribute("RotY"); + entry.rot.z = child->IntAttribute("RotZ"); + entry.params = child->IntAttribute("Params"); + setStartPositionList->startPositions.push_back(entry); + } + + child = child->NextSiblingElement(); + } + + setStartPositionList->numStartPositions = setStartPositionList->startPositions.size(); + return setStartPositionList; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h index b07901f05..b4894207e 100644 --- a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetStartPositionListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetStartPositionListFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp index d83b24583..739da5330 100644 --- a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetTimeSettingsFactory.h" #include "soh/resource/type/scenecommand/SetTimeSettings.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetTimeSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetTimeSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setTimeSettings = std::make_shared(initData); ReadCommandId(setTimeSettings, reader); @@ -13,6 +14,23 @@ SetTimeSettingsFactory::ReadResource(std::shared_ptr init setTimeSettings->settings.minute = reader->ReadInt8(); setTimeSettings->settings.timeIncrement = reader->ReadInt8(); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogTimeSettingsAsXML(setTimeSettings); + } + + return setTimeSettings; +} + +std::shared_ptr SetTimeSettingsFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setTimeSettings = std::make_shared(initData); + + setTimeSettings->cmdId = SceneCommandID::SetTimeSettings; + + setTimeSettings->settings.hour = reader->IntAttribute("Hour"); + setTimeSettings->settings.minute = reader->IntAttribute("Minute"); + setTimeSettings->settings.timeIncrement = reader->IntAttribute("TimeIncrement"); + return setTimeSettings; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h index d1336f788..4b7b5c90f 100644 --- a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetTimeSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetTimeSettingsFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp index c751ad611..4289ef46e 100644 --- a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetTransitionActorListFactory.h" #include "soh/resource/type/scenecommand/SetTransitionActorList.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr SetTransitionActorListFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { +std::shared_ptr SetTransitionActorListFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { auto setTransitionActorList = std::make_shared(initData); ReadCommandId(setTransitionActorList, reader); @@ -28,6 +29,43 @@ std::shared_ptr SetTransitionActorListFactory::ReadResource(std: setTransitionActorList->transitionActorList.push_back(entry); } + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogTransitionActorListAsXML(setTransitionActorList); + } + + return setTransitionActorList; +} + +std::shared_ptr SetTransitionActorListFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setTransitionActorList = std::make_shared(initData); + + setTransitionActorList->cmdId = SceneCommandID::SetTransitionActorList; + + auto child = reader->FirstChildElement(); + + while (child != nullptr) { + std::string childName = child->Name(); + if (childName == "TransitionActorEntry") { + TransitionActorEntry entry; + entry.sides[0].room = child->IntAttribute("FrontSideRoom"); + entry.sides[0].effects = child->IntAttribute("FrontSideEffects"); + entry.sides[1].room = child->IntAttribute("BackSideRoom"); + entry.sides[1].effects = child->IntAttribute("BackSideEffects"); + entry.id = child->IntAttribute("Id"); + entry.pos.x = child->IntAttribute("PosX"); + entry.pos.y = child->IntAttribute("PosY"); + entry.pos.z = child->IntAttribute("PosZ"); + entry.rotY = child->IntAttribute("RotY"); + entry.params = child->IntAttribute("Params"); + setTransitionActorList->transitionActorList.push_back(entry); + } + + child = child->NextSiblingElement(); + } + + setTransitionActorList->numTransitionActors = setTransitionActorList->transitionActorList.size(); + return setTransitionActorList; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h index c8fb65f9a..a3fc42f41 100644 --- a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetTransitionActorListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetTransitionActorListFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp index 3208004ce..587e9dcc7 100644 --- a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp @@ -1,10 +1,11 @@ #include "soh/resource/importer/scenecommand/SetWindSettingsFactory.h" #include "soh/resource/type/scenecommand/SetWindSettings.h" +#include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" namespace SOH { -std::shared_ptr -SetWindSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { +std::shared_ptr +SetWindSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { auto setWind = std::make_shared(initData); ReadCommandId(setWind, reader); @@ -14,6 +15,24 @@ SetWindSettingsFactory::ReadResource(std::shared_ptr init setWind->settings.windSouth = reader->ReadInt8(); setWind->settings.windSpeed = reader->ReadUByte(); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ResourceLogging"), 0)) { + LogWindSettingsAsXML(setWind); + } + + return setWind; +} + +std::shared_ptr SetWindSettingsFactoryXML::ReadResource(std::shared_ptr initData, + tinyxml2::XMLElement* reader) { + auto setWind = std::make_shared(initData); + + setWind->cmdId = SceneCommandID::SetWind; + + setWind->settings.windWest = reader->IntAttribute("WindWest"); + setWind->settings.windVertical = reader->IntAttribute("WindVertical"); + setWind->settings.windSouth = reader->IntAttribute("WindSouth"); + setWind->settings.windSpeed = reader->IntAttribute("WindSpeed"); + return setWind; } } // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h index 6cc9fbc1b..85381e517 100644 --- a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h @@ -5,7 +5,13 @@ namespace SOH { class SetWindSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; +}; + +class SetWindSettingsFactoryXML : public SceneCommandFactoryXMLV0 { + public: + std::shared_ptr + ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; }; } // namespace SOH diff --git a/soh/soh/resource/logging/SceneCommandLoggers.cpp b/soh/soh/resource/logging/SceneCommandLoggers.cpp new file mode 100644 index 000000000..7c55bcaf0 --- /dev/null +++ b/soh/soh/resource/logging/SceneCommandLoggers.cpp @@ -0,0 +1,603 @@ +#include "soh/resource/type/scenecommand/EndMarker.h" +#include "soh/resource/type/scenecommand/SetActorList.h" +#include "soh/resource/type/scenecommand/SetAlternateHeaders.h" +#include "soh/resource/type/scenecommand/SetCameraSettings.h" +#include "soh/resource/type/scenecommand/SetCollisionHeader.h" +#include "soh/resource/type/scenecommand/SetCsCamera.h" +#include "soh/resource/type/scenecommand/SetCutscenes.h" +#include "soh/resource/type/scenecommand/SetEchoSettings.h" +#include "soh/resource/type/scenecommand/SetEntranceList.h" +#include "soh/resource/type/scenecommand/SetExitList.h" +#include "soh/resource/type/scenecommand/SetLightingSettings.h" +#include "soh/resource/type/scenecommand/SetLightList.h" +#include "soh/resource/type/scenecommand/SetMesh.h" +#include "soh/resource/type/scenecommand/SetObjectList.h" +#include "soh/resource/type/scenecommand/SetPathways.h" +#include "soh/resource/type/scenecommand/SetRoomBehavior.h" +#include "soh/resource/type/scenecommand/SetRoomList.h" +#include "soh/resource/type/scenecommand/SetSkyboxModifier.h" +#include "soh/resource/type/scenecommand/SetSkyboxSettings.h" +#include "soh/resource/type/scenecommand/SetSoundSettings.h" +#include "soh/resource/type/scenecommand/SetSpecialObjects.h" +#include "soh/resource/type/scenecommand/SetStartPositionList.h" +#include "soh/resource/type/scenecommand/SetTimeSettings.h" +#include "soh/resource/type/scenecommand/SetTransitionActorList.h" +#include "soh/resource/type/scenecommand/SetWindSettings.h" +#include "spdlog/spdlog.h" + +namespace SOH { + +void LogEndMarkerAsXML(std::shared_ptr resource) { + std::shared_ptr endMarker = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("EndMarker"); + doc.InsertFirstChild(root); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogActorListAsXML(std::shared_ptr resource) { + std::shared_ptr setActorList = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetActorList"); + doc.InsertFirstChild(root); + + for (size_t i = 0; i < setActorList->numActors; i++) { + tinyxml2::XMLElement* entry = doc.NewElement("ActorEntry"); + entry->SetAttribute("Id", setActorList->actorList[i].id); + entry->SetAttribute("PosX", setActorList->actorList[i].pos.x); + entry->SetAttribute("PosY", setActorList->actorList[i].pos.y); + entry->SetAttribute("PosZ", setActorList->actorList[i].pos.z); + entry->SetAttribute("RotX", setActorList->actorList[i].rot.x); + entry->SetAttribute("RotY", setActorList->actorList[i].rot.y); + entry->SetAttribute("RotZ", setActorList->actorList[i].rot.z); + entry->SetAttribute("Params", setActorList->actorList[i].params); + root->InsertEndChild(entry); + } + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogAlternateHeadersAsXML(std::shared_ptr resource) { + std::shared_ptr setAlternateHeaders = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetAlternateHeaders"); + doc.InsertFirstChild(root); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogCameraSettingsAsXML(std::shared_ptr resource) { + std::shared_ptr setCameraSettings = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetCameraSettings"); + doc.InsertFirstChild(root); + + root->SetAttribute("CameraMovement", setCameraSettings->settings.cameraMovement); + root->SetAttribute("WorldMapArea", setCameraSettings->settings.worldMapArea); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogSetCollisionHeaderAsXML(std::shared_ptr resource) { + std::shared_ptr setCollisionHeader = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetCollisionHeader"); + doc.InsertFirstChild(root); + + root->SetAttribute("FileName", setCollisionHeader->fileName.c_str()); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogCsCameraAsXML(std::shared_ptr resource) { + std::shared_ptr setCsCamera = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetCsCamera"); + doc.InsertFirstChild(root); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogCutscenesAsXML(std::shared_ptr resource) { + std::shared_ptr setCutscenes = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetCutscenes"); + doc.InsertFirstChild(root); + + root->SetAttribute("FileName", setCutscenes->fileName.c_str()); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogEchoSettingsAsXML(std::shared_ptr resource) { + std::shared_ptr setEchoSettings = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetEchoSettings"); + doc.InsertFirstChild(root); + + root->SetAttribute("Echo", setEchoSettings->settings.echo); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogEntranceListAsXML(std::shared_ptr resource) { + std::shared_ptr setEntranceList = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetEntranceList"); + doc.InsertFirstChild(root); + + for (size_t i = 0; i < setEntranceList->numEntrances; i++) { + tinyxml2::XMLElement* entry = doc.NewElement("EntranceEntry"); + entry->SetAttribute("Spawn", setEntranceList->entrances[i].spawn); + entry->SetAttribute("Room", setEntranceList->entrances[i].room); + root->InsertEndChild(entry); + } + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogExitListAsXML(std::shared_ptr resource) { + std::shared_ptr setExitList = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetExitList"); + doc.InsertFirstChild(root); + + for (size_t i = 0; i < setExitList->numExits; i++) { + tinyxml2::XMLElement* entry = doc.NewElement("ExitEntry"); + entry->SetAttribute("Id", setExitList->exits[i]); + root->InsertEndChild(entry); + } + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogLightingSettingsAsXML(std::shared_ptr resource) { + std::shared_ptr setLightingSettings = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetLightingSettings"); + doc.InsertFirstChild(root); + + for (size_t i = 0; i < setLightingSettings->settings.size(); i++) { + tinyxml2::XMLElement* entry = doc.NewElement("LightingSetting"); + entry->SetAttribute("AmbientColorR", setLightingSettings->settings[i].ambientColor[0]); + entry->SetAttribute("AmbientColorG", setLightingSettings->settings[i].ambientColor[1]); + entry->SetAttribute("AmbientColorB", setLightingSettings->settings[i].ambientColor[2]); + + entry->SetAttribute("Light1DirX", setLightingSettings->settings[i].light1Dir[0]); + entry->SetAttribute("Light1DirY", setLightingSettings->settings[i].light1Dir[1]); + entry->SetAttribute("Light1DirZ", setLightingSettings->settings[i].light1Dir[2]); + entry->SetAttribute("Light1ColorR", setLightingSettings->settings[i].light1Color[0]); + entry->SetAttribute("Light1ColorG", setLightingSettings->settings[i].light1Color[1]); + entry->SetAttribute("Light1ColorB", setLightingSettings->settings[i].light1Color[2]); + + entry->SetAttribute("Light2DirX", setLightingSettings->settings[i].light2Dir[0]); + entry->SetAttribute("Light2DirY", setLightingSettings->settings[i].light2Dir[1]); + entry->SetAttribute("Light2DirZ", setLightingSettings->settings[i].light2Dir[2]); + entry->SetAttribute("Light2ColorR", setLightingSettings->settings[i].light2Color[0]); + entry->SetAttribute("Light2ColorG", setLightingSettings->settings[i].light2Color[1]); + entry->SetAttribute("Light2ColorB", setLightingSettings->settings[i].light2Color[2]); + + entry->SetAttribute("FogColorR", setLightingSettings->settings[i].fogColor[0]); + entry->SetAttribute("FogColorG", setLightingSettings->settings[i].fogColor[1]); + entry->SetAttribute("FogColorB", setLightingSettings->settings[i].fogColor[2]); + entry->SetAttribute("FogNear", setLightingSettings->settings[i].fogNear); + entry->SetAttribute("FogFar", setLightingSettings->settings[i].fogFar); + + root->InsertEndChild(entry); + } + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogLightListAsXML(std::shared_ptr resource) { + std::shared_ptr setLightList = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetLightList"); + doc.InsertFirstChild(root); + + for (size_t i = 0; i < setLightList->numLights; i++) { + tinyxml2::XMLElement* light = doc.NewElement("LightInfo"); + light->SetAttribute("Type", setLightList->lightList[i].type); + if (false/*setLightList->lightList[i].type == LIGHT_DIRECTIONAL*/) { + light->SetAttribute("X", setLightList->lightList[i].params.dir.x); + light->SetAttribute("Y", setLightList->lightList[i].params.dir.y); + light->SetAttribute("Z", setLightList->lightList[i].params.dir.z); + light->SetAttribute("ColorR", setLightList->lightList[i].params.dir.color[0]); + light->SetAttribute("ColorG", setLightList->lightList[i].params.dir.color[1]); + light->SetAttribute("ColorB", setLightList->lightList[i].params.dir.color[2]); + } else { + light->SetAttribute("X", setLightList->lightList[i].params.point.x); + light->SetAttribute("Y", setLightList->lightList[i].params.point.y); + light->SetAttribute("Z", setLightList->lightList[i].params.point.z); + light->SetAttribute("ColorR", setLightList->lightList[i].params.point.color[0]); + light->SetAttribute("ColorG", setLightList->lightList[i].params.point.color[1]); + light->SetAttribute("ColorB", setLightList->lightList[i].params.point.color[2]); + light->SetAttribute("DrawGlow", setLightList->lightList[i].params.point.drawGlow); + light->SetAttribute("Radius", setLightList->lightList[i].params.point.radius); + } + root->InsertEndChild(light); + } + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogMeshAsXML(std::shared_ptr resource) { + std::shared_ptr setMesh = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetMesh"); + doc.InsertFirstChild(root); + + root->SetAttribute("Data", setMesh->data); + root->SetAttribute("MeshHeaderType", setMesh->meshHeader.base.type); + + if (setMesh->meshHeader.base.type == 0) { + root->SetAttribute("PolyNum", setMesh->meshHeader.polygon0.num); + PolygonDlist* dlist = (PolygonDlist*)setMesh->meshHeader.polygon0.start; + for (int i = 0; i < setMesh->meshHeader.polygon0.num; i += 1) { + tinyxml2::XMLElement* polygon = doc.NewElement("Polygon"); + polygon->SetAttribute("PolyType", "0"); + polygon->SetAttribute("MeshOpa", setMesh->opaPaths[i].c_str()); + polygon->SetAttribute("MeshXlu", setMesh->xluPaths[i].c_str()); + + root->InsertEndChild(polygon); + } + dlist += 1; + } else if (setMesh->meshHeader.base.type == 1) { + root->SetAttribute("PolyNum", "1"); + tinyxml2::XMLElement* polygon = doc.NewElement("Polygon"); + polygon->SetAttribute("Format", setMesh->meshHeader.polygon1.format); + polygon->SetAttribute("ImgOpa", ""); + polygon->SetAttribute("ImgXlu", ""); + + if (setMesh->meshHeader.polygon1.format == 1) { + polygon->SetAttribute("BgImageCount", "0"); + } else { + polygon->SetAttribute("BgImageCount", setMesh->meshHeader.polygon1.multi.count); + } + + polygon->SetAttribute("PolyType", "0"); + + polygon->SetAttribute("MeshOpa", setMesh->opaPaths[0].c_str()); + polygon->SetAttribute("MeshXlu", setMesh->xluPaths[0].c_str()); + + root->InsertEndChild(polygon); + + BgImage* image = setMesh->meshHeader.polygon1.multi.list; + int count = setMesh->meshHeader.polygon1.format == 1 ? 1 : setMesh->meshHeader.polygon1.multi.count; + for (int i = 0; i < count; i += 1) { + tinyxml2::XMLElement* bgImage = doc.NewElement("BgImage"); + if (setMesh->meshHeader.polygon1.format == 1) { + bgImage->SetAttribute("Unknown_00", image->unk_00); + bgImage->SetAttribute("Id", image->id); + bgImage->SetAttribute("ImagePath", setMesh->imagePaths[i].c_str()); + bgImage->SetAttribute("Unknown_0C", setMesh->meshHeader.polygon1.single.unk_0C); + bgImage->SetAttribute("TLUT", setMesh->meshHeader.polygon1.single.tlut); + bgImage->SetAttribute("Width", setMesh->meshHeader.polygon1.single.width); + bgImage->SetAttribute("Height", setMesh->meshHeader.polygon1.single.height); + bgImage->SetAttribute("Fmt", setMesh->meshHeader.polygon1.single.fmt); + bgImage->SetAttribute("Siz", setMesh->meshHeader.polygon1.single.siz); + bgImage->SetAttribute("Mode0", setMesh->meshHeader.polygon1.single.mode0); + bgImage->SetAttribute("TLUTCount", setMesh->meshHeader.polygon1.single.tlutCount); + } else { + bgImage->SetAttribute("Unknown_00", image->unk_00); + bgImage->SetAttribute("Id", image->id); + bgImage->SetAttribute("ImagePath", setMesh->imagePaths[i].c_str()); + bgImage->SetAttribute("Unknown_0C", image->unk_0C); + bgImage->SetAttribute("TLUT", image->tlut); + bgImage->SetAttribute("Width", image->width); + bgImage->SetAttribute("Height", image->height); + bgImage->SetAttribute("Fmt", image->fmt); + bgImage->SetAttribute("Siz", image->siz); + bgImage->SetAttribute("Mode0", image->mode0); + bgImage->SetAttribute("TLUTCount", image->tlutCount); + } + polygon->InsertEndChild(bgImage); + + image += 1; + } + } else if (setMesh->meshHeader.base.type == 2) { + root->SetAttribute("PolyNum", setMesh->meshHeader.polygon2.num); + PolygonDlist2* dlist = (PolygonDlist2*)setMesh->meshHeader.polygon2.start; + for (int i = 0; i < setMesh->meshHeader.polygon2.num; i += 1) { + tinyxml2::XMLElement* polygon = doc.NewElement("Polygon"); + polygon->SetAttribute("PolyType", "0"); + + polygon->SetAttribute("PosX", dlist->pos.x); + polygon->SetAttribute("PosY", dlist->pos.y); + polygon->SetAttribute("PosZ", dlist->pos.z); + polygon->SetAttribute("Unknown", dlist->unk_06); + + polygon->SetAttribute("MeshOpa", setMesh->opaPaths[i].c_str()); + polygon->SetAttribute("MeshXlu", setMesh->xluPaths[i].c_str()); + + root->InsertEndChild(polygon); + dlist += 1; + } + } + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogObjectListAsXML(std::shared_ptr resource) { + std::shared_ptr setObjectList = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetObjectList"); + doc.InsertFirstChild(root); + + for (size_t i = 0; i < setObjectList->numObjects; i++) { + tinyxml2::XMLElement* entry = doc.NewElement("ObjectEntry"); + entry->SetAttribute("Id", setObjectList->objects[i]); + root->InsertEndChild(entry); + } + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogPathwaysAsXML(std::shared_ptr resource) { + std::shared_ptr setPathways = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetPathways"); + doc.InsertFirstChild(root); + + for (size_t i = 0; i < setPathways->pathFileNames.size(); i++) { + tinyxml2::XMLElement* pathway = doc.NewElement("Pathway"); + pathway->SetAttribute("FilePath", setPathways->pathFileNames[i].c_str()); + root->InsertEndChild(pathway); + } + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogRoomBehaviorAsXML(std::shared_ptr resource) { + std::shared_ptr setRoomBehavior = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetRoomBehavior"); + doc.InsertFirstChild(root); + + root->SetAttribute("GameplayFlags1", setRoomBehavior->roomBehavior.gameplayFlags); + root->SetAttribute("GameplayFlags2", setRoomBehavior->roomBehavior.gameplayFlags2); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogRoomListAsXML(std::shared_ptr resource) { + std::shared_ptr setRoomList = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetRoomList"); + doc.InsertFirstChild(root); + + for (size_t i = 0; i < setRoomList->numRooms; i++) { + tinyxml2::XMLElement* entry = doc.NewElement("RoomEntry"); + entry->SetAttribute("Path", setRoomList->fileNames[i].c_str()); + root->InsertEndChild(entry); + } + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogSkyboxModifierAsXML(std::shared_ptr resource) { + std::shared_ptr setSkyboxModifier = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetSkyboxModifier"); + doc.InsertFirstChild(root); + + root->SetAttribute("SkyboxDisabled", setSkyboxModifier->modifier.skyboxDisabled); + root->SetAttribute("SunMoonDisabled", setSkyboxModifier->modifier.sunMoonDisabled); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogSkyboxSettingsAsXML(std::shared_ptr resource) { + std::shared_ptr setSkyboxSettings = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetSkyboxSettings"); + doc.InsertFirstChild(root); + + root->SetAttribute("Unknown", setSkyboxSettings->settings.unk); + root->SetAttribute("SkyboxId", setSkyboxSettings->settings.skyboxId); + root->SetAttribute("Weather", setSkyboxSettings->settings.weather); + root->SetAttribute("Indoors", setSkyboxSettings->settings.indoors); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogSoundSettingsAsXML(std::shared_ptr resource) { + std::shared_ptr setSoundSettings = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetSoundSettings"); + doc.InsertFirstChild(root); + + root->SetAttribute("Reverb", setSoundSettings->settings.reverb); + root->SetAttribute("NatureAmbienceId", setSoundSettings->settings.natureAmbienceId); + root->SetAttribute("SeqId", setSoundSettings->settings.seqId); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogSpecialObjectsAsXML(std::shared_ptr resource) { + std::shared_ptr setSpecialObjects = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetSpecialObjects"); + doc.InsertFirstChild(root); + + root->SetAttribute("ElfMessage", setSpecialObjects->specialObjects.elfMessage); + root->SetAttribute("GlobalObject", setSpecialObjects->specialObjects.globalObject); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogStartPositionListAsXML(std::shared_ptr resource) { + std::shared_ptr setStartPositionList = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetStartPositionList"); + doc.InsertFirstChild(root); + + for (size_t i = 0; i < setStartPositionList->numStartPositions; i++) { + tinyxml2::XMLElement* entry = doc.NewElement("StartPositionEntry"); + entry->SetAttribute("Id", setStartPositionList->startPositions[i].id); + entry->SetAttribute("PosX", setStartPositionList->startPositions[i].pos.x); + entry->SetAttribute("PosY", setStartPositionList->startPositions[i].pos.y); + entry->SetAttribute("PosZ", setStartPositionList->startPositions[i].pos.z); + entry->SetAttribute("RotX", setStartPositionList->startPositions[i].rot.x); + entry->SetAttribute("RotY", setStartPositionList->startPositions[i].rot.y); + entry->SetAttribute("RotZ", setStartPositionList->startPositions[i].rot.z); + entry->SetAttribute("Params", setStartPositionList->startPositions[i].params); + root->InsertEndChild(entry); + } + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogTimeSettingsAsXML(std::shared_ptr resource) { + std::shared_ptr setTimeSettings = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetTimeSettings"); + doc.InsertFirstChild(root); + + root->SetAttribute("Hour", setTimeSettings->settings.hour); + root->SetAttribute("Minute", setTimeSettings->settings.minute); + root->SetAttribute("TimeIncrement", setTimeSettings->settings.timeIncrement); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogTransitionActorListAsXML(std::shared_ptr resource) { + std::shared_ptr setTransitionActorList = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetTransitionActorList"); + doc.InsertFirstChild(root); + + for (size_t i = 0; i < setTransitionActorList->numTransitionActors; i++) { + tinyxml2::XMLElement* entry = doc.NewElement("TransitionActorEntry"); + entry->SetAttribute("FrontSideRoom", setTransitionActorList->transitionActorList[i].sides[0].room); + entry->SetAttribute("FrontSideEffects", setTransitionActorList->transitionActorList[i].sides[0].effects); + entry->SetAttribute("BackSideRoom", setTransitionActorList->transitionActorList[i].sides[1].room); + entry->SetAttribute("BackSideEffects", setTransitionActorList->transitionActorList[i].sides[1].effects); + entry->SetAttribute("Id", setTransitionActorList->transitionActorList[i].id); + entry->SetAttribute("PosX", setTransitionActorList->transitionActorList[i].pos.x); + entry->SetAttribute("PosY", setTransitionActorList->transitionActorList[i].pos.y); + entry->SetAttribute("PosZ", setTransitionActorList->transitionActorList[i].pos.z); + entry->SetAttribute("RotY", setTransitionActorList->transitionActorList[i].rotY); + entry->SetAttribute("Params", setTransitionActorList->transitionActorList[i].params); + root->InsertEndChild(entry); + } + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +void LogWindSettingsAsXML(std::shared_ptr resource) { + std::shared_ptr setWindSettings = std::static_pointer_cast(resource); + + tinyxml2::XMLDocument doc; + tinyxml2::XMLElement* root = doc.NewElement("SetWindSettings"); + doc.InsertFirstChild(root); + + root->SetAttribute("WindWest", setWindSettings->settings.windWest); + root->SetAttribute("WindVertical", setWindSettings->settings.windVertical); + root->SetAttribute("WindSouth", setWindSettings->settings.windSouth); + root->SetAttribute("WindSpeed", setWindSettings->settings.windSpeed); + + tinyxml2::XMLPrinter printer; + doc.Accept(&printer); + + SPDLOG_INFO("{}: {}", resource->GetInitData()->Path, printer.CStr()); +} + +} //namespace SOH \ No newline at end of file diff --git a/soh/soh/resource/logging/SceneCommandLoggers.h b/soh/soh/resource/logging/SceneCommandLoggers.h new file mode 100644 index 000000000..f952ac766 --- /dev/null +++ b/soh/soh/resource/logging/SceneCommandLoggers.h @@ -0,0 +1,32 @@ +#include "Resource.h" +#include "soh/OTRGlobals.h" + +namespace SOH { + +void LogEndMarkerAsXML(std::shared_ptr resource); +void LogActorListAsXML(std::shared_ptr resource); +void LogAlternateHeadersAsXML(std::shared_ptr resource); +void LogCameraSettingsAsXML(std::shared_ptr resource); +void LogSetCollisionHeaderAsXML(std::shared_ptr resource); +void LogCsCameraAsXML(std::shared_ptr resource); +void LogCutscenesAsXML(std::shared_ptr resource); +void LogEchoSettingsAsXML(std::shared_ptr resource); +void LogEntranceListAsXML(std::shared_ptr resource); +void LogExitListAsXML(std::shared_ptr resource); +void LogLightingSettingsAsXML(std::shared_ptr resource); +void LogLightListAsXML(std::shared_ptr resource); +void LogMeshAsXML(std::shared_ptr resource); +void LogObjectListAsXML(std::shared_ptr resource); +void LogPathwaysAsXML(std::shared_ptr resource); +void LogRoomBehaviorAsXML(std::shared_ptr resource); +void LogRoomListAsXML(std::shared_ptr resource); +void LogSkyboxModifierAsXML(std::shared_ptr resource); +void LogSkyboxSettingsAsXML(std::shared_ptr resource); +void LogSoundSettingsAsXML(std::shared_ptr resource); +void LogSpecialObjectsAsXML(std::shared_ptr resource); +void LogStartPositionListAsXML(std::shared_ptr resource); +void LogTimeSettingsAsXML(std::shared_ptr resource); +void LogTransitionActorListAsXML(std::shared_ptr resource); +void LogWindSettingsAsXML(std::shared_ptr resource); + +} //namespace SOH \ No newline at end of file diff --git a/soh/soh/resource/type/Animation.h b/soh/soh/resource/type/Animation.h index abd319d97..bf2497107 100644 --- a/soh/soh/resource/type/Animation.h +++ b/soh/soh/resource/type/Animation.h @@ -63,11 +63,11 @@ LinkAnimationHeader linkAnimationHeader; TransformUpdateIndex transformUpdateIndex; }; -class Animation : public LUS::Resource { +class Animation : public Ship::Resource { public: using Resource::Resource; - Animation() : Resource(std::shared_ptr()) {} + Animation() : Resource(std::shared_ptr()) {} AnimationData* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/AudioSample.h b/soh/soh/resource/type/AudioSample.h index 4d6929c59..f37659091 100644 --- a/soh/soh/resource/type/AudioSample.h +++ b/soh/soh/resource/type/AudioSample.h @@ -39,11 +39,11 @@ namespace SOH { s32 sampleRate; // For wav samples only... } Sample; // size = 0x10 - class AudioSample : public LUS::Resource { + class AudioSample : public Ship::Resource { public: using Resource::Resource; - AudioSample() : Resource(std::shared_ptr()) {} + AudioSample() : Resource(std::shared_ptr()) {} Sample* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/AudioSequence.h b/soh/soh/resource/type/AudioSequence.h index 457db6243..d7a8820a3 100644 --- a/soh/soh/resource/type/AudioSequence.h +++ b/soh/soh/resource/type/AudioSequence.h @@ -17,11 +17,11 @@ typedef struct { uint8_t fonts[16]; } Sequence; -class AudioSequence : public LUS::Resource { +class AudioSequence : public Ship::Resource { public: using Resource::Resource; - AudioSequence() : Resource(std::shared_ptr()) {} + AudioSequence() : Resource(std::shared_ptr()) {} Sequence* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/AudioSoundFont.h b/soh/soh/resource/type/AudioSoundFont.h index 11b899d3e..12d66b2d2 100644 --- a/soh/soh/resource/type/AudioSoundFont.h +++ b/soh/soh/resource/type/AudioSoundFont.h @@ -52,11 +52,11 @@ typedef struct { s32 fntIndex; } SoundFont; // size = 0x14 -class AudioSoundFont : public LUS::Resource { +class AudioSoundFont : public Ship::Resource { public: using Resource::Resource; - AudioSoundFont() : Resource(std::shared_ptr()) {} + AudioSoundFont() : Resource(std::shared_ptr()) {} SoundFont* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/Background.h b/soh/soh/resource/type/Background.h index 9edc4b0d6..aa81edde4 100644 --- a/soh/soh/resource/type/Background.h +++ b/soh/soh/resource/type/Background.h @@ -3,11 +3,11 @@ #include "resource/Resource.h" namespace SOH { -class Background : public LUS::Resource { +class Background : public Ship::Resource { public: using Resource::Resource; - Background() : Resource(std::shared_ptr()) {} + Background() : Resource(std::shared_ptr()) {} uint8_t* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/CollisionHeader.h b/soh/soh/resource/type/CollisionHeader.h index e2ddf3f7a..dba5994ce 100644 --- a/soh/soh/resource/type/CollisionHeader.h +++ b/soh/soh/resource/type/CollisionHeader.h @@ -67,11 +67,11 @@ typedef struct { size_t cameraDataListLen; // OTRTODO: Added to allow for bounds checking the cameraDataList. } CollisionHeaderData; // original name: BGDataInfo -class CollisionHeader : public LUS::Resource { +class CollisionHeader : public Ship::Resource { public: using Resource::Resource; - CollisionHeader() : Resource(std::shared_ptr()) {} + CollisionHeader() : Resource(std::shared_ptr()) {} CollisionHeaderData* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/Cutscene.h b/soh/soh/resource/type/Cutscene.h index c4d5fb0d5..664413d2d 100644 --- a/soh/soh/resource/type/Cutscene.h +++ b/soh/soh/resource/type/Cutscene.h @@ -41,11 +41,11 @@ enum class CutsceneCommands { Error = 0xFEAF, }; -class Cutscene : public LUS::Resource { +class Cutscene : public Ship::Resource { public: using Resource::Resource; - Cutscene() : Resource(std::shared_ptr()) {} + Cutscene() : Resource(std::shared_ptr()) {} uint32_t* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/Path.h b/soh/soh/resource/type/Path.h index c4078bed3..5adf683d3 100644 --- a/soh/soh/resource/type/Path.h +++ b/soh/soh/resource/type/Path.h @@ -13,11 +13,11 @@ typedef struct { /* 0x04 */ Vec3s* points; // Segment Address to the array of points } PathData; // size = 0x8 -class Path : public LUS::Resource { +class Path : public Ship::Resource { public: using Resource::Resource; - Path() : Resource(std::shared_ptr()) {} + Path() : Resource(std::shared_ptr()) {} PathData* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/PlayerAnimation.h b/soh/soh/resource/type/PlayerAnimation.h index 416b3928c..e44d30b1b 100644 --- a/soh/soh/resource/type/PlayerAnimation.h +++ b/soh/soh/resource/type/PlayerAnimation.h @@ -5,11 +5,11 @@ #include "Resource.h" namespace SOH { -class PlayerAnimation : public LUS::Resource { +class PlayerAnimation : public Ship::Resource { public: using Resource::Resource; - PlayerAnimation() : Resource(std::shared_ptr()) {} + PlayerAnimation() : Resource(std::shared_ptr()) {} int16_t* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/Scene.h b/soh/soh/resource/type/Scene.h index 79ff69392..722c51845 100644 --- a/soh/soh/resource/type/Scene.h +++ b/soh/soh/resource/type/Scene.h @@ -9,11 +9,11 @@ namespace SOH { -class Scene : public LUS::Resource { +class Scene : public Ship::Resource { public: using Resource::Resource; - Scene() : Resource(std::shared_ptr()) {} + Scene() : Resource(std::shared_ptr()) {} void* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/Skeleton.cpp b/soh/soh/resource/type/Skeleton.cpp index 39c28f533..8ac676c55 100644 --- a/soh/soh/resource/type/Skeleton.cpp +++ b/soh/soh/resource/type/Skeleton.cpp @@ -36,9 +36,9 @@ void SkeletonPatcher::RegisterSkeleton(std::string& path, SkelAnime* skelAnime) } // Determine if we're using an alternate skeleton - if (path.starts_with(LUS::IResource::gAltAssetPrefix)) { - info.vanillaSkeletonPath = path.substr(LUS::IResource::gAltAssetPrefix.length(), - path.size() - LUS::IResource::gAltAssetPrefix.length()); + if (path.starts_with(Ship::IResource::gAltAssetPrefix)) { + info.vanillaSkeletonPath = path.substr(Ship::IResource::gAltAssetPrefix.length(), + path.size() - Ship::IResource::gAltAssetPrefix.length()); } else { info.vanillaSkeletonPath = path; } @@ -65,11 +65,11 @@ void SkeletonPatcher::ClearSkeletons() } void SkeletonPatcher::UpdateSkeletons() { - bool isHD = CVarGetInteger("gAltAssets", 0); + bool isHD = CVarGetInteger(CVAR_ALT_ASSETS, 0); for (auto skel : skeletons) { Skeleton* newSkel = - (Skeleton*)LUS::Context::GetInstance()->GetResourceManager() - ->LoadResource((isHD ? LUS::IResource::gAltAssetPrefix : "") + skel.vanillaSkeletonPath, true) + (Skeleton*)Ship::Context::GetInstance()->GetResourceManager() + ->LoadResource((isHD ? Ship::IResource::gAltAssetPrefix : "") + skel.vanillaSkeletonPath, true) .get(); if (newSkel != nullptr) { diff --git a/soh/soh/resource/type/Skeleton.h b/soh/soh/resource/type/Skeleton.h index 81aa90c68..72d81c5a5 100644 --- a/soh/soh/resource/type/Skeleton.h +++ b/soh/soh/resource/type/Skeleton.h @@ -50,11 +50,11 @@ union SkeletonData { SkelCurveLimbList skelCurveLimbList; }; -class Skeleton : public LUS::Resource { +class Skeleton : public Ship::Resource { public: using Resource::Resource; - Skeleton() : Resource(std::shared_ptr()) {} + Skeleton() : Resource(std::shared_ptr()) {} SkeletonData* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/SkeletonLimb.h b/soh/soh/resource/type/SkeletonLimb.h index bae04092c..04b815f05 100644 --- a/soh/soh/resource/type/SkeletonLimb.h +++ b/soh/soh/resource/type/SkeletonLimb.h @@ -97,11 +97,11 @@ union SkeletonLimbData { SkinLimb skinLimb; }; -class SkeletonLimb : public LUS::Resource { +class SkeletonLimb : public Ship::Resource { public: using Resource::Resource; - SkeletonLimb() : Resource(std::shared_ptr()) {} + SkeletonLimb() : Resource(std::shared_ptr()) {} SkeletonLimbData* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/Text.h b/soh/soh/resource/type/Text.h index 03cf7340b..1ad8c9663 100644 --- a/soh/soh/resource/type/Text.h +++ b/soh/soh/resource/type/Text.h @@ -16,11 +16,11 @@ public: std::string msg; }; -class Text : public LUS::Resource { +class Text : public Ship::Resource { public: using Resource::Resource; - Text() : Resource(std::shared_ptr()) {} + Text() : Resource(std::shared_ptr()) {} MessageEntry* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/scenecommand/SceneCommand.h b/soh/soh/resource/type/scenecommand/SceneCommand.h index 5eb44ae9d..04216e09b 100644 --- a/soh/soh/resource/type/scenecommand/SceneCommand.h +++ b/soh/soh/resource/type/scenecommand/SceneCommand.h @@ -47,10 +47,10 @@ enum class SceneCommandID : uint8_t { Error = 0xFF }; -class ISceneCommand : public LUS::IResource { +class ISceneCommand : public Ship::IResource { public: using IResource::IResource; - ISceneCommand() : IResource(std::shared_ptr()) {} + ISceneCommand() : IResource(std::shared_ptr()) {} SceneCommandID cmdId; }; diff --git a/soh/soh/resource/type/scenecommand/SetMesh.h b/soh/soh/resource/type/scenecommand/SetMesh.h index 33ab24202..5d4f99c6b 100644 --- a/soh/soh/resource/type/scenecommand/SetMesh.h +++ b/soh/soh/resource/type/scenecommand/SetMesh.h @@ -94,6 +94,8 @@ class SetMesh : public SceneCommand { uint8_t data; uint8_t meshHeaderType; + std::vector opaPaths; + std::vector xluPaths; std::vector dlists; std::vector dlists2; std::vector imagePaths; diff --git a/soh/soh/resource/type/scenecommand/SetPathways.h b/soh/soh/resource/type/scenecommand/SetPathways.h index cf875cf5e..9f22130a6 100644 --- a/soh/soh/resource/type/scenecommand/SetPathways.h +++ b/soh/soh/resource/type/scenecommand/SetPathways.h @@ -18,6 +18,7 @@ class SetPathways : public SceneCommand { size_t GetPointerSize(); uint32_t numPaths; + std::vector pathFileNames; std::vector paths; }; }; // namespace LUS diff --git a/soh/soh/z_message_OTR.cpp b/soh/soh/z_message_OTR.cpp index ce0255436..2d281d7a8 100644 --- a/soh/soh/z_message_OTR.cpp +++ b/soh/soh/z_message_OTR.cpp @@ -1,7 +1,7 @@ #include "OTRGlobals.h" #include #include "soh/resource/type/Scene.h" -#include +#include #include "global.h" #include "vt.h" #include "soh/resource/type/Text.h" @@ -23,10 +23,10 @@ static void SetMessageEntry(MessageTableEntry& entry, const SOH::MessageEntry& m } static void OTRMessage_LoadCustom(const std::string& folderPath, MessageTableEntry*& table, size_t tableSize) { - auto lst = *LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folderPath).get(); + auto lst = *Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folderPath).get(); for (auto& tPath : lst) { - auto file = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(tPath)); + auto file = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(tPath)); for (size_t j = 0; j < file->messages.size(); ++j) { // Check if same text ID exists already @@ -43,7 +43,7 @@ static void OTRMessage_LoadCustom(const std::string& folderPath, MessageTableEnt } MessageTableEntry* OTRMessage_LoadTable(const std::string& filePath, bool isNES) { - auto file = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(filePath)); + auto file = std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResource(filePath)); if (file == nullptr) return nullptr; @@ -120,7 +120,7 @@ extern "C" void OTRMessage_Init() if (sStaffMessageEntryTablePtr == NULL) { auto file2 = - std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource( + std::static_pointer_cast(Ship::Context::GetInstance()->GetResourceManager()->LoadResource( "text/staff_message_data_static/staff_message_data_static")); // OTRTODO: Should not be malloc'ing here. It's fine for now since we check that the message table is already null. sStaffMessageEntryTablePtr = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * file2->messages.size()); diff --git a/soh/soh/z_play_otr.cpp b/soh/soh/z_play_otr.cpp index 522a24eb8..237b48ef3 100644 --- a/soh/soh/z_play_otr.cpp +++ b/soh/soh/z_play_otr.cpp @@ -1,7 +1,7 @@ #include "OTRGlobals.h" #include #include "soh/resource/type/Scene.h" -#include +#include #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "global.h" #include "vt.h" @@ -13,9 +13,9 @@ void OTRPlay_InitScene(PlayState* play, s32 spawn); s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene); //LUS::OTRResource* OTRPlay_LoadFile(PlayState* play, RomFile* file) { -LUS::IResource* OTRPlay_LoadFile(PlayState* play, const char* fileName) +Ship::IResource* OTRPlay_LoadFile(PlayState* play, const char* fileName) { - auto res = LUS::Context::GetInstance()->GetResourceManager()->LoadResource(fileName); + auto res = Ship::Context::GetInstance()->GetResourceManager()->LoadResource(fileName); return res.get(); } @@ -81,7 +81,7 @@ void OTRPlay_InitScene(PlayState* play, s32 spawn) { if (IS_BOSS_RUSH && play->sceneNum != SCENE_CHAMBER_OF_THE_SAGES) { gSaveContext.isBossRushPaused = 0; } - /* auto data = static_cast(LUS::Context::GetInstance() + /* auto data = static_cast(Ship::Context::GetInstance() ->GetResourceManager() ->ResourceLoad("object_link_child\\object_link_childVtx_01FE08") .get()); diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index 0b9ba98f9..0aa92e0ec 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -1,7 +1,7 @@ #include "OTRGlobals.h" #include #include "soh/resource/type/Scene.h" -#include +#include #include "global.h" #include "vt.h" #include "soh/resource/type/CollisionHeader.h" @@ -34,13 +34,13 @@ #include "soh/resource/type/scenecommand/SetEchoSettings.h" #include "soh/resource/type/scenecommand/SetAlternateHeaders.h" -extern LUS::IResource* OTRPlay_LoadFile(PlayState* play, const char* fileName); +extern Ship::IResource* OTRPlay_LoadFile(PlayState* play, const char* fileName); extern "C" s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); extern "C" RomFile sNaviMsgFiles[]; s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene); // Forward Declaration of function declared in OTRGlobals.cpp -std::shared_ptr GetResourceByNameHandlingMQ(const char* path); +std::shared_ptr GetResourceByNameHandlingMQ(const char* path); bool Scene_CommandSpawnList(PlayState* play, SOH::ISceneCommand* cmd) { // SOH::SetStartPositionList* cmdStartPos = std::static_pointer_cast(cmd); diff --git a/soh/src/boot/build.c.in b/soh/src/boot/build.c.in index 4fc6a17f4..4d6a07ce6 100644 --- a/soh/src/boot/build.c.in +++ b/soh/src/boot/build.c.in @@ -4,6 +4,7 @@ const char gBuildVersion[] = "@PROJECT_BUILD_NAME@ (@CMAKE_PROJECT_VERSION_MAJOR const u16 gBuildVersionMajor = @CMAKE_PROJECT_VERSION_MAJOR@; const u16 gBuildVersionMinor = @CMAKE_PROJECT_VERSION_MINOR@; const u16 gBuildVersionPatch = @CMAKE_PROJECT_VERSION_PATCH@; + const char gBuildTeam[] = "@PROJECT_TEAM@"; const char gBuildDate[] = __DATE__ " " __TIME__; const char gBuildMakeOption[] = ""; diff --git a/soh/src/code/audioMgr.c b/soh/src/code/audioMgr.c index d9b215d07..2a6752206 100644 --- a/soh/src/code/audioMgr.c +++ b/soh/src/code/audioMgr.c @@ -109,10 +109,10 @@ void AudioMgr_Init(AudioMgr* audioMgr, void* stack, OSPri pri, OSId id, SchedCon Audio_InitSound(); osSendMesgPtr(&audioMgr->unk_C8, NULL, OS_MESG_BLOCK); - Audio_SetGameVolume(SEQ_PLAYER_BGM_MAIN, CVarGetFloat("gMainMusicVolume", 1.0f)); - Audio_SetGameVolume(SEQ_PLAYER_BGM_SUB, CVarGetFloat("gSubMusicVolume", 1.0f)); - Audio_SetGameVolume(SEQ_PLAYER_FANFARE, CVarGetFloat("gFanfareVolume", 1.0f)); - Audio_SetGameVolume(SEQ_PLAYER_SFX, CVarGetFloat("gSFXMusicVolume", 1.0f)); + Audio_SetGameVolume(SEQ_PLAYER_BGM_MAIN, CVarGetFloat(CVAR_SETTING("Volume.MainMusic"), 1.0f)); + Audio_SetGameVolume(SEQ_PLAYER_BGM_SUB, CVarGetFloat(CVAR_SETTING("Volume.SubMusic"), 1.0f)); + Audio_SetGameVolume(SEQ_PLAYER_FANFARE, CVarGetFloat(CVAR_SETTING("Volume.Fanfare"), 1.0f)); + Audio_SetGameVolume(SEQ_PLAYER_SFX, CVarGetFloat(CVAR_SETTING("Volume.SFX"), 1.0f)); // Removed due to crash //IrqMgr_AddClient(audioMgr->irqMgr, &irqClient, &audioMgr->unk_74); diff --git a/soh/src/code/audio_load.c b/soh/src/code/audio_load.c index 914366f91..cb7ba60bb 100644 --- a/soh/src/code/audio_load.c +++ b/soh/src/code/audio_load.c @@ -632,7 +632,7 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) { // Keep track of the previous sequence/scene so we don't repeat notifications static uint16_t previousSeqId = UINT16_MAX; static int16_t previousSceneNum = INT16_MAX; - if (CVarGetInteger("gSeqNameOverlay", 0) && + if (CVarGetInteger(CVAR_AUDIO("SeqNameOverlay"), 0) && playerIdx == SEQ_PLAYER_BGM_MAIN && (seqId != previousSeqId || (gPlayState != NULL && gPlayState->sceneNum != previousSceneNum))) { @@ -642,7 +642,7 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) { } const char* sequenceName = AudioCollection_GetSequenceName(seqId); if (sequenceName != NULL) { - Overlay_DisplayText_Seconds(CVarGetInteger("gSeqNameOverlayDuration", 5), sequenceName); + Overlay_DisplayText_Seconds(CVarGetInteger(CVAR_AUDIO("SeqNameOverlayDuration"), 5), sequenceName); } } } diff --git a/soh/src/code/audio_playback.c b/soh/src/code/audio_playback.c index 66f236c43..39be0c3a7 100644 --- a/soh/src/code/audio_playback.c +++ b/soh/src/code/audio_playback.c @@ -94,7 +94,7 @@ void Audio_InitNoteSub(Note* note, NoteSubEu* sub, NoteSubAttributes* attrs) { vel = 0.0f > vel ? 0.0f : vel; vel = 1.0f < vel ? 1.0f : vel; - float master_vol = CVarGetFloat("gGameMasterVolume", 1.0f); + float master_vol = CVarGetFloat(CVAR_SETTING("Volume.Master"), 1.0f); sub->targetVolLeft = (s32)((vel * volLeft) * (0x1000 - 0.001f)) * master_vol; sub->targetVolRight = (s32)((vel * volRight) * (0x1000 - 0.001f)) * master_vol; @@ -120,7 +120,7 @@ void Audio_NoteSetResamplingRate(NoteSubEu* noteSubEu, f32 resamplingRateInput) } else { noteSubEu->bitField1.hasTwoParts = true; if (3.99996f < resamplingRateInput) { - if (CVarGetInteger("gExperimentalOctaveDrop", 0)) { + if (CVarGetInteger(CVAR_AUDIO("ExperimentalOctaveDrop"), 0)) { resamplingRate = resamplingRateInput * 0.25; } else { resamplingRate = 1.99998f; diff --git a/soh/src/code/audio_synthesis.c b/soh/src/code/audio_synthesis.c index f2c526630..7044a48c4 100644 --- a/soh/src/code/audio_synthesis.c +++ b/soh/src/code/audio_synthesis.c @@ -653,7 +653,7 @@ Acmd* AudioSynth_DoOneAudioUpdate(s16* aiBuf, s32 aiBufLen, Acmd* cmd, s32 updat } updateIndex = aiBufLen * 2; - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { aInterleave(cmd++, DMEM_TEMP, DMEM_RIGHT_CH, DMEM_LEFT_CH, updateIndex); } else { aInterleave(cmd++, DMEM_TEMP, DMEM_LEFT_CH, DMEM_RIGHT_CH, updateIndex); diff --git a/soh/src/code/code_80097A00.c b/soh/src/code/code_80097A00.c index eb83738e3..32110d8d2 100644 --- a/soh/src/code/code_80097A00.c +++ b/soh/src/code/code_80097A00.c @@ -205,7 +205,7 @@ u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) { if (equipment == EQUIP_TYPE_TUNIC) { gSaveContext.equips.equipment |= EQUIP_VALUE_TUNIC_KOKIRI << (EQUIP_TYPE_TUNIC * 4); // non-vanilla: remove goron and zora tunics from item buttons if assignable tunics is on - if (CVarGetInteger("gAssignableTunicsAndBoots", 0) && equipValue != EQUIP_VALUE_TUNIC_KOKIRI) { + if (CVarGetInteger(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 0) && equipValue != EQUIP_VALUE_TUNIC_KOKIRI) { ItemID item = (equipValue == EQUIP_VALUE_TUNIC_GORON ? ITEM_TUNIC_GORON : ITEM_TUNIC_ZORA); for (int i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { if (gSaveContext.equips.buttonItems[i] == item) { diff --git a/soh/src/code/code_800EC960.c b/soh/src/code/code_800EC960.c index c07cb3b8f..a1364b8a9 100644 --- a/soh/src/code/code_800EC960.c +++ b/soh/src/code/code_800EC960.c @@ -1259,11 +1259,11 @@ void Audio_PlayFanfare_Rando(GetItemEntry getItem); // Function originally not called, so repurposing for control mapping void Audio_OcaUpdateBtnMap(bool customControls, bool dpad, bool rStick) { if (customControls) { - sOcarinaD5BtnMap = CVarGetInteger("gOcarinaD5BtnMap", BTN_CUP); - sOcarinaB4BtnMap = CVarGetInteger("gOcarinaB4BtnMap", BTN_CLEFT); - sOcarinaA4BtnMap = CVarGetInteger("gOcarinaA4BtnMap", BTN_CRIGHT); - sOcarinaF4BtnMap = CVarGetInteger("gOcarinaF4BtnMap", BTN_CDOWN); - sOcarinaD4BtnMap = CVarGetInteger("gOcarinaD4BtnMap", BTN_A); + sOcarinaD5BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.D5Button"), BTN_CUP); + sOcarinaB4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.B4Button"), BTN_CLEFT); + sOcarinaA4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.A4Button"), BTN_CRIGHT); + sOcarinaF4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.F4Button"), BTN_CDOWN); + sOcarinaD4BtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.D4Button"), BTN_A); } else { sOcarinaD5BtnMap = BTN_CUP; sOcarinaB4BtnMap = BTN_CLEFT; @@ -1540,8 +1540,8 @@ void func_800ED200(void) { u8 k; u32 disableSongBtnMap; - if (CVarGetInteger("gCustomOcarinaControls", 0)) { - disableSongBtnMap = CVarGetInteger("gOcarinaDisableBtnMap", BTN_L); + if (CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0)) { + disableSongBtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.DisableButton"), BTN_L); } else { disableSongBtnMap = BTN_L; } @@ -1602,13 +1602,13 @@ void func_800ED200(void) { void func_800ED458(s32 arg0) { u32 phi_v1_2; - bool customControls = CVarGetInteger("gCustomOcarinaControls", 0); - bool dpad = CVarGetInteger("gDpadOcarina", 0); - bool rStick = CVarGetInteger("gRStickOcarina", 0); + bool customControls = CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0); + bool dpad = CVarGetInteger(CVAR_SETTING("OcarinaControl.Dpad"), 0); + bool rStick = CVarGetInteger(CVAR_SETTING("OcarinaControl.RStick"), 0); if (D_80130F3C != 0 && sOcarinaDropInputTimer != 0) { sOcarinaDropInputTimer--; - if (!CVarGetInteger("gDpadNoDropOcarinaInput", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 0)) { return; } } @@ -1650,7 +1650,7 @@ void func_800ED458(s32 arg0) { u32 noteSharpBtnMap; if (customControls) { - noteSharpBtnMap = CVarGetInteger("gOcarinaSharpBtnMap", BTN_R); + noteSharpBtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.SharpButton"), BTN_R); } else { noteSharpBtnMap = BTN_R; } @@ -1661,7 +1661,7 @@ void func_800ED458(s32 arg0) { u32 noteFlatBtnMap; if (customControls) { - noteFlatBtnMap = CVarGetInteger("gOcarinaFlatBtnMap", BTN_Z); + noteFlatBtnMap = CVarGetInteger(CVAR_SETTING("CustomOcarina.FlatButton"), BTN_Z); } else { noteFlatBtnMap = BTN_Z; } @@ -2067,15 +2067,15 @@ void Audio_OcaMemoryGameStart(u8 minigameRound) { u8 i; // #region SOH [Enhancement] - if (CVarGetInteger("gCustomizeOcarinaGame", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 0)) { u8 startingNotes = 3; - u8 roundOneCount = CVarGetInteger("gOcarinaGameRoundOneNotes", 5); - u8 roundTwoCount = CVarGetInteger("gOcarinaGameRoundTwoNotes", 6); - u8 roundThreeCount = CVarGetInteger("gOcarinaGameRoundThreeNotes", 8); + u8 roundOneCount = CVarGetInteger(CVAR_ENHANCEMENT("OcarinaGame.RoundOneNotes"), 5); + u8 roundTwoCount = CVarGetInteger(CVAR_ENHANCEMENT("OcarinaGame.RoundTwoNotes"), 6); + u8 roundThreeCount = CVarGetInteger(CVAR_ENHANCEMENT("OcarinaGame.RoundThreeNotes"), 8); u8 modMinigameNoteCnts[] = { roundOneCount, roundTwoCount, roundThreeCount }; - startingNotes = CVarGetInteger("gOcarinaGameStartingNotes", 3); + startingNotes = CVarGetInteger(CVAR_ENHANCEMENT("OcarinaGame.StartingNotes"), 3); if (minigameRound > 2) { minigameRound = 2; @@ -2118,9 +2118,9 @@ s32 Audio_OcaMemoryGameGenNote(void) { } // #region SOH [Enhancement] - if (CVarGetInteger("gCustomizeOcarinaGame", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 0)) { int noteSpeed = 0x2D; - noteSpeed = noteSpeed / CVarGetInteger("gOcarinaGameNoteSpeed", 1); + noteSpeed = noteSpeed / CVarGetInteger(CVAR_ENHANCEMENT("OcarinaGame.NoteSpeed"), 1); sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].noteIdx = rndNote; sOcarinaSongs[OCARINA_SONG_MEMORY_GAME][sOcaMinigameAppendPos].unk_02 = noteSpeed; @@ -4025,7 +4025,7 @@ void Audio_PlayFanfare_Rando(GetItemEntry getItem) { temp1 = NA_BGM_SMALL_ITEM_GET | 0x900; } // If the setting is toggled on and we get special quest items (longer fanfares): - if (CVarGetInteger("gRandoQuestItemFanfares", 0) != 0) { + if (CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("QuestItemFanfares"), 0) != 0) { // If we get a medallion, play the "get a medallion" fanfare if ((itemId >= ITEM_MEDALLION_FOREST) && (itemId <= ITEM_MEDALLION_LIGHT)) { temp1 = NA_BGM_MEDALLION_GET | 0x900; diff --git a/soh/src/code/game.c b/soh/src/code/game.c index b46aa4ebd..f0988c7c3 100644 --- a/soh/src/code/game.c +++ b/soh/src/code/game.c @@ -14,7 +14,7 @@ FaultClient sGameFaultClient; u16 sLastButtonPressed; // Forward declared, because this in a C++ header. -int gfx_create_framebuffer(uint32_t width, uint32_t height); +int gfx_create_framebuffer(uint32_t width, uint32_t height, uint32_t native_width, uint32_t native_height, uint8_t resize); void gfx_texture_cache_clear(); @@ -93,7 +93,7 @@ void func_800C4344(GameState* gameState) { HREG(95) = CHECK_BTN_ALL(selectedInput->press.button, hReg82); } - if (CVarGetInteger("gRegEditEnabled", 0) || gIsCtrlr2Valid) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("RegEditEnabled"), 0) || gIsCtrlr2Valid) { func_8006390C(&gameState->input[1]); } @@ -162,7 +162,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { } sLastButtonPressed = gameState->input[0].press.button | gameState->input[0].cur.button; - if (R_DISABLE_INPUT_DISPLAY == 0 && CVarGetInteger("gDebugEnabled", 0)) { + if (R_DISABLE_INPUT_DISPLAY == 0 && CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) { GameState_DrawInputDisplay(sLastButtonPressed, &newDList); } @@ -247,7 +247,7 @@ void GameState_Update(GameState* gameState) { if (fbTest == -1) { - fbTest = gfx_create_framebuffer(64, 112); + fbTest = gfx_create_framebuffer(64, 112, SCREEN_WIDTH, SCREEN_HEIGHT, true); //fbTest = gfx_create_framebuffer(256, 512); } @@ -329,7 +329,7 @@ void GameState_Update(GameState* gameState) { func_800C49F4(gfxCtx); } - gSaveContext.language = CVarGetInteger("gLanguages", LANGUAGE_ENG); + gSaveContext.language = CVarGetInteger(CVAR_SETTING("Languages"), LANGUAGE_ENG); GameInteractor_ExecuteOnGameFrameUpdate(); gameState->frames++; @@ -467,7 +467,7 @@ void GameState_Destroy(GameState* gameState) { // Performing clear skeletons before unload resources fixes an actor heap corruption crash due to the skeleton patching system. ResourceMgr_ClearSkeletons(); - if (CVarGetInteger("gAltAssets", 0)) { + if (CVarGetInteger(CVAR_ALT_ASSETS, 0)) { ResourceUnloadDirectory("alt/*"); gfx_texture_cache_clear(); } diff --git a/soh/src/code/gfxprint.c b/soh/src/code/gfxprint.c index 8a0dbead4..1717e46b3 100644 --- a/soh/src/code/gfxprint.c +++ b/soh/src/code/gfxprint.c @@ -141,7 +141,7 @@ static const ALIGN_ASSET(2) char rGfxPrintFontDataAlt[] = drGfxPrintFontDataAlt; // https://github.com/HarbourMasters/Shipwright/issues/2762 typedef enum {hardcoded, otrDefault, otrAlt} font_texture_t; font_texture_t GfxPrint_TextureToUse() { - if (CVarGetInteger("gAltAssets", 0) && ResourceMgr_FileExists(rGfxPrintFontDataAlt)) { + if (CVarGetInteger(CVAR_ALT_ASSETS, 0) && ResourceMgr_FileExists(rGfxPrintFontDataAlt)) { // If we have alt assets enabled, and we have alt prefixed font texture, use that return otrAlt; } else if (ResourceMgr_FileExists(rGfxPrintFontData)) { @@ -214,7 +214,7 @@ void GfxPrint_SetColor(GfxPrint* this, u32 r, u32 g, u32 b, u32 a) { } void GfxPrint_SetPosPx(GfxPrint* this, s32 x, s32 y) { - this->posX = this->baseX + (x * 4) + CVarGetInteger("gGfxPrintCharStartOffset", 0); + this->posX = this->baseX + (x * 4) + CVarGetInteger(CVAR_DEVELOPER_TOOLS("GfxPrintChar.StartOffset"), 0); this->posY = this->baseY + (y * 4); } @@ -272,7 +272,7 @@ void GfxPrint_PrintCharImpl(GfxPrint* this, u8 c) { (u16)(c >> 3) * 256, 1 << 10, 1 << 10); } - this->posX += CVarGetInteger("gGfxPrintCharSpacing", 32); + this->posX += CVarGetInteger(CVAR_DEVELOPER_TOOLS("GfxPrintChar.Spacing"), 32); } void GfxPrint_PrintStringWithSize(GfxPrint* this, const void* buffer, u32 charSize, u32 charCount) { diff --git a/soh/src/code/graph.c b/soh/src/code/graph.c index d273e7643..f5d620e72 100644 --- a/soh/src/code/graph.c +++ b/soh/src/code/graph.c @@ -290,7 +290,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { OPEN_DISPS(gfxCtx); - if (CVarGetInteger("gValueViewer.EnablePrinting", 0)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("ValueViewerEnablePrinting"), 0)) { Gfx* gfx; Gfx* polyOpa; GfxPrint printer; @@ -424,7 +424,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { sGraphUpdateTime = time; } - if (CVarGetInteger("gDebugEnabled", 0)) + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) { if (CHECK_BTN_ALL(gameState->input[0].press.button, BTN_Z) && CHECK_BTN_ALL(gameState->input[0].cur.button, BTN_L | BTN_R)) { diff --git a/soh/src/code/padmgr.c b/soh/src/code/padmgr.c index 3315a9fe8..57dd2c6f7 100644 --- a/soh/src/code/padmgr.c +++ b/soh/src/code/padmgr.c @@ -287,8 +287,8 @@ void PadMgr_ProcessInputs(PadMgr* padMgr) { // When 3 frames are left on easy pause buffer, re-apply the last held inputs to the prev inputs // to compute the pressed difference. This makes it so previously held inputs are continued as "held", // but new inputs when unpausing are "pressed" out of the pause menu. - if (CVarGetInteger("gCheatEasyPauseBufferTimer", 0) == 3) { - input->prev.button = CVarGetInteger("gCheatEasyPauseBufferLastInputs", 0); + if (CVarGetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 0) == 3) { + input->prev.button = CVarGetInteger(CVAR_GENERAL("CheatEasyPauseBufferLastInputs"), 0); } buttonDiff = input->prev.button ^ input->cur.button; diff --git a/soh/src/code/shrink_window.c b/soh/src/code/shrink_window.c index 015820421..ee4d2e967 100644 --- a/soh/src/code/shrink_window.c +++ b/soh/src/code/shrink_window.c @@ -6,7 +6,7 @@ s32 sShrinkWindowVal = 0; s32 sShrinkWindowCurrentVal = 0; void ShrinkWindow_SetVal(s32 value) { - if (CVarGetInteger("gDisableBlackBars", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableBlackBars"), 0)) { sShrinkWindowVal = 0; return; } @@ -21,7 +21,7 @@ u32 ShrinkWindow_GetVal(void) { } void ShrinkWindow_SetCurrentVal(s32 currentVal) { - if (CVarGetInteger("gDisableBlackBars", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableBlackBars"), 0)) { sShrinkWindowCurrentVal = 0; return; } diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index e1002d114..98e414d55 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -353,50 +353,50 @@ void func_8002BE98(TargetContext* targetCtx, s32 actorCategory, PlayState* play) } void func_8002BF60(TargetContext* targetCtx, Actor* actor, s32 actorCategory, PlayState* play) { - if (CVarGetInteger("gCosmetics.Navi_IdlePrimary.Changed", 0)) { - sNaviColorList[ACTORCAT_PLAYER].inner = CVarGetColor("gCosmetics.Navi_IdlePrimary.Value", defaultIdlePrimaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Navi.IdlePrimary.Changed"), 0)) { + sNaviColorList[ACTORCAT_PLAYER].inner = CVarGetColor(CVAR_COSMETIC("Navi.IdlePrimary.Value"), defaultIdlePrimaryColor); } else { sNaviColorList[ACTORCAT_PLAYER].inner = defaultIdlePrimaryColor; } - if (CVarGetInteger("gCosmetics.Navi_IdleSecondary.Changed", 0)) { - sNaviColorList[ACTORCAT_PLAYER].outer = CVarGetColor("gCosmetics.Navi_IdleSecondary.Value", defaultIdleSecondaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Navi.IdleSecondary.Changed"), 0)) { + sNaviColorList[ACTORCAT_PLAYER].outer = CVarGetColor(CVAR_COSMETIC("Navi.IdleSecondary.Value"), defaultIdleSecondaryColor); } else { sNaviColorList[ACTORCAT_PLAYER].outer = defaultIdleSecondaryColor; } - if (CVarGetInteger("gCosmetics.Navi_NPCPrimary.Changed", 0)) { - sNaviColorList[ACTORCAT_NPC].inner = CVarGetColor("gCosmetics.Navi_NPCPrimary.Value", defaultNPCPrimaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Navi.NPCPrimary.Changed"), 0)) { + sNaviColorList[ACTORCAT_NPC].inner = CVarGetColor(CVAR_COSMETIC("Navi.NPCPrimary.Value"), defaultNPCPrimaryColor); } else { sNaviColorList[ACTORCAT_NPC].inner = defaultNPCPrimaryColor; } - if (CVarGetInteger("gCosmetics.Navi_NPCSecondary.Changed", 0)) { - sNaviColorList[ACTORCAT_NPC].outer = CVarGetColor("gCosmetics.Navi_NPCSecondary.Value", defaultNPCSecondaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Navi.NPCSecondary.Changed"), 0)) { + sNaviColorList[ACTORCAT_NPC].outer = CVarGetColor(CVAR_COSMETIC("Navi.NPCSecondary.Value"), defaultNPCSecondaryColor); } else { sNaviColorList[ACTORCAT_NPC].outer = defaultNPCSecondaryColor; } - if (CVarGetInteger("gCosmetics.Navi_EnemyPrimary.Changed", 0)) { - sNaviColorList[ACTORCAT_ENEMY].inner = CVarGetColor("gCosmetics.Navi_EnemyPrimary.Value", defaultEnemyPrimaryColor); - sNaviColorList[ACTORCAT_BOSS].inner = CVarGetColor("gCosmetics.Navi_EnemyPrimary.Value", defaultEnemyPrimaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Navi.EnemyPrimary.Changed"), 0)) { + sNaviColorList[ACTORCAT_ENEMY].inner = CVarGetColor(CVAR_COSMETIC("Navi.EnemyPrimary.Value"), defaultEnemyPrimaryColor); + sNaviColorList[ACTORCAT_BOSS].inner = CVarGetColor(CVAR_COSMETIC("Navi.EnemyPrimary.Value"), defaultEnemyPrimaryColor); } else { sNaviColorList[ACTORCAT_ENEMY].inner = defaultEnemyPrimaryColor; sNaviColorList[ACTORCAT_BOSS].inner = defaultEnemyPrimaryColor; } - if (CVarGetInteger("gCosmetics.Navi_EnemySecondary.Changed", 0)) { - sNaviColorList[ACTORCAT_ENEMY].outer = CVarGetColor("gCosmetics.Navi_EnemySecondary.Value", defaultEnemySecondaryColor); - sNaviColorList[ACTORCAT_BOSS].outer = CVarGetColor("gCosmetics.Navi_EnemySecondary.Value", defaultEnemySecondaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Navi.EnemySecondary.Changed"), 0)) { + sNaviColorList[ACTORCAT_ENEMY].outer = CVarGetColor(CVAR_COSMETIC("Navi.EnemySecondary.Value"), defaultEnemySecondaryColor); + sNaviColorList[ACTORCAT_BOSS].outer = CVarGetColor(CVAR_COSMETIC("Navi.EnemySecondary.Value"), defaultEnemySecondaryColor); } else { sNaviColorList[ACTORCAT_ENEMY].outer = defaultEnemySecondaryColor; sNaviColorList[ACTORCAT_BOSS].outer = defaultEnemySecondaryColor; } - if (CVarGetInteger("gCosmetics.Navi_PropsPrimary.Changed", 0)) { - sNaviColorList[ACTORCAT_PROP].inner = CVarGetColor("gCosmetics.Navi_PropsPrimary.Value", defaultPropsPrimaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Navi.PropsPrimary.Changed"), 0)) { + sNaviColorList[ACTORCAT_PROP].inner = CVarGetColor(CVAR_COSMETIC("Navi.PropsPrimary.Value"), defaultPropsPrimaryColor); } else { sNaviColorList[ACTORCAT_PROP].inner = defaultPropsPrimaryColor; } - if (CVarGetInteger("gCosmetics.Navi_PropsSecondary.Changed", 0)) { - sNaviColorList[ACTORCAT_PROP].outer = CVarGetColor("gCosmetics.Navi_PropsSecondary.Value", defaultPropsSecondaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Navi.PropsSecondary.Changed"), 0)) { + sNaviColorList[ACTORCAT_PROP].outer = CVarGetColor(CVAR_COSMETIC("Navi.PropsSecondary.Value"), defaultPropsSecondaryColor); } else { sNaviColorList[ACTORCAT_PROP].outer = defaultPropsSecondaryColor; } @@ -1082,10 +1082,10 @@ void TitleCard_InitPlaceName(PlayState* play, TitleCardContext* titleCtx, void* void TitleCard_Update(PlayState* play, TitleCardContext* titleCtx) { const Color_RGB8 TitleCard_Colors_ori = {255,255,255}; Color_RGB8 TitleCard_Colors = {255,255,255}; - if (titleCtx->isBossCard && CVarGetInteger("gHudColors", 1) == 2) {//Bosses cards. - TitleCard_Colors = CVarGetColor24("gCCTC_B_U_Prim", TitleCard_Colors_ori); - } else if (!titleCtx->isBossCard && CVarGetInteger("gHudColors", 1) == 2) { - TitleCard_Colors = CVarGetColor24("gCCTC_OW_U_Prim", TitleCard_Colors_ori); + if (titleCtx->isBossCard && CVarGetInteger(CVAR_COSMETIC("HUD.TitleCard.Boss.Changed"), 1) == 2) { + TitleCard_Colors = CVarGetColor24(CVAR_COSMETIC("HUD.TitleCard.Boss.Value"), TitleCard_Colors_ori); + } else if (!titleCtx->isBossCard && CVarGetInteger(CVAR_COSMETIC("HUD.TitleCard.Map.Changed"), 1) == 2) { + TitleCard_Colors = CVarGetColor24(CVAR_COSMETIC("HUD.TitleCard.Map.Value"), TitleCard_Colors_ori); } else { TitleCard_Colors = TitleCard_Colors_ori; } @@ -1119,20 +1119,20 @@ void TitleCard_Draw(PlayState* play, TitleCardContext* titleCtx) { if (titleCtx->alpha != 0) { width = titleCtx->width; height = titleCtx->height; - s16 TitleCard_PosX_Modifier = (titleCtx->isBossCard ? CVarGetInteger("gTCBPosX", 0) : CVarGetInteger("gTCMPosX", 0)); - s16 TitleCard_PosY_Modifier = (titleCtx->isBossCard ? CVarGetInteger("gTCBPosY", 0) : CVarGetInteger("gTCMPosY", 0)); - s16 TitleCard_PosType_Checker = (titleCtx->isBossCard ? CVarGetInteger("gTCBPosType", 0) : CVarGetInteger("gTCMPosType", 0)); - s16 TitleCard_Margin_Checker = (titleCtx->isBossCard ? CVarGetInteger("gTCBUseMargins", 0) : CVarGetInteger("gTCMUseMargins", 0)); + s16 TitleCard_PosX_Modifier = (titleCtx->isBossCard ? CVarGetInteger(CVAR_COSMETIC("TitleCard.Boss.PosX"), 0) : CVarGetInteger(CVAR_COSMETIC("TitleCard.Map.PosX"), 0)); + s16 TitleCard_PosY_Modifier = (titleCtx->isBossCard ? CVarGetInteger(CVAR_COSMETIC("TitleCard.Boss.PosY"), 0) : CVarGetInteger(CVAR_COSMETIC("TitleCard.Map.PosY"), 0)); + s16 TitleCard_PosType_Checker = (titleCtx->isBossCard ? CVarGetInteger(CVAR_COSMETIC("TitleCard.Boss.PosType"), 0) : CVarGetInteger(CVAR_COSMETIC("TitleCard.Map.PosType"), 0)); + s16 TitleCard_Margin_Checker = (titleCtx->isBossCard ? CVarGetInteger(CVAR_COSMETIC("TitleCard.Boss.UseMargins"), 0) : CVarGetInteger(CVAR_COSMETIC("TitleCard.Map.UseMargins"), 0)); s16 TitleCard_MarginX = 0; s16 TitleCard_PosX = titleCtx->x; s16 TitleCard_PosY = titleCtx->y; if (TitleCard_PosType_Checker != 0) { TitleCard_PosY = TitleCard_PosY_Modifier; if (TitleCard_PosType_Checker == 1) {//Anchor Left - if (TitleCard_Margin_Checker != 0) {TitleCard_MarginX = CVarGetInteger("gHUDMargin_L", 0)*-1;}; + if (TitleCard_Margin_Checker != 0) {TitleCard_MarginX = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.L"), 0)*-1;}; TitleCard_PosX = OTRGetDimensionFromLeftEdge(TitleCard_PosX_Modifier+TitleCard_MarginX)-11; } else if (TitleCard_PosType_Checker == 2) {//Anchor Right - if (TitleCard_Margin_Checker != 0) {TitleCard_MarginX = CVarGetInteger("gHUDMargin_R", 0);}; + if (TitleCard_Margin_Checker != 0) {TitleCard_MarginX = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.R"), 0);}; TitleCard_PosX = OTRGetDimensionFromRightEdge(TitleCard_PosX_Modifier+TitleCard_MarginX); } else if (TitleCard_PosType_Checker == 3) {//Anchor None TitleCard_PosX = TitleCard_PosX_Modifier; @@ -1228,7 +1228,7 @@ void Actor_Init(Actor* actor, PlayState* play) { actor->uncullZoneForward = 1000.0f; actor->uncullZoneScale = 350.0f; actor->uncullZoneDownward = 700.0f; - if (CVarGetInteger("gDisableDrawDistance", 0) != 0 && actor->id != ACTOR_EN_TORCH2 && actor->id != ACTOR_EN_BLKOBJ // Extra check for Dark Link and his room + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableDrawDistance"), 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 && (play->sceneNum != SCENE_DODONGOS_CAVERN && 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 @@ -2213,7 +2213,7 @@ void Player_PlaySfx(Actor* actor, u16 sfxId) { if (actor->id != ACTOR_PLAYER || sfxId < NA_SE_VO_LI_SWORD_N || sfxId > NA_SE_VO_LI_ELECTRIC_SHOCK_LV_KID) { Audio_PlaySoundGeneral(sfxId, &actor->projectedPos, 4, &D_801333E0 , &D_801333E0, &D_801333E8); } else { - freqMultiplier = CVarGetFloat("gLinkVoiceFreqMultiplier", 1.0); + freqMultiplier = CVarGetFloat(CVAR_AUDIO("LinkVoiceFreqMultiplier"), 1.0); if (freqMultiplier <= 0) { freqMultiplier = 1; } @@ -2349,7 +2349,7 @@ void Actor_DrawFaroresWindPointer(PlayState* play) { D_8015BC14 = 60; D_8015BC18 = 1.0f; } else if (D_8015BC14) { - D_8015BC14-= CVarGetInteger("gFastFarores", 0) ? 5 : 1; + D_8015BC14-= CVarGetInteger(CVAR_ENHANCEMENT("FastFarores"), 0) ? 5 : 1; } else if (D_8015BC18 > 0.0f) { static Vec3f effectVel = { 0.0f, -0.05f, 0.0f }; static Vec3f effectAccel = { 0.0f, -0.025f, 0.0f }; @@ -2897,7 +2897,7 @@ s32 func_800314B0(PlayState* play, Actor* actor) { s32 func_800314D4(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3) { f32 var; - if (CVarGetInteger("gDisableDrawDistance", 0) != 0 && actor->id != ACTOR_EN_TORCH2 && actor->id != ACTOR_EN_BLKOBJ // Extra check for Dark Link and his room + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableDrawDistance"), 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 && (play->sceneNum != SCENE_DODONGOS_CAVERN && 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 @@ -2910,7 +2910,7 @@ s32 func_800314D4(PlayState* play, Actor* actor, Vec3f* arg2, f32 arg3) { // #region SoH [Widescreen support] // Doors will cull quite noticeably on wider screens. For these actors the zone is increased f32 limit = 1.0f; - if (((actor->id == ACTOR_EN_DOOR) || (actor->id == ACTOR_DOOR_SHUTTER)) && CVarGetInteger("gIncreaseDoorUncullZones", 1)) { + if (((actor->id == ACTOR_EN_DOOR) || (actor->id == ACTOR_DOOR_SHUTTER)) && CVarGetInteger(CVAR_GENERAL("IncreaseDoorUncullZones"), 1)) { limit = 2.0f; } @@ -3191,7 +3191,7 @@ int gMapLoading = 0; Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 posX, f32 posY, f32 posZ, s16 rotX, s16 rotY, s16 rotZ, s16 params, s16 canRandomize) { - uint8_t tryRandomizeEnemy = CVarGetInteger("gRandomizedEnemies", 0) && gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2 && canRandomize; + uint8_t tryRandomizeEnemy = CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) && gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2 && canRandomize; if (tryRandomizeEnemy) { if (!GetRandomizedEnemy(play, &actorId, &posX, &posY, &posZ, &rotX, &rotY, &rotZ, ¶ms)) { @@ -3220,7 +3220,7 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos objBankIndex = Object_GetIndex(&gPlayState->objectCtx, dbEntry->objectId); - if (objBankIndex < 0 && (!gMapLoading || CVarGetInteger("gRandomizedEnemies", 0))) { + if (objBankIndex < 0 && (!gMapLoading || CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0))) { objBankIndex = 0; } @@ -3298,7 +3298,7 @@ Actor* Actor_SpawnAsChild(ActorContext* actorCtx, Actor* parent, PlayState* play // Gohma (z_boss_goma.c), the Stalchildren spawner (z_en_encount1.c) and the falling platform spawning Stalfos in // Forest Temple (z_bg_mori_bigst.c) that normally rely on this behaviour are changed when // Enemy Rando is on so they still work properly even without assigning a parent. - if (CVarGetInteger("gRandomizedEnemies", 0) && (spawnedActor->id == ACTOR_EN_FLOORMAS || spawnedActor->id == ACTOR_EN_PEEHAT)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) && (spawnedActor->id == ACTOR_EN_FLOORMAS || spawnedActor->id == ACTOR_EN_PEEHAT)) { return spawnedActor; } diff --git a/soh/src/code/z_bgcheck.c b/soh/src/code/z_bgcheck.c index 064d59860..2a385f966 100644 --- a/soh/src/code/z_bgcheck.c +++ b/soh/src/code/z_bgcheck.c @@ -1902,7 +1902,7 @@ s32 BgCheck_CheckWallImpl(CollisionContext* colCtx, u16 xpFlags, Vec3f* posResul s32 bgId2; f32 nx, ny, nz; // unit normal of polygon - if (CVarGetInteger("gNoClip", 0) && actor != NULL && actor->id == ACTOR_PLAYER) { + if (CVarGetInteger(CVAR_CHEAT("NoClip"), 0) && actor != NULL && actor->id == ACTOR_PLAYER) { return false; } @@ -4025,7 +4025,7 @@ u32 func_80041D94(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { * SurfaceType Get Wall Flags */ s32 func_80041DB8(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { - if (CVarGetInteger("gClimbEverything", 0) != 0) { + if (CVarGetInteger(CVAR_CHEAT("ClimbEverything"), 0) != 0) { return (1 << 3) | D_80119D90[func_80041D94(colCtx, poly, bgId)]; } else { return D_80119D90[func_80041D94(colCtx, poly, bgId)]; @@ -4122,7 +4122,7 @@ u32 SurfaceType_GetEcho(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) * SurfaceType Is Hookshot Surface */ u32 SurfaceType_IsHookshotSurface(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { - return CVarGetInteger("gHookshotEverything", 0) || SurfaceType_GetData(colCtx, poly, bgId, 1) >> 17 & 1; + return CVarGetInteger(CVAR_CHEAT("HookshotEverything"), 0) || SurfaceType_GetData(colCtx, poly, bgId, 1) >> 17 & 1; } /** diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index b5719d48c..bfaafaba2 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -1239,7 +1239,7 @@ f32 Camera_LERPClampDist(Camera* camera, f32 dist, f32 min, f32 max) { camera->rUpdateRateInv = Camera_LERPCeilF(rUpdateRateInvTarget, camera->rUpdateRateInv, PCT(OREG(25)), 0.1f); return Camera_LERPCeilF(distTarget, camera->dist, 1.0f / camera->rUpdateRateInv, - CVarGetInteger("gFixCameraDrift", 0) ? 0.0f : 0.2f); + CVarGetInteger(CVAR_ENHANCEMENT("FixCameraDrift"), 0) ? 0.0f : 0.2f); } f32 Camera_ClampDist(Camera* camera, f32 dist, f32 minDist, f32 maxDist, s16 timer) { @@ -1262,7 +1262,7 @@ f32 Camera_ClampDist(Camera* camera, f32 dist, f32 minDist, f32 maxDist, s16 tim camera->rUpdateRateInv = Camera_LERPCeilF(rUpdateRateInvTarget, camera->rUpdateRateInv, PCT(OREG(25)), 0.1f); return Camera_LERPCeilF(distTarget, camera->dist, 1.0f / camera->rUpdateRateInv, - CVarGetInteger("gFixCameraDrift", 0) ? 0.0f : 0.2f); + CVarGetInteger(CVAR_ENHANCEMENT("FixCameraDrift"), 0) ? 0.0f : 0.2f); } s16 Camera_CalcDefaultPitch(Camera* camera, s16 arg1, s16 arg2, s16 arg3) { @@ -1485,12 +1485,12 @@ s32 Camera_Free(Camera* camera) { camera->animState = 0; - f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f * (CVarGetFloat("gThirdPersonCameraSensitivityX", 1.0f)); - f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f * (CVarGetFloat("gThirdPersonCameraSensitivityY", 1.0f)); - bool invertXAxis = (CVarGetInteger("gInvertXAxis", 0) && !CVarGetInteger("gMirroredWorld", 0)) || (!CVarGetInteger("gInvertXAxis", 0) && CVarGetInteger("gMirroredWorld", 0)); + f32 newCamX = -D_8015BD7C->state.input[0].cur.right_stick_x * 10.0f * (CVarGetFloat(CVAR_SETTING("FreeLook.CameraSensitivity.X"), 1.0f)); + f32 newCamY = D_8015BD7C->state.input[0].cur.right_stick_y * 10.0f * (CVarGetFloat(CVAR_SETTING("FreeLook.CameraSensitivity.Y"), 1.0f)); + bool invertXAxis = (CVarGetInteger(CVAR_SETTING("FreeLook.InvertXAxis"), 0) && !CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) || (!CVarGetInteger(CVAR_SETTING("FreeLook.InvertXAxis"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)); camera->play->camX += newCamX * (invertXAxis ? -1 : 1); - camera->play->camY += newCamY * (CVarGetInteger("gInvertYAxis", 1) ? 1 : -1); + camera->play->camY += newCamY * (CVarGetInteger(CVAR_SETTING("FreeLook.InvertYAxis"), 1) ? 1 : -1); if (camera->play->camY > 0x32A4) { camera->play->camY = 0x32A4; @@ -1499,8 +1499,8 @@ s32 Camera_Free(Camera* camera) { camera->play->camY = -0x228C; } - f32 distTarget = CVarGetInteger("gFreeCameraDistMax", para1->distTarget); - f32 speedScaler = CVarGetInteger("gFreeCameraTransitionSpeed", 25); + f32 distTarget = CVarGetInteger(CVAR_SETTING("FreeLook.MaxCameraDistance"), para1->distTarget); + f32 speedScaler = CVarGetInteger(CVAR_SETTING("FreeLook.TransitionSpeed"), 25); f32 distDiff = ABS(distTarget - camera->dist); if (distDiff > 0) camera->dist = Camera_LERPCeilF(distTarget, camera->dist, speedScaler / (distDiff + speedScaler), 0.0f); @@ -1524,7 +1524,7 @@ s32 Camera_Free(Camera* camera) { } s32 Camera_Normal1(Camera* camera) { - if (CVarGetInteger("gFreeCamera", 0) && SetCameraManual(camera) == 1) { + if (CVarGetInteger(CVAR_SETTING("FreeLook.Enabled"), 0) && SetCameraManual(camera) == 1) { Camera_Free(camera); return 1; } @@ -1679,7 +1679,7 @@ s32 Camera_Normal1(Camera* camera) { if (anim->startSwingTimer <= 0) { // idle camera re-center - if (CVarGetInteger("gA11yDisableIdleCam", 0)) { + if (CVarGetInteger(CVAR_SETTING("A11yDisableIdleCam"), 0)) { return 1; } eyeAdjustment.pitch = atEyeNextGeo.pitch; @@ -1710,7 +1710,7 @@ s32 Camera_Normal1(Camera* camera) { Camera_Vec3fVecSphGeoAdd(eyeNext, at, &eyeAdjustment); if ((camera->status == CAM_STAT_ACTIVE) && (!(norm1->interfaceFlags & 0x10))) { anim->swingYawTarget = BINANG_ROT180(camera->playerPosRot.rot.y); - if (!CVarGetInteger("gFixCameraSwing", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("FixCameraSwing"), 0)) { if (anim->startSwingTimer > 0) { func_80046E20(camera, &eyeAdjustment, norm1->distMin, norm1->unk_0C, &sp98, &anim->swing); } else { @@ -1749,7 +1749,7 @@ s32 Camera_Normal1(Camera* camera) { } // crit wiggle - if(!CVarGetInteger("gDisableCritWiggle",0)) { + if(!CVarGetInteger(CVAR_ENHANCEMENT("DisableCritWiggle"),0)) { if (gSaveContext.health <= 16 && ((camera->play->state.frames % 256) == 0)) { wiggleAdj = Rand_ZeroOne() * 10000.0f; camera->inputDir.y = wiggleAdj + camera->inputDir.y; @@ -1770,7 +1770,7 @@ s32 Camera_Normal1(Camera* camera) { } s32 Camera_Normal2(Camera* camera) { - if (CVarGetInteger("gFreeCamera", 0) && SetCameraManual(camera) == 1) { + if (CVarGetInteger(CVAR_SETTING("FreeLook.Enabled"), 0) && SetCameraManual(camera) == 1) { Camera_Free(camera); return 1; } @@ -1941,7 +1941,7 @@ s32 Camera_Normal2(Camera* camera) { // riding epona s32 Camera_Normal3(Camera* camera) { - if (CVarGetInteger("gFreeCamera", 0) && SetCameraManual(camera) == 1) { + if (CVarGetInteger(CVAR_SETTING("FreeLook.Enabled"), 0) && SetCameraManual(camera) == 1) { Camera_Free(camera); return 1; } @@ -2305,7 +2305,7 @@ s32 Camera_Parallel0(Camera* camera) { * Generic jump, jumping off ledges */ s32 Camera_Jump1(Camera* camera) { - if (CVarGetInteger("gFreeCamera", 0) && SetCameraManual(camera) == 1) { + if (CVarGetInteger(CVAR_SETTING("FreeLook.Enabled"), 0) && SetCameraManual(camera) == 1) { Camera_Free(camera); return 1; } @@ -2455,7 +2455,7 @@ s32 Camera_Jump1(Camera* camera) { // Climbing ladders/vines s32 Camera_Jump2(Camera* camera) { - if (CVarGetInteger("gFreeCamera", 0) && SetCameraManual(camera) == 1) { + if (CVarGetInteger(CVAR_SETTING("FreeLook.Enabled"), 0) && SetCameraManual(camera) == 1) { Camera_Free(camera); return 1; } @@ -2642,7 +2642,7 @@ s32 Camera_Jump2(Camera* camera) { // swimming s32 Camera_Jump3(Camera* camera) { - if (CVarGetInteger("gFreeCamera", 0) && SetCameraManual(camera) == 1) { + if (CVarGetInteger(CVAR_SETTING("FreeLook.Enabled"), 0) && SetCameraManual(camera) == 1) { Camera_Free(camera); return 1; } @@ -3104,7 +3104,7 @@ s32 Camera_Battle3(Camera* camera) { * setting value. */ s32 Camera_Battle4(Camera* camera) { - if (CVarGetInteger("gFreeCamera", 0) && SetCameraManual(camera) == 1) { + if (CVarGetInteger(CVAR_SETTING("FreeLook.Enabled"), 0) && SetCameraManual(camera) == 1) { Camera_Free(camera); return 1; } @@ -4639,7 +4639,7 @@ s32 Camera_Data4(Camera* camera) { * Hanging off of a ledge */ s32 Camera_Unique1(Camera* camera) { - if (CVarGetInteger("gFreeCamera", 0) && SetCameraManual(camera) == 1) { + if (CVarGetInteger(CVAR_SETTING("FreeLook.Enabled"), 0) && SetCameraManual(camera) == 1) { Camera_Free(camera); return 1; } @@ -4726,7 +4726,7 @@ s32 Camera_Unique1(Camera* camera) { anim->timer--; } - sp8C.yaw = Camera_LERPFloorS(anim->yawTarget, eyeNextAtOffset.yaw, 0.5f, CVarGetInteger("gFixHangingLedgeSwingRate", 0) ? 0xA : 0x2710); + sp8C.yaw = Camera_LERPFloorS(anim->yawTarget, eyeNextAtOffset.yaw, 0.5f, CVarGetInteger(CVAR_ENHANCEMENT("FixHangingLedgeSwingRate"), 0) ? 0xA : 0x2710); Camera_Vec3fVecSphGeoAdd(eyeNext, at, &sp8C); *eye = *eyeNext; Camera_BGCheck(camera, at, eye); @@ -7619,7 +7619,7 @@ Vec3s Camera_Update(Camera* camera) { } // enable/disable debug cam - if (CVarGetInteger("gDebugEnabled", 0) && CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_START)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) && CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_START)) { gDbgCamEnabled ^= 1; if (gDbgCamEnabled) { DbgCamera_Enable(&D_8015BD80, camera); @@ -7702,7 +7702,7 @@ Vec3s Camera_Update(Camera* camera) { } if (camera->timer != -1 && CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_DRIGHT) && - CVarGetInteger("gDebugEnabled", 0)) { + CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) { camera->timer = 0; } @@ -7890,7 +7890,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) { } // Clear free look if an action is performed that would move the camera (targeting, first person, talking) - if (CVarGetInteger("gFreeCamera", 0) && SetCameraManual(camera) == 1 && + if (CVarGetInteger(CVAR_SETTING("FreeLook.Enabled"), 0) && SetCameraManual(camera) == 1 && ((mode >= CAM_MODE_TARGET && mode <= CAM_MODE_BATTLE) || (mode >= CAM_MODE_FIRSTPERSON && mode <= CAM_MODE_CLIMBZ) || mode == CAM_MODE_HANGZ || mode == CAM_MODE_FOLLOWBOOMERANG)) { diff --git a/soh/src/code/z_collision_check.c b/soh/src/code/z_collision_check.c index c4716c947..5376ae41c 100644 --- a/soh/src/code/z_collision_check.c +++ b/soh/src/code/z_collision_check.c @@ -3047,7 +3047,7 @@ void CollisionCheck_ApplyDamage(PlayState* play, CollisionCheckContext* colChkCt collider->actor->colChkInfo.damage += damage; } - if (CVarGetInteger("gIvanCoopModeEnabled", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0)) { collider->actor->colChkInfo.damage *= GET_PLAYER(play)->ivanDamageMultiplier; } } @@ -3667,7 +3667,7 @@ u8 CollisionCheck_GetSwordDamage(s32 dmgFlags, PlayState* play) { damage = 8; } - if (CVarGetInteger("gIvanCoopModeEnabled", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0)) { damage *= GET_PLAYER(play)->ivanDamageMultiplier; } diff --git a/soh/src/code/z_common_data.c b/soh/src/code/z_common_data.c index 2a903b26e..31a25841d 100644 --- a/soh/src/code/z_common_data.c +++ b/soh/src/code/z_common_data.c @@ -8,7 +8,7 @@ void SaveContext_Init(void) { gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; gSaveContext.forcedSeqId = NA_BGM_GENERAL_SFX; - gSaveContext.nextCutsceneIndex = CVarGetInteger("gBetaQuestWorld", 0xFFEF); + gSaveContext.nextCutsceneIndex = CVarGetInteger(CVAR_CHEAT("BetaQuestWorld"), 0xFFEF); gSaveContext.cutsceneTrigger = 0; gSaveContext.chamberCutsceneNum = 0; gSaveContext.nextDayTime = 0xFFFF; diff --git a/soh/src/code/z_construct.c b/soh/src/code/z_construct.c index c8a340492..960088cba 100644 --- a/soh/src/code/z_construct.c +++ b/soh/src/code/z_construct.c @@ -430,8 +430,8 @@ void Regs_InitDataImpl(void) { WREG(28) = 0; R_OW_MINIMAP_X = 238; R_OW_MINIMAP_Y = 164; - if (!CVarGetInteger("gEnhancements.RememberMapToggleState", 0)) { - R_MINIMAP_DISABLED = CVarGetInteger("gMinimalUI", 0); + if (!CVarGetInteger(CVAR_ENHANCEMENT("RememberMapToggleState"), 0)) { + R_MINIMAP_DISABLED = CVarGetInteger(CVAR_ENHANCEMENT("MinimalUI"), 0); } WREG(32) = 122; WREG(33) = 60; diff --git a/soh/src/code/z_debug.c b/soh/src/code/z_debug.c index 267846eb4..1a814d745 100644 --- a/soh/src/code/z_debug.c +++ b/soh/src/code/z_debug.c @@ -133,7 +133,7 @@ void func_8006390C(Input* input) { InputCombo* input_combo; s32 i; - if (!CVarGetInteger("gDebugEnabled", 0)) + if (!CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) return; regGroup = (gGameInfo->regGroup * REG_PAGES + gGameInfo->regPage) * REG_PER_PAGE - REG_PER_PAGE; @@ -216,7 +216,7 @@ void func_80063C04(GfxPrint* printer) { s32 pad; char name[3]; - if (!CVarGetInteger("gDebugEnabled", 0)) + if (!CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) return; // set up register name string @@ -243,7 +243,7 @@ void func_80063D7C(GraphicsContext* gfxCtx) { GfxPrint printer; Gfx* tempRet; - if (!CVarGetInteger("gDebugEnabled", 0) || GameInteractor_NoUIActive()) { + if (!CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) || GameInteractor_NoUIActive()) { return; } diff --git a/soh/src/code/z_demo.c b/soh/src/code/z_demo.c index 51d0053e1..424fca83f 100644 --- a/soh/src/code/z_demo.c +++ b/soh/src/code/z_demo.c @@ -155,14 +155,14 @@ void func_80064558(PlayState* play, CutsceneContext* csCtx) { void func_800645A0(PlayState* play, CutsceneContext* csCtx) { Input* input = &play->state.input[0]; - if (CVarGetInteger("gDebugEnabled", 0) && CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) && CHECK_BTN_ALL(input->press.button, BTN_DLEFT) && (csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneSetupIndex >= 4)) { D_8015FCC8 = 0; gSaveContext.cutsceneIndex = 0xFFFD; gSaveContext.cutsceneTrigger = 1; } - if (CVarGetInteger("gDebugEnabled", 0) && CHECK_BTN_ALL(input->press.button, BTN_DUP) && + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) && CHECK_BTN_ALL(input->press.button, BTN_DUP) && (csCtx->state == CS_STATE_IDLE) && (gSaveContext.sceneSetupIndex >= 4) && !gDbgCamEnabled) { D_8015FCC8 = 1; gSaveContext.cutsceneIndex = 0xFFFD; @@ -506,7 +506,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB } bool debugCsSkip = (CHECK_BTN_ALL(play->state.input[0].press.button, BTN_START) && - (gSaveContext.fileNum != 0xFEDC) && CVarGetInteger("gDebugEnabled", 0)); + (gSaveContext.fileNum != 0xFEDC) && CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)); if ((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 3) && (play->sceneNum != SCENE_HYRULE_FIELD) && (csCtx->frames > 20) && @@ -519,9 +519,9 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB } bool playCutscene = false; - if (!CVarGetInteger("gCreditsFix", 1) && (cmd->startFrame == csCtx->frames)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("CreditsFix"), 1) && (cmd->startFrame == csCtx->frames)) { playCutscene = true; - } else if (CVarGetInteger("gCreditsFix", 1)) { + } else if (CVarGetInteger(CVAR_ENHANCEMENT("CreditsFix"), 1)) { u16 delay = 0; // HACK: Align visual timing with audio during credits sequence @@ -623,7 +623,7 @@ void Cutscene_Command_Terminator(PlayState* play, CutsceneContext* csCtx, CsCmdB play->transitionType = TRANS_TYPE_INSTANT; break; case 8: - if (CVarGetInteger("gBetterFW", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("BetterFarore"), 0)) { FaroresWindData tempFW = gSaveContext.backupFW; gSaveContext.backupFW = gSaveContext.fw; gSaveContext.fw = tempFW; @@ -1701,7 +1701,7 @@ void Cutscene_ProcessCommands(PlayState* play, CutsceneContext* csCtx, u8* cutsc return; } - if (CVarGetInteger("gDebugEnabled", 0) && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_DRIGHT)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) && CHECK_BTN_ALL(play->state.input[0].press.button, BTN_DRIGHT)) { csCtx->state = CS_STATE_UNSKIPPABLE_INIT; return; } diff --git a/soh/src/code/z_draw.c b/soh/src/code/z_draw.c index 8dcd847ec..e27f230b1 100644 --- a/soh/src/code/z_draw.c +++ b/soh/src/code/z_draw.c @@ -764,13 +764,13 @@ void GetItem_DrawRecoveryHeart(PlayState* play, s16 drawId) { 1 * -(play->state.frames * 2), 32, 32)); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); - if (CVarGetInteger("gCosmetics.Consumable_Hearts.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.Consumable_Hearts.Value", (Color_RGB8) { 255, 70, 50 }); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.Hearts.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("Consumable.Hearts.Value"), (Color_RGB8) { 255, 70, 50 }); gDPSetGrayscaleColor(POLY_XLU_DISP++, color.r, color.g, color.b, 255); gSPGrayscale(POLY_XLU_DISP++, true); } gSPDisplayList(POLY_XLU_DISP++, sDrawItemTable[drawId].dlists[0]); - if (CVarGetInteger("gCosmetics.Consumable_Hearts.Changed", 0)) { + if (CVarGetInteger(CVAR_COSMETIC("Consumable.Hearts.Changed"), 0)) { gSPGrayscale(POLY_XLU_DISP++, false); } CLOSE_DISPS(play->state.gfxCtx); diff --git a/soh/src/code/z_eff_blure.c b/soh/src/code/z_eff_blure.c index e770a9096..82e50fc65 100644 --- a/soh/src/code/z_eff_blure.c +++ b/soh/src/code/z_eff_blure.c @@ -208,8 +208,8 @@ s32 EffectBlure_Update(void* thisx) { switch (this->trailType) { //there HAS to be a better way to do this. case 2: - if (CVarGetInteger("gCosmetics.Trails_Boomerang.Changed", 0)) { - color = CVarGetColor("gCosmetics.Trails_Boomerang.Value", (Color_RGBA8){ 255, 255, 100, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Trails.Boomerang.Changed"), 0)) { + color = CVarGetColor(CVAR_COSMETIC("Trails.Boomerang.Value"), (Color_RGBA8){ 255, 255, 100, 255 }); changed = 1; } else if (changed) { color = (Color_RGBA8){ 255, 255, 100, 255 }; @@ -217,8 +217,8 @@ s32 EffectBlure_Update(void* thisx) { } break; case 3: - if (CVarGetInteger("gCosmetics.Trails_Bombchu.Changed", 0)) { - color = CVarGetColor("gCosmetics.Trails_Bombchu.Value", (Color_RGBA8){ 250, 0, 0, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Trails.Bombchu.Changed"), 0)) { + color = CVarGetColor(CVAR_COSMETIC("Trails.Bombchu.Value"), (Color_RGBA8){ 250, 0, 0, 255 }); this->p1StartColor.r = color.r; this->p2StartColor.r = color.r * 0.8f; this->p1EndColor.r = color.r * 0.6f; @@ -248,8 +248,8 @@ s32 EffectBlure_Update(void* thisx) { } break; case 4: - if (CVarGetInteger("gCosmetics.Trails_KokiriSword.Changed", 0)) { - color = CVarGetColor("gCosmetics.Trails_KokiriSword.Value", (Color_RGBA8){ 255, 255, 255, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Trails.KokiriSword.Changed"), 0)) { + color = CVarGetColor(CVAR_COSMETIC("Trails.KokiriSword.Value"), (Color_RGBA8){ 255, 255, 255, 255 }); changed = 1; } else if (changed) { color = (Color_RGBA8){ 255, 255, 255, 255 }; @@ -257,8 +257,8 @@ s32 EffectBlure_Update(void* thisx) { } break; case 5: - if (CVarGetInteger("gCosmetics.Trails_MasterSword.Changed", 0)) { - color = CVarGetColor("gCosmetics.Trails_MasterSword.Value", (Color_RGBA8){ 255, 255, 255, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Trails.MasterSword.Changed"), 0)) { + color = CVarGetColor(CVAR_COSMETIC("Trails.MasterSword.Value"), (Color_RGBA8){ 255, 255, 255, 255 }); changed = 1; } else if (changed) { color = (Color_RGBA8){ 255, 255, 255, 255 }; @@ -266,8 +266,8 @@ s32 EffectBlure_Update(void* thisx) { } break; case 6: - if (CVarGetInteger("gCosmetics.Trails_BiggoronSword.Changed", 0)) { - color = CVarGetColor("gCosmetics.Trails_BiggoronSword.Value", (Color_RGBA8){ 255, 255, 255, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Trails.BiggoronSword.Changed"), 0)) { + color = CVarGetColor(CVAR_COSMETIC("Trails.BiggoronSword.Value"), (Color_RGBA8){ 255, 255, 255, 255 }); changed = 1; } else if (changed) { color = (Color_RGBA8){ 255, 255, 255, 255 }; @@ -275,8 +275,8 @@ s32 EffectBlure_Update(void* thisx) { } break; case 7: - if (CVarGetInteger("gCosmetics.Trails_Stick.Changed", 0)) { - color = CVarGetColor("gCosmetics.Trails_Stick.Value", (Color_RGBA8){ 255, 255, 255, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Trails.Stick.Changed"), 0)) { + color = CVarGetColor(CVAR_COSMETIC("Trails.Stick.Value"), (Color_RGBA8){ 255, 255, 255, 255 }); changed = 1; } else if (changed) { color = (Color_RGBA8){ 255, 255, 255, 255 }; @@ -284,8 +284,8 @@ s32 EffectBlure_Update(void* thisx) { } break; case 8: - if (CVarGetInteger("gCosmetics.Trails_Hammer.Changed", 0)) { - color = CVarGetColor("gCosmetics.Trails_Hammer.Value", (Color_RGBA8){ 255, 255, 255, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Trails.Hammer.Changed"), 0)) { + color = CVarGetColor(CVAR_COSMETIC("Trails.Hammer.Value"), (Color_RGBA8){ 255, 255, 255, 255 }); changed = 1; } else if (changed) { color = (Color_RGBA8){ 255, 255, 255, 255 }; @@ -317,8 +317,8 @@ s32 EffectBlure_Update(void* thisx) { // Don't override boomerang and bombchu trail durations if (this->trailType != 2 && this->trailType != 3) { - if (CVarGetInteger("gCosmetics.Trails_Duration.Changed", 0)) { - this->elemDuration = CVarGetInteger("gCosmetics.Trails_Duration.Value", 4); + if (CVarGetInteger(CVAR_COSMETIC("Trails.Duration.Changed"), 0)) { + this->elemDuration = CVarGetInteger(CVAR_COSMETIC("Trails.Duration.Value"), 4); } } diff --git a/soh/src/code/z_en_item00.c b/soh/src/code/z_en_item00.c index e6a3fd756..8e30f462a 100644 --- a/soh/src/code/z_en_item00.c +++ b/soh/src/code/z_en_item00.c @@ -3,6 +3,7 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h" #include "textures/icon_item_static/icon_item_static.h" +#include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS 0 @@ -334,7 +335,7 @@ void EnItem00_SetupAction(EnItem00* this, EnItem00ActionFunc actionFunc) { void EnItem00_SetObjectDependency(EnItem00* this, PlayState* play, s16 objectIndex) { // Remove object dependency for Enemy Randomizer and Crowd Control to allow Like-likes to // drop equipment correctly in rooms where Like-likes normally don't spawn. - if (CVarGetInteger("gRandomizedEnemies", 0) || CVarGetInteger("gCrowdControl", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) || (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0))) { this->actor.objBankIndex = 0; } else { this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, objectIndex); @@ -782,7 +783,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) { this->actor.params == ITEM00_BOMBS_SPECIAL || (this->actor.params >= ITEM00_BOMBCHU && this->actor.params <= ITEM00_SOH_GIVE_ITEM_ENTRY_GI) ) { - if (CVarGetInteger("gNewDrops", 0) || (this->actor.params >= ITEM00_SOH_DUMMY && this->actor.params <= ITEM00_SOH_GIVE_ITEM_ENTRY_GI)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0) || (this->actor.params >= ITEM00_SOH_DUMMY && this->actor.params <= ITEM00_SOH_GIVE_ITEM_ENTRY_GI)) { this->actor.shape.rot.y += 960; } else { this->actor.shape.rot.y = 0; @@ -791,7 +792,7 @@ void EnItem00_Update(Actor* thisx, PlayState* play) { if (this->unk_15A > 0) { this->unk_15A--; - if (CVarGetInteger("gDropsDontDie", 0) && (this->unk_154 <= 0)) { + if (CVarGetInteger(CVAR_CHEAT("DropsDontDie"), 0) && (this->unk_154 <= 0)) { this->unk_15A++; } } @@ -1006,35 +1007,35 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { if (!(this->unk_156 & this->unk_158)) { switch (this->actor.params) { case ITEM00_RUPEE_GREEN: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 25.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_RUPEE_GREEN); break; } case ITEM00_RUPEE_BLUE: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 25.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_RUPEE_BLUE); break; } case ITEM00_RUPEE_RED: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 25.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_RUPEE_RED); break; } case ITEM00_RUPEE_ORANGE: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 17.5f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_RUPEE_GOLD); break; } case ITEM00_RUPEE_PURPLE: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 17.5f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_RUPEE_PURPLE); @@ -1044,7 +1045,7 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { } break; case ITEM00_HEART_PIECE: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 21.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_HEART_PIECE); @@ -1057,7 +1058,7 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { break; case ITEM00_HEART: // Only change despawn-able recovery hearts - if (CVarGetInteger("gNewDrops", 0) && this->unk_15A >= 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0) && this->unk_15A >= 0) { mtxScale = 16.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_HEART); @@ -1083,7 +1084,7 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { case ITEM00_BOMBS_A: case ITEM00_BOMBS_B: case ITEM00_BOMBS_SPECIAL: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 8.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_BOMB); @@ -1091,70 +1092,70 @@ void EnItem00_Draw(Actor* thisx, PlayState* play) { } case ITEM00_ARROWS_SINGLE: case ITEM00_ARROWS_SMALL: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 7.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_ARROWS_SMALL); break; } case ITEM00_ARROWS_MEDIUM: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 7.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_ARROWS_MEDIUM); break; } case ITEM00_ARROWS_LARGE: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 7.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_ARROWS_LARGE); break; } case ITEM00_NUTS: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 9.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_NUTS); break; } case ITEM00_STICK: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 7.5f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_STICK); break; } case ITEM00_MAGIC_LARGE: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 8.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_MAGIC_LARGE); break; } case ITEM00_MAGIC_SMALL: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 8.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_MAGIC_SMALL); break; } case ITEM00_SEEDS: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 7.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_SEEDS); break; } case ITEM00_BOMBCHU: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 9.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_BOMBCHU); break; } case ITEM00_SMALL_KEY: - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { mtxScale = 8.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); GetItem_Draw(play, GID_KEY_SMALL); @@ -1314,24 +1315,24 @@ void EnItem00_DrawRupee(EnItem00* this, PlayState* play) { u8 shouldColor = 0; switch (texIndex) { case 0: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_GreenRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_GreenRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.GreenRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.GreenRupee.Changed"), 0); break; case 1: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_BlueRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_BlueRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.BlueRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.BlueRupee.Changed"), 0); break; case 2: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_RedRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_RedRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.RedRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.RedRupee.Changed"), 0); break; case 4: // orange rupee texture corresponds to the purple rupee (authentic bug) - rupeeColor = CVarGetColor24("gCosmetics.Consumable_PurpleRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_PurpleRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.PurpleRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.PurpleRupee.Changed"), 0); break; case 3: // pink rupee texture corresponds to the gold rupee (authentic bug) - rupeeColor = CVarGetColor24("gCosmetics.Consumable_GoldRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_GoldRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.GoldRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.GoldRupee.Changed"), 0); break; } @@ -1491,7 +1492,7 @@ s16 func_8001F404(s16 dropId) { if (LINK_IS_ADULT) { if (dropId == ITEM00_SEEDS) { dropId = ITEM00_ARROWS_SMALL; - } else if ((dropId == ITEM00_STICK) && !(CVarGetInteger("gTreeStickDrops", 0))) { + } else if ((dropId == ITEM00_STICK) && !(CVarGetInteger(CVAR_ENHANCEMENT("TreesDropSticks"), 0))) { dropId = ITEM00_RUPEE_GREEN; } } else { @@ -1500,7 +1501,7 @@ s16 func_8001F404(s16 dropId) { } } - if ((CVarGetInteger("gBombchuDrops", 0) || + if ((CVarGetInteger(CVAR_ENHANCEMENT("BombchuDrops"), 0) || (IS_RANDO && Randomizer_GetSettingValue(RSK_ENABLE_BOMBCHU_DROPS) == 1)) && (dropId == ITEM00_BOMBS_A || dropId == ITEM00_BOMBS_B || dropId == ITEM00_BOMBS_SPECIAL)) { dropId = EnItem00_ConvertBombDropToBombchu(dropId); @@ -1534,7 +1535,7 @@ EnItem00* Item_DropCollectible(PlayState* play, Vec3f* spawnPos, s16 params) { params &= 0x3FFF; - if ((params & 0x00FF) == ITEM00_HEART && CVarGetInteger("gNoHeartDrops", 0)) { return NULL; } + if ((params & 0x00FF) == ITEM00_HEART && CVarGetInteger(CVAR_ENHANCEMENT("NoHeartDrops"), 0)) { return NULL; } if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) { // TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf) @@ -1579,7 +1580,7 @@ EnItem00* Item_DropCollectible2(PlayState* play, Vec3f* spawnPos, s16 params) { params &= 0x3FFF; - if ((params & 0x00FF) == ITEM00_HEART && CVarGetInteger("gNoHeartDrops", 0)) { return NULL; } + if ((params & 0x00FF) == ITEM00_HEART && CVarGetInteger(CVAR_ENHANCEMENT("NoHeartDrops"), 0)) { return NULL; } if (((params & 0x00FF) == ITEM00_FLEXIBLE) && !param4000) { // TODO: Prevent the cast to EnItem00 here since this is a different actor (En_Elf) @@ -1616,7 +1617,7 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP param8000 = params & 0x8000; params &= 0x7FFF; - if (CVarGetInteger("gNoRandomDrops", 0)) { return; } + if (CVarGetInteger(CVAR_ENHANCEMENT("NoRandomDrops"), 0)) { return; } if (fromActor != NULL) { if (fromActor->dropFlag) { @@ -1659,11 +1660,11 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP EffectSsDeadSound_SpawnStationary(play, spawnPos, NA_SE_EV_BUTTERFRY_TO_FAIRY, true, DEADSOUND_REPEAT_MODE_OFF, 40); return; - } else if (gSaveContext.health <= 0x30 && !CVarGetInteger("gNoHeartDrops", 0)) { // 3 hearts or less + } else if (gSaveContext.health <= 0x30 && !CVarGetInteger(CVAR_ENHANCEMENT("NoHeartDrops"), 0)) { // 3 hearts or less params = 0xB * 0x10; dropTableIndex = 0x0; dropId = ITEM00_HEART; - } else if (gSaveContext.health <= 0x50 && !CVarGetInteger("gNoHeartDrops", 0)) { // 5 hearts or less + } else if (gSaveContext.health <= 0x50 && !CVarGetInteger(CVAR_ENHANCEMENT("NoHeartDrops"), 0)) { // 5 hearts or less params = 0xA * 0x10; dropTableIndex = 0x0; dropId = ITEM00_HEART; @@ -1696,7 +1697,7 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP } } - if (dropId != 0xFF && (!CVarGetInteger("gNoHeartDrops", 0) || dropId != ITEM00_HEART)) { + if (dropId != 0xFF && (!CVarGetInteger(CVAR_ENHANCEMENT("NoHeartDrops"), 0) || dropId != ITEM00_HEART)) { dropQuantity = sDropQuantities[params + dropTableIndex]; while (dropQuantity > 0) { if (!param8000) { @@ -1721,7 +1722,7 @@ void Item_DropCollectibleRandom(PlayState* play, Actor* fromActor, Vec3f* spawnP } } } else { - if (CVarGetInteger("gBushDropFix", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("BushDropFix"), 0)) { Item_DropCollectible(play, spawnPos, dropId | 0x8000); } else { Item_DropCollectible(play, spawnPos, params | 0x8000); diff --git a/soh/src/code/z_face_reaction.c b/soh/src/code/z_face_reaction.c index 899c6afc6..278af706e 100644 --- a/soh/src/code/z_face_reaction.c +++ b/soh/src/code/z_face_reaction.c @@ -67,7 +67,7 @@ u16 sReactionTextIds[][PLAYER_MASK_MAX] = { u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) { u8 currentMask = Player_GetMask(play); - if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && currentMask == PLAYER_MASK_BUNNY) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && currentMask == PLAYER_MASK_BUNNY) { return 0; } else { return sReactionTextIds[reactionSet][currentMask]; diff --git a/soh/src/code/z_fcurve_data_skelanime.c b/soh/src/code/z_fcurve_data_skelanime.c index b75c34a61..91b6dc90c 100644 --- a/soh/src/code/z_fcurve_data_skelanime.c +++ b/soh/src/code/z_fcurve_data_skelanime.c @@ -131,7 +131,7 @@ void SkelCurve_DrawLimb(PlayState* play, s32 limbIndex, SkelAnimeCurve* skelCurv Matrix_TranslateRotateZYX(&pos, &rot); Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); - if (CVarGetInteger("gDisableLOD", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableLOD"), 0)) { lod = 0; } diff --git a/soh/src/code/z_frame_advance.c b/soh/src/code/z_frame_advance.c index e48bd0c35..6fcd76ae7 100644 --- a/soh/src/code/z_frame_advance.c +++ b/soh/src/code/z_frame_advance.c @@ -18,10 +18,10 @@ s32 FrameAdvance_Update(FrameAdvanceContext* frameAdvCtx, Input* input) { frameAdvCtx->enabled = !frameAdvCtx->enabled; } - if (!frameAdvCtx->enabled || CVarGetInteger("gFrameAdvance", 0) || (CHECK_BTN_ALL(input->cur.button, BTN_Z) && + if (!frameAdvCtx->enabled || CVarGetInteger(CVAR_GENERAL("FrameAdvance"), 0) || (CHECK_BTN_ALL(input->cur.button, BTN_Z) && (CHECK_BTN_ALL(input->press.button, BTN_R) || (CHECK_BTN_ALL(input->cur.button, BTN_R) && (++frameAdvCtx->timer >= 9))))) { - CVarClear("gFrameAdvance"); + CVarClear(CVAR_GENERAL("FrameAdvance")); frameAdvCtx->timer = 0; return true; } diff --git a/soh/src/code/z_kaleido_setup.c b/soh/src/code/z_kaleido_setup.c index e4001e6ce..3efbd6ade 100644 --- a/soh/src/code/z_kaleido_setup.c +++ b/soh/src/code/z_kaleido_setup.c @@ -18,13 +18,13 @@ void KaleidoSetup_Update(PlayState* play) { play->shootingGalleryStatus <= 1 && gSaveContext.magicState != MAGIC_STATE_STEP_CAPACITY && gSaveContext.magicState != MAGIC_STATE_FILL && (play->sceneNum != SCENE_BOMBCHU_BOWLING_ALLEY || !Flags_GetSwitch(play, 0x38))) { - u8 easyPauseBufferEnabled = CVarGetInteger("gCheatEasyPauseBufferEnabled", 0); - u8 easyPauseBufferTimer = CVarGetInteger("gCheatEasyPauseBufferTimer", 0); + u8 easyPauseBufferEnabled = CVarGetInteger(CVAR_CHEAT("EasyPauseBuffer"), 0); + u8 easyPauseBufferTimer = CVarGetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 0); // If start is not seen as pressed on the 2nd to last frame then we should end the easy frame advance flow if (easyPauseBufferEnabled && easyPauseBufferTimer == 2 && !CHECK_BTN_ALL(input->press.button, BTN_START)) { - CVarSetInteger("gCheatEasyPauseBufferTimer", 0); + CVarSetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 0); } if (CHECK_BTN_ALL(input->cur.button, BTN_L) && CHECK_BTN_ALL(input->press.button, BTN_CUP)) { @@ -34,14 +34,14 @@ void KaleidoSetup_Update(PlayState* play) { } else if ((CHECK_BTN_ALL(input->press.button, BTN_START) && (!easyPauseBufferEnabled || !easyPauseBufferTimer)) || (easyPauseBufferEnabled && easyPauseBufferTimer == 1)) { // Force Kaleido open when easy pause buffer reaches 0 // Remember last held buttons for pause buffer cheat (minus start so easy frame advance works) - CVarSetInteger("gCheatEasyPauseBufferLastInputs", input->cur.button & ~(BTN_START)); + CVarSetInteger(CVAR_GENERAL("CheatEasyPauseBufferLastInputs"), input->cur.button & ~(BTN_START)); gSaveContext.unk_13EE = gSaveContext.unk_13EA; if (CHECK_BTN_ALL(input->cur.button, BTN_L)) - CVarSetInteger("gPauseTriforce", 1); + CVarSetInteger(CVAR_GENERAL("PauseTriforce"), 1); else - CVarSetInteger("gPauseTriforce", 0); + CVarSetInteger(CVAR_GENERAL("PauseTriforce"), 0); WREG(16) = -175; diff --git a/soh/src/code/z_kankyo.c b/soh/src/code/z_kankyo.c index 77c7546f8..90ac9135f 100644 --- a/soh/src/code/z_kankyo.c +++ b/soh/src/code/z_kankyo.c @@ -1384,7 +1384,7 @@ void Environment_DrawSunAndMoon(PlayState* play) { color = CLAMP_MIN(color, 0.0f); scale = -15.0f * color + 25.0f; - scale *= CVarGetFloat("gCosmetics.Moon_Size", 1.0f); + scale *= CVarGetFloat(CVAR_COSMETIC("Moon.Size"), 1.0f); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); temp = -y / 80.0f; @@ -1396,8 +1396,8 @@ void Environment_DrawSunAndMoon(PlayState* play) { gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_LOAD); Gfx_SetupDL_51Opa(play->state.gfxCtx); gDPPipeSync(POLY_OPA_DISP++); - if (CVarGetInteger("gCosmetics.World_Moon.Changed", 0)) { - Color_RGB8 moonColor = CVarGetColor24("gCosmetics.World_Moon.Value", (Color_RGB8){ 0, 0, 240 }); + if (CVarGetInteger(CVAR_COSMETIC("World.Moon.Changed"), 0)) { + Color_RGB8 moonColor = CVarGetColor24(CVAR_COSMETIC("World.Moon.Value"), (Color_RGB8){ 0, 0, 240 }); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, moonColor.r, moonColor.g, moonColor.b, alpha); gDPSetEnvColor(POLY_OPA_DISP++, moonColor.r / 2, moonColor.g / 2, moonColor.b / 2, alpha); } else { diff --git a/soh/src/code/z_lib.c b/soh/src/code/z_lib.c index 820256cbb..57f1312dd 100644 --- a/soh/src/code/z_lib.c +++ b/soh/src/code/z_lib.c @@ -201,7 +201,7 @@ void func_80077D10(f32* arg0, s16* arg1, Input* input) { f32 relX = input->rel.stick_x; f32 relY = input->rel.stick_y; - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { relX = -input->rel.stick_x; } diff --git a/soh/src/code/z_lifemeter.c b/soh/src/code/z_lifemeter.c index 69cba24b4..3cb9d4715 100644 --- a/soh/src/code/z_lifemeter.c +++ b/soh/src/code/z_lifemeter.c @@ -120,20 +120,20 @@ s16 sHeartsDDEnv[2][3]; void HealthMeter_Init(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; Color_RGB8 mainColor = {HEARTS_PRIM_R, HEARTS_PRIM_G, HEARTS_PRIM_B}; - if (CVarGetInteger("gCosmetics.Consumable_Hearts.Changed", 0)) { - mainColor = CVarGetColor24("gCosmetics.Consumable_Hearts.Value", mainColor); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.Hearts.Changed"), 0)) { + mainColor = CVarGetColor24(CVAR_COSMETIC("Consumable.Hearts.Value"), mainColor); } Color_RGB8 mainBorder = {HEARTS_ENV_R, HEARTS_ENV_G, HEARTS_ENV_B}; - if (CVarGetInteger("gCosmetics.Consumable_HeartBorder.Changed", 0)) { - mainBorder = CVarGetColor24("gCosmetics.Consumable_HeartBorder.Value", mainBorder); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.HeartBorder.Changed"), 0)) { + mainBorder = CVarGetColor24(CVAR_COSMETIC("Consumable.HeartBorder.Value"), mainBorder); } Color_RGB8 ddColor = {HEARTS_DD_ENV_R, HEARTS_DD_ENV_G, HEARTS_DD_ENV_B}; - if (CVarGetInteger("gCosmetics.Consumable_DDHearts.Changed", 0)) { - ddColor = CVarGetColor24("gCosmetics.Consumable_DDHearts.Value", ddColor); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.DDHearts.Changed"), 0)) { + ddColor = CVarGetColor24(CVAR_COSMETIC("Consumable.DDHearts.Value"), ddColor); } Color_RGB8 ddBorder = {HEARTS_DD_PRIM_R, HEARTS_DD_PRIM_G, HEARTS_DD_PRIM_B}; - if (CVarGetInteger("gCosmetics.Consumable_DDHeartBorder.Changed", 0)) { - ddBorder = CVarGetColor24("gCosmetics.Consumable_DDHeartBorder.Value", ddBorder); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.DDHeartBorder.Changed"), 0)) { + ddBorder = CVarGetColor24(CVAR_COSMETIC("Consumable.DDHeartBorder.Value"), ddBorder); } interfaceCtx->unk_228 = 0x140; @@ -176,26 +176,26 @@ void HealthMeter_Update(PlayState* play) { s16 gFactor; s16 bFactor; - Top_LM_Margin = CVarGetInteger("gHUDMargin_T", 0); - Left_LM_Margin = CVarGetInteger("gHUDMargin_L", 0); - Right_LM_Margin = CVarGetInteger("gHUDMargin_R", 0); - Bottom_LM_Margin = CVarGetInteger("gHUDMargin_B", 0); + Top_LM_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.T"), 0); + Left_LM_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.L"), 0); + Right_LM_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.R"), 0); + Bottom_LM_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.B"), 0); Color_RGB8 mainColor = {HEARTS_PRIM_R, HEARTS_PRIM_G, HEARTS_PRIM_B}; - if (CVarGetInteger("gCosmetics.Consumable_Hearts.Changed", 0)) { - mainColor = CVarGetColor24("gCosmetics.Consumable_Hearts.Value", mainColor); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.Hearts.Changed"), 0)) { + mainColor = CVarGetColor24(CVAR_COSMETIC("Consumable.Hearts.Value"), mainColor); } Color_RGB8 mainBorder = {HEARTS_ENV_R, HEARTS_ENV_G, HEARTS_ENV_B}; - if (CVarGetInteger("gCosmetics.Consumable_HeartBorder.Changed", 0)) { - mainBorder = CVarGetColor24("gCosmetics.Consumable_HeartBorder.Value", mainBorder); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.HeartBorder.Changed"), 0)) { + mainBorder = CVarGetColor24(CVAR_COSMETIC("Consumable.HeartBorder.Value"), mainBorder); } Color_RGB8 ddColor = {HEARTS_DD_ENV_R, HEARTS_DD_ENV_G, HEARTS_DD_ENV_B}; - if (CVarGetInteger("gCosmetics.Consumable_DDHearts.Changed", 0)) { - ddColor = CVarGetColor24("gCosmetics.Consumable_DDHearts.Value", ddColor); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.DDHearts.Changed"), 0)) { + ddColor = CVarGetColor24(CVAR_COSMETIC("Consumable.DDHearts.Value"), ddColor); } Color_RGB8 ddBorder = {HEARTS_DD_PRIM_R, HEARTS_DD_PRIM_G, HEARTS_DD_PRIM_B}; - if (CVarGetInteger("gCosmetics.Consumable_DDHeartBorder.Changed", 0)) { - ddBorder = CVarGetColor24("gCosmetics.Consumable_DDHeartBorder.Value", ddBorder); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.DDHeartBorder.Changed"), 0)) { + ddBorder = CVarGetColor24(CVAR_COSMETIC("Consumable.DDHeartBorder.Value"), ddBorder); } if (interfaceCtx->unk_200 != 0) { @@ -336,20 +336,20 @@ static void* sHeartDDTextures[] = { s16 getHealthMeterXOffset() { s16 X_Margins; - if (CVarGetInteger("gHeartsUseMargins", 0) != 0) + if (CVarGetInteger(CVAR_COSMETIC("HUD.Hearts.UseMargins"), 0) != 0) X_Margins = Left_LM_Margin; else X_Margins = 0; - if (CVarGetInteger("gHeartsCountPosType", 0) != 0) { - if (CVarGetInteger("gHeartsCountPosType", 0) == 1) {//Anchor Left - return OTRGetDimensionFromLeftEdge(CVarGetInteger("gHeartsCountPosX", 0)+X_Margins+70.0f); - } else if (CVarGetInteger("gHeartsCountPosType", 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) == 1) {//Anchor Left + return OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosX"), 0)+X_Margins+70.0f); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) == 2) {//Anchor Right X_Margins = Right_LM_Margin; - return OTRGetDimensionFromRightEdge(CVarGetInteger("gHeartsCountPosX", 0)+X_Margins+70.0f); - } else if (CVarGetInteger("gHeartsCountPosType", 0) == 3) {//Anchor None - return CVarGetInteger("gHeartsCountPosX", 0)+70.0f;; - } else if (CVarGetInteger("gHeartsCountPosType", 0) == 4) {//Hidden + return OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosX"), 0)+X_Margins+70.0f); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) == 3) {//Anchor None + return CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosX"), 0)+70.0f;; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) == 4) {//Hidden return -9999; } } else { @@ -359,15 +359,15 @@ s16 getHealthMeterXOffset() { s16 getHealthMeterYOffset() { s16 Y_Margins; - if (CVarGetInteger("gHeartsUseMargins", 0) != 0) + if (CVarGetInteger(CVAR_COSMETIC("HUD.Hearts.UseMargins"), 0) != 0) Y_Margins = (Top_LM_Margin*-1); else Y_Margins = 0; f32 HeartsScale = 0.7f; - if (CVarGetInteger("gHeartsCountPosType", 0) != 0) { - HeartsScale = CVarGetFloat("gHeartsCountScale", 0.7f); - return CVarGetInteger("gHeartsCountPosY", 0)+Y_Margins+(HeartsScale*15); + if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) != 0) { + HeartsScale = CVarGetFloat(CVAR_COSMETIC("HUD.HeartsCount.Scale"), 0.7f); + return CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosY"), 0)+Y_Margins+(HeartsScale*15); } else { return 0.0f+Y_Margins; } @@ -397,8 +397,8 @@ void HealthMeter_Draw(PlayState* play) { u8* curBgImgLoaded = NULL; s32 ddHeartCountMinusOne = gSaveContext.isDoubleDefenseAcquired ? totalHeartCount - 1 : -1; f32 HeartsScale = 0.7f; - if (CVarGetInteger("gHeartsCountPosType", 0) != 0) { - HeartsScale = CVarGetFloat("gHeartsCountScale", 0.7f); + if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) != 0) { + HeartsScale = CVarGetFloat(CVAR_COSMETIC("HUD.HeartsCount.Scale"), 0.7f); } static u32 epoch = 0; epoch++; @@ -413,7 +413,7 @@ void HealthMeter_Draw(PlayState* play) { /* s16 X_Margins; s16 Y_Margins; - if (CVarGetInteger("gHeartsUseMargins", 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Hearts.UseMargins"), 0) != 0) { X_Margins = Left_LM_Margin; Y_Margins = (Top_LM_Margin*-1); } else { @@ -422,16 +422,16 @@ void HealthMeter_Draw(PlayState* play) { } s16 PosX_original = OTRGetDimensionFromLeftEdge(0.0f)+X_Margins; s16 PosY_original = 0.0f+Y_Margins; - if (CVarGetInteger("gHeartsCountPosType", 0) != 0) { - offsetY = CVarGetInteger("gHeartsCountPosY", 0)+Y_Margins+(HeartsScale*15); - if (CVarGetInteger("gHeartsCountPosType", 0) == 1) {//Anchor Left - offsetX = OTRGetDimensionFromLeftEdge(CVarGetInteger("gHeartsCountPosX", 0)+X_Margins+70.0f); - } else if (CVarGetInteger("gHeartsCountPosType", 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) != 0) { + offsetY = CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosY"), 0)+Y_Margins+(HeartsScale*15); + if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) == 1) {//Anchor Left + offsetX = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosX"), 0)+X_Margins+70.0f); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) == 2) {//Anchor Right X_Margins = Right_LM_Margin; - offsetX = OTRGetDimensionFromRightEdge(CVarGetInteger("gHeartsCountPosX", 0)+X_Margins+70.0f); - } else if (CVarGetInteger("gHeartsCountPosType", 0) == 3) {//Anchor None - offsetX = CVarGetInteger("gHeartsCountPosX", 0)+70.0f; - } else if (CVarGetInteger("gHeartsCountPosType", 0) == 4) {//Hidden + offsetX = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosX"), 0)+X_Margins+70.0f); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) == 3) {//Anchor None + offsetX = CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosX"), 0)+70.0f; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.HeartsCount.PosType"), 0) == 4) {//Hidden offsetX = -9999; } } else { @@ -602,7 +602,7 @@ void HealthMeter_Draw(PlayState* play) { { Mtx* matrix = Graph_Alloc(gfxCtx, sizeof(Mtx)); - if (CVarGetInteger("gNoHUDHeartAnimation", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NoHUDHeartAnimation"), 0)) { Matrix_SetTranslateScaleMtx2(matrix, HeartsScale, // Scale X HeartsScale, // Scale Y @@ -626,7 +626,7 @@ void HealthMeter_Draw(PlayState* play) { } offsetX += 10.0f; - s32 lineLength = CVarGetInteger("gHeartsLineLength", 10); + s32 lineLength = CVarGetInteger(CVAR_COSMETIC("HUD.Hearts.LineLength"), 10); if (lineLength != 0 && (i+1)%lineLength == 0) { offsetX = PosX_anchor; offsetY += 10.0f; @@ -646,7 +646,7 @@ void HealthMeter_HandleCriticalAlarm(PlayState* play) { if (interfaceCtx->unk_22A <= 0) { interfaceCtx->unk_22A = 0; interfaceCtx->unk_22C = 0; - if (CVarGetInteger("gLowHpAlarm", 0) == 0 && !Player_InCsMode(play) && (play->pauseCtx.state == 0) && + if (CVarGetInteger(CVAR_ENHANCEMENT("LowHpAlarm"), 0) == 0 && !Player_InCsMode(play) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && HealthMeter_IsCritical() && !Play_InCsMode(play)) { func_80078884(NA_SE_SY_HITPOINT_ALARM); } diff --git a/soh/src/code/z_map_exp.c b/soh/src/code/z_map_exp.c index 5ed13f810..e05c2a6b2 100644 --- a/soh/src/code/z_map_exp.c +++ b/soh/src/code/z_map_exp.c @@ -606,17 +606,17 @@ void Minimap_DrawCompassIcons(PlayState* play) { Player* player = GET_PLAYER(play); s16 tempX, tempZ; Color_RGB8 lastEntranceColor = { 200, 0, 0 }; - if (CVarGetInteger("gCosmetics.Hud_MinimapEntrance.Changed", 0)) { - lastEntranceColor = CVarGetColor24("gCosmetics.Hud_MinimapEntrance.Value", lastEntranceColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.MinimapEntrance.Changed"), 0)) { + lastEntranceColor = CVarGetColor24(CVAR_COSMETIC("HUD.MinimapEntrance.Value"), lastEntranceColor); } Color_RGB8 currentPositionColor = { 200, 255, 0 }; - if (CVarGetInteger("gCosmetics.Hud_MinimapPosition.Changed", 0)) { - currentPositionColor = CVarGetColor24("gCosmetics.Hud_MinimapPosition.Value", currentPositionColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.MinimapPosition.Changed"), 0)) { + currentPositionColor = CVarGetColor24(CVAR_COSMETIC("HUD.MinimapPosition.Value"), currentPositionColor); } s16 X_Margins_Minimap; s16 Y_Margins_Minimap; - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) { - if (CVarGetInteger("gMinimapPosType", 0) == 0) {X_Margins_Minimap = Right_MM_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 0) {X_Margins_Minimap = Right_MM_Margin;}; Y_Margins_Minimap = Bottom_MM_Margin; } else { X_Margins_Minimap = 0; @@ -652,32 +652,32 @@ void Minimap_DrawCompassIcons(PlayState* play) { tempX = player->actor.world.pos.x; tempZ = player->actor.world.pos.z; - tempX /= R_COMPASS_SCALE_X * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1); + tempX /= R_COMPASS_SCALE_X * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1); tempZ /= R_COMPASS_SCALE_Y; - s16 tempXOffset = R_COMPASS_OFFSET_X + (CVarGetInteger("gMirroredWorld", 0) ? mirrorOffset : 0); - if (CVarGetInteger("gMinimapPosType", 0) != 0) { - if (CVarGetInteger("gMinimapPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; + s16 tempXOffset = R_COMPASS_OFFSET_X + (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? mirrorOffset : 0); + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; Matrix_Translate( - OTRGetDimensionFromLeftEdge((tempXOffset + (X_Margins_Minimap*10) + tempX + (CVarGetInteger("gMinimapPosX", 0)*10)) / 10.0f), - (R_COMPASS_OFFSET_Y + ((Y_Margins_Minimap*10)*-1) - tempZ + ((CVarGetInteger("gMinimapPosY", 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); - } else if (CVarGetInteger("gMinimapPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; + OTRGetDimensionFromLeftEdge((tempXOffset + (X_Margins_Minimap*10) + tempX + (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)*10)) / 10.0f), + (R_COMPASS_OFFSET_Y + ((Y_Margins_Minimap*10)*-1) - tempZ + ((CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosY"), 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; Matrix_Translate( - OTRGetDimensionFromRightEdge((tempXOffset + (X_Margins_Minimap*10) + tempX + (CVarGetInteger("gMinimapPosX", 0)*10)) / 10.0f), - (R_COMPASS_OFFSET_Y +((Y_Margins_Minimap*10)*-1) - tempZ + ((CVarGetInteger("gMinimapPosY", 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); - } else if (CVarGetInteger("gMinimapPosType", 0) == 3) {//Anchor None + OTRGetDimensionFromRightEdge((tempXOffset + (X_Margins_Minimap*10) + tempX + (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)*10)) / 10.0f), + (R_COMPASS_OFFSET_Y +((Y_Margins_Minimap*10)*-1) - tempZ + ((CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosY"), 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 3) {//Anchor None Matrix_Translate( - (tempXOffset + tempX + (CVarGetInteger("gMinimapPosX", 0)*10) / 10.0f), - (R_COMPASS_OFFSET_Y + ((Y_Margins_Minimap*10)*-1) - tempZ + ((CVarGetInteger("gMinimapPosY", 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); + (tempXOffset + tempX + (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)*10) / 10.0f), + (R_COMPASS_OFFSET_Y + ((Y_Margins_Minimap*10)*-1) - tempZ + ((CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosY"), 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); } } else { Matrix_Translate(OTRGetDimensionFromRightEdge((tempXOffset+(X_Margins_Minimap*10) + tempX) / 10.0f), (R_COMPASS_OFFSET_Y+((Y_Margins_Minimap*10)*-1) - tempZ) / 10.0f, 0.0f, MTXMODE_NEW); } Matrix_Scale(0.4f, 0.4f, 0.4f, MTXMODE_APPLY); Matrix_RotateX(-1.6f, MTXMODE_APPLY); - tempX = ((0x7FFF - player->actor.shape.rot.y) / 0x400) * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1); + tempX = ((0x7FFF - player->actor.shape.rot.y) / 0x400) * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1); Matrix_RotateY(tempX / 10.0f, MTXMODE_APPLY); gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -688,30 +688,30 @@ void Minimap_DrawCompassIcons(PlayState* play) { //Player map entry (red arrow) tempX = sPlayerInitialPosX; tempZ = sPlayerInitialPosZ; - tempX /= R_COMPASS_SCALE_X * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1); + tempX /= R_COMPASS_SCALE_X * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1); tempZ /= R_COMPASS_SCALE_Y; - if (CVarGetInteger("gMinimapPosType", 0) != 0) { - if (CVarGetInteger("gMinimapPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; Matrix_Translate( - OTRGetDimensionFromLeftEdge((tempXOffset + (X_Margins_Minimap*10) + tempX + (CVarGetInteger("gMinimapPosX", 0)*10)) / 10.0f), - (R_COMPASS_OFFSET_Y + ((Y_Margins_Minimap*10)*-1) - tempZ + ((CVarGetInteger("gMinimapPosY", 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); - } else if (CVarGetInteger("gMinimapPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; + OTRGetDimensionFromLeftEdge((tempXOffset + (X_Margins_Minimap*10) + tempX + (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)*10)) / 10.0f), + (R_COMPASS_OFFSET_Y + ((Y_Margins_Minimap*10)*-1) - tempZ + ((CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosY"), 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; Matrix_Translate( - OTRGetDimensionFromRightEdge((tempXOffset + (X_Margins_Minimap*10) + tempX + (CVarGetInteger("gMinimapPosX", 0)*10)) / 10.0f), - (R_COMPASS_OFFSET_Y +((Y_Margins_Minimap*10)*-1) - tempZ + ((CVarGetInteger("gMinimapPosY", 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); - } else if (CVarGetInteger("gMinimapPosType", 0) == 3) {//Anchor None + OTRGetDimensionFromRightEdge((tempXOffset + (X_Margins_Minimap*10) + tempX + (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)*10)) / 10.0f), + (R_COMPASS_OFFSET_Y +((Y_Margins_Minimap*10)*-1) - tempZ + ((CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosY"), 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 3) {//Anchor None Matrix_Translate( - (tempXOffset + tempX + (CVarGetInteger("gMinimapPosX", 0)*10) / 10.0f), - (R_COMPASS_OFFSET_Y - tempZ + ((CVarGetInteger("gMinimapPosY", 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); + (tempXOffset + tempX + (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)*10) / 10.0f), + (R_COMPASS_OFFSET_Y - tempZ + ((CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosY"), 0)*10)*-1)) / 10.0f, 0.0f, MTXMODE_NEW); } } else { Matrix_Translate(OTRGetDimensionFromRightEdge((tempXOffset+(X_Margins_Minimap*10) + tempX) / 10.0f), (R_COMPASS_OFFSET_Y+((Y_Margins_Minimap*10)*-1) - tempZ) / 10.0f, 0.0f, MTXMODE_NEW); } Matrix_Scale(VREG(9) / 100.0f, VREG(9) / 100.0f, VREG(9) / 100.0f, MTXMODE_APPLY); Matrix_RotateX(VREG(52) / 10.0f, MTXMODE_APPLY); - Matrix_RotateY((sPlayerInitialDirection * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1)) / 10.0f, MTXMODE_APPLY); + Matrix_RotateY((sPlayerInitialDirection * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1)) / 10.0f, MTXMODE_APPLY); gSPMatrix(OVERLAY_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -727,23 +727,23 @@ void Minimap_Draw(PlayState* play) { InterfaceContext* interfaceCtx = &play->interfaceCtx; s32 mapIndex = gSaveContext.mapIndex; Color_RGB8 minimapColor = {0, 255, 255}; - if (CVarGetInteger("gCosmetics.Hud_Minimap.Changed", 0)) { - minimapColor = CVarGetColor24("gCosmetics.Hud_Minimap.Value", minimapColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.Changed"), 0)) { + minimapColor = CVarGetColor24(CVAR_COSMETIC("HUD.Minimap.Value"), minimapColor); } OPEN_DISPS(play->state.gfxCtx); // If any of these CVars are enabled, disable toggling the minimap with L, unless gEnableMapToggle is set bool enableMapToggle = - !(CVarGetInteger("gDebugEnabled", 0) || CVarGetInteger("gMoonJumpOnL", 0) || CVarGetInteger("gTurboOnL", 0)) || - CVarGetInteger("gEnableMapToggle", 0); + !(CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) || CVarGetInteger(CVAR_CHEAT("MoonJumpOnL"), 0)) || + CVarGetInteger(CVAR_DEVELOPER_TOOLS("EnableMapToggle"), 0); if (play->pauseCtx.state < 4) { //Minimap margins s16 X_Margins_Minimap; s16 Y_Margins_Minimap; - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) { - if (CVarGetInteger("gMinimapPosType", 0) == 0) {X_Margins_Minimap = Right_MM_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 0) {X_Margins_Minimap = Right_MM_Margin;}; Y_Margins_Minimap = Bottom_MM_Margin; } else { X_Margins_Minimap = 0; @@ -761,7 +761,7 @@ void Minimap_Draw(PlayState* play) { case SCENE_SHADOW_TEMPLE: case SCENE_BOTTOM_OF_THE_WELL: case SCENE_ICE_CAVERN: - if (!R_MINIMAP_DISABLED && CVarGetInteger("gMinimapPosType", 0) != 4) { // Not Hidden + if (!R_MINIMAP_DISABLED && CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) != 4) { // Not Hidden Gfx_SetupDL_39Overlay(play->state.gfxCtx); gDPSetCombineLERP(OVERLAY_DISP++, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0, 1, 0, PRIMITIVE, 0, TEXEL0, 0, PRIMITIVE, 0); @@ -769,28 +769,28 @@ void Minimap_Draw(PlayState* play) { if (CHECK_DUNGEON_ITEM(DUNGEON_MAP, mapIndex)) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, minimapColor.r, minimapColor.g, minimapColor.b, interfaceCtx->minimapAlpha); - u8 mirrorMode = CVarGetInteger("gMirroredWorld", 0) ? G_TX_MIRROR : G_TX_NOMIRROR; + u8 mirrorMode = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? G_TX_MIRROR : G_TX_NOMIRROR; gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->mapSegmentName[0], G_IM_FMT_I, 96, 85, 0, mirrorMode | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); s16 dgnMiniMapX = OTRGetRectDimensionFromRightEdge(R_DGN_MINIMAP_X + X_Margins_Minimap); s16 dgnMiniMapY = R_DGN_MINIMAP_Y + Y_Margins_Minimap; - if (CVarGetInteger("gMinimapPosType", 0) != 0) { - dgnMiniMapY = R_DGN_MINIMAP_Y+CVarGetInteger("gMinimapPosY", 0)+Y_Margins_Minimap; - if (CVarGetInteger("gMinimapPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; - dgnMiniMapX = OTRGetDimensionFromLeftEdge(R_DGN_MINIMAP_X+CVarGetInteger("gMinimapPosX", 0)+X_Margins_Minimap); - } else if (CVarGetInteger("gMinimapPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; - dgnMiniMapX = OTRGetDimensionFromRightEdge(R_DGN_MINIMAP_X+CVarGetInteger("gMinimapPosX", 0)+X_Margins_Minimap); - } else if (CVarGetInteger("gMinimapPosType", 0) == 3) {//Anchor None - dgnMiniMapX = CVarGetInteger("gMinimapPosX", 0); + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) != 0) { + dgnMiniMapY = R_DGN_MINIMAP_Y+CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosY"), 0)+Y_Margins_Minimap; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; + dgnMiniMapX = OTRGetDimensionFromLeftEdge(R_DGN_MINIMAP_X+CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)+X_Margins_Minimap); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; + dgnMiniMapX = OTRGetDimensionFromRightEdge(R_DGN_MINIMAP_X+CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)+X_Margins_Minimap); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 3) {//Anchor None + dgnMiniMapX = CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0); } } s32 sValue = 0; - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { // Flip the minimap on the x-axis (s-axis) by setting s to the textures mirror boundary sValue = 96 << 5; } @@ -839,13 +839,13 @@ void Minimap_Draw(PlayState* play) { case SCENE_GORON_CITY: case SCENE_LON_LON_RANCH: case SCENE_OUTSIDE_GANONS_CASTLE: - if (!R_MINIMAP_DISABLED && CVarGetInteger("gMinimapPosType", 0) != 4) { // Not Hidden + if (!R_MINIMAP_DISABLED && CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) != 4) { // Not Hidden Gfx_SetupDL_39Overlay(play->state.gfxCtx); gDPSetCombineMode(OVERLAY_DISP++, G_CC_MODULATEIA_PRIM, G_CC_MODULATEIA_PRIM); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, minimapColor.r, minimapColor.g, minimapColor.b, interfaceCtx->minimapAlpha); - u8 mirrorMode = CVarGetInteger("gMirroredWorld", 0) ? G_TX_MIRROR : G_TX_NOMIRROR; + u8 mirrorMode = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? G_TX_MIRROR : G_TX_NOMIRROR; gDPLoadTextureBlock_4b(OVERLAY_DISP++, interfaceCtx->mapSegmentName[0], G_IM_FMT_IA, gMapData->owMinimapWidth[mapIndex], gMapData->owMinimapHeight[mapIndex], 0, mirrorMode | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, @@ -853,21 +853,21 @@ void Minimap_Draw(PlayState* play) { s16 oWMiniMapX = OTRGetRectDimensionFromRightEdge(R_OW_MINIMAP_X + X_Margins_Minimap); s16 oWMiniMapY = R_OW_MINIMAP_Y + Y_Margins_Minimap; - if (CVarGetInteger("gMinimapPosType", 0) != 0) { - oWMiniMapY = R_OW_MINIMAP_Y+CVarGetInteger("gMinimapPosY", 0)+Y_Margins_Minimap; - if (CVarGetInteger("gMinimapPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; - oWMiniMapX = OTRGetDimensionFromLeftEdge(R_OW_MINIMAP_X+CVarGetInteger("gMinimapPosX", 0)+X_Margins_Minimap); - } else if (CVarGetInteger("gMinimapPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; - oWMiniMapX = OTRGetDimensionFromRightEdge(R_OW_MINIMAP_X+CVarGetInteger("gMinimapPosX", 0)+X_Margins_Minimap); - } else if (CVarGetInteger("gMinimapPosType", 0) == 3) {//Anchor None - oWMiniMapX = CVarGetInteger("gMinimapPosX", 0); + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) != 0) { + oWMiniMapY = R_OW_MINIMAP_Y+CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosY"), 0)+Y_Margins_Minimap; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; + oWMiniMapX = OTRGetDimensionFromLeftEdge(R_OW_MINIMAP_X+CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)+X_Margins_Minimap); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; + oWMiniMapX = OTRGetDimensionFromRightEdge(R_OW_MINIMAP_X+CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)+X_Margins_Minimap); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 3) {//Anchor None + oWMiniMapX = CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0); } } s32 sValue = 0; - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { // Flip the minimap on the x-axis (s-axis) by setting s to the textures mirror boundary sValue = gMapData->owMinimapWidth[mapIndex] << 5; } @@ -890,7 +890,7 @@ void Minimap_Draw(PlayState* play) { // Then duplicate that and right-align the texture (extra 2 pixels are due to the texture being a 6px left-aligned in a 8px tex) s16 distFromCenter = (R_OW_MINIMAP_X + (gMapData->owMinimapWidth[mapIndex] / 2)) - (origX + (iconSize / 2)); s16 mirrorOffset = distFromCenter * 2 + (iconSize / 2) - 2; - s16 newX = origX + (CVarGetInteger("gMirroredWorld", 0) ? mirrorOffset : 0); + s16 newX = origX + (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? mirrorOffset : 0); // The game authentically uses larger negative values for the entrance icon Y pos value. Normally only the first 12 bits // would be read when the final value is passed into `gSPTextureRectangle`, but our cosmetic hud placements requires using @@ -901,16 +901,16 @@ void Minimap_Draw(PlayState* play) { s16 entranceX = OTRGetRectDimensionFromRightEdge(newX + X_Margins_Minimap); s16 entranceY = newY + Y_Margins_Minimap; - if (CVarGetInteger("gMinimapPosType", 0) != 0) { - entranceY = newY + CVarGetInteger("gMinimapPosY", 0) + Y_Margins_Minimap; - if (CVarGetInteger("gMinimapPosType", 0) == 1) { // Anchor Left - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; - entranceX = OTRGetRectDimensionFromLeftEdge(newX + X_Margins_Minimap + CVarGetInteger("gMinimapPosX", 0)); - } else if (CVarGetInteger("gMinimapPosType", 0) == 2) { // Anchor Right - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; - entranceX = OTRGetRectDimensionFromRightEdge(newX + X_Margins_Minimap + CVarGetInteger("gMinimapPosX", 0)); - } else if (CVarGetInteger("gMinimapPosType", 0) == 3) { // Anchor None - entranceX = newX + X_Margins_Minimap + CVarGetInteger("gMinimapPosX", 0); + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) != 0) { + entranceY = newY + CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosY"), 0) + Y_Margins_Minimap; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 1) { // Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; + entranceX = OTRGetRectDimensionFromLeftEdge(newX + X_Margins_Minimap + CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 2) { // Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; + entranceX = OTRGetRectDimensionFromRightEdge(newX + X_Margins_Minimap + CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 3) { // Anchor None + entranceX = newX + X_Margins_Minimap + CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0); } } @@ -918,14 +918,14 @@ void Minimap_Draw(PlayState* play) { // or hide them entirely if the fix is applied if (gMapData->owEntranceIconPosY[sEntranceIconMapIndex] == 0) { entranceY = 0; - entranceX = CVarGetInteger("gFixDungeonMinimapIcon", 0) ? -9999 : OTRGetRectDimensionFromLeftEdge(0); + entranceX = CVarGetInteger(CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), 0) ? -9999 : OTRGetRectDimensionFromLeftEdge(0); } //! @bug UB: sEntranceIconMapIndex can be up to 23 and is accessing owEntranceFlag which is size 20 if ((gMapData->owEntranceFlag[sEntranceIconMapIndex] == 0xFFFF) || ((gMapData->owEntranceFlag[sEntranceIconMapIndex] != 0xFFFF) && ((gSaveContext.infTable[26] & gBitFlags[gMapData->owEntranceFlag[mapIndex]]) || - CVarGetInteger("gAlwaysShowDungeonMinimapIcon", 0)))) { + CVarGetInteger(CVAR_ENHANCEMENT("AlwaysShowDungeonMinimapIcon"), 0)))) { gDPLoadTextureBlock(OVERLAY_DISP++, gMapDungeonEntranceIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, iconSize, iconSize, 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); @@ -934,25 +934,25 @@ void Minimap_Draw(PlayState* play) { } } - s16 origX = CVarGetInteger("gMirroredWorld", 0) ? 256 : 270; + s16 origX = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? 256 : 270; s16 entranceX = OTRGetRectDimensionFromRightEdge(origX + X_Margins_Minimap); s16 entranceY = 154 + Y_Margins_Minimap; - if (CVarGetInteger("gMinimapPosType", 0) != 0) { - entranceY = 154 + Y_Margins_Minimap + CVarGetInteger("gMinimapPosY", 0); - if (CVarGetInteger("gMinimapPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; - entranceX = OTRGetRectDimensionFromLeftEdge(origX + X_Margins_Minimap + CVarGetInteger("gMinimapPosX", 0)); - } else if (CVarGetInteger("gMinimapPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; - entranceX = OTRGetRectDimensionFromRightEdge(origX + X_Margins_Minimap + CVarGetInteger("gMinimapPosX", 0)); - } else if (CVarGetInteger("gMinimapPosType", 0) == 3) {//Anchor None - entranceX = origX + X_Margins_Minimap + CVarGetInteger("gMinimapPosX", 0); + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) != 0) { + entranceY = 154 + Y_Margins_Minimap + CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosY"), 0); + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Left_MM_Margin;}; + entranceX = OTRGetRectDimensionFromLeftEdge(origX + X_Margins_Minimap + CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap = Right_MM_Margin;}; + entranceX = OTRGetRectDimensionFromRightEdge(origX + X_Margins_Minimap + CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 3) {//Anchor None + entranceX = origX + X_Margins_Minimap + CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0); } } // Ice Cavern entrance icon if ((play->sceneNum == SCENE_ZORAS_FOUNTAIN) && ((gSaveContext.infTable[26] & gBitFlags[9]) || - CVarGetInteger("gAlwaysShowDungeonMinimapIcon", 0))) { + CVarGetInteger(CVAR_ENHANCEMENT("AlwaysShowDungeonMinimapIcon"), 0))) { gDPLoadTextureBlock(OVERLAY_DISP++, gMapDungeonEntranceIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b, iconSize, iconSize, 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); @@ -992,10 +992,10 @@ void Map_Update(PlayState* play) { s16 floor; s16 i; - Top_MM_Margin = CVarGetInteger("gHUDMargin_T", 0); - Left_MM_Margin = CVarGetInteger("gHUDMargin_L", 0); - Right_MM_Margin = CVarGetInteger("gHUDMargin_R", 0); - Bottom_MM_Margin = CVarGetInteger("gHUDMargin_B", 0); + Top_MM_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.T"), 0); + Left_MM_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.L"), 0); + Right_MM_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.R"), 0); + Bottom_MM_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.B"), 0); if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { switch (play->sceneNum) { diff --git a/soh/src/code/z_map_mark.c b/soh/src/code/z_map_mark.c index 212fad139..df8ef4464 100644 --- a/soh/src/code/z_map_mark.c +++ b/soh/src/code/z_map_mark.c @@ -113,15 +113,15 @@ void MapMark_DrawForDungeon(PlayState* play) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, interfaceCtx->minimapAlpha); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, interfaceCtx->minimapAlpha); - s32 Top_MC_Margin = CVarGetInteger("gHUDMargin_T", 0); - s32 Left_MC_Margin = CVarGetInteger("gHUDMargin_L", 0); - s32 Right_MC_Margin = CVarGetInteger("gHUDMargin_R", 0); - s32 Bottom_MC_Margin = CVarGetInteger("gHUDMargin_B", 0); + s32 Top_MC_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.T"), 0); + s32 Left_MC_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.L"), 0); + s32 Right_MC_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.R"), 0); + s32 Bottom_MC_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.B"), 0); s32 X_Margins_Minimap_ic; s32 Y_Margins_Minimap_ic; - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) { - if (CVarGetInteger("gMinimapPosType", 0) == 0) {X_Margins_Minimap_ic = Right_MC_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 0) {X_Margins_Minimap_ic = Right_MC_Margin;}; Y_Margins_Minimap_ic = Bottom_MC_Margin; } else { X_Margins_Minimap_ic = 0; @@ -141,29 +141,29 @@ void MapMark_DrawForDungeon(PlayState* play) { // The original mark point X originates from the left edge of the map // For mirror mode, we compute the new mark point X by subtracting it from the right side of the // dungeon map and the textures width - s16 markPointX = CVarGetInteger("gMirroredWorld", 0) ? 96 - markPoint->x - width : markPoint->x; + s16 markPointX = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? 96 - markPoint->x - width : markPoint->x; //Minimap chest / boss icon const s32 PosX_Minimap_ori = GREG(94) + OTRGetRectDimensionFromRightEdge(markPointX+X_Margins_Minimap_ic) + 204; const s32 PosY_Minimap_ori = GREG(95) + markPoint->y + Y_Margins_Minimap_ic + 140; - if (CVarGetInteger("gMinimapPosType", 0) != 0) { - rectTop = (markPoint->y + Y_Margins_Minimap_ic + 140 + CVarGetInteger("gMinimapPosY", 0)); - if (CVarGetInteger("gMinimapPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap_ic = Left_MC_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) != 0) { + rectTop = (markPoint->y + Y_Margins_Minimap_ic + 140 + CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosY"), 0)); + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap_ic = Left_MC_Margin;}; if (play->sceneNum == SCENE_DEKU_TREE || play->sceneNum == SCENE_DODONGOS_CAVERN || play->sceneNum == SCENE_JABU_JABU || play->sceneNum == SCENE_FOREST_TEMPLE || play->sceneNum == SCENE_FIRE_TEMPLE || play->sceneNum == SCENE_WATER_TEMPLE || play->sceneNum == SCENE_SPIRIT_TEMPLE || play->sceneNum == SCENE_SHADOW_TEMPLE || play->sceneNum == SCENE_BOTTOM_OF_THE_WELL || play->sceneNum == SCENE_ICE_CAVERN) { - rectLeft = OTRGetRectDimensionFromLeftEdge(markPointX+CVarGetInteger("gMinimapPosX", 0)+204+X_Margins_Minimap_ic); + rectLeft = OTRGetRectDimensionFromLeftEdge(markPointX+CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)+204+X_Margins_Minimap_ic); } else { - rectLeft = OTRGetRectDimensionFromLeftEdge(markPointX+CVarGetInteger("gMinimapPosX", 0)+204+X_Margins_Minimap_ic); + rectLeft = OTRGetRectDimensionFromLeftEdge(markPointX+CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)+204+X_Margins_Minimap_ic); } - } else if (CVarGetInteger("gMinimapPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gMinimapUseMargins", 0) != 0) {X_Margins_Minimap_ic = Right_MC_Margin;}; - rectLeft = OTRGetRectDimensionFromRightEdge(markPointX+CVarGetInteger("gMinimapPosX", 0)+204+X_Margins_Minimap_ic); - } else if (CVarGetInteger("gMinimapPosType", 0) == 3) {//Anchor None - rectLeft = markPointX+CVarGetInteger("gMinimapPosX", 0)+204+X_Margins_Minimap_ic; - } else if (CVarGetInteger("gMinimapPosType", 0) == 4) {//Hidden + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.UseMargins"), 0) != 0) {X_Margins_Minimap_ic = Right_MC_Margin;}; + rectLeft = OTRGetRectDimensionFromRightEdge(markPointX+CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)+204+X_Margins_Minimap_ic); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 3) {//Anchor None + rectLeft = markPointX+CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosX"), 0)+204+X_Margins_Minimap_ic; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Minimap.PosType"), 0) == 4) {//Hidden rectLeft = -9999; } } else { diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 015d7c4b0..4847bb47e 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -99,30 +99,30 @@ void Message_ResetOcarinaNoteState(void) { sOcarinaNoteABtnEnv = (Color_RGB8){ 10, 10, 10 }; sOcarinaNoteCBtnPrim = (Color_RGB8){ 255, 255, 50 }; sOcarinaNoteCBtnEnv = (Color_RGB8){ 10, 10, 10 }; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - sOcarinaNoteABtnPrim = CVarGetColor24("gCosmetics.Hud_AButton.Value", sOcarinaNoteABtnPrim); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + sOcarinaNoteABtnPrim = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), sOcarinaNoteABtnPrim); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { sOcarinaNoteABtnPrim = (Color_RGB8){ 80, 255, 150 }; } - if (CVarGetInteger("gCosmetics.Hud_CButtons.Changed", 0)) { - sOcarinaNoteCBtnPrim = CVarGetColor24("gCosmetics.Hud_CButtons.Value", sOcarinaNoteCBtnPrim); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CButtons.Changed"), 0)) { + sOcarinaNoteCBtnPrim = CVarGetColor24(CVAR_COSMETIC("HUD.CButtons.Value"), sOcarinaNoteCBtnPrim); } sOcarinaNoteCUpBtnPrim = sOcarinaNoteCBtnPrim; sOcarinaNoteCDownBtnPrim = sOcarinaNoteCBtnPrim; sOcarinaNoteCLeftBtnPrim = sOcarinaNoteCBtnPrim; sOcarinaNoteCRightBtnPrim = sOcarinaNoteCBtnPrim; - if (CVarGetInteger("gCosmetics.Hud_CUpButton.Changed", 0)) { - sOcarinaNoteCUpBtnPrim = CVarGetColor24("gCosmetics.Hud_CUpButton.Value", sOcarinaNoteCUpBtnPrim); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.Changed"), 0)) { + sOcarinaNoteCUpBtnPrim = CVarGetColor24(CVAR_COSMETIC("HUD.CUpButton.Value"), sOcarinaNoteCUpBtnPrim); } - if (CVarGetInteger("gCosmetics.Hud_CDownButton.Changed", 0)) { - sOcarinaNoteCDownBtnPrim = CVarGetColor24("gCosmetics.Hud_CDownButton.Value", sOcarinaNoteCDownBtnPrim); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.Changed"), 0)) { + sOcarinaNoteCDownBtnPrim = CVarGetColor24(CVAR_COSMETIC("HUD.CDownButton.Value"), sOcarinaNoteCDownBtnPrim); } - if (CVarGetInteger("gCosmetics.Hud_CLeftButton.Changed", 0)) { - sOcarinaNoteCLeftBtnPrim = CVarGetColor24("gCosmetics.Hud_CLeftButton.Value", sOcarinaNoteCLeftBtnPrim); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.Changed"), 0)) { + sOcarinaNoteCLeftBtnPrim = CVarGetColor24(CVAR_COSMETIC("HUD.CLeftButton.Value"), sOcarinaNoteCLeftBtnPrim); } - if (CVarGetInteger("gCosmetics.Hud_CRightButton.Changed", 0)) { - sOcarinaNoteCRightBtnPrim = CVarGetColor24("gCosmetics.Hud_CRightButton.Value", sOcarinaNoteCRightBtnPrim); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.Changed"), 0)) { + sOcarinaNoteCRightBtnPrim = CVarGetColor24(CVAR_COSMETIC("HUD.CRightButton.Value"), sOcarinaNoteCRightBtnPrim); } } @@ -150,7 +150,7 @@ void Message_UpdateOcarinaGame(PlayState* play) { u8 Message_ShouldAdvance(PlayState* play) { Input* input = &play->state.input[0]; - bool isB_Held = CVarGetInteger("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) + bool isB_Held = CVarGetInteger(CVAR_ENHANCEMENT("SkipText"), 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) : CHECK_BTN_ALL(input->press.button, BTN_B); if (CHECK_BTN_ALL(input->press.button, BTN_A) || isB_Held || CHECK_BTN_ALL(input->press.button, BTN_CUP)) { @@ -162,7 +162,7 @@ u8 Message_ShouldAdvance(PlayState* play) { u8 Message_ShouldAdvanceSilent(PlayState* play) { Input* input = &play->state.input[0]; - bool isB_Held = CVarGetInteger("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) + bool isB_Held = CVarGetInteger(CVAR_ENHANCEMENT("SkipText"), 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) : CHECK_BTN_ALL(input->press.button, BTN_B); return CHECK_BTN_ALL(input->press.button, BTN_A) || isB_Held || CHECK_BTN_ALL(input->press.button, BTN_CUP); @@ -187,7 +187,7 @@ void Message_HandleChoiceSelection(PlayState* play, u8 numChoices) { static s16 sAnalogStickHeld = false; MessageContext* msgCtx = &play->msgCtx; Input* input = &play->state.input[0]; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); if ((input->rel.stick_y >= 30 && !sAnalogStickHeld) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DUP))) { sAnalogStickHeld = true; @@ -291,7 +291,7 @@ void Message_FindMessage(PlayState* play, u16 textId) { const char* seg; u16 bufferId = textId; // Use the better owl message if better owl is enabled - if (CVarGetInteger("gBetterOwl", 0) != 0 && (bufferId == 0x2066 || bufferId == 0x607B || + if (CVarGetInteger(CVAR_ENHANCEMENT("BetterOwl"), 0) != 0 && (bufferId == 0x2066 || bufferId == 0x607B || bufferId == 0x10C2 || bufferId == 0x10C6 || bufferId == 0x206A)) { bufferId = 0x71B3; @@ -463,14 +463,14 @@ void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) { { 0, 0, 0 }, { 0, 130, 255 }, }; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_AButton.Value", (Color_RGB8){ 50, 130, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), (Color_RGB8){ 50, 130, 255 }); sIconPrimColors[0].r = color.r - 50; sIconPrimColors[0].g = color.g - 50; sIconPrimColors[0].b = color.b - 50; sIconPrimColors[1] = color; sIconEnvColors[1] = color; - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { sIconPrimColors[0] = (Color_RGB8){ 0, 200, 80 }; sIconPrimColors[1] = (Color_RGB8){ 50, 255, 130 }; sIconEnvColors[1] = (Color_RGB8){ 50, 255, 130 }; @@ -873,7 +873,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { Message_SetTextColor(msgCtx, msgCtx->msgBufDecoded[++i] & 0xF); break; case ' ': - msgCtx->textPosX += CVarGetInteger("gTextSpacing", 6); + msgCtx->textPosX += CVarGetInteger(CVAR_ENHANCEMENT("TextSpacing"), 6); break; case MESSAGE_BOX_BREAK: if (msgCtx->msgMode == MSGMODE_TEXT_DISPLAYING) { @@ -1032,7 +1032,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { msgCtx->textDelay = msgCtx->msgBufDecoded[++i]; break; case MESSAGE_UNSKIPPABLE: - msgCtx->textUnskippable = CVarGetInteger("gSkipText", 0) != 1; + msgCtx->textUnskippable = CVarGetInteger(CVAR_ENHANCEMENT("SkipText"), 0) != 1; break; case MESSAGE_TWO_CHOICE: msgCtx->textboxEndType = TEXTBOX_ENDTYPE_2_CHOICE; @@ -1116,7 +1116,7 @@ void Message_DrawText(PlayState* play, Gfx** gfxP) { } } if (msgCtx->textDelayTimer == 0) { - msgCtx->textDrawPos = i + CVarGetInteger("gTextSpeed", 2); + msgCtx->textDrawPos = i + CVarGetInteger(CVAR_ENHANCEMENT("TextSpeed"), 2); msgCtx->textDelayTimer = msgCtx->textDelay; } else { msgCtx->textDelayTimer--; @@ -1189,7 +1189,7 @@ void Message_Decode(PlayState* play) { phi_s1 = temp_s2 = msgCtx->msgBufDecoded[decodedBufPos] = font->msgBuf[msgCtx->msgBufPos]; // Don't require input for credits textboxes in randomizer - if (CVarGetInteger("gNoInputForCredits", 0) && ( + if (CVarGetInteger(CVAR_ENHANCEMENT("NoInputForCredits"), 0) && ( msgCtx->textId == 0x706F || msgCtx->textId == 0x7091 || msgCtx->textId == 0x7092 || @@ -1654,12 +1654,12 @@ void Message_OpenText(PlayState* play, u16 textId) { //DmaMgr_SendRequest1(font->msgBuf, (uintptr_t)(_staff_message_data_staticSegmentRomStart + 4 + font->msgOffset), //font->msgLength, __FILE__, __LINE__); - } else if (CVarGetInteger("gAskToEquip", 0) && - (((LINK_IS_ADULT || CVarGetInteger("gTimelessEquipment", 0)) && + } else if (CVarGetInteger(CVAR_ENHANCEMENT("AskToEquip"), 0) && + (((LINK_IS_ADULT || CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0)) && // 0C = Biggoron, 4B = Giant's, 4E = Mirror Shield, 50-51 = Tunics (textId == 0x0C || textId == 0x4B || textId == 0x4E || textId == 0x50 || textId == 0x51)) || - ((!LINK_IS_ADULT || CVarGetInteger("gTimelessEquipment", 0)) && + ((!LINK_IS_ADULT || CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0)) && // 4C = Deku Shield, A4 = Kokiri Sword (textId == 0x4C || textId == 0xA4)) || // 4D == Hylian Shield @@ -2018,14 +2018,14 @@ void Message_DrawMain(PlayState* play, Gfx** p) { { 10, 10, 10 }, { 50, 50, 255 }, }; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_AButton.Value", (Color_RGB8){ 100, 200, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), (Color_RGB8){ 100, 200, 255 }); sOcarinaNoteAPrimColors[0].r = (color.r / 255.0f) * 95; sOcarinaNoteAPrimColors[0].g = (color.g / 255.0f) * 95; sOcarinaNoteAPrimColors[0].b = (color.b / 255.0f) * 95; sOcarinaNoteAPrimColors[1] = color; sOcarinaNoteAEnvColors[1] = color; - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { sOcarinaNoteAPrimColors[0] = (Color_RGB8){ 80, 255, 150 }; sOcarinaNoteAPrimColors[1] = (Color_RGB8){ 100, 255, 200 }; sOcarinaNoteAEnvColors[1] = (Color_RGB8){ 50, 255, 50 }; @@ -2039,8 +2039,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { { 10, 10, 10 }, { 110, 110, 50 }, }; - if (CVarGetInteger("gCosmetics.Hud_CButtons.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_CButtons.Value", (Color_RGB8){ 100, 200, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CButtons.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("HUD.CButtons.Value"), (Color_RGB8){ 100, 200, 255 }); sOcarinaNoteCPrimColors[0] = color; sOcarinaNoteCPrimColors[1] = color; sOcarinaNoteCEnvColors[1].r = (color.r / 255.0f) * 95; @@ -2056,8 +2056,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { { 10, 10, 10 }, { 110, 110, 50 }, }; - if (CVarGetInteger("gCosmetics.Hud_CUpButton.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_CUpButton.Value", (Color_RGB8){ 100, 200, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("HUD.CUpButton.Value"), (Color_RGB8){ 100, 200, 255 }); sOcarinaNoteCUpPrimColors[0] = color; sOcarinaNoteCUpPrimColors[1] = color; sOcarinaNoteCUpEnvColors[1].r = (color.r / 255.0f) * 95; @@ -2073,8 +2073,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { { 10, 10, 10 }, { 110, 110, 50 }, }; - if (CVarGetInteger("gCosmetics.Hud_CDownButton.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_CDownButton.Value", (Color_RGB8){ 100, 200, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("HUD.CDownButton.Value"), (Color_RGB8){ 100, 200, 255 }); sOcarinaNoteCDownPrimColors[0] = color; sOcarinaNoteCDownPrimColors[1] = color; sOcarinaNoteCDownEnvColors[1].r = (color.r / 255.0f) * 95; @@ -2090,8 +2090,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { { 10, 10, 10 }, { 110, 110, 50 }, }; - if (CVarGetInteger("gCosmetics.Hud_CLeftButton.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_CLeftButton.Value", (Color_RGB8){ 100, 200, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("HUD.CLeftButton.Value"), (Color_RGB8){ 100, 200, 255 }); sOcarinaNoteCLeftPrimColors[0] = color; sOcarinaNoteCLeftPrimColors[1] = color; sOcarinaNoteCLeftEnvColors[1].r = (color.r / 255.0f) * 95; @@ -2107,8 +2107,8 @@ void Message_DrawMain(PlayState* play, Gfx** p) { { 10, 10, 10 }, { 110, 110, 50 }, }; - if (CVarGetInteger("gCosmetics.Hud_CRightButton.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_CRightButton.Value", (Color_RGB8){ 100, 200, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("HUD.CRightButton.Value"), (Color_RGB8){ 100, 200, 255 }); sOcarinaNoteCRightPrimColors[0] = color; sOcarinaNoteCRightPrimColors[1] = color; sOcarinaNoteCRightEnvColors[1].r = (color.r / 255.0f) * 95; @@ -2155,7 +2155,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { gDPSetCombineLERP(gfx++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0); - bool isB_Held = CVarGetInteger("gSkipText", 0) != 0 ? CHECK_BTN_ALL(play->state.input[0].cur.button, BTN_B) + bool isB_Held = CVarGetInteger(CVAR_ENHANCEMENT("SkipText"), 0) != 0 ? CHECK_BTN_ALL(play->state.input[0].cur.button, BTN_B) : CHECK_BTN_ALL(play->state.input[0].press.button, BTN_B); switch (msgCtx->msgMode) { @@ -2436,7 +2436,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { } break; case MSGMODE_SETUP_DISPLAY_SONG_PLAYED: - if (CVarGetInteger("gFastOcarinaPlayback", 0) == 0 || + if (CVarGetInteger(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 0) == 0 || play->msgCtx.lastPlayedSong == OCARINA_SONG_TIME || play->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS || play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) { @@ -2491,7 +2491,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { Message_Decode(play); msgCtx->msgMode = MSGMODE_DISPLAY_SONG_PLAYED_TEXT; - if (CVarGetInteger("gFastOcarinaPlayback", 0) == 0 || play->msgCtx.lastPlayedSong == OCARINA_SONG_TIME + if (CVarGetInteger(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 0) == 0 || play->msgCtx.lastPlayedSong == OCARINA_SONG_TIME || play->msgCtx.lastPlayedSong == OCARINA_SONG_STORMS || play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS) { msgCtx->stateTimer = 20; @@ -3022,7 +3022,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { * the last value being saved in a static variable. */ void Message_DrawDebugVariableChanged(s16* var, GraphicsContext* gfxCtx) { - if (!CVarGetInteger("gDebugEnabled", 0)) { return; } + if (!CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) { return; } static s16 sVarLastValue = 0; static s16 sFillTimer = 0; @@ -3163,7 +3163,7 @@ void Message_Update(PlayState* play) { GameInteractor_ExecuteOnDialogMessage(); - bool isB_Held = CVarGetInteger("gSkipText", 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) && !sTextboxSkipped + bool isB_Held = CVarGetInteger(CVAR_ENHANCEMENT("SkipText"), 0) != 0 ? CHECK_BTN_ALL(input->cur.button, BTN_B) && !sTextboxSkipped : CHECK_BTN_ALL(input->press.button, BTN_B); switch (msgCtx->msgMode) { @@ -3382,7 +3382,7 @@ void Message_Update(PlayState* play) { } if ((s32)(gSaveContext.inventory.questItems & 0xF0000000) == 0x40000000) { gSaveContext.inventory.questItems ^= 0x40000000; - if (!CVarGetInteger("gHurtContainer", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("HurtContainer"), 0)) { gSaveContext.healthCapacity += 0x10; gSaveContext.health += 0x10; } else { diff --git a/soh/src/code/z_olib.c b/soh/src/code/z_olib.c index 2b72f3014..da4959726 100644 --- a/soh/src/code/z_olib.c +++ b/soh/src/code/z_olib.c @@ -80,7 +80,7 @@ Vec3f* OLib_VecSphToVec3f(Vec3f* dest, VecSph* sph) { f32 sinYaw; f32 cosYaw; - if (CVarGetInteger("gFixCameraDrift", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FixCameraDrift"), 0)) { cosPitch = Math_AccurateCosS(sph->pitch); cosYaw = Math_AccurateCosS(sph->yaw); sinPitch = Math_AccurateSinS(sph->pitch); diff --git a/soh/src/code/z_onepointdemo.c b/soh/src/code/z_onepointdemo.c index 95030baf6..0bc6728f5 100644 --- a/soh/src/code/z_onepointdemo.c +++ b/soh/src/code/z_onepointdemo.c @@ -73,7 +73,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor // #region SOH [Enhancement] //the default is 90, lower values necessary to prevent camera swing as animation speeds up - s16 camCrawlTemp = CVarGetInteger("gCrawlSpeed", 1); + s16 camCrawlTemp = CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1); s16 camCrawlTimer = D_8012042C / camCrawlTemp; // #endregion @@ -337,7 +337,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor case 9601: Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); - if (CVarGetInteger("gCrawlSpeed", 1) > 1) { + if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, camCrawlTimer, D_80120308, D_80120398); } else { OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120398); @@ -345,7 +345,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor break; case 9602: // #region SOH [Enhancement] - if (CVarGetInteger("gCrawlSpeed", 1) > 1) { + if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { Play_CameraChangeSetting(play, camIdx, CAM_SET_CS_3); Play_CameraChangeSetting(play, MAIN_CAM, mainCam->prevSetting); OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, camCrawlTimer, D_80120308, D_80120434); diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index cb665999e..934b9486d 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -1170,7 +1170,7 @@ void func_80083108(PlayState* play) { if (interfaceCtx->restrictions.tradeItems != 0) { for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { - if ((CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) + if ((CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) && (gSaveContext.equips.buttonItems[i] >= ITEM_MASK_KEATON) && (gSaveContext.equips.buttonItems[i] <= ITEM_MASK_TRUTH)) { gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED; @@ -1401,7 +1401,7 @@ void Interface_SetSceneRestrictions(PlayState* play) { interfaceCtx->restrictions.farores, interfaceCtx->restrictions.dinsNayrus, interfaceCtx->restrictions.all); osSyncPrintf(VT_RST); - if (CVarGetInteger("gBetterFW", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("BetterFarore"), 0)) { if (currentScene == SCENE_GERUDO_TRAINING_GROUND || currentScene == SCENE_INSIDE_GANONS_CASTLE) { interfaceCtx->restrictions.farores = 0; } @@ -1539,7 +1539,7 @@ void Inventory_SwapAgeEquipment(void) { // When using enhancements, set swordless flag if player doesn't have kokiri sword or hasn't equipped a sword yet. // Then set the child equips button items to item none to ensure kokiri sword is not equipped - if ((CVarGetInteger("gSwitchAge", 0) || CVarGetInteger("gSwitchTimeline", 0)) && (CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_KOKIRI) == 0 || Flags_GetInfTable(INFTABLE_SWORDLESS))) { + if ((CVarGetInteger(CVAR_GENERAL("SwitchAge"), 0) || CVarGetInteger(CVAR_GENERAL("SwitchTimeline"), 0)) && (CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_KOKIRI) == 0 || Flags_GetInfTable(INFTABLE_SWORDLESS))) { Flags_SetInfTable(INFTABLE_SWORDLESS); gSaveContext.childEquips.buttonItems[0] = ITEM_NONE; } @@ -1554,7 +1554,7 @@ void Inventory_SwapAgeEquipment(void) { gSaveContext.adultEquips.equipment = gSaveContext.equips.equipment; // Switching age using enhancements separated out to make vanilla flow clear - if (CVarGetInteger("gSwitchAge", 0) || CVarGetInteger("gSwitchTimeline", 0)) { + if (CVarGetInteger(CVAR_GENERAL("SwitchAge"), 0) || CVarGetInteger(CVAR_GENERAL("SwitchTimeline"), 0)) { for (i = 0; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { gSaveContext.equips.buttonItems[i] = gSaveContext.childEquips.buttonItems[i]; @@ -1629,7 +1629,7 @@ void Inventory_SwapAgeEquipment(void) { (EQUIP_VALUE_BOOTS_KOKIRI << (EQUIP_TYPE_BOOTS * 4)); } - if ((CVarGetInteger("gSwitchAge", 0) || CVarGetInteger("gSwitchTimeline", 0)) && + if ((CVarGetInteger(CVAR_GENERAL("SwitchAge"), 0) || CVarGetInteger(CVAR_GENERAL("SwitchTimeline"), 0)) && (gSaveContext.equips.buttonItems[0] == ITEM_NONE)) { Flags_SetInfTable(INFTABLE_SWORDLESS); if (gSaveContext.childEquips.equipment == 0) { @@ -1640,7 +1640,7 @@ void Inventory_SwapAgeEquipment(void) { } } } - CVarSetInteger("gSwitchTimeline", 0); + CVarSetInteger(CVAR_GENERAL("SwitchTimeline"), 0); shieldEquipValue = gEquipMasks[EQUIP_TYPE_SHIELD] & gSaveContext.equips.equipment; if (shieldEquipValue != 0) { shieldEquipValue >>= gEquipShifts[EQUIP_TYPE_SHIELD]; @@ -2282,7 +2282,7 @@ u8 Item_Give(PlayState* play, u8 item) { gSaveContext.sohStats.heartPieces++; return Return_Item(item, MOD_NONE, ITEM_NONE); } else if (item == ITEM_HEART_CONTAINER) { - if (!CVarGetInteger("gHurtContainer", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("HurtContainer"), 0)) { gSaveContext.healthCapacity += 0x10; gSaveContext.health += 0x10; } else { @@ -2383,7 +2383,7 @@ u8 Item_Give(PlayState* play, u8 item) { } return Return_Item(item, MOD_NONE, ITEM_NONE); } else if ((item >= ITEM_WEIRD_EGG) && (item <= ITEM_CLAIM_CHECK)) { - if ((item == ITEM_SAW) && CVarGetInteger("gDekuNutUpgradeFix", 0) == 0) { + if ((item == ITEM_SAW) && CVarGetInteger(CVAR_ENHANCEMENT("DekuNutUpgradeFix"), 0) == 0) { Flags_SetItemGetInf(ITEMGETINF_OBTAINED_NUT_UPGRADE_FROM_STAGE); } @@ -2941,7 +2941,7 @@ void Inventory_UpdateBottleItem(PlayState* play, u8 item, u8 button) { item = ITEM_MILK_HALF; } - if (CVarGetInteger("gRestoreRBAValues",0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RestoreRBAValues"),0)) { byteSwapInventory(); gSaveContext.inventory.items[gSaveContext.equips.cButtonSlots[button - 1]] = item; byteSwapInventory(); @@ -3052,7 +3052,7 @@ void Interface_SetNaviCall(PlayState* play, u16 naviCallState) { if (((naviCallState == 0x1D) || (naviCallState == 0x1E)) && !interfaceCtx->naviCalling && (play->csCtx.state == CS_STATE_IDLE)) { - if (!CVarGetInteger("gDisableNaviCallAudio", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("DisableNaviCallAudio"), 0)) { // clang-format off if (naviCallState == 0x1E) { Audio_PlaySoundGeneral(NA_SE_VO_NAVY_CALL, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } @@ -3390,22 +3390,22 @@ void Interface_UpdateMagicBar(PlayState* play) { Color_RGB8 MagicBorder_2 = { 255, 255, 150 }; Color_RGB8 MagicBorder_3 = { 255, 255, 50 }; - if (CVarGetInteger("gCosmetics.Consumable_MagicBorderActive.Changed", 0)) { //This will make custom color based on users selected colors. - sMagicBorderColors[0][0] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_0).r; - sMagicBorderColors[0][1] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_0).g; - sMagicBorderColors[0][2] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_0).b; + if (CVarGetInteger(CVAR_COSMETIC("Consumable.MagicBorderActive.Changed"), 0)) { //This will make custom color based on users selected colors. + sMagicBorderColors[0][0] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_0).r; + sMagicBorderColors[0][1] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_0).g; + sMagicBorderColors[0][2] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_0).b; - sMagicBorderColors[1][0] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_1).r/2; - sMagicBorderColors[1][1] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_1).g/2; - sMagicBorderColors[1][2] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_1).b/2; + sMagicBorderColors[1][0] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_1).r/2; + sMagicBorderColors[1][1] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_1).g/2; + sMagicBorderColors[1][2] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_1).b/2; - sMagicBorderColors[2][0] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_2).r/2.5; - sMagicBorderColors[2][1] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_2).g/2.5; - sMagicBorderColors[2][2] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_2).b/2.5; + sMagicBorderColors[2][0] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_2).r/2.5; + sMagicBorderColors[2][1] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_2).g/2.5; + sMagicBorderColors[2][2] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_2).b/2.5; - sMagicBorderColors[3][0] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_3).r/3; - sMagicBorderColors[3][1] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_3).g/3; - sMagicBorderColors[3][2] = CVarGetColor24("gCosmetics.Consumable_MagicBorderActive.Value", MagicBorder_3).b/3; + sMagicBorderColors[3][0] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_3).r/3; + sMagicBorderColors[3][1] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_3).g/3; + sMagicBorderColors[3][2] = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorderActive.Value"), MagicBorder_3).b/3; } static s16 sMagicBorderIndexes[] = { 0, 1, 1, 0 }; @@ -3465,15 +3465,15 @@ void Interface_UpdateMagicBar(PlayState* play) { if (gSaveContext.magic <= 0) { gSaveContext.magic = 0; gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1; - if (CVarGetInteger("gCosmetics.Consumable_MagicBorder.Changed", 0)) { - sMagicBorder = CVarGetColor24("gCosmetics.Consumable_MagicBorder.Value", sMagicBorder_ori); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.MagicBorder.Changed"), 0)) { + sMagicBorder = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorder.Value"), sMagicBorder_ori); } else { sMagicBorder = sMagicBorder_ori; } } else if (gSaveContext.magic == gSaveContext.magicTarget) { gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1; - if (CVarGetInteger("gCosmetics.Consumable_MagicBorder.Changed", 0)) { - sMagicBorder = CVarGetColor24("gCosmetics.Consumable_MagicBorder.Value", sMagicBorder_ori); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.MagicBorder.Changed"), 0)) { + sMagicBorder = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorder.Value"), sMagicBorder_ori); } else { sMagicBorder = sMagicBorder_ori; } @@ -3518,8 +3518,8 @@ void Interface_UpdateMagicBar(PlayState* play) { break; case MAGIC_STATE_RESET: - if (CVarGetInteger("gCosmetics.Consumable_MagicBorder.Changed", 0)) { - sMagicBorder = CVarGetColor24("gCosmetics.Consumable_MagicBorder.Value", sMagicBorder_ori); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.MagicBorder.Changed"), 0)) { + sMagicBorder = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorder.Value"), sMagicBorder_ori); } else { sMagicBorder = sMagicBorder_ori; } @@ -3531,7 +3531,7 @@ void Interface_UpdateMagicBar(PlayState* play) { (msgCtx->msgMode == MSGMODE_NONE) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) { bool hasLens = false; - for (int buttonIndex = 1; buttonIndex < (CVarGetInteger("gDpadEquips", 0) != 0) ? ARRAY_COUNT(gSaveContext.equips.buttonItems) : 4; buttonIndex++) { + for (int buttonIndex = 1; buttonIndex < (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) ? ARRAY_COUNT(gSaveContext.equips.buttonItems) : 4; buttonIndex++) { if (gSaveContext.equips.buttonItems[buttonIndex] == ITEM_LENS) { hasLens = true; break; @@ -3544,8 +3544,8 @@ void Interface_UpdateMagicBar(PlayState* play) { Audio_PlaySoundGeneral(NA_SE_SY_GLASSMODE_OFF, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); gSaveContext.magicState = MAGIC_STATE_IDLE; - if (CVarGetInteger("gCosmetics.Consumable_MagicBorder.Changed", 0)) { - sMagicBorder = CVarGetColor24("gCosmetics.Consumable_MagicBorder.Value", sMagicBorder_ori); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.MagicBorder.Changed"), 0)) { + sMagicBorder = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicBorder.Value"), sMagicBorder_ori); } else { sMagicBorder = sMagicBorder_ori; } @@ -3640,11 +3640,11 @@ void Interface_DrawMagicBar(PlayState* play) { 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 - if (CVarGetInteger("gCosmetics.Consumable_MagicActive.Changed", 0)) { - magicbar_yellow = CVarGetColor24("gCosmetics.Consumable_MagicActive.Value", magicbar_yellow); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.MagicActive.Changed"), 0)) { + magicbar_yellow = CVarGetColor24(CVAR_COSMETIC("Consumable.MagicActive.Value"), magicbar_yellow); } - if (CVarGetInteger("gCosmetics.Consumable_Magic.Changed", 0)) { - magicbar_green = CVarGetColor24("gCosmetics.Consumable_Magic.Value", magicbar_green); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.Magic.Changed"), 0)) { + magicbar_green = CVarGetColor24(CVAR_COSMETIC("Consumable.Magic.Value"), magicbar_green); } OPEN_DISPS(play->state.gfxCtx); @@ -3652,7 +3652,7 @@ void Interface_DrawMagicBar(PlayState* play) { if (gSaveContext.magicLevel != 0) { s16 X_Margins; s16 Y_Margins; - if (CVarGetInteger("gMagicBarUseMargins", 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.UseMargins"), 0) != 0) { X_Margins = Left_HUD_Margin; Y_Margins = (Top_HUD_Margin*-1); } else { @@ -3670,40 +3670,40 @@ void Interface_DrawMagicBar(PlayState* play) { s16 rMagicBarX; s16 PosX_MidEnd; s16 rMagicFillX; - s32 lineLength = CVarGetInteger("gHeartsLineLength", 10); - if (CVarGetInteger("gMagicBarPosType", 0) != 0) { - magicBarY = CVarGetInteger("gMagicBarPosY", 0)+Y_Margins; - if (CVarGetInteger("gMagicBarPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gMagicBarUseMargins", 0) != 0) {X_Margins = Left_HUD_Margin;}; - PosX_Start = OTRGetDimensionFromLeftEdge(CVarGetInteger("gMagicBarPosX", 0)+X_Margins); - rMagicBarX = OTRGetDimensionFromLeftEdge(CVarGetInteger("gMagicBarPosX", 0)+X_Margins); - PosX_MidEnd = OTRGetDimensionFromLeftEdge(CVarGetInteger("gMagicBarPosX", 0)+X_Margins+8); - rMagicFillX = OTRGetDimensionFromLeftEdge(CVarGetInteger("gMagicBarPosX", 0)+X_Margins+8); - } else if (CVarGetInteger("gMagicBarPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gMagicBarUseMargins", 0) != 0) {X_Margins = Right_HUD_Margin;}; - PosX_Start = OTRGetDimensionFromRightEdge(CVarGetInteger("gMagicBarPosX", 0)+X_Margins); - rMagicBarX = OTRGetDimensionFromRightEdge(CVarGetInteger("gMagicBarPosX", 0)+X_Margins); - PosX_MidEnd = OTRGetDimensionFromRightEdge(CVarGetInteger("gMagicBarPosX", 0)+X_Margins+8); - rMagicFillX = OTRGetDimensionFromRightEdge(CVarGetInteger("gMagicBarPosX", 0)+X_Margins+8); - } else if (CVarGetInteger("gMagicBarPosType", 0) == 3) {//Anchor None - PosX_Start = CVarGetInteger("gMagicBarPosX", 0)+X_Margins; - rMagicBarX = CVarGetInteger("gMagicBarPosX", 0)+X_Margins; - PosX_MidEnd = CVarGetInteger("gMagicBarPosX", 0)+X_Margins+8; - rMagicFillX = CVarGetInteger("gMagicBarPosX", 0)+X_Margins+8; - } else if (CVarGetInteger("gMagicBarPosType", 0) == 4) {//hidden + s32 lineLength = CVarGetInteger(CVAR_COSMETIC("HUD.Hearts.LineLength"), 10); + if (CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosType"), 0) != 0) { + magicBarY = CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosY"), 0)+Y_Margins; + if (CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.UseMargins"), 0) != 0) {X_Margins = Left_HUD_Margin;}; + PosX_Start = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins); + rMagicBarX = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins); + PosX_MidEnd = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins+8); + rMagicFillX = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins+8); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.UseMargins"), 0) != 0) {X_Margins = Right_HUD_Margin;}; + PosX_Start = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins); + rMagicBarX = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins); + PosX_MidEnd = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins+8); + rMagicFillX = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins+8); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosType"), 0) == 3) {//Anchor None + PosX_Start = CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins; + rMagicBarX = CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins; + PosX_MidEnd = CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins+8; + rMagicFillX = CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0)+X_Margins+8; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosType"), 0) == 4) {//hidden PosX_Start = -9999; rMagicBarX = -9999; PosX_MidEnd = -9999; rMagicFillX = -9999; - } else if (CVarGetInteger("gMagicBarPosType", 0) == 5) {//Anchor To life meter + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosType"), 0) == 5) {//Anchor To life meter magicBarY = R_MAGIC_BAR_SMALL_Y-2 + magicDrop*(lineLength == 0 ? 0 : (gSaveContext.healthCapacity-1)/(0x10*lineLength)) + - CVarGetInteger("gMagicBarPosY", 0) + getHealthMeterYOffset(); - s16 xPushover = CVarGetInteger("gMagicBarPosX", 0) + getHealthMeterXOffset() + R_MAGIC_BAR_X-1; + CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosY"), 0) + getHealthMeterYOffset(); + s16 xPushover = CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0) + getHealthMeterXOffset() + R_MAGIC_BAR_X-1; PosX_Start = xPushover; rMagicBarX = xPushover; PosX_MidEnd = xPushover+8; - rMagicFillX = CVarGetInteger("gMagicBarPosX", 0) + getHealthMeterXOffset() + R_MAGIC_FILL_X-1; + rMagicFillX = CVarGetInteger(CVAR_COSMETIC("HUD.MagicBar.PosX"), 0) + getHealthMeterXOffset() + R_MAGIC_FILL_X-1; } } else { if ((gSaveContext.healthCapacity-1)/0x10 >= lineLength && lineLength != 0) { @@ -3816,18 +3816,18 @@ void Interface_DrawEnemyHealthBar(TargetContext* targetCtx, PlayState* play) { Color_RGBA8 healthbar_border = { 255, 255, 255, 255 }; s16 healthbar_fillWidth = 64; s16 healthbar_actorOffset = 40; - s32 healthbar_offsetX = CVarGetInteger("gCosmetics.Hud_EnemyHealthBarPosX", 0); - s32 healthbar_offsetY = CVarGetInteger("gCosmetics.Hud_EnemyHealthBarPosY", 0); - s8 anchorType = CVarGetInteger("gCosmetics.Hud_EnemyHealthBarPosType", ENEMYHEALTH_ANCHOR_ACTOR); + s32 healthbar_offsetX = CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar.PosX"), 0); + s32 healthbar_offsetY = CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar.PosY"), 0); + s8 anchorType = CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar.PosType"), ENEMYHEALTH_ANCHOR_ACTOR); - if (CVarGetInteger("gCosmetics.Hud_EnemyHealthBar.Changed", 0)) { - healthbar_red = CVarGetColor("gCosmetics.Hud_EnemyHealthBar.Value", healthbar_red); + if (CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar..Changed"), 0)) { + healthbar_red = CVarGetColor(CVAR_COSMETIC("HUD.EnemyHealthBar..Value"), healthbar_red); } - if (CVarGetInteger("gCosmetics.Hud_EnemyHealthBorder.Changed", 0)) { - healthbar_border = CVarGetColor("gCosmetics.Hud_EnemyHealthBorder.Value", healthbar_border); + if (CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBorder.Changed"), 0)) { + healthbar_border = CVarGetColor(CVAR_COSMETIC("HUD.EnemyHealthBorder.Value"), healthbar_border); } - if (CVarGetInteger("gCosmetics.Hud_EnemyHealthBarWidth.Changed", 0)) { - healthbar_fillWidth = CVarGetInteger("gCosmetics.Hud_EnemyHealthBarWidth.Value", healthbar_fillWidth); + if (CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar.Width.Changed"), 0)) { + healthbar_fillWidth = CVarGetInteger(CVAR_COSMETIC("HUD.EnemyHealthBar.Width.Value"), healthbar_fillWidth); } OPEN_DISPS(play->state.gfxCtx); @@ -3845,7 +3845,7 @@ void Interface_DrawEnemyHealthBar(TargetContext* targetCtx, PlayState* play) { func_8002BE04(play, &targetCtx->targetCenterPos, &projTargetCenter, &projTargetCappedInvW); projTargetCenter.x = (SCREEN_WIDTH / 2) * (projTargetCenter.x * projTargetCappedInvW); - projTargetCenter.x = projTargetCenter.x * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1); + projTargetCenter.x = projTargetCenter.x * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1); projTargetCenter.x = CLAMP(projTargetCenter.x, (-SCREEN_WIDTH / 2) + halfBarWidth, (SCREEN_WIDTH / 2) - halfBarWidth); @@ -4007,37 +4007,37 @@ void Interface_DrawItemButtons(PlayState* play) { s16 height; Color_RGB8 bButtonColor = { 0, 150, 0 }; - if (CVarGetInteger("gCosmetics.Hud_BButton.Changed", 0)) { - bButtonColor = CVarGetColor24("gCosmetics.Hud_BButton.Value", bButtonColor); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.Changed"), 0)) { + bButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.BButton.Value"), bButtonColor); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { bButtonColor = (Color_RGB8){ 255, 30, 30 }; } Color_RGB8 cButtonsColor = { 255, 160, 0 }; - if (CVarGetInteger("gCosmetics.Hud_CButtons.Changed", 0)) { - cButtonsColor = CVarGetColor24("gCosmetics.Hud_CButtons.Value", cButtonsColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CButtons.Changed"), 0)) { + cButtonsColor = CVarGetColor24(CVAR_COSMETIC("HUD.CButtons.Value"), cButtonsColor); } Color_RGB8 cUpButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CUpButton.Changed", 0)) { - cUpButtonColor = CVarGetColor24("gCosmetics.Hud_CUpButton.Value", cUpButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.Changed"), 0)) { + cUpButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CUpButton.Value"), cUpButtonColor); } Color_RGB8 cDownButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CDownButton.Changed", 0)) { - cDownButtonColor = CVarGetColor24("gCosmetics.Hud_CDownButton.Value", cDownButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.Changed"), 0)) { + cDownButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CDownButton.Value"), cDownButtonColor); } Color_RGB8 cLeftButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CLeftButton.Changed", 0)) { - cLeftButtonColor = CVarGetColor24("gCosmetics.Hud_CLeftButton.Value", cLeftButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.Changed"), 0)) { + cLeftButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CLeftButton.Value"), cLeftButtonColor); } Color_RGB8 cRightButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CRightButton.Changed", 0)) { - cRightButtonColor = CVarGetColor24("gCosmetics.Hud_CRightButton.Value", cRightButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.Changed"), 0)) { + cRightButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CRightButton.Value"), cRightButtonColor); } Color_RGB8 startButtonColor = { 200, 0, 0 }; - if (CVarGetInteger("gCosmetics.Hud_StartButton.Changed", 0)) { - startButtonColor = CVarGetColor24("gCosmetics.Hud_StartButton.Value", startButtonColor); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.Changed"), 0)) { + startButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.StartButton.Value"), startButtonColor); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { startButtonColor = (Color_RGB8){ 120, 120, 120 }; } @@ -4046,12 +4046,12 @@ void Interface_DrawItemButtons(PlayState* play) { s16 Y_Margins_BtnB; s16 BBtn_Size = 32; int BBtnScaled = BBtn_Size * 0.95f; - if (CVarGetInteger("gBBtnPosType", 0) != 0) { - BBtnScaled = BBtn_Size * CVarGetFloat("gBBtnScale", 0.95f); + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) != 0) { + BBtnScaled = BBtn_Size * CVarGetFloat(CVAR_COSMETIC("HUD.BButton.Scale"), 0.95f); } int BBtn_factor = (1 << 10) * BBtn_Size / BBtnScaled; - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) { - if (CVarGetInteger("gBBtnPosType", 0) == 0) {X_Margins_BtnB = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 0) {X_Margins_BtnB = Right_HUD_Margin;}; Y_Margins_BtnB = (Top_HUD_Margin*-1); } else { X_Margins_BtnB = 0; @@ -4061,17 +4061,17 @@ void Interface_DrawItemButtons(PlayState* play) { s16 PosY_BtnB_ori = R_ITEM_BTN_Y(0)+Y_Margins_BtnB; s16 PosX_BtnB; s16 PosY_BtnB; - if (CVarGetInteger("gBBtnPosType", 0) != 0) { - PosY_BtnB = CVarGetInteger("gBBtnPosY", 0)+Y_Margins_BtnB; - if (CVarGetInteger("gBBtnPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Left_HUD_Margin;}; - PosX_BtnB = OTRGetDimensionFromLeftEdge(CVarGetInteger("gBBtnPosX", 0)+X_Margins_BtnB); - } else if (CVarGetInteger("gBBtnPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Right_HUD_Margin;}; - PosX_BtnB = OTRGetDimensionFromRightEdge(CVarGetInteger("gBBtnPosX", 0)+X_Margins_BtnB); - } else if (CVarGetInteger("gBBtnPosType", 0) == 3) {//Anchor None - PosX_BtnB = CVarGetInteger("gBBtnPosX", 0); - } else if (CVarGetInteger("gBBtnPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) != 0) { + PosY_BtnB = CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosY"), 0)+Y_Margins_BtnB; + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) {X_Margins_BtnB = Left_HUD_Margin;}; + PosX_BtnB = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0)+X_Margins_BtnB); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) {X_Margins_BtnB = Right_HUD_Margin;}; + PosX_BtnB = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0)+X_Margins_BtnB); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 3) {//Anchor None + PosX_BtnB = CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 4) {//Hidden PosX_BtnB = -9999; } } else { @@ -4081,8 +4081,8 @@ void Interface_DrawItemButtons(PlayState* play) { //Start Button s16 X_Margins_StartBtn; s16 Y_Margins_StartBtn; - if (CVarGetInteger("gStartBtnUseMargins", 0) != 0) { - if (CVarGetInteger("gStartBtnPosType", 0) == 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.PosType"), 0) == 0) { X_Margins_StartBtn = Right_HUD_Margin; }; Y_Margins_StartBtn = Top_HUD_Margin*-1; @@ -4093,8 +4093,8 @@ void Interface_DrawItemButtons(PlayState* play) { s16 StartBtn_Icon_H = 32; s16 StartBtn_Icon_W = 32; float Start_BTN_Scale = 0.75f; - if (CVarGetInteger("gStartBtnPosType", 0) != 0) { - Start_BTN_Scale = CVarGetFloat("gStartBtnScale", 0.75f); + if (CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.PosType"), 0) != 0) { + Start_BTN_Scale = CVarGetFloat(CVAR_COSMETIC("HUD.StartButton.Scale"), 0.75f); } int StartBTN_H_Scaled = StartBtn_Icon_H * Start_BTN_Scale; int StartBTN_W_Scaled = StartBtn_Icon_W * Start_BTN_Scale; @@ -4106,17 +4106,17 @@ void Interface_DrawItemButtons(PlayState* play) { s16 StartBTN_Label_H = DO_ACTION_TEX_HEIGHT(); s16 PosX_StartBtn; s16 PosY_StartBtn; - if (CVarGetInteger("gStartBtnPosType", 0) != 0) { - PosY_StartBtn = CVarGetInteger("gStartBtnPosY", 0)-(Start_BTN_Scale*13)+Y_Margins_StartBtn; - if (CVarGetInteger("gStartBtnPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gStartBtnUseMargins", 0) != 0) {X_Margins_StartBtn = Left_HUD_Margin;}; - PosX_StartBtn = OTRGetDimensionFromLeftEdge(CVarGetInteger("gStartBtnPosX", 0)-(Start_BTN_Scale*13)+X_Margins_StartBtn); - } else if (CVarGetInteger("gStartBtnPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gStartBtnUseMargins", 0) != 0) {X_Margins_StartBtn = Right_HUD_Margin;}; - PosX_StartBtn = OTRGetDimensionFromRightEdge(CVarGetInteger("gStartBtnPosX", 0)-(Start_BTN_Scale*13)+X_Margins_StartBtn); - } else if (CVarGetInteger("gStartBtnPosType", 0) == 3) {//Anchor None - PosX_StartBtn = CVarGetInteger("gStartBtnPosX", 0); - } else if (CVarGetInteger("gStartBtnPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.PosType"), 0) != 0) { + PosY_StartBtn = CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.PosY"), 0)-(Start_BTN_Scale*13)+Y_Margins_StartBtn; + if (CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.UseMargins"), 0) != 0) {X_Margins_StartBtn = Left_HUD_Margin;}; + PosX_StartBtn = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.PosX"), 0)-(Start_BTN_Scale*13)+X_Margins_StartBtn); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.UseMargins"), 0) != 0) {X_Margins_StartBtn = Right_HUD_Margin;}; + PosX_StartBtn = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.PosX"), 0)-(Start_BTN_Scale*13)+X_Margins_StartBtn); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.PosType"), 0) == 3) {//Anchor None + PosX_StartBtn = CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.StartButton.PosType"), 0) == 4) {//Hidden PosX_StartBtn = -9999; } } else { @@ -4136,29 +4136,29 @@ void Interface_DrawItemButtons(PlayState* play) { s16 Y_Margins_CR; s16 Y_Margins_CU; s16 Y_Margins_CD; - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnLPosType", 0) == 0) {X_Margins_CL = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 0) {X_Margins_CL = Right_HUD_Margin;}; Y_Margins_CL = (Top_HUD_Margin*-1); } else { X_Margins_CL = 0; Y_Margins_CL = 0; } - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnRPosType", 0) == 0) {X_Margins_CR = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 0) {X_Margins_CR = Right_HUD_Margin;}; Y_Margins_CR = (Top_HUD_Margin*-1); } else { X_Margins_CR = 0; Y_Margins_CR = 0; } - if (CVarGetInteger("gCBtnUUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnUPosType", 0) == 0) {X_Margins_CU = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.PosType"), 0) == 0) {X_Margins_CU = Right_HUD_Margin;}; Y_Margins_CU = (Top_HUD_Margin*-1); } else { X_Margins_CU = 0; Y_Margins_CU = 0; } - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnDPosType", 0) == 0) {X_Margins_CD = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 0) {X_Margins_CD = Right_HUD_Margin;}; Y_Margins_CD = (Top_HUD_Margin*-1); } else { X_Margins_CD = 0; @@ -4168,7 +4168,7 @@ void Interface_DrawItemButtons(PlayState* play) { const s16 C_Right_BTN_Pos_ori[] = { C_RIGHT_BUTTON_X+X_Margins_CR, C_RIGHT_BUTTON_Y+Y_Margins_CR }; const s16 C_Up_BTN_Pos_ori[] = { C_UP_BUTTON_X+X_Margins_CU, C_UP_BUTTON_Y+Y_Margins_CU }; const s16 C_Down_BTN_Pos_ori[] = { C_DOWN_BUTTON_X+X_Margins_CD, C_DOWN_BUTTON_Y+Y_Margins_CD }; - s16 LabelX_Navi=7 + !!CVarGetInteger("gNaviTextFix", 0); + s16 LabelX_Navi=7 + !!CVarGetInteger(CVAR_ENHANCEMENT("NaviTextFix"), 0); s16 LabelY_Navi=4; s16 C_Left_BTN_Pos[2]; //(X,Y) s16 C_Right_BTN_Pos[2]; @@ -4176,23 +4176,23 @@ void Interface_DrawItemButtons(PlayState* play) { s16 C_Down_BTN_Pos[2]; //C button Left s16 C_Left_BTN_Size = 32; - float CLeftScale = CVarGetFloat("gCBtnLScale", 0.87f); + float CLeftScale = CVarGetFloat(CVAR_COSMETIC("HUD.CLeftButton.Scale"), 0.87f); int CLeftScaled = C_Left_BTN_Size * 0.87f; - if (CVarGetInteger("gCBtnLPosType", 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) != 0) { CLeftScaled = C_Left_BTN_Size * CLeftScale; } int CLeft_factor = (1 << 10) * C_Left_BTN_Size / CLeftScaled; - if (CVarGetInteger("gCBtnLPosType", 0) != 0) { - C_Left_BTN_Pos[1] = CVarGetInteger("gCBtnLPosY", 0)+Y_Margins_CL; - if (CVarGetInteger("gCBtnLPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Left_HUD_Margin;}; - C_Left_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnLPosX", 0)+X_Margins_CL); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Right_HUD_Margin;}; - C_Left_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnLPosX", 0)+X_Margins_CL); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 3) {//Anchor None - C_Left_BTN_Pos[0] = CVarGetInteger("gCBtnLPosX", 0); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) != 0) { + C_Left_BTN_Pos[1] = CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosY"), 0)+Y_Margins_CL; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) {X_Margins_CL = Left_HUD_Margin;}; + C_Left_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0)+X_Margins_CL); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) {X_Margins_CL = Right_HUD_Margin;}; + C_Left_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0)+X_Margins_CL); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 3) {//Anchor None + C_Left_BTN_Pos[0] = CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 4) {//Hidden C_Left_BTN_Pos[0] = -9999; } } else { @@ -4201,23 +4201,23 @@ void Interface_DrawItemButtons(PlayState* play) { } //C button Right s16 C_Right_BTN_Size = 32; - float CRightScale = CVarGetFloat("gCBtnRScale", 0.87f); + float CRightScale = CVarGetFloat(CVAR_COSMETIC("HUD.CRightButton.Scale"), 0.87f); int CRightScaled = C_Right_BTN_Size * 0.87f; - if (CVarGetInteger("gCBtnRPosType", 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) != 0) { CRightScaled = C_Right_BTN_Size * CRightScale; } int CRight_factor = (1 << 10) * C_Right_BTN_Size / CRightScaled; - if (CVarGetInteger("gCBtnRPosType", 0) != 0) { - C_Right_BTN_Pos[1] = CVarGetInteger("gCBtnRPosY", 0)+Y_Margins_CR; - if (CVarGetInteger("gCBtnRPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Left_HUD_Margin;}; - C_Right_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnRPosX", 0)+X_Margins_CR); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Right_HUD_Margin;}; - C_Right_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnRPosX", 0)+X_Margins_CR); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 3) {//Anchor None - C_Right_BTN_Pos[0] = CVarGetInteger("gCBtnRPosX", 0); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) != 0) { + C_Right_BTN_Pos[1] = CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosY"), 0)+Y_Margins_CR; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) {X_Margins_CR = Left_HUD_Margin;}; + C_Right_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0)+X_Margins_CR); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) {X_Margins_CR = Right_HUD_Margin;}; + C_Right_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0)+X_Margins_CR); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 3) {//Anchor None + C_Right_BTN_Pos[0] = CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 4) {//Hidden C_Right_BTN_Pos[0] = -9999; } } else { @@ -4227,22 +4227,22 @@ void Interface_DrawItemButtons(PlayState* play) { //C Button Up s16 C_Up_BTN_Size = 32; int CUpScaled = C_Up_BTN_Size * 0.5f; - float CUpScale = CVarGetFloat("gCBtnUScale", 0.5f); - if (CVarGetInteger("gCBtnUPosType", 0) != 0) { + float CUpScale = CVarGetFloat(CVAR_COSMETIC("HUD.CUpButton.Scale"), 0.5f); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.PosType"), 0) != 0) { CUpScaled = C_Up_BTN_Size * CUpScale; } int CUp_factor = (1 << 10) * C_Up_BTN_Size / CUpScaled; - if (CVarGetInteger("gCBtnUPosType", 0) != 0) { - C_Up_BTN_Pos[1] = CVarGetInteger("gCBtnUPosY", 0)+Y_Margins_CU; - if (CVarGetInteger("gCBtnUPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnUUseMargins", 0) != 0) {X_Margins_CU = Left_HUD_Margin;}; - C_Up_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnUPosX", 0)+X_Margins_CU); - } else if (CVarGetInteger("gCBtnUPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnUUseMargins", 0) != 0) {X_Margins_CU = Right_HUD_Margin;}; - C_Up_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnUPosX", 0)+X_Margins_CU); - } else if (CVarGetInteger("gCBtnUPosType", 0) == 3) {//Anchor None - C_Up_BTN_Pos[0] = CVarGetInteger("gCBtnUPosX", 0); - } else if (CVarGetInteger("gCBtnUPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.PosType"), 0) != 0) { + C_Up_BTN_Pos[1] = CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.PosY"), 0)+Y_Margins_CU; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.UseMargins"), 0) != 0) {X_Margins_CU = Left_HUD_Margin;}; + C_Up_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.PosX"), 0)+X_Margins_CU); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.UseMargins"), 0) != 0) {X_Margins_CU = Right_HUD_Margin;}; + C_Up_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.PosX"), 0)+X_Margins_CU); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.PosType"), 0) == 3) {//Anchor None + C_Up_BTN_Pos[0] = CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.PosType"), 0) == 4) {//Hidden C_Up_BTN_Pos[0] = -9999; } } else { @@ -4251,24 +4251,24 @@ void Interface_DrawItemButtons(PlayState* play) { } //C Button down s16 C_Down_BTN_Size = 32; - float CDownScale = CVarGetFloat("gCBtnDScale", 0.87f); - if (CVarGetInteger("gCBtnDPosType", 0) == 0) { + float CDownScale = CVarGetFloat(CVAR_COSMETIC("HUD.CDownButton.Scale"), 0.87f); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 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 (CVarGetInteger("gCBtnDPosType", 0) != 0) { - C_Down_BTN_Pos[1] = CVarGetInteger("gCBtnDPosY", 0)+Y_Margins_CD; - if (CVarGetInteger("gCBtnDPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; - C_Down_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnDPosX", 0)+X_Margins_CD); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; - C_Down_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnDPosX", 0)+X_Margins_CD); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 3) {//Anchor None - C_Down_BTN_Pos[0] = CVarGetInteger("gCBtnDPosX", 0); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) != 0) { + C_Down_BTN_Pos[1] = CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosY"), 0)+Y_Margins_CD; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; + C_Down_BTN_Pos[0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0)+X_Margins_CD); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; + C_Down_BTN_Pos[0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0)+X_Margins_CD); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 3) {//Anchor None + C_Down_BTN_Pos[0] = CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 4) {//Hidden C_Down_BTN_Pos[0] = -9999; } } else { @@ -4396,22 +4396,22 @@ void Interface_DrawItemButtons(PlayState* play) { s16 Y_Margins_CL; s16 Y_Margins_CR; s16 Y_Margins_CD; - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnLPosType", 0) == 0) {X_Margins_CL = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 0) {X_Margins_CL = Right_HUD_Margin;}; Y_Margins_CL = (Top_HUD_Margin*-1); } else { X_Margins_CL = 0; Y_Margins_CL = 0; } - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnRPosType", 0) == 0) {X_Margins_CR = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 0) {X_Margins_CR = Right_HUD_Margin;}; Y_Margins_CR = (Top_HUD_Margin*-1); } else { X_Margins_CR = 0; Y_Margins_CR = 0; } - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnDPosType", 0) == 0) {X_Margins_CD = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 0) {X_Margins_CD = Right_HUD_Margin;}; Y_Margins_CD = (Top_HUD_Margin*-1); } else { X_Margins_CD = 0; @@ -4429,17 +4429,17 @@ void Interface_DrawItemButtons(PlayState* play) { }; s16 ItemIconPos[3][2]; //(X,Y) //C button Left - if (CVarGetInteger("gCBtnLPosType", 0) != 0) { - ItemIconPos[0][1] = CVarGetInteger("gCBtnLPosY", 0)+Y_Margins_CL; - if (CVarGetInteger("gCBtnLPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Left_HUD_Margin;}; - ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnLPosX", 0)+X_Margins_CL); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Right_HUD_Margin;}; - ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnLPosX", 0)+X_Margins_CL); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 3) {//Anchor None - ItemIconPos[0][0] = CVarGetInteger("gCBtnLPosX", 0); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) != 0) { + ItemIconPos[0][1] = CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosY"), 0)+Y_Margins_CL; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) {X_Margins_CL = Left_HUD_Margin;}; + ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0)+X_Margins_CL); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) {X_Margins_CL = Right_HUD_Margin;}; + ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0)+X_Margins_CL); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 3) {//Anchor None + ItemIconPos[0][0] = CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 4) {//Hidden ItemIconPos[0][0] = -9999; } } else { @@ -4447,17 +4447,17 @@ void Interface_DrawItemButtons(PlayState* play) { ItemIconPos[0][1] = ItemIconPos_ori[0][1]; } //C Button down - if (CVarGetInteger("gCBtnDPosType", 0) != 0) { - ItemIconPos[1][1] = CVarGetInteger("gCBtnDPosY", 0)+Y_Margins_CD; - if (CVarGetInteger("gCBtnDPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; - ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnDPosX", 0)+X_Margins_CD); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; - ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnDPosX", 0)+X_Margins_CD); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 3) {//Anchor None - ItemIconPos[1][0] = CVarGetInteger("gCBtnDPosX", 0); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) != 0) { + ItemIconPos[1][1] = CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosY"), 0)+Y_Margins_CD; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; + ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0)+X_Margins_CD); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; + ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0)+X_Margins_CD); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 3) {//Anchor None + ItemIconPos[1][0] = CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 4) {//Hidden ItemIconPos[1][0] = -9999; } } else { @@ -4465,17 +4465,17 @@ void Interface_DrawItemButtons(PlayState* play) { ItemIconPos[1][1] = ItemIconPos_ori[1][1]; } //C button Right - if (CVarGetInteger("gCBtnRPosType", 0) != 0) { - ItemIconPos[2][1] = CVarGetInteger("gCBtnRPosY", 0)+Y_Margins_CR; - if (CVarGetInteger("gCBtnRPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Left_HUD_Margin;}; - ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnRPosX", 0)+X_Margins_CR); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Right_HUD_Margin;}; - ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnRPosX", 0)+X_Margins_CR); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 3) {//Anchor None - ItemIconPos[2][0] = CVarGetInteger("gCBtnRPosX", 0); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) != 0) { + ItemIconPos[2][1] = CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosY"), 0)+Y_Margins_CR; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) {X_Margins_CR = Left_HUD_Margin;}; + ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0)+X_Margins_CR); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) {X_Margins_CR = Right_HUD_Margin;}; + ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0)+X_Margins_CR); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 3) {//Anchor None + ItemIconPos[2][0] = CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 4) {//Hidden ItemIconPos[2][0] = -9999; } } else { @@ -4525,36 +4525,36 @@ void Interface_DrawItemIconTexture(PlayState* play, void* texture, s16 button) { s16 Y_Margins_BtnB; s16 X_Margins_DPad_Items; s16 Y_Margins_DPad_Items; - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) { - if (CVarGetInteger("gBBtnPosType", 0) == 0) {X_Margins_BtnB = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 0) {X_Margins_BtnB = Right_HUD_Margin;}; Y_Margins_BtnB = (Top_HUD_Margin*-1); } else { X_Margins_BtnB = 0; Y_Margins_BtnB = 0; } - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnLPosType", 0) == 0) {X_Margins_CL = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 0) {X_Margins_CL = Right_HUD_Margin;}; Y_Margins_CL = (Top_HUD_Margin*-1); } else { X_Margins_CL = 0; Y_Margins_CL = 0; } - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnRPosType", 0) == 0) {X_Margins_CR = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 0) {X_Margins_CR = Right_HUD_Margin;}; Y_Margins_CR = (Top_HUD_Margin*-1); } else { X_Margins_CR = 0; Y_Margins_CR = 0; } - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnDPosType", 0) == 0) {X_Margins_CD = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 0) {X_Margins_CD = Right_HUD_Margin;}; Y_Margins_CD = (Top_HUD_Margin*-1); } else { X_Margins_CD = 0; Y_Margins_CD = 0; } - if (CVarGetInteger("gDPadUseMargins", 0) != 0) { - if (CVarGetInteger("gDPadPosType", 0) == 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; Y_Margins_DPad_Items = (Top_HUD_Margin*-1); } else { X_Margins_DPad_Items = 0; @@ -4588,29 +4588,29 @@ void Interface_DrawItemIconTexture(PlayState* play, void* texture, s16 button) { }; //(X,Y) Used with custom position to place it properly. s16 ItemIconPos[8][2]; //(X,Y) //DPadItems - if (CVarGetInteger("gDPadPosType", 0) != 0) { - ItemIconPos[4][1] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[0][1];//Up - ItemIconPos[5][1] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[1][1];//Down - ItemIconPos[6][1] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[2][1];//Left - ItemIconPos[7][1] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[3][1];//Right - if (CVarGetInteger("gDPadPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gDPadUseMargins", 0) != 0) {X_Margins_DPad_Items = Left_HUD_Margin;}; - ItemIconPos[4][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); - ItemIconPos[5][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); - ItemIconPos[6][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); - ItemIconPos[7][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); - } else if (CVarGetInteger("gDPadPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gDPadUseMargins", 0) != 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; - ItemIconPos[4][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); - ItemIconPos[5][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); - ItemIconPos[6][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); - ItemIconPos[7][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); - } else if (CVarGetInteger("gDPadPosType", 0) == 3) {//Anchor None - ItemIconPos[4][0] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[0][0]; - ItemIconPos[5][0] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[1][0]; - ItemIconPos[6][0] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[2][0]; - ItemIconPos[7][0] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[3][0]; - } else if (CVarGetInteger("gDPadPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) != 0) { + ItemIconPos[4][1] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[0][1];//Up + ItemIconPos[5][1] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[1][1];//Down + ItemIconPos[6][1] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[2][1];//Left + ItemIconPos[7][1] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[3][1];//Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) {X_Margins_DPad_Items = Left_HUD_Margin;}; + ItemIconPos[4][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); + ItemIconPos[5][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); + ItemIconPos[6][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); + ItemIconPos[7][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; + ItemIconPos[4][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); + ItemIconPos[5][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); + ItemIconPos[6][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); + ItemIconPos[7][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 3) {//Anchor None + ItemIconPos[4][0] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[0][0]; + ItemIconPos[5][0] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[1][0]; + ItemIconPos[6][0] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[2][0]; + ItemIconPos[7][0] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[3][0]; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 4) {//Hidden ItemIconPos[4][0] = -9999; ItemIconPos[5][0] = -9999; ItemIconPos[6][0] = -9999; @@ -4627,17 +4627,17 @@ void Interface_DrawItemIconTexture(PlayState* play, void* texture, s16 button) { ItemIconPos[7][1] = ItemIconPos_ori[7][1]; } //B Button - if (CVarGetInteger("gBBtnPosType", 0) != 0) { - ItemIconPos[0][1] = CVarGetInteger("gBBtnPosY", 0)+Y_Margins_BtnB; - if (CVarGetInteger("gBBtnPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Left_HUD_Margin;}; - ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gBBtnPosX", 0)+X_Margins_BtnB); - } else if (CVarGetInteger("gBBtnPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Right_HUD_Margin;}; - ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gBBtnPosX", 0)+X_Margins_BtnB); - } else if (CVarGetInteger("gBBtnPosType", 0) == 3) {//Anchor None - ItemIconPos[0][0] = CVarGetInteger("gBBtnPosX", 0); - } else if (CVarGetInteger("gBBtnPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) != 0) { + ItemIconPos[0][1] = CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosY"), 0)+Y_Margins_BtnB; + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) {X_Margins_BtnB = Left_HUD_Margin;}; + ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0)+X_Margins_BtnB); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) {X_Margins_BtnB = Right_HUD_Margin;}; + ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0)+X_Margins_BtnB); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 3) {//Anchor None + ItemIconPos[0][0] = CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 4) {//Hidden ItemIconPos[0][0] = -9999; } } else { @@ -4645,17 +4645,17 @@ void Interface_DrawItemIconTexture(PlayState* play, void* texture, s16 button) { ItemIconPos[0][1] = ItemIconPos_ori[0][1]; } //C button Left - if (CVarGetInteger("gCBtnLPosType", 0) != 0) { - ItemIconPos[1][1] = CVarGetInteger("gCBtnLPosY", 0)+Y_Margins_CL; - if (CVarGetInteger("gCBtnLPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Left_HUD_Margin;}; - ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnLPosX", 0)+X_Margins_CL); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Right_HUD_Margin;}; - ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnLPosX", 0)+X_Margins_CL); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 3) {//Anchor None - ItemIconPos[1][0] = CVarGetInteger("gCBtnLPosX", 0); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) != 0) { + ItemIconPos[1][1] = CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosY"), 0)+Y_Margins_CL; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) {X_Margins_CL = Left_HUD_Margin;}; + ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0)+X_Margins_CL); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) {X_Margins_CL = Right_HUD_Margin;}; + ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0)+X_Margins_CL); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 3) {//Anchor None + ItemIconPos[1][0] = CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 4) {//Hidden ItemIconPos[1][0] = -9999; } } else { @@ -4663,17 +4663,17 @@ void Interface_DrawItemIconTexture(PlayState* play, void* texture, s16 button) { ItemIconPos[1][1] = ItemIconPos_ori[1][1]; } //C Button down - if (CVarGetInteger("gCBtnDPosType", 0) != 0) { - ItemIconPos[2][1] = CVarGetInteger("gCBtnDPosY", 0)+Y_Margins_CD; - if (CVarGetInteger("gCBtnDPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; - ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnDPosX", 0)+X_Margins_CD); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; - ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnDPosX", 0)+X_Margins_CD); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 3) {//Anchor None - ItemIconPos[2][0] = CVarGetInteger("gCBtnDPosX", 0); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) != 0) { + ItemIconPos[2][1] = CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosY"), 0)+Y_Margins_CD; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; + ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0)+X_Margins_CD); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; + ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0)+X_Margins_CD); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 3) {//Anchor None + ItemIconPos[2][0] = CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 4) {//Hidden ItemIconPos[2][0] = -9999; } } else { @@ -4681,17 +4681,17 @@ void Interface_DrawItemIconTexture(PlayState* play, void* texture, s16 button) { ItemIconPos[2][1] = ItemIconPos_ori[2][1]; } //C button Right - if (CVarGetInteger("gCBtnRPosType", 0) != 0) { - ItemIconPos[3][1] = CVarGetInteger("gCBtnRPosY", 0)+Y_Margins_CR; - if (CVarGetInteger("gCBtnRPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Left_HUD_Margin;}; - ItemIconPos[3][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnRPosX", 0)+X_Margins_CR); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Right_HUD_Margin;}; - ItemIconPos[3][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnRPosX", 0)+X_Margins_CR); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 3) {//Anchor None - ItemIconPos[3][0] = CVarGetInteger("gCBtnRPosX", 0); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) != 0) { + ItemIconPos[3][1] = CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosY"), 0)+Y_Margins_CR; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) {X_Margins_CR = Left_HUD_Margin;}; + ItemIconPos[3][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0)+X_Margins_CR); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) {X_Margins_CR = Right_HUD_Margin;}; + ItemIconPos[3][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0)+X_Margins_CR); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 3) {//Anchor None + ItemIconPos[3][0] = CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 4) {//Hidden ItemIconPos[3][0] = -9999; } } else { @@ -4734,36 +4734,36 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { s16 Y_Margins_BtnB; s16 X_Margins_DPad_Items; s16 Y_Margins_DPad_Items; - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) { - if (CVarGetInteger("gBBtnPosType", 0) == 0) {X_Margins_BtnB = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 0) {X_Margins_BtnB = Right_HUD_Margin;}; Y_Margins_BtnB = (Top_HUD_Margin*-1); } else { X_Margins_BtnB = 0; Y_Margins_BtnB = 0; } - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnLPosType", 0) == 0) {X_Margins_CL = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 0) {X_Margins_CL = Right_HUD_Margin;}; Y_Margins_CL = (Top_HUD_Margin*-1); } else { X_Margins_CL = 0; Y_Margins_CL = 0; } - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnRPosType", 0) == 0) {X_Margins_CR = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 0) {X_Margins_CR = Right_HUD_Margin;}; Y_Margins_CR = (Top_HUD_Margin*-1); } else { X_Margins_CR = 0; Y_Margins_CR = 0; } - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnDPosType", 0) == 0) {X_Margins_CD = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 0) {X_Margins_CD = Right_HUD_Margin;}; Y_Margins_CD = (Top_HUD_Margin*-1); } else { X_Margins_CD = 0; Y_Margins_CD = 0; } - if (CVarGetInteger("gDPadUseMargins", 0) != 0) { - if (CVarGetInteger("gDPadPosType", 0) == 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; Y_Margins_DPad_Items = (Top_HUD_Margin*-1); } else { X_Margins_DPad_Items = 0; @@ -4787,29 +4787,29 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { {23,19},//Right }; //(X,Y) Used with custom position to place it properly. //DPadItems - if (CVarGetInteger("gDPadPosType", 0) != 0) { - ItemIconPos[4][1] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[0][1];//Up - ItemIconPos[5][1] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[1][1];//Down - ItemIconPos[6][1] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[2][1];//Left - ItemIconPos[7][1] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[3][1];//Right - if (CVarGetInteger("gDPadPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gDPadUseMargins", 0) != 0) {X_Margins_DPad_Items = Left_HUD_Margin;}; - ItemIconPos[4][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); - ItemIconPos[5][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); - ItemIconPos[6][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); - ItemIconPos[7][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); - } else if (CVarGetInteger("gDPadPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gDPadUseMargins", 0) != 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; - ItemIconPos[4][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); - ItemIconPos[5][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); - ItemIconPos[6][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); - ItemIconPos[7][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); - } else if (CVarGetInteger("gDPadPosType", 0) == 3) {//Anchor None - ItemIconPos[4][0] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[0][0]; - ItemIconPos[5][0] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[1][0]; - ItemIconPos[6][0] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[2][0]; - ItemIconPos[7][0] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[3][0]; - } else if (CVarGetInteger("gDPadPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) != 0) { + ItemIconPos[4][1] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[0][1];//Up + ItemIconPos[5][1] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[1][1];//Down + ItemIconPos[6][1] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[2][1];//Left + ItemIconPos[7][1] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[3][1];//Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) {X_Margins_DPad_Items = Left_HUD_Margin;}; + ItemIconPos[4][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); + ItemIconPos[5][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); + ItemIconPos[6][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); + ItemIconPos[7][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; + ItemIconPos[4][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); + ItemIconPos[5][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); + ItemIconPos[6][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); + ItemIconPos[7][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 3) {//Anchor None + ItemIconPos[4][0] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[0][0]; + ItemIconPos[5][0] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[1][0]; + ItemIconPos[6][0] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[2][0]; + ItemIconPos[7][0] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[3][0]; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 4) {//Hidden ItemIconPos[4][0] = -9999; ItemIconPos[5][0] = -9999; ItemIconPos[6][0] = -9999; @@ -4828,17 +4828,17 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { //B Button s16 PosX_adjust = 1; s16 PosY_adjust = 17; - if (CVarGetInteger("gBBtnPosType", 0) != 0) { - ItemIconPos[0][1] = CVarGetInteger("gBBtnPosY", 0)+Y_Margins_BtnB+PosY_adjust; - if (CVarGetInteger("gBBtnPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Left_HUD_Margin;}; - ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gBBtnPosX", 0)+X_Margins_BtnB+PosX_adjust); - } else if (CVarGetInteger("gBBtnPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB = Right_HUD_Margin;}; - ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gBBtnPosX", 0)+X_Margins_BtnB+PosX_adjust); - } else if (CVarGetInteger("gBBtnPosType", 0) == 3) {//Anchor None - ItemIconPos[0][0] = CVarGetInteger("gBBtnPosX", 0)+PosX_adjust; - } else if (CVarGetInteger("gBBtnPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) != 0) { + ItemIconPos[0][1] = CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosY"), 0)+Y_Margins_BtnB+PosY_adjust; + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) {X_Margins_BtnB = Left_HUD_Margin;}; + ItemIconPos[0][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0)+X_Margins_BtnB+PosX_adjust); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) {X_Margins_BtnB = Right_HUD_Margin;}; + ItemIconPos[0][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0)+X_Margins_BtnB+PosX_adjust); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 3) {//Anchor None + ItemIconPos[0][0] = CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0)+PosX_adjust; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 4) {//Hidden ItemIconPos[0][0] = -9999; } } else { @@ -4846,17 +4846,17 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { ItemIconPos[0][1] = ItemIconPos_ori[0][1]; } //C button Left - if (CVarGetInteger("gCBtnLPosType", 0) != 0) { - ItemIconPos[1][1] = CVarGetInteger("gCBtnLPosY", 0)+Y_Margins_CL+PosY_adjust; - if (CVarGetInteger("gCBtnLPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Left_HUD_Margin;}; - ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnLPosX", 0)+X_Margins_CL+PosX_adjust); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Right_HUD_Margin;}; - ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnLPosX", 0)+X_Margins_CL+PosX_adjust); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 3) {//Anchor None - ItemIconPos[1][0] = CVarGetInteger("gCBtnLPosX", 0)+PosX_adjust; - } else if (CVarGetInteger("gCBtnLPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) != 0) { + ItemIconPos[1][1] = CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosY"), 0)+Y_Margins_CL+PosY_adjust; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) {X_Margins_CL = Left_HUD_Margin;}; + ItemIconPos[1][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0)+X_Margins_CL+PosX_adjust); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) {X_Margins_CL = Right_HUD_Margin;}; + ItemIconPos[1][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0)+X_Margins_CL+PosX_adjust); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 3) {//Anchor None + ItemIconPos[1][0] = CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0)+PosX_adjust; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 4) {//Hidden ItemIconPos[1][0] = -9999; } } else { @@ -4864,17 +4864,17 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { ItemIconPos[1][1] = ItemIconPos_ori[1][1]; } //C Button down - if (CVarGetInteger("gCBtnDPosType", 0) != 0) { - ItemIconPos[2][1] = CVarGetInteger("gCBtnDPosY", 0)+Y_Margins_CD+PosY_adjust; - if (CVarGetInteger("gCBtnDPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; - ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnDPosX", 0)+X_Margins_CD+PosX_adjust); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; - ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnDPosX", 0)+X_Margins_CD+PosX_adjust); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 3) {//Anchor None - ItemIconPos[2][0] = CVarGetInteger("gCBtnDPosX", 0)+PosX_adjust; - } else if (CVarGetInteger("gCBtnDPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) != 0) { + ItemIconPos[2][1] = CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosY"), 0)+Y_Margins_CD+PosY_adjust; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; + ItemIconPos[2][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0)+X_Margins_CD+PosX_adjust); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; + ItemIconPos[2][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0)+X_Margins_CD+PosX_adjust); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 3) {//Anchor None + ItemIconPos[2][0] = CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0)+PosX_adjust; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 4) {//Hidden ItemIconPos[2][0] = -9999; } } else { @@ -4882,17 +4882,17 @@ void Interface_DrawAmmoCount(PlayState* play, s16 button, s16 alpha) { ItemIconPos[2][1] = ItemIconPos_ori[2][1]; } //C button Right - if (CVarGetInteger("gCBtnRPosType", 0) != 0) { - ItemIconPos[3][1] = CVarGetInteger("gCBtnRPosY", 0)+Y_Margins_CR+PosY_adjust; - if (CVarGetInteger("gCBtnRPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Left_HUD_Margin;}; - ItemIconPos[3][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnRPosX", 0)+X_Margins_CR+PosX_adjust); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Right_HUD_Margin;}; - ItemIconPos[3][0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnRPosX", 0)+X_Margins_CR+PosX_adjust); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 3) {//Anchor None - ItemIconPos[3][0] = CVarGetInteger("gCBtnRPosX", 0)+PosX_adjust; - } else if (CVarGetInteger("gCBtnRPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) != 0) { + ItemIconPos[3][1] = CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosY"), 0)+Y_Margins_CR+PosY_adjust; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) {X_Margins_CR = Left_HUD_Margin;}; + ItemIconPos[3][0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0)+X_Margins_CR+PosX_adjust); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) {X_Margins_CR = Right_HUD_Margin;}; + ItemIconPos[3][0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0)+X_Margins_CR+PosX_adjust); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 3) {//Anchor None + ItemIconPos[3][0] = CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0)+PosX_adjust; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 4) {//Hidden ItemIconPos[3][0] = -9999; } } else { @@ -5121,19 +5121,19 @@ void Interface_Draw(PlayState* play) { Color_RGB8 rColor; Color_RGB8 keyCountColor = { 200, 230, 255 }; - if (CVarGetInteger("gCosmetics.Hud_KeyCount.Changed", 0)) { - keyCountColor = CVarGetColor24("gCosmetics.Hud_KeyCount.Value", keyCountColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.KeyCount.Changed"), 0)) { + keyCountColor = CVarGetColor24(CVAR_COSMETIC("HUD.KeyCount.Value"), keyCountColor); } Color_RGB8 dPadColor = { 255, 255, 255 }; - if (CVarGetInteger("gCosmetics.Hud_Dpad.Changed", 0)) { - dPadColor = CVarGetColor24("gCosmetics.Hud_Dpad.Value", dPadColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.Changed"), 0)) { + dPadColor = CVarGetColor24(CVAR_COSMETIC("HUD.Dpad.Value"), dPadColor); } Color_RGB8 aButtonColor = { 90, 90, 255 }; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + aButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), aButtonColor); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = (Color_RGB8){ 0, 200, 50 }; } @@ -5155,7 +5155,7 @@ void Interface_Draw(PlayState* play) { s16 svar4; s16 svar5; s16 svar6; - bool fullUi = !CVarGetInteger("gMinimalUI", 0) || !R_MINIMAP_DISABLED || play->pauseCtx.state != 0; + bool fullUi = !CVarGetInteger(CVAR_ENHANCEMENT("MinimalUI"), 0) || !R_MINIMAP_DISABLED || play->pauseCtx.state != 0; if (GameInteractor_NoUIActive()) { return; @@ -5183,50 +5183,50 @@ void Interface_Draw(PlayState* play) { //when not having a wallet in rando, don't calculate the ruppe icon if (!IS_RANDO || Flags_GetRandomizerInf(RAND_INF_HAS_WALLET)) { // Rupee Icon - if (CVarGetInteger("gDynamicWalletIcon", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DynamicWalletIcon"), 0)) { switch (CUR_UPG_VALUE(UPG_WALLET)) { case 0: - if (CVarGetInteger("gCosmetics.Consumable_GreenRupee.Changed", 0)) { - rColor = CVarGetColor24("gCosmetics.Consumable_GreenRupee.Value", rupeeWalletColors[0]); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.GreenRupee.Changed"), 0)) { + rColor = CVarGetColor24(CVAR_COSMETIC("Consumable.GreenRupee.Value"), rupeeWalletColors[0]); } else { rColor = rupeeWalletColors[0]; } break; case 1: - if (CVarGetInteger("gCosmetics.Consumable_BlueRupee.Changed", 0)) { - rColor = CVarGetColor24("gCosmetics.Consumable_BlueRupee.Value", rupeeWalletColors[1]); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.BlueRupee.Changed"), 0)) { + rColor = CVarGetColor24(CVAR_COSMETIC("Consumable.BlueRupee.Value"), rupeeWalletColors[1]); } else { rColor = rupeeWalletColors[1]; } break; case 2: - if (CVarGetInteger("gCosmetics.Consumable_RedRupee.Changed", 0)) { - rColor = CVarGetColor24("gCosmetics.Consumable_RedRupee.Value", rupeeWalletColors[2]); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.RedRupee.Changed"), 0)) { + rColor = CVarGetColor24(CVAR_COSMETIC("Consumable.RedRupee.Value"), rupeeWalletColors[2]); } else { rColor = rupeeWalletColors[2]; } break; case 3: - if (CVarGetInteger("gCosmetics.Consumable_PurpleRupee.Changed", 0)) { - rColor = CVarGetColor24("gCosmetics.Consumable_PurpleRupee.Value", rupeeWalletColors[3]); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.PurpleRupee.Changed"), 0)) { + rColor = CVarGetColor24(CVAR_COSMETIC("Consumable.PurpleRupee.Value"), rupeeWalletColors[3]); } else { rColor = rupeeWalletColors[3]; } break; } } else { - if (CVarGetInteger("gCosmetics.Consumable_GreenRupee.Changed", rupeeWalletColors)) { - rColor = CVarGetColor24("gCosmetics.Consumable_GreenRupee.Value", rupeeWalletColors[0]); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.GreenRupee.Changed"), rupeeWalletColors)) { + rColor = CVarGetColor24(CVAR_COSMETIC("Consumable.GreenRupee.Value"), rupeeWalletColors[0]); } else { - rColor = rupeeWalletColors[0]; + rColor = rupeeWalletColors[0]; } } //Rupee icon & counter s16 X_Margins_RC; s16 Y_Margins_RC; - if (CVarGetInteger("gRCUseMargins", 0) != 0) { - if (CVarGetInteger("gRCPosType", 0) == 0) {X_Margins_RC = Left_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.PosType"), 0) == 0) {X_Margins_RC = Left_HUD_Margin;}; Y_Margins_RC = Bottom_HUD_Margin; } else { X_Margins_RC = 0; @@ -5234,18 +5234,18 @@ void Interface_Draw(PlayState* play) { } s16 PosX_RC_ori = OTRGetRectDimensionFromLeftEdge(26+X_Margins_RC); s16 PosY_RC_ori = 206+Y_Margins_RC; - if (CVarGetInteger("gRCPosType", 0) != 0) { - PosY_RC = CVarGetInteger("gRCPosY", 0)+Y_Margins_RC; - if (CVarGetInteger("gRCPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gRCUseMargins", 0) != 0) {X_Margins_RC = Left_HUD_Margin;}; - PosX_RC = OTRGetDimensionFromLeftEdge(CVarGetInteger("gRCPosX", 0)+X_Margins_RC); - } else if (CVarGetInteger("gRCPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gRCUseMargins", 0) != 0) {X_Margins_RC = Right_HUD_Margin;}; - PosX_RC = OTRGetDimensionFromRightEdge(CVarGetInteger("gRCPosX", 0)+X_Margins_RC); - } else if (CVarGetInteger("gRCPosType", 0) == 3) {//Anchor None - PosX_RC = CVarGetInteger("gRCPosX", 0); - } else if (CVarGetInteger("gRCPosType", 0) == 4) {//Hidden - PosX_RC = -9999; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.PosType"), 0) != 0) { + PosY_RC = CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.PosY"), 0)+Y_Margins_RC; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.UseMargins"), 0) != 0) {X_Margins_RC = Left_HUD_Margin;}; + PosX_RC = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.PosX"), 0)+X_Margins_RC); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.UseMargins"), 0) != 0) {X_Margins_RC = Right_HUD_Margin;}; + PosX_RC = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.PosX"), 0)+X_Margins_RC); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.PosType"), 0) == 3) {//Anchor None + PosX_RC = CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Rupees.PosType"), 0) == 4) {//Hidden + PosX_RC = -9999; } } else { PosY_RC = PosY_RC_ori; @@ -5276,8 +5276,8 @@ void Interface_Draw(PlayState* play) { if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] >= 0) { s16 X_Margins_SKC; s16 Y_Margins_SKC; - if (CVarGetInteger("gSKCUseMargins", 0) != 0) { - if (CVarGetInteger("gSKCPosType", 0) == 0) {X_Margins_SKC = Left_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.PosType"), 0) == 0) {X_Margins_SKC = Left_HUD_Margin;}; Y_Margins_SKC = Bottom_HUD_Margin; } else { X_Margins_SKC = 0; @@ -5287,17 +5287,17 @@ void Interface_Draw(PlayState* play) { s16 PosY_SKC_ori = 190+Y_Margins_SKC; s16 PosX_SKC; s16 PosY_SKC; - if (CVarGetInteger("gSKCPosType", 0) != 0) { - PosY_SKC = CVarGetInteger("gSKCPosY", 0)+Y_Margins_SKC; - if (CVarGetInteger("gSKCPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gSKCUseMargins", 0) != 0) {X_Margins_SKC = Left_HUD_Margin;}; - PosX_SKC = OTRGetDimensionFromLeftEdge(CVarGetInteger("gSKCPosX", 0)+X_Margins_SKC); - } else if (CVarGetInteger("gSKCPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gSKCUseMargins", 0) != 0) {X_Margins_SKC = Right_HUD_Margin;}; - PosX_SKC = OTRGetDimensionFromRightEdge(CVarGetInteger("gSKCPosX", 0)+X_Margins_SKC); - } else if (CVarGetInteger("gSKCPosType", 0) == 3) {//Anchor None - PosX_SKC = CVarGetInteger("gSKCPosX", 0); - } else if (CVarGetInteger("gSKCPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.PosType"), 0) != 0) { + PosY_SKC = CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.PosY"), 0)+Y_Margins_SKC; + if (CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.UseMargins"), 0) != 0) {X_Margins_SKC = Left_HUD_Margin;}; + PosX_SKC = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.PosX"), 0)+X_Margins_SKC); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.UseMargins"), 0) != 0) {X_Margins_SKC = Right_HUD_Margin;}; + PosX_SKC = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.PosX"), 0)+X_Margins_SKC); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.PosType"), 0) == 3) {//Anchor None + PosX_SKC = CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.SmallKey.PosType"), 0) == 4) {//Hidden PosX_SKC = -9999; } } else { @@ -5385,7 +5385,7 @@ void Interface_Draw(PlayState* play) { gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); } - if (CVarGetInteger("gDrawLineupTick", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DrawLineupTick"), 0)) { Interface_DrawLineupTick(play); } @@ -5396,16 +5396,16 @@ void Interface_Draw(PlayState* play) { Minimap_Draw(play); if ((R_PAUSE_MENU_MODE != 2) && (R_PAUSE_MENU_MODE != 3)) { - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { gSPMatrix(OVERLAY_DISP++, interfaceCtx->view.projectionFlippedPtr, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); } func_8002C124(&play->actorCtx.targetCtx, play); // Draw Z-Target - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { gSPMatrix(OVERLAY_DISP++, interfaceCtx->view.projectionPtr, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); } // Render enemy health bar after Z-target to leverage set variables - if (CVarGetInteger("gEnemyHealthBar", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("EnemyHealthBar"), 0)) { Interface_DrawEnemyHealthBar(&play->actorCtx.targetCtx, play); } } @@ -5460,24 +5460,24 @@ void Interface_Draw(PlayState* play) { s16 BbtnPosY; s16 X_Margins_BtnB_label; s16 Y_Margins_BtnB_label; - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) { - if (CVarGetInteger("gBBtnPosType", 0) == 0) {X_Margins_BtnB_label = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 0) {X_Margins_BtnB_label = Right_HUD_Margin;}; Y_Margins_BtnB_label = (Top_HUD_Margin*-1); } else { X_Margins_BtnB_label = 0; Y_Margins_BtnB_label = 0; } - if (CVarGetInteger("gBBtnPosType", 0) != 0) { - BbtnPosY = CVarGetInteger("gBBtnPosY", 0)+Y_Margins_BtnB_label+PosY_adjust; - if (CVarGetInteger("gBBtnPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB_label = Left_HUD_Margin;}; - BbtnPosX = OTRGetDimensionFromLeftEdge(CVarGetInteger("gBBtnPosX", 0)+X_Margins_BtnB_label+PosX_adjust); - } else if (CVarGetInteger("gBBtnPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) {X_Margins_BtnB_label = Right_HUD_Margin;}; - BbtnPosX = OTRGetDimensionFromRightEdge(CVarGetInteger("gBBtnPosX", 0)+X_Margins_BtnB_label+PosX_adjust); - } else if (CVarGetInteger("gBBtnPosType", 0) == 3) {//Anchor None - BbtnPosX = CVarGetInteger("gBBtnPosX", 0)+PosX_adjust; - } else if (CVarGetInteger("gBBtnPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) != 0) { + BbtnPosY = CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosY"), 0)+Y_Margins_BtnB_label+PosY_adjust; + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) {X_Margins_BtnB_label = Left_HUD_Margin;}; + BbtnPosX = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0)+X_Margins_BtnB_label+PosX_adjust); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) {X_Margins_BtnB_label = Right_HUD_Margin;}; + BbtnPosX = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0)+X_Margins_BtnB_label+PosX_adjust); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 3) {//Anchor None + BbtnPosX = CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosX"), 0)+PosX_adjust; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 4) {//Hidden BbtnPosX = -9999; } } else { @@ -5539,7 +5539,7 @@ void Interface_Draw(PlayState* play) { Interface_DrawAmmoCount(play, 3, interfaceCtx->cRightAlpha); } - if (CVarGetInteger("gDpadEquips", 0) != 0) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { // DPad is only greyed-out when all 4 DPad directions are too uint16_t dpadAlpha = MAX(MAX(MAX(interfaceCtx->dpadUpAlpha, interfaceCtx->dpadDownAlpha), interfaceCtx->dpadLeftAlpha), @@ -5550,24 +5550,24 @@ void Interface_Draw(PlayState* play) { s16 DpadPosY; s16 X_Margins_Dpad; s16 Y_Margins_Dpad; - if (CVarGetInteger("gDPadUseMargins", 0) != 0) { - if (CVarGetInteger("gDPadPosType", 0) == 0) {X_Margins_Dpad = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 0) {X_Margins_Dpad = Right_HUD_Margin;}; Y_Margins_Dpad = (Top_HUD_Margin*-1); } else { Y_Margins_Dpad = 0; X_Margins_Dpad = 0; } - if (CVarGetInteger("gDPadPosType", 0) != 0) { - DpadPosY = CVarGetInteger("gDPadPosY", 0)+Y_Margins_Dpad; - if (CVarGetInteger("gDPadPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gDPadUseMargins", 0) != 0) {X_Margins_Dpad = Left_HUD_Margin;}; - DpadPosX = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_Dpad); - } else if (CVarGetInteger("gDPadPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gDPadUseMargins", 0) != 0) {X_Margins_Dpad = Right_HUD_Margin;}; - DpadPosX = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_Dpad); - } else if (CVarGetInteger("gDPadPosType", 0) == 3) {//Anchor None - DpadPosX = CVarGetInteger("gDPadPosX", 0); - } else if (CVarGetInteger("gDPadPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) != 0) { + DpadPosY = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_Dpad; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) {X_Margins_Dpad = Left_HUD_Margin;}; + DpadPosX = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_Dpad); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) {X_Margins_Dpad = Right_HUD_Margin;}; + DpadPosX = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_Dpad); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 3) {//Anchor None + DpadPosX = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 4) {//Hidden DpadPosX = -9999; } } else { @@ -5636,7 +5636,7 @@ void Interface_Draw(PlayState* play) { Gfx_SetupDL_42Overlay(play->state.gfxCtx); s16 X_Margins_BtnA; s16 Y_Margins_BtnA; - if (CVarGetInteger("gABtnUseMargins", 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.UseMargins"), 0) != 0) { X_Margins_BtnA = Right_HUD_Margin; Y_Margins_BtnA = (Top_HUD_Margin*-1); } else { @@ -5651,21 +5651,21 @@ void Interface_Draw(PlayState* play) { s16 PosY_BtnA; s16 rAIconX; s16 rAIconY; - if (CVarGetInteger("gABtnPosType", 0) != 0) { - PosY_BtnA = CVarGetInteger("gABtnPosY", 0)+Y_Margins_BtnA; + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosType"), 0) != 0) { + PosY_BtnA = CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosY"), 0)+Y_Margins_BtnA; rAIconY = 98.0f - PosY_BtnA; - if (CVarGetInteger("gABtnPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gABtnUseMargins", 0) != 0) {X_Margins_BtnA = Left_HUD_Margin;}; - PosX_BtnA = OTRGetDimensionFromLeftEdge(CVarGetInteger("gABtnPosX", 0)+X_Margins_BtnA); - rAIconX = OTRGetDimensionFromLeftEdge(CVarGetInteger("gABtnPosX", 0)+X_Margins_BtnA); - } else if (CVarGetInteger("gABtnPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gABtnUseMargins", 0) != 0) {X_Margins_BtnA = Right_HUD_Margin;}; - PosX_BtnA = OTRGetDimensionFromRightEdge(CVarGetInteger("gABtnPosX", 0)+X_Margins_BtnA); - rAIconX= OTRGetDimensionFromRightEdge(CVarGetInteger("gABtnPosX", 0)+X_Margins_BtnA); - } else if (CVarGetInteger("gABtnPosType", 0) == 3) {//Anchor None - PosX_BtnA = CVarGetInteger("gABtnPosX", 0); - rAIconX = CVarGetInteger("gABtnPosX", 0); - } else if (CVarGetInteger("gABtnPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.UseMargins"), 0) != 0) {X_Margins_BtnA = Left_HUD_Margin;}; + PosX_BtnA = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosX"), 0)+X_Margins_BtnA); + rAIconX = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosX"), 0)+X_Margins_BtnA); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.UseMargins"), 0) != 0) {X_Margins_BtnA = Right_HUD_Margin;}; + PosX_BtnA = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosX"), 0)+X_Margins_BtnA); + rAIconX= OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosX"), 0)+X_Margins_BtnA); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosType"), 0) == 3) {//Anchor None + PosX_BtnA = CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosX"), 0); + rAIconX = CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.PosType"), 0) == 4) {//Hidden PosX_BtnA = -9999; rAIconX = -9999; } @@ -5759,7 +5759,7 @@ void Interface_Draw(PlayState* play) { if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0)) { if (gSaveContext.minigameState != 1) { // Carrots rendering if the action corresponds to riding a horse - if (interfaceCtx->unk_1EE == 8 && !CVarGetInteger("gInfiniteEpona", 0)) { + if (interfaceCtx->unk_1EE == 8 && !CVarGetInteger(CVAR_CHEAT("InfiniteEponaBoost"), 0)) { // Load Carrot Icon gDPLoadTextureBlock(OVERLAY_DISP++, gCarrotIconTex, G_IM_FMT_RGBA, G_IM_SIZ_32b, 16, 16, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, @@ -5769,17 +5769,17 @@ void Interface_Draw(PlayState* play) { s16 CarrotsPosX = ZREG(14); s16 CarrotsPosY = ZREG(15); s16 CarrotsMargins_X = 0; - if (CVarGetInteger("gCarrotsPosType", 0) != 0) { - CarrotsPosY = CVarGetInteger("gCarrotsPosY", 0); - if (CVarGetInteger("gCarrotsPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCarrotsUseMargins", 0) != 0) {CarrotsMargins_X = Left_HUD_Margin;}; - CarrotsPosX = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCarrotsPosX", 0)+CarrotsMargins_X); - } else if (CVarGetInteger("gCarrotsPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCarrotsUseMargins", 0) != 0) {CarrotsMargins_X = Right_HUD_Margin;}; - CarrotsPosX = OTRGetDimensionFromRightEdge(CVarGetInteger("gCarrotsPosX", 0)+CarrotsMargins_X); - } else if (CVarGetInteger("gCarrotsPosType", 0) == 3) {//Anchor None - CarrotsPosX = CVarGetInteger("gCarrotsPosX", 0); - } else if (CVarGetInteger("gCarrotsPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.Carrots.PosType"), 0) != 0) { + CarrotsPosY = CVarGetInteger(CVAR_COSMETIC("HUD.Carrots.PosY"), 0); + if (CVarGetInteger(CVAR_COSMETIC("HUD.Carrots.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Carrots.UseMargins"), 0) != 0) {CarrotsMargins_X = Left_HUD_Margin;}; + CarrotsPosX = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Carrots.PosX"), 0)+CarrotsMargins_X); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Carrots.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Carrots.UseMargins"), 0) != 0) {CarrotsMargins_X = Right_HUD_Margin;}; + CarrotsPosX = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Carrots.PosX"), 0)+CarrotsMargins_X); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Carrots.PosType"), 0) == 3) {//Anchor None + CarrotsPosX = CVarGetInteger(CVAR_COSMETIC("HUD.Carrots.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Carrots.PosType"), 0) == 4) {//Hidden CarrotsPosX = -9999; } } @@ -5798,25 +5798,25 @@ void Interface_Draw(PlayState* play) { } else { // Score for the Horseback Archery s32 X_Margins_Archery; - if (CVarGetInteger("gASUseMargins", 0) != 0) { - if (CVarGetInteger("gASPosType", 0) == 0) {X_Margins_Archery = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.PosType"), 0) == 0) {X_Margins_Archery = Right_HUD_Margin;}; } else { X_Margins_Archery = 0; } s16 ArcheryPos_Y = ZREG(15); s16 ArcheryPos_X = OTRGetRectDimensionFromRightEdge(WREG(32)+X_Margins_Archery); - if (CVarGetInteger("gASPosType", 0) != 0) { - ArcheryPos_Y = CVarGetInteger("gASPosY", 0); - if (CVarGetInteger("gASPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gASUseMargins", 0) != 0) {X_Margins_Archery = Left_HUD_Margin;}; - ArcheryPos_X = OTRGetRectDimensionFromLeftEdge(CVarGetInteger("gASPosX", 0)+X_Margins_Archery); - } else if (CVarGetInteger("gASPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gASUseMargins", 0) != 0) {X_Margins_Archery = Right_HUD_Margin;}; - ArcheryPos_X = OTRGetRectDimensionFromRightEdge(CVarGetInteger("gASPosX", 0)+X_Margins_Archery); - } else if (CVarGetInteger("gASPosType", 0) == 3) {//Anchor None - ArcheryPos_X = CVarGetInteger("gASPosX", 0)+204+X_Margins_Archery; - } else if (CVarGetInteger("gASPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.PosType"), 0) != 0) { + ArcheryPos_Y = CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.PosY"), 0); + if (CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.UseMargins"), 0) != 0) {X_Margins_Archery = Left_HUD_Margin;}; + ArcheryPos_X = OTRGetRectDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.PosX"), 0)+X_Margins_Archery); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.UseMargins"), 0) != 0) {X_Margins_Archery = Right_HUD_Margin;}; + ArcheryPos_X = OTRGetRectDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.PosX"), 0)+X_Margins_Archery); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.PosType"), 0) == 3) {//Anchor None + ArcheryPos_X = CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.PosX"), 0)+204+X_Margins_Archery; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.ArcheryScore.PosType"), 0) == 4) {//Hidden ArcheryPos_X = -9999; } } @@ -6236,24 +6236,24 @@ void Interface_Draw(PlayState* play) { gDPSetPrimColor(OVERLAY_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(OVERLAY_DISP++, 0, 0, 0, 0); s32 X_Margins_Timer; - if (CVarGetInteger("gTimersUseMargins", 0) != 0) { - if (CVarGetInteger("gTimersPosType", 0) == 0) {X_Margins_Timer = Left_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Timers.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Timers.PosType"), 0) == 0) {X_Margins_Timer = Left_HUD_Margin;}; } else { X_Margins_Timer = 0; } svar5 = OTRGetRectDimensionFromLeftEdge(gSaveContext.timerX[svar6]+X_Margins_Timer); svar2 = gSaveContext.timerY[svar6]; - if (CVarGetInteger("gTimersPosType", 0) != 0) { - svar2 = (CVarGetInteger("gTimersPosY", 0)); - if (CVarGetInteger("gTimersPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gTimersUseMargins", 0) != 0) {X_Margins_Timer = Left_HUD_Margin;}; - svar5 = OTRGetRectDimensionFromLeftEdge(CVarGetInteger("gTimersPosX", 0)+X_Margins_Timer); - } else if (CVarGetInteger("gTimersPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gTimersUseMargins", 0) != 0) {X_Margins_Timer = Right_HUD_Margin;}; - svar5 = OTRGetRectDimensionFromRightEdge(CVarGetInteger("gTimersPosX", 0)+X_Margins_Timer); - } else if (CVarGetInteger("gTimersPosType", 0) == 3) {//Anchor None - svar5 = CVarGetInteger("gTimersPosX", 0)+204+X_Margins_Timer; - } else if (CVarGetInteger("gTimersPosType", 0) == 4) {//Hidden + if (CVarGetInteger(CVAR_COSMETIC("HUD.Timers.PosType"), 0) != 0) { + svar2 = (CVarGetInteger(CVAR_COSMETIC("HUD.Timers.PosY"), 0)); + if (CVarGetInteger(CVAR_COSMETIC("HUD.Timers.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Timers.UseMargins"), 0) != 0) {X_Margins_Timer = Left_HUD_Margin;}; + svar5 = OTRGetRectDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Timers.PosX"), 0)+X_Margins_Timer); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Timers.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Timers.UseMargins"), 0) != 0) {X_Margins_Timer = Right_HUD_Margin;}; + svar5 = OTRGetRectDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Timers.PosX"), 0)+X_Margins_Timer); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Timers.PosType"), 0) == 3) {//Anchor None + svar5 = CVarGetInteger(CVAR_COSMETIC("HUD.Timers.PosX"), 0)+204+X_Margins_Timer; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Timers.PosType"), 0) == 4) {//Hidden svar5 = -9999; } } @@ -6312,31 +6312,31 @@ void Interface_DrawTotalGameplayTimer(PlayState* play) { // Draw timer based on the Gameplay Stats total time. if ((IS_BOSS_RUSH && gSaveContext.bossRushOptions[BR_OPTIONS_TIMER] == BR_CHOICE_TIMER_YES) || - (CVarGetInteger("gGameplayStats.ShowIngameTimer", 0) && gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2)) { + (CVarGetInteger(CVAR_ENHANCEMENT("GameplayStats.ShowIngameTimer"), 0) && gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2)) { s32 X_Margins_Timer = 0; - if (CVarGetInteger("gIGTUseMargins", 0) != 0) { - if (CVarGetInteger("gIGTPosType", 0) == 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.IGT.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.IGT.PosType"), 0) == 0) { X_Margins_Timer = Left_HUD_Margin; }; } s32 rectLeftOri = OTRGetRectDimensionFromLeftEdge(24 + X_Margins_Timer); s32 rectTopOri = 73; - if (CVarGetInteger("gIGTPosType", 0) != 0) { - rectTopOri = (CVarGetInteger("gIGTPosY", 0)); - if (CVarGetInteger("gIGTPosType", 0) == 1) { // Anchor Left - if (CVarGetInteger("gIGTUseMargins", 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.IGT.PosType"), 0) != 0) { + rectTopOri = (CVarGetInteger(CVAR_COSMETIC("HUD.IGT.PosY"), 0)); + if (CVarGetInteger(CVAR_COSMETIC("HUD.IGT.PosType"), 0) == 1) { // Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.IGT.UseMargins"), 0) != 0) { X_Margins_Timer = Left_HUD_Margin; }; - rectLeftOri = OTRGetRectDimensionFromLeftEdge(CVarGetInteger("gIGTPosX", 0) + X_Margins_Timer); - } else if (CVarGetInteger("gIGTPosType", 0) == 2) { // Anchor Right - if (CVarGetInteger("gIGTUseMargins", 0) != 0) { + rectLeftOri = OTRGetRectDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.IGT.PosX"), 0) + X_Margins_Timer); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.IGT.PosType"), 0) == 2) { // Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.IGT.UseMargins"), 0) != 0) { X_Margins_Timer = Right_HUD_Margin; }; - rectLeftOri = OTRGetRectDimensionFromRightEdge(CVarGetInteger("gIGTPosX", 0) + X_Margins_Timer); - } else if (CVarGetInteger("gIGTPosType", 0) == 3) { // Anchor None - rectLeftOri = CVarGetInteger("gIGTPosX", 0) + 204 + X_Margins_Timer; - } else if (CVarGetInteger("gIGTPosType", 0) == 4) { // Hidden + rectLeftOri = OTRGetRectDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.IGT.PosX"), 0) + X_Margins_Timer); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.IGT.PosType"), 0) == 3) { // Anchor None + rectLeftOri = CVarGetInteger(CVAR_COSMETIC("HUD.IGT.PosX"), 0) + 204 + X_Margins_Timer; + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.IGT.PosType"), 0) == 4) { // Hidden rectLeftOri = -9999; } } @@ -6423,10 +6423,10 @@ void Interface_Update(PlayState* play) { u16 action; Input* debugInput = &play->state.input[2]; - Top_HUD_Margin = CVarGetInteger("gHUDMargin_T", 0); - Left_HUD_Margin = CVarGetInteger("gHUDMargin_L", 0); - Right_HUD_Margin = CVarGetInteger("gHUDMargin_R", 0); - Bottom_HUD_Margin = CVarGetInteger("gHUDMargin_B", 0); + Top_HUD_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.T"), 0); + Left_HUD_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.L"), 0); + Right_HUD_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.R"), 0); + Bottom_HUD_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.B"), 0); GameInteractor_ExecuteOnInterfaceUpdate(); @@ -6573,11 +6573,11 @@ void Interface_Update(PlayState* play) { D_80125A58 = Player_GetEnvironmentalHazard(play); if (D_80125A58 == 1) { - if (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) == EQUIP_VALUE_TUNIC_GORON || CVarGetInteger("gSuperTunic", 0) != 0) { + if (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) == EQUIP_VALUE_TUNIC_GORON || CVarGetInteger(CVAR_CHEAT("SuperTunic"), 0) != 0) { D_80125A58 = 0; } } else if ((Player_GetEnvironmentalHazard(play) >= 2) && (Player_GetEnvironmentalHazard(play) < 5)) { - if (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) == EQUIP_VALUE_TUNIC_ZORA || CVarGetInteger("gSuperTunic", 0) != 0) { + if (CUR_EQUIP_VALUE(EQUIP_TYPE_TUNIC) == EQUIP_VALUE_TUNIC_ZORA || CVarGetInteger(CVAR_CHEAT("SuperTunic"), 0) != 0) { D_80125A58 = 0; } } diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index 4e27e6cb8..a54314d00 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -498,12 +498,6 @@ void Play_Init(GameState* thisx) { gTrnsnUnkState = 0; play->transitionMode = TRANS_MODE_OFF; - if (CVarGetInteger("gSceneTransitions", 255)!= 255){ - play->transitionMode = CVarGetInteger("gSceneTransitions", 0); - gSaveContext.nextTransitionType = CVarGetInteger("gSceneTransitions", 0); - play->transitionType = CVarGetInteger("gSceneTransitions", 0); - } - FrameAdvance_Init(&play->frameAdvCtx); Rand_Seed((u32)osGetTime()); Matrix_Init(&play->state); @@ -546,7 +540,7 @@ void Play_Init(GameState* thisx) { Fault_AddClient(&D_801614B8, ZeldaArena_Display, NULL, NULL); // In order to keep bunny hood equipped on first load, we need to pre-set the age reqs for the item and slot - if ((CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && CVarGetInteger("gAdultBunnyHood", 0)) || CVarGetInteger("gTimelessEquipment", 0)) { + if ((CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && CVarGetInteger(CVAR_ENHANCEMENT("AdultBunnyHood"), 0)) || CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0)) { gItemAgeReqs[ITEM_MASK_BUNNY] = AGE_REQ_NONE; if(INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY) gSlotAgeReqs[SLOT_TRADE_CHILD] = AGE_REQ_NONE; @@ -633,7 +627,7 @@ void Play_Init(GameState* thisx) { } #endif - if (CVarGetInteger("gIvanCoopModeEnabled", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0)) { Actor_Spawn(&play->actorCtx, play, gEnPartnerId, GET_PLAYER(play)->actor.world.pos.x, GET_PLAYER(play)->actor.world.pos.y + Player_GetHeight(GET_PLAYER(play)) + 5.0f, GET_PLAYER(play)->actor.world.pos.z, 0, 0, 0, 1, true); @@ -671,7 +665,7 @@ void Play_Update(PlayState* play) { HREG(82) = 0; } - if (CVarGetInteger("gFreeCamera", 0) && Player_InCsMode(play)) { + if (CVarGetInteger(CVAR_SETTING("FreeLook.Enabled"), 0) && Player_InCsMode(play)) { play->manualCamera = false; } @@ -1087,7 +1081,7 @@ void Play_Update(PlayState* play) { gSaveContext.sohStats.sceneTimer++; gSaveContext.sohStats.roomTimer++; - if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && Player_GetMask(play) == PLAYER_MASK_BUNNY) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && Player_GetMask(play) == PLAYER_MASK_BUNNY) { gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD]++; } } @@ -1376,7 +1370,7 @@ void Play_Draw(PlayState* play) { // Flip the projections and invert culling for the OPA and XLU display buffers // These manage the world and effects - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { gSPSetExtraGeometryMode(POLY_OPA_DISP++, G_EX_INVERT_CULLING); gSPSetExtraGeometryMode(POLY_XLU_DISP++, G_EX_INVERT_CULLING); gSPMatrix(POLY_OPA_DISP++, play->view.projectionFlippedPtr, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); @@ -1610,7 +1604,7 @@ void Play_Draw(PlayState* play) { GameInteractor_ExecuteOnPlayDrawEnd(); // Reset the inverted culling - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { gSPClearExtraGeometryMode(POLY_OPA_DISP++, G_EX_INVERT_CULLING); gSPClearExtraGeometryMode(POLY_XLU_DISP++, G_EX_INVERT_CULLING); } @@ -1658,11 +1652,11 @@ void Play_Main(GameState* thisx) { PlayState* play = (PlayState*)thisx; // Decrease the easy pause buffer timer every frame - if (CVarGetInteger("gCheatEasyPauseBufferTimer", 0) > 0) { - CVarSetInteger("gCheatEasyPauseBufferTimer", CVarGetInteger("gCheatEasyPauseBufferTimer", 0) - 1); + if (CVarGetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 0) > 0) { + CVarSetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), CVarGetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 0) - 1); } - if (play->envCtx.unk_EE[2] == 0 && CVarGetInteger("gLetItSnow", 0)) { + if (play->envCtx.unk_EE[2] == 0 && CVarGetInteger(CVAR_GENERAL("LetItSnow"), 0)) { play->envCtx.unk_EE[3] = 64; Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_OBJECT_KANKYO, 0, 0, 0, 0, 0, 0, 3, 0); } @@ -1708,7 +1702,7 @@ void Play_Main(GameState* thisx) { LOG_NUM("1", 1); } - if (CVarGetInteger("gTimeSync", 0)) { + if (CVarGetInteger(CVAR_CHEAT("TimeSync"), 0)) { const int maxRealDaySeconds = 86400; const int maxInGameDayTicks = 65536; @@ -1839,11 +1833,11 @@ void Play_InitScene(PlayState* play, s32 spawn) } void Play_SpawnScene(PlayState* play, s32 sceneNum, s32 spawn) { - uint8_t mqMode = CVarGetInteger("gBetterDebugWarpScreenMQMode", WARP_MODE_OVERRIDE_OFF); - int16_t mqModeScene = CVarGetInteger("gBetterDebugWarpScreenMQModeScene", -1); + uint8_t mqMode = CVarGetInteger(CVAR_GENERAL("BetterDebugWarpScreenMQMode"), WARP_MODE_OVERRIDE_OFF); + int16_t mqModeScene = CVarGetInteger(CVAR_GENERAL("BetterDebugWarpScreenMQModeScene"), -1); if (mqMode != WARP_MODE_OVERRIDE_OFF && sceneNum != mqModeScene) { - CVarClear("gBetterDebugWarpScreenMQMode"); - CVarClear("gBetterDebugWarpScreenMQModeScene"); + CVarClear(CVAR_GENERAL("BetterDebugWarpScreenMQMode")); + CVarClear(CVAR_GENERAL("BetterDebugWarpScreenMQModeScene")); } OTRPlay_SpawnScene(play, sceneNum, spawn); @@ -2226,7 +2220,7 @@ void Play_PerformSave(PlayState* play) { IS_RANDO && gSaveContext.triforcePiecesCollected == (Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) + 1) && Randomizer_GetSettingValue(RSK_TRIFORCE_HUNT); - if (CVarGetInteger("gAutosave", AUTOSAVE_OFF) != AUTOSAVE_OFF || triforceHuntCompleted) { + if (CVarGetInteger(CVAR_ENHANCEMENT("Autosave"), AUTOSAVE_OFF) != AUTOSAVE_OFF || triforceHuntCompleted) { Overlay_DisplayText(3.0f, "Game Saved"); } } diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 932524ab2..f5c529a66 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -597,12 +597,12 @@ s32 Player_ActionToModelGroup(Player* this, s32 actionParam) { void Player_SetModelsForHoldingShield(Player* this) { if ((this->stateFlags1 & PLAYER_STATE1_SHIELDING) && ((this->itemAction < 0) || (this->itemAction == this->heldItemAction))) { - if ((CVarGetInteger("gShieldTwoHanded", 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK) || + if ((CVarGetInteger(CVAR_CHEAT("ShieldTwoHanded"), 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK) || !Player_HoldsTwoHandedWeapon(this)) && !Player_IsChildWithHylianShield(this)) { this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD; - if (LINK_IS_CHILD && (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && (this->currentShield == PLAYER_SHIELD_MIRROR)) { + if (LINK_IS_CHILD && (CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) && (this->currentShield == PLAYER_SHIELD_MIRROR)) { this->rightHandDLists = &sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD][0]; - } else if (LINK_IS_ADULT && (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && (this->currentShield == PLAYER_SHIELD_DEKU)) { + } else if (LINK_IS_ADULT && (CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) && (this->currentShield == PLAYER_SHIELD_DEKU)) { this->rightHandDLists = &sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD][1]; } else { this->rightHandDLists = &sPlayerDListGroups[PLAYER_MODELTYPE_RH_SHIELD][gSaveContext.linkAge]; @@ -613,7 +613,7 @@ void Player_SetModelsForHoldingShield(Player* this) { this->sheathType = PLAYER_MODELTYPE_SHEATH_17; } this->sheathDLists = &sPlayerDListGroups[this->sheathType][gSaveContext.linkAge]; - if ((CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && LINK_IS_CHILD && + if ((CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) && LINK_IS_CHILD && gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI) { this->sheathDLists = &sPlayerDListGroups[this->sheathType][0]; } @@ -628,7 +628,7 @@ void Player_SetModels(Player* this, s32 modelGroup) { this->leftHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_LEFT_HAND]; this->leftHandDLists = &sPlayerDListGroups[this->leftHandType][gSaveContext.linkAge]; - if (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) { if (LINK_IS_CHILD && (this->leftHandType == PLAYER_MODELTYPE_LH_HAMMER || ((this->leftHandType == PLAYER_MODELTYPE_LH_SWORD || this->leftHandType == PLAYER_MODELTYPE_LH_BGS) && @@ -649,7 +649,7 @@ void Player_SetModels(Player* this, s32 modelGroup) { this->rightHandType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_RIGHT_HAND]; this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][gSaveContext.linkAge]; - if (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) { if (LINK_IS_CHILD && (this->rightHandType == PLAYER_MODELTYPE_RH_HOOKSHOT || (this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD && this->currentShield == PLAYER_SHIELD_MIRROR))) { @@ -660,7 +660,7 @@ void Player_SetModels(Player* this, s32 modelGroup) { this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][1]; } } - if ((CVarGetInteger("gBowSlingShotAmmoFix", 0) || CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && this->rightHandType == 11) { // If holding Bow/Slingshot + if ((CVarGetInteger(CVAR_ENHANCEMENT("BowSlingshotAmmoFix"), 0) || CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) && this->rightHandType == 11) { // If holding Bow/Slingshot this->rightHandDLists = &sPlayerDListGroups[this->rightHandType][Player_HoldsSlingshot(this)]; } @@ -668,7 +668,7 @@ void Player_SetModels(Player* this, s32 modelGroup) { this->sheathType = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH]; this->sheathDLists = &sPlayerDListGroups[this->sheathType][gSaveContext.linkAge]; - if (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) { if (LINK_IS_CHILD && (this->currentShield == PLAYER_SHIELD_HYLIAN || this->currentShield == PLAYER_SHIELD_MIRROR) && ((gSaveContext.equips.buttonItems[0] == ITEM_SWORD_MASTER) || @@ -789,11 +789,11 @@ s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 xzRange, f32 y s32 Player_GetStrength(void) { s32 strengthUpgrade = CUR_UPG_VALUE(UPG_STRENGTH); - if (CVarGetInteger("gToggleStrength", 0) && CVarGetInteger("gStrengthDisabled", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("StrengthDisabled"), 0)) { return PLAYER_STR_NONE; } - if (CVarGetInteger("gTimelessEquipment", 0) || LINK_IS_ADULT) { + if (CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0) || LINK_IS_ADULT) { return strengthUpgrade; } else if (strengthUpgrade != 0) { return PLAYER_STR_BRACELET; @@ -953,9 +953,9 @@ s32 Player_GetEnvironmentalHazard(PlayState* play) { triggerEntry = &sTextTriggers[var]; if ((triggerEntry->flag != 0) && !(gSaveContext.textTriggerFlags & triggerEntry->flag) && - (((var == 0) && (this->currentTunic != PLAYER_TUNIC_GORON && CVarGetInteger("gSuperTunic", 0) == 0 && CVarGetInteger("gDisableTunicWarningText", 0) == 0)) || + (((var == 0) && (this->currentTunic != PLAYER_TUNIC_GORON && CVarGetInteger(CVAR_CHEAT("SuperTunic"), 0) == 0 && CVarGetInteger(CVAR_ENHANCEMENT("DisableTunicWarningText"), 0) == 0)) || (((var == 1) || (var == 3)) && (this->currentBoots == PLAYER_BOOTS_IRON) && - (this->currentTunic != PLAYER_TUNIC_ZORA && CVarGetInteger("gSuperTunic", 0) == 0 && CVarGetInteger("gDisableTunicWarningText", 0) == 0)))) { + (this->currentTunic != PLAYER_TUNIC_ZORA && CVarGetInteger(CVAR_CHEAT("SuperTunic"), 0) == 0 && CVarGetInteger(CVAR_ENHANCEMENT("DisableTunicWarningText"), 0) == 0)))) { Message_StartTextbox(play, triggerEntry->textId, NULL); gSaveContext.textTriggerFlags |= triggerEntry->flag; } @@ -1068,14 +1068,14 @@ void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dL Color_RGB8 sTemp; color = &sTunicColors[tunic]; - if (tunic == PLAYER_TUNIC_KOKIRI && CVarGetInteger("gCosmetics.Link_KokiriTunic.Changed", 0)) { - sTemp = CVarGetColor24("gCosmetics.Link_KokiriTunic.Value", sTunicColors[PLAYER_TUNIC_KOKIRI]); + if (tunic == PLAYER_TUNIC_KOKIRI && CVarGetInteger(CVAR_COSMETIC("Link.KokiriTunic.Changed"), 0)) { + sTemp = CVarGetColor24(CVAR_COSMETIC("Link.KokiriTunic.Value"), sTunicColors[PLAYER_TUNIC_KOKIRI]); color = &sTemp; - } else if (tunic == PLAYER_TUNIC_GORON && CVarGetInteger("gCosmetics.Link_GoronTunic.Changed", 0)) { - sTemp = CVarGetColor24("gCosmetics.Link_GoronTunic.Value", sTunicColors[PLAYER_TUNIC_GORON]); + } else if (tunic == PLAYER_TUNIC_GORON && CVarGetInteger(CVAR_COSMETIC("Link.GoronTunic.Changed"), 0)) { + sTemp = CVarGetColor24(CVAR_COSMETIC("Link.GoronTunic.Value"), sTunicColors[PLAYER_TUNIC_GORON]); color = &sTemp; - } else if (tunic == PLAYER_TUNIC_ZORA && CVarGetInteger("gCosmetics.Link_ZoraTunic.Changed", 0)) { - sTemp = CVarGetColor24("gCosmetics.Link_ZoraTunic.Value", sTunicColors[PLAYER_TUNIC_ZORA]); + } else if (tunic == PLAYER_TUNIC_ZORA && CVarGetInteger(CVAR_COSMETIC("Link.ZoraTunic.Changed"), 0)) { + sTemp = CVarGetColor24(CVAR_COSMETIC("Link.ZoraTunic.Value"), sTunicColors[PLAYER_TUNIC_ZORA]); color = &sTemp; } @@ -1090,7 +1090,7 @@ void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dL SkelAnime_DrawFlexLod(play, skeleton, jointTable, dListCount, overrideLimbDraw, postLimbDraw, data, lod); - if (((CVarGetInteger("gFPSGauntlets", 0) && LINK_IS_ADULT) || (overrideLimbDraw != Player_OverrideLimbDrawGameplayFirstPerson)) && + if (((CVarGetInteger(CVAR_ENHANCEMENT("FirstPersonGauntlets"), 0) && LINK_IS_ADULT) || (overrideLimbDraw != Player_OverrideLimbDrawGameplayFirstPerson)) && (overrideLimbDraw != Player_OverrideLimbDrawGameplayCrawling) && (gSaveContext.gameMode != 3)) { if (LINK_IS_ADULT) { @@ -1100,11 +1100,11 @@ void Player_DrawImpl(PlayState* play, void** skeleton, Vec3s* jointTable, s32 dL gDPPipeSync(POLY_OPA_DISP++); color = &sGauntletColors[strengthUpgrade - 2]; - if (strengthUpgrade == PLAYER_STR_SILVER_G && CVarGetInteger("gCosmetics.Gloves_SilverGauntlets.Changed", 0)) { - sTemp = CVarGetColor24("gCosmetics.Gloves_SilverGauntlets.Value", sGauntletColors[PLAYER_STR_SILVER_G - 2]); + if (strengthUpgrade == PLAYER_STR_SILVER_G && CVarGetInteger(CVAR_COSMETIC("Gloves.SilverGauntlets.Changed"), 0)) { + sTemp = CVarGetColor24(CVAR_COSMETIC("Gloves.SilverGauntlets.Value"), sGauntletColors[PLAYER_STR_SILVER_G - 2]); color = &sTemp; - } else if (strengthUpgrade == PLAYER_STR_GOLD_G && CVarGetInteger("gCosmetics.Gloves_GoldenGauntlets.Changed", 0)) { - sTemp = CVarGetColor24("gCosmetics.Gloves_GoldenGauntlets.Value", sGauntletColors[PLAYER_STR_GOLD_G - 2]); + } else if (strengthUpgrade == PLAYER_STR_GOLD_G && CVarGetInteger(CVAR_COSMETIC("Gloves.GoldenGauntlets.Changed"), 0)) { + sTemp = CVarGetColor24(CVAR_COSMETIC("Gloves.GoldenGauntlets.Value"), sGauntletColors[PLAYER_STR_GOLD_G - 2]); color = &sTemp; } gDPSetEnvColor(POLY_OPA_DISP++, color->r, color->g, color->b, 0); @@ -1243,7 +1243,7 @@ void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* p s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* thisx) { Player* this = (Player*)thisx; - if (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0) && CVarGetInteger("gEnhancements.ScaleAdultEquimentAsChild", 0) && LINK_IS_CHILD) { + if (CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("ScaleAdultEquimentAsChild"), 0) && LINK_IS_CHILD) { if (limbIndex == PLAYER_LIMB_L_HAND) { if ((gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI && sLeftHandType == PLAYER_MODELTYPE_LH_SWORD) || (sLeftHandType == PLAYER_MODELTYPE_LH_BGS) || (sLeftHandType == PLAYER_MODELTYPE_LH_HAMMER)) { @@ -1310,8 +1310,8 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** } if (limbIndex == PLAYER_LIMB_HEAD) { - if (CVarGetInteger("gCosmetics.Link_HeadScale.Changed", 0)) { - f32 scale = CVarGetFloat("gCosmetics.Link_HeadScale.Value", 1.0f); + if (CVarGetInteger(CVAR_COSMETIC("Link.HeadScale.Changed"), 0)) { + f32 scale = CVarGetFloat(CVAR_COSMETIC("Link.HeadScale.Value"), 1.0f); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); if (scale > 1.2f) { Matrix_Translate(-((LINK_IS_ADULT ? 320.0f : 200.0f) * scale), 0.0f, 0.0f, MTXMODE_APPLY); @@ -1323,8 +1323,8 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** rot->y -= this->unk_6B8; rot->z += this->unk_6B6; } else if (limbIndex == PLAYER_LIMB_L_HAND) { - if (CVarGetInteger("gCosmetics.Link_SwordScale.Changed", 0)) { - f32 scale = CVarGetFloat("gCosmetics.Link_SwordScale.Value", 1.0f); + if (CVarGetInteger(CVAR_COSMETIC("Link.SwordScale.Changed"), 0)) { + f32 scale = CVarGetFloat(CVAR_COSMETIC("Link.SwordScale.Value"), 1.0f); Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); Matrix_Translate(-((LINK_IS_ADULT ? 320.0f : 200.0f) * scale), 0.0f, 0.0f, MTXMODE_APPLY); } @@ -1396,7 +1396,7 @@ s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI)) { dLists += PLAYER_SHIELD_MAX * 4; } - } else if (!CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { + } else if (!CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) { if (!LINK_IS_ADULT && ((this->sheathType == PLAYER_MODELTYPE_SHEATH_16) || (this->sheathType == PLAYER_MODELTYPE_SHEATH_17)) && (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI)) { dLists = &sSheathWithSwordDLs[PLAYER_SHIELD_MAX * 4]; @@ -1438,7 +1438,7 @@ s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, G *dList = sFirstPersonLeftForearmDLs[gSaveContext.linkAge]; } else if (limbIndex == PLAYER_LIMB_L_HAND) { s32 handOutDlIndex = gSaveContext.linkAge; - if ((CVarGetInteger("gBowSlingShotAmmoFix", 0) || CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) && LINK_IS_ADULT && Player_HoldsSlingshot(this)) { + if ((CVarGetInteger(CVAR_ENHANCEMENT("BowSlingshotAmmoFix"), 0) || CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) && LINK_IS_ADULT && Player_HoldsSlingshot(this)) { handOutDlIndex = 1; } *dList = sFirstPersonLeftHandDLs[handOutDlIndex]; @@ -1448,7 +1448,7 @@ s32 Player_OverrideLimbDrawGameplayFirstPerson(PlayState* play, s32 limbIndex, G *dList = sFirstPersonForearmDLs[gSaveContext.linkAge]; } else if (limbIndex == PLAYER_LIMB_R_HAND) { s32 firstPersonWeaponIndex = gSaveContext.linkAge; - if (CVarGetInteger("gBowSlingShotAmmoFix", 0) || CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("BowSlingshotAmmoFix"), 0) || CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) { if (Player_HoldsBow(this)) { firstPersonWeaponIndex = 0; } else if (Player_HoldsSlingshot(this)) { @@ -1558,7 +1558,7 @@ void func_800906D4(PlayState* play, Player* this, Vec3f* newTipPos) { void Player_DrawGetItemIceTrap(PlayState* play, Player* this, Vec3f* refPos, s32 drawIdPlusOne, f32 height) { OPEN_DISPS(play->state.gfxCtx); - if (CVarGetInteger("gLetItSnow", 0)) { + if (CVarGetInteger(CVAR_GENERAL("LetItSnow"), 0)) { Gfx_SetupDL_25Opa(play->state.gfxCtx); Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); @@ -1686,13 +1686,13 @@ void Player_DrawHookshotReticle(PlayState* play, Player* this, f32 hookshotRange gSPTexture(WORLD_OVERLAY_DISP++, 0xFFFF, 0xFFFF, 0, G_TX_RENDERTILE, G_ON); gDPLoadTextureBlock(WORLD_OVERLAY_DISP++, gLinkAdultHookshotReticleTex, G_IM_FMT_I, G_IM_SIZ_8b, 64, 64, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, 6, 6, G_TX_NOLOD, G_TX_NOLOD); - if (SurfaceType_IsHookshotSurface(&play->colCtx, colPoly, bgId) && CVarGetInteger("gHookshotableReticle", false)) { + if (SurfaceType_IsHookshotSurface(&play->colCtx, colPoly, bgId) && CVarGetInteger(CVAR_ENHANCEMENT("HookshotableReticle"), false)) { const Color_RGBA8 defaultColor = { .r = 0, .g = 255, .b = 0, .a = 255 }; - const Color_RGBA8 color = CVarGetColor("gCosmetics.HookshotReticle_Target.Value", defaultColor); + const Color_RGBA8 color = CVarGetColor(CVAR_COSMETIC("HookshotReticle.Target.Value"), defaultColor); gDPSetPrimColor(WORLD_OVERLAY_DISP++, 0, 0, color.r, color.g, color.b, color.a); } else { const Color_RGBA8 defaultColor = { .r = 255, .g = 0, .b = 0, .a = 255 }; - const Color_RGBA8 color = CVarGetColor("gCosmetics.HookshotReticle_NonTarget.Value", defaultColor); + const Color_RGBA8 color = CVarGetColor(CVAR_COSMETIC("HookshotReticle.NonTarget.Value"), defaultColor); gDPSetPrimColor(WORLD_OVERLAY_DISP++, 0, 0, color.r, color.g, color.b, color.a); } gSPVertex(WORLD_OVERLAY_DISP++, (uintptr_t)gLinkAdultHookshotReticleVtx, 3, 0); @@ -1852,7 +1852,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve Matrix_Get(&this->shieldMf); } else if ((this->rightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT) || (this->rightHandType == PLAYER_MODELTYPE_RH_BOW_SLINGSHOT_2)) { s32 stringModelToUse = gSaveContext.linkAge; - if (CVarGetInteger("gBowSlingShotAmmoFix", 0) || CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("BowSlingshotAmmoFix"), 0) || CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0)) { stringModelToUse = Player_HoldsSlingshot(this); } BowStringData* stringData = &sBowStringData[stringModelToUse]; @@ -1918,10 +1918,10 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve if (func_8002DD78(this) != 0) { Matrix_Translate(500.0f, 300.0f, 0.0f, MTXMODE_APPLY); Player_DrawHookshotReticle( - play, this, ((this->heldItemAction == PLAYER_IA_HOOKSHOT) ? 38600.0f : 77600.0f) * CVarGetFloat("gCheatHookshotReachMultiplier", 1.0f)); + play, this, ((this->heldItemAction == PLAYER_IA_HOOKSHOT) ? 38600.0f : 77600.0f) * CVarGetFloat(CVAR_CHEAT("HookshotReachMultiplier"), 1.0f)); } } - } else if (CVarGetInteger("gBowReticle", 0) && ( + } else if (CVarGetInteger(CVAR_ENHANCEMENT("BowReticle"), 0) && ( (this->heldItemAction == PLAYER_IA_BOW_FIRE) || (this->heldItemAction == PLAYER_IA_BOW_ICE) || (this->heldItemAction == PLAYER_IA_BOW_LIGHT) || @@ -2042,7 +2042,7 @@ s32 Player_OverrideLimbDrawPause(PlayState* play, s32 limbIndex, Gfx** dList, Ve type = gPlayerModelTypes[modelGroup][PLAYER_MODELGROUPENTRY_SHEATH]; if ((type == PLAYER_MODELTYPE_SHEATH_18) || (type == PLAYER_MODELTYPE_SHEATH_19)) { dListOffset = playerSwordAndShield[1] * ptrSize; - } else if (type == PLAYER_MODELTYPE_SHEATH_16 && CVarGetInteger("gPauseLiveLink", 0)) { + } else if (type == PLAYER_MODELTYPE_SHEATH_16 && CVarGetInteger(CVAR_ENHANCEMENT("PauseLiveLink"), 0)) { //if (playerSwordAndShield[0] == 1) //dListOffset = 4; } @@ -2126,9 +2126,9 @@ void Player_DrawPauseImpl(PlayState* play, void* seg04, void* seg06, SkelAnime* playerSwordAndShield[0] = sword; playerSwordAndShield[1] = shield; - Matrix_SetTranslateRotateYXZ(pos->x - ((CVarGetInteger("gPauseLiveLink", 0) && LINK_AGE_IN_YEARS == YEARS_ADULT) ? 25 : 0), - pos->y - (CVarGetInteger("gPauseTriforce", 0) ? 16 : 0), pos->z, rot); - Matrix_Scale(scale * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1), scale, scale, MTXMODE_APPLY); + Matrix_SetTranslateRotateYXZ(pos->x - ((CVarGetInteger(CVAR_ENHANCEMENT("PauseLiveLink"), 0) && LINK_AGE_IN_YEARS == YEARS_ADULT) ? 25 : 0), + pos->y - (CVarGetInteger(CVAR_GENERAL("PauseTriforce"), 0) ? 16 : 0), pos->z, rot); + Matrix_Scale(scale * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1), scale, scale, MTXMODE_APPLY); gSPSegment(POLY_OPA_DISP++, 0x04, seg04); gSPSegment(POLY_OPA_DISP++, 0x06, seg06); @@ -2146,11 +2146,11 @@ void Player_DrawPauseImpl(PlayState* play, void* seg04, void* seg06, SkelAnime* Player_DrawImpl(play, skelAnime->skeleton, skelAnime->jointTable, skelAnime->dListCount, 0, tunic, boots, 0, Player_OverrideLimbDrawPause, NULL, &playerSwordAndShield); - if (CVarGetInteger("gPauseTriforce", 0)) { + if (CVarGetInteger(CVAR_GENERAL("PauseTriforce"), 0)) { Matrix_SetTranslateRotateYXZ(pos->x - (LINK_AGE_IN_YEARS == YEARS_ADULT ? 25 : 0), pos->y + 280 + (LINK_AGE_IN_YEARS == YEARS_ADULT ? 48 : 0), pos->z, rot); - Matrix_Scale(scale * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1), scale * 1, scale * 1, MTXMODE_APPLY); + Matrix_Scale(scale * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1), scale * 1, scale * 1, MTXMODE_APPLY); Gfx* ohNo = POLY_XLU_DISP; POLY_XLU_DISP = POLY_OPA_DISP; @@ -2180,8 +2180,8 @@ void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* Vec3s* srcTable; s32 i; bool canswitchrnd = false; - s16 SelectedMode = CVarGetInteger("gPauseLiveLink", 0); - MinFrameCount = CVarGetInteger("gMinFrameCount", 200); + s16 SelectedMode = CVarGetInteger(CVAR_ENHANCEMENT("PauseLiveLink"), 0); + MinFrameCount = CVarGetInteger(CVAR_ENHANCEMENT("MinFrameCount"), 200); gSegments[4] = VIRTUAL_TO_PHYSICAL(segment + 0x3800); gSegments[6] = VIRTUAL_TO_PHYSICAL(segment + 0x8800); @@ -2206,7 +2206,7 @@ void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* }; s16 AnimArraySize = ARRAY_COUNT(PauseMenuAnimSet); - if (CVarGetInteger("gPauseLiveLink", 0) || CVarGetInteger("gPauseTriforce", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("PauseLiveLink"), 0) || CVarGetInteger(CVAR_GENERAL("PauseTriforce"), 0)) { uintptr_t anim = 0; // Initialise anim if (CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) >= EQUIP_VALUE_SWORD_BIGGORON) { @@ -2363,7 +2363,7 @@ void Player_DrawPause(PlayState* play, u8* segment, SkelAnime* skelAnime, Vec3f* //anim = gPlayerAnim_link_wait_itemD2_20f; // Use for biggoron sword? - if (CVarGetInteger("gPauseTriforce", 0)) { + if (CVarGetInteger(CVAR_GENERAL("PauseTriforce"), 0)) { anim = gPlayerAnim_link_magic_kaze2; sword = 0; shield = 0; diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index de068ae6c..8970dac1b 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -5,6 +5,7 @@ #include "global.h" #include "vt.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" +#include "soh/Enhancements/game-interactor/GameInteractor.h" #include #include @@ -275,7 +276,7 @@ void Room_DrawBackground2D(Gfx** gfxP, void* tex, void* tlut, u16 width, u16 hei bg->b.imageFmt = fmt; bg->b.imageSiz = siz; bg->b.imagePal = 0; - bg->b.imageFlip = CVarGetInteger("gMirroredWorld", 0) ? G_BG_FLAG_FLIPS : 0; + bg->b.imageFlip = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? G_BG_FLAG_FLIPS : 0; // When an alt resource exists for the background, we need to unload the original asset // to clear the cache so the alt asset will be loaded instead @@ -412,7 +413,7 @@ BgImage* func_80096A74(PolygonType1* polygon1, PlayState* play) { camera = GET_ACTIVE_CAM(play); camId = camera->camDataIdx; - if (camId == -1 && (CVarGetInteger("gNoRestrictItems", 0) || CVarGetInteger("gCrowdControl", 0))) { + if (camId == -1 && (CVarGetInteger(CVAR_CHEAT("NoRestrictItems"), 0) || (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0)))) { // This prevents a crash when using items that change the // camera (such as din's fire), voiding out or dying on // scenes with prerendered backgrounds. diff --git a/soh/src/code/z_skelanime.c b/soh/src/code/z_skelanime.c index 2123c2d3b..3df8a26a5 100644 --- a/soh/src/code/z_skelanime.c +++ b/soh/src/code/z_skelanime.c @@ -78,7 +78,7 @@ void SkelAnime_DrawLod(PlayState* play, void** skeleton, Vec3s* jointTable, Vec3f pos; Vec3s rot; - if (CVarGetInteger("gDisableLOD", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableLOD"), 0)) { lod = 0; } @@ -195,7 +195,7 @@ void SkelAnime_DrawFlexLod(PlayState* play, void** skeleton, Vec3s* jointTable, Vec3s rot; Mtx* mtx = Graph_Alloc(play->state.gfxCtx, dListCount * sizeof(Mtx)); - if (CVarGetInteger("gDisableLOD", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableLOD"), 0)) { lod = 0; } @@ -870,7 +870,7 @@ AnimationEntry* AnimationContext_AddEntry(AnimationContext* animationCtx, Animat */ void AnimationContext_SetLoadFrame(PlayState* play, LinkAnimationHeader* animation, s32 frame, s32 limbCount, Vec3s* frameTable) { - if (CVarGetInteger("gN64WeirdFrames", 0) && frame < 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("N64WeirdFrames"), 0) && frame < 0) { Vec3s* src = (Vec3s*)getN64WeirdFrame((sizeof(Vec3s) * limbCount + 2) * frame); memcpy(frameTable, src, sizeof(Vec3s) * limbCount + 2); return; diff --git a/soh/src/code/z_sram.c b/soh/src/code/z_sram.c index 2ec190b41..9daa5a3cf 100644 --- a/soh/src/code/z_sram.c +++ b/soh/src/code/z_sram.c @@ -125,7 +125,7 @@ void Sram_OpenSave() { default: // Use the saved entrance value with remember save location, except when in grottos/fairy fountains - if (CVarGetInteger("gRememberSaveLocation", 0) && gSaveContext.savedSceneNum != SCENE_FAIRYS_FOUNTAIN && + if (CVarGetInteger(CVAR_ENHANCEMENT("RememberSaveLocation"), 0) && gSaveContext.savedSceneNum != SCENE_FAIRYS_FOUNTAIN && gSaveContext.savedSceneNum != SCENE_GROTTOS) { break; } @@ -142,7 +142,7 @@ void Sram_OpenSave() { osSyncPrintf(VT_RST); if (gSaveContext.health < 0x30) { - gSaveContext.health = CVarGetInteger("gFullHealthSpawn", 0) ? gSaveContext.healthCapacity : 0x30; + gSaveContext.health = CVarGetInteger(CVAR_ENHANCEMENT("FullHealthSpawn"), 0) ? gSaveContext.healthCapacity : 0x30; } if (gSaveContext.scarecrowLongSongSet) { @@ -221,7 +221,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) { u16* ptr; u16 checksum; - if (fileChooseCtx->buttonIndex != 0 || !CVarGetInteger("gDebugEnabled", 0)) { + if (fileChooseCtx->buttonIndex != 0 || !CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) { Sram_InitNewSave(); } else { Sram_InitDebugSave(); @@ -232,7 +232,7 @@ void Sram_InitSave(FileChooseContext* fileChooseCtx) { gSaveContext.dayTime = 0x6AAB; gSaveContext.cutsceneIndex = 0xFFF1; - if ((fileChooseCtx->buttonIndex == 0 && CVarGetInteger("gDebugEnabled", 0)) || CVarGetInteger("gNaviSkipCutscene", 0)) { + if ((fileChooseCtx->buttonIndex == 0 && CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0))) { gSaveContext.cutsceneIndex = 0; } diff --git a/soh/src/code/z_view.c b/soh/src/code/z_view.c index 42e4bcce7..c6235c923 100644 --- a/soh/src/code/z_view.c +++ b/soh/src/code/z_view.c @@ -432,7 +432,7 @@ s32 func_800AAA9C(View* view) { } osSyncPrintf("\n"); } - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { MtxF flipF; SkinMatrix_Clear(&flipF); flipF.xx = -1.0; @@ -553,7 +553,7 @@ s32 func_800AB2C4(View* view) { (f32)gScreenHeight * 0.5f, -30, view->zFar, view->scale); // This is for z-targeting - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { MtxF flipF; SkinMatrix_Clear(&flipF); flipF.xx = -1.0; diff --git a/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 0c7435da4..80457e5fb 100644 --- a/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -85,7 +85,7 @@ void ArmsHook_Wait(ArmsHook* this, PlayState* play) { if (this->actor.parent == NULL) { Player* player = GET_PLAYER(play); // get correct timer length for hookshot or longshot - s32 length = ((player->heldItemAction == PLAYER_IA_HOOKSHOT) ? 13 : 26) * CVarGetFloat("gCheatHookshotReachMultiplier", 1.0f); + s32 length = ((player->heldItemAction == PLAYER_IA_HOOKSHOT) ? 13 : 26) * CVarGetFloat(CVAR_CHEAT("HookshotReachMultiplier"), 1.0f); ArmsHook_SetupAction(this, ArmsHook_Shoot); func_8002D9A4(&this->actor, 20.0f); @@ -258,7 +258,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) { sp60.y = this->unk_1F4.y - (this->unk_1E8.y - this->unk_1F4.y); sp60.z = this->unk_1F4.z - (this->unk_1E8.z - this->unk_1F4.z); u16 buttonsToCheck = BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger("gDpadEquips", 0) != 0) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if (BgCheck_EntityLineTest1(&play->colCtx, &sp60, &this->unk_1E8, &sp78, &poly, true, true, true, true, 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 d257a7fd9..984bf8ecd 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 @@ -196,12 +196,12 @@ void ArrowFire_Draw(Actor* thisx, PlayState* play2) { Actor* tranform; Color_RGB8 primaryColor = {255, 200, 0}; - if (CVarGetInteger("gCosmetics.Arrows_FirePrimary.Changed", 0)) { - primaryColor = CVarGetColor24("gCosmetics.Arrows_FirePrimary.Value", primaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.FirePrimary.Changed"), 0)) { + primaryColor = CVarGetColor24(CVAR_COSMETIC("Arrows.FirePrimary.Value"), primaryColor); } Color_RGB8 secondaryColor = {255, 0, 0}; - if (CVarGetInteger("gCosmetics.Arrows_FireSecondary.Changed", 0)) { - secondaryColor = CVarGetColor24("gCosmetics.Arrows_FireSecondary.Value", secondaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.FireSecondary.Changed"), 0)) { + secondaryColor = CVarGetColor24(CVAR_COSMETIC("Arrows.FireSecondary.Value"), secondaryColor); } stateFrames = play->state.frames; 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 94d7ecabc..64ea63131 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 @@ -197,12 +197,12 @@ void ArrowIce_Draw(Actor* thisx, PlayState* play) { EnArrow* arrow = (EnArrow*)this->actor.parent; Color_RGB8 primaryColor = {170, 255, 255}; - if (CVarGetInteger("gCosmetics.Arrows_IcePrimary.Changed", 0)) { - primaryColor = CVarGetColor24("gCosmetics.Arrows_IcePrimary.Value", primaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.IcePrimary.Changed"), 0)) { + primaryColor = CVarGetColor24(CVAR_COSMETIC("Arrows.IcePrimary.Value"), primaryColor); } Color_RGB8 secondaryColor = {0, 0, 255}; - if (CVarGetInteger("gCosmetics.Arrows_IceSecondary.Changed", 0)) { - secondaryColor = CVarGetColor24("gCosmetics.Arrows_IceSecondary.Value", secondaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.IceSecondary.Changed"), 0)) { + secondaryColor = CVarGetColor24(CVAR_COSMETIC("Arrows.IceSecondary.Value"), secondaryColor); } if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { 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 9ddfb96a6..f42a0bcef 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 @@ -195,12 +195,12 @@ void ArrowLight_Draw(Actor* thisx, PlayState* play) { Actor* tranform; Color_RGB8 primaryColor = {255, 255, 170}; - if (CVarGetInteger("gCosmetics.Arrows_LightPrimary.Changed", 0)) { - primaryColor = CVarGetColor24("gCosmetics.Arrows_LightPrimary.Value", primaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.LightPrimary.Changed"), 0)) { + primaryColor = CVarGetColor24(CVAR_COSMETIC("Arrows.LightPrimary.Value"), primaryColor); } Color_RGB8 secondaryColor = {255, 255, 0}; - if (CVarGetInteger("gCosmetics.Arrows_LightSecondary.Changed", 0)) { - secondaryColor = CVarGetColor24("gCosmetics.Arrows_LightSecondary.Value", secondaryColor); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.LightSecondary.Changed"), 0)) { + secondaryColor = CVarGetColor24(CVAR_COSMETIC("Arrows.LightSecondary.Value"), secondaryColor); } if ((arrow != NULL) && (arrow->actor.update != NULL) && (this->timer < 255)) { diff --git a/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c b/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c index 3e7f60da9..03c9e96ad 100644 --- a/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c +++ b/soh/src/overlays/actors/ovl_Bg_Breakwall/z_bg_breakwall.c @@ -107,7 +107,7 @@ void BgBreakwall_Init(Actor* thisx, PlayState* play) { s32 wallType = ((this->dyna.actor.params >> 13) & 3) & 0xFF; // Initialize this with the mud wall, so it can't be affected by toggling while the actor is loaded - blueFireArrowsEnabledOnMudwallLoad = CVarGetInteger("gBlueFireArrows", 0) || (IS_RANDO && Randomizer_GetSettingValue(RSK_BLUE_FIRE_ARROWS)); + blueFireArrowsEnabledOnMudwallLoad = CVarGetInteger(CVAR_ENHANCEMENT("BlueFireArrows"), 0) || (IS_RANDO && Randomizer_GetSettingValue(RSK_BLUE_FIRE_ARROWS)); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); DynaPolyActor_Init(&this->dyna, DPM_UNK); diff --git a/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c b/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c index 2379b0a58..d1f0e6d30 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c @@ -69,7 +69,7 @@ void func_8087B7E8(BgHaka* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { - if (play->sceneNum == SCENE_GRAVEYARD && !LINK_IS_ADULT && IS_DAY && !CVarGetInteger("gDayGravePull", 0)) { + if (play->sceneNum == SCENE_GRAVEYARD && !LINK_IS_ADULT && IS_DAY && !CVarGetInteger(CVAR_ENHANCEMENT("DayGravePull"), 0)) { this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; if (!Play_InCsMode(play)) { diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index c61c93a46..98c5138c3 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -211,9 +211,9 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, PlayState* play) { if (turnFinished) { player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->vRotYDeg10 = (this->vRotYDeg10 + turnAngle) % 3600; - this->vTurnRateDeg10 = CVarGetInteger("gFasterBlockPush", 0) * 2; + this->vTurnRateDeg10 = CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 2; this->vTurnAngleDeg10 = 0; - this->vTimer = 5 - ((CVarGetInteger("gFasterBlockPush", 0) * 3) / 5); + this->vTimer = 5 - ((CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 3) / 5); this->actionFunc = BgHakaGate_StatueIdle; this->dyna.unk_150 = 0.0f; } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c b/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c index 4f9b4a216..e031c07cc 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c @@ -181,7 +181,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, PlayState* play) { func_80078884(NA_SE_SY_ERROR); } else { // Random rewards - if (CVarGetInteger("gNoRandomDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NoRandomDrops"), 0)) { collectibleParams = -1; } else if(rnd < 0.4f) { collectibleParams = ITEM00_BOMBS_A; @@ -196,7 +196,7 @@ void BgHakaTubo_DropCollectible(BgHakaTubo* this, PlayState* play) { } } else if (Flags_GetCollectible(play, this->dyna.actor.params) != 0) { // If small key already collected, drop recovery heart instead - if (CVarGetInteger("gNoHeartDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NoHeartDrops"), 0)) { collectibleParams = -1; } else { diff --git a/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index 97ed090a8..61d0ccb1b 100644 --- a/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/soh/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -320,7 +320,7 @@ void BgHeavyBlock_Wait(BgHeavyBlock* this, PlayState* play) { if (Actor_HasParent(&this->dyna.actor, play)) { this->timer = 0; - if (!CVarGetInteger("gFasterHeavyBlockLift", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 0)) { switch (this->dyna.actor.params & 0xFF) { case HEAVYBLOCK_BREAKABLE: OnePointCutscene_Init(play, 4020, 270, &this->dyna.actor, MAIN_CAM); @@ -369,7 +369,7 @@ void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, PlayState* play) { this->timer++; - if (!CVarGetInteger("gFasterHeavyBlockLift", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 0)) { Player_SetCsActionWithHaltedActors(play, &player->actor, 8); } @@ -409,7 +409,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, PlayState* play) { Quake_SetCountdown(quakeIndex, 30); // We don't want this arbitrarily long quake with the enhancement enabled - if (!CVarGetInteger("gFasterHeavyBlockLift", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 0)) { quakeIndex = Quake_Add(GET_ACTIVE_CAM(play), 2); Quake_SetSpeed(quakeIndex, 12000); Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0); diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index 36cfb0a27..c5b90a4c9 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -137,9 +137,9 @@ void func_8088B268(BgHidanRock* this, PlayState* play) { } } - this->dyna.actor.speedXZ = this->dyna.actor.speedXZ + (CVarGetInteger("gFasterBlockPush", 0) * 0.3) + 0.5f; + this->dyna.actor.speedXZ = this->dyna.actor.speedXZ + (CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 0.3) + 0.5f; this->dyna.actor.speedXZ = - CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f + (CVarGetInteger("gFasterBlockPush", 0) * 0.5)); + CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f + (CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 0.5)); if (D_8088BFC0 > 0.0f) { temp_v1 = Math_StepToF(&D_8088BFC0, 20.0f, this->dyna.actor.speedXZ); @@ -157,7 +157,7 @@ void func_8088B268(BgHidanRock* this, PlayState* play) { this->dyna.actor.home.pos.z = this->dyna.actor.world.pos.z; D_8088BFC0 = 0.0f; this->dyna.actor.speedXZ = 0.0f; - this->timer = 5 - ((CVarGetInteger("gFasterBlockPush", 0) * 3) / 5); + this->timer = 5 - ((CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 3) / 5); } func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); diff --git a/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c b/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c index 36666ed15..4d0353fcf 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c +++ b/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c @@ -105,7 +105,7 @@ void func_80890740(BgIceShelter* this, PlayState* play) { s32 type = (this->dyna.actor.params >> 8) & 7; // Initialize this with the red ice, so it can't be affected by toggling while the actor is loaded - blueFireArrowsEnabledOnRedIceLoad = CVarGetInteger("gBlueFireArrows", 0) || (IS_RANDO && Randomizer_GetSettingValue(RSK_BLUE_FIRE_ARROWS)); + blueFireArrowsEnabledOnRedIceLoad = CVarGetInteger(CVAR_ENHANCEMENT("BlueFireArrows"), 0) || (IS_RANDO && Randomizer_GetSettingValue(RSK_BLUE_FIRE_ARROWS)); Collider_InitCylinder(play, &this->cylinder1); // If "Blue Fire Arrows" is enabled, set up a collider on the red ice that responds to them @@ -461,8 +461,8 @@ void BgIceShelter_Draw(Actor* thisx, PlayState* play2) { break; } - if (CVarGetInteger("gCosmetics.World_RedIce.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.World_RedIce.Value", (Color_RGB8){ 255, 0, 0}); + if (CVarGetInteger(CVAR_COSMETIC("World.RedIce.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("World.RedIce.Value"), (Color_RGB8){ 255, 0, 0}); gDPSetEnvColor(POLY_XLU_DISP++, color.r, color.g, color.b, this->alpha); } else { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, this->alpha); diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index 564f6f322..f2c821929 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -443,7 +443,7 @@ void func_80896950(BgJyaCobra* this, PlayState* play) { if (this->dyna.unk_150 > 0.001f) { this->unk_168++; - if (this->unk_168 >= (15 - CVarGetInteger("gFasterBlockPush", 0) * 2)) { + if (this->unk_168 >= (15 - CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 2)) { func_808969F8(this, play); } } else { @@ -478,7 +478,7 @@ void func_808969F8(BgJyaCobra* this, PlayState* play) { this->unk_174.z = player->actor.world.pos.z - this->dyna.actor.world.pos.z; this->unk_170 = 0; this->unk_172 = true; - this->unk_16E = CVarGetInteger("gFasterBlockPush", 0) * 20; + this->unk_16E = CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 20; } void func_80896ABC(BgJyaCobra* this, PlayState* play) { diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c b/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c index 7ec5c2a77..19bef1b67 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c @@ -99,7 +99,7 @@ void BgJyaLift_DelayMove(BgJyaLift* this, PlayState* play) { // The cutscene of the platform lowering will show the central room in an unloaded state if // Link is not standing on the platform as it lowers. Therefore check for the Sunlight arrows // enhancement and if it's enabled, check that Link is on the platform. Otherwise skip it. - if (!(CVarGetInteger("gSunlightArrows", 0) || Randomizer_GetSettingValue(RSK_SUNLIGHT_ARROWS)) || + if (!(CVarGetInteger(CVAR_ENHANCEMENT("SunlightArrows"), 0) || Randomizer_GetSettingValue(RSK_SUNLIGHT_ARROWS)) || (GET_PLAYER(play)->actor.world.pos.x > -19.0f && GET_PLAYER(play)->actor.world.pos.x < 139.0f && GET_PLAYER(play)->actor.world.pos.z > -1172.0f && diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index 5088334ed..8576934de 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -6,6 +6,7 @@ #include "z_bg_mori_bigst.h" #include "objects/object_mori_objects/object_mori_objects.h" +#include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED @@ -221,8 +222,8 @@ void BgMoriBigst_SetupStalfosPairFight(BgMoriBigst* this, PlayState* play) { void BgMoriBigst_StalfosPairFight(BgMoriBigst* this, PlayState* play) { if ((this->dyna.actor.home.rot.z == 0 || // Check if all enemies are defeated instead of the regular stalfos when enemy randomizer or crowd control is on. - (Flags_GetTempClear(play, this->dyna.actor.room) && (CVarGetInteger("gRandomizedEnemies", 0) || (CVarGetInteger("gCrowdControl", 0))))) && - !Player_InCsMode(play)) { + (Flags_GetTempClear(play, this->dyna.actor.room) && (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) || + ((CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0)))))) && !Player_InCsMode(play)) { Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); BgMoriBigst_SetupDone(this, play); } diff --git a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index f020a462a..f8c02704f 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -94,7 +94,7 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play) { if (this->dyna.unk_150 > 0.001f) { this->timer++; - if ((this->timer > (28 - CVarGetInteger("gFasterBlockPush", 0) * 4)) && !Player_InCsMode(play)) { + if ((this->timer > (28 - CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 4)) && !Player_InCsMode(play)) { BgMoriKaitenkabe_SetupRotate(this); Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, 8); Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.world.pos); @@ -118,7 +118,7 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play) { void BgMoriKaitenkabe_SetupRotate(BgMoriKaitenkabe* this) { this->actionFunc = BgMoriKaitenkabe_Rotate; - this->rotSpeed = CVarGetInteger("gFasterBlockPush", 0) * 0.1f; + this->rotSpeed = CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 0.1f; this->rotYdeg = 0.0f; } diff --git a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index 08d4fc773..716868f39 100644 --- a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -387,8 +387,8 @@ void BgPoEvent_BlockPush(BgPoEvent* this, PlayState* play) { s32 blockStop; Player* player = GET_PLAYER(play); - this->dyna.actor.speedXZ = this->dyna.actor.speedXZ + (CVarGetInteger("gFasterBlockPush", 0) * 0.3) + 0.5f; - this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f + (CVarGetInteger("gFasterBlockPush", 0) * 0.5)); + this->dyna.actor.speedXZ = this->dyna.actor.speedXZ + (CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 0.3) + 0.5f; + this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f + (CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 0.5)); blockStop = Math_StepToF(&sBgPoEventblockPushDist, 20.0f, this->dyna.actor.speedXZ); displacement = this->direction * sBgPoEventblockPushDist; this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.x; @@ -403,7 +403,7 @@ void BgPoEvent_BlockPush(BgPoEvent* this, PlayState* play) { this->dyna.actor.home.pos.z = this->dyna.actor.world.pos.z; sBgPoEventblockPushDist = 0.0f; this->dyna.actor.speedXZ = 0.0f; - this->direction = 5 - ((CVarGetInteger("gFasterBlockPush", 0) * 3) / 5); + this->direction = 5 - ((CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 3) / 5); sBgPoEventBlocksAtRest++; this->actionFunc = BgPoEvent_BlockIdle; if (this->type == 1) { diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c b/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c index a697bd666..3a18e3650 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Fusya/z_bg_spot01_fusya.c @@ -60,8 +60,8 @@ void func_808AAA50(BgSpot01Fusya* this, PlayState* play) { f32 temp; Actor* thisx = &this->actor; - if (CVarGetInteger("gCosmetics.Kak_Windmill_Speed.Changed", 0)) { - this->unk_158 = CVarGetFloat("gCosmetics.Kak_Windmill_Speed.Value", 100.0f); + if (CVarGetInteger(CVAR_COSMETIC("Kak.Windmill_Speed.Changed"), 0)) { + this->unk_158 = CVarGetFloat(CVAR_COSMETIC("Kak.Windmill_Speed.Value"), 100.0f); } else { this->unk_158 = 100.0f; } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index 0a4738092..6e5bcf8dd 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -251,7 +251,7 @@ void BgSpot06Objects_GateSpawnBubbles(BgSpot06Objects* this, PlayState* play) { void BgSpot06Objects_GateWaitForSwitch(BgSpot06Objects* this, PlayState* play) { s32 i; - if ((CVarGetInteger("gWaterTempleGateFix", 0) == 0 || LINK_IS_ADULT) && Flags_GetSwitch(play, this->switchFlag)) { + if (Flags_GetSwitch(play, this->switchFlag)) { this->timer = 100; this->dyna.actor.world.pos.y += 3.0f; this->actionFunc = BgSpot06Objects_GateWaitToOpen; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index 4385c4341..d1fdca048 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -260,9 +260,9 @@ void func_808B4194(BgSpot15Rrbox* this, PlayState* play) { s32 approxFResult; Actor* actor = &this->dyna.actor; - this->unk_174 = this->unk_174 + ((CVarGetInteger("gFasterBlockPush", 0) / 2) * 0.5) + 0.5f; + this->unk_174 = this->unk_174 + ((CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) / 2) * 0.5) + 0.5f; - this->unk_174 = CLAMP_MAX(this->unk_174, 2.0f + (CVarGetInteger("gFasterBlockPush", 0) * 0.5)); + this->unk_174 = CLAMP_MAX(this->unk_174, 2.0f + (CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 0.5)); approxFResult = Math_StepToF(&this->unk_178, 20.0f, this->unk_174); @@ -294,7 +294,7 @@ void func_808B4194(BgSpot15Rrbox* this, PlayState* play) { this->dyna.unk_150 = 0.0f; this->unk_178 = 0.0f; this->unk_174 = 0.0f; - this->unk_168 = 10 - ((CVarGetInteger("gFasterBlockPush", 0) * 3) / 2); + this->unk_168 = 10 - ((CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 3) / 2); func_808B4084(this, play); } Audio_PlayActorSound2(actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); diff --git a/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c b/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index 8233ffeac..2d81c8610 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c @@ -297,7 +297,7 @@ void func_808B7F74(BgSpot18Basket* this) { shapeRotY = this->dyna.actor.shape.rot.y; this->actionFunc = func_808B7FC0; - if ((shapeRotY < -0x2E93) || (shapeRotY >= 0x7C19) || CVarGetInteger("gGoronPot", 0)) { + if ((shapeRotY < -0x2E93) || (shapeRotY >= 0x7C19) || CVarGetInteger(CVAR_ENHANCEMENT("GoronPot"), 0)) { this->unk_218 = 2; } else if (shapeRotY < 0x26C2) { this->unk_218 = 1; diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 169794568..145fdcfd9 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -1240,7 +1240,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, PlayState* play) { static Color_RGBA8 bloodPrimColor = { 0, 120, 0, 255 }; static Color_RGBA8 bloodEnvColor = { 0, 120, 0, 255 }; - if(CVarGetInteger("gRedGanonBlood", 0)) { + if(CVarGetInteger(CVAR_ENHANCEMENT("RedGanonBlood"), 0)) { bloodPrimColor.r = 120; bloodPrimColor.g = 0; diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 28febacd4..d9dd602c5 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -1486,7 +1486,7 @@ void func_8090109C(BossGanon2* this, PlayState* play) { static Color_RGBA8 sPrimColor = { 0, 120, 0, 255 }; static Color_RGBA8 sEnvColor = { 0, 120, 0, 255 }; - if(CVarGetInteger("gRedGanonBlood", 0)) { + if(CVarGetInteger(CVAR_ENHANCEMENT("RedGanonBlood"), 0)) { sPrimColor.r = 120; sPrimColor.g = 0; diff --git a/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 489350ad0..e05b73650 100644 --- a/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/soh/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -445,7 +445,7 @@ void BossGoma_SetupCeilingIdle(BossGoma* this) { void BossGoma_SetupFallJump(BossGoma* this) { // When in Enemy Randomizer, reset the state of the spawned Gohma Larva because it's not done // by the (non-existent) Larva themselves. - if (CVarGetInteger("gRandomizedEnemies", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { this->childrenGohmaState[0] = this->childrenGohmaState[1] = this->childrenGohmaState[2] = 0; } Animation_Change(&this->skelanime, &gGohmaLandAnim, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, -5.0f); @@ -1559,14 +1559,14 @@ void BossGoma_CeilingIdle(BossGoma* this, PlayState* play) { if (this->framesUntilNextAction == 0) { Actor* nearbyEnTest = NULL; - if (CVarGetInteger("gRandomizedEnemies", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { nearbyEnTest = Actor_FindNearby(play, &this->actor, -1, ACTORCAT_ENEMY, 8000.0f); } if (this->childrenGohmaState[0] == 0 && this->childrenGohmaState[1] == 0 && this->childrenGohmaState[2] == 0) { // if no child gohma has been spawned BossGoma_SetupCeilingPrepareSpawnGohmas(this); } else if ((this->childrenGohmaState[0] < 0 && this->childrenGohmaState[1] < 0 && this->childrenGohmaState[2] < 0) || - (nearbyEnTest == NULL && CVarGetInteger("gRandomizedEnemies", 0))) { + (nearbyEnTest == NULL && CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0))) { // In authentic gameplay, check if all baby Ghomas are dead. In Enemy Randomizer, check if there's no enemies alive. BossGoma_SetupFallJump(this); } else { diff --git a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 5b8eef344..de754328d 100644 --- a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -360,7 +360,7 @@ void BossSst_HeadSetupLurk(BossSst* this) { } void BossSst_HeadLurk(BossSst* this, PlayState* play) { - if (CVarGetInteger("gQuickBongoKill", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("QuickBongoKill"), 0)) { this->colliderCyl.base.acFlags |= AC_ON; } @@ -371,7 +371,7 @@ void BossSst_HeadLurk(BossSst* this, PlayState* play) { void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) { //Make sure to restore original behavior if the quick kill didn't happen - if (CVarGetInteger("gQuickBongoKill", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("QuickBongoKill"), 0)) { this->colliderCyl.base.acFlags &= ~AC_ON; } @@ -2665,7 +2665,7 @@ void BossSst_UpdateHead(Actor* thisx, PlayState* play) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->colliderJntSph.base); } - if ((this->actionFunc != BossSst_HeadLurk || CVarGetInteger("gQuickBongoKill", 0)) && (this->actionFunc != BossSst_HeadIntro)) { + if ((this->actionFunc != BossSst_HeadLurk || CVarGetInteger(CVAR_ENHANCEMENT("QuickBongoKill"), 0)) && (this->actionFunc != BossSst_HeadIntro)) { if (this->colliderCyl.base.acFlags & AC_ON) { CollisionCheck_SetAC(play, &play->colChkCtx, &this->colliderCyl.base); } diff --git a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 04f388b39..feda50c76 100644 --- a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -181,7 +181,7 @@ void DoorAna_Update(Actor* thisx, PlayState* play) { this->actionFunc(this, play); // Changes the grottos facing angle based on camera angle - if (!CVarGetInteger("gDisableGrottoRotation", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("DisableGrottoRotation"), 0)) { this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x8000; } } diff --git a/soh/src/overlays/actors/ovl_En_Am/z_en_am.c b/soh/src/overlays/actors/ovl_En_Am/z_en_am.c index 8347c631a..c62e3a8fa 100644 --- a/soh/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/soh/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -670,7 +670,7 @@ void EnAm_Statue(EnAm* this, PlayState* play) { Player* player = GET_PLAYER(play); f32 temp158f = this->dyna.unk_158; s16 moveDir = 0; - s32 blockSpeed = CVarGetInteger("gFasterBlockPush", 0); + s32 blockSpeed = CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0); if (this->unk_258 == 0) { if (this->dyna.unk_150 != 0.0f) { diff --git a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c index 740aea6c4..0b1a2b0b7 100644 --- a/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c +++ b/soh/src/overlays/actors/ovl_En_Anubice_Fire/z_en_anubice_fire.c @@ -116,7 +116,7 @@ void func_809B27D8(EnAnubiceFire* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_IT_SHIELD_REFLECT_SW); this->cylinder.base.atFlags &= 0xFFE9; this->cylinder.base.atFlags |= 8; - this->cylinder.info.toucher.dmgFlags = CVarGetInteger("gAnubisFix", 0) ? 0x800 : 2; + this->cylinder.info.toucher.dmgFlags = CVarGetInteger(CVAR_ENHANCEMENT("AnubixFix"), 0) ? 0x800 : 2; this->unk_15A = 30; this->actor.params = 1; this->actor.velocity.x *= -1.0f; diff --git a/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index 8b1d191a6..c13833d6d 100644 --- a/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/soh/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -84,46 +84,46 @@ void EnArrow_Init(Actor* thisx, PlayState* play) { }; EnArrow* this = (EnArrow*)thisx; - if (CVarGetInteger("gCosmetics.Arrows_NormalPrimary.Changed", 0)) { - blureNormal.altEnvColor = CVarGetColor("gCosmetics.Arrows_NormalPrimary.Value", (Color_RGBA8){ 0, 150, 0, 0 }); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.NormalPrimary.Changed"), 0)) { + blureNormal.altEnvColor = CVarGetColor(CVAR_COSMETIC("Arrows.NormalPrimary.Value"), (Color_RGBA8){ 0, 150, 0, 0 }); } else { blureNormal.altEnvColor = (Color_RGBA8){ 0, 150, 0, 0 }; } - if (CVarGetInteger("gCosmetics.Arrows_NormalSecondary.Changed", 0)) { - blureNormal.altPrimColor = CVarGetColor("gCosmetics.Arrows_NormalSecondary.Value", (Color_RGBA8){ 255, 255, 170, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.NormalSecondary.Changed"), 0)) { + blureNormal.altPrimColor = CVarGetColor(CVAR_COSMETIC("Arrows.NormalSecondary.Value"), (Color_RGBA8){ 255, 255, 170, 255 }); } else { blureNormal.altPrimColor = (Color_RGBA8){ 255, 255, 170, 255 }; } - if (CVarGetInteger("gCosmetics.Arrows_FirePrimary.Changed", 0)) { - blureFire.altEnvColor = CVarGetColor("gCosmetics.Arrows_FirePrimary.Value", (Color_RGBA8){ 255, 200, 0, 0 }); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.FirePrimary.Changed"), 0)) { + blureFire.altEnvColor = CVarGetColor(CVAR_COSMETIC("Arrows.FirePrimary.Value"), (Color_RGBA8){ 255, 200, 0, 0 }); } else { blureFire.altEnvColor = (Color_RGBA8){ 255, 200, 0, 0 }; } - if (CVarGetInteger("gCosmetics.Arrows_FireSecondary.Changed", 0)) { - blureFire.altPrimColor = CVarGetColor("gCosmetics.Arrows_FireSecondary.Value", (Color_RGBA8){ 255, 0, 0, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.FireSecondary.Changed"), 0)) { + blureFire.altPrimColor = CVarGetColor(CVAR_COSMETIC("Arrows.FireSecondary.Value"), (Color_RGBA8){ 255, 0, 0, 255 }); } else { blureFire.altPrimColor = (Color_RGBA8){ 255, 0, 0, 255 }; } - if (CVarGetInteger("gCosmetics.Arrows_IcePrimary.Changed", 0)) { - blureIce.altEnvColor = CVarGetColor("gCosmetics.Arrows_IcePrimary.Value", (Color_RGBA8){ 0, 0, 255, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.IcePrimary.Changed"), 0)) { + blureIce.altEnvColor = CVarGetColor(CVAR_COSMETIC("Arrows.IcePrimary.Value"), (Color_RGBA8){ 0, 0, 255, 255 }); } else { blureIce.altEnvColor = (Color_RGBA8){ 0, 0, 255, 255 }; } - if (CVarGetInteger("gCosmetics.Arrows_IceSecondary.Changed", 0)) { - blureIce.altPrimColor = CVarGetColor("gCosmetics.Arrows_IceSecondary.Value", (Color_RGBA8){ 170, 255, 255, 0 }); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.IceSecondary.Changed"), 0)) { + blureIce.altPrimColor = CVarGetColor(CVAR_COSMETIC("Arrows.IceSecondary.Value"), (Color_RGBA8){ 170, 255, 255, 0 }); } else { blureIce.altPrimColor = (Color_RGBA8){ 170, 255, 255, 0 }; } - if (CVarGetInteger("gCosmetics.Arrows_LightPrimary.Changed", 0)) { - blureLight.altEnvColor = CVarGetColor("gCosmetics.Arrows_LightPrimary.Value", (Color_RGBA8){ 255, 255, 0, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.LightPrimary.Changed"), 0)) { + blureLight.altEnvColor = CVarGetColor(CVAR_COSMETIC("Arrows.LightPrimary.Value"), (Color_RGBA8){ 255, 255, 0, 255 }); } else { blureLight.altEnvColor = (Color_RGBA8){ 255, 255, 0, 255 }; } - if (CVarGetInteger("gCosmetics.Arrows_LightSecondary.Changed", 0)) { - blureLight.altPrimColor = CVarGetColor("gCosmetics.Arrows_LightSecondary.Value", (Color_RGBA8){ 255, 255, 170, 0 }); + if (CVarGetInteger(CVAR_COSMETIC("Arrows.LightSecondary.Changed"), 0)) { + blureLight.altPrimColor = CVarGetColor(CVAR_COSMETIC("Arrows.LightSecondary.Value"), (Color_RGBA8){ 255, 255, 170, 0 }); } else { blureLight.altPrimColor = (Color_RGBA8){ 255, 255, 170, 0 }; } diff --git a/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c b/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c index 816dcf091..0d367a411 100644 --- a/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c +++ b/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c @@ -6,6 +6,7 @@ #include "z_en_blkobj.h" #include "objects/object_blkobj/object_blkobj.h" +#include "soh/Enhancements/game-interactor/GameInteractor.h" #define FLAGS (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_DRAW_WHILE_CULLED) @@ -104,8 +105,11 @@ void EnBlkobj_DarkLinkFight(EnBlkobj* this, PlayState* play) { // Check for if Dark Link is defeated in authentic gameplay. // Check for if all enemies are defeated with enemy randomizer or crowd control on. uint8_t roomCleared = - (!CVarGetInteger("gRandomizedEnemies", 0) && !CVarGetInteger("gCrowdControl", 0) && Actor_Find(&play->actorCtx, ACTOR_EN_TORCH2, ACTORCAT_BOSS) == NULL) || - ((CVarGetInteger("gRandomizedEnemies", 0) || CVarGetInteger("gCrowdControl", 0)) && Flags_GetTempClear(play, this->dyna.actor.room)); + (!CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) && + !(CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0)) && + Actor_Find(&play->actorCtx, ACTOR_EN_TORCH2, ACTORCAT_BOSS) == NULL) || + ((CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) || (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0))) && + Flags_GetTempClear(play, this->dyna.actor.room)); if (roomCleared) { Flags_SetClear(play, this->dyna.actor.room); this->timer++; diff --git a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 7fee4b178..434556a51 100644 --- a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -110,8 +110,8 @@ void EnBom_Init(Actor* thisx, PlayState* play) { Actor_SetScale(thisx, 0.01f); } - if (CVarGetFloat("gBombTimerMultiplier", 1.0f) != 1.0f) { - this->timer = (s32)(70 * CVarGetFloat("gBombTimerMultiplier", 1.0f)); + if (CVarGetFloat(CVAR_CHEAT("BombTimerMultiplier"), 1.0f) != 1.0f) { + this->timer = (s32)(70 * CVarGetFloat(CVAR_CHEAT("BombTimerMultiplier"), 1.0f)); // Do the sound and scale immediately if GameInteractor hasn't already. if (!GameInteractor_GetRandomBombFuseTimerActive()) { Audio_PlayActorSound2(thisx, NA_SE_PL_TAKE_OUT_SHIELD); @@ -125,7 +125,7 @@ void EnBom_Init(Actor* thisx, PlayState* play) { Collider_SetCylinder(play, &this->bombCollider, thisx, &sCylinderInit); Collider_SetJntSph(play, &this->explosionCollider, thisx, &sJntSphInit, &this->explosionColliderItems[0]); this->explosionColliderItems[0].info.toucher.damage += (thisx->shape.rot.z & 0xFF00) >> 8; - if (CVarGetInteger("gNutsExplodeBombs", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NutsExplodeBombs"), 0)) { this->bombCollider.info.bumper.dmgFlags |= 1; } @@ -199,7 +199,7 @@ void EnBom_Explode(EnBom* this, PlayState* play) { func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); } - if (CVarGetInteger("gStaticExplosionRadius", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("StaticExplosionRadius"), 0)) { //72 is the maximum radius of an OoT bomb explosion this->explosionCollider.elements[0].dim.worldSphere.radius = 72; } else { @@ -267,7 +267,7 @@ void EnBom_Update(Actor* thisx, PlayState* play2) { } // With random bomb fuse timer or gBombTimerMultiplier, sound effect and scaling is already done on init. - if (this->timer == 67 && !GameInteractor_GetRandomBombFuseTimerActive() && CVarGetFloat("gBombTimerMultiplier", 1.0f) == 1.0f) { + if (this->timer == 67 && !GameInteractor_GetRandomBombFuseTimerActive() && CVarGetFloat(CVAR_CHEAT("BombTimerMultiplier"), 1.0f) == 1.0f) { Audio_PlayActorSound2(thisx, NA_SE_PL_TAKE_OUT_SHIELD); Actor_SetScale(thisx, 0.01f); } @@ -281,7 +281,7 @@ void EnBom_Update(Actor* thisx, PlayState* play2) { Actor_UpdateBgCheckInfo(play, thisx, 5.0f, 10.0f, 15.0f, 0x1F); if (thisx->params == BOMB_BODY) { - float timerMultiplier = CVarGetFloat("gBombTimerMultiplier", 1.0f); + float timerMultiplier = CVarGetFloat(CVAR_CHEAT("BombTimerMultiplier"), 1.0f); if (this->timer < (timerMultiplier == 1.0f ? 63 : (s32)(70 * timerMultiplier - 7))) { dustAccel.y = 0.2f; @@ -397,7 +397,7 @@ void EnBom_Draw(Actor* thisx, PlayState* play) { if (thisx->params == BOMB_BODY) { Gfx_SetupDL_25Opa(play->state.gfxCtx); - if (!CVarGetInteger("gDisableBombBillboarding", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("DisableBombBillboarding"), 0)) { Matrix_ReplaceRotation(&play->billboardMtxF); } func_8002EBCC(thisx, play, 0); diff --git a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index 2110383a4..6df2802f8 100644 --- a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -69,7 +69,7 @@ void EnBomBowlMan_Init(Actor* thisx, PlayState* play2) { Actor_SetScale(&this->actor, 0.013f); for (i = 0; i < 2; i++) { - if(CVarGetInteger("gCustomizeBombchuBowling", 0) && CVarGetInteger(i == 0 ? "gBombchuBowlingNoSmallCucco" : "gBombchuBowlingNoBigCucco", 0)) { + if(CVarGetInteger(CVAR_ENHANCEMENT("CustomizeBombchuBowling"), 0) && CVarGetInteger(i == 0 ? CVAR_ENHANCEMENT("BombchuBowlingNoSmallCucco") : CVAR_ENHANCEMENT("BombchuBowlingNoBigCucco"), 0)) { continue; } @@ -327,8 +327,8 @@ void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, PlayState* play) { Rupees_ChangeBy(-30); this->minigamePlayStatus = 1; this->wallStatus[0] = this->wallStatus[1] = 0; - if(CVarGetInteger("gCustomizeBombchuBowling", 0)) { - play->bombchuBowlingStatus = CVarGetInteger("gBombchuBowlingAmmunition", 10); + if(CVarGetInteger(CVAR_ENHANCEMENT("CustomizeBombchuBowling"), 0)) { + play->bombchuBowlingStatus = CVarGetInteger(CVAR_ENHANCEMENT("BombchuBowlingAmmo"), 10); } else { play->bombchuBowlingStatus = 10; diff --git a/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index 02ff9140d..c265b3eb0 100644 --- a/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/soh/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -139,7 +139,7 @@ void EnBomChu_UpdateFloorPoly(EnBomChu* this, CollisionPoly* floorPoly, PlayStat f32 normDotUp; MtxF mf; - if (CVarGetInteger("gBombchusOOB", 0) && floorPoly == NULL) { + if (CVarGetInteger(CVAR_ENHANCEMENT("BombchusOOB"), 0) && floorPoly == NULL) { EnBomChu_Explode(this, play); return; } @@ -491,7 +491,7 @@ void EnBomChu_Draw(Actor* thisx, PlayState* play) { f32 colorIntensity; s32 blinkHalfPeriod; s32 blinkTime; - Color_RGB8 BombchuCol = CVarGetColor24("gBombTrailCol", BombchuColorOriginal); + Color_RGB8 BombchuCol = CVarGetColor24(CVAR_COSMETIC("Trails.Bombchu.Value"), BombchuColorOriginal); OPEN_DISPS(play->state.gfxCtx); @@ -515,8 +515,8 @@ void EnBomChu_Draw(Actor* thisx, PlayState* play) { colorIntensity = blinkTime / (f32)blinkHalfPeriod; - if (CVarGetInteger("gCosmetics.Equipment_ChuBody.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.Equipment_ChuBody.Value", (Color_RGB8){ 209.0f, 34.0f, -35.0f }); + if (CVarGetInteger(CVAR_COSMETIC("Equipment.ChuBody.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("Equipment.ChuBody.Value"), (Color_RGB8){ 209.0f, 34.0f, -35.0f }); gDPSetEnvColor(POLY_OPA_DISP++, (colorIntensity * color.r), (colorIntensity * color.g), (colorIntensity * color.b), 255); } else { diff --git a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c index a60b7c5ed..29eb6dc94 100644 --- a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -577,8 +577,8 @@ void EnBox_Update(Actor* thisx, PlayState* play) { void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) { EnBox_CreateExtraChestTextures(); - int csmc = CVarGetInteger("gChestSizeAndTextureMatchesContents", CSMC_DISABLED); - int requiresStoneAgony = CVarGetInteger("gChestSizeDependsStoneOfAgony", 0); + int csmc = CVarGetInteger(CVAR_ENHANCEMENT("ChestSizeAndTextureMatchContents"), CSMC_DISABLED); + int requiresStoneAgony = CVarGetInteger(CVAR_ENHANCEMENT("ChestSizeDependsStoneOfAgony"), 0); GetItemCategory getItemCategory; int isVanilla = csmc == CSMC_DISABLED || (requiresStoneAgony && !CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)) || @@ -673,7 +673,7 @@ void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) { } } - if (CVarGetInteger("gLetItSnow", 0) && hasChristmasChestTexturesAvailable && hasCreatedRandoChestTextures && !hasCustomChestDLs) { + if (CVarGetInteger(CVAR_GENERAL("LetItSnow"), 0) && hasChristmasChestTexturesAvailable && hasCreatedRandoChestTextures && !hasCustomChestDLs) { if (this->dyna.actor.scale.x == 0.01f) { this->boxBodyDL = gChristmasRedTreasureChestChestFrontDL; this->boxLidDL = gChristmasRedTreasureChestChestSideAndLidDL; diff --git a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 6be3a219f..f0f6b5bb5 100644 --- a/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/soh/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -262,7 +262,7 @@ void EnClearTag_Init(Actor* thisx, PlayState* play) { // Change Arwing to regular enemy instead of boss with enemy randomizer and crowd control. // This way Arwings will be considered for "clear enemy" rooms properly. - if (CVarGetInteger("gRandomizedEnemies", 0) || CVarGetInteger("gCrowdControl", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) || (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0))) { Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_ENEMY); } @@ -478,7 +478,7 @@ void EnClearTag_Update(Actor* thisx, PlayState* play2) { // Introduce a range requirement in Enemy Rando so Arwings don't shoot the player from // across the map. Especially noticeable in big maps like Lake Hylia and Hyrule Field. - uint8_t enemyRandoShootLaser = !CVarGetInteger("gRandomizedEnemies", 0) || this->actor.xzDistToPlayer < 1000.0f; + uint8_t enemyRandoShootLaser = !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) || this->actor.xzDistToPlayer < 1000.0f; // Check if the Arwing should fire its laser. if ((this->frameCounter % 4) == 0 && (Rand_ZeroOne() < 0.75f) && diff --git a/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c index ea0432f27..bb7236e04 100644 --- a/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -283,7 +283,7 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { } if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & PLAYER_STATE1_ON_HORSE) && (this->actor.yDistToWater < -40.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL) && - !CVarGetInteger("gNoKeeseGuayTarget", 0)) { + !CVarGetInteger(CVAR_CHEAT("NoKeeseGuayTarget"), 0)) { EnCrow_SetupDiveAttack(this); } } @@ -321,7 +321,7 @@ void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL) || (this->collider.base.atFlags & AT_HIT) || (this->actor.bgCheckFlags & 9) || (player->stateFlags1 & PLAYER_STATE1_ON_HORSE) || (this->actor.yDistToWater > -40.0f) || - CVarGetInteger("gNoKeeseGuayTarget", 0)) { + CVarGetInteger(CVAR_CHEAT("NoKeeseGuayTarget"), 0)) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_ATTACK); @@ -364,7 +364,7 @@ void EnCrow_Die(EnCrow* this, PlayState* play) { } else { Item_DropCollectible(play, &this->actor.world.pos, ITEM00_RUPEE_RED); } - if (!CVarGetInteger("gRandomizedEnemies", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { EnCrow_SetupRespawn(this); } else { Actor_Kill(this); 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 38a1cf95b..b226d00f2 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 @@ -373,7 +373,7 @@ void EnDog_FollowPlayer(EnDog* this, PlayState* play) { return; } - if (CVarGetInteger("gDogFollowsEverywhere", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DogFollowsEverywhere"), 0)) { // If the dog is too far away it's usually because they are stuck in a hole or on a different floor, this gives them a push if (this->actor.xyzDistToPlayerSq > 250000.0f) { Player* player = GET_PLAYER(play); @@ -394,7 +394,7 @@ void EnDog_FollowPlayer(EnDog* this, PlayState* play) { } if (this->actor.xzDistToPlayer > 400.0f) { - if (CVarGetInteger("gDogFollowsEverywhere", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DogFollowsEverywhere"), 0)) { // Instead of stopping following when the dog gets too far, just speed them up. speed = this->actor.xzDistToPlayer / 25.0f; } else { @@ -419,7 +419,7 @@ void EnDog_FollowPlayer(EnDog* this, PlayState* play) { Math_ApproachF(&this->actor.speedXZ, speed, 0.6f, 1.0f); - if (!(this->actor.xzDistToPlayer > 400.0f) || CVarGetInteger("gDogFollowsEverywhere", 0)) { + if (!(this->actor.xzDistToPlayer > 400.0f) || CVarGetInteger(CVAR_ENHANCEMENT("DogFollowsEverywhere"), 0)) { Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 10, 1000, 1); this->actor.shape.rot = this->actor.world.rot; } @@ -500,11 +500,11 @@ void EnDog_Draw(Actor* thisx, PlayState* play) { EnDog* this = (EnDog*)thisx; Color_RGB8 colors[] = { { 255, 255, 200 }, { 150, 100, 50 } }; - if (CVarGetInteger("gCosmetics.NPC_Dog1.Changed", 0)) { - colors[0] = CVarGetColor24("gCosmetics.NPC_Dog1.Value", colors[0]); + if (CVarGetInteger(CVAR_COSMETIC("NPC.Dog1.Changed"), 0)) { + colors[0] = CVarGetColor24(CVAR_COSMETIC("NPC.Dog1.Value"), colors[0]); } - if (CVarGetInteger("gCosmetics.NPC_Dog2.Changed", 0)) { - colors[1] = CVarGetColor24("gCosmetics.NPC_Dog2.Value", colors[1]); + if (CVarGetInteger(CVAR_COSMETIC("NPC.Dog2.Changed"), 0)) { + colors[1] = CVarGetColor24(CVAR_COSMETIC("NPC.Dog2.Value"), colors[1]); } OPEN_DISPS(play->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_Door/z_en_door.c b/soh/src/overlays/actors/ovl_En_Door/z_en_door.c index 2a571e34e..cbfd5f018 100644 --- a/soh/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/soh/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -349,11 +349,11 @@ void EnDoor_Draw(Actor* thisx, PlayState* play) { } } if (this->lockTimer != 0) { - if (CVarGetInteger("gShowDoorLocksOnBothSides", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("ShowDoorLocksOnBothSides"), 0)) { Matrix_Push(); } Actor_DrawDoorLock(play, this->lockTimer, DOORLOCK_NORMAL); - if (CVarGetInteger("gShowDoorLocksOnBothSides", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("ShowDoorLocksOnBothSides"), 0)) { Matrix_Pop(); Matrix_RotateZYX(0, 0x8000, 0, MTXMODE_APPLY); Actor_DrawDoorLock(play, this->lockTimer, DOORLOCK_NORMAL); diff --git a/soh/src/overlays/actors/ovl_En_Du/z_en_du.c b/soh/src/overlays/actors/ovl_En_Du/z_en_du.c index 2c7b1a2bb..7d18395e8 100644 --- a/soh/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/soh/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -277,7 +277,7 @@ void func_809FE040(EnDu* this) { this->unk_1E6 = 0; } // #region SOH[Enhancement] - if (CVarGetInteger("gEnhancements.FixDaruniaDanceSpeed", 1)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FixDaruniaDanceSpeed"), 1)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfoFix, animationIndices[this->unk_1E6]); // #endregion } else { @@ -299,7 +299,7 @@ void func_809FE104(EnDu* this) { this->unk_1E6++; if (this->unk_1E6 < 4) { // #region SOH[Enhancement] - if (CVarGetInteger("gEnhancements.FixDaruniaDanceSpeed", 1) && this->unk_1E6 <= 1) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FixDaruniaDanceSpeed"), 1) && this->unk_1E6 <= 1) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfoFix, animationIndices[this->unk_1E6]); // #endregion } else { @@ -496,7 +496,7 @@ void func_809FE890(EnDu* this, PlayState* play) { if (csAction->action == 7 || csAction->action == 8) { this->unk_1E6 = 0; // #region SOH[Enhancement] - if (CVarGetInteger("gEnhancements.FixDaruniaDanceSpeed", 1)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FixDaruniaDanceSpeed"), 1)) { Animation_ChangeByInfo(&this->skelAnime, sAnimationInfoFix, ENDU_ANIM_7); // #endregion } else { diff --git a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c index e08e794a3..2c1bd0983 100644 --- a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -631,15 +631,15 @@ void func_80A0329C(EnElf* this, PlayState* play) { if ((heightDiff > 0.0f) && (heightDiff < 60.0f)) { if (!func_80A01F90(&this->actor.world.pos, &refActor->actor.world.pos, 10.0f)) { - if (CVarGetInteger("gFairyEffect", 0) && !(this->fairyFlags & FAIRY_FLAG_BIG)) + if (CVarGetInteger(CVAR_ENHANCEMENT("FairyEffect"), 0) && !(this->fairyFlags & FAIRY_FLAG_BIG)) { - if (CVarGetInteger("gFairyPercentRestore", 0)) + if (CVarGetInteger(CVAR_ENHANCEMENT("FairyPercentRestore"), 0)) { - Health_ChangeBy(play, (gSaveContext.healthCapacity * CVarGetInteger("gFairyHealth", 100) / 100 + 15) / 16 * 16); + Health_ChangeBy(play, (gSaveContext.healthCapacity * CVarGetInteger(CVAR_ENHANCEMENT("FairyHealth"), 100) / 100 + 15) / 16 * 16); } else { - Health_ChangeBy(play, CVarGetInteger("gFairyHealth", 8) * 16); + Health_ChangeBy(play, CVarGetInteger(CVAR_ENHANCEMENT("FairyHealth"), 8) * 16); } } else @@ -1486,7 +1486,7 @@ s32 EnElf_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p if (this->fairyFlags & FAIRY_FLAG_BIG) { scale *= 2.0f; } - scale *= CVarGetFloat("gCosmetics.Fairies_Size", 1.0f); + scale *= CVarGetFloat(CVAR_COSMETIC("Fairies.Size"), 1.0f); scale *= (this->actor.scale.x * 124.99999f); Matrix_MultVec3f(&zeroVec, &mtxMult); diff --git a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index 146f0deaa..74d5fcd06 100644 --- a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -169,7 +169,7 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, PlayState* play) { break; } } - int32_t modifiedSpawnRate = CVarGetInteger("gEnhancements.LeeverSpawnRate", 0); + int32_t modifiedSpawnRate = CVarGetInteger(CVAR_ENHANCEMENT("LeeverSpawnRate"), 0); if (modifiedSpawnRate) { this->timer = 20 * modifiedSpawnRate; } @@ -248,9 +248,9 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play) { // been spawned and/or killed. int8_t enemyCount = play->actorCtx.actorLists[ACTORCAT_ENEMY].length; if ((this->curNumSpawn < this->maxCurSpawns && this->totalNumSpawn < this->maxTotalSpawns) || - (CVarGetInteger("gRandomizedEnemies", 0) && enemyCount < 15)) { + (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) && enemyCount < 15)) { while ((this->curNumSpawn < this->maxCurSpawns && this->totalNumSpawn < this->maxTotalSpawns) || - (CVarGetInteger("gRandomizedEnemies", 0) && enemyCount < 15)) { + (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) && enemyCount < 15)) { if (play->sceneNum == SCENE_HYRULE_FIELD) { if ((player->floorSfxOffset == 0) || (player->actor.floorBgId != BGCHECK_SCENE) || !(player->actor.bgCheckFlags & 1) || (player->stateFlags1 & PLAYER_STATE1_IN_WATER)) { @@ -282,7 +282,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play) { break; } if ((player->actor.yDistToWater != BGCHECK_Y_MIN) && - (floorY < (player->actor.world.pos.y + player->actor.yDistToWater*(CVarGetInteger("gEnemySpawnsOverWaterboxes", 0) ? 1 : -1)))) { + (floorY < (player->actor.world.pos.y + player->actor.yDistToWater*(CVarGetInteger(CVAR_ENHANCEMENT("EnemySpawnsOverWaterboxes"), 0) ? 1 : -1)))) { break; } spawnPos.y = floorY; diff --git a/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c b/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c index 834096220..120461f8f 100644 --- a/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c +++ b/soh/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c @@ -388,7 +388,7 @@ void EnExRuppy_Draw(Actor* thisx, PlayState* play) { if (!this->invisible) { OPEN_DISPS(play->state.gfxCtx); - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { // purple/gold rupees need less scaling f32 mtxScale = this->colorIdx >= 3 ? 17.5f : 25.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); @@ -398,24 +398,24 @@ void EnExRuppy_Draw(Actor* thisx, PlayState* play) { u8 shouldColor = 0; switch (this->colorIdx) { case 0: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_GreenRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_GreenRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.GreenRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.GreenRupee.Changed"), 0); break; case 1: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_BlueRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_BlueRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.BlueRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.BlueRupee.Changed"), 0); break; case 2: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_RedRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_RedRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.RedRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.RedRupee.Changed"), 0); break; case 4: // orange rupee texture corresponds to the purple rupee (authentic bug) - rupeeColor = CVarGetColor24("gCosmetics.Consumable_PurpleRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_PurpleRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.PurpleRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.PurpleRupee.Changed"), 0); break; case 3: // pink rupee texture corresponds to the gold rupee (authentic bug) - rupeeColor = CVarGetColor24("gCosmetics.Consumable_GoldRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_GoldRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.GoldRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.GoldRupee.Changed"), 0); break; } 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 f37bc73db..6c8afb6d7 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 @@ -416,7 +416,7 @@ void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { } if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL) && - !CVarGetInteger("gNoKeeseGuayTarget", 0)) { + !CVarGetInteger(CVAR_CHEAT("NoKeeseGuayTarget"), 0)) { EnFirefly_SetupDiveAttack(this); } } @@ -495,7 +495,7 @@ void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL) || - CVarGetInteger("gNoKeeseGuayTarget", 0)) { + CVarGetInteger(CVAR_CHEAT("NoKeeseGuayTarget"), 0)) { EnFirefly_SetupFlyAway(this); } } @@ -742,10 +742,10 @@ void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* static Color_RGBA8 fireAuraEnvColor = { 255, 50, 0, 0 }; static Color_RGBA8 iceAuraPrimColor = { 100, 200, 255, 255 }; static Color_RGBA8 iceAuraEnvColor = { 0, 0, 255, 0 }; - Color_RGBA8 customFireAuraPrimColor = CVarGetColor("gCosmetics.NPC_FireKeesePrimary.Value", fireAuraPrimColor); - Color_RGBA8 customFireAuraEnvColor = CVarGetColor("gCosmetics.NPC_FireKeeseSecondary.Value", fireAuraEnvColor); - Color_RGBA8 customIceAuraPrimColor = CVarGetColor("gCosmetics.NPC_IceKeesePrimary.Value", iceAuraPrimColor); - Color_RGBA8 customIceAuraEnvColor = CVarGetColor("gCosmetics.NPC_IceKeeseSecondary.Value", iceAuraEnvColor); + Color_RGBA8 customFireAuraPrimColor = CVarGetColor(CVAR_COSMETIC("NPC.FireKeesePrimary.Value"), fireAuraPrimColor); + Color_RGBA8 customFireAuraEnvColor = CVarGetColor(CVAR_COSMETIC("NPC.FireKeeseSecondary.Value"), fireAuraEnvColor); + Color_RGBA8 customIceAuraPrimColor = CVarGetColor(CVAR_COSMETIC("NPC.IceKeesePrimary.Value"), iceAuraPrimColor); + Color_RGBA8 customIceAuraEnvColor = CVarGetColor(CVAR_COSMETIC("NPC.IceKeeseSecondary.Value"), iceAuraEnvColor); 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 }; @@ -785,23 +785,23 @@ void EnFirefly_PostLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3s* } if (this->auraType == KEESE_AURA_FIRE) { - if (CVarGetInteger("gCosmetics.NPC_FireKeesePrimary.Changed", 0)) { + if (CVarGetInteger(CVAR_COSMETIC("NPC.FireKeesePrimary.Changed"), 0)) { effPrimColor = &customFireAuraPrimColor; } else { effPrimColor = &fireAuraPrimColor; } - if (CVarGetInteger("gCosmetics.NPC_FireKeeseSecondary.Changed", 0)) { + if (CVarGetInteger(CVAR_COSMETIC("NPC.FireKeeseSecondary.Changed"), 0)) { effEnvColor = &customFireAuraEnvColor; } else { effEnvColor = &fireAuraEnvColor; } } else { - if (CVarGetInteger("gCosmetics.NPC_IceKeesePrimary.Changed", 0)) { + if (CVarGetInteger(CVAR_COSMETIC("NPC.IceKeesePrimary.Changed"), 0)) { effPrimColor = &customIceAuraPrimColor; } else { effPrimColor = &iceAuraPrimColor; } - if (CVarGetInteger("gCosmetics.NPC_IceKeeseSecondary.Changed", 0)) { + if (CVarGetInteger(CVAR_COSMETIC("NPC.IceKeeseSecondary.Changed"), 0)) { effEnvColor = &customIceAuraEnvColor; } else { effEnvColor = &iceAuraEnvColor; diff --git a/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c index 1bd8e3202..d2493a47b 100644 --- a/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -681,7 +681,7 @@ void EnFish_UpdateCutscene(EnFish* this, PlayState* play) { // Update functions and Draw void EnFish_OrdinaryUpdate(EnFish* this, PlayState* play) { - if (this->timer > 0 && CVarGetInteger("gNoFishDespawn", 0) == 0) { + if (this->timer > 0 && CVarGetInteger(CVAR_CHEAT("NoFishDespawn"), 0) == 0) { this->timer--; } diff --git a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index e6e096e47..eaaa7c800 100644 --- a/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/soh/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -212,7 +212,7 @@ void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, PlayState* play) { static s8 majorScale[] = { 0, 2, 4, 5, 7, 9, 11, 13, 15, 17 }; if (this->noteIndex < sCollectedCount) { - if (sCollectedCount < (CVarGetInteger("gSilverRupeeJingleExtend", 0) ? 10 : 5)) { + if (sCollectedCount < (CVarGetInteger(CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), 0) ? 10 : 5)) { // "sound?" osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ 音? ☆☆☆☆☆ %d\n" VT_RST, this->noteIndex); Audio_PlaySoundTransposed(&D_801333D4, NA_SE_EV_FIVE_COUNT_LUPY, majorScale[this->noteIndex]); @@ -480,7 +480,7 @@ void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) { if (!this->broken) { OPEN_DISPS(play->state.gfxCtx); - if (CVarGetInteger("gNewDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0)) { // purple/gold/silver rupees need less scaling f32 mtxScale = this->colorIdx >= 3 ? 17.5f : 25.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); @@ -488,7 +488,7 @@ void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) { if (this->type == ENGSWITCH_TARGET_RUPEE) { GetItem_Draw(play, sRupeeTexturesNew[this->colorIdx]); } else { - Color_RGB8 silverRupeeColor = CVarGetColor24("gCosmetics.Consumable_SilverRupee.Value", (Color_RGB8){ 255, 255, 255 }); + Color_RGB8 silverRupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.SilverRupee.Value"), (Color_RGB8){ 255, 255, 255 }); Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD); @@ -507,28 +507,28 @@ void EnGSwitch_DrawRupee(Actor* thisx, PlayState* play) { u8 shouldColor = 0; switch (this->colorIdx) { case 0: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_GreenRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_GreenRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.GreenRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.GreenRupee.Changed"), 0); break; case 1: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_BlueRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_BlueRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.BlueRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.BlueRupee.Changed"), 0); break; case 2: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_RedRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_RedRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.RedRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.RedRupee.Changed"), 0); break; case 4: // orange rupee texture corresponds to the purple rupee (authentic bug) - rupeeColor = CVarGetColor24("gCosmetics.Consumable_PurpleRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_PurpleRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.PurpleRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.PurpleRupee.Changed"), 0); break; case 3: // pink rupee texture corresponds to the gold rupee (authentic bug) - rupeeColor = CVarGetColor24("gCosmetics.Consumable_GoldRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_GoldRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.GoldRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.GoldRupee.Changed"), 0); break; case 5: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_SilverRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_SilverRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.SilverRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.SilverRupee.Changed"), 0); break; } @@ -635,28 +635,28 @@ void EnGSwitch_DrawEffects(EnGSwitch* this, PlayState* play) { u8 shouldColor = 0; switch (effect->colorIdx) { case 0: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_GreenRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_GreenRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.GreenRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.GreenRupee.Changed"), 0); break; case 1: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_BlueRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_BlueRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.BlueRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.BlueRupee.Changed"), 0); break; case 2: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_RedRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_RedRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.RedRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.RedRupee.Changed"), 0); break; case 3: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_PurpleRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_PurpleRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.PurpleRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.PurpleRupee.Changed"), 0); break; case 4: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_GoldRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_GoldRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.GoldRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.GoldRupee.Changed"), 0); break; case 5: - rupeeColor = CVarGetColor24("gCosmetics.Consumable_SilverRupee.Value", (Color_RGB8){ 255, 255, 255 }); - shouldColor = CVarGetInteger("gCosmetics.Consumable_SilverRupee.Changed", 0); + rupeeColor = CVarGetColor24(CVAR_COSMETIC("Consumable.SilverRupee.Value"), (Color_RGB8){ 255, 255, 255 }); + shouldColor = CVarGetInteger(CVAR_COSMETIC("Consumable.SilverRupee.Changed"), 0); break; } diff --git a/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c b/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c index 835743b34..81840dc1c 100644 --- a/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c +++ b/soh/src/overlays/actors/ovl_En_Ge3/z_en_ge3.c @@ -245,7 +245,7 @@ s32 EnGe3_OverrideLimbDraw(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* p rot->x += this->headRot.y; default: - if (CVarGetInteger("gGerudoWarriorClothingFix", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("GerudoWarriorClothingFix"), 0)) { // This is a hack to fix the color-changing clothes this Gerudo has on N64 versions OPEN_DISPS(play->state.gfxCtx); switch (limbIndex) { diff --git a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c index 6aa1b7d41..11c29227f 100644 --- a/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c +++ b/soh/src/overlays/actors/ovl_En_GirlA/z_en_girla.c @@ -493,7 +493,7 @@ s32 EnGirlA_CanBuy_DekuNuts(PlayState* play, EnGirlA* this) { if (gSaveContext.rupees < this->basePrice) { return CANBUY_RESULT_NEED_RUPEES; } - if ((Item_CheckObtainability(ITEM_NUT) == ITEM_NONE) && !CVarGetInteger("gFastDrops", 0)) { + if ((Item_CheckObtainability(ITEM_NUT) == ITEM_NONE) && !CVarGetInteger(CVAR_ENHANCEMENT("FastDrops"), 0)) { return CANBUY_RESULT_SUCCESS_FANFARE; } return CANBUY_RESULT_SUCCESS; @@ -506,7 +506,7 @@ s32 EnGirlA_CanBuy_DekuSticks(PlayState* play, EnGirlA* this) { if (gSaveContext.rupees < this->basePrice) { return CANBUY_RESULT_NEED_RUPEES; } - if ((Item_CheckObtainability(ITEM_STICK) == ITEM_NONE) && !CVarGetInteger("gFastDrops", 0)) { + if ((Item_CheckObtainability(ITEM_STICK) == ITEM_NONE) && !CVarGetInteger(CVAR_ENHANCEMENT("FastDrops"), 0)) { return CANBUY_RESULT_SUCCESS_FANFARE; } return CANBUY_RESULT_SUCCESS; @@ -705,7 +705,7 @@ s32 EnGirlA_CanBuy_DekuSeeds(PlayState* play, EnGirlA* this) { if (gSaveContext.rupees < this->basePrice) { return CANBUY_RESULT_NEED_RUPEES; } - if ((Item_CheckObtainability(ITEM_SEEDS) == ITEM_NONE) && !CVarGetInteger("gFastDrops", 0)) { + if ((Item_CheckObtainability(ITEM_SEEDS) == ITEM_NONE) && !CVarGetInteger(CVAR_ENHANCEMENT("FastDrops"), 0)) { return CANBUY_RESULT_SUCCESS_FANFARE; } return CANBUY_RESULT_SUCCESS; diff --git a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 4194e9ee5..d20a19aec 100644 --- a/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/soh/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1316,7 +1316,7 @@ void EnGo2_RollingAnimation(EnGo2* this, PlayState* play) { } void EnGo2_WakeUp(EnGo2* this, PlayState* play) { - if (CVarGetInteger("gUnfixGoronSpin", 0)) { + if (CVarGetInteger(CVAR_COSMETIC("UnfixGoronSpin"), 0)) { // Trick SkelAnime into thinking the current animation is changing so that it morphs between the same position, // making the goron do a spin this->skelAnime.animation = NULL; @@ -2039,7 +2039,7 @@ s32 EnGo2_OverrideLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3f* pos, V f32 float1; if (limb == 17) { - Matrix_Translate(2800.0f + CVarGetFloat("gCosmetics.Goron_NeckLength", 0.0f), 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_Translate(2800.0f + CVarGetFloat(CVAR_COSMETIC("Goron.NeckLength"), 0.0f), 0.0f, 0.0f, MTXMODE_APPLY); vec1 = this->interactInfo.headRot; float1 = (vec1.y / (f32)0x8000) * M_PI; Matrix_RotateX(float1, MTXMODE_APPLY); diff --git a/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 159774406..64329bb04 100644 --- a/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -594,8 +594,8 @@ void EnGs_Draw(Actor* thisx, PlayState* play) { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, this->flashColor.r, this->flashColor.g, this->flashColor.b, this->flashColor.a); } else { - if (CVarGetInteger("gCosmetics.World_GossipStone.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.World_GossipStone.Value", (Color_RGB8){255, 255, 255}); + if (CVarGetInteger(CVAR_COSMETIC("World.GossipStone.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("World.GossipStone.Value"), (Color_RGB8){255, 255, 255}); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color.r, color.g, color.b, 255); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); diff --git a/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index d3b81c3d2..947a65c99 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/soh/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -337,9 +337,9 @@ void func_80A56B40(EnHeishi4* this, PlayState* play) { Player* player = GET_PLAYER(play); // Only allow sneaking when not wearing a mask as that triggers different dialogue. MM Bunny hood disables // these interactions, so bunny hood is fine in that case. - if (CVarGetInteger("gMarketSneak", 0) && + if (CVarGetInteger(CVAR_ENHANCEMENT("MarketSneak"), 0) && (player->currentMask == PLAYER_MASK_NONE || - (player->currentMask == PLAYER_MASK_BUNNY && CVarGetInteger("gMMBunnyHood", 0)))) { + (player->currentMask == PLAYER_MASK_BUNNY && CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), 0)))) { this->actionFunc = EnHeishi4_MarketSneak; } else { this->actionFunc = func_80A56614; diff --git a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c index f653b6ff9..a9fb3267e 100644 --- a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -3042,7 +3042,7 @@ void EnHorse_StickDirection(Vec2f* curStick, f32* stickMag, s16* angle) { void EnHorse_UpdateStick(EnHorse* this, PlayState* play) { this->lastStick = this->curStick; - this->curStick.x = play->state.input[0].rel.stick_x * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1); + this->curStick.x = play->state.input[0].rel.stick_x * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1); this->curStick.y = play->state.input[0].rel.stick_y; } @@ -3312,7 +3312,7 @@ void EnHorse_CheckBoost(EnHorse* thisx, PlayState* play2) { this->stateFlags |= ENHORSE_BOOST; this->stateFlags |= ENHORSE_FIRST_BOOST_REGEN; this->stateFlags |= ENHORSE_FLAG_8; - if (!CVarGetInteger("gInfiniteEpona", 0)) { this->numBoosts--; } + if (!CVarGetInteger(CVAR_CHEAT("InfiniteEponaBoost"), 0)) { this->numBoosts--; } this->boostTimer = 0; if (this->numBoosts == 0) { this->boostRegenTime = 140; diff --git a/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c index cbcd03e0e..76ca5049e 100644 --- a/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/soh/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -439,7 +439,7 @@ u16 func_80A6F810(PlayState* play, Actor* thisx) { if (followingDog != 0) { this->unk_215 = false; - return ((followingDog == 1) || (CVarGetInteger("gAllDogsRichard", 0))) ? 0x709F : 0x709E; + return ((followingDog == 1) || (CVarGetInteger(CVAR_ENHANCEMENT("AllDogsRichard"), 0))) ? 0x709F : 0x709E; } else { return 0x709D; } diff --git a/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 3da5dbe7b..39f8c587d 100644 --- a/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -233,7 +233,8 @@ void func_80A74398(Actor* thisx, PlayState* play) { Effect_Add(play, &this->blureIdx, EFFECT_BLURE1, 0, 0, &blureInit); func_80A74714(this); - uint8_t enemyRandoCCActive = CVarGetInteger("gRandomizedEnemies", 0) || CVarGetInteger("gCrowdControl", 0); + uint8_t enemyRandoCCActive = CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) || + (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0)); if (this->switchFlags != 0xFF) { // In vanilla gameplay, Iron Knuckles are despawned based on specific flags in specific scenarios. @@ -303,7 +304,7 @@ void func_80A747C0(EnIk* this, PlayState* play) { this->skelAnime.playSpeed = 1.0f; // Disable miniboss music with Enemy Randomizer because the music would keep // playing if the enemy was never defeated, which is common with Enemy Randomizer. - if (!CVarGetInteger("gRandomizedEnemies", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { func_800F5ACC(NA_BGM_MINI_BOSS); } } @@ -663,7 +664,8 @@ void func_80A75A38(EnIk* this, PlayState* play) { Item_DropCollectibleRandom(play, &this->actor, &this->actor.world.pos, 0xB0); // Don't set flag when Enemy Rando or CrowdControl are on. // Instead Iron Knuckles rely on the "clear room" flag. - if (this->switchFlags != 0xFF && !CVarGetInteger("gRandomizedEnemies", 0) && !CVarGetInteger("gCrowdControl", 0)) { + if (this->switchFlags != 0xFF && !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) && + !(CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0))) { Flags_SetSwitch(play, this->switchFlags); } Actor_Kill(&this->actor); @@ -810,8 +812,8 @@ Gfx* func_80A761B0(GraphicsContext* gfxCtx, u8 primR, u8 primG, u8 primB, u8 env displayListHead = displayList; gDPPipeSync(displayListHead++); - if (CVarGetInteger("gCosmetics.NPC_IronKnuckles.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.NPC_IronKnuckles.Value", (Color_RGB8){primR, primG, primB}); + if (CVarGetInteger(CVAR_COSMETIC("NPC.IronKnuckles.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("NPC.IronKnuckles.Value"), (Color_RGB8){primR, primG, primB}); gDPSetPrimColor(displayListHead++, 0, 0, color.r, color.g, color.b, 255); } else { gDPSetPrimColor(displayListHead++, 0, 0, primR, primG, primB, 255); @@ -1466,7 +1468,8 @@ void EnIk_Init(Actor* thisx, PlayState* play) { } // Immediately trigger Iron Knuckle for Enemy Rando and Crowd Control - if ((CVarGetInteger("gRandomizedEnemies", 0) || CVarGetInteger("gCrowdControl", 0)) && (thisx->params == 2 || thisx->params == 3)) { + if ((CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) || (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0))) + && (thisx->params == 2 || thisx->params == 3)) { this->skelAnime.playSpeed = 1.0f; } } diff --git a/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c index 862b6f92b..71891328f 100644 --- a/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/soh/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -213,7 +213,7 @@ void EnInsect_Init(Actor* thisx, PlayState* play2) { // For bugs that aren't linked to a soil patch, we remove the "short lived" flag to prevent them from despawning // And exit early to not increment the "bugs dropped count" - if (CVarGetInteger("gNoBugsDespawn", 0) && this->soilActor == NULL) { + if (CVarGetInteger(CVAR_CHEAT("NoBugsDespawn"), 0) && this->soilActor == NULL) { this->unk_314 &= ~4; return; } 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 fe09f4e2b..c8bea148f 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 @@ -127,7 +127,7 @@ void func_80A90264(EnKakasi2* this, PlayState* play) { bool hasTwoOcarinaButtons = !IS_RANDO || ocarinaButtonCount >= 2; bool skipScarecrow = hasTwoOcarinaButtons && play->msgCtx.msgMode == MSGMODE_OCARINA_PLAYING && - ((CVarGetInteger("gSkipScarecrow", 0) && gSaveContext.scarecrowSpawnSongSet) || + ((CVarGetInteger(CVAR_ENHANCEMENT("InstantScarecrow"), 0) && gSaveContext.scarecrowSpawnSongSet) || (IS_RANDO && Randomizer_GetSettingValue(RSK_SKIP_SCARECROWS_SONG))); if ((BREG(1) != 0) || skipScarecrow && (this->actor.xzDistToPlayer < this->maxSpawnDistance.x) && diff --git a/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.c index ddd197320..466f7271d 100644 --- a/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/soh/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -1084,7 +1084,7 @@ void func_80A98DB4(EnKo* this, PlayState* play) { dist = this->actor.xzDistToPlayer; } - if (CVarGetInteger("gDisableKokiriDrawDistance", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableKokiriDrawDistance"), 0) != 0) { this->appearDist = 32767.0f; Math_SmoothStepToF(&this->modelAlpha, (this->appearDist < dist) ? 0.0f : 255.0f, 0.3f, 40.0f, 1.0f); f32 test = this->appearDist; @@ -1353,9 +1353,9 @@ void EnKo_Draw(Actor* thisx, PlayState* play) { Color_RGBA8 tunicColor = sModelInfo[ENKO_TYPE].tunicColor; Color_RGBA8 bootsColor = sModelInfo[ENKO_TYPE].bootsColor; - if (CVarGetInteger("gCosmetics.NPC_Kokiri.Changed", 0)) { - tunicColor = CVarGetColor("gCosmetics.NPC_Kokiri.Value", sModelInfo[ENKO_TYPE].tunicColor); - bootsColor = CVarGetColor("gCosmetics.NPC_Kokiri.Value", sModelInfo[ENKO_TYPE].bootsColor); + if (CVarGetInteger(CVAR_COSMETIC("NPC.Kokiri.Changed"), 0)) { + tunicColor = CVarGetColor(CVAR_COSMETIC("NPC.Kokiri.Value"), sModelInfo[ENKO_TYPE].tunicColor); + bootsColor = CVarGetColor(CVAR_COSMETIC("NPC.Kokiri.Value"), sModelInfo[ENKO_TYPE].bootsColor); } this->actor.shape.shadowAlpha = this->modelAlpha; diff --git a/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c b/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c index 75e54c140..04b0ca1e3 100644 --- a/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c +++ b/soh/src/overlays/actors/ovl_En_Kusa/z_en_kusa.c @@ -137,9 +137,9 @@ void EnKusa_DropCollectible(EnKusa* this, PlayState* play) { Item_DropCollectibleRandom(play, NULL, &this->actor.world.pos, dropParams << 4); break; case ENKUSA_TYPE_1: - if (CVarGetInteger("gNoRandomDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NoRandomDrops"), 0)) { } - else if (CVarGetInteger("gNoHeartDrops", 0)) { + else if (CVarGetInteger(CVAR_ENHANCEMENT("NoHeartDrops"), 0)) { Item_DropCollectible(play, &this->actor.world.pos, ITEM00_SEEDS); } else if (Rand_ZeroOne() < 0.5f) { diff --git a/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 24abf54ff..73157aedf 100644 --- a/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/soh/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -302,7 +302,7 @@ s32 EnKz_FollowPath(EnKz* this, PlayState* play) { pathDiffZ = pointPos->z - this->actor.world.pos.z; Math_SmoothStepToS(&this->actor.world.rot.y, (Math_FAtan2F(pathDiffX, pathDiffZ) * (0x8000 / M_PI)), 0xA, 0x3E8, 1); - if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 10.0f * CVarGetInteger("gMweepSpeed", 1)) { + if ((SQ(pathDiffX) + SQ(pathDiffZ)) < 10.0f * CVarGetInteger(CVAR_ENHANCEMENT("MweepSpeed"), 1)) { this->waypoint++; if (this->waypoint >= path->count) { this->waypoint = 0; @@ -397,7 +397,7 @@ void EnKz_SetupMweep(EnKz* this, PlayState* play) { initPos.z += 260.0f; Play_CameraSetAtEye(play, this->cutsceneCamera, &pos, &initPos); Player_SetCsActionWithHaltedActors(play, &this->actor, 8); - this->actor.speedXZ = 0.1f * CVarGetInteger("gMweepSpeed", 1); + this->actor.speedXZ = 0.1f * CVarGetInteger(CVAR_ENHANCEMENT("MweepSpeed"), 1); this->actionFunc = EnKz_Mweep; } 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 00cfb3555..2143aa6e6 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 @@ -340,8 +340,8 @@ void EnMThunder_Draw(Actor* thisx, PlayState* play2) { switch (this->unk_1C6) { case 0: - if (CVarGetInteger("gCosmetics.SpinAttack_Level2Primary.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.SpinAttack_Level2Primary.Value", (Color_RGB8){255, 255, 170}); + if (CVarGetInteger(CVAR_COSMETIC("SpinAttack.Level2Primary.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("SpinAttack.Level2Primary.Value"), (Color_RGB8){255, 255, 170}); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, color.r, color.g, color.b, (u8)(this->unk_1B0 * 255)); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, (u8)(this->unk_1B0 * 255)); @@ -350,8 +350,8 @@ void EnMThunder_Draw(Actor* thisx, PlayState* play2) { gSPDisplayList(POLY_XLU_DISP++, gSpinAttack4DL); break; case 1: - if (CVarGetInteger("gCosmetics.SpinAttack_Level1Primary.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.SpinAttack_Level1Primary.Value", (Color_RGB8){170, 255, 255}); + if (CVarGetInteger(CVAR_COSMETIC("SpinAttack.Level1Primary.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("SpinAttack.Level1Primary.Value"), (Color_RGB8){170, 255, 255}); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, color.r, color.g, color.b, (u8)(this->unk_1B0 * 255)); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, (u8)(this->unk_1B0 * 255)); @@ -383,14 +383,14 @@ void EnMThunder_Draw(Actor* thisx, PlayState* play2) { if (this->unk_1B8 >= 0.85f) { phi_f14 = (D_80AA046C[(play->gameplayFrames & 7)] * 6.0f) + 1.0f; - if (CVarGetInteger("gCosmetics.SpinAttack_Level2Primary.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.SpinAttack_Level2Primary.Value", (Color_RGB8){255, 255, 170}); + if (CVarGetInteger(CVAR_COSMETIC("SpinAttack.Level2Primary.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("SpinAttack.Level2Primary.Value"), (Color_RGB8){255, 255, 170}); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, color.r, color.g, color.b, this->unk_1C8); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 255, 255, 170, this->unk_1C8); } - if (CVarGetInteger("gCosmetics.SpinAttack_Level2Secondary.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.SpinAttack_Level2Secondary.Value", (Color_RGB8){255, 100, 0}); + if (CVarGetInteger(CVAR_COSMETIC("SpinAttack.Level2Secondary.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("SpinAttack.Level2Secondary.Value"), (Color_RGB8){255, 100, 0}); gDPSetEnvColor(POLY_XLU_DISP++, color.r, color.g, color.b, 128); } else { gDPSetEnvColor(POLY_XLU_DISP++, 255, 100, 0, 128); @@ -398,14 +398,14 @@ void EnMThunder_Draw(Actor* thisx, PlayState* play2) { phi_t1 = 0x28; } else { phi_f14 = (D_80AA046C[play->gameplayFrames & 7] * 2.0f) + 1.0f; - if (CVarGetInteger("gCosmetics.SpinAttack_Level1Primary.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.SpinAttack_Level1Primary.Value", (Color_RGB8){170, 255, 255}); + if (CVarGetInteger(CVAR_COSMETIC("SpinAttack.Level1Primary.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("SpinAttack.Level1Primary.Value"), (Color_RGB8){170, 255, 255}); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, color.r, color.g, color.b, this->unk_1C8); } else { gDPSetPrimColor(POLY_XLU_DISP++, 0, 0x80, 170, 255, 255, this->unk_1C8); } - if (CVarGetInteger("gCosmetics.SpinAttack_Level1Secondary.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.SpinAttack_Level1Secondary.Value", (Color_RGB8){0, 100, 255}); + if (CVarGetInteger(CVAR_COSMETIC("SpinAttack.Level1Secondary.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("SpinAttack.Level1Secondary.Value"), (Color_RGB8){0, 100, 255}); gDPSetEnvColor(POLY_XLU_DISP++, color.r, color.g, color.b, 128); } else { 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 adff5253e..44b3399b0 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 @@ -655,7 +655,7 @@ void EnMag_DrawInnerMq(Actor* thisx, PlayState* play, Gfx** gfxp) { u16 rectTop; u16 length; int lang = LANGUAGE_ENG; - if (CVarGetInteger("gTitleScreenTranslation", 0)) { + if (CVarGetInteger(CVAR_SETTING("TitleScreenTranslation"), 0)) { lang = gSaveContext.language; } @@ -855,7 +855,7 @@ void EnMag_DrawInnerVanilla(Actor* thisx, PlayState* play, Gfx** gfxp) { u16 rectTop; u16 length; int lang = LANGUAGE_ENG; - if (CVarGetInteger("gTitleScreenTranslation", 0)) { + if (CVarGetInteger(CVAR_SETTING("TitleScreenTranslation"), 0)) { lang = gSaveContext.language; } diff --git a/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 43f6a6665..b0aff3750 100644 --- a/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -512,7 +512,7 @@ void EnMb_SetupClubAttack(EnMb* this) { // Rotate Club Moblin towards player in Enemy Randomizer because they're // borderline useless otherwise in most scenarios. - if (CVarGetInteger("gRandomizedEnemies", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 100.0f, 0); Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 3, 100.0f, 0); } @@ -717,7 +717,7 @@ void EnMb_ClubWaitAfterAttack(EnMb* this, PlayState* play) { // Rotate Club Moblin towards player in Enemy Randomizer because they're // borderline useless otherwise in most scenarios. - if (CVarGetInteger("gRandomizedEnemies", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 100.0f, 0); Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 3, 100.0f, 0); } @@ -844,7 +844,7 @@ void EnMb_ClubAttack(EnMb* this, PlayState* play) { // Rotate Club Moblin towards player in Enemy Randomizer because they're // borderline useless otherwise in most scenarios. - if (!CVarGetInteger("gRandomizedEnemies", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { Math_SmoothStepToS(&this->actor.shape.rot.y, relYawTarget[this->attack - 1] + this->actor.world.rot.y, 1, 0x2EE, 0); } else { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 100.0f, 0); @@ -891,7 +891,7 @@ void EnMb_ClubAttack(EnMb* this, PlayState* play) { // Disable camera shake when the Moblin attacks with Enemy Randomizer enabled. // This camera shake gets very annoying as these Moblins can spawn in many rooms, // and also often (initially) out of reach for the player. - if (!CVarGetInteger("gRandomizedEnemies", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { Camera_AddQuake(&play->mainCamera, 2, 0x19, 5); } func_800358DC(&this->actor, &effSpawnPos, &this->actor.world.rot, flamesParams, 20, flamesUnused, play, @@ -1267,7 +1267,7 @@ void EnMb_ClubWaitPlayerNear(EnMb* this, PlayState* play) { // Rotate Club Moblin towards player in Enemy Randomizer because they're // borderline useless otherwise in most scenarios. - if (CVarGetInteger("gRandomizedEnemies", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 100.0f, 0); Math_SmoothStepToS(&this->actor.world.rot.y, this->actor.yawTowardsPlayer, 3, 100.0f, 0); } @@ -1278,7 +1278,7 @@ void EnMb_ClubWaitPlayerNear(EnMb* this, PlayState* play) { // Add a height check to the Moblin's Club attack when Enemy Randomizer is on. // Without the height check, the Moblin will attack (and play the sound effect) a lot even though // the Moblin is very far away from the player in vertical rooms (like the first room in Deku Tree). - s8 enemyRando = CVarGetInteger("gRandomizedEnemies", 0); + s8 enemyRando = CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0); if (!enemyRando || (enemyRando && this->actor.yDistToPlayer <= 100.0f && this->actor.yDistToPlayer >= -100.0f)) { EnMb_SetupClubAttack(this); } diff --git a/soh/src/overlays/actors/ovl_En_Md/z_en_md.c b/soh/src/overlays/actors/ovl_En_Md/z_en_md.c index 280648aac..f55123f5b 100644 --- a/soh/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/soh/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -616,7 +616,7 @@ void func_80AAB5A4(EnMd* this, PlayState* play) { f32 temp; if (play->sceneNum != SCENE_MIDOS_HOUSE) { - if (CVarGetInteger("gDisableKokiriDrawDistance", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableKokiriDrawDistance"), 0) != 0) { temp = (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && !Flags_GetEventChkInf(EVENTCHKINF_SPOKE_TO_MIDO_AFTER_DEKU_TREES_DEATH) && (play->sceneNum == SCENE_KOKIRI_FOREST)) ? 100.0f diff --git a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 0497b82e9..45433afd6 100644 --- a/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/soh/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -666,7 +666,7 @@ void func_80AB6D08(EnNiw* this, PlayState* play) { } this->path = 1; - this->timer5 = 80 * CVarGetInteger("gCuccoStayDurationMultiplier", 1); + this->timer5 = 80 * CVarGetInteger(CVAR_ENHANCEMENT("CuccoStayDurationMult"), 1); this->actor.speedXZ = 0.0f; this->actor.velocity.y = 4.0f; } else { diff --git a/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 2add8c4a9..63f4fe3a3 100644 --- a/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -75,7 +75,7 @@ void EnNutsball_Init(Actor* thisx, PlayState* play) { ActorShape_Init(&this->actor.shape, 400.0f, ActorShadow_DrawCircle, 13.0f); Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); - if (CVarGetInteger("gRandomizedEnemies", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { this->objBankIndex = 0; } else { this->objBankIndex = Object_GetIndex(&play->objectCtx, sObjectIDs[this->actor.params]); @@ -176,7 +176,7 @@ void EnNutsball_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - if (CVarGetInteger("gNewDrops", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0) != 0) { Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 6), diff --git a/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 9533e8309..5d75b7343 100644 --- a/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -506,7 +506,7 @@ void EnOkuta_ProjectileFly(EnOkuta* this, PlayState* play) { pos.x = this->actor.world.pos.x; pos.y = this->actor.world.pos.y + 11.0f; pos.z = this->actor.world.pos.z; - if (CVarGetInteger("gNewDrops", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0) != 0) { static s16 sEffectScales[] = { 145, 135, 115, 85, 75, 53, 45, 40, 35, }; @@ -763,7 +763,7 @@ void EnOkuta_Draw(Actor* thisx, PlayState* play) { } else { OPEN_DISPS(play->state.gfxCtx); - if (CVarGetInteger("gNewDrops", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NewDrops"), 0) != 0) { Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPSegment(POLY_OPA_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 6), 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 afa825e57..eeea17e47 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 @@ -664,7 +664,7 @@ void EnOssan_UpdateCursorPos(PlayState* play, EnOssan* this) { this->cursorX = x; this->cursorY = y; - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { this->cursorX = SCREEN_WIDTH - x; } } @@ -775,7 +775,7 @@ void EnOssan_UpdateJoystickInputState(PlayState* play, EnOssan* this) { s8 stickX = input->rel.stick_x; s8 stickY = input->rel.stick_y; - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { stickX = -input->rel.stick_x; } @@ -981,7 +981,7 @@ s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, PlayState* play) { void EnOssan_State_FacingShopkeeper(EnOssan* this, PlayState* play, Player* player) { Input* input = &play->state.input[0]; u8 nextIndex; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); if ((Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE) && !EnOssan_TestEndInteraction(this, play, &play->state.input[0])) { @@ -992,7 +992,7 @@ void EnOssan_State_FacingShopkeeper(EnOssan* this, PlayState* play, Player* play u16 dLeft = BTN_DLEFT; u16 dRight = BTN_DRIGHT; - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { dLeft = BTN_DRIGHT; dRight = BTN_DLEFT; } @@ -1070,7 +1070,7 @@ void EnOssan_CursorUpDown(EnOssan* this, PlayState* play) { Input* input = &play->state.input[0]; u8 curTemp = this->cursorIndex; u8 curScanTemp; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); if ((this->stickAccumY < 0) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DDOWN))) { curTemp &= 0xFE; @@ -1223,7 +1223,7 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, PlayState* play, Player* playe u8 prevIndex = this->cursorIndex; s32 c; s32 d; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); if (!EnOssan_ReturnItemToShelf(this)) { osSyncPrintf("%s[%d]:" VT_FGCOL(GREEN) "ズーム中!!" VT_RST "\n", __FILE__, __LINE__); @@ -1242,7 +1242,7 @@ void EnOssan_State_BrowseLeftShelf(EnOssan* this, PlayState* play, Player* playe u16 dLeft = BTN_DLEFT; u16 dRight = BTN_DRIGHT; - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { dLeft = BTN_DRIGHT; dRight = BTN_DLEFT; } @@ -1292,7 +1292,7 @@ void EnOssan_State_BrowseRightShelf(EnOssan* this, PlayState* play, Player* play s32 pad[2]; u8 prevIndex; u8 nextIndex; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); prevIndex = this->cursorIndex; if (!EnOssan_ReturnItemToShelf(this)) { @@ -1312,7 +1312,7 @@ void EnOssan_State_BrowseRightShelf(EnOssan* this, PlayState* play, Player* play u16 dLeft = BTN_DLEFT; u16 dRight = BTN_DRIGHT; - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { dLeft = BTN_DRIGHT; dRight = BTN_DLEFT; } @@ -1976,9 +1976,9 @@ void EnOssan_UpdateItemSelectedProperty(EnOssan* this) { void EnOssan_UpdateCursorAnim(EnOssan* this) { Color_RGB8 aButtonColor = { 0, 80, 255 }; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + aButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), aButtonColor); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = (Color_RGB8){ 0, 255, 80 }; } f32 t; @@ -2414,7 +2414,7 @@ void EnOssan_DrawStickDirectionPrompts(PlayState* play, EnOssan* this) { s32 drawStickRightPrompt = this->stickRightPrompt.isEnabled; // Invert which stick prompt is active when only one is active - if (CVarGetInteger("gMirroredWorld", 0) && (drawStickLeftPrompt != drawStickRightPrompt)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) && (drawStickLeftPrompt != drawStickRightPrompt)) { drawStickLeftPrompt = !drawStickLeftPrompt; drawStickRightPrompt = !drawStickRightPrompt; } @@ -2535,7 +2535,7 @@ s32 EnGo2_OverrideLimbDrawGoronShopkeeper (PlayState* play, s32 limb, Gfx** dLis EnOssan* this = (EnOssan*)thisx; if (limb == 17) { - Matrix_Translate(CVarGetFloat("gCosmetics.Goron_NeckLength", 0.0f), 0.0f, 0.0f, MTXMODE_APPLY); + Matrix_Translate(CVarGetFloat(CVAR_COSMETIC("Goron.NeckLength"), 0.0f), 0.0f, 0.0f, MTXMODE_APPLY); } return 0; } diff --git a/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c index c5f6acaee..776c59149 100644 --- a/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/soh/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -373,7 +373,7 @@ void func_80ACA7E0(EnOwl* this, PlayState* play) { void EnOwl_ConfirmKokiriMessage(EnOwl* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVarGetInteger("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); + uint8_t index = CVarGetInteger(CVAR_ENHANCEMENT("BetterOwl"), 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: Message_ContinueTextbox(play, 0x2065); @@ -402,7 +402,7 @@ void EnOwl_WaitOutsideKokiri(EnOwl* this, PlayState* play) { void func_80ACA998(EnOwl* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVarGetInteger("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); + uint8_t index = CVarGetInteger(CVAR_ENHANCEMENT("BetterOwl"), 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: Message_ContinueTextbox(play, 0x2069); @@ -448,7 +448,7 @@ void EnOwl_WaitHyruleCastle(EnOwl* this, PlayState* play) { void func_80ACAB88(EnOwl* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVarGetInteger("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); + uint8_t index = CVarGetInteger(CVAR_ENHANCEMENT("BetterOwl"), 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: // obtained zelda's letter @@ -491,7 +491,7 @@ void EnOwl_WaitKakariko(EnOwl* this, PlayState* play) { void func_80ACAD34(EnOwl* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVarGetInteger("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); + uint8_t index = CVarGetInteger(CVAR_ENHANCEMENT("BetterOwl"), 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: Message_ContinueTextbox(play, 0x206F); @@ -529,7 +529,7 @@ void EnOwl_WaitGerudo(EnOwl* this, PlayState* play) { void func_80ACAEB8(EnOwl* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVarGetInteger("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); + uint8_t index = CVarGetInteger(CVAR_ENHANCEMENT("BetterOwl"), 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: Message_ContinueTextbox(play, 0x2071); @@ -651,7 +651,7 @@ void EnOwl_WaitDeathMountainShortcut(EnOwl* this, PlayState* play) { void func_80ACB344(EnOwl* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVarGetInteger("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); + uint8_t index = CVarGetInteger(CVAR_ENHANCEMENT("BetterOwl"), 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: Message_ContinueTextbox(play, 0x607A); @@ -676,7 +676,7 @@ void func_80ACB3E0(EnOwl* this, PlayState* play) { void func_80ACB440(EnOwl* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVarGetInteger("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); + uint8_t index = CVarGetInteger(CVAR_ENHANCEMENT("BetterOwl"), 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: Message_ContinueTextbox(play, 0x10C1); @@ -713,7 +713,7 @@ void EnOwl_WaitLWPreSaria(EnOwl* this, PlayState* play) { void func_80ACB5C4(EnOwl* this, PlayState* play) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_CHOICE && Message_ShouldAdvance(play)) { // swap the order of the responses if better owl is enabled - uint8_t index = CVarGetInteger("gBetterOwl", 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); + uint8_t index = CVarGetInteger(CVAR_ENHANCEMENT("BetterOwl"), 0) == 0 ? play->msgCtx.choiceIndex : (1 - play->msgCtx.choiceIndex); switch (index) { case OWL_REPEAT: Message_ContinueTextbox(play, 0x10C5); diff --git a/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c b/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c index 6a001d07b..de7bddf82 100644 --- a/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c +++ b/soh/src/overlays/actors/ovl_En_Partner/z_en_partner.c @@ -580,7 +580,7 @@ void EnPartner_Update(Actor* thisx, PlayState* play) { Input sControlInput = play->state.input[this->actor.params]; - f32 relX = sControlInput.cur.stick_x / 10.0f * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1); + f32 relX = sControlInput.cur.stick_x / 10.0f * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1); f32 relY = sControlInput.cur.stick_y / 10.0f; Vec3f camForward = { GET_ACTIVE_CAM(play)->at.x - GET_ACTIVE_CAM(play)->eye.x, 0.0f, @@ -689,7 +689,7 @@ void EnPartner_Update(Actor* thisx, PlayState* play) { uint16_t partnerButtons[7] = { BTN_CLEFT, BTN_CDOWN, BTN_CRIGHT, BTN_DUP, BTN_DDOWN, BTN_DLEFT, BTN_DRIGHT}; uint8_t buttonMax = 3; - if (CVarGetInteger("gDpadEquips", 0) != 0) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { buttonMax = ARRAY_COUNT(gSaveContext.equips.cButtonSlots); } @@ -745,8 +745,8 @@ void EnPartner_Update(Actor* thisx, PlayState* play) { CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider.base); } - if (CVarGetInteger("gCosmetics.Ivan_IdlePrimary.Changed", 0)) { - Color_RGB8 ivanColor1 = CVarGetColor24("gCosmetics.Ivan_IdlePrimary.Value", (Color_RGB8){ 255, 255, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Ivan.IdlePrimary.Changed"), 0)) { + Color_RGB8 ivanColor1 = CVarGetColor24(CVAR_COSMETIC("Ivan.IdlePrimary.Value"), (Color_RGB8){ 255, 255, 255 }); this->innerColor.r = ivanColor1.r; this->innerColor.g = ivanColor1.g; this->innerColor.b = ivanColor1.b; @@ -756,8 +756,8 @@ void EnPartner_Update(Actor* thisx, PlayState* play) { this->innerColor.b = 255; } - if (CVarGetInteger("gCosmetics.Ivan_IdleSecondary.Changed", 0)) { - Color_RGB8 ivanColor2 = CVarGetColor24("gCosmetics.Ivan_IdleSecondary.Value", (Color_RGB8){ 0, 255, 0 }); + if (CVarGetInteger(CVAR_COSMETIC("Ivan.IdleSecondary.Changed"), 0)) { + Color_RGB8 ivanColor2 = CVarGetColor24(CVAR_COSMETIC("Ivan.IdleSecondary.Value"), (Color_RGB8){ 0, 255, 0 }); this->outerColor.r = ivanColor2.r; this->outerColor.g = ivanColor2.g; this->outerColor.b = ivanColor2.b; diff --git a/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index 7b444f241..5526ad49c 100644 --- a/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/soh/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -328,7 +328,7 @@ void EnPeehat_Ground_SetStateGround(EnPeehat* this) { void EnPeehat_Ground_StateGround(EnPeehat* this, PlayState* play) { // Keep the peahat as the version that doesn't spawn extra enemies and can actually be killed // when Enemy Randomizer is on. - if (IS_DAY || CVarGetInteger("gRandomizedEnemies", 0)) { + if (IS_DAY || CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { this->actor.flags |= ACTOR_FLAG_TARGETABLE; if (this->riseDelayTimer == 0) { if (this->actor.xzDistToPlayer < this->xzDistToRise) { diff --git a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 4514439c1..e69cfda78 100644 --- a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -254,7 +254,7 @@ void func_80AE2744(EnRd* this, PlayState* play) { // Add a height check to redeads/gibdos freeze when Enemy Randomizer is on. // Without the height check, redeads/gibdos can freeze the player from insane distances in // vertical rooms (like the first room in Deku Tree), making these rooms nearly unplayable. - s8 enemyRandoCCActive = CVarGetInteger("gRandomizedEnemies", 0) || CVarGetInteger("gCrowdControl", 0); + s8 enemyRandoCCActive = CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) || (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0)); if (!enemyRandoCCActive || (enemyRandoCCActive && this->actor.yDistToPlayer <= 100.0f && this->actor.yDistToPlayer >= -100.0f)) { if ((this->actor.params != 2) && (this->unk_305 == 0)) { func_80AE37BC(this); @@ -338,7 +338,7 @@ void func_80AE2C1C(EnRd* this, PlayState* play) { PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_CLIMBING_LADDER)) && !(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { if (this->unk_306 == 0) { - if (!(this->unk_312 & PLAYER_STATE2_GRABBED_BY_ENEMY) && !CVarGetInteger("gNoRedeadFreeze", 0)) { + if (!(this->unk_312 & PLAYER_STATE2_GRABBED_BY_ENEMY) && !CVarGetInteger(CVAR_CHEAT("NoRedeadFreeze"), 0)) { player->actor.freezeTimer = 40; func_8008EEAC(play, &this->actor); GET_PLAYER(play)->unk_684 = &this->actor; @@ -570,7 +570,7 @@ void func_80AE3834(EnRd* this, PlayState* play) { s16 temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->unk_30E - this->unk_310; if (ABS(temp_v0) < 0x2008) { - if (!(this->unk_312 & 0x80) && !CVarGetInteger("gNoRedeadFreeze", 0)) { + if (!(this->unk_312 & 0x80) && !CVarGetInteger(CVAR_CHEAT("NoRedeadFreeze"), 0)) { player->actor.freezeTimer = 60; func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); func_8008EEAC(play, &this->actor); @@ -668,7 +668,7 @@ void func_80AE3C98(EnRd* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { if (this->unk_30C == 0) { - s8 enemyRandoCCActive = CVarGetInteger("gRandomizedEnemies", 0) || CVarGetInteger("gCrowdControl", 0); + s8 enemyRandoCCActive = CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) || (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0)); // Don't set this flag in Enemy Rando as it can overlap with other objects using the same flag. if (!Flags_GetSwitch(play, this->unk_312 & 0x7F) && !enemyRandoCCActive) { Flags_SetSwitch(play, this->unk_312 & 0x7F); diff --git a/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index 4582e0b3f..5012dff2b 100644 --- a/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/soh/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -42,7 +42,7 @@ void EnRiverSound_Init(Actor* thisx, PlayState* play) { } else if (this->actor.params == RS_SARIAS_SONG) { // Always have leading music in rando if ( - CVarGetInteger("gLostWoodsConsistentVolume", 0) || + CVarGetInteger(CVAR_AUDIO("LostWoodsConsistentVolume"), 0) || ((!CHECK_QUEST_ITEM(QUEST_SONG_LULLABY) || CHECK_QUEST_ITEM(QUEST_SONG_SARIA)) && !IS_RANDO) ) { Actor_Kill(&this->actor); diff --git a/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c index 616a4d700..73223218e 100644 --- a/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -739,7 +739,7 @@ void EnSa_Update(Actor* thisx, PlayState* play) { } if (this->actionFunc != func_80AF68E4) { - if (CVarGetInteger("gDisableKokiriDrawDistance", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableKokiriDrawDistance"), 0) != 0) { this->alpha = func_80034DD4(&this->actor, play, this->alpha, 32767); } else { diff --git a/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.c index 6a5862747..e985fe862 100644 --- a/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/soh/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -192,7 +192,7 @@ void EnSkb_Destroy(Actor* thisx, PlayState* play) { void func_80AFCD60(EnSkb* this) { // Don't despawn stallchildren during daytime when enemy randomizer is enabled. - if (IS_DAY && !CVarGetInteger("gRandomizedEnemies", 0)) { + if (IS_DAY && !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { func_80AFCF48(this); } else if (Actor_IsFacingPlayer(&this->actor, 0x11C7) && (this->actor.xzDistToPlayer < (60.0f + (this->actor.params * 6.0f)))) { @@ -290,7 +290,7 @@ void EnSkb_Advance(EnSkb* this, PlayState* play) { } } // Don't despawn stallchildren during daytime or when a stalchildren walks too far away from his "home" when enemy randomizer is enabled. - if ((Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) > 800.0f || IS_DAY) && !CVarGetInteger("gRandomizedEnemies", 0)) { + if ((Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) > 800.0f || IS_DAY) && !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { func_80AFCF48(this); } else if (Actor_IsFacingPlayer(&this->actor, 0x11C7) && (this->actor.xzDistToPlayer < (60.0f + (this->actor.params * 6.0f)))) { diff --git a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 7398d00c0..b903adc55 100644 --- a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1407,7 +1407,7 @@ void EnSkj_StartOcarinaMinigame(EnSkj* this, PlayState* play) { if (dialogState == TEXT_STATE_CLOSING) { // #region SOH [Enhancement] - if (CVarGetInteger("gInstantOcarinaGameWin", 0) && CVarGetInteger("gCustomizeOcarinaGame", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("InstantOcarinaGameWin"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 0)) { play->msgCtx.ocarinaMode = OCARINA_MODE_0F; this->songFailTimer = 160; this->actionFunc = EnSkj_WaitForPlayback; @@ -1469,8 +1469,8 @@ void EnSkj_WaitForPlayback(EnSkj* this, PlayState* play) { case MSGMODE_MEMORY_GAME_PLAYER_PLAYING: if (this->songFailTimer != 0) { // #region SOH [Enhancement] - if (CVarGetInteger("gOcarinaUnlimitedFailTime", 0) == 1 && - CVarGetInteger("gCustomizeOcarinaGame", 0) == 1) { + if (CVarGetInteger(CVAR_ENHANCEMENT("OcarinaUnlimitedFailTime"), 0) == 1 && + CVarGetInteger(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 0) == 1) { // don't decrement timer // #endregion } else { 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 f62f8b998..00f859e70 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 @@ -354,7 +354,7 @@ s32 func_80B0C9F0(EnSw* this, PlayState* play) { } Enemy_StartFinishingBlow(play, &this->actor); if (((this->actor.params & 0xE000) >> 0xD) != 0) { - if (CVarGetInteger("gGsCutscene", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("GSCutscene"), 0)) { OnePointCutscene_Init(play, 2200, 90, &this->actor, MAIN_CAM); } this->skelAnime.playSpeed = 8.0f; @@ -571,7 +571,7 @@ void func_80B0D590(EnSw* this, PlayState* play) { this->collider.elements[0].info.ocElemFlags = 1; } - Math_ApproachF(&this->actor.scale.x, !IS_DAY || CVarGetInteger("gNightGSAlwaysSpawn", 0) ? 0.02f : 0.0f, 0.2f, 0.01f); + Math_ApproachF(&this->actor.scale.x, !IS_DAY || CVarGetInteger(CVAR_ENHANCEMENT("NightGSAlwaysSpawn"), 0) ? 0.02f : 0.0f, 0.2f, 0.01f); Actor_SetScale(&this->actor, this->actor.scale.x); } diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index f0d9d3897..dbd6007a2 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -111,8 +111,8 @@ void EnSyatekiItm_Idle(EnSyatekiItm* this, PlayState* play) { player->actor.world.rot.x = player->actor.shape.rot.x = player->actor.world.rot.z = player->actor.shape.rot.z = 0; s32 ammunition = 15; - if(CVarGetInteger("gCustomizeShootingGallery", 0)) { - ammunition = CVarGetInteger(LINK_IS_ADULT ? "gAdultShootingGalleryAmmunition" : "gChildShootingGalleryAmmunition", 15); + if(CVarGetInteger(CVAR_ENHANCEMENT("CustomizeShootingGallery"), 0)) { + ammunition = CVarGetInteger(LINK_IS_ADULT ? CVAR_ENHANCEMENT("ShootingGalleryAmmoAdult") : CVAR_ENHANCEMENT("ShootingGalleryAmmoChild"), 15); } func_8008EF44(play, ammunition); this->roundNum = this->hitCount = 0; @@ -132,7 +132,7 @@ void EnSyatekiItm_StartRound(EnSyatekiItm* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->unkTimer == 0) { - if (LINK_IS_ADULT && !(CVarGetInteger("gCustomizeShootingGallery", 0) && CVarGetInteger("gConstantAdultGallery", 0))) { + if (LINK_IS_ADULT && !(CVarGetInteger(CVAR_ENHANCEMENT("CustomizeShootingGallery"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("ConstantAdultGallery"), 0))) { for (i = 0, j = 0; i < SYATEKI_ROUND_MAX; i++) { if (this->roundFlags[i]) { j++; diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 4928048a3..eca7cc18c 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/soh/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -293,7 +293,7 @@ void EnSyatekiMan_StartGame(EnSyatekiMan* this, PlayState* play) { Message_CloseTextbox(play); gallery = ((EnSyatekiItm*)this->actor.parent); if (gallery->actor.update != NULL) { - if(CVarGetInteger("gCustomizeShootingGallery", 0) && CVarGetInteger("gInstantShootingGalleryWin", 0)) { + if(CVarGetInteger(CVAR_ENHANCEMENT("CustomizeShootingGallery"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("InstantShootingGalleryWin"), 0)) { gallery->hitCount = 10; gallery->signal = ENSYATEKI_END; } else { @@ -394,8 +394,8 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, PlayState* play) { case SYATEKI_RESULT_ALMOST: this->timer = 20; s32 ammunition = 15; - if(CVarGetInteger("gCustomizeShootingGallery", 0)) { - ammunition = CVarGetInteger(LINK_IS_ADULT ? "gAdultShootingGalleryAmmunition" : "gChildShootingGalleryAmmunition", 15); + if(CVarGetInteger(CVAR_ENHANCEMENT("CustomizeShootingGallery"), 0)) { + ammunition = CVarGetInteger(LINK_IS_ADULT ? CVAR_ENHANCEMENT("ShootingGalleryAmmoAdult") : CVAR_ENHANCEMENT("ShootingGalleryAmmoChild"), 15); } func_8008EF44(play, ammunition); this->actionFunc = EnSyatekiMan_RestartGame; diff --git a/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index f919bb39a..9e9fc82f5 100644 --- a/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -128,7 +128,7 @@ void EnTorch2_Init(Actor* thisx, PlayState* play2) { // Change Dark Link to regular enemy instead of boss with enemy randomizer and crowd control. // This way Dark Link will be considered for "clear enemy" rooms properly. - if (CVarGetInteger("gRandomizedEnemies", 0) || CVarGetInteger("gCrowdControl", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) || (CVarGetInteger(CVAR_REMOTE("Scheme"), GI_SCHEME_SAIL) == GI_SCHEME_CROWD_CONTROL && CVarGetInteger(CVAR_REMOTE("Enabled"), 0))) { Actor_ChangeCategory(play, &play->actorCtx, thisx, ACTORCAT_ENEMY); } @@ -279,7 +279,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { } // Disable miniboss music with Enemy Randomizer because the music would keep // playing if the enemy was never defeated, which is common with Enemy Randomizer. - if (!CVarGetInteger("gRandomizedEnemies", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { func_800F5ACC(NA_BGM_MINI_BOSS); } sActionState = ENTORCH2_ATTACK; @@ -592,7 +592,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { input->prev.button = input->cur.button & (u16) ~(BTN_A | BTN_B); PadUtils_UpdateRelXY(input); - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { input->rel.stick_x *= -1; } diff --git a/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c b/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c index d7a838d8a..9b6154a8b 100644 --- a/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/soh/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -246,7 +246,7 @@ void EnVali_SetupDivideAndDie(EnVali* this, PlayState* play) { // Offset small jellyfish with Enemy Randomizer, otherwise it gets // stuck in a loop spawning more big jellyfish with seeded spawns. - if (CVarGetInteger("gRandomizedEnemies", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { this->actor.world.rot.y += rand() % 50; } diff --git a/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 2f90ad1a0..1a711b644 100644 --- a/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -405,7 +405,7 @@ void EnWallmas_ReturnToCeiling(EnWallmas* this, PlayState* play) { } } if (this->actor.params == WMT_SHADOWTAG) { - if (!CVarGetInteger("gShadowTag", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("ShadowTag"), 0)) { Actor_Kill(&this->actor); } } @@ -439,7 +439,7 @@ void EnWallmas_Die(EnWallmas* this, PlayState* play) { Actor_Kill(&this->actor); } if (this->actor.params == WMT_SHADOWTAG) { - if (!CVarGetInteger("gShadowTag", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("ShadowTag"), 0)) { Actor_Kill(&this->actor); } else { EnWallmas_Init(this, play); diff --git a/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c b/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c index 41a485bbc..2c243e254 100644 --- a/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c +++ b/soh/src/overlays/actors/ovl_En_Wf/z_en_wf.c @@ -390,7 +390,7 @@ void EnWf_WaitToAppear(EnWf* this, PlayState* play) { // Disable miniboss music with Enemy Randomizer because the music would keep // playing if the enemy was never defeated, which is common with Enemy Randomizer. - if ((this->actor.params != WOLFOS_NORMAL) && (this->switchFlag != 0xFF) && !CVarGetInteger("gRandomizedEnemies", 0)) { + if ((this->actor.params != WOLFOS_NORMAL) && (this->switchFlag != 0xFF) && !CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0)) { func_800F5ACC(NA_BGM_MINI_BOSS); } } diff --git a/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index 4adb7afe7..2b0d6c126 100644 --- a/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/soh/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -101,7 +101,7 @@ static f32 sSpawnSin; s32 EnWood02_SpawnZoneCheck(EnWood02* this, PlayState* play, Vec3f* pos) { f32 phi_f12; - if (CVarGetInteger("gDisableDrawDistance", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableDrawDistance"), 0) != 0) { return true; } @@ -177,7 +177,7 @@ void EnWood02_Init(Actor* thisx, PlayState* play2) { // as the night scene, For the always spawn GS enhancement we apply the needed // params to have the GS drop when bonking if ((this->actor.params & 0xFF) == WOOD_TREE_CONICAL_MEDIUM && IS_DAY && - play->sceneNum == SCENE_KAKARIKO_VILLAGE && CVarGetInteger("gNightGSAlwaysSpawn", 0)) { + play->sceneNum == SCENE_KAKARIKO_VILLAGE && CVarGetInteger(CVAR_ENHANCEMENT("NightGSAlwaysSpawn"), 0)) { this->actor.params = 0x2001; this->actor.home.rot.z = 0x71; } @@ -352,7 +352,7 @@ void EnWood02_Update(Actor* thisx, PlayState* play2) { dropsSpawnPt = this->actor.world.pos; dropsSpawnPt.y += 200.0f; - if ((this->unk_14C >= 0) && (this->unk_14C < 0x64) && (CVarGetInteger("gTreeStickDrops", 0)) && !(INV_CONTENT(ITEM_STICK) == ITEM_NONE)) { + if ((this->unk_14C >= 0) && (this->unk_14C < 0x64) && (CVarGetInteger(CVAR_ENHANCEMENT("TreesDropSticks"), 0)) && !(INV_CONTENT(ITEM_STICK) == ITEM_NONE)) { (numDrops = (Rand_ZeroOne() * 4)); for (i = 0; i < numDrops; ++i) { Item_DropCollectible(play, &dropsSpawnPt, ITEM00_STICK); diff --git a/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c index f5275618b..57ac15ecf 100644 --- a/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -428,7 +428,7 @@ u16 EnZo_GetTextId(PlayState* play, Actor* thisx) { } if (Flags_GetEventChkInf(EVENTCHKINF_KING_ZORA_MOVED) || - (CVarGetInteger("gFixZoraHintDialogue", 0) && + (CVarGetInteger(CVAR_ENHANCEMENT("FixZoraHintDialogue"), 0) && Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_RUTOS_LETTER))) { return 0x4010; } diff --git a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c index 8b7c77aca..a0ead103c 100644 --- a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -2045,7 +2045,7 @@ void Fishing_DrawRod(PlayState* play) { lureXZLen = player->unk_85C - lureXZLen; spC4 = player->unk_858; - Math_SmoothStepToF(&player->unk_858, input->rel.stick_x * 0.02f * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1), 0.3f, 5.0f, 0.0f); + Math_SmoothStepToF(&player->unk_858, input->rel.stick_x * 0.02f * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1), 0.3f, 5.0f, 0.0f); spC4 = player->unk_858 - spC4; if (player->unk_858 > 1.0f) { @@ -2922,33 +2922,33 @@ f32 Fishing_GetMinimumRequiredScore() { // RANDOTODO: update the enhancement sliders to not allow // values above rando fish weight values when rando'd if(sLinkAge == 1) { - weight = CVarGetInteger("gCustomizeFishing", 0) ? CVarGetInteger("gChildMinimumWeightFish", 10) : 10; + weight = CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0) ? CVarGetInteger(CVAR_ENHANCEMENT("MinimumFishWeightChild"), 10) : 10; } else { - weight = CVarGetInteger("gCustomizeFishing", 0) ? CVarGetInteger("gAdultMinimumWeightFish", 13) : 13; + weight = CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0) ? CVarGetInteger(CVAR_ENHANCEMENT("MinimumFishWeightAdult"), 13) : 13; } return sqrt(((f32)weight - 0.5f) / 0.0036f); } bool getInstantFish() { - return CVarGetInteger("gCustomizeFishing", 0) && CVarGetInteger("gInstantFishing", 0); + return CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("InstantFishing"), 0); } bool getGuaranteeBite() { - return CVarGetInteger("gCustomizeFishing", 0) && CVarGetInteger("gGuaranteeFishingBite", 0); + return CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("GuaranteeFishingBite"), 0); } bool getFishNeverEscape() { - return CVarGetInteger("gCustomizeFishing", 0) && CVarGetInteger("gFishNeverEscape", 0); + return CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("FishNeverEscape"), 0); } bool getShouldSpawnLoaches() { - return (CVarGetInteger("gCustomizeFishing", 0) && CVarGetInteger("gLoachesAlwaysAppear", 0)) + return (CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("LoachesAlwaysAppear"), 0)) || ((KREG(1) == 1) || ((sFishGameNumber & 3) == 3)); } bool getShouldConfirmKeep() { - return !CVarGetInteger("gCustomizeFishing", 0) || !CVarGetInteger("gSkipKeepConfirmation", 0); + return !CVarGetInteger(CVAR_ENHANCEMENT("CustomizeFishing"), 0) || !CVarGetInteger(CVAR_ENHANCEMENT("SkipKeepConfirmation"), 0); } void Fishing_UpdateFish(Actor* thisx, PlayState* play2) { @@ -5591,7 +5591,7 @@ void Fishing_UpdateOwner(Actor* thisx, PlayState* play2) { player->actor.speedXZ = 0.0f; // #region SOH [Enhancement] - if (CVarGetInteger("gQuitFishingAtDoor", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("QuitFishingAtDoor"), 0)) { Fishing_QuitAtDoor(this, play); } // #endregion 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 73a588ab3..db1ea8208 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 @@ -200,8 +200,8 @@ void MagicDark_DiamondDraw(Actor* thisx, PlayState* play) { u16 gameplayFrames = play->gameplayFrames; Color_RGB8 Spell_env_ori = {0, 100, 255}; Color_RGB8 Spell_col_ori = {170, 255, 255}; - Color_RGB8 Spell_env = CVarGetColor24("gNL_Diamond_Env", Spell_env_ori); - Color_RGB8 Spell_col = CVarGetColor24("gNL_Diamond_Col", Spell_col_ori); + Color_RGB8 Spell_env = CVarGetColor24(CVAR_COSMETIC("Magic.NayrusSecondary.Value"), Spell_env_ori); + Color_RGB8 Spell_col = CVarGetColor24(CVAR_COSMETIC("Magic.NayrusPrimary.Value"), Spell_col_ori); OPEN_DISPS(play->state.gfxCtx); @@ -224,7 +224,7 @@ void MagicDark_DiamondDraw(Actor* thisx, PlayState* play) { Matrix_RotateY(this->actor.shape.rot.y * (M_PI / 0x8000), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (CVarGetInteger("gUseSpellsCol",0)) { + if (CVarGetInteger(CVAR_COSMETIC("UseSpellsColors"),0)) { 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 { 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 b245c988c..f785124f4 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 @@ -218,8 +218,8 @@ void MagicFire_Draw(Actor* thisx, PlayState* play) { u8 alpha; Color_RGB8 Spell_env_ori = {255, 0, 0}; Color_RGB8 Spell_col_ori = {255, 200, 0}; - Color_RGB8 Spell_env = CVarGetColor24("gDF_Env", Spell_env_ori); - Color_RGB8 Spell_col = CVarGetColor24("gDF_Col", Spell_col_ori); + Color_RGB8 Spell_env = CVarGetColor24(CVAR_COSMETIC("Magic.DinsSecondary.Value"), Spell_env_ori); + Color_RGB8 Spell_col = CVarGetColor24(CVAR_COSMETIC("Magic.DinsPrimaryary.Value"), Spell_col_ori); if (this->action > 0) { OPEN_DISPS(play->state.gfxCtx); @@ -231,7 +231,7 @@ void MagicFire_Draw(Actor* thisx, PlayState* play) { gDPSetColorDither(POLY_XLU_DISP++, G_CD_DISABLE); gDPFillRectangle(POLY_XLU_DISP++, 0, 0, 319, 239); Gfx_SetupDL_25Xlu(play->state.gfxCtx); - if (CVarGetInteger("gUseSpellsCol",0)) { + if (CVarGetInteger(CVAR_COSMETIC("UseSpellsColors"),0)) { 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 { diff --git a/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c b/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c index e17de7597..19bf701fa 100644 --- a/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c +++ b/soh/src/overlays/actors/ovl_Obj_Comb/z_obj_comb.c @@ -142,7 +142,7 @@ void ObjComb_ChooseItemDrop(ObjComb* this, PlayState* play) { } else if (Rand_ZeroOne() < 0.5f) { params = -1; } - if (params >= 0 && !CVarGetInteger("gNoRandomDrops", 0)) { + if (params >= 0 && !CVarGetInteger(CVAR_ENHANCEMENT("NoRandomDrops"), 0)) { Item_DropCollectible(play, &this->actor.world.pos, params); } } diff --git a/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index 217fc434f..18c898547 100644 --- a/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/soh/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -123,7 +123,7 @@ void ObjLightswitch_InitCollider(ObjLightswitch* this, PlayState* play) { s32 pad; // Initialize this with the sun switch, so it can't be affected by toggling while the actor is loaded - sunLightArrowsEnabledOnSunSwitchLoad = CVarGetInteger("gSunlightArrows", 0) || (IS_RANDO && Randomizer_GetSettingValue(RSK_SUNLIGHT_ARROWS)); + sunLightArrowsEnabledOnSunSwitchLoad = CVarGetInteger(CVAR_ENHANCEMENT("SunlightArrows"), 0) || (IS_RANDO && Randomizer_GetSettingValue(RSK_SUNLIGHT_ARROWS)); Collider_InitJntSph(play, &this->collider); // If "Sunlight Arrows" is enabled, set up the collider to allow Light Arrow hits diff --git a/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c b/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c index bbe5bd0aa..519035081 100644 --- a/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c +++ b/soh/src/overlays/actors/ovl_Obj_Mure/z_obj_mure.c @@ -275,7 +275,7 @@ void ObjMure_InitialAction(ObjMure* this, PlayState* play) { } void ObjMure_CulledState(ObjMure* this, PlayState* play) { - if (fabsf(this->actor.projectedPos.z) < sZClip[this->type] || CVarGetInteger("gDisableDrawDistance", 0) != 0) { + if (fabsf(this->actor.projectedPos.z) < sZClip[this->type] || CVarGetInteger(CVAR_ENHANCEMENT("DisableDrawDistance"), 0) != 0) { this->actionFunc = ObjMure_ActiveState; this->actor.flags |= ACTOR_FLAG_UPDATE_WHILE_CULLED; ObjMure_SpawnActors(this, play); @@ -399,7 +399,7 @@ static ObjMureActionFunc sTypeGroupBehaviorFunc[] = { void ObjMure_ActiveState(ObjMure* this, PlayState* play) { ObjMure_CheckChildren(this, play); if (sZClip[this->type] + 40.0f <= fabsf(this->actor.projectedPos.z) && - CVarGetInteger("gDisableDrawDistance", 1) != 0) { + CVarGetInteger(CVAR_ENHANCEMENT("DisableDrawDistance"), 1) != 0) { this->actionFunc = ObjMure_CulledState; this->actor.flags &= ~ACTOR_FLAG_UPDATE_WHILE_CULLED; ObjMure_KillActors(this, play); diff --git a/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c b/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c index b883072b9..0aad27c04 100644 --- a/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c +++ b/soh/src/overlays/actors/ovl_Obj_Mure2/z_obj_mure2.c @@ -191,7 +191,7 @@ void func_80B9A658(ObjMure2* this) { void func_80B9A668(ObjMure2* this, PlayState* play) { if (Math3D_Dist1DSq(this->actor.projectedPos.x, this->actor.projectedPos.z) < (sDistSquared1[this->actor.params & 3] * this->unk_184) || - CVarGetInteger("gDisableDrawDistance", 0) != 0) { + CVarGetInteger(CVAR_ENHANCEMENT("DisableDrawDistance"), 0) != 0) { this->actor.flags |= ACTOR_FLAG_UPDATE_WHILE_CULLED; ObjMure2_SpawnActors(this, play); func_80B9A6E8(this); @@ -205,7 +205,7 @@ void func_80B9A6E8(ObjMure2* this) { void func_80B9A6F8(ObjMure2* this, PlayState* play) { func_80B9A534(this); - if (CVarGetInteger("gDisableDrawDistance", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableDrawDistance"), 0) != 0) { return; } diff --git a/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 09ce9dff6..ae26db3ac 100644 --- a/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -568,9 +568,9 @@ void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play) { f32 pushDistSigned; s32 stopFlag; - this->pushSpeed = this->pushSpeed + (CVarGetInteger("gFasterBlockPush", 0) * 0.25) + 0.5f; + this->pushSpeed = this->pushSpeed + (CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 0.25) + 0.5f; this->stateFlags |= PUSHBLOCK_PUSH; - this->pushSpeed = CLAMP_MAX(this->pushSpeed, 2.0f + (CVarGetInteger("gFasterBlockPush", 0) * 0.5)); + this->pushSpeed = CLAMP_MAX(this->pushSpeed, 2.0f + (CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 0.5)); stopFlag = Math_StepToF(&this->pushDist, 20.0f, this->pushSpeed); pushDistSigned = ((this->direction >= 0.0f) ? 1.0f : -1.0f) * this->pushDist; thisx->world.pos.x = thisx->home.pos.x + (pushDistSigned * this->yawSin); @@ -596,7 +596,7 @@ void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play) { this->dyna.unk_150 = 0.0f; this->pushDist = 0.0f; this->pushSpeed = 0.0f; - this->timer = 10 - ((CVarGetInteger("gFasterBlockPush", 0) * 3) / 2); + this->timer = 10 - ((CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 3) / 2); if (this->floorBgIds[this->highestFloor] == BGCHECK_SCENE) { ObjOshihiki_SetupOnScene(this, play); } else { diff --git a/soh/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c b/soh/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c index 202bcc09f..4da1c3eba 100644 --- a/soh/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c +++ b/soh/src/overlays/actors/ovl_Obj_Roomtimer/z_obj_roomtimer.c @@ -34,7 +34,7 @@ void ObjRoomtimer_Init(Actor* thisx, PlayState* play) { // Shabom room in Jabu Jabu has a lengthened timer in Enemy Randomizer. Flag doesn't match what the game // expects. Instead set it back to the same flag as what it would be in vanilla. - if (CVarGetInteger("gRandomizedEnemies", 0) && play->sceneNum == SCENE_JABU_JABU && play->roomCtx.curRoom.num == 12) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RandomizedEnemies"), 0) && play->sceneNum == SCENE_JABU_JABU && play->roomCtx.curRoom.num == 12) { this->switchFlag = 30; } else { this->switchFlag = (params >> 10) & 0x3F; diff --git a/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index b0c7b44fc..cf8c28165 100644 --- a/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -340,8 +340,8 @@ void ObjTimeblock_Draw(Actor* thisx, PlayState* play) { Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - if (CVarGetInteger("gCosmetics.World_BlockOfTime.Changed", 0)) { - Color_RGB8 color = CVarGetColor24("gCosmetics.World_BlockOfTime.Value", *primColor); + if (CVarGetInteger(CVAR_COSMETIC("World.BlockOfTime.Changed"), 0)) { + Color_RGB8 color = CVarGetColor24(CVAR_COSMETIC("World.BlockOfTime.Value"), *primColor); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, color.r, color.g, color.b, 255); } else { gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, primColor->r, primColor->g, primColor->b, 255); diff --git a/soh/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/soh/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index 0076a6385..dfc236251 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/soh/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -80,7 +80,7 @@ void OceffWipe_Draw(Actor* thisx, PlayState* play) { OPEN_DISPS(play->state.gfxCtx); - int fastOcarinaPlayback = (CVarGetInteger("gFastOcarinaPlayback", 0) != 0); + int fastOcarinaPlayback = (CVarGetInteger(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 0) != 0); if (this->timer < 32) { z = Math_SinS(this->timer << 9) * (fastOcarinaPlayback ? 1200.0f : 1400.0f); } else { diff --git a/soh/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/soh/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index 38014b5e2..a6b422062 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/soh/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -72,7 +72,7 @@ void OceffWipe2_Draw(Actor* thisx, PlayState* play) { eye = GET_ACTIVE_CAM(play)->eye; Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play)); - int fastOcarinaPlayback = (CVarGetInteger("gFastOcarinaPlayback", 0) != 0); + int fastOcarinaPlayback = (CVarGetInteger(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 0) != 0); if (this->timer < 32) { z = Math_SinS(this->timer << 9) * (fastOcarinaPlayback ? 1200.0f : 1330.0f); } else { diff --git a/soh/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/soh/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index df3fc1a87..28f02100d 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/soh/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -73,7 +73,7 @@ void OceffWipe3_Draw(Actor* thisx, PlayState* play) { eye = GET_ACTIVE_CAM(play)->eye; Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play)); - int fastOcarinaPlayback = (CVarGetInteger("gFastOcarinaPlayback", 0) != 0); + int fastOcarinaPlayback = (CVarGetInteger(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 0) != 0); if (this->counter < 32) { z = Math_SinS(this->counter << 9) * (fastOcarinaPlayback ? 1200.0f : 1330.0f); } else { diff --git a/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index 5a66b2991..6c96e639f 100644 --- a/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/soh/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -68,7 +68,7 @@ void OceffWipe4_Draw(Actor* thisx, PlayState* play) { eye = GET_ACTIVE_CAM(play)->eye; Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(play)); - int fastOcarinaPlayback = (CVarGetInteger("gFastOcarinaPlayback", 0) != 0); + int fastOcarinaPlayback = (CVarGetInteger(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 0) != 0); if (this->timer < 16) { z = Math_SinS(this->timer * 1024) * (fastOcarinaPlayback ? 1200.0f : 1330.0f); } else { 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 0b9b2303d..8963298e7 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -2075,7 +2075,7 @@ void Player_InitExplosiveIA(PlayState* play, Player* this) { this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 0); if (spawnedActor != NULL) { if ((explosiveType != 0) && (play->bombchuBowlingStatus != 0)) { - if (!CVarGetInteger("gInfiniteAmmo", 0)) { + if (!CVarGetInteger(CVAR_CHEAT("InfiniteAmmo"), 0)) { play->bombchuBowlingStatus--; } if (play->bombchuBowlingStatus == 0) { @@ -2215,7 +2215,7 @@ s32 Player_ItemIsItemAction(s32 item1, s32 itemAction) { } s32 Player_GetItemOnButton(PlayState* play, s32 index) { - if (index >= ((CVarGetInteger("gDpadEquips", 0) != 0) ? 8 : 4)) { + if (index >= ((CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) ? 8 : 4)) { return ITEM_NONE; } else if (play->bombchuBowlingStatus != 0) { return (play->bombchuBowlingStatus > 0) ? ITEM_BOMBCHU : ITEM_NONE; @@ -2253,10 +2253,10 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) { s32 i; if (this->currentMask != PLAYER_MASK_NONE) { - if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) { s32 maskItem = this->currentMask - PLAYER_MASK_KEATON + ITEM_MASK_KEATON; bool hasOnDpad = false; - if (CVarGetInteger("gDpadEquips", 0) != 0) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { for (int buttonIndex = 4; buttonIndex < 8; buttonIndex++) { hasOnDpad |= gSaveContext.equips.buttonItems[buttonIndex] == maskItem; } @@ -2272,7 +2272,7 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) { maskItemAction = this->currentMask - 1 + PLAYER_IA_MASK_KEATON; bool hasOnDpad = false; - if (CVarGetInteger("gDpadEquips", 0) != 0) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { for (int buttonIndex = 0; buttonIndex < 4; buttonIndex++) { hasOnDpad |= Player_ItemIsItemAction(DPAD_ITEM(buttonIndex), maskItemAction); } @@ -2288,7 +2288,7 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) { if (!(this->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE)) && !func_8008F128(this)) { if (this->itemAction >= PLAYER_IA_FISHING_POLE) { bool hasOnDpad = false; - if (CVarGetInteger("gDpadEquips", 0) != 0) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { for (int buttonIndex = 0; buttonIndex < 4; buttonIndex++) { hasOnDpad |= Player_ItemIsInUse(this, DPAD_ITEM(buttonIndex)); } @@ -2379,7 +2379,7 @@ void Player_StartChangingHeldItem(Player* this, PlayState* play) { } void Player_UpdateItems(Player* this, PlayState* play) { - if ((this->actor.category == ACTORCAT_PLAYER) && (CVarGetInteger("gQuickPutaway", 0) || !(this->stateFlags1 & PLAYER_STATE1_START_PUTAWAY)) && + if ((this->actor.category == ACTORCAT_PLAYER) && (CVarGetInteger(CVAR_ENHANCEMENT("QuickPutaway"), 0) || !(this->stateFlags1 & PLAYER_STATE1_START_PUTAWAY)) && ((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_SHIELDING)) && (gSaveContext.health != 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->csAction == 0) && (play->shootingGalleryStatus == 0) && (play->activeCamera == MAIN_CAM) && @@ -2395,7 +2395,7 @@ void Player_UpdateItems(Player* this, PlayState* play) { // Determine projectile type for bow or slingshot s32 func_80834380(PlayState* play, Player* this, s32* itemPtr, s32* typePtr) { bool useBow = LINK_IS_ADULT; - if(CVarGetInteger("gBowSlingShotAmmoFix", 0)){ + if(CVarGetInteger(CVAR_ENHANCEMENT("BowSlingshotAmmoFix"), 0)){ useBow = this->heldItemAction != PLAYER_IA_SLINGSHOT; } if (useBow) { @@ -2495,10 +2495,10 @@ LinkAnimationHeader* func_808346C4(PlayState* play, Player* this) { if (this->unk_870 < 0.5f) { return D_808543A4[Player_HoldsTwoHandedWeapon(this) && - !(CVarGetInteger("gShieldTwoHanded", 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK))]; + !(CVarGetInteger(CVAR_CHEAT("ShieldTwoHanded"), 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK))]; } else { return D_808543AC[Player_HoldsTwoHandedWeapon(this) && - !(CVarGetInteger("gShieldTwoHanded", 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK))]; + !(CVarGetInteger(CVAR_CHEAT("ShieldTwoHanded"), 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK))]; } } @@ -2679,7 +2679,7 @@ int func_80834E44(PlayState* play) { int func_80834E7C(PlayState* play) { u16 buttonsToCheck = BTN_A | BTN_B | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger("gDpadEquips", 0) != 0) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } return (play->shootingGalleryStatus != 0) && @@ -2750,11 +2750,11 @@ s32 func_808350A4(PlayState* play, Player* this) { func_80834380(play, this, &item, &arrowType); if (gSaveContext.minigameState == 1) { - if (!CVarGetInteger("gInfiniteAmmo", 0)) { + if (!CVarGetInteger(CVAR_CHEAT("InfiniteAmmo"), 0)) { play->interfaceCtx.hbaAmmo--; } } else if (play->shootingGalleryStatus != 0) { - if (!CVarGetInteger("gInfiniteAmmo", 0)) { + if (!CVarGetInteger(CVAR_CHEAT("InfiniteAmmo"), 0)) { play->shootingGalleryStatus--; } } else { @@ -2939,7 +2939,7 @@ s32 Player_UpperAction_CarryActor(Player* this, PlayState* play) { } void func_808357E8(Player* this, Gfx** dLists) { - if (LINK_IS_ADULT && (CVarGetInteger("gEnhancements.EquimentAlwaysVisible", 0))) { + if (LINK_IS_ADULT && (CVarGetInteger(CVAR_ENHANCEMENT("EquimentAlwaysVisible"), 0))) { this->leftHandDLists = &dLists[1]; } else { this->leftHandDLists = &dLists[gSaveContext.linkAge]; @@ -3023,7 +3023,7 @@ s32 func_808359FC(Player* this, PlayState* play) { } s32 spawn_boomerang_ivan(EnPartner* this, PlayState* play) { - if (!CVarGetInteger("gIvanCoopModeEnabled", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0)) { return 0; } @@ -3057,7 +3057,7 @@ s32 func_80835B60(Player* this, PlayState* play) { return 1; } - if (sUseHeldItem && CVarGetInteger("gFastBoomerang", 0)) { + if (sUseHeldItem && CVarGetInteger(CVAR_ENHANCEMENT("FastBoomerang"), 0)) { this->boomerangQuickRecall = true; } @@ -3181,7 +3181,7 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { ((itemAction == PLAYER_IA_MAGIC_BEAN) && (AMMO(ITEM_BEAN) == 0)) || (temp = Player_ActionToExplosive(this, itemAction), ((temp >= 0) && ((AMMO(sExplosiveInfos[temp].itemId) == 0) || - (play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length >= 3 && !CVarGetInteger("gRemoveExplosiveLimit", 0))))))) { + (play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length >= 3 && !CVarGetInteger(CVAR_ENHANCEMENT("RemoveExplosiveLimit"), 0))))))) { // Prevent some items from being used if player is out of ammo. // Also prevent explosives from being used if there are 3 or more active (outside of bombchu bowling) func_80078884(NA_SE_SY_ERROR); @@ -3243,7 +3243,7 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { (item != this->heldItemId) && (sItemChangeTypes[gPlayerModelTypes[this->modelGroup][PLAYER_MODELGROUPENTRY_ANIM]][nextAnimType] != PLAYER_ITEM_CHG_0) && - (!CVarGetInteger("gSeparateArrows", 0) || + (!CVarGetInteger(CVAR_ENHANCEMENT("SeparateArrows"), 0) || itemAction < PLAYER_IA_BOW || itemAction > PLAYER_IA_BOW_0E || this->heldItemAction < PLAYER_IA_BOW || this->heldItemAction > PLAYER_IA_BOW_0E)) { // Start the held item change process @@ -4005,7 +4005,7 @@ void func_80837948(PlayState* play, Player* this, s32 arg2) { } if ((arg2 >= PLAYER_MWA_FLIPSLASH_START) && (arg2 <= PLAYER_MWA_JUMPSLASH_FINISH)) { - if (CVarGetInteger("gRestoreQPA", 1) && temp == -1) { + if (CVarGetInteger(CVAR_GENERAL("RestoreQPA"), 1) && temp == -1) { dmgFlags = 0x16171617; } else { @@ -4040,7 +4040,7 @@ s32 func_80837B18_modified(PlayState* play, Player* this, s32 damage, u8 modifie s32 modifiedDamage = damage; if (modified) { - modifiedDamage *= (1 << CVarGetInteger("gDamageMul", 0)); + modifiedDamage *= (1 << CVarGetInteger(CVAR_ENHANCEMENT("DamageMult"), 0)); } return Health_ChangeBy(play, modifiedDamage); @@ -4227,7 +4227,7 @@ s32 func_8083816C(s32 arg0) { } void func_8083819C(Player* this, PlayState* play) { - if (this->currentShield == PLAYER_SHIELD_DEKU && (CVarGetInteger("gFireproofDekuShield", 0) == 0)) { + if (this->currentShield == PLAYER_SHIELD_DEKU && (CVarGetInteger(CVAR_CHEAT("FireproofDekuShield"), 0) == 0)) { Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_SHIELD, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, true); Inventory_DeleteEquipment(play, EQUIP_TYPE_SHIELD); @@ -4265,7 +4265,7 @@ s32 func_808382DC(Player* this, PlayState* play) { if (this->unk_A86 != 0) { if (!Player_InBlockingCsMode(play, this)) { - Player_InflictDamageModified(play, -16 * (1 << CVarGetInteger("gVoidDamageMul", 0)), false); + Player_InflictDamageModified(play, -16 * (1 << CVarGetInteger(CVAR_ENHANCEMENT("VoidDamageMult"), 0)), false); this->unk_A86 = 0; } } else { @@ -4340,18 +4340,18 @@ s32 func_808382DC(Player* this, PlayState* play) { if (this->unk_870 < 0.5f) { anim = D_808543BC[Player_HoldsTwoHandedWeapon(this) && - !(CVarGetInteger("gShieldTwoHanded", 0) && + !(CVarGetInteger(CVAR_CHEAT("ShieldTwoHanded"), 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK))]; } else { anim = D_808543B4[Player_HoldsTwoHandedWeapon(this) && - !(CVarGetInteger("gShieldTwoHanded", 0) && + !(CVarGetInteger(CVAR_CHEAT("ShieldTwoHanded"), 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK))]; } LinkAnimation_PlayOnce(play, &this->upperSkelAnime, anim); } else { Player_AnimPlayOnce(play, this, D_808543C4[Player_HoldsTwoHandedWeapon(this) && - !(CVarGetInteger("gShieldTwoHanded", 0) && + !(CVarGetInteger(CVAR_CHEAT("ShieldTwoHanded"), 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK))]); } } @@ -4408,7 +4408,7 @@ s32 func_808382DC(Player* this, PlayState* play) { ((sp48 >= 0) && SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) && (this->floorTypeTimer >= D_808544F4[sp48])) || - ((sp48 >= 0) && ((this->currentTunic != PLAYER_TUNIC_GORON && CVarGetInteger("gSuperTunic", 0) == 0) || + ((sp48 >= 0) && ((this->currentTunic != PLAYER_TUNIC_GORON && CVarGetInteger(CVAR_CHEAT("SuperTunic"), 0) == 0) || (this->floorTypeTimer >= D_808544F4[sp48])))) { this->floorTypeTimer = 0; this->actor.colChkInfo.damage = 4; @@ -5098,7 +5098,7 @@ void func_8083A0F4(PlayState* play, Player* this) { // Same actor is used for small and large silver rocks, use actor params to identify large ones bool isLargeSilverRock = interactActorId == ACTOR_EN_ISHI && interactRangeActor->params & 1 == 1; - if (CVarGetInteger("gFasterHeavyBlockLift", 0) && (isLargeSilverRock || interactActorId == ACTOR_BG_HEAVY_BLOCK)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 0) && (isLargeSilverRock || interactActorId == ACTOR_BG_HEAVY_BLOCK)) { LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 5.0f); } else { LinkAnimation_PlayOnce(play, &this->skelAnime, anim); @@ -5227,7 +5227,7 @@ s32 func_8083A6AC(Player* this, PlayState* play) { if (BgCheck_EntityLineTest1(&play->colCtx, &this->actor.world.pos, &sp74, &sp68, &sp84, true, false, false, true, &sp80) && - ((ABS(sp84->normal.y) < 600) || (CVarGetInteger("gClimbEverything", 0) != 0))) { + ((ABS(sp84->normal.y) < 600) || (CVarGetInteger(CVAR_CHEAT("ClimbEverything"), 0) != 0))) { f32 nx = COLPOLY_GET_NORMAL(sp84->normal.x); f32 ny = COLPOLY_GET_NORMAL(sp84->normal.y); f32 nz = COLPOLY_GET_NORMAL(sp84->normal.z); @@ -5357,7 +5357,7 @@ s32 func_8083AD4C(PlayState* play, Player* this) { if (func_8002DD6C(this)) { bool shouldUseBowCamera = LINK_IS_ADULT; - if(CVarGetInteger("gBowSlingShotAmmoFix", 0)){ + if(CVarGetInteger(CVAR_ENHANCEMENT("BowSlingshotAmmoFix"), 0)){ shouldUseBowCamera = this->heldItemAction != PLAYER_IA_SLINGSHOT; } @@ -5425,7 +5425,7 @@ void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) { //! magic value, it will be consumed to zero. Magic_RequestChange(play, sMagicSpellCosts[magicSpell], MAGIC_CONSUME_WAIT_PREVIEW); - u8 isFastFarores = CVarGetInteger("gFastFarores", 0) && this->itemAction == PLAYER_IA_FARORES_WIND; + u8 isFastFarores = CVarGetInteger(CVAR_ENHANCEMENT("FastFarores"), 0) && this->itemAction == PLAYER_IA_FARORES_WIND; if (isFastFarores) { LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_magic_tame, 0.83f * 2); @@ -5655,7 +5655,7 @@ s32 Player_ActionChange_4(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_NAVI_ALERT; } - if (!CHECK_BTN_ALL(sControlInput->press.button, CVarGetInteger("gNaviOnL", 0) ? BTN_L : BTN_CUP) && !sp28) { + if (!CHECK_BTN_ALL(sControlInput->press.button, CVarGetInteger(CVAR_SETTING("NaviOnL"), 0) ? BTN_L : BTN_CUP) && !sp28) { return 0; } @@ -5704,7 +5704,7 @@ s32 Player_ActionChange_0(Player* this, PlayState* play) { if ((this->unk_664 != NULL) && (CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_NAVI_HAS_INFO) || (this->unk_664->naviEnemyId != 0xFF))) { this->stateFlags2 |= PLAYER_STATE2_NAVI_ALERT; - } else if ((this->naviTextId == 0 || CVarGetInteger("gNaviOnL", 0)) && !func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && + } else if ((this->naviTextId == 0 || CVarGetInteger(CVAR_SETTING("NaviOnL"), 0)) && !func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && (YREG(15) != 0x10) && (YREG(15) != 0x20) && !func_8083B8F4(this, play)) { func_80078884(NA_SE_SY_ERROR); @@ -6020,7 +6020,7 @@ s32 func_8083C6B8(PlayState* play, Player* this) { sp24 = this->actor.world.pos; sp24.y += 50.0f; - if (CVarGetInteger("gHoverFishing", 0) + if (CVarGetInteger(CVAR_ENHANCEMENT("HoverFishing"), 0) ? 0 : !(this->actor.bgCheckFlags & 1) || (this->actor.world.pos.z > 1300.0f) || BgCheck_SphVsFirstPoly(&play->colCtx, &sp24, 20.0f)) { @@ -6267,7 +6267,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { func_80832340(play, this); // Skip take breath animation on surface if Link didn't grab an item while underwater and the setting is enabled - if (CVarGetInteger("gSkipSwimDeepEndAnim", 0) && !(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim"), 0) && !(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { auto lastAnimFrame = Animation_GetLastFrame(&gPlayerAnim_link_swimer_swim_deep_end); LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_swimer_swim_deep_end, 1.0f, lastAnimFrame, lastAnimFrame, ANIMMODE_ONCE, -6.0f); @@ -6549,22 +6549,22 @@ void func_8083DFE0(Player* this, f32* arg1, s16* arg2) { } } - if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) == BUNNY_HOOD_FAST_AND_JUMP && this->currentMask == PLAYER_MASK_BUNNY) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) == BUNNY_HOOD_FAST_AND_JUMP && this->currentMask == PLAYER_MASK_BUNNY) { maxSpeed *= 1.5f; } - if (CVarGetInteger("gEnableWalkModify", 0) && !CVarGetInteger("gWalkModifierDoesntChangeJump", 0)) { - if (CVarGetInteger("gWalkSpeedToggle", 0)) { + if (CVarGetInteger(CVAR_SETTING("WalkModifier.Enabled"), 0) && !CVarGetInteger(CVAR_SETTING("WalkModifier.DoesntChangeJump"), 0)) { + if (CVarGetInteger(CVAR_SETTING("WalkModifier.SpeedToggle"), 0)) { if (gWalkSpeedToggle1) { - maxSpeed *= CVarGetFloat("gWalkModifierOne", 1.0f); + maxSpeed *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping1"), 1.0f); } else if (gWalkSpeedToggle2) { - maxSpeed *= CVarGetFloat("gWalkModifierTwo", 1.0f); + maxSpeed *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping2"), 1.0f); } } else { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER1)) { - maxSpeed *= CVarGetFloat("gWalkModifierOne", 1.0f); + maxSpeed *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping1"), 1.0f); } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER2)) { - maxSpeed *= CVarGetFloat("gWalkModifierTwo", 1.0f); + maxSpeed *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping2"), 1.0f); } } } @@ -6753,7 +6753,7 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { if(gSaveContext.pendingIceTrapCount) { gSaveContext.pendingIceTrapCount--; GameInteractor_ExecuteOnItemReceiveHooks(ItemTable_RetrieveEntry(MOD_RANDOMIZER, RG_ICE_TRAP)); - if (CVarGetInteger("gAddTraps.enabled", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("ExtraTraps.Enabled"), 0)) { return 1; } this->stateFlags1 &= ~(PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD); @@ -6814,7 +6814,7 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { // Skip cutscenes from picking up consumables with "Fast Pickup Text" enabled, even when the player never picked it up before. // But only for bushes/rocks/enemies because otherwise it can lead to softlocks in deku mask theatre and potentially other places. - uint8_t skipItemCutscene = CVarGetInteger("gFastDrops", 0) && isDropToSkip; + uint8_t skipItemCutscene = CVarGetInteger(CVAR_ENHANCEMENT("FastDrops"), 0) && isDropToSkip; // Same as above but for rando. Rando is different because we want to enable cutscenes for items that the player already has because // those items could be a randomized item coming from scrubs, freestanding PoH's and keys. So we need to once again overrule @@ -6853,7 +6853,7 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { giEntry = this->getItemEntry; } EnBox* chest = (EnBox*)interactedActor; - if (CVarGetInteger("gFastChests", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FastChests"), 0) != 0) { giEntry.gi = -1 * abs(giEntry.gi); } @@ -6943,7 +6943,7 @@ s32 func_8083EAF0(Player* this, Actor* actor) { s32 Player_ActionChange_9(Player* this, PlayState* play) { u16 buttonsToCheck = BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger("gDpadEquips", 0) != 0) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if ((this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (this->heldActor != NULL) && @@ -7140,10 +7140,10 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall func_80832224(this); this->actor.prevPos = this->actor.world.pos; // #region SOH [Enhancement] - if (CVarGetInteger("gCrawlSpeed", 1) > 1) { + if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { // increase animation speed when entering a tunnel LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_start, - ((CVarGetInteger("gCrawlSpeed", 1) + 1.0f) / 2.0f), 0.0f, + ((CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) + 1.0f) / 2.0f), 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), ANIMMODE_ONCE, 0.0f); Player_AnimReplaceApplyFlags(play, this, 0x9D); @@ -7233,10 +7233,10 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { if (this->linearVelocity > 0.0f) { this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; // #region SOH [Enhancement] - if (CVarGetInteger("gCrawlSpeed", 1) > 1) { + if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { // animation when exiting a tunnel forward LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_end, - ((CVarGetInteger("gCrawlSpeed", 1) + 1.0f) / 2.0f), 0.0f, + ((CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) + 1.0f) / 2.0f), 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_end), ANIMMODE_ONCE, 0.0f); Player_AnimReplaceApplyFlags(play, this, 0x9D); @@ -7251,9 +7251,9 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { this->actor.shape.rot.y = this->actor.wallYaw; // #region SOH [Enhancement] // animation when exiting a tunnel backward - if (CVarGetInteger("gCrawlSpeed",1) > 1) { + if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"),1) > 1) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_start, - -1.0f * ((CVarGetInteger("gCrawlSpeed", 1) + 1.0f) / 2.0f), + -1.0f * ((CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) + 1.0f) / 2.0f), Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), 0.0f, ANIMMODE_ONCE, 0.0f); Player_AnimReplaceApplyFlags(play, this, 0x9D); OnePointCutscene_Init(play, 9602, 999, NULL, MAIN_CAM); @@ -7426,7 +7426,7 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { } // #region SOH [Enhancement] - if (CVarGetInteger("gRightStickAiming", 0) || !CVarGetInteger("gInvertZAimingYAxis", 1)) { + if (CVarGetInteger(CVAR_SETTING("Controls.RightStickAim"), 0) || !CVarGetInteger(CVAR_SETTING("Controls.InvertZAimingYAxis"), 1)) { if (this->unk_664 != NULL) { func_8083DB98(this, 1); @@ -7434,7 +7434,7 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { int8_t relStickY; // preserves simultaneous left/right-stick aiming - if (CVarGetInteger("gRightStickAiming", 0)) { + if (CVarGetInteger(CVAR_SETTING("Controls.RightStickAim"), 0)) { if ((sControlInput->rel.stick_y + sControlInput->rel.right_stick_y) >= 0) { relStickY = (((sControlInput->rel.stick_y) > (sControlInput->rel.right_stick_y)) ? (sControlInput->rel.stick_y) @@ -7449,7 +7449,7 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { } Math_SmoothStepToS(&this->actor.focus.rot.x, - relStickY * (CVarGetInteger("gInvertZAimingYAxis", 1) ? 1 : -1) * 240.0f, 14, 4000, 30); + relStickY * (CVarGetInteger(CVAR_SETTING("Controls.InvertZAimingYAxis"), 1) ? 1 : -1) * 240.0f, 14, 4000, 30); func_80836AB8(this, 1); } // #endregion @@ -7558,9 +7558,9 @@ void func_8084029C(Player* this, f32 arg1) { } if ((this->currentBoots == PLAYER_BOOTS_HOVER || - (CVarGetInteger("gIvanCoopModeEnabled", 0) && this->ivanFloating)) && + (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0) && this->ivanFloating)) && !(this->actor.bgCheckFlags & 1) && - (this->hoverBootsTimer != 0 || (CVarGetInteger("gIvanCoopModeEnabled", 0) && this->ivanFloating))) { + (this->hoverBootsTimer != 0 || (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0) && this->ivanFloating))) { func_8002F8F0(&this->actor, NA_SE_PL_HOBBERBOOTS_LV - SFX_FLAG); } else if (func_8084021C(this->unk_868, arg1, 29.0f, 10.0f) || func_8084021C(this->unk_868, arg1, 29.0f, 24.0f)) { func_808327F8(this, this->linearVelocity); @@ -7753,7 +7753,7 @@ void func_808409CC(PlayState* play, Player* this) { if (sp34 < 4) { if (((sp34 != 0) && (sp34 != 3)) || ((this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && ((sp34 == 3) || Player_GetMeleeWeaponHeld(this)))) { - if ((sp34 == 1) && Player_HoldsTwoHandedWeapon(this) && CVarGetInteger("gTwoHandedIdle", 0) == 1) { + if ((sp34 == 1) && Player_HoldsTwoHandedWeapon(this) && CVarGetInteger(CVAR_ENHANCEMENT("TwoHandedIdle"), 0) == 1) { sp34 = 4; } sp38 = sp34 + 9; @@ -8296,22 +8296,22 @@ void Player_Action_80842180(Player* this, PlayState* play) { } } - if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && this->currentMask == PLAYER_MASK_BUNNY) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && this->currentMask == PLAYER_MASK_BUNNY) { sp2C *= 1.5f; } - if (CVarGetInteger("gEnableWalkModify", 0)) { - if (CVarGetInteger("gWalkSpeedToggle", 0)) { + if (CVarGetInteger(CVAR_SETTING("WalkModifier.Enabled"), 0)) { + if (CVarGetInteger(CVAR_SETTING("WalkModifier.SpeedToggle"), 0)) { if (gWalkSpeedToggle1) { - sp2C *= CVarGetFloat("gWalkModifierOne", 1.0f); + sp2C *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping1"), 1.0f); } else if (gWalkSpeedToggle2) { - sp2C *= CVarGetFloat("gWalkModifierTwo", 1.0f); + sp2C *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping2"), 1.0f); } } else { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER1)) { - sp2C *= CVarGetFloat("gWalkModifierOne", 1.0f); + sp2C *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping1"), 1.0f); } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER2)) { - sp2C *= CVarGetFloat("gWalkModifierTwo", 1.0f); + sp2C *= CVarGetFloat(CVAR_SETTING("WalkModifier.Mapping2"), 1.0f); } } } @@ -8473,7 +8473,7 @@ s32 func_808428D8(Player* this, PlayState* play) { this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H; this->yaw = this->actor.shape.rot.y + this->unk_6BE; - if (!CVarGetInteger("gCrouchStabHammerFix", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("CrouchStabHammerFix"), 0)) { return 1; } @@ -8484,7 +8484,7 @@ s32 func_808428D8(Player* this, PlayState* play) { swordId = Player_GetMeleeWeaponHeld(this) - 1; } - if (swordId != 4 && !CVarGetInteger("gCrouchStabFix", 0)) { // 4 = Megaton Hammer + if (swordId != 4 && !CVarGetInteger(CVAR_ENHANCEMENT("CrouchStabFix"), 0)) { // 4 = Megaton Hammer return 1; } @@ -8704,8 +8704,8 @@ void Player_Action_80843188(Player* this, PlayState* play) { func_8083721C(this); if (this->av2.actionVar2 != 0) { - sp54 = sControlInput->rel.stick_y * 100 * (CVarGetInteger("gInvertShieldAimingYAxis", 1) ? 1 : -1); - sp50 = sControlInput->rel.stick_x * (CVarGetInteger("gMirroredWorld", 0) ? 120 : -120) * (CVarGetInteger("gInvertShieldAimingXAxis", 0) ? -1 : 1); + sp54 = sControlInput->rel.stick_y * 100 * (CVarGetInteger(CVAR_SETTING("Controls.InvertShieldAimingYAxis"), 1) ? 1 : -1); + sp50 = sControlInput->rel.stick_x * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? 120 : -120) * (CVarGetInteger(CVAR_SETTING("Controls.InvertShieldAimingYAxis"), 0) ? -1 : 1); sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); sp40 = Math_CosS(sp4E); @@ -8917,12 +8917,12 @@ void func_80843AE8(PlayState* play, Player* this) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_derth_rebirth, 1.0f, 99.0f, Animation_GetLastFrame(&gPlayerAnim_link_derth_rebirth), ANIMMODE_ONCE, 0.0f); } - if (CVarGetInteger("gFairyReviveEffect", 0)) { - if (CVarGetInteger("gFairyRevivePercentRestore", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FairyReviveEffect"), 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FairyRevivePercentRestore"), 0)) { gSaveContext.healthAccumulator = - (gSaveContext.healthCapacity * CVarGetInteger("gFairyReviveHealth", 100) / 100 + 15) / 16 * 16; + (gSaveContext.healthCapacity * CVarGetInteger(CVAR_ENHANCEMENT("FairyReviveHealth"), 100) / 100 + 15) / 16 * 16; } else { - gSaveContext.healthAccumulator = CVarGetInteger("gFairyReviveHealth", 20) * 16; + gSaveContext.healthAccumulator = CVarGetInteger(CVAR_ENHANCEMENT("FairyReviveHealth"), 20) * 16; } } else { gSaveContext.healthAccumulator = 0x140; @@ -8959,7 +8959,7 @@ static AnimSfxEntry D_808545F0[] = { }; void Player_Action_80843CEC(Player* this, PlayState* play) { - if (this->currentTunic != PLAYER_TUNIC_GORON && CVarGetInteger("gSuperTunic", 0) == 0) { + if (this->currentTunic != PLAYER_TUNIC_GORON && CVarGetInteger(CVAR_CHEAT("SuperTunic"), 0) == 0) { if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (sFloorType == 9) || ((func_80838144(sFloorType) >= 0) && !SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId))) { @@ -9023,7 +9023,7 @@ s32 func_80843E64(PlayState* play, Player* this) { impactInfo = &D_80854600[impactIndex]; - if (Player_InflictDamageModified(play, impactInfo->damage * (1 << CVarGetInteger("gFallDamageMul", 0)), + if (Player_InflictDamageModified(play, impactInfo->damage * (1 << CVarGetInteger(CVAR_ENHANCEMENT("FallDamageMult"), 0)), false)) { return -1; } @@ -9086,7 +9086,7 @@ void Player_Action_8084411C(Player* this, PlayState* play) { Actor* heldActor = this->heldActor; u16 buttonsToCheck = BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger("gDpadEquips", 0) != 0) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if (!func_80835644(play, this, heldActor) && (heldActor->id == ACTOR_EN_NIW) && @@ -9843,7 +9843,7 @@ void Player_Action_80846120(Player* this, PlayState* play) { if (LinkAnimation_OnFrame(&this->skelAnime, 229.0f)) { Actor* heldActor = this->heldActor; - if (CVarGetInteger("gFasterHeavyBlockLift", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 0)) { // This is the difference in rotation when the animation is sped up 5x heldActor->shape.rot.x -= 3510; } @@ -9868,7 +9868,7 @@ void Player_Action_80846260(Player* this, PlayState* play) { } u16 buttonsToCheck = BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger("gDpadEquips", 0) != 0) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if (this->av2.actionVar2 == 0) { @@ -9942,7 +9942,7 @@ void Player_Action_808464B0(Player* this, PlayState* play) { heldActor->velocity.y = 0.0f; heldActor->speedXZ = 0.0f; func_80834644(play, this); - if (heldActor->id == ACTOR_EN_BOM_CHU && !CVarGetInteger("gDisableFirstPersonChus", 0)) { + if (heldActor->id == ACTOR_EN_BOM_CHU && !CVarGetInteger(CVAR_ENHANCEMENT("DisableFirstPersonChus"), 0)) { func_8083B8F4(this, play); } } @@ -10200,7 +10200,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { Player_UseItem(play, this, ITEM_NONE); Player_SetEquipmentData(play, this); this->prevBoots = this->currentBoots; - if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) { if (INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_SOLD_OUT) { sMaskMemory = PLAYER_MASK_NONE; } @@ -10456,7 +10456,7 @@ void func_808473D4(PlayState* play, Player* this) { if (doAction != DO_ACTION_PUTAWAY) { this->unk_837 = 20; } else if (this->unk_837 != 0) { - if (CVarGetInteger("gInstantPutaway", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("InstantPutaway"), 0) != 0) { this->unk_837 = 0; } else { doAction = DO_ACTION_NONE; @@ -10493,7 +10493,7 @@ s32 Player_UpdateHoverBoots(Player* this) { s32 cond; if ((this->currentBoots == PLAYER_BOOTS_HOVER || - (CVarGetInteger("gIvanCoopModeEnabled", 0) && this->ivanFloating)) && + (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0) && this->ivanFloating)) && (this->hoverBootsTimer != 0)) { this->hoverBootsTimer--; } else { @@ -10501,7 +10501,7 @@ s32 Player_UpdateHoverBoots(Player* this) { } cond = (this->currentBoots == PLAYER_BOOTS_HOVER || - (CVarGetInteger("gIvanCoopModeEnabled", 0) && this->ivanFloating)) && + (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0) && this->ivanFloating)) && ((this->actor.yDistToWater >= 0.0f) || (func_80838144(sFloorType) >= 0) || func_8083816C(sFloorType)); if (cond && (this->actor.bgCheckFlags & 1) && (this->hoverBootsTimer != 0)) { @@ -10664,7 +10664,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { sTouchedWallFlags = func_80041DB8(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId); // conflicts arise from these two being enabled at once, and with ClimbEverything on, FixVineFall is redundant anyway - if (CVarGetInteger("gFixVineFall", 0) && !CVarGetInteger("gClimbEverything", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FixVineFall"), 0) && !CVarGetInteger(CVAR_CHEAT("ClimbEverything"), 0)) { /* This fixes the "started climbing a wall and then immediately fell off" bug. * The main idea is if a climbing wall is detected, double-check that it will * still be valid once climbing begins by doing a second raycast with a small @@ -10733,7 +10733,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { if ((this->actor.bgCheckFlags & 0x200) && (sShapeYawToTouchedWall < 0x3000)) { CollisionPoly* wallPoly = this->actor.wallPoly; - if ((ABS(wallPoly->normal.y) < 600) || (CVarGetInteger("gClimbEverything", 0) != 0)) { + if ((ABS(wallPoly->normal.y) < 600) || (CVarGetInteger(CVAR_CHEAT("ClimbEverything"), 0) != 0)) { f32 sp8C = COLPOLY_GET_NORMAL(wallPoly->normal.x); f32 sp88 = COLPOLY_GET_NORMAL(wallPoly->normal.y); f32 sp84 = COLPOLY_GET_NORMAL(wallPoly->normal.z); @@ -10924,7 +10924,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { seqMode = SEQ_MODE_STILL; } - if (play->actorCtx.targetCtx.bgmEnemy != NULL && !CVarGetInteger("gEnemyBGMDisable", 0)) { + if (play->actorCtx.targetCtx.bgmEnemy != NULL && !CVarGetInteger(CVAR_AUDIO("EnemyBGMDisable"), 0)) { seqMode = SEQ_MODE_ENEMY; Audio_SetBgmEnemyVolume(sqrtf(play->actorCtx.targetCtx.bgmEnemy->xyzDistToPlayerSq)); } @@ -11004,7 +11004,7 @@ void Player_UpdateBodyBurn(PlayState* play, Player* this) { s32 sp58; s32 sp54; - if (this->currentTunic == PLAYER_TUNIC_GORON || CVarGetInteger("gSuperTunic", 0) != 0) { + if (this->currentTunic == PLAYER_TUNIC_GORON || CVarGetInteger(CVAR_CHEAT("SuperTunic"), 0) != 0) { sp54 = 20; } else { sp54 = (s32)(this->linearVelocity * 0.4f) + 1; @@ -11073,17 +11073,17 @@ void func_80848EF8(Player* this, PlayState* play) { /*Prevent it on horse, while jumping and on title screen. If you fly around no stone of agony for you! */ Color_RGB8 stoneOfAgonyColor = { 255, 255, 255 }; - if (CVarGetInteger("gCosmetics.Hud_StoneOfAgony.Changed", 0)) { - stoneOfAgonyColor = CVarGetColor24("gCosmetics.Hud_StoneOfAgony.Value", stoneOfAgonyColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.StoneOfAgony.Changed"), 0)) { + stoneOfAgonyColor = CVarGetColor24(CVAR_COSMETIC("HUD.StoneOfAgony.Value"), stoneOfAgonyColor); } - if (CVarGetInteger("gVisualAgony", 0) && !this->stateFlags1 && !GameInteractor_NoUIActive()) { - s16 Top_Margins = (CVarGetInteger("gHUDMargin_T", 0) * -1); - s16 Left_Margins = CVarGetInteger("gHUDMargin_L", 0); - s16 Right_Margins = CVarGetInteger("gHUDMargin_R", 0); + if (CVarGetInteger(CVAR_ENHANCEMENT("VisualAgony"), 0) && !this->stateFlags1 && !GameInteractor_NoUIActive()) { + s16 Top_Margins = (CVarGetInteger(CVAR_COSMETIC("HUD.Margin.T"), 0) * -1); + s16 Left_Margins = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.L"), 0); + s16 Right_Margins = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.R"), 0); s16 X_Margins_VSOA; s16 Y_Margins_VSOA; - if (CVarGetInteger("gVSOAUseMargins", 0) != 0) { - if (CVarGetInteger("gVSOAPosType", 0) == 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosType"), 0) == 0) { X_Margins_VSOA = Left_Margins; }; Y_Margins_VSOA = Top_Margins; @@ -11095,21 +11095,21 @@ void func_80848EF8(Player* this, PlayState* play) { s16 PosY_VSOA_ori = 60 + Y_Margins_VSOA; s16 PosX_VSOA; s16 PosY_VSOA; - if (CVarGetInteger("gVSOAPosType", 0) != 0) { - PosY_VSOA = CVarGetInteger("gVSOAPosY", 0) + Y_Margins_VSOA; - if (CVarGetInteger("gVSOAPosType", 0) == 1) { // Anchor Left - if (CVarGetInteger("gVSOAUseMargins", 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosType"), 0) != 0) { + PosY_VSOA = CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosY"), 0) + Y_Margins_VSOA; + if (CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosType"), 0) == 1) { // Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.UseMargins"), 0) != 0) { X_Margins_VSOA = Left_Margins; }; - PosX_VSOA = OTRGetDimensionFromLeftEdge(CVarGetInteger("gVSOAPosX", 0) + X_Margins_VSOA); - } else if (CVarGetInteger("gVSOAPosType", 0) == 2) { // Anchor Right - if (CVarGetInteger("gVSOAUseMargins", 0) != 0) { + PosX_VSOA = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosX"), 0) + X_Margins_VSOA); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosType"), 0) == 2) { // Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.UseMargins"), 0) != 0) { X_Margins_VSOA = Right_Margins; }; - PosX_VSOA = OTRGetDimensionFromRightEdge(CVarGetInteger("gVSOAPosX", 0) + X_Margins_VSOA); - } else if (CVarGetInteger("gVSOAPosType", 0) == 3) { // Anchor None - PosX_VSOA = CVarGetInteger("gVSOAPosX", 0); - } else if (CVarGetInteger("gVSOAPosType", 0) == 4) { // Hidden + PosX_VSOA = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosX"), 0) + X_Margins_VSOA); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosType"), 0) == 3) { // Anchor None + PosX_VSOA = CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosX"), 0); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.VisualSoA.PosType"), 0) == 4) { // Hidden PosX_VSOA = -9999; } } else { @@ -11160,7 +11160,7 @@ void func_80848EF8(Player* this, PlayState* play) { if (this->unk_6A0 > 4000000.0f) { this->unk_6A0 = 0.0f; - if (CVarGetInteger("gVisualAgony", 0) && !this->stateFlags1 && !GameInteractor_NoUIActive()) { + if (CVarGetInteger(CVAR_ENHANCEMENT("VisualAgony"), 0) && !this->stateFlags1 && !GameInteractor_NoUIActive()) { // This audio is placed here and not in previous CVar check to prevent ears ra.. :) Audio_PlaySoundGeneral(NA_SE_SY_MESSAGE_WOMAN, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E0); } @@ -11631,7 +11631,7 @@ void Player_Update(Actor* thisx, PlayState* play) { if (func_8084FCAC(this, play)) { if (gSaveContext.dogParams < 0) { // Disable object dependency to prevent losing dog in scenes other than market - if (Object_GetIndex(&play->objectCtx, OBJECT_DOG) < 0 && !CVarGetInteger("gDogFollowsEverywhere", 0)) { + if (Object_GetIndex(&play->objectCtx, OBJECT_DOG) < 0 && !CVarGetInteger(CVAR_ENHANCEMENT("DogFollowsEverywhere"), 0)) { gSaveContext.dogParams = 0; } else { gSaveContext.dogParams &= 0x7FFF; @@ -11642,7 +11642,7 @@ void Player_Update(Actor* thisx, PlayState* play) { sDogSpawnPos.z, 0, this->actor.shape.rot.y, 0, dogParams | 0x8000, true); if (dog != NULL) { // Room -1 allows actor to cross between rooms, similar to Navi - dog->room = CVarGetInteger("gDogFollowsEverywhere", 0) ? -1 : 0; + dog->room = CVarGetInteger(CVAR_ENHANCEMENT("DogFollowsEverywhere"), 0) ? -1 : 0; } } } @@ -11665,7 +11665,7 @@ void Player_Update(Actor* thisx, PlayState* play) { } } - if (CVarGetInteger("gEnableWalkModify", 0) && CVarGetInteger("gWalkSpeedToggle", 0)) { + if (CVarGetInteger(CVAR_SETTING("WalkModifier.Enabled"), 0) && CVarGetInteger(CVAR_SETTING("WalkModifier.SpeedToggle"), 0)) { if (CHECK_BTN_ALL(sControlInput->press.button, BTN_MODIFIER1)) { gWalkSpeedToggle1 = !gWalkSpeedToggle1; } @@ -11778,7 +11778,7 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, if ((overrideLimbDraw == Player_OverrideLimbDrawGameplayDefault) && (this->currentMask != PLAYER_MASK_NONE)) { // Fixes a bug in vanilla where ice traps are rendered extremely large while wearing a bunny hood - if (CVarGetInteger("gFixIceTrapWithBunnyHood", 1)) Matrix_Push(); + if (CVarGetInteger(CVAR_GENERAL("FixIceTrapWithBunnyHood"), 1)) Matrix_Push(); Mtx* bunnyEarMtx = Graph_Alloc(play->state.gfxCtx, 2 * sizeof(Mtx)); if (this->currentMask == PLAYER_MASK_BUNNY) { @@ -11791,27 +11791,27 @@ void Player_DrawGameplay(PlayState* play, Player* this, s32 lod, Gfx* cullDList, earRot.x = sBunnyEarKinematics.rot.y + 0x3E2; earRot.y = sBunnyEarKinematics.rot.z + 0xDBE; earRot.z = sBunnyEarKinematics.rot.x - 0x348A; - Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f - CVarGetFloat("gCosmetics.BunnyHood_EarLength", 0.0f), -240.0f - CVarGetFloat("gCosmetics.BunnyHood_EarSpread", 0.0f), &earRot); + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f - CVarGetFloat(CVAR_COSMETIC("BunnyHood.EarLength"), 0.0f), -240.0f - CVarGetFloat(CVAR_COSMETIC("BunnyHood.EarSpread"), 0.0f), &earRot); MATRIX_TOMTX(bunnyEarMtx++); // Left ear earRot.x = sBunnyEarKinematics.rot.y - 0x3E2; earRot.y = -0xDBE - sBunnyEarKinematics.rot.z; earRot.z = sBunnyEarKinematics.rot.x - 0x348A; - Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f - CVarGetFloat("gCosmetics.BunnyHood_EarLength", 0.0f), 240.0f + CVarGetFloat("gCosmetics.BunnyHood_EarSpread", 0.0f), &earRot); + Matrix_SetTranslateRotateYXZ(97.0f, -1203.0f - CVarGetFloat(CVAR_COSMETIC("BunnyHood.EarLength"), 0.0f), 240.0f + CVarGetFloat(CVAR_COSMETIC("BunnyHood.EarSpread"), 0.0f), &earRot); MATRIX_TOMTX(bunnyEarMtx); } - if (this->currentMask != PLAYER_MASK_BUNNY || !CVarGetInteger("gHideBunnyHood", 0)) { + if (this->currentMask != PLAYER_MASK_BUNNY || !CVarGetInteger(CVAR_ENHANCEMENT("HideBunnyHood"), 0)) { gSPDisplayList(POLY_OPA_DISP++, sMaskDlists[this->currentMask - 1]); } - if (CVarGetInteger("gFixIceTrapWithBunnyHood", 1)) Matrix_Pop(); + if (CVarGetInteger(CVAR_GENERAL("FixIceTrapWithBunnyHood"), 1)) Matrix_Pop(); } if ((this->currentBoots == PLAYER_BOOTS_HOVER || - (CVarGetInteger("gIvanCoopModeEnabled", 0) && this->ivanFloating)) && + (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0) && this->ivanFloating)) && !(this->actor.bgCheckFlags & 1) && !(this->stateFlags1 & PLAYER_STATE1_ON_HORSE) && (this->hoverBootsTimer != 0)) { s32 sp5C; @@ -11896,7 +11896,7 @@ void Player_Draw(Actor* thisx, PlayState* play2) { lod = 1; } - if (CVarGetInteger("gDisableLOD", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("DisableLOD"), 0)) { lod = 0; } @@ -12001,23 +12001,23 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) { s32 temp1 = 0; s16 temp2 = 0; s16 temp3 = 0; - s8 invertXAxisMulti = ((CVarGetInteger("gInvertAimingXAxis", 0) && !CVarGetInteger("gMirroredWorld", 0)) || (!CVarGetInteger("gInvertAimingXAxis", 0) && CVarGetInteger("gMirroredWorld", 0))) ? -1 : 1; - s8 invertYAxisMulti = CVarGetInteger("gInvertAimingYAxis", 1) ? 1 : -1; - f32 xAxisMulti = CVarGetFloat("gFirstPersonCameraSensitivityX", 1.0f); - f32 yAxisMulti = CVarGetFloat("gFirstPersonCameraSensitivityY", 1.0f); + s8 invertXAxisMulti = ((CVarGetInteger(CVAR_SETTING("Controls.InvertAimingXAxis"), 0) && !CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) || (!CVarGetInteger(CVAR_SETTING("Controls.InvertAimingXAxis"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0))) ? -1 : 1; + s8 invertYAxisMulti = CVarGetInteger(CVAR_SETTING("Controls.InvertAimingYAxis"), 1) ? 1 : -1; + f32 xAxisMulti = CVarGetFloat(CVAR_SETTING("FirstPersonCameraSensitivity.X"), 1.0f); + f32 yAxisMulti = CVarGetFloat(CVAR_SETTING("FirstPersonCameraSensitivity.Y"), 1.0f); if (!func_8002DD78(this) && !func_808334B4(this) && (arg2 == 0)) { // First person without weapon // Y Axis - if (!CVarGetInteger("gMoveWhileFirstPerson", 0)) { + if (!CVarGetInteger(CVAR_SETTING("MoveInFirstPerson"), 0)) { temp2 += sControlInput->rel.stick_y * 240.0f * invertYAxisMulti * yAxisMulti; } - if (CVarGetInteger("gRightStickAiming", 0) && fabsf(sControlInput->cur.right_stick_y) > 15.0f) { + if (CVarGetInteger(CVAR_SETTING("Controls.RightStickAim"), 0) && fabsf(sControlInput->cur.right_stick_y) > 15.0f) { temp2 += sControlInput->cur.right_stick_y * 240.0f * invertYAxisMulti * yAxisMulti; } if (fabsf(sControlInput->cur.gyro_x) > 0.01f) { temp2 += (-sControlInput->cur.gyro_x) * 750.0f; } - if (CVarGetInteger("gDisableAutoCenterViewFirstPerson", 0)) { + if (CVarGetInteger(CVAR_SETTING("DisableFirstPersonAutoCenterView"), 0)) { this->actor.focus.rot.x += temp2 * 0.1f; this->actor.focus.rot.x = CLAMP(this->actor.focus.rot.x, -14000, 14000); } else { @@ -12026,10 +12026,10 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) { // X Axis temp2 = 0; - if (!CVarGetInteger("gMoveWhileFirstPerson", 0)) { + if (!CVarGetInteger(CVAR_SETTING("MoveInFirstPerson"), 0)) { temp2 += sControlInput->rel.stick_x * -16.0f * invertXAxisMulti * xAxisMulti; } - if (CVarGetInteger("gRightStickAiming", 0) && fabsf(sControlInput->cur.right_stick_x) > 15.0f) { + if (CVarGetInteger(CVAR_SETTING("Controls.RightStickAim"), 0) && fabsf(sControlInput->cur.right_stick_x) > 15.0f) { temp2 += sControlInput->cur.right_stick_x * -16.0f * invertXAxisMulti * xAxisMulti; } if (fabsf(sControlInput->cur.gyro_y) > 0.01f) { @@ -12041,11 +12041,11 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) { // Y Axis temp1 = (this->stateFlags1 & PLAYER_STATE1_ON_HORSE) ? 3500 : 14000; - if (!CVarGetInteger("gMoveWhileFirstPerson", 0)) { + if (!CVarGetInteger(CVAR_SETTING("MoveInFirstPerson"), 0)) { temp3 += ((sControlInput->rel.stick_y >= 0) ? 1 : -1) * (s32)((1.0f - Math_CosS(sControlInput->rel.stick_y * 200)) * 1500.0f) * invertYAxisMulti * yAxisMulti; } - if (CVarGetInteger("gRightStickAiming", 0) && fabsf(sControlInput->cur.right_stick_y) > 15.0f) { + if (CVarGetInteger(CVAR_SETTING("Controls.RightStickAim"), 0) && fabsf(sControlInput->cur.right_stick_y) > 15.0f) { temp3 += ((sControlInput->cur.right_stick_y >= 0) ? 1 : -1) * (s32)((1.0f - Math_CosS(sControlInput->cur.right_stick_y * 200)) * 1500.0f) * invertYAxisMulti * yAxisMulti; } @@ -12059,11 +12059,11 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) { temp1 = 19114; temp2 = this->actor.focus.rot.y - this->actor.shape.rot.y; temp3 = 0; - if (!CVarGetInteger("gMoveWhileFirstPerson", 0)) { + if (!CVarGetInteger(CVAR_SETTING("MoveInFirstPerson"), 0)) { temp3 = ((sControlInput->rel.stick_x >= 0) ? 1 : -1) * (s32)((1.0f - Math_CosS(sControlInput->rel.stick_x * 200)) * -1500.0f) * invertXAxisMulti * xAxisMulti; } - if (CVarGetInteger("gRightStickAiming", 0) && fabsf(sControlInput->cur.right_stick_x) > 15.0f) { + if (CVarGetInteger(CVAR_SETTING("Controls.RightStickAim"), 0) && fabsf(sControlInput->cur.right_stick_x) > 15.0f) { temp3 += ((sControlInput->cur.right_stick_x >= 0) ? 1 : -1) * (s32)((1.0f - Math_CosS(sControlInput->cur.right_stick_x * 200)) * -1500.0f) * invertXAxisMulti * xAxisMulti; } @@ -12074,9 +12074,9 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) { this->actor.focus.rot.y = CLAMP(temp2, -temp1, temp1) + this->actor.shape.rot.y; } - if (CVarGetInteger("gMoveWhileFirstPerson", 0)) { + if (CVarGetInteger(CVAR_SETTING("MoveInFirstPerson"), 0)) { f32 movementSpeed = LINK_IS_ADULT ? 9.0f : 8.25f; - if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && this->currentMask == PLAYER_MASK_BUNNY) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && this->currentMask == PLAYER_MASK_BUNNY) { movementSpeed *= 1.5f; } @@ -12113,18 +12113,18 @@ void func_8084AEEC(Player* this, f32* arg1, f32 arg2, s16 arg3) { // #region SOH [Enhancement] f32 swimMod = 1.0f; - if (CVarGetInteger("gEnableWalkModify", 0) == 1) { - if (CVarGetInteger("gWalkSpeedToggle", 0) == 1) { + if (CVarGetInteger(CVAR_SETTING("WalkModifier.Enabled"), 0) == 1) { + if (CVarGetInteger(CVAR_SETTING("WalkModifier.SpeedToggle"), 0) == 1) { if (gWalkSpeedToggle1) { - swimMod *= CVarGetFloat("gSwimModifierOne", 1.0f); + swimMod *= CVarGetFloat(CVAR_SETTING("WalkModifier.SwimMapping1"), 1.0f); } else if (gWalkSpeedToggle2) { - swimMod *= CVarGetFloat("gSwimModifierTwo", 1.0f); + swimMod *= CVarGetFloat(CVAR_SETTING("WalkModifier.SwimMapping2"), 1.0f); } } else { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER1)) { - swimMod *= CVarGetFloat("gSwimModifierOne", 1.0f); + swimMod *= CVarGetFloat(CVAR_SETTING("WalkModifier.SwimMapping1"), 1.0f); } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_MODIFIER2)) { - swimMod *= CVarGetFloat("gSwimModifierTwo", 1.0f); + swimMod *= CVarGetFloat(CVAR_SETTING("WalkModifier.SwimMapping2"), 1.0f); } } temp1 = this->skelAnime.curFrame - 10.0f; @@ -12272,7 +12272,7 @@ void Player_Action_8084B1D8(Player* this, PlayState* play) { } u16 buttonsToCheck = BTN_A | BTN_B | BTN_R | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; - if (CVarGetInteger("gDpadEquips", 0) != 0) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if ((this->csAction != 0) || (this->unk_6AD == 0) || (this->unk_6AD >= 4) || func_80833B54(this) || @@ -12300,7 +12300,7 @@ s32 func_8084B3CC(PlayState* play, Player* this) { if (!func_8002DD6C(this) || Player_HoldsHookshot(this)) { s32 projectileItemToUse = ITEM_BOW; - if(CVarGetInteger("gBowSlingShotAmmoFix", 0)){ + if(CVarGetInteger(CVAR_ENHANCEMENT("BowSlingshotAmmoFix"), 0)){ projectileItemToUse = LINK_IS_ADULT ? ITEM_BOW : ITEM_SLINGSHOT; } @@ -12641,7 +12641,7 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { phi_f2 = -1.0f; } - this->skelAnime.playSpeed = phi_f2 * phi_f0 + phi_f2 * CVarGetInteger("gClimbSpeed", 0); + this->skelAnime.playSpeed = phi_f2 * phi_f0 + phi_f2 * CVarGetInteger(CVAR_ENHANCEMENT("ClimbSpeed"), 0); if (this->av2.actionVar2 >= 0) { if ((this->actor.wallPoly != NULL) && (this->actor.wallBgId != BGCHECK_SCENE)) { @@ -12711,7 +12711,7 @@ void Player_Action_8084BF1C(Player* this, PlayState* play) { if ((this->av1.actionVar1 != 0) && (sp80 != 0)) { anim2 = this->ageProperties->unk_BC[this->av2.actionVar2]; - if (CVarGetInteger("gMirroredWorld", 0) ? (sp80 < 0) : (sp80 > 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? (sp80 < 0) : (sp80 > 0)) { this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->av2.actionVar2]; Player_AnimPlayOnce(play, this, anim2); } else { @@ -12814,8 +12814,8 @@ void Player_Action_8084C760(Player* this, PlayState* play) { // player speed in a tunnel if (!Player_TryLeavingCrawlspace(this, play)) { // #region SOH [Enhancement] - if (CVarGetInteger("gCrawlSpeed", 1) > 1) { - this->linearVelocity = sControlInput->rel.stick_y * 0.03f * CVarGetInteger("gCrawlSpeed", 1); + if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { + this->linearVelocity = sControlInput->rel.stick_y * 0.03f * CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1); // #endregion } else { this->linearVelocity = sControlInput->rel.stick_y * 0.03f; @@ -13360,7 +13360,7 @@ void func_8084DBC4(PlayState* play, Player* this, f32 arg2) { func_8084AEEC(this, &this->linearVelocity, sp2C * 0.5f, sp2A); // Original implementation of func_8084AEEC (SurfaceWithoutSwimMod) to prevent velocity increases via swim mod which push Link into the air // #region SOH [Enhancement] - if (CVarGetInteger("gEnableWalkModify", 0)) { + if (CVarGetInteger(CVAR_SETTING("WalkModifier.Enabled"), 0)) { SurfaceWithoutSwimMod(this, &this->actor.velocity.y, arg2, this->yaw); // #endregion } else { @@ -13466,7 +13466,7 @@ s32 func_8084DFF4(PlayState* play, Player* this) { } this->av1.actionVar1 = 1; equipItem = giEntry.itemId; - equipNow = CVarGetInteger("gAskToEquip", 0) && giEntry.modIndex == MOD_NONE && + equipNow = CVarGetInteger(CVAR_ENHANCEMENT("AskToEquip"), 0) && giEntry.modIndex == MOD_NONE && equipItem >= ITEM_SWORD_KOKIRI && equipItem <= ITEM_TUNIC_ZORA && CHECK_AGE_REQ_ITEM(equipItem); @@ -13842,29 +13842,29 @@ void Player_Action_8084EAC0(Player* this, PlayState* play) { } else { s32 sp28 = D_808549FC[this->itemAction - PLAYER_IA_BOTTLE_POTION_RED]; - if (CVarGetInteger("gRedPotionEffect", 0) && this->itemAction == PLAYER_IA_BOTTLE_POTION_RED) { - if (CVarGetInteger("gRedPercentRestore", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RedPotionEffect"), 0) && this->itemAction == PLAYER_IA_BOTTLE_POTION_RED) { + if (CVarGetInteger(CVAR_ENHANCEMENT("RedPercentRestore"), 0)) { gSaveContext.healthAccumulator = - (gSaveContext.healthCapacity * CVarGetInteger("gRedPotionHealth", 100) / 100 + 15) / 16 * 16; + (gSaveContext.healthCapacity * CVarGetInteger(CVAR_ENHANCEMENT("RedPotionHealth"), 100) / 100 + 15) / 16 * 16; } else { - gSaveContext.healthAccumulator = CVarGetInteger("gRedPotionHealth", 20) * 16; + gSaveContext.healthAccumulator = CVarGetInteger(CVAR_ENHANCEMENT("RedPotionHealth"), 20) * 16; } - } else if (CVarGetInteger("gBluePotionEffects", 0) && + } else if (CVarGetInteger(CVAR_ENHANCEMENT("BluePotionEffects"), 0) && this->itemAction == PLAYER_IA_BOTTLE_POTION_BLUE) { - if (CVarGetInteger("gBlueHealthPercentRestore", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("BlueHealthPercentRestore"), 0)) { gSaveContext.healthAccumulator = - (gSaveContext.healthCapacity * CVarGetInteger("gBluePotionHealth", 100) / 100 + 15) / 16 * 16; + (gSaveContext.healthCapacity * CVarGetInteger(CVAR_ENHANCEMENT("BluePotionHealth"), 100) / 100 + 15) / 16 * 16; } else { - gSaveContext.healthAccumulator = CVarGetInteger("gBluePotionHealth", 20) * 16; + gSaveContext.healthAccumulator = CVarGetInteger(CVAR_ENHANCEMENT("BluePotionHealth"), 20) * 16; } - if (CVarGetInteger("gBlueManaPercentRestore", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("BlueManaPercentRestore"), 0)) { if (gSaveContext.magicState != MAGIC_STATE_ADD) { Magic_Fill(play); } Magic_RequestChange(play, - (gSaveContext.magicLevel * 48 * CVarGetInteger("gBluePotionMana", 100) / 100 + 15) / + (gSaveContext.magicLevel * 48 * CVarGetInteger(CVAR_ENHANCEMENT("BluePotionMana"), 100) / 100 + 15) / 16 * 16, MAGIC_ADD); } else { @@ -13872,18 +13872,18 @@ void Player_Action_8084EAC0(Player* this, PlayState* play) { Magic_Fill(play); } - Magic_RequestChange(play, CVarGetInteger("gBluePotionMana", 100), MAGIC_ADD); + Magic_RequestChange(play, CVarGetInteger(CVAR_ENHANCEMENT("BluePotionMana"), 100), MAGIC_ADD); ; } - } else if (CVarGetInteger("gGreenPotionEffect", 0) && + } else if (CVarGetInteger(CVAR_ENHANCEMENT("GreenPotionEffect"), 0) && this->itemAction == PLAYER_IA_BOTTLE_POTION_GREEN) { - if (CVarGetInteger("gGreenPercentRestore", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("GreenPercentRestore"), 0)) { if (gSaveContext.magicState != MAGIC_STATE_ADD) { Magic_Fill(play); } Magic_RequestChange(play, - (gSaveContext.magicLevel * 48 * CVarGetInteger("gGreenPotionMana", 100) / 100 + 15) / + (gSaveContext.magicLevel * 48 * CVarGetInteger(CVAR_ENHANCEMENT("GreenPotionMana"), 100) / 100 + 15) / 16 * 16, MAGIC_ADD); } else { @@ -13891,25 +13891,25 @@ void Player_Action_8084EAC0(Player* this, PlayState* play) { Magic_Fill(play); } - Magic_RequestChange(play, CVarGetInteger("gGreenPotionMana", 100), MAGIC_ADD); + Magic_RequestChange(play, CVarGetInteger(CVAR_ENHANCEMENT("GreenPotionMana"), 100), MAGIC_ADD); ; } - } else if (CVarGetInteger("gMilkEffect", 0) && (this->itemAction == PLAYER_IA_BOTTLE_MILK_FULL || + } else if (CVarGetInteger(CVAR_ENHANCEMENT("MilkEffect"), 0) && (this->itemAction == PLAYER_IA_BOTTLE_MILK_FULL || this->itemAction == PLAYER_IA_BOTTLE_MILK_HALF)) { - if (CVarGetInteger("gMilkPercentRestore", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MilkPercentRestore"), 0)) { gSaveContext.healthAccumulator = - (gSaveContext.healthCapacity * CVarGetInteger("gMilkHealth", 100) / 100 + 15) / 16 * 16; + (gSaveContext.healthCapacity * CVarGetInteger(CVAR_ENHANCEMENT("MilkHealth"), 100) / 100 + 15) / 16 * 16; } else { - gSaveContext.healthAccumulator = CVarGetInteger("gMilkHealth", 5) * 16; + gSaveContext.healthAccumulator = CVarGetInteger(CVAR_ENHANCEMENT("MilkHealth"), 5) * 16; } - if (CVarGetInteger("gSeparateHalfMilkEffect", 0) && + if (CVarGetInteger(CVAR_ENHANCEMENT("SeparateHalfMilkEffect"), 0) && this->itemAction == PLAYER_IA_BOTTLE_MILK_HALF) { - if (CVarGetInteger("gHalfMilkPercentRestore", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("HalfMilkPercentRestore"), 0)) { gSaveContext.healthAccumulator = - (gSaveContext.healthCapacity * CVarGetInteger("gHalfMilkHealth", 100) / 100 + 15) / 16 * + (gSaveContext.healthCapacity * CVarGetInteger(CVAR_ENHANCEMENT("HalfMilkHealth"), 100) / 100 + 15) / 16 * 16; } else { - gSaveContext.healthAccumulator = CVarGetInteger("gHalfMilkHealth", 5) * 16; + gSaveContext.healthAccumulator = CVarGetInteger(CVAR_ENHANCEMENT("HalfMilkHealth"), 5) * 16; } } } else { @@ -13992,7 +13992,7 @@ void Player_Action_8084ECA4(Player* this, PlayState* play) { } } else if (this->av2.actionVar2 == 0) { - if (CVarGetInteger("gFastDrops", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FastDrops"), 0)) { this->av1.actionVar1 = 0; } else { Message_StartTextbox(play, D_80854A04[this->av1.actionVar1 - 1].textId, &this->actor); @@ -14054,7 +14054,7 @@ void Player_Action_8084ECA4(Player* this, PlayState* play) { // Vanilla behavior/rando gave a bottle item if (!IS_RANDO || catchInfo != NULL) { Player_UpdateBottleHeld(play, this, catchInfo->itemId, ABS(catchInfo->itemAction)); - if (!CVarGetInteger("gFastDrops", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("FastDrops"), 0)) { this->stateFlags1 |= PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE; Player_AnimPlayOnceAdjusted(play, this, sp24->unk_04); func_80835EA4(play, 4); @@ -14094,12 +14094,12 @@ void Player_Action_8084EED8(Player* this, PlayState* play) { Player_PlaySfx(this, NA_SE_EV_BOTTLE_CAP_OPEN); Player_PlaySfx(this, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } else if (LinkAnimation_OnFrame(&this->skelAnime, 47.0f)) { - if (CVarGetInteger("gFairyEffect", 0)) { - if (CVarGetInteger("gFairyPercentRestore", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FairyEffect"), 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FairyPercentRestore"), 0)) { gSaveContext.healthAccumulator = - (gSaveContext.healthCapacity * CVarGetInteger("gFairyHealth", 100) / 100 + 15) / 16 * 16; + (gSaveContext.healthCapacity * CVarGetInteger(CVAR_ENHANCEMENT("FairyHealth"), 100) / 100 + 15) / 16 * 16; } else { - gSaveContext.healthAccumulator = CVarGetInteger("gFairyHealth", 8) * 16; + gSaveContext.healthAccumulator = CVarGetInteger(CVAR_ENHANCEMENT("FairyHealth"), 8) * 16; } } else { gSaveContext.healthAccumulator = 0x140; @@ -14435,7 +14435,7 @@ void Player_Action_8084FBF4(Player* this, PlayState* play) { s32 func_8084FCAC(Player* this, PlayState* play) { sControlInput = &play->state.input[0]; - if (CVarGetInteger("gDebugEnabled", 0) && + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) && ((CHECK_BTN_ALL(sControlInput->cur.button, BTN_A | BTN_L | BTN_R) && CHECK_BTN_ALL(sControlInput->press.button, BTN_B)) || (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DRIGHT)))) { @@ -14474,9 +14474,9 @@ s32 func_8084FCAC(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DDOWN)) { angle = temp + 0x8000; } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DLEFT)) { - angle = temp + (0x4000 * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1)); + angle = temp + (0x4000 * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1)); } else if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DRIGHT)) { - angle = temp - (0x4000 * (CVarGetInteger("gMirroredWorld", 0) ? -1 : 1)); + angle = temp - (0x4000 * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1)); } this->actor.world.pos.x += speed * Math_SinS(angle); @@ -14756,7 +14756,7 @@ static AnimSfxEntry D_80854A8C[][2] = { }; void Player_Action_808507F4(Player* this, PlayState* play) { - u8 isFastFarores = CVarGetInteger("gFastFarores", 0) && this->itemAction == PLAYER_IA_FARORES_WIND; + u8 isFastFarores = CVarGetInteger(CVAR_ENHANCEMENT("FastFarores"), 0) && this->itemAction == PLAYER_IA_FARORES_WIND; if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->av1.actionVar1 < 0) { if ((this->itemAction == PLAYER_IA_NAYRUS_LOVE) || isFastFarores || (gSaveContext.magicState == MAGIC_STATE_IDLE)) { @@ -15952,7 +15952,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2) { sp24 = D_808547C4[this->cueId]; func_80852B4C(play, this, linkCsAction, &D_80854E50[ABS(sp24)]); - if (CVarGetInteger("gFixEyesOpenWhileSleeping", 0) && (play->csCtx.linkAction->action == 28 || play->csCtx.linkAction->action == 29)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FixEyesOpenWhileSleeping"), 0) && (play->csCtx.linkAction->action == 28 || play->csCtx.linkAction->action == 29)) { this->skelAnime.jointTable[22].x = 8; } } diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c b/soh/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c index fe92d8a3f..014541ee0 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Extra/z_eff_ss_extra.c @@ -62,7 +62,7 @@ void EffectSsExtra_Draw(PlayState* play, u32 index, EffectSs* this) { s32 pad; f32 scale = this->rScale / 100.0f; void* object = play->objectCtx.status[this->rObjBankIdx].segment; - u8 mirroredWorld = CVarGetInteger("gMirroredWorld", 0); + u8 mirroredWorld = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0); OPEN_DISPS(play->state.gfxCtx); diff --git a/soh/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c b/soh/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c index a1a46f6de..85c585462 100644 --- a/soh/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c +++ b/soh/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c @@ -222,7 +222,7 @@ static void draw_ico_sphere(Gfx** p_gfx_p, f32 x, f32 y, f32 z, f32 radius, Grap } void EffectSsSolderSrchBall_Draw(PlayState* play, u32 index, EffectSs* this) { - if (CVarGetInteger("gGuardVision", 0) == 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("GuardVision"), 0) == 0) { return; } 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 29c51e326..dcf3209cb 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 @@ -1008,11 +1008,11 @@ u8 generating; bool fileSelectSpoilerFileLoaded = false; void FileChoose_UpdateRandomizer() { - if (CVarGetInteger("gRandoGenerating", 0) != 0 && generating == 0) { + if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) != 0 && generating == 0) { generating = 1; func_800F5E18(SEQ_PLAYER_BGM_MAIN, NA_BGM_HORSE, 0, 7, 1); return; - } else if (CVarGetInteger("gRandoGenerating", 0) == 0 && generating) { + } else if (CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) == 0 && generating) { if (Randomizer_IsSeedGenerated()) { Audio_PlayFanfare(NA_BGM_HORSE_GOAL); } else { @@ -1025,22 +1025,22 @@ void FileChoose_UpdateRandomizer() { return; } - if (!SpoilerFileExists(CVarGetString("gSpoilerLog", "")) && !CVarGetInteger("gRandomizerDontGenerateSpoiler", 0)) { - CVarSetString("gSpoilerLog", ""); + if (!SpoilerFileExists(CVarGetString(CVAR_GENERAL("SpoilerLog"), "")) && !CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) { + CVarSetString(CVAR_GENERAL("SpoilerLog"), ""); } - if (CVarGetInteger("gRandomizerNewFileDropped", 0) != 0 || !(Randomizer_IsSeedGenerated() || Randomizer_IsSpoilerLoaded()) && - SpoilerFileExists(CVarGetString("gSpoilerLog", "")) && !fileSelectSpoilerFileLoaded) { - if (CVarGetInteger("gRandomizerNewFileDropped", 0) != 0) { - CVarSetString("gSpoilerLog", CVarGetString("gRandomizerDroppedFile", "")); + if (CVarGetInteger(CVAR_GENERAL("RandomizerNewFileDropped"), 0) != 0 || !(Randomizer_IsSeedGenerated() || Randomizer_IsSpoilerLoaded()) && + SpoilerFileExists(CVarGetString(CVAR_GENERAL("SpoilerLog"), "")) && !fileSelectSpoilerFileLoaded) { + if (CVarGetInteger(CVAR_GENERAL("RandomizerNewFileDropped"), 0) != 0) { + CVarSetString(CVAR_GENERAL("SpoilerLog"), CVarGetString(CVAR_GENERAL("RandomizerDroppedFile"), "")); } - const char* fileLoc = CVarGetString("gSpoilerLog", ""); - CVarSetInteger("gRandomizerNewFileDropped", 0); - CVarSetString("gRandomizerDroppedFile", ""); + const char* fileLoc = CVarGetString(CVAR_GENERAL("SpoilerLog"), ""); + CVarSetInteger(CVAR_GENERAL("RandomizerNewFileDropped"), 0); + CVarSetString(CVAR_GENERAL("RandomizerDroppedFile"), ""); Randomizer_ParseSpoiler(fileLoc); fileSelectSpoilerFileLoaded = true; - if (SpoilerFileExists(CVarGetString("gSpoilerLog", "")) && CVarGetInteger("gRandomizerDontGenerateSpoiler", 0)) { + if (SpoilerFileExists(CVarGetString(CVAR_GENERAL("SpoilerLog"), "")) && CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) { remove(fileLoc); } } @@ -1061,7 +1061,7 @@ void FileChoose_UpdateMainMenu(GameState* thisx) { static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E }; FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); FileChoose_UpdateRandomizer(); @@ -1251,7 +1251,7 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) { FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; s8 i = 0; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); FileChoose_UpdateRandomizer(); @@ -1308,17 +1308,17 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) { this->prevConfigMode = this->configMode; this->configMode = CM_ROTATE_TO_NAME_ENTRY; this->logoAlpha = 0; - CVarSetInteger("gOnFileSelectNameEntry", 1); + CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 1); this->kbdButton = FS_KBD_BTN_NONE; this->charPage = FS_CHAR_PAGE_ENG; this->kbdX = 0; this->kbdY = 0; this->charIndex = 0; this->charBgAlpha = 0; - this->newFileNameCharCount = CVarGetInteger("gLinkDefaultName", 0) ? 4 : 0; + this->newFileNameCharCount = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? 4 : 0; this->nameEntryBoxPosX = 120; this->nameEntryBoxAlpha = 0; - memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName, CVarGetInteger("gLinkDefaultName", 0) ? &linkName : &emptyName, 8); + memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName, CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkName : &emptyName, 8); return; } } @@ -1343,18 +1343,18 @@ void FileChoose_GenerateRandoSeed(GameState* thisx) { this->prevConfigMode = this->configMode; this->configMode = CM_ROTATE_TO_NAME_ENTRY; this->logoAlpha = 0; - CVarSetInteger("gOnFileSelectNameEntry", 1); + CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 1); this->kbdButton = FS_KBD_BTN_NONE; this->charPage = FS_CHAR_PAGE_ENG; this->kbdX = 0; this->kbdY = 0; this->charIndex = 0; this->charBgAlpha = 0; - this->newFileNameCharCount = CVarGetInteger("gLinkDefaultName", 0) ? 4 : 0; + this->newFileNameCharCount = CVarGetInteger(CVAR_GENERAL("LinkDefaultName"), 0) ? 4 : 0; this->nameEntryBoxPosX = 120; this->nameEntryBoxAlpha = 0; memcpy(Save_GetSaveMetaInfo(this->buttonIndex)->playerName, - CVarGetInteger("gLinkDefaultName", 0) ? &linkName : &emptyName, 8); + CVarGetInteger(CVAR_GENERAL("LinkDefaultName"), 0) ? &linkName : &emptyName, 8); return; } if (!generating) { @@ -1369,7 +1369,7 @@ void FileChoose_UpdateBossRushMenu(GameState* thisx) { FileChoose_UpdateStickDirectionPromptAnim(thisx); FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); // Fade in elements after opening Boss Rush options menu this->bossRushUIAlpha += 25; @@ -1989,20 +1989,20 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) { s16 deathCountSplit[3]; Color_RGB8 heartColor = {HEARTS_PRIM_R, HEARTS_PRIM_G, HEARTS_PRIM_B}; - if (CVarGetInteger("gCosmetics.Consumable_Hearts.Changed", 0)) { - heartColor = CVarGetColor24("gCosmetics.Consumable_Hearts.Value", heartColor); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.Hearts.Changed"), 0)) { + heartColor = CVarGetColor24(CVAR_COSMETIC("Consumable.Hearts.Value"), heartColor); } Color_RGB8 heartBorder = {HEARTS_ENV_R, HEARTS_ENV_G, HEARTS_ENV_B}; - if (CVarGetInteger("gCosmetics.Consumable_HeartBorder.Changed", 0)) { - heartBorder = CVarGetColor24("gCosmetics.Consumable_HeartBorder.Value", heartBorder); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.HeartBorder.Changed"), 0)) { + heartBorder = CVarGetColor24(CVAR_COSMETIC("Consumable.HeartBorder.Value"), heartBorder); } Color_RGB8 ddColor = {HEARTS_DD_ENV_R, HEARTS_DD_ENV_G, HEARTS_DD_ENV_B}; - if (CVarGetInteger("gCosmetics.Consumable_DDHearts.Changed", 0)) { - ddColor = CVarGetColor24("gCosmetics.Consumable_DDHearts.Value", ddColor); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.DDHearts.Changed"), 0)) { + ddColor = CVarGetColor24(CVAR_COSMETIC("Consumable.DDHearts.Value"), ddColor); } Color_RGB8 ddBorder = {HEARTS_DD_PRIM_R, HEARTS_DD_PRIM_G, HEARTS_DD_PRIM_B}; - if (CVarGetInteger("gCosmetics.Consumable_DDHeartBorder.Changed", 0)) { - ddBorder = CVarGetColor24("gCosmetics.Consumable_DDHeartBorder.Value", ddBorder); + if (CVarGetInteger(CVAR_COSMETIC("Consumable.DDHeartBorder.Changed"), 0)) { + ddBorder = CVarGetColor24(CVAR_COSMETIC("Consumable.DDHeartBorder.Value"), ddBorder); } OPEN_DISPS(this->state.gfxCtx); @@ -2035,7 +2035,7 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) { &deathCountSplit[2]); // draw death count - if (CVarGetInteger("gFileSelectMoreInfo", 0) == 0 || this->menuMode != FS_MENU_MODE_SELECT) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FileSelectMoreInfo"), 0) == 0 || this->menuMode != FS_MENU_MODE_SELECT) { for (i = 0, vtxOffset = 0; i < 3; i++, vtxOffset += 4) { FileChoose_DrawCharacter(this->state.gfxCtx, sp54->fontBuf + deathCountSplit[i] * FONT_CHAR_TEX_SIZE, vtxOffset); @@ -2059,7 +2059,7 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) { i = Save_GetSaveMetaInfo(fileIndex)->healthCapacity / 0x10; - if (CVarGetInteger("gFileSelectMoreInfo", 0) == 0 || this->menuMode != FS_MENU_MODE_SELECT) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FileSelectMoreInfo"), 0) == 0 || this->menuMode != FS_MENU_MODE_SELECT) { // draw hearts for (vtxOffset = 0, j = 0; j < i; j++, vtxOffset += 4) { gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[D_8081284C[fileIndex] + vtxOffset] + 0x30, 4, 0); @@ -2076,7 +2076,7 @@ void FileChoose_DrawFileInfo(GameState* thisx, s16 fileIndex, s16 isActive) { textAlpha = 255; } - if (CVarGetInteger("gFileSelectMoreInfo", 0) != 0 && this->menuMode == FS_MENU_MODE_SELECT) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FileSelectMoreInfo"), 0) != 0 && this->menuMode == FS_MENU_MODE_SELECT) { DrawMoreInfo(this, fileIndex, textAlpha); } else { // draw quest items @@ -2369,7 +2369,7 @@ void FileChoose_DrawWindowContents(GameState* thisx) { this->fileInfoAlpha[fileIndex]); // Draw the small file name box instead when more meta info is enabled - if (CVarGetInteger("gFileSelectMoreInfo", 0) != 0 && this->menuMode == FS_MENU_MODE_SELECT) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FileSelectMoreInfo"), 0) != 0 && this->menuMode == FS_MENU_MODE_SELECT) { // Location of file 1 small name box vertices gSPVertex(POLY_OPA_DISP++, &this->windowContentVtx[68], 4, 0); @@ -2850,7 +2850,7 @@ void FileChoose_FadeInFileInfo(GameState* thisx) { void FileChoose_ConfirmFile(GameState* thisx) { FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); if (CHECK_BTN_ALL(input->press.button, BTN_START) || (CHECK_BTN_ALL(input->press.button, BTN_A))) { if (this->confirmButtonIndex == FS_BTN_CONFIRM_YES) { @@ -2979,7 +2979,7 @@ void FileChoose_LoadGame(GameState* thisx) { gSaveContext.fileNum = this->buttonIndex; gSaveContext.gameMode = 0; - if ((this->buttonIndex == FS_BTN_SELECT_FILE_1 && CVarGetInteger("gDebugEnabled", 0)) || this->buttonIndex == 0xFF) { + if ((this->buttonIndex == FS_BTN_SELECT_FILE_1 && CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0)) || this->buttonIndex == 0xFF) { if (this->buttonIndex == 0xFF) { Sram_InitDebugSave(); } else { @@ -3005,7 +3005,7 @@ void FileChoose_LoadGame(GameState* thisx) { gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = 0xFF; gSaveContext.showTitleCard = true; - if (!CVarGetInteger("gDogFollowsEverywhere", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("DogFollowsEverywhere"), 0)) { gSaveContext.dogParams = 0; } gSaveContext.timer1State = 0; @@ -3045,21 +3045,6 @@ void FileChoose_LoadGame(GameState* thisx) { gSaveContext.naviTimer = 0; - // SWORDLESS LINK IS BACK BABY - if (CVarGetInteger("gSwordlessLink", 0) != 0) - { - if ((gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KOKIRI) && - (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_MASTER) && - (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_BGS) && - (gSaveContext.equips.buttonItems[0] != ITEM_SWORD_KNIFE)) { - - gSaveContext.equips.buttonItems[0] = ITEM_NONE; - swordEquipValue = (BOMSWAP16(gEquipMasks[EQUIP_TYPE_SWORD]) & gSaveContext.equips.equipment) >> (EQUIP_TYPE_SWORD * 4); - gSaveContext.equips.equipment &= gEquipNegMasks[EQUIP_TYPE_SWORD]; - gSaveContext.inventory.equipment ^= (gBitFlags[swordEquipValue - 1] << BOMSWAP16(gEquipShifts[EQUIP_TYPE_SWORD])); - } - } - if (IS_RANDO) { // Setup the modified entrance table and entrance shuffle table for rando Entrance_Init(); @@ -3285,8 +3270,8 @@ void FileChoose_Main(GameState* thisx) { Input* input = &this->state.input[0]; Color_RGB8 helpTextColor = { 100, 255, 255 }; - if (CVarGetInteger("gCosmetics.Title_FileChoose.Changed", 0)) { - Color_RGB8 backgroundColor = CVarGetColor24("gCosmetics.Title_FileChoose.Value", (Color_RGB8){ 100, 150, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Title.FileChoose.Changed"), 0)) { + Color_RGB8 backgroundColor = CVarGetColor24(CVAR_COSMETIC("Title.FileChoose.Value"), (Color_RGB8){ 100, 150, 255 }); this->windowColor[0] = backgroundColor.r; this->windowColor[1] = backgroundColor.g; this->windowColor[2] = backgroundColor.b; @@ -3311,19 +3296,19 @@ void FileChoose_Main(GameState* thisx) { sWindowContentColors[0][2] = 255; } - if (CVarGetInteger("gTimeFlowFileSelect", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeFlowFileSelect"), 0) != 0) { gSaveContext.skyboxTime += 0x10; } - if (CVarGetInteger("gSkipLogoTitle", 0) && CVarGetInteger("gSaveFileID", FASTFILE_1) <= FASTFILE_3 && !isFastFileIdIncompatible) { - if (Save_Exist(CVarGetInteger("gSaveFileID", FASTFILE_1)) && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(CVarGetInteger("gSaveFileID", FASTFILE_1)))) { - this->buttonIndex = CVarGetInteger("gSaveFileID", FASTFILE_1); + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), 0) && CVarGetInteger(CVAR_DEVELOPER_TOOLS("SaveFileID"), FASTFILE_1) <= FASTFILE_3 && !isFastFileIdIncompatible) { + if (Save_Exist(CVarGetInteger(CVAR_DEVELOPER_TOOLS("SaveFileID"), FASTFILE_1)) && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(CVarGetInteger(CVAR_DEVELOPER_TOOLS("SaveFileID"), FASTFILE_1)))) { + this->buttonIndex = CVarGetInteger(CVAR_DEVELOPER_TOOLS("SaveFileID"), FASTFILE_1); this->menuMode = FS_MENU_MODE_SELECT; this->selectMode = SM_LOAD_GAME; } else { isFastFileIdIncompatible = 1; } - } else if (CVarGetInteger("gSkipLogoTitle", 0) && CVarGetInteger("gSaveFileID", FASTFILE_1) == FASTFILE_MAP_SELECT) { + } else if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), 0) && CVarGetInteger(CVAR_DEVELOPER_TOOLS("SaveFileID"), FASTFILE_1) == FASTFILE_MAP_SELECT) { this->buttonIndex = 0xFF; this->menuMode = FS_MENU_MODE_SELECT; this->selectMode = SM_LOAD_GAME; @@ -3342,7 +3327,7 @@ void FileChoose_Main(GameState* thisx) { this->stickRelX = input->rel.stick_x; this->stickRelY = input->rel.stick_y; - if (CVarGetInteger("gDpadHoldChange", 1) && CVarGetInteger("gDpadText", 0)) { + if (CVarGetInteger(CVAR_SETTING("DpadHoldChange"), 1) && CVarGetInteger(CVAR_SETTING("DpadInText"), 0)) { if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) { if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) { this->inputTimerX = 10; @@ -3689,7 +3674,7 @@ void FileChoose_Init(GameState* thisx) { this->questType[1] = MIN_QUEST; this->questType[2] = MIN_QUEST; isFastFileIdIncompatible = 0; - CVarSetInteger("gOnFileSelectNameEntry", 0); + CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0); SREG(30) = 1; osSyncPrintf("SIZE=%x\n", size); diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c index 6f155e367..3080eb14f 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_copy_erase.c @@ -64,7 +64,7 @@ static s16 sLastCopyEraseButtonIndex; void FileChoose_SelectCopySource(GameState* thisx) { FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); if (((this->buttonIndex == FS_BTN_COPY_QUIT) && CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) || CHECK_BTN_ALL(input->press.button, BTN_B)) { @@ -181,7 +181,7 @@ void FileChoose_SetupCopyDest2(GameState* thisx) { void FileChoose_SelectCopyDest(GameState* thisx) { FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); if (((this->buttonIndex == FS_BTN_COPY_QUIT) && CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) || CHECK_BTN_ALL(input->press.button, BTN_B)) { @@ -370,7 +370,7 @@ void FileChoose_CopyConfirm(GameState* thisx) { FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; u16 dayTime; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); if (((this->buttonIndex != FS_BTN_CONFIRM_YES) && CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) || CHECK_BTN_ALL(input->press.button, BTN_B)) { @@ -695,7 +695,7 @@ void FileChoose_SetupEraseSelect(GameState* thisx) { void FileChoose_EraseSelect(GameState* thisx) { FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); if (((this->buttonIndex == FS_BTN_COPY_QUIT) && CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) || CHECK_BTN_ALL(input->press.button, BTN_B)) { @@ -837,7 +837,7 @@ void FileChoose_SetupEraseConfirm2(GameState* thisx) { void FileChoose_EraseConfirm(GameState* thisx) { FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); if (((this->buttonIndex != FS_BTN_CONFIRM_YES) && CHECK_BTN_ANY(input->press.button, BTN_A | BTN_START)) || CHECK_BTN_ALL(input->press.button, BTN_B)) { diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c index e76fc092e..6463bdbab 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_nameset_PAL.c @@ -381,7 +381,7 @@ void FileChoose_DrawNameEntry(GameState* thisx) { } this->prevConfigMode = CM_NAME_ENTRY; sLastCharIndex = -1; - CVarSetInteger("gOnFileSelectNameEntry", 0); + CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0); } else { for (i = this->newFileNameCharCount; i < 7; i++) { filename[i] = filename[i + 1]; @@ -456,7 +456,7 @@ void FileChoose_DrawNameEntry(GameState* thisx) { gSaveContext.dayTime = dayTime; this->prevConfigMode = CM_MAIN_MENU; this->configMode = CM_NAME_ENTRY_TO_MAIN; - CVarSetInteger("gOnFileSelectNameEntry", 0); + CVarSetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0); Randomizer_SetSeedGenerated(false); this->nameBoxAlpha[this->buttonIndex] = this->nameAlpha[this->buttonIndex] = 200; this->connectorAlpha[this->buttonIndex] = 255; @@ -529,7 +529,7 @@ void FileChoose_UpdateKeyboardCursor(GameState* thisx) { FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; s16 prevKbdX; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); this->kbdButton = 99; @@ -685,7 +685,7 @@ static s8 sLastOptionButtonIndex = -1; void FileChoose_UpdateOptionsMenu(GameState* thisx) { FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; - bool dpad = CVarGetInteger("gDpadText", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); if (CHECK_BTN_ALL(input->press.button, BTN_B)) { Audio_PlaySoundGeneral(NA_SE_SY_FSEL_DECIDE_L, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -755,7 +755,7 @@ void FileChoose_UpdateOptionsMenu(GameState* thisx) { // Persist the new language so it is not overridden on the next frame if (languageChanged) { - CVarSetInteger("gLanguages", gSaveContext.language); + CVarSetInteger(CVAR_SETTING("Languages"), gSaveContext.language); GameInteractor_ExecuteOnSetGameLanguage(); } @@ -913,8 +913,8 @@ void FileChoose_DrawOptionsImpl(GameState* thisx) { { 0, 150, 150 }, }; - if (CVarGetInteger("gCosmetics.Title_FileChoose.Changed", 0)) { - Color_RGB8 backgroundColor = CVarGetColor24("gCosmetics.Title_FileChoose.Value", (Color_RGB8){ 100, 150, 255 }); + if (CVarGetInteger(CVAR_COSMETIC("Title.FileChoose.Changed"), 0)) { + Color_RGB8 backgroundColor = CVarGetColor24(CVAR_COSMETIC("Title.FileChoose.Value"), (Color_RGB8){ 100, 150, 255 }); cursorPrimColors[1][0] = MIN(backgroundColor.r + 100, 255); cursorPrimColors[1][1] = MIN(backgroundColor.g + 100, 255); cursorPrimColors[1][2] = MIN(backgroundColor.b + 100, 255); diff --git a/soh/src/overlays/gamestates/ovl_select/z_select.c b/soh/src/overlays/gamestates/ovl_select/z_select.c index dbc7e1796..f4d577c5c 100644 --- a/soh/src/overlays/gamestates/ovl_select/z_select.c +++ b/soh/src/overlays/gamestates/ovl_select/z_select.c @@ -45,9 +45,9 @@ void Select_LoadGame(SelectContext* this, s32 entranceIndex) { } if (this->isBetterWarp) { - CVarSetInteger("gBetterDebugWarpScreenCurrentScene", this->currentScene); - CVarSetInteger("gBetterDebugWarpScreenTopDisplayedScene", this->topDisplayedScene); - CVarSetInteger("gBetterDebugWarpScreenPageDownIndex", this->pageDownIndex); + CVarSetInteger(CVAR_GENERAL("BetterDebugWarpScreenCurrentScene"), this->currentScene); + CVarSetInteger(CVAR_GENERAL("BetterDebugWarpScreenTopDisplayedScene"), this->topDisplayedScene); + CVarSetInteger(CVAR_GENERAL("BetterDebugWarpScreenPageDownIndex"), this->pageDownIndex); CVarSave(); if (ResourceMgr_GameHasMasterQuest() && ResourceMgr_GameHasOriginal()) { @@ -57,11 +57,11 @@ void Select_LoadGame(SelectContext* this, s32 entranceIndex) { s16 scene = gEntranceTable[entrancePair.entranceIndex].scene; u8 isEntranceDefaultMQ = ResourceMgr_IsSceneMasterQuest(scene); if (!isEntranceDefaultMQ && this->opt) { // Force vanilla for default MQ scene - CVarSetInteger("gBetterDebugWarpScreenMQMode", WARP_MODE_OVERRIDE_MQ_AS_VANILLA); - CVarSetInteger("gBetterDebugWarpScreenMQModeScene", scene); + CVarSetInteger(CVAR_GENERAL("BetterDebugWarpScreenMQMode"), WARP_MODE_OVERRIDE_MQ_AS_VANILLA); + CVarSetInteger(CVAR_GENERAL("BetterDebugWarpScreenMQModeScene"), scene); } else if (isEntranceDefaultMQ && !this->opt) { // Force MQ for default vanilla scene - CVarSetInteger("gBetterDebugWarpScreenMQMode", WARP_MODE_OVERRIDE_VANILLA_AS_MQ); - CVarSetInteger("gBetterDebugWarpScreenMQModeScene", scene); + CVarSetInteger(CVAR_GENERAL("BetterDebugWarpScreenMQMode"), WARP_MODE_OVERRIDE_VANILLA_AS_MQ); + CVarSetInteger(CVAR_GENERAL("BetterDebugWarpScreenMQModeScene"), scene); } } } @@ -111,9 +111,9 @@ void Select_Grotto_LoadGame(SelectContext* this, s32 grottoIndex) { } if (this->isBetterWarp) { - CVarSetInteger("gBetterDebugWarpScreenCurrentScene", this->currentScene); - CVarSetInteger("gBetterDebugWarpScreenTopDisplayedScene", this->topDisplayedScene); - CVarSetInteger("gBetterDebugWarpScreenPageDownIndex", this->pageDownIndex); + CVarSetInteger(CVAR_GENERAL("BetterDebugWarpScreenCurrentScene"), this->currentScene); + CVarSetInteger(CVAR_GENERAL("BetterDebugWarpScreenTopDisplayedScene"), this->topDisplayedScene); + CVarSetInteger(CVAR_GENERAL("BetterDebugWarpScreenPageDownIndex"), this->pageDownIndex); CVarSave(); } @@ -1078,7 +1078,7 @@ void Select_PrintMenu(SelectContext* this, GfxPrint* printer) { GfxPrint_SetColor(printer, 200, 200, 55, 255); } - if (CVarGetInteger("gDebugWarpScreenTranslation", 1)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1)) { switch (gSaveContext.language) { case LANGUAGE_ENG: default: @@ -1105,7 +1105,7 @@ void Select_PrintMenu(SelectContext* this, GfxPrint* printer) { GfxPrint_SetColor(printer, 155, 55, 150, 255); // Small position hack of the OPT=X text since german Link's Age overlap if translated - if (CVarGetInteger("gDebugWarpScreenTranslation", 1) && gSaveContext.language == LANGUAGE_GER) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1) && gSaveContext.language == LANGUAGE_GER) { GfxPrint_SetPos(printer, 26, 26); } else { GfxPrint_SetPos(printer, 20, 26); @@ -1134,7 +1134,7 @@ void Better_Select_PrintMenu(SelectContext* this, GfxPrint* printer) { GfxPrint_SetColor(printer, 175, 175, 175, 255); } - if (CVarGetInteger("gDebugWarpScreenTranslation", 1)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1)) { switch (gSaveContext.language) { case LANGUAGE_ENG: default: @@ -1160,7 +1160,7 @@ void Better_Select_PrintMenu(SelectContext* this, GfxPrint* printer) { GfxPrint_SetColor(printer, 205, 100, 200, 255); GfxPrint_SetPos(printer, 3, 26); - if (CVarGetInteger("gDebugWarpScreenTranslation", 1)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1)) { switch (gSaveContext.language) { case LANGUAGE_ENG: default: @@ -1200,7 +1200,7 @@ void Select_PrintLoadingMessage(SelectContext* this, GfxPrint* printer) { GfxPrint_SetPos(printer, 10, 15); GfxPrint_SetColor(printer, 255, 255, 255, 255); randomMsg = Rand_ZeroOne() * ARRAY_COUNT(sLoadingMessages); - if (CVarGetInteger("gDebugWarpScreenTranslation", 1)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1)) { switch (gSaveContext.language) { case LANGUAGE_ENG: default: @@ -1231,7 +1231,7 @@ static BetterSceneSelectAgeLabels sBetterAgeLabels[] = { void Select_PrintAgeSetting(SelectContext* this, GfxPrint* printer, s32 age) { GfxPrint_SetPos(printer, 4, 26); GfxPrint_SetColor(printer, 255, 255, 55, 255); - if (CVarGetInteger("gDebugWarpScreenTranslation", 1)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1)) { switch (gSaveContext.language) { case LANGUAGE_ENG: default: @@ -1252,7 +1252,7 @@ void Select_PrintAgeSetting(SelectContext* this, GfxPrint* printer, s32 age) { void Better_Select_PrintAgeSetting(SelectContext* this, GfxPrint* printer, s32 age) { GfxPrint_SetPos(printer, 25, 25); GfxPrint_SetColor(printer, 100, 100, 100, 255); - if (CVarGetInteger("gDebugWarpScreenTranslation", 1)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1)) { switch (gSaveContext.language) { case LANGUAGE_ENG: case LANGUAGE_FRA: @@ -1268,7 +1268,7 @@ void Better_Select_PrintAgeSetting(SelectContext* this, GfxPrint* printer, s32 a } GfxPrint_SetColor(printer, 55, 200, 50, 255); - if (CVarGetInteger("gDebugWarpScreenTranslation", 1)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1)) { switch (gSaveContext.language) { case LANGUAGE_ENG: default: @@ -1304,7 +1304,7 @@ void Select_PrintCutsceneSetting(SelectContext* this, GfxPrint* printer, u16 csI }; char* label; - int lang = CVarGetInteger("gDebugWarpScreenTranslation", 1) ? gSaveContext.language + 1 : 0; + int lang = CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1) ? gSaveContext.language + 1 : 0; GfxPrint_SetPos(printer, 4, 25); GfxPrint_SetColor(printer, 255, 255, 55, 255); @@ -1367,7 +1367,7 @@ void Better_Select_PrintTimeSetting(SelectContext* this, GfxPrint* printer) { GfxPrint_SetColor(printer, 100, 100, 100, 255); if (gSaveContext.dayTime > 0xC000 || gSaveContext.dayTime < 0x4555) { - if (CVarGetInteger("gDebugWarpScreenTranslation", 1)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1)) { switch (gSaveContext.language) { case LANGUAGE_ENG: default: @@ -1384,7 +1384,7 @@ void Better_Select_PrintTimeSetting(SelectContext* this, GfxPrint* printer) { label = "Night"; } } else { - if (CVarGetInteger("gDebugWarpScreenTranslation", 1)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1)) { switch (gSaveContext.language) { case LANGUAGE_ENG: default: @@ -1401,7 +1401,7 @@ void Better_Select_PrintTimeSetting(SelectContext* this, GfxPrint* printer) { label = "Day"; } } - if (CVarGetInteger("gDebugWarpScreenTranslation", 1)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1)) { switch (gSaveContext.language) { case LANGUAGE_ENG: default: @@ -1436,7 +1436,7 @@ void Better_Select_PrintMQSetting(SelectContext* this, GfxPrint* printer) { GfxPrint_Printf(printer, "MQ:"); } - if (CVarGetInteger("gDebugWarpScreenTranslation", 1)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugWarpScreenTranslation"), 1)) { switch (gSaveContext.language) { case LANGUAGE_ENG: default: @@ -1533,7 +1533,7 @@ void Select_Draw(SelectContext* this) { void Select_Main(GameState* thisx) { SelectContext* this = (SelectContext*)thisx; - if (this->isBetterWarp != CVarGetInteger("gBetterDebugWarpScreen", 0)) { + if (this->isBetterWarp != CVarGetInteger(CVAR_DEVELOPER_TOOLS("BetterDebugWarpScreen"), 0)) { Select_SwitchBetterWarpMode(this, !this->isBetterWarp); } @@ -1564,13 +1564,13 @@ void Select_SwitchBetterWarpMode(SelectContext* this, u8 isBetterWarpMode) { gSaveContext.dayTime = 0x8000; if (isBetterWarpMode) { - s32 currScene = CVarGetInteger("gBetterDebugWarpScreenCurrentScene", 0); + s32 currScene = CVarGetInteger(CVAR_GENERAL("BetterDebugWarpScreenCurrentScene"), 0); this->count = ARRAY_COUNT(sBetterScenes); if (currScene >= 0 && currScene < this->count) { this->currentScene = currScene; - this->topDisplayedScene = CVarGetInteger("gBetterDebugWarpScreenTopDisplayedScene", 0); - this->pageDownIndex = CVarGetInteger("gBetterDebugWarpScreenPageDownIndex", 0); + this->topDisplayedScene = CVarGetInteger(CVAR_GENERAL("BetterDebugWarpScreenTopDisplayedScene"), 0); + this->pageDownIndex = CVarGetInteger(CVAR_GENERAL("BetterDebugWarpScreenPageDownIndex"), 0); BetterSceneSelectEntrancePair entrancePair = this->betterScenes[this->currentScene].entrancePairs[this->pageDownIndex]; if (entrancePair.canBeMQ && ResourceMgr_IsSceneMasterQuest(gEntranceTable[entrancePair.entranceIndex].scene)) { @@ -1637,7 +1637,7 @@ void Select_Init(GameState* thisx) { gSaveContext.nightFlag = 0; gSaveContext.dayTime = 0x8000; - CVarClear("gBetterDebugWarpScreenMQMode"); - CVarClear("gBetterDebugWarpScreenMQModeScene"); - Select_SwitchBetterWarpMode(this, CVarGetInteger("gBetterDebugWarpScreen", 0)); + CVarClear(CVAR_GENERAL("BetterDebugWarpScreenMQMode")); + CVarClear(CVAR_GENERAL("BetterDebugWarpScreenMQModeScene")); + Select_SwitchBetterWarpMode(this, CVarGetInteger(CVAR_DEVELOPER_TOOLS("BetterDebugWarpScreen"), 0)); } diff --git a/soh/src/overlays/gamestates/ovl_title/z_title.c b/soh/src/overlays/gamestates/ovl_title/z_title.c index d123e7e90..51d0ac62b 100644 --- a/soh/src/overlays/gamestates/ovl_title/z_title.c +++ b/soh/src/overlays/gamestates/ovl_title/z_title.c @@ -167,7 +167,7 @@ void Title_Draw(TitleContext* this) { Matrix_RotateZYX(0, sTitleRotY, 0, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, MATRIX_NEWMTX(this->state.gfxCtx), G_MTX_LOAD); - if (CVarGetInteger("gAuthenticLogo", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("AuthenticLogo"), 0)) { gSPDisplayList(POLY_OPA_DISP++, gNintendo64LogoDL); } else { gSPDisplayList(POLY_OPA_DISP++, gShipLogoDL); @@ -178,8 +178,8 @@ void Title_Draw(TitleContext* this) { gDPSetRenderMode(POLY_OPA_DISP++, G_RM_XLU_SURF2, G_RM_OPA_CI | CVG_DST_WRAP); gDPSetCombineLERP(POLY_OPA_DISP++, TEXEL1, PRIMITIVE, ENV_ALPHA, TEXEL0, 0, 0, 0, TEXEL0, PRIMITIVE, ENVIRONMENT, COMBINED, ENVIRONMENT, COMBINED, 0, PRIMITIVE, 0); - if (CVarGetInteger("gCosmetics.Title_NintendoLogo.Changed", 0)) { - Color_RGB8 nintendoLogoColor = CVarGetColor24("gCosmetics.Title_NintendoLogo.Value", (Color_RGB8){0, 0, 255}); + if (CVarGetInteger(CVAR_COSMETIC("Title.NintendoLogo.Changed"), 0)) { + Color_RGB8 nintendoLogoColor = CVarGetColor24(CVAR_COSMETIC("Title.NintendoLogo.Value"), (Color_RGB8){0, 0, 255}); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 255, 255, 255); gDPSetEnvColor(POLY_OPA_DISP++, nintendoLogoColor.r, nintendoLogoColor.g, nintendoLogoColor.b, 128); } else { @@ -192,7 +192,7 @@ void Title_Draw(TitleContext* this) { for (idx = 0, y = 94; idx < 16; idx++, y += 2) { - gDPLoadMultiTile(POLY_OPA_DISP++, CVarGetInteger("gAuthenticLogo", 0) ? nintendo_rogo_static_Tex_000000 : nintendo_rogo_static_Tex_LUS_000000, 0, G_TX_RENDERTILE, G_IM_FMT_I, G_IM_SIZ_8b, 192, 32, + gDPLoadMultiTile(POLY_OPA_DISP++, CVarGetInteger(CVAR_ENHANCEMENT("AuthenticLogo"), 0) ? nintendo_rogo_static_Tex_000000 : nintendo_rogo_static_Tex_LUS_000000, 0, G_TX_RENDERTILE, G_IM_FMT_I, G_IM_SIZ_8b, 192, 32, 0, idx * 2, 192 - 1, (idx + 1) * 2 - 1, 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); @@ -204,7 +204,7 @@ void Title_Draw(TitleContext* this) { } // Draw ice cube around N64 logo. - if (CVarGetInteger("gLetItSnow", 0)) { + if (CVarGetInteger(CVAR_GENERAL("LetItSnow"), 0)) { f32 scale = 0.4f; gSPSegment(POLY_OPA_DISP++, 0x08, @@ -221,7 +221,7 @@ void Title_Draw(TitleContext* this) { Environment_FillScreen(this->state.gfxCtx, 0, 0, 0, (s16)this->coverAlpha, FILL_SCREEN_XLU); - sTitleRotY += (300 * CVarGetFloat("gCosmetics.N64Logo_SpinSpeed", 1.0f)); + sTitleRotY += (300 * CVarGetFloat(CVAR_COSMETIC("N64Logo.SpinSpeed"), 1.0f)); CLOSE_DISPS(this->state.gfxCtx); } @@ -237,7 +237,7 @@ void Title_Main(GameState* thisx) { Title_Calc(this); Title_Draw(this); - if (!CVarGetInteger("gAuthenticLogo", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("AuthenticLogo"), 0)) { Gfx* gfx = POLY_OPA_DISP; s32 pad; @@ -245,13 +245,13 @@ void Title_Main(GameState* thisx) { POLY_OPA_DISP = gfx; } - if (this->exit || CVarGetInteger("gSkipLogoTitle", 0)) { + if (this->exit || CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), 0)) { gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = 0xFF; gSaveContext.gameMode = 1; this->state.running = false; - if (gLoadFileSelect || CVarGetInteger("gSkipLogoTitle", 0)) + if (gLoadFileSelect || CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkipLogoTitle"), 0)) SET_NEXT_GAMESTATE(&this->state, FileChoose_Init, FileChooseContext); else SET_NEXT_GAMESTATE(&this->state, Opening_Init, OpeningContext); 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 78b5ee32f..c81a89c4e 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 @@ -7,9 +7,9 @@ extern const char* digitTextures[]; void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { Color_RGB8 aButtonColor = { 80, 150, 255 }; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + aButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), aButtonColor); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = (Color_RGB8){ 80, 255, 150 }; } if (IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_A)) { @@ -17,36 +17,36 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { } Color_RGB8 cButtonsColor = {255, 255, 50}; - if (CVarGetInteger("gCosmetics.Hud_CButtons.Changed", 0)) { - cButtonsColor = CVarGetColor24("gCosmetics.Hud_CButtons.Value", cButtonsColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CButtons.Changed"), 0)) { + cButtonsColor = CVarGetColor24(CVAR_COSMETIC("HUD.CButtons.Value"), cButtonsColor); } Color_RGB8 cUpButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CUpButton.Changed", 0)) { - cUpButtonColor = CVarGetColor24("gCosmetics.Hud_CUpButton.Value", cUpButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.Changed"), 0)) { + cUpButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CUpButton.Value"), cUpButtonColor); } if (IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_UP)) { cUpButtonColor = (Color_RGB8){ 191, 191, 191 }; } Color_RGB8 cDownButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CDownButton.Changed", 0)) { - cDownButtonColor = CVarGetColor24("gCosmetics.Hud_CDownButton.Value", cDownButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.Changed"), 0)) { + cDownButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CDownButton.Value"), cDownButtonColor); } if (IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_DOWN)) { cDownButtonColor = (Color_RGB8){ 191, 191, 191 }; } Color_RGB8 cLeftButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CLeftButton.Changed", 0)) { - cLeftButtonColor = CVarGetColor24("gCosmetics.Hud_CLeftButton.Value", cLeftButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.Changed"), 0)) { + cLeftButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CLeftButton.Value"), cLeftButtonColor); } if (IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_LEFT)) { cLeftButtonColor = (Color_RGB8){ 191, 191, 191 }; } Color_RGB8 cRightButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CRightButton.Changed", 0)) { - cRightButtonColor = CVarGetColor24("gCosmetics.Hud_CRightButton.Value", cRightButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.Changed"), 0)) { + cRightButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CRightButton.Value"), cRightButtonColor); } if (IS_RANDO && !Flags_GetRandomizerInf(RAND_INF_HAS_OCARINA_C_RIGHT)) { cRightButtonColor = (Color_RGB8){ 191, 191, 191 }; @@ -121,7 +121,7 @@ void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx) { s16 pad2; s16 phi_s0_2; s16 sp208[3]; - bool dpad = CVarGetInteger("gDpadPause", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0); OPEN_DISPS(gfxCtx); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c index 3aa4a25d6..d2050bc80 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_debug.c @@ -641,7 +641,7 @@ void KaleidoScope_DrawDebugEditor(PlayState* play) { // Handles exiting the inventory editor with the L button // The editor is opened with `debugState` set to 1, and becomes closable after a frame once `debugState` is set to 2 s16 Debug_BTN = BTN_L; - if (CVarGetInteger("gNGCKaleidoSwitcher", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NGCKaleidoSwitcher"), 0) != 0) { Debug_BTN = BTN_Z; } if (pauseCtx->debugState == 1) { diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index cf4344027..99ba5df72 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -108,9 +108,9 @@ void KaleidoScope_DrawAButton(PlayState* play, Vtx* vtx, int16_t xTranslate, int Matrix_Translate(xTranslate, yTranslate, 0, MTXMODE_APPLY); gSPMatrix(POLY_KAL_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); Color_RGB8 aButtonColor = { 0, 100, 255 }; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + aButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), aButtonColor); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = (Color_RGB8){ 0, 255, 100 }; } @@ -132,10 +132,10 @@ void KaleidoScope_DrawPlayerWork(PlayState* play) { //Vec3s rot; // Removed for not having it use din the function f32 scale; Input* input = &play->state.input[0]; - s16 RotationSpeed = 150 * CVarGetInteger("gPauseLiveLinkRotationSpeed", 0); - u8 AllowStickRotation = (CVarGetInteger("gPauseLiveLinkRotation", 0) == 3) ? true : false; - u8 AllowCRotation = (CVarGetInteger("gPauseLiveLinkRotation", 0) == 2) ? true : false; - u8 AllowDPadRotation = (CVarGetInteger("gPauseLiveLinkRotation", 0) == 1) ? true : false; + s16 RotationSpeed = 150 * CVarGetInteger(CVAR_ENHANCEMENT("PauseLiveLinkRotationSpeed"), 0); + u8 AllowStickRotation = (CVarGetInteger(CVAR_ENHANCEMENT("PauseLiveLinkRotation"), 0) == 3) ? true : false; + u8 AllowCRotation = (CVarGetInteger(CVAR_ENHANCEMENT("PauseLiveLinkRotation"), 0) == 2) ? true : false; + u8 AllowDPadRotation = (CVarGetInteger(CVAR_ENHANCEMENT("PauseLiveLinkRotation"), 0) == 1) ? true : false; if (LINK_AGE_IN_YEARS == YEARS_CHILD) { @@ -143,7 +143,7 @@ void KaleidoScope_DrawPlayerWork(PlayState* play) { pos.y = -130.0f; pos.z = -150.0f; scale = 0.046f; - } else if (CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) != EQUIP_VALUE_SWORD_MASTER && !CVarGetInteger("gPauseTriforce", 0)) { + } else if (CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) != EQUIP_VALUE_SWORD_MASTER && !CVarGetInteger(CVAR_GENERAL("PauseTriforce"), 0)) { pos.x = 25.0f; pos.y = -228.0f; pos.z = 60.0f; @@ -213,9 +213,9 @@ void KaleidoScope_DrawEquipment(PlayState* play) { s16 cursorX; s16 cursorY; s16 oldCursorPoint; - bool dpad = (CVarGetInteger("gDpadPause", 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP)); - bool pauseAnyCursor = (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || - (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); + bool dpad = (CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP)); + bool pauseAnyCursor = (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || + (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); OPEN_DISPS(play->state.gfxCtx); @@ -542,8 +542,8 @@ void KaleidoScope_DrawEquipment(PlayState* play) { // Allow Toggling of Strength when Pressing A on Strength Upgrade Slot if ((pauseCtx->cursorSpecialPos == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0) && CHECK_BTN_ALL(input->press.button, BTN_A) && - (pauseCtx->cursorX[PAUSE_EQUIP] == 0) && (pauseCtx->cursorY[PAUSE_EQUIP] == 2) && CVarGetInteger("gToggleStrength", 0)) { - CVarSetInteger("gStrengthDisabled", !CVarGetInteger("gStrengthDisabled", 0)); + (pauseCtx->cursorX[PAUSE_EQUIP] == 0) && (pauseCtx->cursorY[PAUSE_EQUIP] == 2) && CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0)) { + CVarSetInteger(CVAR_ENHANCEMENT("StrengthDisabled"), !CVarGetInteger(CVAR_ENHANCEMENT("StrengthDisabled"), 0)); // Equip success sound Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); // Wait 10 frames before accepting input again @@ -552,7 +552,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { } u16 buttonsToCheck = BTN_A | BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT; - if (CVarGetInteger("gDpadEquips", 0) && (!CVarGetInteger("gDpadPause", 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) && (!CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } @@ -569,10 +569,10 @@ void KaleidoScope_DrawEquipment(PlayState* play) { // Only BGS/Giant's Knife is affected, and it will revert to Master Sword. // If we have the feature toggled on - if (CVarGetInteger("gEquipmentCanBeRemoved", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("EquipmentCanBeRemoved"), 0)) { - if (CVarGetInteger("gEnhancements.SwordToggle", SWORD_TOGGLE_NONE) == SWORD_TOGGLE_BOTH_AGES || - (CVarGetInteger("gEnhancements.SwordToggle", SWORD_TOGGLE_NONE) == SWORD_TOGGLE_CHILD) && LINK_IS_CHILD) { + if (CVarGetInteger(CVAR_ENHANCEMENT("SwordToggle"), SWORD_TOGGLE_NONE) == SWORD_TOGGLE_BOTH_AGES || + (CVarGetInteger(CVAR_ENHANCEMENT("SwordToggle"), SWORD_TOGGLE_NONE) == SWORD_TOGGLE_CHILD) && LINK_IS_CHILD) { // If we're on the "swords" section of the equipment screen AND we're on a currently-equipped sword if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD)) { Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_NONE); @@ -640,7 +640,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); pauseCtx->unk_1E4 = 7; sEquipTimer = 10; - } else if (CVarGetInteger("gAssignableTunicsAndBoots", 0) != 0) { + } else if (CVarGetInteger(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 0) != 0) { // Only allow assigning tunic and boots to c-buttons if (pauseCtx->cursorY[PAUSE_EQUIP] > 1) { if (CHECK_OWNED_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP] - 1)) { @@ -680,7 +680,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { EQUIP_FAIL: if (CHECK_BTN_ALL(input->press.button, BTN_A)) { Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); - } else if ((CVarGetInteger("gAssignableTunicsAndBoots", 0) != 0) && (pauseCtx->cursorY[PAUSE_EQUIP] > 1)) { + } else if ((CVarGetInteger(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 0) != 0) && (pauseCtx->cursorY[PAUSE_EQUIP] > 1)) { Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } } @@ -704,8 +704,8 @@ void KaleidoScope_DrawEquipment(PlayState* play) { // Do not Grey Out Strength Upgrade Name when Enabled // This needs to be outside the previous block since otherwise the nameColorSet is cleared to 0 by other menu pages when toggling if ((pauseCtx->pageIndex == PAUSE_EQUIP) && (pauseCtx->cursorX[PAUSE_EQUIP] == 0) && - (pauseCtx->cursorY[PAUSE_EQUIP] == 2) && CVarGetInteger("gToggleStrength", 0)) { - if (CVarGetInteger("gStrengthDisabled", 0)) { + (pauseCtx->cursorY[PAUSE_EQUIP] == 2) && CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("StrengthDisabled"), 0)) { pauseCtx->nameColorSet = 1; } else { pauseCtx->nameColorSet = 0; @@ -735,7 +735,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { // Add zoom effect to strength item if cursor is hovering over it when toggle option is on if ((pauseCtx->cursorX[PAUSE_EQUIP] == 0) && (pauseCtx->cursorY[PAUSE_EQUIP] == 2) && - CVarGetInteger("gToggleStrength", 0) && pauseCtx->cursorSpecialPos == 0) { + CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0) && pauseCtx->cursorSpecialPos == 0) { u8 row = 2; u8 column = 0; u8 equipVtxIndex = 16 * row + 4 * column; @@ -756,7 +756,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { for (rowStart = 0, j = 0, temp = 0, i = 0; i < 4; i++, rowStart += 4, j += 16) { gSPVertex(POLY_KAL_DISP++, &pauseCtx->equipVtx[j], 16, 0); - bool drawGreyItems = !CVarGetInteger("gTimelessEquipment", 0); + bool drawGreyItems = !CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0); if (LINK_AGE_IN_YEARS == YEARS_CHILD) { point = CUR_UPG_VALUE(sChildUpgrades[i]); if ((point != 0) && (CUR_UPG_VALUE(sChildUpgrades[i]) != 0)) { @@ -765,7 +765,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { if ((drawGreyItems && ((sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1) == ITEM_GAUNTLETS_SILVER || (sChildUpgradeItemBases[i] + CUR_UPG_VALUE(sChildUpgrades[i]) - 1) == ITEM_GAUNTLETS_GOLD)) || - (CVarGetInteger("gToggleStrength", 0) && CVarGetInteger("gStrengthDisabled", 0) && sChildUpgrades[i] == UPG_STRENGTH)) { + (CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("StrengthDisabled"), 0) && sChildUpgrades[i] == UPG_STRENGTH)) { gDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gSPGrayscale(POLY_KAL_DISP++, true); } @@ -785,8 +785,8 @@ void KaleidoScope_DrawEquipment(PlayState* play) { // Grey Out Strength Upgrades when Disabled and the Toggle Strength Option is on if ((drawGreyItems && (((sAdultUpgradeItemBases[i] + CUR_UPG_VALUE(sAdultUpgrades[i]) - 1) == ITEM_BRACELET && - !(IS_RANDO) && !CVarGetInteger("gToggleStrength", 0)))) || - (CVarGetInteger("gToggleStrength", 0) && CVarGetInteger("gStrengthDisabled", 0) && sAdultUpgrades[i] == UPG_STRENGTH)) { + !(IS_RANDO) && !CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0)))) || + (CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0) && CVarGetInteger(CVAR_ENHANCEMENT("StrengthDisabled"), 0) && sAdultUpgrades[i] == UPG_STRENGTH)) { gDPSetGrayscaleColor(POLY_KAL_DISP++, 109, 109, 109, 255); gSPGrayscale(POLY_KAL_DISP++, true); } @@ -816,7 +816,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) { // Render A button indicator when hovered over strength if ((pauseCtx->cursorX[PAUSE_EQUIP] == 0) && (pauseCtx->cursorY[PAUSE_EQUIP] == 2) && - CVarGetInteger("gToggleStrength", 0) && pauseCtx->cursorSpecialPos == 0 + CVarGetInteger(CVAR_ENHANCEMENT("ToggleStrength"), 0) && pauseCtx->cursorSpecialPos == 0 && pauseCtx->unk_1E4 == 0 && pauseCtx->state == 6) { u8 row = 2; u8 column = 0; diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index 12d7cb4dd..6cc02aa03 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -70,7 +70,7 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, gDPPipeSync(POLY_KAL_DISP++); if (i != 0) { - gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[((CVarGetInteger("gEnhancements.BetterAmmoRendering", 0) ? sAllAmmoVtxOffset[slot] : sAmmoVtxOffset[slot]) + 31) * 4], 4, 0); + gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[((CVarGetInteger(CVAR_ENHANCEMENT("BetterAmmoRendering"), 0) ? sAllAmmoVtxOffset[slot] : sAmmoVtxOffset[slot]) + 31) * 4], 4, 0); gDPLoadTextureBlock(POLY_KAL_DISP++, ((u8*)_gAmmoDigit0Tex[i]), G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, @@ -79,7 +79,7 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, gSP1Quadrangle(POLY_KAL_DISP++, 0, 2, 3, 1, 0); } - gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[((CVarGetInteger("gEnhancements.BetterAmmoRendering", 0) ? sAllAmmoVtxOffset[slot] : sAmmoVtxOffset[slot]) + 32) * 4], 4, 0); + gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[((CVarGetInteger(CVAR_ENHANCEMENT("BetterAmmoRendering"), 0) ? sAllAmmoVtxOffset[slot] : sAmmoVtxOffset[slot]) + 32) * 4], 4, 0); gDPLoadTextureBlock(POLY_KAL_DISP++, ((u8*)_gAmmoDigit0Tex[ammo]), G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, @@ -193,9 +193,9 @@ void KaleidoScope_DrawItemCycleExtras(PlayState* play, u8 slot, u8 canCycle, u8 if (!isCycling && sSlotCycleActiveAnimTimer[slot] == 0 && pauseCtx->cursorSlot[PAUSE_ITEM] == slot && pauseCtx->cursorSpecialPos == 0) { Color_RGB8 aButtonColor = { 0, 100, 255 }; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + aButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), aButtonColor); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = (Color_RGB8){ 0, 255, 100 }; } @@ -252,7 +252,7 @@ void KaleidoScope_DrawItemCycleExtras(PlayState* play, u8 slot, u8 canCycle, u8 void KaleidoScope_HandleItemCycleExtras(PlayState* play, u8 slot, bool canCycle, u8 leftItem, u8 rightItem, bool replaceCButtons) { Input* input = &play->state.input[0]; PauseContext* pauseCtx = &play->pauseCtx; - bool dpad = (CVarGetInteger("gDpadPause", 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP)); + bool dpad = (CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP)); u8 slotItem = gSaveContext.inventory.items[slot]; u8 hasLeftItem = leftItem != ITEM_NONE && slotItem != leftItem; u8 hasRightItem = rightItem != ITEM_NONE && slotItem != rightItem && leftItem != rightItem; @@ -313,7 +313,7 @@ bool CanMaskSelect() { // * zelda's letter check: Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER) // * kak gate check: Flags_GetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD) // and the mask quest is complete: Flags_GetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE) - return CVarGetInteger("gMaskSelect", 0) && + return CVarGetInteger(CVAR_ENHANCEMENT("MaskSelect"), 0) && Flags_GetEventChkInf(EVENTCHKINF_PAID_BACK_BUNNY_HOOD_FEE) && Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_ZELDAS_LETTER) && Flags_GetInfTable(INFTABLE_SHOWED_ZELDAS_LETTER_TO_GATE_GUARD); @@ -339,8 +339,8 @@ void KaleidoScope_HandleItemCycles(PlayState* play) { //to allow adult link to wear it if the setting is enabled gSlotAgeReqs[SLOT_TRADE_CHILD] = ( - ((CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) && CVarGetInteger("gAdultBunnyHood", 0)) || - CVarGetInteger("gTimelessEquipment", 0) + ((CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) && CVarGetInteger(CVAR_ENHANCEMENT("AdultBunnyHood"), 0)) || + CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0) ) && INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY ? AGE_REQ_NONE @@ -348,8 +348,8 @@ void KaleidoScope_HandleItemCycles(PlayState* play) { //also update the age requirement for the bunny hood itself gItemAgeReqs[ITEM_MASK_BUNNY] = - ((CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) && CVarGetInteger("gAdultBunnyHood", 0)) || - CVarGetInteger("gTimelessEquipment", 0) + ((CVarGetInteger(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) && CVarGetInteger(CVAR_ENHANCEMENT("AdultBunnyHood"), 0)) || + CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0) ? AGE_REQ_NONE : AGE_REQ_CHILD; @@ -414,9 +414,9 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { s16 cursorY; s16 oldCursorPoint; s16 moveCursorResult; - bool dpad = (CVarGetInteger("gDpadPause", 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP)); - bool pauseAnyCursor = pauseCtx->cursorSpecialPos == 0 && ((CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || - (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_ALWAYS_ON)); + bool dpad = (CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) && !CHECK_BTN_ALL(input->cur.button, BTN_CUP)); + bool pauseAnyCursor = pauseCtx->cursorSpecialPos == 0 && ((CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || + (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON)); OPEN_DISPS(play->state.gfxCtx); @@ -669,7 +669,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { if ((pauseCtx->debugState == 0) && (pauseCtx->state == 6) && (pauseCtx->unk_1E4 == 0)) { KaleidoScope_HandleItemCycles(play); u16 buttonsToCheck = BTN_CLEFT | BTN_CDOWN | BTN_CRIGHT; - if (CVarGetInteger("gDpadEquips", 0) && (!CVarGetInteger("gDpadPause", 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) { + if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0) && (!CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0) || CHECK_BTN_ALL(input->cur.button, BTN_CUP))) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } if (CHECK_BTN_ANY(input->press.button, buttonsToCheck)) { @@ -779,7 +779,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { gDPSetCombineLERP(POLY_KAL_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - u8 gBetterAmmoRendering = CVarGetInteger("gEnhancements.BetterAmmoRendering", 0); + u8 gBetterAmmoRendering = CVarGetInteger(CVAR_ENHANCEMENT("BetterAmmoRendering"), 0); for (i = 0; i < (gBetterAmmoRendering ? 24 : 15); i++) { if ((gBetterAmmoRendering ? ItemInSlotUsesAmmo(i) : gAmmoItems[i] != ITEM_NONE) && (gSaveContext.inventory.items[i] != ITEM_NONE)) { @@ -803,7 +803,7 @@ void KaleidoScope_SetupItemEquip(PlayState* play, u16 item, u16 slot, s16 animX, pauseCtx->equipTargetCBtn = 1; } else if (CHECK_BTN_ALL(input->press.button, BTN_CRIGHT)) { pauseCtx->equipTargetCBtn = 2; - } else if (CVarGetInteger("gDpadEquips", 0)) { + } else if (CVarGetInteger(CVAR_SETTING("DpadEquips"), 0)) { if (CHECK_BTN_ALL(input->press.button, BTN_DUP)) { pauseCtx->equipTargetCBtn = 3; } else if (CHECK_BTN_ALL(input->press.button, BTN_DDOWN)) { @@ -826,7 +826,7 @@ void KaleidoScope_SetupItemEquip(PlayState* play, u16 item, u16 slot, s16 animX, sEquipMoveTimer = 10; if ((pauseCtx->equipTargetItem == ITEM_ARROW_FIRE) || (pauseCtx->equipTargetItem == ITEM_ARROW_ICE) || (pauseCtx->equipTargetItem == ITEM_ARROW_LIGHT)) { - if (CVarGetInteger("gSkipArrowAnimation", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("SkipArrowAnimation"), 0)) { Audio_PlaySoundGeneral(NA_SE_SY_DECIDE, &D_801333D4, 4, &D_801333E0, &D_801333E0, &D_801333E8); } else { u16 index = 0; @@ -858,10 +858,10 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { u16 offsetX; u16 offsetY; - s16 Top_HUD_Margin = CVarGetInteger("gHUDMargin_T", 0); - s16 Left_HUD_Margin = CVarGetInteger("gHUDMargin_L", 0); - s16 Right_HUD_Margin = CVarGetInteger("gHUDMargin_R", 0); - s16 Bottom_HUD_Margin = CVarGetInteger("gHUDMargin_B", 0); + s16 Top_HUD_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.T"), 0); + s16 Left_HUD_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.L"), 0); + s16 Right_HUD_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.R"), 0); + s16 Bottom_HUD_Margin = CVarGetInteger(CVAR_COSMETIC("HUD.Margin.B"), 0); s16 X_Margins_CL; s16 X_Margins_CR; @@ -873,36 +873,36 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { s16 Y_Margins_BtnB; s16 X_Margins_DPad_Items; s16 Y_Margins_DPad_Items; - if (CVarGetInteger("gBBtnUseMargins", 0) != 0) { - if (CVarGetInteger("gBBtnPosType", 0) == 0) {X_Margins_BtnB = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.BButton.PosType"), 0) == 0) {X_Margins_BtnB = Right_HUD_Margin;}; Y_Margins_BtnB = (Top_HUD_Margin*-1); } else { X_Margins_BtnB = 0; Y_Margins_BtnB = 0; } - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnLPosType", 0) == 0) {X_Margins_CL = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 0) {X_Margins_CL = Right_HUD_Margin;}; Y_Margins_CL = (Top_HUD_Margin*-1); } else { X_Margins_CL = 0; Y_Margins_CL = 0; } - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnRPosType", 0) == 0) {X_Margins_CR = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 0) {X_Margins_CR = Right_HUD_Margin;}; Y_Margins_CR = (Top_HUD_Margin*-1); } else { X_Margins_CR = 0; Y_Margins_CR = 0; } - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) { - if (CVarGetInteger("gCBtnDPosType", 0) == 0) {X_Margins_CD = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 0) {X_Margins_CD = Right_HUD_Margin;}; Y_Margins_CD = (Top_HUD_Margin*-1); } else { X_Margins_CD = 0; Y_Margins_CD = 0; } - if (CVarGetInteger("gDPadUseMargins", 0) != 0) { - if (CVarGetInteger("gDPadPosType", 0) == 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; Y_Margins_DPad_Items = (Top_HUD_Margin*-1); } else { X_Margins_DPad_Items = 0; @@ -925,28 +925,28 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { }; //(X,Y) Used with custom position to place it properly. //DPadItems - if (CVarGetInteger("gDPadPosType", 0) != 0) { - sCButtonPosY[3] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[0][1];//Up - sCButtonPosY[4] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[1][1];//Down - sCButtonPosY[5] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[2][1];//Left - sCButtonPosY[6] = CVarGetInteger("gDPadPosY", 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[3][1];//Right - if (CVarGetInteger("gDPadPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gDPadUseMargins", 0) != 0) {X_Margins_DPad_Items = Left_HUD_Margin;}; - sCButtonPosX[3] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); - sCButtonPosX[4] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); - sCButtonPosX[5] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); - sCButtonPosX[6] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); - } else if (CVarGetInteger("gDPadPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gDPadUseMargins", 0) != 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; - sCButtonPosX[3] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); - sCButtonPosX[4] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); - sCButtonPosX[5] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); - sCButtonPosX[6] = OTRGetDimensionFromRightEdge(CVarGetInteger("gDPadPosX", 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); - } else if (CVarGetInteger("gDPadPosType", 0) == 3) {//Anchor None - sCButtonPosX[3] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[0][0]; - sCButtonPosX[4] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[1][0]; - sCButtonPosX[5] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[2][0]; - sCButtonPosX[6] = CVarGetInteger("gDPadPosX", 0)+DPad_ItemsOffset[3][0]; + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) != 0) { + sCButtonPosY[3] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[0][1];//Up + sCButtonPosY[4] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[1][1];//Down + sCButtonPosY[5] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[2][1];//Left + sCButtonPosY[6] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosY"), 0)+Y_Margins_DPad_Items+DPad_ItemsOffset[3][1];//Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) {X_Margins_DPad_Items = Left_HUD_Margin;}; + sCButtonPosX[3] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); + sCButtonPosX[4] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); + sCButtonPosX[5] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); + sCButtonPosX[6] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.UseMargins"), 0) != 0) {X_Margins_DPad_Items = Right_HUD_Margin;}; + sCButtonPosX[3] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[0][0]); + sCButtonPosX[4] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[1][0]); + sCButtonPosX[5] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[2][0]); + sCButtonPosX[6] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+X_Margins_DPad_Items+DPad_ItemsOffset[3][0]); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosType"), 0) == 3) {//Anchor None + sCButtonPosX[3] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[0][0]; + sCButtonPosX[4] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[1][0]; + sCButtonPosX[5] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[2][0]; + sCButtonPosX[6] = CVarGetInteger(CVAR_COSMETIC("HUD.Dpad.PosX"), 0)+DPad_ItemsOffset[3][0]; } } else { sCButtonPosX[3] = OTRGetDimensionFromRightEdge(ItemIconPos_ori[3][0]); @@ -959,48 +959,48 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { sCButtonPosY[6] = ItemIconPos_ori[6][1]; } //C button Left - if (CVarGetInteger("gCBtnLPosType", 0) != 0) { - sCButtonPosY[0] = CVarGetInteger("gCBtnLPosY", 0)+Y_Margins_CL; - if (CVarGetInteger("gCBtnLPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Left_HUD_Margin;}; - sCButtonPosX[0] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnLPosX", 0)+X_Margins_CL); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnLUseMargins", 0) != 0) {X_Margins_CL = Right_HUD_Margin;}; - sCButtonPosX[0] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnLPosX", 0)+X_Margins_CL); - } else if (CVarGetInteger("gCBtnLPosType", 0) == 3) {//Anchor None - sCButtonPosX[0] = CVarGetInteger("gCBtnLPosX", 0); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) != 0) { + sCButtonPosY[0] = CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosY"), 0)+Y_Margins_CL; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) {X_Margins_CL = Left_HUD_Margin;}; + sCButtonPosX[0] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0)+X_Margins_CL); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.UseMargins"), 0) != 0) {X_Margins_CL = Right_HUD_Margin;}; + sCButtonPosX[0] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0)+X_Margins_CL); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosType"), 0) == 3) {//Anchor None + sCButtonPosX[0] = CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.PosX"), 0); } } else { sCButtonPosX[0] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[0][0]); sCButtonPosY[0] = ItemIconPos_ori[0][1]; } //C Button down - if (CVarGetInteger("gCBtnDPosType", 0) != 0) { - sCButtonPosY[1] = CVarGetInteger("gCBtnDPosY", 0)+Y_Margins_CD; - if (CVarGetInteger("gCBtnDPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; - sCButtonPosX[1] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnDPosX", 0)+X_Margins_CD); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnDUseMargins", 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; - sCButtonPosX[1] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnDPosX", 0)+X_Margins_CD); - } else if (CVarGetInteger("gCBtnDPosType", 0) == 3) {//Anchor None - sCButtonPosX[1] = CVarGetInteger("gCBtnDPosX", 0); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) != 0) { + sCButtonPosY[1] = CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosY"), 0)+Y_Margins_CD; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) {X_Margins_CD = Left_HUD_Margin;}; + sCButtonPosX[1] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0)+X_Margins_CD); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) {X_Margins_CD = Right_HUD_Margin;}; + sCButtonPosX[1] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0)+X_Margins_CD); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosType"), 0) == 3) {//Anchor None + sCButtonPosX[1] = CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0); } } else { sCButtonPosX[1] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[1][0]); sCButtonPosY[1] = ItemIconPos_ori[1][1]; } //C button Right - if (CVarGetInteger("gCBtnRPosType", 0) != 0) { - sCButtonPosY[2] = CVarGetInteger("gCBtnRPosY", 0)+Y_Margins_CR; - if (CVarGetInteger("gCBtnRPosType", 0) == 1) {//Anchor Left - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Left_HUD_Margin;}; - sCButtonPosX[2] = OTRGetDimensionFromLeftEdge(CVarGetInteger("gCBtnRPosX", 0)+X_Margins_CR); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 2) {//Anchor Right - if (CVarGetInteger("gCBtnRUseMargins", 0) != 0) {X_Margins_CR = Right_HUD_Margin;}; - sCButtonPosX[2] = OTRGetDimensionFromRightEdge(CVarGetInteger("gCBtnRPosX", 0)+X_Margins_CR); - } else if (CVarGetInteger("gCBtnRPosType", 0) == 3) {//Anchor None - sCButtonPosX[2] = CVarGetInteger("gCBtnRPosX", 0); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) != 0) { + sCButtonPosY[2] = CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosY"), 0)+Y_Margins_CR; + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 1) {//Anchor Left + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) {X_Margins_CR = Left_HUD_Margin;}; + sCButtonPosX[2] = OTRGetDimensionFromLeftEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0)+X_Margins_CR); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 2) {//Anchor Right + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.UseMargins"), 0) != 0) {X_Margins_CR = Right_HUD_Margin;}; + sCButtonPosX[2] = OTRGetDimensionFromRightEdge(CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0)+X_Margins_CR); + } else if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosType"), 0) == 3) {//Anchor None + sCButtonPosX[2] = CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.PosX"), 0); } } else { sCButtonPosX[2] = OTRGetRectDimensionFromRightEdge(ItemIconPos_ori[2][0]); @@ -1037,7 +1037,7 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { if (D_8082A488 == 0) { pauseCtx->equipTargetItem -= 0xBF - ITEM_BOW_ARROW_FIRE; - if (!CVarGetInteger("gSeparateArrows", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("SeparateArrows"), 0)) { pauseCtx->equipTargetSlot = SLOT_BOW; } sEquipMoveTimer = 6; @@ -1123,7 +1123,7 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { pauseCtx->equipTargetItem = ITEM_BOW_ARROW_LIGHT; break; } - if (!CVarGetInteger("gSeparateArrows", 0)) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("SeparateArrows"), 0)) { pauseCtx->equipTargetSlot = SLOT_BOW; } } @@ -1156,7 +1156,7 @@ void KaleidoScope_UpdateItemEquip(PlayState* play) { if (pauseCtx->equipTargetItem == ITEM_BOW) { if (gSaveContext.equips.buttonItems[otherButtonIndex] >= ITEM_BOW_ARROW_FIRE && gSaveContext.equips.buttonItems[otherButtonIndex] <= ITEM_BOW_ARROW_LIGHT && - !CVarGetInteger("gSeparateArrows", 0)) { + !CVarGetInteger(CVAR_ENHANCEMENT("SeparateArrows"), 0)) { gSaveContext.equips.buttonItems[otherButtonIndex] = gSaveContext.equips.buttonItems[targetButtonIndex]; gSaveContext.equips.cButtonSlots[otherSlotIndex] = gSaveContext.equips.cButtonSlots[pauseCtx->equipTargetCBtn]; Interface_LoadItemIcon2(play, otherButtonIndex); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c index dc574532c..8aba85040 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_map_PAL.c @@ -54,7 +54,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) { s16 stepG; s16 stepB; u16 rgba16; - bool dpad = CVarGetInteger("gDpadPause", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0); OPEN_DISPS(gfxCtx); @@ -347,7 +347,7 @@ void KaleidoScope_DrawDungeonMap(PlayState* play, GraphicsContext* gfxCtx) { gDPLoadTLUT_pal16(POLY_KAL_DISP++, 0, interfaceCtx->mapPalettesPulse[palettePulseIdx]); gDPSetTextureLUT(POLY_KAL_DISP++, G_TT_RGBA16); - u8 mirroredWorld = CVarGetInteger("gMirroredWorld", 0); + u8 mirroredWorld = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0); u8 mirrorMode = mirroredWorld ? G_TX_MIRROR : G_TX_NOMIRROR; // Offset the U value of each vertex to be in the mirror boundary for the map textures if (mirroredWorld) { @@ -443,8 +443,8 @@ void KaleidoScope_DrawWorldMap(PlayState* play, GraphicsContext* gfxCtx) { s16 stepR; s16 stepG; s16 stepB; - bool dpad = CVarGetInteger("gDpadPause", 0); - u8 mirroredWorld = CVarGetInteger("gMirroredWorld", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0); + u8 mirroredWorld = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0); u8 mirrorMode = mirroredWorld ? G_TX_MIRROR : G_TX_NOMIRROR; OPEN_DISPS(gfxCtx); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c index 0807b8356..80ab3da9e 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_prompt.c @@ -7,7 +7,7 @@ void KaleidoScope_UpdatePrompt(PlayState* play) { Input* input = &play->state.input[0]; s8 relStickX = input->rel.stick_x; s16 step; - bool dpad = CVarGetInteger("gDpadPause", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0); if (((pauseCtx->state == 7) && (pauseCtx->unk_1EC == 1)) || (pauseCtx->state == 0xE) || (pauseCtx->state == 0x10)) { if ((pauseCtx->promptChoice == 0) && ((relStickX >= 30) || (dpad && CHECK_BTN_ALL(input->press.button, BTN_DRIGHT)))) { diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h index 936f0bbdd..6c5fe7ba8 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope.h @@ -20,9 +20,9 @@ extern u8 gAreaGsFlags[]; #define AGE_REQ_CHILD LINK_AGE_CHILD #define AGE_REQ_NONE 9 -#define CHECK_AGE_REQ_EQUIP(i, j) (CVarGetInteger("gTimelessEquipment", 0) || (gEquipAgeReqs[i][j] == AGE_REQ_NONE) || (gEquipAgeReqs[i][j] == ((void)0, gSaveContext.linkAge))) -#define CHECK_AGE_REQ_SLOT(slotIndex) (CVarGetInteger("gTimelessEquipment", 0) || (gSlotAgeReqs[slotIndex] == AGE_REQ_NONE) || gSlotAgeReqs[slotIndex] == ((void)0, gSaveContext.linkAge)) -#define CHECK_AGE_REQ_ITEM(itemIndex) (CVarGetInteger("gTimelessEquipment", 0) || (gItemAgeReqs[itemIndex] == AGE_REQ_NONE) || (gItemAgeReqs[itemIndex] == gSaveContext.linkAge)) +#define CHECK_AGE_REQ_EQUIP(i, j) (CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0) || (gEquipAgeReqs[i][j] == AGE_REQ_NONE) || (gEquipAgeReqs[i][j] == ((void)0, gSaveContext.linkAge))) +#define CHECK_AGE_REQ_SLOT(slotIndex) (CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0) || (gSlotAgeReqs[slotIndex] == AGE_REQ_NONE) || gSlotAgeReqs[slotIndex] == ((void)0, gSaveContext.linkAge)) +#define CHECK_AGE_REQ_ITEM(itemIndex) (CVarGetInteger(CVAR_CHEAT("TimelessEquipment"), 0) || (gItemAgeReqs[itemIndex] == AGE_REQ_NONE) || (gItemAgeReqs[itemIndex] == gSaveContext.linkAge)) void KaleidoScope_DrawQuestStatus(PlayState* play, GraphicsContext* gfxCtx); s32 KaleidoScope_UpdateQuestStatusPoint(PauseContext* pauseCtx, s32 point); 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 059a845c3..424c823d6 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 @@ -945,7 +945,7 @@ Gfx* KaleidoScope_QuadTextureIA4(Gfx* gfx, void* texture, s16 width, s16 height, } Gfx* KaleidoScope_QuadTextureIA8(Gfx* gfx, void* texture, s16 width, s16 height, u16 point) { - u8 mirrorMode = CVarGetInteger("gMirroredWorld", 0) ? G_TX_MIRROR : G_TX_NOMIRROR; + u8 mirrorMode = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? G_TX_MIRROR : G_TX_NOMIRROR; gDPLoadTextureBlock(gfx++, texture, G_IM_FMT_IA, G_IM_SIZ_8b, width, height, 0, mirrorMode | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); gSP1Quadrangle(gfx++, point, point + 2, point + 3, point + 1, 0); @@ -1057,7 +1057,7 @@ void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) { gSaveContext.buttonStatus[buttonIndex] = D_8082AB6C[pauseCtx->pageIndex + pt][buttonIndex]; } - if ((CVarGetInteger("gAssignableTunicsAndBoots", 0) != 0) && (D_8082ABEC[pauseCtx->mode] == PAUSE_EQUIP)) { + if ((CVarGetInteger(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 0) != 0) && (D_8082ABEC[pauseCtx->mode] == PAUSE_EQUIP)) { gSaveContext.buttonStatus[1] = BTN_ENABLED; gSaveContext.buttonStatus[2] = BTN_ENABLED; gSaveContext.buttonStatus[3] = BTN_ENABLED; @@ -1079,12 +1079,12 @@ void KaleidoScope_SwitchPage(PauseContext* pauseCtx, u8 pt) { void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) { s16 Debug_BTN = BTN_L; s16 PageLeft_BTN = BTN_Z; - if (CVarGetInteger("gNGCKaleidoSwitcher", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("NGCKaleidoSwitcher"), 0) != 0) { Debug_BTN = BTN_Z; PageLeft_BTN = BTN_L; } - if (CVarGetInteger("gDebugEnabled", 0) && (pauseCtx->debugState == 0) && CHECK_BTN_ALL(input->press.button, Debug_BTN)) { + if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) && (pauseCtx->debugState == 0) && CHECK_BTN_ALL(input->press.button, Debug_BTN)) { pauseCtx->debugState = 1; return; } @@ -1099,7 +1099,7 @@ void KaleidoScope_HandlePageToggles(PauseContext* pauseCtx, Input* input) { return; } - bool dpad = CVarGetInteger("gDpadPause", 0); + bool dpad = CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0); if (pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) { if ((pauseCtx->stickRelX < -30) || (dpad && CHECK_BTN_ALL(input->cur.button, BTN_DLEFT))) { pauseCtx->pageSwitchTimer++; @@ -1129,14 +1129,14 @@ void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) { temp = pauseCtx->unk_1E4; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - sCursorColors[2] = CVarGetColor24("gCosmetics.Hud_AButton.Value", sCursorColors[2]); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + sCursorColors[2] = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), sCursorColors[2]); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { sCursorColors[2] = (Color_RGB8){ 0, 255, 50 }; } - if (CVarGetInteger("gCosmetics.Hud_CButtons.Changed", 0)) { - sCursorColors[1] = CVarGetColor24("gCosmetics.Hud_CButtons.Value", sCursorColors[1]); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CButtons.Changed"), 0)) { + sCursorColors[1] = CVarGetColor24(CVAR_COSMETIC("HUD.CButtons.Value"), sCursorColors[1]); } if ((((pauseCtx->unk_1E4 == 0) || (temp == 8)) && (pauseCtx->state == 6)) || @@ -1210,19 +1210,19 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { { 0, 0, 0 }, { 255, 255, 0 }, { 0, 50, 255 }, { 0, 0, 0 }, { 0, 0, 0 }, { 0, 50, 255 }, }; Color_RGB8 aButtonColor = { 100, 100, 255 }; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor); - D_8082ACF4[8] = CVarGetColor24("gCosmetics.Hud_AButton.Value", D_8082ACF4[8]); - D_8082ACF4[11] = CVarGetColor24("gCosmetics.Hud_AButton.Value", D_8082ACF4[11]); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + aButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), aButtonColor); + D_8082ACF4[8] = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), D_8082ACF4[8]); + D_8082ACF4[11] = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), D_8082ACF4[11]); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = (Color_RGB8){ 100, 255, 100 }; D_8082ACF4[8] = (Color_RGB8){ 0, 255, 50 }; D_8082ACF4[11] = (Color_RGB8){ 0, 255, 50 }; } - if (CVarGetInteger("gCosmetics.Hud_CButtons.Changed", 0)) { - D_8082ACF4[4] = CVarGetColor24("gCosmetics.Hud_CButtons.Value", D_8082ACF4[4]); - D_8082ACF4[7] = CVarGetColor24("gCosmetics.Hud_CButtons.Value", D_8082ACF4[7]); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CButtons.Changed"), 0)) { + D_8082ACF4[4] = CVarGetColor24(CVAR_COSMETIC("HUD.CButtons.Value"), D_8082ACF4[4]); + D_8082ACF4[7] = CVarGetColor24(CVAR_COSMETIC("HUD.CButtons.Value"), D_8082ACF4[7]); } static s16 D_8082AD3C = 20; @@ -1273,7 +1273,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { } } - if (CVarGetInteger("gDpadHoldChange", 1) && CVarGetInteger("gDpadPause", 0)) { + if (CVarGetInteger(CVAR_SETTING("DpadHoldChange"), 1) && CVarGetInteger(CVAR_SETTING("DPadOnPause"), 0)) { if (CHECK_BTN_ALL(input->cur.button, BTN_DLEFT)) { if (CHECK_BTN_ALL(input->press.button, BTN_DLEFT)) { D_8082AD44 = XREG(8); @@ -1618,7 +1618,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, sPromptChoiceTexs[gSaveContext.language][1], 48, 16, 16); } else if (((pauseCtx->state == 7 && pauseCtx->unk_1EC >= 4) || pauseCtx->state == 0xF) && - !CVarGetInteger("gSkipSaveConfirmation", 0)) { + !CVarGetInteger(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 0)) { POLY_KAL_DISP = KaleidoScope_QuadTextureIA8(POLY_KAL_DISP, sSaveConfirmationTexs[gSaveContext.language], 152, 16, 0); } else if ((pauseCtx->state != 7) || (pauseCtx->unk_1EC < 4)) { @@ -1670,31 +1670,31 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { void KaleidoScope_DrawInfoPanel(PlayState* play) { Color_RGB8 aButtonColor = { 0, 100, 255 }; - if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { - aButtonColor = CVarGetColor24("gCosmetics.Hud_AButton.Value", aButtonColor); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { + if (CVarGetInteger(CVAR_COSMETIC("HUD.AButton.Changed"), 0)) { + aButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.AButton.Value"), aButtonColor); + } else if (CVarGetInteger(CVAR_COSMETIC("DefaultColorScheme"), COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = (Color_RGB8){ 0, 255, 100 }; } Color_RGB8 cButtonsColor = {255, 160, 0}; - if (CVarGetInteger("gCosmetics.Hud_CButtons.Changed", 0)) { - cButtonsColor = CVarGetColor24("gCosmetics.Hud_CButtons.Value", cButtonsColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CButtons.Changed"), 0)) { + cButtonsColor = CVarGetColor24(CVAR_COSMETIC("HUD.CButtons.Value"), cButtonsColor); } Color_RGB8 cUpButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CUpButton.Changed", 0)) { - cUpButtonColor = CVarGetColor24("gCosmetics.Hud_CUpButton.Value", cUpButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CUpButton.Changed"), 0)) { + cUpButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CUpButton.Value"), cUpButtonColor); } Color_RGB8 cDownButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CDownButton.Changed", 0)) { - cDownButtonColor = CVarGetColor24("gCosmetics.Hud_CDownButton.Value", cDownButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.Changed"), 0)) { + cDownButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CDownButton.Value"), cDownButtonColor); } Color_RGB8 cLeftButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CLeftButton.Changed", 0)) { - cLeftButtonColor = CVarGetColor24("gCosmetics.Hud_CLeftButton.Value", cLeftButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CLeftButton.Changed"), 0)) { + cLeftButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CLeftButton.Value"), cLeftButtonColor); } Color_RGB8 cRightButtonColor = cButtonsColor; - if (CVarGetInteger("gCosmetics.Hud_CRightButton.Changed", 0)) { - cRightButtonColor = CVarGetColor24("gCosmetics.Hud_CRightButton.Value", cRightButtonColor); + if (CVarGetInteger(CVAR_COSMETIC("HUD.CRightButton.Changed"), 0)) { + cRightButtonColor = CVarGetColor24(CVAR_COSMETIC("HUD.CRightButton.Value"), cRightButtonColor); } static const void* sToEquipTextures[3] = { @@ -1883,21 +1883,21 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { gSPMatrix(POLY_KAL_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); - const Color_RGBA8 namePanelColor = CVarGetColor("gCosmetics.Kal_NamePanel.Value", (Color_RGBA8){90,100,130,255}); + const Color_RGBA8 namePanelColor = CVarGetColor(CVAR_COSMETIC("Kaleido.NamePanel.Value"), (Color_RGBA8){90,100,130,255}); gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, namePanelColor.r, namePanelColor.g, namePanelColor.b, namePanelColor.a); gSPVertex(POLY_KAL_DISP++, &pauseCtx->infoPanelVtx[0], 16, 0); gSPDisplayList(POLY_KAL_DISP++, gItemNamePanelDL); - if (CVarGetInteger("gUniformLR", 0) == 0) { // Restore the misplace gDPSetPrimColor + if (CVarGetInteger(CVAR_ENHANCEMENT("FixMenuLR"), 0) == 0) { // Restore the misplace gDPSetPrimColor gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 90, 100, 130, 255); } if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_LEFT) && (pauseCtx->unk_1E4 == 0)) { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, D_808321A0, D_808321A2, D_808321A4, D_808321A6); } else { - if (CVarGetInteger("gUniformLR", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FixMenuLR"), 0) != 0) { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 180, 210, 255, 255); } } @@ -1905,14 +1905,14 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { gSPDisplayList(POLY_KAL_DISP++, gLButtonIconDL); - if (CVarGetInteger("gUniformLR", 0) == 0) { //Restore the misplace gDPSetPrimColor + if (CVarGetInteger(CVAR_ENHANCEMENT("FixMenuLR"), 0) == 0) { //Restore the misplace gDPSetPrimColor gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 180, 210, 255, 255); } if ((pauseCtx->cursorSpecialPos == PAUSE_CURSOR_PAGE_RIGHT) && (pauseCtx->unk_1E4 == 0)) { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, D_808321A0, D_808321A2, D_808321A4, D_808321A6); } else { - if (CVarGetInteger("gUniformLR", 0) != 0) { + if (CVarGetInteger(CVAR_ENHANCEMENT("FixMenuLR"), 0) != 0) { gDPSetPrimColor(POLY_KAL_DISP++, 0, 0, 180, 210, 255, 255); } } @@ -1963,7 +1963,7 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { POLY_KAL_DISP = KaleidoScope_QuadTextureIA4(POLY_KAL_DISP, pauseCtx->nameSegment, 128, 16, 0); } - if (pauseCtx->pageIndex == PAUSE_MAP && CVarGetInteger("gSkulltulaDebugEnabled", 0) != 0) { + if (pauseCtx->pageIndex == PAUSE_MAP && CVarGetInteger(CVAR_DEVELOPER_TOOLS("SkulltulaDebugEnabled"), 0) != 0) { if (YREG(7) != 0) { osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("キンスタ数(%d) Get_KIN_STA=%x (%x) (%x)\n", YREG(6), GET_GS_FLAGS(YREG(6)), @@ -2061,8 +2061,8 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { } } else { bool pauseAnyCursor = - (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || - (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); + (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || + (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); if (!pauseCtx->pageIndex && (!pauseAnyCursor || (gSaveContext.inventory.items[pauseCtx->cursorPoint[PAUSE_ITEM]] != ITEM_NONE))) { // pageIndex == PAUSE_ITEM pauseCtx->infoPanelVtx[16].v.ob[0] = pauseCtx->infoPanelVtx[18].v.ob[0] = WREG(49 + gSaveContext.language); @@ -2199,8 +2199,8 @@ void KaleidoScope_DrawInfoPanel(PlayState* play) { void KaleidoScope_UpdateNamePanel(PlayState* play) { PauseContext* pauseCtx = &play->pauseCtx; u16 sp2A; - bool pauseAnyCursor = (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || - (CVarGetInteger("gPauseAnyCursor", 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); + bool pauseAnyCursor = (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_RANDO_ONLY && IS_RANDO) || + (CVarGetInteger(CVAR_SETTING("PauseAnyCursor"), 0) == PAUSE_ANY_CURSOR_ALWAYS_ON); if ((pauseCtx->namedItem != pauseCtx->cursorItem[pauseCtx->pageIndex]) || ((pauseCtx->pageIndex == PAUSE_MAP) && (pauseCtx->cursorSpecialPos != 0))) { @@ -2450,40 +2450,40 @@ static s16 D_8082B0E4[] = { static const char* gPageVtxColorCvars[][4] = { { - "gCosmetics.Kal_ItemSelA.Value", - "gCosmetics.Kal_ItemSelB.Value", - "gCosmetics.Kal_ItemSelC.Value", - "gCosmetics.Kal_ItemSelD.Value", + CVAR_COSMETIC("Kaleido.ItemSelA.Value"), + CVAR_COSMETIC("Kaleido.ItemSelB.Value"), + CVAR_COSMETIC("Kaleido.ItemSelC.Value"), + CVAR_COSMETIC("Kaleido.ItemSelD.Value"), }, { - "gCosmetics.Kal_EquipSelA.Value", - "gCosmetics.Kal_EquipSelB.Value", - "gCosmetics.Kal_EquipSelC.Value", - "gCosmetics.Kal_EquipSelD.Value", + CVAR_COSMETIC("Kaleido.EquipSelA.Value"), + CVAR_COSMETIC("Kaleido.EquipSelB.Value"), + CVAR_COSMETIC("Kaleido.EquipSelC.Value"), + CVAR_COSMETIC("Kaleido.EquipSelD.Value"), }, { - "gCosmetics.Kal_MapSelDunA.Value", - "gCosmetics.Kal_MapSelDunB.Value", - "gCosmetics.Kal_MapSelDunC.Value", - "gCosmetics.Kal_MapSelDunD.Value", + CVAR_COSMETIC("Kaleido.MapSelDunA.Value"), + CVAR_COSMETIC("Kaleido.MapSelDunB.Value"), + CVAR_COSMETIC("Kaleido.MapSelDunC.Value"), + CVAR_COSMETIC("Kaleido.MapSelDunD.Value"), }, { - "gCosmetics.Kal_QuestStatusA.Value", - "gCosmetics.Kal_QuestStatusB.Value", - "gCosmetics.Kal_QuestStatusC.Value", - "gCosmetics.Kal_QuestStatusD.Value", + CVAR_COSMETIC("Kaleido.QuestStatusA.Value"), + CVAR_COSMETIC("Kaleido.QuestStatusB.Value"), + CVAR_COSMETIC("Kaleido.QuestStatusC.Value"), + CVAR_COSMETIC("Kaleido.QuestStatusD.Value"), }, { - "gCosmetics.Kal_MapSelectA.Value", - "gCosmetics.Kal_MapSelectB.Value", - "gCosmetics.Kal_MapSelectC.Value", - "gCosmetics.Kal_MapSelectD.Value", + CVAR_COSMETIC("Kaleido.MapSelectA.Value"), + CVAR_COSMETIC("Kaleido.MapSelectB.Value"), + CVAR_COSMETIC("Kaleido.MapSelectC.Value"), + CVAR_COSMETIC("Kaleido.MapSelectD.Value"), }, { - "gCosmetics.Kal_SaveA.Value", - "gCosmetics.Kal_SaveB.Value", - "gCosmetics.Kal_SaveC.Value", - "gCosmetics.Kal_SaveD.Value", + CVAR_COSMETIC("Kaleido.SaveA.Value"), + CVAR_COSMETIC("Kaleido.SaveB.Value"), + CVAR_COSMETIC("Kaleido.SaveC.Value"), + CVAR_COSMETIC("Kaleido.SaveD.Value"), }, }; @@ -2827,7 +2827,7 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->cursorVtx[19].v.tc[1] = 0x400; // 24 items, 7 "item selected" backgrounds, 14 ammo digits (2 each for 7 items) -- then 4 vertices for each - pauseCtx->itemVtx = Graph_Alloc(gfxCtx, (24 + 7 + 2 * (CVarGetInteger("gEnhancements.BetterAmmoRendering", 0) ? ARRAY_COUNT(D_8082B11C_all) : ARRAY_COUNT(D_8082B11C))) * 4 * sizeof(Vtx)); + pauseCtx->itemVtx = Graph_Alloc(gfxCtx, (24 + 7 + 2 * (CVarGetInteger(CVAR_ENHANCEMENT("BetterAmmoRendering"), 0) ? ARRAY_COUNT(D_8082B11C_all) : ARRAY_COUNT(D_8082B11C))) * 4 * sizeof(Vtx)); for (phi_t4 = 0, phi_t2 = 0, phi_t5 = 58; phi_t4 < 4; phi_t4++, phi_t5 -= 32) { for (phi_t1 = -96, phi_t3 = 0; phi_t3 < 6; phi_t3++, phi_t2 += 4, phi_t1 += 32) { @@ -2868,7 +2868,7 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { for (phi_t3 = 1; phi_t3 < ARRAY_COUNT(gSaveContext.equips.buttonItems); phi_t3++, phi_t2 += 4) { if (gSaveContext.equips.cButtonSlots[phi_t3 - 1] != ITEM_NONE && - ((phi_t3 < 4) || CVarGetInteger("gDpadEquips", 0))) { + ((phi_t3 < 4) || CVarGetInteger(CVAR_SETTING("DpadEquips"), 0))) { phi_t4 = gSaveContext.equips.cButtonSlots[phi_t3 - 1] * 4; pauseCtx->itemVtx[phi_t2 + 0].v.ob[0] = pauseCtx->itemVtx[phi_t2 + 2].v.ob[0] = @@ -2917,7 +2917,7 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { } } - u8 gBetterAmmoRendering = CVarGetInteger("gEnhancements.BetterAmmoRendering", 0); + u8 gBetterAmmoRendering = CVarGetInteger(CVAR_ENHANCEMENT("BetterAmmoRendering"), 0); for (phi_t3 = 0; phi_t3 < (gBetterAmmoRendering ? ARRAY_COUNT(D_8082B11C_all) : ARRAY_COUNT(D_8082B11C)); phi_t3++) { phi_t4 = gBetterAmmoRendering ? D_8082B11C_all[phi_t3] : D_8082B11C[phi_t3]; @@ -3267,7 +3267,7 @@ void KaleidoScope_Draw(PlayState* play) { func_800AAA50(&play->view, 15); // Flip the OPA and XLU projections again as the set view call above reset the original flips from z_play - if (CVarGetInteger("gMirroredWorld", 0)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0)) { gSPMatrix(POLY_OPA_DISP++, play->view.projectionFlippedPtr, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPMatrix(POLY_XLU_DISP++, play->view.projectionFlippedPtr, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); gSPMatrix(POLY_OPA_DISP++, play->view.viewingPtr, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION); @@ -3302,7 +3302,7 @@ void func_808265BC(PlayState* play) { pauseCtx->pageIndex = D_8082ABEC[pauseCtx->mode]; - if ((CVarGetInteger("gAssignableTunicsAndBoots", 0) != 0) && (pauseCtx->pageIndex == PAUSE_EQUIP)) { + if ((CVarGetInteger(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 0) != 0) && (pauseCtx->pageIndex == PAUSE_EQUIP)) { gSaveContext.buttonStatus[1] = BTN_ENABLED; gSaveContext.buttonStatus[2] = BTN_ENABLED; gSaveContext.buttonStatus[3] = BTN_ENABLED; @@ -3994,9 +3994,9 @@ void KaleidoScope_Update(PlayState* play) // Boss Rush skips past the "Save?" window when pressing B while paused. if (CHECK_BTN_ALL(input->press.button, BTN_START) || (CHECK_BTN_ALL(input->press.button, BTN_B) && IS_BOSS_RUSH)) { - if (CVarGetInteger("gCheatEasyPauseBufferEnabled", 0) || CVarGetInteger("gCheatEasyInputBufferingEnabled", 0)) { + if (CVarGetInteger(CVAR_CHEAT("EasyPauseBuffer"), 0) || CVarGetInteger(CVAR_CHEAT("EasyInputBuffer"), 0)) { // Easy pause buffer is 13 frames, 12 for kaledio to end, and one more to advance a single frame - CVarSetInteger("gCheatEasyPauseBufferTimer", 13); + CVarSetInteger(CVAR_GENERAL("CheatEasyPauseBufferTimer"), 13); } Interface_SetDoAction(play, DO_ACTION_NONE); pauseCtx->state = 0x12; @@ -4157,7 +4157,7 @@ void KaleidoScope_Update(PlayState* play) &D_801333E8); Play_PerformSave(play); pauseCtx->unk_1EC = 4; - D_8082B25C = CVarGetInteger("gSkipSaveConfirmation", 0) ? 3 /* 0.1 sec */ : 90 /* 3 secs */; + D_8082B25C = CVarGetInteger(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 0) ? 3 /* 0.1 sec */ : 90 /* 3 secs */; } } else if (CHECK_BTN_ALL(input->press.button, BTN_START) || CHECK_BTN_ALL(input->press.button, BTN_B)) { @@ -4405,7 +4405,7 @@ void KaleidoScope_Update(PlayState* play) gSaveContext.savedSceneNum = play->sceneNum; Save_SaveFile(); pauseCtx->state = 0xF; - D_8082B25C = CVarGetInteger("gSkipSaveConfirmation", 0) ? 3 /* 0.1 sec */ : 90 /* 3 secs */; + D_8082B25C = CVarGetInteger(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 0) ? 3 /* 0.1 sec */ : 90 /* 3 secs */; } } break; @@ -4508,7 +4508,7 @@ void KaleidoScope_Update(PlayState* play) // Reset frame counter to prevent autosave on respawn play->gameplayFrames = 0; gSaveContext.nextTransitionType = TRANS_TYPE_FADE_BLACK; - gSaveContext.health = CVarGetInteger("gFullHealthSpawn", 0) ? gSaveContext.healthCapacity : 0x30; + gSaveContext.health = CVarGetInteger(CVAR_ENHANCEMENT("FullHealthSpawn"), 0) ? gSaveContext.healthCapacity : 0x30; Audio_QueueSeqCmd(0xF << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0xA); gSaveContext.healthAccumulator = 0; gSaveContext.magicState = MAGIC_STATE_IDLE; @@ -4560,7 +4560,7 @@ void KaleidoScope_Update(PlayState* play) R_UPDATE_RATE = 3; R_PAUSE_MENU_MODE = 0; - CVarSetInteger("gPauseTriforce", 0); + CVarSetInteger(CVAR_GENERAL("PauseTriforce"), 0); func_800981B8(&play->objectCtx); func_800418D0(&play->colCtx, play); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c index 37093a283..0de1d117a 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_lmap_mark.c @@ -132,7 +132,7 @@ void PauseMapMark_DrawForDungeon(PlayState* play) { G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); // Compute the offset to mirror icons over the map center (48) as an axis line - s16 mirrorOffset = CVarGetInteger("gMirroredWorld", 0) ? mirrorOffset = (48 - markPoint->x) * 2 + 1 : 0; + s16 mirrorOffset = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? mirrorOffset = (48 - markPoint->x) * 2 + 1 : 0; Matrix_Push(); Matrix_Translate(GREG(92) + markPoint->x + mirrorOffset, GREG(93) + markPoint->y, 0.0f, MTXMODE_APPLY);