From e55e909477cf2f068780c1bf95e0584e675f6383 Mon Sep 17 00:00:00 2001 From: fig02 Date: Thu, 17 Oct 2024 21:44:35 -0400 Subject: [PATCH] Document `ACTOR_FLAG_UPDATE_DURING_OCARINA` and `PLAYER_STATE2_USING_OCARINA` (#2277) * Document ACTOR_FLAG_UPDATE_DURING_OCARINA * document PLAYER_STATE2_USING_OCARINA * format * comment tweak * treat var as flag --- include/z64actor.h | 6 ++++-- include/z64player.h | 2 +- src/code/z_actor.c | 12 ++++++------ src/code/z_player_call.c | 5 +++-- src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c | 2 +- src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c | 2 +- src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c | 2 +- .../actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 2 +- src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c | 2 +- src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 2 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 2 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 4 ++-- src/overlays/actors/ovl_En_Du/z_en_du.c | 2 +- src/overlays/actors/ovl_En_Elf/z_en_elf.c | 2 +- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 2 +- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 2 +- src/overlays/actors/ovl_En_Gs/z_en_gs.c | 2 +- .../ovl_En_Horse_Link_Child/z_en_horse_link_child.c | 2 +- src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c | 2 +- src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c | 4 +++- src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c | 2 +- src/overlays/actors/ovl_En_Kanban/z_en_kanban.c | 2 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 4 +++- src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 4 +++- src/overlays/actors/ovl_En_Md/z_en_md.c | 2 +- .../ovl_En_Okarina_Effect/z_en_okarina_effect.c | 2 +- .../actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c | 2 +- src/overlays/actors/ovl_En_Sa/z_en_sa.c | 2 +- src/overlays/actors/ovl_En_Skj/z_en_skj.c | 4 ++-- src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c | 2 +- src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c | 2 +- src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c | 2 +- .../actors/ovl_Obj_Timeblock/z_obj_timeblock.c | 3 ++- .../actors/ovl_Obj_Warp2block/z_obj_warp2block.c | 3 ++- .../actors/ovl_Object_Kankyo/z_object_kankyo.c | 2 +- src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c | 2 +- src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c | 2 +- src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c | 2 +- src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c | 2 +- src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c | 2 +- src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c | 2 +- src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 2 +- src/overlays/actors/ovl_player_actor/z_player.c | 8 +++++--- 43 files changed, 67 insertions(+), 54 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index 662a40efa8..503ad0f3f6 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -191,8 +191,10 @@ typedef struct ActorShape { // #define ACTOR_FLAG_24 (1 << 24) -// -#define ACTOR_FLAG_25 (1 << 25) +// Actor can update even if Player is currently using the ocarina. +// Typically an actor will halt while the ocarina is active (depending on category). +// This flag allows a given actor to be an exception. +#define ACTOR_FLAG_UPDATE_DURING_OCARINA (1 << 25) // #define ACTOR_FLAG_26 (1 << 26) diff --git a/include/z64player.h b/include/z64player.h index 7ec9cd9065..c82f54bc9c 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -729,7 +729,7 @@ typedef struct WeaponInfo { #define PLAYER_STATE2_24 (1 << 24) #define PLAYER_STATE2_25 (1 << 25) #define PLAYER_STATE2_26 (1 << 26) -#define PLAYER_STATE2_27 (1 << 27) +#define PLAYER_STATE2_USING_OCARINA (1 << 27) // Playing the ocarina or warping out from an ocarina warp song #define PLAYER_STATE2_IDLE_FIDGET (1 << 28) // Playing a fidget idle animation (under typical circumstances, see `Player_ChooseNextIdleAnim` for more info) #define PLAYER_STATE2_29 (1 << 29) #define PLAYER_STATE2_30 (1 << 30) diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 49ee7e9431..cbefaea19d 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -2338,7 +2338,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { Actor* actor; Player* player; u32* categoryFreezeMaskP; - u32 requiredActorFlag; + u32 freezeExceptionFlag; u32 canFreezeCategory; Actor* sp74; ActorEntry* actorEntry; @@ -2351,7 +2351,7 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { } sp74 = NULL; - requiredActorFlag = 0; + freezeExceptionFlag = 0; if (play->numActorEntries != 0) { actorEntry = &play->actorEntryList[0]; @@ -2377,8 +2377,8 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { categoryFreezeMaskP = &sCategoryFreezeMasks[0]; - if (player->stateFlags2 & PLAYER_STATE2_27) { - requiredActorFlag = ACTOR_FLAG_25; + if (player->stateFlags2 & PLAYER_STATE2_USING_OCARINA) { + freezeExceptionFlag = ACTOR_FLAG_UPDATE_DURING_OCARINA; } if ((player->stateFlags1 & PLAYER_STATE1_TALKING) && ((player->actor.textId & 0xFF00) != 0x600)) { @@ -2406,8 +2406,8 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { } else if (!Object_IsLoaded(&play->objectCtx, actor->objectSlot)) { Actor_Kill(actor); actor = actor->next; - } else if ((requiredActorFlag && !(actor->flags & requiredActorFlag)) || - (!requiredActorFlag && canFreezeCategory && + } else if ((freezeExceptionFlag != 0 && !(actor->flags & freezeExceptionFlag)) || + (freezeExceptionFlag == 0 && canFreezeCategory && !((sp74 == actor) || (actor == player->naviActor) || (actor == player->heldActor) || (&player->actor == actor->parent)))) { CollisionCheck_ResetDamage(&actor->colChkInfo); diff --git a/src/code/z_player_call.c b/src/code/z_player_call.c index 64680a0d09..6859e5731f 100644 --- a/src/code/z_player_call.c +++ b/src/code/z_player_call.c @@ -1,7 +1,8 @@ #include "global.h" -#define FLAGS \ - (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_26) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | \ + ACTOR_FLAG_UPDATE_DURING_OCARINA | ACTOR_FLAG_26) #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ "ntsc-1.2:128 pal-1.1:128" diff --git a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c index d75efab0c9..c590f341e5 100644 --- a/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c +++ b/src/overlays/actors/ovl_Arrow_Fire/z_arrow_fire.c @@ -7,7 +7,7 @@ #include "z_arrow_fire.h" #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void ArrowFire_Init(Actor* thisx, PlayState* play); void ArrowFire_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c index 010a110a13..09815d086c 100644 --- a/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c +++ b/src/overlays/actors/ovl_Arrow_Ice/z_arrow_ice.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void ArrowIce_Init(Actor* thisx, PlayState* play); void ArrowIce_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c index 9a0691649b..f88e2c092e 100644 --- a/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c +++ b/src/overlays/actors/ovl_Arrow_Light/z_arrow_light.c @@ -8,7 +8,7 @@ #include "overlays/actors/ovl_En_Arrow/z_en_arrow.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void ArrowLight_Init(Actor* thisx, PlayState* play); void ArrowLight_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index a7d11b1262..89928eb6e3 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -15,7 +15,7 @@ #if OOT_VERSION < NTSC_1_1 #define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5) #else -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_UPDATE_DURING_OCARINA) #endif typedef enum BgDyYoseizoRewardType { diff --git a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c index 0467318591..2a3e8c4531 100644 --- a/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c +++ b/src/overlays/actors/ovl_Demo_Effect/z_demo_effect.c @@ -446,7 +446,7 @@ void DemoEffect_Init(Actor* thisx, PlayState* play2) { case DEMO_EFFECT_TIMEWARP_TIMEBLOCK_LARGE: case DEMO_EFFECT_TIMEWARP_TIMEBLOCK_SMALL: - this->actor.flags |= ACTOR_FLAG_25; + this->actor.flags |= ACTOR_FLAG_UPDATE_DURING_OCARINA; FALLTHROUGH; case DEMO_EFFECT_TIMEWARP_MASTERSWORD: this->initDrawFunc = DemoEffect_DrawTimeWarp; diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 9cb632da8a..caea0b981f 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -252,7 +252,7 @@ void DemoKankyo_Init(Actor* thisx, PlayState* play) { case DEMOKANKYO_WARP_OUT: case DEMOKANKYO_WARP_IN: Actor_ChangeCategory(play, &play->actorCtx, &this->actor, ACTORCAT_ITEMACTION); - this->actor.flags |= ACTOR_FLAG_25; + this->actor.flags |= ACTOR_FLAG_UPDATE_DURING_OCARINA; this->actor.room = -1; this->warpTimer = 35; this->sparkleCounter = 0; diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 7ad6013661..b2b735c3ad 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -7,7 +7,7 @@ #include "z_door_ana.h" #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" -#define FLAGS ACTOR_FLAG_25 +#define FLAGS ACTOR_FLAG_UPDATE_DURING_OCARINA void DoorAna_Init(Actor* thisx, PlayState* play); void DoorAna_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index 012ab4fd60..9468fae6bb 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -146,7 +146,7 @@ void EnBox_Init(Actor* thisx, PlayState* play2) { this->dyna.actor.flags |= ACTOR_FLAG_4; } else if (this->type == ENBOX_TYPE_9 || this->type == ENBOX_TYPE_10) { EnBox_SetupAction(this, func_809C9700); - this->dyna.actor.flags |= ACTOR_FLAG_25; + this->dyna.actor.flags |= ACTOR_FLAG_UPDATE_DURING_OCARINA; DynaPoly_DisableCollision(play, &play->colCtx.dyna, this->dyna.bgId); this->movementFlags |= ENBOX_MOVE_IMMOBILE; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y - 50.0f; @@ -308,7 +308,7 @@ void func_809C9700(EnBox* this, PlayState* play) { } else if (this->unk_1FB == ENBOX_STATE_2 && play->msgCtx.ocarinaMode == OCARINA_MODE_04) { if ((play->msgCtx.lastPlayedSong == OCARINA_SONG_LULLABY && this->type == ENBOX_TYPE_9) || (play->msgCtx.lastPlayedSong == OCARINA_SONG_SUNS && this->type == ENBOX_TYPE_10)) { - this->dyna.actor.flags &= ~ACTOR_FLAG_25; + this->dyna.actor.flags &= ~ACTOR_FLAG_UPDATE_DURING_OCARINA; EnBox_SetupAction(this, EnBox_AppearInit); OnePointCutscene_Attention(play, &this->dyna.actor); this->unk_1A8 = 0; diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index c8e747e31e..67ddf4a1f7 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -2,7 +2,7 @@ #include "assets/objects/object_du/object_du.h" #include "assets/scenes/overworld/spot18/spot18_scene.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnDu_Init(Actor* thisx, PlayState* play); void EnDu_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 95677f121a..fb5760adb3 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -8,7 +8,7 @@ #include "global.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_UPDATE_DURING_OCARINA) #define FAIRY_FLAG_TIMED (1 << 8) #define FAIRY_FLAG_BIG (1 << 9) diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 9bf9969247..5a8dd2995a 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -3,7 +3,7 @@ #include "terminal.h" #include "assets/objects/object_fr/object_fr.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnFr_Init(Actor* thisx, PlayState* play); void EnFr_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 798d7e509d..0e911a1e24 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -8,7 +8,7 @@ #include "assets/objects/object_fu/object_fu.h" #include "assets/scenes/indoors/hakasitarelay/hakasitarelay_scene.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) #define FU_RESET_LOOK_ANGLE (1 << 0) #define FU_WAIT (1 << 1) diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 41bc282cb9..c6c3aefd68 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -9,7 +9,7 @@ #include "overlays/actors/ovl_En_Elf/z_en_elf.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnGs_Init(Actor* thisx, PlayState* play); void EnGs_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index a626ae27f3..c23c2a68de 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -7,7 +7,7 @@ #include "z_en_horse_link_child.h" #include "assets/objects/object_horse_link_child/object_horse_link_child.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnHorseLinkChild_Init(Actor* thisx, PlayState* play); void EnHorseLinkChild_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index c82d070bcf..eae5c35a2c 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -8,7 +8,7 @@ #include "terminal.h" #include "assets/objects/object_ka/object_ka.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnKakasi_Init(Actor* thisx, PlayState* play); void EnKakasi_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index b624b5f890..d169c933ed 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -8,7 +8,9 @@ #include "terminal.h" #include "assets/objects/object_ka/object_ka.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25 | ACTOR_FLAG_LOCK_ON_DISABLED) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_UPDATE_DURING_OCARINA | \ + ACTOR_FLAG_LOCK_ON_DISABLED) static ColliderCylinderInit sCylinderInit = { { diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index 1cc893ad5e..e71d045750 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -8,7 +8,7 @@ #include "terminal.h" #include "assets/objects/object_ka/object_ka.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnKakasi3_Init(Actor* thisx, PlayState* play); void EnKakasi3_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index c2631f471b..a1a0369a4a 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -406,7 +406,7 @@ void EnKanban_Update(Actor* thisx, PlayState* play2) { } piece->airTimer = 100; piece->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - piece->actor.flags |= ACTOR_FLAG_25; + piece->actor.flags |= ACTOR_FLAG_UPDATE_DURING_OCARINA; this->cutMarkTimer = 5; Actor_PlaySfx(&this->actor, NA_SE_IT_SWORD_STRIKE); } diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index 403613d826..f8c42427d0 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -7,7 +7,9 @@ #include "z_en_ma1.h" #include "assets/objects/object_ma1/object_ma1.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_5 | \ + ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnMa1_Init(Actor* thisx, PlayState* play); void EnMa1_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 10ed772e4c..7131f697b5 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -1,7 +1,9 @@ #include "z_en_ma2.h" #include "assets/objects/object_ma2/object_ma2.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_5 | \ + ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnMa2_Init(Actor* thisx, PlayState* play); void EnMa2_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index 37ae4b40fd..ab0d130a70 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -8,7 +8,7 @@ #include "assets/objects/object_md/object_md.h" #include "overlays/actors/ovl_En_Elf/z_en_elf.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnMd_Init(Actor* thisx, PlayState* play); void EnMd_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c index 777c6651f6..305740a431 100644 --- a/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c +++ b/src/overlays/actors/ovl_En_Okarina_Effect/z_en_okarina_effect.c @@ -10,7 +10,7 @@ #include "z64frame_advance.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnOkarinaEffect_Init(Actor* thisx, PlayState* play); void EnOkarinaEffect_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index 0fad60729e..a959b46b4c 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -10,7 +10,7 @@ #include "terminal.h" #include "versions.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnOkarinaTag_Init(Actor* thisx, PlayState* play); void EnOkarinaTag_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index bd7f2d3b4f..72eba29b61 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -4,7 +4,7 @@ #include "assets/scenes/overworld/spot04/spot04_scene.h" #include "assets/scenes/overworld/spot05/spot05_scene.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnSa_Init(Actor* thisx, PlayState* play); void EnSa_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index 16fb37be74..040490ed51 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -2,7 +2,7 @@ #include "overlays/actors/ovl_En_Skjneedle/z_en_skjneedle.h" #include "assets/objects/object_skj/object_skj.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void EnSkj_Init(Actor* thisx, PlayState* play2); void EnSkj_Destroy(Actor* thisx, PlayState* play); @@ -412,7 +412,7 @@ void EnSkj_Init(Actor* thisx, PlayState* play2) { } if ((type < 0) || (type >= 7)) { - this->actor.flags &= ~ACTOR_FLAG_25; + this->actor.flags &= ~ACTOR_FLAG_UPDATE_DURING_OCARINA; } if ((type > 0) && (type < 3)) { diff --git a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index 6049a19a27..fc298fca8b 100644 --- a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -7,7 +7,7 @@ #include "z_magic_dark.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void MagicDark_Init(Actor* thisx, PlayState* play); void MagicDark_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c index 3895bac8be..e36a673c95 100644 --- a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -6,7 +6,7 @@ #include "z_magic_fire.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void MagicFire_Init(Actor* thisx, PlayState* play); void MagicFire_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c index f8a9e829e2..1126ae5b0a 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -6,7 +6,7 @@ #include "z_magic_wind.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void MagicWind_Init(Actor* thisx, PlayState* play); void MagicWind_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index c29b73daa2..0235a0513c 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -7,7 +7,8 @@ #include "z_obj_timeblock.h" #include "assets/objects/object_timeblock/object_timeblock.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_LOCK_ON_DISABLED) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA | ACTOR_FLAG_LOCK_ON_DISABLED) void ObjTimeblock_Init(Actor* thisx, PlayState* play); void ObjTimeblock_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index dcb3428672..7877b148a7 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -8,7 +8,8 @@ #include "assets/objects/object_timeblock/object_timeblock.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_25 | ACTOR_FLAG_LOCK_ON_DISABLED) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA | ACTOR_FLAG_LOCK_ON_DISABLED) void ObjWarp2block_Init(Actor* thisx, PlayState* play2); void ObjWarp2block_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index ca6b10c04a..df08e74937 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -9,7 +9,7 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/object_spot02_objects/object_spot02_objects.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void ObjectKankyo_Init(Actor* thisx, PlayState* play); void ObjectKankyo_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index dd421a8128..0c229ebb12 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -7,7 +7,7 @@ #include "z_oceff_spot.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffSpot_Init(Actor* thisx, PlayState* play); void OceffSpot_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index 931b67930f..3d95b4651e 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -6,7 +6,7 @@ #include "z_oceff_storm.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffStorm_Init(Actor* thisx, PlayState* play); void OceffStorm_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index 986abc8b17..4235b1c004 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -7,7 +7,7 @@ #include "z_oceff_wipe.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffWipe_Init(Actor* thisx, PlayState* play); void OceffWipe_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index 1c07cdbf1f..d613381f81 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -7,7 +7,7 @@ #include "z_oceff_wipe2.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffWipe2_Init(Actor* thisx, PlayState* play); void OceffWipe2_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index 5473c3da47..ea5c7eddcd 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -7,7 +7,7 @@ #include "z_oceff_wipe3.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffWipe3_Init(Actor* thisx, PlayState* play); void OceffWipe3_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index 445e395ff0..0aaee51d08 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -7,7 +7,7 @@ #include "z_oceff_wipe4.h" #include "terminal.h" -#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_25) +#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_UPDATE_DURING_OCARINA) void OceffWipe4_Init(Actor* thisx, PlayState* play); void OceffWipe4_Destroy(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 3b8f64972f..4d581a4448 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -69,7 +69,7 @@ void ShotSun_Init(Actor* thisx, PlayState* play) { if (params == 0x40 || params == 0x41) { this->fairySpawnerState = SPAWNER_OUT_OF_RANGE; this->actor.flags |= ACTOR_FLAG_4; - this->actor.flags |= ACTOR_FLAG_25; + this->actor.flags |= ACTOR_FLAG_UPDATE_DURING_OCARINA; this->actionFunc = ShotSun_UpdateFairySpawner; this->actor.flags |= ACTOR_FLAG_LOCK_ON_DISABLED; } else { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 7102321d58..7fb2b90ff3 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -3426,7 +3426,7 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun this->stateFlags1 &= ~(PLAYER_STATE1_2 | PLAYER_STATE1_TALKING | PLAYER_STATE1_26 | PLAYER_STATE1_28 | PLAYER_STATE1_29 | PLAYER_STATE1_31); - this->stateFlags2 &= ~(PLAYER_STATE2_19 | PLAYER_STATE2_27 | PLAYER_STATE2_IDLE_FIDGET); + this->stateFlags2 &= ~(PLAYER_STATE2_19 | PLAYER_STATE2_USING_OCARINA | PLAYER_STATE2_IDLE_FIDGET); this->stateFlags3 &= ~(PLAYER_STATE3_1 | PLAYER_STATE3_3 | PLAYER_STATE3_FLYING_WITH_HOOKSHOT); this->av1.actionVar1 = 0; @@ -6114,7 +6114,7 @@ s32 Player_ActionHandler_13(Player* this, PlayState* play) { } else { Player_SetupActionPreserveItemAction(play, this, Player_Action_8084E3C4, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_okarina_start); - this->stateFlags2 |= PLAYER_STATE2_27; + this->stateFlags2 |= PLAYER_STATE2_USING_OCARINA; func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); if (this->unk_6A8 != NULL) { this->stateFlags2 |= PLAYER_STATE2_25; @@ -13777,8 +13777,10 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) { Player_TryCsAction(play, NULL, PLAYER_CSACTION_8); play->mainCamera.stateFlags &= ~CAM_STATE_EXTERNAL_FINISHED; + // Setting these flags again is necessary because `Player_TryCsAction` calls + // `Player_SetupAction` which unsets the flags. this->stateFlags1 |= PLAYER_STATE1_28 | PLAYER_STATE1_29; - this->stateFlags2 |= PLAYER_STATE2_27; + this->stateFlags2 |= PLAYER_STATE2_USING_OCARINA; if (Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, 0.0f, 0.0f, 0.0f, 0, 0, 0, DEMOKANKYO_WARP_OUT) == NULL) {