Player Docs: Spin Attack (#1741)

* spin attack

* cleanup

* fix bss

* PR review

* sync func name

* add todo
This commit is contained in:
engineer124
2024-11-21 10:48:50 +11:00
committed by GitHub
parent 70e97dc285
commit 0b51a16453
10 changed files with 142 additions and 140 deletions
+8 -6
View File
@@ -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);
+9 -41
View File
@@ -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 {
-1
View File
@@ -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"