1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-10 11:03:46 +00:00

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
This commit is contained in:
engineer124 2021-08-31 20:22:03 +10:00 committed by GitHub
parent f8498478c4
commit 1117783731
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
281 changed files with 1013 additions and 979 deletions

View file

@ -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)
Next: [Draw functions](draw_functions.md)

View file

@ -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)

View file

@ -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];

View file

@ -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;

View file

@ -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) {

View file

@ -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;
}

View file

@ -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;

View file

@ -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);
}
}
}

View file

@ -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);

View file

@ -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) {

View file

@ -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)) {

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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]++;

View file

@ -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;

View file

@ -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,

View file

@ -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) {

View file

@ -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);

View file

@ -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;

View file

@ -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;

View file

@ -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) &&

View file

@ -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

View file

@ -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) {

View file

@ -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) {

View file

@ -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),

View file

@ -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);

View file

@ -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);

View file

@ -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;
}

View file

@ -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);

View file

@ -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);

View file

@ -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) {

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);
}

View file

@ -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 {

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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) {

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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);

View file

@ -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--;

View file

@ -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

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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) {

View file

@ -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),

View file

@ -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);

View file

@ -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);

View file

@ -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;
}
}

View file

@ -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)) {

View file

@ -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);

View file

@ -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);

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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)) {

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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++);

View file

@ -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 };

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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) {

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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);

View file

@ -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) &&

View file

@ -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);

View file

@ -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);

View file

@ -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)) {

View file

@ -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;

View file

@ -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;

View file

@ -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);

View file

@ -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;

View file

@ -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) {

View file

@ -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);

View file

@ -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);

View file

@ -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;

Some files were not shown because too many files have changed in this diff Show more