Skip to content

Commit

Permalink
Fix V!Spirit and MQ!Fire object dependency crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
lilDavid committed Aug 15, 2023
1 parent 25c7646 commit f57bcaf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 3 additions & 1 deletion soh/src/code/z_en_item00.c
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,9 @@ void EnItem00_SetupAction(EnItem00* this, EnItem00ActionFunc actionFunc) {
void EnItem00_SetObjectDependency(EnItem00* this, PlayState* play, s16 objectIndex) {
// Remove object dependency for Enemy Randomizer and Crowd Control to allow Like-likes to
// drop equipment correctly in rooms where Like-likes normally don't spawn.
if (CVarGetInteger("gRandomizedEnemies", 0) || CVarGetInteger("gCrowdControl", 0)) {
// Also remove object dependency for Master Quest Fire Temple to fix the Like-like there
if (CVarGetInteger("gRandomizedEnemies", 0) || CVarGetInteger("gCrowdControl", 0) ||
(ResourceMgr_IsSceneMasterQuest(SCENE_HIDAN) && play->sceneNum == SCENE_HIDAN)) {
this->actor.objBankIndex = 0;
} else {
this->actor.objBankIndex = Object_GetIndex(&play->objectCtx, objectIndex);
Expand Down
7 changes: 7 additions & 0 deletions soh/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ static InitChainEntry sInitChain[] = {
void ObjTsubo_SpawnCollectible(ObjTsubo* this, PlayState* play) {
s16 dropParams = this->actor.params & 0x1F;

// Avoid spawning a Deku Shield if the item isn't loaded.
// Targeted fix for a crash due to a broken drop from the pot in Spirit
// Temple surrounded by a circling spike trap.
if (dropParams == ITEM00_SHIELD_DEKU && Object_GetIndex(&play->objectCtx, OBJECT_GI_SHIELD_1) == -1) {
return;
}

if ((dropParams >= ITEM00_RUPEE_GREEN) && (dropParams <= ITEM00_BOMBS_SPECIAL)) {
Item_DropCollectible(play, &this->actor.world.pos,
(dropParams | (((this->actor.params >> 9) & 0x3F) << 8)));
Expand Down

0 comments on commit f57bcaf

Please sign in to comment.