diff --git a/Jenkinsfile b/Jenkinsfile index 2eb840966..6e8d0d2e1 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,6 +8,9 @@ pipeline { stages { stage ('Build Windows') { + options { + timeout(time: 20) + } environment { MSBUILD='C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\Msbuild\\Current\\Bin\\msbuild.exe' CONFIG='Release' @@ -71,6 +74,9 @@ pipeline { } } stage ('Build Linux') { + options { + timeout(time: 20) + } agent { label "SoH-Linux-Builders" } diff --git a/OTRExporter/OTRExporter/AudioExporter.cpp b/OTRExporter/OTRExporter/AudioExporter.cpp index e2756007b..fb06708f1 100644 --- a/OTRExporter/OTRExporter/AudioExporter.cpp +++ b/OTRExporter/OTRExporter/AudioExporter.cpp @@ -45,14 +45,14 @@ void OTRExporter_Audio::WriteSampleEntry(SampleEntry* entry, BinaryWriter* write writer->Write((uint32_t)(entry->loop.count)); writer->Write((uint32_t)entry->loop.states.size()); - for (int i = 0; i < entry->loop.states.size(); i++) + for (size_t i = 0; i < entry->loop.states.size(); i++) writer->Write((entry->loop.states[i])); writer->Write((uint32_t)(entry->book.order)); writer->Write((uint32_t)(entry->book.npredictors)); writer->Write((uint32_t)entry->book.books.size()); - for (int i = 0; i < entry->book.books.size(); i++) + for (size_t i = 0; i < entry->book.books.size(); i++) writer->Write((entry->book.books[i])); } @@ -128,7 +128,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit fntWriter.Write((uint32_t)audio->soundFontTable[i].instruments.size()); fntWriter.Write((uint32_t)audio->soundFontTable[i].soundEffects.size()); - for (int k = 0; k < audio->soundFontTable[i].drums.size(); k++) + for (size_t k = 0; k < audio->soundFontTable[i].drums.size(); k++) { fntWriter.Write(audio->soundFontTable[i].drums[k].releaseRate); fntWriter.Write(audio->soundFontTable[i].drums[k].pan); @@ -140,7 +140,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit fntWriter.Write(audio->soundFontTable[i].drums[k].tuning); } - for (int k = 0; k < audio->soundFontTable[i].instruments.size(); k++) + for (size_t k = 0; k < audio->soundFontTable[i].instruments.size(); k++) { fntWriter.Write((uint8_t)audio->soundFontTable[i].instruments[k].isValidInstrument); @@ -156,7 +156,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit WriteSoundFontEntry(audio, audio->soundFontTable[i].instruments[k].highNotesSound, audio->samples, &fntWriter); } - for (int k = 0; k < audio->soundFontTable[i].soundEffects.size(); k++) + for (size_t k = 0; k < audio->soundFontTable[i].soundEffects.size(); k++) { WriteSoundFontEntry(audio, audio->soundFontTable[i].soundEffects[k], audio->samples, &fntWriter); } @@ -167,7 +167,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit } // Write Sequences - for (int i = 0; i < audio->sequences.size(); i++) + for (size_t i = 0; i < audio->sequences.size(); i++) { auto seq = audio->sequences[i]; @@ -183,7 +183,7 @@ void OTRExporter_Audio::Save(ZResource* res, const fs::path& outPath, BinaryWrit seqWriter.Write((uint8_t)audio->sequenceTable[i].cachePolicy); seqWriter.Write((uint32_t)audio->fontIndices[i].size()); - for (int k = 0; k < audio->fontIndices[i].size(); k++) + for (size_t k = 0; k < audio->fontIndices[i].size(); k++) seqWriter.Write((uint8_t)audio->fontIndices[i][k]); std::string fName = OTRExporter_DisplayList::GetPathToRes(res, StringHelper::Sprintf("sequences/%s", audio->seqNames[i].c_str())); diff --git a/StormLib/src/SFileListFile.cpp b/StormLib/src/SFileListFile.cpp index 01a6e0a72..0a53e4b1a 100644 --- a/StormLib/src/SFileListFile.cpp +++ b/StormLib/src/SFileListFile.cpp @@ -684,3 +684,4 @@ bool WINAPI SListFileFindClose(HANDLE hFind) return FreeListFileCache(pCache); } + diff --git a/StormLib/src/StormCommon.h b/StormLib/src/StormCommon.h index 14b5e37a1..c23505038 100644 --- a/StormLib/src/StormCommon.h +++ b/StormLib/src/StormCommon.h @@ -438,3 +438,4 @@ void DumpFileTable(TFileEntry * pFileTable, DWORD dwFileTableSize); #endif #endif // __STORMCOMMON_H__ + diff --git a/ZAPDTR/ZAPD/ZAudio.cpp b/ZAPDTR/ZAPD/ZAudio.cpp index 0fa356e1f..50bb181f2 100644 --- a/ZAPDTR/ZAPD/ZAudio.cpp +++ b/ZAPDTR/ZAPD/ZAudio.cpp @@ -344,6 +344,7 @@ void ZAudio::ParseRawData() //int gSequenceTableOffset = 0x1386A0; //int gSampleBankTableOffset = 0x138D90; //int gSequenceFontTableOffset = 0x1384E0; + // NTSC 1.0 //int gSoundFontTableOffset = 0x1026A0; //int gSequenceTableOffset = 0x102AD0; diff --git a/libultraship/libultraship/Audio.h b/libultraship/libultraship/Audio.h index dd84f5d41..a63035e50 100644 --- a/libultraship/libultraship/Audio.h +++ b/libultraship/libultraship/Audio.h @@ -128,4 +128,4 @@ namespace Ship { public: }; -} \ No newline at end of file +} diff --git a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp index 061e3a8ee..42ffd69eb 100644 --- a/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp +++ b/libultraship/libultraship/Lib/Fast3D/gfx_sdl2.cpp @@ -34,8 +34,8 @@ static SDL_Window *wnd; static SDL_GLContext ctx; static int inverted_scancode_table[512]; static int vsync_enabled = 0; -static unsigned int window_width = DESIRED_SCREEN_WIDTH; -static unsigned int window_height = DESIRED_SCREEN_HEIGHT; +static int window_width = DESIRED_SCREEN_WIDTH; +static int window_height = DESIRED_SCREEN_HEIGHT; static bool fullscreen_state; static void (*on_fullscreen_changed_callback)(bool is_now_fullscreen); static bool (*on_key_down_callback)(int scancode); @@ -145,7 +145,8 @@ static void gfx_sdl_init(const char *game_name, bool start_in_fullscreen) { int len = sprintf(title, "%s (%s)", game_name, GFX_API_NAME); wnd = SDL_CreateWindow(title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, - window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE); + window_width, window_height, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); + SDL_GL_GetDrawableSize(wnd, &window_width, &window_height); if (start_in_fullscreen) { set_fullscreen(true, false); @@ -244,8 +245,7 @@ static void gfx_sdl_handle_events(void) { #endif case SDL_WINDOWEVENT: if (event.window.event == SDL_WINDOWEVENT_SIZE_CHANGED) { - window_width = event.window.data1; - window_height = event.window.data2; + SDL_GL_GetDrawableSize(wnd, &window_width, &window_height); } break; case SDL_QUIT: diff --git a/libultraship/libultraship/SDLAudioPlayer.cpp b/libultraship/libultraship/SDLAudioPlayer.cpp index ed883460e..a2f679581 100644 --- a/libultraship/libultraship/SDLAudioPlayer.cpp +++ b/libultraship/libultraship/SDLAudioPlayer.cpp @@ -38,4 +38,4 @@ namespace Ship { SDL_QueueAudio(Device, Buffer, BufferLen); } } -} \ No newline at end of file +} diff --git a/libultraship/libultraship/SohImGuiImpl.cpp b/libultraship/libultraship/SohImGuiImpl.cpp index 38a15780e..1d122e06b 100644 --- a/libultraship/libultraship/SohImGuiImpl.cpp +++ b/libultraship/libultraship/SohImGuiImpl.cpp @@ -50,6 +50,7 @@ bool oldCursorState = true; ImGui::PopStyleColor(); \ ImGui::Separator(); #define TOGGLE_BTN ImGuiKey_F1 +#define TOGGLE_PAD_BTN ImGuiKey_GamepadBack #define HOOK(b) if(b) needs_save = true; OSContPad* pads; @@ -556,6 +557,20 @@ namespace SohImGui { } } + void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector& items, int defaultValue) { + + if (ImGui::BeginCombo(name.c_str(), items[static_cast(CVar_GetS32(cvarName, defaultValue))].c_str())) { + for (int settingIndex = 0; settingIndex < (int) items.size(); settingIndex++) { + if (ImGui::Selectable(items[settingIndex].c_str())) { + CVar_SetS32(cvarName, settingIndex); + needs_save = true; + + } + } + ImGui::EndCombo(); + } + } + void RandomizeColor(const char* cvarName, ImVec4* colors) { std::string Cvar_Red = cvarName; Cvar_Red += "R"; @@ -684,7 +699,7 @@ namespace SohImGui { const std::shared_ptr wnd = GlobalCtx2::GetInstance()->GetWindow(); ImGuiWindowFlags window_flags = ImGuiWindowFlags_NoDocking | ImGuiWindowFlags_NoBackground | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoMove | - ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus | ImGuiWindowFlags_NoResize; + ImGuiWindowFlags_NoResize; if (CVar_GetS32("gOpenMenuBar", 0)) window_flags |= ImGuiWindowFlags_MenuBar; const ImGuiViewport* viewport = ImGui::GetMainViewport(); @@ -712,7 +727,9 @@ namespace SohImGui { ImGui::DockSpace(dockId, ImVec2(0.0f, 0.0f), ImGuiDockNodeFlags_None); - if (ImGui::IsKeyPressed(TOGGLE_BTN)) { + ImGuiIO& io = ImGui::GetIO(); + io.ConfigFlags |= ImGuiConfigFlags_NavEnableGamepad; + if ((ImGui::IsKeyPressed(TOGGLE_BTN)) || (ImGui::IsKeyDown(TOGGLE_PAD_BTN))) { bool menu_bar = CVar_GetS32("gOpenMenuBar", 0); CVar_SetS32("gOpenMenuBar", !menu_bar); needs_save = true; @@ -742,7 +759,22 @@ namespace SohImGui { } if (ImGui::BeginMenu("Controller")) - { + { + EnhancementCheckbox("D-pad Support on Pause and File Select", "gDpadPauseName"); + EnhancementCheckbox("D-pad Support in Ocarina and Text Choice", "gDpadOcarinaText"); + EnhancementCheckbox("D-pad Support for Browsing Shop Items", "gDpadShop"); + + ImGui::Separator(); + + EnhancementCheckbox("Show Inputs", "gInputEnabled"); + Tooltip("Shows currently pressed inputs on the bottom right of the screen"); + EnhancementCheckbox("Rumble Enabled", "gRumbleEnabled"); + + EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false); + Tooltip("Sets the on screen size of the displayed inputs from Show Inputs"); + + ImGui::Separator(); + for (const auto& [i, controllers] : Ship::Window::Controllers) { bool hasPad = std::find_if(controllers.begin(), controllers.end(), [](const auto& c) { @@ -772,19 +804,6 @@ namespace SohImGui { ImGui::Separator(); } - EnhancementCheckbox("Show Inputs", "gInputEnabled"); - Tooltip("Shows currently pressed inputs on the bottom right of the screen"); - EnhancementCheckbox("Rumble Enabled", "gRumbleEnabled"); - - EnhancementSliderFloat("Input Scale: %.1f", "##Input", "gInputScale", 1.0f, 3.0f, "", 1.0f, false); - Tooltip("Sets the on screen size of the displayed inputs from Show Inputs"); - - ImGui::Separator(); - - EnhancementCheckbox("D-pad Support on Pause and File Select", "gDpadPauseName"); - EnhancementCheckbox("D-pad Support in Ocarina and Text Choice", "gDpadOcarinaText"); - EnhancementCheckbox("D-pad Support for Browsing Shop Items", "gDpadShop"); - ImGui::EndMenu(); } @@ -859,9 +878,11 @@ namespace SohImGui { Tooltip("Displays an icon and plays a sound when Stone of Agony should be activated, for those without rumble"); EnhancementCheckbox("Faster Block Push", "gFasterBlockPush"); EnhancementCheckbox("Assignable Tunics and Boots", "gAssignableTunicsAndBoots"); - Tooltip("Allows equiping the tunic and boots to c-buttons"); + Tooltip("Allows equipping the tunic and boots to c-buttons"); EnhancementCheckbox("MM Bunny Hood", "gMMBunnyHood"); Tooltip("Wearing the Bunny Hood grants a speed increase like in Majora's Mask"); + EnhancementCheckbox("No Forced Navi", "gNoForcedNavi"); + Tooltip("Prevent forced Navi conversations"); EnhancementCheckbox("No Skulltula Freeze", "gSkulltulaFreeze"); Tooltip("Stops the game from freezing the player when picking up Gold Skulltulas"); EnhancementCheckbox("Disable Navi Call Audio", "gDisableNaviCallAudio"); @@ -872,6 +893,7 @@ namespace SohImGui { Tooltip("The default response to Kaepora Gaebora is always that you understood what he said"); EnhancementCheckbox("Link's Cow in Both Time Periods", "gCowOfTime"); Tooltip("Allows the Lon Lon Ranch obstacle course reward to be shared across time periods"); + EnhancementCheckbox("Enable passage of time on file select", "gTimeFlowFileSelect"); ImGui::EndMenu(); } @@ -940,6 +962,8 @@ namespace SohImGui { Tooltip("Show dungeon entrances icon only when it should be"); EnhancementCheckbox("Fix Two Handed idle animations", "gTwoHandedIdle"); Tooltip("Makes two handed idle animation play, a seemingly finished animation that was disabled on accident in the original game"); + EnhancementCheckbox("Fix the Gravedigging Tour Glitch", "gGravediggingTourFix"); + Tooltip("Fixes a bug where you can permanently miss the Gravedigging Tour Heart Piece"); EnhancementCheckbox("Fix Deku Nut upgrade", "gDekuNutUpgradeFix"); Tooltip("Prevents the Forest Stage Deku Nut upgrade from becoming unobtainable after receiving the Poacher's Saw"); EnhancementCheckbox("Fix Navi text HUD position", "gNaviTextFix"); @@ -1015,7 +1039,7 @@ namespace SohImGui { } if (ImGui::BeginMenu("Cosmetics")) { - EnhancementCheckbox("Cosmetics editor", "gCosmticsEditor"); + EnhancementCheckbox("Cosmetics editor", "gCosmeticEditor"); Tooltip("Edit Navi and Link's Tunics color."); EnhancementCheckbox("HUD Margins editor", "gUseMargins"); EnhancementRadioButton("N64 interface", "gHudColors", 0); @@ -1061,6 +1085,8 @@ namespace SohImGui { Tooltip("Drops from enemies, grass, etc. don't disappear after a set amount of time"); EnhancementCheckbox("Fireproof Deku Shield", "gFireproofDekuShield"); Tooltip("Prevents the Deku Shield from burning on contact with fire"); + EnhancementCheckbox("Shield with Two-Handed Weapons", "gShieldTwoHanded"); + Tooltip("Allows Link to shield normally with two-handed swords and the Megaton Hammer"); ImGui::EndMenu(); } @@ -1074,7 +1100,7 @@ namespace SohImGui { if (CVar_GetS32("gSkipLogoTitle",0)) { EnhancementSliderInt("Loading %d", "##SaveFileID", "gSaveFileID", 0, 4, ""); } - ImGui::Separator(); + ImGui::Separator(); EnhancementCheckbox("Stats", "gStatsEnabled"); Tooltip("Shows the stats window, with your FPS and frametimes, and the OS you're playing on"); EnhancementCheckbox("Console", "gConsoleEnabled"); @@ -1085,14 +1111,15 @@ namespace SohImGui { } bool Margins_isOpen = CVar_GetS32("gUseMargins", 0); - bool Cosmetics_isOpen = CVar_GetS32("gCosmticsEditor", 0); + bool Cosmetics_isOpen = CVar_GetS32("gCosmeticEditor", 0); bool Interface_isOpen = CVar_GetS32("gColorsEditor", 0); if (Margins_isOpen) { if (!Margins_isOpen) { + CVar_SetS32("gHUDMargins", 0); return; } - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); + ImGui::SetNextWindowSize(ImVec2(520, 600), ImGuiCond_FirstUseEver); ImGui::Begin("Margins Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); if (ImGui::BeginTabBar("Margins Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Interface margins")) { @@ -1106,14 +1133,14 @@ namespace SohImGui { } ImGui::EndTabBar(); } - ImGui::PopStyleColor(); ImGui::End(); } if (Cosmetics_isOpen) { if (!Cosmetics_isOpen) { + CVar_SetS32("gCosmeticEditor", 0); return; } - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); + ImGui::SetNextWindowSize(ImVec2(500, 627), ImGuiCond_FirstUseEver); ImGui::Begin("Cosmetics Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); if (ImGui::BeginTabBar("Cosmetics Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Navi")) { @@ -1152,14 +1179,14 @@ namespace SohImGui { } ImGui::EndTabBar(); } - ImGui::PopStyleColor(); ImGui::End(); } if (Interface_isOpen) { if (!Interface_isOpen) { + CVar_SetS32("gColorsEditor", 0); return; } - ImGui::PushStyleColor(ImGuiCol_Border, ImVec4(0, 0, 0, 0)); + ImGui::SetNextWindowSize(ImVec2(215, 627), ImGuiCond_FirstUseEver); ImGui::Begin("Interface Editor", nullptr, ImGuiWindowFlags_NoFocusOnAppearing); if (ImGui::BeginTabBar("Interface Editor", ImGuiTabBarFlags_NoCloseWithMiddleMouseButton)) { if (ImGui::BeginTabItem("Hearts")) { @@ -1200,7 +1227,6 @@ namespace SohImGui { } ImGui::EndTabBar(); } - ImGui::PopStyleColor(); ImGui::End(); } diff --git a/libultraship/libultraship/SohImGuiImpl.h b/libultraship/libultraship/SohImGuiImpl.h index 50d5c95e4..1ae02c1e7 100644 --- a/libultraship/libultraship/SohImGuiImpl.h +++ b/libultraship/libultraship/SohImGuiImpl.h @@ -72,6 +72,7 @@ namespace SohImGui { void EnhancementSliderFloat(const char* text, const char* id, const char* cvarName, float min, float max, const char* format, float defaultValue, bool isPercentage); void EnhancementCombobox(const char* name, const char* ComboArray[], size_t arraySize, uint8_t FirstTimeValue); void EnhancementColor(const char* text, const char* cvarName, ImVec4 ColorRGBA, ImVec4 default_colors, bool allow_rainbow = true, bool has_alpha=false, bool TitleSameLine=false); + void EnhancementCombo(const std::string& name, const char* cvarName, const std::vector& items, int defaultValue = 0); void DrawMainMenuAndCalculateGameSize(void); diff --git a/libultraship/libultraship/WasapiAudioPlayer.cpp b/libultraship/libultraship/WasapiAudioPlayer.cpp index 2e6a8e2b7..5e65196d0 100644 --- a/libultraship/libultraship/WasapiAudioPlayer.cpp +++ b/libultraship/libultraship/WasapiAudioPlayer.cpp @@ -171,4 +171,4 @@ namespace Ship { return S_OK; } } -#endif \ No newline at end of file +#endif diff --git a/soh/assets/xml/GC_NMQ_D/audio/Audio.xml b/soh/assets/xml/GC_NMQ_D/audio/Audio.xml index b47d5ce51..47bed7419 100644 --- a/soh/assets/xml/GC_NMQ_D/audio/Audio.xml +++ b/soh/assets/xml/GC_NMQ_D/audio/Audio.xml @@ -1,7 +1,7 @@ - \ No newline at end of file + diff --git a/soh/assets/xml/GC_NMQ_PAL_F/audio/Audio.xml b/soh/assets/xml/GC_NMQ_PAL_F/audio/Audio.xml index 73de9a1eb..082ead443 100644 --- a/soh/assets/xml/GC_NMQ_PAL_F/audio/Audio.xml +++ b/soh/assets/xml/GC_NMQ_PAL_F/audio/Audio.xml @@ -1,7 +1,7 @@ diff --git a/soh/soh/Enhancements/bootcommands.c b/soh/soh/Enhancements/bootcommands.c index 77dd075c5..83755ee5d 100644 --- a/soh/soh/Enhancements/bootcommands.c +++ b/soh/soh/Enhancements/bootcommands.c @@ -35,9 +35,11 @@ void BootCommands_Init() CVar_RegisterS32("gNewDrops", 0); CVar_RegisterS32("gVisualAgony", 0); CVar_RegisterS32("gLanguages", 0); //0 = English / 1 = German / 2 = French + CVar_RegisterS32("gGravediggingTourFix", 1); CVar_RegisterS32("gHudColors", 1); //0 = N64 / 1 = NGC / 2 = Custom CVar_RegisterS32("gUseNaviCol", 0); CVar_RegisterS32("gUseTunicsCol", 0); + CVar_RegisterS32("gTimeFlowFileSelect", 0); } //void BootCommands_ParseBootArgs(char* str) diff --git a/soh/soh/Enhancements/debugger/colViewer.cpp b/soh/soh/Enhancements/debugger/colViewer.cpp index f5c283aac..1a7c60ba8 100644 --- a/soh/soh/Enhancements/debugger/colViewer.cpp +++ b/soh/soh/Enhancements/debugger/colViewer.cpp @@ -6,6 +6,7 @@ #include #include #include +#include extern "C" { #include @@ -15,40 +16,27 @@ extern "C" { extern GlobalContext* gGlobalCtx; } -enum class ColRenderSetting { - Disabled, - Solid, - Transparent, - NumSettings -}; +enum class ColRenderSetting { Disabled, Solid, Transparent }; -std::string ColRenderSettingNames[] = { +std::vector ColRenderSettingNames = { "Disabled", "Solid", "Transparent", }; -static ColRenderSetting showSceneColSetting = ColRenderSetting::Disabled; -static ColRenderSetting showBgActorSetting = ColRenderSetting::Disabled; -static ColRenderSetting showColCheckSetting = ColRenderSetting::Disabled; -static ColRenderSetting showWaterboxSetting = ColRenderSetting::Disabled; +ImVec4 scene_col; +ImVec4 hookshot_col; +ImVec4 entrance_col; +ImVec4 specialSurface_col; +ImVec4 interactable_col; +ImVec4 slope_col; +ImVec4 void_col; -static uint32_t sceneColor = 0xFFFFFFFF; -static uint32_t hookshotColor = 0x8080FFFF; -static uint32_t entranceColor = 0x00FF00FF; -static uint32_t specialSurfaceColor = 0xC0FFC0FF; -static uint32_t interactableColor = 0xC000C0FF; -static uint32_t slopeColor = 0xFFFF80FF; -static uint32_t voidColor = 0xFF0000FF; +ImVec4 oc_col; +ImVec4 ac_col; +ImVec4 at_col; -static uint32_t ocColor = 0xFFFFFFFF; -static uint32_t acColor = 0x0000FFFF; -static uint32_t atColor = 0xFF0000FF; - -static uint32_t waterboxColor = 0x0000FFFF; - -static bool applyAsDecal = false; -static bool isShaded = false; +ImVec4 waterbox_col; static std::vector opaDl; static std::vector xluDl; @@ -62,38 +50,10 @@ static std::vector cylinderVtx; static std::vector sphereGfx; static std::vector sphereVtx; -// Create a dropdown menu to set a ColRenderSetting -void DrawColRenderSetting(const std::string& name, ColRenderSetting& setting) { - if (ImGui::BeginCombo(name.c_str(), ColRenderSettingNames[static_cast(setting)].c_str())) { - for (int32_t settingIndex = 0; settingIndex < static_cast(ColRenderSetting::NumSettings); settingIndex++) { - if (ImGui::Selectable(ColRenderSettingNames[settingIndex].c_str())) { - setting = static_cast(settingIndex); - } - } - ImGui::EndCombo(); - } -} - -// Draw a color picker box -void DrawColorPicker(const std::string& name, uint32_t& color) { - float colorAsFloat[4]; - colorAsFloat[0] = ((color >> 24) & 0xFF) / 255.0f; - colorAsFloat[1] = ((color >> 16) & 0xFF) / 255.0f; - colorAsFloat[2] = ((color >> 8) & 0xFF) / 255.0f; - colorAsFloat[3] = (color & 0xFF) / 255.0f; - if (ImGui::ColorEdit4(name.c_str(), colorAsFloat, ImGuiColorEditFlags_NoInputs | ImGuiColorEditFlags_NoLabel)) { - color = static_cast(colorAsFloat[3] * 255) | - static_cast(colorAsFloat[2] * 255) << 8 | - static_cast(colorAsFloat[1] * 255) << 16 | - static_cast(colorAsFloat[0] * 255) << 24; - } - ImGui::SameLine(); - ImGui::Text(name.c_str()); -} - // Draws the ImGui window for the collision viewer void DrawColViewerWindow(bool& open) { if (!open) { + CVar_SetS32("gCollisionViewerEnabled", 0); return; } @@ -102,16 +62,17 @@ void DrawColViewerWindow(bool& open) { ImGui::End(); return; } + SohImGui::EnhancementCheckbox("Enabled", "gColViewerEnabled"); - DrawColRenderSetting("Scene", showSceneColSetting); - DrawColRenderSetting("Bg Actors", showBgActorSetting); - DrawColRenderSetting("Col Check", showColCheckSetting); - DrawColRenderSetting("Waterbox", showWaterboxSetting); + SohImGui::EnhancementCombo("Scene", "gColViewerScene", ColRenderSettingNames); + SohImGui::EnhancementCombo("Bg Actors", "gColViewerBgActors", ColRenderSettingNames); + SohImGui::EnhancementCombo("Col Check", "gColViewerColCheck", ColRenderSettingNames); + SohImGui::EnhancementCombo("Waterbox", "gColViewerWaterbox", ColRenderSettingNames); - ImGui::Checkbox("Apply as decal", &applyAsDecal); + SohImGui::EnhancementCheckbox("Apply as decal", "gColViewerDecal"); InsertHelpHoverText("Applies the collision as a decal display. This can be useful if there is z-fighting occuring " "with the scene geometry, but can cause other artifacts."); - ImGui::Checkbox("Shaded", &isShaded); + SohImGui::EnhancementCheckbox("Shaded", "gColViewerShaded"); InsertHelpHoverText("Applies the scene's shading to the collision display."); // This has to be duplicated in both code paths due to the nature of ImGui::IsItemHovered() @@ -119,17 +80,20 @@ void DrawColViewerWindow(bool& open) { if (ImGui::TreeNode("Colors")) { InsertHelpHoverText(colorHelpText); - DrawColorPicker("Normal", sceneColor); - DrawColorPicker("Hookshot", hookshotColor); - DrawColorPicker("Entrance", entranceColor); - DrawColorPicker("Special Surface (Grass/Sand/Etc)", specialSurfaceColor); - DrawColorPicker("Interactable (Vines/Crawlspace/Etc)", interactableColor); - DrawColorPicker("Slope", slopeColor); - DrawColorPicker("Void", voidColor); - DrawColorPicker("OC", ocColor); - DrawColorPicker("AC", acColor); - DrawColorPicker("AT", atColor); - DrawColorPicker("Waterbox", waterboxColor); + SohImGui::EnhancementColor("Normal", "gColViewerColorNormal", scene_col, ImVec4(255, 255, 255, 255), false); + SohImGui::EnhancementColor("Hookshot", "gColViewerColorHookshot", hookshot_col, ImVec4(128, 128, 255, 255), + false); + SohImGui::EnhancementColor("Entrance", "gColViewerColorEntrance", entrance_col, ImVec4(0, 255, 0, 255), false); + SohImGui::EnhancementColor("Special Surface (Grass/Sand/Etc)", "gColViewerColorSpecialSurface", + specialSurface_col, ImVec4(192, 255, 192, 255), false); + SohImGui::EnhancementColor("Interactable (Vines/Crawlspace/Etc)", "gColViewerColorInteractable", + interactable_col, ImVec4(192, 0, 192, 255), false); + SohImGui::EnhancementColor("Slope", "gColViewerColorSlope", slope_col, ImVec4(255, 255, 128, 255), false); + SohImGui::EnhancementColor("Void", "gColViewerColorVoid", void_col, ImVec4(255, 0, 0, 255), false); + SohImGui::EnhancementColor("OC", "gColViewerColorOC", oc_col, ImVec4(255, 255, 255, 255), false); + SohImGui::EnhancementColor("AC", "gColViewerColorAC", ac_col, ImVec4(0, 0, 255, 255), false); + SohImGui::EnhancementColor("AT", "gColViewerColorAT", at_col, ImVec4(255, 0, 0, 255), false); + SohImGui::EnhancementColor("Waterbox", "gColViewerColorWaterbox", waterbox_col, ImVec4(0, 0, 255, 255), false); ImGui::TreePop(); } else { @@ -161,13 +125,12 @@ void CalcTriNorm(const Vec3f& v1, const Vec3f& v2, const Vec3f& v3, Vec3f& norm) .n = {.ob = { x, y, z }, .tc = { qs105(s), qs105(t) }, .n = { nx, ny, nz }, .a = ca } \ } - void CreateCylinderData() { constexpr int32_t CYL_DIVS = 12; cylinderGfx.reserve(5 + CYL_DIVS * 2); cylinderVtx.reserve(2 + CYL_DIVS * 2); - cylinderVtx.push_back(gdSPDefVtxN(0, 0, 0, 0, 0, 0, -127, 0, 0xFF)); // Bottom center vertex + cylinderVtx.push_back(gdSPDefVtxN(0, 0, 0, 0, 0, 0, -127, 0, 0xFF)); // Bottom center vertex cylinderVtx.push_back(gdSPDefVtxN(0, 128, 0, 0, 0, 0, 127, 0, 0xFF)); // Top center vertex // Create two rings of vertices for (int i = 0; i < CYL_DIVS; ++i) { @@ -210,9 +173,10 @@ void CreateCylinderData() { cylinderGfx.push_back(gsSPEndDisplayList()); } -// This subdivides a face into four tris by placing new verticies at the midpoints of the sides (Like a triforce!), then blowing up the -// verticies so they are on the unit sphere -void CreateSphereFace(std::vector>& faces, int32_t v0Index, int32_t v1Index, int32_t v2Index) { +// This subdivides a face into four tris by placing new verticies at the midpoints of the sides (Like a triforce!), then +// blowing up the verticies so they are on the unit sphere +void CreateSphereFace(std::vector>& faces, int32_t v0Index, int32_t v1Index, + int32_t v2Index) { size_t nextIndex = sphereVtx.size(); size_t v01Index = nextIndex; @@ -248,9 +212,9 @@ void CreateSphereFace(std::vector>& faces, in } } -// Creates a sphere following the idea in here: http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html -// Spcifically, create a icosahedron by realizing that the points can be placed on 3 rectangles that are on each unit plane. -// Then, subdividing each face. +// Creates a sphere following the idea in here: +// http://blog.andreaskahler.com/2009/06/creating-icosphere-mesh-in-code.html Spcifically, create a icosahedron by +// realizing that the points can be placed on 3 rectangles that are on each unit plane. Then, subdividing each face. void CreateSphereData() { std::vector base; @@ -351,7 +315,7 @@ void InitGfx(std::vector& gfx, ColRenderSetting setting) { alpha = 0xFF; } - if (applyAsDecal) { + if (CVar_GetS32("gColViewerDecal", 0) != 0) { rm |= ZMODE_DEC; } else if (setting == ColRenderSetting::Transparent) { rm |= ZMODE_XLU; @@ -363,7 +327,7 @@ void InitGfx(std::vector& gfx, ColRenderSetting setting) { gfx.push_back(gsDPSetCycleType(G_CYC_1CYCLE)); gfx.push_back(gsDPSetRenderMode(rm | blc1, rm | blc2)); - if (isShaded) { + if (CVar_GetS32("gColViewerShaded", 0) != 0) { gfx.push_back(gsDPSetCombineMode(G_CC_MODULATERGB_PRIM_ENVA, G_CC_MODULATERGB_PRIM_ENVA)); gfx.push_back(gsSPLoadGeometryMode(G_CULL_BACK | G_ZBUFFER | G_LIGHTING)); } else { @@ -376,10 +340,16 @@ void InitGfx(std::vector& gfx, ColRenderSetting setting) { // Draws a dynapoly structure (scenes or Bg Actors) void DrawDynapoly(std::vector& dl, CollisionHeader* col, int32_t bgId) { - uint32_t color = sceneColor; - uint32_t lastColor = color; - dl.push_back(gsDPSetPrimColor(0, 0, (color >> 24) & 0xFF, (color >> 16) & 0xFF, (color >> 8) & 0xFF, - (color >> 0) & 0xFF)); + uint32_t colorR = CVar_GetS32("gColViewerColorNormalR", 255); + uint32_t colorG = CVar_GetS32("gColViewerColorNormalG", 255); + uint32_t colorB = CVar_GetS32("gColViewerColorNormalB", 255); + uint32_t colorA = 255; + + uint32_t lastColorR = colorR; + uint32_t lastColorG = colorG; + uint32_t lastColorB = colorB; + + dl.push_back(gsDPSetPrimColor(0, 0, colorR, colorG, colorB, colorA)); // This keeps track of if we have processed a poly, but not drawn it yet so we can batch them. // This saves several hundred commands in larger scenes @@ -389,34 +359,49 @@ void DrawDynapoly(std::vector& dl, CollisionHeader* col, int32_t bgId) { CollisionPoly* poly = &col->polyList[i]; if (SurfaceType_IsHookshotSurface(&gGlobalCtx->colCtx, poly, bgId)) { - color = hookshotColor; + colorR = CVar_GetS32("gColViewerColorHookshotR", 128); + colorG = CVar_GetS32("gColViewerColorHookshotG", 128); + colorB = CVar_GetS32("gColViewerColorHookshotB", 255); } else if (func_80041D94(&gGlobalCtx->colCtx, poly, bgId) > 0x01) { - color = interactableColor; + colorR = CVar_GetS32("gColViewerColorInteractableR", 192); + colorG = CVar_GetS32("gColViewerColorInteractableG", 0); + colorB = CVar_GetS32("gColViewerColorInteractableB", 192); } else if (func_80041E80(&gGlobalCtx->colCtx, poly, bgId) == 0x0C) { - color = voidColor; + colorR = CVar_GetS32("gColViewerColorVoidR", 255); + colorG = CVar_GetS32("gColViewerColorVoidG", 0); + colorB = CVar_GetS32("gColViewerColorVoidB", 0); } else if (SurfaceType_GetSceneExitIndex(&gGlobalCtx->colCtx, poly, bgId) || func_80041E80(&gGlobalCtx->colCtx, poly, bgId) == 0x05) { - color = entranceColor; + colorR = CVar_GetS32("gColViewerColorEntranceR", 0); + colorG = CVar_GetS32("gColViewerColorEntranceG", 255); + colorB = CVar_GetS32("gColViewerColorEntranceB", 0); } else if (func_80041D4C(&gGlobalCtx->colCtx, poly, bgId) != 0 || SurfaceType_IsWallDamage(&gGlobalCtx->colCtx, poly, bgId)) { - color = specialSurfaceColor; + colorR = CVar_GetS32("gColViewerColorSpecialSurfaceR", 192); + colorG = CVar_GetS32("gColViewerColorSpecialSurfaceG", 255); + colorB = CVar_GetS32("gColViewerColorSpecialSurfaceB", 192); } else if (SurfaceType_GetSlope(&gGlobalCtx->colCtx, poly, bgId) == 0x01) { - color = slopeColor; + colorR = CVar_GetS32("gColViewerColorSlopeR", 255); + colorG = CVar_GetS32("gColViewerColorSlopeG", 255); + colorB = CVar_GetS32("gColViewerColorSlopeB", 128); } else { - color = sceneColor; + colorR = CVar_GetS32("gColViewerColorNormalR", 255); + colorG = CVar_GetS32("gColViewerColorNormalG", 255); + colorB = CVar_GetS32("gColViewerColorNormalB", 255); } - if (lastColor != color) { + if (colorR != lastColorR || colorG != lastColorG || colorB != lastColorB) { // Color changed, flush previous poly if (previousPoly) { dl.push_back(gsSPVertex((uintptr_t)&vtxDl.at(vtxDl.size() - 3), 3, 0)); dl.push_back(gsSP1Triangle(0, 1, 2, 0)); previousPoly = false; } - dl.push_back(gsDPSetPrimColor(0, 0, (color >> 24) & 0xFF, (color >> 16) & 0xFF, (color >> 8) & 0xFF, - (color >> 0) & 0xFF)); + dl.push_back(gsDPSetPrimColor(0, 0, colorR, colorG, colorB, colorA)); } - lastColor = color; + lastColorR = colorR; + lastColorG = colorG; + lastColorB = colorB; Vec3s* va = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIA)]; Vec3s* vb = &col->vtxList[COLPOLY_VTX_INDEX(poly->flags_vIB)]; @@ -450,7 +435,9 @@ void DrawDynapoly(std::vector& dl, CollisionHeader* col, int32_t bgId) { // Draws the scene void DrawSceneCollision() { - if (showSceneColSetting == ColRenderSetting::Disabled) { + ColRenderSetting showSceneColSetting = (ColRenderSetting)CVar_GetS32("gColViewerScene", 0); + + if (showSceneColSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) { return; } @@ -463,7 +450,8 @@ void DrawSceneCollision() { // Draws all Bg Actors void DrawBgActorCollision() { - if (showBgActorSetting == ColRenderSetting::Disabled) { + ColRenderSetting showBgActorSetting = (ColRenderSetting)CVar_GetS32("gColViewerBgActors", 0); + if (showBgActorSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) { return; } @@ -489,7 +477,6 @@ void DrawBgActorCollision() { dl.push_back(gsSPPopMatrix(G_MTX_MODELVIEW)); } } - } // Draws a quad @@ -588,7 +575,8 @@ void DrawColCheckList(std::vector& dl, Collider** objects, int32_t count) { // Draws all Col Check objects void DrawColCheckCollision() { - if (showColCheckSetting == ColRenderSetting::Disabled) { + ColRenderSetting showColCheckSetting = (ColRenderSetting)CVar_GetS32("gColViewerColCheck", 0); + if (showColCheckSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) { return; } @@ -598,16 +586,15 @@ void DrawColCheckCollision() { CollisionCheckContext& col = gGlobalCtx->colChkCtx; - dl.push_back(gsDPSetPrimColor(0, 0, (ocColor >> 24) & 0xFF, (ocColor >> 16) & 0xFF, (ocColor >> 8) & 0xFF, - (ocColor >> 0) & 0xFF)); + dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorOCR", 255), CVar_GetS32("gColViewerColorOCG", 255), + CVar_GetS32("gColViewerColorOCB", 255), 255)); DrawColCheckList(dl, col.colOC, col.colOCCount); - - dl.push_back(gsDPSetPrimColor(0, 0, (acColor >> 24) & 0xFF, (acColor >> 16) & 0xFF, (acColor >> 8) & 0xFF, - (acColor >> 0) & 0xFF)); + dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorACR", 0), CVar_GetS32("gColViewerColorACG", 0), + CVar_GetS32("gColViewerColorACB", 255), 255)); DrawColCheckList(dl, col.colAC, col.colACCount); + dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorATR", 255), CVar_GetS32("gColViewerColorATG", 0), + CVar_GetS32("gColViewerColorATB", 0), 255)); - dl.push_back(gsDPSetPrimColor(0, 0, (atColor >> 24) & 0xFF, (atColor >> 16) & 0xFF, (atColor >> 8) & 0xFF, - (atColor >> 0) & 0xFF)); DrawColCheckList(dl, col.colAT, col.colATCount); } @@ -641,15 +628,18 @@ extern "C" f32 zdWaterBoxMinY; // Draws all waterboxes void DrawWaterboxList() { - if (showWaterboxSetting == ColRenderSetting::Disabled) { + ColRenderSetting showWaterboxSetting = (ColRenderSetting)CVar_GetS32("gColViewerWaterbox", 0); + if (showWaterboxSetting == ColRenderSetting::Disabled || CVar_GetS32("gColViewerEnabled", 0) == 0) { return; } std::vector& dl = (showWaterboxSetting == ColRenderSetting::Transparent) ? xluDl : opaDl; InitGfx(dl, showWaterboxSetting); dl.push_back(gsSPMatrix(&gMtxClear, G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH)); - dl.push_back(gsDPSetPrimColor(0, 0, (waterboxColor >> 24) & 0xFF, (waterboxColor >> 16) & 0xFF, - (waterboxColor >> 8) & 0xFF, (waterboxColor >> 0) & 0xFF)); + + dl.push_back(gsDPSetPrimColor(0, 0, CVar_GetS32("gColViewerColorWaterboxR", 0), + CVar_GetS32("gColViewerColorWaterboxG", 0), + CVar_GetS32("gColViewerColorWaterboxB", 255), 255)); CollisionHeader* col = gGlobalCtx->colCtx.colHeader; for (int32_t waterboxIndex = 0; waterboxIndex < col->numWaterBoxes; waterboxIndex++) { @@ -664,8 +654,7 @@ void DrawWaterboxList() { } // Resets a vector for the next frame and returns the capacity -template -size_t ResetVector(T& vec) { +template size_t ResetVector(T& vec) { size_t oldSize = vec.size(); vec.clear(); // Reserve slightly more space than last frame to account for variance (such as different amounts of bg actors) diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index a0d27f70f..d243ce49a 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -7,6 +7,7 @@ #include #include #include +#include extern "C" { #include @@ -1544,6 +1545,7 @@ void DrawPlayerTab() { void DrawSaveEditor(bool& open) { if (!open) { + CVar_SetS32("gSaveEditorEnabled", 0); return; } diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index b3b905a08..20bf62d32 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -808,9 +808,11 @@ extern "C" int ResourceMgr_OTRSigCheck(char* imgData) { uintptr_t i = (uintptr_t)(imgData); +// if (i == 0xD9000000 || i == 0xE7000000 || (i & 1) == 1) if ((i & 1) == 1) return 0; +// if ((i & 0xFF000000) != 0xAB000000 && (i & 0xFF000000) != 0xCD000000 && i != 0) { if (i != 0) { if (imgData[0] == '_' && imgData[1] == '_' && imgData[2] == 'O' && imgData[3] == 'T' && imgData[4] == 'R' && imgData[5] == '_' && imgData[6] == '_') diff --git a/soh/src/code/audio_load.c b/soh/src/code/audio_load.c index 59749dff5..e2633b883 100644 --- a/soh/src/code/audio_load.c +++ b/soh/src/code/audio_load.c @@ -585,6 +585,8 @@ s32 AudioLoad_SyncInitSeqPlayerInternal(s32 playerIdx, s32 seqId, s32 arg2) { AudioSeq_SequencePlayerDisable(seqPlayer); fontId = 0xFF; + index = ((u16*)gAudioContext.sequenceFontTable)[seqId]; + numFonts = gAudioContext.sequenceFontTable[index++]; if (gUseLegacySD) { index = ((u16*)gAudioContext.sequenceFontTable)[seqId]; @@ -917,7 +919,6 @@ void AudioLoad_RelocateFont(s32 fontId, SoundFontData* mem, RelocInfo* relocInfo void** ptrs = (void**)mem; - #define BASE_OFFSET(x) (void*)((u32)(x) + (u32)(mem)) reloc2 = ptrs[0]; @@ -1495,6 +1496,7 @@ void AudioLoad_InitSlowLoads(void) { s32 AudioLoad_SlowLoadSample(s32 fontId, s32 instId, s8* isDone) { SoundFontSample* sample; AudioSlowLoad* slowLoad; + sample = AudioLoad_GetFontSample(fontId, instId); if (sample == NULL) { *isDone = 0; @@ -1654,15 +1656,12 @@ s32 AudioLoad_SlowLoadSeq(s32 seqId, u8* ramAddr, s8* isDone) { } seqId = AudioLoad_GetRealTableIndex(SEQUENCE_TABLE, seqId); - seqTable = AudioLoad_GetLoadTable(SEQUENCE_TABLE); - slowLoad = &gAudioContext.slowLoads[gAudioContext.slowLoadPos]; if (slowLoad->status == LOAD_STATUS_DONE) { slowLoad->status = LOAD_STATUS_WAITING; } - slowLoad->sample.sampleAddr = NULL; slowLoad->isDone = isDone; @@ -2075,7 +2074,7 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) { if (preload->isFree == false) { sample = preload->sample; - key = sample->sampleAddr + sample->size + sample->medium; + key = (u32)sample->sampleAddr + sample->size + sample->medium; if (key == preload->endAndMediumKey) { // Change storage for sample to the preloaded version. sample->sampleAddr = preload->ramAddr; @@ -2098,12 +2097,12 @@ s32 AudioLoad_ProcessSamplePreloads(s32 resetStatus) { sample = preload->sample; nChunks = (sample->size >> 12) + 1; - key = sample->sampleAddr + sample->size + sample->medium; + key = (u32)sample->sampleAddr + sample->size + sample->medium; if (key != preload->endAndMediumKey) { preload->isFree = true; gAudioContext.preloadSampleStackTop--; } else { - AudioLoad_StartAsyncLoad(sample->sampleAddr, preload->ramAddr, sample->size, sample->medium, + AudioLoad_StartAsyncLoad((u32)sample->sampleAddr, preload->ramAddr, sample->size, sample->medium, nChunks, &gAudioContext.preloadSampleQueue, preload->encodedInfo); break; } @@ -2251,7 +2250,6 @@ void AudioLoad_PreloadSamplesForFont(s32 fontId, s32 async, RelocInfo* relocInfo } sample = gAudioContext.usedSamples[i]; - if (sample->medium == MEDIUM_RAM) { continue; } diff --git a/soh/src/code/audio_playback.c b/soh/src/code/audio_playback.c index a0773a642..b9f868bd3 100644 --- a/soh/src/code/audio_playback.c +++ b/soh/src/code/audio_playback.c @@ -355,8 +355,6 @@ Instrument* Audio_GetInstrumentInner(s32 fontId, s32 instId) { return inst; } - - return inst; } diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index a729bebe9..d40aeab99 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -360,7 +360,8 @@ s32 Player_ActionToModelGroup(Player* this, s32 actionParam) { void Player_SetModelsForHoldingShield(Player* this) { if ((this->stateFlags1 & 0x400000) && ((this->itemActionParam < 0) || (this->itemActionParam == this->heldItemActionParam))) { - if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) { + if ((CVar_GetS32("gShieldTwoHanded", 0) && (this->heldItemActionParam != PLAYER_AP_STICK) || + !Player_HoldsTwoHandedWeapon(this)) && !Player_IsChildWithHylianShield(this)) { this->rightHandType = 10; this->rightHandDLists = &sPlayerDListGroups[10][gSaveContext.linkAge]; if (this->sheathType == 18) { diff --git a/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index 5e0a780fd..f995179f1 100644 --- a/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/soh/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -110,7 +110,7 @@ void ElfMsg_Destroy(Actor* thisx, GlobalContext* globalCtx) { s32 ElfMsg_GetMessageId(ElfMsg* this) { // Negative message ID forces link to talk to Navi - if (this->actor.params & 0x8000) { + if (this->actor.params & 0x8000 || CVar_GetS32("gNoForcedNavi", 0) != 0) { return (this->actor.params & 0xFF) + 0x100; } else { return -((this->actor.params & 0xFF) + 0x100); diff --git a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c index 1559b188c..8319c2bc9 100644 --- a/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c +++ b/soh/src/overlays/actors/ovl_En_Tk/z_en_tk.c @@ -9,6 +9,10 @@ #include "objects/object_tk/object_tk.h" #define FLAGS (ACTOR_FLAG_0 | ACTOR_FLAG_3) +#define COLLECTFLAG_GRAVEDIGGING_HEART_PIECE 0x19 +#define ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE 0x1000 + +bool heartPieceSpawned; void EnTk_Init(Actor* thisx, GlobalContext* globalCtx); void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx); @@ -505,6 +509,7 @@ void EnTk_Init(Actor* thisx, GlobalContext* globalCtx) { this->currentReward = -1; this->currentSpot = NULL; this->actionFunc = EnTk_Rest; + heartPieceSpawned = false; } void EnTk_Destroy(Actor* thisx, GlobalContext* globalCtx) { @@ -611,13 +616,23 @@ void EnTk_Dig(EnTk* this, GlobalContext* globalCtx) { * Upgrade the purple rupee reward to the heart piece if this * is the first grand prize dig. */ - if (!(gSaveContext.itemGetInf[1] & 0x1000)) { - gSaveContext.itemGetInf[1] |= 0x1000; + // If vanilla itemGetInf flag is not set, it's impossible for the new flag to be set, so return true. + // Otherwise if the gGravediggingTourFix is enabled and the new flag hasn't been set, return true. + // If true, spawn the heart piece and set the vanilla itemGetInf flag and new temp clear flag. + if (!heartPieceSpawned && + (!(gSaveContext.itemGetInf[1] & ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE) || + CVar_GetS32("gGravediggingTourFix", 0) && + !Flags_GetCollectible(globalCtx, COLLECTFLAG_GRAVEDIGGING_HEART_PIECE))) { this->currentReward = 4; + gSaveContext.itemGetInf[1] |= ITEMGETINFFLAG_GRAVEDIGGING_HEART_PIECE; + heartPieceSpawned = true; } } - Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]); + EnItem00* reward = Item_DropCollectible(globalCtx, &rewardPos, rewardParams[this->currentReward]); + if (this->currentReward == 4) { + reward->collectibleFlag = COLLECTFLAG_GRAVEDIGGING_HEART_PIECE; + } } } 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 6edef49ba..0b82ef951 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -2106,10 +2106,10 @@ LinkAnimationHeader* func_808346C4(GlobalContext* globalCtx, Player* this) { func_808323B4(globalCtx, this); if (this->unk_870 < 0.5f) { - return D_808543A4[Player_HoldsTwoHandedWeapon(this)]; + return D_808543A4[Player_HoldsTwoHandedWeapon(this) && !(CVar_GetS32("gShieldTwoHanded", 0) && (this->heldItemActionParam != PLAYER_AP_STICK))]; } else { - return D_808543AC[Player_HoldsTwoHandedWeapon(this)]; + return D_808543AC[Player_HoldsTwoHandedWeapon(this) && !(CVar_GetS32("gShieldTwoHanded", 0) && (this->heldItemActionParam != PLAYER_AP_STICK))]; } } diff --git a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c index 03a93e949..1b406d8d1 100644 --- a/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c +++ b/soh/src/overlays/gamestates/ovl_file_choose/z_file_choose.c @@ -1601,6 +1601,10 @@ void FileChoose_Main(GameState* thisx) { }; FileChooseContext* this = (FileChooseContext*)thisx; Input* input = &this->state.input[0]; + + if (CVar_GetS32("gTimeFlowFileSelect", 0) != 0) { + gSaveContext.skyboxTime += 0x10; + } OPEN_DISPS(this->state.gfxCtx, "../z_file_choose.c", 2898);