1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-14 21:40:03 +00:00

Boomerang related state flags (#2180)

* boomerang state flags

* finish comment
This commit is contained in:
fig02 2024-09-09 21:58:22 -04:00 committed by GitHub
parent 6fcaa51832
commit 6e0288d155
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 17 deletions

View file

@ -672,8 +672,8 @@ typedef struct WeaponInfo {
#define PLAYER_STATE1_21 (1 << 21)
#define PLAYER_STATE1_22 (1 << 22)
#define PLAYER_STATE1_23 (1 << 23)
#define PLAYER_STATE1_24 (1 << 24)
#define PLAYER_STATE1_25 (1 << 25)
#define PLAYER_STATE1_USING_BOOMERANG (1 << 24) // Currently using the boomerang. This includes all phases (aiming, throwing, and catching).
#define PLAYER_STATE1_BOOMERANG_THROWN (1 << 25) // Boomerang has been thrown and is flying in the air
#define PLAYER_STATE1_26 (1 << 26)
#define PLAYER_STATE1_27 (1 << 27)
#define PLAYER_STATE1_28 (1 << 28)

View file

@ -1199,7 +1199,8 @@ s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx**
if ((sLeftHandType == PLAYER_MODELTYPE_LH_BGS) && (gSaveContext.save.info.playerData.swordHealth <= 0.0f)) {
dLists += 4;
} else if ((sLeftHandType == PLAYER_MODELTYPE_LH_BOOMERANG) && (this->stateFlags1 & PLAYER_STATE1_25)) {
} else if ((sLeftHandType == PLAYER_MODELTYPE_LH_BOOMERANG) &&
(this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN)) {
dLists = gPlayerLeftHandOpenDLs + gSaveContext.save.linkAge;
sLeftHandType = PLAYER_MODELTYPE_LH_OPEN;
} else if ((this->leftHandType == PLAYER_MODELTYPE_LH_OPEN) && (this->actor.speed > 2.0f) &&

View file

@ -186,7 +186,7 @@ void EnBoom_Fly(EnBoom* this, PlayState* play) {
}
}
// Set player flags and kill the boomerang beacause Link caught it.
player->stateFlags1 &= ~PLAYER_STATE1_25;
player->stateFlags1 &= ~PLAYER_STATE1_BOOMERANG_THROWN;
Actor_Kill(&this->actor);
}
} else {

View file

@ -2065,7 +2065,7 @@ int func_808332B8(Player* this) {
}
s32 func_808332E4(Player* this) {
return (this->stateFlags1 & PLAYER_STATE1_24);
return (this->stateFlags1 & PLAYER_STATE1_USING_BOOMERANG);
}
void func_808332F4(Player* this, PlayState* play) {
@ -2167,7 +2167,9 @@ void Player_InitItemActionWithAnim(PlayState* play, Player* this, s8 itemAction)
LinkAnimationHeader** iter = D_80853914 + this->modelAnimType;
u32 animGroup;
this->stateFlags1 &= ~(PLAYER_STATE1_3 | PLAYER_STATE1_24);
// This is redundant, the same two flags get unset in
// `Player_InitItemAction` called below.
this->stateFlags1 &= ~(PLAYER_STATE1_3 | PLAYER_STATE1_USING_BOOMERANG);
for (animGroup = 0; animGroup < PLAYER_ANIMGROUP_MAX; animGroup++) {
if (current == *iter) {
@ -2259,7 +2261,7 @@ void Player_InitHookshotIA(PlayState* play, Player* this) {
}
void Player_InitBoomerangIA(PlayState* play, Player* this) {
this->stateFlags1 |= PLAYER_STATE1_24;
this->stateFlags1 |= PLAYER_STATE1_USING_BOOMERANG;
}
void Player_InitItemAction(PlayState* play, Player* this, s8 itemAction) {
@ -2270,7 +2272,7 @@ void Player_InitItemAction(PlayState* play, Player* this, s8 itemAction) {
this->heldItemAction = this->itemAction = itemAction;
this->modelGroup = this->nextModelGroup;
this->stateFlags1 &= ~(PLAYER_STATE1_3 | PLAYER_STATE1_24);
this->stateFlags1 &= ~(PLAYER_STATE1_3 | PLAYER_STATE1_USING_BOOMERANG);
sItemActionInitFuncs[itemAction](play, this);
@ -2806,7 +2808,7 @@ s32 func_80834EB8(Player* this, PlayState* play) {
}
s32 func_80834F2C(Player* this, PlayState* play) {
if ((this->doorType == PLAYER_DOORTYPE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_25)) {
if ((this->doorType == PLAYER_DOORTYPE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN)) {
if (sUseHeldItem || func_80834E44(play)) {
if (func_80834D2C(this, play)) {
return func_80834EB8(this, play);
@ -3049,7 +3051,7 @@ s32 func_80835800(Player* this, PlayState* play) {
return true;
}
if (this->stateFlags1 & PLAYER_STATE1_25) {
if (this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN) {
Player_SetUpperActionFunc(this, func_80835B60);
} else if (func_80834F2C(this, play)) {
return true;
@ -3104,13 +3106,16 @@ s32 func_808359FC(Player* this, PlayState* play) {
this->actor.focus.rot.x, yaw, 0, 0);
this->boomerangActor = &boomerang->actor;
if (boomerang != NULL) {
boomerang->moveTo = this->focusActor;
boomerang->returnTimer = 20;
this->stateFlags1 |= PLAYER_STATE1_25;
this->stateFlags1 |= PLAYER_STATE1_BOOMERANG_THROWN;
if (!func_8008E9C4(this)) {
Player_SetParallel(this);
}
this->unk_A73 = 4;
Player_PlaySfx(this, NA_SE_IT_BOOMERANG_THROW);
Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_N);
@ -3125,7 +3130,7 @@ s32 func_80835B60(Player* this, PlayState* play) {
return true;
}
if (!(this->stateFlags1 & PLAYER_STATE1_25)) {
if (!(this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN)) {
Player_SetUpperActionFunc(this, func_80835C08);
LinkAnimation_PlayOnce(play, &this->upperSkelAnime, &gPlayerAnim_link_boom_catch);
func_808357E8(this, gPlayerLeftHandBoomerangDLs);
@ -3574,9 +3579,10 @@ void func_80836BEC(Player* this, PlayState* play) {
isTalking = func_8083224C(play);
if (isTalking || (this->unk_66C != 0) || (this->stateFlags1 & (PLAYER_STATE1_12 | PLAYER_STATE1_25))) {
if (isTalking || (this->unk_66C != 0) ||
(this->stateFlags1 & (PLAYER_STATE1_12 | PLAYER_STATE1_BOOMERANG_THROWN))) {
if (!isTalking) {
if (!(this->stateFlags1 & PLAYER_STATE1_25) &&
if (!(this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN) &&
((this->heldItemAction != PLAYER_IA_FISHING_POLE) || (this->unk_860 == 0)) &&
CHECK_BTN_ALL(sControlInput->press.button, BTN_Z)) {
if (this->actor.category == ACTORCAT_PLAYER) {
@ -10769,7 +10775,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) {
if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_TALK)) {
camMode = CAM_MODE_TALK;
} else if (this->stateFlags1 & PLAYER_STATE1_16) {
if (this->stateFlags1 & PLAYER_STATE1_25) {
if (this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN) {
camMode = CAM_MODE_FOLLOW_BOOMERANG;
} else {
camMode = CAM_MODE_Z_TARGET_FRIENDLY;
@ -10780,7 +10786,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) {
Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, focusActor);
} else if (this->stateFlags1 & PLAYER_STATE1_12) {
camMode = CAM_MODE_CHARGE;
} else if (this->stateFlags1 & PLAYER_STATE1_25) {
} else if (this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN) {
camMode = CAM_MODE_FOLLOW_BOOMERANG;
Camera_SetViewParam(Play_GetCamera(play, CAM_ID_MAIN), CAM_VIEW_TARGET, this->boomerangActor);
} else if (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14)) {
@ -14762,7 +14768,7 @@ void func_80851750(PlayState* play, Player* this, CsCmdActorCue* cue) {
}
void func_80851788(PlayState* play, Player* this, CsCmdActorCue* cue) {
this->stateFlags1 &= ~PLAYER_STATE1_25;
this->stateFlags1 &= ~PLAYER_STATE1_BOOMERANG_THROWN;
this->yaw = this->actor.shape.rot.y = this->actor.world.rot.y =
Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_450);