diff options
| author | engineer124 <47598039+engineer124@users.noreply.github.com> | 2021-08-31 20:22:03 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-08-31 12:22:03 +0200 |
| commit | 1117783731523947813e3834ae6871a0de37108c (patch) | |
| tree | cd01546a640c9e214d62c393cf08bfa313995743 /src/code | |
| parent | f8498478c466a0a8ceb9650427cf37e3c3bf4a0b (diff) | |
Macros: `PLAYER` -> `GET_PLAYER(globalCtx)`, `ACTIVE_CAM` -> `GET_ACTIVE_CAM(globalCtx)` (#921)
* PLAYER -> GET_PLAYER(globalCtx)
* ACTIVE_CAM -> GET_ACTIVE_CAM(globalCtx)
* PR Suggestions
* formatter
* Add brackets
* remove from actorfixer.py
* Bring back actorfixer.py change
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/code_80097A00.c | 2 | ||||
| -rw-r--r-- | src/code/z_actor.c | 48 | ||||
| -rw-r--r-- | src/code/z_bgcheck.c | 2 | ||||
| -rw-r--r-- | src/code/z_camera.c | 8 | ||||
| -rw-r--r-- | src/code/z_collision_check.c | 4 | ||||
| -rw-r--r-- | src/code/z_demo.c | 10 | ||||
| -rw-r--r-- | src/code/z_effect_soft_sprite_old_init.c | 2 | ||||
| -rw-r--r-- | src/code/z_elf_message.c | 2 | ||||
| -rw-r--r-- | src/code/z_en_item00.c | 2 | ||||
| -rw-r--r-- | src/code/z_map_exp.c | 6 | ||||
| -rw-r--r-- | src/code/z_parameter.c | 8 | ||||
| -rw-r--r-- | src/code/z_play.c | 19 | ||||
| -rw-r--r-- | src/code/z_player_lib.c | 18 | ||||
| -rw-r--r-- | src/code/z_room.c | 10 | ||||
| -rw-r--r-- | src/code/z_scene_table.c | 6 |
15 files changed, 73 insertions, 74 deletions
diff --git a/src/code/code_80097A00.c b/src/code/code_80097A00.c index 7481564fc..f8b8e4e28 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 2140efce6..4ddc2581b 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 c8be7361b..426757f75 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 5f643a09c..8eae2f7ac 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 1790f6864..d5237bb96 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 c28bad4f9..b0dd00118 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 30390e827..73c2aba44 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 eb81dec6d..f6f3a22f5 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 6393c2f43..35fd67387 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 b327e122e..54ff428e5 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 f2cb1103e..7fc6abef0 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 2fa25e093..d12eddcec 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 0ec34898f..8ce855350 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 20a040512..4e6448ccc 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 a33237aec..0a8db0631 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]++; |
