From b5c6545d6f97b7762aa3f0cc308c2b0e6ec9fd84 Mon Sep 17 00:00:00 2001 From: Pepe20129 <72659707+Pepe20129@users.noreply.github.com> Date: Thu, 17 Oct 2024 20:55:31 +0200 Subject: [PATCH] `z_player` documentation 2024-10-11 (#4407) * Add names to start of typedefs * Idle stuff * 2 functions * Player state flags * Name functions + misc * ActionChange => ActionHandler * Some player unks * More player unks * Header misc * Misc * More misc * Player Actions * Missed comments * Move ship specific stuff * Fix build * CsCmdActorAction to CsCmdActorCue * Fix build --- soh/include/functions.h | 10 +- soh/include/macros.h | 16 +- soh/include/z64.h | 4 +- soh/include/z64cutscene.h | 2 +- soh/include/z64player.h | 412 +- soh/soh/Enhancements/debugger/actorViewer.cpp | 2 +- .../Enhancements/debugger/debugSaveEditor.cpp | 4 +- .../Enhancements/randomizer/hook_handlers.cpp | 16 +- .../Enhancements/timesaver_hook_handlers.cpp | 4 +- soh/soh/OTRGlobals.cpp | 6 +- soh/src/code/z_actor.c | 80 +- soh/src/code/z_camera.c | 2 +- soh/src/code/z_parameter.c | 2 +- soh/src/code/z_player_lib.c | 230 +- .../overlays/actors/ovl_Bg_Haka/z_bg_haka.c | 2 +- .../ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c | 2 +- .../ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c | 2 +- .../z_bg_spot01_idohashira.c | 8 +- .../z_bg_spot16_bombstone.c | 2 +- .../actors/ovl_Bg_Treemouth/z_bg_treemouth.c | 4 +- .../overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 4 +- .../overlays/actors/ovl_Demo_6K/z_demo_6k.c | 2 +- .../overlays/actors/ovl_Demo_Du/z_demo_du.c | 32 +- .../overlays/actors/ovl_Demo_Ec/z_demo_ec.c | 8 +- .../overlays/actors/ovl_Demo_Ext/z_demo_ext.c | 6 +- .../overlays/actors/ovl_Demo_Go/z_demo_go.c | 6 +- .../overlays/actors/ovl_Demo_Gt/z_demo_gt.c | 8 +- .../overlays/actors/ovl_Demo_Ik/z_demo_ik.c | 10 +- .../overlays/actors/ovl_Demo_Im/z_demo_im.c | 20 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 2 +- .../overlays/actors/ovl_Demo_Sa/z_demo_sa.c | 18 +- .../overlays/actors/ovl_Demo_Shd/z_demo_shd.c | 4 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 6 +- .../actors/ovl_Efc_Erupc/z_efc_erupc.c | 2 +- soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c | 4 +- .../overlays/actors/ovl_En_Bombf/z_en_bombf.c | 10 +- .../overlays/actors/ovl_En_Boom/z_en_boom.c | 2 +- soh/src/overlays/actors/ovl_En_Dh/z_en_dh.c | 2 +- .../actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c | 2 +- soh/src/overlays/actors/ovl_En_Du/z_en_du.c | 6 +- soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c | 22 +- .../actors/ovl_En_Ex_Item/z_en_ex_item.c | 2 +- .../overlays/actors/ovl_En_Fish/z_en_fish.c | 2 +- .../actors/ovl_En_Goroiwa/z_en_goroiwa.c | 2 +- .../overlays/actors/ovl_En_Horse/z_en_horse.c | 44 +- soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c | 6 +- soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c | 24 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 2 +- .../overlays/actors/ovl_En_Okuta/z_en_okuta.c | 2 +- soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c | 6 +- soh/src/overlays/actors/ovl_En_Rl/z_en_rl.c | 6 +- soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c | 28 +- soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c | 16 +- soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c | 6 +- soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c | 4 +- .../overlays/actors/ovl_En_Test/z_en_test.c | 6 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 26 +- soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c | 44 +- soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c | 4 +- soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 8 +- soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c | 28 +- soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 4 +- .../actors/ovl_Obj_Dekujr/z_obj_dekujr.c | 6 +- .../actors/ovl_player_actor/z_player.c | 4901 ++++++++++------- .../ovl_kaleido_scope/z_kaleido_scope_PAL.c | 2 +- 65 files changed, 3603 insertions(+), 2562 deletions(-) diff --git a/soh/include/functions.h b/soh/include/functions.h index 82b03e637..41b325236 100644 --- a/soh/include/functions.h +++ b/soh/include/functions.h @@ -415,7 +415,7 @@ f32 Actor_WorldDistXZToPoint(Actor* actor, Vec3f* refPoint); void func_8002DBD0(Actor* actor, Vec3f* result, Vec3f* arg2); f32 Actor_HeightDiff(Actor* actorA, Actor* actorB); f32 Player_GetHeight(Player* player); -s32 Player_ActionChange_2(Player* player, PlayState* play); +s32 Player_ActionHandler_2(Player* player, PlayState* play); f32 func_8002DCE4(Player* player); s32 func_8002DD6C(Player* player); s32 func_8002DD78(Player* player); @@ -1107,7 +1107,7 @@ void Player_SetBootData(PlayState* play, Player* player); s32 Player_InBlockingCsMode(PlayState* play, Player* player); s32 Player_TryCsAction(PlayState* play, Actor* actor, s32 csAction); s32 Player_InCsMode(PlayState* play); -s32 func_8008E9C4(Player* player); +s32 Player_CheckHostileLockOn(Player* player); s32 Player_IsChildWithHylianShield(Player* player); s32 Player_ActionToModelGroup(Player* player, s32 actionParam); void Player_SetModelsForHoldingShield(Player* player); @@ -1117,9 +1117,9 @@ void func_8008EC70(Player* player); void Player_SetEquipmentData(PlayState* play, Player* player); void Player_UpdateBottleHeld(PlayState* play, Player* player, s32 item, s32 actionParam); void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, s16 arg5, s32 arg6); -void func_8008EDF0(Player* player); -void func_8008EE08(Player* player); -void func_8008EEAC(PlayState* play, Actor* actor); +void Player_ReleaseLockOn(Player* player); +void Player_ClearZTargeting(Player* player); +void Player_SetAutoLockOnActor(PlayState* play, Actor* actor); s32 func_8008EF44(PlayState* play, s32 ammo); s32 Player_IsBurningStickInRange(PlayState* play, Vec3f* pos, f32 radius, f32 arg3); s32 Player_GetStrength(void); diff --git a/soh/include/macros.h b/soh/include/macros.h index 6288efe59..e5c03ceca 100644 --- a/soh/include/macros.h +++ b/soh/include/macros.h @@ -8,17 +8,23 @@ // #define __attribute__(x) // #endif -// #ifndef AVOID_UB -// #define BAD_RETURN(type) type -// #else -// #define BAD_RETURN(type) void -// #endif +// SoH [Port] Always use the AVOID_UB version (we don't set AVOID_UB while building yet) +/* +#ifndef AVOID_UB +#define BAD_RETURN(type) type +#else +#define BAD_RETURN(type) void +#endif +*/ +#define BAD_RETURN(type) void +// Upstream TODO: Document reasoning for change // #define UNUSED __attribute__((unused)) // #define FALLTHROUGH __attribute__((fallthrough)) #define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0])) #define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0])) +#define ARRAY_COUNT_2D(arr) (s32)(sizeof(arr) / sizeof(arr[0][0])) #define PHYSICAL_TO_VIRTUAL(addr) (void*)((uintptr_t)(addr) + 0x80000000) #define VIRTUAL_TO_PHYSICAL(addr) (uintptr_t)((u8*)(addr) - 0x80000000) diff --git a/soh/include/z64.h b/soh/include/z64.h index 6d79cbc04..f4cec6e82 100644 --- a/soh/include/z64.h +++ b/soh/include/z64.h @@ -382,8 +382,8 @@ typedef struct { /* 0x1B */ u8 unk_1B; /* 0x1C */ CutsceneCameraPoint* cameraFocus; /* 0x20 */ CutsceneCameraPoint* cameraPosition; - /* 0x24 */ CsCmdActorAction* linkAction; - /* 0x28 */ CsCmdActorAction* npcActions[10]; // "npcdemopnt" + /* 0x24 */ CsCmdActorCue* linkAction; + /* 0x28 */ CsCmdActorCue* npcActions[10]; // "npcdemopnt" } CutsceneContext; // size = 0x50 typedef struct { diff --git a/soh/include/z64cutscene.h b/soh/include/z64cutscene.h index cea4e2fab..7511cca92 100644 --- a/soh/include/z64cutscene.h +++ b/soh/include/z64cutscene.h @@ -92,7 +92,7 @@ typedef struct { /* 0x0C */ Vec3i startPos; /* 0x18 */ Vec3i endPos; /* 0x24 */ Vec3i normal; -} CsCmdActorAction; // size = 0x30 +} CsCmdActorCue; // size = 0x30 typedef enum { CS_STATE_IDLE, diff --git a/soh/include/z64player.h b/soh/include/z64player.h index d03b64da5..6f00eb3ef 100644 --- a/soh/include/z64player.h +++ b/soh/include/z64player.h @@ -7,9 +7,7 @@ struct Player; -extern GetItemEntry sGetItemTable[195]; - -typedef enum { +typedef enum PlayerSword { /* 0 */ PLAYER_SWORD_NONE, /* 1 */ PLAYER_SWORD_KOKIRI, /* 2 */ PLAYER_SWORD_MASTER, @@ -17,7 +15,7 @@ typedef enum { /* 4 */ PLAYER_SWORD_MAX } PlayerSword; -typedef enum { +typedef enum PlayerShield { /* 0x00 */ PLAYER_SHIELD_NONE, /* 0x01 */ PLAYER_SHIELD_DEKU, /* 0x02 */ PLAYER_SHIELD_HYLIAN, @@ -25,14 +23,14 @@ typedef enum { /* 0x04 */ PLAYER_SHIELD_MAX } PlayerShield; -typedef enum { +typedef enum PlayerTunic { /* 0x00 */ PLAYER_TUNIC_KOKIRI, /* 0x01 */ PLAYER_TUNIC_GORON, /* 0x02 */ PLAYER_TUNIC_ZORA, /* 0x03 */ PLAYER_TUNIC_MAX } PlayerTunic; -typedef enum { +typedef enum PlayerBoots { /* 0x00 */ PLAYER_BOOTS_KOKIRI, /* 0x01 */ PLAYER_BOOTS_IRON, /* 0x02 */ PLAYER_BOOTS_HOVER, @@ -43,7 +41,7 @@ typedef enum { /* 0x06 */ PLAYER_BOOTS_MAX } PlayerBoots; -typedef enum { +typedef enum PlayerStrength { /* 0x00 */ PLAYER_STR_NONE, /* 0x01 */ PLAYER_STR_BRACELET, /* 0x02 */ PLAYER_STR_SILVER_G, @@ -51,7 +49,7 @@ typedef enum { /* 0x04 */ PLAYER_STR_MAX } PlayerStrength; -typedef enum { +typedef enum PlayerMask { /* 0x00 */ PLAYER_MASK_NONE, /* 0x01 */ PLAYER_MASK_KEATON, /* 0x02 */ PLAYER_MASK_SKULL, @@ -64,9 +62,15 @@ typedef enum { /* 0x09 */ PLAYER_MASK_MAX } PlayerMask; -typedef enum { +typedef enum PlayerIdleType { + /* -0x1 */ PLAYER_IDLE_CRIT_HEALTH = -1, + /* 0x0 */ PLAYER_IDLE_DEFAULT, + /* 0x1 */ PLAYER_IDLE_FIDGET +} PlayerIdleType; + +typedef enum PlayerItemAction { /* 0x00 */ PLAYER_IA_NONE, - /* 0x01 */ PLAYER_IA_LAST_USED, + /* 0x01 */ PLAYER_IA_SWORD_CS, // Hold sword without shield in hand. The sword is not usable. /* 0x02 */ PLAYER_IA_FISHING_POLE, /* 0x03 */ PLAYER_IA_SWORD_MASTER, /* 0x04 */ PLAYER_IA_SWORD_KOKIRI, @@ -132,10 +136,10 @@ typedef enum { /* 0x40 */ PLAYER_IA_MASK_GERUDO, /* 0x41 */ PLAYER_IA_MASK_TRUTH, /* 0x42 */ PLAYER_IA_LENS_OF_TRUTH, - /* 0x4C */ PLAYER_IA_MAX + /* 0x43 */ PLAYER_IA_MAX } PlayerItemAction; -typedef enum { +typedef enum PlayerLimb { /* 0x00 */ PLAYER_LIMB_NONE, /* 0x01 */ PLAYER_LIMB_ROOT, /* 0x02 */ PLAYER_LIMB_WAIST, @@ -161,7 +165,7 @@ typedef enum { /* 0x16 */ PLAYER_LIMB_MAX } PlayerLimb; -typedef enum { +typedef enum PlayerBodyPart { /* 0x00 */ PLAYER_BODYPART_WAIST, // PLAYER_LIMB_WAIST /* 0x01 */ PLAYER_BODYPART_R_THIGH, // PLAYER_LIMB_R_THIGH /* 0x02 */ PLAYER_BODYPART_R_SHIN, // PLAYER_LIMB_R_SHIN @@ -183,7 +187,7 @@ typedef enum { /* 0x12 */ PLAYER_BODYPART_MAX } PlayerBodyPart; -typedef enum { +typedef enum PlayerMeleeWeaponAnimation { /* 0 */ PLAYER_MWA_FORWARD_SLASH_1H, /* 1 */ PLAYER_MWA_FORWARD_SLASH_2H, /* 2 */ PLAYER_MWA_FORWARD_COMBO_1H, @@ -215,7 +219,7 @@ typedef enum { /* 28 */ PLAYER_MWA_MAX } PlayerMeleeWeaponAnimation; -typedef enum { +typedef enum PlayerDoorType { /* -1 */ PLAYER_DOORTYPE_AJAR = -1, /* 0 */ PLAYER_DOORTYPE_NONE, /* 1 */ PLAYER_DOORTYPE_HANDLE, @@ -223,10 +227,10 @@ typedef enum { /* 3 */ PLAYER_DOORTYPE_FAKE } PlayerDoorType; -typedef enum { - /* 0x00 */ PLAYER_MODELGROUP_0, // unused (except with the `Player_OverrideLimbDrawPause` bug) - /* 0x01 */ PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD, // kokiri/master sword, shield not in hand - /* 0x02 */ PLAYER_MODELGROUP_SWORD, // kokiri/master sword and possibly shield +typedef enum PlayerModelGroup { + /* 0x00 */ PLAYER_MODELGROUP_0, // unused (except for a bug in `Player_OverrideLimbDrawPause`) + /* 0x01 */ PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD, //hold sword only. used for holding sword only as child link with hylian shield equipped + /* 0x02 */ PLAYER_MODELGROUP_SWORD_AND_SHIELD, // hold sword and shield or just sword if no shield is equipped /* 0x03 */ PLAYER_MODELGROUP_DEFAULT, // non-specific models, for items that don't have particular link models /* 0x04 */ PLAYER_MODELGROUP_4, // unused, same as PLAYER_MODELGROUP_DEFAULT /* 0x05 */ PLAYER_MODELGROUP_BGS, // biggoron sword @@ -239,11 +243,11 @@ typedef enum { /* 0x0C */ PLAYER_MODELGROUP_OCARINA, // ocarina /* 0x0D */ PLAYER_MODELGROUP_OOT, // ocarina of time /* 0x0E */ PLAYER_MODELGROUP_BOTTLE, // bottles (drawn separately) - /* 0x0F */ PLAYER_MODELGROUP_15, // "last used" + /* 0x0F */ PLAYER_MODELGROUP_SWORD, // hold sword and no shield, even if one is equipped /* 0x10 */ PLAYER_MODELGROUP_MAX } PlayerModelGroup; -typedef enum { +typedef enum PlayerModelGroupEntry { /* 0x00 */ PLAYER_MODELGROUPENTRY_ANIM, /* 0x01 */ PLAYER_MODELGROUPENTRY_LEFT_HAND, /* 0x02 */ PLAYER_MODELGROUPENTRY_RIGHT_HAND, @@ -252,7 +256,7 @@ typedef enum { /* 0x05 */ PLAYER_MODELGROUPENTRY_MAX } PlayerModelGroupEntry; -typedef enum { +typedef enum PlayerModelType { // left hand /* 0x00 */ PLAYER_MODELTYPE_LH_OPEN, // empty open hand /* 0x01 */ PLAYER_MODELTYPE_LH_CLOSED, // empty closed hand @@ -282,7 +286,7 @@ typedef enum { /* 0xFF */ PLAYER_MODELTYPE_RH_FF = 0xFF // disable shield collider, cutscene-specific } PlayerModelType; -typedef enum { +typedef enum PlayerAnimType { /* 0x00 */ PLAYER_ANIMTYPE_0, /* 0x01 */ PLAYER_ANIMTYPE_1, /* 0x02 */ PLAYER_ANIMTYPE_2, @@ -292,7 +296,10 @@ typedef enum { /* 0x06 */ PLAYER_ANIMTYPE_MAX } PlayerAnimType; -typedef enum { +/** + * Temporary names, derived from original animation names in `D_80853914` + */ +typedef enum PlayerAnimGroup { /* 0x00 */ PLAYER_ANIMGROUP_wait, /* 0x01 */ PLAYER_ANIMGROUP_walk, /* 0x02 */ PLAYER_ANIMGROUP_run, @@ -344,7 +351,227 @@ typedef enum { #define LIMB_BUF_COUNT(limbCount) ((ALIGN16((limbCount) * sizeof(Vec3s)) + sizeof(Vec3s) - 1) / sizeof(Vec3s)) #define PLAYER_LIMB_BUF_COUNT LIMB_BUF_COUNT(PLAYER_LIMB_MAX) -typedef struct { +typedef enum PlayerCsAction { + /* 0x00 */ PLAYER_CSACTION_NONE, + /* 0x01 */ PLAYER_CSACTION_1, + /* 0x02 */ PLAYER_CSACTION_2, + /* 0x03 */ PLAYER_CSACTION_3, + /* 0x04 */ PLAYER_CSACTION_4, + /* 0x05 */ PLAYER_CSACTION_5, + /* 0x06 */ PLAYER_CSACTION_6, + /* 0x07 */ PLAYER_CSACTION_7, + /* 0x08 */ PLAYER_CSACTION_8, + /* 0x09 */ PLAYER_CSACTION_9, + /* 0x0A */ PLAYER_CSACTION_10, + /* 0x0B */ PLAYER_CSACTION_11, + /* 0x0C */ PLAYER_CSACTION_12, + /* 0x0D */ PLAYER_CSACTION_13, + /* 0x0E */ PLAYER_CSACTION_14, + /* 0x0F */ PLAYER_CSACTION_15, + /* 0x10 */ PLAYER_CSACTION_16, + /* 0x11 */ PLAYER_CSACTION_17, + /* 0x12 */ PLAYER_CSACTION_18, + /* 0x13 */ PLAYER_CSACTION_19, + /* 0x14 */ PLAYER_CSACTION_20, + /* 0x15 */ PLAYER_CSACTION_21, + /* 0x16 */ PLAYER_CSACTION_22, + /* 0x17 */ PLAYER_CSACTION_23, + /* 0x18 */ PLAYER_CSACTION_24, + /* 0x19 */ PLAYER_CSACTION_25, + /* 0x1A */ PLAYER_CSACTION_26, + /* 0x1B */ PLAYER_CSACTION_27, + /* 0x1C */ PLAYER_CSACTION_28, + /* 0x1D */ PLAYER_CSACTION_29, + /* 0x1E */ PLAYER_CSACTION_30, + /* 0x1F */ PLAYER_CSACTION_31, + /* 0x20 */ PLAYER_CSACTION_32, + /* 0x21 */ PLAYER_CSACTION_33, + /* 0x22 */ PLAYER_CSACTION_34, + /* 0x23 */ PLAYER_CSACTION_35, + /* 0x24 */ PLAYER_CSACTION_36, + /* 0x25 */ PLAYER_CSACTION_37, + /* 0x26 */ PLAYER_CSACTION_38, + /* 0x27 */ PLAYER_CSACTION_39, + /* 0x28 */ PLAYER_CSACTION_40, + /* 0x29 */ PLAYER_CSACTION_41, + /* 0x2A */ PLAYER_CSACTION_42, + /* 0x2B */ PLAYER_CSACTION_43, + /* 0x2C */ PLAYER_CSACTION_44, + /* 0x2D */ PLAYER_CSACTION_45, + /* 0x2E */ PLAYER_CSACTION_46, + /* 0x2F */ PLAYER_CSACTION_47, + /* 0x30 */ PLAYER_CSACTION_48, + /* 0x31 */ PLAYER_CSACTION_49, + /* 0x32 */ PLAYER_CSACTION_50, + /* 0x33 */ PLAYER_CSACTION_51, + /* 0x34 */ PLAYER_CSACTION_52, + /* 0x35 */ PLAYER_CSACTION_53, + /* 0x36 */ PLAYER_CSACTION_54, + /* 0x37 */ PLAYER_CSACTION_55, + /* 0x38 */ PLAYER_CSACTION_56, + /* 0x39 */ PLAYER_CSACTION_57, + /* 0x3A */ PLAYER_CSACTION_58, + /* 0x3B */ PLAYER_CSACTION_59, + /* 0x3C */ PLAYER_CSACTION_60, + /* 0x3D */ PLAYER_CSACTION_61, + /* 0x3E */ PLAYER_CSACTION_62, + /* 0x3F */ PLAYER_CSACTION_63, + /* 0x40 */ PLAYER_CSACTION_64, + /* 0x41 */ PLAYER_CSACTION_65, + /* 0x42 */ PLAYER_CSACTION_66, + /* 0x43 */ PLAYER_CSACTION_67, + /* 0x44 */ PLAYER_CSACTION_68, + /* 0x45 */ PLAYER_CSACTION_69, + /* 0x46 */ PLAYER_CSACTION_70, + /* 0x47 */ PLAYER_CSACTION_71, + /* 0x48 */ PLAYER_CSACTION_72, + /* 0x49 */ PLAYER_CSACTION_73, + /* 0x4A */ PLAYER_CSACTION_74, + /* 0x4B */ PLAYER_CSACTION_75, + /* 0x4C */ PLAYER_CSACTION_76, + /* 0x4D */ PLAYER_CSACTION_77, + /* 0x4E */ PLAYER_CSACTION_78, + /* 0x4F */ PLAYER_CSACTION_79, + /* 0x50 */ PLAYER_CSACTION_80, + /* 0x51 */ PLAYER_CSACTION_81, + /* 0x52 */ PLAYER_CSACTION_82, + /* 0x53 */ PLAYER_CSACTION_83, + /* 0x54 */ PLAYER_CSACTION_84, + /* 0x55 */ PLAYER_CSACTION_85, + /* 0x56 */ PLAYER_CSACTION_86, + /* 0x57 */ PLAYER_CSACTION_87, + /* 0x58 */ PLAYER_CSACTION_88, + /* 0x59 */ PLAYER_CSACTION_89, + /* 0x5A */ PLAYER_CSACTION_90, + /* 0x5B */ PLAYER_CSACTION_91, + /* 0x5C */ PLAYER_CSACTION_92, + /* 0x5D */ PLAYER_CSACTION_93, + /* 0x5E */ PLAYER_CSACTION_94, + /* 0x5F */ PLAYER_CSACTION_95, + /* 0x60 */ PLAYER_CSACTION_96, + /* 0x61 */ PLAYER_CSACTION_97, + /* 0x62 */ PLAYER_CSACTION_98, + /* 0x63 */ PLAYER_CSACTION_99, + /* 0x64 */ PLAYER_CSACTION_100, + /* 0x65 */ PLAYER_CSACTION_101, + /* 0x66 */ PLAYER_CSACTION_102, + /* 0x67 */ PLAYER_CSACTION_MAX +} PlayerCsAction; + +typedef enum PlayerCueId { + /* 0x00 */ PLAYER_CUEID_NONE, + /* 0x01 */ PLAYER_CUEID_1, + /* 0x02 */ PLAYER_CUEID_2, + /* 0x03 */ PLAYER_CUEID_3, + /* 0x04 */ PLAYER_CUEID_4, + /* 0x05 */ PLAYER_CUEID_5, + /* 0x06 */ PLAYER_CUEID_6, + /* 0x07 */ PLAYER_CUEID_7, + /* 0x08 */ PLAYER_CUEID_8, + /* 0x09 */ PLAYER_CUEID_9, + /* 0x0A */ PLAYER_CUEID_10, + /* 0x0B */ PLAYER_CUEID_11, + /* 0x0C */ PLAYER_CUEID_12, + /* 0x0D */ PLAYER_CUEID_13, + /* 0x0E */ PLAYER_CUEID_14, + /* 0x0F */ PLAYER_CUEID_15, + /* 0x10 */ PLAYER_CUEID_16, + /* 0x11 */ PLAYER_CUEID_17, + /* 0x12 */ PLAYER_CUEID_18, + /* 0x13 */ PLAYER_CUEID_19, + /* 0x14 */ PLAYER_CUEID_20, + /* 0x15 */ PLAYER_CUEID_21, + /* 0x16 */ PLAYER_CUEID_22, + /* 0x17 */ PLAYER_CUEID_23, + /* 0x18 */ PLAYER_CUEID_24, + /* 0x19 */ PLAYER_CUEID_25, + /* 0x1A */ PLAYER_CUEID_26, + /* 0x1B */ PLAYER_CUEID_27, + /* 0x1C */ PLAYER_CUEID_28, + /* 0x1D */ PLAYER_CUEID_29, + /* 0x1E */ PLAYER_CUEID_30, + /* 0x1F */ PLAYER_CUEID_31, + /* 0x20 */ PLAYER_CUEID_32, + /* 0x21 */ PLAYER_CUEID_33, + /* 0x22 */ PLAYER_CUEID_34, + /* 0x23 */ PLAYER_CUEID_35, + /* 0x24 */ PLAYER_CUEID_36, + /* 0x25 */ PLAYER_CUEID_37, + /* 0x26 */ PLAYER_CUEID_38, + /* 0x27 */ PLAYER_CUEID_39, + /* 0x28 */ PLAYER_CUEID_40, + /* 0x29 */ PLAYER_CUEID_41, + /* 0x2A */ PLAYER_CUEID_42, + /* 0x2B */ PLAYER_CUEID_43, + /* 0x2C */ PLAYER_CUEID_44, + /* 0x2D */ PLAYER_CUEID_45, + /* 0x2E */ PLAYER_CUEID_46, + /* 0x2F */ PLAYER_CUEID_47, + /* 0x30 */ PLAYER_CUEID_48, + /* 0x31 */ PLAYER_CUEID_49, + /* 0x32 */ PLAYER_CUEID_50, + /* 0x33 */ PLAYER_CUEID_51, + /* 0x34 */ PLAYER_CUEID_52, + /* 0x35 */ PLAYER_CUEID_53, + /* 0x36 */ PLAYER_CUEID_54, + /* 0x37 */ PLAYER_CUEID_55, + /* 0x38 */ PLAYER_CUEID_56, + /* 0x39 */ PLAYER_CUEID_57, + /* 0x3A */ PLAYER_CUEID_58, + /* 0x3B */ PLAYER_CUEID_59, + /* 0x3C */ PLAYER_CUEID_60, + /* 0x3D */ PLAYER_CUEID_61, + /* 0x3E */ PLAYER_CUEID_62, + /* 0x3F */ PLAYER_CUEID_63, + /* 0x40 */ PLAYER_CUEID_64, + /* 0x41 */ PLAYER_CUEID_65, + /* 0x42 */ PLAYER_CUEID_66, + /* 0x43 */ PLAYER_CUEID_67, + /* 0x44 */ PLAYER_CUEID_68, + /* 0x45 */ PLAYER_CUEID_69, + /* 0x46 */ PLAYER_CUEID_70, + /* 0x47 */ PLAYER_CUEID_71, + /* 0x48 */ PLAYER_CUEID_72, + /* 0x49 */ PLAYER_CUEID_73, + /* 0x4A */ PLAYER_CUEID_74, + /* 0x4B */ PLAYER_CUEID_75, + /* 0x4C */ PLAYER_CUEID_76, + /* 0x4D */ PLAYER_CUEID_77, + /* 0x4E */ PLAYER_CUEID_MAX +} PlayerCueId; + +typedef enum PlayerLedgeClimbType { + /* 0 */ PLAYER_LEDGE_CLIMB_NONE, + /* 1 */ PLAYER_LEDGE_CLIMB_1, + /* 2 */ PLAYER_LEDGE_CLIMB_2, + /* 3 */ PLAYER_LEDGE_CLIMB_3, + /* 4 */ PLAYER_LEDGE_CLIMB_4 +} PlayerLedgeClimbType; + +typedef enum PlayerStickDirection { + /* -1 */ PLAYER_STICK_DIR_NONE = -1, + /* 0 */ PLAYER_STICK_DIR_FORWARD, + /* 1 */ PLAYER_STICK_DIR_LEFT, + /* 2 */ PLAYER_STICK_DIR_BACKWARD, + /* 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; /* 0x08 */ f32 unk_08; @@ -380,7 +607,7 @@ typedef struct { /* 0xCC */ LinkAnimationHeader* unk_CC[2]; } PlayerAgeProperties; // size = 0xD4 -typedef struct { +typedef struct WeaponInfo { /* 0x00 */ s32 active; /* 0x04 */ Vec3f tip; /* 0x10 */ Vec3f base; @@ -389,7 +616,7 @@ typedef struct { // #region SOH [General] // Supporting pendingFlag // Upstream TODO: Rename these to be more obviously SoH specific -typedef enum { +typedef enum FlagType { FLAG_NONE, FLAG_SCENE_SWITCH, FLAG_SCENE_TREASURE, @@ -403,47 +630,47 @@ typedef enum { FLAG_GS_TOKEN, } FlagType; -typedef struct { +typedef struct PendingFlag { /* 0x00 */ s32 flagID; // which flag to set when Player_SetPendingFlag is called /* 0x04 */ FlagType flagType; // type of flag to set when Player_SetPendingFlag is called } PendingFlag; // size = 0x06 // #endregion #define PLAYER_STATE1_LOADING (1 << 0) //Transitioning to a new scene -#define PLAYER_STATE1_SWINGING_BOTTLE (1 << 1) +#define PLAYER_STATE1_SWINGING_BOTTLE (1 << 1) // Bottle is swung; Bottle is active and can catch things #define PLAYER_STATE1_HOOKSHOT_FALLING (1 << 2) #define PLAYER_STATE1_ITEM_IN_HAND (1 << 3) -#define PLAYER_STATE1_ENEMY_TARGET (1 << 4) +#define PLAYER_STATE1_HOSTILE_LOCK_ON (1 << 4) // Currently locked onto a hostile actor. Triggers a "battle" variant of many actions. #define PLAYER_STATE1_INPUT_DISABLED (1 << 5) -#define PLAYER_STATE1_TEXT_ON_SCREEN (1 << 6) -#define PLAYER_STATE1_DEAD (1 << 7) -#define PLAYER_STATE1_START_PUTAWAY (1 << 8) +#define PLAYER_STATE1_TALKING (1 << 6) // Currently talking to an actor. This includes item exchanges. +#define PLAYER_STATE1_DEAD (1 << 7) // Player has died. Note that this gets set when the death cutscene has started, after landing from the air. +#define PLAYER_STATE1_START_CHANGING_HELD_ITEM (1 << 8) // Item change process has begun #define PLAYER_STATE1_READY_TO_FIRE (1 << 9) #define PLAYER_STATE1_GETTING_ITEM (1 << 10) -#define PLAYER_STATE1_ITEM_OVER_HEAD (1 << 11) -#define PLAYER_STATE1_CHARGING_SPIN_ATTACK (1 << 12) +#define PLAYER_STATE1_CARRYING_ACTOR (1 << 11) // Currently carrying an actor +#define PLAYER_STATE1_CHARGING_SPIN_ATTACK (1 << 12) // Currently charing a spin attack (by holding down the B button) #define PLAYER_STATE1_HANGING_OFF_LEDGE (1 << 13) -#define PLAYER_STATE1_CLIMBING_LEDGE (1 << 14) -#define PLAYER_STATE1_TARGETING (1 << 15) -#define PLAYER_STATE1_TARGET_LOCKED (1 << 16) -#define PLAYER_STATE1_TARGET_NOTHING (1 << 17) +#define PLAYER_STATE1_CLIMBING_LEDGE (1 << 14) +#define PLAYER_STATE1_Z_TARGETING (1 << 15) // Either lock-on or parallel is active. This flag is never checked for and is practically unused. +#define PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS (1 << 16) // Currently focusing on a friendly actor. Includes friendly lock-on, talking, and more. Usually does not include hostile actor lock-on, see `PLAYER_STATE1_HOSTILE_LOCK_ON`. +#define PLAYER_STATE1_PARALLEL (1 << 17) // "Parallel" mode, Z-Target without an actor lock-on #define PLAYER_STATE1_JUMPING (1 << 18) #define PLAYER_STATE1_FREEFALL (1 << 19) #define PLAYER_STATE1_FIRST_PERSON (1 << 20) #define PLAYER_STATE1_CLIMBING_LADDER (1 << 21) #define PLAYER_STATE1_SHIELDING (1 << 22) #define PLAYER_STATE1_ON_HORSE (1 << 23) -#define PLAYER_STATE1_BOOMERANG_IN_HAND (1 << 24) -#define PLAYER_STATE1_THREW_BOOMERANG (1 << 25) +#define PLAYER_STATE1_USING_BOOMERANG (1 << 24) // Currently using the boomerang. This includes all phases (aiming, throwing, and catching). +#define PLAYER_STATE1_BOOMERANG_THROWN (1 << 25) // Boomerang has been thrown and is flying in the air #define PLAYER_STATE1_DAMAGED (1 << 26) #define PLAYER_STATE1_IN_WATER (1 << 27) #define PLAYER_STATE1_IN_ITEM_CS (1 << 28) #define PLAYER_STATE1_IN_CUTSCENE (1 << 29) -#define PLAYER_STATE1_30 (1 << 30) //Unknown, potentially target related? +#define PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE (1 << 30) // Lock-on was released automatically, for example by leaving the lock-on leash range #define PLAYER_STATE1_FLOOR_DISABLED (1 << 31) //Used for grottos #define PLAYER_STATE2_DO_ACTION_GRAB (1 << 0) -#define PLAYER_STATE2_SPEAK_OR_CHECK (1 << 1) +#define PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER (1 << 1) // Can accept a talk offer. "Speak" or "Check" is shown on the A button. #define PLAYER_STATE2_DO_ACTION_CLIMB (1 << 2) #define PLAYER_STATE2_FOOTSTEP (1 << 3) #define PLAYER_STATE2_MOVING_DYNAPOLY (1 << 4) @@ -451,18 +678,18 @@ typedef struct { #define PLAYER_STATE2_DISABLE_ROTATION_ALWAYS (1 << 6) #define PLAYER_STATE2_GRABBED_BY_ENEMY (1 << 7) #define PLAYER_STATE2_GRABBING_DYNAPOLY (1 << 8) -#define PLAYER_STATE2_SPAWN_DUST (1 << 9) +#define PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND (1 << 9) // Forces sand footstep sounds regardless of current floor type #define PLAYER_STATE2_UNDERWATER (1 << 10) #define PLAYER_STATE2_DIVING (1 << 11) #define PLAYER_STATE2_STATIONARY_LADDER (1 << 12) -#define PLAYER_STATE2_SWITCH_TARGETING (1 << 13) +#define PLAYER_STATE2_LOCK_ON_WITH_SWITCH (1 << 13) // Actor lock-on is active, specifically with Switch Targeting. Hold Targeting checks the state of the Z button instead of this flag. #define PLAYER_STATE2_FROZEN (1 << 14) #define PLAYER_STATE2_PAUSE_MOST_UPDATING (1 << 15) -#define PLAYER_STATE2_DO_ACTION_ENTER (1 << 16) // Turns on the "Enter On A" DoAction +#define PLAYER_STATE2_DO_ACTION_ENTER (1 << 16) // Sets the "Enter On A" DoAction #define PLAYER_STATE2_SPIN_ATTACKING (1 << 17) //w/o magic #define PLAYER_STATE2_CRAWLING (1 << 18) // Crawling through a crawlspace #define PLAYER_STATE2_HOPPING (1 << 19) //Sidehop/backflip -#define PLAYER_STATE2_NAVI_OUT (1 << 20) +#define PLAYER_STATE2_NAVI_ACTIVE (1 << 20) // Navi is visible and active. Could be hovering idle near Link or hovering over other actors. #define PLAYER_STATE2_NAVI_ALERT (1 << 21) #define PLAYER_STATE2_DO_ACTION_DOWN (1 << 22) #define PLAYER_STATE2_NEAR_OCARINA_ACTOR (1 << 23) @@ -470,7 +697,7 @@ typedef struct { #define PLAYER_STATE2_PLAY_FOR_ACTOR (1 << 25) #define PLAYER_STATE2_REFLECTION (1 << 26) //Handles Dark Link's Reflection #define PLAYER_STATE2_OCARINA_PLAYING (1 << 27) -#define PLAYER_STATE2_IDLING (1 << 28) +#define PLAYER_STATE2_IDLE_FIDGET (1 << 28) // Playing a fidget idle animation (under typical circumstances, see `Player_ChooseNextIdleAnim` for more info) #define PLAYER_STATE2_DISABLE_DRAW (1 << 29) #define PLAYER_STATE2_SWORD_LUNGE (1 << 30) #define PLAYER_STATE2_FORCED_VOID_OUT (1 << 31) @@ -480,13 +707,23 @@ typedef struct { #define PLAYER_STATE3_PAUSE_ACTION_FUNC (1 << 2) #define PLAYER_STATE3_FINISHED_ATTACKING (1 << 3) #define PLAYER_STATE3_CHECK_FLOOR_WATER_COLLISION (1 << 4) -#define PLAYER_STATE3_FORCE_PULL_OCARINA (1 << 5) +#define PLAYER_STATE3_FORCE_PULL_OCARINA (1 << 5) #define PLAYER_STATE3_RESTORE_NAYRUS_LOVE (1 << 6) // Set by ocarina effects actors when destroyed to signal Nayru's Love may be restored (see `ACTOROVL_ALLOC_ABSOLUTE`) -#define PLAYER_STATE3_HOOKSHOT_TRAVELLING (1 << 7) //Travelling to target +#define PLAYER_STATE3_FLYING_WITH_HOOKSHOT (1 << 7) // Flying in the air with the hookshot as it pulls Player toward its destination typedef void (*PlayerActionFunc)(struct Player*, struct PlayState*); typedef s32 (*UpperActionFunc)(struct Player*, struct PlayState*); -typedef void (*PlayerFuncA74)(struct PlayState*, struct Player*); +typedef void (*AfterPutAwayFunc)(struct PlayState*, struct Player*); + +#define UNK6AE_ROT_FOCUS_X (1 << 0) +#define UNK6AE_ROT_FOCUS_Y (1 << 1) +#define UNK6AE_ROT_FOCUS_Z (1 << 2) +#define UNK6AE_ROT_HEAD_X (1 << 3) +#define UNK6AE_ROT_HEAD_Y (1 << 4) +#define UNK6AE_ROT_HEAD_Z (1 << 5) +#define UNK6AE_ROT_UPPER_X (1 << 6) +#define UNK6AE_ROT_UPPER_Y (1 << 7) +#define UNK6AE_ROT_UPPER_Z (1 << 8) typedef struct Player { /* 0x0000 */ Actor actor; @@ -547,71 +784,76 @@ typedef struct Player { /* 0x0450 */ Vec3f unk_450; /* 0x045C */ Vec3f unk_45C; /* 0x0468 */ char unk_468[0x002]; - /* 0x046A */ s16 doorBgCamIndex; + /* 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 /* 0x046C */ s16 subCamId; /* 0x046E */ char unk_46E[0x02A]; /* 0x0498 */ ColliderCylinder cylinder; /* 0x04E4 */ ColliderQuad meleeWeaponQuads[2]; /* 0x05E4 */ ColliderQuad shieldQuad; - /* 0x0664 */ Actor* unk_664; + /* 0x0664 */ Actor* focusActor; // Actor that Player and the camera are looking at; Used for lock-on, talking, and more /* 0x0668 */ char unk_668[0x004]; - /* 0x066C */ s32 unk_66C; + /* 0x066C */ s32 zTargetActiveTimer; // Non-zero values indicate Z-Targeting should update; Values under 5 indicate lock-on is releasing /* 0x0670 */ s32 meleeWeaponEffectIndex; /* 0x0674 */ PlayerActionFunc actionFunc; /* 0x0678 */ PlayerAgeProperties* ageProperties; /* 0x067C */ u32 stateFlags1; /* 0x0680 */ u32 stateFlags2; - /* 0x0684 */ Actor* unk_684; + /* 0x0684 */ Actor* autoLockOnActor; // Actor that is locked onto automatically without player input; see `Player_SetAutoLockOnActor` /* 0x0688 */ Actor* boomerangActor; /* 0x068C */ Actor* naviActor; /* 0x0690 */ s16 naviTextId; /* 0x0692 */ u8 stateFlags3; /* 0x0693 */ s8 exchangeItemId; - /* 0x0694 */ Actor* targetActor; - /* 0x0698 */ f32 targetActorDistance; + /* 0x0694 */ Actor* talkActor; // Actor offering to talk, or currently talking to, depending on context + /* 0x0698 */ f32 talkActorDistance; // xz distance away from `talkActor` /* 0x069C */ char unk_69C[0x004]; /* 0x06A0 */ f32 unk_6A0; /* 0x06A4 */ f32 closestSecretDistSq; /* 0x06A8 */ Actor* unk_6A8; - /* 0x06AC */ s8 unk_6AC; + /* 0x06AC */ s8 idleType; /* 0x06AD */ u8 unk_6AD; - /* 0x06AE */ u16 unk_6AE; - /* 0x06B0 */ s16 unk_6B0; + /* 0x06AE */ u16 unk_6AE_rotFlags; // See `UNK6AE_ROT_` macros. If its flag isn't set, a rot steps to 0. + /* 0x06B0 */ s16 upperLimbYawSecondary; /* 0x06B2 */ char unk_6B4[0x004]; - /* 0x06B6 */ s16 unk_6B6; - /* 0x06B8 */ s16 unk_6B8; - /* 0x06BA */ s16 unk_6BA; - /* 0x06BC */ s16 unk_6BC; - /* 0x06BE */ s16 unk_6BE; - /* 0x06C0 */ s16 unk_6C0; + /* 0x06B6 */ Vec3s headLimbRot; + /* 0x06BC */ Vec3s upperLimbRot; /* 0x06C2 */ s16 unk_6C2; /* 0x06C4 */ f32 unk_6C4; /* 0x06C8 */ SkelAnime upperSkelAnime; /* 0x070C */ Vec3s upperJointTable[PLAYER_LIMB_BUF_COUNT]; /* 0x079C */ Vec3s upperMorphTable[PLAYER_LIMB_BUF_COUNT]; /* 0x082C */ UpperActionFunc upperActionFunc; - /* 0x0830 */ f32 upperAnimBlendWeight; + /* 0x0830 */ f32 upperAnimInterpWeight; /* 0x0834 */ s16 unk_834; /* 0x0836 */ s8 unk_836; - /* 0x0837 */ u8 unk_837; - /* 0x0838 */ f32 linearVelocity; + /* 0x0837 */ u8 putAwayCooldownTimer; + /* 0x0838 */ f32 linearVelocity; // Controls horizontal speed, used for `actor.speed`. Current or target value depending on context. /* 0x083C */ s16 yaw; // General yaw value, used both for world and shape rotation. Current or target value depending on context. - /* 0x083E */ s16 zTargetYaw; // yaw relating to Z targeting/"parallel" mode + /* 0x083E */ s16 parallelYaw; // yaw in "parallel" mode, Z-Target without an actor lock-on /* 0x0840 */ u16 underwaterTimer; /* 0x0842 */ s8 meleeWeaponAnimation; /* 0x0843 */ s8 meleeWeaponState; /* 0x0844 */ s8 unk_844; /* 0x0845 */ u8 unk_845; - /* 0x0846 */ u8 unk_846; - /* 0x0847 */ s8 unk_847[4]; - /* 0x084B */ s8 unk_84B[4]; + /* 0x0846 */ u8 controlStickDataIndex; // cycles between 0 - 3. Used to index `controlStickSpinAngles` and `controlStickDirections` + /* 0x0847 */ s8 controlStickSpinAngles[4]; // Stores a modified version of the control stick angle for the last 4 frames. Used for checking spins. + /* 0x084B */ s8 controlStickDirections[4]; // Stores the control stick direction (relative to shape yaw) for the last 4 frames. See `PlayerStickDirection`. /* 0x084F */ union { s8 actionVar1; + s8 facingUpSlope; // Player_Action_SlideOnSlope: facing uphill when sliding on a slope + s8 bottleCatchType; // Player_Action_SwingBottle: entry type for `sBottleCatchInfo`, corresponds to actor caught in a bottle } av1; // "Action Variable 1": context dependent variable that has different meanings depending on what action is currently running /* 0x0850 */ union { s16 actionVar2; + s16 fallDamageStunTimer; // Player_Action_Idle: Prevents any movement and shakes model up and down quickly to indicate fall damage stun + s16 bonked; // Player_Action_Roll: set to true after bonking into a wall or an actor + s16 startedTextbox; // Player_Action_SwingBottle: set to true when the textbox is started + s16 inWater; // Player_Action_SwingBottle: true if a bottle is swung in water. Used to determine which bottle swing animation to use. } av2; // "Action Variable 2": context dependent variable that has different meanings depending on what action is currently running /* 0x0854 */ f32 unk_854; @@ -626,14 +868,14 @@ typedef struct Player { /* 0x0874 */ f32 unk_874; /* 0x0878 */ f32 unk_878; /* 0x087C */ s16 unk_87C; - /* 0x087E */ s16 unk_87E; + /* 0x087E */ s16 turnRate; // Amount angle is changed every frame when turning in place /* 0x0880 */ f32 unk_880; /* 0x0884 */ f32 yDistToLedge; // y distance to ground above an interact wall. LEDGE_DIST_MAX if no ground is found /* 0x0888 */ f32 distToInteractWall; // xyz distance to the interact wall /* 0x088C */ u8 ledgeClimbType; /* 0x088D */ u8 ledgeClimbDelayTimer; - /* 0x088E */ u8 unk_88E; - /* 0x088F */ u8 unk_88F; + /* 0x088E */ u8 textboxBtnCooldownTimer; // Prevents usage of A/B/C-up when counting down + /* 0x088F */ u8 damageFlickerAnimCounter; // Used to flicker Link after taking damage /* 0x0890 */ u8 unk_890; /* 0x0891 */ u8 bodyShockTimer; /* 0x0892 */ u8 unk_892; @@ -644,11 +886,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]; @@ -658,8 +900,8 @@ typedef struct Player { /* 0x0A60 */ u8 bodyIsBurning; /* 0x0A61 */ u8 bodyFlameTimers[PLAYER_BODYPART_MAX]; // one flame per body part /* 0x0A73 */ u8 unk_A73; - /* 0x0A74 */ PlayerFuncA74 func_A74; - /* 0x0A78 */ s8 invincibilityTimer; // prevents damage when nonzero (positive = visible, counts towards zero each frame) + /* 0x0A74 */ AfterPutAwayFunc afterPutAwayFunc; // See `Player_SetupWaitForPutAway` and `Player_Action_WaitForPutAway` + /* 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; @@ -678,9 +920,9 @@ typedef struct Player { // #region SOH [Enhancements] // Upstream TODO: Rename this to make it more obvious it is apart of an enhancement /* */ u8 boomerangQuickRecall; // Has the player pressed the boomerang button while it's in the air still? + /* */ u8 ivanFloating; + /* */ u8 ivanDamageMultiplier; // #endregion - u8 ivanFloating; - u8 ivanDamageMultiplier; } Player; // size = 0xA94 #endif diff --git a/soh/soh/Enhancements/debugger/actorViewer.cpp b/soh/soh/Enhancements/debugger/actorViewer.cpp index 84ecd5ff0..bea2d5b87 100644 --- a/soh/soh/Enhancements/debugger/actorViewer.cpp +++ b/soh/soh/Enhancements/debugger/actorViewer.cpp @@ -1060,7 +1060,7 @@ void ActorViewerWindow::DrawElement() { if (ImGui::Button("Fetch from Target")) { Player* player = GET_PLAYER(gPlayState); - fetch = player->targetActor; + fetch = player->talkActor; if (fetch != NULL) { display = fetch; category = fetch->category; diff --git a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp index ffe192f68..a5126d32e 100644 --- a/soh/soh/Enhancements/debugger/debugSaveEditor.cpp +++ b/soh/soh/Enhancements/debugger/debugSaveEditor.cpp @@ -613,8 +613,8 @@ void DrawFlagsTab() { ImGui::SameLine(); DrawGroupWithBorder([&]() { - ImGui::Text("unk_6AE"); - UIWidgets::DrawFlagArray16("unk_6AE", player->unk_6AE); + ImGui::Text("unk_6AE_rotFlags"); + UIWidgets::DrawFlagArray16("unk_6AE_rotFlags", player->unk_6AE_rotFlags); }); } ImGui::TreePop(); diff --git a/soh/soh/Enhancements/randomizer/hook_handlers.cpp b/soh/soh/Enhancements/randomizer/hook_handlers.cpp index b03b5a3c8..aefb5775f 100644 --- a/soh/soh/Enhancements/randomizer/hook_handlers.cpp +++ b/soh/soh/Enhancements/randomizer/hook_handlers.cpp @@ -50,8 +50,8 @@ extern "C" { extern SaveContext gSaveContext; extern PlayState* gPlayState; extern void func_8084DFAC(PlayState* play, Player* player); -extern void func_80835DAC(PlayState* play, Player* player, PlayerActionFunc actionFunc, s32 flags); -extern s32 func_80836898(PlayState* play, Player* player, PlayerFuncA74 func); +extern void Player_SetupActionPreserveAnimMovement(PlayState* play, Player* player, PlayerActionFunc actionFunc, s32 flags); +extern s32 Player_SetupWaitForPutAway(PlayState* play, Player* player, AfterPutAwayFunc func); } #define RAND_GET_OPTION(option) Rando::Context::GetInstance()->GetOption(option).GetSelectedOptionIndex() @@ -252,7 +252,7 @@ void RandomizerOnPlayerUpdateForRCQueueHandler() { // If we're in a cutscene, don't queue Player* player = GET_PLAYER(gPlayState); - if (Player_InBlockingCsMode(gPlayState, player) || player->stateFlags1 & PLAYER_STATE1_IN_ITEM_CS || player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM || player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + if (Player_InBlockingCsMode(gPlayState, player) || player->stateFlags1 & PLAYER_STATE1_IN_ITEM_CS || player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM || player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { return; } @@ -297,7 +297,7 @@ void RandomizerOnPlayerUpdateForItemQueueHandler() { if (randomizerQueuedCheck == RC_UNKNOWN_CHECK) return; Player* player = GET_PLAYER(gPlayState); - if (player == NULL || Player_InBlockingCsMode(gPlayState, player) || player->stateFlags1 & PLAYER_STATE1_IN_ITEM_CS || player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM || player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + if (player == NULL || Player_InBlockingCsMode(gPlayState, player) || player->stateFlags1 & PLAYER_STATE1_IN_ITEM_CS || player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM || player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { return; } @@ -306,7 +306,7 @@ void RandomizerOnPlayerUpdateForItemQueueHandler() { if (player->stateFlags1 & PLAYER_STATE1_IN_WATER) { // Allow the player to receive the item while swimming player->stateFlags2 |= PLAYER_STATE2_UNDERWATER; - Player_ActionChange_2(player, gPlayState); + Player_ActionHandler_2(player, gPlayState); } } @@ -342,7 +342,7 @@ void RandomizerOnItemReceiveHandler(GetItemEntry receivedItemEntry) { static uint32_t updateHook; updateHook = GameInteractor::Instance->RegisterGameHook([]() { Player* player = GET_PLAYER(gPlayState); - if (player == NULL || Player_InBlockingCsMode(gPlayState, player) || player->stateFlags1 & PLAYER_STATE1_IN_ITEM_CS || player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM || player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + if (player == NULL || Player_InBlockingCsMode(gPlayState, player) || player->stateFlags1 & PLAYER_STATE1_IN_ITEM_CS || player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM || player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { return; } @@ -604,7 +604,7 @@ void Player_Action_8084E6D4_override(Player* player, PlayState* play) { } void func_8083A434_override(PlayState* play, Player* player) { - func_80835DAC(play, player, Player_Action_8084E6D4_override, 0); + Player_SetupActionPreserveAnimMovement(play, player, Player_Action_8084E6D4_override, 0); player->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_IN_CUTSCENE; } @@ -643,7 +643,7 @@ void RandomizerOnVanillaBehaviorHandler(GIVanillaBehavior id, bool* should, va_l RandomizerSetChestGameRandomizerInf(rc); Player* player = GET_PLAYER(gPlayState); - func_80836898(gPlayState, player, func_8083A434_override); + Player_SetupWaitForPutAway(gPlayState, player, func_8083A434_override); *should = false; break; diff --git a/soh/soh/Enhancements/timesaver_hook_handlers.cpp b/soh/soh/Enhancements/timesaver_hook_handlers.cpp index fbe3dbee4..317c751a3 100644 --- a/soh/soh/Enhancements/timesaver_hook_handlers.cpp +++ b/soh/soh/Enhancements/timesaver_hook_handlers.cpp @@ -991,7 +991,7 @@ void TimeSaverOnPlayerUpdateHandler() { if (vanillaQueuedItemEntry.itemId == ITEM_NONE) return; Player* player = GET_PLAYER(gPlayState); - if (player == NULL || Player_InBlockingCsMode(gPlayState, player) || player->stateFlags1 & PLAYER_STATE1_IN_ITEM_CS || player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM || player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + if (player == NULL || Player_InBlockingCsMode(gPlayState, player) || player->stateFlags1 & PLAYER_STATE1_IN_ITEM_CS || player->stateFlags1 & PLAYER_STATE1_GETTING_ITEM || player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { return; } @@ -1000,7 +1000,7 @@ void TimeSaverOnPlayerUpdateHandler() { if (player->stateFlags1 & PLAYER_STATE1_IN_WATER) { // Allow the player to receive the item while swimming player->stateFlags2 |= PLAYER_STATE2_UNDERWATER; - Player_ActionChange_2(player, gPlayState); + Player_ActionHandler_2(player, gPlayState); } } diff --git a/soh/soh/OTRGlobals.cpp b/soh/soh/OTRGlobals.cpp index e019654a5..0563ebe39 100644 --- a/soh/soh/OTRGlobals.cpp +++ b/soh/soh/OTRGlobals.cpp @@ -2588,7 +2588,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { Player_GetMask(play) == PLAYER_MASK_TRUTH) || (Randomizer_GetSettingValue(RSK_GOSSIP_STONE_HINTS) == RO_GOSSIP_STONES_NEED_STONE && CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)))) { - Actor* stone = GET_PLAYER(play)->targetActor; + Actor* stone = GET_PLAYER(play)->talkActor; RandomizerHint stoneHint = RH_NONE; s16 hintParams = stone->params & 0xFF; @@ -2642,7 +2642,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(rc, TEXT_SHOP_ITEM_RANDOM_CONFIRM); // textId: TEXT_SCRUB_RANDOM + (randomizerInf - RAND_INF_SCRUBS_PURCHASED_DODONGOS_CAVERN_DEKU_SCRUB_NEAR_BOMB_BAG_LEFT) } else if (textId == TEXT_SCRUB_RANDOM) { - EnDns* enDns = (EnDns*)GET_PLAYER(play)->targetActor; + EnDns* enDns = (EnDns*)GET_PLAYER(play)->talkActor; RandomizerCheck rc = OTRGlobals::Instance->gRandomizer->GetCheckFromRandomizerInf((RandomizerInf)enDns->sohScrubIdentity.randomizerInf); messageEntry = OTRGlobals::Instance->gRandomizer->GetMerchantMessage(rc, TEXT_SCRUB_RANDOM, TEXT_SCRUB_RANDOM_FREE, Randomizer_GetSettingValue(RSK_SCRUB_TEXT_HINT) == RO_GENERIC_OFF); } else if (CVarGetInteger(CVAR_RANDOMIZER_ENHANCEMENT("RandomizeRupeeNames"), 1) && @@ -2679,7 +2679,7 @@ extern "C" int CustomMessage_RetrieveIfExists(PlayState* play) { else if (textId == TEXT_CARPET_SALESMAN_ARMS_DEALER){ messageEntry = CustomMessageManager::Instance->RetrieveMessage(Randomizer::merchantMessageTableID, textId, MF_AUTO_FORMAT); } else if (textId == TEXT_SKULLTULA_PEOPLE_IM_CURSED) { - actorParams = GET_PLAYER(play)->targetActor->params; + actorParams = GET_PLAYER(play)->talkActor->params; if (actorParams == 1 && ctx->GetOption(RSK_KAK_10_SKULLS_HINT)){ messageEntry = ctx->GetHint(RH_KAK_10_SKULLS_HINT)->GetHintMessage(MF_AUTO_FORMAT); } else if (actorParams == 2 && ctx->GetOption(RSK_KAK_20_SKULLS_HINT)){ diff --git a/soh/src/code/z_actor.c b/soh/src/code/z_actor.c index 7c3914095..b9616a44a 100644 --- a/soh/src/code/z_actor.c +++ b/soh/src/code/z_actor.c @@ -486,7 +486,7 @@ void func_8002C124(TargetContext* targetCtx, PlayState* play) { func_8002BE64(targetCtx, targetCtx->unk_4C, spBC.x, spBC.y, spBC.z); - if ((!(player->stateFlags1 & PLAYER_STATE1_TEXT_ON_SCREEN)) || (actor != player->unk_664)) { + if ((!(player->stateFlags1 & PLAYER_STATE1_TALKING)) || (actor != player->focusActor)) { OVERLAY_DISP = Gfx_SetupDL(OVERLAY_DISP, 0x39); for (spB0 = 0, spAC = targetCtx->unk_4C; spB0 < spB8; spB0++, spAC = (spAC + 1) % 3) { @@ -564,7 +564,7 @@ void func_8002C7BC(TargetContext* targetCtx, Player* player, Actor* actorArg, Pl unkActor = NULL; - if ((player->unk_664 != NULL) && (player->unk_84B[player->unk_846] == 2)) { + if ((player->focusActor != NULL) && (player->controlStickDirections[player->controlStickDataIndex] == 2)) { targetCtx->unk_94 = NULL; } else { func_80032AF0(play, &play->actorCtx, &unkActor, player); @@ -1397,7 +1397,7 @@ s32 func_8002DD78(Player* player) { s32 func_8002DDA8(PlayState* play) { Player* player = GET_PLAYER(play); - return (player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) || func_8002DD78(player); + return (player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) || func_8002DD78(player); } s32 func_8002DDE4(PlayState* play) { @@ -1448,7 +1448,7 @@ s32 func_8002DF38(PlayState* play, Actor* actor, u8 csAction) { player->csAction = csAction; player->csActor = actor; - player->doorBgCamIndex = 0; + player->cv.haltActorsDuringCsAction = false; return true; } @@ -1457,7 +1457,7 @@ s32 Player_SetCsActionWithHaltedActors(PlayState* play, Actor* actor, u8 csActio Player* player = GET_PLAYER(play); func_8002DF38(play, actor, csAction); - player->doorBgCamIndex = 1; + player->cv.haltActorsDuringCsAction = true; return true; } @@ -1854,7 +1854,7 @@ f32 func_8002EFC0(Actor* actor, Player* player, s16 arg2) { s16 yawTemp = (s16)(actor->yawTowardsPlayer - 0x8000) - arg2; s16 yawTempAbs = ABS(yawTemp); - if (player->unk_664 != NULL) { + if (player->focusActor != NULL) { if ((yawTempAbs > 0x4000) || (actor->flags & ACTOR_FLAG_NO_LOCKON)) { return FLT_MAX; } else { @@ -1900,7 +1900,7 @@ s32 func_8002F0C8(Actor* actor, Player* player, s32 flag) { s16 abs_var = ABS(var); f32 dist; - if ((player->unk_664 == NULL) && (abs_var > 0x2AAA)) { + if ((player->focusActor == NULL) && (abs_var > 0x2AAA)) { dist = FLT_MAX; } else { dist = actor->xyzDistToPlayerSq; @@ -1927,13 +1927,13 @@ s32 func_8002F1C4(Actor* actor, PlayState* play, f32 arg2, f32 arg3, u32 exchang // This is convoluted but it seems like it must be a single if statement to match if ((player->actor.flags & ACTOR_FLAG_PLAYER_TALKED_TO) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(play)) || (!actor->isTargeted && - ((arg3 < fabsf(actor->yDistToPlayer)) || (player->targetActorDistance < actor->xzDistToPlayer) || + ((arg3 < fabsf(actor->yDistToPlayer)) || (player->talkActorDistance < actor->xzDistToPlayer) || (arg2 < actor->xzDistToPlayer)))) { return false; } - player->targetActor = actor; - player->targetActorDistance = actor->xzDistToPlayer; + player->talkActor = actor; + player->talkActorDistance = actor->xzDistToPlayer; player->exchangeItemId = exchangeItemId; return true; @@ -2002,7 +2002,7 @@ s32 GiveItemEntryWithoutActor(PlayState* play, GetItemEntry getItemEntry) { Player_GetExplosiveHeld(player) < 0) { if (((player->heldActor != NULL) && ((getItemEntry.getItemId > GI_NONE) && (getItemEntry.getItemId < GI_MAX)) || (IS_RANDO && (getItemEntry.getItemId > RG_NONE) && (getItemEntry.getItemId < RG_MAX))) || - (!(player->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE)))) { + (!(player->stateFlags1 & (PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_IN_CUTSCENE)))) { if ((getItemEntry.getItemId != GI_NONE)) { player->getItemEntry = getItemEntry; player->getItemId = getItemEntry.getItemId; @@ -2039,10 +2039,10 @@ s32 GiveItemEntryFromActor(Actor* actor, PlayState* play, GetItemEntry getItemEn (PLAYER_STATE1_DEAD | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_FIRST_PERSON | PLAYER_STATE1_CLIMBING_LADDER)) && Player_GetExplosiveHeld(player) < 0) { - if ((((player->heldActor != NULL) || (actor == player->targetActor)) && + if ((((player->heldActor != NULL) || (actor == player->talkActor)) && ((!IS_RANDO && ((getItemEntry.getItemId > GI_NONE) && (getItemEntry.getItemId < GI_MAX))) || (IS_RANDO && ((getItemEntry.getItemId > RG_NONE) && (getItemEntry.getItemId < RG_MAX))))) || - (!(player->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE)))) { + (!(player->stateFlags1 & (PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_IN_CUTSCENE)))) { if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) { s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y; s32 absYawDiff = ABS(yawDiff); @@ -2083,9 +2083,9 @@ s32 Actor_OfferGetItem(Actor* actor, PlayState* play, s32 getItemId, f32 xzRange (PLAYER_STATE1_DEAD | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_FIRST_PERSON | PLAYER_STATE1_CLIMBING_LADDER)) && Player_GetExplosiveHeld(player) < 0) { - if ((((player->heldActor != NULL) || (actor == player->targetActor)) && + if ((((player->heldActor != NULL) || (actor == player->talkActor)) && ((!IS_RANDO && ((getItemId > GI_NONE) && (getItemId < GI_MAX))) || (IS_RANDO && ((getItemId > RG_NONE) && (getItemId < RG_MAX))))) || - (!(player->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE)))) { + (!(player->stateFlags1 & (PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_IN_CUTSCENE)))) { if ((actor->xzDistToPlayer < xzRange) && (fabsf(actor->yDistToPlayer) < yRange)) { s16 yawDiff = actor->yawTowardsPlayer - player->actor.shape.rot.y; s32 absYawDiff = ABS(yawDiff); @@ -2156,7 +2156,7 @@ u32 Actor_SetRideActor(PlayState* play, Actor* horse, s32 mountSide) { Player* player = GET_PLAYER(play); if (!(player->stateFlags1 & - (PLAYER_STATE1_DEAD | PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_HANGING_OFF_LEDGE | + (PLAYER_STATE1_DEAD | PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_FIRST_PERSON | PLAYER_STATE1_CLIMBING_LADDER))) { player->rideActor = horse; player->mountSide = mountSide; @@ -2177,11 +2177,11 @@ s32 Actor_NotMounted(PlayState* play, Actor* horse) { void func_8002F698(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) { 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 = arg6; + player->knockbackType = arg5; + player->knockbackRot = arg3; + player->knockbackSpeed = arg2; + player->knockbackYVelocity = arg4; } void func_8002F6D4(PlayState* play, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5) { @@ -2502,18 +2502,18 @@ void func_800304DC(PlayState* play, ActorContext* actorCtx, ActorEntry* actorEnt } u32 D_80116068[ACTORCAT_MAX] = { - PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, - PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, 0, - PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, + PLAYER_STATE1_TALKING | PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, PLAYER_STATE1_DEAD, - PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE, PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, 0, - PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE, - PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE, + PLAYER_STATE1_TALKING | PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, 0, - PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, + PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS, }; void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { @@ -2558,8 +2558,8 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { unkFlag = ACTOR_FLAG_NO_FREEZE_OCARINA; } - if ((player->stateFlags1 & PLAYER_STATE1_TEXT_ON_SCREEN) && ((player->actor.textId & 0xFF00) != 0x600)) { - sp74 = player->targetActor; + if ((player->stateFlags1 & PLAYER_STATE1_TALKING) && ((player->actor.textId & 0xFF00) != 0x600)) { + sp74 = player->talkActor; } for (i = 0; i < ARRAY_COUNT(actorCtx->actorLists); i++, sp80++) { @@ -2613,13 +2613,13 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { actor->flags &= ~ACTOR_FLAG_PLAY_HIT_SFX; if ((DECR(actor->freezeTimer) == 0) && (actor->flags & (ACTOR_FLAG_UPDATE_WHILE_CULLED | ACTOR_FLAG_ACTIVE))) { - if (actor == player->unk_664) { + if (actor == player->focusActor) { actor->isTargeted = true; } else { actor->isTargeted = false; } - if ((actor->targetPriority != 0) && (player->unk_664 == NULL)) { + if ((actor->targetPriority != 0) && (player->focusActor == NULL)) { actor->targetPriority = 0; } @@ -2643,14 +2643,14 @@ void Actor_UpdateAll(PlayState* play, ActorContext* actorCtx) { } } - actor = player->unk_664; + actor = player->focusActor; if ((actor != NULL) && (actor->update == NULL)) { actor = NULL; - func_8008EDF0(player); + Player_ReleaseLockOn(player); } - if ((actor == NULL) || (player->unk_66C < 5)) { + if ((actor == NULL) || (player->zTargetActiveTimer < 5)) { actor = NULL; if (actorCtx->targetCtx.unk_4B != 0) { actorCtx->targetCtx.unk_4B = 0; @@ -3429,8 +3429,8 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, PlayState* play) { osSyncPrintf("アクタークラス削除 [%s]\n", dbEntry->name); // "Actor class deleted [%s]" } - if ((player != NULL) && (actor == player->unk_664)) { - func_8008EDF0(player); + if ((player != NULL) && (actor == player->focusActor)) { + Player_ReleaseLockOn(player); Camera_ChangeMode(Play_GetCamera(play, Play_GetActiveCamId(play)), 0); } @@ -3484,7 +3484,7 @@ void func_800328D4(PlayState* play, ActorContext* actorCtx, Player* player, u32 Vec3f sp70; actor = actorCtx->actorLists[actorCategory].head; - sp84 = player->unk_664; + sp84 = player->focusActor; while (actor != NULL) { if ((actor->update != NULL) && ((Player*)actor != player) && CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_TARGETABLE)) { @@ -3985,7 +3985,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, PlayState* play, f32 distance, s16 s32 Actor_IsTargeted(PlayState* play, Actor* actor) { Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) && actor->isTargeted) { + if ((player->stateFlags1 & PLAYER_STATE1_HOSTILE_LOCK_ON) && actor->isTargeted) { return true; } else { return false; @@ -3998,7 +3998,7 @@ s32 Actor_IsTargeted(PlayState* play, Actor* actor) { s32 Actor_OtherIsTargeted(PlayState* play, Actor* actor) { Player* player = GET_PLAYER(play); - if ((player->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) && !actor->isTargeted) { + if ((player->stateFlags1 & PLAYER_STATE1_HOSTILE_LOCK_ON) && !actor->isTargeted) { return true; } else { return false; diff --git a/soh/src/code/z_camera.c b/soh/src/code/z_camera.c index bfaafaba2..986606045 100644 --- a/soh/src/code/z_camera.c +++ b/soh/src/code/z_camera.c @@ -6182,7 +6182,7 @@ s32 Camera_Demo5(Camera* camera) { sp4A = playerhead.rot.y - playerTargetGeo.yaw; if (camera->target->category == ACTORCAT_PLAYER) { pad = camera->play->state.frames - sDemo5PrevAction12Frame; - if (player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + if (player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { // holding object over head. Player_SetCsActionWithHaltedActors(camera->play, camera->target, 8); } else if (ABS(pad) > 3000) { diff --git a/soh/src/code/z_parameter.c b/soh/src/code/z_parameter.c index 29f7430eb..10b2953ec 100644 --- a/soh/src/code/z_parameter.c +++ b/soh/src/code/z_parameter.c @@ -4051,7 +4051,7 @@ void Interface_DrawEnemyHealthBar(TargetContext* targetCtx, PlayState* play) { Interface_CreateQuadVertexGroup(&sEnemyHealthVtx[12], -floorf(halfBarWidth) + endTexWidth, (-texHeight / 2) + 3, healthBarFill, 7, 0); - if (((!(player->stateFlags1 & PLAYER_STATE1_TEXT_ON_SCREEN)) || (actor != player->unk_664)) && targetCtx->unk_44 < 500.0f) { + if (((!(player->stateFlags1 & PLAYER_STATE1_TALKING)) || (actor != player->focusActor)) && targetCtx->unk_44 < 500.0f) { f32 slideInOffsetY = 0; // Slide in the health bar from edge of the screen (mimic the Z-Target triangles fly in) diff --git a/soh/src/code/z_player_lib.c b/soh/src/code/z_player_lib.c index bde5ea431..1a05a515d 100644 --- a/soh/src/code/z_player_lib.c +++ b/soh/src/code/z_player_lib.c @@ -34,73 +34,73 @@ s16 sBootData[PLAYER_BOOTS_MAX][17] = { // Used to map action params to model groups u8 sActionModelGroups[] = { - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NONE - PLAYER_MODELGROUP_15, // PLAYER_IA_LAST_USED - PLAYER_MODELGROUP_10, // PLAYER_IA_FISHING_POLE - PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_MASTER - PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_KOKIRI - PLAYER_MODELGROUP_BGS, // PLAYER_IA_SWORD_BIGGORON - PLAYER_MODELGROUP_10, // PLAYER_IA_DEKU_STICK - PLAYER_MODELGROUP_HAMMER, // PLAYER_IA_HAMMER - PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW - PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_FIRE - PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_ICE - PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_LIGHT - PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0C - PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0D - PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0E - PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_SLINGSHOT - PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_HOOKSHOT - PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_LONGSHOT - PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMB - PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMBCHU - PLAYER_MODELGROUP_BOOMERANG, // PLAYER_IA_BOOMERANG - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_15 - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_16 - PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_MAGIC_SPELL_17 - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FARORES_WIND - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NAYRUS_LOVE - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_DINS_FIRE - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_DEKU_NUT - PLAYER_MODELGROUP_OCARINA, // PLAYER_IA_OCARINA_FAIRY - PLAYER_MODELGROUP_OOT, // PLAYER_IA_OCARINA_OF_TIME - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FISH - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FIRE - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BUG - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POE - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BIG_POE - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_RUTOS_LETTER - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_RED - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_BLUE - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_GREEN - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK_FULL - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK_HALF - PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FAIRY - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ZELDAS_LETTER - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_WEIRD_EGG - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CHICKEN - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_BEAN - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_EGG - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_CUCCO - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_COJIRO - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_MUSHROOM - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_POTION - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POACHERS_SAW - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_BROKEN_GORONS_SWORD - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_PRESCRIPTION - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FROG - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_EYEDROPS - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CLAIM_CHECK - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_KEATON - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SKULL - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SPOOKY - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_BUNNY_HOOD - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GORON - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_ZORA - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GERUDO - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_TRUTH - PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_LENS_OF_TRUTH + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NONE + PLAYER_MODELGROUP_SWORD, // PLAYER_IA_SWORD_CS + PLAYER_MODELGROUP_10, // PLAYER_IA_FISHING_POLE + PLAYER_MODELGROUP_SWORD_AND_SHIELD, // PLAYER_IA_SWORD_MASTER + PLAYER_MODELGROUP_SWORD_AND_SHIELD, // PLAYER_IA_SWORD_KOKIRI + PLAYER_MODELGROUP_BGS, // PLAYER_IA_SWORD_BIGGORON + PLAYER_MODELGROUP_10, // PLAYER_IA_DEKU_STICK + PLAYER_MODELGROUP_HAMMER, // PLAYER_IA_HAMMER + PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW + PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_FIRE + PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_ICE + PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_LIGHT + PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0C + PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0D + PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_BOW_0E + PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_SLINGSHOT + PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_HOOKSHOT + PLAYER_MODELGROUP_HOOKSHOT, // PLAYER_IA_LONGSHOT + PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMB + PLAYER_MODELGROUP_EXPLOSIVES, // PLAYER_IA_BOMBCHU + PLAYER_MODELGROUP_BOOMERANG, // PLAYER_IA_BOOMERANG + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_15 + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_SPELL_16 + PLAYER_MODELGROUP_BOW_SLINGSHOT, // PLAYER_IA_MAGIC_SPELL_17 + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FARORES_WIND + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_NAYRUS_LOVE + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_DINS_FIRE + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_DEKU_NUT + PLAYER_MODELGROUP_OCARINA, // PLAYER_IA_OCARINA_FAIRY + PLAYER_MODELGROUP_OOT, // PLAYER_IA_OCARINA_OF_TIME + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FISH + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FIRE + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BUG + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POE + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_BIG_POE + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_RUTOS_LETTER + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_RED + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_BLUE + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_POTION_GREEN + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK_FULL + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_MILK_HALF + PLAYER_MODELGROUP_BOTTLE, // PLAYER_IA_BOTTLE_FAIRY + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ZELDAS_LETTER + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_WEIRD_EGG + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CHICKEN + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MAGIC_BEAN + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_EGG + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POCKET_CUCCO + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_COJIRO + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_MUSHROOM + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_ODD_POTION + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_POACHERS_SAW + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_BROKEN_GORONS_SWORD + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_PRESCRIPTION + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_FROG + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_EYEDROPS + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_CLAIM_CHECK + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_KEATON + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SKULL + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_SPOOKY + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_BUNNY_HOOD + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GORON + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_ZORA + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_GERUDO + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_MASK_TRUTH + PLAYER_MODELGROUP_DEFAULT, // PLAYER_IA_LENS_OF_TRUTH }; TextTriggerEntry sTextTriggers[] = { @@ -128,7 +128,7 @@ u8 gPlayerModelTypes[PLAYER_MODELGROUP_MAX][PLAYER_MODELGROUPENTRY_MAX] = { PLAYER_MODELTYPE_SHEATH_19, PLAYER_MODELTYPE_WAIST }, - /* PLAYER_MODELGROUP_SWORD */ + /* PLAYER_MODELGROUP_SWORD_AND_SHIELD */ { PLAYER_ANIMTYPE_1, PLAYER_MODELTYPE_LH_SWORD, @@ -232,7 +232,7 @@ u8 gPlayerModelTypes[PLAYER_MODELGROUP_MAX][PLAYER_MODELGROUPENTRY_MAX] = { PLAYER_MODELTYPE_SHEATH_18, PLAYER_MODELTYPE_WAIST }, - /* PLAYER_MODELGROUP_15 */ + /* PLAYER_MODELGROUP_SWORD */ { PLAYER_ANIMTYPE_0, PLAYER_MODELTYPE_LH_SWORD, @@ -565,7 +565,7 @@ uint8_t Player_IsCustomLinkModel() { s32 Player_InBlockingCsMode(PlayState* play, Player* this) { return (this->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_CUTSCENE)) || (this->csAction != 0) || (play->transitionTrigger == TRANS_TRIGGER_START) || - (this->stateFlags1 & PLAYER_STATE1_LOADING) || (this->stateFlags3 & PLAYER_STATE3_HOOKSHOT_TRAVELLING) || + (this->stateFlags1 & PLAYER_STATE1_LOADING) || (this->stateFlags3 & PLAYER_STATE3_FLYING_WITH_HOOKSHOT) || ((gSaveContext.magicState != MAGIC_STATE_IDLE) && (Player_ActionToMagicSpell(this, this->itemAction) >= 0)); } @@ -575,8 +575,15 @@ s32 Player_InCsMode(PlayState* play) { return Player_InBlockingCsMode(play, this) || (this->unk_6AD == 4); } -s32 func_8008E9C4(Player* this) { - return (this->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET); +/** + * Checks if Player is currently locked onto a hostile actor. + * `PLAYER_STATE1_HOSTILE_LOCK_ON` controls Player's "battle" response to hostile actors. + * + * Note that within Player, `Player_UpdateHostileLockOn` exists, which updates the flag and also returns the check. + * Player can use this function instead if the flag should be checked, but not updated. + */ +s32 Player_CheckHostileLockOn(Player* this) { + return (this->stateFlags1 & PLAYER_STATE1_HOSTILE_LOCK_ON); } s32 Player_IsChildWithHylianShield(Player* this) { @@ -586,7 +593,7 @@ s32 Player_IsChildWithHylianShield(Player* this) { s32 Player_ActionToModelGroup(Player* this, s32 actionParam) { s32 modelGroup = sActionModelGroups[actionParam]; - if ((modelGroup == PLAYER_MODELGROUP_SWORD) && Player_IsChildWithHylianShield(this)) { + if ((modelGroup == PLAYER_MODELGROUP_SWORD_AND_SHIELD) && Player_IsChildWithHylianShield(this)) { // child, using kokiri sword with hylian shield equipped return PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD; } else { @@ -735,29 +742,48 @@ void Player_UpdateBottleHeld(PlayState* play, Player* this, s32 item, s32 action this->itemAction = actionParam; } -void func_8008EDF0(Player* this) { - this->unk_664 = NULL; - this->stateFlags2 &= ~PLAYER_STATE2_SWITCH_TARGETING; +void Player_ReleaseLockOn(Player* this) { + this->focusActor = NULL; + this->stateFlags2 &= ~PLAYER_STATE2_LOCK_ON_WITH_SWITCH; } -void func_8008EE08(Player* this) { +/** + * This function aims to clear Z-Target related state when it isn't in use. + * It also handles setting a specific free fall related state that is interntwined with Z-Targeting. + * TODO: Learn more about this and give a name to PLAYER_STATE1_19 + */ +void Player_ClearZTargeting(Player* this) { if ((this->actor.bgCheckFlags & 1) || (this->stateFlags1 & (PLAYER_STATE1_CLIMBING_LADDER | PLAYER_STATE1_ON_HORSE | PLAYER_STATE1_IN_WATER)) || (!(this->stateFlags1 & (PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL)) && ((this->actor.world.pos.y - this->actor.floorHeight) < 100.0f))) { - this->stateFlags1 &= ~(PLAYER_STATE1_TARGETING | PLAYER_STATE1_TARGET_LOCKED | PLAYER_STATE1_TARGET_NOTHING | PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_30); + this->stateFlags1 &= ~(PLAYER_STATE1_Z_TARGETING | PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS | PLAYER_STATE1_PARALLEL | PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE); } else if (!(this->stateFlags1 & (PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL | PLAYER_STATE1_CLIMBING_LADDER))) { this->stateFlags1 |= PLAYER_STATE1_FREEFALL; } - func_8008EDF0(this); + Player_ReleaseLockOn(this); } -void func_8008EEAC(PlayState* play, Actor* actor) { +/** + * Sets the "auto lock-on actor" to lock onto an actor without Player's input. + * This function will first release any existing lock-on or (try to) release parallel. + * + * When using Switch Targeting, it is not possible to carry an auto lock-on actor into a normal + * lock-on when the auto lock-on is finished. + * This is because the `PLAYER_STATE2_LOCK_ON_WITH_SWITCH` flag is never set with an auto lock-on. + * With Hold Targeting it is possible to keep the auto lock-on going by keeping the Z button held down. + * + * The auto lock-on is considered "friendly" even if the actor is actually hostile. If the auto lock-on is hostile, + * Player's battle response will not occur (if he is actionable) and the camera behaves differently. + * When transitioning from auto lock-on to normal lock-on (with Hold Targeting) there will be a noticeable change + * when it switches from "friendly" mode to "hostile" mode. + */ +void Player_SetAutoLockOnActor(PlayState* play, Actor* actor) { Player* this = GET_PLAYER(play); - func_8008EE08(this); - this->unk_664 = actor; - this->unk_684 = actor; - this->stateFlags1 |= PLAYER_STATE1_TARGET_LOCKED; + Player_ClearZTargeting(this); + this->focusActor = actor; + this->autoLockOnActor = actor; + this->stateFlags1 |= PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS; Camera_SetParam(Play_GetCamera(play, 0), 8, actor); Camera_ChangeMode(Play_GetCamera(play, 0), 2); } @@ -919,7 +945,7 @@ s32 Player_GetExplosiveHeld(Player* this) { s32 func_8008F2BC(Player* this, s32 actionParam) { s32 sword = 0; - if (actionParam != PLAYER_IA_LAST_USED) { + if (actionParam != PLAYER_IA_SWORD_CS) { sword = actionParam - PLAYER_IA_SWORD_MASTER; if ((sword < 0) || (sword >= 3)) { goto return_neg; @@ -1319,9 +1345,9 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** Matrix_Translate((LINK_IS_ADULT ? 3600.0f : 2900.0f) * ABS(scale - 1.0f), 0.0f, 0.0f, MTXMODE_APPLY); } } - rot->x += this->unk_6BA; - rot->y -= this->unk_6B8; - rot->z += this->unk_6B6; + rot->x += this->headLimbRot.z; + rot->y -= this->headLimbRot.y; + rot->z += this->headLimbRot.x; } else if (limbIndex == PLAYER_LIMB_L_HAND) { if (CVarGetInteger(CVAR_COSMETIC("Link.SwordScale.Changed"), 0)) { f32 scale = CVarGetFloat(CVAR_COSMETIC("Link.SwordScale.Value"), 1.0f); @@ -1329,18 +1355,18 @@ s32 Player_OverrideLimbDrawGameplayCommon(PlayState* play, s32 limbIndex, Gfx** Matrix_Translate(-((LINK_IS_ADULT ? 320.0f : 200.0f) * scale), 0.0f, 0.0f, MTXMODE_APPLY); } } else if (limbIndex == PLAYER_LIMB_UPPER) { - if (this->unk_6B0 != 0) { + if (this->upperLimbYawSecondary != 0) { Matrix_RotateZ(0x44C * (M_PI / 0x8000), MTXMODE_APPLY); - Matrix_RotateY(this->unk_6B0 * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY(this->upperLimbYawSecondary * (M_PI / 0x8000), MTXMODE_APPLY); } - if (this->unk_6BE != 0) { - Matrix_RotateY(this->unk_6BE * (M_PI / 0x8000), MTXMODE_APPLY); + if (this->upperLimbRot.y != 0) { + Matrix_RotateY(this->upperLimbRot.y * (M_PI / 0x8000), MTXMODE_APPLY); } - if (this->unk_6BC != 0) { - Matrix_RotateX(this->unk_6BC * (M_PI / 0x8000), MTXMODE_APPLY); + if (this->upperLimbRot.x != 0) { + Matrix_RotateX(this->upperLimbRot.x * (M_PI / 0x8000), MTXMODE_APPLY); } - if (this->unk_6C0 != 0) { - Matrix_RotateZ(this->unk_6C0 * (M_PI / 0x8000), MTXMODE_APPLY); + if (this->upperLimbRot.z != 0) { + Matrix_RotateZ(this->upperLimbRot.z * (M_PI / 0x8000), MTXMODE_APPLY); } } else if (limbIndex == PLAYER_LIMB_L_THIGH) { func_8008F87C(play, this, &this->skelAnime, pos, rot, PLAYER_LIMB_L_THIGH, PLAYER_LIMB_L_SHIN, @@ -1367,7 +1393,7 @@ s32 Player_OverrideLimbDrawGameplayDefault(PlayState* play, s32 limbIndex, Gfx** if ((sLeftHandType == PLAYER_MODELTYPE_LH_BGS) && (gSaveContext.swordHealth <= 0.0f)) { dLists += 4; - } else if ((sLeftHandType == PLAYER_MODELTYPE_LH_BOOMERANG) && (this->stateFlags1 & PLAYER_STATE1_THREW_BOOMERANG)) { + } else if ((sLeftHandType == PLAYER_MODELTYPE_LH_BOOMERANG) && (this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN)) { dLists = &gPlayerLeftHandOpenDLs[gSaveContext.linkAge]; sLeftHandType = PLAYER_MODELTYPE_LH_OPEN; } else if ((this->leftHandType == PLAYER_MODELTYPE_LH_OPEN) && (this->actor.speedXZ > 2.0f) && !(this->stateFlags1 & PLAYER_STATE1_IN_WATER)) { @@ -1828,7 +1854,7 @@ void Player_PostLimbDrawGameplay(PlayState* play, s32 limbIndex, Gfx** dList, Ve Matrix_Get(&sp14C); Matrix_MtxFToYXZRotS(&sp14C, &hookedActor->world.rot, 0); hookedActor->shape.rot = hookedActor->world.rot; - } else if (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + } else if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { Vec3s spB8; Matrix_Get(&sp14C); @@ -2000,9 +2026,9 @@ u32 func_80091738(PlayState* play, u8* segment, SkelAnime* skelAnime) { } u8 sPauseModelGroupBySword[] = { - PLAYER_MODELGROUP_SWORD, // PLAYER_SWORD_KOKIRI - PLAYER_MODELGROUP_SWORD, // PLAYER_SWORD_MASTER - PLAYER_MODELGROUP_BGS, // PLAYER_SWORD_BIGGORON + PLAYER_MODELGROUP_SWORD_AND_SHIELD, // PLAYER_SWORD_KOKIRI + PLAYER_MODELGROUP_SWORD_AND_SHIELD, // PLAYER_SWORD_MASTER + PLAYER_MODELGROUP_BGS, // PLAYER_SWORD_BIGGORON }; s32 Player_OverrideLimbDrawPause(PlayState* play, s32 limbIndex, Gfx** dList, Vec3f* pos, Vec3s* rot, void* arg) { @@ -2015,7 +2041,7 @@ s32 Player_OverrideLimbDrawPause(PlayState* play, s32 limbIndex, Gfx** dList, Ve Gfx** dLists; size_t ptrSize = sizeof(uint32_t); - if ((modelGroup == PLAYER_MODELGROUP_SWORD) && !LINK_IS_ADULT && (playerSwordAndShield[1] == PLAYER_SHIELD_HYLIAN)) { + if ((modelGroup == PLAYER_MODELGROUP_SWORD_AND_SHIELD) && !LINK_IS_ADULT && (playerSwordAndShield[1] == PLAYER_SHIELD_HYLIAN)) { modelGroup = PLAYER_MODELGROUP_CHILD_HYLIAN_SHIELD; } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c b/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c index d1f0e6d30..7b5519e43 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c @@ -61,7 +61,7 @@ void func_8087B758(BgHaka* this, Player* player) { func_8002DBD0(&this->dyna.actor, &sp1C, &player->actor.world.pos); if (fabsf(sp1C.x) < 34.6f && sp1C.z > -112.8f && sp1C.z < -36.0f) { - player->stateFlags2 |= PLAYER_STATE2_SPAWN_DUST; + player->stateFlags2 |= PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND; } } diff --git a/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index 22b8c989a..59eabd941 100644 --- a/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/soh/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -290,7 +290,7 @@ void BgHakaSgami_Update(Actor* thisx, PlayState* play) { BgHakaSgami* this = (BgHakaSgami*)thisx; Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE)) || (this->actionFunc == BgHakaSgami_SetupSpin)) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE)) || (this->actionFunc == BgHakaSgami_SetupSpin)) { this->actionFunc(this, play); } } diff --git a/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c b/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c index 30164bf2e..3af46683c 100644 --- a/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c +++ b/soh/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c @@ -201,7 +201,7 @@ void BgJyaGoroiwa_Update(Actor* thisx, PlayState* play) { s32 bgId; Vec3f pos; - if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE))) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE))) { this->actionFunc(this, play); BgJyaGoroiwa_UpdateRotation(this); pos.x = this->actor.world.pos.x; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c b/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c index e8ecc6d91..d49830357 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot01_Idohashira/z_bg_spot01_idohashira.c @@ -152,9 +152,9 @@ s32 BgSpot01Idohashira_NotInCsMode(PlayState* play) { return false; } -CsCmdActorAction* BgSpot01Idohashira_GetNpcAction(PlayState* play, s32 actionIdx) { +CsCmdActorCue* BgSpot01Idohashira_GetNpcAction(PlayState* play, s32 actionIdx) { s32 pad[2]; - CsCmdActorAction* npcAction = NULL; + CsCmdActorCue* npcAction = NULL; if (!BgSpot01Idohashira_NotInCsMode(play)) { npcAction = play->csCtx.npcActions[actionIdx]; @@ -186,7 +186,7 @@ f32 func_808AB1DC(f32 arg0, f32 arg1, u16 arg2, u16 arg3, u16 arg4) { } s32 func_808AB29C(BgSpot01Idohashira* this, PlayState* play) { - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; Vec3f* thisPos; f32 endX; f32 temp_f0; @@ -237,7 +237,7 @@ void func_808AB414(BgSpot01Idohashira* this, PlayState* play) { } void func_808AB444(BgSpot01Idohashira* this, PlayState* play) { - CsCmdActorAction* npcAction = BgSpot01Idohashira_GetNpcAction(play, 2); + CsCmdActorCue* npcAction = BgSpot01Idohashira_GetNpcAction(play, 2); u32 action; u32 currentNpcAction; diff --git a/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 4bc551eae..34a0c5091 100644 --- a/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/soh/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -413,7 +413,7 @@ void func_808B57E0(BgSpot16Bombstone* this, PlayState* play) { OnePointCutscene_Init(play, 4180, sTimer, NULL, MAIN_CAM); } } - } else if (player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + } else if (player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { playerHeldActor = player->heldActor; if (playerHeldActor != NULL && playerHeldActor->category == ACTORCAT_EXPLOSIVE && playerHeldActor->id == ACTOR_EN_BOMBF) { diff --git a/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c b/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c index 4c4d828f8..69ecc4251 100644 --- a/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/soh/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -92,7 +92,7 @@ void BgTreemouth_Destroy(Actor* thisx, PlayState* play) { } void func_808BC65C(BgTreemouth* this, PlayState* play) { - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; if ((play->csCtx.state != CS_STATE_IDLE)) { npcAction = play->csCtx.npcActions[0]; @@ -198,7 +198,7 @@ void func_808BC9EC(BgTreemouth* this, PlayState* play) { } void func_808BCAF0(BgTreemouth* this, PlayState* play) { - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; if (play->csCtx.state != CS_STATE_IDLE) { npcAction = play->csCtx.npcActions[0]; diff --git a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index a739bfd96..ad1c87d1c 100644 --- a/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/soh/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -389,7 +389,7 @@ void BossSst_HeadSetupIntro(BossSst* this, PlayState* play) { player->actor.world.pos.z = sRoomCenter.z; player->linearVelocity = player->actor.velocity.y = 0.0f; player->actor.shape.rot.y = -0x8000; - player->zTargetYaw = -0x8000; + player->parallelYaw = -0x8000; player->yaw = -0x8000; player->fallStartHeight = 0; player->stateFlags1 |= PLAYER_STATE1_INPUT_DISABLED; @@ -448,7 +448,7 @@ void BossSst_HeadIntro(BossSst* this, PlayState* play) { player->actor.world.pos.z = sRoomCenter.z; player->linearVelocity = 0; player->actor.shape.rot.y = -0x8000; - player->zTargetYaw = -0x8000; + player->parallelYaw = -0x8000; player->yaw = -0x8000; } diff --git a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index 418b758a1..3207e4e87 100644 --- a/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/soh/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -807,7 +807,7 @@ void func_809691BC(Demo6K* this, PlayState* play, s32 params) { Vec3f startPos; Vec3f endPos; f32 temp; - CsCmdActorAction* csAction = play->csCtx.npcActions[params]; + CsCmdActorCue* csAction = play->csCtx.npcActions[params]; startPos.x = csAction->startPos.x; startPos.y = csAction->startPos.y; diff --git a/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c b/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c index 73f6c2e6d..d05e3aa2b 100644 --- a/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/soh/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -103,7 +103,7 @@ void DemoDu_UpdateBgCheckInfo(DemoDu* this, PlayState* play) { Actor_UpdateBgCheckInfo(play, &this->actor, 75.0f, 30.0f, 30.0f, 5); } -CsCmdActorAction* DemoDu_GetNpcAction(PlayState* play, s32 idx) { +CsCmdActorCue* DemoDu_GetNpcAction(PlayState* play, s32 idx) { if (play->csCtx.state != CS_STATE_IDLE) { return play->csCtx.npcActions[idx]; } @@ -111,7 +111,7 @@ CsCmdActorAction* DemoDu_GetNpcAction(PlayState* play, s32 idx) { } s32 DemoDu_IsNpcDoingThisAction(DemoDu* this, PlayState* play, u16 action, s32 idx) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, idx); + CsCmdActorCue* npcAction = DemoDu_GetNpcAction(play, idx); if ((npcAction != NULL) && (npcAction->action == action)) { return true; @@ -120,7 +120,7 @@ s32 DemoDu_IsNpcDoingThisAction(DemoDu* this, PlayState* play, u16 action, s32 i } s32 DemoDu_IsNpcNotDoingThisAction(DemoDu* this, PlayState* play, u16 action, s32 idx) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, idx); + CsCmdActorCue* npcAction = DemoDu_GetNpcAction(play, idx); if ((npcAction != NULL) && (npcAction->action != action)) { return true; @@ -129,7 +129,7 @@ s32 DemoDu_IsNpcNotDoingThisAction(DemoDu* this, PlayState* play, u16 action, s3 } void DemoDu_MoveToNpcPos(DemoDu* this, PlayState* play, s32 idx) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, idx); + CsCmdActorCue* npcAction = DemoDu_GetNpcAction(play, idx); s32 pad; if (npcAction != NULL) { @@ -214,7 +214,7 @@ void DemoDu_CsFireMedallion_AdvanceTo01(DemoDu* this, PlayState* play) { void DemoDu_CsFireMedallion_AdvanceTo02(DemoDu* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 1)) { this->updateIndex = CS_FIREMEDALLION_SUBSCENE(2); @@ -233,7 +233,7 @@ void DemoDu_CsFireMedallion_AdvanceTo03(DemoDu* this) { void DemoDu_CsFireMedallion_AdvanceTo04(DemoDu* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 2)) { Animation_Change(&this->skelAnime, &gDaruniaItemGiveAnim, 1.0f, 0.0f, @@ -253,7 +253,7 @@ void DemoDu_CsFireMedallion_AdvanceTo05(DemoDu* this, s32 animFinished) { void DemoDu_CsFireMedallion_AdvanceTo06(DemoDu* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[6]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[6]; if ((npcAction != NULL) && (npcAction->action == 2)) { this->updateIndex = CS_FIREMEDALLION_SUBSCENE(6); @@ -444,7 +444,7 @@ void DemoDu_CsGoronsRuby_DaruniaFalling(DemoDu* this, PlayState* play) { CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = csCtx->npcActions[2]; + CsCmdActorCue* npcAction = csCtx->npcActions[2]; Vec3f startPos; Vec3f endPos; Vec3f* pos = &this->actor.world.pos; @@ -473,7 +473,7 @@ void DemoDu_CsGoronsRuby_AdvanceTo01(DemoDu* this, PlayState* play) { void DemoDu_CsGoronsRuby_AdvanceTo02(DemoDu* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 1)) { Animation_Change(&this->skelAnime, &gDaruniaStandUpAfterFallingAnim, 1.0f, 0.0f, @@ -489,7 +489,7 @@ void DemoDu_CsGoronsRuby_AdvanceTo03(DemoDu* this, PlayState* play) { CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = csCtx->npcActions[2]; + CsCmdActorCue* npcAction = csCtx->npcActions[2]; if ((npcAction != NULL) && (csCtx->frames >= npcAction->endFrame)) { this->updateIndex = CS_GORONSRUBY_SUBSCENE(3); @@ -500,7 +500,7 @@ void DemoDu_CsGoronsRuby_AdvanceTo03(DemoDu* this, PlayState* play) { void DemoDu_CsGoronsRuby_AdvanceTo04(DemoDu* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 2)) { this->updateIndex = CS_GORONSRUBY_SUBSCENE(4); @@ -518,7 +518,7 @@ void DemoDu_CsGoronsRuby_AdvanceTo05(DemoDu* this, s32 animFinished) { void DemoDu_CsGoronsRuby_AdvanceTo06(DemoDu* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 3)) { Animation_Change(&this->skelAnime, &gDaruniaHitBreastAnim, 1.0f, 0.0f, @@ -538,7 +538,7 @@ void DemoDu_CsGoronsRuby_AdvanceTo07(DemoDu* this, s32 animFinished) { void DemoDu_CsGoronsRuby_AdvanceTo08(DemoDu* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 4)) { Animation_Change(&this->skelAnime, &gDaruniaHitLinkAnim, 1.0f, 0.0f, @@ -566,7 +566,7 @@ void DemoDu_CsGoronsRuby_AdvanceTo10(DemoDu* this, s32 animFinished) { void DemoDu_CsGoronsRuby_AdvanceTo11(DemoDu* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 5)) { Animation_Change(&this->skelAnime, &gDaruniaItemGiveAnim, 1.0f, 0.0f, @@ -586,7 +586,7 @@ void DemoDu_CsGoronsRuby_AdvanceTo12(DemoDu* this, s32 animFinished) { void DemoDu_CsGoronsRuby_AdvanceTo13(DemoDu* this, PlayState* play) { if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[2]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[2]; if ((npcAction != NULL) && (npcAction->action != 6)) { Animation_Change(&this->skelAnime, &gDaruniaIdleAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gDaruniaIdleAnim), @@ -886,7 +886,7 @@ void DemoDu_CsCredits_BackTo02(DemoDu* this, s32 animFinished) { } void DemoDu_CsCredits_HandleSubscenesByNpcAction(DemoDu* this, PlayState* play) { - CsCmdActorAction* npcAction = DemoDu_GetNpcAction(play, 2); + CsCmdActorCue* npcAction = DemoDu_GetNpcAction(play, 2); if (npcAction != NULL) { s32 action = npcAction->action; diff --git a/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c b/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c index ca100ea13..1ce6aa7b8 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c +++ b/soh/src/overlays/actors/ovl_Demo_Ec/z_demo_ec.c @@ -331,7 +331,7 @@ void DemoEc_UseAnimationObject(DemoEc* this, PlayState* play) { gSegments[6] = PHYSICAL_TO_VIRTUAL(play->objectCtx.status[animObjBankIndex].segment); } -CsCmdActorAction* DemoEc_GetNpcAction(PlayState* play, s32 actionIndex) { +CsCmdActorCue* DemoEc_GetNpcAction(PlayState* play, s32 actionIndex) { if (play->csCtx.state != CS_STATE_IDLE) { return play->csCtx.npcActions[actionIndex]; } else { @@ -340,7 +340,7 @@ CsCmdActorAction* DemoEc_GetNpcAction(PlayState* play, s32 actionIndex) { } void DemoEc_SetNpcActionPosRot(DemoEc* this, PlayState* play, s32 actionIndex) { - CsCmdActorAction* npcAction = DemoEc_GetNpcAction(play, actionIndex); + CsCmdActorCue* npcAction = DemoEc_GetNpcAction(play, actionIndex); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -821,7 +821,7 @@ void func_8096F26C(DemoEc* this, s32 arg1) { } void func_8096F2B0(DemoEc* this, PlayState* play, s32 arg2) { - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; s32 sp18; npcAction = DemoEc_GetNpcAction(play, arg2); @@ -895,7 +895,7 @@ void func_8096F544(DemoEc* this, s32 changeAnim) { } void func_8096F578(DemoEc* this, PlayState* play, s32 arg2) { - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; s32 sp18; npcAction = DemoEc_GetNpcAction(play, arg2); diff --git a/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c b/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c index 196038265..15d042ff9 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c +++ b/soh/src/overlays/actors/ovl_Demo_Ext/z_demo_ext.c @@ -50,7 +50,7 @@ void DemoExt_PlayVortexSFX(DemoExt* this) { } } -CsCmdActorAction* DemoExt_GetNpcAction(PlayState* play, s32 npcActionIndex) { +CsCmdActorCue* DemoExt_GetNpcAction(PlayState* play, s32 npcActionIndex) { if (play->csCtx.state != CS_STATE_IDLE) { return play->csCtx.npcActions[npcActionIndex]; } @@ -63,7 +63,7 @@ void DemoExt_SetupWait(DemoExt* this) { } void DemoExt_SetupMaintainVortex(DemoExt* this, PlayState* play) { - CsCmdActorAction* npcAction = DemoExt_GetNpcAction(play, 5); + CsCmdActorCue* npcAction = DemoExt_GetNpcAction(play, 5); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -88,7 +88,7 @@ void DemoExt_FinishClosing(DemoExt* this) { } void DemoExt_CheckCsMode(DemoExt* this, PlayState* play) { - CsCmdActorAction* csCmdNPCAction = DemoExt_GetNpcAction(play, 5); + CsCmdActorCue* csCmdNPCAction = DemoExt_GetNpcAction(play, 5); s32 csAction; s32 previousCsAction; diff --git a/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.c b/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.c index 8c7c981a4..274de1a8b 100644 --- a/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.c +++ b/soh/src/overlays/actors/ovl_Demo_Go/z_demo_go.c @@ -127,7 +127,7 @@ void func_8097CB0C(DemoGo* this, PlayState* play) { Actor* thisx = &this->actor; PosRot* world = &thisx->world; CutsceneContext* csCtx = &play->csCtx; - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; f32 temp_ret; s32 pad; Vec3f startPos; @@ -167,7 +167,7 @@ void func_8097CCC0(DemoGo* this) { } void func_8097CCE0(DemoGo* this, PlayState* play) { - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; Actor* thisx = &this->actor; s32 rotYDelta; s32 newRotY; @@ -221,7 +221,7 @@ void func_8097CE20(DemoGo* this, PlayState* play) { void func_8097CE78(DemoGo* this, PlayState* play) { CutsceneContext* csCtx = &play->csCtx; - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; if (play->csCtx.state != CS_STATE_IDLE) { npcAction = csCtx->npcActions[func_8097C870(this)]; diff --git a/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c b/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c index 381f03b3c..fcc989f19 100644 --- a/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c +++ b/soh/src/overlays/actors/ovl_Demo_Gt/z_demo_gt.c @@ -297,9 +297,9 @@ u8 func_8097E69C(PlayState* play) { } } -CsCmdActorAction* DemoGt_GetNpcAction(PlayState* play, u32 actionIdx) { +CsCmdActorCue* DemoGt_GetNpcAction(PlayState* play, u32 actionIdx) { s32 pad[2]; - CsCmdActorAction* ret = NULL; + CsCmdActorCue* ret = NULL; if (!func_8097E69C(play)) { ret = play->csCtx.npcActions[actionIdx]; @@ -309,7 +309,7 @@ CsCmdActorAction* DemoGt_GetNpcAction(PlayState* play, u32 actionIdx) { } u8 func_8097E704(PlayState* play, u16 arg1, s32 arg2) { - CsCmdActorAction* action = DemoGt_GetNpcAction(play, arg2); + CsCmdActorCue* action = DemoGt_GetNpcAction(play, arg2); if ((action != NULL) && (action->action == arg1)) { return true; @@ -319,7 +319,7 @@ u8 func_8097E704(PlayState* play, u16 arg1, s32 arg2) { } void func_8097E744(DemoGt* this, PlayState* play, u32 actionIdx) { - CsCmdActorAction* npcAction = DemoGt_GetNpcAction(play, actionIdx); + CsCmdActorCue* npcAction = DemoGt_GetNpcAction(play, actionIdx); Vec3f* pos = &this->dyna.actor.world.pos; f32 startX; f32 startY; diff --git a/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c b/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c index 07219945a..c5515a6c1 100644 --- a/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c +++ b/soh/src/overlays/actors/ovl_Demo_Ik/z_demo_ik.c @@ -37,7 +37,7 @@ s32 DemoIk_UpdateSkelAnime(DemoIk* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* DemoIk_GetCue(PlayState* play, s32 index) { +CsCmdActorCue* DemoIk_GetCue(PlayState* play, s32 index) { if (play->csCtx.state != CS_STATE_IDLE) { return play->csCtx.npcActions[index]; } @@ -45,7 +45,7 @@ CsCmdActorAction* DemoIk_GetCue(PlayState* play, s32 index) { } s32 DemoIk_CheckCue(PlayState* play, u16 action, s32 index) { - CsCmdActorAction* cue = DemoIk_GetCue(play, index); + CsCmdActorCue* cue = DemoIk_GetCue(play, index); if ((cue != NULL) && (cue->action == action)) { return 1; @@ -147,7 +147,7 @@ void DemoIk_SpawnDeadDb(DemoIk* this, PlayState* play) { } void DemoIk_MoveToStartPos(DemoIk* this, PlayState* play, s32 index) { - CsCmdActorAction* cue = DemoIk_GetCue(play, index); + CsCmdActorCue* cue = DemoIk_GetCue(play, index); if (cue != NULL) { this->actor.world.pos.x = cue->startPos.x; @@ -208,7 +208,7 @@ void func_809839AC(DemoIk* this) { } void func_809839D0(DemoIk* this, PlayState* play) { - CsCmdActorAction* cue = DemoIk_GetCue(play, DemoIk_GetIndexFromParams(this->actor.params)); + CsCmdActorCue* cue = DemoIk_GetCue(play, DemoIk_GetIndexFromParams(this->actor.params)); if (cue != NULL) { s32 nextCsAction = cue->action; @@ -362,7 +362,7 @@ void func_8098402C(DemoIk* this) { } void func_80984048(DemoIk* this, PlayState* play) { - CsCmdActorAction* cue = DemoIk_GetCue(play, 4); + CsCmdActorCue* cue = DemoIk_GetCue(play, 4); if (cue != NULL) { s32 nextCsAction = cue->action; diff --git a/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 1a502127c..027539451 100644 --- a/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/soh/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -223,9 +223,9 @@ s32 DemoIm_IsCsStateIdle(PlayState* play) { } } -CsCmdActorAction* DemoIm_GetNpcAction(PlayState* play, s32 actionIdx) { +CsCmdActorCue* DemoIm_GetNpcAction(PlayState* play, s32 actionIdx) { s32 pad[2]; - CsCmdActorAction* ret = NULL; + CsCmdActorCue* ret = NULL; if (!DemoIm_IsCsStateIdle(play)) { ret = play->csCtx.npcActions[actionIdx]; @@ -234,7 +234,7 @@ CsCmdActorAction* DemoIm_GetNpcAction(PlayState* play, s32 actionIdx) { } s32 func_809850E8(DemoIm* this, PlayState* play, u16 action, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); + CsCmdActorCue* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { if (npcAction->action == action) { @@ -245,7 +245,7 @@ s32 func_809850E8(DemoIm* this, PlayState* play, u16 action, s32 actionIdx) { } s32 func_80985134(DemoIm* this, PlayState* play, u16 action, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); + CsCmdActorCue* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { if (npcAction->action != action) { @@ -256,7 +256,7 @@ s32 func_80985134(DemoIm* this, PlayState* play, u16 action, s32 actionIdx) { } void func_80985180(DemoIm* this, PlayState* play, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); + CsCmdActorCue* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -267,7 +267,7 @@ void func_80985180(DemoIm* this, PlayState* play, s32 actionIdx) { } void func_80985200(DemoIm* this, PlayState* play, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, actionIdx); + CsCmdActorCue* npcAction = DemoIm_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -614,7 +614,7 @@ void func_80986148(DemoIm* this) { } void func_809861C4(DemoIm* this, PlayState* play) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); + CsCmdActorCue* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; @@ -647,7 +647,7 @@ void func_8098629C(DemoIm* this, PlayState* play) { } void func_809862E0(DemoIm* this, PlayState* play) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); + CsCmdActorCue* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; @@ -777,7 +777,7 @@ void func_80986794(DemoIm* this) { } void func_8098680C(DemoIm* this, PlayState* play) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); + CsCmdActorCue* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; @@ -1055,7 +1055,7 @@ void func_809871B4(DemoIm* this, s32 arg1) { } void func_809871E8(DemoIm* this, PlayState* play) { - CsCmdActorAction* npcAction = DemoIm_GetNpcAction(play, 5); + CsCmdActorCue* npcAction = DemoIm_GetNpcAction(play, 5); if (npcAction != NULL) { u32 action = npcAction->action; diff --git a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index ed707ffad..719a8b7fa 100644 --- a/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/soh/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -376,7 +376,7 @@ void DemoKankyo_DoNothing2(DemoKankyo* this, PlayState* play) { void DemoKankyo_SetRockPos(DemoKankyo* this, PlayState* play, s32 params) { Vec3f startPos; Vec3f endPos; - CsCmdActorAction* csAction = play->csCtx.npcActions[params]; + CsCmdActorCue* csAction = play->csCtx.npcActions[params]; f32 temp_f0; startPos.x = csAction->startPos.x; diff --git a/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index 59b19c5c7..06efb9768 100644 --- a/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/soh/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -160,7 +160,7 @@ s32 DemoSa_UpdateSkelAnime(DemoSa* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* DemoSa_GetNpcAction(PlayState* play, s32 idx) { +CsCmdActorCue* DemoSa_GetNpcAction(PlayState* play, s32 idx) { if (play->csCtx.state != CS_STATE_IDLE) { return play->csCtx.npcActions[idx]; } @@ -168,7 +168,7 @@ CsCmdActorAction* DemoSa_GetNpcAction(PlayState* play, s32 idx) { } s32 func_8098E654(DemoSa* this, PlayState* play, u16 arg2, s32 arg3) { - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, arg3); + CsCmdActorCue* npcAction = DemoSa_GetNpcAction(play, arg3); if ((npcAction != NULL) && (npcAction->action == arg2)) { return 1; @@ -177,7 +177,7 @@ s32 func_8098E654(DemoSa* this, PlayState* play, u16 arg2, s32 arg3) { } s32 func_8098E6A0(DemoSa* this, PlayState* play, u16 arg2, s32 arg3) { - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, arg3); + CsCmdActorCue* npcAction = DemoSa_GetNpcAction(play, arg3); if ((npcAction != NULL) && (npcAction->action != arg2)) { return 1; @@ -186,7 +186,7 @@ s32 func_8098E6A0(DemoSa* this, PlayState* play, u16 arg2, s32 arg3) { } void func_8098E6EC(DemoSa* this, PlayState* play, s32 actionIdx) { - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, actionIdx); + CsCmdActorCue* npcAction = DemoSa_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -267,7 +267,7 @@ void func_8098E960(DemoSa* this, PlayState* play) { } void func_8098E9EC(DemoSa* this, PlayState* play) { - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; if (play->csCtx.state != CS_STATE_IDLE) { npcAction = play->csCtx.npcActions[4]; @@ -287,7 +287,7 @@ void func_8098EA3C(DemoSa* this) { } void func_8098EA68(DemoSa* this, PlayState* play) { - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; if (play->csCtx.state != CS_STATE_IDLE) { npcAction = play->csCtx.npcActions[4]; @@ -308,7 +308,7 @@ void func_8098EB00(DemoSa* this, s32 arg1) { } void func_8098EB6C(DemoSa* this, PlayState* play) { - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; if (play->csCtx.state != CS_STATE_IDLE) { npcAction = play->csCtx.npcActions[6]; @@ -552,7 +552,7 @@ void func_8098F610(DemoSa* this, s32 arg1) { void func_8098F654(DemoSa* this, PlayState* play) { s32 unk_1AC; s32 action; - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, 4); + CsCmdActorCue* npcAction = DemoSa_GetNpcAction(play, 4); if (npcAction != NULL) { action = npcAction->action; @@ -697,7 +697,7 @@ void func_8098FB34(DemoSa* this, s32 arg1) { void func_8098FB68(DemoSa* this, PlayState* play) { s32 unk_1AC; s32 action; - CsCmdActorAction* npcAction = DemoSa_GetNpcAction(play, 1); + CsCmdActorCue* npcAction = DemoSa_GetNpcAction(play, 1); if (npcAction != NULL) { action = npcAction->action; diff --git a/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c b/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c index eed364b3d..26ce36f95 100644 --- a/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c +++ b/soh/src/overlays/actors/ovl_Demo_Shd/z_demo_shd.c @@ -59,7 +59,7 @@ void func_80991298(DemoShd* this, PlayState* play) { } if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction0 = play->csCtx.npcActions[0]; + CsCmdActorCue* npcAction0 = play->csCtx.npcActions[0]; if (npcAction0 != NULL) { if (npcAction0->action == 2) { @@ -74,7 +74,7 @@ void func_80991298(DemoShd* this, PlayState* play) { } if (play->csCtx.state != CS_STATE_IDLE) { - CsCmdActorAction* npcAction1 = play->csCtx.npcActions[1]; + CsCmdActorCue* npcAction1 = play->csCtx.npcActions[1]; if (npcAction1 != NULL) { if (npcAction1->action == 2) { diff --git a/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 843e95f25..9daf8bf68 100644 --- a/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/soh/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -420,7 +420,7 @@ void func_80996C60(DoorShutter* this, PlayState* play) { DoorShutter_SetupAction(this, func_80997004); this->unk_16C = sp38; this->unk_170 = 0.0f; - Camera_ChangeDoorCam(play->cameraPtrs[MAIN_CAM], &this->dyna.actor, player->doorBgCamIndex, 0.0f, 12, sp34, 10); + Camera_ChangeDoorCam(play->cameraPtrs[MAIN_CAM], &this->dyna.actor, player->cv.slidingDoorBgCamIndex, 0.0f, 12, sp34, 10); } } @@ -558,7 +558,7 @@ void func_80997220(DoorShutter* this, PlayState* play) { } this->unk_164 = 0; this->dyna.actor.velocity.y = 0.0f; - if (DoorShutter_SetupDoor(this, play) && !(player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { + if (DoorShutter_SetupDoor(this, play) && !(player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) { DoorShutter_SetupAction(this, func_80997568); Player_SetCsActionWithHaltedActors(play, NULL, 2); } @@ -642,7 +642,7 @@ void DoorShutter_Update(Actor* thisx, PlayState* play) { DoorShutter* this = (DoorShutter*)thisx; Player* player = GET_PLAYER(play); - if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_IN_ITEM_CS)) || (this->actionFunc == DoorShutter_SetupType)) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_IN_ITEM_CS)) || (this->actionFunc == DoorShutter_SetupType)) { this->actionFunc(this, play); } } diff --git a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c index ac2fcb6f4..82a710c35 100644 --- a/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c +++ b/soh/src/overlays/actors/ovl_Efc_Erupc/z_efc_erupc.c @@ -147,7 +147,7 @@ void EfcErupc_Draw(Actor* thisx, PlayState* play) { gSPMatrix(POLY_XLU_DISP++, MATRIX_NEWMTX(play->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); if (play->csCtx.state != 0) { - CsCmdActorAction* csActorAction = play->csCtx.npcActions[2]; + CsCmdActorCue* csActorAction = play->csCtx.npcActions[2]; if (csActorAction != 0) { csAction = csActorAction->action; if ((csAction == 2) || (csAction == 3)) { diff --git a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c index 434556a51..e379f0095 100644 --- a/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/soh/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -238,11 +238,11 @@ void EnBom_Explode(EnBom* this, PlayState* play) { if (this->timer == 0) { player = GET_PLAYER(play); - if ((player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (player->heldActor == &this->actor)) { + if ((player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (player->heldActor == &this->actor)) { player->actor.child = NULL; player->heldActor = NULL; player->interactRangeActor = NULL; - player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; + player->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR; } Actor_Kill(&this->actor); diff --git a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 2eecc1fb3..f83aaf76b 100644 --- a/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/soh/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -164,7 +164,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) { player->heldActor = NULL; player->interactRangeActor = NULL; this->actor.parent = NULL; - player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; + player->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR; } } else if (this->bombCollider.base.acFlags & AC_HIT) { this->bombCollider.base.acFlags &= ~AC_HIT; @@ -200,7 +200,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) { player->heldActor = NULL; player->interactRangeActor = NULL; this->actor.parent = NULL; - player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; + player->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR; this->actor.world.pos = this->actor.home.pos; } } @@ -218,7 +218,7 @@ void EnBombf_GrowBomb(EnBombf* this, PlayState* play) { player->heldActor = NULL; player->interactRangeActor = NULL; this->actor.parent = NULL; - player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; + player->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR; this->actor.world.pos = this->actor.home.pos; } } @@ -302,11 +302,11 @@ void EnBombf_Explode(EnBombf* this, PlayState* play) { if (this->timer == 0) { player = GET_PLAYER(play); - if ((player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (player->heldActor == &this->actor)) { + if ((player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (player->heldActor == &this->actor)) { player->actor.child = NULL; player->heldActor = NULL; player->interactRangeActor = NULL; - player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; + player->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR; } Actor_Kill(&this->actor); diff --git a/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c index d5e082933..29385eaa4 100644 --- a/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/soh/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -188,7 +188,7 @@ void EnBoom_Fly(EnBoom* this, PlayState* play) { } } // Set player flags and kill the boomerang beacause Link caught it. - player->stateFlags1 &= ~PLAYER_STATE1_THREW_BOOMERANG; + player->stateFlags1 &= ~PLAYER_STATE1_BOOMERANG_THROWN; player->boomerangQuickRecall = false; Actor_Kill(&this->actor); } diff --git a/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.c b/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.c index d63982e14..997d9aaa5 100644 --- a/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/soh/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -237,7 +237,7 @@ void EnDh_Wait(EnDh* this, PlayState* play) { Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0x7D0, 0); SkelAnime_Update(&this->skelAnime); if (this->actor.params != ENDH_START_ATTACK_BOMB) { - func_8008EEAC(play, &this->actor); + Player_SetAutoLockOnActor(play, &this->actor); } } } diff --git a/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index 401ffbef4..95dbb144a 100644 --- a/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/soh/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -123,7 +123,7 @@ void EnDntJiji_Wait(EnDntJiji* this, PlayState* play) { SkelAnime_Update(&this->skelAnime); if ((this->timer == 1) && (this->actor.xzDistToPlayer < 150.0f) && !Play_InCsMode(play) && - !(player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { + !(player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) { OnePointCutscene_Init(play, 2230, -99, &this->actor, MAIN_CAM); this->timer = 0; Player_SetCsActionWithHaltedActors(play, NULL, 8); diff --git a/soh/src/overlays/actors/ovl_En_Du/z_en_du.c b/soh/src/overlays/actors/ovl_En_Du/z_en_du.c index 916d2a76e..20acdec4c 100644 --- a/soh/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/soh/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -254,13 +254,13 @@ void func_809FDE9C(EnDu* this) { } } -void func_809FDFC0(CsCmdActorAction* csAction, Vec3f* dst) { +void func_809FDFC0(CsCmdActorCue* csAction, Vec3f* dst) { dst->x = csAction->startPos.x; dst->y = csAction->startPos.y; dst->z = csAction->startPos.z; } -void func_809FE000(CsCmdActorAction* csAction, Vec3f* dst) { +void func_809FE000(CsCmdActorCue* csAction, Vec3f* dst) { dst->x = csAction->endPos.x; dst->y = csAction->endPos.y; dst->z = csAction->endPos.z; @@ -473,7 +473,7 @@ void func_809FE890(EnDu* this, PlayState* play) { Vec3f startPos; Vec3f endPos; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; - CsCmdActorAction* csAction; + CsCmdActorCue* csAction; if (play->csCtx.state == CS_STATE_IDLE) { Player_SetCsActionWithHaltedActors(play, &this->actor, 1); diff --git a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c index f6f82f5c7..477d60d64 100644 --- a/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/soh/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -1047,11 +1047,11 @@ void func_80A04414(EnElf* this, PlayState* play) { } if (this->fairyFlags & 1) { - if ((arrowPointedActor == NULL) || (player->unk_664 == NULL)) { + if ((arrowPointedActor == NULL) || (player->focusActor == NULL)) { this->fairyFlags ^= 1; } } else { - if ((arrowPointedActor != NULL) && (player->unk_664 != NULL)) { + if ((arrowPointedActor != NULL) && (player->focusActor != NULL)) { if (arrowPointedActor->category == ACTORCAT_NPC) { targetSound = NA_SE_VO_NAVY_HELLO; } else { @@ -1103,7 +1103,7 @@ void func_80A0461C(EnElf* this, PlayState* play) { } else if (arrowPointedActor == NULL || arrowPointedActor->category == ACTORCAT_NPC) { if (arrowPointedActor != NULL) { this->unk_2C0 = 100; - player->stateFlags2 |= PLAYER_STATE2_NAVI_OUT; + player->stateFlags2 |= PLAYER_STATE2_NAVI_ACTIVE; temp = 0; } else { switch (this->unk_2A8) { @@ -1124,7 +1124,7 @@ void func_80A0461C(EnElf* this, PlayState* play) { this->unk_2AE--; temp = 7; } else { - player->stateFlags2 |= PLAYER_STATE2_NAVI_OUT; + player->stateFlags2 |= PLAYER_STATE2_NAVI_ACTIVE; temp = 0; } } else { @@ -1154,7 +1154,7 @@ void func_80A0461C(EnElf* this, PlayState* play) { switch (temp) { case 0: - if (!(player->stateFlags2 & PLAYER_STATE2_NAVI_OUT)) { + if (!(player->stateFlags2 & PLAYER_STATE2_NAVI_ACTIVE)) { temp = 7; if (this->unk_2C7 == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_NAVY_VANISH); @@ -1162,7 +1162,7 @@ void func_80A0461C(EnElf* this, PlayState* play) { } break; case 8: - if (player->stateFlags2 & PLAYER_STATE2_NAVI_OUT) { + if (player->stateFlags2 & PLAYER_STATE2_NAVI_ACTIVE) { func_80A0299C(this, 0x32); this->unk_2C0 = 42; temp = 11; @@ -1172,10 +1172,10 @@ void func_80A0461C(EnElf* this, PlayState* play) { } break; case 7: - player->stateFlags2 &= ~PLAYER_STATE2_NAVI_OUT; + player->stateFlags2 &= ~PLAYER_STATE2_NAVI_ACTIVE; break; default: - player->stateFlags2 |= PLAYER_STATE2_NAVI_OUT; + player->stateFlags2 |= PLAYER_STATE2_NAVI_ACTIVE; break; } } @@ -1232,7 +1232,7 @@ void func_80A04DE4(EnElf* this, PlayState* play) { if (this->fairyFlags & 0x10) { naviRefPos = play->actorCtx.targetCtx.naviRefPos; - if ((player->unk_664 == NULL) || (&player->actor == player->unk_664) || (&this->actor == player->unk_664)) { + if ((player->focusActor == NULL) || (&player->actor == player->focusActor) || (&this->actor == player->focusActor)) { naviRefPos.x = player->bodyPartsPos[7].x + (Math_SinS(player->actor.shape.rot.y) * 20.0f); naviRefPos.y = player->bodyPartsPos[7].y + 5.0f; naviRefPos.z = player->bodyPartsPos[7].z + (Math_CosS(player->actor.shape.rot.y) * 20.0f); @@ -1384,7 +1384,7 @@ void func_80A053F0(Actor* thisx, PlayState* play) { EnElf* this = (EnElf*)thisx; if (player->naviTextId == 0) { - if (player->unk_664 == NULL) { + if (player->focusActor == NULL) { if (((gSaveContext.naviTimer >= 600) && (gSaveContext.naviTimer <= 3000)) || (nREG(89) != 0)) { player->naviTextId = ElfMessage_GetCUpText(play); @@ -1551,7 +1551,7 @@ void EnElf_Draw(Actor* thisx, PlayState* play) { void EnElf_GetCutsceneNextPos(Vec3f* vec, PlayState* play, s32 action) { Vec3f startPos; Vec3f endPos; - CsCmdActorAction* npcAction = play->csCtx.npcActions[action]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[action]; f32 lerp; startPos.x = npcAction->startPos.x; diff --git a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c index 0b3d69f3c..3101988a8 100644 --- a/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c +++ b/soh/src/overlays/actors/ovl_En_Ex_Item/z_en_ex_item.c @@ -389,7 +389,7 @@ void EnExItem_TargetPrizeApproach(EnExItem* this, PlayState* play) { this->actor.parent = NULL; if (!GameInteractor_Should(VB_PLAY_ONEPOINT_ACTOR_CS, true, &this->actor)) { - GET_PLAYER(play)->stateFlags1 &= ~(PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD); + GET_PLAYER(play)->stateFlags1 &= ~(PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_CARRYING_ACTOR); } if (CUR_UPG_VALUE(UPG_BULLET_BAG) == 1) { diff --git a/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c index c85ef69f5..766b15640 100644 --- a/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/soh/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -622,7 +622,7 @@ void EnFish_Cutscene_WiggleFlyingThroughAir(EnFish* this, PlayState* play) { void EnFish_UpdateCutscene(EnFish* this, PlayState* play) { s32 pad; s32 pad2; - CsCmdActorAction* csAction = play->csCtx.npcActions[1]; + CsCmdActorCue* csAction = play->csCtx.npcActions[1]; Vec3f startPos; Vec3f endPos; f32 progress; diff --git a/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 432116b2d..8b52be1fd 100644 --- a/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/soh/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -725,7 +725,7 @@ void EnGoroiwa_Update(Actor* thisx, PlayState* play) { s32 pad; s32 sp30; - if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE))) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE))) { if (this->collisionDisabledTimer > 0) { this->collisionDisabledTimer--; } diff --git a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c index a9fb3267e..82e5a70c9 100644 --- a/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/soh/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -13,7 +13,7 @@ #define FLAGS ACTOR_FLAG_UPDATE_WHILE_CULLED -typedef void (*EnHorseCsFunc)(EnHorse*, PlayState*, CsCmdActorAction*); +typedef void (*EnHorseCsFunc)(EnHorse*, PlayState*, CsCmdActorCue*); typedef void (*EnHorseActionFunc)(EnHorse*, PlayState*); void EnHorse_Init(Actor* thisx, PlayState* play); @@ -388,11 +388,11 @@ static s32 sIdleAnimIds[] = { 1, 3, 0, 3, 1, 0 }; static s16 sIngoAnimations[] = { 7, 6, 2, 2, 1, 1, 0, 0, 0, 0 }; -void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorCue* action); +void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorCue* action); +void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorCue* action); +void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorCue* action); +void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorCue* action); static EnHorseCsFunc sCutsceneInitFuncs[] = { NULL, @@ -403,11 +403,11 @@ static EnHorseCsFunc sCutsceneInitFuncs[] = { EnHorse_CsWarpRearingInit, }; -void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action); -void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action); +void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorCue* action); +void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorCue* action); +void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorCue* action); +void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorCue* action); +void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorCue* action); static EnHorseCsFunc sCutsceneActionFuncs[] = { NULL, EnHorse_CsMoveToPoint, EnHorse_CsJump, EnHorse_CsRearing, EnHorse_CsWarpMoveToPoint, EnHorse_CsWarpRearing, @@ -2104,7 +2104,7 @@ void EnHorse_UpdateIngoRace(EnHorse* this, PlayState* play) { &((EnIn*)this->rider)->animationIdx, &((EnIn*)this->rider)->unk_1E0); } -void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorCue* action) { this->animationIdx = ENHORSE_ANIM_GALLOP; this->cutsceneAction = 1; Animation_PlayOnceSetSpeed(&this->skin.skelAnime, sAnimationHeaders[this->type][this->animationIdx], @@ -2113,7 +2113,7 @@ void EnHorse_CsMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play); -void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorCue* action) { Vec3f endPos; f32 speed = 8.0f; @@ -2165,13 +2165,13 @@ void EnHorse_CsPlayHighJumpAnim(EnHorse* this, PlayState* play) { func_800AA000(0.0f, 170, 10, 10); } -void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsJumpInit(EnHorse* this, PlayState* play, CsCmdActorCue* action) { EnHorse_CsSetAnimHighJump(this, play); this->cutsceneAction = 2; this->cutsceneFlags &= ~1; } -void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorCue* action) { f32 temp_f2; if (this->cutsceneFlags & 1) { @@ -2223,7 +2223,7 @@ void EnHorse_CsJump(EnHorse* this, PlayState* play, CsCmdActorAction* action) { } } -void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorCue* action) { this->animationIdx = ENHORSE_ANIM_REARING; this->cutsceneAction = 3; this->cutsceneFlags &= ~4; @@ -2236,7 +2236,7 @@ void EnHorse_CsRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* act Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); } -void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorCue* action) { this->actor.speedXZ = 0.0f; if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { @@ -2259,7 +2259,7 @@ void EnHorse_CsRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) } } -void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorCue* action) { this->actor.world.pos.x = action->startPos.x; this->actor.world.pos.y = action->startPos.y; this->actor.world.pos.z = action->startPos.z; @@ -2272,7 +2272,7 @@ void EnHorse_WarpMoveInit(EnHorse* this, PlayState* play, CsCmdActorAction* acti this->actor.speedXZ * 0.3f); } -void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorCue* action) { Vec3f endPos; f32 speed = 8.0f; @@ -2296,7 +2296,7 @@ void EnHorse_CsWarpMoveToPoint(EnHorse* this, PlayState* play, CsCmdActorAction* } } -void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorCue* action) { this->actor.world.pos.x = action->startPos.x; this->actor.world.pos.y = action->startPos.y; this->actor.world.pos.z = action->startPos.z; @@ -2315,7 +2315,7 @@ void EnHorse_CsWarpRearingInit(EnHorse* this, PlayState* play, CsCmdActorAction* Animation_GetLastFrame(sAnimationHeaders[this->type][this->animationIdx]), ANIMMODE_ONCE, -3.0f); } -void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorAction* action) { +void EnHorse_CsWarpRearing(EnHorse* this, PlayState* play, CsCmdActorCue* action) { this->actor.speedXZ = 0.0f; if (this->curFrame > 25.0f) { if (!(this->stateFlags & ENHORSE_LAND2_SOUND)) { @@ -2362,7 +2362,7 @@ s32 EnHorse_GetCutsceneFunctionIndex(s32 csAction) { void EnHorse_CutsceneUpdate(EnHorse* this, PlayState* play) { s32 csFunctionIdx; - CsCmdActorAction* linkCsAction = play->csCtx.linkAction; + CsCmdActorCue* linkCsAction = play->csCtx.linkAction; if (play->csCtx.state == 3) { this->playerControlled = 1; diff --git a/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 39f8c587d..1fad5680b 100644 --- a/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/soh/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -1056,7 +1056,7 @@ s32 func_80A7707C(EnIk* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnIk_GetNpcAction(PlayState* play, s32 actionIdx) { +CsCmdActorCue* EnIk_GetNpcAction(PlayState* play, s32 actionIdx) { if (play->csCtx.state != CS_STATE_IDLE) { return play->csCtx.npcActions[actionIdx]; } else { @@ -1065,7 +1065,7 @@ CsCmdActorAction* EnIk_GetNpcAction(PlayState* play, s32 actionIdx) { } void func_80A770C0(EnIk* this, PlayState* play, s32 actionIdx) { - CsCmdActorAction* npcAction = EnIk_GetNpcAction(play, actionIdx); + CsCmdActorCue* npcAction = EnIk_GetNpcAction(play, actionIdx); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -1247,7 +1247,7 @@ void func_80A77844(EnIk* this, PlayState* play) { } void func_80A779DC(EnIk* this, PlayState* play) { - CsCmdActorAction* npcAction = EnIk_GetNpcAction(play, 4); + CsCmdActorCue* npcAction = EnIk_GetNpcAction(play, 4); u32 action; u32 currentNpcAction; diff --git a/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c index c24e00e84..c3ee312cc 100644 --- a/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/soh/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -232,7 +232,7 @@ s32 EnNb_UpdateSkelAnime(EnNb* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnNb_GetNpcCsAction(PlayState* play, s32 npcActionIdx) { +CsCmdActorCue* EnNb_GetNpcCsAction(PlayState* play, s32 npcActionIdx) { if (play->csCtx.state != CS_STATE_IDLE) { return play->csCtx.npcActions[npcActionIdx]; } @@ -240,7 +240,7 @@ CsCmdActorAction* EnNb_GetNpcCsAction(PlayState* play, s32 npcActionIdx) { } void EnNb_SetupCsPosRot(EnNb* this, PlayState* play, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, npcActionIdx); + CsCmdActorCue* csCmdNPCAction = EnNb_GetNpcCsAction(play, npcActionIdx); s16 newRotY; Actor* thisx = &this->actor; @@ -253,7 +253,7 @@ void EnNb_SetupCsPosRot(EnNb* this, PlayState* play, s32 npcActionIdx) { } s32 func_80AB1390(EnNb* this, PlayState* play, u16 arg2, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction; if ((play->csCtx.state != CS_STATE_IDLE) && (csCmdNPCAction = play->csCtx.npcActions[npcActionIdx], csCmdNPCAction != NULL) && @@ -264,7 +264,7 @@ s32 func_80AB1390(EnNb* this, PlayState* play, u16 arg2, s32 npcActionIdx) { } s32 func_80AB13D8(EnNb* this, PlayState* play, u16 arg2, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction; if ((play->csCtx.state != CS_STATE_IDLE) && (csCmdNPCAction = play->csCtx.npcActions[npcActionIdx], csCmdNPCAction != NULL) && @@ -275,7 +275,7 @@ s32 func_80AB13D8(EnNb* this, PlayState* play, u16 arg2, s32 npcActionIdx) { } void EnNb_SetInitialCsPosRot(EnNb* this, PlayState* play, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, npcActionIdx); + CsCmdActorCue* csCmdNPCAction = EnNb_GetNpcCsAction(play, npcActionIdx); Actor* thisx = &this->actor; if (csCmdNPCAction != NULL) { @@ -354,7 +354,7 @@ void EnNb_SetupChamberCsImpl(EnNb* this, PlayState* play) { void EnNb_SetupChamberWarpImpl(EnNb* this, PlayState* play) { CutsceneContext* csCtx = &play->csCtx; - CsCmdActorAction* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction; if (csCtx->state != CS_STATE_IDLE) { csCmdNPCAction = csCtx->npcActions[1]; @@ -375,7 +375,7 @@ void EnNb_SetupDefaultChamberIdle(EnNb* this) { void EnNb_SetupArmRaise(EnNb* this, PlayState* play) { AnimationHeader* animation = &gNabooruRaisingArmsGivingMedallionAnim; - CsCmdActorAction* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction; if (play->csCtx.state != CS_STATE_IDLE) { csCmdNPCAction = play->csCtx.npcActions[1]; @@ -398,7 +398,7 @@ void EnNb_SetupRaisedArmTransition(EnNb* this, s32 animFinished) { } void EnNb_SetupMedallion(EnNb* this, PlayState* play) { - CsCmdActorAction* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction; if (play->csCtx.state != CS_STATE_IDLE) { csCmdNPCAction = play->csCtx.npcActions[6]; @@ -587,7 +587,7 @@ void EnNb_PlayAgonySFX(EnNb* this, PlayState* play) { } void EnNb_SetPosInPortal(EnNb* this, PlayState* play) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); + CsCmdActorCue* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); Vec3f* pos = &this->actor.world.pos; f32 f0; s32 pad; @@ -642,7 +642,7 @@ void EnNb_SetupKidnap(EnNb* this) { } void EnNb_CheckKidnapCsMode(EnNb* this, PlayState* play) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); + CsCmdActorCue* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); s32 action; s32 previousCsAction; @@ -849,7 +849,7 @@ void EnNb_SetupConfrontationDestroy(EnNb* this) { } void EnNb_CheckConfrontationCsMode(EnNb* this, PlayState* play) { - CsCmdActorAction* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction; s32 csAction; s32 previousCsAction; @@ -1051,7 +1051,7 @@ void EnNb_CheckIfLookingUp(EnNb* this, s32 animFinished) { } void EnNb_CheckCreditsCsModeImpl(EnNb* this, PlayState* play) { - CsCmdActorAction* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); + CsCmdActorCue* csCmdNPCAction = EnNb_GetNpcCsAction(play, 1); s32 action; s32 previousCsAction; diff --git a/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 63f4fe3a3..a9c2a7361 100644 --- a/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/soh/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -156,7 +156,7 @@ void EnNutsball_Update(Actor* thisx, PlayState* play) { Player* player = GET_PLAYER(play); s32 pad; - if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE)) || (this->actionFunc == func_80ABBB34)) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE)) || (this->actionFunc == func_80ABBB34)) { this->actionFunc(this, play); Actor_MoveForward(&this->actor); diff --git a/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 5d75b7343..54fc2d2fa 100644 --- a/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/soh/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -629,7 +629,7 @@ void EnOkuta_Update(Actor* thisx, PlayState* play2) { Vec3f sp38; s32 sp34; - if (!(player->stateFlags1 & (PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE))) { + if (!(player->stateFlags1 & (PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE))) { if (this->actor.params == 0) { EnOkuta_ColliderCheck(this, play); if (!WaterBox_GetSurfaceImpl(play, &play->colCtx, this->actor.world.pos.x, diff --git a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c index e69cfda78..e90360bfa 100644 --- a/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/soh/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -340,8 +340,8 @@ void func_80AE2C1C(EnRd* this, PlayState* play) { if (this->unk_306 == 0) { if (!(this->unk_312 & PLAYER_STATE2_GRABBED_BY_ENEMY) && !CVarGetInteger(CVAR_CHEAT("NoRedeadFreeze"), 0)) { player->actor.freezeTimer = 40; - func_8008EEAC(play, &this->actor); - GET_PLAYER(play)->unk_684 = &this->actor; + Player_SetAutoLockOnActor(play, &this->actor); + GET_PLAYER(play)->autoLockOnActor = &this->actor; func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); } this->unk_306 = 0x3C; @@ -573,7 +573,7 @@ void func_80AE3834(EnRd* this, PlayState* play) { if (!(this->unk_312 & 0x80) && !CVarGetInteger(CVAR_CHEAT("NoRedeadFreeze"), 0)) { player->actor.freezeTimer = 60; func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); - func_8008EEAC(play, &this->actor); + Player_SetAutoLockOnActor(play, &this->actor); } Audio_PlayActorSound2(&this->actor, NA_SE_EN_REDEAD_AIM); func_80AE2B90(this, play); diff --git a/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.c b/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.c index 12b23037d..1aa5ccee1 100644 --- a/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/soh/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -86,7 +86,7 @@ s32 func_80AE7494(EnRl* this) { } s32 func_80AE74B4(EnRl* this, PlayState* play, u16 arg2, s32 arg3) { - CsCmdActorAction* csCmdActorAction; + CsCmdActorCue* csCmdActorAction; if (play->csCtx.state != CS_STATE_IDLE) { csCmdActorAction = play->csCtx.npcActions[arg3]; @@ -98,7 +98,7 @@ s32 func_80AE74B4(EnRl* this, PlayState* play, u16 arg2, s32 arg3) { } s32 func_80AE74FC(EnRl* this, PlayState* play, u16 arg2, s32 arg3) { - CsCmdActorAction* csCmdActorAction; + CsCmdActorCue* csCmdActorAction; if (play->csCtx.state != CS_STATE_IDLE) { csCmdActorAction = play->csCtx.npcActions[arg3]; @@ -143,7 +143,7 @@ void func_80AE7668(EnRl* this, PlayState* play) { } void func_80AE7698(EnRl* this, PlayState* play) { - CsCmdActorAction* csCmdActorAction; + CsCmdActorCue* csCmdActorAction; if (play->csCtx.state != CS_STATE_IDLE) { csCmdActorAction = play->csCtx.npcActions[0]; diff --git a/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 1ca46ddae..afc51e291 100644 --- a/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/soh/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -248,9 +248,9 @@ s32 EnRu1_IsCsStateIdle(PlayState* play) { return false; } -CsCmdActorAction* func_80AEAF58(PlayState* play, s32 npcActionIdx) { +CsCmdActorCue* func_80AEAF58(PlayState* play, s32 npcActionIdx) { s32 pad[2]; - CsCmdActorAction* ret = NULL; + CsCmdActorCue* ret = NULL; if (!EnRu1_IsCsStateIdle(play)) { ret = play->csCtx.npcActions[npcActionIdx]; @@ -259,7 +259,7 @@ CsCmdActorAction* func_80AEAF58(PlayState* play, s32 npcActionIdx) { } s32 func_80AEAFA0(PlayState* play, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AEAF58(play, npcActionIdx); + CsCmdActorCue* csCmdNPCAction = func_80AEAF58(play, npcActionIdx); if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action == action)) { return true; @@ -268,7 +268,7 @@ s32 func_80AEAFA0(PlayState* play, u16 action, s32 npcActionIdx) { } s32 func_80AEAFE0(PlayState* play, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AEAF58(play, npcActionIdx); + CsCmdActorCue* csCmdNPCAction = func_80AEAF58(play, npcActionIdx); if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action != action)) { return true; @@ -412,7 +412,7 @@ void func_80AEB3DC(EnRu1* this, PlayState* play) { EnRu1_SetMouthIndex(this, 0); } -CsCmdActorAction* func_80AEB438(PlayState* play) { +CsCmdActorCue* func_80AEB438(PlayState* play) { return func_80AEAF58(play, 3); } @@ -482,7 +482,7 @@ void func_80AEB7D0(EnRu1* this) { this->skelAnime.moveFlags &= ~0x3; } -f32 func_80AEB7E0(CsCmdActorAction* csCmdNPCAction, PlayState* play) { +f32 func_80AEB7E0(CsCmdActorCue* csCmdNPCAction, PlayState* play) { s32 csCtxFrames = play->csCtx.frames; if ((csCtxFrames < csCmdNPCAction->endFrame) && (csCmdNPCAction->endFrame - csCmdNPCAction->startFrame > 0)) { @@ -500,7 +500,7 @@ f32 func_80AEB87C(f32 arg0, s32 arg1, s32 arg2) { } void func_80AEB89C(EnRu1* this, PlayState* play) { - CsCmdActorAction* npcAction = func_80AEB438(play); + CsCmdActorCue* npcAction = func_80AEB438(play); s16 npcActionRotY; if (npcAction != NULL) { @@ -528,7 +528,7 @@ void func_80AEB954(EnRu1* this, PlayState* play) { void func_80AEB974(EnRu1* this, PlayState* play) { Vec3f* thisPos; f32 sp30; - CsCmdActorAction* csCmdNPCAction = func_80AEB438(play); + CsCmdActorCue* csCmdNPCAction = func_80AEB438(play); s32 pad; if (csCmdNPCAction != NULL) { @@ -549,7 +549,7 @@ void func_80AEBA2C(EnRu1* this, PlayState* play) { Vec3f* unk_364 = &this->unk_364; Vec3f* thisPos; f32 temp_ret_2; - CsCmdActorAction* csCmdNPCAction = func_80AEB438(play); + CsCmdActorCue* csCmdNPCAction = func_80AEB438(play); s32 pad2; if (csCmdNPCAction != NULL) { @@ -675,7 +675,7 @@ void func_80AEBF60(EnRu1* this, PlayState* play) { } void func_80AEBFD8(EnRu1* this, PlayState* play) { - CsCmdActorAction* csCmdNPCAction = func_80AEB438(play); + CsCmdActorCue* csCmdNPCAction = func_80AEB438(play); f32 frameCount; u16 csCtxFrames; u16 endFrame; @@ -878,7 +878,7 @@ void func_80AEC780(EnRu1* this, PlayState* play) { } void func_80AEC81C(EnRu1* this, PlayState* play) { - CsCmdActorAction* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction; s16 newRotY; if (func_80AEAFE0(play, 1, 3)) { @@ -1653,7 +1653,7 @@ void func_80AEE7C4(EnRu1* this, PlayState* play) { } player = GET_PLAYER(play); - if (player->stateFlags2 & PLAYER_STATE2_IDLING) { + if (player->stateFlags2 & PLAYER_STATE2_IDLE_FIDGET) { this->unk_370 += 1.0f; if (this->action != 32) { if (*unk_370 > 30.0f) { @@ -1953,8 +1953,8 @@ void func_80AEF5B8(EnRu1* this) { void func_80AEF624(EnRu1* this, PlayState* play) { f32 frameCount; - CsCmdActorAction* csCmdNPCAction; - CsCmdActorAction* csCmdNPCAction2; + CsCmdActorCue* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction2; s16 newRotTmp; if (func_80AEAFE0(play, 1, 3)) { diff --git a/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index 2905390bb..dee36edfa 100644 --- a/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/soh/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -176,7 +176,7 @@ s32 EnRu2_UpdateSkelAnime(EnRu2* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* func_80AF27AC(PlayState* play, s32 npcActionIdx) { +CsCmdActorCue* func_80AF27AC(PlayState* play, s32 npcActionIdx) { if (play->csCtx.state != CS_STATE_IDLE) { return play->csCtx.npcActions[npcActionIdx]; } @@ -184,7 +184,7 @@ CsCmdActorAction* func_80AF27AC(PlayState* play, s32 npcActionIdx) { } s32 func_80AF27D0(EnRu2* this, PlayState* play, u16 arg2, s32 npcActionIdx) { - CsCmdActorAction* csCmdActorAction = func_80AF27AC(play, npcActionIdx); + CsCmdActorCue* csCmdActorAction = func_80AF27AC(play, npcActionIdx); if ((csCmdActorAction != NULL) && (csCmdActorAction->action == arg2)) { return true; @@ -193,7 +193,7 @@ s32 func_80AF27D0(EnRu2* this, PlayState* play, u16 arg2, s32 npcActionIdx) { } s32 func_80AF281C(EnRu2* this, PlayState* play, u16 arg2, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AF27AC(play, npcActionIdx); + CsCmdActorCue* csCmdNPCAction = func_80AF27AC(play, npcActionIdx); if ((csCmdNPCAction != NULL) && (csCmdNPCAction->action != arg2)) { return true; @@ -202,7 +202,7 @@ s32 func_80AF281C(EnRu2* this, PlayState* play, u16 arg2, s32 npcActionIdx) { } void func_80AF2868(EnRu2* this, PlayState* play, u32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = func_80AF27AC(play, npcActionIdx); + CsCmdActorCue* csCmdNPCAction = func_80AF27AC(play, npcActionIdx); s16 newRotY; Actor* thisx = &this->actor; @@ -287,7 +287,7 @@ void func_80AF2AB4(EnRu2* this, PlayState* play) { void func_80AF2B44(EnRu2* this, PlayState* play) { CutsceneContext* csCtx = &play->csCtx; - CsCmdActorAction* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction; if (csCtx->state != CS_STATE_IDLE) { csCmdNPCAction = csCtx->npcActions[3]; @@ -308,7 +308,7 @@ void func_80AF2B94(EnRu2* this) { void func_80AF2BC0(EnRu2* this, PlayState* play) { AnimationHeader* animation = &gAdultRutoRaisingArmsUpAnim; - CsCmdActorAction* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction; if (play->csCtx.state != CS_STATE_IDLE) { csCmdNPCAction = play->csCtx.npcActions[3]; @@ -327,7 +327,7 @@ void func_80AF2C54(EnRu2* this, s32 arg1) { } void func_80AF2C68(EnRu2* this, PlayState* play) { - CsCmdActorAction* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction; if (play->csCtx.state != CS_STATE_IDLE) { csCmdNPCAction = play->csCtx.npcActions[6]; @@ -544,7 +544,7 @@ void func_80AF3530(EnRu2* this, s32 arg1) { } void func_80AF3564(EnRu2* this, PlayState* play) { - CsCmdActorAction* csCmdNPCAction = func_80AF27AC(play, 3); + CsCmdActorCue* csCmdNPCAction = func_80AF27AC(play, 3); s32 action; s32 unk_2BC; diff --git a/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c index ff36e98d0..ca1da32cc 100644 --- a/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/soh/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -463,13 +463,13 @@ void func_80AF609C(EnSa* this) { } } -void func_80AF6130(CsCmdActorAction* csAction, Vec3f* dst) { +void func_80AF6130(CsCmdActorCue* csAction, Vec3f* dst) { dst->x = csAction->startPos.x; dst->y = csAction->startPos.y; dst->z = csAction->startPos.z; } -void func_80AF6170(CsCmdActorAction* csAction, Vec3f* dst) { +void func_80AF6170(CsCmdActorCue* csAction, Vec3f* dst) { dst->x = csAction->endPos.x; dst->y = csAction->endPos.y; dst->z = csAction->endPos.z; @@ -639,7 +639,7 @@ void func_80AF68E4(EnSa* this, PlayState* play) { Vec3f startPos; Vec3f endPos; Vec3f D_80AF7448 = { 0.0f, 0.0f, 0.0f }; - CsCmdActorAction* csAction; + CsCmdActorCue* csAction; f32 temp_f0; f32 gravity; diff --git a/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 0063b7c31..6a4676fdd 100644 --- a/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/soh/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -580,7 +580,7 @@ s32 func_80B150AC(EnTa* this, PlayState* play, s32 idx) { Player* player = GET_PLAYER(play); Actor* interactRangeActor; - if (player->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + if (player->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { interactRangeActor = player->interactRangeActor; if (interactRangeActor != NULL && interactRangeActor->id == ACTOR_EN_NIW && interactRangeActor == &this->superCuccos[idx]->actor) { @@ -614,7 +614,7 @@ void func_80B15100(EnTa* this, PlayState* play) { if (player->heldActor == &this->superCuccos[unk_2CA]->actor) { player->heldActor = NULL; } - player->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; + player->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR; this->superCuccos[unk_2CA] = NULL; } this->unk_2E0 |= 1; diff --git a/soh/src/overlays/actors/ovl_En_Test/z_en_test.c b/soh/src/overlays/actors/ovl_En_Test/z_en_test.c index 1f4be6670..75c4f6c6a 100644 --- a/soh/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/soh/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -407,7 +407,7 @@ void EnTest_ChooseAction(EnTest* this, PlayState* play) { } else { if (this->actor.xzDistToPlayer < 110.0f) { if (Rand_ZeroOne() > 0.2f) { - if (player->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) { + if (player->stateFlags1 & PLAYER_STATE1_HOSTILE_LOCK_ON) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); } else { @@ -693,7 +693,7 @@ void EnTest_WalkAndBlock(EnTest* this, PlayState* play) { if (this->actor.xzDistToPlayer < 110.0f) { if (Rand_ZeroOne() > 0.2f) { - if (player->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) { + if (player->stateFlags1 & PLAYER_STATE1_HOSTILE_LOCK_ON) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); } else { @@ -978,7 +978,7 @@ void EnTest_SlashDownEnd(EnTest* this, PlayState* play) { if ((ABS(yawDiff) > 0x3E80) && (this->actor.params != STALFOS_TYPE_CEILING)) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; EnTest_SetupJumpBack(this); - } else if (player->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) { + } else if (player->stateFlags1 & PLAYER_STATE1_HOSTILE_LOCK_ON) { if (this->actor.isTargeted) { EnTest_SetupSlashDown(this); } else if ((play->gameplayFrames % 2) != 0) { diff --git a/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 9e9fc82f5..51b1d9e53 100644 --- a/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/soh/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -136,7 +136,7 @@ void EnTorch2_Init(Actor* thisx, PlayState* play2) { sInput.cur.stick_x = sInput.cur.stick_y = 0; this->currentShield = PLAYER_SHIELD_HYLIAN; this->heldItemAction = this->heldItemId = PLAYER_IA_SWORD_MASTER; - Player_SetModelGroup(this, PLAYER_MODELGROUP_SWORD); + Player_SetModelGroup(this, PLAYER_MODELGROUP_SWORD_AND_SHIELD); play->playerInit(this, play, &gDarkLinkSkel); this->actor.naviEnemyId = 0x26; this->cylinder.base.acFlags = AC_ON | AC_TYPE_PLAYER; @@ -604,7 +604,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { if ((this->actor.colChkInfo.health == 0) && sDeathFlag) { this->csAction = 0x18; this->csActor = &player->actor; - this->doorBgCamIndex = 1; + this->cv.haltActorsDuringCsAction = true; sDeathFlag = false; } if ((this->invincibilityTimer == 0) && (this->actor.colChkInfo.health != 0) && @@ -614,11 +614,11 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { if (!Actor_ApplyDamage(&this->actor)) { func_800F5B58(); this->actor.flags &= ~(ACTOR_FLAG_TARGETABLE | 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 = 2; + 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); @@ -634,11 +634,11 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { } } else { this->actor.flags &= ~ACTOR_FLAG_TARGETABLE; - 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 = 1; + this->knockbackYVelocity = 6.0f; + this->knockbackSpeed = 8.0f; + this->knockbackRot = this->actor.yawTowardsPlayer + 0x8000; Actor_SetDropFlag(&this->actor, &this->cylinder.info, 1); this->stateFlags3 &= ~PLAYER_STATE3_PAUSE_ACTION_FUNC; this->stateFlags3 |= PLAYER_STATE3_IGNORE_CEILING_FLOOR_WATER; @@ -651,7 +651,7 @@ void EnTorch2_Update(Actor* thisx, PlayState* play2) { } } this->actor.colChkInfo.damage = 0; - this->unk_8A0 = 0; + this->knockbackDamage = 0; } // Handles being frozen by a deku nut diff --git a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c index 991853c55..512c11766 100644 --- a/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/soh/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -122,8 +122,8 @@ s32 EnXc_AnimIsFinished(EnXc* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnXc_GetCsCmd(PlayState* play, s32 npcActionIdx) { - CsCmdActorAction* action = NULL; +CsCmdActorCue* EnXc_GetCsCmd(PlayState* play, s32 npcActionIdx) { + CsCmdActorCue* action = NULL; if (play->csCtx.state != 0) { action = play->csCtx.npcActions[npcActionIdx]; @@ -132,7 +132,7 @@ CsCmdActorAction* EnXc_GetCsCmd(PlayState* play, s32 npcActionIdx) { } s32 EnXc_CompareCsAction(EnXc* this, PlayState* play, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdActorAction = EnXc_GetCsCmd(play, npcActionIdx); + CsCmdActorCue* csCmdActorAction = EnXc_GetCsCmd(play, npcActionIdx); if (csCmdActorAction != NULL && csCmdActorAction->action == action) { return true; @@ -141,7 +141,7 @@ s32 EnXc_CompareCsAction(EnXc* this, PlayState* play, u16 action, s32 npcActionI } s32 EnXc_CsActionsAreNotEqual(EnXc* this, PlayState* play, u16 action, s32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnXc_GetCsCmd(play, npcActionIdx); + CsCmdActorCue* csCmdNPCAction = EnXc_GetCsCmd(play, npcActionIdx); if (csCmdNPCAction && csCmdNPCAction->action != action) { return true; @@ -150,7 +150,7 @@ s32 EnXc_CsActionsAreNotEqual(EnXc* this, PlayState* play, u16 action, s32 npcAc } void func_80B3C588(EnXc* this, PlayState* play, u32 npcActionIdx) { - CsCmdActorAction* csCmdNPCAction = EnXc_GetCsCmd(play, npcActionIdx); + CsCmdActorCue* csCmdNPCAction = EnXc_GetCsCmd(play, npcActionIdx); Actor* thisx = &this->actor; if (csCmdNPCAction != NULL) { @@ -164,7 +164,7 @@ void func_80B3C588(EnXc* this, PlayState* play, u32 npcActionIdx) { } void func_80B3C620(EnXc* this, PlayState* play, s32 npcActionIdx) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, npcActionIdx); + CsCmdActorCue* npcAction = EnXc_GetCsCmd(play, npcActionIdx); Vec3f* xcPos = &this->actor.world.pos; f32 startX; f32 startY; @@ -528,7 +528,7 @@ s32 sEnXcFlameSpawned = false; void EnXc_SpawnFlame(EnXc* this, PlayState* play) { if (!sEnXcFlameSpawned) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); + CsCmdActorCue* npcAction = EnXc_GetCsCmd(play, 0); f32 xPos = npcAction->startPos.x; f32 yPos = npcAction->startPos.y; f32 zPos = npcAction->startPos.z; @@ -540,7 +540,7 @@ void EnXc_SpawnFlame(EnXc* this, PlayState* play) { void EnXc_SetupFlamePos(EnXc* this, PlayState* play) { Vec3f* attachedPos; - CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); + CsCmdActorCue* npcAction = EnXc_GetCsCmd(play, 0); if (this->flameActor != NULL) { attachedPos = &this->flameActor->world.pos; @@ -565,7 +565,7 @@ void EnXc_InitFlame(EnXc* this, PlayState* play) { s16 sceneNum = play->sceneNum; if (sceneNum == SCENE_DEATH_MOUNTAIN_CRATER) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); + CsCmdActorCue* npcAction = EnXc_GetCsCmd(play, 0); if (npcAction != NULL) { s32 action = npcAction->action; @@ -588,7 +588,7 @@ void EnXc_InitFlame(EnXc* this, PlayState* play) { void func_80B3D48C(EnXc* this, PlayState* play) { CutsceneContext* csCtx = &play->csCtx; - CsCmdActorAction* linkAction = csCtx->linkAction; + CsCmdActorCue* linkAction = csCtx->linkAction; s16 yaw; if (linkAction != NULL) { @@ -603,7 +603,7 @@ void func_80B3D48C(EnXc* this, PlayState* play) { AnimationHeader* EnXc_GetCurrentHarpAnim(PlayState* play, s32 index) { AnimationHeader* animation = &gSheikPlayingHarp5Anim; - CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, index); + CsCmdActorCue* npcAction = EnXc_GetCsCmd(play, index); if (npcAction != NULL) { u16 action = npcAction->action; @@ -677,7 +677,7 @@ void EnXc_SetupFallFromSkyAction(EnXc* this, PlayState* play) { CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { - CsCmdActorAction* npcAction = csCtx->npcActions[4]; + CsCmdActorCue* npcAction = csCtx->npcActions[4]; if (npcAction && npcAction->action == 2) { s32 pad; @@ -752,7 +752,7 @@ void EnXc_SetupStoppedAction(EnXc* this) { } void func_80B3DAF0(EnXc* this, PlayState* play) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 4); + CsCmdActorCue* npcAction = EnXc_GetCsCmd(play, 4); u16 action; if (npcAction && @@ -799,7 +799,7 @@ void func_80B3DCA8(EnXc* this, PlayState* play) { f32 frameCount; if (play->csCtx.state != 0) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL && npcAction->action == 8) { frameCount = Animation_GetLastFrame(&gSheikInitialHarpAnim); @@ -848,7 +848,7 @@ void func_80B3DE78(EnXc* this, s32 animFinished) { void EnXc_SetupReverseAccel(EnXc* this, PlayState* play) { if (play->csCtx.state != 0) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL && npcAction->action == 4) { Animation_Change(&this->skelAnime, &gSheikWalkingAnim, -1.0f, Animation_GetLastFrame(&gSheikWalkingAnim), @@ -900,7 +900,7 @@ void func_80B3E164(EnXc* this, PlayState* play) { void EnXc_SetupDisappear(EnXc* this, PlayState* play) { if (play->csCtx.state != 0) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL && npcAction->action == 9) { s16 sceneNum = play->sceneNum; @@ -1164,7 +1164,7 @@ void func_80B3EC0C(EnXc* this, PlayState* play) { CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { - CsCmdActorAction* npcAction = csCtx->npcActions[4]; + CsCmdActorCue* npcAction = csCtx->npcActions[4]; if ((npcAction != NULL) && (npcAction->action != 1)) { PosRot* posRot = &this->actor.world; @@ -1187,7 +1187,7 @@ void func_80B3EC90(EnXc* this, PlayState* play) { CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { - CsCmdActorAction* npcAction = csCtx->npcActions[4]; + CsCmdActorCue* npcAction = csCtx->npcActions[4]; if (npcAction != NULL && npcAction->action != 6) { func_80B3C9EC(this); @@ -1413,7 +1413,7 @@ void EnXc_PlayDiveSFX(Vec3f* src, PlayState* play) { } void EnXc_LakeHyliaDive(PlayState* play) { - CsCmdActorAction* npcAction = npcAction = EnXc_GetCsCmd(play, 0); + CsCmdActorCue* npcAction = npcAction = EnXc_GetCsCmd(play, 0); if (npcAction != NULL) { Vec3f startPos; @@ -1442,7 +1442,7 @@ void func_80B3F534(PlayState* play) { s32 D_80B41DAC = 1; void func_80B3F59C(EnXc* this, PlayState* play) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 0); + CsCmdActorCue* npcAction = EnXc_GetCsCmd(play, 0); if (npcAction != NULL) { s32 action = npcAction->action; @@ -1649,7 +1649,7 @@ void func_80B3FF0C(EnXc* this, PlayState* play) { CutsceneContext* csCtx = &play->csCtx; if (csCtx->state != 0) { - CsCmdActorAction* npcAction = play->csCtx.npcActions[4]; + CsCmdActorCue* npcAction = play->csCtx.npcActions[4]; if (npcAction != NULL) { PosRot* posRot = &this->actor.world; @@ -1984,7 +1984,7 @@ void func_80B40E88(EnXc* this) { } s32 EnXc_SetupNocturneState(Actor* thisx, PlayState* play) { - CsCmdActorAction* npcAction = EnXc_GetCsCmd(play, 4); + CsCmdActorCue* npcAction = EnXc_GetCsCmd(play, 4); if (npcAction != NULL) { s32 action = npcAction->action; diff --git a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c index 03fb95bd3..4ecf2afee 100644 --- a/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c +++ b/soh/src/overlays/actors/ovl_En_Zf/z_en_zf.c @@ -542,7 +542,7 @@ s32 EnZf_CanAttack(PlayState* play, EnZf* this) { return true; } if (this->actor.params == ENZF_TYPE_DINOLFOS) { - targetedActor = player->unk_664; + targetedActor = player->focusActor; if (targetedActor == NULL) { return false; } else { @@ -1208,7 +1208,7 @@ void EnZf_Slash(EnZf* this, PlayState* play) { if (yawDiff > 16000) { this->actor.world.rot.y = this->actor.yawTowardsPlayer; func_80B483E4(this, play); - } else if (player->stateFlags1 & (PLAYER_STATE1_ENEMY_TARGET | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE)) { + } else if (player->stateFlags1 & (PLAYER_STATE1_HOSTILE_LOCK_ON | PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE)) { if (this->actor.isTargeted) { EnZf_SetupSlash(this); } else { diff --git a/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 7234ed57f..584ab5686 100644 --- a/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/soh/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -331,13 +331,13 @@ void func_80B4B240(EnZl1* this, PlayState* play) { func_80038290(play, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); } -void func_80B4B7F4(CsCmdActorAction* npcAction, Vec3f* pos) { +void func_80B4B7F4(CsCmdActorCue* npcAction, Vec3f* pos) { pos->x = npcAction->startPos.x; pos->y = npcAction->startPos.y; pos->z = npcAction->startPos.z; } -void func_80B4B834(CsCmdActorAction* npcAction, Vec3f* pos) { +void func_80B4B834(CsCmdActorCue* npcAction, Vec3f* pos) { pos->x = npcAction->endPos.x; pos->y = npcAction->endPos.y; pos->z = npcAction->endPos.z; @@ -368,7 +368,7 @@ void func_80B4B8B4(EnZl1* this, PlayState* play) { Vec3f sp8C = { -512.0f, 105.0f, -4.0f }; s32 pad2; f32 actionLength; - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; Vec3f sp74; Vec3f sp68; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; @@ -450,7 +450,7 @@ void func_80B4BC78(EnZl1* this, PlayState* play) { Vec3f sp70; Vec3f sp64; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; s32 pad; f32 frameCount; diff --git a/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index 79e3e95e4..1b0b39aa5 100644 --- a/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/soh/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -212,7 +212,7 @@ s32 EnZl2_UpdateSkelAnime(EnZl2* this) { return SkelAnime_Update(&this->skelAnime); } -CsCmdActorAction* EnZl2_GetNpcAction(PlayState* play, s32 idx) { +CsCmdActorCue* EnZl2_GetNpcAction(PlayState* play, s32 idx) { if (play->csCtx.state != CS_STATE_IDLE) { return play->csCtx.npcActions[idx]; } @@ -220,7 +220,7 @@ CsCmdActorAction* EnZl2_GetNpcAction(PlayState* play, s32 idx) { } void func_80B4EDB8(EnZl2* this, PlayState* play, s32 arg2) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, arg2); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, arg2); if (npcAction != NULL) { this->actor.world.pos.x = npcAction->startPos.x; @@ -683,7 +683,7 @@ void func_80B5008C(EnZl2* this) { } void func_80B500E0(EnZl2* this, PlayState* play) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); Vec3f* thisPos = &this->actor.world.pos; f32 startX; f32 startY; @@ -715,7 +715,7 @@ void func_80B501C4(EnZl2* this, s32 alpha) { } void func_80B501E8(EnZl2* this, PlayState* play) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); if (npcAction != NULL) { this->actor.shape.shadowAlpha = this->alpha = @@ -732,7 +732,7 @@ void func_80B50260(EnZl2* this, PlayState* play) { } void func_80B50278(EnZl2* this, PlayState* play) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); this->actor.world.pos.x = npcAction->startPos.x; this->actor.world.pos.y = npcAction->startPos.y; @@ -746,7 +746,7 @@ void func_80B50278(EnZl2* this, PlayState* play) { void func_80B50304(EnZl2* this, PlayState* play) { s32 pad[2]; ActorShape* shape = &this->actor.shape; - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); f32 actionXDelta; f32 actionZDelta; @@ -761,7 +761,7 @@ void func_80B50304(EnZl2* this, PlayState* play) { } void func_80B503DC(EnZl2* this, PlayState* play) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); if ((npcAction != NULL) && (play->csCtx.frames >= npcAction->endFrame)) { this->action = 4; @@ -906,7 +906,7 @@ void func_80B50980(EnZl2* this, PlayState* play) { } void func_80B509A0(EnZl2* this, PlayState* play) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); if (npcAction != NULL) { if (play->csCtx.frames >= npcAction->endFrame) { @@ -918,7 +918,7 @@ void func_80B509A0(EnZl2* this, PlayState* play) { } void func_80B50A04(EnZl2* this, PlayState* play) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); s32 newAction; s32 unk_240; @@ -1329,7 +1329,7 @@ void func_80B518C0(EnZl2* this) { } void func_80B51948(EnZl2* this, PlayState* play) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); s32 newAction; s32 unk_240; @@ -1450,7 +1450,7 @@ void func_80B51D24(EnZl2* this, PlayState* play) { } void func_80B51DA4(EnZl2* this, PlayState* play) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); Vec3f* thisPos = &this->actor.world.pos; f32 startX; f32 startY; @@ -1486,7 +1486,7 @@ void func_80B51EA8(EnZl2* this) { void func_80B51EBC(EnZl2* this, PlayState* play) { ActorShape* shape = &this->actor.shape; - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); s32 pad[2]; this->actor.world.rot.y = shape->rot.y = npcAction->rot.y; @@ -1497,7 +1497,7 @@ void func_80B51EBC(EnZl2* this, PlayState* play) { } void func_80B51F38(EnZl2* this, PlayState* play) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); if (npcAction != NULL) { if (play->csCtx.frames - 8 >= npcAction->endFrame) { @@ -1508,7 +1508,7 @@ void func_80B51F38(EnZl2* this, PlayState* play) { } void func_80B51FA8(EnZl2* this, PlayState* play) { - CsCmdActorAction* npcAction = EnZl2_GetNpcAction(play, 0); + CsCmdActorCue* npcAction = EnZl2_GetNpcAction(play, 0); s32 action; s32 unk_240; diff --git a/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index e50ba85d5..cdb88cc48 100644 --- a/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/soh/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -314,7 +314,7 @@ void func_80B5BB78(EnZl4* this, PlayState* play) { Npc_TrackPoint(&this->actor, &this->interactInfo, 2, NPC_TRACKING_HEAD_AND_TORSO); } -void EnZl4_GetActionStartPos(CsCmdActorAction* action, Vec3f* vec) { +void EnZl4_GetActionStartPos(CsCmdActorCue* action, Vec3f* vec) { vec->x = action->startPos.x; vec->y = action->startPos.y; vec->z = action->startPos.z; @@ -1213,7 +1213,7 @@ void EnZl4_Idle(EnZl4* this, PlayState* play) { void EnZl4_TheEnd(EnZl4* this, PlayState* play) { s32 animIndex[] = { ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_0, ZL4_ANIM_26, ZL4_ANIM_21, ZL4_ANIM_3 }; - CsCmdActorAction* npcAction; + CsCmdActorCue* npcAction; Vec3f pos; if (SkelAnime_Update(&this->skelAnime) && (this->skelAnime.animation == &gChildZeldaAnim_010DF8)) { diff --git a/soh/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c b/soh/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c index 94416ff5d..0a1736dc4 100644 --- a/soh/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c +++ b/soh/src/overlays/actors/ovl_Obj_Dekujr/z_obj_dekujr.c @@ -73,20 +73,20 @@ void ObjDekujr_Init(Actor* thisx, PlayState* play) { void ObjDekujr_Destroy(Actor* thisx, PlayState* play) { } -void ObjDekujr_SetInitialPos(CsCmdActorAction* npcAction, Vec3f* initPos) { +void ObjDekujr_SetInitialPos(CsCmdActorCue* npcAction, Vec3f* initPos) { initPos->x = npcAction->startPos.x; initPos->y = npcAction->startPos.y; initPos->z = npcAction->startPos.z; } -void ObjDekujr_SetFinalPos(CsCmdActorAction* npcAction, Vec3f* finalPos) { +void ObjDekujr_SetFinalPos(CsCmdActorCue* npcAction, Vec3f* finalPos) { finalPos->x = npcAction->endPos.x; finalPos->y = npcAction->endPos.y; finalPos->z = npcAction->endPos.z; } void ObjDekujr_ComeUp(ObjDekujr* this, PlayState* play) { - CsCmdActorAction* csCmdNPCAction; + CsCmdActorCue* csCmdNPCAction; Vec3f initPos; Vec3f finalPos; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; diff --git a/soh/src/overlays/actors/ovl_player_actor/z_player.c b/soh/src/overlays/actors/ovl_player_actor/z_player.c index bddbfa656..fc0837f74 100644 --- a/soh/src/overlays/actors/ovl_player_actor/z_player.c +++ b/soh/src/overlays/actors/ovl_player_actor/z_player.c @@ -47,24 +47,17 @@ typedef enum { /* 0x03 */ KNOB_ANIM_CHILD_R } KnobDoorAnim; -typedef struct { +typedef struct ExplosiveInfo { /* 0x00 */ u8 itemId; /* 0x02 */ s16 actorId; } ExplosiveInfo; // size = 0x04 -typedef struct { - /* 0x00 */ s16 actorId; - /* 0x02 */ u8 itemId; - /* 0x03 */ u8 itemAction; - /* 0x04 */ u8 textId; -} BottleCatchInfo; // size = 0x06 - -typedef struct { +typedef struct BottleDropInfo { /* 0x00 */ s16 actorId; /* 0x02 */ s16 actorParams; } BottleDropInfo; // size = 0x04 -typedef struct { +typedef struct FallImpactInfo { /* 0x00 */ s8 damage; /* 0x01 */ u8 rumbleStrength; /* 0x02 */ u8 rumbleDuration; @@ -72,21 +65,21 @@ typedef struct { /* 0x04 */ u16 sfxId; } FallImpactInfo; // size = 0x06 -typedef struct { +typedef struct SpecialRespawnInfo { /* 0x00 */ Vec3f pos; /* 0x0C */ s16 yaw; } SpecialRespawnInfo; // size = 0x10 -typedef enum { - /* 1 */ ANIMSFX_TYPE_1 = 1, - /* 2 */ ANIMSFX_TYPE_2, - /* 3 */ ANIMSFX_TYPE_3, - /* 4 */ ANIMSFX_TYPE_4, - /* 5 */ ANIMSFX_TYPE_5, - /* 6 */ ANIMSFX_TYPE_6, - /* 7 */ ANIMSFX_TYPE_7, - /* 8 */ ANIMSFX_TYPE_8, - /* 9 */ ANIMSFX_TYPE_9 +typedef enum AnimSfxType { + /* 1 */ ANIMSFX_TYPE_GENERAL = 1, + /* 2 */ ANIMSFX_TYPE_FLOOR, + /* 3 */ ANIMSFX_TYPE_FLOOR_BY_AGE, + /* 4 */ ANIMSFX_TYPE_VOICE, + /* 5 */ ANIMSFX_TYPE_LANDING, // `AnimSfxEntry.sfxId` is ignored. Adjusted for Iron Boots if needed. + /* 6 */ ANIMSFX_TYPE_RUNNING, // `AnimSfxEntry.sfxId` is ignored. Adjusted for Iron Boots if needed. + /* 7 */ ANIMSFX_TYPE_JUMPING, // `AnimSfxEntry.sfxId` is ignored. Adjusted for Iron Boots if needed. + /* 8 */ ANIMSFX_TYPE_WALKING, // `AnimSfxEntry.sfxId` is ignored. Adjusted for Iron Boots if needed. + /* 9 */ ANIMSFX_TYPE_UNKNOWN // `AnimSfxEntry.sfxId` is ignored. Only used in the intro cutscene. } AnimSfxType; #define ANIMSFX_SHIFT_TYPE(type) ((type) << 11) @@ -96,29 +89,22 @@ typedef enum { #define ANIMSFX_GET_TYPE(data) ((data)&0x7800) #define ANIMSFX_GET_FRAME(data) ((data)&0x7FF) -typedef struct { +typedef struct AnimSfxEntry { /* 0x00 */ u16 sfxId; /* 0x02 */ s16 data; } AnimSfxEntry; // size = 0x04 -typedef struct { +typedef struct struct_808551A4 { /* 0x00 */ u16 unk_00; /* 0x02 */ s16 unk_02; } struct_808551A4; // size = 0x04 -typedef struct { +typedef struct ItemChangeInfo { /* 0x00 */ LinkAnimationHeader* anim; /* 0x04 */ u8 changeFrame; } ItemChangeInfo; // size = 0x08 -typedef struct { - /* 0x00 */ LinkAnimationHeader* unk_00; - /* 0x04 */ LinkAnimationHeader* unk_04; - /* 0x08 */ u8 unk_08; - /* 0x09 */ u8 unk_09; -} struct_80854554; // size = 0x0C - -typedef struct { +typedef struct struct_80854190 { /* 0x00 */ LinkAnimationHeader* unk_00; /* 0x04 */ LinkAnimationHeader* unk_04; /* 0x08 */ LinkAnimationHeader* unk_08; @@ -126,17 +112,17 @@ typedef struct { /* 0x0D */ u8 unk_0D; } struct_80854190; // size = 0x10 -typedef struct { +typedef struct struct_80854578 { /* 0x00 */ LinkAnimationHeader* anim; /* 0x04 */ f32 unk_04; /* 0x04 */ f32 unk_08; } struct_80854578; // size = 0x0C -typedef struct { +typedef struct struct_80854B18 { /* 0x00 */ s8 type; /* 0x04 */ union { void* ptr; - void (*func)(PlayState*, Player*, CsCmdActorAction*); + void (*func)(PlayState*, Player*, CsCmdActorCue*); }; } struct_80854B18; // size = 0x08 @@ -164,7 +150,6 @@ s32 func_80835800(Player* this, PlayState* play); s32 func_80835884(Player* this, PlayState* play); // Start aiming boomerang s32 func_808358F0(Player* this, PlayState* play); // Aim boomerang s32 func_808359FC(Player* this, PlayState* play); // Throw boomerang -s32 spawn_boomerang_ivan(EnPartner* this, PlayState* play); // Throw boomerang Ivan s32 func_80835B60(Player* this, PlayState* play); // Boomerang active s32 func_80835C08(Player* this, PlayState* play); @@ -174,7 +159,6 @@ s32 func_8083C61C(PlayState* play, Player* this); void func_8083CA20(PlayState* play, Player* this); void func_8083CA54(PlayState* play, Player* this); void func_8083CA9C(PlayState* play, Player* this); -void Player_SetPendingFlag(Player* this, PlayState* play); void func_80846648(PlayState* play, Player* this); void func_80846660(PlayState* play, Player* this); void func_808467D4(PlayState* play, Player* this); @@ -184,7 +168,6 @@ void func_80846978(PlayState* play, Player* this); void func_808469BC(PlayState* play, Player* this); void func_80846A68(PlayState* play, Player* this); void Player_UpdateCommon(Player* this, PlayState* play, Input* input); -s32 func_8084FCAC(Player* this, PlayState* play); void func_8084FF7C(Player* this); void Player_UpdateBunnyEars(Player* this); void func_80851008(PlayState* play, Player* this, void* anim); @@ -205,62 +188,62 @@ void func_808511FC(PlayState* play, Player* this, void* anim); void func_80851248(PlayState* play, Player* this, void* anim); void func_80851294(PlayState* play, Player* this, void* anim); void func_808512E0(PlayState* play, Player* this, void* arg2); -void func_80851368(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808513BC(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808514C0(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_8085157C(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808515A4(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851688(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851750(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851788(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851828(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808518DC(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_8085190C(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851998(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808519C0(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808519EC(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851A50(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851B90(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851BE8(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851CA4(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851D2C(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851D80(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851DEC(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851E28(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851E64(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851E90(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851ECC(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851F84(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80851FB0(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852048(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852080(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852174(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808521B8(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808521F4(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852234(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_8085225C(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852280(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852358(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852388(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852298(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852328(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852480(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852450(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808524B0(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808524D0(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852514(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852544(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852554(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852564(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808525C0(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852608(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852648(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808526EC(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_8085283C(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808528C8(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852944(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_808529D0(PlayState* play, Player* this, CsCmdActorAction* arg2); -void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2); +void func_80851368(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808513BC(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808514C0(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_8085157C(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808515A4(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851688(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851750(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851788(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851828(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808518DC(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_8085190C(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851998(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808519C0(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808519EC(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851A50(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851B90(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851BE8(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851CA4(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851D2C(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851D80(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851DEC(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851E28(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851E64(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851E90(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851ECC(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851F84(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80851FB0(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852048(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852080(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852174(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808521B8(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808521F4(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852234(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_8085225C(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852280(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852358(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852388(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852298(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852328(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852480(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852450(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808524B0(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808524D0(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852514(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852544(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852554(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852564(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808525C0(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852608(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852648(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808526EC(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_8085283C(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808528C8(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852944(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_808529D0(PlayState* play, Player* this, CsCmdActorCue* cue); +void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cue); int Player_IsDroppingFish(PlayState* play); s32 Player_StartFishing(PlayState* play); s32 func_80852F38(PlayState* play, Player* this); @@ -272,13 +255,13 @@ void Player_StartTalking(PlayState* play, Actor* actor); void Player_Action_80840450(Player* this, PlayState* play); void Player_Action_808407CC(Player* this, PlayState* play); -void Player_Action_80840BC8(Player* this, PlayState* play); +void Player_Action_Idle(Player* this, PlayState* play); void Player_Action_80840DE4(Player* this, PlayState* play); void Player_Action_808414F8(Player* this, PlayState* play); void Player_Action_8084170C(Player* this, PlayState* play); void Player_Action_808417FC(Player* this, PlayState* play); void Player_Action_8084193C(Player* this, PlayState* play); -void Player_Action_80841BA8(Player* this, PlayState* play); +void Player_Action_TurnInPlace(Player* this, PlayState* play); void Player_Action_80842180(Player* this, PlayState* play); void Player_Action_8084227C(Player* this, PlayState* play); void Player_Action_8084279C(Player* this, PlayState* play); @@ -292,14 +275,14 @@ void Player_Action_80843954(Player* this, PlayState* play); void Player_Action_80843A38(Player* this, PlayState* play); void Player_Action_80843CEC(Player* this, PlayState* play); void Player_Action_8084411C(Player* this, PlayState* play); -void Player_Action_80844708(Player* this, PlayState* play); +void Player_Action_Roll(Player* this, PlayState* play); void Player_Action_80844A44(Player* this, PlayState* play); void Player_Action_80844AF4(Player* this, PlayState* play); void Player_Action_80844E68(Player* this, PlayState* play); void Player_Action_80845000(Player* this, PlayState* play); void Player_Action_80845308(Player* this, PlayState* play); void Player_Action_80845668(Player* this, PlayState* play); -void Player_Action_808458D0(Player* this, PlayState* play); +void Player_Action_WaitForPutAway(Player* this, PlayState* play); void Player_Action_80845CA4(Player* this, PlayState* play); void Player_Action_80845EF8(Player* this, PlayState* play); void Player_Action_80846050(Player* this, PlayState* play); @@ -310,7 +293,7 @@ void Player_Action_80846408(Player* this, PlayState* play); void Player_Action_808464B0(Player* this, PlayState* play); void Player_Action_80846578(Player* this, PlayState* play); void Player_Action_8084B1D8(Player* this, PlayState* play); -void Player_Action_8084B530(Player* this, PlayState* play); +void Player_Action_Talk(Player* this, PlayState* play); void Player_Action_8084B78C(Player* this, PlayState* play); void Player_Action_8084B898(Player* this, PlayState* play); void Player_Action_8084B9E4(Player* this, PlayState* play); @@ -335,11 +318,11 @@ void Player_Action_8084E604(Player* this, PlayState* play); void Player_Action_8084E6D4(Player* this, PlayState* play); void Player_Action_8084E9AC(Player* this, PlayState* play); void Player_Action_8084EAC0(Player* this, PlayState* play); -void Player_Action_8084ECA4(Player* this, PlayState* play); +void Player_Action_SwingBottle(Player* this, PlayState* play); void Player_Action_8084EED8(Player* this, PlayState* play); void Player_Action_8084EFC0(Player* this, PlayState* play); -void Player_Action_8084F104(Player* this, PlayState* play); -void Player_Action_8084F390(Player* this, PlayState* play); +void Player_Action_ExchangeItem(Player* this, PlayState* play); +void Player_Action_SlideOnSlope(Player* this, PlayState* play); void Player_Action_8084F608(Player* this, PlayState* play); void Player_Action_8084F698(Player* this, PlayState* play); void Player_Action_8084F710(Player* this, PlayState* play); @@ -359,9 +342,74 @@ void Player_Action_80850C68(Player* this, PlayState* play); void Player_Action_80850E84(Player* this, PlayState* play); void Player_Action_CsAction(Player* this, PlayState* play); +#pragma region [SoH] +u8 gWalkSpeedToggle1; +u8 gWalkSpeedToggle2; + +s32 spawn_boomerang_ivan(EnPartner* this, PlayState* play) { + if (!CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0)) { + return 0; + } + + f32 posX = (Math_SinS(this->actor.shape.rot.y) * 1.0f) + this->actor.world.pos.x; + f32 posZ = (Math_CosS(this->actor.shape.rot.y) * 1.0f) + this->actor.world.pos.z; + s32 yaw = this->actor.shape.rot.y; + EnBoom* boomerang = + (EnBoom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOOM, posX, this->actor.world.pos.y + 7.0f, posZ, + this->actor.focus.rot.x, yaw, 0, 0, true); + + this->boomerangActor = &boomerang->actor; + if (boomerang != NULL) { + boomerang->returnTimer = 20; + Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOOMERANG_THROW); + } + + return 1; +} + +// Sets a flag according to which type of flag is specified in player->pendingFlag.flagType +// and which flag is specified in player->pendingFlag.flagID. +void Player_SetPendingFlag(Player* this, PlayState* play) { + switch (this->pendingFlag.flagType) { + case FLAG_SCENE_SWITCH: + Flags_SetSwitch(play, this->pendingFlag.flagID); + break; + case FLAG_SCENE_TREASURE: + Flags_SetTreasure(play, this->pendingFlag.flagID); + break; + case FLAG_SCENE_CLEAR: + Flags_SetClear(play, this->pendingFlag.flagID); + break; + case FLAG_SCENE_COLLECTIBLE: + Flags_SetCollectible(play, this->pendingFlag.flagID); + break; + case FLAG_EVENT_CHECK_INF: + Flags_SetEventChkInf(this->pendingFlag.flagID); + break; + case FLAG_ITEM_GET_INF: + Flags_SetItemGetInf(this->pendingFlag.flagID); + break; + case FLAG_INF_TABLE: + Flags_SetInfTable(this->pendingFlag.flagID); + break; + case FLAG_EVENT_INF: + Flags_SetEventInf(this->pendingFlag.flagID); + break; + case FLAG_RANDOMIZER_INF: + Flags_SetRandomizerInf(this->pendingFlag.flagID); + break; + case FLAG_NONE: + default: + break; + } + this->pendingFlag.flagType = FLAG_NONE; + this->pendingFlag.flagID = 0; +} +#pragma endregion + // .bss part 1 static s32 D_80858AA0; -static s32 D_80858AA4; +static s32 sSavedCurrentMask; static Vec3f sInteractWallCheckResult; static Input* sControlInput; @@ -499,20 +547,20 @@ static PlayerAgeProperties sAgeProperties[] = { }, }; -static u32 D_808535D0 = false; +static u32 sNoclipEnabled = false; static f32 sControlStickMagnitude = 0.0f; static s16 sControlStickAngle = 0; -static s16 D_808535DC = 0; -static s32 D_808535E0 = 0; +static s16 sControlStickWorldYaw = 0; +static s32 sUpperBodyIsBusy = false; // see `Player_UpdateUpperBody` static s32 sFloorType = 0; -static f32 D_808535E8 = 1.0f; -static f32 D_808535EC = 1.0f; +static f32 sWaterSpeedFactor = 1.0f; // Set to 0.5f in water, 1.0f otherwise. Influences different speed values. +static f32 sInvWaterSpeedFactor = 1.0f; // Inverse of `sWaterSpeedFactor` (1.0f / sWaterSpeedFactor) static u32 sTouchedWallFlags = 0; static u32 sConveyorSpeed = 0; static s16 sIsFloorConveyor = false; static s16 sConveyorYaw = 0; static f32 sYDistToFloor = 0.0f; -static s32 sPrevFloorProperty = 0; +static s32 sPrevFloorProperty = 0; // floor property from the previous frame static s32 sShapeYawToTouchedWall = 0; static s32 sWorldYawToTouchedWall = 0; static s16 sFloorShapePitch = 0; @@ -947,80 +995,181 @@ static LinkAnimationHeader* D_80853D4C[][3] = { &gPlayerAnim_link_fighter_Rside_jump_endR }, }; -static LinkAnimationHeader* D_80853D7C[][2] = { +typedef enum FidgetType { + /* 0x00 */ FIDGET_LOOK_AROUND, // ROOM_ENV_DEFAULT + /* 0x01 */ FIDGET_COLD, // ROOM_ENV_COLD + /* 0x02 */ FIDGET_WARM, // ROOM_ENV_WARM + /* 0x03 */ FIDGET_HOT, // ROOM_ENV_HOT (same animations as FIDGET_WARM) + /* 0x04 */ FIDGET_STRETCH_1, // ROOM_ENV_UNK_STRETCH_1 + /* 0x05 */ FIDGET_STRETCH_2, // ROOM_ENV_UNK_STRETCH_1 (same animations as FIDGET_STRETCH_1) + /* 0x06 */ FIDGET_STRETCH_3, // ROOM_ENV_UNK_STRETCH_1 (same animations as FIDGET_STRETCH_1) + /* 0x07 */ FIDGET_CRIT_HEALTH_START, + /* 0x08 */ FIDGET_CRIT_HEALTH_LOOP, + /* 0x09 */ FIDGET_SWORD_SWING, + /* 0x0A */ FIDGET_ADJUST_TUNIC, + /* 0x0B */ FIDGET_TAP_FEET, + /* 0x0C */ FIDGET_ADJUST_SHIELD, + /* 0x0D */ FIDGET_SWORD_SWING_TWO_HAND +} FidgetType; + +static LinkAnimationHeader* sFidgetAnimations[][2] = { + // FIDGET_LOOK_AROUND { &gPlayerAnim_link_normal_wait_typeA_20f, &gPlayerAnim_link_normal_waitF_typeA_20f }, + + // FIDGET_COLD { &gPlayerAnim_link_normal_wait_typeC_20f, &gPlayerAnim_link_normal_waitF_typeC_20f }, + + // FIDGET_WARM { &gPlayerAnim_link_normal_wait_typeB_20f, &gPlayerAnim_link_normal_waitF_typeB_20f }, + + // FIDGET_HOT { &gPlayerAnim_link_normal_wait_typeB_20f, &gPlayerAnim_link_normal_waitF_typeB_20f }, + + // FIDGET_STRETCH_1 { &gPlayerAnim_link_wait_typeD_20f, &gPlayerAnim_link_waitF_typeD_20f }, + + // FIDGET_STRETCH_2 { &gPlayerAnim_link_wait_typeD_20f, &gPlayerAnim_link_waitF_typeD_20f }, + + // FIDGET_STRETCH_3 { &gPlayerAnim_link_wait_typeD_20f, &gPlayerAnim_link_waitF_typeD_20f }, + + // FIDGET_CRIT_HEALTH_START { &gPlayerAnim_link_wait_heat1_20f, &gPlayerAnim_link_waitF_heat1_20f }, + + // FIDGET_CRIT_HEALTH_LOOP { &gPlayerAnim_link_wait_heat2_20f, &gPlayerAnim_link_waitF_heat2_20f }, + + // FIDGET_SWORD_SWING { &gPlayerAnim_link_wait_itemD1_20f, &gPlayerAnim_link_wait_itemD1_20f }, + + // FIDGET_ADJUST_TUNIC { &gPlayerAnim_link_wait_itemA_20f, &gPlayerAnim_link_waitF_itemA_20f }, + + // FIDGET_TAP_FEET { &gPlayerAnim_link_wait_itemB_20f, &gPlayerAnim_link_waitF_itemB_20f }, + + // FIDGET_ADJUST_SHIELD { &gPlayerAnim_link_wait_itemC_20f, &gPlayerAnim_link_wait_itemC_20f }, + + // FIDGET_SWORD_SWING_TWO_HAND { &gPlayerAnim_link_wait_itemD2_20f, &gPlayerAnim_link_wait_itemD2_20f } }; -static AnimSfxEntry D_80853DEC[] = { - { NA_SE_VO_LI_SNEEZE, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 8) }, +static AnimSfxEntry sFidgetAnimSfxSneeze[] = { + { NA_SE_VO_LI_SNEEZE, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 8) }, }; -static AnimSfxEntry D_80853DF0[] = { - { NA_SE_VO_LI_SWEAT, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 18) }, +static AnimSfxEntry sFidgetAnimSfxSweat[] = { + { NA_SE_VO_LI_SWEAT, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 18) }, }; -static AnimSfxEntry D_80853DF4[] = { - { NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 13) }, +static AnimSfxEntry sFidgetAnimSfxCritHealthStart[] = { + { NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 13) }, }; -static AnimSfxEntry D_80853DF8[] = { - { NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 10) }, +static AnimSfxEntry sFidgetAnimSfxCritHealthLoop[] = { + { NA_SE_VO_LI_BREATH_REST, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 10) }, }; -static AnimSfxEntry D_80853DFC[] = { - { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 44) }, { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 48) }, - { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 52) }, { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 56) }, - { NA_SE_PL_CALM_HIT, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 60) }, +static AnimSfxEntry sFidgetAnimSfxTunic[] = { + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 44) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 48) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 52) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 56) }, + { NA_SE_PL_CALM_HIT, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 60) }, }; -static AnimSfxEntry D_80853E10[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 25) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 30) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 44) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 48) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 52) }, { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_8, 56) }, +static AnimSfxEntry sFidgetAnimSfxTapFeet[] = { + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 25) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 30) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 44) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 48) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 52) }, { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 56) }, }; -static AnimSfxEntry D_80853E28[] = { - { NA_SE_IT_SHIELD_POSTURE, ANIMSFX_DATA(ANIMSFX_TYPE_1, 16) }, - { NA_SE_IT_SHIELD_POSTURE, ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, - { NA_SE_IT_SHIELD_POSTURE, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 70) }, +static AnimSfxEntry sFidgetAnimSfxShield[] = { + { NA_SE_IT_SHIELD_POSTURE, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 16) }, + { NA_SE_IT_SHIELD_POSTURE, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 20) }, + { NA_SE_IT_SHIELD_POSTURE, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 70) }, }; -static AnimSfxEntry D_80853E34[] = { - { NA_SE_IT_HAMMER_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_1, 10) }, - { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_4, 10) }, - { NA_SE_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_1, 22) }, - { NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 22) }, +static AnimSfxEntry sFidgetAnimSfxSword[] = { + { NA_SE_IT_HAMMER_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 10) }, + { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 10) }, + { NA_SE_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 22) }, + { NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 22) }, }; -static AnimSfxEntry D_80853E44[] = { - { NA_SE_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_1, 39) }, - { NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 39) }, +static AnimSfxEntry sFidgetAnimSfxSwordTwoHand[] = { + { NA_SE_IT_SWORD_SWING, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 39) }, + { NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 39) }, }; -static AnimSfxEntry D_80853E4C[] = { - { NA_SE_VO_LI_RELAX, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, +static AnimSfxEntry sFidgetAnimSfxStretch[] = { + { NA_SE_VO_LI_RELAX, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 20) }, }; -static AnimSfxEntry* D_80853E50[] = { - D_80853DEC, D_80853DF0, D_80853DF4, D_80853DF8, D_80853DFC, D_80853E10, - D_80853E28, D_80853E34, D_80853E44, D_80853E4C, NULL, +typedef enum FidgetAnimSfxType { + /* 0x0 */ FIDGET_ANIMSFX_NONE, + /* 0x1 */ FIDGET_ANIMSFX_SNEEZE, + /* 0x2 */ FIDGET_ANIMSFX_SWEAT, + /* 0x3 */ FIDGET_ANIMSFX_CRIT_HEALTH_START, + /* 0x4 */ FIDGET_ANIMSFX_CRIT_HEALTH_LOOP, + /* 0x5 */ FIDGET_ANIMSFX_TUNIC, + /* 0x6 */ FIDGET_ANIMSFX_TAP_FEET, + /* 0x7 */ FIDGET_ANIMSFX_SHIELD, + /* 0x8 */ FIDGET_ANIMSFX_SWORD, + /* 0x9 */ FIDGET_ANIMSFX_SWORD_TWO_HAND, + /* 0xA */ FIDGET_ANIMSFX_STRETCH +} FidgetAnimSfxType; + +static AnimSfxEntry* sFidgetAnimSfxLists[] = { + sFidgetAnimSfxSneeze, // FIDGET_ANIMSFX_SNEEZE + sFidgetAnimSfxSweat, // FIDGET_ANIMSFX_SWEAT + sFidgetAnimSfxCritHealthStart, // FIDGET_ANIMSFX_CRIT_HEALTH_START + sFidgetAnimSfxCritHealthLoop, // FIDGET_ANIMSFX_CRIT_HEALTH_LOOP + sFidgetAnimSfxTunic, // FIDGET_ANIMSFX_TUNIC + sFidgetAnimSfxTapFeet, // FIDGET_ANIMSFX_TAP_FEET + sFidgetAnimSfxShield, // FIDGET_ANIMSFX_SHIELD + sFidgetAnimSfxSword, // FIDGET_ANIMSFX_SWORD + sFidgetAnimSfxSwordTwoHand, // FIDGET_ANIMSFX_SWORD_TWO_HAND + sFidgetAnimSfxStretch, // FIDGET_ANIMSFX_STRETCH + NULL, // unused entry }; -static u8 D_80853E7C[] = { - 0, 0, 1, 1, 2, 2, 2, 2, 10, 10, 10, 10, 10, 10, 3, 3, 4, 4, 8, 8, 5, 5, 6, 6, 7, 7, 9, 9, 0, +/** + * The indices in this array correspond 1 to 1 with the entries of sFidgetAnimations. + * There is also an extra FIDGET_ANIMSFX_NONE at the end that doesn't correspond to any animation. + */ +static u8 sFidgetAnimSfxTypes[] = { + FIDGET_ANIMSFX_NONE, // FIDGET_LOOK_AROUND + FIDGET_ANIMSFX_NONE, // FIDGET_LOOK_AROUND (sword/shield in hand) + FIDGET_ANIMSFX_SNEEZE, // FIDGET_COLD + FIDGET_ANIMSFX_SNEEZE, // FIDGET_COLD (sword/shield in hand) + FIDGET_ANIMSFX_SWEAT, // FIDGET_WARM + FIDGET_ANIMSFX_SWEAT, // FIDGET_WARM (sword/shield in hand) + FIDGET_ANIMSFX_SWEAT, // FIDGET_HOT + FIDGET_ANIMSFX_SWEAT, // FIDGET_HOT (sword/shield in hand) + FIDGET_ANIMSFX_STRETCH, // FIDGET_STRETCH_1 + FIDGET_ANIMSFX_STRETCH, // FIDGET_STRETCH_1 (sword/shield in hand) + FIDGET_ANIMSFX_STRETCH, // FIDGET_STRETCH_2 + FIDGET_ANIMSFX_STRETCH, // FIDGET_STRETCH_2 (sword/shield in hand) + FIDGET_ANIMSFX_STRETCH, // FIDGET_STRETCH_3 + FIDGET_ANIMSFX_STRETCH, // FIDGET_STRETCH_3 (sword/shield in hand) + FIDGET_ANIMSFX_CRIT_HEALTH_START, // FIDGET_CRIT_HEALTH_START + FIDGET_ANIMSFX_CRIT_HEALTH_START, // FIDGET_CRIT_HEALTH_START (sword/shield in hand) + FIDGET_ANIMSFX_CRIT_HEALTH_LOOP, // FIDGET_CRIT_HEALTH_LOOP + FIDGET_ANIMSFX_CRIT_HEALTH_LOOP, // FIDGET_CRIT_HEALTH_LOOP (sword/shield in hand) + FIDGET_ANIMSFX_SWORD, // FIDGET_SWORD_SWING + FIDGET_ANIMSFX_SWORD, // FIDGET_SWORD_SWING (sword/shield in hand) + FIDGET_ANIMSFX_TUNIC, // FIDGET_ADJUST_TUNIC + FIDGET_ANIMSFX_TUNIC, // FIDGET_ADJUST_TUNIC (sword/shield in hand) + FIDGET_ANIMSFX_TAP_FEET, // FIDGET_TAP_FEET + FIDGET_ANIMSFX_TAP_FEET, // FIDGET_TAP_FEET (sword/shield in hand) + FIDGET_ANIMSFX_SHIELD, // FIDGET_ADJUST_SHIELD + FIDGET_ANIMSFX_SHIELD, // FIDGET_ADJUST_SHIELD (sword/shield in hand) + FIDGET_ANIMSFX_SWORD_TWO_HAND, // FIDGET_SWORD_SWING_TWO_HAND + FIDGET_ANIMSFX_SWORD_TWO_HAND, // FIDGET_SWORD_SWING_TWO_HAND (sword/shield in hand) + FIDGET_ANIMSFX_NONE, // unused, doesnt correspond to any animation }; // Used to map item IDs to item actions @@ -1089,9 +1238,6 @@ static s8 sItemActions[] = { PLAYER_IA_SWORD_BIGGORON, // ITEM_SWORD_BIGGORON }; -u8 gWalkSpeedToggle1; -u8 gWalkSpeedToggle2; - static s32 (*sItemActionUpdateFuncs[])(Player* this, PlayState* play) = { func_8083485C, // PLAYER_IA_NONE func_8083485C, // PLAYER_IA_SWORD_CS @@ -1232,7 +1378,7 @@ static void (*sItemActionInitFuncs[])(PlayState* play, Player* this) = { Player_InitDefaultIA, // PLAYER_IA_LENS_OF_TRUTH }; -typedef enum { +typedef enum ItemChangeType { /* 0 */ PLAYER_ITEM_CHG_0, /* 1 */ PLAYER_ITEM_CHG_1, /* 2 */ PLAYER_ITEM_CHG_2, @@ -1451,17 +1597,18 @@ static LinkAnimationHeader* D_808543D4[] = { &gPlayerAnim_link_hook_wait, }; -void Player_ZeroSpeedXZ(Player* this) { +BAD_RETURN(s32) Player_ZeroSpeedXZ(Player* this) { this->actor.speedXZ = 0.0f; this->linearVelocity = 0.0f; } -void func_80832224(Player* this) { +// return type can't be void due to regalloc in func_8083F72C +BAD_RETURN(s32) func_80832224(Player* this) { Player_ZeroSpeedXZ(this); this->unk_6AD = 0; } -s32 func_8083224C(PlayState* play) { +s32 Player_IsTalking(PlayState* play) { Player* this = GET_PLAYER(play); return CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_PLAYER_TALKED_TO); @@ -1483,7 +1630,7 @@ void Player_AnimPlayOnceAdjusted(PlayState* play, Player* this, LinkAnimationHea LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, PLAYER_ANIM_ADJUSTED_SPEED); } -void func_808322FC(Player* this) { +void Player_ApplyYawFromAnim(Player* this) { this->actor.shape.rot.y += this->skelAnime.jointTable[1].y; this->skelAnime.jointTable[1].y = 0; } @@ -1516,7 +1663,7 @@ void Player_DetachHeldActor(PlayState* play, Player* this) { this->heldActor = NULL; this->interactRangeActor = NULL; heldActor->parent = NULL; - this->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; + this->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR; } if (Player_GetExplosiveHeld(this) >= 0) { @@ -1526,14 +1673,14 @@ void Player_DetachHeldActor(PlayState* play, Player* this) { } void func_80832440(PlayState* play, Player* this) { - if ((this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (this->heldActor == NULL)) { + if ((this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (this->heldActor == NULL)) { if (this->interactRangeActor != NULL) { if (this->getItemId == GI_NONE) { - this->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; + this->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR; this->interactRangeActor = NULL; } } else { - this->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; + this->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR; } } @@ -1552,12 +1699,16 @@ void func_80832440(PlayState* play, Player* this) { this->unk_845 = this->unk_844 = 0; } -s32 func_80832528(PlayState* play, Player* this) { +/** + * Puts away item currently in hand, if holding any. + * @return true if an item needs to be put away, false if not. + */ +s32 Player_PutAwayHeldItem(PlayState* play, Player* this) { if (this->heldItemAction >= PLAYER_IA_FISHING_POLE) { Player_UseItem(play, this, ITEM_NONE); - return 1; + return true; } else { - return 0; + return false; } } @@ -1569,7 +1720,8 @@ void func_80832564(PlayState* play, Player* this) { s32 func_80832594(Player* this, s32 arg1, s32 arg2) { s16 controlStickAngleDiff = this->prevControlStickAngle - sControlStickAngle; - this->av2.actionVar2 += arg1 + (s16)(ABS(controlStickAngleDiff) * fabsf(sControlStickMagnitude) * 2.5415802156203426e-06f); + this->av2.actionVar2 += + arg1 + (s16)(ABS(controlStickAngleDiff) * fabsf(sControlStickMagnitude) * 2.5415802156203426e-06f); if (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B)) { this->av2.actionVar2 += 5; @@ -1590,7 +1742,7 @@ void Player_RequestRumble(Player* this, s32 sourceStrength, s32 duration, s32 de } } -void func_80832698(Player* this, u16 sfxId) { +void Player_PlayVoiceSfx(Player* this, u16 sfxId) { if (this->actor.category == ACTORCAT_PLAYER) { Player_PlaySfx(this, sfxId + this->ageProperties->unk_92); } else { @@ -1608,59 +1760,59 @@ void func_808326F0(Player* this) { } } -u16 func_8083275C(Player* this, u16 sfxId) { +u16 Player_ApplyFloorSfxOffset(Player* this, u16 sfxId) { return sfxId + this->floorSfxOffset; } -void func_80832770(Player* this, u16 sfxId) { - Player_PlaySfx(this, func_8083275C(this, sfxId)); +void Player_PlayFloorSfx(Player* this, u16 sfxId) { + Player_PlaySfx(this, Player_ApplyFloorSfxOffset(this, sfxId)); } -u16 func_808327A4(Player* this, u16 sfxId) { +u16 Player_ApplyFloorAndAgeSfxOffsets(Player* this, u16 sfxId) { return sfxId + this->floorSfxOffset + this->ageProperties->unk_94; } -void func_808327C4(Player* this, u16 sfxId) { - Player_PlaySfx(this, func_808327A4(this, sfxId)); +void Player_PlayFloorSfxByAge(Player* this, u16 sfxId) { + Player_PlaySfx(this, Player_ApplyFloorAndAgeSfxOffsets(this, sfxId)); } -void func_808327F8(Player* this, f32 arg1) { +void Player_PlaySteppingSfx(Player* this, f32 pitchAdjustment) { s32 sfxId; if (this->currentBoots == PLAYER_BOOTS_IRON) { sfxId = NA_SE_PL_WALK_HEAVYBOOTS; } else { - sfxId = func_808327A4(this, NA_SE_PL_WALK_GROUND); + sfxId = Player_ApplyFloorAndAgeSfxOffsets(this, NA_SE_PL_WALK_GROUND); } - func_800F4010(&this->actor.projectedPos, sfxId, arg1); + func_800F4010(&this->actor.projectedPos, sfxId, pitchAdjustment); // Gameplay stats: Count footsteps // Only count while game isn't complete and don't count Link's idle animations or crawling in crawlspaces - if (!gSaveContext.sohStats.gameComplete && !(this->stateFlags2 & PLAYER_STATE2_IDLING) && + if (!gSaveContext.sohStats.gameComplete && !(this->stateFlags2 & PLAYER_STATE2_IDLE_FIDGET) && !(this->stateFlags2 & PLAYER_STATE2_CRAWLING)) { gSaveContext.sohStats.count[COUNT_STEPS]++; } } -void func_80832854(Player* this) { +void Player_PlayJumpingSfx(Player* this) { s32 sfxId; if (this->currentBoots == PLAYER_BOOTS_IRON) { sfxId = NA_SE_PL_JUMP_HEAVYBOOTS; } else { - sfxId = func_808327A4(this, NA_SE_PL_JUMP); + sfxId = Player_ApplyFloorAndAgeSfxOffsets(this, NA_SE_PL_JUMP); } Player_PlaySfx(this, sfxId); } -void func_808328A0(Player* this) { +void Player_PlayLandingSfx(Player* this) { s32 sfxId; if (this->currentBoots == PLAYER_BOOTS_IRON) { sfxId = NA_SE_PL_LAND_HEAVYBOOTS; } else { - sfxId = func_808327A4(this, NA_SE_PL_LAND); + sfxId = Player_ApplyFloorAndAgeSfxOffsets(this, NA_SE_PL_LAND); } Player_PlaySfx(this, sfxId); @@ -1692,23 +1844,23 @@ void Player_ProcessAnimSfxList(Player* this, AnimSfxEntry* entry) { s32 type = ANIMSFX_GET_TYPE(absData); if (LinkAnimation_OnFrame(&this->skelAnime, fabsf(ANIMSFX_GET_FRAME(absData)))) { - if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_1)) { + if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_GENERAL)) { Player_PlaySfx(this, entry->sfxId); - } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_2)) { - func_80832770(this, entry->sfxId); - } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_3)) { - func_808327C4(this, entry->sfxId); - } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_4)) { - func_80832698(this, entry->sfxId); - } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_5)) { - func_808328A0(this); - } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_6)) { - func_808327F8(this, 6.0f); - } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_7)) { - func_80832854(this); - } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_8)) { - func_808327F8(this, 0.0f); - } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_9)) { + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_FLOOR)) { + Player_PlayFloorSfx(this, entry->sfxId); + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_FLOOR_BY_AGE)) { + Player_PlayFloorSfxByAge(this, entry->sfxId); + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_VOICE)) { + Player_PlayVoiceSfx(this, entry->sfxId); + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_LANDING)) { + Player_PlayLandingSfx(this); + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_RUNNING)) { + Player_PlaySteppingSfx(this, 6.0f); + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_JUMPING)) { + Player_PlayJumpingSfx(this); + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_WALKING)) { + Player_PlaySteppingSfx(this, 0.0f); + } else if (type == ANIMSFX_SHIFT_TYPE(ANIMSFX_TYPE_UNKNOWN)) { func_800F4010(&this->actor.projectedPos, NA_SE_PL_WALK_LADDER + this->ageProperties->unk_94, 0.0f); } @@ -1749,13 +1901,14 @@ s32 func_80832CB0(PlayState* play, Player* this, LinkAnimationHeader* anim) { } } -void Player_SkelAnimeResetPrevTranslRot(Player* this) { +void Player_ResetAnimMovement(Player* this) { this->skelAnime.prevTransl = this->skelAnime.baseTransl; this->skelAnime.prevRot = this->actor.shape.rot.y; } -void Player_SkelAnimeResetPrevTranslRotAgeScale(Player* this) { - Player_SkelAnimeResetPrevTranslRot(this); +void Player_ResetAnimMovementScaledByAge(Player* this) { + Player_ResetAnimMovement(this); + this->skelAnime.prevTransl.x *= this->ageProperties->unk_08; this->skelAnime.prevTransl.y *= this->ageProperties->unk_08; this->skelAnime.prevTransl.z *= this->ageProperties->unk_08; @@ -1765,11 +1918,19 @@ void Player_ZeroRootLimbYaw(Player* this) { this->skelAnime.jointTable[1].y = 0; } -void func_80832DBC(Player* this) { +/** + * Finishes "AnimMovement" by resetting various aspects of Player's SkelAnime structure. + * + * This function is called in Player_SetupAction so it will run on every action change, but + * it can also be called within action functions to change animations in the middle of an action. + */ +void Player_FinishAnimMovement(Player* this) { if (this->skelAnime.moveFlags != 0) { - func_808322FC(this); + Player_ApplyYawFromAnim(this); + this->skelAnime.jointTable[0].x = this->skelAnime.baseTransl.x; this->skelAnime.jointTable[0].z = this->skelAnime.baseTransl.z; + if (this->skelAnime.moveFlags & 8) { if (this->skelAnime.moveFlags & 2) { this->skelAnime.jointTable[0].y = this->skelAnime.prevTransl.y; @@ -1777,59 +1938,95 @@ void func_80832DBC(Player* this) { } else { this->skelAnime.jointTable[0].y = this->skelAnime.baseTransl.y; } - Player_SkelAnimeResetPrevTranslRot(this); + + Player_ResetAnimMovement(this); + this->skelAnime.moveFlags = 0; } } -void func_80832E48(Player* this, s32 flags) { - Vec3f pos; +/** + * This is a reimplementation of `AnimTask_ActorMovement`. + * + * This achieves the same goal as `AnimTask_ActorMovement`but it adds + * the ability to scale the resulting movement according to age. + * + * When using the AnimTask variant, age specific scaling can only be applied visually + * to the root bone position and does not affect world position. + */ +void Player_ApplyAnimMovementScaledByAge(Player* this, s32 movementFlags) { + Vec3f diff; - this->skelAnime.moveFlags = flags; + this->skelAnime.moveFlags = movementFlags; this->skelAnime.prevTransl = this->skelAnime.baseTransl; - SkelAnime_UpdateTranslation(&this->skelAnime, &pos, this->actor.shape.rot.y); - if (flags & 1) { + SkelAnime_UpdateTranslation(&this->skelAnime, &diff, this->actor.shape.rot.y); + + if (movementFlags & 1) { if (!LINK_IS_ADULT) { - pos.x *= 0.64f; - pos.z *= 0.64f; + diff.x *= 0.64f; + diff.z *= 0.64f; } - this->actor.world.pos.x += pos.x * this->actor.scale.x; - this->actor.world.pos.z += pos.z * this->actor.scale.z; + + this->actor.world.pos.x += diff.x * this->actor.scale.x; + this->actor.world.pos.z += diff.z * this->actor.scale.z; } - if (flags & 2) { - if (!(flags & 4)) { - pos.y *= this->ageProperties->unk_08; + if (movementFlags & 2) { + if (!(movementFlags & 4)) { + diff.y *= this->ageProperties->unk_08; } - this->actor.world.pos.y += pos.y * this->actor.scale.y; + + this->actor.world.pos.y += diff.y * this->actor.scale.y; } - func_808322FC(this); + Player_ApplyYawFromAnim(this); } -#define ANIM_REPLACE_APPLY_FLAG_8 (1 << 8) -#define ANIM_REPLACE_APPLY_FLAG_9 (1 << 9) +#define PLAYER_ANIM_MOVEMENT_RESET (1 << 8) +#define PLAYER_ANIM_MOVEMENT_RESET_BY_AGE (1 << 9) -void Player_AnimReplaceApplyFlags(PlayState* play, Player* this, s32 flags) { - if (flags & ANIM_REPLACE_APPLY_FLAG_9) { - Player_SkelAnimeResetPrevTranslRotAgeScale(this); - } else if ((flags & ANIM_REPLACE_APPLY_FLAG_8) || (this->skelAnime.moveFlags != 0)) { - Player_SkelAnimeResetPrevTranslRot(this); +/** + * Starts "AnimMovement" so that Player will move according to the translation and rotation specified + * by the animation that is playing. + * + * The `flags` field can be any of the SkelAnime system's `ANIM_FLAG_` flags, as well as Player-specific + * `PLAYER_ANIM_MOVEMENT_` flags. + * + * For AnimMovement features to be enabled, it is usually required to pass `ANIM_FLAG_ENABLE_MOVEMENT` + * as one of the flags, but there are a few niche cases where it can be desirable to omit it + * (for example to use `ANIM_FLAG_DISABLE_CHILD_ROOT_ADJUSTMENT` without any actual AnimMovement). + * + * Note: AnimMovement is always disabled during every action change. + * This means the order that functions are called matters. + * `Player_StartAnimMovement` must be called *after* a call to `Player_SetupAction`. + */ +void Player_StartAnimMovement(PlayState* play, Player* this, s32 flags) { + if (flags & PLAYER_ANIM_MOVEMENT_RESET_BY_AGE) { + Player_ResetAnimMovementScaledByAge(this); + } else if ((flags & PLAYER_ANIM_MOVEMENT_RESET) || (this->skelAnime.moveFlags != 0)) { + // If AnimMovement is already in use when this function is called and + // `PLAYER_ANIM_MOVEMENT_RESET_BY_AGE` is not set, then this case will be used. + Player_ResetAnimMovement(this); } else { + // Default case used when AnimMovement was not enabled previously. + // This sets prevTransl and prevRot to Players current translation and yaw. this->skelAnime.prevTransl = this->skelAnime.jointTable[0]; this->skelAnime.prevRot = this->actor.shape.rot.y; } - this->skelAnime.moveFlags = flags; + // Remove Player specific flags by masking the lower byte before setting to `skelAnime.movementFlags` + this->skelAnime.moveFlags = flags /*&& 0xFF*/; + Player_ZeroSpeedXZ(this); AnimationContext_DisableQueue(play); } +// TODO: Change all of these wrapper functions below to use "AnimMovement" instead of "AnimReplace" void Player_AnimReplacePlayOnceSetSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, playbackSpeed); - Player_AnimReplaceApplyFlags(play, this, flags); + Player_StartAnimMovement(play, this, flags); } void Player_AnimReplacePlayOnce(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { @@ -1847,7 +2044,7 @@ void Player_AnimReplaceNormalPlayOnceAdjusted(PlayState* play, Player* this, Lin void Player_AnimReplacePlayLoopSetSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags, f32 playbackSpeed) { LinkAnimation_PlayLoopSetSpeed(play, &this->skelAnime, anim, playbackSpeed); - Player_AnimReplaceApplyFlags(play, this, flags); + Player_StartAnimMovement(play, this, flags); } void Player_AnimReplacePlayLoop(PlayState* play, Player* this, LinkAnimationHeader* anim, s32 flags) { @@ -1863,32 +2060,32 @@ void Player_AnimReplaceNormalPlayLoopAdjusted(PlayState* play, Player* this, Lin } void Player_ProcessControlStick(PlayState* play, Player* this) { - s8 phi_v1; - s8 phi_v0; + s8 spinAngle; + s8 direction; this->prevControlStickMagnitude = sControlStickMagnitude; this->prevControlStickAngle = sControlStickAngle; func_80077D10(&sControlStickMagnitude, &sControlStickAngle, sControlInput); - D_808535DC = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)) + sControlStickAngle; + sControlStickWorldYaw = Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)) + sControlStickAngle; - this->unk_846 = (this->unk_846 + 1) % 4; + this->controlStickDataIndex = (this->controlStickDataIndex + 1) % 4; if (sControlStickMagnitude < 55.0f) { - phi_v0 = -1; - phi_v1 = -1; + direction = PLAYER_STICK_DIR_NONE; + spinAngle = -1; } else { - phi_v1 = (u16)(sControlStickAngle + 0x2000) >> 9; - phi_v0 = (u16)((s16)(D_808535DC - this->actor.shape.rot.y) + 0x2000) >> 14; + spinAngle = (u16)(sControlStickAngle + 0x2000) >> 9; + direction = (u16)((s16)(sControlStickWorldYaw - this->actor.shape.rot.y) + 0x2000) >> 14; } - this->unk_847[this->unk_846] = phi_v1; - this->unk_84B[this->unk_846] = phi_v0; + this->controlStickSpinAngles[this->controlStickDataIndex] = spinAngle; + this->controlStickDirections[this->controlStickDataIndex] = direction; } void func_8083328C(PlayState* play, Player* this, LinkAnimationHeader* linkAnim) { - LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, linkAnim, D_808535E8); + LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, linkAnim, sWaterSpeedFactor); } int func_808332B8(Player* this) { @@ -1896,7 +2093,7 @@ int func_808332B8(Player* this) { } s32 func_808332E4(Player* this) { - return (this->stateFlags1 & PLAYER_STATE1_BOOMERANG_IN_HAND); + return (this->stateFlags1 & PLAYER_STATE1_USING_BOOMERANG); } void func_808332F4(Player* this, PlayState* play) { @@ -1910,29 +2107,51 @@ void func_808332F4(Player* this, PlayState* play) { this->unk_862 = ABS(giEntry.gi); } -static LinkAnimationHeader* func_80833338(Player* this) { +/** + * Get the appropriate Idle animation based on current `modelAnimType`. + * This is the default idle animation. + * + * For fidget idle animations (which can for example, change based on environment) + * see `sFidgetAnimations`. + */ +LinkAnimationHeader* Player_GetIdleAnim(Player* this) { return GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType); } -s32 func_80833350(Player* this) { - LinkAnimationHeader** entry; - s32 i; +/** + * Return values for `Player_CheckForIdleAnim` + */ +#define IDLE_ANIM_DEFAULT -1 +#define IDLE_ANIM_NONE 0 +// Fidget idle anims are returned by index. See `sFidgetAnimations` and `FidgetType`. - if (func_80833338(this) != this->skelAnime.animation) { - for (i = 0, entry = &D_80853D7C[0][0]; i < 28; i++, entry++) { - if (this->skelAnime.animation == *entry) { +/** + * Checks if the current animation is an idle animation. + * If the current animation is a fidget animation, the index into + * `sFidgetAnimations` is returned (plus one). + * If the current animation is a default idle animation, -1 is returned. + * Lastly if the current animation is neither of these, 0 is returned. + */ +s32 Player_CheckForIdleAnim(Player* this) { + if (Player_GetIdleAnim(this) != this->skelAnime.animation) { + LinkAnimationHeader** fidgetAnim; + s32 i; + + for (i = 0, fidgetAnim = &sFidgetAnimations[0][0]; i < ARRAY_COUNT_2D(sFidgetAnimations); i++, fidgetAnim++) { + if (this->skelAnime.animation == *fidgetAnim) { return i + 1; } } - return 0; + + return IDLE_ANIM_NONE; } - return -1; + return IDLE_ANIM_DEFAULT; } -void func_808333FC(Player* this, s32 arg1) { - if (D_80853E7C[arg1] != 0) { - Player_ProcessAnimSfxList(this, D_80853E50[D_80853E7C[arg1] - 1]); +void Player_ProcessFidgetAnimSfxList(Player* this, s32 fidgetAnimIndex) { + if (sFidgetAnimSfxTypes[fidgetAnimIndex] != FIDGET_ANIMSFX_NONE) { + Player_ProcessAnimSfxList(this, sFidgetAnimSfxLists[sFidgetAnimSfxTypes[fidgetAnimIndex] - 1]); } } @@ -1994,16 +2213,20 @@ LinkAnimationHeader* func_808335F4(Player* this) { void Player_SetUpperActionFunc(Player* this, UpperActionFunc upperActionFunc) { this->upperActionFunc = upperActionFunc; this->unk_836 = 0; - this->upperAnimBlendWeight = 0.0f; + this->upperAnimInterpWeight = 0.0f; func_808326F0(this); } +#define Player_GetMeleeWeaponHeld2 Player_GetMeleeWeaponHeld + void Player_InitItemActionWithAnim(PlayState* play, Player* this, s8 itemAction) { LinkAnimationHeader* current = this->skelAnime.animation; LinkAnimationHeader** iter = &D_80853914[0][this->modelAnimType]; u32 animGroup; - this->stateFlags1 &= ~(PLAYER_STATE1_ITEM_IN_HAND | PLAYER_STATE1_BOOMERANG_IN_HAND); + // This is redundant, the same two flags get unset in + // `Player_InitItemAction` called below. + this->stateFlags1 &= ~(PLAYER_STATE1_ITEM_IN_HAND | PLAYER_STATE1_USING_BOOMERANG); for (animGroup = 0; animGroup < PLAYER_ANIMGROUP_MAX; animGroup++) { if (current == *iter) { @@ -2023,7 +2246,7 @@ s8 Player_ItemToItemAction(s32 item) { if (item >= ITEM_NONE_FE) { return PLAYER_IA_NONE; } else if (item == ITEM_LAST_USED) { - return PLAYER_IA_LAST_USED; + return PLAYER_IA_SWORD_CS; } else if (item == ITEM_FISHING_POLE) { return PLAYER_IA_FISHING_POLE; // #region SOH [Enhancement] Added to prevent crashes with assignable equipment @@ -2038,6 +2261,8 @@ s8 Player_ItemToItemAction(s32 item) { void Player_InitDefaultIA(PlayState* play, Player* this) { } +#define Player_HoldsTwoHandedWeapon2 Player_HoldsTwoHandedWeapon + void Player_InitDekuStickIA(PlayState* play, Player* this) { this->unk_85C = 1.0f; } @@ -2060,8 +2285,8 @@ void Player_InitExplosiveIA(PlayState* play, Player* this) { ExplosiveInfo* explosiveInfo; Actor* spawnedActor; - if (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { - func_80832528(play, this); + if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { + Player_PutAwayHeldItem(play, this); return; } @@ -2088,7 +2313,7 @@ void Player_InitExplosiveIA(PlayState* play, Player* this) { this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; this->unk_3BC.y = spawnedActor->shape.rot.y - this->actor.shape.rot.y; - this->stateFlags1 |= PLAYER_STATE1_ITEM_OVER_HEAD; + this->stateFlags1 |= PLAYER_STATE1_CARRYING_ACTOR; } } @@ -2102,18 +2327,18 @@ void Player_InitHookshotIA(PlayState* play, Player* this) { } void Player_InitBoomerangIA(PlayState* play, Player* this) { - this->stateFlags1 |= PLAYER_STATE1_BOOMERANG_IN_HAND; + this->stateFlags1 |= PLAYER_STATE1_USING_BOOMERANG; } void Player_InitItemAction(PlayState* play, Player* this, s8 itemAction) { - this->unk_860 = 0; this->unk_85C = 0.0f; this->unk_858 = 0.0f; + this->unk_860 = 0; this->heldItemAction = this->itemAction = itemAction; this->modelGroup = this->nextModelGroup; - this->stateFlags1 &= ~(PLAYER_STATE1_ITEM_IN_HAND | PLAYER_STATE1_BOOMERANG_IN_HAND); + this->stateFlags1 &= ~(PLAYER_STATE1_ITEM_IN_HAND | PLAYER_STATE1_USING_BOOMERANG); sItemActionInitFuncs[itemAction](play, this); @@ -2149,7 +2374,7 @@ void func_80833A20(Player* this, s32 newMeleeWeaponState) { if (!((this->meleeWeaponAnimation >= PLAYER_MWA_FLIPSLASH_START) && (this->meleeWeaponAnimation <= PLAYER_MWA_JUMPSLASH_FINISH))) { - func_80832698(this, voiceSfx); + Player_PlayVoiceSfx(this, voiceSfx); } if (this->heldItemAction >= PLAYER_IA_SWORD_MASTER && this->heldItemAction <= PLAYER_IA_SWORD_BIGGORON) { @@ -2160,36 +2385,81 @@ void func_80833A20(Player* this, s32 newMeleeWeaponState) { this->meleeWeaponState = newMeleeWeaponState; } -s32 func_80833B2C(Player* this) { - if (this->stateFlags1 & (PLAYER_STATE1_TARGET_LOCKED | PLAYER_STATE1_TARGET_NOTHING | PLAYER_STATE1_30)) { - return 1; +/** + * This function checks for friendly (non-hostile) Z-Target related states. + * For hostile related lock-on states, see `Player_UpdateHostileLockOn` and `Player_CheckHostileLockOn`. + * + * Note that `PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS` will include all `focusActor` use cases that relate to + * friendly actors. This function can return true when talking to an actor, for example. + * Despite that, this function is only relevant in the context of actor lock-on, which is a subset of actor focus. + * This is why the function name states `FriendlyLockOn` instead of `FriendlyActorFocus`. + * + * There is a special case that allows hostile actors to be treated as "friendly" if Player is carrying another actor + * See relevant code in `Player_UpdateZTargeting` for more details. + * + * Additionally, `PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE` will be set very briefly in some conditions when + * a lock-on is forced to release. In these niche cases, this function will apply to both friendly and hostile actors. + * Overall, it is safe to assume that this specific state flag is not very relevant for this function's use cases. + */ +s32 Player_FriendlyLockOnOrParallel(Player* this) { + if (this->stateFlags1 & + (PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS | PLAYER_STATE1_PARALLEL | PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE)) { + return true; } else { - return 0; + return false; } } -s32 func_80833B54(Player* this) { - if ((this->unk_664 != NULL) && CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_HOSTILE)) { - this->stateFlags1 |= PLAYER_STATE1_ENEMY_TARGET; - return 1; - } +/** + * Checks the current state of `focusActor` and if it is a hostile actor (if applicable). + * If so, sets `PLAYER_STATE1_HOSTILE_LOCK_ON` which will control Player's "battle" response to + * hostile actors. This includes affecting how movement is handled, and enabling a "fighting" set + * of animations. + * + * Note that `Player_CheckHostileLockOn` also exists to check if there is currently a hostile lock-on actor. + * This function differs in that it first updates the flag if appropriate, then returns the same information. + * + * @return true if there is currently a hostile lock-on actor, false otherwise + */ +s32 Player_UpdateHostileLockOn(Player* this) { + if ((this->focusActor != NULL) && + CHECK_FLAG_ALL(this->focusActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_HOSTILE)) { + this->stateFlags1 |= PLAYER_STATE1_HOSTILE_LOCK_ON; + return true; + } else { + if (this->stateFlags1 & PLAYER_STATE1_HOSTILE_LOCK_ON) { + this->stateFlags1 &= ~PLAYER_STATE1_HOSTILE_LOCK_ON; - if (this->stateFlags1 & PLAYER_STATE1_ENEMY_TARGET) { - this->stateFlags1 &= ~PLAYER_STATE1_ENEMY_TARGET; - if (this->linearVelocity == 0.0f) { - this->yaw = this->actor.shape.rot.y; + // sync world and shape yaw when not moving + if (this->linearVelocity == 0.0f) { + this->yaw = this->actor.shape.rot.y; + } } + + return false; } - - return 0; } -int func_80833BCC(Player* this) { - return func_8008E9C4(this) || func_80833B2C(this); +/** + * Returns true if currently Z-Targeting, false if not. + * Z-Targeting here is a blanket term that covers both the "actor lock-on" and "parallel" states. + * + * This variant of the function calls `Player_CheckHostileLockOn`, which does not update the hostile + * lock-on actor state. + */ +int Player_IsZTargeting(Player* this) { + return Player_CheckHostileLockOn(this) || Player_FriendlyLockOnOrParallel(this); } -int func_80833C04(Player* this) { - return func_80833B54(this) || func_80833B2C(this); +/** + * Returns true if currently Z-Targeting, false if not. + * Z-Targeting here is a blanket term that covers both the "actor lock-on" and "parallel" states. + * + * This variant of the function calls `Player_UpdateHostileLockOn`, which updates the hostile + * lock-on actor state before checking its state. + */ +int Player_IsZTargetingWithHostileUpdate(Player* this) { + return Player_UpdateHostileLockOn(this) || Player_FriendlyLockOnOrParallel(this); } void func_80833C3C(Player* this) { @@ -2266,7 +2536,7 @@ void Player_ProcessItemButtons(Player* this, PlayState* play) { } } - if (!(this->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE)) && !func_8008F128(this)) { + if (!(this->stateFlags1 & (PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_IN_CUTSCENE)) && !func_8008F128(this)) { if (this->itemAction >= PLAYER_IA_FISHING_POLE) { bool hasOnDpad = false; if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { @@ -2356,11 +2626,11 @@ void Player_StartChangingHeldItem(Player* this, PlayState* play) { LinkAnimation_Change(play, &this->upperSkelAnime, anim, playSpeed, startFrame, endFrame, ANIMMODE_ONCE, 0.0f); - this->stateFlags1 &= ~PLAYER_STATE1_START_PUTAWAY; + this->stateFlags1 &= ~PLAYER_STATE1_START_CHANGING_HELD_ITEM; } void Player_UpdateItems(Player* this, PlayState* play) { - if ((this->actor.category == ACTORCAT_PLAYER) && (CVarGetInteger(CVAR_ENHANCEMENT("QuickPutaway"), 0) || !(this->stateFlags1 & PLAYER_STATE1_START_PUTAWAY)) && + if ((this->actor.category == ACTORCAT_PLAYER) && (CVarGetInteger(CVAR_ENHANCEMENT("QuickPutaway"), 0) || !(this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM)) && ((this->heldItemAction == this->itemAction) || (this->stateFlags1 & PLAYER_STATE1_SHIELDING)) && (gSaveContext.health != 0) && (play->csCtx.state == CS_STATE_IDLE) && (this->csAction == 0) && (play->shootingGalleryStatus == 0) && (play->activeCamera == MAIN_CAM) && @@ -2368,7 +2638,7 @@ void Player_UpdateItems(Player* this, PlayState* play) { Player_ProcessItemButtons(this, play); } - if (this->stateFlags1 & PLAYER_STATE1_START_PUTAWAY) { + if (this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) { Player_StartChangingHeldItem(this, play); } } @@ -2465,9 +2735,9 @@ void func_80834644(PlayState* play, Player* this) { Player_SetUpperActionFunc(this, sItemActionUpdateFuncs[this->heldItemAction]); this->unk_834 = 0; - this->unk_6AC = 0; + this->idleType = PLAYER_IDLE_DEFAULT; Player_DetachHeldActor(play, this); - this->stateFlags1 &= ~PLAYER_STATE1_START_PUTAWAY; + this->stateFlags1 &= ~PLAYER_STATE1_START_CHANGING_HELD_ITEM; } LinkAnimationHeader* func_808346C4(PlayState* play, Player* this) { @@ -2489,7 +2759,7 @@ s32 func_80834758(PlayState* play, Player* this) { if (!(this->stateFlags1 & (PLAYER_STATE1_SHIELDING | PLAYER_STATE1_ON_HORSE | PLAYER_STATE1_IN_CUTSCENE)) && (play->shootingGalleryStatus == 0) && (this->heldItemAction == this->itemAction) && - (this->currentShield != PLAYER_SHIELD_NONE) && !Player_IsChildWithHylianShield(this) && func_80833BCC(this) && + (this->currentShield != PLAYER_SHIELD_NONE) && !Player_IsChildWithHylianShield(this) && Player_IsZTargeting(this) && CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { anim = func_808346C4(play, this); @@ -2505,9 +2775,9 @@ s32 func_80834758(PlayState* play, Player* this) { s32 func_8083485C(Player* this, PlayState* play) { if (func_80834758(play, this)) { - return 1; + return true; } else { - return 0; + return false; } } @@ -2533,11 +2803,11 @@ void Player_WaitToFinishItemChange(PlayState* play, Player* this) { Player_FinishItemChange(play, this); } - func_80833B54(this); + Player_UpdateHostileLockOn(this); } s32 func_8083499C(Player* this, PlayState* play) { - if (this->stateFlags1 & PLAYER_STATE1_START_PUTAWAY) { + if (this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) { Player_StartChangingHeldItem(this, play); } else { return 0; @@ -2547,14 +2817,14 @@ s32 func_8083499C(Player* this, PlayState* play) { } /** - * The actual sword weapon is not handled here. See `Player_ActionChange_7` for melee weapon usage. + * The actual sword weapon is not handled here. See `Player_ActionHandler_7` for melee weapon usage. * This upper body action allows for shielding or changing held items while a sword is in hand. */ s32 Player_UpperAction_Sword(Player* this, PlayState* play) { if (func_80834758(play, this) || func_8083499C(this, play)) { - return 1; + return true; } else { - return 0; + return false; } } @@ -2565,20 +2835,21 @@ s32 Player_UpperAction_ChangeHeldItem(Player* this, PlayState* play) { (sUseHeldItem || ((this->modelAnimType != PLAYER_ANIMTYPE_3) && (play->shootingGalleryStatus == 0)))))) { Player_SetUpperActionFunc(this, sItemActionUpdateFuncs[this->heldItemAction]); this->unk_834 = 0; - this->unk_6AC = 0; + this->idleType = PLAYER_IDLE_DEFAULT; sHeldItemButtonIsHeldDown = sUseHeldItem; + return this->upperActionFunc(this, play); } - if (func_80833350(this) != 0) { + if (Player_CheckForIdleAnim(this) != IDLE_ANIM_NONE) { Player_WaitToFinishItemChange(play, this); - Player_AnimPlayOnce(play, this, func_80833338(this)); - this->unk_6AC = 0; + Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this)); + this->idleType = PLAYER_IDLE_DEFAULT; } else { Player_WaitToFinishItemChange(play, this); } - return 1; + return true; } s32 func_80834B5C(Player* this, PlayState* play) { @@ -2586,11 +2857,11 @@ s32 func_80834B5C(Player* this, PlayState* play) { if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { func_80834894(this); - return 1; + return true; } else { this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); - return 1; + return true; } } @@ -2607,7 +2878,7 @@ s32 func_80834BD4(Player* this, PlayState* play) { this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); - return 1; + return true; } s32 func_80834C74(Player* this, PlayState* play) { @@ -2617,12 +2888,13 @@ s32 func_80834C74(Player* this, PlayState* play) { Player_SetUpperActionFunc(this, sItemActionUpdateFuncs[this->heldItemAction]); LinkAnimation_PlayLoop(play, &this->upperSkelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType)); - this->unk_6AC = 0; + this->idleType = PLAYER_IDLE_DEFAULT; this->upperActionFunc(this, play); - return 0; + + return false; } - return 1; + return true; } s32 func_80834D2C(Player* this, PlayState* play) { @@ -2647,7 +2919,7 @@ s32 func_80834D2C(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_ON_HORSE) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_uma_anim_walk); - } else if ((this->actor.bgCheckFlags & 1) && !func_80833B54(this)) { + } else if ((this->actor.bgCheckFlags & 1) && !Player_UpdateHostileLockOn(this)) { Player_AnimPlayLoop(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType)); } @@ -2670,7 +2942,7 @@ int func_80834E7C(PlayState* play) { s32 func_80834EB8(Player* this, PlayState* play) { if ((this->unk_6AD == 0) || (this->unk_6AD == 2)) { - if (func_80833BCC(this) || + if (Player_IsZTargeting(this) || (Camera_CheckValidMode(Play_GetCamera(play, 0), 7) == 0)) { return 1; } @@ -2681,7 +2953,7 @@ s32 func_80834EB8(Player* this, PlayState* play) { } s32 func_80834F2C(Player* this, PlayState* play) { - if ((this->doorType == PLAYER_DOORTYPE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_THREW_BOOMERANG)) { + if ((this->doorType == PLAYER_DOORTYPE_NONE) && !(this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN)) { if (sUseHeldItem || func_80834E44(play)) { if (func_80834D2C(this, play)) { return func_80834EB8(this, play); @@ -2713,12 +2985,12 @@ s32 func_8083501C(Player* this, PlayState* play) { if ((!Player_HoldsHookshot(this) || func_80834FBC(this)) && !func_80834758(play, this) && !func_80834F2C(this, play)) { - return 0; + return false; } else if (this->rideActor != NULL) { this->unk_6AD = 2; // OTRTODO: THIS IS A BAD IDEA BUT IT FIXES THE HORSE FIRST PERSON? } - return 1; + return true; } // Fire the projectile @@ -2773,10 +3045,10 @@ s32 func_808351D4(Player* this, PlayState* play) { sp2C = 1; } - Math_ScaledStepToS(&this->unk_6C0, 1200, 400); - this->unk_6AE |= 0x100; + Math_ScaledStepToS(&this->upperLimbRot.z, 1200, 400); + this->unk_6AE_rotFlags |= UNK6AE_ROT_UPPER_Z; - if ((this->unk_836 == 0) && (func_80833350(this) == 0) && + if ((this->unk_836 == 0) && (Player_CheckForIdleAnim(this) == IDLE_ANIM_NONE) && (this->skelAnime.animation == &gPlayerAnim_link_bow_side_walk)) { LinkAnimation_PlayOnce(play, &this->upperSkelAnime, D_808543CC[sp2C]); this->unk_836 = -1; @@ -2810,14 +3082,14 @@ s32 func_808351D4(Player* this, PlayState* play) { this->stateFlags1 |= PLAYER_STATE1_READY_TO_FIRE; } - return 1; + return true; } s32 func_808353D8(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->upperSkelAnime); if (Player_HoldsHookshot(this) && !func_80834FBC(this)) { - return 1; + return true; } if (!func_80834758(play, this) && @@ -2836,11 +3108,12 @@ s32 func_808353D8(Player* this, PlayState* play) { this->unk_834--; } - if (func_80833BCC(this) || (this->unk_6AD != 0) || (this->stateFlags1 & PLAYER_STATE1_FIRST_PERSON)) { + if (Player_IsZTargeting(this) || (this->unk_6AD != 0) || (this->stateFlags1 & PLAYER_STATE1_FIRST_PERSON)) { if (this->unk_834 == 0) { this->unk_834++; } - return 1; + + return true; } if (Player_HoldsHookshot(this)) { @@ -2853,7 +3126,7 @@ s32 func_808353D8(Player* this, PlayState* play) { this->unk_834 = 0; } - return 1; + return true; } s32 func_80835588(Player* this, PlayState* play) { @@ -2861,17 +3134,19 @@ s32 func_80835588(Player* this, PlayState* play) { Player_SetUpperActionFunc(this, func_8083501C); } - return 1; + return true; } -void func_808355DC(Player* this) { - this->stateFlags1 |= PLAYER_STATE1_TARGET_NOTHING; +void Player_SetParallel(Player* this) { + this->stateFlags1 |= PLAYER_STATE1_PARALLEL; - if (!(this->skelAnime.moveFlags & 0x80) && (this->actor.bgCheckFlags & 0x200) && (sShapeYawToTouchedWall < 0x2000)) { + if (!(this->skelAnime.moveFlags & 0x80) && + (this->actor.bgCheckFlags & 0x200) && (sShapeYawToTouchedWall < 0x2000)) { + // snap to the wall this->yaw = this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; } - this->zTargetYaw = this->actor.shape.rot.y; + this->parallelYaw = this->actor.shape.rot.y; } s32 func_80835644(PlayState* play, Player* this, Actor* arg2) { @@ -2899,10 +3174,10 @@ s32 Player_UpperAction_CarryActor(Player* this, PlayState* play) { } if (func_80834758(play, this)) { - return 1; + return true; } - if (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { if (LinkAnimation_Update(play, &this->upperSkelAnime)) { LinkAnimation_PlayLoop(play, &this->upperSkelAnime, &gPlayerAnim_link_normal_carryB_wait); } @@ -2913,7 +3188,7 @@ s32 Player_UpperAction_CarryActor(Player* this, PlayState* play) { this->fallStartHeight = this->actor.world.pos.y; } - return 1; + return true; } return func_8083485C(this, play); @@ -2929,16 +3204,16 @@ void func_808357E8(Player* this, Gfx** dLists) { s32 func_80835800(Player* this, PlayState* play) { if (func_80834758(play, this)) { - return 1; + return true; } - if (this->stateFlags1 & PLAYER_STATE1_THREW_BOOMERANG) { + if (this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN) { Player_SetUpperActionFunc(this, func_80835B60); } else if (func_80834F2C(this, play)) { - return 1; + return true; } - return 0; + return false; } s32 func_80835884(Player* this, PlayState* play) { @@ -2949,7 +3224,7 @@ s32 func_80835884(Player* this, PlayState* play) { func_80834EB8(this, play); - return 1; + return true; } s32 func_808358F0(Player* this, PlayState* play) { @@ -2971,7 +3246,7 @@ s32 func_808358F0(Player* this, PlayState* play) { (this->unk_870 < 0.5f) ? &gPlayerAnim_link_boom_throwR : &gPlayerAnim_link_boom_throwL); } - return 1; + return true; } s32 func_808359FC(Player* this, PlayState* play) { @@ -2981,68 +3256,51 @@ s32 func_808359FC(Player* this, PlayState* play) { } else if (LinkAnimation_OnFrame(&this->upperSkelAnime, 6.0f)) { f32 posX = (Math_SinS(this->actor.shape.rot.y) * 10.0f) + this->actor.world.pos.x; f32 posZ = (Math_CosS(this->actor.shape.rot.y) * 10.0f) + this->actor.world.pos.z; - s32 yaw = (this->unk_664 != NULL) ? this->actor.shape.rot.y + 14000 : this->actor.shape.rot.y; + s32 yaw = (this->focusActor != NULL) ? this->actor.shape.rot.y + 14000 : this->actor.shape.rot.y; EnBoom* boomerang = (EnBoom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOOM, posX, this->actor.world.pos.y + 30.0f, posZ, this->actor.focus.rot.x, yaw, 0, 0, true); this->boomerangActor = &boomerang->actor; + if (boomerang != NULL) { - boomerang->moveTo = this->unk_664; + boomerang->moveTo = this->focusActor; boomerang->returnTimer = 20; - this->stateFlags1 |= PLAYER_STATE1_THREW_BOOMERANG; - if (!func_8008E9C4(this)) { - func_808355DC(this); + this->stateFlags1 |= PLAYER_STATE1_BOOMERANG_THROWN; + + if (!Player_CheckHostileLockOn(this)) { + Player_SetParallel(this); } + this->unk_A73 = 4; Player_PlaySfx(this, NA_SE_IT_BOOMERANG_THROW); - func_80832698(this, NA_SE_VO_LI_SWORD_N); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_N); } } - return 1; -} - -s32 spawn_boomerang_ivan(EnPartner* this, PlayState* play) { - if (!CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0)) { - return 0; - } - - f32 posX = (Math_SinS(this->actor.shape.rot.y) * 1.0f) + this->actor.world.pos.x; - f32 posZ = (Math_CosS(this->actor.shape.rot.y) * 1.0f) + this->actor.world.pos.z; - s32 yaw = this->actor.shape.rot.y; - EnBoom* boomerang = - (EnBoom*)Actor_Spawn(&play->actorCtx, play, ACTOR_EN_BOOM, posX, this->actor.world.pos.y + 7.0f, posZ, - this->actor.focus.rot.x, yaw, 0, 0, true); - - this->boomerangActor = &boomerang->actor; - if (boomerang != NULL) { - boomerang->returnTimer = 20; - Audio_PlayActorSound2(&this->actor, NA_SE_IT_BOOMERANG_THROW); - } - - return 1; + return true; } s32 func_80835B60(Player* this, PlayState* play) { if (func_80834758(play, this)) { - return 1; + return true; } - if (!(this->stateFlags1 & PLAYER_STATE1_THREW_BOOMERANG)) { + if (!(this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN)) { Player_SetUpperActionFunc(this, func_80835C08); LinkAnimation_PlayOnce(play, &this->upperSkelAnime, &gPlayerAnim_link_boom_catch); func_808357E8(this, gPlayerLeftHandBoomerangDLs); Player_PlaySfx(this, NA_SE_PL_CATCH_BOOMERANG); - func_80832698(this, NA_SE_VO_LI_SWORD_N); - return 1; + Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_N); + + return true; } if (sUseHeldItem && CVarGetInteger(CVAR_ENHANCEMENT("FastBoomerang"), 0)) { this->boomerangQuickRecall = true; } - return 0; + return false; } s32 func_80835C08(Player* this, PlayState* play) { @@ -3050,7 +3308,7 @@ s32 func_80835C08(Player* this, PlayState* play) { Player_SetUpperActionFunc(this, func_80835800); } - return 1; + return true; } s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { @@ -3071,45 +3329,63 @@ s32 Player_SetupAction(PlayState* play, Player* this, PlayerActionFunc actionFun func_8008EC70(this); } - if (!(flags & 1) && !(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { + if (!(flags & 1) && !(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) { func_80834644(play, this); this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; } - func_80832DBC(this); - - this->stateFlags1 &= ~(PLAYER_STATE1_HOOKSHOT_FALLING | PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DAMAGED | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE | + Player_FinishAnimMovement(this); + + this->stateFlags1 &= ~(PLAYER_STATE1_HOOKSHOT_FALLING | PLAYER_STATE1_TALKING | PLAYER_STATE1_DAMAGED | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE | PLAYER_STATE1_FLOOR_DISABLED); - this->stateFlags2 &= ~(PLAYER_STATE2_HOPPING | PLAYER_STATE2_OCARINA_PLAYING | PLAYER_STATE2_IDLING); - this->stateFlags3 &= ~(PLAYER_STATE3_MIDAIR | PLAYER_STATE3_FINISHED_ATTACKING | PLAYER_STATE3_HOOKSHOT_TRAVELLING); - + this->stateFlags2 &= ~(PLAYER_STATE2_HOPPING | PLAYER_STATE2_OCARINA_PLAYING | PLAYER_STATE2_IDLE_FIDGET); + this->stateFlags3 &= ~(PLAYER_STATE3_MIDAIR | PLAYER_STATE3_FINISHED_ATTACKING | PLAYER_STATE3_FLYING_WITH_HOOKSHOT); + this->av1.actionVar1 = 0; this->av2.actionVar2 = 0; - - this->unk_6AC = 0; - + + this->idleType = PLAYER_IDLE_DEFAULT; + func_808326F0(this); return 1; } -void func_80835DAC(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { - s32 temp; +/** + * Calls `Player_SetupAction` to setup a new action, but takes extra measures to + * preserve AnimMovement while doing so. + */ +void Player_SetupActionPreserveAnimMovement(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { + s32 savedMovementFlags; - temp = this->skelAnime.moveFlags; + savedMovementFlags = this->skelAnime.moveFlags; + + // Setting `skelAnime.movementFlags` to 0 will prevent `Player_FinishAnimMovement` from ending + // AnimMovement when `Player_SetupAction` is called. this->skelAnime.moveFlags = 0; + Player_SetupAction(play, this, actionFunc, flags); - this->skelAnime.moveFlags = temp; + this->skelAnime.moveFlags = savedMovementFlags; } -void func_80835DE4(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { - s32 temp; +/** + * Calls `Player_SetupAction` to setup a new action, but takes extra measures to + * preserve the current itemAction while doing so. + * + * Note that `itemAction` must be PLAYER_IA_NONE or higher for the action change to take place. + */ +void Player_SetupActionPreserveItemAction(PlayState* play, Player* this, PlayerActionFunc actionFunc, s32 flags) { + s32 savedItemAction; - if (this->itemAction >= 0) { - temp = this->itemAction; + if (this->itemAction >= PLAYER_IA_NONE) { + savedItemAction = this->itemAction; + + // Setting `itemAction` to `heldItemAction` will prevent `func_8008EC70` from running when + // `Player_SetupAction` is called. this->itemAction = this->heldItemAction; + Player_SetupAction(play, this, actionFunc, flags); - this->itemAction = temp; + this->itemAction = savedItemAction; Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction)); } } @@ -3209,7 +3485,7 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { } else if (((itemAction >= PLAYER_IA_OCARINA_FAIRY) && (itemAction <= PLAYER_IA_OCARINA_OF_TIME)) || (itemAction >= PLAYER_IA_BOTTLE_FISH)) { // Handle "cutscene items" - if (!func_8008E9C4(this) || + if (!Player_CheckHostileLockOn(this) || ((itemAction >= PLAYER_IA_BOTTLE_POTION_RED) && (itemAction <= PLAYER_IA_BOTTLE_FAIRY))) { func_8002D53C(play, &play->actorCtx.titleCtx); this->unk_6AD = 4; @@ -3230,7 +3506,7 @@ void Player_UseItem(PlayState* play, Player* this, s32 item) { this->heldItemAction < PLAYER_IA_BOW || this->heldItemAction > PLAYER_IA_BOW_0E)) { // Start the held item change process this->heldItemId = item; - this->stateFlags1 |= PLAYER_STATE1_START_PUTAWAY; + this->stateFlags1 |= PLAYER_STATE1_START_CHANGING_HELD_ITEM; } else { // Init new held item for use Player_DestroyHookshot(this); @@ -3260,7 +3536,7 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { } func_80832224(this); - func_80832698(this, NA_SE_VO_LI_DOWN); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_DOWN); if (this->actor.category == ACTORCAT_PLAYER) { func_800F47BC(); @@ -3281,77 +3557,120 @@ void func_80836448(PlayState* play, Player* this, LinkAnimationHeader* anim) { } } -s32 Player_CanUpdateItems(Player* this) { - return (!(Player_Action_808458D0 == this->actionFunc) || - ((this->stateFlags1 & PLAYER_STATE1_START_PUTAWAY) && +int Player_CanUpdateItems(Player* this) { + return (!(Player_Action_WaitForPutAway == this->actionFunc) || + ((this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) && ((this->heldItemId == ITEM_LAST_USED) || (this->heldItemId == ITEM_NONE)))) && (!(Player_UpperAction_ChangeHeldItem == this->upperActionFunc) || (Player_ItemToItemAction(this->heldItemId) == this->heldItemAction)); } +/** + * Updates the Upper Body system. + * The Upper Body system is composed of an upper action function and + * a separate skelanime that can play an animation which is different + * from the main skelanime. + * + * @return true if the upper body is "busy", false otherwise. + * + * The upper body being "busy" can mean a few things: + * - Hookshot has just connected with something that Player can fly to + * - A deku nut is currently being thrown + * - The current upper action function has indicated that it is busy + * + * If an upper action indicates being busy by returning true, the + * animation playing in the upper body skeleton will be used. + * This animation may be used for all limbs or only the upper body limbs + * depending on some conditions. See details below. + */ s32 Player_UpdateUpperBody(Player* this, PlayState* play) { if (!(this->stateFlags1 & PLAYER_STATE1_ON_HORSE) && (this->actor.parent != NULL) && Player_HoldsHookshot(this)) { Player_SetupAction(play, this, Player_Action_80850AEC, 1); - this->stateFlags3 |= PLAYER_STATE3_HOOKSHOT_TRAVELLING; + this->stateFlags3 |= PLAYER_STATE3_FLYING_WITH_HOOKSHOT; Player_AnimPlayOnce(play, this, &gPlayerAnim_link_hook_fly_start); - Player_AnimReplaceApplyFlags(play, this, 0x9B); + Player_StartAnimMovement(play, this, 0x9B); func_80832224(this); this->yaw = this->actor.shape.rot.y; this->actor.bgCheckFlags &= ~1; this->hoverBootsTimer = 0; - this->unk_6AE |= 0x43; - func_80832698(this, NA_SE_VO_LI_LASH); - return 1; + this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_FOCUS_Y | UNK6AE_ROT_UPPER_X; + Player_PlayVoiceSfx(this, NA_SE_VO_LI_LASH); + return true; } if (Player_CanUpdateItems(this)) { Player_UpdateItems(this, play); if (Player_Action_8084E604 == this->actionFunc) { - return 1; + return true; } } if (!this->upperActionFunc(this, play)) { - return 0; + return false; } - if (this->upperAnimBlendWeight != 0.0f) { - if ((func_80833350(this) == 0) || (this->linearVelocity != 0.0f)) { + if (this->upperAnimInterpWeight != 0.0f) { + // The functionality contained within this block of code is never used in practice + // because `upperAnimInterpWeight` is always 0. + if ((Player_CheckForIdleAnim(this) == IDLE_ANIM_NONE) || (this->linearVelocity != 0.0f)) { AnimationContext_SetCopyFalse(play, this->skelAnime.limbCount, this->upperSkelAnime.jointTable, this->skelAnime.jointTable, sUpperBodyLimbCopyMap); } - Math_StepToF(&this->upperAnimBlendWeight, 0.0f, 0.25f); + Math_StepToF(&this->upperAnimInterpWeight, 0.0f, 0.25f); AnimationContext_SetInterp(play, this->skelAnime.limbCount, this->skelAnime.jointTable, - this->upperSkelAnime.jointTable, 1.0f - this->upperAnimBlendWeight); - } else if ((func_80833350(this) == 0) || (this->linearVelocity != 0.0f)) { + this->upperSkelAnime.jointTable, 1.0f - this->upperAnimInterpWeight); + } else if ((Player_CheckForIdleAnim(this) == IDLE_ANIM_NONE) || (this->linearVelocity != 0.0f)) { + // Only copy the upper body animation to the upper body limbs in the main skeleton. + // Doing so allows the main skeleton to play its own animation for the lower body limbs. AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->upperSkelAnime.jointTable, sUpperBodyLimbCopyMap); } else { + // Copy all of the upper body animation into the whole main skeleton. + // The upper body has full control of all limbs. AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->upperSkelAnime.jointTable); } - return 1; + return true; } -s32 func_80836898(PlayState* play, Player* this, PlayerFuncA74 func) { - this->func_A74 = func; - Player_SetupAction(play, this, Player_Action_808458D0, 0); +/** + * Sets up `Player_Action_WaitForPutAway`, which will allow the held item put away process + * to complete before moving on to a new action. + * + * The function provided by the `afterPutAwayFunc` argument will run after the put away is complete. + * This function is expected to set a new action and move execution away from `Player_Action_WaitForPutAway`. + * + * @return From `Player_PutAwayHeldItem`: true if an item needs to be put away, false if not. + */ +s32 Player_SetupWaitForPutAway(PlayState* play, Player* this, AfterPutAwayFunc afterPutAwayFunc) { + this->afterPutAwayFunc = afterPutAwayFunc; + Player_SetupAction(play, this, Player_Action_WaitForPutAway, 0); this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; - return func_80832528(play, this); + + return Player_PutAwayHeldItem(play, this); } -void func_808368EC(Player* this, PlayState* play) { +/** + * Updates Shape Yaw (`shape.rot.y`). In other words, the Y rotation of Player's model. + * This does not affect the direction Player will move in. + * + * There are 3 modes shape yaw can be updated with, based on player state: + * - Lock on: Rotates Player to face the current lock on target. + * - Parallel: Rotates Player to face the current Parallel angle, set when Z-Targeting without an actor lock-on + * - Normal: Rotates Player to face `this->yaw`, the direction he is currently moving + */ +void Player_UpdateShapeYaw(Player* this, PlayState* play) { s16 previousYaw = this->actor.shape.rot.y; if (!(this->stateFlags2 & (PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS))) { - if ((this->unk_664 != NULL) && + if ((this->focusActor != NULL) && ((play->actorCtx.targetCtx.unk_4B != 0) || (this->actor.category != ACTORCAT_PLAYER))) { Math_ScaledStepToS(&this->actor.shape.rot.y, - Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos), 4000); - } else if ((this->stateFlags1 & PLAYER_STATE1_TARGET_NOTHING) && + Math_Vec3f_Yaw(&this->actor.world.pos, &this->focusActor->focus.pos), 4000); + } else if ((this->stateFlags1 & PLAYER_STATE1_PARALLEL) && !(this->stateFlags2 & (PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS))) { - Math_ScaledStepToS(&this->actor.shape.rot.y, this->zTargetYaw, 4000); + Math_ScaledStepToS(&this->actor.shape.rot.y, this->parallelYaw, 4000); } } else if (!(this->stateFlags2 & PLAYER_STATE2_DISABLE_ROTATION_ALWAYS)) { Math_ScaledStepToS(&this->actor.shape.rot.y, this->yaw, 2000); @@ -3360,151 +3679,235 @@ void func_808368EC(Player* this, PlayState* play) { this->unk_87C = this->actor.shape.rot.y - previousYaw; } -s32 func_808369C8(s16* pValue, s16 arg1, s16 arg2, s16 arg3, s16 arg4, s16 arg5) { - s16 temp1; - s16 temp2; - s16 temp3; +/** + * Step a value by `step` to a `target` value. + * Constrains the value to be no further than `constraintRange` from `constraintMid` (accounting for wrapping). + * Constrains the value to be no further than `overflowRange` from 0. + * If this second constraint is enforced, return how much the value was past by the range, or return 0. + * + * @return The amount by which the value overflowed the absolute range defined by `overflowRange` + */ +s32 Player_ScaledStepBinangClamped(s16* pValue, s16 target, s16 step, s16 overflowRange, s16 constraintMid, + s16 constraintRange) { + s16 diff; + s16 clampedDiff; + s16 valueBeforeOverflowClamp; - temp1 = temp2 = arg4 - *pValue; - temp2 = CLAMP(temp2, -arg5, arg5); - *pValue += (s16)(temp1 - temp2); + // Clamp value to [constraintMid - constraintRange , constraintMid + constraintRange] + // This is more involved than a simple `CLAMP`, to account for binang wrapping + diff = clampedDiff = constraintMid - *pValue; + clampedDiff = CLAMP(clampedDiff, -constraintRange, constraintRange); + *pValue += (s16)(diff - clampedDiff); - Math_ScaledStepToS(pValue, arg1, arg2); + Math_ScaledStepToS(pValue, target, step); - temp3 = *pValue; - if (*pValue < -arg3) { - *pValue = -arg3; - } else if (*pValue > arg3) { - *pValue = arg3; + valueBeforeOverflowClamp = *pValue; + if (*pValue < -overflowRange) { + *pValue = -overflowRange; + } else if (*pValue > overflowRange) { + *pValue = overflowRange; } - return temp3 - *pValue; + return valueBeforeOverflowClamp - *pValue; } s32 func_80836AB8(Player* this, s32 arg1) { - s16 sp36; - s16 var; + s16 targetUpperBodyYaw; + s16 yaw; - var = this->actor.shape.rot.y; - if (arg1 != 0) { - var = this->actor.focus.rot.y; - this->unk_6BC = this->actor.focus.rot.x; - this->unk_6AE |= 0x41; + yaw = this->actor.shape.rot.y; + if (arg1) { + yaw = this->actor.focus.rot.y; + this->upperLimbRot.x = this->actor.focus.rot.x; + this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_UPPER_X; } else { - func_808369C8(&this->unk_6BC, - func_808369C8(&this->unk_6B6, this->actor.focus.rot.x, 600, 10000, this->actor.focus.rot.x, 0), - 200, 4000, this->unk_6B6, 10000); - sp36 = this->actor.focus.rot.y - var; - func_808369C8(&sp36, 0, 200, 24000, this->unk_6BE, 8000); - var = this->actor.focus.rot.y - sp36; - func_808369C8(&this->unk_6B8, sp36 - this->unk_6BE, 200, 8000, sp36, 8000); - func_808369C8(&this->unk_6BE, sp36, 200, 8000, this->unk_6B8, 8000); - this->unk_6AE |= 0xD9; + // Step the head pitch to the focus pitch. + // If the head cannot be pitched enough, pitch the upper body. + Player_ScaledStepBinangClamped(&this->upperLimbRot.x, + Player_ScaledStepBinangClamped(&this->headLimbRot.x, this->actor.focus.rot.x, + 600, 10000, this->actor.focus.rot.x, 0), + 200, 4000, this->headLimbRot.x, 10000); + + // Step the upper body and head yaw to the focus yaw. + // Eventually prefers turning the upper body rather than the head. + targetUpperBodyYaw = this->actor.focus.rot.y - yaw; + Player_ScaledStepBinangClamped(&targetUpperBodyYaw, 0, 200, 24000, this->upperLimbRot.y, 8000); + yaw = this->actor.focus.rot.y - targetUpperBodyYaw; + Player_ScaledStepBinangClamped(&this->headLimbRot.y, targetUpperBodyYaw - this->upperLimbRot.y, 200, 8000, + targetUpperBodyYaw, 8000); + Player_ScaledStepBinangClamped(&this->upperLimbRot.y, targetUpperBodyYaw, 200, 8000, this->headLimbRot.y, 8000); + + this->unk_6AE_rotFlags |= + UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_HEAD_X | UNK6AE_ROT_HEAD_Y | UNK6AE_ROT_UPPER_X | UNK6AE_ROT_UPPER_Y; } - return var; + return yaw; } -void func_80836BEC(Player* this, PlayState* play) { - s32 sp1C = 0; - s32 zTrigPressed = CHECK_BTN_ALL(sControlInput->cur.button, BTN_Z); - Actor* actorToTarget; +/** + * Updates state related to Z-Targeting. + * + * Z-Targeting is an umbrella term for two main states: + * - Actor Lock-on: Player has locked onto an actor, a reticle appears, both Player and the camera focus on the actor. + * - Parallel: Player and the camera keep facing the same angle from when Z was pressed. Can snap to walls. + * This state occurs when there are no actors available to lock onto. + * + * First this function updates `zTargetActiveTimer`. For most Z-Target related states to update, this + * timer has to have a non-zero value. Additionally, the timer must have a value of 5 or greater + * for the Attention system to recognize that an actor lock-on is active. + * + * Following this, a next lock-on actor is chosen. If there is currently no actor lock-on active, the actor + * Navi is hovering over will be chosen. If there is an active lock-on, the next available + * lock-on will be the actor with an arrow hovering above it. + * + * If the above regarding actor lock-on does not occur, then Z-Parallel can begin. + * + * Lastly, the function handles updating general "actor focus" state. This applies to non Z-Target states + * like talking to an actor. If the current focus actor is not considered "hostile", then + * `PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS` can be set. This flag being set will trigger `Player_UpdateCamAndSeqModes` + * to make the camera focus on the current focus actor. + */ +void Player_UpdateZTargeting(Player* this, PlayState* play) { + s32 ignoreLeash = false; + s32 zButtonHeld = CHECK_BTN_ALL(sControlInput->cur.button, BTN_Z); + Actor* nextLockOnActor; s32 pad; - s32 holdTarget; - s32 cond; + s32 usingHoldTargeting; + s32 isTalking; - if (!zTrigPressed) { - this->stateFlags1 &= ~PLAYER_STATE1_30; + if (!zButtonHeld) { + this->stateFlags1 &= ~PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE; } if ((play->csCtx.state != CS_STATE_IDLE) || (this->csAction != 0) || - (this->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_CUTSCENE)) || (this->stateFlags3 & PLAYER_STATE3_HOOKSHOT_TRAVELLING)) { - this->unk_66C = 0; - } else if (zTrigPressed || (this->stateFlags2 & PLAYER_STATE2_SWITCH_TARGETING) || (this->unk_684 != NULL)) { - if (this->unk_66C <= 5) { - this->unk_66C = 5; + (this->stateFlags1 & (PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_CUTSCENE)) || + (this->stateFlags3 & PLAYER_STATE3_FLYING_WITH_HOOKSHOT)) { + // Don't allow Z-Targeting in various states + this->zTargetActiveTimer = 0; + } else if (zButtonHeld || (this->stateFlags2 & PLAYER_STATE2_LOCK_ON_WITH_SWITCH) || + (this->autoLockOnActor != NULL)) { + // While a lock-on is active, decrement the timer and hold it at 5. + // Values under 5 indicate a lock-on has ended and will make the reticle release. + // See usage toward the end of `Actor_UpdateAll`. + // + // `zButtonHeld` will also be true for Parallel. This is necessary because the timer + // needs to be non-zero for `Player_SetParallel` to be able to run below. + if (this->zTargetActiveTimer <= 5) { + this->zTargetActiveTimer = 5; } else { - this->unk_66C--; + this->zTargetActiveTimer--; } - } else if (this->stateFlags1 & PLAYER_STATE1_TARGET_NOTHING) { - this->unk_66C = 0; - } else if (this->unk_66C != 0) { - this->unk_66C--; + } else if (this->stateFlags1 & PLAYER_STATE1_PARALLEL) { + // If the above code block which checks `zButtonHeld` is not taken, that means Z has been released. + // In that case, setting `zTargetActiveTimer` to 0 will stop Parallel if it is currently active. + this->zTargetActiveTimer = 0; + } else if (this->zTargetActiveTimer != 0) { + this->zTargetActiveTimer--; } - if (this->unk_66C >= 6) { - sp1C = 1; + if (this->zTargetActiveTimer >= 6) { + // When a lock-on is started, `zTargetActiveTimer` will be set to 15 and then immediately start decrementing + // down to 5. During this 10 frame period, set `ignoreLeash` so that the lock-on will temporarily + // have an infinite leash distance. + // This gives time for the reticle to settle while it locks on, even if the player leaves the leash range. + ignoreLeash = true; } - cond = func_8083224C(play); - if (cond || (this->unk_66C != 0) || (this->stateFlags1 & (PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_THREW_BOOMERANG))) { - if (!cond) { - if (!(this->stateFlags1 & PLAYER_STATE1_THREW_BOOMERANG) && + isTalking = Player_IsTalking(play); + + if (isTalking || (this->zTargetActiveTimer != 0) || + (this->stateFlags1 & (PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_BOOMERANG_THROWN))) { + if (!isTalking) { + if (!(this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN) && ((this->heldItemAction != PLAYER_IA_FISHING_POLE) || (this->unk_860 == 0)) && CHECK_BTN_ALL(sControlInput->press.button, BTN_Z)) { if (this->actor.category == ACTORCAT_PLAYER) { - actorToTarget = play->actorCtx.targetCtx.arrowPointedActor; + // The next lock-on actor defaults to the actor Navi is hovering over. + // This may change to the arrow hover actor below. + nextLockOnActor = play->actorCtx.targetCtx.arrowPointedActor; } else { - actorToTarget = &GET_PLAYER(play)->actor; + // Dark Link will always lock onto the player. + nextLockOnActor = &GET_PLAYER(play)->actor; } - holdTarget = (gSaveContext.zTargetSetting != 0) || (this->actor.category != ACTORCAT_PLAYER); - this->stateFlags1 |= PLAYER_STATE1_TARGETING; + // Get saved Z Target setting. + // Dark Link uses Hold Targeting. + usingHoldTargeting = (gSaveContext.zTargetSetting != 0) || (this->actor.category != ACTORCAT_PLAYER); - if ((actorToTarget != NULL) && !(actorToTarget->flags & ACTOR_FLAG_NO_LOCKON)) { - if ((actorToTarget == this->unk_664) && (this->actor.category == ACTORCAT_PLAYER)) { - actorToTarget = play->actorCtx.targetCtx.unk_94; + this->stateFlags1 |= PLAYER_STATE1_Z_TARGETING; + + if ((nextLockOnActor != NULL) && !(nextLockOnActor->flags & ACTOR_FLAG_NO_LOCKON)) { + + // Navi hovers over the current lock-on actor, so `nextLockOnActor` and `focusActor` + // will be the same if already locked on. + // In this case, `nextLockOnActor` will be the arrow hover actor instead. + if ((nextLockOnActor == this->focusActor) && (this->actor.category == ACTORCAT_PLAYER)) { + nextLockOnActor = play->actorCtx.targetCtx.unk_94; } - if (actorToTarget != this->unk_664) { - if (!holdTarget) { - this->stateFlags2 |= PLAYER_STATE2_SWITCH_TARGETING; + if (nextLockOnActor != this->focusActor) { + // Set new lock-on + + if (!usingHoldTargeting) { + this->stateFlags2 |= PLAYER_STATE2_LOCK_ON_WITH_SWITCH; } - this->unk_664 = actorToTarget; - this->unk_66C = 15; - this->stateFlags2 &= ~(PLAYER_STATE2_SPEAK_OR_CHECK | PLAYER_STATE2_NAVI_ALERT); + + this->focusActor = nextLockOnActor; + this->zTargetActiveTimer = 15; + this->stateFlags2 &= ~(PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER | PLAYER_STATE2_NAVI_ALERT); } else { - if (!holdTarget) { - func_8008EDF0(this); + if (!usingHoldTargeting) { + Player_ReleaseLockOn(this); } } - this->stateFlags1 &= ~PLAYER_STATE1_30; + this->stateFlags1 &= ~PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE; } else { - if (!(this->stateFlags1 & (PLAYER_STATE1_TARGET_NOTHING | PLAYER_STATE1_30))) { - func_808355DC(this); + // Lock-on was not started above. Set Parallel Mode. + if (!(this->stateFlags1 & (PLAYER_STATE1_PARALLEL | PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE))) { + Player_SetParallel(this); } } } - if (this->unk_664 != NULL) { - if ((this->actor.category == ACTORCAT_PLAYER) && (this->unk_664 != this->unk_684) && - func_8002F0C8(this->unk_664, this, sp1C)) { - func_8008EDF0(this); - this->stateFlags1 |= PLAYER_STATE1_30; - } else if (this->unk_664 != NULL) { - this->unk_664->targetPriority = 40; + if (this->focusActor != NULL) { + if ((this->actor.category == ACTORCAT_PLAYER) && (this->focusActor != this->autoLockOnActor) && + func_8002F0C8(this->focusActor, this, ignoreLeash)) { + Player_ReleaseLockOn(this); + this->stateFlags1 |= PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE; + } else if (this->focusActor != NULL) { + this->focusActor->targetPriority = 40; } - } else if (this->unk_684 != NULL) { - this->unk_664 = this->unk_684; + } else if (this->autoLockOnActor != NULL) { + // Because of the previous if condition above, `autoLockOnActor` does not take precedence + // over `focusActor` if it already exists. + // However, `autoLockOnActor` is expected to be set with `Player_SetAutoLockOnActor` + // which will release any existing lock-on before setting the new one. + this->focusActor = this->autoLockOnActor; } } - if (this->unk_664 != NULL) { - this->stateFlags1 &= ~(PLAYER_STATE1_TARGET_LOCKED | PLAYER_STATE1_TARGET_NOTHING); - if ((this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) || - !CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_HOSTILE)) { - this->stateFlags1 |= PLAYER_STATE1_TARGET_LOCKED; + if (this->focusActor != NULL) { + this->stateFlags1 &= ~(PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS | PLAYER_STATE1_PARALLEL); + + // Check if an actor is not hostile, aka "friendly", to set `PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS`. + // + // When carrying another actor, `PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS` will be set even if the actor + // is hostile. This is a special case to allow Player to have more freedom of movement and be able + // to throw a carried actor at the lock-on actor, even if it is hostile. + if ((this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) || + !CHECK_FLAG_ALL(this->focusActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_HOSTILE)) { + this->stateFlags1 |= PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS; } } else { - if (this->stateFlags1 & PLAYER_STATE1_TARGET_NOTHING) { - this->stateFlags2 &= ~PLAYER_STATE2_SWITCH_TARGETING; + if (this->stateFlags1 & PLAYER_STATE1_PARALLEL) { + this->stateFlags2 &= ~PLAYER_STATE2_LOCK_ON_WITH_SWITCH; } else { - func_8008EE08(this); + Player_ClearZTargeting(this); } } } else { - func_8008EE08(this); + Player_ClearZTargeting(this); } } @@ -3555,6 +3958,7 @@ s32 Player_CalcSpeedAndYawFromControlStick(PlayState* play, Player* this, f32* o // See the definition of `SPEED_MODE_LINEAR` and `SPEED_MODE_CURVED` for more information. if (speedMode != SPEED_MODE_LINEAR) { *outSpeedTarget -= 20.0f; + if (*outSpeedTarget < 0.0f) { // If control stick magnitude is below 20, return zero speed. *outSpeedTarget = 0.0f; @@ -3576,7 +3980,7 @@ s32 Player_CalcSpeedAndYawFromControlStick(PlayState* play, Player* this, f32* o floorPitchInfluence = CLAMP(sinFloorPitch, 0.0f, 0.6f); if (this->unk_6C4 != 0.0f) { - speedCap -= (this->unk_6C4 * 0.008f); + speedCap -= this->unk_6C4 * 0.008f; speedCap = CLAMP_MIN(speedCap, 2.0f); } @@ -3590,7 +3994,13 @@ s32 Player_CalcSpeedAndYawFromControlStick(PlayState* play, Player* this, f32* o return false; } -s32 func_8083721C(Player* this) { +/** + * Steps speed toward zero to at a rate defined by current boot data. + * After zero is reached, speed will be held at zero. + * + * @return true if speed is 0, false otherwise + */ +s32 Player_DecelerateToZero(Player* this) { return Math_StepToF(&this->linearVelocity, 0.0f, REG(43) / 100.0f); } @@ -3612,13 +4022,13 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw if (!Player_CalcSpeedAndYawFromControlStick(play, this, outSpeedTarget, outYawTarget, speedMode)) { *outYawTarget = this->actor.shape.rot.y; - if (this->unk_664 != NULL) { + if (this->focusActor != NULL) { if ((play->actorCtx.targetCtx.unk_4B != 0) && !(this->stateFlags2 & PLAYER_STATE2_DISABLE_ROTATION_ALWAYS)) { - *outYawTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_664->focus.pos); + *outYawTarget = Math_Vec3f_Yaw(&this->actor.world.pos, &this->focusActor->focus.pos); return false; } - } else if (func_80833B2C(this)) { - *outYawTarget = this->zTargetYaw; + } else if (Player_FriendlyLockOnOrParallel(this)) { + *outYawTarget = this->parallelYaw; } return false; @@ -3628,139 +4038,145 @@ s32 Player_GetMovementSpeedAndYaw(Player* this, f32* outSpeedTarget, s16* outYaw } } -typedef enum { - /* 0 */ PLAYER_ACTION_CHG_0, - /* 1 */ PLAYER_ACTION_CHG_1, - /* 2 */ PLAYER_ACTION_CHG_2, - /* 3 */ PLAYER_ACTION_CHG_3, - /* 4 */ PLAYER_ACTION_CHG_4, - /* 5 */ PLAYER_ACTION_CHG_5, - /* 6 */ PLAYER_ACTION_CHG_6, - /* 7 */ PLAYER_ACTION_CHG_7, - /* 8 */ PLAYER_ACTION_CHG_8, - /* 9 */ PLAYER_ACTION_CHG_9, - /* 10 */ PLAYER_ACTION_CHG_10, - /* 11 */ PLAYER_ACTION_CHG_11, - /* 12 */ PLAYER_ACTION_CHG_12, - /* 13 */ PLAYER_ACTION_CHG_13 -} ActionChangeIndex; +typedef enum ActionHandlerIndex { + /* 0 */ PLAYER_ACTION_HANDLER_0, + /* 1 */ PLAYER_ACTION_HANDLER_1, + /* 2 */ PLAYER_ACTION_HANDLER_2, + /* 3 */ PLAYER_ACTION_HANDLER_3, + /* 4 */ PLAYER_ACTION_HANDLER_TALK, + /* 5 */ PLAYER_ACTION_HANDLER_5, + /* 6 */ PLAYER_ACTION_HANDLER_ROLL, + /* 7 */ PLAYER_ACTION_HANDLER_7, + /* 8 */ PLAYER_ACTION_HANDLER_8, + /* 9 */ PLAYER_ACTION_HANDLER_9, + /* 10 */ PLAYER_ACTION_HANDLER_10, + /* 11 */ PLAYER_ACTION_HANDLER_11, + /* 12 */ PLAYER_ACTION_HANDLER_12, + /* 13 */ PLAYER_ACTION_HANDLER_13 +} ActionHandlerIndex; -static s8 sActionChangeList1[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, - PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, +static s8 sActionHandlerList1[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_TALK, PLAYER_ACTION_HANDLER_9, + PLAYER_ACTION_HANDLER_10, PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_8, -PLAYER_ACTION_HANDLER_7, }; -static s8 sActionChangeList2[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_5, - PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, - PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_7, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_6, +static s8 sActionHandlerList2[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_1, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_5, + PLAYER_ACTION_HANDLER_3, PLAYER_ACTION_HANDLER_TALK, PLAYER_ACTION_HANDLER_9, PLAYER_ACTION_HANDLER_10, + PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_7, PLAYER_ACTION_HANDLER_8, -PLAYER_ACTION_HANDLER_ROLL, }; -static s8 sActionChangeList3[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_3, - PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, - PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +static s8 sActionHandlerList3[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_1, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_3, + PLAYER_ACTION_HANDLER_TALK, PLAYER_ACTION_HANDLER_9, PLAYER_ACTION_HANDLER_10, PLAYER_ACTION_HANDLER_11, + PLAYER_ACTION_HANDLER_8, PLAYER_ACTION_HANDLER_7, -PLAYER_ACTION_HANDLER_ROLL, }; -static s8 sActionChangeList4[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, - PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, +static s8 sActionHandlerList4[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_TALK, PLAYER_ACTION_HANDLER_9, + PLAYER_ACTION_HANDLER_10, PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_8, -PLAYER_ACTION_HANDLER_7, }; -static s8 sActionChangeList5[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, - PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_12, PLAYER_ACTION_CHG_8, -PLAYER_ACTION_CHG_7, +static s8 sActionHandlerList5[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_TALK, + PLAYER_ACTION_HANDLER_9, PLAYER_ACTION_HANDLER_10, PLAYER_ACTION_HANDLER_11, + PLAYER_ACTION_HANDLER_12, PLAYER_ACTION_HANDLER_8, -PLAYER_ACTION_HANDLER_7, }; -static s8 sActionChangeList6[] = { - -PLAYER_ACTION_CHG_7, +static s8 sActionHandlerListTurnInPlace[] = { + -PLAYER_ACTION_HANDLER_7, }; -static s8 sActionChangeList7[] = { - PLAYER_ACTION_CHG_0, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, - PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, - PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +static s8 sActionHandlerListIdle[] = { + PLAYER_ACTION_HANDLER_0, PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_1, PLAYER_ACTION_HANDLER_2, + PLAYER_ACTION_HANDLER_3, PLAYER_ACTION_HANDLER_5, PLAYER_ACTION_HANDLER_TALK, PLAYER_ACTION_HANDLER_9, + PLAYER_ACTION_HANDLER_8, PLAYER_ACTION_HANDLER_7, -PLAYER_ACTION_HANDLER_ROLL, }; -static s8 sActionChangeList8[] = { - PLAYER_ACTION_CHG_0, PLAYER_ACTION_CHG_11, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, - PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_12, PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, - PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +static s8 sActionHandlerList8[] = { + PLAYER_ACTION_HANDLER_0, PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_1, PLAYER_ACTION_HANDLER_2, + PLAYER_ACTION_HANDLER_3, PLAYER_ACTION_HANDLER_12, PLAYER_ACTION_HANDLER_5, PLAYER_ACTION_HANDLER_TALK, + PLAYER_ACTION_HANDLER_9, PLAYER_ACTION_HANDLER_8, PLAYER_ACTION_HANDLER_7, -PLAYER_ACTION_HANDLER_ROLL, }; -static s8 sActionChangeList9[] = { - PLAYER_ACTION_CHG_13, PLAYER_ACTION_CHG_1, PLAYER_ACTION_CHG_2, PLAYER_ACTION_CHG_3, PLAYER_ACTION_CHG_12, - PLAYER_ACTION_CHG_5, PLAYER_ACTION_CHG_4, PLAYER_ACTION_CHG_9, PLAYER_ACTION_CHG_10, PLAYER_ACTION_CHG_11, - PLAYER_ACTION_CHG_8, PLAYER_ACTION_CHG_7, -PLAYER_ACTION_CHG_6, +static s8 sActionHandlerList9[] = { + PLAYER_ACTION_HANDLER_13, PLAYER_ACTION_HANDLER_1, PLAYER_ACTION_HANDLER_2, PLAYER_ACTION_HANDLER_3, + PLAYER_ACTION_HANDLER_12, PLAYER_ACTION_HANDLER_5, PLAYER_ACTION_HANDLER_TALK, PLAYER_ACTION_HANDLER_9, + PLAYER_ACTION_HANDLER_10, PLAYER_ACTION_HANDLER_11, PLAYER_ACTION_HANDLER_8, PLAYER_ACTION_HANDLER_7, + -PLAYER_ACTION_HANDLER_ROLL, }; -static s8 sActionChangeList10[] = { - PLAYER_ACTION_CHG_10, - PLAYER_ACTION_CHG_8, - -PLAYER_ACTION_CHG_7, +static s8 sActionHandlerList10[] = { + PLAYER_ACTION_HANDLER_10, + PLAYER_ACTION_HANDLER_8, + -PLAYER_ACTION_HANDLER_7, }; -static s8 sActionChangeList11[] = { - PLAYER_ACTION_CHG_0, - PLAYER_ACTION_CHG_12, - PLAYER_ACTION_CHG_5, - -PLAYER_ACTION_CHG_4, +static s8 sActionHandlerList11[] = { + PLAYER_ACTION_HANDLER_0, + PLAYER_ACTION_HANDLER_12, + PLAYER_ACTION_HANDLER_5, + -PLAYER_ACTION_HANDLER_TALK, }; -s32 Player_ActionChange_0(Player* this, PlayState* play); -s32 Player_ActionChange_1(Player* this, PlayState* play); -s32 Player_ActionChange_2(Player* this, PlayState* play); -s32 Player_ActionChange_3(Player* this, PlayState* play); -s32 Player_ActionChange_4(Player* this, PlayState* play); -s32 Player_ActionChange_5(Player* this, PlayState* play); -s32 Player_ActionChange_6(Player* this, PlayState* play); -s32 Player_ActionChange_7(Player* this, PlayState* play); -s32 Player_ActionChange_8(Player* this, PlayState* play); -s32 Player_ActionChange_9(Player* this, PlayState* play); -s32 Player_ActionChange_10(Player* this, PlayState* play); -s32 Player_ActionChange_11(Player* this, PlayState* play); -s32 Player_ActionChange_12(Player* this, PlayState* play); -s32 Player_ActionChange_13(Player* this, PlayState* play); +s32 Player_ActionHandler_0(Player* this, PlayState* play); +s32 Player_ActionHandler_1(Player* this, PlayState* play); +s32 Player_ActionHandler_2(Player* this, PlayState* play); +s32 Player_ActionHandler_3(Player* this, PlayState* play); +s32 Player_ActionHandler_Talk(Player* this, PlayState* play); +s32 Player_ActionHandler_5(Player* this, PlayState* play); +s32 Player_ActionHandler_Roll(Player* this, PlayState* play); +s32 Player_ActionHandler_7(Player* this, PlayState* play); +s32 Player_ActionHandler_8(Player* this, PlayState* play); +s32 Player_ActionHandler_9(Player* this, PlayState* play); +s32 Player_ActionHandler_10(Player* this, PlayState* play); +s32 Player_ActionHandler_11(Player* this, PlayState* play); +s32 Player_ActionHandler_12(Player* this, PlayState* play); +s32 Player_ActionHandler_13(Player* this, PlayState* play); -static s32 (*sActionChangeFuncs[])(Player* this, PlayState* play) = { - /* PLAYER_ACTION_CHG_0 */ Player_ActionChange_0, - /* PLAYER_ACTION_CHG_1 */ Player_ActionChange_1, - /* PLAYER_ACTION_CHG_2 */ Player_ActionChange_2, - /* PLAYER_ACTION_CHG_3 */ Player_ActionChange_3, - /* PLAYER_ACTION_CHG_4 */ Player_ActionChange_4, - /* PLAYER_ACTION_CHG_5 */ Player_ActionChange_5, - /* PLAYER_ACTION_CHG_6 */ Player_ActionChange_6, - /* PLAYER_ACTION_CHG_7 */ Player_ActionChange_7, - /* PLAYER_ACTION_CHG_8 */ Player_ActionChange_8, - /* PLAYER_ACTION_CHG_9 */ Player_ActionChange_9, - /* PLAYER_ACTION_CHG_10 */ Player_ActionChange_10, - /* PLAYER_ACTION_CHG_11 */ Player_ActionChange_11, - /* PLAYER_ACTION_CHG_12 */ Player_ActionChange_12, - /* PLAYER_ACTION_CHG_13 */ Player_ActionChange_13, +static s32 (*sActionHandlerFuncs[])(Player* this, PlayState* play) = { + Player_ActionHandler_0, // PLAYER_ACTION_HANDLER_0 + Player_ActionHandler_1, // PLAYER_ACTION_HANDLER_1 + Player_ActionHandler_2, // PLAYER_ACTION_HANDLER_2 + Player_ActionHandler_3, // PLAYER_ACTION_HANDLER_3 + Player_ActionHandler_Talk, // PLAYER_ACTION_HANDLER_TALK + Player_ActionHandler_5, // PLAYER_ACTION_HANDLER_5 + Player_ActionHandler_Roll, // PLAYER_ACTION_HANDLER_ROLL + Player_ActionHandler_7, // PLAYER_ACTION_HANDLER_7 + Player_ActionHandler_8, // PLAYER_ACTION_HANDLER_8 + Player_ActionHandler_9, // PLAYER_ACTION_HANDLER_9 + Player_ActionHandler_10, // PLAYER_ACTION_HANDLER_10 + Player_ActionHandler_11, // PLAYER_ACTION_HANDLER_11 + Player_ActionHandler_12, // PLAYER_ACTION_HANDLER_12 + Player_ActionHandler_13, // PLAYER_ACTION_HANDLER_13 }; /** - * This function processes "Action Change Lists", which run various functions that - * check if it is appropriate to change to a new action. + * This function processes "Action Handler Lists". * - * Action Change Lists are a list of indices for the `sActionChangeFuncs` array. - * The functions are ran in order until one of them returns true, or the end of the list is reached. - * An Action Change index having a negative value indicates that it is the last member in the list. + * An Action Handler is a function that "listens" for certain conditions or the right time + * to change to a certain action. These can include actions triggered manually by the player + * or actions that happen automatically, given some other condition(s). * - * Because these lists are processed sequentially, the order of the indices in the list determines its priority. + * Action Handler Lists are a list of indices for the `sActionHandlerFuncs` array. + * The Action Handlers are ran in order until one of them returns true, or the end of the list is reached. + * An Action Handler index having a negative value indicates that it is the last member in the list. * - * If the `updateUpperBody` argument is true, Player's upper body will update before the Action Change List - * is processed. This allows for Item Action functions to run. + * Because these lists are processed sequentially, the order of the indices in the list + * determines an Action Handler's priority. + * + * If the `updateUpperBody` argument is true, Player's upper body will update before the Action Handler List + * is processed. This allows for Item Action functions to run, for example. * * @return true if a new action has been chosen * */ -s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeList, s32 updateUpperBody) { +s32 Player_TryActionHandlerList(PlayState* play, Player* this, s8* actionHandlerList, s32 updateUpperBody) { s32 i; if (!(this->stateFlags1 & (PLAYER_STATE1_LOADING | PLAYER_STATE1_DEAD | PLAYER_STATE1_IN_CUTSCENE))) { if (updateUpperBody) { - D_808535E0 = Player_UpdateUpperBody(this, play); + sUpperBodyIsBusy = Player_UpdateUpperBody(this, play); if (Player_Action_8084E604 == this->actionFunc) { return true; @@ -3768,22 +4184,22 @@ s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeLi } if (func_8008F128(this)) { - this->unk_6AE |= 0x41; + this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_UPPER_X; return true; } - if (!(this->stateFlags1 & PLAYER_STATE1_START_PUTAWAY) && + if (!(this->stateFlags1 & PLAYER_STATE1_START_CHANGING_HELD_ITEM) && (Player_UpperAction_ChangeHeldItem != this->upperActionFunc)) { - // Process all entries in the Action Change List with a positive index - while (*actionChangeList >= 0) { - if (sActionChangeFuncs[*actionChangeList](this, play)) { + // Process all entries in the Action Handler List with a positive index + while (*actionHandlerList >= 0) { + if (sActionHandlerFuncs[*actionHandlerList](this, play)) { return true; } - actionChangeList++; + actionHandlerList++; } // Try the last entry in the list. Negate the index to make it positive again. - if (sActionChangeFuncs[-(*actionChangeList)](this, play)) { + if (sActionHandlerFuncs[-(*actionHandlerList)](this, play)) { return true; } } @@ -3792,21 +4208,44 @@ s32 Player_TryActionChangeList(PlayState* play, Player* this, s8* actionChangeLi return false; } -s32 func_808374A0(PlayState* play, Player* this, SkelAnime* skelAnime, f32 arg3) { +typedef enum PlayerActionInterruptResult { + /* -1 */ PLAYER_INTERRUPT_NONE = -1, + /* 0 */ PLAYER_INTERRUPT_NEW_ACTION, + /* 1 */ PLAYER_INTERRUPT_MOVE +} PlayerActionInterruptResult; + +/** + * An Action Interrupt allows for ending an action early, toward the end of an animation. + * + * First, `sActionHandlerListIdle` will be checked to see if any of those actions should be used. + * It should be noted that the `updateUpperBody` argument passed to `Player_TryActionHandlerList` + * is `true`. This means that an item can be used during the interrupt window. + * + * If no actions from the Action Handler List are used, then the control stick is checked to see if + * any movement should occur. + * + * Note that while this function can set up a new action with `sActionHandlerListIdle`, this function + * will not set up an appropriate action for moving. + * It is the callers responsibility to react accordingly to `PLAYER_INTERRUPT_MOVE`. + * + * @param frameRange The number of frames, from the end of the current animation, where an interrupt can occur. + * @return The interrupt result. See `PlayerActionInterruptResult`. + */ +s32 Player_TryActionInterrupt(PlayState* play, Player* this, SkelAnime* skelAnime, f32 frameRange) { f32 speedTarget; s16 yawTarget; - if ((skelAnime->endFrame - arg3) <= skelAnime->curFrame) { - if (Player_TryActionChangeList(play, this, sActionChangeList7, true)) { - return 0; + if ((skelAnime->endFrame - frameRange) <= skelAnime->curFrame) { + if (Player_TryActionHandlerList(play, this, sActionHandlerListIdle, true)) { + return PLAYER_INTERRUPT_NEW_ACTION; } if (Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play)) { - return 1; + return PLAYER_INTERRUPT_MOVE; } } - return -1; + return PLAYER_INTERRUPT_NONE; } void func_80837530(PlayState* play, Player* this, s32 arg2) { @@ -3825,7 +4264,7 @@ void func_80837530(PlayState* play, Player* this, s32 arg2) { } } -s32 func_808375D8(Player* this) { +s32 Player_CanSpinAttack(Player* this) { s8 sp3C[4]; s8* iter; s8* iter2; @@ -3834,32 +4273,37 @@ s32 func_808375D8(Player* this) { s32 i; if ((this->heldItemAction == PLAYER_IA_DEKU_STICK) || Player_HoldsBrokenKnife(this)) { - return 0; + return false; } - iter = &this->unk_847[0]; + iter = &this->controlStickSpinAngles[0]; iter2 = &sp3C[0]; + for (i = 0; i < 4; i++, iter++, iter2++) { if ((*iter2 = *iter) < 0) { - return 0; + return false; } + *iter2 *= 2; } temp1 = sp3C[0] - sp3C[1]; + if (ABS(temp1) < 10) { - return 0; + return false; } iter2 = &sp3C[1]; + for (i = 1; i < 3; i++, iter2++) { temp2 = *iter2 - *(iter2 + 1); + if ((ABS(temp2) < 10) || (temp2 * temp1 < 0)) { - return 0; + return false; } } - return 1; + return true; } void func_80837704(PlayState* play, Player* this) { @@ -3888,6 +4332,7 @@ static s8 D_80854480[] = { PLAYER_MWA_RIGHT_SLASH_1H, PLAYER_MWA_LEFT_SLASH_1H, }; + static s8 D_80854484[] = { PLAYER_MWA_HAMMER_FORWARD, PLAYER_MWA_HAMMER_SIDE, @@ -3896,38 +4341,43 @@ static s8 D_80854484[] = { }; s32 func_80837818(Player* this) { - s32 sp1C = this->unk_84B[this->unk_846]; + s32 controlStickDirection = this->controlStickDirections[this->controlStickDataIndex]; s32 sp18; if (this->heldItemAction == PLAYER_IA_HAMMER) { - if (sp1C < 0) { - sp1C = 0; + if (controlStickDirection <= PLAYER_STICK_DIR_NONE) { + controlStickDirection = PLAYER_STICK_DIR_FORWARD; } - sp18 = D_80854484[sp1C]; + + sp18 = D_80854484[controlStickDirection]; this->unk_845 = 0; } else { - if (func_808375D8(this)) { + if (Player_CanSpinAttack(this)) { sp18 = PLAYER_MWA_SPIN_ATTACK_1H; } else { - if (sp1C < 0) { - if (func_80833BCC(this)) { + if (controlStickDirection <= PLAYER_STICK_DIR_NONE) { + if (Player_IsZTargeting(this)) { sp18 = PLAYER_MWA_FORWARD_SLASH_1H; } else { sp18 = PLAYER_MWA_RIGHT_SLASH_1H; } } else { - sp18 = D_80854480[sp1C]; + sp18 = D_80854480[controlStickDirection]; + if (sp18 == PLAYER_MWA_STAB_1H) { this->stateFlags2 |= PLAYER_STATE2_SWORD_LUNGE; - if (!func_80833BCC(this)) { + + if (!Player_IsZTargeting(this)) { sp18 = PLAYER_MWA_FORWARD_SLASH_1H; } } } + if (this->heldItemAction == PLAYER_IA_DEKU_STICK) { sp18 = PLAYER_MWA_FORWARD_SLASH_1H; } } + if (Player_HoldsTwoHandedWeapon(this)) { sp18++; } @@ -3975,7 +4425,7 @@ void func_80837948(PlayState* play, Player* this, s32 arg2) { Player_AnimPlayOnceAdjusted(play, this, D_80854190[arg2].unk_00); if ((arg2 != PLAYER_MWA_FLIPSLASH_START) && (arg2 != PLAYER_MWA_JUMPSLASH_START)) { - Player_AnimReplaceApplyFlags(play, this, 0x209); + Player_StartAnimMovement(play, this, 0x209); } this->yaw = this->actor.shape.rot.y; @@ -4001,18 +4451,38 @@ 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; } s32 func_80837B18_modified(PlayState* play, Player* this, s32 damage, u8 modified) { @@ -4034,7 +4504,7 @@ s32 func_80837B18(PlayState* play, Player* this, s32 damage) { void func_80837B60(Player* this) { this->skelAnime.prevTransl = this->skelAnime.jointTable[0]; - func_80832E48(this, 3); + Player_ApplyAnimMovementScaledByAge(this, 3); } void func_80837B9C(Player* this, PlayState* play) { @@ -4052,7 +4522,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; @@ -4072,9 +4543,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; @@ -4083,8 +4554,8 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, Player_RequestRumble(this, 255, 10, 40, 0); Player_PlaySfx(this, NA_SE_PL_FREEZE_S); - func_80832698(this, NA_SE_VO_LI_FREEZE); - } else if (arg2 == 4) { + Player_PlayVoiceSfx(this, NA_SE_VO_LI_FREEZE); + } else if (damageResponseType == PLAYER_HIT_RESPONSE_ELECTRIC_SHOCK) { Player_SetupAction(play, this, Player_Action_8084FBF4, 0); Player_RequestRumble(this, 255, 80, 150, 0); @@ -4094,7 +4565,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_IN_WATER) { Player_SetupAction(play, this, Player_Action_8084E30C, 0); Player_RequestRumble(this, 180, 20, 50, 0); @@ -4104,8 +4575,10 @@ 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 & 1) || + Player_PlayVoiceSfx(this, NA_SE_VO_LI_DAMAGE_S); + } else if ((damageResponseType == PLAYER_HIT_RESPONSE_KNOCKBACK_LARGE) || + (damageResponseType == PLAYER_HIT_RESPONSE_KNOCKBACK_SMALL) || + !(this->actor.bgCheckFlags & 1) || (this->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_CLIMBING_LADDER))) { Player_SetupAction(play, this, Player_Action_8084377C, 0); @@ -4114,7 +4587,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.speedXZ = 3.0f; @@ -4122,32 +4595,32 @@ void func_80837C0C(PlayState* play, Player* this, s32 arg2, f32 arg3, f32 arg4, this->actor.velocity.y = 6.0f; Player_AnimChangeFreeze(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_damage_run, this->modelAnimType)); - func_80832698(this, NA_SE_VO_LI_DAMAGE_S); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_DAMAGE_S); } else { - this->actor.speedXZ = arg3; - this->linearVelocity = arg3; - this->actor.velocity.y = arg4; + this->actor.speedXZ = speed; + this->linearVelocity = 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; } if ((this->actor.category != ACTORCAT_PLAYER) && (this->actor.colChkInfo.health == 0)) { - func_80832698(this, NA_SE_VO_BL_DOWN); + Player_PlayVoiceSfx(this, NA_SE_VO_BL_DOWN); } else { - func_80832698(this, NA_SE_VO_LI_FALL_L); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_FALL_L); } } this->hoverBootsTimer = 0; this->actor.bgCheckFlags &= ~1; } else { - if ((this->linearVelocity > 4.0f) && !func_8008E9C4(this)) { + if ((this->linearVelocity > 4.0f) && !Player_CheckHostileLockOn(this)) { this->unk_890 = 20; Player_RequestRumble(this, 120, 20, 10, 0); - func_80832698(this, NA_SE_VO_LI_DAMAGE_S); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_DAMAGE_S); return; } @@ -4164,23 +4637,23 @@ 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; } - if (func_8008E9C4(this)) { + if (Player_CheckHostileLockOn(this)) { sp28 += 1; } anim = *sp28; - func_80832698(this, NA_SE_VO_LI_DAMAGE_S); + 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; } } @@ -4204,7 +4677,7 @@ s32 func_80838144(s32 arg0) { } } -s32 func_8083816C(s32 arg0) { +int func_8083816C(s32 arg0) { return (arg0 == 4) || (arg0 == 7) || (arg0 == 12); } @@ -4231,7 +4704,7 @@ void func_80838280(Player* this) { if (this->actor.colChkInfo.acHitEffect == 1) { func_8083821C(this); } - func_80832698(this, NA_SE_VO_LI_FALL_L); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_FALL_L); } void func_808382BC(Player* this) { @@ -4254,7 +4727,7 @@ s32 func_808382DC(Player* this, PlayState* play) { sp68 = ((Player_GetHeight(this) - 8.0f) < (this->unk_6C4 * this->actor.scale.y)); if (sp68 || (this->actor.bgCheckFlags & 0x100) || (sFloorType == 9) || (this->stateFlags2 & PLAYER_STATE2_FORCED_VOID_OUT)) { - func_80832698(this, NA_SE_VO_LI_DAMAGE_S); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_DAMAGE_S); if (sp68) { Play_TriggerRespawn(play); @@ -4282,20 +4755,26 @@ s32 func_808382DC(Player* this, PlayState* play) { Play_TriggerVoidOut(play); } - func_80832698(this, NA_SE_VO_LI_TAKEN_AWAY); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_TAKEN_AWAY); play->unk_11DE9 = 1; func_80078884(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; @@ -4366,16 +4845,16 @@ s32 func_808382DC(Player* this, PlayState* play) { } if (this->stateFlags1 & PLAYER_STATE1_IN_WATER) { - 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); @@ -4394,7 +4873,7 @@ s32 func_808382DC(Player* this, PlayState* play) { (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; } @@ -4412,12 +4891,12 @@ void func_80838940(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* Player_AnimPlayOnceAdjusted(play, this, anim); } - this->actor.velocity.y = arg2 * D_808535E8; + this->actor.velocity.y = arg2 * sWaterSpeedFactor; this->hoverBootsTimer = 0; this->actor.bgCheckFlags &= ~1; - func_80832854(this); - func_80832698(this, sfxId); + Player_PlayJumpingSfx(this); + Player_PlayVoiceSfx(this, sfxId); this->stateFlags1 |= PLAYER_STATE1_JUMPING; } @@ -4426,7 +4905,7 @@ void func_808389E8(Player* this, LinkAnimationHeader* anim, f32 arg2, PlayState* func_80838940(this, anim, arg2, play, NA_SE_VO_LI_SWORD_N); } -s32 Player_ActionChange_12(Player* this, PlayState* play) { +s32 Player_ActionHandler_12(Player* this, PlayState* play) { s32 sp3C; LinkAnimationHeader* anim; f32 sp34; @@ -4435,7 +4914,7 @@ s32 Player_ActionChange_12(Player* this, PlayState* play) { f32 wallPolyNormalZ; f32 sp24; - if (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (this->ledgeClimbType >= 2) && + if (!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (this->ledgeClimbType >= 2) && (!(this->stateFlags1 & PLAYER_STATE1_IN_WATER) || (this->ageProperties->unk_14 > this->yDistToLedge))) { sp3C = 0; @@ -4531,7 +5010,7 @@ void func_80838E70(PlayState* play, Player* this, f32 arg2, s16 arg3) { this->unk_450.x = (Math_SinS(arg3) * arg2) + this->actor.world.pos.x; this->unk_450.z = (Math_CosS(arg3) * arg2) + this->actor.world.pos.z; - Player_AnimPlayOnce(play, this, func_80833338(this)); + Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this)); } void func_80838F18(PlayState* play, Player* this) { @@ -4551,7 +5030,7 @@ s32 func_80838FB8(PlayState* play, Player* this) { if ((play->transitionTrigger == TRANS_TRIGGER_OFF) && (this->stateFlags1 & PLAYER_STATE1_FLOOR_DISABLED)) { func_80838F5C(play, this); Player_AnimPlayLoop(play, this, &gPlayerAnim_link_normal_landing_wait); - func_80832698(this, NA_SE_VO_LI_FALL_S); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_FALL_S); func_800788CC(NA_SE_OC_SECRET_WARP_IN); return 1; } @@ -4572,7 +5051,7 @@ s32 func_80838FB8(PlayState* play, Player* this) { * * Note: grottos and normal fairy fountains use `ENTR_RETURN_GROTTO` */ -s16 sReturnEntranceGroupData[] = { +static s16 sReturnEntranceGroupData[] = { // ENTR_RETURN_GREAT_FAIRYS_FOUNTAIN_MAGIC /* 0 */ ENTR_DEATH_MOUNTAIN_TRAIL_4, // from Magic Fairy Fountain /* 1 */ ENTR_DEATH_MOUNTAIN_CRATER_3, // from Double Magic Fairy Fountain @@ -4603,7 +5082,7 @@ s16 sReturnEntranceGroupData[] = { /** * The values are indices into `sReturnEntranceGroupData` marking the start of each group */ -u8 sReturnEntranceGroupIndices[] = { +static u8 sReturnEntranceGroupIndices[] = { 11, // ENTR_RETURN_GREAT_FAIRYS_FOUNTAIN_SPELLS 9, // ENTR_RETURN_SHOOTING_GALLERY 3, // ENTR_RETURN_2 @@ -4808,7 +5287,7 @@ s32 Player_PosVsWallLineTest(PlayState* play, Player* this, Vec3f* offset, Colli return BgCheck_EntityLineTest1(&play->colCtx, &posA, &posB, posResult, wallPoly, true, false, false, true, bgId); } -s32 Player_ActionChange_1(Player* this, PlayState* play) { +s32 Player_ActionHandler_1(Player* this, PlayState* play) { DoorShutter* doorShutter; EnDoor* door; // Can also be DoorKiller* s32 doorDirection; @@ -4824,7 +5303,7 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { Vec3f checkPos; if ((this->doorType != PLAYER_DOORTYPE_NONE) && - (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) || + (!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) || ((this->heldActor != NULL) && (this->heldActor->id == ACTOR_EN_RU1)))) { if ((CHECK_BTN_ALL(sControlInput->press.button, BTN_A) || (Player_Action_8084F9A0 == this->actionFunc)) && GameInteractor_Should(VB_BE_ABLE_TO_OPEN_DOORS, true)) { doorActor = this->doorActor; @@ -4868,14 +5347,14 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { if (this->doorTimer != 0) { this->av2.actionVar2 = 0; - Player_AnimChangeOnceMorph(play, this, func_80833338(this)); + Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnim(this)); this->skelAnime.endFrame = 0.0f; } else { this->linearVelocity = 0.1f; } if (doorShutter->dyna.actor.category == ACTORCAT_DOOR) { - this->doorBgCamIndex = play->transiActorCtx.list[(u16)doorShutter->dyna.actor.params >> 10] + this->cv.slidingDoorBgCamIndex = play->transiActorCtx.list[(u16)doorShutter->dyna.actor.params >> 10] .sides[(doorDirection > 0) ? 0 : 1] .effects; @@ -4901,7 +5380,7 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { } Player_SetupAction(play, this, Player_Action_80845EF8, 0); - func_80832528(play, this); + Player_PutAwayHeldItem(play, this); if (doorDirection < 0) { this->actor.shape.rot.y = doorActor->shape.rot.y; @@ -4922,7 +5401,7 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { } func_80832224(this); - Player_AnimReplaceApplyFlags(play, this, 0x28F); + Player_StartAnimMovement(play, this, 0x28F); if (doorActor->parent != NULL) { doorDirection = -doorDirection; @@ -4951,7 +5430,7 @@ s32 Player_ActionChange_1(Player* this, PlayState* play) { play->transiActorCtx.list[(u16)doorActor->params >> 10] .sides[(doorDirection > 0) ? 0 : 1] .effects, - 0, 38.0f * D_808535EC, 26.0f * D_808535EC, 10.0f * D_808535EC); + 0, 38.0f * sInvWaterSpeedFactor, 26.0f * sInvWaterSpeedFactor, 10.0f * sInvWaterSpeedFactor); } } } @@ -4999,14 +5478,14 @@ void func_80839E88(Player* this, PlayState* play) { void func_80839F30(Player* this, PlayState* play) { Player_SetupAction(play, this, Player_Action_808407CC, 1); - Player_AnimChangeOnceMorph(play, this, func_80833338(this)); + Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnim(this)); this->yaw = this->actor.shape.rot.y; } void func_80839F90(Player* this, PlayState* play) { - if (func_8008E9C4(this)) { + if (Player_CheckHostileLockOn(this)) { func_80839E88(this, play); - } else if (func_80833B2C(this)) { + } else if (Player_FriendlyLockOnOrParallel(this)) { func_80839F30(this, play); } else { func_80853080(this, play); @@ -5016,12 +5495,12 @@ void func_80839F90(Player* this, PlayState* play) { void func_80839FFC(Player* this, PlayState* play) { PlayerActionFunc actionFunc; - if (func_8008E9C4(this)) { + if (Player_CheckHostileLockOn(this)) { actionFunc = Player_Action_80840450; - } else if (func_80833B2C(this)) { + } else if (Player_FriendlyLockOnOrParallel(this)) { actionFunc = Player_Action_808407CC; } else { - actionFunc = Player_Action_80840BC8; + actionFunc = Player_Action_Idle; } Player_SetupAction(play, this, actionFunc, 1); @@ -5029,7 +5508,8 @@ void func_80839FFC(Player* this, PlayState* play) { void func_8083A060(Player* this, PlayState* play) { func_80839FFC(this, play); - if (func_8008E9C4(this)) { + + if (Player_CheckHostileLockOn(this)) { this->av2.actionVar2 = 1; } } @@ -5039,7 +5519,7 @@ void func_8083A098(Player* this, LinkAnimationHeader* anim, PlayState* play) { func_8083328C(play, this, anim); } -s32 func_8083A0D4(Player* this) { +int func_8083A0D4(Player* this) { return (this->interactRangeActor != NULL) && (this->heldActor == NULL); } @@ -5085,23 +5565,23 @@ void func_8083A0F4(PlayState* play, Player* this) { } } else { func_80839F90(this, play); - this->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; + this->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR; } } -void func_8083A2F8(PlayState* play, Player* this) { - func_80835DAC(play, this, Player_Action_8084B530, 0); +void Player_SetupTalk(PlayState* play, Player* this) { + Player_SetupActionPreserveAnimMovement(play, this, Player_Action_Talk, 0); - this->stateFlags1 |= PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_IN_CUTSCENE; + this->stateFlags1 |= PLAYER_STATE1_TALKING | PLAYER_STATE1_IN_CUTSCENE; if (this->actor.textId != 0) { - Message_StartTextbox(play, this->actor.textId, this->targetActor); - this->unk_664 = this->targetActor; + Message_StartTextbox(play, this->actor.textId, this->talkActor); + this->focusActor = this->talkActor; } } void func_8083A360(PlayState* play, Player* this) { - func_80835DAC(play, this, Player_Action_8084CC98, 0); + Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084CC98, 0); } void func_8083A388(PlayState* play, Player* this) { @@ -5112,7 +5592,7 @@ void func_8083A3B0(PlayState* play, Player* this) { s32 sp1C = this->av2.actionVar2; s32 sp18 = this->av1.actionVar1; - func_80835DAC(play, this, Player_Action_8084BF1C, 0); + Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084BF1C, 0); this->actor.velocity.y = 0.0f; this->av2.actionVar2 = sp1C; @@ -5120,11 +5600,11 @@ void func_8083A3B0(PlayState* play, Player* this) { } void func_8083A40C(PlayState* play, Player* this) { - func_80835DAC(play, this, Player_Action_8084C760, 0); + Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084C760, 0); } void func_8083A434(PlayState* play, Player* this) { - func_80835DAC(play, this, Player_Action_8084E6D4, 0); + Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084E6D4, 0); this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_IN_CUTSCENE; @@ -5176,20 +5656,20 @@ void func_8083A5C4(PlayState* play, Player* this, CollisionPoly* arg2, f32 arg3, this->actor.shape.rot.y = this->yaw = Math_Atan2S(nz, nx); func_80832224(this); - Player_SkelAnimeResetPrevTranslRot(this); + Player_ResetAnimMovement(this); } s32 func_8083A6AC(Player* this, PlayState* play) { - CollisionPoly* sp84; - s32 sp80; - Vec3f sp74; - Vec3f sp68; - f32 temp1; - //! @bug `floorPitch` and `floorPitchAlt` are cleared to 0 before this function is called, because the player //! left the ground. The angles will always be zero and therefore will always pass these checks. //! The intention seems to be to prevent ledge hanging or vine grabbing when walking off of a steep enough slope. if ((this->actor.yDistToWater < -80.0f) && (ABS(this->floorPitch) < 2730) && (ABS(this->floorPitchAlt) < 2730)) { + CollisionPoly* sp84; + s32 sp80; + Vec3f sp74; + Vec3f sp68; + f32 temp1; + sp74.x = this->actor.prevPos.x - this->actor.world.pos.x; sp74.z = this->actor.prevPos.z - this->actor.world.pos.z; @@ -5215,7 +5695,7 @@ s32 func_8083A6AC(Player* this, PlayState* play) { sp54 = Math3D_UDistPlaneToPos(nx, ny, nz, sp84->dist, &this->actor.world.pos); - sp50 = sPrevFloorProperty == 6; + sp50 = (sPrevFloorProperty == 6); if (!sp50 && (func_80041DB8(&play->colCtx, sp84, sp80) & 8)) { sp50 = 1; } @@ -5224,23 +5704,23 @@ s32 func_8083A6AC(Player* this, PlayState* play) { sp50 ? &gPlayerAnim_link_normal_Fclimb_startB : &gPlayerAnim_link_normal_fall); if (sp50) { - func_80836898(play, this, func_8083A3B0); + Player_SetupWaitForPutAway(play, this, func_8083A3B0); this->yaw += 0x8000; this->actor.shape.rot.y = this->yaw; this->stateFlags1 |= PLAYER_STATE1_CLIMBING_LADDER; - Player_AnimReplaceApplyFlags(play, this, 0x9F); + Player_StartAnimMovement(play, this, 0x9F); this->av2.actionVar2 = -1; this->av1.actionVar1 = sp50; } else { this->stateFlags1 |= PLAYER_STATE1_HANGING_OFF_LEDGE; - this->stateFlags1 &= ~PLAYER_STATE1_TARGET_NOTHING; + this->stateFlags1 &= ~PLAYER_STATE1_PARALLEL; } Player_PlaySfx(this, NA_SE_PL_SLIPDOWN); - func_80832698(this, NA_SE_VO_LI_HANG); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_HANG); return 1; } } @@ -5300,7 +5780,7 @@ void func_8083AA10(Player* this, PlayState* play) { (sPrevFloorProperty != 9) && (sYDistToFloor > 20.0f) && (this->meleeWeaponState == 0) && (ABS(sp5C) < 0x2000) && (this->linearVelocity > 3.0f)) { - if ((sPrevFloorProperty == 11) && !(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { + if ((sPrevFloorProperty == 11) && !(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) { sp40 = func_808396F4(play, this, &D_8085451C, &sp44, &sp58, &sp54); sp3C = this->actor.world.pos.y; @@ -5330,7 +5810,7 @@ void func_8083AA10(Player* this, PlayState* play) { } s32 func_8083AD4C(PlayState* play, Player* this) { - s32 cameraMode; + s32 camMode; if (this->unk_6AD == 2) { if (func_8002DD6C(this)) { @@ -5339,16 +5819,16 @@ s32 func_8083AD4C(PlayState* play, Player* this) { if(CVarGetInteger(CVAR_ENHANCEMENT("BowSlingshotAmmoFix"), 0)){ shouldUseBowCamera = this->heldItemAction != PLAYER_IA_SLINGSHOT; } - - cameraMode = shouldUseBowCamera ? CAM_MODE_BOWARROW : CAM_MODE_SLINGSHOT; + + camMode = shouldUseBowCamera ? CAM_MODE_BOWARROW : CAM_MODE_SLINGSHOT; } else { - cameraMode = CAM_MODE_BOOMERANG; + camMode = CAM_MODE_BOOMERANG; } } else { - cameraMode = CAM_MODE_FIRSTPERSON; + camMode = CAM_MODE_FIRSTPERSON; } - return Camera_ChangeMode(Play_GetCamera(play, 0), cameraMode); + return Camera_ChangeMode(Play_GetCamera(play, 0), camMode); } /** @@ -5361,13 +5841,15 @@ s32 Player_StartCsAction(PlayState* play, Player* this) { // (with a special case for `PLAYER_CSACTION_7`) if (this->unk_6AD == 3) { Player_SetupAction(play, this, Player_Action_CsAction, 0); - if (this->doorBgCamIndex != 0) { + + if (this->cv.haltActorsDuringCsAction) { this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; } + func_80832318(this); - return 1; + return true; } else { - return 0; + return false; } } @@ -5391,7 +5873,7 @@ void func_8083AE40(Player* this, s16 objectId) { } void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) { - func_80835DE4(play, this, Player_Action_808507F4, 0); + Player_SetupActionPreserveItemAction(play, this, Player_Action_808507F4, 0); this->av1.actionVar1 = magicSpell - 3; @@ -5421,18 +5903,42 @@ void func_8083AF44(PlayState* play, Player* this, s32 magicSpell) { } void func_8083B010(Player* this) { - this->actor.focus.rot.x = this->actor.focus.rot.z = this->unk_6B6 = this->unk_6B8 = this->unk_6BA = this->unk_6BC = - this->unk_6BE = this->unk_6C0 = 0; + this->actor.focus.rot.x = this->actor.focus.rot.z = this->headLimbRot.x = this->headLimbRot.y = this->headLimbRot.z = this->upperLimbRot.x = + this->upperLimbRot.y = this->upperLimbRot.z = 0; this->actor.focus.rot.y = this->actor.shape.rot.y; } static u8 D_80854528[] = { - GI_LETTER_ZELDA, GI_WEIRD_EGG, GI_CHICKEN, GI_BEAN, GI_POCKET_EGG, GI_POCKET_CUCCO, - GI_COJIRO, GI_ODD_MUSHROOM, GI_ODD_POTION, GI_SAW, GI_SWORD_BROKEN, GI_PRESCRIPTION, - GI_FROG, GI_EYEDROPS, GI_CLAIM_CHECK, GI_MASK_SKULL, GI_MASK_SPOOKY, GI_MASK_KEATON, - GI_MASK_BUNNY, GI_MASK_TRUTH, GI_MASK_GORON, GI_MASK_ZORA, GI_MASK_GERUDO, GI_LETTER_RUTO, - GI_LETTER_RUTO, GI_LETTER_RUTO, GI_LETTER_RUTO, GI_LETTER_RUTO, GI_LETTER_RUTO, + GI_LETTER_ZELDA, // EXCH_ITEM_ZELDAS_LETTER + GI_WEIRD_EGG, // EXCH_ITEM_WEIRD_EGG + GI_CHICKEN, // EXCH_ITEM_CHICKEN + GI_BEAN, // EXCH_ITEM_MAGIC_BEAN + GI_POCKET_EGG, // EXCH_ITEM_POCKET_EGG + GI_POCKET_CUCCO, // EXCH_ITEM_POCKET_CUCCO + GI_COJIRO, // EXCH_ITEM_COJIRO + GI_ODD_MUSHROOM, // EXCH_ITEM_ODD_MUSHROOM + GI_ODD_POTION, // EXCH_ITEM_ODD_POTION + GI_SAW, // EXCH_ITEM_POACHERS_SAW + GI_SWORD_BROKEN, // EXCH_ITEM_BROKEN_GORONS_SWORD + GI_PRESCRIPTION, // EXCH_ITEM_PRESCRIPTION + GI_FROG, // EXCH_ITEM_EYEBALL_FROG + GI_EYEDROPS, // EXCH_ITEM_EYE_DROPS + GI_CLAIM_CHECK, // EXCH_ITEM_CLAIM_CHECK + GI_MASK_SKULL, // EXCH_ITEM_MASK_SKULL + GI_MASK_SPOOKY, // EXCH_ITEM_MASK_SPOOKY + GI_MASK_KEATON, // EXCH_ITEM_MASK_KEATON + GI_MASK_BUNNY, // EXCH_ITEM_MASK_BUNNY_HOOD + GI_MASK_TRUTH, // EXCH_ITEM_MASK_TRUTH + GI_MASK_GORON, // EXCH_ITEM_MASK_GORON + GI_MASK_ZORA, // EXCH_ITEM_MASK_ZORA + GI_MASK_GERUDO, // EXCH_ITEM_MASK_GERUDO + GI_LETTER_RUTO, // EXCH_ITEM_BOTTLE_FISH + GI_LETTER_RUTO, // EXCH_ITEM_BOTTLE_BLUE_FIRE + GI_LETTER_RUTO, // EXCH_ITEM_BOTTLE_BUG + GI_LETTER_RUTO, // EXCH_ITEM_BOTTLE_POE + GI_LETTER_RUTO, // EXCH_ITEM_BOTTLE_BIG_POE + GI_LETTER_RUTO, // EXCH_ITEM_BOTTLE_RUTOS_LETTER }; static LinkAnimationHeader* D_80854548[] = { @@ -5441,11 +5947,11 @@ static LinkAnimationHeader* D_80854548[] = { &gPlayerAnim_link_normal_take_out, }; -s32 Player_ActionChange_13(Player* this, PlayState* play) { +s32 Player_ActionHandler_13(Player* this, PlayState* play) { s32 sp2C; s32 sp28; GetItemEntry giEntry; - Actor* targetActor; + Actor* talkActor; if ((this->unk_6AD != 0) && (func_808332B8(this) || (this->actor.bgCheckFlags & 1) || (this->stateFlags1 & PLAYER_STATE1_ON_HORSE))) { @@ -5459,7 +5965,7 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { } else { Player_SetupAction(play, this, Player_Action_8085063C, 1); this->stateFlags1 |= PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE; - Player_AnimPlayOnce(play, this, func_80833338(this)); + Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this)); func_80835EA4(play, 4); } @@ -5472,12 +5978,12 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { (sp28 = Player_ActionToBottle(this, this->itemAction) - 1, ((sp28 >= 0) && (sp28 < 6) && ((this->itemAction > PLAYER_IA_BOTTLE_POE) || - ((this->targetActor != NULL) && + ((this->talkActor != NULL) && (((this->itemAction == PLAYER_IA_BOTTLE_POE) && (this->exchangeItemId == EXCH_ITEM_POE)) || (this->exchangeItemId == EXCH_ITEM_BLUE_FIRE))))))) { if ((play->actorCtx.titleCtx.delayTimer == 0) && (play->actorCtx.titleCtx.alpha == 0)) { - func_80835DE4(play, this, Player_Action_8084F104, 0); + Player_SetupActionPreserveItemAction(play, this, Player_Action_ExchangeItem, 0); if (sp2C >= 0) { if (this->getItemEntry.objectId == OBJECT_INVALID) { @@ -5488,7 +5994,7 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { func_8083AE40(this, giEntry.objectId); } - this->stateFlags1 |= PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE; + this->stateFlags1 |= PLAYER_STATE1_TALKING | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE; if (sp2C >= 0) { sp2C = sp2C + 1; @@ -5496,9 +6002,9 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { sp2C = sp28 + 0x18; } - targetActor = this->targetActor; + talkActor = this->talkActor; - if ((targetActor != NULL) && + if ((talkActor != NULL) && ((this->exchangeItemId == sp2C) || (this->exchangeItemId == EXCH_ITEM_BLUE_FIRE) || ((this->exchangeItemId == EXCH_ITEM_POE) && (this->itemAction == PLAYER_IA_BOTTLE_BIG_POE)) || @@ -5507,13 +6013,13 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { ((this->exchangeItemId != EXCH_ITEM_BEAN) || (this->itemAction == PLAYER_IA_MAGIC_BEAN))) { if (this->exchangeItemId == EXCH_ITEM_BEAN) { Inventory_ChangeAmmo(ITEM_BEAN, -1); - func_80835DE4(play, this, Player_Action_8084279C, 0); + Player_SetupActionPreserveItemAction(play, this, Player_Action_8084279C, 0); this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; this->av2.actionVar2 = 0x50; this->av1.actionVar1 = -1; } - targetActor->flags |= ACTOR_FLAG_PLAYER_TALKED_TO; - this->unk_664 = this->targetActor; + talkActor->flags |= ACTOR_FLAG_PLAYER_TALKED_TO; + this->focusActor = this->talkActor; } else if (sp2C == EXCH_ITEM_LETTER_RUTO) { this->av1.actionVar1 = 1; this->actor.textId = 0x4005; @@ -5541,20 +6047,20 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { sp2C = Player_ActionToBottle(this, this->itemAction); if (sp2C >= 0) { if (sp2C == 0xC) { - func_80835DE4(play, this, Player_Action_8084EED8, 0); + Player_SetupActionPreserveItemAction(play, this, Player_Action_8084EED8, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_bug_out); func_80835EA4(play, 3); } else if ((sp2C > 0) && (sp2C < 4)) { - func_80835DE4(play, this, Player_Action_8084EFC0, 0); + Player_SetupActionPreserveItemAction(play, this, Player_Action_8084EFC0, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_bottle_fish_out); func_80835EA4(play, (sp2C == 1) ? 1 : 5); } else { - func_80835DE4(play, this, Player_Action_8084EAC0, 0); + Player_SetupActionPreserveItemAction(play, this, Player_Action_8084EAC0, 0); Player_AnimChangeOnceMorphAdjusted(play, this, &gPlayerAnim_link_bottle_drink_demo_start); func_80835EA4(play, 2); } } else { - func_80835DE4(play, this, Player_Action_8084E3C4, 0); + Player_SetupActionPreserveItemAction(play, this, Player_Action_8084E3C4, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_okarina_start); this->stateFlags2 |= PLAYER_STATE2_OCARINA_PLAYING; func_80835EA4(play, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); @@ -5589,80 +6095,96 @@ s32 Player_ActionChange_13(Player* this, PlayState* play) { return 0; } -s32 Player_ActionChange_4(Player* this, PlayState* play) { - Actor* sp34 = this->targetActor; - Actor* sp30 = this->unk_664; - Actor* sp2C = NULL; - s32 sp28 = 0; - s32 sp24; +s32 Player_ActionHandler_Talk(Player* this, PlayState* play) { + Actor* talkOfferActor = this->talkActor; + Actor* lockOnActor = this->focusActor; + Actor* cUpTalkActor = NULL; + s32 forceTalkToNavi = false; + s32 canTalkToLockOnWithCUp; - sp24 = (sp30 != NULL) && - (CHECK_FLAG_ALL(sp30->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_NAVI_HAS_INFO) || (sp30->naviEnemyId != 0xFF)); + canTalkToLockOnWithCUp = + (lockOnActor != NULL) && + (CHECK_FLAG_ALL(lockOnActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_NAVI_HAS_INFO) || + (lockOnActor->naviEnemyId != 0xFF)); - if (sp24 || (this->naviTextId != 0)) { - sp28 = (this->naviTextId < 0) && ((ABS(this->naviTextId) & 0xFF00) != 0x200); - if (sp28 || !sp24) { - sp2C = this->naviActor; - if (sp28) { - sp30 = NULL; - sp34 = NULL; + if (canTalkToLockOnWithCUp || (this->naviTextId != 0)) { + // If `naviTextId` is negative and outside the 0x2XX range, talk to Navi instantly + forceTalkToNavi = (this->naviTextId < 0) && ((ABS(this->naviTextId) & 0xFF00) != 0x200); + + if (forceTalkToNavi || !canTalkToLockOnWithCUp) { + // If `lockOnActor` can't be talked to with c-up, the only option left is Navi + cUpTalkActor = this->naviActor; + + if (forceTalkToNavi) { + // Clearing these pointers guarantees that `cUpTalkActor` will take priority + lockOnActor = NULL; + talkOfferActor = NULL; } } else { - sp2C = sp30; + // Navi is not the talk actor, so the only option left for talking with c-up is `lockOnActor` + // (though, `lockOnActor` may be NULL at this point). + cUpTalkActor = lockOnActor; } } - if ((sp34 != NULL) || (sp2C != NULL)) { - if ((sp30 == NULL) || (sp30 == sp34) || (sp30 == sp2C)) { - if (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) || - ((this->heldActor != NULL) && (sp28 || (sp34 == this->heldActor) || (sp2C == this->heldActor) || - ((sp34 != NULL) && (sp34->flags & ACTOR_FLAG_WILL_TALK))))) { + if ((talkOfferActor != NULL) || (cUpTalkActor != NULL)) { + if ((lockOnActor == NULL) || (lockOnActor == talkOfferActor) || (lockOnActor == cUpTalkActor)) { + if (!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) || + ((this->heldActor != NULL) && (forceTalkToNavi || (talkOfferActor == this->heldActor) || (cUpTalkActor == this->heldActor) || + ((talkOfferActor != NULL) && (talkOfferActor->flags & ACTOR_FLAG_WILL_TALK))))) { if ((this->actor.bgCheckFlags & 1) || (this->stateFlags1 & PLAYER_STATE1_ON_HORSE) || (func_808332B8(this) && !(this->stateFlags2 & PLAYER_STATE2_UNDERWATER))) { - if (sp34 != NULL) { - this->stateFlags2 |= PLAYER_STATE2_SPEAK_OR_CHECK; - if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) || (sp34->flags & ACTOR_FLAG_WILL_TALK)) { - sp2C = NULL; - } else if (sp2C == NULL) { + if (talkOfferActor != NULL) { + this->stateFlags2 |= PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER; + if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) || (talkOfferActor->flags & ACTOR_FLAG_WILL_TALK)) { + cUpTalkActor = NULL; + } else if (cUpTalkActor == NULL) { return 0; } } - if (sp2C != NULL) { - if (!sp28) { + if (cUpTalkActor != NULL) { + if (!forceTalkToNavi) { this->stateFlags2 |= PLAYER_STATE2_NAVI_ALERT; } - if (!CHECK_BTN_ALL(sControlInput->press.button, CVarGetInteger(CVAR_ENHANCEMENT("NaviOnL"), 0) ? BTN_L : BTN_CUP) && !sp28) { + if (!CHECK_BTN_ALL(sControlInput->press.button, CVarGetInteger(CVAR_ENHANCEMENT("NaviOnL"), 0) ? BTN_L : BTN_CUP) && !forceTalkToNavi) { return 0; } - sp34 = sp2C; - this->targetActor = NULL; + talkOfferActor = cUpTalkActor; + this->talkActor = NULL; - if (sp28 || !sp24) { - sp2C->textId = ABS(this->naviTextId); + if (forceTalkToNavi || !canTalkToLockOnWithCUp) { + cUpTalkActor->textId = ABS(this->naviTextId); } else { - if (sp2C->naviEnemyId != 0xFF) { - sp2C->textId = sp2C->naviEnemyId + 0x600; + if (cUpTalkActor->naviEnemyId != 0xFF) { + cUpTalkActor->textId = cUpTalkActor->naviEnemyId + 0x600; } } } - this->currentMask = D_80858AA4; - Player_StartTalking(play, sp34); - return 1; + // `sSavedCurrentMask` saves the current mask just before the current action runs on this frame. + // This saved mask value is then restored just before starting a conversation. + // + // This handles an edge case where a conversation is started on the same frame that a mask was taken on or off. + // Because Player updates early before most actors, the text ID being offered comes from the previous frame. + // If a mask was taken on or off the same frame this function runs, the wrong text will be used. + // This is especially important to prevent unwanted behavior with regards to mask trading. + this->currentMask = sSavedCurrentMask; + Player_StartTalking(play, talkOfferActor); + return true; } } } } - return 0; + return false; } s32 func_8083B8F4(Player* this, PlayState* play) { - if (!(this->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_ON_HORSE)) && + if (!(this->stateFlags1 & (PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_ON_HORSE)) && Camera_CheckValidMode(Play_GetCamera(play, 0), 6)) { if ((this->actor.bgCheckFlags & 1) || (func_808332B8(this) && (this->actor.yDistToWater < this->ageProperties->unk_2C))) { @@ -5674,16 +6196,16 @@ s32 func_8083B8F4(Player* this, PlayState* play) { return 0; } -s32 Player_ActionChange_0(Player* this, PlayState* play) { +s32 Player_ActionHandler_0(Player* this, PlayState* play) { if (this->unk_6AD != 0) { - Player_ActionChange_13(this, play); + Player_ActionHandler_13(this, play); return 1; } - if ((this->unk_664 != NULL) && (CHECK_FLAG_ALL(this->unk_664->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_NAVI_HAS_INFO) || - (this->unk_664->naviEnemyId != 0xFF))) { + if ((this->focusActor != NULL) && (CHECK_FLAG_ALL(this->focusActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_NAVI_HAS_INFO) || + (this->focusActor->naviEnemyId != 0xFF))) { this->stateFlags2 |= PLAYER_STATE2_NAVI_ALERT; - } else if ((this->naviTextId == 0 || CVarGetInteger(CVAR_ENHANCEMENT("NaviOnL"), 0)) && !func_8008E9C4(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && + } else if ((this->naviTextId == 0 || CVarGetInteger(CVAR_ENHANCEMENT("NaviOnL"), 0)) && !Player_CheckHostileLockOn(this) && CHECK_BTN_ALL(sControlInput->press.button, BTN_CUP) && (YREG(15) != 0x10) && (YREG(15) != 0x20) && !func_8083B8F4(this, play)) { func_80078884(NA_SE_SY_ERROR); @@ -5705,8 +6227,8 @@ void func_8083BA90(PlayState* play, Player* this, s32 arg2, f32 xzVelocity, f32 this->actor.bgCheckFlags &= ~1; this->hoverBootsTimer = 0; - func_80832854(this); - func_80832698(this, NA_SE_VO_LI_SWORD_L); + Player_PlayJumpingSfx(this); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_L); } s32 func_8083BB20(Player* this) { @@ -5729,73 +6251,76 @@ s32 func_8083BBA0(Player* this, PlayState* play) { return 0; } -void func_8083BC04(Player* this, PlayState* play) { - Player_SetupAction(play, this, Player_Action_80844708, 0); +void Player_SetupRoll(Player* this, PlayState* play) { + Player_SetupAction(play, this, Player_Action_Roll, 0); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_landing_roll, this->modelAnimType), - 1.25f * D_808535E8); + 1.25f * sWaterSpeedFactor); gSaveContext.sohStats.count[COUNT_ROLLS]++; } -s32 func_8083BC7C(Player* this, PlayState* play) { - if ((this->unk_84B[this->unk_846] == 0) && (sFloorType != 7)) { - func_8083BC04(this, play); - return 1; +s32 Player_TryRoll(Player* this, PlayState* play) { + if ((this->controlStickDirections[this->controlStickDataIndex] == 0) && (sFloorType != 7)) { + Player_SetupRoll(this, play); + + return true; } - return 0; + return false; } -void func_8083BCD0(Player* this, PlayState* play, s32 arg2) { - func_80838940(this, D_80853D4C[arg2][0], !(arg2 & 1) ? 5.8f : 3.5f, play, NA_SE_VO_LI_SWORD_N); +void func_8083BCD0(Player* this, PlayState* play, s32 controlStickDirection) { + func_80838940(this, D_80853D4C[controlStickDirection][0], !(controlStickDirection & 1) ? 5.8f : 3.5f, play, NA_SE_VO_LI_SWORD_N); - if (arg2) {} + if (controlStickDirection) {} this->av2.actionVar2 = 1; - this->av1.actionVar1 = arg2; + this->av1.actionVar1 = controlStickDirection; - this->yaw = this->actor.shape.rot.y + (arg2 << 0xE); - this->linearVelocity = !(arg2 & 1) ? 6.0f : 8.5f; + this->yaw = this->actor.shape.rot.y + (controlStickDirection << 0xE); + this->linearVelocity = !(controlStickDirection & 1) ? 6.0f : 8.5f; this->stateFlags2 |= PLAYER_STATE2_HOPPING; - Player_PlaySfx(this, ((arg2 << 0xE) == 0x8000) ? NA_SE_PL_ROLL : NA_SE_PL_SKIP); + Player_PlaySfx(this, ((controlStickDirection << 0xE) == 0x8000) ? NA_SE_PL_ROLL : NA_SE_PL_SKIP); } -s32 Player_ActionChange_10(Player* this, PlayState* play) { - s32 sp2C; +s32 Player_ActionHandler_10(Player* this, PlayState* play) { + s32 controlStickDirection; if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && (play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && (sFloorType != 7) && (SurfaceType_GetSlope(&play->colCtx, this->actor.floorPoly, this->actor.floorBgId) != 1)) { - sp2C = this->unk_84B[this->unk_846]; + controlStickDirection = this->controlStickDirections[this->controlStickDataIndex]; - if (sp2C <= 0) { - if (func_80833BCC(this)) { + if (controlStickDirection <= PLAYER_STICK_DIR_FORWARD) { + if (Player_IsZTargeting(this)) { if (this->actor.category != ACTORCAT_PLAYER) { - if (sp2C < 0) { + if (controlStickDirection <= PLAYER_STICK_DIR_NONE) { func_808389E8(this, &gPlayerAnim_link_normal_jump, REG(69) / 100.0f, play); } else { - func_8083BC04(this, play); + Player_SetupRoll(this, play); } } else { if ((Player_GetMeleeWeaponHeld(this) != 0) && Player_CanUpdateItems(this)) { func_8083BA90(play, this, PLAYER_MWA_JUMPSLASH_START, 5.0f, 5.0f); } else { - func_8083BC04(this, play); + Player_SetupRoll(this, play); } } + return 1; } } else { - func_8083BCD0(this, play, sp2C); - if (sp2C == 1 || sp2C == 3) { + func_8083BCD0(this, play, controlStickDirection); + + if (controlStickDirection == 1 || controlStickDirection == 3) { gSaveContext.sohStats.count[COUNT_SIDEHOPS]++; } - if (sp2C == 2) { + if (controlStickDirection == 2) { gSaveContext.sohStats.count[COUNT_BACKFLIPS]++; } - + return 1; } } @@ -5839,13 +6364,13 @@ void func_8083C0B8(Player* this, PlayState* play) { } void func_8083C0E8(Player* this, PlayState* play) { - Player_SetupAction(play, this, Player_Action_80840BC8, 1); - Player_AnimPlayOnce(play, this, func_80833338(this)); + Player_SetupAction(play, this, Player_Action_Idle, 1); + Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this)); this->yaw = this->actor.shape.rot.y; } void func_8083C148(Player* this, PlayState* play) { - if (!(this->stateFlags3 & PLAYER_STATE3_HOOKSHOT_TRAVELLING)) { + if (!(this->stateFlags3 & PLAYER_STATE3_FLYING_WITH_HOOKSHOT)) { func_8083B010(this); if (this->stateFlags1 & PLAYER_STATE1_IN_WATER) { func_80838F18(play, this); @@ -5860,29 +6385,40 @@ void func_8083C148(Player* this, PlayState* play) { this->stateFlags1 &= ~(PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_FIRST_PERSON); } -s32 Player_ActionChange_6(Player* this, PlayState* play) { - if (!func_80833B54(this) && (D_808535E0 == 0) && !(this->stateFlags1 & PLAYER_STATE1_ON_HORSE) && +/** + * Handles setting up a roll if it is appropriate. + * + * If a roll is not applicable, there are two extra behaviors that could occur: + * - If an item is currently held in hand, it can be put away. + * - Navi can be toggled on and off. + * She will either appear and fly around Link's head, or disappear by flying back into his hat + * + * These extra behaviors are not new actions themselves, so they will result in `false` being returned + * even if they occur. + */ +s32 Player_ActionHandler_Roll(Player* this, PlayState* play) { + if (!Player_UpdateHostileLockOn(this) && !sUpperBodyIsBusy && !(this->stateFlags1 & PLAYER_STATE1_ON_HORSE) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A)) { - if (func_8083BC7C(this, play)) { - return 1; - } - if ((this->unk_837 == 0) && (this->heldItemAction >= PLAYER_IA_SWORD_MASTER)) { + if (Player_TryRoll(this, play)) { + return true; + } else if ((this->putAwayCooldownTimer == 0) && (this->heldItemAction >= PLAYER_IA_SWORD_MASTER)) { Player_UseItem(play, this, ITEM_NONE); } else { - this->stateFlags2 ^= PLAYER_STATE2_NAVI_OUT; + this->stateFlags2 ^= PLAYER_STATE2_NAVI_ACTIVE; } } - return 0; + return false; } -s32 Player_ActionChange_11(Player* this, PlayState* play) { +s32 Player_ActionHandler_11(Player* this, PlayState* play) { LinkAnimationHeader* anim; f32 frame; if ((play->shootingGalleryStatus == 0) && (this->currentShield != PLAYER_SHIELD_NONE) && CHECK_BTN_ALL(sControlInput->cur.button, BTN_R) && - (Player_IsChildWithHylianShield(this) || (!func_80833B2C(this) && (this->unk_664 == NULL)))) { + (Player_IsChildWithHylianShield(this) || + (!Player_FriendlyLockOnOrParallel(this) && (this->focusActor == NULL)))) { func_80832318(this); Player_DetachHeldActor(play, this); @@ -5898,20 +6434,20 @@ s32 Player_ActionChange_11(Player* this, PlayState* play) { } if (anim != this->skelAnime.animation) { - if (func_8008E9C4(this)) { + if (Player_CheckHostileLockOn(this)) { this->unk_86C = 1.0f; } else { this->unk_86C = 0.0f; func_80833C3C(this); } - this->unk_6BC = this->unk_6BE = this->unk_6C0 = 0; + this->upperLimbRot.x = this->upperLimbRot.y = this->upperLimbRot.z = 0; } frame = Animation_GetLastFrame(anim); LinkAnimation_Change(play, &this->skelAnime, anim, 1.0f, frame, frame, ANIMMODE_ONCE, 0.0f); if (Player_IsChildWithHylianShield(this)) { - Player_AnimReplaceApplyFlags(play, this, 4); + Player_StartAnimMovement(play, this, 4); } Player_PlaySfx(this, NA_SE_IT_SHIELD_POSTURE); @@ -5927,7 +6463,7 @@ s32 func_8083C484(Player* this, f32* arg1, s16* arg2) { s16 yaw = this->yaw - *arg2; if (ABS(yaw) > 0x6000) { - if (func_8083721C(this)) { + if (Player_DecelerateToZero(this)) { *arg1 = 0.0f; *arg2 = this->yaw; } else { @@ -5944,7 +6480,7 @@ void func_8083C50C(Player* this) { } } -s32 Player_ActionChange_8(Player* this, PlayState* play) { +s32 Player_ActionHandler_8(Player* this, PlayState* play) { if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { if (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) && (Player_GetMeleeWeaponHeld(this) != 0) && (this->unk_844 == 1) && (this->heldItemAction != PLAYER_IA_DEKU_STICK)) { @@ -5972,37 +6508,43 @@ s32 func_8083C61C(PlayState* play, Player* this) { return 0; } -static struct_80854554 D_80854554[] = { +typedef struct BottleSwingInfo { + /* 0x00 */ LinkAnimationHeader* missAnimation; + /* 0x04 */ LinkAnimationHeader* catchAnimation; + /* 0x08 */ u8 firstActiveFrame; + /* 0x09 */ u8 numActiveFrames; +} BottleSwingInfo; // size = 0x0C + +static BottleSwingInfo sBottleSwingInfo[] = { { &gPlayerAnim_link_bottle_bug_miss, &gPlayerAnim_link_bottle_bug_in, 2, 3 }, { &gPlayerAnim_link_bottle_fish_miss, &gPlayerAnim_link_bottle_fish_in, 5, 3 }, }; s32 func_8083C6B8(PlayState* play, Player* this) { - Vec3f sp24; - if (sUseHeldItem) { if (Player_GetBottleHeld(this) >= 0) { - Player_SetupAction(play, this, Player_Action_8084ECA4, 0); + Player_SetupAction(play, this, Player_Action_SwingBottle, 0); if (this->actor.yDistToWater > 12.0f) { - this->av2.actionVar2 = 1; + this->av2.inWater = true; } - Player_AnimPlayOnceAdjusted(play, this, D_80854554[this->av2.actionVar2].unk_00); + Player_AnimPlayOnceAdjusted(play, this, sBottleSwingInfo[this->av2.inWater].missAnimation); Player_PlaySfx(this, NA_SE_IT_SWORD_SWING); - func_80832698(this, NA_SE_VO_LI_AUTO_JUMP); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_AUTO_JUMP); return 1; } if (this->heldItemAction == PLAYER_IA_FISHING_POLE) { - sp24 = this->actor.world.pos; - sp24.y += 50.0f; + Vec3f rodCheckPos = this->actor.world.pos; + + rodCheckPos.y += 50.0f; if (CVarGetInteger(CVAR_ENHANCEMENT("HoverFishing"), 0) ? 0 : !(this->actor.bgCheckFlags & 1) || (this->actor.world.pos.z > 1300.0f) || - BgCheck_SphVsFirstPoly(&play->colCtx, &sp24, 20.0f)) { + BgCheck_SphVsFirstPoly(&play->colCtx, &rodCheckPos, 20.0f)) { func_80078884(NA_SE_SY_ERROR); return 0; } @@ -6023,7 +6565,7 @@ s32 func_8083C6B8(PlayState* play, Player* this) { void func_8083C858(Player* this, PlayState* play) { PlayerActionFunc actionFunc; - if (func_80833BCC(this)) { + if (Player_IsZTargeting(this)) { actionFunc = Player_Action_8084227C; } else { actionFunc = Player_Action_80842180; @@ -6125,19 +6667,22 @@ void func_8083CD00(Player* this, PlayState* play) { LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, &gPlayerAnim_link_anchor_back_brake, 2.0f); } -void func_8083CD54(PlayState* play, Player* this, s16 yaw) { +void Player_SetupTurnInPlace(PlayState* play, Player* this, s16 yaw) { this->yaw = yaw; - Player_SetupAction(play, this, Player_Action_80841BA8, 1); - this->unk_87E = 1200; - this->unk_87E *= D_808535E8; - LinkAnimation_Change(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_45_turn][this->modelAnimType], 1.0f, 0.0f, - 0.0f, ANIMMODE_LOOP, -6.0f); + + Player_SetupAction(play, this, Player_Action_TurnInPlace, 1); + + this->turnRate = 1200; + this->turnRate *= sWaterSpeedFactor; // slow turn rate by half when in water + + LinkAnimation_Change(play, &this->skelAnime, D_80853914[PLAYER_ANIMGROUP_45_turn][this->modelAnimType], 1.0f, + 0.0f, 0.0f, ANIMMODE_LOOP, -6.0f); } void func_8083CE0C(Player* this, PlayState* play) { LinkAnimationHeader* anim; - Player_SetupAction(play, this, Player_Action_80840BC8, 1); + Player_SetupAction(play, this, Player_Action_Idle, 1); if (this->unk_870 < 0.5f) { anim = D_80853914[PLAYER_ANIMGROUP_waitR2wait][this->modelAnimType]; @@ -6238,7 +6783,7 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { Player_SetupAction(play, this, Player_Action_8084E1EC, 1); if (this->stateFlags1 & PLAYER_STATE1_GETTING_ITEM) { - this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE; + this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_IN_CUTSCENE; } this->av2.actionVar2 = 2; @@ -6246,13 +6791,13 @@ s32 func_8083D12C(PlayState* play, Player* this, Input* arg2) { func_80832340(play, this); // Skip take breath animation on surface if Link didn't grab an item while underwater and the setting is enabled - if (CVarGetInteger(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim"), 0) && !(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { + if (CVarGetInteger(CVAR_ENHANCEMENT("SkipSwimDeepEndAnim"), 0) && !(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) { int lastAnimFrame = Animation_GetLastFrame(&gPlayerAnim_link_swimer_swim_deep_end); LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_swimer_swim_deep_end, 1.0f, lastAnimFrame, lastAnimFrame, ANIMMODE_ONCE, -6.0f); } else { Player_AnimChangeOnceMorph(play, this, - (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) ? &gPlayerAnim_link_swimer_swim_get + (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) ? &gPlayerAnim_link_swimer_swim_get : &gPlayerAnim_link_swimer_swim_deep_end); } @@ -6298,7 +6843,7 @@ void func_8083D36C(PlayState* play, Player* this) { Player_PlaySfx(this, NA_SE_EV_DIVE_INTO_WATER); if (this->fallDistance > 800.0f) { - func_80832698(this, NA_SE_VO_LI_CLIMB_END); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_CLIMB_END); } } } @@ -6335,7 +6880,7 @@ void func_8083D53C(PlayState* play, Player* this) { } } else if ((this->stateFlags1 & PLAYER_STATE1_IN_WATER) && (this->actor.yDistToWater < this->ageProperties->unk_24)) { if ((this->skelAnime.moveFlags == 0) && (this->currentBoots != PLAYER_BOOTS_IRON)) { - func_8083CD54(play, this, this->actor.shape.rot.y); + Player_SetupTurnInPlace(play, this, this->actor.shape.rot.y); } func_8083D0A8(play, this, this->actor.velocity.y); } @@ -6439,19 +6984,21 @@ void func_8083D6EC(PlayState* play, Player* this) { } s32 func_8083DB98(Player* this, s32 arg1) { - Actor* unk_664 = this->unk_664; - Vec3f sp30; - s16 sp2E; - s16 sp2C; + Actor* focusActor = this->focusActor; + Vec3f playerHeadPos; + s16 targetFocusRotX; + s16 targetFocusRotY; - sp30.x = this->actor.world.pos.x; - sp30.y = this->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; - sp30.z = this->actor.world.pos.z; - sp2E = Math_Vec3f_Pitch(&sp30, &unk_664->focus.pos); - sp2C = Math_Vec3f_Yaw(&sp30, &unk_664->focus.pos); - Math_SmoothStepToS(&this->actor.focus.rot.y, sp2C, 4, 10000, 0); - Math_SmoothStepToS(&this->actor.focus.rot.x, sp2E, 4, 10000, 0); - this->unk_6AE |= 2; + playerHeadPos.x = this->actor.world.pos.x; + playerHeadPos.y = this->bodyPartsPos[PLAYER_BODYPART_HEAD].y + 3.0f; + playerHeadPos.z = this->actor.world.pos.z; + + targetFocusRotX = Math_Vec3f_Pitch(&playerHeadPos, &focusActor->focus.pos); + targetFocusRotY = Math_Vec3f_Yaw(&playerHeadPos, &focusActor->focus.pos); + + Math_SmoothStepToS(&this->actor.focus.rot.y, targetFocusRotY, 4, 10000, 0); + Math_SmoothStepToS(&this->actor.focus.rot.x, targetFocusRotX, 4, 10000, 0); + this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_Y; return func_80836AB8(this, arg1); } @@ -6464,11 +7011,11 @@ void func_8083DC54(Player* this, PlayState* play) { f32 temp1; Vec3f sp34; - if (this->unk_664 != NULL) { + if (this->focusActor != NULL) { if (func_8002DD78(this) || func_808334B4(this)) { - func_8083DB98(this, 1); + func_8083DB98(this, true); } else { - func_8083DB98(this, 0); + func_8083DB98(this, false); } return; } @@ -6490,19 +7037,23 @@ void func_8083DC54(Player* this, PlayState* play) { } void func_8083DDC8(Player* this, PlayState* play) { - s16 temp1; - s16 temp2; - if (!func_8002DD78(this) && !func_808334B4(this) && (this->linearVelocity > 5.0f)) { - temp1 = this->linearVelocity * 200.0f; - temp2 = (s16)(this->yaw - this->actor.shape.rot.y) * this->linearVelocity * 0.1f; - temp1 = CLAMP(temp1, -4000, 4000); - temp2 = CLAMP(-temp2, -4000, 4000); - Math_ScaledStepToS(&this->unk_6BC, temp1, 900); - this->unk_6B6 = -(f32)this->unk_6BC * 0.5f; - Math_ScaledStepToS(&this->unk_6BA, temp2, 300); - Math_ScaledStepToS(&this->unk_6C0, temp2, 200); - this->unk_6AE |= 0x168; + s16 targetPitch; + s16 targetRoll; + + targetPitch = this->linearVelocity * 200.0f; + targetRoll = (s16)(this->yaw - this->actor.shape.rot.y) * this->linearVelocity * 0.1f; + + targetPitch = CLAMP(targetPitch, -4000, 4000); + targetRoll = CLAMP(-targetRoll, -4000, 4000); + + Math_ScaledStepToS(&this->upperLimbRot.x, targetPitch, 900); + this->headLimbRot.x = -(f32)this->upperLimbRot.x * 0.5f; + + Math_ScaledStepToS(&this->headLimbRot.z, targetRoll, 300); + Math_ScaledStepToS(&this->upperLimbRot.z, targetRoll, 200); + + this->unk_6AE_rotFlags |= UNK6AE_ROT_HEAD_X | UNK6AE_ROT_HEAD_Z | UNK6AE_ROT_UPPER_X | UNK6AE_ROT_UPPER_Z; } else { func_8083DC54(this, play); } @@ -6566,7 +7117,7 @@ static struct_80854578 D_80854578[] = { { &gPlayerAnim_link_uma_right_up, -34.16f, 7.91f }, }; -s32 Player_ActionChange_3(Player* this, PlayState* play) { +s32 Player_ActionHandler_3(Player* this, PlayState* play) { EnHorse* rideActor = (EnHorse*)this->rideActor; f32 unk_04; f32 unk_08; @@ -6578,7 +7129,7 @@ s32 Player_ActionChange_3(Player* this, PlayState* play) { sp38 = Math_CosS(rideActor->actor.shape.rot.y); sp34 = Math_SinS(rideActor->actor.shape.rot.y); - func_80836898(play, this, func_8083A360); + Player_SetupWaitForPutAway(play, this, func_8083A360); this->stateFlags1 |= PLAYER_STATE1_ON_HORSE; this->actor.bgCheckFlags &= ~0x20; @@ -6601,7 +7152,7 @@ s32 Player_ActionChange_3(Player* this, PlayState* play) { Actor_MountHorse(play, this, &rideActor->actor); Player_AnimPlayOnce(play, this, D_80854578[temp].anim); - Player_AnimReplaceApplyFlags(play, this, 0x9B); + Player_StartAnimMovement(play, this, 0x9B); this->actor.parent = this->rideActor; func_80832224(this); Actor_DisableLens(play); @@ -6620,7 +7171,7 @@ void Player_GetSlopeDirection(CollisionPoly* floorPoly, Vec3f* slopeNormal, s16* } s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly) { - static LinkAnimationHeader* sSlopeSlipAnims[] = { + static LinkAnimationHeader* sSlopeSlideAnims[] = { &gPlayerAnim_link_normal_down_slope_slip, &gPlayerAnim_link_normal_up_slope_slip, }; @@ -6632,8 +7183,9 @@ s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly) f32 slopeSlowdownSpeedStep; s16 velYawToDownwardSlope; - if (!Player_InBlockingCsMode(play, this) && (Player_Action_8084F390 != this->actionFunc) && + if (!Player_InBlockingCsMode(play, this) && (Player_Action_SlideOnSlope != this->actionFunc) && (SurfaceType_GetSlope(&play->colCtx, floorPoly, this->actor.floorBgId) == 1)) { + // Get direction of movement relative to the downward direction of the slope playerVelYaw = Math_Atan2S(this->actor.velocity.z, this->actor.velocity.x); Player_GetSlopeDirection(floorPoly, &slopeNormal, &downwardSlopeYaw); velYawToDownwardSlope = downwardSlopeYaw - playerVelYaw; @@ -6652,12 +7204,13 @@ s32 Player_HandleSlopes(PlayState* play, Player* this, CollisionPoly* floorPoly) Math_StepToF(&this->pushedSpeed, slopeSlowdownSpeed, slopeSlowdownSpeedStep); } else { // moving downward on the slope, causing player to slip - Player_SetupAction(play, this, Player_Action_8084F390, 0); + Player_SetupAction(play, this, Player_Action_SlideOnSlope, 0); func_80832564(play, this); + if (sFloorShapePitch >= 0) { this->av1.actionVar1 = 1; } - Player_AnimChangeLoopMorph(play, this, sSlopeSlipAnims[this->av1.actionVar1]); + Player_AnimChangeLoopMorph(play, this, sSlopeSlideAnims[this->av1.actionVar1]); this->linearVelocity = sqrtf(SQ(this->actor.velocity.x) + SQ(this->actor.velocity.z)); this->yaw = playerVelYaw; return true; @@ -6673,12 +7226,12 @@ static s32 D_80854598[] = { }; void func_8083E4C4(PlayState* play, Player* this, GetItemEntry* giEntry) { - s32 sp1C = giEntry->field & 0x1F; + s32 dropType = giEntry->field & 0x1F; if (!(giEntry->field & 0x80)) { - Item_DropCollectible(play, &this->actor.world.pos, sp1C | 0x8000); - if ((sp1C != 4) && (sp1C != 8) && (sp1C != 9) && (sp1C != 0xA) && (sp1C != 0) && (sp1C != 1) && (sp1C != 2) && - (sp1C != 0x14) && (sp1C != 0x13)) { + Item_DropCollectible(play, &this->actor.world.pos, dropType | 0x8000); + if ((dropType != 4) && (dropType != 8) && (dropType != 9) && (dropType != 0xA) && (dropType != 0) && (dropType != 1) && (dropType != 2) && + (dropType != 0x14) && (dropType != 0x13)) { Item_Give(play, giEntry->itemId); } } else { @@ -6687,46 +7240,7 @@ void func_8083E4C4(PlayState* play, Player* this, GetItemEntry* giEntry) { func_80078884((this->getItemId < 0 || this->getItemEntry.getItemId < 0) ? NA_SE_SY_GET_BOXITEM : NA_SE_SY_GET_ITEM); } -// Sets a flag according to which type of flag is specified in player->pendingFlag.flagType -// and which flag is specified in player->pendingFlag.flagID. -void Player_SetPendingFlag(Player* this, PlayState* play) { - switch (this->pendingFlag.flagType) { - case FLAG_SCENE_SWITCH: - Flags_SetSwitch(play, this->pendingFlag.flagID); - break; - case FLAG_SCENE_TREASURE: - Flags_SetTreasure(play, this->pendingFlag.flagID); - break; - case FLAG_SCENE_CLEAR: - Flags_SetClear(play, this->pendingFlag.flagID); - break; - case FLAG_SCENE_COLLECTIBLE: - Flags_SetCollectible(play, this->pendingFlag.flagID); - break; - case FLAG_EVENT_CHECK_INF: - Flags_SetEventChkInf(this->pendingFlag.flagID); - break; - case FLAG_ITEM_GET_INF: - Flags_SetItemGetInf(this->pendingFlag.flagID); - break; - case FLAG_INF_TABLE: - Flags_SetInfTable(this->pendingFlag.flagID); - break; - case FLAG_EVENT_INF: - Flags_SetEventInf(this->pendingFlag.flagID); - break; - case FLAG_RANDOMIZER_INF: - Flags_SetRandomizerInf(this->pendingFlag.flagID); - break; - case FLAG_NONE: - default: - break; - } - this->pendingFlag.flagType = FLAG_NONE; - this->pendingFlag.flagID = 0; -} - -s32 Player_ActionChange_2(Player* this, PlayState* play) { +s32 Player_ActionHandler_2(Player* this, PlayState* play) { Actor* interactedActor; if(gSaveContext.pendingIceTrapCount) { @@ -6735,7 +7249,7 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { if (CVarGetInteger(CVAR_ENHANCEMENT("ExtraTraps.Enabled"), 0)) { return 1; } - this->stateFlags1 &= ~(PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD); + this->stateFlags1 &= ~(PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_CARRYING_ACTOR); this->actor.colChkInfo.damage = 0; func_80837C0C(play, this, 3, 0.0f, 0.0f, 0, 20); this->getItemId = GI_NONE; @@ -6807,12 +7321,12 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { func_8083AE40(this, giEntry.objectId); if (!(this->stateFlags2 & PLAYER_STATE2_UNDERWATER) || (this->currentBoots == PLAYER_BOOTS_IRON)) { - func_80836898(play, this, func_8083A434); + Player_SetupWaitForPutAway(play, this, func_8083A434); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_demo_get_itemB); func_80835EA4(play, 9); } - this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE; + this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_IN_CUTSCENE; func_80832224(this); return 1; } @@ -6822,7 +7336,7 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; } - } else if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && !(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && + } else if (CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && !(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && !(this->stateFlags2 & PLAYER_STATE2_UNDERWATER)) { if (this->getItemId != GI_NONE) { GetItemEntry giEntry; @@ -6841,9 +7355,9 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { } if (GameInteractor_Should(VB_GIVE_ITEM_FROM_CHEST, true, chest)) { - func_80836898(play, this, func_8083A434); + Player_SetupWaitForPutAway(play, this, func_8083A434); } - this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_CUTSCENE; + this->stateFlags1 |= PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_IN_CUTSCENE; func_8083AE40(this, giEntry.objectId); this->actor.world.pos.x = @@ -6858,7 +7372,7 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { if (GameInteractor_Should(VB_PLAY_SLOW_CHEST_CS, vanillaPlaySlowChestCS, chest)) { Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_98); - Player_AnimReplaceApplyFlags(play, this, 0x28F); + Player_StartAnimMovement(play, this, 0x28F); chest->unk_1F4 = 1; Camera_ChangeSetting(Play_GetCamera(play, 0), CAM_SET_SLOW_CHEST_CS); } else { @@ -6876,11 +7390,11 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { this->itemAction = PLAYER_IA_NONE; this->modelAnimType = PLAYER_ANIMTYPE_0; this->heldItemAction = this->itemAction; - func_80836898(play, this, func_8083A0F4); + Player_SetupWaitForPutAway(play, this, func_8083A0F4); if (sp24 == PLAYER_IA_SWORD_MASTER) { - this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_IA_LAST_USED); - Player_InitItemAction(play, this, PLAYER_IA_LAST_USED); + this->nextModelGroup = Player_ActionToModelGroup(this, PLAYER_IA_SWORD_CS); + Player_InitItemAction(play, this, PLAYER_IA_SWORD_CS); } else { Player_UseItem(play, this, ITEM_LAST_USED); } @@ -6892,11 +7406,11 @@ s32 Player_ActionChange_2(Player* this, PlayState* play) { return 0; } - func_80836898(play, this, func_8083A0F4); + Player_SetupWaitForPutAway(play, this, func_8083A0F4); } func_80832224(this); - this->stateFlags1 |= PLAYER_STATE1_ITEM_OVER_HEAD; + this->stateFlags1 |= PLAYER_STATE1_CARRYING_ACTOR; return 1; } } @@ -6919,12 +7433,12 @@ s32 func_8083EAF0(Player* this, Actor* actor) { return 1; } -s32 Player_ActionChange_9(Player* this, PlayState* play) { +s32 Player_ActionHandler_9(Player* this, PlayState* play) { u16 buttonsToCheck = BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } - if ((this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (this->heldActor != NULL) && + if ((this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (this->heldActor != NULL) && CHECK_BTN_ANY(sControlInput->press.button, buttonsToCheck)) { if (!func_80835644(play, this, this->heldActor)) { if (!func_8083EAF0(this, this->heldActor)) { @@ -7008,7 +7522,7 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) { f32 sp34 = this->distToInteractWall; LinkAnimationHeader* anim; - func_80836898(play, this, func_8083A3B0); + Player_SetupWaitForPutAway(play, this, func_8083A3B0); this->stateFlags1 |= PLAYER_STATE1_CLIMBING_LADDER; this->stateFlags1 &= ~PLAYER_STATE1_IN_WATER; @@ -7038,7 +7552,7 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) { func_80832224(this); Math_Vec3f_Copy(&this->actor.prevPos, &this->actor.world.pos); Player_AnimPlayOnce(play, this, anim); - Player_AnimReplaceApplyFlags(play, this, 0x9F); + Player_StartAnimMovement(play, this, 0x9F); return true; } @@ -7050,7 +7564,7 @@ s32 func_8083EC18(Player* this, PlayState* play, u32 wallFlags) { } void func_8083F070(Player* this, LinkAnimationHeader* anim, PlayState* play) { - func_80835DAC(play, this, Player_Action_8084C5F8, 0); + Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084C5F8, 0); LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, anim, (4.0f / 3.0f)); } @@ -7110,7 +7624,7 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall f32 wallPolyNormZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); f32 distToInteractWall = this->distToInteractWall; - func_80836898(play, this, func_8083A40C); + Player_SetupWaitForPutAway(play, this, func_8083A40C); this->stateFlags2 |= PLAYER_STATE2_CRAWLING; this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; this->actor.world.pos.x = xVertex1 + (distToInteractWall * wallPolyNormX); @@ -7124,11 +7638,11 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall ((CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) + 1.0f) / 2.0f), 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), ANIMMODE_ONCE, 0.0f); - Player_AnimReplaceApplyFlags(play, this, 0x9D); + Player_StartAnimMovement(play, this, 0x9D); // #endregion } else { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_start); - Player_AnimReplaceApplyFlags(play, this, 0x9D); + Player_StartAnimMovement(play, this, 0x9D); } return true; } @@ -7140,15 +7654,15 @@ s32 Player_TryEnteringCrawlspace(Player* this, PlayState* play, u32 interactWall s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f32 arg4) { CollisionPoly* wallPoly; - s32 sp78; + s32 wallBgId; Vec3f sp6C; Vec3f sp60; Vec3f sp54; f32 yawCos; f32 yawSin; s32 temp; - f32 temp1; - f32 temp2; + f32 wallPolyNormalX; + f32 wallPolyNormalZ; yawCos = Math_CosS(this->actor.shape.rot.y); yawSin = Math_SinS(this->actor.shape.rot.y); @@ -7160,17 +7674,17 @@ s32 func_8083F360(PlayState* play, Player* this, f32 arg1, f32 arg2, f32 arg3, f sp60.y = sp6C.y = this->actor.world.pos.y + arg1; if (BgCheck_EntityLineTest1(&play->colCtx, &sp6C, &sp60, &sp54, &this->actor.wallPoly, true, false, false, - true, &sp78)) { + true, &wallBgId)) { wallPoly = this->actor.wallPoly; this->actor.bgCheckFlags |= 0x200; - this->actor.wallBgId = sp78; + this->actor.wallBgId = wallBgId; - sTouchedWallFlags = func_80041DB8(&play->colCtx, wallPoly, sp78); + sTouchedWallFlags = func_80041DB8(&play->colCtx, wallPoly, wallBgId); - temp1 = COLPOLY_GET_NORMAL(wallPoly->normal.x); - temp2 = COLPOLY_GET_NORMAL(wallPoly->normal.z); - temp = Math_Atan2S(-temp2, -temp1); + wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); + wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); + temp = Math_Atan2S(-wallPolyNormalZ, -wallPolyNormalX); Math_ScaledStepToS(&this->actor.shape.rot.y, temp, 800); this->yaw = this->actor.shape.rot.y; @@ -7191,56 +7705,59 @@ s32 func_8083F524(PlayState* play, Player* this) { /** * Two exit walls are placed at each end of the crawlspace, separate to the two entrance walls used to enter the - * crawlspace. These front and back exit walls are futher into the crawlspace than the front and + * crawlspace. These front and back exit walls are further into the crawlspace than the front and * back entrance walls. When player interacts with either of these two interior exit walls, start the leaving-crawlspace * cutscene and return true. Else, return false */ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { - s16 temp; + s16 yawToWall; if ((this->linearVelocity != 0.0f) && (this->actor.bgCheckFlags & 8) && (sTouchedWallFlags & 0x30)) { - temp = this->actor.shape.rot.y - this->actor.wallYaw; + // The exit wallYaws will always point inward on the crawlline + // Interacting with the exit wall in front will have a yaw diff of 0x8000 + // Interacting with the exit wall behind will have a yaw diff of 0 + yawToWall = this->actor.shape.rot.y - this->actor.wallYaw; if (this->linearVelocity < 0.0f) { - temp += 0x8000; + yawToWall += 0x8000; } - if (ABS(temp) > 0x4000) { + if (ABS(yawToWall) > 0x4000) { Player_SetupAction(play, this, Player_Action_8084C81C, 0); if (this->linearVelocity > 0.0f) { + // Leaving a crawlspace forwards this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; // #region SOH [Enhancement] if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { - // animation when exiting a tunnel forward LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_end, ((CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) + 1.0f) / 2.0f), 0.0f, Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_end), ANIMMODE_ONCE, 0.0f); - Player_AnimReplaceApplyFlags(play, this, 0x9D); + Player_StartAnimMovement(play, this, 0x9D); OnePointCutscene_Init(play, 9601, 999, NULL, MAIN_CAM); // #endregion } else { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_child_tunnel_end); - Player_AnimReplaceApplyFlags(play, this, 0x9D); + Player_StartAnimMovement(play, this, 0x9D); OnePointCutscene_Init(play, 9601, 999, NULL, MAIN_CAM); } } else { + // Leaving a crawlspace backwards this->actor.shape.rot.y = this->actor.wallYaw; // #region SOH [Enhancement] - // animation when exiting a tunnel backward - if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"),1) > 1) { + if (CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) > 1) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_start, -1.0f * ((CVarGetInteger(CVAR_ENHANCEMENT("CrawlSpeed"), 1) + 1.0f) / 2.0f), Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), 0.0f, ANIMMODE_ONCE, 0.0f); - Player_AnimReplaceApplyFlags(play, this, 0x9D); + Player_StartAnimMovement(play, this, 0x9D); OnePointCutscene_Init(play, 9602, 999, NULL, MAIN_CAM); // #endregion } else { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_child_tunnel_start, -1.0f, Animation_GetLastFrame(&gPlayerAnim_link_child_tunnel_start), 0.0f, ANIMMODE_ONCE, 0.0f); - Player_AnimReplaceApplyFlags(play, this, 0x9D); + Player_StartAnimMovement(play, this, 0x9D); OnePointCutscene_Init(play, 9602, 999, NULL, MAIN_CAM); } } @@ -7248,15 +7765,15 @@ s32 Player_TryLeavingCrawlspace(Player* this, PlayState* play) { this->yaw = this->actor.shape.rot.y; Player_ZeroSpeedXZ(this); - return 1; + return true; } } - return 0; + return false; } void func_8083F72C(Player* this, LinkAnimationHeader* anim, PlayState* play) { - if (!func_80836898(play, this, func_8083A388)) { + if (!Player_SetupWaitForPutAway(play, this, func_8083A388)) { Player_SetupAction(play, this, Player_Action_8084B78C, 0); } @@ -7266,10 +7783,10 @@ void func_8083F72C(Player* this, LinkAnimationHeader* anim, PlayState* play) { this->actor.shape.rot.y = this->yaw = this->actor.wallYaw + 0x8000; } -s32 Player_ActionChange_5(Player* this, PlayState* play) { +s32 Player_ActionHandler_5(Player* this, PlayState* play) { DynaPolyActor* wallPolyActor; - if (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (this->actor.bgCheckFlags & 0x200) && (sShapeYawToTouchedWall < 0x3000)) { + if (!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (this->actor.bgCheckFlags & 0x200) && (sShapeYawToTouchedWall < 0x3000)) { if (((this->linearVelocity > 0.0f) && func_8083EC18(this, play, sTouchedWallFlags)) || Player_TryEnteringCrawlspace(this, play, sTouchedWallFlags)) { @@ -7291,8 +7808,8 @@ s32 Player_ActionChange_5(Player* this, PlayState* play) { return 0; } - func_80836898(play, this, func_8083A0F4); - this->stateFlags1 |= PLAYER_STATE1_ITEM_OVER_HEAD; + Player_SetupWaitForPutAway(play, this, func_8083A0F4); + this->stateFlags1 |= PLAYER_STATE1_CARRYING_ACTOR; this->interactRangeActor = &wallPolyActor->actor; this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; @@ -7363,19 +7880,19 @@ s32 func_8083FBC0(Player* this, PlayState* play) { if (!CHECK_BTN_ALL(sControlInput->press.button, BTN_A) && (this->actor.bgCheckFlags & 0x200) && ((sTouchedWallFlags & 8) || (sTouchedWallFlags & 2) || func_80041E4C(&play->colCtx, this->actor.wallPoly, this->actor.wallBgId))) { - return 0; + return false; } func_8083FB7C(this, play); - func_80832698(this, NA_SE_VO_LI_AUTO_JUMP); - return 1; + Player_PlayVoiceSfx(this, NA_SE_VO_LI_AUTO_JUMP); + return true; } s32 func_8083FC68(Player* this, f32 arg1, s16 arg2) { f32 sp1C = (s16)(arg2 - this->actor.shape.rot.y); f32 temp; - if (this->unk_664 != NULL) { + if (this->focusActor != NULL) { func_8083DB98(this, func_8002DD78(this) || func_808334B4(this)); } @@ -7391,10 +7908,10 @@ s32 func_8083FC68(Player* this, f32 arg1, s16 arg2) { } s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { - s16 sp2E = *arg2 - this->zTargetYaw; + s16 sp2E = *arg2 - this->parallelYaw; u16 sp2C = ABS(sp2E); - if ((func_8002DD78(this) || func_808334B4(this)) && (this->unk_664 == NULL)) { + if ((func_8002DD78(this) || func_808334B4(this)) && (this->focusActor == NULL)) { *arg1 *= Math_SinS(sp2C); if (*arg1 != 0.0f) { @@ -7406,7 +7923,7 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { // #region SOH [Enhancement] if (CVarGetInteger(CVAR_SETTING("Controls.RightStickAim"), 0) || !CVarGetInteger(CVAR_SETTING("Controls.InvertZAimingYAxis"), 1)) { - if (this->unk_664 != NULL) { + if (this->focusActor != NULL) { func_8083DB98(this, 1); } else { int8_t relStickY; @@ -7432,7 +7949,7 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { } // #endregion } else { - if (this->unk_664 != NULL) { + if (this->focusActor != NULL) { func_8083DB98(this, 1); } else { Math_SmoothStepToS(&this->actor.focus.rot.x, sControlInput->rel.stick_y * 240.0f, 14, 4000, 30); @@ -7440,7 +7957,7 @@ s32 func_8083FD78(Player* this, f32* arg1, s16* arg2, PlayState* play) { } } } else { - if (this->unk_664 != NULL) { + if (this->focusActor != NULL) { return func_8083FC68(this, *arg1, *arg2); } else { func_8083DC54(this, play); @@ -7477,14 +7994,14 @@ s32 func_80840058(Player* this, f32* arg1, s16* arg2, PlayState* play) { func_8083DC54(this, play); if ((*arg1 != 0.0f) || (ABS(this->unk_87C) > 400)) { - s16 temp1 = *arg2 - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); - u16 temp2 = (ABS(temp1) - 0x2000) & 0xFFFF; + s16 temp1 = *arg2 - (u16)Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); + u16 temp2 = (ABS(temp1) - 0x2000); if ((temp2 < 0x4000) || (this->unk_87C != 0)) { return -1; - } else { - return 1; } + + return 1; } return 0; @@ -7541,7 +8058,7 @@ void func_8084029C(Player* this, f32 arg1) { (this->hoverBootsTimer != 0 || (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0) && this->ivanFloating))) { func_8002F8F0(&this->actor, NA_SE_PL_HOBBERBOOTS_LV - SFX_FLAG); } else if (func_8084021C(this->unk_868, arg1, 29.0f, 10.0f) || func_8084021C(this->unk_868, arg1, 29.0f, 24.0f)) { - func_808327F8(this, this->linearVelocity); + Player_PlaySteppingSfx(this, this->linearVelocity); if (this->linearVelocity > 4.0f) { this->stateFlags2 |= PLAYER_STATE2_FOOTSTEP; } @@ -7574,7 +8091,7 @@ void Player_Action_80840450(Player* this, PlayState* play) { if (this->av2.actionVar2 != 0) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832DBC(this); + Player_FinishAnimMovement(this); Player_AnimPlayLoop(play, this, func_808334E4(this)); this->av2.actionVar2 = 0; this->stateFlags3 &= ~PLAYER_STATE3_FINISHED_ATTACKING; @@ -7584,10 +8101,10 @@ void Player_Action_80840450(Player* this, PlayState* play) { func_808401B0(play, this); } - func_8083721C(this); + Player_DecelerateToZero(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList1, true)) { - if (!func_80833B54(this) && (!func_80833B2C(this) || (func_80834B5C != this->upperActionFunc))) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList1, true)) { + if (!Player_UpdateHostileLockOn(this) && (!Player_FriendlyLockOnOrParallel(this) || (func_80834B5C != this->upperActionFunc))) { func_8083CF10(this, play); return; } @@ -7646,20 +8163,20 @@ void Player_Action_808407CC(Player* this, PlayState* play) { s32 temp3; if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832DBC(this); - Player_AnimPlayOnce(play, this, func_80833338(this)); + Player_FinishAnimMovement(this); + Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this)); } - func_8083721C(this); + Player_DecelerateToZero(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList2, true)) { - if (func_80833B54(this)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList2, true)) { + if (Player_UpdateHostileLockOn(this)) { func_8083CEAC(this, play); return; } - if (!func_80833B2C(this)) { - func_80835DAC(play, this, Player_Action_80840BC8, 1); + if (!Player_FriendlyLockOnOrParallel(this)) { + Player_SetupActionPreserveAnimMovement(play, this, Player_Action_Idle, 1); this->yaw = this->actor.shape.rot.y; return; } @@ -7697,95 +8214,134 @@ void Player_Action_808407CC(Player* this, PlayState* play) { temp3 = ABS(temp2); if (temp3 > 800) { - func_8083CD54(play, this, yawTarget); + Player_SetupTurnInPlace(play, this, yawTarget); } } } -void func_808409CC(PlayState* play, Player* this) { +void Player_ChooseNextIdleAnim(PlayState* play, Player* this) { LinkAnimationHeader* anim; - LinkAnimationHeader** animPtr; + LinkAnimationHeader** fidgetAnimPtr; s32 heathIsCritical; - s32 sp38; - s32 sp34; + s32 fidgetType; + s32 commonType; - if ((this->unk_664 != NULL) || - (!(heathIsCritical = HealthMeter_IsCritical()) && ((this->unk_6AC = (this->unk_6AC + 1) & 1) != 0))) { - this->stateFlags2 &= ~PLAYER_STATE2_IDLING; - anim = func_80833338(this); + if ((this->focusActor != NULL) || + (!(heathIsCritical = HealthMeter_IsCritical()) && ((this->idleType = (this->idleType + 1) & 1) != 0))) { + this->stateFlags2 &= ~PLAYER_STATE2_IDLE_FIDGET; + anim = Player_GetIdleAnim(this); } else { - this->stateFlags2 |= PLAYER_STATE2_IDLING; - if (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { - anim = func_80833338(this); + this->stateFlags2 |= PLAYER_STATE2_IDLE_FIDGET; + + if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { + // Default idle animation will play if carrying an actor. + // Note that in this case, `PLAYER_STATE2_IDLE_FIDGET` is still set even though the + // animation that plays isn't a fidget animation. + anim = Player_GetIdleAnim(this); } else { - sp38 = play->roomCtx.curRoom.behaviorType2; + // Pick fidget type based on room behavior. + // This may be changed below. + fidgetType = play->roomCtx.curRoom.behaviorType2; + if (heathIsCritical) { - if (this->unk_6AC >= 0) { - sp38 = 7; - this->unk_6AC = -1; + if (this->idleType >= PLAYER_IDLE_DEFAULT) { + fidgetType = FIDGET_CRIT_HEALTH_START; + + // When health is critical, `idleType` will not be updated. + // It will stay as `PLAYER_IDLE_CRIT_HEALTH` until health is no longer critical. + this->idleType = PLAYER_IDLE_CRIT_HEALTH; } else { - sp38 = 8; + // Keep looping the critical health animation until critical health ends + fidgetType = FIDGET_CRIT_HEALTH_LOOP; } } else { - sp34 = Rand_ZeroOne() * 5.0f; - if (sp34 < 4) { - if (((sp34 != 0) && (sp34 != 3)) || ((this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && - ((sp34 == 3) || Player_GetMeleeWeaponHeld(this)))) { - if ((sp34 == 1) && Player_HoldsTwoHandedWeapon(this) && CVarGetInteger(CVAR_ENHANCEMENT("TwoHandedIdle"), 0) == 1) { - sp34 = 4; + commonType = Rand_ZeroOne() * 5; + + // There is a 4/5 chance that a common fidget type will be considered. + // However it may get rejected by the conditions below. + // The type determined by `curRoom.behaviorType2` will be used if a common type is rejected. + if (commonType < 4) { + // `FIDGET_ADJUST_TUNIC` and `FIDGET_TAP_FEET` are accepted unconditionally. + // The sword and shield related common types have extra restrictions. + // + // Note that `FIDGET_SWORD_SWING` is the first common fidget type, which is why + // all operations are done relative to this type. + if (((commonType + FIDGET_SWORD_SWING != FIDGET_SWORD_SWING) && + (commonType + FIDGET_SWORD_SWING != FIDGET_ADJUST_SHIELD)) || + ((this->rightHandType == PLAYER_MODELTYPE_RH_SHIELD) && + ((commonType + FIDGET_SWORD_SWING == FIDGET_ADJUST_SHIELD) || + (Player_GetMeleeWeaponHeld2(this) != 0)))) { + //! @bug It is possible for `FIDGET_ADJUST_SHIELD` to be used even if + //! a shield is not currently equipped. This is because of how being shieldless + //! is implemented. There is no sword-only model type, only + //! `PLAYER_MODELGROUP_SWORD_AND_SHIELD` exists. Therefore, the right hand type will be + //! `PLAYER_MODELTYPE_RH_SHIELD` if sword is in hand, even if no shield is equipped. + if ((commonType + FIDGET_SWORD_SWING == FIDGET_SWORD_SWING) && + Player_HoldsTwoHandedWeapon(this) && + CVarGetInteger(CVAR_ENHANCEMENT("TwoHandedIdle"), 0) == 1) { + //! @bug This code is unreachable. + //! The check above groups the `Player_GetMeleeWeaponHeld2` check and + //! `PLAYER_MODELTYPE_RH_SHIELD` conditions together, meaning sword and shield must be + //! in hand. However shield is not in hand when using a two handed melee weapon. + commonType = FIDGET_SWORD_SWING_TWO_HAND - FIDGET_SWORD_SWING; } - sp38 = sp34 + 9; + + fidgetType = FIDGET_SWORD_SWING + commonType; } } } - animPtr = &D_80853D7C[sp38][0]; + + fidgetAnimPtr = &sFidgetAnimations[fidgetType][0]; + if (this->modelAnimType != PLAYER_ANIMTYPE_1) { - animPtr = &D_80853D7C[sp38][1]; + fidgetAnimPtr = &sFidgetAnimations[fidgetType][1]; } - anim = *animPtr; + + anim = *fidgetAnimPtr; } } - LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f) * D_808535E8, 0.0f, + LinkAnimation_Change(play, &this->skelAnime, anim, (2.0f / 3.0f) * sWaterSpeedFactor, 0.0f, Animation_GetLastFrame(anim), ANIMMODE_ONCE, -6.0f); } -void Player_Action_80840BC8(Player* this, PlayState* play) { - s32 sp44; - s32 sp40; +void Player_Action_Idle(Player* this, PlayState* play) { + s32 idleAnimResult = Player_CheckForIdleAnim(this); + s32 animDone = LinkAnimation_Update(play, &this->skelAnime); f32 speedTarget; s16 yawTarget; - s16 temp; + s16 yawDiff; - sp44 = func_80833350(this); - sp40 = LinkAnimation_Update(play, &this->skelAnime); - - if (sp44 > 0) { - func_808333FC(this, sp44 - 1); + if (idleAnimResult > IDLE_ANIM_NONE) { + Player_ProcessFidgetAnimSfxList(this, idleAnimResult - 1); } - if (sp40 != 0) { - if (this->av2.actionVar2 != 0) { - if (DECR(this->av2.actionVar2) == 0) { + if (animDone) { + if (this->av2.fallDamageStunTimer != 0) { + if (DECR(this->av2.fallDamageStunTimer) == 0) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; } - this->skelAnime.jointTable[0].y = (this->skelAnime.jointTable[0].y + ((this->av2.actionVar2 & 1) * 0x50)) - 0x28; + + // Offset model y position. + // Depending on if the timer is even or odd, the offset will be 40 or -40 model space units. + this->skelAnime.jointTable[0].y = + (this->skelAnime.jointTable[0].y + ((this->av2.fallDamageStunTimer & 1) * 0x50)) - 0x28; } else { - func_80832DBC(this); - func_808409CC(play, this); + Player_FinishAnimMovement(this); + Player_ChooseNextIdleAnim(play, this); } } - func_8083721C(this); + Player_DecelerateToZero(this); - if (this->av2.actionVar2 == 0) { - if (!Player_TryActionChangeList(play, this, sActionChangeList7, true)) { - if (func_80833B54(this)) { + if (this->av2.fallDamageStunTimer == 0) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerListIdle, true)) { + if (Player_UpdateHostileLockOn(this)) { func_8083CEAC(this, play); return; } - if (func_80833B2C(this)) { + if (Player_FriendlyLockOnOrParallel(this)) { func_80839F30(this, play); return; } @@ -7797,15 +8353,17 @@ void Player_Action_80840BC8(Player* this, PlayState* play) { return; } - temp = yawTarget - this->actor.shape.rot.y; - if (ABS(temp) > 800) { - func_8083CD54(play, this, yawTarget); + yawDiff = yawTarget - this->actor.shape.rot.y; + + if (ABS(yawDiff) > 800) { + Player_SetupTurnInPlace(play, this, yawTarget); return; } Math_ScaledStepToS(&this->actor.shape.rot.y, yawTarget, 1200); this->yaw = this->actor.shape.rot.y; - if (func_80833338(this) == this->skelAnime.animation) { + + if (Player_GetIdleAnim(this) == this->skelAnime.animation) { func_8083DC54(this, play); } } @@ -7849,16 +8407,16 @@ void Player_Action_80840DE4(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 0.0f) || LinkAnimation_OnFrame(&this->skelAnime, frames * 0.5f)) { - func_808327F8(this, this->linearVelocity); + Player_PlaySteppingSfx(this, this->linearVelocity); } - if (!Player_TryActionChangeList(play, this, sActionChangeList3, true)) { - if (func_80833B54(this)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList3, true)) { + if (Player_UpdateHostileLockOn(this)) { func_8083CEAC(this, play); return; } - if (!func_80833B2C(this)) { + if (!Player_FriendlyLockOnOrParallel(this)) { func_80853080(this, play); return; } @@ -7907,6 +8465,8 @@ void func_80841138(Player* this, PlayState* play) { f32 temp2; if (this->unk_864 < 1.0f) { + s32 pad; + temp1 = R_UPDATE_RATE * 0.5f; func_8084029C(this, REG(35) / 1000.0f); LinkAnimation_LoadToJoint(play, &this->skelAnime, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_back_walk, this->modelAnimType), @@ -7955,7 +8515,7 @@ s32 func_80841458(Player* this, f32* arg1, s16* arg2, PlayState* play) { } if (*arg1 != 0.0f) { - if (func_8083721C(this)) { + if (Player_DecelerateToZero(this)) { *arg1 = 0.0f; *arg2 = this->yaw; } else { @@ -7970,12 +8530,11 @@ void Player_Action_808414F8(Player* this, PlayState* play) { f32 speedTarget; s16 yawTarget; s32 sp2C; - s16 sp2A; func_80841138(this, play); - if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { - if (!func_80833C04(this)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList4, true)) { + if (!Player_IsZTargetingWithHostileUpdate(this)) { func_8083C8DC(this, play, this->yaw); return; } @@ -7994,7 +8553,7 @@ void Player_Action_808414F8(Player* this, PlayState* play) { } } } else { - sp2A = yawTarget - this->yaw; + s16 sp2A = yawTarget - this->yaw; Math_AsymStepToF(&this->linearVelocity, speedTarget * 1.5f, 1.5f, 2.0f); Math_ScaledStepToS(&this->yaw, yawTarget, sp2A * 0.1f); @@ -8017,9 +8576,9 @@ void Player_Action_8084170C(Player* this, PlayState* play) { s16 yawTarget; sp34 = LinkAnimation_Update(play, &this->skelAnime); - func_8083721C(this); + Player_DecelerateToZero(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList4, true)) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->linearVelocity == 0.0f) { @@ -8039,7 +8598,7 @@ void Player_Action_808417FC(Player* this, PlayState* play) { sp1C = LinkAnimation_Update(play, &this->skelAnime); - if (!Player_TryActionChangeList(play, this, sActionChangeList4, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList4, true)) { if (sp1C != 0) { func_80839F30(this, play); } @@ -8069,15 +8628,15 @@ void Player_Action_8084193C(Player* this, PlayState* play) { func_80841860(play, this); - if (!Player_TryActionChangeList(play, this, sActionChangeList5, true)) { - if (!func_80833C04(this)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList5, true)) { + if (!Player_IsZTargetingWithHostileUpdate(this)) { func_8083C858(this, play); return; } Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - if (func_80833B2C(this)) { + if (Player_FriendlyLockOnOrParallel(this)) { temp1 = func_8083FD78(this, &speedTarget, &yawTarget, play); } else { temp1 = func_8083FC68(this, speedTarget, yawTarget); @@ -8089,7 +8648,7 @@ void Player_Action_8084193C(Player* this, PlayState* play) { } if (temp1 < 0) { - if (func_80833B2C(this)) { + if (Player_FriendlyLockOnOrParallel(this)) { func_8083CB2C(this, yawTarget, play); } else { func_8083CBF0(this, yawTarget, play); @@ -8098,7 +8657,7 @@ void Player_Action_8084193C(Player* this, PlayState* play) { } if ((this->linearVelocity < 3.6f) && (speedTarget < 4.0f)) { - if (!func_8008E9C4(this) && func_80833B2C(this)) { + if (!Player_CheckHostileLockOn(this) && Player_FriendlyLockOnOrParallel(this)) { func_8083CB94(this, play); } else { func_80839F90(this, play); @@ -8124,26 +8683,41 @@ void Player_Action_8084193C(Player* this, PlayState* play) { } } -void Player_Action_80841BA8(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; +/** + * Turn in place until the angle pointed to by the control stick is reached. + * + * This is the state that the speedrunning community refers to as "ESS" or "ESS Position". + * See the bug comment below and https://www.zeldaspeedruns.com/oot/tech/extended-superslide + * for more information. + */ +void Player_Action_TurnInPlace(Player* this, PlayState* play) { + f32 speedTarget; + s16 yawTarget; LinkAnimation_Update(play, &this->skelAnime); if (Player_HoldsTwoHandedWeapon(this)) { - AnimationContext_SetLoadFrame(play, func_80833338(this), 0, this->skelAnime.limbCount, + AnimationContext_SetLoadFrame(play, Player_GetIdleAnim(this), 0, this->skelAnime.limbCount, this->skelAnime.morphTable); AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, this->skelAnime.morphTable, sUpperBodyLimbCopyMap); } - Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_CURVED, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); - if (!Player_TryActionChangeList(play, this, sActionChangeList6, true)) { - if (sp34 != 0.0f) { - this->actor.shape.rot.y = sp32; + //! @bug This action does not handle xzSpeed in any capacity. + //! Player's current speed value will be maintained the entire time this action is running. + //! This is the core bug that allows many different glitches to manifest. + //! + //! One possible fix is to kill all speed instantly in `Player_SetupTurnInPlace`. + //! Another possible fix is to gradually kill speed by calling `Player_DecelerateToZero` + //! here, which plenty of other "standing" actions do. + + if (!Player_TryActionHandlerList(play, this, sActionHandlerListTurnInPlace, true)) { + if (speedTarget != 0.0f) { + this->actor.shape.rot.y = yawTarget; func_8083C858(this, play); - } else if (Math_ScaledStepToS(&this->actor.shape.rot.y, sp32, this->unk_87E)) { + } else if (Math_ScaledStepToS(&this->actor.shape.rot.y, yawTarget, this->turnRate)) { func_8083C0E8(this, play); } @@ -8256,8 +8830,8 @@ void Player_Action_80842180(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; func_80841EE4(this, play); - if (!Player_TryActionChangeList(play, this, sActionChangeList8, true)) { - if (func_80833C04(this)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList8, true)) { + if (Player_IsZTargetingWithHostileUpdate(this)) { func_8083C858(this, play); return; } @@ -8311,8 +8885,8 @@ void Player_Action_8084227C(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; func_80841EE4(this, play); - if (!Player_TryActionChangeList(play, this, sActionChangeList9, true)) { - if (!func_80833C04(this)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList9, true)) { + if (!Player_IsZTargetingWithHostileUpdate(this)) { func_8083C858(this, play); return; } @@ -8320,8 +8894,8 @@ void Player_Action_8084227C(Player* this, PlayState* play) { Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, SPEED_MODE_LINEAR, play); if (!func_8083C484(this, &sp2C, &sp2A)) { - if ((func_80833B2C(this) && (sp2C != 0.0f) && (func_8083FD78(this, &sp2C, &sp2A, play) <= 0)) || - (!func_80833B2C(this) && (func_8083FC68(this, sp2C, sp2A) <= 0))) { + if ((Player_FriendlyLockOnOrParallel(this) && (sp2C != 0.0f) && (func_8083FD78(this, &sp2C, &sp2A, play) <= 0)) || + (!Player_FriendlyLockOnOrParallel(this) && (func_8083FC68(this, sp2C, sp2A) <= 0))) { func_80839F90(this, play); return; } @@ -8343,8 +8917,8 @@ void Player_Action_808423EC(Player* this, PlayState* play) { sp34 = LinkAnimation_Update(play, &this->skelAnime); - if (!Player_TryActionChangeList(play, this, sActionChangeList5, true)) { - if (!func_80833C04(this)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList5, true)) { + if (!Player_IsZTargetingWithHostileUpdate(this)) { func_8083C858(this, play); return; } @@ -8352,7 +8926,7 @@ void Player_Action_808423EC(Player* this, PlayState* play) { Player_GetMovementSpeedAndYaw(this, &sp30, &sp2E, SPEED_MODE_LINEAR, play); if ((this->skelAnime.morphWeight == 0.0f) && (this->skelAnime.curFrame > 5.0f)) { - func_8083721C(this); + Player_DecelerateToZero(this); if ((this->skelAnime.curFrame > 10.0f) && (func_8083FC68(this, sp30, sp2E) < 0)) { func_8083CBF0(this, sp2E, play); @@ -8373,9 +8947,9 @@ void Player_Action_8084251C(Player* this, PlayState* play) { sp34 = LinkAnimation_Update(play, &this->skelAnime); - func_8083721C(this); + Player_DecelerateToZero(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList10, true)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList10, true)) { Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); if (this->linearVelocity == 0.0f) { @@ -8422,7 +8996,7 @@ void Player_Action_8084279C(Player* this, PlayState* play) { func_80832CB0(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check_wait, this->modelAnimType)); if (DECR(this->av2.actionVar2) == 0) { - if (!Player_ActionChange_13(this, play)) { + if (!Player_ActionHandler_13(this, play)) { func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_check_end, this->modelAnimType), play); } @@ -8449,7 +9023,7 @@ s32 func_808428D8(Player* this, PlayState* play) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_defense_kiru); this->av1.actionVar1 = 1; this->meleeWeaponAnimation = PLAYER_MWA_STAB_1H; - this->yaw = this->actor.shape.rot.y + this->unk_6BE; + this->yaw = this->actor.shape.rot.y + this->upperLimbRot.y; if (!CVarGetInteger(CVAR_ENHANCEMENT("CrouchStabHammerFix"), 0)) { return 1; @@ -8474,7 +9048,7 @@ s32 func_808428D8(Player* this, PlayState* play) { } s32 func_80842964(Player* this, PlayState* play) { - return Player_ActionChange_13(this, play) || Player_ActionChange_4(this, play) || Player_ActionChange_2(this, play); + return Player_ActionHandler_13(this, play) || Player_ActionHandler_Talk(this, play) || Player_ActionHandler_2(this, play); } void Player_RequestQuake(PlayState* play, s32 speed, s32 y, s32 countdown) { @@ -8551,7 +9125,7 @@ void func_80842D20(PlayState* play, Player* this) { func_80832440(play, this); Player_SetupAction(play, this, Player_Action_808505DC, 0); - if (func_8008E9C4(this)) { + if (Player_CheckHostileLockOn(this)) { sp28 = 2; } else { sp28 = 0; @@ -8645,7 +9219,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; } } @@ -8656,15 +9231,6 @@ s32 func_80842DF4(PlayState* play, Player* this) { } void Player_Action_80843188(Player* this, PlayState* play) { - f32 sp54; - f32 sp50; - s16 sp4E; - s16 sp4C; - s16 sp4A; - s16 sp48; - s16 sp46; - f32 sp40; - if (LinkAnimation_Update(play, &this->skelAnime)) { if (!Player_IsChildWithHylianShield(this)) { Player_AnimPlayLoop(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_defense_wait, this->modelAnimType)); @@ -8679,9 +9245,18 @@ void Player_Action_80843188(Player* this, PlayState* play) { this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; } - func_8083721C(this); + Player_DecelerateToZero(this); if (this->av2.actionVar2 != 0) { + f32 sp54; + f32 sp50; + s16 sp4E; + s16 sp4C; + s16 sp4A; + s16 sp48; + s16 sp46; + f32 sp40; + sp54 = sControlInput->rel.stick_y * 100 * (CVarGetInteger(CVAR_SETTING("Controls.InvertShieldAimingYAxis"), 1) ? 1 : -1); sp50 = sControlInput->rel.stick_x * (CVarGetInteger(CVAR_ENHANCEMENT("MirroredWorld"), 0) ? 120 : -120) * (CVarGetInteger(CVAR_SETTING("Controls.InvertShieldAimingYAxis"), 0) ? -1 : 1); sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(play)); @@ -8700,14 +9275,14 @@ void Player_Action_80843188(Player* this, PlayState* play) { sp48 = 100; } - sp46 = ABS(sp4A - this->unk_6BE) * 0.25f; + sp46 = ABS(sp4A - this->upperLimbRot.y) * 0.25f; if (sp46 < 50) { sp46 = 50; } Math_ScaledStepToS(&this->actor.focus.rot.x, sp4C, sp48); - this->unk_6BC = this->actor.focus.rot.x; - Math_ScaledStepToS(&this->unk_6BE, sp4A, sp46); + this->upperLimbRot.x = this->actor.focus.rot.x; + Math_ScaledStepToS(&this->upperLimbRot.y, sp4A, sp46); if (this->av1.actionVar1 != 0) { if (!func_80842DF4(play, this)) { @@ -8719,7 +9294,7 @@ void Player_Action_80843188(Player* this, PlayState* play) { this->av1.actionVar1 = 0; } } else if (!func_80842964(this, play)) { - if (Player_ActionChange_11(this, play)) { + if (Player_ActionHandler_11(this, play)) { func_808428D8(this, play); } else { this->stateFlags1 &= ~PLAYER_STATE1_SHIELDING; @@ -8730,7 +9305,7 @@ void Player_Action_80843188(Player* this, PlayState* play) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_clink_normal_defense_ALL, 1.0f, Animation_GetLastFrame(&gPlayerAnim_clink_normal_defense_ALL), 0.0f, ANIMMODE_ONCE, 0.0f); - Player_AnimReplaceApplyFlags(play, this, 4); + Player_StartAnimMovement(play, this, 4); } else { if (this->itemAction < 0) { func_8008EC70(this); @@ -8749,24 +9324,24 @@ void Player_Action_80843188(Player* this, PlayState* play) { this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); - this->unk_6AE |= 0xC1; + this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_UPPER_X | UNK6AE_ROT_UPPER_Y; } void Player_Action_808435C4(Player* this, PlayState* play) { - s32 temp; + s32 interruptResult; LinkAnimationHeader* anim; f32 frames; - func_8083721C(this); + Player_DecelerateToZero(this); if (this->av1.actionVar1 == 0) { - D_808535E0 = Player_UpdateUpperBody(this, play); - if ((func_80834B5C == this->upperActionFunc) || (func_808374A0(play, this, &this->upperSkelAnime, 4.0f) > 0)) { + sUpperBodyIsBusy = Player_UpdateUpperBody(this, play); + if ((func_80834B5C == this->upperActionFunc) || (Player_TryActionInterrupt(play, this, &this->upperSkelAnime, 4.0f) > 0)) { Player_SetupAction(play, this, Player_Action_80840450, 1); } } else { - temp = func_808374A0(play, this, &this->skelAnime, 4.0f); - if ((temp != 0) && ((temp > 0) || LinkAnimation_Update(play, &this->skelAnime))) { + interruptResult = Player_TryActionInterrupt(play, this, &this->skelAnime, 4.0f); + if ((interruptResult != 0) && ((interruptResult > 0) || LinkAnimation_Update(play, &this->skelAnime))) { Player_SetupAction(play, this, Player_Action_80843188, 1); this->stateFlags1 |= PLAYER_STATE1_SHIELDING; Player_SetModelsForHoldingShield(this); @@ -8778,12 +9353,12 @@ void Player_Action_808435C4(Player* this, PlayState* play) { } void Player_Action_8084370C(Player* this, PlayState* play) { - s32 sp1C; + s32 interruptResult; - func_8083721C(this); + Player_DecelerateToZero(this); - sp1C = func_808374A0(play, this, &this->skelAnime, 16.0f); - if ((sp1C != 0) && (LinkAnimation_Update(play, &this->skelAnime) || (sp1C > 0))) { + interruptResult = Player_TryActionInterrupt(play, this, &this->skelAnime, 16.0f); + if ((interruptResult != 0) && (LinkAnimation_Update(play, &this->skelAnime) || (interruptResult > 0))) { func_80839F90(this, play); } } @@ -8793,14 +9368,15 @@ void Player_Action_8084377C(Player* this, PlayState* play) { func_808382BC(this); - if (!(this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) && (this->av2.actionVar2 == 0) && (this->unk_8A1 != 0)) { - s16 temp = this->actor.shape.rot.y - this->unk_8A2; + if (!(this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) && (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->linearVelocity = this->unk_8A4; + this->yaw = this->actor.shape.rot.y = this->knockbackRot; + this->linearVelocity = 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) { @@ -8816,7 +9392,7 @@ void Player_Action_8084377C(Player* this, PlayState* play) { func_80853080(this, play); } } else if ((this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) || - (!(this->cylinder.base.acFlags & AC_HIT) && (this->unk_8A1 == 0))) { + (!(this->cylinder.base.acFlags & AC_HIT) && (this->knockbackType == 0))) { if (this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) { this->av2.actionVar2++; } else { @@ -8827,12 +9403,12 @@ void Player_Action_8084377C(Player* this, PlayState* play) { Player_AnimPlayOnce(play, this, (this->yaw != this->actor.shape.rot.y) ? &gPlayerAnim_link_normal_front_downB : &gPlayerAnim_link_normal_back_downB); - func_80832698(this, NA_SE_VO_LI_FREEZE); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_FREEZE); } } if (this->actor.bgCheckFlags & 2) { - func_80832770(this, NA_SE_PL_BOUND); + Player_PlayFloorSfx(this, NA_SE_PL_BOUND); } } @@ -8840,7 +9416,7 @@ void Player_Action_80843954(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; func_808382BC(this); - func_8083721C(this); + Player_DecelerateToZero(this); if (LinkAnimation_Update(play, &this->skelAnime) && (this->linearVelocity == 0.0f)) { if (this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) { @@ -8858,8 +9434,8 @@ void Player_Action_80843954(Player* this, PlayState* play) { } static AnimSfxEntry D_808545DC[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_8, 30) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 20) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 30) }, }; void Player_Action_80843A38(Player* this, PlayState* play) { @@ -8871,7 +9447,7 @@ void Player_Action_80843A38(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_IN_CUTSCENE) { LinkAnimation_Update(play, &this->skelAnime); } else { - sp24 = func_808374A0(play, this, &this->skelAnime, 16.0f); + sp24 = Player_TryActionInterrupt(play, this, &this->skelAnime, 16.0f); if ((sp24 != 0) && (LinkAnimation_Update(play, &this->skelAnime) || (sp24 > 0))) { func_80839F90(this, play); } @@ -8915,7 +9491,7 @@ void func_80843AE8(PlayState* play, Player* this) { func_80853080(this, play); } this->unk_A87 = 20; - func_80837AFC(this, -20); + Player_SetInvulnerability(this, -20); func_800F47FC(); } } else if (this->av1.actionVar1 != 0) { @@ -8932,10 +9508,10 @@ void func_80843AE8(PlayState* play, Player* this) { } static AnimSfxEntry D_808545F0[] = { - { NA_SE_PL_BOUND, ANIMSFX_DATA(ANIMSFX_TYPE_2, 60) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 140) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 164) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_8, 170) }, + { NA_SE_PL_BOUND, ANIMSFX_DATA(ANIMSFX_TYPE_FLOOR, 60) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 140) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 164) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 170) }, }; void Player_Action_80843CEC(Player* this, PlayState* play) { @@ -8947,7 +9523,7 @@ void Player_Action_80843CEC(Player* this, PlayState* play) { } } - func_8083721C(this); + Player_DecelerateToZero(this); if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->actor.category == ACTORCAT_PLAYER) { @@ -8960,13 +9536,13 @@ void Player_Action_80843CEC(Player* this, PlayState* play) { Player_ProcessAnimSfxList(this, D_808545F0); } else if (this->skelAnime.animation == &gPlayerAnim_link_normal_electric_shock_end) { if (LinkAnimation_OnFrame(&this->skelAnime, 88.0f)) { - func_80832770(this, NA_SE_PL_BOUND); + Player_PlayFloorSfx(this, NA_SE_PL_BOUND); } } } void func_80843E14(Player* this, u16 sfxId) { - func_80832698(this, sfxId); + Player_PlayVoiceSfx(this, sfxId); if ((this->heldActor != NULL) && (this->heldActor->id == ACTOR_EN_RU1)) { Audio_PlayActorSound2(this->heldActor, NA_SE_VO_RT_FALL); @@ -9008,11 +9584,11 @@ 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); Player_PlaySfx(this, NA_SE_PL_BODY_HIT); - func_80832698(this, impactInfo->sfxId); + Player_PlayVoiceSfx(this, impactInfo->sfxId); return impactIndex + 1; } @@ -9027,11 +9603,11 @@ s32 func_80843E64(PlayState* play, Player* this) { Player_RequestRumble(this, (u8)sp34, (u8)(sp34 * 0.1f), (u8)sp34, 0); if (sFloorType == 6) { - func_80832698(this, NA_SE_VO_LI_CLIMB_END); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_CLIMB_END); } } - func_808328A0(this); + Player_PlayLandingSfx(this); return 0; } @@ -9045,7 +9621,7 @@ void func_8084409C(PlayState* play, Player* this, f32 speedXZ, f32 velocityY) { heldActor->velocity.y = velocityY; func_80834644(play, this); Player_PlaySfx(this, NA_SE_PL_THROW); - func_80832698(this, NA_SE_VO_LI_SWORD_N); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_N); } } @@ -9055,14 +9631,14 @@ void Player_Action_8084411C(Player* this, PlayState* play) { if (gSaveContext.respawn[RESPAWN_MODE_TOP].data > 40) { this->actor.gravity = 0.0f; - } else if (func_8008E9C4(this)) { + } else if (Player_CheckHostileLockOn(this)) { this->actor.gravity = -1.2f; } Player_GetMovementSpeedAndYaw(this, &sp4C, &sp4A, SPEED_MODE_LINEAR, play); if (!(this->actor.bgCheckFlags & 1)) { - if (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { Actor* heldActor = this->heldActor; u16 buttonsToCheck = BTN_A | BTN_B | BTN_CLEFT | BTN_CRIGHT | BTN_CDOWN; @@ -9104,17 +9680,17 @@ void Player_Action_8084411C(Player* this, PlayState* play) { if (!GameInteractor_GetDisableLedgeGrabsActive() && (this->actor.bgCheckFlags & 0x200) && !(this->stateFlags2 & PLAYER_STATE2_HOPPING) && - !(this->stateFlags1 & (PLAYER_STATE1_ITEM_OVER_HEAD | PLAYER_STATE1_IN_WATER)) && (this->linearVelocity > 0.0f)) { - if ((this->yDistToLedge >= 150.0f) && (this->unk_84B[this->unk_846] == 0)) { + !(this->stateFlags1 & (PLAYER_STATE1_CARRYING_ACTOR | PLAYER_STATE1_IN_WATER)) && (this->linearVelocity > 0.0f)) { + if ((this->yDistToLedge >= 150.0f) && (this->controlStickDirections[this->controlStickDataIndex] == 0)) { func_8083EC18(this, play, sTouchedWallFlags); } else if ((this->ledgeClimbType >= 2) && (this->yDistToLedge < 150.0f) && (((this->actor.world.pos.y - this->actor.floorHeight) + this->yDistToLedge) > (70.0f * this->ageProperties->unk_08))) { AnimationContext_DisableQueue(play); if (this->stateFlags1 & PLAYER_STATE1_HOOKSHOT_FALLING) { - func_80832698(this, NA_SE_VO_LI_HOOKSHOT_HANG); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_HOOKSHOT_HANG); } else { - func_80832698(this, NA_SE_VO_LI_HANG); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_HANG); } this->actor.world.pos.y += this->yDistToLedge; func_8083A5C4(play, this, this->actor.wallPoly, this->distToInteractWall, @@ -9131,21 +9707,21 @@ void Player_Action_8084411C(Player* this, PlayState* play) { s32 sp3C; if (this->stateFlags2 & PLAYER_STATE2_HOPPING) { - if (func_8008E9C4(this)) { + if (Player_CheckHostileLockOn(this)) { anim = D_80853D4C[this->av1.actionVar1][2]; } else { anim = D_80853D4C[this->av1.actionVar1][1]; } } else if (this->skelAnime.animation == &gPlayerAnim_link_normal_run_jump) { anim = &gPlayerAnim_link_normal_run_jump_end; - } else if (func_8008E9C4(this)) { + } else if (Player_CheckHostileLockOn(this)) { anim = &gPlayerAnim_link_anchor_landingR; func_80833C3C(this); } else if (this->fallDistance <= 80) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_short_landing, this->modelAnimType); - } else if ((this->fallDistance < 800) && (this->unk_84B[this->unk_846] == 0) && - !(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { - func_8083BC04(this, play); + } else if ((this->fallDistance < 800) && (this->controlStickDirections[this->controlStickDataIndex] == 0) && + !(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) { + Player_SetupRoll(this, play); return; } @@ -9165,54 +9741,60 @@ void Player_Action_8084411C(Player* this, PlayState* play) { } } -static AnimSfxEntry D_8085460C[] = { - { NA_SE_VO_LI_SWORD_N, ANIMSFX_DATA(ANIMSFX_TYPE_4, 1) }, - { NA_SE_PL_WALK_GROUND, ANIMSFX_DATA(ANIMSFX_TYPE_3, 6) }, - { NA_SE_PL_ROLL, ANIMSFX_DATA(ANIMSFX_TYPE_1, 6) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_5, 18) }, +static AnimSfxEntry sRollAnimSfxList[] = { + { NA_SE_VO_LI_SWORD_N, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 1) }, + { NA_SE_PL_WALK_GROUND, ANIMSFX_DATA(ANIMSFX_TYPE_FLOOR_BY_AGE, 6) }, + { NA_SE_PL_ROLL, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 6) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_LANDING, 18) }, }; -void Player_Action_80844708(Player* this, PlayState* play) { - Actor* cylinderOc; - s32 temp; - s32 sp44; +void Player_Action_Roll(Player* this, PlayState* play) { + Actor* ocCollidedActor; + s32 interruptResult; + s32 animDone; DynaPolyActor* wallPolyActor; s32 pad; - f32 sp38; - s16 sp36; + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; - cylinderOc = NULL; - sp44 = LinkAnimation_Update(play, &this->skelAnime); + ocCollidedActor = NULL; + animDone = LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 8.0f)) { - func_80837AFC(this, -10); + Player_SetInvulnerability(this, -10); } - if (func_80842964(this, play) == 0) { - if (this->av2.actionVar2 != 0) { + if (!func_80842964(this, play)) { + if (this->av2.bonked) { Math_StepToF(&this->linearVelocity, 0.0f, 2.0f); - temp = func_808374A0(play, this, &this->skelAnime, 5.0f); - if ((temp != 0) && ((temp > 0) || sp44)) { + interruptResult = Player_TryActionInterrupt(play, this, &this->skelAnime, 5.0f); + if ((interruptResult != PLAYER_INTERRUPT_NEW_ACTION) && + ((interruptResult >= PLAYER_INTERRUPT_MOVE) || animDone)) { func_8083A060(this, play); } } else { - f32 rand = Rand_ZeroOne(); - uint8_t randomBonk = (rand <= .05) && GameInteractor_GetRandomBonksActive(); + // Must have a speed of 7 or above to be able to bonk into something if (this->linearVelocity >= 7.0f) { + bool randomBonk = GameInteractor_GetRandomBonksActive() && (Rand_ZeroOne() <= .05); if (randomBonk || ((this->actor.bgCheckFlags & 0x200) && (sWorldYawToTouchedWall < 0x2000)) || ((this->cylinder.base.ocFlags1 & OC1_HIT) && - (cylinderOc = this->cylinder.base.oc, - ((cylinderOc->id == ACTOR_EN_WOOD02) && - (ABS((s16)(this->actor.world.rot.y - cylinderOc->yawTowardsPlayer)) > 0x6000))))) { + (ocCollidedActor = this->cylinder.base.oc, + ((ocCollidedActor->id == ACTOR_EN_WOOD02) && + (ABS((s16)(this->actor.world.rot.y - ocCollidedActor->yawTowardsPlayer)) > 0x6000))))) { - if (cylinderOc != NULL) { - cylinderOc->home.rot.y = 1; + if (ocCollidedActor != NULL) { + // The EN_WOOD02 actor uses home y rotation as a flag to signal that it has been + // bonked into and should try to spawn a drop. + ocCollidedActor->home.rot.y = 1; } else if (this->actor.wallBgId != BGCHECK_SCENE) { wallPolyActor = DynaPoly_GetActor(&play->colCtx, this->actor.wallBgId); + if ((wallPolyActor != NULL) && (wallPolyActor->actor.id == ACTOR_OBJ_KIBAKO2)) { + // The OBJ_KIBAKO2 actor uses home z rotation as a flag to signal that it has been + // bonked into and should break. wallPolyActor->actor.home.rot.z = 1; } } @@ -9222,34 +9804,41 @@ void Player_Action_80844708(Player* this, PlayState* play) { Player_RequestQuake(play, 33267, 3, 12); Player_RequestRumble(this, 255, 20, 150, 0); Player_PlaySfx(this, NA_SE_PL_BODY_HIT); - func_80832698(this, NA_SE_VO_LI_CLIMB_END); - this->av2.actionVar2 = 1; + Player_PlayVoiceSfx(this, NA_SE_VO_LI_CLIMB_END); + this->av2.bonked = 1; + gSaveContext.sohStats.count[COUNT_BONKS]++; GameInteractor_ExecuteOnPlayerBonk(); + return; } } - if ((this->skelAnime.curFrame < 15.0f) || !Player_ActionChange_7(this, play)) { + if ((this->skelAnime.curFrame < 15.0f) || !Player_ActionHandler_7(this, play)) { if (this->skelAnime.curFrame >= 20.0f) { func_8083A060(this, play); + return; } - Player_GetMovementSpeedAndYaw(this, &sp38, &sp36, SPEED_MODE_CURVED, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_CURVED, play); - sp38 *= 1.5f; - if ((sp38 < 3.0f) || (this->unk_84B[this->unk_846] != 0)) { - sp38 = 3.0f; + // `speedTarget` at this point is the speed that would be used for regular walking. + // Rolling speed is 1.5 times faster than what the walking speed would be for the current control stick + // input. + speedTarget *= 1.5f; + + if ((speedTarget < 3.0f) || (this->controlStickDirections[this->controlStickDataIndex] != 0)) { + speedTarget = 3.0f; } - func_8083DF68(this, sp38, this->actor.shape.rot.y); + func_8083DF68(this, speedTarget, this->actor.shape.rot.y); if (func_8084269C(play, this)) { func_8002F8F0(&this->actor, NA_SE_PL_ROLL_DUST - SFX_FLAG); } - Player_ProcessAnimSfxList(this, D_8085460C); + Player_ProcessAnimSfxList(this, sRollAnimSfxList); } } } @@ -9266,13 +9855,13 @@ void Player_Action_80844A44(Player* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { 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); } } void Player_Action_80844AF4(Player* this, PlayState* play) { - f32 sp2C; - s16 sp2A; + f32 speedTarget; + s16 yawTarget; this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; @@ -9283,8 +9872,8 @@ void Player_Action_80844AF4(Player* this, PlayState* play) { func_8084285C(this, 6.0f, 7.0f, 99.0f); if (!(this->actor.bgCheckFlags & 1)) { - Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, SPEED_MODE_LINEAR, play); - func_8083DFE0(this, &sp2C, &this->yaw); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); + func_8083DFE0(this, &speedTarget, &this->yaw); return; } @@ -9292,7 +9881,7 @@ void Player_Action_80844AF4(Player* this, PlayState* play) { this->meleeWeaponAnimation += 2; func_80837948(play, this, this->meleeWeaponAnimation); this->unk_845 = 3; - func_808328A0(this); + Player_PlayLandingSfx(this); } } } @@ -9304,17 +9893,17 @@ s32 func_80844BE4(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_SPIN_ATTACKING; } else { if (!CHECK_BTN_ALL(sControlInput->cur.button, BTN_B)) { - if ((this->unk_858 >= 0.85f) || func_808375D8(this)) { + if ((this->unk_858 >= 0.85f) || Player_CanSpinAttack(this)) { temp = D_80854384[Player_HoldsTwoHandedWeapon(this)]; } else { temp = D_80854380[Player_HoldsTwoHandedWeapon(this)]; } func_80837948(play, this, temp); - func_80837AFC(this, -8); + Player_SetInvulnerability(this, -8); this->stateFlags2 |= PLAYER_STATE2_SPIN_ATTACKING; - if (this->unk_84B[this->unk_846] == 0) { + if (this->controlStickDirections[this->controlStickDataIndex] == 0) { this->stateFlags2 |= PLAYER_STATE2_SWORD_LUNGE; } } else { @@ -9352,21 +9941,21 @@ void func_80844E3C(Player* this) { } void Player_Action_80844E68(Player* this, PlayState* play) { - f32 sp34; - s16 sp32; + f32 speedTarget; + s16 yawTarget; s32 temp; this->stateFlags1 |= PLAYER_STATE1_CHARGING_SPIN_ATTACK; if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832DBC(this); - func_808355DC(this); - this->stateFlags1 &= ~PLAYER_STATE1_TARGET_NOTHING; + Player_FinishAnimMovement(this); + Player_SetParallel(this); + this->stateFlags1 &= ~PLAYER_STATE1_PARALLEL; Player_AnimPlayLoop(play, this, D_80854360[Player_HoldsTwoHandedWeapon(this)]); this->av2.actionVar2 = -1; } - func_8083721C(this); + Player_DecelerateToZero(this); if (!func_80842964(this, play) && (this->av2.actionVar2 != 0)) { func_80844E3C(this); @@ -9379,9 +9968,9 @@ void Player_Action_80844E68(Player* this, PlayState* play) { func_80844D68(this, play); } } else if (!func_80844BE4(this, play)) { - Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_LINEAR, play); + Player_GetMovementSpeedAndYaw(this, &speedTarget, &yawTarget, SPEED_MODE_LINEAR, play); - temp = func_80840058(this, &sp34, &sp32, play); + temp = func_80840058(this, &speedTarget, &yawTarget, play); if (temp > 0) { func_80844CF8(this, play); } else if (temp < 0) { @@ -9561,7 +10150,7 @@ void Player_Action_80845668(Player* this, PlayState* play) { return; } } else { - temp2 = func_808374A0(play, this, &this->skelAnime, 4.0f); + temp2 = Player_TryActionInterrupt(play, this, &this->skelAnime, 4.0f); if (temp2 == 0) { this->stateFlags1 &= ~(PLAYER_STATE1_CLIMBING_LEDGE | PLAYER_STATE1_JUMPING); @@ -9588,13 +10177,13 @@ void Player_Action_80845668(Player* this, PlayState* play) { } if (LinkAnimation_OnFrame(&this->skelAnime, temp3)) { - func_808328A0(this); - func_80832698(this, NA_SE_VO_LI_CLIMB_END); + Player_PlayLandingSfx(this); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_CLIMB_END); } if ((this->skelAnime.animation == &gPlayerAnim_link_normal_100step_up) || (this->skelAnime.curFrame > 5.0f)) { if (this->av2.actionVar2 == 0) { - func_80832854(this); + Player_PlayJumpingSfx(this); this->av2.actionVar2 = 1; } Math_StepToF(&this->actor.shape.yOffset, 0.0f, 150.0f); @@ -9602,34 +10191,51 @@ void Player_Action_80845668(Player* this, PlayState* play) { } } -void Player_Action_808458D0(Player* this, PlayState* play) { +/** + * Allow the held item put away process to complete before running `afterPutAwayFunc` + */ +void Player_Action_WaitForPutAway(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; LinkAnimation_Update(play, &this->skelAnime); - if (((this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (this->heldActor != NULL) && (this->getItemId == GI_NONE)) || + // Wait for the held item put away process to complete. + // Determining if the put away process is complete is a bit complicated: + // `Player_UpdateUpperBody` will only return false if the current UpperAction returns false. + // The UpperAction responsible for putting away items, `Player_UpperAction_ChangeHeldItem`, constantly + // returns true until the item change is done. False won't be returned until the item change is done, and a new + // UpperAction is running and can return false itself. + // Note that this implementation allows for delaying indefinitely by, for example, holding shield + // during the item put away. The shield UpperAction will return true while shielding and targeting. + // Meaning, `afterPutAwayFunc` will be delayed until the player decides to let go of shield. + // This quirk can contribute to the possibility of other bugs manifesting. + // + // The other conditions listed will force the put away delay function to run instantly if carrying an actor. + // This is necessary because the UpperAction for carrying actors will always return true while holding + // the actor, so `!Player_UpdateUpperBody` could never pass. + if (((this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (this->heldActor != NULL) && (this->getItemId == GI_NONE)) || !Player_UpdateUpperBody(this, play)) { - this->func_A74(play, this); + this->afterPutAwayFunc(play, this); } } -s32 func_80845964(PlayState* play, Player* this, CsCmdActorAction* arg2, f32 arg3, s16 arg4, s32 arg5) { +s32 func_80845964(PlayState* play, Player* this, CsCmdActorCue* cue, f32 arg3, s16 arg4, s32 arg5) { if ((arg5 != 0) && (this->linearVelocity == 0.0f)) { return LinkAnimation_Update(play, &this->skelAnime); } if (arg5 != 2) { f32 sp34 = R_UPDATE_RATE * 0.5f; - f32 selfDistX = arg2->endPos.x - this->actor.world.pos.x; - f32 selfDistZ = arg2->endPos.z - this->actor.world.pos.z; + f32 selfDistX = cue->endPos.x - this->actor.world.pos.x; + f32 selfDistZ = cue->endPos.z - this->actor.world.pos.z; f32 sp28 = sqrtf(SQ(selfDistX) + SQ(selfDistZ)) / sp34; - s32 sp24 = (arg2->endFrame - play->csCtx.frames) + 1; + s32 sp24 = (cue->endFrame - play->csCtx.frames) + 1; arg4 = Math_Atan2S(selfDistZ, selfDistX); if (arg5 == 1) { - f32 distX = arg2->endPos.x - arg2->startPos.x; - f32 distZ = arg2->endPos.z - arg2->startPos.z; - s32 temp = (((sqrtf(SQ(distX) + SQ(distZ)) / sp34) / (arg2->endFrame - arg2->startFrame)) / 1.5f) * 4.0f; + f32 distX = cue->endPos.x - cue->startPos.x; + f32 distZ = cue->endPos.z - cue->startPos.z; + s32 temp = (((sqrtf(SQ(distX) + SQ(distZ)) / sp34) / (cue->endFrame - cue->startFrame)) / 1.5f) * 4.0f; if (temp >= sp24) { arg4 = this->actor.shape.rot.y; @@ -9686,7 +10292,7 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { s32 sp30; s32 pad; - if (!Player_ActionChange_13(this, play)) { + if (!Player_ActionHandler_13(this, play)) { if (this->av2.actionVar2 == 0) { LinkAnimation_Update(play, &this->skelAnime); @@ -9695,7 +10301,7 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { this->av2.actionVar2 = 1; } } else if (this->av1.actionVar1 == 0) { - sp3C = 5.0f * D_808535E8; + sp3C = 5.0f * sWaterSpeedFactor; if (func_80845BA0(play, this, &sp3C, -1) < 30) { this->av1.actionVar1 = 1; @@ -9730,14 +10336,14 @@ void Player_Action_80845CA4(Player* this, PlayState* play) { func_8005B1A4(Play_GetCamera(play, 0)); func_80845C68(play, gSaveContext.respawn[RESPAWN_MODE_DOWN].data); - if (!Player_ActionChange_4(this, play)) { + if (!Player_ActionHandler_Talk(this, play)) { func_8083CF5C(this, play); } } } } - if (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { Player_UpdateUpperBody(this, play); } } @@ -9773,7 +10379,7 @@ void Player_Action_80845EF8(Player* this, PlayState* play) { } void Player_Action_80846050(Player* this, PlayState* play) { - func_8083721C(this); + Player_DecelerateToZero(this); if (LinkAnimation_Update(play, &this->skelAnime)) { func_80839F90(this, play); @@ -9798,13 +10404,13 @@ void Player_Action_80846050(Player* this, PlayState* play) { } static AnimSfxEntry D_8085461C[] = { - { NA_SE_VO_LI_SWORD_L, ANIMSFX_DATA(ANIMSFX_TYPE_4, 49) }, - { NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 230) }, + { NA_SE_VO_LI_SWORD_L, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 49) }, + { NA_SE_VO_LI_SWORD_N, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 230) }, }; void Player_Action_80846120(Player* this, PlayState* play) { if (LinkAnimation_Update(play, &this->skelAnime) && (this->av2.actionVar2++ > 20)) { - if (!Player_ActionChange_13(this, play)) { + if (!Player_ActionHandler_13(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_heavy_carry_end, play); } return; @@ -9837,7 +10443,7 @@ void Player_Action_80846120(Player* this, PlayState* play) { } void Player_Action_80846260(Player* this, PlayState* play) { - func_8083721C(this); + Player_DecelerateToZero(this); if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_silver_wait); @@ -9860,7 +10466,7 @@ void Player_Action_80846260(Player* this, PlayState* play) { } if (LinkAnimation_OnFrame(&this->skelAnime, 25.0f)) { - func_80832698(this, NA_SE_VO_LI_SWORD_L); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_L); return; } @@ -9884,7 +10490,7 @@ void Player_Action_80846358(Player* this, PlayState* play) { heldActor->velocity.y = 20.0f; func_80834644(play, this); Player_PlaySfx(this, NA_SE_PL_THROW); - func_80832698(this, NA_SE_VO_LI_SWORD_N); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_N); } } @@ -9899,14 +10505,14 @@ void Player_Action_80846408(Player* this, PlayState* play) { this->av2.actionVar2--; if (this->av2.actionVar2 == 0) { func_8083A098(this, &gPlayerAnim_link_normal_nocarry_free_end, play); - this->stateFlags1 &= ~PLAYER_STATE1_ITEM_OVER_HEAD; - func_80832698(this, NA_SE_VO_LI_DAMAGE_S); + this->stateFlags1 &= ~PLAYER_STATE1_CARRYING_ACTOR; + Player_PlayVoiceSfx(this, NA_SE_VO_LI_DAMAGE_S); } } } void Player_Action_808464B0(Player* this, PlayState* play) { - func_8083721C(this); + Player_DecelerateToZero(this); if (LinkAnimation_Update(play, &this->skelAnime)) { func_80839F90(this, play); @@ -9931,7 +10537,7 @@ void Player_Action_80846578(Player* this, PlayState* play) { f32 sp34; s16 sp32; - func_8083721C(this); + Player_DecelerateToZero(this); if (LinkAnimation_Update(play, &this->skelAnime) || ((this->skelAnime.curFrame >= 8.0f) && Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_CURVED, play))) { @@ -10052,7 +10658,7 @@ void func_808467D4(PlayState* play, Player* this) { this->yaw = this->actor.shape.rot.y = -0x8000; LinkAnimation_Change(play, &this->skelAnime, this->ageProperties->unk_A0, 2.0f / 3.0f, 0.0f, 0.0f, ANIMMODE_ONCE, 0.0f); - Player_AnimReplaceApplyFlags(play, this, 0x28F); + Player_StartAnimMovement(play, this, 0x28F); if (LINK_IS_ADULT) { func_80846720(play, this, 0); } @@ -10061,7 +10667,7 @@ void func_808467D4(PlayState* play, Player* this) { void func_808468A8(PlayState* play, Player* this) { Player_SetupAction(play, this, Player_Action_8084F9A0, 0); - Player_AnimReplaceApplyFlags(play, this, 0x9B); + Player_StartAnimMovement(play, this, 0x9B); } void func_808468E8(PlayState* play, Player* this) { @@ -10073,7 +10679,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) { @@ -10082,10 +10688,10 @@ void func_808469BC(PlayState* play, Player* this) { this->stateFlags1 |= PLAYER_STATE1_IN_CUTSCENE; } -static s16 D_80854700[] = { ACTOR_MAGIC_WIND, ACTOR_MAGIC_DARK, ACTOR_MAGIC_FIRE }; +Actor* Player_SpawnMagicSpell(PlayState* play, Player* this, s32 spell) { + static s16 sMagicSpellActorIds[] = { ACTOR_MAGIC_WIND, ACTOR_MAGIC_DARK, ACTOR_MAGIC_FIRE }; -Actor* func_80846A00(PlayState* play, Player* this, s32 arg2) { - return Actor_Spawn(&play->actorCtx, play, D_80854700[arg2], this->actor.world.pos.x, + return Actor_Spawn(&play->actorCtx, play, sMagicSpellActorIds[spell], this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0, true); } @@ -10104,7 +10710,7 @@ static EffectBlureInit2 blureSword = { 0, 2, 0, { 255, 255, 255, 255 }, { 255, 255, 255, 64 }, 1, }; -static Vec3s D_80854730 = { -57, 3377, 0 }; +static Vec3s sSkeletonBaseTransl = { -57, 3377, 0 }; void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHeader) { this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; @@ -10116,10 +10722,10 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe SkelAnime_InitLink(play, &this->skelAnime, skelHeader, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_wait, this->modelAnimType), 9, this->jointTable, this->morphTable, PLAYER_LIMB_MAX); - this->skelAnime.baseTransl = D_80854730; - SkelAnime_InitLink(play, &this->upperSkelAnime, skelHeader, func_80833338(this), 9, this->upperJointTable, + this->skelAnime.baseTransl = sSkeletonBaseTransl; + SkelAnime_InitLink(play, &this->upperSkelAnime, skelHeader, Player_GetIdleAnim(this), 9, this->upperJointTable, this->upperMorphTable, PLAYER_LIMB_MAX); - this->upperSkelAnime.baseTransl = D_80854730; + this->upperSkelAnime.baseTransl = sSkeletonBaseTransl; Effect_Add(play, &this->meleeWeaponEffectIndex, EFFECT_BLURE2, 0, 0, &blureSword); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, this->ageProperties->unk_04); @@ -10137,9 +10743,22 @@ void Player_InitCommon(Player* this, PlayState* play, FlexSkeletonHeader* skelHe } static void (*D_80854738[])(PlayState* play, Player* this) = { - func_80846648, func_808467D4, func_80846660, func_808468A8, func_808468E8, func_808469BC, - func_80846A68, func_80846978, func_8083CA54, func_8083CA54, func_8083CA54, func_8083CA54, - func_8083CA54, func_8083CA20, func_8083CA54, func_8083CA9C, + /* 0x0 */ func_80846648, + /* 0x1 */ func_808467D4, // From time travel + /* 0x2 */ func_80846660, + /* 0x3 */ func_808468A8, + /* 0x4 */ func_808468E8, + /* 0x5 */ func_808469BC, + /* 0x6 */ func_80846A68, + /* 0x7 */ func_80846978, + /* 0x8 */ func_8083CA54, + /* 0x9 */ func_8083CA54, + /* 0xA */ func_8083CA54, + /* 0xB */ func_8083CA54, + /* 0xC */ func_8083CA54, + /* 0xD */ func_8083CA20, + /* 0xE */ func_8083CA54, + /* 0xF */ func_8083CA9C, }; static Vec3f D_80854778 = { 0.0f, 50.0f, 0.0f }; @@ -10150,8 +10769,8 @@ void Player_Init(Actor* thisx, PlayState* play2) { SceneTableEntry* scene = play->loadedScene; u32 titleFileSize; s32 initMode; - s32 sp50; - s32 sp4C; + s32 respawnFlag; + s32 respawnMode; // In ER, once Link has spawned we know the scene has loaded, so we can sanitize the last known entrance type if (IS_RANDO && Randomizer_GetSettingValue(RSK_SHUFFLE_ENTRANCES)) { @@ -10186,36 +10805,39 @@ void Player_Init(Actor* thisx, PlayState* play2) { this->currentMask = gSaveContext.maskMemory; } Player_InitCommon(this, play, gPlayerSkelHeaders[((void)0, gSaveContext.linkAge)]); + // `giObjectSegment` is used for both "get item" objects and title cards. The maximum size for + // get item objects is 0x2000 (see the assert in func_8083AE40), and the maximum size for + // title cards is 0x1000 * LANGUAGE_MAX since each title card image includes all languages. this->giObjectSegment = (void*)(((uintptr_t)ZELDA_ARENA_MALLOC_DEBUG(0x3008) + 8) & ~0xF); - sp50 = gSaveContext.respawnFlag; + respawnFlag = gSaveContext.respawnFlag; - if (sp50 != 0) { - if (sp50 == -3) { + if (respawnFlag != 0) { + if (respawnFlag == -3) { thisx->params = gSaveContext.respawn[RESPAWN_MODE_RETURN].playerParams; } else { - if ((sp50 == 1) || (sp50 == -1)) { + if ((respawnFlag == 1) || (respawnFlag == -1)) { this->unk_A86 = -2; } - if (sp50 < 0) { - sp4C = 0; + if (respawnFlag < 0) { + respawnMode = 0; } else { - sp4C = sp50 - 1; - Math_Vec3f_Copy(&thisx->world.pos, &gSaveContext.respawn[sp50 - 1].pos); + respawnMode = respawnFlag - 1; + Math_Vec3f_Copy(&thisx->world.pos, &gSaveContext.respawn[respawnFlag - 1].pos); Math_Vec3f_Copy(&thisx->home.pos, &thisx->world.pos); Math_Vec3f_Copy(&thisx->prevPos, &thisx->world.pos); this->fallStartHeight = thisx->world.pos.y; - this->yaw = thisx->shape.rot.y = gSaveContext.respawn[sp4C].yaw; - thisx->params = gSaveContext.respawn[sp4C].playerParams; + this->yaw = thisx->shape.rot.y = gSaveContext.respawn[respawnMode].yaw; + thisx->params = gSaveContext.respawn[respawnMode].playerParams; } - play->actorCtx.flags.tempSwch = gSaveContext.respawn[sp4C].tempSwchFlags & 0xFFFFFF; - play->actorCtx.flags.tempCollect = gSaveContext.respawn[sp4C].tempCollectFlags; + play->actorCtx.flags.tempSwch = gSaveContext.respawn[respawnMode].tempSwchFlags & 0xFFFFFF; + play->actorCtx.flags.tempCollect = gSaveContext.respawn[respawnMode].tempCollectFlags; } } - if ((sp50 == 0) || (sp50 < -1)) { + if ((respawnFlag == 0) || (respawnFlag < -1)) { titleFileSize = scene->titleFile.vromEnd - scene->titleFile.vromStart; if (GameInteractor_Should(VB_SHOW_TITLE_CARD, gSaveContext.showTitleCard)) { if ((gSaveContext.sceneSetupIndex < 4) && @@ -10230,7 +10852,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { gSaveContext.showTitleCard = true; } - if (func_80845C68(play, (sp50 == 2) ? 1 : 0) == 0) { + if (func_80845C68(play, (respawnFlag == 2) ? 1 : 0) == 0) { gSaveContext.respawn[RESPAWN_MODE_DOWN].playerParams = (thisx->params & 0xFF) | 0xD00; } @@ -10260,7 +10882,7 @@ void Player_Init(Actor* thisx, PlayState* play2) { if (gSaveContext.nayrusLoveTimer != 0) { gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1; - func_80846A00(play, this, 1); + Player_SpawnMagicSpell(play, this, 1); this->stateFlags3 &= ~PLAYER_STATE3_RESTORE_NAYRUS_LOVE; } @@ -10273,74 +10895,75 @@ void Player_Init(Actor* thisx, PlayState* play2) { MREG(64) = 0; } -void func_808471F4(s16* pValue) { +void Player_ApproachZeroBinang(s16* pValue) { s16 step; - step = (ABS(*pValue) * 100.0f) / 1000.0f; + step = ABS(*pValue) * 100.0f / 1000.0f; step = CLAMP(step, 400, 4000); Math_ScaledStepToS(pValue, 0, step); } void func_80847298(Player* this) { - s16 sp26; + if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_FOCUS_Y)) { + s16 diff = this->actor.focus.rot.y - this->actor.shape.rot.y; - if (!(this->unk_6AE & 2)) { - sp26 = this->actor.focus.rot.y - this->actor.shape.rot.y; - func_808471F4(&sp26); - this->actor.focus.rot.y = this->actor.shape.rot.y + sp26; + Player_ApproachZeroBinang(&diff); + this->actor.focus.rot.y = this->actor.shape.rot.y + diff; } - if (!(this->unk_6AE & 1)) { - func_808471F4(&this->actor.focus.rot.x); + if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_FOCUS_X)) { + Player_ApproachZeroBinang(&this->actor.focus.rot.x); } - if (!(this->unk_6AE & 8)) { - func_808471F4(&this->unk_6B6); + if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_HEAD_X)) { + Player_ApproachZeroBinang(&this->headLimbRot.x); } - if (!(this->unk_6AE & 0x40)) { - func_808471F4(&this->unk_6BC); + if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_UPPER_X)) { + Player_ApproachZeroBinang(&this->upperLimbRot.x); } - if (!(this->unk_6AE & 4)) { - func_808471F4(&this->actor.focus.rot.z); + if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_FOCUS_Z)) { + Player_ApproachZeroBinang(&this->actor.focus.rot.z); } - if (!(this->unk_6AE & 0x10)) { - func_808471F4(&this->unk_6B8); + if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_HEAD_Y)) { + Player_ApproachZeroBinang(&this->headLimbRot.y); } - if (!(this->unk_6AE & 0x20)) { - func_808471F4(&this->unk_6BA); + if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_HEAD_Z)) { + Player_ApproachZeroBinang(&this->headLimbRot.z); } - if (!(this->unk_6AE & 0x80)) { - if (this->unk_6B0 != 0) { - func_808471F4(&this->unk_6B0); + if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_UPPER_Y)) { + if (this->upperLimbYawSecondary != 0) { + Player_ApproachZeroBinang(&this->upperLimbYawSecondary); } else { - func_808471F4(&this->unk_6BE); + Player_ApproachZeroBinang(&this->upperLimbRot.y); } } - if (!(this->unk_6AE & 0x100)) { - func_808471F4(&this->unk_6C0); + if (!(this->unk_6AE_rotFlags & UNK6AE_ROT_UPPER_Z)) { + Player_ApproachZeroBinang(&this->upperLimbRot.z); } - this->unk_6AE = 0; + this->unk_6AE_rotFlags = 0; } static f32 D_80854784[] = { 120.0f, 240.0f, 360.0f }; -static u8 sDiveDoActions[] = { DO_ACTION_1, DO_ACTION_2, DO_ACTION_3, DO_ACTION_4, - DO_ACTION_5, DO_ACTION_6, DO_ACTION_7, DO_ACTION_8 }; - -void func_808473D4(PlayState* play, Player* this) { +/** + * Updates the two main interface elements that player is responsible for: + * - Do Action label on the A button + * - Navi C-up icon for hints + */ +void Player_UpdateInterface(PlayState* play, Player* this) { if ((Message_GetState(&play->msgCtx) == TEXT_STATE_NONE) && (this->actor.category == ACTORCAT_PLAYER)) { Actor* heldActor = this->heldActor; Actor* interactRangeActor = this->interactRangeActor; s32 sp24; - s32 sp20 = this->unk_84B[this->unk_846]; + s32 controlStickDirection = this->controlStickDirections[this->controlStickDataIndex]; s32 sp1C = func_808332B8(this); s32 doAction = DO_ACTION_NONE; @@ -10353,10 +10976,10 @@ void func_808473D4(PlayState* play, Player* this) { } } else if ((Player_Action_8084E3C4 != this->actionFunc) && !(this->stateFlags2 & PLAYER_STATE2_CRAWLING)) { if ((this->doorType != PLAYER_DOORTYPE_NONE) && - (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) || + (!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) || ((heldActor != NULL) && (heldActor->id == ACTOR_EN_RU1)))) { doAction = DO_ACTION_OPEN; - } else if ((!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) || (heldActor == NULL)) && + } else if ((!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) || (heldActor == NULL)) && (interactRangeActor != NULL) && ((!sp1C && (this->getItemId == GI_NONE)) || (this->getItemId < 0 && !(this->stateFlags1 & PLAYER_STATE1_IN_WATER)))) { @@ -10374,8 +10997,8 @@ void func_808473D4(PlayState* play, Player* this) { doAction = DO_ACTION_CLIMB; } else if ((this->stateFlags1 & PLAYER_STATE1_ON_HORSE) && !EN_HORSE_CHECK_4((EnHorse*)this->rideActor) && (Player_Action_8084D3E4 != this->actionFunc)) { - if ((this->stateFlags2 & PLAYER_STATE2_SPEAK_OR_CHECK) && (this->targetActor != NULL)) { - if (this->targetActor->category == ACTORCAT_NPC) { + if ((this->stateFlags2 & PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER) && (this->talkActor != NULL)) { + if (this->talkActor->category == ACTORCAT_NPC) { doAction = DO_ACTION_SPEAK; } else { doAction = DO_ACTION_CHECK; @@ -10383,8 +11006,8 @@ void func_808473D4(PlayState* play, Player* this) { } else if (!func_8002DD78(this) && !(this->stateFlags1 & PLAYER_STATE1_FIRST_PERSON)) { doAction = DO_ACTION_FASTER; } - } else if ((this->stateFlags2 & PLAYER_STATE2_SPEAK_OR_CHECK) && (this->targetActor != NULL)) { - if (this->targetActor->category == ACTORCAT_NPC) { + } else if ((this->stateFlags2 & PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER) && (this->talkActor != NULL)) { + if (this->talkActor->category == ACTORCAT_NPC) { doAction = DO_ACTION_SPEAK; } else { doAction = DO_ACTION_CHECK; @@ -10394,7 +11017,7 @@ void func_808473D4(PlayState* play, Player* this) { doAction = DO_ACTION_DOWN; } else if (this->stateFlags2 & PLAYER_STATE2_DO_ACTION_ENTER) { doAction = DO_ACTION_ENTER; - } else if ((this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) && (this->getItemId == GI_NONE) && + } else if ((this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) && (this->getItemId == GI_NONE) && (heldActor != NULL)) { if ((this->actor.bgCheckFlags & 1) || (heldActor->id == ACTOR_EN_NIW)) { if (func_8083EAF0(this, heldActor) == 0) { @@ -10407,24 +11030,29 @@ void func_808473D4(PlayState* play, Player* this) { (this->getItemId < GI_MAX)) { doAction = DO_ACTION_GRAB; } else if (this->stateFlags2 & PLAYER_STATE2_DIVING) { + static u8 sDiveNumberDoActions[] = { DO_ACTION_1, DO_ACTION_2, DO_ACTION_3, DO_ACTION_4, + DO_ACTION_5, DO_ACTION_6, DO_ACTION_7, DO_ACTION_8 }; + sp24 = (D_80854784[CUR_UPG_VALUE(UPG_SCALE)] - this->actor.yDistToWater) / 40.0f; sp24 = CLAMP(sp24, 0, 7); - doAction = sDiveDoActions[sp24]; + doAction = sDiveNumberDoActions[sp24]; } else if (sp1C && !(this->stateFlags2 & PLAYER_STATE2_UNDERWATER)) { doAction = DO_ACTION_DIVE; - } else if (!sp1C && (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) || func_80833BCC(this) || + } else if (!sp1C && (!(this->stateFlags1 & PLAYER_STATE1_SHIELDING) || Player_IsZTargeting(this) || !Player_IsChildWithHylianShield(this))) { - if ((!(this->stateFlags1 & PLAYER_STATE1_CLIMBING_LEDGE) && (sp20 <= 0) && - (func_8008E9C4(this) || - ((sFloorType != 7) && (func_80833B2C(this) || + if ((!(this->stateFlags1 & PLAYER_STATE1_CLIMBING_LEDGE) && + (controlStickDirection <= PLAYER_STICK_DIR_FORWARD) && + (Player_CheckHostileLockOn(this) || + ((sFloorType != 7) && (Player_FriendlyLockOnOrParallel(this) || ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && - !(this->stateFlags1 & PLAYER_STATE1_SHIELDING) && (sp20 == 0))))))) { + !(this->stateFlags1 & PLAYER_STATE1_SHIELDING) && + (controlStickDirection == PLAYER_STICK_DIR_FORWARD))))))) { doAction = DO_ACTION_ATTACK; } else if ((play->roomCtx.curRoom.behaviorType1 != ROOM_BEHAVIOR_TYPE1_2) && - func_80833BCC(this) && (sp20 > 0)) { + Player_IsZTargeting(this) && (controlStickDirection >= PLAYER_STICK_DIR_LEFT)) { doAction = DO_ACTION_JUMP; } else if ((this->heldItemAction >= PLAYER_IA_SWORD_MASTER) || - ((this->stateFlags2 & PLAYER_STATE2_NAVI_OUT) && + ((this->stateFlags2 & PLAYER_STATE2_NAVI_ACTIVE) && (play->actorCtx.targetCtx.arrowPointedActor == NULL))) { doAction = DO_ACTION_PUTAWAY; } @@ -10433,20 +11061,22 @@ void func_808473D4(PlayState* play, Player* this) { } if (doAction != DO_ACTION_PUTAWAY) { - this->unk_837 = 20; - } else if (this->unk_837 != 0) { + this->putAwayCooldownTimer = 20; + } else if (this->putAwayCooldownTimer != 0) { if (CVarGetInteger(CVAR_ENHANCEMENT("InstantPutaway"), 0) != 0) { - this->unk_837 = 0; + this->putAwayCooldownTimer = 0; } else { + // Replace the "Put Away" Do Action label with a blank label while + // the cooldown timer is counting down doAction = DO_ACTION_NONE; - this->unk_837--; + this->putAwayCooldownTimer--; } } Interface_SetDoAction(play, doAction); if (this->stateFlags2 & PLAYER_STATE2_NAVI_ALERT) { - if (this->unk_664 != NULL) { + if (this->focusActor != NULL) { Interface_SetNaviCall(play, 0x1E); } else { Interface_SetNaviCall(play, 0x1D); @@ -10469,7 +11099,7 @@ void func_808473D4(PlayState* play, Player* this) { * @return true if not on the ground, false otherwise. Note this is independent of the Hover Boots state. */ s32 Player_UpdateHoverBoots(Player* this) { - s32 cond; + s32 canHoverOnGround; if ((this->currentBoots == PLAYER_BOOTS_HOVER || (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0) && this->ivanFloating)) && @@ -10479,29 +11109,29 @@ s32 Player_UpdateHoverBoots(Player* this) { this->hoverBootsTimer = 0; } - cond = (this->currentBoots == PLAYER_BOOTS_HOVER || - (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0) && this->ivanFloating)) && - ((this->actor.yDistToWater >= 0.0f) || (func_80838144(sFloorType) >= 0) || func_8083816C(sFloorType)); + canHoverOnGround = + (this->currentBoots == PLAYER_BOOTS_HOVER || (CVarGetInteger(CVAR_ENHANCEMENT("IvanCoopModeEnabled"), 0) && this->ivanFloating)) && + ((this->actor.yDistToWater >= 0.0f) || (func_80838144(sFloorType) >= 0) || func_8083816C(sFloorType)); - if (cond && (this->actor.bgCheckFlags & 1) && (this->hoverBootsTimer != 0)) { + if (canHoverOnGround && (this->actor.bgCheckFlags & 1) && (this->hoverBootsTimer != 0)) { this->actor.bgCheckFlags &= ~1; } if (this->actor.bgCheckFlags & 1) { - if (!cond) { + if (!canHoverOnGround) { this->hoverBootsTimer = 19; } - return 0; + return false; + } else { + sFloorType = 0; + this->floorPitch = this->floorPitchAlt = sFloorShapePitch = 0; + + return true; } - - sFloorType = 0; - this->floorPitch = this->floorPitchAlt = sFloorShapePitch = 0; - - return 1; } /** - * Peforms various tasks related to scene collision. + * Performs various tasks related to scene collision. * * This includes: * - Update BgCheckInfo, parameters adjusted due to various state flags @@ -10516,23 +11146,26 @@ s32 Player_UpdateHoverBoots(Player* this) { */ void Player_ProcessSceneCollision(PlayState* play, Player* this) { static Vec3f sInteractWallCheckOffset = { 0.0f, 18.0f, 0.0f }; - u8 nextLedgeClimbType = 0; + u8 nextLedgeClimbType = PLAYER_LEDGE_CLIMB_NONE; CollisionPoly* floorPoly; Vec3f unusedWorldPos; - f32 spB0; - f32 spAC; + f32 float0; // multi-purpose variable, see define names (fake match?) + f32 float1; // multi-purpose variable, see define names (fake match?) f32 ceilingCheckHeight; u32 flags; sPrevFloorProperty = this->floorProperty; +#define vWallCheckRadius float0 +#define vWallCheckHeight float1 + if (this->stateFlags2 & PLAYER_STATE2_CRAWLING) { - spB0 = 10.0f; - spAC = 15.0f; + vWallCheckRadius = 10.0f; + vWallCheckHeight = 15.0f; ceilingCheckHeight = 30.0f; } else { - spB0 = this->ageProperties->wallCheckRadius; - spAC = 26.0f; + vWallCheckRadius = this->ageProperties->wallCheckRadius; + vWallCheckHeight = 26.0f; ceilingCheckHeight = this->ageProperties->ceilingCheckHeight; } @@ -10562,7 +11195,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { } Math_Vec3f_Copy(&unusedWorldPos, &this->actor.world.pos); - Actor_UpdateBgCheckInfo(play, &this->actor, spAC, spB0, ceilingCheckHeight, flags); + Actor_UpdateBgCheckInfo(play, &this->actor, vWallCheckHeight, vWallCheckRadius, ceilingCheckHeight, flags); if (this->actor.bgCheckFlags & 0x10) { this->actor.velocity.y = 0.0f; @@ -10570,7 +11203,6 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { sYDistToFloor = this->actor.world.pos.y - this->actor.floorHeight; sConveyorSpeed = 0; - floorPoly = this->actor.floorPoly; if (floorPoly != NULL) { @@ -10584,7 +11216,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { this->floorSfxOffset = 5; } } else { - if (this->stateFlags2 & PLAYER_STATE2_SPAWN_DUST) { + if (this->stateFlags2 & PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND) { this->floorSfxOffset = 1; } else { this->floorSfxOffset = SurfaceType_GetSfx(&play->colCtx, floorPoly, this->actor.floorBgId); @@ -10695,16 +11327,20 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { sShapeYawToTouchedWall = ABS(yawDiff); yawDiff = this->yaw - (s16)(this->actor.wallYaw + 0x8000); - sWorldYawToTouchedWall = ABS(yawDiff); - spB0 = sWorldYawToTouchedWall * 0.00008f; - if (!(this->actor.bgCheckFlags & 1) || spB0 >= 1.0f) { +#define vSpeedScale float0 +#define vSpeedLimit float1 + + vSpeedScale = sWorldYawToTouchedWall * 0.00008f; + + if (!(this->actor.bgCheckFlags & 1) || vSpeedScale >= 1.0f) { this->unk_880 = R_RUN_SPEED_LIMIT / 100.0f; } else { - spAC = (R_RUN_SPEED_LIMIT / 100.0f * spB0); - this->unk_880 = spAC; - if (spAC < 0.1f) { + vSpeedLimit = (R_RUN_SPEED_LIMIT / 100.0f * vSpeedScale); + this->unk_880 = vSpeedLimit; + + if (vSpeedLimit < 0.1f) { this->unk_880 = 0.1f; } } @@ -10712,45 +11348,47 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { if ((this->actor.bgCheckFlags & 0x200) && (sShapeYawToTouchedWall < 0x3000)) { CollisionPoly* wallPoly = this->actor.wallPoly; - if ((ABS(wallPoly->normal.y) < 600) || (CVarGetInteger(CVAR_CHEAT("ClimbEverything"), 0) != 0)) { - f32 sp8C = COLPOLY_GET_NORMAL(wallPoly->normal.x); - f32 sp88 = COLPOLY_GET_NORMAL(wallPoly->normal.y); - f32 sp84 = COLPOLY_GET_NORMAL(wallPoly->normal.z); + if (ABS(wallPoly->normal.y) < 600 || (CVarGetInteger(CVAR_CHEAT("ClimbEverything"), 0) != 0)) { + f32 wallPolyNormalX = COLPOLY_GET_NORMAL(wallPoly->normal.x); + f32 wallPolyNormalY = COLPOLY_GET_NORMAL(wallPoly->normal.y); + f32 wallPolyNormalZ = COLPOLY_GET_NORMAL(wallPoly->normal.z); f32 yDistToLedge; - CollisionPoly* sp7C; - CollisionPoly* sp78; - s32 sp74; - Vec3f sp68; - f32 sp64; - f32 sp60; - s32 temp3; + CollisionPoly* ledgeFloorPoly; + CollisionPoly* poly; + s32 bgId; + Vec3f ledgeCheckPos; + f32 ledgePosY; + f32 ceillingPosY; + s32 wallYawDiff; - this->distToInteractWall = Math3D_UDistPlaneToPos(sp8C, sp88, sp84, wallPoly->dist, &this->actor.world.pos); + this->distToInteractWall = Math3D_UDistPlaneToPos(wallPolyNormalX, wallPolyNormalY, wallPolyNormalZ, wallPoly->dist, &this->actor.world.pos); - spB0 = this->distToInteractWall + 10.0f; - sp68.x = this->actor.world.pos.x - (spB0 * sp8C); - sp68.z = this->actor.world.pos.z - (spB0 * sp84); - sp68.y = this->actor.world.pos.y + this->ageProperties->unk_0C; +#define vLedgeCheckOffsetXZ float0 - sp64 = BgCheck_EntityRaycastFloor1(&play->colCtx, &sp7C, &sp68); - yDistToLedge = sp64 - this->actor.world.pos.y; + vLedgeCheckOffsetXZ = this->distToInteractWall + 10.0f; + ledgeCheckPos.x = this->actor.world.pos.x - (vLedgeCheckOffsetXZ * wallPolyNormalX); + ledgeCheckPos.z = this->actor.world.pos.z - (vLedgeCheckOffsetXZ * wallPolyNormalZ); + ledgeCheckPos.y = this->actor.world.pos.y + this->ageProperties->unk_0C; + + ledgePosY = BgCheck_EntityRaycastFloor1(&play->colCtx, &ledgeFloorPoly, &ledgeCheckPos); + yDistToLedge = ledgePosY - this->actor.world.pos.y; this->yDistToLedge = yDistToLedge; if ((this->yDistToLedge < 18.0f) || - BgCheck_EntityCheckCeiling(&play->colCtx, &sp60, &this->actor.world.pos, - (sp64 - this->actor.world.pos.y) + 20.0f, &sp78, &sp74, &this->actor)) { + BgCheck_EntityCheckCeiling(&play->colCtx, &ceillingPosY, &this->actor.world.pos, + (ledgePosY - this->actor.world.pos.y) + 20.0f, &poly, &bgId, &this->actor)) { this->yDistToLedge = 399.96002f; } else { - sInteractWallCheckOffset.y = (sp64 + 5.0f) - this->actor.world.pos.y; + sInteractWallCheckOffset.y = (ledgePosY + 5.0f) - this->actor.world.pos.y; - if (Player_PosVsWallLineTest(play, this, &sInteractWallCheckOffset, &sp78, &sp74, &sInteractWallCheckResult) && - (temp3 = this->actor.wallYaw - Math_Atan2S(sp78->normal.z, sp78->normal.x), - ABS(temp3) < 0x4000) && - !func_80041E18(&play->colCtx, sp78, sp74)) { + if (Player_PosVsWallLineTest(play, this, &sInteractWallCheckOffset, &poly, &bgId, &sInteractWallCheckResult) && + (wallYawDiff = this->actor.wallYaw - Math_Atan2S(poly->normal.z, poly->normal.x), + ABS(wallYawDiff) < 0x4000) && + !func_80041E18(&play->colCtx, poly, bgId)) { this->yDistToLedge = 399.96002f; } else if (func_80041DE4(&play->colCtx, wallPoly, this->actor.wallBgId) == 0) { if (this->ageProperties->unk_1C <= this->yDistToLedge) { - if (ABS(sp7C->normal.y) > 28000) { + if (ABS(ledgeFloorPoly->normal.y) > 28000) { if (this->ageProperties->unk_14 <= this->yDistToLedge) { nextLedgeClimbType = 4; } else if (this->ageProperties->unk_18 <= this->yDistToLedge) { @@ -10785,32 +11423,34 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { sFloorType = func_80041D4C(&play->colCtx, floorPoly, this->actor.floorBgId); if (!Player_UpdateHoverBoots(this)) { - f32 sp58; - f32 sp54; - f32 sp50; - f32 sp4C; + f32 floorPolyNormalX; + f32 invFloorPolyNormalY; + f32 floorPolyNormalZ; + f32 sin; s32 pad2; - f32 sp44; + f32 cos; s32 pad3; if (this->actor.floorBgId != BGCHECK_SCENE) { func_800434C8(&play->colCtx, this->actor.floorBgId); } - sp58 = COLPOLY_GET_NORMAL(floorPoly->normal.x); - sp54 = 1.0f / COLPOLY_GET_NORMAL(floorPoly->normal.y); - sp50 = COLPOLY_GET_NORMAL(floorPoly->normal.z); + floorPolyNormalX = COLPOLY_GET_NORMAL(floorPoly->normal.x); + invFloorPolyNormalY = 1.0f / COLPOLY_GET_NORMAL(floorPoly->normal.y); + floorPolyNormalZ = COLPOLY_GET_NORMAL(floorPoly->normal.z); - sp4C = Math_SinS(this->yaw); - sp44 = Math_CosS(this->yaw); + sin = Math_SinS(this->yaw); + cos = Math_CosS(this->yaw); - this->floorPitch = Math_Atan2S(1.0f, (-(sp58 * sp4C) - (sp50 * sp44)) * sp54); - this->floorPitchAlt = Math_Atan2S(1.0f, (-(sp58 * sp44) - (sp50 * sp4C)) * sp54); + this->floorPitch = + Math_Atan2S(1.0f, (-(floorPolyNormalX * sin) - (floorPolyNormalZ * cos)) * invFloorPolyNormalY); + this->floorPitchAlt = + Math_Atan2S(1.0f, (-(floorPolyNormalX * cos) - (floorPolyNormalZ * sin)) * invFloorPolyNormalY); - sp4C = Math_SinS(this->actor.shape.rot.y); - sp44 = Math_CosS(this->actor.shape.rot.y); + sin = Math_SinS(this->actor.shape.rot.y); + cos = Math_CosS(this->actor.shape.rot.y); - sFloorShapePitch = Math_Atan2S(1.0f, (-(sp58 * sp4C) - (sp50 * sp44)) * sp54); + sFloorShapePitch = Math_Atan2S(1.0f, (-(floorPolyNormalX * sin) - (floorPolyNormalZ * cos)) * invFloorPolyNormalY); Player_HandleSlopes(play, this, floorPoly); } @@ -10829,7 +11469,7 @@ void Player_ProcessSceneCollision(PlayState* play, Player* this) { void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { u8 seqMode; s32 pad; - Actor* unk_664; + Actor* focusActor; s32 camMode; if (this->actor.category == ACTORCAT_PLAYER) { @@ -10838,18 +11478,18 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { if (this->csAction != 0) { Camera_ChangeMode(Play_GetCamera(play, 0), CAM_MODE_NORMAL); } else if (!(this->stateFlags1 & PLAYER_STATE1_FIRST_PERSON)) { - if ((this->actor.parent != NULL) && (this->stateFlags3 & PLAYER_STATE3_HOOKSHOT_TRAVELLING)) { + if ((this->actor.parent != NULL) && (this->stateFlags3 & PLAYER_STATE3_FLYING_WITH_HOOKSHOT)) { camMode = CAM_MODE_HOOKSHOT; Camera_SetParam(Play_GetCamera(play, 0), 8, this->actor.parent); } else if (Player_Action_8084377C == this->actionFunc) { camMode = CAM_MODE_STILL; } else if (this->stateFlags2 & PLAYER_STATE2_GRABBING_DYNAPOLY) { camMode = CAM_MODE_PUSHPULL; - } else if ((unk_664 = this->unk_664) != NULL) { + } else if ((focusActor = this->focusActor) != NULL) { if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_PLAYER_TALKED_TO)) { camMode = CAM_MODE_TALK; - } else if (this->stateFlags1 & PLAYER_STATE1_TARGET_LOCKED) { - if (this->stateFlags1 & PLAYER_STATE1_THREW_BOOMERANG) { + } else if (this->stateFlags1 & PLAYER_STATE1_FRIENDLY_ACTOR_FOCUS) { + if (this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN) { camMode = CAM_MODE_FOLLOWBOOMERANG; } else { camMode = CAM_MODE_FOLLOWTARGET; @@ -10857,19 +11497,19 @@ void Player_UpdateCamAndSeqModes(PlayState* play, Player* this) { } else { camMode = CAM_MODE_BATTLE; } - Camera_SetParam(Play_GetCamera(play, 0), 8, unk_664); + Camera_SetParam(Play_GetCamera(play, 0), 8, focusActor); } else if (this->stateFlags1 & PLAYER_STATE1_CHARGING_SPIN_ATTACK) { camMode = CAM_MODE_CHARGE; - } else if (this->stateFlags1 & PLAYER_STATE1_THREW_BOOMERANG) { + } else if (this->stateFlags1 & PLAYER_STATE1_BOOMERANG_THROWN) { camMode = CAM_MODE_FOLLOWBOOMERANG; Camera_SetParam(Play_GetCamera(play, 0), 8, this->boomerangActor); } else if (this->stateFlags1 & (PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE)) { - if (func_80833B2C(this)) { + if (Player_FriendlyLockOnOrParallel(this)) { camMode = CAM_MODE_HANGZ; } else { camMode = CAM_MODE_HANG; } - } else if (this->stateFlags1 & (PLAYER_STATE1_TARGET_NOTHING | PLAYER_STATE1_30)) { + } else if (this->stateFlags1 & (PLAYER_STATE1_PARALLEL | PLAYER_STATE1_LOCK_ON_FORCED_TO_RELEASE)) { if (func_8002DD78(this) || func_808334B4(this)) { camMode = CAM_MODE_BOWARROWZ; } else if (this->stateFlags1 & PLAYER_STATE1_CLIMBING_LADDER) { @@ -10989,15 +11629,15 @@ void Player_UpdateBodyBurn(PlayState* play, Player* this) { sp54 = (s32)(this->linearVelocity * 0.4f) + 1; } - spawnedFlame = false; - timerPtr = this->bodyFlameTimers; - if (this->stateFlags2 & PLAYER_STATE2_FOOTSTEP) { sp58 = 100; } else { sp58 = 0; } + spawnedFlame = false; + timerPtr = this->bodyFlameTimers; + func_8083819C(this, play); for (i = 0; i < PLAYER_BODYPART_MAX; i++, timerPtr++) { @@ -11039,7 +11679,7 @@ void Player_UpdateBodyBurn(PlayState* play, Player* this) { } } -void func_80848EF8(Player* this, PlayState* play) { +void Player_DetectRumbleSecrets(Player* this) { if (CHECK_QUEST_ITEM(QUEST_STONE_OF_AGONY)) { f32 temp = 200000.0f - (this->closestSecretDistSq * 5.0f); @@ -11102,7 +11742,7 @@ void func_80848EF8(Player* this, PlayState* play) { int rectHeight = 24; // Texture Heigh int DefaultIconA = 50; // Default icon alpha (55 on 255) - OPEN_DISPS(play->state.gfxCtx); + OPEN_DISPS(gPlayState->state.gfxCtx); gDPPipeSync(OVERLAY_DISP++); gDPSetPrimColor(OVERLAY_DISP++, 0, 0, stoneOfAgonyColor.r, stoneOfAgonyColor.g, stoneOfAgonyColor.b, DefaultIconA); @@ -11134,7 +11774,7 @@ void func_80848EF8(Player* this, PlayState* play) { G_AC_NONE | G_ZS_PRIM | G_RM_XLU_SURF | G_RM_XLU_SURF2); gSPWideTextureRectangle(OVERLAY_DISP++, rectLeft << 2, rectTop << 2, (rectLeft + rectWidth) << 2, (rectTop + rectHeight) << 2, G_TX_RENDERTILE, 0, 0, 1 << 10, 1 << 10); - CLOSE_DISPS(play->state.gfxCtx); + CLOSE_DISPS(gPlayState->state.gfxCtx); } if (this->unk_6A0 > 4000000.0f) { @@ -11148,21 +11788,96 @@ void func_80848EF8(Player* this, PlayState* play) { } } -static s8 D_808547C4[] = { - 0, 3, 3, 5, 4, 8, 9, 13, 14, 15, 16, 17, 18, -22, 23, 24, 25, 26, 27, 28, 29, 31, 32, 33, 34, -35, - 30, 36, 38, -39, -40, -41, 42, 43, 45, 46, 0, 0, 0, 67, 48, 47, -50, 51, -52, -53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, -65, -66, 68, 11, 69, 70, 71, 8, 8, 72, 73, 78, 79, 80, 89, 90, 91, 92, 77, 19, 94, +static s8 sCueToCsActionMap[PLAYER_CUEID_MAX] = { + PLAYER_CSACTION_NONE, // PLAYER_CUEID_NONE + PLAYER_CSACTION_3, // PLAYER_CUEID_1 + PLAYER_CSACTION_3, // PLAYER_CUEID_2 + PLAYER_CSACTION_5, // PLAYER_CUEID_3 + PLAYER_CSACTION_4, // PLAYER_CUEID_4 + PLAYER_CSACTION_8, // PLAYER_CUEID_5 + PLAYER_CSACTION_9, // PLAYER_CUEID_6 + PLAYER_CSACTION_13, // PLAYER_CUEID_7 + PLAYER_CSACTION_14, // PLAYER_CUEID_8 + PLAYER_CSACTION_15, // PLAYER_CUEID_9 + PLAYER_CSACTION_16, // PLAYER_CUEID_10 + PLAYER_CSACTION_17, // PLAYER_CUEID_11 + PLAYER_CSACTION_18, // PLAYER_CUEID_12 + -PLAYER_CSACTION_22, // PLAYER_CUEID_13 + PLAYER_CSACTION_23, // PLAYER_CUEID_14 + PLAYER_CSACTION_24, // PLAYER_CUEID_15 + PLAYER_CSACTION_25, // PLAYER_CUEID_16 + PLAYER_CSACTION_26, // PLAYER_CUEID_17 + PLAYER_CSACTION_27, // PLAYER_CUEID_18 + PLAYER_CSACTION_28, // PLAYER_CUEID_19 + PLAYER_CSACTION_29, // PLAYER_CUEID_20 + PLAYER_CSACTION_31, // PLAYER_CUEID_21 + PLAYER_CSACTION_32, // PLAYER_CUEID_22 + PLAYER_CSACTION_33, // PLAYER_CUEID_23 + PLAYER_CSACTION_34, // PLAYER_CUEID_24 + -PLAYER_CSACTION_35, // PLAYER_CUEID_25 + PLAYER_CSACTION_30, // PLAYER_CUEID_26 + PLAYER_CSACTION_36, // PLAYER_CUEID_27 + PLAYER_CSACTION_38, // PLAYER_CUEID_28 + -PLAYER_CSACTION_39, // PLAYER_CUEID_29 + -PLAYER_CSACTION_40, // PLAYER_CUEID_30 + -PLAYER_CSACTION_41, // PLAYER_CUEID_31 + PLAYER_CSACTION_42, // PLAYER_CUEID_32 + PLAYER_CSACTION_43, // PLAYER_CUEID_33 + PLAYER_CSACTION_45, // PLAYER_CUEID_34 + PLAYER_CSACTION_46, // PLAYER_CUEID_35 + PLAYER_CSACTION_NONE, // PLAYER_CUEID_36 + PLAYER_CSACTION_NONE, // PLAYER_CUEID_37 + PLAYER_CSACTION_NONE, // PLAYER_CUEID_38 + PLAYER_CSACTION_67, // PLAYER_CUEID_39 + PLAYER_CSACTION_48, // PLAYER_CUEID_40 + PLAYER_CSACTION_47, // PLAYER_CUEID_41 + -PLAYER_CSACTION_50, // PLAYER_CUEID_42 + PLAYER_CSACTION_51, // PLAYER_CUEID_43 + -PLAYER_CSACTION_52, // PLAYER_CUEID_44 + -PLAYER_CSACTION_53, // PLAYER_CUEID_45 + PLAYER_CSACTION_54, // PLAYER_CUEID_46 + PLAYER_CSACTION_55, // PLAYER_CUEID_47 + PLAYER_CSACTION_56, // PLAYER_CUEID_48 + PLAYER_CSACTION_57, // PLAYER_CUEID_49 + PLAYER_CSACTION_58, // PLAYER_CUEID_50 + PLAYER_CSACTION_59, // PLAYER_CUEID_51 + PLAYER_CSACTION_60, // PLAYER_CUEID_52 + PLAYER_CSACTION_61, // PLAYER_CUEID_53 + PLAYER_CSACTION_62, // PLAYER_CUEID_54 + PLAYER_CSACTION_63, // PLAYER_CUEID_55 + PLAYER_CSACTION_64, // PLAYER_CUEID_56 + -PLAYER_CSACTION_65, // PLAYER_CUEID_57 + -PLAYER_CSACTION_66, // PLAYER_CUEID_58 + PLAYER_CSACTION_68, // PLAYER_CUEID_59 + PLAYER_CSACTION_11, // PLAYER_CUEID_60 + PLAYER_CSACTION_69, // PLAYER_CUEID_61 + PLAYER_CSACTION_70, // PLAYER_CUEID_62 + PLAYER_CSACTION_71, // PLAYER_CUEID_63 + PLAYER_CSACTION_8, // PLAYER_CUEID_64 + PLAYER_CSACTION_8, // PLAYER_CUEID_65 + PLAYER_CSACTION_72, // PLAYER_CUEID_66 + PLAYER_CSACTION_73, // PLAYER_CUEID_67 + PLAYER_CSACTION_78, // PLAYER_CUEID_68 + PLAYER_CSACTION_79, // PLAYER_CUEID_69 + PLAYER_CSACTION_80, // PLAYER_CUEID_70 + PLAYER_CSACTION_89, // PLAYER_CUEID_71 + PLAYER_CSACTION_90, // PLAYER_CUEID_72 + PLAYER_CSACTION_91, // PLAYER_CUEID_73 + PLAYER_CSACTION_92, // PLAYER_CUEID_74 + PLAYER_CSACTION_77, // PLAYER_CUEID_75 + PLAYER_CSACTION_19, // PLAYER_CUEID_76 + PLAYER_CSACTION_94, // PLAYER_CUEID_77 }; static Vec3f D_80854814 = { 0.0f, 0.0f, 200.0f }; -static f32 D_80854820[] = { 2.0f, 4.0f, 7.0f }; -static f32 D_8085482C[] = { 0.5f, 1.0f, 3.0f }; +static f32 sWaterConveyorSpeeds[] = { 2.0f, 4.0f, 7.0f }; +static f32 sFloorConveyorSpeeds[] = { 0.5f, 1.0f, 3.0f }; void Player_UseTunicBoots(Player* this, PlayState* play) { // Boots and tunics equip despite state if ( - this->stateFlags1 & (PLAYER_STATE1_INPUT_DISABLED | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE | PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_DEAD) || + this->stateFlags1 & (PLAYER_STATE1_INPUT_DISABLED | PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE | PLAYER_STATE1_TALKING | PLAYER_STATE1_DEAD) || this->stateFlags2 & PLAYER_STATE2_OCARINA_PLAYING ) { return; @@ -11217,8 +11932,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->unk_A73--; } - if (this->unk_88E != 0) { - this->unk_88E--; + if (this->textboxBtnCooldownTimer != 0) { + this->textboxBtnCooldownTimer--; } if (this->unk_A87 != 0) { @@ -11235,8 +11950,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { this->unk_890--; } - func_808473D4(play, this); - func_80836BEC(this, play); + Player_UpdateInterface(play, this); + Player_UpdateZTargeting(this, play); if (this->heldItemAction == PLAYER_IA_DEKU_STICK && GameInteractor_Should(VB_DEKU_STICK_BE_ON_FIRE, this->unk_860 != 0)) { @@ -11255,7 +11970,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { if ((this->stateFlags3 & PLAYER_STATE3_RESTORE_NAYRUS_LOVE) && (gSaveContext.nayrusLoveTimer != 0) && (gSaveContext.magicState == MAGIC_STATE_IDLE)) { gSaveContext.magicState = MAGIC_STATE_METER_FLASH_1; - func_80846A00(play, this, 1); + Player_SpawnMagicSpell(play, this, 1); this->stateFlags3 &= ~PLAYER_STATE3_RESTORE_NAYRUS_LOVE; } @@ -11295,7 +12010,7 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { func_8083A360(play, this); this->stateFlags1 |= PLAYER_STATE1_ON_HORSE; Player_AnimPlayOnce(play, this, &gPlayerAnim_link_uma_wait_1); - Player_AnimReplaceApplyFlags(play, this, 0x9B); + Player_StartAnimMovement(play, this, 0x9B); this->av2.actionVar2 = 99; } @@ -11402,13 +12117,13 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { sConveyorSpeed--; if (sIsFloorConveyor == 0) { - sp48 = D_80854820[sConveyorSpeed]; + sp48 = sWaterConveyorSpeeds[sConveyorSpeed]; if (!(this->stateFlags1 & PLAYER_STATE1_IN_WATER)) { sp48 *= 0.25f; } } else { - sp48 = D_8085482C[sConveyorSpeed]; + sp48 = sFloorConveyorSpeeds[sConveyorSpeed]; } Math_StepToF(&this->pushedSpeed, sp48, sp48 * 0.1f); @@ -11439,16 +12154,16 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { } else { this->fallStartHeight = this->actor.world.pos.y; } - func_80848EF8(this, play); + Player_DetectRumbleSecrets(this); } } if ((play->csCtx.state != CS_STATE_IDLE) && (this->csAction != 6) && !(this->stateFlags1 & PLAYER_STATE1_ON_HORSE) && !(this->stateFlags2 & PLAYER_STATE2_GRABBED_BY_ENEMY) && (this->actor.category == ACTORCAT_PLAYER)) { - CsCmdActorAction* linkActionCsCmd = play->csCtx.linkAction; + CsCmdActorCue* linkActionCsCmd = play->csCtx.linkAction; - if ((linkActionCsCmd != NULL) && (D_808547C4[linkActionCsCmd->action] != 0)) { + if ((linkActionCsCmd != NULL) && (sCueToCsActionMap[linkActionCsCmd->action] != 0)) { Player_SetCsActionWithHaltedActors(play, NULL, 6); Player_ZeroSpeedXZ(this); } else if ((this->csAction == 0) && !(this->stateFlags2 & PLAYER_STATE2_UNDERWATER) && @@ -11471,13 +12186,13 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { func_8083D6EC(play, this); - if ((this->unk_664 == NULL) && (this->naviTextId == 0)) { - this->stateFlags2 &= ~(PLAYER_STATE2_SPEAK_OR_CHECK | PLAYER_STATE2_NAVI_ALERT); + if ((this->focusActor == NULL) && (this->naviTextId == 0)) { + this->stateFlags2 &= ~(PLAYER_STATE2_CAN_ACCEPT_TALK_OFFER | PLAYER_STATE2_NAVI_ALERT); } this->stateFlags1 &= ~(PLAYER_STATE1_SWINGING_BOTTLE | PLAYER_STATE1_READY_TO_FIRE | PLAYER_STATE1_CHARGING_SPIN_ATTACK | PLAYER_STATE1_SHIELDING); this->stateFlags2 &= ~(PLAYER_STATE2_DO_ACTION_GRAB | PLAYER_STATE2_DO_ACTION_CLIMB | PLAYER_STATE2_FOOTSTEP | PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS | - PLAYER_STATE2_GRABBING_DYNAPOLY | PLAYER_STATE2_SPAWN_DUST | PLAYER_STATE2_STATIONARY_LADDER | PLAYER_STATE2_FROZEN | + PLAYER_STATE2_GRABBING_DYNAPOLY | PLAYER_STATE2_FORCE_SAND_FLOOR_SOUND | PLAYER_STATE2_STATIONARY_LADDER | PLAYER_STATE2_FROZEN | PLAYER_STATE2_DO_ACTION_ENTER | PLAYER_STATE2_DO_ACTION_DOWN | PLAYER_STATE2_REFLECTION); this->stateFlags3 &= ~PLAYER_STATE3_CHECK_FLOOR_WATER_COLLISION; @@ -11485,14 +12200,14 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { Player_ProcessControlStick(play, this); if (this->stateFlags1 & PLAYER_STATE1_IN_WATER) { - D_808535E8 = 0.5f; + sWaterSpeedFactor = 0.5f; } else { - D_808535E8 = 1.0f; + sWaterSpeedFactor = 1.0f; } - D_808535EC = 1.0f / D_808535E8; + sInvWaterSpeedFactor = 1.0f / sWaterSpeedFactor; sUseHeldItem = sHeldItemButtonIsHeldDown = 0; - D_80858AA4 = this->currentMask; + sSavedCurrentMask = this->currentMask; if (!(this->stateFlags3 & PLAYER_STATE3_PAUSE_ACTION_FUNC)) { this->actionFunc(this, play); @@ -11506,17 +12221,17 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { (this->skelAnime.moveFlags & 4) ? 1.0f : this->ageProperties->unk_08); } - func_808368EC(this, play); + Player_UpdateShapeYaw(this, play); if (CHECK_FLAG_ALL(this->actor.flags, ACTOR_FLAG_PLAYER_TALKED_TO)) { - this->targetActorDistance = 0.0f; + this->talkActorDistance = 0.0f; } else { - this->targetActor = NULL; - this->targetActorDistance = FLT_MAX; + this->talkActor = NULL; + this->talkActorDistance = FLT_MAX; this->exchangeItemId = EXCH_ITEM_NONE; } - if (!(this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { + if (!(this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) { this->interactRangeActor = NULL; this->getItemDirection = 0x6000; } @@ -11537,8 +12252,8 @@ 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->unk_684 = NULL; + this->knockbackType = 0; + this->autoLockOnActor = NULL; phi_f12 = ((this->bodyPartsPos[PLAYER_BODYPART_L_FOOT].y + this->bodyPartsPos[PLAYER_BODYPART_R_FOOT].y) * 0.5f) + @@ -11599,6 +12314,8 @@ void Player_UpdateCommon(Player* this, PlayState* play, Input* input) { static Vec3f D_80854838 = { 0.0f, 0.0f, -30.0f }; +s32 Player_UpdateNoclip(Player* this, PlayState* play); + void Player_Update(Actor* thisx, PlayState* play) { static Vec3f sDogSpawnPos; Player* this = (Player*)thisx; @@ -11607,7 +12324,7 @@ void Player_Update(Actor* thisx, PlayState* play) { Input sp44; Actor* dog; - if (func_8084FCAC(this, play)) { + if (Player_UpdateNoclip(this, play)) { if (gSaveContext.dogParams < 0) { // Disable object dependency to prevent losing dog in scenes other than market if (Object_GetIndex(&play->objectCtx, OBJECT_DOG) < 0 && !CVarGetInteger(CVAR_ENHANCEMENT("DogFollowsEverywhere"), 0)) { @@ -11638,7 +12355,7 @@ void Player_Update(Actor* thisx, PlayState* play) { memset(&sp44, 0, sizeof(sp44)); } else { sp44 = play->state.input[0]; - if (this->unk_88E != 0) { + if (this->textboxBtnCooldownTimer != 0) { sp44.cur.button &= ~(BTN_A | BTN_B | BTN_CUP); sp44.press.button &= ~(BTN_A | BTN_B | BTN_CUP); } @@ -11727,15 +12444,13 @@ void Player_Update(Actor* thisx, PlayState* play) { GameInteractor_ExecuteOnPlayerUpdate(); } -typedef struct { +typedef struct BunnyEarKinematics { /* 0x0 */ Vec3s rot; /* 0x6 */ Vec3s angVel; } BunnyEarKinematics; // size = 0xC static BunnyEarKinematics sBunnyEarKinematics; -static Vec3s D_80858AD8[25]; - static Gfx* sMaskDlists[PLAYER_MASK_MAX - 1] = { gLinkChildKeatonMaskDL, gLinkChildSkullMaskDL, gLinkChildSpookyMaskDL, gLinkChildBunnyHoodDL, gLinkChildGoronMaskDL, gLinkChildZoraMaskDL, gLinkChildGerudoMaskDL, gLinkChildMaskOfTruthDL, @@ -11839,9 +12554,6 @@ void Player_Draw(Actor* thisx, PlayState* play2) { Vec3s rot; f32 scale; - // OTRTODO: This is crashing randomly, so its temporarily been disabled - // return; - if (LINK_AGE_IN_YEARS == YEARS_CHILD) { pos.x = 2.0f; pos.y = -130.0f; @@ -11869,7 +12581,7 @@ void Player_Draw(Actor* thisx, PlayState* play2) { s32 lod; s32 pad; - if ((this->csAction != 0) || (func_8008E9C4(this) && 0) || (this->actor.projectedPos.z < 160.0f)) { + if ((this->csAction != 0) || (Player_CheckHostileLockOn(this) && 0) || (this->actor.projectedPos.z < 160.0f)) { lod = 0; } else { lod = 1; @@ -11883,9 +12595,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); + 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->unk_88F * 256) * 2000.0f)); + 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); @@ -12081,7 +12793,7 @@ s16 func_8084ABD8(PlayState* play, Player* this, s32 arg2, s16 arg3) { this->actor.world.pos.z += (relY2 * movementSpeed) + this->actor.colChkInfo.displacement.z; } - this->unk_6AE |= 2; + this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_Y; return func_80836AB8(this, (play->shootingGalleryStatus != 0) || func_8002DD78(this) || func_808334B4(this)) - arg3; } @@ -12244,7 +12956,7 @@ void Player_Action_8084B1D8(Player* this, PlayState* play) { func_8084B000(this); func_8084AEEC(this, &this->linearVelocity, 0, this->actor.shape.rot.y); } else { - func_8083721C(this); + Player_DecelerateToZero(this); } if ((this->unk_6AD == 2) && (func_8002DD6C(this) || func_808332E4(this))) { @@ -12255,16 +12967,16 @@ void Player_Action_8084B1D8(Player* this, PlayState* play) { if (CVarGetInteger(CVAR_ENHANCEMENT("DpadEquips"), 0) != 0) { buttonsToCheck |= BTN_DUP | BTN_DDOWN | BTN_DLEFT | BTN_DRIGHT; } - if ((this->csAction != 0) || (this->unk_6AD == 0) || (this->unk_6AD >= 4) || func_80833B54(this) || - (this->unk_664 != NULL) || !func_8083AD4C(play, this) || + if ((this->csAction != 0) || (this->unk_6AD == 0) || (this->unk_6AD >= 4) || Player_UpdateHostileLockOn(this) || + (this->focusActor != NULL) || !func_8083AD4C(play, this) || (((this->unk_6AD == 2) && (CHECK_BTN_ANY(sControlInput->press.button, BTN_A | BTN_B | BTN_R) || - func_80833B2C(this) || (!func_8002DD78(this) && !func_808334B4(this)))) || + Player_FriendlyLockOnOrParallel(this) || (!func_8002DD78(this) && !func_808334B4(this)))) || ((this->unk_6AD == 1) && CHECK_BTN_ANY(sControlInput->press.button, buttonsToCheck)))) { func_8083C148(this, play); func_80078884(NA_SE_SY_CAMERA_ZOOM_UP); } else if ((DECR(this->av2.actionVar2) == 0) || (this->unk_6AD != 2)) { if (func_8008F128(this)) { - this->unk_6AE |= 0x43; + this->unk_6AE_rotFlags |= UNK6AE_ROT_FOCUS_X | UNK6AE_ROT_FOCUS_Y | UNK6AE_ROT_UPPER_X; } else { this->actor.shape.rot.y = func_8084ABD8(play, this, 0, 0); } @@ -12288,7 +13000,7 @@ s32 func_8084B3CC(PlayState* play, Player* this) { } this->stateFlags1 |= PLAYER_STATE1_FIRST_PERSON; - Player_AnimPlayOnce(play, this, func_80833338(this)); + Player_AnimPlayOnce(play, this, Player_GetIdleAnim(this)); Player_ZeroSpeedXZ(this); func_8083B010(this); return 1; @@ -12307,28 +13019,29 @@ s32 func_8084B4D4(PlayState* play, Player* this) { this->stateFlags3 &= ~PLAYER_STATE3_FORCE_PULL_OCARINA; func_8084B498(this); this->unk_6AD = 4; - Player_ActionChange_13(this, play); + Player_ActionHandler_13(this, play); return 1; } return 0; } -void Player_Action_8084B530(Player* this, PlayState* play) { +void Player_Action_Talk(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; + Player_UpdateUpperBody(this, play); if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { this->actor.flags &= ~ACTOR_FLAG_PLAYER_TALKED_TO; - if (!CHECK_FLAG_ALL(this->targetActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_HOSTILE)) { - this->stateFlags2 &= ~PLAYER_STATE2_SWITCH_TARGETING; + if (!CHECK_FLAG_ALL(this->talkActor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_HOSTILE)) { + this->stateFlags2 &= ~PLAYER_STATE2_LOCK_ON_WITH_SWITCH; } func_8005B1A4(Play_GetCamera(play, 0)); if (!func_8084B4D4(play, this) && !func_8084B3CC(play, this) && !Player_StartCsAction(play, this)) { - if ((this->targetActor != this->interactRangeActor) || !Player_ActionChange_2(this, play)) { + if ((this->talkActor != this->interactRangeActor) || !Player_ActionHandler_2(this, play)) { if (this->stateFlags1 & PLAYER_STATE1_ON_HORSE) { s32 sp24 = this->av2.actionVar2; func_8083A360(play, this); @@ -12341,7 +13054,7 @@ void Player_Action_8084B530(Player* this, PlayState* play) { } } - this->unk_88E = 10; + this->textboxBtnCooldownTimer = 10; return; } @@ -12349,22 +13062,22 @@ void Player_Action_8084B530(Player* this, PlayState* play) { Player_Action_8084CC98(this, play); } else if (func_808332B8(this)) { Player_Action_8084D610(this, play); - } else if (!func_8008E9C4(this) && LinkAnimation_Update(play, &this->skelAnime)) { + } else if (!Player_CheckHostileLockOn(this) && LinkAnimation_Update(play, &this->skelAnime)) { if (this->skelAnime.moveFlags != 0) { - func_80832DBC(this); - if ((this->targetActor->category == ACTORCAT_NPC) && - (this->heldItemAction != PLAYER_IA_FISHING_POLE)) { + Player_FinishAnimMovement(this); + + if ((this->talkActor->category == ACTORCAT_NPC) && (this->heldItemAction != PLAYER_IA_FISHING_POLE)) { Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_talk_free); } else { - Player_AnimPlayLoop(play, this, func_80833338(this)); + Player_AnimPlayLoop(play, this, Player_GetIdleAnim(this)); } } else { Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_link_normal_talk_free_wait); } } - if (this->unk_664 != NULL) { - this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); + if (this->focusActor != NULL) { + this->yaw = this->actor.shape.rot.y = func_8083DB98(this, false); } } @@ -12400,8 +13113,8 @@ void func_8084B840(PlayState* play, Player* this, f32 arg2) { } static AnimSfxEntry D_80854870[] = { - { NA_SE_PL_SLIP, ANIMSFX_DATA(ANIMSFX_TYPE_2, 3) }, - { NA_SE_PL_SLIP, -ANIMSFX_DATA(ANIMSFX_TYPE_2, 21) }, + { NA_SE_PL_SLIP, ANIMSFX_DATA(ANIMSFX_TYPE_FLOOR, 3) }, + { NA_SE_PL_SLIP, -ANIMSFX_DATA(ANIMSFX_TYPE_FLOOR, 21) }, }; void Player_Action_8084B898(Player* this, PlayState* play) { @@ -12415,7 +13128,7 @@ void Player_Action_8084B898(Player* this, PlayState* play) { this->av2.actionVar2 = 1; } else if (this->av2.actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 11.0f)) { - func_80832698(this, NA_SE_VO_LI_PUSH); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_PUSH); } } @@ -12441,8 +13154,8 @@ void Player_Action_8084B898(Player* this, PlayState* play) { } static AnimSfxEntry D_80854878[] = { - { NA_SE_PL_SLIP, ANIMSFX_DATA(ANIMSFX_TYPE_2, 4) }, - { NA_SE_PL_SLIP, -ANIMSFX_DATA(ANIMSFX_TYPE_2, 24) }, + { NA_SE_PL_SLIP, ANIMSFX_DATA(ANIMSFX_TYPE_FLOOR, 4) }, + { NA_SE_PL_SLIP, -ANIMSFX_DATA(ANIMSFX_TYPE_FLOOR, 24) }, }; static Vec3f D_80854880 = { 0.0f, 26.0f, -40.0f }; @@ -12467,7 +13180,7 @@ void Player_Action_8084B9E4(Player* this, PlayState* play) { } else { if (this->av2.actionVar2 == 0) { if (LinkAnimation_OnFrame(&this->skelAnime, 11.0f)) { - func_80832698(this, NA_SE_VO_LI_PUSH); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_PUSH); } } else { Player_ProcessAnimSfxList(this, D_80854878); @@ -12524,7 +13237,7 @@ void Player_Action_8084BBE4(Player* this, PlayState* play) { } if (LinkAnimation_OnFrame(&this->skelAnime, temp)) { - func_80832770(this, NA_SE_PL_WALK_GROUND); + Player_PlayFloorSfx(this, NA_SE_PL_WALK_GROUND); if (this->skelAnime.animation == &gPlayerAnim_link_normal_fall) { this->av1.actionVar1 = 1; } else { @@ -12537,7 +13250,7 @@ void Player_Action_8084BBE4(Player* this, PlayState* play) { if (this->av1.actionVar1 != 0) { Player_GetMovementSpeedAndYaw(this, &sp3C, &sp3A, SPEED_MODE_LINEAR, play); - if (this->unk_847[this->unk_846] >= 0) { + if (this->controlStickSpinAngles[this->controlStickDataIndex] >= 0) { if (this->av1.actionVar1 > 0) { anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_fall_up, this->modelAnimType); } else { @@ -12564,17 +13277,17 @@ void Player_Action_8084BDFC(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832E48(this, 1); + Player_ApplyAnimMovementScaledByAge(this, 1); func_8083C0E8(this, play); return; } if (LinkAnimation_OnFrame(&this->skelAnime, this->skelAnime.endFrame - 6.0f)) { - func_808328A0(this); + Player_PlayLandingSfx(this); } else if (LinkAnimation_OnFrame(&this->skelAnime, this->skelAnime.endFrame - 34.0f)) { this->stateFlags1 &= ~(PLAYER_STATE1_HANGING_OFF_LEDGE | PLAYER_STATE1_CLIMBING_LEDGE); Player_PlaySfx(this, NA_SE_PL_CLIMB_CLIFF); - func_80832698(this, NA_SE_VO_LI_CLIMB_END); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_CLIMB_END); } } @@ -12728,9 +13441,9 @@ static f32 D_80854898[] = { 10.0f, 20.0f }; static f32 D_808548A0[] = { 40.0f, 50.0f }; static AnimSfxEntry D_808548A8[] = { - { NA_SE_PL_WALK_LADDER, ANIMSFX_DATA(ANIMSFX_TYPE_1, 10) }, - { NA_SE_PL_WALK_LADDER, ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, - { NA_SE_PL_WALK_LADDER, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 30) }, + { NA_SE_PL_WALK_LADDER, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 10) }, + { NA_SE_PL_WALK_LADDER, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 20) }, + { NA_SE_PL_WALK_LADDER, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 30) }, }; void Player_Action_8084C5F8(Player* this, PlayState* play) { @@ -12742,7 +13455,7 @@ void Player_Action_8084C5F8(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; - temp = func_808374A0(play, this, &this->skelAnime, 4.0f); + temp = Player_TryActionInterrupt(play, this, &this->skelAnime, 4.0f); if (temp == 0) { this->stateFlags1 &= ~PLAYER_STATE1_CLIMBING_LADDER; @@ -12768,17 +13481,17 @@ void Player_Action_8084C5F8(Player* this, PlayState* play) { sp24.z = this->actor.world.pos.z; if (BgCheck_EntityRaycastFloor3(&play->colCtx, &sp34, &sp30, &sp24) != 0.0f) { this->floorSfxOffset = func_80041F10(&play->colCtx, sp34, sp30); - func_808328A0(this); + Player_PlayLandingSfx(this); } } } static AnimSfxEntry D_808548B4[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 40) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 48) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 56) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 64) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 72) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 80) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 88) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 96) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 104) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 40) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 48) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 56) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 64) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 72) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 80) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 88) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 96) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 104) }, }; void Player_Action_8084C760(Player* this, PlayState* play) { @@ -12809,11 +13522,11 @@ void Player_Action_8084C760(Player* this, PlayState* play) { } static AnimSfxEntry D_808548D8[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 10) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 18) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 26) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 34) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 52) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 60) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 68) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 76) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 84) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 10) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 18) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 26) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 34) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 52) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 60) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 68) }, { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 76) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 84) }, }; void Player_Action_8084C81C(Player* this, PlayState* play) { @@ -12887,7 +13600,7 @@ s32 func_8084C9BC(Player* this, PlayState* play) { if (EN_HORSE_CHECK_1(rideActor) || (EN_HORSE_CHECK_4(rideActor) && CHECK_BTN_ALL(sControlInput->press.button, BTN_A))) { rideActor->actor.child = NULL; - func_80835DAC(play, this, Player_Action_8084D3E4, 0); + Player_SetupActionPreserveAnimMovement(play, this, Player_Action_8084D3E4, 0); this->unk_878 = sp34 - rideActor->actor.world.pos.y; Player_AnimPlayOnce(play, this, (this->mountSide < 0) ? &gPlayerAnim_link_uma_left_down @@ -12958,10 +13671,14 @@ static u8 D_80854998[2][2] = { static Vec3s D_8085499C = { -69, 7146, -266 }; static AnimSfxEntry D_808549A4[] = { - { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 48) }, { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 58) }, - { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 68) }, { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 92) }, - { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 110) }, { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 126) }, - { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 132) }, { NA_SE_PL_CALM_PAT, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 136) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 48) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 58) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 68) }, + { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 92) }, + { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 110) }, + { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 126) }, + { NA_SE_PL_CALM_PAT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 132) }, + { NA_SE_PL_CALM_PAT, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 136) }, }; void Player_Action_8084CC98(Player* this, PlayState* play) { @@ -12998,7 +13715,8 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { func_8002DE74(play, this); this->skelAnime.prevTransl = D_8085499C; - if ((rideActor->animationIdx != this->av2.actionVar2) && ((rideActor->animationIdx >= 2) || (this->av2.actionVar2 >= 2))) { + if ((rideActor->animationIdx != this->av2.actionVar2) && + ((rideActor->animationIdx >= 2) || (this->av2.actionVar2 >= 2))) { if ((this->av2.actionVar2 = rideActor->animationIdx) < 2) { f32 rand = Rand_ZeroOne(); s32 temp = 0; @@ -13022,7 +13740,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { } if (this->av2.actionVar2 == 1) { - if ((D_808535E0 != 0) || func_8083224C(play)) { + if (sUpperBodyIsBusy || Player_IsTalking(play)) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_uma_wait_3); } else if (LinkAnimation_Update(play, &this->skelAnime)) { this->av2.actionVar2 = 99; @@ -13044,8 +13762,8 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { this->unk_6AD = 0; this->av1.actionVar1 = 0; } else if ((this->av2.actionVar2 < 2) || (this->av2.actionVar2 >= 4)) { - D_808535E0 = Player_UpdateUpperBody(this, play); - if (D_808535E0 != 0) { + sUpperBodyIsBusy = Player_UpdateUpperBody(this, play); + if (sUpperBodyIsBusy) { this->av1.actionVar1 = 0; } } @@ -13057,9 +13775,9 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { this->yaw = this->actor.shape.rot.y = rideActor->actor.shape.rot.y; if ((this->csAction != 0) || - (!func_8083224C(play) && ((rideActor->actor.speedXZ != 0.0f) || !Player_ActionChange_4(this, play)) && - !Player_ActionChange_6(this, play))) { - if (D_808535E0 == 0) { + (!Player_IsTalking(play) && ((rideActor->actor.speedXZ != 0.0f) || !Player_ActionHandler_Talk(this, play)) && + !Player_ActionHandler_Roll(this, play))) { + if (!sUpperBodyIsBusy) { if (this->av1.actionVar1 != 0) { if (LinkAnimation_Update(play, &this->upperSkelAnime)) { rideActor->stateFlags &= ~ENHORSE_FLAG_8; @@ -13069,7 +13787,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { if (this->upperSkelAnime.animation == &gPlayerAnim_link_uma_stop_muti) { if (LinkAnimation_OnFrame(&this->upperSkelAnime, 23.0f)) { Player_PlaySfx(this, NA_SE_IT_LASH); - func_80832698(this, NA_SE_VO_LI_LASH); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_LASH); } AnimationContext_SetCopyAll(play, this->skelAnime.limbCount, this->skelAnime.jointTable, @@ -13077,7 +13795,7 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { } else { if (LinkAnimation_OnFrame(&this->upperSkelAnime, 10.0f)) { Player_PlaySfx(this, NA_SE_IT_LASH); - func_80832698(this, NA_SE_VO_LI_LASH); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_LASH); } AnimationContext_SetCopyTrue(play, this->skelAnime.limbCount, this->skelAnime.jointTable, @@ -13103,33 +13821,33 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { if (this->stateFlags1 & PLAYER_STATE1_FIRST_PERSON) { if (!func_8083AD4C(play, this) || CHECK_BTN_ANY(sControlInput->press.button, BTN_A) || - func_80833BCC(this)) { + Player_IsZTargeting(this)) { this->unk_6AD = 0; this->stateFlags1 &= ~PLAYER_STATE1_FIRST_PERSON; } else { - this->unk_6BE = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y; - this->unk_6BE += 5000; - this->unk_6B0 = -5000; + this->upperLimbRot.y = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y; + this->upperLimbRot.y += 5000; + this->upperLimbYawSecondary = -5000; } return; } - if ((this->csAction != 0) || (!func_8084C9BC(this, play) && !Player_ActionChange_13(this, play))) { - if (this->unk_664 != NULL) { + if ((this->csAction != 0) || (!func_8084C9BC(this, play) && !Player_ActionHandler_13(this, play))) { + if (this->focusActor != NULL) { if (func_8002DD78(this) != 0) { - this->unk_6BE = func_8083DB98(this, 1) - this->actor.shape.rot.y; - this->unk_6BE = CLAMP(this->unk_6BE, -0x4AAA, 0x4AAA); - this->actor.focus.rot.y = this->actor.shape.rot.y + this->unk_6BE; - this->unk_6BE += 5000; - this->unk_6AE |= 0x80; + this->upperLimbRot.y = func_8083DB98(this, 1) - this->actor.shape.rot.y; + this->upperLimbRot.y = CLAMP(this->upperLimbRot.y, -0x4AAA, 0x4AAA); + this->actor.focus.rot.y = this->actor.shape.rot.y + this->upperLimbRot.y; + this->upperLimbRot.y += 5000; + this->unk_6AE_rotFlags |= UNK6AE_ROT_UPPER_Y; } else { func_8083DB98(this, 0); } } else { if (func_8002DD78(this) != 0) { - this->unk_6BE = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y; - this->unk_6BE += 5000; - this->unk_6B0 = -5000; + this->upperLimbRot.y = func_8084ABD8(play, this, 1, -5000) - this->actor.shape.rot.y; + this->upperLimbRot.y += 5000; + this->upperLimbYawSecondary = -5000; } } } @@ -13137,9 +13855,9 @@ void Player_Action_8084CC98(Player* this, PlayState* play) { } static AnimSfxEntry D_808549C4[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_5, 0) }, - { NA_SE_PL_GET_OFF_HORSE, ANIMSFX_DATA(ANIMSFX_TYPE_1, 10) }, - { NA_SE_PL_SLIPDOWN, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 25) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_LANDING, 0) }, + { NA_SE_PL_GET_OFF_HORSE, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 10) }, + { NA_SE_PL_SLIPDOWN, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 25) }, }; void Player_Action_8084D3E4(Player* this, PlayState* play) { @@ -13164,16 +13882,16 @@ void Player_Action_8084D3E4(Player* this, PlayState* play) { Camera_ChangeSetting(Play_GetCamera(play, 0), CAM_SET_NORMAL0); if (this->mountSide < 0) { - D_808549C4[0].data = ANIMSFX_DATA(ANIMSFX_TYPE_5, 40); + D_808549C4[0].data = ANIMSFX_DATA(ANIMSFX_TYPE_LANDING, 40); } else { - D_808549C4[0].data = ANIMSFX_DATA(ANIMSFX_TYPE_5, 29); + D_808549C4[0].data = ANIMSFX_DATA(ANIMSFX_TYPE_LANDING, 29); } Player_ProcessAnimSfxList(this, D_808549C4); } } static AnimSfxEntry D_808549D0[] = { - { NA_SE_PL_SWIM, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 0) }, + { NA_SE_PL_SWIM, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 0) }, }; void func_8084D530(Player* this, f32* arg1, f32 arg2, s16 arg3) { @@ -13199,7 +13917,7 @@ void Player_Action_8084D610(Player* this, PlayState* play) { func_80832CB0(play, this, &gPlayerAnim_link_swimer_swim_wait); func_8084B000(this); - if (!func_8083224C(play) && !Player_TryActionChangeList(play, this, sActionChangeList11, true) && + if (!Player_IsTalking(play) && !Player_TryActionHandlerList(play, this, sActionHandlerList11, true) && !func_8083D12C(play, this, sControlInput)) { if (this->unk_6AD != 1) { this->unk_6AD = 0; @@ -13211,7 +13929,7 @@ void Player_Action_8084D610(Player* this, PlayState* play) { if (this->actor.bgCheckFlags & 1) { func_8083A098(this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_short_landing, this->modelAnimType), play); - func_808328A0(this); + Player_PlayLandingSfx(this); } } else { Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_LINEAR, play); @@ -13223,7 +13941,7 @@ void Player_Action_8084D610(Player* this, PlayState* play) { return; } - if (func_80833C04(this)) { + if (Player_IsZTargetingWithHostileUpdate(this)) { func_8084D5CC(play, this); } else { func_8084D574(play, this, sp32); @@ -13236,7 +13954,7 @@ void Player_Action_8084D610(Player* this, PlayState* play) { } void Player_Action_8084D7C4(Player* this, PlayState* play) { - if (!Player_ActionChange_13(this, play)) { + if (!Player_ActionHandler_13(this, play)) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; func_8084B158(play, this, NULL, this->linearVelocity); @@ -13258,13 +13976,14 @@ void Player_Action_8084D84C(Player* this, PlayState* play) { func_8084B158(play, this, sControlInput, this->linearVelocity); func_8084B000(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList11, true) && !func_8083D12C(play, this, sControlInput)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList11, true) && + !func_8083D12C(play, this, sControlInput)) { Player_GetMovementSpeedAndYaw(this, &sp34, &sp32, SPEED_MODE_LINEAR, play); temp = this->actor.shape.rot.y - sp32; if ((sp34 == 0.0f) || (ABS(temp) > 0x6000) || (this->currentBoots == PLAYER_BOOTS_IRON)) { func_80838F18(play, this); - } else if (func_80833C04(this)) { + } else if (Player_IsZTargetingWithHostileUpdate(this)) { func_8084D5CC(play, this); } @@ -13317,12 +14036,13 @@ void Player_Action_8084DAB4(Player* this, PlayState* play) { func_8084B158(play, this, sControlInput, this->linearVelocity); func_8084B000(this); - if (!Player_TryActionChangeList(play, this, sActionChangeList11, true) && !func_8083D12C(play, this, sControlInput)) { + if (!Player_TryActionHandlerList(play, this, sActionHandlerList11, true) && + !func_8083D12C(play, this, sControlInput)) { Player_GetMovementSpeedAndYaw(this, &sp2C, &sp2A, SPEED_MODE_LINEAR, play); if (sp2C == 0.0f) { func_80838F18(play, this); - } else if (!func_80833C04(this)) { + } else if (!Player_IsZTargetingWithHostileUpdate(this)) { func_8084D574(play, this, sp2A); } else { func_8084D980(play, this, &sp2C, &sp2A); @@ -13355,7 +14075,7 @@ void Player_Action_8084DC48(Player* this, PlayState* play) { this->actor.gravity = 0.0f; Player_UpdateUpperBody(this, play); - if (!Player_ActionChange_13(this, play)) { + if (!Player_ActionHandler_13(this, play)) { if (this->currentBoots == PLAYER_BOOTS_IRON) { func_80838F18(play, this); return; @@ -13370,14 +14090,14 @@ void Player_Action_8084DC48(Player* this, PlayState* play) { this->actor.velocity.y = -2.0f; } - func_8083721C(this); + Player_DecelerateToZero(this); return; } func_8084B158(play, this, sControlInput, this->actor.velocity.y); this->unk_6C2 = 16000; - if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !Player_ActionChange_2(this, play) && + if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_A) && !Player_ActionHandler_2(this, play) && !(this->actor.bgCheckFlags & 1) && (this->actor.yDistToWater < D_80854784[CUR_UPG_VALUE(UPG_SCALE)])) { func_8084DBC4(play, this, -2.0f); } else { @@ -13396,7 +14116,7 @@ void Player_Action_8084DC48(Player* this, PlayState* play) { } else if (!func_8083D12C(play, this, sControlInput)) { sp2C = (this->av2.actionVar2 * 0.018f) + 4.0f; - if (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD) { + if (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR) { sControlInput = NULL; } @@ -13414,7 +14134,7 @@ void Player_Action_8084DC48(Player* this, PlayState* play) { void func_8084DF6C(PlayState* play, Player* this) { this->unk_862 = 0; - this->stateFlags1 &= ~(PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD); + this->stateFlags1 &= ~(PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_CARRYING_ACTOR); this->getItemId = GI_NONE; this->getItemEntry = (GetItemEntry)GET_ITEM_NONE; func_8005B1A4(Play_GetCamera(play, 0)); @@ -13422,7 +14142,7 @@ void func_8084DF6C(PlayState* play, Player* this) { void func_8084DFAC(PlayState* play, Player* this) { func_8084DF6C(play, this); - func_808322FC(this); + Player_ApplyYawFromAnim(this); func_8083C0E8(this, play); this->yaw = this->actor.shape.rot.y; } @@ -13572,7 +14292,7 @@ void Player_Action_8084E1EC(Player* this, PlayState* play) { func_80832340(play, this); func_80835EA4(play, 8); } else if (LinkAnimation_OnFrame(&this->skelAnime, 5.0f)) { - func_80832698(this, NA_SE_VO_LI_BREATH_DRINK); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_BREATH_DRINK); } } @@ -13628,13 +14348,13 @@ void Player_Action_8084E3C4(Player* this, PlayState* play) { if (play->msgCtx.ocarinaMode == OCARINA_MODE_04) { func_8005B1A4(Play_GetCamera(play, 0)); - if ((this->targetActor != NULL) && (this->targetActor == this->unk_6A8)) { - Player_StartTalking(play, this->targetActor); + if ((this->talkActor != NULL) && (this->talkActor == this->unk_6A8)) { + Player_StartTalking(play, this->talkActor); } else if (this->naviTextId < 0) { - this->targetActor = this->naviActor; + this->talkActor = this->naviActor; this->naviActor->textId = -this->naviTextId; - Player_StartTalking(play, this->targetActor); - } else if (!Player_ActionChange_13(this, play)) { + Player_StartTalking(play, this->talkActor); + } else if (!Player_ActionHandler_13(this, play)) { func_8083A098(this, &gPlayerAnim_link_normal_okarina_end, play); } @@ -13671,17 +14391,17 @@ void Player_Action_8084E604(Player* this, PlayState* play) { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_ARROW, this->bodyPartsPos[PLAYER_BODYPART_R_HAND].x, this->bodyPartsPos[PLAYER_BODYPART_R_HAND].y, this->bodyPartsPos[PLAYER_BODYPART_R_HAND].z, 4000, this->actor.shape.rot.y, 0, ARROW_NUT, true); - func_80832698(this, NA_SE_VO_LI_SWORD_N); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_N); } - func_8083721C(this); + Player_DecelerateToZero(this); } static AnimSfxEntry D_808549E0[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_7, 87) }, - { NA_SE_VO_LI_CLIMB_END, ANIMSFX_DATA(ANIMSFX_TYPE_4, 87) }, - { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_4, 69) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_5, 123) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_JUMPING, 87) }, + { NA_SE_VO_LI_CLIMB_END, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 87) }, + { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 69) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_LANDING, 123) }, }; void Player_Action_8084E6D4(Player* this, PlayState* play) { @@ -13694,7 +14414,7 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { } if (func_8084DFF4(play, this) && (this->av2.actionVar2 == 1)) { - cond = ((this->targetActor != NULL) && (this->exchangeItemId < 0)) || + cond = ((this->talkActor != NULL) && (this->exchangeItemId < 0)) || (this->stateFlags3 & PLAYER_STATE3_FORCE_PULL_OCARINA); if (cond || (gSaveContext.healthAccumulator == 0)) { @@ -13703,7 +14423,7 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { this->exchangeItemId = EXCH_ITEM_NONE; if (func_8084B4D4(play, this) == 0) { - Player_StartTalking(play, this->targetActor); + Player_StartTalking(play, this->talkActor); } } else { func_8084DFAC(play, this); @@ -13711,10 +14431,10 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { } } } else { - func_80832DBC(this); + Player_FinishAnimMovement(this); if ((this->getItemId == GI_ICE_TRAP && !IS_RANDO) || (IS_RANDO && (this->getItemId == RG_ICE_TRAP || this->getItemEntry.getItemId == RG_ICE_TRAP))) { - this->stateFlags1 &= ~(PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_ITEM_OVER_HEAD); + this->stateFlags1 &= ~(PLAYER_STATE1_GETTING_ITEM | PLAYER_STATE1_CARRYING_ACTOR); if ((this->getItemId != GI_ICE_TRAP && !IS_RANDO) || (IS_RANDO && (this->getItemId != RG_ICE_TRAP || this->getItemEntry.getItemId != RG_ICE_TRAP))) { @@ -13727,7 +14447,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; } @@ -13760,7 +14480,7 @@ void Player_Action_8084E6D4(Player* this, PlayState* play) { } static AnimSfxEntry D_808549F0[] = { - { NA_SE_IT_MASTER_SWORD_SWING, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 60) }, + { NA_SE_IT_MASTER_SWORD_SWING, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 60) }, }; void func_8084E988(Player* this) { @@ -13768,8 +14488,8 @@ void func_8084E988(Player* this) { } static AnimSfxEntry D_808549F4[] = { - { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_4, 5) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_5, 15) }, + { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 5) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_LANDING, 15) }, }; void Player_Action_8084E9AC(Player* this, PlayState* play) { @@ -13784,7 +14504,7 @@ void Player_Action_8084E9AC(Player* this, PlayState* play) { } } else { if (LINK_IS_ADULT && LinkAnimation_OnFrame(&this->skelAnime, 158.0f)) { - func_80832698(this, NA_SE_VO_LI_SWORD_N); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_N); return; } @@ -13920,80 +14640,95 @@ void Player_Action_8084EAC0(Player* this, PlayState* play) { this->av2.actionVar2 = 2; Player_UpdateBottleHeld(play, this, ITEM_BOTTLE, PLAYER_IA_BOTTLE); } - func_80832698(this, NA_SE_VO_LI_DRINK - SFX_FLAG); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_DRINK - SFX_FLAG); } else if ((this->av2.actionVar2 == 2) && LinkAnimation_OnFrame(&this->skelAnime, 29.0f)) { - func_80832698(this, NA_SE_VO_LI_BREATH_DRINK); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_BREATH_DRINK); } } -static BottleCatchInfo D_80854A04[] = { - { ACTOR_EN_ELF, ITEM_FAIRY, 0x2A, 0x46 }, - { ACTOR_EN_FISH, ITEM_FISH, 0x1F, 0x47 }, - { ACTOR_EN_ICE_HONO, ITEM_BLUE_FIRE, 0x20, 0x5D }, - { ACTOR_EN_INSECT, ITEM_BUG, 0x21, 0x7A }, +typedef enum BottleCatchType { + BOTTLE_CATCH_NONE, // This type does not have an associated entry in `sBottleCatchInfo` + BOTTLE_CATCH_FAIRY, + BOTTLE_CATCH_FISH, + BOTTLE_CATCH_BLUE_FIRE, + BOTTLE_CATCH_BUGS +} BottleCatchType; + +typedef struct BottleCatchInfo { + /* 0x00 */ s16 actorId; + /* 0x02 */ u8 itemId; + /* 0x03 */ u8 itemAction; + /* 0x04 */ u8 textId; +} BottleCatchInfo; // size = 0x06 + +static BottleCatchInfo sBottleCatchInfo[] = { + { ACTOR_EN_ELF, ITEM_FAIRY, PLAYER_IA_BOTTLE_FAIRY, 0x46 }, // BOTTLE_CATCH_FAIRY + { ACTOR_EN_FISH, ITEM_FISH, PLAYER_IA_BOTTLE_FISH, 0x47 }, // BOTTLE_CATCH_FISH + { ACTOR_EN_ICE_HONO, ITEM_BLUE_FIRE, PLAYER_IA_BOTTLE_FIRE, 0x5D }, // BOTTLE_CATCH_BLUE_FIRE + { ACTOR_EN_INSECT, ITEM_BUG, PLAYER_IA_BOTTLE_BUG, 0x7A }, // BOTTLE_CATCH_BUGS }; -void Player_Action_8084ECA4(Player* this, PlayState* play) { - struct_80854554* sp24; - BottleCatchInfo* catchInfo; - s32 temp; - s32 i, j; - FishIdentity fish; - GetItemEntry gi = GET_ITEM_NONE; - RandomizerCheck rc = RC_UNKNOWN_CHECK; - u8 catchId; +void Player_Action_SwingBottle(Player* this, PlayState* play) { + // Action Variable 2 has two separate uses within the same action. + // After it is used as `inWater` here, it will be used for `startedTextbox` below. + // The two usages will never overlap, so this won't cause any issues. + BottleSwingInfo* swingEntry = &sBottleSwingInfo[this->av2.inWater]; - func_8083721C(this); + Player_DecelerateToZero(this); if (LinkAnimation_Update(play, &this->skelAnime)) { - if (this->av1.actionVar1 != 0) { - if (this->av2.actionVar2 == 0) { + if (this->av1.bottleCatchType != BOTTLE_CATCH_NONE) { + if (!this->av2.startedTextbox) { if (CVarGetInteger(CVAR_ENHANCEMENT("FastDrops"), 0)) { - this->av1.actionVar1 = 0; + this->av1.bottleCatchType = BOTTLE_CATCH_NONE; } else { - Message_StartTextbox(play, D_80854A04[this->av1.actionVar1 - 1].textId, &this->actor); + // 1 is subtracted because `sBottleCatchInfo` does not have an entry for `BOTTLE_CATCH_NONE` + Message_StartTextbox(play, sBottleCatchInfo[this->av1.bottleCatchType - 1].textId, &this->actor); } Audio_PlayFanfare(NA_BGM_ITEM_GET | 0x900); - this->av2.actionVar2 = 1; + this->av2.startedTextbox = true; } else if (Message_GetState(&play->msgCtx) == TEXT_STATE_CLOSING) { - this->av1.actionVar1 = 0; + this->av1.bottleCatchType = BOTTLE_CATCH_NONE; func_8005B1A4(Play_GetCamera(play, 0)); } } else { func_8083C0E8(this, play); } - } else { - if (this->av1.actionVar1 == 0) { - sp24 = &D_80854554[this->av2.actionVar2]; - temp = this->skelAnime.curFrame - sp24->unk_08; + } else if (this->av1.bottleCatchType == BOTTLE_CATCH_NONE) { + s32 activeFrame = this->skelAnime.curFrame - swingEntry->firstActiveFrame; - if (temp >= 0) { - if (sp24->unk_09 >= temp) { - if (this->av2.actionVar2 != 0) { - if (temp == 0) { - Player_PlaySfx(this, NA_SE_IT_SCOOP_UP_WATER); - } + if (activeFrame >= 0 && activeFrame <= swingEntry->numActiveFrames) { + if (this->av2.inWater && activeFrame == 0) { + // Play water scoop sound on the first active frame, if applicable + Player_PlaySfx(this, NA_SE_IT_SCOOP_UP_WATER); + } + + // `interactRangeActor` will be set by the Get Item system. See `Actor_OfferGetItem`. + if (this->interactRangeActor != NULL) { + BottleCatchInfo* catchInfo = &sBottleCatchInfo[0]; + s32 i; + + // Try to find an `interactRangeActor` with the same ID as an entry in `sBottleCatchInfo` + for (i = 0; i < ARRAY_COUNT(sBottleCatchInfo); i++, catchInfo++) { + if (this->interactRangeActor->id == catchInfo->actorId) { + break; } + } - if (this->interactRangeActor != NULL) { - catchInfo = &D_80854A04[0]; - for (i = 0; i < 4; i++, catchInfo++) { - if (this->interactRangeActor->id == catchInfo->actorId) { - break; - } - } + if (GameInteractor_Should(VB_BOTTLE_ACTOR, i < ARRAY_COUNT(sBottleCatchInfo), this->interactRangeActor)) { + // 1 is added because `sBottleCatchInfo` does not have an entry for `BOTTLE_CATCH_NONE` + this->av1.bottleCatchType = i + 1; - if (GameInteractor_Should(VB_BOTTLE_ACTOR, i < 4, this->interactRangeActor)) { - this->av1.actionVar1 = i + 1; - this->av2.actionVar2 = 0; - this->interactRangeActor->parent = &this->actor; - Player_UpdateBottleHeld(play, this, catchInfo->itemId, ABS(catchInfo->itemAction)); - if (!CVarGetInteger(CVAR_ENHANCEMENT("FastDrops"), 0)) { - this->stateFlags1 |= PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE; - Player_AnimPlayOnceAdjusted(play, this, sp24->unk_04); - func_80835EA4(play, 4); - } - } + this->av2.startedTextbox = false; + if (!CVarGetInteger(CVAR_ENHANCEMENT("FastDrops"), 0)) { + this->stateFlags1 |= PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE; + } + this->interactRangeActor->parent = &this->actor; + + Player_UpdateBottleHeld(play, this, catchInfo->itemId, ABS(catchInfo->itemAction)); + if (!CVarGetInteger(CVAR_ENHANCEMENT("FastDrops"), 0)) { + Player_AnimPlayOnceAdjusted(play, this, swingEntry->catchAnimation); + func_80835EA4(play, 4); } } } @@ -14043,12 +14778,12 @@ static BottleDropInfo D_80854A28[] = { }; static AnimSfxEntry D_80854A34[] = { - { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_4, 38) }, - { NA_SE_EV_BOTTLE_CAP_OPEN, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 40) }, + { NA_SE_VO_LI_AUTO_JUMP, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 38) }, + { NA_SE_EV_BOTTLE_CAP_OPEN, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 40) }, }; void Player_Action_8084EFC0(Player* this, PlayState* play) { - func_8083721C(this); + Player_DecelerateToZero(this); if (LinkAnimation_Update(play, &this->skelAnime)) { func_8083C0E8(this, play); @@ -14072,24 +14807,24 @@ void Player_Action_8084EFC0(Player* this, PlayState* play) { } static AnimSfxEntry D_80854A3C[] = { - { NA_SE_PL_PUT_OUT_ITEM, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 30) }, + { NA_SE_PL_PUT_OUT_ITEM, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 30) }, }; -void Player_Action_8084F104(Player* this, PlayState* play) { +void Player_Action_ExchangeItem(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET; if (LinkAnimation_Update(play, &this->skelAnime)) { if (this->av2.actionVar2 < 0) { func_8083C0E8(this, play); } else if (this->exchangeItemId == EXCH_ITEM_NONE) { - Actor* targetActor = this->targetActor; + Actor* talkActor = this->talkActor; this->unk_862 = 0; - if (targetActor->textId != 0xFFFF) { + if (talkActor->textId != 0xFFFF) { this->actor.flags |= ACTOR_FLAG_PLAYER_TALKED_TO; } - Player_StartTalking(play, targetActor); + Player_StartTalking(play, talkActor); } else { GetItemEntry giEntry = ItemTable_Retrieve(D_80854528[this->exchangeItemId - 1]); @@ -14102,6 +14837,8 @@ void Player_Action_8084F104(Player* this, PlayState* play) { } if (this->av2.actionVar2 == 0) { + s32 pad; + Message_StartTextbox(play, this->actor.textId, &this->actor); if ((this->itemAction == PLAYER_IA_CHICKEN) || (this->itemAction == PLAYER_IA_POCKET_CUCCO)) { @@ -14127,12 +14864,12 @@ void Player_Action_8084F104(Player* this, PlayState* play) { Player_ProcessAnimSfxList(this, D_80854A3C); } - if ((this->av1.actionVar1 == 0) && (this->unk_664 != NULL)) { + if ((this->av1.actionVar1 == 0) && (this->focusActor != NULL)) { this->yaw = this->actor.shape.rot.y = func_8083DB98(this, 0); } } -void func_8084F308(Player* this, PlayState* play) { +void Player_Action_8084F308(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; if (LinkAnimation_Update(play, &this->skelAnime)) { @@ -14145,65 +14882,64 @@ void func_8084F308(Player* this, PlayState* play) { } } -void Player_Action_8084F390(Player* this, PlayState* play) { - CollisionPoly* floorPoly; - f32 sp50; - f32 sp4C; - f32 sp48; - s16 sp46; - s16 sp44; - Vec3f sp38; - +void Player_Action_SlideOnSlope(Player* this, PlayState* play) { this->stateFlags2 |= PLAYER_STATE2_DISABLE_ROTATION_Z_TARGET | PLAYER_STATE2_DISABLE_ROTATION_ALWAYS; LinkAnimation_Update(play, &this->skelAnime); func_8084269C(play, this); func_800F4138(&this->actor.projectedPos, NA_SE_PL_SLIP_LEVEL - SFX_FLAG, this->actor.speedXZ); - if (Player_ActionChange_13(this, play) == 0) { - floorPoly = this->actor.floorPoly; + if (Player_ActionHandler_13(this, play) == 0) { + CollisionPoly* floorPoly = this->actor.floorPoly; + f32 xzSpeedTarget; + f32 xzSpeedIncrStep; + f32 xzSpeedDecrStep; + s16 downwardSlopeYaw; + s16 shapeYawTarget; + Vec3f slopeNormal; if (floorPoly == NULL) { func_80837B9C(this, play); return; } - Player_GetSlopeDirection(floorPoly, &sp38, &sp46); + Player_GetSlopeDirection(floorPoly, &slopeNormal, &downwardSlopeYaw); - sp44 = sp46; - if (this->av1.actionVar1 != 0) { - sp44 = sp46 + 0x8000; + shapeYawTarget = downwardSlopeYaw; + if (this->av1.facingUpSlope) { + shapeYawTarget = downwardSlopeYaw + 0x8000; } if (this->linearVelocity < 0) { - sp46 += 0x8000; + downwardSlopeYaw += 0x8000; } - sp50 = (1.0f - sp38.y) * 40.0f; - sp50 = CLAMP(sp50, 0, 10.0f); - sp4C = (sp50 * sp50) * 0.015f; - sp48 = sp38.y * 0.01f; + xzSpeedTarget = (1.0f - slopeNormal.y) * 40.0f; + xzSpeedTarget = CLAMP(xzSpeedTarget, 0, 10.0f); + xzSpeedIncrStep = SQ(xzSpeedTarget) * 0.015f; + xzSpeedDecrStep = slopeNormal.y * 0.01f; if (SurfaceType_GetSlope(&play->colCtx, floorPoly, this->actor.floorBgId) != 1) { - sp50 = 0; - sp48 = sp38.y * 10.0f; + xzSpeedTarget = 0; + xzSpeedDecrStep = slopeNormal.y * 10.0f; } - if (sp4C < 1.0f) { - sp4C = 1.0f; + if (xzSpeedIncrStep < 1.0f) { + xzSpeedIncrStep = 1.0f; } - if (Math_AsymStepToF(&this->linearVelocity, sp50, sp4C, sp48) && (sp50 == 0)) { - LinkAnimationHeader* anim; - if (this->av1.actionVar1 == 0) { - anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_down_slope_slip_end, this->modelAnimType); + if (Math_AsymStepToF(&this->linearVelocity, xzSpeedTarget, xzSpeedIncrStep, xzSpeedDecrStep) && (xzSpeedTarget == 0)) { + LinkAnimationHeader* slideAnimation; + + if (!this->av1.facingUpSlope) { + slideAnimation = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_down_slope_slip_end, this->modelAnimType); } else { - anim = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_up_slope_slip_end, this->modelAnimType); + slideAnimation = GET_PLAYER_ANIM(PLAYER_ANIMGROUP_up_slope_slip_end, this->modelAnimType); } - func_8083A098(this, anim, play); + func_8083A098(this, slideAnimation, play); } - Math_SmoothStepToS(&this->yaw, sp46, 10, 4000, 800); - Math_ScaledStepToS(&this->actor.shape.rot.y, sp44, 2000); + Math_SmoothStepToS(&this->yaw, downwardSlopeYaw, 10, 4000, 800); + Math_ScaledStepToS(&this->actor.shape.rot.y, shapeYawTarget, 2000); } } @@ -14232,7 +14968,7 @@ void Player_Action_8084F710(Player* this, PlayState* play) { if (this->av2.actionVar2 == 0) { if (this->actor.bgCheckFlags & 1) { this->skelAnime.endFrame = this->skelAnime.animLength - 1.0f; - func_808328A0(this); + Player_PlayLandingSfx(this); this->av2.actionVar2 = 1; } } else { @@ -14289,7 +15025,7 @@ void Player_Action_8084F88C(Player* this, PlayState* play) { } void Player_Action_8084F9A0(Player* this, PlayState* play) { - Player_ActionChange_1(this, play); + Player_ActionHandler_1(this, play); } void Player_Action_8084F9C0(Player* this, PlayState* play) { @@ -14311,8 +15047,8 @@ void Player_Action_8084FA54(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); Player_UpdateUpperBody(this, play); - this->unk_6BE = func_8084ABD8(play, this, 1, 0) - this->actor.shape.rot.y; - this->unk_6AE |= 0x80; + this->upperLimbRot.y = func_8084ABD8(play, this, 1, 0) - this->actor.shape.rot.y; + this->unk_6AE_rotFlags |= UNK6AE_ROT_UPPER_Y; if (play->shootingGalleryStatus < 0) { play->shootingGalleryStatus++; @@ -14342,7 +15078,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); } } } @@ -14361,7 +15097,27 @@ void Player_Action_8084FBF4(Player* this, PlayState* play) { func_8002F8F0(&this->actor, NA_SE_VO_LI_TAKEN_AWAY - SFX_FLAG + this->ageProperties->unk_92); } -s32 func_8084FCAC(Player* this, PlayState* play) { +/** + * Updates the "Noclip" debug feature, which allows the player to fly around anywhere + * in the world and clip through any collision. + * + * Noclip can be toggled on and off with two different button combos: + * Hold L + R + A and press B + * or + * Hold L and press D-pad right + * + * To control Noclip mode: + * - Move horizontally with the 4 D-pad directions + * - Move up with B + * - Move down with A + * - Hold R to move faster + * + * With Noclip enabled, another button combination can be pressed to set all "temp clear" flags + * in the current room. To do so hold L and press D-pad left. + * + * @return true if Noclip is disabled, false if enabled + */ +s32 Player_UpdateNoclip(Player* this, PlayState* play) { sControlInput = &play->state.input[0]; if (CVarGetInteger(CVAR_DEVELOPER_TOOLS("DebugEnabled"), 0) && @@ -14369,14 +15125,14 @@ s32 func_8084FCAC(Player* this, PlayState* play) { CHECK_BTN_ALL(sControlInput->press.button, BTN_B)) || (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DRIGHT)))) { - D_808535D0 ^= 1; + sNoclipEnabled ^= 1; - if (D_808535D0) { + if (sNoclipEnabled) { Camera_ChangeMode(Play_GetCamera(play, 0), CAM_MODE_BOWARROWZ); } } - if (D_808535D0) { + if (sNoclipEnabled) { f32 speed; if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_R)) { @@ -14416,9 +15172,7 @@ s32 func_8084FCAC(Player* this, PlayState* play) { Player_ZeroSpeedXZ(this); this->actor.gravity = 0.0f; - this->actor.velocity.z = 0.0f; - this->actor.velocity.y = 0.0f; - this->actor.velocity.x = 0.0f; + this->actor.velocity.x = this->actor.velocity.z = this->actor.velocity.y = 0.0f; if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_L) && CHECK_BTN_ALL(sControlInput->press.button, BTN_DLEFT)) { Flags_SetTempClear(play, play->roomCtx.curRoom.num); @@ -14426,10 +15180,10 @@ s32 func_8084FCAC(Player* this, PlayState* play) { Math_Vec3f_Copy(&this->actor.home.pos, &this->actor.world.pos); - return 0; + return false; } - return 1; + return true; } void func_8084FF7C(Player* this) { @@ -14455,7 +15209,7 @@ void Player_UpdateBunnyEars(Player* this) { // Damping: decay by 1/8 the previous value each frame sBunnyEarKinematics.angVel.x -= sBunnyEarKinematics.angVel.x >> 3; sBunnyEarKinematics.angVel.y -= sBunnyEarKinematics.angVel.y >> 3; - + // Elastic restorative force sBunnyEarKinematics.angVel.x += -sBunnyEarKinematics.rot.x >> 2; sBunnyEarKinematics.angVel.y += -sBunnyEarKinematics.rot.y >> 2; @@ -14492,7 +15246,7 @@ void Player_UpdateBunnyEars(Player* this) { } } -s32 Player_ActionChange_7(Player* this, PlayState* play) { +s32 Player_ActionHandler_7(Player* this, PlayState* play) { if (func_8083C6B8(play, this) == 0) { if (func_8083BB20(this) != 0) { s32 sp24 = func_80837818(this); @@ -14536,11 +15290,11 @@ void Player_Action_808502D0(Player* this, PlayState* play) { func_8083C50C(this); if (LinkAnimation_Update(play, &this->skelAnime)) { - if (!Player_ActionChange_7(this, play)) { + if (!Player_ActionHandler_7(this, play)) { u8 sp43 = this->skelAnime.moveFlags; LinkAnimationHeader* sp3C; - if (func_8008E9C4(this)) { + if (Player_CheckHostileLockOn(this)) { sp3C = sp44->unk_08; } else { sp3C = sp44->unk_04; @@ -14570,7 +15324,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) { sp2C = this->actor.world.pos.y - shockwavePos.y; Math_ScaledStepToS(&this->actor.focus.rot.x, Math_Atan2S(45.0f, sp2C), 800); - func_80836AB8(this, 1); + func_80836AB8(this, true); if ((((this->meleeWeaponAnimation == PLAYER_MWA_HAMMER_FORWARD) && LinkAnimation_OnFrame(&this->skelAnime, 7.0f)) || ((this->meleeWeaponAnimation == PLAYER_MWA_JUMPSLASH_FINISH) && LinkAnimation_OnFrame(&this->skelAnime, 2.0f))) && @@ -14585,7 +15339,7 @@ void Player_Action_808502D0(Player* this, PlayState* play) { void Player_Action_808505DC(Player* this, PlayState* play) { LinkAnimation_Update(play, &this->skelAnime); - func_8083721C(this); + Player_DecelerateToZero(this); if (this->skelAnime.curFrame >= 6.0f) { func_80839FFC(this, play); @@ -14664,23 +15418,23 @@ static LinkAnimationHeader* D_80854A70[] = { static u8 D_80854A7C[] = { 70, 10, 10 }; static AnimSfxEntry D_80854A80[] = { - { NA_SE_PL_SKIP, ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, - { NA_SE_VO_LI_SWORD_N, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 26) }, + { NA_SE_PL_SKIP, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 20) }, + { NA_SE_VO_LI_SWORD_N, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 20) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 26) }, }; static AnimSfxEntry D_80854A8C[][2] = { { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, - { NA_SE_VO_LI_MAGIC_FROL, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 30) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 20) }, + { NA_SE_VO_LI_MAGIC_FROL, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 30) }, }, { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 20) }, - { NA_SE_VO_LI_MAGIC_NALE, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 44) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 20) }, + { NA_SE_VO_LI_MAGIC_NALE, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 44) }, }, { - { NA_SE_VO_LI_MAGIC_ATTACK, ANIMSFX_DATA(ANIMSFX_TYPE_4, 20) }, - { NA_SE_IT_SWORD_SWING_HARD, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 20) }, + { NA_SE_VO_LI_MAGIC_ATTACK, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 20) }, + { NA_SE_IT_SWORD_SWING_HARD, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 20) }, }, }; @@ -14696,7 +15450,7 @@ void Player_Action_808507F4(Player* this, PlayState* play) { if (this->av2.actionVar2 == 0) { LinkAnimation_PlayOnceSetSpeed(play, &this->skelAnime, D_80854A58[this->av1.actionVar1], 0.83f * (isFastFarores ? 2 : 1)); - if (func_80846A00(play, this, this->av1.actionVar1) != NULL) { + if (Player_SpawnMagicSpell(play, this, this->av1.actionVar1) != NULL) { this->stateFlags1 |= PLAYER_STATE1_IN_ITEM_CS | PLAYER_STATE1_IN_CUTSCENE; if ((this->av1.actionVar1 != 0) || (gSaveContext.respawn[RESPAWN_MODE_TOP].data <= 0)) { gSaveContext.magicState = MAGIC_STATE_CONSUME_SETUP; @@ -14749,7 +15503,7 @@ void Player_Action_808507F4(Player* this, PlayState* play) { } } - func_8083721C(this); + Player_DecelerateToZero(this); } void Player_Action_80850AEC(Player* this, PlayState* play) { @@ -14792,6 +15546,12 @@ void Player_Action_80850AEC(Player* this, PlayState* play) { void Player_Action_80850C68(Player* this, PlayState* play) { if ((this->av2.actionVar2 != 0) && ((this->unk_858 != 0.0f) || (this->unk_85C != 0.0f))) { + // 144-byte buffer, declared as a u64 array for 8-byte alignment. LinkAnimation_BlendToMorph will round up + // the buffer address to the nearest 16-byte alignment before passing it to AnimTaskQueue_AddLoadPlayerFrame, + // and AnimTaskQueue_AddLoadPlayerFrame requires space for `sizeof(Vec3s) * limbCount + 2` bytes. Link's + // skeleton has 22 limbs (including the root limb) so we need 134 bytes of space, plus 8 bytes of margin for + // the 16-byte alignment operation. + static u64 D_80858AD8[18]; f32 updateScale = R_UPDATE_RATE * 0.5f; this->skelAnime.curFrame += this->skelAnime.playSpeed * updateScale; @@ -14806,7 +15566,7 @@ void Player_Action_80850C68(Player* this, PlayState* play) { LinkAnimation_BlendToMorph( play, &this->skelAnime, &gPlayerAnim_link_fishing_wait, this->skelAnime.curFrame, (this->unk_85C < 0.0f) ? &gPlayerAnim_link_fishing_reel_up : &gPlayerAnim_link_fishing_reel_down, 5.0f, - fabsf(this->unk_85C), D_80858AD8); + fabsf(this->unk_85C), (Vec3s*)D_80858AD8); LinkAnimation_InterpJointMorph(play, &this->skelAnime, 0.5f); } else if (LinkAnimation_Update(play, &this->skelAnime)) { this->unk_860 = 2; @@ -14814,7 +15574,7 @@ void Player_Action_80850C68(Player* this, PlayState* play) { this->av2.actionVar2 = 1; } - func_8083721C(this); + Player_DecelerateToZero(this); if (this->unk_860 == 0) { func_80853080(this, play); @@ -14837,234 +15597,234 @@ static void (*D_80854AA4[])(PlayState*, Player*, void*) = { }; static AnimSfxEntry D_80854AF0[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_5, 34) }, - { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 45) }, - { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_1, 51) }, - { NA_SE_PL_CALM_HIT, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 64) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_LANDING, 34) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 45) }, + { NA_SE_PL_CALM_HIT, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 51) }, + { NA_SE_PL_CALM_HIT, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 64) }, }; static AnimSfxEntry D_80854B00[] = { - { NA_SE_VO_LI_SURPRISE, ANIMSFX_DATA(ANIMSFX_TYPE_4, 3) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 15) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 24) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 30) }, - { NA_SE_VO_LI_FALL_L, -ANIMSFX_DATA(ANIMSFX_TYPE_4, 31) }, + { NA_SE_VO_LI_SURPRISE, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 3) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 15) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 24) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 30) }, + { NA_SE_VO_LI_FALL_L, -ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 31) }, }; static AnimSfxEntry D_80854B14[] = { - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 10) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 10) }, }; -static struct_80854B18 D_80854B18[] = { - { 0, NULL }, - { -1, func_808515A4 }, - { 2, &gPlayerAnim_link_demo_goma_furimuki }, - { 0, NULL }, - { 0, NULL }, - { 3, &gPlayerAnim_link_demo_bikkuri }, - { 0, NULL }, - { 0, NULL }, - { -1, func_808515A4 }, - { 2, &gPlayerAnim_link_demo_furimuki }, - { -1, func_80851788 }, - { 3, &gPlayerAnim_link_demo_warp }, - { -1, func_808518DC }, - { 7, &gPlayerAnim_clink_demo_get1 }, - { 5, &gPlayerAnim_clink_demo_get2 }, - { 5, &gPlayerAnim_clink_demo_get3 }, - { 5, &gPlayerAnim_clink_demo_standup }, - { 7, &gPlayerAnim_clink_demo_standup_wait }, - { -1, func_808519EC }, - { 2, &gPlayerAnim_link_demo_baru_op1 }, - { 2, &gPlayerAnim_link_demo_baru_op3 }, - { 0, NULL }, - { -1, func_80851B90 }, - { 3, &gPlayerAnim_link_demo_jibunmiru }, - { 9, &gPlayerAnim_link_normal_back_downA }, - { 2, &gPlayerAnim_link_normal_back_down_wake }, - { -1, func_80851D2C }, - { 2, &gPlayerAnim_link_normal_okarina_end }, - { 3, &gPlayerAnim_link_demo_get_itemA }, - { -1, func_808515A4 }, - { 2, &gPlayerAnim_link_normal_normal2fighter_free }, - { 0, NULL }, - { 0, NULL }, - { 5, &gPlayerAnim_clink_demo_atozusari }, - { -1, func_80851368 }, - { -1, func_80851E64 }, - { 5, &gPlayerAnim_clink_demo_bashi }, - { 16, &gPlayerAnim_link_normal_hang_up_down }, - { -1, func_80851F84 }, - { -1, func_80851E90 }, - { 6, &gPlayerAnim_clink_op3_okiagari }, - { 6, &gPlayerAnim_clink_op3_tatiagari }, - { -1, func_80852080 }, - { 5, &gPlayerAnim_clink_demo_miokuri }, - { -1, func_808521F4 }, - { -1, func_8085225C }, - { -1, func_80852280 }, - { 5, &gPlayerAnim_clink_demo_nozoki }, - { 5, &gPlayerAnim_clink_demo_koutai }, - { -1, func_808515A4 }, - { 5, &gPlayerAnim_clink_demo_koutai_kennuki }, - { 5, &gPlayerAnim_link_demo_kakeyori }, - { 5, &gPlayerAnim_link_demo_kakeyori_mimawasi }, - { 5, &gPlayerAnim_link_demo_kakeyori_miokuri }, - { 3, &gPlayerAnim_link_demo_furimuki2 }, - { 3, &gPlayerAnim_link_demo_kaoage }, - { 4, &gPlayerAnim_link_demo_kaoage_wait }, - { 3, &gPlayerAnim_clink_demo_mimawasi }, - { 3, &gPlayerAnim_link_demo_nozokikomi }, - { 6, &gPlayerAnim_kolink_odoroki_demo }, - { 6, &gPlayerAnim_link_shagamu_demo }, - { 14, &gPlayerAnim_link_okiru_demo }, - { 3, &gPlayerAnim_link_okiru_demo }, - { 5, &gPlayerAnim_link_fighter_power_kiru_start }, - { 16, &gPlayerAnim_demo_link_nwait }, - { 15, &gPlayerAnim_demo_link_tewatashi }, - { 15, &gPlayerAnim_demo_link_orosuu }, - { 3, &gPlayerAnim_d_link_orooro }, - { 3, &gPlayerAnim_d_link_imanodare }, - { 3, &gPlayerAnim_link_hatto_demo }, - { 6, &gPlayerAnim_o_get_mae }, - { 6, &gPlayerAnim_o_get_ato }, - { 6, &gPlayerAnim_om_get_mae }, - { 6, &gPlayerAnim_nw_modoru }, - { 3, &gPlayerAnim_link_demo_gurad }, - { 3, &gPlayerAnim_link_demo_look_hand }, - { 4, &gPlayerAnim_link_demo_sita_wait }, - { 3, &gPlayerAnim_link_demo_ue }, - { 3, &gPlayerAnim_Link_muku }, - { 3, &gPlayerAnim_Link_miageru }, - { 6, &gPlayerAnim_Link_ha }, - { 3, &gPlayerAnim_L_1kyoro }, - { 3, &gPlayerAnim_L_2kyoro }, - { 3, &gPlayerAnim_L_sagaru }, - { 3, &gPlayerAnim_L_bouzen }, - { 3, &gPlayerAnim_L_kamaeru }, - { 3, &gPlayerAnim_L_hajikareru }, - { 3, &gPlayerAnim_L_ken_miru }, - { 3, &gPlayerAnim_L_mukinaoru }, - { -1, func_808524B0 }, - { 3, &gPlayerAnim_link_wait_itemD1_20f }, - { -1, func_80852544 }, - { -1, func_80852564 }, - { 3, &gPlayerAnim_link_normal_wait_typeB_20f }, - { -1, func_80852608 }, - { 3, &gPlayerAnim_link_demo_kousan }, - { 3, &gPlayerAnim_link_demo_return_to_past }, - { 3, &gPlayerAnim_link_last_hit_motion1 }, - { 3, &gPlayerAnim_link_last_hit_motion2 }, - { 3, &gPlayerAnim_link_demo_zeldamiru }, - { 3, &gPlayerAnim_link_demo_kenmiru1 }, - { 3, &gPlayerAnim_link_demo_kenmiru2 }, - { 3, &gPlayerAnim_link_demo_kenmiru2_modori }, +static struct_80854B18 D_80854B18[PLAYER_CSACTION_MAX] = { + { 0, NULL }, // PLAYER_CSACTION_NONE + { -1, func_808515A4 }, // PLAYER_CSACTION_1 + { 2, &gPlayerAnim_link_demo_goma_furimuki }, // PLAYER_CSACTION_2 + { 0, NULL }, // PLAYER_CSACTION_3 + { 0, NULL }, // PLAYER_CSACTION_4 + { 3, &gPlayerAnim_link_demo_bikkuri }, // PLAYER_CSACTION_5 + { 0, NULL }, // PLAYER_CSACTION_6 + { 0, NULL }, // PLAYER_CSACTION_7 + { -1, func_808515A4 }, // PLAYER_CSACTION_8 + { 2, &gPlayerAnim_link_demo_furimuki }, // PLAYER_CSACTION_9 + { -1, func_80851788 }, // PLAYER_CSACTION_10 + { 3, &gPlayerAnim_link_demo_warp }, // PLAYER_CSACTION_11 + { -1, func_808518DC }, // PLAYER_CSACTION_12 + { 7, &gPlayerAnim_clink_demo_get1 }, // PLAYER_CSACTION_13 + { 5, &gPlayerAnim_clink_demo_get2 }, // PLAYER_CSACTION_14 + { 5, &gPlayerAnim_clink_demo_get3 }, // PLAYER_CSACTION_15 + { 5, &gPlayerAnim_clink_demo_standup }, // PLAYER_CSACTION_16 + { 7, &gPlayerAnim_clink_demo_standup_wait }, // PLAYER_CSACTION_17 + { -1, func_808519EC }, // PLAYER_CSACTION_18 + { 2, &gPlayerAnim_link_demo_baru_op1 }, // PLAYER_CSACTION_19 + { 2, &gPlayerAnim_link_demo_baru_op3 }, // PLAYER_CSACTION_20 + { 0, NULL }, // PLAYER_CSACTION_21 + { -1, func_80851B90 }, // PLAYER_CSACTION_22 + { 3, &gPlayerAnim_link_demo_jibunmiru }, // PLAYER_CSACTION_23 + { 9, &gPlayerAnim_link_normal_back_downA }, // PLAYER_CSACTION_24 + { 2, &gPlayerAnim_link_normal_back_down_wake }, // PLAYER_CSACTION_25 + { -1, func_80851D2C }, // PLAYER_CSACTION_26 + { 2, &gPlayerAnim_link_normal_okarina_end }, // PLAYER_CSACTION_27 + { 3, &gPlayerAnim_link_demo_get_itemA }, // PLAYER_CSACTION_28 + { -1, func_808515A4 }, // PLAYER_CSACTION_29 + { 2, &gPlayerAnim_link_normal_normal2fighter_free }, // PLAYER_CSACTION_30 + { 0, NULL }, // PLAYER_CSACTION_31 + { 0, NULL }, // PLAYER_CSACTION_32 + { 5, &gPlayerAnim_clink_demo_atozusari }, // PLAYER_CSACTION_33 + { -1, func_80851368 }, // PLAYER_CSACTION_34 + { -1, func_80851E64 }, // PLAYER_CSACTION_35 + { 5, &gPlayerAnim_clink_demo_bashi }, // PLAYER_CSACTION_36 + { 16, &gPlayerAnim_link_normal_hang_up_down }, // PLAYER_CSACTION_37 + { -1, func_80851F84 }, // PLAYER_CSACTION_38 + { -1, func_80851E90 }, // PLAYER_CSACTION_39 + { 6, &gPlayerAnim_clink_op3_okiagari }, // PLAYER_CSACTION_40 + { 6, &gPlayerAnim_clink_op3_tatiagari }, // PLAYER_CSACTION_41 + { -1, func_80852080 }, // PLAYER_CSACTION_42 + { 5, &gPlayerAnim_clink_demo_miokuri }, // PLAYER_CSACTION_43 + { -1, func_808521F4 }, // PLAYER_CSACTION_44 + { -1, func_8085225C }, // PLAYER_CSACTION_45 + { -1, func_80852280 }, // PLAYER_CSACTION_46 + { 5, &gPlayerAnim_clink_demo_nozoki }, // PLAYER_CSACTION_47 + { 5, &gPlayerAnim_clink_demo_koutai }, // PLAYER_CSACTION_48 + { -1, func_808515A4 }, // PLAYER_CSACTION_49 + { 5, &gPlayerAnim_clink_demo_koutai_kennuki }, // PLAYER_CSACTION_50 + { 5, &gPlayerAnim_link_demo_kakeyori }, // PLAYER_CSACTION_51 + { 5, &gPlayerAnim_link_demo_kakeyori_mimawasi }, // PLAYER_CSACTION_52 + { 5, &gPlayerAnim_link_demo_kakeyori_miokuri }, // PLAYER_CSACTION_53 + { 3, &gPlayerAnim_link_demo_furimuki2 }, // PLAYER_CSACTION_54 + { 3, &gPlayerAnim_link_demo_kaoage }, // PLAYER_CSACTION_55 + { 4, &gPlayerAnim_link_demo_kaoage_wait }, // PLAYER_CSACTION_56 + { 3, &gPlayerAnim_clink_demo_mimawasi }, // PLAYER_CSACTION_57 + { 3, &gPlayerAnim_link_demo_nozokikomi }, // PLAYER_CSACTION_58 + { 6, &gPlayerAnim_kolink_odoroki_demo }, // PLAYER_CSACTION_59 + { 6, &gPlayerAnim_link_shagamu_demo }, // PLAYER_CSACTION_60 + { 14, &gPlayerAnim_link_okiru_demo }, // PLAYER_CSACTION_61 + { 3, &gPlayerAnim_link_okiru_demo }, // PLAYER_CSACTION_62 + { 5, &gPlayerAnim_link_fighter_power_kiru_start }, // PLAYER_CSACTION_63 + { 16, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSACTION_64 + { 15, &gPlayerAnim_demo_link_tewatashi }, // PLAYER_CSACTION_65 + { 15, &gPlayerAnim_demo_link_orosuu }, // PLAYER_CSACTION_66 + { 3, &gPlayerAnim_d_link_orooro }, // PLAYER_CSACTION_67 + { 3, &gPlayerAnim_d_link_imanodare }, // PLAYER_CSACTION_68 + { 3, &gPlayerAnim_link_hatto_demo }, // PLAYER_CSACTION_69 + { 6, &gPlayerAnim_o_get_mae }, // PLAYER_CSACTION_70 + { 6, &gPlayerAnim_o_get_ato }, // PLAYER_CSACTION_71 + { 6, &gPlayerAnim_om_get_mae }, // PLAYER_CSACTION_72 + { 6, &gPlayerAnim_nw_modoru }, // PLAYER_CSACTION_73 + { 3, &gPlayerAnim_link_demo_gurad }, // PLAYER_CSACTION_74 + { 3, &gPlayerAnim_link_demo_look_hand }, // PLAYER_CSACTION_75 + { 4, &gPlayerAnim_link_demo_sita_wait }, // PLAYER_CSACTION_76 + { 3, &gPlayerAnim_link_demo_ue }, // PLAYER_CSACTION_77 + { 3, &gPlayerAnim_Link_muku }, // PLAYER_CSACTION_78 + { 3, &gPlayerAnim_Link_miageru }, // PLAYER_CSACTION_79 + { 6, &gPlayerAnim_Link_ha }, // PLAYER_CSACTION_80 + { 3, &gPlayerAnim_L_1kyoro }, // PLAYER_CSACTION_81 + { 3, &gPlayerAnim_L_2kyoro }, // PLAYER_CSACTION_82 + { 3, &gPlayerAnim_L_sagaru }, // PLAYER_CSACTION_83 + { 3, &gPlayerAnim_L_bouzen }, // PLAYER_CSACTION_84 + { 3, &gPlayerAnim_L_kamaeru }, // PLAYER_CSACTION_85 + { 3, &gPlayerAnim_L_hajikareru }, // PLAYER_CSACTION_86 + { 3, &gPlayerAnim_L_ken_miru }, // PLAYER_CSACTION_87 + { 3, &gPlayerAnim_L_mukinaoru }, // PLAYER_CSACTION_88 + { -1, func_808524B0 }, // PLAYER_CSACTION_89 + { 3, &gPlayerAnim_link_wait_itemD1_20f }, // PLAYER_CSACTION_90 + { -1, func_80852544 }, // PLAYER_CSACTION_91 + { -1, func_80852564 }, // PLAYER_CSACTION_92 + { 3, &gPlayerAnim_link_normal_wait_typeB_20f }, // PLAYER_CSACTION_93 + { -1, func_80852608 }, // PLAYER_CSACTION_94 + { 3, &gPlayerAnim_link_demo_kousan }, // PLAYER_CSACTION_95 + { 3, &gPlayerAnim_link_demo_return_to_past }, // PLAYER_CSACTION_96 + { 3, &gPlayerAnim_link_last_hit_motion1 }, // PLAYER_CSACTION_97 + { 3, &gPlayerAnim_link_last_hit_motion2 }, // PLAYER_CSACTION_98 + { 3, &gPlayerAnim_link_demo_zeldamiru }, // PLAYER_CSACTION_99 + { 3, &gPlayerAnim_link_demo_kenmiru1 }, // PLAYER_CSACTION_100 + { 3, &gPlayerAnim_link_demo_kenmiru2 }, // PLAYER_CSACTION_101 + { 3, &gPlayerAnim_link_demo_kenmiru2_modori }, // PLAYER_CSACTION_102 }; -static struct_80854B18 D_80854E50[] = { - { 0, NULL }, - { -1, func_808514C0 }, - { -1, func_8085157C }, - { -1, func_80851998 }, - { -1, func_808519C0 }, - { 11, NULL }, - { -1, func_80852C50 }, - { -1, func_80852944 }, - { -1, func_80851688 }, - { -1, func_80851750 }, - { -1, func_80851828 }, - { -1, func_808521B8 }, - { -1, func_8085190C }, - { 11, NULL }, - { 11, NULL }, - { 11, NULL }, - { 18, D_80854AF0 }, - { 11, NULL }, - { -1, func_80851A50 }, - { 12, &gPlayerAnim_link_demo_baru_op2 }, - { 11, NULL }, - { 0, NULL }, - { -1, func_80851BE8 }, - { 11, NULL }, - { -1, func_80851CA4 }, - { 11, NULL }, - { 17, &gPlayerAnim_link_normal_okarina_swing }, - { 11, NULL }, - { 11, NULL }, - { 11, NULL }, - { -1, func_80851D80 }, - { -1, func_80851DEC }, - { -1, func_80851E28 }, - { 18, D_80854B00 }, - { -1, func_808513BC }, - { 11, NULL }, - { 11, NULL }, - { 11, NULL }, - { 11, NULL }, - { -1, func_80851ECC }, - { -1, func_80851FB0 }, - { -1, func_80852048 }, - { -1, func_80852174 }, - { 13, &gPlayerAnim_clink_demo_miokuri_wait }, - { -1, func_80852234 }, - { 0, NULL }, - { 0, NULL }, - { 11, NULL }, - { -1, func_80852450 }, - { -1, func_80851688 }, - { -1, func_80852298 }, - { 13, &gPlayerAnim_link_demo_kakeyori_wait }, - { -1, func_80852480 }, - { 13, &gPlayerAnim_link_demo_kakeyori_miokuri_wait }, - { -1, func_80852328 }, - { 11, NULL }, - { 11, NULL }, - { 12, &gPlayerAnim_clink_demo_mimawasi_wait }, - { -1, func_80852358 }, - { 11, NULL }, - { 18, D_80854B14 }, - { 11, NULL }, - { 11, NULL }, - { 11, NULL }, - { 11, NULL }, - { -1, func_80852388 }, - { 17, &gPlayerAnim_demo_link_nwait }, - { 12, &gPlayerAnim_d_link_orowait }, - { 12, &gPlayerAnim_demo_link_nwait }, - { 11, NULL }, - { -1, func_808526EC }, - { 17, &gPlayerAnim_sude_nwait }, - { -1, func_808526EC }, - { 17, &gPlayerAnim_sude_nwait }, - { 12, &gPlayerAnim_link_demo_gurad_wait }, - { 12, &gPlayerAnim_link_demo_look_hand_wait }, - { 11, NULL }, - { 12, &gPlayerAnim_link_demo_ue_wait }, - { 12, &gPlayerAnim_Link_m_wait }, - { 13, &gPlayerAnim_Link_ue_wait }, - { 12, &gPlayerAnim_Link_otituku_w }, - { 12, &gPlayerAnim_L_kw }, - { 11, NULL }, - { 11, NULL }, - { 11, NULL }, - { 11, NULL }, - { -1, func_80852648 }, - { 11, NULL }, - { 12, &gPlayerAnim_L_kennasi_w }, - { -1, func_808524D0 }, - { -1, func_80852514 }, - { -1, func_80852554 }, - { -1, func_808525C0 }, - { 11, NULL }, - { 11, NULL }, - { 11, NULL }, - { -1, func_8085283C }, - { -1, func_808528C8 }, - { -1, func_808528C8 }, - { 12, &gPlayerAnim_link_demo_zeldamiru_wait }, - { 12, &gPlayerAnim_link_demo_kenmiru1_wait }, - { 12, &gPlayerAnim_link_demo_kenmiru2_wait }, - { 12, &gPlayerAnim_demo_link_nwait }, +static struct_80854B18 D_80854E50[PLAYER_CSACTION_MAX] = { + { 0, NULL }, // PLAYER_CSACTION_NONE + { -1, func_808514C0 }, // PLAYER_CSACTION_1 + { -1, func_8085157C }, // PLAYER_CSACTION_2 + { -1, func_80851998 }, // PLAYER_CSACTION_3 + { -1, func_808519C0 }, // PLAYER_CSACTION_4 + { 11, NULL }, // PLAYER_CSACTION_5 + { -1, func_80852C50 }, // PLAYER_CSACTION_6 + { -1, func_80852944 }, // PLAYER_CSACTION_7 + { -1, func_80851688 }, // PLAYER_CSACTION_8 + { -1, func_80851750 }, // PLAYER_CSACTION_9 + { -1, func_80851828 }, // PLAYER_CSACTION_10 + { -1, func_808521B8 }, // PLAYER_CSACTION_11 + { -1, func_8085190C }, // PLAYER_CSACTION_12 + { 11, NULL }, // PLAYER_CSACTION_13 + { 11, NULL }, // PLAYER_CSACTION_14 + { 11, NULL }, // PLAYER_CSACTION_15 + { 18, D_80854AF0 }, // PLAYER_CSACTION_16 + { 11, NULL }, // PLAYER_CSACTION_17 + { -1, func_80851A50 }, // PLAYER_CSACTION_18 + { 12, &gPlayerAnim_link_demo_baru_op2 }, // PLAYER_CSACTION_19 + { 11, NULL }, // PLAYER_CSACTION_20 + { 0, NULL }, // PLAYER_CSACTION_21 + { -1, func_80851BE8 }, // PLAYER_CSACTION_22 + { 11, NULL }, // PLAYER_CSACTION_23 + { -1, func_80851CA4 }, // PLAYER_CSACTION_24 + { 11, NULL }, // PLAYER_CSACTION_25 + { 17, &gPlayerAnim_link_normal_okarina_swing }, // PLAYER_CSACTION_26 + { 11, NULL }, // PLAYER_CSACTION_27 + { 11, NULL }, // PLAYER_CSACTION_28 + { 11, NULL }, // PLAYER_CSACTION_29 + { -1, func_80851D80 }, // PLAYER_CSACTION_30 + { -1, func_80851DEC }, // PLAYER_CSACTION_31 + { -1, func_80851E28 }, // PLAYER_CSACTION_32 + { 18, D_80854B00 }, // PLAYER_CSACTION_33 + { -1, func_808513BC }, // PLAYER_CSACTION_34 + { 11, NULL }, // PLAYER_CSACTION_35 + { 11, NULL }, // PLAYER_CSACTION_36 + { 11, NULL }, // PLAYER_CSACTION_37 + { 11, NULL }, // PLAYER_CSACTION_38 + { -1, func_80851ECC }, // PLAYER_CSACTION_39 + { -1, func_80851FB0 }, // PLAYER_CSACTION_40 + { -1, func_80852048 }, // PLAYER_CSACTION_41 + { -1, func_80852174 }, // PLAYER_CSACTION_42 + { 13, &gPlayerAnim_clink_demo_miokuri_wait }, // PLAYER_CSACTION_43 + { -1, func_80852234 }, // PLAYER_CSACTION_44 + { 0, NULL }, // PLAYER_CSACTION_45 + { 0, NULL }, // PLAYER_CSACTION_46 + { 11, NULL }, // PLAYER_CSACTION_47 + { -1, func_80852450 }, // PLAYER_CSACTION_48 + { -1, func_80851688 }, // PLAYER_CSACTION_49 + { -1, func_80852298 }, // PLAYER_CSACTION_50 + { 13, &gPlayerAnim_link_demo_kakeyori_wait }, // PLAYER_CSACTION_51 + { -1, func_80852480 }, // PLAYER_CSACTION_52 + { 13, &gPlayerAnim_link_demo_kakeyori_miokuri_wait }, // PLAYER_CSACTION_53 + { -1, func_80852328 }, // PLAYER_CSACTION_54 + { 11, NULL }, // PLAYER_CSACTION_55 + { 11, NULL }, // PLAYER_CSACTION_56 + { 12, &gPlayerAnim_clink_demo_mimawasi_wait }, // PLAYER_CSACTION_57 + { -1, func_80852358 }, // PLAYER_CSACTION_58 + { 11, NULL }, // PLAYER_CSACTION_59 + { 18, D_80854B14 }, // PLAYER_CSACTION_60 + { 11, NULL }, // PLAYER_CSACTION_61 + { 11, NULL }, // PLAYER_CSACTION_62 + { 11, NULL }, // PLAYER_CSACTION_63 + { 11, NULL }, // PLAYER_CSACTION_64 + { -1, func_80852388 }, // PLAYER_CSACTION_65 + { 17, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSACTION_66 + { 12, &gPlayerAnim_d_link_orowait }, // PLAYER_CSACTION_67 + { 12, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSACTION_68 + { 11, NULL }, // PLAYER_CSACTION_69 + { -1, func_808526EC }, // PLAYER_CSACTION_70 + { 17, &gPlayerAnim_sude_nwait }, // PLAYER_CSACTION_71 + { -1, func_808526EC }, // PLAYER_CSACTION_72 + { 17, &gPlayerAnim_sude_nwait }, // PLAYER_CSACTION_73 + { 12, &gPlayerAnim_link_demo_gurad_wait }, // PLAYER_CSACTION_74 + { 12, &gPlayerAnim_link_demo_look_hand_wait }, // PLAYER_CSACTION_75 + { 11, NULL }, // PLAYER_CSACTION_76 + { 12, &gPlayerAnim_link_demo_ue_wait }, // PLAYER_CSACTION_77 + { 12, &gPlayerAnim_Link_m_wait }, // PLAYER_CSACTION_78 + { 13, &gPlayerAnim_Link_ue_wait }, // PLAYER_CSACTION_79 + { 12, &gPlayerAnim_Link_otituku_w }, // PLAYER_CSACTION_80 + { 12, &gPlayerAnim_L_kw }, // PLAYER_CSACTION_81 + { 11, NULL }, // PLAYER_CSACTION_82 + { 11, NULL }, // PLAYER_CSACTION_83 + { 11, NULL }, // PLAYER_CSACTION_84 + { 11, NULL }, // PLAYER_CSACTION_85 + { -1, func_80852648 }, // PLAYER_CSACTION_86 + { 11, NULL }, // PLAYER_CSACTION_87 + { 12, &gPlayerAnim_L_kennasi_w }, // PLAYER_CSACTION_88 + { -1, func_808524D0 }, // PLAYER_CSACTION_89 + { -1, func_80852514 }, // PLAYER_CSACTION_90 + { -1, func_80852554 }, // PLAYER_CSACTION_91 + { -1, func_808525C0 }, // PLAYER_CSACTION_92 + { 11, NULL }, // PLAYER_CSACTION_93 + { 11, NULL }, // PLAYER_CSACTION_94 + { 11, NULL }, // PLAYER_CSACTION_95 + { -1, func_8085283C }, // PLAYER_CSACTION_96 + { -1, func_808528C8 }, // PLAYER_CSACTION_97 + { -1, func_808528C8 }, // PLAYER_CSACTION_98 + { 12, &gPlayerAnim_link_demo_zeldamiru_wait }, // PLAYER_CSACTION_99 + { 12, &gPlayerAnim_link_demo_kenmiru1_wait }, // PLAYER_CSACTION_100 + { 12, &gPlayerAnim_link_demo_kenmiru2_wait }, // PLAYER_CSACTION_101 + { 12, &gPlayerAnim_demo_link_nwait }, // PLAYER_CSACTION_102 }; void Player_AnimChangeOnceMorphZeroRootYawSpeed(PlayState* play, Player* this, LinkAnimationHeader* anim) { @@ -15153,7 +15913,7 @@ void func_808511FC(PlayState* play, Player* this, void* anim) { void func_80851248(PlayState* play, Player* this, void* anim) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80832DBC(this); + Player_FinishAnimMovement(this); Player_AnimPlayLoopAdjusted(play, this, anim); } } @@ -15175,14 +15935,14 @@ void func_80851314(Player* this) { this->csActor = NULL; } - this->unk_664 = this->csActor; + this->focusActor = this->csActor; - if (this->unk_664 != NULL) { + if (this->focusActor != NULL) { this->actor.shape.rot.y = func_8083DB98(this, 0); } } -void func_80851368(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851368(PlayState* play, Player* this, CsCmdActorCue* cue) { this->stateFlags1 |= PLAYER_STATE1_IN_WATER; this->stateFlags2 |= PLAYER_STATE2_UNDERWATER; this->stateFlags1 &= ~(PLAYER_STATE1_JUMPING | PLAYER_STATE1_FREEFALL); @@ -15190,7 +15950,7 @@ void func_80851368(PlayState* play, Player* this, CsCmdActorAction* arg2) { Player_AnimPlayLoop(play, this, &gPlayerAnim_link_swimer_swim); } -void func_808513BC(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_808513BC(PlayState* play, Player* this, CsCmdActorCue* cue) { this->actor.gravity = 0.0f; if (this->av1.actionVar1 == 0) { @@ -15216,7 +15976,7 @@ void func_808513BC(PlayState* play, Player* this, CsCmdActorAction* arg2) { func_8084AEEC(this, &this->linearVelocity, 0.0f, this->actor.shape.rot.y); } -void func_808514C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_808514C0(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80851314(this); if (func_808332B8(this)) { @@ -15226,21 +15986,21 @@ void func_808514C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { LinkAnimation_Update(play, &this->skelAnime); - if (func_8008F128(this) || (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { + if (func_8008F128(this) || (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) { Player_UpdateUpperBody(this, play); return; } if ((this->interactRangeActor != NULL) && (this->interactRangeActor->textId == 0xFFFF)) { - Player_ActionChange_2(this, play); + Player_ActionHandler_2(this, play); } } -void func_8085157C(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_8085157C(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); } -void func_808515A4(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_808515A4(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimationHeader* anim; if (func_808332B8(this)) { @@ -15261,7 +16021,7 @@ void func_808515A4(PlayState* play, Player* this, CsCmdActorAction* arg2) { Player_ZeroSpeedXZ(this); } -void func_80851688(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851688(PlayState* play, Player* this, CsCmdActorCue* cue) { if (func_8084B3CC(play, this) == 0) { if ((this->csAction == 0x31) && (play->csCtx.state == CS_STATE_IDLE)) { Player_SetCsActionWithHaltedActors(play, NULL, 7); @@ -15275,24 +16035,24 @@ void func_80851688(PlayState* play, Player* this, CsCmdActorAction* arg2) { LinkAnimation_Update(play, &this->skelAnime); - if (func_8008F128(this) || (this->stateFlags1 & PLAYER_STATE1_ITEM_OVER_HEAD)) { + if (func_8008F128(this) || (this->stateFlags1 & PLAYER_STATE1_CARRYING_ACTOR)) { Player_UpdateUpperBody(this, play); } } } static AnimSfxEntry D_80855188[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 42) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 48) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 42) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 48) }, }; -void func_80851750(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851750(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); Player_ProcessAnimSfxList(this, D_80855188); } -void func_80851788(PlayState* play, Player* this, CsCmdActorAction* arg2) { - this->stateFlags1 &= ~PLAYER_STATE1_THREW_BOOMERANG; +void func_80851788(PlayState* play, Player* this, CsCmdActorCue* cue) { + this->stateFlags1 &= ~PLAYER_STATE1_BOOMERANG_THROWN; this->yaw = this->actor.shape.rot.y = this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &this->unk_450); @@ -15304,7 +16064,7 @@ void func_80851788(PlayState* play, Player* this, CsCmdActorAction* arg2) { } } -void func_80851828(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851828(PlayState* play, Player* this, CsCmdActorCue* cue) { f32 sp1C = 2.5f; func_80845BA0(play, this, &sp1C, 10); @@ -15327,11 +16087,11 @@ void func_80851828(PlayState* play, Player* this, CsCmdActorAction* arg2) { } } -void func_808518DC(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_808518DC(PlayState* play, Player* this, CsCmdActorCue* cue) { func_8083CEAC(this, play); } -void func_8085190C(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_8085190C(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80851314(this); if (this->av2.actionVar2 != 0) { @@ -15346,12 +16106,12 @@ void func_8085190C(PlayState* play, Player* this, CsCmdActorAction* arg2) { } } -void func_80851998(PlayState* play, Player* this, CsCmdActorAction* arg2) { - func_80845964(play, this, arg2, 0.0f, 0, 0); +void func_80851998(PlayState* play, Player* this, CsCmdActorCue* cue) { + func_80845964(play, this, cue, 0.0f, 0, 0); } -void func_808519C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { - func_80845964(play, this, arg2, 0.0f, 0, 1); +void func_808519C0(PlayState* play, Player* this, CsCmdActorCue* cue) { + func_80845964(play, this, cue, 0.0f, 0, 1); } // unused @@ -15362,11 +16122,11 @@ static LinkAnimationHeader* D_80855190[] = { static Vec3f D_80855198 = { -1.0f, 70.0f, 20.0f }; -void func_808519EC(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_808519EC(PlayState* play, Player* this, CsCmdActorCue* cue) { Math_Vec3f_Copy(&this->actor.world.pos, &D_80855198); this->actor.shape.rot.y = -0x8000; Player_AnimPlayOnceAdjusted(play, this, this->ageProperties->unk_9C); - Player_AnimReplaceApplyFlags(play, this, 0x28F); + Player_StartAnimMovement(play, this, 0x28F); } static struct_808551A4 D_808551A4[] = { @@ -15375,11 +16135,11 @@ static struct_808551A4 D_808551A4[] = { }; static AnimSfxEntry D_808551AC[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 29) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_8, 39) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 29) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 39) }, }; -void func_80851A50(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851A50(PlayState* play, Player* this, CsCmdActorCue* cue) { struct_808551A4* sp2C; Gfx** dLists; @@ -15399,27 +16159,27 @@ void func_80851A50(PlayState* play, Player* this, CsCmdActorAction* arg2) { Player_PlaySfx(this, sp2C->unk_00); if (!LINK_IS_ADULT) { - func_80832698(this, sp2C->unk_02); + Player_PlayVoiceSfx(this, sp2C->unk_02); } } else if (LINK_IS_ADULT) { if (LinkAnimation_OnFrame(&this->skelAnime, 66.0f)) { - func_80832698(this, NA_SE_VO_LI_SWORD_L); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_SWORD_L); } } else { Player_ProcessAnimSfxList(this, D_808551AC); } } -void func_80851B90(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851B90(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Change(play, &this->skelAnime, &gPlayerAnim_link_demo_warp, -(2.0f / 3.0f), 12.0f, 12.0f, ANIMMODE_ONCE, 0.0f); } static AnimSfxEntry D_808551B4[] = { - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_5, 30) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_LANDING, 30) }, }; -void func_80851BE8(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851BE8(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); this->av2.actionVar2++; @@ -15433,28 +16193,28 @@ void func_80851BE8(PlayState* play, Player* this, CsCmdActorAction* arg2) { } } -void func_80851CA4(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851CA4(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime) && (this->av2.actionVar2 == 0) && (this->actor.bgCheckFlags & 1)) { Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_back_downB); this->av2.actionVar2 = 1; } if (this->av2.actionVar2 != 0) { - func_8083721C(this); + Player_DecelerateToZero(this); } } -void func_80851D2C(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851D2C(PlayState* play, Player* this, CsCmdActorCue* cue) { Player_AnimChangeOnceMorphAdjustedZeroRootYawSpeed(play, this, &gPlayerAnim_link_normal_okarina_start); func_8084B498(this); Player_SetModels(this, Player_ActionToModelGroup(this, this->itemAction)); } static AnimSfxEntry D_808551B8[] = { - { NA_SE_IT_SWORD_PICKOUT, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 12) }, + { NA_SE_IT_SWORD_PICKOUT, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 12) }, }; -void func_80851D80(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851D80(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 6.0f)) { @@ -15464,26 +16224,26 @@ void func_80851D80(PlayState* play, Player* this, CsCmdActorAction* arg2) { } } -void func_80851DEC(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851DEC(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); Math_StepToS(&this->actor.shape.face, 0, 1); } -void func_80851E28(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851E28(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); Math_StepToS(&this->actor.shape.face, 2, 1); } -void func_80851E64(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851E64(PlayState* play, Player* this, CsCmdActorCue* cue) { Player_AnimReplacePlayOnceAdjusted(play, this, &gPlayerAnim_link_swimer_swim_get, 0x98); } -void func_80851E90(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851E90(PlayState* play, Player* this, CsCmdActorCue* cue) { Player_AnimReplacePlayOnce(play, this, &gPlayerAnim_clink_op3_negaeri, 0x9C); - func_80832698(this, NA_SE_VO_LI_GROAN); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_GROAN); } -void func_80851ECC(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851ECC(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait2, 0x9C); } @@ -15498,18 +16258,18 @@ void func_80851F14(PlayState* play, Player* this, LinkAnimationHeader* anim, Ani } } -void func_80851F84(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851F84(PlayState* play, Player* this, CsCmdActorCue* cue) { this->actor.shape.shadowDraw = NULL; func_80851134(play, this, &gPlayerAnim_clink_op3_wait1); } static AnimSfxEntry D_808551BC[] = { - { NA_SE_VO_LI_RELAX, ANIMSFX_DATA(ANIMSFX_TYPE_4, 35) }, - { NA_SE_PL_SLIPDOWN, ANIMSFX_DATA(ANIMSFX_TYPE_1, 236) }, - { NA_SE_PL_SLIPDOWN, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 256) }, + { NA_SE_VO_LI_RELAX, ANIMSFX_DATA(ANIMSFX_TYPE_VOICE, 35) }, + { NA_SE_PL_SLIPDOWN, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 236) }, + { NA_SE_PL_SLIPDOWN, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 256) }, }; -void func_80851FB0(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80851FB0(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimReplacePlayLoop(play, this, &gPlayerAnim_clink_op3_wait3, 0x9C); this->av2.actionVar2 = 1; @@ -15522,30 +16282,30 @@ void func_80851FB0(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_808551C8[] = { - { NA_SE_PL_LAND_LADDER, ANIMSFX_DATA(ANIMSFX_TYPE_1, 67) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_9, 84) }, - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_9, 90) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_9, 96) }, + { NA_SE_PL_LAND_LADDER, ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 67) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_UNKNOWN, 84) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_UNKNOWN, 90) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_UNKNOWN, 96) }, }; -void func_80852048(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852048(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); Player_ProcessAnimSfxList(this, D_808551C8); } -void func_80852080(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852080(PlayState* play, Player* this, CsCmdActorCue* cue) { Player_AnimReplacePlayOnceAdjusted(play, this, &gPlayerAnim_clink_demo_futtobi, 0x9D); - func_80832698(this, NA_SE_VO_LI_FALL_L); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_FALL_L); } -void func_808520BC(PlayState* play, Player* this, CsCmdActorAction* arg2) { - f32 startX = arg2->startPos.x; - f32 startY = arg2->startPos.y; - f32 startZ = arg2->startPos.z; - f32 distX = (arg2->endPos.x - startX); - f32 distY = (arg2->endPos.y - startY); - f32 distZ = (arg2->endPos.z - startZ); - f32 sp4 = (f32)(play->csCtx.frames - arg2->startFrame) / (f32)(arg2->endFrame - arg2->startFrame); +void func_808520BC(PlayState* play, Player* this, CsCmdActorCue* cue) { + f32 startX = cue->startPos.x; + f32 startY = cue->startPos.y; + f32 startZ = cue->startPos.z; + f32 distX = (cue->endPos.x - startX); + f32 distY = (cue->endPos.y - startY); + f32 distZ = (cue->endPos.z - startZ); + f32 sp4 = (f32)(play->csCtx.frames - cue->startFrame) / (f32)(cue->endFrame - cue->startFrame); this->actor.world.pos.x = distX * sp4 + startX; this->actor.world.pos.y = distY * sp4 + startY; @@ -15553,41 +16313,41 @@ void func_808520BC(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_808551D8[] = { - { NA_SE_PL_BOUND, ANIMSFX_DATA(ANIMSFX_TYPE_2, 20) }, - { NA_SE_PL_BOUND, -ANIMSFX_DATA(ANIMSFX_TYPE_2, 30) }, + { NA_SE_PL_BOUND, ANIMSFX_DATA(ANIMSFX_TYPE_FLOOR, 20) }, + { NA_SE_PL_BOUND, -ANIMSFX_DATA(ANIMSFX_TYPE_FLOOR, 30) }, }; -void func_80852174(PlayState* play, Player* this, CsCmdActorAction* arg2) { - func_808520BC(play, this, arg2); +void func_80852174(PlayState* play, Player* this, CsCmdActorCue* cue) { + func_808520BC(play, this, cue); LinkAnimation_Update(play, &this->skelAnime); Player_ProcessAnimSfxList(this, D_808551D8); } -void func_808521B8(PlayState* play, Player* this, CsCmdActorAction* arg2) { - if (arg2 != NULL) { - func_808520BC(play, this, arg2); +void func_808521B8(PlayState* play, Player* this, CsCmdActorCue* cue) { + if (cue != NULL) { + func_808520BC(play, this, cue); } LinkAnimation_Update(play, &this->skelAnime); } -void func_808521F4(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_808521F4(PlayState* play, Player* this, CsCmdActorCue* cue) { Player_AnimChangeOnceMorph(play, this, GET_PLAYER_ANIM(PLAYER_ANIMGROUP_nwait, this->modelAnimType)); Player_ZeroSpeedXZ(this); } -void func_80852234(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852234(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); } -void func_8085225C(PlayState* play, Player* this, CsCmdActorAction* arg2) { - Player_AnimReplaceApplyFlags(play, this, 0x98); +void func_8085225C(PlayState* play, Player* this, CsCmdActorCue* cue) { + Player_StartAnimMovement(play, this, 0x98); } -void func_80852280(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852280(PlayState* play, Player* this, CsCmdActorCue* cue) { this->actor.draw = Player_Draw; } -void func_80852298(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852298(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimReplaceNormalPlayLoopAdjusted(play, this, &gPlayerAnim_clink_demo_koutai_wait); this->av2.actionVar2 = 1; @@ -15599,24 +16359,24 @@ void func_80852298(PlayState* play, Player* this, CsCmdActorAction* arg2) { } static AnimSfxEntry D_808551E0[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 10) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 24) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 10) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 24) }, }; -void func_80852328(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852328(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80851F14(play, this, &gPlayerAnim_link_demo_furimuki2_wait, D_808551E0); } static AnimSfxEntry D_808551E8[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_8, 15) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_8, 35) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 15) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_WALKING, 35) }, }; -void func_80852358(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852358(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80851F14(play, this, &gPlayerAnim_link_demo_nozokikomi_wait, D_808551E8); } -void func_80852388(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852388(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { Player_AnimPlayLoopAdjusted(play, this, &gPlayerAnim_demo_link_twait); this->av2.actionVar2 = 1; @@ -15637,49 +16397,49 @@ void func_80852414(PlayState* play, Player* this, LinkAnimationHeader* anim, Ani } static AnimSfxEntry D_808551F0[] = { - { 0, ANIMSFX_DATA(ANIMSFX_TYPE_6, 15) }, - { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_6, 33) }, + { 0, ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 15) }, + { 0, -ANIMSFX_DATA(ANIMSFX_TYPE_RUNNING, 33) }, }; -void func_80852450(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852450(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80852414(play, this, &gPlayerAnim_clink_demo_koutai_wait, D_808551F0); } static AnimSfxEntry D_808551F8[] = { - { NA_SE_PL_KNOCK, -ANIMSFX_DATA(ANIMSFX_TYPE_1, 78) }, + { NA_SE_PL_KNOCK, -ANIMSFX_DATA(ANIMSFX_TYPE_GENERAL, 78) }, }; -void func_80852480(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852480(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80852414(play, this, &gPlayerAnim_link_demo_kakeyori_wait, D_808551F8); } -void func_808524B0(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_808524B0(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80837704(play, this); } -void func_808524D0(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_808524D0(PlayState* play, Player* this, CsCmdActorCue* cue) { sControlInput->press.button |= BTN_B; Player_Action_80844E68(this, play); } -void func_80852514(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852514(PlayState* play, Player* this, CsCmdActorCue* cue) { Player_Action_80844E68(this, play); } -void func_80852544(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852544(PlayState* play, Player* this, CsCmdActorCue* cue) { } -void func_80852554(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852554(PlayState* play, Player* this, CsCmdActorCue* cue) { } -void func_80852564(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852564(PlayState* play, Player* this, CsCmdActorCue* cue) { this->stateFlags3 |= PLAYER_STATE3_MIDAIR; this->linearVelocity = 2.0f; this->actor.velocity.y = -1.0f; Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_back_downA); - func_80832698(this, NA_SE_VO_LI_FALL_L); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_FALL_L); } static void (*D_808551FC[])(Player* this, PlayState* play) = { @@ -15688,16 +16448,16 @@ static void (*D_808551FC[])(Player* this, PlayState* play) = { Player_Action_80843A38, }; -void func_808525C0(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_808525C0(PlayState* play, Player* this, CsCmdActorCue* cue) { D_808551FC[this->av2.actionVar2](this, play); } -void func_80852608(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852608(PlayState* play, Player* this, CsCmdActorCue* cue) { func_80846720(play, this, 0); Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_demo_return_to_past); } -void func_80852648(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852648(PlayState* play, Player* this, CsCmdActorCue* cue) { LinkAnimation_Update(play, &this->skelAnime); if (LinkAnimation_OnFrame(&this->skelAnime, 10.0f)) { @@ -15731,7 +16491,7 @@ static Vec3s D_80855210[2][2] = { { { -200, 500, 0 }, { 600, 400, 600 } }, }; -void func_808526EC(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_808526EC(PlayState* play, Player* this, CsCmdActorCue* cue) { static Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; static Color_RGBA8 primColor = { 255, 255, 255, 0 }; static Color_RGBA8 envColor = { 0, 128, 128, 0 }; @@ -15758,9 +16518,9 @@ void func_808526EC(PlayState* play, Player* this, CsCmdActorAction* arg2) { EffectSsKiraKira_SpawnDispersed(play, &sparklePos, &zeroVec, &zeroVec, &primColor, &envColor, 600, -10); } -void func_8085283C(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_8085283C(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { - func_80852944(play, this, arg2); + func_80852944(play, this, cue); // This is when link picks up the sword in the Ganon fight } else if (this->av2.actionVar2 == 0) { Item_Give(play, ITEM_SWORD_MASTER); @@ -15770,7 +16530,7 @@ void func_8085283C(PlayState* play, Player* this, CsCmdActorAction* arg2) { } } -void func_808528C8(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_808528C8(PlayState* play, Player* this, CsCmdActorCue* cue) { if (LinkAnimation_Update(play, &this->skelAnime)) { func_8084285C(this, 0.0f, 99.0f, this->skelAnime.endFrame - 8.0f); } @@ -15780,14 +16540,14 @@ void func_808528C8(PlayState* play, Player* this, CsCmdActorAction* arg2) { } } -void func_80852944(PlayState* play, Player* this, CsCmdActorAction* arg2) { +void func_80852944(PlayState* play, Player* this, CsCmdActorCue* cue) { if (func_808332B8(this)) { func_80838F18(play, this); func_80832340(play, this); } else { func_8083C148(this, play); - if (!Player_ActionChange_4(this, play)) { - Player_ActionChange_2(this, play); + if (!Player_ActionHandler_Talk(this, play)) { + Player_ActionHandler_2(this, play); } } @@ -15795,36 +16555,36 @@ void func_80852944(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->unk_6AD = 0; } -void func_808529D0(PlayState* play, Player* this, CsCmdActorAction* arg2) { - this->actor.world.pos.x = arg2->startPos.x; - this->actor.world.pos.y = arg2->startPos.y; +void func_808529D0(PlayState* play, Player* this, CsCmdActorCue* cue) { + this->actor.world.pos.x = cue->startPos.x; + this->actor.world.pos.y = cue->startPos.y; if ((play->sceneNum == SCENE_KOKIRI_FOREST) && !LINK_IS_ADULT) { this->actor.world.pos.y -= 1.0f; } - this->actor.world.pos.z = arg2->startPos.z; - this->yaw = this->actor.shape.rot.y = arg2->rot.y; + this->actor.world.pos.z = cue->startPos.z; + this->yaw = this->actor.shape.rot.y = cue->rot.y; } -void func_80852A54(PlayState* play, Player* this, CsCmdActorAction* arg2) { - f32 dx = arg2->startPos.x - (s32)this->actor.world.pos.x; - f32 dy = arg2->startPos.y - (s32)this->actor.world.pos.y; - f32 dz = arg2->startPos.z - (s32)this->actor.world.pos.z; +void func_80852A54(PlayState* play, Player* this, CsCmdActorCue* cue) { + f32 dx = cue->startPos.x - (s32)this->actor.world.pos.x; + f32 dy = cue->startPos.y - (s32)this->actor.world.pos.y; + f32 dz = cue->startPos.z - (s32)this->actor.world.pos.z; f32 dist = sqrtf(SQ(dx) + SQ(dy) + SQ(dz)); - s16 yawDiff = arg2->rot.y - this->actor.shape.rot.y; + s16 yawDiff = cue->rot.y - this->actor.shape.rot.y; if ((this->linearVelocity == 0.0f) && ((dist > 50.0f) || (ABS(yawDiff) > 0x4000))) { - func_808529D0(play, this, arg2); + func_808529D0(play, this, cue); } this->skelAnime.moveFlags = 0; Player_ZeroRootLimbYaw(this); } -void func_80852B4C(PlayState* play, Player* this, CsCmdActorAction* arg2, struct_80854B18* arg3) { +void func_80852B4C(PlayState* play, Player* this, CsCmdActorCue* cue, struct_80854B18* arg3) { if (arg3->type > 0) { D_80854AA4[arg3->type](play, this, arg3->ptr); } else if (arg3->type < 0) { - arg3->func(play, this, arg2); + arg3->func(play, this, cue); } if ((D_80858AA0 & 4) && !(this->skelAnime.moveFlags & 4)) { @@ -15839,8 +16599,8 @@ void func_80852C0C(PlayState* play, Player* this, s32 csAction) { } } -void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2) { - CsCmdActorAction* linkCsAction = play->csCtx.linkAction; +void func_80852C50(PlayState* play, Player* this, CsCmdActorCue* cue) { + CsCmdActorCue* linkCsAction = play->csCtx.linkAction; s32 pad; s32 sp24; @@ -15857,7 +16617,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2) { } if (this->cueId != linkCsAction->action) { - sp24 = D_808547C4[linkCsAction->action]; + sp24 = sCueToCsActionMap[linkCsAction->action]; if (sp24 >= 0) { if ((sp24 == 3) || (sp24 == 4)) { func_80852A54(play, this, linkCsAction); @@ -15868,7 +16628,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2) { D_80858AA0 = this->skelAnime.moveFlags; - func_80832DBC(this); + Player_FinishAnimMovement(this); osSyncPrintf("TOOL MODE=%d\n", sp24); func_80852C0C(play, this, ABS(sp24)); func_80852B4C(play, this, linkCsAction, &D_80854B18[ABS(sp24)]); @@ -15878,7 +16638,7 @@ void func_80852C50(PlayState* play, Player* this, CsCmdActorAction* arg2) { this->cueId = linkCsAction->action; } - sp24 = D_808547C4[this->cueId]; + sp24 = sCueToCsActionMap[this->cueId]; func_80852B4C(play, this, linkCsAction, &D_80854E50[ABS(sp24)]); if (CVarGetInteger(CVAR_ENHANCEMENT("FixEyesOpenWhileSleeping"), 0) && (play->csCtx.linkAction->action == 28 || play->csCtx.linkAction->action == 29)) { @@ -15890,7 +16650,7 @@ void Player_Action_CsAction(Player* this, PlayState* play) { if (this->csAction != this->prevCsAction) { D_80858AA0 = this->skelAnime.moveFlags; - func_80832DBC(this); + Player_FinishAnimMovement(this); this->prevCsAction = this->csAction; osSyncPrintf("DEMO MODE=%d\n", this->csAction); func_80852C0C(play, this, this->csAction); @@ -15916,13 +16676,13 @@ s32 Player_StartFishing(PlayState* play) { s32 func_80852F38(PlayState* play, Player* this) { if (!Player_InBlockingCsMode(play, this) && (this->invincibilityTimer >= 0) && !func_8008F128(this) && - !(this->stateFlags3 & PLAYER_STATE3_HOOKSHOT_TRAVELLING)) { + !(this->stateFlags3 & PLAYER_STATE3_FLYING_WITH_HOOKSHOT)) { func_80832564(play, this); - Player_SetupAction(play, this, func_8084F308, 0); + Player_SetupAction(play, this, Player_Action_8084F308, 0); Player_AnimPlayOnce(play, this, &gPlayerAnim_link_normal_re_dead_attack); this->stateFlags2 |= PLAYER_STATE2_GRABBED_BY_ENEMY; func_80832224(this); - func_80832698(this, NA_SE_VO_LI_HELD); + Player_PlayVoiceSfx(this, NA_SE_VO_LI_HELD); return true; } @@ -15953,8 +16713,8 @@ s32 Player_TryCsAction(PlayState* play, Actor* actor, s32 csAction) { } void func_80853080(Player* this, PlayState* play) { - Player_SetupAction(play, this, Player_Action_80840BC8, 1); - Player_AnimChangeOnceMorph(play, this, func_80833338(this)); + Player_SetupAction(play, this, Player_Action_Idle, 1); + Player_AnimChangeOnceMorph(play, this, Player_GetIdleAnim(this)); this->yaw = this->actor.shape.rot.y; } @@ -15973,23 +16733,30 @@ s32 Player_InflictDamageModified(PlayState* play, s32 damage, u8 modified) { return 0; } -// Start talking with the given actor +/** + * Start talking to the specified actor. + * + * This function does not concern trading exchange items. + * For item exchanges see relevant code in `Player_ActionHandler_13` and `Player_Action_ExchangeItem`. + */ void Player_StartTalking(PlayState* play, Actor* actor) { Player* this = GET_PLAYER(play); s32 pad; - if ((this->targetActor != NULL) || (actor == this->naviActor) || + if ((this->talkActor != NULL) || (actor == this->naviActor) || CHECK_FLAG_ALL(actor->flags, ACTOR_FLAG_TARGETABLE | ACTOR_FLAG_NAVI_HAS_INFO)) { actor->flags |= ACTOR_FLAG_PLAYER_TALKED_TO; } - this->targetActor = actor; + this->talkActor = actor; this->exchangeItemId = EXCH_ITEM_NONE; if (actor->textId == 0xFFFF) { + // Player will stand and look at the actor with no text appearing. + // This can be used to delay text from appearing, for example. Player_SetCsActionWithHaltedActors(play, actor, 1); actor->flags |= ACTOR_FLAG_PLAYER_TALKED_TO; - func_80832528(play, this); + Player_PutAwayHeldItem(play, this); } else { if (this->actor.flags & ACTOR_FLAG_PLAYER_TALKED_TO) { this->actor.textId = 0; @@ -16001,42 +16768,42 @@ void Player_StartTalking(PlayState* play, Actor* actor) { if (this->stateFlags1 & PLAYER_STATE1_ON_HORSE) { s32 sp24 = this->av2.actionVar2; - func_80832528(play, this); - func_8083A2F8(play, this); + Player_PutAwayHeldItem(play, this); + Player_SetupTalk(play, this); this->av2.actionVar2 = sp24; } else { if (func_808332B8(this)) { - func_80836898(play, this, func_8083A2F8); + Player_SetupWaitForPutAway(play, this, Player_SetupTalk); Player_AnimChangeLoopSlowMorph(play, this, &gPlayerAnim_link_swimer_swim_wait); } else if ((actor->category != ACTORCAT_NPC) || (this->heldItemAction == PLAYER_IA_FISHING_POLE)) { - func_8083A2F8(play, this); + Player_SetupTalk(play, this); - if (!func_8008E9C4(this)) { + if (!Player_CheckHostileLockOn(this)) { if ((actor != this->naviActor) && (actor->xzDistToPlayer < 40.0f)) { Player_AnimPlayOnceAdjusted(play, this, &gPlayerAnim_link_normal_backspace); } else { - Player_AnimPlayLoop(play, this, func_80833338(this)); + Player_AnimPlayLoop(play, this, Player_GetIdleAnim(this)); } } } else { - func_80836898(play, this, func_8083A2F8); + Player_SetupWaitForPutAway(play, this, Player_SetupTalk); Player_AnimPlayOnceAdjusted(play, this, (actor->xzDistToPlayer < 40.0f) ? &gPlayerAnim_link_normal_backspace : &gPlayerAnim_link_normal_talk_free); } if (this->skelAnime.animation == &gPlayerAnim_link_normal_backspace) { - Player_AnimReplaceApplyFlags(play, this, 0x19); + Player_StartAnimMovement(play, this, 0x19); } func_80832224(this); } - this->stateFlags1 |= PLAYER_STATE1_TEXT_ON_SCREEN | PLAYER_STATE1_IN_CUTSCENE; + this->stateFlags1 |= PLAYER_STATE1_TALKING | PLAYER_STATE1_IN_CUTSCENE; } - if ((this->naviActor == this->targetActor) && ((this->targetActor->textId & 0xFF00) != 0x200)) { + if ((this->naviActor == this->talkActor) && ((this->talkActor->textId & 0xFF00) != 0x200)) { this->naviActor->flags |= ACTOR_FLAG_PLAYER_TALKED_TO; func_80835EA4(play, 0xB); } diff --git a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c index 47bb73d5c..baf1eb533 100644 --- a/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/soh/src/overlays/misc/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -4598,7 +4598,7 @@ void KaleidoScope_Update(PlayState* play) osSyncPrintf("i=%d LAST_TIME_TYPE=%d\n", i, gSaveContext.unk_13EE); gSaveContext.unk_13EA = 0; Interface_ChangeAlpha(gSaveContext.unk_13EE); - player->targetActor = NULL; + player->talkActor = NULL; Player_SetEquipmentData(play, player); osSyncPrintf(VT_RST); break;