diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md index 46ace1d6ee..e07b603c27 100644 --- a/docs/tutorial/other_functions.md +++ b/docs/tutorial/other_functions.md @@ -294,14 +294,14 @@ extern Vec3f D_80A88CF0; ``` (you must include the `.0f` parts even for integer floats: it can affect codegen, and as such it is part of our style). -- replace the mysterious `globalCtx->unk1C44 + 0x24`. The first part is so common that most people on decomp know it by heart: it is the location of the Player actor. `+ 0x24` is obviously an offset that leats to a `Vec3f`, and if you look in the actor struct, you find that this is the location of `world.pos`. To use `Player`, we put `Player* player = PLAYER` at the top of the function. +- replace the mysterious `globalCtx->unk1C44 + 0x24`. The first part is so common that most people on decomp know it by heart: it is the location of the Player actor. `+ 0x24` is obviously an offset that leats to a `Vec3f`, and if you look in the actor struct, you find that this is the location of `world.pos`. To use `Player`, we put `Player* player = GET_PLAYER(globalCtx)` at the top of the function. **NOTE:** mips_to_c will now output something like `&globalCtx->actorCtx.actorLists[2].head` for the Player pointer instead: this makes a lot more sense, but is not so easy to spot in the ASM without the characteristic `1C44`. After all this, the function becomes ```C void func_80A87C30(EnJj *this, GlobalContext *globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && (globalCtx->isPlayerDroppingFish(globalCtx) != 0)) { this->unk_30C = 100; @@ -344,7 +344,7 @@ typedef struct EnJj { The diff now looks fine for this function, but it gives compiler warnings about `CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider);`: the last argument is the wrong type: we need to give it `&this->collider.base` instead, which points to the same address, but is the right type. So the matching function is ```C void func_80A87C30(EnJj *this, GlobalContext *globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((Math_Vec3f_DistXZ(&D_80A88CF0, &player->actor.world.pos) < 300.0f) && (globalCtx->isPlayerDroppingFish(globalCtx) != 0)) { this->unk_30C = 100; @@ -394,9 +394,9 @@ Easy things to sort out: - We can remove the casts from `(u8)1U` and just leave `1`. -- `globalCtx->cameraPtrs[globalCtx->activeCamera]` has a macro: it is `ACTIVE_CAM`, so this line can be written as +- `globalCtx->cameraPtrs[globalCtx->activeCamera]` has a macro: it is `GET_ACTIVE_CAM(globalCtx)`, so this line can be written as ```C -func_8005B1A4(ACTIVE_CAM); +func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); ``` - `gSaveContext.unkEDA` we have dealt with before: it is `gSaveContext.eventChkInf[3]`. This is a flag-setting function; it can be written more compactly as @@ -418,7 +418,7 @@ void func_80A87CEC(EnJj *this, GlobalContext *globalCtx) { globalCtx->csCtx.segment = &D_80A88164; gSaveContext.cutsceneTrigger = 1; func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, child->bgId); - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); gSaveContext.eventChkInf[3] |= 0x400; func_80078884(NA_SE_SY_CORRECT_CHIME); } @@ -437,7 +437,7 @@ void func_80A87CEC(EnJj* this, GlobalContext* globalCtx) { globalCtx->csCtx.segment = &D_80A88164; gSaveContext.cutsceneTrigger = 1; func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, child->bgId); - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); gSaveContext.eventChkInf[3] |= 0x400; func_80078884(NA_SE_SY_CORRECT_CHIME); } @@ -827,4 +827,4 @@ void func_80A87D94(EnJj* this, GlobalContext* globalCtx) { With that, the last remaining function is `EnJj_Draw`. Draw functions have an extra layer of macroing that is required, so we shall cover them separately. -Next: [Draw functions](draw_functions.md) \ No newline at end of file +Next: [Draw functions](draw_functions.md) diff --git a/include/macros.h b/include/macros.h index 30a19882df..0b008d10f1 100644 --- a/include/macros.h +++ b/include/macros.h @@ -22,9 +22,9 @@ #define RGBA8(r, g, b, a) (((r & 0xFF) << 24) | ((g & 0xFF) << 16) | ((b & 0xFF) << 8) | ((a & 0xFF) << 0)) -#define PLAYER ((Player*)globalCtx->actorCtx.actorLists[ACTORCAT_PLAYER].head) +#define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorLists[ACTORCAT_PLAYER].head) -#define ACTIVE_CAM globalCtx->cameraPtrs[globalCtx->activeCamera] +#define GET_ACTIVE_CAM(globalCtx) ((globalCtx)->cameraPtrs[(globalCtx)->activeCamera]) #define LINK_IS_ADULT (gSaveContext.linkAge == 0) #define LINK_IS_CHILD (gSaveContext.linkAge == 1) diff --git a/src/code/code_80097A00.c b/src/code/code_80097A00.c index 7481564fcd..f8b8e4e288 100644 --- a/src/code/code_80097A00.c +++ b/src/code/code_80097A00.c @@ -189,7 +189,7 @@ void Inventory_ChangeEquipment(s16 equipment, u16 value) { } u8 Inventory_DeleteEquipment(GlobalContext* globalCtx, s16 equipment) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; u16 sp26 = gSaveContext.equips.equipment & gEquipMasks[equipment]; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 2140efce6b..4ddc2581bc 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -321,7 +321,7 @@ void func_8002C124(TargetContext* targetCtx, GlobalContext* globalCtx) { f32 var2; s32 i; - player = PLAYER; + player = GET_PLAYER(globalCtx); spCE = 0xFF; var1 = 1.0f; @@ -986,19 +986,19 @@ s32 func_8002DD78(Player* player) { } s32 func_8002DDA8(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); return (player->stateFlags1 & 0x800) || func_8002DD78(player); } s32 func_8002DDE4(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); return player->stateFlags2 & 0x8; } s32 func_8002DDF4(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); return player->stateFlags2 & 0x1000; } @@ -1035,7 +1035,7 @@ void func_8002DF18(GlobalContext* globalCtx, Player* player) { } s32 func_8002DF38(GlobalContext* globalCtx, Actor* actor, u8 csMode) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->csMode = csMode; player->unk_448 = actor; @@ -1045,7 +1045,7 @@ s32 func_8002DF38(GlobalContext* globalCtx, Actor* actor, u8 csMode) { } s32 func_8002DF54(GlobalContext* globalCtx, Actor* actor, u8 csMode) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_8002DF38(globalCtx, actor, csMode); player->unk_46A = 1; @@ -1068,7 +1068,7 @@ void func_8002DFA4(DynaPolyActor* dynaActor, f32 arg1, s16 arg2) { * The maximum angle difference that qualifies as "facing" is specified by `maxAngle`. */ s32 Player_IsFacingActor(Actor* actor, s16 maxAngle, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawDiff = (s16)(actor->yawTowardsPlayer + 0x8000) - player->actor.shape.rot.y; if (ABS(yawDiff) < maxAngle) { @@ -1515,7 +1515,7 @@ u32 func_8002F194(Actor* actor, GlobalContext* globalCtx) { } s32 func_8002F1C4(Actor* actor, GlobalContext* globalCtx, f32 arg2, f32 arg3, u32 exchangeItemId) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); // This is convoluted but it seems like it must be a single if statement to match if ((player->actor.flags & 0x100) || ((exchangeItemId != EXCH_ITEM_NONE) && Player_InCsMode(globalCtx)) || @@ -1555,7 +1555,7 @@ u32 func_8002F334(Actor* actor, GlobalContext* globalCtx) { } s8 func_8002F368(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); return player->exchangeItemId; } @@ -1578,7 +1578,7 @@ u32 Actor_HasParent(Actor* actor, GlobalContext* globalCtx) { } s32 func_8002F434(Actor* actor, GlobalContext* globalCtx, s32 getItemId, f32 xzRange, f32 yRange) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(player->stateFlags1 & 0x3C7080) && Player_GetExplosiveHeld(player) < 0) { if ((((player->heldActor != NULL) || (actor == player->targetActor)) && (getItemId > GI_NONE) && @@ -1633,7 +1633,7 @@ void func_8002F5C4(Actor* actorA, Actor* actorB, GlobalContext* globalCtx) { } void func_8002F5F0(Actor* actor, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (actor->xyzDistToPlayerSq < player->unk_6A4) { player->unk_6A4 = actor->xyzDistToPlayerSq; @@ -1649,7 +1649,7 @@ s32 Actor_IsMounted(GlobalContext* globalCtx, Actor* horse) { } u32 Actor_SetRideActor(GlobalContext* globalCtx, Actor* horse, s32 mountSide) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(player->stateFlags1 & 0x003C7880)) { player->rideActor = horse; @@ -1669,7 +1669,7 @@ s32 Actor_NotMounted(GlobalContext* globalCtx, Actor* horse) { } void func_8002F698(GlobalContext* globalCtx, Actor* actor, f32 arg2, s16 arg3, f32 arg4, u32 arg5, u32 arg6) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->unk_8A0 = arg6; player->unk_8A1 = arg5; @@ -2027,7 +2027,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { ActorEntry* actorEntry; s32 i; - player = PLAYER; + player = GET_PLAYER(globalCtx); if (0) { // This ASSERT is optimized out but it exists due to its presence in rodata @@ -2050,7 +2050,7 @@ void Actor_UpdateAll(GlobalContext* globalCtx, ActorContext* actorCtx) { } if (KREG(0) == -100) { - refActor = &PLAYER->actor; + refActor = &GET_PLAYER(globalCtx)->actor; KREG(0) = 0; Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_CLEAR_TAG, refActor->world.pos.x, refActor->world.pos.y + 100.0f, refActor->world.pos.z, 0, 0, 0, 1); @@ -2856,7 +2856,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC Actor* newHead; ActorOverlay* overlayEntry; - player = PLAYER; + player = GET_PLAYER(globalCtx); overlayEntry = actor->overlayEntry; name = overlayEntry->name != NULL ? overlayEntry->name : ""; @@ -3425,7 +3425,7 @@ s16 Actor_TestFloorInDirection(Actor* actor, GlobalContext* globalCtx, f32 dista * Returns true if the player is targeting the provided actor */ s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->stateFlags1 & 0x10) && actor->isTargeted) { return true; @@ -3438,7 +3438,7 @@ s32 Actor_IsTargeted(GlobalContext* globalCtx, Actor* actor) { * Returns true if the player is targeting an actor other than the provided actor */ s32 Actor_OtherIsTargeted(GlobalContext* globalCtx, Actor* actor) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->stateFlags1 & 0x10) && !actor->isTargeted) { return true; @@ -3870,7 +3870,7 @@ void func_80034CC4(GlobalContext* globalCtx, SkelAnime* skelAnime, OverrideLimbD } s16 func_80034DD4(Actor* actor, GlobalContext* globalCtx, s16 arg2, f32 arg3) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 var; if ((globalCtx->csCtx.state != CS_STATE_IDLE) || (gDbgCamEnabled)) { @@ -3951,7 +3951,7 @@ s32 func_80035124(Actor* actor, GlobalContext* globalCtx) { #include "z_cheap_proc.c" u8 func_800353E8(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); return player->unk_845; } @@ -3980,7 +3980,7 @@ Actor* Actor_FindNearby(GlobalContext* globalCtx, Actor* refActor, s16 actorId, } s32 func_800354B4(GlobalContext* globalCtx, Actor* actor, f32 range, s16 arg3, s16 arg4, s16 arg5) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 var1; s16 var2; @@ -4025,7 +4025,7 @@ void func_800355B8(GlobalContext* globalCtx, Vec3f* arg1) { } u8 func_800355E4(GlobalContext* globalCtx, Collider* collider) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((collider->acFlags & AC_TYPE_PLAYER) && (player->swordState != 0) && (player->swordAnimation == 0x16)) { return true; @@ -5510,7 +5510,7 @@ s32 func_80037FC8(Actor* actor, Vec3f* arg1, Vec3s* arg2, Vec3s* arg3) { } s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, f32 arg4) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; Vec3f sp2C; s16 var; @@ -5540,7 +5540,7 @@ s32 func_80038154(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* ar } s32 func_80038290(GlobalContext* globalCtx, Actor* actor, Vec3s* arg2, Vec3s* arg3, Vec3f arg4) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; Vec3f sp24; s16 var; diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index c8be7361b2..426757f759 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -4493,7 +4493,7 @@ void BgCheck_DrawStaticPolyList(GlobalContext* globalCtx, CollisionContext* colC * Draw scene collision */ void BgCheck_DrawStaticCollision(GlobalContext* globalCtx, CollisionContext* colCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); StaticLookup* lookup = BgCheck_GetNearestStaticLookup(colCtx, colCtx->lookupTbl, &player->actor.world.pos); if (AREG(23) != 0) { diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 5f643a09c1..8eae2f7ac1 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -3463,12 +3463,10 @@ s32 Camera_KeepOn4(Camera* camera) { KeepOn4_Unk20* unk20 = &keep4->unk_20; s32 pad; f32 playerHeight; - Player* player; + Player* player = GET_PLAYER(camera->globalCtx); s16 angleCnt; s32 i; - player = (Player*)camera->globalCtx->actorCtx.actorLists[ACTORCAT_PLAYER].head; - if (camera->animState == 0 || camera->animState == 0xA || camera->animState == 0x14) { if (camera->globalCtx->view.unk_124 == 0) { camera->unk_14C |= 0x20; @@ -7528,7 +7526,7 @@ Vec3s Camera_Update(Camera* camera) { */ void Camera_Finish(Camera* camera) { Camera* mainCam = camera->globalCtx->cameraPtrs[MAIN_CAM]; - Player* player = (Player*)camera->globalCtx->actorCtx.actorLists[ACTORCAT_PLAYER].head; + Player* player = GET_PLAYER(camera->globalCtx); if (camera->timer == 0) { Gameplay_ChangeCameraStatus(camera->globalCtx, camera->parentCamIdx, CAM_STAT_ACTIVE); @@ -8098,7 +8096,7 @@ s16 func_8005B1A4(Camera* camera) { camera->unk_14C |= 0x8; if ((camera->thisIdx == MAIN_CAM) && (camera->globalCtx->activeCamera != MAIN_CAM)) { - camera->globalCtx->cameraPtrs[camera->globalCtx->activeCamera]->unk_14C |= 0x8; + GET_ACTIVE_CAM(camera->globalCtx)->unk_14C |= 0x8; return camera->globalCtx->activeCamera; } diff --git a/src/code/z_collision_check.c b/src/code/z_collision_check.c index 1790f6864d..d5237bb960 100644 --- a/src/code/z_collision_check.c +++ b/src/code/z_collision_check.c @@ -2621,8 +2621,8 @@ void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colChkCt /** * 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* colChkCtx) { Collider** col; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index c28bad4f90..b0dd00118e 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -161,7 +161,7 @@ void func_800647C0(GlobalContext* globalCtx, CutsceneContext* csCtx) { // Command 3: Misc. Actions void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 temp; u8 sp3F; @@ -267,7 +267,7 @@ void func_80064824(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* break; case 16: if (sp3F != 0) { - D_8015FCCA = Quake_Add(ACTIVE_CAM, 6); + D_8015FCCA = Quake_Add(GET_ACTIVE_CAM(globalCtx), 6); Quake_SetSpeed(D_8015FCCA, 0x7FFF); Quake_SetQuakeValues(D_8015FCCA, 4, 0, 1000, 0); Quake_SetCountdown(D_8015FCCA, 800); @@ -440,7 +440,7 @@ void func_80065134(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdDayTim // Command 0x3E8: Code Execution (& Terminates Cutscene?) void Cutscene_Command_Terminator(GlobalContext* globalCtx, CutsceneContext* csCtx, CsCmdBase* cmd) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 temp = 0; if ((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 3) && (globalCtx->sceneNum != SCENE_SPOT00) && @@ -1297,7 +1297,7 @@ s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext* Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE); Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->unk_14)); Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->unk_14), csCtx->cameraFocus, - csCtx->cameraPosition, PLAYER, relativeToLink); + csCtx->cameraPosition, GET_PLAYER(globalCtx), relativeToLink); } } } @@ -1334,7 +1334,7 @@ s32 Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCt Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE); Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->unk_14)); Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->unk_14), csCtx->cameraFocus, - csCtx->cameraPosition, PLAYER, relativeToLink); + csCtx->cameraPosition, GET_PLAYER(globalCtx), relativeToLink); } } } diff --git a/src/code/z_effect_soft_sprite_old_init.c b/src/code/z_effect_soft_sprite_old_init.c index 30390e827e..73c2aba443 100644 --- a/src/code/z_effect_soft_sprite_old_init.c +++ b/src/code/z_effect_soft_sprite_old_init.c @@ -977,7 +977,7 @@ void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f* } 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_elf_message.c b/src/code/z_elf_message.c index eb81dec6dd..f6f3a22f5b 100644 --- a/src/code/z_elf_message.c +++ b/src/code/z_elf_message.c @@ -138,7 +138,7 @@ u16 ElfMessage_GetTextFromMsgs(ElfMessage* msg) { } u16 ElfMessage_GetSariaText(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); ElfMessage* msgs; if (!LINK_IS_ADULT) { diff --git a/src/code/z_en_item00.c b/src/code/z_en_item00.c index 6393c2f436..35fd673871 100644 --- a/src/code/z_en_item00.c +++ b/src/code/z_en_item00.c @@ -688,7 +688,7 @@ void func_8001E304(EnItem00* this, GlobalContext* globalCtx) { } void func_8001E5C8(EnItem00* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->getItemId != GI_NONE) { if (!Actor_HasParent(&this->actor, globalCtx)) { diff --git a/src/code/z_map_exp.c b/src/code/z_map_exp.c index b327e122e6..54ff428e52 100644 --- a/src/code/z_map_exp.c +++ b/src/code/z_map_exp.c @@ -11,7 +11,7 @@ s16 sPlayerInitialDirection = 0; s16 sEntranceIconMapIndex = 0; void Map_SavePlayerInitialInfo(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); sPlayerInitialPosX = player->actor.world.pos.x; sPlayerInitialPosZ = player->actor.world.pos.z; @@ -312,7 +312,7 @@ void Map_Init(GlobalContext* globalCtx) { void Minimap_DrawCompassIcons(GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 tempX, tempZ; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_map_exp.c", 565); @@ -506,7 +506,7 @@ s16 Map_GetFloorTextIndexOffset(s32 mapIndex, s32 floor) { void Map_Update(GlobalContext* globalCtx) { static s16 sLastRoomNum = 99; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 mapIndex = gSaveContext.mapIndex; InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s16 floor; diff --git a/src/code/z_parameter.c b/src/code/z_parameter.c index f2cb1103e6..7fc6abef05 100644 --- a/src/code/z_parameter.c +++ b/src/code/z_parameter.c @@ -598,7 +598,7 @@ void func_80082850(GlobalContext* globalCtx, s16 maxAlpha) { void func_80083108(GlobalContext* globalCtx) { MessageContext* msgCtx = &globalCtx->msgCtx; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; s16 i; s16 sp28 = 0; @@ -2654,7 +2654,7 @@ void Interface_DrawItemButtons(GlobalContext* globalCtx) { static void* cUpLabelTextures[] = { gNaviCUpENGTex, gNaviCUpENGTex, gNaviCUpENGTex }; static s16 startButtonLeftPos[] = { 132, 130, 130 }; InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); PauseContext* pauseCtx = &globalCtx->pauseCtx; s16 temp; // Used as both an alpha value and a button index s16 dxdy; @@ -3018,7 +3018,7 @@ void Interface_Draw(GlobalContext* globalCtx) { InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; PauseContext* pauseCtx = &globalCtx->pauseCtx; MessageContext* msgCtx = &globalCtx->msgCtx; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 svar1; s16 svar2; s16 svar3; @@ -3806,7 +3806,7 @@ void Interface_Update(GlobalContext* globalCtx) { static s16 D_80125B64 = 0; MessageContext* msgCtx = &globalCtx->msgCtx; InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 alpha; s16 alpha1; u16 action; diff --git a/src/code/z_play.c b/src/code/z_play.c index 2fa25e0935..d12eddcec1 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -14,7 +14,7 @@ s16 D_801614C8; u64 D_801614D0[0xA00]; void func_800BC450(GlobalContext* globalCtx) { - Camera_ChangeDataIdx(ACTIVE_CAM, globalCtx->unk_1242B - 1); + Camera_ChangeDataIdx(GET_ACTIVE_CAM(globalCtx), globalCtx->unk_1242B - 1); } void func_800BC490(GlobalContext* globalCtx, s16 point) { @@ -142,7 +142,7 @@ Gfx* func_800BC8A0(GlobalContext* globalCtx, Gfx* gfx) { void Gameplay_Destroy(GameState* thisx) { GlobalContext* globalCtx = (GlobalContext*)thisx; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); globalCtx->state.gfxCtx->callback = NULL; globalCtx->state.gfxCtx->callbackParam = 0; @@ -372,7 +372,7 @@ void Gameplay_Init(GameState* thisx) { ; // Empty Loop } - player = PLAYER; + player = GET_PLAYER(globalCtx); Camera_InitPlayerSettings(&globalCtx->mainCamera, player); Camera_ChangeMode(&globalCtx->mainCamera, CAM_MODE_NORMAL); @@ -394,7 +394,7 @@ void Gameplay_Init(GameState* thisx) { func_800758AC(globalCtx); gSaveContext.seqIndex = globalCtx->soundCtx.seqIndex; gSaveContext.nightSeqIndex = globalCtx->soundCtx.nightSeqIndex; - func_8002DF18(globalCtx, PLAYER); + func_8002DF18(globalCtx, GET_PLAYER(globalCtx)); AnimationContext_Update(globalCtx, &globalCtx->animationCtx); gSaveContext.respawnFlag = 0; @@ -1210,10 +1210,11 @@ void Gameplay_Draw(GlobalContext* globalCtx) { } if ((HREG(80) != 10) || (HREG(83) != 0)) { - if ((globalCtx->skyboxCtx.unk_140 != 0) && (ACTIVE_CAM->setting != CAM_SET_PREREND0)) { + if ((globalCtx->skyboxCtx.unk_140 != 0) && + (GET_ACTIVE_CAM(globalCtx)->setting != CAM_SET_PREREND0)) { Vec3f sp74; - Camera_GetSkyboxOffset(&sp74, ACTIVE_CAM); + Camera_GetSkyboxOffset(&sp74, GET_ACTIVE_CAM(globalCtx)); SkyboxDraw_Draw(&globalCtx->skyboxCtx, gfxCtx, globalCtx->skyboxId, 0, globalCtx->view.eye.x + sp74.x, globalCtx->view.eye.y + sp74.y, globalCtx->view.eye.z + sp74.z); @@ -1295,7 +1296,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) { } if (globalCtx->view.unk_124 != 0) { - Camera_Update(ACTIVE_CAM); + Camera_Update(GET_ACTIVE_CAM(globalCtx)); func_800AB944(&globalCtx->view); globalCtx->view.unk_124 = 0; if (globalCtx->skyboxId && (globalCtx->skyboxId != SKYBOX_UNSET_1D) && !globalCtx->envCtx.skyDisabled) { @@ -1304,7 +1305,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) { } } - Camera_Finish(ACTIVE_CAM); + Camera_Finish(GET_ACTIVE_CAM(globalCtx)); CLOSE_DISPS(gfxCtx, "../z_play.c", 4508); } @@ -1726,7 +1727,7 @@ void Gameplay_SetRespawnData(GlobalContext* globalCtx, s32 respawnMode, s16 entr } void Gameplay_SetupRespawnPoint(GlobalContext* globalCtx, s32 respawnMode, s32 playerParams) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 entranceIndex; s8 roomIndex; diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 0ec34898f1..8ce8553506 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -304,7 +304,7 @@ s32 Player_InBlockingCsMode(GlobalContext* globalCtx, Player* this) { } s32 Player_InCsMode(GlobalContext* globalCtx) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); return Player_InBlockingCsMode(globalCtx, this) || (this->unk_6AD == 4); } @@ -419,7 +419,7 @@ void func_8008EE08(Player* this) { } void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); func_8008EE08(this); this->unk_664 = actor; @@ -430,7 +430,7 @@ void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) { } s32 func_8008EF30(GlobalContext* globalCtx) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); return (this->stateFlags1 & 0x800000); } @@ -441,7 +441,7 @@ s32 func_8008EF44(GlobalContext* globalCtx, s32 ammo) { } s32 Player_IsBurningStickInRange(GlobalContext* globalCtx, Vec3f* pos, f32 xzRange, f32 yRange) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); Vec3f diff; s32 pad; @@ -466,13 +466,13 @@ s32 Player_GetStrength(void) { } u8 Player_GetMask(GlobalContext* globalCtx) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); return this->currentMask; } Player* Player_UnsetMask(GlobalContext* globalCtx) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); this->currentMask = PLAYER_MASK_NONE; @@ -480,13 +480,13 @@ Player* Player_UnsetMask(GlobalContext* globalCtx) { } s32 Player_HasMirrorShieldEquipped(GlobalContext* globalCtx) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); return (this->currentShield == PLAYER_SHIELD_MIRROR); } s32 Player_HasMirrorShieldSetToDraw(GlobalContext* globalCtx) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); return (this->rightHandType == 10) && (this->currentShield == PLAYER_SHIELD_MIRROR); } @@ -580,7 +580,7 @@ return_neg: } s32 func_8008F2F8(GlobalContext* globalCtx) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); TextTriggerEntry* triggerEntry; s32 var; diff --git a/src/code/z_room.c b/src/code/z_room.c index 20a0405121..4e6448cccd 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -329,7 +329,7 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 628); - camera = ACTIVE_CAM; + camera = GET_ACTIVE_CAM(globalCtx); sp9C = (camera->setting == CAM_SET_PREREND0); polygon1 = &room->mesh->polygon1; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist); @@ -384,7 +384,7 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { BgImage* bgImage; s32 i; - camera = ACTIVE_CAM; + camera = GET_ACTIVE_CAM(globalCtx); camId = camera->camDataIdx; // jfifid camId2 = func_80041C10(&globalCtx->colCtx, camId, BGCHECK_SCENE)[2].y; @@ -392,7 +392,7 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { camId = camId2; } - player = PLAYER; + player = GET_PLAYER(globalCtx); player->actor.params = (player->actor.params & 0xFF00) | camId; bgImage = SEGMENTED_TO_VIRTUAL(polygon1->multi.list); @@ -424,7 +424,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 752); - camera = ACTIVE_CAM; + camera = GET_ACTIVE_CAM(globalCtx); sp98 = (camera->setting == CAM_SET_PREREND0); polygon1 = &room->mesh->polygon1; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist); @@ -589,7 +589,7 @@ s32 func_800973FC(GlobalContext* globalCtx, RoomContext* roomCtx) { gSegments[3] = VIRTUAL_TO_PHYSICAL(roomCtx->unk_34); Scene_ExecuteCommands(globalCtx, roomCtx->curRoom.segment); - Player_SetBootData(globalCtx, PLAYER); + Player_SetBootData(globalCtx, GET_PLAYER(globalCtx)); Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx); return 1; diff --git a/src/code/z_scene_table.c b/src/code/z_scene_table.c index a33237aecc..0a8db06310 100644 --- a/src/code/z_scene_table.c +++ b/src/code/z_scene_table.c @@ -1437,14 +1437,14 @@ void func_8009BEEC(GlobalContext* globalCtx) { s32 var; if (globalCtx->gameplayFrames % 128 == 13) { - var = Quake_Add(ACTIVE_CAM, 2); + var = Quake_Add(GET_ACTIVE_CAM(globalCtx), 2); Quake_SetSpeed(var, 10000); Quake_SetQuakeValues(var, 4, 0, 0, 0); Quake_SetCountdown(var, 127); } if ((globalCtx->gameplayFrames % 64 == 0) && (Rand_ZeroOne() > 0.6f)) { - var = Quake_Add(ACTIVE_CAM, 3); + var = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(var, 32000.0f + (Rand_ZeroOne() * 3000.0f)); Quake_SetQuakeValues(var, 10.0f - (Rand_ZeroOne() * 9.0f), 0, 0, 0); Quake_SetCountdown(var, 48.0f - (Rand_ZeroOne() * 15.0f)); @@ -2081,7 +2081,7 @@ void func_8009EE44(GlobalContext* globalCtx) { if ((globalCtx->roomCtx.unk_74[0] == 0) && (INV_CONTENT(ITEM_COJIRO) == ITEM_COJIRO)) { if (globalCtx->roomCtx.unk_74[1] == 50) { - func_8002F7DC(&PLAYER->actor, NA_SE_EV_CHICKEN_CRY_M); + func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_EV_CHICKEN_CRY_M); globalCtx->roomCtx.unk_74[0] = 1; } globalCtx->roomCtx.unk_74[1]++; 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 e79bd7b6a5..82defa74b9 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -86,13 +86,13 @@ void ArmsHook_Destroy(Actor* thisx, GlobalContext* globalCtx) { void ArmsHook_Wait(ArmsHook* this, GlobalContext* globalCtx) { if (this->actor.parent == NULL) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); // get correct timer length for hookshot or longshot s32 length = (player->heldItemActionParam == PLAYER_AP_HOOKSHOT) ? 13 : 26; ArmsHook_SetupAction(this, ArmsHook_Shoot); func_8002D9A4(&this->actor, 20.0f); - this->actor.parent = &PLAYER->actor; + this->actor.parent = &GET_PLAYER(globalCtx)->actor; this->timer = length; } } @@ -142,7 +142,7 @@ void ArmsHook_AttachHookToActor(ArmsHook* this, Actor* actor) { } void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* touchedActor; Actor* grabbed; Vec3f bodyDistDiffVec; @@ -301,7 +301,7 @@ void ArmsHook_Update(Actor* thisx, GlobalContext* globalCtx) { void ArmsHook_Draw(Actor* thisx, GlobalContext* globalCtx) { s32 pad; ArmsHook* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp78; Vec3f sp6C; Vec3f sp60; diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index 26e257bf92..d554bbbdf5 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -174,7 +174,7 @@ void BgBdanObjects_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (BgBdanObjects_GetContactRu1(this, 0)) { if (this->dyna.actor.xzDistToPlayer < 250.0f) { @@ -228,7 +228,7 @@ void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) { if (this->timer != 0) { this->timer--; if (this->timer == 0) { - temp = Quake_Add(ACTIVE_CAM, 1); + temp = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); Quake_SetSpeed(temp, 0x3A98); Quake_SetQuakeValues(temp, 0, 1, 0xFA, 1); Quake_SetCountdown(temp, 0xA); @@ -242,12 +242,12 @@ void func_8086C29C(BgBdanObjects* this, GlobalContext* globalCtx) { BgBdanObjects_SetContactRu1(this, 4); this->timer = 10; this->actionFunc = func_8086C55C; - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); } } void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->dyna.actor.velocity.y += 0.5f; if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + -70.0f, diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index ce58666e1f..0dec26fef9 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -366,7 +366,7 @@ void func_8086D9F8(BgBdanSwitch* this) { } void func_8086DA1C(BgBdanSwitch* this, GlobalContext* globalCtx) { - Actor* heldActor = PLAYER->heldActor; + Actor* heldActor = GET_PLAYER(globalCtx)->heldActor; if (func_8004356C(&this->dyna)) { if (heldActor != NULL && heldActor->id == ACTOR_EN_RU1) { diff --git a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c index 13308d39ae..8c681e05b3 100644 --- a/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c +++ b/src/overlays/actors/ovl_Bg_Bowl_Wall/z_bg_bowl_wall.c @@ -153,7 +153,7 @@ void BgBowlWall_FallDoEffects(BgBowlWall* this, GlobalContext* globalCtx) { EffectSsHahen_SpawnBurst(globalCtx, &effectPos, 10.0f, 0, 50, 15, 3, HAHEN_OBJECT_DEFAULT, 10, NULL); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_IT_BOMB_EXPLOSION); } - quakeIndex = Quake_Add(ACTIVE_CAM, 1); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); Quake_SetSpeed(quakeIndex, 0x7FFF); Quake_SetQuakeValues(quakeIndex, 300, 0, 0, 0); Quake_SetCountdown(quakeIndex, 30); diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index d5d9a23671..a910914817 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -426,7 +426,7 @@ void BgDyYoseizo_SetupHealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* glob } void BgDyYoseizo_HealPlayer_NoReward(BgDyYoseizo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 curFrame = this->skelAnime.curFrame; Vec3f beamPos; s16 beamParams; @@ -511,7 +511,7 @@ void BgDyYoseizo_SayFarewell_NoReward(BgDyYoseizo* this, GlobalContext* globalCt func_80106CCC(globalCtx); this->mouthState = 0; this->actionFunc = BgDyYoseizo_SetupSpinShrink; - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); } BgDyYoseizo_Bob(this, globalCtx); @@ -667,7 +667,7 @@ static u8 sItemIds[] = { ITEM_FARORES_WIND, ITEM_DINS_FIRE, ITEM_NAYRUS_LOVE }; void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, GlobalContext* globalCtx) { f32 curFrame = this->skelAnime.curFrame; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 actionIndex; s16 demoEffectParams; Vec3f itemPos; @@ -950,7 +950,7 @@ void BgDyYoseizo_ParticleInit(BgDyYoseizo* this, Vec3f* initPos, Vec3f* initVelo void BgDyYoseizo_ParticleUpdate(BgDyYoseizo* this, GlobalContext* globalCtx) { BgDyYoseizoParticle* particle = this->particles; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp94; Vec3f sp88; f32 goalPitch; diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index 9c4191097c..8109e5e615 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -189,7 +189,7 @@ void BgGanonOtyuka_WaitToFall(BgGanonOtyuka* this, GlobalContext* globalCtx) { } void BgGanonOtyuka_Fall(BgGanonOtyuka* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 i; Vec3f pos; Vec3f velocity; diff --git a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c index d9e3faa634..62242d4437 100644 --- a/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c +++ b/src/overlays/actors/ovl_Bg_Gjyo_Bridge/z_bg_gjyo_bridge.c @@ -70,7 +70,7 @@ void func_808787A4(BgGjyoBridge* this, GlobalContext* globalCtx) { } void BgGjyoBridge_TriggerCutscene(BgGjyoBridge* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT) && CHECK_QUEST_ITEM(QUEST_MEDALLION_SHADOW) && (INV_CONTENT(ITEM_ARROW_LIGHT) == ITEM_ARROW_LIGHT) && (player->actor.world.pos.x > -70.0f) && diff --git a/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c b/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c index 8345a7cd19..499ac89f7f 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Firemeiro/z_bg_gnd_firemeiro.c @@ -113,7 +113,7 @@ void BgGndFiremeiro_Shake(BgGndFiremeiro* this, GlobalContext* globalCtx) { } void BgGndFiremeiro_Rise(BgGndFiremeiro* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* thisx = &this->dyna.actor; if ((player->currentBoots != PLAYER_BOOTS_HOVER) && func_8004356C(&this->dyna)) { // Player standing on it diff --git a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c index 82dab010f5..46d357c4c7 100644 --- a/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Gnd_Iceblock/z_bg_gnd_iceblock.c @@ -234,7 +234,7 @@ void BgGndIceblock_SetNextPosition(BgGndIceblock* this) { } void BgGndIceblock_Idle(BgGndIceblock* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~0x10; @@ -250,7 +250,7 @@ void BgGndIceblock_Idle(BgGndIceblock* this, GlobalContext* globalCtx) { } void BgGndIceblock_Reset(BgGndIceblock* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { diff --git a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c index de108c6488..6260f76785 100644 --- a/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c +++ b/src/overlays/actors/ovl_Bg_Haka/z_bg_haka.c @@ -67,7 +67,7 @@ void func_8087B758(BgHaka* this, Player* player) { } void func_8087B7E8(BgHaka* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->dyna.unk_150 != 0.0f) { if (globalCtx->sceneNum == SCENE_SPOT02 && !LINK_IS_ADULT && !gSaveContext.nightFlag) { @@ -91,7 +91,7 @@ void func_8087B7E8(BgHaka* this, GlobalContext* globalCtx) { } void func_8087B938(BgHaka* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 sp38; this->dyna.actor.speedXZ += 0.05f; @@ -117,7 +117,7 @@ void func_8087B938(BgHaka* this, GlobalContext* globalCtx) { } void func_8087BAAC(BgHaka* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->dyna.unk_150 != 0.0f) { this->dyna.unk_150 = 0.0f; @@ -126,7 +126,7 @@ void func_8087BAAC(BgHaka* this, GlobalContext* globalCtx) { } void func_8087BAE4(BgHaka* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; if (this->dyna.actor.params != 0) { diff --git a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c index dabb62ce85..8d4d2b693a 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c +++ b/src/overlays/actors/ovl_Bg_Haka_Gate/z_bg_haka_gate.c @@ -150,7 +150,7 @@ void BgHakaGate_DoNothing(BgHakaGate* this, GlobalContext* globalCtx) { } void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~0x10; @@ -159,7 +159,7 @@ void BgHakaGate_StatueInactive(BgHakaGate* this, GlobalContext* globalCtx) { } void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 linkDirection; f32 forceDirection; @@ -188,7 +188,7 @@ void BgHakaGate_StatueIdle(BgHakaGate* this, GlobalContext* globalCtx) { } void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 turnFinished; s16 turnAngle; @@ -222,7 +222,7 @@ void BgHakaGate_StatueTurn(BgHakaGate* this, GlobalContext* globalCtx) { void BgHakaGate_FloorClosed(BgHakaGate* this, GlobalContext* globalCtx) { if ((sStatueDistToPlayer > 1.0f) && (sStatueRotY != 0)) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 radialDist; f32 angDist; f32 cos = Math_CosS(sStatueRotY); @@ -327,7 +327,7 @@ void BgHakaGate_DrawFlame(BgHakaGate* this, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Matrix_Translate(thisx->world.pos.x, thisx->world.pos.y + 15.0f, thisx->world.pos.z, MTXMODE_NEW); - Matrix_RotateY(Camera_GetCamDirYaw(ACTIVE_CAM) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) * (M_PI / 0x8000), MTXMODE_APPLY); scale = this->vFlameScale * 0.00001f; Matrix_Scale(scale, scale, scale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_haka_gate.c", 744), diff --git a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c index f25334086e..67a5db0d25 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c +++ b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c @@ -180,7 +180,7 @@ void func_8087D720(BgHakaHuta* this, GlobalContext* globalCtx) { this->counter++; if (this->counter == 6) { this->actionFunc = BgHakaHuta_DoNothing; - quakeIndex = Quake_Add(ACTIVE_CAM, 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quakeIndex, 0x7530); Quake_SetQuakeValues(quakeIndex, 4, 0, 0, 0); Quake_SetCountdown(quakeIndex, 2); diff --git a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c index 0231c01cab..4a4d836155 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c +++ b/src/overlays/actors/ovl_Bg_Haka_Sgami/z_bg_haka_sgami.c @@ -289,7 +289,7 @@ void BgHakaSgami_Spin(BgHakaSgami* this, GlobalContext* globalCtx) { void BgHakaSgami_Update(Actor* thisx, GlobalContext* globalCtx) { BgHakaSgami* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(player->stateFlags1 & 0x300000C0) || (this->actionFunc == BgHakaSgami_SetupSpin)) { this->actionFunc(this, globalCtx); diff --git a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c index fee1deea6a..904c5c3ca0 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c +++ b/src/overlays/actors/ovl_Bg_Haka_Trap/z_bg_haka_trap.c @@ -208,7 +208,7 @@ void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx) { Vec3f sp28; f32 sine; f32 zNonNegative; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_8002DBD0(&this->dyna.actor, &sp28, &player->actor.world.pos); @@ -230,7 +230,7 @@ void func_8087FFC0(BgHakaTrap* this, GlobalContext* globalCtx) { void func_808801B8(BgHakaTrap* this, GlobalContext* globalCtx) { static UNK_TYPE D_80881018 = 0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((D_80880F30 == 0) && (!Player_InCsMode(globalCtx))) { if (!Math_StepToF(&this->dyna.actor.world.pos.x, this->dyna.actor.home.pos.x, 0.5f)) { @@ -431,13 +431,13 @@ void func_808809B0(BgHakaTrap* this, GlobalContext* globalCtx) { } void func_808809E4(BgHakaTrap* this, GlobalContext* globalCtx, s16 arg2) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp18; func_8002DBD0(&this->dyna.actor, &sp18, &player->actor.world.pos); if ((fabsf(sp18.x) < 70.0f) && (fabsf(sp18.y) < 100.0f) && (sp18.z < 500.0f) && - (PLAYER->currentBoots != PLAYER_BOOTS_IRON)) { + (GET_PLAYER(globalCtx)->currentBoots != PLAYER_BOOTS_IRON)) { player->windSpeed = ((500.0f - sp18.z) * 0.06f + 5.0f) * arg2 * (1.0f / 0x3A00) * (2.0f / 3.0f); player->windDirection = this->dyna.actor.shape.rot.y; } diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index f9340f444c..dd084b922d 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -239,8 +239,8 @@ void BgHeavyBlock_SpawnDust(GlobalContext* globalCtx, f32 posX, f32 posY, f32 po accel.x = 0.0f; accel.y = (dustParams & 8) ? 0.0f : 0.5f; - eye = ACTIVE_CAM->eye; - at = ACTIVE_CAM->at; + eye = GET_ACTIVE_CAM(globalCtx)->eye; + at = GET_ACTIVE_CAM(globalCtx)->at; scale = 1000; scaleStep = 160; @@ -333,7 +333,7 @@ void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx) { break; } - quakeIndex = Quake_Add(ACTIVE_CAM, 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quakeIndex, 25000); Quake_SetQuakeValues(quakeIndex, 1, 1, 5, 0); Quake_SetCountdown(quakeIndex, 10); @@ -342,7 +342,7 @@ void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx) { } void BgHeavyBlock_LiftedUp(BgHeavyBlock* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; f32 cosYaw; f32 zOffset; @@ -400,12 +400,12 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { Flags_SetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F); Actor_Kill(&this->dyna.actor); - quakeIndex = Quake_Add(ACTIVE_CAM, 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0); Quake_SetCountdown(quakeIndex, 30); - quakeIndex = Quake_Add(ACTIVE_CAM, 2); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 2); Quake_SetSpeed(quakeIndex, 12000); Quake_SetQuakeValues(quakeIndex, 5, 0, 0, 0); Quake_SetCountdown(quakeIndex, 999); @@ -415,7 +415,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - quakeIndex = Quake_Add(ACTIVE_CAM, 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 16, 2, 120, 0); Quake_SetCountdown(quakeIndex, 40); @@ -426,7 +426,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { case HEAVYBLOCK_UNBREAKABLE: Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); - quakeIndex = Quake_Add(ACTIVE_CAM, 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0); Quake_SetCountdown(quakeIndex, 40); @@ -434,7 +434,7 @@ void BgHeavyBlock_Fly(BgHeavyBlock* this, GlobalContext* globalCtx) { this->actionFunc = BgHeavyBlock_Land; break; default: - quakeIndex = Quake_Add(ACTIVE_CAM, 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quakeIndex, 28000); Quake_SetQuakeValues(quakeIndex, 14, 2, 100, 0); Quake_SetCountdown(quakeIndex, 40); @@ -487,7 +487,7 @@ void BgHeavyBlock_Draw(Actor* thisx, GlobalContext* globalCtx) { static Vec3f D_80884ED4 = { 0.0f, 400.0f, 0.0f }; BgHeavyBlock* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_heavy_block.c", 904); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c index fc3aa9ee71..e8dd81e65a 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Dalm/z_bg_hidan_dalm.c @@ -125,7 +125,7 @@ void BgHidanDalm_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void BgHidanDalm_Wait(BgHidanDalm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->collider.base.acFlags & AC_HIT) && !Player_InCsMode(globalCtx) && (player->swordAnimation == 22 || player->swordAnimation == 23)) { @@ -146,7 +146,7 @@ void BgHidanDalm_Wait(BgHidanDalm* this, GlobalContext* globalCtx) { this->dyna.actor.bgCheckFlags &= ~8; this->dyna.actor.speedXZ = 10.0f; Flags_SetSwitch(globalCtx, this->switchFlag); - func_8002F7DC(&PLAYER->actor, NA_SE_IT_HAMMER_HIT); + func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_IT_HAMMER_HIT); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_DARUMA_VANISH); } else { CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c index e185977426..89c905cb20 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Firewall/z_bg_hidan_firewall.c @@ -86,7 +86,7 @@ s32 BgHidanFirewall_CheckProximity(BgHidanFirewall* this, GlobalContext* globalC Player* player; Vec3f distance; - player = PLAYER; + player = GET_PLAYER(globalCtx); func_8002DBD0(&this->actor, &distance, &player->actor.world.pos); if (fabsf(distance.x) < 100.0f && fabsf(distance.z) < 120.0f) { @@ -145,7 +145,7 @@ void BgHidanFirewall_ColliderFollowPlayer(BgHidanFirewall* this, GlobalContext* f32 sp28; f32 phi_f0; - player = PLAYER; + player = GET_PLAYER(globalCtx); func_8002DBD0(&this->actor, &sp30, &player->actor.world.pos); if (sp30.x < -70.0f) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c index e666dd0078..1fdb3c8a5d 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c @@ -72,7 +72,7 @@ static InitChainEntry sInitChain[] = { void BgHidanFwbig_Init(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; BgHidanFwbig* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor_ProcessInitChain(&this->actor, sInitChain); Collider_InitCylinder(globalCtx, &this->collider); @@ -176,7 +176,7 @@ void BgHidanFwbig_WaitForTimer(BgHidanFwbig* this, GlobalContext* globalCtx) { } void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->actor.world.pos.x < 1150.0f) { this->actionFunc = BgHidanFwbig_Rise; @@ -196,7 +196,7 @@ void BgHidanFwbig_Move(BgHidanFwbig* this, GlobalContext* globalCtx) { } void BgHidanFwbig_MoveCollider(BgHidanFwbig* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f projPos; f32 cs; f32 sn; diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index 0a5e10fae0..5a53e25036 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -310,7 +310,7 @@ void func_80888860(BgHidanHamstep* this, GlobalContext* globalCtx) { if (1) {} if (this->unk_244 == 1) { - quakeIndex = Quake_Add(ACTIVE_CAM, 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quakeIndex, -15536); Quake_SetQuakeValues(quakeIndex, 0, 0, 500, 0); Quake_SetCountdown(quakeIndex, 20); @@ -369,7 +369,7 @@ void func_80888A58(BgHidanHamstep* this, GlobalContext* globalCtx) { if (1) {} if (this->unk_244 == 1) { - quakeIndex = Quake_Add(ACTIVE_CAM, 3); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quakeIndex, -15536); Quake_SetQuakeValues(quakeIndex, 20, 1, 0, 0); Quake_SetCountdown(quakeIndex, 7); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index 11a7c25f65..a39938d366 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -125,7 +125,7 @@ void func_8088B268(BgHidanRock* this, GlobalContext* globalCtx) { f32 sp2C; s32 temp_v1; s32 frame; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->dyna.unk_150 != 0.0f) { if (this->timer == 0) { @@ -213,7 +213,7 @@ void func_8088B5F4(BgHidanRock* this, GlobalContext* globalCtx) { void func_8088B634(BgHidanRock* this, GlobalContext* globalCtx) { if (func_8004356C(&this->dyna)) { this->timer = 20; - this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4000; + this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4000; this->actionFunc = func_8088B69C; } } @@ -294,7 +294,7 @@ void func_8088B954(BgHidanRock* this, GlobalContext* globalCtx) { } void func_8088B990(BgHidanRock* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->timer++; if (this->dyna.unk_150 != 0.0f) { @@ -366,7 +366,7 @@ void func_8088BC40(GlobalContext* globalCtx, BgHidanRock* this) { MTXMODE_NEW); } - Matrix_RotateRPY(0, Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000, 0, MTXMODE_APPLY); + Matrix_RotateRPY(0, Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000, 0, MTXMODE_APPLY); Matrix_Translate(-10.5f, 0.0f, 0.0f, MTXMODE_APPLY); Matrix_Scale(6.0f, this->unk_16C, 6.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c index d4b83d1e66..0b6272a400 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rsekizou/z_bg_hidan_rsekizou.c @@ -241,7 +241,7 @@ void BgHidanRsekizou_Draw(Actor* thisx, GlobalContext* globalCtx) { POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); - if ((s16)((Camera_GetCamDirYaw(ACTIVE_CAM) - this->dyna.actor.shape.rot.y) - 0x2E6C) >= 0) { + if ((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->dyna.actor.shape.rot.y) - 0x2E6C) >= 0) { for (i = 3; i >= 0; i--) { POLY_XLU_DISP = BgHidanRsekizou_DrawFireball(globalCtx, this, i, &mf, 0, POLY_XLU_DISP); } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c index bfcbe6563d..cd75598bcf 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Sima/z_bg_hidan_sima.c @@ -116,12 +116,12 @@ void BgHidanSima_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_8088E518(BgHidanSima* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y, 3.4f); if (func_8004356C(&this->dyna) && !(player->stateFlags1 & 0x6000)) { this->timer = 20; - this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4000; + this->dyna.actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4000; if (this->dyna.actor.home.pos.y <= this->dyna.actor.world.pos.y) { this->actionFunc = func_8088E5D0; } else { diff --git a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c index 714c4e4943..06af0a3577 100644 --- a/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c +++ b/src/overlays/actors/ovl_Bg_Ice_Objects/z_bg_ice_objects.c @@ -135,7 +135,7 @@ void BgIceObjects_CheckPits(BgIceObjects* this, GlobalContext* globalCtx) { } void BgIceObjects_Idle(BgIceObjects* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { @@ -200,7 +200,7 @@ void BgIceObjects_Slide(BgIceObjects* this, GlobalContext* globalCtx) { } void BgIceObjects_Reset(BgIceObjects* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* thisx = &this->dyna.actor; if (this->dyna.unk_150 != 0.0f) { @@ -216,7 +216,7 @@ void BgIceObjects_Reset(BgIceObjects* this, GlobalContext* globalCtx) { } void BgIceObjects_Stuck(BgIceObjects* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~0x10; diff --git a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c index 1ac4f592fd..756da36936 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c +++ b/src/overlays/actors/ovl_Bg_Jya_Block/z_bg_jya_block.c @@ -58,7 +58,7 @@ void BgJyaBlock_Destroy(Actor* thisx, GlobalContext* globalCtx) { void BgJyaBlock_Update(Actor* thisx, GlobalContext* globalCtx) { BgJyaBlock* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->stateFlags2 &= ~0x10; this->dyna.unk_150 = 0.0f; diff --git a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c index 5f0f4dcbb4..97860883a5 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c +++ b/src/overlays/actors/ovl_Bg_Jya_Cobra/z_bg_jya_cobra.c @@ -207,7 +207,7 @@ void func_80895A70(BgJyaCobra* this) { } void func_80895BEC(BgJyaCobra* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; Vec3f sp2C; @@ -457,7 +457,7 @@ void func_80896918(BgJyaCobra* this, GlobalContext* globalCtx) { } void func_80896950(BgJyaCobra* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->dyna.unk_150 > 0.001f) { this->unk_168++; @@ -475,7 +475,7 @@ void func_80896950(BgJyaCobra* this, GlobalContext* globalCtx) { } void func_808969F8(BgJyaCobra* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 phi_a3; s16 temp2; @@ -500,7 +500,7 @@ void func_808969F8(BgJyaCobra* this, GlobalContext* globalCtx) { void func_80896ABC(BgJyaCobra* this, GlobalContext* globalCtx) { s16 temp_v0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); temp_v0 = (s16)((this->unk_16C * 0x2000) + this->dyna.actor.home.rot.y) - this->dyna.actor.world.rot.y; if (ABS(temp_v0) < 7424) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c index 0b21c0d5d9..09b86ff86c 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Goroiwa/z_bg_jya_goroiwa.c @@ -155,7 +155,7 @@ void BgJyaGoroiwa_Move(BgJyaGoroiwa* this, GlobalContext* globalCtx) { } func_8002F6D4(globalCtx, thisx, 2.0f, thisx->yawTowardsPlayer, 0.0f, 0); - func_8002F7DC(&PLAYER->actor, NA_SE_PL_BODY_HIT); + func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); this->yOffsetSpeed = 10.0f; this->speedFactor = 0.5f; @@ -198,7 +198,7 @@ void BgJyaGoroiwa_Wait(BgJyaGoroiwa* this, GlobalContext* globalCtx) { void BgJyaGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; BgJyaGoroiwa* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 bgId; Vec3f pos; diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c index d8f9f9760b..fe2e88c040 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c @@ -105,7 +105,7 @@ void func_80899950(BgJyaKanaami* this, GlobalContext* globalCtx) { if (Math_ScaledStepToS(&this->dyna.actor.world.rot.x, 0x4000, this->unk_168)) { func_80899A08(this); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_TRAP_BOUND); - quakeId = Quake_Add(ACTIVE_CAM, 3); + quakeId = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quakeId, 25000); Quake_SetQuakeValues(quakeId, 2, 0, 0, 0); Quake_SetCountdown(quakeId, 16); diff --git a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c index 066afcc74a..37f0c16b3e 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c +++ b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c @@ -118,7 +118,7 @@ void BgJyaLift_Move(BgJyaLift* this, GlobalContext* globalCtx) { tempVelocity = (this->dyna.actor.velocity.y < 0.2f) ? 0.2f : this->dyna.actor.velocity.y; distFromBottom = Math_SmoothStepToF(&this->dyna.actor.world.pos.y, 973.0f, 0.1f, tempVelocity, 0.2f); if ((this->dyna.actor.world.pos.y < 1440.0f) && (1440.0f <= this->dyna.actor.prevPos.y)) { - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); } if (fabsf(distFromBottom) < 0.001f) { BgJyaLift_SetFinalPosY(this); diff --git a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c index 08b0b225bd..42954fffd4 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c +++ b/src/overlays/actors/ovl_Bg_Jya_Zurerukabe/z_bg_jya_zurerukabe.c @@ -77,7 +77,7 @@ void BgJyaZurerukabe_InitDynaPoly(BgJyaZurerukabe* this, GlobalContext* globalCt } void func_8089B4C8(BgJyaZurerukabe* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->stateFlags1 == 0x200000) && (player->actor.wallPoly != NULL)) { s32 i; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c index dd98542226..039a490f10 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Uzu/z_bg_mizu_uzu.c @@ -58,7 +58,7 @@ void BgMizuUzu_Destroy(Actor* thisx, GlobalContext* globalCtx) { void func_8089F788(BgMizuUzu* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; - if (PLAYER->currentBoots == PLAYER_BOOTS_IRON) { + if (GET_PLAYER(globalCtx)->currentBoots == PLAYER_BOOTS_IRON) { func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); } else { func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index ca4a9e283a..83acc31b55 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -75,7 +75,7 @@ void BgMoriBigst_Init(Actor* thisx, GlobalContext* globalCtx) { osSyncPrintf("mori (bigST.鍵型天井)(arg : %04x)(sw %d)(noE %d)(roomC %d)(playerPosY %f)\n", this->dyna.actor.params, Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F), Flags_GetTempClear(globalCtx, this->dyna.actor.room), Flags_GetClear(globalCtx, this->dyna.actor.room), - PLAYER->actor.world.pos.y); + GET_PLAYER(globalCtx)->actor.world.pos.y); BgMoriBigst_InitDynapoly(this, globalCtx, &gMoriBigstCol, DPM_UNK); Actor_ProcessInitChain(&this->dyna.actor, sInitChain); this->moriTexObjIndex = Object_GetIndex(&globalCtx->objectCtx, OBJECT_MORI_TEX); @@ -111,7 +111,7 @@ void BgMoriBigst_WaitForMoriTex(BgMoriBigst* this, GlobalContext* globalCtx) { if (Object_IsLoaded(&globalCtx->objectCtx, this->moriTexObjIndex)) { thisx->draw = BgMoriBigst_Draw; - if (Flags_GetClear(globalCtx, thisx->room) && (PLAYER->actor.world.pos.y > 700.0f)) { + if (Flags_GetClear(globalCtx, thisx->room) && (GET_PLAYER(globalCtx)->actor.world.pos.y > 700.0f)) { if (Flags_GetSwitch(globalCtx, (thisx->params >> 8) & 0x3F)) { BgMoriBigst_SetupDone(this, globalCtx); } else { @@ -145,9 +145,10 @@ void BgMoriBigst_SetupStalfosFight(BgMoriBigst* this, GlobalContext* globalCtx) } void BgMoriBigst_StalfosFight(BgMoriBigst* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); - if ((this->dyna.actor.home.rot.z == 0) && ((this->dyna.actor.home.pos.y - 5.0f) <= PLAYER->actor.world.pos.y)) { + if ((this->dyna.actor.home.rot.z == 0) && + ((this->dyna.actor.home.pos.y - 5.0f) <= GET_PLAYER(globalCtx)->actor.world.pos.y)) { BgMoriBigst_SetupFall(this, globalCtx); OnePointCutscene_Init(globalCtx, 3220, 72, &this->dyna.actor, MAIN_CAM); } @@ -174,7 +175,7 @@ void BgMoriBigst_SetupLanding(BgMoriBigst* this, GlobalContext* globalCtx) { BgMoriBigst_SetupAction(this, BgMoriBigst_Landing); this->waitTimer = 18; - quake = Quake_Add(ACTIVE_CAM, 3); + quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quake, 25000); Quake_SetQuakeValues(quake, 5, 0, 0, 0); Quake_SetCountdown(quake, 16); diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index 54051f4ccb..6c7fdd2fea 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c @@ -127,7 +127,7 @@ void BgMoriElevator_Destroy(Actor* thisx, GlobalContext* globalCtx) { s32 BgMoriElevator_IsPlayerRiding(BgMoriElevator* this, GlobalContext* globalCtx) { return ((this->dyna.unk_160 & 2) && !(this->unk_170 & 2) && - ((PLAYER->actor.world.pos.y - this->dyna.actor.world.pos.y) < 80.0f)); + ((GET_PLAYER(globalCtx)->actor.world.pos.y - this->dyna.actor.world.pos.y) < 80.0f)); } void BgMoriElevator_SetupWaitAfterInit(BgMoriElevator* this) { diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index 037fd0ee4a..031666567d 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -168,7 +168,7 @@ void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, GlobalContext* globalCtx void func_808A3C8C(BgMoriHineri* this, GlobalContext* globalCtx) { f32 f0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f0 = 1100.0f - (player->actor.world.pos.z - this->dyna.actor.world.pos.z); this->dyna.actor.shape.rot.z = CLAMP(f0, 0.0f, 1000.0f) * 16.384f; @@ -214,7 +214,8 @@ void func_808A3E54(BgMoriHineri* this, GlobalContext* globalCtx) { sNextCamIdx = SUBCAM_NONE; } } - if ((sNextCamIdx >= SUBCAM_FIRST) && ((ACTIVE_CAM->eye.z - this->dyna.actor.world.pos.z) < 1100.0f)) { + if ((sNextCamIdx >= SUBCAM_FIRST) && + ((GET_ACTIVE_CAM(globalCtx)->eye.z - this->dyna.actor.world.pos.z) < 1100.0f)) { func_8002F948(&this->dyna.actor, NA_SE_EV_FLOOR_ROLLING - SFX_FLAG); } } diff --git a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c index f17336f890..c29e99f763 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c +++ b/src/overlays/actors/ovl_Bg_Mori_Kaitenkabe/z_bg_mori_kaitenkabe.c @@ -91,7 +91,7 @@ void BgMoriKaitenkabe_Wait(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { Vec3f push; Vec3f leverArm; Vec3f torque; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->dyna.unk_150 > 0.001f) { this->timer++; @@ -124,7 +124,7 @@ void BgMoriKaitenkabe_SetupRotate(BgMoriKaitenkabe* this) { } void BgMoriKaitenkabe_Rotate(BgMoriKaitenkabe* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* thisx = &this->dyna.actor; s16 rotY; diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index 4111dc0b88..c3961135fd 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c @@ -87,13 +87,13 @@ void BgMoriRakkatenjo_Destroy(Actor* thisx, GlobalContext* globalCtx) { } s32 BgMoriRakkatenjo_IsLinkUnder(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { - Vec3f* pos = &PLAYER->actor.world.pos; + Vec3f* pos = &GET_PLAYER(globalCtx)->actor.world.pos; return (-3300.0f < pos->z) && (pos->z < -1840.0f) && (1791.0f < pos->x) && (pos->x < 2191.0f); } s32 BgMoriRakkatenjo_IsLinkClose(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { - Vec3f* pos = &PLAYER->actor.world.pos; + Vec3f* pos = &GET_PLAYER(globalCtx)->actor.world.pos; return (-3360.0f < pos->z) && (pos->z < -1840.0f) && (1791.0f < pos->x) && (pos->x < 2191.0f); } @@ -164,7 +164,7 @@ void BgMoriRakkatenjo_Fall(BgMoriRakkatenjo* this, GlobalContext* globalCtx) { 403.0f - (thisx->world.pos.y - 403.0f) * bounceVel[this->bounceCount] / fabsf(thisx->velocity.y); thisx->velocity.y = bounceVel[this->bounceCount]; this->bounceCount++; - quake = Quake_Add(ACTIVE_CAM, 3); + quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quake, 50000); Quake_SetQuakeValues(quake, 5, 0, 0, 0); Quake_SetCountdown(quake, 5); diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index 651d845ff3..7a3e0c76f8 100644 --- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -322,7 +322,7 @@ void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx) { if (firstFall == 0) { firstFall = 1; } else { - func_8002DF54(globalCtx, &PLAYER->actor, 7); + func_8002DF54(globalCtx, &GET_PLAYER(globalCtx)->actor, 7); } } this->direction = 0; @@ -331,7 +331,7 @@ void BgPoEvent_BlockFall(BgPoEvent* this, GlobalContext* globalCtx) { } void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* amy; if (sPuzzleState == 0xF) { @@ -386,7 +386,7 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) { static f32 blockPushDist = 0.0f; f32 displacement; s32 blockStop; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->dyna.actor.speedXZ += 0.1f; this->dyna.actor.speedXZ = CLAMP_MAX(this->dyna.actor.speedXZ, 2.0f); @@ -417,7 +417,7 @@ void BgPoEvent_BlockPush(BgPoEvent* this, GlobalContext* globalCtx) { } void BgPoEvent_BlockReset(BgPoEvent* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~0x10; @@ -437,7 +437,7 @@ void BgPoEvent_BlockReset(BgPoEvent* this, GlobalContext* globalCtx) { } void BgPoEvent_BlockSolved(BgPoEvent* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->dyna.unk_150 != 0.0f) { player->stateFlags2 &= ~0x10; @@ -515,7 +515,7 @@ void BgPoEvent_PaintingVanish(BgPoEvent* this, GlobalContext* globalCtx) { void BgPoEvent_PaintingPresent(BgPoEvent* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); DECR(this->timer); diff --git a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c index 8ae8dd53c3..7546da1f49 100644 --- a/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c +++ b/src/overlays/actors/ovl_Bg_Po_Syokudai/z_bg_po_syokudai.c @@ -179,7 +179,8 @@ void BgPoSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, envColor->r, envColor->g, envColor->b, 255); Matrix_Translate(0.0f, 52.0f, 0.0f, MTXMODE_APPLY); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) - this->actor.shape.rot.y + 0x8000) * (M_PI / 0x8000), + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000) * + (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale(0.0027f, 0.0027f, 0.0027f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c index 1c44e60feb..46eb5fff1d 100644 --- a/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c +++ b/src/overlays/actors/ovl_Bg_Spot00_Hanebasi/z_bg_spot00_hanebasi.c @@ -215,7 +215,7 @@ void BgSpot00Hanebasi_Update(Actor* thisx, GlobalContext* globalCtx) { if (globalCtx->sceneNum == SCENE_SPOT00) { if (CHECK_QUEST_ITEM(QUEST_KOKIRI_EMERALD) && CHECK_QUEST_ITEM(QUEST_GORON_RUBY) && CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE) && !(gSaveContext.eventChkInf[8] & 1) && LINK_IS_CHILD) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->actor.world.pos.x > -450.0f) && (player->actor.world.pos.x < 450.0f) && (player->actor.world.pos.z > 1080.0f) && (player->actor.world.pos.z < 1700.0f) && @@ -272,7 +272,7 @@ void BgSpot00Hanebasi_DrawTorches(Actor* thisx, GlobalContext* globalCtx2) { sTorchFlameScale = ((thisx->shape.rot.x * -1) - 0x2000) * (1.0f / 1024000.0f); } - angle = (s16)(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000) * (M_PI / 32768.0f); + angle = (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 32768.0f); gDPSetPrimColor(POLY_XLU_DISP++, 128, 128, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); diff --git a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c index 08eee11ef6..63355a8136 100644 --- a/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot02_Objects/z_bg_spot02_objects.c @@ -143,7 +143,7 @@ void func_808AC908(BgSpot02Objects* this, GlobalContext* globalCtx) { } void func_808ACA08(BgSpot02Objects* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->timer != 0) { this->timer--; diff --git a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c index b1f4e157f5..a3fd84383e 100644 --- a/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c +++ b/src/overlays/actors/ovl_Bg_Spot08_Iceblock/z_bg_spot08_iceblock.c @@ -174,7 +174,7 @@ void BgSpot08Iceblock_Roll(BgSpot08Iceblock* this, GlobalContext* globalCtx) { s32 rollDataIndex; MtxF mtx; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); switch (this->dyna.actor.params & 0xFF) { case 0x11: // Medium nonrotating diff --git a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c index 1ea9234db6..e2068abfc9 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c @@ -57,7 +57,7 @@ void func_808B27F0(GlobalContext* globalCtx, s16 waterSurface) { } s32 func_808B280C(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp58; Vec3f sp4C; Vec3f sp40; diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index f9a9af2607..4b7f4ee803 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c @@ -113,7 +113,7 @@ void func_808B318C(BgSpot12Gate* this, GlobalContext* globalCtx) { if (Math_StepToF(&this->dyna.actor.world.pos.y, this->dyna.actor.home.pos.y + 200.0f, this->dyna.actor.velocity.y)) { func_808B3274(this); - var = Quake_Add(ACTIVE_CAM, 3); + var = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(var, -0x3CB0); Quake_SetQuakeValues(var, 3, 0, 0, 0); Quake_SetCountdown(var, 0xC); diff --git a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c index 942597e093..6a65ff93f9 100644 --- a/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c +++ b/src/overlays/actors/ovl_Bg_Spot15_Rrbox/z_bg_spot15_rrbox.c @@ -233,7 +233,7 @@ void func_808B4084(BgSpot15Rrbox* this, GlobalContext* globalCtx) { } void func_808B40AC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->unk_168 <= 0 && fabsf(this->dyna.unk_150) > 0.001f) { if (func_808B3AAC(this, globalCtx) && !func_808B4010(this, globalCtx)) { @@ -256,7 +256,7 @@ void func_808B4178(BgSpot15Rrbox* this, GlobalContext* globalCtx) { void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) { f32 sign; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 tempUnk178; s32 approxFResult; Actor* actor = &this->dyna.actor; @@ -282,7 +282,7 @@ void func_808B4194(BgSpot15Rrbox* this, GlobalContext* globalCtx) { this->unk_174 = 0.0f; func_808B4380(this, globalCtx); } else if (approxFResult) { - player = PLAYER; + player = GET_PLAYER(globalCtx); if (func_808B4010(this, globalCtx)) { Audio_PlayActorSound2(actor, NA_SE_EV_WOOD_BOUND); } @@ -312,7 +312,7 @@ void func_808B4380(BgSpot15Rrbox* this, GlobalContext* globalCtx) { void func_808B43D0(BgSpot15Rrbox* this, GlobalContext* globalCtx) { f32 floorHeight; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* actor = &this->dyna.actor; if (fabsf(this->dyna.unk_150) > 0.001f) { @@ -346,7 +346,7 @@ void func_808B44B8(BgSpot15Rrbox* this, GlobalContext* globalCtx) { } void func_808B44CC(BgSpot15Rrbox* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->stateFlags2 &= ~0x10; this->dyna.unk_150 = 0.0f; diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 325266959a..8a09e39b93 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -366,7 +366,7 @@ void func_808B561C(BgSpot16Bombstone* this, GlobalContext* globalCtx) { } void func_808B56BC(BgSpot16Bombstone* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 sinValue; s16 adjustedYawDiff; s32 yawDiff; @@ -395,7 +395,7 @@ void func_808B56BC(BgSpot16Bombstone* this, GlobalContext* globalCtx) { void func_808B57E0(BgSpot16Bombstone* this, GlobalContext* globalCtx) { Actor* playerHeldActor; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnBombf* currentBomb; if (sTimer > 0) { diff --git a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c index 045cd7cd33..bbd178cfa8 100644 --- a/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c +++ b/src/overlays/actors/ovl_Bg_Spot17_Funen/z_bg_spot17_funen.c @@ -59,7 +59,8 @@ void func_808B7478(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 153); func_80093D84(globalCtx->state.gfxCtx); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) - thisx->shape.rot.y + 0x8000) * 9.58738019108e-05f, + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - thisx->shape.rot.y + 0x8000) * + 9.58738019108e-05f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_bg_spot17_funen.c", 161), diff --git a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c index 5612e872ef..61ab80954b 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Obj/z_bg_spot18_obj.c @@ -210,7 +210,7 @@ void func_808B8DDC(BgSpot18Obj* this, GlobalContext* globalCtx) { } void func_808B8E20(BgSpot18Obj* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (fabsf(this->dyna.unk_150) > 0.001f) { this->dyna.unk_150 = 0.0f; @@ -245,7 +245,7 @@ void func_808B8EE0(BgSpot18Obj* this) { void func_808B8F08(BgSpot18Obj* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_StepToF(&this->dyna.actor.speedXZ, 1.2f, 0.1f); Actor_MoveForward(&this->dyna.actor); diff --git a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c index e3d3fe7067..e14d52d625 100644 --- a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c +++ b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c @@ -55,7 +55,7 @@ void BgSstFloor_Destroy(BgSstFloor* thisx, GlobalContext* globalCtx) { void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { s32 pad; BgSstFloor* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); CollisionHeader* colHeader = SEGMENTED_TO_VIRTUAL(&gBongoDrumCol); colHeader->vtxList = SEGMENTED_TO_VIRTUAL(colHeader->vtxList); diff --git a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c index 0826eb793a..42eedd80be 100644 --- a/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c +++ b/src/overlays/actors/ovl_Bg_Toki_Swd/z_bg_toki_swd.c @@ -142,7 +142,7 @@ void func_808BB0AC(BgTokiSwd* this, GlobalContext* globalCtx) { } BgTokiSwd_SetupAction(this, func_808BB128); } else { - player = PLAYER; + player = GET_PLAYER(globalCtx); player->interactRangeActor = &this->actor; } } diff --git a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c index b1a141ffc0..2798c5b15b 100644 --- a/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c +++ b/src/overlays/actors/ovl_Bg_Treemouth/z_bg_treemouth.c @@ -165,7 +165,7 @@ void func_808BC8B8(BgTreemouth* this, GlobalContext* globalCtx) { } void func_808BC9EC(BgTreemouth* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (globalCtx->csCtx.state == CS_STATE_UNSKIPPABLE_INIT) { if (Actor_IsFacingAndNearPlayer(&this->dyna.actor, 350.0f, 0x7530)) { diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index e61e7f5aea..3c1974cd9d 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -278,7 +278,7 @@ void BgYdanSp_FloorWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { f32 sqrtFallDistance; f32 unk; - player = PLAYER; + player = GET_PLAYER(globalCtx); webPos.x = this->dyna.actor.world.pos.x; webPos.y = this->dyna.actor.world.pos.y - 50.0f; webPos.z = this->dyna.actor.world.pos.z; @@ -399,7 +399,7 @@ void BgYdanSp_WallWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { Player* player; Vec3f sp30; - player = PLAYER; + player = GET_PLAYER(globalCtx); if (Flags_GetSwitch(globalCtx, this->burnSwitchFlag) || (this->trisCollider.base.acFlags & 2)) { this->dyna.actor.home.pos.y = this->dyna.actor.world.pos.y + 80.0f; BgYdanSp_BurnWeb(this, globalCtx); diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index 1906e81a53..cc8ae1f2ef 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -245,7 +245,7 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { Vec3f sp54; Vec3f sp48; - player = PLAYER; + player = GET_PLAYER(globalCtx); camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); if (this->unk_196 != 0) { @@ -819,8 +819,8 @@ void BossDodongo_Update(Actor* thisx, GlobalContext* globalCtx2) { BossDodongo* this = THIS; f32 temp_f0; s16 i; - Player* player = PLAYER; - Player* player2 = PLAYER; + Player* player = GET_PLAYER(globalCtx); + Player* player2 = GET_PLAYER(globalCtx); s32 pad; this->unk_1E2 = 0; @@ -1150,7 +1150,7 @@ f32 func_808C4F6C(BossDodongo* this, GlobalContext* globalCtx) { s32 pad; f32 temp_f2; f32 rotation; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); xDiff = player->actor.world.pos.x - this->actor.world.pos.x; zDiff = player->actor.world.pos.z - this->actor.world.pos.z; @@ -1173,7 +1173,7 @@ f32 func_808C50A8(BossDodongo* this, GlobalContext* globalCtx) { s32 pad; f32 temp_f2; f32 rotation; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); xDiff = player->actor.world.pos.x - this->actor.world.pos.x; zDiff = player->actor.world.pos.z - this->actor.world.pos.z; @@ -1191,7 +1191,7 @@ f32 func_808C50A8(BossDodongo* this, GlobalContext* globalCtx) { } void BossDodongo_PlayerYawCheck(BossDodongo* this, GlobalContext* globalCtx) { - s16 yawDiff = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor) - this->actor.world.rot.y; + s16 yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; if ((yawDiff < 0x38E3) && (-0x38E3 < yawDiff)) { this->playerYawInRange = true; @@ -1295,7 +1295,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { s16 i; Vec3f effectPos; Camera* camera; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 8fe8ca357e..7949d80eef 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -269,7 +269,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { f32 dx; f32 dy; f32 dz; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 angleToTarget; f32 pitchToTarget; Vec3f* holePosition1; @@ -300,7 +300,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { // Boss Intro Cutscene if (this->introState != BFD_CS_NONE) { - Player* player2 = PLAYER; + Player* player2 = GET_PLAYER(globalCtx); Camera* mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); switch (this->introState) { @@ -1428,7 +1428,7 @@ void BossFd_Update(Actor* thisx, GlobalContext* globalCtx) { void BossFd_UpdateEffects(BossFd* this, GlobalContext* globalCtx) { BossFdEffect* effect = this->effects; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Color_RGB8 colors[4] = { { 255, 128, 0 }, { 255, 0, 0 }, { 255, 255, 0 }, { 255, 0, 0 } }; Vec3f diff; s16 i1; diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 992f6d8903..729527b9a7 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -227,7 +227,7 @@ void BossFd2_SetupEmerge(BossFd2* this, GlobalContext* globalCtx) { void BossFd2_Emerge(BossFd2* this, GlobalContext* globalCtx) { s8 health; BossFd* bossFd = (BossFd*)this->actor.parent; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 i; s16 holeTime; @@ -402,7 +402,7 @@ void BossFd2_BreatheFire(BossFd2* this, GlobalContext* globalCtx) { s16 angleY; s16 breathOpacity = 0; BossFd* bossFd = (BossFd*)this->actor.parent; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 tempX; f32 tempY; @@ -810,7 +810,7 @@ void BossFd2_CollisionCheck(BossFd2* this, GlobalContext* globalCtx) { BossFd* bossFd = (BossFd*)this->actor.parent; if (this->actionFunc == BossFd2_ClawSwipe) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); for (i = 0; i < ARRAY_COUNT(this->elements); i++) { if (this->collider.elements[i].info.toucherFlags & TOUCH_HIT) { diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 8aaa58a005..5994a0e5cc 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -205,7 +205,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Vec3f* temp[2]; sp8D = false; - player = PLAYER; + player = GET_PLAYER(globalCtx); this->unk_398++; switch (this->unk_39C) { @@ -1283,7 +1283,7 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { f32 temp_f2; sp4C = Gameplay_GetCamera(globalCtx, MAIN_CAM); - player = PLAYER; + player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); this->unk_398++; this->unk_339 = 20; @@ -1465,7 +1465,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { f32 phi_f0; s32 phi_a1; - player = PLAYER; + player = GET_PLAYER(globalCtx); this->unk_398++; SkelAnime_Update(&this->skelAnime); @@ -1853,7 +1853,7 @@ void func_80902348(BossGanon2* this, GlobalContext* globalCtx) { } if (this->unk_324 > 0.0f) { - player = PLAYER; + player = GET_PLAYER(globalCtx); temp_f2 = -200.0f - player->actor.world.pos.x; temp_f12 = -200.0f - player->actor.world.pos.z; @@ -2649,7 +2649,7 @@ void func_8090523C(BossGanon2* this, GlobalContext* globalCtx) { if (this->unk_38C > 0.0f) { s8 i; - player = PLAYER; + player = GET_PLAYER(globalCtx); func_80093D84(globalCtx->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0, 0, 255, 255, 255, (s16)this->unk_38C); gDPSetEnvColor(POLY_XLU_DISP++, 0, 255, 255, 0); @@ -2803,7 +2803,7 @@ void BossGanon2_Draw(Actor* thisx, GlobalContext* globalCtx) { void func_80905DA8(BossGanon2* this, GlobalContext* globalCtx) { s32 pad[5]; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); BossGanon2Effect* effect = globalCtx->specialEffects; Vec3f sp78; s16 i; diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index 00463ea08f..b76f54634a 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -486,7 +486,7 @@ void BossGanondrof_Neutral(BossGanondrof* this, GlobalContext* globalCtx) { f32 targetX; f32 targetY; f32 targetZ; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* playerx = &player->actor; Actor* thisx = &this->actor; f32 rand01; @@ -797,7 +797,7 @@ void BossGanondrof_SetupCharge(BossGanondrof* this, GlobalContext* globalCtx) { } void BossGanondrof_Charge(BossGanondrof* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* playerx = &player->actor; Actor* thisx = &this->actor; f32 dxCenter = thisx->world.pos.x - GND_BOSSROOM_CENTER_X; @@ -943,7 +943,7 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { f32 camX; f32 camZ; f32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Camera* camera = Gameplay_GetCamera(globalCtx, 0); osSyncPrintf("PYP %f\n", player->actor.floorHeight); diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index c16b47ce5d..dd02ffbe4e 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -625,7 +625,7 @@ void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { Camera* camera; camera = Gameplay_GetCamera(globalCtx, 0); - player = PLAYER; + player = GET_PLAYER(globalCtx); this->actionState = 4; this->actor.flags |= 1; func_80064520(globalCtx, &globalCtx->csCtx); @@ -646,7 +646,7 @@ void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { player->actor.world.pos.z = 300.0f; player->actor.world.rot.y = player->actor.shape.rot.y = -0x705C; - this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor) + 0x8000; + this->actor.world.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) + 0x8000; // room entrance, closer to room center this->subCameraEye.x = 90.0f; @@ -671,7 +671,7 @@ void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { */ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Camera* cam; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad[2]; Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); @@ -779,7 +779,8 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { this->lookedAtFrames++; Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); Math_ApproachS(&this->actor.world.rot.y, - Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor) + 0x8000, 2, 0xBB8); + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) + 0x8000, 2, + 0xBB8); this->eyeLidBottomRotX = this->eyeLidTopRotX = this->eyeIrisRotX = this->eyeIrisRotY = 0; } else { this->lookedAtFrames = 0; @@ -879,7 +880,8 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { this->subCameraAt.z = this->actor.world.pos.z; SkelAnime_Update(&this->skelanime); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor), 2, 0x7D0); + Math_ApproachS(&this->actor.world.rot.y, + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, 0x7D0); if (this->actor.bgCheckFlags & 1) { this->actionState = 130; @@ -901,7 +903,8 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Math_ApproachF(&this->subCameraEye.z, this->actor.world.pos.z + 45.0f + 40.0f, 0.1f, this->subCameraFollowSpeed * 30.0f); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor), 2, 0x7D0); + Math_ApproachS(&this->actor.world.rot.y, + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, 0x7D0); SkelAnime_Update(&this->skelanime); this->subCameraAt.x = this->actor.world.pos.x; this->subCameraAt.z = this->actor.world.pos.z; @@ -988,7 +991,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { Vec3f accel2 = { 0.0f, -0.5f, 0.0f }; Vec3f pos; Camera* camera; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f childPos; s16 i; @@ -1256,7 +1259,8 @@ void BossGoma_FloorAttackPosture(BossGoma* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); if (this->skelanime.curFrame >= (19.0f + 1.0f / 3.0f) && this->skelanime.curFrame <= 30.0f) { - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor), 3, 0xBB8); + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), + 3, 0xBB8); } if (Animation_OnFrame(&this->skelanime, Animation_GetLastFrame(&gGohmaPrepareAttackAnim))) { @@ -1424,7 +1428,8 @@ void BossGoma_FloorStunned(BossGoma* this, GlobalContext* globalCtx) { void BossGoma_FallJump(BossGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor), 2, 0x7D0); + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, + 0x7D0); if (this->actor.bgCheckFlags & 1) { BossGoma_SetupFloorLand(this); @@ -1440,7 +1445,8 @@ void BossGoma_FallJump(BossGoma* this, GlobalContext* globalCtx) { void BossGoma_FallStruckDown(BossGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor), 3, 0x7D0); + Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 3, + 0x7D0); if (this->actor.bgCheckFlags & 1) { BossGoma_SetupFloorLandStruckDown(this); @@ -1599,7 +1605,7 @@ void BossGoma_FloorMain(BossGoma* this, GlobalContext* globalCtx) { } if (!this->doNotMoveThisFrame) { - rot = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor); + rot = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); if (this->patienceTimer != 0) { this->patienceTimer--; @@ -1713,7 +1719,7 @@ void BossGoma_UpdateEye(BossGoma* this, GlobalContext* globalCtx) { s16 targetEyeIrisRotY; if (!this->disableGameplayLogic) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->eyeState == EYESTATE_IRIS_FOLLOW_BONUS_IFRAMES) { // player + 0xA73 seems to be related to "throwing something" @@ -1743,8 +1749,10 @@ void BossGoma_UpdateEye(BossGoma* this, GlobalContext* globalCtx) { } if (this->eyeState != EYESTATE_IRIS_NO_FOLLOW_NO_IFRAMES) { - targetEyeIrisRotY = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor) - this->actor.shape.rot.y; - targetEyeIrisRotX = Actor_WorldPitchTowardActor(&this->actor, &PLAYER->actor) - this->actor.shape.rot.x; + targetEyeIrisRotY = + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.y; + targetEyeIrisRotX = + Actor_WorldPitchTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.x; if (this->actor.shape.rot.x > 0x4000 || this->actor.shape.rot.x < -0x4000) { targetEyeIrisRotY = -(s16)(targetEyeIrisRotY + 0x8000); diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 69599bfd3d..090235c810 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -410,7 +410,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { s16 tentXrot; s16 sp1B4 = 0; // real s32 buttons; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 indS0; s16 indS1; Camera* camera1; @@ -1196,7 +1196,7 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { f32 sp80; f32 sp7C; f32 sp78; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); Vec3f bubblePos; Vec3f bubblePos2; @@ -1728,7 +1728,7 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { void BossMo_CoreCollisionCheck(BossMo* this, GlobalContext* globalCtx) { s16 i; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); osSyncPrintf(VT_FGCOL(YELLOW)); osSyncPrintf("Core_Damage_check START\n"); @@ -1832,8 +1832,8 @@ void BossMo_Core(BossMo* this, GlobalContext* globalCtx) { 0.1f, 0.15f, 0.2f, 0.3f, 0.4f, 0.43f, 0.4f, 0.3f, 0.2f, 0.15f, 0.1f, }; u8 nearLand; - s16 i; // not on stack - Player* player = PLAYER; // not on stack + s16 i; // not on stack + Player* player = GET_PLAYER(globalCtx); // not on stack f32 spDC; f32 spD8; f32 spD4; @@ -2203,7 +2203,7 @@ void BossMo_UpdateCore(Actor* thisx, GlobalContext* globalCtx) { s32 pad; BossMo* this = THIS; s16 i; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); osSyncPrintf("CORE mode = <%d>\n", this->work[MO_TENT_ACTION_STATE]); if (sMorphaTent2 == NULL) { @@ -2250,7 +2250,7 @@ void BossMo_UpdateTent(Actor* thisx, GlobalContext* globalCtx) { s16 index; s32 pad; BossMo* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 phi_f0; if ((this == sMorphaTent2) && (this->tent2KillTimer != 0)) { diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 4040957074..c461bbfb08 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -359,7 +359,7 @@ void BossSst_HeadLurk(BossSst* this, GlobalContext* globalCtx) { } void BossSst_HeadSetupIntro(BossSst* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->timer = 611; this->ready = false; @@ -389,7 +389,7 @@ void BossSst_HeadSetupIntro(BossSst* this, GlobalContext* globalCtx) { } void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 tempo; s32 introStateTimer; s32 revealStateTimer; @@ -651,15 +651,15 @@ void BossSst_HeadNeutral(BossSst* this, GlobalContext* globalCtx) { } if (this->timer == 0) { - if ((PLAYER->actor.world.pos.y > -50.0f) && !(PLAYER->stateFlags1 & 0x6080)) { + if ((GET_PLAYER(globalCtx)->actor.world.pos.y > -50.0f) && !(GET_PLAYER(globalCtx)->stateFlags1 & 0x6080)) { sHands[Rand_ZeroOne() <= 0.5f]->ready = true; BossSst_HeadSetupWait(this); } else { this->timer = 28; } } else { - Math_ApproachS(&this->actor.shape.rot.y, Actor_WorldYawTowardPoint(&PLAYER->actor, &sRoomCenter) + 0x8000, 4, - 0x400); + Math_ApproachS(&this->actor.shape.rot.y, + Actor_WorldYawTowardPoint(&GET_PLAYER(globalCtx)->actor, &sRoomCenter) + 0x8000, 4, 0x400); if ((this->timer == 28) || (this->timer == 84)) { BossSst_HeadSfx(this, NA_SE_EN_SHADEST_PRAY); } @@ -760,7 +760,7 @@ void BossSst_HeadCharge(BossSst* this, GlobalContext* globalCtx) { sHands[LEFT]->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); sHands[RIGHT]->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); func_8002F71C(globalCtx, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); - func_8002F7DC(&PLAYER->actor, NA_SE_PL_BODY_HIT); + func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); } } @@ -999,7 +999,7 @@ void BossSst_UpdateDeathCamera(BossSst* this, GlobalContext* globalCtx) { } void BossSst_HeadSetupDeath(BossSst* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Animation_MorphToLoop(&this->skelAnime, &gBongoHeadEyeOpenIdleAnim, -5.0f); BossSst_HeadSfx(this, NA_SE_EN_SHADEST_DEAD); @@ -1018,7 +1018,7 @@ void BossSst_HeadSetupDeath(BossSst* this, GlobalContext* globalCtx) { Gameplay_CopyCamera(globalCtx, sCutsceneCamera, MAIN_CAM); func_8002DF54(globalCtx, &player->actor, 8); func_80064520(globalCtx, &globalCtx->csCtx); - Math_Vec3f_Copy(&sCameraEye, &ACTIVE_CAM->eye); + Math_Vec3f_Copy(&sCameraEye, &GET_ACTIVE_CAM(globalCtx)->eye); this->actionFunc = BossSst_HeadDeath; } @@ -1037,15 +1037,15 @@ void BossSst_HeadDeath(BossSst* this, GlobalContext* globalCtx) { Gameplay_CameraSetAtEye(globalCtx, sCutsceneCamera, &this->actor.focus.pos, &sCameraEye); Math_StepToF(&this->radius, -350.0f, 10.0f); } else if (this->timer == 48) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->actor.world.pos.x = sRoomCenter.x + (400.0f * Math_SinS(this->actor.shape.rot.y)) + (Math_CosS(this->actor.shape.rot.y) * -120.0f); player->actor.world.pos.z = sRoomCenter.z + (400.0f * Math_CosS(this->actor.shape.rot.y)) - (Math_SinS(this->actor.shape.rot.y) * -120.0f); player->actor.shape.rot.y = Actor_WorldYawTowardPoint(&player->actor, &sRoomCenter); - func_8002DBD0(&this->actor, &sCameraEye, &globalCtx->cameraPtrs[globalCtx->activeCamera]->eye); - func_8002DBD0(&this->actor, &sCameraAt, &globalCtx->cameraPtrs[globalCtx->activeCamera]->at); + func_8002DBD0(&this->actor, &sCameraEye, &GET_ACTIVE_CAM(globalCtx)->eye); + func_8002DBD0(&this->actor, &sCameraAt, &GET_ACTIVE_CAM(globalCtx)->at); this->radius = -350.0f; this->actor.world.pos.x = sRoomCenter.x - (Math_SinS(this->actor.shape.rot.y) * 350.0f); this->actor.world.pos.z = sRoomCenter.z - (Math_CosS(this->actor.shape.rot.y) * 350.0f); @@ -1179,7 +1179,7 @@ void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx) { Gameplay_ChangeCameraStatus(globalCtx, sCutsceneCamera, CAM_STAT_WAIT); Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); Gameplay_ClearCamera(globalCtx, sCutsceneCamera); - func_8002DF54(globalCtx, &PLAYER->actor, 7); + func_8002DF54(globalCtx, &GET_PLAYER(globalCtx)->actor, 7); func_80064534(globalCtx, &globalCtx->csCtx); Actor_Kill(&this->actor); Actor_Kill(&sHands[LEFT]->actor); @@ -1229,7 +1229,7 @@ void BossSst_HandWait(BossSst* this, GlobalContext* globalCtx) { Math_StepToF(&this->actor.world.pos.x, this->actor.home.pos.x, 1.0f); Math_StepToF(&this->actor.world.pos.z, this->actor.home.pos.z, 1.0f); if (HAND_STATE(OTHER_HAND(this)) == HAND_DAMAGED) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->timer != 0) { this->timer--; @@ -1445,7 +1445,7 @@ void BossSst_HandReadySlam(BossSst* this, GlobalContext* globalCtx) { BossSst_HandSetupSlam(this); } } else { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Math_StepToF(&this->actor.world.pos.y, ROOM_CENTER_Y + 300.0f, 30.0f) && (this->actor.xzDistToPlayer < 140.0f)) { @@ -1503,7 +1503,7 @@ void BossSst_HandSlam(BossSst* this, GlobalContext* globalCtx) { } if (this->colliderJntSph.base.atFlags & AT_HIT) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->actor.world.pos.x = (Math_SinS(this->actor.yawTowardsPlayer) * 100.0f) + this->actor.world.pos.x; player->actor.world.pos.z = (Math_CosS(this->actor.yawTowardsPlayer) * 100.0f) + this->actor.world.pos.z; @@ -1555,7 +1555,7 @@ void BossSst_HandSetupSweep(BossSst* this) { } void BossSst_HandSweep(BossSst* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 newTargetYaw; SkelAnime_Update(&this->skelAnime); @@ -1626,7 +1626,7 @@ void BossSst_HandPunch(BossSst* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 8) { BossSst_HandSetupRetreat(this); } else if (this->colliderJntSph.base.atFlags & AT_HIT) { - func_8002F7DC(&PLAYER->actor, NA_SE_PL_BODY_HIT); + func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); func_8002F71C(globalCtx, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); BossSst_HandSetupRetreat(this); } @@ -1690,7 +1690,7 @@ void BossSst_HandSetupClap(BossSst* this) { void BossSst_HandClap(BossSst* this, GlobalContext* globalCtx) { static s32 dropFlag = false; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -1793,7 +1793,7 @@ void BossSst_HandSetupGrab(BossSst* this) { } void BossSst_HandGrab(BossSst* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->timer != 0) { this->timer--; @@ -1848,7 +1848,7 @@ void BossSst_HandSetupCrush(BossSst* this) { } void BossSst_HandCrush(BossSst* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); if (this->timer != 0) { @@ -1897,7 +1897,7 @@ void BossSst_HandSetupSwing(BossSst* this) { } void BossSst_HandSwing(BossSst* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 offXZ; if (Math_ScaledStepToS(&this->actor.shape.rot.x, this->amplitude, this->timer * 0xE4 + 0x1C8)) { @@ -2068,7 +2068,7 @@ void BossSst_HandReadyCharge(BossSst* this, GlobalContext* globalCtx) { OTHER_HAND(this)->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); sHead->colliderJntSph.base.atFlags &= ~(AT_ON | AT_HIT); func_8002F71C(globalCtx, &this->actor, 10.0f, this->actor.shape.rot.y, 5.0f); - func_8002F7DC(&PLAYER->actor, NA_SE_PL_BODY_HIT); + func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); } } @@ -2394,7 +2394,7 @@ void BossSst_HandBreakIce(BossSst* this, GlobalContext* globalCtx) { } void BossSst_HandGrabPlayer(BossSst* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (globalCtx->grabPlayer(globalCtx, player)) { player->actor.parent = &this->actor; @@ -2408,7 +2408,7 @@ void BossSst_HandGrabPlayer(BossSst* this, GlobalContext* globalCtx) { } void BossSst_HandReleasePlayer(BossSst* this, GlobalContext* globalCtx, s32 dropPlayer) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->actor.parent == &this->actor) { player->actor.parent = NULL; diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index 529288e01e..3afdd78626 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -388,7 +388,7 @@ void BossTw_AddShieldDeflectEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2) s16 i; s16 j; BossTwEffect* eff; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); sShieldHitPos = player->bodyPartsPos[15]; sShieldHitYaw = player->actor.shape.rot.y; @@ -418,7 +418,7 @@ void BossTw_AddShieldHitEffect(GlobalContext* globalCtx, f32 arg1, s16 arg2) { s16 i; s16 j; BossTwEffect* eff; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); sShieldHitPos = player->bodyPartsPos[15]; sShieldHitYaw = player->actor.shape.rot.y; @@ -707,7 +707,7 @@ void BossTw_FlyTo(BossTw* this, GlobalContext* globalCtx) { } void BossTw_SetupShootBeam(BossTw* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actionFunc = BossTw_ShootBeam; Animation_MorphToPlayOnce(&this->skelAnime, &object_tw_Anim_007688, -5.0f); @@ -789,7 +789,7 @@ void BossTw_SpawnGroundBlast(BossTw* this, GlobalContext* globalCtx, s16 blastTy s32 BossTw_BeamHitPlayerCheck(BossTw* this, GlobalContext* globalCtx) { Vec3f offset; Vec3f beamDistFromPlayer; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 i; offset.x = player->actor.world.pos.x - this->beamOrigin.x; @@ -835,7 +835,7 @@ s32 BossTw_BeamHitPlayerCheck(BossTw* this, GlobalContext* globalCtx) { s32 BossTw_CheckBeamReflection(BossTw* this, GlobalContext* globalCtx) { Vec3f offset; Vec3f vec; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags1 & 0x400000 && (s16)(player->actor.shape.rot.y - this->actor.shape.rot.y + 0x8000) < 0x2000 && @@ -968,7 +968,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { f32 floorY; Vec3f sp130; Vec3s sp128; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); BossTw* otherTw = (BossTw*)this->actor.parent; Input* input = &globalCtx->state.input[0]; @@ -1142,7 +1142,7 @@ void BossTw_ShootBeam(BossTw* this, GlobalContext* globalCtx) { case 1: if (CHECK_BTN_ALL(input->cur.button, BTN_R)) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->beamDist = sqrtf(SQ(xDiff) + SQ(yDiff) + SQ(zDiff)); Math_ApproachF(&this->beamReflectionDist, 2000.0f, 1.0f, 40.0f); @@ -1493,7 +1493,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { s16 i; Vec3f spB0; Vec3f spA4; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); switch (this->csState2) { case 0: @@ -1773,7 +1773,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { s16 i; Vec3f sp90; Vec3f sp84; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->csSfxTimer > 220 && this->csSfxTimer < 630) { func_80078884(NA_SE_EN_TWINROBA_UNARI - SFX_FLAG); @@ -2607,7 +2607,7 @@ void BossTw_DeathCSMsgSfx(BossTw* this, GlobalContext* globalCtx) { void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { s16 i; Vec3f spD0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Camera* mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); SkelAnime_Update(&this->skelAnime); @@ -2846,7 +2846,7 @@ static s16 D_8094A90C[] = { void BossTw_Update(Actor* thisx, GlobalContext* globalCtx) { BossTw* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 i; s32 pad; @@ -2972,7 +2972,7 @@ void BossTw_TwinrovaUpdate(Actor* thisx, GlobalContext* globalCtx2) { s16 i; GlobalContext* globalCtx = globalCtx2; BossTw* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.flags &= ~0x400; this->unk_5F8 = 0; @@ -3489,7 +3489,7 @@ void BossTw_Draw(Actor* thisx, GlobalContext* globalCtx2) { static Vec3f D_8094A9A4 = { 0.0f, 200.0f, 2000.0f }; GlobalContext* globalCtx = globalCtx2; BossTw* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_boss_tw.c", 6947); @@ -3678,7 +3678,7 @@ void BossTw_TwinrovaPostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** void BossTw_ShieldChargeDraw(BossTw* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_t0; s16 temp_a0; @@ -3911,7 +3911,7 @@ void BossTw_BlastFire(BossTw* this, GlobalContext* globalCtx) { f32 yDiff; f32 zDiff; f32 distXZ; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Player* player2 = player; switch (this->actor.params) { @@ -4102,7 +4102,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { f32 yDiff; f32 zDiff; f32 xzDist; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Player* player2 = player; switch (this->actor.params) { @@ -4321,7 +4321,7 @@ void BossTw_BlastIce(BossTw* this, GlobalContext* globalCtx) { } s32 BossTw_BlastShieldCheck(BossTw* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 ret = false; ColliderInfo* info; @@ -4562,7 +4562,7 @@ void BossTw_UpdateEffects(GlobalContext* globalCtx) { }; Vec3f sp11C; BossTwEffect* eff = globalCtx->specialEffects; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u8 sp113 = 0; s16 i; s16 j; @@ -4900,7 +4900,7 @@ void BossTw_DrawEffects(GlobalContext* globalCtx) { s16 i; s16 j; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_s4; BossTwEffect* currentEffect = globalCtx->specialEffects; BossTwEffect* effectHead; @@ -5365,7 +5365,7 @@ void BossTw_TwinrovaSetupFly(BossTw* this, GlobalContext* globalCtx) { f32 zDiff; f32 yDiff; f32 xzDist; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); do { this->work[TW_PLLR_IDX] += (s16)(((s16)Rand_ZeroFloat(2.99f)) + 1); diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index 62aa36f945..2fec99cb59 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -763,7 +763,7 @@ void BossVa_SetupIntro(BossVa* this) { void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { s32 i; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_1AC += 0xC31; this->unk_1A0 = (Math_CosS(this->unk_1AC) * 0.1f) + 1.0f; @@ -1056,7 +1056,7 @@ void BossVa_SetupBodyPhase1(BossVa* this) { } void BossVa_BodyPhase1(BossVa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_1B0 += 0xCE4; this->bodyGlow = (s16)(Math_SinS(this->unk_1B0) * 50.0f) + 150; @@ -1121,7 +1121,7 @@ void BossVa_SetupBodyPhase2(BossVa* this, GlobalContext* globalCtx) { } void BossVa_BodyPhase2(BossVa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp48; if (this->actor.colorFilterTimer == 0) { @@ -1226,7 +1226,7 @@ void BossVa_SetupBodyPhase3(BossVa* this) { void BossVa_BodyPhase3(BossVa* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 i; s16 sp62; @@ -1348,7 +1348,7 @@ void BossVa_SetupBodyPhase4(BossVa* this, GlobalContext* globalCtx) { } void BossVa_BodyPhase4(BossVa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 tmpf1; EnBoom* boomerang; @@ -1526,7 +1526,7 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { s32 i; Camera* camera = Gameplay_GetCamera(globalCtx, 0); s32 sp7C; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 tmp16; switch (sCsState) { @@ -1906,7 +1906,7 @@ void BossVa_SetupZapperAttack(BossVa* this, GlobalContext* globalCtx) { } void BossVa_ZapperAttack(BossVa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnBoom* boomerang; Actor* boomTarget; s16 yaw; @@ -2236,7 +2236,7 @@ void BossVa_SetupZapperEnraged(BossVa* this, GlobalContext* globalCtx) { } void BossVa_ZapperEnraged(BossVa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; s16 tmp16; s16 sp6C; @@ -2524,7 +2524,7 @@ void BossVa_SetupBariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { } void BossVa_BariPhase3Attack(BossVa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnBoom* boomerang; Vec3f sp54 = GET_BODY(this)->unk_1D8; s16 sp52; @@ -2611,7 +2611,7 @@ void BossVa_SetupBariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { } void BossVa_BariPhase2Attack(BossVa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnBoom* boomerang; Vec3f sp54 = GET_BODY(this)->unk_1D8; s16 sp52; @@ -3291,7 +3291,7 @@ static s32 sUnkValue = 0x009B0000; // Unreferenced? Possibly a color void BossVa_UpdateEffects(GlobalContext* globalCtx) { BossVaEffect* effect = sVaEffects; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 spB6; s16 i; f32 floorY; @@ -3714,7 +3714,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { void BossVa_SpawnSpark(GlobalContext* globalCtx, BossVaEffect* effect, BossVa* this, Vec3f* offset, s16 scale, u8 mode) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 index; Vec3f pos = { 0.0f, -1000.0f, 0.0f }; Vec3f tempVec; diff --git a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c index d7ed5bd134..d99d0da5b0 100644 --- a/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c +++ b/src/overlays/actors/ovl_Demo_6K/z_demo_6k.c @@ -520,9 +520,9 @@ void func_80967DBC(Demo6K* this, GlobalContext* globalCtx) { } if (this->timer2 > 104) { - func_80967BF8(PLAYER, globalCtx); + func_80967BF8(GET_PLAYER(globalCtx), globalCtx); Actor_Kill(&this->actor); - Audio_PlayActorSound2(&PLAYER->actor, NA_SE_EN_FANTOM_HIT_THUNDER); + Audio_PlayActorSound2(&GET_PLAYER(globalCtx)->actor, NA_SE_EN_FANTOM_HIT_THUNDER); } else if (this->timer2 > 94) { Actor_SetScale(&this->actor, this->actor.scale.x + 0.03f); @@ -695,7 +695,7 @@ void func_809688C4(Actor* thisx, GlobalContext* globalCtx2) { func_80093D84(globalCtx->state.gfxCtx); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 255, 255); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); for (i = 0; i < 16; i++) { gDPPipeSync(POLY_XLU_DISP++); diff --git a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c index d121b19560..802dbee62a 100644 --- a/src/overlays/actors/ovl_Demo_Du/z_demo_du.c +++ b/src/overlays/actors/ovl_Demo_Du/z_demo_du.c @@ -176,7 +176,7 @@ void DemoDu_CsFireMedallion_SpawnDoorWarp(DemoDu* this, GlobalContext* globalCtx // Gives the Fire Medallion to Link. void func_80969F38(DemoDu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 80.0f; f32 posZ = player->actor.world.pos.z; @@ -195,7 +195,7 @@ void DemoDu_CsFireMedallion_AdvanceTo01(DemoDu* this, GlobalContext* globalCtx) s32 pad[2]; if ((gSaveContext.chamberCutsceneNum == 1) && (gSaveContext.sceneSetupIndex < 4)) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->updateIndex = CS_FIREMEDALLION_SUBSCENE(1); globalCtx->csCtx.segment = D_8096C1A4; @@ -316,7 +316,7 @@ void DemoDu_CsPlaySfx_DaruniaFalling(GlobalContext* globalCtx) { // Cutscene: Darunia gives Link the Goron's Ruby. void DemoDu_CsPlaySfx_DaruniaHitsLink(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; func_80078914(&player->actor.projectedPos, NA_SE_EN_DARUNIA_HIT_LINK); @@ -333,7 +333,7 @@ void DemoDu_CsPlaySfx_HitBreast(DemoDu* this) { // Sfx played when Link is escaping from the gorons at the end of the scene. void DemoDu_CsPlaySfx_LinkEscapeFromGorons(GlobalContext* globalCtx) { if (globalCtx->csCtx.frames == 1400) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Audio_PlaySoundGeneral(NA_SE_VO_LI_FALL_L_KID, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -344,7 +344,7 @@ void DemoDu_CsPlaySfx_LinkEscapeFromGorons(GlobalContext* globalCtx) { // Sfx played when Link is surprised by Darunia falling from the sky. void DemoDu_CsPlaySfx_LinkSurprised(GlobalContext* globalCtx) { if (globalCtx->csCtx.frames == 174) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Audio_PlaySoundGeneral(NA_SE_VO_LI_SURPRISE_KID, &player->actor.projectedPos, 4U, &D_801333E0, &D_801333E0, &D_801333E8); @@ -394,7 +394,7 @@ void DemoDu_CsGoronsRuby_SpawnDustWhenHittingLink(DemoDu* this, GlobalContext* g if (Animation_OnFrame(&this->skelAnime, 31.0f) || Animation_OnFrame(&this->skelAnime, 41.0f)) { s32 pad[2]; s32 i; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f* headPos = &player->bodyPartsPos[PLAYER_LIMB_HEAD]; Vec3f velocity = { 0.0f, 0.0f, 0.0f }; Vec3f accel = { 0.0f, 0.3f, 0.0f }; diff --git a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c index 9ec77e151f..6f08e9fe1c 100644 --- a/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c +++ b/src/overlays/actors/ovl_Demo_Gj/z_demo_gj.c @@ -547,7 +547,7 @@ void DemoGj_SetupMovement(DemoGj* this, GlobalContext* globalCtx) { } if (xDistance == 0.0f && zDistance == 0.0f) { - player = PLAYER; + player = GET_PLAYER(globalCtx); xDistance = player->actor.world.pos.x - pos->x; zDistance = player->actor.world.pos.z - pos->z; diff --git a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c index 8fa4762452..baec20ad9a 100644 --- a/src/overlays/actors/ovl_Demo_Im/z_demo_im.c +++ b/src/overlays/actors/ovl_Demo_Im/z_demo_im.c @@ -177,7 +177,7 @@ void func_80984DB8(DemoIm* this) { } void func_80984E58(DemoIm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawDiff; s16 phi_a3; @@ -190,7 +190,7 @@ void func_80984E58(DemoIm* this, GlobalContext* globalCtx) { } void func_80984F10(DemoIm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_2D4.unk_18 = player->actor.world.pos; this->unk_2D4.unk_14 = kREG(16) + 12.0f; @@ -199,7 +199,7 @@ void func_80984F10(DemoIm* this, GlobalContext* globalCtx) { } void func_80984F94(DemoIm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_2D4.unk_18 = player->actor.world.pos; this->unk_2D4.unk_14 = kREG(16) + 4.0f; @@ -308,7 +308,7 @@ void func_80985358(DemoIm* this, GlobalContext* globalCtx) { } void func_809853B4(DemoIm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 playerX = player->actor.world.pos.x; f32 playerY = player->actor.world.pos.y + 80.0f; f32 playerZ = player->actor.world.pos.z; @@ -326,7 +326,7 @@ void func_8098544C(DemoIm* this, GlobalContext* globalCtx) { s32 pad[2]; if ((gSaveContext.chamberCutsceneNum == 4) && (gSaveContext.sceneSetupIndex < 4)) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->action = 1; globalCtx->csCtx.segment = D_8098786C; @@ -825,7 +825,7 @@ void func_809869B0(DemoIm* this, GlobalContext* globalCtx) { } s32 func_809869F8(DemoIm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 playerPosX = player->actor.world.pos.x; f32 thisPosX = this->actor.world.pos.x; @@ -836,7 +836,7 @@ s32 func_809869F8(DemoIm* this, GlobalContext* globalCtx) { } s32 func_80986A5C(DemoIm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 playerPosX = player->actor.world.pos.x; f32 thisPosX = this->actor.world.pos.x; @@ -859,7 +859,7 @@ s32 func_80986AD0(DemoIm* this, GlobalContext* globalCtx) { void func_80986B2C(GlobalContext* globalCtx) { if (func_8010BDBC(&globalCtx->msgCtx) == 2) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); globalCtx->nextEntranceIndex = 0xCD; globalCtx->fadeTransition = 38; diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 4ed2c16432..f0eb882d7f 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -284,7 +284,7 @@ void DemoKankyo_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void DemoKankyo_SetupType(DemoKankyo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 temp; if (this->actor.objBankIndex == this->objBankIndex) { @@ -771,7 +771,7 @@ void DemoKankyo_DrawWarpSparkles(Actor* thisx, GlobalContext* globalCtx) { f32 temp_f22; DemoKankyo* this = THIS; Gfx* disp; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f camPos; f32 translateX; f32 translateY; diff --git a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c index e605c10ec0..22f8e68539 100644 --- a/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c +++ b/src/overlays/actors/ovl_Demo_Sa/z_demo_sa.c @@ -232,7 +232,7 @@ void func_8098E86C(DemoSa* this, GlobalContext* globalCtx) { } void func_8098E8C8(DemoSa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 80.0f; f32 posZ = player->actor.world.pos.z; @@ -251,7 +251,7 @@ void func_8098E960(DemoSa* this, GlobalContext* globalCtx) { Player* player; if ((gSaveContext.chamberCutsceneNum == 0) && (gSaveContext.sceneSetupIndex < 4)) { - player = PLAYER; + player = GET_PLAYER(globalCtx); this->action = 1; globalCtx->csCtx.segment = D_8099010C; gSaveContext.cutsceneTrigger = 2; 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 df5188bde5..2ad226fd5e 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -126,7 +126,7 @@ void DoorAna_WaitOpen(DoorAna* this, GlobalContext* globalCtx) { Player* player; s32 destinationIdx; - player = PLAYER; + player = GET_PLAYER(globalCtx); if (Math_StepToF(&this->actor.scale.x, 0.01f, 0.001f)) { if ((this->actor.targetMode != 0) && (globalCtx->sceneLoadFlag == 0) && (player->stateFlags1 & 0x80000000) && (player->unk_84F == 0)) { @@ -159,7 +159,7 @@ void DoorAna_GrabPlayer(DoorAna* this, GlobalContext* globalCtx) { Player* player; if (this->actor.yDistToPlayer <= 0.0f && 15.0f < this->actor.xzDistToPlayer) { - player = PLAYER; + player = GET_PLAYER(globalCtx); player->actor.world.pos.x = Math_SinS(this->actor.yawTowardsPlayer) * 15.0f + this->actor.world.pos.x; player->actor.world.pos.z = Math_CosS(this->actor.yawTowardsPlayer) * 15.0f + this->actor.world.pos.z; } @@ -170,7 +170,7 @@ void DoorAna_Update(Actor* thisx, GlobalContext* globalCtx) { this->actionFunc(this, globalCtx); // changes the grottos facing angle based on camera angle - this->actor.shape.rot.y = Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000; + this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000; } void DoorAna_Draw(Actor* thisx, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c index 87e346ad19..afe136d569 100644 --- a/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c +++ b/src/overlays/actors/ovl_Door_Gerudo/z_door_gerudo.c @@ -64,7 +64,7 @@ void DoorGerudo_Destroy(Actor* thisx, GlobalContext* globalCtx) { } f32 func_809946BC(GlobalContext* globalCtx, DoorGerudo* this, f32 arg2, f32 arg3, f32 arg4) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f playerPos; Vec3f sp1C; @@ -81,7 +81,7 @@ f32 func_809946BC(GlobalContext* globalCtx, DoorGerudo* this, f32 arg2, f32 arg3 } s32 func_80994750(DoorGerudo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 temp_f0; s16 rotYDiff; @@ -110,7 +110,7 @@ void func_8099485C(DoorGerudo* this, GlobalContext* globalCtx) { s32 direction = func_80994750(this, globalCtx); if (direction != 0) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] <= 0) { player->naviTextId = -0x203; diff --git a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c index cb3f665d1a..31d936486e 100644 --- a/src/overlays/actors/ovl_Door_Killer/z_door_killer.c +++ b/src/overlays/actors/ovl_Door_Killer/z_door_killer.c @@ -349,7 +349,7 @@ void DoorKiller_FallOver(DoorKiller* this, GlobalContext* globalCtx) { } if (!(this->hasHitPlayerOrGround & 1)) { Vec3f playerPosRelToDoor; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_8002DBD0(&this->actor, &playerPosRelToDoor, &player->actor.world.pos); if ((fabsf(playerPosRelToDoor.y) < 20.0f) && (fabsf(playerPosRelToDoor.x) < 20.0f) && (playerPosRelToDoor.z < 100.0f) && (playerPosRelToDoor.z > 0.0f)) { @@ -408,7 +408,7 @@ void DoorKiller_WaitBeforeWobble(DoorKiller* this, GlobalContext* globalCtx) { } void DoorKiller_Wait(DoorKiller* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f playerPosRelToDoor; s16 angleToFacingPlayer; diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 60750709e9..5704f5cdb3 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -309,7 +309,7 @@ f32 func_80996840(GlobalContext* globalCtx, DoorShutter* this, f32 arg2, f32 arg s32 pad; Vec3f sp28; Vec3f sp1C; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); sp28.x = player->actor.world.pos.x; sp28.y = player->actor.world.pos.y + arg2; @@ -323,7 +323,7 @@ f32 func_80996840(GlobalContext* globalCtx, DoorShutter* this, f32 arg2, f32 arg } s32 func_809968D4(DoorShutter* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!Player_InCsMode(globalCtx)) { ShutterInfo* temp_v1 = &sShutterInfo[this->unk_16C]; @@ -348,10 +348,10 @@ void func_80996A54(DoorShutter* this, GlobalContext* globalCtx) { Flags_SetClear(globalCtx, this->dyna.actor.room); DoorShutter_SetupAction(this, func_80997150); OnePointCutscene_Attention(globalCtx, &this->dyna.actor); - OnePointCutscene_Attention(globalCtx, &PLAYER->actor); + OnePointCutscene_Attention(globalCtx, &GET_PLAYER(globalCtx)->actor); this->unk_16F = -100; } else if (func_809968D4(this, globalCtx) != 0) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->naviTextId = -0x202; } @@ -377,7 +377,7 @@ void func_80996B0C(DoorShutter* this, GlobalContext* globalCtx) { s32 doorDirection = func_809968D4(this, globalCtx); if (doorDirection != 0) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->unk_16E != 0) { if (this->doorType == SHUTTER_BOSS) { @@ -400,7 +400,7 @@ void func_80996B0C(DoorShutter* this, GlobalContext* globalCtx) { void func_80996C60(DoorShutter* this, GlobalContext* globalCtx) { if (this->dyna.actor.category == ACTORCAT_DOOR) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 sp38 = this->unk_16C; s32 sp34 = 0xF; @@ -466,7 +466,7 @@ void func_80996EE8(DoorShutter* this, GlobalContext* globalCtx) { OnePointCutscene_Attention(globalCtx, &this->dyna.actor); this->unk_16F = -100; } else if (func_809968D4(this, globalCtx)) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); // Jabu navi text for switch doors is different player->naviTextId = (globalCtx->sceneNum == SCENE_BDAN) ? -0x20B : -0x202; } @@ -525,7 +525,7 @@ void func_80997150(DoorShutter* this, GlobalContext* globalCtx) { } void func_80997220(DoorShutter* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s8 room = this->dyna.actor.room; if (this->dyna.actor.room >= 0) { @@ -628,7 +628,7 @@ void func_80997744(DoorShutter* this, GlobalContext* globalCtx) { void DoorShutter_Update(Actor* thisx, GlobalContext* globalCtx) { DoorShutter* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(player->stateFlags1 & 0x100004C0) || (this->actionFunc == DoorShutter_SetupType)) { 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 0dee0a37f8..dc2c52e43e 100644 --- a/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c +++ b/src/overlays/actors/ovl_Eff_Dust/z_eff_dust.c @@ -174,7 +174,7 @@ void EffDust_UpdateFunc_8099DD74(EffDust* this, GlobalContext* globalCtx) { void EffDust_UpdateFunc_8099DFC0(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; @@ -316,7 +316,7 @@ void EffDust_DrawFunc_8099E784(Actor* thisx, GlobalContext* globalCtx2) { Vec3f* initialPositions; s32 i; f32 aux; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); OPEN_DISPS(gfxCtx, "../z_eff_dust.c", 472); diff --git a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c index 6f4ae05a5f..12bfb380a4 100644 --- a/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c +++ b/src/overlays/actors/ovl_Elf_Msg/z_elf_msg.c @@ -172,7 +172,7 @@ s32 ElfMsg_GetMessageId(ElfMsg* this) { } void ElfMsg_CallNaviCuboid(ElfMsg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnElf* navi = (EnElf*)player->naviActor; if ((fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < (100.0f * this->actor.scale.x)) && @@ -189,7 +189,7 @@ s32 ElfMsg_WithinXZDistance(Vec3f* pos1, Vec3f* pos2, f32 distance) { } void ElfMsg_CallNaviCylinder(ElfMsg* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnElf* navi = (EnElf*)player->naviActor; if (ElfMsg_WithinXZDistance(&player->actor.world.pos, &this->actor.world.pos, this->actor.scale.x * 100.0f) && diff --git a/src/overlays/actors/ovl_En_Am/z_en_am.c b/src/overlays/actors/ovl_En_Am/z_en_am.c index 55e3256028..694898c5a7 100644 --- a/src/overlays/actors/ovl_En_Am/z_en_am.c +++ b/src/overlays/actors/ovl_En_Am/z_en_am.c @@ -372,7 +372,7 @@ void EnAm_Sleep(EnAm* this, GlobalContext* globalCtx) { s32 pad; f32 rand; f32 sin; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->unk_258 != 0) || ((this->hurtCollider.base.ocFlags1 & OC1_HIT) && (this->hurtCollider.base.oc == &player->actor)) || @@ -665,7 +665,7 @@ void EnAm_Lunge(EnAm* this, GlobalContext* globalCtx) { } void EnAm_Statue(EnAm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 temp158f = this->dyna.unk_158; s16 moveDir = 0; @@ -907,7 +907,7 @@ void EnAm_Update(Actor* thisx, GlobalContext* globalCtx) { if ((this->behavior >= 4) && (this->unk_264 > 0)) { if (!(this->hitCollider.base.atFlags & AT_BOUNCED)) { if (this->hitCollider.base.atFlags & AT_HIT) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->hitCollider.base.at == &player->actor) { Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); diff --git a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c index 3e6c5c4cd1..02ff9966cc 100644 --- a/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c +++ b/src/overlays/actors/ovl_En_Anubice/z_en_anubice.c @@ -95,7 +95,7 @@ static DamageTable sDamageTable[] = { }; void EnAnubice_Hover(EnAnubice* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->hoverVelocityTimer += 1500.0f; this->targetHeight = player->actor.world.pos.y + this->playerHeightOffset; @@ -109,7 +109,7 @@ void EnAnubice_SetFireballRot(EnAnubice* this, GlobalContext* globalCtx) { f32 x; f32 y; f32 z; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); x = player->actor.world.pos.x - this->fireballPos.x; y = player->actor.world.pos.y + 10.0f - this->fireballPos.y; @@ -204,7 +204,7 @@ void EnAnubice_SetupIdle(EnAnubice* this, GlobalContext* globalCtx) { } void EnAnubice_Idle(EnAnubice* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->actor.shape.yOffset, 0.5f, 300.0f); diff --git a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c index c4db981131..4def28e67e 100644 --- a/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c +++ b/src/overlays/actors/ovl_En_Arrow/z_en_arrow.c @@ -155,7 +155,7 @@ void EnArrow_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void EnArrow_Shoot(EnArrow* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actor.parent == NULL) { if ((this->actor.params != ARROW_NUT) && (player->unk_A73 == 0)) { @@ -389,7 +389,7 @@ void func_809B4640(EnArrow* this, GlobalContext* globalCtx) { void EnArrow_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnArrow* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->isCsNut || ((this->actor.params >= ARROW_NORMAL_LIT) && (player->unk_A73 != 0)) || !Player_InBlockingCsMode(globalCtx, player)) { diff --git a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c index e7a506fa98..7b90cc4a55 100644 --- a/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c +++ b/src/overlays/actors/ovl_En_Attack_Niw/z_en_attack_niw.c @@ -298,7 +298,7 @@ void EnAttackNiw_Update(Actor* thisx, GlobalContext* globalCtx) { f32 tmpf1; EnAttackNiw* this = THIS; EnNiw* cucco; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; Vec3f sp30; GlobalContext* globalCtx2 = globalCtx; diff --git a/src/overlays/actors/ovl_En_Ba/z_en_ba.c b/src/overlays/actors/ovl_En_Ba/z_en_ba.c index a5954c1a4e..a99b1e33c5 100644 --- a/src/overlays/actors/ovl_En_Ba/z_en_ba.c +++ b/src/overlays/actors/ovl_En_Ba/z_en_ba.c @@ -140,7 +140,7 @@ void EnBa_SetupIdle(EnBa* this) { } void EnBa_Idle(EnBa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 i; s32 pad; Vec3s sp5C; @@ -230,7 +230,7 @@ void EnBa_SetupSwingAtPlayer(EnBa* this) { } void EnBa_SwingAtPlayer(EnBa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp; s16 i; Vec3s sp58; diff --git a/src/overlays/actors/ovl_En_Bb/z_en_bb.c b/src/overlays/actors/ovl_En_Bb/z_en_bb.c index 0f349ffb6a..548ea42245 100644 --- a/src/overlays/actors/ovl_En_Bb/z_en_bb.c +++ b/src/overlays/actors/ovl_En_Bb/z_en_bb.c @@ -772,7 +772,7 @@ void EnBb_SetupRed(GlobalContext* globalCtx, EnBb* this) { } void EnBb_Red(EnBb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 floorType; s16 yawDiff; @@ -978,7 +978,7 @@ void EnBb_SetupGreen(EnBb* this) { } void EnBb_Green(EnBb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f bobOffset = { 0.0f, 0.0f, 0.0f }; Vec3f nextPos = player->actor.world.pos; @@ -1331,7 +1331,7 @@ void EnBb_Draw(Actor* thisx, GlobalContext* globalCtx) { 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, this->flamePrimBlue, this->flamePrimAlpha); gDPSetEnvColor(POLY_XLU_DISP++, this->flameEnvColor.r, this->flameEnvColor.g, this->flameEnvColor.b, 0); - Matrix_RotateY(((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) - this->actor.shape.rot.y + 0x8000)) * + Matrix_RotateY(((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000)) * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale(this->flameScaleX * 0.01f, this->flameScaleY * 0.01f, 1.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c index 460831f1f8..ce427a21cc 100644 --- a/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c +++ b/src/overlays/actors/ovl_En_Bdfire/z_en_bdfire.c @@ -122,7 +122,7 @@ void func_809BC2A4(EnBdfire* this, GlobalContext* globalCtx) { void func_809BC598(EnBdfire* this, GlobalContext* globalCtx) { s16 phi_v1_2; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 distToBurn; BossDodongo* bossDodongo; s16 i; diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 53f37b611c..0bcb09c0ac 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -392,7 +392,7 @@ void func_809BD768(EnBigokuta* this) { } void func_809BD7F0(EnBigokuta* this, GlobalContext* globalCtx) { - this->actor.world.rot.y = Actor_WorldYawTowardPoint(globalCtx->actorCtx.actorLists[2].head, &this->actor.home.pos); + this->actor.world.rot.y = Actor_WorldYawTowardPoint(&GET_PLAYER(globalCtx)->actor, &this->actor.home.pos); this->actor.shape.rot.y = this->actor.world.rot.y + (this->unk_194 * 0x4000); func_809BCE3C(this); this->actionFunc = func_809BE518; @@ -477,7 +477,7 @@ void func_809BDB90(EnBigokuta* this, GlobalContext* globalCtx) { } void func_809BDC08(EnBigokuta* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_v0; s16 pad; s16 phi_v1; @@ -573,7 +573,7 @@ void func_809BDFC8(EnBigokuta* this, GlobalContext* globalCtx) { } void func_809BE058(EnBigokuta* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 speedXZ; if (this->unk_196 != 0) { diff --git a/src/overlays/actors/ovl_En_Bili/z_en_bili.c b/src/overlays/actors/ovl_En_Bili/z_en_bili.c index e3b1954ae8..62d5e9196a 100644 --- a/src/overlays/actors/ovl_En_Bili/z_en_bili.c +++ b/src/overlays/actors/ovl_En_Bili/z_en_bili.c @@ -735,7 +735,7 @@ s32 EnBili_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList EnBili_PulseLimb2(this, curFrame, &limbScale); } else if (limbIndex == EN_BILI_LIMB_TENTACLES) { EnBili_PulseLimb4(this, curFrame, &limbScale); - rot->y = (Camera_GetCamDirYaw(ACTIVE_CAM) - this->actor.shape.rot.y) + 0x8000; + rot->y = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y) + 0x8000; } Matrix_Scale(limbScale.x, limbScale.y, limbScale.z, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c index f5eeed4369..1ee789c20f 100644 --- a/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c +++ b/src/overlays/actors/ovl_En_Blkobj/z_en_blkobj.c @@ -80,7 +80,7 @@ void EnBlkobj_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void EnBlkobj_Wait(EnBlkobj* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->dyna.actor.xzDistToPlayer < 120.0f) { EnBlkobj_SetupAction(this, EnBlkobj_SpawnDarkLink); diff --git a/src/overlays/actors/ovl_En_Bom/z_en_bom.c b/src/overlays/actors/ovl_En_Bom/z_en_bom.c index acfbcd50c0..39f5ed8cd5 100644 --- a/src/overlays/actors/ovl_En_Bom/z_en_bom.c +++ b/src/overlays/actors/ovl_En_Bom/z_en_bom.c @@ -206,7 +206,7 @@ void EnBom_Explode(EnBom* this, GlobalContext* globalCtx) { } if (this->timer == 0) { - player = PLAYER; + player = GET_PLAYER(globalCtx); if ((player->stateFlags1 & 0x800) && (player->heldActor == &this->actor)) { player->actor.child = NULL; diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index f0ce24195f..bcbc7535e9 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -454,7 +454,7 @@ void EnBomBowlMan_BeginPlayGame(EnBomBowlMan* this, GlobalContext* globalCtx) { if ((func_8010BDBC(&globalCtx->msgCtx) == this->dialogState) && (func_80106BC8(globalCtx) != 0)) { func_80106CCC(globalCtx); - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); this->startedPlaying = true; if (BREG(2)) { diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c index ff5d514f26..2628d5a84d 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c @@ -174,7 +174,7 @@ void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) { } void EnBomBowlPit_GivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_8002DF54(globalCtx, NULL, 7); this->getItemId = sGetItemIds[this->prizeIndex]; diff --git a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c index db77992f1d..a1a949ae92 100644 --- a/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c +++ b/src/overlays/actors/ovl_En_Bom_Chu/z_en_bom_chu.c @@ -190,7 +190,7 @@ void func_809C5BA8(EnBomChu* this, CollisionPoly* floorPoly, GlobalContext* glob } void EnBomChu_WaitForRelease(EnBomChu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->timer != 0) { this->timer--; diff --git a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c index 2fb31beeda..258ca8d403 100644 --- a/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c +++ b/src/overlays/actors/ovl_En_Bombf/z_en_bombf.c @@ -147,7 +147,7 @@ void EnBombf_GrowBomb(EnBombf* this, GlobalContext* globalCtx) { EnBombf* bombFlower; s32 pad; s32 pad1; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad2; if (this->flowerBombScale >= 1.0f) { @@ -301,7 +301,7 @@ void EnBombf_Explode(EnBombf* this, GlobalContext* globalCtx) { } if (this->timer == 0) { - player = PLAYER; + player = GET_PLAYER(globalCtx); if ((player->stateFlags1 & 0x800) && (player->heldActor == &this->actor)) { player->actor.child = NULL; diff --git a/src/overlays/actors/ovl_En_Boom/z_en_boom.c b/src/overlays/actors/ovl_En_Boom/z_en_boom.c index 6e922f9093..3f43c72ddb 100644 --- a/src/overlays/actors/ovl_En_Boom/z_en_boom.c +++ b/src/overlays/actors/ovl_En_Boom/z_en_boom.c @@ -122,7 +122,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { Vec3f hitPoint; s32 pad2; - player = PLAYER; + player = GET_PLAYER(globalCtx); target = this->moveTo; // If the boomerang is moving toward a targeted actor, handle setting the proper x and y angle to fly toward it. @@ -240,7 +240,7 @@ void EnBoom_Fly(EnBoom* this, GlobalContext* globalCtx) { void EnBoom_Update(Actor* thisx, GlobalContext* globalCtx) { EnBoom* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(player->stateFlags1 & 0x20000000)) { this->actionFunc(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index c5daa2e490..97c9cd60e1 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -285,7 +285,7 @@ void EnBox_FallOnSwitchFlag(EnBox* this, GlobalContext* globalCtx) { // used for types 9, 10 void func_809C9700(EnBox* this, GlobalContext* globalCtx) { s32 treasureFlag = this->dyna.actor.params & 0x1F; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (treasureFlag >= ENBOX_TREASURE_FLAG_UNK_MIN && treasureFlag < ENBOX_TREASURE_FLAG_UNK_MAX) { func_8002F5F0(&this->dyna.actor, globalCtx); @@ -421,7 +421,7 @@ void EnBox_WaitOpen(EnBox* this, GlobalContext* globalCtx) { osSyncPrintf("Actor_Environment_Tbox_On() %d\n", this->dyna.actor.params & 0x1F); Flags_SetTreasure(globalCtx, this->dyna.actor.params & 0x1F); } else { - player = PLAYER; + player = GET_PLAYER(globalCtx); func_8002DBD0(&this->dyna.actor, &sp4C, &player->actor.world.pos); if (sp4C.z > -50.0f && sp4C.z < 0.0f && fabsf(sp4C.y) < 10.0f && fabsf(sp4C.x) < 20.0f && Player_IsFacingActor(&this->dyna.actor, 0x3000, globalCtx)) { diff --git a/src/overlays/actors/ovl_En_Butte/z_en_butte.c b/src/overlays/actors/ovl_En_Butte/z_en_butte.c index 02f8700157..0574c49ddd 100644 --- a/src/overlays/actors/ovl_En_Butte/z_en_butte.c +++ b/src/overlays/actors/ovl_En_Butte/z_en_butte.c @@ -123,7 +123,7 @@ void EnButte_DrawTransformationEffect(EnButte* this, GlobalContext* globalCtx) { alpha = Math_SinS(sTransformationEffectAlpha) * 250; alpha = CLAMP(alpha, 0, 255); - Camera_GetCamDir(&camDir, ACTIVE_CAM); + Camera_GetCamDir(&camDir, GET_ACTIVE_CAM(globalCtx)); Matrix_RotateY(camDir.y * (M_PI / 0x8000), MTXMODE_NEW); Matrix_RotateX(camDir.x * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_RotateZ(camDir.z * (M_PI / 0x8000), MTXMODE_APPLY); @@ -217,7 +217,7 @@ void EnButte_SetupFlyAround(EnButte* this) { void EnButte_FlyAround(EnButte* this, GlobalContext* globalCtx) { EnButteFlightParams* flightParams = &sFlyAroundParams[this->flightParamsIdx]; s16 yaw; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 distSqFromHome; f32 maxDistSqFromHome; f32 minAnimSpeed; @@ -292,7 +292,7 @@ void EnButte_SetupFollowLink(EnButte* this) { void EnButte_FollowLink(EnButte* this, GlobalContext* globalCtx) { static s32 D_809CE410 = 1500; EnButteFlightParams* flightParams = &sFollowLinkParams[this->flightParamsIdx]; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 distSqFromHome; Vec3f swordTip; f32 animSpeed; @@ -399,7 +399,7 @@ void EnButte_Update(Actor* thisx, GlobalContext* globalCtx) { this->unk_260 += 0x600; if ((this->actor.params & 1) == 1) { - if (PLAYER->swordState == 0) { + if (GET_PLAYER(globalCtx)->swordState == 0) { if (this->swordDownTimer > 0) { this->swordDownTimer--; } diff --git a/src/overlays/actors/ovl_En_Bw/z_en_bw.c b/src/overlays/actors/ovl_En_Bw/z_en_bw.c index ac9f2bfb2f..86aba458a2 100644 --- a/src/overlays/actors/ovl_En_Bw/z_en_bw.c +++ b/src/overlays/actors/ovl_En_Bw/z_en_bw.c @@ -192,8 +192,8 @@ void func_809CEA24(EnBw* this, GlobalContext* globalCtx) { s16 sp60; f32 sp5C; f32 sp58; - Player* player = PLAYER; - Player* player2 = PLAYER; + Player* player = GET_PLAYER(globalCtx); + Player* player2 = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); this->unk_244 = this->unk_250 + 0.1f; @@ -435,7 +435,7 @@ void func_809CF8F0(EnBw* this) { } void func_809CF984(EnBw* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 floorPolyType; Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); diff --git a/src/overlays/actors/ovl_En_Bx/z_en_bx.c b/src/overlays/actors/ovl_En_Bx/z_en_bx.c index c113eed0eb..40adca64ad 100644 --- a/src/overlays/actors/ovl_En_Bx/z_en_bx.c +++ b/src/overlays/actors/ovl_En_Bx/z_en_bx.c @@ -131,7 +131,7 @@ void func_809D1D0C(Actor* thisx, GlobalContext* globalCtx) { void EnBx_Update(Actor* thisx, GlobalContext* globalCtx) { EnBx* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 i; s16 tmp32; s32 tmp33; 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 3f1a947619..ce52e7be3c 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 @@ -319,7 +319,7 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { s16 rotationScale; GlobalContext* globalCtx = globalCtx2; EnClearTag* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->frameCounter++; diff --git a/src/overlays/actors/ovl_En_Cow/z_en_cow.c b/src/overlays/actors/ovl_En_Cow/z_en_cow.c index 22635da9f6..c4411a0415 100644 --- a/src/overlays/actors/ovl_En_Cow/z_en_cow.c +++ b/src/overlays/actors/ovl_En_Cow/z_en_cow.c @@ -299,7 +299,7 @@ void EnCow_Update(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; s16 targetX; s16 targetY; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[0].base); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->colliders[1].base); diff --git a/src/overlays/actors/ovl_En_Crow/z_en_crow.c b/src/overlays/actors/ovl_En_Crow/z_en_crow.c index 065ef0865a..1f93f6ed9d 100644 --- a/src/overlays/actors/ovl_En_Crow/z_en_crow.c +++ b/src/overlays/actors/ovl_En_Crow/z_en_crow.c @@ -228,7 +228,7 @@ void EnCrow_SetupRespawn(EnCrow* this) { // Action functions void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 skelanimeUpdated; s16 var; @@ -285,7 +285,7 @@ void EnCrow_FlyIdle(EnCrow* this, GlobalContext* globalCtx) { } void EnCrow_DiveAttack(EnCrow* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 facingPlayer; Vec3f pos; s16 target; diff --git a/src/overlays/actors/ovl_En_Cs/z_en_cs.c b/src/overlays/actors/ovl_En_Cs/z_en_cs.c index 9e1c928a9b..56352db63f 100644 --- a/src/overlays/actors/ovl_En_Cs/z_en_cs.c +++ b/src/overlays/actors/ovl_En_Cs/z_en_cs.c @@ -202,7 +202,7 @@ s32 EnCs_GetTalkState(EnCs* this, GlobalContext* globalCtx) { } s32 EnCs_GetTextID(EnCs* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 textId = Text_GetFaceReaction(globalCtx, 15); if (gSaveContext.itemGetInf[3] & 0x400) { @@ -391,7 +391,7 @@ void EnCs_Wait(EnCs* this, GlobalContext* globalCtx) { } void EnCs_Talk(EnCs* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (SkelAnime_Update(&this->skelAnime) != 0) { EnCs_SetAnimFromIndex(this, this->currentAnimIndex, &this->currentAnimIndex); diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index c7898d7df0..f158e104e7 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -566,7 +566,7 @@ void EnDaiku_EscapeRun(EnDaiku* this, GlobalContext* globalCtx) { void EnDaiku_Update(Actor* thisx, GlobalContext* globalCtx) { EnDaiku* this = THIS; s32 curFrame; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->currentAnimIndex == ENDAIKU_ANIM_RUN) { curFrame = this->skelAnime.curFrame; diff --git a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c index e9fdf252f2..0ae07ac499 100644 --- a/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c +++ b/src/overlays/actors/ovl_En_Daiku_Kakariko/z_en_daiku_kakariko.c @@ -447,7 +447,7 @@ void EnDaikuKakariko_Run(EnDaikuKakariko* this, GlobalContext* globalCtx) { void EnDaikuKakariko_Update(Actor* thisx, GlobalContext* globalCtx) { EnDaikuKakariko* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad2; if (this->currentAnimIndex == 3) { diff --git a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c index 63bca3ea9f..2cf56aeb6b 100644 --- a/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c +++ b/src/overlays/actors/ovl_En_Dekubaba/z_en_dekubaba.c @@ -480,7 +480,7 @@ void EnDekubaba_Wait(EnDekubaba* this, GlobalContext* globalCtx) { } void EnDekubaba_Grow(EnDekubaba* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 headDistHorizontal; f32 headDistVertical; f32 headShiftX; @@ -620,7 +620,7 @@ void EnDekubaba_UpdateHeadPosition(EnDekubaba* this) { } void EnDekubaba_DecideLunge(EnDekubaba* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); if (Animation_OnFrame(&this->skelAnime, 0.0f) || Animation_OnFrame(&this->skelAnime, 12.0f)) { @@ -723,7 +723,7 @@ void EnDekubaba_Lunge(EnDekubaba* this, GlobalContext* globalCtx) { } void EnDekubaba_PrepareLunge(EnDekubaba* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->timer != 0) { this->timer--; diff --git a/src/overlays/actors/ovl_En_Dh/z_en_dh.c b/src/overlays/actors/ovl_En_Dh/z_en_dh.c index 0b91ade158..176ae9df1e 100644 --- a/src/overlays/actors/ovl_En_Dh/z_en_dh.c +++ b/src/overlays/actors/ovl_En_Dh/z_en_dh.c @@ -471,7 +471,7 @@ void EnDh_Death(EnDh* this, GlobalContext* globalCtx) { void EnDh_CollisionCheck(EnDh* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 lastHealth; if ((this->collider2.base.acFlags & AC_HIT) && !this->retreat) { @@ -503,7 +503,7 @@ void EnDh_CollisionCheck(EnDh* this, GlobalContext* globalCtx) { void EnDh_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnDh* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad40; EnDh_CollisionCheck(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Dha/z_en_dha.c b/src/overlays/actors/ovl_En_Dha/z_en_dha.c index 044e2ff63e..297d0f03dd 100644 --- a/src/overlays/actors/ovl_En_Dha/z_en_dha.c +++ b/src/overlays/actors/ovl_En_Dha/z_en_dha.c @@ -194,7 +194,7 @@ void EnDha_Wait(EnDha* this, GlobalContext* globalCtx) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; // unused Vec3f armPosMultiplier1 = { 0.0f, 0.0f, 55.0f }; Vec3f armPosMultiplier2 = { 0.0f, 0.0f, -54.0f }; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; s32 pad2; Vec3f playerPos = player->actor.world.pos; @@ -303,7 +303,7 @@ void EnDha_SetupTakeDamage(EnDha* this) { } void EnDha_TakeDamage(EnDha* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->stateFlags2 & 0x80) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~0x80; @@ -341,7 +341,7 @@ void EnDha_SetupDeath(EnDha* this) { void EnDha_Die(EnDha* this, GlobalContext* globalCtx) { s16 angle; Vec3f vec; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->stateFlags2 & 0x80) && (&this->actor == player->actor.parent)) { player->stateFlags2 &= ~0x80; diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index e951559453..38fb620dd5 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -482,7 +482,7 @@ void func_809EEAF8(EnDivingGame* this, GlobalContext* globalCtx) { void EnDivingGame_Update(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; EnDivingGame* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f pos; if (this->csCameraTimer != 0) { 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 18f504b620..feafc52398 100644 --- a/src/overlays/actors/ovl_En_Dns/z_en_dns.c +++ b/src/overlays/actors/ovl_En_Dns/z_en_dns.c @@ -405,7 +405,7 @@ void func_809EFF50(EnDns* this, GlobalContext* globalCtx) { } void func_809EFF98(EnDns* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags1 & 0x400) { if ((func_8010BDBC(&globalCtx->msgCtx) == 6) && (func_80106BC8(globalCtx) != 0)) { diff --git a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index 2d0b841b82..5def3984c9 100644 --- a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -115,7 +115,7 @@ void EnDntJiji_SetupWait(EnDntJiji* this, GlobalContext* globalCtx) { } void EnDntJiji_Wait(EnDntJiji* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); if ((this->timer == 1) && (this->actor.xzDistToPlayer < 150.0f) && !Gameplay_InCsMode(globalCtx) && @@ -254,7 +254,7 @@ void EnDntJiji_Talk(EnDntJiji* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 3, 0x1388, 0); if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && func_80106BC8(globalCtx)) { - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); func_80106CCC(globalCtx); func_8002DF54(globalCtx, NULL, 7); this->actor.parent = NULL; diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index 1b5f306336..38cae751ec 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -339,8 +339,8 @@ void EnDntNomal_TargetTalk(EnDntNomal* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && func_80106BC8(globalCtx)) { func_80106CCC(globalCtx); - func_8005B1A4(ACTIVE_CAM); - ACTIVE_CAM->csId = 0; + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); + GET_ACTIVE_CAM(globalCtx)->csId = 0; func_8002DF54(globalCtx, NULL, 8); this->actionFunc = EnDntNomal_SetupTargetGivePrize; } @@ -658,7 +658,7 @@ void EnDntNomal_SetupStageAttack(EnDntNomal* this, GlobalContext* globalCtx) { } void EnDntNomal_StageAttack(EnDntNomal* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* nut; f32 frame = this->skelAnime.curFrame; f32 dz; diff --git a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c index 44babe2139..cb15209b7a 100644 --- a/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c +++ b/src/overlays/actors/ovl_En_Dodojr/z_en_dodojr.c @@ -279,7 +279,7 @@ s32 func_809F6DD0(EnDodojr* this) { void func_809F6E54(EnDodojr* this, GlobalContext* globalCtx) { f32 angles[] = { 0.0f, 210.0f, 60.0f, 270.0f, 120.0f, 330.0f, 180.0f, 30.0f, 240.0f, 90.0f, 300.0f, 150.0f }; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f pos; s16 angleIndex; @@ -391,7 +391,7 @@ void func_809F72A4(EnDodojr* this, GlobalContext* globalCtx) { void func_809F73AC(EnDodojr* this, GlobalContext* globalCtx) { f32 lastFrame = Animation_GetLastFrame(&object_dodojr_Anim_000860); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 dist; if (!(this->actor.xzDistToPlayer >= 320.0f)) { 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 e3b8263d3f..ab9ae3f159 100644 --- a/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c +++ b/src/overlays/actors/ovl_En_Dodongo/z_en_dodongo.c @@ -528,7 +528,7 @@ void EnDodongo_SwallowBomb(EnDodongo* this, GlobalContext* globalCtx) { void EnDodongo_Walk(EnDodongo* this, GlobalContext* globalCtx) { s32 pad; f32 playbackSpeed; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawDiff = (s16)(this->actor.yawTowardsPlayer - this->actor.shape.rot.y); yawDiff = ABS(yawDiff); @@ -649,7 +649,7 @@ void EnDodongo_SweepTail(EnDodongo* this, GlobalContext* globalCtx) { Actor_SpawnFloorDustRing(globalCtx, &this->actor, &tailPos, 5.0f, 2, 2.0f, 100, 15, 0); if (this->colliderBody.base.atFlags & AT_HIT) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->colliderBody.base.at == &player->actor) { Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); diff --git a/src/overlays/actors/ovl_En_Door/z_en_door.c b/src/overlays/actors/ovl_En_Door/z_en_door.c index aaaffb78e4..f6b3cd568d 100644 --- a/src/overlays/actors/ovl_En_Door/z_en_door.c +++ b/src/overlays/actors/ovl_En_Door/z_en_door.c @@ -160,7 +160,7 @@ void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx) { this->lockTimer = 10; } } else if (doorType == DOOR_AJAR) { - if (Actor_WorldDistXZToActor(&this->actor, &PLAYER->actor) > DOOR_AJAR_SLAM_RANGE) { + if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor) > DOOR_AJAR_SLAM_RANGE) { this->actionFunc = EnDoor_AjarWait; this->actor.world.rot.y = -0x1800; } @@ -183,7 +183,7 @@ void EnDoor_SetupType(EnDoor* this, GlobalContext* globalCtx) { } void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 doorType; Vec3f playerPosRelToDoor; s16 phi_v0; @@ -209,7 +209,7 @@ void EnDoor_Idle(EnDoor* this, GlobalContext* globalCtx) { if (ABS(phi_v0) < 0x3000) { if (this->lockTimer != 0) { if (gSaveContext.inventory.dungeonKeys[gSaveContext.mapIndex] <= 0) { - Player* player2 = PLAYER; + Player* player2 = GET_PLAYER(globalCtx); player2->naviTextId = -0x203; return; diff --git a/src/overlays/actors/ovl_En_Ds/z_en_ds.c b/src/overlays/actors/ovl_En_Ds/z_en_ds.c index ec0ffbb9a7..b2a0d7cb27 100644 --- a/src/overlays/actors/ovl_En_Ds/z_en_ds.c +++ b/src/overlays/actors/ovl_En_Ds/z_en_ds.c @@ -139,7 +139,7 @@ void EnDs_BrewOddPotion1(EnDs* this, GlobalContext* globalCtx) { } void EnDs_OfferOddPotion(EnDs* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((func_8010BDBC(&globalCtx->msgCtx) == 4) && (func_80106BC8(globalCtx) != 0)) { switch (globalCtx->msgCtx.choiceIndex) { @@ -204,7 +204,7 @@ void EnDs_OfferBluePotion(EnDs* this, GlobalContext* globalCtx) { } void EnDs_Wait(EnDs* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawDiff; if (func_8002F194(&this->actor, globalCtx) != 0) { diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index 190850bcd1..c5a9c86f22 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -147,7 +147,7 @@ s32 func_809FDDB4(EnDu* this, GlobalContext* globalCtx) { } void func_809FDE24(EnDu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_a3 = 0; if (this->unk_1F4.unk_00 == 0) { @@ -295,7 +295,7 @@ void func_809FE3B4(EnDu* this, GlobalContext* globalCtx) { } void func_809FE3C0(EnDu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags2 & 0x1000000) { func_8010BD88(globalCtx, 0x22); @@ -314,7 +314,7 @@ void func_809FE3C0(EnDu* this, GlobalContext* globalCtx) { } void func_809FE4A4(EnDu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (globalCtx->msgCtx.unk_E3EE == 4) { globalCtx->msgCtx.unk_E3EE = 0; @@ -338,7 +338,7 @@ void func_809FE4A4(EnDu* this, GlobalContext* globalCtx) { } void func_809FE638(EnDu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(player->stateFlags1 & 0x20000000)) { OnePointCutscene_Init(globalCtx, 3330, -99, &this->actor, MAIN_CAM); @@ -368,7 +368,7 @@ void func_809FE6CC(EnDu* this, GlobalContext* globalCtx) { void func_809FE740(EnDu* this, GlobalContext* globalCtx) { if (this->unk_1F4.unk_00 == 0) { - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); this->unk_1E2 = 0x5A; EnDu_SetupAction(this, func_809FE798); } diff --git a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c index 5670644917..7a95a0325f 100644 --- a/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c +++ b/src/overlays/actors/ovl_En_Eiyer/z_en_eiyer.c @@ -256,7 +256,7 @@ void EnEiyer_SetupStartAttack(EnEiyer* this) { } void EnEiyer_SetupDiveAttack(EnEiyer* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.velocity.y = 0.0f; this->basePos.y = player->actor.world.pos.y + 15.0f; @@ -452,7 +452,7 @@ void EnEiyer_Glide(EnEiyer* this, GlobalContext* globalCtx) { } void EnEiyer_StartAttack(EnEiyer* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f focus; SkelAnime_Update(&this->skelanime); diff --git a/src/overlays/actors/ovl_En_Elf/z_en_elf.c b/src/overlays/actors/ovl_En_Elf/z_en_elf.c index 5a46163223..f5c1c216fa 100644 --- a/src/overlays/actors/ovl_En_Elf/z_en_elf.c +++ b/src/overlays/actors/ovl_En_Elf/z_en_elf.c @@ -211,7 +211,7 @@ s32 func_80A01F90(Vec3f* this, Vec3f* arg1, f32 arg2) { } void func_80A01FE0(EnElf* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!func_80A01F90(&this->actor.world.pos, &player->actor.world.pos, 30.0f)) { this->unk_2B8 = 0.5f; @@ -231,7 +231,7 @@ void func_80A01FE0(EnElf* this, GlobalContext* globalCtx) { } void func_80A020A4(EnElf* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_80A01F90(&this->actor.world.pos, &player->actor.world.pos, 50.0f)) { if (this->unk_2C0 > 0) { @@ -316,7 +316,7 @@ f32 EnElf_GetColorValue(s32 colorFlag) { void EnElf_Init(Actor* thisx, GlobalContext* globalCtx) { EnElf* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 colorConfig; s32 i; @@ -462,7 +462,7 @@ void func_80A02AA4(EnElf* this, GlobalContext* globalCtx) { } void func_80A02B38(EnElf* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_2AA = (this->unk_2AC * 2) & 0xFFFF; this->unk_28C.x = Math_SinS(this->unk_2AC) * this->unk_2B8; @@ -538,7 +538,7 @@ void func_80A02F2C(EnElf* this, Vec3f* targetPos) { void func_80A03018(EnElf* this, GlobalContext* globalCtx) { s32 pad[2]; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 targetYaw; Vec3f* unk_28C = &this->unk_28C; @@ -598,9 +598,9 @@ void func_80A03148(EnElf* this, Vec3f* arg1, f32 arg2, f32 arg3, f32 arg4) { } void func_80A0329C(EnElf* this, GlobalContext* globalCtx) { - Player* refActor = PLAYER; + Player* refActor = GET_PLAYER(globalCtx); s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 heightDiff; SkelAnime_Update(&this->skelAnime); @@ -689,7 +689,7 @@ void func_80A03604(EnElf* this, GlobalContext* globalCtx) { } void func_80A03610(EnElf* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); Math_SmoothStepToF(&this->unk_2B8, 30.0f, 0.1f, 4.0f, 1.0f); @@ -732,7 +732,7 @@ void func_80A03610(EnElf* this, GlobalContext* globalCtx) { } void func_80A03814(EnElf* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); @@ -767,7 +767,7 @@ void func_80A03814(EnElf* this, GlobalContext* globalCtx) { } void func_80A03990(EnElf* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); @@ -816,7 +816,7 @@ void EnElf_UpdateLights(EnElf* this, GlobalContext* globalCtx) { } if (this->fairyFlags & 0x20) { - player = PLAYER; + player = GET_PLAYER(globalCtx); Lights_PointNoGlowSetInfo(&this->lightInfoNoGlow, player->actor.world.pos.x, (s16)(player->actor.world.pos.y) + 60.0f, player->actor.world.pos.z, 255, 255, 255, 200); @@ -836,7 +836,7 @@ void EnElf_UpdateLights(EnElf* this, GlobalContext* globalCtx) { void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { Vec3f nextPos; Vec3f prevPos; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* arrowPointedActor; f32 xScale; f32 distFromLinksHead; @@ -928,7 +928,7 @@ void func_80A03CF8(EnElf* this, GlobalContext* globalCtx) { } break; case 12: - nextPos = ACTIVE_CAM->eye; + nextPos = GET_ACTIVE_CAM(globalCtx)->eye; nextPos.y += (-2000.0f * this->actor.scale.y); func_80A03148(this, &nextPos, 0.0f, 20.0f, 0.2f); break; @@ -1000,7 +1000,7 @@ void EnElf_ChangeColor(Color_RGBAf* dest, Color_RGBAf* newColor, Color_RGBAf* cu void func_80A04414(EnElf* this, GlobalContext* globalCtx) { Actor* arrowPointedActor = globalCtx->actorCtx.targetCtx.arrowPointedActor; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 transitionRate; u16 targetSound; @@ -1057,7 +1057,7 @@ void func_80A04414(EnElf* this, GlobalContext* globalCtx) { void func_80A0461C(EnElf* this, GlobalContext* globalCtx) { s32 temp; Actor* arrowPointedActor; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (globalCtx->csCtx.state != CS_STATE_IDLE) { if (globalCtx->csCtx.npcActions[8] != NULL) { @@ -1212,7 +1212,7 @@ void func_80A04D90(EnElf* this, GlobalContext* globalCtx) { // move to talk to player void func_80A04DE4(EnElf* this, GlobalContext* globalCtx) { Vec3f headCopy; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f naviRefPos; if (this->fairyFlags & 0x10) { @@ -1243,7 +1243,7 @@ void func_80A04DE4(EnElf* this, GlobalContext* globalCtx) { // move after talking to player void func_80A04F94(EnElf* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_SmoothStepToS(&this->actor.shape.rot.y, this->unk_2BC, 5, 0x1000, 0x400); this->timer++; @@ -1366,7 +1366,7 @@ void func_80A052F4(Actor* thisx, GlobalContext* globalCtx) { void func_80A053F0(Actor* thisx, GlobalContext* globalCtx) { u8 unk2C7; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnElf* this = THIS; if (player->naviTextId == 0) { @@ -1496,7 +1496,7 @@ void EnElf_Draw(Actor* thisx, GlobalContext* globalCtx) { EnElf* this = THIS; s32 pad1; Gfx* dListHead; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->unk_2A8 != 8) && !(this->fairyFlags & 8)) { if (!(player->stateFlags1 & 0x100000) || (kREG(90) < this->actor.projectedPos.z)) { diff --git a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c index 458b7376bf..91f5113c7f 100644 --- a/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c +++ b/src/overlays/actors/ovl_En_Encount1/z_en_encount1.c @@ -92,7 +92,7 @@ void EnEncount1_Init(Actor* thisx, GlobalContext* globalCtx) { } void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 floorType; f32 spawnDist; s32 spawnParams; @@ -177,7 +177,7 @@ void EnEncount1_SpawnLeevers(EnEncount1* this, GlobalContext* globalCtx) { } void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 bgId; CollisionPoly* floorPoly; Vec3f spawnPos; @@ -215,7 +215,7 @@ void EnEncount1_SpawnTektites(EnEncount1* this, GlobalContext* globalCtx) { } void EnEncount1_SpawnStalchildOrWolfos(EnEncount1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 spawnDist; s16 spawnAngle; s16 spawnId; diff --git a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c index c5f4fb83d2..350965ba25 100644 --- a/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c +++ b/src/overlays/actors/ovl_En_Encount2/z_en_encount2.c @@ -65,7 +65,7 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { s32 pad; s16 quakeIndex; s16 spawnerState; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); spawnerState = ENCOUNT2_INACTIVE; if (!this->isNotDeathMountain) { @@ -93,7 +93,7 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { break; case ENCOUNT2_ACTIVE_DEATH_MOUNTAIN: if ((this->deathMountainSpawnerTimer == 1) || (!this->isQuaking)) { - quakeIndex = Quake_Add(ACTIVE_CAM, 1); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); Quake_SetSpeed(quakeIndex, 0x7FFF); Quake_SetQuakeValues(quakeIndex, 50, 0, 0, 0); Quake_SetCountdown(quakeIndex, 300); @@ -115,7 +115,7 @@ void EnEncount2_Wait(EnEncount2* this, GlobalContext* globalCtx) { } void EnEncount2_SpawnRocks(EnEncount2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnFireRock* spawnedRock; f32 tempVec1X; f32 tempVec1Y; @@ -311,7 +311,7 @@ void EnEncount2_ParticleInit(EnEncount2* this, Vec3f* particlePos, f32 scale) { void EnEncount2_ParticleUpdate(EnEncount2* this, GlobalContext* globalCtx) { s16 i; EnEncount2Particle* particle = this->particles; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f targetPos; for (i = 0; i < ARRAY_COUNT(this->particles); particle++, i++) { diff --git a/src/overlays/actors/ovl_En_Fd/z_en_fd.c b/src/overlays/actors/ovl_En_Fd/z_en_fd.c index dc27937ff7..de31f11645 100644 --- a/src/overlays/actors/ovl_En_Fd/z_en_fd.c +++ b/src/overlays/actors/ovl_En_Fd/z_en_fd.c @@ -269,7 +269,7 @@ s32 EnFd_CheckHammer(EnFd* this, GlobalContext* globalCtx) { } s32 EnFd_ColliderCheck(EnFd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); ColliderInfo* info; if (this->collider.base.acFlags & AC_HIT || EnFd_CheckHammer(this, globalCtx)) { @@ -374,7 +374,7 @@ Actor* EnFd_FindPotentialTheat(EnFd* this, GlobalContext* globalCtx) { return NULL; } - player = PLAYER; + player = GET_PLAYER(globalCtx); if (!EnFd_CanSeeActor(this, &player->actor, globalCtx)) { return NULL; } diff --git a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c index 0469fda545..25fbba421c 100644 --- a/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c +++ b/src/overlays/actors/ovl_En_Fd_Fire/z_en_fd_fire.c @@ -124,7 +124,7 @@ s32 EnFdFire_CheckCollider(EnFdFire* this, GlobalContext* globalCtx) { void EnFdFire_Init(Actor* thisx, GlobalContext* globalCtx) { EnFdFire* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 20.0f); Collider_InitCylinder(globalCtx, &this->collider); @@ -174,7 +174,7 @@ void EnFdFire_WaitToDie(EnFdFire* this, GlobalContext* globalCtx) { } void EnFdFire_DanceTowardsPlayer(EnFdFire* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 angles[] = { 0.0f, 210.0f, 60.0f, 270.0f, 120.0f, 330.0f, 180.0f, 30.0f, 240.0f, 90.0f, 300.0f, 150.0f, }; @@ -251,14 +251,14 @@ void EnFdFire_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_fd_fire.c", 572); Matrix_Translate(this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, MTXMODE_NEW); - sp8E = Math_Vec3f_Yaw(&scale, &this->actor.velocity) - Camera_GetCamDirYaw(ACTIVE_CAM); + sp8E = Math_Vec3f_Yaw(&scale, &this->actor.velocity) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); sp84 = fabsf(Math_CosS(sp8E)); sp88 = Math_SinS(sp8E); sp80 = Math_Vec3f_DistXZ(&scale, &this->actor.velocity) / 1.5f; if (1) {} if (1) {} if (1) {} - Matrix_RotateY((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_RotateZ(((sp88 * -10.0f) * sp80) * (M_PI / 180.0f), MTXMODE_APPLY); scale.x = scale.y = scale.z = this->scale * 0.001f; Matrix_Scale(scale.x, scale.y, scale.z, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index b1140af905..39c7cc2ad0 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -85,7 +85,7 @@ void EnFhgFire_SetUpdate(EnFhgFire* this, EnFhgFireUpdateFunc updateFunc) { void EnFhgFire_Init(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnFhgFire* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); ActorShape_Init(&this->actor.shape, 0.0f, NULL, 0.0f); if ((this->actor.params == FHGFIRE_LIGHTNING_SHOCK) || (this->actor.params == FHGFIRE_LIGHTNING_BURST) || @@ -284,7 +284,7 @@ void EnFhgFire_LightningTrail(EnFhgFire* this, GlobalContext* globalCtx) { } void EnFhgFire_LightningShock(EnFhgFire* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f pos; if (this->collider.base.atFlags & AT_HIT) { @@ -311,7 +311,7 @@ void EnFhgFire_LightningShock(EnFhgFire* this, GlobalContext* globalCtx) { } void EnFhgFire_LightningBurst(EnFhgFire* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); globalCtx->envCtx.unk_E1 = 0x01; this->actor.shape.rot.y += 0x1000; @@ -423,7 +423,7 @@ void EnFhgFire_EnergyBall(EnFhgFire* this, GlobalContext* globalCtx) { f32 dzPG; u8 killMode = BALL_FIZZLE; u8 canBottleReflect1; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->work[FHGFIRE_KILL_TIMER] != 0) { this->work[FHGFIRE_KILL_TIMER]--; diff --git a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c index 6824895a80..7057cdb7b3 100644 --- a/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c +++ b/src/overlays/actors/ovl_En_Fire_Rock/z_en_fire_rock.c @@ -71,7 +71,7 @@ static ColliderCylinderInit D_80A12CCC = { void EnFireRock_Init(Actor* thisx, GlobalContext* globalCtx) { GlobalContext* globalCtx2 = globalCtx; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnFireRock* this = THIS; s16 temp; @@ -168,7 +168,7 @@ void EnFireRock_Fall(EnFireRock* this, GlobalContext* globalCtx) { Vec3f flamePos; s32 i; - player = PLAYER; + player = GET_PLAYER(globalCtx); if ((this->actor.floorHeight == -10000.0f) || (this->actor.world.pos.y < (player->actor.world.pos.y - 200.0f))) { Actor_Kill(&this->actor); return; @@ -305,8 +305,8 @@ void FireRock_WaitOnFloor(EnFireRock* this, GlobalContext* globalCtx) { void EnFireRock_Update(Actor* thisx, GlobalContext* globalCtx) { EnFireRock* this = THIS; s16 setCollision; - Player* player = PLAYER; - Actor* playerActor = &PLAYER->actor; + Player* player = GET_PLAYER(globalCtx); + Actor* playerActor = &GET_PLAYER(globalCtx)->actor; if (this->timer2 != 0) { this->timer2--; 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 4ee48134c7..1f62e29165 100644 --- a/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c +++ b/src/overlays/actors/ovl_En_Firefly/z_en_firefly.c @@ -296,7 +296,7 @@ void EnFirefly_SetupDisturbDiveAttack(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) { @@ -453,7 +453,7 @@ void EnFirefly_Die(EnFirefly* this, GlobalContext* globalCtx) { } void EnFirefly_DiveAttack(EnFirefly* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f preyPos; SkelAnime_Update(&this->skelAnime); @@ -583,7 +583,7 @@ void EnFirefly_Perch(EnFirefly* this, GlobalContext* globalCtx) { } void EnFirefly_DisturbDiveAttack(EnFirefly* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f preyPos; SkelAnime_Update(&this->skelAnime); diff --git a/src/overlays/actors/ovl_En_Fish/z_en_fish.c b/src/overlays/actors/ovl_En_Fish/z_en_fish.c index b9eab1a3b7..a36993704f 100644 --- a/src/overlays/actors/ovl_En_Fish/z_en_fish.c +++ b/src/overlays/actors/ovl_En_Fish/z_en_fish.c @@ -167,7 +167,7 @@ void EnFish_SetYOffset(EnFish* this) { s32 EnFish_InBottleRange(EnFish* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp1C; if (this->actor.xzDistToPlayer < 32.0f) { @@ -321,7 +321,7 @@ void EnFish_Respawning_SetupApproachPlayer(EnFish* this) { void EnFish_Respawning_ApproachPlayer(EnFish* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad2; Vec3f sp38; s16 yaw; diff --git a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c index 9d103e5bd0..82dc61e61e 100644 --- a/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c +++ b/src/overlays/actors/ovl_En_Floormas/z_en_floormas.c @@ -740,7 +740,7 @@ void EnFloormas_SmShrink(EnFloormas* this, GlobalContext* globalCtx) { } void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); if (this->skelAnime.curFrame < 20.0f) { @@ -761,7 +761,7 @@ void EnFloormas_JumpAtLink(EnFloormas* this, GlobalContext* globalCtx) { } void EnFloormas_GrabLink(EnFloormas* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnFloormas* parent; EnFloormas* child; f32 yDelta; diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index f5a21be366..6c770d9a56 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -599,7 +599,7 @@ s32 EnFr_SetupJumpingUp(EnFr* this, s32 frogIndex) { } void EnFr_Idle(EnFr* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags2 & 0x2000000) { if (globalCtx->msgCtx.unk_E3EE == 4) { 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 954dada518..de2a0f62ea 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -168,7 +168,7 @@ void func_80A1DBA0(EnFu* this, GlobalContext* globalCtx) { } void func_80A1DBD4(EnFu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (globalCtx->msgCtx.unk_E3EE >= 4) { this->actionFunc = EnFu_WaitAdult; @@ -192,7 +192,7 @@ void func_80A1DBD4(EnFu* this, GlobalContext* globalCtx) { } void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->stateFlags2 |= 0x800000; // if dialog state is 7, player has played back the song @@ -203,7 +203,7 @@ void EnFu_WaitForPlayback(EnFu* this, GlobalContext* globalCtx) { } void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->stateFlags2 |= 0x800000; // if dialog state is 2, start song demonstration @@ -217,7 +217,7 @@ void EnFu_TeachSong(EnFu* this, GlobalContext* globalCtx) { void EnFu_WaitAdult(EnFu* this, GlobalContext* globalCtx) { static s16 yawDiff; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; if ((gSaveContext.eventChkInf[5] & 0x800)) { diff --git a/src/overlays/actors/ovl_En_Fw/z_en_fw.c b/src/overlays/actors/ovl_En_Fw/z_en_fw.c index 808ccfa711..adfedf039b 100644 --- a/src/overlays/actors/ovl_En_Fw/z_en_fw.c +++ b/src/overlays/actors/ovl_En_Fw/z_en_fw.c @@ -97,7 +97,7 @@ s32 EnFw_DoBounce(EnFw* this, s32 totalBounces, f32 yVelocity) { } s32 EnFw_PlayerInRange(EnFw* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); CollisionPoly* poly; s32 bgId; Vec3f collisionPos; diff --git a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c index 10fb70a5de..32a2276d62 100644 --- a/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c +++ b/src/overlays/actors/ovl_En_G_Switch/z_en_g_switch.c @@ -236,7 +236,7 @@ void EnGSwitch_SilverRupeeTracker(EnGSwitch* this, GlobalContext* globalCtx) { } void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.shape.rot.y += 0x800; if (this->actor.xyzDistToPlayerSq < 900.0f) { @@ -255,7 +255,7 @@ void EnGSwitch_SilverRupeeIdle(EnGSwitch* this, GlobalContext* globalCtx) { } void EnGSwitch_SilverRupeeCollected(EnGSwitch* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.shape.rot.y += 0x3C0; if (this->killTimer == 0) { diff --git a/src/overlays/actors/ovl_En_Gb/z_en_gb.c b/src/overlays/actors/ovl_En_Gb/z_en_gb.c index 503a7826e9..d94b6da8a6 100644 --- a/src/overlays/actors/ovl_En_Gb/z_en_gb.c +++ b/src/overlays/actors/ovl_En_Gb/z_en_gb.c @@ -271,7 +271,7 @@ void func_80A2F7C0(EnGb* this) { } void func_80A2F83C(EnGb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!func_80A2F760(this)) { if (this->actionTimer != 0) { @@ -319,7 +319,7 @@ void func_80A2F9C0(EnGb* this, GlobalContext* globalCtx) { gSaveContext.infTable[0xB] |= 0x40; } func_80A2F180(this); - Player_UpdateBottleHeld(globalCtx, PLAYER, ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); Rupees_ChangeBy(10); this->actionFunc = func_80A2F83C; } @@ -331,7 +331,7 @@ void func_80A2FA50(EnGb* this, GlobalContext* globalCtx) { gSaveContext.infTable[0xB] |= 0x40; } func_80A2F180(this); - Player_UpdateBottleHeld(globalCtx, PLAYER, ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); Rupees_ChangeBy(50); HIGH_SCORE(HS_POE_POINTS) += 100; if (HIGH_SCORE(HS_POE_POINTS) != 1000) { @@ -340,7 +340,7 @@ void func_80A2FA50(EnGb* this, GlobalContext* globalCtx) { } this->actionFunc = func_80A2F83C; } else { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->exchangeItemId = EXCH_ITEM_NONE; this->textId = 0x70F8; diff --git a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c index 14980ddd96..2fe001b423 100644 --- a/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c +++ b/src/overlays/actors/ovl_En_Ge1/z_en_ge1.c @@ -569,7 +569,7 @@ void EnGe1_WaitDoNothing(EnGe1* this, GlobalContext* globalCtx) { } void EnGe1_BeginGame_Archery(EnGe1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* horse; if ((func_8010BDBC(&globalCtx->msgCtx) == 4) && func_80106BC8(globalCtx)) { @@ -667,7 +667,7 @@ void EnGe1_TalkNoHorse_Archery(EnGe1* this, GlobalContext* globalCtx) { } void EnGe1_Wait_Archery(EnGe1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u16 textId; if (!(player->stateFlags1 & 0x800000)) { diff --git a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c index 5d31eb9f5f..8bb04c75a1 100644 --- a/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c +++ b/src/overlays/actors/ovl_En_Ge2/z_en_ge2.c @@ -198,7 +198,7 @@ s32 Ge2_DetectPlayerInAction(GlobalContext* globalCtx, EnGe2* this) { } s32 Ge2_DetectPlayerInUpdate(GlobalContext* globalCtx, EnGe2* this, Vec3f* pos, s16 yRot, f32 yDetectRange) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f posResult; CollisionPoly* outPoly; f32 visionScale; diff --git a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c index 1ca22f1801..0e0c1b55e4 100644 --- a/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c +++ b/src/overlays/actors/ovl_En_GeldB/z_en_geldb.c @@ -266,7 +266,7 @@ void EnGeldB_Destroy(Actor* thisx, GlobalContext* globalCtx) { } s32 EnGeldB_ReactToPlayer(GlobalContext* globalCtx, EnGeldB* this, s16 arg2) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* thisx = &this->actor; s16 angleToWall; s16 angleToLink; @@ -413,7 +413,7 @@ void EnGeldB_SetupReady(EnGeldB* this) { } void EnGeldB_Ready(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; s16 angleToLink; @@ -480,7 +480,7 @@ void EnGeldB_Advance(EnGeldB* this, GlobalContext* globalCtx) { s32 prevKeyFrame; s32 pad3C; s16 facingAngletoLink; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad30; s32 pad2C; f32 playSpeed; @@ -566,7 +566,7 @@ void EnGeldB_SetupRollForward(EnGeldB* this) { } void EnGeldB_RollForward(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 facingAngleToLink = player->actor.shape.rot.y - this->actor.shape.rot.y; if (SkelAnime_Update(&this->skelAnime)) { @@ -647,7 +647,7 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) { s32 thisKeyFrame; s32 pad; s32 prevKeyFrame; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); if (!EnGeldB_DodgeRanged(globalCtx, this) && !EnGeldB_ReactToPlayer(globalCtx, this, 0)) { @@ -731,7 +731,7 @@ void EnGeldB_Circle(EnGeldB* this, GlobalContext* globalCtx) { void EnGeldB_SetupSpinDodge(EnGeldB* this, GlobalContext* globalCtx) { s16 sp3E; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 lastFrame = Animation_GetLastFrame(&gGerudoRedSidestepAnim); Animation_Change(&this->skelAnime, &gGerudoRedSidestepAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, 0.0f); @@ -839,7 +839,7 @@ void EnGeldB_SetupSlash(EnGeldB* this) { } void EnGeldB_Slash(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 angleFacingLink = player->actor.shape.rot.y - this->actor.shape.rot.y; s16 angleToLink = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; @@ -897,7 +897,7 @@ void EnGeldB_SetupSpinAttack(EnGeldB* this) { } void EnGeldB_SpinAttack(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 angleFacingLink; s16 angleToLink; @@ -1120,7 +1120,7 @@ void EnGeldB_SetupBlock(EnGeldB* this) { } void EnGeldB_Block(EnGeldB* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; s16 angleToLink; s16 angleFacingLink; @@ -1178,7 +1178,7 @@ void EnGeldB_SetupSidestep(EnGeldB* this, GlobalContext* globalCtx) { f32 lastFrame = Animation_GetLastFrame(&gGerudoRedSidestepAnim); Animation_Change(&this->skelAnime, &gGerudoRedSidestepAnim, 1.0f, 0.0f, lastFrame, ANIMMODE_LOOP_INTERP, 0.0f); - player = PLAYER; + player = GET_PLAYER(globalCtx); Math_SmoothStepToS(&this->actor.shape.rot.y, this->actor.yawTowardsPlayer, 1, 0xFA0, 1); linkAngle = player->actor.shape.rot.y; if (Math_SinS(linkAngle - this->actor.shape.rot.y) > 0.0f) { @@ -1199,7 +1199,7 @@ void EnGeldB_SetupSidestep(EnGeldB* this, GlobalContext* globalCtx) { void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { s16 behindLinkAngle; s16 phi_v1; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 thisKeyFrame; s32 prevKeyFrame; f32 playSpeed; @@ -1271,7 +1271,7 @@ void EnGeldB_Sidestep(EnGeldB* this, GlobalContext* globalCtx) { EnGeldB_SetupReady(this); this->timer = (Rand_ZeroOne() * 5.0f) + 1.0f; } else { - Player* player2 = PLAYER; + Player* player2 = GET_PLAYER(globalCtx); s16 angleFacingPlayer2 = player2->actor.shape.rot.y - this->actor.shape.rot.y; this->actor.world.rot.y = this->actor.shape.rot.y; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index cf547d4493..6f19afb9f0 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -168,7 +168,7 @@ void EnGm_SetTextID(EnGm* this) { void func_80A3DB04(EnGm* this, GlobalContext* globalCtx) { f32 dx; f32 dz; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); dx = this->talkPos.x - player->actor.world.pos.x; dz = this->talkPos.z - player->actor.world.pos.z; @@ -194,7 +194,7 @@ void func_80A3DC44(EnGm* this, GlobalContext* globalCtx) { f32 dx; f32 dz; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnGm_SetTextID(this); diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 3f3febac18..c1926e707f 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -90,7 +90,7 @@ void EnGo_SetupAction(EnGo* this, EnGoActionFunc actionFunc) { } u16 EnGo_GetTextID(GlobalContext* globalCtx, Actor* thisx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); switch (thisx->params & 0xF0) { case 0x90: @@ -395,7 +395,7 @@ f32 EnGo_GetGoronSize(EnGo* this) { } void func_80A3F060(EnGo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 unkVal; if (this->actionFunc != EnGo_BiggoronActionFunc && this->actionFunc != EnGo_FireGenericActionFunc && @@ -570,7 +570,7 @@ s32 EnGo_IsRollingOnGround(EnGo* this, s16 unkArg1, f32 unkArg2) { } void func_80A3F908(EnGo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 float1; s32 isUnkCondition; diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index abd0b34f95..dbed3614e4 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -540,7 +540,7 @@ s16 EnGo2_GetStateGoronCityLink(GlobalContext* globalCtx, EnGo2* this) { } u16 EnGo2_GetTextIdGoronDmtBiggoron(GlobalContext* globalCtx, EnGo2* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (gSaveContext.bgsFlag) { player->exchangeItemId = EXCH_ITEM_CLAIM_CHECK; @@ -846,7 +846,7 @@ void EnGo2_SwapInitialFrameAnimFrameCount(EnGo2* this) { } s32 func_80A44AB0(EnGo2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 arg2; if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { @@ -1052,7 +1052,7 @@ void EnGo2_BiggoronSetTextId(EnGo2* this, GlobalContext* globalCtx, Player* play } void func_80A45288(EnGo2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 linkAge; if (this->actionFunc != EnGo2_GoronFireGenericAction) { @@ -1591,7 +1591,7 @@ void EnGo2_CurledUp(EnGo2* this, GlobalContext* globalCtx) { if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { - quake = Quake_Add(ACTIVE_CAM, 3); + quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quake, -0x3CB0); Quake_SetQuakeValues(quake, 8, 0, 0, 0); Quake_SetCountdown(quake, 16); @@ -1797,7 +1797,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { case 1: if (DECR(this->animTimer)) { if (this->animTimer == 60 || this->animTimer == 120) { - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); func_800F4524(&D_801333D4, NA_SE_EV_GORON_WATER_DROP, 60); } } else { @@ -1828,7 +1828,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { } void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); switch (this->goronState) { case 0: @@ -1857,7 +1857,7 @@ void EnGo2_GoronLinkStopRolling(EnGo2* this, GlobalContext* globalCtx) { } void EnGo2_GoronFireGenericAction(EnGo2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3s D_80A4854C = { 0x00, 0x00, 0x00 }; switch (this->goronState) { diff --git a/src/overlays/actors/ovl_En_Goma/z_en_goma.c b/src/overlays/actors/ovl_En_Goma/z_en_goma.c index 7656d0a845..064e4dcdfa 100644 --- a/src/overlays/actors/ovl_En_Goma/z_en_goma.c +++ b/src/overlays/actors/ovl_En_Goma/z_en_goma.c @@ -196,7 +196,8 @@ void EnGoma_SetupFlee(EnGoma* this) { void EnGoma_Flee(EnGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); Math_ApproachF(&this->actor.speedXZ, 6.6666665f, 0.5f, 2.0f); - Math_ApproachS(&this->actor.world.rot.y, Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor) + 0x8000, 3, 2000); + Math_ApproachS(&this->actor.world.rot.y, + Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) + 0x8000, 3, 2000); Math_ApproachS(&this->actor.shape.rot.y, this->actor.world.rot.y, 2, 3000); if (this->actionTimer == 0) { @@ -267,7 +268,7 @@ void EnGoma_EggFallToGround(EnGoma* this, GlobalContext* globalCtx) { } void EnGoma_Egg(EnGoma* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 i; this->eggSquishAngle += 1.0f; @@ -303,7 +304,7 @@ void EnGoma_SetupHatch(EnGoma* this, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.005f); this->gomaType = ENGOMA_NORMAL; this->actionTimer = 5; - this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); this->actor.world.rot.y = this->actor.shape.rot.y; EnGoma_SpawnHatchDebris(this, globalCtx); this->eggScale = 1.0f; @@ -455,7 +456,7 @@ void EnGoma_PrepareJump(EnGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); - targetAngle = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor); + targetAngle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); Math_ApproachS(&this->actor.world.rot.y, targetAngle, 2, 4000); Math_ApproachS(&this->actor.shape.rot.y, targetAngle, 2, 3000); @@ -515,7 +516,8 @@ void EnGoma_Jump(EnGoma* this, GlobalContext* globalCtx) { void EnGoma_Stand(EnGoma* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); Math_ApproachZeroF(&this->actor.speedXZ, 0.5f, 2.0f); - Math_ApproachS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor), 2, 3000); + Math_ApproachS(&this->actor.shape.rot.y, Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor), 2, + 3000); if (this->actionTimer == 0) { EnGoma_SetupChasePlayer(this); @@ -588,8 +590,8 @@ void EnGoma_LookAtPlayer(EnGoma* this, GlobalContext* globalCtx) { s16 eyePitch; s16 eyeYaw; - eyeYaw = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor) - this->actor.shape.rot.y; - eyePitch = Actor_WorldPitchTowardActor(&this->actor, &PLAYER->actor) - this->actor.shape.rot.x; + eyeYaw = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.y; + eyePitch = Actor_WorldPitchTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.shape.rot.x; if (eyeYaw > 6000) { eyeYaw = 6000; @@ -603,7 +605,7 @@ void EnGoma_LookAtPlayer(EnGoma* this, GlobalContext* globalCtx) { void EnGoma_UpdateHit(EnGoma* this, GlobalContext* globalCtx) { static Vec3f sShieldKnockbackVel = { 0.0f, 0.0f, 20.0f }; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->hurtTimer != 0) { this->hurtTimer--; @@ -696,7 +698,7 @@ void EnGoma_SetFloorRot(EnGoma* this) { void EnGoma_Update(Actor* thisx, GlobalContext* globalCtx) { EnGoma* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actionTimer != 0) { this->actionTimer--; diff --git a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c index 0ee3e714bc..a8c40adcdf 100644 --- a/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c +++ b/src/overlays/actors/ovl_En_Goroiwa/z_en_goroiwa.c @@ -379,7 +379,7 @@ s32 EnGoroiwa_MoveDownToNextWaypoint(EnGoroiwa* this, GlobalContext* globalCtx) if (this->actor.velocity.y < 0.0f && this->actor.world.pos.y <= nextPointY) { if (this->bounceCount == 0) { if (this->actor.xzDistToPlayer < 600.0f) { - quakeIdx = Quake_Add(ACTIVE_CAM, 3); + quakeIdx = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quakeIdx, -0x3CB0); Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0); Quake_SetCountdown(quakeIdx, 7); @@ -601,7 +601,7 @@ void EnGoroiwa_Roll(EnGoroiwa* this, GlobalContext* globalCtx) { osSyncPrintf("Player ぶっ飛ばし\n"); osSyncPrintf(VT_RST); onHitSetupFuncs[(this->actor.params >> 10) & 1](this); - func_8002F7DC(&PLAYER->actor, NA_SE_PL_BODY_HIT); + func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; } @@ -683,7 +683,7 @@ void EnGoroiwa_MoveUp(EnGoroiwa* this, GlobalContext* globalCtx) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); - func_8002F7DC(&PLAYER->actor, NA_SE_PL_BODY_HIT); + func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; } @@ -708,7 +708,7 @@ void EnGoroiwa_MoveDown(EnGoroiwa* this, GlobalContext* globalCtx) { if (this->collider.base.atFlags & AT_HIT) { this->collider.base.atFlags &= ~AT_HIT; func_8002F6D4(globalCtx, &this->actor, 2.0f, this->actor.yawTowardsPlayer, 0.0f, 4); - func_8002F7DC(&PLAYER->actor, NA_SE_PL_BODY_HIT); + func_8002F7DC(&GET_PLAYER(globalCtx)->actor, NA_SE_PL_BODY_HIT); if ((this->actor.home.rot.z & 1) == 1) { this->collisionDisabledTimer = 50; } @@ -722,7 +722,7 @@ void EnGoroiwa_MoveDown(EnGoroiwa* this, GlobalContext* globalCtx) { void EnGoroiwa_Update(Actor* thisx, GlobalContext* globalCtx) { EnGoroiwa* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; UNK_TYPE sp30; diff --git a/src/overlays/actors/ovl_En_Gs/z_en_gs.c b/src/overlays/actors/ovl_En_Gs/z_en_gs.c index 7386793458..b5fcac6a9d 100644 --- a/src/overlays/actors/ovl_En_Gs/z_en_gs.c +++ b/src/overlays/actors/ovl_En_Gs/z_en_gs.c @@ -139,7 +139,7 @@ s32 func_80A4E3EC(EnGs* this, GlobalContext* globalCtx) { } void func_80A4E470(EnGs* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); bREG(15) = 0; if (this->actor.xzDistToPlayer <= 100.0f) { diff --git a/src/overlays/actors/ovl_En_Guest/z_en_guest.c b/src/overlays/actors/ovl_En_Guest/z_en_guest.c index 1fedbdf4e1..cab8dcb23c 100644 --- a/src/overlays/actors/ovl_En_Guest/z_en_guest.c +++ b/src/overlays/actors/ovl_En_Guest/z_en_guest.c @@ -150,7 +150,7 @@ void func_80A505CC(Actor* thisx, GlobalContext* globalCtx) { s32 pad; Player* player; - player = PLAYER; + player = GET_PLAYER(globalCtx); this->unk_2C8++; func_80A5046C(this); diff --git a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c index 82b3c7c586..a1a782fb77 100644 --- a/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c +++ b/src/overlays/actors/ovl_En_Heishi1/z_en_heishi1.c @@ -232,7 +232,7 @@ void EnHeishi1_SetupMoveToLink(EnHeishi1* this, GlobalContext* globalCtx) { } void EnHeishi1_MoveToLink(EnHeishi1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); Math_ApproachF(&this->actor.world.pos.x, player->actor.world.pos.x, 1.0f, this->moveSpeed); @@ -391,7 +391,7 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { s16 path; u8 i; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad2; Camera* activeCam; @@ -407,7 +407,7 @@ void EnHeishi1_Update(Actor* thisx, GlobalContext* globalCtx) { this->waypointTimer--; } - activeCam = ACTIVE_CAM; + activeCam = GET_ACTIVE_CAM(globalCtx); if (player->actor.freezeTimer == 0) { diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index e82e065c8a..ecbee0dfa6 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -394,7 +394,7 @@ void func_80A5399C(EnHeishi2* this, GlobalContext* globalCtx) { } void func_80A53AD4(EnHeishi2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 exchangeItemId; s16 yawDiffTemp; s16 yawDiff; diff --git a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c index 15b27bda7c..5627963bad 100644 --- a/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c +++ b/src/overlays/actors/ovl_En_Heishi3/z_en_heishi3.c @@ -113,7 +113,7 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx) s16 yawDiffNew; f32 sightRange; - player = PLAYER; + player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; yawDiffNew = ABS(yawDiff); @@ -145,7 +145,7 @@ void EnHeishi3_StandSentinelInGrounds(EnHeishi3* this, GlobalContext* globalCtx) * Handles the guards standing in front of Hyrule Castle. **/ void EnHeishi3_StandSentinelInCastle(EnHeishi3* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); if ((player->actor.world.pos.x < -190.0f) && (player->actor.world.pos.x > -380.0f) && diff --git a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c index 2d59c887bb..8955307c7c 100644 --- a/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c +++ b/src/overlays/actors/ovl_En_Heishi4/z_en_heishi4.c @@ -343,7 +343,7 @@ void func_80A56B40(EnHeishi4* this, GlobalContext* globalCtx) { void EnHeishi4_Update(Actor* thisx, GlobalContext* globalCtx) { EnHeishi4* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); thisx->world.pos.x = this->pos.x; thisx->world.pos.y = this->pos.y; diff --git a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c index 6c2042fa86..8f9791b308 100644 --- a/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c +++ b/src/overlays/actors/ovl_En_Hintnuts/z_en_hintnuts.c @@ -409,11 +409,11 @@ void EnHintnuts_Leave(EnHintnuts* this, GlobalContext* globalCtx) { if (this->actor.bgCheckFlags & 8) { temp_a1 = this->actor.wallYaw; } else { - temp_a1 = this->actor.yawTowardsPlayer - Camera_GetCamDirYaw(ACTIVE_CAM) - 0x8000; + temp_a1 = this->actor.yawTowardsPlayer - Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - 0x8000; if (ABS(temp_a1) >= 0x4001) { - temp_a1 = Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000; + temp_a1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000; } else { - temp_a1 = Camera_GetCamDirYaw(ACTIVE_CAM) - (temp_a1 >> 1) + 0x8000; + temp_a1 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - (temp_a1 >> 1) + 0x8000; } } Math_ScaledStepToS(&this->actor.shape.rot.y, temp_a1, 0x800); 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 f3972e5224..999c646202 100644 --- a/src/overlays/actors/ovl_En_Holl/z_en_holl.c +++ b/src/overlays/actors/ovl_En_Holl/z_en_holl.c @@ -135,7 +135,7 @@ void EnHoll_SwapRooms(GlobalContext* globalCtx) { // Horizontal Planes void func_80A58DD4(EnHoll* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 phi_t0 = ((globalCtx->sceneNum == SCENE_JYASINZOU) ? 1 : 0) & 0xFFFFFFFF; Vec3f vec; f32 absZ; @@ -171,7 +171,7 @@ void func_80A58DD4(EnHoll* this, GlobalContext* globalCtx) { // Horizontal Planes void func_80A59014(EnHoll* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 useViewEye = gDbgCamEnabled || globalCtx->csCtx.state != CS_STATE_IDLE; Vec3f vec; s32 temp; @@ -202,7 +202,7 @@ void func_80A59014(EnHoll* this, GlobalContext* globalCtx) { // Vertical Planes void func_80A591C0(EnHoll* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 absY = fabsf(this->actor.yDistToPlayer); s32 transitionActorIdx; @@ -282,7 +282,7 @@ void func_80A59520(EnHoll* this, GlobalContext* globalCtx) { // Horizontal Planes void func_80A59618(EnHoll* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f vec; f32 absZ; s32 side; diff --git a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c index b2656c7339..23e30d1edc 100644 --- a/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c +++ b/src/overlays/actors/ovl_En_Honotrap/z_en_honotrap.c @@ -197,7 +197,7 @@ void EnHonotrap_InitFlame(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetInfo(&this->actor.colChkInfo, NULL, &sColChkInfoInit); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawCircle, 30.0f); this->actor.shape.shadowAlpha = 128; - this->targetPos = PLAYER->actor.world.pos; + this->targetPos = GET_PLAYER(globalCtx)->actor.world.pos; this->targetPos.y += 10.0f; this->flameScroll = Rand_ZeroOne() * 511.0f; EnHonotrap_SetupFlame(this); @@ -370,7 +370,7 @@ void EnHonotrap_FlameMove(EnHonotrap* this, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.0f, 10.0f, 0.0f, 0x1D); if (this->collider.tris.base.atFlags & AT_BOUNCED) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f shieldNorm; Vec3f tempVel; Vec3f shieldVec; @@ -421,7 +421,7 @@ void EnHonotrap_FlameChase(EnHonotrap* this, GlobalContext* globalCtx) { func_8002D7EC(&this->actor); Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 7.0f, 10.0f, 0.0f, 0x1D); if (this->collider.cyl.base.atFlags & AT_BOUNCED) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3s shieldRot; Matrix_MtxFToYXZRotS(&player->shieldMf, &shieldRot, false); @@ -519,7 +519,8 @@ void EnHonotrap_DrawFlame(Actor* thisx, GlobalContext* globalCtx) { Gfx_TwoTexScroll(globalCtx->state.gfxCtx, 0, 0, 0, 0x20, 0x40, 1, 0, this->flameScroll, 0x20, 0x80)); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 200, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) - this->actor.shape.rot.y + 0x8000) * (M_PI / 0x8000), + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000) * + (M_PI / 0x8000), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_honotrap.c", 1024), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 4b57e36b12..6468322bb5 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -583,8 +583,8 @@ void EnHorse_UpdateIngoRaceInfo(EnHorse* this, GlobalContext* globalCtx, RaceInf this->actor.shape.rot.y = this->actor.world.rot.y; } - sp50 = Actor_WorldDistXZToActor(&this->actor, &PLAYER->actor); - relPlayerYaw = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor) - this->actor.world.rot.y; + sp50 = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); + relPlayerYaw = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; if (sp50 <= 200.0f || (fabsf(Math_SinS(relPlayerYaw)) < 0.8f && Math_CosS(relPlayerYaw) > 0.0f)) { if (this->actor.speedXZ < this->ingoHorseMaxSpeed) { this->actor.speedXZ += 0.47f; @@ -677,7 +677,7 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { for (i = 0; i < 169; i++) { if (sHorseSpawns[i].scene == globalCtx->sceneNum) { - player = PLAYER; + player = GET_PLAYER(globalCtx); if (globalCtx->sceneNum != SCENE_SPOT20 || //! Same flag checked twice (Flags_GetEventChkInf(0x18) && ((gSaveContext.eventInf[0] & 0xF) != 6 || Flags_GetEventChkInf(0x18))) || @@ -698,7 +698,7 @@ s32 EnHorse_Spawn(EnHorse* this, GlobalContext* globalCtx) { this->actor.world.pos.z = sHorseSpawns[i].pos.z; this->actor.prevPos = this->actor.world.pos; this->actor.world.rot.y = sHorseSpawns[i].angle; - this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor); + this->actor.shape.rot.y = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); spawn = true; SkinMatrix_Vec3fMtxFMultXYZW(&globalCtx->mf_11D60, &this->actor.world.pos, &this->actor.projectedPos, &this->actor.projectedW); @@ -720,9 +720,9 @@ void EnHorse_ResetRace(EnHorse* this, GlobalContext* globalCtx) { } s32 EnHorse_PlayerCanMove(EnHorse* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); - if ((player->stateFlags1 & 1) || func_8002DD78(PLAYER) == 1 || (player->stateFlags1 & 0x100000) || + if ((player->stateFlags1 & 1) || func_8002DD78(GET_PLAYER(globalCtx)) == 1 || (player->stateFlags1 & 0x100000) || ((this->stateFlags & ENHORSE_FLAG_19) && !this->inRace) || this->action == ENHORSE_ACT_HBA || player->actor.flags & 0x100 || globalCtx->csCtx.state != 0) { return false; @@ -908,7 +908,7 @@ void EnHorse_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void EnHorse_RotateToPlayer(EnHorse* this, GlobalContext* globalCtx) { - EnHorse_RotateToPoint(this, globalCtx, &PLAYER->actor.world.pos, 400); + EnHorse_RotateToPoint(this, globalCtx, &GET_PLAYER(globalCtx)->actor.world.pos, 400); if (this->stateFlags & ENHORSE_OBSTACLE) { this->actor.world.rot.y += 800.0f; } @@ -1514,7 +1514,7 @@ void EnHorse_Reverse(EnHorse* this, GlobalContext* globalCtx) { f32 stickMag; s16 stickAngle; s16 turnAmount; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnHorse_PlayWalkingSound(this); EnHorse_StickDirection(&this->curStick, &stickMag, &stickAngle); @@ -1866,7 +1866,7 @@ void EnHorse_SetFollowAnimation(EnHorse* this, GlobalContext* globalCtx) { s32 animId = ENHORSE_ANIM_WALK; f32 distToPlayer; - distToPlayer = Actor_WorldDistXZToActor(&this->actor, &PLAYER->actor); + distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); if (distToPlayer > 400.0f) { animId = ENHORSE_ANIM_GALLOP; } else if (!(distToPlayer <= 300.0f)) { @@ -1904,14 +1904,14 @@ void EnHorse_FollowPlayer(EnHorse* this, GlobalContext* globalCtx) { f32 angleDiff; DREG(53) = 0; - distToPlayer = Actor_WorldDistXZToActor(&this->actor, &PLAYER->actor); + distToPlayer = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); // First rotate if the player is behind if ((this->playerDir == PLAYER_DIR_BACK_R || this->playerDir == PLAYER_DIR_BACK_L) && (distToPlayer > 300.0f && !(this->stateFlags & ENHORSE_TURNING_TO_PLAYER))) { this->animationIdx = ENHORSE_ANIM_REARING; this->stateFlags |= ENHORSE_TURNING_TO_PLAYER; - this->angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor); + this->angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor); angleDiff = (f32)this->angleToPlayer - (f32)this->actor.world.rot.y; if (angleDiff > 32767.f) { angleDiff -= 32767.0f; @@ -2565,7 +2565,7 @@ void EnHorse_InitFleePlayer(EnHorse* this) { } void EnHorse_FleePlayer(EnHorse* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 distToHome; f32 playerDistToHome; f32 distToPlayer; @@ -2998,7 +2998,7 @@ s32 EnHorse_GetMountSide(EnHorse* this, GlobalContext* globalCtx); void EnHorse_MountDismount(EnHorse* this, GlobalContext* globalCtx) { s32 pad[2]; s32 mountSide; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); mountSide = EnHorse_GetMountSide(this, globalCtx); if (mountSide != 0 && !(this->stateFlags & ENHORSE_UNRIDEABLE) && player->rideActor == NULL) { @@ -3382,7 +3382,7 @@ void EnHorse_UpdatePlayerDir(EnHorse* this, GlobalContext* globalCtx) { f32 s; f32 c; - angle = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor) - this->actor.world.rot.y; + angle = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; s = Math_SinS(angle); c = Math_CosS(angle); if (s > 0.8660254f) { @@ -3433,7 +3433,7 @@ void EnHorse_TiltBody(EnHorse* this, GlobalContext* globalCtx) { } s32 EnHorse_UpdateConveyors(EnHorse* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 conveyorDir; if ((this->actor.floorPoly == NULL) && (this != (EnHorse*)player->rideActor)) { @@ -3462,7 +3462,7 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; Vec3f dustAcc = { 0.0f, 0.0f, 0.0f }; Vec3f dustVel = { 0.0f, 1.0f, 0.0f }; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->lastYaw = thisx->shape.rot.y; EnHorse_UpdateStick(this, globalCtx); @@ -3640,7 +3640,7 @@ s32 EnHorse_GetMountSide(EnHorse* this, GlobalContext* globalCtx) { if ((this->animationIdx != ENHORSE_ANIM_IDLE) && (this->animationIdx != ENHORSE_ANIM_WHINNEY)) { return 0; } - return EnHorse_MountSideCheck(this, globalCtx, PLAYER); + return EnHorse_MountSideCheck(this, globalCtx, GET_PLAYER(globalCtx)); } void EnHorse_RandomOffset(Vec3f* src, f32 dist, Vec3f* dst) { diff --git a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c index 3287b26d3f..8234f6698a 100644 --- a/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c +++ b/src/overlays/actors/ovl_En_Horse_Game_Check/z_en_horse_game_check.c @@ -135,7 +135,7 @@ void EnHorseGameCheck_FinishIngoRace(EnHorseGameCheckIngoRace* this, GlobalConte s32 EnHorseGameCheck_UpdateIngoRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { EnHorseGameCheckIngoRace* this = (EnHorseGameCheckIngoRace*)base; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 i; EnHorse* ingoHorse; EnHorse* horse; @@ -240,7 +240,7 @@ s32 EnHorseGameCheck_DestroyGerudoArchery(EnHorseGameCheckBase* base, GlobalCont s32 EnHorseGameCheck_UpdateGerudoArchery(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { EnHorseGameCheckGerudoArchery* this = (EnHorseGameCheckGerudoArchery*)base; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnHorse* horse = (EnHorse*)player->rideActor; if (horse == NULL) { @@ -316,7 +316,7 @@ void EnHorseGameCheck_FinishMalonRace(EnHorseGameCheckMalonRace* this, GlobalCon s32 EnHorseGameCheck_UpdateMalonRace(EnHorseGameCheckBase* base, GlobalContext* globalCtx) { EnHorseGameCheckMalonRace* this = (EnHorseGameCheckMalonRace*)base; s32 i; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnHorse* horse; if (!(this->raceFlags & MALONRACE_PLAYER_ON_MARK) && AT_FINISH_LINE(player->rideActor)) { diff --git a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c index d85c38be39..e389b733ab 100644 --- a/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c +++ b/src/overlays/actors/ovl_En_Horse_Ganon/z_en_horse_ganon.c @@ -140,7 +140,7 @@ void func_80A686A8(EnHorseGanon* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y = this->actor.world.rot.y; - if (Actor_WorldDistXZToActor(&this->actor, &PLAYER->actor) <= 300.0f) { + if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor) <= 300.0f) { if (this->actor.speedXZ < 12.0f) { this->actor.speedXZ += 1.0f; } else { diff --git a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c index 66e43fb0b7..bad75d9a0f 100644 --- a/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c +++ b/src/overlays/actors/ovl_En_Horse_Link_Child/z_en_horse_link_child.c @@ -225,7 +225,7 @@ void func_80A699FC(EnHorseLinkChild* this, GlobalContext* globalCtx) { f32 distFromLink; s32 newAnimationIdx; - distFromLink = Actor_WorldDistXZToActor(&this->actor, &PLAYER->actor); + distFromLink = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); if (SkelAnime_Update(&this->skin.skelAnime)) { if ((distFromLink < 1000.0f) && (distFromLink > 70.0f)) { @@ -258,7 +258,7 @@ void func_80A69C18(EnHorseLinkChild* this, GlobalContext* globalCtx) { s32 newAnimationIdx; if ((this->animationIdx == 4) || (this->animationIdx == 3) || (this->animationIdx == 2)) { - yawDiff = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor) - this->actor.world.rot.y; + yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; if (yawDiff > 0x12C) { this->actor.world.rot.y += 0x12C; @@ -272,7 +272,7 @@ void func_80A69C18(EnHorseLinkChild* this, GlobalContext* globalCtx) { } if (SkelAnime_Update(&this->skin.skelAnime)) { - distFromLink = Actor_WorldDistXZToActor(&this->actor, &PLAYER->actor); + distFromLink = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); if (distFromLink > 1000.0f) { func_80A6993C(this, 0); @@ -318,7 +318,7 @@ void func_80A69F5C(EnHorseLinkChild* this, GlobalContext* globalCtx) { s32 yawOffset; if ((this->animationIdx == 4) || (this->animationIdx == 3) || (this->animationIdx == 2)) { - player = PLAYER; + player = GET_PLAYER(globalCtx); if (Math3D_Vec3f_DistXYZ(&player->actor.world.pos, &this->actor.home.pos) < 250.0f) { yawDiff = player->actor.shape.rot.y; @@ -350,7 +350,7 @@ void func_80A6A068(EnHorseLinkChild* this, GlobalContext* globalCtx) { f32 distLinkFromHome; func_80A69F5C(this, globalCtx); - player = PLAYER; + player = GET_PLAYER(globalCtx); distFromLink = Actor_WorldDistXZToActor(&this->actor, &player->actor); if (gSaveContext.entranceIndex == 0x2AE) { @@ -451,10 +451,10 @@ void func_80A6A5A4(EnHorseLinkChild* this, GlobalContext* globalCtx) { func_80A6A724(this); } else { this->actor.speedXZ = 0.0f; - yawDiff = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor) - this->actor.world.rot.y; + yawDiff = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; // 0.7071 = cos(pi/4) if ((Math_CosS(yawDiff) < 0.7071f) && (this->animationIdx == 2)) { - func_8006DD9C(&this->actor, &PLAYER->actor.world.pos, 300); + func_8006DD9C(&this->actor, &GET_PLAYER(globalCtx)->actor.world.pos, 300); } if (SkelAnime_Update(&this->skin.skelAnime)) { @@ -480,7 +480,7 @@ void func_80A6A724(EnHorseLinkChild* this) { } void func_80A6A7D0(EnHorseLinkChild* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 dist; s32 newAnimationIdx; @@ -499,7 +499,7 @@ void func_80A6A7D0(EnHorseLinkChild* this, GlobalContext* globalCtx) { if (SkelAnime_Update(&this->skin.skelAnime)) { if (!this->unk_1E8) { - dist = Actor_WorldDistXZToActor(&this->actor, &PLAYER->actor); + dist = Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor); } else { dist = Math3D_Vec3f_DistXYZ(&this->actor.world.pos, &this->actor.home.pos); } diff --git a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c index 0d99e45f62..df9bc7f1ca 100644 --- a/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c +++ b/src/overlays/actors/ovl_En_Horse_Zelda/z_en_horse_zelda.c @@ -135,7 +135,7 @@ void func_80A6D918(EnHorseZelda* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y = this->actor.world.rot.y; - if (Actor_WorldDistXZToActor(&this->actor, &PLAYER->actor) <= 300.0f) { + if (Actor_WorldDistXZToActor(&this->actor, &GET_PLAYER(globalCtx)->actor) <= 300.0f) { if (this->actor.speedXZ < 12.0f) { this->actor.speedXZ += 1.0f; } else { diff --git a/src/overlays/actors/ovl_En_Hs/z_en_hs.c b/src/overlays/actors/ovl_En_Hs/z_en_hs.c index 090505c2de..6ee8fb0595 100644 --- a/src/overlays/actors/ovl_En_Hs/z_en_hs.c +++ b/src/overlays/actors/ovl_En_Hs/z_en_hs.c @@ -184,7 +184,7 @@ void func_80A6E7BC(EnHs* this, GlobalContext* globalCtx) { } void func_80A6E8CC(EnHs* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && func_80106BC8(globalCtx)) { func_8010B720(globalCtx, 0x10B3); @@ -204,7 +204,7 @@ void func_80A6E8CC(EnHs* this, GlobalContext* globalCtx) { } void func_80A6E9AC(EnHs* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawDiff; if (func_8002F194(&this->actor, globalCtx)) { diff --git a/src/overlays/actors/ovl_En_Hy/z_en_hy.c b/src/overlays/actors/ovl_En_Hy/z_en_hy.c index aa938c4241..7a6025051e 100644 --- a/src/overlays/actors/ovl_En_Hy/z_en_hy.c +++ b/src/overlays/actors/ovl_En_Hy/z_en_hy.c @@ -262,7 +262,7 @@ void func_80A6F7CC(EnHy* this, GlobalContext* globalCtx, s32 getItemId) { } u16 func_80A6F810(GlobalContext* globalCtx, Actor* thisx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnHy* this = THIS; u16 textId = Text_GetFaceReaction(globalCtx, (this->actor.params & 0x7F) + 37); @@ -441,7 +441,7 @@ s16 func_80A70058(GlobalContext* globalCtx, Actor* thisx) { case 0x70F3: Rupees_ChangeBy(beggarRewards[this->actor.textId - 0x70F0]); func_80034EC0(&this->skelAnime, D_80A72050, 17); - Player_UpdateBottleHeld(globalCtx, PLAYER, ITEM_BOTTLE, PLAYER_AP_BOTTLE); + Player_UpdateBottleHeld(globalCtx, GET_PLAYER(globalCtx), ITEM_BOTTLE, PLAYER_AP_BOTTLE); break; case 0x7016: gSaveContext.infTable[12] |= 1; @@ -565,7 +565,7 @@ void func_80A70734(EnHy* this, GlobalContext* globalCtx) { } void func_80A70834(EnHy* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->actor.params & 0x7F) == 5) { if (!Inventory_HasSpecificBottle(ITEM_BLUE_FIRE) && !Inventory_HasSpecificBottle(ITEM_BUG) && @@ -606,7 +606,7 @@ void func_80A70834(EnHy* this, GlobalContext* globalCtx) { } void func_80A70978(EnHy* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_a3; switch (this->actor.params & 0x7F) { diff --git a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c index 0a02942000..4b9b6a09ff 100644 --- a/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c +++ b/src/overlays/actors/ovl_En_Ice_Hono/z_en_ice_hono.c @@ -189,7 +189,7 @@ void EnIceHono_Destroy(Actor* thisx, GlobalContext* globalCtx) { } u32 EnIceHono_InBottleRange(EnIceHono* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actor.xzDistToPlayer < 60.0f) { Vec3f tempPos; @@ -389,7 +389,8 @@ void EnIceHono_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 0, 150, 255, 0); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) - this->actor.shape.rot.y + 0x8000) * (M_PI / 0x8000), + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000) * + (M_PI / 0x8000), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_ice_hono.c", 718), diff --git a/src/overlays/actors/ovl_En_Ik/z_en_ik.c b/src/overlays/actors/ovl_En_Ik/z_en_ik.c index 2a8095d34a..7a98744fb9 100644 --- a/src/overlays/actors/ovl_En_Ik/z_en_ik.c +++ b/src/overlays/actors/ovl_En_Ik/z_en_ik.c @@ -771,7 +771,7 @@ void func_80A75C38(EnIk* this, GlobalContext* globalCtx) { void func_80A75FA0(Actor* thisx, GlobalContext* globalCtx) { EnIk* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u8 prevInvincibilityTimer; this->unk_2FA = this->unk_2FB; 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 ff37acf593..79c42dc2b6 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -114,7 +114,7 @@ u16 func_80A78FB0(GlobalContext* globalCtx) { } u16 func_80A79010(GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u16 temp_v0 = Text_GetFaceReaction(globalCtx, 25); if (temp_v0 != 0) { @@ -302,7 +302,7 @@ s16 func_80A79500(GlobalContext* globalCtx, Actor* thisx) { } void func_80A795C8(EnIn* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_a3; if (this->skelAnime.animation == &object_in_Anim_0003B4 || this->skelAnime.animation == &object_in_Anim_001BE0 || @@ -435,7 +435,7 @@ void func_80A79BAC(EnIn* this, GlobalContext* globalCtx, s32 index, u32 arg3) { } void func_80A79C78(EnIn* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp48; Vec3f sp3C; Vec3s zeroVec = { 0, 0, 0 }; @@ -644,7 +644,7 @@ void func_80A7A4C8(EnIn* this, GlobalContext* globalCtx) { } void func_80A7A568(EnIn* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 phi_a2; s32 phi_a3; @@ -664,7 +664,8 @@ void func_80A7A568(EnIn* this, GlobalContext* globalCtx) { this->unk_308.unk_00 = 0; return; } - gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0x10) | (((EnHorse*)PLAYER->rideActor)->type << 4); + gSaveContext.eventInf[0] = + (gSaveContext.eventInf[0] & ~0x10) | (((EnHorse*)GET_PLAYER(globalCtx)->rideActor)->type << 4); gSaveContext.eventInf[0] = (gSaveContext.eventInf[0] & ~0xF) | 2; phi_a2 = 2; phi_a3 = 2; @@ -787,7 +788,7 @@ void func_80A7AA40(EnIn* this, GlobalContext* globalCtx) { } void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f sp48; Vec3f sp3C; @@ -852,7 +853,7 @@ void func_80A7AE84(EnIn* this, GlobalContext* globalCtx) { } void func_80A7AEF0(EnIn* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 yaw; Vec3f pos = this->actor.world.pos; @@ -875,7 +876,7 @@ void func_80A7B018(EnIn* this, GlobalContext* globalCtx) { } void func_80A7B024(EnIn* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->rideActor != NULL) { player->rideActor->freezeTimer = 10; diff --git a/src/overlays/actors/ovl_En_Insect/z_en_insect.c b/src/overlays/actors/ovl_En_Insect/z_en_insect.c index dc4698aafb..4d126280b6 100644 --- a/src/overlays/actors/ovl_En_Insect/z_en_insect.c +++ b/src/overlays/actors/ovl_En_Insect/z_en_insect.c @@ -95,7 +95,7 @@ f32 EnInsect_XZDistanceSquared(Vec3f* v1, Vec3f* v2) { s32 EnInsect_InBottleRange(EnInsect* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f pos; if (this->actor.xzDistToPlayer < 32.0f) { diff --git a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c index e266bf78f9..2191bbb906 100644 --- a/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c +++ b/src/overlays/actors/ovl_En_Ishi/z_en_ishi.c @@ -430,7 +430,7 @@ void EnIshi_Fly(EnIshi* this, GlobalContext* globalCtx) { sDustSpawnFuncs[type](this, globalCtx); } if (type == ROCK_LARGE) { - quakeIdx = Quake_Add(ACTIVE_CAM, 3); + quakeIdx = Quake_Add(GET_ACTIVE_CAM(globalCtx), 3); Quake_SetSpeed(quakeIdx, -0x3CB0); Quake_SetQuakeValues(quakeIdx, 3, 0, 0, 0); Quake_SetCountdown(quakeIdx, 7); diff --git a/src/overlays/actors/ovl_En_Jj/z_en_jj.c b/src/overlays/actors/ovl_En_Jj/z_en_jj.c index 4ce5a0db80..64280297fb 100644 --- a/src/overlays/actors/ovl_En_Jj/z_en_jj.c +++ b/src/overlays/actors/ovl_En_Jj/z_en_jj.c @@ -196,7 +196,7 @@ void EnJj_WaitToOpenMouth(EnJj* this, GlobalContext* globalCtx) { void EnJj_WaitForFish(EnJj* this, GlobalContext* globalCtx) { static Vec3f feedingSpot = { -1589.0f, 53.0f, -43.0f }; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((Math_Vec3f_DistXZ(&feedingSpot, &player->actor.world.pos) < 300.0f) && globalCtx->isPlayerDroppingFish(globalCtx)) { @@ -220,7 +220,7 @@ void EnJj_BeginCutscene(EnJj* this, GlobalContext* globalCtx) { globalCtx->csCtx.segment = &D_80A88164; gSaveContext.cutsceneTrigger = 1; func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, bodyCollisionActor->bgId); - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); gSaveContext.eventChkInf[3] |= 0x400; func_80078884(NA_SE_SY_CORRECT_CHIME); } diff --git a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c index d1fa4a6326..12a11955c2 100644 --- a/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c +++ b/src/overlays/actors/ovl_En_Jsjutan/z_en_jsjutan.c @@ -113,7 +113,7 @@ void func_80A89A6C(EnJsjutan* this, GlobalContext* globalCtx) { f32 maxOffset; f32 maxAmp; f32 waveform; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* parent = this->dyna.actor.parent; Actor* actorExplosive = globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; u8 isInCreditsScene = false; // sp8B diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 78809ec445..28b2852967 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -196,7 +196,7 @@ void func_80A8F660(EnKakasi* this, GlobalContext* globalCtx) { } void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_80A8F28C(this); SkelAnime_Update(&this->skelanime); @@ -236,7 +236,7 @@ void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) { } void func_80A8F8D0(EnKakasi* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (globalCtx->msgCtx.unk_E3EE == 4 && globalCtx->msgCtx.msgMode == 0) { // end? diff --git a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c index 25880d52c4..c3d4c5bd75 100644 --- a/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c +++ b/src/overlays/actors/ovl_En_Kakasi2/z_en_kakasi2.c @@ -114,7 +114,7 @@ void EnKakasi2_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_80A90264(EnKakasi2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_194++; diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index 28dc11e5c6..6045a18b84 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -210,7 +210,7 @@ void func_80A91284(EnKakasi3* this, GlobalContext* globalCtx) { } void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_80A90E28(this); SkelAnime_Update(&this->skelAnime); @@ -279,7 +279,7 @@ void func_80A915B8(EnKakasi3* this, GlobalContext* globalCtx) { } void func_80A91620(EnKakasi3* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((globalCtx->msgCtx.unk_E3EE == 4 || (globalCtx->msgCtx.unk_E3EE >= 5 && globalCtx->msgCtx.unk_E3EE < 11)) && (globalCtx->msgCtx.msgMode == 0)) { @@ -343,7 +343,7 @@ void func_80A9187C(EnKakasi3* this, GlobalContext* globalCtx) { } void func_80A918E4(EnKakasi3* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (BREG(3) != 0) { // No way! diff --git a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c index ff81782d7f..b7e742dd84 100644 --- a/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c +++ b/src/overlays/actors/ovl_En_Kanban/z_en_kanban.c @@ -257,7 +257,7 @@ void EnKanban_Update(Actor* thisx, GlobalContext* globalCtx2) { EnKanban* this = THIS; EnKanban* signpost; EnKanban* piece; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f offset; this->frameCount++; diff --git a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c index b066f02269..e49eea5842 100644 --- a/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c +++ b/src/overlays/actors/ovl_En_Karebaba/z_en_karebaba.c @@ -252,7 +252,7 @@ void EnKarebaba_Awaken(EnKarebaba* this, GlobalContext* globalCtx) { } void EnKarebaba_Upright(EnKarebaba* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); diff --git a/src/overlays/actors/ovl_En_Ko/z_en_ko.c b/src/overlays/actors/ovl_En_Ko/z_en_ko.c index 775fcc6c01..7249d94ec8 100644 --- a/src/overlays/actors/ovl_En_Ko/z_en_ko.c +++ b/src/overlays/actors/ovl_En_Ko/z_en_ko.c @@ -349,7 +349,7 @@ u16 func_80A96FD0(GlobalContext* globalCtx, Actor* thisx) { } u16 func_80A97338(GlobalContext* globalCtx, Actor* thisx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnKo* this = THIS; switch (ENKO_TYPE) { @@ -898,7 +898,7 @@ s32 EnKo_AdultSaved(EnKo* this, GlobalContext* globalCtx) { } } void func_80A9877C(EnKo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((globalCtx->csCtx.state != 0) || (gDbgCamEnabled != 0)) { this->unk_1E8.unk_18 = globalCtx->view.eye; @@ -1180,7 +1180,7 @@ void func_80A99560(EnKo* this, GlobalContext* globalCtx) { } void func_80A995CC(EnKo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 temp_f2; f32 phi_f0; s16 homeYawToPlayer = Math_Vec3f_Yaw(&this->actor.home.pos, &player->actor.world.pos); diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index 50b14afc3e..9a4e30a388 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -65,7 +65,7 @@ static struct_80034EC0_Entry sAnimations[] = { }; u16 EnKz_GetTextNoMaskChild(GlobalContext* globalCtx, EnKz* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (CHECK_QUEST_ITEM(QUEST_ZORA_SAPPHIRE)) { return 0x402B; @@ -78,7 +78,7 @@ u16 EnKz_GetTextNoMaskChild(GlobalContext* globalCtx, EnKz* this) { } u16 EnKz_GetTextNoMaskAdult(GlobalContext* globalCtx, EnKz* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (INV_CONTENT(ITEM_TRADE_ADULT) >= ITEM_FROG) { if (!(gSaveContext.infTable[19] & 0x200)) { @@ -185,7 +185,7 @@ void EnKz_UpdateEyes(EnKz* this) { s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, callback1_800343CC callback1, callback2_800343CC callback2) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 sp32; s16 sp30; f32 xzDistToPlayer; @@ -228,7 +228,7 @@ s32 func_80A9C95C(GlobalContext* globalCtx, EnKz* this, s16* arg2, f32 unkf, cal } void func_80A9CB18(EnKz* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_80A9C95C(globalCtx, this, &this->unk_1E0.unk_00, 340.0f, EnKz_GetText, func_80A9C6C0)) { if ((this->actor.textId == 0x401A) && !(gSaveContext.eventChkInf[3] & 8)) { diff --git a/src/overlays/actors/ovl_En_Light/z_en_light.c b/src/overlays/actors/ovl_En_Light/z_en_light.c index 23b0e45777..425c4db48a 100644 --- a/src/overlays/actors/ovl_En_Light/z_en_light.c +++ b/src/overlays/actors/ovl_En_Light/z_en_light.c @@ -79,7 +79,7 @@ void EnLight_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnLight_UpdatePosRot(EnLight* this, GlobalContext* globalCtx) { // update yaw for billboard effect - this->actor.shape.rot.y = Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000; + this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000; if (this->actor.parent != NULL) { Math_Vec3f_Copy(&this->actor.world.pos, &(this->actor.parent)->world.pos); @@ -184,7 +184,8 @@ void EnLight_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); } - Matrix_RotateY((s16)((Camera_GetCamDirYaw(ACTIVE_CAM) - this->actor.shape.rot.y) + 0x8000) * (M_PI / 32768.0f), + Matrix_RotateY((s16)((Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y) + 0x8000) * + (M_PI / 32768.0f), MTXMODE_APPLY); if (this->actor.params & 1) { diff --git a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c index a3df7d0044..7465dd3273 100644 --- a/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c +++ b/src/overlays/actors/ovl_En_M_Thunder/z_en_m_thunder.c @@ -64,7 +64,7 @@ void func_80A9EFE0(EnMThunder* this, EnMThunderActionFunc actionFunc) { void EnMThunder_Init(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; EnMThunder* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Collider_InitCylinder(globalCtx, &this->collider); Collider_SetCylinder(globalCtx, &this->collider, &this->actor, &D_80AA0420); @@ -130,7 +130,7 @@ void func_80A9F314(GlobalContext* globalCtx, f32 arg1) { } void func_80A9F350(EnMThunder* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags2 & 0x20000) { if (player->swordAnimation >= 0x18) { @@ -150,7 +150,7 @@ void func_80A9F350(EnMThunder* this, GlobalContext* globalCtx) { } void func_80A9F408(EnMThunder* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* child = this->actor.child; this->unk_1B8 = player->unk_858; @@ -271,7 +271,7 @@ void func_80A9F938(EnMThunder* this, GlobalContext* globalCtx) { } void func_80A9F9B4(EnMThunder* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Math_StepToF(&this->unk_1AC, 0.0f, 1 / 16.0f)) { Actor_Kill(&this->actor); @@ -321,7 +321,7 @@ void EnMThunder_Draw(Actor* thisx, GlobalContext* globalCtx2) { static f32 D_80AA046C[] = { 0.1f, 0.15f, 0.2f, 0.25f, 0.3f, 0.25f, 0.2f, 0.15f }; GlobalContext* globalCtx = globalCtx2; EnMThunder* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 phi_f14; s32 phi_t1; // u8 frames; diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index 74c9aee4b1..d02e1f9521 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -222,7 +222,7 @@ void EnMa1_ChangeAnimation(EnMa1* this, UNK_TYPE idx) { } void func_80AA0AF4(EnMa1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_a3; if ((this->unk_1E8.unk_00 == 0) && (this->skelAnime.animation == &gMalonChildSingAnim)) { @@ -330,7 +330,7 @@ void func_80AA0EFC(EnMa1* this, GlobalContext* globalCtx) { } void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->unk_1E8.unk_00 != 0) { if (this->skelAnime.animation != &gMalonChildIdleAnim) { @@ -358,7 +358,7 @@ void func_80AA0F44(EnMa1* this, GlobalContext* globalCtx) { } void func_80AA106C(EnMa1* this, GlobalContext* globalCtx) { - PLAYER->stateFlags2 |= 0x800000; + GET_PLAYER(globalCtx)->stateFlags2 |= 0x800000; if (this->unk_1E8.unk_00 == 2) { func_800ED858(2); func_8010BD58(globalCtx, 9); @@ -368,7 +368,7 @@ void func_80AA106C(EnMa1* this, GlobalContext* globalCtx) { } void func_80AA10EC(EnMa1* this, GlobalContext* globalCtx) { - PLAYER->stateFlags2 |= 0x800000; + GET_PLAYER(globalCtx)->stateFlags2 |= 0x800000; if (func_8010BDBC(&globalCtx->msgCtx) == 7) { func_8010BD58(globalCtx, 0x16); this->actionFunc = func_80AA1150; @@ -376,7 +376,7 @@ void func_80AA10EC(EnMa1* this, GlobalContext* globalCtx) { } void func_80AA1150(EnMa1* this, GlobalContext* globalCtx) { - PLAYER->stateFlags2 |= 0x800000; + GET_PLAYER(globalCtx)->stateFlags2 |= 0x800000; if (globalCtx->msgCtx.unk_E3EE == 3) { globalCtx->nextEntranceIndex = 0x157; gSaveContext.nextCutsceneIndex = 0xFFF1; @@ -445,7 +445,7 @@ void EnMa1_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma1.c", 1226); - camera = ACTIVE_CAM; + camera = GET_ACTIVE_CAM(globalCtx); distFromCamera = Math_Vec3f_DistXZ(&this->actor.world.pos, &camera->eye); func_800F6268(distFromCamera, 0x2F); func_80093D18(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 4e8573f669..a8d55da8f7 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -115,7 +115,7 @@ s16 func_80AA1A38(GlobalContext* globalCtx, Actor* thisx) { } void func_80AA1AE4(EnMa2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_a3; if ((this->unk_1E0.unk_00 == 0) && (this->skelAnime.animation == &object_ma2_Anim_009EE0)) { @@ -255,7 +255,7 @@ void func_80AA2018(EnMa2* this, GlobalContext* globalCtx) { } void func_80AA204C(EnMa2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags2 & 0x1000000) { player->unk_6A8 = &this->actor; @@ -268,7 +268,7 @@ void func_80AA204C(EnMa2* this, GlobalContext* globalCtx) { } void func_80AA20E4(EnMa2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (globalCtx->msgCtx.unk_E3EE >= 4) { this->actionFunc = func_80AA204C; @@ -285,7 +285,7 @@ void func_80AA20E4(EnMa2* this, GlobalContext* globalCtx) { } void func_80AA21C8(EnMa2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (DECR(this->unk_208)) { player->stateFlags2 |= 0x800000; @@ -377,7 +377,7 @@ void EnMa2_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma2.c", 955); - camera = ACTIVE_CAM; + camera = GET_ACTIVE_CAM(globalCtx); someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &camera->eye); func_800F6268(someFloat, 0x2F); func_80093D18(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index df9f0d3397..01de029130 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -67,7 +67,7 @@ static struct_D_80AA1678 D_80AA3848[] = { }; u16 func_80AA2AA0(GlobalContext* globalCtx, Actor* thisx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16* timer1ValuePtr; // weirdness with this necessary to match if (!(gSaveContext.infTable[11] & 0x100)) { @@ -174,7 +174,7 @@ s16 func_80AA2BD4(GlobalContext* globalCtx, Actor* thisx) { } void func_80AA2E54(EnMa3* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_a3; if ((this->unk_1E0.unk_00 == 0) && (this->skelAnime.animation == &object_ma2_Anim_009EE0)) { @@ -359,7 +359,7 @@ void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 978); - camera = ACTIVE_CAM; + camera = GET_ACTIVE_CAM(globalCtx); someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &camera->eye); func_800F6268(someFloat, 0x2F); func_80093D18(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Mb/z_en_mb.c b/src/overlays/actors/ovl_En_Mb/z_en_mb.c index 06e5d05e3a..22ce465b54 100644 --- a/src/overlays/actors/ovl_En_Mb/z_en_mb.c +++ b/src/overlays/actors/ovl_En_Mb/z_en_mb.c @@ -260,7 +260,7 @@ void EnMb_SetupAction(EnMb* this, EnMbActionFunc actionFunc) { void EnMb_Init(Actor* thisx, GlobalContext* globalCtx) { EnMb* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 relYawFromPlayer; Actor_ProcessInitChain(&this->actor, sInitChain); @@ -372,7 +372,7 @@ void EnMb_NextWaypoint(EnMb* this, GlobalContext* globalCtx) { * and they all are 100 units wide. */ s32 EnMb_IsPlayerInCorridor(EnMb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 xFromPlayer; f32 zFromPlayer; f32 cos; @@ -601,7 +601,7 @@ void EnMb_SetupStunned(EnMb* this) { } void EnMb_Stunned(EnMb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((player->stateFlags2 & 0x80) && player->actor.parent == &this->actor) { player->stateFlags2 &= ~0x80; @@ -715,7 +715,7 @@ void EnMb_ClubWaitAfterAttack(EnMb* this, GlobalContext* globalCtx) { * Slow down, charge again if the player is near, or resume walking. */ void EnMb_SpearPatrolEndCharge(EnMb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 lastFrame; s16 relYawFromPlayer; s16 yawPlayerToWaypoint; @@ -817,7 +817,7 @@ void EnMb_SpearGuardPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { } void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; Vec3f effSpawnPos; Vec3f effWhiteShockwaveDynamics = { 0.0f, 0.0f, 0.0f }; @@ -883,7 +883,7 @@ void EnMb_ClubAttack(EnMb* this, GlobalContext* globalCtx) { * Prepare charge (animation), then charge to the end of the floor collision. */ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 prevFrame; s32 hasHitPlayer = false; s32 endCharge = !Actor_TestFloorInDirection(&this->actor, globalCtx, 110.0f, this->actor.world.rot.y); @@ -963,7 +963,7 @@ void EnMb_SpearPatrolPrepareAndCharge(EnMb* this, GlobalContext* globalCtx) { * Charge and follow the path, until hitting the player or, after some time, reaching home. */ void EnMb_SpearPatrolImmediateCharge(EnMb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 prevFrame; s32 hasHitPlayer = false; s32 endCharge = !Actor_TestFloorInDirection(&this->actor, globalCtx, 110.0f, this->actor.world.rot.y); @@ -1119,7 +1119,7 @@ void EnMb_SpearGuardWalk(EnMb* this, GlobalContext* globalCtx) { s32 beforeCurFrame; s32 pad1; s32 pad2; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 relYawTowardsPlayer = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; s16 yawTowardsHome; f32 playSpeedAbs; @@ -1232,7 +1232,7 @@ void EnMb_SpearPatrolWalkTowardsWaypoint(EnMb* this, GlobalContext* globalCtx) { } void EnMb_ClubWaitPlayerNear(EnMb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; s16 relYawFromPlayer = this->actor.world.rot.y - this->actor.yawTowardsPlayer; @@ -1293,7 +1293,7 @@ void EnMb_SetupSpearDead(EnMb* this) { } void EnMb_SpearDead(EnMb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.5f, 0.0f); @@ -1371,7 +1371,7 @@ void EnMb_ClubUpdateAttackCollider(Actor* thisx, GlobalContext* globalCtx) { } void EnMb_CheckColliding(EnMb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->frontShielding.base.acFlags & AC_HIT) { this->frontShielding.base.acFlags &= ~(AC_HIT | AC_BOUNCED); diff --git a/src/overlays/actors/ovl_En_Md/z_en_md.c b/src/overlays/actors/ovl_En_Md/z_en_md.c index ef853025e9..af09839474 100644 --- a/src/overlays/actors/ovl_En_Md/z_en_md.c +++ b/src/overlays/actors/ovl_En_Md/z_en_md.c @@ -496,7 +496,7 @@ void EnMd_UpdateEyes(EnMd* this) { } void func_80AAB158(EnMd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 absYawDiff; s16 temp; s16 temp2; @@ -669,9 +669,9 @@ void func_80AAB8F8(EnMd* this, GlobalContext* globalCtx) { } void func_80AAB948(EnMd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 temp; - Actor* actorToBlock = &PLAYER->actor; + Actor* actorToBlock = &GET_PLAYER(globalCtx)->actor; s16 yaw; func_80AAAA24(this); @@ -734,7 +734,7 @@ void func_80AAB948(EnMd* this, GlobalContext* globalCtx) { } void func_80AABC10(EnMd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (globalCtx->msgCtx.unk_E3EE >= 4) { this->actionFunc = func_80AAB948; diff --git a/src/overlays/actors/ovl_En_Mk/z_en_mk.c b/src/overlays/actors/ovl_En_Mk/z_en_mk.c index 6ab9c55c60..9b9f364249 100644 --- a/src/overlays/actors/ovl_En_Mk/z_en_mk.c +++ b/src/overlays/actors/ovl_En_Mk/z_en_mk.c @@ -152,7 +152,7 @@ void func_80AACCA0(EnMk* this, GlobalContext* globalCtx) { } void func_80AACD48(EnMk* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && (func_80106BC8(globalCtx) != 0)) { func_80106CCC(globalCtx); @@ -214,7 +214,7 @@ void func_80AAD014(EnMk* this, GlobalContext* globalCtx) { void EnMk_Wait(EnMk* this, GlobalContext* globalCtx) { s16 angle; s32 swimFlag; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 playerExchangeItem; if (func_8002F194(&this->actor, globalCtx) != 0) { @@ -306,7 +306,7 @@ void EnMk_Update(Actor* thisx, GlobalContext* globalCtx) { Math_SmoothStepToS(&this->headRotation.y, 0, 6, 6200, 100); } - player = PLAYER; + player = GET_PLAYER(globalCtx); if (this->flags & 8) { if (!(player->stateFlags2 & 0x400)) { diff --git a/src/overlays/actors/ovl_En_Mm/z_en_mm.c b/src/overlays/actors/ovl_En_Mm/z_en_mm.c index b93878e8b8..3a4546bda4 100644 --- a/src/overlays/actors/ovl_En_Mm/z_en_mm.c +++ b/src/overlays/actors/ovl_En_Mm/z_en_mm.c @@ -221,7 +221,7 @@ s32 func_80AADA70(void) { s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 sp1C = 1; switch (func_8010BDBC(&globalCtx->msgCtx)) { @@ -268,7 +268,7 @@ s32 func_80AADAA0(EnMm* this, GlobalContext* globalCtx) { } s32 EnMm_GetTextId(EnMm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 textId; textId = Text_GetFaceReaction(globalCtx, 0x1C); @@ -287,7 +287,7 @@ s32 EnMm_GetTextId(EnMm* this, GlobalContext* globalCtx) { } void func_80AADCD0(EnMm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 yawDiff; s16 sp26; s16 sp24; diff --git a/src/overlays/actors/ovl_En_Nb/z_en_nb.c b/src/overlays/actors/ovl_En_Nb/z_en_nb.c index 5636c8e8e7..7d96b0ce47 100644 --- a/src/overlays/actors/ovl_En_Nb/z_en_nb.c +++ b/src/overlays/actors/ovl_En_Nb/z_en_nb.c @@ -150,7 +150,7 @@ void EnNb_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void func_80AB0FBC(EnNb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_300.unk_18 = player->actor.world.pos; this->unk_300.unk_14 = kREG(16) + 9.0f; @@ -158,7 +158,7 @@ void func_80AB0FBC(EnNb* this, GlobalContext* globalCtx) { } void func_80AB1040(EnNb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_300.unk_18 = player->actor.world.pos; this->unk_300.unk_14 = kREG(16) + 9.0f; @@ -316,7 +316,7 @@ void EnNb_SpawnBlueWarp(EnNb* this, GlobalContext* globalCtx) { } void EnNb_GiveMedallion(EnNb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 50.0f; f32 posZ = player->actor.world.pos.z; @@ -335,7 +335,7 @@ void EnNb_SetupChamberCsImpl(EnNb* this, GlobalContext* globalCtx) { Player* player; if ((gSaveContext.chamberCutsceneNum == 3) && (gSaveContext.sceneSetupIndex < 4)) { - player = PLAYER; + player = GET_PLAYER(globalCtx); this->action = NB_CHAMBER_UNDERGROUND; globalCtx->csCtx.segment = &D_80AB431C; gSaveContext.cutsceneTrigger = 2; @@ -1145,7 +1145,7 @@ void EnNb_SetNoticeSFX(EnNb* this) { } s32 EnNb_GetNoticedStatus(EnNb* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 playerX = player->actor.world.pos.x; f32 playerZ = player->actor.world.pos.z; f32 thisX = this->actor.world.pos.x; 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 2d191feba9..2501249d25 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -447,7 +447,7 @@ void func_80AB63A8(EnNiw* this, GlobalContext* globalCtx) { } void func_80AB6450(EnNiw* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actor.xzDistToPlayer < 30.0f && fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 5.0f) { this->timer6 = 100; @@ -827,7 +827,7 @@ void func_80AB7290(EnNiw* this, GlobalContext* globalCtx) { } void func_80AB7328(EnNiw* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->timer6 == 0) { this->unk_2AC.x = this->unk_2B8.x = this->actor.world.pos.x; @@ -875,7 +875,7 @@ void func_80AB747C(EnNiw* this, GlobalContext* globalCtx) { void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad1; EnNiw* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 i; s16 featherCount; Vec3f zeroVec1 = { 0.0f, 0.0f, 0.0f }; diff --git a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c index 2d804e42a8..9b89ffd255 100644 --- a/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c +++ b/src/overlays/actors/ovl_En_Niw_Girl/z_en_niw_girl.c @@ -190,7 +190,7 @@ void func_80AB94D0(EnNiwGirl* this, GlobalContext* globalCtx) { void EnNiwGirl_Update(Actor* thisx, GlobalContext* globalCtx) { EnNiwGirl* this = THIS; EnNiwGirlActionFunc tempActionFunc; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor_SetScale(&this->actor, 0.013f); this->unkUpTimer++; diff --git a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c index 670114ca2b..8d060c7ec6 100644 --- a/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c +++ b/src/overlays/actors/ovl_En_Niw_Lady/z_en_niw_lady.c @@ -352,7 +352,7 @@ void func_80ABA778(EnNiwLady* this, GlobalContext* globalCtx) { } void func_80ABA878(EnNiwLady* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s8 playerExchangeItemId; if ((func_8010BDBC(&globalCtx->msgCtx) == 0) || (func_8010BDBC(&globalCtx->msgCtx) == 6)) { @@ -488,7 +488,7 @@ void func_80ABAD7C(EnNiwLady* this, GlobalContext* globalCtx) { void EnNiwLady_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnNiwLady* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor_SetFocus(thisx, 60.0f); this->unk_288.unk_18 = player->actor.world.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 15bf359d7d..75032fd78c 100644 --- a/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c +++ b/src/overlays/actors/ovl_En_Nutsball/z_en_nutsball.c @@ -92,7 +92,7 @@ void func_80ABBB34(EnNutsball* this, GlobalContext* globalCtx) { } void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3s sp4C; Vec3f sp40; @@ -139,7 +139,7 @@ void func_80ABBBA8(EnNutsball* this, GlobalContext* globalCtx) { void EnNutsball_Update(Actor* thisx, GlobalContext* globalCtx) { EnNutsball* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; if (!(player->stateFlags1 & 0x300000C0) || (this->actionFunc == func_80ABBB34)) { diff --git a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c index 45c1063000..8f504e246e 100644 --- a/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c +++ b/src/overlays/actors/ovl_En_Okarina_Tag/z_en_okarina_tag.c @@ -112,7 +112,7 @@ void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx) { Player* player; u16 unk_152; - player = PLAYER; + player = GET_PLAYER(globalCtx); this->unk_15A++; if ((this->switchFlag >= 0) && (Flags_GetSwitch(globalCtx, this->switchFlag))) { this->actor.flags &= ~1; @@ -143,7 +143,7 @@ void func_80ABEF2C(EnOkarinaTag* this, GlobalContext* globalCtx) { } void func_80ABF0CC(EnOkarinaTag* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (globalCtx->msgCtx.unk_E3EE == 4) { this->actionFunc = func_80ABEF2C; @@ -186,7 +186,7 @@ void func_80ABF0CC(EnOkarinaTag* this, GlobalContext* globalCtx) { } void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_15A++; if ((this->unk_152 != 6) || (gSaveContext.scarecrowSpawnSongSet)) { @@ -229,7 +229,7 @@ void func_80ABF28C(EnOkarinaTag* this, GlobalContext* globalCtx) { } void func_80ABF4C8(EnOkarinaTag* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (globalCtx->msgCtx.unk_E3EE == 4) { this->actionFunc = func_80ABF28C; diff --git a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c index 97ef846933..5780cb2dad 100644 --- a/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c +++ b/src/overlays/actors/ovl_En_Okuta/z_en_okuta.c @@ -470,7 +470,7 @@ void EnOkuta_Freeze(EnOkuta* this, GlobalContext* globalCtx) { void EnOkuta_ProjectileFly(EnOkuta* this, GlobalContext* globalCtx) { Vec3f pos; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3s sp40; this->timer--; @@ -574,7 +574,7 @@ void EnOkuta_ColliderCheck(EnOkuta* this, GlobalContext* globalCtx) { void EnOkuta_Update(Actor* thisx, GlobalContext* globalCtx2) { EnOkuta* this = THIS; GlobalContext* globalCtx = globalCtx2; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); WaterBox* outWaterBox; f32 ySurface; Vec3f sp38; 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 5f84498f3f..c4c1537c8f 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -546,7 +546,7 @@ void EnOssan_TalkHappyMaskShopkeeper(GlobalContext* globalCtx) { void EnOssan_UpdateCameraDirection(EnOssan* this, GlobalContext* globalCtx, f32 cameraFaceAngle) { this->cameraFaceAngle = cameraFaceAngle; - Camera_SetCameraData(ACTIVE_CAM, 0xC, NULL, NULL, cameraFaceAngle, 0, 0); + Camera_SetCameraData(GET_ACTIVE_CAM(globalCtx), 0xC, NULL, NULL, cameraFaceAngle, 0, 0); } s32 EnOssan_TryGetObjBankIndexes(EnOssan* this, GlobalContext* globalCtx, s16* objectIds) { @@ -646,7 +646,7 @@ void EnOssan_UpdateCursorPos(GlobalContext* globalCtx, EnOssan* this) { } void EnOssan_EndInteraction(GlobalContext* globalCtx, EnOssan* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); // "End of conversation!" osSyncPrintf(VT_FGCOL(YELLOW) "%s[%d]:★★★ 会話終了!! ★★★" VT_RST "\n", "../z_en_oB1.c", 1337); @@ -1317,7 +1317,7 @@ void EnOssan_State_DisplayOnlyBombDialog(EnOssan* this, GlobalContext* globalCtx } void EnOssan_GiveItemWithFanfare(GlobalContext* globalCtx, EnOssan* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); osSyncPrintf("\n" VT_FGCOL(YELLOW) "初めて手にいれた!!" VT_RST "\n\n"); func_8002F434(&this->actor, globalCtx, this->shelfSlots[this->cursorIndex]->getItemId, 120.0f, 120.0f); @@ -2198,7 +2198,7 @@ void EnOssan_Obj3ToSeg6(EnOssan* this, GlobalContext* globalCtx) { } void EnOssan_MainActionFunc(EnOssan* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->blinkFunc(this); EnOssan_UpdateJoystickInputState(globalCtx, this); 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 33eb947d51..79069ddac6 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -245,7 +245,7 @@ void EnOwl_Destroy(Actor* thisx, GlobalContext* globalCtx) { * Rotates this to the player instance */ void EnOwl_LookAtLink(EnOwl* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.shape.rot.y = this->actor.world.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &player->actor.world.pos); diff --git a/src/overlays/actors/ovl_En_Part/z_en_part.c b/src/overlays/actors/ovl_En_Part/z_en_part.c index 3a2f2105ef..69d3910efd 100644 --- a/src/overlays/actors/ovl_En_Part/z_en_part.c +++ b/src/overlays/actors/ovl_En_Part/z_en_part.c @@ -173,7 +173,7 @@ void func_80ACE5B8(EnPart* this, GlobalContext* globalCtx) { } void func_80ACE5C8(EnPart* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->timer--; if (this->timer == 0) { diff --git a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c index b41f63ceb0..0b8cb245cf 100644 --- a/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c +++ b/src/overlays/actors/ovl_En_Peehat/z_en_peehat.c @@ -494,7 +494,7 @@ void EnPeehat_Ground_SetStateSeekPlayer(EnPeehat* this) { } void EnPeehat_Ground_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_SmoothStepToF(&this->actor.speedXZ, 3.0f, 1.0f, 0.25f, 0.0f); Math_SmoothStepToF(&this->actor.world.pos.y, this->actor.floorHeight + 80.0f, 1.0f, 3.0f, 0.0f); @@ -560,7 +560,7 @@ void EnPeehat_Larva_StateSeekPlayer(EnPeehat* this, GlobalContext* globalCtx) { EnPeehat_SetStateAttackRecoil(this); } else if ((this->colQuad.base.atFlags & AT_HIT) || (this->colCylinder.base.acFlags & AC_HIT) || (this->actor.bgCheckFlags & 1)) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->colQuad.base.atFlags &= ~AT_HIT; if (!(this->colCylinder.base.acFlags & AC_HIT) && &player->actor == this->colQuad.base.at) { if (Rand_ZeroOne() > 0.5f) { @@ -656,7 +656,7 @@ void EnPeehat_Ground_SetStateHover(EnPeehat* this) { void EnPeehat_Ground_StateHover(EnPeehat* this, GlobalContext* globalCtx) { f32 cos; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); // hover but don't gain altitude if (this->actor.world.pos.y - this->actor.floorHeight > 75.0f) { @@ -705,7 +705,7 @@ void EnPeehat_Ground_StateReturnHome(EnPeehat* this, GlobalContext* globalCtx) { s16 yRot; Player* player; - player = PLAYER; + player = GET_PLAYER(globalCtx); if (this->actor.world.pos.y - this->actor.floorHeight > 75.0f) { this->actor.world.pos.y -= 1.0f; } else { @@ -921,7 +921,7 @@ void EnPeehat_Adult_CollisionCheck(EnPeehat* this, GlobalContext* globalCtx) { void EnPeehat_Update(Actor* thisx, GlobalContext* globalCtx) { EnPeehat* this = THIS; s32 i; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); // If Adult Peahat if (thisx->params <= 0) { diff --git a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c index 6145a76d24..35f50252fa 100644 --- a/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c +++ b/src/overlays/actors/ovl_En_Po_Field/z_en_po_field.c @@ -236,7 +236,7 @@ void EnPoField_SetupAppear(EnPoField* this) { } void EnPoField_SetupCirclePlayer(EnPoField* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Animation_PlayLoop(&this->skelAnime, &gPoeFieldFloatAnim); this->collider.base.acFlags |= AC_ON; @@ -359,7 +359,7 @@ void EnPoField_SetupInteractWithSoul(EnPoField* this) { } void EnPoField_CorrectYPos(EnPoField* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->unk_194 == 0) { this->unk_194 = 32; @@ -380,7 +380,7 @@ void EnPoField_CorrectYPos(EnPoField* this, GlobalContext* globalCtx) { } f32 EnPoField_SetFleeSpeed(EnPoField* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 speed = ((player->stateFlags1 & 0x800000) && player->rideActor != NULL) ? player->rideActor->speedXZ : 12.0f; if (this->actor.xzDistToPlayer < 300.0f) { @@ -396,7 +396,7 @@ f32 EnPoField_SetFleeSpeed(EnPoField* this, GlobalContext* globalCtx) { } void EnPoField_WaitForSpawn(EnPoField* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 spawnDist; s32 i; s32 bgId; @@ -464,7 +464,7 @@ void EnPoField_Appear(EnPoField* this, GlobalContext* globalCtx) { } void EnPoField_CirclePlayer(EnPoField* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 temp_v1 = 16 - this->unk_194; SkelAnime_Update(&this->skelAnime); @@ -552,12 +552,16 @@ void EnPoField_Death(EnPoField* this, GlobalContext* globalCtx) { if (this->actionTimer < 5) { sp6C.y = Math_SinS(this->actionTimer * 0x1000 - 0x4000) * 23.0f + (this->actor.world.pos.y + 40.0f); sp68 = Math_CosS(this->actionTimer * 0x1000 - 0x4000) * 23.0f; - sp6C.x = Math_SinS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * sp68 + this->actor.world.pos.x; - sp6C.z = Math_CosS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * sp68 + this->actor.world.pos.z; + sp6C.x = + Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * sp68 + this->actor.world.pos.x; + sp6C.z = + Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * sp68 + this->actor.world.pos.z; } else { sp6C.y = this->actor.world.pos.y + 40.0f + 15.0f * (this->actionTimer - 5); - sp6C.x = Math_SinS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * 23.0f + this->actor.world.pos.x; - sp6C.z = Math_CosS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * 23.0f + this->actor.world.pos.z; + sp6C.x = + Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.x; + sp6C.z = + Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.z; } EffectSsDeadDb_Spawn(globalCtx, &sp6C, &D_80AD7114, &D_80AD7120, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); @@ -785,7 +789,7 @@ void EnPoField_DrawFlame(EnPoField* this, GlobalContext* globalCtx) { sp4C = this->flameScale * 85000.0f; gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, sp4C); Matrix_Translate(this->flamePosition.x, this->flamePosition.y, this->flamePosition.z, MTXMODE_NEW); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); if (this->flameTimer >= 20) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Matrix_Scale(this->flameScale, this->flameScale, this->flameScale, MTXMODE_APPLY); @@ -993,7 +997,7 @@ void EnPoField_DrawSoul(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, info->primColor.r, info->primColor.g, info->primColor.b, this->lightColor.a); gDPSetEnvColor(POLY_XLU_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 255); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_po_field.c", 2143), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gPoeFieldSoulDL); diff --git a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c index 72fd45c66e..74d911bdfe 100644 --- a/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c +++ b/src/overlays/actors/ovl_En_Po_Relay/z_en_po_relay.c @@ -184,7 +184,7 @@ void EnPoRelay_Talk(EnPoRelay* this, GlobalContext* globalCtx) { } void EnPoRelay_Race(EnPoRelay* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f vec; f32 speed; f32 multiplier; @@ -301,12 +301,16 @@ void EnPoRelay_DisappearAndReward(EnPoRelay* this, GlobalContext* globalCtx) { if (this->actionTimer < 5) { vec.y = Math_SinS((this->actionTimer * 0x1000) - 0x4000) * 23.0f + (this->actor.world.pos.y + 40.0f); multiplier = Math_CosS((this->actionTimer * 0x1000) - 0x4000) * 23.0f; - vec.x = (Math_SinS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * multiplier) + this->actor.world.pos.x; - vec.z = (Math_CosS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * multiplier) + this->actor.world.pos.z; + vec.x = (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier) + + this->actor.world.pos.x; + vec.z = (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier) + + this->actor.world.pos.z; } else { vec.y = this->actor.world.pos.y + 40.0f + 15.0f * (this->actionTimer - 5); - vec.x = (Math_SinS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * 23.0f) + this->actor.world.pos.x; - vec.z = (Math_CosS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * 23.0f) + this->actor.world.pos.z; + vec.x = + (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f) + this->actor.world.pos.x; + vec.z = + (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f) + this->actor.world.pos.z; } EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AD8D30, &D_80AD8D3C, this->actionTimer * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, true); diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 2813834566..2f2dd5e325 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -337,7 +337,7 @@ void func_80AD9718(EnPoSisters* this) { } void func_80AD97C8(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 sp20; if (this->unk_195 == 0 || this->actionFunc != func_80ADAAA4) { @@ -572,7 +572,7 @@ void func_80ADA2BC(EnPoSisters* this, GlobalContext* globalCtx) { void func_80ADA35C(EnPoSisters* this, GlobalContext* globalCtx) { f32 targetY; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actionFunc == func_80ADBF58) { targetY = this->actor.home.pos.y; @@ -629,7 +629,7 @@ void func_80ADA530(EnPoSisters* this, GlobalContext* globalCtx) { } void func_80ADA6A0(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_v0; SkelAnime_Update(&this->skelAnime); @@ -844,7 +844,7 @@ void func_80ADB2B8(EnPoSisters* this, GlobalContext* globalCtx) { } void func_80ADB338(EnPoSisters* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnPoSisters* realMeg = (EnPoSisters*)this->actor.parent; if (this->unk_195 == 0) { @@ -966,7 +966,7 @@ void func_80ADB770(EnPoSisters* this, GlobalContext* globalCtx) { this->unk_199 &= ~0x40; } } - if (Actor_WorldDistXZToPoint(&PLAYER->actor, &this->actor.home.pos) > 600.0f) { + if (Actor_WorldDistXZToPoint(&GET_PLAYER(globalCtx)->actor, &this->actor.home.pos) > 600.0f) { this->unk_199 &= ~0x40; func_80AD9C24(this, globalCtx); } else if (this->unk_19A == 0) { @@ -1405,7 +1405,7 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPPipeSync(POLY_XLU_DISP++); gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, temp_s7->r, temp_s7->g, temp_s7->b, phi_s5); Matrix_Translate(this->unk_234[i].x, this->unk_234[i].y, this->unk_234[i].z, MTXMODE_NEW); - Matrix_RotateRPY(0, (s16)(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000), 0, MTXMODE_APPLY); + Matrix_RotateRPY(0, (s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000), 0, MTXMODE_APPLY); if (this->actionFunc == func_80ADAFC0) { phi_f20 = (this->unk_19A - i) * 0.025f + 0.5f; phi_f20 = CLAMP(phi_f20, 0.5f, 0.8f) * 0.007f; 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 4750424226..b16bd54e63 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -459,7 +459,7 @@ void func_80ADE9BC(EnPoh* this) { } void EnPoh_MoveTowardsPlayerHeight(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_195 * 0x800); @@ -520,7 +520,7 @@ void func_80ADEC9C(EnPoh* this, GlobalContext* globalCtx) { Player* player; s16 facingDiff; - player = PLAYER; + player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); if (this->unk_198 != 0) { this->unk_198--; @@ -614,12 +614,16 @@ void func_80ADF15C(EnPoh* this, GlobalContext* globalCtx) { if (this->unk_198 < 5) { vec.y = Math_SinS((this->unk_198 * 0x1000) - 0x4000) * 23.0f + (this->actor.world.pos.y + 40.0f); multiplier = Math_CosS((this->unk_198 * 0x1000) - 0x4000) * 23.0f; - vec.x = Math_SinS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * multiplier + this->actor.world.pos.x; - vec.z = Math_CosS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * multiplier + this->actor.world.pos.z; + vec.x = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier + + this->actor.world.pos.x; + vec.z = Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * multiplier + + this->actor.world.pos.z; } else { vec.y = (this->actor.world.pos.y + 40.0f) + (15.0f * (this->unk_198 - 5)); - vec.x = Math_SinS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * 23.0f + this->actor.world.pos.x; - vec.z = Math_CosS(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x4800) * 23.0f + this->actor.world.pos.z; + vec.x = + Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.x; + vec.z = + Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800) * 23.0f + this->actor.world.pos.z; } EffectSsDeadDb_Spawn(globalCtx, &vec, &D_80AE1B60, &D_80AE1B6C, this->unk_198 * 10 + 80, 0, 255, 255, 255, 255, 0, 0, 255, 1, 9, 1); @@ -1189,7 +1193,7 @@ void EnPoh_DrawSoul(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, this->info->primColor.r, this->info->primColor.g, this->info->primColor.b, this->lightColor.a); gDPSetEnvColor(POLY_XLU_DISP++, this->lightColor.r, this->lightColor.g, this->lightColor.b, 255); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * 9.58738e-05f, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx, "../z_en_poh.c", 2910), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, this->info->soulDisplayList); 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 87cd33f90f..362ecc831d 100644 --- a/src/overlays/actors/ovl_En_Rd/z_en_rd.c +++ b/src/overlays/actors/ovl_En_Rd/z_en_rd.c @@ -308,7 +308,7 @@ void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) { Vec3f sp44 = D_80AE4918; Color_RGBA8 sp40 = D_80AE4924; Color_RGBA8 sp3C = D_80AE4928; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; s16 sp32 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->unk_30E - this->unk_310; @@ -329,7 +329,7 @@ void func_80AE2C1C(EnRd* this, GlobalContext* globalCtx) { if (!(this->unk_312 & 0x80)) { player->actor.freezeTimer = 40; func_8008EEAC(globalCtx, &this->actor); - PLAYER->unk_684 = &this->actor; + GET_PLAYER(globalCtx)->unk_684 = &this->actor; func_800AA000(this->actor.xzDistToPlayer, 0xFF, 0x14, 0x96); } this->unk_306 = 0x3C; @@ -374,7 +374,7 @@ void func_80AE2F50(EnRd* this, GlobalContext* globalCtx) { } void func_80AE2FD0(EnRd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; s16 targetY = Actor_WorldYawTowardPoint(&this->actor, &this->actor.home.pos); @@ -472,7 +472,7 @@ void func_80AE33F0(EnRd* this) { void func_80AE3454(EnRd* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (SkelAnime_Update(&this->skelAnime)) { this->unk_304++; @@ -551,7 +551,7 @@ void func_80AE3834(EnRd* this, GlobalContext* globalCtx) { Vec3f sp34 = D_80AE492C; Color_RGBA8 sp30 = D_80AE4938; Color_RGBA8 sp2C = D_80AE493C; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 temp_v0 = this->actor.yawTowardsPlayer - this->actor.shape.rot.y - this->unk_30E - this->unk_310; if (ABS(temp_v0) < 0x2008) { @@ -608,7 +608,7 @@ void func_80AE3A8C(EnRd* this) { } void func_80AE3B18(EnRd* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actor.speedXZ < 0.0f) { this->actor.speedXZ += 0.15f; @@ -738,7 +738,7 @@ void func_80AE3F9C(EnRd* this, GlobalContext* globalCtx) { void func_80AE4114(EnRd* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((gSaveContext.unk_1422 != 0) && (this->actor.shape.rot.x == 0) && (this->unk_318 == 0) && (this->unk_31B != 9) && (this->unk_31B != 10) && (this->unk_31B != 1)) { @@ -789,7 +789,7 @@ void func_80AE4114(EnRd* this, GlobalContext* globalCtx) { void EnRd_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; EnRd* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad2; func_80AE4114(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c index e9e4dfc147..be837d6622 100644 --- a/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c +++ b/src/overlays/actors/ovl_En_Reeba/z_en_reeba.c @@ -166,7 +166,7 @@ void EnReeba_Destroy(Actor* thisx, GlobalContext* globalCtx) { void func_80AE4F40(EnReeba* this, GlobalContext* globalCtx) { f32 frames = Animation_GetLastFrame(&object_reeba_Anim_0001E4); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 playerSpeed; Animation_Change(&this->skelanime, &object_reeba_Anim_0001E4, 2.0f, 0.0f, frames, ANIMMODE_LOOP, -10.0f); @@ -193,7 +193,7 @@ void func_80AE4F40(EnReeba* this, GlobalContext* globalCtx) { } void func_80AE5054(EnReeba* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 playerLinearVel; SkelAnime_Update(&this->skelanime); @@ -577,7 +577,7 @@ void func_80AE5EDC(EnReeba* this, GlobalContext* globalCtx) { void EnReeba_Update(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; EnReeba* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_80AE5EDC(this, globalCtx); this->actionfunc(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c index 96cf5a6a69..91684d5f42 100644 --- a/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c +++ b/src/overlays/actors/ovl_En_River_Sound/z_en_river_sound.c @@ -167,7 +167,7 @@ s32 EnRiverSound_GetSoundPos(Vec3s* points, s32 numPoints, Vec3f* hearPos, Vec3f void EnRiverSound_Update(Actor* thisx, GlobalContext* globalCtx) { Path* path; Vec3f* pos; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnRiverSound* this = THIS; s32 sp34; diff --git a/src/overlays/actors/ovl_En_Rl/z_en_rl.c b/src/overlays/actors/ovl_En_Rl/z_en_rl.c index be2df85d3a..79b96f2867 100644 --- a/src/overlays/actors/ovl_En_Rl/z_en_rl.c +++ b/src/overlays/actors/ovl_En_Rl/z_en_rl.c @@ -123,7 +123,7 @@ void func_80AE7590(EnRl* this, GlobalContext* globalCtx) { if (gSaveContext.sceneSetupIndex == 4 && sceneNum == SCENE_KENJYANOMA && globalCtx->csCtx.state != CS_STATE_IDLE && globalCtx->csCtx.npcActions[6] != NULL && globalCtx->csCtx.npcActions[6]->action == 2 && !this->lightMedallionGiven) { - player = PLAYER; + player = GET_PLAYER(globalCtx); pos.x = player->actor.world.pos.x; pos.y = player->actor.world.pos.y + 80.0f; pos.z = player->actor.world.pos.z; @@ -134,7 +134,7 @@ void func_80AE7590(EnRl* this, GlobalContext* globalCtx) { } void func_80AE7668(EnRl* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->drawConfig = 1; this->action = 1; diff --git a/src/overlays/actors/ovl_En_Rr/z_en_rr.c b/src/overlays/actors/ovl_En_Rr/z_en_rr.c index 66ba3a151a..71ee1e8f92 100644 --- a/src/overlays/actors/ovl_En_Rr/z_en_rr.c +++ b/src/overlays/actors/ovl_En_Rr/z_en_rr.c @@ -285,7 +285,7 @@ u8 EnRr_GetMessage(u8 shield, u8 tunic) { } void EnRr_SetupReleasePlayer(EnRr* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); u8 shield; u8 tunic; @@ -413,7 +413,7 @@ void EnRr_SetupStunned(EnRr* this) { void EnRr_CollisionCheck(EnRr* this, GlobalContext* globalCtx) { Vec3f hitPos; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->collider2.base.acFlags & AC_HIT) { this->collider2.base.acFlags &= ~AC_HIT; @@ -618,7 +618,7 @@ void EnRr_Reach(EnRr* this, GlobalContext* globalCtx) { } void EnRr_GrabPlayer(EnRr* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_800AA000(this->actor.xyzDistToPlayerSq, 120, 2, 120); if ((this->frameCount % 8) == 0) { diff --git a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c index 658a341710..309e80f804 100644 --- a/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c +++ b/src/overlays/actors/ovl_En_Ru1/z_en_ru1.c @@ -590,7 +590,7 @@ void func_80AEBC30(GlobalContext* globalCtx) { Player* player; if (globalCtx->csCtx.frames == 0xCD) { - player = PLAYER; + player = GET_PLAYER(globalCtx); Audio_PlaySoundGeneral(NA_SE_EV_DIVE_INTO_WATER, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); } @@ -818,7 +818,7 @@ void func_80AEC4F4(EnRu1* this) { } s32 func_80AEC5FC(EnRu1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 thisPosZ = this->actor.world.pos.z; f32 playerPosZ = player->actor.world.pos.z; @@ -854,7 +854,7 @@ void func_80AEC6E4(EnRu1* this, GlobalContext* globalCtx) { void func_80AEC780(EnRu1* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((func_80AEC5FC(this, globalCtx)) && (!Gameplay_InCsMode(globalCtx)) && (!(player->stateFlags1 & 0x206000)) && (player->actor.bgCheckFlags & 1)) { @@ -1016,7 +1016,7 @@ void func_80AECE04(EnRu1* this, GlobalContext* globalCtx) { void func_80AECE20(EnRu1* this, GlobalContext* globalCtx) { s32 pad2; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f* playerPos = &player->actor.world.pos; s16 shapeRotY = player->actor.shape.rot.y; s32 pad; @@ -1030,7 +1030,7 @@ void func_80AECE20(EnRu1* this, GlobalContext* globalCtx) { void func_80AECEB4(EnRu1* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f* player_unk_450 = &player->unk_450; Vec3f* pos = &this->actor.world.pos; s16 shapeRotY = this->actor.shape.rot.y; @@ -1041,7 +1041,7 @@ void func_80AECEB4(EnRu1* this, GlobalContext* globalCtx) { s32 func_80AECF6C(EnRu1* this, GlobalContext* globalCtx) { s16* shapeRotY; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Player* otherPlayer; s16 temp_f16; f32 temp1; @@ -1050,7 +1050,7 @@ s32 func_80AECF6C(EnRu1* this, GlobalContext* globalCtx) { this->unk_26C += 1.0f; if ((player->actor.speedXZ == 0.0f) && (this->unk_26C >= 3.0f)) { - otherPlayer = PLAYER; + otherPlayer = GET_PLAYER(globalCtx); player->actor.world.pos.x = otherPlayer->unk_450.x; player->actor.world.pos.y = otherPlayer->unk_450.y; player->actor.world.pos.z = otherPlayer->unk_450.z; @@ -1194,7 +1194,7 @@ void func_80AED4FC(EnRu1* this) { } void func_80AED520(EnRu1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Audio_PlaySoundGeneral(NA_SE_PL_PULL_UP_RUTO, &player->actor.projectedPos, 4, &D_801333E0, &D_801333E0, &D_801333E8); @@ -1640,7 +1640,7 @@ void func_80AEE7C4(EnRu1* this, GlobalContext* globalCtx) { return; } - player = PLAYER; + player = GET_PLAYER(globalCtx); if (player->stateFlags2 & 0x10000000) { this->unk_370 += 1.0f; if (this->action != 32) { @@ -1781,7 +1781,7 @@ void func_80AEEF5C(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEEF68(EnRu1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 something; this->unk_374.unk_18 = player->actor.world.pos; @@ -1791,7 +1791,7 @@ void func_80AEEF68(EnRu1* this, GlobalContext* globalCtx) { } void func_80AEEFEC(EnRu1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 something; this->unk_374.unk_18 = player->actor.world.pos; diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index 506925cf8b..cc9fccb0f8 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -251,7 +251,7 @@ void func_80AF29DC(EnRu2* this, GlobalContext* globalCtx) { } void func_80AF2A38(EnRu2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 posX = player->actor.world.pos.x; f32 posY = player->actor.world.pos.y + 50.0f; f32 posZ = player->actor.world.pos.z; @@ -266,7 +266,7 @@ void func_80AF2AB4(EnRu2* this, GlobalContext* globalCtx) { s16 temp; if ((gSaveContext.chamberCutsceneNum == 2) && (gSaveContext.sceneSetupIndex < 4)) { - player = PLAYER; + player = GET_PLAYER(globalCtx); this->action = 1; globalCtx->csCtx.segment = &D_80AF411C; gSaveContext.cutsceneTrigger = 2; @@ -620,7 +620,7 @@ void func_80AF37CC(EnRu2* this) { } s32 func_80AF383C(EnRu2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 thisPosX = this->actor.world.pos.x; f32 playerPosX = player->actor.world.pos.x; @@ -672,10 +672,10 @@ void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) { osSyncPrintf("おれが小松だ! \n"); this->unk_2C2++; if (this->unk_2C2 % 6 == 3) { - player = PLAYER; + player = GET_PLAYER(globalCtx); // uorya-! (screeming sound) osSyncPrintf("うおりゃー! \n"); - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); player->actor.world.pos.x = 820.0f; player->actor.world.pos.y = 0.0f; player->actor.world.pos.z = 180.0f; @@ -686,7 +686,7 @@ void func_80AF39DC(EnRu2* this, GlobalContext* globalCtx) { this->unk_2C3 = dialogState; if (func_8010BDBC(msgCtx) == 2) { this->action = 18; - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); } } diff --git a/src/overlays/actors/ovl_En_Sa/z_en_sa.c b/src/overlays/actors/ovl_En_Sa/z_en_sa.c index d1d6219655..efd4d821e3 100644 --- a/src/overlays/actors/ovl_En_Sa/z_en_sa.c +++ b/src/overlays/actors/ovl_En_Sa/z_en_sa.c @@ -372,7 +372,7 @@ s32 func_80AF5DFC(EnSa* this, GlobalContext* globalCtx) { } void func_80AF5F34(EnSa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_a3 = 0; if (globalCtx->sceneNum == SCENE_SPOT04) { @@ -588,7 +588,7 @@ void func_80AF67D0(EnSa* this, GlobalContext* globalCtx) { } void func_80AF683C(EnSa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!(player->actor.world.pos.z >= -2220.0f) && !Gameplay_InCsMode(globalCtx)) { globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(D_02005730); diff --git a/src/overlays/actors/ovl_En_Sda/z_en_sda.c b/src/overlays/actors/ovl_En_Sda/z_en_sda.c index 7724bf397c..1c2b5045d2 100644 --- a/src/overlays/actors/ovl_En_Sda/z_en_sda.c +++ b/src/overlays/actors/ovl_En_Sda/z_en_sda.c @@ -130,7 +130,7 @@ void EnSda_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == 1) { player = (Player*)this->actor.parent; } else { - player = PLAYER; + player = GET_PLAYER(globalCtx); } this->actor.world.pos = player->actor.world.pos; @@ -148,7 +148,7 @@ void EnSda_Draw(Actor* thisx, GlobalContext* globalCtx) { if (this->actor.params == 1) { player = (Player*)this->actor.parent; } else { - player = PLAYER; + player = GET_PLAYER(globalCtx); } player->actor.shape.shadowAlpha = 0; diff --git a/src/overlays/actors/ovl_En_Si/z_en_si.c b/src/overlays/actors/ovl_En_Si/z_en_si.c index 50c4f30be7..ad8a48a771 100644 --- a/src/overlays/actors/ovl_En_Si/z_en_si.c +++ b/src/overlays/actors/ovl_En_Si/z_en_si.c @@ -80,7 +80,7 @@ s32 func_80AFB748(EnSi* this, GlobalContext* globalCtx) { } void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->actor.flags & 0x2000) == 0x2000) { this->actionFunc = func_80AFB89C; @@ -109,7 +109,7 @@ void func_80AFB768(EnSi* this, GlobalContext* globalCtx) { } void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_SmoothStepToF(&this->actor.scale.x, 0.25f, 0.4f, 1.0f, 0.0f); Actor_SetScale(&this->actor, this->actor.scale.x); @@ -125,7 +125,7 @@ void func_80AFB89C(EnSi* this, GlobalContext* globalCtx) { } void func_80AFB950(EnSi* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_8010BDBC(&globalCtx->msgCtx) != 2) { player->actor.freezeTimer = 10; diff --git a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c index 74d515740e..eef956069a 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c @@ -114,7 +114,7 @@ void func_80AFBDC8(EnSiofuki* this, GlobalContext* globalCtx) { } void func_80AFBE8C(EnSiofuki* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 dX; f32 dY; f32 dZ; 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 365bccb1b4..13967c44fd 100644 --- a/src/overlays/actors/ovl_En_Skb/z_en_skb.c +++ b/src/overlays/actors/ovl_En_Skb/z_en_skb.c @@ -259,7 +259,7 @@ void EnSkb_Advance(EnSkb* this, GlobalContext* globalCtx) { s32 thisKeyFrame; s32 prevKeyFrame; f32 playSpeed; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->unk_283 != 0) && ((globalCtx->gameplayFrames & 0xF) == 0)) { this->unk_288 = Rand_CenteredFloat(50000.0f); @@ -474,7 +474,7 @@ void func_80AFD968(EnSkb* this, GlobalContext* globalCtx) { func_80AFD7B4(this, globalCtx); return; } - player = PLAYER; + player = GET_PLAYER(globalCtx); if (this->unk_283 == 0) { if ((this->actor.colChkInfo.damageEffect == 0xD) || ((this->actor.colChkInfo.damageEffect == 0xE) && diff --git a/src/overlays/actors/ovl_En_Skj/z_en_skj.c b/src/overlays/actors/ovl_En_Skj/z_en_skj.c index ac34bce28e..a3af338a22 100644 --- a/src/overlays/actors/ovl_En_Skj/z_en_skj.c +++ b/src/overlays/actors/ovl_En_Skj/z_en_skj.c @@ -454,7 +454,7 @@ void EnSkj_Init(Actor* thisx, GlobalContext* globalCtx2) { this->actor.gravity = -1.0f; EnSkj_CalculateCenter(this); - player = PLAYER; + player = GET_PLAYER(globalCtx); osSyncPrintf("Player_X : %f\n", player->actor.world.pos.x); osSyncPrintf("Player_Z : %f\n", player->actor.world.pos.z); osSyncPrintf("World_X : %f\n", this->actor.world.pos.x); @@ -723,7 +723,7 @@ void EnSkj_SariasSongKidIdle(EnSkj* this, GlobalContext* globalCtx) { this->backfilpFlag = 1; EnSkj_Backflip(this); } else if (sSmallStumpSkullKid.unk0 != 0) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (EnSkj_RangeCheck(player, sSmallStumpSkullKid.skullkid)) { EnSkj_SetupWaitInRange(this); player->stateFlags2 |= 0x800000; @@ -906,7 +906,7 @@ void EnSkj_SetupWaitInRange(EnSkj* this) { } void EnSkj_WaitInRange(EnSkj* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); // When link pulls out the Ocarina center him on the stump // Link was probably supposed to be pointed towards skull kid as well @@ -957,7 +957,7 @@ void EnSkj_SetupWaitForSong(EnSkj* this) { } void EnSkj_WaitForSong(EnSkj* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); // Played a song thats not Saria's song if (!(gSaveContext.itemGetInf[1] & 0x40) && @@ -1206,7 +1206,7 @@ void EnSkj_SetupWaitForTextClear(EnSkj* this) { void EnSkj_SariasSongWaitForTextClear(EnSkj* this, GlobalContext* globalCtx) { u8 state = func_8010BDBC(&globalCtx->msgCtx); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (state == 6 && func_80106BC8(globalCtx)) { EnSkj_SetupWaitInRange(this); @@ -1367,7 +1367,7 @@ void EnSkj_TurnPlayer(EnSkj* this, Player* player) { } void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (EnSkj_RangeCheck(player, this)) { sOcarinaMinigameSkullKids[SKULL_KID_LEFT].skullkid->playerInRange = true; @@ -1387,7 +1387,7 @@ void EnSkj_SetupWaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { } void EnSkj_WaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->stateFlags2 & 0x1000000) { player->stateFlags2 |= 0x2000000; @@ -1403,7 +1403,7 @@ void EnSkj_WaitForOcarina(EnSkj* this, GlobalContext* globalCtx) { void EnSkj_StartOcarinaMinigame(EnSkj* this, GlobalContext* globalCtx) { u8 dialogState = func_8010BDBC(&globalCtx->msgCtx); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnSkj_TurnPlayer(this, player); @@ -1418,7 +1418,7 @@ void EnSkj_StartOcarinaMinigame(EnSkj* this, GlobalContext* globalCtx) { } void EnSkj_WaitForPlayback(EnSkj* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnSkj_TurnPlayer(this, player); @@ -1518,7 +1518,7 @@ void EnSkj_WaitForOfferResponse(EnSkj* this, GlobalContext* globalCtx) { if (func_8010BDBC(&globalCtx->msgCtx) == 4 && func_80106BC8(globalCtx)) { switch (globalCtx->msgCtx.choiceIndex) { case 0: // yes - player = PLAYER; + player = GET_PLAYER(globalCtx); player->stateFlags3 |= 0x20; // makes player take ocarina out right away after closing box this->actionFunc = EnSkj_SetupWaitForOcarina; break; diff --git a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c index f6dd9d2759..1a15def251 100644 --- a/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c +++ b/src/overlays/actors/ovl_En_Ssh/z_en_ssh.c @@ -368,7 +368,7 @@ void EnSsh_Bob(EnSsh* this, GlobalContext* globalCtx) { } s32 EnSsh_IsCloseToLink(EnSsh* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 yDist; if (this->stateFlags & SSH_STATE_GROUND_START) { @@ -450,7 +450,7 @@ void EnSsh_Sway(EnSsh* this) { void EnSsh_CheckBodyStickHit(EnSsh* this, GlobalContext* globalCtx) { ColliderInfo* info0 = &this->colCylinder[0].info; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->unk_860 != 0) { info0->bumper.dmgFlags |= 2; diff --git a/src/overlays/actors/ovl_En_St/z_en_st.c b/src/overlays/actors/ovl_En_St/z_en_st.c index 78b49c9fb3..e87a972572 100644 --- a/src/overlays/actors/ovl_En_St/z_en_st.c +++ b/src/overlays/actors/ovl_En_St/z_en_st.c @@ -309,7 +309,7 @@ void EnSt_InitColliders(EnSt* this, GlobalContext* globalCtx) { void EnSt_CheckBodyStickHit(EnSt* this, GlobalContext* globalCtx) { ColliderInfo* body = &this->colCylinder[0].info; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (player->unk_860 != 0) { body->bumper.dmgFlags |= 2; @@ -384,7 +384,7 @@ void EnSt_UpdateCylinders(EnSt* this, GlobalContext* globalCtx) { } s32 EnSt_CheckHitLink(EnSt* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 hit; s32 i; @@ -692,7 +692,7 @@ void EnSt_Bob(EnSt* this, GlobalContext* globalCtx) { } s32 EnSt_IsCloseToPlayer(EnSt* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 yDist; if (this->takeDamageSpinTimer != 0) { diff --git a/src/overlays/actors/ovl_En_Stream/z_en_stream.c b/src/overlays/actors/ovl_En_Stream/z_en_stream.c index 375a9ad7c3..1372cfe0d0 100644 --- a/src/overlays/actors/ovl_En_Stream/z_en_stream.c +++ b/src/overlays/actors/ovl_En_Stream/z_en_stream.c @@ -82,7 +82,7 @@ s32 func_80B0B81C(Vec3f* vortexPosRot, Vec3f* playerPosRot, Vec3f* posDifference } void EnStream_SuckPlayer(EnStream* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad48; Vec3f posDifference; f32 xzDist; @@ -113,7 +113,7 @@ void EnStream_SuckPlayer(EnStream* this, GlobalContext* globalCtx) { } void EnStream_WaitForPlayer(EnStream* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 pad; Vec3f temp; 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 b1f4e2ea5f..dd61f4eccd 100644 --- a/src/overlays/actors/ovl_En_Sw/z_en_sw.c +++ b/src/overlays/actors/ovl_En_Sw/z_en_sw.c @@ -426,7 +426,7 @@ s32 func_80B0CCF4(EnSw* this, f32* arg1) { void func_80B0CEA8(EnSw* this, GlobalContext* globalCtx) { if (!(this->actor.scale.x < 0.0139999995f)) { - Camera* activeCam = ACTIVE_CAM; + Camera* activeCam = GET_ACTIVE_CAM(globalCtx); if (!(Math_Vec3f_DistXYZ(&this->actor.world.pos, &activeCam->eye) >= 380.0f)) { Audio_PlayActorSound2(&this->actor, ((this->actor.params & 0xE000) >> 0xD) > 0 ? NA_SE_EN_STALGOLD_ROLL @@ -682,7 +682,7 @@ s16 func_80B0DE34(EnSw* this, Vec3f* arg1) { } s32 func_80B0DEA8(EnSw* this, GlobalContext* globalCtx, s32 arg2) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); CollisionPoly* sp58; s32 sp54; Vec3f sp48; @@ -790,7 +790,7 @@ s32 func_80B0E430(EnSw* this, f32 arg1, s16 arg2, s32 arg3, GlobalContext* globa return 0; } - activeCam = ACTIVE_CAM; + activeCam = GET_ACTIVE_CAM(globalCtx); if (Math_Vec3f_DistXYZ(&this->actor.world.pos, &activeCam->eye) < 380.0f) { if (DECR(this->unk_440) == 0) { @@ -827,7 +827,7 @@ void func_80B0E5E0(EnSw* this, GlobalContext* globalCtx) { } void func_80B0E728(EnSw* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; if (DECR(this->unk_442) != 0) { diff --git a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c index c51f5065b9..988e48d38e 100644 --- a/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c +++ b/src/overlays/actors/ovl_En_Syateki_Itm/z_en_syateki_itm.c @@ -102,7 +102,7 @@ void EnSyatekiItm_Destroy(Actor* thisx, GlobalContext* globalCtx) { void EnSyatekiItm_Idle(EnSyatekiItm* this, GlobalContext* globalCtx) { s32 i; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->signal == ENSYATEKI_START) { player->actor.world.pos.x = -12.0f; @@ -126,7 +126,7 @@ void EnSyatekiItm_Idle(EnSyatekiItm* this, GlobalContext* globalCtx) { void EnSyatekiItm_StartRound(EnSyatekiItm* this, GlobalContext* globalCtx) { s32 i; s32 j; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->unkTimer == 0) { if (LINK_IS_ADULT) { @@ -166,7 +166,7 @@ void EnSyatekiItm_StartRound(EnSyatekiItm* this, GlobalContext* globalCtx) { } void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; s32 i; s32 roundIdx; @@ -274,7 +274,7 @@ void EnSyatekiItm_SpawnTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { } void EnSyatekiItm_CheckTargets(EnSyatekiItm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 i; s16 j; @@ -309,7 +309,7 @@ void EnSyatekiItm_CleanupGame(EnSyatekiItm* this, GlobalContext* globalCtx) { } void EnSyatekiItm_EndGame(EnSyatekiItm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); player->actor.freezeTimer = 10; if (this->signal == ENSYATEKI_RESULTS) { diff --git a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c index b82e57d5e8..394c90bed8 100644 --- a/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c +++ b/src/overlays/actors/ovl_En_Syateki_Niw/z_en_syateki_niw.c @@ -366,7 +366,7 @@ void func_80B123A8(EnSyatekiNiw* this, GlobalContext* globalCtx) { } void func_80B12460(EnSyatekiNiw* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 phi_f16 = 0.0f; player->actor.freezeTimer = 10; diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 7d31978a22..303ed84fcc 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -337,7 +337,7 @@ void func_80B145F8(EnTa* this, GlobalContext* globalCtx) { } void func_80B14634(EnTa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_8002F194(&this->actor, globalCtx)) { s32 exchangeItemId = func_8002F368(globalCtx); @@ -370,7 +370,7 @@ void func_80B146F8(EnTa* this, GlobalContext* globalCtx) { } void func_80B14754(EnTa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_8002F194(&this->actor, globalCtx) != 0) { s32 exchangeItemId = func_8002F368(globalCtx); @@ -583,7 +583,7 @@ void func_80B15034(EnTa* this, GlobalContext* globalCtx) { } s32 func_80B150AC(EnTa* this, GlobalContext* globalCtx, s32 idx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* interactRangeActor; if (player->stateFlags1 & 0x800) { @@ -597,7 +597,7 @@ s32 func_80B150AC(EnTa* this, GlobalContext* globalCtx, s32 idx) { } void func_80B15100(EnTa* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((func_8010BDBC(&globalCtx->msgCtx) == 5) && (func_80106BC8(globalCtx) != 0)) { s32 unk_2CA; diff --git a/src/overlays/actors/ovl_En_Test/z_en_test.c b/src/overlays/actors/ovl_En_Test/z_en_test.c index b12923b686..0992791c3e 100644 --- a/src/overlays/actors/ovl_En_Test/z_en_test.c +++ b/src/overlays/actors/ovl_En_Test/z_en_test.c @@ -360,7 +360,7 @@ void EnTest_ChooseRandomAction(EnTest* this, GlobalContext* globalCtx) { void EnTest_ChooseAction(EnTest* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawDiff = player->actor.shape.rot.y - this->actor.shape.rot.y; yawDiff = ABS(yawDiff); @@ -485,7 +485,7 @@ void EnTest_SetupIdle(EnTest* this) { } void EnTest_Idle(EnTest* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawDiff; SkelAnime_Update(&this->skelAnime); @@ -572,7 +572,7 @@ void EnTest_WalkAndBlock(EnTest* this, GlobalContext* globalCtx) { s32 prevFrame; s32 temp_f16; f32 playSpeed; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 absPlaySpeed; s16 yawDiff; s32 temp_v0_2; @@ -799,7 +799,7 @@ void func_80860F84(EnTest* this, GlobalContext* globalCtx) { s32 prevFrame; s32 temp_f16; s16 yawDiff; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 checkDist = 0.0f; s16 newYaw; f32 absPlaySpeed; @@ -946,7 +946,7 @@ void EnTest_SetupSlashDownEnd(EnTest* this) { } void EnTest_SlashDownEnd(EnTest* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawDiff; if (SkelAnime_Update(&this->skelAnime)) { @@ -1223,7 +1223,7 @@ void func_80862154(EnTest* this) { } void func_808621D4(EnTest* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.1f, 0.0f); @@ -1265,7 +1265,7 @@ void func_80862398(EnTest* this) { } void func_80862418(EnTest* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 0.1f, 0.0f); @@ -1318,7 +1318,7 @@ void EnTest_SetupStunned(EnTest* this) { } void EnTest_Stunned(EnTest* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_SmoothStepToF(&this->actor.speedXZ, 0.0f, 1.0f, 1.0f, 0.0f); @@ -1366,7 +1366,7 @@ void func_808627C4(EnTest* this, GlobalContext* globalCtx) { // a variation of sidestep void func_808628C8(EnTest* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad1; s32 prevFrame; s32 temp_f16; @@ -1655,7 +1655,7 @@ void EnTest_UpdateHeadRot(EnTest* this, GlobalContext* globalCtx) { } void EnTest_UpdateDamage(EnTest* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->shieldCollider.base.acFlags & AC_BOUNCED) { this->shieldCollider.base.acFlags &= ~AC_BOUNCED; diff --git a/src/overlays/actors/ovl_En_Tite/z_en_tite.c b/src/overlays/actors/ovl_En_Tite/z_en_tite.c index 6e12e85393..766077929b 100644 --- a/src/overlays/actors/ovl_En_Tite/z_en_tite.c +++ b/src/overlays/actors/ovl_En_Tite/z_en_tite.c @@ -368,7 +368,7 @@ void EnTite_Attack(EnTite* this, GlobalContext* globalCtx) { if (!(this->collider.base.atFlags & AT_HIT) && (this->actor.flags & 0x40)) { CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } else { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->collider.base.atFlags &= ~AT_HIT; Animation_MorphToLoop(&this->skelAnime, &object_tite_Anim_0012E4, 4.0f); this->actor.speedXZ = -6.0f; @@ -449,7 +449,7 @@ void EnTite_TurnTowardPlayer(EnTite* this, GlobalContext* globalCtx) { if ((this->actor.params == TEKTITE_BLUE) && (this->actor.bgCheckFlags & 0x20)) { this->actor.world.pos.y += this->actor.yDistToWater; } - angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &PLAYER->actor) - this->actor.world.rot.y; + angleToPlayer = Actor_WorldYawTowardActor(&this->actor, &GET_PLAYER(globalCtx)->actor) - this->actor.world.rot.y; if (angleToPlayer > 0) { turnVelocity = (angleToPlayer / 42.0f) + 10.0f; this->actor.world.rot.y += (turnVelocity * 2); diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 5791267064..b8c060457d 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -184,7 +184,7 @@ Actor* EnTorch2_GetAttackItem(GlobalContext* globalCtx, Player* this) { s32 EnTorch2_SwingSword(GlobalContext* globalCtx, Input* input, Player* this) { f32 noAttackChance = 0.0f; s32 attackDelay = 7; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->linearVelocity < 0.0f) || (player->linearVelocity < 0.0f)) { return 0; @@ -236,7 +236,7 @@ void EnTorch2_Backflip(Player* this, Input* input, Actor* thisx) { */ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { GlobalContext* globalCtx = globalCtx2; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Player* this = THIS; Input* input = &sInput; u16 phi_a2; diff --git a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c index 4f3a1831e2..0940ecbcd4 100644 --- a/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c +++ b/src/overlays/actors/ovl_En_Toryo/z_en_toryo.c @@ -149,7 +149,7 @@ void EnToryo_Destroy(Actor* thisx, GlobalContext* globalCtx) { s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 ret = 1; switch (func_8010BDBC(&globalCtx->msgCtx)) { @@ -222,7 +222,7 @@ s32 func_80B203D8(EnToryo* this, GlobalContext* globalCtx) { s32 func_80B205CC(EnToryo* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 ret = 5; switch (func_8010BDBC(&globalCtx->msgCtx)) { @@ -292,7 +292,7 @@ s32 func_80B206A0(EnToryo* this, GlobalContext* globalCtx) { } void func_80B20768(EnToryo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 sp32; s16 sp30; @@ -358,7 +358,7 @@ void func_80B20914(EnToryo* this, GlobalContext* globalCtx) { void EnToryo_Update(Actor* thisx, GlobalContext* globalCtx) { EnToryo* this = THIS; ColliderCylinder* collider = &this->collider; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 rot; Collider_UpdateCylinder(thisx, collider); diff --git a/src/overlays/actors/ovl_En_Tp/z_en_tp.c b/src/overlays/actors/ovl_En_Tp/z_en_tp.c index 4bbdbe0c3f..a81f4791c2 100644 --- a/src/overlays/actors/ovl_En_Tp/z_en_tp.c +++ b/src/overlays/actors/ovl_En_Tp/z_en_tp.c @@ -247,7 +247,7 @@ void EnTp_Head_SetupApproachPlayer(EnTp* this) { } void EnTp_Head_ApproachPlayer(EnTp* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 30.0f, 1.0f, 0.5f, 0.0f); Audio_PlaySoundGeneral(NA_SE_EN_TAIL_FLY - SFX_FLAG, &this->actor.projectedPos, 4, &D_801333E0, &D_801333E0, @@ -382,7 +382,7 @@ void EnTp_Head_SetupTakeOff(EnTp* this) { */ void EnTp_Head_TakeOff(EnTp* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Math_SmoothStepToF(&this->actor.speedXZ, 2.5f, 0.1f, 0.2f, 0.0f); Math_SmoothStepToF(&this->actor.world.pos.y, player->actor.world.pos.y + 85.0f + this->horizontalVariation, 1.0f, @@ -438,7 +438,7 @@ void EnTp_Head_SetupWait(EnTp* this) { * Awaken and rise from the ground when Player is closer than 200 */ void EnTp_Head_Wait(EnTp* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yaw; this->unk_15C--; @@ -660,7 +660,7 @@ void EnTp_Update(Actor* thisx, GlobalContext* globalCtx) { Vec3f kiraPos; Color_RGBA8 kiraPrimColor = { 0, 0, 255, 255 }; Color_RGBA8 kiraEnvColor = { 0, 0, 0, 0 }; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 yawToWall; if (player->stateFlags1 & 0x4000000) { // Shielding diff --git a/src/overlays/actors/ovl_En_Tr/z_en_tr.c b/src/overlays/actors/ovl_En_Tr/z_en_tr.c index 6c35185b5d..be8b7d1ca5 100644 --- a/src/overlays/actors/ovl_En_Tr/z_en_tr.c +++ b/src/overlays/actors/ovl_En_Tr/z_en_tr.c @@ -215,7 +215,7 @@ void func_80B23254(EnTr* this, GlobalContext* globalCtx, s32 arg2, f32 arg3, f32 Vec3f sp58; Color_RGBA8* primColor; Color_RGBA8* envColor; - Vec3f cameraEye = ACTIVE_CAM->eye; + Vec3f cameraEye = GET_ACTIVE_CAM(globalCtx)->eye; s16 yaw = Math_Vec3f_Yaw(&cameraEye, &this->actor.world.pos); s16 reversePitch = -Math_Vec3f_Pitch(&cameraEye, &this->actor.world.pos); f32 sp3C; @@ -420,8 +420,8 @@ s32 EnTr_OverrideLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, if ((child != NULL) && (limbIndex == 19)) { Matrix_MultVec3f(&src, &dest); - dest.x -= (10.0f * Math_SinS(Camera_GetCamDirYaw(ACTIVE_CAM))); - dest.z -= (10.0f * Math_CosS(Camera_GetCamDirYaw(ACTIVE_CAM))); + dest.x -= (10.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)))); + dest.z -= (10.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)))); child->world.pos = dest; } return 0; 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 1a4214c4c2..47b60c24e0 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 @@ -169,8 +169,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); @@ -222,7 +222,7 @@ void EnTuboTrap_HandleImpact(EnTuboTrap* this, GlobalContext* globalCtx) { } void EnTuboTrap_WaitForProximity(EnTuboTrap* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 targetHeight; if (BREG(2) != 0) { diff --git a/src/overlays/actors/ovl_En_Vali/z_en_vali.c b/src/overlays/actors/ovl_En_Vali/z_en_vali.c index 98c003d2c6..bdf1e5ab6a 100644 --- a/src/overlays/actors/ovl_En_Vali/z_en_vali.c +++ b/src/overlays/actors/ovl_En_Vali/z_en_vali.c @@ -291,8 +291,8 @@ void EnVali_DischargeLightning(EnVali* this, GlobalContext* globalCtx) { s16 yaw; for (i = 0; i < 4; i++) { - cos = -Math_CosS(Camera_GetCamDirYaw(ACTIVE_CAM)); - sin = Math_SinS(Camera_GetCamDirYaw(ACTIVE_CAM)); + cos = -Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); + sin = Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); if (!((this->lightningTimer + (i << 1)) % 4)) { yaw = (s16)Rand_CenteredFloat(12288.0f) + (i * 0x4000) + 0x2000; pos.x = this->actor.world.pos.x + (Math_SinS(yaw) * 12.0f * cos); diff --git a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c index 1a5f7e13ff..873111bd17 100644 --- a/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c +++ b/src/overlays/actors/ovl_En_Vb_Ball/z_en_vb_ball.c @@ -289,7 +289,7 @@ void EnVbBall_Update(Actor* thisx, GlobalContext* globalCtx2) { } } if (this->collider.base.atFlags & AT_HIT) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->collider.base.atFlags &= ~AT_HIT; Audio_PlayActorSound2(&player->actor, NA_SE_PL_BODY_HIT); diff --git a/src/overlays/actors/ovl_En_Vm/z_en_vm.c b/src/overlays/actors/ovl_En_Vm/z_en_vm.c index 8f000d8181..a174813b67 100644 --- a/src/overlays/actors/ovl_En_Vm/z_en_vm.c +++ b/src/overlays/actors/ovl_En_Vm/z_en_vm.c @@ -176,7 +176,7 @@ void EnVm_SetupWait(EnVm* this) { } void EnVm_Wait(EnVm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 dist; s16 headRot; s16 pad; @@ -260,7 +260,7 @@ void EnVm_SetupAttack(EnVm* this) { } void EnVm_Attack(EnVm* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 pitch = Math_Vec3f_Pitch(&this->beamPos1, &player->actor.world.pos); f32 dist; Vec3f playerPos; diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index ae73b56322..fe1c9ea5e5 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -93,7 +93,7 @@ void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx) { func_80078884(NA_SE_SY_TRE_BOX_APPEAR); this->timer = 60; EffectSsBomb2_SpawnLayered(globalCtx, &this->explosionCenter, &effVelocity, &effAccel, 200, 40); - quakeIndex = Quake_Add(ACTIVE_CAM, 1); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); Quake_SetSpeed(quakeIndex, 0x7FFF); Quake_SetQuakeValues(quakeIndex, 100, 0, 0, 0); Quake_SetCountdown(quakeIndex, 100); diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 9a4bf00d53..41b9a9ea15 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -152,7 +152,7 @@ void EnWallmas_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.flags &= ~1; this->actor.flags |= 0x20; @@ -165,7 +165,7 @@ void EnWallmas_TimerInit(EnWallmas* this, GlobalContext* globalCtx) { } void EnWallmas_SetupDrop(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); AnimationHeader* objSegChangee = &gWallmasterLungeAnim; Animation_Change(&this->skelAnime, objSegChangee, 0.0f, 20.0f, Animation_GetLastFrame(&gWallmasterLungeAnim), @@ -294,7 +294,7 @@ void EnWallmas_SetupStun(EnWallmas* this) { } void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f* playerPos = &player->actor.world.pos; this->actor.world.pos = *playerPos; @@ -321,7 +321,7 @@ void EnWallmas_WaitToDrop(EnWallmas* this, GlobalContext* globalCtx) { } void EnWallmas_Drop(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!Player_InCsMode(globalCtx) && !(player->stateFlags2 & 0x10) && (player->invincibilityTimer >= 0) && (this->actor.xzDistToPlayer < 30.0f) && (this->actor.yDistToPlayer < -5.0f) && @@ -364,7 +364,7 @@ void EnWallmas_JumpToCeiling(EnWallmas* this, GlobalContext* globalCtx) { } void EnWallmas_ReturnToCeiling(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); if (this->skelAnime.curFrame > 20.0f) { this->timer += 9; @@ -422,7 +422,7 @@ void EnWallmas_Die(EnWallmas* this, GlobalContext* globalCtx) { } void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Animation_OnFrame(&this->skelAnime, 1.0f) != 0) { if (!LINK_IS_ADULT) { @@ -475,7 +475,7 @@ void EnWallmas_TakePlayer(EnWallmas* this, GlobalContext* globalCtx) { } void EnWallmas_WaitForProximity(EnWallmas* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 200.0f) { EnWallmas_TimerInit(this, globalCtx); } 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 68bcce3552..e07a2e04d3 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 @@ -133,7 +133,7 @@ u8 WeatherTag_CheckEnableWeatherEffect(EnWeatherTag* this, GlobalContext* global u16 arg6, u8 weatherMode) { s32 pad; u8 ret = false; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this->actor.params)) { if ((globalCtx->envCtx.unk_1E != 0) || !D_8011FB3C || @@ -173,7 +173,7 @@ u8 WeatherTag_CheckRestoreWeather(EnWeatherTag* this, GlobalContext* globalCtx, u16 arg6) { s32 pad; u8 ret = false; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((WEATHER_TAG_RANGE100(this->actor.params) + 100.0f) < Actor_WorldDistXZToActor(&player->actor, &this->actor)) { if (globalCtx->envCtx.unk_1E != 0 || !D_8011FB3C || @@ -288,7 +288,7 @@ void EnWeatherTag_EnabledCloudyRainThunderKakariko(EnWeatherTag* this, GlobalCon } void EnWeatherTag_SetSandstormIntensity(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this->actor.params)) { Math_SmoothStepToS(&globalCtx->envCtx.unk_9E, -0x50, 1, 2, 1); @@ -300,7 +300,7 @@ void EnWeatherTag_SetSandstormIntensity(EnWeatherTag* this, GlobalContext* globa } void EnWeatherTag_DisabledRainThunder(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (Actor_WorldDistXZToActor(&player->actor, &this->actor) < WEATHER_TAG_RANGE100(this->actor.params)) { func_80077624(globalCtx); @@ -311,7 +311,7 @@ void EnWeatherTag_DisabledRainThunder(EnWeatherTag* this, GlobalContext* globalC } void EnWeatherTag_EnabledRainThunder(EnWeatherTag* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((WEATHER_TAG_RANGE100(this->actor.params) + 10.0f) < Actor_WorldDistXZToActor(&player->actor, &this->actor)) { func_80077684(globalCtx); diff --git a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c index 2628ae2933..9bc55b9cda 100644 --- a/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c +++ b/src/overlays/actors/ovl_En_Weiyer/z_en_weiyer.c @@ -280,7 +280,7 @@ void func_80B328E8(EnWeiyer* this, GlobalContext* globalCtx) { Rand_ZeroOne() * ((this->actor.home.pos.y - this->actor.floorHeight) / 2.0f) + this->actor.floorHeight; } } else { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->actor.bgCheckFlags & 1) { this->unk_280 = @@ -346,7 +346,7 @@ void func_80B32D30(EnWeiyer* this, GlobalContext* globalCtx) { } s16 func_80B32DEC(EnWeiyer* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f vec; vec.x = player->actor.world.pos.x; @@ -357,7 +357,7 @@ s16 func_80B32DEC(EnWeiyer* this, GlobalContext* globalCtx) { } void func_80B32E34(EnWeiyer* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); @@ -514,7 +514,7 @@ void func_80B333B8(EnWeiyer* this, GlobalContext* globalCtx) { } void func_80B3349C(EnWeiyer* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 phi_a1; s32 phi_a0; diff --git a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c index f250e374af..bb0ef61072 100644 --- a/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c +++ b/src/overlays/actors/ovl_En_Wonder_Item/z_en_wonder_item.c @@ -202,7 +202,7 @@ void EnWonderItem_Init(Actor* thisx, GlobalContext* globalCtx) { } void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 prevTagFlags = this->tagFlags; s32 i; s32 mask; @@ -239,7 +239,7 @@ void EnWonderItem_MultitagFree(EnWonderItem* this, GlobalContext* globalCtx) { } void EnWonderItem_ProximityDrop(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->actor.xzDistToPlayer < 50.0f) && (fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 30.0f)) { EnWonderItem_DropCollectible(this, globalCtx, true); @@ -254,7 +254,7 @@ void EnWonderItem_InteractSwitch(EnWonderItem* this, GlobalContext* globalCtx) { } void EnWonderItem_ProximitySwitch(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->actor.xzDistToPlayer < 50.0f) && (fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 30.0f)) { if (this->switchFlag >= 0) { @@ -265,7 +265,7 @@ void EnWonderItem_ProximitySwitch(EnWonderItem* this, GlobalContext* globalCtx) } void EnWonderItem_MultitagOrdered(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 prevTagFlags = this->tagFlags; s32 i; s32 mask; @@ -322,7 +322,7 @@ void EnWonderItem_BombSoldier(EnWonderItem* this, GlobalContext* globalCtx) { } void EnWonderItem_RollDrop(EnWonderItem* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((this->actor.xzDistToPlayer < 50.0f) && (player->invincibilityTimer < 0) && (fabsf(this->actor.world.pos.y - player->actor.world.pos.y) < 30.0f)) { diff --git a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c index 0e2a7eba84..14d6e58993 100644 --- a/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c +++ b/src/overlays/actors/ovl_En_Wonder_Talk2/z_en_wonder_talk2.c @@ -111,7 +111,7 @@ void func_80B3A10C(EnWonderTalk2* this, GlobalContext* globalCtx) { } void func_80B3A15C(EnWonderTalk2* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_158++; if ((this->switchFlag >= 0) && Flags_GetSwitch(globalCtx, this->switchFlag)) { @@ -205,7 +205,7 @@ void func_80B3A3D4(EnWonderTalk2* this, GlobalContext* globalCtx) { void func_80B3A4F8(EnWonderTalk2* this, GlobalContext* globalCtx) { Player* player; - player = PLAYER; + player = GET_PLAYER(globalCtx); this->unk_158++; if (this->switchFlag >= 0 && Flags_GetSwitch(globalCtx, this->switchFlag)) { if (!this->unk_15A) { diff --git a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c index a36ea5d5d3..388edea676 100644 --- a/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c +++ b/src/overlays/actors/ovl_En_Wood02/z_en_wood02.c @@ -375,7 +375,7 @@ void EnWood02_Update(Actor* thisx, GlobalContext* globalCtx2) { CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } } else if (this->actor.params < 0x17) { // Bush - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->unk_14C >= -1) { if (((player->rideActor == NULL) && (sqrt(this->actor.xyzDistToPlayerSq) < 20.0) && diff --git a/src/overlays/actors/ovl_En_Xc/z_en_xc.c b/src/overlays/actors/ovl_En_Xc/z_en_xc.c index c1e78b41ed..d6b2eae2a4 100644 --- a/src/overlays/actors/ovl_En_Xc/z_en_xc.c +++ b/src/overlays/actors/ovl_En_Xc/z_en_xc.c @@ -77,7 +77,7 @@ void EnXc_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void EnXc_CalculateHeadTurn(EnXc* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->npcInfo.unk_18 = player->actor.world.pos; this->npcInfo.unk_14 = kREG(16) - 3.0f; @@ -284,7 +284,7 @@ void func_80B3CA38(EnXc* this, GlobalContext* globalCtx) { s32 EnXc_MinuetCS(EnXc* this, GlobalContext* globalCtx) { if (this->actor.params == SHEIK_TYPE_MINUET) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 z = player->actor.world.pos.z; if (z < -2225.0f) { if (!Gameplay_InCsMode(globalCtx)) { @@ -314,7 +314,7 @@ s32 EnXc_BoleroCS(EnXc* this, GlobalContext* globalCtx) { PosRot* posRot; if (this->actor.params == SHEIK_TYPE_BOLERO) { - player = PLAYER; + player = GET_PLAYER(globalCtx); posRot = &player->actor.world; if ((posRot->pos.x > -784.0f) && (posRot->pos.x < -584.0f) && (posRot->pos.y > 447.0f) && (posRot->pos.y < 647.0f) && (posRot->pos.z > -446.0f) && (posRot->pos.z < -246.0f) && @@ -343,7 +343,7 @@ void EnXc_SetupSerenadeAction(EnXc* this, GlobalContext* globalCtx) { s32 EnXc_SerenadeCS(EnXc* this, GlobalContext* globalCtx) { if (this->actor.params == SHEIK_TYPE_SERENADE) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 stateFlags = player->stateFlags1; if (CHECK_OWNED_EQUIP(EQUIP_BOOTS, 1) && !(gSaveContext.eventChkInf[5] & 4) && !(stateFlags & 0x20000000) && !Gameplay_InCsMode(globalCtx)) { @@ -549,7 +549,7 @@ void func_80B3D48C(EnXc* this, GlobalContext* globalCtx) { if (linkAction != NULL) { yaw = linkAction->urot.y + 0x8000; } else { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); yaw = player->actor.world.rot.y + 0x8000; } diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 0257ef402a..ba15be52f0 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -341,7 +341,7 @@ void func_80B4AE18(EnZl1* this) { } void func_80B4AF18(EnZl1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; func_80038290(globalCtx, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); @@ -361,7 +361,7 @@ void func_80B4AF18(EnZl1* this, GlobalContext* globalCtx) { } void func_80B4B010(EnZl1* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad2; s32 pad3; s32 pad; @@ -407,7 +407,7 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { Vec3f sp58 = { -434.0f, 84.0f, 0.0f }; u8 sp54[] = { 0x00, 0x00, 0x02 }; s32 pad2; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); AnimationHeader* animHeaderSeg; MessageContext* msgCtx = &globalCtx->msgCtx; f32 frameCount; @@ -623,7 +623,7 @@ void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx) { void func_80B4BBC4(EnZl1* this, GlobalContext* globalCtx) { s32 pad; f32 frameCount = Animation_GetLastFrame(&gChildZelda1Anim_00438); - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Animation_Change(&this->skelAnime, &gChildZelda1Anim_00438, 1.0f, 0.0f, frameCount, ANIMMODE_LOOP, 0.0f); func_8002DF54(globalCtx, &this->actor, 1); @@ -695,7 +695,7 @@ void func_80B4BC78(EnZl1* this, GlobalContext* globalCtx) { void func_80B4BF2C(EnZl1* this, GlobalContext* globalCtx) { s32 pad; MessageContext* msgCtx = &globalCtx->msgCtx; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); switch (this->unk_1E2) { case 0: diff --git a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c index 826bb03138..70516fb0be 100644 --- a/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c +++ b/src/overlays/actors/ovl_En_Zl2/z_en_zl2.c @@ -544,7 +544,7 @@ void EnZl2_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve } { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Matrix_Push(); if (player->rightHandType == 0xFF) { Matrix_Put(&player->shieldMf); @@ -629,7 +629,7 @@ void EnZl2_GiveLightArrows(EnZl2* this, GlobalContext* globalCtx) { f32 posZ; if (this->unk_244 == 0) { - player = PLAYER; + player = GET_PLAYER(globalCtx); posX = player->actor.world.pos.x; posY = player->actor.world.pos.y + 80.0f; posZ = player->actor.world.pos.z; @@ -1179,7 +1179,7 @@ void func_80B513A8(EnZl2* this, GlobalContext* globalCtx) { f32 posZ; if (this->unk_250 == 0) { - player = PLAYER; + player = GET_PLAYER(globalCtx); posX = player->actor.world.pos.x; posY = player->actor.world.pos.y; posZ = player->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 62e8999994..f87bc09121 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -162,7 +162,7 @@ void func_80B536C4(EnZl3* this) { } void func_80B53764(EnZl3* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_3F8.unk_18 = player->actor.world.pos; this->unk_3F8.unk_14 = kREG(16) - 16.0f; @@ -1711,7 +1711,7 @@ s32 func_80B573C8(EnZl3* this, GlobalContext* globalCtx) { } s32 func_80B573FC(EnZl3* this, GlobalContext* globalCtx, f32 arg2) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 playerX = player->actor.world.pos.x; f32 playerZ = player->actor.world.pos.z; f32 thisX = this->actor.world.pos.x; @@ -1727,7 +1727,7 @@ s32 func_80B57458(EnZl3* this, GlobalContext* globalCtx) { Vec3f* thisPos = &this->actor.world.pos; f32 thisX = thisPos->x; f32 thisZ = thisPos->z; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f* playerPos = &player->actor.world.pos; s32 pad; f32 playerX = playerPos->x; @@ -1821,7 +1821,7 @@ void func_80B57754(EnZl3* this, GlobalContext* globalCtx) { void func_80B577BC(GlobalContext* globalCtx, Vec3f* vec) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f* playerPos = &player->actor.world.pos; f32 posX = vec->x; f32 posY = vec->y; @@ -1973,7 +1973,7 @@ s32 func_80B57D80(EnZl3* this, GlobalContext* globalCtx) { s32 pad; s16* sp32 = &this->actor.shape.rot.y; struct_80034A14_arg1* unk_3F8 = &this->unk_3F8; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 unk_314 = this->unk_314; s16 temp_v0 = func_80B57104(this, unk_314); s32 pad2; @@ -2031,7 +2031,7 @@ s32 func_80B57F84(EnZl3* this, GlobalContext* globalCtx) { void func_80B58014(EnZl3* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s8 invincibilityTimer = player->invincibilityTimer; if (func_80B57324(this, globalCtx)) { @@ -2073,7 +2073,7 @@ void func_80B58214(EnZl3* this, GlobalContext* globalCtx) { } void func_80B58268(EnZl3* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s8 invincibilityTimer = player->invincibilityTimer; if ((invincibilityTimer <= 0) && (player->fallDistance <= 50)) { @@ -2099,7 +2099,7 @@ void func_80B582C8(EnZl3* this, GlobalContext* globalCtx) { *unk_3CC += 1.0f; func_80B57858(globalCtx); } else if (*unk_3CC == kREG(17) + 40.0f) { - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); *unk_3CC += 1.0f; } else if (*unk_3CC >= ((kREG(17) + 40.0f) + 1.0f)) { this->action = 32; @@ -2111,7 +2111,7 @@ void func_80B582C8(EnZl3* this, GlobalContext* globalCtx) { void func_80B584B4(EnZl3* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s8 invincibilityTimer = player->invincibilityTimer; Actor* nearbyEnTest = Actor_FindNearby(globalCtx, &this->actor, ACTOR_EN_TEST, ACTORCAT_ENEMY, 8000.0f); @@ -2162,7 +2162,7 @@ void func_80B58624(EnZl3* this, GlobalContext* globalCtx) { } else { if (*unk_3CC >= kREG(20) + 30.0f) { this->action = 28; - func_8005B1A4(ACTIVE_CAM); + func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); func_80B54E14(this, &gZelda2Anime2Anim_009FBC, 0, -12.0f, 0); *unk_3CC = 0.0f; } else { @@ -2201,7 +2201,7 @@ s32 func_80B58938(EnZl3* this, GlobalContext* globalCtx) { s32 func_80B5899C(EnZl3* this, GlobalContext* globalCtx) { if ((this->actor.bgCheckFlags & 1)) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s8 invincibilityTimer = player->invincibilityTimer; if ((invincibilityTimer > 0) || (player->fallDistance >= 0x33)) { @@ -2221,7 +2221,7 @@ void func_80B58A1C(EnZl3* this, GlobalContext* globalCtx) { } void func_80B58A50(EnZl3* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s8 invincibilityTimer = player->invincibilityTimer; if ((invincibilityTimer <= 0) && (player->fallDistance <= 50)) { diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index d942a85673..596dc4f9b2 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -181,7 +181,7 @@ static struct_80034EC0_Entry sAnimationEntries[] = { #include "z_en_zl4_cutscene_data.c" void EnZl4_SetCsCameraAngle(GlobalContext* globalCtx, s16 index) { - Camera* activeCam = ACTIVE_CAM; + Camera* activeCam = GET_ACTIVE_CAM(globalCtx); Camera_ChangeSetting(activeCam, CAM_SET_FREE0); activeCam->at = sCsCameraAngle[index].at; @@ -191,8 +191,8 @@ void EnZl4_SetCsCameraAngle(GlobalContext* globalCtx, s16 index) { } void EnZl4_SetCsCameraMove(GlobalContext* globalCtx, s16 index) { - Camera* activeCam = ACTIVE_CAM; - Player* player = PLAYER; + Camera* activeCam = GET_ACTIVE_CAM(globalCtx); + Player* player = GET_PLAYER(globalCtx); Camera_ChangeSetting(activeCam, CAM_SET_DEMO0); Camera_ResetAnim(activeCam); @@ -305,7 +305,7 @@ void EnZl4_SetMove(EnZl4* this, GlobalContext* globalCtx) { } void func_80B5BB78(EnZl4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_1E0.unk_18 = player->actor.world.pos; func_80034A14(&this->actor, &this->unk_1E0, 2, 2); @@ -318,8 +318,8 @@ void EnZl4_GetActionStartPos(CsCmdActorAction* action, Vec3f* vec) { } s32 EnZl4_SetupFromLegendCs(EnZl4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; - Actor* playerx = &PLAYER->actor; + Player* player = GET_PLAYER(globalCtx); + Actor* playerx = &GET_PLAYER(globalCtx)->actor; s16 rotY; func_8002DF54(globalCtx, &this->actor, 8); @@ -419,8 +419,8 @@ void EnZl4_ReverseAnimation(EnZl4* this) { } s32 EnZl4_CsWaitForPlayer(EnZl4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; - Actor* playerx = &PLAYER->actor; + Player* player = GET_PLAYER(globalCtx); + Actor* playerx = &GET_PLAYER(globalCtx)->actor; s16 rotY; s16 yawDiff; s16 absYawDiff; @@ -786,7 +786,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { } s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { - Camera* activeCam = ACTIVE_CAM; + Camera* activeCam = GET_ACTIVE_CAM(globalCtx); switch (this->talkState) { case 0: @@ -932,7 +932,7 @@ s32 EnZl4_CsLookWindow(EnZl4* this, GlobalContext* globalCtx) { } s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 rotY; switch (this->talkState) { @@ -1098,7 +1098,7 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { if (!((func_8010BDBC(&globalCtx->msgCtx) == 5) && func_80106BC8(globalCtx))) { break; } else { - Camera_ChangeSetting(ACTIVE_CAM, 1); + Camera_ChangeSetting(GET_ACTIVE_CAM(globalCtx), 1); this->talkState = 7; globalCtx->talkWithPlayer(globalCtx, &this->actor); func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, fabsf(this->actor.xzDistToPlayer) + 1.0f, @@ -1121,7 +1121,7 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { } void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); switch (this->csState) { case ZL4_CS_WAIT: diff --git a/src/overlays/actors/ovl_En_Zo/z_en_zo.c b/src/overlays/actors/ovl_En_Zo/z_en_zo.c index d9d81f24d6..b6a74f3f9e 100644 --- a/src/overlays/actors/ovl_En_Zo/z_en_zo.c +++ b/src/overlays/actors/ovl_En_Zo/z_en_zo.c @@ -493,7 +493,7 @@ void EnZo_Blink(EnZo* this) { } void EnZo_Dialog(EnZo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->unk_194.unk_18 = player->actor.world.pos; if (this->actionFunc == EnZo_Standing) { @@ -509,7 +509,7 @@ void EnZo_Dialog(EnZo* this, GlobalContext* globalCtx) { } s32 EnZo_PlayerInProximity(EnZo* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f surfacePos; f32 yDist; f32 hDist; diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c index dcda6aa195..4fd344207c 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -113,7 +113,7 @@ void EnfHG_SetupIntro(EnfHG* this, GlobalContext* globalCtx) { void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { static Vec3f audioVec = { 0.0f, 0.0f, 50.0f }; s32 pad64; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); BossGanondrof* bossGnd = (BossGanondrof*)this->actor.parent; s32 pad58; s32 pad54; diff --git a/src/overlays/actors/ovl_End_Title/z_end_title.c b/src/overlays/actors/ovl_End_Title/z_end_title.c index c4fa997dd0..087ab0b617 100644 --- a/src/overlays/actors/ovl_End_Title/z_end_title.c +++ b/src/overlays/actors/ovl_End_Title/z_end_title.c @@ -51,7 +51,7 @@ void EndTitle_Draw(Actor* thisx, GlobalContext* globalCtx) { MtxF* mf; EndTitle* this = THIS; s32 frameCount = globalCtx->csCtx.frames; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); mf = &player->mf_9E0; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 821e735a16..ad844044ba 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -1574,7 +1574,7 @@ void Fishing_DrawLureHook(GlobalContext* globalCtx, Vec3f* pos, Vec3f* refPos, u f32 offsetY; Vec3f posSrc = { 0.0f, 0.0f, 1.0f }; Vec3f posStep; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 2963); @@ -1678,7 +1678,7 @@ void Fishing_UpdateSinkingLure(GlobalContext* globalCtx) { Vec3f sp88; f32 offsetX; f32 offsetZ; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); posSrc.z = 0.85f; @@ -1787,7 +1787,7 @@ void Fishing_DrawLureAndLine(GlobalContext* globalCtx, Vec3f* linePos, Vec3f* li s16 i; s16 spB4 = D_80B7E144; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 3287); @@ -1953,7 +1953,7 @@ void Fishing_DrawRod(GlobalContext* globalCtx) { f32 spC4; f32 spC0; Input* input = &globalCtx->state.input[0]; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_fishing.c", 3600); @@ -2100,7 +2100,7 @@ void Fishing_UpdateLure(Fishing* this, GlobalContext* globalCtx) { f32 phi_f16; f32 spC8; s16 i; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; Vec3f spA8; Vec3f sp9C; @@ -2890,7 +2890,7 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { s16 spEE; Fishing* this = THIS; GlobalContext* globalCtx = globalCtx2; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Input* input = &globalCtx->state.input[0]; f32 spD8; f32 phi_f0; @@ -4319,7 +4319,7 @@ void Fishing_HandleLilyPadContact(FishingProp* prop, Vec3f* entityPos, u8 fishTi void Fishing_UpdatePondProps(GlobalContext* globalCtx) { FishingProp* prop = &sPondProps[0]; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Actor* actor; s16 i; @@ -4489,7 +4489,7 @@ void Fishing_DrawPondProps(GlobalContext* globalCtx) { void Fishing_UpdateGroupFishes(GlobalContext* globalCtx) { s16 groupContactFlags = 0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); FishingGroupFish* fish = &sGroupFishes[0]; f32 dy; f32 dx; @@ -5084,7 +5084,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { f32 camAtFraction; f32 lureDistXZ; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Input* input = &globalCtx->state.input[0]; if (0) { diff --git a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c index fb46b84f8b..ddd4419560 100644 --- a/src/overlays/actors/ovl_Item_Shield/z_item_shield.c +++ b/src/overlays/actors/ovl_Item_Shield/z_item_shield.c @@ -187,7 +187,7 @@ void func_80B86CA8(ItemShield* this, GlobalContext* globalCtx) { void func_80B86F68(ItemShield* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); MtxF* shield = &player->shieldMf; this->actor.world.pos.x = shield->wx; diff --git a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c index 644609c355..740aa8e412 100644 --- a/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c +++ b/src/overlays/actors/ovl_Magic_Dark/z_magic_dark.c @@ -39,7 +39,7 @@ static Color_RGBA8 D_80B88B10[] = { { 50, 100, 150, 200 }, { 255, 200, 150, 100 void MagicDark_Init(Actor* thisx, GlobalContext* globalCtx) { MagicDark* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (!LINK_IS_ADULT) { this->scale = 0.4f; @@ -73,7 +73,7 @@ void MagicDark_Destroy(Actor* thisx, GlobalContext* globalCtx) { void MagicDark_DiamondUpdate(Actor* thisx, GlobalContext* globalCtx) { MagicDark* this = THIS; u8 phi_a0; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 pad; s16 nayrusLoveTimer = gSaveContext.nayrusLoveTimer; s32 msgMode = globalCtx->msgCtx.msgMode; @@ -124,7 +124,7 @@ void MagicDark_DiamondUpdate(Actor* thisx, GlobalContext* globalCtx) { } thisx->world.rot.y += 0x3E8; - thisx->shape.rot.y = thisx->world.rot.y + Camera_GetCamDirYaw(ACTIVE_CAM); + thisx->shape.rot.y = thisx->world.rot.y + Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); this->timer++; gSaveContext.nayrusLoveTimer = nayrusLoveTimer + 1; @@ -168,7 +168,7 @@ void MagicDark_DimLighting(GlobalContext* globalCtx, f32 intensity) { void MagicDark_OrbUpdate(Actor* thisx, GlobalContext* globalCtx) { MagicDark* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_8002F974(&this->actor, NA_SE_PL_MAGIC_SOUL_BALL - SFX_FLAG); if (this->timer < 35) { @@ -203,7 +203,7 @@ void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx) { func_80093D84(globalCtx->state.gfxCtx); { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 heightDiff; this->actor.world.pos.x = player->bodyPartsPos[0].x; @@ -234,7 +234,7 @@ void MagicDark_DiamondDraw(Actor* thisx, GlobalContext* globalCtx) { void MagicDark_OrbDraw(Actor* thisx, GlobalContext* globalCtx) { MagicDark* this = THIS; Vec3f pos; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; f32 sp6C = globalCtx->state.frames & 0x1F; @@ -252,11 +252,11 @@ void MagicDark_OrbDraw(Actor* thisx, GlobalContext* globalCtx) { return; } - pos.x -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirYaw(ACTIVE_CAM)) * - Math_CosS(Camera_GetCamDirPitch(ACTIVE_CAM))); - pos.y -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirPitch(ACTIVE_CAM))); - pos.z -= (this->actor.scale.x * 300.0f * Math_CosS(Camera_GetCamDirYaw(ACTIVE_CAM)) * - Math_CosS(Camera_GetCamDirPitch(ACTIVE_CAM))); + pos.x -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * + Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)))); + pos.y -= (this->actor.scale.x * 300.0f * Math_SinS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)))); + pos.z -= (this->actor.scale.x * 300.0f * Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * + Math_CosS(Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)))); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_magic_dark.c", 619); diff --git a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c index a26540ff3b..b6ea921551 100644 --- a/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c +++ b/src/overlays/actors/ovl_Magic_Fire/z_magic_fire.c @@ -341,7 +341,7 @@ void MagicFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { void MagicFire_UpdateBeforeCast(Actor* thisx, GlobalContext* globalCtx) { MagicFire* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if ((globalCtx->msgCtx.msgMode == 0xD) || (globalCtx->msgCtx.msgMode == 0x11)) { Actor_Kill(&this->actor); @@ -358,7 +358,7 @@ void MagicFire_UpdateBeforeCast(Actor* thisx, GlobalContext* globalCtx) { void MagicFire_Update(Actor* thisx, GlobalContext* globalCtx) { MagicFire* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; if (1) {} diff --git a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c index 1c93d3087a..03b6138dbc 100644 --- a/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c +++ b/src/overlays/actors/ovl_Magic_Wind/z_magic_wind.c @@ -128,7 +128,7 @@ void MagicWind_SetupAction(MagicWind* this, MagicWindFunc actionFunc) { void MagicWind_Init(Actor* thisx, GlobalContext* globalCtx) { MagicWind* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (SkelCurve_Init(globalCtx, &this->skelCurve, &sLimbList, &sTransformUpdIdx) == 0) { // Magic_Wind_Actor_ct (): Construct failed @@ -167,7 +167,7 @@ void MagicWind_UpdateAlpha(f32 alpha) { } void MagicWind_WaitForTimer(MagicWind* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->timer > 0) { this->timer--; diff --git a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c index f35c1a6134..0902be8c47 100644 --- a/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c +++ b/src/overlays/actors/ovl_Mir_Ray/z_mir_ray.c @@ -129,7 +129,7 @@ void MirRay_SetupCollider(MirRay* this) { // Set up a light point between source point and reflection point. Reflection point is the pool point (for windows) or // at the player position (for mirrors) void MirRay_MakeShieldLight(MirRay* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); MirRayDataEntry* dataEntry = &sMirRayData[this->actor.params]; Vec3f reflectionPt; Vec3s lightPt; @@ -241,7 +241,7 @@ void MirRay_Destroy(Actor* thisx, GlobalContext* globalCtx) { void MirRay_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad; MirRay* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); D_80B8E670 = 0; @@ -269,7 +269,7 @@ void MirRay_SetIntensity(MirRay* this, GlobalContext* globalCtx) { f32 temp_f0_2; f32 temp_f2_2; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); MtxF* shieldMtx = &player->shieldMf; this->reflectIntensity = 0.0f; @@ -308,7 +308,7 @@ void MirRay_SetIntensity(MirRay* this, GlobalContext* globalCtx) { // Draws six images, one for each corner of the shield, by finding the intersection of a line segment from the corner // perpendicular to the shield with the nearest collision (if any). void MirRay_SetupReflectionPolys(MirRay* this, GlobalContext* globalCtx, MirRayShieldReflection* reflection) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); MtxF* shieldMtx; s32 i; Vec3f posA; @@ -365,7 +365,7 @@ void MirRay_RemoveSimilarReflections(MirRayShieldReflection* reflection) { // Creates the reflected beam's collider (to interact with objects) and places and orients the shield images void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldReflection* reflection) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 i; f32 temp_f0; Vec3f vecB; @@ -483,7 +483,7 @@ void MirRay_ReflectedBeam(MirRay* this, GlobalContext* globalCtx, MirRayShieldRe void MirRay_Draw(Actor* thisx, GlobalContext* globalCtx) { MirRay* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 i; MirRayShieldReflection reflection[6]; s32 temp; diff --git a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c index 6d51c073f0..f752ed59c8 100644 --- a/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c +++ b/src/overlays/actors/ovl_Obj_Lift/z_obj_lift.c @@ -144,7 +144,7 @@ void func_80B96560(ObjLift* this, GlobalContext* globalCtx) { if (((this->dyna.actor.params >> 8) & 7) == 7) { func_80B967C0(this); } else { - quakeIndex = Quake_Add(ACTIVE_CAM, 1); + quakeIndex = Quake_Add(GET_ACTIVE_CAM(globalCtx), 1); Quake_SetSpeed(quakeIndex, 10000); Quake_SetQuakeValues(quakeIndex, 2, 0, 0, 0); Quake_SetCountdown(quakeIndex, 20); diff --git a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c index 7c9698a8cf..0578549790 100644 --- a/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c +++ b/src/overlays/actors/ovl_Obj_Makekinsuta/z_obj_makekinsuta.c @@ -48,7 +48,7 @@ void ObjMakekinsuta_Init(Actor* thisx, GlobalContext* globalCtx) { void func_80B98320(ObjMakekinsuta* this, GlobalContext* globalCtx) { if (this->unk_152 != 0) { - if (this->timer >= 60 && !func_8002DEEC(PLAYER)) { + if (this->timer >= 60 && !func_8002DEEC(GET_PLAYER(globalCtx))) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_SW, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, this->actor.shape.rot.y, 0, (this->actor.params | 0x8000)); this->actionFunc = ObjMakekinsuta_DoNothing; diff --git a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c index 14e14e106a..d818a71919 100644 --- a/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c +++ b/src/overlays/actors/ovl_Obj_Oshihiki/z_obj_oshihiki.c @@ -469,7 +469,7 @@ void ObjOshihiki_SetupOnScene(ObjOshihiki* this, GlobalContext* globalCtx) { void ObjOshihiki_OnScene(ObjOshihiki* this, GlobalContext* globalCtx) { s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->stateFlags |= PUSHBLOCK_ON_SCENE; if ((this->timer <= 0) && (fabsf(this->dyna.unk_150) > 0.001f)) { @@ -496,7 +496,7 @@ void ObjOshihiki_SetupOnActor(ObjOshihiki* this, GlobalContext* globalCtx) { void ObjOshihiki_OnActor(ObjOshihiki* this, GlobalContext* globalCtx) { s32 bgId; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); DynaPolyActor* dynaPolyActor; this->stateFlags |= PUSHBLOCK_ON_ACTOR; @@ -556,7 +556,7 @@ void ObjOshihiki_SetupPush(ObjOshihiki* this, GlobalContext* globalCtx) { void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { Actor* thisx = &this->dyna.actor; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 pushDistSigned; s32 stopFlag; @@ -577,7 +577,7 @@ void ObjOshihiki_Push(ObjOshihiki* this, GlobalContext* globalCtx) { this->pushSpeed = 0.0f; ObjOshihiki_SetupFall(this, globalCtx); } else if (stopFlag) { - player = PLAYER; + player = GET_PLAYER(globalCtx); if (ObjOshihiki_CheckWall(globalCtx, this->dyna.unk_158, this->dyna.unk_150, this)) { Audio_PlayActorSound2(thisx, NA_SE_EV_BLOCK_BOUND); } @@ -607,7 +607,7 @@ void ObjOshihiki_SetupFall(ObjOshihiki* this, GlobalContext* globalCtx) { } void ObjOshihiki_Fall(ObjOshihiki* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->stateFlags |= PUSHBLOCK_FALL; if (fabsf(this->dyna.unk_150) > 0.001f) { 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 6bc2a937e0..01c9cbe5d0 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -153,7 +153,7 @@ void ObjSyokudai_Update(Actor* thisx, GlobalContext* globalCtx2) { } } } else { - player = PLAYER; + player = GET_PLAYER(globalCtx); interactionType = 0; if (this->actor.params & 0x400) { this->litTimer = -1; @@ -295,7 +295,8 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Matrix_Translate(0.0f, 52.0f, 0.0f, MTXMODE_APPLY); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) - this->actor.shape.rot.y + 0x8000) * (M_PI / 0x8000), + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.shape.rot.y + 0x8000) * + (M_PI / 0x8000), MTXMODE_APPLY); Matrix_Scale(flameScale, flameScale, flameScale, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c index ce860c1b6f..39756c0b9d 100644 --- a/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c +++ b/src/overlays/actors/ovl_Obj_Timeblock/z_obj_timeblock.c @@ -155,7 +155,7 @@ u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, GlobalContext* globalCtx) { Vec3f distance; f32 blockSize; - func_8002DBD0(&this->dyna.actor, &distance, &PLAYER->actor.world.pos); + func_8002DBD0(&this->dyna.actor, &distance, &GET_PLAYER(globalCtx)->actor.world.pos); blockSize = this->dyna.actor.scale.x * 50.0f + 6.0f; // Return true if player's xz position is not inside the block if (blockSize < fabsf(distance.x) || blockSize < fabsf(distance.z)) { @@ -167,7 +167,7 @@ u8 ObjTimeblock_PlayerIsInRange(ObjTimeblock* this, GlobalContext* globalCtx) { } s32 ObjTimeblock_WaitForOcarina(ObjTimeblock* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (ObjTimeblock_PlayerIsInRange(this, globalCtx)) { if (player->stateFlags2 & 0x1000000) { diff --git a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c index e5efe8740f..c1de1bd687 100644 --- a/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c +++ b/src/overlays/actors/ovl_Obj_Tsubo/z_obj_tsubo.c @@ -263,7 +263,7 @@ void ObjTsubo_Idle(ObjTsubo* this, GlobalContext* globalCtx) { } } if (this->actor.xzDistToPlayer < 100.0f) { - temp_v0 = this->actor.yawTowardsPlayer - PLAYER->actor.world.rot.y; + temp_v0 = this->actor.yawTowardsPlayer - GET_PLAYER(globalCtx)->actor.world.rot.y; phi_v1 = ABS(temp_v0); if (phi_v1 >= 0x5556) { // GI_NONE in this case allows the player to lift the actor diff --git a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c index 405a895504..de1a1b12dc 100644 --- a/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c +++ b/src/overlays/actors/ovl_Obj_Warp2block/z_obj_warp2block.c @@ -88,7 +88,7 @@ s32 func_80BA1ECC(ObjWarp2block* this, GlobalContext* globalCtx) { } temp_a3 = this->dyna.actor.child; - player = PLAYER; + player = GET_PLAYER(globalCtx); if ((this->dyna.actor.xzDistToPlayer <= sDistances[(((this->dyna.actor.params >> 0xB) & 7))]) || (temp_a3->xzDistToPlayer <= sDistances[(((temp_a3->params >> 0xB) & 7))])) { @@ -157,7 +157,7 @@ void ObjWarp2block_SwapWithChild(ObjWarp2block* this, GlobalContext* globalCtx) } s32 func_80BA2218(ObjWarp2block* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (func_80BA1ECC(this, globalCtx)) { if (player->stateFlags2 & 0x1000000) { diff --git a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c index b85bdc60c1..d0f5215e61 100644 --- a/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c +++ b/src/overlays/actors/ovl_Oceff_Spot/z_oceff_spot.c @@ -67,7 +67,7 @@ void OceffSpot_Init(Actor* thisx, GlobalContext* globalCtx) { void OceffSpot_Destroy(Actor* thisx, GlobalContext* globalCtx) { s32 pad; OceffSpot* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode1); LightContext_RemoveLight(globalCtx, &globalCtx->lightCtx, this->lightNode2); @@ -120,7 +120,7 @@ void OceffSpot_GrowCylinder(OceffSpot* this, GlobalContext* globalCtx) { void OceffSpot_Update(Actor* thisx, GlobalContext* globalCtx) { OceffSpot* this = THIS; s32 pad; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); f32 temp; temp = (1.0f - cosf(this->unk_174 * M_PI)) * 0.5f; diff --git a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c index d74ed07143..ad8d960e01 100644 --- a/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c +++ b/src/overlays/actors/ovl_Oceff_Storm/z_oceff_storm.c @@ -61,7 +61,7 @@ void OceffStorm_Init(Actor* thisx, GlobalContext* globalCtx) { void OceffStorm_Destroy(Actor* thisx, GlobalContext* globalCtx) { OceffStorm* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_800876C8(globalCtx); if (gSaveContext.nayrusLoveTimer != 0) { @@ -117,10 +117,10 @@ void OceffStorm_UnkAction(OceffStorm* this, GlobalContext* globalCtx) { void OceffStorm_Update(Actor* thisx, GlobalContext* globalCtx) { OceffStorm* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->actor.world.pos = player->actor.world.pos; - this->actor.shape.rot.y = Camera_GetCamDirYaw(ACTIVE_CAM); + this->actor.shape.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); this->actionFunc(this, globalCtx); } diff --git a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c index fd91a7aee6..360dbe85e7 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c +++ b/src/overlays/actors/ovl_Oceff_Wipe/z_oceff_wipe.c @@ -40,13 +40,13 @@ void OceffWipe_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.1f); this->counter = 0; - this->actor.world.pos = ACTIVE_CAM->eye; + this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; osSyncPrintf(VT_FGCOL(CYAN) " WIPE arg_data = %d\n" VT_RST, this->actor.params); } void OceffWipe_Destroy(Actor* thisx, GlobalContext* globalCtx) { OceffWipe* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_800876C8(globalCtx); if (gSaveContext.nayrusLoveTimer != 0) { @@ -57,7 +57,7 @@ void OceffWipe_Destroy(Actor* thisx, GlobalContext* globalCtx) { void OceffWipe_Update(Actor* thisx, GlobalContext* globalCtx) { OceffWipe* this = THIS; - this->actor.world.pos = ACTIVE_CAM->eye; + this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; if (this->counter < 100) { this->counter++; } else { @@ -76,8 +76,8 @@ void OceffWipe_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = ACTIVE_CAM->eye; - Camera_GetSkyboxOffset(&vec, ACTIVE_CAM); + eye = GET_ACTIVE_CAM(globalCtx)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); OPEN_DISPS(globalCtx->state.gfxCtx, "../z_oceff_wipe.c", 346); diff --git a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c index acad0d34e7..f7541c959a 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c +++ b/src/overlays/actors/ovl_Oceff_Wipe2/z_oceff_wipe2.c @@ -34,13 +34,13 @@ void OceffWipe2_Init(Actor* thisx, GlobalContext* globalCtx) { OceffWipe2* this = THIS; Actor_SetScale(&this->actor, 0.1f); this->counter = 0; - this->actor.world.pos = ACTIVE_CAM->eye; + this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; osSyncPrintf(VT_FGCOL(CYAN) " WIPE2 arg_data = %d\n" VT_RST, this->actor.params); } void OceffWipe2_Destroy(Actor* thisx, GlobalContext* globalCtx) { OceffWipe2* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_800876C8(globalCtx); if (gSaveContext.nayrusLoveTimer != 0) { @@ -50,7 +50,7 @@ void OceffWipe2_Destroy(Actor* thisx, GlobalContext* globalCtx) { void OceffWipe2_Update(Actor* thisx, GlobalContext* globalCtx) { OceffWipe2* this = THIS; - this->actor.world.pos = ACTIVE_CAM->eye; + this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; if (this->counter < 100) { this->counter++; } else { @@ -68,8 +68,8 @@ void OceffWipe2_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = ACTIVE_CAM->eye; - Camera_GetSkyboxOffset(&vec, ACTIVE_CAM); + eye = GET_ACTIVE_CAM(globalCtx)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); if (this->counter < 32) { z = Math_SinS(this->counter << 9) * 1330; } else { diff --git a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c index 7b525f8f61..73f21facd5 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c +++ b/src/overlays/actors/ovl_Oceff_Wipe3/z_oceff_wipe3.c @@ -34,14 +34,14 @@ void OceffWipe3_Init(Actor* thisx, GlobalContext* globalCtx) { OceffWipe3* this = THIS; Actor_SetScale(&this->actor, 0.1f); this->counter = 0; - this->actor.world.pos = ACTIVE_CAM->eye; + this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; // it's actually WIPE3... osSyncPrintf(VT_FGCOL(CYAN) " WIPE2 arg_data = %d\n" VT_RST, this->actor.params); } void OceffWipe3_Destroy(Actor* thisx, GlobalContext* globalCtx) { OceffWipe3* this = THIS; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); func_800876C8(globalCtx); if (gSaveContext.nayrusLoveTimer != 0) { @@ -51,7 +51,7 @@ void OceffWipe3_Destroy(Actor* thisx, GlobalContext* globalCtx) { void OceffWipe3_Update(Actor* thisx, GlobalContext* globalCtx) { OceffWipe3* this = THIS; - this->actor.world.pos = ACTIVE_CAM->eye; + this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; if (this->counter < 100) { this->counter++; } else { @@ -69,8 +69,8 @@ void OceffWipe3_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = ACTIVE_CAM->eye; - Camera_GetSkyboxOffset(&vec, ACTIVE_CAM); + eye = GET_ACTIVE_CAM(globalCtx)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); if (this->counter < 32) { z = Math_SinS(this->counter << 9) * 1330; } else { diff --git a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c index 0700866b72..7e1b78dbce 100644 --- a/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c +++ b/src/overlays/actors/ovl_Oceff_Wipe4/z_oceff_wipe4.c @@ -35,7 +35,7 @@ void OceffWipe4_Init(Actor* thisx, GlobalContext* globalCtx) { Actor_SetScale(&this->actor, 0.1f); this->counter = 0; - this->actor.world.pos = ACTIVE_CAM->eye; + this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; osSyncPrintf(VT_FGCOL(CYAN) " WIPE4 arg_data = %d\n" VT_RST, this->actor.params); } @@ -48,7 +48,7 @@ void OceffWipe4_Destroy(Actor* thisx, GlobalContext* globalCtx) { void OceffWipe4_Update(Actor* thisx, GlobalContext* globalCtx) { OceffWipe4* this = THIS; - this->actor.world.pos = ACTIVE_CAM->eye; + this->actor.world.pos = GET_ACTIVE_CAM(globalCtx)->eye; if (this->counter < 50) { this->counter++; } else { @@ -66,8 +66,8 @@ void OceffWipe4_Draw(Actor* thisx, GlobalContext* globalCtx) { Vtx* vtxPtr; Vec3f vec; - eye = ACTIVE_CAM->eye; - Camera_GetSkyboxOffset(&vec, ACTIVE_CAM); + eye = GET_ACTIVE_CAM(globalCtx)->eye; + Camera_GetSkyboxOffset(&vec, GET_ACTIVE_CAM(globalCtx)); if (this->counter < 16) { z = Math_SinS(this->counter << 10) * 1330; } else { diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index 2c6ea38255..2dd2de11e5 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -121,7 +121,7 @@ void ShotSun_TriggerFairy(ShotSun* this, GlobalContext* globalCtx) { } void func_80BADF0C(ShotSun* this, GlobalContext* globalCtx) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s32 pad; s32 params = this->actor.params & 0xFF; @@ -155,7 +155,7 @@ void func_80BADF0C(ShotSun* this, GlobalContext* globalCtx) { void ShotSun_UpdateHyliaSun(ShotSun* this, GlobalContext* globalCtx) { Vec3s cylinderPos; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); EnItem00* collectible; s32 pad; Vec3f spawnPos; diff --git a/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c b/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c index a3a9f0013b..a11bbfbed1 100644 --- a/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c +++ b/src/overlays/actors/ovl_kaleido_scope/z_kaleido_scope_PAL.c @@ -2474,7 +2474,7 @@ void KaleidoScope_Update(GlobalContext* globalCtx) { PauseContext* pauseCtx = &globalCtx->pauseCtx; InterfaceContext* interfaceCtx = &globalCtx->interfaceCtx; GameOverContext* gameOverCtx = &globalCtx->gameOverCtx; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); Input* input = &globalCtx->state.input[0]; u32 size; u32 size0; diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index 52b1acb921..3e61579468 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -1151,7 +1151,7 @@ s32 func_80832224(Player* this) { } s32 func_8083224C(GlobalContext* globalCtx) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); return (this->actor.flags & 0x100) == 0x100; } @@ -1537,7 +1537,7 @@ void func_8083315C(GlobalContext* globalCtx, Player* this) { func_80077D10(&D_808535D4, &D_808535D8, sControlInput); - D_808535DC = Camera_GetInputDirYaw(ACTIVE_CAM) + D_808535D8; + D_808535DC = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)) + D_808535D8; this->unk_846 = (this->unk_846 + 1) % 4; @@ -2996,7 +2996,7 @@ void func_80836BEC(Player* this, GlobalContext* globalCtx) { if (this->actor.category == ACTORCAT_PLAYER) { actorToTarget = globalCtx->actorCtx.targetCtx.arrowPointedActor; } else { - actorToTarget = &PLAYER->actor; + actorToTarget = &GET_PLAYER(globalCtx)->actor; } holdTarget = (gSaveContext.zTargetSetting != 0) || (this->actor.category != ACTORCAT_PLAYER); @@ -3124,7 +3124,7 @@ s32 func_80837268(Player* this, f32* arg1, s16* arg2, f32 arg3, GlobalContext* g return 0; } else { - *arg2 += Camera_GetInputDirYaw(ACTIVE_CAM); + *arg2 += Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); return 1; } } @@ -6457,7 +6457,7 @@ s32 func_80840058(Player* this, f32* arg1, s16* arg2, GlobalContext* globalCtx) func_8083DC54(this, globalCtx); if ((*arg1 != 0.0f) || (ABS(this->unk_87C) > 400)) { - s16 temp1 = *arg2 - Camera_GetInputDirYaw(ACTIVE_CAM); + s16 temp1 = *arg2 - Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); u16 temp2 = (ABS(temp1) - 0x2000) & 0xFFFF; if ((temp2 < 0x4000) || (this->unk_87C != 0)) { @@ -7603,7 +7603,7 @@ void func_80843188(Player* this, GlobalContext* globalCtx) { if (this->unk_850 != 0) { sp54 = sControlInput->rel.stick_y * 100; sp50 = sControlInput->rel.stick_x * -120; - sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(ACTIVE_CAM); + sp4E = this->actor.shape.rot.y - Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); sp40 = Math_CosS(sp4E); sp4C = (Math_SinS(sp4E) * sp50) + (sp54 * sp40); @@ -11989,7 +11989,7 @@ void func_8084E6D4(Player* this, GlobalContext* globalCtx) { } if (this->skelAnime.animation == &gPlayerAnim_002788) { - Math_ScaledStepToS(&this->actor.shape.rot.y, Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000, 4000); + Math_ScaledStepToS(&this->actor.shape.rot.y, Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000, 4000); } if (LinkAnimation_OnFrame(&this->skelAnime, 21.0f)) { @@ -12538,7 +12538,7 @@ s32 func_8084FCAC(Player* this, GlobalContext* globalCtx) { s16 angle; s16 temp; - angle = temp = Camera_GetInputDirYaw(ACTIVE_CAM); + angle = temp = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); if (CHECK_BTN_ALL(sControlInput->cur.button, BTN_DDOWN)) { angle = temp + 0x8000; @@ -14011,13 +14011,13 @@ void func_80852E14(Player* this, GlobalContext* globalCtx) { } s32 Player_IsDroppingFish(GlobalContext* globalCtx) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); return (func_8084EFC0 == this->func_674) && (this->itemActionParam == PLAYER_AP_BOTTLE_FISH); } s32 Player_StartFishing(GlobalContext* globalCtx) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); func_80832564(globalCtx, this); func_80835F44(globalCtx, this, ITEM_FISHING_POLE); @@ -14041,7 +14041,7 @@ s32 func_80852F38(GlobalContext* globalCtx, Player* this) { // Sets up player cutscene s32 func_80852FFC(GlobalContext* globalCtx, Actor* actor, s32 csMode) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); if (!Player_InBlockingCsMode(globalCtx, this)) { func_80832564(globalCtx, this); @@ -14062,7 +14062,7 @@ void func_80853080(Player* this, GlobalContext* globalCtx) { } s32 Player_InflictDamage(GlobalContext* globalCtx, s32 damage) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); if (!Player_InBlockingCsMode(globalCtx, this) && !func_80837B18(globalCtx, this, damage)) { this->stateFlags2 &= ~0x80; @@ -14074,7 +14074,7 @@ s32 Player_InflictDamage(GlobalContext* globalCtx, s32 damage) { // Start talking with the given actor void func_80853148(GlobalContext* globalCtx, Actor* actor) { - Player* this = PLAYER; + Player* this = GET_PLAYER(globalCtx); s32 pad; if ((this->targetActor != NULL) || (actor == this->naviActor) || ((actor->flags & 0x40001) == 0x40001)) { diff --git a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c index c155950cd3..587678b374 100644 --- a/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c +++ b/src/overlays/effects/ovl_Effect_Ss_En_Fire/z_eff_ss_en_fire.c @@ -73,7 +73,7 @@ void EffectSsEnFire_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) { OPEN_DISPS(gfxCtx, "../z_eff_en_fire.c", 169); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); - camYaw = (Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000); + camYaw = (Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000); Matrix_RotateY(camYaw * (M_PI / 0x8000), MTXMODE_APPLY); scale = Math_SinS(this->life * 0x333) * (this->rScale * 0.00005f); diff --git a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c index dd8b04cf82..ebad9da8d6 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fhg_Flash/z_eff_ss_fhg_flash.c @@ -178,7 +178,7 @@ void EffectSsFhgFlash_UpdateShock(GlobalContext* globalCtx, u32 index, EffectSs* this->rXZRot = (this->rXZRot + rand) + 0x4000; if (this->rParam == FHGFLASH_SHOCK_PLAYER) { - player = PLAYER; + player = GET_PLAYER(globalCtx); randBodypart = Rand_ZeroFloat(17.9f); this->pos.x = player->bodyPartsPos[randBodypart].x + Rand_CenteredFloat(10.0f); this->pos.y = player->bodyPartsPos[randBodypart].y + Rand_CenteredFloat(15.0f); diff --git a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c index 09066252e5..c0e00027cf 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c +++ b/src/overlays/effects/ovl_Effect_Ss_Fire_Tail/z_eff_ss_fire_tail.c @@ -86,12 +86,14 @@ void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_Translate(this->pos.x + this->actor->world.pos.x, this->pos.y + this->actor->world.pos.y, this->pos.z + this->actor->world.pos.z, MTXMODE_NEW); } else { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); s16 bodyPart = this->rBodyPart; - this->pos.x = player->bodyPartsPos[bodyPart].x - (Math_SinS(Camera_GetCamDirYaw(ACTIVE_CAM)) * 5.0f); + this->pos.x = + player->bodyPartsPos[bodyPart].x - (Math_SinS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * 5.0f); this->pos.y = player->bodyPartsPos[bodyPart].y; - this->pos.z = player->bodyPartsPos[bodyPart].z - (Math_CosS(Camera_GetCamDirYaw(ACTIVE_CAM)) * 5.0f); + this->pos.z = + player->bodyPartsPos[bodyPart].z - (Math_CosS(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))) * 5.0f); Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); } @@ -99,11 +101,11 @@ void EffectSsFireTail_Draw(GlobalContext* globalCtx, u32 index, EffectSs* this) Matrix_Translate(this->pos.x, this->pos.y, this->pos.z, MTXMODE_NEW); } - yaw = Math_Vec3f_Yaw(&scale, &this->vec) - Camera_GetCamDirYaw(ACTIVE_CAM); + yaw = Math_Vec3f_Yaw(&scale, &this->vec) - Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); temp1 = fabsf(Math_CosS(yaw)); temp2 = Math_SinS(yaw); dist = Math_Vec3f_DistXZ(&scale, &this->vec) / (this->rReg10 * 0.1f); - Matrix_RotateY((s16)(Camera_GetCamDirYaw(ACTIVE_CAM) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 0x8000), MTXMODE_APPLY); Matrix_RotateZ(temp2 * this->rReg2 * dist * (M_PI / 180.0f), MTXMODE_APPLY); temp2 = 1.0f - ((f32)(this->life + 1) / this->rLifespan); temp2 = 1.0f - SQ(temp2); diff --git a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c index a76fcc2094..643b3749b8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c +++ b/src/overlays/effects/ovl_Effect_Ss_Hahen/z_eff_ss_hahen.c @@ -117,7 +117,7 @@ void EffectSsHahen_DrawGray(GlobalContext* globalCtx, u32 index, EffectSs* this) } void EffectSsHahen_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) { - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); this->rPitch += 55; this->rYaw += 10; diff --git a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c index e8c7cff424..b1ef28263d 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c +++ b/src/overlays/effects/ovl_Effect_Ss_Kakera/z_eff_ss_kakera.c @@ -348,7 +348,7 @@ s32 func_809AA0EC(EffectSs* this) { void func_809AA230(EffectSs* this, GlobalContext* globalCtx) { static f32 D_809AA5B0[] = { 10.0f, 20.0f, 40.0f }; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->rReg8 == 0) { if ((((this->rReg4 >> 4) & 1) * 0x10) == 0x10) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c index d89e0160ae..5fcce046c8 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c +++ b/src/overlays/effects/ovl_Effect_Ss_Lightning/z_eff_ss_lightning.c @@ -131,8 +131,8 @@ void EffectSsLightning_Update(GlobalContext* globalCtx, u32 index, EffectSs* thi pos.y = this->pos.y + (Math_SinS(this->rYaw - 0x4000) * scale); scale = Math_CosS(this->rYaw - 0x4000) * scale; - pos.x = this->pos.x - (Math_CosS(Camera_GetInputDirYaw(ACTIVE_CAM)) * scale); - pos.z = this->pos.z + (Math_SinS(Camera_GetInputDirYaw(ACTIVE_CAM)) * scale); + pos.x = this->pos.x - (Math_CosS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx))) * scale); + pos.z = this->pos.z + (Math_SinS(Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx))) * scale); EffectSsLightning_NewLightning(globalCtx, &pos, yaw, this); diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c index 251856139e..b4c19b6bbb 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c @@ -82,7 +82,7 @@ void EffectSsSibuki_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) s32 pad[3]; f32 xzVelScale; s16 yaw; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); if (this->pos.y <= player->actor.floorHeight) { this->life = 0; diff --git a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c index 61ee5e3701..babae25179 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c +++ b/src/overlays/effects/ovl_Effect_Ss_Solder_Srch_Ball/z_eff_ss_solder_srch_ball.c @@ -35,7 +35,7 @@ void EffectSsSolderSrchBall_Update(GlobalContext* globalCtx, u32 index, EffectSs f32 playerPosDiffY; f32 playerPosDiffZ; s16* linkDetected; - Player* player = PLAYER; + Player* player = GET_PLAYER(globalCtx); linkDetected = this->actor; diff --git a/tools/actorfixer.py b/tools/actorfixer.py index 3720cb0bca..77d1b24924 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -103,6 +103,8 @@ wordReplace = { "func_800D20CC": "Matrix_MtxFToYXZRotS", "func_800D2264": "Matrix_MtxFToZYXRotS", "func_800D23FC": "Matrix_RotateAxis", + "PLAYER": "GET_PLAYER(globalCtx)", + "ACTIVE_CAM": "GET_ACTIVE_CAM(globalCtx)", } # [a-zA-Z0-9_]