From 3aeadb42b8a195b3d2f67ce71fcd184ddf26d856 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Wed, 13 Oct 2021 03:27:29 +1100 Subject: [PATCH] Macros: `PLAYER` -> `GET_PLAYER(globalCtx)` and `ACTIVE_CAM` -> `GET_ACTIVE_CAM(globalCtx)` (#283) * PLAYER -> GET_PLAYER(globalCtx), ACTIVE_CAM -> GET_ACTIVE_CAM(globalCtx) * formatter * PR Suggestions * `FIRST_ENEMY` -> `GET_FIRST_ENEMY(globalCtx)` * Fix merge conflicts --- include/macros.h | 7 ++-- src/code/code_800E8EA0.c | 4 +-- src/code/z_collision_check.c | 4 +-- src/code/z_effect_soft_sprite_old_init.c | 2 +- src/code/z_en_item00.c | 4 +-- src/code/z_quake.c | 6 ++-- src/code/z_room.c | 2 +- src/code/z_snap.c | 4 +-- .../actors/ovl_Arms_Hook/z_arms_hook.c | 6 ++-- .../ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c | 6 ++-- .../ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c | 10 +++--- .../ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c | 2 +- .../ovl_Bg_Iknin_Susceil/z_bg_iknin_susceil.c | 8 ++--- .../actors/ovl_Bg_Tobira01/z_bg_tobira01.c | 2 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 6 ++-- .../actors/ovl_Door_Spiral/z_door_spiral.c | 10 +++--- src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c | 6 ++-- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 24 ++++++------- .../actors/ovl_En_Bji_01/z_en_bji_01.c | 2 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 2 +- src/overlays/actors/ovl_En_Dai/z_en_dai.c | 4 +-- .../actors/ovl_En_Dekunuts/z_en_dekunuts.c | 2 +- src/overlays/actors/ovl_En_Dg/z_en_dg.c | 24 ++++++------- .../actors/ovl_En_Dinofos/z_en_dinofos.c | 8 ++--- src/overlays/actors/ovl_En_Dnp/z_en_dnp.c | 4 +-- src/overlays/actors/ovl_En_Dnq/z_en_dnq.c | 6 ++-- src/overlays/actors/ovl_En_Dns/z_en_dns.c | 10 +++--- .../actors/ovl_En_Dodongo/z_en_dodongo.c | 8 ++--- .../actors/ovl_En_Firefly/z_en_firefly.c | 6 ++-- src/overlays/actors/ovl_En_Fsn/z_en_fsn.c | 10 +++--- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 22 ++++++------ .../actors/ovl_En_Guruguru/z_en_guruguru.c | 8 ++--- src/overlays/actors/ovl_En_Hg/z_en_hg.c | 6 ++-- src/overlays/actors/ovl_En_Holl/z_en_holl.c | 6 ++-- src/overlays/actors/ovl_En_In/z_en_in.c | 8 ++--- .../actors/ovl_En_Invadepoh/z_en_invadepoh.c | 20 +++++------ src/overlays/actors/ovl_En_Kgy/z_en_kgy.c | 16 ++++----- src/overlays/actors/ovl_En_Ma4/z_en_ma4.c | 18 +++++----- .../actors/ovl_En_Ma_Yto/z_en_ma_yto.c | 2 +- .../actors/ovl_En_Ma_Yts/z_en_ma_yts.c | 2 +- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 2 +- .../actors/ovl_En_Minislime/z_en_minislime.c | 4 +-- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 4 +-- .../actors/ovl_En_Nutsball/z_en_nutsball.c | 2 +- src/overlays/actors/ovl_En_Ossan/z_en_ossan.c | 22 ++++++------ src/overlays/actors/ovl_En_Owl/z_en_owl.c | 6 ++-- .../actors/ovl_En_Pamera/z_en_pamera.c | 2 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 6 ++-- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 10 +++--- .../actors/ovl_En_Railgibud/z_en_railgibud.c | 18 +++++----- src/overlays/actors/ovl_En_Rd/z_en_rd.c | 16 ++++----- src/overlays/actors/ovl_En_Sb/z_en_sb.c | 2 +- .../actors/ovl_En_Sellnuts/z_en_sellnuts.c | 14 ++++---- src/overlays/actors/ovl_En_Skb/z_en_skb.c | 2 +- src/overlays/actors/ovl_En_Sob1/z_en_sob1.c | 18 +++++----- .../actors/ovl_En_Suttari/z_en_suttari.c | 20 +++++------ src/overlays/actors/ovl_En_Sw/z_en_sw.c | 2 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 36 +++++++++---------- src/overlays/actors/ovl_En_Test4/z_en_test4.c | 8 ++--- .../actors/ovl_En_Thiefbird/z_en_thiefbird.c | 10 +++--- src/overlays/actors/ovl_En_Toto/z_en_toto.c | 14 ++++---- src/overlays/actors/ovl_En_Trt/z_en_trt.c | 26 +++++++------- .../actors/ovl_En_Tubo_Trap/z_en_tubo_trap.c | 6 ++-- .../actors/ovl_En_Warp_Uzu/z_en_warp_uzu.c | 2 +- .../ovl_En_Weather_Tag/z_en_weather_tag.c | 16 +++++---- src/overlays/actors/ovl_En_Zot/z_en_zot.c | 4 +-- src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c | 2 +- .../actors/ovl_Obj_Etcetera/z_obj_etcetera.c | 2 +- .../actors/ovl_Obj_Funen/z_obj_funen.c | 2 +- .../actors/ovl_Obj_Ghaka/z_obj_ghaka.c | 4 +-- .../actors/ovl_Obj_Kibako/z_obj_kibako.c | 2 +- .../ovl_Obj_Moon_Stone/z_obj_moon_stone.c | 4 +-- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 4 +-- .../ovl_Obj_Tokei_Step/z_obj_tokei_step.c | 2 +- 74 files changed, 301 insertions(+), 300 deletions(-) diff --git a/include/macros.h b/include/macros.h index fc03fa4ffc..915a3fff3e 100644 --- a/include/macros.h +++ b/include/macros.h @@ -17,8 +17,7 @@ #define VIRTUAL_TO_PHYSICAL(addr) (uintptr_t)((u8*)(addr)-0x80000000) #define SEGMENTED_TO_VIRTUAL(addr) (void*)(PHYSICAL_TO_VIRTUAL(gSegments[SEGMENT_NUMBER(addr)]) + SEGMENT_OFFSET(addr)) -// Currently most often called ctxt in MM, TODO: Refactor names when its used -#define ACTIVE_CAM globalCtx->cameraPtrs[globalCtx->activeCamera] +#define GET_ACTIVE_CAM(globalCtx) ((globalCtx)->cameraPtrs[(globalCtx)->activeCamera]) #define MAIN_CAM 0 #define SUBCAM_FREE 0 @@ -37,9 +36,9 @@ } \ (void)0 -#define PLAYER ((Player*)globalCtx->actorCtx.actorList[ACTORCAT_PLAYER].first) +#define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorList[ACTORCAT_PLAYER].first) -#define FIRST_ENEMY ((Actor*)globalCtx->actorCtx.actorList[ACTORCAT_ENEMY].first) +#define GET_FIRST_ENEMY(globalCtx) ((Actor*)(globalCtx)->actorCtx.actorList[ACTORCAT_ENEMY].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/src/code/code_800E8EA0.c b/src/code/code_800E8EA0.c index ca2e9e841f..754b8759da 100644 --- a/src/code/code_800E8EA0.c +++ b/src/code/code_800E8EA0.c @@ -54,7 +54,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) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 sVar3; Vec3f local_14; s16 sVar3A; @@ -83,7 +83,7 @@ s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* } s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 sVar3; Vec3f local_14; s16 sVar3A; diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 40ea71ee01..6ea0b2fcf0 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -2913,8 +2913,8 @@ void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt, /** * Iterates through all AT colliders, testing them for AC collisions with each AC collider, setting the info regarding * the collision for each AC and AT collider that collided. Then spawns hitmarks and plays sound effects for each - * successful collision. To collide, an AT collider must share a type (PLAYER, ENEMY, or BOMB) with the AC collider and - * the toucher and bumper elements that overlapped must share a dmgFlag. + * successful collision. To collide, an AT collider must share a type (AC_TYPE_PLAYER, AC_TYPE_ENEMY, or AC_TYPE_OTHER) + * with the AC collider and the toucher and bumper elements that overlapped must share a dmgFlag. */ void CollisionCheck_AT(GlobalContext* globalCtx, CollisionCheckContext* colCtxt) { Collider** col; diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 39cc4af73e..aa461153c8 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -899,7 +899,7 @@ void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* #endif void EffectSsFireTail_SpawnFlameOnPlayer(GlobalContext* globalCtx, f32 scale, s16 bodyPart, f32 colorIntensity) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); 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 13be40c0ab..0a412c2da8 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -403,7 +403,7 @@ void func_800A6780(EnItem00* this, GlobalContext* globalCtx) { } void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->unk14A != 0) { if (Actor_HasParent(&this->actor, globalCtx) == 0) { @@ -439,7 +439,7 @@ void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) { void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) { EnItem00* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 sp38 = player->stateFlags3 & 0x1000; s32 getItemId = GI_NONE; s32 pad2; diff --git a/src/code/z_quake.c b/src/code/z_quake.c index b45e023812..aeb8370ab4 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -444,7 +444,7 @@ void Quake2_Update(void) { Player* player; GlobalContext* globalCtx = sQuake2Context.globalCtx; PosRot playerPosRot; - Camera* camera = globalCtx->cameraPtrs[globalCtx->activeCamera]; + Camera* camera = GET_ACTIVE_CAM(globalCtx); f32 speedRatio = CLAMP_MAX(camera->speedRatio, 1.0f); if (sQuake2Context.type != 0) { @@ -605,7 +605,7 @@ void Quake2_Update(void) { angle1 = 0x3F0; angle2 = 0x156; sQuake2Context.countdown = 2; - player = PLAYER; + player = GET_PLAYER(globalCtx); if (&player->actor != NULL) { func_800B8248(&playerPosRot, player); @@ -654,7 +654,7 @@ void Quake2_Update(void) { angle1 = 0x3F0; angle2 = 0x156; sQuake2Context.countdown = 2; - player = PLAYER; + player = GET_PLAYER(globalCtx); angle1Speed = 359.2f; angle2Speed = -18.5f; rotX = 0.0f; diff --git a/src/code/z_room.c b/src/code/z_room.c index 0a11f83fe9..5f900ea873 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -114,7 +114,7 @@ s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) { gSegments[3] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram); Scene_ProcessHeader(globalCtx, (SceneCmd*)roomCtx->currRoom.segment); - func_80123140(globalCtx, PLAYER); + func_80123140(globalCtx, GET_PLAYER(globalCtx)); Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); if (((globalCtx->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) && diff --git a/src/code/z_snap.c b/src/code/z_snap.c index b6538a685f..120861ff5f 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -119,7 +119,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, s32 ret = 0; u32 unk2; - camera = ACTIVE_CAM; + camera = GET_ACTIVE_CAM(globalCtx); distance = OLib_Vec3fDist(pos, &camera->eye); if ((distance < distanceMin) || (distanceMax < distance)) { @@ -148,7 +148,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, } actors[0] = actor; - actors[1] = &PLAYER->actor; + actors[1] = &GET_PLAYER(globalCtx)->actor; if (CollisionCheck_LineOCCheck(globalCtx, &globalCtx->colChkCtx, 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 07d68d030d..2e99b093f9 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -72,7 +72,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->actor; + this->actor.parent = &GET_PLAYER(globalCtx)->actor; this->timer = 26; } } @@ -120,7 +120,7 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) { } void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->actor.parent == NULL) || (!func_801240C8(player))) { ArmsHook_DetachHookFromActor(this); @@ -288,7 +288,7 @@ static Vec3f D_808C1C4C = { 0.0f, -500.0f, 0.0f }; void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { ArmsHook* this = THIS; f32 f0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx);; if (player->actor.draw != NULL && player->rightHandType == 0xB) { Vec3f sp68; 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 55d5564c86..68371797b9 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 @@ -59,7 +59,7 @@ void BgCtowerRot_Init(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc = BgCtowerRot_CorridorRotate; return; } - player = PLAYER; + player = GET_PLAYER(globalCtx); if (this->dyna.actor.params == MAIN_DOOR) { BgCheck3_LoadMesh(globalCtx, &this->dyna, &D_06017410); this->dyna.actor.world.rot.y = this->dyna.actor.shape.rot.y + 0x4000; @@ -85,7 +85,7 @@ void BgCtowerRot_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void BgCtowerRot_CorridorRotate(BgCtowerRot* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f offset; f32 rotZ; f32 offsetDiffZ; @@ -128,7 +128,7 @@ void BgCtowerRot_DoorClose(BgCtowerRot* this, GlobalContext* globalCtx) { } void BgCtowerRot_DoorIdle(BgCtowerRot* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f offset; Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->actor.world.pos); diff --git a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c index 7df92fc577..691cf99924 100644 --- a/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c +++ b/src/overlays/actors/ovl_Bg_Hakugin_Post/z_bg_hakugin_post.c @@ -523,8 +523,8 @@ void func_80A9C058(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU sp44.x = this->dyna.actor.home.pos.x + unkStruct1->unk_14.x; sp44.y = this->unk_16C + unkStruct1->unk_14.y; sp44.z = this->dyna.actor.home.pos.z + unkStruct1->unk_14.z; - func_8013ECE0(Math3D_DistanceSquared(&sp44, &PLAYER->actor.world.pos), 255, 20, 150); - quake = Quake_Add(ACTIVE_CAM, 3); + func_8013ECE0(Math3D_DistanceSquared(&sp44, &GET_PLAYER(globalCtx)->actor.world.pos), 255, 20, 150); + quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quake, 20000); Quake_SetQuakeValues(quake, 7, 0, 0, 0); Quake_SetCountdown(quake, 12); @@ -540,8 +540,8 @@ void func_80A9C058(BgHakuginPost* this, GlobalContext* globalCtx, BgHakuginPostU void func_80A9C18C(BgHakuginPost* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; - Camera* activeCam = ACTIVE_CAM; + Player* player = GET_PLAYER(globalCtx); + Camera* activeCam = GET_ACTIVE_CAM(globalCtx); s16 quake; func_8013ECE0(Math3D_XZDistanceSquared(player->actor.world.pos.x, player->actor.world.pos.z, @@ -814,7 +814,7 @@ void func_80A9CE00(BgHakuginPost* this) { void func_80A9CE1C(BgHakuginPost* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); ColliderCylinder* collider; s32 yDiff; s32 i; diff --git a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c index 6c590ab9da..986b8b8ae3 100644 --- a/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c +++ b/src/overlays/actors/ovl_Bg_Ikana_Shutter/z_bg_ikana_shutter.c @@ -146,7 +146,7 @@ void func_80BD5A18(BgIkanaShutter* this, GlobalContext* globalCtx) { this->dyna.actor.velocity.y *= 0.978f; this->dyna.actor.world.pos.y += this->dyna.actor.velocity.y; if (this->dyna.actor.world.pos.y <= this->dyna.actor.home.pos.y) { - quake = Quake_Add(ACTIVE_CAM, 3); + quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quake, 0x5420); Quake_SetQuakeValues(quake, 4, 0, 0, 0); Quake_SetCountdown(quake, 12); 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 fa4bdd85d1..123a1248fa 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,7 +49,7 @@ static InitChainEntry sInitChain[] = { s32 func_80C0A740(BgIkninSusceil* this, GlobalContext* globalCtx) { s32 pad2[2]; Vec3f offset; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor_CalcOffsetOrientedToDrawRotation(&this->dyna.actor, &offset, &player->actor.world.pos); @@ -66,7 +66,7 @@ void func_80C0A838(BgIkninSusceil* this, GlobalContext* globalCtx) { void func_80C0A86C(BgIkninSusceil* this, GlobalContext* globalCtx, s16 verticalMag, s16 countdown, s32 arg4) { s32 pad; - s16 quake = Quake_Add(ACTIVE_CAM, 3); + s16 quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quake, 0x7B30); Quake_SetQuakeValues(quake, verticalMag, 0, 0, 0); @@ -84,7 +84,7 @@ s32 func_80C0A95C(BgIkninSusceil* this, GlobalContext* globalCtx) { s32 phi_t0 = true; s32 i; f32 new_var; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f offset; f32 temp1, temp2, temp3, temp4; @@ -218,7 +218,7 @@ void func_80C0AE5C(BgIkninSusceil* this, GlobalContext* globalCtx) { void BgIkninSusceil_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; BgIkninSusceil* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->unk168 == 0) && (this->unk166 > 0) && (player->stateFlags3 & 0x100) && (player->unk_B48 > 1000.0f)) { this->unk168 = 2; 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 063af19d24..72b196ab07 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) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 cutsceneId = this->dyna.actor.cutscene; s16 prevTimer; 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 ba8920246b..4db7316e41 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) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 dooranaType = GET_DOORANA_TYPE(this); s8 pad[4]; s32 entranceIndex; @@ -187,7 +187,7 @@ void DoorAna_GrabLink(DoorAna* this, GlobalContext* globalCtx) { } if ((this->actor.yDistToPlayer <= 0.0f) && (this->actor.xzDistToPlayer > 20.0f)) { - player = PLAYER; + player = GET_PLAYER(globalCtx); 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; } @@ -197,7 +197,7 @@ void DoorAna_Update(Actor* thisx, GlobalContext* globalCtx) { DoorAna* this = THIS; this->actionFunc(this, globalCtx); - this->actor.shape.rot.y = BINANG_ROT180(func_800DFCDC(globalCtx->cameraPtrs[globalCtx->activeCamera])); + this->actor.shape.rot.y = BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))); } void DoorAna_Draw(Actor* thisx, GlobalContext* globalCtx) { 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 e767e3f35d..1978756a2b 100644 --- a/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c +++ b/src/overlays/actors/ovl_Door_Spiral/z_door_spiral.c @@ -223,7 +223,7 @@ void DoorSpiral_WaitForObject(DoorSpiral* this, GlobalContext* globalCtx) { */ f32 DoorSpiral_GetDistFromPlayer(GlobalContext* globalCtx, DoorSpiral* this, f32 yOffset, f32 spiralWidth, f32 spiralHeight) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f target; Vec3f offset; @@ -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) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(func_801233E4(globalCtx))) { SpiralInfo* spiralInfo = &sSpiralInfo[this->spiralType]; @@ -277,7 +277,7 @@ void DoorSpiral_Wait(DoorSpiral* this, GlobalContext* globalCtx) { if (this->shouldClimb) { DoorSpiral_SetupAction(this, DoorSpiral_PlayerClimb); } else if (DoorSpiral_PlayerShouldClimb(this, globalCtx)) { - player = PLAYER; + player = GET_PLAYER(globalCtx); player->doorType = 4; player->doorDirection = this->orientation; @@ -293,7 +293,7 @@ void DoorSpiral_Wait(DoorSpiral* this, GlobalContext* globalCtx) { * Player is climbing the stairs. */ void DoorSpiral_PlayerClimb(DoorSpiral* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); 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; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); 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 b5a6f4c867..bfb2cc7280 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -163,7 +163,7 @@ void func_80918FE4(EffDust* this, GlobalContext* globalCtx) { void func_80919230(EffDust* this, GlobalContext* globalCtx) { s16 theta; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* parent = this->actor.parent; f32* distanceTraveled = this->distanceTraveled; s32 i; @@ -262,7 +262,7 @@ void func_80919768(Actor* thisx, GlobalContext* globalCtx2) { s16 sp92; Vec3f activeCamEye; - activeCamEye = ACTIVE_CAM->eye; + activeCamEye = GET_ACTIVE_CAM(globalCtx)->eye; sp92 = Math_Vec3f_Yaw(&activeCamEye, &thisx->world.pos); OPEN_DISPS(gfxCtx); @@ -313,7 +313,7 @@ void func_809199FC(Actor* thisx, GlobalContext* globalCtx2) { Vec3f* initialPositions; s32 i; f32 aux; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); OPEN_DISPS(gfxCtx); func_8012C28C(gfxCtx); diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index f1da2dc1d5..a639a10b8e 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -513,7 +513,7 @@ void EnBigpo_WarpingOut(EnBigpo* this, GlobalContext* globalCtx) { } void EnBigpo_SetupWarpIn(EnBigpo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 distance = CLAMP_MIN(this->actor.xzDistToPlayer, 200.0f); s16 randomYaw = (Rand_Next() >> 0x14) + this->actor.yawTowardsPlayer; @@ -559,7 +559,7 @@ void EnBigpo_SetupIdleFlying(EnBigpo* this) { } void EnBigpo_IdleFlying(EnBigpo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_FrameUpdateMatrix(&this->skelAnime); DECR(this->idleTimer); @@ -611,7 +611,7 @@ void EnBigpo_SetupSpinAttack(EnBigpo* this) { } void EnBigpo_SpinAttack(EnBigpo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawDiff; SkelAnime_FrameUpdateMatrix(&this->skelAnime); @@ -636,7 +636,7 @@ void EnBigpo_SetupSpinDown(EnBigpo* this) { } void EnBigpo_SpinningDown(EnBigpo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_FrameUpdateMatrix(&this->skelAnime); Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 100.0f, 0.3f, 5.0f, 1.0f); @@ -699,7 +699,7 @@ void EnBigpo_BurnAwayDeath(EnBigpo* this, GlobalContext* globalCtx) { this->idleTimer++; if (this->idleTimer < 8) { - cam = func_800DFCDC(ACTIVE_CAM) + 0x4800; + cam = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) + 0x4800; if (this->idleTimer < 5) { unkTemp = (this->idleTimer << 0xC) - 0x4000; // 1.4.0...1 is NOT 1.4, the rodata demands it @@ -869,7 +869,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx) s32 fireCount = 0; // count the number of possible fires we can find (4 in vanilla) - for (enemyPtr = FIRST_ENEMY; enemyPtr != NULL; enemyPtr = enemyPtr->next) { + for (enemyPtr = GET_FIRST_ENEMY(globalCtx); enemyPtr != NULL; enemyPtr = enemyPtr->next) { if (enemyPtr->id == ACTOR_EN_BIGPO && enemyPtr->params == ENBIGPO_POSSIBLEFIRE) { fireCount++; } @@ -887,7 +887,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx) // for available possiblefires, pick three to be random fires for (fireIndex = 0; fireIndex < ARRAY_COUNT(this->fires); fireIndex++, fireCount--) { - enemyPtr = FIRST_ENEMY; + enemyPtr = GET_FIRST_ENEMY(globalCtx); randomIndex = ((s32)Rand_ZeroFloat(fireCount)) % fireCount; while (enemyPtr != NULL) { @@ -920,7 +920,7 @@ void EnBigpo_SelectRandomFireLocations(EnBigpo* this, GlobalContext* globalCtx) } // remove unused fires - for (enemyPtr = FIRST_ENEMY; enemyPtr != NULL; enemyPtr = enemyPtr->next) { + for (enemyPtr = GET_FIRST_ENEMY(globalCtx); enemyPtr != NULL; enemyPtr = enemyPtr->next) { if (enemyPtr->id == ACTOR_EN_BIGPO && enemyPtr->params == ENBIGPO_POSSIBLEFIRE) { randomFirePo = (EnBigpo*)enemyPtr; randomFirePo->actionFunc = EnBigpo_Die; @@ -1227,7 +1227,7 @@ void EnBigpo_Update(Actor* thisx, GlobalContext* globalCtx) { */ void EnBigpo_UpdateFire(Actor* thisx, GlobalContext* globalCtx) { EnBigpo* this = (EnBigpo*)thisx; - this->actor.shape.rot.y = BINANG_ROT180(func_800DFCDC(ACTIVE_CAM)); + this->actor.shape.rot.y = BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))); this->actionFunc(this, globalCtx); } @@ -1357,7 +1357,7 @@ void EnBigpo_DrawScoopSoul(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.z, this->mainColor.r, this->mainColor.g, this->mainColor.b, this->mainColor.a * 2); - Matrix_RotateY(BINANG_ROT180(func_800DFCDC(ACTIVE_CAM)), MTXMODE_APPLY); + Matrix_RotateY(BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1377,7 +1377,7 @@ void EnBigpo_DrawLantern(Actor* thisx, GlobalContext* globalCtx) { Gfx* dispHead; Vec3f vec1; Vec3f vec2; - Camera* cam = ACTIVE_CAM; + Camera* cam = GET_ACTIVE_CAM(globalCtx); if (cam != NULL) { Math_Vec3f_Diff(&cam->eye, &cam->at, &vec1); @@ -1437,7 +1437,7 @@ void EnBigpo_DrawCircleFlames(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx); func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_RotateY(BINANG_ROT180(func_800DFCDC(ACTIVE_CAM)), MTXMODE_NEW); + Matrix_RotateY(BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))), MTXMODE_NEW); if (this->actionFunc == EnBigpo_SpawnCutsceneStage6) { Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); fireRadius = 500; diff --git a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c index 9f06cdc16f..5cce23a9c6 100644 --- a/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c +++ b/src/overlays/actors/ovl_En_Bji_01/z_en_bji_01.c @@ -80,7 +80,7 @@ static struct_80B8E1A8 D_809CDC7C[] = { }; void func_809CCDE0(EnBji01* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp58; s32 pad[2]; diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 7a4ab54719..e0c520f9fb 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -509,7 +509,7 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { } void EnClearTag_UpdateCamera(EnClearTag* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Camera* camera; s32 pad; diff --git a/src/overlays/actors/ovl_En_Dai/z_en_dai.c b/src/overlays/actors/ovl_En_Dai/z_en_dai.c index 93d43230a7..2bb4870640 100644 --- a/src/overlays/actors/ovl_En_Dai/z_en_dai.c +++ b/src/overlays/actors/ovl_En_Dai/z_en_dai.c @@ -423,7 +423,7 @@ void func_80B3EE8C(EnDai* this, GlobalContext* globalCtx) { } void func_80B3EEDC(EnDai* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->transformation == PLAYER_FORM_GORON) && (globalCtx->msgCtx.unk1202A == 3) && (globalCtx->msgCtx.unk1202E == 1)) { @@ -563,7 +563,7 @@ void EnDai_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnDai_Update(Actor* thisx, GlobalContext* globalCtx) { EnDai* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!func_80B3E7C8(this, globalCtx) && func_80B3E69C(this, globalCtx)) { func_80B3F044(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c index 4dd5512591..69042a8221 100644 --- a/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c +++ b/src/overlays/actors/ovl_En_Dekunuts/z_en_dekunuts.c @@ -307,7 +307,7 @@ void func_808BDA4C(EnDekunuts* this, GlobalContext* globalCtx) { Math_ApproachS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 2, 0xE38); if (this->actor.params == ENDEKUNUTS_GET_FF00_2) { - player = PLAYER; + player = GET_PLAYER(globalCtx); sp58.x = player->actor.world.pos.x; sp58.z = player->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Dg/z_en_dg.c b/src/overlays/actors/ovl_En_Dg/z_en_dg.c index a134bc8745..cf3337c0a7 100644 --- a/src/overlays/actors/ovl_En_Dg/z_en_dg.c +++ b/src/overlays/actors/ovl_En_Dg/z_en_dg.c @@ -167,7 +167,7 @@ void func_80989140(SkelAnime* skelAnime, ActorAnimationEntryS arg1[], s32 arg2) } void func_80989204(EnDg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->collider.dim.pos.x = this->actor.world.pos.x; this->collider.dim.pos.y = this->actor.world.pos.y; @@ -455,7 +455,7 @@ s32 func_80989FC8(GlobalContext* globalCtx) { } void func_8098A064(EnDg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags3 & 0x20000000) { if (D_8098C2A4.unk_00 == 99) { @@ -483,7 +483,7 @@ void func_8098A064(EnDg* this, GlobalContext* globalCtx) { } s32 func_8098A1B4(EnDg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); switch (player->transformation) { case PLAYER_FORM_GORON: @@ -503,7 +503,7 @@ s32 func_8098A1B4(EnDg* this, GlobalContext* globalCtx) { } void func_8098A234(EnDg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(this->actor.bgCheckFlags & 0x20)) { switch (player->transformation) { @@ -562,7 +562,7 @@ void func_8098A234(EnDg* this, GlobalContext* globalCtx) { } void func_8098A468(EnDg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.velocity.y = 0.0f; this->actor.gravity = -3.0f; @@ -586,7 +586,7 @@ void func_8098A468(EnDg* this, GlobalContext* globalCtx) { } void func_8098A55C(EnDg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->transformation == PLAYER_FORM_HUMAN) { func_80989E18(this, globalCtx); @@ -627,7 +627,7 @@ void func_8098A618(EnDg* this, GlobalContext* globalCtx) { } void func_8098A70C(EnDg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_a1; if (this->actor.xzDistToPlayer < 250.0f) { @@ -678,7 +678,7 @@ void func_8098A89C(EnDg* this, GlobalContext* globalCtx) { } void func_8098A938(EnDg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.velocity.y = 0.0f; this->actor.gravity = -3.0f; @@ -726,7 +726,7 @@ void func_8098AAAC(EnDg* this, GlobalContext* globalCtx) { } void func_8098AB48(EnDg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(this->actor.bgCheckFlags & 1)) { this->actionFunc = func_8098AF98; @@ -834,7 +834,7 @@ void func_8098AF98(EnDg* this, GlobalContext* globalCtx) { } void func_8098B004(EnDg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.velocity.y = 0.0f; this->actor.gravity = -3.0f; @@ -1070,7 +1070,7 @@ void func_8098BA64(EnDg* this, GlobalContext* globalCtx) { } void func_8098BB10(EnDg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actor.bgCheckFlags & 1) { if (this->unk_280 & 0x10) { @@ -1147,7 +1147,7 @@ void EnDg_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnDg_Update(Actor* thisx, GlobalContext* globalCtx) { EnDg* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; Vec3f sp28 = { 0.0f, 0.0f, 0.0f }; diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index add94bf4b7..cf6a959b40 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -425,7 +425,7 @@ void func_8089AD70(EnDinofos* this) { } s32 func_8089AE00(EnDinofos* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_v1; s16 temp_v1_2; Actor* temp_v0; @@ -480,7 +480,7 @@ s32 func_8089AE00(EnDinofos* this, GlobalContext* globalCtx) { void func_8089B100(EnDinofos* this, GlobalContext* globalCtx) { Camera* camera = Play_GetCamera(globalCtx, this->camId); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp3C; SkelAnime_ChangeAnim(&this->skelAnime, &D_06001CCC, 1.0f, SkelAnime_GetFrameCount(&D_06001CCC.common), @@ -712,7 +712,7 @@ void func_8089BB60(EnDinofos* this, GlobalContext* globalCtx) { } void func_8089BBB4(EnDinofos* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actionFunc != func_8089BD28) { s16 rotY = player->actor.shape.rot.y - this->actor.shape.rot.y; @@ -744,7 +744,7 @@ void func_8089BBB4(EnDinofos* this, GlobalContext* globalCtx) { } void func_8089BD28(EnDinofos* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_v0; f32 sp2C = 0.0f; diff --git a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c index 30b40c499c..5c354d5d06 100644 --- a/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c +++ b/src/overlays/actors/ovl_En_Dnp/z_en_dnp.c @@ -172,7 +172,7 @@ void func_80B3CD1C(EnDnp* this) { } s32 func_80B3CDA4(EnDnp* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_s0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Vec3f sp3C; Vec3f sp30; @@ -305,7 +305,7 @@ void func_80B3D2D4(EnDnp* this, GlobalContext* globalCtx) { } void func_80B3D338(EnDnp* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->unk_32E != 0) && (func_80152498(&globalCtx->msgCtx) == 2)) { Actor_MarkForDeath(&this->actor); diff --git a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c index ac92ed454c..861095e146 100644 --- a/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c +++ b/src/overlays/actors/ovl_En_Dnq/z_en_dnq.c @@ -257,7 +257,7 @@ s32 func_80A52A78(EnDnq* this, GlobalContext* globalCtx) { } s32 func_80A52B68(EnDnq* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u16 temp = globalCtx->msgCtx.unk11F04; if ((player->stateFlags1 & 0x40) && (player->targetActor == &this->actor)) { @@ -297,7 +297,7 @@ s32 func_80A52B68(EnDnq* this, GlobalContext* globalCtx) { } void func_80A52C6C(EnDnq* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; Vec3f sp34 = { 0.0f, 0.0f, 110.0f }; Vec3f sp28; @@ -335,7 +335,7 @@ s32 func_80A52D44(EnDnq* this, GlobalContext* globalCtx) { } void func_80A52DC8(EnDnq* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yaw = this->actor.yawTowardsPlayer - this->actor.world.rot.y; if (yaw <= 0x3800) { diff --git a/src/overlays/actors/ovl_En_Dns/z_en_dns.c b/src/overlays/actors/ovl_En_Dns/z_en_dns.c index 1249e24300..7d33a75ad9 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -128,7 +128,7 @@ void func_8092C6FC(EnDns* this, GlobalContext* globalCtx) { } void func_8092C740(EnDns* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; Vec3f sp34; Vec3f sp28; @@ -171,7 +171,7 @@ void func_8092C934(EnDns* this) { } s32* func_8092C9BC(EnDns* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(gSaveContext.weekEventReg[23] & 0x20)) { if (player->transformation != PLAYER_FORM_DEKU) { @@ -260,7 +260,7 @@ s32 func_8092CB98(EnDns* this, GlobalContext* globalCtx) { } s32 func_8092CC68(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad[2]; s32 ret = false; s16 bgId; @@ -276,7 +276,7 @@ s32 func_8092CC68(GlobalContext* globalCtx) { } s32 func_8092CCEC(EnDns* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; Vec3f sp3C = player->actor.world.pos; Vec3f sp30 = this->actor.world.pos; @@ -382,7 +382,7 @@ void func_8092D108(EnDns* this, GlobalContext* globalCtx) { } void func_8092D1B8(EnDns* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 sp22 = this->actor.world.rot.y; if (ENDNS_GET_4000(&this->actor)) { diff --git a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c index a411f81abf..e913b669bc 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -389,7 +389,7 @@ void func_80876930(EnDodongo* this, GlobalContext* globalCtx, Vec3f* arg2) { } void func_80876B08(EnDodongo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (ABS_ALT(yDiff) < 0x4000) { @@ -521,7 +521,7 @@ s32 func_8087721C(EnDodongo* this) { } s32 func_80877278(EnDodongo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* explosive = globalCtx->actorCtx.actorList[ACTORCAT_EXPLOSIVES].first; Vec3f sp44; @@ -571,7 +571,7 @@ void func_80877494(EnDodongo* this) { } void func_80877500(EnDodongo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp30; s16 temp_v1; @@ -827,7 +827,7 @@ void func_80878354(EnDodongo* this) { } void func_80878424(EnDodongo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp20; this->timer++; diff --git a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c index a6297afed2..6590796ae8 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -194,7 +194,7 @@ void EnFirefly_Ignite(EnFirefly* this) { } s32 EnFirefly_ReturnToPerch(EnFirefly* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 distFromHome; if (this->actor.params != KEESE_NORMAL_PERCH) { @@ -417,7 +417,7 @@ void EnFirefly_SetupDiveAttack(EnFirefly* this) { } void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f preyPos; SkelAnime_FrameUpdateMatrix(&this->skelAnime); @@ -607,7 +607,7 @@ void EnFirefly_SetupDisturbDiveAttack(EnFirefly* this) { } void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f preyPos; SkelAnime_FrameUpdateMatrix(&this->skelAnime); diff --git a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c index bace8a29b8..291495635d 100644 --- a/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c +++ b/src/overlays/actors/ovl_En_Fsn/z_en_fsn.c @@ -708,7 +708,7 @@ void EnFsn_InitShop(EnFsn* this, GlobalContext* globalCtx) { } void EnFsn_Idle(EnFsn* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->animationIdx == 4) { s16 curFrame = this->skelAnime.animCurrentFrame; @@ -807,7 +807,7 @@ void EnFsn_BeginInteraction(EnFsn* this, GlobalContext* globalCtx) { void EnFsn_StartBuying(EnFsn* this, GlobalContext* globalCtx) { u8 talkState = func_80152498(&globalCtx->msgCtx); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnFsn_HandleLookToShopkeeperBuyingCutscene(this); if (talkState == 5 && func_80147624(globalCtx)) { @@ -903,7 +903,7 @@ void EnFsn_SetupDeterminePrice(EnFsn* this, GlobalContext* globalCtx) { } void EnFsn_DeterminePrice(EnFsn* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 itemGiven; u8 buttonItem; @@ -941,7 +941,7 @@ void EnFsn_DeterminePrice(EnFsn* this, GlobalContext* globalCtx) { void EnFsn_MakeOffer(EnFsn* this, GlobalContext* globalCtx) { u8 talkState = func_80152498(&globalCtx->msgCtx); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (talkState == 4 && func_80147624(globalCtx)) { switch (globalCtx->msgCtx.choiceIndex) { @@ -989,7 +989,7 @@ void EnFsn_GiveItem(EnFsn* this, GlobalContext* globalCtx) { } this->actor.parent = NULL; if (ENFSN_IS_SHOP(&this->actor) && !this->isSelling) { - func_80123D50(globalCtx, PLAYER, 18, 21); + func_80123D50(globalCtx, GET_PLAYER(globalCtx), 18, 21); } this->actionFunc = EnFsn_SetupResumeInteraction; } else if (this->isSelling == true) { diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 102fe9bc59..04ddc07a42 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -307,7 +307,7 @@ void func_80961F00(GlobalContext* globalCtx) { } void func_80961F38(GlobalContext* globalCtx, Vec3f* arg1, s16* arg2, s16 arg3, s16 arg4, s16 arg5) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 sp42; s16 sp40; Vec3f sp34 = player->actor.focus.pos; @@ -381,7 +381,7 @@ void func_809622FC(EnFu* this) { } void func_80962340(EnFu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->unk_54A == 2) { this->actor.flags |= 0x10000; @@ -451,7 +451,7 @@ void func_80962588(EnFu* this, GlobalContext* globalCtx) { } void func_80962660(EnFu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_80147624(globalCtx)) { switch (this->unk_552) { @@ -636,7 +636,7 @@ void func_809629F8(EnFu* this) { } void func_80962A10(EnFu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child; this->unk_53C = 0; @@ -674,7 +674,7 @@ void func_80962BA8(EnFu* this) { } void func_80962BCC(EnFu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child; if ((fuKaiten->rotationSpeed < 100) || (fuKaiten->bouceHeight < 30.0f) || (fuKaiten->bounceSpeed < 600)) { @@ -706,7 +706,7 @@ void func_80962D48(EnFu* this) { } void func_80962D60(EnFu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child; if ((fuKaiten->rotationSpeed < 100) || (fuKaiten->bouceHeight < 40.0f) || (fuKaiten->bounceSpeed < 600)) { @@ -747,7 +747,7 @@ void func_80962F10(EnFu* this) { } void func_80962F4C(EnFu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); BgFuKaiten* fuKaiten = (BgFuKaiten*)this->actor.child; switch (this->unk_542) { @@ -895,7 +895,7 @@ void func_80963610(EnFu* this) { } void func_80963630(EnFu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_800B84D0(&this->actor, globalCtx)) { if ((gSaveContext.weekEventReg[22] & 0x10) && (gSaveContext.weekEventReg[22] & 0x20) && (CURRENT_DAY == 3) && @@ -943,7 +943,7 @@ void func_80963630(EnFu* this, GlobalContext* globalCtx) { } s32 func_80963810(GlobalContext* globalCtx, Vec3f pos) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 sp28; f32 phi_f0; s16 sp22; @@ -1175,7 +1175,7 @@ void func_80963F88(EnFu* this, GlobalContext* globalCtx) { } void func_80963FF8(EnFu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags1 & 0x100000) { globalCtx->actorCtx.unk268 = 1; @@ -1424,7 +1424,7 @@ void func_80964694(EnFu* this, EnFuUnkStruct* ptr, Vec3f* arg2, s32 len) { void func_809647EC(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len) { Vec3f sp44 = { 0.0f, 0.0f, 0.0f }; - s16 activeCam = func_800DFC68(ACTIVE_CAM); + s16 activeCam = func_800DFC68(GET_ACTIVE_CAM(globalCtx)); s32 i; for (i = 0; i < len; i++, ptr++) { diff --git a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c index 32c8cac057..b87748b8a7 100644 --- a/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c +++ b/src/overlays/actors/ovl_En_Guruguru/z_en_guruguru.c @@ -154,7 +154,7 @@ void func_80BC6F14(EnGuruguru* this, GlobalContext* globalCtx) { SkelAnime_FrameUpdateMatrix(&this->skelAnime); if (this->unk270 != 0) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->textIdIndex = 3; if (player->transformation == PLAYER_FORM_DEKU) { @@ -178,7 +178,7 @@ void func_80BC6F14(EnGuruguru* this, GlobalContext* globalCtx) { } void func_80BC701C(EnGuruguru* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->unk268 != 0) && (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU)) { @@ -191,7 +191,7 @@ void func_80BC701C(EnGuruguru* this, GlobalContext* globalCtx) { } void func_80BC7068(EnGuruguru* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->unk268 != 0) { SkelAnime_FrameUpdateMatrix(&this->skelAnime); @@ -322,7 +322,7 @@ void func_80BC7520(EnGuruguru* this, GlobalContext* globalCtx) { void EnGuruguru_Update(Actor* thisx, GlobalContext* globalCtx) { EnGuruguru* this = THIS; s32 yaw; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawTemp; if (!gSaveContext.isNight) { diff --git a/src/overlays/actors/ovl_En_Hg/z_en_hg.c b/src/overlays/actors/ovl_En_Hg/z_en_hg.c index 779e32eddc..54c62e52d9 100644 --- a/src/overlays/actors/ovl_En_Hg/z_en_hg.c +++ b/src/overlays/actors/ovl_En_Hg/z_en_hg.c @@ -178,7 +178,7 @@ void func_80BCF468(EnHg* this) { } void func_80BCF4AC(EnHg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; this->actor.speedXZ = 1.6f; @@ -202,7 +202,7 @@ void func_80BCF5F0(EnHg* this) { } void func_80BCF634(EnHg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Math_Vec3f_DistXZ(&player->actor.world.pos, &this->actor.home.pos) < 200.0f) { func_80BCF468(this); @@ -351,7 +351,7 @@ void func_80BCF95C(EnHg* this, GlobalContext* globalCtx) { } void func_80BCFC0C(EnHg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actor.colChkInfo.health == 1 && !(fabsf(this->actor.yDistToPlayer) >= 80.0f)) { if (player->stateFlags2 & 0x08000000) { diff --git a/src/overlays/actors/ovl_En_Holl/z_en_holl.c b/src/overlays/actors/ovl_En_Holl/z_en_holl.c index 1d7dc33f69..ad9e4e8737 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -106,7 +106,7 @@ void EnHoll_SetupAction(EnHoll* this) { } void EnHoll_SetPlayerSide(GlobalContext* globalCtx, EnHoll* this, Vec3f* transformedPlayerPos) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor_CalcOffsetOrientedToDrawRotation(&this->actor, transformedPlayerPos, &player->actor.world.pos); this->playerSide = (transformedPlayerPos->z < 0.0f) ? EN_HOLL_BEHIND : EN_HOLL_BEFORE; @@ -217,7 +217,7 @@ void EnHoll_VisibleIdle(EnHoll* this, GlobalContext* globalCtx) { } void EnHoll_TransparentIdle(EnHoll* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 useViewEye = D_801D0D50 || globalCtx->csCtx.state != 0; Vec3f transformedPlayerPos; f32 enHollTop; @@ -307,7 +307,7 @@ void EnHoll_RoomTransitionIdle(EnHoll* this, GlobalContext* globalCtx) { void EnHoll_Update(Actor* thisx, GlobalContext* globalCtx) { EnHoll* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((globalCtx->sceneLoadFlag == 0) && (globalCtx->unk_18B4A == 0) && !(player->stateFlags1 & 0x200)) { this->actionFunc(this, globalCtx); 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 e2b0e91caa..e3b34d19f8 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -251,7 +251,7 @@ s32 func_808F3310(EnIn* this, GlobalContext* globalCtx) { } s32 func_808F3334(EnIn* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->colliderJntSph.base.atFlags & AT_HIT) { this->colliderJntSph.base.atFlags &= ~AT_HIT; @@ -275,7 +275,7 @@ s32 func_808F33B8(void) { } void func_808F3414(EnIn* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp30; if (this->unk23D == 0) { @@ -1262,7 +1262,7 @@ s32 func_808F5728(GlobalContext* globalCtx, EnIn* this, s32 arg2, s32* arg3) { if (*arg3 == 1) { s32 requiredScopeTemp; - player = PLAYER; + player = GET_PLAYER(globalCtx); func_808F5994(this, globalCtx, &player->actor.world.pos, 0xC80); } else { rotDiff = this->actor.home.rot.y - this->actor.world.rot.y; @@ -1516,7 +1516,7 @@ void EnIn_Update(Actor* thisx, GlobalContext* globalCtx) { } void func_808F6334(EnIn* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 newUnk4C8; newUnk4C8 = func_80152498(&globalCtx->msgCtx); diff --git a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c index 41d52159d1..a6aaa90c48 100644 --- a/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c +++ b/src/overlays/actors/ovl_En_Invadepoh/z_en_invadepoh.c @@ -2684,7 +2684,7 @@ void func_80B48AD4(EnInvadepoh* this, GlobalContext* globalCtx) { s32 requiredScopeTemp; if ((this->actor.xzDistToPlayer < 350.0f) && ((globalCtx->gameplayFrames & 0x60) != 0)) { - player = PLAYER; + player = GET_PLAYER(globalCtx); temp_v1 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.85f; temp_v1 -= this->actor.shape.rot.x; substruct->unk26.x = CLAMP(temp_v1, -2500, 2500); @@ -2744,7 +2744,7 @@ void func_80B48DE4(EnInvadepoh* this) { void func_80B48E4C(EnInvadepoh* this, GlobalContext* globalCtx) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_v1; s16 diff; @@ -3092,7 +3092,7 @@ void func_80B49DA0(EnInvadepoh* this) { void func_80B49DFC(EnInvadepoh* this, GlobalContext* globalCtx) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_v1; s16 diff; @@ -3222,7 +3222,7 @@ void func_80B4A350(EnInvadepoh* this, GlobalContext* globalCtx) { Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk304, 6, this->behaviorInfo.unk4C, 40); if (this->actor.xzDistToPlayer < 300.0f) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); temp_v1_2 = Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos); temp_v1_2 *= 0.85f; @@ -3318,7 +3318,7 @@ void func_80B4A7C0(EnInvadepoh* this) { void func_80B4A81C(EnInvadepoh* this, GlobalContext* globalCtx) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_v1; s16 diff; @@ -3554,7 +3554,7 @@ void func_80B4B218(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); if (sp38 && this->actor.update != NULL) { SkelAnime_FrameUpdateMatrix(&this->skelAnime); - player = PLAYER; + player = GET_PLAYER(globalCtx); Math_StepToS(&this->behaviorInfo.unk4C, 2000, 40); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 6, this->behaviorInfo.unk4C, 40); temp_v1 = (Math_Vec3f_Pitch(&this->actor.focus.pos, &player->actor.focus.pos) * 0.9f); @@ -3854,7 +3854,7 @@ void func_80B4BFFC(EnInvadepoh* this) { void func_80B4C058(EnInvadepoh* this, GlobalContext* globalCtx) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_v1; s16 diff; @@ -3886,7 +3886,7 @@ void func_80B4C1BC(EnInvadepoh* this) { void func_80B4C218(EnInvadepoh* this, GlobalContext* globalCtx) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* temp_v0; s16 temp_v1; s16 diff; @@ -4079,7 +4079,7 @@ void func_80B4CAB0(EnInvadepoh* this) { void func_80B4CB0C(EnInvadepoh* this, GlobalContext* globalCtx) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_v1; s16 diff; @@ -4108,7 +4108,7 @@ void func_80B4CC70(EnInvadepoh* this) { void func_80B4CCCC(EnInvadepoh* this, GlobalContext* globalCtx) { AlienBehaviorInfo* substruct = &this->behaviorInfo; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_v1; s16 diff; diff --git a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c index 6a37e5e053..457178720f 100644 --- a/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c +++ b/src/overlays/actors/ovl_En_Kgy/z_en_kgy.c @@ -313,7 +313,7 @@ void func_80B40EE8(EnKgy* this, GlobalContext* globalCtx) { } void func_80B411DC(EnKgy* this, GlobalContext* globalCtx, s32 arg2) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); switch (arg2) { case 0: @@ -508,7 +508,7 @@ void func_80B418C4(EnKgy* this, GlobalContext* globalCtx) { void func_80B419B0(EnKgy* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_80B4163C(this, globalCtx); if (func_800B84D0(&this->actor, globalCtx) || (&this->actor == player->targetActor)) { @@ -534,7 +534,7 @@ void func_80B41A48(EnKgy* this, GlobalContext* globalCtx) { void func_80B41ACC(EnKgy* this, GlobalContext* globalCtx) { s32 temp_v0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_FrameUpdateMatrix(&this->skelAnime); if (func_80152498(&globalCtx->msgCtx) == 0x10) { @@ -577,7 +577,7 @@ void func_80B41ACC(EnKgy* this, GlobalContext* globalCtx) { } void func_80B41C30(EnKgy* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (&this->actor != player->targetActor) { this->actionFunc = func_80B42508; @@ -620,7 +620,7 @@ void func_80B41D64(EnKgy* this, GlobalContext* globalCtx) { void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { u16 temp; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (SkelAnime_FrameUpdateMatrix(&this->skelAnime) && (this->unk_2D2 == 3)) { func_80B40BC0(this, 4); @@ -758,7 +758,7 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { case 0xC46: case 0xC55: - func_80123D50(globalCtx, PLAYER, 0x12, 0x15); + func_80123D50(globalCtx, GET_PLAYER(globalCtx), 0x12, 0x15); player->unk_A87 = 0; this->unk_29C &= ~0x8; globalCtx->msgCtx.unk11F10 = 0; @@ -842,7 +842,7 @@ void func_80B41E18(EnKgy* this, GlobalContext* globalCtx) { void func_80B42508(EnKgy* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_FrameUpdateMatrix(&this->skelAnime); this->actor.focus.pos = this->unk_2A8; @@ -881,7 +881,7 @@ void func_80B42660(EnKgy* this, GlobalContext* globalCtx) { void func_80B42714(EnKgy* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_FrameUpdateMatrix(&this->skelAnime); this->actor.focus.pos = this->unk_2A8; diff --git a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c index 6f4c463cf1..b83fba1b4b 100644 --- a/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c +++ b/src/overlays/actors/ovl_En_Ma4/z_en_ma4.c @@ -160,7 +160,7 @@ void EnMa4_ChangeAnim(EnMa4* this, s32 index) { } void func_80ABDD9C(EnMa4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 flag; if (this->unk_1D8.unk_00 == 0 && @@ -346,7 +346,7 @@ void EnMa4_SetupWait(EnMa4* this) { } void EnMa4_Wait(EnMa4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yaw = this->actor.shape.rot.y - this->actor.yawTowardsPlayer; if ((this->state == MA4_STATE_AFTERHORSEBACKGAME) || (this->state == MA4_STATE_AFTERDESCRIBETHEMCS)) { @@ -506,7 +506,7 @@ void EnMa4_HandlePlayerChoice(EnMa4* this, GlobalContext* globalCtx) { } void EnMa4_ChooseNextDialogue(EnMa4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 aux; if (func_80147624(globalCtx) != 0) { @@ -708,7 +708,7 @@ void EnMa4_HorsebackGameTalking(EnMa4* this, GlobalContext* globalCtx) { } void EnMa4_InitHorsebackGame(EnMa4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); globalCtx->interfaceCtx.unk_280 = 1; func_8010E9F0(4, 0); @@ -719,7 +719,7 @@ void EnMa4_InitHorsebackGame(EnMa4* this, GlobalContext* globalCtx) { } void EnMa4_SetupHorsebackGameWait(EnMa4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (globalCtx->interfaceCtx.unk_280 == 8) { this->actionFunc = EnMa4_HorsebackGameWait; @@ -729,7 +729,7 @@ void EnMa4_SetupHorsebackGameWait(EnMa4* this, GlobalContext* globalCtx) { void EnMa4_HorsebackGameWait(EnMa4* this, GlobalContext* globalCtx) { static s16 D_80AC0258 = 0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->stateFlags3 |= 0x400; EnMa4_HorsebackGameCheckPlayerInteractions(this, globalCtx); @@ -756,7 +756,7 @@ void EnMa4_SetupHorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx) { void EnMa4_HorsebackGameEnd(EnMa4* this, GlobalContext* globalCtx) { static s32 sFrameCounter = 0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags1 & 0x100000) { globalCtx->actorCtx.unk268 = 1; @@ -848,7 +848,7 @@ void EnMa4_EponasSongCs(EnMa4* this, GlobalContext* globalCtx) { EnMa4_ChangeAnim(this, 7); } } else { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->stateFlags1 |= 0x20; func_800B85E0(&this->actor, globalCtx, 200.0f, -1); @@ -863,7 +863,7 @@ void EnMa4_SetupEndEponasSongCs(EnMa4* this) { } void EnMa4_EndEponasSongCs(EnMa4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.flags |= 0x10000; if (func_800B84D0(&this->actor, globalCtx) != 0) { diff --git a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c index 1c9987a8e3..b8f7f969b8 100644 --- a/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c +++ b/src/overlays/actors/ovl_En_Ma_Yto/z_en_ma_yto.c @@ -1299,7 +1299,7 @@ void EnMaYto_ChangeAnim(EnMaYto* this, s32 index) { } void func_80B90C78(EnMaYto* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 flag; SkelAnime_FrameUpdateMatrix(&this->skelAnime); 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 76ad7447c3..786dee4bae 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 @@ -143,7 +143,7 @@ static void* sEyeTextures[] = { }; void func_80B8D12C(EnMaYts* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 flag = this->unk_32C == 2 ? true : false; if (this->unk_32C == 0 || this->actor.parent == NULL) { 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 41d80f6375..d1f4a0d90f 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -238,7 +238,7 @@ void EnMinifrog_SetCamera(EnMinifrog* this, GlobalContext* globalCtx) { Vec3f eye; s32 i; - eye = ACTIVE_CAM->eye; + eye = GET_ACTIVE_CAM(globalCtx)->eye; yaw = Math_Vec3f_Yaw(&eye, &this->actor.world.pos); pitch = -Math_Vec3f_Pitch(&eye, &this->actor.world.pos); vec5.x = this->actor.world.pos.x - (5.0f * Math_SinS(yaw) * Math_CosS(pitch)); diff --git a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c index 07b219fc8a..18be1dc958 100644 --- a/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c +++ b/src/overlays/actors/ovl_En_Minislime/z_en_minislime.c @@ -234,7 +234,7 @@ void EnMinislime_Disappear(EnMinislime* this, GlobalContext* globalCtx) { } void EnMinislime_SetupFall(EnMinislime* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yaw; this->collider.base.atFlags |= AT_ON; @@ -762,7 +762,7 @@ void EnMinislime_Update(Actor* thisx, GlobalContext* globalCtx) { } if (this->actor.bgCheckFlags & 2) { - player = PLAYER; + player = GET_PLAYER(globalCtx); vec1.x = this->actor.world.pos.x; vec1.z = this->actor.world.pos.z; vec1.y = player->actor.world.pos.y + player->actor.yDistToWater; 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 1a6dfb9ea4..f3af54caf7 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -638,7 +638,7 @@ void EnNiw_SetupRunAway(EnNiw* this) { } void EnNiw_RunAway(EnNiw* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f tempVec3f = D_808934E8; s16 temp298; f32 dX; @@ -736,7 +736,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { EnNiw* this = (EnNiw*)thisx; s8 pad0; s16 i; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); 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 45c8b9bf0c..bae091c191 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -83,7 +83,7 @@ void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx) { EnNutsball* this = THIS; GlobalContext* globalCtx2 = globalCtx; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f worldPos; Vec3s worldRot; Vec3f spawnBurstPos; diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index d7f9e18bce..046f3bb802 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -197,7 +197,7 @@ void EnOssan_CheckValidSpawn(EnOssan* this) { } void EnOssan_RotateHead(EnOssan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actor.params == ENOSSAN_PART_TIME_WORKER) { if (player->transformation == PLAYER_FORM_ZORA) { @@ -262,7 +262,7 @@ void EnOssan_UpdateCursorPos(GlobalContext* globalCtx, EnOssan* this) { } void EnOssan_EndInteraction(GlobalContext* globalCtx, EnOssan* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_800B84D0(&this->actor, globalCtx); globalCtx->msgCtx.unk11F22 = 0x43; @@ -327,7 +327,7 @@ void EnOssan_SetupLookToShopkeeperFromShelf(GlobalContext* globalCtx, EnOssan* t } void EnOssan_Idle(EnOssan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_8013D9C8(globalCtx, this->limbRotTableY, this->limbRotTableZ, 19); if (func_800B84D0(&this->actor, globalCtx)) { @@ -525,7 +525,7 @@ void EnOssan_Hello(EnOssan* this, GlobalContext* globalCtx) { ActorAnimationEntryS* animations = sAnimations[this->actor.params]; u8 talkState = func_80152498(&globalCtx->msgCtx); s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnOssan_RotateHead(this, globalCtx); if (talkState == 5 && func_80147624(globalCtx)) { @@ -557,7 +557,7 @@ void EnOssan_Hello(EnOssan* this, GlobalContext* globalCtx) { s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, GlobalContext* globalCtx) { ActorAnimationEntryS* animations = sAnimations[this->actor.params]; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); switch (globalCtx->msgCtx.choiceIndex) { case 0: @@ -583,7 +583,7 @@ s32 EnOssan_FacingShopkeeperDialogResult(EnOssan* this, GlobalContext* globalCtx void EnOssan_FaceShopkeeper(EnOssan* this, GlobalContext* globalCtx) { u8 talkState = func_80152498(&globalCtx->msgCtx); s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u8 cursorIdx; if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { @@ -944,7 +944,7 @@ void EnOssan_LookToShopkeeperFromShelf(EnOssan* this, GlobalContext* globalCtx) } void EnOssan_SetupBuyItemWithFanfare(GlobalContext* globalCtx, EnOssan* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_800B8A1C(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); globalCtx->msgCtx.unk11F22 = 0x43; @@ -1080,7 +1080,7 @@ void EnOssan_SetupItemPurchased(EnOssan* this, GlobalContext* globalCtx) { void EnOssan_ContinueShopping(EnOssan* this, GlobalContext* globalCtx) { u8 talkState = func_80152498(&globalCtx->msgCtx); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnGirlA* item; if (talkState == 4) { @@ -1120,7 +1120,7 @@ void EnOssan_ContinueShopping(EnOssan* this, GlobalContext* globalCtx) { } void EnOssan_ItemPurchased(EnOssan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->cutsceneState == ENOSSAN_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -1341,7 +1341,7 @@ void EnOssan_InitPartTimeWorker(EnOssan* this, GlobalContext* globalCtx) { } u16 EnOssan_GetWelcomeCuriosityShopMan(EnOssan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u16 textId = Text_GetFaceReaction(globalCtx, 0x2F); if (textId != 0) { @@ -1374,7 +1374,7 @@ u16 EnOssan_GetWelcomeCuriosityShopMan(EnOssan* this, GlobalContext* globalCtx) } u16 EnOssan_GetWelcomePartTimeWorker(EnOssan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u16 textId = Text_GetFaceReaction(globalCtx, 0x36); if (textId != 0) { diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 36580181ac..04c9e0fd2c 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -224,7 +224,7 @@ void EnOwl_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_8095A920(EnOwl* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &player->actor.world.pos); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.world.rot.y, 6, 0x3E8, 0xC8); @@ -485,7 +485,7 @@ void func_8095B3DC(EnOwl* this, GlobalContext* globalCtx) { } void func_8095B480(EnOwl* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags3 & 0x10000000) { this->actor.textId = 0xBF1; @@ -1071,7 +1071,7 @@ void EnOwl_Update(Actor* thisx, GlobalContext* globalCtx) { void func_8095CCF4(Actor* thisx, GlobalContext* globalCtx) { EnOwl* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags3 & 0x10000000) { Actor_MarkForDeath(&this->actor); diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index 7a99b804a0..94f8605af9 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -432,7 +432,7 @@ void func_80BD909C(EnPamera* this, GlobalContext* globalCtx) { } void func_80BD90AC(EnPamera* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Player_GetMask(globalCtx) != PLAYER_MASK_STONE_MASK && (this->actionFunc != func_80BD8758) && (this->actionFunc != func_80BD8964) && (this->actionFunc != func_80BD8A7C) && 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 9e47e89bb2..ca90a1fd4a 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -972,7 +972,7 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, GlobalContext* globalCtx) { static Vec3f sAccel = { 0.0f, -0.5f, 0.0f }; static Color_RGBA8 primColor = { 250, 250, 250, 255 }; static Color_RGBA8 envColor = { 180, 180, 180, 255 }; - s16 yaw = BINANG_ROT180(func_800DFCDC(ACTIVE_CAM)); + s16 yaw = BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))); Vec3f vec1; Vec3f vel; s32 i; @@ -1245,7 +1245,7 @@ void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx) // Zooms in on Snapper spawn point Play_CameraSetAtEye(globalCtx, this->camId, &at, &eye); - this->quake = Quake_Add(ACTIVE_CAM, 6); + this->quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 6); Quake_SetSpeed(this->quake, 18000); Quake_SetQuakeValues(this->quake, 2, 0, 0, 0); Quake_SetCountdown(this->quake, 15); @@ -1268,7 +1268,7 @@ void EnPametfrog_SnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx) { void EnPametfrog_SetupTransitionGekkoSnapper(EnPametfrog* this, GlobalContext* globalCtx) { this->actor.params = GEKKO_GET_SNAPPER; Quake_RemoveFromIdx(this->quake); - this->quake = Quake_Add(ACTIVE_CAM, 3); + this->quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(this->quake, 20000); Quake_SetQuakeValues(this->quake, 17, 0, 0, 0); Quake_SetCountdown(this->quake, 12); diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 161067b299..7e186e4a19 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -189,7 +189,7 @@ void EnPoh_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_80B2C910(Vec3f* vec, GlobalContext* globalCtx) { - Camera* activeCam = ACTIVE_CAM; + Camera* activeCam = GET_ACTIVE_CAM(globalCtx); Vec3f sp20; f32 temp_f0; @@ -208,7 +208,7 @@ void func_80B2C910(Vec3f* vec, GlobalContext* globalCtx) { } void func_80B2C9B8(EnPoh* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_StepToF(&this->actor.world.pos.y, player->actor.world.pos.y, 1.0f); this->actor.world.pos.y += 2.5f * Math_SinS(this->unk_18D * 0x800); @@ -290,7 +290,7 @@ void func_80B2CD14(EnPoh* this) { } void func_80B2CD64(EnPoh* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawDiff; SkelAnime_FrameUpdateMatrix(&this->skelAnime); @@ -413,7 +413,7 @@ void func_80B2D300(EnPoh* this, GlobalContext* globalCtx) { this->unk_18E++; if (this->unk_18E < 8) { - sp38 = func_800DFCDC(ACTIVE_CAM) + 0x4800; + sp38 = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) + 0x4800; if (this->unk_18E < 5) { sp3A = (this->unk_18E * 0x1000) - 0x4000; sp44.y = (Math_SinS(sp3A) * 23.0f) + (this->actor.world.pos.y + 40.0f); @@ -1013,7 +1013,7 @@ void func_80B2F37C(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 170, 255, this->unk_197); gDPSetEnvColor(POLY_XLU_DISP++, this->unk_194, this->unk_195, this->unk_196, 255); - SysMatrix_InsertYRotation_f((func_800DFCDC(ACTIVE_CAM) + 0x8000) * (M_PI / 32768), MTXMODE_APPLY); + SysMatrix_InsertYRotation_f((func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 32768), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_06003850); diff --git a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c index eb2bfc0303..8105dfb665 100644 --- a/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c +++ b/src/overlays/actors/ovl_En_Railgibud/z_en_railgibud.c @@ -292,7 +292,7 @@ void func_80BA59F0(EnRailgibud* this) { } void func_80BA5A34(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 rot = this->actor.shape.rot.y + this->unk_3E2 + this->unk_3E8; s16 yaw = BINANG_SUB(this->actor.yawTowardsPlayer, rot); @@ -318,7 +318,7 @@ void func_80BA5AF0(EnRailgibud* this) { } void func_80BA5B64(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; Math_ScaledStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 0xFA); @@ -370,7 +370,7 @@ void func_80BA5DBC(EnRailgibud* this) { } void func_80BA5E18(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player2 = PLAYER; + Player* player2 = GET_PLAYER(globalCtx); Player* player = player2; s32 sp34; u16 sp32; @@ -663,7 +663,7 @@ void func_80BA6B9C(EnRailgibud* this, GlobalContext* globalCtx) { } s32 func_80BA6D10(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Player_GetMask(globalCtx) == PLAYER_MASK_GIBDO_MASK) { return false; @@ -678,7 +678,7 @@ s32 func_80BA6D10(EnRailgibud* this, GlobalContext* globalCtx) { } s32 func_80BA6DAC(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Actor_DistanceToPoint(&player->actor, &this->actor.home.pos) >= 100.0f) { return true; @@ -688,7 +688,7 @@ s32 func_80BA6DAC(EnRailgibud* this, GlobalContext* globalCtx) { } void func_80BA6DF8(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->unk_3FA != 1) && (this->collider.base.acFlags & AC_HIT)) { if (this->actionFunc == func_80BA57F8) { @@ -763,7 +763,7 @@ void func_80BA6DF8(EnRailgibud* this, GlobalContext* globalCtx) { } s32 func_80BA7088(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp40; f32 sp3C; f32 sp38 = 0.0f; @@ -795,7 +795,7 @@ void func_80BA71E4(EnRailgibud* this, GlobalContext* globalCtx) { } void func_80BA7234(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp30; if ((this->actionFunc == func_80BA5E18) && (this->unk_3F0 != 2)) { @@ -892,7 +892,7 @@ void func_80BA7578(EnRailgibud* this, GlobalContext* globalCtx) { } void func_80BA76C4(EnRailgibud* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->actionFunc != func_80BA66C8) && ((this->actionFunc != func_80BA5E18) || (this->unk_3F0 == 2))) { Collider_UpdateCylinder(&this->actor, &this->collider); diff --git a/src/overlays/actors/ovl_En_Rd/z_en_rd.c b/src/overlays/actors/ovl_En_Rd/z_en_rd.c index 0e58c90293..ff35322f1d 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -561,7 +561,7 @@ void func_808D4FE0(EnRd* this, GlobalContext* globalCtx) { } void func_808D506C(EnRd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; s16 sp36 = ((this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->unk_3D8) - this->unk_3DA; @@ -583,7 +583,7 @@ void func_808D506C(EnRd* this, GlobalContext* globalCtx) { if (!(this->unk_3DC & 0x80)) { player->actor.freezeTimer = 40; func_80123E90(globalCtx, &this->actor); - PLAYER->unk_A78 = &this->actor; + GET_PLAYER(globalCtx)->unk_A78 = &this->actor; func_8013ECE0(this->actor.xzDistToPlayer, 255, 20, 150); } this->unk_3ED = 60; @@ -634,7 +634,7 @@ void func_808D53C0(EnRd* this, GlobalContext* globalCtx) { } void func_808D5440(EnRd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; s16 sp36 = Actor_YawToPoint(&this->actor, &this->actor.home.pos); @@ -733,7 +733,7 @@ void func_808D586C(EnRd* this) { } void func_808D58CC(EnRd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; if (SkelAnime_FrameUpdateMatrix(&this->skelAnime)) { @@ -826,7 +826,7 @@ void func_808D5C54(EnRd* this) { } void func_808D5CCC(EnRd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_v0 = ((this->actor.yawTowardsPlayer - this->actor.shape.rot.y) - this->unk_3D8) - this->unk_3DA; if (ABS_ALT(temp_v0) < 0x2008) { @@ -928,7 +928,7 @@ void func_808D616C(EnRd* this) { } void func_808D6200(EnRd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; @@ -1061,7 +1061,7 @@ void func_808D66A0(EnRd* this, GlobalContext* globalCtx) { void func_808D6814(EnRd* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((gSaveContext.unk_3F58 != 0) && (this->actor.shape.rot.x == 0) && (this->unk_3E9 == 0) && (this->unk_3EF != 11) && (this->unk_3EF != 12) && (this->unk_3EF != 1)) { @@ -1145,7 +1145,7 @@ void func_808D6814(EnRd* this, GlobalContext* globalCtx) { } void func_808D6A94(EnRd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->actor.colChkInfo.health > 0) && (this->unk_3EF != 10)) { Collider_UpdateCylinder(&this->actor, &this->collider); 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 673a5445f9..691efcdf7a 100644 --- a/src/overlays/actors/ovl_En_Sb/z_en_sb.c +++ b/src/overlays/actors/ovl_En_Sb/z_en_sb.c @@ -361,7 +361,7 @@ void EnSb_UpdateDamage(EnSb* this, GlobalContext* globalCtx) { void EnSb_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnSb* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->isDead) { if (this->actor.yDistToWater > 0.0f) { diff --git a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c index 619827776c..3901c8b247 100644 --- a/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c +++ b/src/overlays/actors/ovl_En_Sellnuts/z_en_sellnuts.c @@ -233,7 +233,7 @@ Actor* func_80ADB040(GlobalContext* globalCtx) { f32 func_80ADB08C(GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* sp18 = func_80ADB040(globalCtx); if (sp18 != NULL) { @@ -346,7 +346,7 @@ void func_80ADB4F4(EnSellnuts* this, GlobalContext* globalCtx) { } void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x7D0, 0); this->actor.world.rot.y = this->actor.shape.rot.y; @@ -425,7 +425,7 @@ void func_80ADB544(EnSellnuts* this, GlobalContext* globalCtx) { } void func_80ADB924(EnSellnuts* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u8 temp_v0 = func_80152498(&globalCtx->msgCtx); s32 temp_v0_2; @@ -704,7 +704,7 @@ void func_80ADC580(EnSellnuts* this, GlobalContext* globalCtx) { } void func_80ADC5A4(EnSellnuts* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_800B84D0(&this->actor, globalCtx)) { player->linearVelocity = 0.0f; @@ -727,7 +727,7 @@ void func_80ADC5A4(EnSellnuts* this, GlobalContext* globalCtx) { } void func_80ADC6D0(EnSellnuts* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((func_80152498(&globalCtx->msgCtx) == 5) && func_80147624(globalCtx)) { globalCtx->msgCtx.unk11F22 = 0x43; @@ -954,7 +954,7 @@ f32 func_80ADCFE8(Path* path, s32 arg1, Vec3f* pos, Vec3s* arg3) { void EnSellnuts_Init(Actor* thisx, GlobalContext* globalCtx) { EnSellnuts* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad2; if ((gSaveContext.weekEventReg[17] & 0x80) || (gSaveContext.weekEventReg[61] & 0x10)) { @@ -1040,7 +1040,7 @@ void EnSellnuts_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnSellnuts_Update(Actor* thisx, GlobalContext* globalCtx) { EnSellnuts* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_328++; if (player->transformation == PLAYER_FORM_DEKU) { diff --git a/src/overlays/actors/ovl_En_Skb/z_en_skb.c b/src/overlays/actors/ovl_En_Skb/z_en_skb.c index bb21a4e573..91efc860c2 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -870,7 +870,7 @@ s32 func_80996594(EnSkb* this, GlobalContext* globalCtx) { void func_8099672C(EnSkb* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->unk_3DE != 6) && (this->unk_3DE != 7)) { if ((this->actor.bgCheckFlags & 0x60) && (this->actor.yDistToWater >= 40.0f)) { diff --git a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c index 6473c327a2..8d501627a1 100644 --- a/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c +++ b/src/overlays/actors/ovl_En_Sob1/z_en_sob1.c @@ -195,7 +195,7 @@ s32 EnSob1_TestItemSelected(GlobalContext* globalCtx) { } u16 EnSob1_GetTalkOption(EnSob1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->shopType == BOMB_SHOP) { if (gSaveContext.day == 1 && gSaveContext.time >= CLOCK_TIME(6, 00)) { @@ -231,7 +231,7 @@ u16 EnSob1_GetTalkOption(EnSob1* this, GlobalContext* globalCtx) { } u16 EnSob1_GetWelcome(EnSob1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->shopType == BOMB_SHOP) { switch (Player_GetMask(globalCtx)) { @@ -443,7 +443,7 @@ void EnSob1_UpdateCursorPos(GlobalContext* globalCtx, EnSob1* this) { } void EnSob1_EndInteraction(GlobalContext* globalCtx, EnSob1* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); @@ -522,7 +522,7 @@ void EnSob1_EndingInteraction(EnSob1* this, GlobalContext* globalCtx) { } void EnSob1_SetupWalk(EnSob1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->actor.world.pos.x >= 0.0f && player->actor.world.pos.x <= 390.0f) && (player->actor.world.pos.z >= 72.0f && player->actor.world.pos.z <= 365.0f)) { @@ -531,7 +531,7 @@ void EnSob1_SetupWalk(EnSob1* this, GlobalContext* globalCtx) { } void EnSob1_Idle(EnSob1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->headRotTarget = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if (func_800B84D0(&this->actor, globalCtx)) { @@ -782,7 +782,7 @@ void EnSob1_Walk(EnSob1* this, GlobalContext* globalCtx) { } void EnSob1_Walking(EnSob1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_WAITING) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -816,7 +816,7 @@ void EnSob1_Walking(EnSob1* this, GlobalContext* globalCtx) { } void EnSob1_ItemPurchased(EnSob1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->cutsceneState == ENSOB1_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -938,7 +938,7 @@ void EnSob1_BrowseShelf(EnSob1* this, GlobalContext* globalCtx) { } void EnSob1_SetupBuyItemWithFanfare(GlobalContext* globalCtx, EnSob1* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_800B8A1C(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); globalCtx->msgCtx.unk11F22 = 0x43; @@ -1096,7 +1096,7 @@ void EnSob1_SetupItemPurchased(EnSob1* this, GlobalContext* globalCtx) { } void EnSob1_ContinueShopping(EnSob1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnGirlA* item; if ((func_80152498(&globalCtx->msgCtx) == 5) && (func_80147624(globalCtx))) { diff --git a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c index eb7f9910a4..ec18b9bd28 100644 --- a/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c +++ b/src/overlays/actors/ovl_En_Suttari/z_en_suttari.c @@ -331,7 +331,7 @@ void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) { case 0: if (gSaveContext.weekEventReg[0x51] & 1) { this->textId = 0x1455; - ((EnElf*)PLAYER->tatlActor)->unk264 |= 8; + ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk264 |= 8; this->flags2 |= 1; } else { this->textId = 0x1450; @@ -353,7 +353,7 @@ void func_80BAAB78(EnSuttari* this, GlobalContext* globalCtx) { case 0x1453: this->flags1 |= 0x400; gSaveContext.weekEventReg[0x51] |= 1; - ((EnElf*)PLAYER->tatlActor)->unk264 |= 8; + ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk264 |= 8; this->flags2 |= 1; this->textId = 0x1454; break; @@ -484,7 +484,7 @@ void EnSuttari_GetPaths(EnSuttari* this, GlobalContext* globalCtx) { } void func_80BAB4F0(EnSuttari* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp30; if (this->flags1 & 0x80) { @@ -815,7 +815,7 @@ s32 func_80BAC220(EnSuttari* this, GlobalContext* globalCtx) { } void func_80BAC2FC(EnSuttari* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 curFrame = this->skelAnime.animCurrentFrame; s16 frameCount = SkelAnime_GetFrameCount(&sAnimations[this->animationIdx].animation->common); @@ -979,7 +979,7 @@ void func_80BAC6E8(EnSuttari* this, GlobalContext* globalCtx) { } void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->animationIdx == 1 || this->animationIdx == 8) { this->animationIdx = 2; @@ -1006,7 +1006,7 @@ void func_80BACA14(EnSuttari* this, GlobalContext* globalCtx) { } void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 target; this->unk3F2 = this->unk2DE; @@ -1037,7 +1037,7 @@ void func_80BACBB0(EnSuttari* this, GlobalContext* globalCtx) { } void func_80BACD2C(EnSuttari* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk3F2 = this->unk2DE; if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_DEKU) { @@ -1170,7 +1170,7 @@ void func_80BAD2B4(EnSuttari* this, GlobalContext* globalCtx) { void func_80BAD380(EnSuttari* this, GlobalContext* globalCtx) { u8 talkState = func_80152498(&globalCtx->msgCtx); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->stateFlags1 & 0x40) && (globalCtx->msgCtx.unk11F04 != 0x2A31)) { this->flags1 |= 0x8000; @@ -1323,7 +1323,7 @@ void func_80BADA9C(EnSuttari* this, GlobalContext* globalCtx) { } this->flags1 &= ~0x400; if (this->flags2 & 1) { - ((EnElf*)PLAYER->tatlActor)->unk264 |= 0x10; + ((EnElf*)GET_PLAYER(globalCtx)->tatlActor)->unk264 |= 0x10; this->flags2 &= ~1; } globalCtx->msgCtx.unk11F22 = 0x43; @@ -1446,7 +1446,7 @@ void EnSuttari_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnSuttari_Update(Actor* thisx, GlobalContext* globalCtx) { EnSuttari* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actionFunc(this, globalCtx); if ((this->flags1 & 8) && (this->flags2 & 0x10) && (player->stateFlags1 & 0x10000000)) { diff --git a/src/overlays/actors/ovl_En_Sw/z_en_sw.c b/src/overlays/actors/ovl_En_Sw/z_en_sw.c index d49dd3757b..d0a58410c9 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -748,7 +748,7 @@ s32 func_808DA08C(EnSw* this, GlobalContext* globalCtx) { } void func_808DA350(EnSw* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->stateFlags1 & 0x200000) && (this->actor.xyzDistToPlayerSq < 8000.0f)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_STALWALL_LAUGH); diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index b17f6378db..e448721274 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -175,7 +175,7 @@ void EnSyatekiMan_Destroy(Actor* thisx, GlobalContext* globalCtx) { } s32 func_809C6720(GlobalContext* globalCtx, Vec3f arg1) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 sp28; f32 phi_f0; s16 sp22 = Math_Vec3f_Yaw(&player->actor.world.pos, &arg1); @@ -209,7 +209,7 @@ void func_809C6810(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C6848(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_800B84D0(&this->actor, globalCtx)) { u16 sp22; @@ -257,7 +257,7 @@ void func_809C6848(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C6A04(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_80147624(globalCtx)) { if (globalCtx->msgCtx.choiceIndex == 0) { @@ -314,7 +314,7 @@ void func_809C6A04(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C6C2C(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_80147624(globalCtx)) { switch (this->unk_284) { @@ -373,7 +373,7 @@ void func_809C6C2C(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C6E30(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags1 & 0x20) { player->stateFlags1 |= 0x20; @@ -524,7 +524,7 @@ void func_809C72D8(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C7380(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_80147624(globalCtx)) { if (globalCtx->msgCtx.choiceIndex == 0) { @@ -587,7 +587,7 @@ void func_809C7380(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_80147624(globalCtx)) { switch (this->unk_284) { @@ -707,7 +707,7 @@ void func_809C7620(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C7990(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags1 & 0x20) { player->stateFlags1 |= 0x20; @@ -749,7 +749,7 @@ void func_809C7990(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C7A90(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Actor_HasParent(&this->actor, globalCtx)) { if (!(gSaveContext.weekEventReg[59] & 0x10)) { @@ -778,7 +778,7 @@ void func_809C7A90(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C7C14(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_800B84D0(&this->actor, globalCtx)) { if ((CURRENT_DAY == 3) && (gSaveContext.time > CLOCK_TIME(12, 00))) { @@ -799,7 +799,7 @@ void func_809C7C14(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C7D14(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Actor_HasParent(&this->actor, globalCtx)) { if (this->unk_284 == 0x407) { @@ -836,7 +836,7 @@ void func_809C7D14(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C7EB4(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (CURRENT_DAY != 3) { if ((func_80152498(&globalCtx->msgCtx) == 6) && func_80147624(globalCtx)) { @@ -861,7 +861,7 @@ void func_809C7EB4(EnSyatekiMan* this, GlobalContext* globalCtx) { } void func_809C7FFC(EnSyatekiMan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_809C6720(globalCtx, D_809C9474)) { player->stateFlags1 |= 0x20; @@ -880,7 +880,7 @@ void func_809C7FFC(EnSyatekiMan* this, GlobalContext* globalCtx) { void func_809C80C0(EnSyatekiMan* this, GlobalContext* globalCtx) { static s16 D_809C9498 = 30; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (D_809C9498 > 0) { player->actor.world.pos = D_809C9474; @@ -910,7 +910,7 @@ void func_809C80C0(EnSyatekiMan* this, GlobalContext* globalCtx) { void func_809C81D0(EnSyatekiMan* this, GlobalContext* globalCtx) { static s16 D_809C949C = 0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (((this->unk_272 == 0) || (this->unk_26C > 140)) && (D_809C949C == 0) && (this->unk_27C < 4)) { D_809C949C = 1; @@ -1020,7 +1020,7 @@ void func_809C8488(EnSyatekiMan* this, GlobalContext* globalCtx) { void func_809C8610(EnSyatekiMan* this, GlobalContext* globalCtx) { static s32 D_809C94A0 = 0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->stateFlags1 |= 0x20; if (globalCtx->interfaceCtx.unk_286 == 0) { @@ -1067,7 +1067,7 @@ void func_809C8710(EnSyatekiMan* this, GlobalContext* globalCtx) { void func_809C8808(EnSyatekiMan* this, GlobalContext* globalCtx) { static s16 D_809C94A4 = 30; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (D_809C94A4 == 30) { if (player->transformation == PLAYER_FORM_FIERCE_DEITY) { @@ -1104,7 +1104,7 @@ void func_809C898C(EnSyatekiMan* this, GlobalContext* globalCtx) { 0x00026984, 0x00012852, 0x00011999, 0x00022895, 0x0000056A, 0x0002A451, 0x00004115, }; static s32 D_809C94A8 = 0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 sp30; s32 pad; u64 sp20; diff --git a/src/overlays/actors/ovl_En_Test4/z_en_test4.c b/src/overlays/actors/ovl_En_Test4/z_en_test4.c index 1abbd96170..f5f460141f 100644 --- a/src/overlays/actors/ovl_En_Test4/z_en_test4.c +++ b/src/overlays/actors/ovl_En_Test4/z_en_test4.c @@ -292,7 +292,7 @@ void func_80A425E4(EnTest4* this, GlobalContext* globalCtx) { void EnTest4_Init(Actor* thisx, GlobalContext* globalCtx) { s32 dayTemp; EnTest4* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s8 temp_v0 = this->actor.cutscene; sCutscenes[0] = temp_v0; @@ -371,7 +371,7 @@ void EnTest4_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_80A42AB8(EnTest4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((globalCtx->unk_18B4A == 0) && (func_801690CC(globalCtx) == 0) && (globalCtx->numSetupActors <= 0) && (globalCtx->roomCtx.unk31 == 0) && (func_8016A168() == 0)) { @@ -496,7 +496,7 @@ void func_80A42F20(EnTest4* this, GlobalContext* globalCtx) { } } if (this->transitionCsTimer == 60) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); gSaveContext.time += CLOCK_TIME_MINUTE; this->unk_146 = gSaveContext.time; @@ -568,7 +568,7 @@ void func_80A4323C(EnTest4* this, GlobalContext* globalCtx) { void EnTest4_Update(Actor* thisx, GlobalContext* globalCtx) { EnTest4* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(player->stateFlags1 & 2)) { this->actionFunc(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c index d0a7b94986..d98657a296 100644 --- a/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c +++ b/src/overlays/actors/ovl_En_Thiefbird/z_en_thiefbird.c @@ -311,7 +311,7 @@ void func_80C10DE8(s32 items[], s32 count, s32 item) { } s32 func_80C10E98(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 phi_s0_2; s32 phi_s2; s32 spB0; @@ -419,7 +419,7 @@ s32 func_80C10E98(GlobalContext* globalCtx) { } void func_80C11338(EnThiefbird* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnItem00* item = NULL; f32 phi_f20 = 5000.0f; s32 i; @@ -478,7 +478,7 @@ void func_80C11538(EnThiefbird* this) { } void func_80C11590(EnThiefbird* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 sp38; SkelAnime_FrameUpdateMatrix(&this->skelAnime); @@ -542,7 +542,7 @@ void func_80C118E4(EnThiefbird* this) { } void func_80C1193C(EnThiefbird* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 pitch; SkelAnime_FrameUpdateMatrix(&this->skelAnime); @@ -858,7 +858,7 @@ void func_80C12744(EnThiefbird* this) { } void func_80C127F4(EnThiefbird* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_v0; f32 temp_f0; 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 07f6cfce2f..d15af55175 100644 --- a/src/overlays/actors/ovl_En_Toto/z_en_toto.c +++ b/src/overlays/actors/ovl_En_Toto/z_en_toto.c @@ -250,7 +250,7 @@ s32 func_80BA397C(EnToto* this, s16 arg1) { } void func_80BA39C8(EnToto* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_80BA383C(this, globalCtx); if (func_800B84D0(&this->actor, globalCtx) != 0) { @@ -343,7 +343,7 @@ void func_80BA3DBC(EnToto* this, GlobalContext* globalCtx) { return; } } else { - player = PLAYER; + player = GET_PLAYER(globalCtx); if (player->stateFlags1 & 0x400 && player->unk_AE7 != 0) { func_80151BB4(globalCtx, 48); func_80151BB4(globalCtx, 9); @@ -410,7 +410,7 @@ s32 func_80BA402C(EnToto* this, GlobalContext* globalCtx) { s32 func_80BA407C(EnToto* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { - ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &PLAYER->actor); + ActorCutscene_StartAndSetUnkLinkFields(this->cutscene, &GET_PLAYER(globalCtx)->actor); return 1; } @@ -458,7 +458,7 @@ s32 func_80BA4204(EnToto* this, GlobalContext* globalCtx) { } s32 func_80BA42BC(EnToto* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u32 phi_s0 = 0; Vec3s* end = &D_80BA510C[3]; @@ -514,7 +514,7 @@ s32 func_80BA44D4(EnTotoUnkStruct2* arg0, Player* player) { } s32 func_80BA4530(EnToto* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnTotoUnkStruct2* temp_s0; s32 i; u16 tmp; @@ -622,7 +622,7 @@ s32 func_80BA4A00(EnToto* this, GlobalContext* globalCtx) { if (DECR(this->unk2B1) == 0) { if (!func_801A2DE0(0x54)) { - actor = (Actor*)PLAYER; // Needed for regalloc, possible FAKE MATCH + actor = (Actor*)GET_PLAYER(globalCtx); // Needed for regalloc, possible FAKE MATCH actor = actor->next; while (actor != NULL) { Actor_MarkForDeath(actor); @@ -651,7 +651,7 @@ s32 func_80BA4B24(EnToto* this, GlobalContext* globalCtx) { Player* player; if (func_80BA40D4(this, globalCtx)) { - player = PLAYER; + player = GET_PLAYER(globalCtx); SkelAnime_ChangeAnimTransitionStop(&this->skelAnime, &D_060028B8, -4.0f); if (player->transformation == PLAYER_FORM_ZORA) { if (!Flags_GetSwitch(globalCtx, this->actor.params & 0x7F)) { diff --git a/src/overlays/actors/ovl_En_Trt/z_en_trt.c b/src/overlays/actors/ovl_En_Trt/z_en_trt.c index dde048caf9..06fe1bfd49 100644 --- a/src/overlays/actors/ovl_En_Trt/z_en_trt.c +++ b/src/overlays/actors/ovl_En_Trt/z_en_trt.c @@ -207,7 +207,7 @@ u16 EnTrt_GetItemChoiceTextId(EnTrt* this) { } void EnTrt_EndInteraction(GlobalContext* globalCtx, EnTrt* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->cutsceneState == ENTRT_CUTSCENESTATE_PLAYING) { ActorCutscene_Stop(this->cutscene); @@ -332,7 +332,7 @@ void EnTrt_Hello(EnTrt* this, GlobalContext* globalCtx) { void EnTrt_GetMushroom(EnTrt* this, GlobalContext* globalCtx) { u8 talkState = func_80152498(&globalCtx->msgCtx); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->tmpGetMushroomCutscene = this->getMushroomCutscene; if (this->cutsceneState != ENTRT_CUTSCENESTATE_PLAYING_SPECIAL) { @@ -346,7 +346,7 @@ void EnTrt_GetMushroom(EnTrt* this, GlobalContext* globalCtx) { this->textId = 0x884; func_801518B0(globalCtx, this->textId, &this->actor); gSaveContext.weekEventReg[0x35] |= 8; - func_80123D50(globalCtx, PLAYER, 18, 21); + func_80123D50(globalCtx, GET_PLAYER(globalCtx), 18, 21); break; case 0x888: this->textId = 0x889; @@ -372,7 +372,7 @@ void EnTrt_GetMushroom(EnTrt* this, GlobalContext* globalCtx) { void EnTrt_PayForMushroom(EnTrt* this, GlobalContext* globalCtx) { if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; - func_80123D50(globalCtx, PLAYER, 18, 21); + func_80123D50(globalCtx, GET_PLAYER(globalCtx), 18, 21); this->actionFunc = EnTrt_SetupItemGiven; } else { func_800B8A1C(&this->actor, globalCtx, GI_RUPEE_RED, 300.0f, 300.0f); @@ -439,7 +439,7 @@ void EnTrt_SetupTryToGiveRedPotion(EnTrt* this, GlobalContext* globalCtx) { } void EnTrt_GiveRedPotionForKoume(EnTrt* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Actor_HasParent(&this->actor, globalCtx)) { this->actor.parent = NULL; @@ -644,7 +644,7 @@ void EnTrt_BrowseShelf(EnTrt* this, GlobalContext* globalCtx) { } void EnTrt_SetupBuyItemWithFanfare(GlobalContext* globalCtx, EnTrt* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_800B8A1C(&this->actor, globalCtx, this->items[this->cursorIdx]->getItemId, 300.0f, 300.0f); globalCtx->msgCtx.unk11F22 = 0x43; @@ -749,7 +749,7 @@ void EnTrt_SelectItem(EnTrt* this, GlobalContext* globalCtx) { } void EnTrt_IdleSleeping(EnTrt* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((gSaveContext.weekEventReg[0x55] & 8) && !(gSaveContext.weekEventReg[0x54] & 0x40)) { this->textId = 0x88F; @@ -806,7 +806,7 @@ void EnTrt_IdleSleeping(EnTrt* this, GlobalContext* globalCtx) { } void EnTrt_IdleAwake(EnTrt* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->flags &= ~ENTRT_FULLY_AWAKE; if (player->transformation == PLAYER_FORM_HUMAN || player->transformation == PLAYER_FORM_FIERCE_DEITY) { @@ -983,7 +983,7 @@ void EnTrt_TryToGiveRedPotion(EnTrt* this, GlobalContext* globalCtx) { } void EnTrt_ItemGiven(EnTrt* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->cutsceneState == ENTRT_CUTSCENESTATE_STOPPED) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { @@ -1032,7 +1032,7 @@ void EnTrt_SetupEndInteraction(EnTrt* this, GlobalContext* globalCtx) { void EnTrt_ShopkeeperGone(EnTrt* this, GlobalContext* globalCtx) { u8 talkState = func_80152498(&globalCtx->msgCtx); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_800B84D0(&this->actor, globalCtx)) { func_801518B0(globalCtx, this->textId, &this->actor); @@ -1099,7 +1099,7 @@ void EnTrt_SetupItemGiven(EnTrt* this, GlobalContext* globalCtx) { void EnTrt_ContinueShopping(EnTrt* this, GlobalContext* globalCtx) { u8 talkState = func_80152498(&globalCtx->msgCtx); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnGirlA* item; if (talkState == 4) { @@ -1369,7 +1369,7 @@ void EnTrt_OpenEyesThenSetToBlink(EnTrt* this) { void EnTrt_TalkToShopkeeper(EnTrt* this, GlobalContext* globalCtx) { u8 talkState = talkState = func_80152498(&globalCtx->msgCtx); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 itemGiven; if (talkState == 5) { @@ -1696,7 +1696,7 @@ void EnTrt_Update(Actor* thisx, GlobalContext* globalCtx) { } void EnTrt_UpdateHeadYawAndPitch(EnTrt* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f playerPos; Vec3f pos; 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 df8a039e77..06ef6ef3f9 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 @@ -163,8 +163,8 @@ void EnTuboTrap_SpawnEffectsInWater(EnTuboTrap* this, GlobalContext* globalCtx) } void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { - Player* player = PLAYER; - Player* player2 = PLAYER; + Player* player = GET_PLAYER(globalCtx); + Player* player2 = GET_PLAYER(globalCtx); if ((this->actor.bgCheckFlags & 0x20) && (this->actor.yDistToWater > 15.0f)) { EnTuboTrap_SpawnEffectsInWater(this, globalCtx); @@ -219,7 +219,7 @@ void EnTuboTrap_Idle(EnTuboTrap* this, GlobalContext* globalCtx) { static s8 sTransformationHeight[] = { 40, 40, 40, 25, 28, }; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 currentHeight; f32 transformationHeight; s16 startingRotation; 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 56b4e11433..dc8ea9ad14 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 @@ -95,7 +95,7 @@ void func_80A66278(EnWarpUzu* this, GlobalContext* globalCtx) { s16 phi_v1; do { - player = PLAYER; + player = GET_PLAYER(globalCtx); if (func_800B84D0(&this->actor, globalCtx)) { func_80A66384(this, globalCtx); } else { 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 4db53de3ca..401bf50b24 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 @@ -110,7 +110,7 @@ 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) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u8 returnVal = 0; if (WEATHER_TAG_RANGE100(this) > Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { @@ -140,7 +140,7 @@ 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) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u8 returnVal = 0; if (WEATHER_TAG_RANGE100(this) < Actor_XZDistanceBetweenActors(&player->actor, &this->actor)) { @@ -166,7 +166,7 @@ u8 func_80966758(EnWeatherTag* this, GlobalContext* globalCtx, UNK_TYPE a3, UNK_ // modify wind? void func_8096689C(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 distance; f32 partialResult; @@ -410,13 +410,14 @@ void EnWeatherTag_Unused_80967250(EnWeatherTag* this, GlobalContext* globalCtx) // WEATHERTAG_TYPE_WATERMURK: (pinnacle rock, zora cape, zora coast) void func_809672DC(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; f32 distance; f32 range; f32 strength = 0.0f; - func_800BCCDC(this->pathPoints, this->pathCount, &PLAYER->actor.world.pos, &this->actor.world.pos, 0); + func_800BCCDC(this->pathPoints, this->pathCount, &GET_PLAYER(globalCtx)->actor.world.pos, &this->actor.world.pos, + 0); distance = Actor_XZDistanceBetweenActors(&player->actor, &this->actor); range = WEATHER_TAG_RANGE100(this); @@ -441,7 +442,7 @@ 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) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Actor_XZDistanceBetweenActors(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this)) { if (CURRENT_DAY == 2) { @@ -465,7 +466,8 @@ 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->actor, &this->actor)) { + if ((WEATHER_TAG_RANGE100(this) + 10.0f) < + Actor_XZDistanceBetweenActors(&GET_PLAYER(globalCtx)->actor, &this->actor)) { D_801BDBB0 = 0; EnWeatherTag_SetupAction(this, func_809674C8); } diff --git a/src/overlays/actors/ovl_En_Zot/z_en_zot.c b/src/overlays/actors/ovl_En_Zot/z_en_zot.c index b49ccaef12..24ca09489c 100644 --- a/src/overlays/actors/ovl_En_Zot/z_en_zot.c +++ b/src/overlays/actors/ovl_En_Zot/z_en_zot.c @@ -552,7 +552,7 @@ void func_80B9765C(EnZot* this, GlobalContext* globalCtx) { } void func_80B97708(EnZot* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 phi_v1; func_80B96D4C(this); @@ -961,7 +961,7 @@ void func_80B9854C(EnZot* this, GlobalContext* globalCtx) { void func_80B985EC(EnZot* this, GlobalContext* globalCtx) { s32 temp_v0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_80B98348(this, globalCtx); if (func_80152498(&globalCtx->msgCtx) == 0x10) { 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 0fba2130ce..0d5a2c1b94 100644 --- a/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c +++ b/src/overlays/actors/ovl_Obj_Boyo/z_obj_boyo.c @@ -104,7 +104,7 @@ Actor* ObjBoyo_GetCollidedActor(ObjBoyo* this, GlobalContext* globalCtx, s32* nu if (this->collider.base.ocFlags2 & OC2_HIT_PLAYER) { *num = 0; - return &PLAYER->actor; + return &GET_PLAYER(globalCtx)->actor; } if (this->collider.base.ocFlags1 & OC2_UNK1) { diff --git a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c index b5272432e5..4a74a3c80c 100644 --- a/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c +++ b/src/overlays/actors/ovl_Obj_Etcetera/z_obj_etcetera.c @@ -128,7 +128,7 @@ void ObjEtcetera_StartSmallFlutterAnimation(ObjEtcetera* this) { void ObjEtcetera_Idle(ObjEtcetera* this, GlobalContext* globalCtx) { s16 minOscillationTimer; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->stateFlags3 & 0x200) && (this->dyna.actor.xzDistToPlayer < 20.0f)) { // Player is launching out of the Deku Flower diff --git a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c index a1c51e097e..04f4635a67 100644 --- a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c +++ b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c @@ -30,7 +30,7 @@ void ObjFunen_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx); func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_RotateY((s16)(func_800DFCDC(ACTIVE_CAM) - 0x8000), 1); + Matrix_RotateY((s16)(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) - 0x8000), 1); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); 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 e2a6b9c8bf..7a20bab743 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) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 distDiff = this->dyna.actor.yawTowardsPlayer - this->dyna.actor.shape.rot.y; if (func_800B84D0(&this->dyna.actor, globalCtx)) { @@ -129,7 +129,7 @@ void func_80B3C4E0(ObjGhaka* this, GlobalContext* globalCtx) { } void func_80B3C624(ObjGhaka* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u8 stepTemp = Math_StepToS(&this->unk_168, 0x64, 1); this->dyna.actor.world.pos.z = this->dyna.actor.home.pos.z + this->unk_168; 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 9d6fc0a548..3fc376dc46 100644 --- a/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c +++ b/src/overlays/actors/ovl_Obj_Kibako/z_obj_kibako.c @@ -120,7 +120,7 @@ void func_80926318(ObjKibako* this, GlobalContext* globalCtx) { s32 pad; if (this->actor.xzDistToPlayer < 100.0f) { - angle = this->actor.yawTowardsPlayer - PLAYER->actor.world.rot.y; + angle = this->actor.yawTowardsPlayer - GET_PLAYER(globalCtx)->actor.world.rot.y; if (ABS_ALT(angle) >= 0x5556) { func_800B8A1C(&this->actor, globalCtx, 0, 36.0f, 30.0f); } 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 227c2b79c5..3a803bc618 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,7 +74,7 @@ void func_80C0662C(ObjMoonStone* this) { } void func_80C06640(ObjMoonStone* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 sp1A = this->actor.yawTowardsPlayer - 0x8000; sp1A -= player->actor.shape.rot.y; @@ -140,7 +140,7 @@ void func_80C06870(ObjMoonStone* this, GlobalContext* globalCtx) { void ObjMoonStone_Update(Actor* thisx, GlobalContext* globalCtx) { ObjMoonStone* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->stateFlags1 & 0x10000282) == 0) { this->actionFunc(this, globalCtx); diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index 997270a6b8..597d470334 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -169,7 +169,7 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { } else { s32 interaction = OBJ_SYOKUDAI_INTERACTION_NONE; u32 flameColliderHurtboxDmgFlags = 0; - player = PLAYER; + player = GET_PLAYER(globalCtx); if (OBJ_SYOKUDAI_GET_START_LIT(thisx)) { this->snuffTimer = OBJ_SYOKUDAI_SNUFF_NEVER; @@ -311,7 +311,7 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); SysMatrix_InsertTranslation(0.0f, OBJ_SYOKUDAI_FLAME_HEIGHT, 0.0f, MTXMODE_APPLY); - Matrix_RotateY(BINANG_ROT180(func_800DFCDC(ACTIVE_CAM) - thisx->shape.rot.y), MTXMODE_APPLY); + Matrix_RotateY(BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) - thisx->shape.rot.y), MTXMODE_APPLY); Matrix_Scale(flameScale, flameScale, flameScale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, D_0407D590); diff --git a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c index 7df2a0ecbd..f6b0da869b 100644 --- a/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c +++ b/src/overlays/actors/ovl_Obj_Tokei_Step/z_obj_tokei_step.c @@ -66,7 +66,7 @@ void ObjTokeiStep_AddQuake(ObjTokeiStep* this, GlobalContext* globalCtx) { s32 pad[2]; s16 quake; - quake = Quake_Add(ACTIVE_CAM, 3); + quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quake, 0x4E20); Quake_SetQuakeValues(quake, 1, 0, 0, 0); Quake_SetCountdown(quake, 7);