From b3c2fc2a71010fce6d0a00786071c21ed65e6de5 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Sat, 16 Dec 2023 20:14:01 -0500 Subject: [PATCH 01/11] document knockback related functions --- include/functions.h | 10 +- include/z64player.h | 31 +++-- src/code/z_actor.c | 77 +++++++++-- .../actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c | 2 +- .../ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c | 2 +- .../z_bg_hidan_firewall.c | 2 +- .../ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c | 2 +- .../ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c | 2 +- .../ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c | 2 +- .../z_bg_jya_zurerukabe.c | 4 +- .../ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c | 2 +- src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c | 2 +- src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c | 2 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 7 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 5 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 3 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 15 +- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 2 +- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 14 +- .../actors/ovl_Demo_Kekkai/z_demo_kekkai.c | 4 +- .../actors/ovl_Door_Killer/z_door_killer.c | 2 +- .../ovl_En_Attack_Niw/z_en_attack_niw.c | 2 +- src/overlays/actors/ovl_En_Ba/z_en_ba.c | 2 +- .../actors/ovl_En_Bdfire/z_en_bdfire.c | 2 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 2 +- src/overlays/actors/ovl_En_Brob/z_en_brob.c | 6 +- .../actors/ovl_En_Bubble/z_en_bubble.c | 2 +- src/overlays/actors/ovl_En_Bx/z_en_bx.c | 2 +- src/overlays/actors/ovl_En_Dh/z_en_dh.c | 2 +- .../actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c | 2 +- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 3 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c | 3 +- .../actors/ovl_En_Fire_Rock/z_en_fire_rock.c | 2 +- src/overlays/actors/ovl_En_GeldB/z_en_geldb.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 2 +- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 2 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 6 +- .../actors/ovl_En_Honotrap/z_en_honotrap.c | 2 +- src/overlays/actors/ovl_En_Hy/z_en_hy.c | 3 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 2 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 17 +-- src/overlays/actors/ovl_En_Mm/z_en_mm.c | 2 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 2 +- src/overlays/actors/ovl_En_Part/z_en_part.c | 5 +- src/overlays/actors/ovl_En_Rr/z_en_rr.c | 2 +- src/overlays/actors/ovl_En_Ssh/z_en_ssh.c | 2 +- src/overlays/actors/ovl_En_St/z_en_st.c | 2 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 22 +-- src/overlays/actors/ovl_En_Trap/z_en_trap.c | 2 +- .../actors/ovl_player_actor/z_player.c | 130 ++++++++++-------- 50 files changed, 259 insertions(+), 168 deletions(-) diff --git a/include/functions.h b/include/functions.h index 62ca9d50034..6958ed92df0 100644 --- a/include/functions.h +++ b/include/functions.h @@ -413,11 +413,11 @@ void Actor_SetClosestSecretDistance(Actor* actor, PlayState* play); s32 Actor_IsMounted(PlayState* play, Actor* horse); u32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide); s32 Actor_NotMounted(PlayState* play, Actor* horse); -void func_8002F698(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6); -void func_8002F6D4(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); -void func_8002F71C(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4); -void func_8002F758(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); -void func_8002F7A0(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4); +void Actor_SetPlayerKnockback(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 type, u32 damage); +void Actor_SetPlayerKnockbackLarge(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage); +void Actor_SetPlayerKnockbackLargeNoDamage(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity); +void Actor_SetPlayerKnockbackSmall(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage); +void Actor_SetPlayerKnockbackSmallNoDamage(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity); void Player_PlaySfx(Player* player, u16 sfxId); void Actor_PlaySfx(Actor* actor, u16 sfxId); void func_8002F850(PlayState* play, Actor* actor); diff --git a/include/z64player.h b/include/z64player.h index f47160bdbad..e8bd5bcc40e 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -549,6 +549,21 @@ typedef enum { /* 4 */ PLAYER_LEDGE_CLIMB_4 } PlayerLedgeClimbType; +typedef enum { + /* 0 */ PLAYER_KNOCKBACK_NONE, + /* 1 */ PLAYER_KNOCKBACK_SMALL, + /* 2 */ PLAYER_KNOCKBACK_LARGE, + /* 3 */ PLAYER_KNOCKBACK_LARGE_SHOCK +} PlayerKnockbackType; + +typedef enum { + /* 0 */ PLAYER_DAMAGE_RESPONSE_NONE, + /* 1 */ PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE, + /* 2 */ PLAYER_DAMAGE_RESPONSE_KNOCKBACK_SMALL, + /* 3 */ PLAYER_DAMAGE_RESPONSE_ICE_TRAP, + /* 4 */ PLAYER_DAMAGE_RESPONSE_ELECTRIC_SHOCK +} PlayerDamageResponseType; + typedef struct { /* 0x00 */ f32 ceilingCheckHeight; /* 0x04 */ f32 unk_04; @@ -731,7 +746,7 @@ typedef struct Player { /* 0x0450 */ Vec3f unk_450; /* 0x045C */ Vec3f unk_45C; /* 0x0468 */ char unk_468[0x002]; - /* 0x046A */ union { + /* 0x046A */ union { s16 haltActorsDuringCsAction; // If true, halt actors belonging to certain categories during a `csAction` s16 slidingDoorBgCamIndex; // `BgCamIndex` used during a sliding door cutscene } cv; // "Cutscene Variable": context dependent variable that has different meanings depending on what function is called @@ -793,11 +808,11 @@ typedef struct Player { /* 0x0847 */ s8 unk_847[4]; /* 0x084B */ s8 unk_84B[4]; - /* 0x084F */ union { + /* 0x084F */ union { s8 actionVar1; } av1; // "Action Variable 1": context dependent variable that has different meanings depending on what action is currently running - /* 0x0850 */ union { + /* 0x0850 */ union { s16 actionVar2; } av2; // "Action Variable 2": context dependent variable that has different meanings depending on what action is currently running @@ -831,11 +846,11 @@ typedef struct Player { /* 0x089A */ s16 floorPitchAlt; // the calculation for this value is bugged and doesn't represent anything meaningful /* 0x089C */ s16 unk_89C; /* 0x089E */ u16 floorSfxOffset; - /* 0x08A0 */ u8 unk_8A0; - /* 0x08A1 */ u8 unk_8A1; - /* 0x08A2 */ s16 unk_8A2; - /* 0x08A4 */ f32 unk_8A4; - /* 0x08A8 */ f32 unk_8A8; + /* 0x08A0 */ u8 knockbackDamage; + /* 0x08A1 */ u8 knockbackType; + /* 0x08A2 */ s16 knockbackRot; + /* 0x08A4 */ f32 knockbackSpeed; + /* 0x08A8 */ f32 knockbackYVelocity; /* 0x08AC */ f32 pushedSpeed; // Pushing player, examples include water currents, floor conveyors, climbing sloped surfaces /* 0x08B0 */ s16 pushedYaw; // Yaw direction of player being pushed /* 0x08B4 */ WeaponInfo meleeWeaponInfo[3]; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index ccd3e20cde7..746155b81d1 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1760,30 +1760,79 @@ s32 Actor_NotMounted(PlayState* play, Actor* horse) { } } -void func_8002F698(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) { +/** + * Sets the player's knockback properties + * + * @param play + * @param actor source actor applying knockback damage + * @param speed + * @param rot the direction the player will be pushed + * @param yVelocity + * @param type PlayerKnockbackType + * @param damage additional amount of damage to deal to the player + */ +void Actor_SetPlayerKnockback(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 type, u32 damage) { Player* player = GET_PLAYER(play); - player->unk_8A0 = arg6; - player->unk_8A1 = arg5; - player->unk_8A2 = arg3; - player->unk_8A4 = arg2; - player->unk_8A8 = arg4; + player->knockbackDamage = damage; + player->knockbackType = type; + player->knockbackRot = rot; + player->knockbackSpeed = speed; + player->knockbackYVelocity = yVelocity; } -void func_8002F6D4(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { - func_8002F698(play, actor, arg2, arg3, arg4, 2, arg5); +/** + * Knocks the player to the ground + * + * @param play + * @param actor source actor applying knockback damage + * @param speed + * @param rot the direction the player will be pushed + * @param yVelocity + * @param damage additional amount of damage to deal to the player + */ +void Actor_SetPlayerKnockbackLarge(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage) { + Actor_SetPlayerKnockback(play, actor, speed, rot, yVelocity, PLAYER_KNOCKBACK_LARGE, damage); } -void func_8002F71C(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { - func_8002F6D4(play, actor, arg2, arg3, arg4, 0); +/** + * Knocks the player to the ground, without applying additional damage + * + * @param play + * @param actor source actor applying knockback damage + * @param speed + * @param rot the direction the player will be pushed + * @param yVelocity + */ +void Actor_SetPlayerKnockbackLargeNoDamage(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity) { + Actor_SetPlayerKnockbackLarge(play, actor, speed, rot, yVelocity, 0); } -void func_8002F758(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { - func_8002F698(play, actor, arg2, arg3, arg4, 1, arg5); +/** + * Knocks the player back while keeping them on their feet + * + * @param play + * @param actor + * @param speed overridden + * @param rot the direction the player will be pushed + * @param yVelocity overridden + * @param damage additional amount of damage to deal to the player + */ +void Actor_SetPlayerKnockbackSmall(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage) { + Actor_SetPlayerKnockback(play, actor, speed, rot, yVelocity, PLAYER_KNOCKBACK_SMALL, damage); } -void func_8002F7A0(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4) { - func_8002F758(play, actor, arg2, arg3, arg4, 0); +/** + * Knocks the player back while keeping them on their feet, without applying additional damage + * + * @param play + * @param actor + * @param speed overridden + * @param rot the direction the player will be pushed + * @param yVelocity overridden + */ +void Actor_SetPlayerKnockbackSmallNoDamage(PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity) { + Actor_SetPlayerKnockbackSmall(play, actor, speed, rot, yVelocity, 0); } /** diff --git a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c index d586e4981bc..4dba8b8a8fa 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c +++ b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c @@ -114,7 +114,7 @@ void BgHakaTubo_Idle(BgHakaTubo* this, PlayState* play) { // Colliding with flame circle if (this->flamesCollider.base.atFlags & AT_HIT) { this->flamesCollider.base.atFlags &= ~AT_HIT; - func_8002F71C(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 5.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 5.0f); } // Colliding with hitbox inside the pot if (this->potCollider.base.acFlags & AC_HIT) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index d7df9bd1ea4..c1116fbbdca 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -211,7 +211,7 @@ void BgHidanCurtain_Update(Actor* thisx, PlayState* play2) { } else { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 1.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 1.0f); } if ((this->type == 4) || (this->type == 5)) { this->actor.world.pos.y = (2.0f * this->actor.home.pos.y) - hcParams->riseDist - this->actor.world.pos.y; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c index 97fb32ad002..aed47201926 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c @@ -133,7 +133,7 @@ void BgHidanFirewall_Collide(BgHidanFirewall* this, PlayState* play) { phi_a3 = this->actor.shape.rot.y + 0x8000; } - func_8002F71C(play, &this->actor, 5.0f, phi_a3, 1.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 5.0f, phi_a3, 1.0f); } void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c index dd2604b7fe9..6ffdcab500d 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c @@ -222,7 +222,7 @@ void BgHidanFwbig_Update(Actor* thisx, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F71C(play, &this->actor, 5.0f, this->actor.world.rot.y, 1.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 5.0f, this->actor.world.rot.y, 1.0f); if (this->direction != 0) { this->actionFunc = BgHidanFwbig_Lower; } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c index 2cbb720acd5..0f56369a684 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sekizou/z_bg_hidan_sekizou.c @@ -258,7 +258,7 @@ void func_8088D750(BgHidanSekizou* this, PlayState* play) { phi_a3 = -0x4000; } } - func_8002F71C(play, &this->dyna.actor, 5.0f, phi_a3, 1.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->dyna.actor, 5.0f, phi_a3, 1.0f); } void BgHidanSekizou_Update(Actor* thisx, PlayState* play2) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c index 6fe12df5857..afd8486b6e6 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c @@ -152,7 +152,7 @@ void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, PlayState* play) { thisx->world.rot.y += 0x8000; } - func_8002F6D4(play, thisx, 2.0f, thisx->yawTowardsPlayer, 0.0f, 0); + Actor_SetPlayerKnockbackLarge(play, thisx, 2.0f, thisx->yawTowardsPlayer, 0.0f, 0); Player_PlaySfx(GET_PLAYER(play), NA_SE_PL_BODY_HIT); this->yOffsetSpeed = 10.0f; diff --git a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c index 0fe33cddccb..df418aae82c 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c +++ b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c @@ -93,13 +93,13 @@ void func_8089B4C8(BgJyaZurerukabe* this, PlayState* play) { case 3: case 5: if (fabsf(D_8089B9C0[D_8089BA30[i]]) > 1.0f) { - func_8002F6D4(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); + Actor_SetPlayerKnockbackLarge(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); } break; case 1: case 4: if (fabsf(D_8089B9C0[D_8089BA30[i]] - D_8089B9C0[D_8089BA30[i + 1]]) > 1.0f) { - func_8002F6D4(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); + Actor_SetPlayerKnockbackLarge(play, &this->dyna.actor, 1.5f, this->dyna.actor.shape.rot.y, 0.0f, 0); } break; } diff --git a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c index 5a5e654cfd2..31403fbd8b5 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c @@ -137,7 +137,7 @@ void BgYdanMaruta_Destroy(Actor* thisx, PlayState* play) { void func_808BEFF4(BgYdanMaruta* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { - func_8002F71C(play, &this->dyna.actor, 7.0f, this->dyna.actor.shape.rot.y, 6.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->dyna.actor, 7.0f, this->dyna.actor.shape.rot.y, 6.0f); } this->dyna.actor.shape.rot.x += 0x360; CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 08ec562b5a6..a418b77dce9 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -1475,7 +1475,7 @@ void BossFd_UpdateEffects(BossFd* this, PlayState* play) { diff.z = player->actor.world.pos.z - effect->pos.z; if ((this->timers[3] == 0) && (sqrtf(SQ(diff.x) + SQ(diff.y) + SQ(diff.z)) < 20.0f)) { this->timers[3] = 50; - func_8002F6D4(play, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30); + Actor_SetPlayerKnockbackLarge(play, NULL, 5.0f, effect->kbAngle, 0.0f, 0x30); if (!player->bodyIsBurning) { for (i2 = 0; i2 < PLAYER_BODYPART_MAX; i2++) { player->bodyFlameTimers[i2] = Rand_S16Offset(0, 200); diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 42c5eb0679d..2e826a6c4c4 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -294,7 +294,7 @@ void BossFd2_Emerge(BossFd2* this, PlayState* play) { case 2: Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x7D0); if ((this->timers[0] == 1) && (this->actor.xzDistToPlayer < 120.0f)) { - func_8002F6D4(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 2.0f, 0x20); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 2.0f, 0x20); Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); } if (Animation_OnFrame(&this->skelAnime, this->fwork[FD2_END_FRAME])) { diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index 909d50b1316..571e77ab3fd 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -3978,7 +3978,7 @@ void BossGanon_LightBall_Update(Actor* thisx, PlayState* play2) { } else { if (sqrtf(SQ(xDistFromLink) + SQ(yDistFromLink) + SQ(zDistFromLink)) <= 25.0f) { spBA = 5; - func_8002F6D4(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x30); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x30); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_HIT_THUNDER); ganondorf->timers[2] = 20; @@ -4455,7 +4455,7 @@ void func_808E2544(Actor* thisx, PlayState* play) { this->actor.speed = 0.0f; if (dorf->timers[2] == 0) { - func_8002F6D4(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x50); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 0x50); SfxSource_PlaySfxAtFixedWorldPos(play, &this->actor.world.pos, 40, NA_SE_EN_GANON_HIT_THUNDER); dorf->timers[2] = 20; @@ -4774,7 +4774,8 @@ void BossGanon_UpdateEffects(PlayState* play) { if (((eff->scale * 150.0f) < distToPlayer) && (distToPlayer < (eff->scale * 300.0f))) { eff->timer = 150; - func_8002F6D4(play, &sGanondorf->actor, 7.0f, sGanondorf->actor.yawTowardsPlayer, 0.0f, 0x20); + Actor_SetPlayerKnockbackLarge(play, &sGanondorf->actor, 7.0f, + sGanondorf->actor.yawTowardsPlayer, 0.0f, 0x20); } } } diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index aff4b32a1c5..73ea357f5aa 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -1853,7 +1853,8 @@ void func_80902348(BossGanon2* this, PlayState* play) { phi_v0_2 = 0; } - func_8002F6D4(play, &this->actor, 15.0f, this->actor.yawTowardsPlayer + phi_v0_2, 2.0f, 0); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 15.0f, this->actor.yawTowardsPlayer + phi_v0_2, 2.0f, + 0); sZelda->unk_3C8 = 8; this->unk_316 = 10; break; @@ -1872,7 +1873,7 @@ void func_80902348(BossGanon2* this, PlayState* play) { } player->bodyIsBurning = true; - func_8002F6D4(play, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 10.0f, Math_Atan2S(temp_f12, temp_f2), 0.0f, 0x10); sZelda->unk_3C8 = 8; } } diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index d6378b1225a..c401403a41a 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -837,7 +837,8 @@ void BossMo_Tentacle(BossMo* this, PlayState* play) { player->actor.parent = NULL; player->csAction = PLAYER_CSACTION_NONE; if (this->timers[0] == 0) { - func_8002F6D4(play, &this->actor, 20.0f, this->actor.shape.rot.y + 0x8000, 10.0f, 0); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 20.0f, this->actor.shape.rot.y + 0x8000, + 10.0f, 0); } } this->timers[0] = 75; diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 1a0c1326eb8..49883d89d49 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -763,7 +763,7 @@ void BossSst_HeadCharge(BossSst* this, PlayState* play) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); sHands[LEFT]->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); sHands[RIGHT]->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - func_8002F71C(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); Player_PlaySfx(GET_PLAYER(play), NA_SE_PL_BODY_HIT); } } @@ -1518,7 +1518,7 @@ void BossSst_HandSlam(BossSst* this, PlayState* play) { player->actor.world.pos.z = (Math_CosS(this->actor.yawTowardsPlayer) * 100.0f) + this->actor.world.pos.z; this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); } Math_ScaledStepToS(&this->actor.shape.rot.x, 0, 0x200); @@ -1577,7 +1577,8 @@ void BossSst_HandSweep(BossSst* this, PlayState* play) { } else if (this->colliderJntSph.base.atFlags & AT_HIT) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); this->ready = true; - func_8002F71C(play, &this->actor, 5.0f, this->actor.shape.rot.y - (this->vParity * 0x3800), 0.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 5.0f, + this->actor.shape.rot.y - (this->vParity * 0x3800), 0.0f); Player_PlaySfx(player, NA_SE_PL_BODY_HIT); newTargetYaw = this->actor.shape.rot.y - (this->vParity * 0x1400); if (((s16)(newTargetYaw - this->targetYaw) * this->vParity) > 0) { @@ -1636,7 +1637,7 @@ void BossSst_HandPunch(BossSst* this, PlayState* play) { BossSst_HandSetupRetreat(this); } else if (this->colliderJntSph.base.atFlags & AT_HIT) { Player_PlaySfx(GET_PLAYER(play), NA_SE_PL_BODY_HIT); - func_8002F71C(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); BossSst_HandSetupRetreat(this); } @@ -1954,7 +1955,7 @@ void BossSst_HandSwing(BossSst* this, PlayState* play) { BossSst_HandReleasePlayer(this, play, false); player->actor.world.pos.x += 70.0f * Math_SinS(this->actor.shape.rot.y); player->actor.world.pos.z += 70.0f * Math_CosS(this->actor.shape.rot.y); - func_8002F71C(play, &this->actor, 15.0f, this->actor.shape.rot.y, 2.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 15.0f, this->actor.shape.rot.y, 2.0f); Player_PlaySfx(player, NA_SE_PL_BODY_HIT); } @@ -2076,7 +2077,7 @@ void BossSst_HandReadyCharge(BossSst* this, PlayState* play) { this->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); OTHER_HAND(this)->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); sHead->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); - func_8002F71C(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); Player_PlaySfx(GET_PLAYER(play), NA_SE_PL_BODY_HIT); } } @@ -2426,7 +2427,7 @@ void BossSst_HandReleasePlayer(BossSst* this, PlayState* play, s32 dropPlayer) { this->colliderJntSph.base.ocFlags1 |= OC1_ON; OTHER_HAND(this)->colliderJntSph.base.ocFlags1 |= OC1_ON; if (dropPlayer) { - func_8002F71C(play, &this->actor, 0.0f, this->actor.shape.rot.y, 0.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 0.0f, this->actor.shape.rot.y, 0.0f); } } } 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 839f1b0f64b..713ca8e8ed8 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -805,7 +805,7 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, PlayState* play) { if (sTwinrovaPtr->timers[2] == 0) { sTwinrovaPtr->timers[2] = 150; this->beamDist = sqrtf(SQ(offset.x) + SQ(offset.y) + SQ(offset.z)); - func_8002F6D4(play, &this->actor, 3.0f, this->actor.shape.rot.y, 0.0f, 0x20); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 3.0f, this->actor.shape.rot.y, 0.0f, 0x20); if (this->actor.params == TW_KOTAKE) { if (sFreezeState == 0) { diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 99ea011f4b6..7460e33835b 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -1069,7 +1069,7 @@ void BossVa_BodyPhase1(BossVa* this, PlayState* play) { if (this->colliderBody.base.atFlags & AT_HIT) { this->colliderBody.base.atFlags &= ~AT_HIT; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); } } @@ -1160,7 +1160,7 @@ void BossVa_BodyPhase2(BossVa* this, PlayState* play) { sPhase2Timer = (sPhase2Timer + 0x18) & 0xFFF0; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); } } @@ -1235,7 +1235,7 @@ void BossVa_BodyPhase3(BossVa* this, PlayState* play) { if (this->colliderBody.base.atFlags & AT_HIT) { this->colliderBody.base.atFlags &= ~AT_HIT; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); this->actor.world.rot.y += (s16)Rand_CenteredFloat(0x2EE0) + 0x8000; Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); } @@ -1356,7 +1356,7 @@ void BossVa_BodyPhase4(BossVa* this, PlayState* play) { if (this->colliderBody.base.atFlags & AT_HIT) { this->colliderBody.base.atFlags &= ~AT_HIT; if (this->colliderBody.base.at == &player->actor) { - func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); this->actor.world.rot.y += (s16)Rand_CenteredFloat(0x2EE0) + 0x8000; Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); } @@ -2542,7 +2542,8 @@ void BossVa_BariPhase3Attack(BossVa* this, PlayState* play) { this->vaBariUnused.y += this->vaBariUnused.z; if ((this->colliderLightning.base.atFlags & AT_HIT) || (this->colliderSph.base.atFlags & AT_HIT)) { if ((this->colliderLightning.base.at == &player->actor) || (this->colliderSph.base.at == &player->actor)) { - func_8002F71C(play, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, + 8.0f); Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); this->colliderSph.base.at = NULL; this->colliderLightning.base.at = NULL; @@ -2637,7 +2638,8 @@ void BossVa_BariPhase2Attack(BossVa* this, PlayState* play) { if ((this->colliderLightning.base.atFlags & AT_HIT) || (this->colliderSph.base.atFlags & AT_HIT)) { if ((this->colliderLightning.base.at == &player->actor) || (this->colliderSph.base.at == &player->actor)) { - func_8002F71C(play, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, 8.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, GET_BODY(this)->actor.yawTowardsPlayer, + 8.0f); Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); this->colliderSph.base.at = NULL; this->colliderLightning.base.at = NULL; diff --git a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c index c63e4d578bc..73802af1ff0 100644 --- a/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c +++ b/src/overlays/actors/ovl_Demo_Kekkai/z_demo_kekkai.c @@ -188,7 +188,7 @@ void DemoKekkai_Update(Actor* thisx, PlayState* play2) { if (this->energyAlpha > 0.99f) { if ((this->collider1.base.atFlags & AT_HIT) || (this->collider2.base.atFlags & AT_HIT)) { - func_8002F71C(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); } CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); @@ -246,7 +246,7 @@ void DemoKekkai_TrialBarrierIdle(Actor* thisx, PlayState* play) { DemoKekkai* this = (DemoKekkai*)thisx; if (this->collider1.base.atFlags & AT_HIT) { - func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 5.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 5.0f); } CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider1.base); CollisionCheck_SetOC(play, &play->colChkCtx, &this->collider1.base); diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c index 1f4aeb2ce58..16e7acbe2e2 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -353,7 +353,7 @@ void DoorKiller_FallOver(DoorKiller* this, PlayState* play) { if ((fabsf(playerPosRelToDoor.y) < 20.0f) && (fabsf(playerPosRelToDoor.x) < 20.0f) && (playerPosRelToDoor.z < 100.0f) && (playerPosRelToDoor.z > 0.0f)) { this->hasHitPlayerOrGround |= 1; - func_8002F6D4(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f, 16); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f, 0x10); Actor_PlaySfx(&this->actor, NA_SE_EN_KDOOR_HIT); Player_PlaySfx(player, NA_SE_PL_BODY_HIT); } diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index c5c43923824..3af31001a67 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -359,7 +359,7 @@ void EnAttackNiw_Update(Actor* thisx, PlayState* play) { cucco = (EnNiw*)this->actor.parent; if ((this->actor.parent->update != NULL) && (this->actor.parent != NULL) && (cucco != NULL) && (cucco->timer9 == 0) && (player->invincibilityTimer == 0)) { - func_8002F6D4(play, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 2.0f, this->actor.world.rot.y, 0.0f, 0x10); cucco->timer9 = 0x46; } } diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/src/overlays/actors/ovl_En_Ba/z_en_ba.c index cdbbb60ee57..f88bbe36770 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -303,7 +303,7 @@ void EnBa_SwingAtPlayer(EnBa* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; if (this->collider.base.at == &player->actor) { - func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); } } CollisionCheck_SetAT(play, &play->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c index 4b2f804f575..a6823d37f05 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -170,7 +170,7 @@ void func_809BC598(EnBdfire* this, PlayState* play) { player->bodyFlameTimers[i] = Rand_S16Offset(0, 200); } player->bodyIsBurning = true; - func_8002F6D4(play, &this->actor, 20.0f, this->actor.world.rot.y, 0.0f, 8); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 20.0f, this->actor.world.rot.y, 0.0f, 8); osSyncPrintf("POWER\n"); } } diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index f3ac29088eb..be3c2d33a21 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -731,7 +731,7 @@ void func_809BE798(EnBigokuta* this, PlayState* play) { } else { effectRot = -0x6000; } - func_8002F71C(play, &this->actor, 10.0f, this->actor.world.rot.y + effectRot, 5.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 10.0f, this->actor.world.rot.y + effectRot, 5.0f); if (this->actionFunc == func_809BDC08) { func_809BD4A4(this); this->unk_196 = 40; diff --git a/src/overlays/actors/ovl_En_Brob/z_en_brob.c b/src/overlays/actors/ovl_En_Brob/z_en_brob.c index e39a5ff2126..87f4e0a26bd 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.c +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.c @@ -152,7 +152,8 @@ void EnBrob_Idle(EnBrob* this, PlayState* play) { } if (this->timer == 0) { if (DynaPolyActor_IsPlayerOnTop(&this->dyna)) { - func_8002F71C(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, + 1.0f); EnBrob_SetupMoveUp(this, play); } else if (this->dyna.actor.xzDistToPlayer < 300.0f) { EnBrob_SetupMoveUp(this, play); @@ -278,7 +279,8 @@ void EnBrob_Update(Actor* thisx, PlayState* play2) { if (this->actionFunc == EnBrob_MoveUp && !(this->colliders[0].base.atFlags & AT_BOUNCED) && !(this->colliders[1].base.atFlags & AT_BOUNCED)) { - func_8002F71C(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, 1.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->dyna.actor, 5.0f, this->dyna.actor.yawTowardsPlayer, + 1.0f); } else if (this->actionFunc != EnBrob_MoveUp) { EnBrob_SetupShock(this); } diff --git a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c index 2e1ea90dd38..2642d3cfa4c 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -117,7 +117,7 @@ void EnBubble_DamagePlayer(EnBubble* this, PlayState* play) { s32 damage = -this->colliderSphere.elements[0].info.toucher.damage; play->damagePlayer(play, damage); - func_8002F7A0(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); + Actor_SetPlayerKnockbackSmallNoDamage(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); } s32 EnBubble_Explosion(EnBubble* this, PlayState* play) { diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index efe94eeec82..a919d7edb9a 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -153,7 +153,7 @@ void EnBx_Update(Actor* thisx, PlayState* play) { play->damagePlayer(play, -4); } } - func_8002F71C(play, &this->actor, 6.0f, tmp32, 6.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 6.0f, tmp32, 6.0f); player->invincibilityTimer = tmp33; } diff --git a/src/overlays/actors/ovl_En_Dh/z_en_dh.c b/src/overlays/actors/ovl_En_Dh/z_en_dh.c index c37d382e448..267c7e9b041 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -331,7 +331,7 @@ void EnDh_Attack(EnDh* this, PlayState* play) { this->actionState++; } else if (this->collider2.base.atFlags & AT_HIT) { this->collider2.base.atFlags &= ~AT_HIT; - func_8002F71C(play, &this->actor, 8.0f, this->actor.shape.rot.y, 8.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.shape.rot.y, 8.0f); } break; case 3: diff --git a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c index e41d08aeca3..75115dbce9b 100644 --- a/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c +++ b/src/overlays/actors/ovl_En_Ex_Ruppy/z_en_ex_ruppy.c @@ -337,7 +337,7 @@ void EnExRuppy_WaitToBlowUp(EnExRuppy* this, PlayState* play) { explosionScaleStep = 6; } EffectSsBomb2_SpawnLayered(play, &this->actor.world.pos, &velocity, &accel, explosionScale, explosionScaleStep); - func_8002F71C(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f); Actor_PlaySfx(&this->actor, NA_SE_IT_BOMB_EXPLOSION); Actor_Kill(&this->actor); } diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index a0e2b232d06..c2080e7c0fb 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -306,7 +306,8 @@ s32 EnFd_ColliderCheck(EnFd* this, PlayState* play) { } this->attackTimer = 30; Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); - func_8002F71C(play, &this->actor, this->actor.speed + 2.0f, this->actor.yawTowardsPlayer, 6.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, this->actor.speed + 2.0f, + this->actor.yawTowardsPlayer, 6.0f); } return false; } diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index 00166c334ca..1be64713a61 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -533,7 +533,8 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, PlayState* play) { if ((bossGnd->flyMode >= GND_FLY_VOLLEY) && (this->work[FHGFIRE_RETURN_COUNT] >= 2)) { Actor_PlaySfx(&this->actor, NA_SE_EN_FANTOM_LAUGH); } - func_8002F698(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, 3, 0x10); + Actor_SetPlayerKnockback(play, &this->actor, 3.0f, this->actor.world.rot.y, 0.0f, + PLAYER_KNOCKBACK_LARGE_SHOCK, 0x10); } break; case FHGFIRE_LIGHT_BLUE: diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index 53b24ba5592..7f19d253a75 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -367,7 +367,7 @@ void EnFireRock_Update(Actor* thisx, PlayState* play) { this->collider.base.atFlags &= ~AT_HIT; if (this->collider.base.at == playerActor) { if (!(player->stateFlags1 & PLAYER_STATE1_26)) { - func_8002F758(play, thisx, 2.0f, -player->actor.world.rot.y, 3.0f, 4); + Actor_SetPlayerKnockbackSmall(play, thisx, 2.0f, -player->actor.world.rot.y, 3.0f, 4); } return; } diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c index 0ed65e828de..3a3f854283a 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -917,7 +917,7 @@ void EnGeldB_SpinAttack(EnGeldB* this, PlayState* play) { } else if (this->swordCollider.base.atFlags & AT_HIT) { this->swordCollider.base.atFlags &= ~AT_HIT; if (&player->actor == this->swordCollider.base.at) { - func_8002F71C(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 6.0f, this->actor.yawTowardsPlayer, 6.0f); this->spinAttackState = 2; Player_SetCsActionWithHaltedActors(play, &this->actor, PLAYER_CSACTION_24); Message_StartTextbox(play, 0x6003, &this->actor); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 529e7de4aed..4fe1edc6ab3 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -712,7 +712,7 @@ void EnGo_StopRolling(EnGo* this, PlayState* play) { if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; play->damagePlayer(play, -4); - func_8002F71C(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); this->unk_20E = 0x10; } } diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index bc5c0b22035..bbaddc39378 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -910,7 +910,7 @@ s32 func_80A44AB0(EnGo2* this, PlayState* play) { arg2 = this->actionFunc == EnGo2_ContinueRolling ? 1.5f : this->actor.speed * 1.5f; play->damagePlayer(play, -4); - func_8002F71C(play, &this->actor, arg2, this->actor.yawTowardsPlayer, 6.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, arg2, this->actor.yawTowardsPlayer, 6.0f); Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; } diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 7ffa09b8b24..428bd0a9439 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -596,7 +596,7 @@ void EnGoroiwa_Roll(EnGoroiwa* this, PlayState* play) { EnGoroiwa_FaceNextWaypoint(this, play); } } - func_8002F6D4(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 0); osSyncPrintf(VT_FGCOL(CYAN)); osSyncPrintf("Player ぶっ飛ばし\n"); // "Player knocked down" osSyncPrintf(VT_RST); @@ -682,7 +682,7 @@ void EnGoroiwa_SetupMoveUp(EnGoroiwa* this) { void EnGoroiwa_MoveUp(EnGoroiwa* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F6D4(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); Player_PlaySfx(GET_PLAYER(play), NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; @@ -707,7 +707,7 @@ void EnGoroiwa_SetupMoveDown(EnGoroiwa* this) { void EnGoroiwa_MoveDown(EnGoroiwa* this, PlayState* play) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - func_8002F6D4(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); Player_PlaySfx(GET_PLAYER(play), NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index 2a22881c739..e58a1872f64 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -320,7 +320,7 @@ void EnHonotrap_SetupFlameDrop(EnHonotrap* this) { void EnHonotrap_FlameDrop(EnHonotrap* this, PlayState* play) { if ((this->collider.cyl.base.atFlags & AT_HIT) || (this->timer <= 0)) { if ((this->collider.cyl.base.atFlags & AT_HIT) && !(this->collider.cyl.base.atFlags & AT_BOUNCED)) { - func_8002F71C(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 5.0f, this->actor.yawTowardsPlayer, 0.0f); } this->actor.velocity.x = this->actor.velocity.y = this->actor.velocity.z = 0.0f; EnHonotrap_SetupFlameVanish(this); diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index 9440a0e4902..c1857975db4 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -508,7 +508,8 @@ u16 EnHy_GetTextId(PlayState* play, Actor* thisx) { return GET_EVENTCHKINF(EVENTCHKINF_80) ? 0x7046 : (GET_INFTABLE(INFTABLE_CD) ? 0x7019 : 0x7018); } case ENHY_TYPE_CNE_11: - return GET_INFTABLE(INFTABLE_MALON_SPAWNED_AT_HYRULE_CASTLE) ? (GET_INFTABLE(INFTABLE_CC) ? 0x7014 : 0x70A4) : 0x7014; + return GET_INFTABLE(INFTABLE_MALON_SPAWNED_AT_HYRULE_CASTLE) ? (GET_INFTABLE(INFTABLE_CC) ? 0x7014 : 0x70A4) + : 0x7014; case ENHY_TYPE_BOJ_12: if (play->sceneId == SCENE_KAKARIKO_VILLAGE) { return !IS_DAY ? 0x5084 : 0x5083; diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 72495a3eca4..312b7ba8026 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -827,7 +827,7 @@ void EnIk_UpdateEnemy(Actor* thisx, PlayState* play) { } } - func_8002F71C(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 8.0f, this->actor.yawTowardsPlayer, 8.0f); player->invincibilityTimer = prevInvincibilityTimer; } } diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 498aea3afe6..5342501337a 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -605,7 +605,7 @@ void EnMb_Stunned(EnMb* this, PlayState* play) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->av2.actionVar2 = 200; - func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); this->attack = ENMB_ATTACK_NONE; } @@ -722,7 +722,7 @@ void EnMb_SpearPatrolEndCharge(EnMb* this, PlayState* play) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->av2.actionVar2 = 200; - func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { @@ -839,8 +839,9 @@ void EnMb_ClubAttack(EnMb* this, PlayState* play) { } } - func_8002F71C(play, &this->actor, (650.0f - this->actor.xzDistToPlayer) * 0.04f + 4.0f, - this->actor.world.rot.y, 8.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, + (650.0f - this->actor.xzDistToPlayer) * 0.04f + 4.0f, + this->actor.world.rot.y, 8.0f); player->invincibilityTimer = prevPlayerInvincibilityTimer; } @@ -948,7 +949,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->av2.actionVar2 = 200; - func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } } this->attack = ENMB_ATTACK_NONE; @@ -1017,7 +1018,7 @@ void EnMb_SpearPatrolImmediateCharge(EnMb* this, PlayState* play) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->av2.actionVar2 = 200; - func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); } this->attack = ENMB_ATTACK_NONE; this->actor.speed = -10.0f; @@ -1299,7 +1300,7 @@ void EnMb_SpearDead(EnMb* this, PlayState* play) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->av2.actionVar2 = 200; - func_8002F71C(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 4.0f, this->actor.world.rot.y, 4.0f); this->attack = ENMB_ATTACK_NONE; } @@ -1382,7 +1383,7 @@ void EnMb_CheckColliding(EnMb* this, PlayState* play) { player->stateFlags2 &= ~PLAYER_STATE2_7; player->actor.parent = NULL; player->av2.actionVar2 = 200; - func_8002F71C(play, &this->actor, 6.0f, this->actor.world.rot.y, 6.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 6.0f, this->actor.world.rot.y, 6.0f); } this->damageEffect = this->actor.colChkInfo.damageEffect; this->attack = ENMB_ATTACK_NONE; diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index 034cfed9f53..164b0ecd918 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -464,7 +464,7 @@ void func_80AAE294(EnMm* this, PlayState* play) { } if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { - func_8002F71C(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 4.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 4.0f); } } } diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index 0ebce6a0a7f..5d14b603c0f 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -1080,7 +1080,7 @@ void EnNiw_Update(Actor* thisx, PlayState* play) { dist = 20.0f; if (this->unk_2A8 != 0 && thisx->xyzDistToPlayerSq < SQ(dist) && player->invincibilityTimer == 0) { - func_8002F6D4(play, &this->actor, 2.0f, thisx->world.rot.y, 0.0f, 0x10); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 2.0f, thisx->world.rot.y, 0.0f, 0x10); } func_80AB747C(this, play); diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c index 82bef2394ce..ab57eae19a0 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -196,8 +196,9 @@ void func_80ACE5C8(EnPart* this, PlayState* play) { play->damagePlayer(play, -8); } } - func_8002F71C(play, this->actor.parent, (650.0f - this->actor.parent->xzDistToPlayer) * 0.04f + 4.0f, - this->actor.parent->world.rot.y, 8.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, this->actor.parent, + (650.0f - this->actor.parent->xzDistToPlayer) * 0.04f + 4.0f, + this->actor.parent->world.rot.y, 8.0f); player->invincibilityTimer = prevInvincibilityTimer; this->timer = 1; } diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 736d1f15126..4b95c28b5fc 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -322,7 +322,7 @@ void EnRr_SetupReleasePlayer(EnRr* this, PlayState* play) { break; } osSyncPrintf(VT_FGCOL(YELLOW) "%s[%d] : Rr_Catch_Cancel" VT_RST "\n", "../z_en_rr.c", 650); - func_8002F6D4(play, &this->actor, 4.0f, this->actor.shape.rot.y, 12.0f, 8); + Actor_SetPlayerKnockbackLarge(play, &this->actor, 4.0f, this->actor.shape.rot.y, 12.0f, 8); if (this->actor.colorFilterTimer == 0) { this->actionFunc = EnRr_Approach; Actor_PlaySfx(&this->actor, NA_SE_EN_LIKE_THROW); diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index f3714039d97..5ae82705354 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -471,7 +471,7 @@ s32 EnSsh_CheckHitPlayer(EnSsh* this, PlayState* play) { Actor_PlaySfx(&this->actor, NA_SE_EN_STALTU_ROLL); Actor_PlaySfx(&this->actor, NA_SE_VO_ST_ATTACK); play->damagePlayer(play, -8); - func_8002F71C(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); this->hitCount--; return true; } diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index bd4e74486e2..0f562da6743 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -404,7 +404,7 @@ s32 EnSt_CheckHitPlayer(EnSt* this, PlayState* play) { this->gaveDamageSpinTimer = 30; play->damagePlayer(play, -8); Actor_PlaySfx(&player->actor, NA_SE_PL_BODY_HIT); - func_8002F71C(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); + Actor_SetPlayerKnockbackLargeNoDamage(play, &this->actor, 4.0f, this->actor.yawTowardsPlayer, 6.0f); return true; } 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 a5f86c6361c..dc84d1b37e0 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -574,11 +574,11 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { if (!Actor_ApplyDamage(&this->actor)) { func_800F5B58(); this->actor.flags &= ~(ACTOR_FLAG_0 | ACTOR_FLAG_2); - this->unk_8A1 = 2; - this->unk_8A4 = 6.0f; - this->unk_8A8 = 6.0f; - this->unk_8A0 = this->actor.colChkInfo.damage; - this->unk_8A2 = this->actor.yawTowardsPlayer + 0x8000; + this->knockbackType = PLAYER_KNOCKBACK_LARGE; + this->knockbackSpeed = 6.0f; + this->knockbackYVelocity = 6.0f; + this->knockbackDamage = this->actor.colChkInfo.damage; + this->knockbackRot = this->actor.yawTowardsPlayer + 0x8000; sDeathFlag++; sActionState = ENTORCH2_DEATH; Enemy_StartFinishingBlow(play, &this->actor); @@ -594,11 +594,11 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { } } else { this->actor.flags &= ~ACTOR_FLAG_0; - this->unk_8A0 = this->actor.colChkInfo.damage; - this->unk_8A1 = 1; - this->unk_8A8 = 6.0f; - this->unk_8A4 = 8.0f; - this->unk_8A2 = this->actor.yawTowardsPlayer + 0x8000; + this->knockbackDamage = this->actor.colChkInfo.damage; + this->knockbackType = PLAYER_KNOCKBACK_SMALL; + this->knockbackYVelocity = 6.0f; + this->knockbackSpeed = 8.0f; + this->knockbackRot = this->actor.yawTowardsPlayer + 0x8000; Actor_SetDropFlag(&this->actor, &this->cylinder.info, true); this->stateFlags3 &= ~PLAYER_STATE3_2; this->stateFlags3 |= PLAYER_STATE3_0; @@ -611,7 +611,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { } } this->actor.colChkInfo.damage = 0; - this->unk_8A0 = 0; + this->knockbackDamage = PLAYER_KNOCKBACK_NONE; } // Handles being frozen by a deku nut diff --git a/src/overlays/actors/ovl_En_Trap/z_en_trap.c b/src/overlays/actors/ovl_En_Trap/z_en_trap.c index 8bdcea00329..5360ac4e0e8 100644 --- a/src/overlays/actors/ovl_En_Trap/z_en_trap.c +++ b/src/overlays/actors/ovl_En_Trap/z_en_trap.c @@ -176,7 +176,7 @@ void EnTrap_Update(Actor* thisx, PlayState* play) { angleToKnockPlayer = thisx->yawTowardsPlayer; } play->damagePlayer(play, -4); - func_8002F7A0(play, thisx, 6.0f, angleToKnockPlayer, 6.0f); + Actor_SetPlayerKnockbackSmallNoDamage(play, thisx, 6.0f, angleToKnockPlayer, 6.0f); this->playerDmgTimer = 15; } if (thisx->params & SPIKETRAP_MODE_LINEAR) { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index c7ce97199cc..588f98b119b 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -4066,23 +4066,26 @@ void func_80837948(PlayState* play, Player* this, s32 arg2) { func_80837918(this, 1, dmgFlags); } -void func_80837AE0(Player* this, s32 timer) { +void Player_SetDamagedInvincibilityTimer(Player* this, s32 timer) { if (this->invincibilityTimer >= 0) { this->invincibilityTimer = timer; this->unk_88F = 0; } } -void func_80837AFC(Player* this, s32 timer) { +void Player_SetIFrameInvincibilityTimer(Player* this, s32 timer) { if (this->invincibilityTimer > timer) { this->invincibilityTimer = timer; } this->unk_88F = 0; } -s32 func_80837B18(PlayState* play, Player* this, s32 damage) { +/** + * @return false if player is out of health + */ +s32 Player_Health_ChangeBy(PlayState* play, Player* this, s32 damage) { if ((this->invincibilityTimer != 0) || (this->actor.category != ACTORCAT_PLAYER)) { - return 1; + return true; } return Health_ChangeBy(play, damage); @@ -4108,7 +4111,8 @@ static LinkAnimationHeader* D_808544B0[] = { &gPlayerAnim_link_normal_back_hit, &gPlayerAnim_link_anchor_back_hitR, }; -void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, s16 arg5, s32 arg6) { +void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 speed, f32 yVelocity, s16 rotation, + s32 invincibilityTimer) { LinkAnimationHeader* anim = NULL; LinkAnimationHeader** sp28; @@ -4120,7 +4124,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_PlaySfx(this, NA_SE_PL_DAMAGE); - if (!func_80837B18(play, this, 0 - this->actor.colChkInfo.damage)) { + if (!Player_Health_ChangeBy(play, this, 0 - this->actor.colChkInfo.damage)) { this->stateFlags2 &= ~PLAYER_STATE2_7; if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(this->stateFlags1 & PLAYER_STATE1_27)) { func_80837B9C(this, play); @@ -4128,9 +4132,9 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, return; } - func_80837AE0(this, arg6); + Player_SetDamagedInvincibilityTimer(this, invincibilityTimer); - if (arg2 == 3) { + if (damageResponseType == PLAYER_DAMAGE_RESPONSE_ICE_TRAP) { Player_SetupAction(play, this, Player_Action_8084FB10, 0); anim = &gPlayerAnim_link_normal_ice_down; @@ -4140,7 +4144,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_PlaySfx(this, NA_SE_PL_FREEZE_S); func_80832698(this, NA_SE_VO_LI_FREEZE); - } else if (arg2 == 4) { + } else if (damageResponseType == PLAYER_DAMAGE_RESPONSE_ELECTRIC_SHOCK) { Player_SetupAction(play, this, Player_Action_8084FBF4, 0); Player_RequestRumble(this, 255, 80, 150, 0); @@ -4150,7 +4154,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, this->av2.actionVar2 = 20; } else { - arg5 -= this->actor.shape.rot.y; + rotation -= this->actor.shape.rot.y; if (this->stateFlags1 & PLAYER_STATE1_27) { Player_SetupAction(play, this, Player_Action_8084E30C, 0); Player_RequestRumble(this, 180, 20, 50, 0); @@ -4161,7 +4165,9 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, anim = &gPlayerAnim_link_swimer_swim_hit; func_80832698(this, NA_SE_VO_LI_DAMAGE_S); - } else if ((arg2 == 1) || (arg2 == 2) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + } else if ((damageResponseType == PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE) || + (damageResponseType == PLAYER_DAMAGE_RESPONSE_KNOCKBACK_SMALL) || + !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21))) { Player_SetupAction(play, this, Player_Action_8084377C, 0); @@ -4170,7 +4176,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_RequestRumble(this, 255, 20, 150, 0); func_80832224(this); - if (arg2 == 2) { + if (damageResponseType == PLAYER_DAMAGE_RESPONSE_KNOCKBACK_SMALL) { this->av2.actionVar2 = 4; this->actor.speed = 3.0f; @@ -4180,11 +4186,11 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_AnimChangeFreeze(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_damage_run, this->modelAnimType)); func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } else { - this->actor.speed = arg3; - this->speedXZ = arg3; - this->actor.velocity.y = arg4; + this->actor.speed = speed; + this->speedXZ = speed; + this->actor.velocity.y = yVelocity; - if (ABS(arg5) > 0x4000) { + if (ABS(rotation) > 0x4000) { anim = &gPlayerAnim_link_normal_front_downA; } else { anim = &gPlayerAnim_link_normal_back_downA; @@ -4220,7 +4226,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, sp28 += 4; } - if (ABS(arg5) <= 0x4000) { + if (ABS(rotation) <= 0x4000) { sp28 += 2; } @@ -4233,10 +4239,10 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } - this->actor.shape.rot.y += arg5; + this->actor.shape.rot.y += rotation; this->yaw = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y; - if (ABS(arg5) > 0x4000) { + if (ABS(rotation) > 0x4000) { this->actor.shape.rot.y += 0x8000; } } @@ -4274,7 +4280,7 @@ void func_8083819C(Player* this, PlayState* play) { } void func_8083821C(Player* this) { - s32 i; + s32 i = 0; // clang-format off for (i = 0; i < PLAYER_BODYPART_MAX; i++) { this->bodyFlameTimers[i] = Rand_S16Offset(0, 200); } @@ -4342,17 +4348,23 @@ s32 func_808382DC(Player* this, PlayState* play) { func_80832698(this, NA_SE_VO_LI_TAKEN_AWAY); play->haltAllActors = true; Sfx_PlaySfxCentered(NA_SE_OC_ABYSS); - } else if ((this->unk_8A1 != 0) && ((this->unk_8A1 >= 2) || (this->invincibilityTimer == 0))) { - u8 sp5C[] = { 2, 1, 1 }; + } else if ((this->knockbackType != PLAYER_KNOCKBACK_NONE) && + ((this->knockbackType >= PLAYER_KNOCKBACK_LARGE) || (this->invincibilityTimer == 0))) { + u8 knockbackResponse[] = { + PLAYER_DAMAGE_RESPONSE_KNOCKBACK_SMALL, + PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE, + PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE, + }; func_80838280(this); - if (this->unk_8A1 == 3) { + if (this->knockbackType == PLAYER_KNOCKBACK_LARGE_SHOCK) { this->bodyShockTimer = 40; } - this->actor.colChkInfo.damage += this->unk_8A0; - func_80837C0C(play, this, sp5C[this->unk_8A1 - 1], this->unk_8A4, this->unk_8A8, this->unk_8A2, 20); + this->actor.colChkInfo.damage += this->knockbackDamage; + func_80837C0C(play, this, knockbackResponse[this->knockbackType - 1], this->knockbackSpeed, + this->knockbackYVelocity, this->knockbackRot, 20); } else { sp64 = (this->shieldQuad.base.acFlags & AC_BOUNCED) != 0; @@ -4416,16 +4428,16 @@ s32 func_808382DC(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_27) { - sp4C = 0; + sp4C = PLAYER_DAMAGE_RESPONSE_NONE; } else if (this->actor.colChkInfo.acHitEffect == 2) { - sp4C = 3; + sp4C = PLAYER_DAMAGE_RESPONSE_ICE_TRAP; } else if (this->actor.colChkInfo.acHitEffect == 3) { - sp4C = 4; + sp4C = PLAYER_DAMAGE_RESPONSE_ELECTRIC_SHOCK; } else if (this->actor.colChkInfo.acHitEffect == 4) { - sp4C = 1; + sp4C = PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE; } else { func_80838280(this); - sp4C = 0; + sp4C = PLAYER_DAMAGE_RESPONSE_NONE; } func_80837C0C(play, this, sp4C, 4.0f, 5.0f, Actor_WorldYawTowardActor(ac, &this->actor), 20); @@ -4443,7 +4455,7 @@ s32 func_808382DC(Player* this, PlayState* play) { ((this->currentTunic != PLAYER_TUNIC_GORON) || (this->floorTypeTimer >= D_808544F4[sp48])))) { this->floorTypeTimer = 0; this->actor.colChkInfo.damage = 4; - func_80837C0C(play, this, 0, 4.0f, 5.0f, this->actor.shape.rot.y, 20); + func_80837C0C(play, this, PLAYER_DAMAGE_RESPONSE_NONE, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } else { return 0; } @@ -8461,7 +8473,8 @@ s32 func_80842DF4(PlayState* play, Player* this) { if (this->actor.colChkInfo.atHitEffect == 1) { this->actor.colChkInfo.damage = 8; - func_80837C0C(play, this, 4, 0.0f, 0.0f, this->actor.shape.rot.y, 20); + func_80837C0C(play, this, PLAYER_DAMAGE_RESPONSE_ELECTRIC_SHOCK, 0.0f, 0.0f, + this->actor.shape.rot.y, 20); return 1; } } @@ -8609,14 +8622,15 @@ void Player_Action_8084377C(Player* this, PlayState* play) { func_808382BC(this); - if (!(this->stateFlags1 & PLAYER_STATE1_29) && (this->av2.actionVar2 == 0) && (this->unk_8A1 != 0)) { - s16 temp = this->actor.shape.rot.y - this->unk_8A2; + if (!(this->stateFlags1 & PLAYER_STATE1_29) && (this->av2.actionVar2 == 0) && + (this->knockbackType != PLAYER_KNOCKBACK_NONE)) { + s16 temp = this->actor.shape.rot.y - this->knockbackRot; - this->yaw = this->actor.shape.rot.y = this->unk_8A2; - this->speedXZ = this->unk_8A4; + this->yaw = this->actor.shape.rot.y = this->knockbackRot; + this->speedXZ = this->knockbackSpeed; if (ABS(temp) > 0x4000) { - this->actor.shape.rot.y = this->unk_8A2 + 0x8000; + this->actor.shape.rot.y = this->knockbackRot + 0x8000; } if (this->actor.velocity.y < 0.0f) { @@ -8632,7 +8646,7 @@ void Player_Action_8084377C(Player* this, PlayState* play) { func_80853080(this, play); } } else if ((this->stateFlags1 & PLAYER_STATE1_29) || - (!(this->cylinder.base.acFlags & AC_HIT) && (this->unk_8A1 == 0))) { + (!(this->cylinder.base.acFlags & AC_HIT) && (this->knockbackType == PLAYER_KNOCKBACK_NONE))) { if (this->stateFlags1 & PLAYER_STATE1_29) { this->av2.actionVar2++; } else { @@ -8722,7 +8736,7 @@ void func_80843AE8(PlayState* play, Player* this) { func_80853080(this, play); } this->unk_A87 = 20; - func_80837AFC(this, -20); + Player_SetIFrameInvincibilityTimer(this, -20); Audio_SetBgmVolumeOnDuringFanfare(); } } else if (this->av1.actionVar1 != 0) { @@ -8783,19 +8797,19 @@ static FallImpactInfo D_80854600[] = { }; s32 func_80843E64(PlayState* play, Player* this) { - s32 sp34; + s32 fallDistance; if ((sFloorType == FLOOR_TYPE_6) || (sFloorType == FLOOR_TYPE_9)) { - sp34 = 0; + fallDistance = 0; } else { - sp34 = this->fallDistance; + fallDistance = this->fallDistance; } Math_StepToF(&this->speedXZ, 0.0f, 1.0f); this->stateFlags1 &= ~(PLAYER_STATE1_18 | PLAYER_STATE1_19); - if (sp34 >= 400) { + if (fallDistance >= 400) { s32 impactIndex; FallImpactInfo* impactInfo; @@ -8811,7 +8825,7 @@ s32 func_80843E64(PlayState* play, Player* this) { return -1; } - func_80837AE0(this, 40); + Player_SetDamagedInvincibilityTimer(this, 40); Player_RequestQuake(play, 32967, 2, 30); Player_RequestRumble(this, impactInfo->rumbleStrength, impactInfo->rumbleDuration, impactInfo->rumbleDecreaseRate, 0); @@ -8821,14 +8835,14 @@ s32 func_80843E64(PlayState* play, Player* this) { return impactIndex + 1; } - if (sp34 > 200) { - sp34 *= 2; + if (fallDistance > 200) { + fallDistance *= 2; - if (sp34 > 255) { - sp34 = 255; + if (fallDistance > 255) { + fallDistance = 255; } - Player_RequestRumble(this, (u8)sp34, (u8)(sp34 * 0.1f), (u8)sp34, 0); + Player_RequestRumble(this, (u8)fallDistance, (u8)(fallDistance * 0.1f), (u8)fallDistance, 0); if (sFloorType == FLOOR_TYPE_6) { func_80832698(this, NA_SE_VO_LI_CLIMB_END); @@ -8988,7 +9002,7 @@ void Player_Action_80844708(Player* this, PlayState* play) { sp44 = LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 8.0f)) { - func_80837AFC(this, -10); + Player_SetIFrameInvincibilityTimer(this, -10); } if (func_80842964(this, play) == 0) { @@ -9064,7 +9078,7 @@ void Player_Action_80844A44(Player* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.colChkInfo.damage = 0x10; - func_80837C0C(play, this, 1, 4.0f, 5.0f, this->actor.shape.rot.y, 20); + func_80837C0C(play, this, PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } } @@ -9109,7 +9123,7 @@ s32 func_80844BE4(Player* this, PlayState* play) { } func_80837948(play, this, temp); - func_80837AFC(this, -8); + Player_SetIFrameInvincibilityTimer(this, -8); this->stateFlags2 |= PLAYER_STATE2_17; if (this->unk_84B[this->unk_846] == 0) { @@ -9873,7 +9887,7 @@ void func_808468E8(PlayState* play, Player* this) { } void func_80846978(PlayState* play, Player* this) { - func_80837C0C(play, this, 1, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); + func_80837C0C(play, this, PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); } void func_808469BC(PlayState* play, Player* this) { @@ -11256,7 +11270,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { temp_f0 = this->actor.world.pos.y - this->actor.prevPos.y; this->doorType = PLAYER_DOORTYPE_NONE; - this->unk_8A1 = 0; + this->knockbackType = PLAYER_KNOCKBACK_NONE; this->unk_684 = NULL; phi_f12 = @@ -13097,7 +13111,7 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { func_8083C0E8(this, play); } else { this->actor.colChkInfo.damage = 0; - func_80837C0C(play, this, 3, 0.0f, 0.0f, 0, 20); + func_80837C0C(play, this, PLAYER_DAMAGE_RESPONSE_ICE_TRAP, 0.0f, 0.0f, 0, 20); } return; } @@ -13614,7 +13628,7 @@ void Player_Action_8084FB10(Player* this, PlayState* play) { } else { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80839F90(this, play); - func_80837AFC(this, -20); + Player_SetIFrameInvincibilityTimer(this, -20); } } } @@ -13623,7 +13637,7 @@ void Player_Action_8084FBF4(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); func_808382BC(this); - if (((this->av2.actionVar2 % 25) != 0) || func_80837B18(play, this, -1)) { + if (((this->av2.actionVar2 % 25) != 0) || Player_Health_ChangeBy(play, this, -1)) { if (DECR(this->av2.actionVar2) == 0) { func_80839F90(this, play); } @@ -15237,7 +15251,7 @@ void func_80853080(Player* this, PlayState* play) { s32 Player_InflictDamage(PlayState* play, s32 damage) { Player* this = GET_PLAYER(play); - if (!Player_InBlockingCsMode(play, this) && !func_80837B18(play, this, damage)) { + if (!Player_InBlockingCsMode(play, this) && !Player_Health_ChangeBy(play, this, damage)) { this->stateFlags2 &= ~PLAYER_STATE2_7; return 1; } From 80998df0c2cd63f4decb7fbcbffa90b6b4ff8811 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 8 Jan 2024 17:27:09 -0500 Subject: [PATCH 02/11] rotation -> yRot --- src/overlays/actors/ovl_player_actor/z_player.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 588f98b119b..3bb7d497b5e 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -4111,7 +4111,7 @@ static LinkAnimationHeader* D_808544B0[] = { &gPlayerAnim_link_normal_back_hit, &gPlayerAnim_link_anchor_back_hitR, }; -void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 speed, f32 yVelocity, s16 rotation, +void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 speed, f32 yVelocity, s16 yRot, s32 invincibilityTimer) { LinkAnimationHeader* anim = NULL; LinkAnimationHeader** sp28; @@ -4154,7 +4154,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 sp this->av2.actionVar2 = 20; } else { - rotation -= this->actor.shape.rot.y; + yRot -= this->actor.shape.rot.y; if (this->stateFlags1 & PLAYER_STATE1_27) { Player_SetupAction(play, this, Player_Action_8084E30C, 0); Player_RequestRumble(this, 180, 20, 50, 0); @@ -4190,7 +4190,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 sp this->speedXZ = speed; this->actor.velocity.y = yVelocity; - if (ABS(rotation) > 0x4000) { + if (ABS(yRot) > 0x4000) { anim = &gPlayerAnim_link_normal_front_downA; } else { anim = &gPlayerAnim_link_normal_back_downA; @@ -4226,7 +4226,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 sp sp28 += 4; } - if (ABS(rotation) <= 0x4000) { + if (ABS(yRot) <= 0x4000) { sp28 += 2; } @@ -4239,10 +4239,10 @@ void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 sp func_80832698(this, NA_SE_VO_LI_DAMAGE_S); } - this->actor.shape.rot.y += rotation; + this->actor.shape.rot.y += yRot; this->yaw = this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y; - if (ABS(rotation) > 0x4000) { + if (ABS(yRot) > 0x4000) { this->actor.shape.rot.y += 0x8000; } } @@ -4280,7 +4280,7 @@ void func_8083819C(Player* this, PlayState* play) { } void func_8083821C(Player* this) { - s32 i = 0; + s32 i; // clang-format off for (i = 0; i < PLAYER_BODYPART_MAX; i++) { this->bodyFlameTimers[i] = Rand_S16Offset(0, 200); } From dd3247e7e4d09a0fdbb165c338f738170dc515f0 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 22 Apr 2024 18:28:26 -0400 Subject: [PATCH 03/11] implement some changes --- include/z64player.h | 8 ++++---- src/overlays/actors/ovl_player_actor/z_player.c | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index e8bd5bcc40e..28705ad73c4 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -550,10 +550,10 @@ typedef enum { } PlayerLedgeClimbType; typedef enum { - /* 0 */ PLAYER_KNOCKBACK_NONE, - /* 1 */ PLAYER_KNOCKBACK_SMALL, - /* 2 */ PLAYER_KNOCKBACK_LARGE, - /* 3 */ PLAYER_KNOCKBACK_LARGE_SHOCK + /* 0 */ PLAYER_KNOCKBACK_NONE, // No knockback + /* 1 */ PLAYER_KNOCKBACK_SMALL, // A small hop, remains standing up + /* 2 */ PLAYER_KNOCKBACK_LARGE, // Sent flying in the air and lands laying down on the floor + /* 3 */ PLAYER_KNOCKBACK_LARGE_SHOCK // Same as`PLAYER_KNOCKBACK_LARGE` with a shock effect } PlayerKnockbackType; typedef enum { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index d6f58fe1716..1276041e6a3 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -4083,7 +4083,7 @@ void Player_SetIFrameInvincibilityTimer(Player* this, s32 timer) { /** * @return false if player is out of health */ -s32 Player_Health_ChangeBy(PlayState* play, Player* this, s32 damage) { +s32 func_80837B18(PlayState* play, Player* this, s32 damage) { if ((this->invincibilityTimer != 0) || (this->actor.category != ACTORCAT_PLAYER)) { return true; } @@ -4124,7 +4124,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 sp Player_PlaySfx(this, NA_SE_PL_DAMAGE); - if (!Player_Health_ChangeBy(play, this, 0 - this->actor.colChkInfo.damage)) { + if (!func_80837B18(play, this, 0 - this->actor.colChkInfo.damage)) { this->stateFlags2 &= ~PLAYER_STATE2_7; if (!(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) && !(this->stateFlags1 & PLAYER_STATE1_27)) { func_80837B9C(this, play); @@ -13638,7 +13638,7 @@ void Player_Action_8084FBF4(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); func_808382BC(this); - if (((this->av2.actionVar2 % 25) != 0) || Player_Health_ChangeBy(play, this, -1)) { + if (((this->av2.actionVar2 % 25) != 0) || func_80837B18(play, this, -1)) { if (DECR(this->av2.actionVar2) == 0) { func_80839F90(this, play); } @@ -15267,7 +15267,7 @@ void func_80853080(Player* this, PlayState* play) { s32 Player_InflictDamage(PlayState* play, s32 damage) { Player* this = GET_PLAYER(play); - if (!Player_InBlockingCsMode(play, this) && !Player_Health_ChangeBy(play, this, damage)) { + if (!Player_InBlockingCsMode(play, this) && !func_80837B18(play, this, damage)) { this->stateFlags2 &= ~PLAYER_STATE2_7; return 1; } From b34a692fd81f7750000d55cf5c878801b03f8c6b Mon Sep 17 00:00:00 2001 From: mzxrules Date: Tue, 18 Jun 2024 16:33:44 -0400 Subject: [PATCH 04/11] Renames and comments --- include/z64player.h | 14 ++--- src/overlays/actors/ovl_En_Bx/z_en_bx.c | 2 +- src/overlays/actors/ovl_En_Fd/z_en_fd.c | 2 +- src/overlays/actors/ovl_En_Ik/z_en_ik.c | 2 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 2 +- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 4 +- .../actors/ovl_player_actor/z_player.c | 54 +++++++++++-------- 7 files changed, 44 insertions(+), 36 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index b36ebab819e..7f57e8e321c 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -612,11 +612,11 @@ typedef enum { } PlayerKnockbackType; typedef enum { - /* 0 */ PLAYER_DAMAGE_RESPONSE_NONE, - /* 1 */ PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE, - /* 2 */ PLAYER_DAMAGE_RESPONSE_KNOCKBACK_SMALL, - /* 3 */ PLAYER_DAMAGE_RESPONSE_ICE_TRAP, - /* 4 */ PLAYER_DAMAGE_RESPONSE_ELECTRIC_SHOCK + /* 0 */ PLAYER_HIT_RESPONSE_NONE, + /* 1 */ PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE, + /* 2 */ PLAYER_HIT_RESPONSE_KNOCKBACK_SMALL, + /* 3 */ PLAYER_HIT_RESPONSE_ICE_TRAP, + /* 4 */ PLAYER_HIT_RESPONSE_ELECTRIC_SHOCK } PlayerDamageResponseType; typedef struct { @@ -890,7 +890,7 @@ typedef struct Player { /* 0x088C */ u8 ledgeClimbType; /* 0x088D */ u8 ledgeClimbDelayTimer; /* 0x088E */ u8 unk_88E; - /* 0x088F */ u8 unk_88F; + /* 0x088F */ u8 unk_88F; // Used to create the flickering animation when Link takes damage /* 0x0890 */ u8 unk_890; /* 0x0891 */ u8 bodyShockTimer; /* 0x0892 */ u8 unk_892; @@ -916,7 +916,7 @@ typedef struct Player { /* 0x0A61 */ u8 bodyFlameTimers[PLAYER_BODYPART_MAX]; // one flame per body part /* 0x0A73 */ u8 unk_A73; /* 0x0A74 */ AfterPutAwayFunc afterPutAwayFunc; // See `Player_SetupWaitForPutAway` and `Player_Action_WaitForPutAway` - /* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero (positive = visible, counts towards zero each frame) + /* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero. Positive values are damage invincibility, negative are dodge invincibiilty /* 0x0A79 */ u8 floorTypeTimer; // counts up every frame the current floor type is the same as the last frame /* 0x0A7A */ u8 floorProperty; /* 0x0A7B */ u8 prevFloorType; diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index 70dc10124a8..ac4d63d55bf 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -146,7 +146,7 @@ void EnBx_Update(Actor* thisx, PlayState* play) { } if ((&player->actor != this->collider.base.at) && (&player->actor != this->collider.base.ac) && (&player->actor != this->colliderQuad.base.at) && (player->invincibilityTimer <= 0)) { - if (player->invincibilityTimer < -39) { + if (player->invincibilityTimer <= -40) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index f14d50184b6..766b85b0023 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -529,7 +529,7 @@ void EnFd_SpinAndSpawnFire(EnFd* this, PlayState* play) { f32 tgtSpeed; f32 rotSpeed; - if ((this->spinTimer < 31) && (this->invincibilityTimer == 0)) { + if ((this->spinTimer <= 30) && (this->invincibilityTimer == 0)) { func_8002F974(&this->actor, NA_SE_EN_FLAME_FIRE_ATTACK - SFX_FLAG); } else { func_8002F974(&this->actor, NA_SE_EN_FLAME_ROLL - SFX_FLAG); diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 86839ae7419..9b8451afcc6 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -817,7 +817,7 @@ void EnIk_UpdateEnemy(Actor* thisx, PlayState* play) { prevInvincibilityTimer = player->invincibilityTimer; if (player->invincibilityTimer <= 0) { - if (player->invincibilityTimer < -39) { + if (player->invincibilityTimer <= -40) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index adb34162d38..6b87dac98f6 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -911,7 +911,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, PlayState* play) { if (this->attackCollider.base.at == &player->actor) { if (!endCharge && !(player->stateFlags2 & PLAYER_STATE2_7)) { if (player->invincibilityTimer < 0) { - if (player->invincibilityTimer < -39) { + if (player->invincibilityTimer <= -40) { player->invincibilityTimer = 0; } else { player->invincibilityTimer = 0; diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 08620c60227..72e235d4d39 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -2067,7 +2067,7 @@ void func_80B58014(EnZl3* this, PlayState* play) { this->action = 34; this->unk_3D0 = 0; func_80B57AE0(this, play); - } else if ((invincibilityTimer > 0) || (player->fallDistance >= 0x33)) { + } else if ((invincibilityTimer > 0) || (player->fallDistance >= 51)) { func_80B54E14(this, &gZelda2Anime2Anim_007664, 0, -11.0f, 0); this->action = 30; func_80B537E8(this); @@ -2222,7 +2222,7 @@ s32 func_80B5899C(EnZl3* this, PlayState* play) { Player* player = GET_PLAYER(play); s8 invincibilityTimer = player->invincibilityTimer; - if ((invincibilityTimer > 0) || (player->fallDistance >= 0x33)) { + if ((invincibilityTimer > 0) || (player->fallDistance >= 51)) { func_80B54E14(this, &gZelda2Anime2Anim_007664, 2, -11.0f, 0); this->action = 35; func_80B56DC8(this); diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index e0aa3010aff..e7b62df4e56 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -4165,6 +4165,10 @@ void func_80837948(PlayState* play, Player* this, s32 arg2) { func_80837918(this, 1, dmgFlags); } +/// Sets the number of frames the player will be invunerable for after taking damage. +/// Overrides any existing damage invincibility frames. +/// Does nothing if the player has dodge invincibility frames. +/// @param timer must be a positive value representing the number of frames the invunerability should last for void Player_SetDamagedInvincibilityTimer(Player* this, s32 timer) { if (this->invincibilityTimer >= 0) { this->invincibilityTimer = timer; @@ -4172,7 +4176,11 @@ void Player_SetDamagedInvincibilityTimer(Player* this, s32 timer) { } } -void Player_SetIFrameInvincibilityTimer(Player* this, s32 timer) { +/// Sets the number of frames the player will be invunerable for when performing a dodging maneuver like a roll. +/// Overrides any existing damage invincibility frames. +/// If the player already has dodge invincibility frames, the longer of the two will be kept. +/// @param timer must be a negative value representing the number of frames the invunerability should last for +void Player_SetDodgeInvincibilityTimer(Player* this, s32 timer) { if (this->invincibilityTimer > timer) { this->invincibilityTimer = timer; } @@ -4233,7 +4241,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 sp Player_SetDamagedInvincibilityTimer(this, invincibilityTimer); - if (damageResponseType == PLAYER_DAMAGE_RESPONSE_ICE_TRAP) { + if (damageResponseType == PLAYER_HIT_RESPONSE_ICE_TRAP) { Player_SetupAction(play, this, Player_Action_8084FB10, 0); anim = &gPlayerAnim_link_normal_ice_down; @@ -4243,7 +4251,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 sp Player_PlaySfx(this, NA_SE_PL_FREEZE_S); func_80832698(this, NA_SE_VO_LI_FREEZE); - } else if (damageResponseType == PLAYER_DAMAGE_RESPONSE_ELECTRIC_SHOCK) { + } else if (damageResponseType == PLAYER_HIT_RESPONSE_ELECTRIC_SHOCK) { Player_SetupAction(play, this, Player_Action_8084FBF4, 0); Player_RequestRumble(this, 255, 80, 150, 0); @@ -4264,8 +4272,8 @@ void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 sp anim = &gPlayerAnim_link_swimer_swim_hit; func_80832698(this, NA_SE_VO_LI_DAMAGE_S); - } else if ((damageResponseType == PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE) || - (damageResponseType == PLAYER_DAMAGE_RESPONSE_KNOCKBACK_SMALL) || + } else if ((damageResponseType == PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE) || + (damageResponseType == PLAYER_HIT_RESPONSE_KNOCKBACK_SMALL) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_21))) { Player_SetupAction(play, this, Player_Action_8084377C, 0); @@ -4275,7 +4283,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 sp Player_RequestRumble(this, 255, 20, 150, 0); func_80832224(this); - if (damageResponseType == PLAYER_DAMAGE_RESPONSE_KNOCKBACK_SMALL) { + if (damageResponseType == PLAYER_HIT_RESPONSE_KNOCKBACK_SMALL) { this->av2.actionVar2 = 4; this->actor.speed = 3.0f; @@ -4450,9 +4458,9 @@ s32 func_808382DC(Player* this, PlayState* play) { } else if ((this->knockbackType != PLAYER_KNOCKBACK_NONE) && ((this->knockbackType >= PLAYER_KNOCKBACK_LARGE) || (this->invincibilityTimer == 0))) { u8 knockbackResponse[] = { - PLAYER_DAMAGE_RESPONSE_KNOCKBACK_SMALL, - PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE, - PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE, + PLAYER_HIT_RESPONSE_KNOCKBACK_SMALL, + PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE, + PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE, }; func_80838280(this); @@ -4527,16 +4535,16 @@ s32 func_808382DC(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_27) { - sp4C = PLAYER_DAMAGE_RESPONSE_NONE; + sp4C = PLAYER_HIT_RESPONSE_NONE; } else if (this->actor.colChkInfo.acHitEffect == 2) { - sp4C = PLAYER_DAMAGE_RESPONSE_ICE_TRAP; + sp4C = PLAYER_HIT_RESPONSE_ICE_TRAP; } else if (this->actor.colChkInfo.acHitEffect == 3) { - sp4C = PLAYER_DAMAGE_RESPONSE_ELECTRIC_SHOCK; + sp4C = PLAYER_HIT_RESPONSE_ELECTRIC_SHOCK; } else if (this->actor.colChkInfo.acHitEffect == 4) { - sp4C = PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE; + sp4C = PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE; } else { func_80838280(this); - sp4C = PLAYER_DAMAGE_RESPONSE_NONE; + sp4C = PLAYER_HIT_RESPONSE_NONE; } func_80837C0C(play, this, sp4C, 4.0f, 5.0f, Actor_WorldYawTowardActor(ac, &this->actor), 20); @@ -4554,7 +4562,7 @@ s32 func_808382DC(Player* this, PlayState* play) { ((this->currentTunic != PLAYER_TUNIC_GORON) || (this->floorTypeTimer >= D_808544F4[sp48])))) { this->floorTypeTimer = 0; this->actor.colChkInfo.damage = 4; - func_80837C0C(play, this, PLAYER_DAMAGE_RESPONSE_NONE, 4.0f, 5.0f, this->actor.shape.rot.y, 20); + func_80837C0C(play, this, PLAYER_HIT_RESPONSE_NONE, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } else { return 0; } @@ -8584,7 +8592,7 @@ s32 func_80842DF4(PlayState* play, Player* this) { if (this->actor.colChkInfo.atHitEffect == 1) { this->actor.colChkInfo.damage = 8; - func_80837C0C(play, this, PLAYER_DAMAGE_RESPONSE_ELECTRIC_SHOCK, 0.0f, 0.0f, + func_80837C0C(play, this, PLAYER_HIT_RESPONSE_ELECTRIC_SHOCK, 0.0f, 0.0f, this->actor.shape.rot.y, 20); return 1; } @@ -8855,7 +8863,7 @@ void func_80843AE8(PlayState* play, Player* this) { func_80853080(this, play); } this->unk_A87 = 20; - Player_SetIFrameInvincibilityTimer(this, -20); + Player_SetDodgeInvincibilityTimer(this, -20); Audio_SetBgmVolumeOnDuringFanfare(); } } else if (this->av1.actionVar1 != 0) { @@ -9125,7 +9133,7 @@ void Player_Action_80844708(Player* this, PlayState* play) { sp44 = LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 8.0f)) { - Player_SetIFrameInvincibilityTimer(this, -10); + Player_SetDodgeInvincibilityTimer(this, -10); } if (func_80842964(this, play) == 0) { @@ -9204,7 +9212,7 @@ void Player_Action_80844A44(Player* this, PlayState* play) { if (this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) { this->actor.colChkInfo.damage = 0x10; - func_80837C0C(play, this, PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE, 4.0f, 5.0f, this->actor.shape.rot.y, 20); + func_80837C0C(play, this, PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } } @@ -9249,7 +9257,7 @@ s32 func_80844BE4(Player* this, PlayState* play) { } func_80837948(play, this, temp); - Player_SetIFrameInvincibilityTimer(this, -8); + Player_SetDodgeInvincibilityTimer(this, -8); this->stateFlags2 |= PLAYER_STATE2_17; if (this->controlStickDirections[this->controlStickDataIndex] == PLAYER_STICK_DIR_FORWARD) { @@ -10005,7 +10013,7 @@ void func_808468E8(PlayState* play, Player* this) { } void func_80846978(PlayState* play, Player* this) { - func_80837C0C(play, this, PLAYER_DAMAGE_RESPONSE_KNOCKBACK_LARGE, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); + func_80837C0C(play, this, PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); } void func_808469BC(PlayState* play, Player* this) { @@ -13256,7 +13264,7 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { func_8083C0E8(this, play); } else { this->actor.colChkInfo.damage = 0; - func_80837C0C(play, this, PLAYER_DAMAGE_RESPONSE_ICE_TRAP, 0.0f, 0.0f, 0, 20); + func_80837C0C(play, this, PLAYER_HIT_RESPONSE_ICE_TRAP, 0.0f, 0.0f, 0, 20); } return; } @@ -13770,7 +13778,7 @@ void Player_Action_8084FB10(Player* this, PlayState* play) { } else { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80839F90(this, play); - Player_SetIFrameInvincibilityTimer(this, -20); + Player_SetDodgeInvincibilityTimer(this, -20); } } } From 5ded1e6676270b3cab5fb2ebc5e5a8dfe1baf592 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Tue, 18 Jun 2024 17:26:00 -0400 Subject: [PATCH 05/11] mq bss --- src/code/fault.c | 2 +- src/code/sys_math3d.c | 2 +- src/code/z_kankyo.c | 2 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/code/fault.c b/src/code/fault.c index 662c1a9f1aa..de1d1b3499b 100644 --- a/src/code/fault.c +++ b/src/code/fault.c @@ -50,7 +50,7 @@ #if OOT_DEBUG #pragma increment_block_number 20 #else -#pragma increment_block_number 25 +#pragma increment_block_number 0 #endif void FaultDrawer_Init(void); diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index 6525f825dae..a5c577aa549 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -3,7 +3,7 @@ // For retail BSS ordering, the block number of cbf in Math3D_CylVsCylOverlapCenterDist // must be 0. -#pragma increment_block_number 187 +#pragma increment_block_number 181 s32 Math3D_LineVsLineClosestTwoPoints(Vec3f* lineAPointA, Vec3f* lineAPointB, Vec3f* lineBPointA, Vec3f* lineBPointB, Vec3f* lineAClosestToB, Vec3f* lineBClosestToA); diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index ce79a7df93b..aab40690484 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -215,7 +215,7 @@ s16 sSunDepthTestY; // These variables could be moved farther down in the file to reduce the amount // of block number padding here, but currently this causes BSS ordering issues // for debug. -#pragma increment_block_number 230 +#pragma increment_block_number 227 LightNode* sNGameOverLightNode; LightInfo sNGameOverLightInfo; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index bee978e5bcf..d75fe1dec58 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -11,7 +11,7 @@ #include "terminal.h" // For retail BSS ordering, the block number of sStreamSfxProjectedPos must be 0. -#pragma increment_block_number 198 +#pragma increment_block_number 192 #define FLAGS ACTOR_FLAG_4 From 3ff3d98983cab246b743a50a0339ed32468ccee2 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Tue, 18 Jun 2024 22:39:00 -0400 Subject: [PATCH 06/11] format --- src/overlays/actors/ovl_player_actor/z_player.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index e17418178ef..cacfa09343c 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -8592,8 +8592,8 @@ s32 func_80842DF4(PlayState* play, Player* this) { if (this->actor.colChkInfo.atHitEffect == 1) { this->actor.colChkInfo.damage = 8; - func_80837C0C(play, this, PLAYER_HIT_RESPONSE_ELECTRIC_SHOCK, 0.0f, 0.0f, - this->actor.shape.rot.y, 20); + func_80837C0C(play, this, PLAYER_HIT_RESPONSE_ELECTRIC_SHOCK, 0.0f, 0.0f, this->actor.shape.rot.y, + 20); return 1; } } From ff022844445b0f7419bb8918adbed7563a0bce5e Mon Sep 17 00:00:00 2001 From: mzxrules Date: Sat, 14 Sep 2024 22:04:20 -0400 Subject: [PATCH 07/11] Intangibility and Invulnerability --- include/z64player.h | 4 +- .../actors/ovl_player_actor/z_player.c | 54 +++++++++++-------- 2 files changed, 35 insertions(+), 23 deletions(-) diff --git a/include/z64player.h b/include/z64player.h index ee74682eca7..6179bf3f6f9 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -890,7 +890,7 @@ typedef struct Player { /* 0x088C */ u8 ledgeClimbType; /* 0x088D */ u8 ledgeClimbDelayTimer; /* 0x088E */ u8 unk_88E; - /* 0x088F */ u8 unk_88F; // Used to create the flickering animation when Link takes damage + /* 0x088F */ u8 damageFlickerAnimCounter; // Used to flicker Link after taking damage /* 0x0890 */ u8 unk_890; /* 0x0891 */ u8 bodyShockTimer; /* 0x0892 */ u8 unk_892; @@ -916,7 +916,7 @@ typedef struct Player { /* 0x0A61 */ u8 bodyFlameTimers[PLAYER_BODYPART_MAX]; // one flame per body part /* 0x0A73 */ u8 unk_A73; /* 0x0A74 */ AfterPutAwayFunc afterPutAwayFunc; // See `Player_SetupWaitForPutAway` and `Player_Action_WaitForPutAway` - /* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero. Positive values are damage invincibility, negative are dodge invincibiilty + /* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero. Positive values are intangibility, negative are invulnerability /* 0x0A79 */ u8 floorTypeTimer; // counts up every frame the current floor type is the same as the last frame /* 0x0A7A */ u8 floorProperty; /* 0x0A7B */ u8 prevFloorType; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 9112f9ab561..7c416f45d53 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -4193,26 +4193,38 @@ void func_80837948(PlayState* play, Player* this, s32 arg2) { func_80837918(this, 1, dmgFlags); } -/// Sets the number of frames the player will be invunerable for after taking damage. -/// Overrides any existing damage invincibility frames. -/// Does nothing if the player has dodge invincibility frames. -/// @param timer must be a positive value representing the number of frames the invunerability should last for -void Player_SetDamagedInvincibilityTimer(Player* this, s32 timer) { +/** + * Gives the player intangibility frames. Used for when the player takes damage. + * + * If the player is already intangible, it will be overridden by the new intangibility duration. + * If the player is already invunerable, no intangibility will be applied. + * + * @param timer must be a positive value representing the number of intangibility frames. + * @note Intangibility prevents taking damage and responses to damage like knockback, while invulnerability only + * prevents taking damage. + */ +void Player_SetIntangibility(Player* this, s32 timer) { if (this->invincibilityTimer >= 0) { this->invincibilityTimer = timer; - this->unk_88F = 0; + this->damageFlickerAnimCounter = 0; } } -/// Sets the number of frames the player will be invunerable for when performing a dodging maneuver like a roll. -/// Overrides any existing damage invincibility frames. -/// If the player already has dodge invincibility frames, the longer of the two will be kept. -/// @param timer must be a negative value representing the number of frames the invunerability should last for -void Player_SetDodgeInvincibilityTimer(Player* this, s32 timer) { +/** + * Gives the player invulnerability frames. Used for when the player performs a dodging maneuver like a roll. + * + * If the player is already intangible, they will become invulnerable instead. + * If the player is already invulnerable, the longer of the two invulnerability periods is kept. + * + * @param timer must be a negative value representing the number of invulnerability frames. + * @note Intangibility prevents taking damage and responses to damage like knockback, while invulnerability only + * prevents taking damage. + */ +void Player_SetInvulnerability(Player* this, s32 timer) { if (this->invincibilityTimer > timer) { this->invincibilityTimer = timer; } - this->unk_88F = 0; + this->damageFlickerAnimCounter = 0; } /** @@ -4267,7 +4279,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 damageResponseType, f32 sp return; } - Player_SetDamagedInvincibilityTimer(this, invincibilityTimer); + Player_SetIntangibility(this, invincibilityTimer); if (damageResponseType == PLAYER_HIT_RESPONSE_ICE_TRAP) { Player_SetupAction(play, this, Player_Action_8084FB10, 0); @@ -8898,7 +8910,7 @@ void func_80843AE8(PlayState* play, Player* this) { func_80853080(this, play); } this->unk_A87 = 20; - Player_SetDodgeInvincibilityTimer(this, -20); + Player_SetInvulnerability(this, -20); Audio_SetBgmVolumeOnDuringFanfare(); } } else if (this->av1.actionVar1 != 0) { @@ -8987,7 +8999,7 @@ s32 func_80843E64(PlayState* play, Player* this) { return -1; } - Player_SetDamagedInvincibilityTimer(this, 40); + Player_SetIntangibility(this, 40); Player_RequestQuake(play, 32967, 2, 30); Player_RequestRumble(this, impactInfo->rumbleStrength, impactInfo->rumbleDuration, impactInfo->rumbleDecreaseRate, 0); @@ -9169,7 +9181,7 @@ void Player_Action_80844708(Player* this, PlayState* play) { sp44 = LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 8.0f)) { - Player_SetDodgeInvincibilityTimer(this, -10); + Player_SetInvulnerability(this, -10); } if (func_80842964(this, play) == 0) { @@ -9293,7 +9305,7 @@ s32 func_80844BE4(Player* this, PlayState* play) { } func_80837948(play, this, temp); - Player_SetDodgeInvincibilityTimer(this, -8); + Player_SetInvulnerability(this, -8); this->stateFlags2 |= PLAYER_STATE2_17; if (this->controlStickDirections[this->controlStickDataIndex] == PLAYER_STICK_DIR_FORWARD) { @@ -11687,9 +11699,9 @@ void Player_Draw(Actor* thisx, PlayState* play2) { Gfx_SetupDL_25Xlu(play->state.gfxCtx); if (this->invincibilityTimer > 0) { - this->unk_88F += CLAMP(50 - this->invincibilityTimer, 8, 40); - POLY_OPA_DISP = - Gfx_SetFog2(POLY_OPA_DISP, 255, 0, 0, 0, 0, 4000 - (s32)(Math_CosS(this->unk_88F * 256) * 2000.0f)); + this->damageFlickerAnimCounter += CLAMP(50 - this->invincibilityTimer, 8, 40); + POLY_OPA_DISP = Gfx_SetFog2(POLY_OPA_DISP, 255, 0, 0, 0, 0, + 4000 - (s32)(Math_CosS(this->damageFlickerAnimCounter * 256) * 2000.0f)); } func_8002EBCC(&this->actor, play, 0); @@ -13822,7 +13834,7 @@ void Player_Action_8084FB10(Player* this, PlayState* play) { } else { if (LinkAnimation_Update(play, &this->skelAnime)) { func_80839F90(this, play); - Player_SetDodgeInvincibilityTimer(this, -20); + Player_SetInvulnerability(this, -20); } } } From 0558f792750a9cf13f1e6d908688704fe91b6d6e Mon Sep 17 00:00:00 2001 From: mzxrules Date: Sat, 14 Sep 2024 23:05:21 -0400 Subject: [PATCH 08/11] bss --- src/code/fault_gc.c | 2 +- src/code/z_common_data.c | 3 +-- src/code/z_kankyo.c | 5 ++--- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- 4 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index 30ffc53099b..8184ffecd6a 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -42,7 +42,7 @@ */ #if PLATFORM_GC -#pragma increment_block_number "gc-eu:208 gc-eu-mq:208 gc-eu-mq-dbg:192 gc-jp:208 gc-jp-ce:208 gc-jp-mq:208 gc-us:208" \ +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-eu-mq-dbg:192 gc-jp:208 gc-jp-ce:208 gc-jp-mq:208 gc-us:208" \ "gc-us-mq:208" #include "global.h" diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index d2655894ff9..9a5a229cc0c 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -2,8 +2,7 @@ #include "region.h" #include "versions.h" -#pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:0 gc-us:0 gc-us-mq:128" \ - "ntsc-1.2:192" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:192" ALIGNED(16) SaveContext gSaveContext; u32 D_8015FA88; diff --git a/src/code/z_kankyo.c b/src/code/z_kankyo.c index 07e46944f12..13b07c761f1 100644 --- a/src/code/z_kankyo.c +++ b/src/code/z_kankyo.c @@ -7,8 +7,7 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "assets/objects/gameplay_field_keep/gameplay_field_keep.h" -#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0" \ - "ntsc-1.2:0" +#pragma increment_block_number "gc-eu:0 gc-eu-mq:0 gc-jp:0 gc-jp-ce:0 gc-jp-mq:0 gc-us:0 gc-us-mq:0 ntsc-1.2:0" typedef enum LightningBoltState { /* 0x00 */ LIGHTNING_BOLT_START, @@ -213,7 +212,7 @@ s16 sLightningFlashAlpha; s16 sSunDepthTestX; s16 sSunDepthTestY; -#pragma increment_block_number "gc-eu:112 gc-eu-mq:112 gc-jp:96 gc-jp-ce:96 gc-jp-mq:216 gc-us:216 gc-us-mq:96" \ +#pragma increment_block_number "gc-eu:240 gc-eu-mq:240 gc-jp:216 gc-jp-ce:216 gc-jp-mq:216 gc-us:216 gc-us-mq:216" \ "ntsc-1.2:224" LightNode* sNGameOverLightNode; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index c6295766b0a..79008cf4685 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -16,7 +16,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:133 gc-eu-mq:133 gc-jp:135 gc-jp-ce:135 gc-jp-mq:129 gc-us:129 gc-us-mq:135" +#pragma increment_block_number "gc-eu:127 gc-eu-mq:127 gc-jp:129 gc-jp-ce:129 gc-jp-mq:129 gc-us:129 gc-us-mq:129" #define FLAGS ACTOR_FLAG_4 From 61173533ff17d37a5679fe23e883422b6dcc109f Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 23 Sep 2024 00:50:48 -0400 Subject: [PATCH 09/11] .bss --- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index b0062297e51..c257981c6b6 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -16,7 +16,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:132 gc-eu-mq:132 gc-jp:134 gc-jp-ce:134 gc-jp-mq:134 gc-us:134 gc-us-mq:134" +#pragma increment_block_number "gc-eu:126 gc-eu-mq:126 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" #define FLAGS ACTOR_FLAG_4 From 9230602f57fbd21da4ddc6e5f13de8d523244233 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 23 Sep 2024 17:24:03 -0400 Subject: [PATCH 10/11] add #pragma increment_block_number to z_en_item00.c --- src/boot/z_std_dma.c | 2 +- src/code/fault_gc.c | 2 +- src/code/main.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_en_item00.c | 3 +++ src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- 6 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/boot/z_std_dma.c b/src/boot/z_std_dma.c index 07ce2653599..a04a4b95c99 100644 --- a/src/boot/z_std_dma.c +++ b/src/boot/z_std_dma.c @@ -27,7 +27,7 @@ #endif #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:108" + "ntsc-1.2:102" StackEntry sDmaMgrStackInfo; OSMesgQueue sDmaMgrMsgQueue; diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index 8184ffecd6a..eecb3df0ab1 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -42,7 +42,7 @@ */ #if PLATFORM_GC -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-eu-mq-dbg:192 gc-jp:208 gc-jp-ce:208 gc-jp-mq:208 gc-us:208" \ +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-eu-mq-dbg:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:208 gc-us:208" \ "gc-us-mq:208" #include "global.h" diff --git a/src/code/main.c b/src/code/main.c index 010fd9050c5..456f03f5d0a 100644 --- a/src/code/main.c +++ b/src/code/main.c @@ -23,7 +23,7 @@ extern struct IrqMgr gIrqMgr; #endif #pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ - "ntsc-1.2:166" + "ntsc-1.2:160" extern u8 _buffersSegmentEnd[]; diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 7464b6ffd3c..58a4cf900dd 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3638,7 +3638,7 @@ s32 Camera_KeepOn3(Camera* camera) { } #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:110" + "ntsc-1.2:104" s32 Camera_KeepOn4(Camera* camera) { static Vec3f D_8015BD50; diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 74b05cf067b..73217592542 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -3,6 +3,9 @@ #include "assets/objects/gameplay_keep/gameplay_keep.h" #include "overlays/effects/ovl_Effect_Ss_Dead_Sound/z_eff_ss_dead_sound.h" +#pragma increment_block_number \ + "gc-eu:0 gc-eu-mq:0 gc-eu-mq-dbg:0 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" + #define FLAGS 0 void EnItem00_Init(Actor* thisx, PlayState* play); diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 1fe68463ff6..be984a987c8 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -16,7 +16,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:131 gc-eu-mq:131 gc-jp:133 gc-jp-ce:133 gc-jp-mq:133 gc-us:133 gc-us-mq:133" +#pragma increment_block_number "gc-eu:131 gc-eu-mq:131 gc-jp:127 gc-jp-ce:127 gc-jp-mq:133 gc-us:133 gc-us-mq:133" #define FLAGS ACTOR_FLAG_4 From 606a5c2ded0f7c19edc8f9be9e430ffa4ad5dce2 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 23 Sep 2024 17:39:47 -0400 Subject: [PATCH 11/11] .bss --- src/code/fault_gc.c | 4 ++-- src/code/z_common_data.c | 2 +- src/code/z_demo.c | 2 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/code/fault_gc.c b/src/code/fault_gc.c index eecb3df0ab1..12152f17a8c 100644 --- a/src/code/fault_gc.c +++ b/src/code/fault_gc.c @@ -42,8 +42,8 @@ */ #if PLATFORM_GC -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-eu-mq-dbg:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:208 gc-us:208" \ - "gc-us-mq:208" +#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-eu-mq-dbg:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192" \ + "gc-us-mq:192" #include "global.h" #include "alloca.h" diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 1c70bfb0f4f..dcd0ee4d2e4 100644 --- a/src/code/z_common_data.c +++ b/src/code/z_common_data.c @@ -3,7 +3,7 @@ #include "versions.h" #pragma increment_block_number "gc-eu:128 gc-eu-mq:128 gc-jp:128 gc-jp-ce:128 gc-jp-mq:128 gc-us:128 gc-us-mq:128" \ - "ntsc-1.2:224" + "ntsc-1.2:192" ALIGNED(16) SaveContext gSaveContext; u32 D_8015FA88; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 5ae1767b53b..e691c67980b 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -124,7 +124,7 @@ u16 gCamAtSplinePointsAppliedFrame; u16 gCamEyePointAppliedFrame; u16 gCamAtPointAppliedFrame; -#pragma increment_block_number "gc-eu:192 gc-eu-mq:192 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ +#pragma increment_block_number "gc-eu:192 gc-eu-mq:176 gc-jp:192 gc-jp-ce:192 gc-jp-mq:192 gc-us:192 gc-us-mq:192" \ "ntsc-1.2:96" // Cam ID to return to when a scripted cutscene is finished diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index be984a987c8..3860420ff44 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -16,7 +16,7 @@ #include "cic6105.h" #endif -#pragma increment_block_number "gc-eu:131 gc-eu-mq:131 gc-jp:127 gc-jp-ce:127 gc-jp-mq:133 gc-us:133 gc-us-mq:133" +#pragma increment_block_number "gc-eu:125 gc-eu-mq:125 gc-jp:127 gc-jp-ce:127 gc-jp-mq:127 gc-us:127 gc-us-mq:127" #define FLAGS ACTOR_FLAG_4