From 1b6dd8a0fe418cfcf8e00c44fa6db59ee568726b Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Fri, 14 Oct 2022 18:00:48 -0400 Subject: [PATCH 1/5] Adds extra entry to obj_lift FallTimerDurations. (#1777) Prevents an OOB access that, as far as I know, was only causing issues on the Switch, but this addition is harmless everywhere else. --- soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index eb13445af..0d43f4992 100644 --- a/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/soh/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -36,7 +36,7 @@ const ActorInit Obj_Lift_InitVars = { NULL, }; -static s16 sFallTimerDurations[] = { 0, 10, 20, 30, 40, 50, 60 }; +static s16 sFallTimerDurations[] = { 0, 10, 20, 30, 40, 50, 60, 0 }; typedef struct { /* 0x00 */ s16 x; From 4173eadae2291b2853a268e965097c9305f126d5 Mon Sep 17 00:00:00 2001 From: Sarge-117 <108380086+Sarge-117@users.noreply.github.com> Date: Wed, 19 Oct 2022 18:51:42 -0700 Subject: [PATCH 2/5] Fix tunics/boots on C-buttons not always being enabled (#1782) * Always enable C-buttons with equipment * Fix for it still sometimes being disables --- soh/src/code/z_parameter.c | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index dd150913b..02f9395f5 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -949,15 +949,7 @@ void func_80083108(GlobalContext* globalCtx) { gSaveContext.buttonStatus[0] = BTN_DISABLED; for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { - if ((gSaveContext.equips.buttonItems[i] >= ITEM_SHIELD_DEKU) && - (gSaveContext.equips.buttonItems[i] <= ITEM_BOOTS_HOVER)) { - // Equipment on c-buttons is always enabled - if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) { - sp28 = 1; - } - - gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED; - } else if (func_8008F2F8(globalCtx) == 2) { + if (func_8008F2F8(globalCtx) == 2) { if ((gSaveContext.equips.buttonItems[i] != ITEM_HOOKSHOT) && (gSaveContext.equips.buttonItems[i] != ITEM_LONGSHOT)) { if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_ENABLED) { @@ -1100,6 +1092,18 @@ void func_80083108(GlobalContext* globalCtx) { } } + for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { + if ((gSaveContext.equips.buttonItems[i] >= ITEM_SHIELD_DEKU) && + (gSaveContext.equips.buttonItems[i] <= ITEM_BOOTS_HOVER)) { + // Equipment on c-buttons is always enabled + if (gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] == BTN_DISABLED) { + sp28 = 1; + } + + gSaveContext.buttonStatus[BUTTON_STATUS_INDEX(i)] = BTN_ENABLED; + } + } + if (interfaceCtx->restrictions.bottles != 0) { for (i = 1; i < ARRAY_COUNT(gSaveContext.equips.buttonItems); i++) { if ((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) && @@ -1253,6 +1257,8 @@ void func_80083108(GlobalContext* globalCtx) { (gSaveContext.equips.buttonItems[i] != ITEM_OCARINA_TIME) && !((gSaveContext.equips.buttonItems[i] >= ITEM_BOTTLE) && (gSaveContext.equips.buttonItems[i] <= ITEM_POE)) && + !((gSaveContext.equips.buttonItems[i] >= ITEM_SHIELD_DEKU) && // Never disable equipment + (gSaveContext.equips.buttonItems[i] <= ITEM_BOOTS_HOVER)) && // (tunics/boots) on C-buttons !((gSaveContext.equips.buttonItems[i] >= ITEM_WEIRD_EGG) && (gSaveContext.equips.buttonItems[i] <= ITEM_CLAIM_CHECK))) { if ((globalCtx->sceneNum != SCENE_TAKARAYA) || From 57ba36b06312e80d7b9ba71c3bf1b7f6397cf27e Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Wed, 19 Oct 2022 23:12:50 -0400 Subject: [PATCH 3/5] Fixes crash (#1798) (#1806) (cherry picked from commit 30c66439a4f842d3ec5ce73f9cd689fcf4b8490b) Co-authored-by: RaelCappra --- soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp index d167ec8b3..7c465110a 100644 --- a/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp +++ b/soh/soh/Enhancements/cosmetics/CosmeticsEditor.cpp @@ -472,7 +472,7 @@ void Draw_ItemsSkills(){ ResetTrailLength("gTrailDuration", 4); UIWidgets::EnhancementCheckbox("Swords use separate colors", "gSeperateSwords"); if (CVar_GetS32("gSeperateSwords", 0) && ImGui::CollapsingHeader("Individual Sword Colors")) { - if (ImGui::BeginTable("tabletrailswords", 2, FlagsTable)) { + if (ImGui::BeginTable("tabletrailswords", 5, FlagsTable)) { ImGui::TableSetupColumn("Kokiri Sword", FlagsCell, TablesCellsWidth / 2); ImGui::TableSetupColumn("Master Sword", FlagsCell, TablesCellsWidth / 2); ImGui::TableSetupColumn("Biggoron Sword", FlagsCell, TablesCellsWidth / 2); From 4a029cc6cffd7b454263d916358ffe622a8abb6e Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Wed, 19 Oct 2022 23:29:28 -0400 Subject: [PATCH 4/5] Cuts down on excess rando lookups in `z_en_item00` (#1805) * Cuts down on excess GetCheckFromActor lookups in z_en_item00 * Fixes non-windows build errors. --- soh/include/z64actor.h | 2 ++ soh/src/code/z_en_item00.c | 42 +++++++++++++++++--------------------- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/soh/include/z64actor.h b/soh/include/z64actor.h index 01eb28a1d..5a4f7d63f 100644 --- a/soh/include/z64actor.h +++ b/soh/include/z64actor.h @@ -5,6 +5,7 @@ #include "z64animation.h" #include "z64math.h" #include "z64collision_check.h" +#include "soh/Enhancements/item-tables/ItemTableTypes.h" #define ACTOR_NUMBER_MAX 2000 #define INVISIBLE_ACTOR_MAX 20 @@ -291,6 +292,7 @@ typedef struct EnItem00 { /* 0x15C */ f32 scale; /* 0x160 */ ColliderCylinder collider; s16 ogParams; + GetItemEntry randoGiEntry; } EnItem00; // size = 0x1AC // Only A_OBJ_SIGNPOST_OBLONG and A_OBJ_SIGNPOST_ARROW are used in room files. diff --git a/soh/src/code/z_en_item00.c b/soh/src/code/z_en_item00.c index d4ddd18e9..c6afc2535 100644 --- a/soh/src/code/z_en_item00.c +++ b/soh/src/code/z_en_item00.c @@ -336,7 +336,7 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { f32 yOffset = 980.0f; f32 shadowScale = 6.0f; s32 getItemId = GI_NONE; - GetItemEntry getItem = (GetItemEntry)GET_ITEM_NONE; + this->randoGiEntry = (GetItemEntry)GET_ITEM_NONE; s16 spawnParam8000 = this->actor.params & 0x8000; s32 pad1; @@ -431,6 +431,14 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { this->actor.shape.shadowAlpha = 180; this->actor.focus.pos = this->actor.world.pos; this->getItemId = GI_NONE; + RandomizerCheck randoCheck = + Randomizer_GetCheckFromActor(this->actor.id, globalCtx->sceneNum, this->ogParams); + + if (gSaveContext.n64ddFlag && randoCheck != RC_UNKNOWN_CHECK) { + this->randoGiEntry = + Randomizer_GetItemFromKnownCheck(randoCheck, getItemId); + this->randoGiEntry.getItemFrom = ITEM_FROM_FREESTANDING; + } if (!spawnParam8000) { EnItem00_SetupAction(this, func_8001DFC8); @@ -516,12 +524,10 @@ void EnItem00_Init(Actor* thisx, GlobalContext* globalCtx) { if (!Actor_HasParent(&this->actor, globalCtx)) { if (getItemId != GI_NONE) { - if (!gSaveContext.n64ddFlag) { + if (!gSaveContext.n64ddFlag || this->randoGiEntry.getItemId == GI_NONE) { func_8002F554(&this->actor, globalCtx, getItemId); } else { - getItem = Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, this->ogParams, getItemId); - getItem.getItemFrom = ITEM_FROM_FREESTANDING; - GiveItemEntryFromActorWithFixedRange(&this->actor, globalCtx, getItem); + GiveItemEntryFromActorWithFixedRange(&this->actor, globalCtx, this->randoGiEntry); } } } @@ -686,10 +692,7 @@ void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) { if (!gSaveContext.n64ddFlag) { func_8002F434(&this->actor, globalCtx, this->getItemId, 50.0f, 80.0f); } else { - GetItemEntry getItemEntry = - Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, this->ogParams, this->getItemId); - getItemEntry.getItemFrom = ITEM_FROM_FREESTANDING; - GiveItemEntryFromActor(&this->actor, globalCtx, getItemEntry, 50.0f, 80.0f); + GiveItemEntryFromActor(&this->actor, globalCtx, this->randoGiEntry, 50.0f, 80.0f); } this->unk_15A++; } else { @@ -724,7 +727,6 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { s16* params; Actor* dynaActor; s32 getItemId = GI_NONE; - GetItemEntry getItem = (GetItemEntry)GET_ITEM_NONE; s16 sp3A = 0; s16 i; u32* temp; @@ -910,13 +912,11 @@ void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { params = &this->actor.params; if ((getItemId != GI_NONE) && !Actor_HasParent(&this->actor, globalCtx)) { - if (!gSaveContext.n64ddFlag) { + if (!gSaveContext.n64ddFlag || this->randoGiEntry.getItemId == GI_NONE) { func_8002F554(&this->actor, globalCtx, getItemId); } else { - getItem = Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, this->ogParams, getItemId); - getItemId = getItem.getItemId; - getItem.getItemFrom = ITEM_FROM_FREESTANDING; - GiveItemEntryFromActorWithFixedRange(&this->actor, globalCtx, getItem); + getItemId = this->randoGiEntry.getItemId; + GiveItemEntryFromActorWithFixedRange(&this->actor, globalCtx, this->randoGiEntry); } } @@ -1389,10 +1389,8 @@ void EnItem00_DrawCollectible(EnItem00* this, GlobalContext* globalCtx) { if (gSaveContext.n64ddFlag && (this->getItemId != GI_NONE || this->actor.params == ITEM00_SMALL_KEY)) { f32 mtxScale = 16.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); - GetItemEntry randoGetItemEntry = - Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, this->ogParams, this->getItemId); - EnItem00_CustomItemsParticles(&this->actor, globalCtx, randoGetItemEntry); - GetItemEntry_Draw(globalCtx, randoGetItemEntry); + EnItem00_CustomItemsParticles(&this->actor, globalCtx, this->randoGiEntry); + GetItemEntry_Draw(globalCtx, this->randoGiEntry); } else { s32 texIndex = this->actor.params - 3; @@ -1451,10 +1449,8 @@ void EnItem00_DrawHeartPiece(EnItem00* this, GlobalContext* globalCtx) { if (gSaveContext.n64ddFlag) { f32 mtxScale = 16.0f; Matrix_Scale(mtxScale, mtxScale, mtxScale, MTXMODE_APPLY); - GetItemEntry randoGetItemEntry = - Randomizer_GetItemFromActor(this->actor.id, globalCtx->sceneNum, this->ogParams, GI_HEART_PIECE); - EnItem00_CustomItemsParticles(&this->actor, globalCtx, randoGetItemEntry); - GetItemEntry_Draw(globalCtx, randoGetItemEntry); + EnItem00_CustomItemsParticles(&this->actor, globalCtx, this->randoGiEntry); + GetItemEntry_Draw(globalCtx, this->randoGiEntry); } else { s32 pad; From 36b42635d623918d1e1d4aa9f5a7e813f6bd623a Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Thu, 20 Oct 2022 09:45:12 -0400 Subject: [PATCH 5/5] chore: bump version --- CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 367360081..85c5ba41c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,8 +7,8 @@ set(CMAKE_CXX_STANDARD 20 CACHE STRING "The C++ standard to use") set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version" FORCE) project(Ship LANGUAGES C CXX - VERSION 4.0.3) -set(PROJECT_BUILD_NAME "ZHORA DELTA" CACHE STRING "") + VERSION 4.0.4) +set(PROJECT_BUILD_NAME "ZHORA ECHO" CACHE STRING "") set(PROJECT_TEAM "github.com/harbourmasters" CACHE STRING "") set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT soh)