summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorengineer124 <47598039+engineer124@users.noreply.github.com>2024-11-21 10:48:50 +1100
committerGitHub <noreply@github.com>2024-11-20 15:48:50 -0800
commit0b51a16453b0dcf136bf694206ee603adac67eaf (patch)
treee1cd8196a489bbc982a87665557fe2ab5ce5c6dc /src
parent70e97dc285caf2060dda282c7420ed1e655f806e (diff)
Player Docs: Spin Attack (#1741)
* spin attack * cleanup * fix bss * PR review * sync func name * add todo
Diffstat (limited to 'src')
-rw-r--r--src/code/z_actor.c14
-rw-r--r--src/code/z_camera.c50
-rw-r--r--src/code/z_player_lib.c1
-rw-r--r--src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c2
-rw-r--r--src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c4
-rw-r--r--src/overlays/actors/ovl_player_actor/z_player.c181
6 files changed, 123 insertions, 129 deletions
diff --git a/src/code/z_actor.c b/src/code/z_actor.c
index 125a2e116..3c3096b5e 100644
--- a/src/code/z_actor.c
+++ b/src/code/z_actor.c
@@ -648,7 +648,8 @@ void Attention_Update(Attention* attention, Player* player, Actor* playerFocusAc
actor = NULL;
- if ((player->focusActor != NULL) && (player->unk_AE3[player->unk_ADE] == 2)) {
+ if ((player->focusActor != NULL) &&
+ (player->controlStickDirections[player->controlStickDataIndex] == PLAYER_STICK_DIR_BACKWARD)) {
// Holding backward on the control stick prevents an arrow appearing over the next lock-on actor.
// This helps escape a lock-on loop when using Switch Targeting, but note that this still works for
// Hold Targeting as well.
@@ -2206,8 +2207,8 @@ s32 Actor_OfferGetItem(Actor* actor, PlayState* play, GetItemId getItemId, f32 x
Player* player = GET_PLAYER(play);
if (!(player->stateFlags1 &
- (PLAYER_STATE1_DEAD | PLAYER_STATE1_1000 | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_40000 |
- PLAYER_STATE1_80000 | PLAYER_STATE1_100000 | PLAYER_STATE1_200000)) &&
+ (PLAYER_STATE1_DEAD | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_2000 | PLAYER_STATE1_4000 |
+ PLAYER_STATE1_40000 | PLAYER_STATE1_80000 | PLAYER_STATE1_100000 | PLAYER_STATE1_200000)) &&
(Player_GetExplosiveHeld(player) <= PLAYER_EXPLOSIVE_NONE)) {
if ((actor->xzDistToPlayer <= xzRange) && (fabsf(actor->playerHeightRel) <= fabsf(yRange))) {
if (((getItemId == GI_MASK_CIRCUS_LEADER) || (getItemId == GI_PENDANT_OF_MEMORIES) ||
@@ -2294,9 +2295,10 @@ s32 Actor_HasRider(PlayState* play, Actor* horse) {
s32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) {
Player* player = GET_PLAYER(play);
- if (!(player->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_1000 |
- PLAYER_STATE1_2000 | PLAYER_STATE1_4000 | PLAYER_STATE1_40000 | PLAYER_STATE1_80000 |
- PLAYER_STATE1_100000 | PLAYER_STATE1_200000))) {
+ if (!(player->stateFlags1 &
+ (PLAYER_STATE1_DEAD | PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_2000 |
+ PLAYER_STATE1_4000 | PLAYER_STATE1_40000 | PLAYER_STATE1_80000 | PLAYER_STATE1_100000 |
+ PLAYER_STATE1_200000))) {
player->rideActor = horse;
player->mountSide = mountSide;
CutsceneManager_Queue(CS_ID_GLOBAL_TALK);
diff --git a/src/code/z_camera.c b/src/code/z_camera.c
index d010162a7..4be0ae9a6 100644
--- a/src/code/z_camera.c
+++ b/src/code/z_camera.c
@@ -400,36 +400,10 @@ s32 func_800CB924(Camera* camera) {
}
s32 func_800CB950(Camera* camera) {
- Player* player;
- s32 phi_v0;
- s32 ret;
- f32 yDiff;
-
if (camera->focalActor == &GET_PLAYER(camera->play)->actor) {
- yDiff = Camera_fabsf(camera->focalActorPosRot.pos.y - camera->focalActorFloorHeight);
-
- phi_v0 = false;
- if (yDiff < 11.0f) {
- phi_v0 = true;
- }
-
- ret = phi_v0;
-
- if (!ret) {
-
- ret = false;
-
- if (camera->focalActor->gravity > -0.1f) {
- ret = true;
- }
-
- player = (Player*)camera->focalActor;
- if (!ret) {
- ret = player->stateFlags1 & PLAYER_STATE1_200000;
- ret = !!ret;
- }
- }
- return ret;
+ return ((Camera_fabsf(camera->focalActorPosRot.pos.y - camera->focalActorFloorHeight)) < 11.0f) ||
+ (camera->focalActor->gravity > -0.1f) ||
+ (((Player*)camera->focalActor)->stateFlags1 & PLAYER_STATE1_200000);
} else {
return true;
}
@@ -445,18 +419,12 @@ s32 Camera_IsClimbingLedge(Camera* camera) {
}
}
-s32 Camera_IsChargingSwordOrDekuFlowerDive(Camera* camera) {
+s32 Camera_IsChargingSpinAttackOrDekuFlowerDive(Camera* camera) {
Actor* focalActor = camera->focalActor;
- s32 ret;
if (focalActor == &GET_PLAYER(camera->play)->actor) {
- // Charging Sword
- ret = !!(((Player*)focalActor)->stateFlags1 & PLAYER_STATE1_1000);
- if (!ret) {
- // Deku Flower Dive
- ret = !!(((Player*)focalActor)->stateFlags3 & PLAYER_STATE3_100);
- }
- return ret;
+ return (((Player*)focalActor)->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK) ||
+ (((Player*)focalActor)->stateFlags3 & PLAYER_STATE3_100);
} else {
return false;
}
@@ -2953,7 +2921,7 @@ s32 Camera_Parallel1(Camera* camera) {
rwData->unk_1C = 0;
}
- if (func_800CB950(camera) || (((Player*)camera->focalActor)->stateFlags1 & PLAYER_STATE1_1000) ||
+ if (func_800CB950(camera) || (((Player*)camera->focalActor)->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK) ||
(((Player*)camera->focalActor)->stateFlags3 & PLAYER_STATE3_100)) {
rwData->unk_04 = camera->focalActorPosRot.pos.y;
sp72 = false;
@@ -3594,7 +3562,7 @@ s32 Camera_Battle1(Camera* camera) {
swingPitchFinal = roData->swingPitchFinal;
fov = roData->fov;
- if (Camera_IsChargingSwordOrDekuFlowerDive(camera)) {
+ if (Camera_IsChargingSpinAttackOrDekuFlowerDive(camera)) {
camera->pitchUpdateRateInv = Camera_ScaledStepToCeilF(18.0f, camera->pitchUpdateRateInv, 0.5f, 0.1f);
camera->yOffsetUpdateRate = Camera_ScaledStepToCeilF(0.2f, camera->yOffsetUpdateRate, 0.5f, 0.0001f);
camera->xzOffsetUpdateRate = Camera_ScaledStepToCeilF(0.2f, camera->xzOffsetUpdateRate, 0.5f, 0.0001f);
@@ -3690,7 +3658,7 @@ s32 Camera_Battle1(Camera* camera) {
sp104 = PREG(86) + 800.0f;
}
- if ((spA4.r > sp104) || Camera_IsChargingSwordOrDekuFlowerDive(camera)) {
+ if ((spA4.r > sp104) || Camera_IsChargingSpinAttackOrDekuFlowerDive(camera)) {
distRatio = 1.0f;
spF8 = 10.0f;
} else {
diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c
index f43136967..55f89a3eb 100644
--- a/src/code/z_player_lib.c
+++ b/src/code/z_player_lib.c
@@ -3,7 +3,6 @@
* Description: Set of library functions to interact with the Player system
*/
-#include "prevent_bss_reordering.h"
#include "global.h"
#include "assets/objects/gameplay_keep/gameplay_keep.h"
diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c
index b78304220..e6b05bd0b 100644
--- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c
+++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c
@@ -176,7 +176,7 @@ void func_80919230(EffDust* this, PlayState* play) {
s32 i;
s32 j;
- if ((parent == NULL) || (parent->update == NULL) || !(player->stateFlags1 & PLAYER_STATE1_1000)) {
+ if ((parent == NULL) || (parent->update == NULL) || !(player->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK)) {
if (this->life != 0) {
this->life--;
} else {
diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c
index c76449fe3..9c2730def 100644
--- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c
+++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c
@@ -221,7 +221,7 @@ void EnMThunder_Spin_AttackNoMagic(EnMThunder* this, PlayState* play) {
return;
}
- if (!(player->stateFlags1 & PLAYER_STATE1_1000)) {
+ if (!(player->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK)) {
Actor_Kill(&this->actor);
}
}
@@ -313,7 +313,7 @@ void EnMThunder_Charge(EnMThunder* this, PlayState* play) {
return;
}
- if (!(player->stateFlags1 & PLAYER_STATE1_1000)) {
+ if (!(player->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK)) {
if (this->actor.child != NULL) {
this->actor.child->parent = NULL;
}
diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c
index 6488867f6..cd454fd8b 100644
--- a/src/overlays/actors/ovl_player_actor/z_player.c
+++ b/src/overlays/actors/ovl_player_actor/z_player.c
@@ -507,9 +507,9 @@ typedef struct struct_8085D200 {
/* 0x9 */ u8 unk_9;
} struct_8085D200; // size = 0xC
-f32 sPlayerControlStickMagnitude;
-s16 sPlayerControlStickAngle;
-s16 D_80862B02; // analog stick yaw + camera yaw
+f32 sControlStickMagnitude;
+s16 sControlStickAngle;
+s16 sControlStickWorldYaw;
s32 sUpperBodyIsBusy; // see `Player_UpdateUpperBody`
FloorType sPlayerFloorType;
u32 sPlayerTouchedWallFlags;
@@ -655,10 +655,10 @@ void func_8082DE50(PlayState* play, Player* this) {
}
s32 func_8082DE88(Player* this, s32 arg1, s32 arg2) {
- s16 controlStickAngleDiff = this->prevControlStickAngle - sPlayerControlStickAngle;
+ s16 controlStickAngleDiff = this->prevControlStickAngle - sControlStickAngle;
this->av2.actionVar2 +=
- arg1 + TRUNCF_BINANG(ABS_ALT(controlStickAngleDiff) * fabsf(sPlayerControlStickMagnitude) * (1.0f / 0x600F0));
+ arg1 + TRUNCF_BINANG(ABS_ALT(controlStickAngleDiff) * fabsf(sControlStickMagnitude) * (1.0f / 0x600F0));
if (CHECK_BTN_ANY(sPlayerControlInput->press.button, BTN_B | BTN_A)) {
this->av2.actionVar2 += 5;
@@ -2032,32 +2032,32 @@ void Player_AnimReplace_PlayLoopNormalAdjusted(PlayState* play, Player* this, Pl
}
void Player_ProcessControlStick(PlayState* play, Player* this) {
- s8 var_v0;
- s8 var_v1;
+ s8 spinAngle;
+ s8 direction;
- this->prevControlStickMagnitude = sPlayerControlStickMagnitude;
- this->prevControlStickAngle = sPlayerControlStickAngle;
+ this->prevControlStickMagnitude = sControlStickMagnitude;
+ this->prevControlStickAngle = sControlStickAngle;
- Lib_GetControlStickData(&sPlayerControlStickMagnitude, &sPlayerControlStickAngle, sPlayerControlInput);
+ Lib_GetControlStickData(&sControlStickMagnitude, &sControlStickAngle, sPlayerControlInput);
- if (sPlayerControlStickMagnitude < 8.0f) {
- sPlayerControlStickMagnitude = 0.0f;
+ if (sControlStickMagnitude < 8.0f) {
+ sControlStickMagnitude = 0.0f;
}
- D_80862B02 = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)) + sPlayerControlStickAngle;
+ sControlStickWorldYaw = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)) + sControlStickAngle;
- this->unk_ADE = (this->unk_ADE + 1) % ARRAY_COUNT(this->unk_ADF);
+ this->controlStickDataIndex = (this->controlStickDataIndex + 1) % ARRAY_COUNT(this->controlStickSpinAngles);
- if (sPlayerControlStickMagnitude < 55.0f) {
- var_v0 = -1;
- var_v1 = -1;
+ if (sControlStickMagnitude < 55.0f) {
+ direction = PLAYER_STICK_DIR_NONE;
+ spinAngle = -1;
} else {
- var_v1 = ((u16)(sPlayerControlStickAngle + 0x2000)) >> 9;
- var_v0 = ((u16)(BINANG_SUB(D_80862B02, this->actor.shape.rot.y) + 0x2000)) >> 14;
+ spinAngle = ((u16)(sControlStickAngle + 0x2000)) >> 9;
+ direction = ((u16)(BINANG_SUB(sControlStickWorldYaw, this->actor.shape.rot.y) + 0x2000)) >> 14;
}
- this->unk_ADF[this->unk_ADE] = var_v1;
- this->unk_AE3[this->unk_ADE] = var_v0;
+ this->controlStickSpinAngles[this->controlStickDataIndex] = spinAngle;
+ this->controlStickDirections[this->controlStickDataIndex] = direction;
}
void Player_Anim_PlayOnceWaterAdjustment(PlayState* play, Player* this, PlayerAnimationHeader* anim) {
@@ -4967,7 +4967,7 @@ void Player_UpdateZTargeting(Player* this, PlayState* play) {
isTalking = Player_IsTalking(play);
if (isTalking || (this->zTargetActiveTimer != 0) ||
- (this->stateFlags1 & (PLAYER_STATE1_1000 | PLAYER_STATE1_ZORA_BOOMERANG_THROWN))) {
+ (this->stateFlags1 & (PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_ZORA_BOOMERANG_THROWN))) {
if (!isTalking) {
if (!(this->stateFlags1 & PLAYER_STATE1_ZORA_BOOMERANG_THROWN) &&
((this->heldItemAction != PLAYER_IA_FISHING_ROD) || (this->unk_B28 == 0)) &&
@@ -5100,8 +5100,8 @@ s32 Player_CalcSpeedAndYawFromControlStick(PlayState* play, Player* this, f32* o
*outSpeedTarget = 0.0f;
*outYawTarget = this->actor.shape.rot.y;
} else {
- *outSpeedTarget = sPlayerControlStickMagnitude;
- *outYawTarget = sPlayerControlStickAngle;
+ *outSpeedTarget = sControlStickMagnitude;
+ *outYawTarget = sControlStickAngle;
// The value of `speedMode` is never actually used. It only toggles this condition.
// See the definition of `SPEED_MODE_LINEAR` and `SPEED_MODE_CURVED` for more information.
@@ -5127,7 +5127,7 @@ s32 Player_CalcSpeedAndYawFromControlStick(PlayState* play, Player* this, f32* o
*outSpeedTarget *= 1.5f;
}
- if (sPlayerControlStickMagnitude != 0.0f) {
+ if (sControlStickMagnitude != 0.0f) {
f32 floorPitchInfluence = Math_SinS(this->floorPitch);
f32 speedCap = this->unk_B50;
f32 var_fa1;
@@ -5479,7 +5479,8 @@ void func_808332A0(PlayState* play, Player* this, s32 magicCost, s32 isSwordBeam
this->unk_B08 = 0.5f;
}
- this->stateFlags1 |= PLAYER_STATE1_1000;
+ this->stateFlags1 |= PLAYER_STATE1_CHARGING_SPIN_ATTACK;
+
if ((this->actor.id == ACTOR_PLAYER) && (isSwordBeam || (this->transformation == PLAYER_FORM_HUMAN))) {
s16 pitch = 0;
Actor* thunder;
@@ -5504,9 +5505,8 @@ void func_808332A0(PlayState* play, Player* this, s32 magicCost, s32 isSwordBeam
}
}
-// Check for inputs for quickspin
-s32 func_808333CC(Player* this) {
- s8 sp3C[4];
+s32 Player_CanSpinAttack(Player* this) {
+ s8 sp3C[ARRAY_COUNT(this->controlStickSpinAngles)];
s8* iter;
s8* iter2;
s8 temp1;
@@ -5517,9 +5517,10 @@ s32 func_808333CC(Player* this) {
return false;
}
- iter = &this->unk_ADF[0];
+ iter = &this->controlStickSpinAngles[0];
iter2 = &sp3C[0];
- for (i = 0; i < 4; i++, iter++, iter2++) {
+
+ for (i = 0; i < ARRAY_COUNT(this->controlStickSpinAngles); i++, iter++, iter2++) {
if ((*iter2 = *iter) < 0) {
return false;
}
@@ -5527,12 +5528,14 @@ s32 func_808333CC(Player* this) {
}
temp1 = sp3C[0] - sp3C[1];
+
if (ABS_ALT(temp1) < 10) {
return false;
}
iter2 = &sp3C[1];
- for (i = 1; i < 3; i++, iter2++) {
+
+ for (i = 1; i < (ARRAY_COUNT(this->controlStickSpinAngles) - 1); i++, iter2++) {
temp2 = *iter2 - *(iter2 + 1);
if ((ABS_ALT(temp2) < 10) || (temp2 * temp1 < 0)) {
return false;
@@ -5564,10 +5567,10 @@ void func_808335B0(PlayState* play, Player* this) {
}
s8 D_8085D090[] = {
- PLAYER_MWA_STAB_1H,
- PLAYER_MWA_RIGHT_SLASH_1H,
- PLAYER_MWA_RIGHT_SLASH_1H,
- PLAYER_MWA_LEFT_SLASH_1H,
+ PLAYER_MWA_STAB_1H, // PLAYER_STICK_DIR_FORWARD
+ PLAYER_MWA_RIGHT_SLASH_1H, // PLAYER_STICK_DIR_LEFT, TODO: verify MWA as left/right does not match stick dir
+ PLAYER_MWA_RIGHT_SLASH_1H, // PLAYER_STICK_DIR_BACKWARD
+ PLAYER_MWA_LEFT_SLASH_1H, // PLAYER_STICK_DIR_RIGHT
};
s8 D_8085D094[][3] = {
@@ -5576,10 +5579,10 @@ s8 D_8085D094[][3] = {
};
PlayerMeleeWeaponAnimation func_808335F4(Player* this) {
- s32 temp_a1;
+ s32 controlStickDirection;
PlayerMeleeWeaponAnimation meleeWeaponAnim;
- temp_a1 = this->unk_AE3[this->unk_ADE];
+ controlStickDirection = this->controlStickDirections[this->controlStickDataIndex];
if ((this->transformation == PLAYER_FORM_ZORA) || (this->transformation == PLAYER_FORM_GORON)) {
s8* meleeWeaponAnims = (this->transformation == PLAYER_FORM_ZORA) ? D_8085D094[0] : D_8085D094[1];
s32 unk_ADD = this->unk_ADD;
@@ -5593,13 +5596,13 @@ PlayerMeleeWeaponAnimation func_808335F4(Player* this) {
}
}
} else {
- if (func_808333CC(this)) {
+ if (Player_CanSpinAttack(this)) {
meleeWeaponAnim = PLAYER_MWA_SPIN_ATTACK_1H;
} else {
- if (temp_a1 < 0) {
+ if (controlStickDirection <= PLAYER_STICK_DIR_NONE) {
meleeWeaponAnim = Player_IsZTargeting(this) ? PLAYER_MWA_FORWARD_SLASH_1H : PLAYER_MWA_RIGHT_SLASH_1H;
} else {
- meleeWeaponAnim = D_8085D090[temp_a1];
+ meleeWeaponAnim = D_8085D090[controlStickDirection];
if (meleeWeaponAnim == PLAYER_MWA_STAB_1H) {
this->stateFlags2 |= PLAYER_STATE2_40000000;
if (!Player_IsZTargeting(this)) {
@@ -7075,7 +7078,8 @@ s32 func_80836F10(PlayState* play, Player* this) {
}
s32 func_808370D4(PlayState* play, Player* this) {
- if ((this->fallDistance < 800) && (this->unk_AE3[this->unk_ADE] == 0) &&
+ if ((this->fallDistance < 800) &&
+ (this->controlStickDirections[this->controlStickDataIndex] == PLAYER_STICK_DIR_FORWARD) &&
!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) {
func_80836B3C(play, this, 0.0f);
@@ -8150,34 +8154,51 @@ s32 func_80839770(Player* this, PlayState* play) {
}
s32 func_80839800(Player* this, PlayState* play) {
- if ((this->unk_AE3[this->unk_ADE] == 0) && (sPlayerFloorType != FLOOR_TYPE_7)) {
+ if ((this->controlStickDirections[this->controlStickDataIndex] == PLAYER_STICK_DIR_FORWARD) &&
+ (sPlayerFloorType != FLOOR_TYPE_7)) {
func_80836B3C(play, this, 0.0f);
return true;
}
return false;
}
-void func_80839860(Player* this, PlayState* play, s32 arg2) {
+void func_80839860(Player* this, PlayState* play, s32 controlStickDirection) {
s32 pad;
- f32 speed = (!(arg2 & 1) ? 5.8f : 3.5f);
+ f32 speed;
+
+ if (!(controlStickDirection & 1)) {
+ // forwards, backwards, or none
+ speed = 5.8f;
+ } else {
+ // left or right
+ speed = 3.5f;
+ }
if (this->currentBoots == PLAYER_BOOTS_GIANT) {
speed /= 2.0f;
}
//! FAKE
- if (arg2 == 2) {}
+ if (controlStickDirection == PLAYER_STICK_DIR_BACKWARD) {}
- func_80834D50(play, this, D_8085C2A4[arg2].unk_0, speed, NA_SE_VO_LI_SWORD_N);
+ func_80834D50(play, this, D_8085C2A4[controlStickDirection].unk_0, speed, NA_SE_VO_LI_SWORD_N);
this->av2.actionVar2 = 1;
- this->av1.actionVar1 = arg2;
+ this->av1.actionVar1 = controlStickDirection;
- this->yaw = this->actor.shape.rot.y + (arg2 << 0xE);
- this->speedXZ = !(arg2 & 1) ? 6.0f : 8.5f;
+ this->yaw = this->actor.shape.rot.y + (controlStickDirection << 0xE);
+
+ if (!(controlStickDirection & 1)) {
+ // forwards, backwards, or none
+ this->speedXZ = 6.0f;
+ } else {
+ // left or right
+ this->speedXZ = 8.5f;
+ }
this->stateFlags2 |= PLAYER_STATE2_80000;
- Player_PlaySfx(this, ((arg2 << 0xE) == 0x8000) ? NA_SE_PL_ROLL : NA_SE_PL_SKIP);
+ Player_PlaySfx(this, ((controlStickDirection << 0xE) == (PLAYER_STICK_DIR_BACKWARD << 0xE)) ? NA_SE_PL_ROLL
+ : NA_SE_PL_SKIP);
}
void func_80839978(PlayState* play, Player* this) {
@@ -8221,12 +8242,12 @@ s32 func_80839A84(PlayState* play, Player* this) {
s32 Player_ActionHandler_10(Player* this, PlayState* play) {
if (CHECK_BTN_ALL(sPlayerControlInput->press.button, BTN_A) && (play->roomCtx.curRoom.type != ROOM_TYPE_INDOORS) &&
(sPlayerFloorType != FLOOR_TYPE_7) && (sPlayerFloorEffect != FLOOR_EFFECT_1)) {
- s32 temp_a2 = this->unk_AE3[this->unk_ADE];
+ s32 controlStickDirection = this->controlStickDirections[this->controlStickDataIndex];
- if (temp_a2 <= 0) {
+ if (controlStickDirection <= PLAYER_STICK_DIR_FORWARD) {
if (Player_IsZTargeting(this)) {
if (this->actor.category != ACTORCAT_PLAYER) {
- if (temp_a2 < 0) {
+ if (controlStickDirection <= PLAYER_STICK_DIR_NONE) {
func_80834DB8(this, &gPlayerAnim_link_normal_jump, REG(69) / 100.0f, play);
} else {
func_80836B3C(play, this, 0.0f);
@@ -8242,7 +8263,7 @@ s32 Player_ActionHandler_10(Player* this, PlayState* play) {
return true;
}
} else {
- func_80839860(this, play, temp_a2);
+ func_80839860(this, play, controlStickDirection);
return true;
}
}
@@ -10745,7 +10766,7 @@ s32 func_80840CD4(Player* this, PlayState* play) {
} else if (!CHECK_BTN_ALL(sPlayerControlInput->cur.button, BTN_B)) {
PlayerMeleeWeaponAnimation meleeWeaponAnim;
- if ((this->unk_B08 >= 0.85f) || func_808333CC(this)) {
+ if ((this->unk_B08 >= 0.85f) || Player_CanSpinAttack(this)) {
meleeWeaponAnim = D_8085CF84[Player_IsHoldingTwoHandedWeapon(this)];
} else {
meleeWeaponAnim = D_8085CF80[Player_IsHoldingTwoHandedWeapon(this)];
@@ -10753,7 +10774,7 @@ s32 func_80840CD4(Player* this, PlayState* play) {
func_80833864(play, this, meleeWeaponAnim);
func_808339B4(this, -8);
this->stateFlags2 |= PLAYER_STATE2_20000;
- if (this->unk_AE3[this->unk_ADE] == 0) {
+ if (this->controlStickDirections[this->controlStickDataIndex] == PLAYER_STICK_DIR_FORWARD) {
this->stateFlags2 |= PLAYER_STATE2_40000000;
}
} else {
@@ -11112,8 +11133,8 @@ void Player_Init(Actor* thisx, PlayState* play) {
this->unk_B92 = 0;
this->unk_B94 = 0;
this->unk_B96 = 0;
- this->stateFlags1 &= ~(PLAYER_STATE1_8 | PLAYER_STATE1_1000 | PLAYER_STATE1_USING_ZORA_BOOMERANG |
- PLAYER_STATE1_ZORA_BOOMERANG_THROWN);
+ this->stateFlags1 &= ~(PLAYER_STATE1_8 | PLAYER_STATE1_CHARGING_SPIN_ATTACK |
+ PLAYER_STATE1_USING_ZORA_BOOMERANG | PLAYER_STATE1_ZORA_BOOMERANG_THROWN);
this->stateFlags2 &= ~(PLAYER_STATE2_20000 | PLAYER_STATE2_1000000 | PLAYER_STATE2_40000000);
this->stateFlags3 &=
~(PLAYER_STATE3_8 | PLAYER_STATE3_40 | PLAYER_STATE3_80 | PLAYER_STATE3_100 | PLAYER_STATE3_200 |
@@ -11421,7 +11442,7 @@ void Player_UpdateInterface(PlayState* play, Player* this) {
Actor* heldActor = this->heldActor;
Actor* interactRangeActor = this->interactRangeActor;
s32 pad;
- s32 sp28 = this->unk_AE3[this->unk_ADE];
+ s32 controlStickDirection = this->controlStickDirections[this->controlStickDataIndex];
s32 sp24;
DoAction doActionA =
((this->transformation == PLAYER_FORM_GORON) && !(this->stateFlags1 & PLAYER_STATE1_400000))
@@ -11431,8 +11452,8 @@ void Player_UpdateInterface(PlayState* play, Player* this) {
if (play->actorCtx.flags & ACTORCTX_FLAG_PICTO_BOX_ON) {
doActionA = DO_ACTION_SNAP;
} else if (Player_InBlockingCsMode(play, this) || (this->actor.flags & ACTOR_FLAG_20000000) ||
- (this->stateFlags1 & PLAYER_STATE1_1000) || (this->stateFlags3 & PLAYER_STATE3_80000) ||
- (Player_Action_80 == this->actionFunc)) {
+ (this->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK) ||
+ (this->stateFlags3 & PLAYER_STATE3_80000) || (Player_Action_80 == this->actionFunc)) {
doActionA = DO_ACTION_NONE;
} else if (this->stateFlags1 & PLAYER_STATE1_100000) {
doActionA = DO_ACTION_RETURN;
@@ -11523,14 +11544,16 @@ void Player_UpdateInterface(PlayState* play, Player* this) {
if ((sp24 && (this->transformation != PLAYER_FORM_DEKU)) || !(this->stateFlags1 & PLAYER_STATE1_400000) ||
!Player_IsGoronOrDeku(this)) {
if ((this->transformation != PLAYER_FORM_GORON) &&
- !(this->stateFlags1 & (PLAYER_STATE1_4 | PLAYER_STATE1_4000)) && (sp28 <= 0) &&
+ !(this->stateFlags1 & (PLAYER_STATE1_4 | PLAYER_STATE1_4000)) &&
+ (controlStickDirection <= PLAYER_STICK_DIR_FORWARD) &&
(Player_CheckHostileLockOn(this) ||
- ((sPlayerFloorType != FLOOR_TYPE_7) &&
- (Player_FriendlyLockOnOrParallel(this) ||
- ((play->roomCtx.curRoom.type != ROOM_TYPE_INDOORS) &&
- !(this->stateFlags1 & PLAYER_STATE1_400000) && (sp28 == 0)))))) {
+ ((sPlayerFloorType != FLOOR_TYPE_7) && (Player_FriendlyLockOnOrParallel(this) ||
+ ((play->roomCtx.curRoom.type != ROOM_TYPE_INDOORS) &&
+ !(this->stateFlags1 & PLAYER_STATE1_400000) &&
+ (controlStickDirection == PLAYER_STICK_DIR_FORWARD)))))) {
doActionA = DO_ACTION_ATTACK;
- } else if ((play->roomCtx.curRoom.type != ROOM_TYPE_INDOORS) && sp24 && (sp28 > 0)) {
+ } else if ((play->roomCtx.curRoom.type != ROOM_TYPE_INDOORS) && sp24 &&
+ (controlStickDirection >= PLAYER_STICK_DIR_LEFT)) {
doActionA = DO_ACTION_JUMP;
} else if ((this->transformation == PLAYER_FORM_DEKU) && !(this->stateFlags1 & PLAYER_STATE1_8000000) &&
(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND)) {
@@ -11949,7 +11972,7 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) {
camMode = CAM_MODE_BATTLE;
}
Camera_SetViewParam(camera, CAM_VIEW_TARGET, this->focusActor);
- } else if (this->stateFlags1 & PLAYER_STATE1_1000) {
+ } else if (this->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK) {
camMode = CAM_MODE_CHARGE;
} else if (this->stateFlags3 & PLAYER_STATE3_100) {
camMode = CAM_MODE_DEKUHIDE;
@@ -12624,7 +12647,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) {
this->stateFlags2 &= ~(PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER | PLAYER_STATE2_200000);
}
- this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_1000 | PLAYER_STATE1_400000);
+ this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_400000);
this->stateFlags2 &=
~(PLAYER_STATE2_1 | PLAYER_STATE2_4 | PLAYER_STATE2_8 | PLAYER_STATE2_20 | PLAYER_STATE2_40 |
PLAYER_STATE2_100 | PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND | PLAYER_STATE2_1000 | PLAYER_STATE2_4000 |
@@ -15182,7 +15205,8 @@ void Player_Action_25(Player* this, PlayState* play) {
(this->speedXZ > 0.0f)) {
if ((this->transformation != PLAYER_FORM_GORON) &&
((this->transformation != PLAYER_FORM_DEKU) || (this->remainingHopsCounter != 0))) {
- if ((this->yDistToLedge >= 150.0f) && (this->unk_AE3[this->unk_ADE] == 0)) {
+ if ((this->yDistToLedge >= 150.0f) &&
+ (this->controlStickDirections[this->controlStickDataIndex] == PLAYER_STICK_DIR_FORWARD)) {
if (func_8083D860(this, play)) {
func_8084C124(play, this);
}
@@ -15275,7 +15299,8 @@ void Player_Action_26(Player* this, PlayState* play) {
Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play);
speedTarget *= 1.5f;
- if ((speedTarget < 3.0f) || (this->unk_AE3[this->unk_ADE] != 0)) {
+ if ((speedTarget < 3.0f) ||
+ (this->controlStickDirections[this->controlStickDataIndex] != PLAYER_STICK_DIR_FORWARD)) {
speedTarget = 3.0f;
}
func_8083CB58(this, speedTarget, this->actor.shape.rot.y);
@@ -15368,7 +15393,7 @@ void Player_Action_30(Player* this, PlayState* play) {
s16 yawTarget;
s32 temp_v0;
- this->stateFlags1 |= PLAYER_STATE1_1000;
+ this->stateFlags1 |= PLAYER_STATE1_CHARGING_SPIN_ATTACK;
if (PlayerAnimation_Update(play, &this->skelAnime)) {
Player_Anim_ResetMove(this);
Player_SetParallel(this);
@@ -15416,7 +15441,7 @@ void Player_Action_31(Player* this, PlayState* play) {
var_v1 = ABS_ALT(temp_v0);
temp_ft4 = fabsf(this->speedXZ);
- this->stateFlags1 |= PLAYER_STATE1_1000;
+ this->stateFlags1 |= PLAYER_STATE1_CHARGING_SPIN_ATTACK;
var_fa0 = temp_ft4 * 1.5f;
var_fa0 = CLAMP_MIN(var_fa0, 1.5f);
@@ -15464,7 +15489,7 @@ void Player_Action_32(Player* this, PlayState* play) {
f32 sp5C = fabsf(this->speedXZ);
f32 var_fa0;
- this->stateFlags1 |= PLAYER_STATE1_1000;
+ this->stateFlags1 |= PLAYER_STATE1_CHARGING_SPIN_ATTACK;
if (sp5C == 0.0f) {
sp5C = ABS_ALT(this->unk_B4C) * 0.0015f;
@@ -16238,7 +16263,7 @@ void Player_Action_48(Player* this, PlayState* play) {
Math_ScaledStepToS(&this->actor.shape.rot.y, this->yaw, 0x800);
if (this->av1.actionVar1 != 0) {
Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play);
- if (this->unk_ADF[this->unk_ADE] >= 0) {
+ if (this->controlStickSpinAngles[this->controlStickDataIndex] >= 0) {
func_808381A0(this,
(this->av1.actionVar1 > 0) ? D_8085BE84[PLAYER_ANIMGROUP_fall_up][this->modelAnimType]
: D_8085BE84[PLAYER_ANIMGROUP_jump_climb_up][this->modelAnimType],
@@ -16764,7 +16789,7 @@ s32 func_80850734(PlayState* play, Player* this) {
s32 func_80850854(PlayState* play, Player* this) {
if ((this->transformation == PLAYER_FORM_DEKU) && (this->remainingHopsCounter != 0) &&
- (gSaveContext.save.saveInfo.playerData.health != 0) && (sPlayerControlStickMagnitude != 0.0f)) {
+ (gSaveContext.save.saveInfo.playerData.health != 0) && (sControlStickMagnitude != 0.0f)) {
func_808373F8(play, this, 0);
return true;
}
@@ -18275,7 +18300,7 @@ void Player_Action_84(Player* this, PlayState* play) {
if (PlayerAnimation_Update(play, &this->skelAnime) ||
((this->meleeWeaponAnimation >= PLAYER_MWA_FLIPSLASH_FINISH) &&
(this->meleeWeaponAnimation <= PLAYER_MWA_ZORA_JUMPKICK_FINISH) && (this->skelAnime.curFrame > 2.0f) &&
- func_808333CC(this))) {
+ Player_CanSpinAttack(this))) {
sPlayerUseHeldItem = this->av2.actionVar2;
if (!Player_ActionHandler_7(this, play)) {