diff --git a/CMake/lus-cvars.cmake b/CMake/lus-cvars.cmake index f6a036479..c64782e75 100644 --- a/CMake/lus-cvars.cmake +++ b/CMake/lus-cvars.cmake @@ -1,7 +1,5 @@ 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 "") diff --git a/CMakeLists.txt b/CMakeLists.txt index ec9f14f5b..cf9c55b5e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.26.0 FATAL_ERROR) set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") +set(CMAKE_C_STANDARD 23 CACHE STRING "The C standard to use") set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version") diff --git a/libultraship b/libultraship index ffc062cbf..6a3f6cd32 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit ffc062cbf44ce8dc07ac9fc0185224010bd78cc5 +Subproject commit 6a3f6cd327b99f617b623e5b9a3afeae460aac2b diff --git a/run-clang-format.ps1 b/run-clang-format.ps1 index 39905f9ed..063cec7af 100644 --- a/run-clang-format.ps1 +++ b/run-clang-format.ps1 @@ -39,7 +39,7 @@ $files = Get-ChildItem -Path $basePath\soh -Recurse -File ` | Where-Object { ($_.Extension -eq '.c' -or $_.Extension -eq '.cpp' -or ` (($_.Extension -eq '.h' -or $_.Extension -eq '.hpp') -and ` (-not ($_.FullName -like "*\soh\src\*" -or $_.FullName -like "*\soh\include\*")))) -and ` - (-not ($_.FullName -like "*\soh\assets\*")) } + (-not ($_.FullName -like "*\soh\assets\*" -or $_.FullName -like "*\soh\build\*")) } for ($i = 0; $i -lt $files.Length; $i++) { $file = $files[$i] diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index 7277b2dfb..19851f690 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -4,6 +4,7 @@ set(CMAKE_SYSTEM_VERSION 10.0 CACHE STRING "" FORCE) project(soh LANGUAGES C CXX) set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") +set(CMAKE_C_STANDARD 23 CACHE STRING "The C standard to use") if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") enable_language(OBJCXX) @@ -511,10 +512,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-parentheses -Wno-narrowing -Wno-missing-braces - -Wno-int-conversion $<$: -Werror-implicit-function-declaration -Wno-incompatible-pointer-types + -Wno-int-conversion > $<$:-fpermissive> $<$: @@ -587,11 +588,11 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang") -Wno-parentheses -Wno-narrowing -Wno-missing-braces - -Wno-int-conversion - -Wno-implicit-int $<$: -Werror-implicit-function-declaration + -Wno-implicit-int -Wno-incompatible-pointer-types + -Wno-int-conversion > $<$:-fpermissive> $<$:-Wno-deprecated-enum-enum-conversion> diff --git a/soh/assets/custom/presets/Main Default.json b/soh/assets/custom/presets/Main Default.json new file mode 100644 index 000000000..7d87c3d95 --- /dev/null +++ b/soh/assets/custom/presets/Main Default.json @@ -0,0 +1,11 @@ +{ + "blocks": { + "enhancements": { + "gCheats": null, + "gEnhancements": null, + "gRandoEnhancements": null + } + }, + "presetName": "Main Default", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Main Enhanced.json b/soh/assets/custom/presets/Main Enhanced.json new file mode 100644 index 000000000..026a78de7 --- /dev/null +++ b/soh/assets/custom/presets/Main Enhanced.json @@ -0,0 +1,56 @@ +{ + "blocks": { + "enhancements": { + "gCheats": null, + "gEnhancements": { + "AssignableTunicsAndBoots": 1, + "Autosave": 1, + "BetterOwl": 1, + "CreditsFix": 1, + "CustomizeFrogsOcarinaGame": 1, + "DekuNutUpgradeFix": 1, + "DisableLOD": 1, + "DpadEquips": 1, + "DpadNoDropOcarinaInput": 1, + "DynamicWalletIcon": 1, + "EnemySpawnsOverWaterboxes": 1, + "FasterRupeeAccumulator": 1, + "FixBrokenGiantsKnife": 1, + "FixDaruniaDanceSpeed": 1, + "FixDungeonMinimapIcon": 1, + "FixEyesOpenWhileSleeping": 1, + "FixFloorSwitches": 1, + "FixHammerHand": 1, + "FixMenuLR": 1, + "FixSawSoftlock": 1, + "FixTexturesOOB": 1, + "FixVineFall": 1, + "FixZoraHintDialogue": 1, + "FrogsModifyFailTime": 2, + "GerudoWarriorClothingFix": 1, + "GravediggingTourFix": 1, + "InjectItemCounts": { + "GoldSkulltula": 1, + "HeartContainer": 1, + "HeartPiece": 1 + }, + "NaviTextFix": 1, + "PulsateBossIcon": 1, + "RedGanonBlood": 1, + "RememberMapToggleState": 1, + "SceneSpecificDirtPathFix": 1, + "SilverRupeeJingleExtend": 1, + "SkipSaveConfirmation": 1, + "SkipText": 1, + "TextSpeed": 5, + "TimeFlowFileSelect": 1, + "TwoHandedIdle": 1, + "VisualAgony": 1, + "WidescreenActorCulling": 1 + }, + "gRandoEnhancements": null + } + }, + "presetName": "Main Enhanced", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Main Randomizer.json b/soh/assets/custom/presets/Main Randomizer.json new file mode 100644 index 000000000..59c24e982 --- /dev/null +++ b/soh/assets/custom/presets/Main Randomizer.json @@ -0,0 +1,135 @@ +{ + "blocks": { + "enhancements": { + "gCheats": { + "EasyFrameAdvance": 1 + }, + "gEnhancements": { + "AdultMasks": 1, + "AssignableTunicsAndBoots": 1, + "Autosave": 1, + "BetterAmmoRendering": 1, + "BetterBombchuShopping": 1, + "BetterFarore": 1, + "BetterOwl": 1, + "BombchusOOB": 1, + "ClimbSpeed": 3, + "CrawlSpeed": 2, + "CreditsFix": 1, + "CustomizeFishing": 1, + "CustomizeFrogsOcarinaGame": 1, + "CustomizeOcarinaGame": 1, + "DampeAllNight": 1, + "DampeWin": 1, + "DayGravePull": 1, + "DekuNutUpgradeFix": 1, + "DisableCritWiggle": 1, + "DisableFirstPersonChus": 1, + "DisableLOD": 1, + "DpadEquips": 1, + "DpadNoDropOcarinaInput": 1, + "DynamicWalletIcon": 1, + "EarlyEyeballFrog": 1, + "EnemySpawnsOverWaterboxes": 1, + "EquipmentCanBeRemoved": 1, + "ExtendedCullingExcludeGlitchActors": 1, + "FastBoomerang": 1, + "FastChests": 1, + "FastDrops": 1, + "FastFarores": 1, + "FastOcarinaPlayback": 1, + "FasterBlockPush": 5, + "FasterHeavyBlockLift": 1, + "FasterRupeeAccumulator": 1, + "FileSelectMoreInfo": 1, + "FishNeverEscape": 1, + "FixBrokenGiantsKnife": 1, + "FixDaruniaDanceSpeed": 1, + "FixDungeonMinimapIcon": 1, + "FixFloorSwitches": 1, + "FixHammerHand": 1, + "FixMenuLR": 1, + "FixSawSoftlock": 1, + "FixTexturesOOB": 1, + "FixVineFall": 1, + "FixZoraHintDialogue": 1, + "ForgeTime": 0, + "FrogsModifyFailTime": 2, + "GerudoWarriorClothingFix": 1, + "GoronPot": 1, + "GravediggingTourFix": 1, + "GuaranteeFishingBite": 1, + "HoverFishing": 1, + "IncludeHeldInputsBufferWindow": 1, + "InjectItemCounts": { + "GoldSkulltula": 1, + "HeartContainer": 1, + "HeartPiece": 1 + }, + "InstantPutaway": 1, + "InstantScarecrow": 1, + "MMBunnyHood": 1, + "MarketSneak": 1, + "MaskSelect": 1, + "MinimumFishWeightAdult": 6, + "MinimumFishWeightChild": 3, + "MweepSpeed": 5.0, + "N64WeirdFrames": 1, + "NaviTextFix": 1, + "NewDrops": 1, + "NoInputForCredits": 1, + "NutsExplodeBombs": 1, + "OcarinaGame": { + "StartingNotes": 5 + }, + "PauseMenuAnimatedLink": 1, + "PauseWarp": 1, + "PersistentMasks": 1, + "PulsateBossIcon": 1, + "QuickBongoKill": 1, + "QuickPutaway": 1, + "QuitFishingAtDoor": 1, + "RedGanonBlood": 1, + "RememberMapToggleState": 1, + "SceneSpecificDirtPathFix": 1, + "SeparateArrows": 1, + "ShowDoorLocksOnBothSides": 1, + "SilverRupeeJingleExtend": 1, + "SkipArrowAnimation": 1, + "SkipSaveConfirmation": 1, + "SkipSwimDeepEndAnim": 1, + "SkipText": 1, + "SlowTextSpeed": 5, + "SwordToggle": 1, + "TextSpeed": 5, + "TimeFlowFileSelect": 1, + "TimeSavers": { + "DisableTitleCard": 1, + "SkipChildStealth": 1, + "SkipCutscene": { + "BossIntro": 1, + "Entrances": 1, + "Intro": 1, + "LearnSong": 1, + "OnePoint": 1, + "QuickBossDeaths": 1, + "Story": 1 + }, + "SkipForcedDialog": 3, + "SkipMiscInteractions": 1, + "SkipOwlInteractions": 1, + "SkipTowerEscape": 1, + "SleepingWaterfall": 1 + }, + "ToTMedallionsColors": 1, + "ToggleStrength": 1, + "TwoHandedIdle": 1, + "VisualAgony": 1, + "WidescreenActorCulling": 1 + }, + "gRandoEnhancements": null + } + }, + "presetName": "Main Randomizer", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Main Vanilla+.json b/soh/assets/custom/presets/Main Vanilla+.json new file mode 100644 index 000000000..0f6c1741a --- /dev/null +++ b/soh/assets/custom/presets/Main Vanilla+.json @@ -0,0 +1,56 @@ +{ + "blocks": { + "enhancements": { + "gCheats": null, + "gEnhancements": { + "AssignableTunicsAndBoots": 1, + "Autosave": 1, + "BetterOwl": 1, + "CreditsFix": 1, + "CustomizeFrogsOcarinaGame": 1, + "DekuNutUpgradeFix": 1, + "DisableLOD": 1, + "DpadEquips": 1, + "DpadNoDropOcarinaInput": 1, + "DynamicWalletIcon": 1, + "EnemySpawnsOverWaterboxes": 1, + "FasterRupeeAccumulator": 1, + "FixBrokenGiantsKnife": 1, + "FixDaruniaDanceSpeed": 1, + "FixDungeonMinimapIcon": 1, + "FixEyesOpenWhileSleeping": 1, + "FixFloorSwitches": 1, + "FixHammerHand": 1, + "FixMenuLR": 1, + "FixSawSoftlock": 1, + "FixTexturesOOB": 1, + "FixVineFall": 1, + "FixZoraHintDialogue": 1, + "FrogsModifyFailTime": 2, + "GerudoWarriorClothingFix": 1, + "GravediggingTourFix": 1, + "InjectItemCounts": { + "GoldSkulltula": 1, + "HeartContainer": 1, + "HeartPiece": 1 + }, + "NaviTextFix": 1, + "PulsateBossIcon": 1, + "RedGanonBlood": 1, + "RememberMapToggleState": 1, + "SceneSpecificDirtPathFix": 1, + "SilverRupeeJingleExtend": 1, + "SkipSaveConfirmation": 1, + "SkipText": 1, + "TextSpeed": 5, + "TimeFlowFileSelect": 1, + "TwoHandedIdle": 1, + "VisualAgony": 1, + "WidescreenActorCulling": 1 + }, + "gRandoEnhancements": null + } + }, + "presetName": "Main Vanilla+", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Advanced.json b/soh/assets/custom/presets/Rando Advanced.json new file mode 100644 index 000000000..4042c0688 --- /dev/null +++ b/soh/assets/custom/presets/Rando Advanced.json @@ -0,0 +1,69 @@ +{ + "blocks": { + "rando": { + "gRandoSettings": { + "40GSHint": 1, + "50GSHint": 1, + "BigPoeTargetCount": 1, + "BlueFireArrows": 1, + "BombchuBag": 1, + "BossKeysanity": 5, + "ClosedForest": 2, + "CompleteMaskQuest": 1, + "CuccosToReturn": 1, + "DampeHint": 1, + "DoorOfTime": 2, + "EnableBombchuDrops": 1, + "FortressCarpenters": 1, + "FrogsHint": 1, + "FullWallets": 1, + "GanonTrial": 0, + "GerudoKeys": 3, + "GregHint": 1, + "HBAHint": 1, + "IncludeTycoonWallet": 1, + "KakarikoGate": 1, + "Keysanity": 5, + "LacsRewardCount": 8, + "MalonHint": 1, + "MerchantText": 1, + "RainbowBridge": 7, + "SariaHint": 1, + "ScrubsFixedPrice": 2, + "ScrubsPrices": 3, + "SheikLAHint": 0, + "Shopsanity": 1, + "ShopsanityCount": 7, + "ShopsanityPrices": 2, + "ShuffleAdultTrade": 1, + "ShuffleBossEntrances": 2, + "ShuffleCows": 1, + "ShuffleDekuNutBag": 1, + "ShuffleDekuStickBag": 1, + "ShuffleDungeonsEntrances": 2, + "ShuffleFrogSongRupees": 1, + "ShuffleGanonBossKey": 9, + "ShuffleGerudoToken": 1, + "ShuffleKeyRings": 2, + "ShuffleKeyRingsRandomCount": 4, + "ShuffleKokiriSword": 1, + "ShuffleMasterSword": 1, + "ShuffleMerchants": 3, + "ShuffleOcarinas": 1, + "ShuffleOverworldSpawns": 1, + "ShuffleScrubs": 2, + "ShuffleSongs": 2, + "ShuffleSwim": 1, + "ShuffleTokens": 3, + "SkipChildZelda": 1, + "SkipEponaRace": 1, + "SkipScarecrowsSong": 1, + "StartingAge": 2, + "StartingMapsCompasses": 0, + "SunlightArrows": 1 + } + } + }, + "presetName": "Rando Advanced", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Beginner.json b/soh/assets/custom/presets/Rando Beginner.json new file mode 100644 index 000000000..595734fe0 --- /dev/null +++ b/soh/assets/custom/presets/Rando Beginner.json @@ -0,0 +1,51 @@ +{ + "blocks": { + "rando": { + "gRandoSettings": { + "10GSHint": 1, + "20GSHint": 1, + "30GSHint": 1, + "40GSHint": 1, + "50GSHint": 1, + "BigPoeTargetCount": 1, + "BiggoronHint": 1, + "BlueFireArrows": 1, + "BossKeysanity": 2, + "ClosedForest": 2, + "CompleteMaskQuest": 1, + "CuccosToReturn": 1, + "DampeHint": 1, + "DoorOfTime": 2, + "EnableBombchuDrops": 1, + "ExcludedLocations": "147,148,233,323,", + "FortressCarpenters": 1, + "FrogsHint": 1, + "FullWallets": 1, + "GanonTrial": 0, + "GregHint": 1, + "HBAHint": 1, + "IncludeTycoonWallet": 1, + "KakarikoGate": 1, + "Keysanity": 2, + "LacsRewardCount": 6, + "MalonHint": 1, + "MerchantText": 1, + "RainbowBridge": 7, + "SariaHint": 1, + "SheikLAHint": 0, + "ShuffleGanonBossKey": 9, + "ShuffleOcarinas": 1, + "SkipChildZelda": 1, + "SkipEponaRace": 1, + "SkipScarecrowsSong": 1, + "StartingKokiriSword": 1, + "StartingMapsCompasses": 0, + "StartingOcarina": 1, + "SunlightArrows": 1, + "ZorasFountain": 1 + } + } + }, + "presetName": "Rando Beginner", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Default.json b/soh/assets/custom/presets/Rando Default.json new file mode 100644 index 000000000..f5c5818e9 --- /dev/null +++ b/soh/assets/custom/presets/Rando Default.json @@ -0,0 +1,9 @@ +{ + "blocks": { + "rando": { + "gRandoSettings": null + } + }, + "presetName": "Rando Default", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Hell Mode.json b/soh/assets/custom/presets/Rando Hell Mode.json new file mode 100644 index 000000000..d42727127 --- /dev/null +++ b/soh/assets/custom/presets/Rando Hell Mode.json @@ -0,0 +1,80 @@ +{ + "blocks": { + "rando": { + "gRandoSettings": { + "BigPoeTargetCount": 1, + "BlueFireArrows": 1, + "BombchuBag": 1, + "BossKeysanity": 5, + "ClosedForest": 2, + "CuccosToReturn": 1, + "DecoupleEntrances": 1, + "DoorOfTime": 2, + "EnableBombchuDrops": 1, + "Fishsanity": 4, + "FishsanityAgeSplit": 1, + "FishsanityPondCount": 17, + "GerudoKeys": 3, + "IncludeTycoonWallet": 1, + "KakarikoGate": 1, + "Keysanity": 5, + "LacsRewardCount": 10, + "LacsRewardOptions": 1, + "LockOverworldDoors": 1, + "MixBosses": 1, + "MixDungeons": 1, + "MixGrottos": 1, + "MixInteriors": 1, + "MixOverworld": 1, + "MixedEntrances": 1, + "RainbowBridge": 7, + "ScrubsPrices": 2, + "Shopsanity": 1, + "ShopsanityCount": 7, + "ShopsanityPrices": 2, + "Shuffle100GSReward": 1, + "ShuffleAdultTrade": 1, + "ShuffleBeehives": 1, + "ShuffleBossEntrances": 2, + "ShuffleBossSouls": 2, + "ShuffleChildWallet": 1, + "ShuffleCows": 1, + "ShuffleCrates": 3, + "ShuffleDekuNutBag": 1, + "ShuffleDekuStickBag": 1, + "ShuffleDungeonsEntrances": 2, + "ShuffleFairies": 1, + "ShuffleFishingPole": 1, + "ShuffleFreestanding": 3, + "ShuffleFrogSongRupees": 1, + "ShuffleGanonBossKey": 9, + "ShuffleGerudoToken": 1, + "ShuffleGrass": 3, + "ShuffleGrottosEntrances": 1, + "ShuffleInteriorsEntrances": 2, + "ShuffleKokiriSword": 1, + "ShuffleMasterSword": 1, + "ShuffleMerchants": 3, + "ShuffleOcarinaButtons": 1, + "ShuffleOcarinas": 1, + "ShuffleOverworldEntrances": 1, + "ShuffleOverworldSpawns": 1, + "ShuffleOwlDrops": 1, + "ShufflePots": 3, + "ShuffleScrubs": 2, + "ShuffleSongs": 2, + "ShuffleSwim": 1, + "ShuffleTokens": 3, + "ShuffleWarpSongs": 1, + "ShuffleWeirdEgg": 1, + "SkipEponaRace": 1, + "StartingAge": 2, + "StartingHearts": 0, + "StartingMapsCompasses": 5, + "SunlightArrows": 1 + } + } + }, + "presetName": "Rando Hell Mode", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/assets/custom/presets/Rando Standard.json b/soh/assets/custom/presets/Rando Standard.json new file mode 100644 index 000000000..ad91912de --- /dev/null +++ b/soh/assets/custom/presets/Rando Standard.json @@ -0,0 +1,63 @@ +{ + "blocks": { + "rando": { + "gRandoSettings": { + "10GSHint": 1, + "20GSHint": 1, + "30GSHint": 1, + "40GSHint": 1, + "50GSHint": 1, + "BigPoeTargetCount": 1, + "BiggoronHint": 1, + "BlueFireArrows": 1, + "BombchuBag": 1, + "BossKeysanity": 2, + "ClosedForest": 2, + "CompleteMaskQuest": 1, + "CuccosToReturn": 1, + "DampeHint": 1, + "DoorOfTime": 2, + "EnableBombchuDrops": 1, + "FortressCarpenters": 1, + "FrogsHint": 1, + "FullWallets": 1, + "GanonTrial": 0, + "GregHint": 1, + "HBAHint": 1, + "IncludeTycoonWallet": 1, + "KakarikoGate": 1, + "Keysanity": 5, + "LacsRewardCount": 7, + "MalonHint": 1, + "MerchantText": 1, + "RainbowBridge": 7, + "SariaHint": 1, + "ScrubsFixedPrice": 2, + "ScrubsPrices": 3, + "SheikLAHint": 0, + "Shopsanity": 1, + "ShopsanityCount": 4, + "ShopsanityPrices": 2, + "ShuffleGanonBossKey": 9, + "ShuffleGerudoToken": 1, + "ShuffleKeyRings": 2, + "ShuffleKeyRingsRandomCount": 8, + "ShuffleKokiriSword": 1, + "ShuffleMerchants": 1, + "ShuffleOcarinas": 1, + "ShuffleScrubs": 2, + "ShuffleSongs": 2, + "ShuffleTokens": 3, + "SkipChildZelda": 1, + "SkipEponaRace": 1, + "SkipScarecrowsSong": 1, + "StartingMapsCompasses": 0, + "StartingOcarina": 1, + "SunlightArrows": 1, + "ZorasFountain": 1 + } + } + }, + "presetName": "Rando Standard", + "isBuiltIn": true +} \ No newline at end of file diff --git a/soh/include/functions.h b/soh/include/functions.h index ad615d173..3d1319907 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -15,7 +15,7 @@ extern "C" #include #if defined(INCLUDE_GAME_PRINTF) && defined(_DEBUG) -#define osSyncPrintf(fmt, ...) lusprintf(__FILE__, __LINE__, 0, fmt, __VA_ARGS__) +#define osSyncPrintf(fmt, ...) lusprintf(__FILE__, __LINE__, 0, fmt, ##__VA_ARGS__) #else #define osSyncPrintf(fmt, ...) osSyncPrintfUnused(fmt, ##__VA_ARGS__) #endif @@ -1378,7 +1378,7 @@ void func_800AA0B4(); void func_800AA0F0(void); u32 func_800AA148(); void func_800AA15C(); -void func_800AA16C(); +void Rumble_ClearRequests(); void func_800AA178(u32); View* View_New(GraphicsContext* gfxCtx); void View_Free(View* view); diff --git a/soh/include/z64.h b/soh/include/z64.h index 83e1498db..53b76e8fb 100644 --- a/soh/include/z64.h +++ b/soh/include/z64.h @@ -544,7 +544,7 @@ typedef enum { LANGUAGE_MAX } Language; -#define TODO_TRANSLATE "__Translate_This__" +#define TODO_TRANSLATE "TranslateThis" // TODO get these properties from the textures themselves #define FONT_CHAR_TEX_WIDTH 16 diff --git a/soh/include/z64animation.h b/soh/include/z64animation.h index b61627a27..3edba982d 100755 --- a/soh/include/z64animation.h +++ b/soh/include/z64animation.h @@ -245,27 +245,30 @@ typedef void (*PostCurveLimbDraw)(struct PlayState* play, SkelAnimeCurve* skelCu typedef s32 (*AnimUpdateFunc)(); typedef struct SkelAnime { - /* 0x00 */ u8 limbCount; // Number of limbs in the skeleton - /* 0x01 */ u8 mode; // See `AnimationMode` - /* 0x02 */ u8 dListCount; // Number of display lists in a flexible skeleton - /* 0x03 */ s8 taper; // Tapering to use when morphing between animations. Only used by Door_Warp1. - /* 0x04 */ void** skeleton; // An array of pointers to limbs. Can be StandardLimb, LodLimb, or SkinLimb. - /* 0x08 */ void* animation; // Can be an AnimationHeader or LinkAnimationHeader. - /* 0x0C */ f32 startFrame; // In mode ANIMMODE_LOOP_PARTIAL*, start of partial loop. - /* 0x10 */ f32 endFrame; // In mode ANIMMODE_ONCE*, Update returns true when curFrame is equal to this. In mode ANIMMODE_LOOP_PARTIAL*, end of partial loop. - /* 0x14 */ f32 animLength; // Total number of frames in the current animation. - /* 0x18 */ f32 curFrame; // Current frame in the animation - /* 0x1C */ f32 playSpeed; // Multiplied by R_UPDATE_RATE / 3 to get the animation's frame rate. + /* 0x00 */ u8 limbCount; // Number of limbs in the skeleton + /* 0x01 */ u8 mode; // See `AnimationMode` + /* 0x02 */ u8 dListCount; // Number of display lists in a flexible skeleton + /* 0x03 */ s8 taper; // Tapering to use when morphing between animations. Only used by Door_Warp1. + /* 0x04 */ void** skeleton; // An array of pointers to limbs. Can be StandardLimb, LodLimb, or SkinLimb. + /* 0x08 */ void* animation; // Can be an AnimationHeader or LinkAnimationHeader. + /* 0x0C */ f32 startFrame; // In mode ANIMMODE_LOOP_PARTIAL*, start of partial loop. + /* 0x10 */ f32 endFrame; // In mode ANIMMODE_ONCE*, Update returns true when curFrame is equal to this. In mode ANIMMODE_LOOP_PARTIAL*, end of partial loop. + /* 0x14 */ f32 animLength; // Total number of frames in the current animation. + /* 0x18 */ f32 curFrame; // Current frame in the animation + /* 0x1C */ f32 playSpeed; // Multiplied by R_UPDATE_RATE / 3 to get the animation's frame rate. /* 0x20 */ Vec3s* jointTable; // Current translation of model and rotations of all limbs /* 0x24 */ Vec3s* morphTable; // Table of values used to morph between animations - /* 0x28 */ f32 morphWeight; // Weight of the current animation morph as a fraction in [0,1] - /* 0x2C */ f32 morphRate; // Reciprocal of the number of frames in the morph - /* 0x30 */ s32 (*update)(); // Can be Loop, Partial loop, Play once, Morph, or Tapered morph. Link only has Loop, Play once, and Morph. - /* 0x34 */ s8 initFlags; // Flags used when initializing Link's skeleton - /* 0x35 */ u8 moveFlags; // Flags used for animations that move the actor in worldspace. - /* 0x36 */ s16 prevRot; // Previous rotation in worldspace. - /* 0x38 */ Vec3s prevTransl; // Previous modelspace translation. - /* 0x3E */ Vec3s baseTransl; // Base modelspace translation. + /* 0x28 */ f32 morphWeight; // Weight of the current animation morph as a fraction in [0,1] + /* 0x2C */ f32 morphRate; // Reciprocal of the number of frames in the morph + /* 0x30 */ union { + s32 (*normal)(struct SkelAnime*); // Can be Loop, Partial loop, Play once, Morph, or Tapered morph + s32 (*link)(struct PlayState*, struct SkelAnime*); // Can be Loop, Play once, or Morph + } update; + /* 0x34 */ s8 initFlags; // Flags used when initializing Link's skeleton + /* 0x35 */ u8 movementFlags; // Flags used for animations that move the actor in worldspace. + /* 0x36 */ s16 prevRot; // Previous rotation in worldspace. + /* 0x38 */ Vec3s prevTransl; // Previous modelspace translation. + /* 0x3E */ Vec3s baseTransl; // Base modelspace translation. SkeletonHeader* skeletonHeader; } SkelAnime; // size = 0x44 diff --git a/soh/soh/Enhancements/DampeFire.cpp b/soh/soh/Enhancements/DampeFire.cpp new file mode 100644 index 000000000..1378ecb04 --- /dev/null +++ b/soh/soh/Enhancements/DampeFire.cpp @@ -0,0 +1,48 @@ +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" +#include "soh/Enhancements/enhancementTypes.h" + +extern "C" { +extern PlayState* gPlayState; +#include "src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.h" +} + +void RegisterDampeFire() { + COND_VB_SHOULD(VB_DAMPE_DROP_FLAME, CVarGetInteger(CVAR_ENHANCEMENT("DampeDropRate"), DAMPE_NORMAL) != DAMPE_NORMAL, + { + double chance; + int cooldown = 9; + switch (CVarGetInteger(CVAR_ENHANCEMENT("DampeDropRate"), DAMPE_NORMAL)) { + case DAMPE_NONE: + *should = false; + return; + default: + case DAMPE_NORMAL: + return; + case DAMPE_JALAPENO: + chance = 0.03; + break; + case DAMPE_CHIPOTLE: + chance = 0.1; + break; + case DAMPE_SCOTCH_BONNET: + chance = 0.2; + break; + case DAMPE_GHOST_PEPPER: + chance = 0.5; + cooldown = 4; + break; + case DAMPE_INFERNO: + *should = true; + return; + } + + EnPoRelay* actor = va_arg(args, EnPoRelay*); + if (actor->actionTimer > cooldown) { + actor->actionTimer = cooldown; + } + *should = actor->actionTimer == 0 && Rand_ZeroOne() < chance; + }); +} + +static RegisterShipInitFunc initFunc(RegisterDampeFire, { CVAR_ENHANCEMENT("DampeDropRate") }); diff --git a/soh/soh/Enhancements/ExtraModes/ShadowTag.cpp b/soh/soh/Enhancements/ExtraModes/ShadowTag.cpp new file mode 100644 index 000000000..dc85534c8 --- /dev/null +++ b/soh/soh/Enhancements/ExtraModes/ShadowTag.cpp @@ -0,0 +1,50 @@ +#include +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" +#include "functions.h" + +extern "C" PlayState* gPlayState; + +static constexpr int32_t CVAR_SHADOW_TAG_DEFAULT = 0; +#define CVAR_SHADOW_TAG_NAME CVAR_ENHANCEMENT("ShadowTag") +#define CVAR_SHADOW_TAG_VALUE CVarGetInteger(CVAR_SHADOW_TAG_NAME, CVAR_SHADOW_TAG_DEFAULT) + +static bool shouldSpawn = false; +static uint16_t delayTimer = 60; + +static constexpr s8 ROOM_GREEN_POE = 16; +static constexpr s8 ROOM_BLUE_POE = 13; +static constexpr s8 ROOM_RED_POE = 12; + +void OnPlayerUpdateShadowTag() { + if (gPlayState->sceneNum == SCENE_FOREST_TEMPLE) { + switch (gPlayState->roomCtx.curRoom.num) { + case ROOM_GREEN_POE: + case ROOM_BLUE_POE: + case ROOM_RED_POE: + return; + default: + break; + } + } + + if (shouldSpawn && (delayTimer <= 0)) { + Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_WALLMAS, 0, 0, 0, 0, 0, 0, 3, false); + shouldSpawn = false; + } else { + delayTimer--; + } +} + +void ResetShadowTagSpawnTimer() { + shouldSpawn = true; + delayTimer = 60; +} + +void RegisterShadowTag() { + COND_HOOK(OnPlayerUpdate, CVAR_SHADOW_TAG_VALUE, OnPlayerUpdateShadowTag); + COND_HOOK(OnSceneSpawnActors, true, []() { ResetShadowTagSpawnTimer(); }); + COND_HOOK(OnSceneInit, true, [](int16_t) { ResetShadowTagSpawnTimer(); }); +} + +static RegisterShipInitFunc initFunc_ShadowTag(RegisterShadowTag, { CVAR_SHADOW_TAG_NAME }); diff --git a/soh/soh/Enhancements/ExtraTraps.cpp b/soh/soh/Enhancements/ExtraTraps.cpp index 92806bacc..e88a8f1fe 100644 --- a/soh/soh/Enhancements/ExtraTraps.cpp +++ b/soh/soh/Enhancements/ExtraTraps.cpp @@ -61,8 +61,8 @@ std::vector getEnabledAddTraps() { }; static void RollRandomTrap(uint32_t seed) { - uint32_t finalSeed = - seed + (IS_RANDO ? Rando::Context::GetInstance()->GetSeed() : gSaveContext.ship.stats.fileCreatedAt); + uint32_t finalSeed = seed + (IS_RANDO ? Rando::Context::GetInstance()->GetSeed() + : static_cast(gSaveContext.ship.stats.fileCreatedAt)); Random_Init(finalSeed); roll = RandomElement(getEnabledAddTraps()); @@ -126,12 +126,12 @@ static void OnPlayerUpdate() { Play_TriggerRespawn(gPlayState); break; case ADD_AMMO_TRAP: - AMMO(ITEM_STICK) = AMMO(ITEM_STICK) * 0.5; - AMMO(ITEM_NUT) = AMMO(ITEM_NUT) * 0.5; - AMMO(ITEM_SLINGSHOT) = AMMO(ITEM_SLINGSHOT) * 0.5; - AMMO(ITEM_BOW) = AMMO(ITEM_BOW) * 0.5; - AMMO(ITEM_BOMB) = AMMO(ITEM_BOMB) * 0.5; - AMMO(ITEM_BOMBCHU) = AMMO(ITEM_BOMBCHU) * 0.5; + AMMO(ITEM_STICK) = static_cast(floor(AMMO(ITEM_STICK) * 0.5f)); + AMMO(ITEM_NUT) = static_cast(floor(AMMO(ITEM_NUT) * 0.5f)); + AMMO(ITEM_SLINGSHOT) = static_cast(floor(AMMO(ITEM_SLINGSHOT) * 0.5f)); + AMMO(ITEM_BOW) = static_cast(floor(AMMO(ITEM_BOW) * 0.5f)); + AMMO(ITEM_BOMB) = static_cast(floor(AMMO(ITEM_BOMB) * 0.5f)); + AMMO(ITEM_BOMBCHU) = static_cast(floor(AMMO(ITEM_BOMBCHU) * 0.5f)); Audio_PlaySoundGeneral(NA_SE_VO_FR_SMILE_0, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); break; diff --git a/soh/soh/Enhancements/Presets/PresetEntries.cpp b/soh/soh/Enhancements/Presets/PresetEntries.cpp deleted file mode 100644 index c9ca5c24f..000000000 --- a/soh/soh/Enhancements/Presets/PresetEntries.cpp +++ /dev/null @@ -1,650 +0,0 @@ -#include "Presets.h" -#include -#include "soh/cvar_prefixes.h" -#include "soh/Enhancements/enhancementTypes.h" - -#define PRESET_ENTRY_S32(cvar, value) \ - { cvar, PRESET_ENTRY_TYPE_S32, value } -#define PRESET_ENTRY_FLOAT(cvar, value) \ - { cvar, PRESET_ENTRY_TYPE_FLOAT, value } -#define PRESET_ENTRY_STRING(cvar, value) \ - { cvar, PRESET_ENTRY_TYPE_STRING, value } -#define PRESET_ENTRY_CPP_STRING(cvar, value) \ - { cvar, PRESET_ENTRY_TYPE_CPP_STRING, value } - -// TODO: Ideally everything in this file will come from one/many JSON files - -// Enhancement presets -const std::vector vanillaPlusPresetEntries = { - // Quality of Life - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("Autosave"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.GoldSkulltula"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartPiece"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartContainer"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterOwl"), 1), - - // Skips & Speed-ups - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipText"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TextSpeed"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterRupeeAccumulator"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 1), - - // Graphics - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableLOD"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RememberMapToggleState"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("VisualAgony"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DynamicWalletIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeFlowFileSelect"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("WidescreenActorCulling"), 1), - - // Items - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadEquips"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), - - // Fixes - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GravediggingTourFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixFloorSwitches"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixZoraHintDialogue"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixVineFall"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EnemySpawnsOverWaterboxes"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixSawSoftlock"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DekuNutUpgradeFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixBrokenGiantsKnife"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixMenuLR"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TwoHandedIdle"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NaviTextFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GerudoWarriorClothingFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixTexturesOOB"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixEyesOpenWhileSleeping"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixHammerHand"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SceneSpecificDirtPathFix"), ZFIGHT_FIX_CONSISTENT_VANISH), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDaruniaDanceSpeed"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CreditsFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RedGanonBlood"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PulsateBossIcon"), 1), - - // Difficulty - // NONE - - // Minigames - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FrogsModifyFailTime"), 2), - - // Extra Modes - // NONE - - // Cheats - // NONE -}; - -const std::vector enhancedPresetEntries = { - // Quality of Life - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("Autosave"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseWarp"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoInputForCredits"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.GoldSkulltula"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartPiece"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartContainer"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableCritWiggle"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterOwl"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuitFishingAtDoor"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantPutaway"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), 1), - - // Skips & Speed-ups - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipText"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TextSpeed"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SlowTextSpeed"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ClimbSpeed"), 3), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterBlockPush"), 5), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CrawlSpeed"), 2), - PRESET_ENTRY_FLOAT(CVAR_ENHANCEMENT("MweepSpeed"), 5.0f), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantScarecrow"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterRupeeAccumulator"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkulltulaFreeze"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 1), - - // Graphics - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableLOD"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NewDrops"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseMenuAnimatedLink"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ShowDoorLocksOnBothSides"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ToTMedallionsColors"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RememberMapToggleState"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("VisualAgony"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DynamicWalletIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterAmmoRendering"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeFlowFileSelect"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("WidescreenActorCulling"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ExtendedCullingExcludeGlitchActors"), 1), - - // Items - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadEquips"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_FAST), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PersistentMasks"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NutsExplodeBombs"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableFirstPersonChus"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterBombchuShopping"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SeparateArrows"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipArrowAnimation"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastBoomerang"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterFarore"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastFarores"), 1), - - // Fixes - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GravediggingTourFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixFloorSwitches"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixZoraHintDialogue"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixVineFall"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EnemySpawnsOverWaterboxes"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixSawSoftlock"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DekuNutUpgradeFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixBrokenGiantsKnife"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixMenuLR"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TwoHandedIdle"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NaviTextFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GerudoWarriorClothingFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixTexturesOOB"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixEyesOpenWhileSleeping"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixHammerHand"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SceneSpecificDirtPathFix"), ZFIGHT_FIX_CONSISTENT_VANISH), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDaruniaDanceSpeed"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CreditsFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RedGanonBlood"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PulsateBossIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("HoverFishing"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("N64WeirdFrames"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BombchusOOB"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuickPutaway"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuickBongoKill"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 1), - - // Difficulty - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EnableBombchuDrops"), 1), PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DampeWin"), 1), - - // Minigames - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FrogsModifyFailTime"), 2), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("OcarinaGame.StartingNotes"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFishing"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GuaranteeFishingBite"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FishNeverEscape"), 1), - - // Extra Modes - // NONE - - // Cheats - // NONE -}; - -const std::vector randomizerPresetEntries = { - // Quality of Life - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("Autosave"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DayGravePull"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DampeAllNight"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MarketSneak"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseWarp"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NoInputForCredits"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("IncludeHeldInputsBufferWindow"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.GoldSkulltula"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartPiece"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InjectItemCounts.HeartContainer"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableCritWiggle"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterOwl"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuitFishingAtDoor"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantPutaway"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SleepingWaterfall"), 1), - - // Skips & Speed-ups - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastDrops"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipForcedDialog"), FORCED_DIALOG_SKIP_ALL), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipText"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TextSpeed"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SlowTextSpeed"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastChests"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ClimbSpeed"), 3), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterBlockPush"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CrawlSpeed"), 2), - PRESET_ENTRY_FLOAT(CVAR_ENHANCEMENT("MweepSpeed"), 5.0f), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipChildStealth"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeSavers.SkipTowerEscape"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("InstantScarecrow"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FasterRupeeAccumulator"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipSaveConfirmation"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ForgeTime"), 0), - - // Graphics - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableLOD"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NewDrops"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PauseMenuAnimatedLink"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ShowDoorLocksOnBothSides"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ToTMedallionsColors"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RememberMapToggleState"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("VisualAgony"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DynamicWalletIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FileSelectMoreInfo"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterAmmoRendering"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TimeFlowFileSelect"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("WidescreenActorCulling"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ExtendedCullingExcludeGlitchActors"), 1), - - // Items - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadEquips"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AssignableTunicsAndBoots"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EquipmentCanBeRemoved"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("ToggleStrength"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SwordToggle"), SWORD_TOGGLE_CHILD), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DpadNoDropOcarinaInput"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastOcarinaPlayback"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MMBunnyHood"), BUNNY_HOOD_FAST), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("AdultMasks"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PersistentMasks"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MaskSelect"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NutsExplodeBombs"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DisableFirstPersonChus"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterBombchuShopping"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SeparateArrows"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SkipArrowAnimation"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastBoomerang"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BetterFarore"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FastFarores"), 1), - - // Fixes - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GravediggingTourFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixFloorSwitches"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixZoraHintDialogue"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixVineFall"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EnemySpawnsOverWaterboxes"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixSawSoftlock"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DekuNutUpgradeFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixBrokenGiantsKnife"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixMenuLR"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDungeonMinimapIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("TwoHandedIdle"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("NaviTextFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GerudoWarriorClothingFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixTexturesOOB"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixHammerHand"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SceneSpecificDirtPathFix"), ZFIGHT_FIX_CONSISTENT_VANISH), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("SilverRupeeJingleExtend"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FixDaruniaDanceSpeed"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CreditsFix"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("RedGanonBlood"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("PulsateBossIcon"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("HoverFishing"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("N64WeirdFrames"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("BombchusOOB"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuickPutaway"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("QuickBongoKill"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("EarlyEyeballFrog"), 1), - - // Difficulty - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GoronPot"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("DampeWin"), 1), - - // Minigames - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFrogsOcarinaGame"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FrogsModifyFailTime"), 2), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeOcarinaGame"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("OcarinaGame.StartingNotes"), 5), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("CustomizeFishing"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("GuaranteeFishingBite"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("FishNeverEscape"), 1), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MinimumFishWeightChild"), 3), - PRESET_ENTRY_S32(CVAR_ENHANCEMENT("MinimumFishWeightAdult"), 6), - - // Extra Modes - // NONE - - // Cheats - PRESET_ENTRY_S32(CVAR_CHEAT("EasyFrameAdvance"), 1), -}; - -// Randomizer presets -const std::vector randomizerBeginnerPresetEntries = { - // World tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ClosedForest"), RO_CLOSED_FOREST_OFF), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ZorasFountain"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_GREG), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SKIP), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FortressCarpenters"), 1), - - // Items tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("IncludeTycoonWallet"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_STARTWITH), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_REWARDS), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardCount"), 6), - - // Gamplay tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 0), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), 1), - - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SheikLAHint"), 0), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DampeHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GregHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SariaHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FrogsHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BiggoronHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MalonHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("HBAHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MerchantText"), 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("FullWallets"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), 1), - - // Locations tab - PRESET_ENTRY_STRING(CVAR_RANDOMIZER_SETTING("ExcludedLocations"), "147,148,233,323,"), - - // Tricks/Glitches tab - // NONE - - // Starting inventory tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingKokiriSword"), RO_STARTING_OCARINA_FAIRY), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingOcarina"), RO_STARTING_OCARINA_FAIRY), -}; - -const std::vector randomizerStandardPresetEntries = { - // World tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ClosedForest"), RO_CLOSED_FOREST_OFF), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ZorasFountain"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_GREG), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SKIP), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FortressCarpenters"), 1), - - // Items tab - 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("ShuffleKokiriSword"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("IncludeTycoonWallet"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_SPECIFIC_COUNT), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityCount"), 4), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityPrices"), RO_PRICE_BALANCED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), RO_SCRUBS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubsPrices"), RO_PRICE_FIXED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubsFixedPrice"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMerchants"), RO_SHUFFLE_MERCHANTS_BEANS_ONLY), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_STARTWITH), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_OWN_DUNGEON), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_REWARDS), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardCount"), 7), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), RO_KEYRINGS_COUNT), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsRandomCount"), 8), - - // Gamplay tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 0), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), 1), - - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SheikLAHint"), 0), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DampeHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GregHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SariaHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FrogsHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BiggoronHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MalonHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("HBAHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MerchantText"), 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("FullWallets"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BombchuBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), 1), - - // Locations tab - // NONE - - // Tricks/Glitches tab - // NONE - - // Starting inventory tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingOcarina"), RO_STARTING_OCARINA_FAIRY), -}; - -const std::vector randomizerAdvancedPresetEntries = { - // World tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ClosedForest"), RO_CLOSED_FOREST_OFF), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_GREG), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingAge"), RO_AGE_RANDOM), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GanonTrial"), RO_GANONS_TRIALS_SKIP), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FortressCarpenters"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDungeonsEntrances"), RO_DUNGEON_ENTRANCE_SHUFFLE_ON_PLUS_GANON), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBossEntrances"), RO_BOSS_ROOM_ENTRANCE_SHUFFLE_FULL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOverworldSpawns"), 1), - - // Items tab - 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("ShuffleKokiriSword"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMasterSword"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("IncludeTycoonWallet"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleSwim"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDekuNutBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDekuStickBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_SPECIFIC_COUNT), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityCount"), 7), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityPrices"), RO_PRICE_BALANCED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), RO_SCRUBS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubsPrices"), RO_PRICE_FIXED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubsFixedPrice"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleCows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMerchants"), RO_SHUFFLE_MERCHANTS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFrogSongRupees"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_STARTWITH), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_REWARDS), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardCount"), 8), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), RO_KEYRINGS_COUNT), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsRandomCount"), 4), - - // Gamplay tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 0), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipChildZelda"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), 1), - - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SheikLAHint"), 0), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DampeHint"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GregHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SariaHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FrogsHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MalonHint"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("HBAHint"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MerchantText"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("40GSHint"), 1), PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("50GSHint"), 1), - - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FullWallets"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BombchuBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), 1), - - // Locations tab - // NONE - - // Tricks/Glitches tab - // NONE - - // Starting inventory tab - // NONE -}; - -const std::vector hellModePresetEntries = { - // World tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ClosedForest"), RO_CLOSED_FOREST_OFF), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("KakarikoGate"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DoorOfTime"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LockOverworldDoors"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("RainbowBridge"), RO_BRIDGE_GREG), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingAge"), RO_AGE_RANDOM), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDungeonsEntrances"), RO_DUNGEON_ENTRANCE_SHUFFLE_ON_PLUS_GANON), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBossEntrances"), RO_BOSS_ROOM_ENTRANCE_SHUFFLE_FULL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOverworldEntrances"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleInteriorsEntrances"), RO_INTERIOR_ENTRANCE_SHUFFLE_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGrottosEntrances"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOwlDrops"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleWarpSongs"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOverworldSpawns"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixedEntrances"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixDungeons"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixBosses"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixOverworld"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixInteriors"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("MixGrottos"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("DecoupleEntrances"), 1), - - // Items tab - 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("ShuffleKokiriSword"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMasterSword"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleChildWallet"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("IncludeTycoonWallet"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinas"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleOcarinaButtons"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleSwim"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleWeirdEgg"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGerudoToken"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFishingPole"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDekuNutBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleDekuStickBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFreestanding"), RO_SHUFFLE_FREESTANDING_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shopsanity"), RO_SHOPSANITY_SPECIFIC_COUNT), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityCount"), 7), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShopsanityPrices"), RO_PRICE_BALANCED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Fishsanity"), RO_FISHSANITY_BOTH), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FishsanityPondCount"), 17), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("FishsanityAgeSplit"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleScrubs"), RO_SCRUBS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ScrubsPrices"), RO_PRICE_BALANCED), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBeehives"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleCows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShufflePots"), RO_SHUFFLE_POTS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleCrates"), RO_SHUFFLE_CRATES_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleMerchants"), RO_SHUFFLE_MERCHANTS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFrogSongRupees"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleAdultTrade"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Shuffle100GSReward"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleBossSouls"), 2), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleFairies"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGrass"), RO_SHUFFLE_GRASS_ALL), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingMapsCompasses"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("Keysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("GerudoKeys"), RO_GERUDO_KEYS_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BossKeysanity"), RO_DUNGEON_ITEM_LOC_ANYWHERE), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("ShuffleGanonBossKey"), RO_GANON_BOSS_KEY_LACS_REWARDS), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardCount"), 10), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("LacsRewardOptions"), RO_LACS_GREG_REWARD), - - // Gamplay tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("CuccosToReturn"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), 0), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SkipEponaRace"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BombchuBag"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("EnableBombchuDrops"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("BlueFireArrows"), 1), - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("SunlightArrows"), 1), - - // Locations tab - // NONE - - // Tricks/Glitches tab - // NONE - - // Starting inventory tab - PRESET_ENTRY_S32(CVAR_RANDOMIZER_SETTING("StartingHearts"), 0), -}; - -const std::map presetTypes = { - { PRESET_TYPE_ENHANCEMENTS, - { { CVAR_PREFIX_ENHANCEMENT, CVAR_PREFIX_CHEAT }, - { - { ENHANCEMENT_PRESET_DEFAULT, - { - "Default", - "Reset all options to their default values.", - {}, - } }, - { ENHANCEMENT_PRESET_VANILLA_PLUS, - { - "Vanilla Plus", - "Adds some quality of life features, but don't alter gameplay and aims to " - "preserve the authentic experience. Recommended for a first playthrough of OoT.", - vanillaPlusPresetEntries, - } }, - { ENHANCEMENT_PRESET_ENHANCED, - { "Enhanced", - "The \"Vanilla Plus\" preset, but with more quality of life enhancements that might alter gameplay " - "slightly. Recommended for returning players going through the vanilla game again.", - enhancedPresetEntries } }, - { ENHANCEMENT_PRESET_RANDOMIZER, - { "Randomizer", - "A baseline set of enhancements for playing randomizer. Includes many quality of life options and " - "options to speed up gameplay.", - randomizerPresetEntries } }, - } } }, - { PRESET_TYPE_RANDOMIZER, - { { CVAR_PREFIX_RANDOMIZER_SETTING, CVAR_PREFIX_RANDOMIZER_ENHANCEMENT }, - { - { RANDOMIZER_PRESET_DEFAULT, - { - "Default", - "Reset all options to their default values.", - {}, - } }, - { RANDOMIZER_PRESET_BEGINNER, - { - "Beginner", - "A simpler set of options and shuffled items meant for players new to the randomizer. ", - randomizerBeginnerPresetEntries, - } }, - { RANDOMIZER_PRESET_STANDARD, - { - "Standard", - "A set of options meant as a baseline for both newer and experienced randomizer players.", - randomizerStandardPresetEntries, - } }, - { RANDOMIZER_PRESET_ADVANCED, - { - "Advanced", - "Includes many more shuffled items and introduces some entrance shuffle options. Meant for advanced " - "randomizer players.", - randomizerAdvancedPresetEntries, - } }, - { RANDOMIZER_PRESET_HELL_MODE, - { "Hell Mode", - "Every location randomized, all entrance settings enabled, but still using glitchless logic. Expect " - "pain.", - hellModePresetEntries } }, - } } } -}; diff --git a/soh/soh/Enhancements/Presets/Presets.cpp b/soh/soh/Enhancements/Presets/Presets.cpp index cef3f8362..b5c364251 100644 --- a/soh/soh/Enhancements/Presets/Presets.cpp +++ b/soh/soh/Enhancements/Presets/Presets.cpp @@ -1,63 +1,145 @@ #include "Presets.h" #include #include -#include -#include +#include +#include +#include +#include #include +#include +#include "soh/OTRGlobals.h" #include "soh/SohGui/MenuTypes.h" #include "soh/SohGui/SohMenu.h" #include "soh/SohGui/SohGui.hpp" +#include "soh/Enhancements/randomizer/randomizer_settings_window.h" +#include "soh/Enhancements/randomizer/randomizer_check_tracker.h" +#include "soh/Enhancements/randomizer/randomizer_entrance_tracker.h" +#include "soh/Enhancements/randomizer/randomizer_item_tracker.h" -std::string FormatLocations(std::vector locs) { - std::string locString = ""; - for (auto loc : locs) { - locString += std::to_string(loc) + ","; - } - return locString; +namespace fs = std::filesystem; + +namespace SohGui { +extern std::shared_ptr mSohMenu; +extern std::shared_ptr mRandomizerSettingsWindow; +} // namespace SohGui + +struct PresetInfo { + nlohmann::json presetValues; + std::string fileName; + bool apply[PRESET_SECTION_MAX]; + bool isBuiltIn = false; +}; + +struct BlockInfo { + std::vector sections; + const char* icon; + std::string names[2]; +}; + +static std::map presets; +static std::string presetFolder; + +void BlankButton() { + ImGui::PushStyleColor(ImGuiCol_Button, { 0, 0, 0, 0 }); + ImGui::PushStyleColor(ImGuiCol_ButtonHovered, { 0, 0, 0, 0 }); + ImGui::PushStyleColor(ImGuiCol_ButtonActive, { 0, 0, 0, 0 }); + ImGui::PushStyleColor(ImGuiCol_Border, { 0, 0, 0, 0 }); + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(8.0f, 8.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 5.0f); } -void applyPreset(std::vector entries) { - for (auto& [cvar, type, value] : entries) { - switch (type) { - case PRESET_ENTRY_TYPE_S32: - CVarSetInteger(cvar, std::get(value)); - break; - case PRESET_ENTRY_TYPE_FLOAT: - CVarSetFloat(cvar, std::get(value)); - break; - case PRESET_ENTRY_TYPE_STRING: - CVarSetString(cvar, std::get(value)); - break; - case PRESET_ENTRY_TYPE_CPP_STRING: - CVarSetString(cvar, std::get(value).c_str()); - break; +void PresetCheckboxStyle(const ImVec4& color) { + ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4(color.x, color.y, color.z, 1.0f)); + ImGui::PushStyleColor(ImGuiCol_FrameBgHovered, ImVec4(color.x, color.y, color.z, 0.8f)); + ImGui::PushStyleColor(ImGuiCol_FrameBgActive, ImVec4(color.x, color.y, color.z, 0.6f)); + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.0f, 0.0f, 0.0f, 0.3f)); + ImGui::PushStyleColor(ImGuiCol_CheckMark, ImVec4(1.0f, 1.0f, 1.0f, 0.7f)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameRounding, 3.0f); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(6.0f, 6.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 5.0f); +} + +static BlockInfo blockInfo[PRESET_SECTION_MAX] = { + { { CVAR_PREFIX_SETTING, CVAR_PREFIX_WINDOW }, ICON_FA_COG, { "Settings", "settings" } }, + { { CVAR_PREFIX_ENHANCEMENT, CVAR_PREFIX_RANDOMIZER_ENHANCEMENT, CVAR_PREFIX_CHEAT }, + ICON_FA_PLUS_CIRCLE, + { "Enhancements", "enhancements" } }, + { { CVAR_PREFIX_AUDIO }, ICON_FA_MUSIC, { "Audio", "audio" } }, + { { CVAR_PREFIX_COSMETIC }, ICON_FA_PAINT_BRUSH, { "Cosmetics", "cosmetics" } }, + { { CVAR_PREFIX_RANDOMIZER_SETTING }, ICON_FA_RANDOM, { "Rando Settings", "rando" } }, + { { CVAR_PREFIX_TRACKER }, ICON_FA_MAP, { "Trackers", "trackers" } }, + { { CVAR_PREFIX_REMOTE }, ICON_FA_WIFI, { "Network", "network" } }, +}; + +std::string FormatPresetPath(std::string name) { + return fmt::format("{}/{}.json", presetFolder, name); +} + +void applyPreset(std::string presetName, std::vector includeSections) { + auto& info = presets[presetName]; + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + if (info.apply[i] && info.presetValues["blocks"].contains(blockInfo[i].names[1])) { + if (!includeSections.empty() && + std::find(includeSections.begin(), includeSections.end(), i) == includeSections.end()) { + continue; + } + if (i == PRESET_SECTION_TRACKERS) { + ItemTracker_LoadFromPreset(info.presetValues["blocks"][blockInfo[i].names[1]]["windows"]); + if (info.presetValues["blocks"][blockInfo[i].names[1]]["windows"].contains("Check Tracker")) { + CheckTracker::CheckTracker_LoadFromPreset( + info.presetValues["blocks"][blockInfo[i].names[1]]["windows"]["Check Tracker"]); + } + if (info.presetValues["blocks"][blockInfo[i].names[1]]["windows"].contains("Entrance Tracker")) { + EntranceTracker_LoadFromPreset( + info.presetValues["blocks"][blockInfo[i].names[1]]["windows"]["Entrance Tracker"]); + } + } + auto section = info.presetValues["blocks"][blockInfo[i].names[1]]; + for (auto& item : section.items()) { + if (section[item.key()].is_null()) { + CVarClearBlock(item.key().c_str()); + } else { + Ship::Context::GetInstance()->GetConfig()->SetBlock(fmt::format("{}.{}", "CVars", item.key()), + item.value()); + Ship::Context::GetInstance()->GetConsoleVariables()->Load(); + } + } + if (i == PRESET_SECTION_RANDOMIZER) { + SohGui::mRandomizerSettingsWindow->SetNeedsUpdate(); + } } - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } - ShipInit::Init("*"); } -void DrawPresetSelector(PresetType presetTypeId) { - const std::string presetTypeCvar = CVAR_GENERAL("SelectedPresets.") + std::to_string(presetTypeId); - const PresetTypeDefinition presetTypeDef = presetTypes.at(presetTypeId); - uint16_t selectedPresetId = CVarGetInteger(presetTypeCvar.c_str(), 0); - if (selectedPresetId >= presetTypeDef.presets.size()) { - selectedPresetId = 0; +void DrawPresetSelector(std::vector includeSections, std::string presetLoc, bool disabled) { + std::vector includedPresets; + for (auto& [name, info] : presets) { + for (auto& section : includeSections) { + if (info.apply[section]) { + includedPresets.push_back(name); + } + } } - const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(selectedPresetId); - std::string comboboxTooltip = ""; - for (auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter) { - if (iter->first != 0) - comboboxTooltip += "\n\n"; - comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description); - } - ImGui::Text("Presets"); + if (includedPresets.empty()) { + ImGui::PushStyleColor(ImGuiCol_Text, UIWidgets::ColorValues.at(UIWidgets::Colors::Orange)); + ImGui::Text("No presets with rando options. Make some in Settings -> Presets"); + ImGui::PopStyleColor(); + return; + } + std::string selectorCvar = fmt::format(CVAR_GENERAL("{}SelectedPreset"), presetLoc); + std::string currentIndex = CVarGetString(selectorCvar.c_str(), includedPresets[0].c_str()); + if (!presets.contains(currentIndex)) { + currentIndex = *includedPresets.begin(); + CVarSetString(selectorCvar.c_str(), currentIndex.c_str()); + } UIWidgets::PushStyleCombobox(THEME_COLOR); - if (ImGui::BeginCombo("##PresetsComboBox", selectedPresetDef.label)) { - for (auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter) { - if (ImGui::Selectable(iter->second.label, iter->first == selectedPresetId)) { - CVarSetInteger(presetTypeCvar.c_str(), iter->first); + if (ImGui::BeginCombo("##PresetsComboBox", currentIndex.c_str())) { + for (auto iter = includedPresets.begin(); iter != includedPresets.end(); ++iter) { + if (ImGui::Selectable(iter->c_str(), *iter == currentIndex)) { + CVarSetString(selectorCvar.c_str(), iter->c_str()); + currentIndex = *iter; Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } @@ -65,18 +147,300 @@ void DrawPresetSelector(PresetType presetTypeId) { ImGui::EndCombo(); } UIWidgets::PopStyleCombobox(); - UIWidgets::Tooltip(comboboxTooltip.c_str()); + // UIWidgets::Tooltip(comboboxTooltip.c_str()); UIWidgets::PushStyleButton(THEME_COLOR); - if (ImGui::Button(("Apply Preset##" + presetTypeCvar).c_str())) { - for (const char* block : presetTypeDef.blocksToClear) { - CVarClearBlock(block); - } - if (selectedPresetId != 0) { - applyPreset(selectedPresetDef.entries); - } - CVarSetInteger(presetTypeCvar.c_str(), selectedPresetId); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); + if (UIWidgets::Button( + ("Apply Preset##" + selectorCvar).c_str(), + UIWidgets::ButtonOptions({ { .disabled = disabled } }).Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline))) { + applyPreset(currentIndex, includeSections); } UIWidgets::PopStyleButton(); } + +void DrawSectionCheck(const std::string& name, bool empty, bool* pointer, std::string section) { + ImGui::AlignTextToFramePadding(); + if (empty) { + ImGui::PushStyleColor(ImGuiCol_Text, { 1.0f, 0.0f, 0.0f, 0.7f }); + BlankButton(); + ImGui::BeginDisabled(); + ImGui::Button((ICON_FA_TIMES + std::string("##") + name + section).c_str()); + ImGui::EndDisabled(); + UIWidgets::PopStyleButton(); + ImGui::PopStyleColor(); + } else { + ImGui::PushFont(OTRGlobals::Instance->fontMono); + ImGui::SetCursorPosY(ImGui::GetCursorPosY() + (ImGui::GetStyle().FramePadding.y)); + UIWidgets::Checkbox(("##" + name + section).c_str(), pointer, + { .defaultValue = true, .padding = { 6.0f, 6.0f }, .color = THEME_COLOR }); + ImGui::PopFont(); + } +} + +void ParsePreset(nlohmann::json& json, std::string name) { + try { + presets[json["presetName"]].presetValues = json; + presets[json["presetName"]].fileName = name; + if (json.contains("isBuiltIn")) { + presets[json["presetName"]].isBuiltIn = json["isBuiltIn"]; + } + for (int i = 0; i < PRESET_SECTION_MAX; i++) { + if (presets[json["presetName"]].presetValues["blocks"].contains(blockInfo[i].names[1])) { + presets[json["presetName"]].apply[i] = true; + } + } + } catch (...) {} +} + +void LoadPresets() { + if (!fs::exists(presetFolder)) { + return; + } + if (!presets.empty()) { + presets.clear(); + } + for (auto const& preset : fs::directory_iterator(presetFolder)) { + std::ifstream ifs(preset.path()); + + auto json = nlohmann::json::parse(ifs); + if (!json.contains("presetName")) { + spdlog::error(fmt::format("Attempted to load file {} as a preset, but was not a preset file.", + preset.path().filename().string())); + } else { + ParsePreset(json, preset.path().filename().stem().string()); + } + ifs.close(); + } + auto initData = std::make_shared(); + initData->Format = RESOURCE_FORMAT_BINARY; + initData->Type = static_cast(Ship::ResourceType::Json); + initData->ResourceVersion = 0; + std::string folder = "presets/*"; + auto builtIns = Ship::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folder); + size_t start = std::string(folder).size() - 1; + for (size_t i = 0; i < builtIns->size(); i++) { + std::string filePath = builtIns->at(i); + auto json = std::static_pointer_cast( + Ship::Context::GetInstance()->GetResourceManager()->LoadResource(filePath, true, initData)); + + std::string fileName = filePath.substr(start, filePath.size() - start - 5); // 5 for length of ".json" + ParsePreset(json->Data, fileName); + } +} + +void SavePreset(std::string& presetName) { + if (!fs::exists(presetFolder)) { + fs::create_directory(presetFolder); + } + presets[presetName].presetValues["presetName"] = presetName; + std::ofstream file( + fmt::format("{}/{}.json", Ship::Context::GetInstance()->LocateFileAcrossAppDirs("presets"), presetName)); + file << presets[presetName].presetValues.dump(4); + file.close(); + LoadPresets(); +} + +static std::string newPresetName; +static bool saveSection[PRESET_SECTION_MAX]; + +void DrawNewPresetPopup() { + bool nameExists = presets.contains(newPresetName); + UIWidgets::InputString("Preset Name", &newPresetName, + UIWidgets::InputOptions() + .Color(THEME_COLOR) + .Size({ 200, 40 }) + .ComponentAlignment(UIWidgets::ComponentAlignments::Right) + .LabelPosition(UIWidgets::LabelPositions::Near) + .ErrorText("Preset name already exists") + .HasError(nameExists)); + nameExists = presets.contains(newPresetName); + bool noneSelected = true; + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + if (saveSection[i]) { + noneSelected = false; + break; + } + } + const char* disabledTooltip = + (newPresetName.empty() ? "Preset name is empty" + : (noneSelected ? "No sections selected" : "Preset name already exists")); + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + UIWidgets::Checkbox(fmt::format("Save {}", blockInfo[i].names[0]).c_str(), &saveSection[i], + UIWidgets::CheckboxOptions().Color(THEME_COLOR).Padding({ 6.0f, 6.0f })); + } + if (UIWidgets::Button( + "Save", UIWidgets::ButtonOptions({ { .disabled = (nameExists || noneSelected || newPresetName.empty()), + .disabledTooltip = disabledTooltip } }) + .Padding({ 6.0f, 6.0f }) + .Color(THEME_COLOR))) { + presets[newPresetName] = {}; + auto config = Ship::Context::GetInstance()->GetConfig()->GetNestedJson(); + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + if (saveSection[i]) { + for (int j = 0; j < blockInfo[i].sections.size(); j++) { + presets[newPresetName].presetValues["blocks"][blockInfo[i].names[1]][blockInfo[i].sections[j]] = + config["CVars"][blockInfo[i].sections[j]]; + } + } + } + if (saveSection[PRESET_SECTION_TRACKERS]) { + for (auto id : itemTrackerWindowIDs) { + auto window = ImGui::FindWindowByName(id); + if (window != nullptr) { + auto size = window->Size; + auto pos = window->Pos; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]] + ["windows"][id]["size"]["width"] = size.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]] + ["windows"][id]["size"]["height"] = size.y; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]] + ["windows"][id]["pos"]["x"] = pos.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]] + ["windows"][id]["pos"]["y"] = pos.y; + } + } + + auto window = ImGui::FindWindowByName("Entrance Tracker"); + if (window != nullptr) { + auto size = window->Size; + auto pos = window->Pos; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Entrance Tracker"]["size"]["width"] = size.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Entrance Tracker"]["size"]["height"] = size.y; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Entrance Tracker"]["pos"]["x"] = pos.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Entrance Tracker"]["pos"]["y"] = pos.y; + } + + window = ImGui::FindWindowByName("Check Tracker"); + if (window != nullptr) { + auto size = window->Size; + auto pos = window->Pos; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Check Tracker"]["size"]["width"] = size.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Check Tracker"]["size"]["height"] = size.y; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Check Tracker"]["pos"]["x"] = pos.x; + presets[newPresetName].presetValues["blocks"][blockInfo[PRESET_SECTION_TRACKERS].names[1]]["windows"] + ["Check Tracker"]["pos"]["y"] = pos.y; + } + } + presets[newPresetName].fileName = newPresetName; + std::fill_n(presets[newPresetName].apply, PRESET_SECTION_MAX, true); + SavePreset(newPresetName); + newPresetName = ""; + ImGui::CloseCurrentPopup(); + } + if (UIWidgets::Button("Cancel", UIWidgets::ButtonOptions().Padding({ 6.0f, 6.0f }).Color(THEME_COLOR))) { + ImGui::CloseCurrentPopup(); + } + ImGui::EndPopup(); +} + +void PresetsCustomWidget(WidgetInfo& info) { + ImGui::PushFont(OTRGlobals::Instance->fontMonoLargest); + if (UIWidgets::Button("New Preset", UIWidgets::ButtonOptions( + { { .disabled = (CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) != 0), + .disabledTooltip = "Disabled because of race lockout" } }) + .Size(UIWidgets::Sizes::Inline) + .Color(THEME_COLOR))) { + ImGui::OpenPopup("newPreset"); + } + if (ImGui::BeginPopup("newPreset", ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | + ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoScrollbar | + ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoTitleBar)) { + DrawNewPresetPopup(); + } + ImGui::SameLine(); + UIWidgets::CVarCheckbox("Hide built-in presets", CVAR_GENERAL("HideBuiltInPresets"), + UIWidgets::CheckboxOptions().Color(THEME_COLOR)); + bool hideBuiltIn = CVarGetInteger(CVAR_GENERAL("HideBuiltInPresets"), 0); + UIWidgets::PushStyleTabs(THEME_COLOR); + if (ImGui::BeginTable("PresetWidgetTable", PRESET_SECTION_MAX + 3)) { + ImGui::TableSetupColumn("Name", ImGuiTableColumnFlags_WidthFixed, 250); + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + ImGui::TableSetupColumn(blockInfo[i].names[0].c_str()); + } + ImGui::TableSetupColumn("Apply", ImGuiTableColumnFlags_WidthFixed, + ImGui::CalcTextSize("Apply").x + ImGui::GetStyle().FramePadding.x * 2); + ImGui::TableSetupColumn("Delete", ImGuiTableColumnFlags_WidthFixed, + ImGui::CalcTextSize("Delete").x + ImGui::GetStyle().FramePadding.x * 2); + BlankButton(); + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + ImGui::TableNextColumn(); + ImGui::Button(fmt::format("{}##header{}", blockInfo[i].icon, blockInfo[i].names[1]).c_str()); + UIWidgets::Tooltip(blockInfo[i].names[0].c_str()); + } + UIWidgets::PopStyleButton(); + + if (presets.empty()) { + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::AlignTextToFramePadding(); + ImGui::Text("No presets found."); + ImGui::EndTable(); + UIWidgets::PopStyleTabs(); + ImGui::PopFont(); + return; + } + for (auto& [name, info] : presets) { + if (hideBuiltIn && info.isBuiltIn) { + continue; + } + ImGui::TableNextRow(); + ImGui::TableNextColumn(); + ImGui::AlignTextToFramePadding(); + ImGui::Text(name.c_str()); + for (int i = PRESET_SECTION_SETTINGS; i < PRESET_SECTION_MAX; i++) { + ImGui::TableNextColumn(); + DrawSectionCheck(name, !info.presetValues["blocks"].contains(blockInfo[i].names[1]), &info.apply[i], + blockInfo[i].names[1]); + } + ImGui::TableNextColumn(); + UIWidgets::PushStyleButton(THEME_COLOR); + if (UIWidgets::Button( + ("Apply##" + name).c_str(), + UIWidgets::ButtonOptions({ { .disabled = (CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) != 0), + .disabledTooltip = "Disabled because of race lockout" } }) + .Padding({ 6.0f, 6.0f }))) { + applyPreset(name); + } + UIWidgets::PopStyleButton(); + ImGui::TableNextColumn(); + UIWidgets::PushStyleButton(THEME_COLOR); + if (!info.isBuiltIn) { + if (UIWidgets::Button(("Delete##" + name).c_str(), + UIWidgets::ButtonOptions().Padding({ 6.0f, 6.0f }))) { + auto path = FormatPresetPath(info.fileName); + if (fs::exists(path)) { + fs::remove(path); + } + presets.erase(name); + UIWidgets::PopStyleButton(); + break; + } + } + UIWidgets::PopStyleButton(); + } + + ImGui::EndTable(); + } + ImGui::PopFont(); + UIWidgets::PopStyleTabs(); +} + +void RegisterPresetsWidgets() { + SohGui::mSohMenu->AddSidebarEntry("Settings", "Presets", 1); + WidgetPath path = { "Settings", "Presets", SECTION_COLUMN_1 }; + SohGui::mSohMenu->AddWidget(path, "PresetsWidget", WIDGET_CUSTOM).CustomFunction(PresetsCustomWidget); + presetFolder = Ship::Context::GetInstance()->GetPathRelativeToAppDirectory("presets"); + std::fill_n(saveSection, PRESET_SECTION_MAX, true); + LoadPresets(); +} + +static RegisterMenuInitFunc initFunc(RegisterPresetsWidgets); diff --git a/soh/soh/Enhancements/Presets/Presets.h b/soh/soh/Enhancements/Presets/Presets.h index 898bc9cc9..5edb265a3 100644 --- a/soh/soh/Enhancements/Presets/Presets.h +++ b/soh/soh/Enhancements/Presets/Presets.h @@ -2,57 +2,17 @@ #include #include -#include -#include "soh/OTRGlobals.h" -enum PresetEntryType { - PRESET_ENTRY_TYPE_S32, - PRESET_ENTRY_TYPE_FLOAT, - PRESET_ENTRY_TYPE_STRING, - PRESET_ENTRY_TYPE_CPP_STRING, +enum PresetSection { + PRESET_SECTION_SETTINGS, + PRESET_SECTION_ENHANCEMENTS, + PRESET_SECTION_AUDIO, + PRESET_SECTION_COSMETICS, + PRESET_SECTION_RANDOMIZER, + PRESET_SECTION_TRACKERS, + PRESET_SECTION_NETWORK, + PRESET_SECTION_MAX, }; -enum PresetType { - PRESET_TYPE_ENHANCEMENTS, - PRESET_TYPE_RANDOMIZER, -}; - -enum EnhancementPreset { - ENHANCEMENT_PRESET_DEFAULT, - ENHANCEMENT_PRESET_VANILLA_PLUS, - ENHANCEMENT_PRESET_ENHANCED, - ENHANCEMENT_PRESET_RANDOMIZER, -}; - -enum RandomizerPreset { - RANDOMIZER_PRESET_DEFAULT, - RANDOMIZER_PRESET_BEGINNER, - RANDOMIZER_PRESET_STANDARD, - RANDOMIZER_PRESET_ADVANCED, - RANDOMIZER_PRESET_HELL_MODE, -}; - -typedef struct PresetEntry { - const char* cvar; - PresetEntryType type; - std::variant value; -} PresetEntry; - -std::string FormatLocations(std::vector locs); - -void DrawPresetSelector(PresetType presetType); -void clearCvars(std::vector cvarsToClear); -void applyPreset(std::vector entries); - -typedef struct PresetDefinition { - const char* label; - const char* description; - std::vector entries; -} PresetDefinition; - -typedef struct PresetTypeDefinition { - std::vector blocksToClear; - std::map presets; -} PresetTypeDefinition; - -extern const std::map presetTypes; +void DrawPresetSelector(std::vector includeSections, std::string currentIndex, bool disabled); +void applyPreset(std::string presetName, std::vector includeSections = {}); diff --git a/soh/soh/Enhancements/QoL/DaytimeGS.cpp b/soh/soh/Enhancements/QoL/DaytimeGS.cpp new file mode 100644 index 000000000..869945cb5 --- /dev/null +++ b/soh/soh/Enhancements/QoL/DaytimeGS.cpp @@ -0,0 +1,70 @@ +#include +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" +#include "soh/ShipInit.hpp" +#include "functions.h" +#include "macros.h" + +extern "C" { +extern PlayState* gPlayState; +extern SaveContext gSaveContext; +} + +static constexpr int32_t CVAR_DAYTIME_GS_DEFAULT = 0; +#define CVAR_DAYTIME_GS_NAME CVAR_ENHANCEMENT("NightGSAlwaysSpawn") +#define CVAR_DAYTIME_GS_VALUE CVarGetInteger(CVAR_DAYTIME_GS_NAME, CVAR_DAYTIME_GS_DEFAULT) + +struct DayTimeGoldSkulltulas { + uint16_t scene; + uint16_t room; + bool forChild; + std::vector actorEntries; +}; + +using DayTimeGoldSkulltulasList = std::vector; + +void OnSpawnNighttimeGoldSkulltula() { + // Gold Skulltulas that are not part of the scene actor list during the day + // Actor values copied from the night time scene actor list + static const DayTimeGoldSkulltulasList dayTimeGoldSkulltulas = { + // Graveyard + { SCENE_GRAVEYARD, 1, true, { { ACTOR_EN_SW, { 156, 315, 795 }, { 16384, -32768, 0 }, -20096 } } }, + // ZF + { SCENE_ZORAS_FOUNTAIN, 0, true, { { ACTOR_EN_SW, { -1891, 187, 1911 }, { 16384, 18022, 0 }, -19964 } } }, + // GF + { SCENE_GERUDOS_FORTRESS, 0, false, { { ACTOR_EN_SW, { 1598, 999, -2008 }, { 16384, -16384, 0 }, -19198 } } }, + { SCENE_GERUDOS_FORTRESS, 1, false, { { ACTOR_EN_SW, { 3377, 1734, -4935 }, { 16384, 0, 0 }, -19199 } } }, + // Kak + { SCENE_KAKARIKO_VILLAGE, 0, false, { { ACTOR_EN_SW, { -18, 540, 1800 }, { 0, -32768, 0 }, -20160 } } }, + { SCENE_KAKARIKO_VILLAGE, + 0, + true, + { { ACTOR_EN_SW, { -465, 377, -888 }, { 0, 28217, 0 }, -20222 }, + { ACTOR_EN_SW, { 5, 686, -171 }, { 0, -32768, 0 }, -20220 }, + { ACTOR_EN_SW, { 324, 270, 905 }, { 16384, 0, 0 }, -20216 }, + { ACTOR_EN_SW, { -602, 120, 1120 }, { 16384, 0, 0 }, -20208 } } }, + // LLR + { SCENE_LON_LON_RANCH, + 0, + true, + { { ACTOR_EN_SW, { -2344, 180, 672 }, { 16384, 22938, 0 }, -29695 }, + { ACTOR_EN_SW, { 808, 48, 326 }, { 16384, 0, 0 }, -29694 }, + { ACTOR_EN_SW, { 997, 286, -2698 }, { 16384, -16384, 0 }, -29692 } } }, + }; + + for (const auto& dayTimeGS : dayTimeGoldSkulltulas) { + if (IS_DAY && dayTimeGS.forChild == LINK_IS_CHILD && dayTimeGS.scene == gPlayState->sceneNum && + dayTimeGS.room == gPlayState->roomCtx.curRoom.num) { + for (const auto& actorEntry : dayTimeGS.actorEntries) { + Actor_Spawn(&gPlayState->actorCtx, gPlayState, actorEntry.id, actorEntry.pos.x, actorEntry.pos.y, + actorEntry.pos.z, actorEntry.rot.x, actorEntry.rot.y, actorEntry.rot.z, actorEntry.params, + false); + } + } + } +} + +void RegisterDaytimeGoldSkultullas() { + COND_HOOK(OnSceneSpawnActors, CVAR_DAYTIME_GS_VALUE, OnSpawnNighttimeGoldSkulltula); +} + +static RegisterShipInitFunc initFunc_DaytimeGoldSkulltulas(RegisterDaytimeGoldSkultullas, { CVAR_DAYTIME_GS_NAME }); diff --git a/soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp b/soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp index b9f65df04..896f07973 100644 --- a/soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp +++ b/soh/soh/Enhancements/TimeSavers/CrawlSpeed.cpp @@ -77,9 +77,9 @@ void CrawlSpeed_Register() { COND_VB_SHOULD(VB_CRAWL_SPEED_EXIT_CS, shouldRegister, { Player* player = GET_PLAYER(gPlayState); Camera* csCam = va_arg(args, Camera*); - s16 csId = va_arg(args, s16); - s16 actionParameters = va_arg(args, s16); - s16 initTimer = va_arg(args, s16); + s16 csId = static_cast(va_arg(args, int)); + s16 actionParameters = static_cast(va_arg(args, int)); + s16 initTimer = static_cast(va_arg(args, int)); CutsceneCameraPoint* atPoints = va_arg(args, CutsceneCameraPoint*); CutsceneCameraPoint* eyePoints = va_arg(args, CutsceneCameraPoint*); bool excludeWellBackroom = (player->actor.world.pos.x > 950.0f) && (player->actor.world.pos.x < 1025.0f) && diff --git a/soh/soh/Enhancements/TimeSavers/FasterBeanSkulltula.cpp b/soh/soh/Enhancements/TimeSavers/FasterBeanSkulltula.cpp new file mode 100644 index 000000000..20011bba3 --- /dev/null +++ b/soh/soh/Enhancements/TimeSavers/FasterBeanSkulltula.cpp @@ -0,0 +1,13 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "z64save.h" +} + +void RegisterFasterBeanSkulltula() { + COND_VB_SHOULD(VB_SPAWN_BEAN_SKULLTULA, CVarGetInteger(CVAR_ENHANCEMENT("FasterBeanSkull"), 0), + { *should = true; }); +} + +static RegisterShipInitFunc initFunc(RegisterFasterBeanSkulltula, { CVAR_ENHANCEMENT("FasterBeanSkull") }); diff --git a/soh/soh/Enhancements/TimeSavers/FasterBottleEmpty.cpp b/soh/soh/Enhancements/TimeSavers/FasterBottleEmpty.cpp new file mode 100644 index 000000000..47b6b7461 --- /dev/null +++ b/soh/soh/Enhancements/TimeSavers/FasterBottleEmpty.cpp @@ -0,0 +1,19 @@ +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/ShipInit.hpp" + +extern "C" { +#include "z64save.h" +} + +void RegisterFasterEmptyBottle() { + COND_VB_SHOULD(VB_EMPTYING_BOTTLE, CVarGetInteger(CVAR_ENHANCEMENT("FasterBottleEmpty"), 0), { + Player* player = va_arg(args, Player*); + if (player->skelAnime.curFrame <= 60.0f) { + player->skelAnime.playSpeed = 3.0f; + } else { + player->skelAnime.playSpeed = 1.0f; + } + }); +} + +static RegisterShipInitFunc initFunc(RegisterFasterEmptyBottle, { CVAR_ENHANCEMENT("FasterBottleEmpty") }); diff --git a/soh/soh/Enhancements/TimeSavers/FasterHeavyBlockLift.cpp b/soh/soh/Enhancements/TimeSavers/FasterHeavyBlockLift.cpp index 10a22d903..97c253073 100644 --- a/soh/soh/Enhancements/TimeSavers/FasterHeavyBlockLift.cpp +++ b/soh/soh/Enhancements/TimeSavers/FasterHeavyBlockLift.cpp @@ -41,7 +41,7 @@ void FasterHeavyBlockLift_Register() { LinkAnimationHeader* anim = va_arg(args, LinkAnimationHeader*); // 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; + bool isLargeSilverRock = (interactActorId == ACTOR_EN_ISHI) && ((interactRangeActor->params & 1) == 1); if (CVarGetInteger(CVAR_ENHANCEMENT("FasterHeavyBlockLift"), 0) && (isLargeSilverRock || interactActorId == ACTOR_BG_HEAVY_BLOCK)) { *should = false; diff --git a/soh/soh/Enhancements/audio/AudioEditor.cpp b/soh/soh/Enhancements/audio/AudioEditor.cpp index 9865615bd..4cf1f389d 100644 --- a/soh/soh/Enhancements/audio/AudioEditor.cpp +++ b/soh/soh/Enhancements/audio/AudioEditor.cpp @@ -265,6 +265,9 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN } } + auto playingFromMenu = CVarGetInteger(CVAR_AUDIO("Playing"), 0); + auto currentBGM = func_800FA0B4(SEQ_PLAYER_BGM_MAIN); + // Longest text in Audio Editor ImVec2 columnSize = ImGui::CalcTextSize("Navi - Look/Hey/Watchout (Target Enemy)"); ImGui::BeginTable(tabId.c_str(), 3, ImGuiTableFlags_SizingFixedFit); @@ -291,10 +294,13 @@ void Draw_SfxTab(const std::string& tabId, SeqType type, const std::string& tabN const std::string lockedButton = ICON_FA_LOCK + hiddenKey; const std::string unlockedButton = ICON_FA_UNLOCK + hiddenKey; const int currentValue = CVarGetInteger(cvarKey.c_str(), defaultValue); + const bool isCurrentlyPlaying = currentValue == playingFromMenu || seqData.sequenceId == currentBGM; ImGui::TableNextRow(); ImGui::TableNextColumn(); - ImGui::Text("%s", seqData.label.c_str()); + ImGui::TextColored( + UIWidgets::ColorValues.at(isCurrentlyPlaying ? UIWidgets::Colors::Yellow : UIWidgets::Colors::White), "%s", + seqData.label.c_str()); ImGui::TableNextColumn(); ImGui::PushItemWidth(-FLT_MIN); const int initialValue = map.contains(currentValue) ? currentValue : defaultValue; diff --git a/soh/soh/Enhancements/boss-rush/BossRush.cpp b/soh/soh/Enhancements/boss-rush/BossRush.cpp index 76cf5637e..979f0ad6a 100644 --- a/soh/soh/Enhancements/boss-rush/BossRush.cpp +++ b/soh/soh/Enhancements/boss-rush/BossRush.cpp @@ -111,7 +111,7 @@ const char* BossRush_GetSettingChoiceName(u8 optionIndex, u8 choiceIndex, u8 lan } u8 BossRush_GetSettingOptionsAmount(u8 optionIndex) { - return BossRushOptions[optionIndex].choices.size(); + return static_cast(BossRushOptions[optionIndex].choices.size()); } void BossRush_SpawnBlueWarps(PlayState* play) { @@ -311,7 +311,8 @@ void BossRush_HandleCompleteBoss(PlayState* play) { play->sceneNum == SCENE_GANON_BOSS) { gSaveContext.ship.stats.playTimer += 2; gSaveContext.ship.stats.gameComplete = 1; - gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_BOSSRUSH_FINISH] = GAMEPLAYSTAT_TOTAL_TIME; + gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_BOSSRUSH_FINISH] = + static_cast(GAMEPLAYSTAT_TOTAL_TIME); } } diff --git a/soh/soh/Enhancements/controls/InputViewer.cpp b/soh/soh/Enhancements/controls/InputViewer.cpp index 1d6695d25..1fbab40c2 100644 --- a/soh/soh/Enhancements/controls/InputViewer.cpp +++ b/soh/soh/Enhancements/controls/InputViewer.cpp @@ -49,14 +49,14 @@ void InputViewer::RenderButton(std::string btnTexture, std::string btnOutlineTex if (outlineMode == BUTTON_OUTLINE_ALWAYS_SHOWN || (outlineMode == BUTTON_OUTLINE_NOT_PRESSED && !state) || (outlineMode == BUTTON_OUTLINE_PRESSED && state)) { ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnOutlineTexture), size, - ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } // Render button if pressed if (state) { ImGui::SetCursorPos(pos); ImGui::SetNextItemAllowOverlap(); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnTexture), size, - ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } } @@ -201,7 +201,7 @@ void InputViewer::DrawElement() { // Background ImGui::Image( Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Input-Viewer-Background"), - scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } // A/B @@ -345,14 +345,14 @@ void InputViewer::DrawElement() { // Analog Stick const int analogOutlineMode = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.OutlineMode"), STICK_MODE_ALWAYS_SHOWN); - const float maxStickDistance = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.Movement"), 12); + const int32_t 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( Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick Outline"), - scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } const int analogStickMode = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogStick.VisibilityMode"), STICK_MODE_ALWAYS_SHOWN); @@ -363,11 +363,11 @@ void InputViewer::DrawElement() { 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(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick"), - scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } // Right Stick - const float maxRightStickDistance = CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.Movement"), 7); + const int32_t maxRightStickDistance = CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.Movement"), 7); const int rightOutlineMode = CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.OutlineMode"), STICK_MODE_ALWAYS_HIDDEN); if (rightOutlineMode == STICK_MODE_ALWAYS_SHOWN || @@ -376,7 +376,7 @@ void InputViewer::DrawElement() { ImGui::SetCursorPos(aPos); ImGui::Image( Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick Outline"), - scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } const int rightStickMode = CVarGetInteger(CVAR_INPUT_VIEWER("RightStick.VisibilityMode"), STICK_MODE_ALWAYS_HIDDEN); @@ -387,7 +387,7 @@ void InputViewer::DrawElement() { 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(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick"), - scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f)); } // Analog stick angle text @@ -401,7 +401,7 @@ void InputViewer::DrawElement() { 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; + const int32_t rSquared = pads[0].stick_x * pads[0].stick_x + pads[0].stick_y * pads[0].stick_y; // ESS range const int range1Min = CVarGetInteger(CVAR_INPUT_VIEWER("AnalogAngles.Range1.Min"), 8); diff --git a/soh/soh/Enhancements/controls/Mouse.cpp b/soh/soh/Enhancements/controls/Mouse.cpp index 4282c3718..4ad9d11d0 100644 --- a/soh/soh/Enhancements/controls/Mouse.cpp +++ b/soh/soh/Enhancements/controls/Mouse.cpp @@ -50,8 +50,8 @@ void Mouse_HandleFirstPerson(Player* player) { : 1; s8 invertYAxisMulti = CVarGetInteger(CVAR_SETTING("Controls.InvertAimingYAxis"), 1) ? 1 : -1; if (MOUSE_ENABLED) { - player->actor.focus.rot.y -= mouseCoordRel.x * 6.0f * xAxisMulti * invertXAxisMulti; - player->actor.focus.rot.x += mouseCoordRel.y * 6.0f * yAxisMulti * invertYAxisMulti; + player->actor.focus.rot.y -= static_cast(mouseCoordRel.x * 6.0f * xAxisMulti * invertXAxisMulti); + player->actor.focus.rot.x += static_cast(mouseCoordRel.y * 6.0f * yAxisMulti * invertYAxisMulti); } } @@ -59,7 +59,7 @@ void Mouse_RecenterCursor() { u32 width = GetWindow()->GetWidth(); u32 height = GetWindow()->GetHeight(); if (MOUSE_ENABLED) { - GetWindow()->SetMousePos({ (s32)(width / 2), (s32)(height / 2) }); + GetWindow()->SetMousePos({ static_cast(width / 2), static_cast(height / 2) }); } } @@ -67,8 +67,8 @@ void Mouse_HandleShield(f32* sp50, f32* sp54) { if (MOUSE_ENABLED) { s32 width = GetWindow()->GetWidth(); s32 height = GetWindow()->GetHeight(); - f32 xBound = 7200 / ((f32)width / 2); - f32 yBound = 6000 / ((f32)height / 2); + f32 xBound = 7200 / (width / 2.0f); + f32 yBound = 6000 / (height / 2.0f); *sp50 += (mouseCoord.x - (width / 2)) * xBound * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? 1 : -1); *sp54 += (mouseCoord.y - (height / 2)) * yBound; @@ -78,8 +78,8 @@ void Mouse_HandleShield(f32* sp50, f32* sp54) { } static s8 iterMouse = 0; -static f32 mouseQuickspinX[5] = {}; -static f32 mouseQuickspinY[5] = {}; +static s32 mouseQuickspinX[5] = {}; +static s32 mouseQuickspinY[5] = {}; static u8 quickspinCount = 0; void Mouse_UpdateQuickspinCount() { @@ -102,9 +102,9 @@ bool Mouse_HandleQuickspin(bool* should, s8* iter2, s8* sp3C) { for (i = 0; i < 4; i++, iter2++) { // Calculating angles as per z_lib.c:func_80077D10() - f32 relY = mouseQuickspinY[i + 1] - mouseQuickspinY[i]; - f32 relX = mouseQuickspinX[i + 1] - mouseQuickspinX[i]; - s16 aTan = Math_Atan2S(relY, -relX); + s32 relY = mouseQuickspinY[i + 1] - mouseQuickspinY[i]; + s32 relX = mouseQuickspinX[i + 1] - mouseQuickspinX[i]; + s16 aTan = Math_Atan2S((f32)relY, (f32)-relX); iterMouse = (u16)(aTan + 0x2000) >> 9; // See z_player.c:Player_ProcessControlStick() if ((*iter2 = iterMouse) < 0) { return *should = false; diff --git a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp index 3f77d1ed4..8a8227073 100644 --- a/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp +++ b/soh/soh/Enhancements/controls/SohInputEditorWindow.cpp @@ -642,10 +642,14 @@ void SohInputEditorWindow::DrawStickSection(uint8_t port, uint8_t stick, int32_t ImGui::SameLine(); ImGui::BeginGroup(); - 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); + DrawStickDirectionLine(StringHelper::Sprintf("%s##%d", ICON_FA_ARROW_UP, stick).c_str(), port, stick, Ship::UP, + color); + DrawStickDirectionLine(StringHelper::Sprintf("%s##%d", ICON_FA_ARROW_DOWN, stick).c_str(), port, stick, Ship::DOWN, + color); + DrawStickDirectionLine(StringHelper::Sprintf("%s##%d", ICON_FA_ARROW_LEFT, stick).c_str(), port, stick, Ship::LEFT, + color); + DrawStickDirectionLine(StringHelper::Sprintf("%s##%d", ICON_FA_ARROW_RIGHT, stick).c_str(), port, stick, + Ship::RIGHT, color); ImGui::EndGroup(); ImGui::SetNextItemOpen(true, ImGuiCond_Once); if (ImGui::TreeNode(StringHelper::Sprintf("Analog Stick Options##%d", id).c_str())) { @@ -1335,12 +1339,12 @@ void SohInputEditorWindow::DrawOcarinaControlPanel() { ImGui::AlignTextToFramePadding(); ImGui::BulletText("Disable song detection"); - DrawButtonLine(ICON_FA_BAN, 0, BTN_CUSTOM_OCARINA_DISABLE_SONGS); + DrawButtonLine(ICON_FA_BAN "##DisableSongDetection", 0, BTN_CUSTOM_OCARINA_DISABLE_SONGS); ImGui::AlignTextToFramePadding(); ImGui::BulletText("Pitch"); - DrawButtonLine(ICON_FA_ARROW_UP, 0, BTN_CUSTOM_OCARINA_PITCH_UP); - DrawButtonLine(ICON_FA_ARROW_DOWN, 0, BTN_CUSTOM_OCARINA_PITCH_DOWN); + DrawButtonLine(ICON_FA_ARROW_UP "##Pitch", 0, BTN_CUSTOM_OCARINA_PITCH_UP); + DrawButtonLine(ICON_FA_ARROW_DOWN "##Pitch", 0, BTN_CUSTOM_OCARINA_PITCH_DOWN); if (!CVarGetInteger(CVAR_SETTING("CustomOcarina.Enabled"), 0)) { ImGui::EndDisabled(); diff --git a/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp b/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp index 1a6f9ce62..27b080358 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp +++ b/soh/soh/Enhancements/custom-message/CustomMessageManager.cpp @@ -155,12 +155,12 @@ const std::string CustomMessage::GetFrench(MessageFormat format) const { } const std::string CustomMessage::GetForCurrentLanguage(MessageFormat format) const { - return GetForLanguage(((Language)gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : gSaveContext.language, - format); + return GetForLanguage( + ((Language)gSaveContext.language == LANGUAGE_JPN) ? LANGUAGE_ENG : (Language)gSaveContext.language, format); } const std::string CustomMessage::GetForLanguage(uint8_t language, MessageFormat format) const { - std::string output = messages[language] != TODO_TRANSLATE ? messages[language] : messages[LANGUAGE_ENG]; + std::string output = !messages[language].starts_with(TODO_TRANSLATE) ? messages[language] : messages[LANGUAGE_ENG]; ProcessMessageFormat(output, format); return output; } diff --git a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h index e7c559857..3bcbaf7b0 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h +++ b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h @@ -162,6 +162,7 @@ typedef enum { TEXT_ANJU_THANKS_FOR_FINDING_MY_CUCCOS = 0x503B, TEXT_ANJU_ROUND_THEM_UP_OR_YOULL_PAY = 0x503C, TEXT_ANJU_DONT_TEASE_MY_CUCCOS = 0x503D, + TEXT_BIG_POE_COLLECTED_RANDO = 0x5090, TEXT_HBA_NOT_ON_HORSE = 0x603F, TEXT_HBA_INITIAL_EXPLAINATION = 0x6040, TEXT_HBA_WANT_TO_TRY_AGAIN_YES_NO = 0x6041, diff --git a/soh/soh/Enhancements/debugger/actorViewer.cpp b/soh/soh/Enhancements/debugger/actorViewer.cpp index 515da6491..d21d9449e 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.cpp +++ b/soh/soh/Enhancements/debugger/actorViewer.cpp @@ -5,7 +5,9 @@ #include "soh/ActorDB.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" #include "soh/Enhancements/nametag.h" +#include "soh/ShipInit.hpp" +#include #include #include #include @@ -13,8 +15,10 @@ #include #include #include +#include #include "soh/OTRGlobals.h" #include "soh/cvar_prefixes.h" +#include "soh/ObjectExtension/ActorListIndex.h" extern "C" { #include @@ -31,6 +35,10 @@ extern PlayState* gPlayState; #define DEKUNUTS_FLOWER 10 #define DEBUG_ACTOR_NAMETAG_TAG "debug_actor_viewer" +#define CVAR_ACTOR_NAME_TAGS(val) CVAR_DEVELOPER_TOOLS("ActorViewer.NameTags." val) +#define CVAR_ACTOR_NAME_TAGS_ENABLED_NAME CVAR_ACTOR_NAME_TAGS("Enabled") +#define CVAR_ACTOR_NAME_TAGS_ENABLED CVarGetInteger(CVAR_ACTOR_NAME_TAGS("Enabled"), 0) + typedef struct { u16 id; u16 params; @@ -38,13 +46,6 @@ typedef struct { Vec3s rot; } ActorInfo; -typedef enum { - LIST, - TARGET, - HELD, - INTERACT, -} RetrievalMethod; - std::array acMapping = { "Switch", "Background (Prop type 1)", "Player", "Bomb", @@ -67,6 +68,10 @@ const std::string GetActorDescription(u16 id) { return ActorDB::Instance->RetrieveEntry(id).entry.valid ? ActorDB::Instance->RetrieveEntry(id).entry.desc : "???"; } +const std::string GetActorDebugName(u16 id) { + return ActorDB::Instance->RetrieveEntry(id).entry.valid ? ActorDB::Instance->RetrieveEntry(id).entry.name : "???"; +} + template void DrawGroupWithBorder(T&& drawFunc, std::string section) { // First group encapsulates the inner portion and border ImGui::BeginChild(std::string("##" + section).c_str(), ImVec2(0, 0), @@ -812,25 +817,37 @@ std::vector GetActorsWithDescriptionContainingString(std::string s) { } void ActorViewer_AddTagForActor(Actor* actor) { - int val = CVarGetInteger(CVAR_DEVELOPER_TOOLS("ActorViewer.NameTags"), ACTORVIEWER_NAMETAGS_NONE); - auto entry = ActorDB::Instance->RetrieveEntry(actor->id); - std::string tag; - - if (val > 0 && entry.entry.valid) { - switch (val) { - case ACTORVIEWER_NAMETAGS_DESC: - tag = entry.desc; - break; - case ACTORVIEWER_NAMETAGS_NAME: - tag = entry.name; - break; - case ACTORVIEWER_NAMETAGS_BOTH: - tag = entry.name + '\n' + entry.desc; - break; - } - - NameTag_RegisterForActorWithOptions(actor, tag.c_str(), { .tag = DEBUG_ACTOR_NAMETAG_TAG }); + if (!CVarGetInteger(CVAR_ACTOR_NAME_TAGS("Enabled"), 0)) { + return; } + + std::vector parts; + + if (CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayID"), 0)) { + parts.push_back(GetActorDebugName(actor->id)); + } + if (CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayDescription"), 0)) { + parts.push_back(GetActorDescription(actor->id)); + } + if (CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayCategory"), 0)) { + parts.push_back(acMapping[actor->category]); + } + if (CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayParams"), 0)) { + parts.push_back(fmt::format("0x{:04X} ({})", (u16)actor->params, actor->params)); + } + + std::string tag = ""; + for (size_t i = 0; i < parts.size(); i++) { + if (i != 0) { + tag += "\n"; + } + tag += parts.at(i); + } + + bool withZBuffer = CVarGetInteger(CVAR_ACTOR_NAME_TAGS("WithZBuffer"), 0); + + NameTag_RegisterForActorWithOptions(actor, tag.c_str(), + { .tag = DEBUG_ACTOR_NAMETAG_TAG, .noZBuffer = !withZBuffer }); } void ActorViewer_AddTagForAllActors() { @@ -850,36 +867,64 @@ void ActorViewer_AddTagForAllActors() { void ActorViewerWindow::DrawElement() { ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0)); - static Actor* display; - static Actor empty{}; - static Actor* fetch = NULL; static ActorInfo newActor = { 0, 0, { 0, 0, 0 }, { 0, 0, 0 } }; - static bool needs_reset = false; static ImU16 one = 1; - static int actor; - static int category = 0; - static RetrievalMethod rm; static std::string filler = "Please select"; - static std::vector list; - static u16 lastSceneId = 0; static std::string searchString = ""; - static s16 currentSelectedInDropdown; - static std::vector actors; + static s16 currentSelectedInDropdown = -1; + static std::vector actorSearchResults; if (gPlayState != nullptr) { - needs_reset = lastSceneId != gPlayState->sceneNum; - if (needs_reset) { - display = ∅ - fetch = nullptr; - actor = category = 0; - filler = "Please Select"; - list.clear(); - needs_reset = false; - searchString = ""; - currentSelectedInDropdown = -1; - actors.clear(); + if (ImGui::BeginChild("options", ImVec2(0, 0), ImGuiChildFlags_Border | ImGuiChildFlags_AutoResizeY)) { + bool toggled = false; + bool optionChange = false; + + ImGui::SeparatorText("Options"); + + toggled = UIWidgets::CVarCheckbox("Actor Name Tags", CVAR_ACTOR_NAME_TAGS("Enabled"), + { { .tooltip = "Adds \"name tags\" above actors for identification" } }); + + ImGui::SameLine(); + + UIWidgets::Button("Display Items", { { .tooltip = "Click to add display items on the name tags" } }); + + if (ImGui::BeginPopupContextItem(nullptr, ImGuiPopupFlags_MouseButtonLeft | ImGuiPopupFlags_NoReopen)) { + optionChange |= UIWidgets::CVarCheckbox("ID", CVAR_ACTOR_NAME_TAGS("DisplayID")); + optionChange |= UIWidgets::CVarCheckbox("Description", CVAR_ACTOR_NAME_TAGS("DisplayDescription")); + optionChange |= UIWidgets::CVarCheckbox("Category", CVAR_ACTOR_NAME_TAGS("DisplayCategory")); + optionChange |= UIWidgets::CVarCheckbox("Params", CVAR_ACTOR_NAME_TAGS("DisplayParams")); + + ImGui::EndPopup(); + } + + optionChange |= UIWidgets::CVarCheckbox( + "Name tags with Z-Buffer", CVAR_ACTOR_NAME_TAGS("WithZBuffer"), + { { .tooltip = "Allow name tags to be obstructed when behind geometry and actors" } }); + + if (toggled || optionChange) { + bool tagsEnabled = CVarGetInteger(CVAR_ACTOR_NAME_TAGS("Enabled"), 0); + bool noOptionsEnabled = !CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayID"), 0) && + !CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayDescription"), 0) && + !CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayCategory"), 0) && + !CVarGetInteger(CVAR_ACTOR_NAME_TAGS("DisplayParams"), 0); + + // Save the user an extra click and prevent adding "empty" tags by enabling, + // disabling, or setting an option based on what changed + if (tagsEnabled && noOptionsEnabled) { + if (toggled) { + CVarSetInteger(CVAR_ACTOR_NAME_TAGS("DisplayID"), 1); + } else { + CVarSetInteger(CVAR_ACTOR_NAME_TAGS("Enabled"), 0); + } + } else if (optionChange && !tagsEnabled && !noOptionsEnabled) { + CVarSetInteger(CVAR_ACTOR_NAME_TAGS("Enabled"), 1); + } + + NameTag_RemoveAllByTag(DEBUG_ACTOR_NAMETAG_TAG); + ActorViewer_AddTagForAllActors(); + } } - lastSceneId = gPlayState->sceneNum; + ImGui::EndChild(); PushStyleCombobox(THEME_COLOR); if (ImGui::BeginCombo("Actor Type", acMapping[category])) { @@ -893,21 +938,19 @@ void ActorViewerWindow::DrawElement() { ImGui::EndCombo(); } + if (display == nullptr) { + filler = "Please select"; + } + if (ImGui::BeginCombo("Actor", filler.c_str())) { - if (gPlayState != nullptr && lastSceneId != gPlayState->sceneNum) { - PopulateActorDropdown(category, list); - lastSceneId = gPlayState->sceneNum; - } for (int i = 0; i < list.size(); i++) { std::string label = std::to_string(i) + ": " + ActorDB::Instance->RetrieveEntry(list[i]->id).name; std::string description = GetActorDescription(list[i]->id); if (description != "") label += " (" + description + ")"; - if (ImGui::Selectable(label.c_str())) { - rm = LIST; + if (ImGui::Selectable(label.c_str(), list[i] == display)) { display = list[i]; - actor = i; filler = label; break; } @@ -918,87 +961,76 @@ void ActorViewerWindow::DrawElement() { PushStyleHeader(THEME_COLOR); if (ImGui::TreeNode("Selected Actor")) { - DrawGroupWithBorder( - [&]() { - ImGui::Text("Name: %s", ActorDB::Instance->RetrieveEntry(display->id).name.c_str()); - ImGui::Text("Description: %s", GetActorDescription(display->id).c_str()); - ImGui::Text("Category: %s", acMapping[display->category]); - ImGui::Text("ID: %d", display->id); - ImGui::Text("Parameters: %d", display->params); - }, - "Selected Actor"); - ImGui::SameLine(); - ImGui::PushItemWidth(ImGui::GetFontSize() * 6); + if (display != nullptr) { + DrawGroupWithBorder( + [&]() { + ImGui::Text("Name: %s", ActorDB::Instance->RetrieveEntry(display->id).name.c_str()); + ImGui::Text("Description: %s", GetActorDescription(display->id).c_str()); + ImGui::Text("Category: %s", acMapping[display->category]); + ImGui::Text("ID: %d", display->id); + ImGui::Text("Parameters: %d", display->params); + ImGui::Text("Actor List Index: %d", GetActorListIndex(display)); + }, + "Selected Actor"); + ImGui::SameLine(); + ImGui::PushItemWidth(ImGui::GetFontSize() * 6); - DrawGroupWithBorder( - [&]() { - ImGui::PushItemWidth(ImGui::GetFontSize() * 6); + DrawGroupWithBorder( + [&]() { + ImGui::PushItemWidth(ImGui::GetFontSize() * 6); + PushStyleInput(THEME_COLOR); + ImGui::Text("Actor Position"); + ImGui::InputScalar("X##CurPos", ImGuiDataType_Float, &display->world.pos.x); + ImGui::InputScalar("Y##CurPos", ImGuiDataType_Float, &display->world.pos.y); + ImGui::InputScalar("Z##CurPos", ImGuiDataType_Float, &display->world.pos.z); + ImGui::PopItemWidth(); + PopStyleInput(); + }, + "Actor Position"); + ImGui::SameLine(); + DrawGroupWithBorder( + [&]() { + PushStyleInput(THEME_COLOR); + ImGui::PushItemWidth(ImGui::GetFontSize() * 6); + ImGui::Text("Actor Rotation"); + ImGui::InputScalar("X##CurRot", ImGuiDataType_S16, &display->world.rot.x); + ImGui::InputScalar("Y##CurRot", ImGuiDataType_S16, &display->world.rot.y); + ImGui::InputScalar("Z##CurRot", ImGuiDataType_S16, &display->world.rot.z); + ImGui::PopItemWidth(); + PopStyleInput(); + }, + "Actor Rotation"); + + if (display->category == ACTORCAT_BOSS || display->category == ACTORCAT_ENEMY) { PushStyleInput(THEME_COLOR); - ImGui::Text("Actor Position"); - ImGui::InputScalar("X##CurPos", ImGuiDataType_Float, &display->world.pos.x); - ImGui::InputScalar("Y##CurPos", ImGuiDataType_Float, &display->world.pos.y); - ImGui::InputScalar("Z##CurPos", ImGuiDataType_Float, &display->world.pos.z); - ImGui::PopItemWidth(); + ImGui::InputScalar("Enemy Health", ImGuiDataType_U8, &display->colChkInfo.health); PopStyleInput(); - }, - "Actor Position"); - ImGui::SameLine(); - DrawGroupWithBorder( - [&]() { - PushStyleInput(THEME_COLOR); - ImGui::PushItemWidth(ImGui::GetFontSize() * 6); - ImGui::Text("Actor Rotation"); - ImGui::InputScalar("X##CurRot", ImGuiDataType_S16, &display->world.rot.x); - ImGui::InputScalar("Y##CurRot", ImGuiDataType_S16, &display->world.rot.y); - ImGui::InputScalar("Z##CurRot", ImGuiDataType_S16, &display->world.rot.z); - ImGui::PopItemWidth(); - PopStyleInput(); - }, - "Actor Rotation"); - - if (display->category == ACTORCAT_BOSS || display->category == ACTORCAT_ENEMY) { - PushStyleInput(THEME_COLOR); - ImGui::InputScalar("Enemy Health", ImGuiDataType_U8, &display->colChkInfo.health); - PopStyleInput(); - UIWidgets::InsertHelpHoverText("Some actors might not use this!"); - } - - DrawGroupWithBorder( - [&]() { - ImGui::Text("flags"); - UIWidgets::DrawFlagArray32("flags", display->flags); - }, - "flags"); - - ImGui::SameLine(); - - DrawGroupWithBorder( - [&]() { - ImGui::Text("bgCheckFlags"); - UIWidgets::DrawFlagArray16("bgCheckFlags", display->bgCheckFlags); - }, - "bgCheckFlags"); - - if (Button("Refresh", ButtonOptions().Color(THEME_COLOR))) { - PopulateActorDropdown(category, list); - switch (rm) { - case INTERACT: - case HELD: - case TARGET: - display = fetch; - break; - case LIST: - display = list[actor]; - break; - default: - break; + UIWidgets::InsertHelpHoverText("Some actors might not use this!"); } - } - if (Button("Go to Actor", ButtonOptions().Color(THEME_COLOR))) { - Player* player = GET_PLAYER(gPlayState); - Math_Vec3f_Copy(&player->actor.world.pos, &display->world.pos); - Math_Vec3f_Copy(&player->actor.home.pos, &player->actor.world.pos); + DrawGroupWithBorder( + [&]() { + ImGui::Text("flags"); + UIWidgets::DrawFlagArray32("flags", display->flags); + }, + "flags"); + + ImGui::SameLine(); + + DrawGroupWithBorder( + [&]() { + ImGui::Text("bgCheckFlags"); + UIWidgets::DrawFlagArray16("bgCheckFlags", display->bgCheckFlags); + }, + "bgCheckFlags"); + + if (Button("Go to Actor", ButtonOptions().Color(THEME_COLOR))) { + Player* player = GET_PLAYER(gPlayState); + Math_Vec3f_Copy(&player->actor.world.pos, &display->world.pos); + Math_Vec3f_Copy(&player->actor.home.pos, &player->actor.world.pos); + } + } else { + ImGui::Text("Select an actor to display information."); } if (Button("Fetch from Target", @@ -1006,34 +1038,28 @@ void ActorViewerWindow::DrawElement() { .Color(THEME_COLOR) .Tooltip("Grabs actor with target arrow above it. You might need C-Up for enemies"))) { Player* player = GET_PLAYER(gPlayState); - fetch = player->talkActor; - if (fetch != NULL) { - display = fetch; - category = fetch->category; + if (player->talkActor != NULL) { + display = player->talkActor; + category = display->category; PopulateActorDropdown(category, list); - rm = TARGET; } } if (Button("Fetch from Held", ButtonOptions().Color(THEME_COLOR).Tooltip("Grabs actor that Link is holding"))) { Player* player = GET_PLAYER(gPlayState); - fetch = player->heldActor; - if (fetch != NULL) { - display = fetch; - category = fetch->category; + if (player->heldActor != NULL) { + display = player->heldActor; + category = display->category; PopulateActorDropdown(category, list); - rm = HELD; } } if (Button("Fetch from Interaction", ButtonOptions().Color(THEME_COLOR).Tooltip("Grabs actor from \"interaction range\""))) { Player* player = GET_PLAYER(gPlayState); - fetch = player->interactRangeActor; - if (fetch != NULL) { - display = fetch; - category = fetch->category; + if (player->interactRangeActor != NULL) { + display = player->interactRangeActor; + category = display->category; PopulateActorDropdown(category, list); - rm = INTERACT; } } @@ -1044,21 +1070,22 @@ void ActorViewerWindow::DrawElement() { // ImGui::PushItemWidth(ImGui::GetFontSize() * 10); if (InputString("Search Actor", &searchString, InputOptions().Color(THEME_COLOR))) { - actors = GetActorsWithDescriptionContainingString(searchString); + actorSearchResults = GetActorsWithDescriptionContainingString(searchString); currentSelectedInDropdown = -1; } - if (!SohUtils::IsStringEmpty(searchString) && !actors.empty()) { - std::string preview = currentSelectedInDropdown == -1 - ? "Please Select" - : ActorDB::Instance->RetrieveEntry(actors[currentSelectedInDropdown]).desc; + if (!SohUtils::IsStringEmpty(searchString) && !actorSearchResults.empty()) { + std::string preview = + currentSelectedInDropdown == -1 + ? "Please Select" + : ActorDB::Instance->RetrieveEntry(actorSearchResults[currentSelectedInDropdown]).desc; PushStyleCombobox(THEME_COLOR); if (ImGui::BeginCombo("Results", preview.c_str())) { - for (u8 i = 0; i < actors.size(); i++) { - if (ImGui::Selectable(ActorDB::Instance->RetrieveEntry(actors[i]).desc.c_str(), + for (u8 i = 0; i < actorSearchResults.size(); i++) { + if (ImGui::Selectable(ActorDB::Instance->RetrieveEntry(actorSearchResults[i]).desc.c_str(), i == currentSelectedInDropdown)) { currentSelectedInDropdown = i; - newActor.id = actors[i]; + newActor.id = actorSearchResults[i]; } } ImGui::EndCombo(); @@ -1160,39 +1187,45 @@ void ActorViewerWindow::DrawElement() { ImGui::TreePop(); } PopStyleHeader(); - - static std::unordered_map nameTagOptions = { - { 0, "None" }, - { 1, "Short Description" }, - { 2, "Actor ID" }, - { 3, "Both" }, - }; - - if (CVarCombobox( - "Actor Name Tags", CVAR_DEVELOPER_TOOLS("ActorViewer.NameTags"), nameTagOptions, - ComboboxOptions().Color(THEME_COLOR).Tooltip("Adds \"name tags\" above actors for identification"))) { - NameTag_RemoveAllByTag(DEBUG_ACTOR_NAMETAG_TAG); - ActorViewer_AddTagForAllActors(); - } } else { ImGui::Text("Global Context needed for actor info!"); - if (needs_reset) { - fetch = nullptr; - actor = category = 0; - filler = "Please Select"; - list.clear(); - needs_reset = false; - searchString = ""; - currentSelectedInDropdown = -1; - actors.clear(); - } } ImGui::EndDisabled(); } void ActorViewerWindow::InitElement() { - GameInteractor::Instance->RegisterGameHook([](void* refActor) { + GameInteractor::Instance->RegisterGameHook([this](void* refActor) { Actor* actor = static_cast(refActor); - ActorViewer_AddTagForActor(actor); + + // Reload actor list if the new actor belongs to the selected category + if (category == actor->category) { + PopulateActorDropdown(actor->category, list); + } + }); + + GameInteractor::Instance->RegisterGameHook([this](void* refActor) { + Actor* actor = static_cast(refActor); + + // If the actor belongs to the selected category, we need to manually remove it, as it has not been removed from + // the global actor array yet + if (category == actor->category) { + list.erase(std::remove(list.begin(), list.end(), actor), list.end()); + } + if (display == actor) { + display = nullptr; + } + }); + + GameInteractor::Instance->RegisterGameHook([this](int16_t sceneNum) { + display = nullptr; + category = ACTORCAT_SWITCH; + list.clear(); }); } + +void ActorViewer_RegisterNameTagHooks() { + COND_HOOK(OnActorInit, CVAR_ACTOR_NAME_TAGS_ENABLED, + [](void* actor) { ActorViewer_AddTagForActor(static_cast(actor)); }); +} + +RegisterShipInitFunc nametagInit(ActorViewer_RegisterNameTagHooks, { CVAR_ACTOR_NAME_TAGS_ENABLED_NAME }); diff --git a/soh/soh/Enhancements/debugger/actorViewer.h b/soh/soh/Enhancements/debugger/actorViewer.h index 5d5bcdf88..07c7e5e24 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.h +++ b/soh/soh/Enhancements/debugger/actorViewer.h @@ -2,6 +2,10 @@ #include +#include "z64actor.h" + +#include + class ActorViewerWindow final : public Ship::GuiWindow { public: using GuiWindow::GuiWindow; @@ -9,4 +13,9 @@ class ActorViewerWindow final : public Ship::GuiWindow { void DrawElement() override; void InitElement() override; void UpdateElement() override{}; + + private: + Actor* display = nullptr; + int category = ACTORCAT_SWITCH; + std::vector list; }; diff --git a/soh/soh/Enhancements/enhancementTypes.h b/soh/soh/Enhancements/enhancementTypes.h index ee3b26d2e..c1b91cffa 100644 --- a/soh/soh/Enhancements/enhancementTypes.h +++ b/soh/soh/Enhancements/enhancementTypes.h @@ -87,6 +87,16 @@ typedef enum { DAMAGE_OHKO } DamageMultType; +typedef enum { + DAMPE_NONE, + DAMPE_NORMAL, + DAMPE_JALAPENO, + DAMPE_CHIPOTLE, + DAMPE_SCOTCH_BONNET, + DAMPE_GHOST_PEPPER, + DAMPE_INFERNO, +} DampeDropRate; + typedef enum { DEKU_STICK_NORMAL, DEKU_STICK_UNBREAKABLE, diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h index e70c0d33e..8d5a8f4e5 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_HookTable.h @@ -27,8 +27,10 @@ DEFINE_HOOK(OnOcarinaSongAction, ()); DEFINE_HOOK(OnCuccoOrChickenHatch, ()); DEFINE_HOOK(OnShopSlotChange, (uint8_t cursorIndex, int16_t price)); DEFINE_HOOK(OnActorInit, (void* actor)); +DEFINE_HOOK(OnActorSpawn, (void* actor)); DEFINE_HOOK(OnActorUpdate, (void* actor)); DEFINE_HOOK(OnActorKill, (void* actor)); +DEFINE_HOOK(OnActorDestroy, (void* actor)); DEFINE_HOOK(OnEnemyDefeat, (void* actor)); DEFINE_HOOK(OnBossDefeat, (void* actor)); DEFINE_HOOK(OnTimestamp, (u8 item)); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp index 08f2660dd..120ca4e99 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp @@ -108,6 +108,13 @@ void GameInteractor_ExecuteOnActorInit(void* actor) { GameInteractor::Instance->ExecuteHooksForFilter(actor); } +void GameInteractor_ExecuteOnActorSpawn(void* actor) { + GameInteractor::Instance->ExecuteHooks(actor); + GameInteractor::Instance->ExecuteHooksForID(((Actor*)actor)->id, actor); + GameInteractor::Instance->ExecuteHooksForPtr((uintptr_t)actor, actor); + GameInteractor::Instance->ExecuteHooksForFilter(actor); +} + void GameInteractor_ExecuteOnActorUpdate(void* actor) { GameInteractor::Instance->ExecuteHooks(actor); GameInteractor::Instance->ExecuteHooksForID(((Actor*)actor)->id, actor); @@ -122,6 +129,13 @@ void GameInteractor_ExecuteOnActorKill(void* actor) { GameInteractor::Instance->ExecuteHooksForFilter(actor); } +void GameInteractor_ExecuteOnActorDestroy(void* actor) { + GameInteractor::Instance->ExecuteHooks(actor); + GameInteractor::Instance->ExecuteHooksForID(((Actor*)actor)->id, actor); + GameInteractor::Instance->ExecuteHooksForPtr((uintptr_t)actor, actor); + GameInteractor::Instance->ExecuteHooksForFilter(actor); +} + void GameInteractor_ExecuteOnEnemyDefeat(void* actor) { GameInteractor::Instance->ExecuteHooks(actor); GameInteractor::Instance->ExecuteHooksForID(((Actor*)actor)->id, actor); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h index cd8e7962e..9bb47868f 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h @@ -29,8 +29,10 @@ void GameInteractor_ExecuteOnSetDoAction(uint16_t action); void GameInteractor_ExecuteOnOcarinaSongAction(); void GameInteractor_ExecuteOnCuccoOrChickenHatch(); void GameInteractor_ExecuteOnActorInit(void* actor); +void GameInteractor_ExecuteOnActorSpawn(void* actor); void GameInteractor_ExecuteOnActorUpdate(void* actor); void GameInteractor_ExecuteOnActorKill(void* actor); +void GameInteractor_ExecuteOnActorDestroy(void* actor); void GameInteractor_ExecuteOnEnemyDefeat(void* actor); void GameInteractor_ExecuteOnBossDefeat(void* actor); void GameInteractor_ExecuteOnTimestamp(u8 item); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp index ac99859b5..779b37981 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp @@ -112,7 +112,7 @@ void GameInteractor::RawAction::FreezePlayer() { void GameInteractor::RawAction::BurnPlayer() { Player* player = GET_PLAYER(gPlayState); for (int i = 0; i < 18; i++) { - player->bodyFlameTimers[i] = Rand_S16Offset(0, 200); + player->bodyFlameTimers[i] = static_cast(Rand_S16Offset(0, 200)); } player->bodyIsBurning = true; func_80837C0C(gPlayState, player, 0, 0, 0, 0, 0); @@ -559,7 +559,7 @@ void GameInteractor::RawAction::SetRandomWind(bool active) { GameInteractor::State::RandomWindActive = 0; GameInteractor::State::RandomWindSecondsSinceLastDirectionChange = 0; player->pushedSpeed = 0.0f; - player->pushedYaw = 0.0f; + player->pushedYaw = 0; } } @@ -617,7 +617,7 @@ GameInteractionEffectQueryResult GameInteractor::RawAction::SpawnEnemyWithOffset } // Generate point in random angle with a radius. - float angle = Random(0, 2 * M_PI); + float angle = static_cast(RandomDouble() * 2 * M_PI); float radius = 150; float posXOffset = radius * cos(angle); float posZOffset = radius * sin(angle); diff --git a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h index 0748d913a..c2b8c1756 100644 --- a/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h +++ b/soh/soh/Enhancements/game-interactor/vanilla-behavior/GIVanillaBehavior.h @@ -228,6 +228,14 @@ typedef enum { // - `*Actor` (interactRangeActor) VB_BOTTLE_ACTOR, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*EnPoField` + VB_BOTTLE_BIG_POE, + // #### `result` // ```c // ((this->actor.params == DNS_TYPE_HEART_PIECE) && (Flags_GetItemGetInf(ITEMGETINF_DEKU_SCRUB_HEART_PIECE))) || @@ -331,6 +339,14 @@ typedef enum { // - None VB_CRAWL_SPEED_INCREASE, + // #### `result` + // ```c + // this->actionTimer == 0 && Rand_ZeroOne() < 0.03f + // ``` + // #### `args` + // - `*EnPoRelay` + VB_DAMPE_DROP_FLAME, + // #### `result` // ```c // !Flags_GetItemGetInf(ITEMGETINF_1C) @@ -462,6 +478,14 @@ typedef enum { // - `*int16_t` (item id) VB_DRAW_AMMO_COUNT, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - Player* + VB_EMPTYING_BOTTLE, + // #### `result` // ```c // (Message_GetState(&play->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(play) @@ -511,6 +535,14 @@ typedef enum { // - `*BgHeavyBlock` VB_FREEZE_LINK_FOR_BLOCK_THROW, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - None + VB_FREEZE_LINK_FOR_FOREST_PILLARS, + // #### `result` // ```c // true @@ -1395,6 +1427,14 @@ typedef enum { // - `*BgTreemouth` VB_PLAY_DEKU_TREE_INTRO_CS, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*DemoKekkai` + VB_PLAY_DISPEL_BARRIER_CS, + // #### `result` // ```c // true @@ -1459,6 +1499,15 @@ typedef enum { // - None VB_PLAY_FIRE_ARROW_CS, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*EnHeishi2` + // - `bool` (clearCamera - true if the code clears a sub-camera, false otherwise) + VB_PLAY_GATE_OPENING_OR_CLOSING_CS, + // #### `result` // ```c // true @@ -1700,6 +1749,14 @@ typedef enum { // - `*EnRu1` VB_RUTO_WANT_TO_BE_TOSSED_TO_SAPPHIRE, + // #### `result` + // ```c + // true + // ``` + // #### `args` + // - `*EnGb` + VB_SELL_POES_TO_POE_COLLECTOR, + // #### `result` // ```c // true @@ -1827,6 +1884,14 @@ typedef enum { // - `*ObjBean` VB_SPAWN_BEAN_STALK_FAIRIES, + // #### `result` + // ```c + // this->timer >= 60 + // ``` + // #### `args` + // - `None` + VB_SPAWN_BEAN_SKULLTULA, + // #### `result` // ```c // true diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index f65a9618a..64c4265d0 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -12,7 +12,6 @@ #include "soh/Enhancements/randomizer/3drando/random.hpp" #include "soh/Enhancements/cosmetics/authenticGfxPatches.h" #include -#include "soh/Enhancements/nametag.h" #include "soh/Enhancements/timesaver_hook_handlers.h" #include "soh/Enhancements/TimeSavers/TimeSavers.h" #include "soh/Enhancements/randomizer/hook_handlers.h" @@ -135,38 +134,6 @@ void RegisterOcarinaTimeTravel() { }); } -void RegisterShadowTag() { - static bool shouldSpawn = false; - static uint16_t delayTimer = 60; - - GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger(CVAR_ENHANCEMENT("ShadowTag"), 0)) { - return; - } - if (gPlayState->sceneNum == SCENE_FOREST_TEMPLE && // Forest Temple Scene - gPlayState->roomCtx.curRoom.num == 16 || // Green Poe Room - gPlayState->roomCtx.curRoom.num == 13 || // Blue Poe Room - gPlayState->roomCtx.curRoom.num == 12) { // Red Poe Room - return; - } else { - if (shouldSpawn && (delayTimer <= 0)) { - Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_WALLMAS, 0, 0, 0, 0, 0, 0, 3, false); - shouldSpawn = false; - } else { - delayTimer--; - } - } - }); - GameInteractor::Instance->RegisterGameHook([]() { - shouldSpawn = true; - delayTimer = 60; - }); - GameInteractor::Instance->RegisterGameHook([](int16_t sceneNum) { - shouldSpawn = true; - delayTimer = 60; - }); -} - static bool hasAffectedHealth = false; void UpdatePermanentHeartLossState() { if (!GameInteractor::IsSaveLoaded()) @@ -219,65 +186,6 @@ void RegisterDeleteFileOnDeath() { }); } -struct DayTimeGoldSkulltulas { - uint16_t scene; - uint16_t room; - bool forChild; - std::vector actorEntries; -}; - -using DayTimeGoldSkulltulasList = std::vector; - -void RegisterDaytimeGoldSkultullas() { - GameInteractor::Instance->RegisterGameHook([]() { - if (!CVarGetInteger(CVAR_ENHANCEMENT("NightGSAlwaysSpawn"), 0)) { - return; - } - - // Gold Skulltulas that are not part of the scene actor list during the day - // Actor values copied from the night time scene actor list - static const DayTimeGoldSkulltulasList dayTimeGoldSkulltulas = { - // Graveyard - { SCENE_GRAVEYARD, 1, true, { { ACTOR_EN_SW, { 156, 315, 795 }, { 16384, -32768, 0 }, -20096 } } }, - // ZF - { SCENE_ZORAS_FOUNTAIN, 0, true, { { ACTOR_EN_SW, { -1891, 187, 1911 }, { 16384, 18022, 0 }, -19964 } } }, - // GF - { SCENE_GERUDOS_FORTRESS, - 0, - false, - { { ACTOR_EN_SW, { 1598, 999, -2008 }, { 16384, -16384, 0 }, -19198 } } }, - { SCENE_GERUDOS_FORTRESS, 1, false, { { ACTOR_EN_SW, { 3377, 1734, -4935 }, { 16384, 0, 0 }, -19199 } } }, - // Kak - { SCENE_KAKARIKO_VILLAGE, 0, false, { { ACTOR_EN_SW, { -18, 540, 1800 }, { 0, -32768, 0 }, -20160 } } }, - { SCENE_KAKARIKO_VILLAGE, - 0, - true, - { { ACTOR_EN_SW, { -465, 377, -888 }, { 0, 28217, 0 }, -20222 }, - { ACTOR_EN_SW, { 5, 686, -171 }, { 0, -32768, 0 }, -20220 }, - { ACTOR_EN_SW, { 324, 270, 905 }, { 16384, 0, 0 }, -20216 }, - { ACTOR_EN_SW, { -602, 120, 1120 }, { 16384, 0, 0 }, -20208 } } }, - // LLR - { SCENE_LON_LON_RANCH, - 0, - true, - { { ACTOR_EN_SW, { -2344, 180, 672 }, { 16384, 22938, 0 }, -29695 }, - { ACTOR_EN_SW, { 808, 48, 326 }, { 16384, 0, 0 }, -29694 }, - { ACTOR_EN_SW, { 997, 286, -2698 }, { 16384, -16384, 0 }, -29692 } } }, - }; - - for (const auto& dayTimeGS : dayTimeGoldSkulltulas) { - if (IS_DAY && dayTimeGS.forChild == LINK_IS_CHILD && dayTimeGS.scene == gPlayState->sceneNum && - dayTimeGS.room == gPlayState->roomCtx.curRoom.num) { - for (const auto& actorEntry : dayTimeGS.actorEntries) { - Actor_Spawn(&gPlayState->actorCtx, gPlayState, actorEntry.id, actorEntry.pos.x, actorEntry.pos.y, - actorEntry.pos.z, actorEntry.rot.x, actorEntry.rot.y, actorEntry.rot.z, - actorEntry.params, false); - } - } - } - }); -} - bool IsHyperBossesActive() { return CVarGetInteger(CVAR_ENHANCEMENT("HyperBosses"), 0) || (IS_BOSS_RUSH && @@ -1049,8 +957,6 @@ void InitMods() { TimeSavers_Register(); RegisterTTS(); RegisterOcarinaTimeTravel(); - RegisterDaytimeGoldSkultullas(); - RegisterShadowTag(); RegisterPermanentHeartLoss(); RegisterDeleteFileOnDeath(); RegisterHyperBosses(); @@ -1064,7 +970,6 @@ void InitMods() { RegisterRandomizedEnemySizes(); RegisterOpenAllHours(); RegisterToTMedallions(); - NameTag_RegisterHooks(); RegisterFloorSwitchesHook(); RegisterPatchHandHandler(); RegisterHurtContainerModeHandler(); diff --git a/soh/soh/Enhancements/nametag.cpp b/soh/soh/Enhancements/nametag.cpp index 253c0980b..1989b3552 100644 --- a/soh/soh/Enhancements/nametag.cpp +++ b/soh/soh/Enhancements/nametag.cpp @@ -5,7 +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" +#include "soh/ShipUtils.h" extern "C" { #include "z64.h" @@ -26,12 +26,16 @@ typedef struct { int16_t height; // Textbox height int16_t width; // Textbox width int16_t yOffset; // Addition Y offset + uint8_t noZBuffer; // Allow rendering over geometry Mtx* mtx; // Allocated Mtx for rendering Vtx* vtx; // Allocated Vtx for rendering } NameTag; static std::vector nameTags; static std::vector nameTagDl; +static bool sMirrorWorldActive = false; + +void NameTag_RegisterHooks(); void FreeNameTag(NameTag* nameTag) { if (nameTag->vtx != nullptr) { @@ -51,14 +55,14 @@ void DrawNameTag(PlayState* play, const NameTag* nameTag) { } // Name tag is too far away to meaningfully read, don't bother rendering it - if (nameTag->actor->xyzDistToPlayerSq > 200000.0f) { + if (nameTag->actor->xyzDistToPlayerSq > 440000.0f) { return; } // Fade out name tags that are far away float alpha = 1.0f; - if (nameTag->actor->xyzDistToPlayerSq > 160000.0f) { - alpha = (200000.0f - nameTag->actor->xyzDistToPlayerSq) / 40000.0f; + if (nameTag->actor->xyzDistToPlayerSq > 360000.0f) { + alpha = (440000.0f - nameTag->actor->xyzDistToPlayerSq) / 80000.0f; } float scale = 75.0f / 100.f; @@ -79,7 +83,7 @@ void DrawNameTag(PlayState* play, const NameTag* nameTag) { textColor = CVarGetColor(CVAR_COSMETIC("HUD.NameTagActorText.Value"), textColor); } - FrameInterpolation_RecordOpenChild(nameTag->actor, 10); + FrameInterpolation_RecordOpenChild(nameTag->actor, 0); // Prefer the highest between world position and focus position if targetable float posY = nameTag->actor->world.pos.y; @@ -92,7 +96,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(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? -1 : 1), -scale, 1.0f, MTXMODE_APPLY); + Matrix_Scale(scale * (sMirrorWorldActive ? -1.0f : 1.0f), -scale, 1.0f, MTXMODE_APPLY); Matrix_Translate(-(float)nameTag->width / 2, -nameTag->height, 0, MTXMODE_APPLY); Matrix_ToMtx(nameTag->mtx, (char*)__FILE__, __LINE__); @@ -154,15 +158,27 @@ void DrawNameTags() { OPEN_DISPS(gPlayState->state.gfxCtx); // Setup before rendering name tags - Gfx_SetupDL_38Xlu(gPlayState->state.gfxCtx); - nameTagDl.push_back(gsDPSetAlphaDither(G_AD_DISABLE)); - nameTagDl.push_back(gsSPClearGeometryMode(G_SHADE)); + POLY_XLU_DISP = Gfx_SetupDL_39(POLY_XLU_DISP); + nameTagDl.push_back(gsDPSetAlphaCompare(G_AC_NONE)); nameTagDl.push_back( gsDPSetCombineLERP(0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0)); + bool zbufferEnabled = false; + // Add all the name tags for (const auto& nameTag : nameTags) { + // Toggle ZBuffer mode based on last state and next tag + if (zbufferEnabled == nameTag.noZBuffer) { + if (nameTag.noZBuffer) { + nameTagDl.push_back(gsSPClearGeometryMode(G_ZBUFFER)); + zbufferEnabled = false; + } else { + nameTagDl.push_back(gsSPSetGeometryMode(G_ZBUFFER)); + zbufferEnabled = true; + } + } + DrawNameTag(gPlayState, &nameTag); } @@ -189,22 +205,22 @@ void UpdateNameTags() { return aDistToCamera > bDistToCamera; }); + + sMirrorWorldActive = CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0); } extern "C" void NameTag_RegisterForActorWithOptions(Actor* actor, const char* text, NameTagOptions options) { std::string processedText = std::string(Interface_ReplaceSpecialCharacters((char*)text)); // Strip out unsupported characters - processedText.erase(std::remove_if(processedText.begin(), processedText.end(), - [](const char& c) { - // 172 is max supported texture for the in-game font system, - // and filter anything less than a space but not the newline or nul - // characters - return (unsigned char)c > 172 || (c < ' ' && c != '\n' && c != '\0'); - }), - processedText.end()); + // 172 is max supported texture for the in-game font system, + // and filter anything less than a space but not the newline or nul characters + processedText.erase( + std::remove_if(processedText.begin(), processedText.end(), + [](const char& c) { return (uint8_t)c > 172 || (c < ' ' && c != '\n' && c != '\0'); }), + processedText.end()); - int16_t numChar = processedText.length(); + size_t numChar = processedText.length(); int16_t numLines = 1; int16_t offsetX = 0; int16_t maxOffsetX = 0; @@ -213,7 +229,7 @@ extern "C" void NameTag_RegisterForActorWithOptions(Actor* actor, const char* te Vtx* vertices = (Vtx*)calloc(sizeof(Vtx[4]), numChar + 1); // Set all the char vtx first to get the total size for the textbox - for (int16_t i = 0; i < numChar; i++) { + for (size_t i = 0; i < numChar; i++) { if (processedText[i] == '\n') { offsetX = 0; numLines++; @@ -249,10 +265,13 @@ extern "C" void NameTag_RegisterForActorWithOptions(Actor* actor, const char* te nameTag.height = height; nameTag.width = width; nameTag.yOffset = options.yOffset; + nameTag.noZBuffer = options.noZBuffer; nameTag.mtx = new Mtx(); nameTag.vtx = vertices; nameTags.push_back(nameTag); + + NameTag_RegisterHooks(); } extern "C" void NameTag_RegisterForActor(Actor* actor, const char* text) { @@ -268,6 +287,8 @@ extern "C" void NameTag_RemoveAllForActor(Actor* actor) { it++; } } + + NameTag_RegisterHooks(); } extern "C" void NameTag_RemoveAllByTag(const char* tag) { @@ -279,6 +300,8 @@ extern "C" void NameTag_RemoveAllByTag(const char* tag) { it++; } } + + NameTag_RegisterHooks(); } void RemoveAllNameTags() { @@ -287,23 +310,49 @@ void RemoveAllNameTags() { } nameTags.clear(); + + NameTag_RegisterHooks(); } -static bool sRegisteredHooks = false; - void NameTag_RegisterHooks() { - if (sRegisteredHooks) { + static HOOK_ID gameStatUpdateHookID = 0; + static HOOK_ID drawHookID = 0; + static HOOK_ID playDestroyHookID = 0; + static HOOK_ID actorDestroyHookID = 0; + static bool sRegisteredHooks = false; + + // Hooks already (un)registered based on nametags + if ((nameTags.size() > 0) == sRegisteredHooks) { + return; + } + + GameInteractor::Instance->UnregisterGameHook(gameStatUpdateHookID); + GameInteractor::Instance->UnregisterGameHook(drawHookID); + GameInteractor::Instance->UnregisterGameHook(playDestroyHookID); + GameInteractor::Instance->UnregisterGameHook(actorDestroyHookID); + gameStatUpdateHookID = 0; + drawHookID = 0; + playDestroyHookID = 0; + actorDestroyHookID = 0; + sRegisteredHooks = false; + + if (nameTags.size() == 0) { return; } sRegisteredHooks = true; // Reorder tags every frame to mimic depth rendering - GameInteractor::Instance->RegisterGameHook([]() { UpdateNameTags(); }); + gameStatUpdateHookID = + GameInteractor::Instance->RegisterGameHook(UpdateNameTags); - // Render name tags at the end of player draw to avoid overflowing the display buffers - GameInteractor::Instance->RegisterGameHook([]() { DrawNameTags(); }); + // Render name tags at the end of the Play World drawing + drawHookID = GameInteractor::Instance->RegisterGameHook(DrawNameTags); // Remove all name tags on play state destroy as all actors are removed anyways - GameInteractor::Instance->RegisterGameHook([]() { RemoveAllNameTags(); }); + playDestroyHookID = GameInteractor::Instance->RegisterGameHook(RemoveAllNameTags); + + // Remove all name tags for actor on destroy + actorDestroyHookID = GameInteractor::Instance->RegisterGameHook( + [](void* actor) { NameTag_RemoveAllForActor((Actor*)actor); }); } diff --git a/soh/soh/Enhancements/nametag.h b/soh/soh/Enhancements/nametag.h index 98b83f7cc..47908e875 100644 --- a/soh/soh/Enhancements/nametag.h +++ b/soh/soh/Enhancements/nametag.h @@ -1,11 +1,16 @@ -#ifndef _NAMETAG_H_ -#define _NAMETAG_H_ -#include +#ifndef NAMETAG_H +#define NAMETAG_H + +#include +#include + +struct Actor; typedef struct { const char* tag; // Tag identifier to filter/remove multiple tags int16_t yOffset; // Additional Y offset to apply for the name tag Color_RGBA8 textColor; // Text color override. Global color is used if alpha is 0 + uint8_t noZBuffer; // Allow rendering over geometry } NameTagOptions; // Register required hooks for nametags on startup @@ -28,4 +33,4 @@ void NameTag_RemoveAllByTag(const char* tag); } #endif -#endif // _NAMETAG_H_ +#endif // NAMETAG_H diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 899bc17bf..0fe779cf1 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -159,11 +159,6 @@ static void ValidateOtherEntrance(GetAccessibleLocationsStruct& gals) { ApplyStartingInventory(); // RANDOTODO when proper ammo logic is done, this could be moved to the start } } - // If we are not shuffling the guard house, add the key so we can properly check for poe merchant access - if (gals.validatedStartingRegion && gals.foundTempleOfTime && - ctx->GetOption(RSK_SHUFFLE_INTERIOR_ENTRANCES).Is(RO_INTERIOR_ENTRANCE_SHUFFLE_OFF)) { - Rando::StaticData::RetrieveItem(RG_GUARD_HOUSE_KEY).ApplyEffect(); - } } // Apply all items that are necessary for checking all location access @@ -180,10 +175,7 @@ static void ApplyAllAdvancmentItems() { static void ValidateSphereZero(GetAccessibleLocationsStruct& gals) { auto ctx = Rando::Context::GetInstance(); // Condition for verifying everything required for sphere 0, expanding search to all locations - if ((!logic->AreCheckingBigPoes || logic->CanEmptyBigPoes) && gals.validatedStartingRegion && - gals.foundTempleOfTime && gals.haveTimeAccess) { - // stop checking for big poes - logic->AreCheckingBigPoes = false; + if (gals.validatedStartingRegion && gals.foundTempleOfTime && gals.haveTimeAccess) { // Apply all items that are necessary for checking all location access ApplyAllAdvancmentItems(); // Reset access as the non-starting age @@ -213,7 +205,7 @@ void ProcessExits(Region* region, GetAccessibleLocationsStruct& gals, Randomizer // Update Time of Day Access for the exit if (UpdateToDAccess(&exit, exitRegion)) { gals.logicUpdated = true; - if (!gals.sphereZeroComplete || logic->AreCheckingBigPoes) { + if (!gals.sphereZeroComplete) { if (!gals.foundTempleOfTime || !gals.validatedStartingRegion) { ValidateOtherEntrance(gals); } @@ -596,15 +588,12 @@ bool CheckBeatable(RandomizerGet ignore /* = RG_NONE*/) { } // Check if the currently randomised set of entrances is a valid game map. -void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAccess) { +void ValidateEntrances(bool checkOtherEntranceAccess) { auto ctx = Rando::Context::GetInstance(); GetAccessibleLocationsStruct gals(0); ResetLogic(ctx, gals, !checkOtherEntranceAccess); ctx->allLocationsReachable = false; - if (checkPoeCollectorAccess) { - logic->AreCheckingBigPoes = true; - } if (checkOtherEntranceAccess) { gals.foundTempleOfTime = false; @@ -620,11 +609,6 @@ void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAcce RegionTable(RR_ROOT)->adultNight = true; RegionTable(RR_ROOT)->childDay = true; RegionTable(RR_ROOT)->adultDay = true; - } else if (checkPoeCollectorAccess) { - // If we are not shuffling the guard house, add the key so we can properly check for poe merchant access - if (ctx->GetOption(RSK_SHUFFLE_INTERIOR_ENTRANCES).Is(RO_INTERIOR_ENTRANCE_SHUFFLE_OFF)) { - Rando::StaticData::RetrieveItem(RG_GUARD_HOUSE_KEY).ApplyEffect(); - } } else { ApplyAllAdvancmentItems(); } @@ -710,11 +694,11 @@ static void PareDownPlaythrough() { auto ctx = Rando::Context::GetInstance(); std::vector toAddBackItem; // Start at sphere before Ganon's and count down - for (int i = ctx->playthroughLocations.size() - 2; i >= 0; i--) { + for (int32_t i = static_cast(ctx->playthroughLocations.size()) - 2; i >= 0; i--) { // Check each item location in sphere std::vector erasableIndices; std::vector sphere = ctx->playthroughLocations.at(i); - for (int j = sphere.size() - 1; j >= 0; j--) { + for (int32_t j = static_cast(sphere.size()) - 1; j >= 0; j--) { RandomizerCheck loc = sphere.at(j); RandomizerGet locGet = ctx->GetItemLocation(loc)->GetPlacedRandomizerGet(); // Copy out item diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.hpp b/soh/soh/Enhancements/randomizer/3drando/fill.hpp index f2028e05d..484331104 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.hpp @@ -72,4 +72,4 @@ void GeneratePlaythrough(); bool CheckBeatable(RandomizerGet ignore = RG_NONE); -void ValidateEntrances(bool checkPoeCollectorAccess, bool checkOtherEntranceAccess); \ No newline at end of file +void ValidateEntrances(bool checkOtherEntranceAccess); diff --git a/soh/soh/Enhancements/randomizer/3drando/hint_list.cpp b/soh/soh/Enhancements/randomizer/3drando/hint_list.cpp index a1cb845f3..734ab00bf 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hint_list.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hint_list.cpp @@ -2467,13 +2467,13 @@ void StaticData::HintTable_Init() { /*german*/ "ein abgelegener Ort", /*french*/ "un lieu isolé")); - hintTextTable[RHT_DUNGEON_ORDINARY] = HintText(CustomMessage(" It's ordinary.", - /*german*/ "&Sieht aus wie immer.", - /*french*/ "&Elle vous semble %rordinaire%w.")); + hintTextTable[RHT_DUNGEON_ORDINARY] = HintText(CustomMessage("&It's %gordinary%w.", + /*german*/ "&Sieht aus %gwie immer%w.", + /*french*/ "&Elle vous semble %gordinaire%w.")); - hintTextTable[RHT_DUNGEON_MASTERFUL] = HintText(CustomMessage(" It's masterful!", - /*german*/ "&Man kann darauf die Worte&%r\"Master Quest\"%w entziffern...", - /*french*/ "&Étrange... les mots %r\"Master&Quest\"%w sont gravés dessus.")); + hintTextTable[RHT_DUNGEON_MASTERFUL] = HintText(CustomMessage("&It's %rmasterful%w!", + /*german*/ "&Man kann darauf die Worte %r\"Master_Quest\"%w entziffern...", + /*french*/ "&Étrange... les mots %r\"Master_Quest\"%w sont gravés dessus.")); // clang-format on } diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp index 8e928185f..65cc6eb8c 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp @@ -40,7 +40,7 @@ const CustomMessage& HintText::GetObscure() const { return obscureText.size() > 0 ? RandomElement(obscureText) : clearText; } -const CustomMessage& HintText::GetObscure(uint8_t selection) const { +const CustomMessage& HintText::GetObscure(size_t selection) const { if (obscureText.size() > selection) { return obscureText[selection]; } else if (obscureText.size() > 0) { @@ -53,7 +53,7 @@ const CustomMessage& HintText::GetAmbiguous() const { return ambiguousText.size() > 0 ? RandomElement(ambiguousText) : clearText; } -const CustomMessage& HintText::GetAmbiguous(uint8_t selection) const { +const CustomMessage& HintText::GetAmbiguous(size_t selection) const { if (ambiguousText.size() > selection) { return ambiguousText[selection]; } else if (ambiguousText.size() > 0) { @@ -62,15 +62,15 @@ const CustomMessage& HintText::GetAmbiguous(uint8_t selection) const { return clearText; } -uint8_t HintText::GetAmbiguousSize() const { +size_t HintText::GetAmbiguousSize() const { return ambiguousText.size(); } -uint8_t HintText::GetObscureSize() const { +size_t HintText::GetObscureSize() const { return obscureText.size(); } -const CustomMessage& HintText::GetHintMessage(uint8_t selection) const { +const CustomMessage& HintText::GetHintMessage(size_t selection) const { auto ctx = Rando::Context::GetInstance(); if (ctx->GetOption(RSK_HINT_CLARITY).Is(RO_HINT_CLARITY_OBSCURE)) { return GetObscure(selection); @@ -273,8 +273,8 @@ std::vector>> conditionalAlways std::make_pair(RC_MARKET_10_BIG_POES, []() { auto ctx = Rando::Context::GetInstance(); - return ctx->GetOption(RSK_BIG_POE_COUNT).Get() >= 3 && !ctx->GetOption(RSK_BIG_POES_HINT); - }), // Remember, the option's value being 3 means 4 are required + return ctx->GetOption(RSK_BIG_POE_COUNT).Get() > 3 && !ctx->GetOption(RSK_BIG_POES_HINT); + }), std::make_pair(RC_DEKU_THEATER_MASK_OF_TRUTH, []() { auto ctx = Rando::Context::GetInstance(); @@ -598,7 +598,7 @@ static void DistributeHints(std::vector& selected, size_t stoneCount, } // if stones are left, assign junk to every remaining stone as a fallback. if (stoneCount > 0) { - selected[selected.size() - 1] += stoneCount; + selected[static_cast(selected.size()) - 1] += static_cast(stoneCount); } } diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.hpp b/soh/soh/Enhancements/randomizer/3drando/hints.hpp index 48566f47e..365904274 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.hpp @@ -37,12 +37,12 @@ class HintText { std::vector obscureText_ = {}); const CustomMessage& GetClear() const; const CustomMessage& GetObscure() const; - const CustomMessage& GetObscure(uint8_t selection) const; + const CustomMessage& GetObscure(size_t selection) const; const CustomMessage& GetAmbiguous() const; - const CustomMessage& GetAmbiguous(uint8_t selection) const; - uint8_t GetAmbiguousSize() const; - uint8_t GetObscureSize() const; - const CustomMessage& GetHintMessage(uint8_t selection = 0) const; + const CustomMessage& GetAmbiguous(size_t selection) const; + size_t GetAmbiguousSize() const; + size_t GetObscureSize() const; + const CustomMessage& GetHintMessage(size_t selection = 0) const; const CustomMessage GetMessageCopy() const; bool operator==(const HintText& right) const; bool operator!=(const HintText& right) const; diff --git a/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp b/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp index a04a7d65c..9a858e059 100644 --- a/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/item_pool.cpp @@ -325,7 +325,7 @@ RandomizerGet GetJunkItem() { return RandomElement(JunkPoolItems); } // Ice Trap is the last item in JunkPoolItems, so subtract 1 to never hit that index - uint8_t idx = Random(0, JunkPoolItems.size() - 1); + uint8_t idx = Random(0, static_cast(JunkPoolItems.size()) - 1); return JunkPoolItems[idx]; } diff --git a/soh/soh/Enhancements/randomizer/3drando/menu.cpp b/soh/soh/Enhancements/randomizer/3drando/menu.cpp index 831330571..cf3a0bc3d 100644 --- a/soh/soh/Enhancements/randomizer/3drando/menu.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/menu.cpp @@ -27,7 +27,7 @@ bool GenerateRandomizer(std::set excludedLocations, std::set(time(NULL))); // if a blank seed was entered, make a random one if (seedInput.empty()) { seedInput = std::to_string(rand() % 0xFFFFFFFF); @@ -35,7 +35,7 @@ bool GenerateRandomizer(std::set excludedLocations, std::set distribution(min, max - 1); return distribution(generator); } -// Returns a random floating point number in [0.0, 1.0] +// Returns a random floating point number in [0.0, 1.0) double RandomDouble() { boost::random::uniform_real_distribution distribution(0.0, 1.0); return distribution(generator); diff --git a/soh/soh/Enhancements/randomizer/3drando/random.hpp b/soh/soh/Enhancements/randomizer/3drando/random.hpp index cc519d5f9..b4f780332 100644 --- a/soh/soh/Enhancements/randomizer/3drando/random.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/random.hpp @@ -8,12 +8,12 @@ #include void Random_Init(uint32_t seed); -uint32_t Random(int min, int max); +uint32_t Random(uint32_t min, uint32_t max); double RandomDouble(); // Get a random element from a vector or array template T RandomElement(std::vector& vector, bool erase) { - const auto idx = Random(0, vector.size()); + const auto idx = Random(0, static_cast(vector.size())); const T selected = vector[idx]; if (erase) { vector.erase(vector.begin() + idx); @@ -21,17 +21,17 @@ template T RandomElement(std::vector& vector, bool erase) { return selected; } template auto& RandomElement(Container& container) { - return container[Random(0, std::size(container))]; + return container[Random(0, static_cast(std::size(container)))]; } template const auto& RandomElement(const Container& container) { - return container[Random(0, std::size(container))]; + return container[Random(0, static_cast(std::size(container)))]; } template const T RandomElementFromSet(const std::set& set) { if (set.size() == 1) { return *set.begin(); } - uint32_t rand = Random(0, set.size()); + uint32_t rand = Random(0, static_cast(set.size())); auto it = set.begin(); for (uint32_t i = 0; i < rand; i++) { it++; @@ -43,12 +43,12 @@ template const T RandomElementFromSet(const std::set& set) { // Shuffle items within a vector or array // RANDOTODO There's probably a more efficient way to do what this does. template void Shuffle(std::vector& vector) { - for (std::size_t i = 0; i + 1 < vector.size(); i++) { - std::swap(vector[i], vector[Random(i, vector.size())]); + for (size_t i = 0; i + 1 < vector.size(); i++) { + std::swap(vector[i], vector[Random(static_cast(i), static_cast(vector.size()))]); } } -template void Shuffle(std::array& arr) { - for (std::size_t i = 0; i + 1 < arr.size(); i++) { - std::swap(arr[i], arr[Random(i, arr.size())]); +template void Shuffle(std::array& arr) { + for (size_t i = 0; i + 1 < arr.size(); i++) { + std::swap(arr[i], arr[Random(static_cast(i), static_cast(arr.size()))]); } } diff --git a/soh/soh/Enhancements/randomizer/3drando/shops.cpp b/soh/soh/Enhancements/randomizer/3drando/shops.cpp index 110ab8a76..115f36394 100644 --- a/soh/soh/Enhancements/randomizer/3drando/shops.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/shops.cpp @@ -115,7 +115,7 @@ uint16_t GetPriceFromSettings(Rando::Location* loc, PriceSettingsStruct priceSet if (random < ShopPriceProbability[i]) { // The randomly generated value has surpassed the total probability up to this point, so this is the // generated price i in range [0, 59], output in range [0, 295] in increments of 5 - return i * 5; + return static_cast(i) * 5; } } return 150; @@ -196,7 +196,8 @@ uint16_t GetCheapBalancedPrice() { double random = RandomDouble(); for (size_t i = 0; i < CheapPriceProbability.size(); i++) { if (random < CheapPriceProbability[i]) { - return i * 5; // i in range [0, 19], output in range [0, 95] in increments of 5 + // i in range [0, 19], output in range [0, 95] in increments of 5 + return static_cast(i) * 5; } } return -1; diff --git a/soh/soh/Enhancements/randomizer/Plandomizer.cpp b/soh/soh/Enhancements/randomizer/Plandomizer.cpp index dc32dc999..4e03e8b8f 100644 --- a/soh/soh/Enhancements/randomizer/Plandomizer.cpp +++ b/soh/soh/Enhancements/randomizer/Plandomizer.cpp @@ -632,7 +632,7 @@ void PlandomizerLoadSpoilerLog(std::string logFile) { PlandomizerAddToItemList(plandomizerRandoRetrieveItem(RG_SOLD_OUT)); } } - } catch (nlohmann::json::parse_error& e) { + } catch (nlohmann::json::parse_error&) { Notification::Emit({ .message = "Invalid Spoiler Log Format", .remainingTime = 10.0f }); } } @@ -967,7 +967,7 @@ void PlandomizerDrawOptions() { } ImGui::TableNextColumn(); - size_t index = 0; + int32_t index = 0; PlandoPushImageButtonStyle(); for (auto& hash : plandoHash) { ImGui::PushID(index); @@ -995,7 +995,7 @@ void PlandomizerDrawOptions() { ImGui::PopStyleVar(); if (downRet) { if (hash == 0) { - hash = gSeedTextures.size() - 1; + hash = static_cast(gSeedTextures.size()) - 1; } else { hash--; } diff --git a/soh/soh/Enhancements/randomizer/ShuffleBeehives.cpp b/soh/soh/Enhancements/randomizer/ShuffleBeehives.cpp new file mode 100644 index 000000000..60969a0c0 --- /dev/null +++ b/soh/soh/Enhancements/randomizer/ShuffleBeehives.cpp @@ -0,0 +1,137 @@ +#include +#include "static_data.h" + +extern "C" { +#include "src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h" +extern PlayState* gPlayState; +} + +extern void EnItem00_DrawRandomizedItem(EnItem00* enItem00, PlayState* play); + +void ObjComb_RandomizerChooseItemDrop(ObjComb* objComb, PlayState* play) { + s16 params = objComb->actor.params & 0x1F; + + if (Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_BEEHIVES).Get() && + !Flags_GetRandomizerInf(objComb->beehiveIdentity.randomizerInf)) { + EnItem00* item00 = (EnItem00*)Item_DropCollectible2(play, &objComb->actor.world.pos, ITEM00_SOH_DUMMY); + item00->randoInf = objComb->beehiveIdentity.randomizerInf; + item00->itemEntry = + OTRGlobals::Instance->gRandomizer->GetItemFromKnownCheck(objComb->beehiveIdentity.randomizerCheck, GI_NONE); + item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; + return; + } + + if ((params > 0) || (params < 0x1A)) { + if (params == 6) { + if (Flags_GetCollectible(play, (objComb->actor.params >> 8) & 0x3F)) { + params = -1; + } else { + params = (params | (((objComb->actor.params >> 8) & 0x3F) << 8)); + } + } else if (Rand_ZeroOne() < 0.5f) { + params = -1; + } + if (params >= 0 && !CVarGetInteger(CVAR_ENHANCEMENT("NoRandomDrops"), 0)) { + Item_DropCollectible(play, &objComb->actor.world.pos, params); + } + } +} + +void ObjComb_RandomizerWait(ObjComb* objComb, PlayState* play) { + s32 dmgFlags; + + objComb->unk_1B0 -= 50; + if (Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_BEEHIVES).Get() && + !Flags_GetRandomizerInf(objComb->beehiveIdentity.randomizerInf)) { + if (objComb->unk_1B0 <= -5000) { + objComb->unk_1B0 = 1500; + } + } else if (objComb->unk_1B0 < 0) { + objComb->unk_1B0 = 0; + } + + if ((objComb->collider.base.acFlags & AC_HIT) != 0) { + objComb->collider.base.acFlags &= ~AC_HIT; + dmgFlags = objComb->collider.elements[0].info.acHitInfo->toucher.dmgFlags; + if (dmgFlags & 0x4001F866) { + objComb->unk_1B0 = 1500; + } else { + ObjComb_Break(objComb, play); + ObjComb_RandomizerChooseItemDrop(objComb, play); + Actor_Kill(&objComb->actor); + } + } else { + CollisionCheck_SetAC(play, &play->colChkCtx, &objComb->collider.base); + } + + if (objComb->actor.update != NULL) { + CollisionCheck_SetOC(play, &play->colChkCtx, &objComb->collider.base); + } +} + +void ObjComb_RandomizerInit(void* actor) { + ObjComb* objComb = static_cast(actor); + s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1); + objComb->beehiveIdentity = OTRGlobals::Instance->gRandomizer->IdentifyBeehive( + gPlayState->sceneNum, (s16)objComb->actor.world.pos.x, respawnData); + objComb->actionFunc = (ObjCombActionFunc)ObjComb_RandomizerWait; +} + +void ObjComb_RandomizerUpdate(void* actor) { + ObjComb* combActor = reinterpret_cast(actor); + combActor->actor.shape.rot.x = + static_cast(Math_SinS(combActor->unk_1B2)) * CLAMP_MIN(combActor->unk_1B0, 0) + + combActor->actor.home.rot.x; +} + +void RegisterShuffleBeehives() { + bool shouldRegister = IS_RANDO && Rando::Context::GetInstance()->GetOption(RSK_SHUFFLE_BEEHIVES).Get(); + + COND_ID_HOOK(OnActorInit, ACTOR_OBJ_COMB, shouldRegister, ObjComb_RandomizerInit); + COND_ID_HOOK(OnActorUpdate, ACTOR_OBJ_COMB, shouldRegister, ObjComb_RandomizerUpdate); +} + +static RegisterShipInitFunc initFunc(RegisterShuffleBeehives, { "IS_RANDO" }); + +void Rando::StaticData::RegisterBeehiveLocations() { + static bool registered = false; + if (registered) + return; + registered = true; + // clang-format off + locationTable[RC_KF_STORMS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_KF_STORMS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KOKIRI_FOREST, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x2C), "Storms Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KF_STORMS_GROTTO_LEFT)); + locationTable[RC_KF_STORMS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_KF_STORMS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KOKIRI_FOREST, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x2C), "Storms Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KF_STORMS_GROTTO_RIGHT)); + locationTable[RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x14), "Tunnel Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_NEAR_SHORTCUTS_GROTTO_LEFT)); + locationTable[RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x14), "Tunnel Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_NEAR_SHORTCUTS_GROTTO_RIGHT)); + locationTable[RC_LW_DEKU_SCRUB_GROTTO_BEEHIVE] = Location::Base(RC_LW_DEKU_SCRUB_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(747, 0xF5), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_DEKU_SCRUB_GROTTO)); + locationTable[RC_SFM_STORMS_GROTTO_BEEHIVE] = Location::Base(RC_SFM_STORMS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_SACRED_FOREST_MEADOW, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xEE), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_SFM_STORMS_GROTTO)); + locationTable[RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x00), "Near Market Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_NEAR_MARKET_GROTTO_LEFT)); + locationTable[RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x00), "Near Market Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_NEAR_MARKET_GROTTO_RIGHT)); + locationTable[RC_HF_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x03), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_OPEN_GROTTO_LEFT)); + locationTable[RC_HF_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x03), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_OPEN_GROTTO_RIGHT)); + locationTable[RC_HF_SOUTHEAST_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_SOUTHEAST_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x22), "Southeast Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_SOUTHEAST_GROTTO_LEFT)); + locationTable[RC_HF_SOUTHEAST_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_SOUTHEAST_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x22), "Southeast Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_SOUTHEAST_GROTTO_RIGHT)); + locationTable[RC_HF_INSIDE_FENCE_GROTTO_BEEHIVE] = Location::Base(RC_HF_INSIDE_FENCE_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(1410, 0xE6), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_LONELY_SCRUB_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_INSIDE_FENCE_GROTTO)); + locationTable[RC_LLR_GROTTO_BEEHIVE] = Location::Base(RC_LLR_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LON_LON_RANCH, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xFC), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LLR_GROTTO)); + locationTable[RC_KAK_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_KAK_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KAKARIKO_VILLAGE, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x28), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KAK_OPEN_GROTTO_LEFT)); + locationTable[RC_KAK_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_KAK_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KAKARIKO_VILLAGE, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x28), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KAK_OPEN_GROTTO_RIGHT)); + locationTable[RC_DMT_COW_GROTTO_BEEHIVE] = Location::Base(RC_DMT_COW_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2617, 0xF8), "Cow Grotto Beehive", RHT_BEEHIVE_COW_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_COW_GROTTO)); + locationTable[RC_DMT_STORMS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_DMT_STORMS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x57), "Storms Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_STORMS_GROTTO_LEFT)); + locationTable[RC_DMT_STORMS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_DMT_STORMS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x57), "Storms Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_STORMS_GROTTO_RIGHT)); + locationTable[RC_GC_GROTTO_BEEHIVE] = Location::Base(RC_GC_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_GORON_CITY, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xFB), "Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_GC_GROTTO)); + locationTable[RC_DMC_UPPER_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_DMC_UPPER_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x7A), "Upper Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_UPPER_GROTTO_LEFT)); + locationTable[RC_DMC_UPPER_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_DMC_UPPER_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x7A), "Upper Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_UPPER_GROTTO_RIGHT)); + locationTable[RC_DMC_HAMMER_GROTTO_BEEHIVE] = Location::Base(RC_DMC_HAMMER_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xF9), "Hammer Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_HAMMER_GROTTO)); + locationTable[RC_ZR_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_ZR_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x29), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_OPEN_GROTTO_LEFT)); + locationTable[RC_ZR_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_ZR_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x29), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_OPEN_GROTTO_RIGHT)); + locationTable[RC_ZR_STORMS_GROTTO_BEEHIVE] = Location::Base(RC_ZR_STORMS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xEB), "Storms Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_STORMS_GROTTO)); + locationTable[RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_LEFT] = Location::Base(RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(382, 0x00), "In Front of King Zora Beehive Left", RHT_BEEHIVE_IN_FRONT_OF_KING_ZORA, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_IN_FRONT_OF_KING_ZORA_LEFT)); + locationTable[RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_RIGHT] = Location::Base(RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(948, 0x00), "In Front of King Zora Beehive Right", RHT_BEEHIVE_IN_FRONT_OF_KING_ZORA, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_IN_FRONT_OF_KING_ZORA_RIGHT)); + locationTable[RC_ZD_BEHIND_KING_ZORA_BEEHIVE] = Location::Base(RC_ZD_BEHIND_KING_ZORA_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(701, 0x00), "Behind King Zora Beehive", RHT_BEEHIVE_BEHIND_KING_ZORA, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_BEHIND_KING_ZORA)); + locationTable[RC_LH_GROTTO_BEEHIVE] = Location::Base(RC_LH_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LAKE_HYLIA, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xEF), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LH_GROTTO)); + locationTable[RC_GV_DEKU_SCRUB_GROTTO_BEEHIVE] = Location::Base(RC_GV_DEKU_SCRUB_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_GERUDO_VALLEY, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xF0), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_GV_DEKU_SCRUB_GROTTO)); + locationTable[RC_COLOSSUS_GROTTO_BEEHIVE] = Location::Base(RC_COLOSSUS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DESERT_COLOSSUS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xFD), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_COLOSSUS_GROTTO)); + // clang-format-on +} + +static RegisterShipInitFunc registerFunc(Rando::StaticData::RegisterBeehiveLocations); diff --git a/soh/soh/Enhancements/randomizer/ShuffleCows.cpp b/soh/soh/Enhancements/randomizer/ShuffleCows.cpp index 203981133..ac2e9529e 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleCows.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleCows.cpp @@ -19,7 +19,7 @@ void EnCow_MoveForRandomizer(EnCow* enCow, PlayState* play) { // Move left cow in lon lon tower enCow->actor.world.pos.x = -229.0f; enCow->actor.world.pos.z = 157.0f; - enCow->actor.shape.rot.y = 15783.0f; + enCow->actor.shape.rot.y = 15783; moved = true; } else if (play->sceneNum == SCENE_STABLE && enCow->actor.world.pos.x == -3 && enCow->actor.world.pos.z == -254) { // Move right cow in lon lon stable @@ -39,7 +39,8 @@ void RegisterShuffleCows() { COND_VB_SHOULD(VB_GIVE_ITEM_FROM_COW, shouldRegister, { EnCow* enCow = va_arg(args, EnCow*); CowIdentity cowIdentity = OTRGlobals::Instance->gRandomizer->IdentifyCow( - gPlayState->sceneNum, enCow->actor.world.pos.x, enCow->actor.world.pos.z); + gPlayState->sceneNum, static_cast(enCow->actor.world.pos.x), + static_cast(enCow->actor.world.pos.z)); // Has this cow already rewarded an item? if (!Flags_GetRandomizerInf(cowIdentity.randomizerInf)) { Flags_SetRandomizerInf(cowIdentity.randomizerInf); @@ -75,7 +76,6 @@ void Rando::StaticData::RegisterCowLocations() { locationTable[RC_DMT_COW_GROTTO_COW] = Location::Base(RC_DMT_COW_GROTTO_COW, RCQUEST_BOTH, RCTYPE_COW, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_EN_COW, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2444, -471), "Cow Grotto Cow", RHT_DMT_COW_GROTTO_COW, RG_MILK, SpoilerCollectionCheck::RandomizerInf(RAND_INF_COWS_MILKED_DMT_COW_GROTTO_COW)); locationTable[RC_GV_COW] = Location::Base(RC_GV_COW, RCQUEST_BOTH, RCTYPE_COW, ACTOR_EN_COW, SCENE_GERUDO_VALLEY, 0x00, "Cow", RHT_GV_COW, RG_MILK, SpoilerCollectionCheck::RandomizerInf(RAND_INF_COWS_MILKED_GV_COW)); locationTable[RC_JABU_JABUS_BELLY_MQ_COW] = Location::Base(RC_JABU_JABUS_BELLY_MQ_COW, RCQUEST_MQ, RCTYPE_COW, ACTOR_EN_COW, SCENE_JABU_JABU, 0x00, "MQ Cow", RHT_JABU_JABUS_BELLY_MQ_COW, RG_MILK, SpoilerCollectionCheck::RandomizerInf(RAND_INF_COWS_MILKED_JABU_JABUS_BELLY_MQ_COW)); - // clang-format-on } diff --git a/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp b/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp index 808078789..343221d63 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleCrates.cpp @@ -3,6 +3,7 @@ #include "static_data.h" #include #include "global.h" +#include "soh/ResourceManagerHelpers.h" extern "C" { #include "variables.h" @@ -11,7 +12,6 @@ extern "C" { #include "overlays/actors/ovl_Obj_Kibako/z_obj_kibako.h" #include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "soh/Enhancements/enhancementTypes.h" -#include "soh/ResourceManagerHelpers.h" extern PlayState* gPlayState; } @@ -195,7 +195,7 @@ void ObjKibako2_RandomizerSpawnCollectible(ObjKibako2* crateActor, PlayState* pl item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; item00->actor.velocity.y = 8.0f; item00->actor.speedXZ = 2.0f; - item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f); + item00->actor.world.rot.y = static_cast(Rand_CenteredFloat(65536.0f)); } void ObjKibako_RandomizerSpawnCollectible(ObjKibako* smallCrateActor, PlayState* play) { @@ -206,7 +206,7 @@ void ObjKibako_RandomizerSpawnCollectible(ObjKibako* smallCrateActor, PlayState* item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; item00->actor.velocity.y = 8.0f; item00->actor.speedXZ = 2.0f; - item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f); + item00->actor.world.rot.y = static_cast(Rand_CenteredFloat(65536.0f)); } void ObjKibako2_RandomizerInit(void* actorRef) { diff --git a/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp b/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp index b2e485a34..1aa0970d2 100644 --- a/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp +++ b/soh/soh/Enhancements/randomizer/ShuffleGrass.cpp @@ -117,7 +117,7 @@ void EnKusa_RandomizerSpawnCollectible(EnKusa* grassActor, PlayState* play) { item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; item00->actor.velocity.y = 8.0f; item00->actor.speedXZ = 2.0f; - item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f); + item00->actor.world.rot.y = static_cast(Rand_CenteredFloat(65536.0f)); } void EnKusa_RandomizerInit(void* actorRef) { diff --git a/soh/soh/Enhancements/randomizer/ShufflePots.cpp b/soh/soh/Enhancements/randomizer/ShufflePots.cpp index 20ef1922a..2021d225a 100644 --- a/soh/soh/Enhancements/randomizer/ShufflePots.cpp +++ b/soh/soh/Enhancements/randomizer/ShufflePots.cpp @@ -48,7 +48,7 @@ void ObjTsubo_RandomizerSpawnCollectible(ObjTsubo* potActor, PlayState* play) { item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; item00->actor.velocity.y = 8.0f; item00->actor.speedXZ = 2.0f; - item00->actor.world.rot.y = Rand_CenteredFloat(65536.0f); + item00->actor.world.rot.y = static_cast(Rand_CenteredFloat(65536.0f)); } void ObjTsubo_RandomizerInit(void* actorRef) { diff --git a/soh/soh/Enhancements/randomizer/context.cpp b/soh/soh/Enhancements/randomizer/context.cpp index fa755325e..e3a914e87 100644 --- a/soh/soh/Enhancements/randomizer/context.cpp +++ b/soh/soh/Enhancements/randomizer/context.cpp @@ -202,7 +202,6 @@ void Context::GenerateLocationPool() { mOptions[RSK_SHUFFLE_FREESTANDING].Is(RO_SHUFFLE_FREESTANDING_DUNGEONS)) || (location.GetRCType() == RCTYPE_POT && mOptions[RSK_SHUFFLE_POTS].Is(RO_SHUFFLE_POTS_DUNGEONS)) || (location.GetRCType() == RCTYPE_GRASS && mOptions[RSK_SHUFFLE_GRASS].Is(RO_SHUFFLE_GRASS_DUNGEONS)) || - (location.GetRCType() == RCTYPE_POT && mOptions[RSK_SHUFFLE_POTS].Is(RO_SHUFFLE_POTS_DUNGEONS)) || (location.GetRCType() == RCTYPE_CRATE && mOptions[RSK_SHUFFLE_CRATES].Is(RO_SHUFFLE_CRATES_DUNGEONS)) || (location.GetRCType() == RCTYPE_NLCRATE && mOptions[RSK_SHUFFLE_CRATES].Is(RO_SHUFFLE_CRATES_DUNGEONS) && diff --git a/soh/soh/Enhancements/randomizer/draw.cpp b/soh/soh/Enhancements/randomizer/draw.cpp index 0403966b7..b9cc0b10b 100644 --- a/soh/soh/Enhancements/randomizer/draw.cpp +++ b/soh/soh/Enhancements/randomizer/draw.cpp @@ -597,7 +597,7 @@ extern "C" s32 OverrideLimbDrawBarinade(PlayState* play, s32 limbIndex, Gfx** dL (uintptr_t)Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, 0, 8, 16, 1, 0, (play->gameplayFrames * -2) % 64, 16, 16)); gDPSetEnvColor(POLY_OPA_DISP++, 0, 0, 0, 200); - Matrix_RotateX(-M_PI / 2, MTXMODE_APPLY); + Matrix_RotateX(-M_PIf / 2.0f, MTXMODE_APPLY); } else if ((limbIndex >= 10) && (limbIndex < 20)) { rot->x -= 0x4000; *dList = NULL; @@ -1097,7 +1097,7 @@ extern "C" void Randomizer_DrawBronzeScale(PlayState* play, GetItemEntry* getIte gSPSegment(POLY_XLU_DISP++, 0x08, (uintptr_t)Gfx_TwoTexScroll(play->state.gfxCtx, 0, 1 * (play->state.frames * 2), -1 * (play->state.frames * 2), 64, 64, 1, 1 * (play->state.frames * 4), - 1 * -(play->state.frames * 4), 32, 32)); + -1 * (play->state.frames * 4), 32, 32)); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); @@ -1116,7 +1116,7 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI // Draw rod Gfx_SetupDL_25Opa(play->state.gfxCtx); - Matrix_Scale(0.2, 0.2, 0.2, MTXMODE_APPLY); + Matrix_Scale(0.2f, 0.2f, 0.2f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_MODELVIEW | G_MTX_LOAD); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingPoleGiDL); @@ -1126,8 +1126,8 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI Matrix_Scale(5.0f, 5.0f, 5.0f, MTXMODE_APPLY); pos = { 0.0f, -25.5f, -4.0f }; Matrix_Translate(pos.x, pos.y, pos.z, MTXMODE_APPLY); - Matrix_RotateZ(-M_PI_2, MTXMODE_APPLY); - Matrix_RotateY(-M_PI_2 - 0.2f, MTXMODE_APPLY); + Matrix_RotateZ(-M_PI_2f, MTXMODE_APPLY); + Matrix_RotateY(-M_PI_2f - 0.2f, MTXMODE_APPLY); Matrix_Scale(0.006f, 0.006f, 0.006f, MTXMODE_APPLY); Gfx_SetupDL_25Opa(play->state.gfxCtx); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), @@ -1140,7 +1140,7 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL); - Matrix_RotateZ(M_PI_2, MTXMODE_APPLY); + Matrix_RotateZ(M_PI_2f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL); @@ -1149,7 +1149,7 @@ extern "C" void Randomizer_DrawFishingPoleGI(PlayState* play, GetItemEntry* getI gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL); - Matrix_RotateZ(M_PI / 2, MTXMODE_APPLY); + Matrix_RotateZ(M_PIf / 2.0f, MTXMODE_APPLY); gSPMatrix(POLY_OPA_DISP++, Matrix_NewMtx(play->state.gfxCtx, (char*)__FILE__, __LINE__), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_OPA_DISP++, (Gfx*)gFishingLureHookDL); diff --git a/soh/soh/Enhancements/randomizer/entrance.cpp b/soh/soh/Enhancements/randomizer/entrance.cpp index f58dad3bc..5a19339ce 100644 --- a/soh/soh/Enhancements/randomizer/entrance.cpp +++ b/soh/soh/Enhancements/randomizer/entrance.cpp @@ -441,12 +441,6 @@ static bool ValidateWorld(Entrance* entrancePlaced) { type = entrancePlaced->GetType(); } - bool checkPoeCollectorAccess = - (ctx->GetOption(RSK_SHUFFLE_OVERWORLD_ENTRANCES) || - ctx->GetOption(RSK_SHUFFLE_INTERIOR_ENTRANCES).Is(RO_INTERIOR_ENTRANCE_SHUFFLE_ALL)) && - (entrancePlaced == nullptr || ctx->GetOption(RSK_MIXED_ENTRANCE_POOLS) || type == EntranceType::Interior || - type == EntranceType::SpecialInterior || type == EntranceType::Overworld || type == EntranceType::Spawn || - type == EntranceType::WarpSong || type == EntranceType::OwlDrop); bool checkOtherEntranceAccess = (ctx->GetOption(RSK_SHUFFLE_OVERWORLD_ENTRANCES) || ctx->GetOption(RSK_SHUFFLE_INTERIOR_ENTRANCES).Is(RO_INTERIOR_ENTRANCE_SHUFFLE_ALL) || @@ -459,7 +453,7 @@ static bool ValidateWorld(Entrance* entrancePlaced) { // Conditions will be checked during the search and any that fail will be figured out // afterwards ctx->GetLogic()->Reset(); - ValidateEntrances(checkPoeCollectorAccess, checkOtherEntranceAccess); + ValidateEntrances(checkOtherEntranceAccess); if (!ctx->GetOption(RSK_DECOUPLED_ENTRANCES)) { // Unless entrances are decoupled, we don't want the player to end up through certain entrances as the wrong age @@ -544,15 +538,6 @@ static bool ValidateWorld(Entrance* entrancePlaced) { } } - // The Big Poe shop should always be accessible as adult without the need to use any bottles - // This is important to ensure that players can never lock their only bottles by filling them with Big Poes they - // can't sell - if (checkPoeCollectorAccess) { - if (!RegionTable(RR_MARKET_GUARD_HOUSE)->Adult()) { - SPDLOG_DEBUG("Big Poe Shop access is not guarenteed as adult\n"); - return false; - } - } SPDLOG_DEBUG("All Locations NOT REACHABLE\n"); return false; } diff --git a/soh/soh/Enhancements/randomizer/entrance.h b/soh/soh/Enhancements/randomizer/entrance.h index 026da7426..8fc192ca1 100644 --- a/soh/soh/Enhancements/randomizer/entrance.h +++ b/soh/soh/Enhancements/randomizer/entrance.h @@ -90,7 +90,7 @@ class Entrance { Entrance* reverse = nullptr; Entrance* assumed = nullptr; Entrance* replacement = nullptr; - int16_t index = 0xFFFF; + int16_t index = -1; bool shuffled = false; bool primary = false; bool addedToPool = false; diff --git a/soh/soh/Enhancements/randomizer/fishsanity.cpp b/soh/soh/Enhancements/randomizer/fishsanity.cpp index 99636d1a4..1b7eb7b92 100644 --- a/soh/soh/Enhancements/randomizer/fishsanity.cpp +++ b/soh/soh/Enhancements/randomizer/fishsanity.cpp @@ -136,8 +136,9 @@ Fishsanity::GetFishingPondLocations(FishsanityOptionsSource optionsSource) { } // NOTE: This only works because we can assume activeFish is already sorted; changes that break this assumption will // also break this - FilterAndEraseFromPool(remainingFish, - [&](uint32_t loc) { return std::binary_search(activeFish.begin(), activeFish.end(), loc); }); + FilterAndEraseFromPool(remainingFish, [&](RandomizerCheck loc) { + return std::binary_search(activeFish.begin(), activeFish.end(), loc); + }); return std::make_pair(activeFish, remainingFish); } diff --git a/soh/soh/Enhancements/randomizer/hint.cpp b/soh/soh/Enhancements/randomizer/hint.cpp index d81e94f2f..4c3de9770 100644 --- a/soh/soh/Enhancements/randomizer/hint.cpp +++ b/soh/soh/Enhancements/randomizer/hint.cpp @@ -174,8 +174,8 @@ void Hint::NamesChosen() { auto ctx = Rando::Context::GetInstance(); std::vector namesTemp = {}; bool saveNames = false; - uint8_t numMessages = GetNumberOfMessages(); - for (uint8_t c = 0; c < numMessages; c++) { + size_t numMessages = GetNumberOfMessages(); + for (size_t c = 0; c < numMessages; c++) { uint8_t selection = GetRandomHintTextEntry(GetHintText(c)); if (selection > 0) { saveNames = true; @@ -187,7 +187,7 @@ void Hint::NamesChosen() { } if (hintType == HINT_TYPE_ITEM || hintType == HINT_TYPE_ITEM_AREA) { - for (uint8_t c = 0; c < locations.size(); c++) { + for (size_t c = 0; c < locations.size(); c++) { namesTemp = {}; saveNames = false; uint8_t selection = GetRandomHintTextEntry(GetItemHintText(c)); @@ -218,7 +218,7 @@ void Hint::NamesChosen() { } } -uint8_t Hint::GetNumberOfMessages() const { +size_t Hint::GetNumberOfMessages() const { size_t numMessages = std::max(messages.size(), hintKeys.size()); if (StaticData::staticHintInfoMap.contains(ownKey)) { numMessages = std::max(StaticData::staticHintInfoMap[ownKey].hintKeys.size(), numMessages); @@ -231,14 +231,14 @@ uint8_t Hint::GetNumberOfMessages() const { const std::vector Hint::GetAllMessageStrings(MessageFormat format) const { std::vector hintMessages = {}; - uint8_t numMessages = GetNumberOfMessages(); - for (int c = 0; c < numMessages; c++) { + size_t numMessages = GetNumberOfMessages(); + for (size_t c = 0; c < numMessages; c++) { hintMessages.push_back(GetHintMessage(format, c).GetForCurrentLanguage(format)); } return hintMessages; } -const HintText Hint::GetHintText(uint8_t id) const { +const HintText Hint::GetHintText(size_t id) const { auto ctx = Rando::Context::GetInstance(); if (hintKeys.size() > id) { return StaticData::hintTextTable[hintKeys[id]]; @@ -283,11 +283,11 @@ const HintText Hint::GetHintText(uint8_t id) const { } } -const CustomMessage Hint::GetHintMessage(MessageFormat format, uint8_t id) const { +const CustomMessage Hint::GetHintMessage(MessageFormat format, size_t id) const { auto ctx = Rando::Context::GetInstance(); CustomMessage hintText = CustomMessage(""); - uint8_t chosenMessage = 0; + size_t chosenMessage = 0; if (hintTextsChosen.size() > id) { chosenMessage = id; } diff --git a/soh/soh/Enhancements/randomizer/hint.h b/soh/soh/Enhancements/randomizer/hint.h index e0e595395..7ff46a104 100644 --- a/soh/soh/Enhancements/randomizer/hint.h +++ b/soh/soh/Enhancements/randomizer/hint.h @@ -23,10 +23,10 @@ class Hint { void FillGapsInData(); void SetLocationsAsHinted() const; void NamesChosen(); - uint8_t GetNumberOfMessages() const; + size_t GetNumberOfMessages() const; const std::vector GetAllMessageStrings(MessageFormat format = MF_AUTO_FORMAT) const; - const CustomMessage GetHintMessage(MessageFormat format = MF_AUTO_FORMAT, uint8_t id = 0) const; - const HintText GetHintText(uint8_t id = 0) const; + const CustomMessage GetHintMessage(MessageFormat format = MF_AUTO_FORMAT, size_t id = 0) const; + const HintText GetHintText(size_t id = 0) const; oJson toJSON(); void logHint(oJson& jsonData); const HintText GetItemHintText(uint8_t slot, bool mysterious = false) const; diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index bd267aebe..5da887494 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -29,6 +29,7 @@ extern "C" { #include "src/overlays/actors/ovl_En_Shopnuts/z_en_shopnuts.h" #include "src/overlays/actors/ovl_En_Dns/z_en_dns.h" #include "src/overlays/actors/ovl_En_Gb/z_en_gb.h" +#include "src/overlays/actors/ovl_En_Po_Field/z_en_po_field.h" #include "src/overlays/actors/ovl_Item_B_Heart/z_item_b_heart.h" #include "src/overlays/actors/ovl_En_Ko/z_en_ko.h" #include "src/overlays/actors/ovl_En_Mk/z_en_mk.h" @@ -43,7 +44,6 @@ extern "C" { #include "src/overlays/actors/ovl_En_Box/z_en_box.h" #include "src/overlays/actors/ovl_En_Skj/z_en_skj.h" #include "src/overlays/actors/ovl_En_Hy/z_en_hy.h" -#include "src/overlays/actors/ovl_Obj_Comb/z_obj_comb.h" #include "src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h" #include "src/overlays/actors/ovl_En_Ge1/z_en_ge1.h" #include "src/overlays/actors/ovl_En_Ds/z_en_ds.h" @@ -328,7 +328,7 @@ void RandomizerOnPlayerUpdateForRCQueueHandler() { (getItemEntry.getItemCategory == ITEM_CATEGORY_JUNK || getItemEntry.getItemCategory == ITEM_CATEGORY_SKULLTULA_TOKEN || getItemEntry.getItemCategory == ITEM_CATEGORY_LESSER))))) { - Item_DropCollectible(gPlayState, &spawnPos, ITEM00_SOH_GIVE_ITEM_ENTRY | 0x8000); + Item_DropCollectible(gPlayState, &spawnPos, static_cast(ITEM00_SOH_GIVE_ITEM_ENTRY | 0x8000)); } } @@ -1013,7 +1013,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l if (item00->itemEntry.getItemId == GI_SWORD_BGS) { gSaveContext.bgsFlag = true; } - Item_Give(gPlayState, item00->itemEntry.itemId); + Item_Give(gPlayState, static_cast(item00->itemEntry.itemId)); } else if (item00->itemEntry.modIndex == MOD_RANDOMIZER) { if (item00->itemEntry.getItemId == RG_ICE_TRAP) { gSaveContext.ship.pendingIceTrapCount++; @@ -1080,12 +1080,35 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l *should = false; break; } + case VB_BOTTLE_BIG_POE: { + EnPoField* enPoe = va_arg(args, EnPoField*); + enPoe->actor.textId = 0x5090; + Flags_SetSwitch(gPlayState, enPoe->actor.params & 0xFF); + HIGH_SCORE(HS_POE_POINTS) += 100; + if (HIGH_SCORE(HS_POE_POINTS) > 1100) { + HIGH_SCORE(HS_POE_POINTS) = 1100; + } + *should = false; + break; + } + case VB_SELL_POES_TO_POE_COLLECTOR: { + if (!Flags_GetRandomizerInf(RAND_INF_10_BIG_POES) && HIGH_SCORE(HS_POE_POINTS) >= 1000) { + EnGb* enGb = va_arg(args, EnGb*); + enGb->textId = 0x70F8; + Message_ContinueTextbox(gPlayState, enGb->textId); + enGb->actionFunc = func_80A2FB40; + *should = false; + } + break; + } case VB_GIVE_ITEM_FROM_POE_COLLECTOR: { EnGb* enGb = va_arg(args, EnGb*); if (!Flags_GetRandomizerInf(RAND_INF_10_BIG_POES)) { + Flags_SetInfTable(INFTABLE_SPOKE_TO_POE_COLLECTOR_IN_RUINED_MARKET); Flags_SetRandomizerInf(RAND_INF_10_BIG_POES); + enGb->textId = 0x70F5; enGb->dyna.actor.parent = NULL; - enGb->actionFunc = func_80A2FC0C; + enGb->actionFunc = func_80A2F83C; *should = false; } break; @@ -1832,65 +1855,6 @@ void EnDns_RandomizerPurchase(EnDns* enDns) { Flags_SetRandomizerInf(enDns->sohScrubIdentity.randomizerInf); } -void ObjComb_RandomizerChooseItemDrop(ObjComb* objComb, PlayState* play) { - s16 params = objComb->actor.params & 0x1F; - - if (RAND_GET_OPTION(RSK_SHUFFLE_BEEHIVES) && !Flags_GetRandomizerInf(objComb->beehiveIdentity.randomizerInf)) { - EnItem00* item00 = (EnItem00*)Item_DropCollectible2(play, &objComb->actor.world.pos, ITEM00_SOH_DUMMY); - item00->randoInf = objComb->beehiveIdentity.randomizerInf; - item00->itemEntry = - OTRGlobals::Instance->gRandomizer->GetItemFromKnownCheck(objComb->beehiveIdentity.randomizerCheck, GI_NONE); - item00->actor.draw = (ActorFunc)EnItem00_DrawRandomizedItem; - return; - } - - if ((params > 0) || (params < 0x1A)) { - if (params == 6) { - if (Flags_GetCollectible(play, (objComb->actor.params >> 8) & 0x3F)) { - params = -1; - } else { - params = (params | (((objComb->actor.params >> 8) & 0x3F) << 8)); - } - } else if (Rand_ZeroOne() < 0.5f) { - params = -1; - } - if (params >= 0 && !CVarGetInteger(CVAR_ENHANCEMENT("NoRandomDrops"), 0)) { - Item_DropCollectible(play, &objComb->actor.world.pos, params); - } - } -} - -void ObjComb_RandomizerWait(ObjComb* objComb, PlayState* play) { - s32 dmgFlags; - - objComb->unk_1B0 -= 50; - if (RAND_GET_OPTION(RSK_SHUFFLE_BEEHIVES) && !Flags_GetRandomizerInf(objComb->beehiveIdentity.randomizerInf)) { - if (objComb->unk_1B0 <= -5000) { - objComb->unk_1B0 = 1500; - } - } else if (objComb->unk_1B0 < 0) { - objComb->unk_1B0 = 0; - } - - if ((objComb->collider.base.acFlags & AC_HIT) != 0) { - objComb->collider.base.acFlags &= ~AC_HIT; - dmgFlags = objComb->collider.elements[0].info.acHitInfo->toucher.dmgFlags; - if (dmgFlags & 0x4001F866) { - objComb->unk_1B0 = 1500; - } else { - ObjComb_Break(objComb, play); - ObjComb_RandomizerChooseItemDrop(objComb, play); - Actor_Kill(&objComb->actor); - } - } else { - CollisionCheck_SetAC(play, &play->colChkCtx, &objComb->collider.base); - } - - if (objComb->actor.update != NULL) { - CollisionCheck_SetOC(play, &play->colChkCtx, &objComb->collider.base); - } -} - void RandomizerOnActorInitHandler(void* actorRef) { Actor* actor = static_cast(actorRef); @@ -1983,14 +1947,6 @@ void RandomizerOnActorInitHandler(void* actorRef) { } } - if (actor->id == ACTOR_OBJ_COMB) { - ObjComb* objComb = static_cast(actorRef); - s16 respawnData = gSaveContext.respawn[RESPAWN_MODE_RETURN].data & ((1 << 8) - 1); - objComb->beehiveIdentity = OTRGlobals::Instance->gRandomizer->IdentifyBeehive( - gPlayState->sceneNum, (s16)actor->world.pos.x, respawnData); - objComb->actionFunc = (ObjCombActionFunc)ObjComb_RandomizerWait; - } - if (actor->id == ACTOR_EN_EX_ITEM) { EnExItem* enExItem = static_cast(actorRef); @@ -2137,27 +2093,27 @@ void RandomizerOnActorInitHandler(void* actorRef) { void RandomizerOnGameFrameUpdateHandler() { if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_QUIVER)) { - AMMO(ITEM_BOW) = CUR_CAPACITY(UPG_QUIVER); + AMMO(ITEM_BOW) = static_cast(CUR_CAPACITY(UPG_QUIVER)); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_BOMB_BAG)) { - AMMO(ITEM_BOMB) = CUR_CAPACITY(UPG_BOMB_BAG); + AMMO(ITEM_BOMB) = static_cast(CUR_CAPACITY(UPG_BOMB_BAG)); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_BULLET_BAG)) { - AMMO(ITEM_SLINGSHOT) = CUR_CAPACITY(UPG_BULLET_BAG); + AMMO(ITEM_SLINGSHOT) = static_cast(CUR_CAPACITY(UPG_BULLET_BAG)); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_STICK_UPGRADE)) { - AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); + AMMO(ITEM_STICK) = static_cast(CUR_CAPACITY(UPG_STICKS)); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_NUT_UPGRADE)) { - AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS); + AMMO(ITEM_NUT) = static_cast(CUR_CAPACITY(UPG_NUTS)); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MAGIC_METER)) { - gSaveContext.magic = gSaveContext.magicCapacity; + gSaveContext.magic = static_cast(gSaveContext.magicCapacity); } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_BOMBCHUS)) { @@ -2165,7 +2121,7 @@ void RandomizerOnGameFrameUpdateHandler() { } if (Flags_GetRandomizerInf(RAND_INF_HAS_INFINITE_MONEY)) { - gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET); + gSaveContext.rupees = static_cast(CUR_CAPACITY(UPG_WALLET)); } if (!Flags_GetRandomizerInf(RAND_INF_HAS_WALLET)) { @@ -2199,12 +2155,6 @@ void RandomizerOnActorUpdateHandler(void* refActor) { actor->params == 0x000F) { // Warp Song particles Entrance_SetWarpSongEntrance(); } - - if (actor->id == ACTOR_OBJ_COMB) { - ObjComb* combActor = reinterpret_cast(actor); - combActor->actor.shape.rot.x = - Math_SinS(combActor->unk_1B2) * CLAMP_MIN(combActor->unk_1B0, 0) + combActor->actor.home.rot.x; - } } // from z_player.c @@ -2216,29 +2166,29 @@ typedef struct { // special respawns used when voided out without swim to prevent infinite loops std::map swimSpecialRespawnInfo = { { ENTR_ZORAS_RIVER_3, // hf to zr in water - { { -1455.443, -20, 1384.826 }, 28761 } }, + { { -1455.443f, -20.0f, 1384.826f }, 28761 } }, { ENTR_HYRULE_FIELD_14, // zr to hf in water - { { 5730.209, -20, 3725.911 }, -20025 } }, + { { 5730.209f, -20.0f, 3725.911f }, -20025 } }, { ENTR_LOST_WOODS_UNDERWATER_SHORTCUT, // zr to lw - { { 1978.718, -36.908, -855 }, -16384 } }, + { { 1978.718f, -36.908f, -855.0f }, -16384 } }, { ENTR_ZORAS_RIVER_UNDERWATER_SHORTCUT, // lw to zr - { { 4082.366, 860.442, -1018.949 }, -32768 } }, + { { 4082.366f, 860.442f, -1018.949f }, -32768 } }, { ENTR_LAKE_HYLIA_RIVER_EXIT, // gv to lh - { { -3276.416, -1033, 2908.421 }, 11228 } }, + { { -3276.416f, -1033.0f, 2908.421f }, 11228 } }, { ENTR_WATER_TEMPLE_ENTRANCE, // lh to water temple - { { -182, 780, 759.5 }, -32768 } }, + { { -182.0f, 780.0f, 759.5f }, -32768 } }, { ENTR_LAKE_HYLIA_OUTSIDE_TEMPLE, // water temple to lh - { { -955.028, -1306.9, 6768.954 }, -32768 } }, + { { -955.028f, -1306.9f, 6768.954f }, -32768 } }, { ENTR_ZORAS_DOMAIN_UNDERWATER_SHORTCUT, // lh to zd - { { -109.86, 11.396, -9.933 }, -29131 } }, + { { -109.86f, 11.396f, -9.933f }, -29131 } }, { ENTR_LAKE_HYLIA_UNDERWATER_SHORTCUT, // zd to lh - { { -912, -1326.967, 3391 }, 0 } }, + { { -912.0f, -1326.967f, 3391.0f }, 0 } }, { ENTR_GERUDO_VALLEY_1, // caught by gerudos as child - { { -424, -2051, -74 }, 16384 } }, + { { -424.0f, -2051.0f, -74.0f }, 16384 } }, { ENTR_HYRULE_FIELD_ON_BRIDGE_SPAWN, // mk to hf (can be a problem when it then turns night) - { { 0, 0, 1100 }, 0 } }, + { { 0.0f, 0.0f, 1100.0f }, 0 } }, { ENTR_ZORAS_FOUNTAIN_JABU_JABU_BLUE_WARP, // jabu blue warp to zf - { { -1580, 150, 1670 }, 8000 } }, + { { -1580.0f, 150.0f, 1670.0f }, 8000 } }, }; f32 triforcePieceScale; @@ -2298,8 +2248,8 @@ void RandomizerOnSceneSpawnActorsHandler() { switch (gPlayState->sceneNum) { case SCENE_TEMPLE_OF_TIME: if (gPlayState->roomCtx.curRoom.num == 1) { - Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_XC, -104, -40, 2382, 0, 0x8000, 0, - SHEIK_TYPE_RANDO, false); + Actor_Spawn(&gPlayState->actorCtx, gPlayState, ACTOR_EN_XC, -104, -40, 2382, 0, + static_cast(0x8000), 0, SHEIK_TYPE_RANDO, false); } break; case SCENE_INSIDE_GANONS_CASTLE: diff --git a/soh/soh/Enhancements/randomizer/location_access.cpp b/soh/soh/Enhancements/randomizer/location_access.cpp index 3e5664ff8..c7e98dca2 100644 --- a/soh/soh/Enhancements/randomizer/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/location_access.cpp @@ -10,9 +10,10 @@ #include "soh/Enhancements/debugger/performanceTimer.h" #include +#include +#include "3drando/shops.hpp" extern "C" { -extern SaveContext gSaveContext; extern PlayState* gPlayState; } @@ -45,17 +46,71 @@ bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAvailab conditionsMet = true; } - return conditionsMet && - (calculatingAvailableChecks || CanBuy()); // TODO: run CanBuy when price is known due to settings + return conditionsMet && CanBuy(calculatingAvailableChecks); } -bool LocationAccess::CanBuy() const { - return CanBuyAnother(location); +static uint16_t GetMinimumPrice(const Rando::Location* loc) { + extern PriceSettingsStruct shopsanityPrices; + extern PriceSettingsStruct scrubPrices; + extern PriceSettingsStruct merchantPrices; + PriceSettingsStruct priceSettings = loc->GetRCType() == RCTYPE_SHOP ? shopsanityPrices + : loc->GetRCType() == RCTYPE_SCRUB ? scrubPrices + : merchantPrices; + + auto ctx = Rando::Context::GetInstance(); + switch (ctx->GetOption(priceSettings.main).Get()) { + case RO_PRICE_VANILLA: + return loc->GetVanillaPrice(); + case RO_PRICE_CHEAP_BALANCED: + return 0; + case RO_PRICE_BALANCED: + return 0; + case RO_PRICE_FIXED: + return ctx->GetOption(priceSettings.fixedPrice).Get() * 5; + case RO_PRICE_RANGE: { + uint16_t range1 = ctx->GetOption(priceSettings.range1).Get() * 5; + uint16_t range2 = ctx->GetOption(priceSettings.range1).Get() * 5; + return range1 < range2 ? range1 : range2; + } + case RO_PRICE_SET_BY_WALLET: { + if (ctx->GetOption(priceSettings.noWallet).Get()) { + return 0; + } else if (ctx->GetOption(priceSettings.childWallet).Get()) { + return 1; + } else if (ctx->GetOption(priceSettings.adultWallet).Get()) { + return 100; + } else if (ctx->GetOption(priceSettings.giantWallet).Get()) { + return 201; + } else { + return 501; + } + } + default: + return 0; + } +} + +bool LocationAccess::CanBuy(bool calculatingAvailableChecks) const { + const auto& loc = Rando::StaticData::GetLocation(location); + const auto& itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(location); + + if (loc->GetRCType() == RCTYPE_SHOP || loc->GetRCType() == RCTYPE_SCRUB || loc->GetRCType() == RCTYPE_MERCHANT) { + // Checks should only be identified while playing + if (calculatingAvailableChecks && itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) { + return CanBuyAnother(GetMinimumPrice(loc)); + } else { + return CanBuyAnother(itemLoc->GetPrice()); + } + } + + return true; } bool CanBuyAnother(RandomizerCheck rc) { - uint16_t price = ctx->GetItemLocation(rc)->GetPrice(); + return CanBuyAnother(ctx->GetItemLocation(rc)->GetPrice()); +} +bool CanBuyAnother(uint16_t price) { if (price > 500) { return logic->HasItem(RG_TYCOON_WALLET); } else if (price > 200) { @@ -275,7 +330,7 @@ bool BeanPlanted(const RandomizerRegion region) { if (gPlayState != nullptr && gPlayState->sceneNum == sceneID) { swch = gPlayState->actorCtx.flags.swch; } else if (sceneID != SCENE_ID_MAX) { - swch = gSaveContext.sceneFlags[sceneID].swch; + swch = Rando::Context::GetInstance()->GetLogic()->GetSaveContext()->sceneFlags[sceneID].swch; } else { swch = 0; } @@ -312,7 +367,7 @@ void RegionTable_Init() { logic = ctx->GetLogic(); // RANDOTODO do not hardcode, instead allow accepting a Logic class somehow grottoEvents = { EventAccess(&logic->GossipStoneFairy, [] { return logic->CallGossipFairy(); }), - EventAccess(&logic->ButterflyFairy, [] { return logic->ButterflyFairy || (logic->CanUse(RG_STICKS)); }), + EventAccess(&logic->ButterflyFairy, [] { return logic->CanUse(RG_STICKS); }), EventAccess(&logic->BugShrub, [] { return logic->CanCutShrubs(); }), EventAccess(&logic->LoneFish, [] { return true; }), }; @@ -324,9 +379,6 @@ void RegionTable_Init() { areaTable[RR_ROOT] = Region("Root", "", {RA_LINKS_POCKET}, NO_DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->KakarikoVillageGateOpen, []{return ctx->GetOption(RSK_KAK_GATE).Is(RO_KAK_GATE_OPEN);}), - //The big poes bottle softlock safety check does not account for the guard house lock if the guard house is not shuffled, so the key is needed before we can safely allow bottle use in logic - //RANDOTODO a setting that lets you drink/dump big poes so we don't need this logic - EventAccess(&logic->CouldEmptyBigPoes, []{return !ctx->GetOption(RSK_SHUFFLE_INTERIOR_ENTRANCES).Is(RO_INTERIOR_ENTRANCE_SHUFFLE_OFF) || logic->CanOpenOverworldDoor(RG_GUARD_HOUSE_KEY);}), }, { //Locations LOCATION(RC_LINKS_POCKET, true), @@ -480,17 +532,17 @@ std::string CleanCheckConditionString(std::string condition) { } namespace Regions { -const auto GetAllRegions() { +auto GetAllRegions() { static const size_t regionCount = RR_MAX - (RR_NONE + 1); static std::array allRegions = {}; - static bool intialized = false; - if (!intialized) { + static bool initialized = false; + if (!initialized) { for (size_t i = 0; i < regionCount; i++) { allRegions[i] = (RandomizerRegion)((RR_NONE + 1) + i); } - intialized = true; + initialized = true; } return allRegions; @@ -629,7 +681,7 @@ std::vector GetShuffleableEntrances(Rando::EntranceType type, Rando::Entrance* GetEntrance(RandomizerRegion source, RandomizerRegion destination) { for (auto& exit : RegionTable(source)->exits) { - if (exit.GetConnectedRegionKey() == destination) { + if (exit.GetOriginalConnectedRegionKey() == destination) { return &exit; } } diff --git a/soh/soh/Enhancements/randomizer/location_access.h b/soh/soh/Enhancements/randomizer/location_access.h index df0cf6bd0..dc09712a1 100644 --- a/soh/soh/Enhancements/randomizer/location_access.h +++ b/soh/soh/Enhancements/randomizer/location_access.h @@ -100,9 +100,10 @@ class LocationAccess { std::string condition_str; // Makes sure shop locations are buyable - bool CanBuy() const; + bool CanBuy(bool calculatingAvailableChecks) const; }; +bool CanBuyAnother(uint16_t price); bool CanBuyAnother(RandomizerCheck rc); namespace Rando { diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp index 44c3fa817..8a8393ba1 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/bottom_of_the_well.cpp @@ -25,7 +25,6 @@ void RegionTable_Init_BottomOfTheWell() { }, { //Locations LOCATION(RC_BOTTOM_OF_THE_WELL_FRONT_CENTER_BOMBABLE_CHEST, logic->HasExplosives()), - LOCATION(RC_BOTTOM_OF_THE_WELL_FREESTANDING_KEY, (logic->HasItem(RG_BRONZE_SCALE) || logic->LoweredWaterInsideBotw) && logic->CanUse(RG_STICKS) || logic->CanUse(RG_DINS_FIRE)), LOCATION(RC_BOTTOM_OF_THE_WELL_UNDERWATER_FRONT_CHEST, logic->LoweredWaterInsideBotw), LOCATION(RC_BOTTOM_OF_THE_WELL_UNDERWATER_LEFT_CHEST, logic->LoweredWaterInsideBotw), LOCATION(RC_BOTTOM_OF_THE_WELL_NEAR_ENTRANCE_POT_1, logic->CanBreakPots()), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp index f327c9992..109799285 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/deku_tree.cpp @@ -445,7 +445,7 @@ void RegionTable_Init_DekuTree() { areaTable[RR_DEKU_TREE_BOSS_ROOM] = Region("Deku Tree Boss Room", "Deku Tree", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->DekuTreeClear, []{return logic->DekuTreeClear || logic->CanKillEnemy(RE_GOHMA);}), + EventAccess(&logic->DekuTreeClear, []{return logic->CanKillEnemy(RE_GOHMA);}), }, { // Locations LOCATION(RC_QUEEN_GOHMA, logic->DekuTreeClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/dodongos_cavern.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/dodongos_cavern.cpp index 8cd60f268..c268f4691 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/dodongos_cavern.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/dodongos_cavern.cpp @@ -567,7 +567,7 @@ void RegionTable_Init_DodongosCavern() { areaTable[RR_DODONGOS_CAVERN_BOSS_ROOM] = Region("Dodongos Cavern Boss Room", "Dodongos Cavern", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->DodongosCavernClear, []{return logic->DodongosCavernClear || (Here(RR_DODONGOS_CAVERN_BOSS_ROOM, []{return logic->HasExplosives() || (logic->CanUse(RG_MEGATON_HAMMER) && ctx->GetTrickOption(RT_DC_HAMMER_FLOOR));}) && logic->CanKillEnemy(RE_KING_DODONGO)); /*todo add chu kill to tricks*/}), + EventAccess(&logic->DodongosCavernClear, []{return Here(RR_DODONGOS_CAVERN_BOSS_ROOM, []{return logic->HasExplosives() || (logic->CanUse(RG_MEGATON_HAMMER) && ctx->GetTrickOption(RT_DC_HAMMER_FLOOR));}) && logic->CanKillEnemy(RE_KING_DODONGO); /*todo add chu kill to tricks*/}), }, { // Locations LOCATION(RC_DODONGOS_CAVERN_BOSS_ROOM_CHEST, true), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp index 8888cdac9..764a78a1c 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/fire_temple.cpp @@ -20,14 +20,14 @@ void RegionTable_Init_FireTemple() { //Exits Entrance(RR_FIRE_TEMPLE_ENTRYWAY, []{return true;}), Entrance(RR_FIRE_TEMPLE_NEAR_BOSS_ROOM, []{return logic->FireTimer() >= 24;}), - Entrance(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return Here(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->CanUse(RG_MEGATON_HAMMER);}) && (logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsKeysanity);}), + Entrance(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return Here(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->CanUse(RG_MEGATON_HAMMER);}) && (logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsFireLoopLocked);}), Entrance(RR_FIRE_TEMPLE_LOOP_EXIT, []{return true;}), Entrance(RR_FIRE_TEMPLE_BIG_LAVA_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 2) && logic->FireTimer() >= 24;}), }); areaTable[RR_FIRE_TEMPLE_NEAR_BOSS_ROOM] = Region("Fire Temple Near Boss Room", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->FairyPot, []{return logic->FairyPot || (logic->CanUse(RG_HOVER_BOOTS) || logic->CanUse(RG_HOOKSHOT));}), + EventAccess(&logic->FairyPot, []{return logic->CanUse(RG_HOVER_BOOTS) || logic->CanUse(RG_HOOKSHOT);}), }, { //Locations LOCATION(RC_FIRE_TEMPLE_NEAR_BOSS_CHEST, true), @@ -43,7 +43,7 @@ void RegionTable_Init_FireTemple() { areaTable[RR_FIRE_TEMPLE_LOOP_ENEMIES] = Region("Fire Temple Loop Enemies", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, {}, {}, { //Exits - Entrance(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsKeysanity;}), + Entrance(RR_FIRE_TEMPLE_FIRST_ROOM, []{return logic->SmallKeys(RR_FIRE_TEMPLE, 8) || !logic->IsFireLoopLocked;}), Entrance(RR_FIRE_TEMPLE_LOOP_TILES, []{return Here(RR_FIRE_TEMPLE_LOOP_ENEMIES, []{return logic->CanKillEnemy(RE_TORCH_SLUG) && logic->CanKillEnemy(RE_FIRE_KEESE);});}), }); @@ -67,7 +67,7 @@ void RegionTable_Init_FireTemple() { areaTable[RR_FIRE_TEMPLE_LOOP_HAMMER_SWITCH] = Region("Fire Temple Loop Hammer Switch", "Fire Temple", {RA_FIRE_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->FireLoopSwitch, []{return logic->FireLoopSwitch || logic->CanUse(RG_MEGATON_HAMMER);}), + EventAccess(&logic->FireLoopSwitch, []{return logic->CanUse(RG_MEGATON_HAMMER);}), }, {}, { //Exits Entrance(RR_FIRE_TEMPLE_LOOP_FLARE_DANCER, []{return true;}), @@ -745,7 +745,7 @@ void RegionTable_Init_FireTemple() { areaTable[RR_FIRE_TEMPLE_BOSS_ROOM] = Region("Fire Temple Boss Room", "Fire Temple", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->FireTempleClear, []{return logic->FireTempleClear || (logic->FireTimer() >= 64 && logic->CanKillEnemy(RE_VOLVAGIA));}), + EventAccess(&logic->FireTempleClear, []{return logic->FireTimer() >= 64 && logic->CanKillEnemy(RE_VOLVAGIA);}), }, { // Locations LOCATION(RC_FIRE_TEMPLE_VOLVAGIA_HEART, logic->FireTempleClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/forest_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/forest_temple.cpp index 2f5ba96bf..a74642324 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/forest_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/forest_temple.cpp @@ -34,7 +34,7 @@ void RegionTable_Init_ForestTemple() { areaTable[RR_FOREST_TEMPLE_LOBBY] = Region("Forest Temple Lobby", "Forest Temple", {RA_FOREST_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ForestTempleMeg, []{return logic->ForestTempleMeg || (logic->ForestTempleJoelle && logic->ForestTempleBeth && logic->ForestTempleAmy && logic->CanUse(RG_FAIRY_BOW));}), + EventAccess(&logic->ForestTempleMeg, []{return logic->ForestTempleJoelle && logic->ForestTempleBeth && logic->ForestTempleAmy && logic->CanUse(RG_FAIRY_BOW);}), }, { //Locations LOCATION(RC_FOREST_TEMPLE_GS_LOBBY, logic->HookshotOrBoomerang()), @@ -203,7 +203,7 @@ void RegionTable_Init_ForestTemple() { areaTable[RR_FOREST_TEMPLE_RED_POE_ROOM] = Region("Forest Temple Red Poe Room", "Forest Temple", {RA_FOREST_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ForestTempleJoelle, []{return logic->ForestTempleJoelle || logic->CanUse(RG_FAIRY_BOW);}), + EventAccess(&logic->ForestTempleJoelle, []{return logic->CanUse(RG_FAIRY_BOW);}), }, { //Locations LOCATION(RC_FOREST_TEMPLE_RED_POE_CHEST, logic->ForestTempleJoelle), @@ -228,7 +228,7 @@ void RegionTable_Init_ForestTemple() { areaTable[RR_FOREST_TEMPLE_BLUE_POE_ROOM] = Region("Forest Temple Blue Poe Room", "Forest Temple", {RA_FOREST_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ForestTempleBeth, []{return logic->ForestTempleBeth || logic->CanUse(RG_FAIRY_BOW);}), + EventAccess(&logic->ForestTempleBeth, []{return logic->CanUse(RG_FAIRY_BOW);}), }, { //Locations LOCATION(RC_FOREST_TEMPLE_BLUE_POE_CHEST, logic->ForestTempleBeth), @@ -274,7 +274,7 @@ void RegionTable_Init_ForestTemple() { areaTable[RR_FOREST_TEMPLE_GREEN_POE_ROOM] = Region("Forest Temple Green Poe Room", "Forest Temple", {RA_FOREST_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ForestTempleAmy, []{return logic->ForestTempleAmy || logic->CanUse(RG_FAIRY_BOW);}), + EventAccess(&logic->ForestTempleAmy, []{return logic->CanUse(RG_FAIRY_BOW);}), }, { //Locations LOCATION(RC_FOREST_TEMPLE_GREEN_POE_POT_1, logic->CanBreakPots()), @@ -608,7 +608,7 @@ void RegionTable_Init_ForestTemple() { areaTable[RR_FOREST_TEMPLE_BOSS_ROOM] = Region("Forest Temple Boss Room", "Forest Temple", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->ForestTempleClear, []{return logic->ForestTempleClear || logic->CanKillEnemy(RE_PHANTOM_GANON);}), + EventAccess(&logic->ForestTempleClear, []{return logic->CanKillEnemy(RE_PHANTOM_GANON);}), }, { // Locations LOCATION(RC_FOREST_TEMPLE_PHANTOM_GANON_HEART, logic->ForestTempleClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/ganons_castle.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/ganons_castle.cpp index 451225273..040c10a90 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/ganons_castle.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/ganons_castle.cpp @@ -80,7 +80,7 @@ void RegionTable_Init_GanonsCastle() { areaTable[RR_GANONS_CASTLE_WATER_TRIAL] = Region("Ganon's Castle Water Trial", "Ganon's Castle", {RA_GANONS_CASTLE}, NO_DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->BlueFireAccess, []{return true;}), - EventAccess(&logic->FairyPot, []{return logic->FairyPot || (logic->BlueFire() && logic->CanKillEnemy(RE_FREEZARD));}), + EventAccess(&logic->FairyPot, []{return logic->BlueFire() && logic->CanKillEnemy(RE_FREEZARD);}), EventAccess(&logic->WaterTrialClear, []{return logic->BlueFire() && logic->IsAdult && logic->CanUse(RG_MEGATON_HAMMER) && logic->CanUse(RG_LIGHT_ARROWS);}), }, { //Locations @@ -109,7 +109,7 @@ void RegionTable_Init_GanonsCastle() { areaTable[RR_GANONS_CASTLE_SPIRIT_TRIAL] = Region("Ganon's Castle Spirit Trial", "Ganon's Castle", {RA_GANONS_CASTLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->NutPot, []{return logic->NutPot || (((ctx->GetTrickOption(RT_GANON_SPIRIT_TRIAL_HOOKSHOT) && logic->CanJumpslashExceptHammer()) || logic->CanUse(RG_HOOKSHOT)) && logic->CanUse(RG_BOMBCHU_5) && logic->CanUse(RG_FAIRY_BOW) && (logic->CanUse(RG_MIRROR_SHIELD) || (ctx->GetOption(RSK_SUNLIGHT_ARROWS) && logic->CanUse(RG_LIGHT_ARROWS))));}), + EventAccess(&logic->NutPot, []{return ((ctx->GetTrickOption(RT_GANON_SPIRIT_TRIAL_HOOKSHOT) && logic->CanJumpslashExceptHammer()) || logic->CanUse(RG_HOOKSHOT)) && logic->CanUse(RG_BOMBCHU_5) && logic->CanUse(RG_FAIRY_BOW) && (logic->CanUse(RG_MIRROR_SHIELD) || (ctx->GetOption(RSK_SUNLIGHT_ARROWS) && logic->CanUse(RG_LIGHT_ARROWS)));}), EventAccess(&logic->SpiritTrialClear, []{return logic->CanUse(RG_LIGHT_ARROWS) && (logic->CanUse(RG_MIRROR_SHIELD) || ctx->GetOption(RSK_SUNLIGHT_ARROWS)) && logic->CanUse(RG_BOMBCHU_5) && ((ctx->GetTrickOption(RT_GANON_SPIRIT_TRIAL_HOOKSHOT) && logic->CanJumpslashExceptHammer()) || logic->CanUse(RG_HOOKSHOT));}), }, { //Locations diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/jabujabus_belly.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/jabujabus_belly.cpp index a43e1b685..bc90e5722 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/jabujabus_belly.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/jabujabus_belly.cpp @@ -361,7 +361,7 @@ void RegionTable_Init_JabuJabusBelly() { areaTable[RR_JABU_JABUS_BELLY_BOSS_ROOM] = Region("Jabu Jabus Belly Boss Room", "Jabu Jabus Belly", {}, NO_DAY_NIGHT_CYCLE, { // Events //todo: add pot kill trick - EventAccess(&logic->JabuJabusBellyClear, []{return logic->JabuJabusBellyClear || logic->CanKillEnemy(RE_BARINADE);}), + EventAccess(&logic->JabuJabusBellyClear, []{return logic->CanKillEnemy(RE_BARINADE);}), }, { // Locations LOCATION(RC_JABU_JABUS_BELLY_BARINADE_POT_1, logic->CanBreakPots()), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/shadow_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/shadow_temple.cpp index 3be1acac4..e7ee515d1 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/shadow_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/shadow_temple.cpp @@ -408,7 +408,7 @@ void RegionTable_Init_ShadowTemple() { areaTable[RR_SHADOW_TEMPLE_BOSS_ROOM] = Region("Shadow Temple Boss Room", "Shadow Temple", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->ShadowTempleClear, []{return logic->ShadowTempleClear || logic->CanKillEnemy(RE_BONGO_BONGO);}), + EventAccess(&logic->ShadowTempleClear, []{return logic->CanKillEnemy(RE_BONGO_BONGO);}), }, { // Locations LOCATION(RC_SHADOW_TEMPLE_BONGO_BONGO_HEART, logic->ShadowTempleClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/spirit_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/spirit_temple.cpp index e7f9c0ee6..c1cf1856f 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/spirit_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/spirit_temple.cpp @@ -556,7 +556,7 @@ void RegionTable_Init_SpiritTemple() { areaTable[RR_SPIRIT_TEMPLE_BOSS_ROOM] = Region("Spirit Temple Boss Room", "Spirit Temple", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->SpiritTempleClear, []{return logic->SpiritTempleClear || logic->CanKillEnemy(RE_TWINROVA);}), + EventAccess(&logic->SpiritTempleClear, []{return logic->CanKillEnemy(RE_TWINROVA);}), }, { // Locations LOCATION(RC_SPIRIT_TEMPLE_TWINROVA_HEART, logic->SpiritTempleClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp b/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp index 05efed953..3acf5d74a 100644 --- a/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/dungeons/water_temple.cpp @@ -40,7 +40,7 @@ void RegionTable_Init_WaterTemple() { areaTable[RR_WATER_TEMPLE_EAST_LOWER] = Region("Water Temple East Lower", "Water Temple", {RA_WATER_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->CanWaterTempleLowFromHigh, []{return logic->CanWaterTempleLowFromHigh || logic->CanUse(RG_ZELDAS_LULLABY);}), + EventAccess(&logic->CanWaterTempleLowFromHigh, []{return logic->CanUse(RG_ZELDAS_LULLABY);}), }, { //Locations LOCATION(RC_WATER_TEMPLE_TORCH_POT_1, logic->CanBreakPots() && (logic->CanWaterTempleLowFromHigh || (logic->CanUse(RG_HOOKSHOT) && logic->CanUse(RG_IRON_BOOTS)))), @@ -165,7 +165,7 @@ void RegionTable_Init_WaterTemple() { areaTable[RR_WATER_TEMPLE_CENTRAL_PILLAR_UPPER] = Region("Water Temple Central Pillar Upper", "Water Temple", {RA_WATER_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->CanWaterTempleMiddle, []{return logic->CanWaterTempleMiddle || logic->CanUse(RG_ZELDAS_LULLABY);}), + EventAccess(&logic->CanWaterTempleMiddle, []{return logic->CanUse(RG_ZELDAS_LULLABY);}), }, { //Locations LOCATION(RC_WATER_TEMPLE_GS_CENTRAL_PILLAR, logic->CanUse(RG_LONGSHOT) || (((ctx->GetTrickOption(RT_WATER_FW_CENTRAL_GS) && logic->CanUse(RG_FARORES_WIND) && (logic->CanUse(RG_FAIRY_BOW) || logic->CanUse(RG_DINS_FIRE) || logic->SmallKeys(RR_WATER_TEMPLE, 5))) || (ctx->GetTrickOption(RT_WATER_IRONS_CENTRAL_GS) && logic->CanUse(RG_IRON_BOOTS) && ((logic->CanUse(RG_HOOKSHOT) && logic->CanUse(RG_FAIRY_BOW)) || (logic->CanUse(RG_DINS_FIRE))))) && logic->CanWaterTempleHigh && logic->HookshotOrBoomerang())), @@ -202,7 +202,7 @@ void RegionTable_Init_WaterTemple() { areaTable[RR_WATER_TEMPLE_HIGH_WATER] = Region("Water Temple High Water", "Water Temple", {RA_WATER_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->CanWaterTempleHigh, []{return logic->CanWaterTempleHigh || logic->CanUse(RG_ZELDAS_LULLABY);}), + EventAccess(&logic->CanWaterTempleHigh, []{return logic->CanUse(RG_ZELDAS_LULLABY);}), }, {}, { //Exits Entrance(RR_WATER_TEMPLE_LOBBY, []{return true;}), @@ -658,7 +658,7 @@ void RegionTable_Init_WaterTemple() { areaTable[RR_WATER_TEMPLE_MQ_DRAGON_ROOM_ALCOVE] = Region("Water Temple MQ Dragon Room Alcove", "Water Temple", {RA_WATER_TEMPLE}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->MQWaterDragonTorches, []{return true;}), + EventAccess(&logic->MQWaterDragonTorches, []{return logic->HasFireSource();}), }, { //Locations @@ -848,7 +848,7 @@ void RegionTable_Init_WaterTemple() { areaTable[RR_WATER_TEMPLE_BOSS_ROOM] = Region("Water Temple Boss Room", "Water Temple", {}, NO_DAY_NIGHT_CYCLE, { // Events - EventAccess(&logic->WaterTempleClear, []{return logic->WaterTempleClear || logic->CanKillEnemy(RE_MORPHA);}), + EventAccess(&logic->WaterTempleClear, []{return logic->CanKillEnemy(RE_MORPHA);}), }, { // Locations LOCATION(RC_WATER_TEMPLE_MORPHA_HEART, logic->WaterTempleClear), diff --git a/soh/soh/Enhancements/randomizer/location_access/gerudo_fortress.cpp b/soh/soh/Enhancements/randomizer/location_access/gerudo_fortress.cpp index dd95b11fb..20d7817d8 100644 --- a/soh/soh/Enhancements/randomizer/location_access/gerudo_fortress.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/gerudo_fortress.cpp @@ -14,7 +14,7 @@ void RegionTable_Init_GerudoFortress() { //Events EventAccess(&logic->CarpenterRescue, []{return logic->CanFinishGerudoFortress();}), EventAccess(&logic->GF_GateOpen, []{return logic->IsAdult && logic->HasItem(RG_GERUDO_MEMBERSHIP_CARD);}), - EventAccess(&logic->GtG_GateOpen, []{return logic->GtG_GateOpen || (logic->IsAdult && logic->HasItem(RG_GERUDO_MEMBERSHIP_CARD) && logic->HasItem(RG_CHILD_WALLET));}), + EventAccess(&logic->GtG_GateOpen, []{return logic->IsAdult && logic->HasItem(RG_GERUDO_MEMBERSHIP_CARD) && logic->HasItem(RG_CHILD_WALLET);}), }, { //Locations LOCATION(RC_GF_CHEST, logic->CanUse(RG_HOVER_BOOTS) || (logic->IsAdult && logic->CanUse(RG_SCARECROW)) || logic->CanUse(RG_LONGSHOT)), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/castle_grounds.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/castle_grounds.cpp index dbf467b0f..fb9676f50 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/castle_grounds.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/castle_grounds.cpp @@ -17,7 +17,7 @@ void RegionTable_Init_CastleGrounds() { areaTable[RR_HYRULE_CASTLE_GROUNDS] = Region("Hyrule Castle Grounds", "Castle Grounds", {RA_HYRULE_CASTLE}, DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairy();}), - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || logic->CanUse(RG_STICKS);}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS);}), EventAccess(&logic->BugRock, []{return true;}), }, { //Locations diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_crater.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_crater.cpp index b05b22c48..29ab7cb41 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_crater.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_crater.cpp @@ -14,7 +14,7 @@ void RegionTable_Init_DeathMountainCrater() { areaTable[RR_DMC_UPPER_LOCAL] = Region("DMC Upper Local", "Death Mountain Crater", {RA_DEATH_MOUNTAIN_CRATER}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->GossipStoneFairy, []{return logic->GossipStoneFairy || (logic->HasExplosives() && logic->CallGossipFairyExceptSuns() && (logic->FireTimer() >= 16 || logic->Hearts() >= 3));}), + EventAccess(&logic->GossipStoneFairy, []{return logic->HasExplosives() && logic->CallGossipFairyExceptSuns() && (logic->FireTimer() >= 16 || logic->Hearts() >= 3);}), }, { //Locations LOCATION(RC_DMC_WALL_FREESTANDING_POH, logic->FireTimer() >= 16 || logic->Hearts() >= 3), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_trail.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_trail.cpp index b9fab96e0..5a0ae001c 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_trail.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/death_mountain_trail.cpp @@ -33,7 +33,7 @@ void RegionTable_Init_DeathMountainTrail() { areaTable[RR_DEATH_MOUNTAIN_SUMMIT] = Region("Death Mountain Summit", "Death Mountain", {RA_DEATH_MOUNTAIN_TRAIL}, DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairy();}), - EventAccess(&logic->BugRock, []{return logic->BugRock || logic->IsChild;}), + EventAccess(&logic->BugRock, []{return logic->IsChild;}), }, { //Locations LOCATION(RC_DMT_TRADE_BROKEN_SWORD, logic->IsAdult && logic->CanUse(RG_BROKEN_SWORD)), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/desert_colossus.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/desert_colossus.cpp index ac0869036..ea0af20c0 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/desert_colossus.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/desert_colossus.cpp @@ -7,7 +7,7 @@ void RegionTable_Init_DesertColossus() { // clang-format off areaTable[RR_DESERT_COLOSSUS] = Region("Desert Colossus", "Desert Colossus", {RA_DESERT_COLOSSUS}, DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->FairyPond, []{return logic->FairyPond || logic->CanUse(RG_SONG_OF_STORMS);}), + EventAccess(&logic->FairyPond, []{return logic->CanUse(RG_SONG_OF_STORMS);}), EventAccess(&logic->BugRock, []{return true;}), }, { //Locations diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/gerudo_valley.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/gerudo_valley.cpp index 86cc1b060..e4e43ac18 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/gerudo_valley.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/gerudo_valley.cpp @@ -7,7 +7,7 @@ void RegionTable_Init_GerudoValley() { // clang-format off areaTable[RR_GERUDO_VALLEY] = Region("Gerudo Valley", "Gerudo Valley", {RA_GERUDO_VALLEY}, DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->BugRock, []{return logic->BugRock || logic->IsChild;}), + EventAccess(&logic->BugRock, []{return logic->IsChild;}), }, { //Locations LOCATION(RC_GV_GS_SMALL_BRIDGE, logic->IsChild && logic->HookshotOrBoomerang() && logic->CanGetNightTimeGS()), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/goron_city.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/goron_city.cpp index 8081757d2..21daeaf21 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/goron_city.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/goron_city.cpp @@ -8,12 +8,12 @@ void RegionTable_Init_GoronCity() { areaTable[RR_GORON_CITY] = Region("Goron City", "Goron City", {RA_GORON_CITY}, NO_DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairyExceptSuns();}), - EventAccess(&logic->StickPot, []{return logic->StickPot || logic->IsChild;}), - EventAccess(&logic->BugRock, []{return logic->BugRock || (logic->BlastOrSmash() || logic->CanUse(RG_SILVER_GAUNTLETS));}), - EventAccess(&logic->GoronCityChildFire, []{return logic->GoronCityChildFire || (logic->IsChild && logic->CanUse(RG_DINS_FIRE));}), - EventAccess(&logic->GCWoodsWarpOpen, []{return logic->GCWoodsWarpOpen || (logic->BlastOrSmash() || logic->CanUse(RG_DINS_FIRE) || logic->CanUse(RG_FAIRY_BOW) || logic->HasItem(RG_GORONS_BRACELET) || logic->GoronCityChildFire);}), - EventAccess(&logic->GCDaruniasDoorOpenChild, []{return logic->GCDaruniasDoorOpenChild || (logic->IsChild && logic->CanUse(RG_ZELDAS_LULLABY));}), - EventAccess(&logic->StopGCRollingGoronAsAdult, []{return logic->StopGCRollingGoronAsAdult || (logic->IsAdult && (logic->HasItem(RG_GORONS_BRACELET) || logic->HasExplosives() || logic->CanUse(RG_FAIRY_BOW) || (ctx->GetTrickOption(RT_GC_LINK_GORON_DINS) && logic->CanUse(RG_DINS_FIRE))));}), + EventAccess(&logic->StickPot, []{return logic->IsChild;}), + EventAccess(&logic->BugRock, []{return logic->BlastOrSmash() || logic->CanUse(RG_SILVER_GAUNTLETS);}), + EventAccess(&logic->GoronCityChildFire, []{return logic->IsChild && logic->CanUse(RG_DINS_FIRE);}), + EventAccess(&logic->GCWoodsWarpOpen, []{return logic->BlastOrSmash() || logic->CanUse(RG_DINS_FIRE) || logic->CanUse(RG_FAIRY_BOW) || logic->HasItem(RG_GORONS_BRACELET) || logic->GoronCityChildFire;}), + EventAccess(&logic->GCDaruniasDoorOpenChild, []{return logic->IsChild && logic->CanUse(RG_ZELDAS_LULLABY);}), + EventAccess(&logic->StopGCRollingGoronAsAdult, []{return logic->IsAdult && (logic->HasItem(RG_GORONS_BRACELET) || logic->HasExplosives() || logic->CanUse(RG_FAIRY_BOW) || (ctx->GetTrickOption(RT_GC_LINK_GORON_DINS) && logic->CanUse(RG_DINS_FIRE)));}), }, { //Locations LOCATION(RC_GC_MAZE_LEFT_CHEST, logic->CanUse(RG_MEGATON_HAMMER) || logic->CanUse(RG_SILVER_GAUNTLETS) || (ctx->GetTrickOption(RT_GC_LEFTMOST) && logic->HasExplosives() && logic->CanUse(RG_HOVER_BOOTS))), @@ -58,7 +58,7 @@ void RegionTable_Init_GoronCity() { areaTable[RR_GC_WOODS_WARP] = Region("GC Woods Warp", "Goron City", {RA_GORON_CITY}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->GCWoodsWarpOpen, []{return logic->GCWoodsWarpOpen || (logic->BlastOrSmash() || logic->CanUse(RG_DINS_FIRE));}), + EventAccess(&logic->GCWoodsWarpOpen, []{return logic->BlastOrSmash() || logic->CanUse(RG_DINS_FIRE);}), }, {}, { //Exits Entrance(RR_GORON_CITY, []{return logic->CanLeaveForest() && logic->GCWoodsWarpOpen;}), @@ -67,7 +67,7 @@ void RegionTable_Init_GoronCity() { areaTable[RR_GC_DARUNIAS_CHAMBER] = Region("GC Darunias Chamber", "Goron City", {RA_GORON_CITY}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->GoronCityChildFire, []{return logic->GoronCityChildFire || (logic->IsChild && logic->CanUse(RG_STICKS));}), + EventAccess(&logic->GoronCityChildFire, []{return logic->IsChild && logic->CanUse(RG_STICKS);}), }, { //Locations LOCATION(RC_GC_DARUNIAS_JOY, logic->IsChild && logic->CanUse(RG_SARIAS_SONG)), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/graveyard.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/graveyard.cpp index 012503d9a..046b5334c 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/graveyard.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/graveyard.cpp @@ -7,7 +7,7 @@ void RegionTable_Init_Graveyard() { // clang-format off areaTable[RR_THE_GRAVEYARD] = Region("The Graveyard", "The Graveyard", {RA_THE_GRAVEYARD}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || (logic->CanUse(RG_STICKS) && logic->AtDay);}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS) && logic->AtDay;}), EventAccess(&logic->BeanPlantFairy, []{return logic->IsChild && logic->CanUse(RG_MAGIC_BEAN) && logic->CanUse(RG_SONG_OF_STORMS);}), EventAccess(&logic->BugRock, []{return true;}), }, { @@ -88,7 +88,7 @@ void RegionTable_Init_Graveyard() { areaTable[RR_GRAVEYARD_DAMPES_GRAVE] = Region("Graveyard Dampes Grave", "Windmill and Dampes Grave", {}, NO_DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->NutPot, []{return true;}), - EventAccess(&logic->DampesWindmillAccess, []{return logic->DampesWindmillAccess || (logic->IsAdult && logic->CanUse(RG_SONG_OF_TIME));}), + EventAccess(&logic->DampesWindmillAccess, []{return logic->IsAdult && logic->CanUse(RG_SONG_OF_TIME);}), }, { //Locations LOCATION(RC_GRAVEYARD_HOOKSHOT_CHEST, true), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp index 777e29050..eec9d9248 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/kakariko.cpp @@ -66,7 +66,7 @@ void RegionTable_Init_Kakariko() { Entrance(RR_KAK_WINDMILL, []{return logic->CanOpenOverworldDoor(RG_WINDMILL_KEY);}), Entrance(RR_KAK_BAZAAR, []{return logic->IsAdult && logic->AtDay && logic->CanOpenOverworldDoor(RG_KAK_BAZAAR_KEY);}), Entrance(RR_KAK_SHOOTING_GALLERY, []{return logic->IsAdult && logic->AtDay && logic->CanOpenOverworldDoor(RG_KAK_SHOOTING_GALLERY_KEY);}), - Entrance(RR_KAK_WELL, []{return logic->IsAdult || logic->DrainWell || logic->CanUse(RG_IRON_BOOTS);}), + Entrance(RR_KAK_WELL, []{return logic->IsAdult || logic->DrainWell || logic->CanUse(RG_IRON_BOOTS) || (ctx->GetTrickOption(RT_BOTTOM_OF_THE_WELL_NAVI_DIVE) && logic->IsChild && logic->HasItem(RG_BRONZE_SCALE) && logic->CanJumpslash());}), Entrance(RR_KAK_POTION_SHOP_FRONT, []{return (logic->AtDay || logic->IsChild) && logic->CanOpenOverworldDoor(RG_KAK_POTION_SHOP_KEY);}), Entrance(RR_KAK_REDEAD_GROTTO, []{return logic->CanOpenBombGrotto();}), Entrance(RR_KAK_IMPAS_LEDGE, []{return (logic->IsChild && logic->AtDay) || (logic->IsAdult && ctx->GetTrickOption(RT_VISIBLE_COLLISION));}), @@ -166,7 +166,7 @@ void RegionTable_Init_Kakariko() { areaTable[RR_KAK_WINDMILL] = Region("Kak Windmill", "Windmill and Dampes Grave", {}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->DrainWell, []{return logic->DrainWell || (logic->IsChild && logic->CanUse(RG_SONG_OF_STORMS));}), + EventAccess(&logic->DrainWell, []{return logic->IsChild && logic->CanUse(RG_SONG_OF_STORMS);}), }, { //Locations LOCATION(RC_KAK_WINDMILL_FREESTANDING_POH, logic->CanUse(RG_BOOMERANG) || logic->DampesWindmillAccess || (logic->IsAdult && ctx->GetTrickOption(RT_KAK_ADULT_WINDMILL_POH)) || (logic->IsChild && logic->CanJumpslashExceptHammer() && ctx->GetTrickOption(RT_KAK_CHILD_WINDMILL_POH))), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp index 80df2bb91..06bdcc268 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/kokiri_forest.cpp @@ -9,7 +9,7 @@ void RegionTable_Init_KokiriForest() { //Events EventAccess(&logic->BeanPlantFairy, []{return logic->IsChild && logic->CanUse(RG_MAGIC_BEAN) && logic->CanUse(RG_SONG_OF_STORMS);}), EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairyExceptSuns();}), - EventAccess(&logic->ShowedMidoSwordAndShield, []{return logic->ShowedMidoSwordAndShield || (logic->IsChild && logic->CanUse(RG_KOKIRI_SWORD) && logic->CanUse(RG_DEKU_SHIELD));}), + EventAccess(&logic->ShowedMidoSwordAndShield, []{return logic->IsChild && logic->CanUse(RG_KOKIRI_SWORD) && logic->CanUse(RG_DEKU_SHIELD);}), }, { //Locations LOCATION(RC_KF_KOKIRI_SWORD_CHEST, logic->IsChild), @@ -93,7 +93,7 @@ void RegionTable_Init_KokiriForest() { //Events EventAccess(&logic->DekuBabaSticks, []{return logic->CanGetDekuBabaSticks();}), EventAccess(&logic->DekuBabaNuts, []{return logic->CanGetDekuBabaNuts();}), - EventAccess(&logic->ShowedMidoSwordAndShield, []{return logic->ShowedMidoSwordAndShield || (logic->IsChild && logic->CanUse(RG_KOKIRI_SWORD) && logic->CanUse(RG_DEKU_SHIELD));}), + EventAccess(&logic->ShowedMidoSwordAndShield, []{return logic->IsChild && logic->CanUse(RG_KOKIRI_SWORD) && logic->CanUse(RG_DEKU_SHIELD);}), }, { //Locations LOCATION(RC_KF_DEKU_TREE_LEFT_GOSSIP_STONE_FAIRY, logic->CallGossipFairyExceptSuns()), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/lake_hylia.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/lake_hylia.cpp index 36d3ee1a3..364dc074b 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/lake_hylia.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/lake_hylia.cpp @@ -9,10 +9,10 @@ void RegionTable_Init_LakeHylia() { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairy();}), EventAccess(&logic->BeanPlantFairy, []{return logic->IsChild && logic->CanUse(RG_MAGIC_BEAN) && logic->CanUse(RG_SONG_OF_STORMS);}), - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || logic->CanUse(RG_STICKS);}), - EventAccess(&logic->BugShrub, []{return logic->BugShrub || (logic->IsChild && logic->CanCutShrubs());}), - EventAccess(&logic->ChildScarecrow, []{return logic->ChildScarecrow || (logic->IsChild && logic->HasItem(RG_FAIRY_OCARINA) && logic->OcarinaButtons() >= 2);}), - EventAccess(&logic->AdultScarecrow, []{return logic->AdultScarecrow || (logic->IsAdult && logic->HasItem(RG_FAIRY_OCARINA) && logic->OcarinaButtons() >= 2);}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS);}), + EventAccess(&logic->BugShrub, []{return logic->IsChild && logic->CanCutShrubs();}), + EventAccess(&logic->ChildScarecrow, []{return logic->IsChild && logic->HasItem(RG_FAIRY_OCARINA) && logic->OcarinaButtons() >= 2;}), + EventAccess(&logic->AdultScarecrow, []{return logic->IsAdult && logic->HasItem(RG_FAIRY_OCARINA) && logic->OcarinaButtons() >= 2;}), }, { //Locations LOCATION(RC_LH_UNDERWATER_ITEM, logic->IsChild && logic->HasItem(RG_SILVER_SCALE)), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/lon_lon_ranch.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/lon_lon_ranch.cpp index fae41664e..0d5e90c70 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/lon_lon_ranch.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/lon_lon_ranch.cpp @@ -7,8 +7,8 @@ void RegionTable_Init_LonLonRanch() { // clang-format off areaTable[RR_LON_LON_RANCH] = Region("Lon Lon Ranch", "Lon Lon Ranch", {RA_LON_LON_RANCH}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->FreedEpona, []{return logic->FreedEpona || ((logic->HasItem(RG_CHILD_WALLET) || ctx->GetOption(RSK_SKIP_EPONA_RACE)) && logic->CanUse(RG_EPONAS_SONG) && logic->IsAdult && logic->AtDay);}), - EventAccess(&logic->LinksCow, []{return logic->LinksCow || (logic->HasItem(RG_CHILD_WALLET) && logic->CanUse(RG_EPONAS_SONG) && logic->IsAdult && logic->AtDay);}), + EventAccess(&logic->FreedEpona, []{return (logic->HasItem(RG_CHILD_WALLET) || ctx->GetOption(RSK_SKIP_EPONA_RACE)) && logic->CanUse(RG_EPONAS_SONG) && logic->IsAdult && logic->AtDay;}), + EventAccess(&logic->LinksCow, []{return logic->HasItem(RG_CHILD_WALLET) && logic->CanUse(RG_EPONAS_SONG) && logic->IsAdult && logic->AtDay;}), }, { //Locations LOCATION(RC_SONG_FROM_MALON, logic->IsChild && logic->HasItem(RG_ZELDAS_LETTER) && logic->HasItem(RG_FAIRY_OCARINA) && logic->AtDay), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp index 812b33a55..56ad88df4 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/lost_woods.cpp @@ -57,14 +57,14 @@ void RegionTable_Init_LostWoods() { Entrance(RR_LW_FOREST_EXIT, []{return true;}), Entrance(RR_GC_WOODS_WARP, []{return true;}), Entrance(RR_LW_BRIDGE, []{return logic->CanLeaveForest() && ((logic->IsAdult && (CanPlantBean(RR_THE_LOST_WOODS) || ctx->GetTrickOption(RT_LW_BRIDGE))) || logic->CanUse(RG_HOVER_BOOTS) || logic->CanUse(RG_LONGSHOT));}), - Entrance(RR_ZORAS_RIVER, []{return logic->CanLeaveForest() && (logic->HasItem(RG_SILVER_SCALE) || logic->CanUse(RG_IRON_BOOTS));}), + Entrance(RR_ZORAS_RIVER, []{return logic->CanLeaveForest() && (logic->HasItem(RG_SILVER_SCALE) || logic->CanUse(RG_IRON_BOOTS) || (ctx->GetTrickOption(RT_BOTTOM_OF_THE_WELL_NAVI_DIVE) && logic->IsChild && logic->HasItem(RG_BRONZE_SCALE) && logic->CanJumpslash()));}), Entrance(RR_LW_BEYOND_MIDO, []{return logic->IsChild || logic->CanUse(RG_SARIAS_SONG) || ctx->GetTrickOption(RT_LW_MIDO_BACKFLIP);}), Entrance(RR_LW_NEAR_SHORTCUTS_GROTTO, []{return Here(RR_THE_LOST_WOODS, []{return logic->BlastOrSmash();});}), }); areaTable[RR_LW_BEYOND_MIDO] = Region("LW Beyond Mido", "Lost Woods", {RA_THE_LOST_WOODS}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || logic->CanUse(RG_STICKS);}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS);}), }, { //Locations LOCATION(RC_LW_DEKU_SCRUB_NEAR_DEKU_THEATER_RIGHT, logic->IsChild && logic->CanStunDeku()), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp index 0314bfde0..dc6058832 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/market.cpp @@ -54,7 +54,7 @@ void RegionTable_Init_Market() { EventAccess(&logic->CanEmptyBigPoes, []{return logic->IsAdult;}), }, { //Locations - LOCATION(RC_MARKET_10_BIG_POES, logic->IsAdult && (logic->BigPoeKill || logic->BigPoes > ctx->GetOption(RSK_BIG_POE_COUNT).Get())), + LOCATION(RC_MARKET_10_BIG_POES, logic->IsAdult && (logic->BigPoeKill || logic->BigPoes >= ctx->GetOption(RSK_BIG_POE_COUNT).Get())), LOCATION(RC_MARKET_GS_GUARD_HOUSE, logic->IsChild), LOCATION(RC_MK_GUARD_HOUSE_CHILD_POT_1, logic->IsChild && logic->CanBreakPots()), LOCATION(RC_MK_GUARD_HOUSE_CHILD_POT_2, logic->IsChild && logic->CanBreakPots()), @@ -138,8 +138,8 @@ void RegionTable_Init_Market() { areaTable[RR_MARKET_MASK_SHOP] = Region("Market Mask Shop", "Market Mask Shop", {}, NO_DAY_NIGHT_CYCLE, { //Events - EventAccess(&logic->SkullMask, []{return logic->SkullMask || (logic->HasItem(RG_ZELDAS_LETTER) && (ctx->GetOption(RSK_COMPLETE_MASK_QUEST) || ChildCanAccess(RR_KAKARIKO_VILLAGE)));}), //RANDOTODO Complete mask quest does not need this location, so should be tied to link's pocket - EventAccess(&logic->MaskOfTruth, []{return logic->MaskOfTruth || (logic->SkullMask && (ctx->GetOption(RSK_COMPLETE_MASK_QUEST) || (ChildCanAccess(RR_THE_LOST_WOODS) && logic->CanUse(RG_SARIAS_SONG) && RegionTable(RR_THE_GRAVEYARD)->childDay && ChildCanAccess(RR_HYRULE_FIELD) && logic->StoneCount() == 3)));}), + EventAccess(&logic->SkullMask, []{return logic->HasItem(RG_ZELDAS_LETTER) && (ctx->GetOption(RSK_COMPLETE_MASK_QUEST) || ChildCanAccess(RR_KAKARIKO_VILLAGE));}), //RANDOTODO Complete mask quest does not need this location, so should be tied to link's pocket + EventAccess(&logic->MaskOfTruth, []{return logic->SkullMask && (ctx->GetOption(RSK_COMPLETE_MASK_QUEST) || (ChildCanAccess(RR_THE_LOST_WOODS) && logic->CanUse(RG_SARIAS_SONG) && RegionTable(RR_THE_GRAVEYARD)->childDay && ChildCanAccess(RR_HYRULE_FIELD) && logic->StoneCount() == 3));}), }, { //Locations LOCATION(RC_MASK_SHOP_HINT, true), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_domain.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_domain.cpp index 3bee82b26..2e75be23a 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_domain.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_domain.cpp @@ -9,10 +9,10 @@ void RegionTable_Init_ZorasDomain() { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairyExceptSuns();}), EventAccess(&logic->NutPot, []{return true;}), - EventAccess(&logic->StickPot, []{return logic->StickPot || logic->IsChild;}), - EventAccess(&logic->FishGroup, []{return logic->FishGroup || logic->IsChild;}), - EventAccess(&logic->KingZoraThawed, []{return logic->KingZoraThawed || (logic->IsAdult && logic->BlueFire());}), - EventAccess(&logic->DeliverLetter, []{return logic->DeliverLetter || (logic->CanUse(RG_RUTOS_LETTER) && logic->IsChild && ctx->GetOption(RSK_ZORAS_FOUNTAIN).IsNot(RO_ZF_OPEN));}), + EventAccess(&logic->StickPot, []{return logic->IsChild;}), + EventAccess(&logic->FishGroup, []{return logic->IsChild;}), + EventAccess(&logic->KingZoraThawed, []{return logic->IsAdult && logic->BlueFire();}), + EventAccess(&logic->DeliverLetter, []{return logic->CanUse(RG_RUTOS_LETTER) && logic->IsChild && ctx->GetOption(RSK_ZORAS_FOUNTAIN).IsNot(RO_ZF_OPEN);}), }, { //Locations LOCATION(RC_ZD_DIVING_MINIGAME, logic->HasItem(RG_BRONZE_SCALE) && logic->HasItem(RG_CHILD_WALLET) && logic->IsChild), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_fountain.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_fountain.cpp index 3ac0921a3..9ab099625 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_fountain.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_fountain.cpp @@ -8,7 +8,7 @@ void RegionTable_Init_ZorasFountain() { areaTable[RR_ZORAS_FOUNTAIN] = Region("Zoras Fountain", "Zoras Fountain", {RA_ZORAS_FOUNTAIN}, NO_DAY_NIGHT_CYCLE, { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairyExceptSuns();}), - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || (logic->CanUse(RG_STICKS) && logic->AtDay);}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS) && logic->AtDay;}), }, { //Locations LOCATION(RC_ZF_GS_TREE, logic->IsChild), diff --git a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_river.cpp b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_river.cpp index 3fbf8bdbd..212c61c70 100644 --- a/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_river.cpp +++ b/soh/soh/Enhancements/randomizer/location_access/overworld/zoras_river.cpp @@ -30,8 +30,8 @@ void RegionTable_Init_ZoraRiver() { //Events EventAccess(&logic->GossipStoneFairy, []{return logic->CallGossipFairy();}), EventAccess(&logic->BeanPlantFairy, []{return logic->IsChild && logic->CanUse(RG_MAGIC_BEAN) && logic->CanUse(RG_SONG_OF_STORMS);}), - EventAccess(&logic->ButterflyFairy, []{return logic->ButterflyFairy || logic->CanUse(RG_STICKS);}), - EventAccess(&logic->BugShrub, []{return logic->BugShrub || logic->CanCutShrubs();}), + EventAccess(&logic->ButterflyFairy, []{return logic->CanUse(RG_STICKS);}), + EventAccess(&logic->BugShrub, []{return logic->CanCutShrubs();}), }, { //Locations LOCATION(RC_ZR_MAGIC_BEAN_SALESMAN, logic->HasItem(RG_CHILD_WALLET) && logic->IsChild), diff --git a/soh/soh/Enhancements/randomizer/location_list.cpp b/soh/soh/Enhancements/randomizer/location_list.cpp index d1785ba07..2812b0135 100644 --- a/soh/soh/Enhancements/randomizer/location_list.cpp +++ b/soh/soh/Enhancements/randomizer/location_list.cpp @@ -842,40 +842,6 @@ void Rando::StaticData::InitLocationTable() { locationTable[RC_SONG_FROM_OCARINA_OF_TIME] = Location::Base(RC_SONG_FROM_OCARINA_OF_TIME, RCQUEST_BOTH, RCTYPE_SONG_LOCATION, ACTOR_ID_MAX, SCENE_HYRULE_FIELD, 0x00, "Song from Ocarina of Time", "Song from Ocarina of Time", RHT_SONG_FROM_OCARINA_OF_TIME, RG_SONG_OF_TIME, SpoilerCollectionCheck::EventChkInf(EVENTCHKINF_LEARNED_SONG_OF_TIME), true); locationTable[RC_SONG_FROM_WINDMILL] = Location::Base(RC_SONG_FROM_WINDMILL, RCQUEST_BOTH, RCTYPE_SONG_LOCATION, RCAREA_KAKARIKO_VILLAGE, ACTOR_ID_MAX, SCENE_WINDMILL_AND_DAMPES_GRAVE, 0x00, "Song from Windmill", "Song from Windmill", RHT_SONG_FROM_WINDMILL, RG_SONG_OF_STORMS, SpoilerCollectionCheck::EventChkInf(EVENTCHKINF_LEARNED_SONG_OF_STORMS), true); - //Beehives - locationTable[RC_KF_STORMS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_KF_STORMS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KOKIRI_FOREST, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x2C), "Storms Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KF_STORMS_GROTTO_LEFT)); - locationTable[RC_KF_STORMS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_KF_STORMS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KOKIRI_FOREST, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x2C), "Storms Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KF_STORMS_GROTTO_RIGHT)); - locationTable[RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x14), "Tunnel Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_NEAR_SHORTCUTS_GROTTO_LEFT)); - locationTable[RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_LW_NEAR_SHORTCUTS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x14), "Tunnel Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_NEAR_SHORTCUTS_GROTTO_RIGHT)); - locationTable[RC_LW_DEKU_SCRUB_GROTTO_BEEHIVE] = Location::Base(RC_LW_DEKU_SCRUB_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LOST_WOODS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(747, 0xF5), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LW_DEKU_SCRUB_GROTTO)); - locationTable[RC_SFM_STORMS_GROTTO_BEEHIVE] = Location::Base(RC_SFM_STORMS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_SACRED_FOREST_MEADOW, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xEE), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_SFM_STORMS_GROTTO)); - locationTable[RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x00), "Near Market Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_NEAR_MARKET_GROTTO_LEFT)); - locationTable[RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_NEAR_MARKET_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x00), "Near Market Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_NEAR_MARKET_GROTTO_RIGHT)); - locationTable[RC_HF_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x03), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_OPEN_GROTTO_LEFT)); - locationTable[RC_HF_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x03), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_OPEN_GROTTO_RIGHT)); - locationTable[RC_HF_SOUTHEAST_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_HF_SOUTHEAST_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x22), "Southeast Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_SOUTHEAST_GROTTO_LEFT)); - locationTable[RC_HF_SOUTHEAST_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_HF_SOUTHEAST_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x22), "Southeast Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_SOUTHEAST_GROTTO_RIGHT)); - locationTable[RC_HF_INSIDE_FENCE_GROTTO_BEEHIVE] = Location::Base(RC_HF_INSIDE_FENCE_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_HYRULE_FIELD, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(1410, 0xE6), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_LONELY_SCRUB_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_HF_INSIDE_FENCE_GROTTO)); - locationTable[RC_LLR_GROTTO_BEEHIVE] = Location::Base(RC_LLR_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LON_LON_RANCH, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xFC), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LLR_GROTTO)); - locationTable[RC_KAK_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_KAK_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KAKARIKO_VILLAGE, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x28), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KAK_OPEN_GROTTO_LEFT)); - locationTable[RC_KAK_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_KAK_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_KAKARIKO_VILLAGE, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x28), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_KAK_OPEN_GROTTO_RIGHT)); - locationTable[RC_DMT_COW_GROTTO_BEEHIVE] = Location::Base(RC_DMT_COW_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2617, 0xF8), "Cow Grotto Beehive", RHT_BEEHIVE_COW_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_COW_GROTTO)); - locationTable[RC_DMT_STORMS_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_DMT_STORMS_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x57), "Storms Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_STORMS_GROTTO_LEFT)); - locationTable[RC_DMT_STORMS_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_DMT_STORMS_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_TRAIL, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x57), "Storms Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMT_STORMS_GROTTO_RIGHT)); - locationTable[RC_GC_GROTTO_BEEHIVE] = Location::Base(RC_GC_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_GORON_CITY, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xFB), "Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_GC_GROTTO)); - locationTable[RC_DMC_UPPER_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_DMC_UPPER_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x7A), "Upper Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_UPPER_GROTTO_LEFT)); - locationTable[RC_DMC_UPPER_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_DMC_UPPER_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x7A), "Upper Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_UPPER_GROTTO_RIGHT)); - locationTable[RC_DMC_HAMMER_GROTTO_BEEHIVE] = Location::Base(RC_DMC_HAMMER_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DEATH_MOUNTAIN_CRATER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xF9), "Hammer Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_DMC_HAMMER_GROTTO)); - locationTable[RC_ZR_OPEN_GROTTO_BEEHIVE_LEFT] = Location::Base(RC_ZR_OPEN_GROTTO_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(-144, 0x29), "Open Grotto Beehive Left", RHT_BEEHIVE_CHEST_GROTTO, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_OPEN_GROTTO_LEFT)); - locationTable[RC_ZR_OPEN_GROTTO_BEEHIVE_RIGHT] = Location::Base(RC_ZR_OPEN_GROTTO_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(121, 0x29), "Open Grotto Beehive Right", RHT_BEEHIVE_CHEST_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_OPEN_GROTTO_RIGHT)); - locationTable[RC_ZR_STORMS_GROTTO_BEEHIVE] = Location::Base(RC_ZR_STORMS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_ZORAS_RIVER, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xEB), "Storms Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZR_STORMS_GROTTO)); - locationTable[RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_LEFT] = Location::Base(RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_LEFT, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(382, 0x00), "In Front of King Zora Beehive Left", RHT_BEEHIVE_IN_FRONT_OF_KING_ZORA, RG_BLUE_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_IN_FRONT_OF_KING_ZORA_LEFT)); - locationTable[RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_RIGHT] = Location::Base(RC_ZD_IN_FRONT_OF_KING_ZORA_BEEHIVE_RIGHT, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(948, 0x00), "In Front of King Zora Beehive Right", RHT_BEEHIVE_IN_FRONT_OF_KING_ZORA, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_IN_FRONT_OF_KING_ZORA_RIGHT)); - locationTable[RC_ZD_BEHIND_KING_ZORA_BEEHIVE] = Location::Base(RC_ZD_BEHIND_KING_ZORA_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, ACTOR_OBJ_COMB, SCENE_ZORAS_DOMAIN, TWO_ACTOR_PARAMS(701, 0x00), "Behind King Zora Beehive", RHT_BEEHIVE_BEHIND_KING_ZORA, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_ZD_BEHIND_KING_ZORA)); - locationTable[RC_LH_GROTTO_BEEHIVE] = Location::Base(RC_LH_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_LAKE_HYLIA, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(5144, 0xEF), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_TRIO_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_LH_GROTTO)); - locationTable[RC_GV_DEKU_SCRUB_GROTTO_BEEHIVE] = Location::Base(RC_GV_DEKU_SCRUB_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_GERUDO_VALLEY, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xF0), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_GV_DEKU_SCRUB_GROTTO)); - locationTable[RC_COLOSSUS_GROTTO_BEEHIVE] = Location::Base(RC_COLOSSUS_GROTTO_BEEHIVE, RCQUEST_BOTH, RCTYPE_BEEHIVE, RCAREA_DESERT_COLOSSUS, ACTOR_OBJ_COMB, SCENE_GROTTOS, TWO_ACTOR_PARAMS(2262, 0xFD), "Deku Scrub Grotto Beehive", RHT_BEEHIVE_SCRUB_PAIR_GROTTO, RG_RED_RUPEE, SpoilerCollectionCheck::RandomizerInf(RAND_INF_BEEHIVE_COLOSSUS_GROTTO)); - /*------------------------------- --- SHOPS --- 8 6 2 4 diff --git a/soh/soh/Enhancements/randomizer/logic.cpp b/soh/soh/Enhancements/randomizer/logic.cpp index 9ba8b6c14..ca52009ac 100644 --- a/soh/soh/Enhancements/randomizer/logic.cpp +++ b/soh/soh/Enhancements/randomizer/logic.cpp @@ -1011,26 +1011,24 @@ Logic::Logic() { uint8_t Logic::BottleCount() { uint8_t count = 0; - if (CouldEmptyBigPoes && !AreCheckingBigPoes) { - for (int i = SLOT_BOTTLE_1; i <= SLOT_BOTTLE_4; i++) { - uint8_t item = GetSaveContext()->inventory.items[i]; - switch (item) { - case ITEM_LETTER_RUTO: - if (DeliverLetter) { - count++; - } - break; - case ITEM_BIG_POE: - if (CanEmptyBigPoes) { - count++; - } - break; - case ITEM_NONE: - break; - default: + for (int i = SLOT_BOTTLE_1; i <= SLOT_BOTTLE_4; i++) { + uint8_t item = GetSaveContext()->inventory.items[i]; + switch (item) { + case ITEM_LETTER_RUTO: + if (DeliverLetter) { count++; - break; - } + } + break; + case ITEM_BIG_POE: + if (CanEmptyBigPoes) { + count++; + } + break; + case ITEM_NONE: + break; + default: + count++; + break; } } return count; @@ -1387,6 +1385,7 @@ bool Logic::SmallKeys(RandomizerRegion dungeon, uint8_t requiredAmountGlitchless static_cast(GlitchDifficulty::INTERMEDIATE) || GetDifficultyValueFromString(GlitchHover) >= static_cast(GlitchDifficulty::INTERMEDIATE))) { return FireTempleKeys >= requiredAmountGlitched; }*/ + // If the Fire Temple loop lock is removed, Small key Count is set to 1 before starting return GetSmallKeyCount(SCENE_FIRE_TEMPLE) >= requiredAmountGlitchless; case RR_WATER_TEMPLE: @@ -1814,7 +1813,7 @@ void Logic::ApplyItemEffect(Item& item, bool state) { if (randoGet == RG_BOTTLE_WITH_BIG_POE) { BigPoes++; } - mSaveContext->inventory.items[slot] = itemId; + mSaveContext->inventory.items[slot] = static_cast(itemId); } break; case RG_RUTOS_LETTER: SetRandoInf(RAND_INF_OBTAINED_RUTOS_LETTER, state); @@ -2306,7 +2305,7 @@ void Logic::SetEventChkInf(int32_t flag, bool state) { } uint8_t Logic::GetGSCount() { - return mSaveContext->inventory.gsTokens; + return static_cast(mSaveContext->inventory.gsTokens); } uint8_t Logic::GetAmmo(uint32_t item) { @@ -2334,9 +2333,9 @@ void Logic::Reset() { StartPerformanceTimer(PT_LOGIC_RESET); memset(inLogic, false, sizeof(inLogic)); // Settings-dependent variables - IsKeysanity = ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) || - ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) || - ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE); + IsFireLoopLocked = ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANYWHERE) || + ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_OVERWORLD) || + ctx->GetOption(RSK_KEYSANITY).Is(RO_DUNGEON_ITEM_LOC_ANY_DUNGEON); // AmmoCanDrop = /*AmmoDrops.IsNot(AMMODROPS_NONE)*/ false; TODO: AmmoDrop setting @@ -2398,7 +2397,7 @@ void Logic::Reset() { // If not keysanity, start with 1 logical key to account for automatically unlocking the basement door in vanilla // FiT - if (!IsKeysanity && ctx->GetDungeon(Rando::FIRE_TEMPLE)->IsVanilla()) { + if (!IsFireLoopLocked && ctx->GetDungeon(Rando::FIRE_TEMPLE)->IsVanilla()) { SetSmallKeyCount(SCENE_FIRE_TEMPLE, 1); } @@ -2406,7 +2405,6 @@ void Logic::Reset() { Bottles = 0; NumBottles = 0; CanEmptyBigPoes = false; - CouldEmptyBigPoes = false; // Drops and Bottle Contents Access NutPot = false; @@ -2496,6 +2494,7 @@ void Logic::Reset() { ForestOpenBossCorridor = false; ShadowTrialFirstChest = false; MQGTGMazeSwitch = false; + MQGTGRightSideSwitch = false; GTGPlatformSilverRupees = false; MQJabuHolesRoomDoor = false; JabuWestTentacle = false; diff --git a/soh/soh/Enhancements/randomizer/logic.h b/soh/soh/Enhancements/randomizer/logic.h index 4f966f5de..19d7e173e 100644 --- a/soh/soh/Enhancements/randomizer/logic.h +++ b/soh/soh/Enhancements/randomizer/logic.h @@ -59,19 +59,13 @@ class Logic { bool LightTrialClear = false; // Logical keysanity - bool IsKeysanity = false; + bool IsFireLoopLocked = false; // Bottle Count uint8_t Bottles = 0; uint8_t NumBottles = 0; // this event covers if the player can currently empty big poes in logic bool CanEmptyBigPoes = false; - // this event covers if the player could, if they filled their bottle with big poes in field, empty them at the poe - // merchant. Works in tandem with the big poes safety check during entrance validation - bool CouldEmptyBigPoes = false; - // this check is used to tell logic that we are checking big poes accessibility in logic, to ensure it's not - // bottle-locked. - bool AreCheckingBigPoes = false; // Drops and Bottle Contents Access bool NutPot = false; diff --git a/soh/soh/Enhancements/randomizer/option.cpp b/soh/soh/Enhancements/randomizer/option.cpp index bec719d4b..f027fd066 100644 --- a/soh/soh/Enhancements/randomizer/option.cpp +++ b/soh/soh/Enhancements/randomizer/option.cpp @@ -83,11 +83,11 @@ void Option::RestoreDelayedOption() { contextSelection = delayedSelection; } -void Option::SetContextIndex(size_t idx) { +void Option::SetContextIndex(uint8_t idx) { // TODO: Set to Context's OptionValue array. contextSelection = idx; - if (contextSelection > options.size() - 1) { - contextSelection = options.size() - 1; + if (contextSelection > static_cast(options.size() - 1)) { + contextSelection = static_cast(options.size() - 1); } } @@ -105,7 +105,7 @@ bool Option::IsHidden() const { void Option::ChangeOptions(std::vector opts) { if (GetOptionIndex() >= opts.size()) { - CVarSetInteger(cvarName.c_str(), opts.size() - 1); + CVarSetInteger(cvarName.c_str(), static_cast(opts.size() - 1)); } options = std::move(opts); } @@ -206,8 +206,8 @@ bool Option::RenderCheckbox() { bool Option::RenderCombobox() { bool changed = false; uint8_t selected = CVarGetInteger(cvarName.c_str(), defaultOption); - if (selected >= options.size()) { - selected = options.size(); + if (selected >= static_cast(options.size())) { + selected = static_cast(options.size()); CVarSetInteger(cvarName.c_str(), selected); changed = true; Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); @@ -231,13 +231,13 @@ bool Option::RenderSlider() { bool changed = false; int val = CVarGetInteger(cvarName.c_str(), defaultOption); if (val > options.size() - 1) { - val = options.size() - 1; + val = static_cast(options.size()) - 1; changed = true; } UIWidgets::IntSliderOptions widgetOptions = UIWidgets::IntSliderOptions() .Color(THEME_COLOR) .Min(0) - .Max(options.size() - 1) + .Max(static_cast(options.size() - 1)) .Tooltip(description.c_str()) .Format(options[val].c_str()) .DefaultValue(defaultOption); diff --git a/soh/soh/Enhancements/randomizer/option.h b/soh/soh/Enhancements/randomizer/option.h index 507729498..55a06ed86 100644 --- a/soh/soh/Enhancements/randomizer/option.h +++ b/soh/soh/Enhancements/randomizer/option.h @@ -241,11 +241,11 @@ class Option { void RestoreDelayedOption(); /** - * @brief Set the rando context index for this Option. Also calls `SetVariable()`. + * @brief Set the rando context index for this Option. * * @param idx the index to set as the selected index. */ - void SetContextIndex(size_t idx); + void SetContextIndex(uint8_t idx); /** * @brief Hides this Option in the menu. (Not currently being used afaik, we prefer to diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 354b171aa..f7279ff80 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -26,6 +26,7 @@ #include #include #include "draw.h" +#include "soh/OTRGlobals.h" #include "soh/SohGui/UIWidgets.hpp" #include "static_data.h" #include "soh/Enhancements/game-interactor/GameInteractor.h" @@ -65,7 +66,7 @@ const std::string Randomizer::NaviRandoMessageTableID = "RandomizerNavi"; const std::string Randomizer::IceTrapRandoMessageTableID = "RandomizerIceTrap"; const std::string Randomizer::randoMiscHintsTableID = "RandomizerMiscHints"; -static const char* englishRupeeNames[190] = { +static const char* englishRupeeNames[188] = { "[P]", "Bad RNG Rolls", "Baht", @@ -111,8 +112,6 @@ static const char* englishRupeeNames[190] = { "Dimes", "Dinars", "DNA", - "Doge", - "Dogecoin", "Doll Hairs", "Dollars", "Dollarydoos", @@ -258,25 +257,25 @@ static const char* englishRupeeNames[190] = { "Zorkmids", }; -static const char* germanRupeeNames[80] = { - "Baht", "Bananen", "Bitcoin", "Bonbons", "Bratwürste", "Brause UFOs", "Brötchen", "Cent", - "Diamanten", "Dinar", "Diridari", "Dogecoin", "Dollar", "Draken", "ECU", "Elexit", - "Erz", "Erzbrocken", "Euro", "EXP", "Forint", "Franken", "Freunde", "Gil", - "Gold", "Groschen", "Gulden", "Gummibären", "Heller", "Juwelen", "Karolin", "Kartoffeln", - "Kies", "Knete", "Knochen", "Kohle", "Kraniche", "Kreuzer", "Kronen", "Kronkorken", - "Kröten", "Lira", "Mark", "Mäuse", "Monde", "Moorhühner", "Moos", "Münzen", - "Naira", "Penunze", "Pesa", "Pfandflaschen", "Pfennig", "Pfund", "Pilze", "Plastiks", - "Pokédollar", "Radieschen", "Rand", "Rappen", "Real", "Rial", "Riyal", "Rubine", - "Rupien", "Saphire", "Schilling", "Seelen", "Septime", "Smaragde", "Steine", "Sterne", - "Sternis", "Tael", "Taler", "Wagenchips", "Won", "Yen", "Yuan", "Zenny", +static const char* germanRupeeNames[79] = { + "Baht", "Bananen", "Bitcoin", "Bonbons", "Bratwürste", "Brause UFOs", "Brötchen", "Cent", + "Diamanten", "Dinar", "Diridari", "Dollar", "Draken", "ECU", "Elexit", "Erz", + "Erzbrocken", "Euro", "EXP", "Forint", "Franken", "Freunde", "Gil", "Gold", + "Groschen", "Gulden", "Gummibären", "Heller", "Juwelen", "Karolin", "Kartoffeln", "Kies", + "Knete", "Knochen", "Kohle", "Kraniche", "Kreuzer", "Kronen", "Kronkorken", "Kröten", + "Lira", "Mark", "Mäuse", "Monde", "Moorhühner", "Moos", "Münzen", "Naira", + "Penunze", "Pesa", "Pfandflaschen", "Pfennig", "Pfund", "Pilze", "Plastiks", "Pokédollar", + "Radieschen", "Rand", "Rappen", "Real", "Rial", "Riyal", "Rubine", "Rupien", + "Saphire", "Schilling", "Seelen", "Septime", "Smaragde", "Steine", "Sterne", "Sternis", + "Tael", "Taler", "Wagenchips", "Won", "Yen", "Yuan", "Zenny", }; -static const char* frenchRupeeNames[40] = { - "Anneaux", "Baguettes", "Balles", "Bananes", "Bitcoin", "Blés", "Bling", "Capsules", - "Centimes", "Champignons", "Clochettes", "Crédits", "Croissants", "Diamants", "Dogecoin", "Dollars", - "Émeraudes", "Éthers", "Étoiles", "Euros", "Florens", "Francs", "Galds", "Gils", - "Grouses", "Halos", "Joyaux", "Lunes", "Mailles", "Munnies", "Orbes", "Orens", - "Pépètes", "Pièces", "Plastyks", "Pokédollars", "Pokémon", "Radis", "Rubis", "Zennies", +static const char* frenchRupeeNames[39] = { + "Anneaux", "Baguettes", "Balles", "Bananes", "Bitcoin", "Blés", "Bling", "Capsules", + "Centimes", "Champignons", "Clochettes", "Crédits", "Croissants", "Diamants", "Dollars", "Émeraudes", + "Éthers", "Étoiles", "Euros", "Florens", "Francs", "Galds", "Gils", "Grouses", + "Halos", "Joyaux", "Lunes", "Mailles", "Munnies", "Orbes", "Orens", "Pépètes", + "Pièces", "Plastyks", "Pokédollars", "Pokémon", "Radis", "Rubis", "Zennies", }; Randomizer::Randomizer() { @@ -357,9 +356,12 @@ std::unordered_map getItemIdToItemId = { { GI_CLAIM_CHECK, ITEM_CLAIM_CHECK }, }; +#ifdef _MSC_VER #pragma optimize("", off) +#else #pragma GCC push_options #pragma GCC optimize("O0") +#endif bool Randomizer::SpoilerFileExists(const char* spoilerFileName) { if (strcmp(spoilerFileName, "") != 0) { std::ifstream spoilerFileStream(SohUtils::Sanitize(spoilerFileName)); @@ -372,8 +374,11 @@ bool Randomizer::SpoilerFileExists(const char* spoilerFileName) { return false; } -#pragma GCC pop_options +#ifdef _MSC_VER #pragma optimize("", on) +#else +#pragma GCC pop_options +#endif void Randomizer::LoadHintMessages() { auto ctx = Rando::Context::GetInstance(); @@ -3506,9 +3511,9 @@ CrateIdentity Randomizer::IdentifyCrate(s32 sceneNum, s32 posX, s32 posZ) { crateSceneNum = SCENE_MARKET_DAY; } else if (sceneNum == SCENE_GERUDOS_FORTRESS && gPlayState->linkAgeOnLoad == 1 && posX == 310) { if (posZ == -1830) { - posZ = -1842.0f; + posZ = -1842; } else if (posZ == -1770) { - posZ = -1782.0f; + posZ = -1782; } } @@ -3639,14 +3644,8 @@ bool GenerateRandomizer(std::string seed /*= ""*/) { return false; } -static const std::unordered_map randomizerPresetList = { - { RANDOMIZER_PRESET_DEFAULT, "Default" }, - { RANDOMIZER_PRESET_BEGINNER, "Beginner" }, - { RANDOMIZER_PRESET_STANDARD, "Standard" }, - { RANDOMIZER_PRESET_ADVANCED, "Advanced" }, - { RANDOMIZER_PRESET_HELL_MODE, "Hell Mode" } -}; -static int32_t randomizerPresetSelected = RANDOMIZER_PRESET_DEFAULT; +static bool locationsTabOpen = false; +static bool tricksTabOpen = false; void RandomizerSettingsWindow::DrawElement() { auto ctx = Rando::Context::GetInstance(); @@ -3654,53 +3653,12 @@ void RandomizerSettingsWindow::DrawElement() { generated = 0; randoThread.join(); } - static bool locationsTabOpen = false; - static bool tricksTabOpen = false; - bool disableEditingRandoSettings = - CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0) || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0); - ImGui::BeginDisabled(CVarGetInteger(CVAR_SETTING("DisableChanges"), 0) || disableEditingRandoSettings); - const PresetTypeDefinition presetTypeDef = presetTypes.at(PRESET_TYPE_RANDOMIZER); - std::string comboboxTooltip = ""; - for (auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter) { - if (iter->first != 0) - comboboxTooltip += "\n\n"; - comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description); - } - const std::string presetTypeCvar = CVAR_GENERAL("SelectedPresets.") + std::to_string(PRESET_TYPE_RANDOMIZER); - randomizerPresetSelected = CVarGetInteger(presetTypeCvar.c_str(), RANDOMIZER_PRESET_DEFAULT); + bool generating = CVarGetInteger(CVAR_GENERAL("RandoGenerating"), 0); + bool disableEditingRandoSettings = generating || CVarGetInteger(CVAR_GENERAL("OnFileSelectNameEntry"), 0); - if (UIWidgets::Combobox("Randomizer Presets", &randomizerPresetSelected, randomizerPresetList, - UIWidgets::ComboboxOptions() - .DefaultIndex(RANDOMIZER_PRESET_DEFAULT) - .Tooltip(comboboxTooltip.c_str()) - .Color(THEME_COLOR))) { - CVarSetInteger(presetTypeCvar.c_str(), randomizerPresetSelected); - } - ImGui::SameLine(); - ImGui::SetCursorPosY(ImGui::GetCursorPos().y + 35.f); - if (UIWidgets::Button( - "Apply Preset##Randomizer", - UIWidgets::ButtonOptions().Color(THEME_COLOR).Size(UIWidgets::Sizes::Inline).Padding(ImVec2(10.f, 6.f)))) { - if (randomizerPresetSelected >= presetTypeDef.presets.size()) { - randomizerPresetSelected = 0; - } - const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(randomizerPresetSelected); - for (const char* block : presetTypeDef.blocksToClear) { - CVarClearBlock(block); - } - if (randomizerPresetSelected != 0) { - applyPreset(selectedPresetDef.entries); - } - CVarSetInteger(presetTypeCvar.c_str(), randomizerPresetSelected); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); - mSettings->UpdateOptionProperties(); - // force excluded location list and trick list update if tab is open. - locationsTabOpen = false; - tricksTabOpen = false; - } - ImGui::EndDisabled(); + DrawPresetSelector({ PRESET_SECTION_RANDOMIZER }, "Randomizer", generating); - UIWidgets::Spacer(0); + // UIWidgets::Spacer(0); UIWidgets::CVarCheckbox("Manual seed entry", CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), UIWidgets::CheckboxOptions().Color(THEME_COLOR)); if (CVarGetInteger(CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), 0)) { @@ -3734,13 +3692,15 @@ void RandomizerSettingsWindow::DrawElement() { } UIWidgets::Spacer(0); - ImGui::BeginDisabled((gSaveContext.gameMode != GAMEMODE_FILE_SELECT) || GameInteractor::IsSaveLoaded()); - if (UIWidgets::Button("Generate Randomizer", - UIWidgets::ButtonOptions().Size(ImVec2(250.f, 0.f)).Color(THEME_COLOR))) { + UIWidgets::ButtonOptions options = UIWidgets::ButtonOptions().Size(ImVec2(250.f, 0.f)).Color(THEME_COLOR); + options.Disabled((gSaveContext.gameMode != GAMEMODE_FILE_SELECT) || GameInteractor::IsSaveLoaded()); + if (options.disabled) { + options.DisabledTooltip("Must be on File Select to generate a randomizer seed."); + } + if (UIWidgets::Button("Generate Randomizer", options)) { ctx->SetSpoilerLoaded(false); GenerateRandomizer(CVarGetInteger(CVAR_RANDOMIZER_SETTING("ManualSeedEntry"), 0) ? seedString : ""); } - ImGui::EndDisabled(); ImGui::SameLine(); if (!CVarGetInteger(CVAR_RANDOMIZER_SETTING("DontGenerateSpoiler"), 0)) { @@ -3748,10 +3708,6 @@ void RandomizerSettingsWindow::DrawElement() { ImGui::Text("Spoiler File: %s", spoilerfilepath.c_str()); } - // RANDOTODO settings presets - // std::string presetfilepath = CVarGetString(CVAR_RANDOMIZER_SETTING("LoadedPreset"), ""); - // ImGui::Text("Settings File: %s", presetfilepath.c_str()); - UIWidgets::Separator(true, true, 0.f, 0.f); ImGuiWindow* window = ImGui::GetCurrentWindow(); @@ -4100,7 +4056,7 @@ void RandomizerSettingsWindow::DrawElement() { Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); } } - if (ImGui::BeginTable("trickTags", showTag.size(), + if (ImGui::BeginTable("trickTags", static_cast(showTag.size()), ImGuiTableFlags_Resizable | ImGuiTableFlags_NoSavedSettings | ImGuiTableFlags_Borders)) { for (auto [rtTag, isShown] : showTag) { @@ -4361,9 +4317,17 @@ void RandomizerSettingsWindow::DrawElement() { UIWidgets::PopStyleTabs(); } +void RandomizerSettingsWindow::SetNeedsUpdate() { + mNeedsUpdate = true; +} + void RandomizerSettingsWindow::UpdateElement() { if (mNeedsUpdate) { + RandomizerCheckObjects::UpdateImGuiVisibility(); mSettings->UpdateOptionProperties(); + locationsTabOpen = false; + tricksTabOpen = false; + mNeedsUpdate = false; } } @@ -4523,6 +4487,9 @@ CustomMessage Randomizer::GetMapGetItemMessageWithHint(GetItemEntry itemEntry) { messageEntry.Replace("[[typeHint]]", Rando::StaticData::hintTextTable[RHT_DUNGEON_ORDINARY].GetHintMessage()); } + // BUG: the icon is not in the message yet so are not accounted for, so overflows are possible + messageEntry.AutoFormat(); + return messageEntry; } @@ -5572,7 +5539,7 @@ void RandomizerSettingsWindow::InitElement() { // (special cases for rando items) void Randomizer_GameplayStats_SetTimestamp(uint16_t item) { - u32 time = GAMEPLAYSTAT_TOTAL_TIME; + u32 time = static_cast(GAMEPLAYSTAT_TOTAL_TIME); // Have items in Link's pocket shown as being obtained at 0.1 seconds if (time == 0) { @@ -5868,7 +5835,7 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { case RG_GREG_RUPEE: Rupees_ChangeBy(1); Flags_SetRandomizerInf(RAND_INF_GREG_FOUND); - gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_FOUND_GREG] = GAMEPLAYSTAT_TOTAL_TIME; + gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_FOUND_GREG] = static_cast(GAMEPLAYSTAT_TOTAL_TIME); break; case RG_TRIFORCE_PIECE: gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected++; @@ -5877,7 +5844,8 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { // Teleport to credits when goal is reached. if (gSaveContext.ship.quest.data.randomizer.triforcePiecesCollected == (OTRGlobals::Instance->gRandomizer->GetRandoSettingValue(RSK_TRIFORCE_HUNT_PIECES_REQUIRED) + 1)) { - gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = GAMEPLAYSTAT_TOTAL_TIME; + gSaveContext.ship.stats.itemTimestamp[TIMESTAMP_TRIFORCE_COMPLETED] = + static_cast(GAMEPLAYSTAT_TOTAL_TIME); gSaveContext.ship.stats.gameComplete = 1; Flags_SetRandomizerInf(RAND_INF_GRANT_GANONS_BOSSKEY); Play_PerformSave(play); @@ -5910,12 +5878,12 @@ extern "C" u16 Randomizer_Item_Give(PlayState* play, GetItemEntry giEntry) { case RG_DEKU_STICK_BAG: Inventory_ChangeUpgrade(UPG_STICKS, 1); INV_CONTENT(ITEM_STICK) = ITEM_STICK; - AMMO(ITEM_STICK) = CUR_CAPACITY(UPG_STICKS); + AMMO(ITEM_STICK) = static_cast(CUR_CAPACITY(UPG_STICKS)); break; case RG_DEKU_NUT_BAG: Inventory_ChangeUpgrade(UPG_NUTS, 1); INV_CONTENT(ITEM_NUT) = ITEM_NUT; - AMMO(ITEM_NUT) = CUR_CAPACITY(UPG_NUTS); + AMMO(ITEM_NUT) = static_cast(CUR_CAPACITY(UPG_NUTS)); break; default: LUSLOG_WARN("Randomizer_Item_Give didn't have behaviour specified for getItemId=%d", item); diff --git a/soh/soh/Enhancements/randomizer/randomizerTypes.h b/soh/soh/Enhancements/randomizer/randomizerTypes.h index 31002d16f..941402dbb 100644 --- a/soh/soh/Enhancements/randomizer/randomizerTypes.h +++ b/soh/soh/Enhancements/randomizer/randomizerTypes.h @@ -3697,6 +3697,8 @@ typedef enum { RT_MEGASIDEHOP_BOMB, RT_MEGASIDEHOP_BOMBCHU, RT_NAVI_DIVE, + RT_BOTTOM_OF_THE_WELL_NAVI_DIVE, + RT_LOST_WOOD_NAVI_DIVE, RT_OCARINA_ITEMS, RT_OCARINA_ITEMS_BOMB, RT_OCARINA_ITEMS_ESS, diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index 6c670e447..52b977032 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -91,6 +91,10 @@ bool previousShowHidden = false; bool hideShopUnshuffledChecks = false; bool alwaysShowGS = false; +static bool presetLoaded = false; +static ImVec2 presetPos; +static ImVec2 presetSize; + std::map startingShopItem = { { SCENE_KOKIRI_SHOP, RC_KF_SHOP_ITEM_1 }, { SCENE_BAZAAR, RC_MARKET_BAZAAR_ITEM_1 }, @@ -979,7 +983,13 @@ void CheckTrackerWindow::DrawElement() { } } - ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver); + if (presetLoaded) { + ImGui::SetNextWindowSize(presetSize); + ImGui::SetNextWindowPos(presetPos); + presetLoaded = false; + } else { + ImGui::SetNextWindowSize(ImVec2(400, 540), ImGuiCond_FirstUseEver); + } BeginFloatWindows("Check Tracker", mIsVisible, ImGuiWindowFlags_NoScrollbar); if (!GameInteractor::IsSaveLoaded() || !initialized) { @@ -1892,16 +1902,16 @@ static std::set rainbowCVars = { int hue = 0; void RainbowTick() { - float freqHue = hue * 2 * M_PI / (360 * CVarGetFloat(CVAR_COSMETIC("RainbowSpeed"), 0.6f)); + float freqHue = hue * 2 * M_PIf / (360 * CVarGetFloat(CVAR_COSMETIC("RainbowSpeed"), 0.6f)); for (auto& cvar : rainbowCVars) { if (CVarGetInteger((cvar + ".Rainbow").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.r = static_cast(sin(freqHue + 0) * 127) + 128; + newColor.g = static_cast(sin(freqHue + (2 * M_PI / 3)) * 127) + 128; + newColor.b = static_cast(sin(freqHue + (4 * M_PI / 3)) * 127) + 128; newColor.a = 255; CVarSetColor((cvar + ".Value").c_str(), newColor); @@ -1967,7 +1977,7 @@ void RecalculateAvailableChecks() { StartPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS); std::vector targetLocations; - targetLocations.reserve(RR_MAX); + targetLocations.reserve(RC_MAX); for (auto& location : Rando::StaticData::GetLocationTable()) { RandomizerCheck rc = location.GetRandomizerCheck(); Rando::ItemLocation* itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); @@ -1979,15 +1989,8 @@ void RecalculateAvailableChecks() { std::vector availableChecks = ReachabilitySearch(targetLocations, RG_NONE, true); for (auto& rc : availableChecks) { - const auto& location = Rando::StaticData::GetLocation(rc); const auto& itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); - if (location->GetRCType() == RCTYPE_SHOP && itemLocation->GetCheckStatus() == RCSHOW_IDENTIFIED) { - if (CanBuyAnother(rc)) { - itemLocation->SetAvailable(true); - } - } else { - itemLocation->SetAvailable(true); - } + itemLocation->SetAvailable(true); } totalChecksAvailable = 0; @@ -2007,6 +2010,12 @@ void RecalculateAvailableChecks() { GetPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS).count()); } +void CheckTracker_LoadFromPreset(nlohmann::json info) { + presetLoaded = true; + presetPos = { info["pos"]["x"], info["pos"]["y"] }; + presetSize = { info["size"]["width"], info["size"]["height"] }; +} + void CheckTrackerWindow::Draw() { if (!IsVisible()) { return; @@ -2114,7 +2123,10 @@ void CheckTrackerSettingsWindow::DrawElement() { "with your current progress.") .Color(THEME_COLOR))) { enableAvailableChecks = CVarGetInteger(CVAR_TRACKER_CHECK("EnableAvailableChecks"), 0); - RecalculateAvailableChecks(); + + if (GameInteractor::IsSaveLoaded(true)) { + RecalculateAvailableChecks(); + } } ImGui::EndDisabled(); diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h index 7636ab063..695899bab 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.h @@ -62,4 +62,5 @@ void UpdateAllAreas(); void RecalculateAllAreaTotals(); void SpoilAreaFromCheck(RandomizerCheck rc); void RecalculateAvailableChecks(); +void CheckTracker_LoadFromPreset(nlohmann::json info); } // namespace CheckTracker diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp index b71bae5b3..1a635f58e 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp @@ -39,6 +39,10 @@ static s16 lastEntranceIndex = -1; static s16 currentGrottoId = -1; static s16 lastSceneOrEntranceDetected = -1; +static bool presetLoaded = false; +static ImVec2 presetPos; +static ImVec2 presetSize; + static std::string spoilerEntranceGroupNames[] = { "Spawns/Warp Songs/Owls", "Kokiri Forest", @@ -382,7 +386,7 @@ const EntranceData entranceData[] = { }; // Check if Link is in the area and return that scene/entrance for tracking -s8 LinkIsInArea(const EntranceData* entrance) { +int16_t LinkIsInArea(const EntranceData* entrance) { bool result = false; if (gPlayState == nullptr) { @@ -445,6 +449,12 @@ const EntranceData* GetEntranceData(s16 index) { return nullptr; } +void EntranceTracker_LoadFromPreset(nlohmann::json info) { + presetLoaded = true; + presetPos = { info["pos"]["x"], info["pos"]["y"] }; + presetSize = { info["size"]["width"], info["size"]["height"] }; +} + // Used for verifying the names on both sides of entrance pairs match. Keeping for ease of use for further name changes // later // TODO: Figure out how to remove the need for duplicate entrance names so this is no longer necessary @@ -757,7 +767,13 @@ void EntranceTrackerWindow::Draw() { } void EntranceTrackerWindow::DrawElement() { - ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver); + if (presetLoaded) { + ImGui::SetNextWindowSize(presetSize); + ImGui::SetNextWindowPos(presetPos); + presetLoaded = false; + } else { + ImGui::SetNextWindowSize(ImVec2(600, 375), ImGuiCond_FirstUseEver); + } if (!ImGui::Begin("Entrance Tracker", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { ImGui::End(); diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h index 4ee33ef62..2d2f7143c 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.h @@ -90,6 +90,7 @@ void InitEntranceTrackingData(); s16 GetLastEntranceOverride(); s16 GetCurrentGrottoId(); const EntranceData* GetEntranceData(s16); +void EntranceTracker_LoadFromPreset(nlohmann::json info); class EntranceTrackerSettingsWindow final : public Ship::GuiWindow { public: diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index 9b7b1fd39..6284d7121 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -375,6 +375,10 @@ uint32_t notesIdleFrames = 0; bool notesNeedSave = false; const uint32_t notesMaxIdleFrames = 40; // two seconds of game time, since OnGameFrameUpdate is used to tick +static bool presetLoaded = false; +static std::unordered_map presetPos; +static std::unordered_map presetSize; + void ItemTrackerOnFrame() { if (notesNeedSave && notesIdleFrames <= notesMaxIdleFrames) { notesIdleFrames++; @@ -398,6 +402,16 @@ bool HasEquipment(ItemTrackerItem item) { return GameInteractor::IsSaveLoaded() ? (item.data & gSaveContext.inventory.equipment) : false; } +void ItemTracker_LoadFromPreset(nlohmann::json trackerInfo) { + presetLoaded = true; + for (auto window : itemTrackerWindowIDs) { + if (trackerInfo.contains(window)) { + presetPos[window] = { trackerInfo[window]["pos"]["x"], trackerInfo[window]["pos"]["y"] }; + presetSize[window] = { trackerInfo[window]["size"]["width"], trackerInfo[window]["size"]["height"] }; + } + } +} + ItemTrackerNumbers GetItemCurrentAndMax(ItemTrackerItem item) { ItemTrackerNumbers result; result.currentCapacity = 0; @@ -670,17 +684,17 @@ void DrawItemCount(ItemTrackerItem item, bool hideMax) { void DrawEquip(ItemTrackerItem item) { bool hasEquip = HasEquipment(item); - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(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)); + ImVec2(iconSize, iconSize), ImVec2(0.0f, 0.0f), ImVec2(1, 1)); Tooltip(SohUtils::GetItemName(item.id).c_str()); } void DrawQuest(ItemTrackerItem item) { bool hasQuestItem = HasQuestItem(item); - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); ImGui::BeginGroup(); ImGui::Image(Ship::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName( hasQuestItem && IsValidSaveFile() ? item.name : item.nameFaded), @@ -698,7 +712,7 @@ void DrawQuest(ItemTrackerItem item) { void DrawItem(ItemTrackerItem item) { uint32_t actualItemId = GameInteractor::IsSaveLoaded() ? INV_CONTENT(item.id) : ITEM_NONE; - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); bool hasItem = actualItemId != ITEM_NONE; std::string itemName = ""; @@ -1015,7 +1029,7 @@ void DrawBottle(ItemTrackerItem item) { item = actualItemTrackerItemMap[actualItemId]; } - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(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)); @@ -1027,7 +1041,7 @@ 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(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(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(); @@ -1078,19 +1092,19 @@ void DrawDungeonItem(ItemTrackerItem item) { } void DrawSong(ItemTrackerItem item) { - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); ImVec2 p = ImGui::GetCursorScreenPos(); bool hasSong = HasSong(item); ImGui::SetCursorScreenPos(ImVec2(p.x + 6, p.y)); 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)); + ImVec2(iconSize / 1.5f, iconSize), ImVec2(0, 0), ImVec2(1, 1)); Tooltip(SohUtils::GetQuestItemName(item.id).c_str()); } void DrawNotes(bool resizeable = false) { ImGui::BeginGroup(); - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36)); int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); struct ItemTrackerNotes { @@ -1113,7 +1127,7 @@ void DrawNotes(bool resizeable = false) { } }; ImVec2 size = resizeable ? ImVec2(-FLT_MIN, ImGui::GetContentRegionAvail().y) - : ImVec2(((iconSize + iconSpacing) * 6) - 8, 200); + : ImVec2(((iconSize + iconSpacing) * 6) - 8.0f, 200.0f); if (GameInteractor::IsSaveLoaded()) { if (ItemTrackerNotes::TrackerNotesInputTextMultiline("##ItemTrackerNotes", &itemTrackerNotes, size, ImGuiInputTextFlags_AllowTabInput)) { @@ -1171,6 +1185,12 @@ void BeginFloatingWindows(std::string UniqueName, ImGuiWindowFlags flags = 0) { ImGui::PushStyleColor(ImGuiCol_WindowBg, color); ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 4.0f); + if (presetLoaded && presetPos.contains(UniqueName)) { + ImGui::SetNextWindowSize(presetSize[UniqueName]); + ImGui::SetNextWindowPos(presetPos[UniqueName]); + presetSize.erase(UniqueName); + presetPos.erase(UniqueName); + } ImGui::Begin(UniqueName.c_str(), nullptr, windowFlags); } void EndFloatingWindows() { @@ -1185,7 +1205,7 @@ 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(CVAR_TRACKER_ITEM("IconSize"), 36); + float iconSize = static_cast(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; @@ -1194,7 +1214,7 @@ void DrawItemsInRows(std::vector items, int columns = 6) { int row = i / columns; int column = i % columns; ImGui::SetCursorPos( - ImVec2((column * (iconSize + iconSpacing) + 8), (row * (iconSize + iconSpacing)) + 8 + topPadding)); + ImVec2((column * (iconSize + iconSpacing) + 8.0f), (row * (iconSize + iconSpacing)) + 8.0f + topPadding)); items[i].drawFunc(items[i]); } } @@ -1208,10 +1228,10 @@ void DrawItemsInACircle(std::vector items) { int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); ImVec2 max = ImGui::GetWindowContentRegionMax(); - float radius = (iconSize + iconSpacing) * 2; + float radius = (iconSize + iconSpacing) * 2.0f; for (int i = 0; i < items.size(); i++) { - float angle = (float)i / items.size() * 2.0f * M_PI; + float angle = static_cast(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(CVAR_TRACKER_ITEM("IconSize"), 36) - 8) / 2.0f, y + 4)); @@ -1225,14 +1245,12 @@ void DrawItemsInACircle(std::vector items) { * to then call DrawItemsInRows */ std::vector GetDungeonItemsVector(std::vector dungeons, int columns = 6) { - int iconSize = CVarGetInteger(CVAR_TRACKER_ITEM("IconSize"), 36); - int iconSpacing = CVarGetInteger(CVAR_TRACKER_ITEM("IconSpacing"), 12); std::vector dungeonItems = {}; int rowCount = 0; for (int i = 0; i < dungeons.size(); i++) { if (dungeons[i].items.size() > rowCount) - rowCount = dungeons[i].items.size(); + rowCount = static_cast(dungeons[i].items.size()); } for (int i = 0; i < rowCount; i++) { @@ -1469,7 +1487,7 @@ void ItemTrackerSaveFile(SaveContext* saveContext, int sectionID, bool fullSave) void ItemTrackerLoadFile() { std::string initialTrackerNotes = ""; SaveManager::Instance->LoadData("personalNotes", initialTrackerNotes); - itemTrackerNotes.resize(initialTrackerNotes.length() + 1); + itemTrackerNotes.resize(static_cast(initialTrackerNotes.length() + 1)); if (initialTrackerNotes != "") { SohUtils::CopyStringToCharArray(itemTrackerNotes.Data, initialTrackerNotes.c_str(), itemTrackerNotes.size()); } else { @@ -1527,13 +1545,14 @@ void ItemTrackerWindow::DrawElement() { SECTION_DISPLAY_EXTENDED_MAIN_WINDOW) || (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Notes"), SECTION_DISPLAY_HIDDEN) == SECTION_DISPLAY_MAIN_WINDOW)) { - BeginFloatingWindows("Item Tracker##main window"); + BeginFloatingWindows("Item Tracker"); DrawItemsInRows(mainWindowItems, 6); 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) { + (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING && + CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == + TRACKER_DISPLAY_ALWAYS)) { DrawNotes(); } EndFloatingWindows(); @@ -1642,7 +1661,10 @@ void ItemTrackerWindow::DrawElement() { 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) { + (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW || + (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING && + CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) != + TRACKER_DISPLAY_COMBO_BUTTON))) { ImGui::SetNextWindowSize(ImVec2(400, 300), ImGuiCond_FirstUseEver); BeginFloatingWindows("Personal Notes", ImGuiWindowFlags_NoFocusOnAppearing); DrawNotes(true); @@ -1657,6 +1679,10 @@ void ItemTrackerWindow::DrawElement() { EndFloatingWindows(); } } + if (presetLoaded) { + shouldUpdateVectors = true; + presetLoaded = false; + } } static std::unordered_map itemTrackerCapacityTrackOptions = { @@ -1943,7 +1969,10 @@ void ItemTrackerSettingsWindow::DrawElement() { shouldUpdateVectors = true; } - if (CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) == TRACKER_DISPLAY_ALWAYS) { + if (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_WINDOW || + (CVarGetInteger(CVAR_TRACKER_ITEM("WindowType"), TRACKER_WINDOW_FLOATING) == TRACKER_WINDOW_FLOATING && + CVarGetInteger(CVAR_TRACKER_ITEM("DisplayType.Main"), TRACKER_DISPLAY_ALWAYS) != + TRACKER_DISPLAY_COMBO_BUTTON)) { if (CVarCombobox("Personal notes", CVAR_TRACKER_ITEM("DisplayType.Notes"), displayTypes, ComboboxOptions() .DefaultIndex(SECTION_DISPLAY_HIDDEN) diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h index 7175baeab..85a2b63a0 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.h @@ -25,6 +25,23 @@ bool HasEquipment(ItemTrackerItem); #define ITEM_TRACKER_ITEM_CUSTOM(id, name, nameFaded, data, drawFunc) \ { id, #name, #nameFaded "_Faded", data, drawFunc } +static std::vector itemTrackerWindowIDs = { "Item Tracker", + "Inventory Items Tracker", + "Equipment Items Tracker", + "Misc Items Tracker", + "Dungeon Rewards Tracker", + "Songs Tracker", + "Dungeon Items Tracker", + "Greg Tracker", + "Triforce Piece Tracker", + "Boss Soul Tracker", + "Ocarina Button Tracker", + "Overworld Key Tracker", + "Fishing Pole Tracker", + "Personal Notes", + "Total Checks" }; +void ItemTracker_LoadFromPreset(nlohmann::json trackerInfo); + typedef struct ItemTrackerDungeon { uint32_t id; std::vector items; diff --git a/soh/soh/Enhancements/randomizer/randomizer_settings_window.h b/soh/soh/Enhancements/randomizer/randomizer_settings_window.h index bf1a2a740..87d830e38 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_settings_window.h +++ b/soh/soh/Enhancements/randomizer/randomizer_settings_window.h @@ -13,6 +13,7 @@ class RandomizerSettingsWindow final : public Ship::GuiWindow { void InitElement() override; void DrawElement() override; void UpdateElement() override; + void SetNeedsUpdate(); private: bool mNeedsUpdate = false; diff --git a/soh/soh/Enhancements/randomizer/savefile.cpp b/soh/soh/Enhancements/randomizer/savefile.cpp index cb8c7eaef..884ade150 100644 --- a/soh/soh/Enhancements/randomizer/savefile.cpp +++ b/soh/soh/Enhancements/randomizer/savefile.cpp @@ -22,7 +22,7 @@ void StartingItemGive(GetItemEntry getItemEntry, RandomizerCheck randomizerCheck if (getItemEntry.getItemId == GI_SWORD_BGS) { gSaveContext.bgsFlag = true; } - Item_Give(NULL, getItemEntry.itemId); + Item_Give(NULL, static_cast(getItemEntry.itemId)); } else if (getItemEntry.modIndex == MOD_RANDOMIZER) { if (getItemEntry.getItemId == RG_ICE_TRAP) { gSaveContext.ship.pendingIceTrapCount++; @@ -269,9 +269,9 @@ extern "C" void Randomizer_InitSaveFile() { // Remove One Time Scrubs with Scrubsanity off if (Randomizer_GetSettingValue(RSK_SHUFFLE_SCRUBS) == RO_SCRUBS_OFF) { - Flags_SetRandomizerInf(RAND_INF_SCRUBS_PURCHASED_LW_DEKU_SCRUB_NEAR_BRIDGE); - Flags_SetRandomizerInf(RAND_INF_SCRUBS_PURCHASED_LW_DEKU_SCRUB_GROTTO_FRONT); - Flags_SetRandomizerInf(RAND_INF_SCRUBS_PURCHASED_HF_DEKU_SCRUB_GROTTO); + Flags_SetItemGetInf(ITEMGETINF_DEKU_SCRUB_HEART_PIECE); + Flags_SetInfTable(INFTABLE_BOUGHT_STICK_UPGRADE); + Flags_SetInfTable(INFTABLE_BOUGHT_NUT_UPGRADE); } int startingAge = OTRGlobals::Instance->gRandoContext->GetOption(RSK_SELECTED_STARTING_AGE).Get(); @@ -334,7 +334,7 @@ extern "C" void Randomizer_InitSaveFile() { Flags_SetRandomizerInf(RAND_INF_TOT_MASTER_SWORD); } - HIGH_SCORE(HS_POE_POINTS) = 1000 - (100 * (Randomizer_GetSettingValue(RSK_BIG_POE_COUNT) + 1)); + HIGH_SCORE(HS_POE_POINTS) = 1000 - (100 * Randomizer_GetSettingValue(RSK_BIG_POE_COUNT)); if (Randomizer_GetSettingValue(RSK_SKIP_EPONA_RACE)) { Flags_SetEventChkInf(EVENTCHKINF_EPONA_OBTAINED); diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index c5d0c23d8..d94df9ae5 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -24,7 +24,7 @@ std::vector NumOpts(const int min, const int max, const int step = } std::vector MultiVecOpts(const std::vector>& optionsVector) { - uint32_t totalSize = 0; + size_t totalSize = 0; for (const auto& vector : optionsVector) { totalSize += vector.size(); } @@ -250,7 +250,7 @@ void Settings::CreateOptions() { OPT_U8(RSK_LACS_REWARD_COUNT, "GCBK Reward Count", {NumOpts(0, 10)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsRewardCount"), "", WidgetType::Slider, 9, true); OPT_U8(RSK_LACS_DUNGEON_COUNT, "GCBK Dungeon Count", {NumOpts(0, 9)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsDungeonCount"), "", WidgetType::Slider, 8, true); OPT_U8(RSK_LACS_TOKEN_COUNT, "GCBK Token Count", {NumOpts(0, 100)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsTokenCount"), "", WidgetType::Slider, 100, true); - OPT_U8(RSK_LACS_OPTIONS, "GCBK LACS Reward Options", {"Standard Reward", "Greg as Reward", "Greg as Wildcard"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsRewardOptions"), "", WidgetType::Combobox, RO_LACS_STANDARD_REWARD); + OPT_U8(RSK_LACS_OPTIONS, "GCBK LACS Reward Options", {"Standard Reward", "Greg as Reward", "Greg as Wildcard"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("LacsRewardOptions"), mOptionDescriptions[RSK_LACS_OPTIONS], WidgetType::Combobox, RO_LACS_STANDARD_REWARD); OPT_U8(RSK_KEYRINGS, "Key Rings", {"Off", "Random", "Count", "Selection"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleKeyRings"), mOptionDescriptions[RSK_KEYRINGS], WidgetType::Combobox, RO_KEYRINGS_OFF); OPT_U8(RSK_KEYRINGS_RANDOM_COUNT, "Keyring Dungeon Count", {NumOpts(0, 9)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsRandomCount"), "", WidgetType::Slider, 8); OPT_U8(RSK_KEYRINGS_GERUDO_FORTRESS, "Gerudo Fortress Keyring", {"No", "Random", "Yes"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("ShuffleKeyRingsGerudoFortress"), "", WidgetType::Combobox, 0); @@ -268,7 +268,7 @@ void Settings::CreateOptions() { OPT_BOOL(RSK_SKIP_CHILD_ZELDA, "Skip Child Zelda", {"Don't Skip", "Skip"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("SkipChildZelda"), mOptionDescriptions[RSK_SKIP_CHILD_ZELDA], WidgetType::Checkbox, RO_GENERIC_DONT_SKIP); OPT_BOOL(RSK_SKIP_EPONA_RACE, "Skip Epona Race", {"Don't Skip", "Skip"}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("SkipEponaRace"), mOptionDescriptions[RSK_SKIP_EPONA_RACE], WidgetType::Checkbox, RO_GENERIC_DONT_SKIP); OPT_BOOL(RSK_SKIP_SCARECROWS_SONG, "Skip Scarecrow's Song", CVAR_RANDOMIZER_SETTING("SkipScarecrowsSong"), mOptionDescriptions[RSK_SKIP_SCARECROWS_SONG]); - OPT_U8(RSK_BIG_POE_COUNT, "Big Poe Target Count", {NumOpts(1, 10)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), mOptionDescriptions[RSK_BIG_POE_COUNT], WidgetType::Slider, 9); + OPT_U8(RSK_BIG_POE_COUNT, "Big Poe Target Count", {NumOpts(0, 10)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("BigPoeTargetCount"), mOptionDescriptions[RSK_BIG_POE_COUNT], WidgetType::Slider, 10); OPT_U8(RSK_CUCCO_COUNT, "Cuccos to return", {NumOpts(0, 7)}, OptionCategory::Setting, CVAR_RANDOMIZER_SETTING("CuccosToReturn"), mOptionDescriptions[RSK_CUCCO_COUNT], WidgetType::Slider, 7); OPT_BOOL(RSK_COMPLETE_MASK_QUEST, "Complete Mask Quest", CVAR_RANDOMIZER_SETTING("CompleteMaskQuest"), mOptionDescriptions[RSK_COMPLETE_MASK_QUEST]); OPT_U8(RSK_GOSSIP_STONE_HINTS, "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); @@ -410,6 +410,8 @@ void Settings::CreateOptions() { "Hover Boots, or Bean."); OPT_TRICK(RT_LW_MIDO_BACKFLIP, RCQUEST_BOTH, RA_THE_LOST_WOODS, { Tricks::Tag::NOVICE }, "Backflip over Mido as Adult", "With a specific position and angle, you can backflip over Mido."); + OPT_TRICK(RT_LOST_WOOD_NAVI_DIVE, RCQUEST_BOTH, RA_THE_LOST_WOODS, { Tricks::Tag::NOVICE }, "Lost Woods Navi dive", + "You need Deku Sticks or Kokiri Sword to dive with Navi for entering Zora's River."); OPT_TRICK(RT_LW_GS_BEAN, RCQUEST_BOTH, RA_THE_LOST_WOODS, { Tricks::Tag::INTERMEDIATE }, "Lost Woods Adult GS without Bean", "You can collect the token with a precise Hookshot use, as long as you can kill the Skulltula somehow " @@ -705,6 +707,9 @@ void Settings::CreateOptions() { OPT_TRICK(RT_LENS_BOTW, RCQUEST_VANILLA, RA_BOTTOM_OF_THE_WELL, { Tricks::Tag::NOVICE }, "Bottom of the Well without Lens of Truth", "Removes the requirements for the Lens of Truth in Bottom of the Well."); + OPT_TRICK(RT_BOTTOM_OF_THE_WELL_NAVI_DIVE, RCQUEST_BOTH, RA_BOTTOM_OF_THE_WELL, { Tricks::Tag::NOVICE }, + "Bottom of the Well Navi dive", + "You need Deku Sticks or Kokiri Sword to dive with Navi for entering Bottom of the Well."); OPT_TRICK(RT_BOTW_CHILD_DEADHAND, RCQUEST_BOTH, RA_BOTTOM_OF_THE_WELL, { Tricks::Tag::NOVICE }, "Child Dead Hand without Kokiri Sword", "Requires 9 sticks or 5 jump slashes."); OPT_TRICK(RT_BOTW_BASEMENT, RCQUEST_VANILLA, RA_BOTTOM_OF_THE_WELL, { Tricks::Tag::NOVICE }, @@ -2638,7 +2643,7 @@ void Context::FinalizeSettings(const std::set& excludedLocation mqSet += 1; break; case RO_MQ_SET_RANDOM: - randMQOption.push_back(i); + randMQOption.push_back(static_cast(i)); dungeons[i]->SetDungeonKnown(false); break; default: @@ -2659,7 +2664,7 @@ void Context::FinalizeSettings(const std::set& excludedLocation // otherwise, make everything a possibility and unknown } else { for (size_t i = 0; i < dungeons.size(); i++) { - randMQOption.push_back(i); + randMQOption.push_back(static_cast(i)); dungeons[i]->SetDungeonKnown(false); mOptions[dungeons[i]->GetMQSetting()].Set(RO_MQ_SET_RANDOM); } diff --git a/soh/soh/Enhancements/randomizer/static_data.h b/soh/soh/Enhancements/randomizer/static_data.h index 797fcab46..1be34e772 100644 --- a/soh/soh/Enhancements/randomizer/static_data.h +++ b/soh/soh/Enhancements/randomizer/static_data.h @@ -49,6 +49,7 @@ class StaticData { static std::vector GetPondFishLocations(); static std::vector GetOverworldFishLocations(); static std::vector GetOverworldFairyLocations(); + static void RegisterBeehiveLocations(); static void RegisterCowLocations(); static void RegisterFishLocations(); static void RegisterFairyLocations(); diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index b738e2fc1..9f488efce 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -13,12 +13,14 @@ extern "C" { #include "src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.h" #include "src/overlays/actors/ovl_En_Owl/z_en_owl.h" #include "src/overlays/actors/ovl_En_Go2/z_en_go2.h" +#include "src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h" #include "src/overlays/actors/ovl_En_Ko/z_en_ko.h" #include "src/overlays/actors/ovl_En_Ma1/z_en_ma1.h" #include "src/overlays/actors/ovl_En_Ru2/z_en_ru2.h" #include "src/overlays/actors/ovl_En_Zl4/z_en_zl4.h" #include "src/overlays/actors/ovl_En_Box/z_en_box.h" #include "src/overlays/actors/ovl_Demo_Im/z_demo_im.h" +#include "src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h" #include "src/overlays/actors/ovl_En_Sa/z_en_sa.h" #include "src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.h" #include "src/overlays/actors/ovl_En_Tk/z_en_tk.h" @@ -217,6 +219,25 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), IS_RANDO) && (entranceFlag != EVENTCHKINF_EPONA_OBTAINED) && entranceIndex != ENTR_SPIRIT_TEMPLE_BOSS_ENTRANCE) { *should = false; + + // Check for dispulsion of Ganon's Tower barrier + switch (entranceIndex) { + case ENTR_INSIDE_GANONS_CASTLE_2: + case ENTR_INSIDE_GANONS_CASTLE_3: + case ENTR_INSIDE_GANONS_CASTLE_4: + case ENTR_INSIDE_GANONS_CASTLE_5: + case ENTR_INSIDE_GANONS_CASTLE_6: + case ENTR_INSIDE_GANONS_CASTLE_7: + if (Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_FOREST_TRIAL) && + Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_WATER_TRIAL) && + Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_SHADOW_TRIAL) && + Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_FIRE_TRIAL) && + Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_LIGHT_TRIAL) && + Flags_GetEventChkInf(EVENTCHKINF_COMPLETED_SPIRIT_TRIAL)) { + Flags_SetEventChkInf(EVENTCHKINF_DISPELLED_GANONS_TOWER_BARRIER); + } + break; + } } break; } @@ -275,6 +296,11 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li } switch (actor->id) { case ACTOR_OBJ_SWITCH: { + if ((actor->params == 8224 && gPlayState->sceneNum == SCENE_DODONGOS_CAVERN) || + (actor->params == 6979 && gPlayState->sceneNum == SCENE_WATER_TEMPLE) && + CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.GlitchAiding"), 0)) { + break; + } ObjSwitch* switchActor = (ObjSwitch*)actor; switchActor->cooldownTimer = 0; *should = false; @@ -349,6 +375,11 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li } break; } + case VB_FREEZE_LINK_FOR_FOREST_PILLARS: + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), IS_RANDO)) { + *should = false; + } + break; case VB_SHOW_TITLE_CARD: if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), IS_RANDO)) { *should = false; @@ -441,6 +472,26 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li *should = false; } break; + case VB_PLAY_DISPEL_BARRIER_CS: { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), IS_RANDO)) { + static s16 trialEntrances[] = { + 0, + ENTR_INSIDE_GANONS_CASTLE_3, + ENTR_INSIDE_GANONS_CASTLE_6, + ENTR_INSIDE_GANONS_CASTLE_5, + ENTR_INSIDE_GANONS_CASTLE_4, + ENTR_INSIDE_GANONS_CASTLE_7, + ENTR_INSIDE_GANONS_CASTLE_2, + }; + RateLimitedSuccessChime(); + DemoKekkai* kekkai = va_arg(args, DemoKekkai*); + gPlayState->nextEntranceIndex = trialEntrances[kekkai->actor.params]; + gPlayState->transitionTrigger = TRANS_TRIGGER_START; + gPlayState->transitionType = TRANS_TYPE_FADE_BLACK; + *should = false; + } + break; + } case VB_OWL_INTERACTION: { if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), IS_RANDO) && *should) { EnOwl* enOwl = va_arg(args, EnOwl*); @@ -720,6 +771,18 @@ void TimeSaverOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_li break; } + case VB_PLAY_GATE_OPENING_OR_CLOSING_CS: { + if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), IS_RANDO)) { + EnHeishi2* enHeishi2 = va_arg(args, EnHeishi2*); + enHeishi2->unk_2F2[0] = 0; + + // The second argument determines whether the vanilla code should be run anyway. It + // should be set to `true` ONLY IF said code calls `Play_ClearCamera`, false otherwise. + bool clearCamera = (bool)va_arg(args, int); + *should = clearCamera && enHeishi2->cameraId != MAIN_CAM; + } + break; + } case VB_PLAY_RAINBOW_BRIDGE_CS: { if (CVarGetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), IS_RANDO)) { *should = false; diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 87cb361e1..a2135006a 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -40,6 +40,7 @@ #include "z64.h" #include "macros.h" #include "Fonts.h" +#include "window/FileDropMgr.h" #include "window/gui/resource/Font.h" #include #include "Enhancements/custom-message/CustomMessageManager.h" @@ -51,7 +52,7 @@ #include "Extractor/Extract.h" #endif -#include +#include #ifdef __APPLE__ #include @@ -271,7 +272,7 @@ OTRGlobals::OTRGlobals() { if (std::filesystem::exists(ootPath)) { OTRFiles.push_back(ootPath); } - std::string sohOtrPath = Ship::Context::GetPathRelativeToAppBundle("soh.otr"); + std::string sohOtrPath = Ship::Context::LocateFileAcrossAppDirs("soh.otr"); if (std::filesystem::exists(sohOtrPath)) { OTRFiles.push_back(sohOtrPath); } @@ -307,6 +308,7 @@ OTRGlobals::OTRGlobals() { context->InitGfxDebugger(); context->InitConfiguration(); context->InitConsoleVariables(); + context->InitFileDropMgr(); // tell LUS to reserve 3 SoH specific threads (Game, Audio, Save) context->InitResourceManager(OTRFiles, {}, 3); @@ -330,6 +332,10 @@ OTRGlobals::OTRGlobals() { context->InitCrashHandler(); context->InitConsole(); + Ship::Context::GetInstance()->GetLogger()->set_level( + (spdlog::level::level_enum)CVarGetInteger(CVAR_DEVELOPER_TOOLS("LogLevel"), 1)); + Ship::Context::GetInstance()->GetLogger()->set_pattern("[%H:%M:%S.%e] [%s:%#] [%l] %v"); + auto sohInputEditorWindow = std::make_shared(CVAR_WINDOW("ControllerConfiguration"), "Configure Controller"); auto sohFast3dWindow = @@ -1151,7 +1157,7 @@ extern "C" void InitOTR() { CheckAndCreateModFolder(); #endif - CheckSoHOTRVersion(Ship::Context::GetPathRelativeToAppBundle("soh.otr")); + CheckSoHOTRVersion(Ship::Context::LocateFileAcrossAppDirs("soh.otr")); if (!std::filesystem::exists(Ship::Context::LocateFileAcrossAppDirs("oot-mq.otr", appShortName)) && !std::filesystem::exists(Ship::Context::LocateFileAcrossAppDirs("oot.otr", appShortName))) { @@ -1434,13 +1440,13 @@ extern "C" void Graph_StartFrame() { } #endif - if (CVarGetInteger(CVAR_NEW_FILE_DROPPED, 0)) { - std::string filePath = SohUtils::Sanitize(CVarGetString(CVAR_DROPPED_FILE, "")); + auto dropMgr = Ship::Context::GetInstance()->GetFileDropMgr(); + if (dropMgr->FileDropped()) { + std::string filePath = dropMgr->GetDroppedFile(); if (!filePath.empty()) { GameInteractor::Instance->ExecuteHooks(filePath); } - CVarClear(CVAR_NEW_FILE_DROPPED); - CVarClear(CVAR_DROPPED_FILE); + dropMgr->ClearDroppedFile(); } } @@ -1899,7 +1905,7 @@ extern "C" void OTRControllerCallback(uint8_t rumble) { } extern "C" float OTRGetAspectRatio() { - return gfx_current_dimensions.aspect_ratio; + return Ship::Context::GetInstance()->GetWindow()->GetAspectRatio(); } extern "C" float OTRGetDimensionFromLeftEdge(float v) { @@ -1912,12 +1918,34 @@ extern "C" float OTRGetDimensionFromRightEdge(float v) { // Gets the width of the current render target area extern "C" uint32_t OTRGetGameRenderWidth() { - return gfx_current_dimensions.width; + auto fastWnd = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()); + auto intP = fastWnd->GetInterpreterWeak().lock(); + + if (!intP) { + assert(false && "Lost reference to Fast::Interpreter"); + return 320; + } + + uint32_t height, width; + intP->GetCurDimensions(&width, &height); + + return width; } // Gets the height of the current render target area extern "C" uint32_t OTRGetGameRenderHeight() { - return gfx_current_dimensions.height; + auto fastWnd = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()); + auto intP = fastWnd->GetInterpreterWeak().lock(); + + if (!intP) { + assert(false && "Lost reference to Fast::Interpreter"); + return 240; + } + + uint32_t height, width; + intP->GetCurDimensions(&width, &height); + + return height; } f32 floorf(f32 x); // RANDOTODO False positive error "allowing all exceptions is incompatible with previous function" @@ -2412,6 +2440,9 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, textId, MF_AUTO_FORMAT); } else if (textId == TEXT_MASK_SHOP_SIGN && ctx->GetOption(RSK_MASK_SHOP_HINT)) { messageEntry = ctx->GetHint(RH_MASK_SHOP_HINT)->GetHintMessage(MF_AUTO_FORMAT); + } else if (textId == TEXT_BIG_POE_COLLECTED_RANDO) { + messageEntry = + CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, textId, MF_AUTO_FORMAT); } } if (textId == TEXT_GS_NO_FREEZE || textId == TEXT_GS_FREEZE) { @@ -2423,15 +2454,15 @@ 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(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && - !(IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF)) { + bool gsTokensShuffled = Randomizer_GetSettingValue(RSK_SHUFFLE_TOKENS) != RO_TOKENSANITY_OFF; + if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && !(IS_RANDO && gsTokensShuffled)) { textId = TEXT_GS_NO_FREEZE; } else { textId = TEXT_GS_FREEZE; } // In vanilla, GS token count is incremented prior to the text box displaying // In rando we need to bump the token count by one to show the correct count - s16 gsCount = gSaveContext.inventory.gsTokens + (IS_RANDO ? 1 : 0); + s16 gsCount = gSaveContext.inventory.gsTokens + ((IS_RANDO && gsTokensShuffled) ? 1 : 0); messageEntry = CustomMessageManager::Instance->RetrieveMessage(customMessageTableID, textId, MF_FORMATTED); messageEntry.Replace("[[gsCount]]", std::to_string(gsCount)); } else if (CVarGetInteger(CVAR_ENHANCEMENT("SkulltulaFreeze"), 0) != 0 && @@ -2496,11 +2527,23 @@ extern "C" void EntranceTracker_SetLastEntranceOverride(s16 entranceIndex) { } extern "C" void Gfx_RegisterBlendedTexture(const char* name, u8* mask, u8* replacement) { - gfx_register_blended_texture(name, mask, replacement); + if (auto intP = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()) + ->GetInterpreterWeak() + .lock()) { + intP->RegisterBlendedTexture(name, mask, replacement); + } else { + assert(false && "Lost reference to Fast::Interpreter"); + } } extern "C" void Gfx_UnregisterBlendedTexture(const char* name) { - gfx_unregister_blended_texture(name); + if (auto intP = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()) + ->GetInterpreterWeak() + .lock()) { + intP->UnregisterBlendedTexture(name); + } else { + assert(false && "Lost reference to Fast::Interpreter"); + } } extern "C" void Gfx_TextureCacheDelete(const uint8_t* texAddr) { @@ -2514,7 +2557,13 @@ extern "C" void Gfx_TextureCacheDelete(const uint8_t* texAddr) { texAddr = (const uint8_t*)ResourceMgr_GetResourceDataByNameHandlingMQ(imgName); } - gfx_texture_cache_delete(texAddr); + if (auto intP = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()) + ->GetInterpreterWeak() + .lock()) { + intP->TextureCacheDelete(texAddr); + } else { + assert(false && "Lost reference to Fast::Interpreter"); + } } void SoH_ProcessDroppedFiles(std::string filePath) { diff --git a/soh/soh/OTRGlobals.h b/soh/soh/OTRGlobals.h index 6f83d78ad..2d1464e47 100644 --- a/soh/soh/OTRGlobals.h +++ b/soh/soh/OTRGlobals.h @@ -15,6 +15,11 @@ #define BTN_CUSTOM_OCARINA_PITCH_UP ((CONTROLLERBUTTONS_T)0x00400000) #define BTN_CUSTOM_OCARINA_PITCH_DOWN ((CONTROLLERBUTTONS_T)0x00800000) +#define M_PIf 3.14159265358979323846f +#define M_PI_2f 1.57079632679489661923f // pi/2 +#define M_SQRT2f 1.41421356237309504880f +#define M_SQRT1_2f 0.70710678118654752440f /* 1/sqrt(2) */ + #ifdef __cplusplus #include #include "Enhancements/savestates.h" diff --git a/soh/soh/ObjectExtension/ActorListIndex.cpp b/soh/soh/ObjectExtension/ActorListIndex.cpp new file mode 100644 index 000000000..5c9367703 --- /dev/null +++ b/soh/soh/ObjectExtension/ActorListIndex.cpp @@ -0,0 +1,16 @@ +#include "ActorListIndex.h" +#include "soh/ObjectExtension/ObjectExtension.h" + +struct ActorListIndex { + s16 index = -1; +}; +static ObjectExtension::Register ActorListIndexRegister; + +int16_t GetActorListIndex(const Actor* actor) { + const ActorListIndex* index = ObjectExtension::GetInstance().Get(actor); + return index != nullptr ? index->index : ActorListIndex{}.index; +} + +void SetActorListIndex(const Actor* actor, int16_t index) { + ObjectExtension::GetInstance().Set(actor, ActorListIndex{ index }); +} \ No newline at end of file diff --git a/soh/soh/ObjectExtension/ActorListIndex.h b/soh/soh/ObjectExtension/ActorListIndex.h new file mode 100644 index 000000000..84f00449d --- /dev/null +++ b/soh/soh/ObjectExtension/ActorListIndex.h @@ -0,0 +1,16 @@ +#ifndef ACTOR_LIST_INDEX_H +#define ACTOR_LIST_INDEX_H + +#ifdef __cplusplus +extern "C" { +#include "z64actor.h" +#endif + +int16_t GetActorListIndex(const Actor* actor); +void SetActorListIndex(const Actor* actor, int16_t index); + +#ifdef __cplusplus +} +#endif + +#endif // ACTOR_LIST_INDEX_H \ No newline at end of file diff --git a/soh/soh/ObjectExtension/ObjectExtension.cpp b/soh/soh/ObjectExtension/ObjectExtension.cpp new file mode 100644 index 000000000..3b8f6f8bf --- /dev/null +++ b/soh/soh/ObjectExtension/ObjectExtension.cpp @@ -0,0 +1,25 @@ +#include "ObjectExtension.h" + +ObjectExtension& ObjectExtension::GetInstance() { + static ObjectExtension instance; + return instance; +} + +ObjectExtension::Id ObjectExtension::RegisterId() { + return NextId++; +} + +void ObjectExtension::Free(const void* object) { + if (object == nullptr) { + return; + } + + std::erase_if(Data, [&object](const auto& iter) { + auto const& [key, value] = iter; + return key.first == object; + }); +} + +extern "C" void ObjectExtension_Free(const void* object) { + ObjectExtension::GetInstance().Free(object); +} diff --git a/soh/soh/ObjectExtension/ObjectExtension.h b/soh/soh/ObjectExtension/ObjectExtension.h new file mode 100644 index 000000000..d59edffd0 --- /dev/null +++ b/soh/soh/ObjectExtension/ObjectExtension.h @@ -0,0 +1,116 @@ +#pragma once + +#ifdef __cplusplus + +#include + +#include +#include +#include +#include +#include + +/* + * This class can attach additional data to pointers. It can only attach a single instance of each type of data. + * Use the ObjectExtension::Register class to register a type to be used as an object extension. + * An example usage is: + * + * struct MyData { + * s32 data = -1; + * }; + * static ObjectExtension::Register MyDataRegister; + * + * Then you can get with + * ObjectExtension::GetInstance().Get(ptr); + * and set with + * ObjectExtension::GetInstance().Set(ptr, MyData{}); + * (or with the returned pointer from Get()). + */ +class ObjectExtension { + public: + using Id = uint32_t; + + static constexpr Id InvalidId = std::numeric_limits::max(); + + // Registers type T to be used as an object extension + template class Register { + public: + Register() { + Id = ObjectExtension::GetInstance().RegisterId(); + } + + static ObjectExtension::Id Id; + }; + + // Gets the singleton ObjectExtension instance + static ObjectExtension& GetInstance(); + + // Gets the data of type T associated with an object, or nullptr if no such data has been attached + template T* Get(const void* object) { + assert(ObjectExtension::Register::Id != InvalidId); + if (object == nullptr) { + return nullptr; + } + + auto it = Data.find(std::make_pair(object, ObjectExtension::Register::Id)); + if (it == Data.end()) { + return nullptr; + } + + return std::any_cast(&(it->second)); + } + + // Sets the data of type T for an object. Data will be copied. + template void Set(const void* object, const T&& data) { + assert(ObjectExtension::Register::Id != InvalidId); + if (object != nullptr) { + Data[std::make_pair(object, ObjectExtension::Register::Id)] = data; + } + } + + // Returns true if an object has data of type T associated with it + template bool Has(const void* object) { + assert(ObjectExtension::Register::Id != InvalidId); + if (object == nullptr) { + return false; + } + + return Data.contains(std::make_pair(object, ObjectExtension::Register::Id)); + } + + // Removes data of type T from an object + template void Remove(const void* object) { + assert(ObjectExtension::Register::Id != InvalidId); + + Data.erase(std::make_pair(object, ObjectExtension::Register::Id)); + } + + // Removes all data from an object + void Free(const void* object); + + private: + ObjectExtension() = default; + + // Returns the next free object extension Id + Id RegisterId(); + + ObjectExtension::Id NextId = 0; + + struct KeyHash { + std::size_t operator()(const std::pair& key) const { + return std::hash{}(key.first) ^ (std::hash{}(key.second) << 1); + } + }; + + // Collection of all object extension data. + std::unordered_map, std::any, KeyHash> Data; +}; + +// Static template globals +template ObjectExtension::Id ObjectExtension::Register::Id = ObjectExtension::InvalidId; + +#else // __cplusplus + +void ObjectExtension_Free(const void* object); + +#endif // __cplusplus diff --git a/soh/soh/ResourceManagerHelpers.cpp b/soh/soh/ResourceManagerHelpers.cpp index e1074e517..57e0ab270 100644 --- a/soh/soh/ResourceManagerHelpers.cpp +++ b/soh/soh/ResourceManagerHelpers.cpp @@ -11,7 +11,7 @@ #include "resource/type/Array.h" #include "resource/type/Skeleton.h" #include "resource/type/PlayerAnimation.h" -#include +#include #include extern "C" PlayState* gPlayState; @@ -292,7 +292,7 @@ extern "C" char* ResourceMgr_LoadPlayerAnimByName(const char* animPath) { } extern "C" void ResourceMgr_PushCurrentDirectory(char* path) { - gfx_push_current_dir(path); + Fast::gfx_push_current_dir(path); } extern "C" Gfx* ResourceMgr_LoadGfxByName(const char* path) { diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 97ab6a52a..0b0421fbe 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -922,6 +922,12 @@ void SaveManager::InitFileDebug() { gSaveContext.playerName[i] = sPlayerName[i]; } gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_PAL; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + const static std::array sPlayerName = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; + for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { + gSaveContext.playerName[i] = sPlayerName[i]; + } + gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_NTSC_JPN; } else { // GAME_REGION_NTSC const static std::array sPlayerName = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { @@ -1037,6 +1043,12 @@ void SaveManager::InitFileMaxed() { gSaveContext.playerName[i] = sPlayerName[i]; } gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_PAL; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + const static std::array sPlayerName = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; + for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { + gSaveContext.playerName[i] = sPlayerName[i]; + } + gSaveContext.ship.filenameLanguage = NAME_LANGUAGE_NTSC_JPN; } else { // GAME_REGION_NTSC const static std::array sPlayerName = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; for (int i = 0; i < ARRAY_COUNT(gSaveContext.playerName); i++) { diff --git a/soh/soh/SohGui/ImGuiUtils.cpp b/soh/soh/SohGui/ImGuiUtils.cpp index 87a8b20e6..ab3d8f59c 100644 --- a/soh/soh/SohGui/ImGuiUtils.cpp +++ b/soh/soh/SohGui/ImGuiUtils.cpp @@ -1,5 +1,6 @@ #include "ImGuiUtils.h" #include +#include #include "assets/soh_assets.h" #include "soh/Enhancements/randomizer/rando_hash.h" diff --git a/soh/soh/SohGui/Menu.h b/soh/soh/SohGui/Menu.h index 139f90030..a7facffd1 100644 --- a/soh/soh/SohGui/Menu.h +++ b/soh/soh/SohGui/Menu.h @@ -2,7 +2,7 @@ #define MENU_H #include -#include "graphic/Fast3D/gfx_rendering_api.h" +#include "graphic/Fast3D/backends/gfx_rendering_api.h" #include "MenuTypes.h" namespace Ship { diff --git a/soh/soh/SohGui/ResolutionEditor.cpp b/soh/soh/SohGui/ResolutionEditor.cpp index d33a7b43c..41026e1e2 100644 --- a/soh/soh/SohGui/ResolutionEditor.cpp +++ b/soh/soh/SohGui/ResolutionEditor.cpp @@ -3,7 +3,8 @@ #include #include "soh/SohGui/UIWidgets.hpp" -#include +#include +#include #include "soh/OTRGlobals.h" #include "soh/SohGui/SohMenu.h" #include "soh/SohGui/SohGui.hpp" @@ -86,6 +87,16 @@ static bool disabled_pixelCount; using namespace UIWidgets; +static std::weak_ptr mInterpreter; + +std::shared_ptr GetInterpreter() { + auto intP = mInterpreter.lock(); + if (!intP) { + assert(false && "Lost reference to Fast::Interpreter"); + } + return intP; +} + void ResolutionCustomWidget(WidgetInfo& info) { ImGui::BeginDisabled(disabled_everything); // Vertical Resolution @@ -368,18 +379,23 @@ void ResolutionCustomWidget(WidgetInfo& info) { } void RegisterResolutionWidgets() { + auto fastWnd = dynamic_pointer_cast(Ship::Context::GetInstance()->GetWindow()); + mInterpreter = fastWnd->GetInterpreterWeak(); + WidgetPath path = { "Settings", "Graphics", SECTION_COLUMN_2 }; // Resolution visualiser mSohMenu->AddWidget(path, "Viewport dimensions: {} x {}", WIDGET_TEXT) .RaceDisable(false) .PreFunc([](WidgetInfo& info) { + auto gfx_current_game_window_viewport = GetInterpreter().get()->mGameWindowViewport; info.name = fmt::format("Viewport dimensions: {} x {}", gfx_current_game_window_viewport.width, gfx_current_game_window_viewport.height); }); mSohMenu->AddWidget(path, "Internal resolution: {} x {}", WIDGET_TEXT) .RaceDisable(false) .PreFunc([](WidgetInfo& info) { + auto gfx_current_dimensions = GetInterpreter().get()->mCurDimensions; info.name = fmt::format("Internal resolution: {} x {}", gfx_current_dimensions.width, gfx_current_dimensions.height); }); @@ -486,6 +502,7 @@ void RegisterResolutionWidgets() { } } else if (showHorizontalResField) { // Show calculated aspect ratio if (item_aspectRatio) { + auto gfx_current_dimensions = GetInterpreter().get()->mCurDimensions; ImGui::Dummy({ 0, 2 }); const float resolvedAspectRatio = (float)gfx_current_dimensions.width / gfx_current_dimensions.height; @@ -539,6 +556,8 @@ void UpdateResolutionVars() { short integerScale_maximumBounds = 1; // can change when window is resized // This is mostly just for UX purposes, as Fit Automatically logic is part of LUS. + auto gfx_current_game_window_viewport = GetInterpreter().get()->mGameWindowViewport; + auto gfx_current_dimensions = GetInterpreter().get()->mCurDimensions; if (((float)gfx_current_game_window_viewport.width / gfx_current_game_window_viewport.height) > ((float)gfx_current_dimensions.width / gfx_current_dimensions.height)) { // Scale to window height diff --git a/soh/soh/SohGui/SohGui.cpp b/soh/soh/SohGui/SohGui.cpp index 7eb3fc6c7..e9b27eda1 100644 --- a/soh/soh/SohGui/SohGui.cpp +++ b/soh/soh/SohGui/SohGui.cpp @@ -11,10 +11,9 @@ #include #include #include -#include #ifdef __APPLE__ -#include "graphic/Fast3D/gfx_metal.h" +#include "graphic/Fast3D/backends/gfx_metal.h" #endif #ifdef __SWITCH__ diff --git a/soh/soh/SohGui/SohMenu.h b/soh/soh/SohGui/SohMenu.h index eb3b1f4f7..c3c3f4fd1 100644 --- a/soh/soh/SohGui/SohMenu.h +++ b/soh/soh/SohGui/SohMenu.h @@ -4,7 +4,7 @@ #include #include "UIWidgets.hpp" #include "Menu.h" -#include "graphic/Fast3D/gfx_rendering_api.h" +#include "graphic/Fast3D/backends/gfx_rendering_api.h" #include "soh/cvar_prefixes.h" #include "soh/Enhancements/enhancementTypes.h" #include "soh/Enhancements/Presets/Presets.h" @@ -53,9 +53,9 @@ static const std::unordered_map menuThemeOptions = { }; static const std::unordered_map textureFilteringMap = { - { FILTER_THREE_POINT, "Three-Point" }, - { FILTER_LINEAR, "Linear" }, - { FILTER_NONE, "None" }, + { Fast::FILTER_THREE_POINT, "Three-Point" }, + { Fast::FILTER_LINEAR, "Linear" }, + { Fast::FILTER_NONE, "None" }, }; static const std::unordered_map logLevels = { @@ -135,6 +135,16 @@ static const std::unordered_map bonkDamageValues = { { BONK_DAMAGE_8_HEARTS, "8 Hearts" }, { BONK_DAMAGE_OHKO, "OHKO" }, }; +static const std::unordered_map dampeDropRates = { + { DAMPE_NONE, "None" }, + { DAMPE_NORMAL, "Vanilla" }, + { DAMPE_JALAPENO, "Jalapeño" }, + { DAMPE_CHIPOTLE, "Serrano" }, + { DAMPE_SCOTCH_BONNET, "Habanero" }, + { DAMPE_GHOST_PEPPER, "Ghost Pepper" }, + { DAMPE_INFERNO, "Dampe's Inferno" }, +}; + static const std::unordered_map cursorAnywhereValues = { { PAUSE_ANY_CURSOR_RANDO_ONLY, "Only in Rando" }, { PAUSE_ANY_CURSOR_ALWAYS_ON, "Always" }, @@ -183,13 +193,6 @@ static const std::unordered_map bootSequenceLabels = { { BOOTSEQUENCE_FILESELECT, "File Select" }, }; -static const std::unordered_map enhancementPresetList = { - { ENHANCEMENT_PRESET_DEFAULT, "Default" }, - { ENHANCEMENT_PRESET_VANILLA_PLUS, "Vanilla Plus" }, - { ENHANCEMENT_PRESET_ENHANCED, "Enhanced" }, - { ENHANCEMENT_PRESET_RANDOMIZER, "Randomizer" }, -}; - class SohMenu : public Ship::Menu { public: SohMenu(const std::string& consoleVariable, const std::string& name); diff --git a/soh/soh/SohGui/SohMenuBar.cpp b/soh/soh/SohGui/SohMenuBar.cpp index aa747c168..418d02eb5 100644 --- a/soh/soh/SohGui/SohMenuBar.cpp +++ b/soh/soh/SohGui/SohMenuBar.cpp @@ -5,7 +5,7 @@ #include #include "UIWidgets.hpp" #include "include/z64audio.h" -#include "graphic/Fast3D/gfx_rendering_api.h" +#include "graphic/Fast3D/backends/gfx_rendering_api.h" #include "soh/OTRGlobals.h" #include "soh/SaveManager.h" #include "z64.h" diff --git a/soh/soh/SohGui/SohMenuDevTools.cpp b/soh/soh/SohGui/SohMenuDevTools.cpp index 91d456c95..6a5c292eb 100644 --- a/soh/soh/SohGui/SohMenuDevTools.cpp +++ b/soh/soh/SohGui/SohMenuDevTools.cpp @@ -87,6 +87,17 @@ void SohMenu::AddMenuDevTools() { } }) .SameLine(true); + AddWidget(path, "Log Level", WIDGET_CVAR_COMBOBOX) + .CVar(CVAR_DEVELOPER_TOOLS("LogLevel")) + .Options(ComboboxOptions() + .Tooltip("The log level determines which messages are printed to the console." + " This does not affect the log file output") + .ComboMap(logLevels)) + .Callback([](WidgetInfo& info) { + Ship::Context::GetInstance()->GetLogger()->set_level( + (spdlog::level::level_enum)CVarGetInteger(CVAR_DEVELOPER_TOOLS("LogLevel"), DEBUG_LOG_DEBUG)); + }) + .PreFunc([](WidgetInfo& info) { info.isHidden = mSohMenu->disabledMap.at(DISABLE_FOR_DEBUG_MODE_OFF).active; }); // Stats path.sidebarName = "Stats"; diff --git a/soh/soh/SohGui/SohMenuEnhancements.cpp b/soh/soh/SohGui/SohMenuEnhancements.cpp index 82a1d0fae..4aaf1fb67 100644 --- a/soh/soh/SohGui/SohMenuEnhancements.cpp +++ b/soh/soh/SohGui/SohMenuEnhancements.cpp @@ -4,11 +4,9 @@ #include #include #include -#include #include static std::string comboboxTooltip = ""; -static int32_t enhancementPresetSelected = ENHANCEMENT_PRESET_DEFAULT; bool isBetaQuestEnabled = false; static std::unordered_map bunnyHoodEffectMap = { { BUNNY_HOOD_VANILLA, "Vanilla" }, @@ -34,51 +32,8 @@ void SohMenu::AddMenuEnhancements() { // Add Enhancements Menu AddMenuEntry("Enhancements", CVAR_SETTING("Menu.EnhancementsSidebarSection")); - // Enhancements - WidgetPath path = { "Enhancements", "Presets", SECTION_COLUMN_1 }; - AddSidebarEntry("Enhancements", path.sidebarName, 3); - - const PresetTypeDefinition presetTypeDef = presetTypes.at(PRESET_TYPE_ENHANCEMENTS); - for (auto iter = presetTypeDef.presets.begin(); iter != presetTypeDef.presets.end(); ++iter) { - if (iter->first != 0) - comboboxTooltip += "\n\n"; - comboboxTooltip += std::string(iter->second.label) + " - " + std::string(iter->second.description); - } - AddWidget(path, "Enhancement Presets", WIDGET_SEPARATOR_TEXT); - AddWidget(path, "Select Preset", WIDGET_COMBOBOX) - .ValuePointer(&enhancementPresetSelected) - .Callback([](WidgetInfo& info) { - const std::string presetTypeCvar = - CVAR_GENERAL("SelectedPresets.") + std::to_string(PRESET_TYPE_ENHANCEMENTS); - CVarSetInteger(presetTypeCvar.c_str(), *std::get(info.valuePointer)); - }) - .Options(ComboboxOptions() - .ComboMap(enhancementPresetList) - .DefaultIndex(ENHANCEMENT_PRESET_DEFAULT) - .Tooltip(comboboxTooltip.c_str())); - AddWidget(path, "Apply Preset##Enhancemnts", WIDGET_BUTTON) - .Options(ButtonOptions().Size(UIWidgets::Sizes::Inline)) - .Callback([](WidgetInfo& info) { - const std::string presetTypeCvar = - CVAR_GENERAL("SelectedPresets.") + std::to_string(PRESET_TYPE_ENHANCEMENTS); - const PresetTypeDefinition presetTypeDef = presetTypes.at(PRESET_TYPE_ENHANCEMENTS); - uint16_t selectedPresetId = CVarGetInteger(presetTypeCvar.c_str(), 0); - if (selectedPresetId >= presetTypeDef.presets.size()) { - selectedPresetId = 0; - } - const PresetDefinition selectedPresetDef = presetTypeDef.presets.at(selectedPresetId); - for (const char* block : presetTypeDef.blocksToClear) { - CVarClearBlock(block); - } - if (selectedPresetId != 0) { - applyPreset(selectedPresetDef.entries); - } - CVarSetInteger(presetTypeCvar.c_str(), selectedPresetId); - Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); - }); - // Quality of Life - path.sidebarName = "Quality of Life"; + WidgetPath path = { "Enhancements", "Quality of Life", SECTION_COLUMN_1 }; AddSidebarEntry("Enhancements", path.sidebarName, 3); path.column = SECTION_COLUMN_1; @@ -289,16 +244,16 @@ void SohMenu::AddMenuEnhancements() { .SameLine(true) .Options(ButtonOptions().Size(Sizes::Inline)) .Callback([](WidgetInfo& info) { - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions"), false); - CVarSetInteger(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard"), false); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Intro")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Entrances")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.Story")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.LearnSong")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.BossIntro")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.QuickBossDeaths")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.OnePoint")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipOwlInteractions")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.SkipMiscInteractions")); + CVarClear(CVAR_ENHANCEMENT("TimeSavers.DisableTitleCard")); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); }); @@ -336,8 +291,8 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_ENHANCEMENT("TimeSavers.SkipCutscene.GlitchAiding")) .Options(CheckboxOptions().Tooltip( "Don't skip cutscenes that are associated with useful glitches. Currently, it is " - "only the Fire Temple Darunia CS, Forest Temple Poe Sisters CS, and the Box Skip One " - "Point in Jabu.")); + "only the Fire Temple Darunia CS, Forest Temple Poe Sisters CS, Dodongo Boss " + "Door Switch CS, Water Temple Dragon Switch CS, and the Box Skip One Point in Jabu.")); AddWidget(path, "Text", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Skip Pickup Messages", WIDGET_CVAR_CHECKBOX) @@ -373,6 +328,9 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim")) .Options(CheckboxOptions().Tooltip("Skips Link's taking breath animation after coming up from water. " "This setting does not interfere with getting items from underwater.")); + AddWidget(path, "Empty Bottles Faster", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("FasterBottleEmpty")) + .Options(CheckboxOptions().Tooltip("Speeds up emptying animation when dumping out the contents of a bottle.")); AddWidget(path, "Vine/Ladder Climb Speed +%d", WIDGET_CVAR_SLIDER_INT) .CVar(CVAR_ENHANCEMENT("ClimbSpeed")) .Options(IntSliderOptions().Min(0).Max(12).DefaultValue(0).Format("+%d")); @@ -430,6 +388,10 @@ void SohMenu::AddMenuEnhancements() { AddWidget(path, "Link as Default File Name", WIDGET_CVAR_CHECKBOX) .CVar(CVAR_ENHANCEMENT("LinkDefaultName")) .Options(CheckboxOptions().Tooltip("Allows you to have \"Link\" as a premade file name.")); + AddWidget(path, "Spawn Bean Skulltula Faster", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_ENHANCEMENT("FasterBeanSkull")) + .Options(CheckboxOptions().Tooltip( + "Makes Gold Skulltulas come out of bean patches faster after bugs dig into center.")); AddWidget(path, "Biggoron Forge Time: %d days", WIDGET_CVAR_SLIDER_INT) .CVar(CVAR_ENHANCEMENT("ForgeTime")) .Options(IntSliderOptions().Min(0).Max(3).DefaultValue(3).Format("%d days").Tooltip( @@ -1143,6 +1105,12 @@ void SohMenu::AddMenuEnhancements() { .CVar(CVAR_ENHANCEMENT("TreesDropSticks")) .Options(CheckboxOptions().Tooltip( "Bonking into Trees will have a chance to drop up to 3 Sticks. Must have obtained sticks previously.")); + AddWidget(path, "Dampe Drop Rate", WIDGET_CVAR_COMBOBOX) + .CVar(CVAR_ENHANCEMENT("DampeDropRate")) + .Options(ComboboxOptions() + .ComboMap(dampeDropRates) + .DefaultIndex(DAMPE_NORMAL) + .Tooltip("Adjusts rate Dampe drops flames during race.")); AddWidget(path, "Miscellaneous", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Delete File on Death", WIDGET_CVAR_CHECKBOX) @@ -1608,6 +1576,9 @@ void SohMenu::AddMenuEnhancements() { .Options(CheckboxOptions().Tooltip( "Keese and Guay no longer target you and simply ignore you as if you were wearing the " "Skull Mask.")); + AddWidget(path, "No Dampe Fire", WIDGET_CVAR_CHECKBOX) + .CVar(CVAR_CHEAT("NoDampeFire")) + .Options(CheckboxOptions().Tooltip("Dampe won't drop fireballs during race.")); AddWidget(path, "Glitch Aids", WIDGET_SEPARATOR_TEXT); AddWidget(path, "Easy Frame Advancing with Pause", WIDGET_CVAR_CHECKBOX) diff --git a/soh/soh/SohGui/SohMenuNetwork.cpp b/soh/soh/SohGui/SohMenuNetwork.cpp index 637c78285..bb6004288 100644 --- a/soh/soh/SohGui/SohMenuNetwork.cpp +++ b/soh/soh/SohGui/SohMenuNetwork.cpp @@ -3,6 +3,7 @@ #include #include #include "SohGui.hpp" +#include "soh/OTRGlobals.h" #include #include diff --git a/soh/soh/SohGui/SohMenuRandomizer.cpp b/soh/soh/SohGui/SohMenuRandomizer.cpp index 8f4e6e43b..b95a8049c 100644 --- a/soh/soh/SohGui/SohMenuRandomizer.cpp +++ b/soh/soh/SohGui/SohMenuRandomizer.cpp @@ -1,5 +1,5 @@ #include "SohMenu.h" -#include +#include "soh/OTRGlobals.h" namespace SohGui { diff --git a/soh/soh/SohGui/SohMenuSettings.cpp b/soh/soh/SohGui/SohMenuSettings.cpp index 909c647bd..23bee56dc 100644 --- a/soh/soh/SohGui/SohMenuSettings.cpp +++ b/soh/soh/SohGui/SohMenuSettings.cpp @@ -1,5 +1,6 @@ #include "SohMenu.h" #include "soh/Notification/Notification.h" +#include "soh/OTRGlobals.h" #include #include "soh/ResourceManagerHelpers.h" #include "UIWidgets.hpp" diff --git a/soh/soh/SohGui/UIWidgets.cpp b/soh/soh/SohGui/UIWidgets.cpp index 3c4e91147..774407583 100644 --- a/soh/soh/SohGui/UIWidgets.cpp +++ b/soh/soh/SohGui/UIWidgets.cpp @@ -204,19 +204,19 @@ bool WindowButton(const char* label, const char* cvarName, std::shared_ptrGetID(label); @@ -317,6 +318,7 @@ bool Checkbox(const char* _label, bool* value, const CheckboxOptions& options) { ImGui::ItemSize(total_bb, style.FramePadding.y); if (!ImGui::ItemAdd(total_bb, id)) { + PopStyleCheckbox(); ImGui::EndDisabled(); return false; } @@ -326,14 +328,13 @@ bool Checkbox(const char* _label, bool* value, const CheckboxOptions& options) { *value = !(*value); ImGui::MarkItemEdited(id); } - PushStyleCheckbox(options.color); ImVec2 checkPos = pos; ImVec2 labelPos = pos; if (options.labelPosition == LabelPositions::Above) { checkPos.y += label_size.y + (style.ItemInnerSpacing.y * 2.0f); } else { // Center with checkbox automatically - labelPos.y += ImGui::CalcTextSize("g").y / 8; + labelPos.y += ImGui::GetStyle().FramePadding.y; } if (options.alignment == ComponentAlignments::Right) { checkPos.x = total_bb.Max.x - square_sz; @@ -762,6 +763,9 @@ bool InputString(const char* label, std::string* value, const InputOptions& opti ImGui::BeginGroup(); ImGui::BeginDisabled(options.disabled); PushStyleInput(options.color); + if (options.hasError) { + ImGui::PushStyleColor(ImGuiCol_Border, ColorValues.at(Colors::Red)); + } float width = (options.size == ImVec2(0, 0)) ? ImGui::GetContentRegionAvail().x : options.size.x; if (options.alignment == ComponentAlignments::Left) { if (options.labelPosition == LabelPositions::Above) { @@ -787,11 +791,17 @@ bool InputString(const char* label, std::string* value, const InputOptions& opti ImGui::SameLine(17.0f); ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 0.4f), "%s", options.placeholder.c_str()); } + if (options.hasError) { + ImGui::PopStyleColor(); + } PopStyleInput(); ImGui::EndDisabled(); ImGui::EndGroup(); - if (options.disabled && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && - !Ship_IsCStringEmpty(options.disabledTooltip)) { + if (options.hasError && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && + !Ship_IsCStringEmpty(options.errorText)) { + ImGui::SetTooltip("%s", WrappedText(options.errorText).c_str()); + } else if (options.disabled && ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && + !Ship_IsCStringEmpty(options.disabledTooltip)) { ImGui::SetTooltip("%s", WrappedText(options.disabledTooltip).c_str()); } else if (ImGui::IsItemHovered(ImGuiHoveredFlags_AllowWhenDisabled) && !Ship_IsCStringEmpty(options.tooltip)) { ImGui::SetTooltip("%s", WrappedText(options.tooltip).c_str()); @@ -1018,7 +1028,7 @@ bool CVarRadioButton(const char* text, const char* cvarName, int32_t id, const R std::string make_invisible = "##" + std::string(text) + std::string(cvarName); bool ret = false; - int val = CVarGetInteger(cvarName, 0); + int val = CVarGetInteger(cvarName, options.defaultIndex); PushStyleCheckbox(options.color); if (ImGui::RadioButton(make_invisible.c_str(), id == val)) { CVarSetInteger(cvarName, id); diff --git a/soh/soh/SohGui/UIWidgets.hpp b/soh/soh/SohGui/UIWidgets.hpp index 2382bb7f6..caf2e912b 100644 --- a/soh/soh/SohGui/UIWidgets.hpp +++ b/soh/soh/SohGui/UIWidgets.hpp @@ -194,6 +194,7 @@ struct CheckboxOptions : WidgetOptions { bool defaultValue = false; // Only applicable to CVarCheckbox ComponentAlignments alignment = ComponentAlignments::Left; LabelPositions labelPosition = LabelPositions::Near; + ImVec2 padding = ImVec2(10.0f, 8.0f); Colors color = Colors::LightBlue; CheckboxOptions& DefaultValue(bool defaultValue_) { @@ -220,6 +221,10 @@ struct CheckboxOptions : WidgetOptions { WidgetOptions::disabledTooltip = disabledTooltip_; return *this; } + CheckboxOptions& Padding(ImVec2 padding_) { + padding = padding_; + return *this; + } }; struct ComboboxOptions : WidgetOptions { @@ -394,6 +399,7 @@ struct FloatSliderOptions : WidgetOptions { struct RadioButtonsOptions : WidgetOptions { std::unordered_map buttonMap; + int32_t defaultIndex = 0; Colors color = Colors::LightBlue; RadioButtonsOptions& ButtonMap(std::unordered_map buttonMap_) { @@ -408,6 +414,10 @@ struct RadioButtonsOptions : WidgetOptions { color = color_; return *this; } + RadioButtonsOptions& DefaultIndex(int32_t defaultIndex_) { + defaultIndex = defaultIndex_; + return *this; + } }; struct InputOptions : WidgetOptions { @@ -420,6 +430,8 @@ struct InputOptions : WidgetOptions { std::string defaultValue = ""; bool secret = false; ImGuiInputFlags addedFlags = 0; + bool hasError = false; + const char* errorText = ""; InputOptions& Tooltip(const char* tooltip_) { WidgetOptions::tooltip = tooltip_; @@ -454,6 +466,11 @@ struct InputOptions : WidgetOptions { return *this; } + InputOptions& ComponentAlignment(ComponentAlignments alignment_) { + alignment = alignment_; + return *this; + } + InputOptions& DefaultValue(std::string defaultValue_) { defaultValue = defaultValue_; return *this; @@ -463,6 +480,16 @@ struct InputOptions : WidgetOptions { secret = secret_; return *this; } + + InputOptions& HasError(bool error_ = false) { + hasError = error_; + return *this; + } + + InputOptions& ErrorText(const char* errorText_) { + errorText = errorText_; + return *this; + } }; void PushStyleMenu(const ImVec4& color); @@ -482,8 +509,8 @@ bool Button(const char* label, const ButtonOptions& options = {}); bool WindowButton(const char* label, const char* cvarName, std::shared_ptr windowPtr, const WindowButtonOptions& options = {}); -void PushStyleCheckbox(const ImVec4& color); -void PushStyleCheckbox(Colors color = Colors::LightBlue); +void PushStyleCheckbox(const ImVec4& color, ImVec2 padding = ImVec2(10.0f, 6.0f)); +void PushStyleCheckbox(Colors color = Colors::LightBlue, ImVec2 padding = ImVec2(10.0f, 6.0f)); void PopStyleCheckbox(); void RenderText(ImVec2 pos, const char* text, const char* text_end, bool hide_text_after_hash); bool Checkbox(const char* label, bool* v, const CheckboxOptions& options = {}); @@ -606,9 +633,9 @@ bool Combobox(const char* label, T* value, const std::vector& combo PushStyleCombobox(options.color); const char* longest; - int length = 0; + size_t length = 0; for (auto& string : comboVector) { - int len = strlen(string); + size_t len = strlen(string); if (len > length) { longest = string; length = len; @@ -690,9 +717,9 @@ bool Combobox(const char* label, T* value, const std::vector& combo PushStyleCombobox(options.color); const char* longest; - int length = 0; + size_t length = 0; for (auto& string : comboVector) { - int len = string.length(); + size_t len = string.length(); if (len > length) { longest = string.c_str(); length = len; diff --git a/soh/soh/config/ConfigUpdaters.h b/soh/soh/config/ConfigUpdaters.h index 6ba0bb98e..7912be7de 100644 --- a/soh/soh/config/ConfigUpdaters.h +++ b/soh/soh/config/ConfigUpdaters.h @@ -1,19 +1,19 @@ #include "libultraship/libultraship.h" namespace SOH { -class ConfigVersion1Updater : public Ship::ConfigVersionUpdater { +class ConfigVersion1Updater final : public Ship::ConfigVersionUpdater { public: ConfigVersion1Updater(); void Update(Ship::Config* conf); }; -class ConfigVersion2Updater : public Ship::ConfigVersionUpdater { +class ConfigVersion2Updater final : public Ship::ConfigVersionUpdater { public: ConfigVersion2Updater(); void Update(Ship::Config* conf); }; -class ConfigVersion3Updater : public Ship::ConfigVersionUpdater { +class ConfigVersion3Updater final : public Ship::ConfigVersionUpdater { public: ConfigVersion3Updater(); void Update(Ship::Config* conf); diff --git a/soh/soh/resource/importer/AnimationFactory.h b/soh/soh/resource/importer/AnimationFactory.h index edeaf9749..2312d7ad3 100644 --- a/soh/soh/resource/importer/AnimationFactory.h +++ b/soh/soh/resource/importer/AnimationFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAnimationV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryAnimationV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/ArrayFactory.cpp b/soh/soh/resource/importer/ArrayFactory.cpp index 0d80d1ef4..0762704ff 100644 --- a/soh/soh/resource/importer/ArrayFactory.cpp +++ b/soh/soh/resource/importer/ArrayFactory.cpp @@ -20,7 +20,7 @@ ResourceFactoryBinaryArrayV0::ReadResource(std::shared_ptr file, for (uint32_t i = 0; i < array->ArrayCount; i++) { if (array->ArrayType == ArrayResourceType::Vertex) { // OTRTODO: Implement Vertex arrays as just a vertex resource. - F3DVtx data; + Fast::F3DVtx data; data.v.ob[0] = reader->ReadInt16(); data.v.ob[1] = reader->ReadInt16(); data.v.ob[2] = reader->ReadInt16(); diff --git a/soh/soh/resource/importer/ArrayFactory.h b/soh/soh/resource/importer/ArrayFactory.h index 49978ff69..a64b7a821 100644 --- a/soh/soh/resource/importer/ArrayFactory.h +++ b/soh/soh/resource/importer/ArrayFactory.h @@ -4,7 +4,7 @@ #include "resource/ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryArrayV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryArrayV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/AudioSampleFactory.h b/soh/soh/resource/importer/AudioSampleFactory.h index 028c8fe3d..43b028fd2 100644 --- a/soh/soh/resource/importer/AudioSampleFactory.h +++ b/soh/soh/resource/importer/AudioSampleFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAudioSampleV2 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryAudioSampleV2 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/AudioSequenceFactory.cpp b/soh/soh/resource/importer/AudioSequenceFactory.cpp index 1423c5c3b..4a4a06265 100644 --- a/soh/soh/resource/importer/AudioSequenceFactory.cpp +++ b/soh/soh/resource/importer/AudioSequenceFactory.cpp @@ -15,7 +15,7 @@ ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr f audioSequence->sequence.seqDataSize = reader->ReadInt32(); audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize); - for (uint32_t i = 0; i < audioSequence->sequence.seqDataSize; i++) { + for (int32_t i = 0; i < audioSequence->sequence.seqDataSize; i++) { audioSequence->sequenceData.push_back(reader->ReadChar()); } audioSequence->sequence.seqData = audioSequence->sequenceData.data(); @@ -25,10 +25,10 @@ ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr f audioSequence->sequence.cachePolicy = reader->ReadUByte(); audioSequence->sequence.numFonts = reader->ReadUInt32(); - for (uint32_t i = 0; i < 16; i++) { + for (int32_t i = 0; i < 16; i++) { audioSequence->sequence.fonts[i] = 0; } - for (uint32_t i = 0; i < audioSequence->sequence.numFonts; i++) { + for (int32_t i = 0; i < audioSequence->sequence.numFonts; i++) { audioSequence->sequence.fonts[i] = reader->ReadUByte(); } diff --git a/soh/soh/resource/importer/AudioSequenceFactory.h b/soh/soh/resource/importer/AudioSequenceFactory.h index 138f22099..5ae4ed946 100644 --- a/soh/soh/resource/importer/AudioSequenceFactory.h +++ b/soh/soh/resource/importer/AudioSequenceFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAudioSequenceV2 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryAudioSequenceV2 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/AudioSoundFontFactory.h b/soh/soh/resource/importer/AudioSoundFontFactory.h index 6ea5b2a78..b978a14bf 100644 --- a/soh/soh/resource/importer/AudioSoundFontFactory.h +++ b/soh/soh/resource/importer/AudioSoundFontFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryAudioSoundFontV2 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryAudioSoundFontV2 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/BackgroundFactory.h b/soh/soh/resource/importer/BackgroundFactory.h index 0e6c3fcdf..e9a47a952 100644 --- a/soh/soh/resource/importer/BackgroundFactory.h +++ b/soh/soh/resource/importer/BackgroundFactory.h @@ -4,7 +4,7 @@ #include "resource/ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryBackgroundV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryBackgroundV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/CollisionHeaderFactory.cpp b/soh/soh/resource/importer/CollisionHeaderFactory.cpp index 35e51d2af..39bf885a0 100644 --- a/soh/soh/resource/importer/CollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/CollisionHeaderFactory.cpp @@ -1,6 +1,7 @@ #include "soh/resource/importer/CollisionHeaderFactory.h" #include "soh/resource/type/CollisionHeader.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/CollisionHeaderFactory.h b/soh/soh/resource/importer/CollisionHeaderFactory.h index f72a0a89b..4db21d351 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 Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryCollisionHeaderV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; }; -class ResourceFactoryXMLCollisionHeaderV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLCollisionHeaderV0 final : public Ship::ResourceFactoryXML { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/CutsceneFactory.h b/soh/soh/resource/importer/CutsceneFactory.h index 0be1e6721..95a6f379e 100644 --- a/soh/soh/resource/importer/CutsceneFactory.h +++ b/soh/soh/resource/importer/CutsceneFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryCutsceneV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryCutsceneV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/PathFactory.cpp b/soh/soh/resource/importer/PathFactory.cpp index 6848fde30..945e36c5f 100644 --- a/soh/soh/resource/importer/PathFactory.cpp +++ b/soh/soh/resource/importer/PathFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/Path.h" #include "soh/resource/logging/PathLogger.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/PathFactory.h b/soh/soh/resource/importer/PathFactory.h index 4fe530e10..f94a201c5 100644 --- a/soh/soh/resource/importer/PathFactory.h +++ b/soh/soh/resource/importer/PathFactory.h @@ -5,13 +5,13 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinaryPathV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryPathV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; }; -class ResourceFactoryXMLPathV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLPathV0 final : public Ship::ResourceFactoryXML { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/PlayerAnimationFactory.h b/soh/soh/resource/importer/PlayerAnimationFactory.h index 0487e608f..7761c63b6 100644 --- a/soh/soh/resource/importer/PlayerAnimationFactory.h +++ b/soh/soh/resource/importer/PlayerAnimationFactory.h @@ -4,7 +4,7 @@ #include "ResourceFactoryBinary.h" namespace SOH { -class ResourceFactoryBinaryPlayerAnimationV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryPlayerAnimationV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/SceneFactory.cpp b/soh/soh/resource/importer/SceneFactory.cpp index 9f79cd80c..730842b7e 100644 --- a/soh/soh/resource/importer/SceneFactory.cpp +++ b/soh/soh/resource/importer/SceneFactory.cpp @@ -1,4 +1,5 @@ #include "spdlog/spdlog.h" +#include #include "soh/resource/type/SohResourceType.h" #include "soh/resource/importer/SceneFactory.h" #include "soh/resource/type/Scene.h" diff --git a/soh/soh/resource/importer/SceneFactory.h b/soh/soh/resource/importer/SceneFactory.h index 53e676093..a22291d51 100644 --- a/soh/soh/resource/importer/SceneFactory.h +++ b/soh/soh/resource/importer/SceneFactory.h @@ -8,7 +8,7 @@ #include "ResourceFactoryXML.h" namespace SOH { -class ResourceFactoryBinarySceneV0 : public Ship::ResourceFactoryBinary { +class ResourceFactoryBinarySceneV0 final : public Ship::ResourceFactoryBinary { public: ResourceFactoryBinarySceneV0(); @@ -28,7 +28,7 @@ class ResourceFactoryBinarySceneV0 : public Ship::ResourceFactoryBinary { std::shared_ptr reader, uint32_t index); }; -class ResourceFactoryXMLSceneV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLSceneV0 final : public Ship::ResourceFactoryXML { public: ResourceFactoryXMLSceneV0(); diff --git a/soh/soh/resource/importer/SkeletonFactory.cpp b/soh/soh/resource/importer/SkeletonFactory.cpp index 108d600de..f81476523 100644 --- a/soh/soh/resource/importer/SkeletonFactory.cpp +++ b/soh/soh/resource/importer/SkeletonFactory.cpp @@ -1,6 +1,7 @@ #include "soh/resource/importer/SkeletonFactory.h" #include "soh/resource/type/Skeleton.h" #include +#include #include namespace SOH { @@ -22,7 +23,7 @@ ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr file, skeleton->limbTableCount = reader->ReadUInt32(); skeleton->limbTable.reserve(skeleton->limbTableCount); - for (uint32_t i = 0; i < skeleton->limbTableCount; i++) { + for (int32_t i = 0; i < skeleton->limbTableCount; i++) { std::string limbPath = reader->ReadString(); skeleton->limbTable.push_back(limbPath); diff --git a/soh/soh/resource/importer/SkeletonFactory.h b/soh/soh/resource/importer/SkeletonFactory.h index 610681529..b7c90443f 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 Ship::ResourceFactoryBinary { +class ResourceFactoryBinarySkeletonV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; }; -class ResourceFactoryXMLSkeletonV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLSkeletonV0 final : public Ship::ResourceFactoryXML { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/SkeletonLimbFactory.cpp b/soh/soh/resource/importer/SkeletonLimbFactory.cpp index 7b58976ab..731892f2a 100644 --- a/soh/soh/resource/importer/SkeletonLimbFactory.cpp +++ b/soh/soh/resource/importer/SkeletonLimbFactory.cpp @@ -1,6 +1,7 @@ #include "soh/resource/importer/SkeletonLimbFactory.h" #include "soh/resource/type/SkeletonLimb.h" #include "spdlog/spdlog.h" +#include #include "libultraship/libultraship.h" namespace SOH { diff --git a/soh/soh/resource/importer/SkeletonLimbFactory.h b/soh/soh/resource/importer/SkeletonLimbFactory.h index 5c3430fb3..bcf1fd4d5 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 Ship::ResourceFactoryBinary { +class ResourceFactoryBinarySkeletonLimbV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; }; -class ResourceFactoryXMLSkeletonLimbV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLSkeletonLimbV0 final : public Ship::ResourceFactoryXML { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/TextFactory.cpp b/soh/soh/resource/importer/TextFactory.cpp index 54ed691f8..0a2c1afb4 100644 --- a/soh/soh/resource/importer/TextFactory.cpp +++ b/soh/soh/resource/importer/TextFactory.cpp @@ -1,6 +1,7 @@ #include "soh/resource/importer/TextFactory.h" #include "soh/resource/type/Text.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/TextFactory.h b/soh/soh/resource/importer/TextFactory.h index a00757285..b67f07cbb 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 Ship::ResourceFactoryBinary { +class ResourceFactoryBinaryTextV0 final : public Ship::ResourceFactoryBinary { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; }; -class ResourceFactoryXMLTextV0 : public Ship::ResourceFactoryXML { +class ResourceFactoryXMLTextV0 final : public Ship::ResourceFactoryXML { public: std::shared_ptr ReadResource(std::shared_ptr file, std::shared_ptr initData) override; diff --git a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp index b54f1cade..f96d541f5 100644 --- a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/EndMarker.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr EndMarkerFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h index a8f336896..3ffc956a6 100644 --- a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h +++ b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class EndMarkerFactory : public SceneCommandFactoryBinaryV0 { +class EndMarkerFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class EndMarkerFactoryXML : public SceneCommandFactoryXMLV0 { +class EndMarkerFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp index 94eb62f14..5b9f851d1 100644 --- a/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetActorList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetActorListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetActorListFactory.h b/soh/soh/resource/importer/scenecommand/SetActorListFactory.h index 8d22cb146..febc5d2b8 100644 --- a/soh/soh/resource/importer/scenecommand/SetActorListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetActorListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetActorListFactory : public SceneCommandFactoryBinaryV0 { +class SetActorListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetActorListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetActorListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp index 70b045d07..5a6d35cc2 100644 --- a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetAlternateHeaders.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include #include "libultraship/libultraship.h" namespace SOH { diff --git a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h index e299ceca3..477843603 100644 --- a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetAlternateHeadersFactory : public SceneCommandFactoryBinaryV0 { +class SetAlternateHeadersFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetAlternateHeadersFactoryXML : public SceneCommandFactoryXMLV0 { +class SetAlternateHeadersFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp index 318f6d4fe..e2f4de65b 100644 --- a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetCameraSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h index 19d6a9e00..d25e8b447 100644 --- a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetCameraSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetCameraSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetCameraSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetCameraSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp index c348b8986..cc0a7b005 100644 --- a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp @@ -3,6 +3,7 @@ #include "soh/resource/logging/SceneCommandLoggers.h" #include "libultraship/libultraship.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h index 74628cfb7..da7626701 100644 --- a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetCollisionHeaderFactory : public SceneCommandFactoryBinaryV0 { +class SetCollisionHeaderFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetCollisionHeaderFactoryXML : public SceneCommandFactoryXMLV0 { +class SetCollisionHeaderFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp index eb54b0a22..ed08c88be 100644 --- a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetCsCamera.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetCsCameraFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h index aef0564fb..239713d44 100644 --- a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetCsCameraFactory : public SceneCommandFactoryBinaryV0 { +class SetCsCameraFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetCsCameraFactoryXML : public SceneCommandFactoryXMLV0 { +class SetCsCameraFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp index 20f96ec46..a8883b2e4 100644 --- a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp @@ -3,6 +3,7 @@ #include "soh/resource/logging/SceneCommandLoggers.h" #include #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetCutscenesFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h index 72d430e06..5db5824fc 100644 --- a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetCutscenesFactory : public SceneCommandFactoryBinaryV0 { +class SetCutscenesFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetCutscenesFactoryXML : public SceneCommandFactoryXMLV0 { +class SetCutscenesFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp index f71925bdd..3352a2ef2 100644 --- a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetEchoSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetEchoSettingsFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h index 583bb2ce0..1ce2ff52d 100644 --- a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetEchoSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetEchoSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetEchoSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetEchoSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp index e033e7d79..eab272b89 100644 --- a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetEntranceList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetEntranceListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h index 86187ca5e..e6949f924 100644 --- a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetEntranceListFactory : public SceneCommandFactoryBinaryV0 { +class SetEntranceListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetEntranceListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetEntranceListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp index cc0128a4f..a1cb515ff 100644 --- a/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetExitList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetExitListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetExitListFactory.h b/soh/soh/resource/importer/scenecommand/SetExitListFactory.h index 4e8fb1fbd..3e5da585a 100644 --- a/soh/soh/resource/importer/scenecommand/SetExitListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetExitListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetExitListFactory : public SceneCommandFactoryBinaryV0 { +class SetExitListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetExitListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetExitListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp index 9ef1e944f..ebb819634 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetLightList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetLightListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetLightListFactory.h b/soh/soh/resource/importer/scenecommand/SetLightListFactory.h index 38eed91be..1cc5c5758 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetLightListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetLightListFactory : public SceneCommandFactoryBinaryV0 { +class SetLightListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetLightListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetLightListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp index 545d24f69..01c5d59e1 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetLightingSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h index 153f7743d..eeb3024b9 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetLightingSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetLightingSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetLightingSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetLightingSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp index 05e3169ce..2f6bf5568 100644 --- a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetMesh.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include #include "libultraship/libultraship.h" namespace SOH { diff --git a/soh/soh/resource/importer/scenecommand/SetMeshFactory.h b/soh/soh/resource/importer/scenecommand/SetMeshFactory.h index b26b07775..82430d5b5 100644 --- a/soh/soh/resource/importer/scenecommand/SetMeshFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetMeshFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetMeshFactory : public SceneCommandFactoryBinaryV0 { +class SetMeshFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetMeshFactoryXML : public SceneCommandFactoryXMLV0 { +class SetMeshFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp index 37d340e36..fbee15e8a 100644 --- a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetObjectList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetObjectListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h index d89eee6aa..3b060dd61 100644 --- a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetObjectListFactory : public SceneCommandFactoryBinaryV0 { +class SetObjectListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetObjectListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetObjectListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp index 084d05aae..62a3d0d7f 100644 --- a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetPathways.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include #include namespace SOH { diff --git a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h index ec2e20f9b..7c49e34a9 100644 --- a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetPathwaysFactory : public SceneCommandFactoryBinaryV0 { +class SetPathwaysFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetPathwaysFactoryXML : public SceneCommandFactoryXMLV0 { +class SetPathwaysFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp index de9a01e77..9b18593f5 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetRoomBehavior.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetRoomBehaviorFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h index 7cfe6845a..080adb2b5 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetRoomBehaviorFactory : public SceneCommandFactoryBinaryV0 { +class SetRoomBehaviorFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetRoomBehaviorFactoryXML : public SceneCommandFactoryXMLV0 { +class SetRoomBehaviorFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp index cc03b9f12..7925a012f 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetRoomList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetRoomListFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h index 54fd88cc9..310a42a3b 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetRoomListFactory : public SceneCommandFactoryBinaryV0 { +class SetRoomListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetRoomListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetRoomListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp index 5168b8c32..a071cc4d0 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetSkyboxModifier.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h index e05a016fc..def84cf59 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetSkyboxModifierFactory : public SceneCommandFactoryBinaryV0 { +class SetSkyboxModifierFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetSkyboxModifierFactoryXML : public SceneCommandFactoryXMLV0 { +class SetSkyboxModifierFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp index e5d3c55c3..3434505cb 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetSkyboxSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h index ec0e7aca5..74e48da15 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetSkyboxSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetSkyboxSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetSkyboxSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetSkyboxSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp index 6826eae4c..a72acce8c 100644 --- a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetSoundSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetSoundSettingsFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h index 8cac78994..f6e04a3af 100644 --- a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetSoundSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetSoundSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetSoundSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetSoundSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp index 44adb5d28..2877dc88a 100644 --- a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetSpecialObjects.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h index 648a76ab0..b3be7e3a5 100644 --- a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetSpecialObjectsFactory : public SceneCommandFactoryBinaryV0 { +class SetSpecialObjectsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetSpecialObjectsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetSpecialObjectsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp index 3a8c885ac..d370cde2b 100644 --- a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetStartPositionList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h index 228a24f05..2e71e43e2 100644 --- a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetStartPositionListFactory : public SceneCommandFactoryBinaryV0 { +class SetStartPositionListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetStartPositionListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetStartPositionListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp index 2a3ec29cf..714570208 100644 --- a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetTimeSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetTimeSettingsFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h index 1818c345f..cb886776c 100644 --- a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetTimeSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetTimeSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetTimeSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetTimeSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp index e026302a0..fd028b6e3 100644 --- a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetTransitionActorList.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr diff --git a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h index 344e60990..f4763b021 100644 --- a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetTransitionActorListFactory : public SceneCommandFactoryBinaryV0 { +class SetTransitionActorListFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetTransitionActorListFactoryXML : public SceneCommandFactoryXMLV0 { +class SetTransitionActorListFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp index 7c810c233..86f0af515 100644 --- a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp @@ -2,6 +2,7 @@ #include "soh/resource/type/scenecommand/SetWindSettings.h" #include "soh/resource/logging/SceneCommandLoggers.h" #include "spdlog/spdlog.h" +#include namespace SOH { std::shared_ptr SetWindSettingsFactory::ReadResource(std::shared_ptr initData, diff --git a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h index c9ad2d3d6..bc60ca2d8 100644 --- a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h @@ -3,13 +3,13 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" namespace SOH { -class SetWindSettingsFactory : public SceneCommandFactoryBinaryV0 { +class SetWindSettingsFactory final : public SceneCommandFactoryBinaryV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; -class SetWindSettingsFactoryXML : public SceneCommandFactoryXMLV0 { +class SetWindSettingsFactoryXML final : public SceneCommandFactoryXMLV0 { public: std::shared_ptr ReadResource(std::shared_ptr initData, tinyxml2::XMLElement* reader) override; diff --git a/soh/soh/resource/logging/PathLogger.cpp b/soh/soh/resource/logging/PathLogger.cpp index 437815000..47b0081f3 100644 --- a/soh/soh/resource/logging/PathLogger.cpp +++ b/soh/soh/resource/logging/PathLogger.cpp @@ -1,5 +1,6 @@ #include "soh/resource/type/Path.h" #include "spdlog/spdlog.h" +#include namespace SOH { void LogPathAsXML(std::shared_ptr resource) { diff --git a/soh/soh/resource/logging/SceneCommandLoggers.cpp b/soh/soh/resource/logging/SceneCommandLoggers.cpp index b0821bdb9..8a464172d 100644 --- a/soh/soh/resource/logging/SceneCommandLoggers.cpp +++ b/soh/soh/resource/logging/SceneCommandLoggers.cpp @@ -24,6 +24,7 @@ #include "soh/resource/type/scenecommand/SetTransitionActorList.h" #include "soh/resource/type/scenecommand/SetWindSettings.h" #include "spdlog/spdlog.h" +#include #include namespace SOH { diff --git a/soh/soh/resource/type/Array.cpp b/soh/soh/resource/type/Array.cpp index d9c3b1cb4..a4bbc0e5e 100644 --- a/soh/soh/resource/type/Array.cpp +++ b/soh/soh/resource/type/Array.cpp @@ -23,7 +23,7 @@ size_t Array::GetPointerSize() { size_t typeSize = 0; switch (ArrayType) { case ArrayResourceType::Vertex: - typeSize = sizeof(F3DVtx); + typeSize = sizeof(Fast::F3DVtx); break; case ArrayResourceType::Scalar: default: diff --git a/soh/soh/resource/type/Array.h b/soh/soh/resource/type/Array.h index cefea1bc8..c7d15a22a 100644 --- a/soh/soh/resource/type/Array.h +++ b/soh/soh/resource/type/Array.h @@ -2,7 +2,10 @@ #include "resource/Resource.h" +namespace Fast { union F3DVtx; +} + namespace SOH { typedef union ScalarData { uint8_t u8; @@ -80,6 +83,6 @@ class Array : public Ship::Resource { size_t ArrayCount; // OTRTODO: Should be a vector of resource pointers... std::vector Scalars; - std::vector Vertices; + std::vector Vertices; }; } // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetLightList.h b/soh/soh/resource/type/scenecommand/SetLightList.h index f9ec925ef..d79a73aec 100644 --- a/soh/soh/resource/type/scenecommand/SetLightList.h +++ b/soh/soh/resource/type/scenecommand/SetLightList.h @@ -35,7 +35,7 @@ typedef struct { /* 0x2 */ LightParams params; } LightInfo; // size = 0xE -class SetLightList : public SceneCommand { +class SetLightList final : public SceneCommand { public: using SceneCommand::SceneCommand; diff --git a/soh/soh/resource/type/scenecommand/SetLightingSettings.h b/soh/soh/resource/type/scenecommand/SetLightingSettings.h index c4059d259..cb2089517 100644 --- a/soh/soh/resource/type/scenecommand/SetLightingSettings.h +++ b/soh/soh/resource/type/scenecommand/SetLightingSettings.h @@ -19,7 +19,7 @@ typedef struct { /* 0x14 */ s16 fogFar; } EnvLightSettings; // size = 0x16 -class SetLightingSettings : public SceneCommand { +class SetLightingSettings final : public SceneCommand { public: using SceneCommand::SceneCommand; diff --git a/soh/soh/stubs.c b/soh/soh/stubs.c index 56013e56f..118b36e72 100644 --- a/soh/soh/stubs.c +++ b/soh/soh/stubs.c @@ -145,7 +145,47 @@ void Audio_osWritebackDCache(void* mem, s32 size) { } s32 osAiSetFrequency(u32 freq) { - return 1; + // this is based off the math from the original method + /* + + s32 osAiSetFrequency(u32 frequency) { + u8 bitrate; + f32 dacRateF = ((f32)osViClock / frequency) + 0.5f; + u32 dacRate = dacRateF; + + if (dacRate < 132) { + return -1; + } + + bitrate = (dacRate / 66); + if (bitrate > 16) { + bitrate = 16; + } + + HW_REG(AI_DACRATE_REG, u32) = dacRate - 1; + HW_REG(AI_BITRATE_REG, u32) = bitrate - 1; + return osViClock / (s32)dacRate; + } + + */ + + // bitrate is unused + + // osViClock comes from + // #define VI_NTSC_CLOCK 48681812 /* Hz = 48.681812 MHz */ + // s32 osViClock = VI_NTSC_CLOCK; + + // frequency was originally 32000 + + // given all of that, dacRate is + // (u32)(((f32)48681812 / 32000) + 0.5f) + // which evaluates to 1521 (which is > 132) + + // this leaves us with a final calculation of + // 48681812 / 1521 + // which evaluates to 32006 + + return 32006; } void osInvalDCache(void* vaddr, s32 nbytes) { diff --git a/soh/soh/z_message_OTR.cpp b/soh/soh/z_message_OTR.cpp index bcd301627..ea849af05 100644 --- a/soh/soh/z_message_OTR.cpp +++ b/soh/soh/z_message_OTR.cpp @@ -172,4 +172,7 @@ extern "C" void OTRMessage_Init() { CustomMessage("I'm sorry I can't sell you these fine specimens, they need an #experienced owner#.^" "Come back when you have had #Bombchus# of your own.", { QM_RED, QM_GREEN })); + CustomMessageManager::Instance->CreateMessage( + customMessageTableID, TEXT_BIG_POE_COLLECTED_RANDO, + CustomMessage("You have #" + CustomMessage::POINTS("\x01") + "# points.", { QM_RED })); } diff --git a/soh/src/code/code_800A9F30.c b/soh/src/code/code_800A9F30.c index d0ca380f4..2eba3774c 100644 --- a/soh/src/code/code_800A9F30.c +++ b/soh/src/code/code_800A9F30.c @@ -84,7 +84,7 @@ void func_800AA15C(void) { D_80160FD0.unk_104 = 2; } -void func_800AA16C(void) { +void Rumble_ClearRequests(void) { D_80160FD0.unk_104 = 0; } diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 3ca67ad3b..0b9d20bc5 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -7,6 +7,8 @@ #include "objects/gameplay_keep/gameplay_keep.h" #include "objects/gameplay_dangeon_keep/gameplay_dangeon_keep.h" #include "objects/object_bdoor/object_bdoor.h" +#include "soh/ObjectExtension/ObjectExtension.h" +#include "soh/ObjectExtension/ActorListIndex.h" #include "soh/frame_interpolation.h" #include "soh/Enhancements/cosmetics/cosmeticsTypes.h" #include "soh/Enhancements/enemyrandomizer.h" @@ -2574,7 +2576,11 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { if (play->numSetupActors != 0) { actorEntry = &play->setupActorList[0]; for (i = 0; i < play->numSetupActors; i++) { - Actor_SpawnEntry(&play->actorCtx, actorEntry++, play); + Actor* spawnedActor = Actor_SpawnEntry(&play->actorCtx, actorEntry++, play); + + // #region SOH [ObjectExtension] ActorListIndex tracking + SetActorListIndex(spawnedActor, (s16)i); + // #endregion } play->numSetupActors = 0; GameInteractor_ExecuteOnSceneSpawnActors(); @@ -3352,6 +3358,10 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos return NULL; } + // #region SOH [ObjectExtension] + SetActorListIndex(actor, -1); + // #endregion + assert(dbEntry->numLoaded < 255); dbEntry->numLoaded++; @@ -3391,6 +3401,8 @@ Actor* Actor_Spawn(ActorContext* actorCtx, PlayState* play, s16 actorId, f32 pos Actor_Init(actor, play); gSegments[6] = temp; + GameInteractor_ExecuteOnActorSpawn(actor); + return actor; } @@ -3466,6 +3478,9 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { player = GET_PLAYER(play); + // Execute before actor memory is freed + GameInteractor_ExecuteOnActorDestroy(actor); + dbEntry = ActorDB_Retrieve(actor->id); if (HREG(20) != 0) { @@ -3494,6 +3509,10 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { newHead = Actor_RemoveFromCategory(play, actorCtx, actor); + // #region SOH [ObjectExtension] + ObjectExtension_Free(actor); + // #endregion + ZELDA_ARENA_FREE_DEBUG(actor); dbEntry->numLoaded--; diff --git a/soh/src/code/z_kankyo.c b/soh/src/code/z_kankyo.c index 090cce962..d78a93c6c 100644 --- a/soh/src/code/z_kankyo.c +++ b/soh/src/code/z_kankyo.c @@ -892,7 +892,7 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex if ((((void)0, gSaveContext.gameMode) != GAMEMODE_NORMAL) && (((void)0, gSaveContext.gameMode) != GAMEMODE_END_CREDITS)) { - func_800AA16C(play); + Rumble_ClearRequests(); } if (pauseCtx->state == 0) { diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 3423855b6..cc6245241 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -4113,7 +4113,8 @@ void Interface_DrawItemButtons(PlayState* play) { if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) { X_Margins_CD = Left_HUD_Margin; }; - C_Down_BTN_Pos[0] = (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.PosX"), 0) + X_Margins_CD); + 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) == ANCHOR_RIGHT) { if (CVarGetInteger(CVAR_COSMETIC("HUD.CDownButton.UseMargins"), 0) != 0) { X_Margins_CD = Right_HUD_Margin; diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index c5c600459..58829aee8 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -1289,12 +1289,12 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** D_80160000 = &this->meleeWeaponInfo[2].base; if (!LINK_IS_ADULT) { - if (!(this->skelAnime.moveFlags & 4) || (this->skelAnime.moveFlags & 1)) { + if (!(this->skelAnime.movementFlags & 4) || (this->skelAnime.movementFlags & 1)) { pos->x *= 0.64f; pos->z *= 0.64f; } - if (!(this->skelAnime.moveFlags & 4) || (this->skelAnime.moveFlags & 2)) { + if (!(this->skelAnime.movementFlags & 4) || (this->skelAnime.movementFlags & 2)) { pos->y *= 0.64f; } } diff --git a/soh/src/code/z_skelanime.c b/soh/src/code/z_skelanime.c index 0773eb4e0..e9f84980c 100644 --- a/soh/src/code/z_skelanime.c +++ b/soh/src/code/z_skelanime.c @@ -1170,9 +1170,9 @@ void SkelAnime_InitLink(PlayState* play, SkelAnime* skelAnime, FlexSkeletonHeade */ void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime) { if (skelAnime->mode <= ANIMMODE_LOOP_INTERP) { - skelAnime->update = LinkAnimation_Loop; + skelAnime->update.link = LinkAnimation_Loop; } else { - skelAnime->update = LinkAnimation_Once; + skelAnime->update.link = LinkAnimation_Once; } skelAnime->morphWeight = 0.0f; } @@ -1182,7 +1182,7 @@ void LinkAnimation_SetUpdateFunction(SkelAnime* skelAnime) { * finishes. */ s32 LinkAnimation_Update(PlayState* play, SkelAnime* skelAnime) { - return skelAnime->update(play, skelAnime); + return skelAnime->update.link(play, skelAnime); } /** @@ -1294,7 +1294,7 @@ void LinkAnimation_Change(PlayState* play, SkelAnime* skelAnime, LinkAnimationHe SkelAnime_CopyFrameTable(skelAnime, skelAnime->morphTable, skelAnime->jointTable); morphFrames = -morphFrames; } else { - skelAnime->update = LinkAnimation_Morph; + skelAnime->update.link = LinkAnimation_Morph; AnimationContext_SetLoadFrame(play, animation, (s32)startFrame, skelAnime->limbCount, skelAnime->morphTable); } @@ -1559,11 +1559,11 @@ s32 SkelAnime_InitSkin(PlayState* play, SkelAnime* skelAnime, SkeletonHeader* sk */ void SkelAnime_SetUpdate(SkelAnime* skelAnime) { if (skelAnime->mode <= ANIMMODE_LOOP_INTERP) { - skelAnime->update = SkelAnime_LoopFull; + skelAnime->update.normal = SkelAnime_LoopFull; } else if (skelAnime->mode <= ANIMMODE_ONCE_INTERP) { - skelAnime->update = SkelAnime_Once; + skelAnime->update.normal = SkelAnime_Once; } else { - skelAnime->update = SkelAnime_LoopPartial; + skelAnime->update.normal = SkelAnime_LoopPartial; } } @@ -1572,7 +1572,7 @@ void SkelAnime_SetUpdate(SkelAnime* skelAnime) { * finishes. */ s32 SkelAnime_Update(SkelAnime* skelAnime) { - return skelAnime->update(skelAnime); + return skelAnime->update.normal(skelAnime); } /** @@ -1741,10 +1741,10 @@ void Animation_ChangeImpl(SkelAnime* skelAnime, AnimationHeader* animation, f32 morphFrames = -morphFrames; } else { if (taper != ANIMTAPER_NONE) { - skelAnime->update = SkelAnime_MorphTaper; + skelAnime->update.normal = SkelAnime_MorphTaper; skelAnime->taper = taper; } else { - skelAnime->update = SkelAnime_Morph; + skelAnime->update.normal = SkelAnime_Morph; } SkelAnime_GetFrameData(animation, startFrame, skelAnime->limbCount, skelAnime->morphTable); } @@ -1895,7 +1895,7 @@ void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle) { f32 sin; f32 cos; - if (skelAnime->moveFlags & ANIM_FLAG_NOMOVE) { + if (skelAnime->movementFlags & ANIM_FLAG_NOMOVE) { diff->x = diff->z = 0.0f; } else { x = skelAnime->jointTable[0].x; @@ -1917,8 +1917,8 @@ void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle) { skelAnime->jointTable[0].x = skelAnime->baseTransl.x; skelAnime->prevTransl.z = skelAnime->jointTable[0].z; skelAnime->jointTable[0].z = skelAnime->baseTransl.z; - if (skelAnime->moveFlags & ANIM_FLAG_UPDATEY) { - if (skelAnime->moveFlags & ANIM_FLAG_NOMOVE) { + if (skelAnime->movementFlags & ANIM_FLAG_UPDATEY) { + if (skelAnime->movementFlags & ANIM_FLAG_NOMOVE) { diff->y = 0.0f; } else { diff->y = skelAnime->jointTable[0].y - skelAnime->prevTransl.y; @@ -1929,7 +1929,7 @@ void SkelAnime_UpdateTranslation(SkelAnime* skelAnime, Vec3f* diff, s16 angle) { diff->y = 0.0f; skelAnime->prevTransl.y = skelAnime->jointTable[0].y; } - skelAnime->moveFlags &= ~ANIM_FLAG_NOMOVE; + skelAnime->movementFlags &= ~ANIM_FLAG_NOMOVE; } /** 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 04aff53be..692497415 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 @@ -6,6 +6,7 @@ #include "z_bg_mori_kaitenkabe.h" #include "objects/object_mori_objects/object_mori_objects.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS 0 @@ -97,7 +98,9 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play) { if ((this->timer > (28 - CVarGetInteger(CVAR_ENHANCEMENT("FasterBlockPush"), 0) * 4)) && !Player_InCsMode(play)) { BgMoriKaitenkabe_SetupRotate(this); - Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, 8); + if (GameInteractor_Should(VB_FREEZE_LINK_FOR_FOREST_PILLARS, true)) { + Player_SetCsActionWithHaltedActors(play, &this->dyna.actor, 8); + } Math_Vec3f_Copy(&this->lockedPlayerPos, &player->actor.world.pos); push.x = Math_SinS(this->dyna.unk_158); push.y = 0.0f; @@ -131,7 +134,9 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { Math_StepToF(&this->rotSpeed, 0.6f, 0.02f); if (Math_StepToF(&this->rotYdeg, this->rotDirection * 45.0f, this->rotSpeed)) { BgMoriKaitenkabe_SetupWait(this); - Player_SetCsActionWithHaltedActors(play, thisx, 7); + if (GameInteractor_Should(VB_FREEZE_LINK_FOR_FOREST_PILLARS, true)) { + Player_SetCsActionWithHaltedActors(play, thisx, 7); + } if (this->rotDirection > 0.0f) { thisx->home.rot.y += 0x2000; } else { @@ -148,7 +153,9 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { this->dyna.unk_150 = 0.0f; player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } - Math_Vec3f_Copy(&player->actor.world.pos, &this->lockedPlayerPos); + if (GameInteractor_Should(VB_FREEZE_LINK_FOR_FOREST_PILLARS, true)) { + Math_Vec3f_Copy(&player->actor.world.pos, &this->lockedPlayerPos); + } } void BgMoriKaitenkabe_Update(Actor* thisx, PlayState* play) { diff --git a/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index 44b67f1bb..29debf9d6 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -175,19 +175,19 @@ void DemoEc_UpdateBgFlags(DemoEc* this, PlayState* play) { } void func_8096D594(DemoEc* this, PlayState* play) { - this->skelAnime.moveFlags |= 3; + this->skelAnime.movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_8096D5D4(DemoEc* this, PlayState* play) { this->skelAnime.baseTransl = this->skelAnime.jointTable[0]; this->skelAnime.prevTransl = this->skelAnime.jointTable[0]; - this->skelAnime.moveFlags |= 3; + this->skelAnime.movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_8096D64C(DemoEc* this, PlayState* play) { - this->skelAnime.moveFlags |= 3; + this->skelAnime.movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } diff --git a/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c b/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c index 825ee35dc..e7ba4364e 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -55,12 +55,12 @@ s32 DemoIk_CheckCue(PlayState* play, u16 action, s32 index) { } void DemoIk_SetMove(DemoIk* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void DemoIk_EndMove(DemoIk* this) { - this->skelAnime.moveFlags &= ~1; + this->skelAnime.movementFlags &= ~1; } f32 DemoIk_GetCurFrame(DemoIk* this) { diff --git a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c index ad1c76a3d..3d50bf330 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c +++ b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c @@ -7,6 +7,7 @@ #include "z_demo_kekkai.h" #include "objects/object_demo_kekkai/object_demo_kekkai.h" #include "scenes/dungeons/ganontika/ganontika_scene.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #include "soh/ResourceManagerHelpers.h" #define FLAGS (ACTOR_FLAG_UPDATE_CULLING_DISABLED | ACTOR_FLAG_DRAW_CULLING_DISABLED) @@ -257,13 +258,15 @@ void DemoKekkai_TrialBarrierIdle(Actor* thisx, PlayState* play) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); if (this->collider2.base.acFlags & AC_HIT) { - Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); - // "I got it" - LOG_STRING("当ったよ"); - this->actor.update = DemoKekkai_TrialBarrierDispel; - this->timer = 0; - play->csCtx.segment = SEGMENTED_TO_VIRTUAL(sSageCutscenes[this->actor.params]); - gSaveContext.cutsceneTrigger = 1; + if (GameInteractor_Should(VB_PLAY_DISPEL_BARRIER_CS, true, this)) { + Sfx_PlaySfxCentered(NA_SE_SY_CORRECT_CHIME); + // "I got it" + LOG_STRING("当ったよ"); + this->actor.update = DemoKekkai_TrialBarrierDispel; + this->timer = 0; + play->csCtx.segment = SEGMENTED_TO_VIRTUAL(sSageCutscenes[this->actor.params]); + gSaveContext.cutsceneTrigger = 1; + } } CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider2.base); func_8002F974(&this->actor, NA_SE_EV_TOWER_ENERGY - SFX_FLAG); diff --git a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h index 4e4a06c18..a8df145c2 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h +++ b/soh/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.h @@ -6,7 +6,7 @@ struct DemoKekkai; -typedef void (*DemoKekkaiUpdateFunc)(struct DemoKekkai* this, PlayState* play); +typedef void (*DemoKekkaiUpdateFunc)(struct DemoKekkai* thisx, PlayState* play); typedef struct DemoKekkai { /* 0x0000 */ Actor actor; diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 40239a1e3..372962042 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -288,19 +288,21 @@ void func_80A2F83C(EnGb* this, PlayState* play) { } } if (Actor_ProcessTalkRequest(&this->dyna.actor, play)) { - switch (func_8002F368(play)) { - case EXCH_ITEM_NONE: - func_80A2F180(this); - this->actionFunc = func_80A2F94C; - break; - case EXCH_ITEM_POE: - player->actor.textId = 0x70F6; - this->actionFunc = func_80A2F9C0; - break; - case EXCH_ITEM_BIG_POE: - player->actor.textId = 0x70F7; - this->actionFunc = func_80A2FA50; - break; + if (GameInteractor_Should(VB_SELL_POES_TO_POE_COLLECTOR, true, this)) { + switch (func_8002F368(play)) { + case EXCH_ITEM_NONE: + func_80A2F180(this); + this->actionFunc = func_80A2F94C; + break; + case EXCH_ITEM_POE: + player->actor.textId = 0x70F6; + this->actionFunc = func_80A2F9C0; + break; + case EXCH_ITEM_BIG_POE: + player->actor.textId = 0x70F7; + this->actionFunc = func_80A2FA50; + break; + } } return; } diff --git a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h index 6df73808e..2ff4f64ff 100644 --- a/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h +++ b/soh/src/overlays/actors/ovl_En_Gb/z_en_gb.h @@ -47,6 +47,7 @@ typedef struct EnGb { /* 0x0388 */ EnGbCagedSoul cagedSouls[4]; } EnGb; // size = 0x0438 -void func_80A2FC0C(EnGb* actor, PlayState* play); +void func_80A2FB40(EnGb* actor, PlayState* play); +void func_80A2F83C(EnGb* actor, PlayState* play); #endif diff --git a/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index 61a10b056..192d749d4 100644 --- a/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/soh/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -314,19 +314,21 @@ void func_80A5372C(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); - this->unk_2F2[0] = 200; - this->cameraId = Play_CreateSubCamera(play); - Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); - Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE); - this->unk_280.x = 947.0f; - this->unk_280.y = 1195.0f; - this->unk_280.z = 2682.0f; + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) { + this->unk_2F2[0] = 200; + this->cameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE); + this->unk_280.x = 947.0f; + this->unk_280.y = 1195.0f; + this->unk_280.z = 2682.0f; - this->unk_28C.x = 1164.0f; - this->unk_28C.y = 1145.0f; - this->unk_28C.z = 3014.0f; + this->unk_28C.x = 1164.0f; + this->unk_28C.y = 1145.0f; + this->unk_28C.z = 3014.0f; - Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + } this->actionFunc = func_80A53850; } @@ -334,11 +336,15 @@ void func_80A53850(EnHeishi2* this, PlayState* play) { BgSpot15Saku* gate; SkelAnime_Update(&this->skelAnime); - Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) { + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + } gate = (BgSpot15Saku*)this->gate; if ((this->unk_2F2[0] == 0) || (gate->unk_168 == 0)) { - Play_ClearCamera(play, this->cameraId); - Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, true)) { + Play_ClearCamera(play, this->cameraId); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + } Message_CloseTextbox(play); this->unk_30C = 1; Player_SetCsActionWithHaltedActors(play, NULL, 7); @@ -479,23 +485,25 @@ void func_80A53DF8(EnHeishi2* this, PlayState* play) { f32 frameCount = Animation_GetLastFrame(&gEnHeishiIdleAnim); Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); - this->unk_2F2[0] = 200; - this->cameraId = Play_CreateSubCamera(play); - Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); - Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE); - this->unk_2BC.x = -71.0f; - this->unk_280.x = -71.0f; - this->unk_2BC.y = 571.0f; - this->unk_280.y = 571.0f; - this->unk_2BC.z = -1487.0f; - this->unk_280.z = -1487.0f; - this->unk_298.x = 181.0f; - this->unk_28C.x = 181.0f; - this->unk_298.y = 417.0f; - this->unk_28C.y = 417.0f; - this->unk_298.z = -1079.0f; - this->unk_28C.z = -1079.0f; - Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) { + this->unk_2F2[0] = 200; + this->cameraId = Play_CreateSubCamera(play); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_WAIT); + Play_ChangeCameraStatus(play, this->cameraId, CAM_STAT_ACTIVE); + this->unk_2BC.x = -71.0f; + this->unk_280.x = -71.0f; + this->unk_2BC.y = 571.0f; + this->unk_280.y = 571.0f; + this->unk_2BC.z = -1487.0f; + this->unk_280.z = -1487.0f; + this->unk_298.x = 181.0f; + this->unk_28C.x = 181.0f; + this->unk_298.y = 417.0f; + this->unk_28C.y = 417.0f; + this->unk_298.z = -1079.0f; + this->unk_28C.z = -1079.0f; + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + } this->actionFunc = func_80A53F30; } @@ -503,11 +511,15 @@ void func_80A53F30(EnHeishi2* this, PlayState* play) { BgGateShutter* gate; SkelAnime_Update(&this->skelAnime); - Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, false)) { + Play_CameraSetAtEye(play, this->cameraId, &this->unk_280, &this->unk_28C); + } gate = (BgGateShutter*)this->gate; if ((this->unk_2F2[0] == 0) || (gate->openingState == 0)) { - Play_ClearCamera(play, this->cameraId); - Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + if (GameInteractor_Should(VB_PLAY_GATE_OPENING_OR_CLOSING_CS, true, this, true)) { + Play_ClearCamera(play, this->cameraId); + Play_ChangeCameraStatus(play, MAIN_CAM, CAM_STAT_ACTIVE); + } if ((this->unk_30A != 2)) { if (this->unk_30A == 0) { this->actor.textId = 0x2015; diff --git a/soh/src/overlays/actors/ovl_En_In/z_en_in.c b/soh/src/overlays/actors/ovl_En_In/z_en_in.c index e84d4d8ff..18903bfbb 100644 --- a/soh/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/soh/src/overlays/actors/ovl_En_In/z_en_in.c @@ -342,7 +342,7 @@ void func_80A795C8(EnIn* this, PlayState* play) { void func_80A79690(SkelAnime* skelAnime, EnIn* this, PlayState* play) { if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { - skelAnime->moveFlags |= 3; + skelAnime->movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } diff --git a/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 73c966288..5acfe5a80 100644 --- a/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -743,7 +743,7 @@ void EnNb_InitDemo6KInConfrontation(EnNb* this, PlayState* play) { } void func_80AB2688(EnNb* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } diff --git a/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index 4d42cd39a..ac13107cf 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/soh/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -712,7 +712,7 @@ void EnPoField_SoulInteract(EnPoField* this, PlayState* play) { if (this->actor.params == 0) { Item_Give(play, ITEM_POE); this->actor.textId = 0x5008; - } else { + } else if (GameInteractor_Should(VB_BOTTLE_BIG_POE, true, this)) { this->actor.textId = 0x508F; Item_Give(play, ITEM_BIG_POE); Flags_SetSwitch(play, sEnPoFieldSpawnSwitchFlags[this->spawnFlagIndex]); diff --git a/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index 41ee2d5c6..d850021a4 100644 --- a/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/soh/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -8,6 +8,8 @@ #include "overlays/actors/ovl_En_Honotrap/z_en_honotrap.h" #include "objects/object_tk/object_tk.h" #include "soh/ResourceManagerHelpers.h" +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" #define FLAGS \ (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED | \ @@ -197,7 +199,7 @@ void EnPoRelay_Race(EnPoRelay* this, PlayState* play) { if (this->actionTimer != 0) { this->actionTimer--; } - if (this->actionTimer == 0 && Rand_ZeroOne() < 0.03f) { + if (GameInteractor_Should(VB_DAMPE_DROP_FLAME, this->actionTimer == 0 && Rand_ZeroOne() < 0.03f, this)) { this->actionTimer = 32; if (this->pathIndex < 23) { speed = Rand_ZeroOne() * 3.0f; diff --git a/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index d70e0af12..e03a8ed20 100644 --- a/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -393,17 +393,17 @@ s32 EnRu1_UpdateSkelAnime(EnRu1* this) { } void func_80AEB364(EnRu1* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_80AEB3A4(EnRu1* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; func_80AEB364(this, play); } void func_80AEB3CC(EnRu1* this) { - this->skelAnime.moveFlags &= ~0x1; + this->skelAnime.movementFlags &= ~0x1; } void func_80AEB3DC(EnRu1* this, PlayState* play) { @@ -464,7 +464,7 @@ void func_80AEB6E0(EnRu1* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { - skelAnime->moveFlags |= 3; + skelAnime->movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } @@ -475,13 +475,13 @@ void func_80AEB738(EnRu1* this, PlayState* play) { skelAnime->baseTransl = skelAnime->jointTable[0]; skelAnime->prevTransl = skelAnime->jointTable[0]; if (skelAnime->baseTransl.y < skelAnime->jointTable[0].y) { - skelAnime->moveFlags |= 3; + skelAnime->movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } void func_80AEB7D0(EnRu1* this) { - this->skelAnime.moveFlags &= ~0x3; + this->skelAnime.movementFlags &= ~0x3; } f32 func_80AEB7E0(CsCmdActorCue* csCmdNPCAction, PlayState* play) { diff --git a/soh/src/overlays/actors/ovl_En_Test/z_en_test.c b/soh/src/overlays/actors/ovl_En_Test/z_en_test.c index 72969cc2e..0bcf45a8b 100644 --- a/soh/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/soh/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -1595,7 +1595,7 @@ void func_8086318C(EnTest* this, PlayState* play) { void EnTest_SetupRecoil(EnTest* this) { this->meleeWeaponState = 0; - this->skelAnime.moveFlags = 2; + this->skelAnime.movementFlags = 2; this->unk_7C8 = 0x13; this->skelAnime.playSpeed = -1.0f; this->skelAnime.startFrame = this->skelAnime.curFrame; diff --git a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c index 30f035c5d..84500db21 100644 --- a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -249,25 +249,25 @@ void func_80B3C8CC(EnXc* this, PlayState* play) { SkelAnime* skelAnime = &this->skelAnime; if (skelAnime->jointTable[0].y >= skelAnime->baseTransl.y) { - skelAnime->moveFlags |= 3; + skelAnime->movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, skelAnime, 1.0f); } } void func_80B3C924(EnXc* this, PlayState* play) { - this->skelAnime.moveFlags |= 3; + this->skelAnime.movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_80B3C964(EnXc* this, PlayState* play) { this->skelAnime.baseTransl = this->skelAnime.jointTable[0]; this->skelAnime.prevTransl = this->skelAnime.jointTable[0]; - this->skelAnime.moveFlags |= 3; + this->skelAnime.movementFlags |= 3; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } void func_80B3C9DC(EnXc* this) { - this->skelAnime.moveFlags &= ~0x3; + this->skelAnime.movementFlags &= ~0x3; } void func_80B3C9EC(EnXc* this) { diff --git a/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 380f80bc9..c02744959 100644 --- a/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -348,7 +348,7 @@ void func_80B4B834(CsCmdActorCue* npcAction, Vec3f* pos) { } void func_80B4B874(EnZl1* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } diff --git a/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index 42a3942dd..aab3e9505 100644 --- a/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -305,7 +305,7 @@ void EnZl4_UpdateFace(EnZl4* this) { } void EnZl4_SetMove(EnZl4* this, PlayState* play) { - this->skelAnime.moveFlags |= 1; + this->skelAnime.movementFlags |= 1; AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, 1.0f); } diff --git a/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c b/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c index a3541a246..34606904b 100644 --- a/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c +++ b/soh/src/overlays/actors/ovl_Obj_Hsblock/z_obj_hsblock.c @@ -53,12 +53,12 @@ void ObjHsblock_SetupAction(ObjHsblock* this, ObjHsblockActionFunc actionFunc) { this->actionFunc = actionFunc; } -void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision, s32 moveFlags) { +void func_80B93B68(ObjHsblock* this, PlayState* play, CollisionHeader* collision, s32 movementFlags) { s32 pad; CollisionHeader* colHeader = NULL; s32 pad2[2]; - DynaPolyActor_Init(&this->dyna, moveFlags); + DynaPolyActor_Init(&this->dyna, movementFlags); CollisionHeader_GetVirtual(collision, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(play, &play->colCtx.dyna, &this->dyna.actor, colHeader); if (this->dyna.bgId == BG_ACTOR_MAX) { diff --git a/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index 1fb3effc1..c193ede65 100644 --- a/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/soh/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -7,6 +7,8 @@ #include "z_obj_makekinsuta.h" #include "vt.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" + #define FLAGS ACTOR_FLAG_UPDATE_CULLING_DISABLED void ObjMakekinsuta_Init(Actor* thisx, PlayState* play); @@ -47,7 +49,7 @@ void ObjMakekinsuta_Init(Actor* thisx, PlayState* play) { void func_80B98320(ObjMakekinsuta* this, PlayState* play) { if (this->unk_152 != 0) { - if (this->timer >= 60 && !func_8002DEEC(GET_PLAYER(play))) { + if (GameInteractor_Should(VB_SPAWN_BEAN_SKULLTULA, this->timer >= 60) && !func_8002DEEC(GET_PLAYER(play))) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_SW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, (this->actor.params | 0x8000), true); this->actionFunc = ObjMakekinsuta_DoNothing; 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 4da9e0deb..6cc57ca22 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -1926,14 +1926,14 @@ void Player_ZeroRootLimbYaw(Player* this) { * it can also be called within action functions to change animations in the middle of an action. */ void Player_FinishAnimMovement(Player* this) { - if (this->skelAnime.moveFlags != 0) { + if (this->skelAnime.movementFlags != 0) { Player_ApplyYawFromAnim(this); this->skelAnime.jointTable[0].x = this->skelAnime.baseTransl.x; this->skelAnime.jointTable[0].z = this->skelAnime.baseTransl.z; - if (this->skelAnime.moveFlags & 8) { - if (this->skelAnime.moveFlags & 2) { + if (this->skelAnime.movementFlags & 8) { + if (this->skelAnime.movementFlags & 2) { this->skelAnime.jointTable[0].y = this->skelAnime.prevTransl.y; } } else { @@ -1942,7 +1942,7 @@ void Player_FinishAnimMovement(Player* this) { Player_ResetAnimMovement(this); - this->skelAnime.moveFlags = 0; + this->skelAnime.movementFlags = 0; } } @@ -1958,7 +1958,7 @@ void Player_FinishAnimMovement(Player* this) { void Player_ApplyAnimMovementScaledByAge(Player* this, s32 movementFlags) { Vec3f diff; - this->skelAnime.moveFlags = movementFlags; + this->skelAnime.movementFlags = movementFlags; this->skelAnime.prevTransl = this->skelAnime.baseTransl; SkelAnime_UpdateTranslation(&this->skelAnime, &diff, this->actor.shape.rot.y); @@ -2005,7 +2005,7 @@ void Player_ApplyAnimMovementScaledByAge(Player* this, s32 movementFlags) { void Player_StartAnimMovement(PlayState* play, Player* this, s32 flags) { if (flags & PLAYER_ANIM_MOVEMENT_RESET_BY_AGE) { Player_ResetAnimMovementScaledByAge(this); - } else if ((flags & PLAYER_ANIM_MOVEMENT_RESET) || (this->skelAnime.moveFlags != 0)) { + } else if ((flags & PLAYER_ANIM_MOVEMENT_RESET) || (this->skelAnime.movementFlags != 0)) { // If AnimMovement is already in use when this function is called and // `PLAYER_ANIM_MOVEMENT_RESET_BY_AGE` is not set, then this case will be used. Player_ResetAnimMovement(this); @@ -2017,7 +2017,7 @@ void Player_StartAnimMovement(PlayState* play, Player* this, s32 flags) { } // Remove Player specific flags by masking the lower byte before setting to `skelAnime.movementFlags` - this->skelAnime.moveFlags = flags /*&& 0xFF*/; + this->skelAnime.movementFlags = flags /*&& 0xFF*/; Player_ZeroSpeedXZ(this); AnimationContext_DisableQueue(play); @@ -3138,7 +3138,7 @@ s32 func_80835588(Player* this, PlayState* play) { void Player_SetParallel(Player* this) { this->stateFlags1 |= PLAYER_STATE1_PARALLEL; - if (!(this->skelAnime.moveFlags & 0x80) && (this->actor.bgCheckFlags & 0x200) && + if (!(this->skelAnime.movementFlags & 0x80) && (this->actor.bgCheckFlags & 0x200) && (sShapeYawToTouchedWall < 0x2000)) { // snap to the wall this->yaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; @@ -3362,14 +3362,14 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun void Player_SetupActionPreserveAnimMovement(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { s32 savedMovementFlags; - savedMovementFlags = this->skelAnime.moveFlags; + savedMovementFlags = this->skelAnime.movementFlags; // Setting `skelAnime.movementFlags` to 0 will prevent `Player_FinishAnimMovement` from ending // AnimMovement when `Player_SetupAction` is called. - this->skelAnime.moveFlags = 0; + this->skelAnime.movementFlags = 0; Player_SetupAction(play, this, actionFunc, flags); - this->skelAnime.moveFlags = savedMovementFlags; + this->skelAnime.movementFlags = savedMovementFlags; } /** @@ -5779,7 +5779,7 @@ void func_8083AA10(Player* this, PlayState* play) { return; } - if (!(this->stateFlags3 & PLAYER_STATE3_MIDAIR) && !(this->skelAnime.moveFlags & 0x80) && + if (!(this->stateFlags3 & PLAYER_STATE3_MIDAIR) && !(this->skelAnime.movementFlags & 0x80) && (Player_Action_8084411C != this->actionFunc) && (Player_Action_80844A44 != this->actionFunc)) { if ((sPrevFloorProperty == 7) || (this->meleeWeaponState != 0)) { @@ -6927,7 +6927,7 @@ void func_8083D53C(PlayState* play, Player* this) { } } else if ((this->stateFlags1 & PLAYER_STATE1_IN_WATER) && (this->actor.yDistToWater < this->ageProperties->unk_24)) { - if ((this->skelAnime.moveFlags == 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) { + if ((this->skelAnime.movementFlags == 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) { Player_SetupTurnInPlace(play, this, this->actor.shape.rot.y); } func_8083D0A8(play, this, this->actor.velocity.y); @@ -12059,7 +12059,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { func_8084FF7C(this); } - if (!(this->skelAnime.moveFlags & 0x80)) { + if (!(this->skelAnime.movementFlags & 0x80)) { if (((this->actor.bgCheckFlags & 1) && (sFloorType == 5) && (this->currentBoots != PLAYER_BOOTS_IRON)) || ((this->currentBoots == PLAYER_BOOTS_HOVER || GameInteractor_GetSlipperyFloorActive()) && !(this->stateFlags1 & (PLAYER_STATE1_IN_WATER | PLAYER_STATE1_IN_CUTSCENE)))) { @@ -12246,9 +12246,9 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Player_UpdateCamAndSeqModes(play, this); - if (this->skelAnime.moveFlags & 8) { + if (this->skelAnime.movementFlags & 8) { AnimationContext_SetMoveActor(play, &this->actor, &this->skelAnime, - (this->skelAnime.moveFlags & 4) ? 1.0f : this->ageProperties->unk_08); + (this->skelAnime.movementFlags & 4) ? 1.0f : this->ageProperties->unk_08); } Player_UpdateShapeYaw(this, play); @@ -13113,7 +13113,7 @@ void Player_Action_Talk(Player* this, PlayState* play) { } else if (func_808332B8(this)) { Player_Action_8084D610(this, play); } else if (!Player_CheckHostileLockOn(this) && LinkAnimation_Update(play, &this->skelAnime)) { - if (this->skelAnime.moveFlags != 0) { + if (this->skelAnime.movementFlags != 0) { Player_FinishAnimMovement(this); if ((this->talkActor->category == ACTORCAT_NPC) && (this->heldItemAction != PLAYER_IA_FISHING_POLE)) { @@ -13551,8 +13551,8 @@ void Player_Action_8084C760(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (!(this->stateFlags1 & PLAYER_STATE1_LOADING)) { - if (this->skelAnime.moveFlags != 0) { - this->skelAnime.moveFlags = 0; + if (this->skelAnime.movementFlags != 0) { + this->skelAnime.movementFlags = 0; return; } @@ -14752,6 +14752,8 @@ static AnimSfxEntry D_80854A34[] = { void Player_Action_8084EFC0(Player* this, PlayState* play) { Player_DecelerateToZero(this); + GameInteractor_Should(VB_EMPTYING_BOTTLE, true, this); + if (LinkAnimation_Update(play, &this->skelAnime)) { func_8083C0E8(this, play); func_8005B1A4(Play_GetCamera(play, 0)); @@ -15259,7 +15261,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (!Player_ActionHandler_7(this, play)) { - u8 sp43 = this->skelAnime.moveFlags; + u8 sp43 = this->skelAnime.movementFlags; LinkAnimationHeader* sp3C; if (Player_CheckHostileLockOn(this)) { @@ -15269,7 +15271,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) { } func_80832318(this); - this->skelAnime.moveFlags = 0; + this->skelAnime.movementFlags = 0; if ((sp3C == &gPlayerAnim_link_fighter_Lpower_jump_kiru_end) && (this->modelAnimType != PLAYER_ANIMTYPE_3)) { @@ -15278,7 +15280,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) { func_8083A098(this, sp3C, play); - this->skelAnime.moveFlags = sp43; + this->skelAnime.movementFlags = sp43; this->stateFlags3 |= PLAYER_STATE3_FINISHED_ATTACKING; } } else if (this->heldItemAction == PLAYER_IA_HAMMER) { @@ -16551,7 +16553,7 @@ void func_80852A54(PlayState* play, Player* this, CsCmdActorCue* cue) { func_808529D0(play, this, cue); } - this->skelAnime.moveFlags = 0; + this->skelAnime.movementFlags = 0; Player_ZeroRootLimbYaw(this); } @@ -16562,7 +16564,7 @@ void func_80852B4C(PlayState* play, Player* this, CsCmdActorCue* cue, struct_808 arg3->func(play, this, cue); } - if ((D_80858AA0 & 4) && !(this->skelAnime.moveFlags & 4)) { + if ((D_80858AA0 & 4) && !(this->skelAnime.movementFlags & 4)) { this->skelAnime.morphTable[0].y /= this->ageProperties->unk_08; D_80858AA0 = 0; } @@ -16601,7 +16603,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cue) { } } - D_80858AA0 = this->skelAnime.moveFlags; + D_80858AA0 = this->skelAnime.movementFlags; Player_FinishAnimMovement(this); osSyncPrintf("TOOL MODE=%d\n", sp24); @@ -16624,7 +16626,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cue) { void Player_Action_CsAction(Player* this, PlayState* play) { if (this->csAction != this->prevCsAction) { - D_80858AA0 = this->skelAnime.moveFlags; + D_80858AA0 = this->skelAnime.movementFlags; Player_FinishAnimMovement(this); this->prevCsAction = this->csAction; 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 6dae312ac..78b167442 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 @@ -1086,10 +1086,6 @@ static s16 sLastFileChooseButtonIndex; * Update function for `CM_MAIN_MENU` */ void FileChoose_UpdateMainMenu(GameState* thisx) { - static u8 emptyName[] = { 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E, 0x3E }; - static u8 emptyNameNES[] = { 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; - static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E }; - static u8 linkNameNES[] = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; bool dpad = CVarGetInteger(CVAR_SETTING("DpadInText"), 0); @@ -1300,6 +1296,7 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) { static u8 emptyNameNES[] = { 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E }; static u8 linkNameNES[] = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; + static u8 linkNameJP[] = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; FileChoose_UpdateStickDirectionPromptAnim(thisx); FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; @@ -1369,6 +1366,14 @@ void FileChoose_UpdateQuestMenu(GameState* thisx) { this->nameEntryBoxAlpha = 0; if (ResourceMgr_GetGameRegion(0) == GAME_REGION_PAL && gSaveContext.language != LANGUAGE_JPN) { defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkName : &emptyName; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + if (CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) != 0) { + // Set player name to "リンク" ("Link" in Katakana, 3 characters long) when playing in Japanese. + defaultName = &linkNameJP; + this->newFileNameCharCount = 3; + } else { + defaultName = &emptyNameNES; + } } else { // GAME_REGION_NTSC defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkNameNES : &emptyNameNES; } @@ -1544,6 +1549,7 @@ void FileChoose_UpdateRandomizerMenu(GameState* thisx) { static u8 emptyNameNES[] = { 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; static u8 linkName[] = { 0x15, 0x2C, 0x31, 0x2E, 0x3E, 0x3E, 0x3E, 0x3E }; static u8 linkNameNES[] = { 0xB6, 0xB3, 0xB8, 0xB5, 0xDF, 0xDF, 0xDF, 0xDF }; + static u8 linkNameJP[] = { 0x81, 0x87, 0x61, 0xDF, 0xDF, 0xDF, 0xDF, 0xDF }; u8* defaultName; this->prevConfigMode = this->configMode; @@ -1561,6 +1567,14 @@ void FileChoose_UpdateRandomizerMenu(GameState* thisx) { this->nameEntryBoxAlpha = 0; if (ResourceMgr_GetGameRegion(0) == GAME_REGION_PAL && gSaveContext.language != LANGUAGE_JPN) { defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkName : &emptyName; + } else if (gSaveContext.language == LANGUAGE_JPN) { // Japanese + if (CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) != 0) { + // Set player name to "リンク" ("Link" in Katakana, 3 characters long) when playing in Japanese. + defaultName = &linkNameJP; + this->newFileNameCharCount = 3; + } else { + defaultName = &emptyNameNES; + } } else { // GAME_REGION_NTSC defaultName = CVarGetInteger(CVAR_ENHANCEMENT("LinkDefaultName"), 0) ? &linkNameNES : &emptyNameNES; }