diff --git a/include/z64actor.h b/include/z64actor.h index 47f0c55065..5218cba276 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -504,10 +504,12 @@ typedef enum DoorLockType { #define ACTOR_FLAG_IGNORE_QUAKE (1 << 12) // #define ACTOR_FLAG_2000 (1 << 13) -// -#define ACTOR_FLAG_4000 (1 << 14) -//! Carried by arrow -#define ACTOR_FLAG_8000 (1 << 15) + +// When hit by an arrow, the actor will be able to attach to the arrow and fly with it in the air +#define ACTOR_FLAG_CAN_ATTACH_TO_ARROW (1 << 14) + +// Actor is currently attached to an arrow and flying with it in the air +#define ACTOR_FLAG_ATTACHED_TO_ARROW (1 << 15) // Player automatically accepts a Talk Offer without needing to press the A button. // Player still has to meet all conditions to be able to receive a talk offer (for example, being in range). diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index c029c6bd25..fb655869f1 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -181,7 +181,7 @@ void EnArrow_Destroy(Actor* thisx, PlayState* play) { Collider_DestroyQuad(play, &this->collider); if ((this->unk_264 != NULL) && (this->unk_264->update != NULL)) { - this->unk_264->flags &= ~ACTOR_FLAG_8000; + this->unk_264->flags &= ~ACTOR_FLAG_ATTACHED_TO_ARROW; } if (ARROW_IS_MAGICAL(this->actor.params) && (this->actor.child == NULL)) { @@ -439,11 +439,11 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { sp7C = this->collider.base.at; if ((sp7C->update != NULL) && !(this->collider.base.atFlags & AT_BOUNCED) && - (sp7C->flags & ACTOR_FLAG_4000)) { + (sp7C->flags & ACTOR_FLAG_CAN_ATTACH_TO_ARROW)) { this->unk_264 = sp7C; func_8088A894(this, play); Math_Vec3f_Diff(&sp7C->world.pos, &this->actor.world.pos, &this->unk_268); - sp7C->flags |= ACTOR_FLAG_8000; + sp7C->flags |= ACTOR_FLAG_ATTACHED_TO_ARROW; this->collider.base.atFlags &= ~AT_HIT; this->actor.speed *= 0.5f; this->actor.velocity.y *= 0.5f; @@ -542,14 +542,14 @@ void func_8088ACE0(EnArrow* this, PlayState* play) { this->unk_264->world.pos.z = ((sp54.z <= sp9C.z) ? 1.0f : -1.0f) + sp9C.z; Math_Vec3f_Diff(&this->unk_264->world.pos, &this->actor.world.pos, &this->unk_268); - this->unk_264->flags &= ~ACTOR_FLAG_8000; + this->unk_264->flags &= ~ACTOR_FLAG_ATTACHED_TO_ARROW; this->unk_264 = NULL; } else { Math_Vec3f_Sum(&this->actor.world.pos, &this->unk_268, &this->unk_264->world.pos); } if ((this->unk_262 != 0) && (this->unk_264 != NULL)) { - this->unk_264->flags &= ~ACTOR_FLAG_8000; + this->unk_264->flags &= ~ACTOR_FLAG_ATTACHED_TO_ARROW; this->unk_264 = NULL; } } else { diff --git a/src/overlays/actors/ovl_En_Bat/z_en_bat.c b/src/overlays/actors/ovl_En_Bat/z_en_bat.c index ec1fa4ba18..960366e28a 100644 --- a/src/overlays/actors/ovl_En_Bat/z_en_bat.c +++ b/src/overlays/actors/ovl_En_Bat/z_en_bat.c @@ -8,7 +8,8 @@ #include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "assets/objects/object_bat/object_bat.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_CAN_ATTACH_TO_ARROW) #define THIS ((EnBat*)thisx) @@ -342,7 +343,7 @@ void EnBat_SetupDie(EnBat* this, PlayState* play) { Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); - if (this->actor.flags & ACTOR_FLAG_8000) { + if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { this->actor.speed = 0.0f; } @@ -355,7 +356,7 @@ void EnBat_Die(EnBat* this, PlayState* play) { Math_StepToF(&this->actor.speed, 0.0f, 0.5f); this->actor.colorFilterTimer = 40; - if (!(this->actor.flags & ACTOR_FLAG_8000)) { // Carried by arrow + if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4000, 0x200); this->actor.shape.rot.z += 0x1780; diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index d3201cc2bf..7f9448064c 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -7,7 +7,8 @@ #include "z_en_crow.h" #include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_CAN_ATTACH_TO_ARROW) #define THIS ((EnCrow*)thisx) @@ -327,7 +328,7 @@ void EnCrow_SetupDamaged(EnCrow* this, PlayState* play) { } Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); - if (this->actor.flags & ACTOR_FLAG_8000) { + if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { this->actor.speed = 0.0f; } @@ -341,7 +342,7 @@ void EnCrow_Damaged(EnCrow* this, PlayState* play) { Math_StepToF(&this->actor.speed, 0.0f, 0.5f); this->actor.colorFilterTimer = 40; - if (!(this->actor.flags & ACTOR_FLAG_8000)) { + if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4000, 0x200); this->actor.shape.rot.z += 0x1780; diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.c b/src/overlays/actors/ovl_En_Fg/z_en_fg.c index 4bde42aa99..e56f7d081f 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -7,7 +7,7 @@ #include "z_en_fg.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_200 | ACTOR_FLAG_4000) +#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_200 | ACTOR_FLAG_CAN_ATTACH_TO_ARROW) #define THIS ((EnFg*)thisx) @@ -348,7 +348,7 @@ void EnFg_Init(Actor* thisx, PlayState* play) { Collider_InitCylinder(play, &this->collider); Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit); CollisionCheck_SetInfo2(&this->actor.colChkInfo, &sDamageTable, &sColChkInfoInit2); - this->actor.flags |= ACTOR_FLAG_4000; + this->actor.flags |= ACTOR_FLAG_CAN_ATTACH_TO_ARROW; Actor_SetScale(&this->actor, 0.01f); this->actor.gravity = -1.6f; this->actionFunc = EnFg_Idle; @@ -362,20 +362,12 @@ void EnFg_Destroy(Actor* thisx, PlayState* play) { void EnFg_Update(Actor* thisx, PlayState* play) { EnFg* this = THIS; - s32 flag; - s32 flagSet; - flag = this->actor.flags; - flagSet = CHECK_FLAG_ALL(flag, ACTOR_FLAG_2000); - if (1) {} - if (!flagSet) { - flagSet = CHECK_FLAG_ALL(flag, ACTOR_FLAG_8000); - if (1) {} - if (!flagSet) { - this->actionFunc(this, play); - Actor_UpdateBgCheckInfo(play, &this->actor, sREG(0), sREG(1), 0.0f, - UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); - } + if ((CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_2000) == 0) && + (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_ATTACHED_TO_ARROW) == 0)) { + this->actionFunc(this, play); + Actor_UpdateBgCheckInfo(play, &this->actor, sREG(0), sREG(1), 0.0f, + UPDBGCHECKINFO_FLAG_1 | UPDBGCHECKINFO_FLAG_4); } EnFg_UpdateSkelAnime(this, play); diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index 0e0246d59d..dc86beeece 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -8,7 +8,8 @@ #include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.h" -#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_CAN_ATTACH_TO_ARROW) #define THIS ((EnFirefly*)thisx) @@ -372,7 +373,7 @@ void EnFirefly_SetupFall(EnFirefly* this, PlayState* play) { this->auraType = KEESE_AURA_NONE; } - if (this->actor.flags & ACTOR_FLAG_8000) { + if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { this->actor.speed = 0.0f; } @@ -384,7 +385,7 @@ void EnFirefly_Fall(EnFirefly* this, PlayState* play) { this->actor.colorFilterTimer = 40; Math_StepToF(&this->actor.speed, 0.0f, 0.5f); - if (!(this->actor.flags & ACTOR_FLAG_8000)) { + if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { if (this->drawDmgEffType != ACTOR_DRAW_DMGEFF_FROZEN_NO_SFX) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x6800, 0x200); this->actor.shape.rot.y -= 0x300; @@ -691,7 +692,7 @@ void EnFirefly_Update(Actor* thisx, PlayState* play2) { EnFirefly_UpdateDamage(this, play); this->actionFunc(this, play); - if (!(this->actor.flags & ACTOR_FLAG_8000)) { + if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { if ((this->actor.colChkInfo.health == 0) || (this->actionFunc == EnFirefly_Stunned)) { Actor_MoveWithGravity(&this->actor); } else { diff --git a/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c b/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c index 985e81134e..bd563d600f 100644 --- a/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c +++ b/src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c @@ -6,8 +6,9 @@ #include "z_en_firefly2.h" -#define FLAGS \ - (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_QUAKE | \ + ACTOR_FLAG_CAN_ATTACH_TO_ARROW) #define THIS ((EnFirefly2*)thisx) diff --git a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c index a00fad2d27..988711a542 100644 --- a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c +++ b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c @@ -7,7 +7,7 @@ #include "z_en_jc_mato.h" #include "assets/objects/object_tru/object_tru.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_4000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_CAN_ATTACH_TO_ARROW) #define THIS ((EnJcMato*)thisx) diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 470fdc9979..5c20498d70 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -8,8 +8,9 @@ #include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#define FLAGS \ - (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_4000) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_10 | ACTOR_FLAG_IGNORE_QUAKE | \ + ACTOR_FLAG_CAN_ATTACH_TO_ARROW) #define THIS ((EnPoSisters*)thisx) @@ -198,7 +199,7 @@ void EnPoSisters_Init(Actor* thisx, PlayState* play) { EnPoSisters_SpawnMegClones(this, play); EnPoSisters_SetupSpawnPo(this); } else { - this->actor.flags &= ~(ACTOR_FLAG_200 | ACTOR_FLAG_4000); + this->actor.flags &= ~(ACTOR_FLAG_200 | ACTOR_FLAG_CAN_ATTACH_TO_ARROW); this->collider.elem.elemMaterial = ELEM_MATERIAL_UNK4; this->collider.elem.acDmgInfo.dmgFlags |= (0x40000 | 0x1); this->collider.base.ocFlags1 = OC1_NONE; @@ -529,7 +530,7 @@ void EnPoSisters_SetupDamageFlinch(EnPoSisters* this) { } void EnPoSisters_DamageFlinch(EnPoSisters* this, PlayState* play) { - if (SkelAnime_Update(&this->skelAnime) && !(this->actor.flags & ACTOR_FLAG_8000)) { + if (SkelAnime_Update(&this->skelAnime) && !(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { if (this->actor.colChkInfo.health != 0) { if (this->type != POE_SISTERS_TYPE_MEG) { EnPoSisters_SetupFlee(this); diff --git a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c index 8aa7df6696..8df5260e68 100644 --- a/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c +++ b/src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c @@ -7,7 +7,7 @@ #include "z_en_ruppecrow.h" #include "assets/objects/object_crow/object_crow.h" -#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_4000) +#define FLAGS (ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_CAN_ATTACH_TO_ARROW) #define THIS ((EnRuppecrow*)thisx) @@ -464,7 +464,7 @@ void EnRuppecrow_HandleDeath(EnRuppecrow* this) { } Actor_SetColorFilter(&this->actor, COLORFILTER_COLORFLAG_RED, 255, COLORFILTER_BUFFLAG_OPA, 40); - if (this->actor.flags & ACTOR_FLAG_8000) { + if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { this->actor.speed = 0.0f; } @@ -602,7 +602,7 @@ void EnRuppecrow_FallToDespawn(EnRuppecrow* this, PlayState* play) { } this->actor.colorFilterTimer = 40; - if (!(this->actor.flags & ACTOR_FLAG_8000)) { + if (!(this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW)) { if (this->currentEffect != ENRUPPECROW_EFFECT_ICE) { Math_ScaledStepToS(&this->actor.shape.rot.x, 0x4000, 0x200); this->actor.shape.rot.z += 0x1780; diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index d1a5ccfe6b..59df1484c0 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -8,9 +8,9 @@ #include "overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h" #include "assets/objects/gameplay_keep/gameplay_keep.h" -#define FLAGS \ - (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_10 | ACTOR_FLAG_20 | ACTOR_FLAG_4000 | \ - ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT) +#define FLAGS \ + (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_10 | ACTOR_FLAG_20 | \ + ACTOR_FLAG_CAN_ATTACH_TO_ARROW | ACTOR_FLAG_SFX_FOR_PLAYER_BODY_HIT) #define THIS ((EnSt*)thisx) @@ -877,7 +877,7 @@ void EnSt_Destroy(Actor* thisx, PlayState* play) { void EnSt_Update(Actor* thisx, PlayState* play) { EnSt* this = THIS; - if (this->actor.flags & ACTOR_FLAG_8000) { + if (this->actor.flags & ACTOR_FLAG_ATTACHED_TO_ARROW) { SkelAnime_Update(&this->skelAnime); this->unk_18C |= 0x80; return;