From 56981d5297dcb37c892a1e433684944381062995 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 23 Sep 2024 18:31:00 -0400 Subject: [PATCH] Document Player Knockback related functions (#1601) * document knockback related functions * rotation -> yRot * implement some changes * Renames and comments * mq bss * format * Intangibility and Invulnerability * bss * .bss * add #pragma increment_block_number to z_en_item00.c * .bss --- include/z64actor.h | 10 +- include/z64player.h | 29 +++- src/boot/z_std_dma.c | 2 +- src/code/fault_gc.c | 4 +- src/code/main.c | 2 +- src/code/z_actor.c | 77 +++++++-- src/code/z_bgcheck.c | 2 +- src/code/z_camera.c | 2 +- src/code/z_collision_check.c | 2 +- src/code/z_common_data.c | 2 +- src/code/z_demo.c | 2 +- src/code/z_en_item00.c | 3 + src/code/z_kankyo.c | 5 +- .../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 | 4 +- 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 | 5 +- .../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_Ik/z_en_ik.c | 4 +- src/overlays/actors/ovl_En_Mb/z_en_mb.c | 19 +-- 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 +- src/overlays/actors/ovl_En_Xc/z_en_xc.c | 3 +- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 4 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 2 +- .../actors/ovl_player_actor/z_player.c | 150 +++++++++++------- 62 files changed, 298 insertions(+), 187 deletions(-) diff --git a/include/z64actor.h b/include/z64actor.h index 949cc8cffe..255ddf3464 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -838,11 +838,11 @@ void Actor_SetClosestSecretDistance(Actor* actor, struct PlayState* play); s32 Actor_IsMounted(struct PlayState* play, Actor* horse); u32 Actor_SetRideActor(struct PlayState* play, Actor* horse, s32 mountSide); s32 Actor_NotMounted(struct PlayState* play, Actor* horse); -void func_8002F698(struct PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6); -void func_8002F6D4(struct PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); -void func_8002F71C(struct PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4); -void func_8002F758(struct PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5); -void func_8002F7A0(struct PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4); +void Actor_SetPlayerKnockback(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 type, u32 damage); +void Actor_SetPlayerKnockbackLarge(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage); +void Actor_SetPlayerKnockbackLargeNoDamage(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity); +void Actor_SetPlayerKnockbackSmall(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity, u32 damage); +void Actor_SetPlayerKnockbackSmallNoDamage(struct PlayState* play, Actor* actor, f32 speed, s16 rot, f32 yVelocity); void Player_PlaySfx(struct Player* player, u16 sfxId); void Actor_PlaySfx(Actor* actor, u16 sfxId); void Actor_PlaySfx_SurfaceBomb(struct PlayState* play, Actor* actor); diff --git a/include/z64player.h b/include/z64player.h index 0043cc9546..d28ea8c0fb 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -604,6 +604,21 @@ typedef enum PlayerStickDirection { /* 3 */ PLAYER_STICK_DIR_RIGHT } PlayerStickDirection; +typedef enum { + /* 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 { + /* 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 PlayerAgeProperties { /* 0x00 */ f32 ceilingCheckHeight; /* 0x04 */ f32 unk_04; @@ -875,7 +890,7 @@ typedef struct Player { /* 0x088C */ u8 ledgeClimbType; /* 0x088D */ u8 ledgeClimbDelayTimer; /* 0x088E */ u8 unk_88E; - /* 0x088F */ u8 unk_88F; + /* 0x088F */ u8 damageFlickerAnimCounter; // Used to flicker Link after taking damage /* 0x0890 */ u8 unk_890; /* 0x0891 */ u8 bodyShockTimer; /* 0x0892 */ u8 unk_892; @@ -886,11 +901,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]; @@ -901,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 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/boot/z_std_dma.c b/src/boot/z_std_dma.c index 07ce265359..a04a4b95c9 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 30ffc53099..12152f17a8 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:208 gc-eu-mq:208 gc-eu-mq-dbg:192 gc-jp:208 gc-jp-ce:208 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/main.c b/src/code/main.c index 010fd9050c..456f03f5d0 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_actor.c b/src/code/z_actor.c index 4405ae21ce..7e99d066f0 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1901,30 +1901,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_8A4 = arg2; - player->unk_8A2 = arg3; - player->unk_8A8 = arg4; + player->knockbackDamage = damage; + player->knockbackType = type; + player->knockbackSpeed = speed; + player->knockbackRot = rot; + 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/code/z_bgcheck.c b/src/code/z_bgcheck.c index dcc2a0df33..3bebeecd5e 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -1,7 +1,7 @@ #include "global.h" #include "terminal.h" -#pragma increment_block_number "ntsc-1.2:152" +#pragma increment_block_number "ntsc-1.2:148" u16 DynaSSNodeList_GetNextNodeIdx(DynaSSNodeList* nodeList); void BgCheck_GetStaticLookupIndicesFromPos(CollisionContext* colCtx, Vec3f* pos, Vec3i* sector); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 7464b6ffd3..58a4cf900d 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_collision_check.c b/src/code/z_collision_check.c index 1f6bb36cd2..27629dd829 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -5,7 +5,7 @@ #include "overlays/effects/ovl_Effect_Ss_HitMark/z_eff_ss_hitmark.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:224" +#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:216" typedef s32 (*ColChkResetFunc)(PlayState*, Collider*); typedef void (*ColChkApplyFunc)(PlayState*, CollisionCheckContext*, Collider*); diff --git a/src/code/z_common_data.c b/src/code/z_common_data.c index 1c70bfb0f4..dcd0ee4d2e 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 5ae1767b53..e691c67980 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/code/z_en_item00.c b/src/code/z_en_item00.c index 74b05cf067..7321759254 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/code/z_kankyo.c b/src/code/z_kankyo.c index 16ccf3b47b..13b07c761f 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: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: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:96 gc-us:96 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_Bg_Haka_Tubo/z_bg_haka_tubo.c b/src/overlays/actors/ovl_Bg_Haka_Tubo/z_bg_haka_tubo.c index 5e8e61ba27..de6dd98196 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 collider 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 dfd7289315..3bfa831b73 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 @@ -212,7 +212,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 8b120e6dab..f083db4284 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 @@ -132,7 +132,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 cc18c4edef..b8d0e63402 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 d512fd4820..2980f56746 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 @@ -259,7 +259,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 31545fe1ce..4b49c9b87b 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 1baa36c389..b4bd5d4e77 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 @@ -97,13 +97,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 dad395c928..2b799465ce 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 6042ccd718..6920ae0412 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -1485,7 +1485,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) { s16 i2; 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 ff8a55f1a9..f3f47695c6 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -295,7 +295,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 e463ef1449..efb2e14cbe 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -3981,7 +3981,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; @@ -4453,7 +4453,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; @@ -4775,7 +4775,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 dbddf628b8..d0fe5ad9f8 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -1859,7 +1859,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; @@ -1880,7 +1881,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 7bbc960cce..4720233dac 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -825,7 +825,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 07b74f7ddb..b91d071943 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -769,7 +769,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); } } @@ -1524,7 +1524,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); @@ -1584,7 +1584,8 @@ void BossSst_HandSweep(BossSst* this, PlayState* play) { 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) { @@ -1643,7 +1644,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); } @@ -1961,7 +1962,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); } @@ -2083,7 +2084,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); } } @@ -2433,7 +2434,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 39996fbbb9..440695d360 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -804,7 +804,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 6e3b6b4eb1..c073b21212 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -1071,7 +1071,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); } } @@ -1161,7 +1161,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); } } @@ -1237,7 +1237,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); } @@ -1358,7 +1358,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); } @@ -2545,7 +2545,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; @@ -2640,7 +2641,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 1fe96ebb63..21f7a4c763 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 a8ca1c5cd3..01e2762657 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 2461948d31..287ff56297 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 @@ -360,7 +360,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 af2e435b20..9662ec26ac 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -311,7 +311,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); } } 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 407bc8cef0..e896f5bf25 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -171,7 +171,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); PRINTF("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 65a839aae6..de7141aa3a 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 0e16b6dcfd..89edf9c5f6 100644 --- a/src/overlays/actors/ovl_En_Brob/z_en_brob.c +++ b/src/overlays/actors/ovl_En_Brob/z_en_brob.c @@ -151,7 +151,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); @@ -277,7 +278,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 5a284929ed..466ebfce65 100644 --- a/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c +++ b/src/overlays/actors/ovl_En_Bubble/z_en_bubble.c @@ -115,7 +115,7 @@ void EnBubble_DamagePlayer(EnBubble* this, PlayState* play) { s32 damage = -this->colliderSphere.elements[0].base.atDmgInfo.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 64d44b27f5..91b701d0d7 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -146,14 +146,14 @@ 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; 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 1c4abe8a3e..0936c81d77 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -330,7 +330,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 62c0faf5ff..d3bf1f26cc 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 @@ -338,7 +338,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 4ff76c923e..8af5bed6ad 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -303,7 +303,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; } @@ -525,7 +526,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)) { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FLAME_FIRE_ATTACK - SFX_FLAG); } else { Actor_PlaySfx_Flagged(&this->actor, NA_SE_EN_FLAME_ROLL - SFX_FLAG); 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 ced412103c..a76c0b8783 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 @@ -535,7 +535,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 e07030cab7..255420e8e2 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 8d09f45342..4c1a386975 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -923,7 +923,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 781bed2255..78376c9813 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -714,7 +714,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 579b193264..cf6f0aa275 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -900,7 +900,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 650c346bfe..a4f7d74c1e 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -609,7 +609,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); PRINTF(VT_FGCOL(CYAN)); PRINTF("Player ぶっ飛ばし\n"); // "Player knocked down" PRINTF(VT_RST); @@ -695,7 +695,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; @@ -720,7 +720,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 c98881645d..e0a1f34432 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -319,7 +319,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_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 727bad19bb..69644f547f 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -820,7 +820,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; @@ -829,7 +829,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 9fa90fb8c5..e92cd0e387 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -606,7 +606,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; } @@ -723,7 +723,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) { @@ -840,8 +840,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; } @@ -911,7 +912,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; @@ -956,7 +957,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); } #endif } @@ -1033,7 +1034,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); } #endif this->attack = ENMB_ATTACK_NONE; @@ -1316,7 +1317,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; } @@ -1399,7 +1400,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 cb4b3b106e..1053bfb0af 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -462,7 +462,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 508a4e543a..5b5afeedba 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -1056,7 +1056,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 1d3eb0fd42..9651575806 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 985083560c..9dfd99b46c 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -324,7 +324,7 @@ void EnRr_SetupReleasePlayer(EnRr* this, PlayState* play) { break; } PRINTF(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 09fa048cae..3d9c998742 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 69b1f17244..cfb68947d0 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 72b6c4587c..41ed3883e7 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -581,11 +581,11 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { if (!Actor_ApplyDamage(&this->actor)) { func_800F5B58(); this->actor.flags &= ~(ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_HOSTILE); - 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); @@ -601,11 +601,11 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { } } else { this->actor.flags &= ~ACTOR_FLAG_ATTENTION_ENABLED; - 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.elem, true); this->stateFlags3 &= ~PLAYER_STATE3_2; this->stateFlags3 |= PLAYER_STATE3_0; @@ -618,7 +618,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 8cf807dcad..8763edd047 100644 --- a/src/overlays/actors/ovl_En_Trap/z_en_trap.c +++ b/src/overlays/actors/ovl_En_Trap/z_en_trap.c @@ -175,7 +175,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_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index cbba735f78..70de5b2af1 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -1395,8 +1395,7 @@ void func_80B3F3D8(void) { Sfx_PlaySfxCentered2(NA_SE_PL_SKIP); } -#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64" \ - "ntsc-1.2:128" +#pragma increment_block_number "gc-eu:64 gc-eu-mq:64 gc-jp:64 gc-jp-ce:64 gc-jp-mq:64 gc-us:64 gc-us-mq:64 ntsc-1.2:64" void EnXc_PlayDiveSFX(Vec3f* src, PlayState* play) { static Vec3f D_80B42DA0; 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 d6a2a02893..6766da26ad 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -2070,7 +2070,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); @@ -2225,7 +2225,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_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 1fe68463ff..3860420ff4 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: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 diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 3e213f1f61..047bb9e560 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -4302,23 +4302,46 @@ void func_80837948(PlayState* play, Player* this, s32 arg2) { func_80837918(this, 1, dmgFlags); } -void func_80837AE0(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; } } -void func_80837AFC(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; } +/** + * @return false if player is out of health + */ s32 func_80837B18(PlayState* play, Player* this, s32 damage) { if ((this->invincibilityTimer != 0) || (this->actor.category != ACTORCAT_PLAYER)) { - return 1; + return true; } return Health_ChangeBy(play, damage); @@ -4344,7 +4367,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 yRot, + s32 invincibilityTimer) { LinkAnimationHeader* anim = NULL; LinkAnimationHeader** sp28; @@ -4364,9 +4388,9 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, return; } - func_80837AE0(this, arg6); + Player_SetIntangibility(this, invincibilityTimer); - if (arg2 == 3) { + if (damageResponseType == PLAYER_HIT_RESPONSE_ICE_TRAP) { Player_SetupAction(play, this, Player_Action_8084FB10, 0); anim = &gPlayerAnim_link_normal_ice_down; @@ -4376,7 +4400,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_PlaySfx(this, NA_SE_PL_FREEZE_S); Player_PlayVoiceSfx(this, NA_SE_VO_LI_FREEZE); - } else if (arg2 == 4) { + } else if (damageResponseType == PLAYER_HIT_RESPONSE_ELECTRIC_SHOCK) { Player_SetupAction(play, this, Player_Action_8084FBF4, 0); Player_RequestRumble(this, 255, 80, 150, 0); @@ -4386,7 +4410,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; + 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); @@ -4397,7 +4421,9 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, anim = &gPlayerAnim_link_swimer_swim_hit; Player_PlayVoiceSfx(this, NA_SE_VO_LI_DAMAGE_S); - } else if ((arg2 == 1) || (arg2 == 2) || !(this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || + } 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); @@ -4406,7 +4432,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_HIT_RESPONSE_KNOCKBACK_SMALL) { this->av2.actionVar2 = 4; this->actor.speed = 3.0f; @@ -4416,11 +4442,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)); Player_PlayVoiceSfx(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(yRot) > 0x4000) { anim = &gPlayerAnim_link_normal_front_downA; } else { anim = &gPlayerAnim_link_normal_back_downA; @@ -4456,7 +4482,7 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, sp28 += 4; } - if (ABS(arg5) <= 0x4000) { + if (ABS(yRot) <= 0x4000) { sp28 += 2; } @@ -4469,10 +4495,10 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_PlayVoiceSfx(this, NA_SE_VO_LI_DAMAGE_S); } - this->actor.shape.rot.y += arg5; + 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(arg5) > 0x4000) { + if (ABS(yRot) > 0x4000) { this->actor.shape.rot.y += 0x8000; } } @@ -4578,17 +4604,23 @@ s32 func_808382DC(Player* this, PlayState* play) { Player_PlayVoiceSfx(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_HIT_RESPONSE_KNOCKBACK_SMALL, + PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE, + PLAYER_HIT_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; @@ -4652,16 +4684,16 @@ s32 func_808382DC(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_27) { - sp4C = 0; + sp4C = PLAYER_HIT_RESPONSE_NONE; } else if (this->actor.colChkInfo.acHitEffect == 2) { - sp4C = 3; + sp4C = PLAYER_HIT_RESPONSE_ICE_TRAP; } else if (this->actor.colChkInfo.acHitEffect == 3) { - sp4C = 4; + sp4C = PLAYER_HIT_RESPONSE_ELECTRIC_SHOCK; } else if (this->actor.colChkInfo.acHitEffect == 4) { - sp4C = 1; + sp4C = PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE; } else { func_80838280(this); - sp4C = 0; + sp4C = PLAYER_HIT_RESPONSE_NONE; } func_80837C0C(play, this, sp4C, 4.0f, 5.0f, Actor_WorldYawTowardActor(ac, &this->actor), 20); @@ -4679,7 +4711,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_HIT_RESPONSE_NONE, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } else { return 0; } @@ -8718,7 +8750,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_HIT_RESPONSE_ELECTRIC_SHOCK, 0.0f, 0.0f, this->actor.shape.rot.y, + 20); return 1; } } @@ -8872,14 +8905,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) { @@ -8895,7 +8929,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 { @@ -8987,7 +9021,7 @@ void func_80843AE8(PlayState* play, Player* this) { func_80853080(this, play); } this->unk_A87 = 20; - func_80837AFC(this, -20); + Player_SetInvulnerability(this, -20); Audio_SetBgmVolumeOnDuringFanfare(); } } else if (this->av1.actionVar1 != 0) { @@ -9048,19 +9082,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; @@ -9076,7 +9110,7 @@ s32 func_80843E64(PlayState* play, Player* this) { return -1; } - func_80837AE0(this, 40); + Player_SetIntangibility(this, 40); Player_RequestQuake(play, 32967, 2, 30); Player_RequestRumble(this, impactInfo->rumbleStrength, impactInfo->rumbleDuration, impactInfo->rumbleDecreaseRate, 0); @@ -9086,14 +9120,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) { Player_PlayVoiceSfx(this, NA_SE_VO_LI_CLIMB_END); @@ -9258,7 +9292,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, FRAMERATE_CONST(-10, -8)); + Player_SetInvulnerability(this, FRAMERATE_CONST(-10, -8)); } if (func_80842964(this, play) == 0) { @@ -9337,7 +9371,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_HIT_RESPONSE_KNOCKBACK_LARGE, 4.0f, 5.0f, this->actor.shape.rot.y, 20); } } @@ -9382,7 +9416,7 @@ s32 func_80844BE4(Player* this, PlayState* play) { } func_80837948(play, this, temp); - func_80837AFC(this, -8); + Player_SetInvulnerability(this, -8); this->stateFlags2 |= PLAYER_STATE2_17; if (this->controlStickDirections[this->controlStickDataIndex] == PLAYER_STICK_DIR_FORWARD) { @@ -10140,7 +10174,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_HIT_RESPONSE_KNOCKBACK_LARGE, 2.0f, 2.0f, this->actor.shape.rot.y + 0x8000, 0); } void func_808469BC(PlayState* play, Player* this) { @@ -11537,7 +11571,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->autoLockOnActor = NULL; phi_f12 = @@ -11778,9 +11812,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); @@ -13403,7 +13437,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_HIT_RESPONSE_ICE_TRAP, 0.0f, 0.0f, 0, 20); } return; } @@ -13917,7 +13951,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_SetInvulnerability(this, -20); } } }