From 8a14fea94c07332bcf61a135076d930073e1d2da Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 8 Feb 2024 20:28:02 -0500 Subject: [PATCH 01/44] support LUS archivemanager refactor (#3912) --- OTRExporter | 2 +- libultraship | 2 +- soh/soh/Enhancements/debugger/dlViewer.cpp | 4 +- soh/soh/Enhancements/tts/tts.cpp | 16 +++--- soh/soh/OTRGlobals.cpp | 59 +++++++++++----------- soh/soh/SohMenuBar.cpp | 3 +- soh/soh/resource/importer/SceneFactory.cpp | 2 +- soh/soh/z_message_OTR.cpp | 2 +- 8 files changed, 44 insertions(+), 46 deletions(-) diff --git a/OTRExporter b/OTRExporter index 44adc47b4..d8f3c4dd4 160000 --- a/OTRExporter +++ b/OTRExporter @@ -1 +1 @@ -Subproject commit 44adc47b4da529e72d968b14cab94aefd8260f22 +Subproject commit d8f3c4dd4a46fb46c4f69cd387afadfa711606e9 diff --git a/libultraship b/libultraship index 0833afad6..825bd1275 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 0833afad66e96d2ec4bbc410186d7247dc243ee2 +Subproject commit 825bd1275bc26a8532f07a887db5141cd635df13 diff --git a/soh/soh/Enhancements/debugger/dlViewer.cpp b/soh/soh/Enhancements/debugger/dlViewer.cpp index 9ed250615..da44a908a 100644 --- a/soh/soh/Enhancements/debugger/dlViewer.cpp +++ b/soh/soh/Enhancements/debugger/dlViewer.cpp @@ -66,7 +66,7 @@ std::map cmdMap = { }; void PerformDisplayListSearch() { - auto result = LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->ListFiles("*" + std::string(searchString) + "*DL*"); + auto result = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles("*" + std::string(searchString) + "*DL*"); std::regex dlSearch(".*((DL)|(DL_.*))$"); @@ -134,7 +134,7 @@ void DLViewerWindow::DrawElement() { try { auto res = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(activeDisplayList)); - if (res->GetInitData()->Type != LUS::ResourceType::DisplayList) { + if (res->GetInitData()->Type != static_cast(LUS::ResourceType::DisplayList)) { ImGui::Text("Resource type is not a Display List. Please choose another."); ImGui::End(); return; diff --git a/soh/soh/Enhancements/tts/tts.cpp b/soh/soh/Enhancements/tts/tts.cpp index 0b46cd18f..1ed6eafa5 100644 --- a/soh/soh/Enhancements/tts/tts.cpp +++ b/soh/soh/Enhancements/tts/tts.cpp @@ -1037,24 +1037,24 @@ void InitTTSBank() { break; } - auto sceneFile = LUS::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/scenes" + languageSuffix); + auto sceneFile = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFileRaw("accessibility/texts/scenes" + languageSuffix); if (sceneFile != nullptr) { - sceneMap = nlohmann::json::parse(sceneFile->Buffer, nullptr, true, true); + sceneMap = nlohmann::json::parse(*sceneFile->Buffer.get(), nullptr, true, true); } - auto miscFile = LUS::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/misc" + languageSuffix); + auto miscFile = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFileRaw("accessibility/texts/misc" + languageSuffix); if (miscFile != nullptr) { - miscMap = nlohmann::json::parse(miscFile->Buffer, nullptr, true, true); + miscMap = nlohmann::json::parse(*miscFile->Buffer.get(), nullptr, true, true); } - auto kaleidoFile = LUS::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/kaleidoscope" + languageSuffix); + auto kaleidoFile = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFileRaw("accessibility/texts/kaleidoscope" + languageSuffix); if (kaleidoFile != nullptr) { - kaleidoMap = nlohmann::json::parse(kaleidoFile->Buffer, nullptr, true, true); + kaleidoMap = nlohmann::json::parse(*kaleidoFile->Buffer.get(), nullptr, true, true); } - auto fileChooseFile = LUS::Context::GetInstance()->GetResourceManager()->LoadFile("accessibility/texts/filechoose" + languageSuffix); + auto fileChooseFile = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->LoadFileRaw("accessibility/texts/filechoose" + languageSuffix); if (fileChooseFile != nullptr) { - fileChooseMap = nlohmann::json::parse(fileChooseFile->Buffer, nullptr, true, true); + fileChooseMap = nlohmann::json::parse(*fileChooseFile->Buffer.get(), nullptr, true, true); } } diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 283d35e53..62a8bdd3d 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -319,19 +319,19 @@ OTRGlobals::OTRGlobals() { SPDLOG_INFO("Starting Ship of Harkinian version {}", (char*)gBuildVersion); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Animation, "Animation", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_PlayerAnimation, "PlayerAnimation", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Room, "Room", std::make_shared()); // Is room scene? maybe? - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_CollisionHeader, "CollisionHeader", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Skeleton, "Skeleton", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_SkeletonLimb, "SkeletonLimb", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Path, "Path", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Cutscene, "Cutscene", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Text, "Text", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_AudioSample, "AudioSample", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_AudioSoundFont, "AudioSoundFont", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_AudioSequence, "AudioSequence", std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(LUS::ResourceType::SOH_Background, "Background", std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Animation), std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_PlayerAnimation), std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Room), std::make_shared()); // Is room scene? maybe? + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_CollisionHeader), std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Skeleton), std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_SkeletonLimb), std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Path), std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Cutscene), std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Text), std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_AudioSample), std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_AudioSoundFont), std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_AudioSequence), std::make_shared()); + context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Background), std::make_shared()); gSaveStateMgr = std::make_shared(); gRandomizer = std::make_shared(); @@ -354,7 +354,7 @@ OTRGlobals::OTRGlobals() { cameraStrings[i] = dup; } - auto versions = context->GetResourceManager()->GetArchive()->GetGameVersions(); + auto versions = context->GetResourceManager()->GetArchiveManager()->GetGameVersions(); for (uint32_t version : versions) { if (!ValidHashes.contains(version)) { @@ -836,7 +836,7 @@ extern "C" RandomizerGet RetrieveRandomizerGetFromItemID(ItemID itemID) { } extern "C" void OTRExtScanner() { - auto lst = *LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->ListFiles("*").get(); + auto lst = *LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles().get(); for (auto& rPath : lst) { std::vector raw = StringHelper::Split(rPath, "."); @@ -859,11 +859,11 @@ OTRVersion ReadPortVersionFromOTR(std::string otrPath) { OTRVersion version = {}; // Use a temporary archive instance to load the otr and read the version file - auto archive = std::make_shared(otrPath, "", std::unordered_set(), false); - if (archive->IsMainMPQValid()) { - auto t = archive->LoadFile("portVersion", false); + auto archive = LUS::OtrArchive(otrPath); + if (archive.LoadRaw()) { + auto t = archive.LoadFileRaw("portVersion"); if (t != nullptr && t->IsLoaded) { - auto stream = std::make_shared(t->Buffer.data(), t->Buffer.size()); + auto stream = std::make_shared(t->Buffer->data(), t->Buffer->size()); auto reader = std::make_shared(stream); LUS::Endianness endianness = (LUS::Endianness)reader->ReadUByte(); reader->SetEndianness(endianness); @@ -871,10 +871,9 @@ OTRVersion ReadPortVersionFromOTR(std::string otrPath) { version.minor = reader->ReadUInt16(); version.patch = reader->ReadUInt16(); } + archive.UnloadRaw(); } - archive = nullptr; - return version; } @@ -1412,15 +1411,15 @@ extern "C" uint16_t OTRGetPixelDepth(float x, float y) { } extern "C" uint32_t ResourceMgr_GetNumGameVersions() { - return LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions().size(); + return LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions().size(); } extern "C" uint32_t ResourceMgr_GetGameVersion(int index) { - return LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index]; + return LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; } extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) { - uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index]; + uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; switch (version) { case OOT_NTSC_US_10: @@ -1443,7 +1442,7 @@ extern "C" uint32_t ResourceMgr_GetGamePlatform(int index) { } extern "C" uint32_t ResourceMgr_GetGameRegion(int index) { - uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->GetGameVersions()[index]; + uint32_t version = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->GetGameVersions()[index]; switch (version) { case OOT_NTSC_US_10: @@ -1529,7 +1528,7 @@ extern "C" void ResourceMgr_UnloadResource(const char* resName) { // OTRTODO: There is probably a more elegant way to go about this... // Kenix: This is definitely leaking memory when it's called. extern "C" char** ResourceMgr_ListFiles(const char* searchMask, int* resultSize) { - auto lst = LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->ListFiles(searchMask); + auto lst = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(searchMask); char** result = (char**)malloc(lst->size() * sizeof(char*)); for (size_t i = 0; i < lst->size(); i++) { @@ -1619,7 +1618,7 @@ extern "C" uint8_t ResourceMgr_TexIsRaw(const char* texPath) { extern "C" uint8_t ResourceMgr_ResourceIsBackground(char* texPath) { auto res = GetResourceByNameHandlingMQ(texPath); - return res->GetInitData()->Type == LUS::ResourceType::SOH_Background; + return res->GetInitData()->Type == static_cast(LUS::ResourceType::SOH_Background); } extern "C" char* ResourceMgr_LoadJPEG(char* data, size_t dataSize) @@ -1667,9 +1666,9 @@ extern "C" uint16_t ResourceMgr_LoadTexHeightByName(char* texPath); extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) { auto res = GetResourceByNameHandlingMQ(filePath); - if (res->GetInitData()->Type == LUS::ResourceType::DisplayList) + if (res->GetInitData()->Type == static_cast(LUS::ResourceType::DisplayList)) return (char*)&((std::static_pointer_cast(res))->Instructions[0]); - else if (res->GetInitData()->Type == LUS::ResourceType::Array) + else if (res->GetInitData()->Type == static_cast(LUS::ResourceType::Array)) return (char*)(std::static_pointer_cast(res))->Vertices.data(); else { return (char*)GetResourceDataByNameHandlingMQ(filePath); @@ -1679,7 +1678,7 @@ extern "C" char* ResourceMgr_LoadTexOrDListByName(const char* filePath) { extern "C" char* ResourceMgr_LoadIfDListByName(const char* filePath) { auto res = GetResourceByNameHandlingMQ(filePath); - if (res->GetInitData()->Type == LUS::ResourceType::DisplayList) + if (res->GetInitData()->Type == static_cast(LUS::ResourceType::DisplayList)) return (char*)&((std::static_pointer_cast(res))->Instructions[0]); return nullptr; diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index f59e3a343..f8dc26ad4 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -201,8 +201,7 @@ void DrawSettingsMenu() { static std::unordered_map audioBackendNames = { { LUS::AudioBackend::WASAPI, "Windows Audio Session API" }, - { LUS::AudioBackend::PULSE, "PulseAudio" }, - { LUS::AudioBackend::SDL, "SDL" }, + { LUS::AudioBackend::SDL, "SDL" } }; ImGui::Text("Audio API (Needs reload)"); diff --git a/soh/soh/resource/importer/SceneFactory.cpp b/soh/soh/resource/importer/SceneFactory.cpp index 01066ffc1..b71f78a2c 100644 --- a/soh/soh/resource/importer/SceneFactory.cpp +++ b/soh/soh/resource/importer/SceneFactory.cpp @@ -109,7 +109,7 @@ std::shared_ptr SceneFactoryV0::ParseSceneCommand(std::shared_ptr if (commandFactory != nullptr) { auto initData = std::make_shared(); initData->Id = scene->GetInitData()->Id; - initData->Type = ResourceType::SOH_SceneCommand; + initData->Type = static_cast(ResourceType::SOH_SceneCommand); initData->Path = scene->GetInitData()->Path + "/SceneCommand" + std::to_string(index); initData->ResourceVersion = scene->GetInitData()->ResourceVersion; result = std::static_pointer_cast(commandFactory->ReadResource(initData, reader)); diff --git a/soh/soh/z_message_OTR.cpp b/soh/soh/z_message_OTR.cpp index a4255d08a..ce594879a 100644 --- a/soh/soh/z_message_OTR.cpp +++ b/soh/soh/z_message_OTR.cpp @@ -23,7 +23,7 @@ static void SetMessageEntry(MessageTableEntry& entry, const LUS::MessageEntry& m } static void OTRMessage_LoadCustom(const std::string& folderPath, MessageTableEntry*& table, size_t tableSize) { - auto lst = *LUS::Context::GetInstance()->GetResourceManager()->GetArchive()->ListFiles(folderPath).get(); + auto lst = *LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folderPath).get(); for (auto& tPath : lst) { auto file = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(tPath)); From c1eb0a897019993f16b9f0603b51b136a1ea7bcc Mon Sep 17 00:00:00 2001 From: Archez Date: Tue, 13 Feb 2024 20:55:33 -0500 Subject: [PATCH 02/44] Bump latest LUS and Fix ship menu bar icon (#3935) * fix ship menu bar icon * update cmake in wiiu/switch * different cmake install * wrong arch --- .github/workflows/generate-builds.yml | 6 ++++++ libultraship | 2 +- soh/soh/SohMenuBar.cpp | 4 ++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/generate-builds.yml b/.github/workflows/generate-builds.yml index 6f7134282..582022dbd 100644 --- a/.github/workflows/generate-builds.yml +++ b/.github/workflows/generate-builds.yml @@ -221,6 +221,9 @@ jobs: run: | sudo apt-get update sudo apt-get install -y ninja-build + sudo apt-get remove -y cmake + wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.sh -O /tmp/cmake.sh + sudo sh /tmp/cmake.sh --prefix=/usr/local/ --exclude-subdir - name: Fix dubious ownership error if: ${{ vars.LINUX_RUNNER }} run: git config --global --add safe.directory '*' @@ -264,6 +267,9 @@ jobs: run: | sudo apt-get update sudo apt-get install -y ninja-build + sudo apt-get remove -y cmake + wget https://github.com/Kitware/CMake/releases/download/v3.28.3/cmake-3.28.3-linux-x86_64.sh -O /tmp/cmake.sh + sudo sh /tmp/cmake.sh --prefix=/usr/local/ --exclude-subdir - uses: actions/checkout@v3 with: submodules: true diff --git a/libultraship b/libultraship index 825bd1275..d5a39635a 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit 825bd1275bc26a8532f07a887db5141cd635df13 +Subproject commit d5a39635a118f814613c0fdd1601f80c809a742d diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index f8dc26ad4..858c12da7 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -111,11 +111,11 @@ namespace SohGui { void DrawMenuBarIcon() { static bool gameIconLoaded = false; if (!gameIconLoaded) { - LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTexture("Game_Icon", "textures/icons/gIcon.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Game_Icon", "textures/icons/gIcon.png"); gameIconLoaded = true; } - if (LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Game_Icon")) { + if (LUS::Context::GetInstance()->GetWindow()->GetGui()->HasTextureByName("Game_Icon")) { #ifdef __SWITCH__ ImVec2 iconSize = ImVec2(20.0f, 20.0f); float posScale = 1.0f; From 3187564f5b4120e159f5e506b4a3db88716b56aa Mon Sep 17 00:00:00 2001 From: mckinlee Date: Thu, 15 Feb 2024 20:13:54 -0500 Subject: [PATCH 03/44] Pause Warp Enhancement (#3223) * Pause Warp Enhancement This commit introduces the PauseWarp mod, a feature that allows players to warp to different locations in the game directly from the pause menu. - Add PauseWarpState structure to manage flags and cooldowns for the pause warp feature. - Implement IsStateValid function for state validation. - Implement ResetStateFlags function to reset all state flags to default values. - Add InitiateWarp function to handle the initiation of warp sequences. - Implement HandleWarpConfirmation function to confirm and execute warp actions. - Implement HandleCooldowns function to manage various cooldown timers. - Add PauseWarp_Main function as the main logic, called every frame to handle pause warp functionality. - Map warp song messages to in-game text messages. * Warp Song Check -Now if you do not have a warp song you won't be able to select the empty slot and still teleport. * Added Audio Fanfares and Changed stateFlag1 to PLAYER_STATE1_IN_CUTSCENE -When selecting a warp song the audio for the applicable warp song will now play for a extra vanilla feel. -Changed the stateFlag1 because previously it just disabled input allowing enemies to harm you. Now that won't happen because the game is put into a cutscene state. * Feedback Update -A new hook was created 'OnPauseMenu' so now PauseWarp_Main is only called when the pause menu is open -Moved pauswarp.c to the Enhancements folder -Removed from graph.c PR Change: Changing to the main branch instead of sulu * Feedback Update #2 -Introduced new function 'PauseWarp_Idle' now that 'PauseWarp_Main' is no longer called every frame -Added C wrapper to access 'GameInteractor::IsSaveLoaded' and scrapped the 'IsStateValid' function -Added 'PauseWarp_Idle' to the the 'RegisterPauseWarp' function -Refactored the code some * Linux Compile Issue -Added a missing header that was causing a compile issue for linux -Hopefully, it won't crash * Minor Bug Fix -Now link won't get soft locked when warping to the same location twice * Update libultraship * Revert "Update libultraship" This reverts commit 746fc234795c06261a4fb69484f4656676f1eaaa. * Bug Fix -Added more checks to ensure vanilla behavior when a Ocarina is not in the players inventory. * WIP * Done unless I'm missing headers * now we done * clean up, these arn't needed anymore * Rename OnPauseMenu to OnKaleidoUpdate --- soh/include/functions.h | 4 + .../game-interactor/GameInteractor.h | 1 + .../game-interactor/GameInteractor_Hooks.cpp | 6 ++ .../game-interactor/GameInteractor_Hooks.h | 3 + soh/soh/Enhancements/mods.cpp | 18 ++++ soh/soh/Enhancements/pausewarp.c | 92 +++++++++++++++++++ soh/soh/SohMenuBar.cpp | 2 + soh/src/code/z_kaleido_scope_call.c | 3 + 8 files changed, 129 insertions(+) create mode 100644 soh/soh/Enhancements/pausewarp.c diff --git a/soh/include/functions.h b/soh/include/functions.h index 3898ea63d..2c4fe9b15 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -2467,6 +2467,10 @@ void Message_DrawText(PlayState* play, Gfx** gfxP); void Interface_CreateQuadVertexGroup(Vtx* vtxList, s32 xStart, s32 yStart, s32 width, s32 height, u8 flippedH); void Interface_RandoRestoreSwordless(void); +//Pause Warp +void PauseWarp_HandleSelection(); +void PauseWarp_Execute(); + // #endregion #ifdef __cplusplus diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index be27e74a2..3e70da37a 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -221,6 +221,7 @@ public: DEFINE_HOOK(OnFileDropped, void(std::string filePath)); DEFINE_HOOK(OnAssetAltChange, void()); + DEFINE_HOOK(OnKaleidoUpdate, void()); // Helpers static bool IsSaveLoaded(); diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp index 4bd5354a6..911c47a71 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.cpp @@ -187,3 +187,9 @@ void GameInteractor_ExecuteOnSetGameLanguage() { void GameInteractor_RegisterOnAssetAltChange(void (*fn)(void)) { GameInteractor::Instance->RegisterGameHook(fn); } + +//MARK: Pause Menu + +void GameInteractor_ExecuteOnKaleidoUpdate() { + GameInteractor::Instance->ExecuteHooks(); +} diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h index 7b7b226fa..5c86cb39b 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_Hooks.h @@ -60,6 +60,9 @@ void GameInteractor_ExecuteOnSetGameLanguage(); // MARK: - System void GameInteractor_RegisterOnAssetAltChange(void (*fn)(void)); +//Mark: - Pause Menu +void GameInteractor_ExecuteOnKaleidoUpdate(); + #ifdef __cplusplus } #endif diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index f829d767f..8b65cdcbe 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -1304,6 +1304,23 @@ void RegisterToTMedallions() { }); } +void RegisterPauseMenuHooks() { + static bool pauseWarpHooksRegistered = false; + GameInteractor::Instance->RegisterGameHook([&]() { + if (!GameInteractor::IsSaveLoaded() || !CVarGetInteger("gPauseWarp", 0)) { + pauseWarpHooksRegistered = false; + return; + } + if (!pauseWarpHooksRegistered) { + GameInteractor::Instance->RegisterGameHook([]() {PauseWarp_HandleSelection();}); + GameInteractor::Instance->RegisterGameHook([]() { + PauseWarp_Execute(); + }); + pauseWarpHooksRegistered = true; + } + }); +} + void InitMods() { RegisterTTS(); RegisterInfiniteMoney(); @@ -1340,4 +1357,5 @@ void InitMods() { NameTag_RegisterHooks(); RegisterPatchHandHandler(); RegisterHurtContainerModeHandler(); + RegisterPauseMenuHooks(); } diff --git a/soh/soh/Enhancements/pausewarp.c b/soh/soh/Enhancements/pausewarp.c new file mode 100644 index 000000000..e0fd97e24 --- /dev/null +++ b/soh/soh/Enhancements/pausewarp.c @@ -0,0 +1,92 @@ +#include "custom-message/CustomMessageTypes.h" +#include "global.h" +#include "z64.h" +#include "game-interactor/GameInteractor.h" + +static const int songMessageMap[] = { + TEXT_WARP_MINUET_OF_FOREST, + TEXT_WARP_BOLERO_OF_FIRE, + TEXT_WARP_SERENADE_OF_WATER, + TEXT_WARP_REQUIEM_OF_SPIRIT, + TEXT_WARP_NOCTURNE_OF_SHADOW, + TEXT_WARP_PRELUDE_OF_LIGHT +}; + +static const int ocarinaSongMap[] = { + OCARINA_SONG_MINUET, + OCARINA_SONG_BOLERO, + OCARINA_SONG_SERENADE, + OCARINA_SONG_REQUIEM, + OCARINA_SONG_NOCTURNE, + OCARINA_SONG_PRELUDE +}; + +static const int entranceIndexMap[] = { + ENTR_SACRED_FOREST_MEADOW_2, // Minuet + ENTR_DEATH_MOUNTAIN_CRATER_4, // Bolero + ENTR_LAKE_HYLIA_8, // Serenade + ENTR_DESERT_COLOSSUS_5, // Requiem + ENTR_GRAVEYARD_7, // Nocturne + ENTR_TEMPLE_OF_TIME_7 // Prelude +}; + +static const int songAudioMap[] = { + NA_BGM_OCA_MINUET, + NA_BGM_OCA_BOLERO, + NA_BGM_OCA_SERENADE, + NA_BGM_OCA_REQUIEM, + NA_BGM_OCA_NOCTURNE, + NA_BGM_OCA_LIGHT +}; + +static bool isWarpActive = false; + +void PauseWarp_Execute() { + if (!isWarpActive || gPlayState->msgCtx.msgMode != MSGMODE_NONE) { + return; + } + isWarpActive = false; + GET_PLAYER(gPlayState)->stateFlags1 &= ~PLAYER_STATE1_IN_CUTSCENE; + if (gPlayState->msgCtx.choiceIndex != 0) { + return; + } + if (IS_RANDO) { + Entrance_SetWarpSongEntrance(); + return; + } + gPlayState->transitionTrigger = TRANS_TRIGGER_START; + gPlayState->transitionType = TRANS_TYPE_FADE_WHITE_FAST; + for (int i = 0; i < ARRAY_COUNT(ocarinaSongMap); i++) { + if (gPlayState->msgCtx.lastPlayedSong == ocarinaSongMap[i]) { + gPlayState->nextEntranceIndex = entranceIndexMap[i]; + return; + } + } + gPlayState->transitionTrigger = TRANS_TRIGGER_OFF; +} + +void ActivateWarp(PauseContext* pauseCtx, int song) { + Audio_OcaSetInstrument(0); + Interface_SetDoAction(gPlayState, DO_ACTION_NONE); + pauseCtx->state = 0x12; + WREG(2) = -6240; + func_800F64E0(0); + pauseCtx->unk_1E4 = 0; + int idx = song - QUEST_SONG_MINUET; + gPlayState->msgCtx.lastPlayedSong = ocarinaSongMap[idx]; + Audio_SetSoundBanksMute(0x20); + Audio_PlayFanfare(songAudioMap[idx]); + Message_StartTextbox(gPlayState, songMessageMap[idx], NULL); + GET_PLAYER(gPlayState)->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; + isWarpActive = true; +} + +void PauseWarp_HandleSelection() { + if (gSaveContext.inventory.items[SLOT_OCARINA] != ITEM_NONE) { + int aButtonPressed = CHECK_BTN_ALL(gPlayState->state.input->press.button, BTN_A); + int song = gPlayState->pauseCtx.cursorPoint[PAUSE_QUEST]; + if (aButtonPressed && CHECK_QUEST_ITEM(song) && song >= QUEST_SONG_MINUET && song <= QUEST_SONG_PRELUDE) { + ActivateWarp(&gPlayState->pauseCtx, song); + } + } +} diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 858c12da7..c2a300877 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -644,6 +644,8 @@ void DrawEnhancementsMenu() { "- Obtained the Master Sword\n" "- Not within range of Time Block\n" "- Not within range of Ocarina playing spots"); + UIWidgets::PaddedEnhancementCheckbox("Pause Warp", "gPauseWarp", true, false); + UIWidgets::Tooltip("Selection of warp song in pause menu initiates warp. Disables song playback."); ImGui::EndTable(); ImGui::EndMenu(); diff --git a/soh/src/code/z_kaleido_scope_call.c b/soh/src/code/z_kaleido_scope_call.c index dd7e3fdd9..82922acd0 100644 --- a/soh/src/code/z_kaleido_scope_call.c +++ b/soh/src/code/z_kaleido_scope_call.c @@ -1,5 +1,6 @@ #include "global.h" #include "vt.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Hooks.h" void (*sKaleidoScopeUpdateFunc)(PlayState* play); void (*sKaleidoScopeDrawFunc)(PlayState* play); @@ -56,6 +57,8 @@ void KaleidoScopeCall_Update(PlayState* play) { KaleidoMgrOverlay* kaleidoScopeOvl = &gKaleidoMgrOverlayTable[KALEIDO_OVL_KALEIDO_SCOPE]; PauseContext* pauseCtx = &play->pauseCtx; + GameInteractor_ExecuteOnKaleidoUpdate(); + if (!gSaveContext.sohStats.gameComplete && (!IS_BOSS_RUSH || !gSaveContext.isBossRushPaused)) { gSaveContext.sohStats.pauseTimer++; From 13fce8258d92e80ea09900f83d338ccba2e7b1f9 Mon Sep 17 00:00:00 2001 From: Archez Date: Thu, 15 Feb 2024 20:14:24 -0500 Subject: [PATCH 04/44] [Rando] Add Mix and Decouple support to Boss Entrances (#3261) * initial support for mixing boss entrances in the mixed pool * support decouple for boss entrances * missed decouple change * add blue warp exits to boss rooms in location access * add entrance get helper methods * fix assumed targets not using root in entrance name * add dedicated blue warp entrances and handle blue warp changes during generation * change bluewarp handling in game to use unique blue warp entrances * handle blue warps in entrance tracker * fix overriding all jabu and water temple rooms * fix grotto returns when exiting boss rooms/dungeons * fix blue warp logic by tracking original connected region key * use entrance enums * remove unneeded entrance values * fix decouple generation crash * fix jabu mq backwards logic --- .../randomizer/3drando/entrance.cpp | 172 ++++++++++++--- .../randomizer/3drando/entrance.hpp | 22 +- .../Enhancements/randomizer/3drando/fill.cpp | 7 +- .../randomizer/3drando/location_access.cpp | 13 ++ .../randomizer/3drando/location_access.hpp | 1 + .../location_access/locacc_deku_tree.cpp | 1 + .../locacc_dodongos_cavern.cpp | 1 + .../location_access/locacc_fire_temple.cpp | 1 + .../location_access/locacc_forest_temple.cpp | 1 + .../locacc_jabujabus_belly.cpp | 15 +- .../location_access/locacc_shadow_temple.cpp | 1 + .../location_access/locacc_spirit_temple.cpp | 1 + .../location_access/locacc_water_temple.cpp | 1 + .../randomizer/3drando/settings.cpp | 14 ++ .../randomizer/3drando/settings.hpp | 2 + .../randomizer/3drando/spoiler_log.cpp | 17 +- .../Enhancements/randomizer/randomizer.cpp | 21 +- .../Enhancements/randomizer/randomizerTypes.h | 1 + .../randomizer/randomizer_entrance.c | 200 ++++++++---------- .../randomizer/randomizer_entrance.h | 18 +- .../randomizer_entrance_tracker.cpp | 13 ++ soh/soh/SaveManager.cpp | 4 +- soh/src/code/z_room.c | 13 +- .../actors/ovl_player_actor/z_player.c | 4 +- 24 files changed, 349 insertions(+), 195 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/entrance.cpp b/soh/soh/Enhancements/randomizer/3drando/entrance.cpp index 5df67bb87..8dd8b4c63 100644 --- a/soh/soh/Enhancements/randomizer/3drando/entrance.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/entrance.cpp @@ -26,7 +26,6 @@ typedef struct { AreaKey parentRegion; AreaKey connectedRegion; int16_t index; - int16_t blueWarp; } EntranceLinkInfo; EntranceLinkInfo NO_RETURN_ENTRANCE = {EntranceType::None, NONE, NONE, -1}; @@ -40,6 +39,11 @@ using EntranceInfoPair = std::pair; using EntrancePair = std::pair; using EntrancePools = std::map>; +// Construct entrance name from parent and connected region keys +std::string EntranceNameByRegions(uint32_t parentRegion, uint32_t connectedRegion) { + return AreaTable(parentRegion)->regionName + " -> " + AreaTable(connectedRegion)->regionName; +} + //The entrance randomization algorithm used here is a direct copy of //the algorithm used in the original N64 randomizer (except now in C++ instead //of python). It may be easier to understand the algorithm by looking at the @@ -77,26 +81,22 @@ void SetAllEntrancesData(std::vector& entranceShuffleTable) { //set data Entrance* forwardEntrance = AreaTable(forwardEntry.parentRegion)->GetExit(forwardEntry.connectedRegion); forwardEntrance->SetIndex(forwardEntry.index); - forwardEntrance->SetBlueWarp(forwardEntry.blueWarp); forwardEntrance->SetType(forwardEntry.type); forwardEntrance->SetAsPrimary(); - // When decouple entrances is on, mark it for entrances except boss rooms - if (Settings::DecoupleEntrances && forwardEntry.type != EntranceType::ChildBoss && - forwardEntry.type != EntranceType::AdultBoss) { + // When decouple entrances is on, mark the forward entrance + if (Settings::DecoupleEntrances) { forwardEntrance->SetDecoupled(); } if (returnEntry.parentRegion != NONE) { Entrance* returnEntrance = AreaTable(returnEntry.parentRegion)->GetExit(returnEntry.connectedRegion); returnEntrance->SetIndex(returnEntry.index); - returnEntrance->SetBlueWarp(returnEntry.blueWarp); returnEntrance->SetType(returnEntry.type); forwardEntrance->BindTwoWay(returnEntrance); // Mark reverse entrance as decoupled - if (Settings::DecoupleEntrances && returnEntry.type != EntranceType::ChildBoss && - returnEntry.type != EntranceType::AdultBoss) { + if (Settings::DecoupleEntrances) { returnEntrance->SetDecoupled(); } } @@ -687,31 +687,31 @@ int ShuffleAllEntrances() { curNumRandomizedEntrances = 0; std::vector entranceShuffleTable = { - //Parent Region Connected Region index blue warp + //Parent Region Connected Region index {{EntranceType::Dungeon, KF_OUTSIDE_DEKU_TREE, DEKU_TREE_ENTRYWAY, 0x0000}, - {EntranceType::Dungeon, DEKU_TREE_ENTRYWAY, KF_OUTSIDE_DEKU_TREE, 0x0209, 0x0457}}, + {EntranceType::Dungeon, DEKU_TREE_ENTRYWAY, KF_OUTSIDE_DEKU_TREE, 0x0209}}, {{EntranceType::Dungeon, DEATH_MOUNTAIN_TRAIL, DODONGOS_CAVERN_ENTRYWAY, 0x0004}, - {EntranceType::Dungeon, DODONGOS_CAVERN_ENTRYWAY, DEATH_MOUNTAIN_TRAIL, 0x0242, 0x047A}}, + {EntranceType::Dungeon, DODONGOS_CAVERN_ENTRYWAY, DEATH_MOUNTAIN_TRAIL, 0x0242}}, {{EntranceType::Dungeon, ZORAS_FOUNTAIN, JABU_JABUS_BELLY_ENTRYWAY, 0x0028}, - {EntranceType::Dungeon, JABU_JABUS_BELLY_ENTRYWAY, ZORAS_FOUNTAIN, 0x0221, 0x010E}}, + {EntranceType::Dungeon, JABU_JABUS_BELLY_ENTRYWAY, ZORAS_FOUNTAIN, 0x0221}}, {{EntranceType::Dungeon, SACRED_FOREST_MEADOW, FOREST_TEMPLE_ENTRYWAY, 0x0169}, - {EntranceType::Dungeon, FOREST_TEMPLE_ENTRYWAY, SACRED_FOREST_MEADOW, 0x0215, 0x0608}}, + {EntranceType::Dungeon, FOREST_TEMPLE_ENTRYWAY, SACRED_FOREST_MEADOW, 0x0215}}, {{EntranceType::Dungeon, DMC_CENTRAL_LOCAL, FIRE_TEMPLE_ENTRYWAY, 0x0165}, - {EntranceType::Dungeon, FIRE_TEMPLE_ENTRYWAY, DMC_CENTRAL_LOCAL, 0x024A, 0x0564}}, + {EntranceType::Dungeon, FIRE_TEMPLE_ENTRYWAY, DMC_CENTRAL_LOCAL, 0x024A}}, {{EntranceType::Dungeon, LAKE_HYLIA, WATER_TEMPLE_ENTRYWAY, 0x0010}, - {EntranceType::Dungeon, WATER_TEMPLE_ENTRYWAY, LAKE_HYLIA, 0x021D, 0x060C}}, + {EntranceType::Dungeon, WATER_TEMPLE_ENTRYWAY, LAKE_HYLIA, 0x021D}}, {{EntranceType::Dungeon, DESERT_COLOSSUS, SPIRIT_TEMPLE_ENTRYWAY, 0x0082}, - {EntranceType::Dungeon, SPIRIT_TEMPLE_ENTRYWAY, DESERT_COLOSSUS_FROM_SPIRIT_ENTRYWAY, 0x01E1, 0x0610}}, + {EntranceType::Dungeon, SPIRIT_TEMPLE_ENTRYWAY, DESERT_COLOSSUS_FROM_SPIRIT_ENTRYWAY, 0x01E1}}, {{EntranceType::Dungeon, GRAVEYARD_WARP_PAD_REGION, SHADOW_TEMPLE_ENTRYWAY, 0x0037}, - {EntranceType::Dungeon, SHADOW_TEMPLE_ENTRYWAY, GRAVEYARD_WARP_PAD_REGION, 0x0205, 0x0580}}, + {EntranceType::Dungeon, SHADOW_TEMPLE_ENTRYWAY, GRAVEYARD_WARP_PAD_REGION, 0x0205}}, {{EntranceType::Dungeon, KAKARIKO_VILLAGE, BOTTOM_OF_THE_WELL_ENTRYWAY, 0x0098}, {EntranceType::Dungeon, BOTTOM_OF_THE_WELL_ENTRYWAY, KAKARIKO_VILLAGE, 0x02A6}}, {{EntranceType::Dungeon, ZORAS_FOUNTAIN, ICE_CAVERN_ENTRYWAY, 0x0088}, {EntranceType::Dungeon, ICE_CAVERN_ENTRYWAY, ZORAS_FOUNTAIN, 0x03D4}}, {{EntranceType::Dungeon, GERUDO_FORTRESS, GERUDO_TRAINING_GROUNDS_ENTRYWAY, 0x0008}, {EntranceType::Dungeon, GERUDO_TRAINING_GROUNDS_ENTRYWAY, GERUDO_FORTRESS, 0x03A8}}, - {{EntranceType::GanonDungeon, GANONS_CASTLE_LEDGE, GANONS_CASTLE_ENTRYWAY, 0x0467}, - {EntranceType::GanonDungeon, GANONS_CASTLE_ENTRYWAY, CASTLE_GROUNDS_FROM_GANONS_CASTLE, 0x023D}}, + {{EntranceType::GanonDungeon, GANONS_CASTLE_LEDGE, GANONS_CASTLE_ENTRYWAY, 0x0467}, + {EntranceType::GanonDungeon, GANONS_CASTLE_ENTRYWAY, CASTLE_GROUNDS_FROM_GANONS_CASTLE, 0x023D}}, {{EntranceType::Interior, KOKIRI_FOREST, KF_MIDOS_HOUSE, 0x0433}, {EntranceType::Interior, KF_MIDOS_HOUSE, KOKIRI_FOREST, 0x0443}}, @@ -947,21 +947,30 @@ int ShuffleAllEntrances() { {{EntranceType::WarpSong, PRELUDE_OF_LIGHT_WARP, TEMPLE_OF_TIME, 0x05F4}, NO_RETURN_ENTRANCE}, {{EntranceType::ChildBoss, DEKU_TREE_BOSS_ENTRYWAY, DEKU_TREE_BOSS_ROOM, 0x040F}, - {EntranceType::ChildBoss, DEKU_TREE_BOSS_ROOM, DEKU_TREE_BOSS_ENTRYWAY, 0x0252, 0x0457}}, + {EntranceType::ChildBoss, DEKU_TREE_BOSS_ROOM, DEKU_TREE_BOSS_ENTRYWAY, 0x0252}}, {{EntranceType::ChildBoss, DODONGOS_CAVERN_BOSS_ENTRYWAY, DODONGOS_CAVERN_BOSS_ROOM, 0x040B}, - {EntranceType::ChildBoss, DODONGOS_CAVERN_BOSS_ROOM, DODONGOS_CAVERN_BOSS_ENTRYWAY, 0x00C5, 0x047A}}, + {EntranceType::ChildBoss, DODONGOS_CAVERN_BOSS_ROOM, DODONGOS_CAVERN_BOSS_ENTRYWAY, 0x00C5}}, {{EntranceType::ChildBoss, JABU_JABUS_BELLY_BOSS_ENTRYWAY, JABU_JABUS_BELLY_BOSS_ROOM, 0x0301}, - {EntranceType::ChildBoss, JABU_JABUS_BELLY_BOSS_ROOM, JABU_JABUS_BELLY_BOSS_ENTRYWAY, 0x0407, 0x010E}}, + {EntranceType::ChildBoss, JABU_JABUS_BELLY_BOSS_ROOM, JABU_JABUS_BELLY_BOSS_ENTRYWAY, 0x0407}}, {{EntranceType::AdultBoss, FOREST_TEMPLE_BOSS_ENTRYWAY, FOREST_TEMPLE_BOSS_ROOM, 0x000C}, - {EntranceType::AdultBoss, FOREST_TEMPLE_BOSS_ROOM, FOREST_TEMPLE_BOSS_ENTRYWAY, 0x024E, 0x0608}}, + {EntranceType::AdultBoss, FOREST_TEMPLE_BOSS_ROOM, FOREST_TEMPLE_BOSS_ENTRYWAY, 0x024E}}, {{EntranceType::AdultBoss, FIRE_TEMPLE_BOSS_ENTRYWAY, FIRE_TEMPLE_BOSS_ROOM, 0x0305}, - {EntranceType::AdultBoss, FIRE_TEMPLE_BOSS_ROOM, FIRE_TEMPLE_BOSS_ENTRYWAY, 0x0175, 0x0564}}, + {EntranceType::AdultBoss, FIRE_TEMPLE_BOSS_ROOM, FIRE_TEMPLE_BOSS_ENTRYWAY, 0x0175}}, {{EntranceType::AdultBoss, WATER_TEMPLE_BOSS_ENTRYWAY, WATER_TEMPLE_BOSS_ROOM, 0x0417}, - {EntranceType::AdultBoss, WATER_TEMPLE_BOSS_ROOM, WATER_TEMPLE_BOSS_ENTRYWAY, 0x0423, 0x060C}}, + {EntranceType::AdultBoss, WATER_TEMPLE_BOSS_ROOM, WATER_TEMPLE_BOSS_ENTRYWAY, 0x0423}}, {{EntranceType::AdultBoss, SPIRIT_TEMPLE_BOSS_ENTRYWAY, SPIRIT_TEMPLE_BOSS_ROOM, 0x008D}, - {EntranceType::AdultBoss, SPIRIT_TEMPLE_BOSS_ROOM, SPIRIT_TEMPLE_BOSS_ENTRYWAY, 0x02F5, 0x0610}}, + {EntranceType::AdultBoss, SPIRIT_TEMPLE_BOSS_ROOM, SPIRIT_TEMPLE_BOSS_ENTRYWAY, 0x02F5}}, {{EntranceType::AdultBoss, SHADOW_TEMPLE_BOSS_ENTRYWAY, SHADOW_TEMPLE_BOSS_ROOM, 0x0413}, - {EntranceType::AdultBoss, SHADOW_TEMPLE_BOSS_ROOM, SHADOW_TEMPLE_BOSS_ENTRYWAY, 0x02B2, 0x0580}}, + {EntranceType::AdultBoss, SHADOW_TEMPLE_BOSS_ROOM, SHADOW_TEMPLE_BOSS_ENTRYWAY, 0x02B2}}, + + {{EntranceType::BlueWarp, DEKU_TREE_BOSS_ROOM, KF_OUTSIDE_DEKU_TREE, 0x0457}, NO_RETURN_ENTRANCE}, + {{EntranceType::BlueWarp, DODONGOS_CAVERN_BOSS_ROOM, DEATH_MOUNTAIN_TRAIL, 0x047A}, NO_RETURN_ENTRANCE}, + {{EntranceType::BlueWarp, JABU_JABUS_BELLY_BOSS_ROOM, ZORAS_FOUNTAIN, 0x010E}, NO_RETURN_ENTRANCE}, + {{EntranceType::BlueWarp, FOREST_TEMPLE_BOSS_ROOM, SACRED_FOREST_MEADOW, 0x0608}, NO_RETURN_ENTRANCE}, + {{EntranceType::BlueWarp, FIRE_TEMPLE_BOSS_ROOM, DMC_CENTRAL_LOCAL, 0x0564}, NO_RETURN_ENTRANCE}, + {{EntranceType::BlueWarp, WATER_TEMPLE_BOSS_ROOM, LAKE_HYLIA, 0x060C}, NO_RETURN_ENTRANCE}, + {{EntranceType::BlueWarp, SPIRIT_TEMPLE_BOSS_ROOM, DESERT_COLOSSUS, 0x0610}, NO_RETURN_ENTRANCE}, + {{EntranceType::BlueWarp, SHADOW_TEMPLE_BOSS_ROOM, GRAVEYARD_WARP_PAD_REGION, 0x0580}, NO_RETURN_ENTRANCE}, }; std::map priorityEntranceTable = { @@ -1011,6 +1020,11 @@ int ShuffleAllEntrances() { FilterAndEraseFromPool(entrancePools[EntranceType::Boss], [](const Entrance* entrance){return entrance->GetParentRegionKey() == DEKU_TREE_BOSS_ENTRYWAY && entrance->GetConnectedRegionKey() == DEKU_TREE_BOSS_ROOM;}); } + if (Settings::DecoupleEntrances) { + for (Entrance* entrance : entrancePools[EntranceType::Boss]) { + entrancePools[EntranceType::BossReverse].push_back(entrance->GetReverse()); + } + } } else { entrancePools[EntranceType::ChildBoss] = GetShuffleableEntrances(EntranceType::ChildBoss); entrancePools[EntranceType::AdultBoss] = GetShuffleableEntrances(EntranceType::AdultBoss); @@ -1019,6 +1033,14 @@ int ShuffleAllEntrances() { FilterAndEraseFromPool(entrancePools[EntranceType::ChildBoss], [](const Entrance* entrance){return entrance->GetParentRegionKey() == DEKU_TREE_BOSS_ENTRYWAY && entrance->GetConnectedRegionKey() == DEKU_TREE_BOSS_ROOM;}); } + if (Settings::DecoupleEntrances) { + for (Entrance* entrance : entrancePools[EntranceType::ChildBoss]) { + entrancePools[EntranceType::ChildBossReverse].push_back(entrance->GetReverse()); + } + for (Entrance* entrance : entrancePools[EntranceType::AdultBoss]) { + entrancePools[EntranceType::AdultBossReverse].push_back(entrance->GetReverse()); + } + } } } @@ -1082,10 +1104,13 @@ int ShuffleAllEntrances() { SetShuffledEntrances(oneWayEntrancePools); //combine entrance pools if mixing pools. Only continue if more than one pool is selected. - int totalMixedPools = (Settings::MixDungeons ? 1 : 0) + (Settings::MixOverworld ? 1 : 0) + (Settings::MixInteriors ? 1 : 0) + (Settings::MixGrottos ? 1 : 0); + int totalMixedPools = (Settings::MixDungeons ? 1 : 0) + (Settings::MixBosses ? 1 : 0) + + (Settings::MixOverworld ? 1 : 0) + (Settings::MixInteriors ? 1 : 0) + + (Settings::MixGrottos ? 1 : 0); if (totalMixedPools < 2) { Settings::MixedEntrancePools.SetSelectedIndex(OFF); Settings::MixDungeons.SetSelectedIndex(OFF); + Settings::MixBosses.SetSelectedIndex(OFF); Settings::MixOverworld.SetSelectedIndex(OFF); Settings::MixInteriors.SetSelectedIndex(OFF); Settings::MixGrottos.SetSelectedIndex(OFF); @@ -1099,6 +1124,12 @@ int ShuffleAllEntrances() { poolsToMix.insert(EntranceType::DungeonReverse); } } + if (Settings::MixBosses) { + poolsToMix.insert(EntranceType::Boss); + if (Settings::DecoupleEntrances) { + poolsToMix.insert(EntranceType::BossReverse); + } + } if (Settings::MixOverworld) { poolsToMix.insert(EntranceType::Overworld); } @@ -1232,6 +1263,87 @@ int ShuffleAllEntrances() { } } + // Determine blue warp targets + if (true /* Settings.BlueWarps.Is(BLUEWARPS_DUNGEON) */) { // RANDOTODO: add bluewarp shuffle + // If a boss room is inside a boss door, make the blue warp go outside the dungeon's entrance + std::map bossExits = { + { EntranceNameByRegions(DEKU_TREE_BOSS_ROOM, DEKU_TREE_BOSS_ENTRYWAY), + GetEntrance(EntranceNameByRegions(DEKU_TREE_ENTRYWAY, KF_OUTSIDE_DEKU_TREE)) }, + { EntranceNameByRegions(DODONGOS_CAVERN_BOSS_ROOM, DODONGOS_CAVERN_BOSS_ENTRYWAY), + GetEntrance(EntranceNameByRegions(DODONGOS_CAVERN_ENTRYWAY, DEATH_MOUNTAIN_TRAIL)) }, + { EntranceNameByRegions(JABU_JABUS_BELLY_BOSS_ROOM, JABU_JABUS_BELLY_BOSS_ENTRYWAY), + GetEntrance(EntranceNameByRegions(JABU_JABUS_BELLY_ENTRYWAY, ZORAS_FOUNTAIN)) }, + { EntranceNameByRegions(FOREST_TEMPLE_BOSS_ROOM, FOREST_TEMPLE_BOSS_ENTRYWAY), + GetEntrance(EntranceNameByRegions(FOREST_TEMPLE_ENTRYWAY, SACRED_FOREST_MEADOW)) }, + { EntranceNameByRegions(FIRE_TEMPLE_BOSS_ROOM, FIRE_TEMPLE_BOSS_ENTRYWAY), + GetEntrance(EntranceNameByRegions(FIRE_TEMPLE_ENTRYWAY, DMC_CENTRAL_LOCAL)) }, + { EntranceNameByRegions(WATER_TEMPLE_BOSS_ROOM, WATER_TEMPLE_BOSS_ENTRYWAY), + GetEntrance(EntranceNameByRegions(WATER_TEMPLE_ENTRYWAY, LAKE_HYLIA)) }, + { EntranceNameByRegions(SPIRIT_TEMPLE_BOSS_ROOM, SPIRIT_TEMPLE_BOSS_ENTRYWAY), + GetEntrance(EntranceNameByRegions(SPIRIT_TEMPLE_ENTRYWAY, DESERT_COLOSSUS_FROM_SPIRIT_ENTRYWAY)) }, + { EntranceNameByRegions(SHADOW_TEMPLE_BOSS_ROOM, SHADOW_TEMPLE_BOSS_ENTRYWAY), + GetEntrance(EntranceNameByRegions(SHADOW_TEMPLE_ENTRYWAY, GRAVEYARD_WARP_PAD_REGION)) }, + }; + + // If a boss room is inside a dungeon entrance (or inside a dungeon which is inside a dungeon entrance), make the blue warp go to that dungeon's blue warp target + std::map dungeonExits = { + { EntranceNameByRegions(DEKU_TREE_ENTRYWAY, KF_OUTSIDE_DEKU_TREE), + GetEntrance(EntranceNameByRegions(DEKU_TREE_BOSS_ROOM, KF_OUTSIDE_DEKU_TREE)) }, + { EntranceNameByRegions(DODONGOS_CAVERN_ENTRYWAY, DEATH_MOUNTAIN_TRAIL), + GetEntrance(EntranceNameByRegions(DODONGOS_CAVERN_BOSS_ROOM, DEATH_MOUNTAIN_TRAIL)) }, + { EntranceNameByRegions(JABU_JABUS_BELLY_ENTRYWAY, ZORAS_FOUNTAIN), + GetEntrance(EntranceNameByRegions(JABU_JABUS_BELLY_BOSS_ROOM, ZORAS_FOUNTAIN)) }, + { EntranceNameByRegions(FOREST_TEMPLE_ENTRYWAY, SACRED_FOREST_MEADOW), + GetEntrance(EntranceNameByRegions(FOREST_TEMPLE_BOSS_ROOM, SACRED_FOREST_MEADOW)) }, + { EntranceNameByRegions(FIRE_TEMPLE_ENTRYWAY, DMC_CENTRAL_LOCAL), + GetEntrance(EntranceNameByRegions(FIRE_TEMPLE_BOSS_ROOM, DMC_CENTRAL_LOCAL)) }, + { EntranceNameByRegions(WATER_TEMPLE_ENTRYWAY, LAKE_HYLIA), + GetEntrance(EntranceNameByRegions(WATER_TEMPLE_BOSS_ROOM, LAKE_HYLIA)) }, + { EntranceNameByRegions(SPIRIT_TEMPLE_ENTRYWAY, DESERT_COLOSSUS_FROM_SPIRIT_ENTRYWAY), + GetEntrance(EntranceNameByRegions(SPIRIT_TEMPLE_BOSS_ROOM, DESERT_COLOSSUS)) }, + { EntranceNameByRegions(SHADOW_TEMPLE_ENTRYWAY, GRAVEYARD_WARP_PAD_REGION), + GetEntrance(EntranceNameByRegions(SHADOW_TEMPLE_BOSS_ROOM, GRAVEYARD_WARP_PAD_REGION)) }, + }; + + // Pair + std::vector bossRoomExitPairs = { + { GetEntrance(EntranceNameByRegions(DEKU_TREE_BOSS_ROOM, KF_OUTSIDE_DEKU_TREE)), + GetEntrance(EntranceNameByRegions(DEKU_TREE_BOSS_ROOM, DEKU_TREE_BOSS_ENTRYWAY)) }, + { GetEntrance(EntranceNameByRegions(DODONGOS_CAVERN_BOSS_ROOM, DEATH_MOUNTAIN_TRAIL)), + GetEntrance(EntranceNameByRegions(DODONGOS_CAVERN_BOSS_ROOM, DODONGOS_CAVERN_BOSS_ENTRYWAY)) }, + { GetEntrance(EntranceNameByRegions(JABU_JABUS_BELLY_BOSS_ROOM, ZORAS_FOUNTAIN)), + GetEntrance(EntranceNameByRegions(JABU_JABUS_BELLY_BOSS_ROOM, JABU_JABUS_BELLY_BOSS_ENTRYWAY)) }, + { GetEntrance(EntranceNameByRegions(FOREST_TEMPLE_BOSS_ROOM, SACRED_FOREST_MEADOW)), + GetEntrance(EntranceNameByRegions(FOREST_TEMPLE_BOSS_ROOM, FOREST_TEMPLE_BOSS_ENTRYWAY)) }, + { GetEntrance(EntranceNameByRegions(FIRE_TEMPLE_BOSS_ROOM, DMC_CENTRAL_LOCAL)), + GetEntrance(EntranceNameByRegions(FIRE_TEMPLE_BOSS_ROOM, FIRE_TEMPLE_BOSS_ENTRYWAY)) }, + { GetEntrance(EntranceNameByRegions(WATER_TEMPLE_BOSS_ROOM, LAKE_HYLIA)), + GetEntrance(EntranceNameByRegions(WATER_TEMPLE_BOSS_ROOM, WATER_TEMPLE_BOSS_ENTRYWAY)) }, + { GetEntrance(EntranceNameByRegions(SPIRIT_TEMPLE_BOSS_ROOM, DESERT_COLOSSUS)), + GetEntrance(EntranceNameByRegions(SPIRIT_TEMPLE_BOSS_ROOM, SPIRIT_TEMPLE_BOSS_ENTRYWAY)) }, + { GetEntrance(EntranceNameByRegions(SHADOW_TEMPLE_BOSS_ROOM, GRAVEYARD_WARP_PAD_REGION)), + GetEntrance(EntranceNameByRegions(SHADOW_TEMPLE_BOSS_ROOM, SHADOW_TEMPLE_BOSS_ENTRYWAY)) }, + }; + + for (EntrancePair pair : bossRoomExitPairs) { + Entrance* target = pair.second->GetReplacement() != nullptr ? pair.second->GetReplacement() : pair.second; + + if (!Settings::DecoupleEntrances) { + while (bossExits.find(target->GetName()) != bossExits.end()) { + Entrance* next = bossExits.at(target->GetName()); + target = next->GetReplacement() != nullptr ? next->GetReplacement() : next; + } + + if (dungeonExits.find(target->GetName()) != dungeonExits.end()) { + target = dungeonExits.at(target->GetName()); + } + } + + pair.first->Connect(target->GetOriginalConnectedRegionKey()); + pair.first->SetReplacement(target); + } + } + // Validate the world one last time to ensure all special conditions are still valid if (!ValidateWorld(nullptr)) { return ENTRANCE_SHUFFLE_FAILURE; @@ -1259,8 +1371,8 @@ void CreateEntranceOverrides() { auto message = "Setting " + entrance->to_string() + "\n"; SPDLOG_DEBUG(message); + uint8_t type = (uint8_t)entrance->GetType(); int16_t originalIndex = entrance->GetIndex(); - int16_t originalBlueWarp = entrance->GetBlueWarp(); int16_t replacementIndex = entrance->GetReplacement()->GetIndex(); int16_t destinationIndex = -1; @@ -1274,9 +1386,9 @@ void CreateEntranceOverrides() { } entranceOverrides.push_back({ + .type = type, .index = originalIndex, .destination = destinationIndex, - .blueWarp = originalBlueWarp, .override = replacementIndex, .overrideDestination = replacementDestinationIndex, }); diff --git a/soh/soh/Enhancements/randomizer/3drando/entrance.hpp b/soh/soh/Enhancements/randomizer/3drando/entrance.hpp index b6a5cb432..e99b418d8 100644 --- a/soh/soh/Enhancements/randomizer/3drando/entrance.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/entrance.hpp @@ -18,12 +18,16 @@ enum class EntranceType { OwlDrop, Spawn, WarpSong, + BlueWarp, Dungeon, GanonDungeon, DungeonReverse, Boss, + BossReverse, ChildBoss, + ChildBossReverse, AdultBoss, + AdultBossReverse, Interior, InteriorReverse, SpecialInterior, @@ -40,6 +44,7 @@ public: Entrance(uint32_t connectedRegion_, std::vector conditions_met_) : connectedRegion(connectedRegion_) { + originalConnectedRegion = connectedRegion_; conditions_met.resize(2); for (size_t i = 0; i < conditions_met_.size(); i++) { conditions_met[i] = conditions_met_[i]; @@ -134,6 +139,10 @@ public: return connectedRegion; } + uint32_t GetOriginalConnectedRegionKey() const { + return originalConnectedRegion; + } + Area* GetConnectedRegion() const { return AreaTable(connectedRegion); } @@ -198,14 +207,6 @@ public: index = newIndex; } - int16_t GetBlueWarp() const { - return blueWarp; - } - - void SetBlueWarp(int16_t newBlueWarp) { - blueWarp = newBlueWarp; - } - Entrance* GetAssumed() const { return assumed; } @@ -251,7 +252,7 @@ public: AreaTable(ROOT)->AddExit(ROOT, connectedRegion, []{return true;}); Entrance* targetEntrance = AreaTable(ROOT)->GetExit(connectedRegion); targetEntrance->SetReplacement(this); - targetEntrance->SetName(GetParentRegion()->regionName + " -> " + GetConnectedRegion()->regionName); + targetEntrance->SetName(AreaTable(ROOT)->regionName + " -> " + GetConnectedRegion()->regionName); return targetEntrance; } @@ -266,6 +267,7 @@ public: private: uint32_t parentRegion; uint32_t connectedRegion; + uint32_t originalConnectedRegion; std::vector conditions_met; //Entrance Randomizer stuff @@ -275,7 +277,6 @@ private: Entrance* assumed = nullptr; Entrance* replacement = nullptr; int16_t index = 0xFFFF; - int16_t blueWarp = 0; bool shuffled = false; bool primary = false; bool addedToPool = false; @@ -285,6 +286,7 @@ private: int ShuffleAllEntrances(); void CreateEntranceOverrides(); +std::string EntranceNameByRegions(uint32_t parentRegion, uint32_t connectedRegion); extern std::vector> playthroughEntrances; extern bool noRandomEntrances; diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 7063a3191..7c8d027f2 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -294,7 +294,12 @@ std::vector GetAccessibleLocations(const std::vector& allowe } // Add shuffled entrances to the entrance playthrough - if (mode == SearchMode::GeneratePlaythrough && exit.IsShuffled() && !exit.IsAddedToPool() && !noRandomEntrances) { + // Include bluewarps when unshuffled but dungeon or boss shuffle is on + if (mode == SearchMode::GeneratePlaythrough && + (exit.IsShuffled() || (exit.GetType() == EntranceType::BlueWarp && + (Settings::ShuffleDungeonEntrances.IsNot(SHUFFLEDUNGEONS_OFF) || + Settings::ShuffleBossEntrances.IsNot(SHUFFLEBOSSES_OFF)))) && + !exit.IsAddedToPool() && !noRandomEntrances) { entranceSphere.push_back(&exit); exit.AddToPool(); // Don't list a two-way coupled entrance from both directions diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access.cpp b/soh/soh/Enhancements/randomizer/3drando/location_access.cpp index 6be67ea84..684dd16e1 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access.cpp @@ -503,3 +503,16 @@ std::vector GetShuffleableEntrances(EntranceType type, bool onlyPrima } return entrancesToShuffle; } + +// Get the specific entrance by name +Entrance* GetEntrance(const std::string name) { + for (uint32_t area : Areas::GetAllAreas()) { + for (auto& exit : AreaTable(area)->exits) { + if (exit.GetName() == name) { + return &exit; + } + } + } + + return nullptr; +} diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access.hpp b/soh/soh/Enhancements/randomizer/3drando/location_access.hpp index 60529a2f6..672a97f5c 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access.hpp @@ -242,6 +242,7 @@ namespace Areas { void AreaTable_Init(); Area* AreaTable(const uint32_t areaKey); std::vector GetShuffleableEntrances(EntranceType type, bool onlyPrimary = true); +Entrance* GetEntrance(const std::string name); // Overworld void AreaTable_Init_LostWoods(); diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_deku_tree.cpp b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_deku_tree.cpp index 2224df4ca..c1231b29e 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_deku_tree.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_deku_tree.cpp @@ -267,5 +267,6 @@ void AreaTable_Init_DekuTree() { { // Exits Entrance(DEKU_TREE_BOSS_ENTRYWAY, { [] { return true; } }), + Entrance(KF_OUTSIDE_DEKU_TREE, { [] { return DekuTreeClear; } }), }); } diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_dodongos_cavern.cpp b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_dodongos_cavern.cpp index 9f8effbcc..dc88b1b2c 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_dodongos_cavern.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_dodongos_cavern.cpp @@ -309,5 +309,6 @@ void AreaTable_Init_DodongosCavern() { { // Exits Entrance(DODONGOS_CAVERN_BOSS_ENTRYWAY, { [] { return true; } }), + Entrance(DEATH_MOUNTAIN_TRAIL, { [] { return DodongosCavernClear; } }), }); } diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_fire_temple.cpp b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_fire_temple.cpp index ff2fb885c..107028872 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_fire_temple.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_fire_temple.cpp @@ -420,5 +420,6 @@ void AreaTable_Init_FireTemple() { { // Exits Entrance(FIRE_TEMPLE_BOSS_ENTRYWAY, { [] { return false; } }), + Entrance(DMC_CENTRAL_LOCAL, { [] { return FireTempleClear; } }), }); } diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_forest_temple.cpp b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_forest_temple.cpp index fea9fda6f..f9bc752cb 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_forest_temple.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_forest_temple.cpp @@ -433,5 +433,6 @@ void AreaTable_Init_ForestTemple() { { // Exits Entrance(FOREST_TEMPLE_BOSS_ENTRYWAY, { [] { return false; } }), + Entrance(SACRED_FOREST_MEADOW, { [] { return ForestTempleClear; } }), }); } diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_jabujabus_belly.cpp b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_jabujabus_belly.cpp index 108b69ccc..c8e38bb61 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_jabujabus_belly.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_jabujabus_belly.cpp @@ -179,17 +179,17 @@ void AreaTable_Init_JabuJabusBelly() { //Locations LocationAccess(JABU_JABUS_BELLY_MQ_SECOND_ROOM_LOWER_CHEST, {[]{return true;}}), LocationAccess(JABU_JABUS_BELLY_MQ_SECOND_ROOM_UPPER_CHEST, {[]{return (IsAdult && (CanUse(HOVER_BOOTS) || CanUse(HOOKSHOT))) || ChildCanAccess(JABU_JABUS_BELLY_MQ_BOSS_AREA);}}), - LocationAccess(JABU_JABUS_BELLY_MQ_COMPASS_CHEST, {[]{return true;}}), - LocationAccess(JABU_JABUS_BELLY_MQ_BASEMENT_NEAR_VINES_CHEST, {[]{return true;}}), - LocationAccess(JABU_JABUS_BELLY_MQ_BASEMENT_NEAR_SWITCHES_CHEST, {[]{return true;}}), + LocationAccess(JABU_JABUS_BELLY_MQ_COMPASS_CHEST, {[]{return (IsChild || CanDive || CanUse(IRON_BOOTS) || LogicJabuAlcoveJumpDive) && (CanUse(SLINGSHOT) || CanUse(BOW) || CanUse(HOOKSHOT) || HasBombchus || (LogicJabuMQRangJump && CanUse(BOOMERANG)));}}), + LocationAccess(JABU_JABUS_BELLY_MQ_BASEMENT_NEAR_VINES_CHEST, {[]{return CanUse(SLINGSHOT);}}), + LocationAccess(JABU_JABUS_BELLY_MQ_BASEMENT_NEAR_SWITCHES_CHEST, {[]{return CanUse(SLINGSHOT);}}), LocationAccess(JABU_JABUS_BELLY_MQ_BOOMERANG_ROOM_SMALL_CHEST, {[]{return true;}}), - LocationAccess(JABU_JABUS_BELLY_MQ_BOOMERANG_CHEST, {[]{return true;}}), + LocationAccess(JABU_JABUS_BELLY_MQ_BOOMERANG_CHEST, {[]{return CanUse(KOKIRI_SWORD) || CanUse(MASTER_SWORD) || CanUse(BIGGORON_SWORD) || CanUse(MEGATON_HAMMER) || CanUse(SLINGSHOT) || CanUse(BOW) || CanUse(STICKS) || Bombs;}}), LocationAccess(JABU_JABUS_BELLY_MQ_GS_BOOMERANG_CHEST_ROOM, {[]{return CanPlay(SongOfTime) || (LogicJabuMQSoTGS && IsChild && CanUse(BOOMERANG));}}), //Trick: CanPlay(SongOfTime) || (LogicJabuMQSoTGS && IsChild && CanUse(BOOMERANG)) }, { //Exits Entrance(JABU_JABUS_BELLY_MQ_BEGINNING, {[]{return true;}}), - Entrance(JABU_JABUS_BELLY_MQ_DEPTHS, {[]{return HasExplosives && IsChild && CanUse(BOOMERANG);}}), + Entrance(JABU_JABUS_BELLY_MQ_DEPTHS, {[]{return HasExplosives && CanUse(SLINGSHOT) && CanUse(BOOMERANG);}}), }); areaTable[JABU_JABUS_BELLY_MQ_DEPTHS] = Area("Jabu Jabus Belly MQ Depths", "Jabu Jabus Belly", JABU_JABUS_BELLY, NO_DAY_NIGHT_CYCLE, {}, { @@ -209,8 +209,8 @@ void AreaTable_Init_JabuJabusBelly() { }, { //Locations LocationAccess(JABU_JABUS_BELLY_MQ_COW, {[]{return CanPlay(EponasSong);}}), - LocationAccess(JABU_JABUS_BELLY_MQ_NEAR_BOSS_CHEST, {[]{return true;}}), - LocationAccess(JABU_JABUS_BELLY_MQ_GS_NEAR_BOSS, {[]{return true;}}), + LocationAccess(JABU_JABUS_BELLY_MQ_NEAR_BOSS_CHEST, {[]{return CanUse(SLINGSHOT);}}), + LocationAccess(JABU_JABUS_BELLY_MQ_GS_NEAR_BOSS, {[]{return CanUse(BOOMERANG) || (LogicJabuNearBossRanged && CanUse(HOOKSHOT));}}), }, { //Exits Entrance(JABU_JABUS_BELLY_MQ_MAIN, {[]{return true;}}), @@ -245,5 +245,6 @@ void AreaTable_Init_JabuJabusBelly() { { // Exits Entrance(JABU_JABUS_BELLY_BOSS_ENTRYWAY, { [] { return false; } }), + Entrance(ZORAS_FOUNTAIN, { [] { return JabuJabusBellyClear; } }), }); } diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_shadow_temple.cpp b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_shadow_temple.cpp index a3dda7521..61778d563 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_shadow_temple.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_shadow_temple.cpp @@ -209,5 +209,6 @@ void AreaTable_Init_ShadowTemple() { { // Exits Entrance(SHADOW_TEMPLE_BOSS_ENTRYWAY, { [] { return false; } }), + Entrance(GRAVEYARD_WARP_PAD_REGION, { [] { return ShadowTempleClear; } }), }); } diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_spirit_temple.cpp b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_spirit_temple.cpp index 2aa0c0516..f676c3c91 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_spirit_temple.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_spirit_temple.cpp @@ -271,5 +271,6 @@ void AreaTable_Init_SpiritTemple() { { // Exits Entrance(SPIRIT_TEMPLE_BOSS_ENTRYWAY, { [] { return false; } }), + Entrance(DESERT_COLOSSUS, { [] { return SpiritTempleClear; } }), }); } diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_water_temple.cpp b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_water_temple.cpp index 559b6c20c..f1c86abb0 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_water_temple.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_water_temple.cpp @@ -331,5 +331,6 @@ void AreaTable_Init_WaterTemple() { { // Exits Entrance(WATER_TEMPLE_BOSS_ENTRYWAY, { [] { return false; } }), + Entrance(LAKE_HYLIA, { [] { return WaterTempleClear; } }), }); } diff --git a/soh/soh/Enhancements/randomizer/3drando/settings.cpp b/soh/soh/Enhancements/randomizer/3drando/settings.cpp index 684e3ec9a..5dcd5a792 100644 --- a/soh/soh/Enhancements/randomizer/3drando/settings.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/settings.cpp @@ -94,6 +94,7 @@ namespace Settings { Option ShuffleOverworldSpawns = Option::Bool("Overworld Spawns", {"Off", "On"}); Option MixedEntrancePools = Option::Bool("Mixed Entrance Pools", {"Off", "On"}); Option MixDungeons = Option::Bool("Mix Dungeons", {"Off", "On"}); + Option MixBosses = Option::Bool("Mix Bosses", {"Off", "On"}); Option MixOverworld = Option::Bool("Mix Overworld", {"Off", "On"}); Option MixInteriors = Option::Bool("Mix Interiors", {"Off", "On"}); Option MixGrottos = Option::Bool("Mix Grottos", {"Off", "On"}); @@ -135,6 +136,7 @@ namespace Settings { &ShuffleOverworldSpawns, &MixedEntrancePools, &MixDungeons, + &MixBosses, &MixOverworld, &MixInteriors, &MixGrottos, @@ -1298,6 +1300,7 @@ namespace Settings { ctx.shuffleOverworldSpawns = (ShuffleOverworldSpawns) ? 1 : 0; ctx.mixedEntrancePools = (MixedEntrancePools) ? 1 : 0; ctx.mixDungeons = (MixDungeons) ? 1 : 0; + ctx.mixBosses = (MixBosses) ? 1 : 0; ctx.mixOverworld = (MixOverworld) ? 1 : 0; ctx.mixInteriors = (MixInteriors) ? 1 : 0; ctx.mixGrottos = (MixGrottos) ? 1 : 0; @@ -1891,6 +1894,13 @@ namespace Settings { MixDungeons.SetSelectedIndex(OFF); } + if (ShuffleBossEntrances.Is(SHUFFLEBOSSES_FULL)) { + MixBosses.Unhide(); + } else { + MixBosses.Hide(); + MixBosses.SetSelectedIndex(OFF); + } + if (ShuffleOverworldEntrances) { MixOverworld.Unhide(); } else { @@ -1914,6 +1924,8 @@ namespace Settings { } else { MixDungeons.Hide(); MixDungeons.SetSelectedIndex(OFF); + MixBosses.Hide(); + MixBosses.SetSelectedIndex(OFF); MixOverworld.Hide(); MixOverworld.SetSelectedIndex(OFF); MixInteriors.Hide(); @@ -2190,6 +2202,7 @@ namespace Settings { if (!MixedEntrancePools) { MixDungeons.SetSelectedIndex(OFF); + MixBosses.SetSelectedIndex(OFF); MixOverworld.SetSelectedIndex(OFF); MixInteriors.SetSelectedIndex(OFF); MixGrottos.SetSelectedIndex(OFF); @@ -2344,6 +2357,7 @@ namespace Settings { ShuffleOverworldSpawns.SetSelectedIndex(cvarSettings[RSK_SHUFFLE_OVERWORLD_SPAWNS]); MixedEntrancePools.SetSelectedIndex(cvarSettings[RSK_MIXED_ENTRANCE_POOLS]); MixDungeons.SetSelectedIndex(cvarSettings[RSK_MIX_DUNGEON_ENTRANCES]); + MixBosses.SetSelectedIndex(cvarSettings[RSK_MIX_BOSS_ENTRANCES]); MixOverworld.SetSelectedIndex(cvarSettings[RSK_MIX_OVERWORLD_ENTRANCES]); MixInteriors.SetSelectedIndex(cvarSettings[RSK_MIX_INTERIOR_ENTRANCES]); MixGrottos.SetSelectedIndex(cvarSettings[RSK_MIX_GROTTO_ENTRANCES]); diff --git a/soh/soh/Enhancements/randomizer/3drando/settings.hpp b/soh/soh/Enhancements/randomizer/3drando/settings.hpp index 12e6443a4..17ea1f0ee 100644 --- a/soh/soh/Enhancements/randomizer/3drando/settings.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/settings.hpp @@ -397,6 +397,7 @@ typedef struct { uint8_t shuffleOverworldSpawns; uint8_t mixedEntrancePools; uint8_t mixDungeons; + uint8_t mixBosses; uint8_t mixOverworld; uint8_t mixInteriors; uint8_t mixGrottos; @@ -784,6 +785,7 @@ void UpdateSettings(std::unordered_map cvarSettin extern Option ShuffleOverworldSpawns; extern Option MixedEntrancePools; extern Option MixDungeons; + extern Option MixBosses; extern Option MixOverworld; extern Option MixInteriors; extern Option MixGrottos; diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp index 0011d3a70..ce885aec5 100644 --- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp @@ -307,35 +307,36 @@ static void WriteLocation( static void WriteShuffledEntrance(std::string sphereString, Entrance* entrance) { int16_t originalIndex = entrance->GetIndex(); int16_t destinationIndex = -1; - int16_t originalBlueWarp = entrance->GetBlueWarp(); - int16_t replacementBlueWarp = -1; int16_t replacementIndex = entrance->GetReplacement()->GetIndex(); int16_t replacementDestinationIndex = -1; std::string name = entrance->GetName(); std::string text = entrance->GetConnectedRegion()->regionName + " from " + entrance->GetReplacement()->GetParentRegion()->regionName; - if (entrance->GetReverse() != nullptr && !entrance->IsDecoupled()) { + // Track the reverse destination, useful for savewarp handling + if (entrance->GetReverse() != nullptr) { destinationIndex = entrance->GetReverse()->GetIndex(); - replacementDestinationIndex = entrance->GetReplacement()->GetReverse()->GetIndex(); - replacementBlueWarp = entrance->GetReplacement()->GetReverse()->GetBlueWarp(); + // When decouple is off we track the replacement's reverse destination, useful for recording visited entrances + if (!entrance->IsDecoupled()) { + replacementDestinationIndex = entrance->GetReplacement()->GetReverse()->GetIndex(); + } } json entranceJson = json::object({ + {"type", entrance->GetType()}, {"index", originalIndex}, {"destination", destinationIndex}, - {"blueWarp", originalBlueWarp}, {"override", replacementIndex}, {"overrideDestination", replacementDestinationIndex}, }); jsonData["entrances"].push_back(entranceJson); - // When decoupled entrances is off, handle saving reverse entrances with blue warps + // When decoupled entrances is off, handle saving reverse entrances if (entrance->GetReverse() != nullptr && !entrance->IsDecoupled()) { json reverseEntranceJson = json::object({ + {"type", entrance->GetReverse()->GetType()}, {"index", replacementDestinationIndex}, {"destination", replacementIndex}, - {"blueWarp", replacementBlueWarp}, {"override", destinationIndex}, {"overrideDestination", originalIndex}, }); diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index 984c20bb2..db287fdff 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -315,6 +315,7 @@ std::unordered_map SpoilerfileSettingNameToEn { "World Settings:Overworld Spawns", RSK_SHUFFLE_OVERWORLD_SPAWNS }, { "World Settings:Mixed Entrance Pools", RSK_MIXED_ENTRANCE_POOLS }, { "World Settings:Mix Dungeons", RSK_MIX_DUNGEON_ENTRANCES }, + { "World Settings:Mix Bosses", RSK_MIX_BOSS_ENTRANCES }, { "World Settings:Mix Overworld", RSK_MIX_OVERWORLD_ENTRANCES }, { "World Settings:Mix Interiors", RSK_MIX_INTERIOR_ENTRANCES }, { "World Settings:Mix Grottos", RSK_MIX_GROTTO_ENTRANCES }, @@ -899,6 +900,7 @@ void Randomizer::ParseRandomizerSettingsFile(const char* spoilerFileName) { case RSK_SHUFFLE_OVERWORLD_SPAWNS: case RSK_MIXED_ENTRANCE_POOLS: case RSK_MIX_DUNGEON_ENTRANCES: + case RSK_MIX_BOSS_ENTRANCES: case RSK_MIX_OVERWORLD_ENTRANCES: case RSK_MIX_INTERIOR_ENTRANCES: case RSK_MIX_GROTTO_ENTRANCES: @@ -1562,9 +1564,9 @@ void Randomizer::ParseEntranceDataFile(const char* spoilerFileName, bool silent) // set all the entrances to be 0 to indicate an unshuffled entrance for (auto &entranceOveride : gSaveContext.entranceOverrides) { + entranceOveride.type = 0; entranceOveride.index = 0; entranceOveride.destination = 0; - entranceOveride.blueWarp = 0; entranceOveride.override = 0; entranceOveride.overrideDestination = 0; } @@ -1579,12 +1581,12 @@ void Randomizer::ParseEntranceDataFile(const char* spoilerFileName, bool silent) json entranceJson = *it; for (auto entranceIt = entranceJson.begin(); entranceIt != entranceJson.end(); ++entranceIt) { - if (entranceIt.key() == "index") { + if (entranceIt.key() == "type") { + gSaveContext.entranceOverrides[i].type = entranceIt.value(); + } else if (entranceIt.key() == "index") { gSaveContext.entranceOverrides[i].index = entranceIt.value(); } else if (entranceIt.key() == "destination") { gSaveContext.entranceOverrides[i].destination = entranceIt.value(); - } else if (entranceIt.key() == "blueWarp") { - gSaveContext.entranceOverrides[i].blueWarp = entranceIt.value(); } else if (entranceIt.key() == "override") { gSaveContext.entranceOverrides[i].override = entranceIt.value(); } else if (entranceIt.key() == "overrideDestination") { @@ -3008,6 +3010,7 @@ void GenerateRandomizerImgui(std::string seed = "") { cvarSettings[RSK_SHUFFLE_OVERWORLD_SPAWNS] = CVarGetInteger("gRandomizeShuffleOverworldSpawns", RO_GENERIC_OFF); cvarSettings[RSK_MIXED_ENTRANCE_POOLS] = CVarGetInteger("gRandomizeMixedEntrances", RO_GENERIC_OFF); cvarSettings[RSK_MIX_DUNGEON_ENTRANCES] = CVarGetInteger("gRandomizeMixDungeons", RO_GENERIC_OFF); + cvarSettings[RSK_MIX_BOSS_ENTRANCES] = CVarGetInteger("gRandomizeMixBosses", RO_GENERIC_OFF); cvarSettings[RSK_MIX_OVERWORLD_ENTRANCES] = CVarGetInteger("gRandomizeMixOverworld", RO_GENERIC_OFF); cvarSettings[RSK_MIX_INTERIOR_ENTRANCES] = CVarGetInteger("gRandomizeMixInteriors", RO_GENERIC_OFF); cvarSettings[RSK_MIX_GROTTO_ENTRANCES] = CVarGetInteger("gRandomizeMixGrottos", RO_GENERIC_OFF); @@ -3706,7 +3709,8 @@ void RandomizerSettingsWindow::DrawElement() { // Mixed Entrance Pools UIWidgets::EnhancementCheckbox("Mixed Entrance Pools", "gRandomizeMixedEntrances"); UIWidgets::InsertHelpHoverText( - "Shuffle entrances into a mixed pool instead of separate ones.\n" + "Shuffle entrances into a mixed pool instead of separate ones. Has no affect on pools whose " + "entrances aren't shuffled, and \"Shuffle Boss Entrances\" must be set to \"Full\" to include them.\n" "\n" "For example, enabling the settings to shuffle grotto, dungeon, and overworld entrances and " "selecting grotto and dungeon entrances here will allow a dungeon to be inside a grotto or " @@ -3720,6 +3724,13 @@ void RandomizerSettingsWindow::DrawElement() { UIWidgets::EnhancementCheckbox("Mix Dungeons", "gRandomizeMixDungeons"); UIWidgets::InsertHelpHoverText("Dungeon entrances will be part of the mixed pool"); } + if (CVarGetInteger("gRandomizeShuffleBossEntrances", RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF) == + RO_BOSS_ROOM_ENTRANCE_SHUFFLE_FULL) { + UIWidgets::Spacer(0); + ImGui::SetCursorPosX(20); + UIWidgets::EnhancementCheckbox("Mix Bosses", "gRandomizeMixBosses"); + UIWidgets::InsertHelpHoverText("Boss entrances will be part of the mixed pool"); + } if (CVarGetInteger("gRandomizeShuffleOverworldEntrances", RO_GENERIC_OFF)) { UIWidgets::Spacer(0); ImGui::SetCursorPosX(20); diff --git a/soh/soh/Enhancements/randomizer/randomizerTypes.h b/soh/soh/Enhancements/randomizer/randomizerTypes.h index 700cddf76..37dc57cef 100644 --- a/soh/soh/Enhancements/randomizer/randomizerTypes.h +++ b/soh/soh/Enhancements/randomizer/randomizerTypes.h @@ -1467,6 +1467,7 @@ typedef enum { RSK_SHUFFLE_OVERWORLD_SPAWNS, RSK_MIXED_ENTRANCE_POOLS, RSK_MIX_DUNGEON_ENTRANCES, + RSK_MIX_BOSS_ENTRANCES, RSK_MIX_OVERWORLD_ENTRANCES, RSK_MIX_INTERIOR_ENTRANCES, RSK_MIX_GROTTO_ENTRANCES, diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance.c b/soh/soh/Enhancements/randomizer/randomizer_entrance.c index ee65d99e4..563873304 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance.c +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance.c @@ -39,17 +39,12 @@ s16 dynamicExitList[] = { // Owl Flights : 0x492064 and 0x492080 static s16 entranceOverrideTable[ENTRANCE_TABLE_SIZE] = {0}; -// Boss scenes (normalize boss scene range to 0 on lookup) to the replaced dungeon scene it is connected to -static s16 dungeonBossSceneOverrides[SHUFFLEABLE_BOSS_COUNT] = {0}; +// Boss scenes (normalize boss scene range to 0 on lookup) mapped to save/death warp entrance +static s16 bossSceneSaveDeathWarps[SHUFFLEABLE_BOSS_COUNT] = {0}; static ActorEntry modifiedLinkActorEntry = {0}; EntranceInfo originalEntranceTable[ENTRANCE_TABLE_SIZE] = {0}; -typedef struct { - s16 blueWarp; - s16 destination; -} BlueWarpReplacement; - typedef struct { s16 entryway; s16 exit; @@ -61,40 +56,25 @@ typedef struct { } DungeonEntranceInfo; static DungeonEntranceInfo dungeons[] = { - //entryway exit, boss, reverse, bluewarp, dungeon scene, boss scene - { DEKU_TREE_ENTRANCE, ENTR_KOKIRI_FOREST_1, ENTR_DEKU_TREE_BOSS_0, ENTR_DEKU_TREE_1, ENTR_KOKIRI_FOREST_11, SCENE_DEKU_TREE, SCENE_DEKU_TREE_BOSS }, - { DODONGOS_CAVERN_ENTRANCE, ENTR_DEATH_MOUNTAIN_TRAIL_3, ENTR_DODONGOS_CAVERN_BOSS_0, ENTR_DODONGOS_CAVERN_1, ENTR_DEATH_MOUNTAIN_TRAIL_5, SCENE_DODONGOS_CAVERN, SCENE_DODONGOS_CAVERN_BOSS }, - { JABU_JABUS_BELLY_ENTRANCE, ENTR_ZORAS_FOUNTAIN_1, ENTR_JABU_JABU_BOSS_0, ENTR_JABU_JABU_1, ENTR_ZORAS_FOUNTAIN_0, SCENE_JABU_JABU, SCENE_JABU_JABU_BOSS }, - { FOREST_TEMPLE_ENTRANCE, ENTR_SACRED_FOREST_MEADOW_1, ENTR_FOREST_TEMPLE_BOSS_0, ENTR_FOREST_TEMPLE_1, ENTR_SACRED_FOREST_MEADOW_3, SCENE_FOREST_TEMPLE, SCENE_FOREST_TEMPLE_BOSS }, - { FIRE_TEMPLE_ENTRANCE, ENTR_DEATH_MOUNTAIN_CRATER_2, ENTR_FIRE_TEMPLE_BOSS_0, ENTR_FIRE_TEMPLE_1, ENTR_DEATH_MOUNTAIN_CRATER_5, SCENE_FIRE_TEMPLE, SCENE_FIRE_TEMPLE_BOSS }, - { WATER_TEMPLE_ENTRANCE, ENTR_LAKE_HYLIA_2, ENTR_WATER_TEMPLE_BOSS_0, ENTR_WATER_TEMPLE_1, ENTR_LAKE_HYLIA_9, SCENE_WATER_TEMPLE, SCENE_WATER_TEMPLE_BOSS }, - { SPIRIT_TEMPLE_ENTRANCE, ENTR_DESERT_COLOSSUS_1, ENTR_SPIRIT_TEMPLE_BOSS_0, ENTR_SPIRIT_TEMPLE_1, ENTR_DESERT_COLOSSUS_8, SCENE_SPIRIT_TEMPLE, SCENE_SPIRIT_TEMPLE_BOSS }, - { SHADOW_TEMPLE_ENTRANCE, ENTR_GRAVEYARD_1, ENTR_SHADOW_TEMPLE_BOSS_0, ENTR_SHADOW_TEMPLE_1, ENTR_GRAVEYARD_8, SCENE_SHADOW_TEMPLE, SCENE_SHADOW_TEMPLE_BOSS }, + //entryway exit, boss, reverse, bluewarp, dungeon scene, boss scene + { ENTR_DEKU_TREE_0, ENTR_KOKIRI_FOREST_1, ENTR_DEKU_TREE_BOSS_0, ENTR_DEKU_TREE_1, ENTR_KOKIRI_FOREST_11, SCENE_DEKU_TREE, SCENE_DEKU_TREE_BOSS }, + { ENTR_DODONGOS_CAVERN_0, ENTR_DEATH_MOUNTAIN_TRAIL_3, ENTR_DODONGOS_CAVERN_BOSS_0, ENTR_DODONGOS_CAVERN_1, ENTR_DEATH_MOUNTAIN_TRAIL_5, SCENE_DODONGOS_CAVERN, SCENE_DODONGOS_CAVERN_BOSS }, + { ENTR_JABU_JABU_0, ENTR_ZORAS_FOUNTAIN_1, ENTR_JABU_JABU_BOSS_0, ENTR_JABU_JABU_1, ENTR_ZORAS_FOUNTAIN_0, SCENE_JABU_JABU, SCENE_JABU_JABU_BOSS }, + { ENTR_FOREST_TEMPLE_0, ENTR_SACRED_FOREST_MEADOW_1, ENTR_FOREST_TEMPLE_BOSS_0, ENTR_FOREST_TEMPLE_1, ENTR_SACRED_FOREST_MEADOW_3, SCENE_FOREST_TEMPLE, SCENE_FOREST_TEMPLE_BOSS }, + { ENTR_FIRE_TEMPLE_0, ENTR_DEATH_MOUNTAIN_CRATER_2, ENTR_FIRE_TEMPLE_BOSS_0, ENTR_FIRE_TEMPLE_1, ENTR_DEATH_MOUNTAIN_CRATER_5, SCENE_FIRE_TEMPLE, SCENE_FIRE_TEMPLE_BOSS }, + { ENTR_WATER_TEMPLE_0, ENTR_LAKE_HYLIA_2, ENTR_WATER_TEMPLE_BOSS_0, ENTR_WATER_TEMPLE_1, ENTR_LAKE_HYLIA_9, SCENE_WATER_TEMPLE, SCENE_WATER_TEMPLE_BOSS }, + { ENTR_SPIRIT_TEMPLE_0, ENTR_DESERT_COLOSSUS_1, ENTR_SPIRIT_TEMPLE_BOSS_0, ENTR_SPIRIT_TEMPLE_1, ENTR_DESERT_COLOSSUS_8, SCENE_SPIRIT_TEMPLE, SCENE_SPIRIT_TEMPLE_BOSS }, + { ENTR_SHADOW_TEMPLE_0, ENTR_GRAVEYARD_1, ENTR_SHADOW_TEMPLE_BOSS_0, ENTR_SHADOW_TEMPLE_1, ENTR_GRAVEYARD_8, SCENE_SHADOW_TEMPLE, SCENE_SHADOW_TEMPLE_BOSS }, }; -//These variables store the new entrance indices for dungeons so that -//savewarping and game overs respawn players at the proper entrance. -//By default, these will be their vanilla values. -static s16 newDekuTreeEntrance = DEKU_TREE_ENTRANCE; -static s16 newDodongosCavernEntrance = DODONGOS_CAVERN_ENTRANCE; -static s16 newJabuJabusBellyEntrance = JABU_JABUS_BELLY_ENTRANCE; -static s16 newForestTempleEntrance = FOREST_TEMPLE_ENTRANCE; -static s16 newFireTempleEntrance = FIRE_TEMPLE_ENTRANCE; -static s16 newWaterTempleEntrance = WATER_TEMPLE_ENTRANCE; -static s16 newSpiritTempleEntrance = SPIRIT_TEMPLE_ENTRANCE; -static s16 newShadowTempleEntrance = SHADOW_TEMPLE_ENTRANCE; -static s16 newBottomOfTheWellEntrance = BOTTOM_OF_THE_WELL_ENTRANCE; -static s16 newGerudoTrainingGroundsEntrance = GERUDO_TRAINING_GROUNDS_ENTRANCE; -static s16 newIceCavernEntrance = ICE_CAVERN_ENTRANCE; - static s8 hasCopiedEntranceTable = 0; static s8 hasModifiedEntranceTable = 0; void Entrance_SetEntranceDiscovered(u16 entranceIndex, u8 isReversedEntrance); u8 Entrance_EntranceIsNull(EntranceOverride* entranceOverride) { - return entranceOverride->index == 0 && entranceOverride->destination == 0 && entranceOverride->blueWarp == 0 - && entranceOverride->override == 0 && entranceOverride->overrideDestination == 0; + return entranceOverride->index == 0 && entranceOverride->destination == 0 && entranceOverride->override == 0 && + entranceOverride->overrideDestination == 0; } static void Entrance_SeparateOGCFairyFountainExit(void) { @@ -113,6 +93,28 @@ static void Entrance_SeparateAdultSpawnAndPrelude() { } } +// Fix Adult dungeon blue warps as Child by assigning the child values for the warp pads +static void Entrance_ReplaceChildTempleWarps() { + if (Randomizer_GetSettingValue(RSK_SHUFFLE_DUNGEON_ENTRANCES) != RO_DUNGEON_ENTRANCE_SHUFFLE_OFF || + Randomizer_GetSettingValue(RSK_SHUFFLE_BOSS_ENTRANCES) != RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF) { + // Forest Temple + gEntranceTable[ENTR_SACRED_FOREST_MEADOW_3] = gEntranceTable[ENTR_SACRED_FOREST_MEADOW_2]; + gEntranceTable[ENTR_SACRED_FOREST_MEADOW_3_1] = gEntranceTable[ENTR_SACRED_FOREST_MEADOW_2_1]; + // Fire Temple + gEntranceTable[ENTR_DEATH_MOUNTAIN_CRATER_5] = gEntranceTable[ENTR_DEATH_MOUNTAIN_CRATER_4]; + gEntranceTable[ENTR_DEATH_MOUNTAIN_CRATER_5_1] = gEntranceTable[ENTR_DEATH_MOUNTAIN_CRATER_4_1]; + // Water Temple + gEntranceTable[ENTR_LAKE_HYLIA_9] = gEntranceTable[ENTR_LAKE_HYLIA_8]; + gEntranceTable[ENTR_LAKE_HYLIA_9_1] = gEntranceTable[ENTR_LAKE_HYLIA_8_1]; + // Shadow Temple + gEntranceTable[ENTR_GRAVEYARD_8] = gEntranceTable[ENTR_GRAVEYARD_7]; + gEntranceTable[ENTR_GRAVEYARD_8_1] = gEntranceTable[ENTR_GRAVEYARD_7_1]; + // Spirit Temple + gEntranceTable[ENTR_DESERT_COLOSSUS_8] = gEntranceTable[ENTR_DESERT_COLOSSUS_5]; + gEntranceTable[ENTR_DESERT_COLOSSUS_8_1] = gEntranceTable[ENTR_DESERT_COLOSSUS_5_1]; + } +} + void Entrance_CopyOriginalEntranceTable(void) { if (!hasCopiedEntranceTable) { memcpy(originalEntranceTable, gEntranceTable, sizeof(EntranceInfo) * ENTRANCE_TABLE_SIZE); @@ -130,9 +132,6 @@ void Entrance_ResetEntranceTable(void) { void Entrance_Init(void) { s32 index; - size_t blueWarpRemapIdx = 0; - BlueWarpReplacement bluewarps[SHUFFLEABLE_BOSS_COUNT] = {0}; - Entrance_CopyOriginalEntranceTable(); // Skip Child Stealth if given by settings @@ -149,6 +148,7 @@ void Entrance_Init(void) { Entrance_SeparateOGCFairyFountainExit(); Entrance_SeparateAdultSpawnAndPrelude(); + Entrance_ReplaceChildTempleWarps(); // Initialize the entrance override table with each index leading to itself. An // index referring to itself means that the entrance is not currently shuffled. @@ -156,9 +156,9 @@ void Entrance_Init(void) { entranceOverrideTable[i] = i; } - // Initialize all boss rooms connected to their vanilla dungeon + // Initialize all boss room save/death warps with their vanilla dungeon entryway for (s16 i = 1; i < SHUFFLEABLE_BOSS_COUNT; i++) { - dungeonBossSceneOverrides[i] = i; + bossSceneSaveDeathWarps[i] = dungeons[i].entryway; } // Initialize the grotto exit and load lists @@ -172,9 +172,30 @@ void Entrance_Init(void) { } s16 originalIndex = gSaveContext.entranceOverrides[i].index; - s16 blueWarpIndex = gSaveContext.entranceOverrides[i].blueWarp; + s16 originalDestination = gSaveContext.entranceOverrides[i].destination; s16 overrideIndex = gSaveContext.entranceOverrides[i].override; + int16_t bossScene = -1; + int16_t saveWarpEntrance = originalDestination; // Default save warp to the original return entrance + + // Search for boss room overrides and look for the matching save/death warp value to use + // If the boss room is in a dungeon, use the dungeons entryway as the save warp + // Otherwise use the "exit" value for the entrance that lead to the boss room + for (int j = 0; j <= SHUFFLEABLE_BOSS_COUNT; j++) { + if (overrideIndex == dungeons[j].bossDoor) { + bossScene = dungeons[j].bossScene; + } + + if (index == dungeons[j].bossDoor) { + saveWarpEntrance = dungeons[j].entryway; + } + } + + // Found a boss scene and a valid save/death warp value + if (bossScene != -1 && saveWarpEntrance != -1) { + bossSceneSaveDeathWarps[bossScene - SCENE_DEKU_TREE_BOSS] = saveWarpEntrance; + } + //Overwrite grotto related indices if (originalIndex >= ENTRANCE_RANDO_GROTTO_EXIT_START) { Grotto_SetExitOverride(originalIndex, overrideIndex); @@ -189,36 +210,6 @@ void Entrance_Init(void) { // Overwrite the indices which we want to shuffle, leaving the rest as they are entranceOverrideTable[originalIndex] = overrideIndex; - if (blueWarpIndex != 0) { - // When boss shuffle is enabled, we need to know what dungeon the boss room is connected to for - // death/save warping, and for the blue warp - if (Randomizer_GetSettingValue(RSK_SHUFFLE_BOSS_ENTRANCES) != RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF) { - s16 bossScene = -1; - s16 replacedDungeonScene = -1; - s16 replacedDungeonExit = -1; - // Search for the boss scene and replaced blue warp exits - for (s16 j = 0; j <= SHUFFLEABLE_BOSS_COUNT; j++) { - if (blueWarpIndex == dungeons[j].blueWarp) { - bossScene = dungeons[j].bossScene; - } - if (overrideIndex == dungeons[j].bossDoorReverse) { - replacedDungeonScene = dungeons[j].scene; - replacedDungeonExit = dungeons[j].exit; - } - } - - // assign the boss scene override - if (bossScene != -1 && replacedDungeonScene != -1 && replacedDungeonExit != -1) { - dungeonBossSceneOverrides[bossScene - SCENE_DEKU_TREE_BOSS] = replacedDungeonScene; - bluewarps[blueWarpRemapIdx].blueWarp = blueWarpIndex; - bluewarps[blueWarpRemapIdx].destination = replacedDungeonExit; - blueWarpRemapIdx++; - } - } else { - entranceOverrideTable[blueWarpIndex] = overrideIndex; - } - } - //Override both land and water entrances for Hyrule Field -> ZR Front and vice versa if (originalIndex == ENTR_ZORAS_RIVER_0) { //Hyrule Field -> ZR Front land entrance entranceOverrideTable[ENTR_ZORAS_RIVER_3] = overrideIndex; @@ -227,14 +218,6 @@ void Entrance_Init(void) { } } - // If we have remapped blue warps from boss shuffle, handle setting those and grabbing the override for - // the replaced dungeons exit in the event that dungeon shuffle is also turned on - for (size_t i = 0; i < ARRAY_COUNT(bluewarps); i++) { - if (bluewarps[i].blueWarp != 0 && bluewarps[i].destination != 0) { - entranceOverrideTable[bluewarps[i].blueWarp] = Entrance_GetOverride(bluewarps[i].destination); - } - } - // Stop playing background music during shuffled entrance transitions // so that we don't get duplicated or overlapping music tracks if (Randomizer_GetSettingValue(RSK_SHUFFLE_OVERWORLD_ENTRANCES)) { @@ -328,40 +311,39 @@ void Entrance_SetGameOverEntrance(void) { s16 scene = gPlayState->sceneNum; - // When in a boss room and boss shuffle is on, get the connected dungeon's original boss room entrance - // then run the normal game over overrides on it + // When in a boss room and boss shuffle is on, use the boss scene to find the death warp entrance if (Randomizer_GetSettingValue(RSK_SHUFFLE_BOSS_ENTRANCES) != RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF && scene >= SCENE_DEKU_TREE_BOSS && scene <= SCENE_SHADOW_TEMPLE_BOSS) { - // Normalize boss scene range to 0 on lookup - scene = dungeonBossSceneOverrides[scene - SCENE_DEKU_TREE_BOSS]; - gSaveContext.entranceIndex = dungeons[scene].bossDoor; + // Normalize boss scene range to 0 on lookup and handle for grotto entrances + gSaveContext.entranceIndex = Grotto_OverrideSpecialEntrance(bossSceneSaveDeathWarps[scene - SCENE_DEKU_TREE_BOSS]); + return; } //Set the current entrance depending on which entrance the player last came through switch (gSaveContext.entranceIndex) { case ENTR_DEKU_TREE_BOSS_0 : //Deku Tree Boss Room - gSaveContext.entranceIndex = newDekuTreeEntrance; + gSaveContext.entranceIndex = ENTR_DEKU_TREE_0; return; case ENTR_DODONGOS_CAVERN_BOSS_0 : //Dodongos Cavern Boss Room - gSaveContext.entranceIndex = newDodongosCavernEntrance; + gSaveContext.entranceIndex = ENTR_DODONGOS_CAVERN_0; return; case ENTR_JABU_JABU_BOSS_0 : //Jabu Jabus Belly Boss Room - gSaveContext.entranceIndex = newJabuJabusBellyEntrance; + gSaveContext.entranceIndex = ENTR_JABU_JABU_0; return; case ENTR_FOREST_TEMPLE_BOSS_0 : //Forest Temple Boss Room - gSaveContext.entranceIndex = newForestTempleEntrance; + gSaveContext.entranceIndex = ENTR_FOREST_TEMPLE_0; return; case ENTR_FIRE_TEMPLE_BOSS_0 : //Fire Temple Boss Room - gSaveContext.entranceIndex = newFireTempleEntrance; + gSaveContext.entranceIndex = ENTR_FIRE_TEMPLE_0; return; case ENTR_WATER_TEMPLE_BOSS_0 : //Water Temple Boss Room - gSaveContext.entranceIndex = newWaterTempleEntrance; + gSaveContext.entranceIndex = ENTR_WATER_TEMPLE_0; return; case ENTR_SPIRIT_TEMPLE_BOSS_0 : //Spirit Temple Boss Room - gSaveContext.entranceIndex = newSpiritTempleEntrance; + gSaveContext.entranceIndex = ENTR_SPIRIT_TEMPLE_0; return; case ENTR_SHADOW_TEMPLE_BOSS_0 : //Shadow Temple Boss Room - gSaveContext.entranceIndex = newShadowTempleEntrance; + gSaveContext.entranceIndex = ENTR_SHADOW_TEMPLE_0; return; case ENTR_GANONDORF_BOSS_0 : //Ganondorf Boss Room gSaveContext.entranceIndex = ENTR_GANONS_TOWER_0; // Inside Ganon's Castle -> Ganon's Tower Climb @@ -374,46 +356,46 @@ void Entrance_SetSavewarpEntrance(void) { s16 scene = gSaveContext.savedSceneNum; - // When in a boss room and boss shuffle is on, use the boss scene override to remap to its - // connected dungeon and use that for the final entrance + // When in a boss room and boss shuffle is on, use the boss scene to find the savewarp entrance if (Randomizer_GetSettingValue(RSK_SHUFFLE_BOSS_ENTRANCES) != RO_BOSS_ROOM_ENTRANCE_SHUFFLE_OFF && scene >= SCENE_DEKU_TREE_BOSS && scene <= SCENE_SHADOW_TEMPLE_BOSS) { - // Normalize boss scene range to 0 on lookup - scene = dungeonBossSceneOverrides[scene - SCENE_DEKU_TREE_BOSS]; + // Normalize boss scene range to 0 on lookup and handle for grotto entrances + gSaveContext.entranceIndex = Grotto_OverrideSpecialEntrance(bossSceneSaveDeathWarps[scene - SCENE_DEKU_TREE_BOSS]); + return; } if (scene == SCENE_DEKU_TREE || scene == SCENE_DEKU_TREE_BOSS) { - gSaveContext.entranceIndex = newDekuTreeEntrance; + gSaveContext.entranceIndex = ENTR_DEKU_TREE_0; } else if (scene == SCENE_DODONGOS_CAVERN || scene == SCENE_DODONGOS_CAVERN_BOSS) { - gSaveContext.entranceIndex = newDodongosCavernEntrance; + gSaveContext.entranceIndex = ENTR_DODONGOS_CAVERN_0; } else if (scene == SCENE_JABU_JABU || scene == SCENE_JABU_JABU_BOSS) { - gSaveContext.entranceIndex = newJabuJabusBellyEntrance; + gSaveContext.entranceIndex = ENTR_JABU_JABU_0; } else if (scene == SCENE_FOREST_TEMPLE || scene == SCENE_FOREST_TEMPLE_BOSS) { //Forest Temple Boss Room - gSaveContext.entranceIndex = newForestTempleEntrance; + gSaveContext.entranceIndex = ENTR_FOREST_TEMPLE_0; } else if (scene == SCENE_FIRE_TEMPLE || scene == SCENE_FIRE_TEMPLE_BOSS) { //Fire Temple Boss Room - gSaveContext.entranceIndex = newFireTempleEntrance; + gSaveContext.entranceIndex = ENTR_FIRE_TEMPLE_0; } else if (scene == SCENE_WATER_TEMPLE || scene == SCENE_WATER_TEMPLE_BOSS) { //Water Temple Boss Room - gSaveContext.entranceIndex = newWaterTempleEntrance; + gSaveContext.entranceIndex = ENTR_WATER_TEMPLE_0; } else if (scene == SCENE_SPIRIT_TEMPLE || scene == SCENE_SPIRIT_TEMPLE_BOSS) { //Spirit Temple Boss Room - gSaveContext.entranceIndex = newSpiritTempleEntrance; + gSaveContext.entranceIndex = ENTR_SPIRIT_TEMPLE_0; } else if (scene == SCENE_SHADOW_TEMPLE || scene == SCENE_SHADOW_TEMPLE_BOSS) { //Shadow Temple Boss Room - gSaveContext.entranceIndex = newShadowTempleEntrance; + gSaveContext.entranceIndex = ENTR_SHADOW_TEMPLE_0; } else if (scene == SCENE_BOTTOM_OF_THE_WELL) { // BOTW - gSaveContext.entranceIndex = newBottomOfTheWellEntrance; + gSaveContext.entranceIndex = ENTR_BOTTOM_OF_THE_WELL_0; } else if (scene == SCENE_GERUDO_TRAINING_GROUND) { // GTG - gSaveContext.entranceIndex = newGerudoTrainingGroundsEntrance; + gSaveContext.entranceIndex = ENTR_GERUDO_TRAINING_GROUND_0; } else if (scene == SCENE_ICE_CAVERN) { // Ice cavern - gSaveContext.entranceIndex = newIceCavernEntrance; + gSaveContext.entranceIndex = ENTR_ICE_CAVERN_0; } else if (scene == SCENE_INSIDE_GANONS_CASTLE) { - gSaveContext.entranceIndex = GANONS_CASTLE_ENTRANCE; + gSaveContext.entranceIndex = ENTR_INSIDE_GANONS_CASTLE_0; } else if (scene == SCENE_GANONS_TOWER || scene == SCENE_INSIDE_GANONS_CASTLE_COLLAPSE || scene == SCENE_GANONS_TOWER_COLLAPSE_INTERIOR || scene == SCENE_GANON_BOSS || scene == SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR) { gSaveContext.entranceIndex = ENTR_GANONS_TOWER_0; // Inside Ganon's Castle -> Ganon's Tower Climb } else if (scene == SCENE_THIEVES_HIDEOUT) { // Theives hideout gSaveContext.entranceIndex = ENTR_THIEVES_HIDEOUT_0; // Gerudo Fortress -> Thieve's Hideout spawn 0 } else if (scene == SCENE_LINKS_HOUSE) { - gSaveContext.entranceIndex = Entrance_OverrideNextIndex(LINK_HOUSE_SAVEWARP_ENTRANCE); + gSaveContext.entranceIndex = Entrance_OverrideNextIndex(ENTR_LINKS_HOUSE_0); } else if (LINK_IS_CHILD) { - gSaveContext.entranceIndex = Entrance_OverrideNextIndex(LINK_HOUSE_SAVEWARP_ENTRANCE); // Child Overworld Spawn + gSaveContext.entranceIndex = Entrance_OverrideNextIndex(ENTR_LINKS_HOUSE_0); // Child Overworld Spawn } else { gSaveContext.entranceIndex = Entrance_OverrideNextIndex(ENTR_HYRULE_FIELD_10); // Adult Overworld Spawn (Normally 0x5F4 (ENTR_TEMPLE_OF_TIME_7), but 0x282 (ENTR_HYRULE_FIELD_10) has been repurposed to differentiate from Prelude which also uses 0x5F4) } @@ -494,7 +476,7 @@ void Entrance_OverrideBlueWarp(void) { void Entrance_OverrideCutsceneEntrance(u16 cutsceneCmd) { switch (cutsceneCmd) { case 24: // Dropping a fish for Jabu Jabu - gPlayState->nextEntranceIndex = Entrance_OverrideNextIndex(newJabuJabusBellyEntrance); + gPlayState->nextEntranceIndex = Entrance_OverrideNextIndex(ENTR_JABU_JABU_0); gPlayState->transitionTrigger = TRANS_TRIGGER_START; gPlayState->transitionType = TRANS_TYPE_FADE_BLACK; // In case Jabu's mouth leads to a grotto return diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance.h b/soh/soh/Enhancements/randomizer/randomizer_entrance.h index 10a485a94..8d8d3a678 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance.h +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance.h @@ -8,20 +8,6 @@ #define ENTRANCE_TABLE_SIZE ENTR_MAX -#define DEKU_TREE_ENTRANCE ENTR_DEKU_TREE_0 -#define DODONGOS_CAVERN_ENTRANCE ENTR_DODONGOS_CAVERN_0 -#define JABU_JABUS_BELLY_ENTRANCE ENTR_JABU_JABU_0 -#define FOREST_TEMPLE_ENTRANCE ENTR_FOREST_TEMPLE_0 -#define FIRE_TEMPLE_ENTRANCE ENTR_FIRE_TEMPLE_0 -#define WATER_TEMPLE_ENTRANCE ENTR_WATER_TEMPLE_0 -#define SPIRIT_TEMPLE_ENTRANCE ENTR_SPIRIT_TEMPLE_0 -#define SHADOW_TEMPLE_ENTRANCE ENTR_SHADOW_TEMPLE_0 -#define BOTTOM_OF_THE_WELL_ENTRANCE ENTR_BOTTOM_OF_THE_WELL_0 -#define GERUDO_TRAINING_GROUNDS_ENTRANCE ENTR_GERUDO_TRAINING_GROUND_0 -#define ICE_CAVERN_ENTRANCE ENTR_ICE_CAVERN_0 -#define GANONS_CASTLE_ENTRANCE ENTR_INSIDE_GANONS_CASTLE_0 -#define LINK_HOUSE_SAVEWARP_ENTRANCE ENTR_LINKS_HOUSE_0 - #define ENTRANCE_RANDO_GROTTO_LOAD_START 0x0700 #define ENTRANCE_RANDO_GROTTO_EXIT_START 0x0800 #define MAX_ENTRANCE_RANDO_USED_INDEX 0x0820 @@ -66,7 +52,7 @@ typedef enum { #define ENTRANCE_RANDO_GROTTO_LOAD(index) ENTRANCE_RANDO_GROTTO_LOAD_START + index #define ENTRANCE_RANDO_GROTTO_EXIT(index) ENTRANCE_RANDO_GROTTO_EXIT_START + index -#define ENTRANCE_OVERRIDES_MAX_COUNT 259 // 11 one-way entrances + 124 two-way entrances (x2) +#define ENTRANCE_OVERRIDES_MAX_COUNT 267 // 19 one-way entrances + 124 two-way entrances (x2) #define SHUFFLEABLE_BOSS_COUNT 8 #define SAVEFILE_ENTRANCES_DISCOVERED_IDX_COUNT 66 // Max entrance rando index is 0x0820, (2080 / 32 == 65) + 1 @@ -79,9 +65,9 @@ typedef enum { (((startTransType) << ENTRANCE_INFO_START_TRANS_TYPE_SHIFT) & ENTRANCE_INFO_START_TRANS_TYPE_MASK)) typedef struct { + uint16_t type; int16_t index; int16_t destination; - int16_t blueWarp; int16_t override; int16_t overrideDestination; } EntranceOverride; diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp index c4af7dd6d..13669271f 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance_tracker.cpp @@ -104,6 +104,7 @@ const EntranceData entranceData[] = { { ENTR_KOKIRI_FOREST_1, ENTR_DEKU_TREE_0, SINGLE_SCENE_INFO(SCENE_DEKU_TREE), "Deku Tree", "KF", ENTRANCE_GROUP_KOKIRI_FOREST, ENTRANCE_GROUP_KOKIRI_FOREST, ENTRANCE_TYPE_DUNGEON, ""}, { ENTR_DEKU_TREE_BOSS_0, ENTR_DEKU_TREE_1, SINGLE_SCENE_INFO(SCENE_DEKU_TREE), "Deku Tree Boss Door", "Gohma", ENTRANCE_GROUP_KOKIRI_FOREST, ENTRANCE_GROUP_KOKIRI_FOREST, ENTRANCE_TYPE_DUNGEON, "", 1}, { ENTR_DEKU_TREE_1, ENTR_DEKU_TREE_BOSS_0, SINGLE_SCENE_INFO(SCENE_DEKU_TREE_BOSS), "Gohma", "Deku Tree Boss Door", ENTRANCE_GROUP_KOKIRI_FOREST, ENTRANCE_GROUP_KOKIRI_FOREST, ENTRANCE_TYPE_DUNGEON, "", 1}, + { ENTR_KOKIRI_FOREST_11, -1, SINGLE_SCENE_INFO(SCENE_DEKU_TREE_BOSS), "Gohma", "Deku Tree Blue Warp", ENTRANCE_GROUP_KOKIRI_FOREST, ENTRANCE_GROUP_KOKIRI_FOREST, ENTRANCE_TYPE_ONE_WAY, "bw", 1}, // Lost Woods { ENTR_KOKIRI_FOREST_2, ENTR_LOST_WOODS_9, SINGLE_SCENE_INFO(SCENE_LOST_WOODS), "Lost Woods Bridge", "KF", ENTRANCE_GROUP_LOST_WOODS, ENTRANCE_GROUP_KOKIRI_FOREST, ENTRANCE_TYPE_OVERWORLD, "lw"}, @@ -131,6 +132,7 @@ const EntranceData entranceData[] = { { ENTR_SACRED_FOREST_MEADOW_1, ENTR_FOREST_TEMPLE_0, SINGLE_SCENE_INFO(SCENE_FOREST_TEMPLE), "Forest Temple", "SFM", ENTRANCE_GROUP_SFM, ENTRANCE_GROUP_SFM, ENTRANCE_TYPE_DUNGEON}, { ENTR_FOREST_TEMPLE_BOSS_0, ENTR_FOREST_TEMPLE_1, SINGLE_SCENE_INFO(SCENE_FOREST_TEMPLE), "Forest Temple Boss Door", "Phantom Ganon", ENTRANCE_GROUP_SFM, ENTRANCE_GROUP_SFM, ENTRANCE_TYPE_DUNGEON, "", 1}, { ENTR_FOREST_TEMPLE_1, ENTR_FOREST_TEMPLE_BOSS_0, SINGLE_SCENE_INFO(SCENE_FOREST_TEMPLE_BOSS), "Phantom Ganon", "Forest Temple Boss Door", ENTRANCE_GROUP_SFM, ENTRANCE_GROUP_SFM, ENTRANCE_TYPE_DUNGEON, "", 1}, + { ENTR_SACRED_FOREST_MEADOW_3, -1, SINGLE_SCENE_INFO(SCENE_FOREST_TEMPLE_BOSS), "Phantom Ganon", "Forest Temple Blue Warp", ENTRANCE_GROUP_SFM, ENTRANCE_GROUP_SFM, ENTRANCE_TYPE_ONE_WAY, "bw", 1}, // Kakariko Village { ENTR_HYRULE_FIELD_1, ENTR_KAKARIKO_VILLAGE_0, SINGLE_SCENE_INFO(SCENE_KAKARIKO_VILLAGE), "Kakariko", "Hyrule Field", ENTRANCE_GROUP_KAKARIKO, ENTRANCE_GROUP_HYRULE_FIELD, ENTRANCE_TYPE_OVERWORLD, "hf"}, @@ -179,6 +181,7 @@ const EntranceData entranceData[] = { { ENTR_GRAVEYARD_1, ENTR_SHADOW_TEMPLE_0, SINGLE_SCENE_INFO(SCENE_SHADOW_TEMPLE), "Shadow Temple", "Graveyard", ENTRANCE_GROUP_GRAVEYARD, ENTRANCE_GROUP_GRAVEYARD, ENTRANCE_TYPE_DUNGEON}, { ENTR_SHADOW_TEMPLE_BOSS_0, ENTR_SHADOW_TEMPLE_1, SINGLE_SCENE_INFO(SCENE_SHADOW_TEMPLE), "Shadow Temple Boss Door", "Bongo-Bongo", ENTRANCE_GROUP_GRAVEYARD, ENTRANCE_GROUP_GRAVEYARD, ENTRANCE_TYPE_DUNGEON, "", 1}, { ENTR_SHADOW_TEMPLE_1, ENTR_SHADOW_TEMPLE_BOSS_0, SINGLE_SCENE_INFO(SCENE_SHADOW_TEMPLE_BOSS), "Bongo-Bongo", "Shadow Temple Boss Door", ENTRANCE_GROUP_GRAVEYARD, ENTRANCE_GROUP_GRAVEYARD, ENTRANCE_TYPE_DUNGEON, "", 1}, + { ENTR_GRAVEYARD_8, -1, SINGLE_SCENE_INFO(SCENE_SHADOW_TEMPLE_BOSS), "Bongo-Bongo", "Shadow Temple Blue Warp", ENTRANCE_GROUP_GRAVEYARD, ENTRANCE_GROUP_GRAVEYARD, ENTRANCE_TYPE_ONE_WAY, "bw", 1}, // Death Mountain Trail { ENTR_GORON_CITY_0, ENTR_DEATH_MOUNTAIN_TRAIL_1, SINGLE_SCENE_INFO(SCENE_DEATH_MOUNTAIN_TRAIL), "DMT", "Goron City", ENTRANCE_GROUP_DEATH_MOUNTAIN_TRAIL, ENTRANCE_GROUP_GORON_CITY, ENTRANCE_TYPE_OVERWORLD, "gc"}, @@ -194,6 +197,7 @@ const EntranceData entranceData[] = { { ENTR_DEATH_MOUNTAIN_TRAIL_3, ENTR_DODONGOS_CAVERN_0, SINGLE_SCENE_INFO(SCENE_DODONGOS_CAVERN), "Dodongo's Cavern", "DMT", ENTRANCE_GROUP_DEATH_MOUNTAIN_TRAIL, ENTRANCE_GROUP_DEATH_MOUNTAIN_TRAIL, ENTRANCE_TYPE_DUNGEON, "dc"}, { ENTR_DODONGOS_CAVERN_BOSS_0, ENTR_DODONGOS_CAVERN_1, SINGLE_SCENE_INFO(SCENE_DODONGOS_CAVERN), "Dodongo's Cavern Boss Door", "King Dodongo", ENTRANCE_GROUP_DEATH_MOUNTAIN_TRAIL, ENTRANCE_GROUP_DEATH_MOUNTAIN_TRAIL, ENTRANCE_TYPE_DUNGEON, "dc", 1}, { ENTR_DODONGOS_CAVERN_1, ENTR_DODONGOS_CAVERN_BOSS_0, SINGLE_SCENE_INFO(SCENE_DODONGOS_CAVERN_BOSS), "King Dodongo", "Dodongo's Cavern Boss Door", ENTRANCE_GROUP_DEATH_MOUNTAIN_TRAIL, ENTRANCE_GROUP_DEATH_MOUNTAIN_TRAIL, ENTRANCE_TYPE_DUNGEON, "dc", 1}, + { ENTR_DEATH_MOUNTAIN_TRAIL_5, -1, SINGLE_SCENE_INFO(SCENE_DODONGOS_CAVERN_BOSS), "King Dodongo", "Dodongo's Cavern Blue Warp", ENTRANCE_GROUP_DEATH_MOUNTAIN_TRAIL, ENTRANCE_GROUP_DEATH_MOUNTAIN_TRAIL, ENTRANCE_TYPE_ONE_WAY, "dc,bw", 1}, // Death Mountain Crater { ENTR_GORON_CITY_1, ENTR_DEATH_MOUNTAIN_CRATER_1, SINGLE_SCENE_INFO(SCENE_DEATH_MOUNTAIN_CRATER), "DMC", "Goron City", ENTRANCE_GROUP_DEATH_MOUNTAIN_CRATER, ENTRANCE_GROUP_GORON_CITY, ENTRANCE_TYPE_OVERWORLD, "gc"}, @@ -208,6 +212,7 @@ const EntranceData entranceData[] = { { ENTR_DEATH_MOUNTAIN_CRATER_2, ENTR_FIRE_TEMPLE_0, SINGLE_SCENE_INFO(SCENE_FIRE_TEMPLE), "Fire Temple", "DMC", ENTRANCE_GROUP_DEATH_MOUNTAIN_CRATER, ENTRANCE_GROUP_DEATH_MOUNTAIN_CRATER, ENTRANCE_TYPE_DUNGEON}, { ENTR_FIRE_TEMPLE_BOSS_0, ENTR_FIRE_TEMPLE_1, SINGLE_SCENE_INFO(SCENE_FIRE_TEMPLE), "Fire Temple Boss Door", "Volvagia", ENTRANCE_GROUP_DEATH_MOUNTAIN_CRATER, ENTRANCE_GROUP_DEATH_MOUNTAIN_CRATER, ENTRANCE_TYPE_DUNGEON, "", 1}, { ENTR_FIRE_TEMPLE_1, ENTR_FIRE_TEMPLE_BOSS_0, SINGLE_SCENE_INFO(SCENE_FIRE_TEMPLE_BOSS), "Volvagia", "Fire Temple Boss Door", ENTRANCE_GROUP_DEATH_MOUNTAIN_CRATER, ENTRANCE_GROUP_DEATH_MOUNTAIN_CRATER, ENTRANCE_TYPE_DUNGEON, "", 1}, + { ENTR_DEATH_MOUNTAIN_CRATER_5, -1, SINGLE_SCENE_INFO(SCENE_FIRE_TEMPLE_BOSS), "Volvagia", "Fire Temple Blue Warp", ENTRANCE_GROUP_DEATH_MOUNTAIN_CRATER, ENTRANCE_GROUP_DEATH_MOUNTAIN_CRATER, ENTRANCE_TYPE_ONE_WAY, "bw", 1}, // Goron City { ENTR_DEATH_MOUNTAIN_TRAIL_1, ENTR_GORON_CITY_0, SINGLE_SCENE_INFO(SCENE_GORON_CITY), "Goron City", "DMT", ENTRANCE_GROUP_GORON_CITY, ENTRANCE_GROUP_DEATH_MOUNTAIN_TRAIL, ENTRANCE_TYPE_OVERWORLD, "gc"}, @@ -247,6 +252,7 @@ const EntranceData entranceData[] = { { ENTR_ZORAS_FOUNTAIN_1, ENTR_JABU_JABU_0, SINGLE_SCENE_INFO(SCENE_JABU_JABU), "Jabu Jabu's Belly", "ZF", ENTRANCE_GROUP_ZORAS_FOUNTAIN, ENTRANCE_GROUP_ZORAS_FOUNTAIN, ENTRANCE_TYPE_DUNGEON}, { ENTR_JABU_JABU_BOSS_0, ENTR_JABU_JABU_1, SINGLE_SCENE_INFO(SCENE_JABU_JABU), "Jabu Jabu's Belly Boss Door", "Barinade", ENTRANCE_GROUP_ZORAS_FOUNTAIN, ENTRANCE_GROUP_ZORAS_FOUNTAIN, ENTRANCE_TYPE_DUNGEON, "", 1}, { ENTR_JABU_JABU_1, ENTR_JABU_JABU_BOSS_0, SINGLE_SCENE_INFO(SCENE_JABU_JABU_BOSS), "Barinade", "Jabu Jabu's Belly Boss Door", ENTRANCE_GROUP_ZORAS_FOUNTAIN, ENTRANCE_GROUP_ZORAS_FOUNTAIN, ENTRANCE_TYPE_DUNGEON, "", 1}, + { ENTR_ZORAS_FOUNTAIN_0, -1, SINGLE_SCENE_INFO(SCENE_JABU_JABU_BOSS), "Barinade", "Jabu Jabu's Belly Blue Warp", ENTRANCE_GROUP_ZORAS_FOUNTAIN, ENTRANCE_GROUP_ZORAS_FOUNTAIN, ENTRANCE_TYPE_ONE_WAY, "bw", 1}, { ENTR_ZORAS_FOUNTAIN_3, ENTR_ICE_CAVERN_0, SINGLE_SCENE_INFO(SCENE_ICE_CAVERN), "Ice Cavern", "ZF", ENTRANCE_GROUP_ZORAS_FOUNTAIN, ENTRANCE_GROUP_ZORAS_FOUNTAIN, ENTRANCE_TYPE_DUNGEON}, // Hyrule Field @@ -298,6 +304,7 @@ const EntranceData entranceData[] = { { ENTR_LAKE_HYLIA_2, ENTR_WATER_TEMPLE_0, SINGLE_SCENE_INFO(SCENE_WATER_TEMPLE), "Water Temple", "Lake Hylia", ENTRANCE_GROUP_LAKE_HYLIA, ENTRANCE_GROUP_LAKE_HYLIA, ENTRANCE_TYPE_DUNGEON, "lh"}, { ENTR_WATER_TEMPLE_BOSS_0, ENTR_WATER_TEMPLE_1, SINGLE_SCENE_INFO(SCENE_WATER_TEMPLE), "Water Temple Boss Door", "Morpha", ENTRANCE_GROUP_LAKE_HYLIA, ENTRANCE_GROUP_LAKE_HYLIA, ENTRANCE_TYPE_DUNGEON, "lh", 1}, { ENTR_WATER_TEMPLE_1, ENTR_WATER_TEMPLE_BOSS_0, SINGLE_SCENE_INFO(SCENE_WATER_TEMPLE_BOSS), "Morpha", "Water Temple Boss Door", ENTRANCE_GROUP_LAKE_HYLIA, ENTRANCE_GROUP_LAKE_HYLIA, ENTRANCE_TYPE_DUNGEON, "lh", 1}, + { ENTR_LAKE_HYLIA_9, -1, SINGLE_SCENE_INFO(SCENE_WATER_TEMPLE_BOSS), "Morpha", "Water Temple Blue Warp", ENTRANCE_GROUP_LAKE_HYLIA, ENTRANCE_GROUP_LAKE_HYLIA, ENTRANCE_TYPE_ONE_WAY, "lh,bw", 1}, // Gerudo Area { ENTR_HYRULE_FIELD_5, ENTR_GERUDO_VALLEY_0, SINGLE_SCENE_INFO(SCENE_GERUDO_VALLEY), "GV", "Hyrule Field", ENTRANCE_GROUP_GERUDO_VALLEY, ENTRANCE_GROUP_HYRULE_FIELD, ENTRANCE_TYPE_OVERWORLD, "hf"}, @@ -328,6 +335,7 @@ const EntranceData entranceData[] = { { ENTR_DESERT_COLOSSUS_1, ENTR_SPIRIT_TEMPLE_0, SINGLE_SCENE_INFO(SCENE_SPIRIT_TEMPLE), "Spirit Temple", "Desert Colossus", ENTRANCE_GROUP_HAUNTED_WASTELAND, ENTRANCE_GROUP_HAUNTED_WASTELAND, ENTRANCE_TYPE_DUNGEON, "dc"}, { ENTR_SPIRIT_TEMPLE_BOSS_0, ENTR_SPIRIT_TEMPLE_1, SINGLE_SCENE_INFO(SCENE_SPIRIT_TEMPLE), "Spirit Temple Boss Door", "Twinrova", ENTRANCE_GROUP_HAUNTED_WASTELAND, ENTRANCE_GROUP_HAUNTED_WASTELAND, ENTRANCE_TYPE_DUNGEON, "", 1}, { ENTR_SPIRIT_TEMPLE_1, ENTR_SPIRIT_TEMPLE_BOSS_0, SINGLE_SCENE_INFO(SCENE_SPIRIT_TEMPLE_BOSS), "Twinrova", "Spirit Temple Boss Door", ENTRANCE_GROUP_HAUNTED_WASTELAND, ENTRANCE_GROUP_HAUNTED_WASTELAND, ENTRANCE_TYPE_DUNGEON, "", 1}, + { ENTR_DESERT_COLOSSUS_8, -1, SINGLE_SCENE_INFO(SCENE_SPIRIT_TEMPLE_BOSS), "Twinrova", "Spirit Temple Blue Warp", ENTRANCE_GROUP_HAUNTED_WASTELAND, ENTRANCE_GROUP_HAUNTED_WASTELAND, ENTRANCE_TYPE_ONE_WAY, "bw", 1}, // Market { ENTR_HYRULE_FIELD_7, ENTR_MARKET_ENTRANCE_DAY_1, {SCENE_NO_SPAWN(SCENE_MARKET_ENTRANCE_DAY), SCENE_NO_SPAWN(SCENE_MARKET_ENTRANCE_NIGHT), SCENE_NO_SPAWN(SCENE_MARKET_ENTRANCE_RUINS)}, "Market Entrance", "Hyrule Field", ENTRANCE_GROUP_MARKET, ENTRANCE_GROUP_HYRULE_FIELD, ENTRANCE_TYPE_OVERWORLD, "hf"}, @@ -797,6 +805,11 @@ void EntranceTrackerWindow::DrawElement() { continue; } + // RANDOTODO: Only show blue warps if bluewarp shuffle is on + if (original->metaTag.ends_with("bw") || override->metaTag.ends_with("bw")) { + continue; + } + bool isDiscovered = IsEntranceDiscovered(entrance.index); bool showOriginal = (!destToggle ? CVarGetInteger("gEntranceTrackerShowTo", 0) : CVarGetInteger("gEntranceTrackerShowFrom", 0)) || isDiscovered; diff --git a/soh/soh/SaveManager.cpp b/soh/soh/SaveManager.cpp index 42f94ee2c..5155bd06b 100644 --- a/soh/soh/SaveManager.cpp +++ b/soh/soh/SaveManager.cpp @@ -184,9 +184,9 @@ void SaveManager::LoadRandomizerVersion2() { SaveManager::Instance->LoadArray("entrances", ARRAY_COUNT(gSaveContext.entranceOverrides), [&](size_t i) { SaveManager::Instance->LoadStruct("", [&]() { + SaveManager::Instance->LoadData("type", gSaveContext.entranceOverrides[i].type); SaveManager::Instance->LoadData("index", gSaveContext.entranceOverrides[i].index); SaveManager::Instance->LoadData("destination", gSaveContext.entranceOverrides[i].destination); - SaveManager::Instance->LoadData("blueWarp", gSaveContext.entranceOverrides[i].blueWarp); SaveManager::Instance->LoadData("override", gSaveContext.entranceOverrides[i].override); SaveManager::Instance->LoadData("overrideDestination", gSaveContext.entranceOverrides[i].overrideDestination); }); @@ -292,9 +292,9 @@ void SaveManager::SaveRandomizer(SaveContext* saveContext, int sectionID, bool f SaveManager::Instance->SaveArray("entrances", ARRAY_COUNT(saveContext->entranceOverrides), [&](size_t i) { SaveManager::Instance->SaveStruct("", [&]() { + SaveManager::Instance->SaveData("type", saveContext->entranceOverrides[i].type); SaveManager::Instance->SaveData("index", saveContext->entranceOverrides[i].index); SaveManager::Instance->SaveData("destination", saveContext->entranceOverrides[i].destination); - SaveManager::Instance->SaveData("blueWarp", saveContext->entranceOverrides[i].blueWarp); SaveManager::Instance->SaveData("override", saveContext->entranceOverrides[i].override); SaveManager::Instance->SaveData("overrideDestination", saveContext->entranceOverrides[i].overrideDestination); }); diff --git a/soh/src/code/z_room.c b/soh/src/code/z_room.c index 772978f09..e92925c6a 100644 --- a/soh/src/code/z_room.c +++ b/soh/src/code/z_room.c @@ -575,6 +575,13 @@ u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) { frontRoom = gSaveContext.respawnFlag > 0 ? ((void)0, gSaveContext.respawn[gSaveContext.respawnFlag - 1].roomIndex) : play->setupEntranceList[play->curSpawn].room; + + // In ER, override roomNum to load based on scene and spawn during scene init + if (IS_RANDO && gSaveContext.respawnFlag <= 0 && + Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { + frontRoom = Entrance_OverrideSpawnSceneRoom(play->sceneNum, play->curSpawn, frontRoom); + } + func_8009728C(play, roomCtx, frontRoom); return maxRoomSize; @@ -583,12 +590,6 @@ u32 func_80096FE8(PlayState* play, RoomContext* roomCtx) { s32 func_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomNum) { size_t size; - // In ER, override roomNum to load based on scene and spawn - if (IS_RANDO && gSaveContext.respawnFlag <= 0 && - Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { - roomNum = Entrance_OverrideSpawnSceneRoom(play->sceneNum, play->curSpawn, roomNum); - } - return OTRfunc_8009728C(play, roomCtx, roomNum); if (roomCtx->status == 0) { 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 145abcdd0..852c8d3d5 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -4538,7 +4538,9 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol Scene_SetTransitionForNextEntrance(play); } else { - if (SurfaceType_GetSlope(&play->colCtx, poly, bgId) == 2) { + // In Entrance rando, if our respawnFlag is set for a grotto return, we don't want the void out to happen + if (SurfaceType_GetSlope(&play->colCtx, poly, bgId) == 2 && + (!IS_RANDO || (Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES) && gSaveContext.respawnFlag != 2))) { gSaveContext.respawn[RESPAWN_MODE_DOWN].entranceIndex = play->nextEntranceIndex; Play_TriggerVoidOut(play); gSaveContext.respawnFlag = -2; From 460ec1bb037c28ee45ba535f7db656826bd885c9 Mon Sep 17 00:00:00 2001 From: Spodi Date: Fri, 16 Feb 2024 02:17:03 +0100 Subject: [PATCH 05/44] Use manifest for windows DPI awareness (#3270) --- soh/SHIPOFHARKINIAN.manifest | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/soh/SHIPOFHARKINIAN.manifest b/soh/SHIPOFHARKINIAN.manifest index 80d9f6036..6f47a937f 100644 --- a/soh/SHIPOFHARKINIAN.manifest +++ b/soh/SHIPOFHARKINIAN.manifest @@ -28,4 +28,10 @@ + + + true/pm + permonitorv2,permonitor + + From 46aea3aa7c1e93ee2c557cb7de63358e6eb2a494 Mon Sep 17 00:00:00 2001 From: inspectredc <78732756+inspectredc@users.noreply.github.com> Date: Fri, 16 Feb 2024 01:17:28 +0000 Subject: [PATCH 06/44] Player State Docs (#3280) * state flags 1 * state flags 2 * state flags 3 * fill array --- .../randomizer/randomizer_entrance.c | 4 +- soh/src/code/z_actor.c | 67 ++++++++++++------- soh/src/code/z_camera.c | 36 +++++----- soh/src/code/z_onepointdemo.c | 4 +- soh/src/code/z_parameter.c | 10 +-- soh/src/code/z_player_lib.c | 52 +++++++------- .../actors/ovl_Arms_Hook/z_arms_hook.c | 2 +- .../ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c | 4 +- .../overlays/actors/ovl_Bg_Haka/z_bg_haka.c | 12 ++-- .../actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c | 8 +-- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c | 2 +- .../ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c | 8 +-- .../ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c | 2 +- .../ovl_Bg_Ice_Objects/z_bg_ice_objects.c | 6 +- .../actors/ovl_Bg_Jya_Block/z_bg_jya_block.c | 2 +- .../ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c | 2 +- .../z_bg_jya_zurerukabe.c | 2 +- .../z_bg_mori_kaitenkabe.c | 4 +- .../actors/ovl_Bg_Po_Event/z_bg_po_event.c | 12 ++-- .../ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c | 12 ++-- .../z_bg_spot16_bombstone.c | 2 +- .../ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c | 4 +- .../actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c | 2 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 4 +- .../overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 20 +++--- .../overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 10 +-- .../overlays/actors/ovl_Boss_Va/z_boss_va.c | 12 ++-- .../overlays/actors/ovl_Door_Ana/z_door_ana.c | 6 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 4 +- .../overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 2 +- soh/src/overlays/actors/ovl_En_Am/z_en_am.c | 2 +- soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c | 6 +- .../actors/ovl_En_Blkobj/z_en_blkobj.c | 2 +- soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c | 4 +- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c | 4 +- .../overlays/actors/ovl_En_Bombf/z_en_bombf.c | 10 +-- .../overlays/actors/ovl_En_Boom/z_en_boom.c | 2 +- soh/src/overlays/actors/ovl_En_Box/z_en_box.c | 4 +- soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c | 2 +- .../overlays/actors/ovl_En_Crow/z_en_crow.c | 4 +- soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c | 18 ++--- soh/src/overlays/actors/ovl_En_Dns/z_en_dns.c | 2 +- .../actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c | 2 +- .../overlays/actors/ovl_En_Door/z_en_door.c | 2 +- soh/src/overlays/actors/ovl_En_Du/z_en_du.c | 10 +-- soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c | 16 ++--- .../actors/ovl_En_Encount1/z_en_encount1.c | 2 +- .../actors/ovl_En_Fire_Rock/z_en_fire_rock.c | 2 +- .../actors/ovl_En_Floormas/z_en_floormas.c | 2 +- soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c | 2 +- soh/src/overlays/actors/ovl_En_Fu/z_en_fu.c | 12 ++-- soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c | 4 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 2 +- soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c | 6 +- .../overlays/actors/ovl_En_Horse/z_en_horse.c | 4 +- soh/src/overlays/actors/ovl_En_In/z_en_in.c | 4 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 8 +-- .../actors/ovl_En_Kakasi3/z_en_kakasi3.c | 16 ++--- .../actors/ovl_En_M_Thunder/z_en_m_thunder.c | 14 ++-- soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 12 ++-- soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 10 +-- soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 2 +- soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c | 38 +++++------ soh/src/overlays/actors/ovl_En_Md/z_en_md.c | 8 +-- soh/src/overlays/actors/ovl_En_Mk/z_en_mk.c | 4 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 2 +- .../ovl_En_Okarina_Tag/z_en_okarina_tag.c | 16 ++--- .../overlays/actors/ovl_En_Okuta/z_en_okuta.c | 2 +- .../overlays/actors/ovl_En_Ossan/z_en_ossan.c | 10 +-- .../actors/ovl_En_Po_Field/z_en_po_field.c | 6 +- soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c | 12 +++- soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c | 4 +- soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 5 +- soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c | 26 +++---- .../actors/ovl_En_Stream/z_en_stream.c | 2 +- soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c | 2 +- soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c | 4 +- .../overlays/actors/ovl_En_Test/z_en_test.c | 6 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 24 +++---- soh/src/overlays/actors/ovl_En_Tp/z_en_tp.c | 2 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 6 +- soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c | 2 +- soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c | 4 +- .../overlays/actors/ovl_Fishing/z_fishing.c | 2 +- .../actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c | 14 ++-- .../ovl_Obj_Timeblock/z_obj_timeblock.c | 4 +- .../ovl_Obj_Warp2block/z_obj_warp2block.c | 4 +- .../overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 4 +- 88 files changed, 375 insertions(+), 347 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_entrance.c b/soh/soh/Enhancements/randomizer/randomizer_entrance.c index 563873304..65606d5d9 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_entrance.c +++ b/soh/soh/Enhancements/randomizer/randomizer_entrance.c @@ -495,8 +495,8 @@ void Entrance_EnableFW(void) { gPlayState->sceneNum == SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR || gPlayState->sceneNum == SCENE_GROTTOS || gPlayState->sceneNum == SCENE_FISHING_POND || gPlayState->sceneNum == SCENE_GANON_BOSS || gSaveContext.eventInf[0] & 0x1 || // Ingo's Minigame state - player->stateFlags1 & 0x08A02000 || // Swimming, riding horse, Down A, hanging from a ledge - player->stateFlags2 & 0x00040000 // Blank A + player->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LADDER | PLAYER_STATE1_ON_HORSE | PLAYER_STATE1_IN_WATER) || // Swimming, riding horse, Down A, hanging from a ledge + player->stateFlags2 & PLAYER_STATE2_CRAWLING // Blank A // Shielding, spinning and getting skull tokens still disable buttons automatically ) { return; diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 089ed475a..a8924398b 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -486,7 +486,7 @@ void func_8002C124(TargetContext* targetCtx, PlayState* play) { func_8002BE64(targetCtx, targetCtx->unk_4C, spBC.x, spBC.y, spBC.z); - if ((!(player->stateFlags1 & 0x40)) || (actor != player->unk_664)) { + if ((!(player->stateFlags1 & PLAYER_STATE1_TEXT_ON_SCREEN)) || (actor != player->unk_664)) { OVERLAY_DISP = Gfx_SetupDL(OVERLAY_DISP, 0x39); for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) { @@ -1376,7 +1376,7 @@ f32 Actor_HeightDiff(Actor* actorA, Actor* actorB) { } f32 Player_GetHeight(Player* player) { - f32 offset = (player->stateFlags1 & 0x800000) ? 32.0f : 0.0f; + f32 offset = (player->stateFlags1 & PLAYER_STATE1_ON_HORSE) ? 32.0f : 0.0f; if (LINK_IS_ADULT) { return offset + 68.0f; @@ -1386,9 +1386,9 @@ f32 Player_GetHeight(Player* player) { } f32 func_8002DCE4(Player* player) { - if (player->stateFlags1 & 0x800000) { + if (player->stateFlags1 & PLAYER_STATE1_ON_HORSE) { return 8.0f; - } else if (player->stateFlags1 & 0x8000000) { + } else if (player->stateFlags1 & PLAYER_STATE1_IN_WATER) { return (R_RUN_SPEED_LIMIT / 100.0f) * 0.6f; } else { return R_RUN_SPEED_LIMIT / 100.0f; @@ -1396,7 +1396,7 @@ f32 func_8002DCE4(Player* player) { } s32 func_8002DD6C(Player* player) { - return player->stateFlags1 & 0x8; + return player->stateFlags1 & PLAYER_STATE1_ITEM_IN_HAND; } s32 func_8002DD78(Player* player) { @@ -1406,19 +1406,19 @@ s32 func_8002DD78(Player* player) { s32 func_8002DDA8(PlayState* play) { Player* player = GET_PLAYER(play); - return (player->stateFlags1 & 0x800) || func_8002DD78(player); + return (player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) || func_8002DD78(player); } s32 func_8002DDE4(PlayState* play) { Player* player = GET_PLAYER(play); - return player->stateFlags2 & 0x8; + return player->stateFlags2 & PLAYER_STATE2_FOOTSTEP; } s32 func_8002DDF4(PlayState* play) { Player* player = GET_PLAYER(play); - return player->stateFlags2 & 0x1000; + return player->stateFlags2 & PLAYER_STATE2_STATIONARY_LADDER; } void func_8002DE04(PlayState* play, Actor* actorA, Actor* actorB) { @@ -1440,12 +1440,12 @@ void func_8002DE74(PlayState* play, Player* player) { void Actor_MountHorse(PlayState* play, Player* player, Actor* horse) { player->rideActor = horse; - player->stateFlags1 |= 0x800000; + player->stateFlags1 |= PLAYER_STATE1_ON_HORSE; horse->child = &player->actor; } s32 func_8002DEEC(Player* player) { - return (player->stateFlags1 & 0x20000080) || (player->csAction != 0); + return (player->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_CUTSCENE)) || (player->csAction != 0); } void func_8002DF18(PlayState* play, Player* player) { @@ -2005,10 +2005,13 @@ u32 Actor_HasParent(Actor* actor, PlayState* play) { s32 GiveItemEntryWithoutActor(PlayState* play, GetItemEntry getItemEntry) { Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { + if (!(player->stateFlags1 & + (PLAYER_STATE1_DEAD | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | + PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_FIRST_PERSON | PLAYER_STATE1_CLIMBING_LADDER)) && + Player_GetExplosiveHeld(player) < 0) { if (((player->heldActor != NULL) && ((getItemEntry.getItemId > GI_NONE) && (getItemEntry.getItemId < GI_MAX)) || (IS_RANDO && (getItemEntry.getItemId > RG_NONE) && (getItemEntry.getItemId < RG_MAX))) || - (!(player->stateFlags1 & 0x20000800))) { + (!(player->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE)))) { if ((getItemEntry.getItemId != GI_NONE)) { player->getItemEntry = getItemEntry; player->getItemId = getItemEntry.getItemId; @@ -2041,11 +2044,14 @@ s32 GiveItemEntryWithoutActor(PlayState* play, GetItemEntry getItemEntry) { s32 GiveItemEntryFromActor(Actor* actor, PlayState* play, GetItemEntry getItemEntry, f32 xzRange, f32 yRange) { Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { + if (!(player->stateFlags1 & + (PLAYER_STATE1_DEAD | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | + PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_FIRST_PERSON | PLAYER_STATE1_CLIMBING_LADDER)) && + Player_GetExplosiveHeld(player) < 0) { if ((((player->heldActor != NULL) || (actor == player->targetActor)) && ((!IS_RANDO && ((getItemEntry.getItemId > GI_NONE) && (getItemEntry.getItemId < GI_MAX))) || (IS_RANDO && ((getItemEntry.getItemId > RG_NONE) && (getItemEntry.getItemId < RG_MAX))))) || - (!(player->stateFlags1 & 0x20000800))) { + (!(player->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE)))) { if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) { s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y; s32 absYawDiff = ABS(yawDiff); @@ -2083,10 +2089,13 @@ void GiveItemEntryFromActorWithFixedRange(Actor* actor, PlayState* play, GetItem s32 func_8002F434(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange, f32 yRange) { Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { + if (!(player->stateFlags1 & + (PLAYER_STATE1_DEAD | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | + PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_FIRST_PERSON | PLAYER_STATE1_CLIMBING_LADDER)) && + Player_GetExplosiveHeld(player) < 0) { if ((((player->heldActor != NULL) || (actor == player->targetActor)) && ((!IS_RANDO && ((getItemId > GI_NONE) && (getItemId < GI_MAX))) || (IS_RANDO && ((getItemId > RG_NONE) && (getItemId < RG_MAX))))) || - (!(player->stateFlags1 & 0x20000800))) { + (!(player->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE)))) { if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) { s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y; s32 absYawDiff = ABS(yawDiff); @@ -2156,7 +2165,9 @@ s32 Actor_IsMounted(PlayState* play, Actor* horse) { u32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) { Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & 0x003C7880)) { + if (!(player->stateFlags1 & + (PLAYER_STATE1_DEAD | PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_HANGING_OFF_LEDGE | + PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_FIRST_PERSON | PLAYER_STATE1_CLIMBING_LADDER))) { player->rideActor = horse; player->mountSide = mountSide; return true; @@ -2501,8 +2512,18 @@ void func_800304DC(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEnt } u32 D_80116068[ACTORCAT_MAX] = { - 0x100000C0, 0x100000C0, 0x00000000, 0x100004C0, 0x00000080, 0x300000C0, - 0x10000080, 0x00000000, 0x300000C0, 0x100004C0, 0x00000000, 0x100000C0, + PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, + PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, + 0, + PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, + PLAYER_STATE1_DEAD, + PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE, + PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, + 0, + PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE, + PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, + 0, + PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, }; void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { @@ -2543,11 +2564,11 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { sp80 = &D_80116068[0]; - if (player->stateFlags2 & 0x8000000) { + if (player->stateFlags2 & PLAYER_STATE2_OCARINA_PLAYING) { unkFlag = ACTOR_FLAG_NO_FREEZE_OCARINA; } - if ((player->stateFlags1 & 0x40) && ((player->actor.textId & 0xFF00) != 0x600)) { + if ((player->stateFlags1 & PLAYER_STATE1_TEXT_ON_SCREEN) && ((player->actor.textId & 0xFF00) != 0x600)) { sp74 = player->targetActor; } @@ -3891,7 +3912,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 s32 Actor_IsTargeted(PlayState* play, Actor* actor) { Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & 0x10) && actor->isTargeted) { + if ((player->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) && actor->isTargeted) { return true; } else { return false; @@ -3904,7 +3925,7 @@ s32 Actor_IsTargeted(PlayState* play, Actor* actor) { s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor) { Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & 0x10) && !actor->isTargeted) { + if ((player->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) && !actor->isTargeted) { return true; } else { return false; diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index ec3981397..b5a0318f6 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -522,7 +522,7 @@ s32 Camera_GetWaterBoxDataIdx(Camera* camera, f32* waterY) { return -1; } - if (!(camera->player->stateFlags1 & 0x8000000)) { + if (!(camera->player->stateFlags1 & PLAYER_STATE1_IN_WATER)) { // player is not swimming *waterY = BGCHECK_Y_MIN; return -1; @@ -1031,7 +1031,7 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 yOffset, f32* arg } if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || - camera->player->stateFlags1 & 0x200000) { + camera->player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER) { *arg3 = Camera_LERPCeilF(playerPosRot->pos.y, *arg3, PCT(OREG(43)), 0.1f); phi_f20 = playerPosRot->pos.y - *arg3; posOffsetTarget.y -= phi_f20; @@ -1134,7 +1134,7 @@ s32 Camera_CalcAtForLockOn(Camera* camera, VecSph* eyeAtDir, Vec3f* targetPos, f tmpPos0.z = tmpPos0.z + lookFromOffset.z; if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || - camera->player->stateFlags1 & 0x200000) { + camera->player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER) { *yPosOffset = Camera_LERPCeilF(playerPosRot->pos.y, *yPosOffset, PCT(OREG(43)), 0.1f); yPosDelta = playerPosRot->pos.y - *yPosOffset; tmpPos0.y -= yPosDelta; @@ -2203,7 +2203,7 @@ s32 Camera_Parallel1(Camera* camera) { } if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || - camera->player->stateFlags1 & 0x200000) { + camera->player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER) { anim->yTarget = playerPosRot->pos.y; sp6A = 0; } else { @@ -2907,7 +2907,7 @@ s32 Camera_Battle1(Camera* camera) { sp78 = batt1->swingPitchFinal; fov = batt1->fov; - if (camera->player->stateFlags1 & 0x1000) { + if (camera->player->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK) { // charging sword. anim->unk_10 = Camera_LERPCeilF(PCT(OREG(12)) * 0.5f, anim->unk_10, PCT(OREG(25)), 0.1f); camera->xzOffsetUpdateRate = Camera_LERPCeilF(0.2f, camera->xzOffsetUpdateRate, PCT(OREG(25)), 0.1f); @@ -2978,7 +2978,7 @@ s32 Camera_Battle1(Camera* camera) { } if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || - camera->player->stateFlags1 & 0x200000) { + camera->player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER) { isOffGround = false; anim->yPosOffset = playerPosRot->pos.y; } else { @@ -3303,7 +3303,7 @@ s32 Camera_KeepOn1(Camera* camera) { anim->unk_0C = NULL; cont: if (camera->playerGroundY == camera->playerPosRot.pos.y || camera->player->actor.gravity > -0.1f || - camera->player->stateFlags1 & 0x200000) { + camera->player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER) { anim->unk_08 = playerPosRot->pos.y; sp80 = 0; } else { @@ -3724,7 +3724,7 @@ s32 Camera_KeepOn4(Camera* camera) { keep4->unk_04 = playerHeight * 1.6f * yNormal; keep4->unk_08 = -2.0f; keep4->unk_0C = 120.0f; - keep4->unk_10 = player->stateFlags1 & 0x8000000 ? 0.0f : 20.0f; + keep4->unk_10 = player->stateFlags1 & PLAYER_STATE1_IN_WATER ? 0.0f : 20.0f; keep4->unk_1C = 0x3212; keep4->unk_1E = 0x1E; keep4->unk_18 = 50.0f; @@ -4982,7 +4982,7 @@ s32 Camera_Unique0(Camera* camera) { camera->animState++; } - if (player->stateFlags1 & 0x20000000) { + if (player->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) { anim->initalPos = playerPosRot->pos; } @@ -4990,7 +4990,7 @@ s32 Camera_Unique0(Camera* camera) { if (anim->animTimer > 0) { anim->animTimer--; anim->initalPos = playerPosRot->pos; - } else if ((!(player->stateFlags1 & 0x20000000)) && + } else if ((!(player->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE)) && ((OLib_Vec3fDistXZ(&playerPosRot->pos, &anim->initalPos) >= 10.0f) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_A) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_B) || @@ -5018,7 +5018,7 @@ s32 Camera_Unique0(Camera* camera) { anim->initalPos = playerPosRot->pos; } - if ((!(player->stateFlags1 & 0x20000000)) && + if ((!(player->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE)) && ((0.001f < camera->xzSpeed) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_A) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_B) || CHECK_BTN_ALL(D_8015BD7C->state.input[0].press.button, BTN_CLEFT) || @@ -5235,7 +5235,7 @@ s32 Camera_Unique9(Camera* camera) { D_8011D3AC = anim->curKeyFrame->unk_01 & 0xF; } else if ((anim->curKeyFrame->unk_01 & 0xF0) == 0xC0) { Camera_UpdateInterface(0xF000 | ((anim->curKeyFrame->unk_01 & 0xF) << 8)); - } else if (camera->player->stateFlags1 & 0x8000000 && player->currentBoots != PLAYER_BOOTS_IRON) { + } else if (camera->player->stateFlags1 & PLAYER_STATE1_IN_WATER && player->currentBoots != PLAYER_BOOTS_IRON) { func_8002DF38(camera->play, camera->target, 8); osSyncPrintf("camera: demo: player demo set WAIT\n"); } else { @@ -5610,7 +5610,7 @@ s32 Camera_Unique9(Camera* camera) { // Set the player's position camera->player->actor.world.pos.x = anim->playerPos.x; camera->player->actor.world.pos.z = anim->playerPos.z; - if (camera->player->stateFlags1 & 0x8000000 && player->currentBoots != PLAYER_BOOTS_IRON) { + if (camera->player->stateFlags1 & PLAYER_STATE1_IN_WATER && player->currentBoots != PLAYER_BOOTS_IRON) { camera->player->actor.world.pos.y = anim->playerPos.y; } } else { @@ -6171,16 +6171,16 @@ s32 Camera_Demo5(Camera* camera) { sDemo5PrevSfxFrame = camera->play->state.frames; - if (camera->player->stateFlags1 & 0x8000000 && (player->currentBoots != PLAYER_BOOTS_IRON)) { + if (camera->player->stateFlags1 & PLAYER_STATE1_IN_WATER && (player->currentBoots != PLAYER_BOOTS_IRON)) { // swimming, and not iron boots - player->stateFlags1 |= 0x20000000; + player->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; // env frozen player->actor.freezeTimer = camera->timer; } else { sp4A = playerhead.rot.y - playerTargetGeo.yaw; if (camera->target->category == ACTORCAT_PLAYER) { pad = camera->play->state.frames - sDemo5PrevAction12Frame; - if (player->stateFlags1 & 0x800) { + if (player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { // holding object over head. func_8002DF54(camera->play, camera->target, 8); } else if (ABS(pad) > 3000) { @@ -7240,7 +7240,7 @@ s32 Camera_UpdateWater(Camera* camera) { } if (camera->unk_14C & 0x200) { - if (player->stateFlags2 & 0x800) { + if (player->stateFlags2 & PLAYER_STATE2_DIVING) { Camera_ChangeSettingFlags(camera, CAM_SET_PIVOT_WATER_SURFACE, 6); camera->unk_14C |= (s16)0x8000; } else if (camera->unk_14C & (s16)0x8000) { @@ -7730,7 +7730,7 @@ void Camera_Finish(Camera* camera) { if ((camera->parentCamIdx == MAIN_CAM) && (camera->csId != 0)) { player->actor.freezeTimer = 0; - player->stateFlags1 &= ~0x20000000; + player->stateFlags1 &= ~PLAYER_STATE1_IN_CUTSCENE; if (player->csAction != 0) { func_8002DF54(camera->play, &player->actor, 7); diff --git a/soh/src/code/z_onepointdemo.c b/soh/src/code/z_onepointdemo.c index 9489eefcd..411f4fb63 100644 --- a/soh/src/code/z_onepointdemo.c +++ b/soh/src/code/z_onepointdemo.c @@ -788,7 +788,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor func_8002DF54(play, NULL, 8); func_800C0808(play, camIdx, player, CAM_SET_CS_C); - player->stateFlags1 |= 0x20000000; + player->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; player->actor.freezeTimer = 90; i = Quake_Add(csCam, 1); @@ -990,7 +990,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor if (func_800C0CB8(play)) { D_801231B4[0].eyeTargetInit.z = D_801231B4[1].eyeTargetInit.z = !LINK_IS_ADULT ? 100.0f : 120.0f; - if (player->stateFlags1 & 0x08000000) { + if (player->stateFlags1 & PLAYER_STATE1_IN_WATER) { D_801231B4[2].atTargetInit.z = 0.0f; } Actor_GetWorldPosShapeRot(&spA0, &player->actor); diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 6efa962b6..1881ea0e8 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -3837,7 +3837,7 @@ void Interface_DrawEnemyHealthBar(TargetContext* targetCtx, PlayState* play) { Interface_CreateQuadVertexGroup(&sEnemyHealthVtx[12], -floorf(halfBarWidth) + endTexWidth, (-texHeight / 2) + 3, healthBarFill, 7, 0); - if (((!(player->stateFlags1 & 0x40)) || (actor != player->unk_664)) && targetCtx->unk_44 < 500.0f) { + if (((!(player->stateFlags1 & PLAYER_STATE1_TEXT_ON_SCREEN)) || (actor != player->unk_664)) && targetCtx->unk_44 < 500.0f) { f32 slideInOffsetY = 0; // Slide in the health bar from edge of the screen (mimic the Z-Target triangles fly in) @@ -4316,7 +4316,7 @@ void Interface_DrawItemButtons(PlayState* play) { if ((gSaveContext.unk_13EA == 1) || (gSaveContext.unk_13EA == 2) || (gSaveContext.unk_13EA == 5)) { temp = 0; - } else if ((player->stateFlags1 & 0x00200000) || (Player_GetEnvironmentalHazard(play) == 4) || + } else if ((player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER) || (Player_GetEnvironmentalHazard(play) == 4) || (player->stateFlags2 & PLAYER_STATE2_CRAWLING)) { temp = 70; } else { @@ -5389,7 +5389,7 @@ void Interface_Draw(PlayState* play) { Interface_DrawItemIconTexture(play, gItemIcons[gSaveContext.equips.buttonItems[0]], 0); } - if ((player->stateFlags1 & 0x00800000) || (play->shootingGalleryStatus > 1) || + if ((player->stateFlags1 & PLAYER_STATE1_ON_HORSE) || (play->shootingGalleryStatus > 1) || ((play->sceneNum == SCENE_BOMBCHU_BOWLING_ALLEY) && Flags_GetSwitch(play, 0x38))) { if (!fullUi) { @@ -5854,7 +5854,7 @@ void Interface_Draw(PlayState* play) { if ((play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && (play->gameOverCtx.state == GAMEOVER_INACTIVE) && (msgCtx->msgMode == MSGMODE_NONE) && - !(player->stateFlags2 & 0x01000000) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + !(player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play) && (gSaveContext.minigameState != 1) && (play->shootingGalleryStatus <= 1) && !((play->sceneNum == SCENE_BOMBCHU_BOWLING_ALLEY) && Flags_GetSwitch(play, 0x38))) { @@ -6546,7 +6546,7 @@ void Interface_Update(PlayState* play) { HealthMeter_Update(play); if ((gSaveContext.timer1State >= 3) && (play->pauseCtx.state == 0) && (play->pauseCtx.debugState == 0) && - (msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & 0x01000000) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && + (msgCtx->msgMode == MSGMODE_NONE) && !(player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (play->transitionMode == TRANS_MODE_OFF) && !Play_InCsMode(play)) {} if (gSaveContext.rupeeAccumulator != 0) { diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index 3edaaca5b..532b01eba 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -526,7 +526,7 @@ void Player_SetBootData(PlayState* play, Player* this) { currentBoots = PLAYER_BOOTS_KOKIRI_CHILD; } } else if (currentBoots == PLAYER_BOOTS_IRON) { - if (this->stateFlags1 & 0x8000000) { + if (this->stateFlags1 & PLAYER_STATE1_IN_WATER) { currentBoots = PLAYER_BOOTS_IRON_UNDERWATER; } REG(27) = 500; @@ -564,8 +564,8 @@ uint8_t Player_IsCustomLinkModel() { } s32 Player_InBlockingCsMode(PlayState* play, Player* this) { - return (this->stateFlags1 & 0x20000080) || (this->csAction != 0) || (play->transitionTrigger == TRANS_TRIGGER_START) || - (this->stateFlags1 & 1) || (this->stateFlags3 & 0x80) || + return (this->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_CUTSCENE)) || (this->csAction != 0) || (play->transitionTrigger == TRANS_TRIGGER_START) || + (this->stateFlags1 & PLAYER_STATE1_LOADING) || (this->stateFlags3 & PLAYER_STATE3_HOOKSHOT_TRAVELLING) || ((gSaveContext.magicState != MAGIC_STATE_IDLE) && (Player_ActionToMagicSpell(this, this->itemAction) >= 0)); } @@ -576,7 +576,7 @@ s32 Player_InCsMode(PlayState* play) { } s32 func_8008E9C4(Player* this) { - return (this->stateFlags1 & 0x10); + return (this->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET); } s32 Player_IsChildWithHylianShield(Player* this) { @@ -595,7 +595,7 @@ s32 Player_ActionToModelGroup(Player* this, s32 actionParam) { } void Player_SetModelsForHoldingShield(Player* this) { - if ((this->stateFlags1 & 0x400000) && + if ((this->stateFlags1 & PLAYER_STATE1_SHIELDING) && ((this->itemAction < 0) || (this->itemAction == this->heldItemAction))) { if ((CVarGetInteger("gShieldTwoHanded", 0) && (this->heldItemAction != PLAYER_IA_DEKU_STICK) || !Player_HoldsTwoHandedWeapon(this)) && !Player_IsChildWithHylianShield(this)) { @@ -737,15 +737,15 @@ void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 action void func_8008EDF0(Player* this) { this->unk_664 = NULL; - this->stateFlags2 &= ~0x2000; + this->stateFlags2 &= ~PLAYER_STATE2_SWITCH_TARGETING; } void func_8008EE08(Player* this) { - if ((this->actor.bgCheckFlags & 1) || (this->stateFlags1 & 0x8A00000) || - (!(this->stateFlags1 & 0xC0000) && ((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) { - this->stateFlags1 &= ~0x400F8000; - } else if (!(this->stateFlags1 & 0x2C0000)) { - this->stateFlags1 |= 0x80000; + if ((this->actor.bgCheckFlags & 1) || (this->stateFlags1 & (PLAYER_STATE1_CLIMBING_LADDER | PLAYER_STATE1_ON_HORSE | PLAYER_STATE1_IN_WATER)) || + (!(this->stateFlags1 & (PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL)) && ((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) { + this->stateFlags1 &= ~(PLAYER_STATE1_TARGETING | PLAYER_STATE1_TARGET_LOCKED | PLAYER_STATE1_TARGET_NOTHING | PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_30); + } else if (!(this->stateFlags1 & (PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_CLIMBING_LADDER))) { + this->stateFlags1 |= PLAYER_STATE1_FREEFALL; } func_8008EDF0(this); @@ -757,7 +757,7 @@ void func_8008EEAC(PlayState* play, Actor* actor) { func_8008EE08(this); this->unk_664 = actor; this->unk_684 = actor; - this->stateFlags1 |= 0x10000; + this->stateFlags1 |= PLAYER_STATE1_TARGET_LOCKED; Camera_SetParam(Play_GetCamera(play, 0), 8, actor); Camera_ChangeMode(Play_GetCamera(play, 0), 2); } @@ -765,7 +765,7 @@ void func_8008EEAC(PlayState* play, Actor* actor) { s32 func_8008EF30(PlayState* play) { Player* this = GET_PLAYER(play); - return (this->stateFlags1 & 0x800000); + return (this->stateFlags1 & PLAYER_STATE1_ON_HORSE); } s32 func_8008EF44(PlayState* play, s32 ammo) { @@ -942,7 +942,7 @@ s32 Player_GetEnvironmentalHazard(PlayState* play) { } else if ((this->underwaterTimer > 80) && ((this->currentBoots == PLAYER_BOOTS_IRON) || (this->underwaterTimer >= 300))) { // Deep underwater var = ((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & 1)) ? 1 : 3; - } else if (this->stateFlags1 & 0x8000000) { // Swimming + } else if (this->stateFlags1 & PLAYER_STATE1_IN_WATER) { // Swimming var = 2; } else { return 0; @@ -1171,7 +1171,7 @@ void func_8008F87C(PlayState* play, Player* this, SkelAnime* skelAnime, Vec3f* p s16 temp2; s32 temp3; - if ((this->actor.scale.y >= 0.0f) && !(this->stateFlags1 & 0x80) && + if ((this->actor.scale.y >= 0.0f) && !(this->stateFlags1 & PLAYER_STATE1_DEAD) && (Player_ActionToMagicSpell(this, this->itemAction) < 0)) { s32 pad; @@ -1367,10 +1367,10 @@ s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** if ((sLeftHandType == PLAYER_MODELTYPE_LH_BGS) && (gSaveContext.swordHealth <= 0.0f)) { dLists += 4; - } else if ((sLeftHandType == PLAYER_MODELTYPE_LH_BOOMERANG) && (this->stateFlags1 & 0x2000000)) { + } else if ((sLeftHandType == PLAYER_MODELTYPE_LH_BOOMERANG) && (this->stateFlags1 & PLAYER_STATE1_THREW_BOOMERANG)) { dLists = &gPlayerLeftHandOpenDLs[gSaveContext.linkAge]; - sLeftHandType = 0; - } else if ((this->leftHandType == PLAYER_MODELTYPE_LH_OPEN) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & 0x8000000)) { + sLeftHandType = PLAYER_MODELTYPE_LH_OPEN; + } else if ((this->leftHandType == PLAYER_MODELTYPE_LH_OPEN) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & PLAYER_STATE1_IN_WATER)) { dLists = &gPlayerLeftHandClosedDLs[gSaveContext.linkAge]; sLeftHandType = PLAYER_MODELTYPE_LH_CLOSED; } @@ -1381,7 +1381,7 @@ s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** if (sRightHandType == PLAYER_MODELTYPE_RH_SHIELD) { dLists += this->currentShield * 4; - } else if ((this->rightHandType == PLAYER_MODELTYPE_RH_OPEN) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & 0x8000000)) { + } else if ((this->rightHandType == PLAYER_MODELTYPE_RH_OPEN) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & PLAYER_STATE1_IN_WATER)) { dLists = &sPlayerRightHandClosedDLs[gSaveContext.linkAge]; sRightHandType = PLAYER_MODELTYPE_RH_CLOSED; } @@ -1510,7 +1510,7 @@ void Player_UpdateShieldCollider(PlayState* play, Player* this, ColliderQuad* co COLTYPE_METAL, }; - if (this->stateFlags1 & 0x400000) { + if (this->stateFlags1 & PLAYER_STATE1_SHIELDING) { Vec3f quadDest[4]; this->shieldQuad.base.colType = shieldColTypes[this->currentShield]; @@ -1544,12 +1544,12 @@ void func_800906D4(PlayState* play, Player* this, Vec3f* newTipPos) { Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]); if (func_80090480(play, NULL, &this->meleeWeaponInfo[0], &newTipPos[0], &newBasePos[0]) && - !(this->stateFlags1 & 0x400000)) { + !(this->stateFlags1 & PLAYER_STATE1_SHIELDING)) { EffectBlure_AddVertex(Effect_GetByIndex(this->meleeWeaponEffectIndex), &this->meleeWeaponInfo[0].tip, &this->meleeWeaponInfo[0].base); } - if ((this->meleeWeaponState > 0) && ((this->meleeWeaponAnimation < 0x18) || (this->stateFlags2 & 0x20000))) { + if ((this->meleeWeaponState > 0) && ((this->meleeWeaponAnimation < 0x18) || (this->stateFlags2 & PLAYER_STATE2_SPIN_ATTACKING))) { func_80090480(play, &this->meleeWeaponQuads[0], &this->meleeWeaponInfo[1], &newTipPos[1], &newBasePos[1]); func_80090480(play, &this->meleeWeaponQuads[1], &this->meleeWeaponInfo[2], &newTipPos[2], &newBasePos[2]); } @@ -1818,13 +1818,13 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve if (this->actor.scale.y >= 0.0f) { if (!Player_HoldsHookshot(this) && ((hookedActor = this->heldActor) != NULL)) { - if (this->stateFlags1 & 0x200) { + if (this->stateFlags1 & PLAYER_STATE1_READY_TO_FIRE) { Matrix_MultVec3f(&sLeftHandArrowVec3, &hookedActor->world.pos); Matrix_RotateZYX(0x69E8, -0x5708, 0x458E, MTXMODE_APPLY); Matrix_Get(&sp14C); Matrix_MtxFToYXZRotS(&sp14C, &hookedActor->world.rot, 0); hookedActor->shape.rot = hookedActor->world.rot; - } else if (this->stateFlags1 & 0x800) { + } else if (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { Vec3s spB8; Matrix_Get(&sp14C); @@ -1858,7 +1858,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve Matrix_Push(); Matrix_Translate(stringData->pos.x, stringData->pos.y, stringData->pos.z, MTXMODE_APPLY); - if ((this->stateFlags1 & 0x200) && (this->unk_860 >= 0) && (this->unk_834 <= 10)) { + if ((this->stateFlags1 & PLAYER_STATE1_READY_TO_FIRE) && (this->unk_860 >= 0) && (this->unk_834 <= 10)) { Vec3f sp90; f32 distXYZ; @@ -1938,7 +1938,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve } if ((this->unk_862 != 0) || ((func_8002DD6C(this) == 0) && (heldActor != NULL))) { - if (!(this->stateFlags1 & 0x400) && (this->unk_862 != 0) && (this->exchangeItemId != EXCH_ITEM_NONE)) { + if (!(this->stateFlags1 & PLAYER_STATE1_GETTING_ITEM) && (this->unk_862 != 0) && (this->exchangeItemId != EXCH_ITEM_NONE)) { Math_Vec3f_Copy(&sGetItemRefPos, &this->leftHandPos); } else { sGetItemRefPos.x = (this->bodyPartsPos[15].x + this->leftHandPos.x) * 0.5f; diff --git a/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 93ff272f4..0c7435da4 100644 --- a/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/soh/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -122,7 +122,7 @@ s32 ArmsHook_CheckForCancel(ArmsHook* this) { if (Player_HoldsHookshot(player)) { if ((player->itemAction != player->heldItemAction) || (player->actor.flags & ACTOR_FLAG_PLAYER_TALKED_TO) || - ((player->stateFlags1 & 0x4000080))) { + ((player->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_DAMAGED)))) { this->timer = 0; ArmsHook_DetachHookFromActor(this); Math_Vec3f_Copy(&this->actor.world.pos, &player->unk_3C8); diff --git a/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c b/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c index e10eb04be..ae8f9cd05 100644 --- a/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c +++ b/soh/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c @@ -237,7 +237,7 @@ void BgGndIceblock_Idle(BgGndIceblock* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; if (this->dyna.unk_150 > 0.0f) { BgGndIceblock_SetNextPosition(this); if (Actor_WorldDistXZToPoint(&this->dyna.actor, &this->targetPos) > 1.0f) { @@ -254,7 +254,7 @@ void BgGndIceblock_Reset(BgGndIceblock* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y, 1.0f)) { diff --git a/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c b/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c index 3745db003..2379b0a58 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c @@ -61,7 +61,7 @@ void func_8087B758(BgHaka* this, Player* player) { func_8002DBD0(&this->dyna.actor, &sp1C, &player->actor.world.pos); if (fabsf(sp1C.x) < 34.6f && sp1C.z > -112.8f && sp1C.z < -36.0f) { - player->stateFlags2 |= 0x200; + player->stateFlags2 |= PLAYER_STATE2_SPAWN_DUST; } } @@ -71,7 +71,7 @@ void func_8087B7E8(BgHaka* this, PlayState* play) { if (this->dyna.unk_150 != 0.0f) { if (play->sceneNum == SCENE_GRAVEYARD && !LINK_IS_ADULT && IS_DAY && !CVarGetInteger("gDayGravePull", 0)) { this->dyna.unk_150 = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; if (!Play_InCsMode(play)) { Message_StartTextbox(play, 0x5073, NULL); this->dyna.actor.params = 100; @@ -80,7 +80,7 @@ void func_8087B7E8(BgHaka* this, PlayState* play) { } else if (0.0f < this->dyna.unk_150 || (play->sceneNum == SCENE_LAKE_HYLIA && !LINK_IS_ADULT && !Flags_GetSwitch(play, 0x23))) { this->dyna.unk_150 = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } else { this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y + 0x8000; this->actionFunc = func_8087B938; @@ -112,7 +112,7 @@ void func_8087B938(BgHaka* this, PlayState* play) { } actor = actor->next; } - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; if (this->dyna.actor.params == 1) { func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -146,7 +146,7 @@ void func_8087BAAC(BgHaka* this, PlayState* play) { if (this->dyna.unk_150 != 0.0f) { this->dyna.unk_150 = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } } @@ -159,7 +159,7 @@ void func_8087BAE4(BgHaka* this, PlayState* play) { } if (this->dyna.unk_150 != 0.0f) { this->dyna.unk_150 = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } if (this->dyna.actor.params == 0) { this->actionFunc = func_8087B7E8; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index de2235b2e..c61c93a46 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -153,7 +153,7 @@ void BgHakaGate_StatueInactive(BgHakaGate* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } } @@ -172,7 +172,7 @@ void BgHakaGate_StatueIdle(BgHakaGate* this, PlayState* play) { this->vTurnDirection = linkDirection * forceDirection; this->actionFunc = BgHakaGate_StatueTurn; } else { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; if (this->vTimer != 0) { this->vTimer--; @@ -197,7 +197,7 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, PlayState* play) { turnFinished = Math_StepToS(&this->vTurnAngleDeg10, 600, this->vTurnRateDeg10); turnAngle = this->vTurnAngleDeg10 * this->vTurnDirection; this->dyna.actor.shape.rot.y = (this->vRotYDeg10 + turnAngle) * 0.1f * (0x10000 / 360.0f); - if ((player->stateFlags2 & 0x10) && (sStatueDistToPlayer > 0.0f)) { + if ((player->stateFlags2 & PLAYER_STATE2_MOVING_DYNAPOLY) && (sStatueDistToPlayer > 0.0f)) { player->actor.world.pos.x = this->dyna.actor.home.pos.x + (Math_SinS(this->dyna.actor.shape.rot.y - this->vInitTurnAngle) * sStatueDistToPlayer); @@ -209,7 +209,7 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, PlayState* play) { } sStatueRotY = this->dyna.actor.shape.rot.y; if (turnFinished) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->vRotYDeg10 = (this->vRotYDeg10 + turnAngle) % 3600; this->vTurnRateDeg10 = CVarGetInteger("gFasterBlockPush", 0) * 2; this->vTurnAngleDeg10 = 0; diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index 846cc1f72..22b8c989a 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -290,7 +290,7 @@ void BgHakaSgami_Update(Actor* thisx, PlayState* play) { BgHakaSgami* this = (BgHakaSgami*)thisx; Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & 0x300000C0) || (this->actionFunc == BgHakaSgami_SetupSpin)) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE)) || (this->actionFunc == BgHakaSgami_SetupSpin)) { this->actionFunc(this, play); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index 8b1d99cb9..36cfb0a27 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -151,7 +151,7 @@ void func_8088B268(BgHidanRock* this, PlayState* play) { this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.unk_158) * D_8088BFC0) + this->dyna.actor.home.pos.z; if (temp_v1) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; this->dyna.actor.home.pos.x = this->dyna.actor.world.pos.x; this->dyna.actor.home.pos.z = this->dyna.actor.world.pos.z; @@ -162,7 +162,7 @@ void func_8088B268(BgHidanRock* this, PlayState* play) { func_8002F974(&this->dyna.actor, NA_SE_EV_ROCK_SLIDE - SFX_FLAG); } else { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; if (this->timer != 0) { this->timer--; @@ -180,7 +180,7 @@ void func_8088B268(BgHidanRock* this, PlayState* play) { this->dyna.actor.world.pos.z = D_8088BF60.z; this->dyna.actor.speedXZ = 0.0f; D_8088BFC0 = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->actionFunc = func_8088B79C; } @@ -300,7 +300,7 @@ void func_8088B990(BgHidanRock* this, PlayState* play) { this->timer++; if (this->dyna.unk_150 != 0.0f) { this->dyna.actor.speedXZ = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } if ((this->type == 0 && (Math_SmoothStepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 1820.0f, diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index ce1732e07..03615e480 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -118,7 +118,7 @@ void func_8088E518(BgHidanSima* this, PlayState* play) { Player* player = GET_PLAYER(play); Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 3.4f); - if (func_8004356C(&this->dyna) && !(player->stateFlags1 & 0x6000)) { + if (func_8004356C(&this->dyna) && !(player->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE))) { this->timer = 20; this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(play)) + 0x4000; if (this->dyna.actor.home.pos.y <= this->dyna.actor.world.pos.y) { diff --git a/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c b/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c index 039b77807..1cd91d468 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c +++ b/soh/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c @@ -138,7 +138,7 @@ void BgIceObjects_Idle(BgIceObjects* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; if ((this->dyna.unk_150 > 0.0f) && !Player_InCsMode(play)) { BgIceObjects_SetNextTarget(this, play); if (Actor_WorldDistXZToPoint(thisx, &this->targetPos) > 1.0f) { @@ -203,7 +203,7 @@ void BgIceObjects_Reset(BgIceObjects* this, PlayState* play) { Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } if (Math_StepToF(&thisx->world.pos.y, thisx->home.pos.y, 1.0f)) { @@ -218,7 +218,7 @@ void BgIceObjects_Stuck(BgIceObjects* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c b/soh/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c index ff695140d..848931456 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c @@ -59,7 +59,7 @@ void BgJyaBlock_Update(Actor* thisx, PlayState* play) { BgJyaBlock* this = (BgJyaBlock*)thisx; Player* player = GET_PLAYER(play); - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c b/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c index 000895dc5..30164bf2e 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c @@ -201,7 +201,7 @@ void BgJyaGoroiwa_Update(Actor* thisx, PlayState* play) { s32 bgId; Vec3f pos; - if (!(player->stateFlags1 & 0x300000C0)) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE))) { this->actionFunc(this, play); BgJyaGoroiwa_UpdateRotation(this); pos.x = this->actor.world.pos.x; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c b/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c index b8ee9c331..1b0f52ae8 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c @@ -78,7 +78,7 @@ void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, PlayState* play, Collis void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((player->stateFlags1 == 0x200000) && (player->actor.wallPoly != NULL)) { + if ((player->stateFlags1 == PLAYER_STATE1_CLIMBING_LADDER) && (player->actor.wallPoly != NULL)) { s32 i; for (i = 0; i < ARRAY_COUNT(D_8089BA18); i++) { 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 645d5cc56..8392e7224 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 @@ -112,7 +112,7 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, PlayState* play) { } if (fabsf(this->dyna.unk_150) > 0.001f) { this->dyna.unk_150 = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } } @@ -145,7 +145,7 @@ void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, PlayState* play) { } if (fabsf(this->dyna.unk_150) > 0.001f) { this->dyna.unk_150 = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } Math_Vec3f_Copy(&player->actor.world.pos, &this->lockedPlayerPos); } diff --git a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index ae699abb6..a2fca0db7 100644 --- a/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/soh/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -348,7 +348,7 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) { } } else { if ((gSaveContext.timer1Value == 0) && (sBgPoEventBlocksAtRest == 5)) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; sBgPoEventPuzzleState = 0x10; sBgPoEventBlocksAtRest = 0; } @@ -367,11 +367,11 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, PlayState* play) { this->direction = (this->dyna.unk_150 >= 0.0f) ? 1.0f : -1.0f; this->actionFunc = BgPoEvent_BlockPush; } else { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } } else { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; DECR(this->direction); } @@ -394,7 +394,7 @@ void BgPoEvent_BlockPush(BgPoEvent* this, PlayState* play) { this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.unk_158) * displacement) + this->dyna.actor.home.pos.z; if (blockStop) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; if ((this->dyna.unk_150 > 0.0f) && (func_800435D8(play, &this->dyna, 0x1E, 0x32, -0x14) == 0)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); } @@ -419,7 +419,7 @@ void BgPoEvent_BlockReset(BgPoEvent* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } if (Math_StepToF(&this->dyna.actor.world.pos.y, 493.0f, 1.0f) && @@ -439,7 +439,7 @@ void BgPoEvent_BlockSolved(BgPoEvent* this, PlayState* play) { Player* player = GET_PLAYER(play); if (this->dyna.unk_150 != 0.0f) { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } if (Math_StepToF(&this->dyna.actor.world.pos.y, 369.0f, 2.0f)) { sBgPoEventPuzzleState = 0x20; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index 019c71cd0..4385c4341 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -239,11 +239,11 @@ void func_808B40AC(BgSpot15Rrbox* this, PlayState* play) { this->unk_17C = this->dyna.unk_150; func_808B4178(this, play); } else { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } } else { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } } @@ -275,7 +275,7 @@ void func_808B4194(BgSpot15Rrbox* this, PlayState* play) { if (!func_808B3F58(this, play)) { actor->home.pos.x = actor->world.pos.x; actor->home.pos.z = actor->world.pos.z; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; this->unk_178 = 0.0f; this->unk_174 = 0.0f; @@ -290,7 +290,7 @@ void func_808B4194(BgSpot15Rrbox* this, PlayState* play) { } actor->home.pos.x = actor->world.pos.x; actor->home.pos.z = actor->world.pos.z; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; this->unk_178 = 0.0f; this->unk_174 = 0.0f; @@ -316,7 +316,7 @@ void func_808B43D0(BgSpot15Rrbox* this, PlayState* play) { if (fabsf(this->dyna.unk_150) > 0.001f) { this->dyna.unk_150 = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } Actor_MoveForward(actor); @@ -347,7 +347,7 @@ void func_808B44B8(BgSpot15Rrbox* this, PlayState* play) { void func_808B44CC(BgSpot15Rrbox* this, PlayState* play) { Player* player = GET_PLAYER(play); - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } diff --git a/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 5509765c3..4bc551eae 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -413,7 +413,7 @@ void func_808B57E0(BgSpot16Bombstone* this, PlayState* play) { OnePointCutscene_Init(play, 4180, sTimer, NULL, MAIN_CAM); } } - } else if (player->stateFlags1 & 0x800) { + } else if (player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { playerHeldActor = player->heldActor; if (playerHeldActor != NULL && playerHeldActor->category == ACTORCAT_EXPLOSIVE && playerHeldActor->id == ACTOR_EN_BOMBF) { diff --git a/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c b/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c index e24e39902..bcff47d6b 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c @@ -213,7 +213,7 @@ void func_808B8E20(BgSpot18Obj* this, PlayState* play) { if (fabsf(this->dyna.unk_150) > 0.001f) { this->dyna.unk_150 = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } } @@ -256,7 +256,7 @@ void func_808B8F08(BgSpot18Obj* this, PlayState* play) { this->dyna.actor.world.pos.x = (Math_SinS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.x; this->dyna.actor.world.pos.z = (Math_CosS(this->dyna.actor.world.rot.y) * 80.0f) + this->dyna.actor.home.pos.z; this->dyna.unk_150 = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); func_80078884(NA_SE_SY_CORRECT_CHIME); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BLOCK_BOUND); diff --git a/soh/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c b/soh/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c index 444de05e3..f62f09128 100644 --- a/soh/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c +++ b/soh/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c @@ -81,7 +81,7 @@ void BgSstFloor_Update(BgSstFloor* thisx, PlayState* play) { this->dyna.actor.params = BONGOFLOOR_REST; this->drumPhase = 28; - if (func_8004356C(&this->dyna) && !(player->stateFlags1 & 0x6000)) { + if (func_8004356C(&this->dyna) && !(player->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE))) { distFromRim = 600.0f - this->dyna.actor.xzDistToPlayer; if (distFromRim > 0.0f) { if (distFromRim > 350.0f) { diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index ebc244d74..97551ca46 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -2276,10 +2276,10 @@ void BossGanon_Wait(BossGanon* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->unk_1C2 == 0) && !(player->actor.world.pos.y < 0.0f)) { - if (!(player->stateFlags1 & 0x2000) && (fabsf(player->actor.world.pos.x) < 110.0f) && + if (!(player->stateFlags1 & PLAYER_STATE1_HANGING_OFF_LEDGE) && (fabsf(player->actor.world.pos.x) < 110.0f) && (fabsf(player->actor.world.pos.z) < 110.0f)) { BossGanon_SetupPoundFloor(this, play); - } else if ((this->timers[0] == 0) && !(player->stateFlags1 & 0x2000)) { + } else if ((this->timers[0] == 0) && !(player->stateFlags1 & PLAYER_STATE1_HANGING_OFF_LEDGE)) { this->timers[0] = (s16)Rand_ZeroFloat(30.0f) + 30; if ((s8)this->actor.colChkInfo.health >= 20) { diff --git a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index f7a48f873..e811c0a35 100644 --- a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -387,7 +387,7 @@ void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) { player->targetYaw = -0x8000; player->currentYaw = -0x8000; player->fallStartHeight = 0; - player->stateFlags1 |= 0x20; + player->stateFlags1 |= PLAYER_STATE1_INPUT_DISABLED; func_80064520(play, &play->csCtx); func_8002DF54(play, &this->actor, 8); @@ -421,7 +421,7 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) { if (this->timer == 0) { sHands[RIGHT]->actor.flags |= ACTOR_FLAG_TARGETABLE; sHands[LEFT]->actor.flags |= ACTOR_FLAG_TARGETABLE; - player->stateFlags1 &= ~0x20; + player->stateFlags1 &= ~PLAYER_STATE1_INPUT_DISABLED; func_80064534(play, &play->csCtx); func_8002DF54(play, &this->actor, 7); sCameraAt.y += 30.0f; @@ -667,7 +667,7 @@ void BossSst_HeadNeutral(BossSst* this, PlayState* play) { } if (this->timer == 0) { - if ((GET_PLAYER(play)->actor.world.pos.y > -50.0f) && !(GET_PLAYER(play)->stateFlags1 & 0x6080)) { + if ((GET_PLAYER(play)->actor.world.pos.y > -50.0f) && !(GET_PLAYER(play)->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE))) { sHands[Rand_ZeroOne() <= 0.5f]->ready = true; BossSst_HeadSetupWait(this); } else { @@ -1252,7 +1252,7 @@ void BossSst_HandWait(BossSst* this, PlayState* play) { this->timer--; } - if ((this->timer == 0) && (player->actor.world.pos.y > -50.0f) && !(player->stateFlags1 & 0x6080)) { + if ((this->timer == 0) && (player->actor.world.pos.y > -50.0f) && !(player->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE))) { BossSst_HandSelectAttack(this); } } else if (sHead->actionFunc == BossSst_HeadNeutral) { @@ -1735,7 +1735,7 @@ void BossSst_HandClap(BossSst* this, PlayState* play) { if (this->ready) { this->timer = 30; this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - if (!(player->stateFlags2 & 0x80)) { + if (!(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { dropFlag = true; } } else { @@ -1824,7 +1824,7 @@ void BossSst_HandGrab(BossSst* this, PlayState* play) { if (SkelAnime_Update(&this->skelAnime)) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); this->actor.speedXZ = 0.0f; - if (player->stateFlags2 & 0x80) { + if (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) { if (Rand_ZeroOne() < 0.5f) { BossSst_HandSetupCrush(this); } else { @@ -1851,7 +1851,7 @@ void BossSst_HandGrab(BossSst* this, PlayState* play) { this->actor.world.pos.x += this->actor.speedXZ * Math_SinS(this->actor.world.rot.y); this->actor.world.pos.z += this->actor.speedXZ * Math_CosS(this->actor.world.rot.y); - if (player->stateFlags2 & 0x80) { + if (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) { player->unk_850 = 0; player->actor.world.pos = this->actor.world.pos; player->actor.shape.rot.y = this->actor.shape.rot.y; @@ -1872,7 +1872,7 @@ void BossSst_HandCrush(BossSst* this, PlayState* play) { this->timer--; } - if (!(player->stateFlags2 & 0x80)) { + if (!(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { BossSst_HandReleasePlayer(this, play, true); BossSst_HandSetupEndCrush(this); } else { @@ -1945,7 +1945,7 @@ void BossSst_HandSwing(BossSst* this, PlayState* play) { Math_ScaledStepToS(&this->actor.shape.rot.z, 0, 0x800); } - if (player->stateFlags2 & 0x80) { + if (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) { player->unk_850 = 0; Math_Vec3f_Copy(&player->actor.world.pos, &this->actor.world.pos); player->actor.shape.rot.x = this->actor.shape.rot.x; @@ -1958,7 +1958,7 @@ void BossSst_HandSwing(BossSst* this, PlayState* play) { } if ((this->timer == 4) && (this->amplitude == 0) && SkelAnime_Update(&this->skelAnime) && - (player->stateFlags2 & 0x80)) { + (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { BossSst_HandReleasePlayer(this, play, false); player->actor.world.pos.x += 70.0f * Math_SinS(this->actor.shape.rot.y); player->actor.world.pos.z += 70.0f * Math_CosS(this->actor.shape.rot.y); diff --git a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 5360eef02..4f0eadd4b 100644 --- a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -803,7 +803,7 @@ s32 BossTw_CheckBeamReflection(BossTw* this, PlayState* play) { Vec3f vec; Player* player = GET_PLAYER(play); - if (player->stateFlags1 & 0x400000 && + if (player->stateFlags1 & PLAYER_STATE1_SHIELDING && (s16)(player->actor.shape.rot.y - this->actor.shape.rot.y + 0x8000) < 0x2000 && (s16)(player->actor.shape.rot.y - this->actor.shape.rot.y + 0x8000) > -0x2000) { // player is shielding and facing angles are less than 45 degrees in either direction @@ -945,7 +945,7 @@ void BossTw_ShootBeam(BossTw* this, PlayState* play) { if (this->timers[1] != 0) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->rotateSpeed); - if ((player->stateFlags1 & 0x400000) && + if ((player->stateFlags1 & PLAYER_STATE1_SHIELDING) && ((s16)((player->actor.shape.rot.y - this->actor.shape.rot.y) + 0x8000) < 0x2000) && ((s16)((player->actor.shape.rot.y - this->actor.shape.rot.y) + 0x8000) > -0x2000)) { Math_ApproachF(&this->targetPos.x, player->bodyPartsPos[15].x, 1.0f, 400.0f); @@ -4799,7 +4799,7 @@ void BossTw_UpdateEffects(PlayState* play) { if (eff->workf[EFF_SCALE] == 0.0f) { eff->type = TWEFF_NONE; if (eff->target == NULL) { - player->stateFlags2 &= ~0x8000; + player->stateFlags2 &= ~PLAYER_STATE2_PAUSE_MOST_UPDATING; sFreezeState = 0; } } @@ -4815,9 +4815,9 @@ void BossTw_UpdateEffects(PlayState* play) { if (eff->workf[EFF_ROLL] >= 0.8f) { eff->workf[EFF_ROLL] -= 0.8f; - player->stateFlags2 |= 0x8000; + player->stateFlags2 |= PLAYER_STATE2_PAUSE_MOST_UPDATING; } else { - player->stateFlags2 &= ~0x8000; + player->stateFlags2 &= ~PLAYER_STATE2_PAUSE_MOST_UPDATING; } if ((sKotakePtr->workf[UNK_F11] > 10.0f) && (sKotakePtr->workf[UNK_F11] < 200.0f)) { diff --git a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index ee62b141e..4891b0330 100644 --- a/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/soh/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -1441,14 +1441,14 @@ void BossVa_BodyPhase4(BossVa* this, PlayState* play) { } else { Math_SmoothStepToS(&this->vaBodySpinRate, 0, 1, 0x96, 0); if (this->timer > 0) { - if ((player->stateFlags1 & 0x4000000) && (this->timer > 35)) { + if ((player->stateFlags1 & PLAYER_STATE1_DAMAGED) && (this->timer > 35)) { this->timer = 35; } Math_SmoothStepToF(&this->actor.shape.yOffset, -480.0f, 1.0f, 30.0f, 0.0f); this->colliderBody.info.bumper.dmgFlags = 0xFC00712; this->timer--; } else { - if ((player->stateFlags1 & 0x4000000) && (this->timer < -60)) { + if ((player->stateFlags1 & PLAYER_STATE1_DAMAGED) && (this->timer < -60)) { this->timer = -59; } if ((play->gameplayFrames % 4) == 0) { @@ -2024,7 +2024,7 @@ void BossVa_ZapperAttack(BossVa* this, PlayState* play) { sp98 = Math_Vec3f_Yaw(&sp7C, &this->armTip); tmp17 = sp98 - this->actor.shape.rot.y; - if ((sp8E >= ABS(tmp17) || this->burst) && !(sBodyState & 0x80) && !(player->stateFlags1 & 0x04000000)) { + if ((sp8E >= ABS(tmp17) || this->burst) && !(sBodyState & 0x80) && !(player->stateFlags1 & PLAYER_STATE1_DAMAGED)) { if (!this->burst) { sp94 = sp98 - this->actor.shape.rot.y; @@ -2086,7 +2086,7 @@ void BossVa_ZapperAttack(BossVa* this, PlayState* play) { this->timer2 = 0; } - if ((this->timer2 < 0) && (player->stateFlags1 & 0x4000000)) { + if ((this->timer2 < 0) && (player->stateFlags1 & PLAYER_STATE1_DAMAGED)) { BossVa_Spark(play, this, 1, 30, 0.0f, 0.0f, SPARK_LINK, 0.0f, true); } } @@ -2287,7 +2287,7 @@ void BossVa_ZapperEnraged(BossVa* this, PlayState* play) { sp6C = Math_Vec3f_Yaw(&sp54, &this->armTip); tmp16 = sp6C - this->actor.shape.rot.y; - if ((ABS(tmp16) <= 0x4650 || this->burst) && !(sBodyState & 0x80) && !(player->stateFlags1 & 0x04000000)) { + if ((ABS(tmp16) <= 0x4650 || this->burst) && !(sBodyState & 0x80) && !(player->stateFlags1 & PLAYER_STATE1_DAMAGED)) { if (!this->burst) { sp68 = sp6C - this->actor.shape.rot.y; @@ -2344,7 +2344,7 @@ void BossVa_ZapperEnraged(BossVa* this, PlayState* play) { this->timer2 = 0; } - if ((this->timer2 < 0) && (player->stateFlags1 & 0x4000000)) { + if ((this->timer2 < 0) && (player->stateFlags1 & PLAYER_STATE1_DAMAGED)) { BossVa_Spark(play, this, 1, 30, 0.0f, 0, SPARK_LINK, 0.0f, true); } } diff --git a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index f3c601fa1..bbd9b2826 100644 --- a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -134,7 +134,7 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { player = GET_PLAYER(play); if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) { - if ((this->actor.targetMode != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (player->stateFlags1 & 0x80000000) && + if ((this->actor.targetMode != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (player->stateFlags1 & PLAYER_STATE1_FLOOR_DISABLED) && (player->unk_84F == 0)) { destinationIdx = ((this->actor.params >> 0xC) & 7) - 1; Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, 0x4FF); @@ -153,10 +153,10 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { DoorAna_SetupAction(this, DoorAna_GrabPlayer); } else { - if (!Player_InCsMode(play) && !(player->stateFlags1 & 0x8800000) && + if (!Player_InCsMode(play) && !(player->stateFlags1 & (PLAYER_STATE1_ON_HORSE | PLAYER_STATE1_IN_WATER)) && this->actor.xzDistToPlayer <= 15.0f && -50.0f <= this->actor.yDistToPlayer && this->actor.yDistToPlayer <= 15.0f) { - player->stateFlags1 |= 0x80000000; + player->stateFlags1 |= PLAYER_STATE1_FLOOR_DISABLED; this->actor.targetMode = 1; } else { this->actor.targetMode = 0; diff --git a/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 290e809f6..c61822f67 100644 --- a/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -553,7 +553,7 @@ void func_80997220(DoorShutter* this, PlayState* play) { } this->unk_164 = 0; this->dyna.actor.velocity.y = 0.0f; - if (DoorShutter_SetupDoor(this, play) && !(player->stateFlags1 & 0x800)) { + if (DoorShutter_SetupDoor(this, play) && !(player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { DoorShutter_SetupAction(this, func_80997568); func_8002DF54(play, NULL, 2); } @@ -637,7 +637,7 @@ void DoorShutter_Update(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & 0x100004C0) || (this->actionFunc == DoorShutter_SetupType)) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_IN_ITEM_CS)) || (this->actionFunc == DoorShutter_SetupType)) { this->actionFunc(this, play); } } diff --git a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index 56a761c84..a81ed473a 100644 --- a/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/soh/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -180,7 +180,7 @@ void EffDust_UpdateFunc_8099DFC0(EffDust* this, PlayState* play) { s32 i; s32 j; - if (parent == NULL || parent->update == NULL || !(player->stateFlags1 & 0x1000)) { + if (parent == NULL || parent->update == NULL || !(player->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK)) { if (this->life != 0) { this->life -= 1; } else { diff --git a/soh/src/overlays/actors/ovl_En_Am/z_en_am.c b/soh/src/overlays/actors/ovl_En_Am/z_en_am.c index c5ca6686a..8347c631a 100644 --- a/soh/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/soh/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -694,7 +694,7 @@ void EnAm_Statue(EnAm* this, PlayState* play) { ((this->hurtCollider.base.ocFlags1 & OC1_HIT) && (ABS(moveDir) <= 0x2000))) { this->unk_258 = 0; - player->stateFlags2 &= ~0x151; + player->stateFlags2 &= ~(PLAYER_STATE2_DO_ACTION_GRAB | PLAYER_STATE2_MOVING_DYNAPOLY | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS | PLAYER_STATE2_GRABBING_DYNAPOLY); player->actor.speedXZ = 0.0f; this->dyna.unk_150 = this->dyna.unk_154 = 0.0f; } diff --git a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c index 9686965d5..04b09aca8 100644 --- a/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/soh/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -188,7 +188,7 @@ void EnBa_Idle(EnBa* this, PlayState* play) { } this->unk_2A8[13].x = this->unk_2A8[12].x; this->unk_2A8[13].y = this->unk_2A8[12].y; - if (!(player->stateFlags1 & 0x4000000) && (this->actor.xzDistToPlayer <= 175.0f) && + if (!(player->stateFlags1 & PLAYER_STATE1_DAMAGED) && (this->actor.xzDistToPlayer <= 175.0f) && (this->actor.world.pos.y == this->actor.home.pos.y + 100.0f)) { EnBa_SetupSwingAtPlayer(this); } @@ -294,7 +294,7 @@ void EnBa_SwingAtPlayer(EnBa* this, PlayState* play) { Matrix_MultVec3f(&D_809B8080, &this->unk_158[i + 1]); } this->unk_31A--; - } else if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & 0x4000000)) { + } else if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & PLAYER_STATE1_DAMAGED)) { EnBa_SetupIdle(this); } else { EnBa_SetupSwingAtPlayer(this); @@ -313,7 +313,7 @@ void EnBa_SwingAtPlayer(EnBa* this, PlayState* play) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); return; } - if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & 0x4000000)) { + if ((this->actor.xzDistToPlayer > 175.0f) || (player->stateFlags1 & PLAYER_STATE1_DAMAGED)) { EnBa_SetupIdle(this); } else { EnBa_SetupSwingAtPlayer(this); diff --git a/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c b/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c index fafb55ca5..816dcf091 100644 --- a/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c +++ b/soh/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c @@ -84,7 +84,7 @@ void EnBlkobj_Wait(EnBlkobj* this, PlayState* play) { if (this->dyna.actor.xzDistToPlayer < 120.0f) { EnBlkobj_SetupAction(this, EnBlkobj_SpawnDarkLink); } - player->stateFlags2 |= 0x04000000; + player->stateFlags2 |= PLAYER_STATE2_REFLECTION; } void EnBlkobj_SpawnDarkLink(EnBlkobj* this, PlayState* play) { diff --git a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 40adc1a6f..7fee4b178 100644 --- a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -238,11 +238,11 @@ void EnBom_Explode(EnBom* this, PlayState* play) { if (this->timer == 0) { player = GET_PLAYER(play); - if ((player->stateFlags1 & 0x800) && (player->heldActor == &this->actor)) { + if ((player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (player->heldActor == &this->actor)) { player->actor.child = NULL; player->heldActor = NULL; player->interactRangeActor = NULL; - player->stateFlags1 &= ~0x800; + player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; } Actor_Kill(&this->actor); diff --git a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c index a6d3afda5..5c18c52fa 100644 --- a/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c +++ b/soh/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c @@ -200,14 +200,14 @@ void EnBomBowlPit_GivePrize(EnBomBowlPit* this, PlayState* play) { } } - player->stateFlags1 &= ~0x20000000; + player->stateFlags1 &= ~PLAYER_STATE1_IN_CUTSCENE; this->actor.parent = NULL; if (!IS_RANDO || this->getItemEntry.getItemId == GI_NONE) { func_8002F434(&this->actor, play, this->getItemId, 2000.0f, 1000.0f); } else { GiveItemEntryFromActor(&this->actor, play, this->getItemEntry, 2000.0f, 1000.0f); } - player->stateFlags1 |= 0x20000000; + player->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; this->actionFunc = EnBomBowlPit_WaitTillPrizeGiven; } diff --git a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 13b02c79c..2eecc1fb3 100644 --- a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -164,7 +164,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) { player->heldActor = NULL; player->interactRangeActor = NULL; this->actor.parent = NULL; - player->stateFlags1 &= ~0x800; + player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; } } else if (this->bombCollider.base.acFlags & AC_HIT) { this->bombCollider.base.acFlags &= ~AC_HIT; @@ -200,7 +200,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) { player->heldActor = NULL; player->interactRangeActor = NULL; this->actor.parent = NULL; - player->stateFlags1 &= ~0x800; + player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; this->actor.world.pos = this->actor.home.pos; } } @@ -218,7 +218,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) { player->heldActor = NULL; player->interactRangeActor = NULL; this->actor.parent = NULL; - player->stateFlags1 &= ~0x800; + player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; this->actor.world.pos = this->actor.home.pos; } } @@ -302,11 +302,11 @@ void EnBombf_Explode(EnBombf* this, PlayState* play) { if (this->timer == 0) { player = GET_PLAYER(play); - if ((player->stateFlags1 & 0x800) && (player->heldActor == &this->actor)) { + if ((player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (player->heldActor == &this->actor)) { player->actor.child = NULL; player->heldActor = NULL; player->interactRangeActor = NULL; - player->stateFlags1 &= ~0x800; + player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; } Actor_Kill(&this->actor); diff --git a/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c index dedb53d5b..d5e082933 100644 --- a/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -243,7 +243,7 @@ void EnBoom_Update(Actor* thisx, PlayState* play) { EnBoom* this = (EnBoom*)thisx; Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & 0x20000000)) { + if (!(player->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE)) { this->actionFunc(this, play); Actor_SetFocus(&this->actor, 0.0f); this->activeTimer = this->activeTimer + 1; diff --git a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c index a4d86ff61..6bbb48488 100644 --- a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -320,8 +320,8 @@ void func_809C9700(EnBox* this, PlayState* play) { this->unk_1FB = ENBOX_STATE_0; } else { if (this->unk_1FB == ENBOX_STATE_0) { - if (!(player->stateFlags2 & 0x1000000)) { - player->stateFlags2 |= 0x800000; + if (!(player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR)) { + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; return; } this->unk_1FB = ENBOX_STATE_1; diff --git a/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c index a57594a0f..2a6fdb4fd 100644 --- a/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/soh/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -359,7 +359,7 @@ void func_809CEA24(EnBw* this, PlayState* play) { Math_SmoothStepToS(&this->actor.world.rot.y, this->unk_236 + this->unk_238, 1, this->actor.speedXZ * 1000.0f, 0); } - if ((this->unk_224 == 0) || (ABS(this->actor.yDistToPlayer) > 60.0f) || (player2->stateFlags1 & 0x6000)) { + if ((this->unk_224 == 0) || (ABS(this->actor.yDistToPlayer) > 60.0f) || (player2->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE))) { this->unk_221 = 3; this->unk_224 = 150; this->unk_250 = 0.0f; diff --git a/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c index 24650142d..cbbba524d 100644 --- a/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -281,7 +281,7 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { if (this->timer != 0) { this->timer--; } - if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & 0x00800000) && + if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & PLAYER_STATE1_ON_HORSE) && (this->actor.yDistToWater < -40.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL)) { EnCrow_SetupDiveAttack(this); } @@ -319,7 +319,7 @@ void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL) || (this->collider.base.atFlags & AT_HIT) || (this->actor.bgCheckFlags & 9) || - (player->stateFlags1 & 0x00800000) || (this->actor.yDistToWater > -40.0f)) { + (player->stateFlags1 & PLAYER_STATE1_ON_HORSE) || (this->actor.yDistToWater > -40.0f)) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_ATTACK); diff --git a/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c index 4f58b1937..893f326d8 100644 --- a/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -230,7 +230,7 @@ void EnDha_Wait(EnDha* this, PlayState* play) { this->timer += 0x1194; this->limbAngleY = Math_SinS(this->timer) * 1820.0f; - if (!(player->stateFlags2 & 0x80)) { + if (!(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { this->unk_1CC = 0; EnDha_SetupTakeDamage(this); return; @@ -245,8 +245,8 @@ void EnDha_Wait(EnDha* this, PlayState* play) { this->handAngle.y -= this->actor.shape.rot.y + this->limbAngleY; this->handAngle.x -= this->actor.shape.rot.x + this->limbAngleX[0] + this->limbAngleX[1]; } else { - if ((player->stateFlags2 & 0x80) && (&this->actor == player->actor.parent)) { - player->stateFlags2 &= ~0x80; + if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && (&this->actor == player->actor.parent)) { + player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; player->unk_850 = 200; } @@ -285,8 +285,8 @@ void EnDha_Wait(EnDha* this, PlayState* play) { this->limbAngleX[1] *= -2; } } else { - if ((player->stateFlags2 & 0x80) && (&this->actor == player->actor.parent)) { - player->stateFlags2 &= ~0x80; + if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && (&this->actor == player->actor.parent)) { + player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; player->unk_850 = 200; } @@ -306,8 +306,8 @@ void EnDha_SetupTakeDamage(EnDha* this) { void EnDha_TakeDamage(EnDha* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((player->stateFlags2 & 0x80) && (&this->actor == player->actor.parent)) { - player->stateFlags2 &= ~0x80; + if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && (&this->actor == player->actor.parent)) { + player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; player->unk_850 = 200; } @@ -344,8 +344,8 @@ void EnDha_Die(EnDha* this, PlayState* play) { Vec3f vec; Player* player = GET_PLAYER(play); - if ((player->stateFlags2 & 0x80) && (&this->actor == player->actor.parent)) { - player->stateFlags2 &= ~0x80; + if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && (&this->actor == player->actor.parent)) { + player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; player->unk_850 = 200; } diff --git a/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 0dd33a8ac..cf73c6a94 100644 --- a/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/soh/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -460,7 +460,7 @@ void func_809EFF50(EnDns* this, PlayState* play) { void func_809EFF98(EnDns* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (player->stateFlags1 & 0x400) { + if (player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_DONE) && Message_ShouldAdvance(play)) { this->dnsItemEntry->setRupeesAndFlags(this); this->dropCollectible = 1; diff --git a/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index 9ce27f4c1..2864544c5 100644 --- a/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -123,7 +123,7 @@ void EnDntJiji_Wait(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->timer == 1) && (this->actor.xzDistToPlayer < 150.0f) && !Play_InCsMode(play) && - !(player->stateFlags1 & 0x800)) { + !(player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { OnePointCutscene_Init(play, 2230, -99, &this->actor, MAIN_CAM); this->timer = 0; func_8002DF54(play, NULL, 8); diff --git a/soh/src/overlays/actors/ovl_En_Door/z_en_door.c b/soh/src/overlays/actors/ovl_En_Door/z_en_door.c index 329462c06..2a571e34e 100644 --- a/soh/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/soh/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -198,7 +198,7 @@ void EnDoor_Idle(EnDoor* this, PlayState* play) { if (this->playerIsOpening != 0) { this->actionFunc = EnDoor_Open; Animation_PlayOnceSetSpeed(&this->skelAnime, D_809FCECC[this->animStyle], - (player->stateFlags1 & 0x8000000) ? 0.75f : 1.5f); + (player->stateFlags1 & PLAYER_STATE1_IN_WATER) ? 0.75f : 1.5f); if (this->lockTimer != 0) { gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex]--; Flags_SetSwitch(play, this->actor.params & 0x3F); diff --git a/soh/src/overlays/actors/ovl_En_Du/z_en_du.c b/soh/src/overlays/actors/ovl_En_Du/z_en_du.c index db13ecc54..19af8a4c5 100644 --- a/soh/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/soh/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -353,9 +353,9 @@ void func_809FE3B4(EnDu* this, PlayState* play) { void func_809FE3C0(EnDu* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (player->stateFlags2 & 0x1000000) { + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { func_8010BD88(play, OCARINA_ACTION_CHECK_SARIA); - player->stateFlags2 |= 0x2000000; + player->stateFlags2 |= PLAYER_STATE2_PLAY_FOR_ACTOR; player->unk_6A8 = &this->actor; EnDu_SetupAction(this, func_809FE4A4); return; @@ -365,7 +365,7 @@ void func_809FE3C0(EnDu* this, PlayState* play) { this->interactInfo.talkState = NPC_TALK_STATE_IDLE; } if (this->actor.xzDistToPlayer < 116.0f + this->collider.dim.radius) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } @@ -393,14 +393,14 @@ void func_809FE4A4(EnDu* this, PlayState* play) { EnDu_SetupAction(this, func_809FE890); play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } void func_809FE638(EnDu* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & 0x20000000)) { + if (!(player->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE)) { OnePointCutscene_Init(play, 3330, -99, &this->actor, MAIN_CAM); player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.world.rot.y + 0x7FFF; Audio_PlayFanfare(NA_BGM_APPEAR); diff --git a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 2191daeab..f996fe6c1 100644 --- a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1097,13 +1097,13 @@ void func_80A0461C(EnElf* this, PlayState* play) { } else { arrowPointedActor = play->actorCtx.targetCtx.arrowPointedActor; - if ((player->stateFlags1 & 0x400) || ((YREG(15) & 0x10) && func_800BC56C(play, 2))) { + if ((player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM) || ((YREG(15) & 0x10) && func_800BC56C(play, 2))) { temp = 12; this->unk_2C0 = 100; } else if (arrowPointedActor == NULL || arrowPointedActor->category == ACTORCAT_NPC) { if (arrowPointedActor != NULL) { this->unk_2C0 = 100; - player->stateFlags2 |= 0x100000; + player->stateFlags2 |= PLAYER_STATE2_NAVI_OUT; temp = 0; } else { switch (this->unk_2A8) { @@ -1124,7 +1124,7 @@ void func_80A0461C(EnElf* this, PlayState* play) { this->unk_2AE--; temp = 7; } else { - player->stateFlags2 |= 0x100000; + player->stateFlags2 |= PLAYER_STATE2_NAVI_OUT; temp = 0; } } else { @@ -1154,7 +1154,7 @@ void func_80A0461C(EnElf* this, PlayState* play) { switch (temp) { case 0: - if (!(player->stateFlags2 & 0x100000)) { + if (!(player->stateFlags2 & PLAYER_STATE2_NAVI_OUT)) { temp = 7; if (this->unk_2C7 == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_NAVY_VANISH); @@ -1162,7 +1162,7 @@ void func_80A0461C(EnElf* this, PlayState* play) { } break; case 8: - if (player->stateFlags2 & 0x100000) { + if (player->stateFlags2 & PLAYER_STATE2_NAVI_OUT) { func_80A0299C(this, 0x32); this->unk_2C0 = 42; temp = 11; @@ -1172,10 +1172,10 @@ void func_80A0461C(EnElf* this, PlayState* play) { } break; case 7: - player->stateFlags2 &= ~0x100000; + player->stateFlags2 &= ~PLAYER_STATE2_NAVI_OUT; break; default: - player->stateFlags2 |= 0x100000; + player->stateFlags2 |= PLAYER_STATE2_NAVI_OUT; break; } } @@ -1514,7 +1514,7 @@ void EnElf_Draw(Actor* thisx, PlayState* play) { Player* player = GET_PLAYER(play); if ((this->unk_2A8 != 8) && !(this->fairyFlags & 8)) { - if (!(player->stateFlags1 & 0x100000) || (kREG(90) < this->actor.projectedPos.z)) { + if (!(player->stateFlags1 & PLAYER_STATE1_FIRST_PERSON) || (kREG(90) < this->actor.projectedPos.z)) { dListHead = Graph_Alloc(play->state.gfxCtx, sizeof(Gfx) * 4); OPEN_DISPS(play->state.gfxCtx); diff --git a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index 48877526a..a43dd8679 100644 --- a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -249,7 +249,7 @@ void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, PlayState* play) { (CVarGetInteger("gRandomizedEnemies", 0) && enemyCount < 15)) { if (play->sceneNum == SCENE_HYRULE_FIELD) { if ((player->floorSfxOffset == 0) || (player->actor.floorBgId != BGCHECK_SCENE) || - !(player->actor.bgCheckFlags & 1) || (player->stateFlags1 & 0x08000000)) { + !(player->actor.bgCheckFlags & 1) || (player->stateFlags1 & PLAYER_STATE1_IN_WATER)) { this->fieldSpawnTimer = 60; break; diff --git a/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index fbdfbc7f7..aa52d53ae 100644 --- a/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/soh/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -362,7 +362,7 @@ void EnFireRock_Update(Actor* thisx, PlayState* play) { if (this->collider.base.atFlags & 2) { this->collider.base.atFlags &= ~2; if (this->collider.base.at == playerActor) { - if (!(player->stateFlags1 & 0x04000000)) { + if (!(player->stateFlags1 & PLAYER_STATE1_DAMAGED)) { func_8002F758(play, thisx, 2.0f, -player->actor.world.rot.y, 3.0f, 4); } return; diff --git a/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 59136cee2..1a906e5b7 100644 --- a/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/soh/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -797,7 +797,7 @@ void EnFloormas_GrabLink(EnFloormas* this, PlayState* play) { this->actor.world.pos.z = Math_CosS(this->actor.shape.rot.y) * (xzDelta * 0.1f) + player->actor.world.pos.z; // let go - if (!(player->stateFlags2 & 0x80) || (player->invincibilityTimer < 0)) { + if (!(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) || (player->invincibilityTimer < 0)) { parent = (EnFloormas*)this->actor.parent; child = (EnFloormas*)this->actor.child; diff --git a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 11a7eb026..3cb02e441 100644 --- a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -606,7 +606,7 @@ s32 EnFr_SetupJumpingUp(EnFr* this, s32 frogIndex) { void EnFr_Idle(EnFr* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (player->stateFlags2 & 0x2000000) { + if (player->stateFlags2 & PLAYER_STATE2_PLAY_FOR_ACTOR) { if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { play->msgCtx.ocarinaMode = OCARINA_MODE_00; } diff --git a/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 278fb18e2..67ad97c96 100644 --- a/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/soh/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -208,17 +208,17 @@ void func_80A1DBD4(EnFu* this, PlayState* play) { play->msgCtx.ocarinaMode = OCARINA_MODE_00; Flags_SetEventChkInf(EVENTCHKINF_PLAYED_SONG_OF_STORMS_IN_WINDMILL); } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_02) { - player->stateFlags2 &= ~0x1000000; + player->stateFlags2 &= ~PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR; this->actionFunc = EnFu_WaitAdult; } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } void EnFu_WaitForPlayback(EnFu* this, PlayState* play) { Player* player = GET_PLAYER(play); - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; // if dialog state is 7, player has played back the song if (Message_GetState(&play->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) { func_8010BD58(play, OCARINA_ACTION_PLAYBACK_STORMS); @@ -229,7 +229,7 @@ void EnFu_WaitForPlayback(EnFu* this, PlayState* play) { void EnFu_TeachSong(EnFu* this, PlayState* play) { Player* player = GET_PLAYER(play); - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; // if dialog state is 2, start song demonstration if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->behaviorFlags &= ~FU_WAIT; @@ -246,7 +246,7 @@ void EnFu_WaitAdult(EnFu* this, PlayState* play) { yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((Flags_GetEventChkInf(EVENTCHKINF_LEARNED_SONG_OF_STORMS))) { func_80A1D94C(this, play, 0x508E, func_80A1DBA0); - } else if (player->stateFlags2 & 0x1000000) { + } else if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { this->actor.textId = 0x5035; Message_StartTextbox(play, this->actor.textId, NULL); this->actionFunc = IS_RANDO ? func_80A1DBD4 : EnFu_TeachSong; @@ -257,7 +257,7 @@ void EnFu_WaitAdult(EnFu* this, PlayState* play) { if (this->actor.xzDistToPlayer < 100.0f) { this->actor.textId = 0x5034; func_8002F2CC(&this->actor, play, 100.0f); - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } } diff --git a/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 1ad8f4867..92a768205 100644 --- a/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/soh/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -661,7 +661,7 @@ void EnGe1_BeginGame_Archery(EnGe1* this, PlayState* play) { gSaveContext.eventInf[0] |= 0x100; Flags_SetEventChkInf(EVENTCHKINF_PLAYED_HORSEBACK_ARCHERY); - if (!(player->stateFlags1 & 0x800000)) { + if (!(player->stateFlags1 & PLAYER_STATE1_ON_HORSE)) { func_8002DF54(play, &this->actor, 1); } else { horse = Actor_FindNearby(play, &player->actor, ACTOR_EN_HORSE, ACTORCAT_BG, 1200.0f); @@ -741,7 +741,7 @@ void EnGe1_Wait_Archery(EnGe1* this, PlayState* play) { Player* player = GET_PLAYER(play); u16 textId; - if (!(player->stateFlags1 & 0x800000)) { + if (!(player->stateFlags1 & PLAYER_STATE1_ON_HORSE)) { EnGe1_SetTalkAction(this, play, 0x603F, 100.0f, EnGe1_TalkNoHorse_Archery); } else { if (Flags_GetEventChkInf(EVENTCHKINF_PLAYED_HORSEBACK_ARCHERY)) { diff --git a/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index c61ac7de1..432116b2d 100644 --- a/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -725,7 +725,7 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) { s32 pad; s32 sp30; - if (!(player->stateFlags1 & 0x300000C0)) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE))) { if (this->collisionDisabledTimer > 0) { this->collisionDisabledTimer--; } diff --git a/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c index e2a4cdaa0..159774406 100644 --- a/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/soh/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -144,8 +144,8 @@ void func_80A4E470(EnGs* this, PlayState* play) { if (this->actor.xzDistToPlayer <= 100.0f) { bREG(15) = 1; if (this->unk_19D == 0) { - player->stateFlags2 |= 0x800000; - if (player->stateFlags2 & 0x1000000) { + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->unk_19D |= 1; } @@ -168,7 +168,7 @@ void func_80A4E470(EnGs* this, PlayState* play) { this->unk_19D = 0; Flags_SetSwitch(play, (this->actor.params >> 8) & 0x3F); } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } } diff --git a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c index d8192be6c..f653b6ff9 100644 --- a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -724,7 +724,7 @@ void EnHorse_ResetRace(EnHorse* this, PlayState* play) { s32 EnHorse_PlayerCanMove(EnHorse* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & 1) || func_8002DD78(GET_PLAYER(play)) == 1 || (player->stateFlags1 & 0x100000) || + if ((player->stateFlags1 & PLAYER_STATE1_LOADING) || func_8002DD78(GET_PLAYER(play)) == 1 || (player->stateFlags1 & PLAYER_STATE1_FIRST_PERSON) || ((this->stateFlags & ENHORSE_FLAG_19) && !this->inRace) || this->action == ENHORSE_ACT_HBA || player->actor.flags & ACTOR_FLAG_PLAYER_TALKED_TO || play->csCtx.state != 0) { return false; @@ -3533,7 +3533,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) { CollisionCheck_SetAT(play, &play->colChkCtx, &this->cyl1.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->cyl1.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->cyl2.base); - if ((player->stateFlags1 & 1) && player->rideActor != NULL) { + if ((player->stateFlags1 & PLAYER_STATE1_LOADING) && player->rideActor != NULL) { if (play->sceneNum != SCENE_LON_LON_RANCH || (play->sceneNum == SCENE_LON_LON_RANCH && (thisx->world.pos.z < -2400.0f))) { EnHorse_UpdateConveyors(this, play); 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 dd8b52fcc..1d0866e6d 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 @@ -145,7 +145,7 @@ u16 func_80A79010(PlayState* play) { } switch (gSaveContext.eventInf[0] & 0xF) { case 1: - if (!(player->stateFlags1 & 0x800000)) { + if (!(player->stateFlags1 & PLAYER_STATE1_ON_HORSE)) { return 0x2036; } else if (Flags_GetEventChkInf(EVENTCHKINF_RENTED_HORSE_FROM_INGO)) { if (Flags_GetInfTable(INFTABLE_A2)) { @@ -657,7 +657,7 @@ void func_80A7A568(EnIn* this, PlayState* play) { s32 phi_a2; s32 transitionType; - if (!Flags_GetEventChkInf(EVENTCHKINF_RENTED_HORSE_FROM_INGO) && (player->stateFlags1 & 0x800000)) { + if (!Flags_GetEventChkInf(EVENTCHKINF_RENTED_HORSE_FROM_INGO) && (player->stateFlags1 & PLAYER_STATE1_ON_HORSE)) { Flags_SetInfTable(INFTABLE_AB); } if (gSaveContext.timer1State == 10) { diff --git a/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 8c3104e9b..cf2f4499b 100644 --- a/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/soh/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -213,18 +213,18 @@ void func_80A8F75C(EnKakasi* this, PlayState* play) { if (absyawTowardsPlayer < 0x4300) { if (!this->unk_194) { - if (player->stateFlags2 & 0x1000000) { + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { this->camId = OnePointCutscene_Init(play, 2260, -99, &this->actor, MAIN_CAM); func_8010BD58(play, OCARINA_ACTION_SCARECROW_LONG_RECORDING); this->unk_19A = 0; this->unk_1B8 = 0.0; - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; this->actionFunc = func_80A8F8D0; return; } if (this->actor.xzDistToPlayer < 80.0f) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } func_8002F2CC(&this->actor, play, 100.0f); @@ -253,7 +253,7 @@ void func_80A8F8D0(EnKakasi* this, PlayState* play) { } } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { func_80A8F320(this, play, 0); - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } diff --git a/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index bc2fb7632..37b6236a5 100644 --- a/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/soh/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -232,33 +232,33 @@ void func_80A91348(EnKakasi3* this, PlayState* play) { if (absAngleTowardsLink < 0x4300) { if (!this->unk_194) { - if (player->stateFlags2 & 0x1000000) { + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { this->camId = OnePointCutscene_Init(play, 2260, -99, &this->actor, MAIN_CAM); play->msgCtx.msgMode = MSGMODE_PAUSED; this->dialogState = TEXT_STATE_EVENT; this->unk_1B8 = 0.0f; Message_StartTextbox(play, 0x40A4, NULL); - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; this->actionFunc = func_80A915B8; return; } if (this->actor.xzDistToPlayer < 80.0f) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } else if (gSaveContext.scarecrowSpawnSongSet && !this->unk_195) { - if (player->stateFlags2 & 0x1000000) { + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { this->camId = OnePointCutscene_Init(play, 2260, -99, &this->actor, MAIN_CAM); play->msgCtx.msgMode = MSGMODE_PAUSED; this->dialogState = TEXT_STATE_EVENT; this->unk_1B8 = 0.0f; Message_StartTextbox(play, 0x40A8, NULL); - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; this->actionFunc = func_80A9187C; return; } if (this->actor.xzDistToPlayer < 80.0f) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } func_8002F2CC(&this->actor, play, 100.0f); @@ -303,7 +303,7 @@ void func_80A91620(EnKakasi3* this, PlayState* play) { if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { func_80A90EBC(this, play, 0); - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } @@ -377,7 +377,7 @@ void func_80A918E4(EnKakasi3* this, PlayState* play) { if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { func_80A90EBC(this, play, 0); - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } diff --git a/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index 6f8624518..00cfb3555 100644 --- a/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/soh/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -84,7 +84,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play2) { Actor_SetScale(&this->actor, 0.1f); this->unk_1CA = 0; - if (player->stateFlags2 & 0x20000) { + if (player->stateFlags2 & PLAYER_STATE2_SPIN_ATTACKING) { if (!gSaveContext.isMagicAcquired || (gSaveContext.magicState != MAGIC_STATE_IDLE) || (((this->actor.params & 0xFF00) >> 8) && !(Magic_RequestChange(play, (this->actor.params & 0xFF00) >> 8, MAGIC_CONSUME_NOW)))) { @@ -96,7 +96,7 @@ void EnMThunder_Init(Actor* thisx, PlayState* play2) { return; } - player->stateFlags2 &= ~0x20000; + player->stateFlags2 &= ~PLAYER_STATE2_SPIN_ATTACKING; this->unk_1CA = 1; this->collider.info.toucher.dmgFlags = D_80AA044C[this->unk_1C7]; this->unk_1C6 = 1; @@ -131,7 +131,7 @@ void func_80A9F314(PlayState* play, f32 arg1) { void func_80A9F350(EnMThunder* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (player->stateFlags2 & 0x20000) { + if (player->stateFlags2 & PLAYER_STATE2_SPIN_ATTACKING) { if (player->meleeWeaponAnimation >= 0x18) { Audio_PlaySoundGeneral(NA_SE_IT_ROLLING_CUT, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -143,7 +143,7 @@ void func_80A9F350(EnMThunder* this, PlayState* play) { return; } - if (!(player->stateFlags1 & 0x1000)) { + if (!(player->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK)) { Actor_Kill(&this->actor); } } @@ -176,7 +176,7 @@ void func_80A9F408(EnMThunder* this, PlayState* play) { func_800AA000(0.0f, (s32)(player->unk_858 * 150.0f) & 0xFF, 2, (s32)(player->unk_858 * 150.0f) & 0xFF); } - if (player->stateFlags2 & 0x20000) { + if (player->stateFlags2 & PLAYER_STATE2_SPIN_ATTACKING) { if ((child != NULL) && (child->update != NULL)) { child->parent = NULL; } @@ -191,7 +191,7 @@ void func_80A9F408(EnMThunder* this, PlayState* play) { Actor_Kill(&this->actor); return; } else { - player->stateFlags2 &= ~0x20000; + player->stateFlags2 &= ~PLAYER_STATE2_SPIN_ATTACKING; if ((this->actor.params & 0xFF00) >> 8) { gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP; } @@ -214,7 +214,7 @@ void func_80A9F408(EnMThunder* this, PlayState* play) { } } - if (!(player->stateFlags1 & 0x1000)) { + if (!(player->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK)) { if (this->actor.child != NULL) { this->actor.child->parent = NULL; } diff --git a/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index 8a11eb668..606bca3b8 100644 --- a/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/soh/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -420,8 +420,8 @@ void func_80AA0F44(EnMa1* this, PlayState* play) { if (Flags_GetEventChkInf(EVENTCHKINF_INVITED_TO_SING_WITH_CHILD_MALON)) { // When the player pulls out the Ocarina while close to Malon - if (player->stateFlags2 & 0x1000000) { - player->stateFlags2 |= 0x2000000; + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { + player->stateFlags2 |= PLAYER_STATE2_PLAY_FOR_ACTOR; player->unk_6A8 = &this->actor; this->actor.textId = 0x2061; Message_StartTextbox(play, this->actor.textId, NULL); @@ -432,7 +432,7 @@ void func_80AA0F44(EnMa1* this, PlayState* play) { } else if (this->actor.xzDistToPlayer < 30.0f + (f32)this->collider.dim.radius) { // somehow flags that the player is close to malon so that pulling out the Ocarina // triggers the code above this. - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } // If rando'ed, a textbox is closing, it's malon's 'my mom wrote this song' text, AND we do have an ocarina // in our inventory. This allows us to grant the check when talking to malon with the ocarina in our inventory. @@ -444,7 +444,7 @@ void func_80AA0F44(EnMa1* this, PlayState* play) { } void func_80AA106C(EnMa1* this, PlayState* play) { - GET_PLAYER(play)->stateFlags2 |= 0x800000; + GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; if (this->interactInfo.talkState == NPC_TALK_STATE_ACTION) { Audio_OcaSetInstrument(2); func_8010BD58(play, OCARINA_ACTION_TEACH_EPONA); @@ -454,7 +454,7 @@ void func_80AA106C(EnMa1* this, PlayState* play) { } void func_80AA10EC(EnMa1* this, PlayState* play) { - GET_PLAYER(play)->stateFlags2 |= 0x800000; + GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; if (Message_GetState(&play->msgCtx) == TEXT_STATE_SONG_DEMO_DONE) { func_8010BD58(play, OCARINA_ACTION_PLAYBACK_EPONA); this->actionFunc = func_80AA1150; @@ -481,7 +481,7 @@ void EnMa1_EndTeachSong(EnMa1* this, PlayState* play) { } void func_80AA1150(EnMa1* this, PlayState* play) { - GET_PLAYER(play)->stateFlags2 |= 0x800000; + GET_PLAYER(play)->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; // When rando'ed, trigger the "song learned" Ocarina mode. if (IS_RANDO && (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING)) { diff --git a/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index dc50b0e0e..1519e57c7 100644 --- a/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/soh/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -265,13 +265,13 @@ void func_80AA2018(EnMa2* this, PlayState* play) { void func_80AA204C(EnMa2* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (player->stateFlags2 & 0x1000000) { + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { player->unk_6A8 = &this->actor; - player->stateFlags2 |= 0x2000000; + player->stateFlags2 |= PLAYER_STATE2_PLAY_FOR_ACTOR; func_8010BD58(play, OCARINA_ACTION_CHECK_EPONA); this->actionFunc = func_80AA20E4; } else if (this->actor.xzDistToPlayer < 30.0f + (f32)this->collider.dim.radius) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } @@ -288,7 +288,7 @@ void func_80AA20E4(EnMa2* this, PlayState* play) { this->actionFunc = func_80AA21C8; play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } @@ -296,7 +296,7 @@ void func_80AA21C8(EnMa2* this, PlayState* play) { Player* player = GET_PLAYER(play); if (DECR(this->unk_208)) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } else { if (this->interactInfo.talkState == NPC_TALK_STATE_IDLE) { this->actor.flags |= ACTOR_FLAG_WILL_TALK; diff --git a/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index 5280f583e..63c4f4da6 100644 --- a/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/soh/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -98,7 +98,7 @@ u16 func_80AA2AA0(PlayState* play, Actor* thisx) { return 0x2004; } } - if ((!(player->stateFlags1 & 0x800000)) && + if ((!(player->stateFlags1 & PLAYER_STATE1_ON_HORSE)) && (Actor_FindNearby(play, thisx, ACTOR_EN_HORSE, 1, 1200.0f) == NULL)) { return 0x2001; } diff --git a/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 59bee3ee5..6190e2db9 100644 --- a/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -612,8 +612,8 @@ void EnMb_SetupStunned(EnMb* this) { void EnMb_Stunned(EnMb* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((player->stateFlags2 & 0x80) && player->actor.parent == &this->actor) { - player->stateFlags2 &= ~0x80; + if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && player->actor.parent == &this->actor) { + player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; player->unk_850 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); @@ -737,8 +737,8 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, PlayState* play) { s16 relYawFromPlayer; s16 yawPlayerToWaypoint; - if ((player->stateFlags2 & 0x80) && player->actor.parent == &this->actor) { - player->stateFlags2 &= ~0x80; + if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && player->actor.parent == &this->actor) { + player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; player->unk_850 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); @@ -939,7 +939,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) { if (this->attackCollider.base.atFlags & AT_HIT) { if (this->attackCollider.base.at == &player->actor) { - if (!endCharge && !(player->stateFlags2 & 0x80)) { + if (!endCharge && !(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { if (player->invincibilityTimer < 0) { if (player->invincibilityTimer < -39) { player->invincibilityTimer = 0; @@ -961,7 +961,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) { } } - if ((player->stateFlags2 & 0x80) && player->actor.parent == &this->actor) { + if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && player->actor.parent == &this->actor) { player->actor.world.pos.x = this->actor.world.pos.x + Math_CosS(this->actor.shape.rot.y) * 10.0f + Math_SinS(this->actor.shape.rot.y) * 89.0f; hasHitPlayer = true; @@ -973,10 +973,10 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) { } if (endCharge) { - if (hasHitPlayer || (player->stateFlags2 & 0x80)) { + if (hasHitPlayer || (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { this->attackCollider.base.atFlags &= ~AT_HIT; - if (player->stateFlags2 & 0x80) { - player->stateFlags2 &= ~0x80; + if (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) { + player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; player->unk_850 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); @@ -1008,7 +1008,7 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) { if (this->attackCollider.base.atFlags & AT_HIT) { if (this->attackCollider.base.at == &player->actor) { - if (!endCharge && !(player->stateFlags2 & 0x80)) { + if (!endCharge && !(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { if (player->invincibilityTimer < 0) { if (player->invincibilityTimer <= -40) { player->invincibilityTimer = 0; @@ -1030,7 +1030,7 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) { } } - if ((player->stateFlags2 & 0x80) && player->actor.parent == &this->actor) { + if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && player->actor.parent == &this->actor) { player->actor.world.pos.x = this->actor.world.pos.x + Math_CosS(this->actor.shape.rot.y) * 10.0f + Math_SinS(this->actor.shape.rot.y) * 89.0f; hasHitPlayer = true; @@ -1042,10 +1042,10 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) { } if (endCharge) { - if (hasHitPlayer || (player->stateFlags2 & 0x80)) { + if (hasHitPlayer || (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { this->attackCollider.base.atFlags &= ~AT_HIT; - if (player->stateFlags2 & 0x80) { - player->stateFlags2 &= ~0x80; + if (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) { + player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; player->unk_850 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); @@ -1274,7 +1274,7 @@ void EnMb_ClubWaitPlayerNear(EnMb* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < this->playerDetectionRange && - !(player->stateFlags1 & 0x4000000) && ABS(relYawFromPlayer) < 0x3E80) { + !(player->stateFlags1 & PLAYER_STATE1_DAMAGED) && ABS(relYawFromPlayer) < 0x3E80) { // Add a height check to the Moblin's Club attack when Enemy Randomizer is on. // Without the height check, the Moblin will attack (and play the sound effect) a lot even though // the Moblin is very far away from the player in vertical rooms (like the first room in Deku Tree). @@ -1339,8 +1339,8 @@ void EnMb_SpearDead(EnMb* this, PlayState* play) { Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); - if ((player->stateFlags2 & 0x80) && player->actor.parent == &this->actor) { - player->stateFlags2 &= ~0x80; + if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && player->actor.parent == &this->actor) { + player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; player->unk_850 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); @@ -1422,8 +1422,8 @@ void EnMb_CheckColliding(EnMb* this, PlayState* play) { this->hitbox.base.acFlags &= ~AC_HIT; if (this->actor.colChkInfo.damageEffect != ENMB_DMGEFF_IGNORE && this->actor.colChkInfo.damageEffect != ENMB_DMGEFF_FREEZE) { - if ((player->stateFlags2 & 0x80) && player->actor.parent == &this->actor) { - player->stateFlags2 &= ~0x80; + if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && player->actor.parent == &this->actor) { + player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; player->unk_850 = 200; func_8002F71C(play, &this->actor, 6.0f, this->actor.world.rot.y, 6.0f); diff --git a/soh/src/overlays/actors/ovl_En_Md/z_en_md.c b/soh/src/overlays/actors/ovl_En_Md/z_en_md.c index 14d9cbb7b..9181b452b 100644 --- a/soh/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/soh/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -774,8 +774,8 @@ void func_80AAB948(EnMd* this, PlayState* play) { } if ((this->interactInfo.talkState == NPC_TALK_STATE_IDLE) && (play->sceneNum == SCENE_LOST_WOODS)) { - if (player->stateFlags2 & 0x1000000) { - player->stateFlags2 |= 0x2000000; + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { + player->stateFlags2 |= PLAYER_STATE2_PLAY_FOR_ACTOR; player->unk_6A8 = &this->actor; func_8010BD58(play, OCARINA_ACTION_CHECK_SARIA); this->actionFunc = func_80AABC10; @@ -783,7 +783,7 @@ void func_80AAB948(EnMd* this, PlayState* play) { } if (this->actor.xzDistToPlayer < (30.0f + this->collider.dim.radius)) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } } @@ -802,7 +802,7 @@ void func_80AABC10(EnMd* this, PlayState* play) { this->actionFunc = func_80AAB948; play->msgCtx.ocarinaMode = OCARINA_MODE_04; } else { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } diff --git a/soh/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/soh/src/overlays/actors/ovl_En_Mk/z_en_mk.c index e5501858c..989b90c96 100644 --- a/soh/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/soh/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -342,13 +342,13 @@ void EnMk_Update(Actor* thisx, PlayState* play) { player = GET_PLAYER(play); if (this->flags & 8) { - if (!(player->stateFlags2 & 0x400)) { + if (!(player->stateFlags2 & PLAYER_STATE2_UNDERWATER)) { this->flags &= ~8; } } else { if (player->currentBoots == PLAYER_BOOTS_IRON) { this->flags |= 8; - } else if (player->stateFlags2 & 0x400) { + } else if (player->stateFlags2 & PLAYER_STATE2_UNDERWATER) { swimFlag = player->actor.yDistToWater; if (swimFlag > 0) { diff --git a/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index d2500afaf..2add8c4a9 100644 --- a/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -156,7 +156,7 @@ void EnNutsball_Update(Actor* thisx, PlayState* play) { Player* player = GET_PLAYER(play); s32 pad; - if (!(player->stateFlags1 & 0x300000C0) || (this->actionFunc == func_80ABBB34)) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE)) || (this->actionFunc == func_80ABBB34)) { this->actionFunc(this, play); Actor_MoveForward(&this->actor); diff --git a/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index 74afaacff..8cb491da4 100644 --- a/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/soh/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -115,18 +115,18 @@ void func_80ABEF2C(EnOkarinaTag* this, PlayState* play) { this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; } else { if ((this->ocarinaSong != 6) || (gSaveContext.scarecrowSpawnSongSet)) { - if (player->stateFlags2 & 0x1000000) { + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { // "North! ! ! ! !" osSyncPrintf(VT_FGCOL(RED) "☆☆☆☆☆ 北!!!!! ☆☆☆☆☆ %f\n" VT_RST, this->actor.xzDistToPlayer); } if ((this->actor.xzDistToPlayer < (90.0f + this->interactRange)) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 80.0f)) { - if (player->stateFlags2 & 0x2000000) { + if (player->stateFlags2 & PLAYER_STATE2_PLAY_FOR_ACTOR) { ocarinaSong = this->ocarinaSong; if (ocarinaSong == 6) { ocarinaSong = 0xA; } - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; func_8010BD58(play, ocarinaSong + OCARINA_ACTION_CHECK_SARIA); this->actionFunc = func_80ABF0CC; } else if ((this->actor.xzDistToPlayer < (50.0f + this->interactRange) && @@ -180,7 +180,7 @@ void func_80ABF0CC(EnOkarinaTag* this, PlayState* play) { play->msgCtx.ocarinaMode = OCARINA_MODE_04; this->actionFunc = func_80ABEF2C; } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } } @@ -196,7 +196,7 @@ void func_80ABF28C(EnOkarinaTag* this, PlayState* play) { ((this->type != 6) || !Flags_GetEventChkInf(EVENTCHKINF_DESTROYED_ROYAL_FAMILY_TOMB)) && (this->actor.xzDistToPlayer < (90.0f + this->interactRange)) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 80.0f)) { - if (player->stateFlags2 & 0x1000000) { + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { switch (this->type) { case 1: func_8010BD58(play, OCARINA_ACTION_CHECK_LULLABY); @@ -217,12 +217,12 @@ void func_80ABF28C(EnOkarinaTag* this, PlayState* play) { Actor_Kill(&this->actor); break; } - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; this->actionFunc = func_80ABF4C8; } else if ((this->actor.xzDistToPlayer < (50.0f + this->interactRange)) && (fabsf(player->actor.world.pos.y - this->actor.world.pos.y) < 40.0f)) { this->unk_15A = 0; - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } } @@ -296,7 +296,7 @@ void func_80ABF4C8(EnOkarinaTag* this, PlayState* play) { } } if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } } diff --git a/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 017d1e9ae..9533e8309 100644 --- a/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -629,7 +629,7 @@ void EnOkuta_Update(Actor* thisx, PlayState* play2) { Vec3f sp38; s32 sp34; - if (!(player->stateFlags1 & 0x300000C0)) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE))) { if (this->actor.params == 0) { EnOkuta_ColliderCheck(this, play); if (!WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, diff --git a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index b0d03430a..34ef24e40 100644 --- a/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/soh/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -678,7 +678,7 @@ void EnOssan_EndInteraction(PlayState* play, EnOssan* this) { Actor_ProcessTalkRequest(&this->actor, play); play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; - player->stateFlags2 &= ~0x20000000; + player->stateFlags2 &= ~PLAYER_STATE2_DISABLE_DRAW; func_800BC490(play, 1); Interface_ChangeAlpha(50); this->drawCursor = 0; @@ -762,7 +762,7 @@ void EnOssan_State_Idle(EnOssan* this, PlayState* play, Player* player) { if (Actor_ProcessTalkRequest(&this->actor, play)) { // "Start conversation!!" osSyncPrintf(VT_FGCOL(YELLOW) "★★★ 会話開始!! ★★★" VT_RST "\n"); - player->stateFlags2 |= 0x20000000; + player->stateFlags2 |= PLAYER_STATE2_DISABLE_DRAW; func_800BC590(play); EnOssan_SetStateStartShopping(play, this, false); } else if (this->actor.xzDistToPlayer < 100.0f) { @@ -1403,7 +1403,7 @@ void EnOssan_GiveItemWithFanfare(PlayState* play, EnOssan* this) { } play->msgCtx.msgMode = MSGMODE_TEXT_CLOSING; play->msgCtx.stateTimer = 4; - player->stateFlags2 &= ~0x20000000; + player->stateFlags2 &= ~PLAYER_STATE2_DISABLE_DRAW; func_800BC490(play, 1); Interface_ChangeAlpha(50); this->drawCursor = 0; @@ -1811,7 +1811,7 @@ void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, PlayState* play, Player case 0: osSyncPrintf(VT_FGCOL(YELLOW) "★★★ 続けるよ!! ★★★" VT_RST "\n"); player->actor.shape.rot.y += 0x8000; - player->stateFlags2 |= 0x20000000; + player->stateFlags2 |= PLAYER_STATE2_DISABLE_DRAW; func_800BC490(play, 2); Message_StartTextbox(play, this->actor.textId, &this->actor); EnOssan_SetStateStartShopping(play, this, true); @@ -1830,7 +1830,7 @@ void EnOssan_State_ContinueShoppingPrompt(EnOssan* this, PlayState* play, Player selectedItem = this->shelfSlots[this->cursorIndex]; selectedItem->updateStockedItemFunc(play, selectedItem); player->actor.shape.rot.y += 0x8000; - player->stateFlags2 |= 0x20000000; + player->stateFlags2 |= PLAYER_STATE2_DISABLE_DRAW; func_800BC490(play, 2); Message_StartTextbox(play, this->actor.textId, &this->actor); EnOssan_SetStateStartShopping(play, this, true); 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 c11feb327..3f109863c 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 @@ -386,7 +386,7 @@ void EnPoField_CorrectYPos(EnPoField* this, PlayState* play) { f32 EnPoField_SetFleeSpeed(EnPoField* this, PlayState* play) { Player* player = GET_PLAYER(play); - f32 speed = ((player->stateFlags1 & 0x800000) && player->rideActor != NULL) ? player->rideActor->speedXZ : 12.0f; + f32 speed = ((player->stateFlags1 & PLAYER_STATE1_ON_HORSE) && player->rideActor != NULL) ? player->rideActor->speedXZ : 12.0f; if (this->actor.xzDistToPlayer < 300.0f) { this->actor.speedXZ = speed * 1.5f + 2.0f; @@ -414,13 +414,13 @@ void EnPoField_WaitForSpawn(EnPoField* this, PlayState* play) { if (fabsf(sEnPoFieldSpawnPositions[i].x - player->actor.world.pos.x) < 150.0f && fabsf(sEnPoFieldSpawnPositions[i].z - player->actor.world.pos.z) < 150.0f) { if (Flags_GetSwitch(play, sEnPoFieldSpawnSwitchFlags[i])) { - if (player->stateFlags1 & 0x800000) { // Player riding Epona + if (player->stateFlags1 & PLAYER_STATE1_ON_HORSE) { // Player riding Epona return; } else { this->actor.params = EN_PO_FIELD_SMALL; spawnDist = 300.0f; } - } else if (player->stateFlags1 & 0x800000 || Rand_ZeroOne() < 0.4f) { + } else if (player->stateFlags1 & PLAYER_STATE1_ON_HORSE || Rand_ZeroOne() < 0.4f) { this->actor.params = EN_PO_FIELD_BIG; this->spawnFlagIndex = i; spawnDist = 480.0f; diff --git a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 6f36bea36..4514439c1 100644 --- a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -333,9 +333,12 @@ void func_80AE2C1C(EnRd* this, PlayState* play) { } if ((ABS(sp32) < 0x1554) && (Actor_WorldDistXYZToActor(&this->actor, &player->actor) <= 150.0f)) { - if (!(player->stateFlags1 & 0x2C6080) && !(player->stateFlags2 & 0x80)) { + if (!(player->stateFlags1 & + (PLAYER_STATE1_DEAD | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | + PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_CLIMBING_LADDER)) && + !(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { if (this->unk_306 == 0) { - if (!(this->unk_312 & 0x80) && !CVarGetInteger("gNoRedeadFreeze", 0)) { + if (!(this->unk_312 & PLAYER_STATE2_GRABBED_BY_ENEMY) && !CVarGetInteger("gNoRedeadFreeze", 0)) { player->actor.freezeTimer = 40; func_8008EEAC(play, &this->actor); GET_PLAYER(play)->unk_684 = &this->actor; @@ -405,7 +408,10 @@ void func_80AE2FD0(EnRd* this, PlayState* play) { this->actor.world.rot.y = this->actor.shape.rot.y; SkelAnime_Update(&this->skelAnime); - if (!(player->stateFlags1 & 0x2C6080) && !(player->stateFlags2 & 0x80) && + if (!(player->stateFlags1 & + (PLAYER_STATE1_DEAD | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | + PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_CLIMBING_LADDER)) && + !(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && (Actor_WorldDistXYZToPoint(&player->actor, &this->actor.home.pos) < 150.0f)) { this->actor.targetMode = 0; func_80AE2B90(this, play); diff --git a/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c index a3265d724..f999f3486 100644 --- a/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/soh/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -499,7 +499,7 @@ void EnRr_CollisionCheck(EnRr* this, PlayState* play) { } } if ((this->ocTimer == 0) && (this->actor.colorFilterTimer == 0) && (player->invincibilityTimer == 0) && - !(player->stateFlags2 & 0x80) && + !(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && ((this->collider1.base.ocFlags1 & OC1_HIT) || (this->collider2.base.ocFlags1 & OC1_HIT))) { this->collider1.base.ocFlags1 &= ~OC1_HIT; this->collider2.base.ocFlags1 &= ~OC1_HIT; @@ -627,7 +627,7 @@ void EnRr_GrabPlayer(EnRr* this, PlayState* play) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_LIKE_EAT); } this->ocTimer = 8; - if ((this->grabTimer == 0) || !(player->stateFlags2 & 0x80)) { + if ((this->grabTimer == 0) || !(player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY)) { EnRr_SetupReleasePlayer(this, play); } else { Math_ApproachF(&player->actor.world.pos.x, this->mouthPos.x, 1.0f, 30.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 97a3c0091..1ca46ddae 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 @@ -866,7 +866,8 @@ void func_80AEC780(EnRu1* this, PlayState* play) { s32 pad; Player* player = GET_PLAYER(play); - if ((func_80AEC5FC(this, play)) && (!Play_InCsMode(play)) && (!(player->stateFlags1 & 0x206000)) && + if ((func_80AEC5FC(this, play)) && (!Play_InCsMode(play)) && + (!(player->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_CLIMBING_LADDER))) && (player->actor.bgCheckFlags & 1)) { play->csCtx.segment = &D_80AF0880; @@ -1652,7 +1653,7 @@ void func_80AEE7C4(EnRu1* this, PlayState* play) { } player = GET_PLAYER(play); - if (player->stateFlags2 & 0x10000000) { + if (player->stateFlags2 & PLAYER_STATE2_IDLING) { this->unk_370 += 1.0f; if (this->action != 32) { if (*unk_370 > 30.0f) { diff --git a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 207d9612b..f2ff5f684 100644 --- a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -722,7 +722,7 @@ void EnSkj_SariasSongKidIdle(EnSkj* this, PlayState* play) { Player* player = GET_PLAYER(play); if (EnSkj_RangeCheck(player, sSmallStumpSkullKid.skullkid)) { EnSkj_SetupWaitInRange(this); - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; player->unk_6A8 = &sSmallStumpSkullKid.skullkid->actor; } } @@ -906,8 +906,8 @@ void EnSkj_WaitInRange(EnSkj* this, PlayState* play) { // When link pulls out the Ocarina center him on the stump // Link was probably supposed to be pointed towards skull kid as well - if (player->stateFlags2 & 0x1000000) { - player->stateFlags2 |= 0x2000000; + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { + player->stateFlags2 |= PLAYER_STATE2_PLAY_FOR_ACTOR; player->unk_6A8 = &sSmallStumpSkullKid.skullkid->actor; player->actor.world.pos.x = sSmallStumpSkullKid.skullkid->actor.world.pos.x; player->actor.world.pos.y = sSmallStumpSkullKid.skullkid->actor.world.pos.y; @@ -928,7 +928,7 @@ void EnSkj_WaitInRange(EnSkj* this, PlayState* play) { } else if (!EnSkj_RangeCheck(player, sSmallStumpSkullKid.skullkid)) { EnSkj_SetupResetFight(this); } else { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; if (Flags_GetItemGetInf(ITEMGETINF_16)) { if (Flags_GetItemGetInf(ITEMGETINF_39)) { this->textId = Text_GetFaceReaction(play, 0x15); @@ -989,10 +989,10 @@ void EnSkj_WaitForSong(EnSkj* this, PlayState* play) { play->msgCtx.ocarinaMode = OCARINA_MODE_05; } } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_02) { - player->stateFlags2 &= ~0x1000000; + player->stateFlags2 &= ~PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR; Actor_Kill(&this->actor); } else if (play->msgCtx.ocarinaMode == OCARINA_MODE_01) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } else { if (play->msgCtx.ocarinaMode >= OCARINA_MODE_05) { gSaveContext.sunsSongState = 0; @@ -1214,7 +1214,7 @@ void EnSkj_SariasSongWaitForTextClear(EnSkj* this, PlayState* play) { if (state == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { EnSkj_SetupWaitInRange(this); - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; player->unk_6A8 = (Actor*)sSmallStumpSkullKid.skullkid; } } @@ -1377,8 +1377,8 @@ void EnSkj_SetupWaitForOcarina(EnSkj* this, PlayState* play) { sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->playerInRange = true; sOcarinaMinigameSkullKids[SKULL_KID_RIGHT].skullkid->playerInRange = true; - if (player->stateFlags2 & 0x1000000) { - player->stateFlags2 |= 0x2000000; + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { + player->stateFlags2 |= PLAYER_STATE2_PLAY_FOR_ACTOR; func_800F5BF0(NATURE_ID_KOKIRI_REGION); EnSkj_TurnPlayer(this, player); player->unk_6A8 = &this->actor; @@ -1393,15 +1393,15 @@ void EnSkj_SetupWaitForOcarina(EnSkj* this, PlayState* play) { void EnSkj_WaitForOcarina(EnSkj* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (player->stateFlags2 & 0x1000000) { - player->stateFlags2 |= 0x2000000; + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { + player->stateFlags2 |= PLAYER_STATE2_PLAY_FOR_ACTOR; func_800F5BF0(NATURE_ID_KOKIRI_REGION); EnSkj_TurnPlayer(this, player); player->unk_6A8 = &this->actor; Message_StartTextbox(play, 0x10BE, &this->actor); this->actionFunc = EnSkj_StartOcarinaMinigame; } else if (EnSkj_RangeCheck(player, this)) { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } @@ -1535,7 +1535,7 @@ void EnSkj_WaitForOfferResponse(EnSkj* this, PlayState* play) { switch (play->msgCtx.choiceIndex) { case 0: // yes player = GET_PLAYER(play); - player->stateFlags3 |= 0x20; // makes player take ocarina out right away after closing box + player->stateFlags3 |= PLAYER_STATE3_FORCE_PULL_OCARINA; // makes player take ocarina out right away after closing box this->actionFunc = EnSkj_SetupWaitForOcarina; break; case 1: // no diff --git a/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.c b/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.c index 9d061ee47..34db1a005 100644 --- a/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.c +++ b/soh/src/overlays/actors/ovl_En_Stream/z_en_stream.c @@ -103,7 +103,7 @@ void EnStream_SuckPlayer(EnStream* this, PlayState* play) { if (yDistWithOffset > 0.0f) { Math_SmoothStepToF(&player->actor.velocity.y, -3.0f, 0.7f, yDistWithOffset, 0.0f); if (posDifference.y < -70.0f) { - player->stateFlags2 |= 0x80000000; + player->stateFlags2 |= PLAYER_STATE2_FORCED_VOID_OUT; } } } else { diff --git a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c index 0a6825c0e..f62f8b998 100644 --- a/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/soh/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -718,7 +718,7 @@ s32 func_80B0DEA8(EnSw* this, PlayState* play, s32 arg2) { s32 sp54; Vec3f sp48; - if (!(player->stateFlags1 & 0x200000) && arg2) { + if (!(player->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER) && arg2) { return false; } else if (func_8002DDF4(play) && arg2) { return false; diff --git a/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 0eb3e9095..267a26c90 100644 --- a/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -579,7 +579,7 @@ s32 func_80B150AC(EnTa* this, PlayState* play, s32 idx) { Player* player = GET_PLAYER(play); Actor* interactRangeActor; - if (player->stateFlags1 & 0x800) { + if (player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { interactRangeActor = player->interactRangeActor; if (interactRangeActor != NULL && interactRangeActor->id == ACTOR_EN_NIW && interactRangeActor == &this->superCuccos[idx]->actor) { @@ -613,7 +613,7 @@ void func_80B15100(EnTa* this, PlayState* play) { if (player->heldActor == &this->superCuccos[unk_2CA]->actor) { player->heldActor = NULL; } - player->stateFlags1 &= ~0x800; + player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; this->superCuccos[unk_2CA] = NULL; } this->unk_2E0 |= 1; 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 46e9edc9e..1f4be6670 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 @@ -407,7 +407,7 @@ void EnTest_ChooseAction(EnTest* this, PlayState* play) { } else { if (this->actor.xzDistToPlayer < 110.0f) { if (Rand_ZeroOne() > 0.2f) { - if (player->stateFlags1 & 0x10) { + if (player->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); } else { @@ -693,7 +693,7 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { if (this->actor.xzDistToPlayer < 110.0f) { if (Rand_ZeroOne() > 0.2f) { - if (player->stateFlags1 & 0x10) { + if (player->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); } else { @@ -978,7 +978,7 @@ void EnTest_SlashDownEnd(EnTest* this, PlayState* play) { if ((ABS(yawDiff) > 0x3E80) && (this->actor.params != STALFOS_TYPE_CEILING)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnTest_SetupJumpBack(this); - } else if (player->stateFlags1 & 0x10) { + } else if (player->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); } else if ((play->gameplayFrames % 2) != 0) { diff --git a/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index bfc99a5b8..f919bb39a 100644 --- a/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -356,7 +356,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { } else if (sSwordJumpState != 0) { sStickTilt = 0.0f; - player->stateFlags3 |= 4; + player->stateFlags3 |= PLAYER_STATE3_PAUSE_ACTION_FUNC; Math_SmoothStepToF(&this->actor.world.pos.x, (Math_SinS(player->actor.shape.rot.y - 0x3E8) * 45.0f) + player->actor.world.pos.x, @@ -369,7 +369,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { if (((u32)sSwordJumpTimer == 0) || ((player->invincibilityTimer > 0) && (this->meleeWeaponState == 0))) { this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer; input->cur.button = BTN_A; - player->stateFlags3 &= ~4; + player->stateFlags3 &= ~PLAYER_STATE3_PAUSE_ACTION_FUNC; sStickTilt = 127.0f; player->skelAnime.curFrame = 3.0f; sStickAngle = this->actor.yawTowardsPlayer + 0x8000; @@ -404,7 +404,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { sStickTilt = 0.0f; sSwordJumpState = 1; - player->stateFlags3 |= 4; + player->stateFlags3 |= PLAYER_STATE3_PAUSE_ACTION_FUNC; this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; sSwordJumpTimer = 27; player->meleeWeaponState = 0; @@ -452,7 +452,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { sStickAngle = thisx->yawTowardsPlayer; sp50 = 0.0f; if ((90.0f >= this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 70.0f) && - (ABS(sp5A) >= 0x7800) && (this->actor.isTargeted || !(player->stateFlags1 & 0x00400000))) { + (ABS(sp5A) >= 0x7800) && (this->actor.isTargeted || !(player->stateFlags1 & PLAYER_STATE1_SHIELDING))) { EnTorch2_SwingSword(play, input, this); } else if (((this->actor.xzDistToPlayer <= 70.0f) || ((this->actor.xzDistToPlayer <= 80.0f + sp50) && (player->meleeWeaponState != 0))) && @@ -523,7 +523,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { this->meleeWeaponState = 0; input->cur.stick_x = input->cur.stick_y = 0; if ((this->invincibilityTimer > 0) && (this->actor.world.pos.y < (this->actor.floorHeight - 160.0f))) { - this->stateFlags3 &= ~1; + this->stateFlags3 &= ~PLAYER_STATE3_IGNORE_CEILING_FLOOR_WATER; this->actor.flags |= ACTOR_FLAG_TARGETABLE; this->invincibilityTimer = 0; this->actor.velocity.y = 0.0f; @@ -608,7 +608,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { sDeathFlag = false; } if ((this->invincibilityTimer == 0) && (this->actor.colChkInfo.health != 0) && - (this->cylinder.base.acFlags & AC_HIT) && !(this->stateFlags1 & 0x04000000) && + (this->cylinder.base.acFlags & AC_HIT) && !(this->stateFlags1 & PLAYER_STATE1_SHIELDING) && !(this->meleeWeaponQuads[0].base.atFlags & AT_HIT) && !(this->meleeWeaponQuads[1].base.atFlags & AT_HIT)) { if (!Actor_ApplyDamage(&this->actor)) { @@ -623,7 +623,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { sActionState = ENTORCH2_DEATH; Enemy_StartFinishingBlow(play, &this->actor); Item_DropCollectibleRandom(play, &this->actor, &thisx->world.pos, 0xC0); - this->stateFlags3 &= ~4; + this->stateFlags3 &= ~PLAYER_STATE3_PAUSE_ACTION_FUNC; } else { func_800F5ACC(NA_BGM_MINI_BOSS); if (this->actor.colChkInfo.damageEffect == 1) { @@ -640,8 +640,8 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { this->unk_8A4 = 8.0f; this->unk_8A2 = this->actor.yawTowardsPlayer + 0x8000; Actor_SetDropFlag(&this->actor, &this->cylinder.info, 1); - this->stateFlags3 &= ~4; - this->stateFlags3 |= 1; + this->stateFlags3 &= ~PLAYER_STATE3_PAUSE_ACTION_FUNC; + this->stateFlags3 |= PLAYER_STATE3_IGNORE_CEILING_FLOOR_WATER; sActionState = ENTORCH2_DAMAGE; if (sAlpha == 255) { Actor_SetColorFilter(&this->actor, 0x4000, 0xFF, 0, 0xC); @@ -657,10 +657,10 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { // Handles being frozen by a deku nut if ((this->actor.colorFilterTimer == 0) || (this->actor.colorFilterParams & 0x4000)) { - this->stateFlags3 &= ~4; + this->stateFlags3 &= ~PLAYER_STATE3_PAUSE_ACTION_FUNC; } else { - this->stateFlags3 |= 4; - this->stateFlags1 &= ~0x04000000; + this->stateFlags3 |= PLAYER_STATE3_PAUSE_ACTION_FUNC; + this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; this->invincibilityTimer = 0; input->press.stick_x = input->press.stick_y = 0; /*! @bug diff --git a/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.c index 82c22529d..30ff3c37f 100644 --- a/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/soh/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -657,7 +657,7 @@ void EnTp_Update(Actor* thisx, PlayState* play) { Player* player = GET_PLAYER(play); s16 yawToWall; - if (player->stateFlags1 & 0x4000000) { // Shielding + if (player->stateFlags1 & PLAYER_STATE1_SHIELDING) { // Shielding this->damageEffect = TAILPASARAN_DMGEFF_NONE; } diff --git a/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 69c33f5f5..2f90ad1a0 100644 --- a/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/soh/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -313,11 +313,11 @@ void EnWallmas_WaitToDrop(EnWallmas* this, PlayState* play) { } if (this->actor.params == WMT_SHADOWTAG) { - if ((player->stateFlags1 & 0x100000) || (player->stateFlags1 & 0x8000000) || !(player->actor.bgCheckFlags & 1)) { + if ((player->stateFlags1 & PLAYER_STATE1_FIRST_PERSON) || (player->stateFlags1 & PLAYER_STATE1_IN_WATER) || !(player->actor.bgCheckFlags & 1)) { Audio_StopSfxById(NA_SE_EN_FALL_AIM); this->timer = 0x82; } - } else if ((player->stateFlags1 & 0x100000) || (player->stateFlags1 & 0x8000000) || !(player->actor.bgCheckFlags & 1) || + } else if ((player->stateFlags1 & PLAYER_STATE1_FIRST_PERSON) || (player->stateFlags1 & PLAYER_STATE1_IN_WATER) || !(player->actor.bgCheckFlags & 1) || ((this->actor.params == 1) && (320.0f < Math_Vec3f_DistXZ(&this->actor.home.pos, playerPos)))) { Audio_StopSfxById(NA_SE_EN_FALL_AIM); this->timer = 0x82; @@ -339,7 +339,7 @@ void EnWallmas_WaitToDrop(EnWallmas* this, PlayState* play) { void EnWallmas_Drop(EnWallmas* this, PlayState* play) { Player* player = GET_PLAYER(play); - if (!Player_InCsMode(play) && !(player->stateFlags2 & 0x10) && (player->invincibilityTimer >= 0) && + if (!Player_InCsMode(play) && !(player->stateFlags2 & PLAYER_STATE2_MOVING_DYNAPOLY) && (player->invincibilityTimer >= 0) && (this->actor.xzDistToPlayer < 30.0f) && (this->actor.yDistToPlayer < -5.0f) && (-(f32)(player->cylinder.dim.height + 10) < this->actor.yDistToPlayer)) { EnWallmas_SetupTakePlayer(this, play); 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 83f799877..f0cdc2249 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 @@ -392,7 +392,7 @@ s32 EnXc_SerenadeCS(EnXc* this, PlayState* play) { if (((CHECK_OWNED_EQUIP(EQUIP_TYPE_BOOTS, EQUIP_INV_BOOTS_IRON) && !IS_RANDO) || (Flags_GetTreasure(play, 2) && IS_RANDO)) && - !Flags_GetEventChkInf(EVENTCHKINF_LEARNED_SERENADE_OF_WATER) && !(stateFlags & 0x20000000) && + !Flags_GetEventChkInf(EVENTCHKINF_LEARNED_SERENADE_OF_WATER) && !(stateFlags & PLAYER_STATE1_IN_CUTSCENE) && !Play_InCsMode(play)) { if (!IS_RANDO) { Cutscene_SetSegment(play, &gIceCavernSerenadeCs); diff --git a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 9aa8204dd..98180605e 100644 --- a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -532,7 +532,7 @@ s32 EnZf_CanAttack(PlayState* play, EnZf* this) { Player* player = GET_PLAYER(play); if (this->actor.params >= ENZF_TYPE_LIZALFOS_MINIBOSS_A) { // miniboss - if (player->stateFlags1 & 0x6000) { // Hanging or climbing + if (player->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE)) { // Hanging or climbing return false; } else { return true; @@ -1208,7 +1208,7 @@ void EnZf_Slash(EnZf* this, PlayState* play) { if (yawDiff > 16000) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80B483E4(this, play); - } else if (player->stateFlags1 & 0x6010) { + } else if (player->stateFlags1 & (PLAYER_STATE1_ENEMY_TARGET | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE)) { if (this->actor.isTargeted) { EnZf_SetupSlash(this); } else { diff --git a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c index 727a20730..9a31ceb50 100644 --- a/soh/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/soh/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -2233,7 +2233,7 @@ void Fishing_UpdateLure(Fishing* this, PlayState* play) { Math_ApproachF(&D_80B7E144, 195.0f, 1.0f, 1.0f); - if (player->stateFlags1 & 0x8000000) { + if (player->stateFlags1 & PLAYER_STATE1_IN_WATER) { D_80B7E0B4 = 0; player->unk_860 = 0; } diff --git a/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 27b4c17cd..09ce9dff6 100644 --- a/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/soh/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -486,11 +486,11 @@ void ObjOshihiki_OnScene(ObjOshihiki* this, PlayState* play) { this->direction = this->dyna.unk_150; ObjOshihiki_SetupPush(this, play); } else { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } } else { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } } @@ -527,11 +527,11 @@ void ObjOshihiki_OnActor(ObjOshihiki* this, PlayState* play) { this->direction = this->dyna.unk_150; ObjOshihiki_SetupPush(this, play); } else { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } } else { - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; } } else { @@ -579,7 +579,7 @@ void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play) { if (!ObjOshihiki_CheckFloor(this, play)) { thisx->home.pos.x = thisx->world.pos.x; thisx->home.pos.z = thisx->world.pos.z; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; this->pushDist = 0.0f; this->pushSpeed = 0.0f; @@ -592,7 +592,7 @@ void ObjOshihiki_Push(ObjOshihiki* this, PlayState* play) { thisx->home.pos.x = thisx->world.pos.x; thisx->home.pos.z = thisx->world.pos.z; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; this->dyna.unk_150 = 0.0f; this->pushDist = 0.0f; this->pushSpeed = 0.0f; @@ -620,7 +620,7 @@ void ObjOshihiki_Fall(ObjOshihiki* this, PlayState* play) { this->stateFlags |= PUSHBLOCK_FALL; if (fabsf(this->dyna.unk_150) > 0.001f) { this->dyna.unk_150 = 0.0f; - player->stateFlags2 &= ~0x10; + player->stateFlags2 &= ~PLAYER_STATE2_MOVING_DYNAPOLY; } Actor_MoveForward(&this->dyna.actor); if (ObjOshihiki_CheckGround(this, play)) { diff --git a/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index ed210ce0b..b0c7b44fc 100644 --- a/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/soh/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -171,11 +171,11 @@ s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, PlayState* play) { Player* player = GET_PLAYER(play); if (ObjTimeblock_PlayerIsInRange(this, play)) { - if (player->stateFlags2 & 0x1000000) { + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->songObserverFunc = ObjTimeblock_WaitForSong; } else { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } return false; diff --git a/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index 73e592e3e..b67660963 100644 --- a/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/soh/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -159,11 +159,11 @@ s32 func_80BA2218(ObjWarp2block* this, PlayState* play) { Player* player = GET_PLAYER(play); if (func_80BA1ECC(this, play)) { - if (player->stateFlags2 & 0x1000000) { + if (player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR) { func_8010BD58(play, OCARINA_ACTION_FREE_PLAY); this->func_168 = func_80BA228C; } else { - player->stateFlags2 |= 0x800000; + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; } } diff --git a/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 0c280171f..a0552a027 100644 --- a/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/soh/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -128,8 +128,8 @@ void func_80BADF0C(ShotSun* this, PlayState* play) { this->unk_1A4 = 0; } else { if (this->unk_1A4 == 0) { - if (!(player->stateFlags2 & 0x1000000)) { - player->stateFlags2 |= 0x800000; + if (!(player->stateFlags2 & PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR)) { + player->stateFlags2 |= PLAYER_STATE2_NEAR_OCARINA_ACTOR; return; } else { this->unk_1A4 = 1; From 0932e1e504538522b62a5b0009edf0ea41354aec Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Fri, 16 Feb 2024 01:20:12 +0000 Subject: [PATCH 07/44] Make the final Magic Bean cost 99 rupees in randomiser when it is not shuffled (#3392) * Make rando final eban cost 99 and clean up Text IDs * Remove Text ID changes * Add french translation, All credit to Purple hato Co-authored-by: Purple Hato --------- Co-authored-by: Purple Hato --- .../custom-message/CustomMessageTypes.h | 16 +++++ .../Enhancements/randomizer/randomizer.cpp | 11 +++- soh/soh/OTRGlobals.cpp | 9 +-- soh/src/overlays/actors/ovl_En_Ms/z_en_ms.c | 59 +++++++++++++------ 4 files changed, 70 insertions(+), 25 deletions(-) diff --git a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h index 47729c129..9e0d7ec0d 100644 --- a/soh/soh/Enhancements/custom-message/CustomMessageTypes.h +++ b/soh/soh/Enhancements/custom-message/CustomMessageTypes.h @@ -55,6 +55,22 @@ typedef enum { TEXT_SHOOTING_GALLERY_MAN_COME_BACK_WITH_BOW = 0x9210, TEXT_LAKE_HYLIA_WATER_SWITCH_SIGN = 0x346, // 0x3yy for cuttable sign range TEXT_LAKE_HYLIA_WATER_SWITCH_NAVI = 0x1B3, // 0x1yy for Navi msg range + TEXT_SARIAS_SONG_CHANNELING_POWER = 0x016D, + TEXT_BEAN_SALESMAN_BUY_FOR_10 = 0x405E, + TEXT_BEAN_SALESMAN_BUY_FOR_20 = 0x405F, + TEXT_BEAN_SALESMAN_BUY_FOR_30 = 0x4060, + TEXT_BEAN_SALESMAN_BUY_FOR_40 = 0x4061, + TEXT_BEAN_SALESMAN_BUY_FOR_50 = 0x4062, + TEXT_BEAN_SALESMAN_BUY_FOR_60 = 0x4063, + TEXT_BEAN_SALESMAN_BUY_FOR_70 = 0x4064, + TEXT_BEAN_SALESMAN_BUY_FOR_80 = 0x4065, + TEXT_BEAN_SALESMAN_BUY_FOR_90 = 0x4066, + TEXT_BEAN_SALESMAN_BUY_FOR_100 = 0x4067, + TEXT_BEAN_SALESMAN_OH_WELL = 0x4068, + TEXT_BEAN_SALESMAN_NOT_ENOUGH_MONEY = 0x4069, + TEXT_BEAN_SALESMAN_SET_A_BEAN_TO_C = 0x406A, + TEXT_BEAN_SALESMAN_SOLD_OUT = 0x406B, + TEXT_BEAN_SALESMAN_WANT_TO_PLANT = 0x406C, } TextIDs; #ifdef __cplusplus diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index db287fdff..f117e4c4a 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -549,13 +549,18 @@ void Randomizer::LoadMerchantMessages(const char* spoilerFileName) { "\x12\x38\x82" "Aufgeben! Ich verkaufe dir einen&%g{{item}}%w&für %r{{price}} Rubine%w!\x07\x10\xA3", "\x12\x38\x82" "J'abandonne! Tu veux bien m'acheter&un %g{{item}}%w?&Ça fera %r{{price}} Rubis%w!\x07\x10\xA3")); CustomMessageManager::Instance->CreateMessage( - Randomizer::merchantMessageTableID, TEXT_BEAN_SALESMAN, + Randomizer::merchantMessageTableID, TEXT_BEAN_SALESMAN_BUY_FOR_10, CustomMessage("I tried to be a %rmagic bean%w salesman,&but it turns out my marketing skills&weren't worth " "beans!^Anyway, want to buy my&%gmysterious item%w for 60 Rupees?\x1B&%gYes&No%w", "Möchten Sie einen geheimnisvollen&Gegenstand für 60 Rubine?\x1B&%gJa&Nein%w", "J'ai essayé d'être un vendeur de&%rharicots magiques%w, mais j'étais&mauvais au niveau du marketing et&ça " "me courait sur le haricot...^Enfin bref, ça te dirait de m'acheter un&" "%gobjet mystérieux%w pour 60 Rubis?\x1B&%gOui&Non%w")); + CustomMessageManager::Instance->CreateMessage( + Randomizer::merchantMessageTableID, TEXT_BEAN_SALESMAN_BUY_FOR_100, + CustomMessage("I never thought I'd say this, but I'm &selling the last %rMagic Bean%w. %r99%w Rupees...\x1B&%gYes&No%w", + "\x1B&%gJa&Nein%w", + "Je te vends mon dernier %rHaricot&magique%w pour %r99 Rubis%w.\x1B&%gAcheter&Ne pas acheter%w")); //Setup for merchant text boxes @@ -567,7 +572,7 @@ void Randomizer::LoadMerchantMessages(const char* spoilerFileName) { "Wie wäre es mit %g&{{item}}%w für %y200 Rubine?%w\x1B&%gJa!&Nein!%w", "Veux-tu acheter %g&{{item}}%w pour %y200 rubis?%w\x1B&%gOui&Non&w")); - //Granny Shopy + //Granny Shop //RANDOTODO: Implement obscure/ambiguous hints CustomMessageManager::Instance->CreateMessage( Randomizer::merchantMessageTableID, TEXT_GRANNYS_SHOP, @@ -5385,7 +5390,7 @@ CustomMessage Randomizer::GetSheikMessage(s16 scene, u16 originalTextId) { } CustomMessage Randomizer::GetSariaMessage(u16 originalTextId) { - if (originalTextId == TEXT_SARIA_SFM || (originalTextId >= TEXT_SARIAS_SONG_TEXT_START && originalTextId <= TEXT_SARIAS_SONG_TEXT_END)) { + if (originalTextId == TEXT_SARIA_SFM || (originalTextId >= TEXT_SARIAS_SONG_FACE_TO_FACE && originalTextId <= TEXT_SARIAS_SONG_CHANNELING_POWER)) { CustomMessage messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::hintMessageTableID, TEXT_SARIAS_SONG_FACE_TO_FACE); CustomMessage messageEntry2 = messageEntry; std::string code = originalTextId == TEXT_SARIA_SFM ? "" : "\x0B"; diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 62a8bdd3d..a5983c457 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -2588,10 +2588,11 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { messageEntry = OTRGlobals::Instance->gRandomizer->GetGoronMessage(choice); } else if (Randomizer_GetSettingValue(RSK_FROGS_HINT) && textId == TEXT_FROGS_UNDERWATER) { messageEntry = OTRGlobals::Instance->gRandomizer->GetFrogsMessage(textId); - } else if (Randomizer_GetSettingValue(RSK_SARIA_HINT)) { - if ((gPlayState->sceneNum == SCENE_SACRED_FOREST_MEADOW && textId == TEXT_SARIA_SFM) || (textId >= TEXT_SARIAS_SONG_TEXT_START && textId <= TEXT_SARIAS_SONG_TEXT_END)) { - messageEntry = OTRGlobals::Instance->gRandomizer->GetSariaMessage(textId); - } + } else if (Randomizer_GetSettingValue(RSK_SARIA_HINT) && + (gPlayState->sceneNum == SCENE_SACRED_FOREST_MEADOW && textId == TEXT_SARIA_SFM) || (textId >= TEXT_SARIAS_SONG_FACE_TO_FACE && textId <= TEXT_SARIAS_SONG_CHANNELING_POWER)) { + messageEntry = OTRGlobals::Instance->gRandomizer->GetSariaMessage(textId); + } else if (textId == TEXT_BEAN_SALESMAN_BUY_FOR_100) { + messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::merchantMessageTableID, TEXT_BEAN_SALESMAN_BUY_FOR_100); } } if (textId == TEXT_GS_NO_FREEZE || textId == TEXT_GS_FREEZE) { diff --git a/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.c b/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.c index b1d453f00..f89644847 100644 --- a/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.c +++ b/soh/src/overlays/actors/ovl_En_Ms/z_en_ms.c @@ -18,6 +18,7 @@ void EnMs_SetOfferText(EnMs* this, PlayState* play); void EnMs_Wait(EnMs* this, PlayState* play); void EnMs_Talk(EnMs* this, PlayState* play); void EnMs_Sell(EnMs* this, PlayState* play); +void EnMs_Sell_Rando(EnMs* this, PlayState* play); void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play); const ActorInit En_Ms_InitVars = { @@ -49,6 +50,10 @@ static s16 sPrices[] = { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, }; +static s16 sRandoPrices[] = { + 10, 20, 30, 40, 50, 60, 70, 80, 90, 99, +}; + static u16 sOfferTextIDs[] = { 0x405E, 0x405F, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066, 0x4067, }; @@ -127,21 +132,30 @@ void EnMs_Talk(EnMs* this, PlayState* play) { } else if (Message_ShouldAdvance(play)) { switch (play->msgCtx.choiceIndex) { case 0: // yes - if (gSaveContext.rupees < - ((IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) - ? 60 - : sPrices[BEANS_BOUGHT])) { - Message_ContinueTextbox(play, 0x4069); // not enough rupees text + //Randomizer Mechanic: Magic bean salesman + if (IS_RANDO){ + if (gSaveContext.rupees < ((Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? 60 : sRandoPrices[BEANS_BOUGHT])) { + Message_ContinueTextbox(play, 0x4069); // TEXT_BEAN_SALESMAN_NOT_ENOUGH_MONEY + return; + } + if (Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)){ + GiveItemEntryFromActor(&this->actor, play, + Randomizer_GetItemFromKnownCheck(RC_ZR_MAGIC_BEAN_SALESMAN, GI_BEAN), 90.0f, 10.0f); + } else { + func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f); + } + this->actionFunc = EnMs_Sell_Rando; + return; + } else { // vanilla code + if(gSaveContext.rupees < sPrices[BEANS_BOUGHT]){ + Message_ContinueTextbox(play, 0x4069); // TEXT_BEAN_SALESMAN_NOT_ENOUGH_MONEY + return; + } + func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f); + this->actionFunc = EnMs_Sell; return; } - if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) { - GiveItemEntryFromActor(&this->actor, play, - Randomizer_GetItemFromKnownCheck(RC_ZR_MAGIC_BEAN_SALESMAN, GI_BEAN), 90.0f, 10.0f); - } else { - func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f); - } - this->actionFunc = EnMs_Sell; - return; + //Randomizer Mechanic end case 1: // no Message_ContinueTextbox(play, 0x4068); default: @@ -150,14 +164,13 @@ void EnMs_Talk(EnMs* this, PlayState* play) { } } -void EnMs_Sell(EnMs* this, PlayState* play) { +void EnMs_Sell_Rando(EnMs* this, PlayState* play) { if (Actor_HasParent(&this->actor, play)) { - Rupees_ChangeBy((IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? -60 : -sPrices[BEANS_BOUGHT]); + Rupees_ChangeBy((Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? -60 : -sRandoPrices[BEANS_BOUGHT]); this->actor.parent = NULL; - this->actionFunc = - (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? EnMs_Wait : EnMs_TalkAfterPurchase; + this->actionFunc = (Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) ? EnMs_Wait : EnMs_TalkAfterPurchase; } else { - if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) { + if (Randomizer_GetSettingValue(RSK_SHUFFLE_MAGIC_BEANS)) { GetItemEntry itemEntry = Randomizer_GetItemFromKnownCheck(RC_ZR_MAGIC_BEAN_SALESMAN, GI_BEAN); gSaveContext.pendingSale = itemEntry.itemId; gSaveContext.pendingSaleMod = itemEntry.modIndex; @@ -172,6 +185,16 @@ void EnMs_Sell(EnMs* this, PlayState* play) { } } +void EnMs_Sell(EnMs* this, PlayState* play) { + if (Actor_HasParent(&this->actor, play)) { + Rupees_ChangeBy(-sPrices[BEANS_BOUGHT]); + this->actor.parent = NULL; + this->actionFunc = EnMs_TalkAfterPurchase; + } else { + func_8002F434(&this->actor, play, GI_BEAN, 90.0f, 10.0f); + } +} + void EnMs_TalkAfterPurchase(EnMs* this, PlayState* play) { // if dialog state is 6 and player responded to textbox if ((Message_GetState(&play->msgCtx)) == TEXT_STATE_DONE && Message_ShouldAdvance(play)) { From 3514954ad17cd50afecc0bea5b529575e868161d Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Thu, 15 Feb 2024 20:23:12 -0500 Subject: [PATCH 08/44] Adds Message Viewer Window to Developer Tools (#3486) * Adds a MessageViewer window to Developer Tools. * Properly destroys message viewer window. * Adds missing ImGui::End() * Fixes an oopsie crashing non-windows builds after first run. * Adds C ABI for displaying a custom message * Fixes a crash and an issue with messages with SFX. * Remove some osSyncPrintf's that aren't very useful for this case. --- .../Enhancements/debugger/MessageViewer.cpp | 271 ++++++++++++++++++ soh/soh/Enhancements/debugger/MessageViewer.h | 62 ++++ soh/soh/SohGui.cpp | 5 + soh/soh/SohMenuBar.cpp | 10 +- soh/soh/util.cpp | 13 + soh/soh/util.h | 4 + 6 files changed, 364 insertions(+), 1 deletion(-) create mode 100644 soh/soh/Enhancements/debugger/MessageViewer.cpp create mode 100644 soh/soh/Enhancements/debugger/MessageViewer.h diff --git a/soh/soh/Enhancements/debugger/MessageViewer.cpp b/soh/soh/Enhancements/debugger/MessageViewer.cpp new file mode 100644 index 000000000..51fe3c0b9 --- /dev/null +++ b/soh/soh/Enhancements/debugger/MessageViewer.cpp @@ -0,0 +1,271 @@ +#include "MessageViewer.h" + +#include +#include + +#include "../custom-message/CustomMessageManager.h" +#include "functions.h" +#include "macros.h" +#include "message_data_static.h" +#include "variables.h" +#include "soh/util.h" + +extern "C" u8 sMessageHasSetSfx; + +void MessageViewer::InitElement() { + CustomMessageManager::Instance->AddCustomMessageTable(TABLE_ID); + mTableIdBuf = static_cast(calloc(MAX_STRING_SIZE, sizeof(char))); + mTextIdBuf = static_cast(calloc(MAX_STRING_SIZE, sizeof(char))); + mCustomMessageBuf = static_cast(calloc(MAX_STRING_SIZE, sizeof(char))); +} + +void MessageViewer::DrawElement() { + ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); + if (!ImGui::Begin("Custom Message Debugger", &mIsVisible, ImGuiWindowFlags_NoFocusOnAppearing)) { + ImGui::End(); + return; + } + ImGui::Text("Table ID"); + ImGui::SameLine(); + ImGui::InputText("##TableID", mTableIdBuf, MAX_STRING_SIZE, ImGuiInputTextFlags_CallbackCharFilter, UIWidgets::TextFilters::FilterAlphaNum); + UIWidgets::InsertHelpHoverText("Leave blank for vanilla table"); + ImGui::Text("Text ID"); + ImGui::SameLine(); + switch (mTextIdBase) { + case DECIMAL: + ImGui::InputText("##TextID", mTextIdBuf, MAX_STRING_SIZE, ImGuiInputTextFlags_CharsDecimal); + UIWidgets::InsertHelpHoverText("Decimal Text ID of the message to load. Decimal digits only (0-9)."); + break; + case HEXADECIMAL: + default: + ImGui::InputText("##TextID", mTextIdBuf, MAX_STRING_SIZE, ImGuiInputTextFlags_CharsHexadecimal); + UIWidgets::InsertHelpHoverText("Hexadecimal Text ID of the message to load. Hexadecimal digits only (0-9/A-F)."); + break; + } + if (ImGui::RadioButton("Hexadecimal", &mTextIdBase, HEXADECIMAL)) { + memset(mTextIdBuf, 0, sizeof(char) * MAX_STRING_SIZE); + } + ImGui::SameLine(); + if (ImGui::RadioButton("Decimal", &mTextIdBase, DECIMAL)) { + memset(mTextIdBuf, 0, sizeof(char) * MAX_STRING_SIZE); + } + ImGui::Text("Language"); + ImGui::SameLine(); + if (ImGui::BeginCombo("##Language", mLanguages[mLanguage])) { + // ReSharper disable CppDFAUnreachableCode + for (size_t i = 0; i < mLanguages.size(); i++) { + if (strlen(mLanguages[i]) > 0) { + if (ImGui::Selectable(mLanguages[i], i == mLanguage)) { + mLanguage = i; + } + } + } + ImGui::EndCombo(); + } + UIWidgets::InsertHelpHoverText("Which language to load from the selected text ID"); + if (ImGui::Button("Display Message##ExistingMessage")) { + mDisplayExistingMessageClicked = true; + } + ImGui::Text("Custom Message"); + UIWidgets::InsertHelpHoverText("Enter a string using Custom Message Syntax to preview it in-game. " + "Any newline (\\n) characters inserted by the Enter key will be stripped " + "from the output."); + ImGui::InputTextMultiline("##CustomMessage", mCustomMessageBuf, MAX_STRING_SIZE); + if (ImGui::Button("Display Message##CustomMessage")) { + mDisplayCustomMessageClicked = true; + } + ImGui::End(); + // ReSharper restore CppDFAUnreachableCode +} + +void MessageViewer::UpdateElement() { + if (mDisplayExistingMessageClicked) { + mTableId = std::string(mTableIdBuf); + switch (mTextIdBase) { + case DECIMAL: + mTextId = std::stoi(std::string(mTextIdBuf), nullptr, 10); + break; + case HEXADECIMAL: + default: + mTextId = std::stoi(std::string(mTextIdBuf), nullptr, 16); + break; + } + DisplayExistingMessage(); + mDisplayExistingMessageClicked = false; + } + if (mDisplayCustomMessageClicked) { + mCustomMessageString = std::string(mCustomMessageBuf); + std::erase(mCustomMessageString, '\n'); + DisplayCustomMessage(); + mDisplayCustomMessageClicked = false; + } +} + +void MessageViewer::DisplayExistingMessage() const { + MessageDebug_StartTextBox(mTableId.c_str(), mTextId, mLanguage); +} + +void MessageViewer::DisplayCustomMessage() const { + MessageDebug_DisplayCustomMessage(mCustomMessageString.c_str()); +} + +extern "C" MessageTableEntry* sNesMessageEntryTablePtr; +extern "C" MessageTableEntry* sGerMessageEntryTablePtr; +extern "C" MessageTableEntry* sFraMessageEntryTablePtr; +extern "C" MessageTableEntry* sStaffMessageEntryTablePtr; + +void FindMessage(PlayState* play, const uint16_t textId, const uint8_t language) { + const char* foundSeg; + const char* nextSeg; + MessageTableEntry* messageTableEntry = sNesMessageEntryTablePtr; + Font* font; + u16 bufferId = textId; + // Use the better owl message if better owl is enabled + if (CVarGetInteger("gBetterOwl", 0) != 0 && (bufferId == 0x2066 || bufferId == 0x607B || + bufferId == 0x10C2 || bufferId == 0x10C6 || bufferId == 0x206A)) + { + bufferId = 0x71B3; + } + + if (language == LANGUAGE_GER) + messageTableEntry = sGerMessageEntryTablePtr; + else if (language == LANGUAGE_FRA) + messageTableEntry = sFraMessageEntryTablePtr; + + // If PAL languages are not present in the OTR file, default to English + if (messageTableEntry == nullptr) + messageTableEntry = sNesMessageEntryTablePtr; + + const char* seg = messageTableEntry->segment; + + while (messageTableEntry->textId != 0xFFFF) { + font = &play->msgCtx.font; + + if (messageTableEntry->textId == bufferId) { + foundSeg = messageTableEntry->segment; + font->charTexBuf[0] = messageTableEntry->typePos; + + nextSeg = messageTableEntry->segment; + font->msgOffset = reinterpret_cast(messageTableEntry->segment); + font->msgLength = messageTableEntry->msgSize; + return; + } + messageTableEntry++; + } + + font = &play->msgCtx.font; + messageTableEntry = sNesMessageEntryTablePtr; + + foundSeg = messageTableEntry->segment; + font->charTexBuf[0] = messageTableEntry->typePos; + messageTableEntry++; + nextSeg = messageTableEntry->segment; + font->msgOffset = foundSeg - seg; + font->msgLength = nextSeg - foundSeg; +} + +static const char* msgStaticTbl[] = +{ + gDefaultMessageBackgroundTex, + gSignMessageBackgroundTex, + gNoteStaffMessageBackgroundTex, + gFadingMessageBackgroundTex, + gMessageContinueTriangleTex, + gMessageEndSquareTex, + gMessageArrowTex +}; + +void MessageDebug_StartTextBox(const char* tableId, uint16_t textId, uint8_t language) { + PlayState* play = gPlayState; + static int16_t messageStaticIndices[] = { 0, 1, 3, 2 }; + const auto player = GET_PLAYER(gPlayState); + player->actor.flags |= ACTOR_FLAG_PLAYER_TALKED_TO; + MessageContext* msgCtx = &play->msgCtx; + msgCtx->ocarinaAction = 0xFFFF; + Font* font = &msgCtx->font; + sMessageHasSetSfx = 0; + for (u32 i = 0; i < FONT_CHAR_TEX_SIZE * 120; i += FONT_CHAR_TEX_SIZE) { + if (&font->charTexBuf[i] != nullptr) { + gSPInvalidateTexCache(play->state.gfxCtx->polyOpa.p++, reinterpret_cast(&font->charTexBuf[i])); + } + } + R_TEXT_CHAR_SCALE = 75; + R_TEXT_LINE_SPACING = 12; + R_TEXT_INIT_XPOS = 65; + char* buffer = font->msgBuf; + msgCtx->textId = textId; + if (strlen(tableId) == 0) { + FindMessage(play, textId, language); + msgCtx->msgLength = static_cast(font->msgLength); + const uintptr_t src = font->msgOffset; + memcpy(font->msgBuf, reinterpret_cast(src), font->msgLength); + } else { + constexpr int maxBufferSize = sizeof(font->msgBuf); + const CustomMessage messageEntry = CustomMessageManager::Instance->RetrieveMessage(tableId, textId); + font->charTexBuf[0] = (messageEntry.GetTextBoxType() << 4) | messageEntry.GetTextBoxPosition(); + switch (language) { + case LANGUAGE_FRA: + font->msgLength = SohUtils::CopyStringToCharBuffer(buffer, messageEntry.GetFrench(), maxBufferSize); + break; + case LANGUAGE_GER: + font->msgLength = SohUtils::CopyStringToCharBuffer(buffer, messageEntry.GetGerman(), maxBufferSize); + break; + case LANGUAGE_ENG: + default: + font->msgLength = SohUtils::CopyStringToCharBuffer(buffer, messageEntry.GetEnglish(), maxBufferSize); + break; + } + msgCtx->msgLength = static_cast(font->msgLength); + } + msgCtx->textBoxProperties = font->charTexBuf[0]; + msgCtx->textBoxType = msgCtx->textBoxProperties >> 4; + msgCtx->textBoxPos = msgCtx->textBoxProperties & 0xF; + const int16_t textBoxType = msgCtx->textBoxType; + // "Text Box Type" + osSyncPrintf("吹き出し種類=%d\n", msgCtx->textBoxType); + if (textBoxType < TEXTBOX_TYPE_NONE_BOTTOM) { + const char* textureName = msgStaticTbl[messageStaticIndices[textBoxType]]; + memcpy(msgCtx->textboxSegment, textureName, strlen(textureName) + 1); + if (textBoxType == TEXTBOX_TYPE_BLACK) { + msgCtx->textboxColorRed = 0; + msgCtx->textboxColorGreen = 0; + msgCtx->textboxColorBlue = 0; + } else if (textBoxType == TEXTBOX_TYPE_WOODEN) { + msgCtx->textboxColorRed = 70; + msgCtx->textboxColorGreen = 50; + msgCtx->textboxColorBlue = 30; + } else if (textBoxType == TEXTBOX_TYPE_BLUE) { + msgCtx->textboxColorRed = 0; + msgCtx->textboxColorGreen = 10; + msgCtx->textboxColorBlue = 50; + } else { + msgCtx->textboxColorRed = 255; + msgCtx->textboxColorGreen = 0; + msgCtx->textboxColorBlue = 0; + } + if (textBoxType == TEXTBOX_TYPE_WOODEN) { + msgCtx->textboxColorAlphaTarget = 230; + } else if (textBoxType == TEXTBOX_TYPE_OCARINA) { + msgCtx->textboxColorAlphaTarget = 180; + } else { + msgCtx->textboxColorAlphaTarget = 170; + } + msgCtx->textboxColorAlphaCurrent = 0; + } + msgCtx->choiceNum = msgCtx->textUnskippable = msgCtx->textboxEndType = 0; + msgCtx->msgBufPos = msgCtx->unk_E3D0 = msgCtx->textDrawPos = 0; + msgCtx->talkActor = &player->actor; + msgCtx->msgMode = MSGMODE_TEXT_START; + msgCtx->stateTimer = 0; + msgCtx->textDelayTimer = 0; + msgCtx->ocarinaMode = OCARINA_MODE_00; +} + +void MessageDebug_DisplayCustomMessage(const char* customMessage) { + CustomMessageManager::Instance->ClearMessageTable(MessageViewer::TABLE_ID); + CustomMessageManager::Instance->CreateMessage(MessageViewer::TABLE_ID, 0, + CustomMessage(customMessage, customMessage, customMessage)); + MessageDebug_StartTextBox(MessageViewer::TABLE_ID, 0, 0); +} + + diff --git a/soh/soh/Enhancements/debugger/MessageViewer.h b/soh/soh/Enhancements/debugger/MessageViewer.h new file mode 100644 index 000000000..702693793 --- /dev/null +++ b/soh/soh/Enhancements/debugger/MessageViewer.h @@ -0,0 +1,62 @@ +#ifndef CUSTOMMESSAGEDEBUGGER_H +#define CUSTOMMESSAGEDEBUGGER_H +#include "z64.h" + +#ifdef __cplusplus +#include "GuiWindow.h" +#include +extern "C" { +#endif +/** + * \brief Pulls a message from the specified message table and kicks off the process of displaying that message + * in a text box on screen. + * \param tableId the tableId string for the table we want to pull from. Empty string for authentic/vanilla messages + * \param textId The textId corresponding to the message to display. Putting in a textId that doesn't exist will + * probably result in a crash. + * \param language The Language to display on the screen. + */ +void MessageDebug_StartTextBox(const char* tableId, uint16_t textId, uint8_t language); + +/** + * \brief + * \param customMessage A string using Custom Message Syntax. + */ +void MessageDebug_DisplayCustomMessage(const char* customMessage); +#ifdef __cplusplus +} + + +class MessageViewer : public LUS::GuiWindow { +public: + static inline const char* TABLE_ID = "MessageViewer"; + using GuiWindow::GuiWindow; + + void InitElement() override; + void DrawElement() override; + void UpdateElement() override; + + virtual ~MessageViewer() = default; + +private: + void DisplayExistingMessage() const; + void DisplayCustomMessage() const; + + static constexpr uint16_t MAX_STRING_SIZE = 1024; + static constexpr std::array mLanguages = {"English", "German", "French"}; + static constexpr int HEXADECIMAL = 0; + static constexpr int DECIMAL = 1; + char* mTableIdBuf; + std::string mTableId; + char* mTextIdBuf; + uint16_t mTextId; + int mTextIdBase = HEXADECIMAL; + size_t mLanguage = LANGUAGE_ENG; + char* mCustomMessageBuf; + std::string mCustomMessageString; + bool mDisplayExistingMessageClicked = false; + bool mDisplayCustomMessageClicked = false; +}; + + +#endif //__cplusplus +#endif //CUSTOMMESSAGEDEBUGGER_H diff --git a/soh/soh/SohGui.cpp b/soh/soh/SohGui.cpp index 49f84068a..a295fed66 100644 --- a/soh/soh/SohGui.cpp +++ b/soh/soh/SohGui.cpp @@ -41,6 +41,7 @@ #include "Enhancements/game-interactor/GameInteractor.h" #include "Enhancements/cosmetics/authenticGfxPatches.h" #include "Enhancements/resolution-editor/ResolutionEditor.h" +#include "Enhancements/debugger/MessageViewer.h" bool ToggleAltAssetsAtEndOfFrame = false; bool isBetaQuestEnabled = false; @@ -122,6 +123,7 @@ namespace SohGui { std::shared_ptr mSaveEditorWindow; std::shared_ptr mDLViewerWindow; std::shared_ptr mValueViewerWindow; + std::shared_ptr mMessageViewerWindow; std::shared_ptr mGameplayStatsWindow; std::shared_ptr mCheckTrackerSettingsWindow; std::shared_ptr mCheckTrackerWindow; @@ -175,6 +177,8 @@ namespace SohGui { gui->AddGuiWindow(mDLViewerWindow); mValueViewerWindow = std::make_shared("gValueViewer.WindowOpen", "Value Viewer"); gui->AddGuiWindow(mValueViewerWindow); + mMessageViewerWindow = std::make_shared("gMessageViewerEnabled", "Message Viewer"); + gui->AddGuiWindow(mMessageViewerWindow); mGameplayStatsWindow = std::make_shared("gGameplayStatsEnabled", "Gameplay Stats"); gui->AddGuiWindow(mGameplayStatsWindow); mCheckTrackerWindow = std::make_shared("gCheckTrackerEnabled", "Check Tracker"); @@ -204,6 +208,7 @@ namespace SohGui { mGameplayStatsWindow = nullptr; mDLViewerWindow = nullptr; mValueViewerWindow = nullptr; + mMessageViewerWindow = nullptr; mSaveEditorWindow = nullptr; mColViewerWindow = nullptr; mActorViewerWindow = nullptr; diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index c2a300877..7fb93544d 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -28,6 +28,7 @@ #include "Enhancements/debugger/dlViewer.h" #include "Enhancements/debugger/valueViewer.h" #include "Enhancements/gameplaystatswindow.h" +#include "Enhancements/debugger/MessageViewer.h" #include "Enhancements/randomizer/randomizer_check_tracker.h" #include "Enhancements/randomizer/randomizer_entrance_tracker.h" #include "Enhancements/randomizer/randomizer_item_tracker.h" @@ -1579,6 +1580,7 @@ extern std::shared_ptr mColViewerWindow; extern std::shared_ptr mActorViewerWindow; extern std::shared_ptr mDLViewerWindow; extern std::shared_ptr mValueViewerWindow; +extern std::shared_ptr mMessageViewerWindow; void DrawDeveloperToolsMenu() { if (ImGui::BeginMenu("Developer Tools")) { @@ -1678,6 +1680,12 @@ void DrawDeveloperToolsMenu() { mValueViewerWindow->ToggleVisibility(); } } + UIWidgets::Spacer(0); + if (mMessageViewerWindow) { + if (ImGui::Button(GetWindowButtonText("Message Viewer", CVarGetInteger("gMessageViewerEnabled", 0)).c_str(), ImVec2(-1.0f, 0.0f))) { + mMessageViewerWindow->ToggleVisibility(); + } + } ImGui::PopStyleVar(3); ImGui::PopStyleColor(1); @@ -1967,4 +1975,4 @@ void SohMenuBar::DrawElement() { ImGui::EndMenuBar(); } } -} // namespace SohGui +} // namespace SohGui diff --git a/soh/soh/util.cpp b/soh/soh/util.cpp index 856432cbb..ceadb8b0e 100644 --- a/soh/soh/util.cpp +++ b/soh/soh/util.cpp @@ -336,3 +336,16 @@ std::string SohUtils::Sanitize(std::string stringValue) { return stringValue; } + +size_t SohUtils::CopyStringToCharBuffer(char* buffer, const std::string& source, const size_t maxBufferSize) { + if (!source.empty()) { + // Prevent potential horrible overflow due to implicit conversion of maxBufferSize to an unsigned. Prevents negatives. + memset(buffer, 0, std::max(0, maxBufferSize)); + // Gaurentee that this value will be greater than 0, regardless of passed variables. + const size_t copiedCharLen = std::min(std::max(0, maxBufferSize - 1), source.length()); + memcpy(buffer, source.c_str(), copiedCharLen); + return copiedCharLen; + } + + return 0; +} diff --git a/soh/soh/util.h b/soh/soh/util.h index db5af8636..827355862 100644 --- a/soh/soh/util.h +++ b/soh/soh/util.h @@ -14,4 +14,8 @@ namespace SohUtils { void CopyStringToCharArray(char* destination, std::string source, size_t size); std::string Sanitize(std::string stringValue); + + // Copies a string into a char buffer up to maxBufferSize characters. This does NOT insert a null terminator + // on the end, as this is used for in-game messages which are not null-terminated. + size_t CopyStringToCharBuffer(char* buffer, const std::string& source, size_t maxBufferSize); } // namespace SohUtils From 458970816fb7214c1893236c53144883a95d9cb1 Mon Sep 17 00:00:00 2001 From: Giantblargg Date: Thu, 15 Feb 2024 18:26:27 -0700 Subject: [PATCH 09/44] Fix Check Tracker Vanilla/MQ Dungeon Spoilers (#3723) * Fix Dungeon Spoilers * Update soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp * Update soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> --- soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp index a50a28762..81415f407 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_check_tracker.cpp @@ -762,7 +762,6 @@ void InitTrackerData(bool isDebug) { } } UpdateAllOrdering(); - UpdateInventoryChecks(); } void SaveTrackerData(SaveContext* saveContext, int sectionID, bool gameSave) { From c1365b3263d7934439700f7e27c71da67edb8431 Mon Sep 17 00:00:00 2001 From: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Date: Thu, 15 Feb 2024 20:27:26 -0500 Subject: [PATCH 10/44] [Time Savers] Shops and Games always open (#3789) * Shops and Games always open * Added comment for scene reload requirement * Prefix * Spacing Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> * I'm bad at merging * Refined by Archez --------- Co-authored-by: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> --- soh/soh/Enhancements/mods.cpp | 30 +++++++++++++++++++ soh/soh/SohMenuBar.cpp | 2 ++ .../overlays/actors/ovl_En_Door/z_en_door.h | 2 ++ 3 files changed, 34 insertions(+) diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 8b65cdcbe..9ae89719f 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -33,6 +33,7 @@ extern "C" { #include "functions.h" #include "variables.h" #include "functions.h" +#include "src/overlays/actors/ovl_En_Door/z_en_door.h" void ResourceMgr_PatchGfxByName(const char* path, const char* patchName, int index, Gfx instruction); void ResourceMgr_UnpatchGfxByName(const char* path, const char* patchName); @@ -1222,6 +1223,34 @@ void RegisterRandomizedEnemySizes() { }); } +void RegisterOpenAllHours() { + GameInteractor::Instance->RegisterGameHook([](void* refActor) { + Actor* actor = static_cast(refActor); + + if (CVarGetInteger("gEnhancements.OpenAllHours", 0) && (actor->id == ACTOR_EN_DOOR)) { + switch (actor->params) { + case 4753: // Night Market Bazaar + case 1678: // Night Potion Shop + case 2689: // Day Bombchu Shop + case 2703: // Night Slingshot Game + case 653: // Day Chest Game + case 6801: // Night Kak Bazaar + case 7822: // Night Kak Potion Shop + case 4751: // Night Kak Archery Game + case 3728: // Night Mask Shop + { + actor->params = (actor->params & 0xFC00) | (DOOR_SCENEEXIT << 7) | 0x3F; + EnDoor* enDoor = static_cast(refActor); + EnDoor_SetupType(enDoor, gPlayState); + break; + } + default: + break; + } + } + }); +} + void PatchToTMedallions() { // TODO: Refactor the DemoEffect_UpdateJewelAdult and DemoEffect_UpdateJewelChild from z_demo_effect // effects to take effect in there @@ -1353,6 +1382,7 @@ void InitMods() { RegisterAltTrapTypes(); RegisterRandomizerSheikSpawn(); RegisterRandomizedEnemySizes(); + RegisterOpenAllHours(); RegisterToTMedallions(); NameTag_RegisterHooks(); RegisterPatchHandHandler(); diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 7fb93544d..20b53fc89 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -631,6 +631,8 @@ void DrawEnhancementsMenu() { UIWidgets::Tooltip("The default response to Kaepora Gaebora is always that you understood what he said"); UIWidgets::PaddedEnhancementCheckbox("Exit Market at Night", "gMarketSneak", true, false); UIWidgets::Tooltip("Allows exiting Hyrule Castle Market Town to Hyrule Field at night by speaking to the guard next to the gate."); + UIWidgets::PaddedEnhancementCheckbox("Shops and Games Always Open", "gEnhancements.OpenAllHours", true, false); + UIWidgets::Tooltip("Shops and minigames are open both day and night. Requires scene reload to take effect."); UIWidgets::PaddedEnhancementCheckbox("Link as default file name", "gLinkDefaultName", true, false); UIWidgets::Tooltip("Allows you to have \"Link\" as a premade file name"); UIWidgets::PaddedEnhancementCheckbox("Quit Fishing At Door", "gQuitFishingAtDoor", true, false); diff --git a/soh/src/overlays/actors/ovl_En_Door/z_en_door.h b/soh/src/overlays/actors/ovl_En_Door/z_en_door.h index 5cb5a7f1c..7389ac99a 100644 --- a/soh/src/overlays/actors/ovl_En_Door/z_en_door.h +++ b/soh/src/overlays/actors/ovl_En_Door/z_en_door.h @@ -57,4 +57,6 @@ typedef struct EnDoor { /* 0x01D4 */ EnDoorActionFunc actionFunc; } EnDoor; // size = 0x01D8 +void EnDoor_SetupType(EnDoor* enDoor, PlayState* play); + #endif From 7cdd33a01d7b82d256164ca57933c4fe31d1c45f Mon Sep 17 00:00:00 2001 From: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> Date: Fri, 16 Feb 2024 02:32:17 +0100 Subject: [PATCH 11/44] Better ammo rendering (#3844) * Better ammo rendering * Update soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c Co-authored-by: Archez * Update z_kaleido_scope_PAL.c * Rename gBetterAmmoRendering to gEnhancements.BetterAmmoRendering --------- Co-authored-by: Archez --- soh/soh/SohMenuBar.cpp | 2 ++ .../misc/ovl_kaleido_scope/z_kaleido_item.c | 25 ++++++++++++++++--- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 10 +++++--- 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 20b53fc89..8b33a72ef 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1149,6 +1149,8 @@ void DrawEnhancementsMenu() { UIWidgets::Tooltip("Space between text characters (useful for HD font textures)"); UIWidgets::PaddedEnhancementCheckbox("More info in file select", "gFileSelectMoreInfo", true, false); UIWidgets::Tooltip("Shows what items you have collected in the file select screen, like in N64 randomizer"); + UIWidgets::PaddedEnhancementCheckbox("Better ammo rendering in pause menu", "gEnhancements.BetterAmmoRendering", true, false); + UIWidgets::Tooltip("Ammo counts in the pause menu will work correctly regardless of the position of items in the inventory"); ImGui::EndMenu(); } diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c index b04f07b38..18cfdc065 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_item.c @@ -19,8 +19,23 @@ static s16 sAmmoVtxOffset[] = { 0, 2, 4, 6, 99, 99, 8, 99, 10, 99, 99, 99, 99, 99, 12, }; +static s16 sAllAmmoVtxOffset[] = { + 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46 +}; + extern const char* _gAmmoDigit0Tex[]; +s8 ItemInSlotUsesAmmo(s16 slot) { + s16 item = gSaveContext.inventory.items[slot]; + return item == ITEM_STICK || + item == ITEM_NUT || + item == ITEM_BOMB || + item == ITEM_BOW || + item == ITEM_SLINGSHOT || + item == ITEM_BOMBCHU || + item == ITEM_BEAN; +} + void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, s16 item, int slot) { s16 ammo; s16 i; @@ -55,7 +70,7 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, gDPPipeSync(POLY_KAL_DISP++); if (i != 0) { - gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[(sAmmoVtxOffset[slot] + 31) * 4], 4, 0); + gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[((CVarGetInteger("gEnhancements.BetterAmmoRendering", 0) ? sAllAmmoVtxOffset[slot] : sAmmoVtxOffset[slot]) + 31) * 4], 4, 0); gDPLoadTextureBlock(POLY_KAL_DISP++, ((u8*)_gAmmoDigit0Tex[i]), G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, @@ -64,7 +79,7 @@ void KaleidoScope_DrawAmmoCount(PauseContext* pauseCtx, GraphicsContext* gfxCtx, gSP1Quadrangle(POLY_KAL_DISP++, 0, 2, 3, 1, 0); } - gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[(sAmmoVtxOffset[slot] + 32) * 4], 4, 0); + gSPVertex(POLY_KAL_DISP++, &pauseCtx->itemVtx[((CVarGetInteger("gEnhancements.BetterAmmoRendering", 0) ? sAllAmmoVtxOffset[slot] : sAmmoVtxOffset[slot]) + 32) * 4], 4, 0); gDPLoadTextureBlock(POLY_KAL_DISP++, ((u8*)_gAmmoDigit0Tex[ammo]), G_IM_FMT_IA, G_IM_SIZ_8b, 8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, @@ -764,8 +779,10 @@ void KaleidoScope_DrawItemSelect(PlayState* play) { gDPSetCombineLERP(POLY_KAL_DISP++, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0, PRIMITIVE, ENVIRONMENT, TEXEL0, ENVIRONMENT, TEXEL0, 0, PRIMITIVE, 0); - for (i = 0; i < 15; i++) { - if ((gAmmoItems[i] != ITEM_NONE) && (gSaveContext.inventory.items[i] != ITEM_NONE)) { + u8 gBetterAmmoRendering = CVarGetInteger("gEnhancements.BetterAmmoRendering", 0); + + for (i = 0; i < (gBetterAmmoRendering ? 24 : 15); i++) { + if ((gBetterAmmoRendering ? ItemInSlotUsesAmmo(i) : gAmmoItems[i] != ITEM_NONE) && (gSaveContext.inventory.items[i] != ITEM_NONE)) { KaleidoScope_DrawAmmoCount(pauseCtx, play->state.gfxCtx, gSaveContext.inventory.items[i], i); } } diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 5f8da1b70..059a845c3 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -2703,6 +2703,8 @@ s16 func_80823A0C(PlayState* play, Vtx* vtx, s16 pageIndex, s16 arg3) { static s16 D_8082B11C[] = { 0, 4, 8, 12, 24, 32, 56 }; +static s16 D_8082B11C_all[] = { 0, 4, 8, 12, 16, 20, 24, 28, 32, 36, 40, 44, 48, 52, 56, 60, 64, 68, 72, 76, 80, 84, 88, 96 }; + static s16 D_8082B12C[] = { -114, 12, 44, 76 }; static u8 D_8082B134[] = { 1, 5, 9, 13 }; @@ -2825,7 +2827,7 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { pauseCtx->cursorVtx[19].v.tc[1] = 0x400; // 24 items, 7 "item selected" backgrounds, 14 ammo digits (2 each for 7 items) -- then 4 vertices for each - pauseCtx->itemVtx = Graph_Alloc(gfxCtx, (24 + 7 + 14) * 4 * sizeof(Vtx)); + pauseCtx->itemVtx = Graph_Alloc(gfxCtx, (24 + 7 + 2 * (CVarGetInteger("gEnhancements.BetterAmmoRendering", 0) ? ARRAY_COUNT(D_8082B11C_all) : ARRAY_COUNT(D_8082B11C))) * 4 * sizeof(Vtx)); for (phi_t4 = 0, phi_t2 = 0, phi_t5 = 58; phi_t4 < 4; phi_t4++, phi_t5 -= 32) { for (phi_t1 = -96, phi_t3 = 0; phi_t3 < 6; phi_t3++, phi_t2 += 4, phi_t1 += 32) { @@ -2915,8 +2917,10 @@ void KaleidoScope_InitVertices(PlayState* play, GraphicsContext* gfxCtx) { } } - for (phi_t3 = 0; phi_t3 < 7; phi_t3++) { - phi_t4 = D_8082B11C[phi_t3]; + u8 gBetterAmmoRendering = CVarGetInteger("gEnhancements.BetterAmmoRendering", 0); + + for (phi_t3 = 0; phi_t3 < (gBetterAmmoRendering ? ARRAY_COUNT(D_8082B11C_all) : ARRAY_COUNT(D_8082B11C)); phi_t3++) { + phi_t4 = gBetterAmmoRendering ? D_8082B11C_all[phi_t3] : D_8082B11C[phi_t3]; pauseCtx->itemVtx[phi_t2 + 0].v.ob[0] = pauseCtx->itemVtx[phi_t2 + 2].v.ob[0] = pauseCtx->itemVtx[phi_t4].v.ob[0]; From db958ab3f45e6ab34d13ee82f6dd53589f5c3928 Mon Sep 17 00:00:00 2001 From: Ted Newman Date: Thu, 15 Feb 2024 17:37:19 -0800 Subject: [PATCH 12/44] New input viewer (#3890) * Move input viewer into SoH * Remove unnecessary comments * Update button outline mode to match default viewer * Fix ambiguous call * CVar name changes and minor fixes * Two more cvars * Separate C-buttons into individual toggles * Account for text height regardless of scale * A few extra comments * Use new LoadTextureFromRawImage to load layer textures --- soh/assets/custom/textures/buttons/ABtn.png | Bin 10967 -> 1485 bytes .../custom/textures/buttons/ABtnOutline.png | Bin 0 -> 1818 bytes .../custom/textures/buttons/AnalogStick.png | Bin 0 -> 2206 bytes .../textures/buttons/AnalogStickOutline.png | Bin 0 -> 3677 bytes soh/assets/custom/textures/buttons/BBtn.png | Bin 1300 -> 1534 bytes .../custom/textures/buttons/BBtnOutline.png | Bin 0 -> 1878 bytes soh/assets/custom/textures/buttons/CDown.png | Bin 11241 -> 1285 bytes .../custom/textures/buttons/CDownOutline.png | Bin 0 -> 1544 bytes soh/assets/custom/textures/buttons/CLeft.png | Bin 11232 -> 1291 bytes .../custom/textures/buttons/CLeftOutline.png | Bin 0 -> 1544 bytes soh/assets/custom/textures/buttons/CRight.png | Bin 11284 -> 1336 bytes .../custom/textures/buttons/CRightOutline.png | Bin 0 -> 1541 bytes soh/assets/custom/textures/buttons/CUp.png | Bin 11219 -> 1305 bytes .../custom/textures/buttons/CUpOutline.png | Bin 0 -> 1546 bytes .../custom/textures/buttons/DPadDown.png | Bin 0 -> 946 bytes .../textures/buttons/DPadDownOutline.png | Bin 0 -> 984 bytes .../custom/textures/buttons/DPadLeft.png | Bin 0 -> 929 bytes .../textures/buttons/DPadLeftOutline.png | Bin 0 -> 953 bytes .../custom/textures/buttons/DPadRight.png | Bin 0 -> 922 bytes .../textures/buttons/DPadRightOutline.png | Bin 0 -> 954 bytes soh/assets/custom/textures/buttons/DPadUp.png | Bin 0 -> 968 bytes .../custom/textures/buttons/DPadUpOutline.png | Bin 0 -> 993 bytes .../buttons/InputViewerBackground.png | Bin 0 -> 941 bytes soh/assets/custom/textures/buttons/LBtn.png | Bin 355 -> 1031 bytes .../custom/textures/buttons/LBtnOutline.png | Bin 0 -> 1089 bytes soh/assets/custom/textures/buttons/RBtn.png | Bin 379 -> 992 bytes .../custom/textures/buttons/RBtnOutline.png | Bin 0 -> 1074 bytes .../custom/textures/buttons/RightStick.png | Bin 0 -> 2150 bytes .../textures/buttons/RightStickOutline.png | Bin 0 -> 2407 bytes .../custom/textures/buttons/StartBtn.png | Bin 11868 -> 973 bytes .../textures/buttons/StartBtnOutline.png | Bin 0 -> 1031 bytes soh/assets/custom/textures/buttons/ZBtn.png | Bin 1241 -> 1005 bytes .../custom/textures/buttons/ZBtnOutline.png | Bin 0 -> 1069 bytes soh/soh/Enhancements/controls/InputViewer.cpp | 519 ++++++++++++++++++ soh/soh/Enhancements/controls/InputViewer.h | 47 ++ soh/soh/SohGui.cpp | 6 + soh/soh/SohGui.hpp | 1 + soh/soh/SohMenuBar.cpp | 25 +- 38 files changed, 594 insertions(+), 4 deletions(-) create mode 100644 soh/assets/custom/textures/buttons/ABtnOutline.png create mode 100644 soh/assets/custom/textures/buttons/AnalogStick.png create mode 100644 soh/assets/custom/textures/buttons/AnalogStickOutline.png create mode 100644 soh/assets/custom/textures/buttons/BBtnOutline.png create mode 100644 soh/assets/custom/textures/buttons/CDownOutline.png create mode 100644 soh/assets/custom/textures/buttons/CLeftOutline.png create mode 100644 soh/assets/custom/textures/buttons/CRightOutline.png create mode 100644 soh/assets/custom/textures/buttons/CUpOutline.png create mode 100644 soh/assets/custom/textures/buttons/DPadDown.png create mode 100644 soh/assets/custom/textures/buttons/DPadDownOutline.png create mode 100644 soh/assets/custom/textures/buttons/DPadLeft.png create mode 100644 soh/assets/custom/textures/buttons/DPadLeftOutline.png create mode 100644 soh/assets/custom/textures/buttons/DPadRight.png create mode 100644 soh/assets/custom/textures/buttons/DPadRightOutline.png create mode 100644 soh/assets/custom/textures/buttons/DPadUp.png create mode 100644 soh/assets/custom/textures/buttons/DPadUpOutline.png create mode 100644 soh/assets/custom/textures/buttons/InputViewerBackground.png create mode 100644 soh/assets/custom/textures/buttons/LBtnOutline.png create mode 100644 soh/assets/custom/textures/buttons/RBtnOutline.png create mode 100644 soh/assets/custom/textures/buttons/RightStick.png create mode 100644 soh/assets/custom/textures/buttons/RightStickOutline.png create mode 100644 soh/assets/custom/textures/buttons/StartBtnOutline.png create mode 100644 soh/assets/custom/textures/buttons/ZBtnOutline.png create mode 100644 soh/soh/Enhancements/controls/InputViewer.cpp create mode 100644 soh/soh/Enhancements/controls/InputViewer.h diff --git a/soh/assets/custom/textures/buttons/ABtn.png b/soh/assets/custom/textures/buttons/ABtn.png index c1b06571c3a9c4427420bcbccec364f28c7c4778..031924cb963fdd399db122ccc7e584ab77d0b782 100644 GIT binary patch delta 1343 zcmV-F1;F~(Rm}^3iBL{Q4GJ0x0000DNk~Le0003;000252nGNE0B$K9FaQ7ng=s@W zP)S2WAaHVTW@&6?001bFeUUv#!%!53Pg6yaiby+%C}gNk7DS6UN)?M>p|llRbufA9 zA2ex5Qd}Gb*MfsTi&X~~XI&j!1wrr!#M!|~(M3wUFDbNti1EVXeVljC;l29+p;2L~ z*)<8Mnq{QoF)^E46?M=HVZ9 z{7G`jl~*K zK!#?ud;=UD0^>!>UiWx+Z|B_p?P<;L2fGS##JnSrc>n+a24YJ`L;$4#lK_}N1-3?$ zY#JVa=m8!VD-Ej64srkh02y>eSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{ z00X2+L_t(|+U?z4QX5wg2GDMW>|?|NjH+xuBUWOx5{Z=nD?vP4sSP#!yf^heqPj?KqOd%3C2`O5=5 zn~G>MqKSy8h%O_#h={0M#whNeBD(c@+}SyVBS#yE8F~4ge`1-Lw|_<~1tr3fBMHTt ze`$t4sv^2k=9Q2{I5J2dChfGUuHPyYUu%+)d9_-Pmv&n?!XUgq`{Vit#^?W8C3EpK zid!vGI6}XF8{^sIT|`Xx{BM^}nKJ9K>j>Nwtyix zWH4@9MDt74-DJ`>PD41t&pb-M8jvTO_#_~OBOE>$-?j5T1moWcS&NfRd~!0!&oxK- z8;p~78dZ0_eBxxzKCj0&PDyiwy{nh&jJ>p}nj5cwg(DnfoZjIZyx(HvYK+&y5e|?( zwdj4b&AQYcg(K{>H4Y-bBbs0Pbh8NI$kDgP!30iK8Lf}?VQ35JlkF#A+99p^DRbT?J=u|Q_myK5%%(mJ)|*p>BNL1>?a&EZwIs3O5td% z2BY;?xfs#?_Ha6OTACy5?^V0<#v0KaVPNflQESv3K{I=8ZJ9GCBpl%&R=t>I^?2!ojMZ>ZAI=`{qCdaWvRpl!UN{xu2))pU>yNH88mpmqo-;2F`Mrr1(LHBs zjG7}Dv5nH2BMips;q+p!H)$#tf>CpX;WWreJFTkgU0sK)h%Pf{?n(5l9?oj*}*o<`P^a@ib^rtPv)@AHnvn$N;wrusr2YT$s_f2 zkjmk$=y9k>A%`dwrJ~SD<^BD}7)j}U-~YP%Y`YKF_5EJ=_r9)szx5Hh%)wS#Qb7_1 zgGrN?SUG{8aOgGV5AdB664C>MO(_j=apO8scyJb*=}q?s;M@%?01oi!-Y^)y?#uyt zLIZL7_Wtf!oXLS=2U=LMe7&TWa*2c$k6vY`yxOH zTk3qfm>DU{ECLgwKPNlZ7QCC<#|vxNT-c9#f2VJ2%l@{P2h#GgGHY5c#5eHT@}+slvE|m<2Ac_&9z}jq${}BA>LPR`_Y{0&tIDRS zXty3Y-1upI|1;{=nzP+ODOw&e&Ggo~5T^d~Bf9g%J~lUYd^SoE?@=p0tJO{IX>v84 z+*Gx(sb8jyPc1BRRCfFLBtHz*VuE_vH2ccg85x_!yOG6yvANYoja4#{KDjY<*R#*k z=RTZrrRl8o?n2ibhrY%0Kc04!c>AX3R3LXvrg$RYf9~eWYcCtx7>0}f&|BO5(w!ID zRAzFe`KoL3wgtggTBDUs!aaERx2)=V9T5GfV}IVd%Lfy80_hj*z4bm9=-)0d{(Sgm zW)4C!3Nhj`t;KgGYRvu}m9sTohp&8uq+_`D zFfZW|^+-;8520?dj0HjMoJRhnl~X2#ITf?gqYl6k%M)m-*1kO$t4PerbcE|(M-@_( zMq2XHjM}z1wSSV?chzc|qin^~3KN#f-!GTq=r#TU~!U9V z*s>MTtG_(ju>D0{W~j6nX&)|7v)$2kRrF1JFI_KryH{DK3rq9^XRcwLez0{Kd8M)) z=Wh9j_6J$9j~mMhWe+Z%{WtbiOm-^1S(AQyQIPcII-kv{?P5NO6%w5i+j2Iokv=uW z;?T-78!gr>BKSv%hi7VgP;35zua542;s0*O1H=Uzx>{De6P+rziLP;xl$$37?@S8H zU3KQ;=2$T&xhz9J8wZ))ZJNs49~VB>gY82!%1^1+3NFs5QYcP-+fI-s8JbXaq|Yh+ znXVFE-~77OJ${v`>E4TMj3RYGlSO@g(Yz|XDVH}XY>pxxxNJ^dbZg1kCkKNh^c4cH zGE5`dI%-prPw@F}OW~GYT^B>^ieq}DPGkG#CrT+is=~V6yJTYcvg^XCb}VAm7SEj< zwynEbP+0n`WA)7{`GhrjXKJ0)*E!iHE9CAtB~8{S1KwQ1#oC15>J+XZKT&3(xv$ z8>Vf4_Q`GkQK?kZxeu(0c50D~$$4aMOdGw-g07@=RbwytEUGE@t%tE~$I1Tg^qQ@4 zEAF>nSo7Scbbq*8dX16XX|e?;@Y42-xD#*qTk)8$h2|WcF4Fbn-2BxN`)B(bpopQL z{|>WIR9GmZ5-xw>MaZI!z)6OTG}BK}?_d0g5BCP?oXCjtfpZvuEc0V;fGA}PwH+?4>z};uI89utm*PRw{ne*HUwomrvoc zdUVfZ!lEg|LYQZ@n}ha*qTM_Heb19Iy7mckOUMsCl0xH3X3tt9kfI z9kL+kHaX?psjCmVCmUpb-#pYFVODbR+`h`lC>6H|xX!{CY2m#Fm3PV|w@=Y}NK9eX zxQ8yf_|Mw=bR2#zAQ4WpZeMu6xpr?R-(VvuAR|h9(}%m(j|}uKOeIeZ)-~@X``D=k z*Ew29A>;hj>x-kB+s*XwBt6ofPH&?ZJ_|=q7K4*ADTJtk20&ld)Of}rHv;Lud z+v0h=e3wsB5w$@QR>2RCzDZLpZQw`ldN||ljYpQ9U6EH`Rn|9fYp|XBvzhsuY4uuV zQLl?D$ukMpo+!;vIvULLW51rYk$ydP4l%c>J8?lmM|h@$&&Aj0mFLyuU{+b#T+MC| zexJXypY+jjhvwJSOJ5Z&?l`eS_T|!yn*Kfhf%olQ9PQ6F{i!@HWOqM8lKAJ_Ow{er zS#OsaDxXp)q@P=R7qQl{D>grnSbq0~nPX}CJK71w zeG$9Xw%XL&)V#i2s;cRup_tgQ@$tN-jy3QuOPg0Yce;pTg-nEZijX1s{?eDNdH?v3u9W{0Jy+-1vA79MEA649+d2HIU zt}yA-lF!xia2!qhgxabXIrC}{;$H2!+8ElKX}a%tO0x9IHww2uD|c$}7Q~o+m=8YO z0AoJY&{(;KobV-Vdx7)&~a=N{IUyOA5o1huW9-RoIvc86t6SgG>rMe;uIre(m&C<;W$#!kI zj`O{&Nh&7l3-sEz74C6Aur{>Co#poUpo;2|WcBH?(K`tH>yzZA6ZwbqGt(8GPMdc? z{_dLODt02iv&3WWZMv35*8TZ5Qg*vk#bmJ=i;qc7lUvR_Cyeepz@{dp?8q*Zfk zJXK6SJ#N0~2j$PNt8Y7!uad4WuK4IxudHh3ImhRLe_!9jY(@1g{qu4vSASiql=Nj` zUUlUSTeD6AEAUZetMOyD#N17lYL@JUreu{AiN^Bw!{^PKkQI5)-c>jJ^ISacWY&J> zmT*hYi)OVQ3p!u>cD`!Tz4J8`w&@7_uh6;syI`;xE9l^JtsB{%NM#1-P-sjqK!+c| z0#gG9Gcx6~C{#ay3-Nx86(`t%ixwwHUP)z;B?SPYd$>~ zi!hOd8?kBLL?&;rTXz~EB& zNCrn0f*8QC0ytDQn9p=30}f$QyqG~;V*~24TCkF|ju>hXKrJ+dR00-^| zG(cg|XniCai^LkBME${4GI_|G!5LH$)Dy+0uuvEsG%6rqga?Of9X!l8rU%Cb{CRfJw1RW@PMpE zEosytJ5~_eUtmL{q5yv&01Si!B4b9_gZ@JfV{S(PE)a@n#iRy7C?qRm1QY;~#-!3| zL_ycvfZ$Eg^9EHW5HLs_9s?k~2;K%rfaZm#8Q}2VGy{qV6p6v%QW#VKf&#&H=pc@+ zE`Y<~000Sqo=6-9@Irb4R2mY4#~a|#RBsA^ql!Q{vgu%IQ~X7vf}m(1lmP~V#bD5A zBmqYtAaP!33Q`}VuZP6r^r#pb1?!C_=n9}9VTtC;NX7`P4tjWInLmZ=&146F^+IRR zm^{w#k_$ZmaOP4V*)Rkgo`6T|V{m8!xJA8Tqm=-g1LiG+ib3mO^aU$4D$xeSq=5ND z51_0EP%OrJ!2%dH(UJ{NxJJ$8 zWj#tTG(wGM{0)+`50l6EIhA@y*89*t&z(f8KFk3{D%y}3LJ z8!%rFmJxW)U=az<8NPTh&ooBb^Lzj(iO}FR3Ef`0E*Jt4qf6AqAqGwxZiIraM&WLa zpv!|yCW`7|1YIsf5|nVxK`fR(9bk{tNtid^u@mth%+VjYi<%91TQXT2z-sm3I`SCf z(vM*{fM8Fj0t^mwywF8W24oTW1_5Ipm;=9=z%M$~&^O&+mOzE{e{6%<_kUynp?{N1 zNZ;Rb{g!J&3QWlOcXs`jYeEW4$oO}5{mddXx^#4;LKFkl2sfSY}!odB?dc`JQtjl;F8GJ63-^hk(WkXZ$;a|U@}@HD{~jO zsbX-MrcN=?ZFE@=RK%bHqZh})8Eff>$1oN?__rXi9@sA)!I!bZ_@%jt z2QXTGh!#2uF|Z_sM=>Ilv35Uf00saVjBhk-4)y*QyC3G8JQ92YBj^?!YTvt%hKYtu zM|D62g!i)Wo*rc(Iuy#^52_&g5~ug7bVr{Sre&!ek$-lRID3L#T41fy*89@aNpxqaOFKG8gf=7Wd z%20Sdpp9r77gQ*#sKe;KkbLC)s0R|^_cVH>)tIB7A%z@8?V#O5?cNaYP-kEPdKU&U z!S9D*fWe+9F*NlpIW#-Q5kS*W8x1fp`{Q@WZ?vzF{9Era6o8C`DnNY*>_h2ATcKu*FD7G> zWb#FBOL7?%Dwk#qgKD>0BqkBLl&oc$*iXOiU+_JT$2pJpdA=X#ydIDDdA| zy9v*o-8#*UTNx`o(;20yBa*Hypxh^{Zq!P#ri5Dg&eHNG8F8K>={1sv^fA>gMlaStK{Bq*)wI4L5_A);d$DQoc>N|3iJDkR|?sL25nC^)QdnU(3J}~Q$ z3LeZgJvrj!g0k`g_4l*1O;arnX_%bhSpQn1Iip0njuysPQ*NiX>QzGjD*W>tSqUk#Yy8R6WOCv9#X;@RIl^^i z5nI}tq?b$%#&*QR9*Trvz$P5;a0MH6|%q7fbVR&WcA6%u3^#%6I{isXWq8rW1yG;jYxA=|C4-dQ? zIlp|zRu)qGKO490UZ6uKOa0bHJH>X`M^iSY@ZMZ?7aWIyGALm%jBJ<=>1mAU$QGaJ zVLfnk++N(@5+cnZL|)jo4c9k<=PeS9xGXAlBkN_+(n(~>U~lEmGM~@0&?-|?QqNGjpo9u;zSu^uspS{ zPDh86@byiosZX4|%?44wgcns&4?$D%3eoIBnTWEJ@m$)EK@{}BQ|^UJt0oom>(7Bz zL726#vPA11Pq|af=)^lJ_fGkPKz_^wmxM=Ag#<{ne>gtLbS&hKA{G6wk-` zjTmhSY+O+wOj%FS(p&R0ikkiV_2`_ycPwOA`^85l`FkzMwQuiC;sbn|t-udeL4N+& zKRHrkD(kM4ZHk6eK0h-BlOF86=>Zv zi$>W9GHNw)-Tc5ntn{We4>-e?7@PMShBep)^M3@3LI(S@AV1k#x zZqn=BfBW8^tSaPN71K_+K(dLoLZyZl<*bVMES1LvXr+cDUt$*u57TTj*F#lMJ#1`y zoI)urP)&Rn`-hSQHgf3M7>fEz`({(v=|;4Awn5Uqyc<07aZR4z8tL`4P2V}tHs(|GN1Z14r+HswfOk@uYJ}H zFNXIDcU}*#BtA;ia%cP}?=u(u7b?1HQm^IZA_uxOhSRyYc=@2YT*Ux9rTX%(AI})i zob%nna2cp0BQz5|$W^z#d6&a#R~CseJ3neo-0y%~@%UPLkgAOtOT@h%kTVlmkZJA+ zm-JKG-&p2*v8kQW?5nKn87K8ia-+F;Eg0_KpVE}wwoJw?k=(hYfxF*w1ZPiNqhsjh Fe*n=C2|@q> literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/AnalogStick.png b/soh/assets/custom/textures/buttons/AnalogStick.png new file mode 100644 index 0000000000000000000000000000000000000000..d3fec7d015eb293346187db09fea10407ad7cf2a GIT binary patch literal 2206 zcmb_ci#rqQAK!?%#3r|4ZFAHwmnE05>bT6TF}b9edu5HEilNOdj!sr9mmwm#)ei?- zE};o2cd?Mel9tO_B4Soav2@n&Z#eJsyzl#cKF{a*yzl4vzMuDor#oInNmmH~0I0Y) zJ9z;BK)kfBSCE&kkw!2xDR4C$i}iHDVv$iXl+f@CWB|Z0CppK~xyMuEs>cajPMY(P z>xO5m-L;(3(FD!()AyP+{b^*8)GP(}b{`JH{VfZUDC+})=aT?%#%=17|9 zj=*^Pa>@{}E8s3=xFld1Rt0vr7Wyzr76y|M;)a4Z;^Qa_Z?;#$hee=vrI_Bw2H6SH zzQ~8T;++7MfLy?B2RY7BDWVwV>~|3WP*(pnfq*;3P$>way13y$i$J)x5qiYAdRz+W zP;tIgEF~g>97zRWW5{Qy`QaO!`Nco#QM;-9M8Qgxb(6Xs<6>y_!Q2>vrTXs)nQ z$r&VwZ3t6z&QqOXBV)n4?gkVW0azgJ-V1X1z|@6gP1H0-DceHSFi~ft7Cy)f$=S5) zbU>=T$c9QjAx5I0GSb8Uh2hX1@4oLy(eS6?P)m2C4i$YmlmvH-mk@ajAAU+z9t$eO z5^DTWS|&mAbP`1-x+6Fx!#sEb_-&UrAza7tk$N5y)(*Q)#7hc|=?z1TA3rDA)l>IE zm<#ZXxTThM_;j9%u5xITeA9ADhRJe z9KrIb=j_UeO;aeaK7Bp0WYTg3`2NpRezuX;dOhbMOb@n6P5QO^f}o_Kir{b46RYC07COsmNLau_Z!f=mT5Lg4 zVthwaVum>jjzQbi)TH^xejjUZTjBn7c|sF|w!Y(DrR|0pn`cF5U3{iei$QY|W(Qc} zqNQlsT&ryNgJ|dJD*Q@hZ1T5WgPWa&4AOXZBCkMsCdTyIOC;iIR+rbS?@*8}=_$5ab1qPMO`G zT>d{>Q7W;(Cfk-r?f3=zLRE@sXzSXrj~@(ZB5O!{9{4T(uT3#_9MX67BvKJKMv zXwsWCL{H|bLU(jkU&z==+xZAl)9Q=t%}t#J)oNG(qd;it@qFTz2-h>|8l*-iu~A&p zBGv$u6viGH4!t-XGg3ywL725mI(%{&YoKk|Z6)|lrPK^%{gtmvAGE$bHivH<>}{Yh zfMpN#3)ZQJJ649|>iBI<=Z+Z#)#zf-aDUr6$Iqr#LQdhVx>EmgzJThB()xADQ5Kxv zEex?JEdIE|?Z=+yxbY36N^l#Zxb9<~9x;C&(IaROD;7dYb}-f1JaU4Uh*Os;Zrcm3 z*Gj*Nn?=G-X=KMqqX5>IaD>Y?=KbO*^veF5e^bEg zPob0ShAyCyu#`|wX3uuh^V&b5j*l*SNSXClVw$EhP7o-hjD#Q2+l!O{pbrhQ9i*mf fE&DJ0>m6TG*pl|y5|BpPFEtmOyHlOx=_~&Lon_D` literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/AnalogStickOutline.png b/soh/assets/custom/textures/buttons/AnalogStickOutline.png new file mode 100644 index 0000000000000000000000000000000000000000..e4d8d71907601d74393ae9514df947db71252e19 GIT binary patch literal 3677 zcmb_ec{r4N8-C?5L^PIT8%t7ICu7T$-Aow!RI(e}SZc`FBS|MAjf5Hd+9WYz>`Ula z1~W*B<4j1_vQ-iyeQ)Rc_xt`k&vm`ab-&l|{XOsdJoo+F$#ynoM-EFK1_0oQg*gff z032rE{WBhJ@EoKBQwM=N0j8#Q7N(|h*NDORfUCX$pqPFmUEjRhPUMd51$26f`MD%T zpC>lIqweWqMDO8B>P4Ny)uTViY6X~MU13}k3AYXJU4n@Dxk^V9fuP9EE1 z*5P8aPSZDTI&?lfBk@i+c_}-{u}7*$GmktRU8LKCd1w-Aqv!dOD_OP$-nQS@vRu=p zX?p&owk=Hl_j}T+k?JZE$|0G$RZk=r_?#%B!!G%6F!vkQ2Ry|4uc!o6zm_zHS(?l7 zLNx*v%MS5D|JKG@JzCaVoRy8(w;&G8E8kA{=D76a0nBhmcE6D3lwC;7ID{zP>uogb zi!XF5c4}JN@MZ@U0tbHYFjw{}kKn##e7)|%C(FUf?&=M9$=Hr(O5>I-DEtHI`}KdA za6}oF1rKt(a48NRDsWkWl?xgr;u~T)VX#AU=t1}GsL0@@w+CwhLmQB`!^EEU;}4?2 zx^R10nxOzHkO5>HaW$R?5#DR&PN4w6C;aQ+0CMxiK@bvVVU30?bI6D(sg-3}>4K0% z7}_z+G?+l}4GIHHiN2m;zCLo10b%}fW){|Vmv0G(0RX?21P!nd#tX>H2fpQ0q%ikXnaWA#qx%<*qV4~>s&iUX4;T!oVzF5BkIT#X zFck^o*Mlc;nXRP_0u(a&&)(i%9aFAin3)3=8;wXQ9aaqqO^a+(k-z2Zd%FRg_<{kQ{Mg@ncg$Hq)qzdoU2H>wS-QHgG}t*sP&RH88T$XUS^B)f6u0!9=)Zhqmu`z+1$&@;Do88~3(;i7-xE=I>9HGU$f4=Ix;1h+6I*a% zS@1TjN@;C`z@GMXa#(U?4Y+GUp@UHIiJUS5`o429CuV2tQ)SYeo+k`%NA zb}J+gncE#6mo};5rVX+BsWUjsZv2s&V^O&J<;Bb4rOlu3)MblpGn(S`Ymg*_n5H*u z*GmK%pe5PayOxT@ER2tjALh5mu?9zB>#xF<^aXl%?2O~`PaX%3JCjIru!q^29+_D0 zCW_9icBc>hkh;KvKm0sbd)#z@!<`PF``FCn!v= zcF{D}`}l#QU5Z)We{u{pac|MRf8glNSsJE5w9g^A3w&LIqMV`!;iX8&E9?jRP*;yQ==KB~(EP=U!oJWxmS6KTmgeaqk z47GSqRYtS^m^|^Omsf%`A`Pd}TBP9unATL0Tn@OvCePZ*$Vt_mkrbyA!(dAU=;Y{{ z&T!efn~B3Yt3Dv{>Y{klYTMXVozCOmr?aczRF-&`9N8OeMSE1M`?TRK-8Cuw!Q`2Eg`|O1o53m$ek^hrl(+Zf7+6P!n@I#Z0~v1&XMFhZAtCAN zdW1{c6yBo1-XtQ=dJ*7mfeFJa!y`OBXHUtG^!Y^U_<~>wjJfc|fVMTAotL9+&>@E( zc;4g+-#9LVGh&X?t4vror=>tnA75w8?HwR#TlcjlIhR9`4wY}zgzAp>(N*#HSGGAs zD88fZ5P+Mo$OB}~nc5WU?Rq5d+Nh?;56?TE;&tL))Cbi4H5tvD@mbh&(hQ{4+cZW< zemAC~Ab<{02Nr(GHAtbJx2)CApGCb5Vym_ChL}B^{Qk%kg~EXlpNNQWT>oUP@GEO7 z3>0t^XbXF-(G|{EMU?%qx}MA8;3p#CaCqYhJcHkl=tFtnhSPwk_b({QdpSA0wZd1f zv~CE;oIP1bQ>x=u_g`>)HgQuVeRC>kuF3Y5W&djXfMl0?rng^<*yhF__*+y^Gg29E z4l*S;#m9(WZ~Wwgwn)^8%(pSzXNq^Kf^t(i_$OKRD1~o_Xke`qe$_ffsg6s1c_I4~ z`;^q>%a?c8KSQm~OI^V8;a)OFH`_hX^I@!;LFDnYgKNpm<@$l&yB@$R(MqCC`|P#W z^}KejDI{r=oV03_qZIF{WHz!1Pw9V?o#*6SUZm}=opVThk*L)=99BQRF+4Oxm?P}8 zwY0PloL3@W`|#p;m?6>8NRjjyx1xAoM9ivwM$Ab|pv;a$b69bIJAEmF^|de=tL)$4 zylu`SUf>)4%D18MvT{~rl!}bH(^cD?WAUD9W;5HJV(HcAg#KRBv0O3p3mNs{!DSAP zvSQzp$04BlX|D$-64-5-SjcN12=2GRT2O|S<(t|JpuZU1IL9_z{`dzX#wI9<8%m`#|AbxgxP6~B<` zCwaebg#QxmE9H&F5_jjK?y%I{x0Bfu`+zHX-*piJskNenV(p-B<1H5NQdsP-gIzgpmx_zi0ZnW)bw0jC zIbyc_$iu_61aQz*COngP2rP)N^dt-CO@NaH&;1RXXzlvi`L3|AurbZS<%ZBmtwW`C zRdsa)KDkZv>igF5v#h1f*@_G0>lz{)g9uSZh(J!a`#;73%3G>PtIvzp&4$uzBI(~nhP2Y?>-4vq8=LAG#F?Oi-o&xITIDcCBsEEASQ!YhDdFy5p%v`7- zVY|jjNA|yNs%usJ{TUBnu=XZ~`s#5-MMZ)Wal<0!Ca8MDwRiBgyTkmpb5E20U^1D< z42urikvJLQQ=E%JI7ZI(&=U(RAsR_T48lcyt z({Tj>dIsOmw#noT3n~MDVpx61HH0Ejc(4azbYLnU7o)A`1`|u$#3KOe+d3? W?mz4GDbwrMD=pAAsA>~j!hZk&QN3UQ literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/BBtn.png b/soh/assets/custom/textures/buttons/BBtn.png index 99b1197c9982d8d2027987f6ae578a9656db2d26..8e2fbb54b5345f3d11afb2d62e2361d982fdfbab 100644 GIT binary patch literal 1534 zcmb`G`#aMM9LK*S=F-JNZgV--g;jFDm$3ESrp81r!)TF-ZD!@V2$f4@Em3pL4o=9a z(2;tu7ILcy$EA}+E-i`L=-A=tf9U-@@6YpoUO#-E&+~kqccup(+@_?h1OUJ`EC%HX z01$99*DJ_xPO357bQ4^rxVm~^U0n_63|bf^G86!e*ev#8%ySR5%kC%9>@18!hS8a7 z{4P|sElxc`~_v?f(EXA7ym0v&+`_f~&=sjUEa!zBst81h;!Q@`1yMcUCk_h*}h>#@C7 z?r_6h*}4Z}P4{adqi@>QR%?G$_A5~DCl(FiavHz9Bx!b?+fTVasO=1Q!x$*S%p;5{ zWRziJR-VUsbB;4Y{R>ho9dCPap2%5A>Cp|I!xn6P$(A;xyFlWcDrnu1 zc48T=ub3!;SM4}@C9E+?77mx0LU#wP#KqEPC)O7zeT&c*C5GTBA}@aPFY>3|Kosyh zzyS)6$~7I^B#Ly5Ukm^!tNt_uxKpIL3875v2{d#LqNlN6#-5=%wTZNtXkVr)Eh;LM z$^={)p&`uBGX}8~X1D=}J>lVVX}bmh$PQsq&R%h23-1Vc9Z(bcl{QRBN9I`{ZkOyX ztU}Tj6kSXJv0{qqUqYEeqNRHwH`2WgCy~wiP<$jEW1McZC+?YO{i6HR;A0jQPVa3V zE&sgmSF6q1tujU58{hMZj8aE`t_tuXOd}ayFajFIdOY|ke6XrCTapm{wzn6~XV*2X z-FL(q=O8*)6LR}U!bdO4|w3Rpy$}kqC`6;{@lQVIe z*OJ$hV6awkI40js`^ii%JGnVApsFC>pZcwxG0k500zuXp93+#@Lqt7rx>;U%vt!p* zAqLFk?6^9(zT++*ZToP~L2;f}%b=$?gN}0hFTc2jCRE9#Z>Y63Blv9bVrszcEh@Pa zHUj1C1?CE%y+Qa@4_sOK z_tIT)_m*^oNPIe_KqtE*EbOC7ZmqWk@Dc*yPaP?9t9;4@I4XUyqdqIK50YQQ(RK5 z0uoFpzilb5?t?xU?Mys!9paVyy*^dyE8wclH;7IpL^BbZqnaA#NrMY(<1o9(i&8BhS5 z40rofXo5T&Hd!ioXYzWF8jrf~5}f)!;y`<# literal 1300 zcmd^7|7#ls6o383)rA@)%yV9AiU$U{!A+u^^06U~F!7X353Le`|Ee?KA5uH(VGnm!xBGd3*dGz+i9j#L46C&`)|u zFA)lb5RsxNpU>y>GK(0Z^YvX6NE+(3PH#K z5`YMRy$GNnRP%o&2C z^QkbGP=j%WjmeB51;Qe&2>uX92`m|8d<^aF_xs&$x6|pg+wEqvS+Cb?wOX}WEtkus zQmIfV2Ivnx?6$D$BAYNunt7JkN0)%d&w$ zfTrmfMx*^mq!SJ|RIMs2MJbdO#55<^EN3#TP6rgqFOp=?>!Up$lBniW`1#1qLEX-+`;xSI`nq)8P?L@q-u&1sP*JUV6P!s{Ng;+vNAsUDhB8>=n0kRyV zSxC^X8v`OsakP)6JpUPo2Venc02081SrNM-v|JK4ppgY93P#>A#w#Cu?Ara$vr7w# zyW{^Ef!$U2F>q^c=H-(wUR-O;4Q@@24o~|hhRc6E{A%LD=})~=>z>&QtMATlzV`bA zSl+mO^Np#*Q!|HujEp}&`AP2`{^^nX@BOthviGI^?B{EJeZJ4Y57WOr_RU*Iht3_j z2OH>pb7b+s(02nX(^r>o>7)GY&gP-@!I?0u4!-pFHQ!D0?NhNk!}H(Xy*mBV>E&x{ z1A8OSJ$~o@iHYq)2ajw&a!I}T(T8U?CkFP%zCL*6#+k#P4VEwcT3?kn9zA>aROpq5 vZODwfKOv9@ScOf5wsiCu^#vF|C8h&9$Keo`ugmKLQgQ%fz? zT1M4UTZutYu|-Sm#pu+MTB^VFf0%d9d-t8sx#xSAcka7wYmF2UJTC|U07TFzI0gU! zBDwcE{?pu(r~=XCf>eU3sV&;nRDnz(`4fWu003o1Ji`FhZ7ZH?V~=2@qps1EeJiZb z!82gy5*eP48zgWMn$&gqD+CnA6~Z@pE7>Rm3z7_QlXc}Y{sQWmeuExGn7_WH(m?yS zYcakkYGk492=Lg>t7=+DprXL9?30#OAzmWZeW6?VG#KvS{j?Z$$$#F(gY(`hLUO_7 zLwurRM~<%ayx8s4`$Xp+nV!pqdBfBaSdV#*Nu0I5*E_!3@+}uzkNaBIo_Ah0HB-{D zfheBKkX4V;RFhT>y$h?ZIKM39k}olgFPbpVZ2V`yL#jVWjZiy&-WXzmQV;-Z-%u_+ zB?O+)!C029>8~uvM;@ao152vO3?Cr2A{%1#P5!vJ#^ru7CHIupqodv?qrRKPZjW4= zx3+y|iN%1EfO+$vqh}(X`?1Ivn8~Zb}LX z@gs%VHBH$^v{2|nl9aW42_@ML=9QHNbL~HB=&&i-F($Mf@B`5P@7vrsD zI;dA!WNZ}M`kLP)=bqLTUiOnzLpsenDNO}aHkx6?T0Alu7b~SR8Ta-F)0{m1`R4ks zVH7vk+eOq@P0kg5mmuYLC3y%%J$f3l z|9qfsBh;zn-|LKE9yLD*Z9nt3%xO|YQ`lkQvn29TJ?~_si^h=3oLEGCYi9146P`%vb z#DR5N33PjInSCAh;;+a<(|XyEkrRyNVYFUs&Fw74cql$LK7y_QSsxAd_ARce6JT%) z?PhNx(+4z0z$wu0j+re3q$B-&EqS``X#C!N z%trN9ZX28joz!F{*q>UDn|xMNHR6C>40+t=eL*6cRV&GSIEj-NuR^9kEpAlK24u$C zWo=YNc>9YMUW9Zpew&jW8tXt2f@%z+;IOf7x9q`#H}7Xyx5!JcInSaRPV>HJ7%J6T{21rB>b4&zyiv77Px3+7tyI&kcXOOhbZxZ8pj`akg~uXJp-3Dymk=@%rfUTw1EcFXzMp-9-I z_6^S5lu!!PXkt%fhl1bO^-n;wvPtb=y1v?hk42CH&TJ1h`$DJTJwGxpC|WuW z;gHEyz!*e^WMnIDX=p3xa=AF6Zi^F7+U?!R69zVmRHC$~Yc;rQ_;p%8gL62gE0Y4P z`8h(6r=_*e(`l-h4;`e!)==9!wMubJ!)~b*Xw=z$SC<>d)FJ#G^#n*y~_{Pj|rRyvAA)Ldjoa;zxBVvlL$B?4%9uWByY y)m`H*zHiU_oJv(7=AOMhLhN^3z<>P#$#r%F#SGX|p|llRbufA9 zA2ex5Qd}Gb*MfsTi&X~~XI&j!1wrr!#M!|~(M3wUFDbNti1EVXeVljC;l29+p;2L~ z*)<8Mnq{QoF)^E46?M=HVZ9 z{7G`jl~*K zK!#?ud;=UD0^>!>UiWx+Z|B_p?P<;L2fGS##JnSrc>n+a24YJ`L;$4#lK_}N1-3?$ zej6Tt=m8!VD=&YoPnG}x02y>eSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{ z00P`eL_t(|+U?!lO&dWN1<*U*6yh`hq5`0jKmj08fpG;$xB#3=;#7d30k)9rP9AU+ zDG7vMdu`5<{J_($J~UT%ys(o1000000001!Ng;TD0I+_=2w=EwFLTr<`=exBlX31p zNz#_2O_Hu;njdNR&hCFkIKo!Cp5>sanbhRqnTvVRl}z_evM@#A2-_2i7a2EAuAUo; z{|w14$C{*Ygso_cqndATytt2dPBS;%ml+uWtk=yfleZ4WB&o^O%`6iW)*N9YgE2Md z@4U)?&v#EUHErPtA9gGKkiO*5gBsxo!w<%bj7LrGR(Z|7%V!U1p3ZlUu#Q&Jtp2;e zbzD<(1P0w2wMWenw8lp?O|JX~G)K@HwMWenHe$hj%9nNDL({zOKX8O2u$B5`-xP!+ z3`(i%Z*8OBZ}ver!Z6eU1XC4`!Vv~&>>h-FBk;G@JqSkt;RyU+89-|*nxk-pq3H(@ zOtpABk8p(HEx7LwWtQm-uH^%(baR=ztnrEQ?x}UJIRbxbjX*fUAoV53AMx745qQ+z zNftG$KNYYf3r8ggM;Nr)WxDDuZr5pz!V!kv9?#OIWWK6^>`M;4!%;ZGM%X>cbQzFm z@4cTsx1D~;*nqWKo?U&E_xST3XI2YG*kretIjYIzEd$b7)wb2J@peu#?@NwLULR&P znF~hE5w_0tEC)@^WcgCsCpXEO%xlS4p(q^T!vy6r{C)-HI7wTQwolqo^1bV_@H85e e;TaV literal 11241 zcmeHNc|26z8z0)pTA`gWl%z3c%osCSlD)DosYtV7gc-ABNV_&gi#3t7zocCYB^Ak< zC|Oe^TSA1g{q7yErd~?F&-?!OUZ0tB&vTyV`~9BhKIhyspO1sqmZlQZ=S_#fU=rqL zMz%l;2R|ZHfp2y|Ko<-qS`lFH#IYs$!I>@qKsBw zA-MLRkMZ;AIBG9E?7PxJLqXJb=tmpoN{Vyy#p^F_SruqsdHZXH`vn3ukSB1w)b(LzMHoA!nNI)eHtru z*o!%83oRtv;nxMfo4y^_KkmDd~=SADu5cHhj8 z<^3iD>*g!J-&Eo;YlTSpxlMMINteSX4|*(RUNR3?My#_B4qJ-Mj=k|d7I*R)E+obt zo8Ss3(k4PrQ1+S|4P5zzF37Ez01i=KJ%6I&Z0*eX~9;ib6ESz9c*qd5mL&!=36qK zydpYM>c+tQG^zK4)A1_xSD9ivRu<0X3`xCTP&5!+DRs#rEX`Ls?Pd`8_wOK=TuELs)&KI+Z5?a0|&6J-&xv)bZ!jDqy9tGL&XvB)CU*sauZW4+udB&cjqh$UbyaRAG#|4(@r0)=Wl(>)F14LZm3lVCE}*P&D+(^2UwxMyAgCeFcmmSEJq|n_VdP`F0r9rPFiuV`-Z-SJL9z`1blaF}b~=j&{7| zmhFjIt|Bn~>HY>6{g+Q$jhOAzExst!e;|nCCf2muApAs-=swFGXP;!IbWJJDZcMkT z3Pdy72iwnCh*Xg7d8r#*`G&ic9e5+)3Qh80*sJW!oCNB@^a1(I(;L(yDnpy|hMs0T zP|?xZ8FDn?RoT^w0Hk*Oo%frU3ZJ38*D1e;!d>X2ZSNM#Z7r<|tuQYrpZ_AbKX4uu zpYw4V-gBVhWrxDdMvbGoXVRV?NP2WVW$}!SA9vNzdseM`Jp=!UbbMM~NP5gvv(Q;7 zP71s<{fjL}&d%6_tewAjHflwT7$(JGb%ksSy*g~y3Q}21nX|}WXw14p#JI_)A~U$Y zLmBvLF?}zSrZ>lG9E~MPU2=49`Npceu2~$~mz00Jw>#LfL#H(6$;>H)W8!+v#Ti#G zck}dil?UmqmkjTmk? zgYA7U1_CE}6Sr{i{Z+|XF+?32^3owd5N~CYnzLb;V;9lSNNT+E1D`Aa4mQR&fCn} zyEFRvi4c2XF|1*b&V`Jp{Rxis*)kpXeC3+53X0n9KW+KYkgjy?zJ%Wy^TQ%!uei(8 zb@5%hEZr_1ost!r^(|^u@rQhGPw`}K{1l85Ne#QS)hk-A@20}s`&x4HY?GLp8&l_s zR`Ede)Et~#DRw@A^j0Hd zJvJ@Dt-PXCC9>7fPs`S~JMNHU&}rsei-P-(xmqigdhDhK*S5aXbuaLOb2;We9 zw|2JbCdZ7g2j@q`$vRAbUzKc1alW}QYL%LpL-LVzx>f00reBNb3^`}BtLvSeLWH7x zL1Yzc&@1$1NY-BK=fuxX_SGK@lq<;|cxLZ>Z1M3FM{?zsmt`+IpOqEir7y>%;Tt*v zmwH#+sR7B9TpUtIA6c@6AEi7VH|luydP*%;gr*$d)jN zm&Wg+Ri8fY&|X!m_iWxZjBWCrGV@gmI7x}K3tz$mf3~}#}w{KRqn0x+?Yod zNS1y@-5WXm#zq1tp1`n17|6Z+-Gca!!j?GTTu|%lvjVkjA?ZC zjy>_KUd&KnNqM!xrJ+2L8d39w^~e}PT$Ogy%U9I};rbDmiw&k0dfwclzW>76(2$@; zM=fQ!PswZBB;xh*9xjjZG`jXIR>X#^(^}`_BHDF}cU0n*{*ss+rAA?HRYTdVf@=R) zP1;RP)V3SOme*n^%6spLr@m;HiSMQiX?U#6dxmYNq_)^_F7dW?560fSB(r?m@u>BtFBUxC#%9u}iq4ryK(5`BZ!80ui-x&`EE^x8TA9|fj4#}>$ zvo+q-Z)@OwT9IRD`g282+}YVGww`r5(-4+-!=2TvZ#fy?IN!+~+*KZ(e*zIXBfaI6$%Ru^`LU?mR+vnp&_n^^zpnz&_I^(P^^S z`Q)O+JvrxHi_R&U`})c_i%D)@=D5%~mdj)nd7>qrcW|W?T-y*jd3{y!XH9cX zh_@fiWUs+5tCgrdVX?a5zSRPD{1?j$aWY^%7G4? z^qnl$5Gf3AbrO|9rm6G1nLu&CU^@CdCW*3{#(|S*?sOkrL|fWJ1e{LQMXbeHXjm`} zX&!X502a+Iz|x))u$e-jBJ}m9>+pyGfH#dpg7dt+eAq;uE`pCs1nxmI3IXT4a5n2A zoGh&2h71-Bj#bC1Yaoqz^eq^K-gLMQi|R(SH8L520D8Iz4-SV(M4|lr{M7w4)fp^z z6q-OFpfoTj3t zf%5kLA%e{@-twJq%m}tU@Pi9wOJg&*EDFtd3(be4BuL8i;<5!fxojF};_LRJx}gA3 zd}hHIQ*#UJ(HJm|?sRV^KLYd?^rTWo{g_;q7vG0ULD9Tu-hdD`fQLWHg0~Hj+%!#34x(Z3-TT!)W5k z1OW&u79A*Ul9!+=5Q+*wxoMNhBs9(qNv2Q%C;~+bNuXiSNUEC~PMbob;HfxmJ`|W( zqJg!!E&`*j@!ewWMdG+ISl+;Tq5Du7e(di<_H=KW9ft&_4XuU6Y2nalj3!1~Q(GJT z-N}*0Vgq#xqM|j_(ZgI+3eg0>Bmwn9_a?d1P)r|peh8qNXvm_GI1H9OgW;u%09C=k zQ2uIw>x|SnaSek)0@nlInMMVd%E)3_NpeT=yE>>}IsXmG&V%9SGcla+uA?XhERG+8 zwb_bgMfRjoIKRdj%Xt*Z7TBiP9G1WNZzlDVpU!Y$ngOv4mcIbM9nE*RH@ug4(fO%@ z!};r%NTPsQ)J3pKTWD1NBLMO^JVfyz`MA@7jdEm_Kz8~V1&bq~F=QNpfYj8ck${@V z5A_D;ZAITr(_rG-gm##m`z#lpPS6%<5>yI+EC}V(|mw)pC9l`IA&&R81O54DtWc35o`$jJN@7yXc1+atz*MrVza=H5G*Ek z4q%+dF}E`XN-d7m!~Caq>}WMJ9VX%hlm{`hLSOBnh&Xt1{lHrx8m zALC6pU@THW5ugC*>g?)*DLXe$2>Z8AV-X9IL8MR%k_%qH6Y@&|g5)@;U#N42;P< zj&c0*90@oTRu7Yz^F1>%@bCBIU;<`Q*vGfSJEDR4r19N=5#ih@nct@WW8?Sj6$1Vh z>hF9E(BS{4!1#}W{|KNhb1YD@_k6y2q9O#zq1lgx-vksQ_?b`*OjN{J$n9 zgG7Mj6Cnm?e=PY6A0{>bE1!Eb0}%L=;%~5tihzj!lpNv$+tF1(3T_|GhM>cE_aNy+ ziJ|8XVL`J8`+p;a9)+6X-;x8xPpJKw^ykz=Afp+83{d;3=KDbsvQ4A~iN_-!EBqo^g4` z9e{!bML@Rk#5^ec24rk_gMoa1MGpG>RsaMfCM%`CbTU|$xyg}$en+-voaU~5(l+sG6RaerYkp_#_ zl+wdZP*zPGzn0;U<0Gpc?yv0!b^0vZKlu!N<%;Pv zKhk((y>~H{l{mV<*##<21wEKV$ki}ItKL~!mf}?}6BhamWt3gcUbx3bn}^Ng0=CCJ z6Vw-QbE#>*-SnfH^9QnpC9&uGwfe0~i$dyAKdhFcZIWnVtZ8)dmR()V!S@QdV$~5m>kTHiX^k78F%)G?tRFk*1b0X4$|+k# z8dgdvC{H0ydsHpke^}7DBnBzmC8LbOV2Dpm0o-9nN6dbRD`8U@QkLbr1I-SD>1_XU zT+6B`csiC1d=H<;MD5lp1#U6ECgT-!Akx!40||J>cKWb(;4)aO$So8%(wrel4wa-A zkZ1UE67Mel6a4-@$IP&%6lpkIYSHxtVLK_2B%JxaO5}-TJLD<-oq7dS$z5bFxT9Qv zYJdThI6|AD}E!hwGi0x($`5-1xFdb-LkLk_7M8z=STnlLhU7(IobOq3gfvJWR%e>`3KOVPliGZD;>BF&GyFVWq%Fy#%3g|w$;1H_%Bzsx}<-3EMJkMq?R{nynZ}98sbprEmd)JH61E*}cL)!G&Bvv7@ZL9P zSb~w1?N!@ixASqdyNZM3eyN{vS2myH>T{bVy7pW3+|(mP3{Mc#!HzyQ6mkoGn>m>l z_Bf!?=$P#(J$TU0vm^#Lf+cETv2yx0;3P_&)kr9aO_qMb6B!U~g>1bPH)G9hfr8&{ zIBEY)(29fJ5K^)36lQ#uAWD$^0fvmt~i1FM%0)2He)$9UK^}&x*&2k+ILC@->ZDd zQn%rk9g`MBt;7K_1=mj5^)?74W@P%sTI>2_y7T2UHPZVwW*RWqVKv`94O~v(I6O#X zLbBH4`_-#g&$fbZm%56?`YPA;#8ysid%M#zDD+K}EhC~EH+VWM2<7yj-z$lc1`Jp4 U5$hkg$@^Cfx?)}Godd7^16AUFtN;K2 literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/CLeft.png b/soh/assets/custom/textures/buttons/CLeft.png index 5e26a2067e159b8bc2c9116664f9e72b5d7896fa..43b04412fbc0752e6589dd93235700e259ec9f64 100644 GIT binary patch delta 1127 zcmV-t1ep8aSBnZEiBL{Q4GJ0x0000DNk~Le0003;000252nGNE0B$K9Fq3f#6@Ms^ zeUUv#!%!53Pg6yaiby+%C}gNk7DS6UN)?M>p|llRbufA9A2ex5Qd}Gb*MfsTi&X~~ zXI&j!1wrr!#M!|~(M3wUFDbN$@xtSMoOjRRz54*6QDLgtH3_JiWu)RUF`HWzdtTwg zCOGqFI5i)8hqXG*N+BH&4r06{6;U9MVNpi{LDua<@0e@AfkQ_hw zAN-!JS(u)3lL9fI`^C0D#(2000SaNLh0L01FcU01FcV z0GgZ_00007bV*G`2j~GF7b`nucbn?~000?uMObu0Z*6U5Zgc=ca%Ew3Wn>_CX>@2H zM@dakSAh-}0008wNkl7zN;S;|`K80Ad1Ql9B;HVkm-;36Nj_(n%U7 zK(GMbqqT1zNL8sVPy_@g`96sU#DlG$_~_g?@lBIaA4`+K8xVhZOT`G_d3P5%>XZFZ zGOo!u4?juLmZVLRu4I-UY4=Vaen&XMM!LDoK~poW$-xURszp~a+dIy}6on&fPAHyd z+%&m*X(;|PB)d#BN#O_^(H2KF-`@Blo9vuqZo2DbWCZZw_A=AA4#p&@$<^&;rY5X8 z!deDnYR=yIYCC`1Jo zcF?T;y}*w+CYmD*x;1K#nj>h9PiUH4`44E0pfzfbnj@^m3;$ETeDpaq&Fj8_gK&h6 z)F=CgEp3Wm2VR$e6>qq|d-E>$sd)Q957rD;|-Z9=ias6qIz@J(p5RNcN zeaU1SkBxAIC+!_)QM3A80ZX#5Rf2GYL91P6t6t)Eoz^HEVd(AgG;K=es|v`z*+Jg>Gk2G1hBN+yZR{a@$nveRtra1XLlDls>$>%1JYjAmesKK zc1|+yOC}|+53`!g1*7H&8|UUS2Tjd%`B2*bZjv>b*OIS7Q8>cZ1m!aPeg)+?Nn4V( tPufv(-E~>G8x50DA4`+K8w?j4>?hWcnVy|(M}+_Y002ovPDHLkV1kll_JRNa literal 11232 zcmeHNd0fof`=7EzE2W6kn2<2d(l#?1?JBKWlq{L$Gt;DI#>}))A=R~9q^@@2Dx^Zb zL@Du=NJ-K{NvM=o)NQf;KA)*iMvC0u{r-1PubFesbDrmUzt3}?v&`$&UI#l18Ogbl z2n0gL%F@gctdY=X+EnnHzinGD0x|vJHfJ}1BgG%d<#8A+ZvZI>iXC;NQ9Rj@fz zcMZ=MdV=((Qhk@3653Srye_+u3i@81g2LSI|hS_I=p>>XF&v z)lQF>1Qdiy^##S0gdXRp)#m6un{&IqFpgQO>x)@sv@)kZ*ZqU)aeL#C1En>sh9@yM z`#X=xc~IlK=HLe2Mnq$JUOXu(;HaqX|JX9`c3t27qaX77mv28`a!pBLrmg--y9@PO zlvO*z43d%;ZHm8wEo*TJRLoX3TG@HwXbrb2(BVmux&B6eT_%4%do#7Sgn90noLbq2 z=}%k@LtoDNt2z6@i3nxM%`ycx(`-K6QS$H0WEQ-TTw#Cbq-01Va3K8uCh? znVL3v2U5c~ZVEi0ye}!_-K?EggBurX+&Et&QxM!J=RC!jNYNrZ_AZENeYx_gqHNi& zmaz6CCS^^57^6Lp*JF#O%(zfIWoz-1j$pro1SN!*TbF6?{K-jslIOgpO)F09pvZ3T zN$e>5&!(Vvqyu_lVUf1V-d>(N6;IwsR*_Qil3%#bGHUs4%Of!+`>Y&S6VvWqR^gRK zIhEx!C9I#mNJ%rT$#FG0^Znd%qqMYF?p~RhfsY=a$y(buSY*>r?tPqk`q=i@m#>Hg zuTsHR+&%d_skT?!hE6>d&y4rYZZ0*^T)W|7#l7^5+}emOD>|+Mr;qwS@x3B(d0rLg z{El4-*Vgn%Xa;K;p22P5g`i(J+nM1e;ne2uVVWaMw%;yQntjr>X_of-!&yjGb@MFT zBTcH&oY3w&)G}jji{&;t9w|aNH-+jIx zi`4O-L!ndX4H*WtErh!G>|1WrS_c`y$$`!r(`_`Iyfzj4OqbFaY|!4CsJu0aCTPK; z?)OMWwCXgt`ey>`bi4JE+-Jvz;LWloJ!lD@caGt2 zG_S*CVk31!vuI&e&mX%-Ps3E-=)Sr=HKS#w-c3r>fo2oK^r@DT z3YXo~0ul{Rw;ys{G}SsxVzI(<9EQHKKGj{`DqcD`IIzd~O4_oO3j1AeA0qTEP_jV-DO09+B08n)xmml@jnnnL8fuh# zn-3MbG-15sW?ZZ3zEIn(OwL&<7C~8c54{QZuKa<_NCxy3M;TX5F zSM{I*WMOK8 z7KBESZ*A7fcCy=Mp17o=lI<0kTm2{~z8zm=mDc$pYjBx~Q&(=V@uoE$HJ285dXw}{ zrp>B8#+lDP9Fyu%=j!}-zs|XqS!KKaA}+Lr9L(98z1o{cZeb4 z9ccfQv%dic3GJ4#k23(3>V-LPu7)koFiI@G2K&dpV@Z8mSb$Xb$iUMCIf7Qfoe%_h(+le0cmZISZbhvrdh_la-6 zQ^;@2OMkermb`RodzYlt1(2Aog6>%$Qfa()C1#W3_APz@NFNJM{OH1s5V!-EpKo@51A_P(R1&ke8W&SaY-E|O|C1KGJ@k02cjzPahgQ80 zpT=H0|M>PmVv(HgPSsOUvp;RKk$=#VVE21@_bosAS&#QJb+??e`AMW>`Wam+2Z&VU zW;&>)2e`TFyQtuj96b&j-X)D9H*lLzSOia!yOF zoLpg-Xu0p5&hfIxB}n4=OwU5jOks4#p`CArDvOZFnuWu7xEt$pP!o)pk@OIyTo z0)?Q5Ci!QMNOf(zyz9(PtK&DH)E-<<_U?>L(bBnAfjC$ti>vrxbtLY^m-b@$|90o= z7s!@0zfp|2c{r#y_~7Ywm3xGAzvl#tMP=8cA03W46_H?F5tQ9>eyU=8`<94nb&)S? zTRyK#{p@s&LU7GXIfg%S$y3GtHE)0C+0KRcE;@T&5+mlBoeKQpg;VV(E}`fhIekzK zHD&sz+=2r)z&9Rq%*P#zE1*G-JF<`tt7ZolG6N;speW%*GFj_Su9^!+m(JtfmN z_D5%<&2+PkRB)^J7$P2sce$^)`KMTsK=baAQx(x=_v~ua%a*zf*m?Jf|J5{`DYN3j zO$0(LoMme2U}b6wzb8SUq~OD3%Ueb&w>_LvQHm1F_7Ui3WU0o^g=@~bO_oZ{EI+%u zIMt&(Wr5Y!t+O^r$%ZUnJAXrxuP;||@=duJ78)Anvo+uDusUJ>yTqMO0sh@v`((V`WtFt`9(A#q__Iq+NK4Ih*LAd6 z$TDnup~m|-ombqnbk|{;nBtj86~h6wk6qQJ_O`iJHkx_KbdMWY6E zdH$=u>Zf;JPl`NsE{3ynx9R3fMo-#RySu!)I~%m`e-1$e9p$Bm%!zq}K*+hUzz4pY ztqqCB@zJ8tIaEL^z=sPa2LfSW7{H~_wg3Vo6=1U1WK{RH0u+)(C!<_-ZLzjoQ^1pD zxs3-nZL@QxZQDX4(ou#hB@F^dpaUO3KtTrhc(eJW05VGGmjt#UF$RScstC4_QEs*l zNK+0EKDa@aYP@8$uZ za2NpU3*GYtbc_|)(E;ZJDq!$fECG$hqwz$Hs69ApYdd1i<_|{^j3*|5!o}dUuoxeo zZ!Gu%bHA^6V_NW?!QWXJM}W`q<$O72kl1;#+;7OxiC;9 zGY-uc@?vF1MnMEfbPkP0CkdN)fWW{~89HbNo~DP^p%W=+0s#x4=~N;^M^~SSr8BT1 zuB_O60fkKiAXlJsEf(m9LSX0+b--+(>QQvjI@)*~nyO3JM-z#3Z9N(TN5unxhzolj z3ruZ_wz_)5YPiIyj=9j<)_+rL_Q$ z59Tf86^GTr5riXj8fg{ilLF=s%ZI`QFkChho)5{C2T%kYo->EzO-4aLNXS&U8;}OW zc}}w7&?wM;5Gn(7XsZlw7842+BkUSrex&@JCnryiKYL<+zN(IRG3E*UIlL|QJbS7a zKok7f&sfSMo*cnriZ9>=TK!~Fqx1}h64Mg280(A z(<9*sB)kr4Xtj|B80ct(XKMf*9=5h5(Rdg@hYQIHN;oH9F4vm{@V<=`oHyg>iP#V4 z=+DeW)rPE1Iov>Sw|WZf{nz5+%OUnOd*FP36$*;ea z0XF#V^9O$kr!1_u1Aj$NrCM8RV1*ATd9`5BQP5)cLd5vV92+=hsB^?Vj~^;jL_ z;*2>U3JiJpRdC1#CeZ$7hy*0F4($34?>m7g_}>ABfS@9}6i*sI4hg~U(Imu2Murl#w2CFdooox#+B6@X

z`w)pXaA)jg$O+DBgr4Fcyi9=ilD_quKpz_K?2t zHiVBx9nBe|eT>9<04a;^g7FAMo%;)+G-DFtV0y3Egd+eshmKh2<3f>xx+7(D zBp~4Nz~S(>z4;`xAGs%?^LeZ@d<11w!`NyPqTtGq6KDt`0VU;lz@yAZx+4#gWWO20 zvze>~{qNeZ6;UD>gAteCIe}(>IP))|JhyaEsQBFy+^QHlp}w;oM*z+EN1(8oC^#&G z>Jb8zeQ(C6E^0B{9=*;GiLr=4!0@`mZs6HN{qI2GrC7FLBt2leU#drgjt)KSY$O7( z0IsVVzCI*j*+lBGW(^?rot>qj*7LmFc& z0XzWJ@T&!CFaO0QfxzLCa;<;Ni9+M!4#38uBw*QiWb(`2gAx0BHbDA60*A(bN&r%V ziYO8IE*~2C{u?6kGho%_}%(ELR7mKa#yvt2e zmnbtyF5SnnEoVAdQAbyW`PlLk2S{gm#t+0Pvi|96MaA`>r&%6PTR8a7V7dDdoi7 zju|L|b_TgbsC_!xk~0mnq2WCJpvnUmQ|vRmz&fG+27b!N7r^4dW_%xp@WjGYcxAC= zJh3pQSNe1fDDgORZxFGqJfB+n!OE(Dq#Yk1ZH237Ii3tEE5=!bjQIwxympP&k@}7# zCVMyX4(W~UOrOk+JSEl_TNnJ@!?}SH6L<~@MB6j3l+$7L<_+uZ^;6YN)@Uaagd6nN z-5CZ4V=T?|4xGD&swm&{QO#GN-9svTL&&O?cLeIbh%lqw@85GA>WnkoruBO`{FaiM z))2zerF6o5;TXLb3l%-@3W^ zU`b>#uo*f=h*W?Fx3GRYkw>1C8(Kn zGpf6YGy}b(dF)b1ZNe5PRB0UZGGHY(CTjBi<{Yhi9^9bH6hAS_<|y`}66B0^1a1R- zAorNE$VoxAF>t;t08rccLqR}(p{@dg*?3nBcnY*v#|)|8KIyGMdTh)oHadz2XWj9P#H`9Mc(&CNg~^t%HO3? zjVlCDAWszV#aN%1?QdQ!w|kp+G@Ia+<_a&1Zdt+GHl-N3E>w-~jW+=)I{qXf;$GZES(EJ%0?nZ+&&+ z&H1g7+T0c`r>Q}5+|@dtIIbyFk<(K{k4&^qAb*9{EFvJ-cbeGwS2C`RqZAVV58E!_ z#AVHg_~#Yuz8|sOWk$IpG42)jf{Idy5D=xR!FWsbViyu_{IW%$!vhk&)mh z>vUf06IQ-`q**cf;&RO8$caZuTmDGuq-{!r=#?dAxkg)Rb%LMdi1 zLkJ`oT1+GlQD3#cQ4J%7z)awE(iI=~o`*$kBgWmvoG?knEFAKa9tS+@W)rq`-2=H$ P{-XmPLv+0FK)(1tYki4q literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/CRight.png b/soh/assets/custom/textures/buttons/CRight.png index 9e6180639b9b332424a585c3ba7e57d287742779..c2d1afabfa0994a1c73817d8172f7bfba44b0433 100644 GIT binary patch delta 1163 zcmV;61a$k9Shxy*iBL{Q4GJ0x0000DNk~Le0003;000252nGNE0B$K9FaQ7ng=s@W zP)S2WAaHVTW@&6?001bFeUUv#!%!53Pg6yaiby+%C}gNk7DS6UN)?M>p|llRbufA9 zA2ex5Qd}Gb*MfsTi&X~~XI&j!1wrr!#M!|~(M3wUFDbNti1EVXeVljC;l29+p;2L~ z*)<8Mnq{QoF)^E46?M=HVZ9 z{7G`jl~*K zK!#?ud;=UD0^>!>UiWx+Z|B_p?P<;L2fGS##JnSrc>n+a24YJ`L;$4#lK_}N1-3?$ zsT&@D=m8!VEEaF+QCR>002y>eSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{ z00R$6L_t(|+U?!VO&d`dhS7KING!8R15N`VDgY`86aW$x7*~J<1>jT?Qvreom}NF; zAj$Y<0m&l5{3K@Zc+Qc$KrHSsLXW=dv3wJgaU)ZcKpY5vmZ@?JfWO_GWq+RR43bev zM!9<>NnIs%k~CE&`I&nA`0i(M1lH2kd3J{-;PDhHcKnRfl&4E%dQKV6?^yzDS0Nl7lQ&oeeT0-X$F zN={z6E+<=mhna{Y(A%x_BJ(PHU42j^j?kwto@O){=C;i>=S@C#@ga@(9HB?5Vf*g| zzQvj*M_{F=#x75fCPy$ezPjNs7bZu*)VK!Iqsb9^VDK)VT3YJcBh%xqZ8gwW9~MrI z$&NSzE2S!}PHkmDY)0Y;td!Djn7*&THHahdENzB=X=4ShK^%c+sass@>k3?hI07r@ z{W|;+;s`xZwL7(KtiUyhBk;6&yJ32;E2ZkzxATZ2^uQpwT=1(O?#{w#8|Z`Uv)twl zpBQf)b*ncfN1zRL*DhEbp(o~54*IyZI0BE_KFqA7{Zj#}WY)!_62uXDq%@hdy~S;s z?oEw<;s|}49*?{)F~7;%Ii+B(eSK9EoBhW~p%ebUvF2bXgLfKIwU zyLvyb@$sIHpII%A&~rCu*)Pd>nSt!`S=F}HK$2whDAReBgDU?Yvyx2LC5$FV;E${G z><&xD_g_l;>`AgD(^BR0x}M002ovPDHLkV1joC1z!LF literal 11284 zcmeHNc|4R|8y>VMyRt^6u_PKZ_A!y{rm|#>gfWYTVVD^PA*GVMN}HvWHzh5viWVfK zsAMa$Wp5EJNJR+W^NdELNcz6-zxVjfJkN8V`@XL0+~+>$IrFP%YfCe}#gdC55C|W} z+}H-VLctIB0^pk#67mTGSv)_)ZZq8m%Ygb(DMS*P0Hp`}5uk)15)lFkdX|w$%2HP5 z-#vb9zpJ4tcM(-wHe_M`*D>Q`VfPtsh5ObPXeHi-9=&ih$9ME~ThnMvVbGrEhqsk# zzK$uhv*nAm%}Jh5;=nU1GwuZs_yGdOlZu6`Y>!#K5(+Byf~$ux(J> zdo}ez^njBuPinpqIo;>B>i+bkf`e}=BZpV-H7bzmt#z&UTo~rxf9Z9>_VJdH&aaP8 zefUz5F!Vv_q?=68kk<0HrrlM`9%P$zyp2R(8F+!J+TQCl;5yjt{3u96|1Wgqz!gGb zgMYBDe%bA#*^lc#Uc9}yi5HqupM$>AaY^9stdmyZ!=2e~>C)lu9*dO~eYj#*f%sLmn zmo{we4i&v)@(wQkLYCX5(d`d-yqBmj3jOnY zB9B(oXnXyIuB{hteQC_AF33|FnIp+5h!!V0epof%s1li{^hi|R{j9i_Z-@~ucTK;+ z%^kSGoz3IBPaNsj?+_j1*YSKjsvk#NH@GC*&H97_;{`O(?DWv5{l+p?jwF?%L`=r$ z*1V=ip>-8j^~u|{Z&(aCg~7-fU3CSBWl9`*>12tTBaf7qMD-*wYIX87-VQXH6>+9g z9L^2sR0dvtj}qk!DcE}2O1idAsiy4cMdcB=zrXodKncZG=z)&u;Bwi1-78&vmONnr zZO0#7yw%i4-0D1l5i2=RUOy`COJuCmKH=FX)o`oTpuA=%D#J3C6Xl=cBcCgu{iNxy z$`g30{VvPeE1r)$3@gdJmV5iXoRiopZ;Uw1t4g`t`0El+oxSJO3eMCnZ9VYfw%3@L z)SZKdu8&ErQIYb84xG?4ipII>tDJ0fx#ccMQo!yyUDMWu^n-`({P^TnFPFC4JB{SA zzOxqG&#<}VTTsVQNyFWji{9nNOPeSEvsNKWYW>l!k!CI#dQ2L%X;avc`hp(4_6`p6 zZr+Uh;k9+%9eu$Y3eLfxXw%9g$3|>$x7-3N!wqs$F_f;a8IDfaBoLx5bf+KxA%ebk9K?@Y{q$8*5Xafd<Sykbu!tK2&W9^Z`f;aVn?n{rK7 zXG=4V_ko;sR>kLxgh%iD$ZhMx8nLUoPyIs(?$=u=-E`aZok{%#gO`|Oj+I~2)W#($ z%OnnW_DWsoI-l8_%zdgRN;~8AvEK8PlbmOc9=bka8C@&mRR)ue9mqNT>Z{YT)elQN zbSu#PXJpE*nTy&sk8-=Y9LjpC+L+k9+B^N!qPut@$OZ2nsYtgoJCa@Fk0qTUt(DT{ zKl?6>qkAkuF=D^Tn!QJjk99Z6@b_@5n_d{vO0=eRuT3jAnxC;?WRdBH5ZT&clzf_i zi`x7sWzn$2f_df3|{1$J00FKoykh_@y*;4p_`UlP7asAoi%&%MEcc- zcF3C~iCH3hu2lC1<_p)SwkI7dzG87szV@Frd)IrOY}go=6PsvTp8h2CS^t1YR9l?= zxWQJ5-3NW&$i8qcUAic*HM%o!_Y*^mnBAAIa&kleb7PVyp+ae!G+#%7rR&I}=w7%~ z2iYaGb6!Fpk^3LR9`{NbDqH0FgKA2fuujT)n@97@6gs(-_J!`mo*iqfMyfhx?KeJb zv!PwKUwjxF&>i8ibbb5%uyZ9>U*^0`j)2`H*j(4;YPZ%1$+I{aCsQ%hYqew1PMM6& zd~t98=DqES3G6O@_yJp=XZ$gUWBY{-T-tXUpY(`WE-~K1FFro}RNr}!(7yJ= z`}m@Oa5}lM%&Yo3+B#WTl+hU+vtTI8TJ+AfY>?1hW&{BxYq#!P4QXc zgT^&+lPiSG?)s=6O768ILbUmZrHqKDz?r z@4wWAhd+F^gS1O>K!BgfydnWXvz04N#8!RSfjMpR*TM&*L5yDiL4LtEgmcHGmqc82 zGF1~5QE#+Y?OV*j)nx|339Ek&@>1oi`Vb%>8LOxviv`Z?e8 zB#RBNZ(B)um|#|{UAbJlYgh3>mxQh1FI@aKw)ge*JtdEfG~8UaGGbgJr`maJ zy>#NJTz*~kU9)w)T7Ld5)i3qhsSCwJtL2TTa{3l4QWmyWb)Cps*9L!_-#Jj%{GgjF z?%d^gN<^fQ`}K8=Zc=f(-Q?D2chlHM_UJ4hF?}I=D>`B0ng3T5i(Kw2a3KmcC zAgBcS_yNTMf#~W7`C)P11Ul4%;7Rh;gZ1VW!k{F)9?VhG0%_rAMA$|$51|rlLoDrZ zA>KG0JWPM>V%;D#0N_KQW1&GlWM3LONDs!uMFaPs83BVbUFhC=u+0|MP$LSJ0M$^@ zP(i{?f=GdCu(gY!x>P(7ZDVZu4FY)5gKeYJ{m=*mgTYW?sH;$@o(NSP9UTNx4WXt6 z2Rz`kU|%{m2<}Uh1tBIdj0rRx6{u(u#TN=Us2$~)6+YDhtpiu&-ID$za!Iv(}PU=Svps{lX&6kGs^ zf-%;EfdbHY3XX(FGjBE2iAbb2jtJMnt7*VBh)6sfg;dAGJv2462q-NS5s%kkgTnaI z=vZGI0fYj;RY(AiIv$Bv#}f!}ybciy*T8CP!*#TX;anG(A3gYMXDn;bTqZKw7)w!5U4bu zZb4L4q>AbU7aoT;1u(Hd{g8aHo&nXC60md%)s8|T>%l-(P%xCa8lbx0 z>Kwh1g2RIAf$2=ZgG=SxVll*eBAAc5h+jGXgk-yo!tnh)obRraC3?9 zZl|h+R@FuWg)uSPP+bJLHL^yl3vM137HIZ-=z^OI8Uq%bZGfL2nM9yY%@eC`X7FQ+ z|5l^3g|oX&L>p23f`Qe#jc{U!Z0juQwQNjQQpjq)q$>@E{&VS9rBnkQ_)n+bT) zAtv8+->L*$NdL$7t@{3t3;^`MBy-B|zv=onU31F7oSgryu7A@trwq)=`QPgLpQUT@ z_ut9{U*O!w0DcL_V0buzU(pLZHkcVh#=*b8^V5$2mPLN%PBaLFX9@V>fE-U22aF5p z7z>kyot$DKLW_kJO5Q;rg31_U1G~+OIG}=Uy&QncoZH(Ro$()o#=dkz#H?HAjQ86C z(~+`^00pqx$4{RiaxQOv3wu_l>4@3MSfs2gNY3776Y@&|?Bu^9WhZ3agF<>fjxis# zNbhFknYM$S7(|#WIT*td@V0M41Zdk3-18IPPX>1KKOqK*z{WlmjW51V7=iB}MS$yR zN@J0-u2VYy@L{F&ycr{>2>>?%w%ms8d5z`F>ToEFI6LfESzZWLc0*)ROz{kt`OC3w0-~0bG8=#0cz{-dw z@-sQ-oB?(bpxW88@yihbopTld0{$rC)R9-S@yyuI@hD;GxG*2*tmy|4?w5^D0eaW| zecOH4HF0l`6`10~dSLB}tmne2VdgC}13z}MoMyZJm`@4d{7;C%(I3kA z%mlwxKE&kysR-{?PwY_BNtlit9P#grnw^{-dolx{@prPo3jQ5Z(3dsm;Qf!I2W?XX zfCiQbBvF*Pg4LI!B*S${UAAE`MqzDcqa1c5Pr%4=)}qbcn=;P z3{+<>Owi{?LeK^_aJ{pieprP!(L3=ytpJt->(l~1ub$(Sur?bo_H5qZj65@TfPr9R z7cpU(SxkQAFp#mSXNF&qgLtzFV3D#50pH`lYM_YOh*|N!Er1mOUa9uHQ_l9RK5%bm a-T&@2YJoFO%U-?#^v9T38ecYa-}N5>&$}J~ diff --git a/soh/assets/custom/textures/buttons/CRightOutline.png b/soh/assets/custom/textures/buttons/CRightOutline.png new file mode 100644 index 0000000000000000000000000000000000000000..d450084ead24fc1b64c507881cb1f094b7b7a572 GIT binary patch literal 1541 zcmcJO`#;kQ7{|YJTW)EIg}I!TyO!LVLsn*OGe&fqxnHJ{+gxU(T+&S@n+|4{UX`4P z&Y4T)62fUYi<09OCUVJP$mL|xS${;&>-9XZ=k@;O^Ln1o^IZ2NVpWy2l>h)x#p7JO z004xQ_BA^cq&3AEXP_dANfV5h-Bfy?Y{b zf;5(P>GTWMVJ(sR^_imRvmH7e)+N8aVcbD>xU!rt5FLYh<*(~MLo{x6J)3>fYK=Z_ zWa|Ojrrq|lJijth z!-6+IDOva&u%cBHj4k<8vm@74{R#TTjw^0#U)JA;x@_hMdy z+Q?-w!cy`)?4jDxE0nqmvM`v;B<8jMMlwBS=EL>^RVW5GD$zQc;I|l3Ulf7~SQp>{ zzy^wr%GV#462({?DINfn)qf-i;Bfa!Avgi=jseet^q>}y<=l=FO0r*hhqT+(WUd7*ZNuws{wC( z8E~rtr~m|efZyf3GsNdac4^!r45aZ5;=jR}_@*&2J30NTA2s{pH*3BFTPpao;t8P> z4qRMy?3w%3UeA!taa;LjjOVay@PC>;6ExWLb&FppV?_oB#8x^3zWt%=UAstCuF>T) zq#amMtn;!Rdl|VAquL2Y({A(8R8~7gVN4Tio9D3eHs1rvn3eFgzHX!kZPE%W{lFot z_fy;5e$_VEvck3^&b%72a6aHoJRFvhrR_Q}b+^Fg!E|1K1b>iLATY5<*z)yH{}E7& zu%DZE&W*kNi~MAi(Y?5qmfcD@9#H$CX`e7|C5xM+FlC0?h|BNd!c}lu^d9+Y0zO0m&{ zZ)>H}X*lrS%730Nz$WdSdg90Jz(Wn|7544GP38)DBsS$tThac++aXbZ)<*{v^0m`JmLWi)$z?tc8ZU{oz0EAZ|fH*SXvHe5kcsqr3-Ed!4XV=H6j z)_Zf>Rv`g33BKM)nbet1yN0IGw7^7P{#>7|I@2-~tKU1#-0a_#4Ocl!O>Hh;bb59C zK;=73yxh9*xnYsh$2HFI?x%IDk#xO@9kRXaDeibmBbV+wMp+p~9FYp@l!PezN93`Y zHQ{4b^E#hfqAr-jf@UMC>2XzUD+oRl{ajlJ86?cJ_|@qbdX`ccCHR5GkEI)$%+~MJ z6duN1QXec`wo}izQ^3=v?y5-oGRtB!`DCWlh}<%VB;i+ogZS?Zo+OGq^~Eu-rWDKf zS*x*)cGlg?5(=^&&TVsRO!3|X&G{+Q@po! zSYAs$EZ{i4XN{{F?#YHPMR-QHi)+fbq5K=oM9ztoTA#4D4PPoiKj&>ke%o@-)8w}5 S)QhkFP{3n|F4fL~ng0X($aydT literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/CUp.png b/soh/assets/custom/textures/buttons/CUp.png index 6c0e29d2de653af5f5518cfd1c6a5d3b956b1e33..aca46472857d3db116e5042f097e2ab27bb7c723 100644 GIT binary patch delta 1138 zcmV-&1daRCSD6ZbiBL{Q4GJ0x0000DNk~Le0003;000252nGNE0B$K9FaQ7ng=s@W zP)S2WAaHVTW@&6?001bFeUUv#!%!53Pg6yaiby+%C}gNk7DS6UN)?M>p|llRbufA9 zA2ex5Qd}Gb*MfsTi&X~~XI&j!1wrr!#M!|~(M3wUFDbNti1EVXeVljC;l29+p;2L~ z*)<8Mnq{QoF)^E46?M=HVZ9 z{7G`jl~*K zK!#?ud;=UD0^>!>UiWx+Z|B_p?P<;L2fGS##JnSrc>n+a24YJ`L;$4#lK_}N1-3?$ zXd51X=m8!VEDC$*4Hf_Z02y>eSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{ z00QtyL_t(|+U?!VO&dV~1>iR}g)9vaxdNO@0tFa}3V;fb;sS6giBkb04P?8>1@Giw zU&2r10JhigebSyV7|m**-poof2><{90001!#~v?#Pb-E1`swyM&EOzklBCp(Ytm$S zwX27>?UHto{5U$x%!mm`c=w@LhPf!o$$$J>n1dLW^culfU;RZjCqKWwZXHu|1hx~5*J%dB{MzDIw%%lGj?jC(H*xrITHy$PJk*CZKkJUd5&B3l2}eLc3rAo*t^Ywd z0uPiP1XB@?!V!3^6OO_W`esp{-B+=0@uC0WP6$Wnm-}a1+txOLSuAWkAsnG+M(1fu zb{9@HnK^h%IKsY7tv4TzCEwfu;RyX~kCV)I(H?6uvzMcAgnqZjMNYLw;RrlzkIS`x z$JYd8U0wI-e{6}x5!~lW^d4V=G`KPf>CpX_the=(+r2XdBH(kZC7$C6on&vgpeF}$?+g* zRy%k%S#2CqlD3v*5L#CR000000001!xFK{I0DxZm1EaN`Nc^1!IRF3v07*qoM6N<$ Ef(ZEcVgLXD literal 11219 zcmeHNc|4Tc8z1FHvKESzX;fN_F~*D;*C<(sMs|{7R>m?jX2veuHc}}sE(l|(6IOCniPQNr(ihtVVz_w&2|b$rG-?>XP+`+d%Ho^#$aX{WW7nUsXG1Ox(+ zBA6T70yPx;h|d6ib3;PjK_D}4hS)pvY)OGoHit!L_|TxdU^Wd(3u4eAkf3Mh4>IDL z^Q5;8_sVlc{eBBp$&%x44gCCZ^__sH8w*XY+1A7_i4onmQ?!~s)KyO#YJ8B`v^F~4 zj?mVGNU(Nofw{F_=wO9zA1oZM9gMDL_1)|JqdBRyhm zfy|KC7Y2{){cY2#`%gA!g=xi{-s%0%!NCU7Op#!2mtRrV1(A?hZ=3IgnGOfPmkV?1 z8W>VbYKxVdTW@f&r@1IXv$;sKBULfKPwd8~2zKkxIrLkX-XJF<*oiiJrSz4}Ym0A~ z-X08x`-!LCzT9z=O-*WBZIBg?j%DuhKbEswDxliyz>$Gk-;$dR>2vPi_iybh?6{@y zq_9c;-Nm~*5#jxk;dR7j{GWA?6bqifLkpRxl`?m&J(A0q{SlmlZurlKi_cY|jX&IZ z;7mGTw~4X?cDjD|G}!`XZIg6&b6(^1qHeLwE$+3X`&j1-0qLF(i}G4@?;rJx>m@Am zrq<4pg*}d)N5PA`mVWZwUw9LjorI-BGMzia*ixcCyP58%W<6K;xJf(h-5Xnte{6Cf z<+IlA*~sD*|JFe9iGSN9Z{%#KbyNmlm8z#g<-Qdec|D2^+$COg2^?=-%~i!K9wr3dfBKU{W=XT%XRzQvVKRuI5zwZjiQBGc=CYq z5ye~8EkW=|r(JvR`hF^k-*GKVc7K^)mD0w&Ht&M}NRE!UalqH}_TZfJE4r_AH7M+f zSPZ%LqGFp>Ggiz}e=hx!=#neJzEQlzQf=D|6Otom##n`(DBk0JXL`z$r(w^rVK%Jp z@ZM9>;?LZJU0t`hX6Kq|^8!rw;;N2&Hu-FBpw7)PJ{lfKF4sBmHv44tXK%@}-W}V; zF3M?FHq|(ItyF4#6w{`>CDOcWxfGpgm(UiFnfhi6=d5GyH62^-C5ub?7i6|~>|5)G zJ#*RHrsO)|*uB*+yI;1~J&-7QsbU`X)(=O5ED?sRvtE^6FQYXra9P?Hg2yqnm@29|Fe!?S?G)wh2MIX;##fap?kuq3b0+zmsn0OuzT*U zSNdjd_tN+zhvG2nx3ouTXT0epJ0glh7oARu)m$l^Ze(ui{m!FA^-%Ptr9S)rFh}Ti z&O+cjZu)VFHWdl-?{(+>-FDbp1+gx7TZb6 z%coaTX?yWYL_Y;#WBY!et$MH^O!hDDt#(N#;!6w&OU>eo!jOTg6`yf?y-hpTw>ue@ zyFQXr-o9@I=Hm8c$;PQ~*agyg@agelaf}Q}VlL!Stfo!Ir*o@fqGN^&qMaSO&HqW< zsQxx%PNk=p;eu_@=<5l&p$V30UcC_1?m{>EDwD#<+>jTidSb$B+=~~?uS+?CvdFiI zey(;^G<&^>OWMIL!}{UqD{=EtO28;VgRO&OI-3m3d8k+RJ8cwdxo&TmG2h0g4*%r=Wb$E37l zEu>xeomYGNKX}ej>7iN2{F9iM+qHJ~)8Fk?RGy(5RjcJHYCpJSRBT_c@MhD_X}49c zC!IANd}#XNtiCgbCl-0M{&o}!-DkYLbEt(*PZc>P?`hxXs@Wc z>z!p)G9&)g`m~1jO|6}4^gpL%Z@X$1;Q7btE3Sx{N#5IBLI~w~_cTNc$~NEH7;;vr zq`lzb-+EUcVzve_Z9Ip>Vye|`PxfB)Q$A@|<-pzNyT9ap|90zpCmX1@6mw-1hM%tI z&dXSkw7C|&(AV;lWOEBXoT6fgZLK`tK+4|uyL?Vm)}!)J$--mPZwF)yg+3FVsT;bX z>&fi=+*-zovUE{#S$Er9@8f4?Q|y!zuhkPbNFaxcw(hoYirJa|vFF59_wX#0a3<|M z7iQjm*Eus7|JMu%@uOzBi@SwxPo;=wo!c7m$16K4)G^1m$Ai(b7&Hu7Chq_0H5x#U;42U1szD|cZ6JlfyxeiH0iq`&#oz%H+R z^s;67%zg8VH?RsSGBrZ=#A0e3t*QCOZVg(uU2qBx=Z{(|K7Z@;v7mBIO2LQg7Slzc z7oy8z%im(Azf{i7PD@sn5s$fj@ge1c>B?2d2~S~!*UeJzkz${^E~*uHYbGW=>=;~z zaLaFO`ZL8`J9=*qdGoV3yD;!&o$sp#>ehHJ-S4t)+KVkxb8mU)8YM;s+~`m&-X(F; z17*3Tlo(e{u&ae)eB@VbZcNz3dV6g7&^^swc(7{W^!?c~ov)VUa;r_tYGQH3GAy@( za^Gjq&;f^zJMl%lvlUTh>n_zCex~ryOqLKZBY)MQ#)QusTuweWp0kiKnAUgGG0`pX z#NS-m{7ayvB1#vHpC{)ssx#hHXowMh_WvAK& zYV*rWuHd}(*X0H%ZVY_qKR3s!RQ)(tCsaLsv;5jnp4_0aDv>(q0~;i*T4QWic`O!p zUt+#x-N%O)-)#CI(Q$d^1EYG+#TLUYSN^silzE7b`6#1Lnx>FgR8j<7>pUjB&oS6M z3V5HxuQim8)RMf~r(ke=EB$_}#*wHx{r=(TU2?Xb7F+MVwyIG)p}YYaJ8xl=%&}8j z3m#jQqi+Oll;EUgyrYt69yW1hN+JDLJ|7_OE9TP6>Tjq+AR^ltMn={IBO}2T5)ew+ z9EUeAUafM=%`Oe5Aht3FOFbh^HnhKKlj$rvEA4!F=GM|QxAIeq2!4L@uCt`WH5?bX zruh4_6-57%ku_6SH<`PrJ&46;Mwdklhj@ z(_fiED6>)TgS?PZ4|@D%RNcB@`gaFvQ%{dJAA?&#`$}O{$4k+B;kW$4- zM0b_C%`0Q9T%Pqv#Z=NVT1`YwJ9F7_$ystPXxp`m8LQeGRXLw$a!OyU_#=)YqHt!P z%Bp_V&z+CU))B7~{#sW4kzAvyw%UEJXQj`;K=qaR>XE}rc@-{077GpzE-rjr@weIP zE)3hRuHps0fg?6AtYV1~XYnfHqExZx4_+P4SzQk=FMRpoacxQ4^nK}BNvz1NM(&qZ zKYhKhtJACNO+D(~P&g#)2I@m6}HMiLO)0k zAn>K}NYEf(A0}5X2oK})>H%%A8v%pzAv|w9%$aBnHDYmSP#sMjO)a=d5Fu+^$>`_z(CDFlqQSgfk5JLIE0oqLR%XSAmH3!CXW;ZXL8j* ziV+TD8kfQWGMd3+LP1UvndQ&J!(hNTbd(&-catEXb5sC)=F@X|R0IKd&;jNH01(<* zT3EQ2He4Hr5Vi+KiNrB$CU-Q7Ks*saBsK!6sfFoFTJj2;YMHs1n73nQtN zF&x{Uvx;T_B4o4QESjS-isZH_`_6nq;0#s;S8VQX?;@~<+ zBpI%QqmbZOlr9-gN0Z4EG>SyhL8ACnU|{tOtqFLTwx-sX9%~;GkIv%w0{ex*q_P6J zUxw@%zBD@?2@D$&ql3nvky==^E*6E>*7*W*q;a@F-h!-1EluRe%&8PTQ-G5Me7JYS$=EQTCjAdBO@j5yF}2>m>^-b=sGAAor;E|v`9e0>SAzkGLnRWYwKVrXk8K&NukrfX6Lf#yg(9% zX6ONIBVe6@O~hYk=(5o~TmCgZ(31uxkrr@Ff~ObC9*NOIV)eApu#we<>Lb9TQ7~J5 z@bDlK^@QW04<0Uh1Tf+3{Ml?D295J|oCJCE9h{K;Xpa8OTo^WDZNy>+1H09ew=R(R zL-`4SBMfU96dIGu`jP9xkdd$my+Htz} zF=QD0IaYXjKhQIiZN8ohfy|l%encRLQsx1jVmt!TMC|3XxeBv?%eb@)_~#kfl>}o$ zd*_)VP}%w}5dbpf@;VPUJl<%izYQ|i`uUXkCT%d0sIU{D1A@}~?j2;YYx|_Qe+rsN zSXfLTDyTtm;qo&_e&~R(_>V+|1qE%;k2ZV(|hN+5!HUbA;caJy$ z_E`pZexvtIhp_m+5e9|8BD@q&n?H|q0>8&QF>P#Qv>^}`)Z@qh&9nLf(eIjl^24*GrcFBh;7sM`eZ5p2uf80=4kVcgwFRf5VDS2bPy8l70^Sgp>Qocdtq?_Mz~K9iHVj%fEU*LX#{>IE+Cz%69T(wg11xI6W|Xi zKPbWi--8Kb1d*5sd%CEP-yM7QoyhlJQ=^tv4qvv_L`Up50?VfhWxdol!-DX)cMtN% z#vB08=Sc~CL-}>b&ywzIH1Ov{K}TwUEdOlAYl8n>ZR%w*!r<)V&cElAUoHE{*Zw96 ziz`M>sL8qj3QtvBn0w3tQcU+)G=u@)YfnX3uMRF4-O zA9?}VSOf$eg1V~y%SBSqH<=m~{+{?m_TNMR1PP)5w!zDTA@awGIbIO70}Hs{g>OH? zp&vm^umpkuuom1}z_!K|mqc*bfVQU!`X-zxIQHEEa1boQPK@+?-s$>aaQR;L>Hw)Of2?k2G%< zS<6}^n4n}5T%J|S{1Ipnx~Oc3wX(Yo6&{L?F-x!q%iVH1bY0l|3%GOSE%JjUs##yF z`q5hZY(#c&KdXfcJhOEz8G(rvQ9Pc{96g$akqL8Vb!dt}EUvf}QmynoryXy68$<`n zu^cBOBCoz78Ou*g$1P;wu5~JQ9?yD056v;@M3K&gTbsK6EgYxZpx4CfZeUlo9fzOS zfL($fmQ6UM8*HE>uYD)Yq^w9`PQo!=hK|W*qLOM>Xg3bN_twEy3@DgGFIcIFL5|(l z%omV=jKb_LK4+WGvy_8)NCNGXc1)@}$i65AYPPM+qn0~nPzhv#qq*F!TC?sbs#C6G z-SVpY7>)}3xHXOP=9cbt*&=V=#YiZF1jpLC0x{%oQN4#;*vRxfv{YX8{d1rYvwVCH z=q)A}-}e;5fxg&x_MvA@xF8fNFl*W4{4FFHzcBt|8QZrCZW1SSHmjzD^8X^@b^&1l z6aZu(wyaZ-~TPgDyS~@fDo+InuAXMy`Qn~p?UHwNEtAIAoK%$D2t}tj z;r1sY2|?*wn;OYlIvua%uX2*L5yKmcnH3?wDhRRiGOU4}*^REVWj-DEeC;);%U$Z$SAn{&mVH*hH+I+C0{t5q zb52X1M$SrfQN(bj-ig&>w#FDQyKA!%RwGOF(=;AuV12d5BKI}QCdsix!Fl+;mxH`r zkp1VOp>Xhh)g=bQh0<@9+rxcVVcHJaro|(ouMpcITlDp|lcV=s%Grsfnh#W$(px3h zb6+IvD%E^S{*QRW>*KOn*fq}j?P}?tguZ6oDTh}YeLmF_#eq|IBx0y~M(vQG7jI(5 z(^y+d^n3R{PYut&PtLYOLXx|(bOu^cc*QIRop0E%$R-VGFkTE{QdIo)aP!L4@fKT3F6A2gUY6p9QBA}{)+X&|s7 zw9so?-B=+Ph~OnU!EV?%4ADiOFu_w7UM# z{zPrWc1_89<%xynod`~?PJ?WGJLFz$N;8|ZVb0JE`ht5sY?7z8oSZLJrX%pnuJ|7b bZO&Y|BP(K(_C3BvKV^}Y))p1#T%!L4P5g(G literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/DPadDown.png b/soh/assets/custom/textures/buttons/DPadDown.png new file mode 100644 index 0000000000000000000000000000000000000000..cec0af1e5575f8e0e6eebacd062afc96b8440f5d GIT binary patch literal 946 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcc}gPR?K3xGnBC9V-A&iT2ysd*&~ z&PAz-C8;S2<(VZJ3hti10pX2&;=uUs^mK6yskrs_#zw&=1BteW_OBGqIUd#GJ1DDb zdeial0l_shnq7C?2tKh;wsM};)$%*lih@A1hXg24ILUJSdTH#<;yM}k`>a>3XEHd* zFdh+n5H2o!CH?QR9p8P0?tlas3R!*}nw{Lb$FOO(a)Sj^2QEUPkKs|o)|)H}eSgG{ zx9@b2SsmadSvIFOibv_3n#I1%Sl lT5l@YiW%k=<>Tg(=UKIn$db;|#taD0e0szR&GfMyf literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/DPadDownOutline.png b/soh/assets/custom/textures/buttons/DPadDownOutline.png new file mode 100644 index 0000000000000000000000000000000000000000..e8dca39b69449bf33a532f091d6f9649b21d72fa GIT binary patch literal 984 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcc}&ApFzCIE#bOI#yLobz*YQ}ap~ zoQqNuOHxx5$}>wc6x=<11Hv2m#DVd>-qXb~q~g}w+Xpib8;GzySiY?}g>Sx**RE#P zea~{$)1;G<5{-`USAU+&Ti^6FoAVg1r6<(-Z$LXOsLi56>KTe%+j p`0Ui)D^cf{PT|*N#0=U4&hyXc8F6TrX&HhfJzf1=);T3K0RXK7P$&QZ literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/DPadLeft.png b/soh/assets/custom/textures/buttons/DPadLeft.png new file mode 100644 index 0000000000000000000000000000000000000000..2a4a09b7983c12c9ad6888ecdc215309386175c3 GIT binary patch literal 929 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcd!iLYuM(m)}}64!_l=ltB<)VvY~ z=c3falGGH1^30M91$R&1fbd2>abSE`c)B=-RNQ)d6OYQU* z2g5Xu`aP1>lRIGeA&&9nnfYhtp9MK!NPq)w X)7&PfTBJQk1f;>!)z4*}Q$iB}bC4wB literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/DPadLeftOutline.png b/soh/assets/custom/textures/buttons/DPadLeftOutline.png new file mode 100644 index 0000000000000000000000000000000000000000..ba3dbf4e8a15d38b6f7407087d2bd118069aa753 GIT binary patch literal 953 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcd!F1GnUgMmVlC9V-A&iT2ysd*&~ z&PAz-C8;S2<(VZJ3hti10pX2&;=uTx;OXKRQgQ3;t&O>d4Fp&(BtLPSU}n zGTnC*0v82tI=NHy#j#!nMnXMYuq?W41AH(&pFXa4W{ zuD`_xo>)x!{`cX;&m=m=T#)oydV5>@~Bz};iE)qM#?GHz*cOBqg0 y^vljYeWqK*!LlfR!u8Bqc1lT;K{<>FV6#}ds6*>{pk|&gNVTV{pUXO@geCytfi*V( literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/DPadRight.png b/soh/assets/custom/textures/buttons/DPadRight.png new file mode 100644 index 0000000000000000000000000000000000000000..e7854a2192b6af2b3deae8700e4baa3f0f300fb5 GIT binary patch literal 922 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcd!CJvXvM4*sliEBiObAE1aYF-J0 zb5UwyNotBhd1gt5g1e`0KzJjcI555oJzX3_DsH{Ky;1OxfdI<^ac4!nqiZiT%P?<@ zWeH(gx?{4s!a+3_^-p<>TzWey|9S`lO&${9!UUzJZ@h;mNXy!~ADJ`rdgiQola{Hn z3w~(UQ~DKjYVoxyG4@k}*TN?R>219hC#2#2L(k)~@>z?ng!*HJF>hx5-!b{klJ1j& zQc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcc}bN4qb%s?T@64!_l=ltB<)VvY~ z=c3falGGH1^30M91$R&1fbd2>abSE;^mK6yskrs__Qu@91_G=Xk|#LYbcLVf6IpPs zOx;21&`gzkN1|L7aGRS=KG6E0t!n)g2GRXL9t5Va0Bsl&z(l2UL2c~ysphp+eH}Ze z6wO-pQYka)lOj{t4c8-fOTSDmw(DSi%JG$B(j~*^d#1CT608$na#i{450Qi4dLIAS zay{m~=e76$FMt1=7db84G_856@@+Go!!fo&eH!izPdVy8Ft<&+S$t<{9 literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/DPadUp.png b/soh/assets/custom/textures/buttons/DPadUp.png new file mode 100644 index 0000000000000000000000000000000000000000..8d70d96dad432d4f23185bb474e9f62bbb4faae9 GIT binary patch literal 968 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcd!)wO;{KyfTt;u=xnoS&PUnpeW$ zT$GwvlA5AWo>`Ki;O^-g5Z=fq4vg>lo-U3d6}R5r*;shULBQc+tTUsYW2wd@?M9^% zLuZ|@PMi*ltX@3fm?NQNoSbIxJx(Kb%fajCSi6803_j5CU#)k6>|+bQnLE2X9v*+} z?Glr<_IKqx|79%q!`v>k1)VZ8<`=wpcki#B4n5=TwfB#2(n-I}G&|W_`te8e^z60q zW*!|s44T;XHO!pNe(s$Q&ykIyhndr@A2Su^xPD)|u!QI$F6j2m(bnQsWMtcW`7KC;r>mdK II;Vst0Pem!Q2+n{ literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/DPadUpOutline.png b/soh/assets/custom/textures/buttons/DPadUpOutline.png new file mode 100644 index 0000000000000000000000000000000000000000..8ad2d7959750842c432eb01ab039b72047d1f8aa GIT binary patch literal 993 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcd!`D`cI9Y7(;64!_l=ltB<)VvY~ z=c3falGGH1^30M91$R&1fbd2>abSG!@N{tuskrs_&PLxO4gwArC4CsDB-|=U(R$dm z;j!?{rKS2)7*y6Bo~y%na<1|Oheuo9w?6Mx`yrQKAPBT#@PUHtOB}ZheJ{_L`Mg6y zzwVxL()z9Y*1Z0e=k;N!ag*7Z&o!scT<>_n-!G@M==_<>20R;cZ?|VQp53^#_v2gZ z^z60%W*!|ojGNf*HOxG3Z&7V#C~!Qi=lI(VQzk8)@@Ch&j|JPz^?*V#tnWWF{**b6Mw<&;$TX{Z1MH literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/InputViewerBackground.png b/soh/assets/custom/textures/buttons/InputViewerBackground.png new file mode 100644 index 0000000000000000000000000000000000000000..091d686c0006e444615a666f5e297103ff343b5e GIT binary patch literal 941 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcc}DJJ6^Wk4ax64!_l=ltB<)VvY~ z=c3falGGH1^30M91$R&1fbd2>abSG6c)B=-RNQ)d#gLIff#-n10X4RYfWyYjKU^62 zwz)X`-vH$=8 literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/LBtn.png b/soh/assets/custom/textures/buttons/LBtn.png index 2e0a8f00c3b02c2b5d254311bfda6a703f13efa7..351ea383a7d97df9eb27444e5bf5d6a4dd18b64b 100644 GIT binary patch literal 1031 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcdUHTkS#KzRnq64!_l=ltB<)VvY~ z=c3falGGH1^30M91$R&1fbd2>abSGk^K@|xskrs__C?>r1`@3o@4r(hY3_57SfVtS zrBujAErIzIo2(*F&}?=A{tph)OG3Dw>j=DDU6tzX$pW+k6Z{F>b*=gLzWD1=@1wJ0 zy;gn>u8~w$3i4{7a%tZbBQK`^DKgt{=gtqRn(}|mLY>0~Z#xsG z=e+mQWLHf%_W$l3{xw^z471pdef+)BQ0dyH_?*8t`63=!%=1$}Z1ML?#cC#<5}9Bx z^GW`fqpE`$#jN@)pNF4Z9=SG*T{L0gV+r~7%X&7&-#h!eZ^MH^ouxgN&*#1opTEPj zd1rohvHgb%o4(m+)sz-Z{$IX!>s0h!~u;e$N`HuDdzk8suV6S3j3^P6 literal 355 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCijK0(?STo12?guU_r!>}+jqU0+|neEIV7^78rf=jZ3=o12?YpFUk*Uq3rL zJ2^QyIyxGt>C%_@*FZ|3B*-uLKPq5&pd2d+l;bS$h%9Dc;5!V$jK}j=qyPmMc)B=- zSom+fd|RklfyXtFOXQ-{&;R>#g`8&j9e(g-Q@qRhOXjiBU#uT2(@kS4**imU#(CKl zH>=Mt7u>fdj^FHoaY~cK`kK%F3Xhlt9!se(G~ZCj6!_(+w4syZAe)lUgwNMl1sHCe z({_0vu5QZ$*1w7wbzHiqGTQH}%=ug0MN4vl2 ezQ4t`d}Ac-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcdUB?)$>ETE8NiEBiObAE1aYF-J0 zb5UwyNotBhd1gt5g1e`0KzJjcI0FNdgr|#RNX4zUx8HW&F%V%5@C^2t!?mo%qP61D z%9NX4i%#$^Y4)+2AvDKH=k5H|#62y4nb_wPO9{j*JYLJz4zvXekQe!X_26TRvaQ$h z*KV~tc4K#!dNGIM5ea?6W54Ho))D&Q-}cymC%Nb2?jP}{8pWDV<3u)merVB`9H0GH z_1AT8&Dyh;@hXhc`*yG8U$Zr<$B6mt$EDY9L|OY^o)UXB*zN8noxi^}H-F=>&g(n9 zslB^S?J+^%Az-37WioX zjpIF?C((A%^v=4g%P+rNx3z5Y>4yayf(}nh&3oPc|Hs+DL&UjN*C0 zUg;b6?<_pcV^((K*MZkxt>pWU3pl+v`hU~4TR>&OLK_}$t=gNk{o1>%wR7*Y&tHF0 pv1LxsuZQ0qu>{S~5PDE6$FOoz^>L1~oSq;Td%F6$taD0e0svfcg;oFn literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/RBtn.png b/soh/assets/custom/textures/buttons/RBtn.png index c255643c35893d1e10a5c7056459a364ff8d9a16..ecb96bd6c10fe4736841b2ced7f1f0f404adc657 100644 GIT binary patch literal 992 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcdUA-j7<$AChTC9V-A&iT2ysd*&~ z&PAz-C8;S2<(VZJ3hti10pX2&;=uUc?&;zfQgQ3;?T5b24h*ah?rr1{-q7?`K_Tw} z+cD2BgN_}IiA*vrarLvqfuw7i+N=^5Ecta}*$Y|qnDFagcgI(Tt$kZ4(boKwW2Sc3Bh95IUXT8D sT`X#muCV*Dc+Gr%CQJ_u4Us?f>1VD46sEmde;?#vPgg&ebxsLQ0Izjb6951J literal 379 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE3?yBabR7dyjKx9jP7LeL$-D$|SkfJR9T^xl z_H+M9WCijK0(?STo12?guU_r!>}+jqy?pud`ucivbMx}@a(#XM`Sa)J=jTtKK0P}- zJ2^QyIyxGtsej3mM?gxTB*-uLKPq5&pd2d+l;bS$h%9Dc;5!V$jK}j=qyPnXc)B=- zSop7B*A@50-GH zDcompl@4(gy|8%e83*+lrxFaG%}#jA`GU1rP=}*uqU1!qz5^>dH<%ID@VQJw{43z!zQ13&09ha znEf=GaFs_#aPg*lza3l(Ok7<5=~>MCuOr$1M{3Sc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcdU-p$wSje$avC9V-A&iT2ysd*&~ z&PAz-C8;S2<(VZJ3hti10pX2&;tUK-oSrU@Ar-gY-ac4(+kuC{p~*{eje~BBUdxxI z%_R#0RnwL@Eh?E1$m*jg^68{=+LIoWx~F@7KmOYw-Nf*GT_(^POz>c?6W4?L#|rPH zrpXKL&Dmp={!B)2`Qe8f!et&dYb-4}y=jj|*LTrV+j8eG%bb6Z|-X>xq4yH%$w_XDYX`+&RS-v^zHS#jkEZd=(g=H2`UJW6LDX$ zr+7~I`SVMs#HGdcUp>9)P1xMWA>K9rEDz=0pSA4e`mW@YXN>w5pZQa`GiFvt#QMK0 zRPCP2JmfuWP*XnT`NF*4B{p*Nd#(oTJe&4e)!5(Y<43N==LFw9`1N4+s(p4Gm|-zA cL_Ylg&8sL=9ea7Qa}mhJp00i_>zopr0ED!F1^@s6 literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/RightStick.png b/soh/assets/custom/textures/buttons/RightStick.png new file mode 100644 index 0000000000000000000000000000000000000000..6b8490aafd7e750ab8e46ff435a3f2196d94e6a6 GIT binary patch literal 2150 zcmd5+{X5g^A0K6kZ^v21iVyl8=QxBAWkOR7n};0oIP3*Zs^&e5IY)5cun!8ZM18;n1TrJ+?A+0IcE@7LBtk@V7zCo1dnMP#smJ|r z<^@kw?sX?ChTf$rH#K`E0;9?d{_~-#e}W0^jkbA&lScrcF#c->lIf)g565W+D4ct* z*gM&c9!6n0jP)NfK0KMf!lnwOom-GUe+l7Cp4wk^C+z;5scA7*l^!VV(SyS5FNRi@ zIvEpY{em{eTod3@zv(Nf-n>67j?Ny+TDnd2?bYZtD=y^I$`HMnKhCGPS%vfnLLK9()SWOG*rf{r|kGKi=j zRX+zfJ005(I~l2WPhJ@|b;`r#{%h-3QtiZTG&Z{a1KyGSpm)7~+E+yy5 zo8H}e+Jfv$E5+UQYn83yMZ{9bPWUV)YOCfz@Ta`>WUR8b+#XTa(*$hZM%tie@N4v~ ze+}erKfHEcE(v*$^jxkRdzUm+f_)1-P_g}uz)jf$0P^#w=YbnZRML`oM;0-(s@SeX z?(NXYp@F1cgP{`*!6NT&w+Y=Tn;f;mI*7Ov6&vw*oB= zA(T3vKfhB0b#CBSFE6vew*Ply*2{TEq08CQ+WJPm$NhDKWHLWDo;5h=EZw)g0cdKX z__W0+GT&4^`9`AKjlo!*y&pa-MR$? zzUB3DhM)|o>^PgS{4trkCx%M3fM#?*A3p%ic+}Zhr_3FIg1yj=vD&!{vXy$}=l+*>TaAq3pvynU&huuo!Xt&x4oEA7?Rse}NT} zFFf!p(0QK>06?#(l{5~WGZeddVzdb%zWs=$6dU#IvtB7LJ=}LTKj5R7=1*Xk?=N3l zA#aISH>^hAtT!+w=yN9X<$9k40zp4hrEtm86B8E~*Hpl3UaW!M@ogQg5Xn|tAB?UF z_VqCse9D=xQ*S?>txf)=gmyu?FB;b>!W}J?5UIu$>mPGlgO=EemP=oyvA3_6C*6vl zzR9==i^Hkrz~ZK4i5ptVukt+>O(Sa3;apB#33p_s#(#mm*8e$l5Kma$RUcf-<8ddv z9(*4&|4^$y$9-^MV1S&!ZL~dEj5qWt$dJZv5^*LD_Uy8EqM6!AjN+T%1J+o6mjPd>Zr>-7`gIQHLQnor=i-q3DIAy!)1{isSp zOwD4DxwJ3OCa_?X%i)`fB@$e%x>d#O_9puS!6@;w*_pMcMV}{_vaiF#xv_f#y@e+V zGCN0BoiE_Vi}1CFa#V%$TO$)qb>F07psA%*uUt+RBBsYCESHKsoL1|UdN_DhRu}VP zwklS^s$zVXl+lxF(E4&M$l>1bNK?%65A7f;083SF9g9#y#WhzqiDaLWT*LH%^xe|G zrqLUE`UeRoU%XLY?C+uumbY;AAHwk?u|gH0GB zk!Wg-A@XOySX~aspS_{@TfN};OTFsigDiVD1f!&+#2=pe%o2Gm1QQ{n zlljAu-2b{z;5!mXy2GjJy=5K|N{+MIvW0~ob@R~TnHh`7Vx6n9`RTqwThQI+IRp6~ z0RaIWckpVUNc3)JBrA~q$JT>KcT{Hk3r`<=cQW)_5RG!PuRkCB>p%IZ B&b|Nu literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/RightStickOutline.png b/soh/assets/custom/textures/buttons/RightStickOutline.png new file mode 100644 index 0000000000000000000000000000000000000000..8fbd54fcc36d766bfb97b99365685f88426c4dbf GIT binary patch literal 2407 zcmd5-`9IWKAD@w>lDd<%jOC$Qw!%ebA}S{9*vAstmvHZxX6$Pc4MIZ1kbPf5LqZ4@ zGAd1@8M2IK40mR(D?8(Ud!FaF=O1{^>vhiSyxyPJ=X}=l{-oMinTQ-ceG~)&iI|xh z+krq}6X4!*SP(eT%1{jeNDeeIvN1CKv&p^s8LZ)GTrpk8z(LR1$<3J9t-@n5z5Fxp-`T zMuthwyL^jFaO``edumQJm05sx9+Do?Dtb(cdI}pde{?O@O5f{)K&o8Vh3>sKT}#jU zwT!Nx)v<;uNTkcCMQEs=Qn{TAYpgx}UDzdGoa9O%n`aO?BOX%kf>i^XCr@96TA0co zf&3PvRKX_9 zaHL^H$S8QgwKQbB*mVV3bK**hKQZ`;&5!ziFG zg5DM;#-J)t4yfRYK*x0eIf5~D!GS=+qCYnnR7j8lK%r1GBtmEjEGwxh-c|Pa3;>-9 zML35Vh5Ye{A379dg!S_Z_4AdF2n@X?Z(@eDaY{Tc38)#E8DDjXq_SrW@lcA4&|kB( z%f2#%exyb%4&!CxrK`fPLU?l)oQQn%27I5!TUZFMqSrUv`=a(v!zKn*a|8Bu1 z9~pu%c3&tI4{PNxJM&^Zo`8FTyAU$_YM+SVkHQ@Dq22WqCo6_n%?9w# z7j<<#wmIG0OOTId%Dv$axr+q3&KphGz`(kms5OS}Ysl8erSR^Ms$56Kg(St2Wi$#I ze*v0!U=bV~tbSfyy(RN4-O8MW^;xR?A+N9cWZJaM)}S&UDvW6NaDE zBdv?>(L9}T2~`zYR>o3N5QH<^l+x6L@)&tRiT*kYR1s!mAx`!=jg5_o*;SoCOfc(p z=T71yW1jkFVM*UdN6ov4#Pz4uDXy-r>Rb-T%CSwIjr%sSv(M9e4T0gr>5=-pwz82~ zh4Mc)cM}d0nFoHPt{fb1yys$*g9`qTQLwL*DgHR+&`=jr34m@??~ zev5>IGnLX56cjo-I}KCu)-Pu`4X9tgrsC7rHI0YvtC-ALI=i~Yu=cjs4l?V4AHbQj z;)qpBG!5NJlfv&N`?B4*HMzXs!j@R=0Tc1zZt2?R4}#`29_Qz;q^nym54>n?g#ZzK z7?6Tw+oid;NJ>jft3z9MA_0|aI*)z+1x*}u3@@gZwYi_qyk3E@oT;F!AnZNpt1lFx ziS`tB_-q<}jQC9L#H9=p+=K+**^dXZ^$spqIq@V8g<^aUvJ_?(Dq=hVD-)XQix%dr zZzK{afv_M*e}9XzW5&7R9K+c%gwSkcl(^+d^O%U+*)4k<&y<= zDm66&?bljoxm@W75J)F_rqC7ng>>_a0k8CQ5r*ID8wS?sF&pDBgVkE0&L!3lyMSH9 zhTq>I{IH$T+rG8a9+V^ul&@!J!DN5OW5z4#HuaO;+W9H19f{2Tk(KanF1bTSx~Z`- z7m1?VT2@bKy@5a=sM(4-)_yRh#UsH9#&@os>g-J|Wx22_95N=saBK2rsl+?sCfQ`g z54Ymt_Sb9Kb2Hji20`Sh&}J6xp8tdS8#<1FRa3Ha-e~YZ|P^DiTm~KJBl$GMVF7=A531q9Qrs=rq1T$sSR#$>4ljGfjCbsHpRWf}FwCZP_GRLCiOa28>irU3@{^&>rznzKCm(Sj z#De&gmu)YBX2lwzA{Gq-ihWKFp=Q^W*FCfQTwr{=)URK+Va&bAWt*6Yh)z+>7(^6= zOmD6GR+E95~M(hQ8~nZ|hM{lt<&eSY_&zzvY~K@&pceGa8#jO_STBD5V#w{z@U5tIn5sOp_k{oB z>P?cR`p)~vlpVBAM{=7e3{z0gY0CX%7&NfHHqzi+6uwq+{AIaPNndl=$?{!d%T9t$ z)sG1(vrj2)0hgzU2} (r4~HbCfY?S!AFdw%3n*yd|bwbx6pkw`FvYe)u}zqJcIq zVwIlUf64TUta0~D331(JAI|-ID!wK`2O|{|6O)9GycD+N-ARi}um!`TxR!C^JJ^l?is`CT%L{I-Wi2a0uJ6KcnUHh>60=zKdt=3cc98$*^wfphZ>G- z-6%E$eq$LxG!OnwG_qNJ1Zg$p84KmS97&9fV_3S)IrmtB;JD}m#>U2m6F?aD(Y@bl zAgdb&&^1S2@p+Z&bfIT(J4`j@t`Itm7`g*py{AoMm&uHt8xF>h!TD!e zvRQh>2zOmnYL;TTegwxY3Yx_a^kyR}hl?UF65&WrP3~xMadFnfXhE_f#``~W0O?q% n$aG^6#t@u2k^dQ4YSaX9!QkZTc|kSuPoWvY%DDNO=iPq*Z-H#} literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/StartBtn.png b/soh/assets/custom/textures/buttons/StartBtn.png index c3e08dc3600853304c65a79b2ba937d297c03c78..ec85f261957998dde16f4ebda829b14c68527681 100644 GIT binary patch delta 786 zcmV+t1MU3WT+Ii6iBL{Q4GJ0x0000DNk~Le0003;000252nGNE0B$K9FaQ7ng=s@W zP)S2WAaHVTW@&6?001bFeUUv#!%!53Pg6yaiby+%C}gNk7DS6UN)?M>p|llRbufA9 zA2ex5Qd}Gb*MfsTi&X~~XI&j!1wrr!#M!|~(M3wUFDbNti1EVXeVljC;l29+p;2L~ z*)<8Mnq{QoF)^E46?M=HVZ9 z{7G`jl~*K zK!#?ud;=UD0^>!>UiWx+Z|B_p?P<;L2fGS##JnSrc>n+a24YJ`L;$4#lK_}N1-3?$ z@f{w2=m8!VDm3iVw>tm;02y>eSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{ z00E>)L_t(|+U?xIZNe}ZhT)G+;!T=OI!Z=?O#+jIP0S&w6sbss)(0zj9_hdO@E=~; z2uJ_`0000000000000000001h#mNe2ttKUZ$ybtLo%?2Pr{rQwz@eg8ld&fCmlCbP`}dk*9DhcJH6*#-g6>F48lO?N)5fPebz6dP;pT`qvO6upR;&?m1aU+hIe>eEGcMMMII=g_P67+!NLOy1oB`06nw)(J9N=dm z9E+b10<;OFKb`;%70A(38sK>(hxK#FX>&`Q)^HXZ0+T@^WRp-LQ5W9u0E?Lpn2Z4b Q$N&HU07*qoM6N<$f@-Zr?*IS* literal 11868 zcmeHMc|4Tc8y|ZaWXTf6n6fu!##krH&XlEW*)_&sEHj!J#$G9oO9lnoonr^gau^rdMg9+J1JGn9)h%7`Ho#syoAtRVkVPph3lHw18MLsFcSfA2` z7q^%=x66(Dnwv;SO?%byO?KSNjypJKN@I&vw{V*vUN>ci=uC_^J50RHS@T3)!C|kG zWz#C3*mG&SPd8VduiW!-JZ7Tw5h{LD#`8Y3pqD+gG56HQjdt+nQseRVGN zWTg@@Geec~IC z_%p-I5t-uG)k->-kMO)rjaA+r6jrrE)Yn?^)LPR$nxAESlhp+4Tf0;26>AST*eSIR zoo`mG%c9>^dgQyChsSKEQkv)L!q%eOCTSJwgBrLd-AA!-RM`W%MsdW=ljHKyLxp|b z(MuvOaoHs6->c6{#_u_dsQrLz)W6?Y+IS`DV$VSzVr`m>H@USg_|W>wxNnJ%8hdoE z8YvCl>(cReUOgsd`C?g8^PBWh{y$XS!ni_f1MqSq#gTTgC*bwH2^RH;>+7nM>cVn! zZfz&aKd&$xTOaSJIFa^zD97+*P58uuW;M^Tr?gd(q1M@h?Iaa=?TIJ*<2rIKt7o2C zc=7YejZt2qgKKnqULHtF;p^U$d=G!zQ-9I_2V0ZN?L1zLW>dR*-Z>wHXJ|O#CZq$pBM~`+p~I;4d&*#Zv4wPZ3lTHcQ&0K=#H&)sbSRED8$vo@$WzTz+jta zv#uytZsc-fCatx8@wykRqUU*^si~s=uj@zd)Z--W?H-!%9dmaqIEYX@bxtnVRk(C1 zAHuk{=iCv=L1q?Dev?$$Mpx__*|_Z*AyNy*74o*!J3lQG%?XqldKscZxTkA2h`LRc zz+E`OlaZXlMM>c0rPheX*gNMP?z>@#+#(^20GPF29()xV-H245?-b!9J$r`!yvk@PoZcVnu?b z&FkRl{7%J^ve^BdFvO*0v)l_Y zhOo`aX9&jPw>t;01dV9tod+$k=||}WH(J;7Nk*0o)+?e$s}$3cLff5JC|U4y1rrQ0 zry5S3)S35A+ma+!VEf_Jk+$$V&u)BOs4A$t;Yfj8<33k<;W}PZo`M_OQw_^LZ3yny z5YCyu@{#qEk0q2_CPT8zu67n3^?t?gp8oLNhDX&odTy!J`m0H*5D;g_* z?8jNQh`U^FE{<&TE0QA))XAF;bGO}X8lZO+sJ$?7cZ6@c;#NO^54Txr=yoGOqoet( zb|B9{-hvkRP=oHX*XitJ+tf<;n zM@J4so3oNMv)xjzIEj}Ktek~Ag98&We4R(dx$j3LCX*#&yIP*?F@pIoBwD$nFB2#M z=eG=86w99f!lOpH#&7eteUkI-YuyJVK5cLl6hZH@lkJQP=so*V-P*151=dtXt<-D4 zwSVE4LMrL$9oUFT4>B#|NJh;Td`cy^RKAugR#9!Zh$Y3dc!&B%bXTk)KIWFs)~_Xn{-A$dViRd@1)=79G1@(XhUSFTq^i?Gl_K^27<* zl@;D%rys=2M&)5;`w${KMLupb>OAw(hqAHl%5}1K1M7T=U>U8SX)ES(JZ*8; z5)|E0bEnkipo)8vtxB-9m1sg)`8*gVO+TpXh}b#nXjhS%KTzFun~@=psEC^eBt6G>{pTBb=xayQ#NUUhzngSDYHmaNpjor%;_ z-kZ1cdN?6q-0tqZn$&~?SL_7Tx|W2betysE5r1=H@3&FZl~G|Q0zqoLUOxC^GjIHj zlCQ9c1@Q(({LcB-qdKczd>C0izLmIul$TccfoZ;GUVzGnmVHOPgc?L%-BwM?%sEh^ zA}NOd=#s|w#Vt=G_dcAO5T3r{rM!aEDsRKr{MklBXOTf2?rSQ7RN!4{9E za`6@tM6XFqP(oO|VjiC&$eWM4MTIy&7cI6C^0sOFYAwJN=`@5bUCc99jgEIcf4N9V z+3GgKs(1YfXT=FI;}b5CmB>{UbnU~Xk0XR(B?d}PPg28QeAL%Eldg2h%>r)85TYHq zaFWQFLj;@G8>+Wg)^vz`ZvGJ`QfCv&}b+lkiw!8dHN3~67PrW-}TVYlbjOXsDW zedm?ZB#r)ZbAF{~?zd~*PgC!u*ti&r$t`jXWbLzyE!>>GL$1bN`owF~)c8hCjSRJg z9@kaGO@h|gOCL(&db0O({{pkk1y>FA+LnH3RyIB`*xmch#-1m)q&aR`z5n9X?rpgdqg56Qcf+e(t>u~O1$VVg zjKdlBUWxRVy4O_FWaU=Z1)lJ7PxdOQK9f)XU_W-GpTBx6Y*C}B-dQHn>-b1+X%Imb z@%TPv(Sf_UcVfPpzF$mhZXAjZ`*>3&<@xp23~q-zYa~1r`z+i~Vb41o-GsGkzB7eY zoaSll&fc<6;=X>Bb^Gphh%jcbNr6zq3qt;5gh9eF+x=q=z1yCje*H-ON=*54*P5@- zxERd97uI^a3+~1aK4}d$9Z+3@M}1Cg&Da+>-XwHEAViT~d2MZHZ--u6r26n-H0unm zvO+OTM^NZMX#N-Gw{6RoWaJiBQS9FrCR)=ZTBM|Ma|$1Y^1Ngo(2#x|g|^^3U!J3e z`}E-3A7fnoGHQBU))!ry=Ee5Dv*>CX8F;8BUKE&bIsaZtL_;S%r8AurubymiX&~Xj z_@CnqOSdKjyH3=VyCMX)pbL{W%v+Z!FCN`{Evl;oZ#|$kYP$Z4s!L$xLGxWJ`-S0q zZztI-b!J=Q52b>0Z_Ojp{UJAwFPB;JIE9Q0Q2_M5e3^(Z_dlxLGiEGoHc| zigk?MSs2*f>Y?3u=FBPOG_ouZE1ZnR-9z2VM!MGABW@c*%W@ga048W5Wx8KOR+IVrTkK=Kqq=3dQeZK+`UlXUA zbw#ec@Z-fTMOzz=`?TaM5;ksJ=m{5zU+%KRGb=niOp>>1fvA;=iiNb=+f9UAi)4Yi zuaT^gjbkFB1LPBjmq=_bayVpnsW9Z|GLvvY*5yS+H;Ms=pMz3_onNx4lBBQf>L<+pe(Gc!PA{ zgOKs@$7OOVnAh~F7jyxc*n3K5^ku7T6>|ih zHTP$pH-3(4sp$Rqu%qr3&%P5S2WgwPnr*mX+%_mbG8{DW`Z=!YTRbc_n|>-@=HMF` zY=JWc__%bnwZW5Up_)WLnlD*1GBgax4H(RDRb&{E6ij9!e8~Y6su6PJY9$gu@iRiM z*RjRehMAEADb~?+vSYNJ6Dc~FWZ;KfwNlV95)S}`l9@zAWM~MLfsZsovT^Z18x*6F z2(}6{*a+!ryB1+aqmvQZn%bHeltm;ZLJPT45MfC7^T#`wTTVg%JtJfwlNp9bqggDL zCJU!YqX(d|1_lObj22o;3k7JP7*SLvF%m^(ECnIHW0;c}Bs!4L6dDx)ViJ96;Y=eW z5*SBJf`jR95eWz<3BW!Zp274(6M&93Fdskxt%bqpqcB=1Edw;CJuqr(J7rB}Ohyri zCpwZChQ?}Q(4nC}STL9t5r6Z|Xu)s-zVXoxWCksqP9j@Gkg3e2oTOnP;S5gBa0VF^ zvHcG5^G5?tv6(q-tO&Mir)Uh~BcaJ5gaJm5vU9%kxC+iPyo0l1;8O<^?k`iED43x!(jjjEh5U-pNv6a zb+mC9e=QaqK9$--VSZ#k40I%l< zv`G5C25cxWuy~WT1S6!D=67(mWNiqM=})7F0{ewR^`o&Ee=9ptLdlLyA{aKTuC|V@ z4o1&FPaBKV)8#;PA=4Q^-h!xDj3!o}ZSF_HTLPFwAb%*K!~ilnj2ZyV2X96v6PYx+ z6O9&Pgamy+fTrx-fH0iQbG!|WL zIFz;?&L5?XHSkCIV)TGi)A7?X(9& zd8YQGH>^N1m_!)hm;_HRoD)_TkHz7!ddTmqjW9%mMa6rLD1JwjwlUV|8r2k`?%)b940|5Om$#2E?-*EjKuHTBlZz=zq zUH^vbw<7Rc%Kv89|14aBe}5~Jsla<53-}Tqy6OY`gBHf`yT-~KHUa(|tvHzqNalxG zyD?xexCHoc!47B1073yK!PY{cms?s=SS((9ofixyszER}adMr{g%Eu{!Ud@Oc6kH? zSf`bKpl<^FA!eF*&h9T8%tXqG4mto8;J@22+h25MP6uWp<|Knip&BITEOR+Bs{@?m zvypNVLT%6y$c8*iG-h;wlNbbqfFST+sUZh|zXwf~@EIKWhXb7C{|zz3#<>)aAt6vt zcY>Q^jNODtp?doGf74f;#ps6!RL-!yX0e@hh%*9^A`}VEC`?756d<3;2r~X(*1I_- z$~zZuD4+nIa$o`5P~ntuw!!folS;r$*##t_0gou~fJwylAYA`{ebp~rN^P%Jensb&}9RRICC!k$06WXCkAryL$9NK;} z=}(vOa$XkG2cbSRL#WSLL&Ti2+4Mm@PR=dQi(?7aD zBmRftq<|fPpDn{aKq(A(z4G8AIeV!Tcivpb``XunoREK(`mzpQ%irEu;hPcQE0gGJW=-d`1T#1L&;< z>@SJcpL%u7r+B>V@nC-I{I diff --git a/soh/assets/custom/textures/buttons/StartBtnOutline.png b/soh/assets/custom/textures/buttons/StartBtnOutline.png new file mode 100644 index 0000000000000000000000000000000000000000..a7902edbdafeb8bdc1a440f700e08cdc06664c32 GIT binary patch literal 1031 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcdU{j_a$*MUNkC9V-A&iT2ysd*&~ z&PAz-C8;S2<(VZJ3hti10pX2&;=uU6=jq}YQgQ3;orAf}1|n<^+|@s79BBhvF<;eRAVlf z9?G!{4dryYM1N>;I65$bu{77){C=pUQQ l={zhm$FmjHw?l;2AiJ(G!GtHH+Tk3?#h$KyF6*2UngC=DT%rH~ literal 0 HcmV?d00001 diff --git a/soh/assets/custom/textures/buttons/ZBtn.png b/soh/assets/custom/textures/buttons/ZBtn.png index def8d9a6da2fcab6486b6106064d9fcd11dd47ba..4fee52d5762f0763b5fb1a5059937b35c1796370 100644 GIT binary patch literal 1005 zcmeAS@N?(olHy`uVBq!ia0y~yU~~tv*K@D|$vjON1E4@_rn7T^r?ay{K~a8MW=<*t zgT}<#iMAex14LT=gIyc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcdUnVV_y2Z2J8C9V-A&iT2ysd*&~ z&PAz-C8;S2<(VZJ3hti10pX2&;=uSm;_2cTQgQ3;?Tfz60TOKw|Fyf$SfG7_kLeLx zUc#Iu9L*8t26GwM8!u;X_3aW@lbip%@AmX(k0(qy3raL3fFGNknm%pG{XM1lp6e06 zUjJotK8pw*Pn4MV^nk@b;n?d}KikOnJj!*R8FcG=t-a?#RnMj(iDRL!D(CSV75J(; zO3qsLQt44(r|5cL!LMbz|60uTd!O~-NyMvOpO=2EvvuOvy;nVGA*S>EP3bT8{XaWa z0C|VXj|o1G_;Io@C~-@5g!SqRH9S`#-I*%9TG}ct^W& za`MAftEx^|%1<@uv9K&^JkP%V(@zBw{5TLw53ILlJ`@#Lc&OqQJIH=dS3j3^P64z!-JE+(X)vKtE{9js;Vf8EX$%O3WC7%d^Ve9S=K|x zSrm&?(;VtXPt{sVp(e={K?-@n<#>zDYBVELR4$!iNs=OZji^&AwW>iQ@@gd~4(y6= zm0csWb>C7wv*74*QIpJqpvyT;;%lK5d0J=}JX0!aIYZ%8k(G0_A6Sm77j4zB6ipWu zH76;YAY~EV`9vRg<-M41`AlqNN;2VcfRhP!yBNpl`)HadNysn=umHFNFa{U^^Z?ob z4S*P+3=jag07U=;U^c^kADc~#B6MBUG!%ryJc&S(i9o_ms0l9wumLojPjKADevEA& z>jp+52K2s5&7JhLm>!$tKqvN8=qS*V0db7jMvM?`Laox7yY_tk=gIf%qo)9#`0M?v`Zx4T z><_y)E_`?O1>!Oi7k7B}p>t2ay!`d*t>=6=f9%hd^)>U;o%pVAmmWTUJM}lvza;hA z(cv38M|?_9rj`P~oKp8a)c Yb??E?_CD!fN=}5$jjjCd`nlKt0Xc-g^`>U~ z?of8|^jO&#R>u$QM{XYUyy)t+M_+SG$HzmDYv+`of4KKI!@|JCRX0sJSIkOX^2pF| zcC=`9+{42fY=SN!Nz3MW=%+o1jQ@Vcw^aOLF(FB_9ZPKA({naYXuv@$6~m zD(71q@tWjR<7bn2fwfb9r{3;A$9BHhaKPBvP0iF_MoFw&R;S!RTT-iVip820Qct-f zr;DD8o^#c!ck8>8@e(JpwKLaUmU5Kw_E6vyG|JLg%)~8t%QVPm$qSoj59Q1Lcov;} zqSZVxnK5+51R47u@_**7jhr#BXfl)Gg5O8C*&l0|7rP*G``h=)xAW#P{7Zk}mHm4) zZ^F09U#gQL70(Y)*K0-AbW|YuPgftMmcdUalb9cJb^-zC9V-A&iT2ysd*&~ z&PAz-C8;S2<(VZJ3hti10pX2&;tUK-ES@foAr-gY-aeRn+d+W!f~;2S3Z|_By96%H z=DXCm!0U`htIJD;09GHx)hAUQQk>Yle|N`m{twA*5!0A}_K*PnYl#1+{tJ+g%{!P*f>fr_&ELa%f*FVY8vQ8)N*Y~GN>Qf${Qa@h# z@lQa5*0#WDT)OQ-x>CX=0Ztx!hw^YO1$x`G>Rek)48D?DH5 z+Lrj^oz{8h%in&MSlN0qWq&=DYc^YdX63Y&q$5vG$kxf%Ouo;~NJ97wgwlUI?=RX~ U9s92IvpL9mPgg&ebxsLQ0BZnzNB{r; literal 0 HcmV?d00001 diff --git a/soh/soh/Enhancements/controls/InputViewer.cpp b/soh/soh/Enhancements/controls/InputViewer.cpp new file mode 100644 index 000000000..6b25589c6 --- /dev/null +++ b/soh/soh/Enhancements/controls/InputViewer.cpp @@ -0,0 +1,519 @@ +#include "InputViewer.h" + +#include "public/bridge/consolevariablebridge.h" +#include "libultraship/libultra/controller.h" +#include "Context.h" +#ifndef IMGUI_DEFINE_MATH_OPERATORS +#define IMGUI_DEFINE_MATH_OPERATORS +#endif +#include +#include +#include + +#include "../../UIWidgets.hpp" + +// Text colors +static ImVec4 textColor = ImVec4(1.0f, 1.0f, 1.0f, 1.0f); +static ImVec4 range1Color = ImVec4(1.0f, 0.7f, 0, 1.0f); +static ImVec4 range2Color = ImVec4(0, 1.0f, 0, 1.0f); + +static const char* buttonOutlineOptions[4] = { "Always Shown", "Shown Only While Not Pressed", + "Shown Only While Pressed", "Always Hidden" }; + +static const char* stickModeOptions[3] = { "Always", "While In Use", "Never" }; + +static Color_RGBA8 vec2Color(ImVec4 vec) { + Color_RGBA8 color; + color.r = vec.x * 255.0; + color.g = vec.y * 255.0; + color.b = vec.z * 255.0; + color.a = vec.w * 255.0; + return color; +} + +static ImVec4 color2Vec(Color_RGBA8 color) { + return ImVec4(color.r / 255.0, color.g / 255.0, color.b / 255.0, color.a / 255.0); +} + +InputViewer::~InputViewer() { + SPDLOG_TRACE("destruct input viewer"); +} + +void InputViewer::RenderButton(std::string btnTexture, std::string btnOutlineTexture, int state, ImVec2 size, + int outlineMode) { + const ImVec2 pos = ImGui::GetCursorPos(); + ImGui::SetNextItemAllowOverlap(); + // Render Outline based on settings + if (outlineMode == BUTTON_OUTLINE_ALWAYS_SHOWN || (outlineMode == BUTTON_OUTLINE_NOT_PRESSED && !state) || + (outlineMode == BUTTON_OUTLINE_PRESSED && state)) { + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnOutlineTexture), size, + ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + } + // Render button if pressed + if (state) { + ImGui::SetCursorPos(pos); + ImGui::SetNextItemAllowOverlap(); + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName(btnTexture), size, + ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + } +} + +void InputViewer::DrawElement() { + if (CVarGetInteger("gOpenWindows.InputViewer", 0)) { + static bool sButtonTexturesLoaded = false; + if (!sButtonTexturesLoaded) { + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage( + "Input-Viewer-Background", "textures/buttons/InputViewerBackground.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn", "textures/buttons/ABtn.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn", "textures/buttons/BBtn.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn", "textures/buttons/LBtn.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn", "textures/buttons/RBtn.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn", "textures/buttons/ZBtn.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Start-Btn", + "textures/buttons/StartBtn.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left", "textures/buttons/CLeft.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right", "textures/buttons/CRight.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up", "textures/buttons/CUp.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down", "textures/buttons/CDown.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Analog-Stick", + "textures/buttons/AnalogStick.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Left", + "textures/buttons/DPadLeft.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Right", + "textures/buttons/DPadRight.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up", "textures/buttons/DPadUp.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Down", + "textures/buttons/DPadDown.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Right-Stick", + "textures/buttons/RightStick.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("A-Btn Outline", + "textures/buttons/ABtnOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("B-Btn Outline", + "textures/buttons/BBtnOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("L-Btn Outline", + "textures/buttons/LBtnOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("R-Btn Outline", + "textures/buttons/RBtnOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Z-Btn Outline", + "textures/buttons/ZBtnOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Start-Btn Outline", + "textures/buttons/StartBtnOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Left Outline", + "textures/buttons/CLeftOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Right Outline", + "textures/buttons/CRightOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Up Outline", + "textures/buttons/CUpOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("C-Down Outline", + "textures/buttons/CDownOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Analog-Stick Outline", + "textures/buttons/AnalogStickOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Left Outline", + "textures/buttons/DPadLeftOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Right Outline", + "textures/buttons/DPadRightOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Up Outline", + "textures/buttons/DPadUpOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Dpad-Down Outline", + "textures/buttons/DPadDownOutline.png"); + LUS::Context::GetInstance()->GetWindow()->GetGui()->LoadTextureFromRawImage("Right-Stick Outline", + "textures/buttons/RightStickOutline.png"); + sButtonTexturesLoaded = true; + } + + ImVec2 mainPos = ImGui::GetWindowPos(); + ImVec2 size = ImGui::GetContentRegionAvail(); + +#ifdef __WIIU__ + const float scale = CVarGetFloat("gInputViewer.Scale", 1.0f) * 2.0f; +#else + const float scale = CVarGetFloat("gInputViewer.Scale", 1.0f); +#endif + const int showAnalogAngles = CVarGetInteger("gInputViewer.AnalogAngles.Enabled", 0); + const int buttonOutlineMode = CVarGetInteger("gInputViewer.ButtonOutlineMode", BUTTON_OUTLINE_NOT_PRESSED); + + ImVec2 bgSize = LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureSize("Input-Viewer-Background"); + ImVec2 scaledBGSize = ImVec2(bgSize.x * scale, bgSize.y * scale); + + ImGui::SetNextWindowSize(ImVec2( + scaledBGSize.x + 20, + scaledBGSize.y + + (showAnalogAngles ? ImGui::CalcTextSize("X").y : 0) * scale * CVarGetFloat("gInputViewer.AnalogAngles.Scale", 1.0f) + 20)); + ImGui::SetNextWindowContentSize( + ImVec2(scaledBGSize.x, scaledBGSize.y + (showAnalogAngles ? 15 : 0) * scale * + CVarGetFloat("gInputViewer.AnalogAngles.Scale", 1.0f))); + ImGui::SetNextWindowPos( + ImVec2(mainPos.x + size.x - scaledBGSize.x - 30, mainPos.y + size.y - scaledBGSize.y - 30), + ImGuiCond_FirstUseEver); + + ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0, 0, 0, 0)); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 0.0f)); + + OSContPad* pads = LUS::Context::GetInstance()->GetControlDeck()->GetPads(); + + ImGuiWindowFlags windowFlags = ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoScrollbar | + ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoBackground | + ImGuiWindowFlags_NoFocusOnAppearing; + + if (!CVarGetInteger("gInputViewer.EnableDragging", 1)) { + windowFlags |= ImGuiWindowFlags_NoInputs | ImGuiWindowFlags_NoMove; + } + + if (pads != nullptr && ImGui::Begin("Input Viewer", nullptr, windowFlags)) { + ImGui::SetCursorPos(ImVec2(10, 10)); + const ImVec2 aPos = ImGui::GetCursorPos(); + + if (CVarGetInteger("gInputViewer.ShowBackground", 1)) { + ImGui::SetNextItemAllowOverlap(); + // Background + ImGui::Image( + LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Input-Viewer-Background"), + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + } + + // A/B + if (CVarGetInteger("gInputViewer.BBtn", 1)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("B-Btn", "B-Btn Outline", pads[0].button & BTN_B, scaledBGSize, buttonOutlineMode); + } + if (CVarGetInteger("gInputViewer.ABtn", 1)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("A-Btn", "A-Btn Outline", pads[0].button & BTN_A, scaledBGSize, buttonOutlineMode); + } + + // C buttons + if (CVarGetInteger("gInputViewer.CUp", 1)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("C-Up", "C-Up Outline", pads[0].button & BTN_CUP, scaledBGSize, buttonOutlineMode); + } + if (CVarGetInteger("gInputViewer.CLeft", 1)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("C-Left", "C-Left Outline", pads[0].button & BTN_CLEFT, scaledBGSize, buttonOutlineMode); + } + if (CVarGetInteger("gInputViewer.CRight", 1)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("C-Right", "C-Right Outline", pads[0].button & BTN_CRIGHT, scaledBGSize, + buttonOutlineMode); + } + if (CVarGetInteger("gInputViewer.CDown", 1)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("C-Down", "C-Down Outline", pads[0].button & BTN_CDOWN, scaledBGSize, buttonOutlineMode); + } + + // L/R/Z + if (CVarGetInteger("gInputViewer.LBtn", 1)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("L-Btn", "L-Btn Outline", pads[0].button & BTN_L, scaledBGSize, buttonOutlineMode); + } + if (CVarGetInteger("gInputViewer.RBtn", 1)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("R-Btn", "R-Btn Outline", pads[0].button & BTN_R, scaledBGSize, buttonOutlineMode); + } + if (CVarGetInteger("gInputViewer.ZBtn", 1)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("Z-Btn", "Z-Btn Outline", pads[0].button & BTN_Z, scaledBGSize, buttonOutlineMode); + } + + // Start + if (CVarGetInteger("gInputViewer.StartBtn", 1)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("Start-Btn", "Start-Btn Outline", pads[0].button & BTN_START, scaledBGSize, + buttonOutlineMode); + } + + // Dpad + if (CVarGetInteger("gInputViewer.Dpad", 0)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("Dpad-Left", "Dpad-Left Outline", pads[0].button & BTN_DLEFT, scaledBGSize, + buttonOutlineMode); + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("Dpad-Right", "Dpad-Right Outline", pads[0].button & BTN_DRIGHT, scaledBGSize, + buttonOutlineMode); + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("Dpad-Up", "Dpad-Up Outline", pads[0].button & BTN_DUP, scaledBGSize, buttonOutlineMode); + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + RenderButton("Dpad-Down", "Dpad-Down Outline", pads[0].button & BTN_DDOWN, scaledBGSize, + buttonOutlineMode); + } + + const bool analogStickIsInDeadzone = !pads[0].stick_x && !pads[0].stick_y; + const bool rightStickIsInDeadzone = !pads[0].right_stick_x && !pads[0].right_stick_y; + + // Analog Stick + const int analogOutlineMode = + CVarGetInteger("gInputViewer.AnalogStick.OutlineMode", STICK_MODE_ALWAYS_SHOWN); + const float maxStickDistance = CVarGetInteger("gInputViewer.AnalogStick.Movement", 12); + if (analogOutlineMode == STICK_MODE_ALWAYS_SHOWN || + (analogOutlineMode == STICK_MODE_HIDDEN_IN_DEADZONE && !analogStickIsInDeadzone)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + ImGui::Image( + LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick Outline"), + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + } + const int analogStickMode = + CVarGetInteger("gInputViewer.AnalogStick.VisibilityMode", STICK_MODE_ALWAYS_SHOWN); + if (analogStickMode == STICK_MODE_ALWAYS_SHOWN || + (analogStickMode == STICK_MODE_HIDDEN_IN_DEADZONE && !analogStickIsInDeadzone)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos( + ImVec2(aPos.x + maxStickDistance * ((float)(pads[0].stick_x) / MAX_AXIS_RANGE) * scale, + aPos.y - maxStickDistance * ((float)(pads[0].stick_y) / MAX_AXIS_RANGE) * scale)); + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Analog-Stick"), + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + } + + // Right Stick + const float maxRightStickDistance = CVarGetInteger("gInputViewer.RightStick.Movement", 7); + const int rightOutlineMode = + CVarGetInteger("gInputViewer.RightStick.OutlineMode", STICK_MODE_ALWAYS_HIDDEN); + if (rightOutlineMode == STICK_MODE_ALWAYS_SHOWN || + (rightOutlineMode == STICK_MODE_HIDDEN_IN_DEADZONE && !rightStickIsInDeadzone)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos(aPos); + ImGui::Image( + LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick Outline"), + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + } + const int rightStickMode = + CVarGetInteger("gInputViewer.RightStick.VisibilityMode", STICK_MODE_ALWAYS_HIDDEN); + if (rightStickMode == STICK_MODE_ALWAYS_SHOWN || + (rightStickMode == STICK_MODE_HIDDEN_IN_DEADZONE && !rightStickIsInDeadzone)) { + ImGui::SetNextItemAllowOverlap(); + ImGui::SetCursorPos( + ImVec2(aPos.x + maxRightStickDistance * ((float)(pads[0].right_stick_x) / MAX_AXIS_RANGE) * scale, + aPos.y - maxRightStickDistance * ((float)(pads[0].right_stick_y) / MAX_AXIS_RANGE) * scale)); + ImGui::Image(LUS::Context::GetInstance()->GetWindow()->GetGui()->GetTextureByName("Right-Stick"), + scaledBGSize, ImVec2(0, 0), ImVec2(1.0f, 1.0f), ImVec4(255, 255, 255, 255)); + } + + // Analog stick angle text + if (showAnalogAngles) { + ImGui::SetCursorPos(ImVec2(aPos.x + 10 + CVarGetInteger("gInputViewer.AnalogAngles.Offset", 0) * scale, + scaledBGSize.y + aPos.y + 10)); + // Scale font with input viewer scale + float oldFontScale = ImGui::GetFont()->Scale; + ImGui::GetFont()->Scale *= scale * CVarGetFloat("gInputViewer.AnalogAngles.Scale", 1.0f); + ImGui::PushFont(ImGui::GetFont()); + + // Calculate polar R coordinate from X and Y angles, squared to avoid sqrt + const float rSquared = pads[0].stick_x * pads[0].stick_x + pads[0].stick_y * pads[0].stick_y; + + // ESS range + const int range1Min = CVarGetInteger("gInputViewer.AnalogAngles.Range1.Min", 8); + const int range1Max = CVarGetInteger("gInputViewer.AnalogAngles.Range1.Max", 27); + // Walking speed range + const int range2Min = CVarGetInteger("gInputViewer.AnalogAngles.Range2.Min", 27); + const int range2Max = CVarGetInteger("gInputViewer.AnalogAngles.Range2.Max", 62); + + // Push color based on angle ranges + if (CVarGetInteger("gInputViewer.AnalogAngles.Range1.Enabled", 0) && + (rSquared >= (range1Min * range1Min)) && (rSquared < (range1Max * range1Max))) { + ImGui::PushStyleColor( + ImGuiCol_Text, + color2Vec(CVarGetColor("gInputViewer.AnalogAngles.Range1.Color", vec2Color(range1Color)))); + } else if (CVarGetInteger("gInputViewer.AnalogAngles.Range2.Enabled", 0) && + (rSquared >= (range2Min * range2Min)) && (rSquared < (range2Max * range2Max))) { + ImGui::PushStyleColor( + ImGuiCol_Text, + color2Vec(CVarGetColor("gInputViewer.AnalogAngles.Range2.Color", vec2Color(range2Color)))); + } else { + ImGui::PushStyleColor(ImGuiCol_Text, color2Vec(CVarGetColor("gInputViewer.AnalogAngles.TextColor", + vec2Color(textColor)))); + } + + // Render text + ImGui::Text("X: %-3d Y: %-3d", pads[0].stick_x, pads[0].stick_y); + // Restore original color + ImGui::PopStyleColor(); + // Restore original font scale + ImGui::GetFont()->Scale = oldFontScale; + ImGui::PopFont(); + } + + ImGui::End(); + } + + ImGui::PopStyleVar(); + ImGui::PopStyleColor(); + } +} + +InputViewerSettingsWindow::~InputViewerSettingsWindow() { + SPDLOG_TRACE("destruct input viewer settings window"); +} + +void InputViewerSettingsWindow::DrawElement() { + ImGui::SetNextWindowSize(ImVec2(450, 525), ImGuiCond_FirstUseEver); + + if (ImGui::Begin("Input Viewer Settings", &mIsVisible)) { + + // gInputViewer.Scale + UIWidgets::EnhancementSliderFloat("Input Viewer Scale: %.2f", "##Input", "gInputViewer.Scale", 0.1f, 5.0f, "", + 1.0f, false, true); + UIWidgets::Tooltip("Sets the on screen size of the input viewer"); + + // gInputViewer.EnableDragging + UIWidgets::EnhancementCheckbox("Enable Dragging", "gInputViewer.EnableDragging", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + + UIWidgets::PaddedSeparator(true, true); + + // gInputViewer.ShowBackground + UIWidgets::EnhancementCheckbox("Show Background Layer", "gInputViewer.ShowBackground", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + + UIWidgets::PaddedSeparator(true, true); + + if (ImGui::CollapsingHeader("Buttons")) { + // gInputViewer.ABtn + UIWidgets::EnhancementCheckbox("Show A-Button Layers", "gInputViewer.ABtn", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + // gInputViewer.BBtn + UIWidgets::EnhancementCheckbox("Show B-Button Layers", "gInputViewer.BBtn", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + // gInputViewer.CUp + UIWidgets::EnhancementCheckbox("Show C-Up Layers", "gInputViewer.CUp", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + // gInputViewer.CRight + UIWidgets::EnhancementCheckbox("Show C-Right Layers", "gInputViewer.CRight", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + // gInputViewer.CDown + UIWidgets::EnhancementCheckbox("Show C-Down Layers", "gInputViewer.CDown", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + // gInputViewer.CLeft + UIWidgets::EnhancementCheckbox("Show C-Left Layers", "gInputViewer.CLeft", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + // gInputViewer.LBtn + UIWidgets::EnhancementCheckbox("Show L-Button Layers", "gInputViewer.LBtn", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + // gInputViewer.RBtn + UIWidgets::EnhancementCheckbox("Show R-Button Layers", "gInputViewer.RBtn", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + // gInputViewer.ZBtn + UIWidgets::EnhancementCheckbox("Show Z-Button Layers", "gInputViewer.ZBtn", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + // gInputViewer.StartBtn + UIWidgets::EnhancementCheckbox("Show Start Button Layers", "gInputViewer.StartBtn", false, "", + UIWidgets::CheckboxGraphics::Checkmark, true); + // gInputViewer.Dpad + UIWidgets::EnhancementCheckbox("Show D-Pad Layers", "gInputViewer.Dpad", false, "", + UIWidgets::CheckboxGraphics::Checkmark, false); + + // gInputViewer.ButtonOutlineMode + UIWidgets::PaddedText("Button Outlines/Backgrounds", true, false); + UIWidgets::EnhancementCombobox("gInputViewer.ButtonOutlineMode", buttonOutlineOptions, + BUTTON_OUTLINE_NOT_PRESSED); + UIWidgets::Tooltip( + "Sets the desired visibility behavior for the button outline/background layers. Useful for " + "custom input viewers."); + + UIWidgets::PaddedSeparator(true, true); + } + + if (ImGui::CollapsingHeader("Analog Stick")) { + // gInputViewer.AnalogStick.VisibilityMode + UIWidgets::PaddedText("Analog Stick Visibility", true, false); + UIWidgets::EnhancementCombobox("gInputViewer.AnalogStick.VisibilityMode", stickModeOptions, + STICK_MODE_ALWAYS_SHOWN); + UIWidgets::Tooltip( + "Determines the conditions under which the moving layer of the analog stick texture is visible."); + + // gInputViewer.AnalogStick.OutlineMode + UIWidgets::PaddedText("Analog Stick Outline/Background Visibility", true, false); + UIWidgets::EnhancementCombobox("gInputViewer.AnalogStick.OutlineMode", stickModeOptions, + STICK_MODE_ALWAYS_SHOWN); + UIWidgets::Tooltip( + "Determines the conditions under which the analog stick outline/background texture is visible."); + + // gInputViewer.AnalogStick.Movement + UIWidgets::EnhancementSliderInt("Analog Stick Movement: %dpx", "##AnalogMovement", + "gInputViewer.AnalogStick.Movement", 0, 200, "", 12, true); + UIWidgets::Tooltip( + "Sets the distance to move the analog stick in the input viewer. Useful for custom input viewers."); + UIWidgets::PaddedSeparator(true, true); + } + + if (ImGui::CollapsingHeader("Additional (\"Right\") Stick")) { + // gInputViewer.RightStick.VisibilityMode + UIWidgets::PaddedText("Right Stick Visibility", true, false); + UIWidgets::EnhancementCombobox("gInputViewer.RightStick.VisibilityMode", stickModeOptions, + STICK_MODE_HIDDEN_IN_DEADZONE); + UIWidgets::Tooltip( + "Determines the conditions under which the moving layer of the right stick texture is visible."); + + // gInputViewer.RightStick.OutlineMode + UIWidgets::PaddedText("Right Stick Outline/Background Visibility", true, false); + UIWidgets::EnhancementCombobox("gInputViewer.RightStick.OutlineMode", stickModeOptions, + STICK_MODE_HIDDEN_IN_DEADZONE); + UIWidgets::Tooltip( + "Determines the conditions under which the right stick outline/background texture is visible."); + + // gInputViewer.RightStick.Movement + UIWidgets::EnhancementSliderInt("Right Stick Movement: %dpx", "##RightMovement", + "gInputViewer.RightStick.Movement", 0, 200, "", 7, true); + UIWidgets::Tooltip( + "Sets the distance to move the right stick in the input viewer. Useful for custom input viewers."); + UIWidgets::PaddedSeparator(true, true); + } + + if (ImGui::CollapsingHeader("Analog Angle Values")) { + // gAnalogAngles + UIWidgets::EnhancementCheckbox("Show Analog Stick Angle Values", "gInputViewer.AnalogAngles.Enabled"); + UIWidgets::Tooltip("Displays analog stick angle values in the input viewer"); + if (CVarGetInteger("gInputViewer.AnalogAngles.Enabled", 0)) { + // gInputViewer.AnalogAngles.TextColor + if (ImGui::ColorEdit4("Text Color", (float*)&textColor)) { + CVarSetColor("gInputViewer.AnalogAngles.TextColor", vec2Color(textColor)); + } + // gAnalogAngleScale + UIWidgets::EnhancementSliderFloat("Angle Text Scale: %.2f%%", "##AnalogAngleScale", + "gInputViewer.AnalogAngles.Scale", 0.1f, 5.0f, "", 1.0f, true, true); + // gInputViewer.AnalogAngles.Offset + UIWidgets::EnhancementSliderInt("Angle Text Offset: %dpx", "##AnalogAngleOffset", + "gInputViewer.AnalogAngles.Offset", 0, 400, "", 0, true); + UIWidgets::PaddedSeparator(true, true); + // gInputViewer.AnalogAngles.Range1.Enabled + UIWidgets::EnhancementCheckbox("Highlight ESS Position", "gInputViewer.AnalogAngles.Range1.Enabled"); + UIWidgets::Tooltip( + "Highlights the angle value text when the analog stick is in ESS position (on flat ground)"); + if (CVarGetInteger("gInputViewer.AnalogAngles.Range1.Enabled", 0)) { + // gInputViewer.AnalogAngles.Range1.Color + if (ImGui::ColorEdit4("ESS Color", (float*)&range1Color)) { + CVarSetColor("gInputViewer.AnalogAngles.Range1.Color", vec2Color(range1Color)); + } + } + + UIWidgets::PaddedSeparator(true, true); + // gInputViewer.AnalogAngles.Range2.Enabled + UIWidgets::EnhancementCheckbox("Highlight Walking Speed Angles", + "gInputViewer.AnalogAngles.Range2.Enabled"); + UIWidgets::Tooltip("Highlights the angle value text when the analog stick is at an angle that would " + "produce a walking speed (on flat ground)\n\n" + "Useful for 1.0 Empty Jumpslash Quick Put Away"); + if (CVarGetInteger("gInputViewer.AnalogAngles.Range2.Enabled", 0)) { + // gInputViewer.AnalogAngles.Range2.Color + if (ImGui::ColorEdit4("Walking Speed Color", (float*)&range2Color)) { + CVarSetColor("gInputViewer.AnalogAngles.Range2.Color", vec2Color(range2Color)); + } + } + } + } + + ImGui::End(); + } +} \ No newline at end of file diff --git a/soh/soh/Enhancements/controls/InputViewer.h b/soh/soh/Enhancements/controls/InputViewer.h new file mode 100644 index 000000000..646c15d9d --- /dev/null +++ b/soh/soh/Enhancements/controls/InputViewer.h @@ -0,0 +1,47 @@ +#pragma once + +#include + +typedef enum { + BUTTON_OUTLINE_ALWAYS_SHOWN, + BUTTON_OUTLINE_NOT_PRESSED, + BUTTON_OUTLINE_PRESSED, + BUTTON_OUTLINE_ALWAYS_HIDDEN +} ButtonOutlineMode; + +typedef enum { + STICK_MODE_ALWAYS_SHOWN, + STICK_MODE_HIDDEN_IN_DEADZONE, + STICK_MODE_ALWAYS_HIDDEN, +} StickMode; + +class InputViewer : public LUS::GuiWindow { +public: + using LUS::GuiWindow::GuiWindow; + + void InitElement() override {}; + void DrawElement() override; + void UpdateElement() override {}; + + InputViewer(); + ~InputViewer(); + + void Draw(); + + private: + void RenderButton(std::string btn, std::string btnOutline, int state, ImVec2 size, int outlineMode); +}; + +class InputViewerSettingsWindow : public LUS::GuiWindow { +public: + using LUS::GuiWindow::GuiWindow; + + void InitElement() override {}; + void DrawElement() override; + void UpdateElement() override {}; + + InputViewerSettingsWindow(); + ~InputViewerSettingsWindow(); + + void Draw(); +}; \ No newline at end of file diff --git a/soh/soh/SohGui.cpp b/soh/soh/SohGui.cpp index a295fed66..4cb43d3a8 100644 --- a/soh/soh/SohGui.cpp +++ b/soh/soh/SohGui.cpp @@ -117,6 +117,8 @@ namespace SohGui { std::shared_ptr mInputEditorWindow; std::shared_ptr mAudioEditorWindow; + std::shared_ptr mInputViewer; + std::shared_ptr mInputViewerSettings; std::shared_ptr mCosmeticsEditorWindow; std::shared_ptr mActorViewerWindow; std::shared_ptr mColViewerWindow; @@ -165,6 +167,10 @@ namespace SohGui { mAudioEditorWindow = std::make_shared("gAudioEditor.WindowOpen", "Audio Editor"); gui->AddGuiWindow(mAudioEditorWindow); + mInputViewer = std::make_shared("gOpenWindows.InputViewer", "Input Viewer"); + gui->AddGuiWindow(mInputViewer); + mInputViewerSettings = std::make_shared("gOpenWindows.InputViewerSettings", "Input Viewer Settings"); + gui->AddGuiWindow(mInputViewerSettings); mCosmeticsEditorWindow = std::make_shared("gCosmeticsEditorEnabled", "Cosmetics Editor"); gui->AddGuiWindow(mCosmeticsEditorWindow); mActorViewerWindow = std::make_shared("gActorViewerEnabled", "Actor Viewer"); diff --git a/soh/soh/SohGui.hpp b/soh/soh/SohGui.hpp index 73a3addd4..0e1d970a8 100644 --- a/soh/soh/SohGui.hpp +++ b/soh/soh/SohGui.hpp @@ -11,6 +11,7 @@ #include #include "SohMenuBar.h" #include "Enhancements/audio/AudioEditor.h" +#include "Enhancements/controls/InputViewer.h" #include "Enhancements/cosmetics/CosmeticsEditor.h" #include "Enhancements/debugger/actorViewer.h" #include "Enhancements/debugger/colViewer.h" diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 8b33a72ef..d74649290 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -21,6 +21,7 @@ #include "Enhancements/audio/AudioEditor.h" +#include "Enhancements/controls/InputViewer.h" #include "Enhancements/cosmetics/CosmeticsEditor.h" #include "Enhancements/debugger/actorViewer.h" #include "Enhancements/debugger/colViewer.h" @@ -180,6 +181,8 @@ void DrawShipMenu() { } extern std::shared_ptr mInputEditorWindow; +extern std::shared_ptr mInputViewer; +extern std::shared_ptr mInputViewerSettings; extern std::shared_ptr mAdvancedResolutionSettingsWindow; void DrawSettingsMenu() { @@ -245,11 +248,25 @@ void DrawSettingsMenu() { #ifndef __SWITCH__ UIWidgets::EnhancementCheckbox("Menubar Controller Navigation", "gControlNav"); UIWidgets::Tooltip("Allows controller navigation of the SOH menu bar (Settings, Enhancements,...)\nCAUTION: This will disable game inputs while the menubar is visible.\n\nD-pad to move between items, A to select, and X to grab focus on the menu bar"); + UIWidgets::PaddedSeparator(); #endif - UIWidgets::PaddedEnhancementCheckbox("Show Inputs", "gInputEnabled", true, false); - UIWidgets::Tooltip("Shows currently pressed inputs on the bottom right of the screen"); - UIWidgets::PaddedEnhancementSliderFloat("Input Scale: %.2f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false, true, true, false); - UIWidgets::Tooltip("Sets the on screen size of the displayed inputs from the Show Inputs setting"); + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2 (12.0f, 6.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_ButtonTextAlign, ImVec2(0.0f, 0.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 1.0f); + ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0.22f, 0.38f, 0.56f, 1.0f)); + if (mInputViewer) { + if (ImGui::Button(GetWindowButtonText("Input Viewer", CVarGetInteger("gOpenWindows.InputViewer", 0)).c_str(), ImVec2 (-1.0f, 0.0f))) { + mInputViewer->ToggleVisibility(); + } + } + if (mInputViewerSettings) { + if (ImGui::Button(GetWindowButtonText("Input Viewer Settings", CVarGetInteger("gOpenWindows.InputViewerSettings", 0)).c_str(), ImVec2 (-1.0f, 0.0f))) { + mInputViewerSettings->ToggleVisibility(); + } + } + ImGui::PopStyleColor(1); + ImGui::PopStyleVar(3); + UIWidgets::PaddedEnhancementSliderInt("Simulated Input Lag: %d frames", "##SimulatedInputLag", "gSimulatedInputLag", 0, 6, "", 0, true, true, false); UIWidgets::Tooltip("Buffers your inputs to be executed a specified amount of frames later"); From f7e746e295f4c294796318aa3e32493ff182a842 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Thu, 15 Feb 2024 19:37:55 -0600 Subject: [PATCH 13/44] Tweaks to coloridoscope (#3901) --- .../cosmetics/CosmeticsEditor.cpp | 189 ++++++++++++++---- 1 file changed, 146 insertions(+), 43 deletions(-) diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 240bf5894..2166f43bc 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -269,35 +269,35 @@ static std::map cosmeticOptions = { COSMETIC_OPTION("Hud_NameTagActorText", "Nametag Text", GROUP_HUD, ImVec4(255, 255, 255, 255), true, true, false), COSMETIC_OPTION("Hud_NameTagActorBackground", "Nametag Background", GROUP_HUD, ImVec4(0, 0, 0, 80), true, false, true), - COSMETIC_OPTION("Kal_ItemSelA", "Item Select Color A", GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, false), - COSMETIC_OPTION("Kal_ItemSelB", "Item Select Color B", GROUP_KALEIDO, ImVec4(70, 100, 130, 255), false, true, false), - COSMETIC_OPTION("Kal_ItemSelC", "Item Select Color C", GROUP_KALEIDO, ImVec4(70, 100, 130, 255), false, true, false), - COSMETIC_OPTION("Kal_ItemSelD", "Item Select Color D", GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, false), + COSMETIC_OPTION("Kal_ItemSelA", "Item Select Color", GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, false), + COSMETIC_OPTION("Kal_ItemSelB", "Item Select Color B", GROUP_KALEIDO, ImVec4(70, 100, 130, 255), false, true, true), + COSMETIC_OPTION("Kal_ItemSelC", "Item Select Color C", GROUP_KALEIDO, ImVec4(70, 100, 130, 255), false, true, true), + COSMETIC_OPTION("Kal_ItemSelD", "Item Select Color D", GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, true), - COSMETIC_OPTION("Kal_EquipSelA", "Equip Select Color A", GROUP_KALEIDO, ImVec4(10, 50, 40, 255), false, true, false), - COSMETIC_OPTION("Kal_EquipSelB", "Equip Select Color B", GROUP_KALEIDO, ImVec4(90, 100, 60, 255), false, true, false), - COSMETIC_OPTION("Kal_EquipSelC", "Equip Select Color C", GROUP_KALEIDO, ImVec4(90, 100, 60, 255), false, true, false), - COSMETIC_OPTION("Kal_EquipSelD", "Equip Select Color D", GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, false), + COSMETIC_OPTION("Kal_EquipSelA", "Equip Select Color", GROUP_KALEIDO, ImVec4(10, 50, 40, 255), false, true, false), + COSMETIC_OPTION("Kal_EquipSelB", "Equip Select Color B", GROUP_KALEIDO, ImVec4(90, 100, 60, 255), false, true, true), + COSMETIC_OPTION("Kal_EquipSelC", "Equip Select Color C", GROUP_KALEIDO, ImVec4(90, 100, 60, 255), false, true, true), + COSMETIC_OPTION("Kal_EquipSelD", "Equip Select Color D", GROUP_KALEIDO, ImVec4(10, 50, 80, 255), false, true, true), - COSMETIC_OPTION("Kal_MapSelDunA", "Map Dungeon Color A", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, false), - COSMETIC_OPTION("Kal_MapSelDunB", "Map Dungeon Color B", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, false), - COSMETIC_OPTION("Kal_MapSelDunC", "Map Dungeon Color C", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, false), - COSMETIC_OPTION("Kal_MapSelDunD", "Map Dungeon Color D", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, false), + COSMETIC_OPTION("Kal_MapSelDunA", "Map Dungeon Color", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, true), + COSMETIC_OPTION("Kal_MapSelDunB", "Map Dungeon Color B", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), + COSMETIC_OPTION("Kal_MapSelDunC", "Map Dungeon Color C", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), + COSMETIC_OPTION("Kal_MapSelDunD", "Map Dungeon Color D", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, true), - COSMETIC_OPTION("Kal_QuestStatusA", "Quest StatusColor A", GROUP_KALEIDO, ImVec4(80, 80, 50, 255), false, true, false), - COSMETIC_OPTION("Kal_QuestStatusB", "Quest StatusColor B", GROUP_KALEIDO, ImVec4(120, 120, 70, 255), false, true, false), - COSMETIC_OPTION("Kal_QuestStatusC", "Quest StatusColor C", GROUP_KALEIDO, ImVec4(120, 120, 70, 255), false, true, false), - COSMETIC_OPTION("Kal_QuestStatusD", "Quest StatusColor D", GROUP_KALEIDO, ImVec4(80, 80, 50, 255), false, true, false), + COSMETIC_OPTION("Kal_QuestStatusA", "Quest Status Color", GROUP_KALEIDO, ImVec4(80, 80, 50, 255), false, true, false), + COSMETIC_OPTION("Kal_QuestStatusB", "Quest Status Color B", GROUP_KALEIDO, ImVec4(120, 120, 70, 255), false, true, true), + COSMETIC_OPTION("Kal_QuestStatusC", "Quest Status Color C", GROUP_KALEIDO, ImVec4(120, 120, 70, 255), false, true, true), + COSMETIC_OPTION("Kal_QuestStatusD", "Quest Status Color D", GROUP_KALEIDO, ImVec4(80, 80, 50, 255), false, true, true), - COSMETIC_OPTION("Kal_MapSelectA", "Map Color A", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, false), - COSMETIC_OPTION("Kal_MapSelectB", "Map Color B", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, false), - COSMETIC_OPTION("Kal_MapSelectC", "Map Color C", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, false), - COSMETIC_OPTION("Kal_MapSelectD", "Map Color D", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, false), + COSMETIC_OPTION("Kal_MapSelectA", "Map Color", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, false), + COSMETIC_OPTION("Kal_MapSelectB", "Map Color B", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), + COSMETIC_OPTION("Kal_MapSelectC", "Map Color C", GROUP_KALEIDO, ImVec4(140, 60, 60, 255), false, true, true), + COSMETIC_OPTION("Kal_MapSelectD", "Map Color D", GROUP_KALEIDO, ImVec4(80, 40, 30, 255), false, true, true), - COSMETIC_OPTION("Kal_SaveA", "Save A", GROUP_KALEIDO, ImVec4(50, 50, 50, 255), false, true, false), - COSMETIC_OPTION("Kal_SaveB", "Save B", GROUP_KALEIDO, ImVec4(110, 110, 110, 255), false, true, false), - COSMETIC_OPTION("Kal_SaveC", "Save C", GROUP_KALEIDO, ImVec4(110, 110, 110, 255), false, true, false), - COSMETIC_OPTION("Kal_SaveD", "Save D", GROUP_KALEIDO, ImVec4(50, 50, 50, 255), false, true, false), + COSMETIC_OPTION("Kal_SaveA", "Save Color", GROUP_KALEIDO, ImVec4(50, 50, 50, 255), false, true, false), + COSMETIC_OPTION("Kal_SaveB", "Save Color B", GROUP_KALEIDO, ImVec4(110, 110, 110, 255), false, true, true), + COSMETIC_OPTION("Kal_SaveC", "Save Color C", GROUP_KALEIDO, ImVec4(110, 110, 110, 255), false, true, true), + COSMETIC_OPTION("Kal_SaveD", "Save Color D", GROUP_KALEIDO, ImVec4(50, 50, 50, 255), false, true, true), COSMETIC_OPTION("Kal_NamePanel", "Name Panel", GROUP_KALEIDO, ImVec4(90,100,130,255), true, true, false), @@ -1631,25 +1631,20 @@ void CopyMultipliedColor(CosmeticOption& cosmeticOptionSrc, CosmeticOption& cosm CVarSetInteger((cosmeticOptionTarget.changedCvar), 1); } -void RandomizeColor(CosmeticOption& cosmeticOption) { - Color_RGBA8 newColor; - newColor.r = Random(0, 255); - newColor.g = Random(0, 255); - newColor.b = Random(0, 255); - newColor.a = 255; - // For alpha supported options, retain the last set alpha instead of overwriting - if (cosmeticOption.supportsAlpha) { - newColor.a = cosmeticOption.currentColor.w * 255; +void ToggleRainbow(CosmeticOption& cosmeticOption, bool state) { + if (state) { + CVarSetInteger(cosmeticOption.rainbowCvar, 1); + CVarSetInteger(cosmeticOption.changedCvar, 1); + } else { + CVarClear(cosmeticOption.rainbowCvar); + CVarClear(cosmeticOption.changedCvar); } +} - cosmeticOption.currentColor.x = newColor.r / 255.0; - cosmeticOption.currentColor.y = newColor.g / 255.0; - cosmeticOption.currentColor.z = newColor.b / 255.0; - cosmeticOption.currentColor.w = newColor.a / 255.0; - - CVarSetColor(cosmeticOption.cvar, newColor); - CVarSetInteger((cosmeticOption.rainbowCvar), 0); - CVarSetInteger((cosmeticOption.changedCvar), 1); +void ApplySideEffects(CosmeticOption& cosmeticOption) { + if (CVarGetInteger("gCosmetics.AdvancedMode", 0)) { + return; + } // This bit is kind of experimental, not sure how I feel about it yet, but it allows for // advanced cosmetic options to be changed based on a non-advanced option. @@ -1671,9 +1666,91 @@ void RandomizeColor(CosmeticOption& cosmeticOption) { CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("SpinAttack_Level1Primary"), 2.0f); } else if (cosmeticOption.label == "Level 2 Secondary") { CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("SpinAttack_Level2Primary"), 2.0f); + } else if (cosmeticOption.label == "Item Select Color") { + if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { + ToggleRainbow(cosmeticOptions.at("Kal_ItemSelB"), true); + ToggleRainbow(cosmeticOptions.at("Kal_ItemSelC"), true); + ToggleRainbow(cosmeticOptions.at("Kal_ItemSelD"), true); + } else { + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_ItemSelB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_ItemSelC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_ItemSelD"), 1.0f); + } + } else if (cosmeticOption.label == "Equip Select Color") { + if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { + ToggleRainbow(cosmeticOptions.at("Kal_EquipSelB"), true); + ToggleRainbow(cosmeticOptions.at("Kal_EquipSelC"), true); + ToggleRainbow(cosmeticOptions.at("Kal_EquipSelD"), true); + } else { + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_EquipSelB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_EquipSelC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_EquipSelD"), 1.0f); + } + } else if (cosmeticOption.label == "Map Dungeon Color") { + if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { + ToggleRainbow(cosmeticOptions.at("Kal_MapSelDunB"), true); + ToggleRainbow(cosmeticOptions.at("Kal_MapSelDunC"), true); + ToggleRainbow(cosmeticOptions.at("Kal_MapSelDunD"), true); + } else { + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelDunB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelDunC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelDunD"), 1.0f); + } + } else if (cosmeticOption.label == "Quest Status Color") { + if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { + ToggleRainbow(cosmeticOptions.at("Kal_QuestStatusB"), true); + ToggleRainbow(cosmeticOptions.at("Kal_QuestStatusC"), true); + ToggleRainbow(cosmeticOptions.at("Kal_QuestStatusD"), true); + } else { + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_QuestStatusB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_QuestStatusC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_QuestStatusD"), 1.0f); + } + } else if (cosmeticOption.label == "Map Color") { + if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { + ToggleRainbow(cosmeticOptions.at("Kal_MapSelectB"), true); + ToggleRainbow(cosmeticOptions.at("Kal_MapSelectC"), true); + ToggleRainbow(cosmeticOptions.at("Kal_MapSelectD"), true); + } else { + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelectB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelectC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_MapSelectD"), 1.0f); + } + } else if (cosmeticOption.label == "Save Color") { + if (CVarGetInteger(cosmeticOption.rainbowCvar, 0)) { + ToggleRainbow(cosmeticOptions.at("Kal_SaveB"), true); + ToggleRainbow(cosmeticOptions.at("Kal_SaveC"), true); + ToggleRainbow(cosmeticOptions.at("Kal_SaveD"), true); + } else { + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_SaveB"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_SaveC"), 2.0f); + CopyMultipliedColor(cosmeticOption, cosmeticOptions.at("Kal_SaveD"), 1.0f); + } } } +void RandomizeColor(CosmeticOption& cosmeticOption) { + Color_RGBA8 newColor; + newColor.r = Random(0, 255); + newColor.g = Random(0, 255); + newColor.b = Random(0, 255); + newColor.a = 255; + // For alpha supported options, retain the last set alpha instead of overwriting + if (cosmeticOption.supportsAlpha) { + newColor.a = cosmeticOption.currentColor.w * 255; + } + + cosmeticOption.currentColor.x = newColor.r / 255.0; + cosmeticOption.currentColor.y = newColor.g / 255.0; + cosmeticOption.currentColor.z = newColor.b / 255.0; + cosmeticOption.currentColor.w = newColor.a / 255.0; + + CVarSetColor(cosmeticOption.cvar, newColor); + CVarSetInteger((cosmeticOption.rainbowCvar), 0); + CVarSetInteger((cosmeticOption.changedCvar), 1); + ApplySideEffects(cosmeticOption); +} + void ResetColor(CosmeticOption& cosmeticOption) { Color_RGBA8 defaultColor = {cosmeticOption.defaultColor.x, cosmeticOption.defaultColor.y, cosmeticOption.defaultColor.z, cosmeticOption.defaultColor.w}; cosmeticOption.currentColor.x = defaultColor.r / 255.0; @@ -1691,7 +1768,7 @@ void ResetColor(CosmeticOption& cosmeticOption) { CVarClear((std::string(cosmeticOption.cvar) + ".A").c_str()); CVarClear((std::string(cosmeticOption.cvar) + ".Type").c_str()); - // This portion should match 1:1 the multiplied colors in `RandomizeColor()` + // This portion should match 1:1 the multiplied colors in `ApplySideEffect()` if (cosmeticOption.label == "Bow Body") { ResetColor(cosmeticOptions.at("Equipment_BowTips")); ResetColor(cosmeticOptions.at("Equipment_BowHandle")); @@ -1707,6 +1784,30 @@ void ResetColor(CosmeticOption& cosmeticOption) { ResetColor(cosmeticOptions.at("SpinAttack_Level1Primary")); } else if (cosmeticOption.label == "Level 2 Secondary") { ResetColor(cosmeticOptions.at("SpinAttack_Level2Primary")); + } else if (cosmeticOption.label == "Item Select Color") { + ResetColor(cosmeticOptions.at("Kal_ItemSelB")); + ResetColor(cosmeticOptions.at("Kal_ItemSelC")); + ResetColor(cosmeticOptions.at("Kal_ItemSelD")); + } else if (cosmeticOption.label == "Equip Select Color") { + ResetColor(cosmeticOptions.at("Kal_EquipSelB")); + ResetColor(cosmeticOptions.at("Kal_EquipSelC")); + ResetColor(cosmeticOptions.at("Kal_EquipSelD")); + } else if (cosmeticOption.label == "Map Dungeon Color") { + ResetColor(cosmeticOptions.at("Kal_MapSelDunB")); + ResetColor(cosmeticOptions.at("Kal_MapSelDunC")); + ResetColor(cosmeticOptions.at("Kal_MapSelDunD")); + } else if (cosmeticOption.label == "Quest Status Color") { + ResetColor(cosmeticOptions.at("Kal_QuestStatusB")); + ResetColor(cosmeticOptions.at("Kal_QuestStatusC")); + ResetColor(cosmeticOptions.at("Kal_QuestStatusD")); + } else if (cosmeticOption.label == "Map Color") { + ResetColor(cosmeticOptions.at("Kal_MapSelectB")); + ResetColor(cosmeticOptions.at("Kal_MapSelectC")); + ResetColor(cosmeticOptions.at("Kal_MapSelectD")); + } else if (cosmeticOption.label == "Save Color") { + ResetColor(cosmeticOptions.at("Kal_SaveB")); + ResetColor(cosmeticOptions.at("Kal_SaveC")); + ResetColor(cosmeticOptions.at("Kal_SaveD")); } } @@ -1727,6 +1828,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) { CVarSetColor(cosmeticOption.cvar, color); CVarSetInteger((cosmeticOption.rainbowCvar), 0); CVarSetInteger((cosmeticOption.changedCvar), 1); + ApplySideEffects(cosmeticOption); ApplyOrResetCustomGfxPatches(); LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } @@ -1744,6 +1846,7 @@ void DrawCosmeticRow(CosmeticOption& cosmeticOption) { if (ImGui::Checkbox(("Rainbow##" + cosmeticOption.label).c_str(), &isRainbow)) { CVarSetInteger((cosmeticOption.rainbowCvar), isRainbow); CVarSetInteger((cosmeticOption.changedCvar), 1); + ApplySideEffects(cosmeticOption); ApplyOrResetCustomGfxPatches(); LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } @@ -1800,7 +1903,7 @@ static const char* colorSchemes[2] = { }; void CosmeticsEditorWindow::DrawElement() { - ImGui::SetNextWindowSize(ImVec2(480, 520), ImGuiCond_FirstUseEver); + ImGui::SetNextWindowSize(ImVec2(550, 520), ImGuiCond_FirstUseEver); if (!ImGui::Begin("Cosmetics Editor", &mIsVisible)) { ImGui::End(); return; From a7b8c1dbcac917440bfe7e59c736ea5e855c9959 Mon Sep 17 00:00:00 2001 From: Josh Bodner <30329717+jbodner09@users.noreply.github.com> Date: Thu, 15 Feb 2024 17:38:28 -0800 Subject: [PATCH 14/44] Fix neck slider (#3902) --- soh/soh/UIWidgets.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/UIWidgets.cpp b/soh/soh/UIWidgets.cpp index 8de4e9e9d..4817e85fc 100644 --- a/soh/soh/UIWidgets.cpp +++ b/soh/soh/UIWidgets.cpp @@ -449,7 +449,7 @@ namespace UIWidgets { if (changed && !(abs(oldVal - val) < 0.000001f)) { std::stringstream ss; - ss << std::setprecision(ticks + 1) << val; + ss << std::setprecision(ticks + 1) << std::setiosflags(std::ios_base::fixed) << val; val = std::stof(ss.str()); CVarSetFloat(cvarName, val); LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); From 107a365b71f8330559e667495174ba0ebc253e22 Mon Sep 17 00:00:00 2001 From: inspectredc <78732756+inspectredc@users.noreply.github.com> Date: Fri, 16 Feb 2024 01:38:54 +0000 Subject: [PATCH 15/44] Add safety measure to Scene_CommandObjectList to prevent crash (#3904) * dont let k overflow * Update soh/soh/z_scene_otr.cpp Co-authored-by: Archez --------- Co-authored-by: Archez --- soh/soh/z_scene_otr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index 54065e27e..33104326e 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -178,7 +178,7 @@ bool Scene_CommandObjectList(PlayState* play, LUS::ISceneCommand* cmd) { // Loop until a mismatch in the object lists // Then clear all object ids past that in the context object list and kill actors for those objects for (i = play->objectCtx.unk_09, k = 0; i < play->objectCtx.num; i++, k++) { - if (play->objectCtx.status[i].id != cmdObj->objects[k]) { + if (i >= cmdObj->objects.size() || play->objectCtx.status[i].id != cmdObj->objects[k]) { for (j = i; j < play->objectCtx.num; j++) { play->objectCtx.status[j].id = OBJECT_INVALID; } From e68b281b18f5cff7d3bac92d4de797043e207ff5 Mon Sep 17 00:00:00 2001 From: Ted Newman Date: Thu, 15 Feb 2024 17:39:24 -0800 Subject: [PATCH 16/44] [Enhancement] Preserve minimap toggle state between areas (#3906) * Add enhancement to preserve minimap toggle state between areas * add map toggle enhancement to presets --- soh/soh/Enhancements/presets.h | 1 + soh/soh/SohMenuBar.cpp | 2 ++ soh/src/code/z_construct.c | 4 +++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index 8a9b963e8..572439e22 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -331,6 +331,7 @@ const std::vector cheatCvars = { "gCosmetics.Link_HeadScale.Value", "gCosmetics.Link_SwordScale.Changed", "gCosmetics.Link_SwordScale.Value", + "gEnhancements.RememberMapToggleState", }; const std::vector randomizerCvars = { diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index d74649290..5f41f1e25 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -988,6 +988,8 @@ void DrawEnhancementsMenu() { UIWidgets::Tooltip("Disables the voice audio when Navi calls you"); UIWidgets::PaddedEnhancementCheckbox("Disable Hot/Underwater Warning Text", "gDisableTunicWarningText", true, false); UIWidgets::Tooltip("Disables warning text when you don't have on the Goron/Zora Tunic in Hot/Underwater conditions."); + UIWidgets::PaddedEnhancementCheckbox("Remember Minimap State Between Areas", "gEnhancements.RememberMapToggleState"); + UIWidgets::Tooltip("Preserves the minimap visibility state when going between areas rather than defaulting it to \"on\" when going through loading zones."); ImGui::EndMenu(); } diff --git a/soh/src/code/z_construct.c b/soh/src/code/z_construct.c index b95902cc5..c8a340492 100644 --- a/soh/src/code/z_construct.c +++ b/soh/src/code/z_construct.c @@ -430,7 +430,9 @@ void Regs_InitDataImpl(void) { WREG(28) = 0; R_OW_MINIMAP_X = 238; R_OW_MINIMAP_Y = 164; - R_MINIMAP_DISABLED = CVarGetInteger("gMinimalUI", 0); + if (!CVarGetInteger("gEnhancements.RememberMapToggleState", 0)) { + R_MINIMAP_DISABLED = CVarGetInteger("gMinimalUI", 0); + } WREG(32) = 122; WREG(33) = 60; WREG(35) = 0; From eeb6c7faaa16d50ce0d094e191c5778cc2ce904e Mon Sep 17 00:00:00 2001 From: "Tina H. (sheepytina)" <99330992+sheepytina@users.noreply.github.com> Date: Fri, 16 Feb 2024 12:47:13 +1100 Subject: [PATCH 17/44] Fix Cosmetics Editor getting stuck on weapon trails (#3913) * Partially fix cosmetics editor getting stuck on sword trails. * No reason for "reset" to be static. * bombchu --- soh/src/code/z_eff_blure.c | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/soh/src/code/z_eff_blure.c b/soh/src/code/z_eff_blure.c index 91ac43766..e770a9096 100644 --- a/soh/src/code/z_eff_blure.c +++ b/soh/src/code/z_eff_blure.c @@ -203,13 +203,17 @@ s32 EffectBlure_Update(void* thisx) { EffectBlure* this = (EffectBlure*)thisx; s32 i; Color_RGBA8 color; - u8 changed = 0; + static u8 changed = 0; + u8 reset = 0; switch (this->trailType) { //there HAS to be a better way to do this. case 2: if (CVarGetInteger("gCosmetics.Trails_Boomerang.Changed", 0)) { color = CVarGetColor("gCosmetics.Trails_Boomerang.Value", (Color_RGBA8){ 255, 255, 100, 255 }); changed = 1; + } else if (changed) { + color = (Color_RGBA8){ 255, 255, 100, 255 }; + reset = 1; } break; case 3: @@ -227,36 +231,65 @@ s32 EffectBlure_Update(void* thisx) { this->p2StartColor.b = color.b * 0.8f; this->p1EndColor.b = color.b * 0.6f; this->p2EndColor.b = color.b * 0.4f; + } else if (changed) { + color = (Color_RGBA8){ 250, 0, 0, 255 }; + this->p1StartColor.r = color.r; + this->p2StartColor.r = color.r * 0.8f; + this->p1EndColor.r = color.r * 0.6f; + this->p2EndColor.r = color.r * 0.4f; + this->p1StartColor.g = color.g; + this->p2StartColor.g = color.g * 0.8f; + this->p1EndColor.g = color.g * 0.6f; + this->p2EndColor.g = color.g * 0.4f; + this->p1StartColor.b = color.b; + this->p2StartColor.b = color.b * 0.8f; + this->p1EndColor.b = color.b * 0.6f; + this->p2EndColor.b = color.b * 0.4f; } break; case 4: if (CVarGetInteger("gCosmetics.Trails_KokiriSword.Changed", 0)) { color = CVarGetColor("gCosmetics.Trails_KokiriSword.Value", (Color_RGBA8){ 255, 255, 255, 255 }); changed = 1; + } else if (changed) { + color = (Color_RGBA8){ 255, 255, 255, 255 }; + reset = 1; } break; case 5: if (CVarGetInteger("gCosmetics.Trails_MasterSword.Changed", 0)) { color = CVarGetColor("gCosmetics.Trails_MasterSword.Value", (Color_RGBA8){ 255, 255, 255, 255 }); changed = 1; + } else if (changed) { + color = (Color_RGBA8){ 255, 255, 255, 255 }; + reset = 1; } break; case 6: if (CVarGetInteger("gCosmetics.Trails_BiggoronSword.Changed", 0)) { color = CVarGetColor("gCosmetics.Trails_BiggoronSword.Value", (Color_RGBA8){ 255, 255, 255, 255 }); changed = 1; + } else if (changed) { + color = (Color_RGBA8){ 255, 255, 255, 255 }; + reset = 1; } break; case 7: if (CVarGetInteger("gCosmetics.Trails_Stick.Changed", 0)) { color = CVarGetColor("gCosmetics.Trails_Stick.Value", (Color_RGBA8){ 255, 255, 255, 255 }); changed = 1; + } else if (changed) { + color = (Color_RGBA8){ 255, 255, 255, 255 }; + reset = 1; } break; case 8: if (CVarGetInteger("gCosmetics.Trails_Hammer.Changed", 0)) { color = CVarGetColor("gCosmetics.Trails_Hammer.Value", (Color_RGBA8){ 255, 255, 255, 255 }); changed = 1; + } else if (changed) { + color = (Color_RGBA8){ 255, 255, 255, 255 }; + reset = 1; } break; default: // don't do anything @@ -278,6 +311,9 @@ s32 EffectBlure_Update(void* thisx) { this->p1EndColor.b = color.b; this->p2EndColor.b = color.b; } + if (reset) { + changed = 0; + } // Don't override boomerang and bombchu trail durations if (this->trailType != 2 && this->trailType != 3) { From 7ccc816772c4cc036c1653d66e2895eb82100e11 Mon Sep 17 00:00:00 2001 From: "Tina H. (sheepytina)" <99330992+sheepytina@users.noreply.github.com> Date: Fri, 16 Feb 2024 12:49:13 +1100 Subject: [PATCH 18/44] Cosmetics Editor fixes for icons in z_message_PAL.c (#3914) * Fix resetting button icon colours in message boxes. * Fix type/math error for custom color in textbox icon pulsing. * Fix type error for custom color in ocarina icon pulsing. * Make custom env colour math more closely match vanilla equivalents. * Make comments presentable. --- soh/src/code/z_message_PAL.c | 73 +++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 35 deletions(-) diff --git a/soh/src/code/z_message_PAL.c b/soh/src/code/z_message_PAL.c index 4c661aad7..234972ff6 100644 --- a/soh/src/code/z_message_PAL.c +++ b/soh/src/code/z_message_PAL.c @@ -453,19 +453,20 @@ void Message_SetTextColor(MessageContext* msgCtx, u16 colorParameter) { } void Message_DrawTextboxIcon(PlayState* play, Gfx** p, s16 x, s16 y) { - static Color_RGB8 sIconPrimColors[2] = { + // SoH [Cosmetics] The following Color_RGB8 were originally static + Color_RGB8 sIconPrimColors[2] = { { 0, 80, 200 }, { 50, 130, 255 }, }; - static Color_RGB8 sIconEnvColors[2] = { + Color_RGB8 sIconEnvColors[2] = { { 0, 0, 0 }, { 0, 130, 255 }, }; if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_AButton.Value", (Color_RGB8){ 50, 130, 255 }); - sIconPrimColors[0].r = (color.r / 255) * 95; - sIconPrimColors[0].g = (color.g / 255) * 95; - sIconPrimColors[0].b = (color.b / 255) * 95; + sIconPrimColors[0].r = color.r - 50; + sIconPrimColors[0].g = color.g - 50; + sIconPrimColors[0].b = color.b - 50; sIconPrimColors[1] = color; sIconEnvColors[1] = color; } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { @@ -2006,19 +2007,21 @@ void Message_DrawMain(PlayState* play, Gfx** p) { static void* sOcarinaNoteTextures[] = { gOcarinaBtnIconATex, gOcarinaBtnIconCDownTex, gOcarinaBtnIconCRightTex, gOcarinaBtnIconCLeftTex, gOcarinaBtnIconCUpTex, }; - static Color_RGB8 sOcarinaNoteAPrimColors[2] = { + + // SoH [Cosmetics] The following Color_RGB8 were originally static + Color_RGB8 sOcarinaNoteAPrimColors[2] = { { 80, 150, 255 }, { 100, 200, 255 }, }; - static Color_RGB8 sOcarinaNoteAEnvColors[2] = { + Color_RGB8 sOcarinaNoteAEnvColors[2] = { { 10, 10, 10 }, { 50, 50, 255 }, }; if (CVarGetInteger("gCosmetics.Hud_AButton.Changed", 0)) { Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_AButton.Value", (Color_RGB8){ 100, 200, 255 }); - sOcarinaNoteAPrimColors[0].r = (color.r / 255) * 95; - sOcarinaNoteAPrimColors[0].g = (color.g / 255) * 95; - sOcarinaNoteAPrimColors[0].b = (color.b / 255) * 95; + sOcarinaNoteAPrimColors[0].r = (color.r / 255.0f) * 95; + sOcarinaNoteAPrimColors[0].g = (color.g / 255.0f) * 95; + sOcarinaNoteAPrimColors[0].b = (color.b / 255.0f) * 95; sOcarinaNoteAPrimColors[1] = color; sOcarinaNoteAEnvColors[1] = color; } else if (CVarGetInteger("gCosmetics.DefaultColorScheme", COLORSCHEME_N64) == COLORSCHEME_GAMECUBE) { @@ -2027,11 +2030,11 @@ void Message_DrawMain(PlayState* play, Gfx** p) { sOcarinaNoteAEnvColors[1] = (Color_RGB8){ 50, 255, 50 }; } - static Color_RGB8 sOcarinaNoteCPrimColors[2] = { + Color_RGB8 sOcarinaNoteCPrimColors[2] = { { 255, 255, 50 }, { 255, 255, 180 }, }; - static Color_RGB8 sOcarinaNoteCEnvColors[2] = { + Color_RGB8 sOcarinaNoteCEnvColors[2] = { { 10, 10, 10 }, { 110, 110, 50 }, }; @@ -2039,16 +2042,16 @@ void Message_DrawMain(PlayState* play, Gfx** p) { Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_CButtons.Value", (Color_RGB8){ 100, 200, 255 }); sOcarinaNoteCPrimColors[0] = color; sOcarinaNoteCPrimColors[1] = color; - sOcarinaNoteCEnvColors[1].r = (color.r / 255) * 95; - sOcarinaNoteCEnvColors[1].g = (color.g / 255) * 95; - sOcarinaNoteCEnvColors[1].b = (color.b / 255) * 95; + sOcarinaNoteCEnvColors[1].r = (color.r / 255.0f) * 95; + sOcarinaNoteCEnvColors[1].g = (color.g / 255.0f) * 95; + sOcarinaNoteCEnvColors[1].b = (color.b / 255.0f) * 95; } - static Color_RGB8 sOcarinaNoteCUpPrimColors[2] = { + Color_RGB8 sOcarinaNoteCUpPrimColors[2] = { { 255, 255, 50 }, { 255, 255, 180 }, }; - static Color_RGB8 sOcarinaNoteCUpEnvColors[2] = { + Color_RGB8 sOcarinaNoteCUpEnvColors[2] = { { 10, 10, 10 }, { 110, 110, 50 }, }; @@ -2056,16 +2059,16 @@ void Message_DrawMain(PlayState* play, Gfx** p) { Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_CUpButton.Value", (Color_RGB8){ 100, 200, 255 }); sOcarinaNoteCUpPrimColors[0] = color; sOcarinaNoteCUpPrimColors[1] = color; - sOcarinaNoteCUpEnvColors[1].r = (color.r / 255) * 95; - sOcarinaNoteCUpEnvColors[1].g = (color.g / 255) * 95; - sOcarinaNoteCUpEnvColors[1].b = (color.b / 255) * 95; + sOcarinaNoteCUpEnvColors[1].r = (color.r / 255.0f) * 95; + sOcarinaNoteCUpEnvColors[1].g = (color.g / 255.0f) * 95; + sOcarinaNoteCUpEnvColors[1].b = (color.b / 255.0f) * 95; } - static Color_RGB8 sOcarinaNoteCDownPrimColors[2] = { + Color_RGB8 sOcarinaNoteCDownPrimColors[2] = { { 255, 255, 50 }, { 255, 255, 180 }, }; - static Color_RGB8 sOcarinaNoteCDownEnvColors[2] = { + Color_RGB8 sOcarinaNoteCDownEnvColors[2] = { { 10, 10, 10 }, { 110, 110, 50 }, }; @@ -2073,16 +2076,16 @@ void Message_DrawMain(PlayState* play, Gfx** p) { Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_CDownButton.Value", (Color_RGB8){ 100, 200, 255 }); sOcarinaNoteCDownPrimColors[0] = color; sOcarinaNoteCDownPrimColors[1] = color; - sOcarinaNoteCDownEnvColors[1].r = (color.r / 255) * 95; - sOcarinaNoteCDownEnvColors[1].g = (color.g / 255) * 95; - sOcarinaNoteCDownEnvColors[1].b = (color.b / 255) * 95; + sOcarinaNoteCDownEnvColors[1].r = (color.r / 255.0f) * 95; + sOcarinaNoteCDownEnvColors[1].g = (color.g / 255.0f) * 95; + sOcarinaNoteCDownEnvColors[1].b = (color.b / 255.0f) * 95; } - static Color_RGB8 sOcarinaNoteCLeftPrimColors[2] = { + Color_RGB8 sOcarinaNoteCLeftPrimColors[2] = { { 255, 255, 50 }, { 255, 255, 180 }, }; - static Color_RGB8 sOcarinaNoteCLeftEnvColors[2] = { + Color_RGB8 sOcarinaNoteCLeftEnvColors[2] = { { 10, 10, 10 }, { 110, 110, 50 }, }; @@ -2090,16 +2093,16 @@ void Message_DrawMain(PlayState* play, Gfx** p) { Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_CLeftButton.Value", (Color_RGB8){ 100, 200, 255 }); sOcarinaNoteCLeftPrimColors[0] = color; sOcarinaNoteCLeftPrimColors[1] = color; - sOcarinaNoteCLeftEnvColors[1].r = (color.r / 255) * 95; - sOcarinaNoteCLeftEnvColors[1].g = (color.g / 255) * 95; - sOcarinaNoteCLeftEnvColors[1].b = (color.b / 255) * 95; + sOcarinaNoteCLeftEnvColors[1].r = (color.r / 255.0f) * 95; + sOcarinaNoteCLeftEnvColors[1].g = (color.g / 255.0f) * 95; + sOcarinaNoteCLeftEnvColors[1].b = (color.b / 255.0f) * 95; } - static Color_RGB8 sOcarinaNoteCRightPrimColors[2] = { + Color_RGB8 sOcarinaNoteCRightPrimColors[2] = { { 255, 255, 50 }, { 255, 255, 180 }, }; - static Color_RGB8 sOcarinaNoteCRightEnvColors[2] = { + Color_RGB8 sOcarinaNoteCRightEnvColors[2] = { { 10, 10, 10 }, { 110, 110, 50 }, }; @@ -2107,9 +2110,9 @@ void Message_DrawMain(PlayState* play, Gfx** p) { Color_RGB8 color = CVarGetColor24("gCosmetics.Hud_CRightButton.Value", (Color_RGB8){ 100, 200, 255 }); sOcarinaNoteCRightPrimColors[0] = color; sOcarinaNoteCRightPrimColors[1] = color; - sOcarinaNoteCRightEnvColors[1].r = (color.r / 255) * 95; - sOcarinaNoteCRightEnvColors[1].g = (color.g / 255) * 95; - sOcarinaNoteCRightEnvColors[1].b = (color.b / 255) * 95; + sOcarinaNoteCRightEnvColors[1].r = (color.r / 255.0f) * 95; + sOcarinaNoteCRightEnvColors[1].g = (color.g / 255.0f) * 95; + sOcarinaNoteCRightEnvColors[1].b = (color.b / 255.0f) * 95; } static s16 sOcarinaNoteFlashTimer = 12; From 2c5cb58ef6fec2d690b4bd3f307d9927496069d6 Mon Sep 17 00:00:00 2001 From: mckinlee Date: Thu, 15 Feb 2024 20:49:56 -0500 Subject: [PATCH 19/44] Rename func_80853148 to Player_StartTalking (#3915) -In PR #3498 I renamed this function for clarity and decided to make a quick seperate PR for this change. --- .../actors/ovl_player_actor/z_player.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) 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 852c8d3d5..0651f900b 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -347,7 +347,7 @@ s32 Player_TryCsAction(PlayState* play, Actor* actor, s32 csAction); void func_80853080(Player* this, PlayState* play); s32 Player_InflictDamage(PlayState* play, s32 damage); s32 Player_InflictDamageModified(PlayState* play, s32 damage, u8 modified); -void func_80853148(PlayState* play, Actor* actor); +void Player_StartTalking(PlayState* play, Actor* actor); // .bss part 1 static s32 D_80858AA0; @@ -4708,7 +4708,7 @@ s32 func_80839800(Player* this, PlayState* play) { if (this->doorType <= PLAYER_DOORTYPE_AJAR) { doorActor->textId = 0xD0; - func_80853148(play, doorActor); + Player_StartTalking(play, doorActor); return 0; } @@ -5533,7 +5533,7 @@ s32 func_8083B644(Player* this, PlayState* play) { } this->currentMask = D_80858AA4; - func_80853148(play, sp34); + Player_StartTalking(play, sp34); return 1; } } @@ -10040,7 +10040,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { play->startPlayerCutscene = Player_TryCsAction; play->func_11D54 = func_80853080; play->damagePlayer = Player_InflictDamage; - play->talkWithPlayer = func_80853148; + play->talkWithPlayer = Player_StartTalking; thisx->room = -1; this->ageProperties = &sAgeProperties[gSaveContext.linkAge]; @@ -13496,11 +13496,11 @@ void func_8084E3C4(Player* this, PlayState* play) { func_8005B1A4(Play_GetCamera(play, 0)); if ((this->targetActor != NULL) && (this->targetActor == this->unk_6A8)) { - func_80853148(play, this->targetActor); + Player_StartTalking(play, this->targetActor); } else if (this->naviTextId < 0) { this->targetActor = this->naviActor; this->naviActor->textId = -this->naviTextId; - func_80853148(play, this->targetActor); + Player_StartTalking(play, this->targetActor); } else if (!func_8083B040(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_okarina_end, play); } @@ -13570,7 +13570,7 @@ void func_8084E6D4(Player* this, PlayState* play) { this->exchangeItemId = EXCH_ITEM_NONE; if (func_8084B4D4(play, this) == 0) { - func_80853148(play, this->targetActor); + Player_StartTalking(play, this->targetActor); } } else { func_8084DFAC(play, this); @@ -13952,7 +13952,7 @@ void func_8084F104(Player* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_PLAYER_TALKED_TO; } - func_80853148(play, targetActor); + Player_StartTalking(play, targetActor); } else { GetItemEntry giEntry = ItemTable_Retrieve(D_80854528[this->exchangeItemId - 1]); @@ -15832,7 +15832,7 @@ s32 Player_InflictDamageModified(PlayState* play, s32 damage, u8 modified) { } // Start talking with the given actor -void func_80853148(PlayState* play, Actor* actor) { +void Player_StartTalking(PlayState* play, Actor* actor) { Player* this = GET_PLAYER(play); s32 pad; From 11a0a0063352018660467edaf0e66e38fb6b192b Mon Sep 17 00:00:00 2001 From: Malkierian Date: Thu, 15 Feb 2024 18:50:31 -0700 Subject: [PATCH 20/44] Add `CVarClear` to appropriate sections of randomizer Locations and Tricks tabs to get around issue with saving blank CVar strings. (#3916) --- soh/soh/Enhancements/randomizer/randomizer.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer.cpp b/soh/soh/Enhancements/randomizer/randomizer.cpp index ab3554174..835621fd3 100644 --- a/soh/soh/Enhancements/randomizer/randomizer.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer.cpp @@ -4689,7 +4689,11 @@ void RandomizerSettingsWindow::DrawElement() { excludedLocationString += std::to_string(excludedLocationIt); excludedLocationString += ","; } - CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str()); + if (excludedLocationString == "") { + CVarClear("gRandomizeExcludedLocations"); + } else { + CVarSetString("gRandomizeExcludedLocations", excludedLocationString.c_str()); + } LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); @@ -4866,7 +4870,7 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += ","; } - CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); + CVarClear("gRandomizeEnabledTricks"); LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } ImGui::SameLine(); @@ -5070,7 +5074,7 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += ","; } - CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); + CVarClear("gRandomizeEnabledTricks"); LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } @@ -5108,7 +5112,11 @@ void RandomizerSettingsWindow::DrawElement() { enabledTrickString += std::to_string(enabledTrickIt); enabledTrickString += ","; } - CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); + if (enabledTrickString == "") { + CVarClear("gRandomizeEnabledTricks"); + } else { + CVarSetString("gRandomizeEnabledTricks", enabledTrickString.c_str()); + } LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); } DrawTagChips(*rtObject.rtTags); From 43fed2d77e7efe1c187c2fe5ae5794e95d5c8893 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 15 Feb 2024 20:51:31 -0500 Subject: [PATCH 21/44] ci: pin switch docker image to known working version (#3917) --- .github/workflows/generate-builds.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/generate-builds.yml b/.github/workflows/generate-builds.yml index cd8a6fd9b..38cc4c9ad 100644 --- a/.github/workflows/generate-builds.yml +++ b/.github/workflows/generate-builds.yml @@ -191,7 +191,7 @@ jobs: needs: generate-soh-otr runs-on: ${{ (vars.LINUX_RUNNER && fromJSON(vars.LINUX_RUNNER)) || 'ubuntu-latest' }} container: - image: devkitpro/devkita64:latest + image: devkitpro/devkita64:20240120 steps: - name: Install dependencies run: | From bbac8f8da40adfb86d82066f5ce6aa041abb3a58 Mon Sep 17 00:00:00 2001 From: Ted Newman Date: Thu, 15 Feb 2024 17:52:46 -0800 Subject: [PATCH 22/44] [Fixes] Fix for Zora hint dialogue condition with an inverted flag check (#3920) * [Fixes] Fix for Zora hint dialogue condition with an inverted flag check * Base dialogue off of ruto's letter flag * simplify condition --- soh/soh/SohMenuBar.cpp | 2 ++ soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 5f41f1e25..4450d3aa1 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1236,6 +1236,8 @@ void DrawEnhancementsMenu() { UIWidgets::PaddedEnhancementCheckbox("Fix Darunia dancing too fast", "gEnhancements.FixDaruniaDanceSpeed", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip("Fixes Darunia's dancing speed so he dances to the beat of Saria's Song, like in vanilla."); + UIWidgets::PaddedEnhancementCheckbox("Fix Zora hint dialogue", "gFixZoraHintDialogue", true, false); + UIWidgets::Tooltip("Fixes one Zora's dialogue giving a hint about bringing Ruto's Letter to King Zora to properly occur before moving King Zora rather than after"); ImGui::EndMenu(); } diff --git a/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c index 561ebf81b..f5275618b 100644 --- a/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/soh/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -361,7 +361,7 @@ void EnZo_SpawnSplashes(EnZo* this) { } } -u16 func_80B61024(PlayState* play, Actor* thisx) { +u16 EnZo_GetTextId(PlayState* play, Actor* thisx) { u16 textId; textId = Text_GetFaceReaction(play, 29); @@ -427,7 +427,9 @@ u16 func_80B61024(PlayState* play, Actor* thisx) { return 0x402D; } - if (Flags_GetEventChkInf(EVENTCHKINF_KING_ZORA_MOVED)) { + if (Flags_GetEventChkInf(EVENTCHKINF_KING_ZORA_MOVED) || + (CVarGetInteger("gFixZoraHintDialogue", 0) && + Flags_GetEventChkInf(EVENTCHKINF_OBTAINED_RUTOS_LETTER))) { return 0x4010; } if (Flags_GetEventChkInf(EVENTCHKINF_SPOKE_TO_A_ZORA)) { @@ -520,7 +522,7 @@ void EnZo_Dialog(EnZo* this, PlayState* play) { } Npc_TrackPoint(&this->actor, &this->interactInfo, 11, this->trackingMode); if (this->canSpeak == true) { - Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->dialogRadius, func_80B61024, + Npc_UpdateTalking(play, &this->actor, &this->interactInfo.talkState, this->dialogRadius, EnZo_GetTextId, func_80B61298); } } From 0cb4cd158aa1243cbec697fff6e663551764b39b Mon Sep 17 00:00:00 2001 From: Malkierian Date: Thu, 15 Feb 2024 18:53:18 -0700 Subject: [PATCH 23/44] Adds reset function to z_en_si (GS Token) to set getItemId to vanilla after resetting SoH. (#3925) --- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c index 49e88f903..f6c87074d 100644 --- a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -16,6 +16,7 @@ void EnSi_Init(Actor* thisx, PlayState* play); void EnSi_Destroy(Actor* thisx, PlayState* play); void EnSi_Update(Actor* thisx, PlayState* play); void EnSi_Draw(Actor* thisx, PlayState* play); +void EnSi_Reset(); s32 func_80AFB748(EnSi* this, PlayState* play); void func_80AFB768(EnSi* this, PlayState* play); @@ -61,7 +62,7 @@ const ActorInit En_Si_InitVars = { (ActorFunc)EnSi_Destroy, (ActorFunc)EnSi_Update, (ActorFunc)EnSi_Draw, - NULL, + (ActorResetFunc)EnSi_Reset, }; void EnSi_Init(Actor* thisx, PlayState* play) { @@ -224,6 +225,11 @@ void EnSi_Draw(Actor* thisx, PlayState* play) { } } +void EnSi_Reset() { + textId = 0xB4; + giveItemId = ITEM_SKULL_TOKEN; +} + void Randomizer_UpdateSkullReward(EnSi* this, PlayState* play) { Player* player = GET_PLAYER(play); From 3d3b8bfc5b22fdc056cea448738fe904a8523f02 Mon Sep 17 00:00:00 2001 From: Archez Date: Thu, 15 Feb 2024 20:54:35 -0500 Subject: [PATCH 24/44] Allow IsSaveLoaded to consider debug saves (#3929) --- .../game-interactor/GameInteractor.cpp | 11 ++++++-- .../game-interactor/GameInteractor.h | 2 +- soh/soh/Enhancements/mods.cpp | 27 ++++++++++--------- soh/soh/Enhancements/tts/tts.cpp | 2 +- 4 files changed, 26 insertions(+), 16 deletions(-) diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor.cpp index eb330947b..5a0d0efd3 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.cpp @@ -37,12 +37,19 @@ GameInteractionEffectQueryResult GameInteractor::RemoveEffect(GameInteractionEff // MARK: - Helpers -bool GameInteractor::IsSaveLoaded() { +bool GameInteractor::IsSaveLoaded(bool allowDbgSave) { Player* player; if (gPlayState != NULL) { player = GET_PLAYER(gPlayState); } - return (gPlayState == NULL || player == NULL || gSaveContext.fileNum < 0 || gSaveContext.fileNum > 2) ? false : true; + + // Checking for normal game mode prevents debug saves from reporting true on title screen + if (gPlayState == NULL || player == NULL || gSaveContext.gameMode != GAMEMODE_NORMAL) { + return false; + } + + // Valid save file or debug save + return (gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2) || (allowDbgSave && gSaveContext.fileNum == 0xFF); } bool GameInteractor::IsGameplayPaused() { diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index 4f8ef259b..b56a001d2 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -198,7 +198,7 @@ public: DEFINE_HOOK(OnAssetAltChange, void()); // Helpers - static bool IsSaveLoaded(); + static bool IsSaveLoaded(bool allowDbgSave = false); static bool IsGameplayPaused(); static bool CanSpawnActor(); static bool CanAddOrTakeAmmo(int16_t amount, int16_t item); diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 6692dd5c9..258fbba42 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -47,7 +47,7 @@ void ReloadSceneTogglingLinkAge() { void RegisterInfiniteMoney() { GameInteractor::Instance->RegisterGameHook([]() { - if (!GameInteractor::IsSaveLoaded()) return; + if (!GameInteractor::IsSaveLoaded(true)) return; if (CVarGetInteger("gInfiniteMoney", 0) != 0) { if (gSaveContext.rupees < CUR_CAPACITY(UPG_WALLET)) { gSaveContext.rupees = CUR_CAPACITY(UPG_WALLET); @@ -58,7 +58,7 @@ void RegisterInfiniteMoney() { void RegisterInfiniteHealth() { GameInteractor::Instance->RegisterGameHook([]() { - if (!GameInteractor::IsSaveLoaded()) return; + if (!GameInteractor::IsSaveLoaded(true)) return; if (CVarGetInteger("gInfiniteHealth", 0) != 0) { if (gSaveContext.health < gSaveContext.healthCapacity) { gSaveContext.health = gSaveContext.healthCapacity; @@ -69,7 +69,7 @@ void RegisterInfiniteHealth() { void RegisterInfiniteAmmo() { GameInteractor::Instance->RegisterGameHook([]() { - if (!GameInteractor::IsSaveLoaded()) return; + if (!GameInteractor::IsSaveLoaded(true)) return; if (CVarGetInteger("gInfiniteAmmo", 0) != 0) { // Deku Sticks if (AMMO(ITEM_STICK) < CUR_CAPACITY(UPG_STICKS)) { @@ -106,7 +106,7 @@ void RegisterInfiniteAmmo() { void RegisterInfiniteMagic() { GameInteractor::Instance->RegisterGameHook([]() { - if (!GameInteractor::IsSaveLoaded()) return; + if (!GameInteractor::IsSaveLoaded(true)) return; if (CVarGetInteger("gInfiniteMagic", 0) != 0) { if (gSaveContext.isMagicAcquired && gSaveContext.magic != (gSaveContext.isDoubleMagicAcquired + 1) * 0x30) { gSaveContext.magic = (gSaveContext.isDoubleMagicAcquired + 1) * 0x30; @@ -117,7 +117,7 @@ void RegisterInfiniteMagic() { void RegisterInfiniteNayrusLove() { GameInteractor::Instance->RegisterGameHook([]() { - if (!GameInteractor::IsSaveLoaded()) return; + if (!GameInteractor::IsSaveLoaded(true)) return; if (CVarGetInteger("gInfiniteNayru", 0) != 0) { gSaveContext.nayrusLoveTimer = 0x44B; } @@ -126,7 +126,7 @@ void RegisterInfiniteNayrusLove() { void RegisterMoonJumpOnL() { GameInteractor::Instance->RegisterGameHook([]() { - if (!GameInteractor::IsSaveLoaded()) return; + if (!GameInteractor::IsSaveLoaded(true)) return; if (CVarGetInteger("gMoonJumpOnL", 0) != 0) { Player* player = GET_PLAYER(gPlayState); @@ -141,7 +141,7 @@ void RegisterMoonJumpOnL() { void RegisterInfiniteISG() { GameInteractor::Instance->RegisterGameHook([]() { - if (!GameInteractor::IsSaveLoaded()) return; + if (!GameInteractor::IsSaveLoaded(true)) return; if (CVarGetInteger("gEzISG", 0) != 0) { Player* player = GET_PLAYER(gPlayState); @@ -153,7 +153,7 @@ void RegisterInfiniteISG() { //Permanent quick put away (QPA) glitched damage value void RegisterEzQPA() { GameInteractor::Instance->RegisterGameHook([]() { - if (!GameInteractor::IsSaveLoaded()) return; + if (!GameInteractor::IsSaveLoaded(true)) return; if (CVarGetInteger("gEzQPA", 0) != 0) { Player* player = GET_PLAYER(gPlayState); @@ -165,7 +165,7 @@ void RegisterEzQPA() { void RegisterUnrestrictedItems() { GameInteractor::Instance->RegisterGameHook([]() { - if (!GameInteractor::IsSaveLoaded()) return; + if (!GameInteractor::IsSaveLoaded(true)) return; if (CVarGetInteger("gNoRestrictItems", 0) != 0) { u8 sunsBackup = gPlayState->interfaceCtx.restrictions.sunsSong; @@ -193,11 +193,14 @@ void RegisterFreezeTime() { /// Switches Link's age and respawns him at the last entrance he entered. void RegisterSwitchAge() { GameInteractor::Instance->RegisterGameHook([]() { - if (!GameInteractor::IsSaveLoaded()) { + static bool warped = false; + + if (!GameInteractor::IsSaveLoaded(true)) { CVarClear("gSwitchAge"); + warped = false; return; } - static bool warped = false; + static Vec3f playerPos; static int16_t playerYaw; static RoomContext* roomCtx; @@ -231,7 +234,7 @@ void RegisterSwitchAge() { void RegisterOcarinaTimeTravel() { GameInteractor::Instance->RegisterGameHook([]() { - if (!GameInteractor::IsSaveLoaded()) { + if (!GameInteractor::IsSaveLoaded(true)) { CVarClear("gTimeTravel"); return; } diff --git a/soh/soh/Enhancements/tts/tts.cpp b/soh/soh/Enhancements/tts/tts.cpp index 0b46cd18f..9e5ff4a42 100644 --- a/soh/soh/Enhancements/tts/tts.cpp +++ b/soh/soh/Enhancements/tts/tts.cpp @@ -168,7 +168,7 @@ void RegisterOnInterfaceUpdateHook() { prevTimer = timer; - if (!GameInteractor::IsSaveLoaded()) return; + if (!GameInteractor::IsSaveLoaded(true)) return; static int16_t lostHealth = 0; static int16_t prevHealth = 0; From bdfcf39e5685b967699e7ac55ab7140f4bce5d2f Mon Sep 17 00:00:00 2001 From: Ted Newman Date: Thu, 15 Feb 2024 17:55:01 -0800 Subject: [PATCH 25/44] Add a link to ship.equipment to the CRC error message box during extraction (#3939) * Add a link to ship.equipment to the CRC error message box during extraction * Improve message and add to ShowCrcErrorBox * Change 'known good roms' to 'known compatible roms' --- soh/soh/Extractor/Extract.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/soh/soh/Extractor/Extract.cpp b/soh/soh/Extractor/Extract.cpp index d4b524474..b08783763 100644 --- a/soh/soh/Extractor/Extract.cpp +++ b/soh/soh/Extractor/Extract.cpp @@ -107,7 +107,8 @@ void Extractor::ShowSizeErrorBox() const { } void Extractor::ShowCrcErrorBox() const { - ShowErrorBox("Rom CRC invalid", "Rom CRC did not match the list of known good roms. Please find another."); + ShowErrorBox("Rom CRC invalid", "Rom CRC did not match the list of known compatible roms. Please find another.\n\n" + "Visit https://ship.equipment/ to validate your ROM and see a list of compatible versions"); } void Extractor::ShowCompressedErrorBox() const { @@ -479,7 +480,8 @@ bool Extractor::Run(std::string searchPath, RomSearchMode searchMode) { ShowCrcErrorBox(); } else { ShowErrorBox("Rom CRC invalid", - "Rom CRC did not match the list of known good roms. Trying the next one..."); + "Rom CRC did not match the list of known compatible roms. Trying the next one...\n\n" + "Visit https://ship.equipment/ to validate your ROM and see a list of compatible versions"); } continue; } From cf6101f4daeb8591c65b8a3d0262b4888e000d06 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Fri, 16 Feb 2024 02:03:58 +0000 Subject: [PATCH 26/44] Logic bug: child cannot climb forest temple to the straight hallway either (#3934) --- .../randomizer/3drando/location_access/locacc_forest_temple.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_forest_temple.cpp b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_forest_temple.cpp index fea9fda6f..5e64aee6c 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_forest_temple.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access/locacc_forest_temple.cpp @@ -172,7 +172,7 @@ void AreaTable_Init_ForestTemple() { Entrance(FOREST_TEMPLE_WEST_CORRIDOR, {[]{return true;}}), Entrance(FOREST_TEMPLE_NW_OUTDOORS_UPPER, {[]{return CanUse(HOVER_BOOTS) || (LogicForestOutsideBackdoor && CanJumpslash && GoronBracelet);}}), Entrance(FOREST_TEMPLE_NW_CORRIDOR_TWISTED, {[]{return IsAdult && GoronBracelet && SmallKeys(FOREST_TEMPLE, 2);}}), - Entrance(FOREST_TEMPLE_NW_CORRIDOR_STRAIGHTENED, {[]{return (CanUse(BOW) || CanUse(SLINGSHOT)) && GoronBracelet && SmallKeys(FOREST_TEMPLE, 2);}}), + Entrance(FOREST_TEMPLE_NW_CORRIDOR_STRAIGHTENED, {[]{return IsAdult && (CanUse(BOW) || CanUse(SLINGSHOT)) && GoronBracelet && SmallKeys(FOREST_TEMPLE, 2);}}), }); areaTable[FOREST_TEMPLE_NW_CORRIDOR_TWISTED] = Area("Forest Temple NW Corridor Twisted", "Forest Temple", FOREST_TEMPLE, NO_DAY_NIGHT_CYCLE, {}, {}, { From a84227cbbb755681ea8534460a665e5e8c524f4b Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Thu, 15 Feb 2024 20:08:31 -0600 Subject: [PATCH 27/44] Support hook unregistration (#3538) --- .../game-interactor/GameInteractor.h | 27 +++- soh/soh/Enhancements/mods.cpp | 127 +++++++++++------- soh/soh/Enhancements/mods.h | 2 + soh/soh/SohMenuBar.cpp | 8 +- 4 files changed, 106 insertions(+), 58 deletions(-) diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor.h b/soh/soh/Enhancements/game-interactor/GameInteractor.h index 3e70da37a..c68aa61df 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor.h +++ b/soh/soh/Enhancements/game-interactor/GameInteractor.h @@ -163,11 +163,30 @@ public: static GameInteractionEffectQueryResult RemoveEffect(RemovableGameInteractionEffect* effect); // Game Hooks - template struct RegisteredGameHooks { inline static std::vector functions; }; - template void RegisterGameHook(typename H::fn h) { RegisteredGameHooks::functions.push_back(h); } + uint32_t nextHookId = 1; + template struct RegisteredGameHooks { inline static std::unordered_map functions; }; + template struct HooksToUnregister { inline static std::vector hooks; }; + template uint32_t RegisterGameHook(typename H::fn h) { + // Ensure hook id is unique and not 0, which is reserved for invalid hooks + if (this->nextHookId == 0 || this->nextHookId >= UINT32_MAX) this->nextHookId = 1; + while (RegisteredGameHooks::functions.find(this->nextHookId) != RegisteredGameHooks::functions.end()) { + this->nextHookId++; + } + + RegisteredGameHooks::functions[this->nextHookId] = h; + return this->nextHookId++; + } + template void UnregisterGameHook(uint32_t id) { + HooksToUnregister::hooks.push_back(id); + } + template void ExecuteHooks(Args&&... args) { - for (auto& fn : RegisteredGameHooks::functions) { - fn(std::forward(args)...); + for (auto& hookId : HooksToUnregister::hooks) { + RegisteredGameHooks::functions.erase(hookId); + } + HooksToUnregister::hooks.clear(); + for (auto& hook : RegisteredGameHooks::functions) { + hook.second(std::forward(args)...); } } diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 9ae89719f..bd7e032a6 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -519,70 +519,93 @@ void RegisterDaytimeGoldSkultullas() { }); } -void RegisterHyperBosses() { - GameInteractor::Instance->RegisterGameHook([](void* refActor) { - // Run the update function a second time to make bosses move and act twice as fast. +bool IsHyperBossesActive() { + return CVarGetInteger("gHyperBosses", 0) || + (IS_BOSS_RUSH && gSaveContext.bossRushOptions[BR_OPTIONS_HYPERBOSSES] == BR_CHOICE_HYPERBOSSES_YES); +} - Player* player = GET_PLAYER(gPlayState); - Actor* actor = static_cast(refActor); +void UpdateHyperBossesState() { + static uint32_t actorUpdateHookId = 0; + if (actorUpdateHookId != 0) { + GameInteractor::Instance->UnregisterGameHook(actorUpdateHookId); + actorUpdateHookId = 0; + } - uint8_t isBossActor = - actor->id == ACTOR_BOSS_GOMA || // Gohma - actor->id == ACTOR_BOSS_DODONGO || // King Dodongo - actor->id == ACTOR_EN_BDFIRE || // King Dodongo Fire Breath - actor->id == ACTOR_BOSS_VA || // Barinade - actor->id == ACTOR_BOSS_GANONDROF || // Phantom Ganon - actor->id == ACTOR_EN_FHG_FIRE || // Phantom Ganon/Ganondorf Energy Ball/Thunder - actor->id == ACTOR_EN_FHG || // Phantom Ganon's Horse - actor->id == ACTOR_BOSS_FD || actor->id == ACTOR_BOSS_FD2 || // Volvagia (grounded/flying) - actor->id == ACTOR_EN_VB_BALL || // Volvagia Rocks - actor->id == ACTOR_BOSS_MO || // Morpha - actor->id == ACTOR_BOSS_SST || // Bongo Bongo - actor->id == ACTOR_BOSS_TW || // Twinrova - actor->id == ACTOR_BOSS_GANON || // Ganondorf - actor->id == ACTOR_BOSS_GANON2; // Ganon + if (IsHyperBossesActive()) { + actorUpdateHookId = GameInteractor::Instance->RegisterGameHook([](void* refActor) { + // Run the update function a second time to make bosses move and act twice as fast. - uint8_t hyperBossesActive = - CVarGetInteger("gHyperBosses", 0) || - (IS_BOSS_RUSH && - gSaveContext.bossRushOptions[BR_OPTIONS_HYPERBOSSES] == BR_CHOICE_HYPERBOSSES_YES); + Player* player = GET_PLAYER(gPlayState); + Actor* actor = static_cast(refActor); - // Don't apply during cutscenes because it causes weird behaviour and/or crashes on some bosses. - if (hyperBossesActive && isBossActor && !Player_InBlockingCsMode(gPlayState, player)) { - // Barinade needs to be updated in sequence to avoid unintended behaviour. - if (actor->id == ACTOR_BOSS_VA) { - // params -1 is BOSSVA_BODY - if (actor->params == -1) { - Actor* actorList = gPlayState->actorCtx.actorLists[ACTORCAT_BOSS].head; - while (actorList != NULL) { - GameInteractor::RawAction::UpdateActor(actorList); - actorList = actorList->next; + uint8_t isBossActor = + actor->id == ACTOR_BOSS_GOMA || // Gohma + actor->id == ACTOR_BOSS_DODONGO || // King Dodongo + actor->id == ACTOR_EN_BDFIRE || // King Dodongo Fire Breath + actor->id == ACTOR_BOSS_VA || // Barinade + actor->id == ACTOR_BOSS_GANONDROF || // Phantom Ganon + actor->id == ACTOR_EN_FHG_FIRE || // Phantom Ganon/Ganondorf Energy Ball/Thunder + actor->id == ACTOR_EN_FHG || // Phantom Ganon's Horse + actor->id == ACTOR_BOSS_FD || actor->id == ACTOR_BOSS_FD2 || // Volvagia (grounded/flying) + actor->id == ACTOR_EN_VB_BALL || // Volvagia Rocks + actor->id == ACTOR_BOSS_MO || // Morpha + actor->id == ACTOR_BOSS_SST || // Bongo Bongo + actor->id == ACTOR_BOSS_TW || // Twinrova + actor->id == ACTOR_BOSS_GANON || // Ganondorf + actor->id == ACTOR_BOSS_GANON2; // Ganon + + // Don't apply during cutscenes because it causes weird behaviour and/or crashes on some bosses. + if (IsHyperBossesActive() && isBossActor && !Player_InBlockingCsMode(gPlayState, player)) { + // Barinade needs to be updated in sequence to avoid unintended behaviour. + if (actor->id == ACTOR_BOSS_VA) { + // params -1 is BOSSVA_BODY + if (actor->params == -1) { + Actor* actorList = gPlayState->actorCtx.actorLists[ACTORCAT_BOSS].head; + while (actorList != NULL) { + GameInteractor::RawAction::UpdateActor(actorList); + actorList = actorList->next; + } } + } else { + GameInteractor::RawAction::UpdateActor(actor); } - } else { - GameInteractor::RawAction::UpdateActor(actor); } - } + }); + } +} + +void RegisterHyperBosses() { + UpdateHyperBossesState(); + GameInteractor::Instance->RegisterGameHook([](int16_t fileNum) { + UpdateHyperBossesState(); }); } -void RegisterHyperEnemies() { - GameInteractor::Instance->RegisterGameHook([](void* refActor) { - // Run the update function a second time to make enemies and minibosses move and act twice as fast. +void UpdateHyperEnemiesState() { + static uint32_t actorUpdateHookId = 0; + if (actorUpdateHookId != 0) { + GameInteractor::Instance->UnregisterGameHook(actorUpdateHookId); + actorUpdateHookId = 0; + } - Player* player = GET_PLAYER(gPlayState); - Actor* actor = static_cast(refActor); + if (CVarGetInteger("gHyperEnemies", 0)) { + actorUpdateHookId = GameInteractor::Instance->RegisterGameHook([](void* refActor) { + // Run the update function a second time to make enemies and minibosses move and act twice as fast. - // Some enemies are not in the ACTORCAT_ENEMY category, and some are that aren't really enemies. - bool isEnemy = actor->category == ACTORCAT_ENEMY || actor->id == ACTOR_EN_TORCH2; - bool isExcludedEnemy = actor->id == ACTOR_EN_FIRE_ROCK || actor->id == ACTOR_EN_ENCOUNT2; + Player* player = GET_PLAYER(gPlayState); + Actor* actor = static_cast(refActor); - // Don't apply during cutscenes because it causes weird behaviour and/or crashes on some cutscenes. - if (CVarGetInteger("gHyperEnemies", 0) && isEnemy && !isExcludedEnemy && - !Player_InBlockingCsMode(gPlayState, player)) { - GameInteractor::RawAction::UpdateActor(actor); - } - }); + // Some enemies are not in the ACTORCAT_ENEMY category, and some are that aren't really enemies. + bool isEnemy = actor->category == ACTORCAT_ENEMY || actor->id == ACTOR_EN_TORCH2; + bool isExcludedEnemy = actor->id == ACTOR_EN_FIRE_ROCK || actor->id == ACTOR_EN_ENCOUNT2; + + // Don't apply during cutscenes because it causes weird behaviour and/or crashes on some cutscenes. + if (CVarGetInteger("gHyperEnemies", 0) && isEnemy && !isExcludedEnemy && + !Player_InBlockingCsMode(gPlayState, player)) { + GameInteractor::RawAction::UpdateActor(actor); + } + }); + } } void RegisterBonkDamage() { @@ -1371,7 +1394,7 @@ void InitMods() { RegisterPermanentHeartLoss(); RegisterDeleteFileOnDeath(); RegisterHyperBosses(); - RegisterHyperEnemies(); + UpdateHyperEnemiesState(); RegisterBonkDamage(); RegisterMenuPathFix(); RegisterMirrorModeHandler(); diff --git a/soh/soh/Enhancements/mods.h b/soh/soh/Enhancements/mods.h index 57ebedfd9..2755924f2 100644 --- a/soh/soh/Enhancements/mods.h +++ b/soh/soh/Enhancements/mods.h @@ -12,6 +12,8 @@ void UpdateMirrorModeState(int32_t sceneNum); void UpdateHurtContainerModeState(bool newState); void PatchToTMedallions(); void UpdatePermanentHeartLossState(); +void UpdateHyperEnemiesState(); +void UpdateHyperBossesState(); void InitMods(); void UpdatePatchHand(); diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 4450d3aa1..a0ac4bf9f 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -959,9 +959,13 @@ void DrawEnhancementsMenu() { UIWidgets::Tooltip("Bonking into trees will have a chance to drop up to 3 sticks. Must already have obtained sticks."); UIWidgets::PaddedEnhancementCheckbox("No Heart Drops", "gNoHeartDrops", true, false); UIWidgets::Tooltip("Disables heart drops, but not heart placements, like from a Deku Scrub running off\nThis simulates Hero Mode from other games in the series"); - UIWidgets::PaddedEnhancementCheckbox("Hyper Bosses", "gHyperBosses", true, false); + if (UIWidgets::PaddedEnhancementCheckbox("Hyper Bosses", "gHyperBosses", true, false)) { + UpdateHyperBossesState(); + } UIWidgets::Tooltip("All major bosses move and act twice as fast."); - UIWidgets::PaddedEnhancementCheckbox("Hyper Enemies", "gHyperEnemies", true, false); + if (UIWidgets::PaddedEnhancementCheckbox("Hyper Enemies", "gHyperEnemies", true, false)) { + UpdateHyperEnemiesState(); + } UIWidgets::Tooltip("All regular enemies and mini-bosses move and act twice as fast."); UIWidgets::PaddedEnhancementCheckbox("Always Win Goron Pot", "gGoronPot", true, false); UIWidgets::Tooltip("Always get the heart piece/purple rupee from the spinning Goron pot"); From e05f558ef33a9630a8dea003e5b191521fb5a7c2 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Thu, 15 Feb 2024 20:12:19 -0600 Subject: [PATCH 28/44] Fix issue with bombchus always showing as major (#3303) --- soh/soh/OTRGlobals.cpp | 6 +++--- soh/src/overlays/actors/ovl_En_Box/z_en_box.c | 14 +++++++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index a5983c457..9548de28d 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -534,7 +534,7 @@ extern "C" void VanillaItemTable_Init() { static GetItemEntry getItemTable[] = { GET_ITEM(ITEM_BOMBS_5, OBJECT_GI_BOMB_1, GID_BOMB, 0x32, 0x59, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_BOMBS_5), GET_ITEM(ITEM_NUTS_5, OBJECT_GI_NUTS, GID_NUTS, 0x34, 0x0C, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_NUTS_5), - GET_ITEM(ITEM_BOMBCHU, OBJECT_GI_BOMB_2, GID_BOMBCHU, 0x33, 0x80, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_BOMBCHUS_10), + GET_ITEM(ITEM_BOMBCHU, OBJECT_GI_BOMB_2, GID_BOMBCHU, 0x33, 0x80, CHEST_ANIM_SHORT, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_BOMBCHUS_10), GET_ITEM(ITEM_BOW, OBJECT_GI_BOW, GID_BOW, 0x31, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_BOW), GET_ITEM(ITEM_SLINGSHOT, OBJECT_GI_PACHINKO, GID_SLINGSHOT, 0x30, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_SLINGSHOT), GET_ITEM(ITEM_BOOMERANG, OBJECT_GI_BOOMERANG, GID_BOOMERANG, 0x35, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_BOOMERANG), @@ -637,8 +637,8 @@ extern "C" void VanillaItemTable_Init() { GET_ITEM(ITEM_BOMBS_20, OBJECT_GI_BOMB_1, GID_BOMB, 0x32, 0x59, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_BOMBS_20), GET_ITEM(ITEM_BOMBS_30, OBJECT_GI_BOMB_1, GID_BOMB, 0x32, 0x59, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_BOMBS_30), GET_ITEM(ITEM_SEEDS_30, OBJECT_GI_SEED, GID_SEEDS, 0xDC, 0x50, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_SEEDS_30), - GET_ITEM(ITEM_BOMBCHUS_5, OBJECT_GI_BOMB_2, GID_BOMBCHU, 0x33, 0x80, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_BOMBCHUS_5), - GET_ITEM(ITEM_BOMBCHUS_20, OBJECT_GI_BOMB_2, GID_BOMBCHU, 0x33, 0x80, CHEST_ANIM_SHORT, ITEM_CATEGORY_JUNK, MOD_NONE, GI_BOMBCHUS_20), + GET_ITEM(ITEM_BOMBCHUS_5, OBJECT_GI_BOMB_2, GID_BOMBCHU, 0x33, 0x80, CHEST_ANIM_SHORT, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_BOMBCHUS_5), + GET_ITEM(ITEM_BOMBCHUS_20, OBJECT_GI_BOMB_2, GID_BOMBCHU, 0x33, 0x80, CHEST_ANIM_SHORT, ITEM_CATEGORY_MAJOR, MOD_NONE, GI_BOMBCHUS_20), GET_ITEM(ITEM_FISH, OBJECT_GI_FISH, GID_FISH, 0x47, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_JUNK, MOD_NONE, GI_FISH), GET_ITEM(ITEM_BUG, OBJECT_GI_INSECT, GID_BUG, 0x7A, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_JUNK, MOD_NONE, GI_BUGS), GET_ITEM(ITEM_BLUE_FIRE, OBJECT_GI_FIRE, GID_BLUE_FIRE, 0x5D, 0x80, CHEST_ANIM_LONG, ITEM_CATEGORY_JUNK, MOD_NONE, GI_BLUE_FIRE), diff --git a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c index 6bbb48488..dfd8fae27 100644 --- a/soh/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/soh/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -646,9 +646,17 @@ void EnBox_UpdateSizeAndTexture(EnBox* this, PlayState* play) { if (!isVanilla) { getItemCategory = this->getItemEntry.getItemCategory; - // If they don't have bombchu's yet consider the bombchu item major - if (this->getItemEntry.gid == GID_BOMBCHU && INV_CONTENT(ITEM_BOMBCHU) != ITEM_BOMBCHU) { - getItemCategory = ITEM_CATEGORY_MAJOR; + // If they have bombchus, don't consider the bombchu item major + if ( + INV_CONTENT(ITEM_BOMBCHU) == ITEM_BOMBCHU && + ((this->getItemEntry.modIndex == MOD_RANDOMIZER && this->getItemEntry.getItemId == RG_PROGRESSIVE_BOMBCHUS) || + (this->getItemEntry.modIndex == MOD_NONE && ( + this->getItemEntry.getItemId == GI_BOMBCHUS_5 || + this->getItemEntry.getItemId == GI_BOMBCHUS_10 || + this->getItemEntry.getItemId == GI_BOMBCHUS_20 + ))) + ) { + getItemCategory = ITEM_CATEGORY_JUNK; // If it's a bottle and they already have one, consider the item lesser } else if ( (this->getItemEntry.modIndex == MOD_RANDOMIZER && this->getItemEntry.getItemId >= RG_BOTTLE_WITH_RED_POTION && this->getItemEntry.getItemId <= RG_BOTTLE_WITH_BIG_POE) || From 1bc15d5bf3042d4fd64e1952eb68c47a7d5d8061 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 15 Feb 2024 21:13:49 -0500 Subject: [PATCH 29/44] document dependencies per distro (#3933) * start on arch * noconfirm * git * noconfirm * just skip cache * cmake * ninja * gcc * lsb * sdl2 * png * sdl net * boost * imagemagick and add opensuse * non interactive * git * cmake * add a bunch * things * more * try to matrix * soh otr i guess * needs * trying to figure out how matrix include works * make the matrix? * matrix debug * install? * echo? * yuck * cannot locate package false * parens for good measure * lsb * libsdl2 * suse * i forgot opensuse uses gcc-c++ instead of g++ for the package name * png * sdl * more * suse packages.... * fedora cmake * 2? * png * handle old sdl2 net * apt * not sure if this is a problem for both clang and gcc on opensuse or just clang * devel * cmake min version * def don't want this here but it's here for now * does this do anything * mantic because cmake version * libopengl? * fedora ninja * fedora g++ * lsb * fedora sdl * libpng * do a build * clang fix * give early returns values * ImageMagick * Update BUILDING.md * something * plain boost instead of devel? * not packing so we don't need this part * base? * don't have it can't need it * just use boost download on opensuse i guess * move workflow * bring back the file * lus main? * detach --- .github/workflows/test-builds-on-distros.yml | 61 +++++++++++++++++++ docs/BUILDING.md | 40 ++++++++++-- soh/CMakeLists.txt | 10 ++- soh/src/code/z_camera.c | 4 +- .../actors/ovl_player_actor/z_player.c | 4 +- 5 files changed, 112 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/test-builds-on-distros.yml diff --git a/.github/workflows/test-builds-on-distros.yml b/.github/workflows/test-builds-on-distros.yml new file mode 100644 index 000000000..fd8b3c929 --- /dev/null +++ b/.github/workflows/test-builds-on-distros.yml @@ -0,0 +1,61 @@ +name: test-builds-on-distros +on: + workflow_dispatch: # by request +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true +jobs: + build: + strategy: + matrix: + image: ["archlinux:base", "opensuse/tumbleweed:latest", "ubuntu:mantic", "debian:bookworm", "fedora:39"] + cc: ["gcc", "clang"] + include: + - cxx: g++ + cc: gcc + - cxx: clang++ + cc: clang + runs-on: ${{ (vars.LINUX_RUNNER && fromJSON(vars.LINUX_RUNNER)) || 'ubuntu-latest' }} + container: + image: ${{ matrix.image }} + steps: + - name: Install dependencies (pacman) + if: ${{ matrix.image == 'archlinux:base' }} + run: | + echo arch + echo pacman -S ${{ matrix.cc }} git cmake ninja lsb-release sdl2 libpng sdl2_net boost + pacman -Syu --noconfirm + pacman -S --noconfirm ${{ matrix.cc }} git cmake ninja lsb-release sdl2 libpng sdl2_net boost + - name: Install dependencies (dnf) + if: ${{ matrix.image == 'fedora:39' }} + run: | + echo fedora + echo dnf install ${{ matrix.cc }} ${{ (matrix.cxx == 'g++' && 'gcc-c++') || '' }} git cmake ninja-build lsb_release SDL2-devel libpng-devel boost-devel + dnf -y upgrade + dnf -y install ${{ matrix.cc }} ${{ (matrix.cxx == 'g++' && 'gcc-c++') || '' }} git cmake ninja-build lsb_release SDL2-devel libpng-devel boost-devel + - name: Install dependencies (apt) + if: ${{ matrix.image == 'ubuntu:mantic' || matrix.image == 'debian:bookworm' }} + run: | + echo debian based + echo apt-get install ${{ matrix.cc }} ${{ (matrix.cxx == 'g++' && 'g++') || '' }} git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libboost-dev libopengl-dev + apt-get update + apt-get -y full-upgrade + apt-get -y install ${{ matrix.cc }} ${{ (matrix.cxx == 'g++' && 'g++') || '' }} git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libboost-dev libopengl-dev + - name: Install dependencies (zypper) + if: ${{ matrix.image == 'opensuse/tumbleweed:latest' }} + run: | + echo openSUSE + echo zypper in ${{ matrix.cc }} ${{ (matrix.cxx == 'g++' && 'gcc-c++') || '' }} ${{ matrix.cc == 'clang' && 'libstdc++-devel' || '' }} git cmake ninja SDL2-devel libpng16-devel + zypper --non-interactive dup + zypper --non-interactive in ${{ matrix.cc }} ${{ (matrix.cxx == 'g++' && 'gcc-c++') || '' }} ${{ matrix.cc == 'clang' && 'libstdc++-devel' || '' }} git cmake ninja SDL2-devel libpng16-devel + - uses: actions/checkout@v3 + with: + submodules: true + - name: Build SoH + run: | + export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" + cmake --no-warn-unused-cli -H. -Bbuild-cmake -GNinja -DCMAKE_BUILD_TYPE:STRING=Release -DBUILD_REMOTE_CONTROL=1 + cmake --build build-cmake --config Release -j3 + env: + CC: ${{ matrix.cc }} + CXX: ${{ matrix.cxx }} diff --git a/docs/BUILDING.md b/docs/BUILDING.md index 56ff9718f..eabc18ec8 100644 --- a/docs/BUILDING.md +++ b/docs/BUILDING.md @@ -84,17 +84,49 @@ cd "build/x64" ``` ## Linux -Requires `gcc >= 10, x11, curl, python3, sdl2 >= 2.0.22, libpng, glew >= 2.2, ninja, cmake, lld, pulseaudio-libs` +### Install dependencies +#### Debian/Ubuntu +```sh +# using gcc +apt-get install gcc g++ git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libboost-dev libopengl-dev -**Important: For maximum performance make sure you have ninja build tools installed!** +# or using clang +apt-get install clang git cmake ninja-build lsb-release libsdl2-dev libpng-dev libsdl2-net-dev libboost-dev libopengl-dev +``` +#### Arch +```sh +# using gcc +pacman -S gcc git cmake ninja lsb-release sdl2 libpng sdl2_net boost -_Note: If you're using Visual Studio Code, the [cpack plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._ +# or using clang +pacman -S clang git cmake ninja lsb-release sdl2 libpng sdl2_net boost +``` +#### Fedora +```sh +# using gcc +dnf install gcc gcc-c++ git cmake ninja-build lsb_release SDL2-devel libpng-devel boost-devel + +# or using clang +dnf install clang git cmake ninja-build lsb_release SDL2-devel libpng-devel boost-devel +``` +#### openSUSE +```sh +# using gcc +zypper in gcc gcc-c++ git cmake ninja SDL2-devel libpng16-devel boost + +# or using clang +zypper in clang libstdc++-devel git cmake ninja SDL2-devel libpng16-devel boost +``` + +### Build + +_Note: If you're using Visual Studio Code, the [CMake Tools plugin](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cmake-tools) makes it very easy to just press run and debug._ ```bash # Clone the repo git clone https://github.com/HarbourMasters/Shipwright.git cd Shipwright -# Clone the submodule libultraship +# Clone the submodules git submodule update --init # Copy the baserom to the OTRExporter folder cp OTRExporter diff --git a/soh/CMakeLists.txt b/soh/CMakeLists.txt index 228303558..f653c5de5 100644 --- a/soh/CMakeLists.txt +++ b/soh/CMakeLists.txt @@ -356,7 +356,13 @@ set(SDL2-INCLUDE ${SDL2_INCLUDE_DIRS}) if (BUILD_REMOTE_CONTROL) find_package(SDL2_net) - set(SDL2-NET-INCLUDE ${SDL_NET_INCLUDE_DIRS}) + + if(NOT SDL2_net_FOUND) + message(STATUS "SDL2_net not found (it's possible the version installed is too old). Disabling BUILD_REMOTE_CONTROL.") + set(BUILD_REMOTE_CONTROL 0) + else() + set(SDL2-NET-INCLUDE ${SDL_NET_INCLUDE_DIRS}) + endif() endif() target_include_directories(${PROJECT_NAME} PRIVATE assets @@ -623,6 +629,8 @@ 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-incompatible-pointer-types diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index b5a0318f6..90634ea31 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -1679,7 +1679,9 @@ s32 Camera_Normal1(Camera* camera) { if (anim->startSwingTimer <= 0) { // idle camera re-center - if (CVarGetInteger("gA11yDisableIdleCam", 0)) return; + if (CVarGetInteger("gA11yDisableIdleCam", 0)) { + return 1; + } eyeAdjustment.pitch = atEyeNextGeo.pitch; eyeAdjustment.yaw = Camera_LERPCeilS(anim->swingYawTarget, atEyeNextGeo.yaw, 1.0f / camera->yawUpdateRateInv, 0xA); 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 0651f900b..71a6c1c22 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -6613,7 +6613,9 @@ s32 func_8083E5A8(Player* this, PlayState* play) { if(gSaveContext.pendingIceTrapCount) { gSaveContext.pendingIceTrapCount--; GameInteractor_ExecuteOnItemReceiveHooks(ItemTable_RetrieveEntry(MOD_RANDOMIZER, RG_ICE_TRAP)); - if (CVarGetInteger("gAddTraps.enabled", 0)) return; + if (CVarGetInteger("gAddTraps.enabled", 0)) { + return 1; + } this->stateFlags1 &= ~(PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD); this->actor.colChkInfo.damage = 0; func_80837C0C(play, this, 3, 0.0f, 0.0f, 0, 20); From 457a75e9f87268106d648d26b3983fdfcbc59f98 Mon Sep 17 00:00:00 2001 From: inspectredc <78732756+inspectredc@users.noreply.github.com> Date: Fri, 16 Feb 2024 02:15:44 +0000 Subject: [PATCH 30/44] More Sword Toggle Options (#3889) * Sword Unequipping Toggle * better macro * less ugly format * cvar prefix * Update soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c * Update soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c --------- Co-authored-by: Garrett Cox --- soh/soh/Enhancements/enhancementTypes.h | 6 ++++ soh/soh/SohMenuBar.cpp | 12 ++++++++ .../ovl_kaleido_scope/z_kaleido_equipment.c | 29 ++++++++++++++----- 3 files changed, 39 insertions(+), 8 deletions(-) diff --git a/soh/soh/Enhancements/enhancementTypes.h b/soh/soh/Enhancements/enhancementTypes.h index c8461bbf1..56160567a 100644 --- a/soh/soh/Enhancements/enhancementTypes.h +++ b/soh/soh/Enhancements/enhancementTypes.h @@ -78,4 +78,10 @@ typedef enum { DEKU_STICK_UNBREAKABLE_AND_ALWAYS_ON_FIRE, } DekuStickType; +typedef enum { + SWORD_TOGGLE_NONE, + SWORD_TOGGLE_CHILD, + SWORD_TOGGLE_BOTH_AGES, +} SwordToggleMode; + #endif diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index a0ac4bf9f..21241bad8 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -105,6 +105,7 @@ static const char* imguiScaleOptions[4] = { "Small", "Normal", "Large", "X-Large "OHKO" }; static const char* timeTravelOptions[3] = { "Disabled", "Ocarina of Time", "Any Ocarina" }; + static const char* swordToggleModes[3] = { "Disabled", "Child Toggle", "Both Ages (May lead to unintended behaviour)"}; extern "C" SaveContext gSaveContext; @@ -1006,6 +1007,17 @@ void DrawEnhancementsMenu() { UIWidgets::Tooltip("Allows equipping the tunic and boots to c-buttons"); UIWidgets::PaddedEnhancementCheckbox("Equipment Toggle", "gEquipmentCanBeRemoved", true, false); UIWidgets::Tooltip("Allows equipment to be removed by toggling it off on\nthe equipment subscreen."); + if (CVarGetInteger("gEquipmentCanBeRemoved", 0)) { + UIWidgets::PaddedText("Sword Toggle Options", true, false); + UIWidgets::EnhancementCombobox("gEnhancements.SwordToggle", swordToggleModes, SWORD_TOGGLE_NONE); + UIWidgets::Tooltip( + "Introduces Options for unequipping Link's sword\n\n" + "None: Only Biggoron's Sword/Giant's Knife can be toggled. Doing so will equip the Master Sword.\n\n" + "Child Toggle: This will allow for completely unequipping any sword as child link.\n\n" + "Both Ages: Any sword can be unequipped as either age. This may lead to swordless glitches as Adult.\n" + ); + } + UIWidgets::PaddedEnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime", true, false); UIWidgets::Tooltip("Allows the Lon Lon Ranch obstacle course reward to be shared across time periods"); UIWidgets::PaddedEnhancementCheckbox("Enable visible guard vision", "gGuardVision", true, false); diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c index def71a66b..cf4344027 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_equipment.c @@ -2,6 +2,7 @@ #include "textures/icon_item_static/icon_item_static.h" #include "textures/parameter_static/parameter_static.h" #include "soh/Enhancements/cosmetics/cosmeticsTypes.h" +#include "soh/Enhancements/enhancementTypes.h" static u8 sChildUpgrades[] = { UPG_BULLET_BAG, UPG_BOMB_BAG, UPG_STRENGTH, UPG_SCALE }; static u8 sAdultUpgrades[] = { UPG_QUIVER, UPG_BOMB_BAG, UPG_STRENGTH, UPG_SCALE }; @@ -562,20 +563,32 @@ void KaleidoScope_DrawEquipment(PlayState* play) { if (CHECK_AGE_REQ_EQUIP(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP])) { if (CHECK_BTN_ALL(input->press.button, BTN_A)) { + // #Region SoH [Enhancements] // Allow Link to remove his equipment from the equipment subscreen by toggling on/off // Shields will be un-equipped entirely, and tunics/boots will revert to Kokiri Tunic/Kokiri Boots // Only BGS/Giant's Knife is affected, and it will revert to Master Sword. // If we have the feature toggled on if (CVarGetInteger("gEquipmentCanBeRemoved", 0)) { - - // If we're on the "swords" section of the equipment screen AND we're on a currently-equipped BGS/Giant's Knife - if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == 3 - && CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_BIGGORON && CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER)){ // And we have the Master Sword - Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER); // "Unequip" it by equipping Master Sword - gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; - gSaveContext.infTable[29] = 0; - goto RESUME_EQUIPMENT_SWORD; // Skip to here so we don't re-equip it + + if (CVarGetInteger("gEnhancements.SwordToggle", SWORD_TOGGLE_NONE) == SWORD_TOGGLE_BOTH_AGES || + (CVarGetInteger("gEnhancements.SwordToggle", SWORD_TOGGLE_NONE) == SWORD_TOGGLE_CHILD) && LINK_IS_CHILD) { + // If we're on the "swords" section of the equipment screen AND we're on a currently-equipped sword + if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD)) { + Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_NONE); + gSaveContext.equips.buttonItems[0] = ITEM_NONE; + Flags_SetInfTable(INFTABLE_SWORDLESS); + goto RESUME_EQUIPMENT_SWORD; // Skip to here so we don't re-equip it + } + } else { + // If we're on the "swords" section of the equipment screen AND we're on a currently-equipped BGS/Giant's Knife + if (pauseCtx->cursorY[PAUSE_EQUIP] == 0 && pauseCtx->cursorX[PAUSE_EQUIP] == 3 + && CUR_EQUIP_VALUE(EQUIP_TYPE_SWORD) == EQUIP_VALUE_SWORD_BIGGORON && CHECK_OWNED_EQUIP(EQUIP_TYPE_SWORD, EQUIP_INV_SWORD_MASTER)){ // And we have the Master Sword + Inventory_ChangeEquipment(EQUIP_TYPE_SWORD, EQUIP_VALUE_SWORD_MASTER); // "Unequip" it by equipping Master Sword + gSaveContext.equips.buttonItems[0] = ITEM_SWORD_MASTER; + Flags_UnsetInfTable(INFTABLE_SWORDLESS); + goto RESUME_EQUIPMENT_SWORD; // Skip to here so we don't re-equip it + } } // If we're on the "shields" section of the equipment screen AND we're on a currently-equipped shield From 4797c9ad354adef62084509d9ae1ee504c702cf1 Mon Sep 17 00:00:00 2001 From: DeusVexus <10972000+DeusVexus@users.noreply.github.com> Date: Thu, 15 Feb 2024 18:29:09 -0800 Subject: [PATCH 31/44] Adds the Keese and Guay don't target you cheat (#3267) * Adds the Keese and Guay don't target you cheat that makes keese and guay ignore you as if you are wearing the skull mask * changed instances of CVar_GetS32 to CVarGetInteger added the cvar to presets.h --------- Co-authored-by: Garrett Cox --- soh/soh/Enhancements/presets.h | 1 + soh/soh/SohMenuBar.cpp | 2 ++ soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c | 6 ++++-- soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c | 6 ++++-- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index 572439e22..d16e343e1 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -312,6 +312,7 @@ const std::vector cheatCvars = { "gSwitchAge", "gSwitchTimeline", "gNoRedeadFreeze", + "gNoKeeseGuayTarget", "gBombTimerMultiplier", "gNoFishDespawn", "gNoBugsDespawn", diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 21241bad8..96d99fbb1 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1545,6 +1545,8 @@ void DrawCheatsMenu() { UIWidgets::Tooltip("This syncs the ingame time with the real world time"); UIWidgets::PaddedEnhancementCheckbox("No ReDead/Gibdo Freeze", "gNoRedeadFreeze", true, false); UIWidgets::Tooltip("Prevents ReDeads and Gibdos from being able to freeze you with their scream"); + UIWidgets::PaddedEnhancementCheckbox("Keese/Guay don't target you", "gNoKeeseGuayTarget", true, false); + UIWidgets::Tooltip("Keese and Guay no longer target you and simply ignore you as if you were wearing the skull mask"); { static int32_t betaQuestEnabled = CVarGetInteger("gEnableBetaQuest", 0); static int32_t lastBetaQuestEnabled = betaQuestEnabled; diff --git a/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c index cbbba524d..ea0432f27 100644 --- a/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/soh/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -282,7 +282,8 @@ void EnCrow_FlyIdle(EnCrow* this, PlayState* play) { this->timer--; } if ((this->timer == 0) && (this->actor.xzDistToPlayer < 300.0f) && !(player->stateFlags1 & PLAYER_STATE1_ON_HORSE) && - (this->actor.yDistToWater < -40.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL)) { + (this->actor.yDistToWater < -40.0f) && (Player_GetMask(play) != PLAYER_MASK_SKULL) && + !CVarGetInteger("gNoKeeseGuayTarget", 0)) { EnCrow_SetupDiveAttack(this); } } @@ -319,7 +320,8 @@ void EnCrow_DiveAttack(EnCrow* this, PlayState* play) { if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL) || (this->collider.base.atFlags & AT_HIT) || (this->actor.bgCheckFlags & 9) || - (player->stateFlags1 & PLAYER_STATE1_ON_HORSE) || (this->actor.yDistToWater > -40.0f)) { + (player->stateFlags1 & PLAYER_STATE1_ON_HORSE) || (this->actor.yDistToWater > -40.0f) || + CVarGetInteger("gNoKeeseGuayTarget", 0)) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; Audio_PlayActorSound2(&this->actor, NA_SE_EN_KAICHO_ATTACK); diff --git a/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index bf7b79b7f..f37bc73db 100644 --- a/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/soh/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -415,7 +415,8 @@ void EnFirefly_FlyIdle(EnFirefly* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.wallYaw, 2, 0xC00, 0x300); } if ((this->timer == 0) && (this->actor.xzDistToPlayer < 200.0f) && - (Player_GetMask(play) != PLAYER_MASK_SKULL)) { + (Player_GetMask(play) != PLAYER_MASK_SKULL) && + !CVarGetInteger("gNoKeeseGuayTarget", 0)) { EnFirefly_SetupDiveAttack(this); } } @@ -493,7 +494,8 @@ void EnFirefly_DiveAttack(EnFirefly* this, PlayState* play) { } Math_ScaledStepToS(&this->actor.shape.rot.x, this->targetPitch, 0x100); } - if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL)) { + if ((this->timer == 0) || (Player_GetMask(play) == PLAYER_MASK_SKULL) || + CVarGetInteger("gNoKeeseGuayTarget", 0)) { EnFirefly_SetupFlyAway(this); } } From 30a063b75d504aaecec4b44a6f7d81f15fe778ff Mon Sep 17 00:00:00 2001 From: Malkierian Date: Thu, 15 Feb 2024 19:44:40 -0700 Subject: [PATCH 32/44] [Tweak] Move Personal Notes to Save File (#3909) * Moves personal notes to the save file under a new itemTracker save section. * Update soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp --------- Co-authored-by: Archez --- .../randomizer/randomizer_item_tracker.cpp | 42 ++++++++++++------- 1 file changed, 27 insertions(+), 15 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp index f24ab818b..f63b37b62 100644 --- a/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp +++ b/soh/soh/Enhancements/randomizer/randomizer_item_tracker.cpp @@ -30,6 +30,8 @@ void DrawBottle(ItemTrackerItem item); void DrawQuest(ItemTrackerItem item); void DrawSong(ItemTrackerItem item); +int itemTrackerSectionId; + bool shouldUpdateVectors = true; std::vector mainWindowItems = {}; @@ -282,11 +284,6 @@ void ItemTrackerOnFrame() { } } -void SaveNotes(uint32_t fileNum) { - CVarSetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), std::string(std::begin(itemTrackerNotes), std::end(itemTrackerNotes)).c_str()); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); -} - bool IsValidSaveFile() { bool validSave = gSaveContext.fileNum >= 0 && gSaveContext.fileNum <= 2; return validSave; @@ -734,7 +731,7 @@ void DrawNotes(bool resizeable = false) { } if ((ImGui::IsItemDeactivatedAfterEdit() || (notesNeedSave && notesIdleFrames > notesMaxIdleFrames)) && IsValidSaveFile()) { notesNeedSave = false; - SaveNotes(gSaveContext.fileNum); + SaveManager::Instance->SaveSection(gSaveContext.fileNum, itemTrackerSectionId, true); } ImGui::EndGroup(); } @@ -959,6 +956,26 @@ void UpdateVectors() { shouldUpdateVectors = false; } +void ItemTrackerInitFile(bool isDebug) { + itemTrackerNotes.clear(); + itemTrackerNotes.push_back(0); +} + +void ItemTrackerSaveFile(SaveContext* saveContext, int sectionID, bool fullSave) { + SaveManager::Instance->SaveData("personalNotes", std::string(std::begin(itemTrackerNotes), std::end(itemTrackerNotes)).c_str()); +} + +void ItemTrackerLoadFile() { + std::string initialTrackerNotes = ""; + SaveManager::Instance->LoadData("personalNotes", initialTrackerNotes); + itemTrackerNotes.resize(initialTrackerNotes.length() + 1); + if (initialTrackerNotes != "") { + SohUtils::CopyStringToCharArray(itemTrackerNotes.Data, initialTrackerNotes.c_str(), itemTrackerNotes.size()); + } else { + itemTrackerNotes.push_back(0); + } +} + void ItemTrackerWindow::DrawElement() { UpdateVectors(); @@ -1223,14 +1240,9 @@ void ItemTrackerWindow::InitElement() { itemTrackerNotes.push_back(0); } - GameInteractor::Instance->RegisterGameHook([](uint32_t fileNum) { - const char* initialTrackerNotes = CVarGetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), ""); - itemTrackerNotes.resize(strlen(initialTrackerNotes) + 1); - strcpy(itemTrackerNotes.Data, initialTrackerNotes); - }); - GameInteractor::Instance->RegisterGameHook([](uint32_t fileNum) { - CVarSetString(("gItemTrackerNotes" + std::to_string(fileNum)).c_str(), ""); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - }); + SaveManager::Instance->AddInitFunction(ItemTrackerInitFile); + itemTrackerSectionId = SaveManager::Instance->AddSaveFunction("itemTrackerData", 1, ItemTrackerSaveFile, true, -1); + SaveManager::Instance->AddLoadFunction("itemTrackerData", 1, ItemTrackerLoadFile); + GameInteractor::Instance->RegisterGameHook(ItemTrackerOnFrame); } From 7319e4db5799ac36983eacec1ad5e7edcef150c7 Mon Sep 17 00:00:00 2001 From: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> Date: Fri, 16 Feb 2024 03:44:46 +0100 Subject: [PATCH 33/44] More player documentation from decomp (#3819) * FallImpactInfo & AnimSfx stuff * IA function naming & Player_UseItem * ActionChange * Speed modes * Fix build * Misc cleanup * Name Player_Action funcs * PlayerAgeProperties * Most of the Player struct * Update z_player.c --------- Co-authored-by: Garrett Cox --- soh/include/z64player.h | 341 +- .../GameInteractor_RawAction.cpp | 4 +- soh/src/code/code_800430A0.c | 2 +- soh/src/code/z_onepointdemo.c | 8 +- .../overlays/actors/ovl_Boss_Fd/z_boss_fd.c | 8 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 6 +- .../overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 12 +- .../overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 16 +- .../overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 16 +- .../overlays/actors/ovl_Door_Ana/z_door_ana.c | 2 +- .../actors/ovl_En_Bdfire/z_en_bdfire.c | 6 +- soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c | 8 +- soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c | 2 +- soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c | 16 +- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 2 +- .../actors/ovl_En_Siofuki/z_en_siofuki.c | 2 +- soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c | 2 +- .../ovl_En_Syateki_Itm/z_en_syateki_itm.c | 2 +- .../actors/ovl_player_actor/z_player.c | 3017 +++++++++-------- 19 files changed, 1814 insertions(+), 1658 deletions(-) diff --git a/soh/include/z64player.h b/soh/include/z64player.h index e5f4b826d..d03b64da5 100644 --- a/soh/include/z64player.h +++ b/soh/include/z64player.h @@ -345,7 +345,7 @@ typedef enum { #define PLAYER_LIMB_BUF_COUNT LIMB_BUF_COUNT(PLAYER_LIMB_MAX) typedef struct { - /* 0x00 */ f32 unk_00; + /* 0x00 */ f32 ceilingCheckHeight; /* 0x04 */ f32 unk_04; /* 0x08 */ f32 unk_08; /* 0x0C */ f32 unk_0C; @@ -359,7 +359,7 @@ typedef struct { /* 0x2C */ f32 unk_2C; /* 0x30 */ f32 unk_30; /* 0x34 */ f32 unk_34; - /* 0x38 */ f32 unk_38; + /* 0x38 */ f32 wallCheckRadius; /* 0x3C */ f32 unk_3C; /* 0x40 */ f32 unk_40; /* 0x44 */ Vec3s unk_44; @@ -489,180 +489,187 @@ typedef s32 (*UpperActionFunc)(struct Player*, struct PlayState*); typedef void (*PlayerFuncA74)(struct PlayState*, struct Player*); typedef struct Player { - /* 0x0000 */ Actor actor; - /* 0x014C */ s8 currentTunic; // current tunic from `PlayerTunic` - /* 0x014D */ s8 currentSwordItemId; - /* 0x014E */ s8 currentShield; // current shield from `PlayerShield` - /* 0x014F */ s8 currentBoots; // current boots from `PlayerBoots` - /* 0x0150 */ s8 heldItemButton; // Button index for the item currently used - /* 0x0151 */ s8 heldItemAction; // Item action for the item currently used - /* 0x0152 */ u8 heldItemId; // Item id for the item currently used - /* 0x0153 */ s8 prevBoots; // previous boots from `PlayerBoots` - /* 0x0154 */ s8 itemAction; // the difference between this and heldItemAction is unclear - /* 0x0155 */ char unk_155[0x003]; - /* 0x0158 */ u8 modelGroup; - /* 0x0159 */ u8 nextModelGroup; - /* 0x015A */ s8 itemChangeType; - /* 0x015B */ u8 modelAnimType; - /* 0x015C */ u8 leftHandType; - /* 0x015D */ u8 rightHandType; - /* 0x015E */ u8 sheathType; - /* 0x015F */ u8 currentMask; // current mask equipped from `PlayerMask` - /* 0x0160 */ Gfx** rightHandDLists; - /* 0x0164 */ Gfx** leftHandDLists; - /* 0x0168 */ Gfx** sheathDLists; - /* 0x016C */ Gfx** waistDLists; - /* 0x0170 */ u8 giObjectLoading; + /* 0x0000 */ Actor actor; + /* 0x014C */ s8 currentTunic; // current tunic from `PlayerTunic` + /* 0x014D */ s8 currentSwordItemId; + /* 0x014E */ s8 currentShield; // current shield from `PlayerShield` + /* 0x014F */ s8 currentBoots; // current boots from `PlayerBoots` + /* 0x0150 */ s8 heldItemButton; // Button index for the item currently used + /* 0x0151 */ s8 heldItemAction; // Item action for the item currently used + /* 0x0152 */ u8 heldItemId; // Item id for the item currently used + /* 0x0153 */ s8 prevBoots; // previous boots from `PlayerBoots` + /* 0x0154 */ s8 itemAction; // the difference between this and heldItemAction is unclear + /* 0x0155 */ char unk_155[0x003]; + /* 0x0158 */ u8 modelGroup; + /* 0x0159 */ u8 nextModelGroup; + /* 0x015A */ s8 itemChangeType; + /* 0x015B */ u8 modelAnimType; + /* 0x015C */ u8 leftHandType; + /* 0x015D */ u8 rightHandType; + /* 0x015E */ u8 sheathType; + /* 0x015F */ u8 currentMask; // current mask equipped from `PlayerMask` + /* 0x0160 */ Gfx** rightHandDLists; + /* 0x0164 */ Gfx** leftHandDLists; + /* 0x0168 */ Gfx** sheathDLists; + /* 0x016C */ Gfx** waistDLists; + /* 0x0170 */ u8 giObjectLoading; /* 0x0174 */ DmaRequest giObjectDmaRequest; /* 0x0194 */ OSMesgQueue giObjectLoadQueue; - /* 0x01AC */ OSMesg giObjectLoadMsg; - /* 0x01B0 */ void* giObjectSegment; // also used for title card textures - /* 0x01B4 */ SkelAnime skelAnime; - /* 0x01F8 */ Vec3s jointTable[PLAYER_LIMB_BUF_COUNT]; - /* 0x0288 */ Vec3s morphTable[PLAYER_LIMB_BUF_COUNT]; - /* 0x0318 */ Vec3s blendTable[PLAYER_LIMB_BUF_COUNT]; - /* 0x03A8 */ s16 unk_3A8[2]; - /* 0x03AC */ Actor* heldActor; - /* 0x03B0 */ Vec3f leftHandPos; - /* 0x03BC */ Vec3s unk_3BC; - /* 0x03C4 */ Actor* unk_3C4; - /* 0x03C8 */ Vec3f unk_3C8; - /* 0x03D4 */ char unk_3D4[0x058]; - /* 0x042C */ s8 doorType; - /* 0x042D */ s8 doorDirection; - /* 0x042E */ s16 doorTimer; - /* 0x0430 */ Actor* doorActor; - /* 0x0434 */ s16 getItemId; // Upstream TODO: Document why this is s16 while it's s8 upstream - /* 0x0436 */ u16 getItemDirection; - /* 0x0438 */ Actor* interactRangeActor; - /* 0x043C */ s8 mountSide; - /* 0x043D */ char unk_43D[0x003]; - /* 0x0440 */ Actor* rideActor; - /* 0x0444 */ u8 csAction; - /* 0x0445 */ u8 prevCsAction; - /* 0x0446 */ u8 cueId; - /* 0x0447 */ u8 unk_447; - /* 0x0448 */ Actor* csActor; - /* 0x044C */ char unk_44C[0x004]; - /* 0x0450 */ Vec3f unk_450; - /* 0x045C */ Vec3f unk_45C; - /* 0x0468 */ char unk_468[0x002]; - /* 0x046A */ s16 doorBgCamIndex; - /* 0x046C */ s16 subCamId; - /* 0x046E */ char unk_46E[0x02A]; + /* 0x01AC */ OSMesg giObjectLoadMsg; + /* 0x01B0 */ void* giObjectSegment; // also used for title card textures + /* 0x01B4 */ SkelAnime skelAnime; + /* 0x01F8 */ Vec3s jointTable[PLAYER_LIMB_BUF_COUNT]; + /* 0x0288 */ Vec3s morphTable[PLAYER_LIMB_BUF_COUNT]; + /* 0x0318 */ Vec3s blendTable[PLAYER_LIMB_BUF_COUNT]; + /* 0x03A8 */ s16 unk_3A8[2]; + /* 0x03AC */ Actor* heldActor; + /* 0x03B0 */ Vec3f leftHandPos; + /* 0x03BC */ Vec3s unk_3BC; + /* 0x03C4 */ Actor* unk_3C4; + /* 0x03C8 */ Vec3f unk_3C8; + /* 0x03D4 */ char unk_3D4[0x058]; + /* 0x042C */ s8 doorType; + /* 0x042D */ s8 doorDirection; + /* 0x042E */ s16 doorTimer; + /* 0x0430 */ Actor* doorActor; + /* 0x0434 */ s16 getItemId; // Upstream TODO: Document why this is s16 while it's s8 upstream + /* 0x0436 */ u16 getItemDirection; + /* 0x0438 */ Actor* interactRangeActor; + /* 0x043C */ s8 mountSide; + /* 0x043D */ char unk_43D[0x003]; + /* 0x0440 */ Actor* rideActor; + /* 0x0444 */ u8 csAction; + /* 0x0445 */ u8 prevCsAction; + /* 0x0446 */ u8 cueId; + /* 0x0447 */ u8 unk_447; + /* 0x0448 */ Actor* csActor; // Actor involved in a `csAction`. Typically the actor that invoked the cutscene. + /* 0x044C */ char unk_44C[0x004]; + /* 0x0450 */ Vec3f unk_450; + /* 0x045C */ Vec3f unk_45C; + /* 0x0468 */ char unk_468[0x002]; + /* 0x046A */ s16 doorBgCamIndex; + /* 0x046C */ s16 subCamId; + /* 0x046E */ char unk_46E[0x02A]; /* 0x0498 */ ColliderCylinder cylinder; /* 0x04E4 */ ColliderQuad meleeWeaponQuads[2]; /* 0x05E4 */ ColliderQuad shieldQuad; - /* 0x0664 */ Actor* unk_664; - /* 0x0668 */ char unk_668[0x004]; - /* 0x066C */ s32 unk_66C; - /* 0x0670 */ s32 meleeWeaponEffectIndex; + /* 0x0664 */ Actor* unk_664; + /* 0x0668 */ char unk_668[0x004]; + /* 0x066C */ s32 unk_66C; + /* 0x0670 */ s32 meleeWeaponEffectIndex; /* 0x0674 */ PlayerActionFunc actionFunc; /* 0x0678 */ PlayerAgeProperties* ageProperties; - /* 0x067C */ u32 stateFlags1; - /* 0x0680 */ u32 stateFlags2; - /* 0x0684 */ Actor* unk_684; - /* 0x0688 */ Actor* boomerangActor; - /* 0x068C */ Actor* naviActor; - /* 0x0690 */ s16 naviTextId; - /* 0x0692 */ u8 stateFlags3; - /* 0x0693 */ s8 exchangeItemId; - /* 0x0694 */ Actor* targetActor; - /* 0x0698 */ f32 targetActorDistance; - /* 0x069C */ char unk_69C[0x004]; - /* 0x06A0 */ f32 unk_6A0; - /* 0x06A4 */ f32 closestSecretDistSq; - /* 0x06A8 */ Actor* unk_6A8; - /* 0x06AC */ s8 unk_6AC; - /* 0x06AD */ u8 unk_6AD; - /* 0x06AE */ u16 unk_6AE; - /* 0x06B0 */ s16 unk_6B0; - /* 0x06B2 */ char unk_6B4[0x004]; - /* 0x06B6 */ s16 unk_6B6; - /* 0x06B8 */ s16 unk_6B8; - /* 0x06BA */ s16 unk_6BA; - /* 0x06BC */ s16 unk_6BC; - /* 0x06BE */ s16 unk_6BE; - /* 0x06C0 */ s16 unk_6C0; - /* 0x06C2 */ s16 unk_6C2; - /* 0x06C4 */ f32 unk_6C4; - /* 0x06C8 */ SkelAnime upperSkelAnime; - /* 0x070C */ Vec3s upperJointTable[PLAYER_LIMB_BUF_COUNT]; - /* 0x079C */ Vec3s upperMorphTable[PLAYER_LIMB_BUF_COUNT]; + /* 0x067C */ u32 stateFlags1; + /* 0x0680 */ u32 stateFlags2; + /* 0x0684 */ Actor* unk_684; + /* 0x0688 */ Actor* boomerangActor; + /* 0x068C */ Actor* naviActor; + /* 0x0690 */ s16 naviTextId; + /* 0x0692 */ u8 stateFlags3; + /* 0x0693 */ s8 exchangeItemId; + /* 0x0694 */ Actor* targetActor; + /* 0x0698 */ f32 targetActorDistance; + /* 0x069C */ char unk_69C[0x004]; + /* 0x06A0 */ f32 unk_6A0; + /* 0x06A4 */ f32 closestSecretDistSq; + /* 0x06A8 */ Actor* unk_6A8; + /* 0x06AC */ s8 unk_6AC; + /* 0x06AD */ u8 unk_6AD; + /* 0x06AE */ u16 unk_6AE; + /* 0x06B0 */ s16 unk_6B0; + /* 0x06B2 */ char unk_6B4[0x004]; + /* 0x06B6 */ s16 unk_6B6; + /* 0x06B8 */ s16 unk_6B8; + /* 0x06BA */ s16 unk_6BA; + /* 0x06BC */ s16 unk_6BC; + /* 0x06BE */ s16 unk_6BE; + /* 0x06C0 */ s16 unk_6C0; + /* 0x06C2 */ s16 unk_6C2; + /* 0x06C4 */ f32 unk_6C4; + /* 0x06C8 */ SkelAnime upperSkelAnime; + /* 0x070C */ Vec3s upperJointTable[PLAYER_LIMB_BUF_COUNT]; + /* 0x079C */ Vec3s upperMorphTable[PLAYER_LIMB_BUF_COUNT]; /* 0x082C */ UpperActionFunc upperActionFunc; - /* 0x0830 */ f32 upperAnimBlendWeight; - /* 0x0834 */ s16 unk_834; - /* 0x0836 */ s8 unk_836; - /* 0x0837 */ u8 unk_837; - /* 0x0838 */ f32 linearVelocity; - /* 0x083C */ s16 currentYaw; - /* 0x083E */ s16 targetYaw; - /* 0x0840 */ u16 underwaterTimer; - /* 0x0842 */ s8 meleeWeaponAnimation; - /* 0x0843 */ s8 meleeWeaponState; - /* 0x0844 */ s8 unk_844; - /* 0x0845 */ u8 unk_845; - /* 0x0846 */ u8 unk_846; - /* 0x0847 */ s8 unk_847[4]; - /* 0x084B */ s8 unk_84B[4]; - /* 0x084F */ s8 unk_84F; - /* 0x0850 */ s16 unk_850; // multipurpose timer - /* 0x0854 */ f32 unk_854; - /* 0x0858 */ f32 unk_858; - /* 0x085C */ f32 unk_85C; // stick length among other things - /* 0x0860 */ s16 unk_860; // stick flame timer among other things - /* 0x0862 */ s16 unk_862; // get item draw ID + 1 - /* 0x0864 */ f32 unk_864; - /* 0x0868 */ f32 unk_868; - /* 0x086C */ f32 unk_86C; - /* 0x0870 */ f32 unk_870; - /* 0x0874 */ f32 unk_874; - /* 0x0878 */ f32 unk_878; - /* 0x087C */ s16 unk_87C; - /* 0x087E */ s16 unk_87E; - /* 0x0880 */ f32 unk_880; - /* 0x0884 */ f32 yDistToLedge; // y distance to ground above an interact wall. LEDGE_DIST_MAX if no ground is found - /* 0x0888 */ f32 distToInteractWall; // distance to the colliding wall plane - /* 0x088C */ u8 unk_88C; - /* 0x088D */ u8 unk_88D; - /* 0x088E */ u8 unk_88E; - /* 0x088F */ u8 unk_88F; - /* 0x0890 */ u8 unk_890; - /* 0x0891 */ u8 shockTimer; - /* 0x0892 */ u8 unk_892; - /* 0x0893 */ u8 hoverBootsTimer; - /* 0x0894 */ s16 fallStartHeight; // last truncated Y position before falling - /* 0x0896 */ s16 fallDistance; // truncated Y distance the player has fallen so far (positive is down) - /* 0x0898 */ s16 floorPitch; // angle of the floor slope in the direction of current world yaw (positive for ascending slope) - /* 0x089A */ s16 floorPitchAlt; // the calculation for this value is bugged and doesn't represent anything meaningful - /* 0x089C */ s16 unk_89C; - /* 0x089E */ u16 floorSfxOffset; - /* 0x08A0 */ u8 unk_8A0; - /* 0x08A1 */ u8 unk_8A1; - /* 0x08A2 */ s16 unk_8A2; - /* 0x08A4 */ f32 unk_8A4; - /* 0x08A8 */ f32 unk_8A8; - /* 0x08AC */ f32 pushedSpeed; // Pushing player, examples include water currents, floor conveyors, climbing sloped surfaces - /* 0x08B0 */ s16 pushedYaw; // Yaw direction of player being pushed + /* 0x0830 */ f32 upperAnimBlendWeight; + /* 0x0834 */ s16 unk_834; + /* 0x0836 */ s8 unk_836; + /* 0x0837 */ u8 unk_837; + /* 0x0838 */ f32 linearVelocity; + /* 0x083C */ s16 yaw; // General yaw value, used both for world and shape rotation. Current or target value depending on context. + /* 0x083E */ s16 zTargetYaw; // yaw relating to Z targeting/"parallel" mode + /* 0x0840 */ u16 underwaterTimer; + /* 0x0842 */ s8 meleeWeaponAnimation; + /* 0x0843 */ s8 meleeWeaponState; + /* 0x0844 */ s8 unk_844; + /* 0x0845 */ u8 unk_845; + /* 0x0846 */ u8 unk_846; + /* 0x0847 */ s8 unk_847[4]; + /* 0x084B */ s8 unk_84B[4]; + + /* 0x084F */ union { + s8 actionVar1; + } av1; // "Action Variable 1": context dependent variable that has different meanings depending on what action is currently running + + /* 0x0850 */ union { + s16 actionVar2; + } av2; // "Action Variable 2": context dependent variable that has different meanings depending on what action is currently running + + /* 0x0854 */ f32 unk_854; + /* 0x0858 */ f32 unk_858; + /* 0x085C */ f32 unk_85C; // stick length among other things + /* 0x0860 */ s16 unk_860; // stick flame timer among other things + /* 0x0862 */ s16 unk_862; // get item draw ID + 1 + /* 0x0864 */ f32 unk_864; + /* 0x0868 */ f32 unk_868; + /* 0x086C */ f32 unk_86C; + /* 0x0870 */ f32 unk_870; + /* 0x0874 */ f32 unk_874; + /* 0x0878 */ f32 unk_878; + /* 0x087C */ s16 unk_87C; + /* 0x087E */ s16 unk_87E; + /* 0x0880 */ f32 unk_880; + /* 0x0884 */ f32 yDistToLedge; // y distance to ground above an interact wall. LEDGE_DIST_MAX if no ground is found + /* 0x0888 */ f32 distToInteractWall; // xyz distance to the interact wall + /* 0x088C */ u8 ledgeClimbType; + /* 0x088D */ u8 ledgeClimbDelayTimer; + /* 0x088E */ u8 unk_88E; + /* 0x088F */ u8 unk_88F; + /* 0x0890 */ u8 unk_890; + /* 0x0891 */ u8 bodyShockTimer; + /* 0x0892 */ u8 unk_892; + /* 0x0893 */ u8 hoverBootsTimer; + /* 0x0894 */ s16 fallStartHeight; // last truncated Y position before falling + /* 0x0896 */ s16 fallDistance; // truncated Y distance the player has fallen so far (positive is down) + /* 0x0898 */ s16 floorPitch; // angle of the floor slope in the direction of current world yaw (positive for ascending slope) + /* 0x089A */ s16 floorPitchAlt; // the calculation for this value is bugged and doesn't represent anything meaningful + /* 0x089C */ s16 unk_89C; + /* 0x089E */ u16 floorSfxOffset; + /* 0x08A0 */ u8 unk_8A0; + /* 0x08A1 */ u8 unk_8A1; + /* 0x08A2 */ s16 unk_8A2; + /* 0x08A4 */ f32 unk_8A4; + /* 0x08A8 */ f32 unk_8A8; + /* 0x08AC */ f32 pushedSpeed; // Pushing player, examples include water currents, floor conveyors, climbing sloped surfaces + /* 0x08B0 */ s16 pushedYaw; // Yaw direction of player being pushed /* 0x08B4 */ WeaponInfo meleeWeaponInfo[3]; - /* 0x0908 */ Vec3f bodyPartsPos[PLAYER_BODYPART_MAX]; - /* 0x09E0 */ MtxF mf_9E0; - /* 0x0A20 */ MtxF shieldMf; - /* 0x0A60 */ u8 isBurning; - /* 0x0A61 */ u8 flameTimers[PLAYER_BODYPART_MAX]; // one flame per body part - /* 0x0A73 */ u8 unk_A73; + /* 0x0908 */ Vec3f bodyPartsPos[PLAYER_BODYPART_MAX]; + /* 0x09E0 */ MtxF mf_9E0; + /* 0x0A20 */ MtxF shieldMf; + /* 0x0A60 */ u8 bodyIsBurning; + /* 0x0A61 */ u8 bodyFlameTimers[PLAYER_BODYPART_MAX]; // one flame per body part + /* 0x0A73 */ u8 unk_A73; /* 0x0A74 */ PlayerFuncA74 func_A74; - /* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero (positive = visible, counts towards zero each frame) - /* 0x0A79 */ u8 unk_A79; - /* 0x0A7A */ u8 unk_A7A; - /* 0x0A7B */ u8 unk_A7B; - /* 0x0A7C */ f32 unk_A7C; - /* 0x0A80 */ s16 unk_A80; - /* 0x0A82 */ u16 unk_A82; - /* 0x0A84 */ s16 unk_A84; - /* 0x0A86 */ s8 unk_A86; - /* 0x0A87 */ u8 unk_A87; - /* 0x0A88 */ Vec3f unk_A88; // previous body part 0 position + /* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero (positive = visible, counts towards zero each frame) + /* 0x0A79 */ u8 floorTypeTimer; // counts up every frame the current floor type is the same as the last frame + /* 0x0A7A */ u8 floorProperty; + /* 0x0A7B */ u8 prevFloorType; + /* 0x0A7C */ f32 prevControlStickMagnitude; + /* 0x0A80 */ s16 prevControlStickAngle; + /* 0x0A82 */ u16 prevFloorSfxOffset; + /* 0x0A84 */ s16 unk_A84; + /* 0x0A86 */ s8 unk_A86; + /* 0x0A87 */ u8 unk_A87; + /* 0x0A88 */ Vec3f unk_A88; // previous body part 0 position // #region SOH [General] // Upstream TODO: Rename these to be more obviously SoH specific /* */ PendingFlag pendingFlag; @@ -670,7 +677,7 @@ typedef struct Player { // #endregion // #region SOH [Enhancements] // Upstream TODO: Rename this to make it more obvious it is apart of an enhancement - /* */ u8 boomerangQuickRecall; // Has the player pressed the boomerang button while it's in the air still? + /* */ u8 boomerangQuickRecall; // Has the player pressed the boomerang button while it's in the air still? // #endregion u8 ivanFloating; u8 ivanDamageMultiplier; diff --git a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp index 854b7dc11..6d66d1c8b 100644 --- a/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp +++ b/soh/soh/Enhancements/game-interactor/GameInteractor_RawAction.cpp @@ -111,9 +111,9 @@ void GameInteractor::RawAction::FreezePlayer() { void GameInteractor::RawAction::BurnPlayer() { Player* player = GET_PLAYER(gPlayState); for (int i = 0; i < 18; i++) { - player->flameTimers[i] = Rand_S16Offset(0, 200); + player->bodyFlameTimers[i] = Rand_S16Offset(0, 200); } - player->isBurning = true; + player->bodyIsBurning = true; func_80837C0C(gPlayState, player, 0, 0, 0, 0, 0); } diff --git a/soh/src/code/code_800430A0.c b/soh/src/code/code_800430A0.c index abaf88405..379f4a3e6 100644 --- a/soh/src/code/code_800430A0.c +++ b/soh/src/code/code_800430A0.c @@ -48,7 +48,7 @@ void func_800432A0(CollisionContext* colCtx, s32 bgId, Actor* actor) { s16 rot = colCtx->dyna.bgActors[bgId].curTransform.rot.y - colCtx->dyna.bgActors[bgId].prevTransform.rot.y; if (actor->id == ACTOR_PLAYER) { - ((Player*)actor)->currentYaw += rot; + ((Player*)actor)->yaw += rot; } actor->shape.rot.y += rot; diff --git a/soh/src/code/z_onepointdemo.c b/soh/src/code/z_onepointdemo.c index 411f4fb63..2ece7c2f1 100644 --- a/soh/src/code/z_onepointdemo.c +++ b/soh/src/code/z_onepointdemo.c @@ -634,7 +634,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor Play_CameraSetAtEye(play, camIdx, &spC0, &spB4); csCam->roll = 0; csCam->fov = 75.0f; - player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = spD0.yaw + 0x7FFF; + player->actor.shape.rot.y = player->actor.world.rot.y = player->yaw = spD0.yaw + 0x7FFF; func_8002DF54(play, NULL, 8); break; case 3240: @@ -674,7 +674,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor Quake_SetCountdown(i, D_80120698 - 20); break; case 3390: - player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = -0x3FD9; + player->actor.shape.rot.y = player->actor.world.rot.y = player->yaw = -0x3FD9; csInfo->keyFrames = D_80121DB4; csInfo->keyFrameCnt = 9; @@ -697,7 +697,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor D_80121F1C[0].eyeTargetInit = play->view.eye; D_80121F1C[0].fovTargetInit = play->view.fovy; Actor_GetFocus(&spA0, actor); - player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = spA0.rot.y; + player->actor.shape.rot.y = player->actor.world.rot.y = player->yaw = spA0.rot.y; csInfo->keyFrames = D_80121F1C; csInfo->keyFrameCnt = 4; @@ -817,7 +817,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 camIdx, s16 csId, Actor* actor csInfo->keyFrameCnt = 2; } - player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = 0x3FFC; + player->actor.shape.rot.y = player->actor.world.rot.y = player->yaw = 0x3FFC; func_800C0808(play, camIdx, player, CAM_SET_CS_C); func_8002DF54(play, NULL, 8); break; diff --git a/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index e74f3c0e4..0d33533ae 100644 --- a/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/soh/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -1480,11 +1480,11 @@ void BossFd_UpdateEffects(BossFd* this, PlayState* play) { if ((this->timers[3] == 0) && (sqrtf(SQ(diff.x) + SQ(diff.y) + SQ(diff.z)) < 20.0f)) { this->timers[3] = 50; func_8002F6D4(play, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30); - if (player->isBurning == false) { - for (i2 = 0; i2 < ARRAY_COUNT(player->flameTimers); i2++) { - player->flameTimers[i2] = Rand_S16Offset(0, 200); + if (player->bodyIsBurning == false) { + for (i2 = 0; i2 < ARRAY_COUNT(player->bodyFlameTimers); i2++) { + player->bodyFlameTimers[i2] = Rand_S16Offset(0, 200); } - player->isBurning = true; + player->bodyIsBurning = true; } } if (effect->timer2 == 0) { diff --git a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 5ec12f093..ba4a4fbc6 100644 --- a/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/soh/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -1918,11 +1918,11 @@ void func_80902348(BossGanon2* this, PlayState* play) { temp_f12 = -200.0f - player->actor.world.pos.z; if (sqrtf(SQ(temp_f2) + SQ(temp_f12)) > 784.0f) { - for (j = 0; j < ARRAY_COUNT(player->flameTimers); j++) { - player->flameTimers[j] = Rand_S16Offset(0, 200); + for (j = 0; j < ARRAY_COUNT(player->bodyFlameTimers); j++) { + player->bodyFlameTimers[j] = Rand_S16Offset(0, 200); } - player->isBurning = true; + player->bodyIsBurning = true; func_8002F6D4(play, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10); sBossGanon2Zelda->unk_3C8 = 8; } diff --git a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 78534e851..74684df71 100644 --- a/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/soh/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -775,7 +775,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { } } if (this->work[MO_TENT_ACTION_STATE] == MO_TENT_GRAB) { - player->unk_850 = 0xA; + player->av2.actionVar2 = 0xA; player->actor.speedXZ = player->actor.velocity.y = 0; Math_ApproachF(&player->actor.world.pos.x, this->grabPosRot.pos.x, 0.5f, 20.0f); Math_ApproachF(&player->actor.world.pos.y, this->grabPosRot.pos.y, 0.5f, 20.0f); @@ -833,7 +833,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { Math_ApproachS(&this->tentRot[indS1].z, tempf2, 1.0f / this->tentMaxAngle, this->tentSpeed); } } - player->unk_850 = 0xA; + player->av2.actionVar2 = 0xA; player->actor.world.pos.x = this->grabPosRot.pos.x; player->actor.world.pos.y = this->grabPosRot.pos.y; player->actor.world.pos.z = this->grabPosRot.pos.z; @@ -852,7 +852,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { this->work[MO_TENT_ACTION_STATE] = MO_TENT_RETREAT; this->work[MO_TENT_INVINC_TIMER] = 50; if (&this->actor == player->actor.parent) { - player->unk_850 = 0x65; + player->av2.actionVar2 = 0x65; player->actor.parent = NULL; player->csAction = 0; if (this->timers[0] == 0) { @@ -882,7 +882,7 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { case MO_TENT_CUT: func_80078914(&this->tentTipPos, NA_SE_EV_WATER_WALL - SFX_FLAG); if (&this->actor == player->actor.parent) { - player->unk_850 = 0x65; + player->av2.actionVar2 = 0x65; player->actor.parent = NULL; player->csAction = 0; } @@ -1804,7 +1804,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { sMorphaTent2->tent2KillTimer = 1; } if (player->actor.parent != NULL) { - player->unk_850 = 0x65; + player->av2.actionVar2 = 0x65; player->actor.parent = NULL; player->csAction = 0; } @@ -1823,7 +1823,7 @@ void BossMo_CoreCollisionCheck(BossMo* this, PlayState* play) { sMorphaTent1->timers[0] = 40; sMorphaTent1->actor.flags &= ~ACTOR_FLAG_TARGETABLE; if (player->actor.parent == &sMorphaTent1->actor) { - player->unk_850 = 0x65; + player->av2.actionVar2 = 0x65; player->actor.parent = NULL; player->csAction = 0; } diff --git a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index e811c0a35..b9f5c6f2c 100644 --- a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -384,8 +384,8 @@ void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) { player->actor.world.pos.z = sRoomCenter.z; player->linearVelocity = player->actor.velocity.y = 0.0f; player->actor.shape.rot.y = -0x8000; - player->targetYaw = -0x8000; - player->currentYaw = -0x8000; + player->zTargetYaw = -0x8000; + player->yaw = -0x8000; player->fallStartHeight = 0; player->stateFlags1 |= PLAYER_STATE1_INPUT_DISABLED; @@ -443,8 +443,8 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) { player->actor.world.pos.z = sRoomCenter.z; player->linearVelocity = 0; player->actor.shape.rot.y = -0x8000; - player->targetYaw = -0x8000; - player->currentYaw = -0x8000; + player->zTargetYaw = -0x8000; + player->yaw = -0x8000; } Math_Vec3f_Copy(&sCameraAt, &player->actor.world.pos); @@ -1757,7 +1757,7 @@ void BossSst_HandClap(BossSst* this, PlayState* play) { } if (player->actor.parent == &this->actor) { - player->unk_850 = 0; + player->av2.actionVar2 = 0; player->actor.world.pos = this->actor.world.pos; } } @@ -1852,7 +1852,7 @@ void BossSst_HandGrab(BossSst* this, PlayState* play) { this->actor.world.pos.x += this->actor.speedXZ * Math_SinS(this->actor.world.rot.y); this->actor.world.pos.z += this->actor.speedXZ * Math_CosS(this->actor.world.rot.y); if (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) { - player->unk_850 = 0; + player->av2.actionVar2 = 0; player->actor.world.pos = this->actor.world.pos; player->actor.shape.rot.y = this->actor.shape.rot.y; } @@ -1946,7 +1946,7 @@ void BossSst_HandSwing(BossSst* this, PlayState* play) { } if (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) { - player->unk_850 = 0; + player->av2.actionVar2 = 0; Math_Vec3f_Copy(&player->actor.world.pos, &this->actor.world.pos); player->actor.shape.rot.x = this->actor.shape.rot.x; player->actor.shape.rot.z = (this->vParity * -0x4000) + this->actor.shape.rot.z; @@ -2429,7 +2429,7 @@ void BossSst_HandReleasePlayer(BossSst* this, PlayState* play, s32 dropPlayer) { if (player->actor.parent == &this->actor) { player->actor.parent = NULL; - player->unk_850 = 100; + player->av2.actionVar2 = 100; this->colliderJntSph.base.ocFlags1 |= OC1_ON; OTHER_HAND(this)->colliderJntSph.base.ocFlags1 |= OC1_ON; if (dropPlayer) { diff --git a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 4f0eadd4b..9d0a68c38 100644 --- a/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/soh/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -777,12 +777,12 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, PlayState* play) { if (sFreezeState == 0) { sFreezeState = 1; } - } else if (!player->isBurning) { - for (i = 0; i < ARRAY_COUNT(player->flameTimers); i++) { - player->flameTimers[i] = Rand_S16Offset(0, 200); + } else if (!player->bodyIsBurning) { + for (i = 0; i < ARRAY_COUNT(player->bodyFlameTimers); i++) { + player->bodyFlameTimers[i] = Rand_S16Offset(0, 200); } - player->isBurning = true; + player->bodyIsBurning = true; Player_PlaySfx(&player->actor, player->ageProperties->unk_92 + NA_SE_VO_LI_DEMO_DAMAGE); } } @@ -3154,7 +3154,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, PlayState* play2) { } } - if (player->isBurning && sShieldIceCharge != 0) { + if (player->bodyIsBurning && sShieldIceCharge != 0) { sShieldIceCharge = 4; } } @@ -4039,15 +4039,15 @@ void BossTw_BlastFire(BossTw* this, PlayState* play) { yDiff = sKoumePtr->groundBlastPos2.y - player->actor.world.pos.y; zDiff = sKoumePtr->groundBlastPos2.z - player->actor.world.pos.z; - if (!player->isBurning && (player->actor.bgCheckFlags & 1) && (fabsf(yDiff) < 10.0f) && + if (!player->bodyIsBurning && (player->actor.bgCheckFlags & 1) && (fabsf(yDiff) < 10.0f) && (sqrtf(SQ(xDiff) + SQ(zDiff)) < (sKoumePtr->workf[UNK_F13] * 4550.0f))) { s16 j; for (j = 0; j < 18; j++) { - player->flameTimers[j] = Rand_S16Offset(0, 200); + player->bodyFlameTimers[j] = Rand_S16Offset(0, 200); } - player->isBurning = 1; + player->bodyIsBurning = 1; if (this->work[BURN_TMR] == 0) { Player_PlaySfx(&player->actor, player->ageProperties->unk_92 + NA_SE_VO_LI_DEMO_DAMAGE); diff --git a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index bbd9b2826..22c850111 100644 --- a/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/soh/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -135,7 +135,7 @@ void DoorAna_WaitOpen(DoorAna* this, PlayState* play) { player = GET_PLAYER(play); if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) { if ((this->actor.targetMode != 0) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (player->stateFlags1 & PLAYER_STATE1_FLOOR_DISABLED) && - (player->unk_84F == 0)) { + (player->av1.actionVar1 == 0)) { destinationIdx = ((this->actor.params >> 0xC) & 7) - 1; Play_SetupRespawnPoint(play, RESPAWN_MODE_RETURN, 0x4FF); gSaveContext.respawn[RESPAWN_MODE_RETURN].pos.y = this->actor.world.pos.y; diff --git a/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c b/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c index a3d6c923d..ab0b82d65 100644 --- a/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/soh/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -174,13 +174,13 @@ void func_809BC598(EnBdfire* this, PlayState* play) { Actor_Kill(&this->actor); return; } - } else if (!player->isBurning) { + } else if (!player->bodyIsBurning) { distToBurn = (this->actor.scale.x * 130.0f) / 4.2000003f; if (this->actor.xyzDistToPlayerSq < SQ(distToBurn)) { for (i = 0; i < 18; i++) { - player->flameTimers[i] = Rand_S16Offset(0, 200); + player->bodyFlameTimers[i] = Rand_S16Offset(0, 200); } - player->isBurning = true; + player->bodyIsBurning = true; func_8002F6D4(play, &this->actor, 20.0f, this->actor.world.rot.y, 0.0f, 8); osSyncPrintf("POWER\n"); } diff --git a/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c index 893f326d8..da6f43388 100644 --- a/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/soh/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -248,7 +248,7 @@ void EnDha_Wait(EnDha* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; - player->unk_850 = 200; + player->av2.actionVar2 = 200; } if (this->actor.home.rot.z != 0) { @@ -288,7 +288,7 @@ void EnDha_Wait(EnDha* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; - player->unk_850 = 200; + player->av2.actionVar2 = 200; } this->actor.home.rot.z = 1; @@ -309,7 +309,7 @@ void EnDha_TakeDamage(EnDha* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; - player->unk_850 = 200; + player->av2.actionVar2 = 200; } Math_SmoothStepToS(&this->limbAngleX[1], 0, 1, 2000, 0); @@ -347,7 +347,7 @@ void EnDha_Die(EnDha* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; - player->unk_850 = 200; + player->av2.actionVar2 = 200; } Math_SmoothStepToS(&this->limbAngleX[1], 0, 1, 0x7D0, 0); diff --git a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 3cb02e441..36c9c2818 100644 --- a/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/soh/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -616,7 +616,7 @@ void EnFr_Idle(EnFr* this, PlayState* play) { player->actor.world.pos.x = this->actor.world.pos.x; // x = 990.0f player->actor.world.pos.y = this->actor.world.pos.y; // y = 205.0f player->actor.world.pos.z = this->actor.world.pos.z; // z = -1220.0f - player->currentYaw = player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y; + player->yaw = player->actor.world.rot.y = player->actor.shape.rot.y = this->actor.world.rot.y; this->reward = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; this->actionFunc = EnFr_Activate; diff --git a/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 6190e2db9..43f6a6665 100644 --- a/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/soh/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -615,7 +615,7 @@ void EnMb_Stunned(EnMb* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && player->actor.parent == &this->actor) { player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; - player->unk_850 = 200; + player->av2.actionVar2 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); this->attack = ENMB_ATTACK_NONE; } @@ -740,7 +740,7 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && player->actor.parent == &this->actor) { player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; - player->unk_850 = 200; + player->av2.actionVar2 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } @@ -967,7 +967,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) { hasHitPlayer = true; player->actor.world.pos.z = this->actor.world.pos.z + Math_SinS(this->actor.shape.rot.y) * 10.0f + Math_CosS(this->actor.shape.rot.y) * 89.0f; - player->unk_850 = 0; + player->av2.actionVar2 = 0; player->actor.speedXZ = 0.0f; player->actor.velocity.y = 0.0f; } @@ -978,7 +978,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) { if (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) { player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; - player->unk_850 = 200; + player->av2.actionVar2 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } } @@ -1036,7 +1036,7 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) { hasHitPlayer = true; player->actor.world.pos.z = this->actor.world.pos.z + Math_SinS(this->actor.shape.rot.y) * 10.0f + Math_CosS(this->actor.shape.rot.y) * 89.0f; - player->unk_850 = 0; + player->av2.actionVar2 = 0; player->actor.speedXZ = 0.0f; player->actor.velocity.y = 0.0f; } @@ -1047,7 +1047,7 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) { if (player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) { player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; - player->unk_850 = 200; + player->av2.actionVar2 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } this->attack = ENMB_ATTACK_NONE; @@ -1342,7 +1342,7 @@ void EnMb_SpearDead(EnMb* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && player->actor.parent == &this->actor) { player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; - player->unk_850 = 200; + player->av2.actionVar2 = 200; func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); this->attack = ENMB_ATTACK_NONE; } @@ -1425,7 +1425,7 @@ void EnMb_CheckColliding(EnMb* this, PlayState* play) { if ((player->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && player->actor.parent == &this->actor) { player->stateFlags2 &= ~PLAYER_STATE2_GRABBED_BY_ENEMY; player->actor.parent = NULL; - player->unk_850 = 200; + player->av2.actionVar2 = 200; func_8002F71C(play, &this->actor, 6.0f, this->actor.world.rot.y, 6.0f); } this->damageEffect = this->actor.colChkInfo.damageEffect; diff --git a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c index 49e88f903..105db6719 100644 --- a/soh/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/soh/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -190,7 +190,7 @@ void func_80AFB950(EnSi* this, PlayState* play) { player->actor.freezeTimer = 0; func_8083C148(GET_PLAYER(play), play); func_80078884(NA_SE_SY_CAMERA_ZOOM_UP); - player->currentYaw = player->actor.shape.rot.y; + player->yaw = player->actor.shape.rot.y; } } } diff --git a/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c b/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c index 81138e23c..e577a3d45 100644 --- a/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c +++ b/soh/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c @@ -170,7 +170,7 @@ void func_80AFBE8C(EnSiofuki* this, PlayState* play) { } else { if (this->applySpeed) { player->linearVelocity = this->appliedSpeed + player->linearVelocity; - player->currentYaw = this->appliedYaw; + player->yaw = this->appliedYaw; } this->targetAppliedSpeed = 0.0f; diff --git a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c index f2ff5f684..67c695872 100644 --- a/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/soh/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -1367,7 +1367,7 @@ void EnSkj_SariasSongShortStumpUpdate(Actor* thisx, PlayState* play) { void EnSkj_TurnPlayer(EnSkj* this, Player* player) { Math_SmoothStepToS(&player->actor.shape.rot.y, this->actor.world.rot.y, 5, 2000, 0); player->actor.world.rot.y = player->actor.shape.rot.y; - player->currentYaw = player->actor.shape.rot.y; + player->yaw = player->actor.shape.rot.y; } void EnSkj_SetupWaitForOcarina(EnSkj* this, PlayState* play) { diff --git a/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index 05b76cb0e..f0d9d3897 100644 --- a/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/soh/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -107,7 +107,7 @@ void EnSyatekiItm_Idle(EnSyatekiItm* this, PlayState* play) { player->actor.world.pos.x = -12.0f; player->actor.world.pos.y = 20.0f; player->actor.world.pos.z = 182.0f; - player->currentYaw = player->actor.world.rot.y = player->actor.shape.rot.y = 0x7F03; + player->yaw = player->actor.world.rot.y = player->actor.shape.rot.y = 0x7F03; player->actor.world.rot.x = player->actor.shape.rot.x = player->actor.world.rot.z = player->actor.shape.rot.z = 0; s32 ammunition = 15; 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 71a6c1c22..d1c224088 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -65,9 +65,9 @@ typedef struct { typedef struct { /* 0x00 */ s8 damage; - /* 0x01 */ u8 unk_01; - /* 0x02 */ u8 unk_02; - /* 0x03 */ u8 unk_03; + /* 0x01 */ u8 rumbleStrength; + /* 0x02 */ u8 rumbleDuration; + /* 0x03 */ u8 rumbleDecreaseRate; /* 0x04 */ u16 sfxId; } FallImpactInfo; // size = 0x06 @@ -76,9 +76,28 @@ typedef struct { /* 0x0C */ s16 yaw; } SpecialRespawnInfo; // size = 0x10 +typedef enum { + /* 1 */ ANIMSFX_TYPE_1 = 1, + /* 2 */ ANIMSFX_TYPE_2, + /* 3 */ ANIMSFX_TYPE_3, + /* 4 */ ANIMSFX_TYPE_4, + /* 5 */ ANIMSFX_TYPE_5, + /* 6 */ ANIMSFX_TYPE_6, + /* 7 */ ANIMSFX_TYPE_7, + /* 8 */ ANIMSFX_TYPE_8, + /* 9 */ ANIMSFX_TYPE_9 +} AnimSfxType; + +#define ANIMSFX_SHIFT_TYPE(type) ((type) << 11) + +#define ANIMSFX_DATA(type, frame) ((ANIMSFX_SHIFT_TYPE(type) | ((frame)&0x7FF))) + +#define ANIMSFX_GET_TYPE(data) ((data)&0x7800) +#define ANIMSFX_GET_FRAME(data) ((data)&0x7FF) + typedef struct { /* 0x00 */ u16 sfxId; - /* 0x02 */ s16 field; + /* 0x02 */ s16 data; } AnimSfxEntry; // size = 0x04 typedef struct { @@ -120,24 +139,26 @@ typedef struct { }; } struct_80854B18; // size = 0x08 -void func_80833770(PlayState* play, Player* this); -void func_80833790(PlayState* play, Player* this); -void func_8083379C(PlayState* play, Player* this); -void func_8083377C(PlayState* play, Player* this); -void func_808337D4(PlayState* play, Player* this); -void func_80833910(PlayState* play, Player* this); -void func_80833984(PlayState* play, Player* this); void Player_InitItemAction(PlayState* play, Player* this, s8 itemAction); -s32 func_8083485C(Player* this, PlayState* play); -s32 func_808349DC(Player* this, PlayState* play); + +void Player_InitDefaultIA(PlayState* play, Player* this); +void Player_InitHammerIA(PlayState* play, Player* this); +void Player_InitBowOrSlingshotIA(PlayState* play, Player* this); +void Player_InitDekuStickIA(PlayState* play, Player* this); +void Player_InitExplosiveIA(PlayState* play, Player* this); +void Player_InitHookshotIA(PlayState* play, Player* this); +void Player_InitBoomerangIA(PlayState* play, Player* this); + s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play); +s32 func_8083485C(Player* this, PlayState* play); +s32 Player_UpperAction_Sword(Player* this, PlayState* play); s32 func_80834B5C(Player* this, PlayState* play); s32 func_80834C74(Player* this, PlayState* play); s32 func_8083501C(Player* this, PlayState* play); s32 func_808351D4(Player* this, PlayState* play); // Arrow nocked s32 func_808353D8(Player* this, PlayState* play); // Aiming in first person s32 func_80835588(Player* this, PlayState* play); -s32 func_808356E8(Player* this, PlayState* play); +s32 Player_UpperAction_CarryActor(Player* this, PlayState* play); s32 func_80835800(Player* this, PlayState* play); s32 func_80835884(Player* this, PlayState* play); // Start aiming boomerang s32 func_808358F0(Player* this, PlayState* play); // Aim boomerang @@ -145,65 +166,14 @@ s32 func_808359FC(Player* this, PlayState* play); // Throw boomerang s32 spawn_boomerang_ivan(EnPartner* this, PlayState* play); // Throw boomerang Ivan s32 func_80835B60(Player* this, PlayState* play); // Boomerang active s32 func_80835C08(Player* this, PlayState* play); + void Player_UseItem(PlayState* play, Player* this, s32 item); void func_80839F90(Player* this, PlayState* play); -s32 func_80838A14(Player* this, PlayState* play); -s32 func_80839800(Player* this, PlayState* play); -s32 func_8083B040(Player* this, PlayState* play); -s32 func_8083B998(Player* this, PlayState* play); -s32 func_8083B644(Player* this, PlayState* play); -s32 func_8083BDBC(Player* this, PlayState* play); -s32 func_8083C1DC(Player* this, PlayState* play); -s32 func_8083C2B0(Player* this, PlayState* play); -s32 func_8083C544(Player* this, PlayState* play); s32 func_8083C61C(PlayState* play, Player* this); void func_8083CA20(PlayState* play, Player* this); void func_8083CA54(PlayState* play, Player* this); void func_8083CA9C(PlayState* play, Player* this); -s32 func_8083E0FC(Player* this, PlayState* play); void Player_SetPendingFlag(Player* this, PlayState* play); -s32 func_8083E5A8(Player* this, PlayState* play); -s32 func_8083EB44(Player* this, PlayState* play); -s32 func_8083F7BC(Player* this, PlayState* play); -void func_80840450(Player* this, PlayState* play); -void func_808407CC(Player* this, PlayState* play); -void func_80840BC8(Player* this, PlayState* play); -void func_80840DE4(Player* this, PlayState* play); -void func_808414F8(Player* this, PlayState* play); -void func_8084170C(Player* this, PlayState* play); -void func_808417FC(Player* this, PlayState* play); -void func_8084193C(Player* this, PlayState* play); -void func_80841BA8(Player* this, PlayState* play); -void func_80842180(Player* this, PlayState* play); -void func_8084227C(Player* this, PlayState* play); -void func_8084279C(Player* this, PlayState* play); -void func_808423EC(Player* this, PlayState* play); -void func_8084251C(Player* this, PlayState* play); -void func_80843188(Player* this, PlayState* play); -void func_808435C4(Player* this, PlayState* play); -void func_8084370C(Player* this, PlayState* play); -void func_8084377C(Player* this, PlayState* play); -void func_80843954(Player* this, PlayState* play); -void func_80843A38(Player* this, PlayState* play); -void func_80843CEC(Player* this, PlayState* play); -void func_8084411C(Player* this, PlayState* play); -void func_80844708(Player* this, PlayState* play); -void func_80844A44(Player* this, PlayState* play); -void func_80844AF4(Player* this, PlayState* play); -void func_80844E68(Player* this, PlayState* play); -void func_80845000(Player* this, PlayState* play); -void func_80845308(Player* this, PlayState* play); -void func_80845668(Player* this, PlayState* play); -void func_808458D0(Player* this, PlayState* play); -void func_80845CA4(Player* this, PlayState* play); -void func_80845EF8(Player* this, PlayState* play); -void func_80846050(Player* this, PlayState* play); -void func_80846120(Player* this, PlayState* play); -void func_80846260(Player* this, PlayState* play); -void func_80846358(Player* this, PlayState* play); -void func_80846408(Player* this, PlayState* play); -void func_808464B0(Player* this, PlayState* play); -void func_80846578(Player* this, PlayState* play); void func_80846648(PlayState* play, Player* this); void func_80846660(PlayState* play, Player* this); void func_808467D4(PlayState* play, Player* this); @@ -212,59 +182,10 @@ void func_808468E8(PlayState* play, Player* this); void func_80846978(PlayState* play, Player* this); void func_808469BC(PlayState* play, Player* this); void func_80846A68(PlayState* play, Player* this); -void func_8084B1D8(Player* this, PlayState* play); -void func_8084B530(Player* this, PlayState* play); -void func_8084B78C(Player* this, PlayState* play); -void func_8084B898(Player* this, PlayState* play); -void func_8084B9E4(Player* this, PlayState* play); -void func_8084BBE4(Player* this, PlayState* play); -void func_8084BDFC(Player* this, PlayState* play); -void func_8084BF1C(Player* this, PlayState* play); void Player_UpdateCommon(Player* this, PlayState* play, Input* input); -void func_8084C5F8(Player* this, PlayState* play); -void func_8084C760(Player* this, PlayState* play); -void func_8084C81C(Player* this, PlayState* play); -void func_8084CC98(Player* this, PlayState* play); -void func_8084D3E4(Player* this, PlayState* play); -void func_8084D610(Player* this, PlayState* play); -void func_8084D7C4(Player* this, PlayState* play); -void func_8084D84C(Player* this, PlayState* play); -void func_8084DAB4(Player* this, PlayState* play); -void func_8084DC48(Player* this, PlayState* play); -void func_8084E1EC(Player* this, PlayState* play); -void func_8084E30C(Player* this, PlayState* play); -void func_8084E368(Player* this, PlayState* play); -void func_8084E3C4(Player* this, PlayState* play); -void func_8084E604(Player* this, PlayState* play); -void func_8084E6D4(Player* this, PlayState* play); -void func_8084E9AC(Player* this, PlayState* play); -void func_8084EAC0(Player* this, PlayState* play); -void func_8084ECA4(Player* this, PlayState* play); -void func_8084EED8(Player* this, PlayState* play); -void func_8084EFC0(Player* this, PlayState* play); -void func_8084F104(Player* this, PlayState* play); -void func_8084F390(Player* this, PlayState* play); -void func_8084F608(Player* this, PlayState* play); -void func_8084F698(Player* this, PlayState* play); -void func_8084F710(Player* this, PlayState* play); -void func_8084F88C(Player* this, PlayState* play); -void func_8084F9A0(Player* this, PlayState* play); -void func_8084F9C0(Player* this, PlayState* play); -void func_8084FA54(Player* this, PlayState* play); -void func_8084FB10(Player* this, PlayState* play); -void func_8084FBF4(Player* this, PlayState* play); s32 func_8084FCAC(Player* this, PlayState* play); void func_8084FF7C(Player* this); void Player_UpdateBunnyEars(Player* this); -s32 func_80850224(Player* this, PlayState* play); -void func_808502D0(Player* this, PlayState* play); -void func_808505DC(Player* this, PlayState* play); -void func_8085063C(Player* this, PlayState* play); -void func_8085076C(Player* this, PlayState* play); -void func_808507F4(Player* this, PlayState* play); -void func_80850AEC(Player* this, PlayState* play); -void func_80850C68(Player* this, PlayState* play); -void func_80850E84(Player* this, PlayState* play); void func_80851008(PlayState* play, Player* this, void* anim); void func_80851030(PlayState* play, Player* this, void* anim); void func_80851050(PlayState* play, Player* this, void* anim); @@ -339,8 +260,7 @@ void func_808528C8(PlayState* play, Player* this, CsCmdActorAction* arg2); void func_80852944(PlayState* play, Player* this, CsCmdActorAction* arg2); void func_808529D0(PlayState* play, Player* this, CsCmdActorAction* arg2); void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852E14(Player* this, PlayState* play); -s32 Player_IsDroppingFish(PlayState* play); +int Player_IsDroppingFish(PlayState* play); s32 Player_StartFishing(PlayState* play); s32 func_80852F38(PlayState* play, Player* this); s32 Player_TryCsAction(PlayState* play, Actor* actor, s32 csAction); @@ -349,6 +269,95 @@ s32 Player_InflictDamage(PlayState* play, s32 damage); s32 Player_InflictDamageModified(PlayState* play, s32 damage, u8 modified); void Player_StartTalking(PlayState* play, Actor* actor); +void Player_Action_80840450(Player* this, PlayState* play); +void Player_Action_808407CC(Player* this, PlayState* play); +void Player_Action_80840BC8(Player* this, PlayState* play); +void Player_Action_80840DE4(Player* this, PlayState* play); +void Player_Action_808414F8(Player* this, PlayState* play); +void Player_Action_8084170C(Player* this, PlayState* play); +void Player_Action_808417FC(Player* this, PlayState* play); +void Player_Action_8084193C(Player* this, PlayState* play); +void Player_Action_80841BA8(Player* this, PlayState* play); +void Player_Action_80842180(Player* this, PlayState* play); +void Player_Action_8084227C(Player* this, PlayState* play); +void Player_Action_8084279C(Player* this, PlayState* play); +void Player_Action_808423EC(Player* this, PlayState* play); +void Player_Action_8084251C(Player* this, PlayState* play); +void Player_Action_80843188(Player* this, PlayState* play); +void Player_Action_808435C4(Player* this, PlayState* play); +void Player_Action_8084370C(Player* this, PlayState* play); +void Player_Action_8084377C(Player* this, PlayState* play); +void Player_Action_80843954(Player* this, PlayState* play); +void Player_Action_80843A38(Player* this, PlayState* play); +void Player_Action_80843CEC(Player* this, PlayState* play); +void Player_Action_8084411C(Player* this, PlayState* play); +void Player_Action_80844708(Player* this, PlayState* play); +void Player_Action_80844A44(Player* this, PlayState* play); +void Player_Action_80844AF4(Player* this, PlayState* play); +void Player_Action_80844E68(Player* this, PlayState* play); +void Player_Action_80845000(Player* this, PlayState* play); +void Player_Action_80845308(Player* this, PlayState* play); +void Player_Action_80845668(Player* this, PlayState* play); +void Player_Action_808458D0(Player* this, PlayState* play); +void Player_Action_80845CA4(Player* this, PlayState* play); +void Player_Action_80845EF8(Player* this, PlayState* play); +void Player_Action_80846050(Player* this, PlayState* play); +void Player_Action_80846120(Player* this, PlayState* play); +void Player_Action_80846260(Player* this, PlayState* play); +void Player_Action_80846358(Player* this, PlayState* play); +void Player_Action_80846408(Player* this, PlayState* play); +void Player_Action_808464B0(Player* this, PlayState* play); +void Player_Action_80846578(Player* this, PlayState* play); +void Player_Action_8084B1D8(Player* this, PlayState* play); +void Player_Action_8084B530(Player* this, PlayState* play); +void Player_Action_8084B78C(Player* this, PlayState* play); +void Player_Action_8084B898(Player* this, PlayState* play); +void Player_Action_8084B9E4(Player* this, PlayState* play); +void Player_Action_8084BBE4(Player* this, PlayState* play); +void Player_Action_8084BDFC(Player* this, PlayState* play); +void Player_Action_8084BF1C(Player* this, PlayState* play); +void Player_Action_8084C5F8(Player* this, PlayState* play); +void Player_Action_8084C760(Player* this, PlayState* play); +void Player_Action_8084C81C(Player* this, PlayState* play); +void Player_Action_8084CC98(Player* this, PlayState* play); +void Player_Action_8084D3E4(Player* this, PlayState* play); +void Player_Action_8084D610(Player* this, PlayState* play); +void Player_Action_8084D7C4(Player* this, PlayState* play); +void Player_Action_8084D84C(Player* this, PlayState* play); +void Player_Action_8084DAB4(Player* this, PlayState* play); +void Player_Action_8084DC48(Player* this, PlayState* play); +void Player_Action_8084E1EC(Player* this, PlayState* play); +void Player_Action_8084E30C(Player* this, PlayState* play); +void Player_Action_8084E368(Player* this, PlayState* play); +void Player_Action_8084E3C4(Player* this, PlayState* play); +void Player_Action_8084E604(Player* this, PlayState* play); +void Player_Action_8084E6D4(Player* this, PlayState* play); +void Player_Action_8084E9AC(Player* this, PlayState* play); +void Player_Action_8084EAC0(Player* this, PlayState* play); +void Player_Action_8084ECA4(Player* this, PlayState* play); +void Player_Action_8084EED8(Player* this, PlayState* play); +void Player_Action_8084EFC0(Player* this, PlayState* play); +void Player_Action_8084F104(Player* this, PlayState* play); +void Player_Action_8084F390(Player* this, PlayState* play); +void Player_Action_8084F608(Player* this, PlayState* play); +void Player_Action_8084F698(Player* this, PlayState* play); +void Player_Action_8084F710(Player* this, PlayState* play); +void Player_Action_8084F88C(Player* this, PlayState* play); +void Player_Action_8084F9A0(Player* this, PlayState* play); +void Player_Action_8084F9C0(Player* this, PlayState* play); +void Player_Action_8084FA54(Player* this, PlayState* play); +void Player_Action_8084FB10(Player* this, PlayState* play); +void Player_Action_8084FBF4(Player* this, PlayState* play); +void Player_Action_808502D0(Player* this, PlayState* play); +void Player_Action_808505DC(Player* this, PlayState* play); +void Player_Action_8085063C(Player* this, PlayState* play); +void Player_Action_8085076C(Player* this, PlayState* play); +void Player_Action_808507F4(Player* this, PlayState* play); +void Player_Action_80850AEC(Player* this, PlayState* play); +void Player_Action_80850C68(Player* this, PlayState* play); +void Player_Action_80850E84(Player* this, PlayState* play); +void Player_Action_CsAction(Player* this, PlayState* play); + // .bss part 1 static s32 D_80858AA0; static s32 D_80858AA4; @@ -384,108 +393,108 @@ static u8 sUpperBodyLimbCopyMap[PLAYER_LIMB_MAX] = { static PlayerAgeProperties sAgeProperties[] = { { - 56.0f, - 90.0f, - 1.0f, - 111.0f, - 70.0f, - 79.4f, - 59.0f, - 41.0f, - 19.0f, - 36.0f, - 44.8f, - 56.0f, - 68.0f, - 70.0f, - 18.0f, - 15.0f, - 70.0f, - { 9, 4671, 359 }, + 56.0f, // ceilingCheckHeight + 90.0f, // unk_04 + 1.0f, // unk_08 + 111.0f, // unk_0C + 70.0f, // unk_10 + 79.4f, // unk_14 + 59.0f, // unk_18 + 41.0f, // unk_1C + 19.0f, // unk_20 + 36.0f, // unk_24 + 44.8f, // unk_28 + 56.0f, // unk_2C + 68.0f, // unk_30 + 70.0f, // unk_34 + 18.0f, // wallCheckRadius + 15.0f, // unk_3C + 70.0f, // unk_40 + { 9, 4671, 359 }, // unk_44 { { 8, 4694, 380 }, { 9, 6122, 359 }, { 8, 4694, 380 }, { 9, 6122, 359 }, - }, + }, // unk_4A { { 9, 6122, 359 }, { 9, 7693, 380 }, { 9, 6122, 359 }, { 9, 7693, 380 }, - }, + }, // unk_62 { { 8, 4694, 380 }, { 9, 6122, 359 }, - }, + }, // unk_7A { { -1592, 4694, 380 }, { -1591, 6122, 359 }, - }, - 0, - 0x80, - &gPlayerAnim_link_demo_Tbox_open, - &gPlayerAnim_link_demo_back_to_past, - &gPlayerAnim_link_demo_return_to_past, - &gPlayerAnim_link_normal_climb_startA, - &gPlayerAnim_link_normal_climb_startB, + }, // unk_86 + 0, // unk_92 + 0x80, // unk_94 + &gPlayerAnim_link_demo_Tbox_open, // unk_98 + &gPlayerAnim_link_demo_back_to_past, // unk_9C + &gPlayerAnim_link_demo_return_to_past, // unk_A0 + &gPlayerAnim_link_normal_climb_startA, // unk_A4 + &gPlayerAnim_link_normal_climb_startB, // unk_A8 { &gPlayerAnim_link_normal_climb_upL, &gPlayerAnim_link_normal_climb_upR, &gPlayerAnim_link_normal_Fclimb_upL, - &gPlayerAnim_link_normal_Fclimb_upR }, - { &gPlayerAnim_link_normal_Fclimb_sideL, &gPlayerAnim_link_normal_Fclimb_sideR }, - { &gPlayerAnim_link_normal_climb_endAL, &gPlayerAnim_link_normal_climb_endAR }, - { &gPlayerAnim_link_normal_climb_endBR, &gPlayerAnim_link_normal_climb_endBL }, + &gPlayerAnim_link_normal_Fclimb_upR }, // unk_AC + { &gPlayerAnim_link_normal_Fclimb_sideL, &gPlayerAnim_link_normal_Fclimb_sideR }, // unk_BC + { &gPlayerAnim_link_normal_climb_endAL, &gPlayerAnim_link_normal_climb_endAR }, // unk_C4 + { &gPlayerAnim_link_normal_climb_endBR, &gPlayerAnim_link_normal_climb_endBL }, // unk_CC }, { - 40.0f, - 60.0f, - 11.0f / 17.0f, - 71.0f, - 50.0f, - 47.0f, - 39.0f, - 27.0f, - 19.0f, - 22.0f, - 29.6f, - 32.0f, - 48.0f, - 70.0f * (11.0f / 17.0f), - 14.0f, - 12.0f, - 55.0f, - { -24, 3565, 876 }, + 40.0f, // ceilingCheckHeight + 60.0f, // unk_04 + 11.0f / 17.0f, // unk_08 + 71.0f, // unk_0C + 50.0f, // unk_10 + 47.0f, // unk_14 + 39.0f, // unk_18 + 27.0f, // unk_1C + 19.0f, // unk_20 + 22.0f, // unk_24 + 29.6f, // unk_28 + 32.0f, // unk_2C + 48.0f, // unk_30 + 70.0f * (11.0f / 17.0f), // unk_34 + 14.0f, // wallCheckRadius + 12.0f, // unk_3C + 55.0f, // unk_40 + { -24, 3565, 876 }, // unk_44 { { -24, 3474, 862 }, { -24, 4977, 937 }, { 8, 4694, 380 }, { 9, 6122, 359 }, - }, + }, // unk_4A { { -24, 4977, 937 }, { -24, 6495, 937 }, { 9, 6122, 359 }, { 9, 7693, 380 }, - }, + }, // unk_62 { { 8, 4694, 380 }, { 9, 6122, 359 }, - }, + }, // unk_7A { { -1592, 4694, 380 }, { -1591, 6122, 359 }, - }, - 0x20, - 0, - &gPlayerAnim_clink_demo_Tbox_open, - &gPlayerAnim_clink_demo_goto_future, - &gPlayerAnim_clink_demo_return_to_future, - &gPlayerAnim_clink_normal_climb_startA, - &gPlayerAnim_clink_normal_climb_startB, + }, // unk_86 + 0x20, // unk_92 + 0, // unk_94 + &gPlayerAnim_clink_demo_Tbox_open, // unk_98 + &gPlayerAnim_clink_demo_goto_future, // unk_9C + &gPlayerAnim_clink_demo_return_to_future, // unk_A0 + &gPlayerAnim_clink_normal_climb_startA, // unk_A4 + &gPlayerAnim_clink_normal_climb_startB, // unk_A8 { &gPlayerAnim_clink_normal_climb_upL, &gPlayerAnim_clink_normal_climb_upR, &gPlayerAnim_link_normal_Fclimb_upL, - &gPlayerAnim_link_normal_Fclimb_upR }, - { &gPlayerAnim_link_normal_Fclimb_sideL, &gPlayerAnim_link_normal_Fclimb_sideR }, - { &gPlayerAnim_clink_normal_climb_endAL, &gPlayerAnim_clink_normal_climb_endAR }, - { &gPlayerAnim_clink_normal_climb_endBR, &gPlayerAnim_clink_normal_climb_endBL }, + &gPlayerAnim_link_normal_Fclimb_upR }, // unk_AC + { &gPlayerAnim_link_normal_Fclimb_sideL, &gPlayerAnim_link_normal_Fclimb_sideR }, // unk_BC + { &gPlayerAnim_clink_normal_climb_endAL, &gPlayerAnim_clink_normal_climb_endAR }, // unk_C4 + { &gPlayerAnim_clink_normal_climb_endBR, &gPlayerAnim_clink_normal_climb_endBL }, // unk_CC }, }; @@ -499,7 +508,7 @@ static f32 D_808535E8 = 1.0f; static f32 D_808535EC = 1.0f; static u32 sTouchedWallFlags = 0; static u32 sConveyorSpeed = 0; -static s16 sIsFloorConveyor = 0; +static s16 sIsFloorConveyor = false; static s16 sConveyorYaw = 0; static f32 sYDistToFloor = 0.0f; static s32 sPrevFloorProperty = 0; @@ -955,50 +964,53 @@ static LinkAnimationHeader* D_80853D7C[][2] = { }; static AnimSfxEntry D_80853DEC[] = { - { NA_SE_VO_LI_SNEEZE, -0x2008 }, + { NA_SE_VO_LI_SNEEZE, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 8) }, }; static AnimSfxEntry D_80853DF0[] = { - { NA_SE_VO_LI_SWEAT, -0x2012 }, + { NA_SE_VO_LI_SWEAT, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 18) }, }; static AnimSfxEntry D_80853DF4[] = { - { NA_SE_VO_LI_BREATH_REST, -0x200D }, + { NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 13) }, }; static AnimSfxEntry D_80853DF8[] = { - { NA_SE_VO_LI_BREATH_REST, -0x200A }, + { NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 10) }, }; static AnimSfxEntry D_80853DFC[] = { - { NA_SE_PL_CALM_HIT, 0x82C }, { NA_SE_PL_CALM_HIT, 0x830 }, { NA_SE_PL_CALM_HIT, 0x834 }, - { NA_SE_PL_CALM_HIT, 0x838 }, { NA_SE_PL_CALM_HIT, -0x83C }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 44) }, { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 48) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 52) }, { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 56) }, + { NA_SE_PL_CALM_HIT, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 60) }, }; static AnimSfxEntry D_80853E10[] = { - { 0, 0x4019 }, { 0, 0x401E }, { 0, 0x402C }, { 0, 0x4030 }, { 0, 0x4034 }, { 0, -0x4038 }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 25) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 30) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 44) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 48) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 52) }, { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_8, 56) }, }; static AnimSfxEntry D_80853E28[] = { - { NA_SE_IT_SHIELD_POSTURE, 0x810 }, - { NA_SE_IT_SHIELD_POSTURE, 0x814 }, - { NA_SE_IT_SHIELD_POSTURE, -0x846 }, + { NA_SE_IT_SHIELD_POSTURE, ANIMSFX_DATA(ANIMSFX_TYPE_1, 16) }, + { NA_SE_IT_SHIELD_POSTURE, ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, + { NA_SE_IT_SHIELD_POSTURE, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 70) }, }; static AnimSfxEntry D_80853E34[] = { - { NA_SE_IT_HAMMER_SWING, 0x80A }, - { NA_SE_VO_LI_AUTO_JUMP, 0x200A }, - { NA_SE_IT_SWORD_SWING, 0x816 }, - { NA_SE_VO_LI_SWORD_N, -0x2016 }, + { NA_SE_IT_HAMMER_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_1, 10) }, + { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_4, 10) }, + { NA_SE_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_1, 22) }, + { NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 22) }, }; static AnimSfxEntry D_80853E44[] = { - { NA_SE_IT_SWORD_SWING, 0x827 }, - { NA_SE_VO_LI_SWORD_N, -0x2027 }, + { NA_SE_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_1, 39) }, + { NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 39) }, }; static AnimSfxEntry D_80853E4C[] = { - { NA_SE_VO_LI_RELAX, -0x2014 }, + { NA_SE_VO_LI_RELAX, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, }; static AnimSfxEntry* D_80853E50[] = { @@ -1081,143 +1093,143 @@ u8 gWalkSpeedToggle1; u8 gWalkSpeedToggle2; static s32 (*sItemActionUpdateFuncs[])(Player* this, PlayState* play) = { - func_8083485C, // PLAYER_IA_NONE - func_8083485C, // PLAYER_IA_SWORD_CS - func_8083485C, // PLAYER_IA_FISHING_POLE - func_808349DC, // PLAYER_IA_SWORD_MASTER - func_808349DC, // PLAYER_IA_SWORD_KOKIRI - func_808349DC, // PLAYER_IA_SWORD_BIGGORON - func_8083485C, // PLAYER_IA_DEKU_STICK - func_8083485C, // PLAYER_IA_HAMMER - func_8083501C, // PLAYER_IA_BOW - func_8083501C, // PLAYER_IA_BOW_FIRE - func_8083501C, // PLAYER_IA_BOW_ICE - func_8083501C, // PLAYER_IA_BOW_LIGHT - func_8083501C, // PLAYER_IA_BOW_0C - func_8083501C, // PLAYER_IA_BOW_0D - func_8083501C, // PLAYER_IA_BOW_0E - func_8083501C, // PLAYER_IA_SLINGSHOT - func_8083501C, // PLAYER_IA_HOOKSHOT - func_8083501C, // PLAYER_IA_LONGSHOT - func_808356E8, // PLAYER_IA_BOMB - func_808356E8, // PLAYER_IA_BOMBCHU - func_80835800, // PLAYER_IA_BOOMERANG - func_8083485C, // PLAYER_IA_MAGIC_SPELL_15 - func_8083485C, // PLAYER_IA_MAGIC_SPELL_16 - func_8083485C, // PLAYER_IA_MAGIC_SPELL_17 - func_8083485C, // PLAYER_IA_FARORES_WIND - func_8083485C, // PLAYER_IA_NAYRUS_LOVE - func_8083485C, // PLAYER_IA_DINS_FIRE - func_8083485C, // PLAYER_IA_DEKU_NUT - func_8083485C, // PLAYER_IA_OCARINA_FAIRY - func_8083485C, // PLAYER_IA_OCARINA_OF_TIME - func_8083485C, // PLAYER_IA_BOTTLE - func_8083485C, // PLAYER_IA_BOTTLE_FISH - func_8083485C, // PLAYER_IA_BOTTLE_FIRE - func_8083485C, // PLAYER_IA_BOTTLE_BUG - func_8083485C, // PLAYER_IA_BOTTLE_POE - func_8083485C, // PLAYER_IA_BOTTLE_BIG_POE - func_8083485C, // PLAYER_IA_BOTTLE_RUTOS_LETTER - func_8083485C, // PLAYER_IA_BOTTLE_POTION_RED - func_8083485C, // PLAYER_IA_BOTTLE_POTION_BLUE - func_8083485C, // PLAYER_IA_BOTTLE_POTION_GREEN - func_8083485C, // PLAYER_IA_BOTTLE_MILK_FULL - func_8083485C, // PLAYER_IA_BOTTLE_MILK_HALF - func_8083485C, // PLAYER_IA_BOTTLE_FAIRY - func_8083485C, // PLAYER_IA_ZELDAS_LETTER - func_8083485C, // PLAYER_IA_WEIRD_EGG - func_8083485C, // PLAYER_IA_CHICKEN - func_8083485C, // PLAYER_IA_MAGIC_BEAN - func_8083485C, // PLAYER_IA_POCKET_EGG - func_8083485C, // PLAYER_IA_POCKET_CUCCO - func_8083485C, // PLAYER_IA_COJIRO - func_8083485C, // PLAYER_IA_ODD_MUSHROOM - func_8083485C, // PLAYER_IA_ODD_POTION - func_8083485C, // PLAYER_IA_POACHERS_SAW - func_8083485C, // PLAYER_IA_BROKEN_GORONS_SWORD - func_8083485C, // PLAYER_IA_PRESCRIPTION - func_8083485C, // PLAYER_IA_FROG - func_8083485C, // PLAYER_IA_EYEDROPS - func_8083485C, // PLAYER_IA_CLAIM_CHECK - func_8083485C, // PLAYER_IA_MASK_KEATON - func_8083485C, // PLAYER_IA_MASK_SKULL - func_8083485C, // PLAYER_IA_MASK_SPOOKY - func_8083485C, // PLAYER_IA_MASK_BUNNY_HOOD - func_8083485C, // PLAYER_IA_MASK_GORON - func_8083485C, // PLAYER_IA_MASK_ZORA - func_8083485C, // PLAYER_IA_MASK_GERUDO - func_8083485C, // PLAYER_IA_MASK_TRUTH - func_8083485C, // PLAYER_IA_LENS_OF_TRUTH + func_8083485C, // PLAYER_IA_NONE + func_8083485C, // PLAYER_IA_SWORD_CS + func_8083485C, // PLAYER_IA_FISHING_POLE + Player_UpperAction_Sword, // PLAYER_IA_SWORD_MASTER + Player_UpperAction_Sword, // PLAYER_IA_SWORD_KOKIRI + Player_UpperAction_Sword, // PLAYER_IA_SWORD_BIGGORON + func_8083485C, // PLAYER_IA_DEKU_STICK + func_8083485C, // PLAYER_IA_HAMMER + func_8083501C, // PLAYER_IA_BOW + func_8083501C, // PLAYER_IA_BOW_FIRE + func_8083501C, // PLAYER_IA_BOW_ICE + func_8083501C, // PLAYER_IA_BOW_LIGHT + func_8083501C, // PLAYER_IA_BOW_0C + func_8083501C, // PLAYER_IA_BOW_0D + func_8083501C, // PLAYER_IA_BOW_0E + func_8083501C, // PLAYER_IA_SLINGSHOT + func_8083501C, // PLAYER_IA_HOOKSHOT + func_8083501C, // PLAYER_IA_LONGSHOT + Player_UpperAction_CarryActor, // PLAYER_IA_BOMB + Player_UpperAction_CarryActor, // PLAYER_IA_BOMBCHU + func_80835800, // PLAYER_IA_BOOMERANG + func_8083485C, // PLAYER_IA_MAGIC_SPELL_15 + func_8083485C, // PLAYER_IA_MAGIC_SPELL_16 + func_8083485C, // PLAYER_IA_MAGIC_SPELL_17 + func_8083485C, // PLAYER_IA_FARORES_WIND + func_8083485C, // PLAYER_IA_NAYRUS_LOVE + func_8083485C, // PLAYER_IA_DINS_FIRE + func_8083485C, // PLAYER_IA_DEKU_NUT + func_8083485C, // PLAYER_IA_OCARINA_FAIRY + func_8083485C, // PLAYER_IA_OCARINA_OF_TIME + func_8083485C, // PLAYER_IA_BOTTLE + func_8083485C, // PLAYER_IA_BOTTLE_FISH + func_8083485C, // PLAYER_IA_BOTTLE_FIRE + func_8083485C, // PLAYER_IA_BOTTLE_BUG + func_8083485C, // PLAYER_IA_BOTTLE_POE + func_8083485C, // PLAYER_IA_BOTTLE_BIG_POE + func_8083485C, // PLAYER_IA_BOTTLE_RUTOS_LETTER + func_8083485C, // PLAYER_IA_BOTTLE_POTION_RED + func_8083485C, // PLAYER_IA_BOTTLE_POTION_BLUE + func_8083485C, // PLAYER_IA_BOTTLE_POTION_GREEN + func_8083485C, // PLAYER_IA_BOTTLE_MILK_FULL + func_8083485C, // PLAYER_IA_BOTTLE_MILK_HALF + func_8083485C, // PLAYER_IA_BOTTLE_FAIRY + func_8083485C, // PLAYER_IA_ZELDAS_LETTER + func_8083485C, // PLAYER_IA_WEIRD_EGG + func_8083485C, // PLAYER_IA_CHICKEN + func_8083485C, // PLAYER_IA_MAGIC_BEAN + func_8083485C, // PLAYER_IA_POCKET_EGG + func_8083485C, // PLAYER_IA_POCKET_CUCCO + func_8083485C, // PLAYER_IA_COJIRO + func_8083485C, // PLAYER_IA_ODD_MUSHROOM + func_8083485C, // PLAYER_IA_ODD_POTION + func_8083485C, // PLAYER_IA_POACHERS_SAW + func_8083485C, // PLAYER_IA_BROKEN_GORONS_SWORD + func_8083485C, // PLAYER_IA_PRESCRIPTION + func_8083485C, // PLAYER_IA_FROG + func_8083485C, // PLAYER_IA_EYEDROPS + func_8083485C, // PLAYER_IA_CLAIM_CHECK + func_8083485C, // PLAYER_IA_MASK_KEATON + func_8083485C, // PLAYER_IA_MASK_SKULL + func_8083485C, // PLAYER_IA_MASK_SPOOKY + func_8083485C, // PLAYER_IA_MASK_BUNNY_HOOD + func_8083485C, // PLAYER_IA_MASK_GORON + func_8083485C, // PLAYER_IA_MASK_ZORA + func_8083485C, // PLAYER_IA_MASK_GERUDO + func_8083485C, // PLAYER_IA_MASK_TRUTH + func_8083485C, // PLAYER_IA_LENS_OF_TRUTH }; static void (*sItemActionInitFuncs[])(PlayState* play, Player* this) = { - func_80833770, // PLAYER_IA_NONE - func_80833770, // PLAYER_IA_SWORD_CS - func_80833770, // PLAYER_IA_FISHING_POLE - func_80833770, // PLAYER_IA_SWORD_MASTER - func_80833770, // PLAYER_IA_SWORD_KOKIRI - func_80833770, // PLAYER_IA_SWORD_BIGGORON - func_8083377C, // PLAYER_IA_DEKU_STICK - func_80833790, // PLAYER_IA_HAMMER - func_8083379C, // PLAYER_IA_BOW - func_8083379C, // PLAYER_IA_BOW_FIRE - func_8083379C, // PLAYER_IA_BOW_ICE - func_8083379C, // PLAYER_IA_BOW_LIGHT - func_8083379C, // PLAYER_IA_BOW_0C - func_8083379C, // PLAYER_IA_BOW_0D - func_8083379C, // PLAYER_IA_BOW_0E - func_8083379C, // PLAYER_IA_SLINGSHOT - func_80833910, // PLAYER_IA_HOOKSHOT - func_80833910, // PLAYER_IA_LONGSHOT - func_808337D4, // PLAYER_IA_BOMB - func_808337D4, // PLAYER_IA_BOMBCHU - func_80833984, // PLAYER_IA_BOOMERANG - func_80833770, // PLAYER_IA_MAGIC_SPELL_15 - func_80833770, // PLAYER_IA_MAGIC_SPELL_16 - func_80833770, // PLAYER_IA_MAGIC_SPELL_17 - func_80833770, // PLAYER_IA_FARORES_WIND - func_80833770, // PLAYER_IA_NAYRUS_LOVE - func_80833770, // PLAYER_IA_DINS_FIRE - func_80833770, // PLAYER_IA_DEKU_NUT - func_80833770, // PLAYER_IA_OCARINA_FAIRY - func_80833770, // PLAYER_IA_OCARINA_OF_TIME - func_80833770, // PLAYER_IA_BOTTLE - func_80833770, // PLAYER_IA_BOTTLE_FISH - func_80833770, // PLAYER_IA_BOTTLE_FIRE - func_80833770, // PLAYER_IA_BOTTLE_BUG - func_80833770, // PLAYER_IA_BOTTLE_POE - func_80833770, // PLAYER_IA_BOTTLE_BIG_POE - func_80833770, // PLAYER_IA_BOTTLE_RUTOS_LETTER - func_80833770, // PLAYER_IA_BOTTLE_POTION_RED - func_80833770, // PLAYER_IA_BOTTLE_POTION_BLUE - func_80833770, // PLAYER_IA_BOTTLE_POTION_GREEN - func_80833770, // PLAYER_IA_BOTTLE_MILK_FULL - func_80833770, // PLAYER_IA_BOTTLE_MILK_HALF - func_80833770, // PLAYER_IA_BOTTLE_FAIRY - func_80833770, // PLAYER_IA_ZELDAS_LETTER - func_80833770, // PLAYER_IA_WEIRD_EGG - func_80833770, // PLAYER_IA_CHICKEN - func_80833770, // PLAYER_IA_MAGIC_BEAN - func_80833770, // PLAYER_IA_POCKET_EGG - func_80833770, // PLAYER_IA_POCKET_CUCCO - func_80833770, // PLAYER_IA_COJIRO - func_80833770, // PLAYER_IA_ODD_MUSHROOM - func_80833770, // PLAYER_IA_ODD_POTION - func_80833770, // PLAYER_IA_POACHERS_SAW - func_80833770, // PLAYER_IA_BROKEN_GORONS_SWORD - func_80833770, // PLAYER_IA_PRESCRIPTION - func_80833770, // PLAYER_IA_FROG - func_80833770, // PLAYER_IA_EYEDROPS - func_80833770, // PLAYER_IA_CLAIM_CHECK - func_80833770, // PLAYER_IA_MASK_KEATON - func_80833770, // PLAYER_IA_MASK_SKULL - func_80833770, // PLAYER_IA_MASK_SPOOKY - func_80833770, // PLAYER_IA_MASK_BUNNY_HOOD - func_80833770, // PLAYER_IA_MASK_GORON - func_80833770, // PLAYER_IA_MASK_ZORA - func_80833770, // PLAYER_IA_MASK_GERUDO - func_80833770, // PLAYER_IA_MASK_TRUTH - func_80833770, // PLAYER_IA_LENS_OF_TRUTH + Player_InitDefaultIA, // PLAYER_IA_NONE + Player_InitDefaultIA, // PLAYER_IA_SWORD_CS + Player_InitDefaultIA, // PLAYER_IA_FISHING_POLE + Player_InitDefaultIA, // PLAYER_IA_SWORD_MASTER + Player_InitDefaultIA, // PLAYER_IA_SWORD_KOKIRI + Player_InitDefaultIA, // PLAYER_IA_SWORD_BIGGORON + Player_InitDekuStickIA, // PLAYER_IA_DEKU_STICK + Player_InitHammerIA, // PLAYER_IA_HAMMER + Player_InitBowOrSlingshotIA, // PLAYER_IA_BOW + Player_InitBowOrSlingshotIA, // PLAYER_IA_BOW_FIRE + Player_InitBowOrSlingshotIA, // PLAYER_IA_BOW_ICE + Player_InitBowOrSlingshotIA, // PLAYER_IA_BOW_LIGHT + Player_InitBowOrSlingshotIA, // PLAYER_IA_BOW_0C + Player_InitBowOrSlingshotIA, // PLAYER_IA_BOW_0D + Player_InitBowOrSlingshotIA, // PLAYER_IA_BOW_0E + Player_InitBowOrSlingshotIA, // PLAYER_IA_SLINGSHOT + Player_InitHookshotIA, // PLAYER_IA_HOOKSHOT + Player_InitHookshotIA, // PLAYER_IA_LONGSHOT + Player_InitExplosiveIA, // PLAYER_IA_BOMB + Player_InitExplosiveIA, // PLAYER_IA_BOMBCHU + Player_InitBoomerangIA, // PLAYER_IA_BOOMERANG + Player_InitDefaultIA, // PLAYER_IA_MAGIC_SPELL_15 + Player_InitDefaultIA, // PLAYER_IA_MAGIC_SPELL_16 + Player_InitDefaultIA, // PLAYER_IA_MAGIC_SPELL_17 + Player_InitDefaultIA, // PLAYER_IA_FARORES_WIND + Player_InitDefaultIA, // PLAYER_IA_NAYRUS_LOVE + Player_InitDefaultIA, // PLAYER_IA_DINS_FIRE + Player_InitDefaultIA, // PLAYER_IA_DEKU_NUT + Player_InitDefaultIA, // PLAYER_IA_OCARINA_FAIRY + Player_InitDefaultIA, // PLAYER_IA_OCARINA_OF_TIME + Player_InitDefaultIA, // PLAYER_IA_BOTTLE + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_FISH + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_FIRE + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_BUG + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_POE + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_BIG_POE + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_RUTOS_LETTER + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_POTION_RED + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_POTION_BLUE + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_POTION_GREEN + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_MILK_FULL + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_MILK_HALF + Player_InitDefaultIA, // PLAYER_IA_BOTTLE_FAIRY + Player_InitDefaultIA, // PLAYER_IA_ZELDAS_LETTER + Player_InitDefaultIA, // PLAYER_IA_WEIRD_EGG + Player_InitDefaultIA, // PLAYER_IA_CHICKEN + Player_InitDefaultIA, // PLAYER_IA_MAGIC_BEAN + Player_InitDefaultIA, // PLAYER_IA_POCKET_EGG + Player_InitDefaultIA, // PLAYER_IA_POCKET_CUCCO + Player_InitDefaultIA, // PLAYER_IA_COJIRO + Player_InitDefaultIA, // PLAYER_IA_ODD_MUSHROOM + Player_InitDefaultIA, // PLAYER_IA_ODD_POTION + Player_InitDefaultIA, // PLAYER_IA_POACHERS_SAW + Player_InitDefaultIA, // PLAYER_IA_BROKEN_GORONS_SWORD + Player_InitDefaultIA, // PLAYER_IA_PRESCRIPTION + Player_InitDefaultIA, // PLAYER_IA_FROG + Player_InitDefaultIA, // PLAYER_IA_EYEDROPS + Player_InitDefaultIA, // PLAYER_IA_CLAIM_CHECK + Player_InitDefaultIA, // PLAYER_IA_MASK_KEATON + Player_InitDefaultIA, // PLAYER_IA_MASK_SKULL + Player_InitDefaultIA, // PLAYER_IA_MASK_SPOOKY + Player_InitDefaultIA, // PLAYER_IA_MASK_BUNNY_HOOD + Player_InitDefaultIA, // PLAYER_IA_MASK_GORON + Player_InitDefaultIA, // PLAYER_IA_MASK_ZORA + Player_InitDefaultIA, // PLAYER_IA_MASK_GERUDO + Player_InitDefaultIA, // PLAYER_IA_MASK_TRUTH + Player_InitDefaultIA, // PLAYER_IA_LENS_OF_TRUTH }; typedef enum { @@ -1555,15 +1567,15 @@ void func_80832564(PlayState* play, Player* this) { } s32 func_80832594(Player* this, s32 arg1, s32 arg2) { - s16 controlStickAngleDiff = this->unk_A80 - sControlStickAngle; + s16 controlStickAngleDiff = this->prevControlStickAngle - sControlStickAngle; - this->unk_850 += arg1 + (s16)(ABS(controlStickAngleDiff) * fabsf(sControlStickMagnitude) * 2.5415802156203426e-06f); + this->av2.actionVar2 += arg1 + (s16)(ABS(controlStickAngleDiff) * fabsf(sControlStickMagnitude) * 2.5415802156203426e-06f); if (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B)) { - this->unk_850 += 5; + this->av2.actionVar2 += 5; } - return this->unk_850 > arg2; + return this->av2.actionVar2 > arg2; } void func_80832630(PlayState* play) { @@ -1676,31 +1688,33 @@ void Player_ProcessAnimSfxList(Player* this, AnimSfxEntry* entry) { s32 pad; do { - s32 absData = ABS(entry->field); - s32 type = absData & 0x7800; - if (LinkAnimation_OnFrame(&this->skelAnime, fabsf(absData & 0x7FF))) { - if (type == 0x800) { + s32 absData = ABS(entry->data); + s32 type = ANIMSFX_GET_TYPE(absData); + + if (LinkAnimation_OnFrame(&this->skelAnime, fabsf(ANIMSFX_GET_FRAME(absData)))) { + if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_1)) { Player_PlaySfx(this, entry->sfxId); - } else if (type == 0x1000) { + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_2)) { func_80832770(this, entry->sfxId); - } else if (type == 0x1800) { + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_3)) { func_808327C4(this, entry->sfxId); - } else if (type == 0x2000) { + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_4)) { func_80832698(this, entry->sfxId); - } else if (type == 0x2800) { + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_5)) { func_808328A0(this); - } else if (type == 0x3000) { + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_6)) { func_808327F8(this, 6.0f); - } else if (type == 0x3800) { + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_7)) { func_80832854(this); - } else if (type == 0x4000) { + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_8)) { func_808327F8(this, 0.0f); - } else if (type == 0x4800) { - func_800F4010(&this->actor.projectedPos, this->ageProperties->unk_94 + NA_SE_PL_WALK_LADDER, 0.0f); + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_9)) { + func_800F4010(&this->actor.projectedPos, + NA_SE_PL_WALK_LADDER + this->ageProperties->unk_94, 0.0f); } } - cont = (entry->field >= 0); // stop processing if `data` is negative + cont = (entry->data >= 0); // stop processing if `data` is negative entry++; } while (cont); } @@ -1812,7 +1826,8 @@ void Player_AnimReplaceApplyFlags(PlayState* play, Player* this, s32 flags) { AnimationContext_DisableQueue(play); } -void Player_AnimReplacePlayOnceSetSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { +void Player_AnimReplacePlayOnceSetSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, + f32 playbackSpeed) { LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, playbackSpeed); Player_AnimReplaceApplyFlags(play, this, flags); } @@ -1829,7 +1844,8 @@ void Player_AnimReplaceNormalPlayOnceAdjusted(PlayState* play, Player* this, Lin Player_AnimReplacePlayOnceAdjusted(play, this, anim, 0x1C); } -void Player_AnimReplacePlayLoopSetSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { +void Player_AnimReplacePlayLoopSetSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, + f32 playbackSpeed) { LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, anim, playbackSpeed); Player_AnimReplaceApplyFlags(play, this, flags); } @@ -1850,8 +1866,8 @@ void Player_ProcessControlStick(PlayState* play, Player* this) { s8 phi_v1; s8 phi_v0; - this->unk_A7C = sControlStickMagnitude; - this->unk_A80 = sControlStickAngle; + this->prevControlStickMagnitude = sControlStickMagnitude; + this->prevControlStickAngle = sControlStickAngle; func_80077D10(&sControlStickMagnitude, &sControlStickAngle, sControlInput); @@ -1875,7 +1891,7 @@ void func_8083328C(PlayState* play, Player* this, LinkAnimationHeader* linkAnim) LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, linkAnim, D_808535E8); } -s32 func_808332B8(Player* this) { +int func_808332B8(Player* this) { return (this->stateFlags1 & PLAYER_STATE1_IN_WATER) && (this->currentBoots != PLAYER_BOOTS_IRON); } @@ -1931,7 +1947,7 @@ LinkAnimationHeader* func_80833438(Player* this) { } } -s32 func_808334B4(Player* this) { +int func_808334B4(Player* this) { return func_808332E4(this) && (this->unk_834 != 0); } @@ -1975,8 +1991,8 @@ LinkAnimationHeader* func_808335F4(Player* this) { } } -void Player_SetUpperActionFunc(Player* this, UpperActionFunc arg1) { - this->upperActionFunc = arg1; +void Player_SetUpperActionFunc(Player* this, UpperActionFunc upperActionFunc) { + this->upperActionFunc = upperActionFunc; this->unk_836 = 0; this->upperAnimBlendWeight = 0.0f; func_808326F0(this); @@ -2019,17 +2035,17 @@ s8 Player_ItemToItemAction(s32 item) { } } -void func_80833770(PlayState* play, Player* this) { +void Player_InitDefaultIA(PlayState* play, Player* this) { } -void func_8083377C(PlayState* play, Player* this) { +void Player_InitDekuStickIA(PlayState* play, Player* this) { this->unk_85C = 1.0f; } -void func_80833790(PlayState* play, Player* this) { +void Player_InitHammerIA(PlayState* play, Player* this) { } -void func_8083379C(PlayState* play, Player* this) { +void Player_InitBowOrSlingshotIA(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_ITEM_IN_HAND; if (this->heldItemAction != PLAYER_IA_SLINGSHOT) { @@ -2039,7 +2055,7 @@ void func_8083379C(PlayState* play, Player* this) { } } -void func_808337D4(PlayState* play, Player* this) { +void Player_InitExplosiveIA(PlayState* play, Player* this) { s32 explosiveType; ExplosiveInfo* explosiveInfo; Actor* spawnedActor; @@ -2052,9 +2068,9 @@ void func_808337D4(PlayState* play, Player* this) { explosiveType = Player_GetExplosiveHeld(this); explosiveInfo = &sExplosiveInfos[explosiveType]; - spawnedActor = Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, explosiveInfo->actorId, - this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, - this->actor.shape.rot.y, 0, 0); + spawnedActor = + Actor_SpawnAsChild(&play->actorCtx, &this->actor, play, explosiveInfo->actorId, this->actor.world.pos.x, + this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 0); if (spawnedActor != NULL) { if ((explosiveType != 0) && (play->bombchuBowlingStatus != 0)) { if (!CVarGetInteger("gInfiniteAmmo", 0)) { @@ -2076,7 +2092,7 @@ void func_808337D4(PlayState* play, Player* this) { } } -void func_80833910(PlayState* play, Player* this) { +void Player_InitHookshotIA(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_ITEM_IN_HAND; this->unk_860 = -3; @@ -2085,7 +2101,7 @@ void func_80833910(PlayState* play, Player* this) { this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, 0); } -void func_80833984(PlayState* play, Player* this) { +void Player_InitBoomerangIA(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_BOOMERANG_IN_HAND; } @@ -2109,7 +2125,8 @@ void func_80833A20(Player* this, s32 newMeleeWeaponState) { u16 voiceSfx; if (this->meleeWeaponState == 0) { - if ((this->heldItemAction == PLAYER_IA_SWORD_BIGGORON) && (gSaveContext.swordHealth > 0.0f)) { + if ((this->heldItemAction == PLAYER_IA_SWORD_BIGGORON) && + (gSaveContext.swordHealth > 0.0f)) { itemSfx = NA_SE_IT_HAMMER_SWING; } else { itemSfx = NA_SE_IT_SWORD_SWING; @@ -2160,18 +2177,18 @@ s32 func_80833B54(Player* this) { if (this->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) { this->stateFlags1 &= ~PLAYER_STATE1_ENEMY_TARGET; if (this->linearVelocity == 0.0f) { - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } } return 0; } -s32 func_80833BCC(Player* this) { +int func_80833BCC(Player* this) { return func_8008E9C4(this) || func_80833B2C(this); } -s32 func_80833C04(Player* this) { +int func_80833C04(Player* this) { return func_80833B54(this) || func_80833B2C(this); } @@ -2251,13 +2268,15 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) { } } else { maskItemAction = this->currentMask - 1 + PLAYER_IA_MASK_KEATON; + bool hasOnDpad = false; if (CVarGetInteger("gDpadEquips", 0) != 0) { for (int buttonIndex = 0; buttonIndex < 4; buttonIndex++) { hasOnDpad |= Player_ItemIsItemAction(DPAD_ITEM(buttonIndex), maskItemAction); } } - if (!Player_ItemIsItemAction(C_BTN_ITEM(0), maskItemAction) && !Player_ItemIsItemAction(C_BTN_ITEM(1), maskItemAction) && + if (!Player_ItemIsItemAction(C_BTN_ITEM(0), maskItemAction) && + !Player_ItemIsItemAction(C_BTN_ITEM(1), maskItemAction) && !Player_ItemIsItemAction(C_BTN_ITEM(2), maskItemAction) && !hasOnDpad) { this->currentMask = PLAYER_MASK_NONE; } @@ -2544,7 +2563,11 @@ s32 func_8083499C(Player* this, PlayState* play) { return 1; } -s32 func_808349DC(Player* this, PlayState* play) { +/** + * The actual sword weapon is not handled here. See `Player_ActionChange_7` for melee weapon usage. + * This upper body action allows for shielding or changing held items while a sword is in hand. + */ +s32 Player_UpperAction_Sword(Player* this, PlayState* play) { if (func_80834758(play, this) || func_8083499C(this, play)) { return 1; } else { @@ -2555,8 +2578,8 @@ s32 func_808349DC(Player* this, PlayState* play) { s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->upperSkelAnime) || ((Player_ItemToItemAction(this->heldItemId) == this->heldItemAction) && - (sUseHeldItem = (sUseHeldItem || - ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)))))) { + (sUseHeldItem = + (sUseHeldItem || ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)))))) { Player_SetUpperActionFunc(this, sItemActionUpdateFuncs[this->heldItemAction]); this->unk_834 = 0; this->unk_6AC = 0; @@ -2609,7 +2632,8 @@ s32 func_80834C74(Player* this, PlayState* play) { if (sUseHeldItem || LinkAnimation_Update(play, &this->upperSkelAnime)) { Player_SetUpperActionFunc(this, sItemActionUpdateFuncs[this->heldItemAction]); - LinkAnimation_PlayLoop(play, &this->upperSkelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType)); + LinkAnimation_PlayLoop(play, &this->upperSkelAnime, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType)); this->unk_6AC = 0; this->upperActionFunc(this, play); return 0; @@ -2647,22 +2671,24 @@ s32 func_80834D2C(Player* this, PlayState* play) { return 1; } -s32 func_80834E44(PlayState* play) { +int func_80834E44(PlayState* play) { return (play->shootingGalleryStatus > 0) && CHECK_BTN_ALL(sControlInput->press.button, BTN_B); } -s32 func_80834E7C(PlayState* play) { +int func_80834E7C(PlayState* play) { u16 buttonsToCheck = BTN_A | BTN_B | BTN_CUP | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; if (CVarGetInteger("gDpadEquips", 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } return (play->shootingGalleryStatus != 0) && - ((play->shootingGalleryStatus < 0) || CHECK_BTN_ANY(sControlInput->cur.button, buttonsToCheck)); + ((play->shootingGalleryStatus < 0) || + CHECK_BTN_ANY(sControlInput->cur.button, buttonsToCheck)); } s32 func_80834EB8(Player* this, PlayState* play) { if ((this->unk_6AD == 0) || (this->unk_6AD == 2)) { - if (func_80833BCC(this) || (Camera_CheckValidMode(Play_GetCamera(play, 0), 7) == 0)) { + if (func_80833BCC(this) || + (Camera_CheckValidMode(Play_GetCamera(play, 0), 7) == 0)) { return 1; } this->unk_6AD = 2; @@ -2859,10 +2885,10 @@ void func_808355DC(Player* this) { this->stateFlags1 |= PLAYER_STATE1_TARGET_NOTHING; if (!(this->skelAnime.moveFlags & 0x80) && (this->actor.bgCheckFlags & 0x200) && (sShapeYawToTouchedWall < 0x2000)) { - this->currentYaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; + this->yaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; } - this->targetYaw = this->actor.shape.rot.y; + this->zTargetYaw = this->actor.shape.rot.y; } s32 func_80835644(PlayState* play, Player* this, Actor* arg2) { @@ -2877,12 +2903,12 @@ s32 func_80835644(PlayState* play, Player* this, Actor* arg2) { void func_80835688(Player* this, PlayState* play) { if (!func_80835644(play, this, this->heldActor)) { - Player_SetUpperActionFunc(this, func_808356E8); + Player_SetUpperActionFunc(this, Player_UpperAction_CarryActor); LinkAnimation_PlayLoop(play, &this->upperSkelAnime, &gPlayerAnim_link_normal_carryB_wait); } } -s32 func_808356E8(Player* this, PlayState* play) { +s32 Player_UpperAction_CarryActor(Player* this, PlayState* play) { Actor* heldActor = this->heldActor; if (heldActor == NULL) { @@ -2974,8 +3000,8 @@ s32 func_808359FC(Player* this, PlayState* play) { f32 posZ = (Math_CosS(this->actor.shape.rot.y) * 10.0f) + this->actor.world.pos.z; s32 yaw = (this->unk_664 != NULL) ? this->actor.shape.rot.y + 14000 : this->actor.shape.rot.y; EnBoom* boomerang = - (EnBoom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOOM, posX, this->actor.world.pos.y + 30.0f, - posZ, this->actor.focus.rot.x, yaw, 0, 0, true); + (EnBoom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOOM, posX, this->actor.world.pos.y + 30.0f, posZ, + this->actor.focus.rot.x, yaw, 0, 0, true); this->boomerangActor = &boomerang->actor; if (boomerang != NULL) { @@ -3024,7 +3050,7 @@ s32 func_80835B60(Player* this, PlayState* play) { Player_SetUpperActionFunc(this, func_80835C08); LinkAnimation_PlayOnce(play, &this->upperSkelAnime, &gPlayerAnim_link_boom_catch); func_808357E8(this, gPlayerLeftHandBoomerangDLs); - Player_PlaySfx(&this->actor, NA_SE_PL_CATCH_BOOMERANG); + Player_PlaySfx(this, NA_SE_PL_CATCH_BOOMERANG); func_80832698(this, NA_SE_VO_LI_SWORD_N); return 1; } @@ -3049,21 +3075,20 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun return 0; } - if (func_8084E3C4 == this->actionFunc) { + if (Player_Action_8084E3C4 == this->actionFunc) { Audio_OcaSetInstrument(0); this->stateFlags2 &= ~(PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR | PLAYER_STATE2_PLAY_FOR_ACTOR); - } else if (func_808507F4 == this->actionFunc) { + } else if (Player_Action_808507F4 == this->actionFunc) { func_80832340(play, this); } this->actionFunc = actionFunc; - if ((this->itemAction != this->heldItemAction) && - (!(flags & 1) || !(this->stateFlags1 & PLAYER_STATE1_SHIELDING))) { + if ((this->itemAction != this->heldItemAction) && (!(flags & 1) || !(this->stateFlags1 & PLAYER_STATE1_SHIELDING))) { func_8008EC70(this); } - if (!(flags & 1) && (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD))) { + if (!(flags & 1) && !(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { func_80834644(play, this); this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; } @@ -3075,8 +3100,8 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun this->stateFlags2 &= ~(PLAYER_STATE2_HOPPING | PLAYER_STATE2_OCARINA_PLAYING | PLAYER_STATE2_IDLING); this->stateFlags3 &= ~(PLAYER_STATE3_MIDAIR | PLAYER_STATE3_FINISHED_ATTACKING | PLAYER_STATE3_HOOKSHOT_TRAVELLING); - this->unk_84F = 0; - this->unk_850 = 0; + this->av1.actionVar1 = 0; + this->av2.actionVar2 = 0; this->unk_6AC = 0; @@ -3118,7 +3143,7 @@ void func_80835E44(PlayState* play, s16 camSetting) { void func_80835EA4(PlayState* play, s32 arg1) { func_80835E44(play, CAM_SET_TURN_AROUND); - Camera_SetCameraData(Play_GetCamera(play, 0), 4, 0, 0, arg1, 0, 0); + Camera_SetCameraData(Play_GetCamera(play, 0), 4, NULL, NULL, arg1, 0, 0); } void Player_DestroyHookshot(Player* this) { @@ -3143,8 +3168,7 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { if (((this->heldItemAction == this->itemAction) && (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) || (Player_ActionToMeleeWeapon(itemAction) != 0) || (itemAction == PLAYER_IA_NONE))) || - ((this->itemAction < 0) && - ((Player_ActionToMeleeWeapon(itemAction) != 0) || (itemAction == PLAYER_IA_NONE)))) { + ((this->itemAction < 0) && ((Player_ActionToMeleeWeapon(itemAction) != 0) || (itemAction == PLAYER_IA_NONE)))) { if ((itemAction == PLAYER_IA_NONE) || !(this->stateFlags1 & PLAYER_STATE1_IN_WATER) || ((this->actor.bgCheckFlags & 1) && @@ -3156,11 +3180,11 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { (temp = Player_ActionToExplosive(this, itemAction), ((temp >= 0) && ((AMMO(sExplosiveInfos[temp].itemId) == 0) || (play->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].length >= 3 && !CVarGetInteger("gRemoveExplosiveLimit", 0))))))) { + // Prevent some items from being used if player is out of ammo. + // Also prevent explosives from being used if there are 3 or more active (outside of bombchu bowling) func_80078884(NA_SE_SY_ERROR); - return; - } - - if (itemAction == PLAYER_IA_LENS_OF_TRUTH) { + } else if (itemAction == PLAYER_IA_LENS_OF_TRUTH) { + // Handle Lens of Truth if (Magic_RequestChange(play, 0, MAGIC_CONSUME_LENS)) { if (play->actorCtx.lensActive) { Actor_DisableLens(play); @@ -3171,20 +3195,15 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { } else { func_80078884(NA_SE_SY_ERROR); } - return; - } - - if (itemAction == PLAYER_IA_DEKU_NUT) { + } else if (itemAction == PLAYER_IA_DEKU_NUT) { + // Handle Deku Nuts if (AMMO(ITEM_NUT) != 0) { func_8083C61C(play, this); } else { func_80078884(NA_SE_SY_ERROR); } - return; - } - - temp = Player_ActionToMagicSpell(this, itemAction); - if (temp >= 0) { + } else if ((temp = Player_ActionToMagicSpell(this, itemAction)) >= 0) { + // Handle magic spells if (((itemAction == PLAYER_IA_FARORES_WIND) && (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 0)) || ((gSaveContext.magicCapacity != 0) && (gSaveContext.magicState == MAGIC_STATE_IDLE) && (gSaveContext.magic >= sMagicSpellCosts[temp]))) { @@ -3193,35 +3212,31 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { } else { func_80078884(NA_SE_SY_ERROR); } - return; - } - - if (itemAction >= PLAYER_IA_MASK_KEATON) { + } else if (itemAction >= PLAYER_IA_MASK_KEATON) { + // Handle wearable masks if (this->currentMask != PLAYER_MASK_NONE) { this->currentMask = PLAYER_MASK_NONE; } else { this->currentMask = itemAction - PLAYER_IA_MASK_KEATON + 1; } + sMaskMemory = this->currentMask; func_808328EC(this, NA_SE_PL_CHANGE_ARMS); - return; - } - - if (((itemAction >= PLAYER_IA_OCARINA_FAIRY) && (itemAction <= PLAYER_IA_OCARINA_OF_TIME)) || + } else if (((itemAction >= PLAYER_IA_OCARINA_FAIRY) && (itemAction <= PLAYER_IA_OCARINA_OF_TIME)) || (itemAction >= PLAYER_IA_BOTTLE_FISH)) { + // Handle "cutscene items" if (!func_8008E9C4(this) || ((itemAction >= PLAYER_IA_BOTTLE_POTION_RED) && (itemAction <= PLAYER_IA_BOTTLE_FAIRY))) { func_8002D53C(play, &play->actorCtx.titleCtx); this->unk_6AD = 4; this->itemAction = itemAction; } - return; - } - - if ((itemAction != this->heldItemAction) || - ((this->heldActor == 0) && (Player_ActionToExplosive(this, itemAction) >= 0))) { + } else if ((itemAction != this->heldItemAction) || + ((this->heldActor == NULL) && (Player_ActionToExplosive(this, itemAction) >= 0))) { + // Handle using a new held item this->nextModelGroup = Player_ActionToModelGroup(this, itemAction); nextAnimType = gPlayerModelTypes[this->nextModelGroup][PLAYER_MODELGROUPENTRY_ANIM]; + if ((this->heldItemAction >= 0) && (Player_ActionToMagicSpell(this, itemAction) < 0) && (item != this->heldItemId) && (sItemChangeTypes[gPlayerModelTypes[this->modelGroup][PLAYER_MODELGROUPENTRY_ANIM]][nextAnimType] != @@ -3229,6 +3244,7 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { (!CVarGetInteger("gSeparateArrows", 0) || itemAction < PLAYER_IA_BOW || itemAction > PLAYER_IA_BOW_0E || this->heldItemAction < PLAYER_IA_BOW || this->heldItemAction > PLAYER_IA_BOW_0E)) { + // Start the held item change process this->heldItemId = item; this->stateFlags1 |= PLAYER_STATE1_START_PUTAWAY; } else { @@ -3237,10 +3253,10 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { Player_DetachHeldActor(play, this); Player_InitItemActionWithAnim(play, this, itemAction); } - return; + } else { + // Handle using the held item already in hand + sUseHeldItem = sHeldItemButtonIsHeldDown = true; } - - sUseHeldItem = sHeldItemButtonIsHeldDown = true; } } } @@ -3250,7 +3266,7 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { func_80832564(play, this); - Player_SetupAction(play, this, cond ? func_8084E368 : func_80843CEC, 0); + Player_SetupAction(play, this, cond ? Player_Action_8084E368 : Player_Action_80843CEC, 0); this->stateFlags1 |= PLAYER_STATE1_DEAD; @@ -3267,7 +3283,7 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { if (Inventory_ConsumeFairy(play)) { play->gameOverCtx.state = GAMEOVER_REVIVE_START; - this->unk_84F = 1; + this->av1.actionVar1 = 1; } else { play->gameOverCtx.state = GAMEOVER_DEATH_START; func_800F6AB0(0); @@ -3282,7 +3298,7 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { } s32 Player_CanUpdateItems(Player* this) { - return (!(func_808458D0 == this->actionFunc) || + return (!(Player_Action_808458D0 == this->actionFunc) || ((this->stateFlags1 & PLAYER_STATE1_START_PUTAWAY) && ((this->heldItemId == ITEM_LAST_USED) || (this->heldItemId == ITEM_NONE)))) && (!(Player_UpperAction_ChangeHeldItem == this->upperActionFunc) || @@ -3291,12 +3307,12 @@ s32 Player_CanUpdateItems(Player* this) { s32 Player_UpdateUpperBody(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_ON_HORSE) && (this->actor.parent != NULL) && Player_HoldsHookshot(this)) { - Player_SetupAction(play, this, func_80850AEC, 1); + Player_SetupAction(play, this, Player_Action_80850AEC, 1); this->stateFlags3 |= PLAYER_STATE3_HOOKSHOT_TRAVELLING; Player_AnimPlayOnce(play, this, &gPlayerAnim_link_hook_fly_start); Player_AnimReplaceApplyFlags(play, this, 0x9B); func_80832224(this); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; this->actor.bgCheckFlags &= ~1; this->hoverBootsTimer = 0; this->unk_6AE |= 0x43; @@ -3306,7 +3322,7 @@ s32 Player_UpdateUpperBody(Player* this, PlayState* play) { if (Player_CanUpdateItems(this)) { Player_UpdateItems(this, play); - if (func_8084E604 == this->actionFunc) { + if (Player_Action_8084E604 == this->actionFunc) { return 1; } } @@ -3336,7 +3352,7 @@ s32 Player_UpdateUpperBody(Player* this, PlayState* play) { s32 func_80836898(PlayState* play, Player* this, PlayerFuncA74 func) { this->func_A74 = func; - Player_SetupAction(play, this, func_808458D0, 0); + Player_SetupAction(play, this, Player_Action_808458D0, 0); this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; return func_80832528(play, this); } @@ -3351,10 +3367,10 @@ void func_808368EC(Player* this, PlayState* play) { Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos), 4000); } else if ((this->stateFlags1 & PLAYER_STATE1_TARGET_NOTHING) && !(this->stateFlags2 & (PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS))) { - Math_ScaledStepToS(&this->actor.shape.rot.y, this->targetYaw, 4000); + Math_ScaledStepToS(&this->actor.shape.rot.y, this->zTargetYaw, 4000); } } else if (!(this->stateFlags2 & PLAYER_STATE2_DISABLE_ROTATION_ALWAYS)) { - Math_ScaledStepToS(&this->actor.shape.rot.y, this->currentYaw, 2000); + Math_ScaledStepToS(&this->actor.shape.rot.y, this->yaw, 2000); } this->unk_87C = this->actor.shape.rot.y - previousYaw; @@ -3508,26 +3524,52 @@ void func_80836BEC(Player* this, PlayState* play) { } } +/** + * These defines exist to simplify the variable used to toggle the different speed modes. + * While the `speedMode` variable is a float and can contain a non-boolean value, + * `Player_CalcSpeedAndYawFromControlStick` never actually uses the value for anything. + * It simply checks if the value is non-zero to toggle the "curved" mode. + * In practice, 0.0f or 0.018f are the only values passed to this function. + * + * It's clear that this value was intended to mean something in the curved mode calculation at + * some point in development, but was either never implemented or removed. + * + * To see the difference between linear and curved mode, with interactive toggles for + * speed cap and floor pitch, see the following desmos graph: https://www.desmos.com/calculator/hri7dcws4c + */ + +// Linear mode is a straight line, increasing target speed at a steady rate relative to the control stick magnitude +#define SPEED_MODE_LINEAR 0.0f + +// Curved mode drops any input below 20 units of magnitude, resulting in zero for target speed. +// Beyond 20 units, a gradual curve slowly moves up until around the 40 unit mark +// when target speed ramps up very quickly. +#define SPEED_MODE_CURVED 0.018f + /** * Calculates target speed and yaw based on input from the control stick. * See `Player_GetMovementSpeedAndYaw` for detailed argument descriptions. * * @return true if the control stick has any magnitude, false otherwise. */ -s32 Player_CalcSpeedAndYawFromControlStick(PlayState* play, Player* this, f32* outSpeedTarget, s16* outYawTarget, f32 speedMode) { +s32 Player_CalcSpeedAndYawFromControlStick(PlayState* play, Player* this, f32* outSpeedTarget, s16* outYawTarget, + f32 speedMode) { f32 temp; f32 sinFloorPitch; f32 floorPitchInfluence; f32 speedCap; - if ((this->unk_6AD != 0) || (play->transitionTrigger == TRANS_TRIGGER_START) || (this->stateFlags1 & PLAYER_STATE1_LOADING)) { + if ((this->unk_6AD != 0) || (play->transitionTrigger == TRANS_TRIGGER_START) || + (this->stateFlags1 & PLAYER_STATE1_LOADING)) { *outSpeedTarget = 0.0f; *outYawTarget = this->actor.shape.rot.y; } else { *outSpeedTarget = sControlStickMagnitude; *outYawTarget = sControlStickAngle; - if (speedMode != 0.0f) { + // The value of `speedMode` is never actually used. It only toggles this condition. + // See the definition of `SPEED_MODE_LINEAR` and `SPEED_MODE_CURVED` for more information. + if (speedMode != SPEED_MODE_LINEAR) { *outSpeedTarget -= 20.0f; if (*outSpeedTarget < 0.0f) { // If control stick magnitude is below 20, return zero speed. @@ -3537,7 +3579,7 @@ s32 Player_CalcSpeedAndYawFromControlStick(PlayState* play, Player* this, f32* o // it happens to give a desirable curve for grounded movement speed relative // to control stick magnitude. temp = 1.0f - Math_CosS(*outSpeedTarget * 450.0f); - *outSpeedTarget = ((temp * temp) * 30.0f) + 7.0f; + *outSpeedTarget = (SQ(temp) * 30.0f) + 7.0f; } } else { // Speed increases linearly relative to control stick magnitude @@ -3550,10 +3592,8 @@ s32 Player_CalcSpeedAndYawFromControlStick(PlayState* play, Player* this, f32* o floorPitchInfluence = CLAMP(sinFloorPitch, 0.0f, 0.6f); if (this->unk_6C4 != 0.0f) { - speedCap = speedCap - (this->unk_6C4 * 0.008f); - if (speedCap < 2.0f) { - speedCap = 2.0f; - } + speedCap -= (this->unk_6C4 * 0.008f); + speedCap = CLAMP_MIN(speedCap, 2.0f); } *outSpeedTarget = (*outSpeedTarget * 0.14f) - (8.0f * floorPitchInfluence * floorPitchInfluence); @@ -3583,7 +3623,8 @@ s32 func_8083721C(Player* this) { * * @return true if the control stick has any magnitude, false otherwise. */ -s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYawTarget, f32 speedMode, PlayState* play) { +s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYawTarget, f32 speedMode, + PlayState* play) { if (!Player_CalcSpeedAndYawFromControlStick(play, this, outSpeedTarget, outYawTarget, speedMode)) { *outYawTarget = this->actor.shape.rot.y; @@ -3593,7 +3634,7 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw return false; } } else if (func_80833B2C(this)) { - *outYawTarget = this->targetYaw; + *outYawTarget = this->zTargetYaw; } return false; @@ -3603,21 +3644,115 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw } } -static s8 D_808543E0[] = { 13, 2, 4, 9, 10, 11, 8, -7 }; -static s8 D_808543E8[] = { 13, 1, 2, 5, 3, 4, 9, 10, 11, 7, 8, -6 }; -static s8 D_808543F4[] = { 13, 1, 2, 3, 4, 9, 10, 11, 8, 7, -6 }; -static s8 D_80854400[] = { 13, 2, 4, 9, 10, 11, 8, -7 }; -static s8 D_80854408[] = { 13, 2, 4, 9, 10, 11, 12, 8, -7 }; -static s8 D_80854414[] = { -7 }; -static s8 D_80854418[] = { 0, 11, 1, 2, 3, 5, 4, 9, 8, 7, -6 }; -static s8 D_80854424[] = { 0, 11, 1, 2, 3, 12, 5, 4, 9, 8, 7, -6 }; -static s8 D_80854430[] = { 13, 1, 2, 3, 12, 5, 4, 9, 10, 11, 8, 7, -6 }; -static s8 D_80854440[] = { 10, 8, -7 }; -static s8 D_80854444[] = { 0, 12, 5, -4 }; +typedef enum { + /* 0 */ PLAYER_ACTION_CHG_0, + /* 1 */ PLAYER_ACTION_CHG_1, + /* 2 */ PLAYER_ACTION_CHG_2, + /* 3 */ PLAYER_ACTION_CHG_3, + /* 4 */ PLAYER_ACTION_CHG_4, + /* 5 */ PLAYER_ACTION_CHG_5, + /* 6 */ PLAYER_ACTION_CHG_6, + /* 7 */ PLAYER_ACTION_CHG_7, + /* 8 */ PLAYER_ACTION_CHG_8, + /* 9 */ PLAYER_ACTION_CHG_9, + /* 10 */ PLAYER_ACTION_CHG_10, + /* 11 */ PLAYER_ACTION_CHG_11, + /* 12 */ PLAYER_ACTION_CHG_12, + /* 13 */ PLAYER_ACTION_CHG_13 +} ActionChangeIndex; -static s32 (*D_80854448[])(Player* this, PlayState* play) = { - func_8083B998, func_80839800, func_8083E5A8, func_8083E0FC, func_8083B644, func_8083F7BC, func_8083C1DC, - func_80850224, func_8083C544, func_8083EB44, func_8083BDBC, func_8083C2B0, func_80838A14, func_8083B040, +static s8 sActionChangeList1[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, + PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, +}; + +static s8 sActionChangeList2[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_5, + PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, + PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_7, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_6, +}; + +static s8 sActionChangeList3[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_3, + PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, + PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +}; + +static s8 sActionChangeList4[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, + PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, +}; + +static s8 sActionChangeList5[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, + PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_12, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, +}; + +static s8 sActionChangeList6[] = { + -PLAYER_ACTION_CHG_7, +}; + +static s8 sActionChangeList7[] = { + PLAYER_ACTION_CHG_0, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, + PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, + PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +}; + +static s8 sActionChangeList8[] = { + PLAYER_ACTION_CHG_0, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, + PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_12, PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, + PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +}; + +static s8 sActionChangeList9[] = { + PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_12, + PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, + PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +}; + +static s8 sActionChangeList10[] = { + PLAYER_ACTION_CHG_10, + PLAYER_ACTION_CHG_8, + -PLAYER_ACTION_CHG_7, +}; + +static s8 sActionChangeList11[] = { + PLAYER_ACTION_CHG_0, + PLAYER_ACTION_CHG_12, + PLAYER_ACTION_CHG_5, + -PLAYER_ACTION_CHG_4, +}; + +s32 Player_ActionChange_0(Player* this, PlayState* play); +s32 Player_ActionChange_1(Player* this, PlayState* play); +s32 Player_ActionChange_2(Player* this, PlayState* play); +s32 Player_ActionChange_3(Player* this, PlayState* play); +s32 Player_ActionChange_4(Player* this, PlayState* play); +s32 Player_ActionChange_5(Player* this, PlayState* play); +s32 Player_ActionChange_6(Player* this, PlayState* play); +s32 Player_ActionChange_7(Player* this, PlayState* play); +s32 Player_ActionChange_8(Player* this, PlayState* play); +s32 Player_ActionChange_9(Player* this, PlayState* play); +s32 Player_ActionChange_10(Player* this, PlayState* play); +s32 Player_ActionChange_11(Player* this, PlayState* play); +s32 Player_ActionChange_12(Player* this, PlayState* play); +s32 Player_ActionChange_13(Player* this, PlayState* play); + +static s32 (*sActionChangeFuncs[])(Player* this, PlayState* play) = { + /* PLAYER_ACTION_CHG_0 */ Player_ActionChange_0, + /* PLAYER_ACTION_CHG_1 */ Player_ActionChange_1, + /* PLAYER_ACTION_CHG_2 */ Player_ActionChange_2, + /* PLAYER_ACTION_CHG_3 */ Player_ActionChange_3, + /* PLAYER_ACTION_CHG_4 */ Player_ActionChange_4, + /* PLAYER_ACTION_CHG_5 */ Player_ActionChange_5, + /* PLAYER_ACTION_CHG_6 */ Player_ActionChange_6, + /* PLAYER_ACTION_CHG_7 */ Player_ActionChange_7, + /* PLAYER_ACTION_CHG_8 */ Player_ActionChange_8, + /* PLAYER_ACTION_CHG_9 */ Player_ActionChange_9, + /* PLAYER_ACTION_CHG_10 */ Player_ActionChange_10, + /* PLAYER_ACTION_CHG_11 */ Player_ActionChange_11, + /* PLAYER_ACTION_CHG_12 */ Player_ActionChange_12, + /* PLAYER_ACTION_CHG_13 */ Player_ActionChange_13, }; /** @@ -3640,9 +3775,10 @@ s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeLi s32 i; if (!(this->stateFlags1 & (PLAYER_STATE1_LOADING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_CUTSCENE))) { - if (updateUpperBody != 0) { + if (updateUpperBody) { D_808535E0 = Player_UpdateUpperBody(this, play); - if (func_8084E604 == this->actionFunc) { + + if (Player_Action_8084E604 == this->actionFunc) { return true; } } @@ -3652,15 +3788,18 @@ s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeLi return true; } - if (!(this->stateFlags1 & PLAYER_STATE1_START_PUTAWAY) && (Player_UpperAction_ChangeHeldItem != this->upperActionFunc)) { + if (!(this->stateFlags1 & PLAYER_STATE1_START_PUTAWAY) && + (Player_UpperAction_ChangeHeldItem != this->upperActionFunc)) { + // Process all entries in the Action Change List with a positive index while (*actionChangeList >= 0) { - if (D_80854448[*actionChangeList](this, play)) { + if (sActionChangeFuncs[*actionChangeList](this, play)) { return true; } actionChangeList++; } - if (D_80854448[-(*actionChangeList)](this, play)) { + // Try the last entry in the list. Negate the index to make it positive again. + if (sActionChangeFuncs[-(*actionChangeList)](this, play)) { return true; } } @@ -3670,15 +3809,15 @@ s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeLi } s32 func_808374A0(PlayState* play, Player* this, SkelAnime* skelAnime, f32 arg3) { - f32 sp24; - s16 sp22; + f32 speedTarget; + s16 yawTarget; if ((skelAnime->endFrame - arg3) <= skelAnime->curFrame) { - if (Player_TryActionChangeList(play, this, D_80854418, 1)) { + if (Player_TryActionChangeList(play, this, sActionChangeList7, true)) { return 0; } - if (Player_GetMovementSpeedAndYaw(this, &sp24, &sp22, 0.018f, play)) { + if (Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play)) { return 1; } } @@ -3755,7 +3894,7 @@ void func_80837704(PlayState* play, Player* this) { } void func_808377DC(PlayState* play, Player* this) { - Player_SetupAction(play, this, func_80844E68, 1); + Player_SetupAction(play, this, Player_Action_80844E68, 1); func_80837704(play, this); } @@ -3833,7 +3972,7 @@ void func_80837948(PlayState* play, Player* this, s32 arg2) { u32 dmgFlags; s32 temp; - Player_SetupAction(play, this, func_808502D0, 0); + Player_SetupAction(play, this, Player_Action_808502D0, 0); this->unk_844 = 8; if (!((arg2 >= PLAYER_MWA_FLIPSLASH_FINISH) && (arg2 <= PLAYER_MWA_JUMPSLASH_FINISH))) { func_80832318(this); @@ -3855,7 +3994,7 @@ void func_80837948(PlayState* play, Player* this, s32 arg2) { Player_AnimReplaceApplyFlags(play, this, 0x209); } - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; if (Player_HoldsBrokenKnife(this)) { temp = 1; @@ -3915,9 +4054,9 @@ void func_80837B60(Player* this) { } void func_80837B9C(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_8084411C, 0); + Player_SetupAction(play, this, Player_Action_8084411C, 0); Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait); - this->unk_850 = 1; + this->av2.actionVar2 = 1; if (this->unk_6AD != 3) { this->unk_6AD = 0; } @@ -3952,7 +4091,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, func_80837AE0(this, arg6); if (arg2 == 3) { - Player_SetupAction(play, this, func_8084FB10, 0); + Player_SetupAction(play, this, Player_Action_8084FB10, 0); anim = &gPlayerAnim_link_normal_ice_down; @@ -3962,18 +4101,18 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_PlaySfx(this, NA_SE_PL_FREEZE_S); func_80832698(this, NA_SE_VO_LI_FREEZE); } else if (arg2 == 4) { - Player_SetupAction(play, this, func_8084FBF4, 0); + Player_SetupAction(play, this, Player_Action_8084FBF4, 0); Player_RequestRumble(this, 255, 80, 150, 0); Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_electric_shock); func_80832224(this); - this->unk_850 = 20; + this->av2.actionVar2 = 20; } else { arg5 -= this->actor.shape.rot.y; if (this->stateFlags1 & PLAYER_STATE1_IN_WATER) { - Player_SetupAction(play, this, func_8084E30C, 0); + Player_SetupAction(play, this, Player_Action_8084E30C, 0); Player_RequestRumble(this, 180, 20, 50, 0); this->linearVelocity = 4.0f; @@ -3984,7 +4123,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } else if ((arg2 == 1) || (arg2 == 2) || !(this->actor.bgCheckFlags & 1) || (this->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_CLIMBING_LADDER))) { - Player_SetupAction(play, this, func_8084377C, 0); + Player_SetupAction(play, this, Player_Action_8084377C, 0); this->stateFlags3 |= PLAYER_STATE3_MIDAIR; @@ -3992,7 +4131,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, func_80832224(this); if (arg2 == 2) { - this->unk_850 = 4; + this->av2.actionVar2 = 4; this->actor.speedXZ = 3.0f; this->linearVelocity = 3.0f; @@ -4030,7 +4169,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, sp28 = D_808544B0; - Player_SetupAction(play, this, func_8084370C, 0); + Player_SetupAction(play, this, Player_Action_8084370C, 0); func_80833C3C(this); if (this->actor.colChkInfo.damage < 5) { @@ -4055,7 +4194,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, } this->actor.shape.rot.y += arg5; - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y; if (ABS(arg5) > 0x4000) { this->actor.shape.rot.y += 0x8000; @@ -4087,8 +4226,8 @@ s32 func_8083816C(s32 arg0) { void func_8083819C(Player* this, PlayState* play) { if (this->currentShield == PLAYER_SHIELD_DEKU && (CVarGetInteger("gFireproofDekuShield", 0) == 0)) { - Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_SHIELD, this->actor.world.pos.x, - this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 1, true); + Actor_Spawn(&play->actorCtx, play, ACTOR_ITEM_SHIELD, this->actor.world.pos.x, this->actor.world.pos.y, + this->actor.world.pos.z, 0, 0, 0, 1, true); Inventory_DeleteEquipment(play, EQUIP_TYPE_SHIELD); Message_StartTextbox(play, 0x305F, NULL); } @@ -4098,10 +4237,10 @@ void func_8083821C(Player* this) { s32 i; // clang-format off - for (i = 0; i < PLAYER_BODYPART_MAX; i++) { this->flameTimers[i] = Rand_S16Offset(0, 200); } + for (i = 0; i < PLAYER_BODYPART_MAX; i++) { this->bodyFlameTimers[i] = Rand_S16Offset(0, 200); } // clang-format on - this->isBurning = true; + this->bodyIsBurning = true; } void func_80838280(Player* this) { @@ -4168,7 +4307,7 @@ s32 func_808382DC(Player* this, PlayState* play) { func_80838280(this); if (this->unk_8A1 == 3) { - this->shockTimer = 40; + this->bodyShockTimer = 40; } this->actor.colChkInfo.damage += this->unk_8A0; @@ -4188,13 +4327,13 @@ s32 func_808382DC(Player* this, PlayState* play) { if (!Player_IsChildWithHylianShield(this)) { if (this->invincibilityTimer >= 0) { LinkAnimationHeader* anim; - s32 sp54 = func_80843188 == this->actionFunc; + s32 sp54 = Player_Action_80843188 == this->actionFunc; if (!func_808332B8(this)) { - Player_SetupAction(play, this, func_808435C4, 0); + Player_SetupAction(play, this, Player_Action_808435C4, 0); } - if (!(this->unk_84F = sp54)) { + if (!(this->av1.actionVar1 = sp54)) { Player_SetUpperActionFunc(this, func_80834BD4); if (this->unk_870 < 0.5f) { @@ -4217,7 +4356,7 @@ s32 func_808382DC(Player* this, PlayState* play) { if (!(this->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_CLIMBING_LADDER))) { this->linearVelocity = -18.0f; - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } } @@ -4239,7 +4378,7 @@ s32 func_808382DC(Player* this, PlayState* play) { s32 sp4C; if (ac->flags & ACTOR_FLAG_PLAY_HIT_SFX) { - Player_PlaySfx(&this->actor, NA_SE_PL_BODY_HIT); + Player_PlaySfx(this, NA_SE_PL_BODY_HIT); } if (this->stateFlags1 & PLAYER_STATE1_IN_WATER) { @@ -4266,10 +4405,10 @@ s32 func_808382DC(Player* this, PlayState* play) { SurfaceType_IsWallDamage(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId)) || ((sp48 >= 0) && SurfaceType_IsWallDamage(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) && - (this->unk_A79 >= D_808544F4[sp48])) || + (this->floorTypeTimer >= D_808544F4[sp48])) || ((sp48 >= 0) && ((this->currentTunic != PLAYER_TUNIC_GORON && CVarGetInteger("gSuperTunic", 0) == 0) || - (this->unk_A79 >= D_808544F4[sp48])))) { - this->unk_A79 = 0; + (this->floorTypeTimer >= D_808544F4[sp48])))) { + this->floorTypeTimer = 0; this->actor.colChkInfo.damage = 4; func_80837C0C(play, this, 0, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } else { @@ -4283,7 +4422,7 @@ s32 func_808382DC(Player* this, PlayState* play) { } void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* play, u16 sfxId) { - Player_SetupAction(play, this, func_8084411C, 1); + Player_SetupAction(play, this, Player_Action_8084411C, 1); if (anim != NULL) { Player_AnimPlayOnceAdjusted(play, this, anim); @@ -4303,7 +4442,7 @@ void func_808389E8(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* func_80838940(this, anim, arg2, play, NA_SE_VO_LI_SWORD_N); } -s32 func_80838A14(Player* this, PlayState* play) { +s32 Player_ActionChange_12(Player* this, PlayState* play) { s32 sp3C; LinkAnimationHeader* anim; f32 sp34; @@ -4312,16 +4451,16 @@ s32 func_80838A14(Player* this, PlayState* play) { f32 wallPolyNormalZ; f32 sp24; - if (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (this->unk_88C >= 2) && + if (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (this->ledgeClimbType >= 2) && (!(this->stateFlags1 & PLAYER_STATE1_IN_WATER) || (this->ageProperties->unk_14 > this->yDistToLedge))) { sp3C = 0; if (func_808332B8(this)) { if (this->actor.yDistToWater < 50.0f) { - if ((this->unk_88C < 2) || (this->yDistToLedge > this->ageProperties->unk_10)) { + if ((this->ledgeClimbType < 2) || (this->yDistToLedge > this->ageProperties->unk_10)) { return 0; } - } else if ((this->currentBoots != PLAYER_BOOTS_IRON) || (this->unk_88C > 2)) { + } else if ((this->currentBoots != PLAYER_BOOTS_IRON) || (this->ledgeClimbType > 2)) { return 0; } } else if (!(this->actor.bgCheckFlags & 1) || @@ -4330,18 +4469,18 @@ s32 func_80838A14(Player* this, PlayState* play) { } if ((this->actor.wallBgId != BGCHECK_SCENE) && (sTouchedWallFlags & 0x40)) { - if (this->unk_88D >= 6) { + if (this->ledgeClimbDelayTimer >= 6) { this->stateFlags2 |= PLAYER_STATE2_DO_ACTION_CLIMB; if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { sp3C = 1; } } - } else if ((this->unk_88D >= 6) || CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { + } else if ((this->ledgeClimbDelayTimer >= 6) || CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { sp3C = 1; } if (sp3C != 0) { - Player_SetupAction(play, this, func_80845668, 0); + Player_SetupAction(play, this, Player_Action_80845668, 0); this->stateFlags1 |= PLAYER_STATE1_JUMPING; @@ -4383,11 +4522,11 @@ s32 func_80838A14(Player* this, PlayState* play) { LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 1.3f); AnimationContext_DisableQueue(play); - this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; + this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; return 1; } - } else if ((this->actor.bgCheckFlags & 1) && (this->unk_88C == 1) && (this->unk_88D >= 3)) { + } else if ((this->actor.bgCheckFlags & 1) && (this->ledgeClimbType == 1) && (this->ledgeClimbDelayTimer >= 3)) { temp = (this->yDistToLedge * 0.08f) + 5.5f; func_808389E8(this, &gPlayerAnim_link_normal_jump, temp, play); this->linearVelocity = 2.5f; @@ -4399,11 +4538,11 @@ s32 func_80838A14(Player* this, PlayState* play) { } void func_80838E70(PlayState* play, Player* this, f32 arg2, s16 arg3) { - Player_SetupAction(play, this, func_80845CA4, 0); + Player_SetupAction(play, this, Player_Action_80845CA4, 0); func_80832440(play, this); - this->unk_84F = 1; - this->unk_850 = 1; + this->av1.actionVar1 = 1; + this->av2.actionVar2 = 1; this->unk_450.x = (Math_SinS(arg3) * arg2) + this->actor.world.pos.x; this->unk_450.z = (Math_CosS(arg3) * arg2) + this->actor.world.pos.z; @@ -4412,12 +4551,12 @@ void func_80838E70(PlayState* play, Player* this, f32 arg2, s16 arg3) { } void func_80838F18(PlayState* play, Player* this) { - Player_SetupAction(play, this, func_8084D610, 0); + Player_SetupAction(play, this, Player_Action_8084D610, 0); Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } void func_80838F5C(PlayState* play, Player* this) { - Player_SetupAction(play, this, func_8084F88C, 0); + Player_SetupAction(play, this, Player_Action_8084F88C, 0); this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE | PLAYER_STATE1_FLOOR_DISABLED; @@ -4490,19 +4629,19 @@ u8 sReturnEntranceGroupIndices[] = { }; s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* poly, u32 bgId) { - s32 sp3C; + s32 exitIndex; s32 temp; s32 sp34; - f32 linearVel; + f32 speedXZ; s32 yaw; if (this->actor.category == ACTORCAT_PLAYER) { - sp3C = 0; + exitIndex = 0; if (!(this->stateFlags1 & PLAYER_STATE1_DEAD) && (play->transitionTrigger == TRANS_TRIGGER_OFF) && (this->csAction == 0) && !(this->stateFlags1 & PLAYER_STATE1_LOADING) && - (((poly != NULL) && (sp3C = SurfaceType_GetSceneExitIndex(&play->colCtx, poly, bgId), sp3C != 0)) || - (func_8083816C(sFloorType) && (this->unk_A7A == 12)))) { + (((poly != NULL) && (exitIndex = SurfaceType_GetSceneExitIndex(&play->colCtx, poly, bgId), exitIndex != 0)) || + (func_8083816C(sFloorType) && (this->floorProperty == 12)))) { sp34 = this->unk_A84 - (s32)this->actor.world.pos.y; @@ -4511,11 +4650,11 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol return 0; } - if (sp3C == 0) { + if (exitIndex == 0) { Play_TriggerVoidOut(play); Scene_SetTransitionForNextEntrance(play); } else { - play->nextEntranceIndex = play->setupExitList[sp3C - 1]; + play->nextEntranceIndex = play->setupExitList[exitIndex - 1]; // Main override for entrance rando and entrance skips if (IS_RANDO) { @@ -4562,17 +4701,17 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol gSaveContext.seqId = (u8)NA_BGM_DISABLED; gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } else { - linearVel = this->linearVelocity; + speedXZ = this->linearVelocity; - if (linearVel < 0.0f) { + if (speedXZ < 0.0f) { this->actor.world.rot.y += 0x8000; - linearVel = -linearVel; + speedXZ = -speedXZ; } - if (linearVel > R_RUN_SPEED_LIMIT / 100.0f) { + if (speedXZ > R_RUN_SPEED_LIMIT / 100.0f) { gSaveContext.entranceSpeed = R_RUN_SPEED_LIMIT / 100.0f; } else { - gSaveContext.entranceSpeed = linearVel; + gSaveContext.entranceSpeed = speedXZ; } if (sConveyorSpeed != 0) { @@ -4597,13 +4736,13 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol if (play->transitionTrigger == TRANS_TRIGGER_OFF) { if ((this->actor.world.pos.y < -4000.0f) || - (((this->unk_A7A == 5) || (this->unk_A7A == 12)) && + (((this->floorProperty == 5) || (this->floorProperty == 12)) && ((sYDistToFloor < 100.0f) || (this->fallDistance > 400.0f) || ((play->sceneNum != SCENE_SHADOW_TEMPLE) && (this->fallDistance > 200.0f)))) || ((play->sceneNum == SCENE_GANONS_TOWER_COLLAPSE_EXTERIOR) && (this->fallDistance > 320.0f))) { if (this->actor.bgCheckFlags & 1) { - if (this->unk_A7A == 5) { + if (this->floorProperty == 5) { Play_TriggerRespawn(play); } else { Play_TriggerVoidOut(play); @@ -4612,11 +4751,11 @@ s32 Player_HandleExitsAndVoids(PlayState* play, Player* this, CollisionPoly* pol func_80078884(NA_SE_OC_ABYSS); } else { func_80838F5C(play, this); - this->unk_850 = 9999; - if (this->unk_A7A == 5) { - this->unk_84F = -1; + this->av2.actionVar2 = 9999; + if (this->floorProperty == 5) { + this->av1.actionVar1 = -1; } else { - this->unk_84F = 1; + this->av1.actionVar1 = 1; } } } @@ -4671,7 +4810,8 @@ f32 func_8083973C(PlayState* play, Player* this, Vec3f* arg2, Vec3f* arg3) { * Point B of the line is at player's world position offset by the entire `offset` vector. * Point A and B are always at the same height, meaning this is a horizontal line test. */ -s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, CollisionPoly** wallPoly, s32* bgId, Vec3f* posResult) { +s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, CollisionPoly** wallPoly, s32* bgId, + Vec3f* posResult) { Vec3f posA; Vec3f posB; @@ -4684,7 +4824,7 @@ s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, Colli return BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, posResult, wallPoly, true, false, false, true, bgId); } -s32 func_80839800(Player* this, PlayState* play) { +s32 Player_ActionChange_1(Player* this, PlayState* play) { DoorShutter* doorShutter; EnDoor* door; // Can also be DoorKiller* s32 doorDirection; @@ -4696,14 +4836,14 @@ s32 func_80839800(Player* this, PlayState* play) { s32 frontRoom; Actor* attachedActor; LinkAnimationHeader* sp5C; - CollisionPoly* sp58; - Vec3f sp4C; + CollisionPoly* groundPoly; + Vec3f checkPos; if ((this->doorType != PLAYER_DOORTYPE_NONE) && (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) || ((this->heldActor != NULL) && (this->heldActor->id == ACTOR_EN_RU1)))) { // Disable doors in Boss Rush so the player can't leave the boss rooms backwards. - if ((CHECK_BTN_ALL(sControlInput->press.button, BTN_A) || (func_8084F9A0 == this->actionFunc)) && !IS_BOSS_RUSH) { + if ((CHECK_BTN_ALL(sControlInput->press.button, BTN_A) || (Player_Action_8084F9A0 == this->actionFunc)) && !IS_BOSS_RUSH) { doorActor = this->doorActor; if (this->doorType <= PLAYER_DOORTYPE_AJAR) { @@ -4719,11 +4859,11 @@ s32 func_80839800(Player* this, PlayState* play) { if (this->doorType == PLAYER_DOORTYPE_SLIDING) { doorShutter = (DoorShutter*)doorActor; - this->currentYaw = doorShutter->dyna.actor.home.rot.y; + this->yaw = doorShutter->dyna.actor.home.rot.y; if (doorDirection > 0) { - this->currentYaw -= 0x8000; + this->yaw -= 0x8000; } - this->actor.shape.rot.y = this->currentYaw; + this->actor.shape.rot.y = this->yaw; if (this->linearVelocity <= 0.0f) { this->linearVelocity = 0.1f; @@ -4731,7 +4871,7 @@ s32 func_80839800(Player* this, PlayState* play) { func_80838E70(play, this, 50.0f, this->actor.shape.rot.y); - this->unk_84F = 0; + this->av1.actionVar1 = 0; this->unk_447 = this->doorType; this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; @@ -4744,7 +4884,7 @@ s32 func_80839800(Player* this, PlayState* play) { func_80832224(this); if (this->doorTimer != 0) { - this->unk_850 = 0; + this->av2.actionVar2 = 0; Player_AnimChangeOnceMorph(play, this, func_80833338(this)); this->skelAnime.endFrame = 0.0f; } else { @@ -4777,7 +4917,7 @@ s32 func_80839800(Player* this, PlayState* play) { sp5C = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_doorB, this->modelAnimType); } - Player_SetupAction(play, this, func_80845EF8, 0); + Player_SetupAction(play, this, Player_Action_80845EF8, 0); func_80832528(play, this); if (doorDirection < 0) { @@ -4786,7 +4926,7 @@ s32 func_80839800(Player* this, PlayState* play) { this->actor.shape.rot.y = doorActor->shape.rot.y - 0x8000; } - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; sp6C = (doorDirection * 22.0f); this->actor.world.pos.x = doorActor->world.pos.x + sp6C * sp74; @@ -4812,13 +4952,14 @@ s32 func_80839800(Player* this, PlayState* play) { Actor_DisableLens(play); if (((doorActor->params >> 7) & 7) == 3) { - sp4C.x = doorActor->world.pos.x - (sp6C * sp74); - sp4C.y = doorActor->world.pos.y + 10.0f; - sp4C.z = doorActor->world.pos.z - (sp6C * sp78); + checkPos.x = doorActor->world.pos.x - (sp6C * sp74); + checkPos.y = doorActor->world.pos.y + 10.0f; + checkPos.z = doorActor->world.pos.z - (sp6C * sp78); - BgCheck_EntityRaycastFloor1(&play->colCtx, &sp58, &sp4C); + BgCheck_EntityRaycastFloor1(&play->colCtx, &groundPoly, &checkPos); - if (Player_HandleExitsAndVoids(play, this, sp58, BGCHECK_SCENE)) { + //! @bug groundPoly's bgId is not guaranteed to be BGCHECK_SCENE + if (Player_HandleExitsAndVoids(play, this, groundPoly, BGCHECK_SCENE)) { gSaveContext.entranceSpeed = 2.0f; gSaveContext.entranceSound = NA_SE_OC_DOOR_OPEN; } @@ -4858,7 +4999,7 @@ s32 func_80839800(Player* this, PlayState* play) { void func_80839E88(Player* this, PlayState* play) { LinkAnimationHeader* anim; - Player_SetupAction(play, this, func_80840450, 1); + Player_SetupAction(play, this, Player_Action_80840450, 1); if (this->unk_870 < 0.5f) { anim = func_808334E4(this); @@ -4870,13 +5011,13 @@ void func_80839E88(Player* this, PlayState* play) { this->unk_874 = this->unk_870; Player_AnimPlayLoop(play, this, anim); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_80839F30(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_808407CC, 1); + Player_SetupAction(play, this, Player_Action_808407CC, 1); Player_AnimChangeOnceMorph(play, this, func_80833338(this)); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_80839F90(Player* this, PlayState* play) { @@ -4893,11 +5034,11 @@ void func_80839FFC(Player* this, PlayState* play) { PlayerActionFunc actionFunc; if (func_8008E9C4(this)) { - actionFunc = func_80840450; + actionFunc = Player_Action_80840450; } else if (func_80833B2C(this)) { - actionFunc = func_808407CC; + actionFunc = Player_Action_808407CC; } else { - actionFunc = func_80840BC8; + actionFunc = Player_Action_80840BC8; } Player_SetupAction(play, this, actionFunc, 1); @@ -4906,7 +5047,7 @@ void func_80839FFC(Player* this, PlayState* play) { void func_8083A060(Player* this, PlayState* play) { func_80839FFC(this, play); if (func_8008E9C4(this)) { - this->unk_850 = 1; + this->av2.actionVar2 = 1; } } @@ -4926,30 +5067,30 @@ void func_8083A0F4(PlayState* play, Player* this) { if (interactActorId == ACTOR_BG_TOKI_SWD) { this->interactRangeActor->parent = &this->actor; - Player_SetupAction(play, this, func_8084F608, 0); + Player_SetupAction(play, this, Player_Action_8084F608, 0); this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; sMaskMemory = PLAYER_MASK_NONE; } else { LinkAnimationHeader* anim; if (interactActorId == ACTOR_BG_HEAVY_BLOCK) { - Player_SetupAction(play, this, func_80846120, 0); + Player_SetupAction(play, this, Player_Action_80846120, 0); this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; anim = &gPlayerAnim_link_normal_heavy_carry; } else if ((interactActorId == ACTOR_EN_ISHI) && ((interactRangeActor->params & 0xF) == 1)) { - Player_SetupAction(play, this, func_80846260, 0); + Player_SetupAction(play, this, Player_Action_80846260, 0); anim = &gPlayerAnim_link_silver_carry; } else if (((interactActorId == ACTOR_EN_BOMBF) || (interactActorId == ACTOR_EN_KUSA)) && (Player_GetStrength() <= PLAYER_STR_NONE)) { - Player_SetupAction(play, this, func_80846408, 0); + Player_SetupAction(play, this, Player_Action_80846408, 0); this->actor.world.pos.x = (Math_SinS(interactRangeActor->yawTowardsPlayer) * 20.0f) + interactRangeActor->world.pos.x; this->actor.world.pos.z = (Math_CosS(interactRangeActor->yawTowardsPlayer) * 20.0f) + interactRangeActor->world.pos.z; - this->currentYaw = this->actor.shape.rot.y = interactRangeActor->yawTowardsPlayer + 0x8000; + this->yaw = this->actor.shape.rot.y = interactRangeActor->yawTowardsPlayer + 0x8000; anim = &gPlayerAnim_link_normal_nocarry_free; } else { - Player_SetupAction(play, this, func_80846050, 0); + Player_SetupAction(play, this, Player_Action_80846050, 0); anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_carryB, this->modelAnimType); } @@ -4968,7 +5109,7 @@ void func_8083A0F4(PlayState* play, Player* this) { } void func_8083A2F8(PlayState* play, Player* this) { - func_80835DAC(play, this, func_8084B530, 0); + func_80835DAC(play, this, Player_Action_8084B530, 0); this->stateFlags1 |= PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_IN_CUTSCENE; @@ -4979,37 +5120,37 @@ void func_8083A2F8(PlayState* play, Player* this) { } void func_8083A360(PlayState* play, Player* this) { - func_80835DAC(play, this, func_8084CC98, 0); + func_80835DAC(play, this, Player_Action_8084CC98, 0); } void func_8083A388(PlayState* play, Player* this) { - Player_SetupAction(play, this, func_8084B78C, 0); + Player_SetupAction(play, this, Player_Action_8084B78C, 0); } void func_8083A3B0(PlayState* play, Player* this) { - s32 sp1C = this->unk_850; - s32 sp18 = this->unk_84F; + s32 sp1C = this->av2.actionVar2; + s32 sp18 = this->av1.actionVar1; - func_80835DAC(play, this, func_8084BF1C, 0); + func_80835DAC(play, this, Player_Action_8084BF1C, 0); this->actor.velocity.y = 0.0f; - this->unk_850 = sp1C; - this->unk_84F = sp18; + this->av2.actionVar2 = sp1C; + this->av1.actionVar1 = sp18; } void func_8083A40C(PlayState* play, Player* this) { - func_80835DAC(play, this, func_8084C760, 0); + func_80835DAC(play, this, Player_Action_8084C760, 0); } void func_8083A434(PlayState* play, Player* this) { - func_80835DAC(play, this, func_8084E6D4, 0); + func_80835DAC(play, this, Player_Action_8084E6D4, 0); this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_IN_CUTSCENE; if (this->getItemId == GI_HEART_CONTAINER_2) { - this->unk_850 = 20; + this->av2.actionVar2 = 20; } else if (this->getItemId >= 0 || (this->getItemEntry.objectId != OBJECT_INVALID && this->getItemEntry.getItemId >= 0)) { - this->unk_850 = 1; + this->av2.actionVar2 = 1; } else { this->getItemId = -this->getItemId; this->getItemEntry.getItemId = -this->getItemEntry.getItemId; @@ -5021,7 +5162,7 @@ s32 func_8083A4A8(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 temp; - yawDiff = this->currentYaw - this->actor.shape.rot.y; + yawDiff = this->yaw - this->actor.shape.rot.y; if ((ABS(yawDiff) < 0x1000) && (this->linearVelocity > 4.0f)) { anim = &gPlayerAnim_link_normal_run_jump; @@ -5036,7 +5177,7 @@ s32 func_8083A4A8(Player* this, PlayState* play) { } func_80838940(this, anim, temp, play, NA_SE_VO_LI_AUTO_JUMP); - this->unk_850 = 1; + this->av2.actionVar2 = 1; return 1; } @@ -5045,13 +5186,13 @@ void func_8083A5C4(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3, f32 nx = COLPOLY_GET_NORMAL(arg2->normal.x); f32 nz = COLPOLY_GET_NORMAL(arg2->normal.z); - Player_SetupAction(play, this, func_8084BBE4, 0); + Player_SetupAction(play, this, Player_Action_8084BBE4, 0); func_80832564(play, this); Player_AnimPlayOnce(play, this, anim); this->actor.world.pos.x -= (arg3 + 1.0f) * nx; this->actor.world.pos.z -= (arg3 + 1.0f) * nz; - this->actor.shape.rot.y = this->currentYaw = Math_Atan2S(nz, nx); + this->actor.shape.rot.y = this->yaw = Math_Atan2S(nz, nx); func_80832224(this); Player_SkelAnimeResetPrevTranslRot(this); @@ -5104,20 +5245,20 @@ s32 func_8083A6AC(Player* this, PlayState* play) { if (sp50) { func_80836898(play, this, func_8083A3B0); - this->currentYaw += 0x8000; - this->actor.shape.rot.y = this->currentYaw; + this->yaw += 0x8000; + this->actor.shape.rot.y = this->yaw; this->stateFlags1 |= PLAYER_STATE1_CLIMBING_LADDER; Player_AnimReplaceApplyFlags(play, this, 0x9F); - this->unk_850 = -1; - this->unk_84F = sp50; + this->av2.actionVar2 = -1; + this->av1.actionVar1 = sp50; } else { this->stateFlags1 |= PLAYER_STATE1_HANGING_OFF_LEDGE; this->stateFlags1 &= ~PLAYER_STATE1_TARGET_NOTHING; } - Player_PlaySfx(&this->actor, NA_SE_PL_SLIPDOWN); + Player_PlaySfx(this, NA_SE_PL_SLIPDOWN); func_80832698(this, NA_SE_VO_LI_HANG); return 1; } @@ -5127,7 +5268,7 @@ s32 func_8083A6AC(Player* this, PlayState* play) { } void func_8083A9B8(Player* this, LinkAnimationHeader* anim, PlayState* play) { - Player_SetupAction(play, this, func_8084BDFC, 0); + Player_SetupAction(play, this, Player_Action_8084BDFC, 0); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, 1.3f); } @@ -5153,7 +5294,7 @@ void func_8083AA10(Player* this, PlayState* play) { } if (!(this->stateFlags3 & PLAYER_STATE3_MIDAIR) && !(this->skelAnime.moveFlags & 0x80) && - (func_8084411C != this->actionFunc) && (func_80844A44 != this->actionFunc)) { + (Player_Action_8084411C != this->actionFunc) && (Player_Action_80844A44 != this->actionFunc)) { if ((sPrevFloorProperty == 7) || (this->meleeWeaponState != 0)) { Math_Vec3f_Copy(&this->actor.world.pos, &this->actor.prevPos); @@ -5167,12 +5308,12 @@ void func_8083AA10(Player* this, PlayState* play) { return; } - sp5C = (s16)(this->currentYaw - this->actor.shape.rot.y); + sp5C = (s16)(this->yaw - this->actor.shape.rot.y); - Player_SetupAction(play, this, func_8084411C, 1); + Player_SetupAction(play, this, Player_Action_8084411C, 1); func_80832440(play, this); - this->floorSfxOffset = this->unk_A82; + this->floorSfxOffset = this->prevFloorSfxOffset; if ((this->actor.bgCheckFlags & 4) && !(this->stateFlags1 & PLAYER_STATE1_IN_WATER) && (sPrevFloorProperty != 6) && (sPrevFloorProperty != 9) && (sYDistToFloor > 20.0f) && (this->meleeWeaponState == 0) && (ABS(sp5C) < 0x2000) && @@ -5186,7 +5327,7 @@ void func_8083AA10(Player* this, PlayState* play) { if (WaterBox_GetSurface1(play, &play->colCtx, sp44.x, sp44.z, &sp3C, &sp50) && ((sp3C - sp40) > 50.0f)) { func_808389E8(this, &gPlayerAnim_link_normal_run_jump_water_fall, 6.0f, play); - Player_SetupAction(play, this, func_80844A44, 0); + Player_SetupAction(play, this, Player_Action_80844A44, 0); return; } } @@ -5238,7 +5379,7 @@ s32 Player_StartCsAction(PlayState* play, Player* this) { // unk_6AD will get set to 3 in `Player_UpdateCommon` if `this->csAction` is non-zero // (with a special case for `PLAYER_CSACTION_7`) if (this->unk_6AD == 3) { - Player_SetupAction(play, this, func_80852E14, 0); + Player_SetupAction(play, this, Player_Action_CsAction, 0); if (this->doorBgCamIndex != 0) { this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; } @@ -5269,9 +5410,9 @@ void func_8083AE40(Player* this, s16 objectId) { } void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) { - func_80835DE4(play, this, func_808507F4, 0); + func_80835DE4(play, this, Player_Action_808507F4, 0); - this->unk_84F = magicSpell - 3; + this->av1.actionVar1 = magicSpell - 3; //! @bug `MAGIC_CONSUME_WAIT_PREVIEW` is not guaranteed to succeed. //! Ideally, the return value of `Magic_RequestChange` should be checked before allowing the process of @@ -5319,7 +5460,7 @@ static LinkAnimationHeader* D_80854548[] = { &gPlayerAnim_link_normal_take_out, }; -s32 func_8083B040(Player* this, PlayState* play) { +s32 Player_ActionChange_13(Player* this, PlayState* play) { s32 sp2C; s32 sp28; GetItemEntry giEntry; @@ -5335,7 +5476,7 @@ s32 func_8083B040(Player* this, PlayState* play) { if ((sp2C != 3) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) { func_8083AF44(play, this, sp2C); } else { - Player_SetupAction(play, this, func_8085063C, 1); + Player_SetupAction(play, this, Player_Action_8085063C, 1); this->stateFlags1 |= PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE; Player_AnimPlayOnce(play, this, func_80833338(this)); func_80835EA4(play, 4); @@ -5355,7 +5496,7 @@ s32 func_8083B040(Player* this, PlayState* play) { (this->exchangeItemId == EXCH_ITEM_BLUE_FIRE))))))) { if ((play->actorCtx.titleCtx.delayTimer == 0) && (play->actorCtx.titleCtx.alpha == 0)) { - func_80835DE4(play, this, func_8084F104, 0); + func_80835DE4(play, this, Player_Action_8084F104, 0); if (sp2C >= 0) { if (this->getItemEntry.objectId == OBJECT_INVALID) { @@ -5385,19 +5526,19 @@ s32 func_8083B040(Player* this, PlayState* play) { ((this->exchangeItemId != EXCH_ITEM_BEAN) || (this->itemAction == PLAYER_IA_MAGIC_BEAN))) { if (this->exchangeItemId == EXCH_ITEM_BEAN) { Inventory_ChangeAmmo(ITEM_BEAN, -1); - func_80835DE4(play, this, func_8084279C, 0); + func_80835DE4(play, this, Player_Action_8084279C, 0); this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; - this->unk_850 = 0x50; - this->unk_84F = -1; + this->av2.actionVar2 = 0x50; + this->av1.actionVar1 = -1; } targetActor->flags |= ACTOR_FLAG_PLAYER_TALKED_TO; this->unk_664 = this->targetActor; } else if (sp2C == EXCH_ITEM_LETTER_RUTO) { - this->unk_84F = 1; + this->av1.actionVar1 = 1; this->actor.textId = 0x4005; func_80835EA4(play, 1); } else { - this->unk_84F = 2; + this->av1.actionVar1 = 2; this->actor.textId = 0xCF; func_80835EA4(play, 4); } @@ -5405,10 +5546,10 @@ s32 func_8083B040(Player* this, PlayState* play) { this->actor.flags |= ACTOR_FLAG_PLAYER_TALKED_TO; this->exchangeItemId = sp2C; - if (this->unk_84F < 0) { + if (this->av1.actionVar1 < 0) { Player_AnimChangeOnceMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check, this->modelAnimType)); } else { - Player_AnimPlayOnce(play, this, D_80854548[this->unk_84F]); + Player_AnimPlayOnce(play, this, D_80854548[this->av1.actionVar1]); } func_80832224(this); @@ -5419,20 +5560,20 @@ s32 func_8083B040(Player* this, PlayState* play) { sp2C = Player_ActionToBottle(this, this->itemAction); if (sp2C >= 0) { if (sp2C == 0xC) { - func_80835DE4(play, this, func_8084EED8, 0); + func_80835DE4(play, this, Player_Action_8084EED8, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_bug_out); func_80835EA4(play, 3); } else if ((sp2C > 0) && (sp2C < 4)) { - func_80835DE4(play, this, func_8084EFC0, 0); + func_80835DE4(play, this, Player_Action_8084EFC0, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_fish_out); func_80835EA4(play, (sp2C == 1) ? 1 : 5); } else { - func_80835DE4(play, this, func_8084EAC0, 0); + func_80835DE4(play, this, Player_Action_8084EAC0, 0); Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_start); func_80835EA4(play, 2); } } else { - func_80835DE4(play, this, func_8084E3C4, 0); + func_80835DE4(play, this, Player_Action_8084E3C4, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_okarina_start); this->stateFlags2 |= PLAYER_STATE2_OCARINA_PLAYING; func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); @@ -5443,8 +5584,8 @@ s32 func_8083B040(Player* this, PlayState* play) { } } else if (func_8083AD4C(play, this)) { if (!(this->stateFlags1 & PLAYER_STATE1_ON_HORSE)) { - Player_SetupAction(play, this, func_8084B1D8, 1); - this->unk_850 = 13; + Player_SetupAction(play, this, Player_Action_8084B1D8, 1); + this->av2.actionVar2 = 13; func_8083B010(this); } this->stateFlags1 |= PLAYER_STATE1_FIRST_PERSON; @@ -5467,14 +5608,15 @@ s32 func_8083B040(Player* this, PlayState* play) { return 0; } -s32 func_8083B644(Player* this, PlayState* play) { +s32 Player_ActionChange_4(Player* this, PlayState* play) { Actor* sp34 = this->targetActor; Actor* sp30 = this->unk_664; Actor* sp2C = NULL; s32 sp28 = 0; s32 sp24; - sp24 = (sp30 != NULL) && (CHECK_FLAG_ALL(sp30->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_NAVI_HAS_INFO) || (sp30->naviEnemyId != 0xFF)); + sp24 = (sp30 != NULL) && + (CHECK_FLAG_ALL(sp30->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_NAVI_HAS_INFO) || (sp30->naviEnemyId != 0xFF)); if (sp24 || (this->naviTextId != 0)) { sp28 = (this->naviTextId < 0) && ((ABS(this->naviTextId) & 0xFF00) != 0x200); @@ -5511,8 +5653,7 @@ s32 func_8083B644(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_NAVI_ALERT; } - if (!CHECK_BTN_ALL(sControlInput->press.button, CVarGetInteger("gNaviOnL", 0) ? BTN_L : BTN_CUP) && - !sp28) { + if (!CHECK_BTN_ALL(sControlInput->press.button, CVarGetInteger("gNaviOnL", 0) ? BTN_L : BTN_CUP) && !sp28) { return 0; } @@ -5520,11 +5661,7 @@ s32 func_8083B644(Player* this, PlayState* play) { this->targetActor = NULL; if (sp28 || !sp24) { - if (this->naviTextId >= 0) { - sp2C->textId = this->naviTextId; - } else { - sp2C->textId = -this->naviTextId; - } + sp2C->textId = ABS(this->naviTextId); } else { if (sp2C->naviEnemyId != 0xFF) { sp2C->textId = sp2C->naviEnemyId + 0x600; @@ -5556,18 +5693,18 @@ s32 func_8083B8F4(Player* this, PlayState* play) { return 0; } -s32 func_8083B998(Player* this, PlayState* play) { +s32 Player_ActionChange_0(Player* this, PlayState* play) { if (this->unk_6AD != 0) { - func_8083B040(this, play); + Player_ActionChange_13(this, play); return 1; } - if ((this->unk_664 != NULL) && - (CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_NAVI_HAS_INFO) || (this->unk_664->naviEnemyId != 0xFF))) { + if ((this->unk_664 != NULL) && (CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_NAVI_HAS_INFO) || + (this->unk_664->naviEnemyId != 0xFF))) { this->stateFlags2 |= PLAYER_STATE2_NAVI_ALERT; - } else if ((this->naviTextId == 0 || CVarGetInteger("gNaviOnL", 0)) && !func_8008E9C4(this) && - CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && (YREG(15) != 0x10) && (YREG(15) != 0x20) && - !func_8083B8F4(this, play)) { + } else if ((this->naviTextId == 0 || CVarGetInteger("gNaviOnL", 0)) && !func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && + (YREG(15) != 0x10) && + (YREG(15) != 0x20) && !func_8083B8F4(this, play)) { func_80078884(NA_SE_SY_ERROR); } @@ -5576,11 +5713,11 @@ s32 func_8083B998(Player* this, PlayState* play) { void func_8083BA90(PlayState* play, Player* this, s32 arg2, f32 xzVelocity, f32 yVelocity) { func_80837948(play, this, arg2); - Player_SetupAction(play, this, func_80844AF4, 0); + Player_SetupAction(play, this, Player_Action_80844AF4, 0); this->stateFlags3 |= PLAYER_STATE3_MIDAIR; - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; this->linearVelocity = xzVelocity; this->actor.velocity.y = yVelocity; @@ -5612,8 +5749,9 @@ s32 func_8083BBA0(Player* this, PlayState* play) { } void func_8083BC04(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_80844708, 0); - LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_landing_roll, this->modelAnimType), + Player_SetupAction(play, this, Player_Action_80844708, 0); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, + GET_PLAYER_ANIM(PLAYER_ANIMGROUP_landing_roll, this->modelAnimType), 1.25f * D_808535E8); gSaveContext.sohStats.count[COUNT_ROLLS]++; } @@ -5632,18 +5770,18 @@ void func_8083BCD0(Player* this, PlayState* play, s32 arg2) { if (arg2) {} - this->unk_850 = 1; - this->unk_84F = arg2; + this->av2.actionVar2 = 1; + this->av1.actionVar1 = arg2; - this->currentYaw = this->actor.shape.rot.y + (arg2 << 0xE); + this->yaw = this->actor.shape.rot.y + (arg2 << 0xE); this->linearVelocity = !(arg2 & 1) ? 6.0f : 8.5f; this->stateFlags2 |= PLAYER_STATE2_HOPPING; - Player_PlaySfx(&this->actor, ((arg2 << 0xE) == 0x8000) ? NA_SE_PL_ROLL : NA_SE_PL_SKIP); + Player_PlaySfx(this, ((arg2 << 0xE) == 0x8000) ? NA_SE_PL_ROLL : NA_SE_PL_SKIP); } -s32 func_8083BDBC(Player* this, PlayState* play) { +s32 Player_ActionChange_10(Player* this, PlayState* play) { s32 sp2C; if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && @@ -5660,7 +5798,7 @@ s32 func_8083BDBC(Player* this, PlayState* play) { func_8083BC04(this, play); } } else { - if (Player_GetMeleeWeaponHeld(this) && Player_CanUpdateItems(this)) { + if ((Player_GetMeleeWeaponHeld(this) != 0) && Player_CanUpdateItems(this)) { func_8083BA90(play, this, PLAYER_MWA_JUMPSLASH_START, 5.0f, 5.0f); } else { func_8083BC04(this, play); @@ -5711,7 +5849,7 @@ void func_8083BF50(Player* this, PlayState* play) { LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, 4.0f * sp30); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_8083C0B8(Player* this, PlayState* play) { @@ -5720,9 +5858,9 @@ void func_8083C0B8(Player* this, PlayState* play) { } void func_8083C0E8(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_80840BC8, 1); + Player_SetupAction(play, this, Player_Action_80840BC8, 1); Player_AnimPlayOnce(play, this, func_80833338(this)); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_8083C148(Player* this, PlayState* play) { @@ -5741,7 +5879,7 @@ void func_8083C148(Player* this, PlayState* play) { this->stateFlags1 &= ~(PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_FIRST_PERSON); } -s32 func_8083C1DC(Player* this, PlayState* play) { +s32 Player_ActionChange_6(Player* this, PlayState* play) { if (!func_80833B54(this) && (D_808535E0 == 0) && !(this->stateFlags1 & PLAYER_STATE1_ON_HORSE) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { if (func_8083BC7C(this, play)) { @@ -5757,7 +5895,7 @@ s32 func_8083C1DC(Player* this, PlayState* play) { return 0; } -s32 func_8083C2B0(Player* this, PlayState* play) { +s32 Player_ActionChange_11(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 frame; @@ -5768,7 +5906,7 @@ s32 func_8083C2B0(Player* this, PlayState* play) { func_80832318(this); Player_DetachHeldActor(play, this); - if (Player_SetupAction(play, this, func_80843188, 0)) { + if (Player_SetupAction(play, this, Player_Action_80843188, 0)) { this->stateFlags1 |= PLAYER_STATE1_SHIELDING; if (!Player_IsChildWithHylianShield(this)) { @@ -5795,7 +5933,7 @@ s32 func_8083C2B0(Player* this, PlayState* play) { Player_AnimReplaceApplyFlags(play, this, 4); } - Player_PlaySfx(&this->actor, NA_SE_IT_SHIELD_POSTURE); + Player_PlaySfx(this, NA_SE_IT_SHIELD_POSTURE); } return 1; @@ -5805,12 +5943,12 @@ s32 func_8083C2B0(Player* this, PlayState* play) { } s32 func_8083C484(Player* this, f32* arg1, s16* arg2) { - s16 yaw = this->currentYaw - *arg2; + s16 yaw = this->yaw - *arg2; if (ABS(yaw) > 0x6000) { if (func_8083721C(this)) { *arg1 = 0.0f; - *arg2 = this->currentYaw; + *arg2 = this->yaw; } else { return 1; } @@ -5825,7 +5963,7 @@ void func_8083C50C(Player* this) { } } -s32 func_8083C544(Player* this, PlayState* play) { +s32 Player_ActionChange_8(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { if (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) && (Player_GetMeleeWeaponHeld(this) != 0) && (this->unk_844 == 1) && (this->heldItemAction != PLAYER_IA_DEKU_STICK)) { @@ -5844,7 +5982,7 @@ s32 func_8083C544(Player* this, PlayState* play) { s32 func_8083C61C(PlayState* play, Player* this) { if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (this->actor.bgCheckFlags & 1) && (AMMO(ITEM_NUT) != 0)) { - Player_SetupAction(play, this, func_8084E604, 0); + Player_SetupAction(play, this, Player_Action_8084E604, 0); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_light_bom); this->unk_6AD = 0; return 1; @@ -5863,15 +6001,15 @@ s32 func_8083C6B8(PlayState* play, Player* this) { if (sUseHeldItem) { if (Player_GetBottleHeld(this) >= 0) { - Player_SetupAction(play, this, func_8084ECA4, 0); + Player_SetupAction(play, this, Player_Action_8084ECA4, 0); if (this->actor.yDistToWater > 12.0f) { - this->unk_850 = 1; + this->av2.actionVar2 = 1; } - Player_AnimPlayOnceAdjusted(play, this, D_80854554[this->unk_850].unk_00); + Player_AnimPlayOnceAdjusted(play, this, D_80854554[this->av2.actionVar2].unk_00); - Player_PlaySfx(&this->actor, NA_SE_IT_SWORD_SWING); + Player_PlaySfx(this, NA_SE_IT_SWORD_SWING); func_80832698(this, NA_SE_VO_LI_AUTO_JUMP); return 1; } @@ -5888,7 +6026,7 @@ s32 func_8083C6B8(PlayState* play, Player* this) { return 0; } - Player_SetupAction(play, this, func_80850C68, 0); + Player_SetupAction(play, this, Player_Action_80850C68, 0); this->unk_860 = 1; Player_ZeroSpeedXZ(this); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_fishing_throw); @@ -5905,9 +6043,9 @@ void func_8083C858(Player* this, PlayState* play) { PlayerActionFunc actionFunc; if (func_80833BCC(this)) { - actionFunc = func_8084227C; + actionFunc = Player_Action_8084227C; } else { - actionFunc = func_80842180; + actionFunc = Player_Action_80842180; } Player_SetupAction(play, this, actionFunc, 1); @@ -5918,7 +6056,7 @@ void func_8083C858(Player* this, PlayState* play) { } void func_8083C8DC(Player* this, PlayState* play, s16 arg2) { - this->actor.shape.rot.y = this->currentYaw = arg2; + this->actor.shape.rot.y = this->yaw = arg2; func_8083C858(this, play); } @@ -5931,10 +6069,10 @@ s32 func_8083C910(PlayState* play, Player* this, f32 arg2) { &sp2C) != 0) { sp28 -= this->actor.world.pos.y; if (this->ageProperties->unk_24 <= sp28) { - Player_SetupAction(play, this, func_8084D7C4, 0); + Player_SetupAction(play, this, Player_Action_8084D7C4, 0); Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); this->stateFlags1 |= PLAYER_STATE1_IN_WATER | PLAYER_STATE1_IN_CUTSCENE; - this->unk_850 = 20; + this->av2.actionVar2 = 20; this->linearVelocity = 2.0f; Player_SetBootData(play, this); return 0; @@ -5948,7 +6086,7 @@ s32 func_8083C910(PlayState* play, Player* this, f32 arg2) { void func_8083CA20(PlayState* play, Player* this) { if (func_8083C910(play, this, 180.0f)) { - this->unk_850 = -20; + this->av2.actionVar2 = -20; } } @@ -5956,7 +6094,7 @@ void func_8083CA54(PlayState* play, Player* this) { this->linearVelocity = 2.0f; gSaveContext.entranceSpeed = 2.0f; if (func_8083C910(play, this, 120.0f)) { - this->unk_850 = -15; + this->av2.actionVar2 = -15; } } @@ -5968,47 +6106,47 @@ void func_8083CA9C(PlayState* play, Player* this) { this->linearVelocity = gSaveContext.entranceSpeed; if (func_8083C910(play, this, 800.0f)) { - this->unk_850 = -80 / this->linearVelocity; - if (this->unk_850 < -20) { - this->unk_850 = -20; + this->av2.actionVar2 = -80 / this->linearVelocity; + if (this->av2.actionVar2 < -20) { + this->av2.actionVar2 = -20; } } } void func_8083CB2C(Player* this, s16 yaw, PlayState* play) { - Player_SetupAction(play, this, func_808414F8, 1); + Player_SetupAction(play, this, Player_Action_808414F8, 1); LinkAnimation_CopyJointToMorph(play, &this->skelAnime); this->unk_864 = this->unk_868 = 0.0f; - this->currentYaw = yaw; + this->yaw = yaw; } void func_8083CB94(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_80840DE4, 1); + Player_SetupAction(play, this, Player_Action_80840DE4, 1); Player_AnimChangeLoopMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_walk, this->modelAnimType)); } void func_8083CBF0(Player* this, s16 yaw, PlayState* play) { - Player_SetupAction(play, this, func_808423EC, 1); + Player_SetupAction(play, this, Player_Action_808423EC, 1); LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_anchor_back_walk, 2.2f, 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_anchor_back_walk), ANIMMODE_ONCE, -6.0f); this->linearVelocity = 8.0f; - this->currentYaw = yaw; + this->yaw = yaw; } void func_8083CC9C(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_8084193C, 1); + Player_SetupAction(play, this, Player_Action_8084193C, 1); Player_AnimChangeLoopMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_side_walkR, this->modelAnimType)); this->unk_868 = 0.0f; } void func_8083CD00(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_8084251C, 1); + Player_SetupAction(play, this, Player_Action_8084251C, 1); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_anchor_back_brake, 2.0f); } void func_8083CD54(PlayState* play, Player* this, s16 yaw) { - this->currentYaw = yaw; - Player_SetupAction(play, this, func_80841BA8, 1); + this->yaw = yaw; + Player_SetupAction(play, this, Player_Action_80841BA8, 1); this->unk_87E = 1200; this->unk_87E *= D_808535E8; LinkAnimation_Change(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_45_turn][this->modelAnimType], 1.0f, 0.0f, @@ -6018,7 +6156,7 @@ void func_8083CD54(PlayState* play, Player* this, s16 yaw) { void func_8083CE0C(Player* this, PlayState* play) { LinkAnimationHeader* anim; - Player_SetupAction(play, this, func_80840BC8, 1); + Player_SetupAction(play, this, Player_Action_80840BC8, 1); if (this->unk_870 < 0.5f) { anim = D_80853914[PLAYER_ANIMGROUP_waitR2wait][this->modelAnimType]; @@ -6027,13 +6165,13 @@ void func_8083CE0C(Player* this, PlayState* play) { } Player_AnimPlayOnce(play, this, anim); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_8083CEAC(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_80840450, 1); + Player_SetupAction(play, this, Player_Action_80840450, 1); Player_AnimChangeOnceMorph(play, this, D_80853914[PLAYER_ANIMGROUP_wait2waitR][this->modelAnimType]); - this->unk_850 = 1; + this->av2.actionVar2 = 1; } void func_8083CF10(Player* this, PlayState* play) { @@ -6082,7 +6220,7 @@ void func_8083D0A8(PlayState* play, Player* this, f32 arg2) { func_80832340(play, this); if (func_8083CFA8(play, this, arg2, 500)) { - Player_PlaySfx(&this->actor, NA_SE_EV_JUMP_OUT_WATER); + Player_PlaySfx(this, NA_SE_EV_JUMP_OUT_WATER); } Player_SetBootData(play, this); @@ -6093,7 +6231,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { if ((arg2 == NULL) || (CHECK_BTN_ALL(arg2->press.button, BTN_A) && (ABS(this->unk_6C2) < 12000) && (this->currentBoots != PLAYER_BOOTS_IRON))) { - Player_SetupAction(play, this, func_8084DC48, 0); + Player_SetupAction(play, this, Player_Action_8084DC48, 0); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_swimer_swim_deep_start); this->unk_6C2 = 0; @@ -6102,7 +6240,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { if (arg2 != NULL) { this->stateFlags2 |= PLAYER_STATE2_DIVING; - Player_PlaySfx(&this->actor, NA_SE_PL_DIVE_BUBBLE); + Player_PlaySfx(this, NA_SE_PL_DIVE_BUBBLE); } return 1; @@ -6116,13 +6254,13 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { this->stateFlags2 &= ~PLAYER_STATE2_UNDERWATER; if (arg2 != NULL) { - Player_SetupAction(play, this, func_8084E1EC, 1); + Player_SetupAction(play, this, Player_Action_8084E1EC, 1); if (this->stateFlags1 & PLAYER_STATE1_GETTING_ITEM) { this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE; } - this->unk_850 = 2; + this->av2.actionVar2 = 2; } func_80832340(play, this); @@ -6138,7 +6276,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { } if (func_8083CFA8(play, this, this->actor.velocity.y, 500)) { - Player_PlaySfx(&this->actor, NA_SE_PL_FACE_UP); + Player_PlaySfx(this, NA_SE_PL_FACE_UP); } return 1; @@ -6152,7 +6290,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { void func_8083D330(PlayState* play, Player* this) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_swimer_swim); this->unk_6C2 = 16000; - this->unk_850 = 1; + this->av2.actionVar2 = 1; } void func_8083D36C(PlayState* play, Player* this) { @@ -6162,12 +6300,12 @@ void func_8083D36C(PlayState* play, Player* this) { if ((this->currentBoots != PLAYER_BOOTS_IRON) && (this->stateFlags2 & PLAYER_STATE2_UNDERWATER)) { this->stateFlags2 &= ~PLAYER_STATE2_UNDERWATER; func_8083D12C(play, this, 0); - this->unk_84F = 1; - } else if (func_80844A44 == this->actionFunc) { - Player_SetupAction(play, this, func_8084DC48, 0); + this->av1.actionVar1 = 1; + } else if (Player_Action_80844A44 == this->actionFunc) { + Player_SetupAction(play, this, Player_Action_8084DC48, 0); func_8083D330(play, this); } else { - Player_SetupAction(play, this, func_8084D610, 1); + Player_SetupAction(play, this, Player_Action_8084D610, 1); Player_AnimChangeOnceMorph(play, this, (this->actor.bgCheckFlags & 1) ? &gPlayerAnim_link_swimer_wait2swim_wait : &gPlayerAnim_link_swimer_land2swim_wait); @@ -6176,7 +6314,7 @@ void func_8083D36C(PlayState* play, Player* this) { if (!(this->stateFlags1 & PLAYER_STATE1_IN_WATER) || (this->actor.yDistToWater < this->ageProperties->unk_2C)) { if (func_8083CFA8(play, this, this->actor.velocity.y, 500)) { - Player_PlaySfx(&this->actor, NA_SE_EV_DIVE_INTO_WATER); + Player_PlaySfx(this, NA_SE_EV_DIVE_INTO_WATER); if (this->fallDistance > 800.0f) { func_80832698(this, NA_SE_VO_LI_CLIMB_END); @@ -6203,14 +6341,14 @@ void func_8083D53C(PlayState* play, Player* this) { } } - if ((func_80845668 != this->actionFunc) && (func_8084BDFC != this->actionFunc)) { + if ((Player_Action_80845668 != this->actionFunc) && (Player_Action_8084BDFC != this->actionFunc)) { if (this->ageProperties->unk_2C < this->actor.yDistToWater) { if (!(this->stateFlags1 & PLAYER_STATE1_IN_WATER) || (!((this->currentBoots == PLAYER_BOOTS_IRON) && (this->actor.bgCheckFlags & 1)) && - (func_8084E30C != this->actionFunc) && (func_8084E368 != this->actionFunc) && - (func_8084D610 != this->actionFunc) && (func_8084D84C != this->actionFunc) && - (func_8084DAB4 != this->actionFunc) && (func_8084DC48 != this->actionFunc) && - (func_8084E1EC != this->actionFunc) && (func_8084D7C4 != this->actionFunc))) { + (Player_Action_8084E30C != this->actionFunc) && (Player_Action_8084E368 != this->actionFunc) && + (Player_Action_8084D610 != this->actionFunc) && (Player_Action_8084D84C != this->actionFunc) && + (Player_Action_8084DAB4 != this->actionFunc) && (Player_Action_8084DC48 != this->actionFunc) && + (Player_Action_8084E1EC != this->actionFunc) && (Player_Action_8084D7C4 != this->actionFunc))) { func_8083D36C(play, this); return; } @@ -6376,7 +6514,7 @@ void func_8083DDC8(Player* this, PlayState* play) { if (!func_8002DD78(this) && !func_808334B4(this) && (this->linearVelocity > 5.0f)) { temp1 = this->linearVelocity * 200.0f; - temp2 = (s16)(this->currentYaw - this->actor.shape.rot.y) * this->linearVelocity * 0.1f; + temp2 = (s16)(this->yaw - this->actor.shape.rot.y) * this->linearVelocity * 0.1f; temp1 = CLAMP(temp1, -4000, 4000); temp2 = CLAMP(-temp2, -4000, 4000); Math_ScaledStepToS(&this->unk_6BC, temp1, 900); @@ -6391,11 +6529,11 @@ void func_8083DDC8(Player* this, PlayState* play) { void func_8083DF68(Player* this, f32 arg1, s16 arg2) { Math_AsymStepToF(&this->linearVelocity, arg1, REG(19) / 100.0f, 1.5f); - Math_ScaledStepToS(&this->currentYaw, arg2, REG(27)); + Math_ScaledStepToS(&this->yaw, arg2, REG(27)); } void func_8083DFE0(Player* this, f32* arg1, s16* arg2) { - s16 yawDiff = this->currentYaw - *arg2; + s16 yawDiff = this->yaw - *arg2; if (this->meleeWeaponState == 0) { float maxSpeed = R_RUN_SPEED_LIMIT / 100.0f; @@ -6434,11 +6572,11 @@ void func_8083DFE0(Player* this, f32* arg1, s16* arg2) { if (ABS(yawDiff) > 0x6000) { if (Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { - this->currentYaw = *arg2; + this->yaw = *arg2; } } else { Math_AsymStepToF(&this->linearVelocity, *arg1, 0.05f, 0.1f); - Math_ScaledStepToS(&this->currentYaw, *arg2, 200); + Math_ScaledStepToS(&this->yaw, *arg2, 200); } } @@ -6447,7 +6585,7 @@ static struct_80854578 D_80854578[] = { { &gPlayerAnim_link_uma_right_up, -34.16f, 7.91f }, }; -s32 func_8083E0FC(Player* this, PlayState* play) { +s32 Player_ActionChange_3(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; f32 unk_04; f32 unk_08; @@ -6478,7 +6616,7 @@ s32 func_8083E0FC(Player* this, PlayState* play) { rideActor->actor.world.pos.z + rideActor->riderPos.z + ((unk_08 * sp38) - (unk_04 * sp34)); this->unk_878 = rideActor->actor.world.pos.y - this->actor.world.pos.y; - this->currentYaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; Actor_MountHorse(play, this, &rideActor->actor); Player_AnimPlayOnce(play, this, D_80854578[temp].anim); @@ -6513,7 +6651,7 @@ s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly) f32 slopeSlowdownSpeedStep; s16 velYawToDownwardSlope; - if (!Player_InBlockingCsMode(play, this) && (func_8084F390 != this->actionFunc) && + if (!Player_InBlockingCsMode(play, this) && (Player_Action_8084F390 != this->actionFunc) && (SurfaceType_GetSlope(&play->colCtx, floorPoly, this->actor.floorBgId) == 1)) { playerVelYaw = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); Player_GetSlopeDirection(floorPoly, &slopeNormal, &downwardSlopeYaw); @@ -6533,14 +6671,14 @@ s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly) Math_StepToF(&this->pushedSpeed, slopeSlowdownSpeed, slopeSlowdownSpeedStep); } else { // moving downward on the slope, causing player to slip - Player_SetupAction(play, this, func_8084F390, 0); + Player_SetupAction(play, this, Player_Action_8084F390, 0); func_80832564(play, this); if (sFloorShapePitch >= 0) { - this->unk_84F = 1; + this->av1.actionVar1 = 1; } - Player_AnimChangeLoopMorph(play, this, sSlopeSlipAnims[this->unk_84F]); + Player_AnimChangeLoopMorph(play, this, sSlopeSlipAnims[this->av1.actionVar1]); this->linearVelocity = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z)); - this->currentYaw = playerVelYaw; + this->yaw = playerVelYaw; return true; } } @@ -6607,7 +6745,7 @@ void Player_SetPendingFlag(Player* this, PlayState* play) { this->pendingFlag.flagID = 0; } -s32 func_8083E5A8(Player* this, PlayState* play) { +s32 Player_ActionChange_2(Player* this, PlayState* play) { Actor* interactedActor; if(gSaveContext.pendingIceTrapCount) { @@ -6725,7 +6863,7 @@ s32 func_8083E5A8(Player* this, PlayState* play) { chest->dyna.actor.world.pos.x - (Math_SinS(chest->dyna.actor.shape.rot.y) * 29.4343f); this->actor.world.pos.z = chest->dyna.actor.world.pos.z - (Math_CosS(chest->dyna.actor.shape.rot.y) * 29.4343f); - this->currentYaw = this->actor.shape.rot.y = chest->dyna.actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y = chest->dyna.actor.shape.rot.y; func_80832224(this); if ((giEntry.itemId != ITEM_NONE) && (giEntry.gi >= 0) && @@ -6779,7 +6917,7 @@ s32 func_8083E5A8(Player* this, PlayState* play) { } void func_8083EA94(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_80846578, 1); + Player_SetupAction(play, this, Player_Action_80846578, 1); Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_throw, this->modelAnimType)); } @@ -6792,7 +6930,7 @@ s32 func_8083EAF0(Player* this, Actor* actor) { return 1; } -s32 func_8083EB44(Player* this, PlayState* play) { +s32 Player_ActionChange_9(Player* this, PlayState* play) { u16 buttonsToCheck = BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; if (CVarGetInteger("gDpadEquips", 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; @@ -6801,7 +6939,7 @@ s32 func_8083EB44(Player* this, PlayState* play) { CHECK_BTN_ANY(sControlInput->press.button, buttonsToCheck)) { if (!func_80835644(play, this, this->heldActor)) { if (!func_8083EAF0(this, this->heldActor)) { - Player_SetupAction(play, this, func_808464B0, 1); + Player_SetupAction(play, this, Player_Action_808464B0, 1); Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_put, this->modelAnimType)); } else { func_8083EA94(this, play); @@ -6886,24 +7024,24 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) { this->stateFlags1 &= ~PLAYER_STATE1_IN_WATER; if ((sp8C != 0) || (wallFlags & 2)) { - if ((this->unk_84F = sp8C) != 0) { + if ((this->av1.actionVar1 = sp8C) != 0) { if (this->actor.bgCheckFlags & 1) { anim = &gPlayerAnim_link_normal_Fclimb_startA; } else { anim = &gPlayerAnim_link_normal_Fclimb_hold2upL; } - sp34 = (this->ageProperties->unk_38 - 1.0f) - sp34; + sp34 = (this->ageProperties->wallCheckRadius - 1.0f) - sp34; } else { anim = this->ageProperties->unk_A4; sp34 = sp34 - 1.0f; } - this->unk_850 = -2; + this->av2.actionVar2 = -2; this->actor.world.pos.y += phi_f20; - this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; + this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; } else { anim = this->ageProperties->unk_A8; - this->unk_850 = -4; - this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw; + this->av2.actionVar2 = -4; + this->actor.shape.rot.y = this->yaw = this->actor.wallYaw; } this->actor.world.pos.x = (sp34 * wallPolyNormalX) + sp80; @@ -6923,7 +7061,7 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) { } void func_8083F070(Player* this, LinkAnimationHeader* anim, PlayState* play) { - func_80835DAC(play, this, func_8084C5F8, 0); + func_80835DAC(play, this, Player_Action_8084C5F8, 0); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, (4.0f / 3.0f)); } @@ -6985,7 +7123,7 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall func_80836898(play, this, func_8083A40C); this->stateFlags2 |= PLAYER_STATE2_CRAWLING; - this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; + this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; this->actor.world.pos.x = xVertex1 + (distToInteractWall * wallPolyNormX); this->actor.world.pos.z = zVertex1 + (distToInteractWall * wallPolyNormZ); func_80832224(this); @@ -7046,7 +7184,7 @@ s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f temp = Math_Atan2S(-temp2, -temp1); Math_ScaledStepToS(&this->actor.shape.rot.y, temp, 800); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; this->actor.world.pos.x = sp54.x - (Math_SinS(this->actor.shape.rot.y) * arg2); this->actor.world.pos.z = sp54.z - (Math_CosS(this->actor.shape.rot.y) * arg2); @@ -7059,7 +7197,7 @@ s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f } s32 func_8083F524(PlayState* play, Player* this) { - return func_8083F360(play, this, 26.0f, this->ageProperties->unk_38 + 5.0f, 30.0f, 0.0f); + return func_8083F360(play, this, 26.0f, this->ageProperties->wallCheckRadius + 5.0f, 30.0f, 0.0f); } /** @@ -7079,7 +7217,7 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { } if (ABS(temp) > 0x4000) { - Player_SetupAction(play, this, func_8084C81C, 0); + Player_SetupAction(play, this, Player_Action_8084C81C, 0); if (this->linearVelocity > 0.0f) { this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; @@ -7118,7 +7256,7 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { } } - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; Player_ZeroSpeedXZ(this); return 1; @@ -7130,16 +7268,16 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { void func_8083F72C(Player* this, LinkAnimationHeader* anim, PlayState* play) { if (!func_80836898(play, this, func_8083A388)) { - Player_SetupAction(play, this, func_8084B78C, 0); + Player_SetupAction(play, this, Player_Action_8084B78C, 0); } Player_AnimPlayOnce(play, this, anim); func_80832224(this); - this->actor.shape.rot.y = this->currentYaw = this->actor.wallYaw + 0x8000; + this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; } -s32 func_8083F7BC(Player* this, PlayState* play) { +s32 Player_ActionChange_5(Player* this, PlayState* play) { DynaPolyActor* wallPolyActor; if (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (this->actor.bgCheckFlags & 0x200) && (sShapeYawToTouchedWall < 0x3000)) { @@ -7169,7 +7307,7 @@ s32 func_8083F7BC(Player* this, PlayState* play) { this->interactRangeActor = &wallPolyActor->actor; this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; - this->currentYaw = this->actor.wallYaw + 0x8000; + this->yaw = this->actor.wallYaw + 0x8000; func_80832224(this); return 1; @@ -7215,13 +7353,13 @@ s32 func_8083F9D0(PlayState* play, Player* this) { } void func_8083FAB8(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_8084B898, 0); + Player_SetupAction(play, this, Player_Action_8084B898, 0); this->stateFlags2 |= PLAYER_STATE2_MOVING_DYNAPOLY; Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_push_start); } void func_8083FB14(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_8084B9E4, 0); + Player_SetupAction(play, this, Player_Action_8084B9E4, 0); this->stateFlags2 |= PLAYER_STATE2_MOVING_DYNAPOLY; Player_AnimPlayOnce(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_pull_start, this->modelAnimType)); } @@ -7264,7 +7402,7 @@ s32 func_8083FC68(Player* this, f32 arg1, s16 arg2) { } s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { - s16 sp2E = *arg2 - this->targetYaw; + s16 sp2E = *arg2 - this->zTargetYaw; u16 sp2C = ABS(sp2E); if ((func_8002DD78(this) || func_808334B4(this)) && (this->unk_664 == NULL)) { @@ -7429,9 +7567,9 @@ void func_8084029C(Player* this, f32 arg1) { } } -void func_80840450(Player* this, PlayState* play) { - f32 sp44; - s16 sp42; +void Player_Action_80840450(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; s32 temp1; u32 temp2; s16 temp3; @@ -7445,11 +7583,11 @@ void func_80840450(Player* this, PlayState* play) { } } - if (this->unk_850 != 0) { + if (this->av2.actionVar2 != 0) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80832DBC(this); Player_AnimPlayLoop(play, this, func_808334E4(this)); - this->unk_850 = 0; + this->av2.actionVar2 = 0; this->stateFlags3 &= ~PLAYER_STATE3_FINISHED_ATTACKING; } func_80833C3C(this); @@ -7459,33 +7597,33 @@ void func_80840450(Player* this, PlayState* play) { func_8083721C(this); - if (!Player_TryActionChangeList(play, this, D_808543E0, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList1, true)) { if (!func_80833B54(this) && (!func_80833B2C(this) || (func_80834B5C != this->upperActionFunc))) { func_8083CF10(this, play); return; } - Player_GetMovementSpeedAndYaw(this, &sp44, &sp42, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp1 = func_8083FC68(this, sp44, sp42); + temp1 = func_8083FC68(this, speedTarget, yawTarget); if (temp1 > 0) { - func_8083C8DC(this, play, sp42); + func_8083C8DC(this, play, yawTarget); return; } if (temp1 < 0) { - func_8083CBF0(this, sp42, play); + func_8083CBF0(this, yawTarget, play); return; } - if (sp44 > 4.0f) { + if (speedTarget > 4.0f) { func_8083CC9C(this, play); return; } func_8084029C(this, (this->linearVelocity * 0.3f) + 1.0f); - func_80840138(this, sp44, sp42); + func_80840138(this, speedTarget, yawTarget); temp2 = this->unk_868; if ((temp2 < 6) || ((temp2 - 0xE) < 6)) { @@ -7493,27 +7631,27 @@ void func_80840450(Player* this, PlayState* play) { return; } - temp3 = sp42 - this->currentYaw; + temp3 = yawTarget - this->yaw; temp4 = ABS(temp3); if (temp4 > 0x4000) { if (Math_StepToF(&this->linearVelocity, 0.0f, 1.5f)) { - this->currentYaw = sp42; + this->yaw = yawTarget; } return; } - Math_AsymStepToF(&this->linearVelocity, sp44 * 0.3f, 2.0f, 1.5f); + Math_AsymStepToF(&this->linearVelocity, speedTarget * 0.3f, 2.0f, 1.5f); if (!(this->stateFlags3 & PLAYER_STATE3_FINISHED_ATTACKING)) { - Math_ScaledStepToS(&this->currentYaw, sp42, temp4 * 0.1f); + Math_ScaledStepToS(&this->yaw, yawTarget, temp4 * 0.1f); } } } -void func_808407CC(Player* this, PlayState* play) { - f32 sp3C; - s16 sp3A; +void Player_Action_808407CC(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; s32 temp1; s16 temp2; s32 temp3; @@ -7525,15 +7663,15 @@ void func_808407CC(Player* this, PlayState* play) { func_8083721C(this); - if (!Player_TryActionChangeList(play, this, D_808543E8, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList2, true)) { if (func_80833B54(this)) { func_8083CEAC(this, play); return; } if (!func_80833B2C(this)) { - func_80835DAC(play, this, func_80840BC8, 1); - this->currentYaw = this->actor.shape.rot.y; + func_80835DAC(play, this, Player_Action_80840BC8, 1); + this->yaw = this->actor.shape.rot.y; return; } @@ -7542,35 +7680,35 @@ void func_808407CC(Player* this, PlayState* play) { return; } - Player_GetMovementSpeedAndYaw(this, &sp3C, &sp3A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp1 = func_8083FD78(this, &sp3C, &sp3A, play); + temp1 = func_8083FD78(this, &speedTarget, &yawTarget, play); if (temp1 > 0) { - func_8083C8DC(this, play, sp3A); + func_8083C8DC(this, play, yawTarget); return; } if (temp1 < 0) { - func_8083CB2C(this, sp3A, play); + func_8083CB2C(this, yawTarget, play); return; } - if (sp3C > 4.9f) { + if (speedTarget > 4.9f) { func_8083CC9C(this, play); func_80833C3C(this); return; } - if (sp3C != 0.0f) { + if (speedTarget != 0.0f) { func_8083CB94(this, play); return; } - temp2 = sp3A - this->actor.shape.rot.y; + temp2 = yawTarget - this->actor.shape.rot.y; temp3 = ABS(temp2); if (temp3 > 800) { - func_8083CD54(play, this, sp3A); + func_8083CD54(play, this, yawTarget); } } } @@ -7623,11 +7761,11 @@ void func_808409CC(PlayState* play, Player* this) { Animation_GetLastFrame(anim), ANIMMODE_ONCE, -6.0f); } -void func_80840BC8(Player* this, PlayState* play) { +void Player_Action_80840BC8(Player* this, PlayState* play) { s32 sp44; s32 sp40; - f32 sp3C; - s16 sp3A; + f32 speedTarget; + s16 yawTarget; s16 temp; sp44 = func_80833350(this); @@ -7638,11 +7776,11 @@ void func_80840BC8(Player* this, PlayState* play) { } if (sp40 != 0) { - if (this->unk_850 != 0) { - if (DECR(this->unk_850) == 0) { + if (this->av2.actionVar2 != 0) { + if (DECR(this->av2.actionVar2) == 0) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } - this->skelAnime.jointTable[0].y = (this->skelAnime.jointTable[0].y + ((this->unk_850 & 1) * 0x50)) - 0x28; + this->skelAnime.jointTable[0].y = (this->skelAnime.jointTable[0].y + ((this->av2.actionVar2 & 1) * 0x50)) - 0x28; } else { func_80832DBC(this); func_808409CC(play, this); @@ -7651,8 +7789,8 @@ void func_80840BC8(Player* this, PlayState* play) { func_8083721C(this); - if (this->unk_850 == 0) { - if (!Player_TryActionChangeList(play, this, D_80854418, 1)) { + if (this->av2.actionVar2 == 0) { + if (!Player_TryActionChangeList(play, this, sActionChangeList7, true)) { if (func_80833B54(this)) { func_8083CEAC(this, play); return; @@ -7663,21 +7801,21 @@ void func_80840BC8(Player* this, PlayState* play) { return; } - Player_GetMovementSpeedAndYaw(this, &sp3C, &sp3A, 0.018f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); - if (sp3C != 0.0f) { - func_8083C8DC(this, play, sp3A); + if (speedTarget != 0.0f) { + func_8083C8DC(this, play, yawTarget); return; } - temp = sp3A - this->actor.shape.rot.y; + temp = yawTarget - this->actor.shape.rot.y; if (ABS(temp) > 800) { - func_8083CD54(play, this, sp3A); + func_8083CD54(play, this, yawTarget); return; } - Math_ScaledStepToS(&this->actor.shape.rot.y, sp3A, 1200); - this->currentYaw = this->actor.shape.rot.y; + Math_ScaledStepToS(&this->actor.shape.rot.y, yawTarget, 1200); + this->yaw = this->actor.shape.rot.y; if (func_80833338(this) == this->skelAnime.animation) { func_8083DC54(this, play); } @@ -7685,11 +7823,11 @@ void func_80840BC8(Player* this, PlayState* play) { } } -void func_80840DE4(Player* this, PlayState* play) { +void Player_Action_80840DE4(Player* this, PlayState* play) { f32 frames; f32 coeff; - f32 sp44; - s16 sp42; + f32 speedTarget; + s16 yawTarget; s32 temp1; s16 temp2; s32 temp3; @@ -7711,7 +7849,7 @@ void func_80840DE4(Player* this, PlayState* play) { this->skelAnime.animLength = frames; this->skelAnime.endFrame = frames - 1.0f; - if ((s16)(this->currentYaw - this->actor.shape.rot.y) >= 0) { + if ((s16)(this->yaw - this->actor.shape.rot.y) >= 0) { direction = 1; } else { direction = -1; @@ -7725,7 +7863,7 @@ void func_80840DE4(Player* this, PlayState* play) { func_808327F8(this, this->linearVelocity); } - if (!Player_TryActionChangeList(play, this, D_808543F4, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList3, true)) { if (func_80833B54(this)) { func_8083CEAC(this, play); return; @@ -7736,42 +7874,42 @@ void func_80840DE4(Player* this, PlayState* play) { return; } - Player_GetMovementSpeedAndYaw(this, &sp44, &sp42, 0.0f, play); - temp1 = func_8083FD78(this, &sp44, &sp42, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + temp1 = func_8083FD78(this, &speedTarget, &yawTarget, play); if (temp1 > 0) { - func_8083C8DC(this, play, sp42); + func_8083C8DC(this, play, yawTarget); return; } if (temp1 < 0) { - func_8083CB2C(this, sp42, play); + func_8083CB2C(this, yawTarget, play); return; } - if (sp44 > 4.9f) { + if (speedTarget > 4.9f) { func_8083CC9C(this, play); func_80833C3C(this); return; } - if ((sp44 == 0.0f) && (this->linearVelocity == 0.0f)) { + if ((speedTarget == 0.0f) && (this->linearVelocity == 0.0f)) { func_80839F30(this, play); return; } - temp2 = sp42 - this->currentYaw; + temp2 = yawTarget - this->yaw; temp3 = ABS(temp2); if (temp3 > 0x4000) { if (Math_StepToF(&this->linearVelocity, 0.0f, 1.5f)) { - this->currentYaw = sp42; + this->yaw = yawTarget; } return; } - Math_AsymStepToF(&this->linearVelocity, sp44 * 0.4f, 1.5f, 1.5f); - Math_ScaledStepToS(&this->currentYaw, sp42, temp3 * 0.1f); + Math_AsymStepToF(&this->linearVelocity, speedTarget * 0.4f, 1.5f, 1.5f); + Math_ScaledStepToS(&this->yaw, yawTarget, temp3 * 0.1f); } } @@ -7817,7 +7955,7 @@ void func_80841138(Player* this, PlayState* play) { } void func_8084140C(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_8084170C, 1); + Player_SetupAction(play, this, Player_Action_8084170C, 1); Player_AnimChangeOnceMorph(play, this, &gPlayerAnim_link_normal_back_brake); } @@ -7830,7 +7968,7 @@ s32 func_80841458(Player* this, f32* arg1, s16* arg2, PlayState* play) { if (*arg1 != 0.0f) { if (func_8083721C(this)) { *arg1 = 0.0f; - *arg2 = this->currentYaw; + *arg2 = this->yaw; } else { return 1; } @@ -7839,40 +7977,40 @@ s32 func_80841458(Player* this, f32* arg1, s16* arg2, PlayState* play) { return 0; } -void func_808414F8(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; +void Player_Action_808414F8(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; s32 sp2C; s16 sp2A; func_80841138(this, play); - if (!Player_TryActionChangeList(play, this, D_80854400, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { if (!func_80833C04(this)) { - func_8083C8DC(this, play, this->currentYaw); + func_8083C8DC(this, play, this->yaw); return; } - Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, 0.0f, play); - sp2C = func_8083FD78(this, &sp34, &sp32, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + sp2C = func_8083FD78(this, &speedTarget, &yawTarget, play); if (sp2C >= 0) { - if (!func_80841458(this, &sp34, &sp32, play)) { + if (!func_80841458(this, &speedTarget, &yawTarget, play)) { if (sp2C != 0) { func_8083C858(this, play); - } else if (sp34 > 4.9f) { + } else if (speedTarget > 4.9f) { func_8083CC9C(this, play); } else { func_8083CB94(this, play); } } } else { - sp2A = sp32 - this->currentYaw; + sp2A = yawTarget - this->yaw; - Math_AsymStepToF(&this->linearVelocity, sp34 * 1.5f, 1.5f, 2.0f); - Math_ScaledStepToS(&this->currentYaw, sp32, sp2A * 0.1f); + Math_AsymStepToF(&this->linearVelocity, speedTarget * 1.5f, 1.5f, 2.0f); + Math_ScaledStepToS(&this->yaw, yawTarget, sp2A * 0.1f); - if ((sp34 == 0.0f) && (this->linearVelocity == 0.0f)) { + if ((speedTarget == 0.0f) && (this->linearVelocity == 0.0f)) { func_80839F30(this, play); } } @@ -7880,39 +8018,39 @@ void func_808414F8(Player* this, PlayState* play) { } void func_808416C0(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_808417FC, 1); + Player_SetupAction(play, this, Player_Action_808417FC, 1); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_back_brake_end); } -void func_8084170C(Player* this, PlayState* play) { +void Player_Action_8084170C(Player* this, PlayState* play) { s32 sp34; - f32 sp30; - s16 sp2E; + f32 speedTarget; + s16 yawTarget; sp34 = LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); - if (!Player_TryActionChangeList(play, this, D_80854400, 1)) { - Player_GetMovementSpeedAndYaw(this, &sp30, &sp2E, 0.0f, play); + if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->linearVelocity == 0.0f) { - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; - if (func_8083FD78(this, &sp30, &sp2E, play) > 0) { + if (func_8083FD78(this, &speedTarget, &yawTarget, play) > 0) { func_8083C858(this, play); - } else if ((sp30 != 0.0f) || (sp34 != 0)) { + } else if ((speedTarget != 0.0f) || (sp34 != 0)) { func_808416C0(this, play); } } } } -void func_808417FC(Player* this, PlayState* play) { +void Player_Action_808417FC(Player* this, PlayState* play) { s32 sp1C; sp1C = LinkAnimation_Update(play, &this->skelAnime); - if (!Player_TryActionChangeList(play, this, D_80854400, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { if (sp1C != 0) { func_80839F30(this, play); } @@ -7933,27 +8071,27 @@ void func_80841860(PlayState* play, Player* this) { LinkAnimation_BlendToJoint(play, &this->skelAnime, sp34, frame, sp38, frame, this->unk_870, this->blendTable); } -void func_8084193C(Player* this, PlayState* play) { - f32 sp3C; - s16 sp3A; +void Player_Action_8084193C(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; s32 temp1; s16 temp2; s32 temp3; func_80841860(play, this); - if (!Player_TryActionChangeList(play, this, D_80854408, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList5, true)) { if (!func_80833C04(this)) { func_8083C858(this, play); return; } - Player_GetMovementSpeedAndYaw(this, &sp3C, &sp3A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (func_80833B2C(this)) { - temp1 = func_8083FD78(this, &sp3C, &sp3A, play); + temp1 = func_8083FD78(this, &speedTarget, &yawTarget, play); } else { - temp1 = func_8083FC68(this, sp3C, sp3A); + temp1 = func_8083FC68(this, speedTarget, yawTarget); } if (temp1 > 0) { @@ -7963,14 +8101,14 @@ void func_8084193C(Player* this, PlayState* play) { if (temp1 < 0) { if (func_80833B2C(this)) { - func_8083CB2C(this, sp3A, play); + func_8083CB2C(this, yawTarget, play); } else { - func_8083CBF0(this, sp3A, play); + func_8083CBF0(this, yawTarget, play); } return; } - if ((this->linearVelocity < 3.6f) && (sp3C < 4.0f)) { + if ((this->linearVelocity < 3.6f) && (speedTarget < 4.0f)) { if (!func_8008E9C4(this) && func_80833B2C(this)) { func_8083CB94(this, play); } else { @@ -7979,25 +8117,25 @@ void func_8084193C(Player* this, PlayState* play) { return; } - func_80840138(this, sp3C, sp3A); + func_80840138(this, speedTarget, yawTarget); - temp2 = sp3A - this->currentYaw; + temp2 = yawTarget - this->yaw; temp3 = ABS(temp2); if (temp3 > 0x4000) { if (Math_StepToF(&this->linearVelocity, 0.0f, 3.0f) != 0) { - this->currentYaw = sp3A; + this->yaw = yawTarget; } return; } - sp3C *= 0.9f; - Math_AsymStepToF(&this->linearVelocity, sp3C, 2.0f, 3.0f); - Math_ScaledStepToS(&this->currentYaw, sp3A, temp3 * 0.1f); + speedTarget *= 0.9f; + Math_AsymStepToF(&this->linearVelocity, speedTarget, 2.0f, 3.0f); + Math_ScaledStepToS(&this->yaw, yawTarget, temp3 * 0.1f); } } -void func_80841BA8(Player* this, PlayState* play) { +void Player_Action_80841BA8(Player* this, PlayState* play) { f32 sp34; s16 sp32; @@ -8010,9 +8148,9 @@ void func_80841BA8(Player* this, PlayState* play) { this->skelAnime.morphTable, sUpperBodyLimbCopyMap); } - Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, 0.018f, play); + Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_CURVED, play); - if (!Player_TryActionChangeList(play, this, D_80854414, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList6, true)) { if (sp34 != 0.0f) { this->actor.shape.rot.y = sp32; func_8083C858(this, play); @@ -8020,7 +8158,7 @@ void func_80841BA8(Player* this, PlayState* play) { func_8083C0E8(this, play); } - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } } @@ -8122,20 +8260,20 @@ void func_80841EE4(Player* this, PlayState* play) { } } -void func_80842180(Player* this, PlayState* play) { +void Player_Action_80842180(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; func_80841EE4(this, play); - if (!Player_TryActionChangeList(play, this, D_80854424, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList8, true)) { if (func_80833C04(this)) { func_8083C858(this, play); return; } - Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, 0.018f, play); + Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, SPEED_MODE_CURVED, play); if (!func_8083C484(this, &sp2C, &sp2A)) { int32_t giSpeedModifier = GameInteractor_RunSpeedModifier(); @@ -8177,20 +8315,20 @@ void func_80842180(Player* this, PlayState* play) { } } -void func_8084227C(Player* this, PlayState* play) { +void Player_Action_8084227C(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; func_80841EE4(this, play); - if (!Player_TryActionChangeList(play, this, D_80854430, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList9, true)) { if (!func_80833C04(this)) { func_8083C858(this, play); return; } - Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, SPEED_MODE_LINEAR, play); if (!func_8083C484(this, &sp2C, &sp2A)) { if ((func_80833B2C(this) && (sp2C != 0.0f) && (func_8083FD78(this, &sp2C, &sp2A, play) <= 0)) || @@ -8209,20 +8347,20 @@ void func_8084227C(Player* this, PlayState* play) { } } -void func_808423EC(Player* this, PlayState* play) { +void Player_Action_808423EC(Player* this, PlayState* play) { s32 sp34; f32 sp30; s16 sp2E; sp34 = LinkAnimation_Update(play, &this->skelAnime); - if (!Player_TryActionChangeList(play, this, D_80854408, 1)) { + if (!Player_TryActionChangeList(play, this, sActionChangeList5, true)) { if (!func_80833C04(this)) { func_8083C858(this, play); return; } - Player_GetMovementSpeedAndYaw(this, &sp30, &sp2E, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &sp30, &sp2E, SPEED_MODE_LINEAR, play); if ((this->skelAnime.morphWeight == 0.0f) && (this->skelAnime.curFrame > 5.0f)) { func_8083721C(this); @@ -8239,27 +8377,27 @@ void func_808423EC(Player* this, PlayState* play) { } } -void func_8084251C(Player* this, PlayState* play) { +void Player_Action_8084251C(Player* this, PlayState* play) { s32 sp34; - f32 sp30; - s16 sp2E; + f32 speedTarget; + s16 yawTarget; sp34 = LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); - if (!Player_TryActionChangeList(play, this, D_80854440, 1)) { - Player_GetMovementSpeedAndYaw(this, &sp30, &sp2E, 0.0f, play); + if (!Player_TryActionChangeList(play, this, sActionChangeList10, true)) { + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->linearVelocity == 0.0f) { - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; - if (func_8083FC68(this, sp30, sp2E) > 0) { + if (func_8083FC68(this, speedTarget, yawTarget) > 0) { func_8083C858(this, play); return; } - if ((sp30 != 0.0f) || (sp34 != 0)) { + if ((speedTarget != 0.0f) || (sp34 != 0)) { func_80839F90(this, play); } } @@ -8291,11 +8429,11 @@ s32 func_8084269C(PlayState* play, Player* this) { return 0; } -void func_8084279C(Player* this, PlayState* play) { +void Player_Action_8084279C(Player* this, PlayState* play) { func_80832CB0(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check_wait, this->modelAnimType)); - if (DECR(this->unk_850) == 0) { - if (!func_8083B040(this, play)) { + if (DECR(this->av2.actionVar2) == 0) { + if (!Player_ActionChange_13(this, play)) { func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check_end, this->modelAnimType), play); } @@ -8320,9 +8458,9 @@ s32 func_808428D8(Player* this, PlayState* play) { } Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_defense_kiru); - this->unk_84F = 1; + this->av1.actionVar1 = 1; this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H; - this->currentYaw = this->actor.shape.rot.y + this->unk_6BE; + this->yaw = this->actor.shape.rot.y + this->unk_6BE; if (!CVarGetInteger("gCrouchStabHammerFix", 0)) { return 1; @@ -8347,22 +8485,22 @@ s32 func_808428D8(Player* this, PlayState* play) { } s32 func_80842964(Player* this, PlayState* play) { - return func_8083B040(this, play) || func_8083B644(this, play) || func_8083E5A8(this, play); + return Player_ActionChange_13(this, play) || Player_ActionChange_4(this, play) || Player_ActionChange_2(this, play); } void Player_RequestQuake(PlayState* play, s32 speed, s32 y, s32 countdown) { - s32 quakeIdx = Quake_Add(Play_GetCamera(play, 0), 3); + s32 quakeIndex = Quake_Add(Play_GetCamera(play, 0), 3); - Quake_SetSpeed(quakeIdx, speed); - Quake_SetQuakeValues(quakeIdx, y, 0, 0, 0); - Quake_SetCountdown(quakeIdx, countdown); + Quake_SetSpeed(quakeIndex, speed); + Quake_SetQuakeValues(quakeIndex, y, 0, 0, 0); + Quake_SetCountdown(quakeIndex, countdown); } void func_80842A28(PlayState* play, Player* this) { Player_RequestQuake(play, 27767, 7, 20); play->actorCtx.unk_02 = 4; Player_RequestRumble(this, 255, 20, 150, 0); - Player_PlaySfx(&this->actor, NA_SE_IT_HAMMER_HIT); + Player_PlaySfx(this, NA_SE_IT_HAMMER_HIT); } void func_80842A88(PlayState* play, Player* this) { @@ -8379,7 +8517,7 @@ s32 func_80842AC4(PlayState* play, Player* this) { this->actor.shape.rot.y + 0x8000); this->unk_85C = 0.5f; func_80842A88(play, this); - Player_PlaySfx(&this->actor, NA_SE_IT_WOODSTICK_BROKEN); + Player_PlaySfx(this, NA_SE_IT_WOODSTICK_BROKEN); } return 1; @@ -8395,7 +8533,7 @@ s32 func_80842B7C(PlayState* play, Player* this) { EffectSsStick_Spawn(play, &this->bodyPartsPos[PLAYER_BODYPART_R_HAND], this->actor.shape.rot.y + 0x8000); func_800849EC(play); - Player_PlaySfx(&this->actor, NA_SE_IT_MAJIN_SWORD_BROKEN); + Player_PlaySfx(this, NA_SE_IT_MAJIN_SWORD_BROKEN); } } @@ -8421,9 +8559,9 @@ void func_80842D20(PlayState* play, Player* this) { s32 pad; s32 sp28; - if (func_80843188 != this->actionFunc) { + if (Player_Action_80843188 != this->actionFunc) { func_80832440(play, this); - Player_SetupAction(play, this, func_808505DC, 0); + Player_SetupAction(play, this, Player_Action_808505DC, 0); if (func_8008E9C4(this)) { sp28 = 2; @@ -8484,9 +8622,9 @@ s32 func_80842DF4(PlayState* play, Player* this) { } else { CollisionCheck_SpawnShieldParticles(play, &sp5C); if (sp48 == 0xB) { - Player_PlaySfx(&this->actor, NA_SE_IT_WALL_HIT_SOFT); + Player_PlaySfx(this, NA_SE_IT_WALL_HIT_SOFT); } else { - Player_PlaySfx(&this->actor, NA_SE_IT_WALL_HIT_HARD); + Player_PlaySfx(this, NA_SE_IT_WALL_HIT_HARD); } } @@ -8529,7 +8667,7 @@ s32 func_80842DF4(PlayState* play, Player* this) { return 0; } -void func_80843188(Player* this, PlayState* play) { +void Player_Action_80843188(Player* this, PlayState* play) { f32 sp54; f32 sp50; s16 sp4E; @@ -8543,8 +8681,8 @@ void func_80843188(Player* this, PlayState* play) { if (!Player_IsChildWithHylianShield(this)) { Player_AnimPlayLoop(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense_wait, this->modelAnimType)); } - this->unk_850 = 1; - this->unk_84F = 0; + this->av2.actionVar2 = 1; + this->av1.actionVar1 = 0; } if (!Player_IsChildWithHylianShield(this)) { @@ -8555,7 +8693,7 @@ void func_80843188(Player* this, PlayState* play) { func_8083721C(this); - if (this->unk_850 != 0) { + if (this->av2.actionVar2 != 0) { sp54 = sControlInput->rel.stick_y * 100 * (CVarGetInteger("gInvertShieldAimingYAxis", 1) ? 1 : -1); sp50 = sControlInput->rel.stick_x * (CVarGetInteger("gMirroredWorld", 0) ? 120 : -120) * (CVarGetInteger("gInvertShieldAimingXAxis", 0) ? -1 : 1); sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); @@ -8583,17 +8721,17 @@ void func_80843188(Player* this, PlayState* play) { this->unk_6BC = this->actor.focus.rot.x; Math_ScaledStepToS(&this->unk_6BE, sp4A, sp46); - if (this->unk_84F != 0) { + if (this->av1.actionVar1 != 0) { if (!func_80842DF4(play, this)) { if (this->skelAnime.curFrame < 2.0f) { func_80833A20(this, 1); } } else { - this->unk_850 = 1; - this->unk_84F = 0; + this->av2.actionVar2 = 1; + this->av1.actionVar1 = 0; } } else if (!func_80842964(this, play)) { - if (func_8083C2B0(this, play)) { + if (Player_ActionChange_11(this, play)) { func_808428D8(this, play); } else { this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; @@ -8612,7 +8750,7 @@ void func_80843188(Player* this, PlayState* play) { func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense_end, this->modelAnimType), play); } - Player_PlaySfx(&this->actor, NA_SE_IT_SHIELD_REMOVE); + Player_PlaySfx(this, NA_SE_IT_SHIELD_REMOVE); return; } } else { @@ -8626,22 +8764,22 @@ void func_80843188(Player* this, PlayState* play) { this->unk_6AE |= 0xC1; } -void func_808435C4(Player* this, PlayState* play) { +void Player_Action_808435C4(Player* this, PlayState* play) { s32 temp; LinkAnimationHeader* anim; f32 frames; func_8083721C(this); - if (this->unk_84F == 0) { + if (this->av1.actionVar1 == 0) { D_808535E0 = Player_UpdateUpperBody(this, play); if ((func_80834B5C == this->upperActionFunc) || (func_808374A0(play, this, &this->upperSkelAnime, 4.0f) > 0)) { - Player_SetupAction(play, this, func_80840450, 1); + Player_SetupAction(play, this, Player_Action_80840450, 1); } } else { temp = func_808374A0(play, this, &this->skelAnime, 4.0f); if ((temp != 0) && ((temp > 0) || LinkAnimation_Update(play, &this->skelAnime))) { - Player_SetupAction(play, this, func_80843188, 1); + Player_SetupAction(play, this, Player_Action_80843188, 1); this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense, this->modelAnimType); @@ -8651,7 +8789,7 @@ void func_808435C4(Player* this, PlayState* play) { } } -void func_8084370C(Player* this, PlayState* play) { +void Player_Action_8084370C(Player* this, PlayState* play) { s32 sp1C; func_8083721C(this); @@ -8662,15 +8800,15 @@ void func_8084370C(Player* this, PlayState* play) { } } -void func_8084377C(Player* this, PlayState* play) { +void Player_Action_8084377C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; func_808382BC(this); - if (!(this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) && (this->unk_850 == 0) && (this->unk_8A1 != 0)) { + if (!(this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) && (this->av2.actionVar2 == 0) && (this->unk_8A1 != 0)) { s16 temp = this->actor.shape.rot.y - this->unk_8A2; - this->currentYaw = this->actor.shape.rot.y = this->unk_8A2; + this->yaw = this->actor.shape.rot.y = this->unk_8A2; this->linearVelocity = this->unk_8A4; if (ABS(temp) > 0x4000) { @@ -8684,22 +8822,22 @@ void func_8084377C(Player* this, PlayState* play) { } if (LinkAnimation_Update(play, &this->skelAnime) && (this->actor.bgCheckFlags & 1)) { - if (this->unk_850 != 0) { - this->unk_850--; - if (this->unk_850 == 0) { + if (this->av2.actionVar2 != 0) { + this->av2.actionVar2--; + if (this->av2.actionVar2 == 0) { func_80853080(this, play); } } else if ((this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) || (!(this->cylinder.base.acFlags & AC_HIT) && (this->unk_8A1 == 0))) { if (this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) { - this->unk_850++; + this->av2.actionVar2++; } else { - Player_SetupAction(play, this, func_80843954, 0); + Player_SetupAction(play, this, Player_Action_80843954, 0); this->stateFlags1 |= PLAYER_STATE1_DAMAGED; } Player_AnimPlayOnce(play, this, - (this->currentYaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_downB + (this->yaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_downB : &gPlayerAnim_link_normal_back_downB); func_80832698(this, NA_SE_VO_LI_FREEZE); } @@ -8710,7 +8848,7 @@ void func_8084377C(Player* this, PlayState* play) { } } -void func_80843954(Player* this, PlayState* play) { +void Player_Action_80843954(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; func_808382BC(this); @@ -8718,25 +8856,25 @@ void func_80843954(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime) && (this->linearVelocity == 0.0f)) { if (this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) { - this->unk_850++; + this->av2.actionVar2++; } else { - Player_SetupAction(play, this, func_80843A38, 0); + Player_SetupAction(play, this, Player_Action_80843A38, 0); this->stateFlags1 |= PLAYER_STATE1_DAMAGED; } Player_AnimPlayOnceAdjusted(play, this, - (this->currentYaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_down_wake + (this->yaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_down_wake : &gPlayerAnim_link_normal_back_down_wake); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } } static AnimSfxEntry D_808545DC[] = { - { 0, 0x4014 }, - { 0, -0x401E }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_8, 30) }, }; -void func_80843A38(Player* this, PlayState* play) { +void Player_Action_80843A38(Player* this, PlayState* play) { s32 sp24; this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; @@ -8757,10 +8895,10 @@ void func_80843A38(Player* this, PlayState* play) { static Vec3f D_808545E4 = { 0.0f, 0.0f, 5.0f }; void func_80843AE8(PlayState* play, Player* this) { - if (this->unk_850 != 0) { - if (this->unk_850 > 0) { - this->unk_850--; - if (this->unk_850 == 0) { + if (this->av2.actionVar2 != 0) { + if (this->av2.actionVar2 > 0) { + this->av2.actionVar2--; + if (this->av2.actionVar2 == 0) { if (this->stateFlags1 & PLAYER_STATE1_IN_WATER) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_swimer_swim_wait, 1.0f, 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_swimer_swim_wait), ANIMMODE_ONCE, @@ -8779,7 +8917,7 @@ void func_80843AE8(PlayState* play, Player* this) { } else { gSaveContext.healthAccumulator = 0x140; } - this->unk_850 = -1; + this->av2.actionVar2 = -1; } } else if (gSaveContext.healthAccumulator == 0) { this->stateFlags1 &= ~PLAYER_STATE1_DEAD; @@ -8792,10 +8930,10 @@ void func_80843AE8(PlayState* play, Player* this) { func_80837AFC(this, -20); func_800F47FC(); } - } else if (this->unk_84F != 0) { - this->unk_850 = 60; + } else if (this->av1.actionVar1 != 0) { + this->av2.actionVar2 = 60; Player_SpawnFairy(play, this, &this->actor.world.pos, &D_808545E4, FAIRY_REVIVE_DEATH); - Player_PlaySfx(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); + Player_PlaySfx(this, NA_SE_EV_FIATY_HEAL - SFX_FLAG); OnePointCutscene_Init(play, 9908, 125, &this->actor, MAIN_CAM); } else if (play->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) { play->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU; @@ -8804,13 +8942,13 @@ void func_80843AE8(PlayState* play, Player* this) { } static AnimSfxEntry D_808545F0[] = { - { NA_SE_PL_BOUND, 0x103C }, - { 0, 0x408C }, - { 0, 0x40A4 }, - { 0, -0x40AA }, + { NA_SE_PL_BOUND, ANIMSFX_DATA(ANIMSFX_TYPE_2, 60) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 140) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 164) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_8, 170) }, }; -void func_80843CEC(Player* this, PlayState* play) { +void Player_Action_80843CEC(Player* this, PlayState* play) { if (this->currentTunic != PLAYER_TUNIC_GORON && CVarGetInteger("gSuperTunic", 0) == 0) { if ((play->roomCtx.curRoom.behaviorType2 == ROOM_BEHAVIOR_TYPE2_3) || (sFloorType == 9) || ((func_80838144(sFloorType) >= 0) && @@ -8882,8 +9020,8 @@ s32 func_80843E64(PlayState* play, Player* this) { func_80837AE0(this, 40); Player_RequestQuake(play, 32967, 2, 30); - Player_RequestRumble(this, impactInfo->unk_01, impactInfo->unk_02, impactInfo->unk_03, 0); - Player_PlaySfx(&this->actor, NA_SE_PL_BODY_HIT); + Player_RequestRumble(this, impactInfo->rumbleStrength, impactInfo->rumbleDuration, impactInfo->rumbleDecreaseRate, 0); + Player_PlaySfx(this, NA_SE_PL_BODY_HIT); func_80832698(this, impactInfo->sfxId); return impactIndex + 1; @@ -8916,12 +9054,12 @@ void func_8084409C(PlayState* play, Player* this, f32 speedXZ, f32 velocityY) { heldActor->speedXZ = speedXZ; heldActor->velocity.y = velocityY; func_80834644(play, this); - Player_PlaySfx(&this->actor, NA_SE_PL_THROW); + Player_PlaySfx(this, NA_SE_PL_THROW); func_80832698(this, NA_SE_VO_LI_SWORD_N); } } -void func_8084411C(Player* this, PlayState* play) { +void Player_Action_8084411C(Player* this, PlayState* play) { f32 sp4C; s16 sp4A; @@ -8931,7 +9069,7 @@ void func_8084411C(Player* this, PlayState* play) { this->actor.gravity = -1.2f; } - Player_GetMovementSpeedAndYaw(this, &sp4C, &sp4A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &sp4C, &sp4A, SPEED_MODE_LINEAR, play); if (!(this->actor.bgCheckFlags & 1)) { if (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { @@ -8955,10 +9093,10 @@ void func_8084411C(Player* this, PlayState* play) { Player_UpdateUpperBody(this, play); - if (((this->stateFlags2 & PLAYER_STATE2_HOPPING) && (this->unk_84F == 2)) || !func_8083BBA0(this, play)) { + if (((this->stateFlags2 & PLAYER_STATE2_HOPPING) && (this->av1.actionVar1 == 2)) || !func_8083BBA0(this, play)) { if (this->actor.velocity.y < 0.0f) { - if (this->unk_850 >= 0) { - if ((this->actor.bgCheckFlags & 8) || (this->unk_850 == 0) || (this->fallDistance > 0)) { + if (this->av2.actionVar2 >= 0) { + if ((this->actor.bgCheckFlags & 8) || (this->av2.actionVar2 == 0) || (this->fallDistance > 0)) { if ((sYDistToFloor > 800.0f) || (this->stateFlags1 & PLAYER_STATE1_HOOKSHOT_FALLING)) { func_80843E14(this, NA_SE_VO_LI_FALL_S); this->stateFlags1 &= ~PLAYER_STATE1_HOOKSHOT_FALLING; @@ -8966,11 +9104,11 @@ void func_8084411C(Player* this, PlayState* play) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_normal_landing, 1.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 8.0f); - this->unk_850 = -1; + this->av2.actionVar2 = -1; } } else { - if ((this->unk_850 == -1) && (this->fallDistance > 120.0f) && (sYDistToFloor > 280.0f)) { - this->unk_850 = -2; + if ((this->av2.actionVar2 == -1) && (this->fallDistance > 120.0f) && (sYDistToFloor > 280.0f)) { + this->av2.actionVar2 = -2; func_80843E14(this, NA_SE_VO_LI_FALL_L); } @@ -8979,7 +9117,7 @@ void func_8084411C(Player* this, PlayState* play) { !(this->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_WATER)) && (this->linearVelocity > 0.0f)) { if ((this->yDistToLedge >= 150.0f) && (this->unk_84B[this->unk_846] == 0)) { func_8083EC18(this, play, sTouchedWallFlags); - } else if ((this->unk_88C >= 2) && (this->yDistToLedge < 150.0f) && + } else if ((this->ledgeClimbType >= 2) && (this->yDistToLedge < 150.0f) && (((this->actor.world.pos.y - this->actor.floorHeight) + this->yDistToLedge) > (70.0f * this->ageProperties->unk_08))) { AnimationContext_DisableQueue(play); @@ -8991,7 +9129,7 @@ void func_8084411C(Player* this, PlayState* play) { this->actor.world.pos.y += this->yDistToLedge; func_8083A5C4(play, this, this->actor.wallPoly, this->distToInteractWall, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_jump_climb_hold, this->modelAnimType)); - this->actor.shape.rot.y = this->currentYaw += 0x8000; + this->actor.shape.rot.y = this->yaw += 0x8000; this->stateFlags1 |= PLAYER_STATE1_HANGING_OFF_LEDGE; } } @@ -9004,9 +9142,9 @@ void func_8084411C(Player* this, PlayState* play) { if (this->stateFlags2 & PLAYER_STATE2_HOPPING) { if (func_8008E9C4(this)) { - anim = D_80853D4C[this->unk_84F][2]; + anim = D_80853D4C[this->av1.actionVar1][2]; } else { - anim = D_80853D4C[this->unk_84F][1]; + anim = D_80853D4C[this->av1.actionVar1][1]; } } else if (this->skelAnime.animation == &gPlayerAnim_link_normal_run_jump) { anim = &gPlayerAnim_link_normal_run_jump_end; @@ -9027,9 +9165,9 @@ void func_8084411C(Player* this, PlayState* play) { func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_landing, this->modelAnimType), play); this->skelAnime.endFrame = 8.0f; if (sp3C == 1) { - this->unk_850 = 10; + this->av2.actionVar2 = 10; } else { - this->unk_850 = 20; + this->av2.actionVar2 = 20; } } else if (sp3C == 0) { func_8083A098(this, anim, play); @@ -9038,13 +9176,13 @@ void func_8084411C(Player* this, PlayState* play) { } static AnimSfxEntry D_8085460C[] = { - { NA_SE_VO_LI_SWORD_N, 0x2001 }, - { NA_SE_PL_WALK_GROUND, 0x1806 }, - { NA_SE_PL_ROLL, 0x806 }, - { 0, -0x2812 }, + { NA_SE_VO_LI_SWORD_N, ANIMSFX_DATA(ANIMSFX_TYPE_4, 1) }, + { NA_SE_PL_WALK_GROUND, ANIMSFX_DATA(ANIMSFX_TYPE_3, 6) }, + { NA_SE_PL_ROLL, ANIMSFX_DATA(ANIMSFX_TYPE_1, 6) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_5, 18) }, }; -void func_80844708(Player* this, PlayState* play) { +void Player_Action_80844708(Player* this, PlayState* play) { Actor* cylinderOc; s32 temp; s32 sp44; @@ -9063,7 +9201,7 @@ void func_80844708(Player* this, PlayState* play) { } if (func_80842964(this, play) == 0) { - if (this->unk_850 != 0) { + if (this->av2.actionVar2 != 0) { Math_StepToF(&this->linearVelocity, 0.0f, 2.0f); temp = func_808374A0(play, this, &this->skelAnime, 5.0f); @@ -9093,22 +9231,22 @@ void func_80844708(Player* this, PlayState* play) { this->linearVelocity = -this->linearVelocity; Player_RequestQuake(play, 33267, 3, 12); Player_RequestRumble(this, 255, 20, 150, 0); - Player_PlaySfx(&this->actor, NA_SE_PL_BODY_HIT); + Player_PlaySfx(this, NA_SE_PL_BODY_HIT); func_80832698(this, NA_SE_VO_LI_CLIMB_END); - this->unk_850 = 1; + this->av2.actionVar2 = 1; gSaveContext.sohStats.count[COUNT_BONKS]++; GameInteractor_ExecuteOnPlayerBonk(); return; } } - if ((this->skelAnime.curFrame < 15.0f) || !func_80850224(this, play)) { + if ((this->skelAnime.curFrame < 15.0f) || !Player_ActionChange_7(this, play)) { if (this->skelAnime.curFrame >= 20.0f) { func_8083A060(this, play); return; } - Player_GetMovementSpeedAndYaw(this, &sp38, &sp36, 0.018f, play); + Player_GetMovementSpeedAndYaw(this, &sp38, &sp36, SPEED_MODE_CURVED, play); sp38 *= 1.5f; if ((sp38 < 3.0f) || (this->unk_84B[this->unk_846] != 0)) { @@ -9127,7 +9265,7 @@ void func_80844708(Player* this, PlayState* play) { } } -void func_80844A44(Player* this, PlayState* play) { +void Player_Action_80844A44(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -9142,7 +9280,7 @@ void func_80844A44(Player* this, PlayState* play) { } } -void func_80844AF4(Player* this, PlayState* play) { +void Player_Action_80844AF4(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; @@ -9155,8 +9293,8 @@ void func_80844AF4(Player* this, PlayState* play) { func_8084285C(this, 6.0f, 7.0f, 99.0f); if (!(this->actor.bgCheckFlags & 1)) { - Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, 0.0f, play); - func_8083DFE0(this, &sp2C, &this->currentYaw); + Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, SPEED_MODE_LINEAR, play); + func_8083DFE0(this, &sp2C, &this->yaw); return; } @@ -9198,32 +9336,32 @@ s32 func_80844BE4(Player* this, PlayState* play) { } void func_80844CF8(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_80845000, 1); + Player_SetupAction(play, this, Player_Action_80845000, 1); } void func_80844D30(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_80845308, 1); + Player_SetupAction(play, this, Player_Action_80845308, 1); } void func_80844D68(Player* this, PlayState* play) { func_80839FFC(this, play); func_80832318(this); Player_AnimChangeOnceMorph(play, this, D_80854368[Player_HoldsTwoHandedWeapon(this)]); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } void func_80844DC8(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_80844E68, 1); + Player_SetupAction(play, this, Player_Action_80844E68, 1); this->unk_868 = 0.0f; Player_AnimPlayLoop(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); - this->unk_850 = 1; + this->av2.actionVar2 = 1; } void func_80844E3C(Player* this) { Math_StepToF(&this->unk_858, 1.0f, 0.02f); } -void func_80844E68(Player* this, PlayState* play) { +void Player_Action_80844E68(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; @@ -9235,23 +9373,23 @@ void func_80844E68(Player* this, PlayState* play) { func_808355DC(this); this->stateFlags1 &= ~PLAYER_STATE1_TARGET_NOTHING; Player_AnimPlayLoop(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); - this->unk_850 = -1; + this->av2.actionVar2 = -1; } func_8083721C(this); - if (!func_80842964(this, play) && (this->unk_850 != 0)) { + if (!func_80842964(this, play) && (this->av2.actionVar2 != 0)) { func_80844E3C(this); - if (this->unk_850 < 0) { + if (this->av2.actionVar2 < 0) { if (this->unk_858 >= 0.1f) { this->unk_845 = 0; - this->unk_850 = 1; + this->av2.actionVar2 = 1; } else if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { func_80844D68(this, play); } } else if (!func_80844BE4(this, play)) { - Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_LINEAR, play); temp = func_80840058(this, &sp34, &sp32, play); if (temp > 0) { @@ -9263,7 +9401,7 @@ void func_80844E68(Player* this, PlayState* play) { } } -void func_80845000(Player* this, PlayState* play) { +void Player_Action_80845000(Player* this, PlayState* play) { s16 temp1; s32 temp2; f32 sp5C; @@ -9274,7 +9412,7 @@ void func_80845000(Player* this, PlayState* play) { s16 temp5; s32 sp44; - temp1 = this->currentYaw - this->actor.shape.rot.y; + temp1 = this->yaw - this->actor.shape.rot.y; temp2 = ABS(temp1); sp5C = fabsf(this->linearVelocity); @@ -9298,7 +9436,7 @@ void func_80845000(Player* this, PlayState* play) { if (!func_80842964(this, play) && !func_80844BE4(this, play)) { func_80844E3C(this); - Player_GetMovementSpeedAndYaw(this, &sp54, &sp52, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &sp54, &sp52, SPEED_MODE_LINEAR, play); temp4 = func_80840058(this, &sp54, &sp52, play); @@ -9309,21 +9447,21 @@ void func_80845000(Player* this, PlayState* play) { if (temp4 == 0) { sp54 = 0.0f; - sp52 = this->currentYaw; + sp52 = this->yaw; } - temp5 = sp52 - this->currentYaw; + temp5 = sp52 - this->yaw; sp44 = ABS(temp5); if (sp44 > 0x4000) { if (Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { - this->currentYaw = sp52; + this->yaw = sp52; } return; } Math_AsymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f); - Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f); + Math_ScaledStepToS(&this->yaw, sp52, sp44 * 0.1f); if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f)) { func_80844DC8(this, play); @@ -9331,7 +9469,7 @@ void func_80845000(Player* this, PlayState* play) { } } -void func_80845308(Player* this, PlayState* play) { +void Player_Action_80845308(Player* this, PlayState* play) { f32 sp5C; f32 sp58; f32 sp54; @@ -9366,7 +9504,7 @@ void func_80845308(Player* this, PlayState* play) { if (!func_80842964(this, play) && !func_80844BE4(this, play)) { func_80844E3C(this); - Player_GetMovementSpeedAndYaw(this, &sp54, &sp52, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &sp54, &sp52, SPEED_MODE_LINEAR, play); temp4 = func_80840058(this, &sp54, &sp52, play); @@ -9377,21 +9515,21 @@ void func_80845308(Player* this, PlayState* play) { if (temp4 == 0) { sp54 = 0.0f; - sp52 = this->currentYaw; + sp52 = this->yaw; } - temp5 = sp52 - this->currentYaw; + temp5 = sp52 - this->yaw; sp44 = ABS(temp5); if (sp44 > 0x4000) { if (Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { - this->currentYaw = sp52; + this->yaw = sp52; } return; } Math_AsymStepToF(&this->linearVelocity, sp54 * 0.2f, 1.0f, 0.5f); - Math_ScaledStepToS(&this->currentYaw, sp52, sp44 * 0.1f); + Math_ScaledStepToS(&this->yaw, sp52, sp44 * 0.1f); if ((sp54 == 0.0f) && (this->linearVelocity == 0.0f) && (sp5C == 0.0f)) { func_80844DC8(this, play); @@ -9399,7 +9537,7 @@ void func_80845308(Player* this, PlayState* play) { } } -void func_80845668(Player* this, PlayState* play) { +void Player_Action_80845668(Player* this, PlayState* play) { s32 sp3C; f32 temp1; s32 temp2; @@ -9429,7 +9567,7 @@ void func_80845668(Player* this, PlayState* play) { } func_80838940(this, NULL, temp1, play, NA_SE_VO_LI_AUTO_JUMP); - this->unk_850 = -1; + this->av2.actionVar2 = -1; return; } } else { @@ -9465,16 +9603,16 @@ void func_80845668(Player* this, PlayState* play) { } if ((this->skelAnime.animation == &gPlayerAnim_link_normal_100step_up) || (this->skelAnime.curFrame > 5.0f)) { - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { func_80832854(this); - this->unk_850 = 1; + this->av2.actionVar2 = 1; } Math_StepToF(&this->actor.shape.yOffset, 0.0f, 150.0f); } } } -void func_808458D0(Player* this, PlayState* play) { +void Player_Action_808458D0(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; LinkAnimation_Update(play, &this->skelAnime); @@ -9551,26 +9689,26 @@ s32 func_80845C68(PlayState* play, s32 arg1) { return arg1; } -void func_80845CA4(Player* this, PlayState* play) { +void Player_Action_80845CA4(Player* this, PlayState* play) { f32 sp3C; s32 temp; f32 sp34; s32 sp30; s32 pad; - if (!func_8083B040(this, play)) { - if (this->unk_850 == 0) { + if (!Player_ActionChange_13(this, play)) { + if (this->av2.actionVar2 == 0) { LinkAnimation_Update(play, &this->skelAnime); if (DECR(this->doorTimer) == 0) { this->linearVelocity = 0.1f; - this->unk_850 = 1; + this->av2.actionVar2 = 1; } - } else if (this->unk_84F == 0) { + } else if (this->av1.actionVar1 == 0) { sp3C = 5.0f * D_808535E8; if (func_80845BA0(play, this, &sp3C, -1) < 30) { - this->unk_84F = 1; + this->av1.actionVar1 = 1; this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; this->unk_450.x = this->unk_45C.x; @@ -9587,8 +9725,8 @@ void func_80845CA4(Player* this, PlayState* play) { this->unk_450.x = (Math_SinS(sConveyorYaw) * 400.0f) + this->actor.world.pos.x; this->unk_450.z = (Math_CosS(sConveyorYaw) * 400.0f) + this->actor.world.pos.z; } - } else if (this->unk_850 < 0) { - this->unk_850++; + } else if (this->av2.actionVar2 < 0) { + this->av2.actionVar2++; sp34 = gSaveContext.entranceSpeed; sp30 = -1; @@ -9596,13 +9734,13 @@ void func_80845CA4(Player* this, PlayState* play) { temp = func_80845BA0(play, this, &sp34, sp30); - if ((this->unk_850 == 0) || + if ((this->av2.actionVar2 == 0) || ((temp == 0) && (this->linearVelocity == 0.0f) && (Play_GetCamera(play, 0)->unk_14C & 0x10))) { func_8005B1A4(Play_GetCamera(play, 0)); func_80845C68(play, gSaveContext.respawn[RESPAWN_MODE_DOWN].data); - if (!func_8083B644(this, play)) { + if (!Player_ActionChange_4(this, play)) { func_8083CF5C(this, play); } } @@ -9614,7 +9752,7 @@ void func_80845CA4(Player* this, PlayState* play) { } } -void func_80845EF8(Player* this, PlayState* play) { +void Player_Action_80845EF8(Player* this, PlayState* play) { s32 sp2C; this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; @@ -9623,9 +9761,9 @@ void func_80845EF8(Player* this, PlayState* play) { Player_UpdateUpperBody(this, play); if (sp2C) { - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { if (DECR(this->doorTimer) == 0) { - this->unk_850 = 1; + this->av2.actionVar2 = 1; this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } } else { @@ -9644,7 +9782,7 @@ void func_80845EF8(Player* this, PlayState* play) { } } -void func_80846050(Player* this, PlayState* play) { +void Player_Action_80846050(Player* this, PlayState* play) { func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -9670,13 +9808,13 @@ void func_80846050(Player* this, PlayState* play) { } static AnimSfxEntry D_8085461C[] = { - { NA_SE_VO_LI_SWORD_L, 0x2031 }, - { NA_SE_VO_LI_SWORD_N, -0x20E6 }, + { NA_SE_VO_LI_SWORD_L, ANIMSFX_DATA(ANIMSFX_TYPE_4, 49) }, + { NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 230) }, }; -void func_80846120(Player* this, PlayState* play) { - if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_850++ > 20)) { - if (!func_8083B040(this, play)) { +void Player_Action_80846120(Player* this, PlayState* play) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->av2.actionVar2++ > 20)) { + if (!Player_ActionChange_13(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_heavy_carry_end, play); } return; @@ -9710,12 +9848,12 @@ void func_80846120(Player* this, PlayState* play) { Player_ProcessAnimSfxList(this, D_8085461C); } -void func_80846260(Player* this, PlayState* play) { +void Player_Action_80846260(Player* this, PlayState* play) { func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_silver_wait); - this->unk_850 = 1; + this->av2.actionVar2 = 1; return; } @@ -9723,7 +9861,7 @@ void func_80846260(Player* this, PlayState* play) { if (CVarGetInteger("gDpadEquips", 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 27.0f)) { Actor* interactRangeActor = this->interactRangeActor; @@ -9739,12 +9877,12 @@ void func_80846260(Player* this, PlayState* play) { } } else if (CHECK_BTN_ANY(sControlInput->press.button, buttonsToCheck)) { - Player_SetupAction(play, this, func_80846358, 1); + Player_SetupAction(play, this, Player_Action_80846358, 1); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_silver_throw); } } -void func_80846358(Player* this, PlayState* play) { +void Player_Action_80846358(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80839F90(this, play); return; @@ -9757,21 +9895,21 @@ void func_80846358(Player* this, PlayState* play) { heldActor->speedXZ = 10.0f; heldActor->velocity.y = 20.0f; func_80834644(play, this); - Player_PlaySfx(&this->actor, NA_SE_PL_THROW); + Player_PlaySfx(this, NA_SE_PL_THROW); func_80832698(this, NA_SE_VO_LI_SWORD_N); } } -void func_80846408(Player* this, PlayState* play) { +void Player_Action_80846408(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_nocarry_free_wait); - this->unk_850 = 15; + this->av2.actionVar2 = 15; return; } - if (this->unk_850 != 0) { - this->unk_850--; - if (this->unk_850 == 0) { + if (this->av2.actionVar2 != 0) { + this->av2.actionVar2--; + if (this->av2.actionVar2 == 0) { func_8083A098(this, &gPlayerAnim_link_normal_nocarry_free_end, play); this->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; func_80832698(this, NA_SE_VO_LI_DAMAGE_S); @@ -9779,7 +9917,7 @@ void func_80846408(Player* this, PlayState* play) { } } -void func_808464B0(Player* this, PlayState* play) { +void Player_Action_808464B0(Player* this, PlayState* play) { func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -9801,14 +9939,14 @@ void func_808464B0(Player* this, PlayState* play) { } } -void func_80846578(Player* this, PlayState* play) { +void Player_Action_80846578(Player* this, PlayState* play) { f32 sp34; s16 sp32; func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime) || - ((this->skelAnime.curFrame >= 8.0f) && Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, 0.018f, play))) { + ((this->skelAnime.curFrame >= 8.0f) && Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_CURVED, play))) { func_80839F90(this, play); return; } @@ -9887,9 +10025,9 @@ void func_80846648(PlayState* play, Player* this) { } void func_80846660(PlayState* play, Player* this) { - Player_SetupAction(play, this, func_8084F710, 0); + Player_SetupAction(play, this, Player_Action_8084F710, 0); if ((play->sceneNum == SCENE_LAKE_HYLIA) && (gSaveContext.sceneSetupIndex >= 4)) { - this->unk_84F = 1; + this->av1.actionVar1 = 1; } this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, 2.0f / 3.0f, 0.0f, 24.0f, @@ -9913,34 +10051,34 @@ void func_80846720(PlayState* play, Player* this, s32 arg2) { func_80834644(play, this); if (arg2 != 0) { - Player_PlaySfx(&this->actor, NA_SE_IT_SWORD_PICKOUT); + Player_PlaySfx(this, NA_SE_IT_SWORD_PICKOUT); } } static Vec3f D_808546F4 = { -1.0f, 69.0f, 20.0f }; void func_808467D4(PlayState* play, Player* this) { - Player_SetupAction(play, this, func_8084E9AC, 0); + Player_SetupAction(play, this, Player_Action_8084E9AC, 0); this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; Math_Vec3f_Copy(&this->actor.world.pos, &D_808546F4); - this->currentYaw = this->actor.shape.rot.y = -0x8000; + this->yaw = this->actor.shape.rot.y = -0x8000; LinkAnimation_Change(play, &this->skelAnime, this->ageProperties->unk_A0, 2.0f / 3.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); Player_AnimReplaceApplyFlags(play, this, 0x28F); if (LINK_IS_ADULT) { func_80846720(play, this, 0); } - this->unk_850 = 20; + this->av2.actionVar2 = 20; } void func_808468A8(PlayState* play, Player* this) { - Player_SetupAction(play, this, func_8084F9A0, 0); + Player_SetupAction(play, this, Player_Action_8084F9A0, 0); Player_AnimReplaceApplyFlags(play, this, 0x9B); } void func_808468E8(PlayState* play, Player* this) { func_808389E8(this, &gPlayerAnim_link_normal_jump, 12.0f, play); - Player_SetupAction(play, this, func_8084F9C0, 0); + Player_SetupAction(play, this, Player_Action_8084F9C0, 0); this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; this->fallStartHeight = this->actor.world.pos.y; OnePointCutscene_Init(play, 5110, 40, &this->actor, MAIN_CAM); @@ -9951,7 +10089,7 @@ void func_80846978(PlayState* play, Player* this) { } void func_808469BC(PlayState* play, Player* this) { - Player_SetupAction(play, this, func_8084F698, 0); + Player_SetupAction(play, this, Player_Action_8084F698, 0); this->actor.draw = NULL; this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; } @@ -9965,7 +10103,7 @@ Actor* func_80846A00(PlayState* play, Player* this, s32 arg2) { void func_80846A68(PlayState* play, Player* this) { this->actor.draw = NULL; - Player_SetupAction(play, this, func_8085076C, 0); + Player_SetupAction(play, this, Player_Action_8085076C, 0); this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; } @@ -9985,7 +10123,7 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe this->ageProperties = &sAgeProperties[gSaveContext.linkAge]; Actor_ProcessInitChain(&this->actor, sInitChain); this->meleeWeaponEffectIndex = TOTAL_EFFECT_COUNT; - this->currentYaw = this->actor.world.rot.y; + this->yaw = this->actor.world.rot.y; func_80834644(play, this); SkelAnime_InitLink(play, &this->skelAnime, skelHeader, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType), 9, @@ -10079,7 +10217,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { Math_Vec3f_Copy(&thisx->home.pos, &thisx->world.pos); Math_Vec3f_Copy(&thisx->prevPos, &thisx->world.pos); this->fallStartHeight = thisx->world.pos.y; - this->currentYaw = thisx->shape.rot.y = gSaveContext.respawn[sp4C].yaw; + this->yaw = thisx->shape.rot.y = gSaveContext.respawn[sp4C].yaw; thisx->params = gSaveContext.respawn[sp4C].playerParams; } @@ -10224,7 +10362,7 @@ void func_808473D4(PlayState* play, Player* this) { if (this->unk_860 == 2) { doAction = DO_ACTION_REEL; } - } else if ((func_8084E3C4 != this->actionFunc) && !(this->stateFlags2 & PLAYER_STATE2_CRAWLING)) { + } else if ((Player_Action_8084E3C4 != this->actionFunc) && !(this->stateFlags2 & PLAYER_STATE2_CRAWLING)) { if ((this->doorType != PLAYER_DOORTYPE_NONE) && (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) || ((heldActor != NULL) && (heldActor->id == ACTOR_EN_RU1)))) { @@ -10246,7 +10384,7 @@ void func_808473D4(PlayState* play, Player* this) { (!(this->stateFlags1 & PLAYER_STATE1_ON_HORSE) && (this->rideActor != NULL))) { doAction = DO_ACTION_CLIMB; } else if ((this->stateFlags1 & PLAYER_STATE1_ON_HORSE) && !EN_HORSE_CHECK_4((EnHorse*)this->rideActor) && - (func_8084D3E4 != this->actionFunc)) { + (Player_Action_8084D3E4 != this->actionFunc)) { if ((this->stateFlags2 & PLAYER_STATE2_SPEAK_OR_CHECK) && (this->targetActor != NULL)) { if (this->targetActor->category == ACTORCAT_NPC) { doAction = DO_ACTION_SPEAK; @@ -10397,16 +10535,16 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { f32 ceilingCheckHeight; u32 flags; - sPrevFloorProperty = this->unk_A7A; + sPrevFloorProperty = this->floorProperty; if (this->stateFlags2 & PLAYER_STATE2_CRAWLING) { spB0 = 10.0f; spAC = 15.0f; ceilingCheckHeight = 30.0f; } else { - spB0 = this->ageProperties->unk_38; + spB0 = this->ageProperties->wallCheckRadius; spAC = 26.0f; - ceilingCheckHeight = this->ageProperties->unk_00; + ceilingCheckHeight = this->ageProperties->ceilingCheckHeight; } if (this->stateFlags1 & (PLAYER_STATE1_IN_CUTSCENE | PLAYER_STATE1_FLOOR_DISABLED)) { @@ -10416,7 +10554,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { } else if ((this->stateFlags1 & PLAYER_STATE1_LOADING) && ((this->unk_A84 - (s32)this->actor.world.pos.y) >= 100)) { flags = 0x39; } else if (!(this->stateFlags1 & PLAYER_STATE1_LOADING) && - ((func_80845EF8 == this->actionFunc) || (func_80845CA4 == this->actionFunc))) { + ((Player_Action_80845EF8 == this->actionFunc) || (Player_Action_80845CA4 == this->actionFunc))) { this->actor.bgCheckFlags &= ~0x208; flags = 0x3C; } else { @@ -10447,8 +10585,8 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { floorPoly = this->actor.floorPoly; if (floorPoly != NULL) { - this->unk_A7A = func_80041EA4(&play->colCtx, floorPoly, this->actor.floorBgId); - this->unk_A82 = this->floorSfxOffset; + this->floorProperty = func_80041EA4(&play->colCtx, floorPoly, this->actor.floorBgId); + this->prevFloorSfxOffset = this->floorSfxOffset; if (this->actor.bgCheckFlags & 0x20) { if (this->actor.yDistToWater < 20.0f) { @@ -10499,7 +10637,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { s32 pad; sInteractWallCheckOffset.y = 18.0f; - sInteractWallCheckOffset.z = this->ageProperties->unk_38 + 10.0f; + sInteractWallCheckOffset.z = this->ageProperties->wallCheckRadius + 10.0f; if (!(this->stateFlags2 & PLAYER_STATE2_CRAWLING) && Player_PosVsWallLineTest(play, this, &sInteractWallCheckOffset, &wallPoly, &wallBgId, &sInteractWallCheckResult)) { @@ -10567,7 +10705,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { sShapeYawToTouchedWall = ABS(yawDiff); - yawDiff = this->currentYaw - (s16)(this->actor.wallYaw + 0x8000); + yawDiff = this->yaw - (s16)(this->actor.wallYaw + 0x8000); sWorldYawToTouchedWall = ABS(yawDiff); @@ -10641,17 +10779,17 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { } } else { this->unk_880 = R_RUN_SPEED_LIMIT / 100.0f; - this->unk_88D = 0; + this->ledgeClimbDelayTimer = 0; this->yDistToLedge = 0.0f; } - if (nextLedgeClimbType == this->unk_88C) { - if ((this->linearVelocity != 0.0f) && (this->unk_88D < 100)) { - this->unk_88D++; + if (nextLedgeClimbType == this->ledgeClimbType) { + if ((this->linearVelocity != 0.0f) && (this->ledgeClimbDelayTimer < 100)) { + this->ledgeClimbDelayTimer++; } } else { - this->unk_88C = nextLedgeClimbType; - this->unk_88D = 0; + this->ledgeClimbType = nextLedgeClimbType; + this->ledgeClimbDelayTimer = 0; } if (this->actor.bgCheckFlags & 1) { @@ -10674,8 +10812,8 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { sp54 = 1.0f / COLPOLY_GET_NORMAL(floorPoly->normal.y); sp50 = COLPOLY_GET_NORMAL(floorPoly->normal.z); - sp4C = Math_SinS(this->currentYaw); - sp44 = Math_CosS(this->currentYaw); + sp4C = Math_SinS(this->yaw); + sp44 = Math_CosS(this->yaw); this->floorPitch = Math_Atan2S(1.0f, (-(sp58 * sp4C) - (sp50 * sp44)) * sp54); this->floorPitchAlt = Math_Atan2S(1.0f, (-(sp58 * sp44) - (sp50 * sp4C)) * sp54); @@ -10691,11 +10829,11 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { Player_UpdateHoverBoots(this); } - if (this->unk_A7B == sFloorType) { - this->unk_A79++; + if (this->prevFloorType == sFloorType) { + this->floorTypeTimer++; } else { - this->unk_A7B = sFloorType; - this->unk_A79 = 0; + this->prevFloorType = sFloorType; + this->floorTypeTimer = 0; } } @@ -10714,7 +10852,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { if ((this->actor.parent != NULL) && (this->stateFlags3 & PLAYER_STATE3_HOOKSHOT_TRAVELLING)) { camMode = CAM_MODE_HOOKSHOT; Camera_SetParam(Play_GetCamera(play, 0), 8, this->actor.parent); - } else if (func_8084377C == this->actionFunc) { + } else if (Player_Action_8084377C == this->actionFunc) { camMode = CAM_MODE_STILL; } else if (this->stateFlags2 & PLAYER_STATE2_GRABBING_DYNAPOLY) { camMode = CAM_MODE_PUSHPULL; @@ -10751,7 +10889,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { camMode = CAM_MODE_TARGET; } } else if (this->stateFlags1 & (PLAYER_STATE1_JUMPING | PLAYER_STATE1_CLIMBING_LADDER)) { - if ((func_80845668 == this->actionFunc) || (this->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER)) { + if ((Player_Action_80845668 == this->actionFunc) || (this->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER)) { camMode = CAM_MODE_CLIMB; } else { camMode = CAM_MODE_JUMP; @@ -10826,16 +10964,16 @@ void func_80848A04(PlayState* play, Player* this) { 0, 8); } -void func_80848B44(PlayState* play, Player* this) { +void Player_UpdateBodyShock(PlayState* play, Player* this) { Vec3f shockPos; Vec3f* randBodyPart; s32 shockScale; - this->shockTimer--; - this->unk_892 += this->shockTimer; + this->bodyShockTimer--; + this->unk_892 += this->bodyShockTimer; if (this->unk_892 > 20) { - shockScale = this->shockTimer * 2; + shockScale = this->bodyShockTimer * 2; this->unk_892 -= 20; if (shockScale > 40) { @@ -10852,7 +10990,7 @@ void func_80848B44(PlayState* play, Player* this) { } } -void func_80848C74(PlayState* play, Player* this) { +void Player_UpdateBodyBurn(PlayState* play, Player* this) { s32 spawnedFlame; u8* timerPtr; s32 timerStep; @@ -10870,7 +11008,7 @@ void func_80848C74(PlayState* play, Player* this) { } spawnedFlame = false; - timerPtr = this->flameTimers; + timerPtr = this->bodyFlameTimers; if (this->stateFlags2 & PLAYER_STATE2_FOOTSTEP) { sp58 = 100; @@ -10903,7 +11041,7 @@ void func_80848C74(PlayState* play, Player* this) { } if (spawnedFlame) { - Player_PlaySfx(&this->actor, NA_SE_EV_TORCH - SFX_FLAG); + Player_PlaySfx(this, NA_SE_EV_TORCH - SFX_FLAG); if (play->sceneNum == SCENE_SPIRIT_TEMPLE_BOSS) { dmgCooldown = 0; @@ -10915,7 +11053,7 @@ void func_80848C74(PlayState* play, Player* this) { Player_InflictDamage(play, -1); } } else { - this->isBurning = false; + this->bodyIsBurning = false; } } @@ -11124,12 +11262,12 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->unk_860++; } - if (this->shockTimer != 0) { - func_80848B44(play, this); + if (this->bodyShockTimer != 0) { + Player_UpdateBodyShock(play, this); } - if (this->isBurning) { - func_80848C74(play, this); + if (this->bodyIsBurning) { + Player_UpdateBodyBurn(play, this); } if ((this->stateFlags3 & PLAYER_STATE3_RESTORE_NAYRUS_LOVE) && (gSaveContext.nayrusLoveTimer != 0) && (gSaveContext.magicState == MAGIC_STATE_IDLE)) { @@ -11175,7 +11313,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->stateFlags1 |= PLAYER_STATE1_ON_HORSE; Player_AnimPlayOnce(play, this, &gPlayerAnim_link_uma_wait_1); Player_AnimReplaceApplyFlags(play, this, 0x9B); - this->unk_850 = 99; + this->av2.actionVar2 = 99; } if (this->unk_844 == 0) { @@ -11204,7 +11342,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { ((this->currentBoots == PLAYER_BOOTS_HOVER || GameInteractor_GetSlipperyFloorActive()) && !(this->stateFlags1 & (PLAYER_STATE1_IN_WATER | PLAYER_STATE1_IN_CUTSCENE)))) { f32 sp70 = this->linearVelocity; - s16 sp6E = this->currentYaw; + s16 sp6E = this->yaw; s16 yawDiff = this->actor.world.rot.y - sp6E; s32 pad; @@ -11214,7 +11352,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } if (Math_StepToF(&this->actor.speedXZ, sp70, 0.35f) && (sp70 == 0.0f)) { - this->actor.world.rot.y = this->currentYaw; + this->actor.world.rot.y = this->yaw; } if (this->linearVelocity != 0.0f) { @@ -11231,14 +11369,14 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } } else { this->actor.speedXZ = this->linearVelocity; - this->actor.world.rot.y = this->currentYaw; + this->actor.world.rot.y = this->yaw; } func_8002D868(&this->actor); if ((this->pushedSpeed != 0.0f) && !Player_InCsMode(play) && !(this->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_CLIMBING_LADDER)) && - (func_80845668 != this->actionFunc) && (func_808507F4 != this->actionFunc)) { + (Player_Action_80845668 != this->actionFunc) && (Player_Action_808507F4 != this->actionFunc)) { this->actor.velocity.x += this->pushedSpeed * Math_SinS(this->pushedYaw); this->actor.velocity.z += this->pushedSpeed * Math_CosS(this->pushedYaw); } @@ -11247,7 +11385,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Player_ProcessSceneCollision(play, this); } else { sFloorType = 0; - this->unk_A7A = 0; + this->floorProperty = 0; if (!(this->stateFlags1 & PLAYER_STATE1_LOADING) && (this->stateFlags1 & PLAYER_STATE1_ON_HORSE)) { EnHorse* rideActor = (EnHorse*)this->rideActor; @@ -11308,7 +11446,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } else if ((this->actor.bgCheckFlags & 1) || (this->stateFlags1 & PLAYER_STATE1_IN_WATER)) { func_80836448(play, this, func_808332B8(this) ? &gPlayerAnim_link_swimer_swim_down - : (this->shockTimer != 0) ? &gPlayerAnim_link_normal_electric_shock_end + : (this->bodyShockTimer != 0) ? &gPlayerAnim_link_normal_electric_shock_end : &gPlayerAnim_link_derth_rebirth); } } else { @@ -11341,7 +11479,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { if ((this->csAction != 7) || !(this->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_CLIMBING_LADDER | PLAYER_STATE1_DAMAGED))) { this->unk_6AD = 3; - } else if (func_80852E14 != this->actionFunc) { + } else if (Player_Action_CsAction != this->actionFunc) { func_80852944(play, this, NULL); } } else { @@ -11815,7 +11953,7 @@ void Player_Draw(Actor* thisx, PlayState* play2) { } if (this->stateFlags2 & PLAYER_STATE2_FROZEN) { - f32 scale = (this->unk_84F >> 1) * 22.0f; + f32 scale = (this->av1.actionVar1 >> 1) * 22.0f; gSPSegment(POLY_XLU_DISP++, 0x08, Gfx_TwoTexScroll(play->state.gfxCtx, 0, 0, (0 - play->gameplayFrames) % 128, 32, 32, 1, @@ -12000,7 +12138,7 @@ void func_8084AEEC(Player* this, f32* arg1, f32 arg2, s16 arg3) { } Math_AsymStepToF(arg1, arg2 * 0.8f * swimMod, temp1, (fabsf(*arg1) * 0.02f) + 0.05f); - Math_ScaledStepToS(&this->currentYaw, arg3, 1600); + Math_ScaledStepToS(&this->yaw, arg3, 1600); // #endregion } else { @@ -12019,7 +12157,7 @@ void func_8084AEEC(Player* this, f32* arg1, f32 arg2, s16 arg3) { } Math_AsymStepToF(arg1, arg2 * 0.8f, temp1, (fabsf(*arg1) * 0.02f) + 0.05f); - Math_ScaledStepToS(&this->currentYaw, arg3, 1600); + Math_ScaledStepToS(&this->yaw, arg3, 1600); } } @@ -12045,7 +12183,7 @@ void SurfaceWithoutSwimMod(Player* this, f32* arg1, f32 arg2, s16 arg3) { } Math_AsymStepToF(arg1, arg2 * 0.8f, temp1, (fabsf(*arg1) * 0.02f) + 0.05f); - Math_ScaledStepToS(&this->currentYaw, arg3, 1600); + Math_ScaledStepToS(&this->yaw, arg3, 1600); } // #endregion @@ -12117,7 +12255,7 @@ void func_8084B158(PlayState* play, Player* this, Input* input, f32 arg3) { LinkAnimation_Update(play, &this->skelAnime); } -void func_8084B1D8(Player* this, PlayState* play) { +void Player_Action_8084B1D8(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_IN_WATER) { func_8084B000(this); func_8084AEEC(this, &this->linearVelocity, 0, this->actor.shape.rot.y); @@ -12140,7 +12278,7 @@ void func_8084B1D8(Player* this, PlayState* play) { ((this->unk_6AD == 1) && CHECK_BTN_ANY(sControlInput->press.button, buttonsToCheck)))) { func_8083C148(this, play); func_80078884(NA_SE_SY_CAMERA_ZOOM_UP); - } else if ((DECR(this->unk_850) == 0) || (this->unk_6AD != 2)) { + } else if ((DECR(this->av2.actionVar2) == 0) || (this->unk_6AD != 2)) { if (func_8008F128(this)) { this->unk_6AE |= 0x43; } else { @@ -12148,13 +12286,13 @@ void func_8084B1D8(Player* this, PlayState* play) { } } - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } s32 func_8084B3CC(PlayState* play, Player* this) { if (play->shootingGalleryStatus != 0) { func_80832564(play, this); - Player_SetupAction(play, this, func_8084FA54, 0); + Player_SetupAction(play, this, Player_Action_8084FA54, 0); if (!func_8002DD6C(this) || Player_HoldsHookshot(this)) { s32 projectileItemToUse = ITEM_BOW; @@ -12185,14 +12323,14 @@ s32 func_8084B4D4(PlayState* play, Player* this) { this->stateFlags3 &= ~PLAYER_STATE3_FORCE_PULL_OCARINA; func_8084B498(this); this->unk_6AD = 4; - func_8083B040(this, play); + Player_ActionChange_13(this, play); return 1; } return 0; } -void func_8084B530(Player* this, PlayState* play) { +void Player_Action_8084B530(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; Player_UpdateUpperBody(this, play); @@ -12206,11 +12344,11 @@ void func_8084B530(Player* this, PlayState* play) { func_8005B1A4(Play_GetCamera(play, 0)); if (!func_8084B4D4(play, this) && !func_8084B3CC(play, this) && !Player_StartCsAction(play, this)) { - if ((this->targetActor != this->interactRangeActor) || !func_8083E5A8(this, play)) { + if ((this->targetActor != this->interactRangeActor) || !Player_ActionChange_2(this, play)) { if (this->stateFlags1 & PLAYER_STATE1_ON_HORSE) { - s32 sp24 = this->unk_850; + s32 sp24 = this->av2.actionVar2; func_8083A360(play, this); - this->unk_850 = sp24; + this->av2.actionVar2 = sp24; } else if (func_808332B8(this)) { func_80838F18(play, this); } else { @@ -12224,9 +12362,9 @@ void func_8084B530(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_ON_HORSE) { - func_8084CC98(this, play); + Player_Action_8084CC98(this, play); } else if (func_808332B8(this)) { - func_8084D610(this, play); + Player_Action_8084D610(this, play); } else if (!func_8008E9C4(this) && LinkAnimation_Update(play, &this->skelAnime)) { if (this->skelAnime.moveFlags != 0) { func_80832DBC(this); @@ -12242,11 +12380,11 @@ void func_8084B530(Player* this, PlayState* play) { } if (this->unk_664 != NULL) { - this->currentYaw = this->actor.shape.rot.y = func_8083DB98(this, 0); + this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); } } -void func_8084B78C(Player* this, PlayState* play) { +void Player_Action_8084B78C(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; @@ -12256,7 +12394,7 @@ void func_8084B78C(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { if (!func_8083F9D0(play, this)) { - Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_LINEAR, play); temp = func_8083FFB8(this, &sp34, &sp32); if (temp > 0) { func_8083FAB8(this, play); @@ -12278,11 +12416,11 @@ void func_8084B840(PlayState* play, Player* this, f32 arg2) { } static AnimSfxEntry D_80854870[] = { - { NA_SE_PL_SLIP, 0x1003 }, - { NA_SE_PL_SLIP, -0x1015 }, + { NA_SE_PL_SLIP, ANIMSFX_DATA(ANIMSFX_TYPE_2, 3) }, + { NA_SE_PL_SLIP, -ANIMSFX_DATA(ANIMSFX_TYPE_2, 21) }, }; -void func_8084B898(Player* this, PlayState* play) { +void Player_Action_8084B898(Player* this, PlayState* play) { f32 sp34; s16 sp32; s32 temp; @@ -12290,8 +12428,8 @@ void func_8084B898(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DO_ACTION_GRAB | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS | PLAYER_STATE2_GRABBING_DYNAPOLY; if (func_80832CB0(play, this, &gPlayerAnim_link_normal_pushing)) { - this->unk_850 = 1; - } else if (this->unk_850 == 0) { + this->av2.actionVar2 = 1; + } else if (this->av2.actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 11.0f)) { func_80832698(this, NA_SE_VO_LI_PUSH); } @@ -12301,7 +12439,7 @@ void func_8084B898(Player* this, PlayState* play) { func_8083F524(play, this); if (!func_8083F9D0(play, this)) { - Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_LINEAR, play); temp = func_8083FFB8(this, &sp34, &sp32); if (temp < 0) { func_8083FB14(this, play); @@ -12319,13 +12457,13 @@ void func_8084B898(Player* this, PlayState* play) { } static AnimSfxEntry D_80854878[] = { - { NA_SE_PL_SLIP, 0x1004 }, - { NA_SE_PL_SLIP, -0x1018 }, + { NA_SE_PL_SLIP, ANIMSFX_DATA(ANIMSFX_TYPE_2, 4) }, + { NA_SE_PL_SLIP, -ANIMSFX_DATA(ANIMSFX_TYPE_2, 24) }, }; static Vec3f D_80854880 = { 0.0f, 26.0f, -40.0f }; -void func_8084B9E4(Player* this, PlayState* play) { +void Player_Action_8084B9E4(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 sp70; s16 sp6E; @@ -12341,9 +12479,9 @@ void func_8084B9E4(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DO_ACTION_GRAB | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS | PLAYER_STATE2_GRABBING_DYNAPOLY; if (func_80832CB0(play, this, anim)) { - this->unk_850 = 1; + this->av2.actionVar2 = 1; } else { - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 11.0f)) { func_80832698(this, NA_SE_VO_LI_PUSH); } @@ -12355,7 +12493,7 @@ void func_8084B9E4(Player* this, PlayState* play) { func_8083F524(play, this); if (!func_8083F9D0(play, this)) { - Player_GetMovementSpeedAndYaw(this, &sp70, &sp6E, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &sp70, &sp6E, SPEED_MODE_LINEAR, play); temp1 = func_8083FFB8(this, &sp70, &sp6E); if (temp1 > 0) { func_8083FAB8(this, play); @@ -12382,7 +12520,7 @@ void func_8084B9E4(Player* this, PlayState* play) { } } -void func_8084BBE4(Player* this, PlayState* play) { +void Player_Action_8084BBE4(Player* this, PlayState* play) { f32 sp3C; s16 sp3A; LinkAnimationHeader* anim; @@ -12392,9 +12530,9 @@ void func_8084BBE4(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { // clang-format off - anim = (this->unk_84F > 0) ? &gPlayerAnim_link_normal_fall_wait : GET_PLAYER_ANIM(PLAYER_ANIMGROUP_jump_climb_wait, this->modelAnimType); Player_AnimPlayLoop(play, this, anim); + anim = (this->av1.actionVar1 > 0) ? &gPlayerAnim_link_normal_fall_wait : GET_PLAYER_ANIM(PLAYER_ANIMGROUP_jump_climb_wait, this->modelAnimType); Player_AnimPlayLoop(play, this, anim); // clang-format on - } else if (this->unk_84F == 0) { + } else if (this->av1.actionVar1 == 0) { if (this->skelAnime.animation == &gPlayerAnim_link_normal_fall) { temp = 11.0f; } else { @@ -12404,19 +12542,19 @@ void func_8084BBE4(Player* this, PlayState* play) { if (LinkAnimation_OnFrame(&this->skelAnime, temp)) { func_80832770(this, NA_SE_PL_WALK_GROUND); if (this->skelAnime.animation == &gPlayerAnim_link_normal_fall) { - this->unk_84F = 1; + this->av1.actionVar1 = 1; } else { - this->unk_84F = -1; + this->av1.actionVar1 = -1; } } } - Math_ScaledStepToS(&this->actor.shape.rot.y, this->currentYaw, 0x800); + Math_ScaledStepToS(&this->actor.shape.rot.y, this->yaw, 0x800); - if (this->unk_84F != 0) { - Player_GetMovementSpeedAndYaw(this, &sp3C, &sp3A, 0.0f, play); + if (this->av1.actionVar1 != 0) { + Player_GetMovementSpeedAndYaw(this, &sp3C, &sp3A, SPEED_MODE_LINEAR, play); if (this->unk_847[this->unk_846] >= 0) { - if (this->unk_84F > 0) { + if (this->av1.actionVar1 > 0) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_fall_up, this->modelAnimType); } else { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_jump_climb_up, this->modelAnimType); @@ -12427,7 +12565,7 @@ void func_8084BBE4(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) || (this->actor.shape.feetFloorFlags != 0)) { func_80837B60(this); - if (this->unk_84F < 0) { + if (this->av1.actionVar1 < 0) { this->linearVelocity = -0.8f; } else { this->linearVelocity = 0.8f; @@ -12438,7 +12576,7 @@ void func_8084BBE4(Player* this, PlayState* play) { } } -void func_8084BDFC(Player* this, PlayState* play) { +void Player_Action_8084BDFC(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -12451,16 +12589,16 @@ void func_8084BDFC(Player* this, PlayState* play) { func_808328A0(this); } else if (LinkAnimation_OnFrame(&this->skelAnime, this->skelAnime.endFrame - 34.0f)) { this->stateFlags1 &= ~(PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE); - Player_PlaySfx(&this->actor, NA_SE_PL_CLIMB_CLIFF); + Player_PlaySfx(this, NA_SE_PL_CLIMB_CLIFF); func_80832698(this, NA_SE_VO_LI_CLIMB_END); } } void func_8084BEE4(Player* this) { - Player_PlaySfx(&this->actor, (this->unk_84F != 0) ? NA_SE_PL_WALK_WALL : NA_SE_PL_WALK_LADDER); + Player_PlaySfx(this, (this->av1.actionVar1 != 0) ? NA_SE_PL_WALK_WALL : NA_SE_PL_WALK_LADDER); } -void func_8084BF1C(Player* this, PlayState* play) { +void Player_Action_8084BF1C(Player* this, PlayState* play) { static Vec3f D_8085488C = { 0.0f, 0.0f, 26.0f }; s32 sp84; s32 sp80; @@ -12479,7 +12617,7 @@ void func_8084BF1C(Player* this, PlayState* play) { this->fallStartHeight = this->actor.world.pos.y; this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; - if ((this->unk_84F != 0) && (ABS(sp84) < ABS(sp80))) { + if ((this->av1.actionVar1 != 0) && (ABS(sp84) < ABS(sp80))) { phi_f0 = ABS(sp80) * 0.0325f; sp84 = 0; } else { @@ -12501,7 +12639,7 @@ void func_8084BF1C(Player* this, PlayState* play) { this->skelAnime.playSpeed = phi_f2 * phi_f0 + phi_f2 * CVarGetInteger("gClimbSpeed", 0); - if (this->unk_850 >= 0) { + if (this->av2.actionVar2 >= 0) { if ((this->actor.wallPoly != NULL) && (this->actor.wallBgId != BGCHECK_SCENE)) { DynaPolyActor* wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); if (wallPolyActor != NULL) { @@ -12510,36 +12648,36 @@ void func_8084BF1C(Player* this, PlayState* play) { } } - Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 6.0f, this->ageProperties->unk_00, 7); + Actor_UpdateBgCheckInfo(play, &this->actor, 26.0f, 6.0f, this->ageProperties->ceilingCheckHeight, 7); func_8083F360(play, this, 26.0f, this->ageProperties->unk_3C, 50.0f, -20.0f); } - if ((this->unk_850 < 0) || !func_8083FBC0(this, play)) { + if ((this->av2.actionVar2 < 0) || !func_8083FBC0(this, play)) { if (LinkAnimation_Update(play, &this->skelAnime) != 0) { - if (this->unk_850 < 0) { - this->unk_850 = ABS(this->unk_850) & 1; + if (this->av2.actionVar2 < 0) { + this->av2.actionVar2 = ABS(this->av2.actionVar2) & 1; return; } if (sp84 != 0) { - sp68 = this->unk_84F + this->unk_850; + sp68 = this->av1.actionVar1 + this->av2.actionVar2; if (sp84 > 0) { D_8085488C.y = this->ageProperties->unk_40; temp_f0 = func_8083973C(play, this, &D_8085488C, &sp5C); if (this->actor.world.pos.y < temp_f0) { - if (this->unk_84F != 0) { + if (this->av1.actionVar1 != 0) { this->actor.world.pos.y = temp_f0; this->stateFlags1 &= ~PLAYER_STATE1_CLIMBING_LADDER; func_8083A5C4(play, this, this->actor.wallPoly, this->ageProperties->unk_3C, &gPlayerAnim_link_normal_jump_climb_up_free); - this->currentYaw += 0x8000; - this->actor.shape.rot.y = this->currentYaw; + this->yaw += 0x8000; + this->actor.shape.rot.y = this->yaw; func_8083A9B8(this, &gPlayerAnim_link_normal_jump_climb_up_free, play); this->stateFlags1 |= PLAYER_STATE1_CLIMBING_LEDGE; } else { - func_8083F070(this, this->ageProperties->unk_CC[this->unk_850], play); + func_8083F070(this, this->ageProperties->unk_CC[this->av2.actionVar2], play); } } else { this->skelAnime.prevTransl = this->ageProperties->unk_4A[sp68]; @@ -12547,14 +12685,14 @@ void func_8084BF1C(Player* this, PlayState* play) { } } else { if ((this->actor.world.pos.y - this->actor.floorHeight) < 15.0f) { - if (this->unk_84F != 0) { + if (this->av1.actionVar1 != 0) { func_8083FB7C(this, play); } else { - if (this->unk_850 != 0) { + if (this->av2.actionVar2 != 0) { this->skelAnime.prevTransl = this->ageProperties->unk_44; } - func_8083F070(this, this->ageProperties->unk_C4[this->unk_850], play); - this->unk_850 = 1; + func_8083F070(this, this->ageProperties->unk_C4[this->av2.actionVar2], play); + this->av2.actionVar2 = 1; } } else { sp68 ^= 1; @@ -12564,16 +12702,16 @@ void func_8084BF1C(Player* this, PlayState* play) { 0.0f, ANIMMODE_ONCE, 0.0f); } } - this->unk_850 ^= 1; + this->av2.actionVar2 ^= 1; } else { - if ((this->unk_84F != 0) && (sp80 != 0)) { - anim2 = this->ageProperties->unk_BC[this->unk_850]; + if ((this->av1.actionVar1 != 0) && (sp80 != 0)) { + anim2 = this->ageProperties->unk_BC[this->av2.actionVar2]; if (CVarGetInteger("gMirroredWorld", 0) ? (sp80 < 0) : (sp80 > 0)) { - this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->unk_850]; + this->skelAnime.prevTransl = this->ageProperties->unk_7A[this->av2.actionVar2]; Player_AnimPlayOnce(play, this, anim2); } else { - this->skelAnime.prevTransl = this->ageProperties->unk_86[this->unk_850]; + this->skelAnime.prevTransl = this->ageProperties->unk_86[this->av2.actionVar2]; LinkAnimation_Change(play, &this->skelAnime, anim2, -1.0f, Animation_GetLastFrame(anim2), 0.0f, ANIMMODE_ONCE, 0.0f); } @@ -12586,10 +12724,10 @@ void func_8084BF1C(Player* this, PlayState* play) { } } - if (this->unk_850 < 0) { - if (((this->unk_850 == -2) && + if (this->av2.actionVar2 < 0) { + if (((this->av2.actionVar2 == -2) && (LinkAnimation_OnFrame(&this->skelAnime, 14.0f) || LinkAnimation_OnFrame(&this->skelAnime, 29.0f))) || - ((this->unk_850 == -4) && + ((this->av2.actionVar2 == -4) && (LinkAnimation_OnFrame(&this->skelAnime, 22.0f) || LinkAnimation_OnFrame(&this->skelAnime, 35.0f) || LinkAnimation_OnFrame(&this->skelAnime, 49.0f) || LinkAnimation_OnFrame(&this->skelAnime, 55.0f)))) { func_8084BEE4(this); @@ -12606,12 +12744,12 @@ static f32 D_80854898[] = { 10.0f, 20.0f }; static f32 D_808548A0[] = { 40.0f, 50.0f }; static AnimSfxEntry D_808548A8[] = { - { NA_SE_PL_WALK_LADDER, 0x80A }, - { NA_SE_PL_WALK_LADDER, 0x814 }, - { NA_SE_PL_WALK_LADDER, -0x81E }, + { NA_SE_PL_WALK_LADDER, ANIMSFX_DATA(ANIMSFX_TYPE_1, 10) }, + { NA_SE_PL_WALK_LADDER, ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, + { NA_SE_PL_WALK_LADDER, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 30) }, }; -void func_8084C5F8(Player* this, PlayState* play) { +void Player_Action_8084C5F8(Player* this, PlayState* play) { s32 temp; f32* sp38; CollisionPoly* sp34; @@ -12635,7 +12773,7 @@ void func_8084C5F8(Player* this, PlayState* play) { sp38 = D_80854898; - if (this->unk_850 != 0) { + if (this->av2.actionVar2 != 0) { Player_ProcessAnimSfxList(this, D_808548A8); sp38 = D_808548A0; } @@ -12652,11 +12790,14 @@ void func_8084C5F8(Player* this, PlayState* play) { } static AnimSfxEntry D_808548B4[] = { - { 0, 0x3028 }, { 0, 0x3030 }, { 0, 0x3038 }, { 0, 0x3040 }, { 0, 0x3048 }, - { 0, 0x3050 }, { 0, 0x3058 }, { 0, 0x3060 }, { 0, -0x3068 }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 40) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 48) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 56) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 64) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 72) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 80) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 88) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 96) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 104) }, }; -void func_8084C760(Player* this, PlayState* play) { +void Player_Action_8084C760(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -12684,11 +12825,14 @@ void func_8084C760(Player* this, PlayState* play) { } static AnimSfxEntry D_808548D8[] = { - { 0, 0x300A }, { 0, 0x3012 }, { 0, 0x301A }, { 0, 0x3022 }, { 0, 0x3034 }, - { 0, 0x303C }, { 0, 0x3044 }, { 0, 0x304C }, { 0, -0x3054 }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 10) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 18) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 26) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 34) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 52) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 60) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 68) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 76) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 84) }, }; -void func_8084C81C(Player* this, PlayState* play) { +void Player_Action_8084C81C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -12739,8 +12883,8 @@ s32 func_8084C9BC(Player* this, PlayState* play) { s32 sp38; f32 sp34; - if (this->unk_850 < 0) { - this->unk_850 = 99; + if (this->av2.actionVar2 < 0) { + this->av2.actionVar2 = 99; } else { sp38 = (this->mountSide < 0) ? 0 : 1; if (!func_8084C89C(play, this, sp38, &sp34)) { @@ -12759,7 +12903,7 @@ s32 func_8084C9BC(Player* this, PlayState* play) { if (EN_HORSE_CHECK_1(rideActor) || (EN_HORSE_CHECK_4(rideActor) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A))) { rideActor->actor.child = NULL; - func_80835DAC(play, this, func_8084D3E4, 0); + func_80835DAC(play, this, Player_Action_8084D3E4, 0); this->unk_878 = sp34 - rideActor->actor.world.pos.y; Player_AnimPlayOnce(play, this, (this->mountSide < 0) ? &gPlayerAnim_link_uma_left_down @@ -12830,12 +12974,13 @@ static u8 D_80854998[2][2] = { static Vec3s D_8085499C = { -69, 7146, -266 }; static AnimSfxEntry D_808549A4[] = { - { NA_SE_PL_CALM_HIT, 0x830 }, { NA_SE_PL_CALM_HIT, 0x83A }, { NA_SE_PL_CALM_HIT, 0x844 }, - { NA_SE_PL_CALM_PAT, 0x85C }, { NA_SE_PL_CALM_PAT, 0x86E }, { NA_SE_PL_CALM_PAT, 0x87E }, - { NA_SE_PL_CALM_PAT, 0x884 }, { NA_SE_PL_CALM_PAT, -0x888 }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 48) }, { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 58) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 68) }, { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 92) }, + { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 110) }, { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 126) }, + { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 132) }, { NA_SE_PL_CALM_PAT, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 136) }, }; -void func_8084CC98(Player* this, PlayState* play) { +void Player_Action_8084CC98(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; u8* arr; @@ -12843,23 +12988,23 @@ void func_8084CC98(Player* this, PlayState* play) { func_8084CBF4(this, 1.0f, 10.0f); - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { if (LinkAnimation_Update(play, &this->skelAnime)) { this->skelAnime.animation = &gPlayerAnim_link_uma_wait_1; - this->unk_850 = 99; + this->av2.actionVar2 = 99; return; } arr = D_80854998[(this->mountSide < 0) ? 0 : 1]; if (LinkAnimation_OnFrame(&this->skelAnime, arr[0])) { - Player_PlaySfx(&this->actor, NA_SE_PL_CLIMB_CLIFF); + Player_PlaySfx(this, NA_SE_PL_CLIMB_CLIFF); return; } if (LinkAnimation_OnFrame(&this->skelAnime, arr[1])) { func_8002DE74(play, this); - Player_PlaySfx(&this->actor, NA_SE_PL_SIT_ON_HORSE); + Player_PlaySfx(this, NA_SE_PL_SIT_ON_HORSE); return; } @@ -12869,12 +13014,12 @@ void func_8084CC98(Player* this, PlayState* play) { func_8002DE74(play, this); this->skelAnime.prevTransl = D_8085499C; - if ((rideActor->animationIdx != this->unk_850) && ((rideActor->animationIdx >= 2) || (this->unk_850 >= 2))) { - if ((this->unk_850 = rideActor->animationIdx) < 2) { + if ((rideActor->animationIdx != this->av2.actionVar2) && ((rideActor->animationIdx >= 2) || (this->av2.actionVar2 >= 2))) { + if ((this->av2.actionVar2 = rideActor->animationIdx) < 2) { f32 rand = Rand_ZeroOne(); s32 temp = 0; - this->unk_850 = 1; + this->av2.actionVar2 = 1; if (rand < 0.1f) { temp = 2; @@ -12883,20 +13028,20 @@ void func_8084CC98(Player* this, PlayState* play) { } Player_AnimPlayOnce(play, this, D_8085498C[temp]); } else { - this->skelAnime.animation = D_80854944[this->unk_850 - 2]; + this->skelAnime.animation = D_80854944[this->av2.actionVar2 - 2]; Animation_SetMorph(play, &this->skelAnime, 8.0f); - if (this->unk_850 < 4) { + if (this->av2.actionVar2 < 4) { func_80834644(play, this); - this->unk_84F = 0; + this->av1.actionVar1 = 0; } } } - if (this->unk_850 == 1) { + if (this->av2.actionVar2 == 1) { if ((D_808535E0 != 0) || func_8083224C(play)) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_uma_wait_3); } else if (LinkAnimation_Update(play, &this->skelAnime)) { - this->unk_850 = 99; + this->av2.actionVar2 = 99; } else if (this->skelAnime.animation == &gPlayerAnim_link_uma_wait_1) { Player_ProcessAnimSfxList(this, D_808549A4); } @@ -12913,11 +13058,11 @@ void func_8084CC98(Player* this, PlayState* play) { this->csAction = 0; } this->unk_6AD = 0; - this->unk_84F = 0; - } else if ((this->unk_850 < 2) || (this->unk_850 >= 4)) { + this->av1.actionVar1 = 0; + } else if ((this->av2.actionVar2 < 2) || (this->av2.actionVar2 >= 4)) { D_808535E0 = Player_UpdateUpperBody(this, play); if (D_808535E0 != 0) { - this->unk_84F = 0; + this->av1.actionVar1 = 0; } } @@ -12925,21 +13070,21 @@ void func_8084CC98(Player* this, PlayState* play) { this->actor.world.pos.y = (rideActor->actor.world.pos.y + rideActor->riderPos.y) - 27.0f; this->actor.world.pos.z = rideActor->actor.world.pos.z + rideActor->riderPos.z; - this->currentYaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; if ((this->csAction != 0) || - (!func_8083224C(play) && ((rideActor->actor.speedXZ != 0.0f) || !func_8083B644(this, play)) && - !func_8083C1DC(this, play))) { + (!func_8083224C(play) && ((rideActor->actor.speedXZ != 0.0f) || !Player_ActionChange_4(this, play)) && + !Player_ActionChange_6(this, play))) { if (D_808535E0 == 0) { - if (this->unk_84F != 0) { + if (this->av1.actionVar1 != 0) { if (LinkAnimation_Update(play, &this->upperSkelAnime)) { rideActor->stateFlags &= ~ENHORSE_FLAG_8; - this->unk_84F = 0; + this->av1.actionVar1 = 0; } if (this->upperSkelAnime.animation == &gPlayerAnim_link_uma_stop_muti) { if (LinkAnimation_OnFrame(&this->upperSkelAnime, 23.0f)) { - Player_PlaySfx(&this->actor, NA_SE_IT_LASH); + Player_PlaySfx(this, NA_SE_IT_LASH); func_80832698(this, NA_SE_VO_LI_LASH); } @@ -12947,7 +13092,7 @@ void func_8084CC98(Player* this, PlayState* play) { this->upperSkelAnime.jointTable); } else { if (LinkAnimation_OnFrame(&this->upperSkelAnime, 10.0f)) { - Player_PlaySfx(&this->actor, NA_SE_IT_LASH); + Player_PlaySfx(this, NA_SE_IT_LASH); func_80832698(this, NA_SE_VO_LI_LASH); } @@ -12960,14 +13105,14 @@ void func_8084CC98(Player* this, PlayState* play) { if (EN_HORSE_CHECK_3(rideActor)) { anim = &gPlayerAnim_link_uma_stop_muti; } else if (EN_HORSE_CHECK_2(rideActor)) { - if ((this->unk_850 >= 2) && (this->unk_850 != 99)) { - anim = D_80854968[this->unk_850 - 2]; + if ((this->av2.actionVar2 >= 2) && (this->av2.actionVar2 != 99)) { + anim = D_80854968[this->av2.actionVar2 - 2]; } } if (anim != NULL) { LinkAnimation_PlayOnce(play, &this->upperSkelAnime, anim); - this->unk_84F = 1; + this->av1.actionVar1 = 1; } } } @@ -12985,7 +13130,7 @@ void func_8084CC98(Player* this, PlayState* play) { return; } - if ((this->csAction != 0) || (!func_8084C9BC(this, play) && !func_8083B040(this, play))) { + if ((this->csAction != 0) || (!func_8084C9BC(this, play) && !Player_ActionChange_13(this, play))) { if (this->unk_664 != NULL) { if (func_8002DD78(this) != 0) { this->unk_6BE = func_8083DB98(this, 1) - this->actor.shape.rot.y; @@ -13008,12 +13153,12 @@ void func_8084CC98(Player* this, PlayState* play) { } static AnimSfxEntry D_808549C4[] = { - { 0, 0x2800 }, - { NA_SE_PL_GET_OFF_HORSE, 0x80A }, - { NA_SE_PL_SLIPDOWN, -0x819 }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_5, 0) }, + { NA_SE_PL_GET_OFF_HORSE, ANIMSFX_DATA(ANIMSFX_TYPE_1, 10) }, + { NA_SE_PL_SLIPDOWN, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 25) }, }; -void func_8084D3E4(Player* this, PlayState* play) { +void Player_Action_8084D3E4(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; func_8084CBF4(this, 1.0f, 10.0f); @@ -13035,16 +13180,16 @@ void func_8084D3E4(Player* this, PlayState* play) { Camera_ChangeSetting(Play_GetCamera(play, 0), CAM_SET_NORMAL0); if (this->mountSide < 0) { - D_808549C4[0].field = 0x2828; + D_808549C4[0].data = ANIMSFX_DATA(ANIMSFX_TYPE_5, 40); } else { - D_808549C4[0].field = 0x281D; + D_808549C4[0].data = ANIMSFX_DATA(ANIMSFX_TYPE_5, 29); } Player_ProcessAnimSfxList(this, D_808549C4); } } static AnimSfxEntry D_808549D0[] = { - { NA_SE_PL_SWIM, -0x800 }, + { NA_SE_PL_SWIM, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 0) }, }; void func_8084D530(Player* this, f32* arg1, f32 arg2, s16 arg3) { @@ -13053,24 +13198,24 @@ void func_8084D530(Player* this, f32* arg1, f32 arg2, s16 arg3) { } void func_8084D574(PlayState* play, Player* this, s16 arg2) { - Player_SetupAction(play, this, func_8084D84C, 0); - this->actor.shape.rot.y = this->currentYaw = arg2; + Player_SetupAction(play, this, Player_Action_8084D84C, 0); + this->actor.shape.rot.y = this->yaw = arg2; Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); } void func_8084D5CC(PlayState* play, Player* this) { - Player_SetupAction(play, this, func_8084DAB4, 0); + Player_SetupAction(play, this, Player_Action_8084DAB4, 0); Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); } -void func_8084D610(Player* this, PlayState* play) { +void Player_Action_8084D610(Player* this, PlayState* play) { f32 sp34; s16 sp32; func_80832CB0(play, this, &gPlayerAnim_link_swimer_swim_wait); func_8084B000(this); - if (!func_8083224C(play) && !Player_TryActionChangeList(play, this, D_80854444, 1) && + if (!func_8083224C(play) && !Player_TryActionChangeList(play, this, sActionChangeList11, true) && !func_8083D12C(play, this, sControlInput)) { if (this->unk_6AD != 1) { this->unk_6AD = 0; @@ -13085,7 +13230,7 @@ void func_8084D610(Player* this, PlayState* play) { func_808328A0(this); } } else { - Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_LINEAR, play); if (sp34 != 0.0f) { s16 temp = this->actor.shape.rot.y - sp32; @@ -13106,20 +13251,20 @@ void func_8084D610(Player* this, PlayState* play) { } } -void func_8084D7C4(Player* this, PlayState* play) { - if (!func_8083B040(this, play)) { +void Player_Action_8084D7C4(Player* this, PlayState* play) { + if (!Player_ActionChange_13(this, play)) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; func_8084B158(play, this, NULL, this->linearVelocity); func_8084B000(this); - if (DECR(this->unk_850) == 0) { + if (DECR(this->av2.actionVar2) == 0) { func_80838F18(play, this); } } } -void func_8084D84C(Player* this, PlayState* play) { +void Player_Action_8084D84C(Player* this, PlayState* play) { f32 sp34; s16 sp32; s16 temp; @@ -13129,8 +13274,8 @@ void func_8084D84C(Player* this, PlayState* play) { func_8084B158(play, this, sControlInput, this->linearVelocity); func_8084B000(this); - if (!Player_TryActionChangeList(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { - Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, 0.0f, play); + if (!Player_TryActionChangeList(play, this, sActionChangeList11, true) && !func_8083D12C(play, this, sControlInput)) { + Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_LINEAR, play); temp = this->actor.shape.rot.y - sp32; if ((sp34 == 0.0f) || (ABS(temp) > 0x6000) || (this->currentBoots == PLAYER_BOOTS_IRON)) { @@ -13148,16 +13293,16 @@ s32 func_8084D980(PlayState* play, Player* this, f32* arg2, s16* arg3) { s16 temp1; s32 temp2; - temp1 = this->currentYaw - *arg3; + temp1 = this->yaw - *arg3; if (ABS(temp1) > 0x6000) { anim = &gPlayerAnim_link_swimer_swim_wait; if (Math_StepToF(&this->linearVelocity, 0.0f, 1.0f)) { - this->currentYaw = *arg3; + this->yaw = *arg3; } else { *arg2 = 0.0f; - *arg3 = this->currentYaw; + *arg3 = this->yaw; } } else { temp2 = func_8083FD78(this, arg2, arg3, play); @@ -13181,15 +13326,15 @@ s32 func_8084D980(PlayState* play, Player* this, f32* arg2, s16* arg3) { return 0; } -void func_8084DAB4(Player* this, PlayState* play) { +void Player_Action_8084DAB4(Player* this, PlayState* play) { f32 sp2C; s16 sp2A; func_8084B158(play, this, sControlInput, this->linearVelocity); func_8084B000(this); - if (!Player_TryActionChangeList(play, this, D_80854444, 1) && !func_8083D12C(play, this, sControlInput)) { - Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, 0.0f, play); + if (!Player_TryActionChangeList(play, this, sActionChangeList11, true) && !func_8083D12C(play, this, sControlInput)) { + Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, SPEED_MODE_LINEAR, play); if (sp2C == 0.0f) { func_80838F18(play, this); @@ -13207,33 +13352,33 @@ void func_8084DBC4(PlayState* play, Player* this, f32 arg2) { f32 sp2C; s16 sp2A; - Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, 0.0f, play); + Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, SPEED_MODE_LINEAR, play); func_8084AEEC(this, &this->linearVelocity, sp2C * 0.5f, sp2A); // Original implementation of func_8084AEEC (SurfaceWithoutSwimMod) to prevent velocity increases via swim mod which push Link into the air // #region SOH [Enhancement] if (CVarGetInteger("gEnableWalkModify", 0)) { - SurfaceWithoutSwimMod(this, &this->actor.velocity.y, arg2, this->currentYaw); + SurfaceWithoutSwimMod(this, &this->actor.velocity.y, arg2, this->yaw); // #endregion } else { - func_8084AEEC(this, &this->actor.velocity.y, arg2, this->currentYaw); + func_8084AEEC(this, &this->actor.velocity.y, arg2, this->yaw); } } -void func_8084DC48(Player* this, PlayState* play) { +void Player_Action_8084DC48(Player* this, PlayState* play) { f32 sp2C; this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; this->actor.gravity = 0.0f; Player_UpdateUpperBody(this, play); - if (!func_8083B040(this, play)) { + if (!Player_ActionChange_13(this, play)) { if (this->currentBoots == PLAYER_BOOTS_IRON) { func_80838F18(play, this); return; } - if (this->unk_84F == 0) { - if (this->unk_850 == 0) { + if (this->av1.actionVar1 == 0) { + if (this->av2.actionVar2 == 0) { if (LinkAnimation_Update(play, &this->skelAnime) || ((this->skelAnime.curFrame >= 22.0f) && !CHECK_BTN_ALL(sControlInput->cur.button, BTN_A))) { func_8083D330(play, this); @@ -13248,24 +13393,24 @@ void func_8084DC48(Player* this, PlayState* play) { func_8084B158(play, this, sControlInput, this->actor.velocity.y); this->unk_6C2 = 16000; - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !func_8083E5A8(this, play) && + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !Player_ActionChange_2(this, play) && !(this->actor.bgCheckFlags & 1) && (this->actor.yDistToWater < D_80854784[CUR_UPG_VALUE(UPG_SCALE)])) { func_8084DBC4(play, this, -2.0f); } else { - this->unk_84F++; + this->av1.actionVar1++; Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } - } else if (this->unk_84F == 1) { + } else if (this->av1.actionVar1 == 1) { LinkAnimation_Update(play, &this->skelAnime); func_8084B000(this); if (this->unk_6C2 < 10000) { - this->unk_84F++; - this->unk_850 = this->actor.yDistToWater; + this->av1.actionVar1++; + this->av2.actionVar2 = this->actor.yDistToWater; Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim); } } else if (!func_8083D12C(play, this, sControlInput)) { - sp2C = (this->unk_850 * 0.018f) + 4.0f; + sp2C = (this->av2.actionVar2 * 0.018f) + 4.0f; if (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { sControlInput = NULL; @@ -13295,7 +13440,7 @@ void func_8084DFAC(PlayState* play, Player* this) { func_8084DF6C(play, this); func_808322FC(this); func_8083C0E8(this, play); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } s32 func_8084DFF4(PlayState* play, Player* this) { @@ -13309,13 +13454,13 @@ s32 func_8084DFF4(PlayState* play, Player* this) { return 1; } - if (this->unk_84F == 0) { + if (this->av1.actionVar1 == 0) { if (this->getItemEntry.objectId == OBJECT_INVALID || (this->getItemId != this->getItemEntry.getItemId)) { giEntry = ItemTable_Retrieve(this->getItemId); } else { giEntry = this->getItemEntry; } - this->unk_84F = 1; + this->av1.actionVar1 = 1; equipItem = giEntry.itemId; equipNow = CVarGetInteger("gAskToEquip", 0) && giEntry.modIndex == MOD_NONE && equipItem >= ITEM_SWORD_KOKIRI && equipItem <= ITEM_TUNIC_ZORA && @@ -13426,7 +13571,7 @@ s32 func_8084DFF4(PlayState* play, Player* this) { return 0; } -void func_8084E1EC(Player* this, PlayState* play) { +void Player_Action_8084E1EC(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -13449,7 +13594,7 @@ void func_8084E1EC(Player* this, PlayState* play) { func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); } -void func_8084E30C(Player* this, PlayState* play) { +void Player_Action_8084E30C(Player* this, PlayState* play) { func_8084B000(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -13459,7 +13604,7 @@ void func_8084E30C(Player* this, PlayState* play) { func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); } -void func_8084E368(Player* this, PlayState* play) { +void Player_Action_8084E368(Player* this, PlayState* play) { func_8084B000(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -13478,10 +13623,10 @@ static s16 sWarpSongEntrances[] = { ENTR_TEMPLE_OF_TIME_7, }; -void func_8084E3C4(Player* this, PlayState* play) { +void Player_Action_8084E3C4(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_okarina_swing); - this->unk_850 = 1; + this->av2.actionVar2 = 1; if (this->stateFlags2 & (PLAYER_STATE2_NEAR_OCARINA_ACTOR | PLAYER_STATE2_PLAY_FOR_ACTOR)) { this->stateFlags2 |= PLAYER_STATE2_ATTEMPT_PLAY_FOR_ACTOR; } else { @@ -13490,7 +13635,7 @@ void func_8084E3C4(Player* this, PlayState* play) { return; } - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { return; } @@ -13503,7 +13648,7 @@ void func_8084E3C4(Player* this, PlayState* play) { this->targetActor = this->naviActor; this->naviActor->textId = -this->naviTextId; Player_StartTalking(play, this->targetActor); - } else if (!func_8083B040(this, play)) { + } else if (!Player_ActionChange_13(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_okarina_end, play); } @@ -13532,7 +13677,7 @@ void func_8084E3C4(Player* this, PlayState* play) { } } -void func_8084E604(Player* this, PlayState* play) { +void Player_Action_8084E604(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_8083A098(this, &gPlayerAnim_link_normal_light_bom_end, play); } else if (LinkAnimation_OnFrame(&this->skelAnime, 3.0f)) { @@ -13547,22 +13692,22 @@ void func_8084E604(Player* this, PlayState* play) { } static AnimSfxEntry D_808549E0[] = { - { 0, 0x3857 }, - { NA_SE_VO_LI_CLIMB_END, 0x2057 }, - { NA_SE_VO_LI_AUTO_JUMP, 0x2045 }, - { 0, -0x287B }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_7, 87) }, + { NA_SE_VO_LI_CLIMB_END, ANIMSFX_DATA(ANIMSFX_TYPE_4, 87) }, + { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_4, 69) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_5, 123) }, }; -void func_8084E6D4(Player* this, PlayState* play) { +void Player_Action_8084E6D4(Player* this, PlayState* play) { s32 cond; if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_850 != 0) { - if (this->unk_850 >= 2) { - this->unk_850--; + if (this->av2.actionVar2 != 0) { + if (this->av2.actionVar2 >= 2) { + this->av2.actionVar2--; } - if (func_8084DFF4(play, this) && (this->unk_850 == 1)) { + if (func_8084DFF4(play, this) && (this->av2.actionVar2 == 1)) { cond = ((this->targetActor != NULL) && (this->exchangeItemId < 0)) || (this->stateFlags3 & PLAYER_STATE3_FORCE_PULL_OCARINA); @@ -13607,11 +13752,11 @@ void func_8084E6D4(Player* this, PlayState* play) { Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_demo_get_itemA); } - this->unk_850 = 2; + this->av2.actionVar2 = 2; func_80835EA4(play, 9); } } else { - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { if (!LINK_IS_ADULT) { Player_ProcessAnimSfxList(this, D_808549E0); } @@ -13629,7 +13774,7 @@ void func_8084E6D4(Player* this, PlayState* play) { } static AnimSfxEntry D_808549F0[] = { - { NA_SE_IT_MASTER_SWORD_SWING, -0x83C }, + { NA_SE_IT_MASTER_SWORD_SWING, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 60) }, }; void func_8084E988(Player* this) { @@ -13637,15 +13782,15 @@ void func_8084E988(Player* this) { } static AnimSfxEntry D_808549F4[] = { - { NA_SE_VO_LI_AUTO_JUMP, 0x2005 }, - { 0, -0x280F }, + { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_4, 5) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_5, 15) }, }; -void func_8084E9AC(Player* this, PlayState* play) { +void Player_Action_8084E9AC(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_84F == 0) { - if (DECR(this->unk_850) == 0) { - this->unk_84F = 1; + if (this->av1.actionVar1 == 0) { + if (DECR(this->av2.actionVar2) == 0) { + this->av1.actionVar1 = 1; this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } } else { @@ -13669,9 +13814,9 @@ static u8 D_808549FC[] = { 0x01, 0x03, 0x02, 0x04, 0x04, }; -void func_8084EAC0(Player* this, PlayState* play) { +void Player_Action_8084EAC0(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { if (this->itemAction == PLAYER_IA_BOTTLE_POE) { s32 rand = Rand_S16Offset(-1, 3); @@ -13777,20 +13922,20 @@ void func_8084EAC0(Player* this, PlayState* play) { } Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_wait); - this->unk_850 = 1; + this->av2.actionVar2 = 1; return; } func_8083C0E8(this, play); func_8005B1A4(Play_GetCamera(play, 0)); - } else if (this->unk_850 == 1) { + } else if (this->av2.actionVar2 == 1) { if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.magicState != MAGIC_STATE_FILL)) { Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_end); - this->unk_850 = 2; + this->av2.actionVar2 = 2; Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_IA_BOTTLE); } func_80832698(this, NA_SE_VO_LI_DRINK - SFX_FLAG); - } else if ((this->unk_850 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 29.0f)) { + } else if ((this->av2.actionVar2 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 29.0f)) { func_80832698(this, NA_SE_VO_LI_BREATH_DRINK); } } @@ -13802,41 +13947,41 @@ static BottleCatchInfo D_80854A04[] = { { ACTOR_EN_INSECT, ITEM_BUG, 0x21, 0x7A }, }; -void func_8084ECA4(Player* this, PlayState* play) { +void Player_Action_8084ECA4(Player* this, PlayState* play) { struct_80854554* sp24; BottleCatchInfo* catchInfo; s32 temp; s32 i; - sp24 = &D_80854554[this->unk_850]; + sp24 = &D_80854554[this->av2.actionVar2]; func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_84F != 0) { - if (this->unk_850 == 0) { + if (this->av1.actionVar1 != 0) { + if (this->av2.actionVar2 == 0) { if (CVarGetInteger("gFastDrops", 0)) { - this->unk_84F = 0; + this->av1.actionVar1 = 0; } else { - Message_StartTextbox(play, D_80854A04[this->unk_84F - 1].textId, &this->actor); + Message_StartTextbox(play, D_80854A04[this->av1.actionVar1 - 1].textId, &this->actor); } Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); - this->unk_850 = 1; + this->av2.actionVar2 = 1; } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - this->unk_84F = 0; + this->av1.actionVar1 = 0; func_8005B1A4(Play_GetCamera(play, 0)); } } else { func_8083C0E8(this, play); } } else { - if (this->unk_84F == 0) { + if (this->av1.actionVar1 == 0) { temp = this->skelAnime.curFrame - sp24->unk_08; if (temp >= 0) { if (sp24->unk_09 >= temp) { - if (this->unk_850 != 0) { + if (this->av2.actionVar2 != 0) { if (temp == 0) { - Player_PlaySfx(&this->actor, NA_SE_IT_SCOOP_UP_WATER); + Player_PlaySfx(this, NA_SE_IT_SCOOP_UP_WATER); } } @@ -13849,8 +13994,8 @@ void func_8084ECA4(Player* this, PlayState* play) { } if (i < 4) { - this->unk_84F = i + 1; - this->unk_850 = 0; + this->av1.actionVar1 = i + 1; + this->av2.actionVar2 = 0; this->interactRangeActor->parent = &this->actor; Player_UpdateBottleHeld(play, this, catchInfo->itemId, ABS(catchInfo->itemAction)); if (!CVarGetInteger("gFastDrops", 0)) { @@ -13875,7 +14020,7 @@ void func_8084ECA4(Player* this, PlayState* play) { static Vec3f D_80854A1C = { 0.0f, 0.0f, 5.0f }; -void func_8084EED8(Player* this, PlayState* play) { +void Player_Action_8084EED8(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_8083C0E8(this, play); func_8005B1A4(Play_GetCamera(play, 0)); @@ -13885,8 +14030,8 @@ void func_8084EED8(Player* this, PlayState* play) { if (LinkAnimation_OnFrame(&this->skelAnime, 37.0f)) { Player_SpawnFairy(play, this, &this->leftHandPos, &D_80854A1C, FAIRY_REVIVE_BOTTLE); Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_IA_BOTTLE); - Player_PlaySfx(&this->actor, NA_SE_EV_BOTTLE_CAP_OPEN); - Player_PlaySfx(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); + Player_PlaySfx(this, NA_SE_EV_BOTTLE_CAP_OPEN); + Player_PlaySfx(this, NA_SE_EV_FIATY_HEAL - SFX_FLAG); } else if (LinkAnimation_OnFrame(&this->skelAnime, 47.0f)) { if (CVarGetInteger("gFairyEffect", 0)) { if (CVarGetInteger("gFairyPercentRestore", 0)) { @@ -13908,11 +14053,11 @@ static BottleDropInfo D_80854A28[] = { }; static AnimSfxEntry D_80854A34[] = { - { NA_SE_VO_LI_AUTO_JUMP, 0x2026 }, - { NA_SE_EV_BOTTLE_CAP_OPEN, -0x828 }, + { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_4, 38) }, + { NA_SE_EV_BOTTLE_CAP_OPEN, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 40) }, }; -void func_8084EFC0(Player* this, PlayState* play) { +void Player_Action_8084EFC0(Player* this, PlayState* play) { func_8083721C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -13937,14 +14082,14 @@ void func_8084EFC0(Player* this, PlayState* play) { } static AnimSfxEntry D_80854A3C[] = { - { NA_SE_PL_PUT_OUT_ITEM, -0x81E }, + { NA_SE_PL_PUT_OUT_ITEM, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 30) }, }; -void func_8084F104(Player* this, PlayState* play) { +void Player_Action_8084F104(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_850 < 0) { + if (this->av2.actionVar2 < 0) { func_8083C0E8(this, play); } else if (this->exchangeItemId == EXCH_ITEM_NONE) { Actor* targetActor = this->targetActor; @@ -13966,21 +14111,21 @@ void func_8084F104(Player* this, PlayState* play) { } } - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { Message_StartTextbox(play, this->actor.textId, &this->actor); if ((this->itemAction == PLAYER_IA_CHICKEN) || (this->itemAction == PLAYER_IA_POCKET_CUCCO)) { - Player_PlaySfx(&this->actor, NA_SE_EV_CHICKEN_CRY_M); + Player_PlaySfx(this, NA_SE_EV_CHICKEN_CRY_M); } - this->unk_850 = 1; + this->av2.actionVar2 = 1; } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_PLAYER_TALKED_TO; this->unk_862 = 0; - if (this->unk_84F == 1) { + if (this->av1.actionVar1 == 1) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_bottle_read_end); - this->unk_850 = -1; + this->av2.actionVar2 = -1; } else { func_8083C0E8(this, play); } @@ -13988,12 +14133,12 @@ void func_8084F104(Player* this, PlayState* play) { func_8005B1A4(Play_GetCamera(play, 0)); } } - } else if (this->unk_850 >= 0) { + } else if (this->av2.actionVar2 >= 0) { Player_ProcessAnimSfxList(this, D_80854A3C); } - if ((this->unk_84F == 0) && (this->unk_664 != NULL)) { - this->currentYaw = this->actor.shape.rot.y = func_8083DB98(this, 0); + if ((this->av1.actionVar1 == 0) && (this->unk_664 != NULL)) { + this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); } } @@ -14010,7 +14155,7 @@ void func_8084F308(Player* this, PlayState* play) { } } -void func_8084F390(Player* this, PlayState* play) { +void Player_Action_8084F390(Player* this, PlayState* play) { CollisionPoly* floorPoly; f32 sp50; f32 sp4C; @@ -14024,7 +14169,7 @@ void func_8084F390(Player* this, PlayState* play) { func_8084269C(play, this); func_800F4138(&this->actor.projectedPos, NA_SE_PL_SLIP_LEVEL - SFX_FLAG, this->actor.speedXZ); - if (func_8083B040(this, play) == 0) { + if (Player_ActionChange_13(this, play) == 0) { floorPoly = this->actor.floorPoly; if (floorPoly == NULL) { @@ -14035,7 +14180,7 @@ void func_8084F390(Player* this, PlayState* play) { Player_GetSlopeDirection(floorPoly, &sp38, &sp46); sp44 = sp46; - if (this->unk_84F != 0) { + if (this->av1.actionVar1 != 0) { sp44 = sp46 + 0x8000; } @@ -14059,7 +14204,7 @@ void func_8084F390(Player* this, PlayState* play) { if (Math_AsymStepToF(&this->linearVelocity, sp50, sp4C, sp48) && (sp50 == 0)) { LinkAnimationHeader* anim; - if (this->unk_84F == 0) { + if (this->av1.actionVar1 == 0) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_down_slope_slip_end, this->modelAnimType); } else { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_up_slope_slip_end, this->modelAnimType); @@ -14067,38 +14212,38 @@ void func_8084F390(Player* this, PlayState* play) { func_8083A098(this, anim, play); } - Math_SmoothStepToS(&this->currentYaw, sp46, 10, 4000, 800); + Math_SmoothStepToS(&this->yaw, sp46, 10, 4000, 800); Math_ScaledStepToS(&this->actor.shape.rot.y, sp44, 2000); } } -void func_8084F608(Player* this, PlayState* play) { - if ((DECR(this->unk_850) == 0) && Player_StartCsAction(play, this)) { +void Player_Action_8084F608(Player* this, PlayState* play) { + if ((DECR(this->av2.actionVar2) == 0) && Player_StartCsAction(play, this)) { func_80852280(play, this, NULL); - Player_SetupAction(play, this, func_80852E14, 0); - func_80852E14(this, play); + Player_SetupAction(play, this, Player_Action_CsAction, 0); + Player_Action_CsAction(this, play); } } -void func_8084F698(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_8084F608, 0); - this->unk_850 = 40; +void Player_Action_8084F698(Player* this, PlayState* play) { + Player_SetupAction(play, this, Player_Action_8084F608, 0); + this->av2.actionVar2 = 40; Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, 0x10, true); } -void func_8084F710(Player* this, PlayState* play) { +void Player_Action_8084F710(Player* this, PlayState* play) { s32 pad; - if ((this->unk_84F != 0) && (play->csCtx.frames < 0x131)) { + if ((this->av1.actionVar1 != 0) && (play->csCtx.frames < 0x131)) { this->actor.gravity = 0.0f; this->actor.velocity.y = 0.0f; } else if (sYDistToFloor < 150.0f) { if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { if (this->actor.bgCheckFlags & 1) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; func_808328A0(this); - this->unk_850 = 1; + this->av2.actionVar2 = 1; } } else { if ((play->sceneNum == SCENE_KOKIRI_FOREST) && Player_StartCsAction(play, this)) { @@ -14121,16 +14266,16 @@ void func_8084F710(Player* this, PlayState* play) { } } -void func_8084F88C(Player* this, PlayState* play) { +void Player_Action_8084F88C(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); - if ((this->unk_850++ > 8) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { + if ((this->av2.actionVar2++ > 8) && (play->transitionTrigger == TRANS_TRIGGER_OFF)) { - if (this->unk_84F != 0) { + if (this->av1.actionVar1 != 0) { if (play->sceneNum == SCENE_ICE_CAVERN) { Play_TriggerRespawn(play); play->nextEntranceIndex = ENTR_ICE_CAVERN_0; - } else if (this->unk_84F < 0) { + } else if (this->av1.actionVar1 < 0) { Play_TriggerRespawn(play); // In ER, handle DMT and other special void outs to respawn from last entrance from grotto if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { @@ -14153,11 +14298,11 @@ void func_8084F88C(Player* this, PlayState* play) { } } -void func_8084F9A0(Player* this, PlayState* play) { - func_80839800(this, play); +void Player_Action_8084F9A0(Player* this, PlayState* play) { + Player_ActionChange_1(this, play); } -void func_8084F9C0(Player* this, PlayState* play) { +void Player_Action_8084F9C0(Player* this, PlayState* play) { this->actor.gravity = -1.0f; LinkAnimation_Update(play, &this->skelAnime); @@ -14169,7 +14314,7 @@ void func_8084F9C0(Player* this, PlayState* play) { } } -void func_8084FA54(Player* this, PlayState* play) { +void Player_Action_8084FA54(Player* this, PlayState* play) { this->unk_6AD = 2; func_8083AD4C(play, this); @@ -14187,16 +14332,16 @@ void func_8084FA54(Player* this, PlayState* play) { } } -void func_8084FB10(Player* this, PlayState* play) { - if (this->unk_84F >= 0) { - if (this->unk_84F < 6) { - this->unk_84F++; +void Player_Action_8084FB10(Player* this, PlayState* play) { + if (this->av1.actionVar1 >= 0) { + if (this->av1.actionVar1 < 6) { + this->av1.actionVar1++; } if (func_80832594(this, 1, 100)) { - this->unk_84F = -1; + this->av1.actionVar1 = -1; EffectSsIcePiece_SpawnBurst(play, &this->actor.world.pos, this->actor.scale.x); - Player_PlaySfx(&this->actor, NA_SE_PL_ICE_BROKEN); + Player_PlaySfx(this, NA_SE_PL_ICE_BROKEN); } else { this->stateFlags2 |= PLAYER_STATE2_FROZEN; } @@ -14212,17 +14357,17 @@ void func_8084FB10(Player* this, PlayState* play) { } } -void func_8084FBF4(Player* this, PlayState* play) { +void Player_Action_8084FBF4(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); func_808382BC(this); - if (((this->unk_850 % 25) != 0) || func_80837B18(play, this, -1)) { - if (DECR(this->unk_850) == 0) { + if (((this->av2.actionVar2 % 25) != 0) || func_80837B18(play, this, -1)) { + if (DECR(this->av2.actionVar2) == 0) { func_80839F90(this, play); } } - this->shockTimer = 40; + this->bodyShockTimer = 40; func_8002F8F0(&this->actor, NA_SE_VO_LI_TAKEN_AWAY - SFX_FLAG + this->ageProperties->unk_92); } @@ -14357,7 +14502,7 @@ void Player_UpdateBunnyEars(Player* this) { } } -s32 func_80850224(Player* this, PlayState* play) { +s32 Player_ActionChange_7(Player* this, PlayState* play) { if (func_8083C6B8(play, this) == 0) { if (func_8083BB20(this) != 0) { s32 sp24 = func_80837818(this); @@ -14379,7 +14524,7 @@ s32 func_80850224(Player* this, PlayState* play) { static Vec3f D_80854A40 = { 0.0f, 40.0f, 45.0f }; -void func_808502D0(Player* this, PlayState* play) { +void Player_Action_808502D0(Player* this, PlayState* play) { struct_80854190* sp44 = &D_80854190[this->meleeWeaponAnimation]; this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; @@ -14401,7 +14546,7 @@ void func_808502D0(Player* this, PlayState* play) { func_8083C50C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { - if (!func_80850224(this, play)) { + if (!Player_ActionChange_7(this, play)) { u8 sp43 = this->skelAnime.moveFlags; LinkAnimationHeader* sp3C; @@ -14448,7 +14593,7 @@ void func_808502D0(Player* this, PlayState* play) { } } -void func_808505DC(Player* this, PlayState* play) { +void Player_Action_808505DC(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); func_8083721C(this); @@ -14457,15 +14602,15 @@ void func_808505DC(Player* this, PlayState* play) { } } -void func_8085063C(Player* this, PlayState* play) { +void Player_Action_8085063C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; LinkAnimation_Update(play, &this->skelAnime); Player_UpdateUpperBody(this, play); - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { Message_StartTextbox(play, 0x3B, &this->actor); - this->unk_850 = 1; + this->av2.actionVar2 = 1; return; } @@ -14492,17 +14637,17 @@ void func_8085063C(Player* this, PlayState* play) { } } -void func_8085076C(Player* this, PlayState* play) { +void Player_Action_8085076C(Player* this, PlayState* play) { s32 respawnData = gSaveContext.respawn[RESPAWN_MODE_TOP].data; - if (this->unk_850 > 20) { + if (this->av2.actionVar2 > 20) { this->actor.draw = Player_Draw; this->actor.world.pos.y += 60.0f; func_80837B9C(this, play); return; } - if (this->unk_850++ == 20) { + if (this->av2.actionVar2++ == 20) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = respawnData + 1; func_80078914(&gSaveContext.respawn[RESPAWN_MODE_TOP].pos, NA_SE_PL_MAGIC_WIND_WARP); } @@ -14529,61 +14674,61 @@ static LinkAnimationHeader* D_80854A70[] = { static u8 D_80854A7C[] = { 70, 10, 10 }; static AnimSfxEntry D_80854A80[] = { - { NA_SE_PL_SKIP, 0x814 }, - { NA_SE_VO_LI_SWORD_N, 0x2014 }, - { 0, -0x301A }, + { NA_SE_PL_SKIP, ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, + { NA_SE_VO_LI_SWORD_N, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 26) }, }; static AnimSfxEntry D_80854A8C[][2] = { { - { 0, 0x4014 }, - { NA_SE_VO_LI_MAGIC_FROL, -0x201E }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, + { NA_SE_VO_LI_MAGIC_FROL, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 30) }, }, { - { 0, 0x4014 }, - { NA_SE_VO_LI_MAGIC_NALE, -0x202C }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, + { NA_SE_VO_LI_MAGIC_NALE, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 44) }, }, { - { NA_SE_VO_LI_MAGIC_ATTACK, 0x2014 }, - { NA_SE_IT_SWORD_SWING_HARD, -0x814 }, + { NA_SE_VO_LI_MAGIC_ATTACK, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, + { NA_SE_IT_SWORD_SWING_HARD, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, }, }; -void func_808507F4(Player* this, PlayState* play) { +void Player_Action_808507F4(Player* this, PlayState* play) { u8 isFastFarores = CVarGetInteger("gFastFarores", 0) && this->itemAction == PLAYER_IA_FARORES_WIND; if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_84F < 0) { + if (this->av1.actionVar1 < 0) { if ((this->itemAction == PLAYER_IA_NAYRUS_LOVE) || isFastFarores || (gSaveContext.magicState == MAGIC_STATE_IDLE)) { func_80839FFC(this, play); func_8005B1A4(Play_GetCamera(play, 0)); } } else { - if (this->unk_850 == 0) { - LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A58[this->unk_84F], 0.83f * (isFastFarores ? 2 : 1)); + if (this->av2.actionVar2 == 0) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A58[this->av1.actionVar1], 0.83f * (isFastFarores ? 2 : 1)); - if (func_80846A00(play, this, this->unk_84F) != NULL) { + if (func_80846A00(play, this, this->av1.actionVar1) != NULL) { this->stateFlags1 |= PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE; - if ((this->unk_84F != 0) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) { + if ((this->av1.actionVar1 != 0) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) { gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP; } } else { Magic_Reset(play); } } else { - LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, D_80854A64[this->unk_84F], 0.83f * (isFastFarores ? 2 : 1)); + LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, D_80854A64[this->av1.actionVar1], 0.83f * (isFastFarores ? 2 : 1)); - if (this->unk_84F == 0) { - this->unk_850 = -10; + if (this->av1.actionVar1 == 0) { + this->av2.actionVar2 = -10; } } - this->unk_850++; + this->av2.actionVar2++; } } else { - if (this->unk_850 < 0) { - this->unk_850++; + if (this->av2.actionVar2 < 0) { + this->av2.actionVar2++; - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { gSaveContext.respawn[RESPAWN_MODE_TOP].data = 1; Play_SetupRespawnPoint(play, RESPAWN_MODE_TOP, 0x6FF); gSaveContext.fw.set = 1; @@ -14596,20 +14741,20 @@ void func_808507F4(Player* this, PlayState* play) { gSaveContext.fw.roomIndex = gSaveContext.respawn[RESPAWN_MODE_DOWN].roomIndex; gSaveContext.fw.tempSwchFlags = gSaveContext.respawn[RESPAWN_MODE_DOWN].tempSwchFlags; gSaveContext.fw.tempCollectFlags = gSaveContext.respawn[RESPAWN_MODE_DOWN].tempCollectFlags; - this->unk_850 = 2; + this->av2.actionVar2 = 2; } - } else if (this->unk_84F >= 0) { - if (this->unk_850 == 0) { + } else if (this->av1.actionVar1 >= 0) { + if (this->av2.actionVar2 == 0) { Player_ProcessAnimSfxList(this, D_80854A80); - } else if (this->unk_850 == 1) { - Player_ProcessAnimSfxList(this, D_80854A8C[this->unk_84F]); - if ((this->unk_84F == 2) && LinkAnimation_OnFrame(&this->skelAnime, 30.0f)) { + } else if (this->av2.actionVar2 == 1) { + Player_ProcessAnimSfxList(this, D_80854A8C[this->av1.actionVar1]); + if ((this->av1.actionVar1 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 30.0f)) { this->stateFlags1 &= ~(PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE); } - } else if ((isFastFarores ? 10 : D_80854A7C[this->unk_84F]) < this->unk_850++) { - LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A70[this->unk_84F], 0.83f * (isFastFarores ? 2 : 1)); - this->currentYaw = this->actor.shape.rot.y; - this->unk_84F = -1; + } else if ((isFastFarores ? 10 : D_80854A7C[this->av1.actionVar1]) < this->av2.actionVar2++) { + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A70[this->av1.actionVar1], 0.83f * (isFastFarores ? 2 : 1)); + this->yaw = this->actor.shape.rot.y; + this->av1.actionVar1 = -1; } } } @@ -14617,7 +14762,7 @@ void func_808507F4(Player* this, PlayState* play) { func_8083721C(this); } -void func_80850AEC(Player* this, PlayState* play) { +void Player_Action_80850AEC(Player* this, PlayState* play) { f32 temp; this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; @@ -14655,8 +14800,8 @@ void func_80850AEC(Player* this, PlayState* play) { } } -void func_80850C68(Player* this, PlayState* play) { - if ((this->unk_850 != 0) && ((this->unk_858 != 0.0f) || (this->unk_85C != 0.0f))) { +void Player_Action_80850C68(Player* this, PlayState* play) { + if ((this->av2.actionVar2 != 0) && ((this->unk_858 != 0.0f) || (this->unk_85C != 0.0f))) { f32 updateScale = R_UPDATE_RATE * 0.5f; this->skelAnime.curFrame += this->skelAnime.playSpeed * updateScale; @@ -14676,7 +14821,7 @@ void func_80850C68(Player* this, PlayState* play) { } else if (LinkAnimation_Update(play, &this->skelAnime)) { this->unk_860 = 2; Player_AnimPlayLoop(play, this, &gPlayerAnim_link_fishing_wait); - this->unk_850 = 1; + this->av2.actionVar2 = 1; } func_8083721C(this); @@ -14684,12 +14829,12 @@ void func_80850C68(Player* this, PlayState* play) { if (this->unk_860 == 0) { func_80853080(this, play); } else if (this->unk_860 == 3) { - Player_SetupAction(play, this, func_80850E84, 0); + Player_SetupAction(play, this, Player_Action_80850E84, 0); Player_AnimChangeOnceMorph(play, this, &gPlayerAnim_link_fishing_fish_catch); } } -void func_80850E84(Player* this, PlayState* play) { +void Player_Action_80850E84(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_860 == 0)) { func_8083A098(this, &gPlayerAnim_link_fishing_fish_catch_end, play); } @@ -14702,18 +14847,22 @@ static void (*D_80854AA4[])(PlayState*, Player*, void*) = { }; static AnimSfxEntry D_80854AF0[] = { - { 0, 0x2822 }, - { NA_SE_PL_CALM_HIT, 0x82D }, - { NA_SE_PL_CALM_HIT, 0x833 }, - { NA_SE_PL_CALM_HIT, -0x840 }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_5, 34) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 45) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 51) }, + { NA_SE_PL_CALM_HIT, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 64) }, }; static AnimSfxEntry D_80854B00[] = { - { NA_SE_VO_LI_SURPRISE, 0x2003 }, { 0, 0x300F }, { 0, 0x3018 }, { 0, 0x301E }, { NA_SE_VO_LI_FALL_L, -0x201F }, + { NA_SE_VO_LI_SURPRISE, ANIMSFX_DATA(ANIMSFX_TYPE_4, 3) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 15) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 24) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 30) }, + { NA_SE_VO_LI_FALL_L, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 31) }, }; static AnimSfxEntry D_80854B14[] = { - { 0, -0x300A }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 10) }, }; static struct_80854B18 D_80854B18[] = { @@ -15008,7 +15157,7 @@ void func_808511D4(PlayState* play, Player* this, void* anim) { void func_808511FC(PlayState* play, Player* this, void* anim) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimChangeLoopMorphAdjustedZeroRootYawSpeed(play, this, anim); - this->unk_850 = 1; + this->av2.actionVar2 = 1; } } @@ -15022,7 +15171,7 @@ void func_80851248(PlayState* play, Player* this, void* anim) { void func_80851294(PlayState* play, Player* this, void* anim) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimReplaceNormalPlayLoopAdjusted(play, this, anim); - this->unk_850 = 1; + this->av2.actionVar2 = 1; } } @@ -15054,19 +15203,19 @@ void func_80851368(PlayState* play, Player* this, CsCmdActorAction* arg2) { void func_808513BC(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->actor.gravity = 0.0f; - if (this->unk_84F == 0) { + if (this->av1.actionVar1 == 0) { if (func_8083D12C(play, this, NULL)) { - this->unk_84F = 1; + this->av1.actionVar1 = 1; } else { func_8084B158(play, this, NULL, fabsf(this->actor.velocity.y)); Math_ScaledStepToS(&this->unk_6C2, -10000, 800); - func_8084AEEC(this, &this->actor.velocity.y, 4.0f, this->currentYaw); + func_8084AEEC(this, &this->actor.velocity.y, 4.0f, this->yaw); } return; } if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->unk_84F == 1) { + if (this->av1.actionVar1 == 1) { Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } else { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_swimer_swim_wait); @@ -15093,7 +15242,7 @@ void func_808514C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { } if ((this->interactRangeActor != NULL) && (this->interactRangeActor->textId == 0xFFFF)) { - func_8083E5A8(this, play); + Player_ActionChange_2(this, play); } } @@ -15143,8 +15292,8 @@ void func_80851688(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_80855188[] = { - { 0, 0x302A }, - { 0, -0x3030 }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 42) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 48) }, }; void func_80851750(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15155,7 +15304,7 @@ void func_80851750(PlayState* play, Player* this, CsCmdActorAction* arg2) { void func_80851788(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->stateFlags1 &= ~PLAYER_STATE1_THREW_BOOMERANG; - this->currentYaw = this->actor.shape.rot.y = this->actor.world.rot.y = + this->yaw = this->actor.shape.rot.y = this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_450); if (this->linearVelocity <= 0.0f) { @@ -15171,7 +15320,7 @@ void func_80851828(PlayState* play, Player* this, CsCmdActorAction* arg2) { func_80845BA0(play, this, &sp1C, 10); if (play->sceneNum == SCENE_JABU_JABU_BOSS) { - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { if (Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) { return; } @@ -15182,8 +15331,8 @@ void func_80851828(PlayState* play, Player* this, CsCmdActorAction* arg2) { } } - this->unk_850++; - if (this->unk_850 > 20) { + this->av2.actionVar2++; + if (this->av2.actionVar2 > 20) { this->csAction = 0xB; } } @@ -15195,10 +15344,10 @@ void func_808518DC(PlayState* play, Player* this, CsCmdActorAction* arg2) { void func_8085190C(PlayState* play, Player* this, CsCmdActorAction* arg2) { func_80851314(this); - if (this->unk_850 != 0) { + if (this->av2.actionVar2 != 0) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoop(play, this, func_808334E4(this)); - this->unk_850 = 0; + this->av2.actionVar2 = 0; } func_80833C3C(this); @@ -15236,8 +15385,8 @@ static struct_808551A4 D_808551A4[] = { }; static AnimSfxEntry D_808551AC[] = { - { 0, 0x401D }, - { 0, -0x4027 }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 29) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_8, 39) }, }; void func_80851A50(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15258,7 +15407,7 @@ void func_80851A50(PlayState* play, Player* this, CsCmdActorAction* arg2) { } this->leftHandDLists = &dLists[gSaveContext.linkAge]; - Player_PlaySfx(&this->actor, sp2C->unk_00); + Player_PlaySfx(this, sp2C->unk_00); if (!LINK_IS_ADULT) { func_80832698(this, sp2C->unk_02); } @@ -15277,16 +15426,16 @@ void func_80851B90(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_808551B4[] = { - { 0, -0x281E }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_5, 30) }, }; void func_80851BE8(PlayState* play, Player* this, CsCmdActorAction* arg2) { LinkAnimation_Update(play, &this->skelAnime); - this->unk_850++; + this->av2.actionVar2++; - if (this->unk_850 >= 180) { - if (this->unk_850 == 180) { + if (this->av2.actionVar2 >= 180) { + if (this->av2.actionVar2 == 180) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_okarina_warp_goal, (2.0f / 3.0f), 10.0f, Animation_GetLastFrame(&gPlayerAnim_link_okarina_warp_goal), ANIMMODE_ONCE, -8.0f); } @@ -15295,12 +15444,12 @@ void func_80851BE8(PlayState* play, Player* this, CsCmdActorAction* arg2) { } void func_80851CA4(PlayState* play, Player* this, CsCmdActorAction* arg2) { - if (LinkAnimation_Update(play, &this->skelAnime) && (this->unk_850 == 0) && (this->actor.bgCheckFlags & 1)) { + if (LinkAnimation_Update(play, &this->skelAnime) && (this->av2.actionVar2 == 0) && (this->actor.bgCheckFlags & 1)) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_back_downB); - this->unk_850 = 1; + this->av2.actionVar2 = 1; } - if (this->unk_850 != 0) { + if (this->av2.actionVar2 != 0) { func_8083721C(this); } } @@ -15312,7 +15461,7 @@ void func_80851D2C(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_808551B8[] = { - { NA_SE_IT_SWORD_PICKOUT, -0x80C }, + { NA_SE_IT_SWORD_PICKOUT, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 12) }, }; void func_80851D80(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15353,8 +15502,8 @@ void func_80851ECC(PlayState* play, Player* this, CsCmdActorAction* arg2) { void func_80851F14(PlayState* play, Player* this, LinkAnimationHeader* anim, AnimSfxEntry* arg3) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoopAdjusted(play, this, anim); - this->unk_850 = 1; - } else if (this->unk_850 == 0) { + this->av2.actionVar2 = 1; + } else if (this->av2.actionVar2 == 0) { Player_ProcessAnimSfxList(this, arg3); } } @@ -15365,16 +15514,16 @@ void func_80851F84(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_808551BC[] = { - { NA_SE_VO_LI_RELAX, 0x2023 }, - { NA_SE_PL_SLIPDOWN, 0x8EC }, - { NA_SE_PL_SLIPDOWN, -0x900 }, + { NA_SE_VO_LI_RELAX, ANIMSFX_DATA(ANIMSFX_TYPE_4, 35) }, + { NA_SE_PL_SLIPDOWN, ANIMSFX_DATA(ANIMSFX_TYPE_1, 236) }, + { NA_SE_PL_SLIPDOWN, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 256) }, }; void func_80851FB0(PlayState* play, Player* this, CsCmdActorAction* arg2) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait3, 0x9C); - this->unk_850 = 1; - } else if (this->unk_850 == 0) { + this->av2.actionVar2 = 1; + } else if (this->av2.actionVar2 == 0) { Player_ProcessAnimSfxList(this, D_808551BC); if (LinkAnimation_OnFrame(&this->skelAnime, 240.0f)) { this->actor.shape.shadowDraw = ActorShadow_DrawFeet; @@ -15383,10 +15532,10 @@ void func_80851FB0(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_808551C8[] = { - { NA_SE_PL_LAND_LADDER, 0x843 }, - { 0, 0x4854 }, - { 0, 0x485A }, - { 0, -0x4860 }, + { NA_SE_PL_LAND_LADDER, ANIMSFX_DATA(ANIMSFX_TYPE_1, 67) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_9, 84) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_9, 90) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_9, 96) }, }; void func_80852048(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15414,8 +15563,8 @@ void func_808520BC(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_808551D8[] = { - { NA_SE_PL_BOUND, 0x1014 }, - { NA_SE_PL_BOUND, -0x101E }, + { NA_SE_PL_BOUND, ANIMSFX_DATA(ANIMSFX_TYPE_2, 20) }, + { NA_SE_PL_BOUND, -ANIMSFX_DATA(ANIMSFX_TYPE_2, 30) }, }; void func_80852174(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15451,8 +15600,8 @@ void func_80852280(PlayState* play, Player* this, CsCmdActorAction* arg2) { void func_80852298(PlayState* play, Player* this, CsCmdActorAction* arg2) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimReplaceNormalPlayLoopAdjusted(play, this, &gPlayerAnim_clink_demo_koutai_wait); - this->unk_850 = 1; - } else if (this->unk_850 == 0) { + this->av2.actionVar2 = 1; + } else if (this->av2.actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) { func_80846720(play, this, 1); } @@ -15460,8 +15609,8 @@ void func_80852298(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_808551E0[] = { - { 0, 0x300A }, - { 0, -0x3018 }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 10) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 24) }, }; void func_80852328(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15469,8 +15618,8 @@ void func_80852328(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_808551E8[] = { - { 0, 0x400F }, - { 0, -0x4023 }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 15) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_8, 35) }, }; void func_80852358(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15480,10 +15629,10 @@ void func_80852358(PlayState* play, Player* this, CsCmdActorAction* arg2) { void func_80852388(PlayState* play, Player* this, CsCmdActorAction* arg2) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_demo_link_twait); - this->unk_850 = 1; + this->av2.actionVar2 = 1; } - if ((this->unk_850 != 0) && (play->csCtx.frames >= 900)) { + if ((this->av2.actionVar2 != 0) && (play->csCtx.frames >= 900)) { this->rightHandType = PLAYER_MODELTYPE_LH_OPEN; } else { this->rightHandType = PLAYER_MODELTYPE_RH_FF; @@ -15492,14 +15641,14 @@ void func_80852388(PlayState* play, Player* this, CsCmdActorAction* arg2) { void func_80852414(PlayState* play, Player* this, LinkAnimationHeader* anim, AnimSfxEntry* arg3) { func_80851294(play, this, anim); - if (this->unk_850 == 0) { + if (this->av2.actionVar2 == 0) { Player_ProcessAnimSfxList(this, arg3); } } static AnimSfxEntry D_808551F0[] = { - { 0, 0x300F }, - { 0, -0x3021 }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 15) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 33) }, }; void func_80852450(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15507,7 +15656,7 @@ void func_80852450(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_808551F8[] = { - { NA_SE_PL_KNOCK, -0x84E }, + { NA_SE_PL_KNOCK, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 78) }, }; void func_80852480(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15521,11 +15670,11 @@ void func_808524B0(PlayState* play, Player* this, CsCmdActorAction* arg2) { void func_808524D0(PlayState* play, Player* this, CsCmdActorAction* arg2) { sControlInput->press.button |= BTN_B; - func_80844E68(this, play); + Player_Action_80844E68(this, play); } void func_80852514(PlayState* play, Player* this, CsCmdActorAction* arg2) { - func_80844E68(this, play); + Player_Action_80844E68(this, play); } void func_80852544(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15544,13 +15693,13 @@ void func_80852564(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static void (*D_808551FC[])(Player* this, PlayState* play) = { - func_8084377C, - func_80843954, - func_80843A38, + Player_Action_8084377C, + Player_Action_80843954, + Player_Action_80843A38, }; void func_808525C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { - D_808551FC[this->unk_850](this, play); + D_808551FC[this->av2.actionVar2](this, play); } void func_80852608(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15622,7 +15771,7 @@ void func_808526EC(PlayState* play, Player* this, CsCmdActorAction* arg2) { void func_8085283C(PlayState* play, Player* this, CsCmdActorAction* arg2) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80852944(play, this, arg2); - } else if (this->unk_850 == 0) { + } else if (this->av2.actionVar2 == 0) { Item_Give(play, ITEM_SWORD_MASTER); func_80846720(play, this, 0); } else { @@ -15646,8 +15795,8 @@ void func_80852944(PlayState* play, Player* this, CsCmdActorAction* arg2) { func_80832340(play, this); } else { func_8083C148(this, play); - if (!func_8083B644(this, play)) { - func_8083E5A8(this, play); + if (!Player_ActionChange_4(this, play)) { + Player_ActionChange_2(this, play); } } @@ -15662,7 +15811,7 @@ void func_808529D0(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->actor.world.pos.y -= 1.0f; } this->actor.world.pos.z = arg2->startPos.z; - this->currentYaw = this->actor.shape.rot.y = arg2->rot.y; + this->yaw = this->actor.shape.rot.y = arg2->rot.y; } void func_80852A54(PlayState* play, Player* this, CsCmdActorAction* arg2) { @@ -15733,8 +15882,8 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2) { func_80852C0C(play, this, ABS(sp24)); func_80852B4C(play, this, linkCsAction, &D_80854B18[ABS(sp24)]); - this->unk_850 = 0; - this->unk_84F = 0; + this->av2.actionVar2 = 0; + this->av1.actionVar1 = 0; this->cueId = linkCsAction->action; } @@ -15746,7 +15895,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2) { } } -void func_80852E14(Player* this, PlayState* play) { +void Player_Action_CsAction(Player* this, PlayState* play) { if (this->csAction != this->prevCsAction) { D_80858AA0 = this->skelAnime.moveFlags; @@ -15760,10 +15909,10 @@ void func_80852E14(Player* this, PlayState* play) { func_80852B4C(play, this, NULL, &D_80854E50[this->csAction]); } -s32 Player_IsDroppingFish(PlayState* play) { +int Player_IsDroppingFish(PlayState* play) { Player* this = GET_PLAYER(play); - return (func_8084EFC0 == this->actionFunc) && (this->itemAction == PLAYER_IA_BOTTLE_FISH); + return (Player_Action_8084EFC0 == this->actionFunc) && (this->itemAction == PLAYER_IA_BOTTLE_FISH); } s32 Player_StartFishing(PlayState* play) { @@ -15802,20 +15951,20 @@ s32 Player_TryCsAction(PlayState* play, Actor* actor, s32 csAction) { if (!Player_InBlockingCsMode(play, this)) { func_80832564(play, this); - Player_SetupAction(play, this, func_80852E14, 0); + Player_SetupAction(play, this, Player_Action_CsAction, 0); this->csAction = csAction; this->csActor = actor; func_80832224(this); - return 1; + return true; } - return 0; + return false; } void func_80853080(Player* this, PlayState* play) { - Player_SetupAction(play, this, func_80840BC8, 1); + Player_SetupAction(play, this, Player_Action_80840BC8, 1); Player_AnimChangeOnceMorph(play, this, func_80833338(this)); - this->currentYaw = this->actor.shape.rot.y; + this->yaw = this->actor.shape.rot.y; } s32 Player_InflictDamage(PlayState* play, s32 damage) { @@ -15859,12 +16008,12 @@ void Player_StartTalking(PlayState* play, Actor* actor) { } if (this->stateFlags1 & PLAYER_STATE1_ON_HORSE) { - s32 sp24 = this->unk_850; + s32 sp24 = this->av2.actionVar2; func_80832528(play, this); func_8083A2F8(play, this); - this->unk_850 = sp24; + this->av2.actionVar2 = sp24; } else { if (func_808332B8(this)) { func_80836898(play, this, func_8083A2F8); From db57581d6f003083714be5030b3264be6c553d10 Mon Sep 17 00:00:00 2001 From: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Date: Thu, 15 Feb 2024 21:51:23 -0500 Subject: [PATCH 34/44] [Cosmetics] Add Vanilla GS DL for Cosmetics Editor (#3937) * Add Vanilla DL * Fixed egregious spacing error --- .../Enhancements/cosmetics/CosmeticsEditor.cpp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 2166f43bc..c6b6a5e74 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -1065,12 +1065,16 @@ void ApplyOrResetCustomGfxPatches(bool manualChange) { if (manualChange || CVarGetInteger(npcGoldenSkulltula.rainbowCvar, 0)) { static Color_RGBA8 defaultColor = {npcGoldenSkulltula.defaultColor.x, npcGoldenSkulltula.defaultColor.y, npcGoldenSkulltula.defaultColor.z, npcGoldenSkulltula.defaultColor.w}; Color_RGBA8 color = CVarGetColor(npcGoldenSkulltula.cvar, defaultColor); - PATCH_GFX(gGiSkulltulaTokenDL, "NPC_GoldenSkulltula1", npcGoldenSkulltula.changedCvar, 5, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); - PATCH_GFX(gGiSkulltulaTokenDL, "NPC_GoldenSkulltula2", npcGoldenSkulltula.changedCvar, 6, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); - PATCH_GFX(gGiSkulltulaTokenFlameDL, "NPC_GoldenSkulltula3", npcGoldenSkulltula.changedCvar, 32, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); - PATCH_GFX(gGiSkulltulaTokenFlameDL, "NPC_GoldenSkulltula4", npcGoldenSkulltula.changedCvar, 33, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); - PATCH_GFX(object_st_DL_003FB0, "NPC_GoldenSkulltula5", npcGoldenSkulltula.changedCvar, 118, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); - PATCH_GFX(object_st_DL_003FB0, "NPC_GoldenSkulltula6", npcGoldenSkulltula.changedCvar, 119, gsDPSetEnvColor(color.r / 4, color.g / 4, color.b / 4, 255)); + PATCH_GFX(gSkulltulaTokenDL, "NPC_GoldenSkulltula1", npcGoldenSkulltula.changedCvar, 5, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); + PATCH_GFX(gSkulltulaTokenDL, "NPC_GoldenSkulltula2", npcGoldenSkulltula.changedCvar, 6, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); + PATCH_GFX(gSkulltulaTokenFlameDL, "NPC_GoldenSkulltula3", npcGoldenSkulltula.changedCvar, 32, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); + PATCH_GFX(gSkulltulaTokenFlameDL, "NPC_GoldenSkulltula4", npcGoldenSkulltula.changedCvar, 33, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); + PATCH_GFX(gGiSkulltulaTokenDL, "NPC_GoldenSkulltula5", npcGoldenSkulltula.changedCvar, 5, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); + PATCH_GFX(gGiSkulltulaTokenDL, "NPC_GoldenSkulltula6", npcGoldenSkulltula.changedCvar, 6, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); + PATCH_GFX(gGiSkulltulaTokenFlameDL, "NPC_GoldenSkulltula7", npcGoldenSkulltula.changedCvar, 32, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); + PATCH_GFX(gGiSkulltulaTokenFlameDL, "NPC_GoldenSkulltula8", npcGoldenSkulltula.changedCvar, 33, gsDPSetEnvColor(color.r / 2, color.g / 2, color.b / 2, 255)); + PATCH_GFX(object_st_DL_003FB0, "NPC_GoldenSkulltula9", npcGoldenSkulltula.changedCvar, 118, gsDPSetPrimColor(0, 0, color.r, color.g, color.b, 255)); + PATCH_GFX(object_st_DL_003FB0, "NPC_GoldenSkulltula10", npcGoldenSkulltula.changedCvar, 119, gsDPSetEnvColor(color.r / 4, color.g / 4, color.b / 4, 255)); } static CosmeticOption& npcGerudo = cosmeticOptions.at("NPC_Gerudo"); From 7f4fc8dc4a650abe5a11a440b1df5acf61a2a790 Mon Sep 17 00:00:00 2001 From: Miles Acquaviva Date: Thu, 15 Feb 2024 22:03:19 -0500 Subject: [PATCH 35/44] Abstracted repeated code into functions (#3116) * Abstracted repeated code into functions * Apply suggestions from code review * Update soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> Co-authored-by: Archez --- .../cosmetics/CosmeticsEditor.cpp | 372 ++++-------------- 1 file changed, 85 insertions(+), 287 deletions(-) diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index c6b6a5e74..72ad74e19 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -1185,6 +1185,43 @@ void DrawScaleSlider(const std::string CvarName,float DefaultValue){ //Disabled for now. feature not done and several fixes needed to be merged. //UIWidgets::EnhancementSliderFloat("Scale : %dx", InvisibleLabel.c_str(), CvarLabel.c_str(), 0.1f, 3.0f,"",DefaultValue,true); } +void Draw_Table_Dropdown(const char* Header_Title, const char* Table_ID, const char* Column_Title, const char* Slider_Title, const char* Slider_ID, int MinY, int MaxY, int MinX, int MaxX, float Default_Value) { + if (ImGui::CollapsingHeader(Header_Title)) { + if (ImGui::BeginTable(Table_ID, 1, FlagsTable)) { + ImGui::TableSetupColumn(Column_Title, FlagsCell, TablesCellsWidth); + Table_InitHeader(false); + DrawUseMarginsSlider(Slider_Title, Slider_ID); + DrawPositionsRadioBoxes(Slider_ID); + DrawPositionSlider(Slider_ID, MinY, MaxY, MinX, MaxX); + DrawScaleSlider(Slider_ID, Default_Value); + ImGui::NewLine(); + ImGui::EndTable(); + } + } +} +void C_Button_Dropdown(const char* Header_Title, const char* Table_ID, const char* Column_Title, const char* Slider_Title, const char* Slider_ID, const char* Int_Type, float Slider_Scale_Value) { + if (ImGui::CollapsingHeader(Header_Title)) { + if (ImGui::BeginTable(Table_ID, 1, FlagsTable)) { + ImGui::TableSetupColumn(Column_Title, FlagsCell, TablesCellsWidth); + Table_InitHeader(false); + DrawUseMarginsSlider(Slider_Title, Slider_ID); + DrawPositionsRadioBoxes(Slider_ID); + s16 Min_X_CU = 0; + s16 Max_X_CU = ImGui::GetWindowViewport()->Size.x/2; + if(CVarGetInteger(Int_Type,0) == 2){ + Max_X_CU = 294; + } else if(CVarGetInteger(Int_Type,0) == 3){ + Max_X_CU = ImGui::GetWindowViewport()->Size.x/2; + } else if(CVarGetInteger(Int_Type,0) == 4){ + Min_X_CU = (ImGui::GetWindowViewport()->Size.x/2)*-1; + } + DrawPositionSlider(Slider_ID, 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_CU, Max_X_CU); + DrawScaleSlider(Slider_ID, Slider_Scale_Value); + ImGui::NewLine(); + ImGui::EndTable(); + } + } +} void Draw_Placements(){ if (ImGui::BeginTable("tableMargins", 1, FlagsTable)) { ImGui::TableSetupColumn("General margins settings", FlagsCell, TablesCellsWidth); @@ -1251,126 +1288,13 @@ void Draw_Placements(){ ImGui::EndTable(); } } - if (ImGui::CollapsingHeader("B Button position")) { - if (ImGui::BeginTable("tablebbtn", 1, FlagsTable)) { - ImGui::TableSetupColumn("B Button settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("B Button", "gBBtn"); - DrawPositionsRadioBoxes("gBBtn"); - DrawPositionSlider("gBBtn", 0, ImGui::GetWindowViewport()->Size.y/4+50, -1, ImGui::GetWindowViewport()->Size.x-50); - DrawScaleSlider("gBBtn",0.95f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("A Button position")) { - if (ImGui::BeginTable("tableabtn", 1, FlagsTable)) { - ImGui::TableSetupColumn("A Button settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("A Button", "gABtn"); - DrawPositionsRadioBoxes("gABtn"); - DrawPositionSlider("gABtn", -10, ImGui::GetWindowViewport()->Size.y/4+50, -20, ImGui::GetWindowViewport()->Size.x-50); - DrawScaleSlider("gABtn",0.95f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("Start Button position")) { - if (ImGui::BeginTable("tablestartbtn", 1, FlagsTable)) { - ImGui::TableSetupColumn("Start Button settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("Start Button", "gStartBtn"); - DrawPositionsRadioBoxes("gStartBtn"); - DrawPositionSlider("gStartBtn", 0, ImGui::GetWindowViewport()->Size.y/2, 0, ImGui::GetWindowViewport()->Size.x/2+70); - DrawScaleSlider("gStartBtn",0.75f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("C Button Up position")) { - if (ImGui::BeginTable("tablecubtn", 1, FlagsTable)) { - ImGui::TableSetupColumn("C Button Up settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("C Button Up", "gCBtnU"); - DrawPositionsRadioBoxes("gCBtnU"); - s16 Min_X_CU = 0; - s16 Max_X_CU = ImGui::GetWindowViewport()->Size.x/2; - if(CVarGetInteger("gCBtnUPosType",0) == 2){ - Max_X_CU = 294; - } else if(CVarGetInteger("gCBtnUPosType",0) == 3){ - Max_X_CU = ImGui::GetWindowViewport()->Size.x/2; - } else if(CVarGetInteger("gCBtnUPosType",0) == 4){ - Min_X_CU = (ImGui::GetWindowViewport()->Size.x/2)*-1; - } - DrawPositionSlider("gCBtnU", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_CU, Max_X_CU); - DrawScaleSlider("gCBtnU",0.5f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("C Button Down position")) { - if (ImGui::BeginTable("tablecdbtn", 1, FlagsTable)) { - ImGui::TableSetupColumn("C Button Down settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("C Button Down", "gCBtnD"); - DrawPositionsRadioBoxes("gCBtnD"); - s16 Min_X_CD = 0; - s16 Max_X_CD = ImGui::GetWindowViewport()->Size.x/2; - if(CVarGetInteger("gCBtnDPosType",0) == 2){ - Max_X_CD = 294; - } else if(CVarGetInteger("gCBtnDPosType",0) == 3){ - Max_X_CD = ImGui::GetWindowViewport()->Size.x/2; - } else if(CVarGetInteger("gCBtnDPosType",0) == 4){ - Min_X_CD = (ImGui::GetWindowViewport()->Size.x/2)*-1; - } - DrawPositionSlider("gCBtnD", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_CD, Max_X_CD); - DrawScaleSlider("gCBtnD",0.87f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("C Button Left position")) { - if (ImGui::BeginTable("tableclbtn", 1, FlagsTable)) { - ImGui::TableSetupColumn("C Button Left settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("C Button Left", "gCBtnL"); - DrawPositionsRadioBoxes("gCBtnL"); - s16 Min_X_CL = 0; - s16 Max_X_CL = ImGui::GetWindowViewport()->Size.x/2; - if(CVarGetInteger("gCBtnLPosType",0) == 2){ - Max_X_CL = 294; - } else if(CVarGetInteger("gCBtnLPosType",0) == 3){ - Max_X_CL = ImGui::GetWindowViewport()->Size.x/2; - } else if(CVarGetInteger("gCBtnLPosType",0) == 4){ - Min_X_CL = (ImGui::GetWindowViewport()->Size.x/2)*-1; - } - DrawPositionSlider("gCBtnL", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_CL, Max_X_CL); - DrawScaleSlider("gCBtnL",0.87f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("C Button Right position")) { - if (ImGui::BeginTable("tablecrnbtn", 1, FlagsTable)) { - ImGui::TableSetupColumn("C Button Right settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("C Button Right", "gCBtnR"); - DrawPositionsRadioBoxes("gCBtnR"); - s16 Min_X_CR = 0; - s16 Max_X_CR = ImGui::GetWindowViewport()->Size.x/2; - if(CVarGetInteger("gCBtnRPosType",0) == 2){ - Max_X_CR = 294; - } else if(CVarGetInteger("gCBtnRPosType",0) == 3){ - Max_X_CR = ImGui::GetWindowViewport()->Size.x/2; - } else if(CVarGetInteger("gCBtnRPosType",0) == 4){ - Min_X_CR = (ImGui::GetWindowViewport()->Size.x/2)*-1; - } - DrawPositionSlider("gCBtnR", 0, ImGui::GetWindowViewport()->Size.y/2, Min_X_CR, Max_X_CR); - DrawScaleSlider("gCBtnR",0.87f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } + Draw_Table_Dropdown("B Button position", "tablebbtn", "B Button settings", "B Button", "gBBtn", 0, ImGui::GetWindowViewport()->Size.y/4+50, -1, ImGui::GetWindowViewport()->Size.x-50, 0.95f); + Draw_Table_Dropdown("A Button position", "tableabtn", "A Button settings", "A Button", "gABtn", -10, ImGui::GetWindowViewport()->Size.y/4+50, -20, ImGui::GetWindowViewport()->Size.x-50, 0.95f); + Draw_Table_Dropdown("Start Button position", "tablestartbtn", "Start Button settings", "Start Button", "gStartBtn", 0, ImGui::GetWindowViewport()->Size.y/2, 0, ImGui::GetWindowViewport()->Size.x/2+70, 0.75f); + C_Button_Dropdown("C Button Up position", "tablecubtn", "C Button Up settings", "C Button Up", "gCBtnU", "gCBtnUPosType", 0.5f); + C_Button_Dropdown("C Button Down position", "tablecdbtn", "C Button Down settings", "C Button Down", "gCBtnD", "gCBtnDPosType", 0.87f); + C_Button_Dropdown("C Button Left position", "tableclbtn", "C Button Left settings", "C Button Left", "gCBtnL", "gCBtnLPosType", 0.87f); + C_Button_Dropdown("C Button Right position", "tablecrbtn", "C Button Right settings", "C Button Right", "gCBtnR", "gCBtnRPosType", 0.87f); if (CVarGetInteger("gDpadEquips",0) && ImGui::CollapsingHeader("DPad items position")) { if (ImGui::BeginTable("tabledpaditems", 1, FlagsTable)) { ImGui::TableSetupColumn("DPad items settings", FlagsCell, TablesCellsWidth); @@ -1390,115 +1314,15 @@ void Draw_Placements(){ ImGui::EndTable(); } } - if (ImGui::CollapsingHeader("Minimaps position")) { - if (ImGui::BeginTable("tableminimapspos", 1, FlagsTable)) { - ImGui::TableSetupColumn("minimaps settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("Minimap", "gMinimap"); - DrawPositionsRadioBoxes("gMinimap", false); - DrawPositionSlider("gMinimap", (ImGui::GetWindowViewport()->Size.y/3)*-1, ImGui::GetWindowViewport()->Size.y/3, ImGui::GetWindowViewport()->Size.x*-1, ImGui::GetWindowViewport()->Size.x/2); - DrawScaleSlider("gMinimap",1.0f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("Small Keys counter position")) { - if (ImGui::BeginTable("tablesmolekeys", 1, FlagsTable)) { - ImGui::TableSetupColumn("Small Keys counter settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("Small Keys counter", "gSKC"); - DrawPositionsRadioBoxes("gSKC"); - DrawPositionSlider("gSKC", 0, ImGui::GetWindowViewport()->Size.y/3, -1, ImGui::GetWindowViewport()->Size.x/2); - DrawScaleSlider("gSKC",1.0f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("Rupee counter position")) { - if (ImGui::BeginTable("tablerupeecount", 1, FlagsTable)) { - ImGui::TableSetupColumn("Rupee counter settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("Rupee counter", "gRC"); - DrawPositionsRadioBoxes("gRC"); - DrawPositionSlider("gRC", -2, ImGui::GetWindowViewport()->Size.y/3, -3, ImGui::GetWindowViewport()->Size.x/2); - DrawScaleSlider("gRC",1.0f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("Carrots position")) { - if (ImGui::BeginTable("tableCarrots", 1, FlagsTable)) { - ImGui::TableSetupColumn("Carrots settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("Carrots", "gCarrots"); - DrawPositionsRadioBoxes("gCarrots"); - DrawPositionSlider("gCarrots", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+25); - DrawScaleSlider("gCarrots",1.0f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("Timers position")) { - if (ImGui::BeginTable("tabletimers", 1, FlagsTable)) { - ImGui::TableSetupColumn("Timers settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("Timers", "gTimers"); - DrawPositionsRadioBoxes("gTimers"); - DrawPositionSlider("gTimers", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2-50); - DrawScaleSlider("gTimers",1.0f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("Archery Scores position")) { - if (ImGui::BeginTable("tablearchery", 1, FlagsTable)) { - ImGui::TableSetupColumn("Archery Scores settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("Archery scores", "gAS"); - DrawPositionsRadioBoxes("gAS", false); - DrawPositionSlider("gAS", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2-50); - DrawScaleSlider("gAS",1.0f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("Title cards (Maps) position")) { - if (ImGui::BeginTable("tabletcmaps", 1, FlagsTable)) { - ImGui::TableSetupColumn("Titlecard maps settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("Title cards (overworld)", "gTCM"); - DrawPositionsRadioBoxes("gTCM"); - DrawPositionSlider("gTCM", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+10); - DrawScaleSlider("gTCM",1.0f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("Title cards (Bosses) position")) { - if (ImGui::BeginTable("tabletcbosses", 1, FlagsTable)) { - ImGui::TableSetupColumn("Title cards (Bosses) settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("Title cards (Bosses)", "gTCB"); - DrawPositionsRadioBoxes("gTCB"); - DrawPositionSlider("gTCB", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+10); - DrawScaleSlider("gTCB",1.0f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } - if (ImGui::CollapsingHeader("In-game Gameplay Timer position")) { - if (ImGui::BeginTable("tablegameplaytimer", 1, FlagsTable)) { - ImGui::TableSetupColumn("In-game Gameplay Timer settings", FlagsCell, TablesCellsWidth); - Table_InitHeader(false); - DrawUseMarginsSlider("In-game Gameplay Timer", "gIGT"); - DrawPositionsRadioBoxes("gIGT"); - DrawPositionSlider("gIGT", 0, ImGui::GetWindowViewport()->Size.y / 2, -50, - ImGui::GetWindowViewport()->Size.x / 2 + 10); - DrawScaleSlider("gIGT", 1.0f); - ImGui::NewLine(); - ImGui::EndTable(); - } - } + Draw_Table_Dropdown("Minimaps position", "tableminimapspos", "minimaps settings", "Minimap", "gMinimap", (ImGui::GetWindowViewport()->Size.y/3)*-1, ImGui::GetWindowViewport()->Size.y/3, ImGui::GetWindowViewport()->Size.x*-1, ImGui::GetWindowViewport()->Size.x/2, 1.0f); + Draw_Table_Dropdown("Small Keys counter position", "tablesmolekeys", "Small Keys counter settings", "Small Keys counter", "gSKC", 0, ImGui::GetWindowViewport()->Size.y/3, -1, ImGui::GetWindowViewport()->Size.x/2, 1.0f); + Draw_Table_Dropdown("Rupee counter position", "tablerupeecount", "Rupee counter settings", "Rupee counter", "gRC", -2, ImGui::GetWindowViewport()->Size.y/3, -3, ImGui::GetWindowViewport()->Size.x/2, 1.0f); + Draw_Table_Dropdown("Carrots position", "tableCarrots", "Carrots settings", "Carrots", "gCarrots", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+25, 1.0f); + Draw_Table_Dropdown("Timers position", "tabletimers", "Timers settings", "Timers", "gTimers", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2-50, 1.0f); + Draw_Table_Dropdown("Archery Scores position", "tablearchery", "Archery Scores settings", "Archery scores", "gAS", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2-50, 1.0f); + Draw_Table_Dropdown("Title cards (Maps) position", "tabletcmaps", "Titlecard maps settings", "Title cards (overworld)", "gTCM", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+10, 1.0f); + Draw_Table_Dropdown("Title cards (Bosses) position", "tabletcbosses", "Title cards (Bosses) settings", "Title cards (Bosses)", "gTCB", 0, ImGui::GetWindowViewport()->Size.y/2, -50, ImGui::GetWindowViewport()->Size.x/2+10, 1.0f); + Draw_Table_Dropdown("In-game Gameplay Timer position", "tablegameplaytimer", "In-game Gameplay Timer settings", "In-game Gameplay Timer", "gIGT", 0, ImGui::GetWindowViewport()->Size.y / 2, -50, ImGui::GetWindowViewport()->Size.x / 2 + 10, 1.0f); if (ImGui::CollapsingHeader("Enemy Health Bar position")) { if (ImGui::BeginTable("enemyhealthbar", 1, FlagsTable)) { ImGui::TableSetupColumn("Enemy Health Bar settings", FlagsCell, TablesCellsWidth); @@ -1526,7 +1350,21 @@ void Draw_Placements(){ } } } - +void Reset_Option_Single(const char* Button_Title, const char* name) { + ImGui::SameLine(); + if (ImGui::Button(Button_Title)) { + CVarClear(name); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + } +} +void Reset_Option_Double(const char* Button_Title, const char* name) { + ImGui::SameLine(); + if (ImGui::Button(Button_Title)) { + CVarClear((std::string(name) + ".Value").c_str()); + CVarClear((std::string(name) + ".Changed").c_str()); + LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); + } +} void DrawSillyTab() { ImGui::BeginDisabled(CVarGetInteger("gDisableChangingSettings", 0)); if (CVarGetInteger("gLetItSnow", 0)) { @@ -1552,68 +1390,28 @@ void DrawSillyTab() { if (UIWidgets::EnhancementSliderFloat("Link Head Scale: %.2fx", "##Link_HeadScale", "gCosmetics.Link_HeadScale.Value", 0.4f, 4.0f, "", 1.0f, false)) { CVarSetInteger("gCosmetics.Link_HeadScale.Changed", 1); } - ImGui::SameLine(); - if (ImGui::Button("Reset##Link_HeadScale")) { - CVarClear("gCosmetics.Link_HeadScale.Value"); - CVarClear("gCosmetics.Link_HeadScale.Changed"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - } - if (UIWidgets::EnhancementSliderFloat("Link Sword Scale: %.3fx", "##Link_SwordScale", "gCosmetics.Link_SwordScale.Value", 1.0f, 2.5f, "", 1.0f, false)) { + Reset_Option_Double("Reset##Link_HeadScale", "gCosmetics.Link_HeadScale"); + if (UIWidgets::EnhancementSliderFloat("Link Sword Scale: %f", "##Link_SwordScale", "gCosmetics.Link_SwordScale.Value", 1.0f, 2.5f, "", 1.0f, false)) { CVarSetInteger("gCosmetics.Link_SwordScale.Changed", 1); } - ImGui::SameLine(); - if (ImGui::Button("Reset##Link_SwordScale")) { - CVarClear("gCosmetics.Link_SwordScale.Value"); - CVarClear("gCosmetics.Link_SwordScale.Changed"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - } - UIWidgets::EnhancementSliderFloat("Bunny Hood Length: %.0f", "##BunnyHood_EarLength", "gCosmetics.BunnyHood_EarLength", -300.0f, 1000.0f, "", 0.0f, false); - ImGui::SameLine(); - if (ImGui::Button("Reset##BunnyHood_EarLength")) { - CVarClear("gCosmetics.BunnyHood_EarLength"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - } - UIWidgets::EnhancementSliderFloat("Bunny Hood Spread: %.0f", "##BunnyHood_EarSpread", "gCosmetics.BunnyHood_EarSpread", -300.0f, 500.0f, "", 0.0f, false); - ImGui::SameLine(); - if (ImGui::Button("Reset##BunnyHood_EarSpread")) { - CVarClear("gCosmetics.BunnyHood_EarSpread"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - } - UIWidgets::EnhancementSliderFloat("Goron Neck Length: %.0f", "##Goron_NeckLength", "gCosmetics.Goron_NeckLength", 0.0f, 5000.0f, "", 0.0f, false); - ImGui::SameLine(); - if (ImGui::Button("Reset##Goron_NeckLength")) { - CVarClear("gCosmetics.Goron_NeckLength"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - } + Reset_Option_Double("Reset##Link_SwordScale", "gCosmetics.Link_SwordScale"); + UIWidgets::EnhancementSliderFloat("Bunny Hood Length: %f", "##BunnyHood_EarLength", "gCosmetics.BunnyHood_EarLength", -300.0f, 1000.0f, "", 0.0f, false); + Reset_Option_Single("Reset##BunnyHood_EarLength", "gCosmetics.BunnyHood_EarLength"); + UIWidgets::EnhancementSliderFloat("Bunny Hood Spread: %f", "##BunnyHood_EarSpread", "gCosmetics.BunnyHood_EarSpread", -300.0f, 500.0f, "", 0.0f, false); + Reset_Option_Single("Reset##BunnyHood_EarSpread", "gCosmetics.BunnyHood_EarSpread"); + UIWidgets::EnhancementSliderFloat("Goron Neck Length: %f", "##Goron_NeckLength", "gCosmetics.Goron_NeckLength", 0.0f, 1000.0f, "", 0.0f, false); + Reset_Option_Single("Reset##Goron_NeckLength", "gCosmetics.Goron_NeckLength"); UIWidgets::EnhancementCheckbox("Unfix Goron Spin", "gUnfixGoronSpin"); - UIWidgets::EnhancementSliderFloat("Fairies Size: %.2fx", "##Fairies_Size", "gCosmetics.Fairies_Size", 0.25f, 5.0f, "", 1.0f, false); - ImGui::SameLine(); - if (ImGui::Button("Reset##Fairies_Size")) { - CVarClear("gCosmetics.Fairies_Size"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - } - UIWidgets::EnhancementSliderFloat("N64 Logo Spin Speed: %.2fx", "##N64Logo_SpinSpeed", "gCosmetics.N64Logo_SpinSpeed", 0.25f, 5.0f, "", 1.0f, false); - ImGui::SameLine(); - if (ImGui::Button("Reset##N64Logo_SpinSpeed")) { - CVarClear("gCosmetics.N64Logo_SpinSpeed"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - } - UIWidgets::EnhancementSliderFloat("Moon Size: %.1f %%", "##Moon_Size", "gCosmetics.Moon_Size", 0.5f, 2.0f, "", 1.0f, true); - ImGui::SameLine(); - if (ImGui::Button("Reset##Moon_Size")) { - CVarClear("gCosmetics.Moon_Size"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - } - if (UIWidgets::EnhancementSliderFloat("Kak Windmill Speed: %.0f", "##Kak_Windmill_Speed", "gCosmetics.Kak_Windmill_Speed.Value", 100.0f, 6000.0f, "", 100.0f, false)) { + UIWidgets::EnhancementSliderFloat("Fairies Size: %f", "##Fairies_Size", "gCosmetics.Fairies_Size", 0.25f, 5.0f, "", 1.0f, false); + Reset_Option_Single("Reset##Fairies_Size", "gCosmetics.Fairies_Size"); + UIWidgets::EnhancementSliderFloat("N64 Logo Spin Speed: %f", "##N64Logo_SpinSpeed", "gCosmetics.N64Logo_SpinSpeed", 0.25f, 5.0f, "", 1.0f, false); + Reset_Option_Single("Reset##N64Logo_SpinSpeed", "gCosmetics.N64Logo_SpinSpeed"); + UIWidgets::EnhancementSliderFloat("Moon Size: %f", "##Moon_Size", "gCosmetics.Moon_Size", 0.5f, 2.0f, "", 1.0f, false); + Reset_Option_Single("Reset##Moon_Size", "gCosmetics.Moon_Size"); + if (UIWidgets::EnhancementSliderFloat("Kak Windmill Speed: %f", "##Kak_Windmill_Speed", "gCosmetics.Kak_Windmill_Speed.Value", 100.0f, 6000.0f, "", 100.0f, false)) { CVarSetInteger("gCosmetics.Kak_Windmill_Speed.Changed", 1); } - ImGui::SameLine(); - if (ImGui::Button("Reset##Kak_Windmill_Speed")) { - CVarClear("gCosmetics.Kak_Windmill_Speed.Value"); - CVarClear("gCosmetics.Kak_Windmill_Speed.Changed"); - LUS::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesOnNextTick(); - } - ImGui::EndDisabled(); + Reset_Option_Double("Reset##Kak_Windmill_Speed", "gCosmetics.Kak_Windmill_Speed"); } // Copies the RGB values from one cosmetic option to another, multiplied by the passed in amount, this From e0d502b696179e2cbae6b284015cfe8d4c251834 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 15 Feb 2024 22:06:52 -0500 Subject: [PATCH 36/44] resource refactory (#3926) * animation * playeranimation * stop putting things in the LUS namespace from SoH * get all the factories out of the namespace * LUS:: * start on scene command stuff * i think that's the rest of scene * reduce copypasta * collision header * skeleton * skeletonlimb * fix * path * cutscene * text * audio sample * sound font * audiosequence * background * Revert "stop putting things in the LUS namespace from SoH" This reverts commit 0ead6056e66287f515a3bb0f9117ad93bc32d543. * namespace shanans * wrap all factories in namespace soh * it's trying to link now * lus * scene command override etc * fix audio loading * slightly less logspam * get past the cutscene problem * in game! * exporter cleanup * more exporter cleanup * clang formatted lus * msvc * itny lus change * variant * formatty * fix of some sort i guess? * use latest lus main * fix name to enum/factory mapping * otrexporter --- OTRExporter | 2 +- libultraship | 2 +- soh/soh/OTRGlobals.cpp | 44 ++--- .../resource/importer/AnimationFactory.cpp | 32 +--- soh/soh/resource/importer/AnimationFactory.h | 16 +- .../resource/importer/AudioSampleFactory.cpp | 36 +--- .../resource/importer/AudioSampleFactory.h | 18 +- .../importer/AudioSequenceFactory.cpp | 33 +--- .../resource/importer/AudioSequenceFactory.h | 18 +- .../importer/AudioSoundFontFactory.cpp | 33 +--- .../resource/importer/AudioSoundFontFactory.h | 18 +- .../resource/importer/BackgroundFactory.cpp | 31 +--- soh/soh/resource/importer/BackgroundFactory.h | 16 +- .../importer/CollisionHeaderFactory.cpp | 69 +++----- .../importer/CollisionHeaderFactory.h | 19 +-- soh/soh/resource/importer/CutsceneFactory.cpp | 49 ++---- soh/soh/resource/importer/CutsceneFactory.h | 18 +- soh/soh/resource/importer/PathFactory.cpp | 34 +--- soh/soh/resource/importer/PathFactory.h | 18 +- .../importer/PlayerAnimationFactory.cpp | 38 ++--- .../importer/PlayerAnimationFactory.h | 16 +- soh/soh/resource/importer/SceneFactory.cpp | 114 ++++++------- soh/soh/resource/importer/SceneFactory.h | 24 ++- soh/soh/resource/importer/SkeletonFactory.cpp | 85 +++------- soh/soh/resource/importer/SkeletonFactory.h | 22 +-- .../resource/importer/SkeletonLimbFactory.cpp | 86 +++------- .../resource/importer/SkeletonLimbFactory.h | 22 +-- soh/soh/resource/importer/TextFactory.cpp | 83 +++------- soh/soh/resource/importer/TextFactory.h | 22 +-- .../scenecommand/EndMarkerFactory.cpp | 38 +---- .../importer/scenecommand/EndMarkerFactory.h | 14 +- .../scenecommand/SceneCommandFactory.cpp | 7 +- .../scenecommand/SceneCommandFactory.h | 13 +- .../scenecommand/SetActorListFactory.cpp | 54 ++---- .../scenecommand/SetActorListFactory.h | 15 +- .../SetAlternateHeadersFactory.cpp | 49 ++---- .../scenecommand/SetAlternateHeadersFactory.h | 15 +- .../scenecommand/SetCameraSettingsFactory.cpp | 36 +--- .../scenecommand/SetCameraSettingsFactory.h | 15 +- .../SetCollisionHeaderFactory.cpp | 35 +--- .../scenecommand/SetCollisionHeaderFactory.h | 15 +- .../scenecommand/SetCsCameraFactory.cpp | 35 +--- .../scenecommand/SetCsCameraFactory.h | 15 +- .../scenecommand/SetCutscenesFactory.cpp | 36 +--- .../scenecommand/SetCutscenesFactory.h | 15 +- .../scenecommand/SetEchoSettingsFactory.cpp | 36 +--- .../scenecommand/SetEchoSettingsFactory.h | 15 +- .../scenecommand/SetEntranceListFactory.cpp | 35 +--- .../scenecommand/SetEntranceListFactory.h | 15 +- .../scenecommand/SetExitListFactory.cpp | 35 +--- .../scenecommand/SetExitListFactory.h | 15 +- .../scenecommand/SetLightListFactory.cpp | 41 +---- .../scenecommand/SetLightListFactory.h | 15 +- .../SetLightingSettingsFactory.cpp | 36 +--- .../scenecommand/SetLightingSettingsFactory.h | 15 +- .../importer/scenecommand/SetMeshFactory.cpp | 45 ++--- .../importer/scenecommand/SetMeshFactory.h | 15 +- .../scenecommand/SetObjectListFactory.cpp | 36 +--- .../scenecommand/SetObjectListFactory.h | 15 +- .../scenecommand/SetPathwaysFactory.cpp | 35 +--- .../scenecommand/SetPathwaysFactory.h | 15 +- .../scenecommand/SetRoomBehaviorFactory.cpp | 35 +--- .../scenecommand/SetRoomBehaviorFactory.h | 15 +- .../scenecommand/SetRoomListFactory.cpp | 46 ++---- .../scenecommand/SetRoomListFactory.h | 15 +- .../scenecommand/SetSkyboxModifierFactory.cpp | 35 +--- .../scenecommand/SetSkyboxModifierFactory.h | 15 +- .../scenecommand/SetSkyboxSettingsFactory.cpp | 35 +--- .../scenecommand/SetSkyboxSettingsFactory.h | 15 +- .../scenecommand/SetSoundSettingsFactory.cpp | 35 +--- .../scenecommand/SetSoundSettingsFactory.h | 15 +- .../scenecommand/SetSpecialObjectsFactory.cpp | 35 +--- .../scenecommand/SetSpecialObjectsFactory.h | 15 +- .../SetStartPositionListFactory.cpp | 56 ++----- .../SetStartPositionListFactory.h | 15 +- .../scenecommand/SetTimeSettingsFactory.cpp | 35 +--- .../scenecommand/SetTimeSettingsFactory.h | 15 +- .../SetTransitionActorListFactory.cpp | 37 +---- .../SetTransitionActorListFactory.h | 15 +- .../scenecommand/SetWindSettingsFactory.cpp | 35 +--- .../scenecommand/SetWindSettingsFactory.h | 15 +- soh/soh/resource/type/Animation.cpp | 4 +- soh/soh/resource/type/Animation.h | 134 +++++++-------- soh/soh/resource/type/AudioSample.cpp | 4 +- soh/soh/resource/type/AudioSample.h | 6 +- soh/soh/resource/type/AudioSequence.cpp | 4 +- soh/soh/resource/type/AudioSequence.h | 6 +- soh/soh/resource/type/AudioSoundFont.cpp | 4 +- soh/soh/resource/type/AudioSoundFont.h | 6 +- soh/soh/resource/type/Background.cpp | 4 +- soh/soh/resource/type/Background.h | 6 +- soh/soh/resource/type/CollisionHeader.cpp | 4 +- soh/soh/resource/type/CollisionHeader.h | 6 +- soh/soh/resource/type/Cutscene.cpp | 4 +- soh/soh/resource/type/Cutscene.h | 8 +- soh/soh/resource/type/Path.cpp | 4 +- soh/soh/resource/type/Path.h | 6 +- soh/soh/resource/type/PlayerAnimation.cpp | 4 +- soh/soh/resource/type/PlayerAnimation.h | 9 +- soh/soh/resource/type/Scene.cpp | 4 +- soh/soh/resource/type/Scene.h | 6 +- soh/soh/resource/type/Skeleton.cpp | 4 +- soh/soh/resource/type/Skeleton.h | 8 +- soh/soh/resource/type/SkeletonLimb.cpp | 4 +- soh/soh/resource/type/SkeletonLimb.h | 8 +- soh/soh/resource/type/SohResourceType.h | 21 +++ soh/soh/resource/type/Text.cpp | 4 +- soh/soh/resource/type/Text.h | 6 +- .../resource/type/scenecommand/EndMarker.cpp | 4 +- .../resource/type/scenecommand/EndMarker.h | 2 +- soh/soh/resource/type/scenecommand/RomFile.h | 2 +- .../resource/type/scenecommand/SceneCommand.h | 6 +- .../type/scenecommand/SetActorList.cpp | 4 +- .../resource/type/scenecommand/SetActorList.h | 2 +- .../type/scenecommand/SetAlternateHeaders.cpp | 4 +- .../type/scenecommand/SetAlternateHeaders.h | 2 +- .../type/scenecommand/SetCameraSettings.cpp | 4 +- .../type/scenecommand/SetCameraSettings.h | 2 +- .../type/scenecommand/SetCollisionHeader.cpp | 4 +- .../type/scenecommand/SetCollisionHeader.h | 2 +- .../type/scenecommand/SetCsCamera.cpp | 4 +- .../resource/type/scenecommand/SetCsCamera.h | 2 +- .../type/scenecommand/SetCutscenes.cpp | 4 +- .../resource/type/scenecommand/SetCutscenes.h | 2 +- .../type/scenecommand/SetEchoSettings.cpp | 4 +- .../type/scenecommand/SetEchoSettings.h | 2 +- .../type/scenecommand/SetEntranceList.cpp | 4 +- .../type/scenecommand/SetEntranceList.h | 2 +- .../type/scenecommand/SetExitList.cpp | 4 +- .../resource/type/scenecommand/SetExitList.h | 2 +- .../type/scenecommand/SetLightList.cpp | 4 +- .../resource/type/scenecommand/SetLightList.h | 2 +- .../type/scenecommand/SetLightingSettings.cpp | 4 +- .../type/scenecommand/SetLightingSettings.h | 2 +- .../resource/type/scenecommand/SetMesh.cpp | 4 +- soh/soh/resource/type/scenecommand/SetMesh.h | 2 +- .../type/scenecommand/SetObjectList.cpp | 4 +- .../type/scenecommand/SetObjectList.h | 2 +- .../type/scenecommand/SetPathways.cpp | 4 +- .../resource/type/scenecommand/SetPathways.h | 2 +- .../type/scenecommand/SetRoomBehavior.cpp | 4 +- .../type/scenecommand/SetRoomBehavior.h | 2 +- .../type/scenecommand/SetRoomList.cpp | 4 +- .../resource/type/scenecommand/SetRoomList.h | 2 +- .../type/scenecommand/SetSkyboxModifier.cpp | 4 +- .../type/scenecommand/SetSkyboxModifier.h | 2 +- .../type/scenecommand/SetSkyboxSettings.cpp | 4 +- .../type/scenecommand/SetSkyboxSettings.h | 2 +- .../type/scenecommand/SetSoundSettings.cpp | 4 +- .../type/scenecommand/SetSoundSettings.h | 2 +- .../type/scenecommand/SetSpecialObjects.cpp | 4 +- .../type/scenecommand/SetSpecialObjects.h | 2 +- .../scenecommand/SetStartPositionList.cpp | 4 +- .../type/scenecommand/SetStartPositionList.h | 2 +- .../type/scenecommand/SetTimeSettings.cpp | 4 +- .../type/scenecommand/SetTimeSettings.h | 2 +- .../scenecommand/SetTransitionActorList.cpp | 4 +- .../scenecommand/SetTransitionActorList.h | 2 +- .../type/scenecommand/SetWindSettings.cpp | 4 +- .../type/scenecommand/SetWindSettings.h | 2 +- soh/soh/z_message_OTR.cpp | 8 +- soh/soh/z_play_otr.cpp | 4 +- soh/soh/z_scene_otr.cpp | 154 +++++++++--------- 163 files changed, 990 insertions(+), 2000 deletions(-) create mode 100644 soh/soh/resource/type/SohResourceType.h diff --git a/OTRExporter b/OTRExporter index d8f3c4dd4..e93bd2be0 160000 --- a/OTRExporter +++ b/OTRExporter @@ -1 +1 @@ -Subproject commit d8f3c4dd4a46fb46c4f69cd387afadfa711606e9 +Subproject commit e93bd2be062b13106fdb29d98cf4ada4d7ad6827 diff --git a/libultraship b/libultraship index d5a39635a..a516b66ce 160000 --- a/libultraship +++ b/libultraship @@ -1 +1 @@ -Subproject commit d5a39635a118f814613c0fdd1601f80c809a742d +Subproject commit a516b66ce0c89fe4e33c55b1fbfbde845d0bf129 diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index 9548de28d..4d82de6bc 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -92,6 +92,7 @@ GameInteractorSail* GameInteractorSail::Instance; #include // Resource Types/Factories +#include "soh/resource/type/SohResourceType.h" #include "soh/resource/type/Animation.h" #include "soh/resource/type/AudioSample.h" #include "soh/resource/type/AudioSequence.h" @@ -319,19 +320,24 @@ OTRGlobals::OTRGlobals() { SPDLOG_INFO("Starting Ship of Harkinian version {}", (char*)gBuildVersion); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Animation), std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_PlayerAnimation), std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Room), std::make_shared()); // Is room scene? maybe? - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_CollisionHeader), std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Skeleton), std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_SkeletonLimb), std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Path), std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Cutscene), std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Text), std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_AudioSample), std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_AudioSoundFont), std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_AudioSequence), std::make_shared()); - context->GetResourceManager()->GetResourceLoader()->RegisterResourceFactory(static_cast(LUS::ResourceType::SOH_Background), std::make_shared()); + auto loader = context->GetResourceManager()->GetResourceLoader(); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Animation", static_cast(SOH::ResourceType::SOH_Animation), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "PlayerAnimation", static_cast(SOH::ResourceType::SOH_PlayerAnimation), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Room", static_cast(SOH::ResourceType::SOH_Room), 0); // Is room scene? maybe? + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "CollisionHeader", static_cast(SOH::ResourceType::SOH_CollisionHeader), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_XML, "CollisionHeader", static_cast(SOH::ResourceType::SOH_CollisionHeader), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Skeleton", static_cast(SOH::ResourceType::SOH_Skeleton), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_XML, "Skeleton", static_cast(SOH::ResourceType::SOH_Skeleton), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "SkeletonLimb", static_cast(SOH::ResourceType::SOH_SkeletonLimb), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_XML, "SkeletonLimb", static_cast(SOH::ResourceType::SOH_SkeletonLimb), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Path", static_cast(SOH::ResourceType::SOH_Path), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Cutscene", static_cast(SOH::ResourceType::SOH_Cutscene), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Text", static_cast(SOH::ResourceType::SOH_Text), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_XML, "Text", static_cast(SOH::ResourceType::SOH_Text), 0); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "AudioSample", static_cast(SOH::ResourceType::SOH_AudioSample), 2); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "AudioSoundFont", static_cast(SOH::ResourceType::SOH_AudioSoundFont), 2); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "AudioSequence", static_cast(SOH::ResourceType::SOH_AudioSequence), 2); + loader->RegisterResourceFactory(std::make_shared(), RESOURCE_FORMAT_BINARY, "Background", static_cast(SOH::ResourceType::SOH_Background), 0); gSaveStateMgr = std::make_shared(); gRandomizer = std::make_shared(); @@ -1390,7 +1396,7 @@ extern "C" void Graph_ProcessGfxCommands(Gfx* commands) { // Actually update the CVar now before runing the alt asset update listeners CVarSetInteger("gAltAssets", !CVarGetInteger("gAltAssets", 0)); gfx_texture_cache_clear(); - LUS::SkeletonPatcher::UpdateSkeletons(); + SOH::SkeletonPatcher::UpdateSkeletons(); GameInteractor::Instance->ExecuteHooks(); } @@ -1618,7 +1624,7 @@ extern "C" uint8_t ResourceMgr_TexIsRaw(const char* texPath) { extern "C" uint8_t ResourceMgr_ResourceIsBackground(char* texPath) { auto res = GetResourceByNameHandlingMQ(texPath); - return res->GetInitData()->Type == static_cast(LUS::ResourceType::SOH_Background); + return res->GetInitData()->Type == static_cast(SOH::ResourceType::SOH_Background); } extern "C" char* ResourceMgr_LoadJPEG(char* data, size_t dataSize) @@ -1689,7 +1695,7 @@ extern "C" Sprite* GetSeedTexture(uint8_t index) { } extern "C" char* ResourceMgr_LoadPlayerAnimByName(const char* animPath) { - auto anim = std::static_pointer_cast(GetResourceByNameHandlingMQ(animPath)); + auto anim = std::static_pointer_cast(GetResourceByNameHandlingMQ(animPath)); return (char*)&anim->limbRotData[0]; } @@ -1953,7 +1959,7 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel // Therefore we can take this oppurtunity to take note of the Skeleton that is created... if (skelAnime != nullptr) { auto stringPath = std::string(path); - LUS::SkeletonPatcher::RegisterSkeleton(stringPath, skelAnime); + SOH::SkeletonPatcher::RegisterSkeleton(stringPath, skelAnime); } return skelHeader; @@ -1961,12 +1967,12 @@ extern "C" SkeletonHeader* ResourceMgr_LoadSkeletonByName(const char* path, Skel extern "C" void ResourceMgr_UnregisterSkeleton(SkelAnime* skelAnime) { if (skelAnime != nullptr) - LUS::SkeletonPatcher::UnregisterSkeleton(skelAnime); + SOH::SkeletonPatcher::UnregisterSkeleton(skelAnime); } extern "C" void ResourceMgr_ClearSkeletons(SkelAnime* skelAnime) { if (skelAnime != nullptr) - LUS::SkeletonPatcher::ClearSkeletons(); + SOH::SkeletonPatcher::ClearSkeletons(); } extern "C" s32* ResourceMgr_LoadCSByName(const char* path) { diff --git a/soh/soh/resource/importer/AnimationFactory.cpp b/soh/soh/resource/importer/AnimationFactory.cpp index c2aaf3067..8e1aca9b7 100644 --- a/soh/soh/resource/importer/AnimationFactory.cpp +++ b/soh/soh/resource/importer/AnimationFactory.cpp @@ -2,32 +2,14 @@ #include "soh/resource/type/Animation.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -AnimationFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Animation with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryAnimationV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { - std::shared_ptr animation = std::static_pointer_cast(resource); - - ResourceVersionFactory::ParseFileBinary(reader, animation); + auto animation = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); AnimationType animType = (AnimationType)reader->ReadUInt32(); animation->type = animType; @@ -100,5 +82,7 @@ void LUS::AnimationFactoryV0::ParseFileBinary(std::shared_ptr read } else if (animType == AnimationType::Legacy) { SPDLOG_DEBUG("BEYTAH ANIMATION?!"); } + + return animation; } -} // namespace LUS +} // namespace SOH \ No newline at end of file diff --git a/soh/soh/resource/importer/AnimationFactory.h b/soh/soh/resource/importer/AnimationFactory.h index dee2026f9..36dfceaae 100644 --- a/soh/soh/resource/importer/AnimationFactory.h +++ b/soh/soh/resource/importer/AnimationFactory.h @@ -1,17 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class AnimationFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinaryAnimationV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class AnimationFactoryV0 : public ResourceVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/AudioSampleFactory.cpp b/soh/soh/resource/importer/AudioSampleFactory.cpp index 9d1477a51..b45e698e5 100644 --- a/soh/soh/resource/importer/AudioSampleFactory.cpp +++ b/soh/soh/resource/importer/AudioSampleFactory.cpp @@ -2,33 +2,14 @@ #include "soh/resource/type/AudioSample.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -AudioSampleFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 2: - factory = std::make_shared(); - break; +namespace SOH { +std::shared_ptr ResourceFactoryBinaryAudioSampleV2::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; } - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load AudioSample with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr audioSample = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, audioSample); + auto audioSample = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); audioSample->sample.codec = reader->ReadUByte(); audioSample->sample.medium = reader->ReadUByte(); @@ -65,9 +46,10 @@ void LUS::AudioSampleFactoryV0::ParseFileBinary(std::shared_ptr re } audioSample->book.book = audioSample->bookData.data(); audioSample->sample.book = &audioSample->book; -} -} // namespace LUS + return audioSample; +} +} // namespace SOH /* in ResourceMgr_LoadAudioSample we used to have diff --git a/soh/soh/resource/importer/AudioSampleFactory.h b/soh/soh/resource/importer/AudioSampleFactory.h index 6e9ddc17c..2680ccdc2 100644 --- a/soh/soh/resource/importer/AudioSampleFactory.h +++ b/soh/soh/resource/importer/AudioSampleFactory.h @@ -1,19 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class AudioSampleFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinaryAudioSampleV2 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class AudioSampleFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/AudioSequenceFactory.cpp b/soh/soh/resource/importer/AudioSequenceFactory.cpp index a4862cb19..ba2a36697 100644 --- a/soh/soh/resource/importer/AudioSequenceFactory.cpp +++ b/soh/soh/resource/importer/AudioSequenceFactory.cpp @@ -2,33 +2,14 @@ #include "soh/resource/type/AudioSequence.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -AudioSequenceFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 2: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load AudioSequence with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryAudioSequenceV2::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr audioSequence = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, audioSequence); + auto audioSequence = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); audioSequence->sequence.seqDataSize = reader->ReadInt32(); audioSequence->sequenceData.reserve(audioSequence->sequence.seqDataSize); @@ -48,5 +29,7 @@ void LUS::AudioSequenceFactoryV0::ParseFileBinary(std::shared_ptr for (uint32_t i = 0; i < audioSequence->sequence.numFonts; i++) { audioSequence->sequence.fonts[i] = reader->ReadUByte(); } + + return audioSequence; } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/AudioSequenceFactory.h b/soh/soh/resource/importer/AudioSequenceFactory.h index 12b3809aa..fb4391d61 100644 --- a/soh/soh/resource/importer/AudioSequenceFactory.h +++ b/soh/soh/resource/importer/AudioSequenceFactory.h @@ -1,19 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class AudioSequenceFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinaryAudioSequenceV2 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class AudioSequenceFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/AudioSoundFontFactory.cpp b/soh/soh/resource/importer/AudioSoundFontFactory.cpp index 5a94cb5f8..6d7efc58c 100644 --- a/soh/soh/resource/importer/AudioSoundFontFactory.cpp +++ b/soh/soh/resource/importer/AudioSoundFontFactory.cpp @@ -3,33 +3,14 @@ #include "spdlog/spdlog.h" #include "libultraship/libultraship.h" -namespace LUS { -std::shared_ptr -AudioSoundFontFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 2: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load AudioSoundFont with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryAudioSoundFontV2::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr audioSoundFont = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, audioSoundFont); + auto audioSoundFont = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); audioSoundFont->soundFont.fntIndex = reader->ReadInt32(); audioSoundFont->medium = reader->ReadInt8(); @@ -186,5 +167,7 @@ void LUS::AudioSoundFontFactoryV0::ParseFileBinary(std::shared_ptr audioSoundFont->soundEffects.push_back(soundEffect); } audioSoundFont->soundFont.soundEffects = audioSoundFont->soundEffects.data(); + + return audioSoundFont; } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/AudioSoundFontFactory.h b/soh/soh/resource/importer/AudioSoundFontFactory.h index 7dd5bc0d5..a63533db9 100644 --- a/soh/soh/resource/importer/AudioSoundFontFactory.h +++ b/soh/soh/resource/importer/AudioSoundFontFactory.h @@ -1,19 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class AudioSoundFontFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinaryAudioSoundFontV2 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class AudioSoundFontFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/BackgroundFactory.cpp b/soh/soh/resource/importer/BackgroundFactory.cpp index 5b09ce70f..07c47cbe9 100644 --- a/soh/soh/resource/importer/BackgroundFactory.cpp +++ b/soh/soh/resource/importer/BackgroundFactory.cpp @@ -2,31 +2,14 @@ #include "soh/resource/type/Background.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -BackgroundFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Background with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryBackgroundV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) { - std::shared_ptr background = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, background); + auto background = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); uint32_t dataSize = reader->ReadUInt32(); @@ -35,5 +18,7 @@ void BackgroundFactoryV0::ParseFileBinary(std::shared_ptr reader, for (uint32_t i = 0; i < dataSize; i++) { background->Data.push_back(reader->ReadUByte()); } + + return background; } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/BackgroundFactory.h b/soh/soh/resource/importer/BackgroundFactory.h index 9767fdf8b..787ee509c 100644 --- a/soh/soh/resource/importer/BackgroundFactory.h +++ b/soh/soh/resource/importer/BackgroundFactory.h @@ -1,17 +1,11 @@ #pragma once #include "resource/Resource.h" -#include "resource/ResourceFactory.h" +#include "resource/ResourceFactoryBinary.h" -namespace LUS { -class BackgroundFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinaryBackgroundV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class BackgroundFactoryV0 : public ResourceVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/CollisionHeaderFactory.cpp b/soh/soh/resource/importer/CollisionHeaderFactory.cpp index 9300efdf0..c5372f249 100644 --- a/soh/soh/resource/importer/CollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/CollisionHeaderFactory.cpp @@ -2,54 +2,14 @@ #include "soh/resource/type/CollisionHeader.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -CollisionHeaderFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryCollisionHeaderV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileBinary(reader, resource); - - return resource; -} - -std::shared_ptr -CollisionHeaderFactory::ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Collision Header with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileXML(reader, resource); - - return resource; -} - -void LUS::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr collisionHeader = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, collisionHeader); + auto collisionHeader = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); collisionHeader->collisionHeaderData.minBounds.x = reader->ReadInt16(); collisionHeader->collisionHeaderData.minBounds.y = reader->ReadInt16(); @@ -159,10 +119,19 @@ void LUS::CollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptrwaterBoxes.push_back(waterBox); } collisionHeader->collisionHeaderData.waterBoxes = collisionHeader->waterBoxes.data(); + + return collisionHeader; } -void LUS::CollisionHeaderFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) { - std::shared_ptr collisionHeader = std::static_pointer_cast(resource); +std::shared_ptr ResourceFactoryXMLCollisionHeaderV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto collisionHeader = std::make_shared(file->InitData); + + auto reader = std::get>(file->Reader)->FirstChildElement(); + auto child = reader->FirstChildElement(); collisionHeader->collisionHeaderData.minBounds.x = reader->IntAttribute("MinBoundsX"); collisionHeader->collisionHeaderData.minBounds.y = reader->IntAttribute("MinBoundsY"); @@ -178,8 +147,6 @@ void LUS::CollisionHeaderFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, s zero.z = 0; collisionHeader->camPosDataZero = zero; - auto child = reader->FirstChildElement(); - while (child != nullptr) { std::string childName = child->Name(); if (childName == "Vertex") { @@ -274,5 +241,7 @@ void LUS::CollisionHeaderFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, s collisionHeader->collisionHeaderData.cameraDataList = collisionHeader->camData.data(); collisionHeader->collisionHeaderData.cameraDataListLen = collisionHeader->camDataCount; collisionHeader->collisionHeaderData.waterBoxes = collisionHeader->waterBoxes.data(); + + return collisionHeader; } -} \ No newline at end of file +} // namespace SOH diff --git a/soh/soh/resource/importer/CollisionHeaderFactory.h b/soh/soh/resource/importer/CollisionHeaderFactory.h index e0276b38f..abd878909 100644 --- a/soh/soh/resource/importer/CollisionHeaderFactory.h +++ b/soh/soh/resource/importer/CollisionHeaderFactory.h @@ -1,20 +1,17 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" +#include "ResourceFactoryXML.h" -namespace LUS { -class CollisionHeaderFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinaryCollisionHeaderV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; - std::shared_ptr - ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class CollisionHeaderFactoryV0 : public ResourceVersionFactory { +class ResourceFactoryXMLCollisionHeaderV0 : public LUS::ResourceFactoryXML { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/CutsceneFactory.cpp b/soh/soh/resource/importer/CutsceneFactory.cpp index 27c747a6e..28f5e642b 100644 --- a/soh/soh/resource/importer/CutsceneFactory.cpp +++ b/soh/soh/resource/importer/CutsceneFactory.cpp @@ -2,36 +2,14 @@ #include "soh/resource/type/Cutscene.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -CutsceneFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Cutscene with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -static inline uint32_t read_CMD_BBBB(std::shared_ptr reader) { +static inline uint32_t read_CMD_BBBB(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); return v; } -static inline uint32_t read_CMD_BBH(std::shared_ptr reader) { +static inline uint32_t read_CMD_BBH(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); @@ -46,7 +24,7 @@ static inline uint32_t read_CMD_BBH(std::shared_ptr reader) { return v; } -static inline uint32_t read_CMD_HBB(std::shared_ptr reader) { +static inline uint32_t read_CMD_HBB(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); @@ -61,7 +39,7 @@ static inline uint32_t read_CMD_HBB(std::shared_ptr reader) { return v; } -static inline uint32_t read_CMD_HH(std::shared_ptr reader) { +static inline uint32_t read_CMD_HH(std::shared_ptr reader) { uint32_t v; reader->Read((char*)&v, sizeof(uint32_t)); @@ -79,11 +57,14 @@ static inline uint32_t read_CMD_HH(std::shared_ptr reader) { return v; } -void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr cutscene = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, cutscene); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryCutsceneV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto cutscene = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); uint32_t numEntries = reader->ReadUInt32(); cutscene->commands.reserve(numEntries); @@ -459,7 +440,7 @@ void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr reade case 0xFFFFFFFF: // CS_END { cutscene->commands.push_back(reader->ReadUInt32()); - return; + return cutscene; } default: SPDLOG_TRACE("CutsceneV0: Unknown command {}\n", commandId); @@ -467,5 +448,7 @@ void LUS::CutsceneFactoryV0::ParseFileBinary(std::shared_ptr reade break; } } + + return cutscene; } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/CutsceneFactory.h b/soh/soh/resource/importer/CutsceneFactory.h index a5813f6fe..8194615af 100644 --- a/soh/soh/resource/importer/CutsceneFactory.h +++ b/soh/soh/resource/importer/CutsceneFactory.h @@ -1,19 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class CutsceneFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinaryCutsceneV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class CutsceneFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/PathFactory.cpp b/soh/soh/resource/importer/PathFactory.cpp index bb4f87eb6..07fc86f40 100644 --- a/soh/soh/resource/importer/PathFactory.cpp +++ b/soh/soh/resource/importer/PathFactory.cpp @@ -2,32 +2,14 @@ #include "soh/resource/type/Path.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -PathFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; +namespace SOH { +std::shared_ptr ResourceFactoryBinaryPathV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; } - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Path with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::PathFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr path = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, path); + auto path = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); path->numPaths = reader->ReadUInt32(); path->paths.reserve(path->numPaths); @@ -52,5 +34,7 @@ void LUS::PathFactoryV0::ParseFileBinary(std::shared_ptr reader, path->pathData.push_back(pathDataEntry); } + + return path; } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/PathFactory.h b/soh/soh/resource/importer/PathFactory.h index 3a8c0d595..aa8ae747c 100644 --- a/soh/soh/resource/importer/PathFactory.h +++ b/soh/soh/resource/importer/PathFactory.h @@ -1,19 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class PathFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinaryPathV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class PathFactoryV0 : public ResourceVersionFactory -{ - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/PlayerAnimationFactory.cpp b/soh/soh/resource/importer/PlayerAnimationFactory.cpp index ae9457669..4c25d5e80 100644 --- a/soh/soh/resource/importer/PlayerAnimationFactory.cpp +++ b/soh/soh/resource/importer/PlayerAnimationFactory.cpp @@ -2,34 +2,14 @@ #include "soh/resource/type/PlayerAnimation.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -PlayerAnimationFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; +namespace SOH { +std::shared_ptr ResourceFactoryBinaryPlayerAnimationV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; } - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load PlayerAnimation with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr playerAnimation = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, playerAnimation); + auto playerAnimation = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); uint32_t numEntries = reader->ReadUInt32(); playerAnimation->limbRotData.reserve(numEntries); @@ -37,5 +17,7 @@ void LUS::PlayerAnimationFactoryV0::ParseFileBinary(std::shared_ptrlimbRotData.push_back(reader->ReadInt16()); } -} -} // namespace LUS + + return playerAnimation; +}; +} // namespace SOH diff --git a/soh/soh/resource/importer/PlayerAnimationFactory.h b/soh/soh/resource/importer/PlayerAnimationFactory.h index b4981f7c6..8b459a38b 100644 --- a/soh/soh/resource/importer/PlayerAnimationFactory.h +++ b/soh/soh/resource/importer/PlayerAnimationFactory.h @@ -1,17 +1,11 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class PlayerAnimationFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinaryPlayerAnimationV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; - -class PlayerAnimationFactoryV0 : public ResourceVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/SceneFactory.cpp b/soh/soh/resource/importer/SceneFactory.cpp index b71f78a2c..679d574cb 100644 --- a/soh/soh/resource/importer/SceneFactory.cpp +++ b/soh/soh/resource/importer/SceneFactory.cpp @@ -1,4 +1,5 @@ #include "spdlog/spdlog.h" +#include "soh/resource/type/SohResourceType.h" #include "soh/resource/importer/SceneFactory.h" #include "soh/resource/type/Scene.h" #include "soh/resource/type/scenecommand/SceneCommand.h" @@ -28,67 +29,36 @@ #include "soh/resource/importer/scenecommand/SetLightListFactory.h" #include "soh/resource/importer/scenecommand/SetMeshFactory.h" -namespace LUS { - -std::shared_ptr -SceneFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - if (SceneFactory::sceneCommandFactories.empty()) { - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetLightingSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetWind] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetExitList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetTimeSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSkyboxModifier] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetEchoSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSoundSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSkyboxSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetRoomBehavior] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCsCamera] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCameraSettings] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetRoomList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCollisionHeader] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetEntranceList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetSpecialObjects] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetObjectList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetStartPositionList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetActorList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetTransitionActorList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::EndMarker] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetAlternateHeaders] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetPathways] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetCutscenes] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetLightList] = std::make_shared(); - SceneFactory::sceneCommandFactories[LUS::SceneCommandID::SetMesh] = std::make_shared(); - } - - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Scene with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; +namespace SOH { +ResourceFactoryBinarySceneV0::ResourceFactoryBinarySceneV0() { + sceneCommandFactories[SceneCommandID::SetLightingSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetWind] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetExitList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetTimeSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSkyboxModifier] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetEchoSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSoundSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSkyboxSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetRoomBehavior] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCsCamera] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCameraSettings] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetRoomList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCollisionHeader] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetEntranceList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetSpecialObjects] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetObjectList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetStartPositionList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetActorList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetTransitionActorList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::EndMarker] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetAlternateHeaders] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetPathways] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetCutscenes] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetLightList] = std::make_shared(); + sceneCommandFactories[SceneCommandID::SetMesh] = std::make_shared(); } -void SceneFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr scene = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, scene); - - ParseSceneCommands(scene, reader); -} - -void SceneFactoryV0::ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader) { +void ResourceFactoryBinarySceneV0::ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader) { uint32_t commandCount = reader->ReadUInt32(); scene->commands.reserve(commandCount); @@ -97,19 +67,19 @@ void SceneFactoryV0::ParseSceneCommands(std::shared_ptr scene, std::share } } -std::shared_ptr SceneFactoryV0::ParseSceneCommand(std::shared_ptr scene, - std::shared_ptr reader, uint32_t index) { +std::shared_ptr ResourceFactoryBinarySceneV0::ParseSceneCommand(std::shared_ptr scene, + std::shared_ptr reader, uint32_t index) { SceneCommandID cmdID = (SceneCommandID)reader->ReadInt32(); - reader->Seek(-sizeof(int32_t), SeekOffsetType::Current); + reader->Seek(-sizeof(int32_t), LUS::SeekOffsetType::Current); std::shared_ptr result = nullptr; - std::shared_ptr commandFactory = SceneFactory::sceneCommandFactories[cmdID]; + auto commandFactory = ResourceFactoryBinarySceneV0::sceneCommandFactories[cmdID]; if (commandFactory != nullptr) { - auto initData = std::make_shared(); + auto initData = std::make_shared(); initData->Id = scene->GetInitData()->Id; - initData->Type = static_cast(ResourceType::SOH_SceneCommand); + initData->Type = static_cast(SOH::ResourceType::SOH_SceneCommand); initData->Path = scene->GetInitData()->Path + "/SceneCommand" + std::to_string(index); initData->ResourceVersion = scene->GetInitData()->ResourceVersion; result = std::static_pointer_cast(commandFactory->ReadResource(initData, reader)); @@ -123,4 +93,16 @@ std::shared_ptr SceneFactoryV0::ParseSceneCommand(std::shared_ptr return result; } -} // namespace LUS +std::shared_ptr ResourceFactoryBinarySceneV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto scene = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); + + ParseSceneCommands(scene, reader); + + return scene; +}; +} // namespace SOH diff --git a/soh/soh/resource/importer/SceneFactory.h b/soh/soh/resource/importer/SceneFactory.h index 59fe08ddf..5dfed2739 100644 --- a/soh/soh/resource/importer/SceneFactory.h +++ b/soh/soh/resource/importer/SceneFactory.h @@ -4,26 +4,22 @@ #include "soh/resource/type/scenecommand/SceneCommand.h" #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" -namespace LUS { -class SceneFactory : public ResourceFactory { +namespace SOH { +class ResourceFactoryBinarySceneV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + ResourceFactoryBinarySceneV0(); + + std::shared_ptr ReadResource(std::shared_ptr file) override; + void ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader); // Doing something very similar to what we do on the ResourceLoader. // Eventually, scene commands should be moved up to the ResourceLoader as well. // They can not right now because the exporter does not give them a proper resource type enum value, // and the exporter does not export the commands with a proper OTR header. - static inline std::unordered_map> sceneCommandFactories; -}; - -class SceneFactoryV0 : public ResourceVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseSceneCommands(std::shared_ptr scene, std::shared_ptr reader); + static inline std::unordered_map> sceneCommandFactories; protected: - std::shared_ptr ParseSceneCommand(std::shared_ptr scene, std::shared_ptr reader, uint32_t index); + std::shared_ptr ParseSceneCommand(std::shared_ptr scene, std::shared_ptr reader, uint32_t index); }; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/SkeletonFactory.cpp b/soh/soh/resource/importer/SkeletonFactory.cpp index 2ce651dee..fedfda400 100644 --- a/soh/soh/resource/importer/SkeletonFactory.cpp +++ b/soh/soh/resource/importer/SkeletonFactory.cpp @@ -3,54 +3,14 @@ #include #include -namespace LUS { -std::shared_ptr -SkeletonFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -std::shared_ptr -SkeletonFactory::ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinarySkeletonV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileXML(reader, resource); - - return resource; -} - -void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr skeleton = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, skeleton); + auto skeleton = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); skeleton->type = (SkeletonType)reader->ReadInt8(); skeleton->limbType = (LimbType)reader->ReadInt8(); @@ -66,17 +26,17 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr reader, skeleton->limbTable.push_back(limbPath); } - if (skeleton->type == LUS::SkeletonType::Curve) { + if (skeleton->type == SkeletonType::Curve) { skeleton->skeletonData.skelCurveLimbList.limbCount = skeleton->limbCount; skeleton->curveLimbArray.reserve(skeleton->skeletonData.skelCurveLimbList.limbCount); - } else if (skeleton->type == LUS::SkeletonType::Flex) { + } else if (skeleton->type == SkeletonType::Flex) { skeleton->skeletonData.flexSkeletonHeader.dListCount = skeleton->dListCount; } - if (skeleton->type == LUS::SkeletonType::Normal) { + if (skeleton->type == SkeletonType::Normal) { skeleton->skeletonData.skeletonHeader.limbCount = skeleton->limbCount; skeleton->standardLimbArray.reserve(skeleton->skeletonData.skeletonHeader.limbCount); - } else if (skeleton->type == LUS::SkeletonType::Flex) { + } else if (skeleton->type == SkeletonType::Flex) { skeleton->skeletonData.flexSkeletonHeader.sh.limbCount = skeleton->limbCount; skeleton->standardLimbArray.reserve(skeleton->skeletonData.flexSkeletonHeader.sh.limbCount); } @@ -87,21 +47,29 @@ void SkeletonFactoryV0::ParseFileBinary(std::shared_ptr reader, skeleton->skeletonHeaderSegments.push_back(limb ? limb->GetRawPointer() : nullptr); } - if (skeleton->type == LUS::SkeletonType::Normal) { + if (skeleton->type == SkeletonType::Normal) { skeleton->skeletonData.skeletonHeader.segment = (void**)skeleton->skeletonHeaderSegments.data(); - } else if (skeleton->type == LUS::SkeletonType::Flex) { + } else if (skeleton->type == SkeletonType::Flex) { skeleton->skeletonData.flexSkeletonHeader.sh.segment = (void**)skeleton->skeletonHeaderSegments.data(); - } else if (skeleton->type == LUS::SkeletonType::Curve) { + } else if (skeleton->type == SkeletonType::Curve) { skeleton->skeletonData.skelCurveLimbList.limbs = (SkelCurveLimb**)skeleton->skeletonHeaderSegments.data(); } else { SPDLOG_ERROR("unknown skeleton type {}", (uint32_t)skeleton->type); } skeleton->skeletonData.skeletonHeader.skeletonType = (uint8_t)skeleton->type; + + return skeleton; } -void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) -{ - std::shared_ptr skel = std::static_pointer_cast(resource); + +std::shared_ptr ResourceFactoryXMLSkeletonV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto skel = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader)->FirstChildElement(); + auto child = reader->FirstChildElement(); skel->type = SkeletonType::Flex; // Default to Flex for legacy reasons if (reader->FindAttribute("Type")) { @@ -137,8 +105,6 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p skel->limbCount = reader->IntAttribute("LimbCount"); skel->dListCount = reader->IntAttribute("DisplayListCount"); - auto child = reader->FirstChildElement(); - while (child != nullptr) { std::string childName = child->Name(); @@ -157,6 +123,7 @@ void SkeletonFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_p skel->skeletonData.flexSkeletonHeader.sh.segment = (void**)skel->skeletonHeaderSegments.data(); skel->skeletonData.flexSkeletonHeader.dListCount = skel->dListCount; skel->skeletonData.skeletonHeader.skeletonType = (uint8_t)skel->type; -} -} // namespace LUS + return skel; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/SkeletonFactory.h b/soh/soh/resource/importer/SkeletonFactory.h index d64449393..5de02175f 100644 --- a/soh/soh/resource/importer/SkeletonFactory.h +++ b/soh/soh/resource/importer/SkeletonFactory.h @@ -1,23 +1,17 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" +#include "ResourceFactoryXML.h" -namespace LUS { -class SkeletonFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinarySkeletonV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; - std::shared_ptr - ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class SkeletonFactoryV0 : public ResourceVersionFactory -{ +class ResourceFactoryXMLSkeletonV0 : public LUS::ResourceFactoryXML { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -}; // namespace LUS - +} // namespace SOH diff --git a/soh/soh/resource/importer/SkeletonLimbFactory.cpp b/soh/soh/resource/importer/SkeletonLimbFactory.cpp index 7ca8ae1cc..15ba92281 100644 --- a/soh/soh/resource/importer/SkeletonLimbFactory.cpp +++ b/soh/soh/resource/importer/SkeletonLimbFactory.cpp @@ -3,54 +3,14 @@ #include "spdlog/spdlog.h" #include "libultraship/libultraship.h" -namespace LUS { -std::shared_ptr -SkeletonLimbFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -std::shared_ptr -SkeletonLimbFactory::ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Skeleton Limb with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinarySkeletonLimbV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileXML(reader, resource); - - return resource; -} - -void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr skeletonLimb = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, skeletonLimb); + auto skeletonLimb = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); skeletonLimb->limbType = (LimbType)reader->ReadInt8(); skeletonLimb->skinSegmentType = (ZLimbSkinType)reader->ReadInt8(); @@ -124,7 +84,7 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r skeletonLimb->childIndex = reader->ReadUByte(); skeletonLimb->siblingIndex = reader->ReadUByte(); - if (skeletonLimb->limbType == LUS::LimbType::LOD) { + if (skeletonLimb->limbType == LimbType::LOD) { skeletonLimb->limbData.lodLimb.jointPos.x = skeletonLimb->transX; skeletonLimb->limbData.lodLimb.jointPos.y = skeletonLimb->transY; skeletonLimb->limbData.lodLimb.jointPos.z = skeletonLimb->transZ; @@ -144,7 +104,7 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r } else { skeletonLimb->limbData.lodLimb.dLists[1] = nullptr; } - } else if (skeletonLimb->limbType == LUS::LimbType::Standard) { + } else if (skeletonLimb->limbType == LimbType::Standard) { skeletonLimb->limbData.standardLimb.jointPos.x = skeletonLimb->transX; skeletonLimb->limbData.standardLimb.jointPos.y = skeletonLimb->transY; skeletonLimb->limbData.standardLimb.jointPos.z = skeletonLimb->transZ; @@ -156,7 +116,7 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r skeletonLimb->dListPtr = "__OTR__" + skeletonLimb->dListPtr; skeletonLimb->limbData.standardLimb.dList = (Gfx*)skeletonLimb->dListPtr.c_str(); } - } else if (skeletonLimb->limbType == LUS::LimbType::Curve) { + } else if (skeletonLimb->limbType == LimbType::Curve) { skeletonLimb->limbData.skelCurveLimb.firstChildIdx = skeletonLimb->childIndex; skeletonLimb->limbData.skelCurveLimb.nextLimbIdx = skeletonLimb->siblingIndex; skeletonLimb->limbData.skelCurveLimb.dList[0] = nullptr; @@ -171,31 +131,31 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r skeletonLimb->dList2Ptr = "__OTR__" + skeletonLimb->dList2Ptr; skeletonLimb->limbData.skelCurveLimb.dList[1] = (Gfx*)skeletonLimb->dList2Ptr.c_str(); } - } else if (skeletonLimb->limbType == LUS::LimbType::Skin) { + } else if (skeletonLimb->limbType == LimbType::Skin) { skeletonLimb->limbData.skinLimb.jointPos.x = skeletonLimb->transX; skeletonLimb->limbData.skinLimb.jointPos.y = skeletonLimb->transY; skeletonLimb->limbData.skinLimb.jointPos.z = skeletonLimb->transZ; skeletonLimb->limbData.skinLimb.child = skeletonLimb->childIndex; skeletonLimb->limbData.skinLimb.sibling = skeletonLimb->siblingIndex; - if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) { + if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_DList) { skeletonLimb->limbData.skinLimb.segmentType = static_cast(skeletonLimb->skinSegmentType); - } else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) { + } else if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_4) { skeletonLimb->limbData.skinLimb.segmentType = 4; - } else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_5) { + } else if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_5) { skeletonLimb->limbData.skinLimb.segmentType = 5; } else { skeletonLimb->limbData.skinLimb.segmentType = 0; } - if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_DList) { + if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_DList) { if (skeletonLimb->skinDList != "") { skeletonLimb->skinDList = "__OTR__" + skeletonLimb->skinDList; skeletonLimb->limbData.skinLimb.segment = (Gfx*)skeletonLimb->skinDList.c_str(); } else { skeletonLimb->limbData.skinLimb.segment = nullptr; } - } else if (skeletonLimb->skinSegmentType == LUS::ZLimbSkinType::SkinType_4) { + } else if (skeletonLimb->skinSegmentType == ZLimbSkinType::SkinType_4) { skeletonLimb->skinAnimLimbData.totalVtxCount = skeletonLimb->skinVtxCnt; skeletonLimb->skinAnimLimbData.limbModifCount = skeletonLimb->skinLimbModifCount; skeletonLimb->skinAnimLimbData.limbModifications = skeletonLimb->skinLimbModifArray.data(); @@ -220,10 +180,17 @@ void LUS::SkeletonLimbFactoryV0::ParseFileBinary(std::shared_ptr r skeletonLimb->limbData.skinLimb.segment = &skeletonLimb->skinAnimLimbData; } } + + return skeletonLimb; } -void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) -{ - std::shared_ptr skelLimb = std::static_pointer_cast(resource); + +std::shared_ptr ResourceFactoryXMLSkeletonLimbV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto skelLimb = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader)->FirstChildElement(); std::string limbType = reader->Attribute("Type"); @@ -275,6 +242,7 @@ void SkeletonLimbFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shar limbData.lodLimb.sibling = skelLimb->siblingIndex; // skelLimb->dList2Ptr = reader->Attribute("DisplayList2"); -} -} // namespace LUS + return skelLimb; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/SkeletonLimbFactory.h b/soh/soh/resource/importer/SkeletonLimbFactory.h index 8480a0126..125dde2b8 100644 --- a/soh/soh/resource/importer/SkeletonLimbFactory.h +++ b/soh/soh/resource/importer/SkeletonLimbFactory.h @@ -1,23 +1,17 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" +#include "ResourceFactoryXML.h" -namespace LUS { -class SkeletonLimbFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinarySkeletonLimbV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; - std::shared_ptr - ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class SkeletonLimbFactoryV0 : public ResourceVersionFactory -{ +class ResourceFactoryXMLSkeletonLimbV0 : public LUS::ResourceFactoryXML { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -}; // namespace LUS - +} // namespace SOH diff --git a/soh/soh/resource/importer/TextFactory.cpp b/soh/soh/resource/importer/TextFactory.cpp index 314dd135c..89d229f80 100644 --- a/soh/soh/resource/importer/TextFactory.cpp +++ b/soh/soh/resource/importer/TextFactory.cpp @@ -2,74 +2,38 @@ #include "soh/resource/type/Text.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -TextFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - default: - // VERSION NOT SUPPORTED - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -std::shared_ptr -TextFactory::ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load Text with version {}", resource->GetInitData()->ResourceVersion); +namespace SOH { +std::shared_ptr ResourceFactoryBinaryTextV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { return nullptr; } - factory->ParseFileXML(reader, resource); - - return resource; -} - -void LUS::TextFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr text = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, text); + auto text = std::make_shared(file->InitData); + auto reader = std::get>(file->Reader); uint32_t msgCount = reader->ReadUInt32(); text->messages.reserve(msgCount); for (uint32_t i = 0; i < msgCount; i++) { - MessageEntry entry; - entry.id = reader->ReadUInt16(); - entry.textboxType = reader->ReadUByte(); - entry.textboxYPos = reader->ReadUByte(); - entry.msg = reader->ReadString(); + MessageEntry entry; + entry.id = reader->ReadUInt16(); + entry.textboxType = reader->ReadUByte(); + entry.textboxYPos = reader->ReadUByte(); + entry.msg = reader->ReadString(); - text->messages.push_back(entry); + text->messages.push_back(entry); } -} -void TextFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) { - std::shared_ptr txt = std::static_pointer_cast(resource); - auto child = reader->FirstChildElement(); + return text; +} + +std::shared_ptr ResourceFactoryXMLTextV0::ReadResource(std::shared_ptr file) { + if (!FileHasValidFormatAndReader(file)) { + return nullptr; + } + + auto txt = std::make_shared(file->InitData); + auto child = std::get>(file->Reader)->FirstChildElement()->FirstChildElement(); while (child != nullptr) { std::string childName = child->Name(); @@ -88,6 +52,7 @@ void TextFactoryV0::ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptrNextSiblingElement(); } -} -} // namespace LUS + return txt; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/TextFactory.h b/soh/soh/resource/importer/TextFactory.h index 7a6ae2841..cb466204b 100644 --- a/soh/soh/resource/importer/TextFactory.h +++ b/soh/soh/resource/importer/TextFactory.h @@ -1,23 +1,17 @@ #pragma once #include "Resource.h" -#include "ResourceFactory.h" +#include "ResourceFactoryBinary.h" +#include "ResourceFactoryXML.h" -namespace LUS { -class TextFactory : public ResourceFactory -{ +namespace SOH { +class ResourceFactoryBinaryTextV0 : public LUS::ResourceFactoryBinary { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; - std::shared_ptr - ReadResourceXML(std::shared_ptr initData, tinyxml2::XMLElement *reader) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -class TextFactoryV0 : public ResourceVersionFactory -{ +class ResourceFactoryXMLTextV0 : public LUS::ResourceFactoryXML { public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; - void ParseFileXML(tinyxml2::XMLElement* reader, std::shared_ptr resource) override; + std::shared_ptr ReadResource(std::shared_ptr file) override; }; -}; // namespace LUS - +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp index 4134e259a..ffcf17410 100644 --- a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.cpp @@ -2,37 +2,13 @@ #include "soh/resource/type/scenecommand/EndMarker.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -EndMarkerFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load EndMarker with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::EndMarkerFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr endMarker = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, endMarker); +namespace SOH { +std::shared_ptr +EndMarkerFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto endMarker = std::make_shared(initData); ReadCommandId(endMarker, reader); - - // This has no data. -} -} // namespace LUS + return endMarker; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h index 8cd83b4f6..486aaa2fb 100644 --- a/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h +++ b/soh/soh/resource/importer/scenecommand/EndMarkerFactory.h @@ -2,15 +2,9 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class EndMarkerFactory : public SceneCommandFactory { +namespace SOH { +class EndMarkerFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class EndMarkerFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp index 9ad0ba2d3..9ab5d1611 100644 --- a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.cpp @@ -2,9 +2,8 @@ #include "soh/resource/type/scenecommand/SceneCommand.h" #include "spdlog/spdlog.h" -namespace LUS { -void SceneCommandVersionFactory::ReadCommandId(std::shared_ptr command, std::shared_ptr reader) { +namespace SOH { +void SceneCommandFactoryBinaryV0::ReadCommandId(std::shared_ptr command, std::shared_ptr reader) { command->cmdId = (SceneCommandID)reader->ReadInt32(); } -} - \ No newline at end of file +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h index d9a23818a..4cebc4a64 100644 --- a/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h +++ b/soh/soh/resource/importer/scenecommand/SceneCommandFactory.h @@ -5,11 +5,12 @@ #include "ResourceFactory.h" #include "soh/resource/type/scenecommand/SceneCommand.h" -namespace LUS { -class SceneCommandFactory : public ResourceFactory {}; +namespace SOH { +class SceneCommandFactoryBinaryV0 { + public: + virtual std::shared_ptr ReadResource(std::shared_ptr initData, std::shared_ptr reader) = 0; -class SceneCommandVersionFactory : public ResourceVersionFactory { -protected: - void ReadCommandId(std::shared_ptr command, std::shared_ptr reader); + protected: + void ReadCommandId(std::shared_ptr command, std::shared_ptr reader); }; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp index 0451eb4c3..86deea193 100644 --- a/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetActorListFactory.cpp @@ -2,52 +2,30 @@ #include "soh/resource/type/scenecommand/SetActorList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetActorListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetActorList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetActorListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setActorList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setActorList); +namespace SOH { +std::shared_ptr +SetActorListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setActorList = std::make_shared(initData); ReadCommandId(setActorList, reader); setActorList->numActors = reader->ReadUInt32(); setActorList->actorList.reserve(setActorList->numActors); for (uint32_t i = 0; i < setActorList->numActors; i++) { - ActorEntry entry; + ActorEntry entry; - entry.id = reader->ReadUInt16(); - entry.pos.x = reader->ReadInt16(); - entry.pos.y = reader->ReadInt16(); - entry.pos.z = reader->ReadInt16(); - entry.rot.x = reader->ReadInt16(); - entry.rot.y = reader->ReadInt16(); - entry.rot.z = reader->ReadInt16(); - entry.params = reader->ReadUInt16(); + entry.id = reader->ReadUInt16(); + entry.pos.x = reader->ReadInt16(); + entry.pos.y = reader->ReadInt16(); + entry.pos.z = reader->ReadInt16(); + entry.rot.x = reader->ReadInt16(); + entry.rot.y = reader->ReadInt16(); + entry.rot.z = reader->ReadInt16(); + entry.params = reader->ReadUInt16(); setActorList->actorList.push_back(entry); } -} -} // namespace LUS + return setActorList; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetActorListFactory.h b/soh/soh/resource/importer/scenecommand/SetActorListFactory.h index 1f4c213bb..49a269cfe 100644 --- a/soh/soh/resource/importer/scenecommand/SetActorListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetActorListFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetActorListFactory : public SceneCommandFactory { +namespace SOH { +class SetActorListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetActorListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp index 5258d970b..833d0af8c 100644 --- a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.cpp @@ -3,47 +3,24 @@ #include "spdlog/spdlog.h" #include "libultraship/libultraship.h" -namespace LUS { -std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetAlternateHeaders with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetAlternateHeadersFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setAlternateHeaders = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setAlternateHeaders); +namespace SOH { +std::shared_ptr SetAlternateHeadersFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setAlternateHeaders = std::make_shared(initData); ReadCommandId(setAlternateHeaders, reader); setAlternateHeaders->numHeaders = reader->ReadUInt32(); setAlternateHeaders->headers.reserve(setAlternateHeaders->numHeaders); for (uint32_t i = 0; i < setAlternateHeaders->numHeaders; i++) { - auto headerName = reader->ReadString(); - if (!headerName.empty()) { - setAlternateHeaders->headers.push_back(std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str()))); - } else { - setAlternateHeaders->headers.push_back(nullptr); - } + auto headerName = reader->ReadString(); + if (!headerName.empty()) { + setAlternateHeaders->headers.push_back(std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(headerName.c_str()))); + } else { + setAlternateHeaders->headers.push_back(nullptr); + } } -} -} // namespace LUS + return setAlternateHeaders; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h index a534c4392..2bc430c0b 100644 --- a/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetAlternateHeadersFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetAlternateHeadersFactory : public SceneCommandFactory { +namespace SOH { +class SetAlternateHeadersFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetAlternateHeadersFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp index 14b332d2a..7e2911a17 100644 --- a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.cpp @@ -2,38 +2,16 @@ #include "soh/resource/type/scenecommand/SetCameraSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetCameraSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetCameraSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetCameraSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setCameraSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setCameraSettings); +namespace SOH { +std::shared_ptr SetCameraSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setCameraSettings = std::make_shared(initData); ReadCommandId(setCameraSettings, reader); setCameraSettings->settings.cameraMovement = reader->ReadInt8(); setCameraSettings->settings.worldMapArea = reader->ReadInt32(); -} -} // namespace LUS + return setCameraSettings; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h index ec4dc9e42..2f1db272f 100644 --- a/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCameraSettingsFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetCameraSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetCameraSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetCameraSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp index e1c113ba3..bb83dc57b 100644 --- a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.cpp @@ -3,37 +3,16 @@ #include "libultraship/libultraship.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetCollisionHeaderFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetCollisionHeader with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetCollisionHeaderFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setCollisionHeader = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setCollisionHeader); +namespace SOH { +std::shared_ptr SetCollisionHeaderFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setCollisionHeader = std::make_shared(initData); ReadCommandId(setCollisionHeader, reader); setCollisionHeader->fileName = reader->ReadString(); setCollisionHeader->collisionHeader = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCollisionHeader->fileName.c_str())); -} -} // namespace LUS + return setCollisionHeader; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h index 96c6ff0a1..b80ee34b4 100644 --- a/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCollisionHeaderFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetCollisionHeaderFactory : public SceneCommandFactory { +namespace SOH { +class SetCollisionHeaderFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetCollisionHeaderFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp index d24e3b2c3..84c277989 100644 --- a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.cpp @@ -2,32 +2,10 @@ #include "soh/resource/type/scenecommand/SetCsCamera.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetCsCameraFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetCsCamera with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setCsCamera = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setCsCamera); +namespace SOH { +std::shared_ptr +SetCsCameraFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setCsCamera = std::make_shared(initData); ReadCommandId(setCsCamera, reader); @@ -35,6 +13,7 @@ void LUS::SetCsCameraFactoryV0::ParseFileBinary(std::shared_ptr re reader->ReadInt32(); // segOffset // OTRTODO: FINISH! -} -} // namespace LUS + return setCsCamera; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h index ec74ed58e..08dc8e3c3 100644 --- a/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCsCameraFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetCsCameraFactory : public SceneCommandFactory { +namespace SOH { +class SetCsCameraFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetCsCameraFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp index db9392e7d..30f72d168 100644 --- a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.cpp @@ -3,38 +3,16 @@ #include #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetCutscenesFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetCutscenes with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetCutscenesFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setCutscenes = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setCutscenes); +namespace SOH { +std::shared_ptr +SetCutscenesFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setCutscenes = std::make_shared(initData); ReadCommandId(setCutscenes, reader); setCutscenes->fileName = reader->ReadString(); setCutscenes->cutscene = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(setCutscenes->fileName.c_str())); -} -} // namespace LUS + return setCutscenes; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h index 7963036ba..bbbe38c98 100644 --- a/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetCutscenesFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetCutscenesFactory : public SceneCommandFactory { +namespace SOH { +class SetCutscenesFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetCutscenesFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp index 530bcb8af..e9c3381cb 100644 --- a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.cpp @@ -2,37 +2,15 @@ #include "soh/resource/type/scenecommand/SetEchoSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetEchoSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetEchoSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetEchoSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setEchoSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setEchoSettings); +namespace SOH { +std::shared_ptr +SetEchoSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setEchoSettings = std::make_shared(initData); ReadCommandId(setEchoSettings, reader); setEchoSettings->settings.echo = reader->ReadInt8(); -} -} // namespace LUS + return setEchoSettings; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h index 90bf3222f..99bda6eae 100644 --- a/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetEchoSettingsFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetEchoSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetEchoSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetEchoSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp index 0fd841278..766bb82da 100644 --- a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.cpp @@ -2,32 +2,10 @@ #include "soh/resource/type/scenecommand/SetEntranceList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetEntranceListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetEntranceListList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setEntranceList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setEntranceList); +namespace SOH { +std::shared_ptr +SetEntranceListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setEntranceList = std::make_shared(initData); ReadCommandId(setEntranceList, reader); @@ -41,6 +19,7 @@ void LUS::SetEntranceListFactoryV0::ParseFileBinary(std::shared_ptrentrances.push_back(entranceEntry); } -} -} // namespace LUS + return setEntranceList; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h index ce20db4f7..35b7fba62 100644 --- a/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetEntranceListFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetEntranceListFactory : public SceneCommandFactory { +namespace SOH { +class SetEntranceListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetEntranceListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp index 04ed0c56b..5fef9d096 100644 --- a/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetExitListFactory.cpp @@ -2,32 +2,10 @@ #include "soh/resource/type/scenecommand/SetExitList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetExitListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared( initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetExitList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setExitList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setExitList); +namespace SOH { +std::shared_ptr +SetExitListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setExitList = std::make_shared( initData); ReadCommandId(setExitList, reader); @@ -36,6 +14,7 @@ void LUS::SetExitListFactoryV0::ParseFileBinary(std::shared_ptr re for (uint32_t i = 0; i < setExitList->numExits; i++) { setExitList->exits.push_back(reader->ReadUInt16()); } -} -} // namespace LUS + return setExitList; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetExitListFactory.h b/soh/soh/resource/importer/scenecommand/SetExitListFactory.h index 351ebe7ca..d82e8f04a 100644 --- a/soh/soh/resource/importer/scenecommand/SetExitListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetExitListFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetExitListFactory : public SceneCommandFactory { +namespace SOH { +class SetExitListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetExitListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp index 2d2a9afe4..2d05631cd 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetLightListFactory.cpp @@ -2,34 +2,10 @@ #include "soh/resource/type/scenecommand/SetLightList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetLightListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetLightList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setLightList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setLightList); +namespace SOH { +std::shared_ptr +SetLightListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setLightList = std::make_shared(initData); ReadCommandId(setLightList, reader); @@ -40,7 +16,7 @@ void LUS::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr r light.type = reader->ReadUByte(); - light.params.point.x = reader->ReadInt16(); + light.params.point.x = reader->ReadInt16(); light.params.point.y = reader->ReadInt16(); light.params.point.z = reader->ReadInt16(); @@ -49,10 +25,11 @@ void LUS::SetLightListFactoryV0::ParseFileBinary(std::shared_ptr r light.params.point.color[2] = reader->ReadUByte(); // b light.params.point.drawGlow = reader->ReadUByte(); - light.params.point.radius = reader->ReadInt16(); + light.params.point.radius = reader->ReadInt16(); setLightList->lightList.push_back(light); } -} -} // namespace LUS + return setLightList; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetLightListFactory.h b/soh/soh/resource/importer/scenecommand/SetLightListFactory.h index 24292a289..1c4a6e9dc 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetLightListFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetLightListFactory : public SceneCommandFactory { +namespace SOH { +class SetLightListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetLightListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp index 3fdedd0e4..d0a7b89d5 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.cpp @@ -2,33 +2,10 @@ #include "soh/resource/type/scenecommand/SetLightingSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetLightingSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetLightingSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setLightingSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setLightingSettings); +namespace SOH { +std::shared_ptr SetLightingSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setLightingSettings = std::make_shared(initData); ReadCommandId(setLightingSettings, reader); @@ -65,6 +42,7 @@ void LUS::SetLightingSettingsFactoryV0::ParseFileBinary(std::shared_ptrReadUInt16(); setLightingSettings->settings.push_back(lightSettings); } -} -} // namespace LUS + return setLightingSettings; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h index 78a624ca6..df25600e2 100644 --- a/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetLightingSettingsFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetLightingSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetLightingSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetLightingSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp index 1398641a7..8c17ecc07 100644 --- a/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetMeshFactory.cpp @@ -3,34 +3,10 @@ #include "spdlog/spdlog.h" #include "libultraship/libultraship.h" -namespace LUS { -std::shared_ptr -SetMeshFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetMesh with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setMesh = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setMesh); +namespace SOH { +std::shared_ptr +SetMeshFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setMesh = std::make_shared(initData); ReadCommandId(setMesh, reader); @@ -143,10 +119,10 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader std::string meshOpa = reader->ReadString(); std::string meshXlu = reader->ReadString(); - auto opaRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()); - auto xluRes = LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()); - dlist.opa = meshOpa != "" ? (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr) : 0; - dlist.xlu = meshXlu != "" ? (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr) : 0; + auto opaRes = meshOpa != "" ? LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshOpa.c_str()) : nullptr; + auto xluRes = meshXlu != "" ? LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(meshXlu.c_str()) : nullptr; + dlist.opa = (Gfx*)(opaRes ? opaRes->GetRawPointer() : nullptr); + dlist.xlu = (Gfx*)(xluRes ? xluRes->GetRawPointer() : nullptr); setMesh->dlists2.push_back(dlist); } else { @@ -164,6 +140,7 @@ void LUS::SetMeshFactoryV0::ParseFileBinary(std::shared_ptr reader } else { SPDLOG_ERROR("Tried to load mesh in SetMesh scene header with type that doesn't exist: {}", setMesh->meshHeader.base.type); } -} -} // namespace LUS + return setMesh; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetMeshFactory.h b/soh/soh/resource/importer/scenecommand/SetMeshFactory.h index 8ca086d43..a912bdd37 100644 --- a/soh/soh/resource/importer/scenecommand/SetMeshFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetMeshFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetMeshFactory : public SceneCommandFactory { +namespace SOH { +class SetMeshFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetMeshFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp index 27082f6e7..b84befb3b 100644 --- a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.cpp @@ -2,33 +2,10 @@ #include "soh/resource/type/scenecommand/SetObjectList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetObjectListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetObjectList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setObjectList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setObjectList); +namespace SOH { +std::shared_ptr +SetObjectListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setObjectList = std::make_shared(initData); ReadCommandId(setObjectList, reader); @@ -37,6 +14,7 @@ void LUS::SetObjectListFactoryV0::ParseFileBinary(std::shared_ptr for (uint32_t i = 0; i < setObjectList->numObjects; i++) { setObjectList->objects.push_back(reader->ReadUInt16()); } -} -} // namespace LUS + return setObjectList; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h index 65725bfb2..4c2f002c0 100644 --- a/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetObjectListFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetObjectListFactory : public SceneCommandFactory { +namespace SOH { +class SetObjectListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetObjectListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp index 1f40ab69d..61534ba48 100644 --- a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.cpp @@ -3,32 +3,10 @@ #include "spdlog/spdlog.h" #include -namespace LUS { -std::shared_ptr -SetPathwaysFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetPathways with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setPathways = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setPathways); +namespace SOH { +std::shared_ptr +SetPathwaysFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setPathways = std::make_shared(initData); ReadCommandId(setPathways, reader); @@ -39,6 +17,7 @@ void LUS::SetPathwaysFactoryV0::ParseFileBinary(std::shared_ptr re auto path = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResourceProcess(pathFileName.c_str())); setPathways->paths.push_back(path->GetPointer()); } -} -} // namespace LUS + return setPathways; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h index fc9b2c62d..c622c820d 100644 --- a/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetPathwaysFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetPathwaysFactory : public SceneCommandFactory { +namespace SOH { +class SetPathwaysFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetPathwaysFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp index 409e3d410..e4601e59c 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.cpp @@ -2,37 +2,16 @@ #include "soh/resource/type/scenecommand/SetRoomBehavior.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetRoomBehaviorFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetRoomBehavior with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetRoomBehaviorFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setRoomBehavior = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setRoomBehavior); +namespace SOH { +std::shared_ptr +SetRoomBehaviorFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setRoomBehavior = std::make_shared(initData); ReadCommandId(setRoomBehavior, reader); setRoomBehavior->roomBehavior.gameplayFlags = reader->ReadInt8(); setRoomBehavior->roomBehavior.gameplayFlags2 = reader->ReadInt32(); -} -} // namespace LUS + return setRoomBehavior; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h index ef5a77bd4..70a53ba1e 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetRoomBehaviorFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetRoomBehaviorFactory : public SceneCommandFactory { +namespace SOH { +class SetRoomBehaviorFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetRoomBehaviorFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp index 136b410a0..7726877a1 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.cpp @@ -2,49 +2,27 @@ #include "soh/resource/type/scenecommand/SetRoomList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetRoomListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetRoomList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetRoomListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setRoomList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setRoomList); +namespace SOH { +std::shared_ptr +SetRoomListFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setRoomList = std::make_shared(initData); ReadCommandId(setRoomList, reader); setRoomList->numRooms = reader->ReadInt32(); setRoomList->rooms.reserve(setRoomList->numRooms); for (uint32_t i = 0; i < setRoomList->numRooms; i++) { - RomFile room; + RomFile room; - setRoomList->fileNames.push_back(reader->ReadString()); + setRoomList->fileNames.push_back(reader->ReadString()); - room.fileName = (char*)setRoomList->fileNames.back().c_str(); - room.vromStart = reader->ReadInt32(); - room.vromEnd = reader->ReadInt32(); + room.fileName = (char*)setRoomList->fileNames.back().c_str(); + room.vromStart = reader->ReadInt32(); + room.vromEnd = reader->ReadInt32(); setRoomList->rooms.push_back(room); } -} -} // namespace LUS + return setRoomList; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h index 1ba5e5c1f..6bf9eaa5c 100644 --- a/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetRoomListFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetRoomListFactory : public SceneCommandFactory { +namespace SOH { +class SetRoomListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetRoomListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp index b68d2e56d..291ae578c 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.cpp @@ -2,37 +2,16 @@ #include "soh/resource/type/scenecommand/SetSkyboxModifier.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetSkyboxModifierFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetSkyboxModifier with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetSkyboxModifierFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setSkyboxModifier = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setSkyboxModifier); +namespace SOH { +std::shared_ptr SetSkyboxModifierFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setSkyboxModifier = std::make_shared(initData); ReadCommandId(setSkyboxModifier, reader); setSkyboxModifier->modifier.skyboxDisabled = reader->ReadInt8(); setSkyboxModifier->modifier.sunMoonDisabled = reader->ReadInt8(); -} -} // namespace LUS + return setSkyboxModifier; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h index 9556b6699..d467cc73d 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxModifierFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetSkyboxModifierFactory : public SceneCommandFactory { +namespace SOH { +class SetSkyboxModifierFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetSkyboxModifierFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp index 3b793c80e..f3e726b07 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.cpp @@ -2,32 +2,10 @@ #include "soh/resource/type/scenecommand/SetSkyboxSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetSkyboxSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetSkyboxSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void SetSkyboxSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setSkyboxSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setSkyboxSettings); +namespace SOH { +std::shared_ptr SetSkyboxSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setSkyboxSettings = std::make_shared(initData); ReadCommandId(setSkyboxSettings, reader); @@ -35,6 +13,7 @@ void SetSkyboxSettingsFactoryV0::ParseFileBinary(std::shared_ptr r setSkyboxSettings->settings.skyboxId = reader->ReadInt8(); setSkyboxSettings->settings.weather = reader->ReadInt8(); setSkyboxSettings->settings.indoors = reader->ReadInt8(); -} -} // namespace LUS + return setSkyboxSettings; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h index 7c2da4bb1..581e56122 100644 --- a/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSkyboxSettingsFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetSkyboxSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetSkyboxSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetSkyboxSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp index 1817af81d..f85178e22 100644 --- a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.cpp @@ -2,38 +2,17 @@ #include "soh/resource/type/scenecommand/SetSoundSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetSoundSettingsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetSoundSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetSoundSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setSoundSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setSoundSettings); +namespace SOH { +std::shared_ptr SetSoundSettingsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setSoundSettings = std::make_shared(initData); ReadCommandId(setSoundSettings, reader); setSoundSettings->settings.reverb = reader->ReadInt8(); setSoundSettings->settings.natureAmbienceId = reader->ReadInt8(); setSoundSettings->settings.seqId = reader->ReadInt8(); -} -} // namespace LUS + return setSoundSettings; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h index 7195b0fb6..e1c4efb03 100644 --- a/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSoundSettingsFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetSoundSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetSoundSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetSoundSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp index 5f818f1d4..b7fd21aa4 100644 --- a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.cpp @@ -2,37 +2,16 @@ #include "soh/resource/type/scenecommand/SetSpecialObjects.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetSpecialObjectsFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr){ - SPDLOG_ERROR("Failed to load SetSpecialObjects with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetSpecialObjectsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setSpecialObjects = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setSpecialObjects); +namespace SOH { +std::shared_ptr SetSpecialObjectsFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setSpecialObjects = std::make_shared(initData); ReadCommandId(setSpecialObjects, reader); setSpecialObjects->specialObjects.elfMessage = reader->ReadInt8(); setSpecialObjects->specialObjects.globalObject = reader->ReadInt16(); -} -} // namespace LUS + return setSpecialObjects; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h index 3e3fc77d0..503cfb61f 100644 --- a/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetSpecialObjectsFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetSpecialObjectsFactory : public SceneCommandFactory { +namespace SOH { +class SetSpecialObjectsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetSpecialObjectsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp index bafb0b153..3165b4361 100644 --- a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.cpp @@ -2,54 +2,30 @@ #include "soh/resource/type/scenecommand/SetStartPositionList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetStartPositionListFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) - { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) - { - SPDLOG_ERROR("Failed to load SetStartPositionList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetStartPositionListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) -{ - std::shared_ptr setStartPositionList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setStartPositionList); +namespace SOH { +std::shared_ptr SetStartPositionListFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setStartPositionList = std::make_shared(initData); ReadCommandId(setStartPositionList, reader); setStartPositionList->numStartPositions = reader->ReadUInt32(); setStartPositionList->startPositions.reserve(setStartPositionList->numStartPositions); for (uint32_t i = 0; i < setStartPositionList->numStartPositions; i++) { - ActorEntry entry; + ActorEntry entry; - entry.id = reader->ReadUInt16(); - entry.pos.x = reader->ReadInt16(); - entry.pos.y = reader->ReadInt16(); - entry.pos.z = reader->ReadInt16(); - entry.rot.x = reader->ReadInt16(); - entry.rot.y = reader->ReadInt16(); - entry.rot.z = reader->ReadInt16(); - entry.params = reader->ReadUInt16(); + entry.id = reader->ReadUInt16(); + entry.pos.x = reader->ReadInt16(); + entry.pos.y = reader->ReadInt16(); + entry.pos.z = reader->ReadInt16(); + entry.rot.x = reader->ReadInt16(); + entry.rot.y = reader->ReadInt16(); + entry.rot.z = reader->ReadInt16(); + entry.params = reader->ReadUInt16(); setStartPositionList->startPositions.push_back(entry); } -} -} // namespace LUS + return setStartPositionList; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h index d2bbcb6a6..b07901f05 100644 --- a/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetStartPositionListFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetStartPositionListFactory : public SceneCommandFactory { +namespace SOH { +class SetStartPositionListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetStartPositionListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp index ab2ac12f0..d83b24583 100644 --- a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.cpp @@ -2,38 +2,17 @@ #include "soh/resource/type/scenecommand/SetTimeSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetTimeSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetTimeSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetTimeSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setTimeSettings = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setTimeSettings); +namespace SOH { +std::shared_ptr +SetTimeSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setTimeSettings = std::make_shared(initData); ReadCommandId(setTimeSettings, reader); setTimeSettings->settings.hour = reader->ReadInt8(); setTimeSettings->settings.minute = reader->ReadInt8(); setTimeSettings->settings.timeIncrement = reader->ReadInt8(); -} -} // namespace LUS + return setTimeSettings; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h index b7ee1083c..d1336f788 100644 --- a/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetTimeSettingsFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetTimeSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetTimeSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetTimeSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp index 575151bab..c751ad611 100644 --- a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.cpp @@ -2,33 +2,11 @@ #include "soh/resource/type/scenecommand/SetTransitionActorList.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr SetTransitionActorListFactory::ReadResource(std::shared_ptr initData, - std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetTransitionActorList with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetTransitionActorListFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setTransitionActorList = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setTransitionActorList); - +namespace SOH { +std::shared_ptr SetTransitionActorListFactory::ReadResource(std::shared_ptr initData, + std::shared_ptr reader) { + auto setTransitionActorList = std::make_shared(initData); + ReadCommandId(setTransitionActorList, reader); setTransitionActorList->numTransitionActors = reader->ReadUInt32(); @@ -49,6 +27,7 @@ void LUS::SetTransitionActorListFactoryV0::ParseFileBinary(std::shared_ptrtransitionActorList.push_back(entry); } -} -} // namespace LUS + return setTransitionActorList; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h index 25343ced8..c8fb65f9a 100644 --- a/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetTransitionActorListFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetTransitionActorListFactory : public SceneCommandFactory { +namespace SOH { +class SetTransitionActorListFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetTransitionActorListFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp index 995045014..3208004ce 100644 --- a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp +++ b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.cpp @@ -2,32 +2,10 @@ #include "soh/resource/type/scenecommand/SetWindSettings.h" #include "spdlog/spdlog.h" -namespace LUS { -std::shared_ptr -SetWindSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { - auto resource = std::make_shared(initData); - std::shared_ptr factory = nullptr; - - switch (resource->GetInitData()->ResourceVersion) { - case 0: - factory = std::make_shared(); - break; - } - - if (factory == nullptr) { - SPDLOG_ERROR("Failed to load SetWindSettings with version {}", resource->GetInitData()->ResourceVersion); - return nullptr; - } - - factory->ParseFileBinary(reader, resource); - - return resource; -} - -void LUS::SetWindSettingsFactoryV0::ParseFileBinary(std::shared_ptr reader, - std::shared_ptr resource) { - std::shared_ptr setWind = std::static_pointer_cast(resource); - ResourceVersionFactory::ParseFileBinary(reader, setWind); +namespace SOH { +std::shared_ptr +SetWindSettingsFactory::ReadResource(std::shared_ptr initData, std::shared_ptr reader) { + auto setWind = std::make_shared(initData); ReadCommandId(setWind, reader); @@ -35,6 +13,7 @@ void LUS::SetWindSettingsFactoryV0::ParseFileBinary(std::shared_ptrsettings.windVertical = reader->ReadInt8(); setWind->settings.windSouth = reader->ReadInt8(); setWind->settings.windSpeed = reader->ReadUByte(); -} -} // namespace LUS + return setWind; +} +} // namespace SOH diff --git a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h index 0a783bb9f..6cc9fbc1b 100644 --- a/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h +++ b/soh/soh/resource/importer/scenecommand/SetWindSettingsFactory.h @@ -2,15 +2,10 @@ #include "soh/resource/importer/scenecommand/SceneCommandFactory.h" -namespace LUS { -class SetWindSettingsFactory : public SceneCommandFactory { +namespace SOH { +class SetWindSettingsFactory : public SceneCommandFactoryBinaryV0 { public: - std::shared_ptr - ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; + std::shared_ptr + ReadResource(std::shared_ptr initData, std::shared_ptr reader) override; }; - -class SetWindSettingsFactoryV0 : public SceneCommandVersionFactory { - public: - void ParseFileBinary(std::shared_ptr reader, std::shared_ptr resource) override; -}; -}; // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/Animation.cpp b/soh/soh/resource/type/Animation.cpp index 46327c732..d11d05394 100644 --- a/soh/soh/resource/type/Animation.cpp +++ b/soh/soh/resource/type/Animation.cpp @@ -1,6 +1,6 @@ #include "Animation.h" -namespace LUS { +namespace SOH { AnimationData* Animation::GetPointer() { return &animationData; } @@ -18,4 +18,4 @@ size_t Animation::GetPointerSize() { return 0; } } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/soh/soh/resource/type/Animation.h b/soh/soh/resource/type/Animation.h index 3d6b810bf..abd319d97 100644 --- a/soh/soh/resource/type/Animation.h +++ b/soh/soh/resource/type/Animation.h @@ -3,85 +3,85 @@ #include "Resource.h" #include -namespace LUS { - enum class AnimationType { - Normal = 0, - Link = 1, - Curve = 2, - Legacy = 3, - }; +namespace SOH { +enum class AnimationType { + Normal = 0, + Link = 1, + Curve = 2, + Legacy = 3, +}; - struct RotationIndex { - uint16_t x, y, z; +struct RotationIndex { + uint16_t x, y, z; - RotationIndex(uint16_t nX, uint16_t nY, uint16_t nZ) : x(nX), y(nY), z(nZ) { - } - }; + RotationIndex(uint16_t nX, uint16_t nY, uint16_t nZ) : x(nX), y(nY), z(nZ) { + } +}; - typedef struct { - /* 0x0000 */ u16 unk_00; // appears to be flags - /* 0x0002 */ s16 unk_02; - /* 0x0004 */ s16 unk_04; - /* 0x0006 */ s16 unk_06; - /* 0x0008 */ f32 unk_08; - } TransformData; // size = 0xC +typedef struct { + /* 0x0000 */ u16 unk_00; // appears to be flags + /* 0x0002 */ s16 unk_02; + /* 0x0004 */ s16 unk_04; + /* 0x0006 */ s16 unk_06; + /* 0x0008 */ f32 unk_08; +} TransformData; // size = 0xC - typedef struct { - /* 0x0000 */ u8* refIndex; - /* 0x0004 */ TransformData* transformData; - /* 0x0008 */ s16* copyValues; - /* 0x000C */ s16 unk_0C; - /* 0x000E */ s16 unk_0E; - } TransformUpdateIndex; // size = 0x10 +typedef struct { + /* 0x0000 */ u8* refIndex; + /* 0x0004 */ TransformData* transformData; + /* 0x0008 */ s16* copyValues; + /* 0x000C */ s16 unk_0C; + /* 0x000E */ s16 unk_0E; +} TransformUpdateIndex; // size = 0x10 - typedef struct { - /* 0x00 */ s16 frameCount; - } AnimationHeaderCommon; +typedef struct { + /* 0x00 */ s16 frameCount; +} AnimationHeaderCommon; - // Index into the frame data table. - typedef struct { - /* 0x00 */ u16 x; - /* 0x02 */ u16 y; - /* 0x04 */ u16 z; - } JointIndex; // size = 0x06 +// Index into the frame data table. +typedef struct { + /* 0x00 */ u16 x; + /* 0x02 */ u16 y; + /* 0x04 */ u16 z; +} JointIndex; // size = 0x06 - typedef struct { - /* 0x00 */ AnimationHeaderCommon common; - /* 0x04 */ s16* frameData; // "tbl" - /* 0x08 */ JointIndex* jointIndices; // "ref_tbl" - /* 0x0C */ u16 staticIndexMax; - } AnimationHeader; // size = 0x10 +typedef struct { + /* 0x00 */ AnimationHeaderCommon common; + /* 0x04 */ s16* frameData; // "tbl" + /* 0x08 */ JointIndex* jointIndices; // "ref_tbl" + /* 0x0C */ u16 staticIndexMax; +} AnimationHeader; // size = 0x10 - typedef struct { - /* 0x00 */ AnimationHeaderCommon common; - /* 0x04 */ void* segment; - } LinkAnimationHeader; // size = 0x8 +typedef struct { + /* 0x00 */ AnimationHeaderCommon common; + /* 0x04 */ void* segment; +} LinkAnimationHeader; // size = 0x8 - union AnimationData { - AnimationHeader animationHeader; - LinkAnimationHeader linkAnimationHeader; - TransformUpdateIndex transformUpdateIndex; - }; +union AnimationData { +AnimationHeader animationHeader; +LinkAnimationHeader linkAnimationHeader; +TransformUpdateIndex transformUpdateIndex; +}; - class Animation : public Resource { - public: - using Resource::Resource; +class Animation : public LUS::Resource { +public: + using Resource::Resource; - Animation() : Resource(std::shared_ptr()) {} + Animation() : Resource(std::shared_ptr()) {} - AnimationData* GetPointer(); - size_t GetPointerSize(); + AnimationData* GetPointer(); + size_t GetPointerSize(); - AnimationType type; - AnimationData animationData; + AnimationType type; + AnimationData animationData; - // NORMAL - std::vector rotationValues; - std::vector rotationIndices; + // NORMAL + std::vector rotationValues; + std::vector rotationIndices; - // CURVE - std::vector refIndexArr; - std::vector transformDataArr; - std::vector copyValuesArr; - }; -}; // namespace LUS \ No newline at end of file + // CURVE + std::vector refIndexArr; + std::vector transformDataArr; + std::vector copyValuesArr; +}; +}; // namespace LUS diff --git a/soh/soh/resource/type/AudioSample.cpp b/soh/soh/resource/type/AudioSample.cpp index 951aae6c1..288765822 100644 --- a/soh/soh/resource/type/AudioSample.cpp +++ b/soh/soh/resource/type/AudioSample.cpp @@ -1,6 +1,6 @@ #include "AudioSample.h" -namespace LUS { +namespace SOH { Sample* AudioSample::GetPointer() { return &sample; } @@ -8,4 +8,4 @@ Sample* AudioSample::GetPointer() { size_t AudioSample::GetPointerSize() { return sizeof(Sample); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/soh/soh/resource/type/AudioSample.h b/soh/soh/resource/type/AudioSample.h index eda8aa456..4d6929c59 100644 --- a/soh/soh/resource/type/AudioSample.h +++ b/soh/soh/resource/type/AudioSample.h @@ -5,7 +5,7 @@ #include "Resource.h" #include -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ uintptr_t start; /* 0x04 */ uintptr_t end; @@ -39,11 +39,11 @@ namespace LUS { s32 sampleRate; // For wav samples only... } Sample; // size = 0x10 - class AudioSample : public Resource { + class AudioSample : public LUS::Resource { public: using Resource::Resource; - AudioSample() : Resource(std::shared_ptr()) {} + AudioSample() : Resource(std::shared_ptr()) {} Sample* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/AudioSequence.cpp b/soh/soh/resource/type/AudioSequence.cpp index c09514a67..41029d47d 100644 --- a/soh/soh/resource/type/AudioSequence.cpp +++ b/soh/soh/resource/type/AudioSequence.cpp @@ -1,6 +1,6 @@ #include "AudioSequence.h" -namespace LUS { +namespace SOH { Sequence* AudioSequence::GetPointer() { return &sequence; @@ -9,4 +9,4 @@ Sequence* AudioSequence::GetPointer() { size_t AudioSequence::GetPointerSize() { return sizeof(Sequence); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/AudioSequence.h b/soh/soh/resource/type/AudioSequence.h index 2b2bb8be9..457db6243 100644 --- a/soh/soh/resource/type/AudioSequence.h +++ b/soh/soh/resource/type/AudioSequence.h @@ -5,7 +5,7 @@ #include "Resource.h" #include -namespace LUS { +namespace SOH { typedef struct { char* seqData; @@ -17,11 +17,11 @@ typedef struct { uint8_t fonts[16]; } Sequence; -class AudioSequence : public Resource { +class AudioSequence : public LUS::Resource { public: using Resource::Resource; - AudioSequence() : Resource(std::shared_ptr()) {} + AudioSequence() : Resource(std::shared_ptr()) {} Sequence* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/AudioSoundFont.cpp b/soh/soh/resource/type/AudioSoundFont.cpp index 43ac40abf..12218cb64 100644 --- a/soh/soh/resource/type/AudioSoundFont.cpp +++ b/soh/soh/resource/type/AudioSoundFont.cpp @@ -1,6 +1,6 @@ #include "AudioSoundFont.h" -namespace LUS { +namespace SOH { SoundFont* AudioSoundFont::GetPointer() { return &soundFont; } @@ -8,4 +8,4 @@ SoundFont* AudioSoundFont::GetPointer() { size_t AudioSoundFont::GetPointerSize() { return sizeof(SoundFont); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/AudioSoundFont.h b/soh/soh/resource/type/AudioSoundFont.h index c47218090..11b899d3e 100644 --- a/soh/soh/resource/type/AudioSoundFont.h +++ b/soh/soh/resource/type/AudioSoundFont.h @@ -6,7 +6,7 @@ #include "soh/resource/type/AudioSample.h" #include -namespace LUS { +namespace SOH { typedef struct { /* 0x0 */ s16 delay; @@ -52,11 +52,11 @@ typedef struct { s32 fntIndex; } SoundFont; // size = 0x14 -class AudioSoundFont : public Resource { +class AudioSoundFont : public LUS::Resource { public: using Resource::Resource; - AudioSoundFont() : Resource(std::shared_ptr()) {} + AudioSoundFont() : Resource(std::shared_ptr()) {} SoundFont* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/Background.cpp b/soh/soh/resource/type/Background.cpp index bc1047b5c..5465b1ad9 100644 --- a/soh/soh/resource/type/Background.cpp +++ b/soh/soh/resource/type/Background.cpp @@ -1,6 +1,6 @@ #include "Background.h" -namespace LUS { +namespace SOH { uint8_t* Background::GetPointer() { return Data.data(); } @@ -8,4 +8,4 @@ uint8_t* Background::GetPointer() { size_t Background::GetPointerSize() { return Data.size() * sizeof(uint8_t); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/Background.h b/soh/soh/resource/type/Background.h index 7f22658e0..9edc4b0d6 100644 --- a/soh/soh/resource/type/Background.h +++ b/soh/soh/resource/type/Background.h @@ -2,12 +2,12 @@ #include "resource/Resource.h" -namespace LUS { -class Background : public Resource { +namespace SOH { +class Background : public LUS::Resource { public: using Resource::Resource; - Background() : Resource(std::shared_ptr()) {} + Background() : Resource(std::shared_ptr()) {} uint8_t* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/CollisionHeader.cpp b/soh/soh/resource/type/CollisionHeader.cpp index 5625d2b59..dbfd737ee 100644 --- a/soh/soh/resource/type/CollisionHeader.cpp +++ b/soh/soh/resource/type/CollisionHeader.cpp @@ -1,6 +1,6 @@ #include "CollisionHeader.h" -namespace LUS { +namespace SOH { CollisionHeaderData* CollisionHeader::GetPointer() { return &collisionHeaderData; } @@ -8,4 +8,4 @@ CollisionHeaderData* CollisionHeader::GetPointer() { size_t CollisionHeader::GetPointerSize() { return sizeof(collisionHeaderData); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/soh/soh/resource/type/CollisionHeader.h b/soh/soh/resource/type/CollisionHeader.h index e401aa7f5..e2ddf3f7a 100644 --- a/soh/soh/resource/type/CollisionHeader.h +++ b/soh/soh/resource/type/CollisionHeader.h @@ -6,7 +6,7 @@ #include #include "z64math.h" -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ u16 type; @@ -67,11 +67,11 @@ typedef struct { size_t cameraDataListLen; // OTRTODO: Added to allow for bounds checking the cameraDataList. } CollisionHeaderData; // original name: BGDataInfo -class CollisionHeader : public Resource { +class CollisionHeader : public LUS::Resource { public: using Resource::Resource; - CollisionHeader() : Resource(std::shared_ptr()) {} + CollisionHeader() : Resource(std::shared_ptr()) {} CollisionHeaderData* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/Cutscene.cpp b/soh/soh/resource/type/Cutscene.cpp index c7e98062a..60440ceb2 100644 --- a/soh/soh/resource/type/Cutscene.cpp +++ b/soh/soh/resource/type/Cutscene.cpp @@ -1,7 +1,7 @@ #include "Cutscene.h" #include -namespace LUS { +namespace SOH { uint32_t* Cutscene::GetPointer() { return commands.data(); } @@ -9,4 +9,4 @@ uint32_t* Cutscene::GetPointer() { size_t Cutscene::GetPointerSize() { return commands.size() * sizeof(uint32_t); } -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/soh/soh/resource/type/Cutscene.h b/soh/soh/resource/type/Cutscene.h index 5bd268e61..3ca8b3d50 100644 --- a/soh/soh/resource/type/Cutscene.h +++ b/soh/soh/resource/type/Cutscene.h @@ -7,7 +7,7 @@ #include "Vec3f.h" #include "Color3b.h" -namespace LUS { +namespace SOH { enum class CutsceneCommands { Cmd00 = 0x0000, @@ -44,11 +44,11 @@ enum class CutsceneCommands { Error = 0xFEAF, }; -class Cutscene : public Resource { +class Cutscene : public LUS::Resource { public: using Resource::Resource; - Cutscene() : Resource(std::shared_ptr()) {} + Cutscene() : Resource(std::shared_ptr()) {} uint32_t* GetPointer(); size_t GetPointerSize(); @@ -57,7 +57,7 @@ class Cutscene : public Resource { uint32_t endFrame; std::vector commands; }; -} // namespace LUS +} // namespace SOH ///////////// diff --git a/soh/soh/resource/type/Path.cpp b/soh/soh/resource/type/Path.cpp index 535db4e7d..072c65fd0 100644 --- a/soh/soh/resource/type/Path.cpp +++ b/soh/soh/resource/type/Path.cpp @@ -1,6 +1,6 @@ #include "Path.h" -namespace LUS { +namespace SOH { PathData* Path::GetPointer() { return pathData.data(); } @@ -8,4 +8,4 @@ PathData* Path::GetPointer() { size_t Path::GetPointerSize() { return pathData.size() * sizeof(PathData); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/Path.h b/soh/soh/resource/type/Path.h index 5dd16dec9..c4078bed3 100644 --- a/soh/soh/resource/type/Path.h +++ b/soh/soh/resource/type/Path.h @@ -6,18 +6,18 @@ #include #include "z64math.h" -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ u8 count; // number of points in the path /* 0x04 */ Vec3s* points; // Segment Address to the array of points } PathData; // size = 0x8 -class Path : public Resource { +class Path : public LUS::Resource { public: using Resource::Resource; - Path() : Resource(std::shared_ptr()) {} + Path() : Resource(std::shared_ptr()) {} PathData* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/PlayerAnimation.cpp b/soh/soh/resource/type/PlayerAnimation.cpp index 55925f49c..189460e4d 100644 --- a/soh/soh/resource/type/PlayerAnimation.cpp +++ b/soh/soh/resource/type/PlayerAnimation.cpp @@ -1,7 +1,7 @@ #include "PlayerAnimation.h" #include -namespace LUS { +namespace SOH { int16_t* PlayerAnimation::GetPointer() { return limbRotData.data(); } @@ -9,4 +9,4 @@ int16_t* PlayerAnimation::GetPointer() { size_t PlayerAnimation::GetPointerSize() { return limbRotData.size() * sizeof(int16_t); } -} // namespace LUS \ No newline at end of file +} // namespace SOH diff --git a/soh/soh/resource/type/PlayerAnimation.h b/soh/soh/resource/type/PlayerAnimation.h index 4eb51b139..d8c47a5f6 100644 --- a/soh/soh/resource/type/PlayerAnimation.h +++ b/soh/soh/resource/type/PlayerAnimation.h @@ -7,17 +7,16 @@ #include "Vec3f.h" #include "Color3b.h" -namespace LUS { - -class PlayerAnimation : public Resource { +namespace SOH { +class PlayerAnimation : public LUS::Resource { public: using Resource::Resource; - PlayerAnimation() : Resource(std::shared_ptr()) {} + PlayerAnimation() : Resource(std::shared_ptr()) {} int16_t* GetPointer(); size_t GetPointerSize(); std::vector limbRotData; }; -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/soh/soh/resource/type/Scene.cpp b/soh/soh/resource/type/Scene.cpp index bfe219e54..15829c40e 100644 --- a/soh/soh/resource/type/Scene.cpp +++ b/soh/soh/resource/type/Scene.cpp @@ -1,6 +1,6 @@ #include "Scene.h" -namespace LUS { +namespace SOH { void* Scene::GetPointer() { // Scene is a special type that requries C++ processing. As such, we return nothing. return nullptr; @@ -9,4 +9,4 @@ void* Scene::GetPointer() { size_t Scene::GetPointerSize() { return 0; } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/Scene.h b/soh/soh/resource/type/Scene.h index f726da359..79ff69392 100644 --- a/soh/soh/resource/type/Scene.h +++ b/soh/soh/resource/type/Scene.h @@ -7,13 +7,13 @@ #include "scenecommand/SceneCommand.h" #include -namespace LUS { +namespace SOH { -class Scene : public Resource { +class Scene : public LUS::Resource { public: using Resource::Resource; - Scene() : Resource(std::shared_ptr()) {} + Scene() : Resource(std::shared_ptr()) {} void* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/Skeleton.cpp b/soh/soh/resource/type/Skeleton.cpp index 13798d3c5..39c28f533 100644 --- a/soh/soh/resource/type/Skeleton.cpp +++ b/soh/soh/resource/type/Skeleton.cpp @@ -3,7 +3,7 @@ #include "soh/OTRGlobals.h" #include "libultraship/libultraship.h" -namespace LUS { +namespace SOH { SkeletonData* Skeleton::GetPointer() { return &skeletonData; } @@ -79,4 +79,4 @@ void SkeletonPatcher::UpdateSkeletons() { } } } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/Skeleton.h b/soh/soh/resource/type/Skeleton.h index 490614a44..81aa90c68 100644 --- a/soh/soh/resource/type/Skeleton.h +++ b/soh/soh/resource/type/Skeleton.h @@ -5,7 +5,7 @@ #include "SkeletonLimb.h" #include -namespace LUS { +namespace SOH { enum class SkeletonType { Normal, @@ -50,11 +50,11 @@ union SkeletonData { SkelCurveLimbList skelCurveLimbList; }; -class Skeleton : public Resource { +class Skeleton : public LUS::Resource { public: using Resource::Resource; - Skeleton() : Resource(std::shared_ptr()) {} + Skeleton() : Resource(std::shared_ptr()) {} SkeletonData* GetPointer(); size_t GetPointerSize(); @@ -91,4 +91,4 @@ class SkeletonPatcher { }; -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/soh/soh/resource/type/SkeletonLimb.cpp b/soh/soh/resource/type/SkeletonLimb.cpp index 8e5a8ef6d..eb599e641 100644 --- a/soh/soh/resource/type/SkeletonLimb.cpp +++ b/soh/soh/resource/type/SkeletonLimb.cpp @@ -1,6 +1,6 @@ #include "SkeletonLimb.h" -namespace LUS { +namespace SOH { SkeletonLimbData* SkeletonLimb::GetPointer() { return &limbData; } @@ -21,4 +21,4 @@ size_t SkeletonLimb::GetPointerSize() { return 0; } } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/SkeletonLimb.h b/soh/soh/resource/type/SkeletonLimb.h index 2110b3484..bae04092c 100644 --- a/soh/soh/resource/type/SkeletonLimb.h +++ b/soh/soh/resource/type/SkeletonLimb.h @@ -4,7 +4,7 @@ #include "libultraship/libultra.h" #include "z64math.h" -namespace LUS { +namespace SOH { enum class LimbType { Invalid, Standard, @@ -97,11 +97,11 @@ union SkeletonLimbData { SkinLimb skinLimb; }; -class SkeletonLimb : public Resource { +class SkeletonLimb : public LUS::Resource { public: using Resource::Resource; - SkeletonLimb() : Resource(std::shared_ptr()) {} + SkeletonLimb() : Resource(std::shared_ptr()) {} SkeletonLimbData* GetPointer(); size_t GetPointerSize(); @@ -131,4 +131,4 @@ public: std::vector> skinLimbModifVertexArrays; std::vector> skinLimbModifTransformationArrays; }; -} // namespace LUS \ No newline at end of file +} // namespace SOH \ No newline at end of file diff --git a/soh/soh/resource/type/SohResourceType.h b/soh/soh/resource/type/SohResourceType.h new file mode 100644 index 000000000..fdf39031e --- /dev/null +++ b/soh/soh/resource/type/SohResourceType.h @@ -0,0 +1,21 @@ +#pragma once + +namespace SOH { +enum class ResourceType { + SOH_Animation = 0x4F414E4D, // OANM + SOH_PlayerAnimation = 0x4F50414D, // OPAM + SOH_Room = 0x4F524F4D, // OROM + SOH_CollisionHeader = 0x4F434F4C, // OCOL + SOH_Skeleton = 0x4F534B4C, // OSKL + SOH_SkeletonLimb = 0x4F534C42, // OSLB + SOH_Path = 0x4F505448, // OPTH + SOH_Cutscene = 0x4F435654, // OCUT + SOH_Text = 0x4F545854, // OTXT + SOH_Audio = 0x4F415544, // OAUD + SOH_AudioSample = 0x4F534D50, // OSMP + SOH_AudioSoundFont = 0x4F534654, // OSFT + SOH_AudioSequence = 0x4F534551, // OSEQ + SOH_Background = 0x4F424749, // OBGI + SOH_SceneCommand = 0x4F52434D, // ORCM +}; +} // namespace SOH diff --git a/soh/soh/resource/type/Text.cpp b/soh/soh/resource/type/Text.cpp index eee289f8a..4678dbbad 100644 --- a/soh/soh/resource/type/Text.cpp +++ b/soh/soh/resource/type/Text.cpp @@ -1,6 +1,6 @@ #include "Text.h" -namespace LUS { +namespace SOH { MessageEntry* Text::GetPointer() { return messages.data(); } @@ -8,4 +8,4 @@ MessageEntry* Text::GetPointer() { size_t Text::GetPointerSize() { return messages.size() * sizeof(MessageEntry); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/Text.h b/soh/soh/resource/type/Text.h index db0cb36a0..03cf7340b 100644 --- a/soh/soh/resource/type/Text.h +++ b/soh/soh/resource/type/Text.h @@ -5,7 +5,7 @@ #include "Resource.h" #include -namespace LUS { +namespace SOH { // TODO: we've moved away from using classes for this stuff class MessageEntry { @@ -16,11 +16,11 @@ public: std::string msg; }; -class Text : public Resource { +class Text : public LUS::Resource { public: using Resource::Resource; - Text() : Resource(std::shared_ptr()) {} + Text() : Resource(std::shared_ptr()) {} MessageEntry* GetPointer(); size_t GetPointerSize(); diff --git a/soh/soh/resource/type/scenecommand/EndMarker.cpp b/soh/soh/resource/type/scenecommand/EndMarker.cpp index 9d12c1518..ba8898187 100644 --- a/soh/soh/resource/type/scenecommand/EndMarker.cpp +++ b/soh/soh/resource/type/scenecommand/EndMarker.cpp @@ -1,6 +1,6 @@ #include "EndMarker.h" -namespace LUS { +namespace SOH { Marker* EndMarker::GetPointer() { return &endMarker; } @@ -8,4 +8,4 @@ Marker* EndMarker::GetPointer() { size_t EndMarker::GetPointerSize() { return sizeof(Marker); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/EndMarker.h b/soh/soh/resource/type/scenecommand/EndMarker.h index 9f981f1f9..4f45051c2 100644 --- a/soh/soh/resource/type/scenecommand/EndMarker.h +++ b/soh/soh/resource/type/scenecommand/EndMarker.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { } Marker; diff --git a/soh/soh/resource/type/scenecommand/RomFile.h b/soh/soh/resource/type/scenecommand/RomFile.h index ebdc3dc3b..19a5545e7 100644 --- a/soh/soh/resource/type/scenecommand/RomFile.h +++ b/soh/soh/resource/type/scenecommand/RomFile.h @@ -2,7 +2,7 @@ #include -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ uintptr_t vromStart; /* 0x04 */ uintptr_t vromEnd; diff --git a/soh/soh/resource/type/scenecommand/SceneCommand.h b/soh/soh/resource/type/scenecommand/SceneCommand.h index 6fb845568..5eb44ae9d 100644 --- a/soh/soh/resource/type/scenecommand/SceneCommand.h +++ b/soh/soh/resource/type/scenecommand/SceneCommand.h @@ -6,7 +6,7 @@ #include "Resource.h" #include -namespace LUS { +namespace SOH { enum class SceneCommandID : uint8_t { SetStartPositionList = 0x00, @@ -47,10 +47,10 @@ enum class SceneCommandID : uint8_t { Error = 0xFF }; -class ISceneCommand : public IResource { +class ISceneCommand : public LUS::IResource { public: using IResource::IResource; - ISceneCommand() : IResource(std::shared_ptr()) {} + ISceneCommand() : IResource(std::shared_ptr()) {} SceneCommandID cmdId; }; diff --git a/soh/soh/resource/type/scenecommand/SetActorList.cpp b/soh/soh/resource/type/scenecommand/SetActorList.cpp index d37ebb148..5bb62e764 100644 --- a/soh/soh/resource/type/scenecommand/SetActorList.cpp +++ b/soh/soh/resource/type/scenecommand/SetActorList.cpp @@ -1,6 +1,6 @@ #include "SetActorList.h" -namespace LUS { +namespace SOH { ActorEntry* SetActorList::GetPointer() { return actorList.data(); } @@ -8,4 +8,4 @@ ActorEntry* SetActorList::GetPointer() { size_t SetActorList::GetPointerSize() { return actorList.size() * sizeof(ActorEntry); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetActorList.h b/soh/soh/resource/type/scenecommand/SetActorList.h index 117175d7d..0eb53c585 100644 --- a/soh/soh/resource/type/scenecommand/SetActorList.h +++ b/soh/soh/resource/type/scenecommand/SetActorList.h @@ -9,7 +9,7 @@ // #include #include "z64math.h" -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ s16 id; /* 0x02 */ Vec3s pos; diff --git a/soh/soh/resource/type/scenecommand/SetAlternateHeaders.cpp b/soh/soh/resource/type/scenecommand/SetAlternateHeaders.cpp index 15b3c97d4..911fef455 100644 --- a/soh/soh/resource/type/scenecommand/SetAlternateHeaders.cpp +++ b/soh/soh/resource/type/scenecommand/SetAlternateHeaders.cpp @@ -1,6 +1,6 @@ #include "SetAlternateHeaders.h" -namespace LUS { +namespace SOH { void* SetAlternateHeaders::GetPointer() { // Like Scene, SetAlternateHeader is a special type that is only acted upon in C++. return nullptr; @@ -9,4 +9,4 @@ void* SetAlternateHeaders::GetPointer() { size_t SetAlternateHeaders::GetPointerSize() { return 0; } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetAlternateHeaders.h b/soh/soh/resource/type/scenecommand/SetAlternateHeaders.h index dc7272369..fdddee3f8 100644 --- a/soh/soh/resource/type/scenecommand/SetAlternateHeaders.h +++ b/soh/soh/resource/type/scenecommand/SetAlternateHeaders.h @@ -11,7 +11,7 @@ #include -namespace LUS { +namespace SOH { class SetAlternateHeaders : public SceneCommand { public: diff --git a/soh/soh/resource/type/scenecommand/SetCameraSettings.cpp b/soh/soh/resource/type/scenecommand/SetCameraSettings.cpp index e1d2967e7..5c41f1c8f 100644 --- a/soh/soh/resource/type/scenecommand/SetCameraSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetCameraSettings.cpp @@ -1,6 +1,6 @@ #include "SetCameraSettings.h" -namespace LUS { +namespace SOH { CameraSettings* SetCameraSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ CameraSettings* SetCameraSettings::GetPointer() { size_t SetCameraSettings::GetPointerSize() { return sizeof(CameraSettings); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetCameraSettings.h b/soh/soh/resource/type/scenecommand/SetCameraSettings.h index adbde2e02..1d8062f9a 100644 --- a/soh/soh/resource/type/scenecommand/SetCameraSettings.h +++ b/soh/soh/resource/type/scenecommand/SetCameraSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { int8_t cameraMovement; int32_t worldMapArea; diff --git a/soh/soh/resource/type/scenecommand/SetCollisionHeader.cpp b/soh/soh/resource/type/scenecommand/SetCollisionHeader.cpp index db8cdcb32..a1c22b9ea 100644 --- a/soh/soh/resource/type/scenecommand/SetCollisionHeader.cpp +++ b/soh/soh/resource/type/scenecommand/SetCollisionHeader.cpp @@ -1,6 +1,6 @@ #include "SetCollisionHeader.h" -namespace LUS { +namespace SOH { CollisionHeaderData* SetCollisionHeader::GetPointer() { if (collisionHeader == nullptr) { return nullptr; @@ -14,4 +14,4 @@ size_t SetCollisionHeader::GetPointerSize() { } return collisionHeader->GetPointerSize(); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetCollisionHeader.h b/soh/soh/resource/type/scenecommand/SetCollisionHeader.h index 79573fe74..e2f63d089 100644 --- a/soh/soh/resource/type/scenecommand/SetCollisionHeader.h +++ b/soh/soh/resource/type/scenecommand/SetCollisionHeader.h @@ -9,7 +9,7 @@ #include "soh/resource/type/CollisionHeader.h" // #include -namespace LUS { +namespace SOH { class SetCollisionHeader : public SceneCommand { public: using SceneCommand::SceneCommand; diff --git a/soh/soh/resource/type/scenecommand/SetCsCamera.cpp b/soh/soh/resource/type/scenecommand/SetCsCamera.cpp index d3eafb803..762ee1e65 100644 --- a/soh/soh/resource/type/scenecommand/SetCsCamera.cpp +++ b/soh/soh/resource/type/scenecommand/SetCsCamera.cpp @@ -1,6 +1,6 @@ #include "SetCsCamera.h" -namespace LUS { +namespace SOH { CsCamera* SetCsCamera::GetPointer() { return &csCamera; } @@ -8,4 +8,4 @@ CsCamera* SetCsCamera::GetPointer() { size_t SetCsCamera::GetPointerSize() { return sizeof(CsCamera); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetCsCamera.h b/soh/soh/resource/type/scenecommand/SetCsCamera.h index db0e3d682..c44d9f935 100644 --- a/soh/soh/resource/type/scenecommand/SetCsCamera.h +++ b/soh/soh/resource/type/scenecommand/SetCsCamera.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { } CsCamera; diff --git a/soh/soh/resource/type/scenecommand/SetCutscenes.cpp b/soh/soh/resource/type/scenecommand/SetCutscenes.cpp index 42d1326d5..6643eda47 100644 --- a/soh/soh/resource/type/scenecommand/SetCutscenes.cpp +++ b/soh/soh/resource/type/scenecommand/SetCutscenes.cpp @@ -1,6 +1,6 @@ #include "SetCutscenes.h" -namespace LUS { +namespace SOH { uint32_t* SetCutscenes::GetPointer() { if (cutscene == nullptr) { return nullptr; @@ -14,4 +14,4 @@ size_t SetCutscenes::GetPointerSize() { } return cutscene->GetPointerSize(); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetCutscenes.h b/soh/soh/resource/type/scenecommand/SetCutscenes.h index 482553934..be74770c0 100644 --- a/soh/soh/resource/type/scenecommand/SetCutscenes.h +++ b/soh/soh/resource/type/scenecommand/SetCutscenes.h @@ -9,7 +9,7 @@ #include "soh/resource/type/Cutscene.h" // #include -namespace LUS { +namespace SOH { class SetCutscenes : public SceneCommand { public: using SceneCommand::SceneCommand; diff --git a/soh/soh/resource/type/scenecommand/SetEchoSettings.cpp b/soh/soh/resource/type/scenecommand/SetEchoSettings.cpp index 47cfa85ad..d4b2b1e15 100644 --- a/soh/soh/resource/type/scenecommand/SetEchoSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetEchoSettings.cpp @@ -1,6 +1,6 @@ #include "SetEchoSettings.h" -namespace LUS { +namespace SOH { EchoSettings* SetEchoSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ EchoSettings* SetEchoSettings::GetPointer() { size_t SetEchoSettings::GetPointerSize() { return sizeof(EchoSettings); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetEchoSettings.h b/soh/soh/resource/type/scenecommand/SetEchoSettings.h index ea2f664d4..30f54d1b3 100644 --- a/soh/soh/resource/type/scenecommand/SetEchoSettings.h +++ b/soh/soh/resource/type/scenecommand/SetEchoSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { int8_t echo; } EchoSettings; diff --git a/soh/soh/resource/type/scenecommand/SetEntranceList.cpp b/soh/soh/resource/type/scenecommand/SetEntranceList.cpp index d33ac189b..e82711da2 100644 --- a/soh/soh/resource/type/scenecommand/SetEntranceList.cpp +++ b/soh/soh/resource/type/scenecommand/SetEntranceList.cpp @@ -1,6 +1,6 @@ #include "SetEntranceList.h" -namespace LUS { +namespace SOH { EntranceEntry* SetEntranceList::GetPointer() { return entrances.data(); } @@ -8,4 +8,4 @@ EntranceEntry* SetEntranceList::GetPointer() { size_t SetEntranceList::GetPointerSize() { return entrances.size() * sizeof(EntranceEntry); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetEntranceList.h b/soh/soh/resource/type/scenecommand/SetEntranceList.h index d31dda78c..7c41b4b04 100644 --- a/soh/soh/resource/type/scenecommand/SetEntranceList.h +++ b/soh/soh/resource/type/scenecommand/SetEntranceList.h @@ -8,7 +8,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ u8 spawn; /* 0x01 */ u8 room; diff --git a/soh/soh/resource/type/scenecommand/SetExitList.cpp b/soh/soh/resource/type/scenecommand/SetExitList.cpp index 99966cdb4..3de483b0e 100644 --- a/soh/soh/resource/type/scenecommand/SetExitList.cpp +++ b/soh/soh/resource/type/scenecommand/SetExitList.cpp @@ -1,6 +1,6 @@ #include "SetExitList.h" -namespace LUS { +namespace SOH { uint16_t* SetExitList::GetPointer() { return exits.data(); } @@ -8,4 +8,4 @@ uint16_t* SetExitList::GetPointer() { size_t SetExitList::GetPointerSize() { return exits.size() * sizeof(int16_t); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetExitList.h b/soh/soh/resource/type/scenecommand/SetExitList.h index c6f0b3f42..f97f11d1e 100644 --- a/soh/soh/resource/type/scenecommand/SetExitList.h +++ b/soh/soh/resource/type/scenecommand/SetExitList.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { class SetExitList : public SceneCommand { public: using SceneCommand::SceneCommand; diff --git a/soh/soh/resource/type/scenecommand/SetLightList.cpp b/soh/soh/resource/type/scenecommand/SetLightList.cpp index c59f75c20..459e957cb 100644 --- a/soh/soh/resource/type/scenecommand/SetLightList.cpp +++ b/soh/soh/resource/type/scenecommand/SetLightList.cpp @@ -1,6 +1,6 @@ #include "SetLightList.h" -namespace LUS { +namespace SOH { LightInfo* SetLightList::GetPointer() { return lightList.data(); } @@ -8,4 +8,4 @@ LightInfo* SetLightList::GetPointer() { size_t SetLightList::GetPointerSize() { return lightList.size() * sizeof(LightInfo); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetLightList.h b/soh/soh/resource/type/scenecommand/SetLightList.h index bbc5aad3d..c3ede1f16 100644 --- a/soh/soh/resource/type/scenecommand/SetLightList.h +++ b/soh/soh/resource/type/scenecommand/SetLightList.h @@ -8,7 +8,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { /* 0x0 */ s16 x; /* 0x2 */ s16 y; diff --git a/soh/soh/resource/type/scenecommand/SetLightingSettings.cpp b/soh/soh/resource/type/scenecommand/SetLightingSettings.cpp index 69127f19c..042062512 100644 --- a/soh/soh/resource/type/scenecommand/SetLightingSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetLightingSettings.cpp @@ -1,6 +1,6 @@ #include "SetLightingSettings.h" -namespace LUS { +namespace SOH { EnvLightSettings* SetLightingSettings::GetPointer() { return settings.data(); } @@ -8,4 +8,4 @@ EnvLightSettings* SetLightingSettings::GetPointer() { size_t SetLightingSettings::GetPointerSize() { return settings.size() * sizeof(EnvLightSettings); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetLightingSettings.h b/soh/soh/resource/type/scenecommand/SetLightingSettings.h index ca894fec3..b8f08d834 100644 --- a/soh/soh/resource/type/scenecommand/SetLightingSettings.h +++ b/soh/soh/resource/type/scenecommand/SetLightingSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ u8 ambientColor[3]; /* 0x03 */ s8 light1Dir[3]; diff --git a/soh/soh/resource/type/scenecommand/SetMesh.cpp b/soh/soh/resource/type/scenecommand/SetMesh.cpp index 5ecd2cbfa..1e2cd396c 100644 --- a/soh/soh/resource/type/scenecommand/SetMesh.cpp +++ b/soh/soh/resource/type/scenecommand/SetMesh.cpp @@ -1,6 +1,6 @@ #include "SetMesh.h" -namespace LUS { +namespace SOH { MeshHeader* SetMesh::GetPointer() { return &meshHeader; } @@ -8,4 +8,4 @@ MeshHeader* SetMesh::GetPointer() { size_t SetMesh::GetPointerSize() { return sizeof(MeshHeader); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetMesh.h b/soh/soh/resource/type/scenecommand/SetMesh.h index a3a6c9731..33ab24202 100644 --- a/soh/soh/resource/type/scenecommand/SetMesh.h +++ b/soh/soh/resource/type/scenecommand/SetMesh.h @@ -8,7 +8,7 @@ #include "libultraship/libultra.h" #include "z64math.h" -namespace LUS { +namespace SOH { typedef struct { /* 0x00 */ u8 type; } PolygonBase; diff --git a/soh/soh/resource/type/scenecommand/SetObjectList.cpp b/soh/soh/resource/type/scenecommand/SetObjectList.cpp index 921166675..04aeb27d0 100644 --- a/soh/soh/resource/type/scenecommand/SetObjectList.cpp +++ b/soh/soh/resource/type/scenecommand/SetObjectList.cpp @@ -1,6 +1,6 @@ #include "SetObjectList.h" -namespace LUS { +namespace SOH { int16_t* SetObjectList::GetPointer() { return objects.data(); } @@ -8,4 +8,4 @@ int16_t* SetObjectList::GetPointer() { size_t SetObjectList::GetPointerSize() { return objects.size() * sizeof(int16_t); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetObjectList.h b/soh/soh/resource/type/scenecommand/SetObjectList.h index c6f786636..e843d4db0 100644 --- a/soh/soh/resource/type/scenecommand/SetObjectList.h +++ b/soh/soh/resource/type/scenecommand/SetObjectList.h @@ -8,7 +8,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { class SetObjectList : public SceneCommand { public: using SceneCommand::SceneCommand; diff --git a/soh/soh/resource/type/scenecommand/SetPathways.cpp b/soh/soh/resource/type/scenecommand/SetPathways.cpp index b69108ea6..fe1d7c5d8 100644 --- a/soh/soh/resource/type/scenecommand/SetPathways.cpp +++ b/soh/soh/resource/type/scenecommand/SetPathways.cpp @@ -1,6 +1,6 @@ #include "SetPathways.h" -namespace LUS { +namespace SOH { PathData** SetPathways::GetPointer() { return paths.data(); } @@ -8,4 +8,4 @@ PathData** SetPathways::GetPointer() { size_t SetPathways::GetPointerSize() { return paths.size() * sizeof(PathData*); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetPathways.h b/soh/soh/resource/type/scenecommand/SetPathways.h index 5846c382f..cf875cf5e 100644 --- a/soh/soh/resource/type/scenecommand/SetPathways.h +++ b/soh/soh/resource/type/scenecommand/SetPathways.h @@ -8,7 +8,7 @@ // #include #include "soh/resource/type/Path.h" -namespace LUS { +namespace SOH { class SetPathways : public SceneCommand { public: diff --git a/soh/soh/resource/type/scenecommand/SetRoomBehavior.cpp b/soh/soh/resource/type/scenecommand/SetRoomBehavior.cpp index deababc87..11bb4e95f 100644 --- a/soh/soh/resource/type/scenecommand/SetRoomBehavior.cpp +++ b/soh/soh/resource/type/scenecommand/SetRoomBehavior.cpp @@ -1,6 +1,6 @@ #include "SetRoomBehavior.h" -namespace LUS { +namespace SOH { RoomBehavior* SetRoomBehavior::GetPointer() { return &roomBehavior; } @@ -8,4 +8,4 @@ RoomBehavior* SetRoomBehavior::GetPointer() { size_t SetRoomBehavior::GetPointerSize() { return sizeof(RoomBehavior); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetRoomBehavior.h b/soh/soh/resource/type/scenecommand/SetRoomBehavior.h index c2a28176e..c05e96a66 100644 --- a/soh/soh/resource/type/scenecommand/SetRoomBehavior.h +++ b/soh/soh/resource/type/scenecommand/SetRoomBehavior.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { int8_t gameplayFlags; int32_t gameplayFlags2; diff --git a/soh/soh/resource/type/scenecommand/SetRoomList.cpp b/soh/soh/resource/type/scenecommand/SetRoomList.cpp index cf8c1d61a..c81d3645e 100644 --- a/soh/soh/resource/type/scenecommand/SetRoomList.cpp +++ b/soh/soh/resource/type/scenecommand/SetRoomList.cpp @@ -1,6 +1,6 @@ #include "SetRoomList.h" -namespace LUS { +namespace SOH { RomFile* SetRoomList::GetPointer() { return rooms.data(); } @@ -8,4 +8,4 @@ RomFile* SetRoomList::GetPointer() { size_t SetRoomList::GetPointerSize() { return rooms.size() * sizeof(RomFile); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetRoomList.h b/soh/soh/resource/type/scenecommand/SetRoomList.h index 66d83dc9c..09ba46f22 100644 --- a/soh/soh/resource/type/scenecommand/SetRoomList.h +++ b/soh/soh/resource/type/scenecommand/SetRoomList.h @@ -10,7 +10,7 @@ #include -namespace LUS { +namespace SOH { // typedef struct { // /* 0x00 */ uintptr_t vromStart; // /* 0x04 */ uintptr_t vromEnd; diff --git a/soh/soh/resource/type/scenecommand/SetSkyboxModifier.cpp b/soh/soh/resource/type/scenecommand/SetSkyboxModifier.cpp index 9926ec01a..122d93d77 100644 --- a/soh/soh/resource/type/scenecommand/SetSkyboxModifier.cpp +++ b/soh/soh/resource/type/scenecommand/SetSkyboxModifier.cpp @@ -1,6 +1,6 @@ #include "SetSkyboxModifier.h" -namespace LUS { +namespace SOH { SkyboxModifier* SetSkyboxModifier::GetPointer() { return &modifier; } @@ -8,4 +8,4 @@ SkyboxModifier* SetSkyboxModifier::GetPointer() { size_t SetSkyboxModifier::GetPointerSize() { return sizeof(SkyboxModifier); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetSkyboxModifier.h b/soh/soh/resource/type/scenecommand/SetSkyboxModifier.h index 6a54879e6..a60adfcaf 100644 --- a/soh/soh/resource/type/scenecommand/SetSkyboxModifier.h +++ b/soh/soh/resource/type/scenecommand/SetSkyboxModifier.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { uint8_t skyboxDisabled; uint8_t sunMoonDisabled; diff --git a/soh/soh/resource/type/scenecommand/SetSkyboxSettings.cpp b/soh/soh/resource/type/scenecommand/SetSkyboxSettings.cpp index 7f12d4fa3..527f0462c 100644 --- a/soh/soh/resource/type/scenecommand/SetSkyboxSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetSkyboxSettings.cpp @@ -1,6 +1,6 @@ #include "SetSkyboxSettings.h" -namespace LUS { +namespace SOH { SkyboxSettings* SetSkyboxSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ SkyboxSettings* SetSkyboxSettings::GetPointer() { size_t SetSkyboxSettings::GetPointerSize() { return sizeof(SetSkyboxSettings); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetSkyboxSettings.h b/soh/soh/resource/type/scenecommand/SetSkyboxSettings.h index a2a9593b0..f256e103e 100644 --- a/soh/soh/resource/type/scenecommand/SetSkyboxSettings.h +++ b/soh/soh/resource/type/scenecommand/SetSkyboxSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { uint8_t unk; uint8_t skyboxId; diff --git a/soh/soh/resource/type/scenecommand/SetSoundSettings.cpp b/soh/soh/resource/type/scenecommand/SetSoundSettings.cpp index f6f1941d1..c136d34db 100644 --- a/soh/soh/resource/type/scenecommand/SetSoundSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetSoundSettings.cpp @@ -1,6 +1,6 @@ #include "SetSoundSettings.h" -namespace LUS { +namespace SOH { SoundSettings* SetSoundSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ SoundSettings* SetSoundSettings::GetPointer() { size_t SetSoundSettings::GetPointerSize() { return sizeof(SoundSettings); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetSoundSettings.h b/soh/soh/resource/type/scenecommand/SetSoundSettings.h index c4ee4668d..b72c2b74d 100644 --- a/soh/soh/resource/type/scenecommand/SetSoundSettings.h +++ b/soh/soh/resource/type/scenecommand/SetSoundSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { uint8_t seqId; uint8_t natureAmbienceId; diff --git a/soh/soh/resource/type/scenecommand/SetSpecialObjects.cpp b/soh/soh/resource/type/scenecommand/SetSpecialObjects.cpp index 3887107da..304ab514c 100644 --- a/soh/soh/resource/type/scenecommand/SetSpecialObjects.cpp +++ b/soh/soh/resource/type/scenecommand/SetSpecialObjects.cpp @@ -1,6 +1,6 @@ #include "SetSpecialObjects.h" -namespace LUS { +namespace SOH { SpecialObjects* SetSpecialObjects::GetPointer() { return &specialObjects; } @@ -8,4 +8,4 @@ SpecialObjects* SetSpecialObjects::GetPointer() { size_t SetSpecialObjects::GetPointerSize() { return sizeof(SpecialObjects); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetSpecialObjects.h b/soh/soh/resource/type/scenecommand/SetSpecialObjects.h index 78cfcd425..2a8906461 100644 --- a/soh/soh/resource/type/scenecommand/SetSpecialObjects.h +++ b/soh/soh/resource/type/scenecommand/SetSpecialObjects.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { int8_t elfMessage; int16_t globalObject; diff --git a/soh/soh/resource/type/scenecommand/SetStartPositionList.cpp b/soh/soh/resource/type/scenecommand/SetStartPositionList.cpp index 89fb40049..5fa17b2a0 100644 --- a/soh/soh/resource/type/scenecommand/SetStartPositionList.cpp +++ b/soh/soh/resource/type/scenecommand/SetStartPositionList.cpp @@ -1,6 +1,6 @@ #include "SetStartPositionList.h" -namespace LUS { +namespace SOH { ActorEntry* SetStartPositionList::GetPointer() { return startPositions.data(); } @@ -8,4 +8,4 @@ ActorEntry* SetStartPositionList::GetPointer() { size_t SetStartPositionList::GetPointerSize() { return startPositions.size() * sizeof(ActorEntry); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetStartPositionList.h b/soh/soh/resource/type/scenecommand/SetStartPositionList.h index 1c5d4242f..28d2d0d31 100644 --- a/soh/soh/resource/type/scenecommand/SetStartPositionList.h +++ b/soh/soh/resource/type/scenecommand/SetStartPositionList.h @@ -9,7 +9,7 @@ #include "soh/resource/type/scenecommand/SetActorList.h" // #include -namespace LUS { +namespace SOH { // typedef struct { // /* 0x00 */ s16 id; // /* 0x02 */ Vec3s pos; diff --git a/soh/soh/resource/type/scenecommand/SetTimeSettings.cpp b/soh/soh/resource/type/scenecommand/SetTimeSettings.cpp index 9a10fb022..c9380a0a0 100644 --- a/soh/soh/resource/type/scenecommand/SetTimeSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetTimeSettings.cpp @@ -1,6 +1,6 @@ #include "SetTimeSettings.h" -namespace LUS { +namespace SOH { TimeSettings* SetTimeSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ TimeSettings* SetTimeSettings::GetPointer() { size_t SetTimeSettings::GetPointerSize() { return sizeof(TimeSettings); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetTimeSettings.h b/soh/soh/resource/type/scenecommand/SetTimeSettings.h index 637398652..cd47e33dc 100644 --- a/soh/soh/resource/type/scenecommand/SetTimeSettings.h +++ b/soh/soh/resource/type/scenecommand/SetTimeSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { uint8_t hour; uint8_t minute; diff --git a/soh/soh/resource/type/scenecommand/SetTransitionActorList.cpp b/soh/soh/resource/type/scenecommand/SetTransitionActorList.cpp index 86387e682..c944e99f2 100644 --- a/soh/soh/resource/type/scenecommand/SetTransitionActorList.cpp +++ b/soh/soh/resource/type/scenecommand/SetTransitionActorList.cpp @@ -1,6 +1,6 @@ #include "SetTransitionActorList.h" -namespace LUS { +namespace SOH { TransitionActorEntry* SetTransitionActorList::GetPointer() { return transitionActorList.data(); } @@ -8,4 +8,4 @@ TransitionActorEntry* SetTransitionActorList::GetPointer() { size_t SetTransitionActorList::GetPointerSize() { return transitionActorList.size() * sizeof(TransitionActorEntry); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetTransitionActorList.h b/soh/soh/resource/type/scenecommand/SetTransitionActorList.h index bb6fc2ac6..389526b0d 100644 --- a/soh/soh/resource/type/scenecommand/SetTransitionActorList.h +++ b/soh/soh/resource/type/scenecommand/SetTransitionActorList.h @@ -9,7 +9,7 @@ // #include #include "z64math.h" -namespace LUS { +namespace SOH { typedef struct { struct { s8 room; // Room to switch to diff --git a/soh/soh/resource/type/scenecommand/SetWindSettings.cpp b/soh/soh/resource/type/scenecommand/SetWindSettings.cpp index 3aa9ce7a6..64bc8ecc8 100644 --- a/soh/soh/resource/type/scenecommand/SetWindSettings.cpp +++ b/soh/soh/resource/type/scenecommand/SetWindSettings.cpp @@ -1,6 +1,6 @@ #include "SetWindSettings.h" -namespace LUS { +namespace SOH { WindSettings* SetWindSettings::GetPointer() { return &settings; } @@ -8,4 +8,4 @@ WindSettings* SetWindSettings::GetPointer() { size_t SetWindSettings::GetPointerSize() { return sizeof(WindSettings); } -} // namespace LUS +} // namespace SOH diff --git a/soh/soh/resource/type/scenecommand/SetWindSettings.h b/soh/soh/resource/type/scenecommand/SetWindSettings.h index e79b445ae..f3f9da968 100644 --- a/soh/soh/resource/type/scenecommand/SetWindSettings.h +++ b/soh/soh/resource/type/scenecommand/SetWindSettings.h @@ -7,7 +7,7 @@ #include "SceneCommand.h" #include -namespace LUS { +namespace SOH { typedef struct { int8_t windWest; int8_t windVertical; diff --git a/soh/soh/z_message_OTR.cpp b/soh/soh/z_message_OTR.cpp index ce594879a..05432fc53 100644 --- a/soh/soh/z_message_OTR.cpp +++ b/soh/soh/z_message_OTR.cpp @@ -15,7 +15,7 @@ extern "C" MessageTableEntry* sFraMessageEntryTablePtr; extern "C" MessageTableEntry* sStaffMessageEntryTablePtr; //extern "C" MessageTableEntry* _message_0xFFFC_nes; -static void SetMessageEntry(MessageTableEntry& entry, const LUS::MessageEntry& msgEntry) { +static void SetMessageEntry(MessageTableEntry& entry, const SOH::MessageEntry& msgEntry) { entry.textId = msgEntry.id; entry.typePos = (msgEntry.textboxType << 4) | msgEntry.textboxYPos; entry.segment = msgEntry.msg.c_str(); @@ -26,7 +26,7 @@ static void OTRMessage_LoadCustom(const std::string& folderPath, MessageTableEnt auto lst = *LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles(folderPath).get(); for (auto& tPath : lst) { - auto file = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(tPath)); + auto file = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(tPath)); for (size_t j = 0; j < file->messages.size(); ++j) { // Check if same text ID exists already @@ -43,7 +43,7 @@ static void OTRMessage_LoadCustom(const std::string& folderPath, MessageTableEnt } MessageTableEntry* OTRMessage_LoadTable(const std::string& filePath, bool isNES) { - auto file = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(filePath)); + auto file = std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource(filePath)); if (file == nullptr) return nullptr; @@ -120,7 +120,7 @@ extern "C" void OTRMessage_Init() if (sStaffMessageEntryTablePtr == NULL) { auto file2 = - std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource( + std::static_pointer_cast(LUS::Context::GetInstance()->GetResourceManager()->LoadResource( "text/staff_message_data_static/staff_message_data_static")); // OTRTODO: Should not be malloc'ing here. It's fine for now since we check that the message table is already null. sStaffMessageEntryTablePtr = (MessageTableEntry*)malloc(sizeof(MessageTableEntry) * file2->messages.size()); diff --git a/soh/soh/z_play_otr.cpp b/soh/soh/z_play_otr.cpp index 828380ea7..522a24eb8 100644 --- a/soh/soh/z_play_otr.cpp +++ b/soh/soh/z_play_otr.cpp @@ -10,7 +10,7 @@ extern "C" void Play_InitScene(PlayState * play, s32 spawn); extern "C" void Play_InitEnvironment(PlayState * play, s16 skyboxId); void OTRPlay_InitScene(PlayState* play, s32 spawn); -s32 OTRScene_ExecuteCommands(PlayState* play, LUS::Scene* scene); +s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene); //LUS::OTRResource* OTRPlay_LoadFile(PlayState* play, RomFile* file) { LUS::IResource* OTRPlay_LoadFile(PlayState* play, const char* fileName) @@ -75,7 +75,7 @@ void OTRPlay_InitScene(PlayState* play, s32 spawn) { func_80096FD4(play, &play->roomCtx.curRoom); YREG(15) = 0; gSaveContext.worldMapArea = 0; - OTRScene_ExecuteCommands(play, (LUS::Scene*)play->sceneSegment); + OTRScene_ExecuteCommands(play, (SOH::Scene*)play->sceneSegment); Play_InitEnvironment(play, play->skyboxId); // Unpause the timer for Boss Rush when the scene loaded isn't the Chamber of Sages. if (IS_BOSS_RUSH && play->sceneNum != SCENE_CHAMBER_OF_THE_SAGES) { diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index 8bfb13308..9367fa8db 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -37,7 +37,7 @@ extern LUS::IResource* OTRPlay_LoadFile(PlayState* play, const char* fileName); extern "C" s32 Object_Spawn(ObjectContext* objectCtx, s16 objectId); extern "C" RomFile sNaviMsgFiles[]; -s32 OTRScene_ExecuteCommands(PlayState* play, LUS::Scene* scene); +s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene); std::shared_ptr ResourceMgr_LoadFile(const char* path) { std::string Path = path; @@ -53,9 +53,9 @@ std::shared_ptr ResourceMgr_LoadFile(const char* path) { // Forward Declaration of function declared in OTRGlobals.cpp std::shared_ptr GetResourceByNameHandlingMQ(const char* path); -bool Scene_CommandSpawnList(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetStartPositionList* cmdStartPos = std::static_pointer_cast(cmd); - LUS::SetStartPositionList* cmdStartPos = (LUS::SetStartPositionList*)cmd; +bool Scene_CommandSpawnList(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetStartPositionList* cmdStartPos = std::static_pointer_cast(cmd); + SOH::SetStartPositionList* cmdStartPos = (SOH::SetStartPositionList*)cmd; ActorEntry* entries = (ActorEntry*)cmdStartPos->GetRawPointer(); play->linkActorEntry = &entries[play->setupEntranceList[play->curSpawn].spawn]; @@ -67,9 +67,9 @@ bool Scene_CommandSpawnList(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandActorList(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetActorList* cmdActor = std::static_pointer_cast(cmd); - LUS::SetActorList* cmdActor = (LUS::SetActorList*)cmd; +bool Scene_CommandActorList(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetActorList* cmdActor = std::static_pointer_cast(cmd); + SOH::SetActorList* cmdActor = (SOH::SetActorList*)cmd; play->numSetupActors = cmdActor->numActors; play->setupActorList = (ActorEntry*)cmdActor->GetRawPointer(); @@ -77,24 +77,24 @@ bool Scene_CommandActorList(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandUnused2(PlayState* play, LUS::ISceneCommand* cmd) { +bool Scene_CommandUnused2(PlayState* play, SOH::ISceneCommand* cmd) { // OTRTODO: Do we need to implement this? // play->unk_11DFC = SEGMENTED_TO_VIRTUAL(cmd->unused02.segment); return false; } -bool Scene_CommandCollisionHeader(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetCollisionHeader* cmdCol = std::static_pointer_cast(cmd); - LUS::SetCollisionHeader* cmdCol = (LUS::SetCollisionHeader*)cmd; +bool Scene_CommandCollisionHeader(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetCollisionHeader* cmdCol = std::static_pointer_cast(cmd); + SOH::SetCollisionHeader* cmdCol = (SOH::SetCollisionHeader*)cmd; BgCheck_Allocate(&play->colCtx, play, (CollisionHeader*)cmdCol->GetRawPointer()); return false; } -bool Scene_CommandRoomList(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetRoomList* cmdRoomList = std::static_pointer_cast(cmd); - LUS::SetRoomList* cmdRoomList = (LUS::SetRoomList*)cmd; +bool Scene_CommandRoomList(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetRoomList* cmdRoomList = std::static_pointer_cast(cmd); + SOH::SetRoomList* cmdRoomList = (SOH::SetRoomList*)cmd; play->numRooms = cmdRoomList->numRooms; play->roomList = (RomFile*)cmdRoomList->GetRawPointer(); @@ -102,17 +102,17 @@ bool Scene_CommandRoomList(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandEntranceList(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetEntranceList* otrEntrance = std::static_pointer_cast(cmd); - LUS::SetEntranceList* otrEntrance = (LUS::SetEntranceList*)cmd; +bool Scene_CommandEntranceList(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetEntranceList* otrEntrance = std::static_pointer_cast(cmd); + SOH::SetEntranceList* otrEntrance = (SOH::SetEntranceList*)cmd; play->setupEntranceList = (EntranceEntry*)otrEntrance->GetRawPointer(); return false; } -bool Scene_CommandSpecialFiles(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetSpecialObjects* specialCmd = std::static_pointer_cast(cmd); - LUS::SetSpecialObjects* specialCmd = (LUS::SetSpecialObjects*)cmd; +bool Scene_CommandSpecialFiles(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetSpecialObjects* specialCmd = std::static_pointer_cast(cmd); + SOH::SetSpecialObjects* specialCmd = (SOH::SetSpecialObjects*)cmd; if (specialCmd->specialObjects.globalObject != 0) { play->objectCtx.subKeepIndex = Object_Spawn(&play->objectCtx, specialCmd->specialObjects.globalObject); @@ -127,9 +127,9 @@ bool Scene_CommandSpecialFiles(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandRoomBehavior(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetRoomBehavior* cmdRoom = std::static_pointer_cast(cmd); - LUS::SetRoomBehavior* cmdRoom = (LUS::SetRoomBehavior*)cmd; +bool Scene_CommandRoomBehavior(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetRoomBehavior* cmdRoom = std::static_pointer_cast(cmd); + SOH::SetRoomBehavior* cmdRoom = (SOH::SetRoomBehavior*)cmd; play->roomCtx.curRoom.behaviorType1 = cmdRoom->roomBehavior.gameplayFlags; play->roomCtx.curRoom.behaviorType2 = cmdRoom->roomBehavior.gameplayFlags2 & 0xFF; @@ -139,9 +139,9 @@ bool Scene_CommandRoomBehavior(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandMeshHeader(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetMesh* otrMesh = static_pointer_cast(cmd); - LUS::SetMesh* otrMesh = (LUS::SetMesh*)cmd; +bool Scene_CommandMeshHeader(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetMesh* otrMesh = static_pointer_cast(cmd); + SOH::SetMesh* otrMesh = (SOH::SetMesh*)cmd; play->roomCtx.curRoom.meshHeader = (MeshHeader*)otrMesh->GetRawPointer(); return false; @@ -156,9 +156,9 @@ bool OTRfunc_800982FC(ObjectContext* objectCtx, s32 bankIndex, s16 objectId) { return false; } -bool Scene_CommandObjectList(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetObjectList* cmdObj = static_pointer_cast(cmd); - LUS::SetObjectList* cmdObj = (LUS::SetObjectList*)cmd; +bool Scene_CommandObjectList(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetObjectList* cmdObj = static_pointer_cast(cmd); + SOH::SetObjectList* cmdObj = (SOH::SetObjectList*)cmd; s32 i; s32 j; @@ -199,9 +199,9 @@ bool Scene_CommandObjectList(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandLightList(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetLightList* cmdLight = static_pointer_cast(cmd); - LUS::SetLightList* cmdLight = (LUS::SetLightList*)cmd; +bool Scene_CommandLightList(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetLightList* cmdLight = static_pointer_cast(cmd); + SOH::SetLightList* cmdLight = (SOH::SetLightList*)cmd; for (size_t i = 0; i < cmdLight->lightList.size(); i++) { LightContext_InsertLight(play, &play->lightCtx, (LightInfo*)&cmdLight->lightList[i]); @@ -210,17 +210,17 @@ bool Scene_CommandLightList(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandPathList(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetPathways* cmdPath = static_pointer_cast(cmd); - LUS::SetPathways* cmdPath = (LUS::SetPathways*)cmd; +bool Scene_CommandPathList(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetPathways* cmdPath = static_pointer_cast(cmd); + SOH::SetPathways* cmdPath = (SOH::SetPathways*)cmd; play->setupPathList = (Path*)(cmdPath->GetPointer()[0]); return false; } -bool Scene_CommandTransitionActorList(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetTransitionActorList* cmdActor = static_pointer_cast(cmd); - LUS::SetTransitionActorList* cmdActor = (LUS::SetTransitionActorList*)cmd; +bool Scene_CommandTransitionActorList(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetTransitionActorList* cmdActor = static_pointer_cast(cmd); + SOH::SetTransitionActorList* cmdActor = (SOH::SetTransitionActorList*)cmd; play->transiActorCtx.numActors = cmdActor->numTransitionActors; play->transiActorCtx.list = (TransitionActorEntry*)cmdActor->GetRawPointer(); @@ -232,16 +232,16 @@ bool Scene_CommandTransitionActorList(PlayState* play, LUS::ISceneCommand* cmd) // transiActorCtx->numActors = 0; //} -bool Scene_CommandLightSettingsList(PlayState* play, LUS::ISceneCommand* cmd) { +bool Scene_CommandLightSettingsList(PlayState* play, SOH::ISceneCommand* cmd) { play->envCtx.lightSettingsList = (EnvLightSettings*)cmd->GetRawPointer(); return false; } // Scene Command 0x11: Skybox Settings -bool Scene_CommandSkyboxSettings(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetSkyboxSettings* cmdSky = static_pointer_cast(cmd); - LUS::SetSkyboxSettings* cmdSky = (LUS::SetSkyboxSettings*)cmd; +bool Scene_CommandSkyboxSettings(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetSkyboxSettings* cmdSky = static_pointer_cast(cmd); + SOH::SetSkyboxSettings* cmdSky = (SOH::SetSkyboxSettings*)cmd; play->skyboxId = cmdSky->settings.skyboxId; play->envCtx.unk_17 = play->envCtx.unk_18 = cmdSky->settings.weather; @@ -250,9 +250,9 @@ bool Scene_CommandSkyboxSettings(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandSkyboxDisables(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetSkyboxModifier* cmdSky = static_pointer_cast(cmd); - LUS::SetSkyboxModifier* cmdSky = (LUS::SetSkyboxModifier*)cmd; +bool Scene_CommandSkyboxDisables(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetSkyboxModifier* cmdSky = static_pointer_cast(cmd); + SOH::SetSkyboxModifier* cmdSky = (SOH::SetSkyboxModifier*)cmd; play->envCtx.sunMoonDisabled = cmdSky->modifier.sunMoonDisabled; play->envCtx.skyboxDisabled = cmdSky->modifier.skyboxDisabled; @@ -260,9 +260,9 @@ bool Scene_CommandSkyboxDisables(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandTimeSettings(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetTimeSettings* cmdTime = static_pointer_cast(cmd); - LUS::SetTimeSettings* cmdTime = (LUS::SetTimeSettings*)cmd; +bool Scene_CommandTimeSettings(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetTimeSettings* cmdTime = static_pointer_cast(cmd); + SOH::SetTimeSettings* cmdTime = (SOH::SetTimeSettings*)cmd; if ((cmdTime->settings.hour != 0xFF) && (cmdTime->settings.minute != 0xFF)) { gSaveContext.skyboxTime = gSaveContext.dayTime = @@ -300,9 +300,9 @@ bool Scene_CommandTimeSettings(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandWindSettings(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetWind* cmdWind = std::static_pointer_cast(cmd); - LUS::SetWindSettings* cmdWind = (LUS::SetWindSettings*)cmd; +bool Scene_CommandWindSettings(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetWind* cmdWind = std::static_pointer_cast(cmd); + SOH::SetWindSettings* cmdWind = (SOH::SetWindSettings*)cmd; play->envCtx.windDirection.x = cmdWind->settings.windWest; play->envCtx.windDirection.y = cmdWind->settings.windVertical; @@ -313,19 +313,19 @@ bool Scene_CommandWindSettings(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandExitList(PlayState* play, LUS::ISceneCommand* cmd) { +bool Scene_CommandExitList(PlayState* play, SOH::ISceneCommand* cmd) { play->setupExitList = (s16*)cmd->GetRawPointer(); return false; } -bool Scene_CommandUndefined9(PlayState* play, LUS::ISceneCommand* cmd) { +bool Scene_CommandUndefined9(PlayState* play, SOH::ISceneCommand* cmd) { return false; } -bool Scene_CommandSoundSettings(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetSoundSettings* cmdSnd = static_pointer_cast(cmd); - LUS::SetSoundSettings* cmdSnd = (LUS::SetSoundSettings*)cmd; +bool Scene_CommandSoundSettings(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetSoundSettings* cmdSnd = static_pointer_cast(cmd); + SOH::SetSoundSettings* cmdSnd = (SOH::SetSoundSettings*)cmd; play->sequenceCtx.seqId = cmdSnd->settings.seqId; play->sequenceCtx.natureAmbienceId = cmdSnd->settings.natureAmbienceId; @@ -337,18 +337,18 @@ bool Scene_CommandSoundSettings(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool Scene_CommandEchoSettings(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetEchoSettings* cmdEcho = static_pointer_cast(cmd); - LUS::SetEchoSettings* cmdEcho = (LUS::SetEchoSettings*)cmd; +bool Scene_CommandEchoSettings(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetEchoSettings* cmdEcho = static_pointer_cast(cmd); + SOH::SetEchoSettings* cmdEcho = (SOH::SetEchoSettings*)cmd; play->roomCtx.curRoom.echo = cmdEcho->settings.echo; return false; } -bool Scene_CommandAlternateHeaderList(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetAlternateHeaders* cmdHeaders = static_pointer_cast(cmd); - LUS::SetAlternateHeaders* cmdHeaders = (LUS::SetAlternateHeaders*)cmd; +bool Scene_CommandAlternateHeaderList(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetAlternateHeaders* cmdHeaders = static_pointer_cast(cmd); + SOH::SetAlternateHeaders* cmdHeaders = (SOH::SetAlternateHeaders*)cmd; // s32 pad; // SceneCmd* altHeader; @@ -358,8 +358,8 @@ bool Scene_CommandAlternateHeaderList(PlayState* play, LUS::ISceneCommand* cmd) // osSyncPrintf("\n[ZU]sceneset counter=[%X]", ((void)0, gSaveContext.sceneSetupIndex)); if (gSaveContext.sceneSetupIndex != 0) { - LUS::Scene* desiredHeader = - std::static_pointer_cast(cmdHeaders->headers[gSaveContext.sceneSetupIndex - 1]).get(); + SOH::Scene* desiredHeader = + std::static_pointer_cast(cmdHeaders->headers[gSaveContext.sceneSetupIndex - 1]).get(); if (desiredHeader != nullptr) { OTRScene_ExecuteCommands(play, desiredHeader); @@ -369,8 +369,8 @@ bool Scene_CommandAlternateHeaderList(PlayState* play, LUS::ISceneCommand* cmd) osSyncPrintf("\nげぼはっ! 指定されたデータがないでええっす!"); if (gSaveContext.sceneSetupIndex == 3) { - LUS::Scene* desiredHeader = - std::static_pointer_cast(cmdHeaders->headers[gSaveContext.sceneSetupIndex - 2]).get(); + SOH::Scene* desiredHeader = + std::static_pointer_cast(cmdHeaders->headers[gSaveContext.sceneSetupIndex - 2]).get(); // "Using adult day data there!" osSyncPrintf("\nそこで、大人の昼データを使用するでええっす!!"); @@ -385,9 +385,9 @@ bool Scene_CommandAlternateHeaderList(PlayState* play, LUS::ISceneCommand* cmd) return false; } -bool Scene_CommandCutsceneData(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetCutscenes* cmdCS = std::static_pointer_cast(cmd); - LUS::SetCutscenes* cmdCS = (LUS::SetCutscenes*)cmd; +bool Scene_CommandCutsceneData(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetCutscenes* cmdCS = std::static_pointer_cast(cmd); + SOH::SetCutscenes* cmdCS = (SOH::SetCutscenes*)cmd; play->csCtx.segment = cmdCS->cutscene->commands.data(); @@ -396,9 +396,9 @@ bool Scene_CommandCutsceneData(PlayState* play, LUS::ISceneCommand* cmd) { } // Camera & World Map Area -bool Scene_CommandMiscSettings(PlayState* play, LUS::ISceneCommand* cmd) { - // LUS::SetCameraSettings* cmdCam = std::static_pointer_cast(cmd); - LUS::SetCameraSettings* cmdCam = (LUS::SetCameraSettings*)cmd; +bool Scene_CommandMiscSettings(PlayState* play, SOH::ISceneCommand* cmd) { + // SOH::SetCameraSettings* cmdCam = std::static_pointer_cast(cmd); + SOH::SetCameraSettings* cmdCam = (SOH::SetCameraSettings*)cmd; YREG(15) = cmdCam->settings.cameraMovement; gSaveContext.worldMapArea = cmdCam->settings.worldMapArea; @@ -420,7 +420,7 @@ bool Scene_CommandMiscSettings(PlayState* play, LUS::ISceneCommand* cmd) { return false; } -bool (*sceneCommands[])(PlayState*, LUS::ISceneCommand*) = { +bool (*sceneCommands[])(PlayState*, SOH::ISceneCommand*) = { Scene_CommandSpawnList, // SCENE_CMD_ID_SPAWN_LIST Scene_CommandActorList, // SCENE_CMD_ID_ACTOR_LIST Scene_CommandUnused2, // SCENE_CMD_ID_UNUSED_2 @@ -449,8 +449,8 @@ bool (*sceneCommands[])(PlayState*, LUS::ISceneCommand*) = { Scene_CommandMiscSettings, // SCENE_CMD_ID_MISC_SETTINGS }; -s32 OTRScene_ExecuteCommands(PlayState* play, LUS::Scene* scene) { - LUS::SceneCommandID cmdCode; +s32 OTRScene_ExecuteCommands(PlayState* play, SOH::Scene* scene) { + SOH::SceneCommandID cmdCode; for (int i = 0; i < scene->commands.size(); i++) { auto sceneCmd = scene->commands[i]; @@ -487,7 +487,7 @@ extern "C" s32 OTRfunc_800973FC(PlayState* play, RoomContext* roomCtx) { roomCtx->curRoom.segment = roomCtx->unk_34; gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->unk_34); - OTRScene_ExecuteCommands(play, (LUS::Scene*)roomCtx->roomToLoad); + OTRScene_ExecuteCommands(play, (SOH::Scene*)roomCtx->roomToLoad); Player_SetBootData(play, GET_PLAYER(play)); Actor_SpawnTransitionActors(play, &play->actorCtx); @@ -523,7 +523,7 @@ extern "C" s32 OTRfunc_8009728C(PlayState* play, RoomContext* roomCtx, s32 roomN //&roomCtx->loadQueue, NULL, __FILE__, __LINE__); auto roomData = - std::static_pointer_cast(GetResourceByNameHandlingMQ(play->roomList[roomNum].fileName)); + std::static_pointer_cast(GetResourceByNameHandlingMQ(play->roomList[roomNum].fileName)); roomCtx->status = 1; roomCtx->roomToLoad = roomData.get(); From a8d3724a53f57c501612b39c2c5291323ece9814 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Thu, 15 Feb 2024 21:28:06 -0600 Subject: [PATCH 37/44] Add missing cvars mostly that patrick forgot because he likes ranch dressing but also some that I missed oops (#3944) --- soh/soh/Enhancements/presets.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index d16e343e1..d25d92780 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -260,6 +260,22 @@ const std::vector enhancementsCvars = { "gAddTraps.Tele", "gAddTraps.Void", "gToTMedallionsColors", + "gCuccoStayDurationMultiplier", + "gDeleteFileOnDeath", + "gEnemySizeScalesHealth", + "gEnhancements.BetterAmmoRendering", + "gEnhancements.EquimentAlwaysVisible", + "gEnhancements.FixDaruniaDanceSpeed", + "gEnhancements.OpenAllHours", + "gEnhancements.ResetNaviTimer", + "gEnhancements.ScaleAdultEquimentAsChild", + "gEnhancements.SwordToggle", + "gFixZoraHintDialogue", + "gHurtContainer", + "gPauseWarp", + "gPermanentHeartLoss", + "gRemoveExplosiveLimit", + "gToggleStrength", }; const std::vector cheatCvars = { From 45992125463a648997159b77517c8a2f4d1fd246 Mon Sep 17 00:00:00 2001 From: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Date: Thu, 15 Feb 2024 23:02:58 -0500 Subject: [PATCH 38/44] [Fixes] Fix Raised Floor Switches (#3851) * Lower by 1 * gEnhancements. * Update z_obj_switch.c Co-authored-by: Archez * Moved to Hook * Properly this time * Added to presets * Added a Return; * Use Hex Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> --------- Co-authored-by: Archez Co-authored-by: inspectredc <78732756+inspectredc@users.noreply.github.com> Co-authored-by: Garrett Cox --- soh/soh/Enhancements/mods.cpp | 19 +++++++++++++++++++ soh/soh/Enhancements/presets.h | 7 +++++++ soh/soh/SohMenuBar.cpp | 3 +++ 3 files changed, 29 insertions(+) diff --git a/soh/soh/Enhancements/mods.cpp b/soh/soh/Enhancements/mods.cpp index 4788fb4f5..d1147f5fc 100644 --- a/soh/soh/Enhancements/mods.cpp +++ b/soh/soh/Enhancements/mods.cpp @@ -23,6 +23,7 @@ #include "src/overlays/actors/ovl_En_Tp/z_en_tp.h" #include "src/overlays/actors/ovl_En_Firefly/z_en_firefly.h" #include "src/overlays/actors/ovl_En_Xc/z_en_xc.h" +#include "src/overlays/actors/ovl_Obj_Switch/z_obj_switch.h" #include "objects/object_link_boy/object_link_boy.h" #include "objects/object_link_child/object_link_child.h" @@ -1359,6 +1360,23 @@ void RegisterToTMedallions() { }); } + +void RegisterFloorSwitchesHook() { + GameInteractor::Instance->RegisterGameHook([](void* refActor) { + Actor* actor = static_cast(refActor); + if (actor->id != ACTOR_OBJ_SWITCH || !CVarGetInteger("gEnhancements.FixFloorSwitches", 0)) { + return; + } + + ObjSwitch* switchActor = reinterpret_cast(actor); + s32 type = (switchActor->dyna.actor.params & 7); + + if (switchActor->dyna.actor.params == 0x1200 || switchActor->dyna.actor.params == 0x3A00) { + switchActor->dyna.actor.world.pos.y -= 1; + } + }); +} + void RegisterPauseMenuHooks() { static bool pauseWarpHooksRegistered = false; GameInteractor::Instance->RegisterGameHook([&]() { @@ -1411,6 +1429,7 @@ void InitMods() { RegisterOpenAllHours(); RegisterToTMedallions(); NameTag_RegisterHooks(); + RegisterFloorSwitchesHook(); RegisterPatchHandHandler(); RegisterHurtContainerModeHandler(); RegisterPauseMenuHooks(); diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index d25d92780..025581b0d 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -270,6 +270,7 @@ const std::vector enhancementsCvars = { "gEnhancements.ResetNaviTimer", "gEnhancements.ScaleAdultEquimentAsChild", "gEnhancements.SwordToggle", + "gEnhancements.FixFloorSwitches", "gFixZoraHintDialogue", "gHurtContainer", "gPauseWarp", @@ -543,6 +544,8 @@ const std::vector vanillaPlusPresetEntries = { PRESET_ENTRY_S32("gNaviTextFix", 1), // Extend Silver Rupee Jingle PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1), + // Fix some Floor Switches + PRESET_ENTRY_S32("gEnhancements.FixFloorSwitches", 1), // Red Ganon blood PRESET_ENTRY_S32("gRedGanonBlood", 1), @@ -614,6 +617,8 @@ const std::vector enhancedPresetEntries = { PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1), // Fix enemies not spawning on ground over water PRESET_ENTRY_S32("gEnemySpawnsOverWaterboxes", 1), + // Fix some Floor Switches + PRESET_ENTRY_S32("gEnhancements.FixFloorSwitches", 1), // Red Ganon blood PRESET_ENTRY_S32("gRedGanonBlood", 1), @@ -736,6 +741,8 @@ const std::vector randomizerPresetEntries = { PRESET_ENTRY_S32("gNaviTextFix", 1), // Extend Silver Rupee Jingle PRESET_ENTRY_S32("gSilverRupeeJingleExtend", 1), + // Fix some Floor Switches + PRESET_ENTRY_S32("gEnhancements.FixFloorSwitches", 1), // Red Ganon blood PRESET_ENTRY_S32("gRedGanonBlood", 1), diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index 96d99fbb1..a3f91b145 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -1252,6 +1252,9 @@ void DrawEnhancementsMenu() { UIWidgets::PaddedEnhancementCheckbox("Fix Darunia dancing too fast", "gEnhancements.FixDaruniaDanceSpeed", true, false, false, "", UIWidgets::CheckboxGraphics::Cross, true); UIWidgets::Tooltip("Fixes Darunia's dancing speed so he dances to the beat of Saria's Song, like in vanilla."); + UIWidgets::PaddedEnhancementCheckbox("Fix raised Floor Switches", "gEnhancements.FixFloorSwitches", true, false); + UIWidgets::Tooltip("Fixes the two raised floor switches, the one in Forest Temple Basement and the one at the top of Fire Temple. \n" + "This will lower them, making activating them easier"); UIWidgets::PaddedEnhancementCheckbox("Fix Zora hint dialogue", "gFixZoraHintDialogue", true, false); UIWidgets::Tooltip("Fixes one Zora's dialogue giving a hint about bringing Ruto's Letter to King Zora to properly occur before moving King Zora rather than after"); From c484ea227b8bb2e8343485dbe041c47b1f2f4a2e Mon Sep 17 00:00:00 2001 From: Patrick12115 <115201185+Patrick12115@users.noreply.github.com> Date: Thu, 15 Feb 2024 23:12:09 -0500 Subject: [PATCH 39/44] [Difficulty Options] Leever Spawn Rate (#3460) * Spawn Rate * Update z_en_reeba.c Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> * gEnhancements * Merging issues * Added preset entry and changed timer value math * Update soh/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c * this should do it * Update soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c * move out of loop --------- Co-authored-by: briaguya <70942617+briaguya-ai@users.noreply.github.com> Co-authored-by: Garrett Cox --- soh/soh/Enhancements/presets.h | 1 + soh/soh/SohMenuBar.cpp | 2 ++ soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/soh/soh/Enhancements/presets.h b/soh/soh/Enhancements/presets.h index 025581b0d..3fede1e9b 100644 --- a/soh/soh/Enhancements/presets.h +++ b/soh/soh/Enhancements/presets.h @@ -269,6 +269,7 @@ const std::vector enhancementsCvars = { "gEnhancements.OpenAllHours", "gEnhancements.ResetNaviTimer", "gEnhancements.ScaleAdultEquimentAsChild", + "gEnhancements.LeeverSpawnRate", "gEnhancements.SwordToggle", "gEnhancements.FixFloorSwitches", "gFixZoraHintDialogue", diff --git a/soh/soh/SohMenuBar.cpp b/soh/soh/SohMenuBar.cpp index a3f91b145..3ba5030f3 100644 --- a/soh/soh/SohMenuBar.cpp +++ b/soh/soh/SohMenuBar.cpp @@ -977,6 +977,8 @@ void DrawEnhancementsMenu() { UIWidgets::Tooltip("All dogs can be traded in and will count as Richard."); UIWidgets::PaddedEnhancementSliderInt("Cuccos Stay Put Multiplier: %dx", "##CuccoStayDurationMultiplier", "gCuccoStayDurationMultiplier", 1, 5, "", 1, true, true, false); UIWidgets::Tooltip("Cuccos will stay in place longer after putting them down, by a multiple of the value of the slider."); + UIWidgets::PaddedEnhancementSliderInt("Leever Spawn Rate: %d seconds", "##LeeverSpawnRate", "gEnhancements.LeeverSpawnRate", 0, 10, "", 0, true, true, false); + UIWidgets::Tooltip("The time between leever groups spawning."); ImGui::EndMenu(); } diff --git a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index a43dd8679..146f0deaa 100644 --- a/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/soh/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -169,6 +169,10 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, PlayState* play) { break; } } + int32_t modifiedSpawnRate = CVarGetInteger("gEnhancements.LeeverSpawnRate", 0); + if (modifiedSpawnRate) { + this->timer = 20 * modifiedSpawnRate; + } } } } From d0b09743b9b9eef10ec7d102b78483e352dd7795 Mon Sep 17 00:00:00 2001 From: Archez Date: Thu, 15 Feb 2024 23:25:16 -0500 Subject: [PATCH 40/44] Fix missing ImGui::EndDisabled (#3946) --- soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index 72ad74e19..4f04bc64b 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -1412,6 +1412,7 @@ void DrawSillyTab() { CVarSetInteger("gCosmetics.Kak_Windmill_Speed.Changed", 1); } Reset_Option_Double("Reset##Kak_Windmill_Speed", "gCosmetics.Kak_Windmill_Speed"); + ImGui::EndDisabled(); } // Copies the RGB values from one cosmetic option to another, multiplied by the passed in amount, this From 19af4481c08d44fe4bff85eb4662bfb559c4dbfb Mon Sep 17 00:00:00 2001 From: Archez Date: Tue, 20 Feb 2024 09:31:24 -0500 Subject: [PATCH 41/44] fix object unload using wrong index (#3949) --- soh/soh/z_scene_otr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/z_scene_otr.cpp b/soh/soh/z_scene_otr.cpp index 33104326e..be1840ecd 100644 --- a/soh/soh/z_scene_otr.cpp +++ b/soh/soh/z_scene_otr.cpp @@ -178,7 +178,7 @@ bool Scene_CommandObjectList(PlayState* play, LUS::ISceneCommand* cmd) { // Loop until a mismatch in the object lists // Then clear all object ids past that in the context object list and kill actors for those objects for (i = play->objectCtx.unk_09, k = 0; i < play->objectCtx.num; i++, k++) { - if (i >= cmdObj->objects.size() || play->objectCtx.status[i].id != cmdObj->objects[k]) { + if (k >= cmdObj->objects.size() || play->objectCtx.status[i].id != cmdObj->objects[k]) { for (j = i; j < play->objectCtx.num; j++) { play->objectCtx.status[j].id = OBJECT_INVALID; } From ef9fc0a9ec8716201dfaeb2d28d059171a066b7a Mon Sep 17 00:00:00 2001 From: Archez Date: Tue, 20 Feb 2024 09:38:10 -0500 Subject: [PATCH 42/44] fix endianess issue with camera setting data (#3950) --- soh/src/code/z_camera_data.inc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/soh/src/code/z_camera_data.inc b/soh/src/code/z_camera_data.inc index b9e0ba864..90b1874c7 100644 --- a/soh/src/code/z_camera_data.inc +++ b/soh/src/code/z_camera_data.inc @@ -16,9 +16,11 @@ typedef struct { union { u32 unk_00; struct { - u32 unk_bit0 : 1; - u32 unk_bit1 : 1; - u32 validModes : 30; + // SoH [Port] These bitfield values are unused and led to shifting in validModes for little endian systems + // Removing those so that validModes can be a complete 32 bit value + // u32 unk_bit0 : 1; + // u32 unk_bit1 : 1; + u32 validModes; }; }; CameraMode* cameraModes; From cd25f1d3c1fcecd574e6a4019c6f9cc41260ff1c Mon Sep 17 00:00:00 2001 From: Archez Date: Wed, 21 Feb 2024 00:20:25 -0500 Subject: [PATCH 43/44] Fix performance of dlist viewer (#3961) --- soh/soh/Enhancements/debugger/dlViewer.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/soh/soh/Enhancements/debugger/dlViewer.cpp b/soh/soh/Enhancements/debugger/dlViewer.cpp index da44a908a..028234fc1 100644 --- a/soh/soh/Enhancements/debugger/dlViewer.cpp +++ b/soh/soh/Enhancements/debugger/dlViewer.cpp @@ -9,7 +9,6 @@ #include #include #include -#include #include #include "dlViewer.h" @@ -68,14 +67,12 @@ std::map cmdMap = { void PerformDisplayListSearch() { auto result = LUS::Context::GetInstance()->GetResourceManager()->GetArchiveManager()->ListFiles("*" + std::string(searchString) + "*DL*"); - std::regex dlSearch(".*((DL)|(DL_.*))$"); - displayListSearchResults.clear(); // Filter the file results even further as StormLib can only use wildcard searching for (size_t i = 0; i < result->size(); i++) { std::string val = result->at(i); - if (std::regex_search(val.c_str(), dlSearch)) { + if (val.ends_with("DL") || val.find("DL_") != std::string::npos) { displayListSearchResults.push_back(val); } } @@ -99,8 +96,6 @@ void DLViewerWindow::DrawElement() { return; } - ImGui::Text("%d", searchDebounceFrames); - // Debounce the search field as listing otr files is expensive if (ImGui::InputText("Search Display Lists", searchString, ARRAY_COUNT(searchString))) { doSearch = true; From bcbe4cb1c35798cc1017844fc453de8ab8bfc6f1 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Wed, 21 Feb 2024 00:21:26 -0500 Subject: [PATCH 44/44] we crash if we try to SPDLOG in the destructors (#3951) * we crash if we try to SPDLOG in the destructors * rip em out * newline * add to destroy * Revert "rip em out" This reverts commit 738a9b80f327fe728e176d63ab2d54a36fb908ad. * Revert "we crash if we try to SPDLOG in the destructors" This reverts commit 327d305e00ab9cb05ca93c5566a06ae9a345d329. --- soh/soh/Enhancements/controls/InputViewer.h | 2 +- soh/soh/SohGui.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/controls/InputViewer.h b/soh/soh/Enhancements/controls/InputViewer.h index 646c15d9d..6f2e2c587 100644 --- a/soh/soh/Enhancements/controls/InputViewer.h +++ b/soh/soh/Enhancements/controls/InputViewer.h @@ -44,4 +44,4 @@ public: ~InputViewerSettingsWindow(); void Draw(); -}; \ No newline at end of file +}; diff --git a/soh/soh/SohGui.cpp b/soh/soh/SohGui.cpp index 4cb43d3a8..bbc12b1a1 100644 --- a/soh/soh/SohGui.cpp +++ b/soh/soh/SohGui.cpp @@ -224,5 +224,7 @@ namespace SohGui { mStatsWindow = nullptr; mConsoleWindow = nullptr; mSohMenuBar = nullptr; + mInputViewer = nullptr; + mInputViewerSettings = nullptr; } }