Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document Arrow Related Actor Flags #1737

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions include/z64actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand Down
10 changes: 5 additions & 5 deletions src/overlays/actors/ovl_En_Arrow/z_en_arrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 4 additions & 3 deletions src/overlays/actors/ovl_En_Bat/z_en_bat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down
7 changes: 4 additions & 3 deletions src/overlays/actors/ovl_En_Crow/z_en_crow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down
24 changes: 8 additions & 16 deletions src/overlays/actors/ovl_En_Fg/z_en_fg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down
9 changes: 5 additions & 4 deletions src/overlays/actors/ovl_En_Firefly/z_en_firefly.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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;
}

Expand All @@ -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;
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions src/overlays/actors/ovl_En_Firefly2/z_en_firefly2.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
9 changes: 5 additions & 4 deletions src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions src/overlays/actors/ovl_En_Ruppecrow/z_en_ruppecrow.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions src/overlays/actors/ovl_En_St/z_en_st.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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;
Expand Down