From e57fb5780d488786895e6cb0c6e872255986d045 Mon Sep 17 00:00:00 2001 From: EllipticEllipsis <73679967+EllipticEllipsis@users.noreply.github.com> Date: Fri, 2 Jul 2021 04:15:26 +0100 Subject: [PATCH] z64player.h and Player struct work (#195) * Rename Player, name some of its struct vars, add collision flag macros to actors missing them * Name Player_GetMask/RemoveMask, add a few macros * Format * Update include/functions.h Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> * Fix unk_14B in a non-matching Co-authored-by: engineer124 <47598039+engineer124@users.noreply.github.com> --- include/functions.h | 26 +- include/macros.h | 2 +- include/z64.h | 14 +- include/z64actor.h | 65 ---- include/z64player.h | 324 ++++++++++++++++++ src/code/code_0x800CAAD0.c | 2 +- src/code/code_0x800E8EA0.c | 9 +- src/code/z_effect_soft_sprite_old_init.c | 4 +- src/code/z_en_item00.c | 8 +- src/code/z_snap.c | 2 +- .../actors/ovl_Arms_Hook/z_arms_hook.c | 39 ++- .../ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c | 12 +- .../actors/ovl_Bg_Icicle/z_bg_icicle.c | 8 +- .../actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c | 18 +- .../actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h | 2 +- .../ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c | 16 +- .../actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c | 28 +- .../ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c | 4 +- .../actors/ovl_Bg_Tobira01/z_bg_tobira01.c | 4 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 14 +- .../actors/ovl_Door_Spiral/z_door_spiral.c | 20 +- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 6 +- .../actors/ovl_En_Encount2/z_en_encount2.c | 2 +- src/overlays/actors/ovl_En_Fg/z_en_fg.c | 4 +- src/overlays/actors/ovl_En_In/z_en_in.c | 44 +-- .../actors/ovl_En_Jc_Mato/z_en_jc_mato.c | 4 +- .../actors/ovl_En_Ma_Yts/z_en_ma_yts.c | 8 +- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 4 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 12 +- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 6 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 48 +-- .../actors/ovl_En_Po_Fusen/z_en_po_fusen.c | 4 +- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 4 +- src/overlays/actors/ovl_En_Toto/z_en_toto.c | 44 +-- .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c | 33 +- .../actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c | 6 +- .../ovl_En_Weather_Tag/z_en_weather_tag.c | 30 +- src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c | 8 +- src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c | 16 +- .../actors/ovl_Obj_Ghaka/z_obj_ghaka.c | 14 +- .../actors/ovl_Obj_Kibako/z_obj_kibako.c | 22 +- .../ovl_Obj_Lightswitch/z_obj_lightswitch.c | 2 +- .../ovl_Obj_Moon_Stone/z_obj_moon_stone.c | 6 +- tables/functions.txt | 4 +- 44 files changed, 621 insertions(+), 331 deletions(-) create mode 100644 include/z64player.h diff --git a/include/functions.h b/include/functions.h index 7665e37853..ad472b3796 100644 --- a/include/functions.h +++ b/include/functions.h @@ -715,7 +715,7 @@ void func_800B4F78(TargetContext* targetContext, u8 type, GlobalContext* globalC void func_800B5040(TargetContext* targetContext, Actor* actor, u8 type, GlobalContext* globalCtx); void Actor_TargetContextInit(TargetContext* targetCtx, Actor* actor, GlobalContext* globalCtx); void func_800B5208(TargetContext* targetCtx, GlobalContext* globalCtx); -void func_800B5814(TargetContext* targetContext, ActorPlayer* player, Actor* param_3, GlobalContext* globalCtx); +void func_800B5814(TargetContext* targetContext, Player* player, Actor* param_3, GlobalContext* globalCtx); u32 Flags_GetSwitch(GlobalContext* globalCtx, s32 flag); void Actor_SetSwitchFlag(GlobalContext* globalCtx, s32 flag); void Actor_UnsetSwitchFlag(GlobalContext* globalCtx, s32 flag); @@ -777,7 +777,7 @@ f32 Actor_XZDistanceToPoint(Actor* actor, Vec3f* point); void Actor_CalcOffsetOrientedToDrawRotation(Actor* actor, Vec3f* offset, Vec3f* point); f32 Actor_YDistance(Actor* actor1, Actor* actor2); void func_800B6F20(GlobalContext* globalCtx, s32 param_2, f32 param_3, s16 param_4); -float func_800B6FC8(ActorPlayer* player); +float func_800B6FC8(Player* player); // void func_800B7090(void); // void func_800B7118(void); // void func_800B7128(void); @@ -807,7 +807,7 @@ void func_800B8050(Actor* actor, GlobalContext* globalCtx, s32 iParm3); void func_800B8118(Actor* actor, GlobalContext* globalCtx, s32 iParm3); // void func_800B81E0(void); UNK_PTR func_800B8214(PosRot* param_1, Actor* param_2); -f32* func_800B8248(PosRot* param_1, ActorPlayer* param_2); +f32* func_800B8248(PosRot* param_1, Player* param_2); // void func_800B82EC(void); // void func_800B83BC(void); // void func_800B83F8(void); @@ -2214,8 +2214,8 @@ s32 func_801224E0(s32 param_1, s16 param_2, s16 param_3); // void func_801226E0(void); void func_80122744(GlobalContext* globalCtx, UNK_PTR arg1, u32 arg2, Vec3s* arg3); s32 func_80122760(GlobalContext* globalCtx, UNK_PTR arg1, f32 arg2); -void func_80122868(GlobalContext* globalCtx, ActorPlayer* player); -void func_801229A0(GlobalContext* globalCtx, ActorPlayer* player); +void func_80122868(GlobalContext* globalCtx, Player* player); +void func_801229A0(GlobalContext* globalCtx, Player* player); // void func_801229EC(void); // void func_801229FC(void); // void func_80122BA4(void); @@ -2223,13 +2223,13 @@ void func_801229A0(GlobalContext* globalCtx, ActorPlayer* player); // void func_80122D44(void); // void func_80122ED8(void); // void func_80122EEC(void); -void func_80122F28(ActorPlayer* player, GlobalContext* globalCtx, Actor* actor); +void func_80122F28(Player* player, GlobalContext* globalCtx, Actor* actor); // void func_80122F9C(void); // void func_80122FCC(void); // void func_8012300C(void); void func_8012301C(s32 iParm1, GlobalContext* globalCtx); -void func_80123140(GlobalContext* globalCtx, ActorPlayer* param_2); -u32 func_80123358(GlobalContext* globalCtx, ActorPlayer* player); +void func_80123140(GlobalContext* globalCtx, Player* param_2); +u32 func_80123358(GlobalContext* globalCtx, Player* player); u32 func_801233E4(GlobalContext* globalCtx); // void func_80123420(void); // void func_80123434(void); @@ -2246,17 +2246,17 @@ s32 func_80123590(GlobalContext* globalCtx, Actor* actor); // void func_80123C58(void); // void func_80123C90(void); // void func_80123D50(void); -void func_80123DA4(ActorPlayer* player); +void func_80123DA4(Player* player); // void func_80123DC0(void); // void func_80123E90(void); // void func_80123F2C(void); // void func_80123F48(void); // void func_80124020(void); -u32 func_8012403C(GlobalContext* globalCtx); // Player_IsWearingAMask -void func_8012404C(GlobalContext* globalCtx); +u32 Player_GetMask(GlobalContext* globalCtx); +void Player_RemoveMask(GlobalContext* globalCtx); // void func_8012405C(void); // void func_80124088(void); -s32 func_801240C8(ActorPlayer* player); +s32 func_801240C8(Player* player); // void func_801240DC(void); // void func_80124110(void); // void func_80124148(void); @@ -2345,7 +2345,7 @@ void Quake2_SetCountdown(s16 countdown); // s16 Quake2_GetType(void); void Quake2_SetType(s16 type); void Quake2_ClearType(s16 type); -u32 Quake2_GetFloorQuake(ActorPlayer* player); +u32 Quake2_GetFloorQuake(Player* player); // void Quake2_Update(void); // void Quake_NumActiveQuakes(void); Gfx* Gfx_SetFog(Gfx* gfx, s32 r, s32 g, s32 b, s32 a, s32 n, s32 f); diff --git a/include/macros.h b/include/macros.h index 1e42fbc5d1..8e7310a366 100644 --- a/include/macros.h +++ b/include/macros.h @@ -23,7 +23,7 @@ (curState)->nextGameStateInit = (GameStateFunc)newInit; \ (curState)->nextGameStateSize = sizeof(newStruct); -#define PLAYER ((ActorPlayer*)globalCtx->actorCtx.actorList[ACTORCAT_PLAYER].first) +#define PLAYER ((Player*)globalCtx->actorCtx.actorList[ACTORCAT_PLAYER].first) // linkAge still exists in MM, but is always set to 0 (always adult) // There are remnants of these macros from OOT, but they are essentially useless diff --git a/include/z64.h b/include/z64.h index 50aaecfab1..8fb60933e6 100644 --- a/include/z64.h +++ b/include/z64.h @@ -32,6 +32,7 @@ #include #include #include +#include "z64player.h" #include #include @@ -1343,7 +1344,7 @@ struct Camera { /* 0x084 */ f32 unk84; /* 0x088 */ f32 unk88; /* 0x08C */ GlobalContext* globalCtx; - /* 0x090 */ ActorPlayer* player; + /* 0x090 */ Player* player; /* 0x094 */ PosRot unk94; /* 0x0A8 */ Actor* unkA8; /* 0x0AC */ Vec3f unkAC; @@ -1451,7 +1452,7 @@ struct s800B948C { /* 0x08 */ u32 updateActorIfSet; /* 0x0C */ u32 unkC; /* 0x10 */ Actor* unk10; - /* 0x14 */ ActorPlayer* player; + /* 0x14 */ Player* player; /* 0x18 */ u32 runMainIfSet; // Bitmask of actor flags. The actor will only have main called if it has at least 1 flag set that matches this bitmask }; // size = 0x1C @@ -1525,7 +1526,14 @@ struct GlobalContext { /* 0x17D88 */ ObjectContext objectCtx; /* 0x186E0 */ RoomContext roomContext; /* 0x18760 */ TransitionContext transitionCtx; - /* 0x18768 */ UNK_TYPE1 pad18768[0x30]; + /* 0x18768 */ void (*playerInit)(Player* player, struct GlobalContext* globalCtx, FlexSkeletonHeader* skelHeader); + /* 0x1876C */ void (*playerUpdate)(Player* player, struct GlobalContext* globalCtx, Input* input); + /* 0x18770 */ UNK_TYPE1 pad18770[0x8]; + /* 0x18778 */ s32 (*grabPlayer)(struct GlobalContext* globalCtx, Player* player); + /* 0x1877C */ s32 (*func_1877C)(struct GlobalContext* globalCtx, Player* player, s32 arg2); + /* 0x18780 */ void (*func_18780)(Player* player, struct GlobalContext* globalCtx); + /* 0x18784 */ s32 (*damagePlayer)(struct GlobalContext* globalCtx, s32 damage); + /* 0x18788 */ UNK_TYPE1 pad18788[0x10]; /* 0x18798 */ void (*func_18798)(struct GlobalContext* globalCtx, void* arg1, s32 arg2); /* 0x1879C */ UNK_TYPE1 pad1879C[0x14]; /* 0x187B0 */ MtxF unk187B0; diff --git a/include/z64actor.h b/include/z64actor.h index 4cfd665f56..a6726a731d 100644 --- a/include/z64actor.h +++ b/include/z64actor.h @@ -212,71 +212,6 @@ typedef struct { /* 0x15A */ s16 pad15A; } DynaPolyActor; // size = 0x15C -typedef struct { - /* 0x000 */ Actor base; - /* 0x144 */ UNK_TYPE1 unk144; - /* 0x145 */ UNK_TYPE1 pad145[0x2]; - /* 0x147 */ s8 itemActionParam; - /* 0x148 */ UNK_TYPE1 pad148[0x2]; - /* 0x14A */ s8 heldItemActionParam; - /* 0x14B */ u8 unk14B; - /* 0x14C */ UNK_TYPE1 pad14C[0x5]; - /* 0x151 */ u8 unk151; - /* 0x152 */ UNK_TYPE1 unk152; - /* 0x153 */ u8 unk153; // isWearingAMask - /* 0x154 */ UNK_TYPE1 pad154[0x1F8]; - /* 0x34C */ Actor* heldActor; - /* 0x350 */ UNK_TYPE1 pad350[0x18]; - /* 0x368 */ Vec3f unk368; - /* 0x374 */ UNK_TYPE1 pad374[0x8]; - /* 0x37C */ s8 doorType; - /* 0x37D */ s8 doorDirection; - /* 0x37E */ s8 doorTimer; - /* 0x37F */ s8 unk37F; - /* 0x380 */ Actor* doorActor; - /* 0x384 */ UNK_TYPE1 unk384[0x10]; - /* 0x394 */ u8 unk394; - /* 0x395 */ UNK_TYPE1 pad395[0x37]; - /* 0x3CC */ s16 unk3CC; - /* 0x3CE */ s8 unk3CE; - /* 0x3CF */ UNK_TYPE1 pad3CF[0x361]; - /* 0x730 */ Actor* unk730; - /* 0x734 */ UNK_TYPE1 pad734[0x338]; - /* 0xA6C */ u32 stateFlags1; - /* 0xA70 */ u32 unkA70; - /* 0xA74 */ u32 unkA74; - /* 0xA78 */ UNK_TYPE1 padA78[0x8]; - /* 0xA80 */ Actor* unkA80; - /* 0xA84 */ UNK_TYPE1 padA84[0x4]; - /* 0xA88 */ Actor* unkA88; - /* 0xA8C */ f32 unkA8C; - /* 0xA90 */ UNK_TYPE1 padA90[0x44]; - /* 0xAD4 */ s16 unkAD4; - /* 0xAD6 */ UNK_TYPE1 padAD6[0x8]; - /* 0xADE */ u8 unkADE; - /* 0xADF */ UNK_TYPE1 padADF[0x4]; - /* 0xAE3 */ s8 unkAE3; - /* 0xAE4 */ UNK_TYPE1 padAE4[0x3]; - /* 0xAE7 */ s8 unkAE7; - /* 0xAE8 */ UNK_TYPE1 padAE8[0x20]; - /* 0xB08 */ f32 unkB08; - /* 0xB0C */ UNK_TYPE1 padB0C[0x1C]; - /* 0xB28 */ s16 unkB28; - /* 0xB2A */ UNK_TYPE1 padB2A[0x1E]; - /* 0xB48 */ f32 unkB48; - /* 0xB4C */ UNK_TYPE1 padB4C[0x34]; - /* 0xB80 */ f32 unk_B80; - /* 0xB84 */ s16 unk_B84; - /* 0xB86 */ char unk_B86[0x16]; - /* 0xB9C */ Vec3f unkB9C; - /* 0xBA8 */ UNK_TYPE1 padBA8[0x44]; - /* 0xBEC */ Vec3f bodyPartsPos[18]; - /* 0xCC4 */ MtxF mf_CC4; - /* 0xD04 */ MtxF unkD04; - /* 0xD44 */ UNK_TYPE1 padD44[0x18]; - /* 0xD5C */ s8 invincibilityTimer; - /* 0xD5D */ UNK_TYPE1 padD5D[0x1B]; -} ActorPlayer; // size = 0xD78 typedef enum { /* 0x00 */ ITEM00_RUPEE_GREEN, diff --git a/include/z64player.h b/include/z64player.h new file mode 100644 index 0000000000..22817042f6 --- /dev/null +++ b/include/z64player.h @@ -0,0 +1,324 @@ +#ifndef _Z64PLAYER_H_ +#define _Z64PLAYER_H_ + +#include "z64actor.h" +#include "os.h" + +struct Player; + +typedef enum { + /* 0x00 */ PLAYER_SHIELD_NONE, + /* 0x01 */ PLAYER_SHIELD_HEROS_SHIELD, + /* 0x02 */ PLAYER_SHIELD_MIRROR_SHIELD, + /* 0x03 */ PLAYER_SHIELD_MAX +} PlayerShield; + +typedef enum { + /* 0x00 */ PLAYER_FORM_FIERCE_DEITY, + /* 0x01 */ PLAYER_FORM_GORON, + /* 0x02 */ PLAYER_FORM_ZORA, + /* 0x03 */ PLAYER_FORM_DEKU, + /* 0x04 */ PLAYER_FORM_HUMAN, + /* 0x05 */ PLAYER_FORM_MAX +} PlayerTransformation; + +typedef enum { + /* 0x00 */ PLAYER_MASK_NONE, + /* 0x01 */ PLAYER_MASK_MASK_OF_TRUTH, + /* 0x02 */ PLAYER_MASK_KAFEIS_MASK, + /* 0x03 */ PLAYER_MASK_ALL_NIGHT_MASK, + /* 0x04 */ PLAYER_MASK_BUNNY_HOOD, + /* 0x05 */ PLAYER_MASK_KEATON_MASK, + /* 0x06 */ PLAYER_MASK_GAROS_MASK, + /* 0x07 */ PLAYER_MASK_ROMANIS_MASK, + /* 0x08 */ PLAYER_MASK_CIRCUS_LEADERS_MASK, + /* 0x09 */ PLAYER_MASK_POSTMANS_HAT, + /* 0x0A */ PLAYER_MASK_COUPLES_MASK, + /* 0x0B */ PLAYER_MASK_GREAT_FAIRYS_MASK, + /* 0x0C */ PLAYER_MASK_GIBDO_MASK, + /* 0x0D */ PLAYER_MASK_DON_GEROS_MASK, + /* 0x0E */ PLAYER_MASK_KAMAROS_MASK, + /* 0x0F */ PLAYER_MASK_CAPTAINS_HAT, + /* 0x10 */ PLAYER_MASK_STONE_MASK, + /* 0x11 */ PLAYER_MASK_BREMEN_MASK, + /* 0x12 */ PLAYER_MASK_BLAST_MASK, + /* 0x13 */ PLAYER_MASK_MASK_OF_SCENTS, + /* 0x14 */ PLAYER_MASK_GIANTS_MASK, + /* 0x15 */ PLAYER_MASK_FIERCE_DEITYS_MASK, + /* 0x16 */ PLAYER_MASK_GORON_MASK, + /* 0x17 */ PLAYER_MASK_ZORA_MASK, + /* 0x18 */ PLAYER_MASK_DEKU_MASK, + /* 0x19 */ PLAYER_MASK_MAX +} PlayerMask; + + +typedef struct { + /* 0x00 */ f32 unk_00; + /* 0x04 */ f32 unk_04; + /* 0x08 */ f32 unk_08; + /* 0x0C */ f32 unk_0C; + /* 0x10 */ f32 unk_10; + /* 0x14 */ f32 unk_14; + /* 0x18 */ f32 unk_18; + /* 0x1C */ f32 unk_1C; + /* 0x20 */ f32 unk_20; + /* 0x24 */ f32 unk_24; + /* 0x28 */ f32 unk_28; + /* 0x2C */ f32 unk_2C; + /* 0x30 */ f32 unk_30; + /* 0x34 */ f32 unk_34; + /* 0x38 */ f32 unk_38; + /* 0x3C */ f32 unk_3C; + /* 0x40 */ f32 unk_40; + /* 0x44 */ Vec3s unk_44; + /* 0x4A */ Vec3s unk_4A[4]; + /* 0x62 */ Vec3s unk_62[4]; + /* 0x7A */ Vec3s unk_7A[4]; + /* 0x92 */ u16 unk_92; + /* 0x94 */ u16 unk_94; + /* 0x98 */ f32 unk_98; + /* 0x9C */ f32 unk_9C; + /* 0xA0 */ LinkAnimationHeader* unk_A0; + /* 0xA4 */ LinkAnimationHeader* unk_A4; + /* 0xA8 */ LinkAnimationHeader* unk_A8; + /* 0xAC */ LinkAnimationHeader* unk_AC; + /* 0xB0 */ LinkAnimationHeader* unk_B0; + /* 0xB4 */ LinkAnimationHeader* unk_B4[4]; + /* 0xC4 */ LinkAnimationHeader* unk_C4[2]; + /* 0xCC */ LinkAnimationHeader* unk_CC[2]; + /* 0xD4 */ LinkAnimationHeader* unk_D4[2]; +} PlayerAgeProperties; // size = 0xDC + + +typedef struct { + /* 0x00 */ s32 active; + /* 0x04 */ Vec3f tip; + /* 0x10 */ Vec3f base; +} WeaponInfo; // size = 0x1C + + +typedef void (*PlayerFuncD58)(struct GlobalContext*, struct Player*); + + +typedef struct Player { + /* 0x000 */ Actor actor; + /* 0x144 */ s8 currentShield; + /* 0x145 */ s8 currentBoots; + /* 0x146 */ s8 heldItemButton; + /* 0x147 */ s8 itemActionParam; + /* 0x148 */ u8 heldItemId; + /* 0x149 */ s8 prevBoots; + /* 0x14A */ s8 heldItemActionParam; + /* 0x14B */ u8 transformation; + /* 0x14C */ u8 modelGroup; + /* 0x14D */ u8 nextModelGroup; + /* 0x14E */ s8 unk_14E; + /* 0x14F */ u8 modelAnimType; + /* 0x150 */ u8 leftHandType; + /* 0x151 */ u8 rightHandType; + /* 0x152 */ u8 sheathType; + /* 0x153 */ u8 currentMask; + /* 0x154 */ s8 unk_154; + /* 0x155 */ u8 prevMask; + /* 0x158 */ Gfx** rightHandDLists; + /* 0x15C */ Gfx** leftHandDLists; + /* 0x160 */ Gfx** sheathDLists; + /* 0x164 */ Gfx** waistDLists; + /* 0x168 */ f32 unk_168; + /* 0x16C */ f32 unk_16C; + /* 0x170 */ f32 unk_170; + /* 0x174 */ f32 unk_174; + /* 0x178 */ f32 unk_178; + /* 0x17C */ f32 unk_17C; + /* 0x180 */ f32 unk_180; + /* 0x184 */ f32 unk_184; + /* 0x188 */ f32 unk_188; + /* 0x18C */ f32 unk_18C; + /* 0x190 */ f32 unk_190; + /* 0x194 */ f32 unk_194; + /* 0x198 */ f32 unk_198; + /* 0x19C */ f32 unk_19C; + /* 0x1A0 */ f32 unk_1A0; + /* 0x1A4 */ f32 unk_1A4; + /* 0x1A8 */ f32 unk_1A8; + /* 0x1AC */ f32 unk_1AC; + /* 0x1B0 */ f32 unk_1B0; + /* 0x1B4 */ s16 unk_1B4; + /* 0x1B6 */ char unk_1B6[2]; + /* 0x1B8 */ u8 giObjectLoading; + /* 0x1BC */ DmaRequest giObjectDmaRequest; + /* 0x1DC */ OSMesgQueue giObjectLoadQueue; + /* 0x1F4 */ OSMesg giObjectLoadMsg; + /* 0x1F8 */ void* giObjectSegment; + /* 0x1FC */ u8 maskObjectLoading; + /* 0x1FD */ s8 maskId; + /* 0x200 */ DmaRequest maskDmaRequest; + /* 0x220 */ OSMesgQueue maskObjectLoadQueue; + /* 0x238 */ OSMesg maskObjectLoadMsg; + /* 0x23C */ void* maskObjectSegment; + /* 0x240 */ SkelAnime skelAnime; + /* 0x284 */ SkelAnime unk_284; + /* 0x2C8 */ SkelAnime unk_2C8; + /* 0x30C */ Vec3s jointTable[5]; + /* 0x32A */ Vec3s morphTable[5]; + /* 0x348 */ s16 eyeTexId; + /* 0x34A */ s16 eyeAnimTimer; + /* 0x34C */ Actor* leftHandActor; + /* 0x350 */ PosRot leftHandWorld; + /* 0x364 */ Actor* rightHandActor; + /* 0x368 */ PosRot rightHandWorld; + /* 0x37C */ s8 doorType; + /* 0x37D */ s8 doorDirection; + /* 0x37E */ s8 doorTimer; + /* 0x37F */ s8 doorNext; // used with spiral staircase + /* 0x380 */ Actor* doorActor; + /* 0x384 */ s16 unk_384; + /* 0x386 */ u16 unk_386; + /* 0x388 */ Actor* unk_388; + /* 0x38C */ s16 unk_38C; + /* 0x390 */ Actor* unk_390; + /* 0x394 */ u8 unk_394; + /* 0x395 */ u8 unk_395; + /* 0x396 */ u8 unk_396; + /* 0x397 */ u8 unk_397; + /* 0x398 */ Actor* unk_398; + /* 0x39C */ s16 unk_39C; + /* 0x39E */ s16 unk_39E; + /* 0x3A0 */ Vec3f unk_3A0; + /* 0x3AC */ Vec3f unk_3AC; + /* 0x3B8 */ u16 unk_3B8; + /* 0x3BA */ s16 unk_3BA; + /* 0x3BC */ s16 unk_3BC; + /* 0x3BE */ char unk_3BE[2]; + /* 0x3C0 */ Vec3f unk_3C0; + /* 0x3CC */ s16 unk_3CC; + /* 0x3CE */ s8 unk_3CE; + /* 0x3CF */ u8 unk_3CF; + /* 0x3D0 */ char unk_3D0[0x148]; + /* 0x518 */ ColliderCylinder cylinder; + /* 0x564 */ ColliderQuad swordQuads[2]; + /* 0x664 */ ColliderQuad shieldQuad; + /* 0x6E4 */ ColliderCylinder shieldCylinder; + /* 0x730 */ Actor* unk_730; + /* 0x734 */ char unk_734[8]; + /* 0x73C */ s32 blureEffectIndex[3]; + /* 0x748 */ char unk_748[0x320]; + /* 0xA68 */ PlayerAgeProperties* ageProperties; // repurposed as "transformation properties"? + /* 0xA6C */ u32 stateFlags1; + /* 0xA70 */ u32 stateFlags2; + /* 0xA74 */ u32 stateFlags3; + /* 0xA78 */ Actor* unk_A78; + /* 0xA7C */ Actor* boomerangActor; + /* 0xA80 */ Actor* naviActor; + /* 0xA84 */ s16 naviTextId; + /* 0xA86 */ s8 unk_A86; + /* 0xA87 */ s8 unk_A87; + /* 0xA88 */ Actor* targetActor; + /* 0xA8C */ f32 targetActorDistance; + /* 0xA90 */ Actor* unk_A90; + /* 0xA94 */ f32 unk_A94; + /* 0xA98 */ Actor* unk_A98; + /* 0xA9C */ f32 unk_A9C; + /* 0xAA0 */ f32 unk_AA0; + /* 0xAA4 */ s8 unk_AA4; + /* 0xAA5 */ u8 unk_AA5; + /* 0xAA6 */ u16 unk_AA6; + /* 0xAA8 */ s16 unk_AA8; + /* 0xAAA */ s16 unk_AAA; + /* 0xAAC */ Vec3s unk_AAC; + /* 0xAB2 */ Vec3s unk_AB2; + /* 0xAB8 */ f32 unk_AB8; + /* 0xABC */ f32 unk_ABC; + /* 0xAC0 */ f32 unk_AC0; + /* 0xAC4 */ void* unk_AC4; + /* 0xAC8 */ f32 unk_AC8; + /* 0xACC */ s16 unk_ACC; + /* 0xACE */ s8 unk_ACE; + /* 0xACF */ u8 unk_ACF; + /* 0xAD0 */ f32 linearVelocity; + /* 0xAD4 */ s16 currentYaw; + /* 0xAD6 */ s16 targetYaw; + /* 0xAD8 */ u16 unk_AD8; + /* 0xADA */ s8 swordAnimation; + /* 0xADB */ s8 swordState; + /* 0xADC */ s8 unk_ADC; + /* 0xADD */ s8 unk_ADD; + /* 0xADE */ u8 unk_ADE; + /* 0xADF */ s8 unk_ADF[4]; + /* 0xAE3 */ s8 unk_AE3[4]; + /* 0xAE7 */ s8 unk_AE7; // a timer + /* 0xAE8 */ s16 unk_AE8; // multipurpose timer + /* 0xAEC */ f32 unk_AEC; + /* 0xAF0 */ Vec3f unk_AF0[2]; + /* 0xB08 */ f32 unk_B08[8]; + /* 0xB28 */ s16 unk_B28; + /* 0xB2A */ s8 unk_B2A; + /* 0xB2B */ s8 unk_B2B; + /* 0xB2C */ f32 windSpeed; + /* 0xB30 */ s16 windAngleX; + /* 0xB32 */ s16 windAngleY; + /* 0xB34 */ f32 unk_B34; + /* 0xB38 */ f32 unk_B38; + /* 0xB3C */ f32 unk_B3C; + /* 0xB40 */ f32 unk_B40; + /* 0xB44 */ f32 unk_B44; + /* 0xB48 */ f32 unk_B48; + /* 0xB4C */ s16 unk_B4C; + /* 0xB4E */ s16 unk_B4E; + /* 0xB50 */ f32 unk_B50; + /* 0xB54 */ f32 unk_B54; + /* 0xB58 */ f32 unk_B58; + /* 0xB5C */ u8 unk_B5C; + /* 0xB5D */ u8 unk_B5D; + /* 0xB5E */ u8 unk_B5E; + /* 0xB5F */ u8 unk_B5F; + /* 0xB60 */ u16 unk_B60; // blast mask timer? + /* 0xB62 */ s16 unk_B62; + /* 0xB64 */ u8 unk_B64; + /* 0xB65 */ u8 unk_B65; + /* 0xB66 */ u8 unk_B66; + /* 0xB67 */ u8 unk_B67; // deku hop timer? + /* 0xB68 */ s16 unk_B68; + /* 0xB6A */ s16 unk_B6A; + /* 0xB6C */ s16 unk_B6C; + /* 0xB6E */ s16 unk_B6E; + /* 0xB70 */ s16 unk_B70; + /* 0xB72 */ u16 unk_B72; // floor type? + /* 0xB74 */ u8 unk_B74; + /* 0xB75 */ u8 unk_B75; + /* 0xB76 */ s16 unk_B76; + /* 0xB78 */ f32 unk_B78; + /* 0xB7C */ f32 unk_B7C; + /* 0xB80 */ f32 unk_B80; + /* 0xB84 */ s16 unk_B84; + /* 0xB86 */ s16 unk_B86; + /* 0xB88 */ s16 unk_B88; + /* 0xB8A */ s16 unk_B8A; + /* 0xB8C */ s16 unk_B8C; + /* 0xB8E */ s16 unk_B8E; + /* 0xB90 */ s16 unk_B90; + /* 0xB92 */ s16 unk_B92; + /* 0xB94 */ s16 unk_B94; + /* 0xB96 */ s16 unk_B96; + /* 0xB98 */ WeaponInfo swordInfo[3]; + /* 0xBEC */ Vec3f bodyPartsPos[18]; + /* 0xCC4 */ MtxF mf_CC4; + /* 0xD04 */ MtxF shieldMf; + /* 0xD44 */ u8 isBurning; + /* 0xD45 */ u8 flameTimers[18]; // one flame per body part + /* 0xD57 */ u8 unk_D57; + /* 0xD58 */ PlayerFuncD58 unk_D58; + /* 0xD5C */ s8 invincibilityTimer; // prevents damage when nonzero (positive = visible, counts towards zero each frame) + /* 0xD5D */ u8 unk_D5D; + /* 0xD5E */ u8 unk_D5E; + /* 0xD5F */ u8 unk_D5F; + /* 0xD60 */ f32 unk_D60; + /* 0xD64 */ s16 unk_D64; + /* 0xD66 */ u16 unk_D66; + /* 0xD68 */ s16 unk_D68; + /* 0xD6A */ s8 unk_D6A; + /* 0xD6B */ u8 unk_D6B; + /* 0xD6C */ Vec3f unk_D6C; // previous body part 0 position +} Player; // size = 0xD78 + +#endif diff --git a/src/code/code_0x800CAAD0.c b/src/code/code_0x800CAAD0.c index 0db62aca08..9c28f81f0d 100644 --- a/src/code/code_0x800CAAD0.c +++ b/src/code/code_0x800CAAD0.c @@ -50,7 +50,7 @@ void BgCheck2_UpdateActorYRotation(CollisionContext* colCtx, s32 index, Actor* a angleChange = colCtx->dyna.bgActors[index].curTransform.rot.y - colCtx->dyna.bgActors[index].prevTransform.rot.y; if (actor->id == 0) { - ((ActorPlayer*)actor)->unkAD4 += angleChange; + ((Player*)actor)->currentYaw += angleChange; } actor->shape.rot.y += angleChange; diff --git a/src/code/code_0x800E8EA0.c b/src/code/code_0x800E8EA0.c index 9f6e86c3a4..145701240e 100644 --- a/src/code/code_0x800E8EA0.c +++ b/src/code/code_0x800E8EA0.c @@ -55,7 +55,7 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4) } s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, f32 param_5) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; s16 sVar3; Vec3f local_14; @@ -74,15 +74,16 @@ s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* if (((globalCtx->csCtx).state != 0) || (D_801D0D50 != 0)) { local_14 = globalCtx->view.eye; } else { - local_14 = player->base.focus.pos; + local_14 = player->actor.focus.pos; } func_800E8FA4(actor, &local_14, param_3, param_4); return 1; } + s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; s16 sVar3; Vec3f local_14; @@ -100,7 +101,7 @@ s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* if (((globalCtx->csCtx).state != 0) || (D_801D0D50 != 0)) { local_14 = globalCtx->view.eye; } else { - local_14 = player->base.focus.pos; + local_14 = player->actor.focus.pos; } func_800E8FA4(actor, &local_14, param_3, param_4); diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 69e9fd9ec4..9c64de42ea 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -875,9 +875,9 @@ void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* #endif void EffectSsFireTail_SpawnFlameOnPlayer(GlobalContext* globalCtx, f32 scale, s16 bodyPart, f32 colorIntensity) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; - EffectSsFireTail_SpawnFlame(globalCtx, &player->base, &player->bodyPartsPos[bodyPart], scale, bodyPart, + EffectSsFireTail_SpawnFlame(globalCtx, &player->actor, &player->bodyPartsPos[bodyPart], scale, bodyPart, colorIntensity); } diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index b0c0eda13b..8d67625a91 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -404,7 +404,7 @@ void func_800A6780(EnItem00* this, GlobalContext* globalCtx) { } void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; if (this->unk14A != 0) { if (Actor_HasParent(&this->actor, globalCtx) == 0) { @@ -420,7 +420,7 @@ void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) { return; } - this->actor.world.pos = player->base.world.pos; + this->actor.world.pos = player->actor.world.pos; if (this->actor.params <= ITEM00_RUPEE_RED) { this->actor.shape.rot.y = this->actor.shape.rot.y + 960; @@ -440,8 +440,8 @@ void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) { void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { EnItem00* this = THIS; s32 pad; - ActorPlayer* player = PLAYER; - s32 sp38 = player->unkA74 & 0x1000; + Player* player = PLAYER; + s32 sp38 = player->stateFlags3 & 0x1000; s32 getItemId = GI_NONE; s32 pad2; diff --git a/src/code/z_snap.c b/src/code/z_snap.c index cae6f3e16c..aea74db3e9 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -149,7 +149,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, } actors[0] = actor; - actors[1] = &PLAYER->base; + actors[1] = &PLAYER->actor; if (CollisionCheck_LineOCCheck(globalCtx, &globalCtx->colCheckCtx, pos, &camera->eye, actors, 2) != 0) { func_8013A41C(0x3b); ret |= 0x3b; diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 63f928c143..69ac194348 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -79,7 +79,7 @@ void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx) { if (this->actor.parent == NULL) { ArmsHook_SetupAction(this, ArmsHook_Shoot); func_800B6C04(&this->actor, 20.0f); - this->actor.parent = &PLAYER->base; + this->actor.parent = &PLAYER->actor; this->timer = 26; } } @@ -89,11 +89,11 @@ void func_808C1154(ArmsHook* this) { this->actor.parent->parent = &this->actor; } -s32 ArmsHook_AttachToPlayer(ArmsHook* this, ActorPlayer* player) { - player->base.child = &this->actor; - player->heldActor = &this->actor; +s32 ArmsHook_AttachToPlayer(ArmsHook* this, Player* player) { + player->actor.child = &this->actor; + player->leftHandActor = &this->actor; if (this->actor.child != NULL) { - player->base.parent = this->actor.child = NULL; + player->actor.parent = this->actor.child = NULL; return 1; } return 0; @@ -107,13 +107,13 @@ void ArmsHook_DetachHookFromActor(ArmsHook* this) { } s32 ArmsHook_CheckForCancel(ArmsHook* this) { - ActorPlayer* player = (ActorPlayer*)this->actor.parent; + Player* player = (Player*)this->actor.parent; if (func_801240C8(player)) { - if ((player->heldItemActionParam != player->itemActionParam) || ((player->base.flags & 0x100)) || + if ((player->heldItemActionParam != player->itemActionParam) || ((player->actor.flags & 0x100)) || ((player->stateFlags1 & 0x4000080))) { this->timer = 0; ArmsHook_DetachHookFromActor(this); - Math_Vec3f_Copy(&this->actor.world.pos, &player->unk368); + Math_Vec3f_Copy(&this->actor.world.pos, &player->rightHandWorld.pos); return 1; } } @@ -127,7 +127,7 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) { } void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; if ((this->actor.parent == NULL) || (!func_801240C8(player))) { ArmsHook_DetachHookFromActor(this); @@ -135,7 +135,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { return; } - func_800B8F98(&player->base, NA_SE_IT_HOOKSHOT_CHAIN - SFX_FLAG); + func_800B8F98(&player->actor, NA_SE_IT_HOOKSHOT_CHAIN - SFX_FLAG); ArmsHook_CheckForCancel(this); if (this->timer != 0 && (this->collider.base.atFlags & AT_HIT) && @@ -184,7 +184,8 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { { f32 velocity; - bodyDistDiff = Math_Vec3f_DistXYZAndStoreDiff(&player->unk368, &this->actor.world.pos, &bodyDistDiffVec); + bodyDistDiff = + Math_Vec3f_DistXYZAndStoreDiff(&player->rightHandWorld.pos, &this->actor.world.pos, &bodyDistDiffVec); if (bodyDistDiff < 30.0f) { velocity = 0.0f; phi_f16 = 0.0f; @@ -211,13 +212,13 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { } if (this->actor.child == NULL) { - Math_Vec3f_Sum(&player->unk368, &newPos, &this->actor.world.pos); + Math_Vec3f_Sum(&player->rightHandWorld.pos, &newPos, &this->actor.world.pos); if (grabbed != NULL) { Math_Vec3f_Sum(&this->actor.world.pos, &this->unk1FC, &grabbed->world.pos); } } else { - Math_Vec3f_Diff(&bodyDistDiffVec, &newPos, &player->base.velocity); - player->base.world.rot.x = + Math_Vec3f_Diff(&bodyDistDiffVec, &newPos, &player->actor.velocity); + player->actor.world.rot.x = Math_FAtan2F(sqrtf(SQ(bodyDistDiffVec.x) + SQ(bodyDistDiffVec.z)), -bodyDistDiffVec.y); } if (phi_f16 < 50.0f) { @@ -225,8 +226,8 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { if (phi_f16 == 0.0f) { ArmsHook_SetupAction(this, ArmsHook_Wait); if (ArmsHook_AttachToPlayer(this, player)) { - Math_Vec3f_Diff(&this->actor.world.pos, &player->base.world.pos, &player->base.velocity); - player->base.velocity.y -= 20.0f; + Math_Vec3f_Diff(&this->actor.world.pos, &player->actor.world.pos, &player->actor.velocity); + player->actor.velocity.y -= 20.0f; } } } @@ -287,14 +288,14 @@ void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) { void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { ArmsHook* this = THIS; s32 pad; - ActorPlayer* player = PLAYER; + Player* player = PLAYER; Vec3f sp68; Vec3f sp5C; Vec3f sp50; f32 sp4C; f32 sp48; - if (player->base.draw != NULL && player->unk151 == 0xB) { + if (player->actor.draw != NULL && player->rightHandType == 0xB) { // OPEN_DISP macro { GraphicsContext* sp44 = globalCtx->state.gfxCtx; @@ -319,7 +320,7 @@ void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { gSPDisplayList(sp44->polyOpa.p++, D_0601D960); SysMatrix_InsertTranslation(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - Math_Vec3f_Diff(&player->unk368, &this->actor.world.pos, &sp68); + Math_Vec3f_Diff(&player->rightHandWorld.pos, &this->actor.world.pos, &sp68); sp48 = SQ(sp68.x) + SQ(sp68.z); sp4C = sqrtf(sp48); Matrix_RotateY(Math_Atan2S(sp68.x, sp68.z), MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c index 6813e688eb..1924e2f483 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c @@ -55,7 +55,7 @@ static Gfx* bgCtowerRotDlists[] = { D_06012DA0, D_06017220, D_060174E0 }; void BgCtowerRot_Init(Actor* thisx, GlobalContext* globalCtx) { BgCtowerRot* this = THIS; s32 pad; - ActorPlayer* player; + Player* player; Vec3f offset; Actor_ProcessInitChain(&this->dyna.actor, sInitChain); @@ -73,7 +73,7 @@ void BgCtowerRot_Init(Actor* thisx, GlobalContext* globalCtx) { BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_06017650); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y - 0x4000; } - Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->base.world.pos); + Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->actor.world.pos); if (offset.z < 0.0f) { this->dyna.actor.world.pos.x = this->dyna.actor.home.pos.x + (Math_SinS(this->dyna.actor.world.rot.y) * 80.0f); this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + (Math_CosS(this->dyna.actor.world.rot.y) * 80.0f); @@ -91,13 +91,13 @@ void BgCtowerRot_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void BgCtowerRot_CorridorRotate(BgCtowerRot* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; Vec3f offset; f32 rotZ; f32 offsetDiffZ; f32 rotZtmp; - Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->base.world.pos); + Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->actor.world.pos); if (offset.z > 1100.0f) { rotZ = 0.0f; } else { @@ -134,10 +134,10 @@ void BgCtowerRot_DoorClose(BgCtowerRot* this, GlobalContext* globalCtx) { } void BgCtowerRot_DoorIdle(BgCtowerRot* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; Vec3f offset; - Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->base.world.pos); + Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->actor.world.pos); if (offset.z > 30.0f) { this->unk160 = 0.0f; ActorCutscene_SetIntentToPlay(this->dyna.actor.cutscene); diff --git a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c index 4486335e74..9bfb828249 100644 --- a/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c +++ b/src/overlays/actors/ovl_Bg_Icicle/z_bg_icicle.c @@ -165,8 +165,8 @@ void BgIcicle_Shiver(BgIcicle* this, GlobalContext* globalCtx) { } void BgIcicle_Fall(BgIcicle* this, GlobalContext* globalCtx) { - if ((this->collider.base.atFlags & 2) || (this->dyna.actor.bgCheckFlags & 1)) { - this->collider.base.atFlags &= ~2; + if ((this->collider.base.atFlags & AT_HIT) || (this->dyna.actor.bgCheckFlags & 1)) { + this->collider.base.atFlags &= ~AT_HIT; this->dyna.actor.bgCheckFlags &= ~1; if (this->dyna.actor.world.pos.y < this->dyna.actor.floorHeight) { @@ -202,8 +202,8 @@ void BgIcicle_Regrow(BgIcicle* this, GlobalContext* globalCtx) { void BgIcicle_UpdateAttacked(BgIcicle* this, GlobalContext* globalCtx) { s32 sp24; - if (this->collider.base.acFlags & 2) { - this->collider.base.acFlags &= ~2; + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; if (this->dyna.actor.params == ICICLE_STALAGMITE_RANDOM_DROP) { BgIcicle_Break(this, globalCtx, 50.0f); diff --git a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c index 788c849550..19836f1f67 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.c @@ -57,14 +57,14 @@ void BgIkanaRay_Init(Actor* thisx, GlobalContext* globalCtx) { BgIkanaRay* this = THIS; ColliderCylinder* collision = &this->collision; - Actor_ProcessInitChain(&this->base, sInitChain); + Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitCylinder(globalCtx, collision); - Collider_SetCylinder(globalCtx, collision, &this->base, &sCylinderInit); - Collider_UpdateCylinder(&this->base, &this->collision); + Collider_SetCylinder(globalCtx, collision, &this->actor, &sCylinderInit); + Collider_UpdateCylinder(&this->actor, &this->collision); this->animatedTextures = (AnimatedMaterial*)Lib_SegmentedToVirtual(object_ikana_obj_001228); - if (Flags_GetSwitch(globalCtx, this->base.params & 0x7F) != 0) { + if (Flags_GetSwitch(globalCtx, this->actor.params & 0x7F)) { BgIkanaRay_SetActivated(this); } else { BgIkanaRay_SetDeactivated(this); @@ -79,20 +79,20 @@ void BgIkanaRay_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void BgIkanaRay_SetDeactivated(BgIkanaRay* this) { - this->base.draw = NULL; - this->base.flags |= 0x10; + this->actor.draw = NULL; + this->actor.flags |= 0x10; this->update = BgIkanaRay_UpdateCheckForActivation; } void BgIkanaRay_UpdateCheckForActivation(BgIkanaRay* this, GlobalContext* globalCtx) { - if (Flags_GetSwitch(globalCtx, this->base.params & 0x7F) != 0) { + if (Flags_GetSwitch(globalCtx, this->actor.params & 0x7F)) { BgIkanaRay_SetActivated(this); } } void BgIkanaRay_SetActivated(BgIkanaRay* this) { - this->base.draw = BgIkanaRay_Draw; - this->base.flags &= ~0x10; + this->actor.draw = BgIkanaRay_Draw; + this->actor.flags &= ~0x10; this->update = BgIkanaRay_UpdateActivated; } diff --git a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h index 50178c02c9..9a3cb77de1 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h +++ b/src/overlays/actors/ovl_Bg_Ikana_Ray/z_bg_ikana_ray.h @@ -6,7 +6,7 @@ struct BgIkanaRay; typedef struct BgIkanaRay { - /* 0x000 */ Actor base; + /* 0x000 */ Actor actor; /* 0x144 */ ColliderCylinder collision; /* 0x190 */ AnimatedMaterial* animatedTextures; /* 0x194 */ void (*update)(struct BgIkanaRay*, GlobalContext*); diff --git a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c index 8eedd685e5..26d84dd8fc 100644 --- a/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c +++ b/src/overlays/actors/ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c @@ -49,9 +49,9 @@ static InitChainEntry sInitChain[] = { s32 func_80C0A740(BgIkninSusceil* this, GlobalContext* globalCtx) { s32 pad2[2]; Vec3f offset; - ActorPlayer* player = PLAYER; + Player* player = PLAYER; - Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->base.world.pos); + Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->actor.world.pos); return (D_80C0B0E8.x < offset.z) && (offset.z < D_80C0B0E8.y) && (offset.x > -240.0f) && (offset.x < D_80C0B0E4); } @@ -84,11 +84,11 @@ s32 func_80C0A95C(BgIkninSusceil* this, GlobalContext* globalCtx) { s32 phi_t0 = true; s32 i; f32 new_var; - ActorPlayer* player = PLAYER; + Player* player = PLAYER; Vec3f offset; f32 temp1, temp2, temp3, temp4; - Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->base.world.pos); + Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->actor.world.pos); for (i = 0; i < 7; i++) { temp3 = (D_80C0B0F0[i] * 80.0f) + 0.5f; temp4 = (D_80C0B0F0[i] * 80.0f) + 79.5f; @@ -218,12 +218,12 @@ void func_80C0AE5C(BgIkninSusceil* this, GlobalContext* globalCtx) { void BgIkninSusceil_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; BgIkninSusceil* this = THIS; - ActorPlayer* player = PLAYER; + Player* player = PLAYER; - if ((this->unk168 == 0) && (this->unk166 > 0) && ((player->unkA74 & 0x100) != 0) && (player->unkB48 > 1000.0f)) { + if ((this->unk168 == 0) && (this->unk166 > 0) && (player->stateFlags3 & 0x100) && (player->unk_B48 > 1000.0f)) { this->unk168 = 2; if ((func_80C0A95C(this, globalCtx) != 0) && (this->actionFunc != func_80C0AE5C)) { - func_800B8E58(&player->base, NA_SE_PL_BODY_HIT); + func_800B8E58(&player->actor, NA_SE_PL_BODY_HIT); func_80C0AE3C(this); } } @@ -236,7 +236,7 @@ void BgIkninSusceil_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->dyna.actor.home.pos.y + 70.0f) < this->dyna.actor.world.pos.y) { this->unk166 = 0; - } else if ((player->unkA74 & 0x100) != 0) { + } else if (player->stateFlags3 & 0x100) { this->unk166 = 3; } else { if (this->unk166 > 0) { diff --git a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c index 4b129e8e36..7bce96703a 100644 --- a/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c +++ b/src/overlays/actors/ovl_Bg_Iknv_Obj/z_bg_iknv_obj.c @@ -33,21 +33,21 @@ const ActorInit Bg_Iknv_Obj_InitVars = { }; static ColliderCylinderInit sCylinderInit = { - { - COLTYPE_NONE, + { + COLTYPE_NONE, AT_NONE, - AC_ON | AC_TYPE_ENEMY, - OC1_ON | OC1_TYPE_ALL, - OC2_TYPE_1, - COLSHAPE_CYLINDER, + AC_ON | AC_TYPE_ENEMY, + OC1_ON | OC1_TYPE_ALL, + OC2_TYPE_1, + COLSHAPE_CYLINDER, }, - { - ELEMTYPE_UNK0, - { 0x00000000, 0x00, 0x00 }, - { 0xF7CFFFFF, 0x00, 0x00 }, - TOUCH_NONE | TOUCH_SFX_NORMAL, - BUMP_ON, - OCELEM_ON, + { + ELEMTYPE_UNK0, + { 0x00000000, 0x00, 0x00 }, + { 0xF7CFFFFF, 0x00, 0x00 }, + TOUCH_NONE | TOUCH_SFX_NORMAL, + BUMP_ON, + OCELEM_ON, }, { 40, 40, 0, { 0, 0, 0 } }, }; @@ -88,7 +88,7 @@ void BgIknvObj_Init(Actor* thisx, GlobalContext* globalCtx) { break; default: Actor_MarkForDeath(&this->dyna.actor); - } + } } void BgIknvObj_Destroy(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c index 920c48f05e..1259d3f7bc 100644 --- a/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c +++ b/src/overlays/actors/ovl_Bg_Kin2_Fence/z_bg_kin2_fence.c @@ -185,7 +185,7 @@ void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, GlobalContext* globalCtx) { s32 hitMask; s32 nextMask; - if (this->collider.base.acFlags & 2) { + if (this->collider.base.acFlags & AC_HIT) { hitMask = BgKin2Fence_CheckHitMask(this); if (hitMask >= 0) { nextMask = (s8)gSaveContext.spiderHouseMaskOrder[this->masksHit]; @@ -198,7 +198,7 @@ void BgKin2Fence_HandleMaskCode(BgKin2Fence* this, GlobalContext* globalCtx) { this->masksHit = 0; } } - this->collider.base.acFlags &= ~2; + this->collider.base.acFlags &= ~AC_HIT; this->cooldownTimer = 5; if (this->masksHit > 5) { BgKin2Fence_SetupPlayOpenCutscene(this); diff --git a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c index 26262278e8..063af19d24 100644 --- a/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c +++ b/src/overlays/actors/ovl_Bg_Tobira01/z_bg_tobira01.c @@ -25,7 +25,7 @@ extern Gfx D_06000088[]; extern CollisionHeader D_060011C0; void BgTobira01_Open(BgTobira01* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; s16 cutsceneId = this->dyna.actor.cutscene; s16 prevTimer; @@ -41,7 +41,7 @@ void BgTobira01_Open(BgTobira01* this, GlobalContext* globalCtx) { } } else if (!(gSaveContext.weekEventReg[88] & 0x40) && (this->timer == 0) && (globalCtx->actorCtx.unk1F5 != 0) && (globalCtx->actorCtx.unk1F4 == 0) && - (func_800C99AC(&globalCtx->colCtx, player->base.floorPoly, player->base.floorBgId) == 6)) { + (func_800C99AC(&globalCtx->colCtx, player->actor.floorPoly, player->actor.floorBgId) == 6)) { this->playCutscene = true; this->unk_16C = 0; // this variable is not used anywhere else } diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index fbcd027793..8d0294a59f 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -118,7 +118,7 @@ void DoorAna_WaitClosed(DoorAna* this, GlobalContext* globalCtx) { } void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; s32 dooranaType = GET_DOORANA_TYPE(this); s8 pad[4]; s32 entranceIndex; @@ -126,7 +126,7 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f) != 0) { if ((this->actor.targetMode != 0) && (globalCtx->unk18875 == 0) && (globalCtx->unk18B4A == 0) && - (player->stateFlags1 & 0x80000000) && (player->unkAE7 == 0)) { + (player->stateFlags1 & 0x80000000) && (player->unk_AE7 == 0)) { if (dooranaType == DOORANA_TYPE_ADJACENT) { // 300 uses scene exit addresses, not static DoorAna entrance addresses, @@ -175,7 +175,7 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { } void DoorAna_GrabLink(DoorAna* this, GlobalContext* globalCtx) { - ActorPlayer* player; + Player* player; s8 pad[2]; if (ActorCutscene_GetCurrentIndex() != this->actor.cutscene) { @@ -188,18 +188,18 @@ void DoorAna_GrabLink(DoorAna* this, GlobalContext* globalCtx) { if ((this->actor.yDistToPlayer <= 0.0f) && (this->actor.xzDistToPlayer > 20.0f)) { player = PLAYER; - player->base.world.pos.x = (Math_SinS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.x; - player->base.world.pos.z = (Math_CosS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.z; + player->actor.world.pos.x = (Math_SinS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.x; + player->actor.world.pos.z = (Math_CosS(this->actor.yawTowardsPlayer) * 20.0f) + this->actor.world.pos.z; } } void DoorAna_Update(Actor* thisx, GlobalContext* globalCtx) { DoorAna* this = THIS; + this->actionFunc(this, globalCtx); this->actor.shape.rot.y = func_800DFCDC(globalCtx->cameraPtrs[globalCtx->activeCamera]) + 0x8000; } void DoorAna_Draw(Actor* thisx, GlobalContext* globalCtx) { - Gfx* doorAnaDL = D_05000C40; - func_800BE03C(globalCtx, doorAnaDL); + func_800BE03C(globalCtx, D_05000C40); } diff --git a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c index 498f2cf2a9..e6777da703 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -223,13 +223,13 @@ void DoorSpiral_WaitForObject(DoorSpiral* this, GlobalContext* globalCtx) { */ f32 DoorSpiral_GetDistFromPlayer(GlobalContext* globalCtx, DoorSpiral* this, f32 yOffset, f32 spiralWidth, f32 spiralHeight) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; Vec3f target; Vec3f offset; - target.x = player->base.world.pos.x; - target.y = player->base.world.pos.y + yOffset; - target.z = player->base.world.pos.z; + target.x = player->actor.world.pos.x; + target.y = player->actor.world.pos.y + yOffset; + target.z = player->actor.world.pos.z; Actor_CalcOffsetOrientedToDrawRotation(&this->actor, &offset, &target); @@ -244,7 +244,7 @@ f32 DoorSpiral_GetDistFromPlayer(GlobalContext* globalCtx, DoorSpiral* this, f32 * Checks if the player should climb the stairs. */ s32 DoorSpiral_PlayerShouldClimb(DoorSpiral* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; if (!(func_801233E4(globalCtx))) { SpiralInfo* spiralInfo = &sSpiralInfo[this->spiralType]; @@ -252,7 +252,7 @@ s32 DoorSpiral_PlayerShouldClimb(DoorSpiral* this, GlobalContext* globalCtx) { DoorSpiral_GetDistFromPlayer(globalCtx, this, 0.0f, spiralInfo->spiralWidth, spiralInfo->spiralHeight); if (fabsf(dist) < 64.0f) { - s16 angle = player->base.shape.rot.y - this->actor.shape.rot.y; + s16 angle = player->actor.shape.rot.y - this->actor.shape.rot.y; if (dist > 0.0f) { angle = 0x8000 - angle; @@ -271,7 +271,7 @@ s32 DoorSpiral_PlayerShouldClimb(DoorSpiral* this, GlobalContext* globalCtx) { * Wait for the player to interact with the stairs. */ void DoorSpiral_Wait(DoorSpiral* this, GlobalContext* globalCtx) { - ActorPlayer* player; + Player* player; s32 transition; if (this->shouldClimb) { @@ -283,7 +283,7 @@ void DoorSpiral_Wait(DoorSpiral* this, GlobalContext* globalCtx) { player->doorDirection = this->orientation; player->doorActor = &this->actor; transition = GET_TRANSITION_ID_PARAM(this); - player->unk37F = ((u16)globalCtx->transitionCtx.transitionActorList[transition].params) >> 10; + player->doorNext = ((u16)globalCtx->transitionCtx.transitionActorList[transition].params) >> 10; func_80122F28(player, globalCtx, &this->actor); } @@ -293,7 +293,7 @@ void DoorSpiral_Wait(DoorSpiral* this, GlobalContext* globalCtx) { * Player is climbing the stairs. */ void DoorSpiral_PlayerClimb(DoorSpiral* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; if (!(player->stateFlags1 & 0x20000000)) { DoorSpiral_SetupAction(this, DoorSpiral_WaitForObject); @@ -304,7 +304,7 @@ void DoorSpiral_PlayerClimb(DoorSpiral* this, GlobalContext* globalCtx) { void DoorSpiral_Update(Actor* thisx, GlobalContext* globalCtx) { DoorSpiral* this = (DoorSpiral*)thisx; s32 pad; - ActorPlayer* player = PLAYER; + Player* player = PLAYER; if ((!(player->stateFlags1 & 0x100004C0)) || (this->actionFunc == DoorSpiral_WaitForObject)) { this->actionFunc(this, globalCtx); diff --git a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c index a90ec2f719..082e5a1ae6 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -165,7 +165,7 @@ void func_80918FE4(EffDust* this, GlobalContext* globalCtx) { void func_80919230(EffDust* this, GlobalContext* globalCtx) { s16 theta; - ActorPlayer* player = PLAYER; + Player* player = PLAYER; Actor* parent = this->actor.parent; f32* distanceTraveled = this->distanceTraveled; s32 i; @@ -315,7 +315,7 @@ void func_809199FC(Actor* thisx, GlobalContext* globalCtx2) { Vec3f* initialPositions; s32 i; f32 aux; - ActorPlayer* player = PLAYER; + Player* player = PLAYER; OPEN_DISPS(gfxCtx); func_8012C28C(gfxCtx); @@ -326,7 +326,7 @@ void func_809199FC(Actor* thisx, GlobalContext* globalCtx2) { distanceTraveled = this->distanceTraveled; gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, 255); - if (player->unkB08 >= 0.85f) { + if (player->unk_B08[0] >= 0.85f) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); } else { gDPSetEnvColor(POLY_XLU_DISP++, 0, 0, 255, 0); diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index b79a2a9fcf..a65aaac4a8 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -112,7 +112,7 @@ void EnEncount2_Idle(EnEncount2* this, GlobalContext* globalCtx) { this->oscillationAngle += 1500.0f; this->dyna.actor.velocity.y = Math_SinS(this->oscillationAngle); Math_ApproachF(&this->scale, 0.1f, 0.3f, 0.01f); - if (((this->collider.base.acFlags & AC_HIT) != 0) && (this->dyna.actor.colChkInfo.damageEffect == 0xE)) { + if ((this->collider.base.acFlags & AC_HIT) && (this->dyna.actor.colChkInfo.damageEffect == 0xE)) { this->dyna.actor.colChkInfo.health = 0; this->isPopped = 1; this->actionFunc = EnEncount2_Popped; diff --git a/src/overlays/actors/ovl_En_Fg/z_en_fg.c b/src/overlays/actors/ovl_En_Fg/z_en_fg.c index 0d730fa0b7..231369ed1e 100644 --- a/src/overlays/actors/ovl_En_Fg/z_en_fg.c +++ b/src/overlays/actors/ovl_En_Fg/z_en_fg.c @@ -130,7 +130,7 @@ u8 EnFg_UpdateHealth(EnFg* this) { s32 EnFg_GetDamageEffect(EnFg* this) { s32 ret = 0; - if (this->collider.base.acFlags & 2) { + if (this->collider.base.acFlags & AC_HIT) { switch (this->actor.colChkInfo.damageEffect) { case 1: ret = FG_DMGEFFECT_DEKUSTICK; @@ -148,7 +148,7 @@ s32 EnFg_GetDamageEffect(EnFg* this) { ret = FG_DMGEFFECT_EXPLOSION; break; } - this->collider.base.acFlags &= ~2; + this->collider.base.acFlags &= ~AC_HIT; EnFg_UpdateHealth(this); } return ret; diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index 99df382977..7545c40a13 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -216,21 +216,21 @@ void func_808F32A0(EnIn* this, GlobalContext* globalCtx) { } s32 func_808F3310(EnIn* this, GlobalContext* globalCtx) { - if (this->colliderCylinder.base.acFlags & 2) { - this->colliderCylinder.base.acFlags &= ~2; + if (this->colliderCylinder.base.acFlags & AC_HIT) { + this->colliderCylinder.base.acFlags &= ~AC_HIT; } return 0; } s32 func_808F3334(EnIn* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; - if (this->colliderJntSph.base.atFlags & 2) { - this->colliderJntSph.base.atFlags &= ~2; - if (this->colliderJntSph.base.atFlags & 4) { + if (this->colliderJntSph.base.atFlags & AT_HIT) { + this->colliderJntSph.base.atFlags &= ~AT_HIT; + if (this->colliderJntSph.base.atFlags & AT_BOUNCED) { return 0; } - Audio_PlayActorSound2(&player->base, 0x83E); + Audio_PlayActorSound2(&player->actor, 0x83E); func_800B8D98(globalCtx, &this->actor, 3.0f, this->actor.yawTowardsPlayer, 6.0f); } return 1; @@ -247,16 +247,16 @@ s32 func_808F33B8(void) { } void func_808F3414(EnIn* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; Vec3f sp30; if (this->unk23D == 0) { this->unk494 = SkelAnime_FrameUpdateMatrix(&this->skelAnime); } if (func_8013D5E8(this->actor.shape.rot.y, 0x2710, this->actor.yawTowardsPlayer)) { - sp30.x = player->base.world.pos.x; + sp30.x = player->actor.world.pos.x; sp30.y = player->bodyPartsPos[7].y + 3.0f; - sp30.z = player->base.world.pos.z; + sp30.z = player->actor.world.pos.z; func_8013D2E0(&sp30, &this->actor.focus, &this->actor.shape, &this->unk352, &this->unk358, &this->unk35E, D_808F6C0C); } else { @@ -471,7 +471,7 @@ void func_808F3D40(EnIn* this, GlobalContext* globalCtx) { u16 func_808F3DD4(GlobalContext* globalCtx, EnIn* this, u32 arg2) { u16 textId = 0; - if (func_8012403C(globalCtx) == 8) { + if (Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADERS_MASK) { if (!(gSaveContext.weekEventReg[63] & 0x40)) { return 0x34A9; } else if (this->unk4AC & 8) { @@ -1211,7 +1211,7 @@ s32 func_808F5728(GlobalContext* globalCtx, EnIn* this, s32 arg2, s32* arg3) { s16 rotDiff; s16 yawDiff; s16 yawDiffA; - ActorPlayer* player; + Player* player; if (*arg3 == 4) { return 0; @@ -1232,7 +1232,7 @@ s32 func_808F5728(GlobalContext* globalCtx, EnIn* this, s32 arg2, s32* arg3) { } if (*arg3 == 1) { player = PLAYER; - func_808F5994(this, globalCtx, &player->base.world.pos, 0xC80); + func_808F5994(this, globalCtx, &player->actor.world.pos, 0xC80); dummy_label_895711:; // POSSIBLE FAKE MATCH } else { rotDiff = this->actor.home.rot.y - this->actor.world.rot.y; @@ -1315,7 +1315,7 @@ void func_808F5A94(EnIn* this, GlobalContext* globalCtx) { void func_808F5B58(EnIn* this, GlobalContext* globalCtx) { if (func_800F41E4(globalCtx, &globalCtx->actorCtx)) { - if ((func_8012403C(globalCtx) == 8 && gSaveContext.weekEventReg[63] & 0x40) || + if ((Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADERS_MASK && gSaveContext.weekEventReg[63] & 0x40) || gSaveContext.weekEventReg[56] & 8) { if (gSaveContext.day == 3) { func_808F5728(globalCtx, this, 6, &this->unk48C); @@ -1323,8 +1323,8 @@ void func_808F5B58(EnIn* this, GlobalContext* globalCtx) { func_808F5728(globalCtx, this, 2, &this->unk48C); } } - } else if (func_8012403C(globalCtx) != 8 || - (func_8012403C(globalCtx) == 8 && gSaveContext.weekEventReg[63] & 0x40)) { + } else if (Player_GetMask(globalCtx) != PLAYER_MASK_CIRCUS_LEADERS_MASK || + (Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADERS_MASK && gSaveContext.weekEventReg[63] & 0x40)) { if (gSaveContext.day == 3) { func_808F5728(globalCtx, this, 4, &this->unk48C); } else { @@ -1337,7 +1337,8 @@ void func_808F5C98(EnIn* this, GlobalContext* globalCtx) { if (this->unk4B0 == 0) { this->actionFunc = func_808F5B58; } - if ((func_8012403C(globalCtx) == 8 && gSaveContext.weekEventReg[63] & 0x40) || gSaveContext.weekEventReg[56] & 8) { + if ((Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADERS_MASK && gSaveContext.weekEventReg[63] & 0x40) || + gSaveContext.weekEventReg[56] & 8) { if (gSaveContext.day != 3) { func_808F5728(globalCtx, this, 2, &this->unk48C); } else { @@ -1473,7 +1474,7 @@ void EnIn_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk4AC &= ~2; func_808F38F8(this, globalCtx); } - if (func_8012403C(globalCtx) == 8) { + if (Player_GetMask(globalCtx) == PLAYER_MASK_CIRCUS_LEADERS_MASK) { this->unk4AC |= 0x40; } else { this->unk4AC &= ~0x40; @@ -1485,7 +1486,7 @@ void EnIn_Update(Actor* thisx, GlobalContext* globalCtx) { } void func_808F6334(EnIn* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; s32 newUnk4C8; newUnk4C8 = func_80152498(&globalCtx->msgCtx); @@ -1493,8 +1494,9 @@ void func_808F6334(EnIn* this, GlobalContext* globalCtx) { this->unk4C4 = CLAMP(this->unk4C4, 0.0f, 80.0f); SysMatrix_InsertTranslation(this->unk4C4, 0.0f, 0.0f, MTXMODE_APPLY); - if (this == (EnIn*)player->unkA88 && !(globalCtx->msgCtx.unk11F04 >= 0xFF && globalCtx->msgCtx.unk11F04 <= 0x200) && - newUnk4C8 == 3 && this->unk4C8 == 3) { + if (this == (EnIn*)player->targetActor && + !(globalCtx->msgCtx.unk11F04 >= 0xFF && globalCtx->msgCtx.unk11F04 <= 0x200) && newUnk4C8 == 3 && + this->unk4C8 == 3) { if (!(globalCtx->state.frames & 1)) { this->unk4C0 = this->unk4C0 != 0.0f ? 0.0f : 1.0f; } diff --git a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c index 36d1456cce..d046fbf477 100644 --- a/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c +++ b/src/overlays/actors/ovl_En_Jc_Mato/z_en_jc_mato.c @@ -60,8 +60,8 @@ s32 EnJcMato_CheckForHit(EnJcMato* this, GlobalContext* globalCtx) { this->collider.dim.worldSphere.center.x = this->pos.x; this->collider.dim.worldSphere.center.y = this->pos.y; this->collider.dim.worldSphere.center.z = this->pos.z; - if ((this->collider.base.acFlags & 2) && !this->hitFlag && (this->actor.colChkInfo.damageEffect == 0xF)) { - this->collider.base.acFlags &= ~2; + if ((this->collider.base.acFlags & AC_HIT) && !this->hitFlag && (this->actor.colChkInfo.damageEffect == 0xF)) { + this->collider.base.acFlags &= ~AC_HIT; Audio_PlayActorSound2(&this->actor, NA_SE_SY_TRE_BOX_APPEAR); globalCtx->interfaceCtx.unk25C = 1; this->hitFlag = 1; diff --git a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c index 6340fd0e93..e2c3eeff6f 100644 --- a/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c +++ b/src/overlays/actors/ovl_En_Ma_Yts/z_en_ma_yts.c @@ -142,11 +142,11 @@ void EnMaYts_ChangeAnim(EnMaYts* this, s32 index) { } void func_80B8D12C(EnMaYts* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; s16 flag = this->unk_32C == 2 ? true : false; if ((this->unk_32C == 0) || (this->actor.parent == NULL)) { - this->unk_1D8.unk_18 = player->base.world.pos; + this->unk_1D8.unk_18 = player->actor.world.pos; this->unk_1D8.unk_18.y -= -10.0f; } else { Math_Vec3f_StepTo(&this->unk_1D8.unk_18, &this->actor.parent->world.pos, 8.0f); @@ -325,13 +325,13 @@ void EnMaYts_StartDialogue(EnMaYts* this, GlobalContext* globalCtx) { func_801518B0(globalCtx, 0x335F, &this->actor); this->textId = 0x335F; } else { - // Saying to non-human Link: "Pretend you did not heard that." + // Saying to non-human Link: "Pretend you did not hear that." EnMaYts_SetFaceExpression(this, 4, 3); func_801518B0(globalCtx, 0x3362, &this->actor); this->textId = 0x3362; func_80151BB4(globalCtx, 5); } - } else if (func_8012403C(globalCtx)) { // Player_IsWearingAMask + } else if (Player_GetMask(globalCtx) != PLAYER_MASK_NONE) { if (!(gSaveContext.weekEventReg[0x41] & 0x40)) { gSaveContext.weekEventReg[0x41] |= 0x40; EnMaYts_SetFaceExpression(this, 0, 0); diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index 84c81008bb..fbfcecbd40 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -338,7 +338,7 @@ void EnMinifrog_Idle(EnMinifrog* this, GlobalContext* globalCtx) { this->flags |= 1; } } else if ((this->actor.xzDistToPlayer < 100.0f) && Actor_IsLinkFacingActor(&this->actor, 0x3000, globalCtx) && - (func_8012403C(globalCtx) == 0xD)) { + (Player_GetMask(globalCtx) == PLAYER_MASK_DON_GEROS_MASK)) { func_800B8614(&this->actor, globalCtx, 110.0f); } } @@ -580,7 +580,7 @@ void EnMinifrog_SetupYellowFrogDialog(EnMinifrog* this, GlobalContext* globalCtx } else if ((this->actor.xzDistToPlayer < 150.0f) && (Actor_IsLinkFacingActor(&this->actor, 0x3000, globalCtx) || ((this->actor.flags & 0x10000) == 0x10000)) && - func_8012403C(globalCtx) == 0xD) { + Player_GetMask(globalCtx) == PLAYER_MASK_DON_GEROS_MASK) { func_800B8614(&this->actor, globalCtx, 160.0f); } } diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index bdd5ba27ba..73fad74952 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -1,11 +1,11 @@ -#include "z_en_niw.h" - /* * File: z_en_niw.c * Overlay: ovl_En_Niw * Description: Cucco (Chicken) (Japanese: Niwatori) */ +#include "z_en_niw.h" + #define FLAGS 0x00800010 void EnNiw_Init(Actor* thisx, GlobalContext* globalCtx); @@ -645,7 +645,7 @@ void EnNiw_SetupRunning(EnNiw* this) { // bad regalloc, center of first if block // actionfunc: running away from link void func_808924B0(EnNiw* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; Vec3f tempVec3f; s16 temp298; f32 dX; @@ -681,8 +681,8 @@ void func_808924B0(EnNiw* this, GlobalContext* globalCtx) { dX = this->actor.world.pos.x - this->unk2BC.x; dZ = this->actor.world.pos.z - this->unk2BC.z; } else { - dX = this->actor.world.pos.x - player->base.world.pos.x; - dZ = this->actor.world.pos.z - player->base.world.pos.z; + dX = this->actor.world.pos.x - player->actor.world.pos.x; + dZ = this->actor.world.pos.z - player->actor.world.pos.z; } this->yawTowardsPlayer = Math_Atan2S(dX, dZ); func_808917F8(this, globalCtx, 0); @@ -756,7 +756,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { EnNiw* this = (EnNiw*)thisx; s8 pad0; s16 i; - ActorPlayer* player = PLAYER; + Player* player = PLAYER; s16 pad1; s16 featherCount; Vec3f pos; diff --git a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c index 1dd66c1c32..1dfb41c2fe 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -82,7 +82,7 @@ void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx) { EnNutsball* this = THIS; GlobalContext* globalCtx2 = globalCtx; - ActorPlayer* player = PLAYER; + Player* player = PLAYER; Vec3f worldPos; Vec3s worldRot; Vec3f spawnBurstPos; @@ -102,10 +102,10 @@ void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1) || (this->actor.bgCheckFlags & 16) || (this->collider.base.atFlags & AT_HIT) || (this->collider.base.acFlags & AC_HIT) || (this->collider.base.ocFlags1 & OC1_HIT)) { - if ((player->unk144 == 1) && (this->collider.base.atFlags & AT_HIT) && + if ((player->currentShield == PLAYER_SHIELD_HEROS_SHIELD) && (this->collider.base.atFlags & AT_HIT) && (this->collider.base.atFlags & AT_TYPE_ENEMY) && (this->collider.base.atFlags & AT_BOUNCED)) { EnNutsball_InitColliderParams(this); - func_8018219C(&player->unkD04, &worldRot, 0); + func_8018219C(&player->shieldMf, &worldRot, 0); this->actor.world.rot.y = worldRot.y + 0x8000; this->timer = 20; } else { diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index dcd2f398d8..0dc99c7608 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -486,7 +486,7 @@ void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx this->actor.shape.rot.y = this->actor.world.rot.y; this->actor.flags |= 1; this->timer = 30; - this->collider.base.ocFlags1 |= 1; + this->collider.base.ocFlags1 |= OC1_ON; yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); eye.x = (Math_SinS(yaw) * 300.0f) + this->actor.focus.pos.x; eye.y = this->actor.focus.pos.y + 100.0f; @@ -540,7 +540,7 @@ void EnPametfrog_JumpToWall(EnPametfrog* this, GlobalContext* globalCtx) { void EnPametfrog_SetupWallCrawl(EnPametfrog* this) { if (this->actionFunc == EnPametfrog_JumpToWall) { SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_06001E14); - this->collider.base.acFlags |= 1; + this->collider.base.acFlags |= AC_ON; this->unk_2D0.x = 0.0f; this->unk_2D0.z = 0.0f; this->actor.gravity = 0.0f; @@ -688,7 +688,7 @@ void EnPametfrog_SetupClimbDownWall(EnPametfrog* this) { this->actor.shape.rot.z = 0; this->actor.colChkInfo.mass = 50; this->actor.speedXZ = 5.0f; - this->collider.base.acFlags &= ~1; + this->collider.base.acFlags &= ~AC_ON; this->actor.velocity.y = 0.0f; this->actor.gravity = -1.0f; yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); @@ -741,8 +741,8 @@ void EnPametfrog_RunToSnapper(EnPametfrog* this, GlobalContext* globalCtx) { void EnPametfrog_SetupJumpOnSnapper(EnPametfrog* this) { SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06004680, 6.0f); this->timer = 6; - this->collider.base.ocFlags1 &= ~1; - this->collider.base.acFlags &= ~1; + this->collider.base.ocFlags1 &= ~OC1_ON; + this->collider.base.acFlags &= ~AC_ON; this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; this->actor.shape.rot.y = Actor_YawBetweenActors(&this->actor, this->actor.child); @@ -796,7 +796,7 @@ void EnPametfrog_SetupFallInAir(EnPametfrog* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; this->actor.velocity.y = 0.0f; - this->collider.base.acFlags &= ~1; + this->collider.base.acFlags &= ~AC_ON; this->timer = 10; if (this->actor.colChkInfo.health == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FROG_DEAD); @@ -941,10 +941,11 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, GlobalContext* globalCtx) { vec1.x = (Math_SinS(yaw) * 20.0f) + this->actor.world.pos.x; vec1.y = this->actor.world.pos.y + 25.0f; vec1.z = (Math_CosS(yaw) * 20.0f) + this->actor.world.pos.z; - this->collider.base.ocFlags1 &= ~1; + this->collider.base.ocFlags1 &= ~OC1_ON; func_800B0DE0(globalCtx, &vec1, &D_801D15B0, &D_801D15B0, &primColor, &envColor, 800, 50); func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EN_NPC_APPEAR); Actor_SetRoomClearedTemp(globalCtx, globalCtx->roomContext.currRoom.num); + for (i = 0; i < 25; i++) { vel.x = randPlusMinusPoint5Scaled(5.0f); vel.y = Rand_ZeroFloat(3.0f) + 4.0f; @@ -1002,7 +1003,7 @@ void EnPametfrog_PlayCutscene(EnPametfrog* this, GlobalContext* globalCtx) { void EnPametfrog_SetupLookAround(EnPametfrog* this) { SkelAnime_ChangeAnimDefaultStop(&this->skelAnime, &D_060066B4); - this->collider.base.atFlags &= ~1; + this->collider.base.atFlags &= ~AT_ON; this->actor.speedXZ = 0.0f; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnPametfrog_LookAround; @@ -1023,7 +1024,7 @@ void EnPametfrog_LookAround(EnPametfrog* this, GlobalContext* globalCtx) { void EnPametfrog_SetupJumpToLink(EnPametfrog* this) { SkelAnime_ChangeAnimDefaultRepeat(&this->skelAnime, &D_060039C4); - this->collider.base.acFlags |= 1; + this->collider.base.acFlags |= AC_ON; this->actor.world.rot.y = this->actor.shape.rot.y; this->actionFunc = EnPametfrog_JumpToLink; } @@ -1040,7 +1041,7 @@ void EnPametfrog_JumpToLink(EnPametfrog* this, GlobalContext* globalCtx) { this->actor.speedXZ = 0.0f; } - if ((this->collider.base.ocFlags1 & 2) && (this->collider.base.ocFlags2 & 1) && + if ((this->collider.base.ocFlags1 & OC1_HIT) && (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) && Actor_IsActorFacingLink(&this->actor, 0x3000) && (this->skelAnime.animCurrentFrame <= 2.0f || this->skelAnime.animCurrentFrame >= 11.0f)) { EnPametfrog_SetupMeleeAttack(this); @@ -1078,22 +1079,22 @@ void EnPametfrog_MeleeAttack(EnPametfrog* this, GlobalContext* globalCtx) { (this->skelAnime.animCurrentSeg == &D_060070C4 && func_801378B8(&this->skelAnime, 9.0f)) || (this->skelAnime.animCurrentSeg == &D_06003F28 && func_801378B8(&this->skelAnime, 2.0f)) || ((this->skelAnime.animCurrentSeg == &D_0600F048) && func_801378B8(&this->skelAnime, 27.0f))) { - this->collider.base.atFlags |= 1; + this->collider.base.atFlags |= AT_ON; if (this->skelAnime.animCurrentSeg == &D_06003F28) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FROG_KICK); } else { Audio_PlayActorSound2(&this->actor, NA_SE_EN_FROG_PUNCH1); } } else { - this->collider.base.atFlags &= ~1; + this->collider.base.atFlags &= ~AT_ON; } } void func_8086CB4C(EnPametfrog* this) { SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_06005D54, -3.0f); this->timer = 20; - this->collider.base.atFlags &= ~1; - this->collider.base.acFlags &= ~1; + this->collider.base.atFlags &= ~AT_ON; + this->collider.base.acFlags &= ~AC_ON; this->actor.speedXZ = 10.0f; Audio_PlayActorSound2(&this->actor, NA_SE_EN_FROG_DAMAGE); func_800BCB70(&this->actor, 0x4000, 0xFF, 0, 20); @@ -1121,10 +1122,11 @@ void func_8086CC84(EnPametfrog* this) { SkelAnime_FrameUpdateMatrix(&this->skelAnime); } - this->collider.base.atFlags &= ~1; + this->collider.base.atFlags &= ~AT_ON; this->actor.speedXZ = 0.0f; + if (this->actor.colChkInfo.health == 0) { - this->collider.base.acFlags &= ~1; + this->collider.base.acFlags &= ~AC_ON; } this->actionFunc = func_8086CD04; @@ -1240,8 +1242,8 @@ void EnPametfrog_TransitionGekkoSnapper(EnPametfrog* this, GlobalContext* global } void EnPametfrog_ApplyDamage(EnPametfrog* this, GlobalContext* globalCtx) { - if (this->collider.base.acFlags & 2) { - this->collider.base.acFlags &= ~2; + if (this->collider.base.acFlags & AC_HIT) { + this->collider.base.acFlags &= ~AC_HIT; if ((this->mode != 10) || !(this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0xDB0B3)) { if (this->actor.params == ENPAMETFROG_PRE_SNAPPER) { if (func_800BE22C(&this->actor) == 0) { @@ -1278,7 +1280,7 @@ void EnPametfrog_ApplyDamage(EnPametfrog* this, GlobalContext* globalCtx) { func_8086CB4C(this); } } else if (func_800BE22C(&this->actor) == 0) { - this->collider.base.acFlags &= ~1; + this->collider.base.acFlags &= ~AC_ON; func_8086A724(this, globalCtx); func_800BBA88(globalCtx, &this->actor); this->actor.flags &= ~1; @@ -1306,7 +1308,7 @@ void EnPametfrog_Update(Actor* thisx, GlobalContext* globalCtx) { } else if (this->actionFunc != EnPametfrog_PlayCutscene) { EnPametfrog_ApplyDamage(this, globalCtx); } else { - this->collider.base.acFlags &= ~2; + this->collider.base.acFlags &= ~AC_HIT; } this->actionFunc(this, globalCtx); @@ -1321,15 +1323,15 @@ void EnPametfrog_Update(Actor* thisx, GlobalContext* globalCtx) { } } - if (this->collider.base.atFlags & 1) { + if (this->collider.base.atFlags & AT_ON) { CollisionCheck_SetAT(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); } - if (this->collider.base.acFlags & 1) { + if (this->collider.base.acFlags & AC_ON) { CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); } - if (this->collider.base.ocFlags1 & 1) { + if (this->collider.base.ocFlags1 & OC1_ON) { CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c index dbcdd696f3..c1e2931926 100644 --- a/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c +++ b/src/overlays/actors/ovl_En_Po_Fusen/z_en_po_fusen.c @@ -141,8 +141,8 @@ u16 EnPoFusen_CheckCollision(EnPoFusen* this, GlobalContext* globalCtx) { this->collider.dim.worldSphere.center.y = (this->actor.world.pos.y + 20.0f); this->collider.dim.worldSphere.center.z = this->actor.world.pos.z; - if (((this->collider.base.acFlags & 2) != 0) && (this->actor.colChkInfo.damageEffect == 0xF)) { - this->collider.base.acFlags &= ~0x2; + if ((this->collider.base.acFlags & AC_HIT) && (this->actor.colChkInfo.damageEffect == 0xF)) { + this->collider.base.acFlags &= ~AC_HIT; return 1; } diff --git a/src/overlays/actors/ovl_En_Sb/z_en_sb.c b/src/overlays/actors/ovl_En_Sb/z_en_sb.c index 854f272319..1da26bfb86 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -331,7 +331,7 @@ void EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnSb* this = THIS; - ActorPlayer* player = PLAYER; + Player* player = PLAYER; if (this->isDead) { if (this->actor.yDistToWater > 0.0f) { @@ -394,4 +394,4 @@ void EnSb_Draw(Actor* thisx, GlobalContext* globalCtx) { EffectSsEnFire_SpawnVec3f(globalCtx, &this->actor, &flamePos, 100, 0, 0, -1); } } -} \ No newline at end of file +} diff --git a/src/overlays/actors/ovl_En_Toto/z_en_toto.c b/src/overlays/actors/ovl_En_Toto/z_en_toto.c index cad6f9968f..6a63f2357c 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -265,19 +265,20 @@ s32 func_80BA397C(EnToto* this, s16 arg1) { } void func_80BA39C8(EnToto* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; func_80BA383C(this, globalCtx); if (func_800B84D0(&this->actor, globalCtx) != 0) { func_80BA36C0(this, globalCtx, 1); if (globalCtx->sceneNum != 0x12) { Actor_SetSwitchFlag(globalCtx, this->actor.params & 0x7F); - } else if (player->unk14B == 3) { + } else if (player->transformation == PLAYER_FORM_DEKU) { Actor_SetSwitchFlag(globalCtx, this->actor.home.rot.x); } this->unk2B6 = 0; return; } + if ((globalCtx->sceneNum == 0x15 && !(gSaveContext.time >= 0x4000 && gSaveContext.time < 0xED02)) || (globalCtx->sceneNum != 0x15 && func_80BA397C(this, 0x2000))) { if (this->unk2B6 != 0) { @@ -288,7 +289,7 @@ void func_80BA39C8(EnToto* this, GlobalContext* globalCtx) { this->actor.flags &= ~0x10000; func_800B8614(&this->actor, globalCtx, 50.0f); if (globalCtx->sceneNum == 0x12) { - if (player->unk14B == 3) { + if (player->transformation == PLAYER_FORM_DEKU) { if (!Flags_GetSwitch(globalCtx, this->actor.home.rot.x)) { this->text = D_80BA5068; } else { @@ -305,6 +306,7 @@ void func_80BA39C8(EnToto* this, GlobalContext* globalCtx) { this->text = D_80BA5038; } } + this->actor.textId = this->text->textId; } } @@ -344,7 +346,7 @@ void func_80BA3D38(EnToto* this, GlobalContext* globalCtx) { } void func_80BA3DBC(EnToto* this, GlobalContext* globalCtx) { - ActorPlayer* player; + Player* player; func_80BA383C(this, globalCtx); if (this->unk2B7 == 0) { @@ -357,7 +359,7 @@ void func_80BA3DBC(EnToto* this, GlobalContext* globalCtx) { } } else { player = PLAYER; - if (player->stateFlags1 & 0x400 && player->unkAE7 != 0) { + if (player->stateFlags1 & 0x400 && player->unk_AE7 != 0) { func_80151BB4(globalCtx, 48); func_80151BB4(globalCtx, 9); func_80151BB4(globalCtx, 10); @@ -365,6 +367,7 @@ void func_80BA3DBC(EnToto* this, GlobalContext* globalCtx) { return; } } + func_80BA36C0(this, globalCtx, 0); ActorCutscene_Stop(this->cutscene); globalCtx->actorCtx.unk5 &= ~0x20; @@ -422,9 +425,10 @@ s32 func_80BA402C(EnToto* this, GlobalContext* globalCtx) { s32 func_80BA407C(EnToto* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &PLAYER->base); + ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &PLAYER->actor); return 1; } + ActorCutscene_SetIntentToPlay(this->cutscene); return 0; } @@ -469,17 +473,17 @@ s32 func_80BA4204(EnToto* this, GlobalContext* globalCtx) { } s32 func_80BA42BC(EnToto* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; u32 phi_s0 = 0; Vec3s* end = &D_80BA510C[3]; func_80BA3FB0(this, globalCtx); func_800B7298(globalCtx, 0, 6); - if (player->base.world.pos.z > -310.0f) { - if ((player->base.world.pos.x > -150.0f) || (player->base.world.pos.z > -172.0f)) { + if (player->actor.world.pos.z > -310.0f) { + if ((player->actor.world.pos.x > -150.0f) || (player->actor.world.pos.z > -172.0f)) { phi_s0 = 3; } else { - if (player->base.world.pos.z > -232.0f) { + if (player->actor.world.pos.z > -232.0f) { phi_s0 = 2; } else { phi_s0 = 1; @@ -514,36 +518,36 @@ s32 func_80BA44A0(EnToto* this, GlobalContext* globalCtx) { return 0; } -s32 func_80BA44D4(EnTotoUnkStruct2* arg0, ActorPlayer* player) { +s32 func_80BA44D4(EnTotoUnkStruct2* arg0, Player* player) { Vec3f unk6; Math_Vec3s_ToVec3f(&unk6, &arg0->unk6); - if (Math_Vec3f_DistXZ(&player->base.world.pos, &unk6) < 10.0f) { + if (Math_Vec3f_DistXZ(&player->actor.world.pos, &unk6) < 10.0f) { return 1; } return 0; } s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; EnTotoUnkStruct2* temp_s0; s32 i; u16 tmp; func_80BA3C88(this); - if (player->base.world.pos.z > -270.0f) { + if (player->actor.world.pos.z > -270.0f) { if (this->spotlights != NULL) { Actor_MarkForDeath(this->spotlights); } this->unk2B6 = 1; return this->text->unk1; } - if (player->base.bgCheckFlags & 1) { + if (player->actor.bgCheckFlags & 1) { temp_s0 = &D_80BA50DC[gSaveContext.playerForm - 1]; if (func_80BA44D4(temp_s0, player)) { - Math_Vec3s_ToVec3f(&player->base.world.pos, &temp_s0->unk6); - player->base.shape.rot.y = 0; - player->unkAD4 = 0; + Math_Vec3s_ToVec3f(&player->actor.world.pos, &temp_s0->unk6); + player->actor.shape.rot.y = 0; + player->currentYaw = 0; return func_80BA407C(this, globalCtx); } if (!ENTOTO_WEEK_EVENT_FLAGS) { @@ -659,12 +663,12 @@ s32 func_80BA4A00(EnToto* this, GlobalContext* globalCtx) { } s32 func_80BA4B24(EnToto* this, GlobalContext* globalCtx) { - ActorPlayer* player; + Player* player; if (func_80BA40D4(this, globalCtx)) { player = PLAYER; SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_060028B8, -4.0f); - if (player->unk14B == 2) { + if (player->transformation == PLAYER_FORM_ZORA) { if (!Flags_GetSwitch(globalCtx, this->actor.params & 0x7F)) { Actor_SetSwitchFlag(globalCtx, this->actor.params & 0x7F); return 1; diff --git a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c index 7b1ee4a783..20a57c7b3c 100644 --- a/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c +++ b/src/overlays/actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c @@ -178,19 +178,20 @@ void func_80930B60(EnTuboTrap* this, GlobalContext* globalCtx) { // EnTuboTrap_HandleImpact void func_80930DDC(EnTuboTrap* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; - ActorPlayer* player2 = PLAYER; + Player* player = PLAYER; + Player* player2 = PLAYER; // in oot func_800F0568 is Audio_PlaySoundAtPosition - if (((this->actor.bgCheckFlags & 0x20) != 0) && (this->actor.yDistToWater > 15.0f)) { + if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) { func_80930B60(this, globalCtx); func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_BOMB_DROP_WATER); func_8093089C(this, globalCtx); Actor_MarkForDeath(&this->actor); return; } - if ((this->collider.base.atFlags & AT_BOUNCED) != 0) { + + if (this->collider.base.atFlags & AT_BOUNCED) { this->collider.base.atFlags &= ~AT_BOUNCED; func_809308F4(this, globalCtx); func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_IT_SHIELD_REFLECT_SW); @@ -199,7 +200,8 @@ void func_80930DDC(EnTuboTrap* this, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); return; } - if ((this->collider.base.acFlags & AC_HIT) != 0) { + + if (this->collider.base.acFlags & AC_HIT) { this->collider.base.acFlags &= ~AC_HIT; func_809308F4(this, globalCtx); func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_EXPLOSION); @@ -208,17 +210,20 @@ void func_80930DDC(EnTuboTrap* this, GlobalContext* globalCtx) { Actor_MarkForDeath(&this->actor); return; } - if ((this->collider.base.atFlags & AT_HIT) != 0) { + + if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; - if (&player->base == this->collider.base.at) { + + if (&player->actor == this->collider.base.at) { func_809308F4(this, globalCtx); func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); - func_800F0568(globalCtx, &player2->base.world.pos, 40, NA_SE_PL_BODY_HIT); + func_800F0568(globalCtx, &player2->actor.world.pos, 40, NA_SE_PL_BODY_HIT); func_8093089C(this, globalCtx); Actor_MarkForDeath(&this->actor); return; } } + if ((this->actor.bgCheckFlags & 8) || (this->actor.bgCheckFlags & 1)) { func_809308F4(this, globalCtx); func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_POT_BROKEN); @@ -227,11 +232,11 @@ void func_80930DDC(EnTuboTrap* this, GlobalContext* globalCtx) { } } -#if NON - MATCHING +#ifdef NON_MATCHING // Wait For Proximity (idle) // NON-MATCHING: wrong register used, v instead of t for the weirdValues[] pointer void func_80931004(EnTuboTrap* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; f32 currentHeight; s8 weirdvalue; s16 startingRotation; @@ -240,18 +245,16 @@ void func_80931004(EnTuboTrap* this, GlobalContext* globalCtx) { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; - if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.world.pos.y <= player->base.world.pos.y)) { + if ((this->actor.xzDistToPlayer < 200.0f) && (this->actor.world.pos.y <= player->actor.world.pos.y)) { startingRotation = this->actor.home.rot.z; if ((startingRotation == 0) || (this->actor.yDistToPlayer <= ((f32)startingRotation * 10.0f))) { func_800BC154(globalCtx, &globalCtx->actorCtx, this, ACTORCAT_ENEMY); currentHeight = this->actor.world.pos.y; this->actor.flags |= 0x11; // always update and can target - // hard to know what this value is even used for without knowing what ActorPlayer::unk14B is - // wild guess: this is player animation state, height is modified to always point at center of link model - weirdvalue = D_8093146C[player->unk14B & 0xFF]; + weirdvalue = D_8093146C[player->transformation & 0xFF]; - this->targetHeight = player->base.world.pos.y + (f32)weirdvalue; + this->targetHeight = player->actor.world.pos.y + (f32)weirdvalue; if (this->targetHeight < currentHeight) { this->targetHeight = currentHeight; this->targetHeight += weirdvalue; diff --git a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c index 1fb6c4b778..35988e8637 100644 --- a/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c +++ b/src/overlays/actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c @@ -89,7 +89,7 @@ void func_80A66208(EnWarpUzu* this, GlobalContext* globalCtx) { } void func_80A66278(EnWarpUzu* this, GlobalContext* globalCtx) { - ActorPlayer* player; + Player* player; s16 temp_v0; s16 phi_a0; s16 phi_v1; @@ -99,8 +99,8 @@ void func_80A66278(EnWarpUzu* this, GlobalContext* globalCtx) { if (func_800B84D0(&this->actor, globalCtx)) { func_80A66384(this, globalCtx); } else { - phi_a0 = ABS((s16)(Actor_YawBetweenActors(&this->actor, &player->base) - this->actor.shape.rot.y)); - temp_v0 = player->base.shape.rot.y - this->actor.shape.rot.y; + phi_a0 = ABS((s16)(Actor_YawBetweenActors(&this->actor, &player->actor) - this->actor.shape.rot.y)); + temp_v0 = player->actor.shape.rot.y - this->actor.shape.rot.y; phi_v1 = ABS(temp_v0); if (phi_a0 >= 0x2AAB) { if (phi_v1 < 0x238E) { diff --git a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c index 8b426611ca..d695677588 100644 --- a/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c +++ b/src/overlays/actors/ovl_En_Weather_Tag/z_en_weather_tag.c @@ -111,10 +111,10 @@ void EnWeatherTag_Init(Actor* thisx, GlobalContext* globalCtx) { // called WeatherTag_CheckEnableWeatherEffect in OOT, that's where "weatherMode" came from u8 func_80966608(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_TYPE a4, u8 new1F, u8 new20, u16 new24, u8 weatherMode) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; u8 returnVal = 0; - if (WEATHER_TAG_RANGE100(this) > Actor_XZDistanceBetweenActors(&player->base, &this->actor)) { + if (WEATHER_TAG_RANGE100(this) > Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { if (globalCtx->kankyoContext.unk1F == globalCtx->kankyoContext.unk20) { D_801BDBB8 = 1; if (!(globalCtx->kankyoContext.unk1E == 0) || @@ -141,10 +141,10 @@ u8 func_80966608(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_ // called WeatherTag_CheckRestoreWeather in OOT u8 func_80966758(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_TYPE a4, u8 new1F, u8 new20, u16 new24) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; u8 returnVal = 0; - if (WEATHER_TAG_RANGE100(this) < Actor_XZDistanceBetweenActors(&player->base, &this->actor)) { + if (WEATHER_TAG_RANGE100(this) < Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { if (globalCtx->kankyoContext.unk1F == globalCtx->kankyoContext.unk20) { D_801BDBB8 = 1; if (!(globalCtx->kankyoContext.unk1E == 0) || @@ -167,11 +167,11 @@ u8 func_80966758(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_ // modify wind? void func_8096689C(EnWeatherTag* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; f32 distance; f32 partialResult; - distance = Actor_XZDistanceBetweenActors(&player->base, &this->actor); + distance = Actor_XZDistanceBetweenActors(&player->actor, &this->actor); if (this->fadeDistance < distance) { distance = this->fadeDistance; } @@ -260,7 +260,9 @@ void func_80966BF4(EnWeatherTag* this, GlobalContext* globalCtx) { newUnk20 = 4; break; } + Math_SmoothStepToF(&D_801F4E74, 0.0f, 0.2f, 0.02f, 0.001f); + if (globalCtx->kankyoContext.unk20 != newUnk20) { globalCtx->kankyoContext.unk21 = 1; globalCtx->kankyoContext.unk20 = newUnk20; @@ -353,7 +355,7 @@ void func_80966FEC(EnWeatherTag* this, GlobalContext* globalCtx) { } } -#if NON_MATCHING +#ifdef NON_MATCHING // non-matching: two instructions are swapped // type 4_2 pirates fortres only? void func_80967060(EnWeatherTag* this, GlobalContext* globalCtx) { @@ -413,11 +415,11 @@ void EnWeatherTag_Unused_80967250(EnWeatherTag* this, GlobalContext* globalCtx) } } -#if NON_MATCHING +#ifdef NON_MATCHING // non_matching: the parameters for func_800BCCDC are correct, but out of order // WEATHERTAG_TYPE_WATERMURK: (pinnacle rock, zora cape, zora coast) void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; s32 pad; f32 distance; f32 range; @@ -429,9 +431,9 @@ void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx) { // ef4: lbu a1,0x14c(s0) | ef4: sw zero,0x10(sp) 5 // ef8: lw a0,0x150(s0) | ef8: addiu a3,s0,0x24 1 // efc: sw zero,0x10(sp) | efc: sw v0,0x3c(sp) 2 - func_800BCCDC(this->pathPoints, this->pathCount, &player->base.world.pos, &this->actor.world.pos, 0); + func_800BCCDC(this->pathPoints, this->pathCount, &player->actor.world.pos, &this->actor.world.pos, 0); - distance = Actor_XZDistanceBetweenActors(&player->base, &this->actor); + distance = Actor_XZDistanceBetweenActors(&player->actor, &this->actor); range = WEATHER_TAG_RANGE100(this); if (distance < range) { @@ -457,9 +459,9 @@ void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx) { // WEATHERTAG_TYPE_LOCALDAY2RAIN: rain proximity as approaching rainy scene // (milk road day 2 approaching ranch it rains, walking away towards termfield no rain) void func_809674C8(EnWeatherTag* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; - if (Actor_XZDistanceBetweenActors(&player->base, &this->actor) < WEATHER_TAG_RANGE100(this)) { + if (Actor_XZDistanceBetweenActors(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this)) { if (CURRENT_DAY == 2) { if ((gSaveContext.time >= 0x4AAA) && (gSaveContext.time < 0xBAAA) && (globalCtx->kankyoContext.unkF2[2] == 0)) { @@ -482,7 +484,7 @@ void func_809674C8(EnWeatherTag* this, GlobalContext* globalCtx) { // WEATHERTAG_TYPE_LOCALDAY2RAIN 2 void func_80967608(EnWeatherTag* this, GlobalContext* globalCtx) { - if ((WEATHER_TAG_RANGE100(this) + 10.0f) < Actor_XZDistanceBetweenActors(&PLAYER->base, &this->actor)) { + if ((WEATHER_TAG_RANGE100(this) + 10.0f) < Actor_XZDistanceBetweenActors(&PLAYER->actor, &this->actor)) { D_801BDBB0 = 0; EnWeatherTag_SetupAction(this, func_809674C8); } diff --git a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c index 074957bac0..95f3dbaebd 100644 --- a/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c +++ b/src/overlays/actors/ovl_Obj_Bell/z_obj_bell.c @@ -149,8 +149,8 @@ s32 func_80A357A8(ObjBell* this, GlobalContext* globalCtx) { f32 temp_f0; s16 temp_v1; - if (this->collider1.base.ocFlags1 & 2) { - this->collider1.base.ocFlags1 &= ~2; + if (this->collider1.base.ocFlags1 & OC1_HIT) { + this->collider1.base.ocFlags1 &= ~OC1_HIT; temp_v1 = this->dyna.actor.yawTowardsPlayer - this->unk_212; temp_f0 = this->unk_21C / 18000.0f; if (ABS_ALT(temp_v1) < 0x3FFC) { @@ -163,8 +163,8 @@ s32 func_80A357A8(ObjBell* this, GlobalContext* globalCtx) { } } } - if (this->collider2.base.acFlags & 2) { - this->collider2.base.acFlags &= ~2; + if (this->collider2.base.acFlags & AC_HIT) { + this->collider2.base.acFlags &= ~AC_HIT; this->unk_20E = 10; switch (this->dyna.actor.colChkInfo.damageEffect) { case 15: diff --git a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c index a774d678da..ec1d5e0c3e 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c @@ -77,7 +77,7 @@ void ObjBoyo_Destroy(Actor* thisx, GlobalContext* globalCtx2) { Collider_DestroyCylinder(globalCtx, &this->collider); } -void ObjBoyo_UpdatePlayerBumpValues(ObjBoyo* this, ActorPlayer* target) { +void ObjBoyo_UpdatePlayerBumpValues(ObjBoyo* this, Player* target) { target->unk_B80 = 30.0f; target->unk_B84 = this->actor.yawTowardsPlayer; } @@ -102,12 +102,12 @@ Actor* ObjBoyo_GetCollidedActor(ObjBoyo* this, GlobalContext* globalCtx, s32* nu BumperCollideInfo* collideInfo; s32 i; - if (this->collider.base.ocFlags2 & 1) { + if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { *num = 0; - return &PLAYER->base; + return &PLAYER->actor; } - if (this->collider.base.ocFlags1 & 2) { + if (this->collider.base.ocFlags1 & OC2_UNK1) { for (collideActor = this->collider.base.oc, collideInfo = &sBumperCollideInfo[1], i = 1; i < 3; collideInfo++, i++) { if (collideInfo->id == collideActor->id) { @@ -153,7 +153,7 @@ void ObjBoyo_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { Actor_SetScale(&this->actor, 0.1f); - if (this->collider.base.acFlags & 2) { + if (this->collider.base.acFlags & AC_HIT) { this->unk_194 = 30; this->unk_196 = 2; this->unk_198 = 0.033333335f; @@ -167,9 +167,9 @@ void ObjBoyo_Update(Actor* thisx, GlobalContext* globalCtx2) { } } - this->collider.base.acFlags &= ~2; - this->collider.base.ocFlags1 &= ~2; - this->collider.base.ocFlags2 &= ~1; + this->collider.base.acFlags &= ~AC_HIT; + this->collider.base.ocFlags1 &= ~OC1_HIT; + this->collider.base.ocFlags2 &= ~OC2_HIT_PLAYER; CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c index 796c94e8ea..96a172e5aa 100644 --- a/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c +++ b/src/overlays/actors/ovl_Obj_Ghaka/z_obj_ghaka.c @@ -72,7 +72,7 @@ void func_80B3C2C4(ObjGhaka* this, GlobalContext* globalCtx) { } void func_80B3C39C(ObjGhaka* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; s16 distDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y; if (func_800B84D0(&this->dyna.actor, globalCtx)) { @@ -80,17 +80,18 @@ void func_80B3C39C(ObjGhaka* this, GlobalContext* globalCtx) { } else if (this->dyna.actor.xzDistToPlayer < 100.0f || this->dyna.actor.isTargeted) { if (distDiff <= -0x5556 || distDiff >= 0x5556) { func_800B863C(&this->dyna.actor, globalCtx); - if (player->unk14B == 1) { + if (player->transformation == PLAYER_FORM_GORON) { this->dyna.actor.textId = 0xCF3; } else { this->dyna.actor.textId = 0xCF2; } } } - if (this->dyna.unk148 < 0.0f && !(gSaveContext.weekEventReg[20] & 0x20) && player->unk14B == 1) { + if (this->dyna.unk148 < 0.0f && !(gSaveContext.weekEventReg[20] & 0x20) && + player->transformation == PLAYER_FORM_GORON) { func_80B3C2B0(this); } else { - player->unkA70 &= ~0x10; + player->stateFlags2 &= ~0x10; this->dyna.unk148 = 0.0f; } } @@ -129,12 +130,13 @@ void func_80B3C4E0(ObjGhaka* this, GlobalContext* globalCtx) { } void func_80B3C624(ObjGhaka* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; u8 stepTemp = Math_StepToS(&this->unk_168, 0x64, 1); this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + this->unk_168; + if (stepTemp) { - player->unkA70 &= ~0x10; + player->stateFlags2 &= ~0x10; this->dyna.unk148 = 0.0f; func_80B3C2C4(this, globalCtx); gSaveContext.weekEventReg[20] |= 0x20; diff --git a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c index 3aae774be0..be5427cb82 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -110,7 +110,7 @@ void func_80926318(ObjKibako* this, GlobalContext* globalCtx) { s32 pad; if (this->actor.xzDistToPlayer < 100.0f) { - angle = this->actor.yawTowardsPlayer - PLAYER->base.world.rot.y; + angle = this->actor.yawTowardsPlayer - PLAYER->actor.world.rot.y; if (ABS_ALT(angle) >= 0x5556) { func_800B8A1C(&this->actor, globalCtx, 0, 36.0f, 30.0f); } @@ -273,7 +273,7 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { func_800F0568(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); func_800F0568(globalCtx, &this->actor.world.pos, 40, NA_SE_EV_DIVE_INTO_WATER_L); Actor_MarkForDeath(&this->actor); - } else if (this->collider.base.acFlags & 2) { + } else if (this->collider.base.acFlags & AC_HIT) { ObjKibako_AirBreak(this, globalCtx); ObjKibako_SpawnCollectible(this, globalCtx); func_800F0568(globalCtx, &this->actor.world.pos, 20, NA_SE_EV_WOODBOX_BREAK); @@ -282,17 +282,22 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); func_809262BC(this); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 18.0f, 15.0f, 0.0f, 0x45); - if (!(this->collider.base.ocFlags1 & 8) && (this->actor.xzDistToPlayer > 28.0f)) { - this->collider.base.ocFlags1 |= 8; + + if (!(this->collider.base.ocFlags1 & OC1_TYPE_PLAYER) && (this->actor.xzDistToPlayer > 28.0f)) { + this->collider.base.ocFlags1 |= OC1_TYPE_PLAYER; } + if ((this->actor.colChkInfo.mass != MASS_IMMOVABLE) && (Math3D_DistanceSquared(&this->actor.world.pos, &this->actor.prevPos) < 0.01f)) { this->actor.colChkInfo.mass = MASS_IMMOVABLE; } - this->collider.base.acFlags &= ~2; + + this->collider.base.acFlags &= ~AC_HIT; + if ((this->actor.params >> 7) & 1) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + if (this->actor.xzDistToPlayer < 800.0f) { CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); func_80926318(this, globalCtx); @@ -301,6 +306,7 @@ void ObjKibako_Idle(ObjKibako* this, GlobalContext* globalCtx) { if (this->actor.xzDistToPlayer < 800.0f) { Collider_UpdateCylinder(&this->actor, &this->collider); CollisionCheck_SetAC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); + if (this->actor.xzDistToPlayer < 180.0f) { CollisionCheck_SetOC(globalCtx, &globalCtx->colCheckCtx, &this->collider.base); func_80926318(this, globalCtx); @@ -324,7 +330,7 @@ void ObjKibako_Held(ObjKibako* this, GlobalContext* globalCtx) { this->actor.room = globalCtx->roomContext.currRoom.num; if (fabsf(this->actor.speedXZ) < 0.1f) { ObjKibako_SetupIdle(this); - this->collider.base.ocFlags1 &= ~8; + this->collider.base.ocFlags1 &= ~OC1_TYPE_PLAYER; Audio_PlayActorSound2(&this->actor, NA_SE_EV_PUT_DOWN_WOODBOX); } else { Actor_SetVelocityAndMoveYRotationAndGravity(&this->actor); @@ -357,9 +363,9 @@ void ObjKibako_Thrown(ObjKibako* this, GlobalContext* globalCtx) { void* pad2; s32 atHit; - atHit = (this->collider.base.atFlags & 2) != 0; + atHit = (this->collider.base.atFlags & AT_HIT) != 0; if (atHit) { - this->collider.base.atFlags &= ~2; + this->collider.base.atFlags &= ~AT_HIT; } func_80926394(this, globalCtx); if (this->timer > 0) { diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index 40fdbaac48..ea9db39244 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -359,7 +359,7 @@ void ObjLightswitch_Update(Actor* thisx, GlobalContext* globalCtx) { ObjLightswitch* this = THIS; s32 pad; - if ((this->collider.base.acFlags & AC_HIT) != 0) { + if (this->collider.base.acFlags & AC_HIT) { // dmgFlags enum doesn't exist yet, 0x2000 is light arrows if ((this->collider.elements->info.acHitInfo->toucher.dmgFlags & 0x2000) != 0) { this->hitState = 10; diff --git a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c index 0948d96b04..8c7e54116d 100644 --- a/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c +++ b/src/overlays/actors/ovl_Obj_Moon_Stone/z_obj_moon_stone.c @@ -74,10 +74,10 @@ void func_80C0662C(ObjMoonStone* this) { } void func_80C06640(ObjMoonStone* this, GlobalContext* globalCtx) { - ActorPlayer* player = PLAYER; + Player* player = PLAYER; s16 sp1A = this->actor.yawTowardsPlayer - 0x8000; - sp1A -= player->base.shape.rot.y; + sp1A -= player->actor.shape.rot.y; if (func_800B84D0(&this->actor, globalCtx)) { this->actor.colChkInfo.health = 1; func_801518B0(globalCtx, 0x5E3U, &this->actor); @@ -140,7 +140,7 @@ void func_80C06870(ObjMoonStone* this, GlobalContext* globalCtx) { void ObjMoonStone_Update(Actor* thisx, GlobalContext* globalCtx) { ObjMoonStone* this = THIS; - ActorPlayer* player = PLAYER; + Player* player = PLAYER; if ((player->stateFlags1 & 0x10000282) == 0) { this->actionFunc(this, globalCtx); diff --git a/tables/functions.txt b/tables/functions.txt index 979f7efb8a..ab8e964078 100644 --- a/tables/functions.txt +++ b/tables/functions.txt @@ -2224,8 +2224,8 @@ 0x80123F2C:("func_80123F2C",), 0x80123F48:("func_80123F48",), 0x80124020:("func_80124020",), - 0x8012403C:("func_8012403C",), - 0x8012404C:("func_8012404C",), + 0x8012403C:("Player_GetMask",), + 0x8012404C:("Player_RemoveMask",), 0x8012405C:("func_8012405C",), 0x80124088:("func_80124088",), 0x801240C8:("func_801240C8",),