From 4042b42e4caeffa39293473fc5f9d5cec6187d56 Mon Sep 17 00:00:00 2001 From: mzxrules Date: Mon, 29 Dec 2025 19:21:49 -0500 Subject: [PATCH 1/2] name Camera_GetFocusActorCategory() --- include/camera.h | 2 +- include/sfx.h | 1 - src/code/z_camera.c | 8 ++++---- src/code/z_camera_data.inc.c | 2 +- .../actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c | 11 +++++------ .../actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 2 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 2 +- .../actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c | 8 ++++---- src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c | 12 ++++++------ src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c | 2 +- 11 files changed, 25 insertions(+), 27 deletions(-) diff --git a/include/camera.h b/include/camera.h index c56e2b8f8f2..bc00aec4f61 100644 --- a/include/camera.h +++ b/include/camera.h @@ -1671,7 +1671,7 @@ s32 Camera_ChangeDoorCam(Camera* camera, struct Actor* doorActor, s16 bgCamIndex s32 Camera_Copy(Camera* dstCamera, Camera* srcCamera); Vec3f Camera_GetQuakeOffset(Camera* camera); void Camera_SetCameraData(Camera* camera, s16 setDataFlags, void* data0, void* data1, s16 data2, s16 data3, s32 data4); -s32 func_8005B198(void); +s32 Camera_GetFocusActorCategory(void); s16 Camera_SetFinishedFlag(Camera* camera); #endif diff --git a/include/sfx.h b/include/sfx.h index 2a9b543c3b5..c6783284f05 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -4,7 +4,6 @@ #include "ultra64.h" #include "versions.h" #include "z_math.h" -#include "assert.h" #define MAX_CHANNELS_PER_BANK 3 diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 803a89400fb..2695fdec983 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -5346,7 +5346,7 @@ s32 Camera_Unique9(Camera* camera) { if (rwData->curKeyFrame->initField != ONEPOINT_CS_INIT_FIELD_NONE) { if (ONEPOINT_CS_INIT_FIELD_IS_TYPE_ACTORCAT(rwData->curKeyFrame->initField)) { - D_8011D3AC = rwData->curKeyFrame->initField & 0xF; + sCameraFocusActorCategory = rwData->curKeyFrame->initField & 0xF; } else if (ONEPOINT_CS_INIT_FIELD_IS_TYPE_HUD_VISIBILITY(rwData->curKeyFrame->initField)) { Camera_UpdateInterface( CAM_INTERFACE_FIELD(CAM_LETTERBOX_IGNORE, rwData->curKeyFrame->initField, 0)); @@ -6148,7 +6148,7 @@ s32 Camera_Demo5(Camera* camera) { camera->targetPosRot = Actor_GetFocus(camera->target); playerTargetGeo = OLib_Vec3fDiffToVecGeo(&camera->targetPosRot.pos, &camera->playerPosRot.pos); - D_8011D3AC = camera->target->category; + sCameraFocusActorCategory = camera->target->category; Actor_GetScreenPos(camera->play, camera->target, &targetScreenPosX, &targetScreenPosY); eyeTargetDist = OLib_Vec3fDist(&camera->targetPosRot.pos, &camera->eye); eyePlayerGeo = OLib_Vec3fDiffToVecGeo(&playerhead.pos, &camera->eyeNext); @@ -8933,8 +8933,8 @@ s32 Camera_QRegInit(void) { } #endif -s32 func_8005B198(void) { - return D_8011D3AC; +s32 Camera_GetFocusActorCategory(void) { + return sCameraFocusActorCategory; } /** diff --git a/src/code/z_camera_data.inc.c b/src/code/z_camera_data.inc.c index 82d1dd619ac..d3bb9d2c39e 100644 --- a/src/code/z_camera_data.inc.c +++ b/src/code/z_camera_data.inc.c @@ -2572,7 +2572,7 @@ s32 sCameraInterfaceField = CAM_INTERFACE_FIELD(CAM_LETTERBOX_NONE, CAM_HUD_VISI s32 sCameraHudVisibilityMode = HUD_VISIBILITY_NOTHING_ALT; s32 sCameraLetterboxSize = 32; -s32 D_8011D3AC = -1; +s32 sCameraFocusActorCategory = -1; // only applicable to CAM_FUNC_DEMO5, CAM_FUNC_UNIQ9 // Used in Camera_KeepOn3 and Camera_KeepOn4 to check around an `at` position for an `eye` position such that the // `at`-`eye` segment is not obstructed by collision or colliders. diff --git a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c index 90855881e48..b6d7239db3c 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c @@ -288,7 +288,7 @@ void func_8086D67C(BgBdanSwitch* this) { } void func_8086D694(BgBdanSwitch* this, PlayState* play) { - if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { + if ((Camera_GetFocusActorCategory() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.2f; if (this->unk_1C8 <= 0.1f) { func_8086D730(this); @@ -366,7 +366,7 @@ void func_8086D944(BgBdanSwitch* this) { } void func_8086D95C(BgBdanSwitch* this, PlayState* play) { - if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { + if ((Camera_GetFocusActorCategory() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.2f; if (this->unk_1C8 <= 0.1f) { func_8086DB24(this); @@ -453,7 +453,7 @@ void func_8086DC30(BgBdanSwitch* this) { } void func_8086DC48(BgBdanSwitch* this, PlayState* play) { - if ((func_8005B198() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { + if ((Camera_GetFocusActorCategory() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { this->unk_1C8 -= 0.3f; if (this->unk_1C8 <= 1.0f) { func_8086DCCC(this); @@ -490,9 +490,8 @@ void func_8086DDA8(BgBdanSwitch* this) { } void func_8086DDC0(BgBdanSwitch* this, PlayState* play) { - if (((PARAMS_GET_U(this->dyna.actor.params, 0, 8) != YELLOW_TALL_2) || - (func_8005B198() == this->dyna.actor.category)) || - (this->unk_1DA <= 0)) { + if ((PARAMS_GET_U(this->dyna.actor.params, 0, 8) != YELLOW_TALL_2) || + (Camera_GetFocusActorCategory() == this->dyna.actor.category) || (this->unk_1DA <= 0)) { this->unk_1C8 += 0.3f; if (this->unk_1C8 >= 2.0f) { func_8086DB4C(this); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c index 3559b572fb7..e0ce45482c3 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c @@ -129,7 +129,7 @@ void func_80889B5C(BgHidanKousi* this, PlayState* play) { void func_80889BC0(BgHidanKousi* this, PlayState* play) { this->unk_168--; - if (this->dyna.actor.category == func_8005B198() || (this->unk_168 <= 0)) { + if (this->dyna.actor.category == Camera_GetFocusActorCategory() || (this->unk_168 <= 0)) { BgHidanKousi_SetupAction(this, func_80889C18); } } diff --git a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c index 3d0b9603dd5..5779d1dfb21 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -797,7 +797,7 @@ void DoorShutter_Unbar(DoorShutter* this, PlayState* play) { if (play->state.frames % 2 != 0) { this->actionTimer++; } - if (this->dyna.actor.category == func_8005B198() || this->actionTimer == 0) { + if (this->dyna.actor.category == Camera_GetFocusActorCategory() || this->actionTimer == 0) { this->actionTimer = 5; } } else { diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.c b/src/overlays/actors/ovl_En_Box/z_en_box.c index c3e37e868a8..06d849137de 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -377,7 +377,7 @@ void EnBox_AppearOnRoomClear(EnBox* this, PlayState* play) { * The chest is ready to appear, possibly waiting for camera/cutscene-related stuff to happen */ void EnBox_AppearInit(EnBox* this, PlayState* play) { - if (func_8005B198() == this->dyna.actor.category || this->unk_1A8 != 0) { + if (Camera_GetFocusActorCategory() == this->dyna.actor.category || this->unk_1A8 != 0) { EnBox_SetupAction(this, EnBox_AppearAnimation); this->unk_1A8 = 0; Actor_Spawn(&play->actorCtx, play, ACTOR_DEMO_KANKYO, this->dyna.actor.home.pos.x, this->dyna.actor.home.pos.y, diff --git a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c index 39f3e80dc16..93b7e3eb77f 100644 --- a/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c +++ b/src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c @@ -268,7 +268,7 @@ void ObjLightswitch_SetupTurnOn(ObjLightswitch* this) { } void ObjLightswitch_TurnOn(ObjLightswitch* this, PlayState* play) { - if (func_8005B198() == this->actor.category || this->toggleDelay <= 0) { + if (Camera_GetFocusActorCategory() == this->actor.category || this->toggleDelay <= 0) { if (this->timer == 0) { Actor_PlaySfx(&this->actor, NA_SE_EV_TRIFORCE_FLASH); } @@ -340,8 +340,8 @@ void ObjLightswitch_SetupTurnOff(ObjLightswitch* this) { } void ObjLightswitch_TurnOff(ObjLightswitch* this, PlayState* play) { - if (PARAMS_GET_U(this->actor.params, 4, 2) != OBJLIGHTSWITCH_TYPE_1 || func_8005B198() == this->actor.category || - this->toggleDelay <= 0) { + if (PARAMS_GET_U(this->actor.params, 4, 2) != OBJLIGHTSWITCH_TYPE_1 || + Camera_GetFocusActorCategory() == this->actor.category || this->toggleDelay <= 0) { this->timer--; Math_StepToS(&this->flameRingRotSpeed, 0, 0xA); @@ -365,7 +365,7 @@ void ObjLightswitch_SetupDisappearDelay(ObjLightswitch* this) { } void ObjLightswitch_DisappearDelay(ObjLightswitch* this, PlayState* play) { - if (func_8005B198() == this->actor.category || this->toggleDelay <= 0) { + if (Camera_GetFocusActorCategory() == this->actor.category || this->toggleDelay <= 0) { ObjLightswitch_SetupDisappear(this); } } diff --git a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c index dbe4193bef1..ee175340e89 100644 --- a/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c +++ b/src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c @@ -449,7 +449,7 @@ void ObjSwitch_FloorPressInit(ObjSwitch* this) { void ObjSwitch_FloorPress(ObjSwitch* this, PlayState* play) { if (OBJSWITCH_SUBTYPE(&this->dyna.actor) == OBJSWITCH_SUBTYPE_HOLD_INVERTED || !this->cooldownOn || - func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { + Camera_GetFocusActorCategory() == this->dyna.actor.category || this->cooldownTimer <= 0) { this->dyna.actor.scale.y -= 99.0f / 2000.0f; if (this->dyna.actor.scale.y <= 33.0f / 2000.0f) { ObjSwitch_FloorDownInit(this); @@ -508,7 +508,7 @@ void ObjSwitch_FloorRelease(ObjSwitch* this, PlayState* play) { s16 subType = OBJSWITCH_SUBTYPE(&this->dyna.actor); if (((subType != OBJSWITCH_SUBTYPE_TOGGLE) && (subType != OBJSWITCH_SUBTYPE_HOLD_INVERTED)) || !this->cooldownOn || - func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { + Camera_GetFocusActorCategory() == this->dyna.actor.category || this->cooldownTimer <= 0) { this->dyna.actor.scale.y += 99.0f / 2000.0f; if (this->dyna.actor.scale.y >= 33.0f / 200.0f) { @@ -568,7 +568,7 @@ void ObjSwitch_EyeClosingInit(ObjSwitch* this) { } void ObjSwitch_EyeClosing(ObjSwitch* this, PlayState* play) { - if (!this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { + if (!this->cooldownOn || Camera_GetFocusActorCategory() == this->dyna.actor.category || this->cooldownTimer <= 0) { this->eyeTexIndex++; if (this->eyeTexIndex >= 3) { ObjSwitch_EyeClosedInit(this); @@ -608,7 +608,7 @@ void ObjSwitch_EyeOpeningInit(ObjSwitch* this) { void ObjSwitch_EyeOpening(ObjSwitch* this, PlayState* play) { if (OBJSWITCH_SUBTYPE(&this->dyna.actor) != OBJSWITCH_SUBTYPE_TOGGLE || !this->cooldownOn || - func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { + Camera_GetFocusActorCategory() == this->dyna.actor.category || this->cooldownTimer <= 0) { this->eyeTexIndex--; if (this->eyeTexIndex <= 0) { @@ -664,7 +664,7 @@ void ObjSwitch_CrystalTurnOnInit(ObjSwitch* this) { } void ObjSwitch_CrystalTurnOn(ObjSwitch* this, PlayState* play) { - if (!this->cooldownOn || func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { + if (!this->cooldownOn || Camera_GetFocusActorCategory() == this->dyna.actor.category || this->cooldownTimer <= 0) { ObjSwitch_CrystalOnInit(this); if (OBJSWITCH_SUBTYPE(&this->dyna.actor) == OBJSWITCH_SUBTYPE_TOGGLE) { ObjSwitch_UpdateTwoTexScrollXY(this); @@ -709,7 +709,7 @@ void ObjSwitch_CrystalTurnOffInit(ObjSwitch* this) { void ObjSwitch_CrystalTurnOff(ObjSwitch* this, PlayState* play) { if (OBJSWITCH_SUBTYPE(&this->dyna.actor) != OBJSWITCH_SUBTYPE_TOGGLE || !this->cooldownOn || - func_8005B198() == this->dyna.actor.category || this->cooldownTimer <= 0) { + Camera_GetFocusActorCategory() == this->dyna.actor.category || this->cooldownTimer <= 0) { ObjSwitch_CrystalOffInit(this); ObjSwitch_UpdateTwoTexScrollXY(this); Actor_PlaySfx(&this->dyna.actor, NA_SE_EV_DIAMOND_SWITCH); diff --git a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c index c36b928ad17..2eef83ad19d 100644 --- a/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c +++ b/src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c @@ -129,7 +129,7 @@ void ShotSun_SpawnFairy(ShotSun* this, PlayState* play) { } void ShotSun_TriggerFairy(ShotSun* this, PlayState* play) { - if ((func_8005B198() == this->actor.category) || (this->timer != 0)) { + if ((Camera_GetFocusActorCategory() == this->actor.category) || (this->timer != 0)) { this->actionFunc = ShotSun_SpawnFairy; this->timer = 50; From 273b56239f0af40b58a88874b799a59bcb7beb1d Mon Sep 17 00:00:00 2001 From: mzxrules Date: Wed, 28 Jan 2026 23:29:19 -0500 Subject: [PATCH 2/2] revert sfx.h --- include/sfx.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/sfx.h b/include/sfx.h index c6783284f05..2a9b543c3b5 100644 --- a/include/sfx.h +++ b/include/sfx.h @@ -4,6 +4,7 @@ #include "ultra64.h" #include "versions.h" #include "z_math.h" +#include "assert.h" #define MAX_CHANNELS_PER_BANK 3