mirror of
https://github.com/zeldaret/oot.git
synced 2024-11-25 01:34:18 +00:00
Document PLAYER_STATE1_SHIELDING
(#2279)
* Document `PLAYER_STATE1_SHIELDING` * Fix format
This commit is contained in:
parent
6ea3982695
commit
2c1d2d74bc
5 changed files with 28 additions and 27 deletions
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue