From 9c1336831c647e397eb41dc5d366cc1f321d3cd0 Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Sun, 3 Sep 2023 21:25:20 -0500 Subject: [PATCH] More synced actions Co-authored-by: PurpleHato --- .../actors/ovl_Bg_Bombwall/z_bg_bombwall.c | 4 +++- .../actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c | 4 +++- .../ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c | 6 ++++-- .../z_bg_hidan_firewall.c | 20 +++++++++++++++++++ .../ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c | 4 +++- .../ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c | 4 +++- .../z_bg_hidan_kowarerukabe.c | 4 +++- .../ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c | 6 ++++-- .../z_bg_jya_bombchuiwa.c | 4 +++- .../ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c | 4 +++- .../ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c | 4 +++- .../z_bg_spot08_bakudankabe.c | 4 +++- .../z_bg_spot11_bakudankabe.c | 5 +++-- .../z_bg_spot17_bakudankabe.c | 4 +++- .../ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c | 4 +++- 15 files changed, 64 insertions(+), 17 deletions(-) diff --git a/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c b/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c index a2f2d241ce8..6f7f8ea940b 100644 --- a/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c +++ b/soh/src/overlays/actors/ovl_Bg_Bombwall/z_bg_bombwall.c @@ -211,7 +211,9 @@ void func_8086ED50(BgBombwall* this, PlayState* play) { } void func_8086ED70(BgBombwall* this, PlayState* play) { - if (this->collider.base.acFlags & AC_HIT) { + // #region SOH [Co-op] + if ((this->collider.base.acFlags & AC_HIT) || Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + // #endregion this->collider.base.acFlags &= ~AC_HIT; func_8086EDFC(this, play); Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c b/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c index 1f0c98f0424..957910362d0 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c @@ -268,7 +268,9 @@ void func_80882E54(BgHakaZou* this, PlayState* play) { } void func_80883000(BgHakaZou* this, PlayState* play) { - if (this->collider.base.acFlags & AC_HIT) { + // #region SOH [Co-op] + if ((this->collider.base.acFlags & AC_HIT) || Flags_GetSwitch(play, this->switchFlag)) { + // #endregion Flags_SetSwitch(play, this->switchFlag); if (this->dyna.actor.params == STA_GIANT_BIRD_STATUE) { diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c index 64829acd14e..6a5935b61c4 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c @@ -126,8 +126,10 @@ void BgHidanDalm_Destroy(Actor* thisx, PlayState* play) { void BgHidanDalm_Wait(BgHidanDalm* this, PlayState* play) { Player* player = GET_PLAYER(play); - if ((this->collider.base.acFlags & AC_HIT) && !Player_InCsMode(play) && - (player->meleeWeaponAnimation == 22 || player->meleeWeaponAnimation == 23)) { + // #region SOH [Co-op] + if (((this->collider.base.acFlags & AC_HIT) && !Player_InCsMode(play) && + (player->meleeWeaponAnimation == 22 || player->meleeWeaponAnimation == 23)) || Flags_GetSwitch(play, this->switchFlag)) { + // #endregion this->collider.base.acFlags &= ~AC_HIT; if ((this->collider.elements[0].info.bumperFlags & BUMP_HIT) || (this->collider.elements[1].info.bumperFlags & BUMP_HIT)) { diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c index 6c1ce1e8fa0..3350ea560fe 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c @@ -6,6 +6,10 @@ #include "z_bg_hidan_firewall.h" #include "objects/object_hidan_objects/object_hidan_objects.h" +#ifdef ENABLE_REMOTE_CONTROL +#include "soh/Enhancements/game-interactor/GameInteractor.h" +#include "soh/Enhancements/game-interactor/GameInteractor_Anchor.h" +#endif #define FLAGS 0 @@ -21,6 +25,8 @@ void BgHidanFirewall_Erupt(BgHidanFirewall* this, PlayState* play); void BgHidanFirewall_Collide(BgHidanFirewall* this, PlayState* play); void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, PlayState* play); +extern s16 gEnPartnerId; + const ActorInit Bg_Hidan_Firewall_InitVars = { ACTOR_BG_HIDAN_FIREWALL, ACTORCAT_BG, @@ -88,6 +94,20 @@ s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, PlayState* play) { player = GET_PLAYER(play); func_8002DBD0(&this->actor, &distance, &player->actor.world.pos); +#ifdef ENABLE_REMOTE_CONTROL + Actor* actor = gPlayState->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; + while (actor != NULL) { + if (gEnPartnerId == actor->id && Anchor_GetClientRoomIndex(actor->params - 3) == gPlayState->roomCtx.curRoom.num && Anchor_GetClientScene(actor->params - 3) == gPlayState->sceneNum) { + Vec3f actorDistance; + func_8002DBD0(&this->actor, &actorDistance, &actor->world.pos); + if (fabsf(actorDistance.x) < 100.0f && fabsf(actorDistance.z) < 120.0f) { + return 1; + } + } + actor = actor->next; + } +#endif + if (fabsf(distance.x) < 100.0f && fabsf(distance.z) < 120.0f) { return 1; } diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index c0ffd1c8bf9..c7911907c91 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -278,7 +278,9 @@ void func_80888734(BgHidanHamstep* this) { } void func_808887C4(BgHidanHamstep* this, PlayState* play) { - if (this->collider.base.acFlags & AC_HIT) { + // #region SOH [Co-op] + if ((this->collider.base.acFlags & AC_HIT) || Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0xFF)) { + // #endregion OnePointCutscene_Init(play, 3310, 100, &this->dyna.actor, MAIN_CAM); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_HAMMER_SWITCH); this->collider.base.acFlags = AC_NONE; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c index ea49fbd4f71..5079c200ed9 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Hrock/z_bg_hidan_hrock.c @@ -201,7 +201,9 @@ void func_8088960C(BgHidanHrock* this, PlayState* play) { } void func_808896B8(BgHidanHrock* this, PlayState* play) { - if (this->collider.base.acFlags & 2) { + // #region SOH [Co-op] + if ((this->collider.base.acFlags & 2) || Flags_GetSwitch(play, this->unk_16A)) { + // #endregion this->collider.base.acFlags &= ~2; this->actionFunc = func_808894B0; this->dyna.actor.flags |= ACTOR_FLAG_UPDATE_WHILE_CULLED; diff --git a/soh/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c b/soh/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c index ee303a1787c..8bd0e78e7ce 100644 --- a/soh/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Hidan_Kowarerukabe/z_bg_hidan_kowarerukabe.c @@ -303,7 +303,9 @@ void BgHidanKowarerukabe_Update(Actor* thisx, PlayState* play) { BgHidanKowarerukabe* this = (BgHidanKowarerukabe*)thisx; s32 pad; - if (Actor_GetCollidedExplosive(play, &this->collider.base) != NULL) { + // #region SOH [Co-op] + if ((Actor_GetCollidedExplosive(play, &this->collider.base) != NULL) || Flags_GetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F)) { + // #endregion BgHidanKowarerukabe_Break(this, play); Flags_SetSwitch(play, (this->dyna.actor.params >> 8) & 0x3F); diff --git a/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c b/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c index 847cf1dcf46..9de80958b03 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c +++ b/soh/src/overlays/actors/ovl_Bg_Ice_Shelter/z_bg_ice_shelter.c @@ -332,10 +332,12 @@ void func_8089107C(BgIceShelter* this, PlayState* play) { MeltOnIceArrowHit(this, this->cylinder2, type, play); } // Default blue fire check - if (this->cylinder1.base.acFlags & AC_HIT) { + // #region SOH [Co-op] + if ((this->cylinder1.base.acFlags & AC_HIT) || Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { this->cylinder1.base.acFlags &= ~AC_HIT; - if ((this->cylinder1.base.ac != NULL) && (this->cylinder1.base.ac->id == ACTOR_EN_ICE_HONO)) { + if (((this->cylinder1.base.ac != NULL) && (this->cylinder1.base.ac->id == ACTOR_EN_ICE_HONO)) || Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + // #endregion if (type == 4) { if (this->dyna.actor.parent != NULL) { this->dyna.actor.parent->freezeTimer = 50; diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c b/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c index cb36b743dbf..bb7333c520c 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c @@ -142,7 +142,9 @@ void BgJyaBombchuiwa_SetupWaitForExplosion(BgJyaBombchuiwa* this, PlayState* pla } void BgJyaBombchuiwa_WaitForExplosion(BgJyaBombchuiwa* this, PlayState* play) { - if ((this->collider.base.acFlags & AC_HIT) || (this->timer > 0)) { + // #region SOH [Co-op] + if (((this->collider.base.acFlags & AC_HIT) || (this->timer > 0)) || Flags_GetSwitch(play, this->actor.params & 0x3F)) { + // #endregion if (this->timer == 0) { OnePointCutscene_Init(play, 3410, -99, &this->actor, MAIN_CAM); } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c b/soh/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c index d0e4b947178..9edb9edc65d 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Bombiwa/z_bg_jya_bombiwa.c @@ -163,7 +163,9 @@ void BgJyaBombiwa_Break(BgJyaBombiwa* this, PlayState* play) { void BgJyaBombiwa_Update(Actor* thisx, PlayState* play) { BgJyaBombiwa* this = (BgJyaBombiwa*)thisx; - if (this->collider.base.acFlags & AC_HIT) { + // #region SOH [Co-op] + if ((this->collider.base.acFlags & AC_HIT) || Flags_GetSwitch(play, this->dyna.actor.params & 0x3F)) { + // #endregion BgJyaBombiwa_Break(this, play); Flags_SetSwitch(play, this->dyna.actor.params & 0x3F); SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); diff --git a/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c b/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c index 06c2381e923..3d1fdcd3af1 100644 --- a/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c +++ b/soh/src/overlays/actors/ovl_Bg_Mizu_Bwall/z_bg_mizu_bwall.c @@ -467,7 +467,9 @@ void BgMizuBwall_SpawnDebris(BgMizuBwall* this, PlayState* play) { void BgMizuBwall_Idle(BgMizuBwall* this, PlayState* play) { BgMizuBwall_SetAlpha(this, play); - if (this->collider.base.acFlags & AC_HIT) { + // #region SOH [Co-op] + if ((this->collider.base.acFlags & AC_HIT) || Flags_GetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F)) { + // #endregion this->collider.base.acFlags &= ~AC_HIT; Flags_SetSwitch(play, ((u16)this->dyna.actor.params >> 8) & 0x3F); this->breakTimer = 1; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c b/soh/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c index af09141fde5..6311d8aa0f8 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot08_Bakudankabe/z_bg_spot08_bakudankabe.c @@ -183,7 +183,9 @@ void BgSpot08Bakudankabe_Destroy(Actor* thisx, PlayState* play) { void BgSpot08Bakudankabe_Update(Actor* thisx, PlayState* play) { BgSpot08Bakudankabe* this = (BgSpot08Bakudankabe*)thisx; - if (this->collider.base.acFlags & AC_HIT) { + // #region SOH [Co-op] + if ((this->collider.base.acFlags & AC_HIT) || Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { + // #endregion func_808B0324(this, play); Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); diff --git a/soh/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c b/soh/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c index 11241004a2a..11580b62c56 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot11_Bakudankabe/z_bg_spot11_bakudankabe.c @@ -134,8 +134,9 @@ void BgSpot11Bakudankabe_Destroy(Actor* thisx, PlayState* play) { void BgSpot11Bakudankabe_Update(Actor* thisx, PlayState* play) { BgSpot11Bakudankabe* this = (BgSpot11Bakudankabe*)thisx; - - if (this->collider.base.acFlags & AC_HIT) { + // #region SOH [Co-op] + if ((this->collider.base.acFlags & AC_HIT) || Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { + // #endregion func_808B2218(this, play); Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); SoundSource_PlaySfxAtFixedWorldPos(play, &D_808B2738, 40, NA_SE_EV_WALL_BROKEN); diff --git a/soh/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c b/soh/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c index 08f8e36b51b..73251148eb6 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot17_Bakudankabe/z_bg_spot17_bakudankabe.c @@ -114,7 +114,9 @@ void BgSpot17Bakudankabe_Destroy(Actor* thisx, PlayState* play) { void BgSpot17Bakudankabe_Update(Actor* thisx, PlayState* play) { BgSpot17Bakudankabe* this = (BgSpot17Bakudankabe*)thisx; - if (this->dyna.actor.xzDistToPlayer < 650.0f && func_80033684(play, &this->dyna.actor) != NULL) { + // #region SOH [Co-op] + if ((this->dyna.actor.xzDistToPlayer < 650.0f && func_80033684(play, &this->dyna.actor) != NULL) || Flags_GetSwitch(play, (this->dyna.actor.params & 0x3F))) { + // #endregion func_808B6BC0(this, play); Flags_SetSwitch(play, (this->dyna.actor.params & 0x3F)); SoundSource_PlaySfxAtFixedWorldPos(play, &this->dyna.actor.world.pos, 40, NA_SE_EV_WALL_BROKEN); diff --git a/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c b/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c index 9a38cfa5efa..b8bae4968ea 100644 --- a/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c +++ b/soh/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c @@ -146,7 +146,9 @@ void func_808BEFF4(BgYdanMaruta* this, PlayState* play) { } void func_808BF078(BgYdanMaruta* this, PlayState* play) { - if (this->collider.base.acFlags & AC_HIT) { + // #region SOH [Co-op] + if ((this->collider.base.acFlags & AC_HIT) || Flags_GetSwitch(play, this->switchFlag)) { + // #endregion this->unk_16A = 20; Flags_SetSwitch(play, this->switchFlag); func_80078884(NA_SE_SY_CORRECT_CHIME);