Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 4 additions & 4 deletions src/code/z_camera.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -8933,8 +8933,8 @@ s32 Camera_QRegInit(void) {
}
#endif

s32 func_8005B198(void) {
return D_8011D3AC;
s32 Camera_GetFocusActorCategory(void) {
return sCameraFocusActorCategory;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/code/z_camera_data.inc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
11 changes: 5 additions & 6 deletions src/overlays/actors/ovl_Bg_Bdan_Switch/z_bg_bdan_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Bg_Hidan_Kousi/z_bg_hidan_kousi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_En_Box/z_en_box.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 4 additions & 4 deletions src/overlays/actors/ovl_Obj_Lightswitch/z_obj_lightswitch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -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);
Expand All @@ -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);
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/overlays/actors/ovl_Obj_Switch/z_obj_switch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion src/overlays/actors/ovl_Shot_Sun/z_shot_sun.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down