1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-29 03:34:07 +00:00

PlayerMeleeWeaponAnimation enum (#1154)

* Move `PlayerSwordAnimation` from `z_en_torch2.c` to `z64player.h`

* `PlayerSwordAnimation` -> `PlayerMeleeWeaponAnimation`

* Add `PWMA_` prefix to `PlayerMeleeWeaponAnimation` values

* Use `PlayerMeleeWeaponAnimation` enum more

* Add `PWMA_MAX`

* Update comments in z_en_kanban.c

* Some cleanup around conditionals with `meleeWeaponAnimation`

* Comment `PWMA_` index value in `D_80854190`

* `PMWA_` -> `PLAYER_MWA_`

* Minor fixup

* Missed one spot

* Run formatter
This commit is contained in:
Dragorn421 2022-03-09 18:52:28 +01:00 committed by GitHub
parent 5cadc5df8a
commit c55a8530ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 174 additions and 111 deletions

View file

@ -172,6 +172,38 @@ typedef enum {
/* 0x12 */ PLAYER_BODYPART_MAX
} PlayerBodyPart;
typedef enum {
/* 0 */ PLAYER_MWA_FORWARD_SLASH_1H,
/* 1 */ PLAYER_MWA_FORWARD_SLASH_2H,
/* 2 */ PLAYER_MWA_FORWARD_COMBO_1H,
/* 3 */ PLAYER_MWA_FORWARD_COMBO_2H,
/* 4 */ PLAYER_MWA_RIGHT_SLASH_1H,
/* 5 */ PLAYER_MWA_RIGHT_SLASH_2H,
/* 6 */ PLAYER_MWA_RIGHT_COMBO_1H,
/* 7 */ PLAYER_MWA_RIGHT_COMBO_2H,
/* 8 */ PLAYER_MWA_LEFT_SLASH_1H,
/* 9 */ PLAYER_MWA_LEFT_SLASH_2H,
/* 10 */ PLAYER_MWA_LEFT_COMBO_1H,
/* 11 */ PLAYER_MWA_LEFT_COMBO_2H,
/* 12 */ PLAYER_MWA_STAB_1H,
/* 13 */ PLAYER_MWA_STAB_2H,
/* 14 */ PLAYER_MWA_STAB_COMBO_1H,
/* 15 */ PLAYER_MWA_STAB_COMBO_2H,
/* 16 */ PLAYER_MWA_FLIPSLASH_START,
/* 17 */ PLAYER_MWA_JUMPSLASH_START,
/* 18 */ PLAYER_MWA_FLIPSLASH_FINISH,
/* 19 */ PLAYER_MWA_JUMPSLASH_FINISH,
/* 20 */ PLAYER_MWA_BACKSLASH_RIGHT,
/* 21 */ PLAYER_MWA_BACKSLASH_LEFT,
/* 22 */ PLAYER_MWA_HAMMER_FORWARD,
/* 23 */ PLAYER_MWA_HAMMER_SIDE,
/* 24 */ PLAYER_MWA_SPIN_ATTACK_1H,
/* 25 */ PLAYER_MWA_SPIN_ATTACK_2H,
/* 26 */ PLAYER_MWA_BIG_SPIN_1H,
/* 27 */ PLAYER_MWA_BIG_SPIN_2H,
/* 28 */ PLAYER_MWA_MAX
} PlayerMeleeWeaponAnimation;
typedef enum {
/* -1 */ PLAYER_DOORTYPE_AJAR = -1,
/* 0 */ PLAYER_DOORTYPE_NONE,

View file

@ -4041,7 +4041,7 @@ u8 func_800355E4(GlobalContext* globalCtx, Collider* collider) {
Player* player = GET_PLAYER(globalCtx);
if ((collider->acFlags & AC_TYPE_PLAYER) && (player->meleeWeaponState != 0) &&
(player->meleeWeaponAnimation == 0x16)) {
(player->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD)) {
return true;
} else {
return false;

View file

@ -1111,7 +1111,7 @@ void func_800906D4(GlobalContext* globalCtx, Player* this, Vec3f* newTipPos) {
}
if ((this->meleeWeaponState > 0) &&
((this->meleeWeaponAnimation < 0x18) || (this->stateFlags2 & PLAYER_STATE2_17))) {
((this->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H) || (this->stateFlags2 & PLAYER_STATE2_17))) {
func_80090480(globalCtx, &this->meleeWeaponQuads[0], &this->meleeWeaponInfo[1], &newTipPos[1], &newBasePos[1]);
func_80090480(globalCtx, &this->meleeWeaponQuads[1], &this->meleeWeaponInfo[2], &newTipPos[2], &newBasePos[2]);
}

View file

@ -126,7 +126,8 @@ void BgHidanDalm_Wait(BgHidanDalm* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
if ((this->collider.base.acFlags & AC_HIT) && !Player_InCsMode(globalCtx) &&
(player->meleeWeaponAnimation == 22 || player->meleeWeaponAnimation == 23)) {
(player->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD ||
player->meleeWeaponAnimation == PLAYER_MWA_HAMMER_SIDE)) {
this->collider.base.acFlags &= ~AC_HIT;
if ((this->collider.elements[0].info.bumperFlags & BUMP_HIT) ||
(this->collider.elements[1].info.bumperFlags & BUMP_HIT)) {

View file

@ -3967,8 +3967,7 @@ void BossGanon_LightBall_Update(Actor* thisx, GlobalContext* globalCtx2) {
this->unk_1C2 = 3;
}
// if a spin attack is used
if (player->meleeWeaponAnimation >= 0x18) {
if (player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) {
this->actor.speedXZ = 20.0f;
}
break;
@ -4410,7 +4409,7 @@ void func_808E2544(Actor* thisx, GlobalContext* globalCtx) {
this->actor.world.rot.x = (Math_CosS(this->unk_1A2 * 0x3400) * sp84 * 0.1f) + this->actor.shape.rot.x;
this->actor.world.rot.y = (Math_SinS(this->unk_1A2 * 0x1A00) * sp84) + this->actor.shape.rot.y;
if ((player->meleeWeaponState != 0) && (player->meleeWeaponAnimation >= 0x18) &&
if ((player->meleeWeaponState != 0) && (player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) &&
(this->actor.xzDistToPlayer < 80.0f)) {
this->unk_1C2 = 0xC;
this->actor.speedXZ = -30.0f;

View file

@ -509,7 +509,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) {
this->work[FHGFIRE_RETURN_COUNT] = 100;
}
if (!canBottleReflect2 && (player->meleeWeaponAnimation >= 24)) {
if (!canBottleReflect2 && (player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H)) {
this->actor.speedXZ = 20.0f;
this->work[FHGFIRE_RETURN_COUNT] = 4;
} else {

View file

@ -282,7 +282,7 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) {
angleToLink = ABS(angleToLink);
if (func_800354B4(globalCtx, thisx, 100.0f, 0x2710, 0x3E80, thisx->shape.rot.y)) {
if (player->meleeWeaponAnimation == 0x11) {
if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnGeldB_SetupSpinDodge(this, globalCtx);
return true;
} else if (globalCtx->gameplayFrames & 1) {
@ -296,7 +296,7 @@ s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) {
(thisx->xzDistToPlayer < 90.0f)) {
EnGeldB_SetupJump(this);
return true;
} else if (player->meleeWeaponAnimation == 0x11) {
} else if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnGeldB_SetupSpinDodge(this, globalCtx);
return true;
} else if ((thisx->xzDistToPlayer < 90.0f) && (globalCtx->gameplayFrames & 1)) {
@ -1141,7 +1141,7 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) {
if ((ABS(angleToLink) <= 0x4000) && (this->actor.xzDistToPlayer < 40.0f) &&
(ABS(this->actor.yDistToPlayer) < 50.0f)) {
if (func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) {
if (player->meleeWeaponAnimation == 0x11) {
if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnGeldB_SetupSpinDodge(this, globalCtx);
} else if (globalCtx->gameplayFrames & 1) {
EnGeldB_SetupBlock(this);
@ -1162,7 +1162,7 @@ void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) {
}
} else if ((this->timer == 0) &&
func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x4000, this->actor.shape.rot.y)) {
if (player->meleeWeaponAnimation == 0x11) {
if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnGeldB_SetupSpinDodge(this, globalCtx);
} else if (!EnGeldB_DodgeRanged(globalCtx, this)) {
if ((globalCtx->gameplayFrames & 1)) {

View file

@ -156,21 +156,35 @@ static Vec3f sPieceSizes[] = {
/* POST_LOWER */ { 200.0f, 500.0f, 0.0f },
};
static u8 sCutTypes[] = {
/* 1H_OVER */ CUT_VERT_L, /* 2H_OVER */ CUT_VERT_L,
/* 1H_COMBO */ CUT_DIAG_R, /* 2H_COMBO */ CUT_DIAG_R,
/* 1H_LEFT */ CUT_HORIZ, /* 2H_LEFT */ CUT_HORIZ,
/* 1H_COMBO */ CUT_HORIZ, /* 2H_COMBO */ CUT_HORIZ,
/* 1H_RIGHT */ CUT_HORIZ, /* 2H_RIGHT */ CUT_HORIZ,
/* 1H_COMBO */ CUT_HORIZ, /* 2H_COMBO */ CUT_HORIZ,
/* 1H_STAB */ CUT_POST, /* 2H_STAB */ CUT_POST,
/* 1H_COMBO */ CUT_POST, /* 2H_COMBO */ CUT_POST,
/* FLIP_START */ CUT_VERT_L, /* JUMP_START */ CUT_VERT_L,
/* FLIP_END */ CUT_VERT_L, /* JUMP_END */ CUT_VERT_L,
/* BACK_LEFT */ CUT_HORIZ, /* BACK_RIGHT */ CUT_HORIZ,
/* OVER_HAMMER */ CUT_POST, /* SIDE_HAMMER */ CUT_POST,
/* 1H_SPIN_ATK */ CUT_POST, /* 2H_SPIN_ATK */ CUT_POST,
/* 1H_BIG_SPIN */ CUT_POST, /* 2H_BIG_SPIN */ CUT_POST,
static u8 sCutTypes[PLAYER_MWA_MAX] = {
CUT_VERT_L, // PLAYER_MWA_FORWARD_SLASH_1H
CUT_VERT_L, // PLAYER_MWA_FORWARD_SLASH_2H
CUT_DIAG_R, // PLAYER_MWA_FORWARD_COMBO_1H
CUT_DIAG_R, // PLAYER_MWA_FORWARD_COMBO_2H
CUT_HORIZ, // PLAYER_MWA_RIGHT_SLASH_1H
CUT_HORIZ, // PLAYER_MWA_RIGHT_SLASH_2H
CUT_HORIZ, // PLAYER_MWA_RIGHT_COMBO_1H
CUT_HORIZ, // PLAYER_MWA_RIGHT_COMBO_2H
CUT_HORIZ, // PLAYER_MWA_LEFT_SLASH_1H
CUT_HORIZ, // PLAYER_MWA_LEFT_SLASH_2H
CUT_HORIZ, // PLAYER_MWA_LEFT_COMBO_1H
CUT_HORIZ, // PLAYER_MWA_LEFT_COMBO_2H
CUT_POST, // PLAYER_MWA_STAB_1H
CUT_POST, // PLAYER_MWA_STAB_2H
CUT_POST, // PLAYER_MWA_STAB_COMBO_1H
CUT_POST, // PLAYER_MWA_STAB_COMBO_2H
CUT_VERT_L, // PLAYER_MWA_FLIPSLASH_START
CUT_VERT_L, // PLAYER_MWA_JUMPSLASH_START
CUT_VERT_L, // PLAYER_MWA_FLIPSLASH_FINISH
CUT_VERT_L, // PLAYER_MWA_JUMPSLASH_FINISH
CUT_HORIZ, // PLAYER_MWA_BACKSLASH_RIGHT
CUT_HORIZ, // PLAYER_MWA_BACKSLASH_LEFT
CUT_POST, // PLAYER_MWA_HAMMER_FORWARD
CUT_POST, // PLAYER_MWA_HAMMER_SIDE
CUT_POST, // PLAYER_MWA_SPIN_ATTACK_1H
CUT_POST, // PLAYER_MWA_SPIN_ATTACK_2H
CUT_POST, // PLAYER_MWA_BIG_SPIN_1H
CUT_POST, // PLAYER_MWA_BIG_SPIN_2H
};
static u16 sCutFlags[] = {

View file

@ -131,7 +131,7 @@ void func_80A9F350(EnMThunder* this, GlobalContext* globalCtx) {
Player* player = GET_PLAYER(globalCtx);
if (player->stateFlags2 & PLAYER_STATE2_17) {
if (player->meleeWeaponAnimation >= 0x18) {
if (player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) {
Audio_PlaySoundGeneral(NA_SE_IT_ROLLING_CUT, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_SWING_HARD, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
@ -181,7 +181,7 @@ void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx) {
}
if (player->unk_858 <= 0.15f) {
if ((player->unk_858 >= 0.1f) && (player->meleeWeaponAnimation >= 0x18)) {
if ((player->unk_858 >= 0.1f) && (player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H)) {
Audio_PlaySoundGeneral(NA_SE_IT_ROLLING_CUT, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0,
&D_801333E8);
Audio_PlaySoundGeneral(NA_SE_IT_SWORD_SWING_HARD, &player->actor.projectedPos, 4, &D_801333E0,

View file

@ -339,7 +339,7 @@ void func_80AD97C8(EnPoSisters* this, GlobalContext* globalCtx) {
f32 sp20;
if (this->unk_195 == 0 || this->actionFunc != func_80ADAAA4) {
if ((player->meleeWeaponState == 0 || player->meleeWeaponAnimation >= 24) &&
if ((player->meleeWeaponState == 0 || player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) &&
player->actor.world.pos.y - player->actor.floorHeight < 1.0f) {
Math_StepToF(&this->unk_294, 110.0f, 3.0f);
} else {

View file

@ -479,8 +479,10 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) {
if (this->unk_283 == 0) {
if ((this->actor.colChkInfo.damageEffect == 0xD) ||
((this->actor.colChkInfo.damageEffect == 0xE) &&
((player->meleeWeaponAnimation >= 4 && player->meleeWeaponAnimation <= 11) ||
(player->meleeWeaponAnimation == 20 || player->meleeWeaponAnimation == 21)))) {
((player->meleeWeaponAnimation >= PLAYER_MWA_RIGHT_SLASH_1H &&
player->meleeWeaponAnimation <= PLAYER_MWA_LEFT_COMBO_2H) ||
(player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_RIGHT ||
player->meleeWeaponAnimation == PLAYER_MWA_BACKSLASH_LEFT)))) {
BodyBreak_Alloc(&this->bodyBreak, 2, globalCtx);
this->unk_283 = 1;
}

View file

@ -495,7 +495,7 @@ void EnTest_Idle(EnTest* this, GlobalContext* globalCtx) {
if ((player->meleeWeaponState != 0) && (ABS(yawDiff) >= 0x1F40)) {
this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer;
if (Rand_ZeroOne() > 0.7f && player->meleeWeaponAnimation != 0x11) {
if (Rand_ZeroOne() > 0.7f && player->meleeWeaponAnimation != PLAYER_MWA_JUMPSLASH_START) {
EnTest_SetupJumpBack(this);
} else {
func_808627C4(this, globalCtx);
@ -626,7 +626,7 @@ void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) {
if (ABS(yawDiff) >= 0x1F40) {
this->actor.shape.rot.y = this->actor.world.rot.y = this->actor.yawTowardsPlayer;
if ((Rand_ZeroOne() > 0.7f) && (player->meleeWeaponAnimation != 0x11)) {
if ((Rand_ZeroOne() > 0.7f) && (player->meleeWeaponAnimation != PLAYER_MWA_JUMPSLASH_START)) {
EnTest_SetupJumpBack(this);
} else {
EnTest_SetupStopAndBlock(this);
@ -1239,7 +1239,7 @@ void func_808621D4(EnTest* this, GlobalContext* globalCtx) {
(this->actor.xzDistToPlayer < 80.0f))) {
EnTest_SetupJumpUp(this);
} else if ((Rand_ZeroOne() > 0.7f) && (this->actor.params != STALFOS_TYPE_CEILING) &&
(player->meleeWeaponAnimation != 0x11)) {
(player->meleeWeaponAnimation != PLAYER_MWA_JUMPSLASH_START)) {
EnTest_SetupJumpBack(this);
} else {
EnTest_SetupStopAndBlock(this);
@ -1279,7 +1279,7 @@ void func_80862418(EnTest* this, GlobalContext* globalCtx) {
(this->actor.xzDistToPlayer < 80.0f))) {
EnTest_SetupJumpUp(this);
} else if ((Rand_ZeroOne() > 0.7f) && (this->actor.params != STALFOS_TYPE_CEILING) &&
(player->meleeWeaponAnimation != 0x11)) {
(player->meleeWeaponAnimation != PLAYER_MWA_JUMPSLASH_START)) {
EnTest_SetupJumpBack(this);
} else {
EnTest_SetupStopAndBlock(this);
@ -1325,7 +1325,7 @@ void EnTest_Stunned(EnTest* this, GlobalContext* globalCtx) {
((ABS((s16)(this->actor.wallYaw - this->actor.shape.rot.y)) < 0x38A4) &&
(this->actor.xzDistToPlayer < 80.0f))) {
EnTest_SetupJumpUp(this);
} else if ((Rand_ZeroOne() > 0.7f) && (player->meleeWeaponAnimation != 0x11)) {
} else if ((Rand_ZeroOne() > 0.7f) && (player->meleeWeaponAnimation != PLAYER_MWA_JUMPSLASH_START)) {
EnTest_SetupJumpBack(this);
} else {
EnTest_SetupStopAndBlock(this);

View file

@ -16,37 +16,6 @@ typedef enum {
/* 3 */ ENTORCH2_DAMAGE
} EnTorch2ActionStates;
typedef enum {
/* 0 */ FORWARD_SLASH_1H,
/* 1 */ FORWARD_SLASH_2H,
/* 2 */ FORWARD_COMBO_1H,
/* 3 */ FORWARD_COMBO_2H,
/* 4 */ RIGHT_SLASH_1H,
/* 5 */ RIGHT_SLASH_2H,
/* 6 */ RIGHT_COMBO_1H,
/* 7 */ RIGHT_COMBO_2H,
/* 8 */ LEFT_SLASH_1H,
/* 9 */ LEFT_SLASH_2H,
/* 10 */ LEFT_COMBO_1H,
/* 11 */ LEFT_COMBO_2H,
/* 12 */ STAB_1H,
/* 13 */ STAB_2H,
/* 14 */ STAB_COMBO_1H,
/* 15 */ STAB_COMBO_2H,
/* 16 */ FLIPSLASH_START,
/* 17 */ JUMPSLASH_START,
/* 18 */ FLIPSLASH_FINISH,
/* 19 */ JUMPSLASH_FINISH,
/* 20 */ BACKSLASH_RIGHT,
/* 21 */ BACKSLASH_LEFT,
/* 22 */ HAMMER_FORWARD,
/* 23 */ HAMMER_SIDE,
/* 24 */ SPIN_ATTACK_1H,
/* 25 */ SPIN_ATTACK_2H,
/* 26 */ BIG_SPIN_1H,
/* 27 */ BIG_SPIN_2H
} PlayerSwordAnimation;
void EnTorch2_Init(Actor* thisx, GlobalContext* globalCtx);
void EnTorch2_Destroy(Actor* thisx, GlobalContext* globalCtx);
void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx);
@ -328,7 +297,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
// Handles Dark Link's initial reaction to jumpslashes
if (((player->meleeWeaponState != 0) || (player->actor.velocity.y > -3.0f)) &&
(player->meleeWeaponAnimation == JUMPSLASH_START)) {
(player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START)) {
this->actor.world.rot.y = this->actor.shape.rot.y = this->actor.yawTowardsPlayer;
if (globalCtx->gameplayFrames % 2) {
@ -383,13 +352,15 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
// Handles Dark Link's reaction to sword attack other than jumpslashes
if (func_800354B4(globalCtx, &this->actor, 120.0f, 0x7FFF, 0x7FFF, this->actor.world.rot.y)) {
if ((player->meleeWeaponAnimation == STAB_1H) && (this->actor.xzDistToPlayer < 90.0f)) {
if ((player->meleeWeaponAnimation == PLAYER_MWA_STAB_1H) &&
(this->actor.xzDistToPlayer < 90.0f)) {
// Handles the reaction to a one-handed stab. If the conditions are satisfied,
// Dark Link jumps on Link's sword. Otherwise he backflips away.
if ((this->meleeWeaponState == 0) && (sCounterState == 0) &&
(player->invincibilityTimer == 0) && (player->meleeWeaponAnimation == STAB_1H) &&
(player->invincibilityTimer == 0) &&
(player->meleeWeaponAnimation == PLAYER_MWA_STAB_1H) &&
(this->actor.xzDistToPlayer <= 85.0f) && Actor_IsTargeted(globalCtx, &this->actor)) {
sStickTilt = 0.0f;
@ -415,17 +386,17 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
sStickAngle = thisx->yawTowardsPlayer;
input->cur.button = BTN_B;
if (player->meleeWeaponAnimation <= FORWARD_COMBO_2H) {
if (player->meleeWeaponAnimation <= PLAYER_MWA_FORWARD_COMBO_2H) {
sStickTilt = 0.0f;
} else if (player->meleeWeaponAnimation <= RIGHT_COMBO_2H) {
} else if (player->meleeWeaponAnimation <= PLAYER_MWA_RIGHT_COMBO_2H) {
sStickTilt = 127.0f;
sStickAngle += 0x4000;
} else if (player->meleeWeaponAnimation <= LEFT_COMBO_2H) {
} else if (player->meleeWeaponAnimation <= PLAYER_MWA_LEFT_COMBO_2H) {
sStickTilt = 127.0f;
sStickAngle -= 0x4000;
} else if (player->meleeWeaponAnimation <= HAMMER_SIDE) {
} else if (player->meleeWeaponAnimation <= PLAYER_MWA_HAMMER_SIDE) {
input->cur.button = BTN_R;
} else if (player->meleeWeaponAnimation <= BIG_SPIN_2H) {
} else if (player->meleeWeaponAnimation <= PLAYER_MWA_BIG_SPIN_2H) {
EnTorch2_Backflip(this, input, &this->actor);
} else {
EnTorch2_Backflip(this, input, &this->actor);
@ -460,8 +431,9 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
Math_SmoothStepToS(&sStickAngle, player->actor.shape.rot.y + 0x7FFF, 1, 0x2328, 0);
}
} else if (this->actor.xzDistToPlayer > 100.0f + sp50) {
if ((player->meleeWeaponState == 0) || (player->meleeWeaponAnimation < SPIN_ATTACK_1H) ||
(player->meleeWeaponAnimation > BIG_SPIN_2H) ||
if ((player->meleeWeaponState == 0) ||
!((player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) &&
(player->meleeWeaponAnimation <= PLAYER_MWA_BIG_SPIN_2H)) ||
(this->actor.xzDistToPlayer >= 280.0f)) {
sStickTilt = 127.0f;
sStickAngle = this->actor.yawTowardsPlayer;
@ -561,8 +533,8 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) {
// Causes Dark Link to shield in place when Link is using magic attacks other than the spin attack
if ((gSaveContext.unk_13F0 == 3) &&
(player->meleeWeaponState == 0 || (player->meleeWeaponAnimation < SPIN_ATTACK_1H) ||
(player->meleeWeaponAnimation > BIG_SPIN_2H))) {
(player->meleeWeaponState == 0 || !((player->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) &&
(player->meleeWeaponAnimation <= PLAYER_MWA_BIG_SPIN_2H)))) {
sStickTilt = 0.0f;
input->cur.stick_x = 0;
input->cur.stick_y = 0;

View file

@ -293,7 +293,7 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) {
playerYawDiff = ABS(playerYawDiff);
if (func_800354B4(globalCtx, &this->actor, 100.0f, 0x2710, 0x2EE0, this->actor.shape.rot.y)) {
if (player->meleeWeaponAnimation == 0x11) {
if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnWf_SetupBlocking(this);
return true;
}
@ -311,7 +311,7 @@ s32 EnWf_ChangeAction(GlobalContext* globalCtx, EnWf* this, s16 mustChoose) {
(this->actor.xzDistToPlayer < 120.0f)) {
EnWf_SetupSomersaultAndAttack(this);
return true;
} else if (player->meleeWeaponAnimation == 0x11) {
} else if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnWf_SetupBlocking(this);
return true;
} else if ((this->actor.xzDistToPlayer < 80.0f) && (globalCtx->gameplayFrames % 2) != 0) {
@ -1024,7 +1024,7 @@ void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) {
if ((ABS(yawDiff) <= 0x4000) && (this->actor.xzDistToPlayer < 60.0f) &&
(ABS(this->actor.yDistToPlayer) < 50.0f)) {
if (func_800354B4(globalCtx, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) {
if (player->meleeWeaponAnimation == 0x11) {
if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnWf_SetupBlocking(this);
} else if ((globalCtx->gameplayFrames % 2) != 0) {
EnWf_SetupBlocking(this);
@ -1047,7 +1047,7 @@ void EnWf_Blocking(EnWf* this, GlobalContext* globalCtx) {
}
} else if (this->actionTimer == 0) {
if (func_800354B4(globalCtx, &this->actor, 100.0f, 10000, 0x4000, this->actor.shape.rot.y)) {
if (player->meleeWeaponAnimation == 0x11) {
if (player->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_START) {
EnWf_SetupBlocking(this);
} else if ((globalCtx->gameplayFrames % 2) != 0) {
EnWf_SetupBlocking(this);

View file

@ -1029,34 +1029,62 @@ static ExplosiveInfo sExplosiveInfos[] = {
{ ITEM_BOMBCHU, ACTOR_EN_BOM_CHU },
};
static struct_80854190 D_80854190[] = {
static struct_80854190 D_80854190[PLAYER_MWA_MAX] = {
/* PLAYER_MWA_FORWARD_SLASH_1H */
{ &gPlayerAnim_002A80, &gPlayerAnim_002A90, &gPlayerAnim_002A88, 1, 4 },
/* PLAYER_MWA_FORWARD_SLASH_2H */
{ &gPlayerAnim_0028C0, &gPlayerAnim_0028C8, &gPlayerAnim_002498, 1, 4 },
/* PLAYER_MWA_FORWARD_COMBO_1H */
{ &gPlayerAnim_002A98, &gPlayerAnim_002AA0, &gPlayerAnim_002540, 0, 5 },
/* PLAYER_MWA_FORWARD_COMBO_2H */
{ &gPlayerAnim_0028D0, &gPlayerAnim_0028D8, &gPlayerAnim_0024A0, 1, 7 },
/* PLAYER_MWA_RIGHT_SLASH_1H */
{ &gPlayerAnim_002968, &gPlayerAnim_002970, &gPlayerAnim_0024C0, 1, 4 },
/* PLAYER_MWA_RIGHT_SLASH_2H */
{ &gPlayerAnim_002880, &gPlayerAnim_002888, &gPlayerAnim_002478, 0, 5 },
/* PLAYER_MWA_RIGHT_COMBO_1H */
{ &gPlayerAnim_002978, &gPlayerAnim_002980, &gPlayerAnim_0024C8, 2, 8 },
/* PLAYER_MWA_RIGHT_COMBO_2H */
{ &gPlayerAnim_002890, &gPlayerAnim_002898, &gPlayerAnim_002480, 3, 8 },
/* PLAYER_MWA_LEFT_SLASH_1H */
{ &gPlayerAnim_0029A0, &gPlayerAnim_0029A8, &gPlayerAnim_0024D0, 0, 4 },
/* PLAYER_MWA_LEFT_SLASH_2H */
{ &gPlayerAnim_0028A0, &gPlayerAnim_0028A8, &gPlayerAnim_002488, 0, 5 },
/* PLAYER_MWA_LEFT_COMBO_1H */
{ &gPlayerAnim_0029B0, &gPlayerAnim_0029B8, &gPlayerAnim_0024D8, 0, 6 },
/* PLAYER_MWA_LEFT_COMBO_2H */
{ &gPlayerAnim_0028B0, &gPlayerAnim_0028B8, &gPlayerAnim_002490, 1, 5 },
/* PLAYER_MWA_STAB_1H */
{ &gPlayerAnim_002AA8, &gPlayerAnim_002AB0, &gPlayerAnim_002548, 0, 3 },
/* PLAYER_MWA_STAB_2H */
{ &gPlayerAnim_0028E0, &gPlayerAnim_0028E8, &gPlayerAnim_0024A8, 0, 3 },
/* PLAYER_MWA_STAB_COMBO_1H */
{ &gPlayerAnim_002AB8, &gPlayerAnim_002AC0, &gPlayerAnim_002550, 1, 9 },
/* PLAYER_MWA_STAB_COMBO_2H */
{ &gPlayerAnim_0028F0, &gPlayerAnim_0028F8, &gPlayerAnim_0024B0, 1, 8 },
/* PLAYER_MWA_FLIPSLASH_START */
{ &gPlayerAnim_002A60, &gPlayerAnim_002A50, &gPlayerAnim_002A50, 1, 10 },
/* PLAYER_MWA_JUMPSLASH_START */
{ &gPlayerAnim_002900, &gPlayerAnim_002910, &gPlayerAnim_002910, 1, 11 },
/* PLAYER_MWA_FLIPSLASH_FINISH */
{ &gPlayerAnim_002A50, &gPlayerAnim_002A58, &gPlayerAnim_002A58, 1, 2 },
/* PLAYER_MWA_JUMPSLASH_FINISH */
{ &gPlayerAnim_002910, &gPlayerAnim_002908, &gPlayerAnim_002908, 1, 2 },
/* PLAYER_MWA_BACKSLASH_RIGHT */
{ &gPlayerAnim_002B80, &gPlayerAnim_002B88, &gPlayerAnim_002B88, 1, 5 },
/* PLAYER_MWA_BACKSLASH_LEFT */
{ &gPlayerAnim_002B70, &gPlayerAnim_002B78, &gPlayerAnim_002B78, 1, 4 },
/* PLAYER_MWA_HAMMER_FORWARD */
{ &gPlayerAnim_002C40, &gPlayerAnim_002C50, &gPlayerAnim_002C48, 3, 10 },
/* PLAYER_MWA_HAMMER_SIDE */
{ &gPlayerAnim_002C70, &gPlayerAnim_002C80, &gPlayerAnim_002C78, 2, 11 },
/* PLAYER_MWA_SPIN_ATTACK_1H */
{ &gPlayerAnim_002B28, &gPlayerAnim_002B30, &gPlayerAnim_002560, 0, 12 },
/* PLAYER_MWA_SPIN_ATTACK_2H */
{ &gPlayerAnim_002940, &gPlayerAnim_002948, &gPlayerAnim_0024B8, 0, 15 },
/* PLAYER_MWA_BIG_SPIN_1H */
{ &gPlayerAnim_0029C0, &gPlayerAnim_0029C8, &gPlayerAnim_002560, 0, 16 },
/* PLAYER_MWA_BIG_SPIN_2H */
{ &gPlayerAnim_0029C0, &gPlayerAnim_0029C8, &gPlayerAnim_0024B8, 0, 16 },
};
@ -1090,8 +1118,8 @@ static LinkAnimationHeader* D_80854378[] = {
&gPlayerAnim_002918,
};
static u8 D_80854380[2] = { 0x18, 0x19 };
static u8 D_80854384[2] = { 0x1A, 0x1B };
static u8 D_80854380[2] = { PLAYER_MWA_SPIN_ATTACK_1H, PLAYER_MWA_SPIN_ATTACK_2H };
static u8 D_80854384[2] = { PLAYER_MWA_BIG_SPIN_1H, PLAYER_MWA_BIG_SPIN_2H };
static u16 D_80854388[] = { BTN_B, BTN_CLEFT, BTN_CDOWN, BTN_CRIGHT };
@ -1786,7 +1814,7 @@ void func_80833A20(Player* this, s32 newMeleeWeaponState) {
voiceSfx = NA_SE_VO_LI_SWORD_N;
if (this->heldItemActionParam == PLAYER_AP_HAMMER) {
itemSfx = NA_SE_IT_HAMMER_SWING;
} else if (this->meleeWeaponAnimation >= 0x18) {
} else if (this->meleeWeaponAnimation >= PLAYER_MWA_SPIN_ATTACK_1H) {
itemSfx = 0;
voiceSfx = NA_SE_VO_LI_SWORD_L;
} else if (this->unk_845 >= 3) {
@ -1798,7 +1826,8 @@ void func_80833A20(Player* this, s32 newMeleeWeaponState) {
func_808328EC(this, itemSfx);
}
if ((this->meleeWeaponAnimation < 0x10) || (this->meleeWeaponAnimation >= 0x14)) {
if (!((this->meleeWeaponAnimation >= PLAYER_MWA_FLIPSLASH_START) &&
(this->meleeWeaponAnimation <= PLAYER_MWA_JUMPSLASH_FINISH))) {
func_80832698(this, voiceSfx);
}
}
@ -3256,7 +3285,8 @@ s32 func_808375D8(Player* this) {
void func_80837704(GlobalContext* globalCtx, Player* this) {
LinkAnimationHeader* anim;
if ((this->meleeWeaponAnimation >= 4) && (this->meleeWeaponAnimation < 8)) {
if ((this->meleeWeaponAnimation >= PLAYER_MWA_RIGHT_SLASH_1H) &&
(this->meleeWeaponAnimation <= PLAYER_MWA_RIGHT_COMBO_2H)) {
anim = D_80854358[Player_HoldsTwoHandedWeapon(this)];
} else {
anim = D_80854350[Player_HoldsTwoHandedWeapon(this)];
@ -3273,8 +3303,18 @@ void func_808377DC(GlobalContext* globalCtx, Player* this) {
func_80837704(globalCtx, this);
}
static s8 D_80854480[] = { 12, 4, 4, 8 };
static s8 D_80854484[] = { 22, 23, 22, 23 };
static s8 D_80854480[] = {
PLAYER_MWA_STAB_1H,
PLAYER_MWA_RIGHT_SLASH_1H,
PLAYER_MWA_RIGHT_SLASH_1H,
PLAYER_MWA_LEFT_SLASH_1H,
};
static s8 D_80854484[] = {
PLAYER_MWA_HAMMER_FORWARD,
PLAYER_MWA_HAMMER_SIDE,
PLAYER_MWA_HAMMER_FORWARD,
PLAYER_MWA_HAMMER_SIDE,
};
s32 func_80837818(Player* this) {
s32 sp1C = this->unk_84B[this->unk_846];
@ -3288,25 +3328,25 @@ s32 func_80837818(Player* this) {
this->unk_845 = 0;
} else {
if (func_808375D8(this)) {
sp18 = 24;
sp18 = PLAYER_MWA_SPIN_ATTACK_1H;
} else {
if (sp1C < 0) {
if (func_80833BCC(this)) {
sp18 = 0;
sp18 = PLAYER_MWA_FORWARD_SLASH_1H;
} else {
sp18 = 4;
sp18 = PLAYER_MWA_RIGHT_SLASH_1H;
}
} else {
sp18 = D_80854480[sp1C];
if (sp18 == 12) {
if (sp18 == PLAYER_MWA_STAB_1H) {
this->stateFlags2 |= PLAYER_STATE2_30;
if (!func_80833BCC(this)) {
sp18 = 0;
sp18 = PLAYER_MWA_FORWARD_SLASH_1H;
}
}
}
if (this->heldItemActionParam == PLAYER_AP_STICK) {
sp18 = 0;
sp18 = PLAYER_MWA_FORWARD_SLASH_1H;
}
}
if (Player_HoldsTwoHandedWeapon(this)) {
@ -3339,7 +3379,7 @@ void func_80837948(GlobalContext* globalCtx, Player* this, s32 arg2) {
func_80835C58(globalCtx, this, func_808502D0, 0);
this->unk_844 = 8;
if ((arg2 < 18) || (arg2 >= 20)) {
if (!((arg2 >= PLAYER_MWA_FLIPSLASH_FINISH) && (arg2 <= PLAYER_MWA_JUMPSLASH_FINISH))) {
func_80832318(this);
}
@ -3355,7 +3395,7 @@ void func_80837948(GlobalContext* globalCtx, Player* this, s32 arg2) {
this->meleeWeaponAnimation = arg2;
func_808322D0(globalCtx, this, D_80854190[arg2].unk_00);
if ((arg2 != 16) && (arg2 != 17)) {
if ((arg2 != PLAYER_MWA_FLIPSLASH_START) && (arg2 != PLAYER_MWA_JUMPSLASH_START)) {
func_80832F54(globalCtx, this, 0x209);
}
@ -3367,7 +3407,7 @@ void func_80837948(GlobalContext* globalCtx, Player* this, s32 arg2) {
temp = Player_GetMeleeWeaponHeld(this) - 1;
}
if ((arg2 >= 16) && (arg2 < 20)) {
if ((arg2 >= PLAYER_MWA_FLIPSLASH_START) && (arg2 <= PLAYER_MWA_JUMPSLASH_FINISH)) {
flags = D_80854488[temp][1];
} else {
flags = D_80854488[temp][0];
@ -4984,7 +5024,7 @@ s32 func_8083BB20(Player* this) {
s32 func_8083BBA0(Player* this, GlobalContext* globalCtx) {
if (func_8083BB20(this) && (D_808535E4 != 7)) {
func_8083BA90(globalCtx, this, 17, 3.0f, 4.5f);
func_8083BA90(globalCtx, this, PLAYER_MWA_JUMPSLASH_START, 3.0f, 4.5f);
return 1;
}
@ -5039,7 +5079,7 @@ s32 func_8083BDBC(Player* this, GlobalContext* globalCtx) {
}
} else {
if ((Player_GetMeleeWeaponHeld(this) != 0) && func_808365C8(this)) {
func_8083BA90(globalCtx, this, 17, 5.0f, 5.0f);
func_8083BA90(globalCtx, this, PLAYER_MWA_JUMPSLASH_START, 5.0f, 5.0f);
} else {
func_8083BC04(this, globalCtx);
}
@ -7423,7 +7463,7 @@ s32 func_808428D8(Player* this, GlobalContext* globalCtx) {
if (!Player_IsChildWithHylianShield(this) && (Player_GetMeleeWeaponHeld(this) != 0) && D_80853614) {
func_80832264(globalCtx, this, &gPlayerAnim_002EC8);
this->unk_84F = 1;
this->meleeWeaponAnimation = 0xC;
this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H;
this->currentYaw = this->actor.shape.rot.y + this->unk_6BE;
return 1;
}
@ -7533,7 +7573,7 @@ s32 func_80842DF4(GlobalContext* globalCtx, Player* this) {
s32 sp48;
if (this->meleeWeaponState > 0) {
if (this->meleeWeaponAnimation < 0x18) {
if (this->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H) {
if (!(this->meleeWeaponQuads[0].base.atFlags & AT_BOUNCED) &&
!(this->meleeWeaponQuads[1].base.atFlags & AT_BOUNCED)) {
if (this->skelAnime.curFrame >= 2.0f) {
@ -7591,7 +7631,7 @@ s32 func_80842DF4(GlobalContext* globalCtx, Player* this) {
temp1 = (this->meleeWeaponQuads[0].base.atFlags & AT_HIT) || (this->meleeWeaponQuads[1].base.atFlags & AT_HIT);
if (temp1) {
if (this->meleeWeaponAnimation < 0x18) {
if (this->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H) {
Actor* at = this->meleeWeaponQuads[temp1 ? 1 : 0].base.at;
if ((at != NULL) && (at->id != ACTOR_EN_KANBAN)) {
@ -9727,8 +9767,8 @@ void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) {
}
} else if (this->stateFlags1 & PLAYER_STATE1_19) {
camMode = CAM_MODE_FREEFALL;
} else if ((this->meleeWeaponState != 0) && (this->meleeWeaponAnimation >= 0) &&
(this->meleeWeaponAnimation < 0x18)) {
} else if ((this->meleeWeaponState != 0) && (this->meleeWeaponAnimation >= PLAYER_MWA_FORWARD_SLASH_1H) &&
(this->meleeWeaponAnimation < PLAYER_MWA_SPIN_ATTACK_1H)) {
camMode = CAM_MODE_STILL;
} else {
camMode = CAM_MODE_NORMAL;
@ -12709,7 +12749,7 @@ s32 func_80850224(Player* this, GlobalContext* globalCtx) {
func_80837948(globalCtx, this, sp24);
if (sp24 >= 0x18) {
if (sp24 >= PLAYER_MWA_SPIN_ATTACK_1H) {
this->stateFlags2 |= PLAYER_STATE2_17;
func_80837530(globalCtx, this, 0);
return 1;
@ -12769,7 +12809,8 @@ void func_808502D0(Player* this, GlobalContext* globalCtx) {
this->stateFlags3 |= PLAYER_STATE3_3;
}
} else if (this->heldItemActionParam == PLAYER_AP_HAMMER) {
if ((this->meleeWeaponAnimation == 0x16) || (this->meleeWeaponAnimation == 0x13)) {
if ((this->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD) ||
(this->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_FINISH)) {
static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f };
Vec3f shockwavePos;
f32 sp2C;
@ -12780,8 +12821,10 @@ void func_808502D0(Player* this, GlobalContext* globalCtx) {
Math_ScaledStepToS(&this->actor.focus.rot.x, Math_Atan2S(45.0f, sp2C), 800);
func_80836AB8(this, 1);
if ((((this->meleeWeaponAnimation == 0x16) && LinkAnimation_OnFrame(&this->skelAnime, 7.0f)) ||
((this->meleeWeaponAnimation == 0x13) && LinkAnimation_OnFrame(&this->skelAnime, 2.0f))) &&
if ((((this->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD) &&
LinkAnimation_OnFrame(&this->skelAnime, 7.0f)) ||
((this->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_FINISH) &&
LinkAnimation_OnFrame(&this->skelAnime, 2.0f))) &&
(sp2C > -40.0f) && (sp2C < 40.0f)) {
func_80842A28(globalCtx, this);
EffectSsBlast_SpawnWhiteShockwave(globalCtx, &shockwavePos, &zeroVec, &zeroVec);