Macros: PLAYER -> GET_PLAYER(globalCtx) and ACTIVE_CAM -> GET_ACTIVE_CAM(globalCtx) (#283)

* PLAYER -> GET_PLAYER(globalCtx), ACTIVE_CAM -> GET_ACTIVE_CAM(globalCtx)

* formatter

* PR Suggestions

* `FIRST_ENEMY` -> `GET_FIRST_ENEMY(globalCtx)`

* Fix merge conflicts
This commit is contained in:
engineer124
2021-10-13 03:27:29 +11:00
committed by GitHub
parent 4c43661cf3
commit 3aeadb42b8
74 changed files with 301 additions and 300 deletions
+2 -2
View File
@@ -54,7 +54,7 @@ s32 func_800E8FA4(Actor* actor, Vec3f* param_2, Vec3s* param_3, Vec3s* param_4)
}
s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, f32 param_5) {
Player* player = PLAYER;
Player* player = GET_PLAYER(globalCtx);
s16 sVar3;
Vec3f local_14;
s16 sVar3A;
@@ -83,7 +83,7 @@ s32 func_800E9138(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s*
}
s32 func_800E9250(GlobalContext* globalCtx, Actor* actor, Vec3s* param_3, Vec3s* param_4, Vec3f param_5) {
Player* player = PLAYER;
Player* player = GET_PLAYER(globalCtx);
s16 sVar3;
Vec3f local_14;
s16 sVar3A;
+2 -2
View File
@@ -2913,8 +2913,8 @@ void CollisionCheck_AC(GlobalContext* globalCtx, CollisionCheckContext* colCtxt,
/**
* Iterates through all AT colliders, testing them for AC collisions with each AC collider, setting the info regarding
* the collision for each AC and AT collider that collided. Then spawns hitmarks and plays sound effects for each
* successful collision. To collide, an AT collider must share a type (PLAYER, ENEMY, or BOMB) with the AC collider and
* the toucher and bumper elements that overlapped must share a dmgFlag.
* successful collision. To collide, an AT collider must share a type (AC_TYPE_PLAYER, AC_TYPE_ENEMY, or AC_TYPE_OTHER)
* with the AC collider and the toucher and bumper elements that overlapped must share a dmgFlag.
*/
void CollisionCheck_AT(GlobalContext* globalCtx, CollisionCheckContext* colCtxt) {
Collider** col;
+1 -1
View File
@@ -899,7 +899,7 @@ void EffectSsFireTail_SpawnFlame(GlobalContext* globalCtx, Actor* actor, Vec3f*
#endif
void EffectSsFireTail_SpawnFlameOnPlayer(GlobalContext* globalCtx, f32 scale, s16 bodyPart, f32 colorIntensity) {
Player* player = PLAYER;
Player* player = GET_PLAYER(globalCtx);
EffectSsFireTail_SpawnFlame(globalCtx, &player->actor, &player->bodyPartsPos[bodyPart], scale, bodyPart,
colorIntensity);
+2 -2
View File
@@ -403,7 +403,7 @@ void func_800A6780(EnItem00* this, GlobalContext* globalCtx) {
}
void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) {
Player* player = PLAYER;
Player* player = GET_PLAYER(globalCtx);
if (this->unk14A != 0) {
if (Actor_HasParent(&this->actor, globalCtx) == 0) {
@@ -439,7 +439,7 @@ void func_800A6A40(EnItem00* this, GlobalContext* globalCtx) {
void EnItem00_Update(Actor* thisx, GlobalContext* globalCtx) {
EnItem00* this = THIS;
s32 pad;
Player* player = PLAYER;
Player* player = GET_PLAYER(globalCtx);
s32 sp38 = player->stateFlags3 & 0x1000;
s32 getItemId = GI_NONE;
s32 pad2;
+3 -3
View File
@@ -444,7 +444,7 @@ void Quake2_Update(void) {
Player* player;
GlobalContext* globalCtx = sQuake2Context.globalCtx;
PosRot playerPosRot;
Camera* camera = globalCtx->cameraPtrs[globalCtx->activeCamera];
Camera* camera = GET_ACTIVE_CAM(globalCtx);
f32 speedRatio = CLAMP_MAX(camera->speedRatio, 1.0f);
if (sQuake2Context.type != 0) {
@@ -605,7 +605,7 @@ void Quake2_Update(void) {
angle1 = 0x3F0;
angle2 = 0x156;
sQuake2Context.countdown = 2;
player = PLAYER;
player = GET_PLAYER(globalCtx);
if (&player->actor != NULL) {
func_800B8248(&playerPosRot, player);
@@ -654,7 +654,7 @@ void Quake2_Update(void) {
angle1 = 0x3F0;
angle2 = 0x156;
sQuake2Context.countdown = 2;
player = PLAYER;
player = GET_PLAYER(globalCtx);
angle1Speed = 359.2f;
angle2Speed = -18.5f;
rotX = 0.0f;
+1 -1
View File
@@ -114,7 +114,7 @@ s32 Room_HandleLoadCallbacks(GlobalContext* globalCtx, RoomContext* roomCtx) {
gSegments[3] = PHYSICAL_TO_VIRTUAL(roomCtx->activeRoomVram);
Scene_ProcessHeader(globalCtx, (SceneCmd*)roomCtx->currRoom.segment);
func_80123140(globalCtx, PLAYER);
func_80123140(globalCtx, GET_PLAYER(globalCtx));
Actor_SpawnTransitionActors(globalCtx, &globalCtx->actorCtx);
if (((globalCtx->sceneNum != SCENE_IKANA) || (roomCtx->currRoom.num != 1)) &&
+2 -2
View File
@@ -119,7 +119,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos,
s32 ret = 0;
u32 unk2;
camera = ACTIVE_CAM;
camera = GET_ACTIVE_CAM(globalCtx);
distance = OLib_Vec3fDist(pos, &camera->eye);
if ((distance < distanceMin) || (distanceMax < distance)) {
@@ -148,7 +148,7 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos,
}
actors[0] = actor;
actors[1] = &PLAYER->actor;
actors[1] = &GET_PLAYER(globalCtx)->actor;
if (CollisionCheck_LineOCCheck(globalCtx, &globalCtx->colChkCtx, pos, &camera->eye, actors, 2) != 0) {
func_8013A41C(0x3b);
ret |= 0x3b;