From 1b9ab52e35f8f78b7f1f2aba81e0a20b061bb3e3 Mon Sep 17 00:00:00 2001 From: aMannus Date: Sat, 21 Jan 2023 03:30:49 +0100 Subject: [PATCH] Tweak - Rando freestanding/skulltula ice trap behaviour (#2230) * Improve skulltula ice traps * Improve freestanding ice traps * Merge fix --- soh/src/overlays/actors/ovl_En_Si/z_en_si.c | 33 +++++++++++++------ .../actors/ovl_player_actor/z_player.c | 22 ++++--------- 2 files changed, 30 insertions(+), 25 deletions(-) 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 4a80a683e..344173805 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 @@ -106,15 +106,25 @@ void func_80AFB768(EnSi* this, PlayState* play) { } else { Item_Give(play, giveItemId); } - if ((CVarGetInteger("gSkulltulaFreeze", 0) != 1 || giveItemId != ITEM_SKULL_TOKEN) && getItemId != RG_ICE_TRAP) { + if ((!CVarGetInteger("gSkulltulaFreeze", 0) || giveItemId != ITEM_SKULL_TOKEN) && + getItemId != RG_ICE_TRAP) { player->actor.freezeTimer = 20; } + if (getItemId == RG_ICE_TRAP && Message_GetState(&play->msgCtx) != TEXT_STATE_CLOSING) { + player->actor.freezeTimer = 10; + } + Message_StartTextbox(play, textId, NULL); - if (gSaveContext.n64ddFlag && getItemId != RG_ICE_TRAP) { - Randomizer_GiveSkullReward(this, play); - Audio_PlayFanfare_Rando(getItem); + if (gSaveContext.n64ddFlag) { + if (getItemId != RG_ICE_TRAP) { + Randomizer_GiveSkullReward(this, play); + Audio_PlayFanfare_Rando(getItem); + } else { + gSaveContext.pendingIceTrapCount++; + Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); + } } else { Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); } @@ -145,9 +155,14 @@ void func_80AFB89C(EnSi* this, PlayState* play) { Message_StartTextbox(play, textId, NULL); - if (gSaveContext.n64ddFlag && getItemId != RG_ICE_TRAP) { - Randomizer_GiveSkullReward(this, play); - Audio_PlayFanfare_Rando(getItem); + if (gSaveContext.n64ddFlag) { + if (getItemId != RG_ICE_TRAP) { + Randomizer_GiveSkullReward(this, play); + Audio_PlayFanfare_Rando(getItem); + } else { + gSaveContext.pendingIceTrapCount++; + Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); + } } else { Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); } @@ -161,7 +176,7 @@ void func_80AFB950(EnSi* this, PlayState* play) { Player* player = GET_PLAYER(play); if (Message_GetState(&play->msgCtx) != TEXT_STATE_CLOSING && - ((CVarGetInteger("gSkulltulaFreeze", 0) != 1 || giveItemId != ITEM_SKULL_TOKEN) && getItemId != RG_ICE_TRAP)) { + (!CVarGetInteger("gSkulltulaFreeze", 0) || getItemId == RG_ICE_TRAP || giveItemId != ITEM_SKULL_TOKEN)) { player->actor.freezeTimer = 10; } else { SET_GS_FLAGS((this->actor.params & 0x1F00) >> 8, this->actor.params & 0xFF); @@ -195,7 +210,6 @@ void EnSi_Draw(Actor* thisx, PlayState* play) { } GetItemEntry_Draw(play, getItem); } - } } @@ -205,7 +219,6 @@ void Randomizer_UpdateSkullReward(EnSi* this, PlayState* play) { getItem = Randomizer_GetItemFromActor(this->actor.id, play->sceneNum, this->actor.params, GI_SKULL_TOKEN); getItemId = getItem.getItemId; if (getItemId == RG_ICE_TRAP) { - gSaveContext.pendingIceTrapCount++; textId = 0xF8; } else { textId = getItem.textId; 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 4f381e7d9..aef758377 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -6301,21 +6301,13 @@ s32 func_8083E5A8(Player* this, PlayState* play) { iREG(67) = false; - if (gSaveContext.n64ddFlag && giEntry.getItemId == RG_ICE_TRAP) { - if (giEntry.getItemFrom == ITEM_FROM_FREESTANDING) { - // RANDOTODO: Abstract this to a function. - this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); - this->actor.colChkInfo.damage = 0; - func_80837C0C(play, this, 3, 0.0f, 0.0f, 0, 20); - Player_SetPendingFlag(this, play); - Message_StartTextbox(play, 0xF8, NULL); - Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); - this->getItemId = GI_NONE; - this->getItemEntry = (GetItemEntry) GET_ITEM_NONE; - // Gameplay stats: Increment Ice Trap count - gSaveContext.sohStats.count[COUNT_ICE_TRAPS]++; - return 1; - } + if (gSaveContext.n64ddFlag && giEntry.getItemId == RG_ICE_TRAP && giEntry.getItemFrom == ITEM_FROM_FREESTANDING) { + this->actor.freezeTimer = 30; + Player_SetPendingFlag(this, play); + Message_StartTextbox(play, 0xF8, NULL); + Audio_PlayFanfare(NA_BGM_SMALL_ITEM_GET); + gSaveContext.pendingIceTrapCount++; + return 1; } // Show the cutscene for picking up an item. In vanilla, this happens in bombchu bowling alley (because getting bombchus need to show the cutscene)