1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-12-29 00:06:33 +00:00

Name Remaining Hookshot Actor Flags (#2306)

* name remaining hookshot flags

* tweak comments

* period
This commit is contained in:
fig02 2024-11-23 23:19:27 -05:00 committed by GitHub
parent e10c64a0b4
commit 33391c0a5b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
25 changed files with 53 additions and 43 deletions

View file

@ -140,11 +140,11 @@ typedef struct ActorShape {
// Actor will retain this flag until `Actor_TalkOfferAccepted` is called or manually turned off by the actor
#define ACTOR_FLAG_TALK (1 << 8)
//
#define ACTOR_FLAG_9 (1 << 9)
// When the hookshot attaches to this actor, the actor will be pulled back as the hookshot retracts.
#define ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR (1 << 9)
//
#define ACTOR_FLAG_10 (1 << 10)
// When the hookshot attaches to this actor, Player will be pulled by the hookshot and fly to the actor.
#define ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER (1 << 10)
// A clump of grass (EN_KUSA) has been destroyed.
// This flag is used to communicate with the spawner actor (OBJ_MURE).
@ -154,11 +154,11 @@ typedef struct ActorShape {
#define ACTOR_FLAG_IGNORE_QUAKE (1 << 12)
// The hookshot is currently attached to this actor.
// The behavior that occurs after attachment is determined by `ACTOR_FLAG_9` and `ACTOR_FLAG_10`.
// The behavior that occurs after attachment is determined by `ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR` and `ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER`.
// If neither of those flags are set attachment cannot occur, and the hookshot will simply act as a damage source.
//
// This flag is also reused to indicate that an actor is attached to the boomerang.
// This only has an effect for Gold Skulltula Tokens (EN_SI) which has overlapping behavior for hookshot and boomerang
// This only has an effect for Gold Skulltula Tokens (EN_SI) which has overlapping behavior for hookshot and boomerang.
#define ACTOR_FLAG_HOOKSHOT_ATTACHED (1 << 13)
// When hit by an arrow, the actor will be able to attach to the arrow and fly with it in the air

View file

@ -94,7 +94,12 @@ void ArmsHook_Wait(ArmsHook* this, PlayState* play) {
}
}
void func_80865044(ArmsHook* this) {
/**
* Start pulling Player so he flies toward the hookshot's current location.
* Setting Player's parent pointer indicates that he should begin flying.
* See `Player_UpdateUpperBody` and `Player_Action_HookshotFly` for Player's side of the interation.
*/
void ArmsHook_PullPlayer(ArmsHook* this) {
this->actor.child = this->actor.parent;
this->actor.parent->parent = &this->actor;
}
@ -154,12 +159,13 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
(this->collider.elem.atHitElem->elemMaterial != ELEM_MATERIAL_UNK4)) {
Actor* touchedActor = this->collider.base.at;
if ((touchedActor->update != NULL) && (touchedActor->flags & (ACTOR_FLAG_9 | ACTOR_FLAG_10))) {
if ((touchedActor->update != NULL) &&
(touchedActor->flags & (ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER))) {
if (this->collider.elem.atHitElem->acElemFlags & ACELEM_HOOKABLE) {
ArmsHook_AttachToActor(this, touchedActor);
if (CHECK_FLAG_ALL(touchedActor->flags, ACTOR_FLAG_10)) {
func_80865044(this);
if (CHECK_FLAG_ALL(touchedActor->flags, ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)) {
ArmsHook_PullPlayer(this);
}
}
}
@ -230,6 +236,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
newPos.z = bodyDistDiffVec.z * velocity;
if (this->actor.child == NULL) {
// Not pulling Player
if ((attachedActor != NULL) && (attachedActor->id == ACTOR_BG_SPOT06_OBJECTS)) {
Math_Vec3f_Diff(&attachedActor->world.pos, &this->attachPointOffset, &this->actor.world.pos);
phi_f16 = 1.0f;
@ -240,6 +247,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
}
}
} else {
// Pulling Player
Math_Vec3f_Diff(&bodyDistDiffVec, &newPos, &player->actor.velocity);
player->actor.world.rot.x =
Math_Atan2S(sqrtf(SQ(bodyDistDiffVec.x) + SQ(bodyDistDiffVec.z)), -bodyDistDiffVec.y);
@ -290,7 +298,7 @@ void ArmsHook_Shoot(ArmsHook* this, PlayState* play) {
ArmsHook_AttachToActor(this, &dynaPolyActor->actor);
}
}
func_80865044(this);
ArmsHook_PullPlayer(this);
Audio_PlaySfxGeneral(NA_SE_IT_HOOKSHOT_STICK_OBJ, &this->actor.projectedPos, 4,
&gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb);
} else {

View file

@ -7,7 +7,7 @@
#include "z_bg_spot06_objects.h"
#include "assets/objects/object_spot06_objects/object_spot06_objects.h"
#define FLAGS ACTOR_FLAG_9
#define FLAGS ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR
typedef enum LakeHyliaObjectsType {
/* 0x0 */ LHO_WATER_TEMPLE_ENTRACE_GATE,

View file

@ -524,7 +524,7 @@ void BossFd2_Vulnerable(BossFd2* this, PlayState* play) {
s16 i;
this->disableAT = true;
this->actor.flags |= ACTOR_FLAG_10;
this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
SkelAnime_Update(&this->skelAnime);
switch (this->work[FD2_ACTION_STATE]) {
case 0:
@ -960,7 +960,7 @@ void BossFd2_Update(Actor* thisx, PlayState* play2) {
PRINTF("FD2 move start \n");
this->disableAT = false;
this->actor.flags &= ~ACTOR_FLAG_10;
this->actor.flags &= ~ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
this->work[FD2_VAR_TIMER]++;
this->work[FD2_UNK_TIMER]++;

View file

@ -2580,7 +2580,7 @@ void BossGanon_Vulnerable(BossGanon* this, PlayState* play) {
this->fwork[GDF_FWORK_1] = Animation_GetLastFrame(&gGanondorfLandAnim);
Animation_MorphToPlayOnce(&this->skelAnime, &gGanondorfLandAnim, 0.0f);
this->timers[0] = 70;
this->actor.flags |= ACTOR_FLAG_10;
this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
}
break;
@ -2613,7 +2613,7 @@ void BossGanon_Vulnerable(BossGanon* this, PlayState* play) {
this->unk_2E6 = 80;
this->unk_2E8 = 0;
this->actor.flags &= ~ACTOR_FLAG_10;
this->actor.flags &= ~ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
}
break;

View file

@ -748,7 +748,7 @@ void BossGanondrof_Stunned(BossGanondrof* this, PlayState* play) {
Actor_PlaySfx(&this->actor, NA_SE_EN_FANTOM_DAMAGE2);
}
this->actor.flags |= ACTOR_FLAG_10;
this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
}
PRINTF("TIME0 %d ********************************************\n", this->timers[0]);
@ -1297,7 +1297,7 @@ void BossGanondrof_Update(Actor* thisx, PlayState* play) {
BossGanondrof* this = (BossGanondrof*)thisx;
PRINTF("MOVE START %d\n", this->actor.params);
this->actor.flags &= ~ACTOR_FLAG_10;
this->actor.flags &= ~ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
this->colliderBody.base.colMaterial = COL_MATERIAL_HIT3;
if (this->killActor) {
Actor_Kill(&this->actor);

View file

@ -2232,7 +2232,7 @@ void BossMo_UpdateCore(Actor* thisx, PlayState* play) {
} else {
MO_WATER_LEVEL(play) = sMorphaTent2->waterLevelMod + ((s16)this->waterLevel + sMorphaTent1->waterLevelMod);
}
this->actor.flags |= ACTOR_FLAG_9;
this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR;
this->actor.focus.pos = this->actor.world.pos;
this->work[MO_TENT_VAR_TIMER]++;

View file

@ -14,7 +14,8 @@
#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" \
"pal-1.0:128 pal-1.1:128"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_10)
#define FLAGS \
(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)
#define vParity actionVar
#define vVanish actionVar

View file

@ -2974,7 +2974,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, PlayState* play2) {
BossTw* this = (BossTw*)thisx;
Player* player = GET_PLAYER(play);
this->actor.flags &= ~ACTOR_FLAG_10;
this->actor.flags &= ~ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
this->unk_5F8 = 0;
this->collider.base.colMaterial = COL_MATERIAL_HIT3;
@ -5252,7 +5252,7 @@ void BossTw_TwinrovaStun(BossTw* this, PlayState* play) {
s16 cloudType;
this->unk_5F8 = 1;
this->actor.flags |= ACTOR_FLAG_10;
this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
cloudType = sTwinrovaBlastType == 0 ? TWEFF_3 : TWEFF_2;

View file

@ -1,7 +1,7 @@
#include "z_en_dh.h"
#include "assets/objects/object_dh/object_dh.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_10)
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)
typedef enum EnDhAction {
/* 0 */ DH_WAIT,

View file

@ -9,7 +9,7 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_fw/object_fw.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_9)
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR)
void EnFd_Init(Actor* thisx, PlayState* play);
void EnFd_Destroy(Actor* thisx, PlayState* play);

View file

@ -7,7 +7,7 @@
#include "z_en_floormas.h"
#include "assets/objects/object_wallmaster/object_wallmaster.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_10)
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)
#define SPAWN_INVISIBLE 0x8000
#define SPAWN_SMALL 0x10

View file

@ -9,7 +9,7 @@
#include "overlays/actors/ovl_En_Bom/z_en_bom.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_9)
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR)
void EnFw_Init(Actor* thisx, PlayState* play);
void EnFw_Destroy(Actor* thisx, PlayState* play);

View file

@ -1,7 +1,7 @@
#include "z_en_fz.h"
#include "assets/objects/object_fz/object_fz.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_10)
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)
void EnFz_Init(Actor* thisx, PlayState* play);
void EnFz_Destroy(Actor* thisx, PlayState* play);

View file

@ -202,7 +202,7 @@ void EnIk_InitImpl(Actor* thisx, PlayState* play) {
thisx->update = EnIk_UpdateEnemy;
thisx->draw = EnIk_DrawEnemy;
thisx->flags |= ACTOR_FLAG_10;
thisx->flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
Collider_InitCylinder(play, &this->bodyCollider);
Collider_SetCylinder(play, &this->bodyCollider, thisx, &sCylinderInit);

View file

@ -73,7 +73,7 @@ void EnKakasi_Init(Actor* thisx, PlayState* play) {
SkelAnime_InitFlex(play, &this->skelanime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0);
this->rot = this->actor.world.rot;
this->actor.flags |= ACTOR_FLAG_10;
this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
Actor_SetScale(&this->actor, 0.01f);

View file

@ -91,7 +91,7 @@ void EnKakasi2_Init(Actor* thisx, PlayState* play) {
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
this->height = 60.0f;
Actor_SetScale(&this->actor, 0.01f);
this->actor.flags |= ACTOR_FLAG_10;
this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
this->unk_198 = this->actor.shape.rot.y;
if (this->switchFlag >= 0 && Flags_GetSwitch(play, this->switchFlag)) {

View file

@ -76,7 +76,7 @@ void EnKakasi3_Init(Actor* thisx, PlayState* play) {
Collider_InitCylinder(play, &this->collider);
Collider_SetCylinder(play, &this->collider, &this->actor, &sCylinderInit);
SkelAnime_InitFlex(play, &this->skelAnime, &object_ka_Skel_0065B0, &object_ka_Anim_000214, NULL, NULL, 0);
this->actor.flags |= ACTOR_FLAG_10;
this->actor.flags |= ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER;
this->rot = this->actor.world.rot;
this->actor.colChkInfo.mass = MASS_IMMOVABLE;
Actor_SetScale(&this->actor, 0.01f);

View file

@ -8,9 +8,9 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_po_sisters/object_po_sisters.h"
#define FLAGS \
(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_9 | ACTOR_FLAG_IGNORE_QUAKE | \
ACTOR_FLAG_CAN_ATTACH_TO_ARROW)
#define FLAGS \
(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR | \
ACTOR_FLAG_IGNORE_QUAKE | ACTOR_FLAG_CAN_ATTACH_TO_ARROW)
void EnPoSisters_Init(Actor* thisx, PlayState* play);
void EnPoSisters_Destroy(Actor* thisx, PlayState* play);
@ -210,7 +210,7 @@ void EnPoSisters_Init(Actor* thisx, PlayState* play) {
this->collider.base.ocFlags1 = OC1_ON | OC1_TYPE_PLAYER;
func_80AD9AA8(this, play);
} else {
this->actor.flags &= ~(ACTOR_FLAG_9 | ACTOR_FLAG_CAN_ATTACH_TO_ARROW);
this->actor.flags &= ~(ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR | ACTOR_FLAG_CAN_ATTACH_TO_ARROW);
this->collider.elem.elemMaterial = ELEM_MATERIAL_UNK4;
this->collider.elem.acDmgInfo.dmgFlags |= DMG_DEKU_NUT;
this->collider.base.ocFlags1 = OC1_NONE;

View file

@ -1,7 +1,7 @@
#include "z_en_rd.h"
#include "assets/objects/object_rd/object_rd.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_10)
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)
void EnRd_Init(Actor* thisx, PlayState* play);
void EnRd_Destroy(Actor* thisx, PlayState* play);

View file

@ -9,7 +9,8 @@
#include "terminal.h"
#include "versions.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_10)
#define FLAGS \
(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_4 | ACTOR_FLAG_5 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)
#define RR_MESSAGE_SHIELD (1 << 0)
#define RR_MESSAGE_TUNIC (1 << 1)

View file

@ -6,7 +6,7 @@
#include "z_en_si.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_9)
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR)
void EnSi_Init(Actor* thisx, PlayState* play);
void EnSi_Destroy(Actor* thisx, PlayState* play);

View file

@ -7,7 +7,7 @@
#include "z_en_skjneedle.h"
#include "assets/objects/object_skj/object_skj.h"
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_9)
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE | ACTOR_FLAG_HOOKSHOT_PULLS_ACTOR)
void EnSkjneedle_Init(Actor* thisx, PlayState* play);
void EnSkjneedle_Destroy(Actor* thisx, PlayState* play);

View file

@ -9,7 +9,7 @@
#include "assets/objects/gameplay_keep/gameplay_keep.h"
#include "assets/objects/object_syokudai/object_syokudai.h"
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_10)
#define FLAGS (ACTOR_FLAG_4 | ACTOR_FLAG_HOOKSHOT_PULLS_PLAYER)
void ObjSyokudai_Init(Actor* thisx, PlayState* play);
void ObjSyokudai_Destroy(Actor* thisx, PlayState* play);

View file

@ -324,7 +324,7 @@ void Player_Action_808505DC(Player* this, PlayState* play);
void Player_Action_8085063C(Player* this, PlayState* play);
void Player_Action_8085076C(Player* this, PlayState* play);
void Player_Action_808507F4(Player* this, PlayState* play);
void Player_Action_80850AEC(Player* this, PlayState* play);
void Player_Action_HookshotFly(Player* this, PlayState* play);
void Player_Action_80850C68(Player* this, PlayState* play);
void Player_Action_80850E84(Player* this, PlayState* play);
void Player_Action_CsAction(Player* this, PlayState* play);
@ -3659,7 +3659,7 @@ int Player_CanUpdateItems(Player* this) {
*/
s32 Player_UpdateUpperBody(Player* this, PlayState* play) {
if (!(this->stateFlags1 & PLAYER_STATE1_23) && (this->actor.parent != NULL) && Player_HoldsHookshot(this)) {
Player_SetupAction(play, this, Player_Action_80850AEC, 1);
Player_SetupAction(play, this, Player_Action_HookshotFly, 1);
this->stateFlags3 |= PLAYER_STATE3_FLYING_WITH_HOOKSHOT;
Player_AnimPlayOnce(play, this, &gPlayerAnim_link_hook_fly_start);
Player_StartAnimMovement(play, this,
@ -14832,7 +14832,7 @@ void Player_Action_808507F4(Player* this, PlayState* play) {
Player_DecelerateToZero(this);
}
void Player_Action_80850AEC(Player* this, PlayState* play) {
void Player_Action_HookshotFly(Player* this, PlayState* play) {
this->stateFlags2 |= PLAYER_STATE2_5;
if (LinkAnimation_Update(play, &this->skelAnime)) {