diff --git a/include/z64player.h b/include/z64player.h index c82f54bc9c..d135c57413 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -691,7 +691,7 @@ typedef struct WeaponInfo { #define PLAYER_STATE1_19 (1 << 19) #define PLAYER_STATE1_20 (1 << 20) #define PLAYER_STATE1_21 (1 << 21) -#define PLAYER_STATE1_22 (1 << 22) +#define PLAYER_STATE1_SHIELDING (1 << 22) // Shielding in any form (regular, hylian shield as child, "shielding" with a two handed sword, etc.) #define PLAYER_STATE1_23 (1 << 23) #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 diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 114987864e..798ba82462 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -644,7 +644,7 @@ s32 Player_ActionToModelGroup(Player* this, s32 itemAction) { } void Player_SetModelsForHoldingShield(Player* this) { - if ((this->stateFlags1 & PLAYER_STATE1_22) && + if ((this->stateFlags1 & PLAYER_STATE1_SHIELDING) && ((this->itemAction < 0) || (this->itemAction == this->heldItemAction))) { if (!Player_HoldsTwoHandedWeapon(this) && !Player_IsChildWithHylianShield(this)) { this->rightHandType = PLAYER_MODELTYPE_RH_SHIELD; @@ -1460,7 +1460,7 @@ void Player_UpdateShieldCollider(PlayState* play, Player* this, ColliderQuad* co COL_MATERIAL_METAL, }; - if (this->stateFlags1 & PLAYER_STATE1_22) { + if (this->stateFlags1 & PLAYER_STATE1_SHIELDING) { Vec3f quadDest[4]; this->shieldQuad.base.colMaterial = shieldColMaterials[this->currentShield]; @@ -1494,7 +1494,7 @@ void func_800906D4(PlayState* play, Player* this, Vec3f* newTipPos) { Matrix_MultVec3f(&D_801260A4[2], &newBasePos[2]); if (func_80090480(play, NULL, &this->meleeWeaponInfo[0], &newTipPos[0], &newBasePos[0]) && - !(this->stateFlags1 & PLAYER_STATE1_22)) { + !(this->stateFlags1 & PLAYER_STATE1_SHIELDING)) { EffectBlure_AddVertex(Effect_GetByIndex(this->meleeWeaponEffectIndex), &this->meleeWeaponInfo[0].tip, &this->meleeWeaponInfo[0].base); } diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 72b07e4e01..c89dadb7c0 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -838,7 +838,7 @@ s32 BossTw_CheckBeamReflection(BossTw* this, PlayState* play) { Vec3f vec; Player* player = GET_PLAYER(play); - if (player->stateFlags1 & PLAYER_STATE1_22 && + if (player->stateFlags1 & PLAYER_STATE1_SHIELDING && (s16)(player->actor.shape.rot.y - this->actor.shape.rot.y + 0x8000) < 0x2000 && (s16)(player->actor.shape.rot.y - this->actor.shape.rot.y + 0x8000) > -0x2000) { // player is shielding and facing angles are less than 45 degrees in either direction @@ -980,7 +980,7 @@ void BossTw_ShootBeam(BossTw* this, PlayState* play) { if (this->timers[1] != 0) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 5, this->rotateSpeed); - if ((player->stateFlags1 & PLAYER_STATE1_22) && + if ((player->stateFlags1 & PLAYER_STATE1_SHIELDING) && ((s16)((player->actor.shape.rot.y - this->actor.shape.rot.y) + 0x8000) < 0x2000) && ((s16)((player->actor.shape.rot.y - this->actor.shape.rot.y) + 0x8000) > -0x2000)) { Math_ApproachF(&this->targetPos.x, player->bodyPartsPos[PLAYER_BODYPART_R_HAND].x, 1.0f, 400.0f); diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 41ed3883e7..6b0ba4cea9 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -408,7 +408,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { sStickAngle = thisx->yawTowardsPlayer; if ((90.0f >= this->actor.xzDistToPlayer) && (this->actor.xzDistToPlayer > 70.0f) && (ABS(sp5A) >= 0x7800) && - (this->actor.isLockedOn || !(player->stateFlags1 & PLAYER_STATE1_22))) { + (this->actor.isLockedOn || !(player->stateFlags1 & PLAYER_STATE1_SHIELDING))) { EnTorch2_SwingSword(play, input, this); } else { f32 sp50 = 0.0f; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 9bc5bd44de..16fd92e0d8 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -2731,7 +2731,7 @@ void Player_UpdateItems(Player* this, PlayState* play) { #if OOT_VERSION >= NTSC_1_1 !(this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) && #endif - ((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_22)) && + ((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_SHIELDING)) && (gSaveContext.save.info.playerData.health != 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->csAction == PLAYER_CSACTION_NONE) && (play->shootingGalleryStatus == 0) && (play->activeCamId == CAM_ID_MAIN) && (play->transitionTrigger != TRANS_TRIGGER_START) && @@ -2850,7 +2850,7 @@ s32 func_80834758(PlayState* play, Player* this) { LinkAnimationHeader* anim; f32 frame; - if (!(this->stateFlags1 & (PLAYER_STATE1_22 | PLAYER_STATE1_23 | PLAYER_STATE1_29)) && + if (!(this->stateFlags1 & (PLAYER_STATE1_SHIELDING | PLAYER_STATE1_23 | PLAYER_STATE1_29)) && (play->shootingGalleryStatus == 0) && (this->heldItemAction == this->itemAction) && (this->currentShield != PLAYER_SHIELD_NONE) && !Player_IsChildWithHylianShield(this) && Player_IsZTargeting(this) && CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { @@ -2952,7 +2952,7 @@ s32 func_80834B5C(Player* this, PlayState* play) { func_80834894(this); return true; } else { - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); return true; } @@ -2968,7 +2968,7 @@ s32 func_80834BD4(Player* this, PlayState* play) { LinkAnimation_Change(play, &this->upperSkelAnime, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); } - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); return true; @@ -3413,13 +3413,14 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun this->actionFunc = actionFunc; - if ((this->itemAction != this->heldItemAction) && (!(flags & 1) || !(this->stateFlags1 & PLAYER_STATE1_22))) { + if ((this->itemAction != this->heldItemAction) && + (!(flags & 1) || !(this->stateFlags1 & PLAYER_STATE1_SHIELDING))) { func_8008EC70(this); } if (!(flags & 1) && !(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) { func_80834644(play, this); - this->stateFlags1 &= ~PLAYER_STATE1_22; + this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; } Player_FinishAnimMovement(this); @@ -3513,7 +3514,7 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { itemAction = Player_ItemToItemAction(item); if (((this->heldItemAction == this->itemAction) && - (!(this->stateFlags1 & PLAYER_STATE1_22) || (Player_ActionToMeleeWeapon(itemAction) != 0) || + (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) || (Player_ActionToMeleeWeapon(itemAction) != 0) || (itemAction == PLAYER_IA_NONE))) || ((this->itemAction < 0) && ((Player_ActionToMeleeWeapon(itemAction) != 0) || (itemAction == PLAYER_IA_NONE)))) { @@ -6302,7 +6303,7 @@ void func_8083BA90(PlayState* play, Player* this, s32 arg2, f32 xzSpeed, f32 yVe } s32 func_8083BB20(Player* this) { - if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetMeleeWeaponHeld(this) != 0)) { + if (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) && (Player_GetMeleeWeaponHeld(this) != 0)) { if (sUseHeldItem || ((this->actor.category != ACTORCAT_PLAYER) && CHECK_BTN_ALL(sControlInput->press.button, BTN_B))) { return 1; @@ -6488,7 +6489,7 @@ s32 Player_ActionHandler_11(Player* this, PlayState* play) { Player_DetachHeldActor(play, this); if (Player_SetupAction(play, this, Player_Action_80843188, 0)) { - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; if (!Player_IsChildWithHylianShield(this)) { Player_SetModelsForHoldingShield(this); @@ -6546,7 +6547,7 @@ void func_8083C50C(Player* this) { s32 Player_ActionHandler_8(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { - if (!(this->stateFlags1 & PLAYER_STATE1_22) && (Player_GetMeleeWeaponHeld2(this) != 0) && + if (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) && (Player_GetMeleeWeaponHeld2(this) != 0) && (this->unk_844 == 1) && (this->heldItemAction != PLAYER_IA_DEKU_STICK)) { if ((this->heldItemAction != PLAYER_IA_SWORD_BIGGORON) || (gSaveContext.save.info.playerData.swordHealth > 0.0f)) { @@ -9144,9 +9145,9 @@ void Player_Action_80843188(Player* this, PlayState* play) { } if (!Player_IsChildWithHylianShield(this)) { - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_UpdateUpperBody(this, play); - this->stateFlags1 &= ~PLAYER_STATE1_22; + this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; } Player_DecelerateToZero(this); @@ -9201,7 +9202,7 @@ void Player_Action_80843188(Player* this, PlayState* play) { if (Player_ActionHandler_11(this, play)) { func_808428D8(this, play); } else { - this->stateFlags1 &= ~PLAYER_STATE1_22; + this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; func_80832318(this); if (Player_IsChildWithHylianShield(this)) { @@ -9225,7 +9226,7 @@ void Player_Action_80843188(Player* this, PlayState* play) { } } - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_UPPER_X | UNK6AE_ROT_UPPER_Y; @@ -9251,7 +9252,7 @@ void Player_Action_808435C4(Player* this, PlayState* play) { if ((interruptResult != PLAYER_INTERRUPT_NEW_ACTION) && ((interruptResult >= PLAYER_INTERRUPT_MOVE) || LinkAnimation_Update(play, &this->skelAnime))) { Player_SetupAction(play, this, Player_Action_80843188, 1); - this->stateFlags1 |= PLAYER_STATE1_22; + this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense, this->modelAnimType); frames = Animation_GetLastFrame(anim); @@ -10924,14 +10925,14 @@ void Player_UpdateInterface(PlayState* play, Player* this) { doAction = sDiveNumberDoActions[sp24]; } else if (sp1C && !(this->stateFlags2 & PLAYER_STATE2_10)) { doAction = DO_ACTION_DIVE; - } else if (!sp1C && (!(this->stateFlags1 & PLAYER_STATE1_22) || Player_IsZTargeting(this) || + } else if (!sp1C && (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) || Player_IsZTargeting(this) || !Player_IsChildWithHylianShield(this))) { if ((!(this->stateFlags1 & PLAYER_STATE1_14) && (controlStickDirection <= PLAYER_STICK_DIR_FORWARD) && (Player_CheckHostileLockOn(this) || ((sFloorType != FLOOR_TYPE_7) && (Player_FriendlyLockOnOrParallel(this) || ((play->roomCtx.curRoom.type != ROOM_TYPE_INDOORS) && - !(this->stateFlags1 & PLAYER_STATE1_22) && + !(this->stateFlags1 & PLAYER_STATE1_SHIELDING) && (controlStickDirection == PLAYER_STICK_DIR_FORWARD))))))) { doAction = DO_ACTION_ATTACK; } else if ((play->roomCtx.curRoom.type != ROOM_TYPE_INDOORS) && Player_IsZTargeting(this) && @@ -11914,8 +11915,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->stateFlags2 &= ~(PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER | PLAYER_STATE2_21); } - this->stateFlags1 &= - ~(PLAYER_STATE1_SWINGING_BOTTLE | PLAYER_STATE1_9 | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_22); + this->stateFlags1 &= ~(PLAYER_STATE1_SWINGING_BOTTLE | PLAYER_STATE1_9 | PLAYER_STATE1_CHARGING_SPIN_ATTACK | + PLAYER_STATE1_SHIELDING); this->stateFlags2 &= ~(PLAYER_STATE2_0 | PLAYER_STATE2_2 | PLAYER_STATE2_3 | PLAYER_STATE2_5 | PLAYER_STATE2_6 | PLAYER_STATE2_8 | PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND | PLAYER_STATE2_12 | PLAYER_STATE2_14 | PLAYER_STATE2_DO_ACTION_ENTER | PLAYER_STATE2_22 | PLAYER_STATE2_26); @@ -11996,7 +11997,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->cylinder.dim.yShift = phi_f12 - this->actor.world.pos.y; - if (this->stateFlags1 & PLAYER_STATE1_22) { + if (this->stateFlags1 & PLAYER_STATE1_SHIELDING) { this->cylinder.dim.height *= 0.8f; }