From d69c07cd751cd3dc25ab55fc08c2ce875ccd6d20 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Fri, 9 Jun 2023 17:22:25 -0400 Subject: [PATCH] numbers aren't magic (#2976) * numbers aren't magic * chest style matches contents renamed everything except the cvar itself at this point (waiting for versioned configs for that) * tracker as part of names * finish the tracker rename --------- Co-authored-by: briaguya --- OTRGui/libs/raylib/src/raudio.c | 2 +- docs/BUILDING.md | 2 +- .../cosmetics/CosmeticsEditor.cpp | 3 +- .../Enhancements/cosmetics/cosmeticsTypes.h | 4 + soh/soh/Enhancements/debugger/colViewer.cpp | 24 +-- soh/soh/Enhancements/debugger/colViewer.h | 7 + soh/soh/Enhancements/enhancementTypes.h | 46 ++++++ .../game-interactor/GameInteractor.cpp | 2 +- .../GameInteractor_RawAction.cpp | 17 +- soh/soh/Enhancements/gameplaystats.cpp | 3 +- soh/soh/Enhancements/mods.cpp | 62 ++++---- soh/soh/Enhancements/presets.h | 19 +-- .../Enhancements/randomizer/randomizerTypes.h | 27 ++++ .../randomizer/randomizer_check_tracker.cpp | 30 ++-- .../randomizer/randomizer_item_tracker.cpp | 145 ++++++++++-------- soh/soh/SohMenuBar.cpp | 18 +-- soh/src/code/z_face_reaction.c | 3 +- soh/src/code/z_message_PAL.c | 7 +- soh/src/code/z_parameter.c | 10 +- soh/src/code/z_play.c | 7 +- .../overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 2 +- soh/src/overlays/actors/ovl_En_Box/z_en_box.c | 9 +- .../overlays/actors/ovl_En_Ossan/z_en_ossan.c | 3 +- .../actors/ovl_player_actor/z_player.c | 11 +- .../ovl_file_choose/z_file_choose.c | 9 +- .../ovl_kaleido_scope/z_kaleido_collect.c | 3 +- .../misc/ovl_kaleido_scope/z_kaleido_item.c | 3 +- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 7 +- 28 files changed, 305 insertions(+), 180 deletions(-) create mode 100644 soh/soh/Enhancements/cosmetics/cosmeticsTypes.h create mode 100644 soh/soh/Enhancements/enhancementTypes.h diff --git a/OTRGui/libs/raylib/src/raudio.c b/OTRGui/libs/raylib/src/raudio.c index ccd156c1e..c87db7ca5 100644 --- a/OTRGui/libs/raylib/src/raudio.c +++ b/OTRGui/libs/raylib/src/raudio.c @@ -452,7 +452,7 @@ void InitAudioDevice(void) return; } - // Mixing happens on a seperate thread which means we need to synchronize. I'm using a mutex here to make things simple, but may + // Mixing happens on a separate thread which means we need to synchronize. I'm using a mutex here to make things simple, but may // want to look at something a bit smarter later on to keep everything real-time, if that's necessary. if (ma_mutex_init(&AUDIO.System.lock) != MA_SUCCESS) { diff --git a/docs/BUILDING.md b/docs/BUILDING.md index dfdb18429..7b24ec30a 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -235,7 +235,7 @@ The CI works via [Github Actions](https://github.com/features/actions) where we To get this step working on your fork, you'll need to add a machine to your own repository as a self-hosted runner via "Settings > Actions > Runners" in your repository settings. Make sure to add the 'asset-builder' tag to your newly added runner to assign it to run this step. To setup your runner as a service read the docs [here](https://docs.github.com/en/actions/hosting-your-own-runners/configuring-the-self-hosted-runner-application-as-a-service?platform=linux). ### Runner on Windows -You'll have to enable the ability to run unsigned scripts through PowerShell. To do this, open Powershell as administrator and run `set-executionpolicy remotesigned`. Most dependencies get installed as part of the CI process. You will also need to seperately install 7z and add it to the PATH so `7z` can be run as a command. [Chocolatey](https://chocolatey.org/) or other package managers can be used to install it easily. +You'll have to enable the ability to run unsigned scripts through PowerShell. To do this, open Powershell as administrator and run `set-executionpolicy remotesigned`. Most dependencies get installed as part of the CI process. You will also need to separately install 7z and add it to the PATH so `7z` can be run as a command. [Chocolatey](https://chocolatey.org/) or other package managers can be used to install it easily. ### Runner on UNIX systems If you're on macOS or Linux take a look at `macports-deps.txt` or `apt-deps.txt` to see the dependencies expected to be on your machine. diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 4f7bdbd5c..eb61dca57 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -1,4 +1,5 @@ #include "CosmeticsEditor.h" +#include "cosmeticsTypes.h" #include "authenticGfxPatches.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" @@ -1688,7 +1689,7 @@ void CosmeticsEditorWindow::DrawElement() { ImGui::Text("Color Scheme"); ImGui::SameLine(); - UIWidgets::EnhancementCombobox("gCosmetics.DefaultColorScheme", colorSchemes, 0); + UIWidgets::EnhancementCombobox("gCosmetics.DefaultColorScheme", colorSchemes, COLORSCHEME_N64); UIWidgets::EnhancementCheckbox("Advanced Mode", "gCosmetics.AdvancedMode"); if (CVarGetInteger("gCosmetics.AdvancedMode", 0)) { if (ImGui::Button("Lock All Advanced", ImVec2(ImGui::GetContentRegionAvail().x / 2, 30.0f))) { diff --git a/soh/soh/Enhancements/cosmetics/cosmeticsTypes.h b/soh/soh/Enhancements/cosmetics/cosmeticsTypes.h new file mode 100644 index 000000000..5da453d48 --- /dev/null +++ b/soh/soh/Enhancements/cosmetics/cosmeticsTypes.h @@ -0,0 +1,4 @@ +typedef enum { + COLORSCHEME_N64, + COLORSCHEME_GAMECUBE +} DefaultColorScheme; \ No newline at end of file diff --git a/soh/soh/Enhancements/debugger/colViewer.cpp b/soh/soh/Enhancements/debugger/colViewer.cpp index a9d9c1b3a..7aa7ab40a 100644 --- a/soh/soh/Enhancements/debugger/colViewer.cpp +++ b/soh/soh/Enhancements/debugger/colViewer.cpp @@ -59,10 +59,10 @@ void ColViewerWindow::DrawElement() { } UIWidgets::EnhancementCheckbox("Enabled", "gColViewerEnabled"); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Scene", "gColViewerScene", ColRenderSettingNames, 0); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Bg Actors", "gColViewerBgActors", ColRenderSettingNames, 0); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Col Check", "gColViewerColCheck", ColRenderSettingNames, 0); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Waterbox", "gColViewerWaterbox", ColRenderSettingNames, 0); + 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::EnhancementCheckbox("Apply as decal", "gColViewerDecal"); UIWidgets::InsertHelpHoverText("Applies the collision as a decal display. This can be useful if there is z-fighting occuring " @@ -428,9 +428,9 @@ void DrawDynapoly(std::vector& dl, CollisionHeader* col, int32_t bgId) { // Draws the scene void DrawSceneCollision() { - ColRenderSetting showSceneColSetting = (ColRenderSetting)CVarGetInteger("gColViewerScene", 0); + ColRenderSetting showSceneColSetting = (ColRenderSetting)CVarGetInteger("gColViewerScene", COLVIEW_DISABLED); - if (showSceneColSetting == ColRenderSetting::Disabled || CVarGetInteger("gColViewerEnabled", 0) == 0) { + if (showSceneColSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { return; } @@ -443,8 +443,8 @@ void DrawSceneCollision() { // Draws all Bg Actors void DrawBgActorCollision() { - ColRenderSetting showBgActorSetting = (ColRenderSetting)CVarGetInteger("gColViewerBgActors", 0); - if (showBgActorSetting == ColRenderSetting::Disabled || CVarGetInteger("gColViewerEnabled", 0) == 0) { + ColRenderSetting showBgActorSetting = (ColRenderSetting)CVarGetInteger("gColViewerBgActors", COLVIEW_DISABLED); + if (showBgActorSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { return; } @@ -568,8 +568,8 @@ void DrawColCheckList(std::vector& dl, Collider** objects, int32_t count) { // Draws all Col Check objects void DrawColCheckCollision() { - ColRenderSetting showColCheckSetting = (ColRenderSetting)CVarGetInteger("gColViewerColCheck", 0); - if (showColCheckSetting == ColRenderSetting::Disabled || CVarGetInteger("gColViewerEnabled", 0) == 0) { + ColRenderSetting showColCheckSetting = (ColRenderSetting)CVarGetInteger("gColViewerColCheck", COLVIEW_DISABLED); + if (showColCheckSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { return; } @@ -621,8 +621,8 @@ extern "C" f32 zdWaterBoxMinY; // Draws all waterboxes void DrawWaterboxList() { - ColRenderSetting showWaterboxSetting = (ColRenderSetting)CVarGetInteger("gColViewerWaterbox", 0); - if (showWaterboxSetting == ColRenderSetting::Disabled || CVarGetInteger("gColViewerEnabled", 0) == 0) { + ColRenderSetting showWaterboxSetting = (ColRenderSetting)CVarGetInteger("gColViewerWaterbox", COLVIEW_DISABLED); + if (showWaterboxSetting == ColRenderSetting::Disabled || !CVarGetInteger("gColViewerEnabled", 0)) { return; } diff --git a/soh/soh/Enhancements/debugger/colViewer.h b/soh/soh/Enhancements/debugger/colViewer.h index 7e3eb9e3b..98f0b6f0a 100644 --- a/soh/soh/Enhancements/debugger/colViewer.h +++ b/soh/soh/Enhancements/debugger/colViewer.h @@ -7,6 +7,12 @@ extern "C" #endif void DrawColViewer(); +typedef enum { + COLVIEW_DISABLED, + COLVIEW_SOLID, + COLVIEW_TRANSPARENT +} ColViewerRenderSetting; + #ifdef __cplusplus class ColViewerWindow : public LUS::GuiWindow { public: @@ -16,4 +22,5 @@ class ColViewerWindow : public LUS::GuiWindow { void DrawElement() override; void UpdateElement() override {}; }; + #endif \ No newline at end of file diff --git a/soh/soh/Enhancements/enhancementTypes.h b/soh/soh/Enhancements/enhancementTypes.h new file mode 100644 index 000000000..00ededc44 --- /dev/null +++ b/soh/soh/Enhancements/enhancementTypes.h @@ -0,0 +1,46 @@ +typedef enum { + CSMC_DISABLED, + CSMC_BOTH, + CSMC_TEXTURE, + CSMC_SIZE +} ChestStyleMatchesContentsType; + +typedef enum { + BUNNY_HOOD_VANILLA, + BUNNY_HOOD_FAST_AND_JUMP, + BUNNY_HOOD_FAST +} BunnyHoodMode; + +typedef enum { + FASTFILE_1, + FASTFILE_2, + FASTFILE_3, + FASTFILE_MAP_SELECT, + FASTFILE_FILE_SELECT +} FastFileSelectTarget; + +typedef enum { + AUTOSAVE_OFF, + AUTOSAVE_LOCATION_AND_MAJOR_ITEMS, + AUTOSAVE_LOCATION_AND_ALL_ITEMS, + AUTOSAVE_LOCATION, + AUTOSAVE_MAJOR_ITEMS, + AUTOSAVE_ALL_ITEMS +} AutosaveType; + +typedef enum { + ZFIGHT_FIX_DISABLED, + ZFIGHT_FIX_CONSISTENT_VANISH, + ZFIGHT_FIX_NO_VANISH, +} ZFightingFixType; + +typedef enum { + BONK_DAMAGE_NONE, + BONK_DAMAGE_QUARTER_HEART, + BONK_DAMAGE_HALF_HEART, + BONK_DAMAGE_1_HEART, + BONK_DAMAGE_2_HEARTS, + BONK_DAMAGE_4_HEARTS, + BONK_DAMAGE_8_HEARTS, + BONK_DAMAGE_OHKO, +} BonkDamage; diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor.cpp index 77d3c168c..eb330947b 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.cpp @@ -87,7 +87,7 @@ bool GameInteractor::CanAddOrTakeAmmo(int16_t amount, int16_t item) { } return true; } else { - // Seperate checks for beans and bombchus because they don't have capacity upgrades + // Separate checks for beans and bombchus because they don't have capacity upgrades if (INV_CONTENT(item) != item || (amount > 0 && ((item == ITEM_BOMBCHU && AMMO(item) == 50) || (item == ITEM_BEAN && AMMO(item) == 10)))) { return false; diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp index 46eb3b547..e7db940cf 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp @@ -3,6 +3,7 @@ #include "soh/Enhancements/cosmetics/CosmeticsEditor.h" #include "soh/Enhancements/randomizer/3drando/random.hpp" #include +#include "soh/Enhancements/debugger/colViewer.h" extern "C" { #include "variables.h" @@ -233,15 +234,15 @@ void GameInteractor::RawAction::SetCollisionViewer(bool active) { CVarSetInteger("gColViewerDecal", active); if (active) { - CVarSetInteger("gColViewerScene", 2); - CVarSetInteger("gColViewerBgActors", 2); - CVarSetInteger("gColViewerColCheck", 2); - CVarSetInteger("gColViewerWaterbox", 2); + CVarSetInteger("gColViewerScene", COLVIEW_TRANSPARENT); + CVarSetInteger("gColViewerBgActors", COLVIEW_TRANSPARENT); + CVarSetInteger("gColViewerColCheck", COLVIEW_TRANSPARENT); + CVarSetInteger("gColViewerWaterbox", COLVIEW_TRANSPARENT); } else { - CVarSetInteger("gColViewerScene", 0); - CVarSetInteger("gColViewerBgActors", 0); - CVarSetInteger("gColViewerColCheck", 0); - CVarSetInteger("gColViewerWaterbox", 0); + CVarSetInteger("gColViewerScene", COLVIEW_DISABLED); + CVarSetInteger("gColViewerBgActors", COLVIEW_DISABLED); + CVarSetInteger("gColViewerColCheck", COLVIEW_DISABLED); + CVarSetInteger("gColViewerWaterbox", COLVIEW_DISABLED); } } diff --git a/soh/soh/Enhancements/gameplaystats.cpp b/soh/soh/Enhancements/gameplaystats.cpp index 0f1880968..712d2812d 100644 --- a/soh/soh/Enhancements/gameplaystats.cpp +++ b/soh/soh/Enhancements/gameplaystats.cpp @@ -12,6 +12,7 @@ extern "C" { #include #include #include +#include "soh/Enhancements/enhancementTypes.h" extern "C" { #include @@ -544,7 +545,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", 0) || gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD] > 0) { + if (CVarGetInteger("gMMBunnyHood", 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])); diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index e9fa86982..b5bc3ec3e 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -3,6 +3,7 @@ #include "game-interactor/GameInteractor.h" #include "tts/tts.h" #include "soh/Enhancements/boss-rush/BossRushTypes.h" +#include "soh/Enhancements/enhancementTypes.h" extern "C" { #include @@ -227,13 +228,13 @@ void AutoSave(GetItemEntry itemEntry) { // 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 // Don't autosave in grottos since resuming from grottos breaks the game. - if ((CVarGetInteger("gAutosave", 0) > 0) && (gPlayState != NULL) && (gSaveContext.pendingSale == ITEM_NONE) && + if ((CVarGetInteger("gAutosave", AUTOSAVE_OFF) != AUTOSAVE_OFF) && (gPlayState != NULL) && (gSaveContext.pendingSale == ITEM_NONE) && (gPlayState->gameplayFrames > 60 && gSaveContext.cutsceneIndex < 0xFFF0) && (gPlayState->sceneNum != SCENE_GANON_DEMO)) { - if (((CVarGetInteger("gAutosave", 0) == 2) || (CVarGetInteger("gAutosave", 0) == 5)) && (item != ITEM_NONE)) { + if (((CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_ALL_ITEMS) || (CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_ALL_ITEMS)) && (item != ITEM_NONE)) { // Autosave for all items performSave = true; - } else if (((CVarGetInteger("gAutosave", 0) == 1) || (CVarGetInteger("gAutosave", 0) == 4)) && (item != ITEM_NONE)) { + } else if (((CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_LOCATION_AND_MAJOR_ITEMS) || (CVarGetInteger("gAutosave", AUTOSAVE_OFF) == AUTOSAVE_MAJOR_ITEMS)) && (item != ITEM_NONE)) { // Autosave for major items if (itemEntry.modIndex == 0) { switch (item) { @@ -284,12 +285,16 @@ void AutoSave(GetItemEntry itemEntry) { } else if (itemEntry.modIndex == 1 && item != RG_ICE_TRAP) { performSave = true; } - } else if ((CVarGetInteger("gAutosave", 0) > 0 && (CVarGetInteger("gAutosave", 0) < 4))) { + } 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) { performSave = true; } if ((gPlayState->sceneNum == SCENE_YOUSEI_IZUMI_TATE) || (gPlayState->sceneNum == SCENE_KAKUSIANA) || (gPlayState->sceneNum == SCENE_KENJYANOMA)) { - if ((CVarGetInteger("gAutosave", 0) > 0 && (CVarGetInteger("gAutosave", 0) < 4))) { + 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) { performSave = false; return; } @@ -486,47 +491,44 @@ void RegisterHyperEnemies() { void RegisterBonkDamage() { GameInteractor::Instance->RegisterGameHook([]() { - uint8_t bonkOption = CVarGetInteger("gBonkDamageMul", 0); + uint8_t bonkOption = CVarGetInteger("gBonkDamageMul", BONK_DAMAGE_NONE); + if (bonkOption == BONK_DAMAGE_NONE) { + return; + } + + if (bonkOption == BONK_DAMAGE_OHKO) { + gSaveContext.health = 0; + return; + } + uint16_t bonkDamage = 0; switch (bonkOption) { - // Quarter heart - case 1: + case BONK_DAMAGE_QUARTER_HEART: bonkDamage = 4; break; - // Half a heart - case 2: + case BONK_DAMAGE_HALF_HEART: bonkDamage = 8; break; - // Full heart - case 3: + case BONK_DAMAGE_1_HEART: bonkDamage = 16; break; - // 2 hearts - case 4: + case BONK_DAMAGE_2_HEARTS: bonkDamage = 32; break; - // 4 hearts - case 5: + case BONK_DAMAGE_4_HEARTS: bonkDamage = 64; break; - // 8 hearts - case 6: + case BONK_DAMAGE_8_HEARTS: bonkDamage = 128; break; - case 0: - case 7: default: break; } - // OHKO - if (bonkOption == 7) { - gSaveContext.health = 0; - } else if (bonkDamage) { - Health_ChangeBy(gPlayState, -bonkDamage); - // Set invincibility to make Link flash red as a visual damage indicator. - Player* player = GET_PLAYER(gPlayState); - player->invincibilityTimer = 28; - } + + Health_ChangeBy(gPlayState, -bonkDamage); + // Set invincibility to make Link flash red as a visual damage indicator. + Player* player = GET_PLAYER(gPlayState); + player->invincibilityTimer = 28; }); } @@ -535,7 +537,7 @@ void UpdateDirtPathFixState(int32_t sceneNum) { case SCENE_SPOT00: case SCENE_SPOT04: case SCENE_SPOT15: - CVarSetInteger("gDirtPathFix", CVarGetInteger("gSceneSpecificDirtPathFix", 0)); + CVarSetInteger("gDirtPathFix", CVarGetInteger("gSceneSpecificDirtPathFix", ZFIGHT_FIX_DISABLED)); return; default: CVarClear("gDirtPathFix"); diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index 9a51d4d71..887244c7b 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -5,6 +5,7 @@ #include #include #include "soh/Enhancements/randomizer/randomizerTypes.h" +#include "soh/Enhancements/enhancementTypes.h" enum PresetEntryType { PRESET_ENTRY_TYPE_S32, @@ -537,7 +538,7 @@ const std::vector enhancedPresetEntries = { // No Skulltula Freeze PRESET_ENTRY_S32("gSkulltulaFreeze", 1), // MM Bunny Hood - PRESET_ENTRY_S32("gMMBunnyHood", 1), + PRESET_ENTRY_S32("gMMBunnyHood", BUNNY_HOOD_FAST_AND_JUMP), // Fast Chests PRESET_ENTRY_S32("gFastChests", 1), // Fast Drops @@ -579,7 +580,7 @@ const std::vector enhancedPresetEntries = { PRESET_ENTRY_S32("gAnubisFix", 1), // Autosave - PRESET_ENTRY_S32("gAutosave", 1), + PRESET_ENTRY_S32("gAutosave", AUTOSAVE_LOCATION_AND_MAJOR_ITEMS), }; const std::vector randomizerPresetEntries = { @@ -657,7 +658,7 @@ const std::vector randomizerPresetEntries = { // No Skulltula Freeze PRESET_ENTRY_S32("gSkulltulaFreeze", 1), // MM Bunny Hood - PRESET_ENTRY_S32("gMMBunnyHood", 1), + PRESET_ENTRY_S32("gMMBunnyHood", BUNNY_HOOD_FAST_AND_JUMP), // Fast Chests PRESET_ENTRY_S32("gFastChests", 1), // Fast Drops @@ -701,7 +702,7 @@ const std::vector randomizerPresetEntries = { PRESET_ENTRY_S32("gAnubisFix", 1), // Autosave - PRESET_ENTRY_S32("gAutosave", 1), + PRESET_ENTRY_S32("gAutosave", AUTOSAVE_LOCATION_AND_MAJOR_ITEMS), // Customize Fishing Behaviour PRESET_ENTRY_S32("gCustomizeFishing", 1), @@ -721,7 +722,7 @@ const std::vector randomizerPresetEntries = { // Pull out Ocarina to Summon Scarecrow PRESET_ENTRY_S32("gSkipScarecrow", 1), // Chest size & texture matches contents - PRESET_ENTRY_S32("gChestSizeAndTextureMatchesContents", 1), + PRESET_ENTRY_S32("gChestSizeAndTextureMatchesContents", CSMC_BOTH), // Pause link animation (0 to 16) PRESET_ENTRY_S32("gPauseLiveLink", 16), @@ -734,9 +735,9 @@ const std::vector randomizerPresetEntries = { }; const std::vector s6PresetEntries = { - PRESET_ENTRY_S32("gChestSizeAndTextureMatchesContents", 1), + PRESET_ENTRY_S32("gChestSizeAndTextureMatchesContents", CSMC_BOTH), PRESET_ENTRY_S32("gFastChests", 1), - PRESET_ENTRY_S32("gMMBunnyHood", 2), + PRESET_ENTRY_S32("gMMBunnyHood", BUNNY_HOOD_FAST), PRESET_ENTRY_S32("gRandomizeBigPoeTargetCount", 1), PRESET_ENTRY_S32("gRandomizeCuccosToReturn", 4), PRESET_ENTRY_S32("gRandomizeDoorOfTime", RO_DOOROFTIME_OPEN), @@ -767,9 +768,9 @@ const std::vector s6PresetEntries = { }; const std::vector hellModePresetEntries = { - PRESET_ENTRY_S32("gChestSizeAndTextureMatchesContents", 1), + PRESET_ENTRY_S32("gChestSizeAndTextureMatchesContents", CSMC_BOTH), PRESET_ENTRY_S32("gFastChests", 1), - PRESET_ENTRY_S32("gMMBunnyHood", 2), + PRESET_ENTRY_S32("gMMBunnyHood", BUNNY_HOOD_FAST), PRESET_ENTRY_S32("gRandomizeBigPoeTargetCount", 1), PRESET_ENTRY_S32("gRandomizeBlueFireArrows", 1), PRESET_ENTRY_S32("gRandomizeBossKeysanity", RO_DUNGEON_ITEM_LOC_ANYWHERE), diff --git a/soh/soh/Enhancements/randomizer/randomizerTypes.h b/soh/soh/Enhancements/randomizer/randomizerTypes.h index 0cf490b8d..e9be6740c 100644 --- a/soh/soh/Enhancements/randomizer/randomizerTypes.h +++ b/soh/soh/Enhancements/randomizer/randomizerTypes.h @@ -1764,3 +1764,30 @@ typedef struct CowIdentity { RandomizerInf randomizerInf; RandomizerCheck randomizerCheck; } CowIdentity; + +typedef enum { + TRACKER_WINDOW_FLOATING, + TRACKER_WINDOW_WINDOW +} TrackerWindowType; + +typedef enum { + TRACKER_DISPLAY_ALWAYS, + TRACKER_DISPLAY_COMBO_BUTTON +} TrackerDisplayType; + +typedef enum { + TRACKER_COMBO_BUTTON_A, + TRACKER_COMBO_BUTTON_B, + TRACKER_COMBO_BUTTON_C_UP, + TRACKER_COMBO_BUTTON_C_DOWN, + TRACKER_COMBO_BUTTON_C_LEFT, + TRACKER_COMBO_BUTTON_C_RIGHT, + TRACKER_COMBO_BUTTON_L, + TRACKER_COMBO_BUTTON_Z, + TRACKER_COMBO_BUTTON_R, + TRACKER_COMBO_BUTTON_START, + TRACKER_COMBO_BUTTON_D_UP, + TRACKER_COMBO_BUTTON_D_DOWN, + TRACKER_COMBO_BUTTON_D_LEFT, + TRACKER_COMBO_BUTTON_D_RIGHT, +} TrackerComboButton; diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 3a1e2947c..6998c6bb5 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -8,6 +8,7 @@ #include #include "3drando/item_location.hpp" #include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "randomizerTypes.h" extern "C" { @@ -118,20 +119,21 @@ void CheckTrackerWindow::DrawElement() { return; } - if (CVarGetInteger("gCheckTrackerWindowType", 1) == 0) { - if (CVarGetInteger("gCheckTrackerShowOnlyPaused", 0) == 1) - if (gPlayState == nullptr || gPlayState->pauseCtx.state == 0) - return; + if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { + if (CVarGetInteger("gCheckTrackerShowOnlyPaused", 0) && (gPlayState == nullptr || gPlayState->pauseCtx.state == 0)) { + return; + } - if (CVarGetInteger("gCheckTrackerDisplayType", 0) == 1) { - int comboButton1Mask = buttons[CVarGetInteger("gCheckTrackerComboButton1", 6)]; - int comboButton2Mask = buttons[CVarGetInteger("gCheckTrackerComboButton2", 8)]; + 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(); bool comboButtonsHeld = trackerButtonsPressed != nullptr && trackerButtonsPressed[0].button & comboButton1Mask && trackerButtonsPressed[0].button & comboButton2Mask; - if (!comboButtonsHeld) + if (!comboButtonsHeld) { return; + } } } @@ -333,7 +335,7 @@ void BeginFloatWindows(std::string UniqueName, bool& open, ImGuiWindowFlags flag ImGuiWindowFlags_AlwaysVerticalScrollbar | ImGuiWindowFlags_NoFocusOnAppearing; } - if (!CVarGetInteger("gCheckTrackerWindowType", 1)) { + if (CVarGetInteger("gCheckTrackerWindowType", TRACKER_WINDOW_WINDOW) == TRACKER_WINDOW_FLOATING) { ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID); windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar; @@ -980,14 +982,14 @@ void CheckTrackerSettingsWindow::DrawElement() { } ImGui::PopItemWidth(); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", "gCheckTrackerWindowType", windowType, 1); - if (CVarGetInteger("gCheckTrackerWindowType", 1) == 0) { + 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", 0) > 0) { - UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", "gCheckTrackerComboButton1", buttonStrings, 6); - UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", "gCheckTrackerComboButton2", buttonStrings, 8); + 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::EnhancementCheckbox("Performance mode", "gCheckTrackerOptionPerformanceMode"); diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 9838b7461..f48018545 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -2,6 +2,7 @@ #include "../../util.h" #include "../../OTRGlobals.h" #include "../../UIWidgets.hpp" +#include "randomizerTypes.h" #include #include @@ -236,6 +237,25 @@ typedef enum { ITEM_TRACKER_NUMBER_AMMO, } ItemTrackerNumberOption; +typedef enum { + KEYS_COLLECTED_MAX, + KEYS_CURRENT_COLLECTED_MAX, + KEYS_CURRENT_MAX +} ItemTrackerKeysNumberOption; + +typedef enum { + SECTION_DISPLAY_HIDDEN, + SECTION_DISPLAY_MAIN_WINDOW, + SECTION_DISPLAY_SEPARATE +} ItemTrackerDisplayType; + +typedef enum { + SECTION_DISPLAY_EXTENDED_HIDDEN, + SECTION_DISPLAY_EXTENDED_MAIN_WINDOW, + SECTION_DISPLAY_EXTENDED_MISC_WINDOW, + SECTION_DISPLAY_EXTENDED_SEPARATE +} ItemTrackerExtendedDisplayType; + struct ItemTrackerNumbers { int currentCapacity; int maxCapacity; @@ -357,8 +377,8 @@ void DrawItemCount(ItemTrackerItem item) { int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); ItemTrackerNumbers currentAndMax = GetItemCurrentAndMax(item); ImVec2 p = ImGui::GetCursorScreenPos(); - int32_t trackerNumberDisplayMode = CVarGetInteger("gItemTrackerCapacityTrack", 1); - int32_t trackerKeyNumberDisplayMode = CVarGetInteger("gItemTrackerKeyTrack", 0); + int32_t trackerNumberDisplayMode = CVarGetInteger("gItemTrackerCapacityTrack", ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY); + int32_t trackerKeyNumberDisplayMode = CVarGetInteger("gItemTrackerKeyTrack", KEYS_COLLECTED_MAX); if (item.id == ITEM_KEY_SMALL && IsValidSaveFile()) { std::string currentString = ""; @@ -366,11 +386,11 @@ void DrawItemCount(ItemTrackerItem item) { ImU32 currentColor = IM_COL_WHITE; ImU32 maxColor = IM_COL_GREEN; // "Collected / Max", "Current / Collected / Max", "Current / Max" - if (trackerKeyNumberDisplayMode == 1 || trackerKeyNumberDisplayMode == 2) { + if (trackerKeyNumberDisplayMode == KEYS_CURRENT_COLLECTED_MAX || trackerKeyNumberDisplayMode == KEYS_CURRENT_MAX) { currentString+= std::to_string(currentAndMax.currentAmmo); currentString+= "/"; } - if (trackerKeyNumberDisplayMode == 0 || trackerKeyNumberDisplayMode == 1) { + if (trackerKeyNumberDisplayMode == KEYS_COLLECTED_MAX || trackerKeyNumberDisplayMode == KEYS_CURRENT_COLLECTED_MAX) { currentString+= std::to_string(currentAndMax.currentCapacity); currentString+= "/"; } @@ -648,7 +668,7 @@ void BeginFloatingWindows(std::string UniqueName, ImGuiWindowFlags flags = 0) { windowFlags |= ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoResize; } - if (!CVarGetInteger("gItemTrackerWindowType", 0)) { + if (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING) { ImGui::SetNextWindowViewport(ImGui::GetMainViewport()->ID); windowFlags |= ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoNav | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollWithMouse | ImGuiWindowFlags_NoScrollbar; @@ -675,7 +695,7 @@ void EndFloatingWindows() { void DrawItemsInRows(std::vector items, int columns = 6) { int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); - int topPadding = CVarGetInteger("gItemTrackerWindowType", 0) ? 20 : 0; + int topPadding = (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW) ? 20 : 0; for (int i = 0; i < items.size(); i++) { int row = i / columns; @@ -767,7 +787,7 @@ void UpdateVectors() { dungeonRewards.insert(dungeonRewards.end(), dungeonRewardMedallions.begin(), dungeonRewardMedallions.end()); dungeonItems.clear(); - if (CVarGetInteger("gItemTrackerDisplayDungeonItemsHorizontal", 1) && CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 2) { + if (CVarGetInteger("gItemTrackerDisplayDungeonItemsHorizontal", 1) && CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { if (CVarGetInteger("gItemTrackerDisplayDungeonItemsMaps", 1)) { dungeonItems = GetDungeonItemsVector(itemTrackerDungeonsWithMapsHorizontal, 12); // Manually adding Thieves Hideout to an open spot so we don't get an additional row for one item @@ -788,38 +808,39 @@ void UpdateVectors() { } mainWindowItems.clear(); - if (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", 1) == 1) { + if (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { mainWindowItems.insert(mainWindowItems.end(), inventoryItems.begin(), inventoryItems.end()); } - if (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", 1) == 1) { + if (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { mainWindowItems.insert(mainWindowItems.end(), equipmentItems.begin(), equipmentItems.end()); } - if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", 1) == 1) { + if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_MAIN_WINDOW) { mainWindowItems.insert(mainWindowItems.end(), miscItems.begin(), miscItems.end()); } - if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) == 1) { + if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 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", 1) == 1) { - if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", 1) == 1 && CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) != 1) { + 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) { 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", 0) == 1) { + if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 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", 0) == 2 && - CVarGetInteger("gItemTrackerMiscItemsDisplayType", 1) != 1 && + if (CVarGetInteger("gItemTrackerGregDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MISC_WINDOW && + CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) != SECTION_DISPLAY_MAIN_WINDOW && std::none_of(miscItems.begin(), miscItems.end(), [](ItemTrackerItem item){return item.id == ITEM_RUPEE_GREEN;})) { - + miscItems.insert(miscItems.end(), gregItems.begin(), gregItems.end()); } else { for (auto it = miscItems.begin(); it != miscItems.end();) { @@ -832,7 +853,7 @@ void UpdateVectors() { } // if we're adding greg to the main window - if (CVarGetInteger("gItemTrackerGregDisplayType", 0) == 1) { + if (CVarGetInteger("gItemTrackerGregDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) { // insert empty items until we're on a new row for greg while (mainWindowItems.size() % 6) { mainWindowItems.push_back(ITEM_TRACKER_ITEM(ITEM_NONE, 0, DrawItem)); @@ -850,53 +871,53 @@ void ItemTrackerWindow::DrawElement() { int iconSize = CVarGetInteger("gItemTrackerIconSize", 36); int iconSpacing = CVarGetInteger("gItemTrackerIconSpacing", 12); - int comboButton1Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton1", 6)]; - int comboButton2Mask = buttonMap[CVarGetInteger("gItemTrackerComboButton2", 8)]; + 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(); bool comboButtonsHeld = buttonsPressed != nullptr && buttonsPressed[0].button & comboButton1Mask && buttonsPressed[0].button & comboButton2Mask; bool isPaused = CVarGetInteger("gItemTrackerShowOnlyPaused", 0) == 0 || gPlayState != nullptr && gPlayState->pauseCtx.state > 0; - if (CVarGetInteger("gItemTrackerWindowType", 0) == 1 || isPaused && (CVarGetInteger("gItemTrackerDisplayType", 0) == 0 ? CVarGetInteger("gItemTrackerEnabled", 0) : comboButtonsHeld)) { + if (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW || isPaused && (CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS ? CVarGetInteger("gItemTrackerEnabled", 0) : comboButtonsHeld)) { if ( - (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", 1) == 1) || - (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", 1) == 1) || - (CVarGetInteger("gItemTrackerMiscItemsDisplayType", 1) == 1) || - (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) == 1) || - (CVarGetInteger("gItemTrackerSongsDisplayType", 1) == 1) || - (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 1) || - (CVarGetInteger("gItemTrackerGregDisplayType", 0) == 1) || - (CVarGetInteger("gItemTrackerNotesDisplayType", 0) == 1) + (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("gItemTrackerNotesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW) ) { BeginFloatingWindows("Item Tracker##main window"); DrawItemsInRows(mainWindowItems, 6); - if (CVarGetInteger("gItemTrackerNotesDisplayType", 0) == 1 && CVarGetInteger("gItemTrackerDisplayType", 0) == 0) { + if (CVarGetInteger("gItemTrackerNotesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW && CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { DrawNotes(); } EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", 1) == 2) { + if (CVarGetInteger("gItemTrackerInventoryItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Inventory Items Tracker"); DrawItemsInRows(inventoryItems); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", 1) == 2) { + if (CVarGetInteger("gItemTrackerEquipmentItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Equipment Items Tracker"); DrawItemsInRows(equipmentItems, 3); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", 1) == 2) { + if (CVarGetInteger("gItemTrackerMiscItemsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Misc Items Tracker"); DrawItemsInRows(miscItems, 4); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) == 2) { + if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Dungeon Rewards Tracker"); - if (CVarGetInteger("gItemTrackerDungeonRewardsCircle", 0) == 1) { + if (CVarGetInteger("gItemTrackerDungeonRewardsCircle", 0)) { ImGui::BeginGroup(); DrawItemsInACircle(dungeonRewardMedallions); ImGui::EndGroup(); @@ -909,13 +930,13 @@ void ItemTrackerWindow::DrawElement() { EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerSongsDisplayType", 1) == 2) { + if (CVarGetInteger("gItemTrackerSongsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Songs Tracker"); DrawItemsInRows(songItems); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 2) { + if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE) { BeginFloatingWindows("Dungeon Items Tracker"); if (CVarGetInteger("gItemTrackerDisplayDungeonItemsHorizontal", 1)) { if (CVarGetInteger("gItemTrackerDisplayDungeonItemsMaps", 1)) { @@ -929,13 +950,13 @@ void ItemTrackerWindow::DrawElement() { EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerGregDisplayType", 0) == 3) { + if (CVarGetInteger("gItemTrackerGregDisplayType", SECTION_DISPLAY_EXTENDED_HIDDEN) == SECTION_DISPLAY_EXTENDED_SEPARATE) { BeginFloatingWindows("Greg Tracker"); DrawItemsInRows(gregItems); EndFloatingWindows(); } - if (CVarGetInteger("gItemTrackerNotesDisplayType", 0) == 2 && CVarGetInteger("gItemTrackerDisplayType", 0) == 0) { + if (CVarGetInteger("gItemTrackerNotesDisplayType", SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_SEPARATE && CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { ImGui::SetNextWindowSize(ImVec2(400,300), ImGuiCond_FirstUseEver); BeginFloatingWindows("Personal Notes", ImGuiWindowFlags_NoFocusOnAppearing); DrawNotes(true); @@ -949,8 +970,8 @@ static const char* itemTrackerKeyTrackOptions[3] = { "Collected / Max", "Current static const char* windowTypes[2] = { "Floating", "Window" }; static const char* displayModes[2] = { "Always", "Combo Button Hold" }; static const char* buttons[14] = { "A", "B", "C-Up", "C-Down", "C-Left", "C-Right", "L", "Z", "R", "Start", "D-Up", "D-Down", "D-Left", "D-Right" }; -static const char* displayTypes[3] = { "Hidden", "Main Window", "Seperate" }; -static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Window", "Seperate" }; +static const char* displayTypes[3] = { "Hidden", "Main Window", "Separate" }; +static const char* extendedDisplayTypes[4] = { "Hidden", "Main Window", "Misc Window", "Separate" }; void ItemTrackerSettingsWindow::DrawElement() { ImGui::SetNextWindowSize(ImVec2(600,375), ImGuiCond_FirstUseEver); @@ -979,25 +1000,25 @@ void ItemTrackerSettingsWindow::DrawElement() { } ImGui::PopItemWidth(); - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", "gItemTrackerWindowType", windowTypes, 0)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Window Type", "gItemTrackerWindowType", windowTypes, TRACKER_WINDOW_FLOATING)) { shouldUpdateVectors = true; } - if (CVarGetInteger("gItemTrackerWindowType", 0) == 0) { + if (CVarGetInteger("gItemTrackerWindowType", TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING) { if (UIWidgets::PaddedEnhancementCheckbox("Enable Dragging", "gItemTrackerHudEditMode")) { shouldUpdateVectors = true; } if (UIWidgets::PaddedEnhancementCheckbox("Only enable while paused", "gItemTrackerShowOnlyPaused")) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", "gItemTrackerDisplayType", displayModes, 0)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Display Mode", "gItemTrackerDisplayType", displayModes, TRACKER_DISPLAY_ALWAYS)) { shouldUpdateVectors = true; } - if (CVarGetInteger("gItemTrackerDisplayType", 0) > 0) { - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", "gItemTrackerComboButton1", buttons, 6)) { + if (CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_COMBO_BUTTON) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 1", "gItemTrackerComboButton1", buttons, TRACKER_COMBO_BUTTON_L)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", "gItemTrackerComboButton2", buttons, 8)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Combo Button 2", "gItemTrackerComboButton2", buttons, TRACKER_COMBO_BUTTON_R)) { shouldUpdateVectors = true; } } @@ -1007,45 +1028,45 @@ void ItemTrackerSettingsWindow::DrawElement() { UIWidgets::EnhancementSliderInt("Icon margins : %dpx", "##ITEMTRACKERSPACING", "gItemTrackerIconSpacing", -5, 50, "", 12); ImGui::Text("Ammo/Capacity Tracking"); - UIWidgets::EnhancementCombobox("gItemTrackerCapacityTrack", itemTrackerCapacityTrackOptions, 1); + UIWidgets::EnhancementCombobox("gItemTrackerCapacityTrack", 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", 1) == ITEM_TRACKER_NUMBER_CURRENT_CAPACITY_ONLY || CVarGetInteger("gItemTrackerCapacityTrack", 1) == ITEM_TRACKER_NUMBER_CURRENT_AMMO_ONLY) { + 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")) { shouldUpdateVectors = true; } } ImGui::Text("Key Count Tracking"); - UIWidgets::EnhancementCombobox("gItemTrackerKeyTrack", itemTrackerKeyTrackOptions, 0); + UIWidgets::EnhancementCombobox("gItemTrackerKeyTrack", itemTrackerKeyTrackOptions, KEYS_COLLECTED_MAX); UIWidgets::InsertHelpHoverText("Customize what numbers are shown for key tracking."); ImGui::TableNextColumn(); - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Inventory", "gItemTrackerInventoryItemsDisplayType", displayTypes, 1)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Inventory", "gItemTrackerInventoryItemsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Equipment", "gItemTrackerEquipmentItemsDisplayType", displayTypes, 1)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Equipment", "gItemTrackerEquipmentItemsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Misc", "gItemTrackerMiscItemsDisplayType", displayTypes, 1)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Misc", "gItemTrackerMiscItemsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Rewards", "gItemTrackerDungeonRewardsDisplayType", displayTypes, 1)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Rewards", "gItemTrackerDungeonRewardsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { shouldUpdateVectors = true; } - if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", 1) == 2) { + if (CVarGetInteger("gItemTrackerDungeonRewardsDisplayType", SECTION_DISPLAY_MAIN_WINDOW) == SECTION_DISPLAY_SEPARATE) { if (UIWidgets::PaddedEnhancementCheckbox("Circle display", "gItemTrackerDungeonRewardsCircle", true, true, false, "", UIWidgets::CheckboxGraphics::Cross, true)) { shouldUpdateVectors = true; } } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Songs", "gItemTrackerSongsDisplayType", displayTypes, 1)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Songs", "gItemTrackerSongsDisplayType", displayTypes, SECTION_DISPLAY_MAIN_WINDOW)) { shouldUpdateVectors = true; } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Items", "gItemTrackerDungeonItemsDisplayType", displayTypes, 0)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Dungeon Items", "gItemTrackerDungeonItemsDisplayType", displayTypes, SECTION_DISPLAY_HIDDEN)) { shouldUpdateVectors = true; } - if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) != 0) { - if (CVarGetInteger("gItemTrackerDungeonItemsDisplayType", 0) == 2) { + 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)) { shouldUpdateVectors = true; } @@ -1054,12 +1075,12 @@ void ItemTrackerSettingsWindow::DrawElement() { shouldUpdateVectors = true; } } - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Greg", "gItemTrackerGregDisplayType", extendedDisplayTypes, 0)) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Greg", "gItemTrackerGregDisplayType", extendedDisplayTypes, SECTION_DISPLAY_EXTENDED_HIDDEN)) { shouldUpdateVectors = true; } - if (CVarGetInteger("gItemTrackerDisplayType", 0) != 1) { - if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Personal notes", "gItemTrackerNotesDisplayType", displayTypes, 0)) { + if (CVarGetInteger("gItemTrackerDisplayType", TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { + if (UIWidgets::LabeledRightAlignedEnhancementCombobox("Personal notes", "gItemTrackerNotesDisplayType", displayTypes, SECTION_DISPLAY_HIDDEN)) { shouldUpdateVectors = true; } } diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index d028ec79f..09b9aacd4 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -60,7 +60,7 @@ std::string GetWindowButtonText(const char* text, bool menuOpen) { "Linear", "None" }; - static const char* chestSizeAndTextureMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" }; + static const char* chestStyleMatchesContentsOptions[4] = { "Disabled", "Both", "Texture Only", "Size Only" }; static const char* bunnyHoodOptions[3] = { "Disabled", "Faster Run & Longer Jump", "Faster Run" }; static const char* allPowers[9] = { "Vanilla (1x)", @@ -405,7 +405,7 @@ void DrawSettingsMenu() { // If more filters are added to LUS, make sure to add them to the filters list here ImGui::Text("Texture Filter (Needs reload)"); - UIWidgets::EnhancementCombobox("gTextureFilter", filters, 0); + UIWidgets::EnhancementCombobox("gTextureFilter", filters, FILTER_THREE_POINT); UIWidgets::Spacer(0); @@ -480,8 +480,8 @@ void DrawEnhancementsMenu() { UIWidgets::PaddedEnhancementCheckbox("Fast Chests", "gFastChests", true, false); UIWidgets::Tooltip("Kick open every chest"); UIWidgets::PaddedText("Chest size & texture matches contents", true, false); - if (UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestSizeAndTextureMatchesContentsOptions, 0)) { - if (CVarGetInteger("gChestSizeAndTextureMatchesContents", 0) == 0) { + if (UIWidgets::EnhancementCombobox("gChestSizeAndTextureMatchesContents", chestStyleMatchesContentsOptions, CSMC_DISABLED)) { + if (CVarGetInteger("gChestSizeAndTextureMatchesContents", CSMC_DISABLED) == CSMC_DISABLED) { CVarSetInteger("gChestSizeDependsStoneOfAgony", 0); } } @@ -494,7 +494,7 @@ void DrawEnhancementsMenu() { " - Boss keys: Vanilla size and texture\n" " - Skulltula Tokens: Small skulltula chest\n" ); - if (CVarGetInteger("gChestSizeAndTextureMatchesContents", 0) > 0) { + if (CVarGetInteger("gChestSizeAndTextureMatchesContents", CSMC_DISABLED) != CSMC_DISABLED) { UIWidgets::PaddedEnhancementCheckbox("Chests of Agony", "gChestSizeDependsStoneOfAgony", true, false); UIWidgets::Tooltip("Only change the size/texture of chests if you have the Stone of Agony."); } @@ -551,7 +551,7 @@ void DrawEnhancementsMenu() { UIWidgets::PaddedEnhancementCheckbox("Prevent Dropped Ocarina Inputs", "gDpadNoDropOcarinaInput", true, false); UIWidgets::Tooltip("Prevent dropping inputs when playing the ocarina quickly"); UIWidgets::PaddedText("Bunny Hood Effect", true, false); - UIWidgets::EnhancementCombobox("gMMBunnyHood", bunnyHoodOptions, 0); + UIWidgets::EnhancementCombobox("gMMBunnyHood", 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." @@ -616,7 +616,7 @@ void DrawEnhancementsMenu() { "64x: Cannot survive void damage" ); UIWidgets::PaddedText("Bonk Damage Multiplier", true, false); - UIWidgets::EnhancementCombobox("gBonkDamageMul", bonkDamageValues, 0); + UIWidgets::EnhancementCombobox("gBonkDamageMul", bonkDamageValues, BONK_DAMAGE_NONE); UIWidgets::Tooltip("Modifies damage taken after bonking."); UIWidgets::PaddedEnhancementCheckbox("Spawn with full health", "gFullHealthSpawn", true, false); UIWidgets::Tooltip("Respawn with full health instead of 3 Hearts"); @@ -925,7 +925,7 @@ void DrawEnhancementsMenu() { ImGui::EndMenu(); } UIWidgets::PaddedText("Fix Vanishing Paths", true, false); - if (UIWidgets::EnhancementCombobox("gSceneSpecificDirtPathFix", zFightingOptions, 0) && gPlayState != NULL) { + if (UIWidgets::EnhancementCombobox("gSceneSpecificDirtPathFix", 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" @@ -1047,7 +1047,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, 0); + UIWidgets::EnhancementCombobox("gAutosave", 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)"); diff --git a/soh/src/code/z_face_reaction.c b/soh/src/code/z_face_reaction.c index c262cd3a2..899c6afc6 100644 --- a/soh/src/code/z_face_reaction.c +++ b/soh/src/code/z_face_reaction.c @@ -1,4 +1,5 @@ #include "global.h" +#include "soh/Enhancements/enhancementTypes.h" u16 sReactionTextIds[][PLAYER_MASK_MAX] = { { 0x0000, 0x7124, 0x7127, 0x7126, 0x7125, 0x7127, 0x7124, 0x7125, 0x7127 }, @@ -66,7 +67,7 @@ u16 sReactionTextIds[][PLAYER_MASK_MAX] = { u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) { u8 currentMask = Player_GetMask(play); - if (CVarGetInteger("gMMBunnyHood", 0) && currentMask == PLAYER_MASK_BUNNY) { + if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && currentMask == PLAYER_MASK_BUNNY) { return 0; } else { return sReactionTextIds[reactionSet][currentMask]; diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 881637d8d..a13c36f4c 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -7,6 +7,7 @@ #include "textures/parameter_static/parameter_static.h" #include "textures/message_static/message_static.h" #include "textures/message_texture_static/message_texture_static.h" +#include "soh/Enhancements/cosmetics/cosmeticsTypes.h" s16 sTextFade = false; // original name: key_off_flag ? @@ -97,7 +98,7 @@ void Message_ResetOcarinaNoteState(void) { 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", 0)) { + } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { sOcarinaNoteABtnPrim = (Color_RGB8){ 80, 255, 150 }; } if (CVarGetInteger("gCosmetics.Hud_CButtons.Changed", 0)) { @@ -465,7 +466,7 @@ void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) { sIconPrimColors[0].b = (color.b / 255) * 95; sIconPrimColors[1] = color; sIconEnvColors[1] = color; - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) { + } else if (CVarGetInteger("gCosmetics.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 }; @@ -2017,7 +2018,7 @@ void Message_DrawMain(PlayState* play, Gfx** p) { sOcarinaNoteAPrimColors[0].b = (color.b / 255) * 95; sOcarinaNoteAPrimColors[1] = color; sOcarinaNoteAEnvColors[1] = color; - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) { + } else if (CVarGetInteger("gCosmetics.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 }; diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 83066aff4..a05cd2de2 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -10,6 +10,8 @@ #include "soh/Enhancements/gameplaystats.h" #include "soh/Enhancements/boss-rush/BossRushTypes.h" #include "soh/Enhancements/custom-message/CustomMessageInterfaceAddon.h" +#include "soh/Enhancements/cosmetics/cosmeticsTypes.h" +#include "soh/Enhancements/enhancementTypes.h" #ifdef _MSC_VER #include @@ -1127,7 +1129,7 @@ void func_80083108(PlayState* play) { if (interfaceCtx->restrictions.tradeItems != 0) { for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { - if ((CVarGetInteger("gMMBunnyHood", 0) != 0) + if ((CVarGetInteger("gMMBunnyHood", 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; @@ -3704,7 +3706,7 @@ void Interface_DrawItemButtons(PlayState* play) { 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", 0)) { + } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { bButtonColor = (Color_RGB8){ 255, 30, 30 }; } @@ -3732,7 +3734,7 @@ void Interface_DrawItemButtons(PlayState* play) { 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", 0)) { + } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { startButtonColor = (Color_RGB8){ 120, 120, 120 }; } @@ -4828,7 +4830,7 @@ void Interface_Draw(PlayState* play) { 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", 0)) { + } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = (Color_RGB8){ 0, 200, 50 }; } diff --git a/soh/src/code/z_play.c b/soh/src/code/z_play.c index b76555b06..59257ad9f 100644 --- a/soh/src/code/z_play.c +++ b/soh/src/code/z_play.c @@ -9,6 +9,7 @@ #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" #include +#include "soh/Enhancements/enhancementTypes.h" #include @@ -644,7 +645,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", 0) || CVarGetInteger("gTimelessEquipment", 0)) { + if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA || CVarGetInteger("gTimelessEquipment", 0)) { gItemAgeReqs[ITEM_MASK_BUNNY] = 9; if(INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY) gSlotAgeReqs[SLOT_TRADE_CHILD] = 9; @@ -1177,7 +1178,7 @@ void Play_Update(PlayState* play) { gSaveContext.sohStats.sceneTimer++; gSaveContext.sohStats.roomTimer++; - if (CVarGetInteger("gMMBunnyHood", 0) && Player_GetMask(play) == PLAYER_MASK_BUNNY) { + if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && Player_GetMask(play) == PLAYER_MASK_BUNNY) { gSaveContext.sohStats.count[COUNT_TIME_BUNNY_HOOD]++; } } @@ -2287,7 +2288,7 @@ void Play_PerformSave(PlayState* play) { } else { Save_SaveFile(); } - if (CVarGetInteger("gAutosave", 0)) { + if (CVarGetInteger("gAutosave", AUTOSAVE_OFF) != AUTOSAVE_OFF) { Overlay_DisplayText(3.0f, "Game Saved"); } } diff --git a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 8765e4c51..1fa024c28 100644 --- a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -2548,7 +2548,7 @@ void BossTw_DeathCSMsgSfx(BossTw* this, PlayState* play) { Math_ApproachF(&this->workf[UNK_F18], 255.0f, 0.1f, 5.0f); } - // Add seperate timings for the "beam" that opens and closes around the sisters + // Add separate timings for the "beam" that opens and closes around the sisters // Needed because we skip ahead in cutscene timer value so it never gets called otherwise if (gSaveContext.n64ddFlag || gSaveContext.isBossRush) { if (this->work[CS_TIMER_2] < 900) { 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 927914371..932d4a16d 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 @@ -1,6 +1,7 @@ #include "z_en_box.h" #include "objects/object_box/object_box.h" #include "soh_assets.h" +#include "soh/Enhancements/enhancementTypes.h" #define FLAGS 0 @@ -632,11 +633,11 @@ void EnBox_Update(Actor* thisx, PlayState* play) { void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) { EnBox_CreateExtraChestTextures(); - int cstmc = CVarGetInteger("gChestSizeAndTextureMatchesContents", 0); + int csmc = CVarGetInteger("gChestSizeAndTextureMatchesContents", CSMC_DISABLED); int requiresStoneAgony = CVarGetInteger("gChestSizeDependsStoneOfAgony", 0); GetItemCategory getItemCategory; - int isVanilla = cstmc == 0 || (requiresStoneAgony && !CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)) || + int isVanilla = csmc == CSMC_DISABLED || (requiresStoneAgony && !CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)) || (play->sceneNum == SCENE_TAKARAYA && this->dyna.actor.room != 6); // Exclude treasure game chests except for the final room if (!isVanilla) { @@ -656,7 +657,7 @@ void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) { } // Change size - if (!isVanilla && (cstmc == 1 || cstmc == 3)) { + if (!isVanilla && (csmc == CSMC_BOTH || csmc == CSMC_SIZE)) { switch (getItemCategory) { case ITEM_CATEGORY_JUNK: case ITEM_CATEGORY_SMALL_KEY: @@ -685,7 +686,7 @@ void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) { } // Change texture - if (!isVanilla && (cstmc == 1 || cstmc == 2)) { + if (!isVanilla && (csmc == CSMC_BOTH || csmc == CSMC_TEXTURE)) { switch (getItemCategory) { case ITEM_CATEGORY_MAJOR: this->boxBodyDL = gGoldTreasureChestChestFrontDL; 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 163a8b86b..5be8e1012 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 @@ -14,6 +14,7 @@ #include "objects/object_masterzoora/object_masterzoora.h" #include "objects/object_masterkokirihead/object_masterkokirihead.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" +#include "soh/Enhancements/cosmetics/cosmeticsTypes.h" #define FLAGS (ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_WHILE_CULLED) @@ -1939,7 +1940,7 @@ 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", 0)) { + } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = (Color_RGB8){ 0, 255, 80 }; } f32 t; 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 80867a56b..bca9561ed 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -25,6 +25,7 @@ #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" #include +#include "soh/Enhancements/enhancementTypes.h" typedef enum { /* 0x00 */ KNOB_ANIM_ADULT_L, @@ -2049,7 +2050,7 @@ void func_80833DF8(Player* this, PlayState* play) { s32 i; if (this->currentMask != PLAYER_MASK_NONE) { - if (CVarGetInteger("gMMBunnyHood", 0) != 0) { + if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) { s32 maskItem = this->currentMask - PLAYER_MASK_KEATON + ITEM_MASK_KEATON; bool hasOnDpad = false; if (CVarGetInteger("gDpadEquips", 0) != 0) { @@ -6119,7 +6120,7 @@ void func_8083DFE0(Player* this, f32* arg1, s16* arg2) { } } - if (CVarGetInteger("gMMBunnyHood", 0) == 1 && this->currentMask == PLAYER_MASK_BUNNY) { + if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) == BUNNY_HOOD_FAST_AND_JUMP && this->currentMask == PLAYER_MASK_BUNNY) { maxSpeed *= 1.5f; } @@ -7761,9 +7762,9 @@ void func_80842180(Player* this, PlayState* play) { } } - if (CVarGetInteger("gMMBunnyHood", 0) && this->currentMask == PLAYER_MASK_BUNNY) { + if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA && this->currentMask == PLAYER_MASK_BUNNY) { sp2C *= 1.5f; - } + } if (CVarGetInteger("gEnableWalkModify", 0)) { if (CVarGetInteger("gWalkSpeedToggle", 0)) { @@ -9664,7 +9665,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { func_80835F44(play, this, ITEM_NONE); Player_SetEquipmentData(play, this); this->prevBoots = this->currentBoots; - if (CVarGetInteger("gMMBunnyHood", 0)) { + if (CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA) { if (INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_SOLD_OUT) { sMaskMemory = PLAYER_MASK_NONE; } 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 e88e76a4a..5a97863c2 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 @@ -13,6 +13,7 @@ #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/boss-rush/BossRush.h" #include "soh/Enhancements/custom-message/CustomMessageTypes.h" +#include "soh/Enhancements/enhancementTypes.h" #define MIN_QUEST (ResourceMgr_GameHasOriginal() ? FS_QUEST_NORMAL : FS_QUEST_MASTER) #define MAX_QUEST FS_QUEST_BOSSRUSH @@ -2497,15 +2498,15 @@ void FileChoose_Main(GameState* thisx) { gSaveContext.skyboxTime += 0x10; } - if (CVarGetInteger("gSkipLogoTitle", 0) && CVarGetInteger("gSaveFileID", 0) < 3 && !isFastFileIdIncompatible) { - if (Save_Exist(CVarGetInteger("gSaveFileID", 0)) && FileChoose_IsSaveCompatible(Save_GetSaveMetaInfo(CVarGetInteger("gSaveFileID", 0)))) { - this->buttonIndex = CVarGetInteger("gSaveFileID", 0); + 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); this->menuMode = FS_MENU_MODE_SELECT; this->selectMode = SM_LOAD_GAME; } else { isFastFileIdIncompatible = 1; } - } else if (CVarGetInteger("gSkipLogoTitle", 0) && CVarGetInteger("gSaveFileID", 0) == 3) { + } else if (CVarGetInteger("gSkipLogoTitle", 0) && CVarGetInteger("gSaveFileID", FASTFILE_1) == FASTFILE_MAP_SELECT) { this->buttonIndex = 0xFF; this->menuMode = FS_MENU_MODE_SELECT; this->selectMode = SM_LOAD_GAME; 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 99888adcc..d8a678e91 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 @@ -1,6 +1,7 @@ #include "z_kaleido_scope.h" #include "textures/parameter_static/parameter_static.h" #include "textures/icon_item_static/icon_item_static.h" +#include "soh/Enhancements/cosmetics/cosmeticsTypes.h" extern const char* digitTextures[]; @@ -8,7 +9,7 @@ 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", 0)) { + } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = (Color_RGB8){ 80, 255, 150 }; } 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 53bec6c7a..2477d7d18 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 @@ -2,6 +2,7 @@ #include "textures/parameter_static/parameter_static.h" #include "soh/Enhancements/randomizer/adult_trade_shuffle.h" #include "soh/Enhancements/randomizer/randomizerTypes.h" +#include "soh/Enhancements/enhancementTypes.h" u8 gAmmoItems[] = { ITEM_STICK, ITEM_NUT, ITEM_BOMB, ITEM_BOW, ITEM_NONE, ITEM_NONE, ITEM_SLINGSHOT, ITEM_NONE, @@ -401,7 +402,7 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { gSelectingMask = cursorSlot == SLOT_TRADE_CHILD; gSlotAgeReqs[SLOT_TRADE_CHILD] = gItemAgeReqs[ITEM_MASK_BUNNY] = - ((CVarGetInteger("gMMBunnyHood", 0) || CVarGetInteger("gTimelessEquipment", 0)) && + ((CVarGetInteger("gMMBunnyHood", BUNNY_HOOD_VANILLA) != BUNNY_HOOD_VANILLA || CVarGetInteger("gTimelessEquipment", 0)) && INV_CONTENT(ITEM_TRADE_CHILD) == ITEM_MASK_BUNNY) ? 9 : 1; 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 773f5b6f8..6ec602abb 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 @@ -16,6 +16,7 @@ #include "soh/frame_interpolation.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/randomizer/randomizer_entrance.h" +#include "soh/Enhancements/cosmetics/cosmeticsTypes.h" static void* sEquipmentFRATexs[] = { gPauseEquipment00FRATex, gPauseEquipment01Tex, gPauseEquipment02Tex, gPauseEquipment03Tex, gPauseEquipment04Tex, @@ -999,7 +1000,7 @@ void KaleidoScope_DrawCursor(PlayState* play, u16 pageIndex) { if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { sCursorColors[2] = CVarGetColor24("gCosmetics.Hud_AButton.Value", sCursorColors[2]); - } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", 0)) { + } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { sCursorColors[2] = (Color_RGB8){ 0, 255, 50 }; } @@ -1082,7 +1083,7 @@ void KaleidoScope_DrawPages(PlayState* play, GraphicsContext* gfxCtx) { 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", 0)) { + } else if (CVarGetInteger("gCosmetics.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 }; @@ -1540,7 +1541,7 @@ 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", 0)) { + } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { aButtonColor = (Color_RGB8){ 0, 255, 100 }; }