From bf56c94f0fdd31774441c9a4473c392af069ce3e Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Fri, 13 May 2022 04:35:31 +1000 Subject: [PATCH] Document Sub-Cameras (#989) * Copying SubCam Changes from PR 908, made it to the end of bosses * Finish copying over PR * format * More cleanup * clean-up * PR Suggestions, Clean-Up, Improvement in CS * Remove substructs from fd/fd2 * format * Improve fishing * minor fix * Make CutsceneCameraDir more general * `sActiveCamMove` -> `sCamMove` * Fix conflict with object kankyo * Add CAM_ID_MAIN to object_kankyo * Improve cam cutscenes further * Revert cutscene cmd names (better for a separate PR) * At -> LookAt in the context of Cutscenes * Missed naming in diving game * Format * Fill in Ganon2 Names (now that it's matching) * format * `sActiveCamId` -> `sReturnToCamId` * activeCamId -> returnToCamId * Discord Discussions * FIRST * Move macro to bottom, comments * More suggestions * PR suggestion, cleanup comment * Oops * add comments * Adjust comment * Change edge-case * whoops Co-authored-by: fig02 --- docs/tutorial/other_functions.md | 4 +- include/functions.h | 6 +- include/macros.h | 2 +- include/z64.h | 12 +- include/z64camera.h | 22 +- include/z64cutscene.h | 2 +- include/z64player.h | 2 +- src/code/z_actor.c | 2 +- src/code/z_camera.c | 86 +-- src/code/z_demo.c | 122 ++-- src/code/z_horse.c | 2 +- src/code/z_message_PAL.c | 4 +- src/code/z_onepointdemo.c | 540 ++++++++--------- src/code/z_play.c | 68 +-- src/code/z_player_lib.c | 4 +- src/code/z_quake.c | 14 +- src/code/z_room.c | 37 +- .../ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c | 23 +- .../actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c | 4 +- .../actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c | 2 +- .../actors/ovl_Bg_Dodoago/z_bg_dodoago.c | 6 +- .../ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c | 4 +- .../ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c | 6 +- .../actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c | 2 +- .../actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c | 2 +- .../actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c | 2 +- .../ovl_Bg_Heavy_Block/z_bg_heavy_block.c | 6 +- .../ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c | 8 +- .../ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c | 4 +- .../ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c | 4 +- .../ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c | 2 +- .../ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c | 8 +- .../ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c | 4 +- .../ovl_Bg_Jya_1flift/z_bg_jya_1flift.c | 4 +- .../z_bg_jya_bombchuiwa.c | 2 +- .../ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c | 2 +- .../actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c | 8 +- .../ovl_Bg_Jya_Megami/z_bg_jya_megami.c | 2 +- .../ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c | 2 +- .../ovl_Bg_Mizu_Water/z_bg_mizu_water.c | 2 +- .../ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c | 4 +- .../ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c | 4 +- .../ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c | 2 +- .../ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c | 28 +- .../ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c | 4 +- .../z_bg_mori_rakkatenjo.c | 14 +- .../actors/ovl_Bg_Po_Event/z_bg_po_event.c | 8 +- .../ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c | 2 +- .../z_bg_spot06_objects.c | 2 +- .../ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c | 2 +- .../ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c | 2 +- .../ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c | 2 +- .../z_bg_spot16_bombstone.c | 4 +- .../ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c | 4 +- .../z_bg_spot18_shutter.c | 2 +- .../actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c | 4 +- .../actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c | 2 +- .../ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c | 2 +- .../actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c | 2 +- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.c | 191 +++--- .../actors/ovl_Boss_Dodongo/z_boss_dodongo.h | 6 +- src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c | 207 +++---- src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h | 33 +- src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c | 140 ++--- src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h | 33 +- .../actors/ovl_Boss_Ganon/z_boss_ganon.c | 12 +- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.c | 567 +++++++++--------- .../actors/ovl_Boss_Ganon2/z_boss_ganon2.h | 8 +- .../ovl_Boss_Ganondrof/z_boss_ganondrof.c | 134 ++--- .../ovl_Boss_Ganondrof/z_boss_ganondrof.h | 22 +- .../actors/ovl_Boss_Goma/z_boss_goma.c | 247 ++++---- .../actors/ovl_Boss_Goma/z_boss_goma.h | 8 +- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c | 440 +++++++------- src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h | 36 +- src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c | 310 +++++----- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c | 212 +++---- src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h | 8 +- src/overlays/actors/ovl_Boss_Va/z_boss_va.c | 308 +++++----- .../actors/ovl_Door_Shutter/z_door_shutter.c | 9 +- .../actors/ovl_Door_Warp1/z_door_warp1.c | 11 +- .../actors/ovl_En_Bigokuta/z_en_bigokuta.c | 8 +- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 4 +- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c | 79 +-- .../ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h | 22 +- src/overlays/actors/ovl_En_Box/z_en_box.c | 4 +- src/overlays/actors/ovl_En_Box/z_en_box.h | 2 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 50 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.h | 6 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.c | 22 +- src/overlays/actors/ovl_En_Daiku/z_en_daiku.h | 2 +- .../ovl_En_Diving_Game/z_en_diving_game.c | 102 ++-- .../ovl_En_Diving_Game/z_en_diving_game.h | 20 +- .../actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c | 22 +- .../actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h | 2 +- .../actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c | 2 +- .../actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c | 2 +- src/overlays/actors/ovl_En_Du/z_en_du.c | 2 +- .../actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c | 6 +- src/overlays/actors/ovl_En_Fr/z_en_fr.c | 2 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 12 +- src/overlays/actors/ovl_En_Go2/z_en_go2.c | 44 +- src/overlays/actors/ovl_En_Go2/z_en_go2.h | 6 +- .../actors/ovl_En_Heishi2/z_en_heishi2.c | 64 +- .../actors/ovl_En_Heishi2/z_en_heishi2.h | 12 +- src/overlays/actors/ovl_En_Horse/z_en_horse.c | 12 +- src/overlays/actors/ovl_En_In/z_en_in.c | 106 ++-- src/overlays/actors/ovl_En_In/z_en_in.h | 12 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 24 +- .../actors/ovl_En_Kakasi/z_en_kakasi.h | 2 +- .../actors/ovl_En_Kakasi3/z_en_kakasi3.c | 32 +- .../actors/ovl_En_Kakasi3/z_en_kakasi3.h | 2 +- src/overlays/actors/ovl_En_Kz/z_en_kz.c | 48 +- src/overlays/actors/ovl_En_Kz/z_en_kz.h | 4 +- src/overlays/actors/ovl_En_Ma1/z_en_ma1.c | 6 +- src/overlays/actors/ovl_En_Ma2/z_en_ma2.c | 6 +- src/overlays/actors/ovl_En_Ma3/z_en_ma3.c | 6 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 2 +- src/overlays/actors/ovl_En_Owl/z_en_owl.c | 2 +- src/overlays/actors/ovl_En_Owl/z_en_owl.h | 2 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 6 +- src/overlays/actors/ovl_En_Ru2/z_en_ru2.c | 4 +- .../actors/ovl_En_Siofuki/z_en_siofuki.c | 2 +- .../ovl_En_Syateki_Man/z_en_syateki_man.c | 14 +- .../ovl_En_Syateki_Man/z_en_syateki_man.h | 2 +- src/overlays/actors/ovl_En_Ta/z_en_ta.c | 32 +- src/overlays/actors/ovl_En_Ta/z_en_ta.h | 4 +- .../actors/ovl_En_Torch2/z_en_torch2.c | 8 +- .../actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c | 2 +- .../actors/ovl_En_Wallmas/z_en_wallmas.c | 2 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.c | 38 +- src/overlays/actors/ovl_En_Zl1/z_en_zl1.h | 2 +- .../actors/ovl_En_Zl1/z_en_zl1_camera_data.c | 2 +- src/overlays/actors/ovl_En_Zl3/z_en_zl3.c | 12 +- src/overlays/actors/ovl_En_Zl4/z_en_zl4.c | 74 +-- .../ovl_En_Zl4/z_en_zl4_cutscene_data.c | 4 +- src/overlays/actors/ovl_En_fHG/z_en_fhg.c | 180 +++--- src/overlays/actors/ovl_En_fHG/z_en_fhg.h | 14 +- src/overlays/actors/ovl_Fishing/z_fishing.c | 177 +++--- src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c | 24 +- .../actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c | 2 +- .../ovl_Object_Kankyo/z_object_kankyo.c | 4 +- .../actors/ovl_player_actor/z_player.c | 98 +-- .../ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c | 2 +- 143 files changed, 2778 insertions(+), 2768 deletions(-) diff --git a/docs/tutorial/other_functions.md b/docs/tutorial/other_functions.md index 97ed8d1ea3..e284ebf73c 100644 --- a/docs/tutorial/other_functions.md +++ b/docs/tutorial/other_functions.md @@ -380,7 +380,7 @@ void func_80A87CEC(EnJj *this, GlobalContext *globalCtx) { globalCtx->csCtx.segment = &D_80A88164; gSaveContext.cutsceneTrigger = (u8)1U; func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, (s32) temp_v1->bgId); - func_8005B1A4(globalCtx->cameraPtrs[globalCtx->activeCamera]); + func_8005B1A4(globalCtx->cameraPtrs[globalCtx->activeCamId]); gSaveContext.unkEDA = (u16) (gSaveContext.unkEDA | 0x400); func_80078884((u16)0x4802U); } @@ -394,7 +394,7 @@ 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 `GET_ACTIVE_CAM(globalCtx)`, so this line can be written as +- `globalCtx->cameraPtrs[globalCtx->activeCamId]` has a macro: it is `GET_ACTIVE_CAM(globalCtx)`, so this line can be written as ```C func_8005B1A4(GET_ACTIVE_CAM(globalCtx)); ``` diff --git a/include/functions.h b/include/functions.h index a1d70dea7b..0c76d5bc40 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1001,8 +1001,8 @@ VecSph* OLib_Vec3fToVecSph(VecSph* dest, Vec3f* vec); VecSph* OLib_Vec3fToVecSphGeo(VecSph* arg0, Vec3f* arg1); VecSph* OLib_Vec3fDiffToVecSphGeo(VecSph* arg0, Vec3f* a, Vec3f* b); Vec3f* OLib_Vec3fDiffRad(Vec3f* dest, Vec3f* a, Vec3f* b); -s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* actor, s16 parentCamIdx); -s16 OnePointCutscene_EndCutscene(GlobalContext* globalCtx, s16 camIdx); +s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* actor, s16 camId); +s16 OnePointCutscene_EndCutscene(GlobalContext* globalCtx, s16 camId); s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor); s32 OnePointCutscene_AttentionSetSfx(GlobalContext* globalCtx, Actor* actor, s32 sfxId); void OnePointCutscene_EnableAttention(void); @@ -1514,7 +1514,7 @@ s32 Gameplay_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3 s32 Gameplay_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); s32 Gameplay_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov); s32 Gameplay_SetCameraRoll(GlobalContext* globalCtx, s16 camId, s16 roll); -void Gameplay_CopyCamera(GlobalContext* globalCtx, s16 camId1, s16 camId2); +void Gameplay_CopyCamera(GlobalContext* globalCtx, s16 destCamId, s16 srcCamId); s32 func_800C0808(GlobalContext* globalCtx, s16 camId, Player* player, s16 setting); s32 Gameplay_CameraChangeSetting(GlobalContext* globalCtx, s16 camId, s16 setting); void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2); diff --git a/include/macros.h b/include/macros.h index fcca426e1e..03105216d1 100644 --- a/include/macros.h +++ b/include/macros.h @@ -22,7 +22,7 @@ #define GET_PLAYER(globalCtx) ((Player*)(globalCtx)->actorCtx.actorLists[ACTORCAT_PLAYER].head) -#define GET_ACTIVE_CAM(globalCtx) ((globalCtx)->cameraPtrs[(globalCtx)->activeCamera]) +#define GET_ACTIVE_CAM(globalCtx) ((globalCtx)->cameraPtrs[(globalCtx)->activeCamId]) #define LINK_IS_ADULT (gSaveContext.linkAge == LINK_AGE_ADULT) #define LINK_IS_CHILD (gSaveContext.linkAge == LINK_AGE_CHILD) diff --git a/include/z64.h b/include/z64.h index 68ff4f5be5..01108f77e8 100644 --- a/include/z64.h +++ b/include/z64.h @@ -301,12 +301,12 @@ typedef struct { /* 0x0C */ f32 unk_0C; /* 0x10 */ u16 frames; /* 0x12 */ u16 unk_12; - /* 0x14 */ s32 unk_14; + /* 0x14 */ s32 subCamId; /* 0x18 */ u16 unk_18; /* 0x1A */ u8 unk_1A; /* 0x1B */ u8 unk_1B; - /* 0x1C */ CutsceneCameraPoint* cameraFocus; - /* 0x20 */ CutsceneCameraPoint* cameraPosition; + /* 0x1C */ CutsceneCameraPoint* subCamLookAtPoints; + /* 0x20 */ CutsceneCameraPoint* subCamEyePoints; /* 0x24 */ CsCmdActorAction* linkAction; /* 0x28 */ CsCmdActorAction* npcActions[10]; // "npcdemopnt" } CutsceneContext; // size = 0x50 @@ -1164,10 +1164,10 @@ typedef struct GlobalContext { /* 0x000B0 */ void* sceneSegment; /* 0x000B8 */ View view; /* 0x001E0 */ Camera mainCamera; - /* 0x0034C */ Camera subCameras[NUM_CAMS - SUBCAM_FIRST]; + /* 0x0034C */ Camera subCameras[NUM_CAMS - CAM_ID_SUB_FIRST]; /* 0x00790 */ Camera* cameraPtrs[NUM_CAMS]; - /* 0x007A0 */ s16 activeCamera; - /* 0x007A2 */ s16 nextCamera; + /* 0x007A0 */ s16 activeCamId; + /* 0x007A2 */ s16 nextCamId; /* 0x007A4 */ SequenceContext sequenceCtx; /* 0x007A8 */ LightContext lightCtx; /* 0x007B8 */ FrameAdvanceContext frameAdvCtx; diff --git a/include/z64camera.h b/include/z64camera.h index 95427a496a..9042f86052 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -15,15 +15,17 @@ #define CAM_STAT_UNK100 0x100 #define NUM_CAMS 4 -#define MAIN_CAM 0 -#define SUBCAM_FIRST 1 -#define SUBCAM_FREE 0 -#define SUBCAM_NONE -1 -#define SUBCAM_ACTIVE -1 + +// Camera IDs are indices into `GlobalContext.cameraPtrs` +#define CAM_ID_MAIN 0 // The index of the main camera +#define CAM_ID_SUB_FIRST 1 // The index sub cameras start at +#define CAM_ID_NONE -1 // Used to indicate no camera. Can be used to default to the active camera in some scenarios + +#define SUB_CAM_ID_DONE 0 // Used in some actors for variables holding sub camera IDs to indicate "subcam is finished" #define ONEPOINT_CS_INFO(camera) (&camera->paramData.uniq9.csInfo) -#define PARENT_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->parentCamIdx]) -#define CHILD_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->childCamIdx]) +#define PARENT_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->parentCamId]) +#define CHILD_CAM(cam) ((cam)->globalCtx->cameraPtrs[(cam)->childCamId]) typedef enum { /* 0x00 */ CAM_SET_NONE, @@ -1379,7 +1381,7 @@ typedef struct { /* 0x148 */ s16 camDataIdx; /* 0x14A */ s16 unk_14A; /* 0x14C */ s16 unk_14C; - /* 0x14E */ s16 childCamIdx; + /* 0x14E */ s16 childCamId; /* 0x150 */ s16 waterDistortionTimer; /* 0x152 */ s16 distortionFlags; /* 0x154 */ s16 prevSetting; @@ -1389,8 +1391,8 @@ typedef struct { /* 0x15C */ s16 paramFlags; /* 0x15E */ s16 animState; /* 0x160 */ s16 timer; - /* 0x162 */ s16 parentCamIdx; - /* 0x164 */ s16 thisIdx; + /* 0x162 */ s16 parentCamId; + /* 0x164 */ s16 camId; /* 0x166 */ s16 prevCamDataIdx; /* 0x168 */ s16 csId; /* 0x16A */ s16 unk_16A; diff --git a/include/z64cutscene.h b/include/z64cutscene.h index 644c21bc6f..49e2ca756b 100644 --- a/include/z64cutscene.h +++ b/include/z64cutscene.h @@ -23,7 +23,7 @@ typedef struct { /* 0x0C */ Vec3f eye; /* 0x18 */ s16 roll; /* 0x1A */ s16 fov; -} CutsceneCameraAngle; // size = 0x1C +} CutsceneCameraDirection; // size = 0x1C typedef struct { /* 0x0 */ CutsceneCameraPoint* atPoints; diff --git a/include/z64player.h b/include/z64player.h index 4e34d37222..c1c3be8315 100644 --- a/include/z64player.h +++ b/include/z64player.h @@ -522,7 +522,7 @@ typedef struct Player { /* 0x045C */ Vec3f unk_45C; /* 0x0468 */ char unk_468[0x002]; /* 0x046A */ s16 unk_46A; - /* 0x046C */ s16 unk_46C; + /* 0x046C */ s16 subCamId; /* 0x046E */ char unk_46E[0x02A]; /* 0x0498 */ ColliderCylinder cylinder; /* 0x04E4 */ ColliderQuad meleeWeaponQuads[2]; diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 4f6c2bf26e..b0b5aba840 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1010,7 +1010,7 @@ void func_8002DE04(GlobalContext* globalCtx, Actor* actorA, Actor* actorB) { void func_8002DE74(GlobalContext* globalCtx, Player* player) { if ((globalCtx->roomCtx.curRoom.unk_03 != 4) && func_800C0CB8(globalCtx)) { - Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, MAIN_CAM), CAM_SET_HORSE); + Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), CAM_SET_HORSE); } } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 33b377aebd..a00611af3d 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -722,7 +722,7 @@ void Camera_CopyDataToRegs(Camera* camera, s16 mode) { s32 i; if (PREG(82)) { - osSyncPrintf("camera: res: stat (%d/%d/%d)\n", camera->thisIdx, camera->setting, mode); + osSyncPrintf("camera: res: stat (%d/%d/%d)\n", camera->camId, camera->setting, mode); } values = sCameraSettings[camera->setting].cameraModes[mode].values; @@ -3345,7 +3345,7 @@ s32 Camera_KeepOn3(Camera* camera) { if (RELOAD_PARAMS(camera)) { if (camera->globalCtx->view.unk_124 == 0) { camera->unk_14C |= 0x20; - camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50; + camera->globalCtx->view.unk_124 = camera->camId | 0x50; return 1; } camera->unk_14C &= ~0x20; @@ -3525,7 +3525,7 @@ s32 Camera_KeepOn4(Camera* camera) { if (camera->globalCtx->view.unk_124 == 0) { camera->unk_14C |= 0x20; camera->unk_14C &= ~(0x4 | 0x2); - camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50; + camera->globalCtx->view.unk_124 = camera->camId | 0x50; return 1; } rwData->unk_14 = *temp_s0; @@ -3538,7 +3538,7 @@ s32 Camera_KeepOn4(Camera* camera) { camera->animState = 20; camera->unk_14C |= 0x20; camera->unk_14C &= ~(0x4 | 0x2); - camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50; + camera->globalCtx->view.unk_124 = camera->camId | 0x50; return 1; } @@ -4205,7 +4205,7 @@ s32 Camera_Subj3(Camera* camera) { playerHeight = Player_GetHeight(camera->player); if (camera->globalCtx->view.unk_124 == 0) { - camera->globalCtx->view.unk_124 = camera->thisIdx | 0x50; + camera->globalCtx->view.unk_124 = camera->camId | 0x50; return true; } @@ -4334,7 +4334,7 @@ s32 Camera_Subj4(Camera* camera) { } if (camera->globalCtx->view.unk_124 == 0) { - camera->globalCtx->view.unk_124 = (camera->thisIdx | 0x50); + camera->globalCtx->view.unk_124 = (camera->camId | 0x50); rwData->unk_24 = camera->xzSpeed; return true; } @@ -5137,7 +5137,7 @@ s32 Camera_Unique9(Camera* camera) { } } else { // We've gone through all the keyframes. - if (camera->thisIdx != MAIN_CAM) { + if (camera->camId != CAM_ID_MAIN) { camera->timer = 0; } return true; @@ -5475,20 +5475,20 @@ s32 Camera_Unique9(Camera* camera) { break; case 19: { // Change the parent camera (or default)'s mode to normal - s32 camIdx = camera->parentCamIdx <= SUBCAM_NONE ? MAIN_CAM : camera->parentCamIdx; + s32 camIdx = camera->parentCamId <= CAM_ID_NONE ? CAM_ID_MAIN : camera->parentCamId; Camera_ChangeModeFlags(camera->globalCtx->cameraPtrs[camIdx], CAM_MODE_NORMAL, 1); } case 18: { // copy the current camera to the parent (or default)'s camera. - s32 camIdx = camera->parentCamIdx <= SUBCAM_NONE ? MAIN_CAM : camera->parentCamIdx; + s32 camIdx = camera->parentCamId <= CAM_ID_NONE ? CAM_ID_MAIN : camera->parentCamId; Camera* cam = camera->globalCtx->cameraPtrs[camIdx]; *eye = *eyeNext; Camera_Copy(cam, camera); } default: - if (camera->thisIdx != MAIN_CAM) { + if (camera->camId != CAM_ID_MAIN) { camera->timer = 0; } } @@ -5911,7 +5911,7 @@ s32 Camera_Demo5(Camera* camera) { D_8011D6AC[1].eyeTargetInit.x = Rand_ZeroOne() * 10.0f; ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D6AC; ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D6AC); - if (camera->parentCamIdx != MAIN_CAM) { + if (camera->parentCamId != CAM_ID_MAIN) { ONEPOINT_CS_INFO(camera)->keyFrameCnt--; } else { camera->timer += D_8011D6AC[2].timerInit; @@ -5921,7 +5921,7 @@ s32 Camera_Demo5(Camera* camera) { D_8011D724[1].timerInit = camera->timer - 1; ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D724; ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D724); - if (camera->parentCamIdx != MAIN_CAM) { + if (camera->parentCamId != CAM_ID_MAIN) { ONEPOINT_CS_INFO(camera)->keyFrameCnt--; } else { camera->timer += D_8011D724[2].timerInit; @@ -5944,7 +5944,7 @@ s32 Camera_Demo5(Camera* camera) { D_8011D79C[1].timerInit = camera->timer - 1; - if (camera->parentCamIdx != MAIN_CAM) { + if (camera->parentCamId != CAM_ID_MAIN) { ONEPOINT_CS_INFO(camera)->keyFrameCnt -= 2; } else { camera->timer += D_8011D79C[2].timerInit + D_8011D79C[3].timerInit; @@ -5955,7 +5955,7 @@ s32 Camera_Demo5(Camera* camera) { D_8011D83C[0].timerInit = camera->timer; ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D83C; ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D83C); - if (camera->parentCamIdx != MAIN_CAM) { + if (camera->parentCamId != CAM_ID_MAIN) { ONEPOINT_CS_INFO(camera)->keyFrameCnt--; } else { camera->timer += D_8011D83C[1].timerInit; @@ -5969,7 +5969,7 @@ s32 Camera_Demo5(Camera* camera) { D_8011D88C[0].timerInit = camera->timer; ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D88C; ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D88C); - if (camera->parentCamIdx != MAIN_CAM) { + if (camera->parentCamId != CAM_ID_MAIN) { ONEPOINT_CS_INFO(camera)->keyFrameCnt--; } else { camera->timer += D_8011D88C[1].timerInit; @@ -5987,7 +5987,7 @@ s32 Camera_Demo5(Camera* camera) { D_8011D8DC[1].timerInit = (s16)(eyeTargetDist * 0.005f) + 8; ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D8DC; ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D8DC); - if (camera->parentCamIdx != MAIN_CAM) { + if (camera->parentCamId != CAM_ID_MAIN) { ONEPOINT_CS_INFO(camera)->keyFrameCnt -= 2; } else { camera->timer += D_8011D8DC[1].timerInit + D_8011D8DC[2].timerInit; @@ -6024,7 +6024,7 @@ s32 Camera_Demo5(Camera* camera) { } ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D954; ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D954); - if (camera->parentCamIdx != MAIN_CAM) { + if (camera->parentCamId != CAM_ID_MAIN) { ONEPOINT_CS_INFO(camera)->keyFrameCnt -= 2; } else { camera->timer += D_8011D954[2].timerInit + D_8011D954[3].timerInit; @@ -6049,7 +6049,7 @@ s32 Camera_Demo5(Camera* camera) { } ONEPOINT_CS_INFO(camera)->keyFrames = D_8011D9F4; ONEPOINT_CS_INFO(camera)->keyFrameCnt = ARRAY_COUNT(D_8011D9F4); - if (camera->parentCamIdx != MAIN_CAM) { + if (camera->parentCamId != CAM_ID_MAIN) { if (camera->globalCtx->state.frames & 1) { D_8011D9F4[0].rollTargetInit = -D_8011D9F4[0].rollTargetInit; D_8011D9F4[1].rollTargetInit = -D_8011D9F4[1].rollTargetInit; @@ -6111,7 +6111,7 @@ s32 Camera_Demo6(Camera* camera) { s16 stateTimers[4]; Demo6ReadWriteData* rwData = &camera->paramData.demo6.rwData; - mainCam = Gameplay_GetCamera(camera->globalCtx, MAIN_CAM); + mainCam = Gameplay_GetCamera(camera->globalCtx, CAM_ID_MAIN); camFocus = camera->target; stateTimers[1] = 0x37; stateTimers[2] = 0x46; @@ -6216,7 +6216,7 @@ s32 Camera_Demo9(Camera* camera) { f32* camFOV = &camera->fov; Demo9ReadWriteData* rwData = &camera->paramData.demo9.rwData; - mainCam = Gameplay_GetCamera(camera->globalCtx, MAIN_CAM); + mainCam = Gameplay_GetCamera(camera->globalCtx, CAM_ID_MAIN); mainCamPlayerPosRot = &mainCam->playerPosRot; if (RELOAD_PARAMS(camera) || R_RELOAD_CAM_PARAMS) { values = sCameraSettings[camera->setting].cameraModes[camera->mode].values; @@ -6306,7 +6306,7 @@ s32 Camera_Demo9(Camera* camera) { if (rwData->finishAction == 0x2000) { // finish action = 0x2000, run OnePointCs 0x3FC (Dramatic Return to Link) onePointTimer = onePointCamData->initTimer < 50 ? 5 : onePointCamData->initTimer / 5; - OnePointCutscene_Init(camera->globalCtx, 1020, onePointTimer, NULL, camera->parentCamIdx); + OnePointCutscene_Init(camera->globalCtx, 1020, onePointTimer, NULL, camera->parentCamId); } } else { // finish action = 0x1000, copy the current camera's values to the @@ -7019,7 +7019,7 @@ void Camera_InitPlayerSettings(Camera* camera, Player* player) { Camera_QRegInit(); osSyncPrintf(VT_FGCOL(BLUE) "camera: personalize ---" VT_RST "\n"); - if (camera->thisIdx == MAIN_CAM) { + if (camera->camId == CAM_ID_MAIN) { Camera_UpdateWater(camera); } } @@ -7035,7 +7035,7 @@ s16 Camera_ChangeStatus(Camera* camera, s16 status) { } if (PREG(82)) { - osSyncPrintf("camera: res: stat (%d/%d/%d)\n", camera->thisIdx, camera->setting, camera->mode); + osSyncPrintf("camera: res: stat (%d/%d/%d)\n", camera->camId, camera->setting, camera->mode); } if (status == CAM_STAT_ACTIVE && camera->status != CAM_STAT_ACTIVE) { @@ -7058,7 +7058,7 @@ void Camera_PrintSettings(Camera* camera) { char sp48[8]; s32 i; - if ((OREG(0) & 1) && (camera->globalCtx->activeCamera == camera->thisIdx) && !gDbgCamEnabled) { + if ((OREG(0) & 1) && (camera->globalCtx->activeCamId == camera->camId) && !gDbgCamEnabled) { for (i = 0; i < NUM_CAMS; i++) { if (camera->globalCtx->cameraPtrs[i] == NULL) { sp58[i] = '-'; @@ -7090,7 +7090,7 @@ void Camera_PrintSettings(Camera* camera) { sp58[i] = '\0'; sp48[i] = '\0'; - sp48[camera->globalCtx->activeCamera] = 'a'; + sp48[camera->globalCtx->activeCamId] = 'a'; func_8006376C(3, 0x16, 5, sp58); func_8006376C(3, 0x16, 1, sp48); func_8006376C(3, 0x17, 5, "S:"); @@ -7260,7 +7260,7 @@ s32 Camera_UpdateHotRoom(Camera* camera) { s32 Camera_DbgChangeMode(Camera* camera) { s32 changeDir = 0; - if (!gDbgCamEnabled && camera->globalCtx->activeCamera == MAIN_CAM) { + if (!gDbgCamEnabled && camera->globalCtx->activeCamId == CAM_ID_MAIN) { if (CHECK_BTN_ALL(D_8015BD7C->state.input[2].press.button, BTN_CUP)) { osSyncPrintf("attention sound URGENCY\n"); func_80078884(NA_SE_SY_ATTENTION_URGENCY); @@ -7387,7 +7387,7 @@ Vec3s Camera_Update(Camera* camera) { QuakeCamCalc quake; Player* player; - player = camera->globalCtx->cameraPtrs[MAIN_CAM]->player; + player = camera->globalCtx->cameraPtrs[CAM_ID_MAIN]->player; if (R_DBG_CAM_UPDATE) { osSyncPrintf("camera: in %x\n", camera); @@ -7494,7 +7494,7 @@ Vec3s Camera_Update(Camera* camera) { if ((gSaveContext.gameMode != 0) && (gSaveContext.gameMode != 3)) { sCameraInterfaceFlags = 0; Camera_UpdateInterface(sCameraInterfaceFlags); - } else if ((D_8011D3F0 != 0) && (camera->thisIdx == MAIN_CAM)) { + } else if ((D_8011D3F0 != 0) && (camera->camId == CAM_ID_MAIN)) { D_8011D3F0--; sCameraInterfaceFlags = 0x3200; Camera_UpdateInterface(sCameraInterfaceFlags); @@ -7626,13 +7626,13 @@ Vec3s Camera_Update(Camera* camera) { * When the camera's timer is 0, change the camera to its parent */ void Camera_Finish(Camera* camera) { - Camera* mainCam = camera->globalCtx->cameraPtrs[MAIN_CAM]; + Camera* mainCam = camera->globalCtx->cameraPtrs[CAM_ID_MAIN]; Player* player = GET_PLAYER(camera->globalCtx); if (camera->timer == 0) { - Gameplay_ChangeCameraStatus(camera->globalCtx, camera->parentCamIdx, CAM_STAT_ACTIVE); + Gameplay_ChangeCameraStatus(camera->globalCtx, camera->parentCamId, CAM_STAT_ACTIVE); - if ((camera->parentCamIdx == MAIN_CAM) && (camera->csId != 0)) { + if ((camera->parentCamId == CAM_ID_MAIN) && (camera->csId != 0)) { player->actor.freezeTimer = 0; player->stateFlags1 &= ~PLAYER_STATE1_29; @@ -7644,23 +7644,23 @@ void Camera_Finish(Camera* camera) { mainCam->unk_14C |= 8; } - if (CHILD_CAM(camera)->parentCamIdx == camera->thisIdx) { - CHILD_CAM(camera)->parentCamIdx = camera->parentCamIdx; + if (CHILD_CAM(camera)->parentCamId == camera->camId) { + CHILD_CAM(camera)->parentCamId = camera->parentCamId; } - if (PARENT_CAM(camera)->childCamIdx == camera->thisIdx) { - PARENT_CAM(camera)->childCamIdx = camera->childCamIdx; + if (PARENT_CAM(camera)->childCamId == camera->camId) { + PARENT_CAM(camera)->childCamId = camera->childCamId; } - if (PARENT_CAM(camera)->thisIdx == MAIN_CAM) { + if (PARENT_CAM(camera)->camId == CAM_ID_MAIN) { PARENT_CAM(camera)->animState = 0; } - camera->childCamIdx = camera->parentCamIdx = SUBCAM_FREE; + camera->childCamId = camera->parentCamId = CAM_ID_MAIN; camera->timer = -1; camera->globalCtx->envCtx.fillScreen = false; - Gameplay_ClearCamera(camera->globalCtx, camera->thisIdx); + Gameplay_ClearCamera(camera->globalCtx, camera->camId); } } @@ -7871,7 +7871,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) { } osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->globalCtx->state.frames, - camera->thisIdx, sCameraSettingNames[camera->setting]); + camera->camId, sCameraSettingNames[camera->setting]); return setting; } @@ -7901,7 +7901,7 @@ s32 Camera_ChangeDataIdx(Camera* camera, s32 camDataIdx) { //! @bug: This is likely checking the wrong value. The actual return of Camera_ChangeSettingFlags or // camDataIdx would make more sense. osSyncPrintf(VT_COL(RED, WHITE) "camera: error: illegal camera ID (%d) !! (%d|%d|%d)\n" VT_RST, camDataIdx, - camera->thisIdx, 0x32, newCameraSetting); + camera->camId, 0x32, newCameraSetting); } return 0x80000000 | camDataIdx; } @@ -8197,10 +8197,10 @@ s32 func_8005B198(void) { s16 func_8005B1A4(Camera* camera) { camera->unk_14C |= 0x8; - if ((camera->thisIdx == MAIN_CAM) && (camera->globalCtx->activeCamera != MAIN_CAM)) { + if ((camera->camId == CAM_ID_MAIN) && (camera->globalCtx->activeCamId != CAM_ID_MAIN)) { GET_ACTIVE_CAM(camera->globalCtx)->unk_14C |= 0x8; - return camera->globalCtx->activeCamera; + return camera->globalCtx->activeCamId; } - return camera->thisIdx; + return camera->camId; } diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 3db79f4233..c2c6e9d06d 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -96,7 +96,7 @@ void* D_8011E304[] = { u16 D_8015FCC0; u16 D_8015FCC2; u16 D_8015FCC4; -s16 D_8015FCC6; +s16 sReturnToCamId; u8 D_8015FCC8; s16 sQuakeIndex; u16 D_8015FCCC; // only written to, never read @@ -1330,8 +1330,8 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs } } -// Command 0x1 & 0x5: Camera Positions -s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { +// Command 0x1 & 0x5: Camera Eye Points +s32 Cutscene_Command_CameraEyePoints(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { s32 shouldContinue = 1; CsCmdBase* cmdBase = (CsCmdBase*)cmd; s32 size; @@ -1342,16 +1342,16 @@ s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext* if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) && ((csCtx->unk_18 < cmdBase->startFrame) || (csCtx->unk_18 >= 0xF000))) { csCtx->unk_1B = 1; - csCtx->cameraPosition = (CutsceneCameraPoint*)cmd; + csCtx->subCamEyePoints = (CutsceneCameraPoint*)cmd; if (csCtx->unk_1A != 0) { csCtx->unk_18 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_CS_0); - Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, CAM_STAT_WAIT); - 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, GET_PLAYER(globalCtx), relativeToLink); + Gameplay_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_CS_0); + Gameplay_ChangeCameraStatus(globalCtx, sReturnToCamId, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE); + Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->subCamId)); + Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->subCamId), csCtx->subCamLookAtPoints, + csCtx->subCamEyePoints, GET_PLAYER(globalCtx), relativeToLink); } } } @@ -1367,8 +1367,8 @@ s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext* return size; } -// Command 0x2 & 0x6: Camera Focus Points -s32 Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { +// Command 0x2 & 0x6: Camera At Points +s32 Cutscene_Command_CameraLookAtPoints(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) { s32 shouldContinue = 1; CsCmdBase* cmdBase = (CsCmdBase*)cmd; s32 size; @@ -1379,16 +1379,16 @@ s32 Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCt if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) && ((D_8015FCC0 < cmdBase->startFrame) || (D_8015FCC0 >= 0xF000))) { csCtx->unk_1A = 1; - csCtx->cameraFocus = (CutsceneCameraPoint*)cmd; + csCtx->subCamLookAtPoints = (CutsceneCameraPoint*)cmd; if (csCtx->unk_1B != 0) { D_8015FCC0 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_CS_0); - Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, CAM_STAT_WAIT); - 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, GET_PLAYER(globalCtx), relativeToLink); + Gameplay_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_CS_0); + Gameplay_ChangeCameraStatus(globalCtx, sReturnToCamId, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE); + Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->subCamId)); + Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->subCamId), csCtx->subCamLookAtPoints, + csCtx->subCamEyePoints, GET_PLAYER(globalCtx), relativeToLink); } } } @@ -1410,7 +1410,7 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm s32 size; Vec3f sp3C; Vec3f sp30; - Camera* sp2C; + Camera* subCam; f32 sp28; cmd += 8; @@ -1419,25 +1419,25 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) && ((D_8015FCC2 < cmdBase->startFrame) || (D_8015FCC2 >= 0xF000))) { csCtx->unk_1B = 1; - csCtx->cameraPosition = (CutsceneCameraPoint*)cmd; + csCtx->subCamEyePoints = (CutsceneCameraPoint*)cmd; if (csCtx->unk_1A != 0) { D_8015FCC2 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - sp2C = Gameplay_GetCamera(globalCtx, csCtx->unk_14); - sp2C->player = NULL; - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE); - Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_FREE0); - sp28 = csCtx->cameraFocus->cameraRoll * 1.40625f; - Camera_SetParam(sp2C, 64, &sp28); - sp3C.x = csCtx->cameraFocus->pos.x; - sp3C.y = csCtx->cameraFocus->pos.y; - sp3C.z = csCtx->cameraFocus->pos.z; - sp30.x = csCtx->cameraPosition->pos.x; - sp30.y = csCtx->cameraPosition->pos.y; - sp30.z = csCtx->cameraPosition->pos.z; - Gameplay_CameraSetAtEye(globalCtx, csCtx->unk_14, &sp3C, &sp30); - Gameplay_CameraSetFov(globalCtx, csCtx->unk_14, csCtx->cameraPosition->viewAngle); + subCam = Gameplay_GetCamera(globalCtx, csCtx->subCamId); + subCam->player = NULL; + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE); + Gameplay_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_FREE0); + sp28 = csCtx->subCamLookAtPoints->cameraRoll * 1.40625f; + Camera_SetParam(subCam, 64, &sp28); + sp3C.x = csCtx->subCamLookAtPoints->pos.x; + sp3C.y = csCtx->subCamLookAtPoints->pos.y; + sp3C.z = csCtx->subCamLookAtPoints->pos.z; + sp30.x = csCtx->subCamEyePoints->pos.x; + sp30.y = csCtx->subCamEyePoints->pos.y; + sp30.z = csCtx->subCamEyePoints->pos.z; + Gameplay_CameraSetAtEye(globalCtx, csCtx->subCamId, &sp3C, &sp30); + Gameplay_CameraSetFov(globalCtx, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle); } } } @@ -1453,7 +1453,7 @@ s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm s32 size; Vec3f sp3C; Vec3f sp30; - Camera* sp2C; + Camera* subCam; f32 sp28; cmd += 8; @@ -1462,23 +1462,23 @@ s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) && ((D_8015FCC4 < cmdBase->startFrame) || (D_8015FCC4 >= 0xF000))) { csCtx->unk_1A = 1; - csCtx->cameraFocus = (CutsceneCameraPoint*)cmd; + csCtx->subCamLookAtPoints = (CutsceneCameraPoint*)cmd; if (csCtx->unk_1B != 0) { D_8015FCC4 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - sp2C = Gameplay_GetCamera(globalCtx, csCtx->unk_14); - sp2C->player = NULL; - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE); - Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_FREE0); - sp3C.x = csCtx->cameraFocus->pos.x; - sp3C.y = csCtx->cameraFocus->pos.y; - sp3C.z = csCtx->cameraFocus->pos.z; - sp30.x = csCtx->cameraPosition->pos.x; - sp30.y = csCtx->cameraPosition->pos.y; - sp30.z = csCtx->cameraPosition->pos.z; - Gameplay_CameraSetAtEye(globalCtx, csCtx->unk_14, &sp3C, &sp30); - Gameplay_CameraSetFov(globalCtx, csCtx->unk_14, csCtx->cameraPosition->viewAngle); + subCam = Gameplay_GetCamera(globalCtx, csCtx->subCamId); + subCam->player = NULL; + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE); + Gameplay_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_FREE0); + sp3C.x = csCtx->subCamLookAtPoints->pos.x; + sp3C.y = csCtx->subCamLookAtPoints->pos.y; + sp3C.z = csCtx->subCamLookAtPoints->pos.z; + sp30.x = csCtx->subCamEyePoints->pos.x; + sp30.y = csCtx->subCamEyePoints->pos.y; + sp30.z = csCtx->subCamEyePoints->pos.z; + Gameplay_CameraSetAtEye(globalCtx, csCtx->subCamId, &sp3C, &sp30); + Gameplay_CameraSetFov(globalCtx, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle); } } } @@ -1859,16 +1859,16 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx, } break; case CS_CMD_CAM_EYE: - cutscenePtr += Cutscene_Command_CameraPositions(globalCtx, csCtx, (void*)cutscenePtr, 0); + cutscenePtr += Cutscene_Command_CameraEyePoints(globalCtx, csCtx, (void*)cutscenePtr, 0); break; case CS_CMD_CAM_EYE_REL_TO_PLAYER: - cutscenePtr += Cutscene_Command_CameraPositions(globalCtx, csCtx, (void*)cutscenePtr, 1); + cutscenePtr += Cutscene_Command_CameraEyePoints(globalCtx, csCtx, (void*)cutscenePtr, 1); break; case CS_CMD_CAM_AT: - cutscenePtr += Cutscene_Command_CameraFocus(globalCtx, csCtx, (void*)cutscenePtr, 0); + cutscenePtr += Cutscene_Command_CameraLookAtPoints(globalCtx, csCtx, (void*)cutscenePtr, 0); break; case CS_CMD_CAM_AT_REL_TO_PLAYER: - cutscenePtr += Cutscene_Command_CameraFocus(globalCtx, csCtx, (void*)cutscenePtr, 1); + cutscenePtr += Cutscene_Command_CameraLookAtPoints(globalCtx, csCtx, (void*)cutscenePtr, 1); break; case CS_CMD_07: cutscenePtr += Cutscene_Command_07(globalCtx, csCtx, (void*)cutscenePtr, 0); @@ -1967,12 +1967,12 @@ void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) { case 0x028E: case 0x0292: case 0x0476: - Gameplay_CopyCamera(globalCtx, D_8015FCC6, csCtx->unk_14); + Gameplay_CopyCamera(globalCtx, sReturnToCamId, csCtx->subCamId); } - Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, csCtx->unk_14); - func_8005B1A4(globalCtx->cameraPtrs[D_8015FCC6]); + Gameplay_ChangeCameraStatus(globalCtx, sReturnToCamId, CAM_STAT_ACTIVE); + Gameplay_ClearCamera(globalCtx, csCtx->subCamId); + func_8005B1A4(globalCtx->cameraPtrs[sReturnToCamId]); } Audio_SetCutsceneFlag(0); @@ -2011,10 +2011,10 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) { D_8015FCC4 = 0xFFFF; csCtx->unk_1A = 0; csCtx->unk_1B = 0; - D_8015FCC6 = globalCtx->activeCamera; + sReturnToCamId = globalCtx->activeCamId; if (D_8015FCC8 != 0) { - csCtx->unk_14 = Gameplay_CreateSubCamera(globalCtx); + csCtx->subCamId = Gameplay_CreateSubCamera(globalCtx); } if (gSaveContext.cutsceneTrigger == 0) { diff --git a/src/code/z_horse.c b/src/code/z_horse.c index 072ef31876..8a3deac6e3 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -223,7 +223,7 @@ void func_8006D684(GlobalContext* globalCtx, Player* player) { sp54.y = player->actor.world.pos.y + 100.0f; sp54.z = player->actor.world.pos.z; - Gameplay_CameraSetAtEye(globalCtx, globalCtx->activeCamera, &player->actor.world.pos, &sp54); + Gameplay_CameraSetAtEye(globalCtx, globalCtx->activeCamId, &player->actor.world.pos, &sp54); } else { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, diff --git a/src/code/z_message_PAL.c b/src/code/z_message_PAL.c index 38968e59ae..18fd1d7325 100644 --- a/src/code/z_message_PAL.c +++ b/src/code/z_message_PAL.c @@ -3275,13 +3275,13 @@ void Message_Update(GlobalContext* globalCtx) { } if (globalCtx->csCtx.state == 0) { osSyncPrintf(VT_FGCOL(GREEN)); - osSyncPrintf("day_time=%x active_camera=%d ", gSaveContext.cutsceneIndex, globalCtx->activeCamera); + osSyncPrintf("day_time=%x active_camera=%d ", gSaveContext.cutsceneIndex, globalCtx->activeCamId); if (msgCtx->textId != 0x2061 && msgCtx->textId != 0x2025 && msgCtx->textId != 0x208C && ((msgCtx->textId < 0x88D || msgCtx->textId >= 0x893) || msgCtx->choiceIndex != 0) && (msgCtx->textId != 0x3055 && gSaveContext.cutsceneIndex < 0xFFF0)) { osSyncPrintf("=== day_time=%x ", ((void)0, gSaveContext.cutsceneIndex)); - if (globalCtx->activeCamera == MAIN_CAM) { + if (globalCtx->activeCamId == CAM_ID_MAIN) { if (gSaveContext.unk_13EE == 0 || gSaveContext.unk_13EE == 1 || gSaveContext.unk_13EE == 2) { gSaveContext.unk_13EE = 0x32; } diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index ea2bec75aa..a4d6edeb13 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -56,10 +56,10 @@ void OnePointCutscene_SetCsCamPoints(Camera* camera, s16 actionParameters, s16 i onePointCamData->initTimer = initTimer; } -s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Actor* actor, s16 timer) { - Camera* csCam = globalCtx->cameraPtrs[camIdx]; - Camera* childCam = globalCtx->cameraPtrs[csCam->childCamIdx]; - Camera* mainCam = globalCtx->cameraPtrs[MAIN_CAM]; +s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 subCamId, s16 csId, Actor* actor, s16 timer) { + Camera* subCam = globalCtx->cameraPtrs[subCamId]; + Camera* childCam = globalCtx->cameraPtrs[subCam->childCamId]; + Camera* mainCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; Player* player = mainCam->player; VecSph spD0; s32 i; @@ -68,7 +68,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act PosRot spA0; PosRot sp8C; f32 tempRand; - OnePointCsInfo* csInfo = &csCam->paramData.uniq9.csInfo; + OnePointCsInfo* csInfo = &subCam->paramData.uniq9.csInfo; switch (csId) { case 1020: @@ -82,13 +82,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act D_801208EC[1].eyeTargetInit = mainCam->eye; D_801208EC[1].fovTargetInit = mainCam->fov; D_801208EC[1].timerInit = timer - 1; - csCam->timer = timer + 1; + subCam->timer = timer + 1; D_801208EC[1].lerpStepScale = 1.0f / (0.5f * timer); csInfo->keyFrames = D_801208EC; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 1030: D_80120964[0].atTargetInit = globalCtx->view.at; @@ -101,7 +101,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80120964; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 5000: D_801209B4[0].atTargetInit = D_801209B4[1].atTargetInit = globalCtx->view.at; @@ -115,17 +115,17 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801209B4; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 5010: - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_ATTENTION); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &mainCam->at, &mainCam->eye); - csCam->roll = 0; + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_ATTENTION); + Gameplay_CameraSetAtEye(globalCtx, subCamId, &mainCam->at, &mainCam->eye); + subCam->roll = 0; break; case 9500: csInfo->keyFrames = D_80120A54; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 2260: D_80120ACC[0].atTargetInit.x = D_80120ACC[2].atTargetInit.x = @@ -137,7 +137,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80120ACC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 2270: csInfo->keyFrames = D_80120B94; @@ -152,11 +152,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act } } - D_80120B94[camIdx - 1].eyeTargetInit.y = + D_80120B94[subCamId - 1].eyeTargetInit.y = ((mainCam->globalCtx->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 5); + i = Quake_Add(subCam, 5); Quake_SetSpeed(i, 400); Quake_SetQuakeValues(i, 4, 5, 40, 0x3C); Quake_SetCountdown(i, 1600); @@ -173,11 +173,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act D_80120D4C[i].eyeTargetInit.z = (Rand_ZeroOne() * 40.0f) + 80.0f; } } - D_80120D4C[camIdx - 1].eyeTargetInit.y = + D_80120D4C[subCamId - 1].eyeTargetInit.y = ((mainCam->globalCtx->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 5); + i = Quake_Add(subCam, 5); Quake_SetSpeed(i, 400); Quake_SetQuakeValues(i, 2, 3, 200, 0x32); Quake_SetCountdown(i, 9999); @@ -186,9 +186,9 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80120E64; csInfo->keyFrameCnt = 8; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 5); + i = Quake_Add(subCam, 5); Quake_SetSpeed(i, 400); Quake_SetQuakeValues(i, 2, 2, 50, 0); Quake_SetCountdown(i, 280); @@ -202,15 +202,15 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80120FA4; csInfo->keyFrameCnt = 6; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 2340: csInfo->keyFrames = D_80121094; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 5); + i = Quake_Add(subCam, 5); Quake_SetSpeed(i, 400); Quake_SetQuakeValues(i, 2, 2, 50, 0); Quake_SetCountdown(i, 60); @@ -219,7 +219,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012110C; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 2200: { s16 sp82; @@ -255,8 +255,8 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801211D4; csInfo->keyFrameCnt = 2; } - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_UNK3); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); } break; case 2290: { Actor* rideActor = player->rideActor; @@ -269,7 +269,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80121224; csInfo->keyFrameCnt = 6; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); } break; case 5120: func_8002DF54(globalCtx, NULL, 8); @@ -277,7 +277,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80121314; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4510: D_8012133C[0].eyeTargetInit = actor->world.pos; @@ -287,7 +287,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012133C; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4500: Actor_GetFocus(&spA0, actor); @@ -298,13 +298,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spD0.pitch = 0x3E8; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); + Gameplay_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); func_8002DF54(globalCtx, NULL, 8); - csCam->roll = 0; - csCam->fov = 50.0f; - if (csCam->childCamIdx != SUBCAM_FREE) { - OnePointCutscene_EndCutscene(globalCtx, csCam->childCamIdx); + subCam->roll = 0; + subCam->fov = 50.0f; + if (subCam->childCamId != CAM_ID_MAIN) { + OnePointCutscene_EndCutscene(globalCtx, subCam->childCamId); } break; case 2210: @@ -319,29 +319,29 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801213B4; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 1010: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &childCam->at, &childCam->eye); - Gameplay_CameraSetFov(globalCtx, camIdx, childCam->fov); - Gameplay_SetCameraRoll(globalCtx, camIdx, childCam->roll); + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); + Gameplay_CameraSetAtEye(globalCtx, subCamId, &childCam->at, &childCam->eye); + Gameplay_CameraSetFov(globalCtx, subCamId, childCam->fov); + Gameplay_SetCameraRoll(globalCtx, subCamId, childCam->roll); break; case 9601: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_CS_3); - Gameplay_CameraChangeSetting(globalCtx, MAIN_CAM, mainCam->prevSetting); - OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120398); + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_CS_3); + Gameplay_CameraChangeSetting(globalCtx, CAM_ID_MAIN, mainCam->prevSetting); + OnePointCutscene_SetCsCamPoints(subCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120398); break; case 9602: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_CS_3); - Gameplay_CameraChangeSetting(globalCtx, MAIN_CAM, mainCam->prevSetting); - OnePointCutscene_SetCsCamPoints(csCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120434); + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_CS_3); + Gameplay_CameraChangeSetting(globalCtx, CAM_ID_MAIN, mainCam->prevSetting); + OnePointCutscene_SetCsCamPoints(subCam, D_80120430 | 0x1000, D_8012042C, D_80120308, D_80120434); break; case 4175: csInfo->keyFrames = D_8012147C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4180: spC0.x = -1881.0f; @@ -350,10 +350,10 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spB4.x = -1979.0f; spB4.y = 703.0f; spB4.z = -269.0f; - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); - csCam->roll = 6; - csCam->fov = 75.0f; + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); + Gameplay_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + subCam->roll = 6; + subCam->fov = 75.0f; func_8002DF54(globalCtx, NULL, 8); break; case 3040: @@ -363,7 +363,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012151C; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3020: D_8012156C[1].timerInit = timer - 1; @@ -380,7 +380,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012156C; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); func_8002DF54(globalCtx, NULL, 8); break; case 3010: @@ -389,15 +389,15 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801215BC; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3070: csInfo->keyFrames = D_801215E4; csInfo->keyFrameCnt = 10; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 3); + i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 22000); Quake_SetQuakeValues(i, 2, 0, 200, 0); Quake_SetCountdown(i, 10); @@ -406,7 +406,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80121774; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3090: func_8002DF54(globalCtx, NULL, 8); @@ -414,17 +414,17 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80121814; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3100: VEC_SET(spB4, 0.0f, -280.0f, -1400.0f); Actor_GetFocus(&spA0, actor); spC0 = spA0.pos; - func_800C0808(globalCtx, camIdx, player, CAM_SET_PIVOT_VERTICAL); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); - csCam->roll = 0; - csCam->fov = 70.0f; + func_800C0808(globalCtx, subCamId, player, CAM_SET_PIVOT_VERTICAL); + Gameplay_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + subCam->roll = 0; + subCam->fov = 70.0f; func_8002DF54(globalCtx, NULL, 8); break; case 3380: @@ -433,9 +433,9 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 2; func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 1); + i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 24000); Quake_SetQuakeValues(i, 2, 0, 0, 0); Quake_SetCountdown(i, 160); @@ -445,12 +445,12 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 2; func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3050: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_CS_3); + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_CS_3); func_8002DF54(globalCtx, &player->actor, 5); - OnePointCutscene_SetCsCamPoints(csCam, D_80120304 | 0x2000, D_80120300, D_8012013C, D_8012021C); + OnePointCutscene_SetCsCamPoints(subCam, D_80120304 | 0x2000, D_80120300, D_8012013C, D_8012021C); func_80078884(NA_SE_SY_CORRECT_CHIME); OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_8012013C[D_801202FC - 2].pos); OnePointCutscene_Vec3sToVec3f(&mainCam->eye, &D_8012021C[D_801202FC - 2].pos); @@ -474,20 +474,20 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act break; case 3120: csInfo->keyFrames = D_80121954[-(timer + 101)]; - csCam->timer = 100; - csCam->unk_14C |= 2; + subCam->timer = 100; + subCam->unk_14C |= 2; csInfo->keyFrameCnt = 2; func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3130: csInfo->keyFrames = D_80121A44; csInfo->keyFrameCnt = 12; func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); - csCam->unk_14C |= 2; + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); + subCam->unk_14C |= 2; break; case 3140: D_80121C24[0].atTargetInit = globalCtx->view.at; @@ -497,7 +497,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80121C24; csInfo->keyFrameCnt = 7; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3150: spC0.x = 1890.0f; @@ -506,10 +506,10 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spB4.x = 1729.0f; spB4.y = 995.0f; spB4.z = -1405.0f; - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); - csCam->roll = 0x50; - csCam->fov = 55.0f; + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); + Gameplay_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + subCam->roll = 0x50; + subCam->fov = 55.0f; func_8002DF38(globalCtx, &player->actor, 8); break; case 3170: @@ -521,11 +521,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act Actor_GetWorld(&spA0, &player->actor); spD0.yaw = OnePointCutscene_Vec3fYaw(&spC0, &spA0.pos) - 0x7D0; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); - Gameplay_CopyCamera(globalCtx, MAIN_CAM, camIdx); - csCam->roll = -1; - csCam->fov = 55.0f; + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); + Gameplay_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + Gameplay_CopyCamera(globalCtx, CAM_ID_MAIN, subCamId); + subCam->roll = -1; + subCam->fov = 55.0f; func_8002DF38(globalCtx, actor, 1); break; case 3160: @@ -535,10 +535,10 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spD0.yaw = spA0.rot.y; spD0.r = 150.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); - csCam->roll = 0; - csCam->fov = 55.0f; + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); + Gameplay_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + subCam->roll = 0; + subCam->fov = 55.0f; func_8002DF38(globalCtx, &player->actor, 8); break; case 3180: @@ -549,14 +549,14 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spD0.yaw = spA0.rot.y; spD0.pitch = -0xAF0; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); - csCam->roll = 0; - csCam->fov = 60.0f; + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); + Gameplay_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + subCam->roll = 0; + subCam->fov = 60.0f; func_8002DF38(globalCtx, actor, 1); break; case 3190: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FOREST_DEFEAT_POE); + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FOREST_DEFEAT_POE); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); func_8002DF38(globalCtx, actor, 0xC); break; @@ -567,10 +567,10 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spB4.x = 80.0f; spB4.y = 445.0f; spB4.z = -1425.0f; - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); - csCam->roll = 0x1E; - csCam->fov = 75.0f; + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); + Gameplay_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + subCam->roll = 0x1E; + subCam->fov = 75.0f; func_8002DF38(globalCtx, &player->actor, 8); Actor_GetWorldPosShapeRot(&spA0, actor); Actor_GetFocus(&sp8C, &player->actor); @@ -581,9 +581,9 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spD0.pitch = 0x5DC; spD0.r = 120.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraSetAtEye(globalCtx, MAIN_CAM, &spC0, &spB4); + Gameplay_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &spC0, &spB4); - i = Quake_Add(csCam, 3); + i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 22000); Quake_SetQuakeValues(i, 1, 0, 0, 0); Quake_SetCountdown(i, 90); @@ -596,25 +596,25 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act spD0.yaw = spA0.rot.y + 0x7FFF; spD0.r = 300.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); - csCam->roll = 0; - csCam->fov = 45.0f; + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); + Gameplay_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + subCam->roll = 0; + subCam->fov = 45.0f; func_8002DF38(globalCtx, &player->actor, 8); break; case 3220: Actor_GetFocus(&spA0, actor); spC0 = spA0.pos; - func_800C0808(globalCtx, camIdx, player, CAM_SET_PIVOT_VERTICAL); + func_800C0808(globalCtx, subCamId, player, CAM_SET_PIVOT_VERTICAL); Actor_GetWorld(&spA0, &player->actor); OLib_Vec3fDiffToVecSphGeo(&spD0, &spC0, &spA0.pos); spD0.yaw += 0x3E8; spD0.r = 400.0f; OnePointCutscene_AddVecSphToVec3f(&spB4, &spC0, &spD0); spB4.y = spA0.pos.y + 60.0f; - Gameplay_CameraSetAtEye(globalCtx, camIdx, &spC0, &spB4); - csCam->roll = 0; - csCam->fov = 75.0f; + Gameplay_CameraSetAtEye(globalCtx, subCamId, &spC0, &spB4); + subCam->roll = 0; + subCam->fov = 75.0f; player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = spD0.yaw + 0x7FFF; func_8002DF54(globalCtx, NULL, 8); break; @@ -625,31 +625,31 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 3; func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 6001: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_CS_3); + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_CS_3); func_8002DF54(globalCtx, NULL, 8); Actor_GetWorld(&spA0, actor); if (spA0.pos.z > -750.0f) { - OnePointCutscene_SetCsCamPoints(csCam, D_801208E8, D_801208E4, D_801206A0, D_80120820); + OnePointCutscene_SetCsCamPoints(subCam, D_801208E8, D_801208E4, D_801206A0, D_80120820); } else { - OnePointCutscene_SetCsCamPoints(csCam, D_801208E8, D_801208E4, D_801206A0, D_80120760); + OnePointCutscene_SetCsCamPoints(subCam, D_801208E8, D_801208E4, D_801206A0, D_80120760); } - i = Quake_Add(csCam, 1); + i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 32000); Quake_SetQuakeValues(i, 0, 0, 20, 0); Quake_SetCountdown(i, D_801208E4 - 10); break; case 3400: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_CS_3); + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_CS_3); func_8002DF38(globalCtx, &player->actor, 8); - OnePointCutscene_SetCsCamPoints(csCam, D_8012069C | 0x2000, D_80120698, D_801204D4, D_801205B4); + OnePointCutscene_SetCsCamPoints(subCam, D_8012069C | 0x2000, D_80120698, D_801204D4, D_801205B4); OnePointCutscene_Vec3sToVec3f(&mainCam->eye, &D_801205B4[D_80120694 - 2].pos); OnePointCutscene_Vec3sToVec3f(&mainCam->at, &D_801204D4[D_80120694 - 2].pos); - i = Quake_Add(csCam, 1); + i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 0x4E20); Quake_SetQuakeValues(i, 1, 0, 50, 0); Quake_SetCountdown(i, D_80120698 - 20); @@ -661,14 +661,14 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 9; func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3310: - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FIRE_STAIRCASE); + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FIRE_STAIRCASE); func_8002DF54(globalCtx, NULL, 8); - Gameplay_CopyCamera(globalCtx, camIdx, MAIN_CAM); + Gameplay_CopyCamera(globalCtx, subCamId, CAM_ID_MAIN); - i = Quake_Add(csCam, 1); + i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 32000); Quake_SetQuakeValues(i, 2, 0, 0, 0); Quake_SetCountdown(i, timer); @@ -683,9 +683,9 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80121F1C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 3); + i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 12000); Quake_SetQuakeValues(i, 0, 0, 1000, 0); Quake_SetCountdown(i, 5); @@ -699,9 +699,9 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 4; func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 3); + i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 12000); Quake_SetQuakeValues(i, 0, 0, 1000, 0); Quake_SetCountdown(i, 5); @@ -711,7 +711,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 3; func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3350: D_801220D4[0].atTargetInit = globalCtx->view.at; @@ -730,23 +730,23 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801220D4; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3330: csInfo->keyFrames = D_8012219C; csInfo->keyFrameCnt = 7; func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3410: csInfo->keyFrames = D_801222B4; csInfo->keyFrameCnt = 5; func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 1); + i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 32000); Quake_SetQuakeValues(i, 4, 0, 0, 0); Quake_SetCountdown(i, 20); @@ -756,9 +756,9 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 2; func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 1); + i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 32000); Quake_SetQuakeValues(i, 2, 0, 0, 0); Quake_SetCountdown(i, 10); @@ -768,11 +768,11 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 6; func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); player->stateFlags1 |= PLAYER_STATE1_29; player->actor.freezeTimer = 90; - i = Quake_Add(csCam, 1); + i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 32000); Quake_SetQuakeValues(i, 2, 0, 0, 0); Quake_SetCountdown(i, 10); @@ -782,9 +782,9 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 7; func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 1); + i = Quake_Add(subCam, 1); Quake_SetSpeed(i, 32000); Quake_SetQuakeValues(i, 1, 0, 10, 0); Quake_SetCountdown(i, 20); @@ -794,7 +794,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 5; player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = 0x3FFC; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); func_8002DF54(globalCtx, NULL, 8); break; case 4110: @@ -802,7 +802,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 3; func_8002DF38(globalCtx, &player->actor, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4120: func_8002DF54(globalCtx, NULL, 8); @@ -810,13 +810,13 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80122714; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4140: csInfo->keyFrames = D_801227B4; csInfo->keyFrameCnt = 6; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); break; case 4150: @@ -825,7 +825,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act func_8002DF54(globalCtx, NULL, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4160: csInfo->keyFrames = D_8012296C; @@ -833,7 +833,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act func_8002DF54(globalCtx, NULL, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4170: csInfo->keyFrames = D_80122A0C; @@ -841,7 +841,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act func_8002DF54(globalCtx, NULL, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4190: csInfo->keyFrames = D_80122A5C; @@ -849,7 +849,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act func_8002DF38(globalCtx, &player->actor, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4200: csInfo->keyFrames = D_80122B9C; @@ -857,7 +857,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act func_8002DF38(globalCtx, &player->actor, 8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4210: player->actor.freezeTimer = timer; @@ -865,9 +865,9 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80122C14; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); - i = Quake_Add(csCam, 3); + i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 12000); Quake_SetQuakeValues(i, 0, 1, 100, 0); Quake_SetCountdown(i, timer - 80); @@ -876,10 +876,10 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = (player->actor.world.pos.z < -15.0f) ? D_80122C3C : D_80122C64; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); func_8002DF38(globalCtx, &player->actor, 1); - i = Quake_Add(csCam, 3); + i = Quake_Add(subCam, 3); Quake_SetSpeed(i, 12000); Quake_SetQuakeValues(i, 0, 1, 10, 0); Quake_SetCountdown(i, timer - 10); @@ -889,7 +889,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrameCnt = 1; func_8002DF54(globalCtx, NULL, 8); - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3260: func_8002DF54(globalCtx, NULL, 8); @@ -898,7 +898,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80122CB4; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 3261: func_8002DF54(globalCtx, NULL, 8); @@ -907,19 +907,19 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80122D04; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 8010: csInfo->keyFrames = D_80122D54; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 8002: csInfo->keyFrames = D_80122DCC; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 8700: Actor_GetFocus(&spA0, actor); @@ -930,7 +930,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80122E44[timer & 1]; csInfo->keyFrameCnt = 7; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 1100: { s32 tempDiff = globalCtx->state.frames - sPrevFrameCs1100; @@ -948,18 +948,18 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012313C; csInfo->keyFrameCnt = 3; } - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); sPrevFrameCs1100 = globalCtx->state.frames; } break; case 9806: - csCam->timer = -99; + subCam->timer = -99; if (func_800C0CB8(globalCtx)) { - func_800C0808(globalCtx, camIdx, player, CAM_SET_TURN_AROUND); - csCam->data2 = 0xC; + func_800C0808(globalCtx, subCamId, player, CAM_SET_TURN_AROUND); + subCam->data2 = 0xC; } else { - Gameplay_CopyCamera(globalCtx, camIdx, MAIN_CAM); - Gameplay_CameraChangeSetting(globalCtx, camIdx, CAM_SET_FREE2); + Gameplay_CopyCamera(globalCtx, subCamId, CAM_ID_MAIN); + Gameplay_CameraChangeSetting(globalCtx, subCamId, CAM_SET_FREE2); } break; case 9908: @@ -982,7 +982,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801231B4; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); } else { D_80123254[1].timerInit = timer - 1; D_80123254[0].fovTargetInit = mainCam->fov; @@ -992,7 +992,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80123254; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); } break; case 1000: @@ -1003,58 +1003,58 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801232A4; csInfo->keyFrameCnt = 1; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 8603: csInfo->keyFrames = D_801232CC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 8604: csInfo->keyFrames = D_80123394; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4000: csInfo->keyFrames = D_8012345C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4010: csInfo->keyFrames = D_801234FC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4011: csInfo->keyFrames = D_801235C4; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4020: csInfo->keyFrames = D_8012368C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4021: csInfo->keyFrames = D_8012372C; csInfo->keyFrameCnt = 4; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 4022: - csCam->timer = D_801237CC[0].timerInit + D_801237CC[3].timerInit + D_801237CC[1].timerInit + - D_801237CC[2].timerInit + D_801237CC[4].timerInit; + subCam->timer = D_801237CC[0].timerInit + D_801237CC[3].timerInit + D_801237CC[1].timerInit + + D_801237CC[2].timerInit + D_801237CC[4].timerInit; csInfo->keyFrames = D_801237CC; csInfo->keyFrameCnt = 5; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 9703: D_80123894[0].atTargetInit = globalCtx->view.at; @@ -1068,7 +1068,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_80123894; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 9704: D_8012390C[0].atTargetInit = globalCtx->view.at; @@ -1078,7 +1078,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012390C; csInfo->keyFrameCnt = 2; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 9705: D_8012395C[0].atTargetInit = globalCtx->view.at; @@ -1088,7 +1088,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_8012395C; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, player, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, player, CAM_SET_CS_C); break; case 5110: D_801239D4[1].timerInit = 10; @@ -1096,7 +1096,7 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act csInfo->keyFrames = D_801239D4; csInfo->keyFrameCnt = 3; - func_800C0808(globalCtx, camIdx, (Player*)actor, CAM_SET_CS_C); + func_800C0808(globalCtx, subCamId, (Player*)actor, CAM_SET_CS_C); break; default: osSyncPrintf(VT_COL(RED, WHITE) "onepointdemo camera: demo number not found !! (%d)\n" VT_RST, csId); @@ -1105,143 +1105,143 @@ s32 OnePointCutscene_SetInfo(GlobalContext* globalCtx, s16 camIdx, s16 csId, Act return 0; } -s16 OnePointCutscene_SetAsChild(GlobalContext* globalCtx, s16 newCamIdx, s16 parentCamIdx) { - s16 prevCamIdx = globalCtx->cameraPtrs[parentCamIdx]->childCamIdx; +s16 OnePointCutscene_SetAsChild(GlobalContext* globalCtx, s16 newCamId, s16 parentCamId) { + s16 prevCamId = globalCtx->cameraPtrs[parentCamId]->childCamId; - globalCtx->cameraPtrs[newCamIdx]->parentCamIdx = parentCamIdx; - globalCtx->cameraPtrs[parentCamIdx]->childCamIdx = newCamIdx; + globalCtx->cameraPtrs[newCamId]->parentCamId = parentCamId; + globalCtx->cameraPtrs[parentCamId]->childCamId = newCamId; - return prevCamIdx; + return prevCamId; } /** * Removes a cutscene camera from the list. Returns the parent cam if the removed camera is active, otherwise returns - * SUBCAM_NONE + * CAM_ID_NONE */ -s32 OnePointCutscene_RemoveCamera(GlobalContext* globalCtx, s16 camIdx) { - Camera* camera = globalCtx->cameraPtrs[camIdx]; - s32 nextCamIdx; +s32 OnePointCutscene_RemoveCamera(GlobalContext* globalCtx, s16 subCamId) { + Camera* subCam = globalCtx->cameraPtrs[subCamId]; + s32 nextCamId; - if (camera->thisIdx == CHILD_CAM(camera)->parentCamIdx) { - CHILD_CAM(camera)->parentCamIdx = camera->parentCamIdx; + if (subCam->camId == CHILD_CAM(subCam)->parentCamId) { + CHILD_CAM(subCam)->parentCamId = subCam->parentCamId; } - if (camera->thisIdx == PARENT_CAM(camera)->childCamIdx) { - PARENT_CAM(camera)->childCamIdx = camera->childCamIdx; + if (subCam->camId == PARENT_CAM(subCam)->childCamId) { + PARENT_CAM(subCam)->childCamId = subCam->childCamId; } - nextCamIdx = (globalCtx->activeCamera == camIdx) ? camera->parentCamIdx : SUBCAM_NONE; - camera->parentCamIdx = MAIN_CAM; - camera->childCamIdx = camera->parentCamIdx; - camera->timer = -1; - Gameplay_ClearCamera(camera->globalCtx, camera->thisIdx); - return nextCamIdx; + nextCamId = (globalCtx->activeCamId == subCamId) ? subCam->parentCamId : CAM_ID_NONE; + subCam->parentCamId = CAM_ID_MAIN; + subCam->childCamId = subCam->parentCamId; + subCam->timer = -1; + Gameplay_ClearCamera(subCam->globalCtx, subCam->camId); + return nextCamId; } -#define vChildCamIdx temp2 -#define vCsStatus temp1 -#define vCurCamIdx temp2 -#define vNextCamIdx temp1 +#define vChildCamId temp2 +#define vSubCamStatus temp1 +#define vCurCamId temp2 +#define vNextCamId temp1 /** * Creates a cutscene subcamera with the specified ID, duration, and targeted actor. The camera is placed into the * cutscene queue in front of the specified camera, then all lower priority demos in front of it are removed from the * queue. */ -s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* actor, s16 parentCamIdx) { +s16 OnePointCutscene_Init(GlobalContext* globalCtx, s16 csId, s16 timer, Actor* actor, s16 parentCamId) { s16 temp1; s16 temp2; - s16 csCamIdx; - Camera* csCam; + s16 subCamId; + Camera* subCam; - if (parentCamIdx == SUBCAM_ACTIVE) { - parentCamIdx = globalCtx->activeCamera; + if (parentCamId == CAM_ID_NONE) { + parentCamId = globalCtx->activeCamId; } - csCamIdx = Gameplay_CreateSubCamera(globalCtx); - if (csCamIdx == SUBCAM_NONE) { + subCamId = Gameplay_CreateSubCamera(globalCtx); + if (subCamId == CAM_ID_NONE) { osSyncPrintf(VT_COL(RED, WHITE) "onepoint demo: error: too many cameras ... give up! type=%d\n" VT_RST, csId); - return SUBCAM_NONE; + return CAM_ID_NONE; } // Inserts the cutscene camera into the cutscene queue in front of parentCam - vChildCamIdx = globalCtx->cameraPtrs[parentCamIdx]->childCamIdx; - vCsStatus = CAM_STAT_ACTIVE; - if (vChildCamIdx >= SUBCAM_FIRST) { - OnePointCutscene_SetAsChild(globalCtx, vChildCamIdx, csCamIdx); - vCsStatus = CAM_STAT_WAIT; + vChildCamId = globalCtx->cameraPtrs[parentCamId]->childCamId; + vSubCamStatus = CAM_STAT_ACTIVE; + if (vChildCamId >= CAM_ID_SUB_FIRST) { + OnePointCutscene_SetAsChild(globalCtx, vChildCamId, subCamId); + vSubCamStatus = CAM_STAT_WAIT; } else { Interface_ChangeAlpha(2); } - OnePointCutscene_SetAsChild(globalCtx, csCamIdx, parentCamIdx); + OnePointCutscene_SetAsChild(globalCtx, subCamId, parentCamId); - csCam = globalCtx->cameraPtrs[csCamIdx]; + subCam = globalCtx->cameraPtrs[subCamId]; - csCam->timer = timer; - csCam->target = actor; + subCam->timer = timer; + subCam->target = actor; - csCam->at = globalCtx->view.at; - csCam->eye = globalCtx->view.eye; - csCam->fov = globalCtx->view.fovy; + subCam->at = globalCtx->view.at; + subCam->eye = globalCtx->view.eye; + subCam->fov = globalCtx->view.fovy; - csCam->csId = csId; + subCam->csId = csId; - if (parentCamIdx == MAIN_CAM) { - Gameplay_ChangeCameraStatus(globalCtx, parentCamIdx, CAM_STAT_UNK3); + if (parentCamId == CAM_ID_MAIN) { + Gameplay_ChangeCameraStatus(globalCtx, parentCamId, CAM_STAT_UNK3); } else { - Gameplay_ChangeCameraStatus(globalCtx, parentCamIdx, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, parentCamId, CAM_STAT_WAIT); } - OnePointCutscene_SetInfo(globalCtx, csCamIdx, csId, actor, timer); - Gameplay_ChangeCameraStatus(globalCtx, csCamIdx, vCsStatus); + OnePointCutscene_SetInfo(globalCtx, subCamId, csId, actor, timer); + Gameplay_ChangeCameraStatus(globalCtx, subCamId, vSubCamStatus); // Removes all lower priority cutscenes in front of this cutscene from the queue. - vCurCamIdx = csCamIdx; - vNextCamIdx = globalCtx->cameraPtrs[csCamIdx]->childCamIdx; + vCurCamId = subCamId; + vNextCamId = globalCtx->cameraPtrs[subCamId]->childCamId; - while (vNextCamIdx >= SUBCAM_FIRST) { - s16 nextCsId = globalCtx->cameraPtrs[vNextCamIdx]->csId; - s16 thisCsId = globalCtx->cameraPtrs[csCamIdx]->csId; + while (vNextCamId >= CAM_ID_SUB_FIRST) { + s16 nextCsId = globalCtx->cameraPtrs[vNextCamId]->csId; + s16 thisCsId = globalCtx->cameraPtrs[subCamId]->csId; if ((nextCsId / 100) < (thisCsId / 100)) { osSyncPrintf(VT_COL(YELLOW, BLACK) "onepointdemo camera[%d]: killed 'coz low priority (%d < %d)\n" VT_RST, - vNextCamIdx, nextCsId, thisCsId); - if (globalCtx->cameraPtrs[vNextCamIdx]->csId != 5010) { - if ((vNextCamIdx = OnePointCutscene_RemoveCamera(globalCtx, vNextCamIdx)) != SUBCAM_NONE) { - Gameplay_ChangeCameraStatus(globalCtx, vNextCamIdx, CAM_STAT_ACTIVE); + vNextCamId, nextCsId, thisCsId); + if (globalCtx->cameraPtrs[vNextCamId]->csId != 5010) { + if ((vNextCamId = OnePointCutscene_RemoveCamera(globalCtx, vNextCamId)) != CAM_ID_NONE) { + Gameplay_ChangeCameraStatus(globalCtx, vNextCamId, CAM_STAT_ACTIVE); } } else { - vCurCamIdx = vNextCamIdx; - OnePointCutscene_EndCutscene(globalCtx, vNextCamIdx); + vCurCamId = vNextCamId; + OnePointCutscene_EndCutscene(globalCtx, vNextCamId); } } else { - vCurCamIdx = vNextCamIdx; + vCurCamId = vNextCamId; } - vNextCamIdx = globalCtx->cameraPtrs[vCurCamIdx]->childCamIdx; + vNextCamId = globalCtx->cameraPtrs[vCurCamId]->childCamId; } - return csCamIdx; + return subCamId; } /** - * Ends the cutscene in camIdx by setting its timer to 0. For attention cutscenes, it is set to 5 instead. + * Ends the cutscene in subCamId by setting its timer to 0. For attention cutscenes, it is set to 5 instead. */ -s16 OnePointCutscene_EndCutscene(GlobalContext* globalCtx, s16 camIdx) { - if (camIdx == SUBCAM_ACTIVE) { - camIdx = globalCtx->activeCamera; +s16 OnePointCutscene_EndCutscene(GlobalContext* globalCtx, s16 subCamId) { + if (subCamId == CAM_ID_NONE) { + subCamId = globalCtx->activeCamId; } - if (globalCtx->cameraPtrs[camIdx] != NULL) { - osSyncPrintf("onepointdemo camera[%d]: delete timer=%d next=%d\n", camIdx, globalCtx->cameraPtrs[camIdx]->timer, - globalCtx->cameraPtrs[camIdx]->parentCamIdx); - if (globalCtx->cameraPtrs[camIdx]->csId == 5010) { - globalCtx->cameraPtrs[camIdx]->timer = 5; + if (globalCtx->cameraPtrs[subCamId] != NULL) { + osSyncPrintf("onepointdemo camera[%d]: delete timer=%d next=%d\n", subCamId, + globalCtx->cameraPtrs[subCamId]->timer, globalCtx->cameraPtrs[subCamId]->parentCamId); + if (globalCtx->cameraPtrs[subCamId]->csId == 5010) { + globalCtx->cameraPtrs[subCamId]->timer = 5; } else { - globalCtx->cameraPtrs[camIdx]->timer = 0; + globalCtx->cameraPtrs[subCamId]->timer = 0; } } - return camIdx; + return subCamId; } #define vTargetCat temp1 -#define vParentCamIdx temp1 +#define vParentCamId temp1 #define vLastHigherCat temp2 -#define vCsCamIdx temp2 +#define vSubCamId temp2 /** * Adds an attention cutscene to the cutscene queue. @@ -1254,11 +1254,11 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { if (sDisableAttention) { osSyncPrintf(VT_COL(YELLOW, BLACK) "actor attention demo camera: canceled by other camera\n" VT_RST); - return SUBCAM_NONE; + return CAM_ID_NONE; } sUnused = -1; - parentCam = globalCtx->cameraPtrs[MAIN_CAM]; + parentCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; if (parentCam->mode == CAM_MODE_FOLLOWBOOMERANG) { osSyncPrintf(VT_COL(YELLOW, BLACK) "actor attention demo camera: change mode BOOKEEPON -> NORMAL\n" VT_RST); Camera_ChangeMode(parentCam, CAM_MODE_NORMAL); @@ -1268,8 +1268,8 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { // after at least one attention demo. vLastHigherCat = -1; - while (parentCam->childCamIdx != SUBCAM_FREE) { - parentCam = globalCtx->cameraPtrs[parentCam->childCamIdx]; + while (parentCam->childCamId != CAM_ID_MAIN) { + parentCam = globalCtx->cameraPtrs[parentCam->childCamId]; if (parentCam == NULL) { break; } else if (parentCam->setting != CAM_SET_CS_ATTENTION) { @@ -1288,7 +1288,7 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { } // Actorcat is only undefined if the actor is in a higher category than all other attention cutscenes. In this case, // it goes in the first position of the list. Otherwise, it goes in the index found in the loop. - vParentCamIdx = (vLastHigherCat == -1) ? MAIN_CAM : parentCam->thisIdx; + vParentCamId = (vLastHigherCat == -1) ? CAM_ID_MAIN : parentCam->camId; switch (actor->category) { case ACTORCAT_SWITCH: @@ -1319,18 +1319,18 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { // If the previous attention cutscene has an actor in the same category, skip this actor. if (actor->category == vLastHigherCat) { osSyncPrintf("→ " VT_FGCOL(MAGENTA) "×" VT_RST " (%d)\n", actor->id); - return SUBCAM_NONE; + return CAM_ID_NONE; } osSyncPrintf("→ " VT_FGCOL(BLUE) "○" VT_RST " (%d)\n", actor->id); - vCsCamIdx = OnePointCutscene_Init(globalCtx, 5010, timer, actor, vParentCamIdx); - if (vCsCamIdx == SUBCAM_NONE) { + vSubCamId = OnePointCutscene_Init(globalCtx, 5010, timer, actor, vParentCamId); + if (vSubCamId == CAM_ID_NONE) { osSyncPrintf(VT_COL(RED, WHITE) "actor attention demo: give up! \n" VT_RST, actor->id); - return SUBCAM_NONE; + return CAM_ID_NONE; } else { - s32* data = (s32*)&globalCtx->cameraPtrs[vCsCamIdx]->data1; + s32* data = (s32*)&globalCtx->cameraPtrs[vSubCamId]->data1; *data = NA_SE_SY_CORRECT_CHIME; - return vCsCamIdx; + return vSubCamId; } } @@ -1338,14 +1338,14 @@ s32 OnePointCutscene_Attention(GlobalContext* globalCtx, Actor* actor) { * Adds an attention cutscene to the cutscene queue with the specified sound effect */ s32 OnePointCutscene_AttentionSetSfx(GlobalContext* globalCtx, Actor* actor, s32 sfxId) { - s32 csCamIdx = OnePointCutscene_Attention(globalCtx, actor); + s32 subCamId = OnePointCutscene_Attention(globalCtx, actor); - if (csCamIdx != SUBCAM_NONE) { - s32* data = (s32*)&globalCtx->cameraPtrs[csCamIdx]->data1; + if (subCamId != CAM_ID_NONE) { + s32* data = (s32*)&globalCtx->cameraPtrs[subCamId]->data1; *data = sfxId; } - return csCamIdx; + return subCamId; } // unused @@ -1359,10 +1359,10 @@ void OnePointCutscene_DisableAttention(void) { } s32 OnePointCutscene_CheckForCategory(GlobalContext* globalCtx, s32 actorCategory) { - Camera* parentCam = globalCtx->cameraPtrs[MAIN_CAM]; + Camera* parentCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; - while (parentCam->childCamIdx != SUBCAM_FREE) { - parentCam = globalCtx->cameraPtrs[parentCam->childCamIdx]; + while (parentCam->childCamId != CAM_ID_MAIN) { + parentCam = globalCtx->cameraPtrs[parentCam->childCamId]; if ((parentCam == NULL) || (parentCam->setting != CAM_SET_CS_ATTENTION)) { break; } else if (actorCategory == parentCam->target->category) { diff --git a/src/code/z_play.c b/src/code/z_play.c index 9d55cd40f0..9f283fee76 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -230,9 +230,9 @@ void Gameplay_Init(GameState* thisx) { Camera_ChangeStatus(&globalCtx->subCameras[i], CAM_STAT_UNK100); } - globalCtx->cameraPtrs[MAIN_CAM] = &globalCtx->mainCamera; - globalCtx->cameraPtrs[MAIN_CAM]->uid = 0; - globalCtx->activeCamera = MAIN_CAM; + globalCtx->cameraPtrs[CAM_ID_MAIN] = &globalCtx->mainCamera; + globalCtx->cameraPtrs[CAM_ID_MAIN]->uid = 0; + globalCtx->activeCamId = CAM_ID_MAIN; func_8005AC48(&globalCtx->mainCamera, 0xFF); Sram_Init(globalCtx, &globalCtx->sramCtx); func_80112098(globalCtx); @@ -1047,14 +1047,14 @@ skip: s32 pad3[5]; s32 i; - globalCtx->nextCamera = globalCtx->activeCamera; + globalCtx->nextCamId = globalCtx->activeCamId; if (1 && HREG(63)) { LOG_NUM("1", 1, "../z_play.c", 3806); } for (i = 0; i < NUM_CAMS; i++) { - if ((i != globalCtx->nextCamera) && (globalCtx->cameraPtrs[i] != NULL)) { + if ((i != globalCtx->nextCamId) && (globalCtx->cameraPtrs[i] != NULL)) { if (1 && HREG(63)) { LOG_NUM("1", 1, "../z_play.c", 3809); } @@ -1063,7 +1063,7 @@ skip: } } - Camera_Update(globalCtx->cameraPtrs[globalCtx->nextCamera]); + Camera_Update(globalCtx->cameraPtrs[globalCtx->nextCamId]); if (1 && HREG(63)) { LOG_NUM("1", 1, "../z_play.c", 3814); @@ -1547,7 +1547,7 @@ void func_800C016C(GlobalContext* globalCtx, Vec3f* src, Vec3f* dest) { s16 Gameplay_CreateSubCamera(GlobalContext* globalCtx) { s16 i; - for (i = SUBCAM_FIRST; i < NUM_CAMS; i++) { + for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) { if (globalCtx->cameraPtrs[i] == NULL) { break; } @@ -1555,38 +1555,38 @@ s16 Gameplay_CreateSubCamera(GlobalContext* globalCtx) { if (i == NUM_CAMS) { osSyncPrintf(VT_COL(RED, WHITE) "camera control: error: fulled sub camera system area\n" VT_RST); - return SUBCAM_NONE; + return CAM_ID_NONE; } osSyncPrintf("camera control: " VT_BGCOL(CYAN) " " VT_COL(WHITE, BLUE) " create new sub camera [%d] " VT_BGCOL( CYAN) " " VT_RST "\n", i); - globalCtx->cameraPtrs[i] = &globalCtx->subCameras[i - SUBCAM_FIRST]; + globalCtx->cameraPtrs[i] = &globalCtx->subCameras[i - CAM_ID_SUB_FIRST]; Camera_Init(globalCtx->cameraPtrs[i], &globalCtx->view, &globalCtx->colCtx, globalCtx); - globalCtx->cameraPtrs[i]->thisIdx = i; + globalCtx->cameraPtrs[i]->camId = i; return i; } s16 Gameplay_GetActiveCamId(GlobalContext* globalCtx) { - return globalCtx->activeCamera; + return globalCtx->activeCamId; } s16 Gameplay_ChangeCameraStatus(GlobalContext* globalCtx, s16 camId, s16 status) { - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; + s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId; if (status == CAM_STAT_ACTIVE) { - globalCtx->activeCamera = camIdx; + globalCtx->activeCamId = camIdx; } return Camera_ChangeStatus(globalCtx->cameraPtrs[camIdx], status); } void Gameplay_ClearCamera(GlobalContext* globalCtx, s16 camId) { - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; + s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId; - if (camIdx == MAIN_CAM) { + if (camIdx == CAM_ID_MAIN) { osSyncPrintf(VT_COL(RED, WHITE) "camera control: error: never clear camera !!\n" VT_RST); } @@ -1602,26 +1602,26 @@ void Gameplay_ClearCamera(GlobalContext* globalCtx, s16 camId) { } void Gameplay_ClearAllSubCameras(GlobalContext* globalCtx) { - s16 i; + s16 subCamId; - for (i = SUBCAM_FIRST; i < NUM_CAMS; i++) { - if (globalCtx->cameraPtrs[i] != NULL) { - Gameplay_ClearCamera(globalCtx, i); + for (subCamId = CAM_ID_SUB_FIRST; subCamId < NUM_CAMS; subCamId++) { + if (globalCtx->cameraPtrs[subCamId] != NULL) { + Gameplay_ClearCamera(globalCtx, subCamId); } } - globalCtx->activeCamera = MAIN_CAM; + globalCtx->activeCamId = CAM_ID_MAIN; } Camera* Gameplay_GetCamera(GlobalContext* globalCtx, s16 camId) { - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; + s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId; return globalCtx->cameraPtrs[camIdx]; } s32 Gameplay_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye) { s32 ret = 0; - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; + s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId; Camera* camera = globalCtx->cameraPtrs[camIdx]; Player* player; @@ -1647,7 +1647,7 @@ s32 Gameplay_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3 s32 Gameplay_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) { s32 ret = 0; - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; + s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId; Camera* camera = globalCtx->cameraPtrs[camIdx]; Player* player; @@ -1681,7 +1681,7 @@ s32 Gameplay_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov) { } s32 Gameplay_SetCameraRoll(GlobalContext* globalCtx, s16 camId, s16 roll) { - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; + s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId; Camera* camera = globalCtx->cameraPtrs[camIdx]; camera->roll = roll; @@ -1689,16 +1689,16 @@ s32 Gameplay_SetCameraRoll(GlobalContext* globalCtx, s16 camId, s16 roll) { return 1; } -void Gameplay_CopyCamera(GlobalContext* globalCtx, s16 camId1, s16 camId2) { - s16 camIdx2 = (camId2 == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId2; - s16 camIdx1 = (camId1 == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId1; +void Gameplay_CopyCamera(GlobalContext* globalCtx, s16 destCamId, s16 srcCamId) { + s16 srcCamId2 = (srcCamId == CAM_ID_NONE) ? globalCtx->activeCamId : srcCamId; + s16 destCamId1 = (destCamId == CAM_ID_NONE) ? globalCtx->activeCamId : destCamId; - Camera_Copy(globalCtx->cameraPtrs[camIdx1], globalCtx->cameraPtrs[camIdx2]); + Camera_Copy(globalCtx->cameraPtrs[destCamId1], globalCtx->cameraPtrs[srcCamId2]); } s32 func_800C0808(GlobalContext* globalCtx, s16 camId, Player* player, s16 setting) { Camera* camera; - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; + s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId; camera = globalCtx->cameraPtrs[camIdx]; Camera_InitPlayerSettings(camera, player); @@ -1710,12 +1710,12 @@ s32 Gameplay_CameraChangeSetting(GlobalContext* globalCtx, s16 camId, s16 settin } void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2) { - s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId; + s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId; s16 i; Gameplay_ClearCamera(globalCtx, camIdx); - for (i = SUBCAM_FIRST; i < NUM_CAMS; i++) { + for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) { if (globalCtx->cameraPtrs[i] != NULL) { osSyncPrintf( VT_COL(RED, WHITE) "camera control: error: return to main, other camera left. %d cleared!!\n" VT_RST, @@ -1725,10 +1725,10 @@ void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2) { } if (arg2 <= 0) { - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - globalCtx->cameraPtrs[MAIN_CAM]->childCamIdx = globalCtx->cameraPtrs[MAIN_CAM]->parentCamIdx = SUBCAM_FREE; + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); + globalCtx->cameraPtrs[CAM_ID_MAIN]->childCamId = globalCtx->cameraPtrs[CAM_ID_MAIN]->parentCamId = CAM_ID_MAIN; } else { - OnePointCutscene_Init(globalCtx, 1020, arg2, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 1020, arg2, NULL, CAM_ID_MAIN); } } diff --git a/src/code/z_player_lib.c b/src/code/z_player_lib.c index 4ac8516f86..9c9a6a075b 100644 --- a/src/code/z_player_lib.c +++ b/src/code/z_player_lib.c @@ -616,8 +616,8 @@ void func_8008EEAC(GlobalContext* globalCtx, Actor* actor) { this->unk_664 = actor; this->unk_684 = actor; this->stateFlags1 |= PLAYER_STATE1_16; - Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, actor); - Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), 2); + Camera_SetParam(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), 8, actor); + Camera_ChangeMode(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), CAM_MODE_FOLLOWTARGET); } s32 func_8008EF30(GlobalContext* globalCtx) { diff --git a/src/code/z_quake.c b/src/code/z_quake.c index 257d6627bd..ac9290e09a 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -148,13 +148,13 @@ s16 Quake_GetFreeIndex(void) { return ret; } -QuakeRequest* Quake_AddImpl(Camera* cam, u32 callbackIdx) { +QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx) { s16 idx = Quake_GetFreeIndex(); QuakeRequest* req = &sQuakeRequest[idx]; __osMemset(req, 0, sizeof(QuakeRequest)); - req->cam = cam; - req->camPtrIdx = cam->thisIdx; + req->cam = camera; + req->camPtrIdx = camera->camId; req->callbackIdx = callbackIdx; req->unk_1C = 1; req->randIdx = ((s16)(Rand_ZeroOne() * (f32)0x10000) & ~3) + idx; @@ -291,8 +291,8 @@ void Quake_Init(void) { sQuakeRequestCount = 0; } -s16 Quake_Add(Camera* cam, u32 callbackIdx) { - return Quake_AddImpl(cam, callbackIdx)->randIdx; +s16 Quake_Add(Camera* camera, u32 callbackIdx) { + return Quake_AddImpl(camera, callbackIdx)->randIdx; } u32 Quake_RemoveFromIdx(s16 idx) { @@ -347,8 +347,8 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { req->camPtrIdx); Quake_Remove(req); } else { - temp = &camera->thisIdx; - eq = req->cam->thisIdx != *temp; + temp = &camera->camId; + eq = req->cam->camId != *temp; absSpeedDiv = ABS(req->speed) / (f32)0x8000; if (sQuakeCallbacks[req->callbackIdx](req, &shake) == 0) { Quake_Remove(req); diff --git a/src/code/z_room.c b/src/code/z_room.c index d1446872f4..77f718c73d 100644 --- a/src/code/z_room.c +++ b/src/code/z_room.c @@ -307,7 +307,7 @@ void func_8009638C(Gfx** displayList, void* source, void* tlut, u16 width, u16 h // Room Draw Polygon Type 1 - Single Format void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { - Camera* camera; + Camera* activeCam; Gfx* spA8; PolygonType1* polygon1; PolygonDlist* polygonDlist; @@ -318,8 +318,8 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 628); - camera = GET_ACTIVE_CAM(globalCtx); - isFixedCamera = camera->setting == CAM_SET_PREREND_FIXED; + activeCam = GET_ACTIVE_CAM(globalCtx); + isFixedCamera = (activeCam->setting == CAM_SET_PREREND_FIXED); polygon1 = &room->mesh->polygon1; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist); drawBg = (flags & 1) && isFixedCamera && polygon1->single.source && !(SREG(25) & 1); @@ -341,7 +341,7 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { { Vec3f sp60; spA8 = POLY_OPA_DISP; - Camera_GetSkyboxOffset(&sp60, camera); + Camera_GetSkyboxOffset(&sp60, activeCam); func_8009638C(&spA8, polygon1->single.source, polygon1->single.tlut, polygon1->single.width, polygon1->single.height, polygon1->single.fmt, polygon1->single.siz, polygon1->single.mode0, polygon1->single.tlutCount, @@ -364,34 +364,33 @@ void func_80096680(GlobalContext* globalCtx, Room* room, u32 flags) { } BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { - Camera* camera; - s32 camId; - s16 camId2; + Camera* activeCam = GET_ACTIVE_CAM(globalCtx); + s32 camDataIdx; + s16 camDataIdx2; Player* player; BgImage* bgImage; s32 i; - camera = GET_ACTIVE_CAM(globalCtx); - camId = camera->camDataIdx; + camDataIdx = activeCam->camDataIdx; // jfifid - camId2 = func_80041C10(&globalCtx->colCtx, camId, BGCHECK_SCENE)[2].y; - if (camId2 >= 0) { - camId = camId2; + camDataIdx2 = func_80041C10(&globalCtx->colCtx, camDataIdx, BGCHECK_SCENE)[2].y; + if (camDataIdx2 >= 0) { + camDataIdx = camDataIdx2; } player = GET_PLAYER(globalCtx); - player->actor.params = (player->actor.params & 0xFF00) | camId; + player->actor.params = (player->actor.params & 0xFF00) | camDataIdx; bgImage = SEGMENTED_TO_VIRTUAL(polygon1->multi.list); for (i = 0; i < polygon1->multi.count; i++) { - if (bgImage->id == camId) { + if (bgImage->id == camDataIdx) { return bgImage; } bgImage++; } // "z_room.c: Data consistent with camera id does not exist camid=%d" - osSyncPrintf(VT_COL(RED, WHITE) "z_room.c:カメラIDに一致するデータが存在しません camid=%d\n" VT_RST, camId); + osSyncPrintf(VT_COL(RED, WHITE) "z_room.c:カメラIDに一致するデータが存在しません camid=%d\n" VT_RST, camDataIdx); LogUtils_HungupThread("../z_room.c", 726); return NULL; @@ -399,7 +398,7 @@ BgImage* func_80096A74(PolygonType1* polygon1, GlobalContext* globalCtx) { // Room Draw Polygon Type 1 - Multi Format void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { - Camera* camera; + Camera* activeCam; Gfx* gfx; PolygonType1* polygon1; BgImage* bgImage; @@ -411,8 +410,8 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_room.c", 752); - camera = GET_ACTIVE_CAM(globalCtx); - isFixedCamera = camera->setting == CAM_SET_PREREND_FIXED; + activeCam = GET_ACTIVE_CAM(globalCtx); + isFixedCamera = (activeCam->setting == CAM_SET_PREREND_FIXED); polygon1 = &room->mesh->polygon1; polygonDlist = SEGMENTED_TO_VIRTUAL(polygon1->dlist); bgImage = func_80096A74(polygon1, globalCtx); @@ -436,7 +435,7 @@ void func_80096B6C(GlobalContext* globalCtx, Room* room, u32 flags) { Vec3f skyboxOffset; gfx = POLY_OPA_DISP; - Camera_GetSkyboxOffset(&skyboxOffset, camera); + Camera_GetSkyboxOffset(&skyboxOffset, activeCam); func_8009638C(&gfx, bgImage->source, bgImage->tlut, bgImage->width, bgImage->height, bgImage->fmt, bgImage->siz, bgImage->mode0, bgImage->tlutCount, (skyboxOffset.x + skyboxOffset.z) * 1.2f + skyboxOffset.y * 0.6f, diff --git a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c index 6ade80aa4e..4288bf6b58 100644 --- a/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c +++ b/src/overlays/actors/ovl_Bg_Bdan_Objects/z_bg_bdan_objects.c @@ -178,7 +178,7 @@ void func_8086C054(BgBdanObjects* this, GlobalContext* globalCtx) { if (this->dyna.actor.xzDistToPlayer < 250.0f) { BgBdanObjects_SetContactRu1(this, 1); this->timer = 20; - OnePointCutscene_Init(globalCtx, 3070, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3070, -99, &this->dyna.actor, CAM_ID_MAIN); player->actor.world.pos.x = -1130.0f; player->actor.world.pos.y = -1025.0f; player->actor.world.pos.z = -3300.0f; @@ -255,7 +255,7 @@ void func_8086C3D8(BgBdanObjects* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); this->dyna.actor.child->world.pos.y = this->dyna.actor.world.pos.y + 140.0f; this->actionFunc = func_8086C5BC; - OnePointCutscene_Init(globalCtx, 3080, -99, this->dyna.actor.child, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3080, -99, this->dyna.actor.child, CAM_ID_MAIN); player->actor.world.pos.x = -1130.0f; player->actor.world.pos.y = -1025.0f; player->actor.world.pos.z = -3500.0f; @@ -328,7 +328,7 @@ void func_8086C76C(BgBdanObjects* this, GlobalContext* globalCtx) { if (func_8004356C(&this->dyna)) { if (this->dyna.actor.xzDistToPlayer < 120.0f) { this->actionFunc = func_8086C7D0; - OnePointCutscene_Init(globalCtx, 3090, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3090, -99, &this->dyna.actor, CAM_ID_MAIN); } } } @@ -352,13 +352,13 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) { } if (this->switchFlag == 0) { if (func_8004356C(&this->dyna)) { - this->cameraSetting = globalCtx->cameraPtrs[MAIN_CAM]->setting; - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2); - func_8005AD1C(globalCtx->cameraPtrs[MAIN_CAM], 4); + this->cameraSetting = globalCtx->cameraPtrs[CAM_ID_MAIN]->setting; + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2); + func_8005AD1C(globalCtx->cameraPtrs[CAM_ID_MAIN], 4); this->switchFlag = 10; } } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_NORMAL2); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_NORMAL2); if (!func_8004356C(&this->dyna)) { if (this->switchFlag != 0) { this->switchFlag--; @@ -366,8 +366,8 @@ void func_8086C874(BgBdanObjects* this, GlobalContext* globalCtx) { } if (this->switchFlag == 0) { if (1) {} - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], this->cameraSetting); - func_8005ACFC(globalCtx->cameraPtrs[MAIN_CAM], 4); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], this->cameraSetting); + func_8005ACFC(globalCtx->cameraPtrs[CAM_ID_MAIN], 4); } } this->dyna.actor.world.pos.y = @@ -416,7 +416,7 @@ void func_8086CB10(BgBdanObjects* this, GlobalContext* globalCtx) { this->timer = 50; this->actionFunc = func_8086CB8C; this->dyna.actor.home.pos.y -= 200.0f; - OnePointCutscene_Init(globalCtx, 3100, 51, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3100, 51, &this->dyna.actor, CAM_ID_MAIN); } } @@ -430,7 +430,8 @@ void func_8086CB8C(BgBdanObjects* this, GlobalContext* globalCtx) { if (this->timer == 0) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_BUYOSTAND_STOP_U); this->actionFunc = BgBdanObjects_DoNothing; - Gameplay_CopyCamera(globalCtx, MAIN_CAM, SUBCAM_ACTIVE); + // Using `CAM_ID_NONE` here defaults to the active camera + Gameplay_CopyCamera(globalCtx, CAM_ID_MAIN, CAM_ID_NONE); } else { func_8002F974(&this->dyna.actor, NA_SE_EV_BUYOSTAND_FALL - SFX_FLAG); } diff --git a/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c b/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c index 279a36f794..13219087f6 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Jd/z_bg_ddan_jd.c @@ -91,7 +91,7 @@ void BgDdanJd_Idle(BgDdanJd* this, GlobalContext* globalCtx) { this->state = STATE_GO_MIDDLE_FROM_BOTTOM; this->idleTimer = 0; this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + MOVE_HEIGHT_MIDDLE; - OnePointCutscene_Init(globalCtx, 3060, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3060, -99, &this->dyna.actor, CAM_ID_MAIN); } if (this->idleTimer == 0) { this->idleTimer = IDLE_FRAMES; @@ -160,7 +160,7 @@ void BgDdanJd_Move(BgDdanJd* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y + MOVE_HEIGHT_MIDDLE; this->idleTimer = 0; this->actionFunc = BgDdanJd_Idle; - OnePointCutscene_Init(globalCtx, 3060, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3060, -99, &this->dyna.actor, CAM_ID_MAIN); } else if (Math_StepToF(&this->dyna.actor.world.pos.y, this->targetY, this->ySpeed)) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_PILLAR_MOVE_STOP); this->actionFunc = BgDdanJd_Idle; diff --git a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c index 016559748a..3235397b7e 100644 --- a/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c +++ b/src/overlays/actors/ovl_Bg_Ddan_Kd/z_bg_ddan_kd.c @@ -103,7 +103,7 @@ void BgDdanKd_CheckForExplosions(BgDdanKd* this, GlobalContext* globalCtx) { if ((explosive != NULL) && (this->prevExplosive != NULL) && (explosive != this->prevExplosive) && (Math_Vec3f_DistXZ(&this->prevExplosivePos, &explosive->world.pos) > 80.0f)) { BgDdanKd_SetupAction(this, BgDdanKd_LowerStairs); - OnePointCutscene_Init(globalCtx, 3050, 999, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3050, 999, &this->dyna.actor, CAM_ID_MAIN); } else { if (this->timer != 0) { this->timer--; diff --git a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c index d5f7d1e460..de905f0fd9 100644 --- a/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c +++ b/src/overlays/actors/ovl_Bg_Dodoago/z_bg_dodoago.c @@ -161,14 +161,14 @@ void BgDodoago_WaitExplosives(BgDodoago* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); BgDodoago_SetupAction(this, BgDodoago_OpenJaw); - OnePointCutscene_Init(globalCtx, 3380, 160, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3380, 160, &this->dyna.actor, CAM_ID_MAIN); } else if (globalCtx->roomCtx.unk_74[this->state] == 0) { - OnePointCutscene_Init(globalCtx, 3065, 40, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3065, 40, &this->dyna.actor, CAM_ID_MAIN); BgDodoago_SetupAction(this, BgDodoago_LightOneEye); Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } else { - OnePointCutscene_Init(globalCtx, 3065, 20, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3065, 20, &this->dyna.actor, CAM_ID_MAIN); Audio_PlaySoundGeneral(NA_SE_SY_ERROR, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); sTimer += 30; diff --git a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c index 0bfc3ba0cf..c87518c28d 100644 --- a/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c +++ b/src/overlays/actors/ovl_Bg_Dy_Yoseizo/z_bg_dy_yoseizo.c @@ -292,9 +292,9 @@ void BgDyYoseizo_ChooseType(BgDyYoseizo* this, GlobalContext* globalCtx) { globalCtx->envCtx.unk_BF = 2; if (globalCtx->sceneNum == SCENE_DAIYOUSEI_IZUMI) { - OnePointCutscene_Init(globalCtx, 8603, -99, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 8603, -99, NULL, CAM_ID_MAIN); } else { - OnePointCutscene_Init(globalCtx, 8604, -99, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 8604, -99, NULL, CAM_ID_MAIN); }; Audio_PlayActorSound2(&this->actor, NA_SE_EV_GREAT_FAIRY_APPEAR); diff --git a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c index ce0bb26353..4ecb53f1a7 100644 --- a/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c +++ b/src/overlays/actors/ovl_Bg_Ganon_Otyuka/z_bg_ganon_otyuka.c @@ -248,7 +248,7 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { s16 i; Gfx* phi_s2; Gfx* phi_s1; - Camera* camera = Gameplay_GetCamera(globalCtx, 0); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); Actor* actor; BgGanonOtyuka* platform; BossGanon* ganondorf; @@ -282,7 +282,7 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { platform = (BgGanonOtyuka*)actor; if (platform->dyna.actor.projectedPos.z > spBC) { - if (camera->eye.y > platform->dyna.actor.world.pos.y) { + if (mainCam->eye.y > platform->dyna.actor.world.pos.y) { phi_s2 = sPlatformTopDL; } else { phi_s2 = sPlatformBottomDL; @@ -293,7 +293,7 @@ void BgGanonOtyuka_Draw(Actor* thisx, GlobalContext* globalCtx) { if (platform->isFalling) { Matrix_RotateX(BINANG_TO_RAD_ALT(platform->dyna.actor.shape.rot.x), MTXMODE_APPLY); Matrix_RotateZ(BINANG_TO_RAD_ALT(platform->dyna.actor.shape.rot.z), MTXMODE_APPLY); - if (camera->eye.y > platform->dyna.actor.world.pos.y) { + if (mainCam->eye.y > platform->dyna.actor.world.pos.y) { phi_s1 = sPlatformBottomDL; } else { phi_s1 = sPlatformTopDL; diff --git a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c index 84c3f4d6f0..c56b019120 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c +++ b/src/overlays/actors/ovl_Bg_Haka_Huta/z_bg_haka_huta.c @@ -108,7 +108,7 @@ void BgHakaHuta_SpawnEnemies(BgHakaHuta* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params) && !Player_InCsMode(globalCtx)) { this->counter = 25; this->actionFunc = BgHakaHuta_Open; - OnePointCutscene_Init(globalCtx, 6001, 999, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 6001, 999, &this->dyna.actor, CAM_ID_MAIN); if (this->unk_16A == 2) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_FIREFLY, (this->dyna.actor.world.pos.x + (-25.0f) * Math_CosS(this->dyna.actor.shape.rot.y) + diff --git a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c index e408f1cac6..89ca9b8212 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c +++ b/src/overlays/actors/ovl_Bg_Haka_Ship/z_bg_haka_ship.c @@ -94,7 +94,7 @@ void BgHakaShip_WaitForSong(BgHakaShip* this, GlobalContext* globalCtx) { this->counter = 130; this->actionFunc = BgHakaShip_CutsceneStationary; osSyncPrintf("シーン 外輪船 ... アァクション!!\n"); - OnePointCutscene_Init(globalCtx, 3390, 999, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3390, 999, &this->dyna.actor, CAM_ID_MAIN); } } } diff --git a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c index 2bb23f60ac..fef5102ece 100644 --- a/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c +++ b/src/overlays/actors/ovl_Bg_Haka_Zou/z_bg_haka_zou.c @@ -273,7 +273,7 @@ void func_80883000(BgHakaZou* this, GlobalContext* globalCtx) { if (this->dyna.actor.params == STA_GIANT_BIRD_STATUE) { this->timer = 20; this->actionFunc = func_80883144; - OnePointCutscene_Init(globalCtx, 3400, 999, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3400, 999, &this->dyna.actor, CAM_ID_MAIN); } else if (this->dyna.actor.params == 2) { func_80882E54(this, globalCtx); this->dyna.actor.draw = NULL; diff --git a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c index 1e968e130a..3003c60e82 100644 --- a/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c +++ b/src/overlays/actors/ovl_Bg_Heavy_Block/z_bg_heavy_block.c @@ -321,13 +321,13 @@ void BgHeavyBlock_Wait(BgHeavyBlock* this, GlobalContext* globalCtx) { switch (this->dyna.actor.params & 0xFF) { case HEAVYBLOCK_BREAKABLE: - OnePointCutscene_Init(globalCtx, 4020, 270, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4020, 270, &this->dyna.actor, CAM_ID_MAIN); break; case HEAVYBLOCK_UNBREAKABLE: - OnePointCutscene_Init(globalCtx, 4021, 220, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4021, 220, &this->dyna.actor, CAM_ID_MAIN); break; case HEAVYBLOCK_UNBREAKABLE_OUTSIDE_CASTLE: - OnePointCutscene_Init(globalCtx, 4022, 210, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4022, 210, &this->dyna.actor, CAM_ID_MAIN); break; } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c index d56753e9b3..f014ac8451 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Curtain/z_bg_hidan_curtain.c @@ -127,11 +127,11 @@ void BgHidanCurtain_WaitForSwitchOn(BgHidanCurtain* this, GlobalContext* globalC if (Flags_GetSwitch(globalCtx, this->actor.params)) { if (this->type == 1) { this->actionFunc = BgHidanCurtain_WaitForCutscene; - OnePointCutscene_Init(globalCtx, 3350, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3350, -99, &this->actor, CAM_ID_MAIN); this->timer = 50; } else if (this->type == 3) { this->actionFunc = BgHidanCurtain_WaitForCutscene; - OnePointCutscene_Init(globalCtx, 3360, 60, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3360, 60, &this->actor, CAM_ID_MAIN); this->timer = 30; } else { this->actionFunc = BgHidanCurtain_TurnOff; @@ -205,8 +205,8 @@ void BgHidanCurtain_Update(Actor* thisx, GlobalContext* globalCtx2) { BgHidanCurtainParams* hcParams = &sHCParams[this->size]; f32 riseProgress; - if ((globalCtx->cameraPtrs[MAIN_CAM]->setting == CAM_SET_SLOW_CHEST_CS) || - (globalCtx->cameraPtrs[MAIN_CAM]->setting == CAM_SET_TURN_AROUND)) { + if ((globalCtx->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_SLOW_CHEST_CS) || + (globalCtx->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_TURN_AROUND)) { this->collider.base.atFlags &= ~AT_HIT; } else { if (this->collider.base.atFlags & AT_HIT) { diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c index 0ef8b81624..50bdfd7646 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fslift/z_bg_hidan_fslift.c @@ -129,10 +129,10 @@ void BgHidanFslift_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_16A == 0) { this->unk_16A = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_16A != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } this->unk_16A = 0; } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c index e111b8b2eb..68b872a8eb 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Fwbig/z_bg_hidan_fwbig.c @@ -121,7 +121,7 @@ void BgHidanFwbig_UpdatePosition(BgHidanFwbig* this) { void BgHidanFwbig_WaitForSwitch(BgHidanFwbig* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, this->actor.params)) { this->actionFunc = BgHidanFwbig_WaitForCs; - OnePointCutscene_Init(globalCtx, 3340, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3340, -99, &this->actor, CAM_ID_MAIN); this->timer = 35; } } @@ -178,7 +178,7 @@ void BgHidanFwbig_WaitForPlayer(BgHidanFwbig* this, GlobalContext* globalCtx) { if (player->actor.world.pos.x < 1150.0f) { this->actionFunc = BgHidanFwbig_Rise; - OnePointCutscene_Init(globalCtx, 3290, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3290, -99, &this->actor, CAM_ID_MAIN); } } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c index 9d3bfe5efa..08580febe1 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Hamstep/z_bg_hidan_hamstep.c @@ -278,7 +278,7 @@ void func_80888734(BgHidanHamstep* this) { void func_808887C4(BgHidanHamstep* this, GlobalContext* globalCtx) { if (this->collider.base.acFlags & AC_HIT) { - OnePointCutscene_Init(globalCtx, 3310, 100, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3310, 100, &this->dyna.actor, CAM_ID_MAIN); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_HAMMER_SWITCH); this->collider.base.acFlags = AC_NONE; BgHidanHamstep_SetupAction(this, 1); diff --git a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c index c1573dfc8a..c9337bfc5c 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Rock/z_bg_hidan_rock.c @@ -264,10 +264,10 @@ void func_8088B79C(BgHidanRock* this, GlobalContext* globalCtx) { if (this->unk_169 == 0) { this->unk_169 = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_169 != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } this->unk_169 = 0; } @@ -317,10 +317,10 @@ void func_8088B990(BgHidanRock* this, GlobalContext* globalCtx) { if (this->unk_169 == 0) { this->unk_169 = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_169 != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } this->unk_169 = 0; } diff --git a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c index ce1066696c..a78868497c 100644 --- a/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c +++ b/src/overlays/actors/ovl_Bg_Hidan_Syoku/z_bg_hidan_syoku.c @@ -112,10 +112,10 @@ void BgHidanSyoku_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unk_168 == 0) { this->unk_168 = 3; } - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); } else if (!func_8004356C(&this->dyna)) { if (this->unk_168 != 0) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } this->unk_168 = 0; } diff --git a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c index 5e291d9632..31ae66538a 100644 --- a/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c +++ b/src/overlays/actors/ovl_Bg_Jya_1flift/z_bg_jya_1flift.c @@ -189,9 +189,9 @@ void BgJya1flift_Update(Actor* thisx, GlobalContext* globalCtx2) { tempIsRiding = func_8004356C(&this->dyna) ? true : false; if ((this->actionFunc == BgJya1flift_Move) || (this->actionFunc == BgJya1flift_DelayMove)) { if (tempIsRiding) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FIRE_PLATFORM); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FIRE_PLATFORM); } else if (!tempIsRiding && this->isLinkRiding) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } } this->isLinkRiding = tempIsRiding; diff --git a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c index 02b0584642..caebb2d86d 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c +++ b/src/overlays/actors/ovl_Bg_Jya_Bombchuiwa/z_bg_jya_bombchuiwa.c @@ -143,7 +143,7 @@ void BgJyaBombchuiwa_SetupWaitForExplosion(BgJyaBombchuiwa* this, GlobalContext* void BgJyaBombchuiwa_WaitForExplosion(BgJyaBombchuiwa* this, GlobalContext* globalCtx) { if ((this->collider.base.acFlags & AC_HIT) || (this->timer > 0)) { if (this->timer == 0) { - OnePointCutscene_Init(globalCtx, 3410, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3410, -99, &this->actor, CAM_ID_MAIN); } this->timer++; if (this->timer > 10) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c index 9ff4d099ea..91b490f168 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Kanaami/z_bg_jya_kanaami.c @@ -80,7 +80,7 @@ void func_80899880(BgJyaKanaami* this) { void func_80899894(BgJyaKanaami* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) || this->unk_16A > 0) { if (this->dyna.actor.world.pos.x > -1000.0f && this->unk_16A == 0) { - OnePointCutscene_Init(globalCtx, 3450, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3450, -99, &this->dyna.actor, CAM_ID_MAIN); } this->unk_16A += 1; if (this->unk_16A >= 0xA) { diff --git a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c index d959c3eb98..a850da8bfc 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c +++ b/src/overlays/actors/ovl_Bg_Jya_Lift/z_bg_jya_lift.c @@ -95,7 +95,7 @@ void BgJyaLift_DelayMove(BgJyaLift* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F) || (this->moveDelay > 0)) { this->moveDelay++; if (this->moveDelay >= 20) { - OnePointCutscene_Init(globalCtx, 3430, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3430, -99, &this->dyna.actor, CAM_ID_MAIN); BgJyaLift_SetupMove(this); } } @@ -136,10 +136,10 @@ void BgJyaLift_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc(this, globalCtx); } if ((this->dyna.unk_160 & 4) && ((this->unk_16B & 4) == 0)) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DIRECTED_YAW); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DIRECTED_YAW); } else if (((this->dyna.unk_160 & 4) == 0) && (this->unk_16B & 4) && - (globalCtx->cameraPtrs[MAIN_CAM]->setting == CAM_SET_DIRECTED_YAW)) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + (globalCtx->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_DIRECTED_YAW)) { + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } this->unk_16B = this->dyna.unk_160; diff --git a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c index 07d43203d4..20a7231142 100644 --- a/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c +++ b/src/overlays/actors/ovl_Bg_Jya_Megami/z_bg_jya_megami.c @@ -198,7 +198,7 @@ void BgJyaMegami_DetectLight(BgJyaMegami* this, GlobalContext* globalCtx) { Flags_SetSwitch(globalCtx, this->dyna.actor.params & 0x3F); BgJyaMegami_SetupExplode(this); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->dyna.actor.world.pos, 100, NA_SE_EV_FACE_EXPLOSION); - OnePointCutscene_Init(globalCtx, 3440, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3440, -99, &this->dyna.actor, CAM_ID_MAIN); } else { if (this->lightTimer < 8) { this->crumbleIndex = 0; diff --git a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c index 584bcbbf79..c8c5720fd6 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Shutter/z_bg_mizu_shutter.c @@ -93,7 +93,7 @@ void BgMizuShutter_Destroy(BgMizuShutter* thisx, GlobalContext* globalCtx) { void BgMizuShutter_WaitForSwitch(BgMizuShutter* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { if (ABS(this->dyna.actor.world.rot.x) > 0x2C60) { - OnePointCutscene_Init(globalCtx, 4510, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4510, -99, &this->dyna.actor, CAM_ID_MAIN); } else { OnePointCutscene_Attention(globalCtx, &this->dyna.actor); } diff --git a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c index 86fc609877..05f6b82334 100644 --- a/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c +++ b/src/overlays/actors/ovl_Bg_Mizu_Water/z_bg_mizu_water.c @@ -174,7 +174,7 @@ void BgMizuWater_WaitForAction(BgMizuWater* this, GlobalContext* globalCtx) { waterLevelActionIndex = BgMizuWater_GetWaterLevelActionIndex(this->actor.params, globalCtx); if (waterLevelActionIndex != 0) { if (prevSwitchFlag != sWaterLevels[waterLevelActionIndex].switchFlag) { - OnePointCutscene_Init(globalCtx, 3120, -100 - waterLevelActionIndex, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3120, -100 - waterLevelActionIndex, NULL, CAM_ID_MAIN); this->actor.params = sWaterLevels[waterLevelActionIndex].switchFlag; this->targetY = sWaterLevels[waterLevelActionIndex].yDiff + this->baseY; } diff --git a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c index f51dc4d8b8..7efe0af0ca 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c +++ b/src/overlays/actors/ovl_Bg_Mori_Bigst/z_bg_mori_bigst.c @@ -148,7 +148,7 @@ void BgMoriBigst_StalfosFight(BgMoriBigst* this, GlobalContext* globalCtx) { 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); + OnePointCutscene_Init(globalCtx, 3220, 72, &this->dyna.actor, CAM_ID_MAIN); } } @@ -162,7 +162,7 @@ void BgMoriBigst_Fall(BgMoriBigst* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y = this->dyna.actor.home.pos.y; BgMoriBigst_SetupLanding(this, globalCtx); Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - OnePointCutscene_Init(globalCtx, 1020, 8, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 1020, 8, &this->dyna.actor, CAM_ID_MAIN); func_8002DF38(globalCtx, NULL, 0x3C); } } diff --git a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c index b8f2b3f037..d58a015fb1 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c +++ b/src/overlays/actors/ovl_Bg_Mori_Elevator/z_bg_mori_elevator.c @@ -168,8 +168,8 @@ void BgMoriElevator_MoveIntoGround(BgMoriElevator* this, GlobalContext* globalCt void func_808A1CF4(BgMoriElevator* this, GlobalContext* globalCtx) { this->actionFunc = BgMoriElevator_MoveAboveGround; - OnePointCutscene_Init(globalCtx, 3230, 70, &this->dyna.actor, MAIN_CAM); - OnePointCutscene_Init(globalCtx, 1020, 15, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3230, 70, &this->dyna.actor, CAM_ID_MAIN); + OnePointCutscene_Init(globalCtx, 1020, 15, &this->dyna.actor, CAM_ID_MAIN); } void BgMoriElevator_MoveAboveGround(BgMoriElevator* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c index 0c3fde4028..b33386009e 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hashira4/z_bg_mori_hashira4.c @@ -136,7 +136,7 @@ void BgMoriHashira4_GateWait(BgMoriHashira4* this, GlobalContext* globalCtx) { if (this->gateTimer > 30) { Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_METALDOOR_OPEN); BgMoriHashira4_SetupAction(this, BgMoriHashira4_GateOpen); - OnePointCutscene_Init(globalCtx, 6010, 20, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 6010, 20, &this->dyna.actor, CAM_ID_MAIN); sUnkTimer++; } } diff --git a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c index ddc1b70fb7..fe830c20d8 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c +++ b/src/overlays/actors/ovl_Bg_Mori_Hineri/z_bg_mori_hineri.c @@ -27,7 +27,7 @@ void BgMoriHineri_SpawnBossKeyChest(BgMoriHineri* this, GlobalContext* globalCtx void BgMoriHineri_DoNothing(BgMoriHineri* this, GlobalContext* globalCtx); void func_808A3D58(BgMoriHineri* this, GlobalContext* globalCtx); -static s16 sNextCamIdx = SUBCAM_NONE; +static s16 sSubCamId = CAM_ID_NONE; const ActorInit Bg_Mori_Hineri_InitVars = { ACTOR_BG_MORI_HINERI, @@ -170,14 +170,14 @@ void func_808A3C8C(BgMoriHineri* this, GlobalContext* 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; - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON1); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON1); if (this->dyna.actor.params != 0) { this->dyna.actor.shape.rot.z = -this->dyna.actor.shape.rot.z; } } void func_808A3D58(BgMoriHineri* this, GlobalContext* globalCtx) { - s16 mainCamChildIdx; + s16 mainCamChildId; if ((Flags_GetSwitch(globalCtx, this->switchFlag) && (this->dyna.actor.params == 0 || this->dyna.actor.params == 2)) || @@ -186,34 +186,34 @@ void func_808A3D58(BgMoriHineri* this, GlobalContext* globalCtx) { this->dyna.actor.draw = BgMoriHineri_DrawHallAndRoom; this->actionFunc = func_808A3E54; - mainCamChildIdx = globalCtx->cameraPtrs[MAIN_CAM]->childCamIdx; - if ((mainCamChildIdx != SUBCAM_FREE) && - (globalCtx->cameraPtrs[mainCamChildIdx]->setting == CAM_SET_CS_TWISTED_HALLWAY)) { - OnePointCutscene_EndCutscene(globalCtx, mainCamChildIdx); + mainCamChildId = globalCtx->cameraPtrs[CAM_ID_MAIN]->childCamId; + if ((mainCamChildId != CAM_ID_MAIN) && + (globalCtx->cameraPtrs[mainCamChildId]->setting == CAM_SET_CS_TWISTED_HALLWAY)) { + OnePointCutscene_EndCutscene(globalCtx, mainCamChildId); } - OnePointCutscene_Init(globalCtx, 3260, 40, &this->dyna.actor, MAIN_CAM); - sNextCamIdx = OnePointCutscene_Init(globalCtx, 3261, 40, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3260, 40, &this->dyna.actor, CAM_ID_MAIN); + sSubCamId = OnePointCutscene_Init(globalCtx, 3261, 40, &this->dyna.actor, CAM_ID_MAIN); } } void func_808A3E54(BgMoriHineri* this, GlobalContext* globalCtx) { s8 objBankIndex; - if (globalCtx->activeCamera == sNextCamIdx) { - if (sNextCamIdx != MAIN_CAM) { + if (globalCtx->activeCamId == sSubCamId) { + if (sSubCamId != SUB_CAM_ID_DONE) { objBankIndex = this->dyna.actor.objBankIndex; this->dyna.actor.objBankIndex = this->moriHineriObjIdx; this->moriHineriObjIdx = objBankIndex; this->dyna.actor.params ^= 1; - sNextCamIdx = MAIN_CAM; + sSubCamId = SUB_CAM_ID_DONE; func_80078884(NA_SE_SY_TRE_BOX_APPEAR); } else { this->dyna.actor.draw = NULL; this->actionFunc = func_808A3D58; - sNextCamIdx = SUBCAM_NONE; + sSubCamId = CAM_ID_NONE; } } - if ((sNextCamIdx >= SUBCAM_FIRST) && + if ((sSubCamId >= CAM_ID_SUB_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); } diff --git a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c index 018e91e3a0..49a6abfc7e 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c +++ b/src/overlays/actors/ovl_Bg_Mori_Idomizu/z_bg_mori_idomizu.c @@ -119,10 +119,10 @@ void BgMoriIdomizu_Main(BgMoriIdomizu* this, GlobalContext* globalCtx) { this->targetWaterLevel = 184.0f; } if (switchFlagSet && !this->prevSwitchFlagSet) { - OnePointCutscene_Init(globalCtx, 3240, 70, thisx, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3240, 70, thisx, CAM_ID_MAIN); this->drainTimer = 90; } else if (!switchFlagSet && this->prevSwitchFlagSet) { - OnePointCutscene_Init(globalCtx, 3240, 70, thisx, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3240, 70, thisx, CAM_ID_MAIN); this->drainTimer = 90; thisx->world.pos.y = 0.0f; } diff --git a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c index 4600d57f3d..3814fe9ae8 100644 --- a/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c +++ b/src/overlays/actors/ovl_Bg_Mori_Rakkatenjo/z_bg_mori_rakkatenjo.c @@ -25,7 +25,7 @@ void BgMoriRakkatenjo_Rest(BgMoriRakkatenjo* this, GlobalContext* globalCtx); void BgMoriRakkatenjo_SetupRise(BgMoriRakkatenjo* this); void BgMoriRakkatenjo_Rise(BgMoriRakkatenjo* this, GlobalContext* globalCtx); -static s16 sCamSetting = 0; +static s16 sCamSetting = CAM_SET_NONE; const ActorInit Bg_Mori_Rakkatenjo_InitVars = { ACTOR_BG_MORI_RAKKATENJO, @@ -74,7 +74,7 @@ void BgMoriRakkatenjo_Init(Actor* thisx, GlobalContext* globalCtx) { CollisionHeader_GetVirtual(&gMoriRakkatenjoCol, &colHeader); this->dyna.bgId = DynaPoly_SetBgActor(globalCtx, &globalCtx->colCtx.dyna, &this->dyna.actor, colHeader); BgMoriRakkatenjo_SetupWaitForMoriTex(this); - sCamSetting = 0; + sCamSetting = CAM_SET_NONE; } void BgMoriRakkatenjo_Destroy(Actor* thisx, GlobalContext* globalCtx) { @@ -206,14 +206,14 @@ void BgMoriRakkatenjo_Update(Actor* thisx, GlobalContext* globalCtx) { if (BgMoriRakkatenjo_IsLinkUnder(this, globalCtx)) { if (sCamSetting == CAM_SET_NONE) { osSyncPrintf("camera changed (mori rakka tenjyo) ... \n"); - sCamSetting = globalCtx->cameraPtrs[MAIN_CAM]->setting; - Camera_SetCameraData(globalCtx->cameraPtrs[MAIN_CAM], 1, &this->dyna.actor, NULL, 0, 0, 0); - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_FOREST_BIRDS_EYE); + sCamSetting = globalCtx->cameraPtrs[CAM_ID_MAIN]->setting; + Camera_SetCameraData(globalCtx->cameraPtrs[CAM_ID_MAIN], 1, &this->dyna.actor, NULL, 0, 0, 0); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_FOREST_BIRDS_EYE); } } else if (sCamSetting != CAM_SET_NONE) { osSyncPrintf("camera changed (previous) ... \n"); - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON1); - sCamSetting = 0; + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON1); + sCamSetting = CAM_SET_NONE; } } diff --git a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c index db2dd57771..21f80b33f8 100644 --- a/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c +++ b/src/overlays/actors/ovl_Bg_Po_Event/z_bg_po_event.c @@ -236,7 +236,7 @@ void BgPoEvent_BlockWait(BgPoEvent* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y = 833.0f; if (sPuzzleState == 0x3F) { if (this->type == 1) { - OnePointCutscene_Init(globalCtx, 3150, 65, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3150, 65, NULL, CAM_ID_MAIN); } this->timer = 45; this->actionFunc = BgPoEvent_BlockShake; @@ -340,7 +340,7 @@ void BgPoEvent_BlockIdle(BgPoEvent* this, GlobalContext* globalCtx) { this->dyna.actor.world.pos.y - 30.0f, this->dyna.actor.world.pos.z + 30.0f, 0, this->dyna.actor.shape.rot.y, 0, this->dyna.actor.params + 0x300); if (amy != NULL) { - OnePointCutscene_Init(globalCtx, 3170, 30, amy, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3170, 30, amy, CAM_ID_MAIN); } func_80078884(NA_SE_SY_CORRECT_CHIME); gSaveContext.timer1State = 0xA; @@ -536,12 +536,12 @@ void BgPoEvent_PaintingPresent(BgPoEvent* this, GlobalContext* globalCtx) { Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_EN_PO_SISTERS, thisx->world.pos.x, thisx->world.pos.y - 40.0f, thisx->world.pos.z, 0, thisx->shape.rot.y, 0, thisx->params + ((this->type - 1) << 8)); - OnePointCutscene_Init(globalCtx, 3160, 80, thisx, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3160, 80, thisx, CAM_ID_MAIN); func_80078884(NA_SE_SY_CORRECT_CHIME); } else { Audio_PlayActorSound2(thisx, NA_SE_EN_PO_LAUGH2); - OnePointCutscene_Init(globalCtx, 3160, 35, thisx, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3160, 35, thisx, CAM_ID_MAIN); } if (thisx->parent != NULL) { thisx->parent->child = NULL; diff --git a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c index 9897102f02..ffa5c4b1ab 100644 --- a/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c +++ b/src/overlays/actors/ovl_Bg_Spot03_Taki/z_bg_spot03_taki.c @@ -70,7 +70,7 @@ void func_808ADEF0(BgSpot03Taki* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, this->switchFlag)) { this->state = WATERFALL_OPENING_ANIMATED; this->timer = 40; - OnePointCutscene_Init(globalCtx, 4100, -99, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4100, -99, NULL, CAM_ID_MAIN); } } else if (this->state == WATERFALL_OPENING_IDLE) { this->timer--; diff --git a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c index cc9a589949..fee1894720 100644 --- a/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c +++ b/src/overlays/actors/ovl_Bg_Spot06_Objects/z_bg_spot06_objects.c @@ -315,7 +315,7 @@ void BgSpot06Objects_LockWait(BgSpot06Objects* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_SY_CORRECT_CHIME, &gSfxDefaultPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); Flags_SetSwitch(globalCtx, this->switchFlag); - OnePointCutscene_Init(globalCtx, 4120, 170, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4120, 170, &this->dyna.actor, CAM_ID_MAIN); } else { CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c index 6e34a57961..c903125849 100644 --- a/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c +++ b/src/overlays/actors/ovl_Bg_Spot11_Oasis/z_bg_spot11_oasis.c @@ -95,7 +95,7 @@ void func_808B2970(BgSpot11Oasis* this) { void func_808B2980(BgSpot11Oasis* this, GlobalContext* globalCtx) { if (Flags_GetEnv(globalCtx, 5) && func_808B280C(globalCtx)) { - OnePointCutscene_Init(globalCtx, 4150, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4150, -99, &this->actor, CAM_ID_MAIN); func_808B29E0(this); } } diff --git a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c index 691686bdad..1aa6128c0c 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Gate/z_bg_spot12_gate.c @@ -83,7 +83,7 @@ void func_808B30C0(BgSpot12Gate* this) { void func_808B30D8(BgSpot12Gate* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { func_808B3134(this); - OnePointCutscene_Init(globalCtx, 4160, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4160, -99, &this->dyna.actor, CAM_ID_MAIN); } } diff --git a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c index e0eb4bafbe..5d1f79087c 100644 --- a/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c +++ b/src/overlays/actors/ovl_Bg_Spot12_Saku/z_bg_spot12_saku.c @@ -83,7 +83,7 @@ void func_808B357C(BgSpot12Saku* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, this->dyna.actor.params & 0x3F)) { func_808B35E4(this); this->timer = 20; - OnePointCutscene_Init(globalCtx, 4170, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4170, -99, &this->dyna.actor, CAM_ID_MAIN); } } diff --git a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c index 359ad09d92..01bd967f67 100644 --- a/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c +++ b/src/overlays/actors/ovl_Bg_Spot16_Bombstone/z_bg_spot16_bombstone.c @@ -410,7 +410,7 @@ void func_808B57E0(BgSpot16Bombstone* this, GlobalContext* globalCtx) { currentBomb = sPlayerBomb; if (currentBomb->timer > 0) { sTimer = currentBomb->timer + 20; - OnePointCutscene_Init(globalCtx, 4180, sTimer, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4180, sTimer, NULL, CAM_ID_MAIN); } } } else if (player->stateFlags1 & PLAYER_STATE1_11) { @@ -440,7 +440,7 @@ void func_808B5950(BgSpot16Bombstone* this, GlobalContext* globalCtx) { func_808B561C(this, globalCtx); - OnePointCutscene_Init(globalCtx, 4180, 50, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4180, 50, NULL, CAM_ID_MAIN); Flags_SetSwitch(globalCtx, this->switchFlag); SET_EVENTCHKINF(EVENTCHKINF_23); diff --git a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c index 5bbc4de5f5..f14ab0dd16 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Basket/z_bg_spot18_basket.c @@ -176,7 +176,7 @@ void func_808B7AEC(BgSpot18Basket* this) { void func_808B7AFC(BgSpot18Basket* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, (this->dyna.actor.params >> 8) & 0x3F)) { - OnePointCutscene_Init(globalCtx, 4220, 80, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4220, 80, &this->dyna.actor, CAM_ID_MAIN); func_808B7B58(this); } } @@ -224,7 +224,7 @@ void func_808B7BCC(BgSpot18Basket* this, GlobalContext* globalCtx) { if (positionDiff > 120.0f && positionDiff < 200.0f) { if (Math3D_Dist2DSq(colliderBaseAc->world.pos.z, this->colliderJntSph.base.ac->world.pos.x, this->dyna.actor.world.pos.z, this->dyna.actor.world.pos.x) < SQ(32.0f)) { - OnePointCutscene_Init(globalCtx, 4210, 240, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4210, 240, &this->dyna.actor, CAM_ID_MAIN); func_808B7D38(this); func_8003EBF8(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); } diff --git a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c index d6a5a1a718..a72472e8e3 100644 --- a/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c +++ b/src/overlays/actors/ovl_Bg_Spot18_Shutter/z_bg_spot18_shutter.c @@ -99,7 +99,7 @@ void func_808B9618(BgSpot18Shutter* this, GlobalContext* globalCtx) { this->actionFunc = func_808B9698; } else { this->actionFunc = func_808B971C; - OnePointCutscene_Init(globalCtx, 4221, 140, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4221, 140, &this->dyna.actor, CAM_ID_MAIN); } } } diff --git a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c index 0d68235ed0..a23499eba6 100644 --- a/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c +++ b/src/overlays/actors/ovl_Bg_Sst_Floor/z_bg_sst_floor.c @@ -61,9 +61,9 @@ void BgSstFloor_Update(BgSstFloor* thisx, GlobalContext* globalCtx) { if (1) {} if (func_80043590(&this->dyna) && (this->dyna.actor.yDistToPlayer < 1000.0f)) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BOSS_BONGO); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BOSS_BONGO); } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); } if (func_8004356C(&this->dyna) && (player->fallDistance > 1000.0f)) { diff --git a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c index 5d8b25f8f3..7001ec6357 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Hasi/z_bg_ydan_hasi.c @@ -139,7 +139,7 @@ void BgYdanHasi_SetupThreeBlocks(BgYdanHasi* this, GlobalContext* globalCtx) { this->timer = 260; this->dyna.actor.draw = BgYdanHasi_Draw; this->actionFunc = BgYdanHasi_UpdateThreeBlocks; - OnePointCutscene_Init(globalCtx, 3040, 30, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3040, 30, &this->dyna.actor, CAM_ID_MAIN); } } diff --git a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c index 4fc67c2996..c81a3486e0 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Maruta/z_bg_ydan_maruta.c @@ -150,7 +150,7 @@ void func_808BF078(BgYdanMaruta* this, GlobalContext* globalCtx) { Flags_SetSwitch(globalCtx, this->switchFlag); func_80078884(NA_SE_SY_CORRECT_CHIME); this->actionFunc = func_808BF108; - OnePointCutscene_Init(globalCtx, 3010, 50, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3010, 50, &this->dyna.actor, CAM_ID_MAIN); } else { CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->collider.base); } diff --git a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c index 42dcad128a..d95e0167c2 100644 --- a/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c +++ b/src/overlays/actors/ovl_Bg_Ydan_Sp/z_bg_ydan_sp.c @@ -402,7 +402,7 @@ void BgYdanSp_WallWebIdle(BgYdanSp* this, GlobalContext* globalCtx) { } else if (player->heldItemActionParam == PLAYER_AP_STICK && player->unk_860 != 0) { func_8002DBD0(&this->dyna.actor, &sp30, &player->meleeWeaponInfo[0].tip); if (fabsf(sp30.x) < 100.0f && sp30.z < 1.0f && sp30.y < 200.0f) { - OnePointCutscene_Init(globalCtx, 3020, 40, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3020, 40, &this->dyna.actor, CAM_ID_MAIN); Math_Vec3f_Copy(&this->dyna.actor.home.pos, &player->meleeWeaponInfo[0].tip); BgYdanSp_BurnWeb(this, globalCtx); } diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c index d8468b9566..e6981e59e0 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.c @@ -238,14 +238,13 @@ void BossDodongo_SetupIntroCutscene(BossDodongo* this, GlobalContext* globalCtx) void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { f32 phi_f0; - Camera* camera; - Player* player; - Vec3f sp60; - Vec3f sp54; - Vec3f sp48; + Camera* mainCam; + Player* player = GET_PLAYER(globalCtx); + Vec3f subCamEye; + Vec3f subCamAt; + Vec3f subCamUp; - player = GET_PLAYER(globalCtx); - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); if (this->unk_196 != 0) { this->unk_196--; @@ -272,14 +271,14 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 1); Gameplay_ClearAllSubCameras(globalCtx); - this->cutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, 1); - Gameplay_ChangeCameraStatus(globalCtx, this->cutsceneCamera, 7); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->csState = 2; this->unk_196 = 0x3C; this->unk_198 = 160; player->actor.world.pos.y = -1023.76f; - this->cameraEye.y = player->actor.world.pos.y - 480.0f + 50.0f; + this->subCamEye.y = player->actor.world.pos.y - 480.0f + 50.0f; case 2: if (this->unk_198 >= 131) { player->actor.world.pos.x = -890.0f; @@ -288,12 +287,12 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { player->actor.speedXZ = 0.0f; player->actor.shape.rot.y = player->actor.world.rot.y = 0x3FFF; - this->cameraEye.x = -890.0f; - this->cameraEye.z = player->actor.world.pos.z - 100.0f; + this->subCamEye.x = -890.0f; + this->subCamEye.z = player->actor.world.pos.z - 100.0f; - this->cameraAt.x = player->actor.world.pos.x; - this->cameraAt.y = player->actor.world.pos.y + 20.0f; - this->cameraAt.z = player->actor.world.pos.z; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = player->actor.world.pos.y + 20.0f; + this->subCamAt.z = player->actor.world.pos.z; } if (this->unk_198 == 110) { @@ -323,14 +322,14 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { } if (this->unk_196 == 0) { - Math_SmoothStepToF(&this->cameraEye.x, this->vec.x + 30.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.y, this->vec.y, 0.2f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.z, this->vec.z + 10.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.x, this->vec.x + 30.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.y, this->vec.y, 0.2f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.z, this->vec.z + 10.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); Math_SmoothStepToF(&this->unk_204, 1.0f, 1.0f, 0.02f, 0.0f); } else { - this->cameraAt.x = player->actor.world.pos.x; - this->cameraAt.y = player->actor.world.pos.y + 20.0f; - this->cameraAt.z = player->actor.world.pos.z; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = player->actor.world.pos.y + 20.0f; + this->subCamAt.z = player->actor.world.pos.z; } if (GET_EVENTCHKINF(EVENTCHKINF_71)) { @@ -357,10 +356,10 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { case 3: BossDodongo_Walk(this, globalCtx); Math_SmoothStepToF(&this->unk_20C, sinf(this->unk_19E * 0.05f) * 0.1f, 1.0f, 0.01f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.x, this->vec.x + 90.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.y, this->vec.y + 50.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.z, this->vec.z, 0.2f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraAt.y, this->vec.y - 10.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.x, this->vec.x + 90.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.y, this->vec.y + 50.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.z, this->vec.z, 0.2f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.y, this->vec.y - 10.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); Math_SmoothStepToF(&this->unk_204, 1.0f, 1.0f, 0.02f, 0.0f); if (fabsf(player->actor.world.pos.x - this->actor.world.pos.x) < 200.0f) { this->csState = 4; @@ -380,16 +379,16 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { phi_f0 = 0.0f; } - Math_SmoothStepToF(&this->cameraEye.x, player->actor.world.pos.x + phi_f0 + 70.0f, 0.2f, + Math_SmoothStepToF(&this->subCamEye.x, player->actor.world.pos.x + phi_f0 + 70.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.y, player->actor.world.pos.y + 10.0f, 0.2f, this->unk_204 * 20.0f, + Math_SmoothStepToF(&this->subCamEye.y, player->actor.world.pos.y + 10.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.z, player->actor.world.pos.z - 60.0f, 0.2f, this->unk_204 * 20.0f, + Math_SmoothStepToF(&this->subCamEye.z, player->actor.world.pos.z - 60.0f, 0.2f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraAt.x, this->vec.x, 0.2f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraAt.y, this->vec.y, 0.2f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraAt.z, this->vec.z, 0.2f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.x, this->vec.x, 0.2f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.y, this->vec.y, 0.2f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.z, this->vec.z, 0.2f, this->unk_204 * 20.0f, 0.0f); Math_SmoothStepToF(&this->unk_204, 1.0f, 1.0f, 0.02f, 0.0f); if (this->unk_196 == 0) { @@ -411,11 +410,11 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { } if (this->unk_198 == 0) { - camera->eye = this->cameraEye; - camera->eyeNext = this->cameraEye; - camera->at = this->cameraAt; - func_800C08AC(globalCtx, this->cutsceneCamera, 0); - this->cutsceneCamera = 0; + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); BossDodongo_SetupWalk(this); @@ -427,26 +426,26 @@ void BossDodongo_IntroCutscene(BossDodongo* this, GlobalContext* globalCtx) { break; } - if (this->cutsceneCamera != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { if (this->unk_1B6 != 0) { this->unk_1B6--; } - sp60.x = this->cameraEye.x; + subCamEye.x = this->subCamEye.x; phi_f0 = sinf((this->unk_1B6 * 3.1415f * 90.0f) / 180.0f); - sp60.y = (this->unk_1B6 * phi_f0 * 0.7f) + this->cameraEye.y; - sp60.z = this->cameraEye.z; + subCamEye.y = (this->unk_1B6 * phi_f0 * 0.7f) + this->subCamEye.y; + subCamEye.z = this->subCamEye.z; - sp54.x = this->cameraAt.x; + subCamAt.x = this->subCamAt.x; phi_f0 = sinf((this->unk_1B6 * 3.1415f * 90.0f) / 180.0f); - sp54.y = (this->unk_1B6 * phi_f0 * 0.7f) + this->cameraAt.y; - sp54.z = this->cameraAt.z; + subCamAt.y = (this->unk_1B6 * phi_f0 * 0.7f) + this->subCamAt.y; + subCamAt.z = this->subCamAt.z; - sp48.x = this->unk_20C; - sp48.y = 1.0f; - sp48.z = this->unk_20C; + subCamUp.x = this->unk_20C; + subCamUp.y = 1.0f; + subCamUp.z = this->unk_20C; - Gameplay_CameraSetAtEyeUp(globalCtx, this->cutsceneCamera, &sp54, &sp60, &sp48); + Gameplay_CameraSetAtEyeUp(globalCtx, this->subCamId, &subCamAt, &subCamEye, &subCamUp); } } @@ -676,7 +675,7 @@ void BossDodongo_Walk(BossDodongo* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_DODO_K_WALK); } - if (this->cutsceneCamera == 0) { + if (this->subCamId == SUB_CAM_ID_DONE) { func_80033E88(&this->actor, globalCtx, 4, 10); } else { this->unk_1B6 = 10; @@ -1295,7 +1294,7 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { f32 sp178; s16 i; Vec3f effectPos; - Camera* camera; + Camera* mainCam; Player* player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); @@ -1305,16 +1304,16 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { this->csState = 5; func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 1); - this->cutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_UNK3); - Gameplay_ChangeCameraStatus(globalCtx, this->cutsceneCamera, CAM_STAT_ACTIVE); - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); - this->cameraEye.x = camera->eye.x; - this->cameraEye.y = camera->eye.y; - this->cameraEye.z = camera->eye.z; - this->cameraAt.x = camera->at.x; - this->cameraAt.y = camera->at.y; - this->cameraAt.z = camera->at.z; + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + this->subCamEye.x = mainCam->eye.x; + this->subCamEye.y = mainCam->eye.y; + this->subCamEye.z = mainCam->eye.z; + this->subCamAt.x = mainCam->at.x; + this->subCamAt.y = mainCam->at.y; + this->subCamAt.z = mainCam->at.z; break; case 5: tempSin = Math_SinS(this->actor.shape.rot.y - 0x1388) * 150.0f; @@ -1324,12 +1323,12 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->unk_208, 0.07f, 1.0f, 0.005f, 0.0f); tempSin = Math_SinS(this->actor.world.rot.y) * 230.0f; tempCos = Math_CosS(this->actor.world.rot.y) * 230.0f; - Math_SmoothStepToF(&this->cameraEye.x, this->actor.world.pos.x + tempSin, 0.2f, 50.0f, 0.1f); - Math_SmoothStepToF(&this->cameraEye.y, this->actor.world.pos.y + 20.0f, 0.2f, 50.0f, 0.1f); - Math_SmoothStepToF(&this->cameraEye.z, this->actor.world.pos.z + tempCos, 0.2f, 50.0f, 0.1f); - Math_SmoothStepToF(&this->cameraAt.x, this->actor.world.pos.x, 0.2f, 30.0f, 0.1f); - Math_SmoothStepToF(&this->cameraAt.y, this->actor.focus.pos.y - 70.0f, 0.2f, 30.0f, 0.1f); - Math_SmoothStepToF(&this->cameraAt.z, this->actor.world.pos.z, 0.2f, 30.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.x, this->actor.world.pos.x + tempSin, 0.2f, 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.y, this->actor.world.pos.y + 20.0f, 0.2f, 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.z, this->actor.world.pos.z + tempCos, 0.2f, 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.x, this->actor.world.pos.x, 0.2f, 30.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.y, this->actor.focus.pos.y - 70.0f, 0.2f, 30.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.z, this->actor.world.pos.z, 0.2f, 30.0f, 0.1f); if (Animation_OnFrame(&this->skelAnime, Animation_GetLastFrame(&object_kingdodongo_Anim_002D0C))) { Animation_Change(&this->skelAnime, &object_kingdodongo_Anim_003CF8, 1.0f, 0.0f, Animation_GetLastFrame(&object_kingdodongo_Anim_003CF8), ANIMMODE_ONCE, -1.0f); @@ -1339,9 +1338,9 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { } break; case 6: - Math_SmoothStepToF(&this->cameraAt.x, this->actor.world.pos.x, 0.2f, 30.0f, 0.1f); - Math_SmoothStepToF(&this->cameraAt.y, (this->actor.world.pos.y - 70.0f) + 130.0f, 0.2f, 20.0f, 0.1f); - Math_SmoothStepToF(&this->cameraAt.z, this->actor.world.pos.z, 0.2f, 30.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.x, this->actor.world.pos.x, 0.2f, 30.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.y, (this->actor.world.pos.y - 70.0f) + 130.0f, 0.2f, 20.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.z, this->actor.world.pos.z, 0.2f, 30.0f, 0.1f); if (Animation_OnFrame(&this->skelAnime, Animation_GetLastFrame(&object_kingdodongo_Anim_003CF8))) { Animation_Change(&this->skelAnime, &object_kingdodongo_Anim_00DF38, 1.0f, 30.0f, 59.0f, ANIMMODE_ONCE, @@ -1356,11 +1355,11 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { break; case 7: this->unk_1C4 += 0x7D0; - Math_SmoothStepToF(&this->cameraAt.x, this->actor.world.pos.x, 0.2f, 30.0f, 0.0f); - Math_SmoothStepToF(&this->cameraAt.y, (this->actor.world.pos.y - 70.0f) + 130.0f, 0.2f, 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraAt.z, this->actor.world.pos.z, 0.2f, 30.0f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.x, -890.0f, 0.1f, this->unk_204 * 5.0f, 0.1f); - Math_SmoothStepToF(&this->cameraEye.z, -3304.0f, 0.1f, this->unk_204 * 5.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.x, this->actor.world.pos.x, 0.2f, 30.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.y, (this->actor.world.pos.y - 70.0f) + 130.0f, 0.2f, 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.z, this->actor.world.pos.z, 0.2f, 30.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.x, -890.0f, 0.1f, this->unk_204 * 5.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.z, -3304.0f, 0.1f, this->unk_204 * 5.0f, 0.1f); Math_SmoothStepToF(&this->unk_204, 1.0f, 1.0f, 0.1f, 0.0f); if (this->unk_1DA == 1) { this->csState = 8; @@ -1436,8 +1435,8 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { if (this->unk_1DA == 884) { Animation_Change(&this->skelAnime, &object_kingdodongo_Anim_0042A8, 1.0f, 0.0f, (f32)Animation_GetLastFrame(&object_kingdodongo_Anim_0042A8), ANIMMODE_LOOP, -20.0f); - tempSin = this->cameraEye.x - this->actor.world.pos.x; - tempCos = this->cameraEye.z - this->actor.world.pos.z; + tempSin = this->subCamEye.x - this->actor.world.pos.x; + tempCos = this->subCamEye.z - this->actor.world.pos.z; this->unk_22C = sqrtf(SQ(tempSin) + SQ(tempCos)); this->unk_230 = Math_FAtan2F(tempSin, tempCos); this->unk_1DC = 350; @@ -1542,9 +1541,9 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->unk_238, 0.0f, 0.05f, 40.0f, 0.0f); } Math_SmoothStepToF(&this->unk_234, 0.0f, 0.2f, 17.0f, 0.0f); - Math_SmoothStepToF(&this->cameraAt.x, this->actor.world.pos.x, 0.2f, 30.0f, 0.0f); - Math_SmoothStepToF(&this->cameraAt.y, (this->actor.world.pos.y - 70.0f) + 130.0f, 0.2f, 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraAt.z, this->actor.world.pos.z, 0.2f, 30.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.x, this->actor.world.pos.x, 0.2f, 30.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.y, (this->actor.world.pos.y - 70.0f) + 130.0f, 0.2f, 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.z, this->actor.world.pos.z, 0.2f, 30.0f, 0.0f); if (this->csState == 9) { if (this->unk_1DA < 0x2C6) { Vec3f spAC[] = { { -390.0f, 0.0f, -3304.0f }, @@ -1565,10 +1564,10 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { sp78 = &sp7C[this->unk_1A0]; } - Math_SmoothStepToF(&this->cameraEye.x, sp78->x, 0.2f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.y, player->actor.world.pos.y + 30.0f, 0.1f, + Math_SmoothStepToF(&this->subCamEye.x, sp78->x, 0.2f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.y, player->actor.world.pos.y + 30.0f, 0.1f, this->unk_204 * 20.0f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.z, sp78->z, 0.1f, this->unk_204 * 20.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.z, sp78->z, 0.1f, this->unk_204 * 20.0f, 0.0f); Math_SmoothStepToF(&this->unk_204, 1.0f, 1.0f, 0.02f, 0.0f); } else { if (this->unk_1A2 == 0) { @@ -1579,9 +1578,9 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->unk_22C, 220.0f, 0.1f, 5.0f, 0.1f); tempSin = sinf(this->unk_230) * (*this).unk_22C; tempCos = cosf(this->unk_230) * (*this).unk_22C; - Math_SmoothStepToF(&this->cameraEye.x, this->actor.world.pos.x + tempSin, 0.2f, 50.0f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.y, this->actor.world.pos.y + 20.0f, 0.2f, 50.0f, 0.0f); - Math_SmoothStepToF(&this->cameraEye.z, this->actor.world.pos.z + tempCos, 0.2f, 50.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.x, this->actor.world.pos.x + tempSin, 0.2f, 50.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.y, this->actor.world.pos.y + 20.0f, 0.2f, 50.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEye.z, this->actor.world.pos.z + tempCos, 0.2f, 50.0f, 0.0f); Math_SmoothStepToF(&this->unk_23C, 0.0f, 0.2f, 0.01f, 0.0f); } } else { @@ -1592,8 +1591,8 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { Math_SmoothStepToF(&this->unk_23C, 0.5f, 0.2f, 0.05f, 0.0f); } - Math_SmoothStepToF(&this->cameraEye.x, -890.0f, 0.1f, this->unk_204 * 5.0f, 0.1f); - Math_SmoothStepToF(&this->cameraEye.z, -3304.0f, 0.1f, this->unk_204 * 5.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.x, -890.0f, 0.1f, this->unk_204 * 5.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.z, -3304.0f, 0.1f, this->unk_204 * 5.0f, 0.1f); Math_SmoothStepToF(&this->unk_204, 1.0f, 1.0f, 0.05f, 0.0f); } @@ -1605,15 +1604,15 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { Math_CosS(this->actor.shape.rot.y) * -50.0f + this->actor.world.pos.z, 0, 0, 0, 0); } if (this->unk_1DA == 600) { - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); - camera->eye = this->cameraEye; - camera->eyeNext = this->cameraEye; - camera->at = this->cameraAt; - func_800C08AC(globalCtx, this->cutsceneCamera, 0); + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); this->unk_1BC = 0; - this->cutsceneCamera = MAIN_CAM; + this->subCamId = SUB_CAM_ID_DONE; this->csState = 100; - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, -890.0f, -1523.76f, @@ -1635,8 +1634,8 @@ void BossDodongo_DeathCutscene(BossDodongo* this, GlobalContext* globalCtx) { } break; } - if (this->cutsceneCamera != MAIN_CAM) { - Gameplay_CameraSetAtEye(globalCtx, this->cutsceneCamera, &this->cameraAt, &this->cameraEye); + if (this->subCamId != SUB_CAM_ID_DONE) { + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } } diff --git a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h index 55d6075b71..c2d68d738e 100644 --- a/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h +++ b/src/overlays/actors/ovl_Boss_Dodongo/z_boss_dodongo.h @@ -41,7 +41,7 @@ typedef struct BossDodongo { /* 0x01AE */ s16 unk_1AE; /* 0x01B0 */ s16 unk_1B0; /* 0x01B2 */ char unk_1B2[0x2]; - /* 0x01B4 */ s16 cutsceneCamera; + /* 0x01B4 */ s16 subCamId; /* 0x01B6 */ s16 unk_1B6; /* 0x01B8 */ s16 playerYawInRange; /* 0x01BA */ s16 playerPosInRange; @@ -93,8 +93,8 @@ typedef struct BossDodongo { /* 0x0404 */ Vec3f unk_404; /* 0x0410 */ Vec3f unk_410; /* 0x041C */ Vec3f mouthPos; - /* 0x0428 */ Vec3f cameraEye; - /* 0x0434 */ Vec3f cameraAt; + /* 0x0428 */ Vec3f subCamEye; + /* 0x0434 */ Vec3f subCamAt; /* 0x0440 */ ColliderJntSph collider; /* 0x0460 */ ColliderJntSphElement items[19]; /* 0x0920 */ BossDodongoEffect effects[BOSS_DODONGO_EFFECT_COUNT]; diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c index 128efa968a..c1eba01bf8 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.c @@ -140,33 +140,33 @@ void BossFd_SpawnFireBreath(BossFdEffect* effect, Vec3f* position, Vec3f* veloci } } -void BossFd_SetCameraSpeed(BossFd* this, f32 speedMod) { - this->camData.eyeVel.x = fabsf(this->camData.eye.x - this->camData.nextEye.x) * speedMod; - this->camData.eyeVel.y = fabsf(this->camData.eye.y - this->camData.nextEye.y) * speedMod; - this->camData.eyeVel.z = fabsf(this->camData.eye.z - this->camData.nextEye.z) * speedMod; - this->camData.atVel.x = fabsf(this->camData.at.x - this->camData.nextAt.x) * speedMod; - this->camData.atVel.y = fabsf(this->camData.at.y - this->camData.nextAt.y) * speedMod; - this->camData.atVel.z = fabsf(this->camData.at.z - this->camData.nextAt.z) * speedMod; +void BossFd_SetCameraSpeed(BossFd* this, f32 velFactor) { + this->subCamEyeVel.x = fabsf(this->subCamEye.x - this->subCamEyeNext.x) * velFactor; + this->subCamEyeVel.y = fabsf(this->subCamEye.y - this->subCamEyeNext.y) * velFactor; + this->subCamEyeVel.z = fabsf(this->subCamEye.z - this->subCamEyeNext.z) * velFactor; + this->subCamAtVel.x = fabsf(this->subCamAt.x - this->subCamAtNext.x) * velFactor; + this->subCamAtVel.y = fabsf(this->subCamAt.y - this->subCamAtNext.y) * velFactor; + this->subCamAtVel.z = fabsf(this->subCamAt.z - this->subCamAtNext.z) * velFactor; } void BossFd_UpdateCamera(BossFd* this, GlobalContext* globalCtx) { - if (this->introCamera != SUBCAM_FREE) { - Math_ApproachF(&this->camData.eye.x, this->camData.nextEye.x, this->camData.eyeMaxVel.x, - this->camData.eyeVel.x * this->camData.speedMod); - Math_ApproachF(&this->camData.eye.y, this->camData.nextEye.y, this->camData.eyeMaxVel.y, - this->camData.eyeVel.y * this->camData.speedMod); - Math_ApproachF(&this->camData.eye.z, this->camData.nextEye.z, this->camData.eyeMaxVel.z, - this->camData.eyeVel.z * this->camData.speedMod); - Math_ApproachF(&this->camData.at.x, this->camData.nextAt.x, this->camData.atMaxVel.x, - this->camData.atVel.x * this->camData.speedMod); - Math_ApproachF(&this->camData.at.y, this->camData.nextAt.y, this->camData.atMaxVel.y, - this->camData.atVel.y * this->camData.speedMod); - Math_ApproachF(&this->camData.at.z, this->camData.nextAt.z, this->camData.atMaxVel.z, - this->camData.atVel.z * this->camData.speedMod); - Math_ApproachF(&this->camData.speedMod, 1.0f, 1.0f, this->camData.accel); - this->camData.at.y += this->camData.yMod; - Gameplay_CameraSetAtEye(globalCtx, this->introCamera, &this->camData.at, &this->camData.eye); - Math_ApproachZeroF(&this->camData.yMod, 1.0f, 0.1f); + if (this->subCamId != SUB_CAM_ID_DONE) { + Math_ApproachF(&this->subCamEye.x, this->subCamEyeNext.x, this->subCamEyeMaxVelFrac.x, + this->subCamEyeVel.x * this->subCamVelFactor); + Math_ApproachF(&this->subCamEye.y, this->subCamEyeNext.y, this->subCamEyeMaxVelFrac.y, + this->subCamEyeVel.y * this->subCamVelFactor); + Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, this->subCamEyeMaxVelFrac.z, + this->subCamEyeVel.z * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, this->subCamAtMaxVelFrac.x, + this->subCamAtVel.x * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, this->subCamAtMaxVelFrac.y, + this->subCamAtVel.y * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, this->subCamAtMaxVelFrac.z, + this->subCamAtVel.z * this->subCamVelFactor); + Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, this->subCamAccel); + this->subCamAt.y += this->subCamAtYOffset; + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Math_ApproachZeroF(&this->subCamAtYOffset, 1.0f, 0.1f); } } @@ -300,7 +300,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { if (this->introState != BFD_CS_NONE) { Player* player2 = GET_PLAYER(globalCtx); - Camera* mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); switch (this->introState) { case BFD_CS_WAIT: @@ -316,44 +316,44 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { this->introState = BFD_CS_START; func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 8); - this->introCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->introCamera, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); player2->actor.world.pos.x = 380.0f; player2->actor.world.pos.y = 100.0f; player2->actor.world.pos.z = 0.0f; player2->actor.shape.rot.y = player2->actor.world.rot.y = -0x4000; player2->actor.speedXZ = 0.0f; - this->camData.eye.x = player2->actor.world.pos.x - 70.0f; - this->camData.eye.y = player2->actor.world.pos.y + 40.0f; - this->camData.eye.z = player2->actor.world.pos.z + 70.0f; - this->camData.at.x = player2->actor.world.pos.x; - this->camData.at.y = player2->actor.world.pos.y + 30.0f; - this->camData.at.z = player2->actor.world.pos.z; - this->camData.nextEye.x = player2->actor.world.pos.x - 50.0f + 18.0f; - this->camData.nextEye.y = player2->actor.world.pos.y + 40; - this->camData.nextEye.z = player2->actor.world.pos.z + 50.0f - 18.0f; - this->camData.nextAt.x = player2->actor.world.pos.x; - this->camData.nextAt.y = player2->actor.world.pos.y + 50.0f; - this->camData.nextAt.z = player2->actor.world.pos.z; + this->subCamEye.x = player2->actor.world.pos.x - 70.0f; + this->subCamEye.y = player2->actor.world.pos.y + 40.0f; + this->subCamEye.z = player2->actor.world.pos.z + 70.0f; + this->subCamAt.x = player2->actor.world.pos.x; + this->subCamAt.y = player2->actor.world.pos.y + 30.0f; + this->subCamAt.z = player2->actor.world.pos.z; + this->subCamEyeNext.x = player2->actor.world.pos.x - 50.0f + 18.0f; + this->subCamEyeNext.y = player2->actor.world.pos.y + 40; + this->subCamEyeNext.z = player2->actor.world.pos.z + 50.0f - 18.0f; + this->subCamAtNext.x = player2->actor.world.pos.x; + this->subCamAtNext.y = player2->actor.world.pos.y + 50.0f; + this->subCamAtNext.z = player2->actor.world.pos.z; BossFd_SetCameraSpeed(this, 1.0f); - this->camData.atMaxVel.x = this->camData.atMaxVel.y = this->camData.atMaxVel.z = 0.05f; - this->camData.eyeMaxVel.x = this->camData.eyeMaxVel.y = this->camData.eyeMaxVel.z = 0.05f; + this->subCamAtMaxVelFrac.x = this->subCamAtMaxVelFrac.y = this->subCamAtMaxVelFrac.z = 0.05f; + this->subCamEyeMaxVelFrac.x = this->subCamEyeMaxVelFrac.y = this->subCamEyeMaxVelFrac.z = 0.05f; this->timers[0] = 0; - this->camData.speedMod = 0.0f; - this->camData.accel = 0.0f; + this->subCamVelFactor = 0.0f; + this->subCamAccel = 0.0f; if (GET_EVENTCHKINF(EVENTCHKINF_73)) { this->introState = BFD_CS_EMERGE; - this->camData.nextEye.x = player2->actor.world.pos.x + 100.0f + 300.0f - 600.0f; - this->camData.nextEye.y = player2->actor.world.pos.y + 100.0f - 50.0f; - this->camData.nextEye.z = player2->actor.world.pos.z + 200.0f - 150.0f; - this->camData.nextAt.x = 0.0f; - this->camData.nextAt.y = 120.0f; - this->camData.nextAt.z = 0.0f; + this->subCamEyeNext.x = player2->actor.world.pos.x + 100.0f + 300.0f - 600.0f; + this->subCamEyeNext.y = player2->actor.world.pos.y + 100.0f - 50.0f; + this->subCamEyeNext.z = player2->actor.world.pos.z + 200.0f - 150.0f; + this->subCamAtNext.x = 0.0f; + this->subCamAtNext.y = 120.0f; + this->subCamAtNext.z = 0.0f; BossFd_SetCameraSpeed(this, 0.5f); - this->camData.eyeMaxVel.x = this->camData.eyeMaxVel.y = this->camData.eyeMaxVel.z = 0.1f; - this->camData.atMaxVel.x = this->camData.atMaxVel.y = this->camData.atMaxVel.z = 0.1f; - this->camData.accel = 0.005f; + this->subCamEyeMaxVelFrac.x = this->subCamEyeMaxVelFrac.y = this->subCamEyeMaxVelFrac.z = 0.1f; + this->subCamAtMaxVelFrac.x = this->subCamAtMaxVelFrac.y = this->subCamAtMaxVelFrac.z = 0.1f; + this->subCamAccel = 0.005f; this->timers[0] = 0; this->holeIndex = 1; this->targetPosition.x = sHoleLocations[this->holeIndex].x; @@ -371,7 +371,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { break; case BFD_CS_START: if (this->timers[0] == 0) { - this->camData.accel = 0.0010000002f; + this->subCamAccel = 0.0010000002f; this->timers[0] = 100; this->introState = BFD_CS_LOOK_LINK; } @@ -388,46 +388,46 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_EN_DODO_K_ROLL - SFX_FLAG, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - this->camData.yMod = Math_CosS(this->work[BFD_MOVE_TIMER] * 0x8000) * this->camData.shake; - Math_ApproachF(&this->camData.shake, 2.0f, 1.0f, 0.8 * 0.01f); + this->subCamAtYOffset = Math_CosS(this->work[BFD_MOVE_TIMER] * 0x8000) * this->subCamShake; + Math_ApproachF(&this->subCamShake, 2.0f, 1.0f, 0.8 * 0.01f); } if (this->timers[0] == 40) { func_8002DF54(globalCtx, &this->actor, 0x13); } if (this->timers[0] == 0) { this->introState = BFD_CS_LOOK_GROUND; - this->camData.nextAt.y = player2->actor.world.pos.y + 10.0f; - this->camData.atMaxVel.y = 0.2f; - this->camData.speedMod = 0.0f; - this->camData.accel = 0.02f; + this->subCamAtNext.y = player2->actor.world.pos.y + 10.0f; + this->subCamAtMaxVelFrac.y = 0.2f; + this->subCamVelFactor = 0.0f; + this->subCamAccel = 0.02f; this->timers[0] = 70; this->work[BFD_MOVE_TIMER] = 0; } break; case BFD_CS_LOOK_GROUND: - this->camData.yMod = Math_CosS(this->work[BFD_MOVE_TIMER] * 0x8000) * this->camData.shake; - Math_ApproachF(&this->camData.shake, 2.0f, 1.0f, 0.8 * 0.01f); + this->subCamAtYOffset = Math_CosS(this->work[BFD_MOVE_TIMER] * 0x8000) * this->subCamShake; + Math_ApproachF(&this->subCamShake, 2.0f, 1.0f, 0.8 * 0.01f); Audio_PlaySoundGeneral(NA_SE_EN_DODO_K_ROLL - SFX_FLAG, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (this->timers[0] == 0) { this->introState = BFD_CS_COLLAPSE; - this->camData.nextEye.x = player2->actor.world.pos.x + 100.0f + 300.0f; - this->camData.nextEye.y = player2->actor.world.pos.y + 100.0f; - this->camData.nextEye.z = player2->actor.world.pos.z + 200.0f; - this->camData.nextAt.x = player2->actor.world.pos.x; - this->camData.nextAt.y = player2->actor.world.pos.y - 150.0f; - this->camData.nextAt.z = player2->actor.world.pos.z - 50.0f; + this->subCamEyeNext.x = player2->actor.world.pos.x + 100.0f + 300.0f; + this->subCamEyeNext.y = player2->actor.world.pos.y + 100.0f; + this->subCamEyeNext.z = player2->actor.world.pos.z + 200.0f; + this->subCamAtNext.x = player2->actor.world.pos.x; + this->subCamAtNext.y = player2->actor.world.pos.y - 150.0f; + this->subCamAtNext.z = player2->actor.world.pos.z - 50.0f; BossFd_SetCameraSpeed(this, 0.1f); this->timers[0] = 170; - this->camData.speedMod = 0.0f; - this->camData.accel = 0.0f; + this->subCamVelFactor = 0.0f; + this->subCamAccel = 0.0f; func_8002DF54(globalCtx, &this->actor, 0x14); } break; case BFD_CS_COLLAPSE: - this->camData.accel = 0.005f; - this->camData.yMod = Math_CosS(this->work[BFD_MOVE_TIMER] * 0x8000) * this->camData.shake; - Math_ApproachF(&this->camData.shake, 2.0f, 1.0f, 0.8 * 0.01f); + this->subCamAccel = 0.005f; + this->subCamAtYOffset = Math_CosS(this->work[BFD_MOVE_TIMER] * 0x8000) * this->subCamShake; + Math_ApproachF(&this->subCamShake, 2.0f, 1.0f, 0.8 * 0.01f); Audio_PlaySoundGeneral(NA_SE_EN_DODO_K_ROLL - SFX_FLAG, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); if (this->timers[0] == 100) { @@ -435,17 +435,17 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { } if (this->timers[0] == 0) { this->introState = BFD_CS_EMERGE; - this->camData.speedMod = 0.0f; - this->camData.nextEye.x = player2->actor.world.pos.x + 100.0f + 300.0f - 600.0f; - this->camData.nextEye.y = player2->actor.world.pos.y + 100.0f - 50.0f; - this->camData.nextEye.z = player2->actor.world.pos.z + 200.0f - 150.0f; - this->camData.nextAt.x = 0.0f; - this->camData.nextAt.y = 120.0f; - this->camData.nextAt.z = 0.0f; + this->subCamVelFactor = 0.0f; + this->subCamEyeNext.x = player2->actor.world.pos.x + 100.0f + 300.0f - 600.0f; + this->subCamEyeNext.y = player2->actor.world.pos.y + 100.0f - 50.0f; + this->subCamEyeNext.z = player2->actor.world.pos.z + 200.0f - 150.0f; + this->subCamAtNext.x = 0.0f; + this->subCamAtNext.y = 120.0f; + this->subCamAtNext.z = 0.0f; BossFd_SetCameraSpeed(this, 0.5f); - this->camData.atMaxVel.x = this->camData.atMaxVel.y = this->camData.atMaxVel.z = 0.1f; - this->camData.eyeMaxVel.x = this->camData.eyeMaxVel.y = this->camData.eyeMaxVel.z = 0.1f; - this->camData.accel = 0.005f; + this->subCamAtMaxVelFrac.x = this->subCamAtMaxVelFrac.y = this->subCamAtMaxVelFrac.z = 0.1f; + this->subCamEyeMaxVelFrac.x = this->subCamEyeMaxVelFrac.y = this->subCamEyeMaxVelFrac.z = 0.1f; + this->subCamAccel = 0.005f; this->timers[0] = 0; this->holeIndex = 1; this->targetPosition.x = sHoleLocations[this->holeIndex].x; @@ -461,24 +461,24 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { } break; case BFD_CS_EMERGE: - osSyncPrintf("WAY_SPD X = %f\n", this->camData.atVel.x); - osSyncPrintf("WAY_SPD Y = %f\n", this->camData.atVel.y); - osSyncPrintf("WAY_SPD Z = %f\n", this->camData.atVel.z); + osSyncPrintf("WAY_SPD X = %f\n", this->subCamAtVel.x); + osSyncPrintf("WAY_SPD Y = %f\n", this->subCamAtVel.y); + osSyncPrintf("WAY_SPD Z = %f\n", this->subCamAtVel.z); if ((this->timers[3] > 190) && !GET_EVENTCHKINF(EVENTCHKINF_73)) { Audio_PlaySoundGeneral(NA_SE_EN_DODO_K_ROLL - SFX_FLAG, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); } if (this->timers[3] == 190) { - this->camData.atMaxVel.x = this->camData.atMaxVel.y = this->camData.atMaxVel.z = 0.05f; + this->subCamAtMaxVelFrac.x = this->subCamAtMaxVelFrac.y = this->subCamAtMaxVelFrac.z = 0.05f; this->platformSignal = VBSIMA_KILL; func_8002DF54(globalCtx, &this->actor, 1); } if (this->actor.world.pos.y > 120.0f) { - this->camData.nextAt = this->actor.world.pos; - this->camData.atVel.x = 190.0f; - this->camData.atVel.y = 85.56f; - this->camData.atVel.z = 25.0f; + this->subCamAtNext = this->actor.world.pos; + this->subCamAtVel.x = 190.0f; + this->subCamAtVel.y = 85.56f; + this->subCamAtVel.z = 25.0f; } else { // the following `temp` stuff is probably fake but is required to match // it's optimized to 1.0f because sp1CF is false at this point, but the 0.1f ends up in rodata @@ -486,8 +486,8 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { if (!sp1CF) { temp = 1.0f; } - Math_ApproachF(&this->camData.shake, 2.0f, temp, 0.1 * 0.08f); - this->camData.yMod = Math_CosS(this->work[BFD_MOVE_TIMER] * 0x8000) * this->camData.shake; + Math_ApproachF(&this->subCamShake, 2.0f, temp, 0.1 * 0.08f); + this->subCamAtYOffset = Math_CosS(this->work[BFD_MOVE_TIMER] * 0x8000) * this->subCamShake; } if (this->timers[3] == 160) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_FIRE_BOSS); @@ -497,10 +497,10 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { SEGMENTED_TO_VIRTUAL(gVolvagiaBossTitleCardTex), 0xA0, 0xB4, 0x80, 0x28); } if (this->timers[3] <= 100) { - this->camData.eyeVel.x = this->camData.eyeVel.y = this->camData.eyeVel.z = 2.0f; - this->camData.nextEye.x = player2->actor.world.pos.x + 50.0f; - this->camData.nextEye.y = player2->actor.world.pos.y + 50.0f; - this->camData.nextEye.z = player2->actor.world.pos.z + 50.0f; + this->subCamEyeVel.x = this->subCamEyeVel.y = this->subCamEyeVel.z = 2.0f; + this->subCamEyeNext.x = player2->actor.world.pos.x + 50.0f; + this->subCamEyeNext.y = player2->actor.world.pos.y + 50.0f; + this->subCamEyeNext.z = player2->actor.world.pos.z + 50.0f; } if (this->work[BFD_ACTION_STATE] == BOSSFD_FLY_HOLE) { switch (this->introFlyState) { @@ -514,7 +514,7 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { } break; case INTRO_FLY_CAMERA: - this->targetPosition = this->camData.eye; + this->targetPosition = this->subCamEye; if (this->timers[5] == 0) { this->timers[0] = 0; this->holeIndex = 7; @@ -534,11 +534,12 @@ void BossFd_Fly(BossFd* this, GlobalContext* globalCtx) { osSyncPrintf("this->timer[2] = %d\n", this->timers[2]); osSyncPrintf("this->timer[5] = %d\n", this->timers[5]); if (this->timers[2] == 0) { - mainCam->eye = this->camData.eye; - mainCam->eyeNext = this->camData.eye; - mainCam->at = this->camData.at; - func_800C08AC(globalCtx, this->introCamera, 0); - this->introState = this->introFlyState = this->introCamera = BFD_CS_NONE; + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + // BFD_CS_NONE / BOSSFD_FLY_MAIN / SUB_CAM_ID_DONE + this->introState = this->introFlyState = this->subCamId = 0; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); this->actionFunc = BossFd_Wait; diff --git a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h index 223f9ae485..8f1a16b79a 100644 --- a/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h +++ b/src/overlays/actors/ovl_Boss_Fd/z_boss_fd.h @@ -73,22 +73,6 @@ typedef struct { /* 0x1E0 */ Vec3f head; } BossFdMane; // size = 0x1EC -typedef struct { - /* 0x00 */ Vec3f eye; - /* 0x0C */ Vec3f at; - /* 0x18 */ Vec3f pad[2]; - /* 0x30 */ Vec3f eyeVel; - /* 0x3C */ Vec3f atVel; - /* 0x48 */ Vec3f nextEye; - /* 0x54 */ Vec3f eyeMaxVel; - /* 0x60 */ Vec3f nextAt; - /* 0x6C */ Vec3f atMaxVel; - /* 0x78 */ f32 speedMod; - /* 0x7C */ f32 accel; - /* 0x80 */ f32 yMod; - /* 0x84 */ f32 shake; -} BossFdCam; // size = 0x88 - typedef enum { /* 0 */ BFD_ACTION_STATE, /* 1 */ BFD_MOVE_TIMER, @@ -175,8 +159,21 @@ typedef struct BossFd { /* 0x13F4 */ Vec3f headPos; /* 0x1400 */ s16 introFlyState; /* 0x1402 */ s16 introState; - /* 0x1404 */ s16 introCamera; - /* 0x1408 */ BossFdCam camData; + /* 0x1404 */ s16 subCamId; + /* 0x1408 */ Vec3f subCamEye; + /* 0x1414 */ Vec3f subCamAt; + /* 0x1420 */ Vec3f subCamUp; + /* 0x142C */ Vec3f pad; + /* 0x1438 */ Vec3f subCamEyeVel; + /* 0x1444 */ Vec3f subCamAtVel; + /* 0x1450 */ Vec3f subCamEyeNext; + /* 0x145C */ Vec3f subCamEyeMaxVelFrac; + /* 0x1468 */ Vec3f subCamAtNext; + /* 0x1474 */ Vec3f subCamAtMaxVelFrac; + /* 0x1480 */ f32 subCamVelFactor; + /* 0x1484 */ f32 subCamAccel; + /* 0x1488 */ f32 subCamAtYOffset; + /* 0x148C */ f32 subCamShake; /* 0x1490 */ ColliderJntSph collider; /* 0x14B0 */ ColliderJntSphElement elements[19]; /* 0x1970 */ BossFdEffect effects[BOSSFD_EFFECT_COUNT]; diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c index 6393aeda41..93c568331e 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.c @@ -616,23 +616,23 @@ void BossFd2_SetupDeath(BossFd2* this, GlobalContext* globalCtx) { } void BossFd2_UpdateCamera(BossFd2* this, GlobalContext* globalCtx) { - if (this->deathCamera != SUBCAM_FREE) { - Math_ApproachF(&this->camData.eye.x, this->camData.nextEye.x, this->camData.eyeMaxVel.x, - this->camData.eyeVel.x * this->camData.speedMod); - Math_ApproachF(&this->camData.eye.y, this->camData.nextEye.y, this->camData.eyeMaxVel.y, - this->camData.eyeVel.y * this->camData.speedMod); - Math_ApproachF(&this->camData.eye.z, this->camData.nextEye.z, this->camData.eyeMaxVel.z, - this->camData.eyeVel.z * this->camData.speedMod); - Math_ApproachF(&this->camData.at.x, this->camData.nextAt.x, this->camData.atMaxVel.x, - this->camData.atVel.x * this->camData.speedMod); - Math_ApproachF(&this->camData.at.y, this->camData.nextAt.y, this->camData.atMaxVel.y, - this->camData.atVel.y * this->camData.speedMod); - Math_ApproachF(&this->camData.at.z, this->camData.nextAt.z, this->camData.atMaxVel.z, - this->camData.atVel.z * this->camData.speedMod); - Math_ApproachF(&this->camData.speedMod, 1.0f, 1.0f, this->camData.accel); - this->camData.at.y += this->camData.yMod; - Gameplay_CameraSetAtEye(globalCtx, this->deathCamera, &this->camData.at, &this->camData.eye); - Math_ApproachF(&this->camData.yMod, 0.0f, 1.0f, 0.1f); + if (this->subCamId != SUB_CAM_ID_DONE) { + Math_ApproachF(&this->subCamEye.x, this->subCamEyeNext.x, this->subCamEyeMaxVelFrac.x, + this->subCamEyeVel.x * this->subCamVelFactor); + Math_ApproachF(&this->subCamEye.y, this->subCamEyeNext.y, this->subCamEyeMaxVelFrac.y, + this->subCamEyeVel.y * this->subCamVelFactor); + Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, this->subCamEyeMaxVelFrac.z, + this->subCamEyeVel.z * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, this->subCamAtMaxVelFrac.x, + this->subCamAtVel.x * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, this->subCamAtMaxVelFrac.y, + this->subCamAtVel.y * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, this->subCamAtMaxVelFrac.z, + this->subCamAtVel.z * this->subCamVelFactor); + Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, this->subCamAccel); + this->subCamAt.y += this->subCamAtYOffset; + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); + Math_ApproachF(&this->subCamAtYOffset, 0.0f, 1.0f, 0.1f); } } @@ -641,7 +641,7 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { Vec3f sp70; Vec3f sp64; BossFd* bossFd = (BossFd*)this->actor.parent; - Camera* mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); f32 pad3; f32 pad2; f32 pad1; @@ -654,26 +654,26 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { this->deathState = DEATH_RETREAT; func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 1); - this->deathCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->deathCamera, CAM_STAT_ACTIVE); - this->camData.eye = mainCam->eye; - this->camData.at = mainCam->at; - this->camData.eyeVel.x = 100.0f; - this->camData.eyeVel.y = 100.0f; - this->camData.eyeVel.z = 100.0f; - this->camData.atVel.x = 100.0f; - this->camData.atVel.y = 100.0f; - this->camData.atVel.z = 100.0f; - this->camData.accel = 0.02f; + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamEye = mainCam->eye; + this->subCamAt = mainCam->at; + this->subCamEyeVel.x = 100.0f; + this->subCamEyeVel.y = 100.0f; + this->subCamEyeVel.z = 100.0f; + this->subCamAtVel.x = 100.0f; + this->subCamAtVel.y = 100.0f; + this->subCamAtVel.z = 100.0f; + this->subCamAccel = 0.02f; this->timers[0] = 0; this->work[FD2_HOLE_COUNTER] = 0; - this->camData.eyeMaxVel.x = 0.1f; - this->camData.eyeMaxVel.y = 0.1f; - this->camData.eyeMaxVel.z = 0.1f; - this->camData.atMaxVel.x = 0.1f; - this->camData.atMaxVel.y = 0.1f; - this->camData.atMaxVel.z = 0.1f; + this->subCamEyeMaxVelFrac.x = 0.1f; + this->subCamEyeMaxVelFrac.y = 0.1f; + this->subCamEyeMaxVelFrac.z = 0.1f; + this->subCamAtMaxVelFrac.x = 0.1f; + this->subCamAtMaxVelFrac.y = 0.1f; + this->subCamAtMaxVelFrac.z = 0.1f; case DEATH_RETREAT: this->work[FD2_HOLE_COUNTER]++; if (this->work[FD2_HOLE_COUNTER] < 15) { @@ -697,13 +697,13 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { sp70.y = 0.0f; sp70.z = 250.0f; Matrix_MultVec3f(&sp70, &sp64); - this->camData.nextEye.x = this->actor.world.pos.x + sp64.x; - this->camData.nextEye.y = 140.0f; - this->camData.nextEye.z = this->actor.world.pos.z + sp64.z; + this->subCamEyeNext.x = this->actor.world.pos.x + sp64.x; + this->subCamEyeNext.y = 140.0f; + this->subCamEyeNext.z = this->actor.world.pos.z + sp64.z; if (this->actor.focus.pos.y >= 90.0f) { - this->camData.nextAt.y = this->actor.focus.pos.y; - this->camData.nextAt.x = this->actor.focus.pos.x; - this->camData.nextAt.z = this->actor.focus.pos.z; + this->subCamAtNext.y = this->actor.focus.pos.y; + this->subCamAtNext.x = this->actor.focus.pos.x; + this->subCamAtNext.z = this->actor.focus.pos.z; } if (this->timers[0] == 0) { if (Animation_OnFrame(skelAnime, 20.0f)) { @@ -723,7 +723,7 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { this->deathState = DEATH_FD_BODY; bossFd->handoffSignal = FD2_SIGNAL_DEATH; this->work[FD2_ACTION_STATE] = 0; - this->camData.speedMod = 0.0f; + this->subCamVelFactor = 0.0f; } else { Math_ApproachF(&this->actor.world.pos.y, -100.0f, 1.0f, 5.0f); } @@ -731,54 +731,54 @@ void BossFd2_Death(BossFd2* this, GlobalContext* globalCtx) { case DEATH_FD_BODY: if (bossFd->actor.world.pos.y < 80.0f) { if (bossFd->actor.world.rot.x > 0x3000) { - this->camData.nextAt = bossFd->actor.world.pos; - this->camData.nextAt.y = 80.0f; - this->camData.nextEye.x = bossFd->actor.world.pos.x; - this->camData.nextEye.y = 150.0f; - this->camData.nextEye.z = bossFd->actor.world.pos.z + 300.0f; + this->subCamAtNext = bossFd->actor.world.pos; + this->subCamAtNext.y = 80.0f; + this->subCamEyeNext.x = bossFd->actor.world.pos.x; + this->subCamEyeNext.y = 150.0f; + this->subCamEyeNext.z = bossFd->actor.world.pos.z + 300.0f; } } else { - this->camData.nextAt = bossFd->actor.world.pos; - this->camData.nextEye.x = this->actor.world.pos.x; - Math_ApproachF(&this->camData.nextEye.y, 200.0f, 1.0f, 2.0f); - Math_ApproachF(&this->camData.nextEye.z, bossFd->actor.world.pos.z + 200.0f, 1.0f, 3.0f); + this->subCamAtNext = bossFd->actor.world.pos; + this->subCamEyeNext.x = this->actor.world.pos.x; + Math_ApproachF(&this->subCamEyeNext.y, 200.0f, 1.0f, 2.0f); + Math_ApproachF(&this->subCamEyeNext.z, bossFd->actor.world.pos.z + 200.0f, 1.0f, 3.0f); if (this->work[FD2_ACTION_STATE] == 0) { this->work[FD2_ACTION_STATE]++; - this->camData.speedMod = 0.0f; - this->camData.accel = 0.02f; + this->subCamVelFactor = 0.0f; + this->subCamAccel = 0.02f; func_8002DF54(globalCtx, &bossFd->actor, 1); } } if ((bossFd->work[BFD_ACTION_STATE] == BOSSFD_BONES_FALL) && (bossFd->timers[0] == 5)) { this->deathState = DEATH_FD_SKULL; - this->camData.speedMod = 0.0f; - this->camData.accel = 0.02f; - this->camData.nextEye.y = 150.0f; - this->camData.nextEye.z = bossFd->actor.world.pos.z + 300.0f; + this->subCamVelFactor = 0.0f; + this->subCamAccel = 0.02f; + this->subCamEyeNext.y = 150.0f; + this->subCamEyeNext.z = bossFd->actor.world.pos.z + 300.0f; } break; case DEATH_FD_SKULL: - Math_ApproachF(&this->camData.nextAt.y, 100.0, 1.0f, 100.0f); - this->camData.nextAt.x = 0.0f; - this->camData.nextAt.z = 0.0f; - this->camData.nextEye.x = 0.0f; - this->camData.nextEye.y = 140.0f; - Math_ApproachF(&this->camData.nextEye.z, 220.0f, 0.5f, 1.15f); + Math_ApproachF(&this->subCamAtNext.y, 100.0, 1.0f, 100.0f); + this->subCamAtNext.x = 0.0f; + this->subCamAtNext.z = 0.0f; + this->subCamEyeNext.x = 0.0f; + this->subCamEyeNext.y = 140.0f; + Math_ApproachF(&this->subCamEyeNext.z, 220.0f, 0.5f, 1.15f); if (bossFd->work[BFD_CAM_SHAKE_TIMER] != 0) { bossFd->work[BFD_CAM_SHAKE_TIMER]--; cameraShake = bossFd->work[BFD_CAM_SHAKE_TIMER] / 0.5f; if (cameraShake >= 20.0f) { cameraShake = 20.0f; } - this->camData.yMod = (bossFd->work[BFD_CAM_SHAKE_TIMER] & 1) ? cameraShake : -cameraShake; + this->subCamAtYOffset = (bossFd->work[BFD_CAM_SHAKE_TIMER] & 1) ? cameraShake : -cameraShake; } if (bossFd->work[BFD_ACTION_STATE] == BOSSFD_SKULL_BURN) { this->deathState = DEATH_FINISH; - mainCam->eye = this->camData.eye; - mainCam->eyeNext = this->camData.eye; - mainCam->at = this->camData.at; - func_800C08AC(globalCtx, this->deathCamera, 0); - this->deathCamera = 0; + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_WARP1, 0.0f, 100.0f, 0.0f, diff --git a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h index afafdbba32..0fe2d445e3 100644 --- a/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h +++ b/src/overlays/actors/ovl_Boss_Fd2/z_boss_fd2.h @@ -23,22 +23,6 @@ typedef struct { /* 0x190 */ Vec3f head; } BossFd2Mane; // size = 0x19C -typedef struct { - /* 0x00 */ Vec3f eye; - /* 0x0C */ Vec3f at; - /* 0x18 */ Vec3f pad[2]; - /* 0x30 */ Vec3f eyeVel; - /* 0x3C */ Vec3f atVel; - /* 0x48 */ Vec3f nextEye; - /* 0x54 */ Vec3f eyeMaxVel; - /* 0x60 */ Vec3f nextAt; - /* 0x6C */ Vec3f atMaxVel; - /* 0x78 */ f32 speedMod; - /* 0x7C */ f32 accel; - /* 0x80 */ f32 yMod; - /* 0x84 */ f32 shake; -} BossFd2Cam; // size = 0x88 - typedef enum { /* 0 */ FD2_TURN_TO_LINK, /* 1 */ FD2_ACTION_STATE, @@ -83,8 +67,21 @@ typedef struct BossFd2 { /* 0x1388 */ char unk_1388[4]; /* 0x138C */ f32 jawOpening; /* 0x1390 */ s16 deathState; - /* 0x1392 */ s16 deathCamera; - /* 0x1394 */ BossFd2Cam camData; + /* 0x1392 */ s16 subCamId; + /* 0x1394 */ Vec3f subCamEye; + /* 0x13A0 */ Vec3f subCamAt; + /* 0x13AC */ Vec3f subCamUp; + /* 0x13B8 */ Vec3f pad; + /* 0x13C4 */ Vec3f subCamEyeVel; + /* 0x13D0 */ Vec3f subCamAtVel; + /* 0x13DC */ Vec3f subCamEyeNext; + /* 0x13E8 */ Vec3f subCamEyeMaxVelFrac; + /* 0x13F4 */ Vec3f subCamAtNext; + /* 0x1400 */ Vec3f subCamAtMaxVelFrac; + /* 0x140C */ f32 subCamVelFactor; + /* 0x1410 */ f32 subCamAccel; + /* 0x1414 */ f32 subCamAtYOffset; + /* 0x1418 */ f32 subCamShake; /* 0x141C */ ColliderJntSph collider; /* 0x143C */ ColliderJntSphElement elements[9]; } BossFd2; // size = 0x167C diff --git a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c index e4011c136a..b615e40ef3 100644 --- a/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c +++ b/src/overlays/actors/ovl_Boss_Ganon/z_boss_ganon.c @@ -560,7 +560,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 8); this->csCamIndex = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); Gameplay_ChangeCameraStatus(globalCtx, this->csCamIndex, CAM_STAT_ACTIVE); this->csCamFov = 60.0f; @@ -1122,7 +1122,7 @@ void BossGanon_IntroCutscene(BossGanon* this, GlobalContext* globalCtx) { } if (this->csTimer == 120) { - mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); mainCam->eye = this->csCamEye; mainCam->eyeNext = this->csCamEye; mainCam->at = this->csCamAt; @@ -1236,7 +1236,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 8); this->csCamIndex = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); Gameplay_ChangeCameraStatus(globalCtx, this->csCamIndex, CAM_STAT_ACTIVE); this->actor.world.pos.x = 0.0f; @@ -1507,7 +1507,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 8); this->csCamIndex = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); Gameplay_ChangeCameraStatus(globalCtx, this->csCamIndex, CAM_STAT_ACTIVE); Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime2_Anim_00ADDC, 0.0f); this->fwork[1] = Animation_GetLastFrame(&object_ganon_anime2_Anim_00EA00); @@ -1782,7 +1782,7 @@ void BossGanon_DeathAndTowerCutscene(BossGanon* this, GlobalContext* globalCtx) this->csCamAt.z = (sZelda->actor.world.pos.z - 25.0f) + 80.0f; if (this->csTimer > 50) { - mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); mainCam->eye = this->csCamEye; mainCam->eyeNext = this->csCamEye; @@ -4708,7 +4708,7 @@ void BossGanon_UpdateEffects(GlobalContext* globalCtx) { } } else if (eff->type == GDF_EFF_LIGHTNING) { if (eff->unk_3C == 0.0f) { - eff->unk_44 = BINANG_TO_RAD_ALT(Camera_GetInputDirYaw(Gameplay_GetCamera(globalCtx, MAIN_CAM))); + eff->unk_44 = BINANG_TO_RAD_ALT(Camera_GetInputDirYaw(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN))); } else { eff->unk_44 = M_PI / 2; } diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c index 4464bbbbf5..a9285e5f96 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.c @@ -196,9 +196,9 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { if (Object_IsLoaded(&globalCtx->objectCtx, objectIdx)) { func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 8); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->unk_39C = 1; sZelda = (EnZl3*)Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_EN_ZL3, 970.0f, 1086.0f, -200.0f, 0, 0, 0, 1); @@ -207,13 +207,13 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { sZelda->actor.world.pos.y = 1086.0f; sZelda->actor.world.pos.z = -214.0f; sZelda->actor.shape.rot.y = -0x7000; - this->unk_3BC.x = 0.0f; - this->unk_3BC.y = 1.0f; - this->unk_3BC.z = 0.0f; + this->subCamUp.x = 0.0f; + this->subCamUp.y = 1.0f; + this->subCamUp.z = 0.0f; this->unk_398 = 0; - this->unk_3A4.x = 0.0f; - this->unk_3A4.y = 1400.0f; - this->unk_3A4.z = 1600.0f; + this->subCamEye.x = 0.0f; + this->subCamEye.y = 1400.0f; + this->subCamEye.z = 1600.0f; player->actor.world.pos.x = 970.0f; player->actor.world.pos.y = 1086.0f; player->actor.world.pos.z = -186.0f; @@ -222,7 +222,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { globalCtx->envCtx.unk_D8 = 0.0f; // fake, tricks the compiler into allocating more stack if (zero) { - this->unk_3A4.x *= 2.0; + this->subCamEye.x *= 2.0; } } else { break; @@ -232,12 +232,12 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { globalCtx->envCtx.unk_D8 = 0.0f; } this->unk_339 = 3; - Math_ApproachF(&this->unk_3A4.x, 1500.0f, 0.1f, this->unk_410.x * 1500.0f); - Math_ApproachF(&this->unk_3A4.z, -160.0f, 0.1f, this->unk_410.x * 1760.0f); + Math_ApproachF(&this->subCamEye.x, 1500.0f, 0.1f, this->unk_410.x * 1500.0f); + Math_ApproachF(&this->subCamEye.z, -160.0f, 0.1f, this->unk_410.x * 1760.0f); Math_ApproachF(&this->unk_410.x, 0.0075f, 1.0f, 0.0001f); - this->unk_3B0.x = -200.0f; - this->unk_3B0.y = 1086.0f; - this->unk_3B0.z = -200.0f; + this->subCamAt.x = -200.0f; + this->subCamAt.y = 1086.0f; + this->subCamAt.z = -200.0f; if (this->unk_398 == 150) { Message_StartTextbox(globalCtx, 0x70D3, NULL); } @@ -270,17 +270,17 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { sZelda->unk_3C8 = 2; func_8002DF54(globalCtx, &this->actor, 0x4F); } - this->unk_3A4.x = 930.0f; - this->unk_3A4.y = 1129.0f; - this->unk_3A4.z = -181.0f; - this->unk_3B0.x = player->actor.world.pos.x; - this->unk_3B0.z = (player->actor.world.pos.z - 15.0f) + 5.0f; + this->subCamEye.x = 930.0f; + this->subCamEye.y = 1129.0f; + this->subCamEye.z = -181.0f; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.z = (player->actor.world.pos.z - 15.0f) + 5.0f; if (this->unk_398 > 104) { - Math_ApproachF(&this->unk_3B0.y, player->actor.world.pos.y + 47.0f + 7.0f + 15.0f, 0.1f, + Math_ApproachF(&this->subCamAt.y, player->actor.world.pos.y + 47.0f + 7.0f + 15.0f, 0.1f, this->unk_410.x); Math_ApproachF(&this->unk_410.x, 2.0f, 1.0f, 0.1f); } else { - this->unk_3B0.y = player->actor.world.pos.y + 47.0f + 7.0f; + this->subCamAt.y = player->actor.world.pos.y + 47.0f + 7.0f; } if ((this->unk_398 > 170) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { this->unk_39C = 3; @@ -289,7 +289,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { } break; case 3: - Math_ApproachF(&this->unk_3B0.y, player->actor.world.pos.y + 47.0f + 7.0f, 0.1f, 2.0f); + Math_ApproachF(&this->subCamAt.y, player->actor.world.pos.y + 47.0f + 7.0f, 0.1f, 2.0f); this->unk_339 = 4; if (this->unk_398 == 10) { func_80078914(&D_80906D6C, NA_SE_EV_STONE_BOUND); @@ -309,17 +309,17 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { break; case 4: this->unk_339 = 4; - Math_ApproachF(&this->unk_3A4.x, -360.0f, 0.1f, this->unk_410.x * 1290.0f); - Math_ApproachF(&this->unk_3A4.z, -20.0f, 0.1f, this->unk_410.x * 170.0f); + Math_ApproachF(&this->subCamEye.x, -360.0f, 0.1f, this->unk_410.x * 1290.0f); + Math_ApproachF(&this->subCamEye.z, -20.0f, 0.1f, this->unk_410.x * 170.0f); Math_ApproachF(&this->unk_410.x, 0.04f, 1.0f, 0.0005f); if (this->unk_398 == 100) { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); - camera->eye = this->unk_3A4; - camera->eyeNext = this->unk_3A4; - camera->at = this->unk_3B0; - func_800C08AC(globalCtx, this->unk_39E, 0); - this->unk_39E = 0; + camera->eye = this->subCamEye; + camera->eyeNext = this->subCamEye; + camera->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); this->unk_39C = 5; @@ -333,9 +333,9 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->unk_39C = 10; this->unk_398 = 0; func_80064520(globalCtx, &globalCtx->csCtx); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); } else { break; } @@ -348,12 +348,12 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { sZelda->actor.world.pos.z = -186.0f; player->actor.shape.rot.y = -0x4000; sZelda->actor.shape.rot.y = -0x5000; - this->unk_3A4.x = 410.0f; - this->unk_3A4.y = 1096.0f; - this->unk_3A4.z = -110.0f; - this->unk_3B0.x = player->actor.world.pos.x + 10.0f; - this->unk_3B0.y = (player->actor.world.pos.y + 200.0f) - 160.0f; - this->unk_3B0.z = player->actor.world.pos.z; + this->subCamEye.x = 410.0f; + this->subCamEye.y = 1096.0f; + this->subCamEye.z = -110.0f; + this->subCamAt.x = player->actor.world.pos.x + 10.0f; + this->subCamAt.y = (player->actor.world.pos.y + 200.0f) - 160.0f; + this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 >= 20) { func_80078884(NA_SE_EN_GOMA_LAST - SFX_FLAG); Math_ApproachF(&this->unk_324, 255.0f, 1.0f, 10.0f); @@ -385,12 +385,12 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { sZelda->actor.world.pos.z = -186.0f; player->actor.shape.rot.y = -0x4000; sZelda->actor.shape.rot.y = -0x5000; - this->unk_3A4.x = 450.0f; - this->unk_3A4.y = 1121.0f; - this->unk_3A4.z = -158.0f; - this->unk_3B0.x = (player->actor.world.pos.x - 20.0f) + 2.0f; - this->unk_3B0.y = ((player->actor.world.pos.y + 200.0f) - 151.0f) - 2.0f; - this->unk_3B0.z = player->actor.world.pos.z + 2.0f; + this->subCamEye.x = 450.0f; + this->subCamEye.y = 1121.0f; + this->subCamEye.z = -158.0f; + this->subCamAt.x = (player->actor.world.pos.x - 20.0f) + 2.0f; + this->subCamAt.y = ((player->actor.world.pos.y + 200.0f) - 151.0f) - 2.0f; + this->subCamAt.z = player->actor.world.pos.z + 2.0f; if (this->unk_398 == 10) { func_80078914(&D_80906D6C, NA_SE_EV_STONE_BOUND); } @@ -409,11 +409,11 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { this->actor.world.pos.y = 1009.0f; this->actor.shape.yOffset = 7000.0f; this->actor.world.rot.y = 0x5000; - this->unk_3A4.x = -60.0f; - this->unk_3A4.y = 1106.0f; - this->unk_3A4.z = -200.0f; - this->unk_3B0.x = this->unk_3B0.z = -200.0f; - this->unk_3B0.y = this->actor.world.pos.y + 70.0f; + this->subCamEye.x = -60.0f; + this->subCamEye.y = 1106.0f; + this->subCamEye.z = -200.0f; + this->subCamAt.x = this->subCamAt.z = -200.0f; + this->subCamAt.y = this->actor.world.pos.y + 70.0f; globalCtx->envCtx.unk_D8 = 0.0f; globalCtx->envCtx.unk_BE = globalCtx->envCtx.unk_BD = 0; this->unk_339 = 0; @@ -433,7 +433,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { } if (this->unk_398 >= 30) { Math_ApproachF(&this->actor.world.pos.y, 1289.0f, 0.1f, 10.0f); - this->unk_3B0.y = this->actor.world.pos.y + 70.0f; + this->subCamAt.y = this->actor.world.pos.y + 70.0f; } if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { Animation_MorphToLoop(&this->skelAnime, &object_ganon_anime3_Anim_002E6C, 0.0f); @@ -456,25 +456,25 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { sZelda->actor.world.pos.x = 724.0f; sZelda->actor.world.pos.y = 1086.0f; sZelda->actor.world.pos.z = -186.0f; - this->unk_3A4.x = this->actor.world.pos.x + -10.0f; - this->unk_3A4.y = this->actor.world.pos.y + 80.0f; - this->unk_3A4.z = this->actor.world.pos.z + 50.0f; - this->unk_3B0.x = player->actor.world.pos.x; - this->unk_3B0.y = player->actor.world.pos.y; - this->unk_3B0.z = player->actor.world.pos.z - 200.0f; + this->subCamEye.x = this->actor.world.pos.x + -10.0f; + this->subCamEye.y = this->actor.world.pos.y + 80.0f; + this->subCamEye.z = this->actor.world.pos.z + 50.0f; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = player->actor.world.pos.y; + this->subCamAt.z = player->actor.world.pos.z - 200.0f; if (this->unk_398 == 20) { func_8002DF54(globalCtx, &this->actor, 0x1E); } if (this->unk_398 == 60) { - this->unk_3A4.x = (this->actor.world.pos.x + 200.0f) - 154.0f; - this->unk_3A4.y = this->actor.world.pos.y + 60.0f; - this->unk_3A4.z = this->actor.world.pos.z - 15.0f; + this->subCamEye.x = (this->actor.world.pos.x + 200.0f) - 154.0f; + this->subCamEye.y = this->actor.world.pos.y + 60.0f; + this->subCamEye.z = this->actor.world.pos.z - 15.0f; this->unk_39C = 15; this->unk_398 = 0; - this->unk_3B0.y = this->actor.world.pos.y + 77.0f + 100.0f; + this->subCamAt.y = this->actor.world.pos.y + 77.0f + 100.0f; this->unk_314 = 2; - this->unk_3B0.z = this->actor.world.pos.z + 5.0f; - this->unk_3B0.x = this->actor.world.pos.x; + this->subCamAt.z = this->actor.world.pos.z + 5.0f; + this->subCamAt.x = this->actor.world.pos.x; } if ((globalCtx->gameplayFrames % 32) == 0) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_BREATH); @@ -485,7 +485,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_BREATH); } SkelAnime_Update(&this->skelAnime); - Math_ApproachF(&this->unk_3B0.y, this->actor.world.pos.y + 77.0f, 0.05f, 5.0f); + Math_ApproachF(&this->subCamAt.y, this->actor.world.pos.y + 77.0f, 0.05f, 5.0f); if (this->unk_398 >= 50) { if (this->unk_398 == 50) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime3_Anim_000BFC, 0.0f); @@ -528,9 +528,9 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime3_Anim_0028A8, 0.0f); this->unk_194 = 1000.0f; } - Math_ApproachF(&this->unk_3A4.x, (this->actor.world.pos.x + 200.0f) - 90.0f, 0.1f, 6.3999996f); - Math_ApproachF(&this->unk_3A4.y, ((this->actor.world.pos.y + 60.0f) - 60.0f) - 70.0f, 0.1f, 13.0f); - Math_ApproachF(&this->unk_3B0.y, this->actor.world.pos.y + 40.0f, 0.1f, 3.6999998f); + Math_ApproachF(&this->subCamEye.x, (this->actor.world.pos.x + 200.0f) - 90.0f, 0.1f, 6.3999996f); + Math_ApproachF(&this->subCamEye.y, ((this->actor.world.pos.y + 60.0f) - 60.0f) - 70.0f, 0.1f, 13.0f); + Math_ApproachF(&this->subCamAt.y, this->actor.world.pos.y + 40.0f, 0.1f, 3.6999998f); if (this->unk_398 == 30) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_BIGMASIC); Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_THROW_BIG); @@ -539,11 +539,11 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { sp8D = true; } if (this->unk_398 >= 60) { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); - camera->eye = this->unk_3A4; - camera->eyeNext = this->unk_3A4; - camera->at = this->unk_3B0; + camera->eye = this->subCamEye; + camera->eyeNext = this->subCamEye; + camera->at = this->subCamAt; this->unk_39C = 17; this->unk_398 = 0; this->unk_337 = 2; @@ -556,29 +556,29 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { } // fake, tricks the compiler into using stack the way we need it to if (zero) { - Math_ApproachF(&this->unk_3B0.y, 0.0f, 0.0f, 0.0f); + Math_ApproachF(&this->subCamAt.y, 0.0f, 0.0f, 0.0f); } break; case 17: this->unk_339 = 6; SkelAnime_Update(&this->skelAnime); - this->unk_3A4.x = player->actor.world.pos.x - 40.0f; - this->unk_3A4.y = player->actor.world.pos.y + 40.0f; - this->unk_3A4.z = player->actor.world.pos.z + 20.0f; - this->unk_3B0.x = player->actor.world.pos.x; - this->unk_3B0.y = (player->actor.world.pos.y + 10.0f + 60.0f) - 30.0f; - this->unk_3B0.z = player->actor.world.pos.z; + this->subCamEye.x = player->actor.world.pos.x - 40.0f; + this->subCamEye.y = player->actor.world.pos.y + 40.0f; + this->subCamEye.z = player->actor.world.pos.z + 20.0f; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = (player->actor.world.pos.y + 10.0f + 60.0f) - 30.0f; + this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 == 25) { this->unk_39C = 18; this->unk_398 = 0; Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon_anime3_Anim_010380, 0.0f); this->skelAnime.playSpeed = 0.0f; - this->unk_3A4.x = ((this->actor.world.pos.x + 500.0f) - 350.0f) - 50.0f; - this->unk_3A4.y = this->actor.world.pos.y; - this->unk_3A4.z = this->actor.world.pos.z; - this->unk_3B0.x = this->actor.world.pos.x + 50.0f; - this->unk_3B0.y = this->actor.world.pos.y + 60.0f; - this->unk_3B0.z = this->actor.world.pos.z; + this->subCamEye.x = ((this->actor.world.pos.x + 500.0f) - 350.0f) - 50.0f; + this->subCamEye.y = this->actor.world.pos.y; + this->subCamEye.z = this->actor.world.pos.z; + this->subCamAt.x = this->actor.world.pos.x + 50.0f; + this->subCamAt.y = this->actor.world.pos.y + 60.0f; + this->subCamAt.z = this->actor.world.pos.z; this->actor.world.rot.y = 0x4000; } break; @@ -588,8 +588,8 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_GANON_BOSS); } Math_ApproachF(&this->unk_30C, 7.0f, 1.0f, 0.1f); - Math_ApproachF(&this->unk_3A4.x, (this->actor.world.pos.x + 500.0f) - 350.0f, 0.1f, 1.0f); - Math_ApproachF(&this->unk_3B0.x, this->actor.world.pos.x, 0.1f, 1.0f); + Math_ApproachF(&this->subCamEye.x, (this->actor.world.pos.x + 500.0f) - 350.0f, 0.1f, 1.0f); + Math_ApproachF(&this->subCamAt.x, this->actor.world.pos.x, 0.1f, 1.0f); Math_ApproachF(&this->unk_228, 1.0f, 0.1f, 0.02f); if (this->unk_398 == 65) { this->unk_39C = 19; @@ -621,13 +621,13 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { player->actor.world.pos.y = 1086.0f; player->actor.world.pos.z = -266.0f; player->actor.shape.rot.y = -0x4000; - this->unk_3A4.x = (player->actor.world.pos.x - 40.0f) - 200.0f; - this->unk_3A4.y = (player->actor.world.pos.y + 40.0f) - 30.0f; - this->unk_3A4.z = (player->actor.world.pos.z - 20.0f) + 100.0f; - this->unk_3B0.x = player->actor.world.pos.x; - this->unk_3B0.y = ((player->actor.world.pos.y + 10.0f + 60.0f) - 20.0f) + 30.0f; - this->unk_3B0.z = player->actor.world.pos.z; - this->unk_3BC.x = 0.8f; + this->subCamEye.x = (player->actor.world.pos.x - 40.0f) - 200.0f; + this->subCamEye.y = (player->actor.world.pos.y + 40.0f) - 30.0f; + this->subCamEye.z = (player->actor.world.pos.z - 20.0f) + 100.0f; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = ((player->actor.world.pos.y + 10.0f + 60.0f) - 20.0f) + 30.0f; + this->subCamAt.z = player->actor.world.pos.z; + this->subCamUp.x = 0.8f; if (this->actor.world.pos.y <= 1099.0f) { this->actor.world.pos.y = 1099.0f; this->unk_39C = 21; @@ -654,7 +654,7 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { if (this->unk_398 < 60) { this->unk_339 = 7; } - this->unk_3BC.x = 0.0f; + this->subCamUp.x = 0.0f; this->actor.world.pos.y = 1099.0f; SkelAnime_Update(&this->skelAnime); Math_ApproachZeroF(&this->unk_30C, 1.0f, 0.1f); @@ -669,12 +669,12 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(object_ganon2_Tex_021A90), 160, 180, 128, 40); } - this->unk_3A4.x = ((this->actor.world.pos.x + 500.0f) - 350.0f) + 100.0f; - this->unk_3A4.y = this->actor.world.pos.y; - this->unk_3A4.z = this->actor.world.pos.z; - this->unk_3B0.x = this->actor.world.pos.x; - this->unk_3B0.z = this->actor.world.pos.z; - this->unk_3B0.y = (this->unk_1B8.y + 60.0f) - 40.0f; + this->subCamEye.x = ((this->actor.world.pos.x + 500.0f) - 350.0f) + 100.0f; + this->subCamEye.y = this->actor.world.pos.y; + this->subCamEye.z = this->actor.world.pos.z; + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.z = this->actor.world.pos.z; + this->subCamAt.y = (this->unk_1B8.y + 60.0f) - 40.0f; if (this->unk_398 > 166 && this->unk_398 < 173) { this->unk_312 = 2; } @@ -703,12 +703,12 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { func_80078884(NA_SE_EN_MGANON_SWORD); func_80078884(NA_SE_EN_MGANON_ROAR); } - this->unk_3A4.x = (player->actor.world.pos.x - 40.0f) + 6.0f; - this->unk_3A4.y = player->actor.world.pos.y + 40.0f; - this->unk_3A4.z = (player->actor.world.pos.z + 20.0f) - 7.0f; - this->unk_3B0.x = player->actor.world.pos.x; - this->unk_3B0.y = ((player->actor.world.pos.y + 10.0f + 60.0f) - 20.0f) - 2.0f; - this->unk_3B0.z = player->actor.world.pos.z; + this->subCamEye.x = (player->actor.world.pos.x - 40.0f) + 6.0f; + this->subCamEye.y = player->actor.world.pos.y + 40.0f; + this->subCamEye.z = (player->actor.world.pos.z + 20.0f) - 7.0f; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = ((player->actor.world.pos.y + 10.0f + 60.0f) - 20.0f) - 2.0f; + this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 == 228) { func_80078884(NA_SE_IT_SHIELD_REFLECT_SW); func_8002DF54(globalCtx, &this->actor, 0x56); @@ -739,10 +739,10 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { if (1) { BossGanon2Effect* effects = globalCtx->specialEffects; - this->unk_3B0 = effects[0].position; - this->unk_3A4.x = effects[0].position.x + 70.0f; - this->unk_3A4.y = effects[0].position.y - 30.0f; - this->unk_3A4.z = effects[0].position.z + 70.0f; + this->subCamAt = effects[0].position; + this->subCamEye.x = effects[0].position.x + 70.0f; + this->subCamEye.y = effects[0].position.y - 30.0f; + this->subCamEye.z = effects[0].position.z + 70.0f; } if ((this->unk_398 & 3) == 0) { func_80078884(NA_SE_IT_SWORD_SWING); @@ -755,12 +755,12 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { break; case 25: SkelAnime_Update(&this->skelAnime); - this->unk_3A4.x = (player->actor.world.pos.x - 40.0f) + 80.0f; - this->unk_3A4.y = player->actor.world.pos.y + 40.0f + 10.0f; - this->unk_3A4.z = player->actor.world.pos.z + 20.0f + 10.0f; - this->unk_3B0.x = player->actor.world.pos.x - 20.0f; - this->unk_3B0.y = ((player->actor.world.pos.y + 10.0f + 60.0f) - 20.0f) - 3.0f; - this->unk_3B0.z = (player->actor.world.pos.z - 40.0f) - 10.0f; + this->subCamEye.x = (player->actor.world.pos.x - 40.0f) + 80.0f; + this->subCamEye.y = player->actor.world.pos.y + 40.0f + 10.0f; + this->subCamEye.z = player->actor.world.pos.z + 20.0f + 10.0f; + this->subCamAt.x = player->actor.world.pos.x - 20.0f; + this->subCamAt.y = ((player->actor.world.pos.y + 10.0f + 60.0f) - 20.0f) - 3.0f; + this->subCamAt.z = (player->actor.world.pos.z - 40.0f) - 10.0f; if (this->unk_398 == 10) { BossGanon2Effect* effects = globalCtx->specialEffects; @@ -777,13 +777,13 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { break; } case 26: - this->unk_3A4.x = sZelda->actor.world.pos.x + 100.0f + 30.0f; - this->unk_3A4.y = sZelda->actor.world.pos.y + 10.0f; - this->unk_3A4.z = sZelda->actor.world.pos.z + 5.0f; - this->unk_3B0.x = sZelda->actor.world.pos.x; - this->unk_3B0.y = sZelda->actor.world.pos.y + 30.0f; - this->unk_3B0.z = sZelda->actor.world.pos.z - 20.0f; - this->unk_3BC.z = -0.5f; + this->subCamEye.x = sZelda->actor.world.pos.x + 100.0f + 30.0f; + this->subCamEye.y = sZelda->actor.world.pos.y + 10.0f; + this->subCamEye.z = sZelda->actor.world.pos.z + 5.0f; + this->subCamAt.x = sZelda->actor.world.pos.x; + this->subCamAt.y = sZelda->actor.world.pos.y + 30.0f; + this->subCamAt.z = sZelda->actor.world.pos.z - 20.0f; + this->subCamUp.z = -0.5f; if (this->unk_398 == 13) { sZelda->unk_3C8 = 6; } @@ -793,26 +793,26 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { } break; case 27: - this->unk_3BC.z = 0.0f; + this->subCamUp.z = 0.0f; if (this->unk_398 == 4) { func_8002DF54(globalCtx, &this->actor, 0x58); } - this->unk_3A4.x = player->actor.world.pos.x - 20.0f; - this->unk_3A4.y = player->actor.world.pos.y + 50.0f; - this->unk_3A4.z = player->actor.world.pos.z; - this->unk_3B0.x = player->actor.world.pos.x; - this->unk_3B0.y = player->actor.world.pos.y + 50.0f; - this->unk_3B0.z = player->actor.world.pos.z; + this->subCamEye.x = player->actor.world.pos.x - 20.0f; + this->subCamEye.y = player->actor.world.pos.y + 50.0f; + this->subCamEye.z = player->actor.world.pos.z; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = player->actor.world.pos.y + 50.0f; + this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 == 26) { D_8090EB30 = globalCtx->actorCtx.actorLists[ACTORCAT_ITEMACTION].head; while (D_8090EB30 != NULL) { if (D_8090EB30->id == ACTOR_EN_ELF) { - this->unk_3A4.x = D_8090EB30->world.pos.x - 30.0f; - this->unk_3A4.y = D_8090EB30->world.pos.y; - this->unk_3A4.z = D_8090EB30->world.pos.z; - this->unk_3B0.x = D_8090EB30->world.pos.x; - this->unk_3B0.y = D_8090EB30->world.pos.y; - this->unk_3B0.z = D_8090EB30->world.pos.z; + this->subCamEye.x = D_8090EB30->world.pos.x - 30.0f; + this->subCamEye.y = D_8090EB30->world.pos.y; + this->subCamEye.z = D_8090EB30->world.pos.z; + this->subCamAt.x = D_8090EB30->world.pos.x; + this->subCamAt.y = D_8090EB30->world.pos.y; + this->subCamAt.z = D_8090EB30->world.pos.z; break; } D_8090EB30 = D_8090EB30->next; @@ -826,12 +826,12 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x70D6, NULL); } if (D_8090EB30 != NULL) { - this->unk_3A4.x = D_8090EB30->world.pos.x - 20.0f; - this->unk_3A4.y = D_8090EB30->world.pos.y; - this->unk_3A4.z = D_8090EB30->world.pos.z; - Math_ApproachF(&this->unk_3B0.x, D_8090EB30->world.pos.x, 0.2f, 50.0f); - Math_ApproachF(&this->unk_3B0.y, D_8090EB30->world.pos.y, 0.2f, 50.0f); - Math_ApproachF(&this->unk_3B0.z, D_8090EB30->world.pos.z, 0.2f, 50.0f); + this->subCamEye.x = D_8090EB30->world.pos.x - 20.0f; + this->subCamEye.y = D_8090EB30->world.pos.y; + this->subCamEye.z = D_8090EB30->world.pos.z; + Math_ApproachF(&this->subCamAt.x, D_8090EB30->world.pos.x, 0.2f, 50.0f); + Math_ApproachF(&this->subCamAt.y, D_8090EB30->world.pos.y, 0.2f, 50.0f); + Math_ApproachF(&this->subCamAt.z, D_8090EB30->world.pos.z, 0.2f, 50.0f); if ((this->unk_398 > 40) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { this->unk_39C = 29; this->unk_398 = 0; @@ -847,12 +847,12 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { break; case 29: SkelAnime_Update(&this->skelAnime); - this->unk_3A4.x = (((this->actor.world.pos.x + 500.0f) - 350.0f) + 100.0f) - 60.0f; - this->unk_3B0.x = this->actor.world.pos.x; - this->unk_3B0.z = this->actor.world.pos.z; - this->unk_3A4.y = this->actor.world.pos.y; - this->unk_3A4.z = this->actor.world.pos.z + 10.0f; - this->unk_3B0.y = (this->unk_1B8.y + 60.0f) - 40.0f; + this->subCamEye.x = (((this->actor.world.pos.x + 500.0f) - 350.0f) + 100.0f) - 60.0f; + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.z = this->actor.world.pos.z; + this->subCamEye.y = this->actor.world.pos.y; + this->subCamEye.z = this->actor.world.pos.z + 10.0f; + this->subCamAt.y = (this->unk_1B8.y + 60.0f) - 40.0f; player->actor.shape.rot.y = -0x4000; player->actor.world.pos.x = 140.0f; player->actor.world.pos.z = -196.0f; @@ -860,13 +860,13 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_ROAR); } if (Animation_OnFrame(&this->skelAnime, this->unk_194)) { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); - camera->eye = this->unk_3A4; - camera->eyeNext = this->unk_3A4; - camera->at = this->unk_3B0; - func_800C08AC(globalCtx, this->unk_39E, 0); - this->unk_39E = 0; + camera->eye = this->subCamEye; + camera->eyeNext = this->subCamEye; + camera->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); this->unk_39C = 0; @@ -883,19 +883,20 @@ void func_808FD5F4(BossGanon2* this, GlobalContext* globalCtx) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_GANON_BODY_SPARK - SFX_FLAG); } - if (this->unk_39E != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { // fake, tricks the compiler into putting some pointers on the stack if (zero) { osSyncPrintf(NULL, 0, 0); } - this->unk_3B0.y += this->unk_41C; - Gameplay_CameraSetAtEyeUp(globalCtx, this->unk_39E, &this->unk_3B0, &this->unk_3A4, &this->unk_3BC); + this->subCamAt.y += this->unk_41C; + Gameplay_CameraSetAtEyeUp(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); } } void func_808FF898(BossGanon2* this, GlobalContext* globalCtx) { - if ((this->unk_312 != 0) && (this->unk_39E == 0)) { + if ((this->unk_312 != 0) && (this->subCamId == SUB_CAM_ID_DONE)) { Actor* actor = globalCtx->actorCtx.actorLists[ACTORCAT_PROP].head; + while (actor != NULL) { if (actor->id == ACTOR_DEMO_GJ) { DemoGj* gj = (DemoGj*)actor; @@ -1269,15 +1270,15 @@ void func_80900818(BossGanon2* this, GlobalContext* globalCtx) { void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { Vec3f sp5C; Vec3f sp50; - Camera* sp4C; + Camera* mainCam1; Player* player; - Camera* temp_v0; - Camera* temp_v0_2; + Camera* mainCam2; + Camera* mainCam3; s32 pad; f32 temp_f12; f32 temp_f2; - sp4C = Gameplay_GetCamera(globalCtx, MAIN_CAM); + mainCam1 = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); player = GET_PLAYER(globalCtx); SkelAnime_Update(&this->skelAnime); this->unk_398++; @@ -1286,13 +1287,13 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { switch (this->unk_39C) { case 0: func_80064520(globalCtx, &globalCtx->csCtx); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); func_8002DF54(globalCtx, &this->actor, 8); this->unk_39C = 1; - this->unk_3A4 = sp4C->eye; - this->unk_3B0 = sp4C->at; + this->subCamEye = mainCam1->eye; + this->subCamAt = mainCam1->at; this->unk_1A2[0] = 300; this->unk_1A2[1] = 100; globalCtx->envCtx.unk_D8 = 0.0f; @@ -1305,12 +1306,12 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { sp5C.y = 0.0f; sp5C.z = 250.0f; Matrix_MultVec3f(&sp5C, &sp50); - Math_ApproachF(&this->unk_3A4.x, this->actor.world.pos.x + sp50.x, 0.2f, 100.0f); - Math_ApproachF(&this->unk_3A4.y, 1136.0f, 0.2f, 100.0f); - Math_ApproachF(&this->unk_3A4.z, this->actor.world.pos.z + sp50.z, 0.2f, 100.0f); - Math_ApproachF(&this->unk_3B0.x, this->unk_1B8.x, 0.2f, 100.0f); - Math_ApproachF(&this->unk_3B0.y, this->unk_1B8.y, 0.2f, 100.0f); - Math_ApproachF(&this->unk_3B0.z, this->unk_1B8.z, 0.2f, 100.0f); + Math_ApproachF(&this->subCamEye.x, this->actor.world.pos.x + sp50.x, 0.2f, 100.0f); + Math_ApproachF(&this->subCamEye.y, 1136.0f, 0.2f, 100.0f); + Math_ApproachF(&this->subCamEye.z, this->actor.world.pos.z + sp50.z, 0.2f, 100.0f); + Math_ApproachF(&this->subCamAt.x, this->unk_1B8.x, 0.2f, 100.0f); + Math_ApproachF(&this->subCamAt.y, this->unk_1B8.y, 0.2f, 100.0f); + Math_ApproachF(&this->subCamAt.z, this->unk_1B8.z, 0.2f, 100.0f); if (this->unk_1A2[1] == 0) { this->unk_39C = 2; this->unk_1A2[1] = 90; @@ -1318,24 +1319,24 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { break; case 2: this->unk_1A2[0] = 300; - this->unk_3A4.x = sZelda->actor.world.pos.x - 100.0f; - this->unk_3A4.y = sZelda->actor.world.pos.y + 30.0f; - this->unk_3A4.z = (sZelda->actor.world.pos.z + 30.0f) - 60.0f; - this->unk_3B0.x = sZelda->actor.world.pos.x; - this->unk_3B0.y = sZelda->actor.world.pos.y + 30.0f; - this->unk_3B0.z = sZelda->actor.world.pos.z - 10.0f; + this->subCamEye.x = sZelda->actor.world.pos.x - 100.0f; + this->subCamEye.y = sZelda->actor.world.pos.y + 30.0f; + this->subCamEye.z = (sZelda->actor.world.pos.z + 30.0f) - 60.0f; + this->subCamAt.x = sZelda->actor.world.pos.x; + this->subCamAt.y = sZelda->actor.world.pos.y + 30.0f; + this->subCamAt.z = sZelda->actor.world.pos.z - 10.0f; Math_ApproachZeroF(&this->unk_324, 1.0f, 5.0f); Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 1.0f / 51); if (this->unk_1A2[1] == 80) { Message_StartTextbox(globalCtx, 0x70D7, NULL); } if ((this->unk_1A2[1] < 30) && (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { - temp_v0 = Gameplay_GetCamera(globalCtx, MAIN_CAM); - temp_v0->eye = this->unk_3A4; - temp_v0->eyeNext = this->unk_3A4; - temp_v0->at = this->unk_3B0; - func_800C08AC(globalCtx, this->unk_39E, 0); - this->unk_39E = 0; + mainCam2 = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam2->eye = this->subCamEye; + mainCam2->eyeNext = this->subCamEye; + mainCam2->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); this->unk_39C = 3; @@ -1343,9 +1344,9 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { break; case 10: func_80064520(globalCtx, &globalCtx->csCtx); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->unk_39C = 11; this->unk_334 = 1; func_8002DF54(globalCtx, &this->actor, 0x60); @@ -1354,28 +1355,28 @@ void func_80900890(BossGanon2* this, GlobalContext* globalCtx) { player->actor.world.pos.x = sZelda->actor.world.pos.x + 50.0f + 10.0f; player->actor.world.pos.z = sZelda->actor.world.pos.z - 25.0f; player->actor.shape.rot.y = -0x8000; - this->unk_3A4.x = (player->actor.world.pos.x + 100.0f) - 80.0f; - this->unk_3A4.y = (player->actor.world.pos.y + 60.0f) - 40.0f; - this->unk_3A4.z = player->actor.world.pos.z - 110.0f; - this->unk_3B0.x = player->actor.world.pos.x; - this->unk_3B0.y = (player->actor.world.pos.y + 60.0f) - 25.0f; - this->unk_3B0.z = player->actor.world.pos.z; + this->subCamEye.x = (player->actor.world.pos.x + 100.0f) - 80.0f; + this->subCamEye.y = (player->actor.world.pos.y + 60.0f) - 40.0f; + this->subCamEye.z = player->actor.world.pos.z - 110.0f; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = (player->actor.world.pos.y + 60.0f) - 25.0f; + this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 == 80) { - temp_v0_2 = Gameplay_GetCamera(globalCtx, MAIN_CAM); - temp_v0_2->eye = this->unk_3A4; - temp_v0_2->eyeNext = this->unk_3A4; - temp_v0_2->at = this->unk_3B0; + mainCam3 = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam3->eye = this->subCamEye; + mainCam3->eyeNext = this->subCamEye; + mainCam3->at = this->subCamAt; this->unk_39C = 3; - func_800C08AC(globalCtx, this->unk_39E, 0); - this->unk_39E = 0; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); } break; } - if (this->unk_39E != 0) { - Gameplay_CameraSetAtEye(globalCtx, this->unk_39E, &this->unk_3B0, &this->unk_3A4); + if (this->subCamId != SUB_CAM_ID_DONE) { + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } switch (this->unk_1AC) { @@ -1455,7 +1456,7 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { Player* player; f32 temp_f14; f32 temp_f12; - Camera* temp_v0_2; + Camera* mainCam; s16 temp_a0_2; f32 phi_f0; s32 phi_a1; @@ -1464,16 +1465,16 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_398++; SkelAnime_Update(&this->skelAnime); - this->unk_3BC.x = 0.0f; - this->unk_3BC.y = 1.0f; - this->unk_3BC.z = 0.0f; + this->subCamUp.x = 0.0f; + this->subCamUp.y = 1.0f; + this->subCamUp.z = 0.0f; switch (this->unk_39C) { case 0: func_80064520(globalCtx, &globalCtx->csCtx); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); func_8002DF54(globalCtx, &this->actor, 8); this->unk_39C = 1; this->unk_398 = 0; @@ -1520,12 +1521,12 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { sZelda->actor.world.pos.x = 340.0f; sZelda->actor.world.pos.z = -250.0f; sZelda->actor.world.rot.y = sZelda->actor.shape.rot.y = -0x2000; - this->unk_3A4.x = 250; - this->unk_3A4.y = 1150.0f; - this->unk_3A4.z = 0.0f; - this->unk_3B0.x = this->unk_1B8.x; - this->unk_3B0.y = this->unk_1B8.y; - this->unk_3B0.z = this->unk_1B8.z; + this->subCamEye.x = 250; + this->subCamEye.y = 1150.0f; + this->subCamEye.z = 0.0f; + this->subCamAt.x = this->unk_1B8.x; + this->subCamAt.y = this->unk_1B8.y; + this->subCamAt.z = this->unk_1B8.z; if (this->unk_398 > 135) { this->unk_39C = 2; this->unk_398 = 0; @@ -1535,12 +1536,12 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_339 = 22; Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.1f); func_80078884(NA_SE_EV_TIMETRIP_LIGHT - SFX_FLAG); - this->unk_3A4.x = 250; - this->unk_3A4.y = 1150.0f; - this->unk_3A4.z = 0.0f; - Math_ApproachF(&this->unk_3B0.x, sZelda->actor.world.pos.x, 0.2f, 20.0f); - Math_ApproachF(&this->unk_3B0.y, sZelda->actor.world.pos.y + 50.0f, 0.2f, 10.0f); - Math_ApproachF(&this->unk_3B0.z, sZelda->actor.world.pos.z, 0.2f, 20.0f); + this->subCamEye.x = 250; + this->subCamEye.y = 1150.0f; + this->subCamEye.z = 0.0f; + Math_ApproachF(&this->subCamAt.x, sZelda->actor.world.pos.x, 0.2f, 20.0f); + Math_ApproachF(&this->subCamAt.y, sZelda->actor.world.pos.y + 50.0f, 0.2f, 10.0f); + Math_ApproachF(&this->subCamAt.z, sZelda->actor.world.pos.z, 0.2f, 20.0f); if (this->unk_398 == 50) { this->unk_39C = 3; this->unk_398 = 0; @@ -1549,12 +1550,12 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { case 3: this->unk_339 = 22; func_80078884(NA_SE_EV_TIMETRIP_LIGHT - SFX_FLAG); - this->unk_3A4.x = 330.0f; - this->unk_3A4.y = 1120.0f; - this->unk_3A4.z = -150.0f; - this->unk_3B0.x = sZelda->actor.world.pos.x; - this->unk_3B0.y = sZelda->actor.world.pos.y + 40.0f; - this->unk_3B0.z = sZelda->actor.world.pos.z; + this->subCamEye.x = 330.0f; + this->subCamEye.y = 1120.0f; + this->subCamEye.z = -150.0f; + this->subCamAt.x = sZelda->actor.world.pos.x; + this->subCamAt.y = sZelda->actor.world.pos.y + 40.0f; + this->subCamAt.z = sZelda->actor.world.pos.z; if (this->unk_398 == 10) { Message_StartTextbox(globalCtx, 0x70D8, NULL); } @@ -1600,19 +1601,19 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_30C = 10.0f; player->actor.world.pos.x = 250.0f; player->actor.world.pos.z = 30.0f; - this->unk_3A4.x = player->actor.world.pos.x - 50.0f; - this->unk_3A4.y = player->actor.world.pos.y + 50.0f; - this->unk_3A4.z = player->actor.world.pos.z + 40.0f; - this->unk_3B0.x = player->actor.world.pos.x; - this->unk_3B0.y = player->actor.world.pos.y + 40.0f; - this->unk_3B0.z = player->actor.world.pos.z; + this->subCamEye.x = player->actor.world.pos.x - 50.0f; + this->subCamEye.y = player->actor.world.pos.y + 50.0f; + this->subCamEye.z = player->actor.world.pos.z + 40.0f; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = player->actor.world.pos.y + 40.0f; + this->subCamAt.z = player->actor.world.pos.z; if (this->unk_398 == 166) { - temp_v0_2 = Gameplay_GetCamera(globalCtx, MAIN_CAM); - temp_v0_2->eye = this->unk_3A4; - temp_v0_2->eyeNext = this->unk_3A4; - temp_v0_2->at = this->unk_3B0; - func_800C08AC(globalCtx, this->unk_39E, 0); - this->unk_39E = 0; + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); this->unk_39C = 6; @@ -1626,9 +1627,9 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { if ((ABS(temp_a0_2) < 0x2000) && (sqrtf(SQ(temp_f14) + SQ(temp_f12)) < 70.0f) && (player->meleeWeaponState != 0) && (player->heldItemActionParam == PLAYER_AP_SWORD_MASTER)) { func_80064520(globalCtx, &globalCtx->csCtx); - this->unk_39E = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_39E, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->unk_39C = 7; this->unk_398 = 0; Animation_MorphToPlayOnce(&this->skelAnime, &object_ganon2_Anim_003B1C, 0.0f); @@ -1656,42 +1657,42 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { func_8090109C(this, globalCtx); } if ((this->unk_398 >= 34) && (this->unk_398 < 40)) { - this->unk_3A4.x = 269.0f; - this->unk_3A4.y = 1112.0f; - this->unk_3A4.z = -28.0f; - this->unk_3B0.x = 234.0f; - this->unk_3B0.y = 1117.0f; - this->unk_3B0.z = -11.0f; + this->subCamEye.x = 269.0f; + this->subCamEye.y = 1112.0f; + this->subCamEye.z = -28.0f; + this->subCamAt.x = 234.0f; + this->subCamAt.y = 1117.0f; + this->subCamAt.z = -11.0f; } else { if (this->unk_398 < 30) { phi_a1 = 0; } else if (this->unk_398 < 43) { phi_a1 = 1; } else { - this->unk_3BC.z = -0.8f; + this->subCamUp.z = -0.8f; player->actor.world.pos.x = 200.0f; player->actor.world.pos.z = 10.0f; phi_a1 = 2; } - this->unk_3A4.x = D_8090702C[phi_a1].x + (player->actor.world.pos.x - 50.0f); - this->unk_3A4.y = D_8090702C[phi_a1].y + (player->actor.world.pos.y + 50.0f); - this->unk_3A4.z = D_8090702C[phi_a1].z + (player->actor.world.pos.z + 40.0f); - this->unk_3B0.x = D_80907050[phi_a1].x + player->actor.world.pos.x; - this->unk_3B0.y = D_80907050[phi_a1].y + (player->actor.world.pos.y + 40.0f); - this->unk_3B0.z = D_80907050[phi_a1].z + player->actor.world.pos.z; + this->subCamEye.x = D_8090702C[phi_a1].x + (player->actor.world.pos.x - 50.0f); + this->subCamEye.y = D_8090702C[phi_a1].y + (player->actor.world.pos.y + 50.0f); + this->subCamEye.z = D_8090702C[phi_a1].z + (player->actor.world.pos.z + 40.0f); + this->subCamAt.x = D_80907050[phi_a1].x + player->actor.world.pos.x; + this->subCamAt.y = D_80907050[phi_a1].y + (player->actor.world.pos.y + 40.0f); + this->subCamAt.z = D_80907050[phi_a1].z + player->actor.world.pos.z; } if (this->unk_398 > 80) { Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); this->unk_39C = 75; this->unk_398 = 0; - this->unk_3A4.x = 112.0f; - this->unk_3A4.y = 1146.0f; - this->unk_3A4.z = 202.0f; - this->unk_3B0.x = 110.0f; - this->unk_3B0.y = 1144.0f; - this->unk_3B0.z = 177.0f; + this->subCamEye.x = 112.0f; + this->subCamEye.y = 1146.0f; + this->subCamEye.z = 202.0f; + this->subCamAt.x = 110.0f; + this->subCamAt.y = 1144.0f; + this->subCamAt.z = 177.0f; player->actor.world.pos.x = 200.0f; - this->unk_3BC.z = 0.0f; + this->subCamUp.z = 0.0f; } break; case 75: @@ -1726,12 +1727,12 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { this->unk_398 = 0; this->unk_194 = 1000.0f; } - this->unk_3A4.x = 250; - this->unk_3A4.y = 1150.0f; - this->unk_3A4.z = 0.0f; - this->unk_3B0.x = this->unk_1B8.x; - this->unk_3B0.y = this->unk_1B8.y; - this->unk_3B0.z = this->unk_1B8.z; + this->subCamEye.x = 250; + this->subCamEye.y = 1150.0f; + this->subCamEye.z = 0.0f; + this->subCamAt.x = this->unk_1B8.x; + this->subCamAt.y = this->unk_1B8.y; + this->subCamAt.z = this->unk_1B8.z; if ((this->unk_398 < 1000) && ((this->unk_398 % 16) == 0)) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MGANON_SWORD); } @@ -1746,12 +1747,12 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { break; case 9: this->unk_339 = 24; - this->unk_3A4.x = 330.0f; - this->unk_3A4.y = 1120.0f; - this->unk_3A4.z = -150.0f; - this->unk_3B0.x = sZelda->actor.world.pos.x; - this->unk_3B0.y = sZelda->actor.world.pos.y + 40.0f; - this->unk_3B0.z = sZelda->actor.world.pos.z; + this->subCamEye.x = 330.0f; + this->subCamEye.y = 1120.0f; + this->subCamEye.z = -150.0f; + this->subCamAt.x = sZelda->actor.world.pos.x; + this->subCamAt.y = sZelda->actor.world.pos.y + 40.0f; + this->subCamAt.z = sZelda->actor.world.pos.z; if (this->unk_398 > 60) { this->unk_39C = 10; this->unk_398 = 0; @@ -1760,9 +1761,9 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { break; case 10: this->unk_339 = 24; - Math_ApproachF(&this->unk_3A4.x, 290.0f, 0.05f, this->unk_410.x); - Math_ApproachF(&this->unk_3A4.y, 1130.0f, 0.05f, this->unk_410.x * 0.25f); - Math_ApproachF(&this->unk_3A4.z, -260.0f, 0.05f, this->unk_410.x * 1.25f); + Math_ApproachF(&this->subCamEye.x, 290.0f, 0.05f, this->unk_410.x); + Math_ApproachF(&this->subCamEye.y, 1130.0f, 0.05f, this->unk_410.x * 0.25f); + Math_ApproachF(&this->subCamEye.z, -260.0f, 0.05f, this->unk_410.x * 1.25f); if ((this->unk_398 >= 40) && (this->unk_398 <= 110)) { Math_ApproachF(&globalCtx->envCtx.unk_D8, 1.0f, 1.0f, 0.02f); Math_ApproachF(&this->unk_384, 10.0f, 0.1f, 0.2f); @@ -1771,10 +1772,10 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { Math_ApproachZeroF(&this->unk_384, 1.0f, 0.2f); } if (this->unk_398 > 130) { - Math_ApproachF(&this->unk_3B0.y, (sZelda->actor.world.pos.y + 40.0f + 10.0f) - 20.0f, 0.1f, + Math_ApproachF(&this->subCamAt.y, (sZelda->actor.world.pos.y + 40.0f + 10.0f) - 20.0f, 0.1f, this->unk_410.x); } else { - Math_ApproachF(&this->unk_3B0.y, sZelda->actor.world.pos.y + 40.0f + 10.0f, 0.05f, + Math_ApproachF(&this->subCamAt.y, sZelda->actor.world.pos.y + 40.0f + 10.0f, 0.05f, this->unk_410.x * 0.25f); } Math_ApproachF(&this->unk_410.x, 1.0f, 1.0f, 0.01f); @@ -1799,8 +1800,8 @@ void func_8090120C(BossGanon2* this, GlobalContext* globalCtx) { break; } - if (this->unk_39E != 0) { - Gameplay_CameraSetAtEyeUp(globalCtx, this->unk_39E, &this->unk_3B0, &this->unk_3A4, &this->unk_3BC); + if (this->subCamId != SUB_CAM_ID_DONE) { + Gameplay_CameraSetAtEyeUp(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); } switch (this->unk_1AC) { @@ -2056,7 +2057,7 @@ void BossGanon2_Update(Actor* thisx, GlobalContext* globalCtx) { CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_424.base); CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &this->unk_444.base); CollisionCheck_SetAC(globalCtx, &globalCtx->colChkCtx, &this->unk_444.base); - if (this->unk_39E == 0) { + if (this->subCamId == SUB_CAM_ID_DONE) { CollisionCheck_SetAT(globalCtx, &globalCtx->colChkCtx, &this->unk_444.base); } } diff --git a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h index 3d26252311..389cdecc2f 100644 --- a/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h +++ b/src/overlays/actors/ovl_Boss_Ganon2/z_boss_ganon2.h @@ -79,11 +79,11 @@ typedef struct BossGanon2 { /* 0x0394 */ f32 unk_394; /* 0x0398 */ u32 unk_398; /* 0x039C */ s16 unk_39C; - /* 0x039E */ s16 unk_39E; + /* 0x039E */ s16 subCamId; /* 0x03A0 */ char unk_3A0[0x4]; - /* 0x03A4 */ Vec3f unk_3A4; - /* 0x03B0 */ Vec3f unk_3B0; - /* 0x03BC */ Vec3f unk_3BC; + /* 0x03A4 */ Vec3f subCamEye; + /* 0x03B0 */ Vec3f subCamAt; + /* 0x03BC */ Vec3f subCamUp; /* 0x03C8 */ char unk_3C8[0x48]; /* 0x0410 */ Vec3f unk_410; /* 0x041C */ f32 unk_41C; diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c index cedfb34f15..724befa434 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.c @@ -942,7 +942,7 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { f32 camZ; f32 pad; Player* player = GET_PLAYER(globalCtx); - Camera* camera = Gameplay_GetCamera(globalCtx, 0); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); osSyncPrintf("PYP %f\n", player->actor.floorHeight); SkelAnime_Update(&this->skelAnime); @@ -956,35 +956,35 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { case DEATH_START: func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 1); - this->deathCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); osSyncPrintf("7\n"); - Gameplay_ChangeCameraStatus(globalCtx, this->deathCamera, CAM_STAT_ACTIVE); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); osSyncPrintf("8\n"); this->deathState = DEATH_THROES; player->actor.speedXZ = 0.0f; this->timers[0] = 50; - this->cameraEye = camera->eye; - this->cameraAt = camera->at; - this->cameraNextEye.x = this->targetPos.x; - this->cameraNextEye.y = GND_BOSSROOM_CENTER_Y + 83.0f; - this->cameraNextEye.z = (this->targetPos.z + 100.0f) + 50; - this->cameraNextAt.x = this->targetPos.x; - this->cameraNextAt.y = this->targetPos.y - 10.0f; - this->cameraNextAt.z = this->targetPos.z; - this->cameraEyeVel.x = fabsf(camera->eye.x - this->cameraNextEye.x); - this->cameraEyeVel.y = fabsf(camera->eye.y - this->cameraNextEye.y); - this->cameraEyeVel.z = fabsf(camera->eye.z - this->cameraNextEye.z); - this->cameraAtVel.x = fabsf(camera->at.x - this->cameraNextAt.x); - this->cameraAtVel.y = fabsf(camera->at.y - this->cameraNextAt.y); - this->cameraAtVel.z = fabsf(camera->at.z - this->cameraNextAt.z); - this->cameraAccel = 0.02f; - this->cameraEyeMaxVel.x = this->cameraEyeMaxVel.y = this->cameraEyeMaxVel.z = 0.05f; + this->subCamEye = mainCam->eye; + this->subCamAt = mainCam->at; + this->subCamEyeNext.x = this->targetPos.x; + this->subCamEyeNext.y = GND_BOSSROOM_CENTER_Y + 83.0f; + this->subCamEyeNext.z = (this->targetPos.z + 100.0f) + 50; + this->subCamAtNext.x = this->targetPos.x; + this->subCamAtNext.y = this->targetPos.y - 10.0f; + this->subCamAtNext.z = this->targetPos.z; + this->subCamEyeVel.x = fabsf(mainCam->eye.x - this->subCamEyeNext.x); + this->subCamEyeVel.y = fabsf(mainCam->eye.y - this->subCamEyeNext.y); + this->subCamEyeVel.z = fabsf(mainCam->eye.z - this->subCamEyeNext.z); + this->subCamAtVel.x = fabsf(mainCam->at.x - this->subCamAtNext.x); + this->subCamAtVel.y = fabsf(mainCam->at.y - this->subCamAtNext.y); + this->subCamAtVel.z = fabsf(mainCam->at.z - this->subCamAtNext.z); + this->subCamAccel = 0.02f; + this->subCamEyeMaxVelFrac.x = this->subCamEyeMaxVelFrac.y = this->subCamEyeMaxVelFrac.z = 0.05f; this->work[GND_ACTION_STATE] = DEATH_SPASM; this->timers[0] = 150; - this->cameraAtMaxVel.x = 0.2f; - this->cameraAtMaxVel.y = 0.2f; - this->cameraAtMaxVel.z = 0.2f; + this->subCamAtMaxVelFrac.x = 0.2f; + this->subCamAtMaxVelFrac.y = 0.2f; + this->subCamAtMaxVelFrac.z = 0.2f; case DEATH_THROES: switch (this->work[GND_ACTION_STATE]) { case DEATH_SPASM: @@ -1006,18 +1006,18 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { break; } Math_ApproachS(&this->actor.shape.rot.y, this->work[GND_VARIANCE_TIMER] * -100, 5, 0xBB8); - Math_ApproachF(&this->cameraNextEye.z, this->targetPos.z + 60.0f, 0.02f, 0.5f); + Math_ApproachF(&this->subCamEyeNext.z, this->targetPos.z + 60.0f, 0.02f, 0.5f); Math_ApproachF(&this->actor.world.pos.y, GND_BOSSROOM_CENTER_Y + 133.0f, 0.05f, 100.0f); this->actor.world.pos.y += Math_SinS(this->work[GND_VARIANCE_TIMER] * 1500); - this->cameraNextAt.x = this->targetPos.x; - this->cameraNextAt.y = this->targetPos.y - 10.0f; - this->cameraNextAt.z = this->targetPos.z; + this->subCamAtNext.x = this->targetPos.x; + this->subCamAtNext.y = this->targetPos.y - 10.0f; + this->subCamAtNext.z = this->targetPos.z; if (this->timers[0] == 0) { this->deathState = DEATH_WARP; this->timers[0] = 350; this->timers[1] = 50; this->fwork[GND_CAMERA_ZOOM] = 300.0f; - this->cameraNextEye.y = GND_BOSSROOM_CENTER_Y + 233.0f; + this->subCamEyeNext.y = GND_BOSSROOM_CENTER_Y + 233.0f; player->actor.world.pos.x = GND_BOSSROOM_CENTER_X - 200.0f; player->actor.world.pos.z = GND_BOSSROOM_CENTER_Z; holdCamera = true; @@ -1040,13 +1040,13 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { this->fwork[GND_CAMERA_ANGLE] += 0x78; camX = Math_SinS(this->fwork[GND_CAMERA_ANGLE]) * this->fwork[GND_CAMERA_ZOOM]; camZ = Math_CosS(this->fwork[GND_CAMERA_ANGLE]) * this->fwork[GND_CAMERA_ZOOM]; - this->cameraEye.x = GND_BOSSROOM_CENTER_X + camX; - this->cameraEye.y = this->cameraNextEye.y; - this->cameraEye.z = GND_BOSSROOM_CENTER_Z + camZ; - this->cameraAt.x = GND_BOSSROOM_CENTER_X; - this->cameraAt.y = GND_BOSSROOM_CENTER_Y + 23.0f; - this->cameraAt.z = GND_BOSSROOM_CENTER_Z; - Math_ApproachF(&this->cameraNextEye.y, GND_BOSSROOM_CENTER_Y + 33.0f, 0.05f, 0.5f); + this->subCamEye.x = GND_BOSSROOM_CENTER_X + camX; + this->subCamEye.y = this->subCamEyeNext.y; + this->subCamEye.z = GND_BOSSROOM_CENTER_Z + camZ; + this->subCamAt.x = GND_BOSSROOM_CENTER_X; + this->subCamAt.y = GND_BOSSROOM_CENTER_Y + 23.0f; + this->subCamAt.z = GND_BOSSROOM_CENTER_Z; + Math_ApproachF(&this->subCamEyeNext.y, GND_BOSSROOM_CENTER_Y + 33.0f, 0.05f, 0.5f); Math_ApproachF(&this->fwork[GND_CAMERA_ZOOM], 170.0f, 0.05f, 1.0f); Math_ApproachF(&this->actor.world.pos.x, GND_BOSSROOM_CENTER_X, 0.05f, 1.5f); Math_ApproachF(&this->actor.world.pos.y, GND_BOSSROOM_CENTER_Y + 83.0f, 0.05f, 1.0f); @@ -1070,12 +1070,12 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { holdCamera = true; bodyDecayLevel = 2; this->actor.world.pos.y = GND_BOSSROOM_CENTER_Y + 83.0f; - this->cameraEye.x = GND_BOSSROOM_CENTER_X; - this->cameraEye.y = GND_BOSSROOM_CENTER_Y + 83.0f; - this->cameraEye.z = GND_BOSSROOM_CENTER_Z + 50.0f; - this->cameraAt.x = GND_BOSSROOM_CENTER_X; - this->cameraAt.y = GND_BOSSROOM_CENTER_Y + 103.0f; - this->cameraAt.z = GND_BOSSROOM_CENTER_Z; + this->subCamEye.x = GND_BOSSROOM_CENTER_X; + this->subCamEye.y = GND_BOSSROOM_CENTER_Y + 83.0f; + this->subCamEye.z = GND_BOSSROOM_CENTER_Z + 50.0f; + this->subCamAt.x = GND_BOSSROOM_CENTER_X; + this->subCamAt.y = GND_BOSSROOM_CENTER_Y + 103.0f; + this->subCamAt.z = GND_BOSSROOM_CENTER_Z; if (this->timers[0] == 0) { this->deathState = DEATH_DISINTEGRATE; Animation_MorphToPlayOnce(&this->skelAnime, &gPhantomGanonLastPoseAnim, -10.0f); @@ -1086,9 +1086,9 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { case DEATH_DISINTEGRATE: holdCamera = true; bodyDecayLevel = 3; - Math_ApproachZeroF(&this->cameraEye.y, 0.05f, 1.0f); // approaches GND_BOSSROOM_CENTER_Y + 33.0f - Math_ApproachF(&this->cameraEye.z, GND_BOSSROOM_CENTER_Z + 170.0f, 0.05f, 2.0f); - Math_ApproachF(&this->cameraAt.y, GND_BOSSROOM_CENTER_Y + 53.0f, 0.05f, 1.0f); + Math_ApproachZeroF(&this->subCamEye.y, 0.05f, 1.0f); // approaches GND_BOSSROOM_CENTER_Y + 33.0f + Math_ApproachF(&this->subCamEye.z, GND_BOSSROOM_CENTER_Z + 170.0f, 0.05f, 2.0f); + Math_ApproachF(&this->subCamAt.y, GND_BOSSROOM_CENTER_Y + 53.0f, 0.05f, 1.0f); if (this->timers[0] == 0) { this->timers[0] = 250; this->deathState = DEATH_FINISH; @@ -1103,17 +1103,17 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { GND_BOSSROOM_CENTER_Y, GND_BOSSROOM_CENTER_Z, 0, 0, 0, WARP_DUNGEON_ADULT); } - Math_ApproachZeroF(&this->cameraEye.y, 0.05f, 1.0f); // GND_BOSSROOM_CENTER_Y + 33.0f - Math_ApproachF(&this->cameraEye.z, GND_BOSSROOM_CENTER_Z + 170.0f, 0.05f, 2.0f); - Math_ApproachF(&this->cameraAt.y, GND_BOSSROOM_CENTER_Y + 53.0f, 0.05f, 1.0f); + Math_ApproachZeroF(&this->subCamEye.y, 0.05f, 1.0f); // GND_BOSSROOM_CENTER_Y + 33.0f + Math_ApproachF(&this->subCamEye.z, GND_BOSSROOM_CENTER_Z + 170.0f, 0.05f, 2.0f); + Math_ApproachF(&this->subCamAt.y, GND_BOSSROOM_CENTER_Y + 53.0f, 0.05f, 1.0f); if (this->timers[0] == 0) { EnfHG* horse = (EnfHG*)this->actor.child; - camera->eye = this->cameraEye; - camera->eyeNext = this->cameraEye; - camera->at = this->cameraAt; - func_800C08AC(globalCtx, this->deathCamera, 0); - this->deathCamera = 0; + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, GND_BOSSROOM_CENTER_X, @@ -1198,24 +1198,24 @@ void BossGanondrof_Death(BossGanondrof* this, GlobalContext* globalCtx) { } } - if (this->deathCamera != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { if (!holdCamera) { - Math_ApproachF(&this->cameraEye.x, this->cameraNextEye.x, this->cameraEyeMaxVel.x, - this->cameraEyeVel.x * this->cameraSpeedMod); - Math_ApproachF(&this->cameraEye.y, this->cameraNextEye.y, this->cameraEyeMaxVel.y, - this->cameraEyeVel.y * this->cameraSpeedMod); - Math_ApproachF(&this->cameraEye.z, this->cameraNextEye.z, this->cameraEyeMaxVel.z, - this->cameraEyeVel.z * this->cameraSpeedMod); - Math_ApproachF(&this->cameraAt.x, this->cameraNextAt.x, this->cameraAtMaxVel.x, - this->cameraAtVel.x * this->cameraSpeedMod); - Math_ApproachF(&this->cameraAt.y, this->cameraNextAt.y, this->cameraAtMaxVel.y, - this->cameraAtVel.y * this->cameraSpeedMod); - Math_ApproachF(&this->cameraAt.z, this->cameraNextAt.z, this->cameraAtMaxVel.z, - this->cameraAtVel.z * this->cameraSpeedMod); - Math_ApproachF(&this->cameraSpeedMod, 1.0f, 1.0f, this->cameraAccel); + Math_ApproachF(&this->subCamEye.x, this->subCamEyeNext.x, this->subCamEyeMaxVelFrac.x, + this->subCamEyeVel.x * this->subCamVelFactor); + Math_ApproachF(&this->subCamEye.y, this->subCamEyeNext.y, this->subCamEyeMaxVelFrac.y, + this->subCamEyeVel.y * this->subCamVelFactor); + Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, this->subCamEyeMaxVelFrac.z, + this->subCamEyeVel.z * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, this->subCamAtMaxVelFrac.x, + this->subCamAtVel.x * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, this->subCamAtMaxVelFrac.y, + this->subCamAtVel.y * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, this->subCamAtMaxVelFrac.z, + this->subCamAtVel.z * this->subCamVelFactor); + Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, this->subCamAccel); } - Gameplay_CameraSetAtEye(globalCtx, this->deathCamera, &this->cameraAt, &this->cameraEye); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } } diff --git a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h index 5621821a1d..4afed3718a 100644 --- a/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h +++ b/src/overlays/actors/ovl_Boss_Ganondrof/z_boss_ganondrof.h @@ -76,18 +76,18 @@ typedef struct BossGanondrof { /* 0x0200 */ Vec3f spearTip; /* 0x020C */ Vec3f targetPos; /* 0x0218 */ Vec3f bodyPartsPos[27]; // only 25 used - /* 0x035C */ s16 deathCamera; + /* 0x035C */ s16 subCamId; /* 0x035E */ s16 deathState; - /* 0x0360 */ Vec3f cameraEye; - /* 0x036C */ Vec3f cameraAt; - /* 0x0378 */ Vec3f cameraEyeVel; - /* 0x0384 */ Vec3f cameraAtVel; - /* 0x0390 */ Vec3f cameraNextEye; - /* 0x039C */ Vec3f cameraEyeMaxVel; - /* 0x03A8 */ Vec3f cameraNextAt; - /* 0x03B4 */ Vec3f cameraAtMaxVel; - /* 0x03C0 */ f32 cameraSpeedMod; - /* 0x03C4 */ f32 cameraAccel; + /* 0x0360 */ Vec3f subCamEye; + /* 0x036C */ Vec3f subCamAt; + /* 0x0378 */ Vec3f subCamEyeVel; + /* 0x0384 */ Vec3f subCamAtVel; + /* 0x0390 */ Vec3f subCamEyeNext; + /* 0x039C */ Vec3f subCamEyeMaxVelFrac; + /* 0x03A8 */ Vec3f subCamAtNext; + /* 0x03B4 */ Vec3f subCamAtMaxVelFrac; + /* 0x03C0 */ f32 subCamVelFactor; + /* 0x03C4 */ f32 subCamAccel; /* 0x03C8 */ f32 legRotY; /* 0x03CC */ f32 legRotZ; /* 0x03D0 */ f32 legSplitY; diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c index 102b133895..75cf395f3d 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.c @@ -621,17 +621,16 @@ void BossGoma_UpdateCeilingMovement(BossGoma* this, GlobalContext* globalCtx, f3 void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { Player* player; - Camera* camera; + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); - camera = Gameplay_GetCamera(globalCtx, 0); player = GET_PLAYER(globalCtx); this->actionState = 4; this->actor.flags |= ACTOR_FLAG_0; func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 1); - this->subCameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, 3); - Gameplay_ChangeCameraStatus(globalCtx, this->subCameraId, 7); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); Animation_Change(&this->skelanime, &gGohmaEyeRollAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gGohmaEyeRollAnim), ANIMMODE_ONCE, 0.0f); this->currentAnimFrameCount = Animation_GetLastFrame(&gGohmaEyeRollAnim); @@ -648,15 +647,15 @@ void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { 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; - this->subCameraEye.z = 170.0f; - this->subCameraEye.y = camera->eye.y + 20.0f; + this->subCamEye.x = 90.0f; + this->subCamEye.z = 170.0f; + this->subCamEye.y = mainCam->eye.y + 20.0f; this->framesUntilNextAction = 50; - this->subCameraAt.x = this->actor.world.pos.x; - this->subCameraAt.y = this->actor.world.pos.y; - this->subCameraAt.z = this->actor.world.pos.z; + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.y = this->actor.world.pos.y; + this->subCamAt.z = this->actor.world.pos.z; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); } @@ -669,7 +668,7 @@ void BossGoma_SetupEncounterState4(BossGoma* this, GlobalContext* globalCtx) { * Skips the door and look-at-Gohma puzzle if the player already reached the boss card part before */ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { - Camera* cam; + Camera* mainCam; Player* player = GET_PLAYER(globalCtx); s32 pad[2]; @@ -693,10 +692,10 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { case 1: // player entered the room func_80064520(globalCtx, &globalCtx->csCtx); - this->subCameraId = Gameplay_CreateSubCamera(globalCtx); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); osSyncPrintf("MAKE CAMERA !!! 1 !!!!!!!!!!!!!!!!!!!!!!!!!!\n"); - Gameplay_ChangeCameraStatus(globalCtx, 0, 1); - Gameplay_ChangeCameraStatus(globalCtx, this->subCameraId, 7); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->actionState = 2; // ceiling center this->actor.world.pos.x = -150.0f; @@ -706,13 +705,13 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { player->actor.world.pos.x = 150.0f; player->actor.world.pos.z = 300.0f; // near ceiling center - this->subCameraEye.x = -350.0f; - this->subCameraEye.y = -310.0f; - this->subCameraEye.z = -350.0f; + this->subCamEye.x = -350.0f; + this->subCamEye.y = -310.0f; + this->subCamEye.z = -350.0f; // below room entrance - this->subCameraAt.x = player->actor.world.pos.x; - this->subCameraAt.y = player->actor.world.pos.y - 200.0f + 25.0f; - this->subCameraAt.z = player->actor.world.pos.z; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = player->actor.world.pos.y - 200.0f + 25.0f; + this->subCamAt.z = player->actor.world.pos.z; this->framesUntilNextAction = 50; this->timer = 80; this->frameCount = 0; @@ -728,22 +727,22 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { if (this->framesUntilNextAction == 0) { // (-20, 25, -65) is towards room center - Math_ApproachF(&this->subCameraEye.x, player->actor.world.pos.x - 20.0f, 0.049999997f, - this->subCameraFollowSpeed * 50.0f); - Math_ApproachF(&this->subCameraEye.y, player->actor.world.pos.y + 25.0f, 0.099999994f, - this->subCameraFollowSpeed * 130.0f); - Math_ApproachF(&this->subCameraEye.z, player->actor.world.pos.z - 65.0f, 0.049999997f, - this->subCameraFollowSpeed * 30.0f); - Math_ApproachF(&this->subCameraFollowSpeed, 0.29999998f, 1.0f, 0.0050000004f); + Math_ApproachF(&this->subCamEye.x, player->actor.world.pos.x - 20.0f, 0.049999997f, + this->subCamFollowSpeed * 50.0f); + Math_ApproachF(&this->subCamEye.y, player->actor.world.pos.y + 25.0f, 0.099999994f, + this->subCamFollowSpeed * 130.0f); + Math_ApproachF(&this->subCamEye.z, player->actor.world.pos.z - 65.0f, 0.049999997f, + this->subCamFollowSpeed * 30.0f); + Math_ApproachF(&this->subCamFollowSpeed, 0.29999998f, 1.0f, 0.0050000004f); if (this->timer == 0) { - Math_ApproachF(&this->subCameraAt.y, player->actor.world.pos.y + 35.0f, 0.099999994f, - this->subCameraFollowSpeed * 30.0f); + Math_ApproachF(&this->subCamAt.y, player->actor.world.pos.y + 35.0f, 0.099999994f, + this->subCamFollowSpeed * 30.0f); } - this->subCameraAt.x = player->actor.world.pos.x; - this->subCameraAt.z = player->actor.world.pos.z; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.z = player->actor.world.pos.z; } - Gameplay_CameraSetAtEye(globalCtx, 0, &this->subCameraAt, &this->subCameraEye); + Gameplay_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &this->subCamAt, &this->subCamEye); if (this->frameCount == 176) { Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_SHUTTER, 164.72f, -480.0f, @@ -760,12 +759,12 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { } if (this->frameCount >= 228) { - cam = Gameplay_GetCamera(globalCtx, 0); - cam->eye = this->subCameraEye; - cam->eyeNext = this->subCameraEye; - cam->at = this->subCameraAt; - func_800C08AC(globalCtx, this->subCameraId, 0); - this->subCameraId = 0; + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); this->actionState = 3; @@ -798,12 +797,12 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { if (this->framesUntilNextAction <= 40) { // (22, -25, 45) is towards room entrance - Math_ApproachF(&this->subCameraEye.x, this->actor.world.pos.x + 22.0f, 0.2f, 100.0f); - Math_ApproachF(&this->subCameraEye.y, this->actor.world.pos.y - 25.0f, 0.2f, 100.0f); - Math_ApproachF(&this->subCameraEye.z, this->actor.world.pos.z + 45.0f, 0.2f, 100.0f); - Math_ApproachF(&this->subCameraAt.x, this->actor.world.pos.x, 0.2f, 100.0f); - Math_ApproachF(&this->subCameraAt.y, this->actor.world.pos.y + 5.0f, 0.2f, 100.0f); - Math_ApproachF(&this->subCameraAt.z, this->actor.world.pos.z, 0.2f, 100.0f); + Math_ApproachF(&this->subCamEye.x, this->actor.world.pos.x + 22.0f, 0.2f, 100.0f); + Math_ApproachF(&this->subCamEye.y, this->actor.world.pos.y - 25.0f, 0.2f, 100.0f); + Math_ApproachF(&this->subCamEye.z, this->actor.world.pos.z + 45.0f, 0.2f, 100.0f); + Math_ApproachF(&this->subCamAt.x, this->actor.world.pos.x, 0.2f, 100.0f); + Math_ApproachF(&this->subCamAt.y, this->actor.world.pos.y + 5.0f, 0.2f, 100.0f); + Math_ApproachF(&this->subCamAt.z, this->actor.world.pos.z, 0.2f, 100.0f); if (this->framesUntilNextAction == 30) { globalCtx->envCtx.unk_BF = 4; @@ -824,7 +823,7 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { Animation_Change(&this->skelanime, &gGohmaWalkAnim, 2.0f, 0.0f, Animation_GetLastFrame(&gGohmaWalkAnim), ANIMMODE_LOOP, -5.0f); this->framesUntilNextAction = 30; - this->subCameraFollowSpeed = 0.0f; + this->subCamFollowSpeed = 0.0f; } } } @@ -832,15 +831,15 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { case 5: // running on the ceiling // (98, 0, 85) is towards room entrance - Math_ApproachF(&this->subCameraEye.x, this->actor.world.pos.x + 8.0f + 90.0f, 0.1f, - this->subCameraFollowSpeed * 30.0f); - Math_ApproachF(&this->subCameraEye.y, player->actor.world.pos.y, 0.1f, this->subCameraFollowSpeed * 30.0f); - Math_ApproachF(&this->subCameraEye.z, this->actor.world.pos.z + 45.0f + 40.0f, 0.1f, - this->subCameraFollowSpeed * 30.0f); - Math_ApproachF(&this->subCameraFollowSpeed, 1.0f, 1.0f, 0.05f); - this->subCameraAt.x = this->actor.world.pos.x; - this->subCameraAt.y = this->actor.world.pos.y; - this->subCameraAt.z = this->actor.world.pos.z; + Math_ApproachF(&this->subCamEye.x, this->actor.world.pos.x + 8.0f + 90.0f, 0.1f, + this->subCamFollowSpeed * 30.0f); + Math_ApproachF(&this->subCamEye.y, player->actor.world.pos.y, 0.1f, this->subCamFollowSpeed * 30.0f); + Math_ApproachF(&this->subCamEye.z, this->actor.world.pos.z + 45.0f + 40.0f, 0.1f, + this->subCamFollowSpeed * 30.0f); + Math_ApproachF(&this->subCamFollowSpeed, 1.0f, 1.0f, 0.05f); + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.y = this->actor.world.pos.y; + this->subCamAt.z = this->actor.world.pos.z; if (this->framesUntilNextAction < 0) { //! @bug ? unreachable, timer is >= 0 @@ -868,15 +867,15 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { break; case 9: // falling from the ceiling - Math_ApproachF(&this->subCameraEye.x, this->actor.world.pos.x + 8.0f + 90.0f, 0.1f, - this->subCameraFollowSpeed * 30.0f); - Math_ApproachF(&this->subCameraEye.y, player->actor.world.pos.y + 10.0f, 0.1f, - this->subCameraFollowSpeed * 30.0f); - Math_ApproachF(&this->subCameraEye.z, this->actor.world.pos.z + 45.0f + 40.0f, 0.1f, - this->subCameraFollowSpeed * 30.0f); - this->subCameraAt.x = this->actor.world.pos.x; - this->subCameraAt.y = this->actor.world.pos.y; - this->subCameraAt.z = this->actor.world.pos.z; + Math_ApproachF(&this->subCamEye.x, this->actor.world.pos.x + 8.0f + 90.0f, 0.1f, + this->subCamFollowSpeed * 30.0f); + Math_ApproachF(&this->subCamEye.y, player->actor.world.pos.y + 10.0f, 0.1f, + this->subCamFollowSpeed * 30.0f); + Math_ApproachF(&this->subCamEye.z, this->actor.world.pos.z + 45.0f + 40.0f, 0.1f, + this->subCamFollowSpeed * 30.0f); + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.y = this->actor.world.pos.y; + this->subCamAt.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, @@ -895,25 +894,25 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { break; case 130: // focus Gohma on the ground - Math_ApproachF(&this->subCameraEye.x, this->actor.world.pos.x + 8.0f + 90.0f, 0.1f, - this->subCameraFollowSpeed * 30.0f); - Math_ApproachF(&this->subCameraEye.y, player->actor.world.pos.y + 10.0f, 0.1f, - this->subCameraFollowSpeed * 30.0f); - Math_ApproachF(&this->subCameraEye.z, this->actor.world.pos.z + 45.0f + 40.0f, 0.1f, - this->subCameraFollowSpeed * 30.0f); + Math_ApproachF(&this->subCamEye.x, this->actor.world.pos.x + 8.0f + 90.0f, 0.1f, + this->subCamFollowSpeed * 30.0f); + Math_ApproachF(&this->subCamEye.y, player->actor.world.pos.y + 10.0f, 0.1f, + this->subCamFollowSpeed * 30.0f); + Math_ApproachF(&this->subCamEye.z, this->actor.world.pos.z + 45.0f + 40.0f, 0.1f, + this->subCamFollowSpeed * 30.0f); Math_ApproachS(&this->actor.shape.rot.x, 0, 2, 0xBB8); 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; + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.z = this->actor.world.pos.z; if (this->framesUntilNextAction != 0) { f32 s = sinf(this->framesUntilNextAction * 3.1415f * 0.5f); - this->subCameraAt.y = this->framesUntilNextAction * s * 0.7f + this->actor.world.pos.y; + this->subCamAt.y = this->framesUntilNextAction * s * 0.7f + this->actor.world.pos.y; } else { - Math_ApproachF(&this->subCameraAt.y, this->actor.focus.pos.y, 0.1f, 10.0f); + Math_ApproachF(&this->subCamAt.y, this->actor.focus.pos.y, 0.1f, 10.0f); } if (Animation_OnFrame(&this->skelanime, 40.0f)) { @@ -938,28 +937,28 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { case 140: SkelAnime_Update(&this->skelanime); - Math_ApproachF(&this->subCameraAt.y, this->actor.focus.pos.y, 0.1f, 10.0f); + Math_ApproachF(&this->subCamAt.y, this->actor.focus.pos.y, 0.1f, 10.0f); if (this->framesUntilNextAction == 0) { this->framesUntilNextAction = 30; this->actionState = 150; - Gameplay_ChangeCameraStatus(globalCtx, 0, 3); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); } break; case 150: SkelAnime_Update(&this->skelanime); - Math_SmoothStepToF(&this->subCameraEye.x, this->actor.world.pos.x + 150.0f, 0.2f, 100.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraEye.y, this->actor.world.pos.y + 20.0f, 0.2f, 100.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraEye.z, this->actor.world.pos.z + 220.0f, 0.2f, 100.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.x, this->actor.world.pos.x + 150.0f, 0.2f, 100.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.y, this->actor.world.pos.y + 20.0f, 0.2f, 100.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.z, this->actor.world.pos.z + 220.0f, 0.2f, 100.0f, 0.1f); if (this->framesUntilNextAction == 0) { - cam = Gameplay_GetCamera(globalCtx, 0); - cam->eye = this->subCameraEye; - cam->eyeNext = this->subCameraEye; - cam->at = this->subCameraAt; - func_800C08AC(globalCtx, this->subCameraId, 0); - this->subCameraId = 0; + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; BossGoma_SetupFloorMain(this); this->disableGameplayLogic = false; this->patienceTimer = 200; @@ -969,8 +968,8 @@ void BossGoma_Encounter(BossGoma* this, GlobalContext* globalCtx) { break; } - if (this->subCameraId != 0) { - Gameplay_CameraSetAtEye(globalCtx, this->subCameraId, &this->subCameraAt, &this->subCameraEye); + if (this->subCamId != SUB_CAM_ID_DONE) { + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } } @@ -990,7 +989,7 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { Vec3f vel2 = { 0.0f, 0.0f, 0.0f }; Vec3f accel2 = { 0.0f, -0.5f, 0.0f }; Vec3f pos; - Camera* camera; + Camera* mainCam; Player* player = GET_PLAYER(globalCtx); Vec3f childPos; s16 i; @@ -1055,18 +1054,18 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { this->actionState = 1; func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 1); - this->subCameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, 3); - Gameplay_ChangeCameraStatus(globalCtx, this->subCameraId, 7); - camera = Gameplay_GetCamera(globalCtx, 0); - this->subCameraEye.x = camera->eye.x; - this->subCameraEye.y = camera->eye.y; - this->subCameraEye.z = camera->eye.z; - this->subCameraAt.x = camera->at.x; - this->subCameraAt.y = camera->at.y; - this->subCameraAt.z = camera->at.z; - dx = this->subCameraEye.x - this->actor.world.pos.x; - dz = this->subCameraEye.z - this->actor.world.pos.z; + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + this->subCamEye.x = mainCam->eye.x; + this->subCamEye.y = mainCam->eye.y; + this->subCamEye.z = mainCam->eye.z; + this->subCamAt.x = mainCam->at.x; + this->subCamAt.y = mainCam->at.y; + this->subCamAt.z = mainCam->at.z; + dx = this->subCamEye.x - this->actor.world.pos.x; + dz = this->subCamEye.z - this->actor.world.pos.z; this->defeatedCameraEyeDist = sqrtf(SQ(dx) + SQ(dz)); this->defeatedCameraEyeAngle = Math_FAtan2F(dx, dz); this->timer = 270; @@ -1101,12 +1100,12 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { dx = dx * this->defeatedCameraEyeDist; dz = cosf(this->defeatedCameraEyeAngle); dz = dz * this->defeatedCameraEyeDist; - Math_SmoothStepToF(&this->subCameraEye.x, this->actor.world.pos.x + dx, 0.2f, 50.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraEye.y, this->actor.world.pos.y + 20.0f, 0.2f, 50.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraEye.z, this->actor.world.pos.z + dz, 0.2f, 50.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraAt.x, this->firstTailLimbWorldPos.x, 0.2f, 50.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraAt.y, this->actor.focus.pos.y, 0.5f, 100.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraAt.z, this->firstTailLimbWorldPos.z, 0.2f, 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.x, this->actor.world.pos.x + dx, 0.2f, 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.y, this->actor.world.pos.y + 20.0f, 0.2f, 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.z, this->actor.world.pos.z + dz, 0.2f, 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.x, this->firstTailLimbWorldPos.x, 0.2f, 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.y, this->actor.focus.pos.y, 0.5f, 100.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.z, this->firstTailLimbWorldPos.z, 0.2f, 50.0f, 0.1f); if (this->timer == 80) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); @@ -1114,24 +1113,24 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { if (this->timer == 0) { this->actionState = 2; - Gameplay_ChangeCameraStatus(globalCtx, 0, 3); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_UNK3); this->timer = 70; this->decayingProgress = 0; - this->subCameraFollowSpeed = 0.0f; + this->subCamFollowSpeed = 0.0f; Actor_Spawn(&globalCtx->actorCtx, globalCtx, ACTOR_ITEM_B_HEART, this->actor.world.pos.x, this->actor.world.pos.y, this->actor.world.pos.z, 0, 0, 0, 0); } break; case 2: - camera = Gameplay_GetCamera(globalCtx, 0); - Math_SmoothStepToF(&this->subCameraEye.x, camera->eye.x, 0.2f, this->subCameraFollowSpeed * 50.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraEye.y, camera->eye.y, 0.2f, this->subCameraFollowSpeed * 50.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraEye.z, camera->eye.z, 0.2f, this->subCameraFollowSpeed * 50.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraAt.x, camera->at.x, 0.2f, this->subCameraFollowSpeed * 50.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraAt.y, camera->at.y, 0.2f, this->subCameraFollowSpeed * 50.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraAt.z, camera->at.z, 0.2f, this->subCameraFollowSpeed * 50.0f, 0.1f); - Math_SmoothStepToF(&this->subCameraFollowSpeed, 1.0f, 1.0f, 0.02f, 0.0f); + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + Math_SmoothStepToF(&this->subCamEye.x, mainCam->eye.x, 0.2f, this->subCamFollowSpeed * 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.y, mainCam->eye.y, 0.2f, this->subCamFollowSpeed * 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamEye.z, mainCam->eye.z, 0.2f, this->subCamFollowSpeed * 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.x, mainCam->at.x, 0.2f, this->subCamFollowSpeed * 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.y, mainCam->at.y, 0.2f, this->subCamFollowSpeed * 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamAt.z, mainCam->at.z, 0.2f, this->subCamFollowSpeed * 50.0f, 0.1f); + Math_SmoothStepToF(&this->subCamFollowSpeed, 1.0f, 1.0f, 0.02f, 0.0f); if (this->timer == 0) { childPos = roomCenter; @@ -1175,12 +1174,12 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { if (this->timer == 0) { if (Math_SmoothStepToF(&this->actor.scale.y, 0, 1.0f, 0.00075f, 0.0f) <= 0.001f) { - camera = Gameplay_GetCamera(globalCtx, 0); - camera->eye = this->subCameraEye; - camera->eyeNext = this->subCameraEye; - camera->at = this->subCameraAt; - func_800C08AC(globalCtx, this->subCameraId, 0); - this->subCameraId = 0; + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); Actor_Kill(&this->actor); @@ -1191,8 +1190,8 @@ void BossGoma_Defeated(BossGoma* this, GlobalContext* globalCtx) { break; } - if (this->subCameraId != 0) { - Gameplay_CameraSetAtEye(globalCtx, this->subCameraId, &this->subCameraAt, &this->subCameraEye); + if (this->subCamId != SUB_CAM_ID_DONE) { + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } if (this->blinkTimer != 0) { diff --git a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h index 22143f1c67..14159e0750 100644 --- a/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h +++ b/src/overlays/actors/ovl_Boss_Goma/z_boss_goma.h @@ -117,7 +117,7 @@ typedef struct BossGoma { /* 0x01B6 */ s16 doNotMoveThisFrame; /* 0x01B8 */ s16 visualState; /* 0x01BA */ s16 invincibilityFrames; - /* 0x01BC */ s16 subCameraId; + /* 0x01BC */ s16 subCamId; /* 0x01BE */ s16 disableGameplayLogic; /* 0x01C0 */ s16 decayingProgress; // when defeated, textures are progressively cleared /* 0x01C2 */ s16 noBackfaceCulling; @@ -136,7 +136,7 @@ typedef struct BossGoma { /* 0x0204 */ f32 mainEnvColor[3]; /* 0x0210 */ f32 eyeEnvColor[3]; /* 0x021C */ f32 currentAnimFrameCount; // not used consistently - /* 0x0220 */ f32 subCameraFollowSpeed; + /* 0x0220 */ f32 subCamFollowSpeed; /* 0x0224 */ f32 eyeIrisScaleY; /* 0x0228 */ f32 defeatedCameraEyeDist; /* 0x022C */ f32 defeatedCameraEyeAngle; @@ -145,8 +145,8 @@ typedef struct BossGoma { /* 0x026C */ Vec3f firstTailLimbWorldPos; /* 0x0278 */ Vec3f rightHandBackLimbWorldPos; /* 0x0284 */ Vec3f leftHandBackLimbWorldPos; - /* 0x0290 */ Vec3f subCameraEye; - /* 0x029C */ Vec3f subCameraAt; + /* 0x0290 */ Vec3f subCamEye; + /* 0x029C */ Vec3f subCamAt; /* 0x02A8 */ Vec3f defeatedLimbPositions[100]; // only 85/86 first indices actually used /* 0x0758 */ u8 deadLimbsState[100]; // only 85/90 first indices actually used /* 0x07BC */ ColliderJntSph collider; diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c index 14b4ce50dd..acc3c1b4d8 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.c @@ -413,8 +413,8 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); s16 indS0; s16 indS1; - Camera* camera1; - Camera* camera2; + Camera* mainCam1; + Camera* mainCam2; BossMo* otherTent = (BossMo*)this->otherTent; f32 maxSwingRateX; f32 maxSwingLagX; @@ -767,7 +767,7 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { Math_ApproachS(&player->actor.shape.rot.y, this->grabPosRot.rot.y, 2, 0x7D0); Math_ApproachS(&player->actor.shape.rot.z, this->grabPosRot.rot.z, 2, 0x7D0); if (this->timers[0] == 0) { - camera1 = Gameplay_GetCamera(globalCtx, MAIN_CAM); + mainCam1 = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); this->work[MO_TENT_ACTION_STATE] = MO_TENT_SHAKE; this->tentMaxAngle = .001f; this->fwork[MO_TENT_SWING_RATE_X] = this->fwork[MO_TENT_SWING_RATE_Z] = @@ -777,14 +777,14 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { this->sfxTimer = 30; Audio_ResetIncreasingTranspose(); func_80064520(globalCtx, &globalCtx->csCtx); - this->csCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->csCamera, CAM_STAT_ACTIVE); - this->cameraEye = camera1->eye; - this->cameraAt = camera1->at; - this->cameraYaw = Math_FAtan2F(this->cameraEye.x - this->actor.world.pos.x, - this->cameraEye.z - this->actor.world.pos.z); - this->cameraYawRate = 0; + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamEye = mainCam1->eye; + this->subCamAt = mainCam1->at; + this->subCamYaw = Math_FAtan2F(this->subCamEye.x - this->actor.world.pos.x, + this->subCamEye.z - this->actor.world.pos.z); + this->subCamYawRate = 0; goto tent_shake; } } @@ -845,21 +845,21 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { this->timers[0] = 75; } } - if (this->csCamera != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { sp138.x = 0; sp138.y = 100.0f; sp138.z = 200.0f; - this->cameraYaw -= this->cameraYawRate; - Math_ApproachF(&this->cameraYawRate, 0.01, 1.0f, 0.002f); - Matrix_RotateY(this->cameraYaw, MTXMODE_NEW); + this->subCamYaw -= this->subCamYawRate; + Math_ApproachF(&this->subCamYawRate, 0.01, 1.0f, 0.002f); + Matrix_RotateY(this->subCamYaw, MTXMODE_NEW); Matrix_MultVec3f(&sp138, &sp12C); - Math_ApproachF(&this->cameraEye.x, this->actor.world.pos.x + sp12C.x, 0.1f, 10.0f); - Math_ApproachF(&this->cameraEye.y, this->actor.world.pos.y + sp12C.y, 0.1f, 10.0f); - Math_ApproachF(&this->cameraEye.z, this->actor.world.pos.z + sp12C.z, 0.1f, 10.0f); - Math_ApproachF(&this->cameraAt.x, player->actor.world.pos.x, 0.5f, 50.0f); - Math_ApproachF(&this->cameraAt.y, player->actor.world.pos.y, 0.5f, 50.0f); - Math_ApproachF(&this->cameraAt.z, player->actor.world.pos.z, 0.5f, 50.0f); - Gameplay_CameraSetAtEye(globalCtx, this->csCamera, &this->cameraAt, &this->cameraEye); + Math_ApproachF(&this->subCamEye.x, this->actor.world.pos.x + sp12C.x, 0.1f, 10.0f); + Math_ApproachF(&this->subCamEye.y, this->actor.world.pos.y + sp12C.y, 0.1f, 10.0f); + Math_ApproachF(&this->subCamEye.z, this->actor.world.pos.z + sp12C.z, 0.1f, 10.0f); + Math_ApproachF(&this->subCamAt.x, player->actor.world.pos.x, 0.5f, 50.0f); + Math_ApproachF(&this->subCamAt.y, player->actor.world.pos.y, 0.5f, 50.0f); + Math_ApproachF(&this->subCamAt.z, player->actor.world.pos.z, 0.5f, 50.0f); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } break; case MO_TENT_CUT: @@ -891,18 +891,18 @@ void BossMo_Tentacle(BossMo* this, GlobalContext* globalCtx) { } break; case MO_TENT_RETREAT: - if (this->csCamera != 0) { - Math_ApproachF(&this->cameraAt.x, player->actor.world.pos.x, 0.5f, 50.0f); - Math_ApproachF(&this->cameraAt.y, player->actor.world.pos.y, 0.5f, 50.0f); - Math_ApproachF(&this->cameraAt.z, player->actor.world.pos.z, 0.5f, 50.0f); - Gameplay_CameraSetAtEye(globalCtx, this->csCamera, &this->cameraAt, &this->cameraEye); + if (this->subCamId != SUB_CAM_ID_DONE) { + Math_ApproachF(&this->subCamAt.x, player->actor.world.pos.x, 0.5f, 50.0f); + Math_ApproachF(&this->subCamAt.y, player->actor.world.pos.y, 0.5f, 50.0f); + Math_ApproachF(&this->subCamAt.z, player->actor.world.pos.z, 0.5f, 50.0f); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); if (player->actor.world.pos.y <= 42.0f) { - camera2 = Gameplay_GetCamera(globalCtx, MAIN_CAM); - camera2->eye = this->cameraEye; - camera2->eyeNext = this->cameraEye; - camera2->at = this->cameraAt; - func_800C08AC(globalCtx, this->csCamera, 0); - this->csCamera = 0; + mainCam2 = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam2->eye = this->subCamEye; + mainCam2->eyeNext = this->subCamEye; + mainCam2->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); } } @@ -1201,16 +1201,16 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { f32 sp7C; f32 sp78; Player* player = GET_PLAYER(globalCtx); - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); Vec3f bubblePos; Vec3f bubblePos2; - Camera* camera2; + Camera* mainCam2; f32 pad50; f32 pad4C; f32 pad48; if (this->csState < MO_INTRO_REVEAL) { - this->cameraZoom = 80.0f; + this->subCamFov = 80.0f; } switch (this->csState) { case MO_INTRO_WAIT: @@ -1228,9 +1228,9 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { // checks if Link is on one of the four platforms func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 8); - this->csCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->csCamera, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->actor.speedXZ = 0.0f; this->csState = MO_INTRO_START; this->timers[2] = 50; @@ -1248,19 +1248,19 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { player->actor.world.pos.z = -130.0f; player->actor.shape.rot.y = player->actor.world.rot.y = 0; player->actor.speedXZ = 0.0f; - this->cameraEye.x = -424.0f; - this->cameraEye.y = -190.0f; - this->cameraEye.z = 180.0f; - this->cameraAt.x = player->actor.world.pos.x; - this->cameraAt.y = -330.0f; - this->cameraAt.z = 0.0f; + this->subCamEye.x = -424.0f; + this->subCamEye.y = -190.0f; + this->subCamEye.z = 180.0f; + this->subCamAt.x = player->actor.world.pos.x; + this->subCamAt.y = -330.0f; + this->subCamAt.z = 0.0f; if (this->timers[2] == 0) { this->csState = MO_INTRO_SWIM; this->work[MO_TENT_MOVE_TIMER] = 0; } else if (this->timers[2] < 50) { - bubblePos.x = (this->cameraEye.x + 20.0f) + 10.0f; + bubblePos.x = (this->subCamEye.x + 20.0f) + 10.0f; bubblePos.y = -250.0f; - bubblePos.z = this->cameraEye.z; + bubblePos.z = this->subCamEye.z; EffectSsBubble_Spawn(globalCtx, &bubblePos, 0.0f, 10.0f, 50.0f, Rand_ZeroFloat(0.05f) + 0.13f); } if (this->timers[2] == 40) { @@ -1268,41 +1268,41 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { } break; case MO_INTRO_SWIM: - Math_ApproachF(&this->cameraYawShake, 0.1f, 1.0f, 0.002f); + Math_ApproachF(&this->subCamYawShake, 0.1f, 1.0f, 0.002f); this->targetPos = cutsceneTargets[this->targetIndex]; if (this->targetIndex == 5) { tempY = Math_SinS(this->work[MO_TENT_MOVE_TIMER] * 0x500) * 20.0f; } else { tempY = Math_SinS(this->work[MO_TENT_MOVE_TIMER] * 0x500) * 5.0f; } - dx = this->targetPos.x - this->cameraEye.x; - dy = this->targetPos.y - this->cameraEye.y + tempY; - dz = this->targetPos.z - this->cameraEye.z; + dx = this->targetPos.x - this->subCamEye.x; + dy = this->targetPos.y - this->subCamEye.y + tempY; + dz = this->targetPos.z - this->subCamEye.z; tempY = Math_FAtan2F(dx, dz); tempX = Math_FAtan2F(dy, sqrtf(SQ(dx) + SQ(dz))); - Math_ApproachS(&this->actor.world.rot.y, RAD_TO_BINANG(tempY), 5, this->cameraYawRate); - Math_ApproachS(&this->actor.world.rot.x, RAD_TO_BINANG(tempX), 5, this->cameraYawRate); + Math_ApproachS(&this->actor.world.rot.y, RAD_TO_BINANG(tempY), 5, this->subCamYawRate); + Math_ApproachS(&this->actor.world.rot.x, RAD_TO_BINANG(tempX), 5, this->subCamYawRate); if (this->work[MO_TENT_MOVE_TIMER] == 150) { - this->cameraAtVel.x = fabsf(this->cameraAt.x - player->actor.world.pos.x); - this->cameraAtVel.y = fabsf(this->cameraAt.y - player->actor.world.pos.y); - this->cameraAtVel.z = fabsf(this->cameraAt.z - player->actor.world.pos.z); + this->subCamAtVel.x = fabsf(this->subCamAt.x - player->actor.world.pos.x); + this->subCamAtVel.y = fabsf(this->subCamAt.y - player->actor.world.pos.y); + this->subCamAtVel.z = fabsf(this->subCamAt.z - player->actor.world.pos.z); } if (this->work[MO_TENT_MOVE_TIMER] >= 150) { - Math_ApproachF(&this->cameraAt.x, player->actor.world.pos.x, 0.1f, - this->cameraAtVel.x * this->cameraSpeedMod); - Math_ApproachF(&this->cameraAt.y, player->actor.world.pos.y + 50.0f, 0.1f, - this->cameraAtVel.y * this->cameraSpeedMod); - Math_ApproachF(&this->cameraAt.z, player->actor.world.pos.z, 0.1f, - this->cameraAtVel.z * this->cameraSpeedMod); - Math_ApproachF(&this->cameraSpeedMod, 0.02f, 1.0f, 0.001f); + Math_ApproachF(&this->subCamAt.x, player->actor.world.pos.x, 0.1f, + this->subCamAtVel.x * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.y, player->actor.world.pos.y + 50.0f, 0.1f, + this->subCamAtVel.y * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.z, player->actor.world.pos.z, 0.1f, + this->subCamAtVel.z * this->subCamVelFactor); + Math_ApproachF(&this->subCamVelFactor, 0.02f, 1.0f, 0.001f); } if (this->work[MO_TENT_MOVE_TIMER] == 190) { func_80078914(&sAudioZeroVec, NA_SE_EN_MOFER_BUBLE_DEMO); } if ((this->work[MO_TENT_MOVE_TIMER] > 150) && (this->work[MO_TENT_MOVE_TIMER] < 180)) { - bubblePos2.x = (this->cameraEye.x + 20.0f) + 10.0f; + bubblePos2.x = (this->subCamEye.x + 20.0f) + 10.0f; bubblePos2.y = -250.0f; - bubblePos2.z = this->cameraEye.z; + bubblePos2.z = this->subCamEye.z; EffectSsBubble_Spawn(globalCtx, &bubblePos2, 0.0f, 10.0f, 50.0f, Rand_ZeroFloat(0.05f) + 0.13f); } sp7C = (f32)0x1000; @@ -1326,14 +1326,14 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { if (this->targetIndex < 5) { if (sqrtf(SQ(dx) + SQ(dz) + SQ(dy)) < 40.0f) { this->targetIndex++; - this->cameraYawRate = 0.0f; + this->subCamYawRate = 0.0f; } } else { sp80 = 1.5f; sp7C = (f32)0x600; } Math_ApproachF(&this->actor.speedXZ, sp80, 1.0f, sp78); - Math_ApproachF(&this->cameraYawRate, sp7C, 1.0f, 128.0f); + Math_ApproachF(&this->subCamYawRate, sp7C, 1.0f, 128.0f); if (this->work[MO_TENT_MOVE_TIMER] == 525) { func_8002DF54(globalCtx, &this->actor, 2); } @@ -1345,11 +1345,11 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { player->actor.world.pos.z = -210.0f; player->actor.world.rot.y = -0x8000; player->actor.shape.rot.y = player->actor.world.rot.y; - this->cameraYawShake = 0.0f; + this->subCamYawShake = 0.0f; sMorphaTent1->baseAlpha = 150.0; this->actor.speedXZ = 0.0f; this->timers[2] = 200; - this->cameraZoom = 60.0f; + this->subCamFov = 60.0f; this->actor.world.pos = sMorphaTent1->actor.world.pos; this->work[MO_TENT_ACTION_STATE] = MO_CORE_INTRO_REVEAL; this->actor.flags &= ~ACTOR_FLAG_0; @@ -1363,33 +1363,33 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { } case MO_INTRO_REVEAL: if (this->timers[2] >= 160) { - this->cameraEye.x = 150.0f; - this->cameraEye.y = 60.0f; - this->cameraEye.z = -230.0f; - this->cameraAt.x = 170.0f; - this->cameraAt.y = 40.0; - this->cameraAt.z = -280.0f; + this->subCamEye.x = 150.0f; + this->subCamEye.y = 60.0f; + this->subCamEye.z = -230.0f; + this->subCamAt.x = 170.0f; + this->subCamAt.y = 40.0; + this->subCamAt.z = -280.0f; sMorphaTent1->xSwing = 0xCEC; sMorphaTent1->fwork[MO_TENT_SWING_RATE_X] = 0.0f; sMorphaTent1->fwork[MO_TENT_SWING_LAG_X] = 1000.0f; sMorphaTent1->fwork[MO_TENT_SWING_SIZE_X] = 2500.0f; if (this->timers[2] == 160) { - this->cameraNextAt.y = 65.0f; - this->cameraNextAt.z = -280.0f; - this->cameraEyeVel.x = fabsf(this->cameraEye.x - 150.0f) * 0.1f; - this->cameraEyeVel.y = fabsf(this->cameraEye.y - 60.0f) * 0.1f; - this->cameraEyeVel.z = fabsf(this->cameraEye.z - -260.0f) * 0.1f; - this->cameraNextEye.x = 150.0f; - this->cameraNextEye.y = 60.0f; - this->cameraNextEye.z = -260.0f; - this->cameraNextAt.x = 155.0f; - this->cameraAtMaxVel.x = this->cameraAtMaxVel.y = this->cameraAtMaxVel.z = 0.1f; - this->cameraAtVel.x = fabsf(this->cameraAt.x - this->cameraNextAt.x) * 0.1f; - this->cameraAtVel.y = fabsf(this->cameraAt.y - this->cameraNextAt.y) * 0.1f; - this->cameraAtVel.z = fabsf(this->cameraAt.z - this->cameraNextAt.z) * 0.1f; - this->cameraEyeMaxVel.x = this->cameraEyeMaxVel.y = this->cameraEyeMaxVel.z = 0.1f; - this->cameraSpeedMod = 0.0f; - this->cameraAccel = 0.01f; + this->subCamAtNext.y = 65.0f; + this->subCamAtNext.z = -280.0f; + this->subCamEyeVel.x = fabsf(this->subCamEye.x - 150.0f) * 0.1f; + this->subCamEyeVel.y = fabsf(this->subCamEye.y - 60.0f) * 0.1f; + this->subCamEyeVel.z = fabsf(this->subCamEye.z - -260.0f) * 0.1f; + this->subCamEyeNext.x = 150.0f; + this->subCamEyeNext.y = 60.0f; + this->subCamEyeNext.z = -260.0f; + this->subCamAtNext.x = 155.0f; + this->subCamAtMaxVelFrac.x = this->subCamAtMaxVelFrac.y = this->subCamAtMaxVelFrac.z = 0.1f; + this->subCamAtVel.x = fabsf(this->subCamAt.x - this->subCamAtNext.x) * 0.1f; + this->subCamAtVel.y = fabsf(this->subCamAt.y - this->subCamAtNext.y) * 0.1f; + this->subCamAtVel.z = fabsf(this->subCamAt.z - this->subCamAtNext.z) * 0.1f; + this->subCamEyeMaxVelFrac.x = this->subCamEyeMaxVelFrac.y = this->subCamEyeMaxVelFrac.z = 0.1f; + this->subCamVelFactor = 0.0f; + this->subCamAccel = 0.01f; this->tentMaxAngle = 0.001f; this->tentSpeed = 0.0f; sp9F = 1; @@ -1398,25 +1398,25 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { sp9F = 1; } if (this->timers[2] == 50) { - this->cameraNextAt.x = 160.0f; - this->cameraNextAt.y = 58.0f; - this->cameraNextAt.z = -247.0f; - this->cameraEyeVel.x = fabsf(this->cameraEye.x - 111.0f) * 0.1f; - this->cameraEyeVel.y = fabsf(this->cameraEye.y - 133.0f) * 0.1f; - this->cameraEyeVel.z = fabsf(this->cameraEye.z - -191.0f) * 0.1f; + this->subCamAtNext.x = 160.0f; + this->subCamAtNext.y = 58.0f; + this->subCamAtNext.z = -247.0f; + this->subCamEyeVel.x = fabsf(this->subCamEye.x - 111.0f) * 0.1f; + this->subCamEyeVel.y = fabsf(this->subCamEye.y - 133.0f) * 0.1f; + this->subCamEyeVel.z = fabsf(this->subCamEye.z - -191.0f) * 0.1f; if (1) {} this->csState = MO_INTRO_FINISH; this->timers[2] = 110; - this->cameraNextEye.x = 111.0f; - this->cameraNextEye.y = 133.0f; - this->cameraNextEye.z = -191.0f; - this->cameraAtVel.x = fabsf(this->cameraAt.x - this->cameraNextAt.x) * 0.1f; - this->cameraAtVel.y = fabsf(this->cameraAt.y - this->cameraNextAt.y) * 0.1f; - this->cameraAtVel.z = fabsf(this->cameraAt.z - this->cameraNextAt.z) * 0.1f; - this->cameraEyeMaxVel.y = 0.03f; - this->cameraAtMaxVel.y = 0.03f; - this->cameraSpeedMod = 0.0f; - this->cameraAccel = 0.01f; + this->subCamEyeNext.x = 111.0f; + this->subCamEyeNext.y = 133.0f; + this->subCamEyeNext.z = -191.0f; + this->subCamAtVel.x = fabsf(this->subCamAt.x - this->subCamAtNext.x) * 0.1f; + this->subCamAtVel.y = fabsf(this->subCamAt.y - this->subCamAtNext.y) * 0.1f; + this->subCamAtVel.z = fabsf(this->subCamAt.z - this->subCamAtNext.z) * 0.1f; + this->subCamEyeMaxVelFrac.y = 0.03f; + this->subCamAtMaxVelFrac.y = 0.03f; + this->subCamVelFactor = 0.0f; + this->subCamAccel = 0.01f; } if (this->timers[2] == 150) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); @@ -1429,23 +1429,24 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { break; case MO_INTRO_FINISH: sp9F = 1; - this->cameraNextEye.x = 111.0f; - this->cameraNextEye.y = 133.0f; - this->cameraNextEye.z = -191.0f; - this->cameraNextAt.x = 160.0f; - this->cameraNextAt.y = 58.0f; - this->cameraNextAt.z = -247.0f; + this->subCamEyeNext.x = 111.0f; + this->subCamEyeNext.y = 133.0f; + this->subCamEyeNext.z = -191.0f; + this->subCamAtNext.x = 160.0f; + this->subCamAtNext.y = 58.0f; + this->subCamAtNext.z = -247.0f; if (this->timers[2] == 100) { sMorphaTent1->work[MO_TENT_ACTION_STATE] = MO_TENT_RETREAT; sMorphaTent1->timers[0] = 50; } if (this->timers[2] == 20) { - camera2 = Gameplay_GetCamera(globalCtx, MAIN_CAM); - camera2->eye = this->cameraEye; - camera2->eyeNext = this->cameraEye; - camera2->at = this->cameraAt; - func_800C08AC(globalCtx, this->csCamera, 0); - this->csState = this->csCamera = MO_BATTLE; + mainCam2 = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam2->eye = this->subCamEye; + mainCam2->eyeNext = this->subCamEye; + mainCam2->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + // MO_BATTLE / SUB_CAM_ID_DONE + this->csState = this->subCamId = 0; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); } @@ -1458,35 +1459,35 @@ void BossMo_IntroCs(BossMo* this, GlobalContext* globalCtx) { sMorphaTent1->actor.speedXZ = 0.0f; sMorphaTent1->actor.shape.rot.y = sMorphaTent1->actor.yawTowardsPlayer; } - if (this->csCamera != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { if (sp9F) { - Math_ApproachF(&this->cameraEye.x, this->cameraNextEye.x, this->cameraEyeMaxVel.x, - this->cameraEyeVel.x * this->cameraSpeedMod); - Math_ApproachF(&this->cameraEye.y, this->cameraNextEye.y, this->cameraEyeMaxVel.y, - this->cameraEyeVel.y * this->cameraSpeedMod); - Math_ApproachF(&this->cameraEye.z, this->cameraNextEye.z, this->cameraEyeMaxVel.z, - this->cameraEyeVel.z * this->cameraSpeedMod); - Math_ApproachF(&this->cameraAt.x, this->cameraNextAt.x, this->cameraAtMaxVel.x, - this->cameraAtVel.x * this->cameraSpeedMod); - Math_ApproachF(&this->cameraAt.y, this->cameraNextAt.y, this->cameraAtMaxVel.y, - this->cameraAtVel.y * this->cameraSpeedMod); - Math_ApproachF(&this->cameraAt.z, this->cameraNextAt.z, this->cameraAtMaxVel.z, - this->cameraAtVel.z * this->cameraSpeedMod); - Math_ApproachF(&this->cameraSpeedMod, 1.0f, 1.0f, this->cameraAccel); + Math_ApproachF(&this->subCamEye.x, this->subCamEyeNext.x, this->subCamEyeMaxVelFrac.x, + this->subCamEyeVel.x * this->subCamVelFactor); + Math_ApproachF(&this->subCamEye.y, this->subCamEyeNext.y, this->subCamEyeMaxVelFrac.y, + this->subCamEyeVel.y * this->subCamVelFactor); + Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, this->subCamEyeMaxVelFrac.z, + this->subCamEyeVel.z * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, this->subCamAtMaxVelFrac.x, + this->subCamAtVel.x * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, this->subCamAtMaxVelFrac.y, + this->subCamAtVel.y * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, this->subCamAtMaxVelFrac.z, + this->subCamAtVel.z * this->subCamVelFactor); + Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, this->subCamAccel); } else if (this->csState < MO_INTRO_REVEAL) { func_8002D908(&this->actor); - this->cameraEye.x += this->actor.velocity.x; - this->cameraEye.y += this->actor.velocity.y; - this->cameraEye.z += this->actor.velocity.z; + this->subCamEye.x += this->actor.velocity.x; + this->subCamEye.y += this->actor.velocity.y; + this->subCamEye.z += this->actor.velocity.z; } - this->cameraUp.x = this->cameraUp.z = - sinf(this->work[MO_TENT_VAR_TIMER] * 0.03f) * this->cameraYawShake * (-2.0f); - this->cameraUp.y = 1.0f; - Gameplay_CameraSetAtEyeUp(globalCtx, this->csCamera, &this->cameraAt, &this->cameraEye, &this->cameraUp); - camera->eye = this->cameraEye; - camera->eyeNext = this->cameraEye; - camera->at = this->cameraAt; - Gameplay_CameraSetFov(globalCtx, this->csCamera, this->cameraZoom); + this->subCamUp.x = this->subCamUp.z = + sinf(this->work[MO_TENT_VAR_TIMER] * 0.03f) * this->subCamYawShake * (-2.0f); + this->subCamUp.y = 1.0f; + Gameplay_CameraSetAtEyeUp(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye, &this->subCamUp); + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + Gameplay_CameraSetFov(globalCtx, this->subCamId, this->subCamFov); } if ((this->csState > MO_INTRO_START) && (this->work[MO_TENT_MOVE_TIMER] > 540)) { @@ -1505,7 +1506,7 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { f32 sp7C; Vec3f sp70; Vec3f sp64; - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); Vec3f velocity; Vec3f pos; @@ -1513,17 +1514,17 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { case MO_DEATH_START: func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 8); - this->csCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->csCamera, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->csState = MO_DEATH_MO_CORE_BURST; - this->cameraEye = camera->eye; + this->subCamEye = mainCam->eye; this->timers[0] = 90; - dx = this->actor.world.pos.x - this->cameraEye.x; - dz = this->actor.world.pos.z - this->cameraEye.z; - this->cameraYaw = Math_FAtan2F(dx, dz); - this->cameraDist = sqrtf(SQ(dx) + SQ(dz)); - this->cameraYawRate = 0.0f; + dx = this->actor.world.pos.x - this->subCamEye.x; + dz = this->actor.world.pos.z - this->subCamEye.z; + this->subCamYaw = Math_FAtan2F(dx, dz); + this->subCamDist = sqrtf(SQ(dx) + SQ(dz)); + this->subCamYawRate = 0.0f; case MO_DEATH_MO_CORE_BURST: this->baseAlpha = 0.0f; if (this->timers[0] & 4) { @@ -1536,15 +1537,15 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { Math_ApproachF(&this->actor.scale.x, sp80, 0.5f, 0.002f); this->actor.scale.z = this->actor.scale.x; Math_ApproachF(&this->actor.scale.y, sp7C, 0.5f, 0.002f); - this->cameraYaw += this->cameraYawRate; + this->subCamYaw += this->subCamYawRate; if (this->timers[0] >= 30) { - Math_ApproachF(&this->cameraYawRate, 0.05f, 1.0f, 0.002f); + Math_ApproachF(&this->subCamYawRate, 0.05f, 1.0f, 0.002f); } else { - Math_ApproachF(&this->cameraYawRate, 0.0f, 1.0f, 0.002f); + Math_ApproachF(&this->subCamYawRate, 0.0f, 1.0f, 0.002f); } Math_ApproachF(&this->actor.world.pos.y, 150.0f, 0.05f, 5.0f); - Math_ApproachF(&this->cameraEye.y, 100.0f, 0.05f, 2.0f); - this->cameraAt = this->cameraNextAt = this->actor.world.pos; + Math_ApproachF(&this->subCamEye.y, 100.0f, 0.05f, 2.0f); + this->subCamAt = this->subCamAtNext = this->actor.world.pos; if (this->timers[0] > 20) { Audio_PlayActorSound2(&this->actor, NA_SE_EN_MOFER_DEAD - SFX_FLAG); } @@ -1567,22 +1568,22 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { } if (this->timers[0] == 0) { this->csState = MO_DEATH_DRAIN_WATER_1; - this->cameraDist = 490.0f; + this->subCamDist = 490.0f; this->actor.world.pos.y = -1000.0f; this->fwork[MO_TENT_SWING_SIZE_X] = 15.0f; - this->cameraYaw = 0.0f; - this->cameraEye.x = 490.0f; - this->cameraEye.y = 50.0f; - this->cameraEye.z = 0.0f; - this->cameraAt.x = 0; - this->cameraAt.y = -100.0f; - this->cameraAt.z = 0.0f; + this->subCamYaw = 0.0f; + this->subCamEye.x = 490.0f; + this->subCamEye.y = 50.0f; + this->subCamEye.z = 0.0f; + this->subCamAt.x = 0; + this->subCamAt.y = -100.0f; + this->subCamAt.z = 0.0f; this->work[MO_TENT_VAR_TIMER] = this->work[MO_TENT_MOVE_TIMER] = 0; - this->cameraAtMaxVel.y = 0.05f; - this->cameraAtVel.y = 4.0f; - this->cameraSpeedMod = 0.0f; - this->cameraAccel = 0.02f; - this->cameraNextAt.y = 320.0f; + this->subCamAtMaxVelFrac.y = 0.05f; + this->subCamAtVel.y = 4.0f; + this->subCamVelFactor = 0.0f; + this->subCamAccel = 0.02f; + this->subCamAtNext.y = 320.0f; if (1) {} this->timers[0] = 100; sMorphaTent1->drawActor = true; @@ -1616,36 +1617,36 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { case MO_DEATH_DRAIN_WATER_1: if (this->timers[0] == 0) { this->csState = MO_DEATH_DRAIN_WATER_2; - this->cameraAt.y = -200.0f; - this->cameraNextAt.y = 320.0f; - this->cameraAtMaxVel.y = 0.05f; - this->cameraAtVel.y = 4.0f; - this->cameraSpeedMod = 0.0f; - this->cameraAccel = 0.0f; + this->subCamAt.y = -200.0f; + this->subCamAtNext.y = 320.0f; + this->subCamAtMaxVelFrac.y = 0.05f; + this->subCamAtVel.y = 4.0f; + this->subCamVelFactor = 0.0f; + this->subCamAccel = 0.0f; sMorphaTent1->work[MO_TENT_ACTION_STATE] = MO_TENT_DEATH_1; this->timers[0] = 125; sMorphaTent1->fwork[MO_TENT_MAX_STRETCH] = 3.7000003f; - this->cameraYaw = 0.5f; - this->cameraDist = 200.0f; + this->subCamYaw = 0.5f; + this->subCamDist = 200.0f; return; } break; case MO_DEATH_DRAIN_WATER_2: if (this->timers[0] == 0) { - this->cameraAccel = 0.02f; + this->subCamAccel = 0.02f; sMorphaTent1->work[MO_TENT_ACTION_STATE] = MO_TENT_DEATH_2; this->csState = MO_DEATH_CEILING; sMorphaTent1->timers[0] = 120; this->timers[0] = 150; } case MO_DEATH_CEILING: - Math_ApproachF(&this->cameraYaw, 0.0f, 0.05f, 0.0029999996f); - Math_ApproachF(&this->cameraDist, 490.0f, 0.1f, 1.0f); + Math_ApproachF(&this->subCamYaw, 0.0f, 0.05f, 0.0029999996f); + Math_ApproachF(&this->subCamDist, 490.0f, 0.1f, 1.0f); if (this->timers[0] == 0) { this->csState = MO_DEATH_DROPLET; this->timers[0] = 140; - this->cameraYawRate = 0.0f; - this->cameraSpeed = 0.0f; + this->subCamYawRate = 0.0f; + this->subCamSpeed = 0.0f; } break; case MO_DEATH_DROPLET: @@ -1656,35 +1657,35 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { sMorphaTent1->tentSpeed = sMorphaTent1->tentMaxAngle; } if (this->timers[0] == 0) { - if (-100.0f < this->cameraEye.y) { - Math_ApproachF(&this->cameraEye.y, sMorphaTent1->actor.world.pos.y - 100.0f, 0.1f, 2000.0f); + if (-100.0f < this->subCamEye.y) { + Math_ApproachF(&this->subCamEye.y, sMorphaTent1->actor.world.pos.y - 100.0f, 0.1f, 2000.0f); } else { - Math_ApproachF(&this->cameraEye.y, -200.0f, 0.1f, 2000.0f); + Math_ApproachF(&this->subCamEye.y, -200.0f, 0.1f, 2000.0f); } - Math_ApproachF(&this->cameraAt.y, (sMorphaTent1->actor.world.pos.y - 50.0f) + 30.0f, 0.5f, 2000.0f); - this->cameraNextAt.y = this->cameraAt.y; + Math_ApproachF(&this->subCamAt.y, (sMorphaTent1->actor.world.pos.y - 50.0f) + 30.0f, 0.5f, 2000.0f); + this->subCamAtNext.y = this->subCamAt.y; } else { - Math_ApproachF(&this->cameraEye.y, 300.0f, 0.05f, this->cameraSpeed); + Math_ApproachF(&this->subCamEye.y, 300.0f, 0.05f, this->subCamSpeed); } - Math_ApproachF(&this->cameraYaw, -M_PI / 2.0f, 0.05f, this->cameraYawRate); - Math_ApproachF(&this->cameraSpeed, 3.0f, 1.0f, 0.05f); - Math_ApproachF(&this->cameraYawRate, 0.012999999f, 1.0f, 0.0005f); + Math_ApproachF(&this->subCamYaw, -M_PI / 2.0f, 0.05f, this->subCamYawRate); + Math_ApproachF(&this->subCamSpeed, 3.0f, 1.0f, 0.05f); + Math_ApproachF(&this->subCamYawRate, 0.012999999f, 1.0f, 0.0005f); if (sMorphaTent1->work[MO_TENT_ACTION_STATE] == MO_TENT_DEATH_6) { - Math_ApproachF(&this->cameraDist, 200.0f, 0.02f, this->cameraSpeed); + Math_ApproachF(&this->subCamDist, 200.0f, 0.02f, this->subCamSpeed); if (sMorphaTent1->timers[0] == 0) { this->csState = MO_DEATH_FINISH; - camera->eye = this->cameraEye; - camera->eyeNext = this->cameraEye; - camera->at = this->cameraAt; - func_800C08AC(globalCtx, this->csCamera, 0); - this->csCamera = 0; + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); sMorphaTent1->actor.world.pos.y = -1000.0f; } } else { - Math_ApproachF(&this->cameraDist, 150.0f, 0.05f, this->cameraSpeed); + Math_ApproachF(&this->subCamDist, 150.0f, 0.05f, this->subCamSpeed); } break; case MO_DEATH_FINISH: @@ -1712,21 +1713,21 @@ void BossMo_DeathCs(BossMo* this, GlobalContext* globalCtx) { } Math_ApproachF(&this->fwork[MO_TENT_SWING_SIZE_X], 0.0f, 0.1f, 0.05f); - sp70.x = this->cameraDist; + sp70.x = this->subCamDist; sp70.y = 0.0f; sp70.z = 0.0f; - Matrix_RotateY(this->cameraYaw, MTXMODE_NEW); + Matrix_RotateY(this->subCamYaw, MTXMODE_NEW); Matrix_MultVec3f(&sp70, &sp64); - this->cameraEye.x = sp64.x + this->cameraAt.x; - this->cameraEye.z = sp64.z + this->cameraAt.z; + this->subCamEye.x = sp64.x + this->subCamAt.x; + this->subCamEye.z = sp64.z + this->subCamAt.z; one = 1; // Super fake, but it works - if (this->csCamera != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { if (one) { - Math_ApproachF(&this->cameraAt.y, this->cameraNextAt.y, this->cameraAtMaxVel.y, - this->cameraAtVel.y * this->cameraSpeedMod); - Math_ApproachF(&this->cameraSpeedMod, 1.0f, 1.0f, this->cameraAccel); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, this->subCamAtMaxVelFrac.y, + this->subCamAtVel.y * this->subCamVelFactor); + Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, this->subCamAccel); } - Gameplay_CameraSetAtEye(globalCtx, this->csCamera, &this->cameraAt, &this->cameraEye); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } } @@ -1770,8 +1771,9 @@ void BossMo_CoreCollisionCheck(BossMo* this, GlobalContext* globalCtx) { this->actor.colChkInfo.health -= damage; this->hitCount++; if ((s8)this->actor.colChkInfo.health <= 0) { - if (((sMorphaTent1->csCamera == 0) && (sMorphaTent2 == NULL)) || - ((sMorphaTent1->csCamera == 0) && (sMorphaTent2 != NULL) && (sMorphaTent2->csCamera == 0))) { + if (((sMorphaTent1->subCamId == SUB_CAM_ID_DONE) && (sMorphaTent2 == NULL)) || + ((sMorphaTent1->subCamId == SUB_CAM_ID_DONE) && (sMorphaTent2 != NULL) && + (sMorphaTent2->subCamId == SUB_CAM_ID_DONE))) { Enemy_StartFinishingBlow(globalCtx, &this->actor); Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); this->csState = MO_DEATH_START; @@ -2661,7 +2663,7 @@ void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { BossMo_DrawWater(this, globalCtx); } - if ((this->csCamera != 0) && (this->csState < MO_INTRO_REVEAL)) { + if ((this->subCamId != SUB_CAM_ID_DONE) && (this->csState < MO_INTRO_REVEAL)) { f32 sp8C; f32 sp88; f32 sp84; @@ -2681,9 +2683,9 @@ void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { (s16)sMorphaTent1->waterTex1y, 32, 32, 1, (s16)sMorphaTent1->waterTex2x, (s16)sMorphaTent1->waterTex2y, 32, 32)); - sp8C = this->cameraAt.x - this->cameraEye.x; - sp88 = this->cameraAt.y - this->cameraEye.y; - sp84 = this->cameraAt.z - this->cameraEye.z; + sp8C = this->subCamAt.x - this->subCamEye.x; + sp88 = this->subCamAt.y - this->subCamEye.y; + sp84 = this->subCamAt.z - this->subCamEye.z; temp = SQ(sp8C) + SQ(sp84); sp7C = Math_FAtan2F(sp8C, sp84); sp78 = -Math_FAtan2F(sp88, sqrtf(temp)); @@ -2695,9 +2697,9 @@ void BossMo_DrawCore(Actor* thisx, GlobalContext* globalCtx) { Matrix_RotateY(sp7C, MTXMODE_NEW); Matrix_RotateX(sp78, MTXMODE_APPLY); Matrix_MultVec3f(&sp6C, &sp60); - sp8C = sp60.x + this->cameraEye.x; - sp88 = sp60.y + this->cameraEye.y; - sp84 = sp60.z + this->cameraEye.z; + sp8C = sp60.x + this->subCamEye.x; + sp88 = sp60.y + this->subCamEye.y; + sp84 = sp60.z + this->subCamEye.z; Matrix_Translate(sp8C, sp88, sp84, MTXMODE_NEW); Matrix_RotateY(sp7C, MTXMODE_APPLY); Matrix_RotateX(sp78, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h index 881dbe2223..fd3edcabd0 100644 --- a/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h +++ b/src/overlays/actors/ovl_Boss_Mo/z_boss_mo.h @@ -100,28 +100,28 @@ typedef struct BossMo { /* 0x0D68 */ f32 tentSpeed; /* 0x0D6C */ f32 tentPulse; /* 0x0D70 */ Vec3f tentPos[41]; - /* 0x0F5C */ f32 cameraZoom; + /* 0x0F5C */ f32 subCamFov; /* 0x0F60 */ s16 csState; - /* 0x0F62 */ s16 csCamera; + /* 0x0F62 */ s16 subCamId; /* 0x0F64 */ s16 targetIndex; - /* 0x0F68 */ Vec3f cameraEye; - /* 0x0F74 */ Vec3f cameraAt; - /* 0x0F80 */ Vec3f cameraUp; + /* 0x0F68 */ Vec3f subCamEye; + /* 0x0F74 */ Vec3f subCamAt; + /* 0x0F80 */ Vec3f subCamUp; /* 0x0F8C */ char unk_F8C[0x18]; - /* 0x0FA4 */ Vec3f cameraEyeVel; - /* 0x0FB0 */ Vec3f cameraAtVel; - /* 0x0FBC */ Vec3f cameraNextEye; - /* 0x0FC8 */ Vec3f cameraEyeMaxVel; - /* 0x0FD4 */ Vec3f cameraNextAt; - /* 0x0FE0 */ Vec3f cameraAtMaxVel; - /* 0x0FEC */ f32 cameraSpeedMod; - /* 0x0FF0 */ f32 cameraAccel; + /* 0x0FA4 */ Vec3f subCamEyeVel; + /* 0x0FB0 */ Vec3f subCamAtVel; + /* 0x0FBC */ Vec3f subCamEyeNext; + /* 0x0FC8 */ Vec3f subCamEyeMaxVelFrac; + /* 0x0FD4 */ Vec3f subCamAtNext; + /* 0x0FE0 */ Vec3f subCamAtMaxVelFrac; + /* 0x0FEC */ f32 subCamVelFactor; + /* 0x0FF0 */ f32 subCamAccel; /* 0x0FF4 */ char unk_FF4[8]; - /* 0x0FFC */ f32 cameraDist; - /* 0x1000 */ f32 cameraSpeed; - /* 0x1004 */ f32 cameraYaw; - /* 0x1008 */ f32 cameraYawRate; - /* 0x100C */ f32 cameraYawShake; + /* 0x0FFC */ f32 subCamDist; + /* 0x1000 */ f32 subCamSpeed; + /* 0x1004 */ f32 subCamYaw; + /* 0x1008 */ f32 subCamYawRate; + /* 0x100C */ f32 subCamYawShake; /* 0x1010 */ Vec3f tentTipPos; /* 0x101C */ ColliderJntSph tentCollider; /* 0x103C */ ColliderJntSphElement tentElements[19]; diff --git a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c index 58ffd88aed..112b88d86c 100644 --- a/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c +++ b/src/overlays/actors/ovl_Boss_Sst/z_boss_sst.c @@ -196,13 +196,13 @@ static Vec3f sRoomCenter = { ROOM_CENTER_X, ROOM_CENTER_Y, ROOM_CENTER_Z }; static Vec3f sHandOffsets[2]; static s16 sHandYawOffsets[2]; -static s16 sCutsceneCamera; -static Vec3f sCameraAt = { ROOM_CENTER_X + 50.0f, ROOM_CENTER_Y + 0.0f, ROOM_CENTER_Z + 0.0f }; -static Vec3f sCameraEye = { ROOM_CENTER_X + 150.0f, ROOM_CENTER_Y + 100.0f, ROOM_CENTER_Z + 0.0f }; -static Vec3f sCameraAtVel = { 0.0f, 0.0f, 0.0f }; -static Vec3f sCameraEyeVel = { 0.0f, 0.0f, 0.0f }; +static s16 sSubCamId; +static Vec3f sSubCamAt = { ROOM_CENTER_X + 50.0f, ROOM_CENTER_Y + 0.0f, ROOM_CENTER_Z + 0.0f }; +static Vec3f sSubCamEye = { ROOM_CENTER_X + 150.0f, ROOM_CENTER_Y + 100.0f, ROOM_CENTER_Z + 0.0f }; +static Vec3f sSubCamAtVel = { 0.0f, 0.0f, 0.0f }; +static Vec3f sSubCamEyeVel = { 0.0f, 0.0f, 0.0f }; -static Vec3f sCameraAtPoints[] = { +static Vec3f sSubCamAtPoints[] = { { ROOM_CENTER_X - 50.0f, ROOM_CENTER_Y + 300.0f, ROOM_CENTER_Z + 0.0f }, { ROOM_CENTER_X + 150.0f, ROOM_CENTER_Y + 300.0f, ROOM_CENTER_Z + 100.0f }, { ROOM_CENTER_X + 0.0f, ROOM_CENTER_Y + 600.0f, ROOM_CENTER_Z + 100.0f }, @@ -213,7 +213,7 @@ static Vec3f sCameraAtPoints[] = { { ROOM_CENTER_X - 60.0f, ROOM_CENTER_Y + 180.0f, ROOM_CENTER_Z + 730.0f }, }; -static Vec3f sCameraEyePoints[] = { +static Vec3f sSubCamEyePoints[] = { { ROOM_CENTER_X + 250.0f, ROOM_CENTER_Y + 800.0f, ROOM_CENTER_Z + 800.0f }, { ROOM_CENTER_X - 150.0f, ROOM_CENTER_Y + 700.0f, ROOM_CENTER_Z + 1400.0f }, { ROOM_CENTER_X + 250.0f, ROOM_CENTER_Y + 100.0f, ROOM_CENTER_Z + 750.0f }, @@ -374,15 +374,15 @@ void BossSst_HeadSetupIntro(BossSst* this, GlobalContext* globalCtx) { func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 8); - sCutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCutsceneCamera, CAM_STAT_ACTIVE); - Math_Vec3f_Copy(&sCameraAt, &player->actor.world.pos); + sSubCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); + Math_Vec3f_Copy(&sSubCamAt, &player->actor.world.pos); if (GET_EVENTCHKINF(EVENTCHKINF_77)) { - sCameraEye.z = ROOM_CENTER_Z - 100.0f; + sSubCamEye.z = ROOM_CENTER_Z - 100.0f; } - Gameplay_CameraSetAtEye(globalCtx, sCutsceneCamera, &sCameraAt, &sCameraEye); + Gameplay_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); this->actionFunc = BossSst_HeadIntro; } @@ -407,13 +407,13 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { player->stateFlags1 &= ~PLAYER_STATE1_5; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); - sCameraAt.y += 30.0f; - sCameraAt.z += 300.0f; - Gameplay_CameraSetAtEye(globalCtx, sCutsceneCamera, &sCameraAt, &sCameraEye); - Gameplay_CopyCamera(globalCtx, MAIN_CAM, sCutsceneCamera); - Gameplay_ChangeCameraStatus(globalCtx, sCutsceneCamera, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, sCutsceneCamera); + sSubCamAt.y += 30.0f; + sSubCamAt.z += 300.0f; + Gameplay_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); + Gameplay_CopyCamera(globalCtx, CAM_ID_MAIN, sSubCamId); + Gameplay_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Gameplay_ClearCamera(globalCtx, sSubCamId); SET_EVENTCHKINF(EVENTCHKINF_77); BossSst_HeadSetupNeutral(this); this->colliderJntSph.base.ocFlags1 |= OC1_ON; @@ -430,7 +430,7 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { player->currentYaw = -0x8000; } - Math_Vec3f_Copy(&sCameraAt, &player->actor.world.pos); + Math_Vec3f_Copy(&sSubCamAt, &player->actor.world.pos); if (player->actor.bgCheckFlags & BGCHECKFLAG_GROUND_TOUCH) { if (!this->ready) { sFloor->dyna.actor.params = BONGOFLOOR_HIT; @@ -442,17 +442,17 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { sHands[LEFT]->actor.draw = BossSst_DrawHand; this->actor.draw = BossSst_DrawHead; this->timer = 178; - sCameraAt.x = ROOM_CENTER_X - 23.0f; - sCameraAt.y = ROOM_CENTER_Y + 0.0f; - sCameraAt.z = ROOM_CENTER_Z + 0.0f; + sSubCamAt.x = ROOM_CENTER_X - 23.0f; + sSubCamAt.y = ROOM_CENTER_Y + 0.0f; + sSubCamAt.z = ROOM_CENTER_Z + 0.0f; } else { this->timer = 546; } } } else if (this->timer >= 478) { - sCameraEye.x += 10.0f; - sCameraEye.y += 10.0f; - sCameraEye.z -= 10.0f; + sSubCamEye.x += 10.0f; + sSubCamEye.y += 10.0f; + sSubCamEye.z -= 10.0f; } else if (this->timer >= 448) { if (this->timer == 460) { sHands[RIGHT]->actor.draw = BossSst_DrawHand; @@ -463,94 +463,94 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { BossSst_HandSetupDownbeat(sHands[RIGHT]); } if (this->timer > 460) { - sCameraEye.x -= 40.0f; - sCameraEye.y -= 40.0f; - sCameraEye.z += 20.0f; + sSubCamEye.x -= 40.0f; + sSubCamEye.y -= 40.0f; + sSubCamEye.z += 20.0f; } else if (this->timer == 460) { - sCameraAt.x = sHands[RIGHT]->actor.home.pos.x + 0.0f; - sCameraAt.y = sHands[RIGHT]->actor.home.pos.y - 20.0f; - sCameraAt.z = sHands[RIGHT]->actor.home.pos.z + 10.0f; - sCameraEye.x = sHands[RIGHT]->actor.home.pos.x + 150.0f; - sCameraEye.y = sHands[RIGHT]->actor.home.pos.y + 100.0f; - sCameraEye.z = sHands[RIGHT]->actor.home.pos.z + 80.0f; + sSubCamAt.x = sHands[RIGHT]->actor.home.pos.x + 0.0f; + sSubCamAt.y = sHands[RIGHT]->actor.home.pos.y - 20.0f; + sSubCamAt.z = sHands[RIGHT]->actor.home.pos.z + 10.0f; + sSubCamEye.x = sHands[RIGHT]->actor.home.pos.x + 150.0f; + sSubCamEye.y = sHands[RIGHT]->actor.home.pos.y + 100.0f; + sSubCamEye.z = sHands[RIGHT]->actor.home.pos.z + 80.0f; } } else { if (this->timer >= 372) { introStateTimer = this->timer - 372; tempo = 6; if (this->timer == 447) { - sCameraAt = player->actor.world.pos; - sCameraEye.x = ROOM_CENTER_X - 200.0f; - sCameraEye.y = ROOM_CENTER_Y + 160.0f; - sCameraEye.z = ROOM_CENTER_Z - 190.0f; + sSubCamAt = player->actor.world.pos; + sSubCamEye.x = ROOM_CENTER_X - 200.0f; + sSubCamEye.y = ROOM_CENTER_Y + 160.0f; + sSubCamEye.z = ROOM_CENTER_Z - 190.0f; } else if (introStateTimer == 11) { - sCameraAt.x = sHands[RIGHT]->actor.home.pos.x + 30.0f; - sCameraAt.y = sHands[RIGHT]->actor.home.pos.y + 0.0f; - sCameraAt.z = sHands[RIGHT]->actor.home.pos.z + 20.0f; - sCameraEye.x = sHands[RIGHT]->actor.home.pos.x + 100.0f; - sCameraEye.y = sHands[RIGHT]->actor.home.pos.y + 10.0f; - sCameraEye.z = sHands[RIGHT]->actor.home.pos.z - 210.0f; + sSubCamAt.x = sHands[RIGHT]->actor.home.pos.x + 30.0f; + sSubCamAt.y = sHands[RIGHT]->actor.home.pos.y + 0.0f; + sSubCamAt.z = sHands[RIGHT]->actor.home.pos.z + 20.0f; + sSubCamEye.x = sHands[RIGHT]->actor.home.pos.x + 100.0f; + sSubCamEye.y = sHands[RIGHT]->actor.home.pos.y + 10.0f; + sSubCamEye.z = sHands[RIGHT]->actor.home.pos.z - 210.0f; } else if (introStateTimer == 62) { - sCameraAt.x = sHands[LEFT]->actor.home.pos.x + 0.0f; - sCameraAt.y = sHands[LEFT]->actor.home.pos.y + 50.0f; - sCameraAt.z = sHands[LEFT]->actor.home.pos.z + 100.0f; - sCameraEye.x = sHands[LEFT]->actor.home.pos.x + 110.0f; - sCameraEye.y = sHands[LEFT]->actor.home.pos.y + 180.0f; - sCameraEye.z = sHands[LEFT]->actor.home.pos.z - 70.0f; + sSubCamAt.x = sHands[LEFT]->actor.home.pos.x + 0.0f; + sSubCamAt.y = sHands[LEFT]->actor.home.pos.y + 50.0f; + sSubCamAt.z = sHands[LEFT]->actor.home.pos.z + 100.0f; + sSubCamEye.x = sHands[LEFT]->actor.home.pos.x + 110.0f; + sSubCamEye.y = sHands[LEFT]->actor.home.pos.y + 180.0f; + sSubCamEye.z = sHands[LEFT]->actor.home.pos.z - 70.0f; } } else if (this->timer >= 304) { introStateTimer = this->timer - 304; tempo = 5; if (introStateTimer == 11) { - sCameraAt.x = sHands[RIGHT]->actor.home.pos.x + 40.0f; - sCameraAt.y = sHands[RIGHT]->actor.home.pos.y - 90.0f; - sCameraAt.z = sHands[RIGHT]->actor.home.pos.z - 40.0f; - sCameraEye.x = sHands[RIGHT]->actor.home.pos.x - 20.0f; - sCameraEye.y = sHands[RIGHT]->actor.home.pos.y + 210.0f; - sCameraEye.z = sHands[RIGHT]->actor.home.pos.z + 170.0f; + sSubCamAt.x = sHands[RIGHT]->actor.home.pos.x + 40.0f; + sSubCamAt.y = sHands[RIGHT]->actor.home.pos.y - 90.0f; + sSubCamAt.z = sHands[RIGHT]->actor.home.pos.z - 40.0f; + sSubCamEye.x = sHands[RIGHT]->actor.home.pos.x - 20.0f; + sSubCamEye.y = sHands[RIGHT]->actor.home.pos.y + 210.0f; + sSubCamEye.z = sHands[RIGHT]->actor.home.pos.z + 170.0f; } else if (this->timer == 368) { - sCameraAt.x = sHands[LEFT]->actor.home.pos.x - 20.0f; - sCameraAt.y = sHands[LEFT]->actor.home.pos.y + 0.0f; - sCameraAt.z = sHands[LEFT]->actor.home.pos.z + 0.0f; - sCameraEye.x = sHands[LEFT]->actor.home.pos.x - 70.0f; - sCameraEye.y = sHands[LEFT]->actor.home.pos.y + 170.0f; - sCameraEye.z = sHands[LEFT]->actor.home.pos.z + 150.0f; + sSubCamAt.x = sHands[LEFT]->actor.home.pos.x - 20.0f; + sSubCamAt.y = sHands[LEFT]->actor.home.pos.y + 0.0f; + sSubCamAt.z = sHands[LEFT]->actor.home.pos.z + 0.0f; + sSubCamEye.x = sHands[LEFT]->actor.home.pos.x - 70.0f; + sSubCamEye.y = sHands[LEFT]->actor.home.pos.y + 170.0f; + sSubCamEye.z = sHands[LEFT]->actor.home.pos.z + 150.0f; } } else if (this->timer >= 244) { introStateTimer = this->timer - 244; tempo = 4; if (introStateTimer == 11) { - sCameraAt.x = sHands[RIGHT]->actor.home.pos.x + 30.0f; - sCameraAt.y = sHands[RIGHT]->actor.home.pos.y + 70.0f; - sCameraAt.z = sHands[RIGHT]->actor.home.pos.z + 40.0f; - sCameraEye.x = sHands[RIGHT]->actor.home.pos.x + 110.0f; - sCameraEye.y = sHands[RIGHT]->actor.home.pos.y - 140.0f; - sCameraEye.z = sHands[RIGHT]->actor.home.pos.z - 10.0f; + sSubCamAt.x = sHands[RIGHT]->actor.home.pos.x + 30.0f; + sSubCamAt.y = sHands[RIGHT]->actor.home.pos.y + 70.0f; + sSubCamAt.z = sHands[RIGHT]->actor.home.pos.z + 40.0f; + sSubCamEye.x = sHands[RIGHT]->actor.home.pos.x + 110.0f; + sSubCamEye.y = sHands[RIGHT]->actor.home.pos.y - 140.0f; + sSubCamEye.z = sHands[RIGHT]->actor.home.pos.z - 10.0f; } else if (this->timer == 300) { - sCameraAt.x = sHands[LEFT]->actor.home.pos.x - 20.0f; - sCameraAt.y = sHands[LEFT]->actor.home.pos.y - 80.0f; - sCameraAt.z = sHands[LEFT]->actor.home.pos.z + 320.0f; - sCameraEye.x = sHands[LEFT]->actor.home.pos.x - 130.0f; - sCameraEye.y = sHands[LEFT]->actor.home.pos.y + 130.0f; - sCameraEye.z = sHands[LEFT]->actor.home.pos.z - 150.0f; + sSubCamAt.x = sHands[LEFT]->actor.home.pos.x - 20.0f; + sSubCamAt.y = sHands[LEFT]->actor.home.pos.y - 80.0f; + sSubCamAt.z = sHands[LEFT]->actor.home.pos.z + 320.0f; + sSubCamEye.x = sHands[LEFT]->actor.home.pos.x - 130.0f; + sSubCamEye.y = sHands[LEFT]->actor.home.pos.y + 130.0f; + sSubCamEye.z = sHands[LEFT]->actor.home.pos.z - 150.0f; } } else if (this->timer >= 192) { introStateTimer = this->timer - 192; tempo = 3; if (this->timer == 240) { - sCameraAt.x = sHands[LEFT]->actor.home.pos.x - 190.0f; - sCameraAt.y = sHands[LEFT]->actor.home.pos.y - 110.0f; - sCameraAt.z = sHands[LEFT]->actor.home.pos.z + 40.0f; - sCameraEye.x = sHands[LEFT]->actor.home.pos.x + 120.0f; - sCameraEye.y = sHands[LEFT]->actor.home.pos.y + 130.0f; - sCameraEye.z = sHands[LEFT]->actor.home.pos.z + 50.0f; + sSubCamAt.x = sHands[LEFT]->actor.home.pos.x - 190.0f; + sSubCamAt.y = sHands[LEFT]->actor.home.pos.y - 110.0f; + sSubCamAt.z = sHands[LEFT]->actor.home.pos.z + 40.0f; + sSubCamEye.x = sHands[LEFT]->actor.home.pos.x + 120.0f; + sSubCamEye.y = sHands[LEFT]->actor.home.pos.y + 130.0f; + sSubCamEye.z = sHands[LEFT]->actor.home.pos.z + 50.0f; } else if (introStateTimer == 12) { - sCameraAt.x = sRoomCenter.x + 50.0f; - sCameraAt.y = sRoomCenter.y - 90.0f; - sCameraAt.z = sRoomCenter.z - 200.0f; - sCameraEye.x = sRoomCenter.x + 50.0f; - sCameraEye.y = sRoomCenter.y + 350.0f; - sCameraEye.z = sRoomCenter.z + 150.0f; + sSubCamAt.x = sRoomCenter.x + 50.0f; + sSubCamAt.y = sRoomCenter.y - 90.0f; + sSubCamAt.z = sRoomCenter.z - 200.0f; + sSubCamEye.x = sRoomCenter.x + 50.0f; + sSubCamEye.y = sRoomCenter.y + 350.0f; + sSubCamEye.z = sRoomCenter.z + 150.0f; } } else if (this->timer >= 148) { introStateTimer = this->timer - 148; @@ -565,33 +565,33 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { if (this->timer <= 198) { revealStateTimer = 198 - this->timer; if (GET_EVENTCHKINF(EVENTCHKINF_77) && (revealStateTimer <= 44)) { - sCameraAt.x += 492.0f * 0.01f; - sCameraAt.y += 200.0f * 0.01f; - sCameraEye.x -= 80.0f * 0.01f; - sCameraEye.y -= 360.0f * 0.01f; - sCameraEye.z += 1000.0f * 0.01f; + sSubCamAt.x += 492.0f * 0.01f; + sSubCamAt.y += 200.0f * 0.01f; + sSubCamEye.x -= 80.0f * 0.01f; + sSubCamEye.y -= 360.0f * 0.01f; + sSubCamEye.z += 1000.0f * 0.01f; } else if (this->timer <= 20) { - sCameraAt.y -= 700.0f * 0.01f; - sCameraAt.z += 900.0f * 0.01f; - sCameraEye.x += 650.0f * 0.01f; - sCameraEye.y += 400.0f * 0.01f; - sCameraEye.z += 1550.0f * 0.01f; + sSubCamAt.y -= 700.0f * 0.01f; + sSubCamAt.z += 900.0f * 0.01f; + sSubCamEye.x += 650.0f * 0.01f; + sSubCamEye.y += 400.0f * 0.01f; + sSubCamEye.z += 1550.0f * 0.01f; this->vVanish = true; this->actor.flags |= ACTOR_FLAG_7; } else if (revealStateTimer < 40) { - sCameraAt.x += 125.0f * 0.01f; - sCameraAt.y += 350.0f * 0.01f; - sCameraAt.z += 500.0f * 0.01f; - sCameraEye.x += 200.0f * 0.01f; - sCameraEye.y -= 850.0f * 0.01f; + sSubCamAt.x += 125.0f * 0.01f; + sSubCamAt.y += 350.0f * 0.01f; + sSubCamAt.z += 500.0f * 0.01f; + sSubCamEye.x += 200.0f * 0.01f; + sSubCamEye.y -= 850.0f * 0.01f; } else if (revealStateTimer >= 45) { if (revealStateTimer < 85) { - sCameraAt.x -= 250.0f * 0.01f; - sCameraAt.y += 425.0f * 0.01f; - sCameraAt.z -= 1200.0f * 0.01f; - sCameraEye.x -= 650.0f * 0.01f; - sCameraEye.y += 125.0f * 0.01f; - sCameraEye.z -= 350.0f * 0.01f; + sSubCamAt.x -= 250.0f * 0.01f; + sSubCamAt.y += 425.0f * 0.01f; + sSubCamAt.z -= 1200.0f * 0.01f; + sSubCamEye.x -= 650.0f * 0.01f; + sSubCamEye.y += 125.0f * 0.01f; + sSubCamEye.z -= 350.0f * 0.01f; } else if (revealStateTimer == 85) { if (!GET_EVENTCHKINF(EVENTCHKINF_77)) { TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, @@ -612,7 +612,7 @@ void BossSst_HeadIntro(BossSst* this, GlobalContext* globalCtx) { } if (this->actionFunc != BossSst_HeadNeutral) { - Gameplay_CameraSetAtEye(globalCtx, sCutsceneCamera, &sCameraAt, &sCameraEye); + Gameplay_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); } } @@ -956,46 +956,46 @@ void BossSst_HeadRecover(BossSst* this, GlobalContext* globalCtx) { } } -void BossSst_SetCameraTargets(f32 cameraSpeedMod, s32 targetIndex) { - Vec3f* nextAt = &sCameraAtPoints[targetIndex]; - Vec3f* nextEye = &sCameraEyePoints[targetIndex]; +void BossSst_SetCameraTargets(f32 subCamVelFactor, s32 targetIndex) { + Vec3f* subCamAtNext = &sSubCamAtPoints[targetIndex]; + Vec3f* subCamEyeNext = &sSubCamEyePoints[targetIndex]; if (targetIndex != 0) { - Math_Vec3f_Copy(&sCameraAt, &sCameraAtPoints[targetIndex - 1]); - Math_Vec3f_Copy(&sCameraEye, &sCameraEyePoints[targetIndex - 1]); + Math_Vec3f_Copy(&sSubCamAt, &sSubCamAtPoints[targetIndex - 1]); + Math_Vec3f_Copy(&sSubCamEye, &sSubCamEyePoints[targetIndex - 1]); } - sCameraAtVel.x = (nextAt->x - sCameraAt.x) * cameraSpeedMod; - sCameraAtVel.y = (nextAt->y - sCameraAt.y) * cameraSpeedMod; - sCameraAtVel.z = (nextAt->z - sCameraAt.z) * cameraSpeedMod; + sSubCamAtVel.x = (subCamAtNext->x - sSubCamAt.x) * subCamVelFactor; + sSubCamAtVel.y = (subCamAtNext->y - sSubCamAt.y) * subCamVelFactor; + sSubCamAtVel.z = (subCamAtNext->z - sSubCamAt.z) * subCamVelFactor; - sCameraEyeVel.x = (nextEye->x - sCameraEye.x) * cameraSpeedMod; - sCameraEyeVel.y = (nextEye->y - sCameraEye.y) * cameraSpeedMod; - sCameraEyeVel.z = (nextEye->z - sCameraEye.z) * cameraSpeedMod; + sSubCamEyeVel.x = (subCamEyeNext->x - sSubCamEye.x) * subCamVelFactor; + sSubCamEyeVel.y = (subCamEyeNext->y - sSubCamEye.y) * subCamVelFactor; + sSubCamEyeVel.z = (subCamEyeNext->z - sSubCamEye.z) * subCamVelFactor; } void BossSst_UpdateDeathCamera(BossSst* this, GlobalContext* globalCtx) { - Vec3f cameraAt; - Vec3f cameraEye; + Vec3f subCamAt; + Vec3f subCamEye; f32 sn; f32 cs; - sCameraAt.x += sCameraAtVel.x; - sCameraAt.y += sCameraAtVel.y; - sCameraAt.z += sCameraAtVel.z; - sCameraEye.x += sCameraEyeVel.x; - sCameraEye.y += sCameraEyeVel.y; - sCameraEye.z += sCameraEyeVel.z; + sSubCamAt.x += sSubCamAtVel.x; + sSubCamAt.y += sSubCamAtVel.y; + sSubCamAt.z += sSubCamAtVel.z; + sSubCamEye.x += sSubCamEyeVel.x; + sSubCamEye.y += sSubCamEyeVel.y; + sSubCamEye.z += sSubCamEyeVel.z; sn = Math_SinS(this->actor.shape.rot.y); cs = Math_CosS(this->actor.shape.rot.y); - cameraAt.x = this->actor.world.pos.x + (sCameraAt.z * sn) + (sCameraAt.x * cs); - cameraAt.y = this->actor.home.pos.y - 140.0f + sCameraAt.y; - cameraAt.z = this->actor.world.pos.z + (sCameraAt.z * cs) - (sCameraAt.x * sn); - cameraEye.x = this->actor.world.pos.x + (sCameraEye.z * sn) + (sCameraEye.x * cs); - cameraEye.y = this->actor.home.pos.y - 140.0f + sCameraEye.y; - cameraEye.z = this->actor.world.pos.z + (sCameraEye.z * cs) - (sCameraEye.x * sn); - Gameplay_CameraSetAtEye(globalCtx, sCutsceneCamera, &cameraAt, &cameraEye); + subCamAt.x = this->actor.world.pos.x + (sSubCamAt.z * sn) + (sSubCamAt.x * cs); + subCamAt.y = this->actor.home.pos.y - 140.0f + sSubCamAt.y; + subCamAt.z = this->actor.world.pos.z + (sSubCamAt.z * cs) - (sSubCamAt.x * sn); + subCamEye.x = this->actor.world.pos.x + (sSubCamEye.z * sn) + (sSubCamEye.x * cs); + subCamEye.y = this->actor.home.pos.y - 140.0f + sSubCamEye.y; + subCamEye.z = this->actor.world.pos.z + (sSubCamEye.z * cs) - (sSubCamEye.x * sn); + Gameplay_CameraSetAtEye(globalCtx, sSubCamId, &subCamAt, &subCamEye); } void BossSst_HeadSetupDeath(BossSst* this, GlobalContext* globalCtx) { @@ -1012,13 +1012,13 @@ void BossSst_HeadSetupDeath(BossSst* this, GlobalContext* globalCtx) { sHands[LEFT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON; sHands[RIGHT]->colliderJntSph.base.ocFlags1 &= ~OC1_ON; Audio_QueueSeqCmd(0x1 << 28 | SEQ_PLAYER_BGM_MAIN << 24 | 0x100FF); - sCutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCutsceneCamera, CAM_STAT_ACTIVE); - Gameplay_CopyCamera(globalCtx, sCutsceneCamera, MAIN_CAM); + sSubCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); + Gameplay_CopyCamera(globalCtx, sSubCamId, CAM_ID_MAIN); func_8002DF54(globalCtx, &player->actor, 8); func_80064520(globalCtx, &globalCtx->csCtx); - Math_Vec3f_Copy(&sCameraEye, &GET_ACTIVE_CAM(globalCtx)->eye); + Math_Vec3f_Copy(&sSubCamEye, &GET_ACTIVE_CAM(globalCtx)->eye); this->actionFunc = BossSst_HeadDeath; } @@ -1034,7 +1034,7 @@ void BossSst_HeadDeath(BossSst* this, GlobalContext* globalCtx) { BossSst_HandSetupThrash(sHands[RIGHT]); BossSst_HeadSetupThrash(this); } else if (this->timer > 48) { - Gameplay_CameraSetAtEye(globalCtx, sCutsceneCamera, &this->actor.focus.pos, &sCameraEye); + Gameplay_CameraSetAtEye(globalCtx, sSubCamId, &this->actor.focus.pos, &sSubCamEye); Math_StepToF(&this->radius, -350.0f, 10.0f); } else if (this->timer == 48) { Player* player = GET_PLAYER(globalCtx); @@ -1044,8 +1044,8 @@ void BossSst_HeadDeath(BossSst* this, GlobalContext* globalCtx) { 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, &GET_ACTIVE_CAM(globalCtx)->eye); - func_8002DBD0(&this->actor, &sCameraAt, &GET_ACTIVE_CAM(globalCtx)->at); + func_8002DBD0(&this->actor, &sSubCamEye, &GET_ACTIVE_CAM(globalCtx)->eye); + func_8002DBD0(&this->actor, &sSubCamAt, &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); @@ -1110,12 +1110,12 @@ void BossSst_HeadDarken(BossSst* this, GlobalContext* globalCtx) { void BossSst_HeadSetupFall(BossSst* this) { this->actor.speedXZ = 1.0f; - Math_Vec3f_Copy(&sCameraAt, &sCameraAtPoints[3]); - Math_Vec3f_Copy(&sCameraEye, &sCameraEyePoints[3]); - sCameraAtVel.x = 0.0f; - sCameraAtVel.z = 0.0f; - sCameraAtVel.y = -50.0f; - Math_Vec3f_Copy(&sCameraEyeVel, &sZeroVec); + Math_Vec3f_Copy(&sSubCamAt, &sSubCamAtPoints[3]); + Math_Vec3f_Copy(&sSubCamEye, &sSubCamEyePoints[3]); + sSubCamAtVel.x = 0.0f; + sSubCamAtVel.z = 0.0f; + sSubCamAtVel.y = -50.0f; + Math_Vec3f_Copy(&sSubCamEyeVel, &sZeroVec); this->actionFunc = BossSst_HeadFall; } @@ -1125,7 +1125,7 @@ void BossSst_HeadFall(BossSst* this, GlobalContext* globalCtx) { BossSst_HeadSetupMelt(this); } - if (sCameraAt.y > 200.0f) { + if (sSubCamAt.y > 200.0f) { BossSst_UpdateDeathCamera(this, globalCtx); } } @@ -1175,10 +1175,10 @@ void BossSst_HeadFinish(BossSst* this, GlobalContext* globalCtx) { if (this->effectMode == BONGO_NULL) { if (this->timer < -170) { BossSst_UpdateDeathCamera(this, globalCtx); - Gameplay_CopyCamera(globalCtx, MAIN_CAM, sCutsceneCamera); - Gameplay_ChangeCameraStatus(globalCtx, sCutsceneCamera, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, sCutsceneCamera); + Gameplay_CopyCamera(globalCtx, CAM_ID_MAIN, sSubCamId); + Gameplay_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Gameplay_ClearCamera(globalCtx, sSubCamId); func_8002DF54(globalCtx, &GET_PLAYER(globalCtx)->actor, 7); func_80064534(globalCtx, &globalCtx->csCtx); Actor_Kill(&this->actor); diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c index ab0b0b56be..d9850344bb 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.c @@ -1510,7 +1510,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 0x39); this->subCamId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->subCamDist = 800.0f; this->subCamYaw = M_PI; @@ -1568,7 +1568,7 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { break; } - if (this->subCamId != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { if (this->unk_5F9 == 0) { Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } else { @@ -1715,13 +1715,13 @@ void BossTw_TwinrovaMergeCS(BossTw* this, GlobalContext* globalCtx) { } if (this->timers[2] == 1) { - Camera* cam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); - cam->eye = this->subCamEye; - cam->eyeNext = this->subCamEye; - cam->at = this->subCamAt; + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; func_800C08AC(globalCtx, this->subCamId, 0); - this->subCamId = 0; + this->subCamId = SUB_CAM_ID_DONE; this->csState2 = this->subCamId; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); @@ -1778,7 +1778,7 @@ void BossTw_TwinrovaSetupIntroCS(BossTw* this, GlobalContext* globalCtx) { } void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { - u8 updateCam = 0; + u8 updateCam = false; s16 i; Vec3f sp90; Vec3f sp84; @@ -1806,30 +1806,30 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 0x39); this->subCamId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->subCamEye.x = 0.0f; this->subCamEye.y = 350; this->subCamEye.z = 200; - this->subCamEyeTarget.x = 450; - this->subCamEyeTarget.y = 900; + this->subCamEyeNext.x = 450; + this->subCamEyeNext.y = 900; this->subCamAt.x = 0; this->subCamAt.y = 270; this->subCamAt.z = 0; - this->subCamAtTarget.x = 0; - this->subCamAtTarget.y = 240; - this->subCamAtTarget.z = 140; + this->subCamAtNext.x = 0; + this->subCamAtNext.y = 240; + this->subCamAtNext.z = 140; - this->subCamEyeTarget.z = 530; - this->subCamEyeStep.x = fabsf(this->subCamEyeTarget.x - this->subCamEye.x); - this->subCamEyeStep.y = fabsf(this->subCamEyeTarget.y - this->subCamEye.y); - this->subCamEyeStep.z = fabsf(this->subCamEyeTarget.z - this->subCamEye.z); - this->subCamAtStep.x = fabsf(this->subCamAtTarget.x - this->subCamAt.x); - this->subCamAtStep.y = fabsf(this->subCamAtTarget.y - this->subCamAt.y); - this->subCamAtStep.z = fabsf(this->subCamAtTarget.z - this->subCamAt.z); + this->subCamEyeNext.z = 530; + this->subCamEyeVel.x = fabsf(this->subCamEyeNext.x - this->subCamEye.x); + this->subCamEyeVel.y = fabsf(this->subCamEyeNext.y - this->subCamEye.y); + this->subCamEyeVel.z = fabsf(this->subCamEyeNext.z - this->subCamEye.z); + this->subCamAtVel.x = fabsf(this->subCamAtNext.x - this->subCamAt.x); + this->subCamAtVel.y = fabsf(this->subCamAtNext.y - this->subCamAt.y); + this->subCamAtVel.z = fabsf(this->subCamAtNext.z - this->subCamAt.z); this->subCamDistStep = 0.05f; this->work[CS_TIMER_1] = 0; @@ -1837,7 +1837,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { break; case 1: - updateCam = 1; + updateCam = true; if (this->work[CS_TIMER_1] == 30) { Message_StartTextbox(globalCtx, 0x6048, NULL); @@ -1891,20 +1891,20 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { if (this->work[CS_TIMER_1] > 50) { this->csState2 = 3; - this->subCamEyeTarget.x = -30; - this->subCamEyeTarget.y = 260; - this->subCamEyeTarget.z = 530; + this->subCamEyeNext.x = -30; + this->subCamEyeNext.y = 260; + this->subCamEyeNext.z = 530; - this->subCamAtTarget.x = 0.0f; - this->subCamAtTarget.y = 265; - this->subCamAtTarget.z = 580; + this->subCamAtNext.x = 0.0f; + this->subCamAtNext.y = 265; + this->subCamAtNext.z = 580; - this->subCamEyeStep.x = fabsf(this->subCamEyeTarget.x - this->subCamEye.x); - this->subCamEyeStep.y = fabsf(this->subCamEyeTarget.y - this->subCamEye.y); - this->subCamEyeStep.z = fabsf(this->subCamEyeTarget.z - this->subCamEye.z); - this->subCamAtStep.x = fabsf(this->subCamAtTarget.x - this->subCamAt.x); - this->subCamAtStep.y = fabsf(this->subCamAtTarget.y - this->subCamAt.y); - this->subCamAtStep.z = fabsf(this->subCamAtTarget.z - this->subCamAt.z); + this->subCamEyeVel.x = fabsf(this->subCamEyeNext.x - this->subCamEye.x); + this->subCamEyeVel.y = fabsf(this->subCamEyeNext.y - this->subCamEye.y); + this->subCamEyeVel.z = fabsf(this->subCamEyeNext.z - this->subCamEye.z); + this->subCamAtVel.x = fabsf(this->subCamAtNext.x - this->subCamAt.x); + this->subCamAtVel.y = fabsf(this->subCamAtNext.y - this->subCamAt.y); + this->subCamAtVel.z = fabsf(this->subCamAtNext.z - this->subCamAt.z); this->subCamUpdateRate = 0; this->subCamDistStep = 0.1f; this->work[CS_TIMER_1] = 0; @@ -1913,7 +1913,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { case 3: SkelAnime_Update(&sKoumePtr->skelAnime); - updateCam = 1; + updateCam = true; Math_ApproachF(&sKoumePtr->actor.world.pos.y, 240.0f, 0.05f, 5.0f); Math_ApproachF(&this->subCamUpdateRate, 1.0f, 1.0f, 0.02f); @@ -1925,20 +1925,20 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { this->csState2 = 4; this->actor.speedXZ = 0; - this->subCamEyeTarget.x = -80.0f; - this->subCamEyeTarget.y = 260.0f; - this->subCamEyeTarget.z = 430.0f; + this->subCamEyeNext.x = -80.0f; + this->subCamEyeNext.y = 260.0f; + this->subCamEyeNext.z = 430.0f; - this->subCamAtTarget.x = sKoumePtr->actor.world.pos.x; - this->subCamAtTarget.y = sKoumePtr->actor.world.pos.y + 20.0f; - this->subCamAtTarget.z = sKoumePtr->actor.world.pos.z; + this->subCamAtNext.x = sKoumePtr->actor.world.pos.x; + this->subCamAtNext.y = sKoumePtr->actor.world.pos.y + 20.0f; + this->subCamAtNext.z = sKoumePtr->actor.world.pos.z; - this->subCamEyeStep.x = fabsf(this->subCamEyeTarget.x - this->subCamEye.x); - this->subCamEyeStep.y = fabsf(this->subCamEyeTarget.y - this->subCamEye.y); - this->subCamEyeStep.z = fabsf(this->subCamEyeTarget.z - this->subCamEye.z); - this->subCamAtStep.x = fabsf(this->subCamAtTarget.x - this->subCamAt.x); - this->subCamAtStep.y = fabsf(this->subCamAtTarget.y - this->subCamAt.y); - this->subCamAtStep.z = fabsf(this->subCamAtTarget.z - this->subCamAt.z); + this->subCamEyeVel.x = fabsf(this->subCamEyeNext.x - this->subCamEye.x); + this->subCamEyeVel.y = fabsf(this->subCamEyeNext.y - this->subCamEye.y); + this->subCamEyeVel.z = fabsf(this->subCamEyeNext.z - this->subCamEye.z); + this->subCamAtVel.x = fabsf(this->subCamAtNext.x - this->subCamAt.x); + this->subCamAtVel.y = fabsf(this->subCamAtNext.y - this->subCamAt.y); + this->subCamAtVel.z = fabsf(this->subCamAtNext.z - this->subCamAt.z); this->subCamUpdateRate = 0.0f; this->subCamDistStep = 0.05f; Animation_MorphToPlayOnce(&sKoumePtr->skelAnime, &object_tw_Anim_000AAC, 0.0f); @@ -1948,9 +1948,9 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { break; case 4: - updateCam = 1; + updateCam = true; SkelAnime_Update(&sKoumePtr->skelAnime); - this->subCamAtTarget.y = 20.0f + sKoumePtr->actor.world.pos.y; + this->subCamAtNext.y = 20.0f + sKoumePtr->actor.world.pos.y; Math_ApproachF(&sKoumePtr->actor.world.pos.y, 350, 0.1f, this->actor.speedXZ); Math_ApproachF(&this->actor.speedXZ, 9.0f, 1.0f, 0.9f); Math_ApproachF(&this->subCamUpdateRate, 1.0f, 1.0f, 0.02f); @@ -2057,18 +2057,18 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { if (this->work[CS_TIMER_1] >= 0x33) { this->csState2 = 11; - this->subCamEyeTarget.x = -30; - this->subCamEyeTarget.y = 260; - this->subCamEyeTarget.z = -530; - this->subCamAtTarget.x = 0; - this->subCamAtTarget.y = 265; - this->subCamAtTarget.z = -580; - this->subCamEyeStep.x = fabsf(this->subCamEyeTarget.x - this->subCamEye.x); - this->subCamEyeStep.y = fabsf(this->subCamEyeTarget.y - this->subCamEye.y); - this->subCamEyeStep.z = fabsf(this->subCamEyeTarget.z - this->subCamEye.z); - this->subCamAtStep.x = fabsf(this->subCamAtTarget.x - this->subCamAt.x); - this->subCamAtStep.y = fabsf(this->subCamAtTarget.y - this->subCamAt.y); - this->subCamAtStep.z = fabsf(this->subCamAtTarget.z - this->subCamAt.z); + this->subCamEyeNext.x = -30; + this->subCamEyeNext.y = 260; + this->subCamEyeNext.z = -530; + this->subCamAtNext.x = 0; + this->subCamAtNext.y = 265; + this->subCamAtNext.z = -580; + this->subCamEyeVel.x = fabsf(this->subCamEyeNext.x - this->subCamEye.x); + this->subCamEyeVel.y = fabsf(this->subCamEyeNext.y - this->subCamEye.y); + this->subCamEyeVel.z = fabsf(this->subCamEyeNext.z - this->subCamEye.z); + this->subCamAtVel.x = fabsf(this->subCamAtNext.x - this->subCamAt.x); + this->subCamAtVel.y = fabsf(this->subCamAtNext.y - this->subCamAt.y); + this->subCamAtVel.z = fabsf(this->subCamAtNext.z - this->subCamAt.z); this->subCamUpdateRate = 0; this->subCamDistStep = 0.1f; this->work[CS_TIMER_1] = 0; @@ -2077,7 +2077,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { case 11: SkelAnime_Update(&sKotakePtr->skelAnime); - updateCam = 1; + updateCam = true; Math_ApproachF(&sKotakePtr->actor.world.pos.y, 240.0f, 0.05f, 5.0f); Math_ApproachF(&this->subCamUpdateRate, 1.0f, 1.0f, 0.02f); @@ -2089,20 +2089,20 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { this->csState2 = 12; this->actor.speedXZ = 0; - this->subCamEyeTarget.y = 260.0f; - this->subCamEyeTarget.x = -80.0f; - this->subCamEyeTarget.z = -430.0f; + this->subCamEyeNext.y = 260.0f; + this->subCamEyeNext.x = -80.0f; + this->subCamEyeNext.z = -430.0f; - this->subCamAtTarget.x = sKotakePtr->actor.world.pos.x; - this->subCamAtTarget.y = sKotakePtr->actor.world.pos.y + 20.0f; - this->subCamAtTarget.z = sKotakePtr->actor.world.pos.z; + this->subCamAtNext.x = sKotakePtr->actor.world.pos.x; + this->subCamAtNext.y = sKotakePtr->actor.world.pos.y + 20.0f; + this->subCamAtNext.z = sKotakePtr->actor.world.pos.z; - this->subCamEyeStep.x = fabsf(this->subCamEyeTarget.x - this->subCamEye.x); - this->subCamEyeStep.y = fabsf(this->subCamEyeTarget.y - this->subCamEye.y); - this->subCamEyeStep.z = fabsf(this->subCamEyeTarget.z - this->subCamEye.z); - this->subCamAtStep.x = fabsf(this->subCamAtTarget.x - this->subCamAt.x); - this->subCamAtStep.y = fabsf(this->subCamAtTarget.y - this->subCamAt.y); - this->subCamAtStep.z = fabsf(this->subCamAtTarget.z - this->subCamAt.z); + this->subCamEyeVel.x = fabsf(this->subCamEyeNext.x - this->subCamEye.x); + this->subCamEyeVel.y = fabsf(this->subCamEyeNext.y - this->subCamEye.y); + this->subCamEyeVel.z = fabsf(this->subCamEyeNext.z - this->subCamEye.z); + this->subCamAtVel.x = fabsf(this->subCamAtNext.x - this->subCamAt.x); + this->subCamAtVel.y = fabsf(this->subCamAtNext.y - this->subCamAt.y); + this->subCamAtVel.z = fabsf(this->subCamAtNext.z - this->subCamAt.z); this->subCamUpdateRate = 0; this->subCamDistStep = 0.05f; Animation_MorphToPlayOnce(&sKotakePtr->skelAnime, &object_tw_Anim_000AAC, 0); @@ -2112,9 +2112,9 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { break; case 12: - updateCam = 1; + updateCam = true; SkelAnime_Update(&sKotakePtr->skelAnime); - this->subCamAtTarget.y = sKotakePtr->actor.world.pos.y + 20.0f; + this->subCamAtNext.y = sKotakePtr->actor.world.pos.y + 20.0f; Math_ApproachF(&sKotakePtr->actor.world.pos.y, 350, 0.1f, this->actor.speedXZ); Math_ApproachF(&this->actor.speedXZ, 9.0f, 1.0f, 0.9f); Math_ApproachF(&this->subCamUpdateRate, 1.0f, 1.0f, 0.02f); @@ -2189,7 +2189,7 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { this->workf[UNK_F9] = -M_PI / 2.0f; this->workf[UNK_F10] = 0.0f; - this->subCamEyeStep.x = 0.0f; + this->subCamEyeVel.x = 0.0f; this->spawnPortalAlpha = 0.0f; } } else { @@ -2233,14 +2233,14 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { if (this->work[CS_TIMER_1] >= 160) { if (this->work[CS_TIMER_1] == 160) { - this->subCamEyeStep.x = 0.0f; + this->subCamEyeVel.x = 0.0f; } - Math_ApproachF(&this->subCamEye.x, 0.0f, 0.05f, this->subCamEyeStep.x * 0.5f); - Math_ApproachF(&this->subCamEye.z, 1000.0f, 0.05f, this->subCamEyeStep.x); - Math_ApproachF(&this->subCamEyeStep.x, 40.0f, 1.0f, 1); + Math_ApproachF(&this->subCamEye.x, 0.0f, 0.05f, this->subCamEyeVel.x * 0.5f); + Math_ApproachF(&this->subCamEye.z, 1000.0f, 0.05f, this->subCamEyeVel.x); + Math_ApproachF(&this->subCamEyeVel.x, 40.0f, 1.0f, 1); } else { - Math_ApproachF(&this->subCamEye.x, 300.0f, 0.05f, this->subCamEyeStep.x); - Math_ApproachF(&this->subCamEyeStep.x, 5.0f, 1.0f, 0.5f); + Math_ApproachF(&this->subCamEye.x, 300.0f, 0.05f, this->subCamEyeVel.x); + Math_ApproachF(&this->subCamEyeVel.x, 5.0f, 1.0f, 0.5f); } if (this->work[CS_TIMER_1] < 200) { @@ -2280,13 +2280,13 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { } if (this->work[CS_TIMER_1] == 260) { - Camera* cam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); - cam->eye = this->subCamEye; - cam->eyeNext = this->subCamEye; - cam->at = this->subCamAt; + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; func_800C08AC(globalCtx, this->subCamId, 0); - this->subCamId = 0; + this->subCamId = SUB_CAM_ID_DONE; this->csState2 = this->subCamId; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); @@ -2295,20 +2295,20 @@ void BossTw_TwinrovaIntroCS(BossTw* this, GlobalContext* globalCtx) { break; } - if (this->subCamId != 0) { + if (this->subCamId != SUB_CAM_ID_DONE) { if (updateCam) { - Math_ApproachF(&this->subCamEye.x, this->subCamEyeTarget.x, this->subCamDistStep, - this->subCamEyeStep.x * this->subCamUpdateRate); - Math_ApproachF(&this->subCamEye.y, this->subCamEyeTarget.y, this->subCamDistStep, - this->subCamEyeStep.y * this->subCamUpdateRate); - Math_ApproachF(&this->subCamEye.z, this->subCamEyeTarget.z, this->subCamDistStep, - this->subCamEyeStep.z * this->subCamUpdateRate); - Math_ApproachF(&this->subCamAt.x, this->subCamAtTarget.x, this->subCamDistStep, - this->subCamAtStep.x * this->subCamUpdateRate); - Math_ApproachF(&this->subCamAt.y, this->subCamAtTarget.y, this->subCamDistStep, - this->subCamAtStep.y * this->subCamUpdateRate); - Math_ApproachF(&this->subCamAt.z, this->subCamAtTarget.z, this->subCamDistStep, - this->subCamAtStep.z * this->subCamUpdateRate); + Math_ApproachF(&this->subCamEye.x, this->subCamEyeNext.x, this->subCamDistStep, + this->subCamEyeVel.x * this->subCamUpdateRate); + Math_ApproachF(&this->subCamEye.y, this->subCamEyeNext.y, this->subCamDistStep, + this->subCamEyeVel.y * this->subCamUpdateRate); + Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, this->subCamDistStep, + this->subCamEyeVel.z * this->subCamUpdateRate); + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, this->subCamDistStep, + this->subCamAtVel.x * this->subCamUpdateRate); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, this->subCamDistStep, + this->subCamAtVel.y * this->subCamUpdateRate); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, this->subCamDistStep, + this->subCamAtVel.z * this->subCamUpdateRate); } Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); @@ -2618,7 +2618,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { s16 i; Vec3f spD0; Player* player = GET_PLAYER(globalCtx); - Camera* mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); SkelAnime_Update(&this->skelAnime); this->work[UNK_S8] += 20; @@ -2697,7 +2697,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 8); this->subCamId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->subCamEye = mainCam->eye; this->subCamAt = mainCam->at; @@ -2815,13 +2815,13 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { Actor_SetScale(&sKoumePtr->actor, sKoumePtr->actor.scale.x); Actor_SetScale(&sKotakePtr->actor, sKoumePtr->actor.scale.x); if (this->work[CS_TIMER_2] >= 1020) { - mainCam = Gameplay_GetCamera(globalCtx, MAIN_CAM); + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); mainCam->eye = this->subCamEye; mainCam->eyeNext = this->subCamEye; mainCam->at = this->subCamAt; func_800C08AC(globalCtx, this->subCamId, 0); this->csState2 = 4; - this->subCamId = 0; + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS_CLEAR); @@ -2840,7 +2840,7 @@ void BossTw_TwinrovaDeathCS(BossTw* this, GlobalContext* globalCtx) { break; } - if (this->subCamId) { + if (this->subCamId != SUB_CAM_ID_DONE) { if (1) {} Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } diff --git a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h index 575997c267..81329abff8 100644 --- a/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h +++ b/src/overlays/actors/ovl_Boss_Tw/z_boss_tw.h @@ -121,11 +121,11 @@ typedef struct BossTw { /* 0x0624 */ Vec3f subCamEye2; /* 0x0630 */ Vec3f subCamAt2; /* 0x063C */ char unused_63C[0x18]; - /* 0x0654 */ Vec3f subCamEyeStep; - /* 0x0660 */ Vec3f subCamAtStep; - /* 0x066C */ Vec3f subCamEyeTarget; + /* 0x0654 */ Vec3f subCamEyeVel; + /* 0x0660 */ Vec3f subCamAtVel; + /* 0x066C */ Vec3f subCamEyeNext; /* 0x0678 */ char unused_678[0xC]; - /* 0x0684 */ Vec3f subCamAtTarget; + /* 0x0684 */ Vec3f subCamAtNext; /* 0x0690 */ char unused_690[0xC]; /* 0x069C */ f32 subCamUpdateRate; /* 0x06A0 */ f32 subCamDistStep; diff --git a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c index e8c044e996..ec6d9e9602 100644 --- a/src/overlays/actors/ovl_Boss_Va/z_boss_va.c +++ b/src/overlays/actors/ovl_Boss_Va/z_boss_va.c @@ -376,18 +376,18 @@ static DamageTable sDamageTable[] = { static Vec3f sZeroVec = { 0.0f, 0.0f, 0.0f }; static u8 sKillBari = 0; static u8 sBodyBari[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; -static s16 sCsCamera = 0; +static s16 sSubCamId = SUB_CAM_ID_DONE; static BossVaEffect sEffects[BOSS_VA_EFFECT_COUNT]; static u8 sBodyState; static u8 sFightPhase; static s8 sCsState; -static Vec3f sCameraEye; -static Vec3f sCameraAt; -static Vec3f sCameraNextEye; -static Vec3f sCameraNextAt; -static Vec3f sCameraEyeMaxVel; -static Vec3f sCameraAtMaxVel; +static Vec3f sSubCamEye; +static Vec3f sSubCamAt; +static Vec3f sSubCamEyeNext; +static Vec3f sSubCamAtNext; +static Vec3f sSubCamEyeMaxVelFrac; +static Vec3f sSubCamAtMaxVelFrac; static s16 sDoorState; static u8 sPhase3StopMoving; static Vec3s sZapperRot; @@ -649,16 +649,16 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { globalCtx->envCtx.screenFillColor[2] = 0xBE; globalCtx->envCtx.screenFillColor[3] = 0xD2; func_80064520(globalCtx, &globalCtx->csCtx); - sCsCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCsCamera, CAM_STAT_ACTIVE); - sCameraNextEye.x = sCameraEye.x = 140.0f; - sCameraNextEye.y = sCameraEye.y = 205.0f; - sCameraNextEye.z = sCameraEye.z = -20.0f; - sCameraNextAt.x = sCameraAt.x = 10.0f; - sCameraNextAt.y = sCameraAt.y = 50.0f; - sCameraNextAt.z = sCameraAt.z = -220.0f; - Gameplay_CameraSetAtEye(globalCtx, sCsCamera, &sCameraAt, &sCameraEye); + sSubCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); + sSubCamEyeNext.x = sSubCamEye.x = 140.0f; + sSubCamEyeNext.y = sSubCamEye.y = 205.0f; + sSubCamEyeNext.z = sSubCamEye.z = -20.0f; + sSubCamAtNext.x = sSubCamAt.x = 10.0f; + sSubCamAtNext.y = sSubCamAt.y = 50.0f; + sSubCamAtNext.z = sSubCamAt.z = -220.0f; + Gameplay_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); this->timer = 20; for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_UPPER_1; i--) { @@ -670,7 +670,7 @@ void BossVa_Init(Actor* thisx, GlobalContext* globalCtx2) { sInitRot[i].y + this->actor.world.rot.y, sInitRot[i].z + this->actor.world.rot.z, i); } - sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec; } else { sCsState = INTRO_START; @@ -790,21 +790,21 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { break; case INTRO_LOOK_DOOR: func_80064520(globalCtx, &globalCtx->csCtx); - if (sCsCamera == SUBCAM_FREE) { - sCsCamera = Gameplay_CreateSubCamera(globalCtx); + if (sSubCamId == SUB_CAM_ID_DONE) { + sSubCamId = Gameplay_CreateSubCamera(globalCtx); } - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCsCamera, CAM_STAT_ACTIVE); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); - sCameraNextEye.x = sCameraEye.x = 13.0f; - sCameraNextEye.y = sCameraEye.y = 124.0f; - sCameraNextEye.z = sCameraEye.z = 167.0f; + sSubCamEyeNext.x = sSubCamEye.x = 13.0f; + sSubCamEyeNext.y = sSubCamEye.y = 124.0f; + sSubCamEyeNext.z = sSubCamEye.z = 167.0f; - sCameraNextAt.x = sCameraAt.x = player->actor.world.pos.x; - sCameraNextAt.y = sCameraAt.y = player->actor.world.pos.y; - sCameraNextAt.z = sCameraAt.z = player->actor.world.pos.z; + sSubCamAtNext.x = sSubCamAt.x = player->actor.world.pos.x; + sSubCamAtNext.y = sSubCamAt.y = player->actor.world.pos.y; + sSubCamAtNext.z = sSubCamAt.z = player->actor.world.pos.z; - sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec; this->timer = 10; sCsState++; @@ -832,21 +832,21 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { break; case INTRO_SPAWN_BARI: func_80064520(globalCtx, &globalCtx->csCtx); - if (sCsCamera == SUBCAM_FREE) { - sCsCamera = Gameplay_CreateSubCamera(globalCtx); + if (sSubCamId == SUB_CAM_ID_DONE) { + sSubCamId = Gameplay_CreateSubCamera(globalCtx); } - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCsCamera, CAM_STAT_ACTIVE); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); - sCameraNextEye.x = sCameraEye.x = 13.0f; - sCameraNextEye.y = sCameraEye.y = 124.0f; - sCameraNextEye.z = sCameraEye.z = 167.0f; + sSubCamEyeNext.x = sSubCamEye.x = 13.0f; + sSubCamEyeNext.y = sSubCamEye.y = 124.0f; + sSubCamEyeNext.z = sSubCamEye.z = 167.0f; - sCameraNextAt.x = sCameraAt.x = player->actor.world.pos.x; - sCameraNextAt.y = sCameraAt.y = player->actor.world.pos.y; - sCameraNextAt.z = sCameraAt.z = player->actor.world.pos.z; + sSubCamAtNext.x = sSubCamAt.x = player->actor.world.pos.x; + sSubCamAtNext.y = sSubCamAt.y = player->actor.world.pos.y; + sSubCamAtNext.z = sSubCamAt.z = player->actor.world.pos.z; - sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec; for (i = BOSSVA_BARI_LOWER_5; i >= BOSSVA_BARI_UPPER_1; i--) { Actor_SpawnAsChild( @@ -860,16 +860,16 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { sCsState++; break; case INTRO_REVERSE_CAMERA: - sCameraNextEye.x = -92.0f; - sCameraNextEye.y = 22.0f; - sCameraNextEye.z = 360.0f; - sCameraNextAt.x = 63.0f; - sCameraNextAt.y = 104.0f; - sCameraNextAt.z = 248.0f; - Math_SmoothStepToF(&sCameraEyeMaxVel.x, 7.0f, 0.3f, 0.7f, 0.05f); - sCameraEyeMaxVel.z = sCameraEyeMaxVel.x; - sCameraEyeMaxVel.y = sCameraEyeMaxVel.z; - sCameraAtMaxVel = sCameraEyeMaxVel; + sSubCamEyeNext.x = -92.0f; + sSubCamEyeNext.y = 22.0f; + sSubCamEyeNext.z = 360.0f; + sSubCamAtNext.x = 63.0f; + sSubCamAtNext.y = 104.0f; + sSubCamAtNext.z = 248.0f; + Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 7.0f, 0.3f, 0.7f, 0.05f); + sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x; + sSubCamEyeMaxVelFrac.y = sSubCamEyeMaxVelFrac.z; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac; this->timer--; if (this->timer == 0) { @@ -878,25 +878,25 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { } break; case INTRO_SUPPORT_CAMERA: - sCameraNextEye.x = sCameraEye.x = 140.0f; - sCameraNextEye.y = sCameraEye.y = 205.0f; - sCameraNextEye.z = sCameraEye.z = -20.0f; + sSubCamEyeNext.x = sSubCamEye.x = 140.0f; + sSubCamEyeNext.y = sSubCamEye.y = 205.0f; + sSubCamEyeNext.z = sSubCamEye.z = -20.0f; - sCameraNextAt.x = sCameraAt.x = 10.0f; - sCameraNextAt.y = sCameraAt.y = 247.0f; - sCameraNextAt.z = sCameraAt.z = -220.0f; + sSubCamAtNext.x = sSubCamAt.x = 10.0f; + sSubCamAtNext.y = sSubCamAt.y = 247.0f; + sSubCamAtNext.z = sSubCamAt.z = -220.0f; sCsState++; this->timer = 1; break; case INTRO_BODY_SOUND: - sCameraNextAt.x = 10.0f; - sCameraNextAt.y = 247.0f; - sCameraNextAt.z = -220.0f; - Math_SmoothStepToF(&sCameraEyeMaxVel.x, 7.0f, 0.3f, 0.7f, 0.05f); - sCameraEyeMaxVel.z = sCameraEyeMaxVel.x; - sCameraEyeMaxVel.y = sCameraEyeMaxVel.z; - sCameraAtMaxVel = sCameraEyeMaxVel; + sSubCamAtNext.x = 10.0f; + sSubCamAtNext.y = 247.0f; + sSubCamAtNext.z = -220.0f; + Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 7.0f, 0.3f, 0.7f, 0.05f); + sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x; + sSubCamEyeMaxVelFrac.y = sSubCamEyeMaxVelFrac.z; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac; this->timer--; if (this->timer == 0) { @@ -907,11 +907,11 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { case INTRO_LOOK_SUPPORT: this->timer--; if (this->timer == 0) { - sCameraNextAt.x = 10.0f; - sCameraNextAt.y = 50.0f; - sCameraNextAt.z = -220.0f; + sSubCamAtNext.x = 10.0f; + sSubCamAtNext.y = 50.0f; + sSubCamAtNext.z = -220.0f; - sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec; sCsState++; sCsState++; @@ -919,13 +919,13 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { } break; case INTRO_CALL_BARI: - Math_SmoothStepToF(&sCameraEyeMaxVel.x, 14.0f, 0.3f, 1.0f, 0.25f); + Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 14.0f, 0.3f, 1.0f, 0.25f); - sCameraEyeMaxVel.y = sCameraEyeMaxVel.x * 0.7f; - sCameraEyeMaxVel.z = sCameraEyeMaxVel.x; + sSubCamEyeMaxVelFrac.y = sSubCamEyeMaxVelFrac.x * 0.7f; + sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x; - sCameraAtMaxVel = sCameraEyeMaxVel; - sCameraAtMaxVel.z = sCameraAtMaxVel.z * 1.75f; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac; + sSubCamAtMaxVelFrac.z = sSubCamAtMaxVelFrac.z * 1.75f; this->timer--; if (this->timer == 0) { @@ -953,9 +953,9 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { } } Math_SmoothStepToS(&this->unk_1F2, 0x280, 1, 0x32, 0); - Math_SmoothStepToF(&sCameraEyeMaxVel.x, 14.0f, 0.3f, 1.0f, 0.25f); - sCameraEyeMaxVel.z = sCameraEyeMaxVel.x; - sCameraAtMaxVel = sCameraEyeMaxVel; + Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 14.0f, 0.3f, 1.0f, 0.25f); + sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac; if (this->timer >= 45000) { globalCtx->envCtx.unk_BF = 1; func_8002DF54(globalCtx, &this->actor, 8); @@ -965,15 +965,15 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { this->timer += this->unk_1F2; if (this->timer >= 65536) { - sCameraEyeMaxVel.y = sCameraAtMaxVel.y = 9.8f; + sSubCamEyeMaxVelFrac.y = sSubCamAtMaxVelFrac.y = 9.8f; sCsState++; - sCameraNextEye.x = 10.0f; - sCameraNextEye.z = 0.0f; + sSubCamEyeNext.x = 10.0f; + sSubCamEyeNext.z = 0.0f; - sCameraNextAt.x = 10.0f; - sCameraNextAt.y = 140.0f; - sCameraNextAt.z = -200.0f; + sSubCamAtNext.x = 10.0f; + sSubCamAtNext.y = 140.0f; + sSubCamAtNext.z = -200.0f; if (!GET_EVENTCHKINF(EVENTCHKINF_76)) { TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, @@ -986,10 +986,10 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { this->timer = 40; } else { - sCameraEyeMaxVel.y = 1.6f; - sCameraNextEye.y = 5.0f; - sCameraNextEye.x = Math_SinS(this->timer) * 200.0f; - sCameraNextEye.z = (Math_CosS(this->timer) * 200.0f) + -200.0f; + sSubCamEyeMaxVelFrac.y = 1.6f; + sSubCamEyeNext.y = 5.0f; + sSubCamEyeNext.x = Math_SinS(this->timer) * 200.0f; + sSubCamEyeNext.z = (Math_CosS(this->timer) * 200.0f) + -200.0f; } break; case INTRO_TITLE: @@ -1011,10 +1011,10 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { case INTRO_FINISH: this->timer--; if (this->timer == 0) { - Gameplay_ClearCamera(globalCtx, sCsCamera); - sCsCamera = 0; + Gameplay_ClearCamera(globalCtx, sSubCamId); + sSubCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); func_8002DF54(globalCtx, &this->actor, 7); sCsState++; SET_EVENTCHKINF(EVENTCHKINF_76); @@ -1035,14 +1035,14 @@ void BossVa_BodyIntro(BossVa* this, GlobalContext* globalCtx) { this->unk_1B0 += 0xCE4; this->bodyGlow = (s16)(Math_SinS(this->unk_1B0) * 50.0f) + 150; - if ((sCsCamera != 0) && (sCsState <= INTRO_TITLE)) { - Math_SmoothStepToF(&sCameraEye.x, sCameraNextEye.x, 0.3f, sCameraEyeMaxVel.x, 0.075f); - Math_SmoothStepToF(&sCameraEye.y, sCameraNextEye.y, 0.3f, sCameraEyeMaxVel.y, 0.075f); - Math_SmoothStepToF(&sCameraEye.z, sCameraNextEye.z, 0.3f, sCameraEyeMaxVel.z, 0.075f); - Math_SmoothStepToF(&sCameraAt.x, sCameraNextAt.x, 0.3f, sCameraAtMaxVel.x, 0.075f); - Math_SmoothStepToF(&sCameraAt.y, sCameraNextAt.y, 0.3f, sCameraAtMaxVel.y, 0.075f); - Math_SmoothStepToF(&sCameraAt.z, sCameraNextAt.z, 0.3f, sCameraAtMaxVel.z, 0.075f); - Gameplay_CameraSetAtEye(globalCtx, sCsCamera, &sCameraAt, &sCameraEye); + if ((sSubCamId != SUB_CAM_ID_DONE) && (sCsState <= INTRO_TITLE)) { + Math_SmoothStepToF(&sSubCamEye.x, sSubCamEyeNext.x, 0.3f, sSubCamEyeMaxVelFrac.x, 0.075f); + Math_SmoothStepToF(&sSubCamEye.y, sSubCamEyeNext.y, 0.3f, sSubCamEyeMaxVelFrac.y, 0.075f); + Math_SmoothStepToF(&sSubCamEye.z, sSubCamEyeNext.z, 0.3f, sSubCamEyeMaxVelFrac.z, 0.075f); + Math_SmoothStepToF(&sSubCamAt.x, sSubCamAtNext.x, 0.3f, sSubCamAtMaxVelFrac.x, 0.075f); + Math_SmoothStepToF(&sSubCamAt.y, sSubCamAtNext.y, 0.3f, sSubCamAtMaxVelFrac.y, 0.075f); + Math_SmoothStepToF(&sSubCamAt.z, sSubCamAtNext.z, 0.3f, sSubCamAtMaxVelFrac.z, 0.075f); + Gameplay_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); } } @@ -1526,7 +1526,7 @@ void BossVa_SetupBodyDeath(BossVa* this, GlobalContext* globalCtx) { void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { s32 i; - Camera* camera = Gameplay_GetCamera(globalCtx, 0); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); s32 sp7C; Player* player = GET_PLAYER(globalCtx); s16 tmp16; @@ -1535,24 +1535,24 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { case DEATH_START: func_8002DF54(globalCtx, &this->actor, 1); func_80064520(globalCtx, &globalCtx->csCtx); - sCsCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCsCamera, CAM_STAT_ACTIVE); + sSubCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); - sCameraNextAt.x = this->actor.world.pos.x; - sCameraNextAt.y = this->actor.world.pos.y; - sCameraNextAt.z = this->actor.world.pos.z; + sSubCamAtNext.x = this->actor.world.pos.x; + sSubCamAtNext.y = this->actor.world.pos.y; + sSubCamAtNext.z = this->actor.world.pos.z; - sCameraAt = camera->at; + sSubCamAt = mainCam->at; - sCameraNextEye = sCameraEye = camera->eye; + sSubCamEyeNext = sSubCamEye = mainCam->eye; - sCameraNextEye.y = 40.0f; - sCameraNextAt.y = 140.0f; + sSubCamEyeNext.y = 40.0f; + sSubCamAtNext.y = 140.0f; - sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec; - this->unk_1AC = Math_Vec3f_Yaw(&sCameraEye, &sCameraNextAt) - 0x100; + this->unk_1AC = Math_Vec3f_Yaw(&sSubCamEye, &sSubCamAtNext) - 0x100; this->unk_1B0 = 15; globalCtx->envCtx.screenFillColor[0] = globalCtx->envCtx.screenFillColor[1] = globalCtx->envCtx.screenFillColor[2] = 0xFF; @@ -1561,13 +1561,13 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { sCsState++; case DEATH_BODY_TUMORS: this->unk_1AC += 0x100; - sCameraNextEye.x = (Math_SinS(this->unk_1AC) * (160.0f + this->unk_1A8)) + sCameraNextAt.x; - sCameraNextEye.z = (Math_CosS(this->unk_1AC) * (160.0f + this->unk_1A8)) + sCameraNextAt.z; - Math_SmoothStepToF(&sCameraEyeMaxVel.x, 16.0f, 0.4f, 1.5f, 0.5f); - sCameraEyeMaxVel.z = sCameraEyeMaxVel.x; - sCameraEyeMaxVel.y = sCameraEyeMaxVel.x * 0.5f; - sCameraAtMaxVel = sCameraEyeMaxVel; - tmp16 = Rand_CenteredFloat(0.5f) + ((sCameraEyeMaxVel.x * 0.5f) + 0.6f); + sSubCamEyeNext.x = (Math_SinS(this->unk_1AC) * (160.0f + this->unk_1A8)) + sSubCamAtNext.x; + sSubCamEyeNext.z = (Math_CosS(this->unk_1AC) * (160.0f + this->unk_1A8)) + sSubCamAtNext.z; + Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 16.0f, 0.4f, 1.5f, 0.5f); + sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x; + sSubCamEyeMaxVelFrac.y = sSubCamEyeMaxVelFrac.x * 0.5f; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac; + tmp16 = Rand_CenteredFloat(0.5f) + ((sSubCamEyeMaxVelFrac.x * 0.5f) + 0.6f); if (((globalCtx->gameplayFrames % 4) == 0) && (this->unk_1B0 != 0)) { for (i = 6; i > 1; i--) { BossVa_Tumor(globalCtx, this, 1, tmp16, 0.0f, 0.0f, TUMOR_BODY, i, true); @@ -1580,7 +1580,7 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { if (this->unk_1B0 == 0) { sCsState++; - sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec; } break; case DEATH_CORE_DEAD: @@ -1606,36 +1606,36 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { this->timer--; if (this->timer == 0) { - sCameraNextAt.x = this->actor.world.pos.x; - sCameraNextAt.y = this->actor.world.pos.y + 30.0f; - sCameraNextAt.z = this->actor.world.pos.z; + sSubCamAtNext.x = this->actor.world.pos.x; + sSubCamAtNext.y = this->actor.world.pos.y + 30.0f; + sSubCamAtNext.z = this->actor.world.pos.z; - sCameraNextEye.x = (Math_SinS(player->actor.shape.rot.y) * -130.0f) + player->actor.world.pos.x; - sCameraNextEye.z = (Math_CosS(player->actor.shape.rot.y) * -130.0f) + player->actor.world.pos.z; - sCameraNextEye.y = player->actor.world.pos.y + 55.0f; + sSubCamEyeNext.x = (Math_SinS(player->actor.shape.rot.y) * -130.0f) + player->actor.world.pos.x; + sSubCamEyeNext.z = (Math_CosS(player->actor.shape.rot.y) * -130.0f) + player->actor.world.pos.z; + sSubCamEyeNext.y = player->actor.world.pos.y + 55.0f; - sCameraAtMaxVel = sCameraEyeMaxVel = sZeroVec; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac = sZeroVec; sCsState++; this->timer = 133; } break; case DEATH_MUSIC: - Math_SmoothStepToF(&sCameraEyeMaxVel.x, 1.5f, 0.3f, 0.05f, 0.015f); - sCameraEyeMaxVel.z = sCameraEyeMaxVel.x; - sCameraEyeMaxVel.y = sCameraEyeMaxVel.z; - sCameraAtMaxVel = sCameraEyeMaxVel; + Math_SmoothStepToF(&sSubCamEyeMaxVelFrac.x, 1.5f, 0.3f, 0.05f, 0.015f); + sSubCamEyeMaxVelFrac.z = sSubCamEyeMaxVelFrac.x; + sSubCamEyeMaxVelFrac.y = sSubCamEyeMaxVelFrac.z; + sSubCamAtMaxVelFrac = sSubCamEyeMaxVelFrac; this->timer--; if (this->timer == 0) { - Gameplay_ClearCamera(globalCtx, sCsCamera); - sCsCamera = 0; + Gameplay_ClearCamera(globalCtx, sSubCamId); + sSubCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); - camera->eyeNext = camera->eye = sCameraEye; + mainCam->eyeNext = mainCam->eye = sSubCamEye; - camera->at = sCameraAt; + mainCam->at = sSubCamAt; func_8002DF54(globalCtx, &this->actor, 7); sCsState++; @@ -1659,14 +1659,14 @@ void BossVa_BodyDeath(BossVa* this, GlobalContext* globalCtx) { break; } - if (sCsCamera != 0) { - Math_SmoothStepToF(&sCameraEye.x, sCameraNextEye.x, 0.3f, sCameraEyeMaxVel.x, 0.15f); - Math_SmoothStepToF(&sCameraEye.y, sCameraNextEye.y, 0.3f, sCameraEyeMaxVel.y, 0.15f); - Math_SmoothStepToF(&sCameraEye.z, sCameraNextEye.z, 0.3f, sCameraEyeMaxVel.z, 0.15f); - Math_SmoothStepToF(&sCameraAt.x, sCameraNextAt.x, 0.3f, sCameraAtMaxVel.x, 0.15f); - Math_SmoothStepToF(&sCameraAt.y, sCameraNextAt.y, 0.3f, sCameraAtMaxVel.y, 0.15f); - Math_SmoothStepToF(&sCameraAt.z, sCameraNextAt.z, 0.3f, sCameraAtMaxVel.z, 0.15f); - Gameplay_CameraSetAtEye(globalCtx, sCsCamera, &sCameraAt, &sCameraEye); + if (sSubCamId != SUB_CAM_ID_DONE) { + Math_SmoothStepToF(&sSubCamEye.x, sSubCamEyeNext.x, 0.3f, sSubCamEyeMaxVelFrac.x, 0.15f); + Math_SmoothStepToF(&sSubCamEye.y, sSubCamEyeNext.y, 0.3f, sSubCamEyeMaxVelFrac.y, 0.15f); + Math_SmoothStepToF(&sSubCamEye.z, sSubCamEyeNext.z, 0.3f, sSubCamEyeMaxVelFrac.z, 0.15f); + Math_SmoothStepToF(&sSubCamAt.x, sSubCamAtNext.x, 0.3f, sSubCamAtMaxVelFrac.x, 0.15f); + Math_SmoothStepToF(&sSubCamAt.y, sSubCamAtNext.y, 0.3f, sSubCamAtMaxVelFrac.y, 0.15f); + Math_SmoothStepToF(&sSubCamAt.z, sSubCamAtNext.z, 0.3f, sSubCamAtMaxVelFrac.z, 0.15f); + Gameplay_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); } SkelAnime_Update(&this->skelAnime); @@ -1818,11 +1818,11 @@ void BossVa_SupportCut(BossVa* this, GlobalContext* globalCtx) { switch (sCsState) { case DEATH_SHELL_BURST: - sCameraEye = sCameraNextEye; - sCameraAt = sCameraNextAt; - Math_SmoothStepToF(&sCameraEye.x, sCameraNextAt.x, 1.0f, 10.0f, 0.0f); - Math_SmoothStepToF(&sCameraEye.z, sCameraNextAt.z, 1.0f, 10.0f, 0.0f); - sCameraEye.y += 20.0f; + sSubCamEye = sSubCamEyeNext; + sSubCamAt = sSubCamAtNext; + Math_SmoothStepToF(&sSubCamEye.x, sSubCamAtNext.x, 1.0f, 10.0f, 0.0f); + Math_SmoothStepToF(&sSubCamEye.z, sSubCamAtNext.z, 1.0f, 10.0f, 0.0f); + sSubCamEye.y += 20.0f; sCsState++; case DEATH_CORE_TUMORS: @@ -2209,11 +2209,11 @@ void BossVa_ZapperDeath(BossVa* this, GlobalContext* globalCtx) { } if ((this->actor.params - BOSSVA_ZAPPER_1 + DEATH_ZAPPER_1) == sCsState) { - sCameraAt.x = this->zapNeckPos.x; - sCameraEye.y = sCameraAt.y = this->zapNeckPos.y; - sCameraAt.z = this->zapNeckPos.z; - sCameraEye.x = (Math_CosS(-(this->actor.shape.rot.y + this->unk_1B0)) * sp3C) + this->zapNeckPos.x; - sCameraEye.z = (Math_SinS(-(this->actor.shape.rot.y + this->unk_1B0)) * sp3C) + this->zapNeckPos.z; + sSubCamAt.x = this->zapNeckPos.x; + sSubCamEye.y = sSubCamAt.y = this->zapNeckPos.y; + sSubCamAt.z = this->zapNeckPos.z; + sSubCamEye.x = (Math_CosS(-(this->actor.shape.rot.y + this->unk_1B0)) * sp3C) + this->zapNeckPos.x; + sSubCamEye.z = (Math_SinS(-(this->actor.shape.rot.y + this->unk_1B0)) * sp3C) + this->zapNeckPos.z; this->unk_1B0 += 0x15E; } } else { @@ -3511,7 +3511,7 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { GraphicsContext* gfxCtx = globalCtx->state.gfxCtx; u8 materialFlag = 0; BossVaEffect* effectHead = effect; - Camera* camera = Gameplay_GetCamera(globalCtx, sCsCamera); + Camera* subCam = Gameplay_GetCamera(globalCtx, sSubCamId); OPEN_DISPS(gfxCtx, "../z_boss_va.c", 4953); @@ -3603,8 +3603,8 @@ void BossVa_DrawEffects(BossVaEffect* effect, GlobalContext* globalCtx) { materialFlag++; } - if ((effect->mode != TUMOR_BODY) || ((Math_Vec3f_DistXZ(&camera->eye, &effect->pos) - - Math_Vec3f_DistXZ(&camera->eye, &parent->actor.world.pos)) < 10.0f)) { + if ((effect->mode != TUMOR_BODY) || ((Math_Vec3f_DistXZ(&subCam->eye, &effect->pos) - + Math_Vec3f_DistXZ(&subCam->eye, &parent->actor.world.pos)) < 10.0f)) { Matrix_Translate(effect->pos.x, effect->pos.y, effect->pos.z, MTXMODE_NEW); Matrix_Scale(effect->scale, effect->scale, effect->scale, MTXMODE_APPLY); 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 0c8ac79dbb..0c9078beba 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -31,7 +31,7 @@ void DoorShutter_Destroy(Actor* thisx, GlobalContext* globalCtx); void DoorShutter_Update(Actor* thisx, GlobalContext* globalCtx); void DoorShutter_Draw(Actor* thisx, GlobalContext* globalCtx); -void func_8099803C(GlobalContext* globalCtx, s16 y, s16 countdown, s16 arg3); +void func_8099803C(GlobalContext* globalCtx, s16 y, s16 countdown, s16 camId); void DoorShutter_SetupType(DoorShutter* this, GlobalContext* globalCtx); void func_80996A54(DoorShutter* this, GlobalContext* globalCtx); void func_80996B00(DoorShutter* this, GlobalContext* globalCtx); @@ -416,7 +416,8 @@ void func_80996C60(DoorShutter* this, GlobalContext* globalCtx) { DoorShutter_SetupAction(this, func_80997004); this->unk_16C = sp38; this->unk_170 = 0.0f; - Camera_ChangeDoorCam(globalCtx->cameraPtrs[MAIN_CAM], &this->dyna.actor, player->unk_46A, 0.0f, 12, sp34, 10); + Camera_ChangeDoorCam(globalCtx->cameraPtrs[CAM_ID_MAIN], &this->dyna.actor, player->unk_46A, 0.0f, 12, sp34, + 10); } } @@ -571,7 +572,7 @@ void func_809973E8(DoorShutter* this, GlobalContext* globalCtx) { 10, false); } Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - quakeId = Quake_Add(Gameplay_GetCamera(globalCtx, 0), 3); + quakeId = Quake_Add(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), 3); Quake_SetSpeed(quakeId, -32536); Quake_SetQuakeValues(quakeId, 2, 0, 0, 0); Quake_SetCountdown(quakeId, 10); @@ -603,7 +604,7 @@ void func_809975C0(DoorShutter* this, GlobalContext* globalCtx) { this->unk_164 = 10; Audio_PlayActorSound2(&this->dyna.actor, NA_SE_EV_STONE_BOUND); - func_8099803C(globalCtx, 2, 10, parent->subCameraId); + func_8099803C(globalCtx, 2, 10, parent->subCamId); Actor_SpawnFloorDustRing(globalCtx, &this->dyna.actor, &this->dyna.actor.world.pos, 70.0f, 20, 8.0f, 500, 10, true); } diff --git a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c index f0e3a5d399..e848e7eca8 100644 --- a/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c +++ b/src/overlays/actors/ovl_Door_Warp1/z_door_warp1.c @@ -465,7 +465,7 @@ void DoorWarp1_ChildWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { Audio_PlaySoundGeneral(NA_SE_EV_LINK_WARP, &player->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - OnePointCutscene_Init(globalCtx, 0x25E7, 999, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 0x25E7, 999, &this->actor, CAM_ID_MAIN); func_8002DF54(globalCtx, &this->actor, 10); player->unk_450.x = this->actor.world.pos.x; @@ -556,7 +556,7 @@ void func_80999EE0(DoorWarp1* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (this->rutoWarpState == WARP_BLUE_RUTO_STATE_3) { - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); sRutoWarpSubCamId = Gameplay_CreateSubCamera(globalCtx); Gameplay_ChangeCameraStatus(globalCtx, sRutoWarpSubCamId, CAM_STAT_ACTIVE); @@ -579,8 +579,9 @@ void func_80999FE4(DoorWarp1* this, GlobalContext* globalCtx) { if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { Audio_PlaySoundGeneral(NA_SE_EV_LINK_WARP, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); - OnePointCutscene_Init(globalCtx, 0x25E9, 999, &this->actor, MAIN_CAM); - Gameplay_CopyCamera(globalCtx, -1, sRutoWarpSubCamId); + OnePointCutscene_Init(globalCtx, 0x25E9, 999, &this->actor, CAM_ID_MAIN); + // Using `CAM_ID_NONE` here defaults to the active camera + Gameplay_CopyCamera(globalCtx, CAM_ID_NONE, sRutoWarpSubCamId); Gameplay_ChangeCameraStatus(globalCtx, sRutoWarpSubCamId, CAM_STAT_WAIT); this->rutoWarpState = WARP_BLUE_RUTO_STATE_WARPING; DoorWarp1_SetupAction(this, DoorWarp1_RutoWarpOut); @@ -648,7 +649,7 @@ void DoorWarp1_AdultWarpIdle(DoorWarp1* this, GlobalContext* globalCtx) { if (DoorWarp1_PlayerInRange(this, globalCtx)) { player = GET_PLAYER(globalCtx); - OnePointCutscene_Init(globalCtx, 0x25E8, 999, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 0x25E8, 999, &this->actor, CAM_ID_MAIN); func_8002DF54(globalCtx, &this->actor, 10); player->unk_450.x = this->actor.world.pos.x; player->unk_450.z = this->actor.world.pos.z; diff --git a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c index 4284b1f413..433cc08e64 100644 --- a/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c +++ b/src/overlays/actors/ovl_En_Bigokuta/z_en_bigokuta.c @@ -640,8 +640,8 @@ void func_809BE26C(EnBigokuta* this, GlobalContext* globalCtx) { } if (this->unk_198 == 0 && Math_StepToF(&this->actor.scale.y, 0.0f, 0.001f)) { Flags_SetClear(globalCtx, this->actor.room); - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_DUNGEON0); - func_8005ACFC(globalCtx->cameraPtrs[MAIN_CAM], 4); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_DUNGEON0); + func_8005ACFC(globalCtx->cameraPtrs[CAM_ID_MAIN], 4); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 50, NA_SE_EN_OCTAROCK_BUBLE); Item_DropCollectibleRandom(globalCtx, &this->actor, &this->actor.world.pos, 0xB0); Actor_Kill(&this->actor); @@ -777,8 +777,8 @@ void EnBigokuta_Update(Actor* thisx, GlobalContext* globalCtx2) { this->actionFunc(this, globalCtx); func_809BD2E4(this); func_809BE568(this); - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BIG_OCTO); - func_8005AD1C(globalCtx->cameraPtrs[MAIN_CAM], 4); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BIG_OCTO); + func_8005AD1C(globalCtx->cameraPtrs[CAM_ID_MAIN], 4); if (this->cylinder[0].base.atFlags & AT_ON) { if (this->actionFunc != func_809BE058) { diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c index d97b552df9..895e115419 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c @@ -307,7 +307,7 @@ void EnBomBowlMan_HandlePlayChoice(EnBomBowlMan* this, GlobalContext* globalCtx) this->actor.textId = 0x1B; Message_ContinueTextbox(globalCtx, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; - OnePointCutscene_Init(globalCtx, 8010, -99, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 8010, -99, NULL, CAM_ID_MAIN); func_8002DF54(globalCtx, NULL, 8); this->actionFunc = EnBomBowMan_SetupChooseShowPrize; } @@ -343,7 +343,7 @@ void func_809C41FC(EnBomBowlMan* this, GlobalContext* globalCtx) { this->actor.textId = 0x1B; Message_ContinueTextbox(globalCtx, this->actor.textId); this->dialogState = TEXT_STATE_EVENT; - OnePointCutscene_Init(globalCtx, 8010, -99, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 8010, -99, NULL, CAM_ID_MAIN); func_8002DF54(globalCtx, NULL, 8); this->actionFunc = EnBomBowMan_SetupChooseShowPrize; } else { diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c index ac2d1069ad..b44ad431e9 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.c @@ -52,7 +52,7 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { EnBomChu* chu; Vec3f chuPosDiff; - if (globalCtx->cameraPtrs[MAIN_CAM]->setting == CAM_SET_CHU_BOWLING) { + if (globalCtx->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING) { chu = (EnBomChu*)globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (chu != NULL) { @@ -70,38 +70,38 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { func_8002DF54(globalCtx, NULL, 8); chu->timer = 1; - this->camId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->camId, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); - this->unk_1C8.x = this->unk_1C8.y = this->unk_1C8.z = 0.1f; - this->unk_1A4.x = this->unk_1A4.y = this->unk_1A4.z = 0.1f; + this->subCamAtMaxVelFrac.x = this->subCamAtMaxVelFrac.y = this->subCamAtMaxVelFrac.z = 0.1f; + this->subCamEyeMaxVelFrac.x = this->subCamEyeMaxVelFrac.y = this->subCamEyeMaxVelFrac.z = 0.1f; - this->unk_180.x = this->unk_168.x = globalCtx->view.at.x; - this->unk_180.y = this->unk_168.y = globalCtx->view.at.y; - this->unk_180.z = this->unk_168.z = globalCtx->view.at.z; + this->subCamAt.x = this->viewAt.x = globalCtx->view.at.x; + this->subCamAt.y = this->viewAt.y = globalCtx->view.at.y; + this->subCamAt.z = this->viewAt.z = globalCtx->view.at.z; - this->unk_18C.x = this->unk_174.x = globalCtx->view.eye.x; - this->unk_18C.y = this->unk_174.y = globalCtx->view.eye.y; - this->unk_18C.z = this->unk_174.z = globalCtx->view.eye.z; + this->subCamEye.x = this->viewEye.x = globalCtx->view.eye.x; + this->subCamEye.y = this->viewEye.y = globalCtx->view.eye.y; + this->subCamEye.z = this->viewEye.z = globalCtx->view.eye.z; - this->unk_1BC.x = 20.0f; - this->unk_1BC.y = 100.0f; - this->unk_1BC.z = -800.0f; + this->subCamAtNext.x = 20.0f; + this->subCamAtNext.y = 100.0f; + this->subCamAtNext.z = -800.0f; - this->unk_198.x = 20.0f; - this->unk_198.y = 50.0f; - this->unk_198.z = -485.0f; + this->subCamEyeNext.x = 20.0f; + this->subCamEyeNext.y = 50.0f; + this->subCamEyeNext.z = -485.0f; - this->unk_1B0.x = fabsf(this->unk_18C.x - this->unk_198.x) * 0.02f; - this->unk_1B0.y = fabsf(this->unk_18C.y - this->unk_198.y) * 0.02f; - this->unk_1B0.z = fabsf(this->unk_18C.z - this->unk_198.z) * 0.02f; + this->subCamEyeVel.x = fabsf(this->subCamEye.x - this->subCamEyeNext.x) * 0.02f; + this->subCamEyeVel.y = fabsf(this->subCamEye.y - this->subCamEyeNext.y) * 0.02f; + this->subCamEyeVel.z = fabsf(this->subCamEye.z - this->subCamEyeNext.z) * 0.02f; - this->unk_1D4.x = fabsf(this->unk_180.x - this->unk_1BC.x) * 0.02f; - this->unk_1D4.y = fabsf(this->unk_180.y - this->unk_1BC.y) * 0.02f; - this->unk_1D4.z = fabsf(this->unk_180.z - this->unk_1BC.z) * 0.02f; + this->subCamAtVel.x = fabsf(this->subCamAt.x - this->subCamAtNext.x) * 0.02f; + this->subCamAtVel.y = fabsf(this->subCamAt.y - this->subCamAtNext.y) * 0.02f; + this->subCamAtVel.z = fabsf(this->subCamAt.z - this->subCamAtNext.z) * 0.02f; - Gameplay_CameraSetAtEye(globalCtx, this->camId, &this->unk_180, &this->unk_18C); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); this->actor.textId = 0xF; Message_StartTextbox(globalCtx, this->actor.textId, NULL); this->unk_154 = TEXT_STATE_EVENT; @@ -118,24 +118,27 @@ void EnBomBowlPit_DetectHit(EnBomBowlPit* this, GlobalContext* globalCtx) { } void EnBomBowlPit_CameraDollyIn(EnBomBowlPit* this, GlobalContext* globalCtx) { - if (this->camId != SUBCAM_FREE) { - Math_ApproachF(&this->unk_180.x, this->unk_1BC.x, this->unk_1C8.x, this->unk_1D4.x); - Math_ApproachF(&this->unk_180.y, this->unk_1BC.y, this->unk_1C8.y, this->unk_1D4.y); - Math_ApproachF(&this->unk_180.z, this->unk_1BC.z, this->unk_1C8.z, this->unk_1D4.z); - Math_ApproachF(&this->unk_18C.x, this->unk_198.x, this->unk_1A4.x, this->unk_1B0.x); - Math_ApproachF(&this->unk_18C.y, this->unk_198.y, this->unk_1A4.y, this->unk_1B0.y); - Math_ApproachF(&this->unk_18C.z, this->unk_198.z, this->unk_1A4.z, this->unk_1B0.z); + if (this->subCamId != SUB_CAM_ID_DONE) { + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, this->subCamAtMaxVelFrac.x, this->subCamAtVel.x); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, this->subCamAtMaxVelFrac.y, this->subCamAtVel.y); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, this->subCamAtMaxVelFrac.z, this->subCamAtVel.z); + Math_ApproachF(&this->subCamEye.x, this->subCamEyeNext.x, this->subCamEyeMaxVelFrac.x, this->subCamEyeVel.x); + Math_ApproachF(&this->subCamEye.y, this->subCamEyeNext.y, this->subCamEyeMaxVelFrac.y, this->subCamEyeVel.y); + Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, this->subCamEyeMaxVelFrac.z, this->subCamEyeVel.z); } - Gameplay_CameraSetAtEye(globalCtx, this->camId, &this->unk_180, &this->unk_18C); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); if ((this->unk_154 == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { Message_CloseTextbox(globalCtx); } - if ((fabsf(this->unk_18C.x - this->unk_198.x) < 5.0f) && (fabsf(this->unk_18C.y - this->unk_198.y) < 5.0f) && - (fabsf(this->unk_18C.z - this->unk_198.z) < 5.0f) && (fabsf(this->unk_180.x - this->unk_1BC.x) < 5.0f) && - (fabsf(this->unk_180.y - this->unk_1BC.y) < 5.0f) && (fabsf(this->unk_180.z - this->unk_1BC.z) < 5.0f)) { + if ((fabsf(this->subCamEye.x - this->subCamEyeNext.x) < 5.0f) && + (fabsf(this->subCamEye.y - this->subCamEyeNext.y) < 5.0f) && + (fabsf(this->subCamEye.z - this->subCamEyeNext.z) < 5.0f) && + (fabsf(this->subCamAt.x - this->subCamAtNext.x) < 5.0f) && + (fabsf(this->subCamAt.y - this->subCamAtNext.y) < 5.0f) && + (fabsf(this->subCamAt.z - this->subCamAtNext.z) < 5.0f)) { Message_CloseTextbox(globalCtx); this->timer = 30; this->actionFunc = EnBomBowlPit_SpawnPrize; @@ -164,8 +167,8 @@ void EnBomBowlPit_SetupGivePrize(EnBomBowlPit* this, GlobalContext* globalCtx) { break; } - Gameplay_ClearCamera(globalCtx, this->camId); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); + Gameplay_ClearCamera(globalCtx, this->subCamId); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); func_8002DF54(globalCtx, NULL, 8); this->actionFunc = EnBomBowlPit_GivePrize; } diff --git a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h index af5d8d3e1b..873c57a8aa 100644 --- a/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h +++ b/src/overlays/actors/ovl_En_Bom_Bowl_Pit/z_en_bom_bowl_pit.h @@ -13,7 +13,7 @@ typedef struct EnBomBowlPit { /* 0x0000 */ Actor actor; /* 0x014C */ EnBomBowlPitActionFunc actionFunc; /* 0x0150 */ u16 unk_150; - /* 0x0152 */ s16 camId; + /* 0x0152 */ s16 subCamId; /* 0x0154 */ s16 unk_154; /* 0x0156 */ s16 exItemDone; // Set by EnExItem? /* 0x0158 */ s16 timer; @@ -21,16 +21,16 @@ typedef struct EnBomBowlPit { /* 0x015C */ s16 start; /* 0x0160 */ s32 getItemId; /* 0x0164 */ u8 status; - /* 0x0168 */ Vec3f unk_168; // set and not used? - /* 0x0174 */ Vec3f unk_174; // set and not used? - /* 0x0180 */ Vec3f unk_180; // camera at (start) - /* 0x018C */ Vec3f unk_18C; // camera eye (start) - /* 0x0198 */ Vec3f unk_198; // camera eye (end) - /* 0x01A4 */ Vec3f unk_1A4; // camera eye (scales) - /* 0x01B0 */ Vec3f unk_1B0; // camera eye (maxsteps) - /* 0x01BC */ Vec3f unk_1BC; // camera at (end) - /* 0x01C8 */ Vec3f unk_1C8; // camera at (scales) - /* 0x01D4 */ Vec3f unk_1D4; // camera eye (maxsteps) + /* 0x0168 */ Vec3f viewAt; // set and not used + /* 0x0174 */ Vec3f viewEye; // set and not used + /* 0x0180 */ Vec3f subCamAt; + /* 0x018C */ Vec3f subCamEye; + /* 0x0198 */ Vec3f subCamEyeNext; + /* 0x01A4 */ Vec3f subCamEyeMaxVelFrac; + /* 0x01B0 */ Vec3f subCamEyeVel; + /* 0x01BC */ Vec3f subCamAtNext; + /* 0x01C8 */ Vec3f subCamAtMaxVelFrac; + /* 0x01D4 */ Vec3f subCamAtVel; /* 0x01E0 */ EnExItem* exItem; /* 0x01E4 */ char unk_1E4[0x3520]; } EnBomBowlPit; // size = 0x3704 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 2d8d581969..c80231c630 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.c +++ b/src/overlays/actors/ovl_En_Box/z_en_box.c @@ -248,7 +248,7 @@ void EnBox_Fall(EnBox* this, GlobalContext* globalCtx) { this->dyna.actor.shape.rot.z = 0; this->dyna.actor.world.pos.y = this->dyna.actor.floorHeight; EnBox_SetupAction(this, EnBox_WaitOpen); - OnePointCutscene_EndCutscene(globalCtx, this->unk_1AC); + OnePointCutscene_EndCutscene(globalCtx, this->subCamId); } Audio_PlaySoundGeneral(NA_SE_EV_COFFIN_CAP_BOUND, &this->dyna.actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); @@ -271,7 +271,7 @@ void EnBox_FallOnSwitchFlag(EnBox* this, GlobalContext* globalCtx) { if (this->unk_1A8 >= 0) { EnBox_SetupAction(this, EnBox_Fall); - this->unk_1AC = OnePointCutscene_Init(globalCtx, 4500, 9999, &this->dyna.actor, MAIN_CAM); + this->subCamId = OnePointCutscene_Init(globalCtx, 4500, 9999, &this->dyna.actor, CAM_ID_MAIN); func_8003EC50(globalCtx, &globalCtx->colCtx.dyna, this->dyna.bgId); } else if (this->unk_1A8 >= -11) { this->unk_1A8++; diff --git a/src/overlays/actors/ovl_En_Box/z_en_box.h b/src/overlays/actors/ovl_En_Box/z_en_box.h index f6e698ed53..a5ab0dfa72 100644 --- a/src/overlays/actors/ovl_En_Box/z_en_box.h +++ b/src/overlays/actors/ovl_En_Box/z_en_box.h @@ -33,7 +33,7 @@ typedef struct EnBox { /* 0x0000 */ DynaPolyActor dyna; /* 0x0164 */ SkelAnime skelanime; /* 0x01A8 */ s32 unk_1A8; // related to animation delays for types 3 and 8 - /* 0x01AC */ s32 unk_1AC; + /* 0x01AC */ s32 subCamId; /* 0x01B0 */ f32 unk_1B0; // 0-1, rotation-related, apparently unused (in z_en_box.c at least) /* 0x01B4 */ EnBoxActionFunc actionFunc; /* 0x01B8 */ Vec3s jointTable[5]; diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c index 9720b8cc7d..a252f6985c 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.c @@ -576,51 +576,51 @@ void EnClearTag_Update(Actor* thisx, GlobalContext* globalCtx2) { if (this->state < CLEAR_TAG_STATE_LASER) { // Play the Arwing cutscene. osSyncPrintf("DEMO_MODE %d\n", this->cutsceneMode); - osSyncPrintf("CAMERA_NO %d\n", this->cameraId); + osSyncPrintf("CAMERA_NO %d\n", this->subCamId); if (this->cutsceneMode != CLEAR_TAG_CUTSCENE_MODE_NONE) { - f32 cutsceneCameraCircleX; - f32 cutsceneCameraCircleZ; + f32 subCamCircleX; + f32 subCamCircleZ; s16 cutsceneTimer; - Vec3f cutsceneCameraAtTarget; - Vec3f cutsceneCameraEyeTarget; + Vec3f subCamEyeNext; + Vec3f subCamAtNext; switch (this->cutsceneMode) { case CLEAR_TAG_CUTSCENE_MODE_SETUP: // Initializes Arwing cutscene camera data. this->cutsceneMode = CLEAR_TAG_CUTSCENE_MODE_PLAY; func_80064520(globalCtx, &globalCtx->csCtx); - this->cameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->cameraId, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); case CLEAR_TAG_CUTSCENE_MODE_PLAY: // Update the Arwing cutscene camera to spin around in a circle. cutsceneTimer = this->frameCounter * 128; - cutsceneCameraCircleX = Math_SinS(cutsceneTimer) * 200.0f; - cutsceneCameraCircleZ = Math_CosS(cutsceneTimer) * 200.0f; - cutsceneCameraAtTarget.x = this->actor.world.pos.x + cutsceneCameraCircleX; - cutsceneCameraAtTarget.y = 200.0f; - cutsceneCameraAtTarget.z = this->actor.world.pos.z + cutsceneCameraCircleZ; - cutsceneCameraEyeTarget = this->actor.world.pos; + subCamCircleX = Math_SinS(cutsceneTimer) * 200.0f; + subCamCircleZ = Math_CosS(cutsceneTimer) * 200.0f; + subCamEyeNext.x = this->actor.world.pos.x + subCamCircleX; + subCamEyeNext.y = 200.0f; + subCamEyeNext.z = this->actor.world.pos.z + subCamCircleZ; + subCamAtNext = this->actor.world.pos; break; } // Make the Arwing cutscene camera approach the target. - if (this->cameraId != SUBCAM_FREE) { - Math_ApproachF(&this->cutsceneCameraAt.x, cutsceneCameraAtTarget.x, 0.1f, 500.0f); - Math_ApproachF(&this->cutsceneCameraAt.y, cutsceneCameraAtTarget.y, 0.1f, 500.0f); - Math_ApproachF(&this->cutsceneCameraAt.z, cutsceneCameraAtTarget.z, 0.1f, 500.0f); - Math_ApproachF(&this->cutsceneCameraEye.x, cutsceneCameraEyeTarget.x, 0.2f, 500.0f); - Math_ApproachF(&this->cutsceneCameraEye.y, cutsceneCameraEyeTarget.y, 0.2f, 500.0f); - Math_ApproachF(&this->cutsceneCameraEye.z, cutsceneCameraEyeTarget.z, 0.2f, 500.0f); - Gameplay_CameraSetAtEye(globalCtx, this->cameraId, &this->cutsceneCameraEye, - &this->cutsceneCameraAt); + if (this->subCamId != SUB_CAM_ID_DONE) { + Math_ApproachF(&this->subCamEye.x, subCamEyeNext.x, 0.1f, 500.0f); + Math_ApproachF(&this->subCamEye.y, subCamEyeNext.y, 0.1f, 500.0f); + Math_ApproachF(&this->subCamEye.z, subCamEyeNext.z, 0.1f, 500.0f); + Math_ApproachF(&this->subCamAt.x, subCamAtNext.x, 0.2f, 500.0f); + Math_ApproachF(&this->subCamAt.y, subCamAtNext.y, 0.2f, 500.0f); + Math_ApproachF(&this->subCamAt.z, subCamAtNext.z, 0.2f, 500.0f); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } // Cutscene has finished. if (this->cutsceneTimer == 1) { - func_800C08AC(globalCtx, this->cameraId, 0); - this->cutsceneMode = this->cameraId = SUBCAM_FREE; + func_800C08AC(globalCtx, this->subCamId, 0); + // CLEAR_TAG_CUTSCENE_MODE_NONE / SUB_CAM_ID_DONE + this->cutsceneMode = this->subCamId = 0; func_80064534(globalCtx, &globalCtx->csCtx); } } diff --git a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h index 96299ae2cf..b817cdc008 100644 --- a/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h +++ b/src/overlays/actors/ovl_En_Clear_Tag/z_en_clear_tag.h @@ -65,9 +65,9 @@ typedef struct EnClearTag { /* 0x0188 */ Vec3f floorTangent; /* 0x0194 */ ColliderCylinder collider; /* 0x01E0 */ u8 cutsceneMode; - /* 0x01E2 */ s16 cameraId; - /* 0x01E4 */ Vec3f cutsceneCameraAt; - /* 0x01F0 */ Vec3f cutsceneCameraEye; + /* 0x01E2 */ s16 subCamId; + /* 0x01E4 */ Vec3f subCamEye; + /* 0x01F0 */ Vec3f subCamAt; /* 0x01FC */ s16 cutsceneTimer; /* 0x01FE */ char unk_1FE[0x06]; } EnClearTag; // size = 0x0204 diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c index 27584e0be5..d51e7fa3f0 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.c @@ -458,13 +458,13 @@ void EnDaiku_InitSubCamera(EnDaiku* this, GlobalContext* globalCtx) { this->subCamEyeInit.z = this->subCamEye.z = this->actor.world.pos.z + eyePosDeltaWorld.z; if (1) {} - this->subCamAtTarget.x = this->subCamAt.x = this->actor.world.pos.x; - this->subCamAtTarget.y = this->subCamAt.y = this->actor.world.pos.y + 60.0f; + this->subCamAtNext.x = this->subCamAt.x = this->actor.world.pos.x; + this->subCamAtNext.y = this->subCamAt.y = this->actor.world.pos.y + 60.0f; if (1) {} - this->subCamAtTarget.z = this->subCamAt.z = this->actor.world.pos.z; + this->subCamAtNext.z = this->subCamAt.z = this->actor.world.pos.z; this->subCamId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); @@ -475,13 +475,13 @@ void EnDaiku_InitSubCamera(EnDaiku* this, GlobalContext* globalCtx) { void EnDaiku_UpdateSubCamera(EnDaiku* this, GlobalContext* globalCtx) { s32 pad; - this->subCamAtTarget.x = this->actor.world.pos.x; - this->subCamAtTarget.y = this->actor.world.pos.y + 60.0f; - this->subCamAtTarget.z = this->actor.world.pos.z; + this->subCamAtNext.x = this->actor.world.pos.x; + this->subCamAtNext.y = this->actor.world.pos.y + 60.0f; + this->subCamAtNext.z = this->actor.world.pos.z; - Math_SmoothStepToF(&this->subCamAt.x, this->subCamAtTarget.x, 1.0f, 1000.0f, 0.0f); - Math_SmoothStepToF(&this->subCamAt.y, this->subCamAtTarget.y, 1.0f, 1000.0f, 0.0f); - Math_SmoothStepToF(&this->subCamAt.z, this->subCamAtTarget.z, 1.0f, 1000.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.x, this->subCamAtNext.x, 1.0f, 1000.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.y, this->subCamAtNext.y, 1.0f, 1000.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAt.z, this->subCamAtNext.z, 1.0f, 1000.0f, 0.0f); Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } @@ -492,7 +492,7 @@ void EnDaiku_EscapeSuccess(EnDaiku* this, GlobalContext* globalCtx) { Vec3f vec; Gameplay_ClearCamera(globalCtx, this->subCamId); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); this->subCamActive = false; if (CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX], diff --git a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h index f76c9756cd..f4282c2102 100644 --- a/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h +++ b/src/overlays/actors/ovl_En_Daiku/z_en_daiku.h @@ -25,7 +25,7 @@ typedef struct EnDaiku { /* 0x0204 */ s32 subCamId; /* 0x0208 */ s16 rotYtowardsPath; /* 0x020C */ Vec3f subCamEyeInit; - /* 0x0218 */ Vec3f subCamAtTarget; + /* 0x0218 */ Vec3f subCamAtNext; /* 0x0224 */ Vec3f subCamEye; /* 0x0230 */ Vec3f subCamAt; /* 0x023C */ s32 stateFlags; diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c index 21d2694549..3181890ca5 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.c @@ -298,38 +298,39 @@ void func_809EE194(EnDivingGame* this, GlobalContext* globalCtx) { void EnDivingGame_SetupRupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); this->subCamId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->spawnRuppyTimer = 10; - this->unk_2F4.x = -210.0f; - this->unk_2F4.y = -80.0f; - this->unk_2F4.z = -1020.0f; - this->unk_2D0.x = -280.0f; - this->unk_2D0.y = -20.0f; - this->unk_2D0.z = -240.0f; + this->subCamAtNext.x = -210.0f; + this->subCamAtNext.y = -80.0f; + this->subCamAtNext.z = -1020.0f; + this->subCamEyeNext.x = -280.0f; + this->subCamEyeNext.y = -20.0f; + this->subCamEyeNext.z = -240.0f; if (!GET_EVENTCHKINF(EVENTCHKINF_38)) { this->rupeesLeftToThrow = 5; } else { this->rupeesLeftToThrow = 10; } - this->unk_2DC.x = this->unk_2DC.y = this->unk_2DC.z = this->unk_300.x = this->unk_300.y = this->unk_300.z = 0.1f; - this->camLookAt.x = globalCtx->view.at.x; - this->camLookAt.y = globalCtx->view.at.y; - this->camLookAt.z = globalCtx->view.at.z; - this->camEye.x = globalCtx->view.eye.x; - this->camEye.y = globalCtx->view.eye.y + 80.0f; - this->camEye.z = globalCtx->view.eye.z + 250.0f; - this->unk_2E8.x = fabsf(this->camEye.x - this->unk_2D0.x) * 0.04f; - this->unk_2E8.y = fabsf(this->camEye.y - this->unk_2D0.y) * 0.04f; - this->unk_2E8.z = fabsf(this->camEye.z - this->unk_2D0.z) * 0.04f; - this->unk_30C.x = fabsf(this->camLookAt.x - this->unk_2F4.x) * 0.04f; - this->unk_30C.y = fabsf(this->camLookAt.y - this->unk_2F4.y) * 0.04f; - this->unk_30C.z = fabsf(this->camLookAt.z - this->unk_2F4.z) * 0.04f; - Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->camLookAt, &this->camEye); + this->subCamEyeMaxVelFrac.x = this->subCamEyeMaxVelFrac.y = this->subCamEyeMaxVelFrac.z = + this->subCamAtMaxVelFrac.x = this->subCamAtMaxVelFrac.y = this->subCamAtMaxVelFrac.z = 0.1f; + this->subCamAt.x = globalCtx->view.at.x; + this->subCamAt.y = globalCtx->view.at.y; + this->subCamAt.z = globalCtx->view.at.z; + this->subCamEye.x = globalCtx->view.eye.x; + this->subCamEye.y = globalCtx->view.eye.y + 80.0f; + this->subCamEye.z = globalCtx->view.eye.z + 250.0f; + this->subCamEyeVel.x = fabsf(this->subCamEye.x - this->subCamEyeNext.x) * 0.04f; + this->subCamEyeVel.y = fabsf(this->subCamEye.y - this->subCamEyeNext.y) * 0.04f; + this->subCamEyeVel.z = fabsf(this->subCamEye.z - this->subCamEyeNext.z) * 0.04f; + this->subCamAtVel.x = fabsf(this->subCamAt.x - this->subCamAtNext.x) * 0.04f; + this->subCamAtVel.y = fabsf(this->subCamAt.y - this->subCamAtNext.y) * 0.04f; + this->subCamAtVel.z = fabsf(this->subCamAt.z - this->subCamAtNext.z) * 0.04f; + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); Gameplay_CameraSetFov(globalCtx, this->subCamId, globalCtx->mainCamera.fov); - this->csCameraTimer = 60; + this->subCamTimer = 60; this->actionFunc = EnDivingGame_RupeeThrow; - this->unk_318 = 0.0f; + this->subCamVelFactor = 0.0f; } // Throws rupee when this->spawnRuppyTimer == 0 @@ -338,15 +339,20 @@ void EnDivingGame_RupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) { if (func_800C0DB4(globalCtx, &this->actor.projectedPos)) { Audio_SetExtraFilter(0); } - if (this->subCamId != 0) { - Math_ApproachF(&this->camEye.x, this->unk_2D0.x, this->unk_2DC.x, this->unk_2E8.x * this->unk_318); - Math_ApproachF(&this->camEye.z, this->unk_2D0.z, this->unk_2DC.z, this->unk_2E8.z * this->unk_318); - Math_ApproachF(&this->camLookAt.x, this->unk_2F4.x, this->unk_300.x, this->unk_30C.x * this->unk_318); - Math_ApproachF(&this->camLookAt.y, this->unk_2F4.y, this->unk_300.y, this->unk_30C.y * this->unk_318); - Math_ApproachF(&this->camLookAt.z, this->unk_2F4.z, this->unk_300.z, this->unk_30C.z * this->unk_318); - Math_ApproachF(&this->unk_318, 1.0f, 1.0f, 0.02f); + if (this->subCamId != SUB_CAM_ID_DONE) { + Math_ApproachF(&this->subCamEye.x, this->subCamEyeNext.x, this->subCamEyeMaxVelFrac.x, + this->subCamEyeVel.x * this->subCamVelFactor); + Math_ApproachF(&this->subCamEye.z, this->subCamEyeNext.z, this->subCamEyeMaxVelFrac.z, + this->subCamEyeVel.z * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.x, this->subCamAtNext.x, this->subCamAtMaxVelFrac.x, + this->subCamAtVel.x * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.y, this->subCamAtNext.y, this->subCamAtMaxVelFrac.y, + this->subCamAtVel.y * this->subCamVelFactor); + Math_ApproachF(&this->subCamAt.z, this->subCamAtNext.z, this->subCamAtMaxVelFrac.z, + this->subCamAtVel.z * this->subCamVelFactor); + Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, 0.02f); } - Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->camLookAt, &this->camEye); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); if (!this->allRupeesThrown && this->spawnRuppyTimer == 0) { this->spawnRuppyTimer = 5; EnDivingGame_SpawnRuppy(this, globalCtx); @@ -361,12 +367,14 @@ void EnDivingGame_RupeeThrow(EnDivingGame* this, GlobalContext* globalCtx) { this->allRupeesThrown = true; } } - if (this->csCameraTimer == 0 || - ((fabsf(this->camEye.x - this->unk_2D0.x) < 2.0f) && (fabsf(this->camEye.y - this->unk_2D0.y) < 2.0f) && - (fabsf(this->camEye.z - this->unk_2D0.z) < 2.0f) && (fabsf(this->camLookAt.x - this->unk_2F4.x) < 2.0f) && - (fabsf(this->camLookAt.y - this->unk_2F4.y) < 2.0f) && (fabsf(this->camLookAt.z - this->unk_2F4.z) < 2.0f))) { + if (this->subCamTimer == 0 || ((fabsf(this->subCamEye.x - this->subCamEyeNext.x) < 2.0f) && + (fabsf(this->subCamEye.y - this->subCamEyeNext.y) < 2.0f) && + (fabsf(this->subCamEye.z - this->subCamEyeNext.z) < 2.0f) && + (fabsf(this->subCamAt.x - this->subCamAtNext.x) < 2.0f) && + (fabsf(this->subCamAt.y - this->subCamAtNext.y) < 2.0f) && + (fabsf(this->subCamAt.z - this->subCamAtNext.z) < 2.0f))) { if (this->unk_2A2 != 0) { - this->csCameraTimer = 70; + this->subCamTimer = 70; this->unk_2A2 = 2; this->actionFunc = func_809EE780; } else { @@ -380,23 +388,23 @@ void EnDivingGame_SetupUnderwaterViewCs(EnDivingGame* this, GlobalContext* globa SkelAnime_Update(&this->skelAnime); if (this->unk_296 == 0) { this->unk_2A2 = 1; - this->csCameraTimer = 100; + this->subCamTimer = 100; this->actionFunc = EnDivingGame_RupeeThrow; - this->camLookAt.x = this->unk_2F4.x = -210.0f; - this->camLookAt.y = this->unk_2F4.y = -80.0f; - this->camLookAt.z = this->unk_2F4.z = -1020.0f; - this->camEye.x = this->unk_2D0.x = -280.0f; - this->camEye.y = this->unk_2D0.y = -20.0f; - this->camEye.z = this->unk_2D0.z = -240.0f; + this->subCamAt.x = this->subCamAtNext.x = -210.0f; + this->subCamAt.y = this->subCamAtNext.y = -80.0f; + this->subCamAt.z = this->subCamAtNext.z = -1020.0f; + this->subCamEye.x = this->subCamEyeNext.x = -280.0f; + this->subCamEye.y = this->subCamEyeNext.y = -20.0f; + this->subCamEye.z = this->subCamEyeNext.z = -240.0f; } } // EnDivingGame_SayStartAndWait ? void func_809EE780(EnDivingGame* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); - if (this->csCameraTimer == 0) { + if (this->subCamTimer == 0) { Gameplay_ClearCamera(globalCtx, this->subCamId); - Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_ACTIVE); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); this->actor.textId = 0x405A; Message_ContinueTextbox(globalCtx, this->actor.textId); this->unk_292 = TEXT_STATE_EVENT; @@ -483,8 +491,8 @@ void EnDivingGame_Update(Actor* thisx, GlobalContext* globalCtx2) { Player* player = GET_PLAYER(globalCtx); Vec3f pos; - if (this->csCameraTimer != 0) { - this->csCameraTimer--; + if (this->subCamTimer != 0) { + this->subCamTimer--; } if (this->unk_296 != 0) { this->unk_296--; diff --git a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h index ee361adaac..9875f077dd 100644 --- a/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h +++ b/src/overlays/actors/ovl_En_Diving_Game/z_en_diving_game.h @@ -18,7 +18,7 @@ typedef struct EnDivingGame { /* 0x028A */ Vec3s vec_28A; /* 0x0290 */ s16 unk_290; // counter that only goes up /* 0x0292 */ s16 unk_292; - /* 0x0294 */ s16 csCameraTimer; + /* 0x0294 */ s16 subCamTimer; /* 0x0296 */ s16 unk_296; // read by ExRuppy // timer? /* 0x0298 */ s16 eyeTimer; /* 0x029A */ s16 spawnRuppyTimer; @@ -31,15 +31,15 @@ typedef struct EnDivingGame { /* 0x02A8 */ s16 state; // minigameState? 0: default, 1: waiting to give the scale, 2: minigame started /* 0x02AA */ s16 extraWinCount; // counts how many times you have beaten the minigame **after** you got the scale. ExRuppy will reset it to zero if a 500 rupee is spawned. /* 0x02AC */ char unk_2AC[0xC]; // probably another Vec3f, but unused. - /* 0x02B8 */ Vec3f camLookAt; - /* 0x02C4 */ Vec3f camEye; - /* 0x02D0 */ Vec3f unk_2D0; - /* 0x02DC */ Vec3f unk_2DC; - /* 0x02E8 */ Vec3f unk_2E8; - /* 0x02F4 */ Vec3f unk_2F4; - /* 0x0300 */ Vec3f unk_300; - /* 0x030C */ Vec3f unk_30C; - /* 0x0318 */ f32 unk_318; + /* 0x02B8 */ Vec3f subCamAt; + /* 0x02C4 */ Vec3f subCamEye; + /* 0x02D0 */ Vec3f subCamEyeNext; + /* 0x02DC */ Vec3f subCamEyeMaxVelFrac; + /* 0x02E8 */ Vec3f subCamEyeVel; + /* 0x02F4 */ Vec3f subCamAtNext; + /* 0x0300 */ Vec3f subCamAtMaxVelFrac; + /* 0x030C */ Vec3f subCamAtVel; + /* 0x0318 */ f32 subCamVelFactor; /* 0x031C */ char unk_31C; // unused /* 0x031D */ u8 notPlayingMinigame; // flag /* 0x031E */ u8 allRupeesThrown; // flag diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c index bdb8d2e219..e2e210bf8b 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.c @@ -97,7 +97,7 @@ void EnDntDemo_Init(Actor* thisx, GlobalContext* globalCtx2) { // "jiji jiji jiji jiji jiji" [onomatopoeia for the scrub sound?] osSyncPrintf(VT_FGCOL(GREEN) "☆☆☆☆☆ じじじじじじじじじじい ☆☆☆☆☆ %x\n" VT_RST, this->leader); } - this->subCamera = 0; + this->subCamId = SUB_CAM_ID_DONE; this->actor.flags &= ~ACTOR_FLAG_0; this->actionFunc = EnDntDemo_Judge; } @@ -124,8 +124,8 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { this->actionFunc = EnDntDemo_Results; } else if ((this->actor.xzDistToPlayer > 30.0f) || (Player_GetMask(globalCtx) == 0)) { this->debugArrowTimer++; - if (this->subCamera != SUBCAM_FREE) { - this->subCamera = SUBCAM_FREE; + if (this->subCamId != SUB_CAM_ID_DONE) { + this->subCamId = SUB_CAM_ID_DONE; } if (this->judgeTimer != 0) { for (i = 0; i < 9; i++) { @@ -134,8 +134,8 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { this->judgeTimer = 0; } } else { - if ((Player_GetMask(globalCtx) != 0) && (this->subCamera == SUBCAM_FREE)) { - this->subCamera = OnePointCutscene_Init(globalCtx, 2220, -99, &this->scrubs[3]->actor, MAIN_CAM); + if ((Player_GetMask(globalCtx) != 0) && (this->subCamId == SUB_CAM_ID_DONE)) { + this->subCamId = OnePointCutscene_Init(globalCtx, 2220, -99, &this->scrubs[3]->actor, CAM_ID_MAIN); } this->debugArrowTimer = 0; if (this->judgeTimer == 40) { @@ -169,10 +169,10 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { this->prize = DNT_PRIZE_NUTS; this->leader->stageSignal = DNT_LEADER_SIGNAL_UP; reaction = DNT_SIGNAL_LOOK; - if (this->subCamera != SUBCAM_FREE) { - this->subCamera = SUBCAM_FREE; + if (this->subCamId != SUB_CAM_ID_DONE) { + this->subCamId = SUB_CAM_ID_DONE; reaction = DNT_SIGNAL_LOOK; - OnePointCutscene_Init(globalCtx, 2340, -99, &this->leader->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 2340, -99, &this->leader->actor, CAM_ID_MAIN); } break; } @@ -209,9 +209,9 @@ void EnDntDemo_Judge(EnDntDemo* this, GlobalContext* globalCtx) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_COURTYARD); break; case DNT_ACTION_ATTACK: - if (this->subCamera != SUBCAM_FREE) { - this->subCamera = SUBCAM_FREE; - OnePointCutscene_Init(globalCtx, 2350, -99, &this->scrubs[3]->actor, MAIN_CAM); + if (this->subCamId != SUB_CAM_ID_DONE) { + this->subCamId = SUB_CAM_ID_DONE; + OnePointCutscene_Init(globalCtx, 2350, -99, &this->scrubs[3]->actor, CAM_ID_MAIN); } Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_ENEMY | 0x800); break; diff --git a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h index c2f3b9cdcb..71170f22e5 100644 --- a/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h +++ b/src/overlays/actors/ovl_En_Dnt_Demo/z_en_dnt_demo.h @@ -18,7 +18,7 @@ typedef struct EnDntDemo { /* 0x0158 */ s16 leaderSignal; /* 0x015A */ s16 action; /* 0x015C */ s16 prize; - /* 0x015E */ s16 subCamera; + /* 0x015E */ s16 subCamId; /* 0x0160 */ Vec3f scrubPos[9]; /* 0x01CC */ Vec3f leaderPos; /* 0x01D8 */ struct EnDntNomal* scrubs[9]; diff --git a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c index 6a2560783c..6cc12dd497 100644 --- a/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c +++ b/src/overlays/actors/ovl_En_Dnt_Jiji/z_en_dnt_jiji.c @@ -118,7 +118,7 @@ void EnDntJiji_Wait(EnDntJiji* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if ((this->timer == 1) && (this->actor.xzDistToPlayer < 150.0f) && !Gameplay_InCsMode(globalCtx) && !(player->stateFlags1 & PLAYER_STATE1_11)) { - OnePointCutscene_Init(globalCtx, 2230, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 2230, -99, &this->actor, CAM_ID_MAIN); this->timer = 0; func_8002DF54(globalCtx, NULL, 8); this->actionFunc = EnDntJiji_SetupUnburrow; diff --git a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c index c07872ba2e..9188ab95e9 100644 --- a/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c +++ b/src/overlays/actors/ovl_En_Dnt_Nomal/z_en_dnt_nomal.c @@ -249,7 +249,7 @@ void EnDntNomal_TargetWait(EnDntNomal* this, GlobalContext* globalCtx) { if (!LINK_IS_ADULT && !GET_ITEMGETINF(ITEMGETINF_1D)) { this->hitCounter++; if (this->hitCounter >= 3) { - OnePointCutscene_Init(globalCtx, 4140, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4140, -99, &this->actor, CAM_ID_MAIN); func_8002DF54(globalCtx, &this->actor, 1); this->timer4 = 50; this->actionFunc = EnDntNomal_SetupTargetUnburrow; diff --git a/src/overlays/actors/ovl_En_Du/z_en_du.c b/src/overlays/actors/ovl_En_Du/z_en_du.c index df386df8e1..ece973e769 100644 --- a/src/overlays/actors/ovl_En_Du/z_en_du.c +++ b/src/overlays/actors/ovl_En_Du/z_en_du.c @@ -365,7 +365,7 @@ void func_809FE638(EnDu* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); if (!(player->stateFlags1 & PLAYER_STATE1_29)) { - OnePointCutscene_Init(globalCtx, 3330, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3330, -99, &this->actor, CAM_ID_MAIN); player->actor.shape.rot.y = player->actor.world.rot.y = this->actor.world.rot.y + 0x7FFF; Audio_PlayFanfare(NA_BGM_APPEAR); EnDu_SetupAction(this, func_809FE6CC); diff --git a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c index 23aded47e4..1b91abdab5 100644 --- a/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c +++ b/src/overlays/actors/ovl_En_Fhg_Fire/z_en_fhg_fire.c @@ -177,7 +177,7 @@ void EnFhgFire_Destroy(Actor* thisx, GlobalContext* globalCtx) { } void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { - Camera* camera = Gameplay_GetCamera(globalCtx, 0); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); s16 i; switch (this->work[FHGFIRE_FIRE_MODE]) { @@ -187,7 +187,7 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { break; case STRIKE_BURST: this->actor.shape.rot.y = - Camera_GetInputDirYaw(camera) + 0x8000 * (this->work[FHGFIRE_VARIANCE_TIMER] & 0xFF); + Camera_GetInputDirYaw(mainCam) + 0x8000 * (this->work[FHGFIRE_VARIANCE_TIMER] & 0xFF); Math_ApproachF(&this->fwork[FHGFIRE_SCALE], 1.0f, 1.0f, 0.2f); if (this->work[FHGFIRE_TIMER] == 0) { @@ -218,7 +218,7 @@ void EnFhgFire_LightningStrike(EnFhgFire* this, GlobalContext* globalCtx) { break; case STRIKE_TRAILS: this->actor.shape.rot.y = - Camera_GetInputDirYaw(camera) + (this->work[FHGFIRE_VARIANCE_TIMER] & 0xFF) * 0x8000; + Camera_GetInputDirYaw(mainCam) + (this->work[FHGFIRE_VARIANCE_TIMER] & 0xFF) * 0x8000; Math_ApproachF(&this->fwork[FHGFIRE_SCALE], 0.0f, 1.0f, 0.2f); if (this->work[FHGFIRE_TIMER] == 30) { diff --git a/src/overlays/actors/ovl_En_Fr/z_en_fr.c b/src/overlays/actors/ovl_En_Fr/z_en_fr.c index 18521e40ed..c8d9105e35 100644 --- a/src/overlays/actors/ovl_En_Fr/z_en_fr.c +++ b/src/overlays/actors/ovl_En_Fr/z_en_fr.c @@ -615,7 +615,7 @@ void EnFr_Idle(EnFr* this, GlobalContext* globalCtx) { globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_00; } - OnePointCutscene_Init(globalCtx, 4110, ~0x62, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4110, ~0x62, &this->actor, CAM_ID_MAIN); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; player->actor.world.pos.x = this->actor.world.pos.x; // x = 990.0f player->actor.world.pos.y = this->actor.world.pos.y; // y = 205.0f diff --git a/src/overlays/actors/ovl_En_Go/z_en_go.c b/src/overlays/actors/ovl_En_Go/z_en_go.c index 2b74d5ae1e..94fa2dcce7 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -420,7 +420,7 @@ void func_80A3F0E4(EnGo* this) { s32 EnGo_IsCameraModified(EnGo* this, GlobalContext* globalCtx) { f32 xyzDistSq; s16 yawDiff = this->actor.yawTowardsPlayer - this->actor.shape.rot.y; - Camera* camera = globalCtx->cameraPtrs[MAIN_CAM]; + Camera* mainCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; if (fabsf(yawDiff) > 10920.0f) { return 0; @@ -428,13 +428,13 @@ s32 EnGo_IsCameraModified(EnGo* this, GlobalContext* globalCtx) { xyzDistSq = (this->actor.scale.x / 0.01f) * 10000.0f; if ((this->actor.params & 0xF0) == 0x90) { - Camera_ChangeSetting(camera, CAM_SET_DIRECTED_YAW); + Camera_ChangeSetting(mainCam, CAM_SET_DIRECTED_YAW); xyzDistSq *= 4.8f; } if (fabsf(this->actor.xyzDistToPlayerSq) > xyzDistSq) { - if (camera->setting == CAM_SET_DIRECTED_YAW) { - Camera_ChangeSetting(camera, CAM_SET_NORMAL0); + if (mainCam->setting == CAM_SET_DIRECTED_YAW) { + Camera_ChangeSetting(mainCam, CAM_SET_NORMAL0); } return 0; } else { @@ -774,7 +774,7 @@ void EnGo_CurledUp(EnGo* this, GlobalContext* globalCtx) { EnGo_SetupAction(this, EnGo_WakeUp); if ((this->actor.params & 0xF0) == 0x90) { - OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, CAM_ID_MAIN); } } } @@ -866,7 +866,7 @@ void EnGo_BiggoronActionFunc(EnGo* this, GlobalContext* globalCtx) { EnGo_SetupAction(this, EnGo_Eyedrops); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; gSaveContext.timer2State = 0; - OnePointCutscene_Init(globalCtx, 4190, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4190, -99, &this->actor, CAM_ID_MAIN); } else { this->unk_1E0.unk_00 = 0; EnGo_SetupAction(this, EnGo_GetItem); diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.c b/src/overlays/actors/ovl_En_Go2/z_en_go2.c index 326b87eb0b..91a028a55a 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.c +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.c @@ -1140,15 +1140,15 @@ f32 EnGo2_GetTargetXZSpeed(EnGo2* this) { } s32 EnGo2_IsCameraModified(EnGo2* this, GlobalContext* globalCtx) { - Camera* camera = globalCtx->cameraPtrs[MAIN_CAM]; + Camera* mainCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { if (EnGo2_IsWakingUp(this)) { - Camera_ChangeSetting(camera, CAM_SET_DIRECTED_YAW); - func_8005AD1C(camera, 4); - } else if (!EnGo2_IsWakingUp(this) && (camera->setting == CAM_SET_DIRECTED_YAW)) { - Camera_ChangeSetting(camera, CAM_SET_DUNGEON1); - func_8005ACFC(camera, 4); + Camera_ChangeSetting(mainCam, CAM_SET_DIRECTED_YAW); + func_8005AD1C(mainCam, 4); + } else if (!EnGo2_IsWakingUp(this) && (mainCam->setting == CAM_SET_DIRECTED_YAW)) { + Camera_ChangeSetting(mainCam, CAM_SET_DUNGEON1); + func_8005ACFC(mainCam, 4); } } @@ -1304,7 +1304,7 @@ void EnGo2_WakeUp(EnGo2* this, GlobalContext* globalCtx) { } } if ((this->actor.params & 0x1F) == GORON_DMT_BIGGORON) { - OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4200, -99, &this->actor, CAM_ID_MAIN); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ENGO2_ANIM_10); this->skelAnime.playSpeed = 0.5f; } else { @@ -1460,23 +1460,23 @@ void EnGo2_GoronLinkAnimation(EnGo2* this, GlobalContext* globalCtx) { void EnGo2_GoronFireCamera(EnGo2* this, GlobalContext* globalCtx) { s16 yaw; - this->camId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->camId, CAM_STAT_ACTIVE); - Path_CopyLastPoint(this->path, &this->at); - yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->at) + 0xE38; - this->eye.x = Math_SinS(yaw) * 100.0f + this->actor.world.pos.x; - this->eye.z = Math_CosS(yaw) * 100.0f + this->actor.world.pos.z; - this->eye.y = this->actor.world.pos.y + 20.0f; - this->at.x = this->actor.world.pos.x; - this->at.y = this->actor.world.pos.y + 40.0f; - this->at.z = this->actor.world.pos.z; - Gameplay_CameraSetAtEye(globalCtx, this->camId, &this->at, &this->eye); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + Path_CopyLastPoint(this->path, &this->subCamAt); + yaw = Math_Vec3f_Yaw(&this->actor.world.pos, &this->subCamAt) + 0xE38; + this->subCamEye.x = Math_SinS(yaw) * 100.0f + this->actor.world.pos.x; + this->subCamEye.z = Math_CosS(yaw) * 100.0f + this->actor.world.pos.z; + this->subCamEye.y = this->actor.world.pos.y + 20.0f; + this->subCamAt.x = this->actor.world.pos.x; + this->subCamAt.y = this->actor.world.pos.y + 40.0f; + this->subCamAt.z = this->actor.world.pos.z; + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } void EnGo2_GoronFireClearCamera(EnGo2* this, GlobalContext* globalCtx) { - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, this->camId); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Gameplay_ClearCamera(globalCtx, this->subCamId); } void EnGo2_BiggoronAnimation(EnGo2* this) { @@ -1810,7 +1810,7 @@ void EnGo2_BiggoronEyedrops(EnGo2* this, GlobalContext* globalCtx) { this->unk_20C = 0; this->goronState++; func_800F483C(0x28, 5); - OnePointCutscene_Init(globalCtx, 4190, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4190, -99, &this->actor, CAM_ID_MAIN); break; case 1: if (DECR(this->animTimer)) { diff --git a/src/overlays/actors/ovl_En_Go2/z_en_go2.h b/src/overlays/actors/ovl_En_Go2/z_en_go2.h index 9c8c1076a2..83e50e6ecf 100644 --- a/src/overlays/actors/ovl_En_Go2/z_en_go2.h +++ b/src/overlays/actors/ovl_En_Go2/z_en_go2.h @@ -96,15 +96,15 @@ typedef struct EnGo2 { /* 0x024A */ s16 unk_24A[18]; // Remains unknown /* 0x026E */ u16 unk_26E; // Remains unknown = 1, 2, or 4: used in func_80034A14 /* 0x0270 */ EnGoEffect effects[EN_GO2_EFFECT_COUNT]; - /* 0x04A0 */ Vec3f eye; - /* 0x04AC */ Vec3f at; + /* 0x04A0 */ Vec3f subCamEye; + /* 0x04AC */ Vec3f subCamAt; /* 0x04B8 */ Vec3s jointTable[18]; /* 0x0524 */ Vec3s morphTable[18]; /* 0x0590 */ s16 unk_590; // timer /* 0x0592 */ s16 animTimer; // animTimer. Plays NA_SE_EN_MORIBLIN_WALK, NA_SE_EV_IRON_DOOR_OPEN, NA_SE_EV_IRON_DOOR_CLOSE /* 0x0594 */ s32 getItemId; /* 0x0598 */ char unk_598[0x02]; - /* 0x059A */ s16 camId; + /* 0x059A */ s16 subCamId; /* 0x059C */ s16 unk_59C; } EnGo2; // size = 0x05A0 diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c index b10570d7f9..34b4140263 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.c @@ -308,18 +308,18 @@ void func_80A5372C(EnHeishi2* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->unk_2F2[0] = 200; - this->cameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->cameraId, CAM_STAT_ACTIVE); - this->unk_280.x = 947.0f; - this->unk_280.y = 1195.0f; - this->unk_280.z = 2682.0f; + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamEye.x = 947.0f; + this->subCamEye.y = 1195.0f; + this->subCamEye.z = 2682.0f; - this->unk_28C.x = 1164.0f; - this->unk_28C.y = 1145.0f; - this->unk_28C.z = 3014.0f; + this->subCamAt.x = 1164.0f; + this->subCamAt.y = 1145.0f; + this->subCamAt.z = 3014.0f; - Gameplay_CameraSetAtEye(globalCtx, this->cameraId, &this->unk_280, &this->unk_28C); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamEye, &this->subCamAt); this->actionFunc = func_80A53850; } @@ -327,11 +327,11 @@ void func_80A53850(EnHeishi2* this, GlobalContext* globalCtx) { BgSpot15Saku* gate; SkelAnime_Update(&this->skelAnime); - Gameplay_CameraSetAtEye(globalCtx, this->cameraId, &this->unk_280, &this->unk_28C); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamEye, &this->subCamAt); gate = (BgSpot15Saku*)this->gate; if ((this->unk_2F2[0] == 0) || (gate->unk_168 == 0)) { - Gameplay_ClearCamera(globalCtx, this->cameraId); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); + Gameplay_ClearCamera(globalCtx, this->subCamId); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); Message_CloseTextbox(globalCtx); this->unk_30C = 1; func_8002DF54(globalCtx, NULL, 7); @@ -472,22 +472,22 @@ void func_80A53DF8(EnHeishi2* this, GlobalContext* globalCtx) { Animation_Change(&this->skelAnime, &gEnHeishiIdleAnim, 1.0f, 0.0f, (s16)frameCount, ANIMMODE_LOOP, -10.0f); this->unk_2F2[0] = 200; - this->cameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->cameraId, CAM_STAT_ACTIVE); - this->unk_2BC.x = -71.0f; - this->unk_280.x = -71.0f; - this->unk_2BC.y = 571.0f; - this->unk_280.y = 571.0f; - this->unk_2BC.z = -1487.0f; - this->unk_280.z = -1487.0f; - this->unk_298.x = 181.0f; - this->unk_28C.x = 181.0f; - this->unk_298.y = 417.0f; - this->unk_28C.y = 417.0f; - this->unk_298.z = -1079.0f; - this->unk_28C.z = -1079.0f; - Gameplay_CameraSetAtEye(globalCtx, this->cameraId, &this->unk_280, &this->unk_28C); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + this->subCamEyeInit.x = -71.0f; + this->subCamEye.x = -71.0f; + this->subCamEyeInit.y = 571.0f; + this->subCamEye.y = 571.0f; + this->subCamEyeInit.z = -1487.0f; + this->subCamEye.z = -1487.0f; + this->subCamAtInit.x = 181.0f; + this->subCamAt.x = 181.0f; + this->subCamAtInit.y = 417.0f; + this->subCamAt.y = 417.0f; + this->subCamAtInit.z = -1079.0f; + this->subCamAt.z = -1079.0f; + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamEye, &this->subCamAt); this->actionFunc = func_80A53F30; } @@ -495,11 +495,11 @@ void func_80A53F30(EnHeishi2* this, GlobalContext* globalCtx) { BgGateShutter* gate; SkelAnime_Update(&this->skelAnime); - Gameplay_CameraSetAtEye(globalCtx, this->cameraId, &this->unk_280, &this->unk_28C); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamEye, &this->subCamAt); gate = (BgGateShutter*)this->gate; if ((this->unk_2F2[0] == 0) || (gate->openingState == 0)) { - Gameplay_ClearCamera(globalCtx, this->cameraId); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); + Gameplay_ClearCamera(globalCtx, this->subCamId); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); if (this->unk_30A != 2) { if (this->unk_30A == 0) { this->actor.textId = 0x2015; diff --git a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h index 83335e49b3..e3a648383a 100644 --- a/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h +++ b/src/overlays/actors/ovl_En_Heishi2/z_en_heishi2.h @@ -18,12 +18,12 @@ typedef struct EnHeishi2 { /* 0x0260 */ Vec3s unk_260; /* 0x0266 */ char unk_266[0x06]; /* 0x026C */ Vec3s unk_26C; // padding inbetween these - /* 0x0274 */ Vec3f unk_274; - /* 0x0280 */ Vec3f unk_280; // camera related - /* 0x028C */ Vec3f unk_28C; // camera related - /* 0x0298 */ Vec3f unk_298; // camera related + /* 0x0274 */ Vec3f unk_274; + /* 0x0280 */ Vec3f subCamEye; + /* 0x028C */ Vec3f subCamAt; + /* 0x0298 */ Vec3f subCamAtInit; /* 0x02A4 */ char unk_2A4[0x18]; - /* 0x02BC */ Vec3f unk_2BC; // camera related + /* 0x02BC */ Vec3f subCamEyeInit; /* 0x02C8 */ char unk_2C8[0x18]; /* 0x02E0 */ f32 unk_2E0; /* 0x02E4 */ f32 unk_2E4; @@ -42,7 +42,7 @@ typedef struct EnHeishi2 { /* 0x030C */ u8 unk_30C; /* 0x030D */ char unk_30D; /* 0x030E */ s16 unk_30E; - /* 0x0310 */ s16 cameraId; + /* 0x0310 */ s16 subCamId; /* 0x0314 */ Actor* gate; // first BgGateShutter that can be found in the actor list /* 0x0318 */ char unk_318[0x18]; /* 0x0330 */ MtxF mtxf_330; diff --git a/src/overlays/actors/ovl_En_Horse/z_en_horse.c b/src/overlays/actors/ovl_En_Horse/z_en_horse.c index 64b8be7443..f3f052b8fe 100644 --- a/src/overlays/actors/ovl_En_Horse/z_en_horse.c +++ b/src/overlays/actors/ovl_En_Horse/z_en_horse.c @@ -1752,9 +1752,9 @@ void EnHorse_Inactive(EnHorse* this, GlobalContext* globalCtx2) { gSaveContext.horseData.scene = globalCtx->sceneNum; // Focus the camera on Epona - Camera_SetParam(globalCtx->cameraPtrs[0], 8, this); - Camera_ChangeSetting(globalCtx->cameraPtrs[0], 0x38); - Camera_SetCameraData(globalCtx->cameraPtrs[0], 4, NULL, NULL, 0x51, 0, 0); + Camera_SetParam(globalCtx->cameraPtrs[CAM_ID_MAIN], 8, this); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_TURN_AROUND); + Camera_SetCameraData(globalCtx->cameraPtrs[CAM_ID_MAIN], 4, NULL, NULL, 0x51, 0, 0); } } if (!(this->stateFlags & ENHORSE_INACTIVE)) { @@ -1826,9 +1826,9 @@ void EnHorse_Idle(EnHorse* this, GlobalContext* globalCtx) { &gSfxDefaultFreqAndVolScale, &gSfxDefaultReverb); this->followTimer = 0; EnHorse_SetFollowAnimation(this, globalCtx); - Camera_SetParam(globalCtx->cameraPtrs[0], 8, this); - Camera_ChangeSetting(globalCtx->cameraPtrs[0], 0x38); - Camera_SetCameraData(globalCtx->cameraPtrs[0], 4, NULL, NULL, 0x51, 0, 0); + Camera_SetParam(globalCtx->cameraPtrs[CAM_ID_MAIN], 8, this); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_TURN_AROUND); + Camera_SetCameraData(globalCtx->cameraPtrs[CAM_ID_MAIN], 4, NULL, NULL, 0x51, 0, 0); } } else { Audio_PlaySoundGeneral(NA_SE_EV_HORSE_NEIGH, &this->actor.projectedPos, 4, &gSfxDefaultFreqAndVolScale, diff --git a/src/overlays/actors/ovl_En_In/z_en_in.c b/src/overlays/actors/ovl_En_In/z_en_in.c index a818701fed..9ed1bd5902 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.c +++ b/src/overlays/actors/ovl_En_In/z_en_in.c @@ -442,21 +442,21 @@ void func_80A79BAC(EnIn* this, GlobalContext* globalCtx, s32 index, u32 transiti void func_80A79C78(EnIn* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); - Vec3f sp48; - Vec3f sp3C; + Vec3f subCamAt; + Vec3f subCamEye; Vec3s zeroVec = { 0, 0, 0 }; - this->camId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->camId, CAM_STAT_ACTIVE); - sp48.x = this->actor.world.pos.x; - sp48.y = this->actor.world.pos.y + 60.0f; - sp48.z = this->actor.world.pos.z; - sp3C.x = sp48.x; - sp3C.y = sp48.y - 22.0f; - sp3C.z = sp48.z + 40.0f; - Gameplay_CameraSetAtEye(globalCtx, this->camId, &sp48, &sp3C); - this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &sp3C); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + subCamAt.x = this->actor.world.pos.x; + subCamAt.y = this->actor.world.pos.y + 60.0f; + subCamAt.z = this->actor.world.pos.z; + subCamEye.x = subCamAt.x; + subCamEye.y = subCamAt.y - 22.0f; + subCamEye.z = subCamAt.z + 40.0f; + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + this->actor.shape.rot.y = Math_Vec3f_Yaw(&this->actor.world.pos, &subCamEye); this->unk_308.unk_08 = zeroVec; this->unk_308.unk_0E = zeroVec; Message_StartTextbox(globalCtx, 0x2025, NULL); @@ -759,33 +759,33 @@ void func_80A7A940(EnIn* this, GlobalContext* globalCtx) { void func_80A7AA40(EnIn* this, GlobalContext* globalCtx) { Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; - Vec3f sp30; - Vec3f sp24; + Vec3f subCamAt; + Vec3f subCamEye; - this->camId = Gameplay_CreateSubCamera(globalCtx); - this->activeCamId = globalCtx->activeCamera; - Gameplay_ChangeCameraStatus(globalCtx, this->activeCamId, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->camId, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + this->returnToCamId = globalCtx->activeCamId; + Gameplay_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); - this->unk_2F0 = 0.0f; - this->unk_2F4 = 50.0f; - this->unk_2F8 = 0.0f; - this->unk_2FC = 0.0f; - this->unk_300 = 50.0f; - this->unk_304 = 50.0f; + this->subCamAtOffset.x = 0.0f; + this->subCamAtOffset.y = 50.0f; + this->subCamAtOffset.z = 0.0f; + this->subCamEyeOffset.x = 0.0f; + this->subCamEyeOffset.y = 50.0f; + this->subCamEyeOffset.z = 50.0f; - sp30 = this->actor.world.pos; - sp24 = this->actor.world.pos; + subCamAt = this->actor.world.pos; + subCamEye = this->actor.world.pos; - sp30.x += this->unk_2F0; - sp30.y += this->unk_2F4; - sp30.z += this->unk_2F8; + subCamAt.x += this->subCamAtOffset.x; + subCamAt.y += this->subCamAtOffset.y; + subCamAt.z += this->subCamAtOffset.z; - sp24.x += this->unk_2FC; - sp24.y += this->unk_300; - sp24.z += this->unk_304; + subCamEye.x += this->subCamEyeOffset.x; + subCamEye.y += this->subCamEyeOffset.y; + subCamEye.z += this->subCamEyeOffset.z; - Gameplay_CameraSetAtEye(globalCtx, this->camId, &sp30, &sp24); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); this->actor.textId = 0x203B; Message_StartTextbox(globalCtx, this->actor.textId, NULL); this->unk_308.unk_00 = 1; @@ -798,8 +798,8 @@ void func_80A7AA40(EnIn* this, GlobalContext* globalCtx) { void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); - Vec3f sp48; - Vec3f sp3C; + Vec3f subCamAt; + Vec3f subCamEye; if (player->rideActor != NULL) { player->rideActor->freezeTimer = 10; @@ -833,29 +833,29 @@ void func_80A7ABD4(EnIn* this, GlobalContext* globalCtx) { if (globalCtx->csCtx.frames == 44) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_RONRON_DOOR_CLOSE); } - Math_SmoothStepToF(&this->unk_2F0, 0.0f, 0.06f, 10000.0f, 0.0f); - Math_SmoothStepToF(&this->unk_2F4, 50.0f, 0.06f, 10000.0f, 0.0f); - Math_SmoothStepToF(&this->unk_2F8, 0.0f, 0.06f, 10000.0f, 0.0f); - Math_SmoothStepToF(&this->unk_2FC, 0.0f, 0.06f, 10000.0f, 0.0f); - Math_SmoothStepToF(&this->unk_300, 150.0f, 0.06f, 10000.0f, 0.0f); - Math_SmoothStepToF(&this->unk_304, 300.0f, 0.06f, 10000.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAtOffset.x, 0.0f, 0.06f, 10000.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAtOffset.y, 50.0f, 0.06f, 10000.0f, 0.0f); + Math_SmoothStepToF(&this->subCamAtOffset.z, 0.0f, 0.06f, 10000.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEyeOffset.x, 0.0f, 0.06f, 10000.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEyeOffset.y, 150.0f, 0.06f, 10000.0f, 0.0f); + Math_SmoothStepToF(&this->subCamEyeOffset.z, 300.0f, 0.06f, 10000.0f, 0.0f); - sp48 = this->actor.world.pos; - sp3C = this->actor.world.pos; + subCamAt = this->actor.world.pos; + subCamEye = this->actor.world.pos; - sp48.x += this->unk_2F0; - sp48.y += this->unk_2F4; - sp48.z += this->unk_2F8; - sp3C.x += this->unk_2FC; - sp3C.y += this->unk_300; - sp3C.z += this->unk_304; - Gameplay_CameraSetAtEye(globalCtx, this->camId, &sp48, &sp3C); + subCamAt.x += this->subCamAtOffset.x; + subCamAt.y += this->subCamAtOffset.y; + subCamAt.z += this->subCamAtOffset.z; + subCamEye.x += this->subCamEyeOffset.x; + subCamEye.y += this->subCamEyeOffset.y; + subCamEye.z += this->subCamEyeOffset.z; + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); } } void func_80A7AE84(EnIn* this, GlobalContext* globalCtx) { - Gameplay_ChangeCameraStatus(globalCtx, this->activeCamId, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, this->camId); + Gameplay_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_ACTIVE); + Gameplay_ClearCamera(globalCtx, this->subCamId); func_8002DF54(globalCtx, &this->actor, 7); Interface_ChangeAlpha(0x32); this->actionFunc = func_80A7AEF0; diff --git a/src/overlays/actors/ovl_En_In/z_en_in.h b/src/overlays/actors/ovl_En_In/z_en_in.h index 5777c21f7c..272535f252 100644 --- a/src/overlays/actors/ovl_En_In/z_en_in.h +++ b/src/overlays/actors/ovl_En_In/z_en_in.h @@ -44,20 +44,16 @@ typedef struct EnIn { /* 0x01EA */ s16 blinkTimer; /* 0x01EC */ s16 unk_1EC; /* 0x01EE */ s16 eyeIndex; - /* 0x01F0 */ s16 camId; - /* 0x01F2 */ s16 activeCamId; + /* 0x01F0 */ s16 subCamId; + /* 0x01F2 */ s16 returnToCamId; /* 0x01F4 */ char unk_1F4[0x4]; /* 0x01F8 */ s16 unk_1F8; /* 0x01FA */ s16 unk_1FA; /* 0x01FC */ s16 unk_1FC; /* 0x01FE */ Vec3s jointTable[INGO_LIMB_MAX]; /* 0x0276 */ Vec3s morphTable[INGO_LIMB_MAX]; - /* 0x02F0 */ f32 unk_2F0; - /* 0x02F4 */ f32 unk_2F4; - /* 0x02F8 */ f32 unk_2F8; - /* 0x02FC */ f32 unk_2FC; - /* 0x0300 */ f32 unk_300; - /* 0x0304 */ f32 unk_304; + /* 0x02F0 */ Vec3f subCamAtOffset; + /* 0x02FC */ Vec3f subCamEyeOffset; /* 0x0308 */ struct_80034A14_arg1 unk_308; /* 0x0330 */ Vec3s unk_330[INGO_LIMB_MAX]; } EnIn; // size = 0x03A8 diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c index 783010a8e1..28526ef564 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -197,7 +197,7 @@ void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) { func_80A8F28C(this); SkelAnime_Update(&this->skelanime); - this->camId = SUBCAM_NONE; + this->subCamId = CAM_ID_NONE; if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { if (this->unk_196 == TEXT_STATE_EVENT) { this->actionFunc = func_80A8F9C8; @@ -213,7 +213,7 @@ void func_80A8F75C(EnKakasi* this, GlobalContext* globalCtx) { if (absyawTowardsPlayer < 0x4300) { if (!this->unk_194) { if (player->stateFlags2 & PLAYER_STATE2_24) { - this->camId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, MAIN_CAM); + this->subCamId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, CAM_ID_MAIN); func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_LONG_RECORDING); this->unk_19A = 0; @@ -246,8 +246,8 @@ void func_80A8F8D0(EnKakasi* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, this->actor.textId, NULL); this->actionFunc = func_80A8F9C8; } else { - OnePointCutscene_EndCutscene(globalCtx, this->camId); - this->camId = SUBCAM_NONE; + OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + this->subCamId = CAM_ID_NONE; this->actionFunc = func_80A8F660; } } else if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_01) { @@ -263,10 +263,10 @@ void func_80A8F9C8(EnKakasi* this, GlobalContext* globalCtx) { if (this->unk_196 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - if (this->camId != SUBCAM_NONE) { - func_8005B1A4(globalCtx->cameraPtrs[this->camId]); + if (this->subCamId != CAM_ID_NONE) { + func_8005B1A4(globalCtx->cameraPtrs[this->subCamId]); } - this->camId = OnePointCutscene_Init(globalCtx, 2270, -99, &this->actor, MAIN_CAM); + this->subCamId = OnePointCutscene_Init(globalCtx, 2270, -99, &this->actor, CAM_ID_MAIN); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; func_8002DF54(globalCtx, NULL, 8); func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_LONG_PLAYBACK); @@ -293,10 +293,10 @@ void func_80A8FAA4(EnKakasi* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, this->actor.textId, NULL); } this->actionFunc = func_80A8FBB8; - OnePointCutscene_EndCutscene(globalCtx, this->camId); - this->camId = SUBCAM_NONE; - this->camId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, MAIN_CAM); - func_8005B1A4(globalCtx->cameraPtrs[this->camId]); + OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + this->subCamId = CAM_ID_NONE; + this->subCamId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, CAM_ID_MAIN); + func_8005B1A4(globalCtx->cameraPtrs[this->subCamId]); } } @@ -305,7 +305,7 @@ void func_80A8FBB8(EnKakasi* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelanime); if (this->unk_196 == Message_GetState(&globalCtx->msgCtx) && Message_ShouldAdvance(globalCtx)) { - func_8005B1A4(globalCtx->cameraPtrs[this->camId]); + func_8005B1A4(globalCtx->cameraPtrs[this->subCamId]); Message_CloseTextbox(globalCtx); func_8002DF54(globalCtx, NULL, 7); this->actionFunc = func_80A8F660; diff --git a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h index aeb13ebcb6..4b07caae04 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.h @@ -26,7 +26,7 @@ typedef struct EnKakasi { /* 0x01B4 */ f32 height; /* 0x01B8 */ f32 unk_1B8; /* 0x01BC */ ColliderCylinder collider; - /* 0x0208 */ s16 camId; + /* 0x0208 */ s16 subCamId; } EnKakasi; // size = 0x020C #endif diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c index 8eb1c67b91..69a523e98a 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.c @@ -211,7 +211,7 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { func_80A90E28(this); SkelAnime_Update(&this->skelAnime); - this->camId = SUBCAM_NONE; + this->subCamId = CAM_ID_NONE; if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { if (!this->unk_194) { if (this->unk_1A8 == 0) { @@ -232,7 +232,7 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { if (!this->unk_194) { if (player->stateFlags2 & PLAYER_STATE2_24) { - this->camId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, MAIN_CAM); + this->subCamId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, CAM_ID_MAIN); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->dialogState = TEXT_STATE_EVENT; this->unk_1B8 = 0.0f; @@ -247,7 +247,7 @@ void func_80A91348(EnKakasi3* this, GlobalContext* globalCtx) { } else if (gSaveContext.scarecrowSpawnSongSet && !this->unk_195) { if (player->stateFlags2 & PLAYER_STATE2_24) { - this->camId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, MAIN_CAM); + this->subCamId = OnePointCutscene_Init(globalCtx, 2260, -99, &this->actor, CAM_ID_MAIN); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->dialogState = TEXT_STATE_EVENT; this->unk_1B8 = 0.0f; @@ -281,12 +281,12 @@ void func_80A91620(EnKakasi3* this, GlobalContext* globalCtx) { (globalCtx->msgCtx.ocarinaMode >= OCARINA_MODE_05 && globalCtx->msgCtx.ocarinaMode < OCARINA_MODE_0B)) && (globalCtx->msgCtx.msgMode == MSGMODE_NONE)) { - OnePointCutscene_EndCutscene(globalCtx, this->camId); - if (globalCtx->cameraPtrs[this->camId] == NULL) { - this->camId = SUBCAM_NONE; + OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + if (globalCtx->cameraPtrs[this->subCamId] == NULL) { + this->subCamId = CAM_ID_NONE; } - if (this->camId != SUBCAM_NONE) { - func_8005B1A4(globalCtx->cameraPtrs[this->camId]); + if (this->subCamId != CAM_ID_NONE) { + func_8005B1A4(globalCtx->cameraPtrs[this->subCamId]); } this->actionFunc = func_80A911F0; return; @@ -314,7 +314,7 @@ void func_80A91760(EnKakasi3* this, GlobalContext* globalCtx) { globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; func_8010BD58(globalCtx, OCARINA_ACTION_SCARECROW_SPAWN_PLAYBACK); this->actionFunc = func_80A917FC; - this->camId = OnePointCutscene_Init(globalCtx, 2280, -99, &this->actor, MAIN_CAM); + this->subCamId = OnePointCutscene_Init(globalCtx, 2280, -99, &this->actor, CAM_ID_MAIN); } } @@ -325,7 +325,7 @@ void func_80A917FC(EnKakasi3* this, GlobalContext* globalCtx) { } else { globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; Message_CloseTextbox(globalCtx); - OnePointCutscene_EndCutscene(globalCtx, this->camId); + OnePointCutscene_EndCutscene(globalCtx, this->subCamId); this->actionFunc = func_80A911F0; } } @@ -351,8 +351,8 @@ void func_80A918E4(EnKakasi3* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x40A6, NULL); this->dialogState = TEXT_STATE_EVENT; - OnePointCutscene_EndCutscene(globalCtx, this->camId); - this->camId = SUBCAM_NONE; + OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + this->subCamId = CAM_ID_NONE; func_8002DF54(globalCtx, NULL, 8); this->actionFunc = func_80A91A90; return; @@ -391,11 +391,11 @@ void func_80A91A90(EnKakasi3* this, GlobalContext* globalCtx) { SET_EVENTCHKINF(EVENTCHKINF_9C); } } - if (globalCtx->cameraPtrs[this->camId] == NULL) { - this->camId = SUBCAM_NONE; + if (globalCtx->cameraPtrs[this->subCamId] == NULL) { + this->subCamId = CAM_ID_NONE; } - if (this->camId != SUBCAM_NONE) { - func_8005B1A4(globalCtx->cameraPtrs[this->camId]); + if (this->subCamId != CAM_ID_NONE) { + func_8005B1A4(globalCtx->cameraPtrs[this->subCamId]); } Message_CloseTextbox(globalCtx); globalCtx->msgCtx.ocarinaMode = OCARINA_MODE_04; diff --git a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h index a5c68445a0..90eadc027b 100644 --- a/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h +++ b/src/overlays/actors/ovl_En_Kakasi3/z_en_kakasi3.h @@ -27,7 +27,7 @@ typedef struct EnKakasi3 { /* 0x01B0 */ Vec3s rot; /* 0x01B8 */ f32 unk_1B8; /* 0x01BC */ ColliderCylinder collider; - /* 0x0208 */ s16 camId; + /* 0x0208 */ s16 subCamId; } EnKakasi3; // size = 0x020C #endif diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.c b/src/overlays/actors/ovl_En_Kz/z_en_kz.c index bc42be566b..d2036cc5e1 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.c +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.c @@ -363,36 +363,36 @@ void EnKz_PreMweepWait(EnKz* this, GlobalContext* globalCtx) { } void EnKz_SetupMweep(EnKz* this, GlobalContext* globalCtx) { - Vec3f unused = { 0.0f, 0.0f, 0.0f }; - Vec3f pos; - Vec3f initPos; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; // unused + Vec3f subCamAt; + Vec3f subCamEye; - this->cutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - this->gameplayCamera = globalCtx->activeCamera; - Gameplay_ChangeCameraStatus(globalCtx, this->gameplayCamera, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->cutsceneCamera, CAM_STAT_ACTIVE); - pos = this->actor.world.pos; - initPos = this->actor.home.pos; - pos.y += 60.0f; - initPos.y += -100.0f; - initPos.z += 260.0f; - Gameplay_CameraSetAtEye(globalCtx, this->cutsceneCamera, &pos, &initPos); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + this->returnToCamId = globalCtx->activeCamId; + Gameplay_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + subCamAt = this->actor.world.pos; + subCamEye = this->actor.home.pos; + subCamAt.y += 60.0f; + subCamEye.y += -100.0f; + subCamEye.z += 260.0f; + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); func_8002DF54(globalCtx, &this->actor, 8); this->actor.speedXZ = 0.1f; this->actionFunc = EnKz_Mweep; } void EnKz_Mweep(EnKz* this, GlobalContext* globalCtx) { - Vec3f unused = { 0.0f, 0.0f, 0.0f }; - Vec3f pos; - Vec3f initPos; + Vec3f zeroVec = { 0.0f, 0.0f, 0.0f }; // unused + Vec3f subCamAt; + Vec3f subCamEye; - pos = this->actor.world.pos; - initPos = this->actor.home.pos; - pos.y += 60.0f; - initPos.y += -100.0f; - initPos.z += 260.0f; - Gameplay_CameraSetAtEye(globalCtx, this->cutsceneCamera, &pos, &initPos); + subCamAt = this->actor.world.pos; + subCamEye = this->actor.home.pos; + subCamAt.y += 60.0f; + subCamEye.y += -100.0f; + subCamEye.z += 260.0f; + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); if ((EnKz_FollowPath(this, globalCtx) == 1) && (this->waypoint == 0)) { Animation_ChangeByInfo(&this->skelanime, sAnimationInfo, ENKZ_ANIM_1); Inventory_ReplaceItem(globalCtx, ITEM_LETTER_RUTO, ITEM_BOTTLE); @@ -407,8 +407,8 @@ void EnKz_Mweep(EnKz* this, GlobalContext* globalCtx) { } void EnKz_StopMweep(EnKz* this, GlobalContext* globalCtx) { - Gameplay_ChangeCameraStatus(globalCtx, this->gameplayCamera, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, this->cutsceneCamera); + Gameplay_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_ACTIVE); + Gameplay_ClearCamera(globalCtx, this->subCamId); func_8002DF54(globalCtx, &this->actor, 7); this->actionFunc = EnKz_Wait; } diff --git a/src/overlays/actors/ovl_En_Kz/z_en_kz.h b/src/overlays/actors/ovl_En_Kz/z_en_kz.h index 67491aceea..2497608143 100644 --- a/src/overlays/actors/ovl_En_Kz/z_en_kz.h +++ b/src/overlays/actors/ovl_En_Kz/z_en_kz.h @@ -20,8 +20,8 @@ typedef struct EnKz { /* 0x020C */ s16 blinkTimer; /* 0x020E */ char unk_20E[2]; /* 0x0210 */ s16 eyeIdx; - /* 0x0212 */ s16 cutsceneCamera; - /* 0x0214 */ s16 gameplayCamera; + /* 0x0212 */ s16 subCamId; + /* 0x0214 */ s16 returnToCamId; /* 0x0216 */ Vec3s jointTable[12]; /* 0x025E */ Vec3s morphTable[12]; /* 0x02A6 */ s16 unk_2A6[12]; diff --git a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c index 4e27ae61a6..ccf1e4dd0f 100644 --- a/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c +++ b/src/overlays/actors/ovl_En_Ma1/z_en_ma1.c @@ -446,14 +446,14 @@ void EnMa1_PostLimbDraw(GlobalContext* globalCtx, s32 limbIndex, Gfx** dList, Ve void EnMa1_Draw(Actor* thisx, GlobalContext* globalCtx) { EnMa1* this = (EnMa1*)thisx; - Camera* camera; + Camera* activeCam; f32 distFromCamera; s32 pad; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma1.c", 1226); - camera = GET_ACTIVE_CAM(globalCtx); - distFromCamera = Math_Vec3f_DistXZ(&this->actor.world.pos, &camera->eye); + activeCam = GET_ACTIVE_CAM(globalCtx); + distFromCamera = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye); func_800F6268(distFromCamera, NA_BGM_LONLON); func_80093D18(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c index 5a877aa653..9a9dd5eefb 100644 --- a/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c +++ b/src/overlays/actors/ovl_En_Ma2/z_en_ma2.c @@ -373,14 +373,14 @@ void EnMa2_Draw(Actor* thisx, GlobalContext* globalCtx) { static void* sEyeTextures[] = { gMalonAdultEyeOpenTex, gMalonAdultEyeHalfTex, gMalonAdultEyeClosedTex }; EnMa2* this = (EnMa2*)thisx; - Camera* camera; + Camera* activeCam; f32 someFloat; s32 pad; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma2.c", 955); - camera = GET_ACTIVE_CAM(globalCtx); - someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &camera->eye); + activeCam = GET_ACTIVE_CAM(globalCtx); + someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye); func_800F6268(someFloat, NA_BGM_LONLON); func_80093D18(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c index e6730b4eff..43d03a7084 100644 --- a/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c +++ b/src/overlays/actors/ovl_En_Ma3/z_en_ma3.c @@ -352,14 +352,14 @@ void EnMa3_Draw(Actor* thisx, GlobalContext* globalCtx) { static void* sMouthTextures[] = { gMalonAdultMouthNeutralTex, gMalonAdultMouthSadTex, gMalonAdultMouthHappyTex }; static void* sEyeTextures[] = { gMalonAdultEyeOpenTex, gMalonAdultEyeHalfTex, gMalonAdultEyeClosedTex }; EnMa3* this = (EnMa3*)thisx; - Camera* camera; + Camera* activeCam; f32 someFloat; s32 pad; OPEN_DISPS(globalCtx->state.gfxCtx, "../z_en_ma3.c", 978); - camera = GET_ACTIVE_CAM(globalCtx); - someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &camera->eye); + activeCam = GET_ACTIVE_CAM(globalCtx); + someFloat = Math_Vec3f_DistXZ(&this->actor.world.pos, &activeCam->eye); func_800F6268(someFloat, NA_BGM_LONLON); func_80093D18(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_En_Niw/z_en_niw.c b/src/overlays/actors/ovl_En_Niw/z_en_niw.c index faa0000e42..a011626965 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -760,7 +760,7 @@ void func_80AB6F04(EnNiw* this, GlobalContext* globalCtx) { } void func_80AB70A0(EnNiw* this, GlobalContext* globalCtx) { - OnePointCutscene_Init(globalCtx, 2290, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 2290, -99, &this->actor, CAM_ID_MAIN); this->timer5 = 100; this->unk_2A2 = 1; this->actionFunc = func_80AB70F8; diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.c b/src/overlays/actors/ovl_En_Owl/z_en_owl.c index 394496300d..262197cf2c 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.c +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.c @@ -271,7 +271,7 @@ s32 EnOwl_CheckInitTalk(EnOwl* this, GlobalContext* globalCtx, u16 textId, f32 t this->actionFlags &= ~0x40; } } - this->cameraIdx = OnePointCutscene_Init(globalCtx, 8700, timer, &this->actor, MAIN_CAM); + this->subCamId = OnePointCutscene_Init(globalCtx, 8700, timer, &this->actor, CAM_ID_MAIN); return true; } else { this->actor.textId = textId; diff --git a/src/overlays/actors/ovl_En_Owl/z_en_owl.h b/src/overlays/actors/ovl_En_Owl/z_en_owl.h index d83e52819c..4534c36385 100644 --- a/src/overlays/actors/ovl_En_Owl/z_en_owl.h +++ b/src/overlays/actors/ovl_En_Owl/z_en_owl.h @@ -30,7 +30,7 @@ typedef struct EnOwl { /* 0x03FC */ u16 actionFlags; /* 0x03FE */ u16 unk_3FE; /* 0x0400 */ s16 unk_400; - /* 0x0402 */ s16 cameraIdx; + /* 0x0402 */ s16 subCamId; /* 0x0404 */ u8 unk_404; /* 0x0405 */ u8 unk_405; /* 0x0406 */ u8 unk_406; diff --git a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c index 0ad4d81c5c..918de6d637 100644 --- a/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c +++ b/src/overlays/actors/ovl_En_Po_Sisters/z_en_po_sisters.c @@ -379,7 +379,7 @@ void func_80AD99D4(EnPoSisters* this, GlobalContext* globalCtx) { this->actor.flags &= ~ACTOR_FLAG_0; this->unk_199 = 0; this->actionFunc = func_80ADAFC0; - OnePointCutscene_Init(globalCtx, 3190, 999, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3190, 999, &this->actor, CAM_ID_MAIN); } void func_80AD9A54(EnPoSisters* this, GlobalContext* globalCtx) { @@ -460,7 +460,7 @@ void func_80AD9DF0(EnPoSisters* this, GlobalContext* globalCtx) { this->unk_198 = 1; this->unk_199 &= ~0x80; this->actionFunc = func_80ADB4B0; - OnePointCutscene_Init(globalCtx, 3180, 156, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3180, 156, &this->actor, CAM_ID_MAIN); } void func_80AD9E60(EnPoSisters* this) { @@ -1039,7 +1039,7 @@ void func_80ADBC88(EnPoSisters* this, GlobalContext* globalCtx) { } if (this->unk_19A == 30) { if (this->unk_194 == 0) { - OnePointCutscene_Init(globalCtx, 3140, 999, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3140, 999, NULL, CAM_ID_MAIN); } D_80ADD784 = 1; } diff --git a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c index ce449215ee..2274ded488 100644 --- a/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c +++ b/src/overlays/actors/ovl_En_Ru2/z_en_ru2.c @@ -633,13 +633,13 @@ s32 func_80AF383C(EnRu2* this, GlobalContext* globalCtx) { void func_80AF3878(EnRu2* this, GlobalContext* globalCtx) { if (func_80AF383C(this, globalCtx) && !Gameplay_InCsMode(globalCtx)) { this->action = 16; - OnePointCutscene_Init(globalCtx, 3130, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3130, -99, &this->actor, CAM_ID_MAIN); } } void func_80AF38D0(EnRu2* this, GlobalContext* globalCtx) { this->action = 16; - OnePointCutscene_Init(globalCtx, 3130, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 3130, -99, &this->actor, CAM_ID_MAIN); } void func_80AF390C(EnRu2* this, GlobalContext* globalCtx) { diff --git a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c index 692d771ce0..4846016b5e 100644 --- a/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c +++ b/src/overlays/actors/ovl_En_Siofuki/z_en_siofuki.c @@ -253,7 +253,7 @@ void func_80AFC478(EnSiofuki* this, GlobalContext* globalCtx) { if (Flags_GetSwitch(globalCtx, ((u16)this->dyna.actor.params >> 6) & 0x3F)) { this->timer = 20; this->actionFunc = func_80AFC3C8; - OnePointCutscene_Init(globalCtx, 5010, 40, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 5010, 40, &this->dyna.actor, CAM_ID_MAIN); } if (Flags_GetTreasure(globalCtx, (u16)this->dyna.actor.params & 0x3F)) { diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c index 3dcc9ab2d2..91599e0ed2 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.c @@ -252,8 +252,8 @@ void EnSyatekiMan_StopTalk(EnSyatekiMan* this, GlobalContext* globalCtx) { } if ((this->numTextBox == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { if (this->cameraHold) { - OnePointCutscene_EndCutscene(globalCtx, this->csCam); - this->csCam = SUBCAM_NONE; + OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + this->subCamId = CAM_ID_NONE; this->cameraHold = false; } Message_CloseTextbox(globalCtx); @@ -270,8 +270,8 @@ void EnSyatekiMan_StartGame(EnSyatekiMan* this, GlobalContext* globalCtx) { } if ((this->numTextBox == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { if (this->cameraHold) { - OnePointCutscene_EndCutscene(globalCtx, this->csCam); - this->csCam = SUBCAM_NONE; + OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + this->subCamId = CAM_ID_NONE; this->cameraHold = false; } Message_CloseTextbox(globalCtx); @@ -290,7 +290,7 @@ void EnSyatekiMan_WaitForGame(EnSyatekiMan* this, GlobalContext* globalCtx) { if (1) {} gallery = ((EnSyatekiItm*)this->actor.parent); if ((gallery->actor.update != NULL) && (gallery->signal == ENSYATEKI_END)) { - this->csCam = OnePointCutscene_Init(globalCtx, 8002, -99, &this->actor, MAIN_CAM); + this->subCamId = OnePointCutscene_Init(globalCtx, 8002, -99, &this->actor, CAM_ID_MAIN); switch (gallery->hitCount) { case 10: this->gameResult = SYATEKI_RESULT_WINNER; @@ -322,8 +322,8 @@ void EnSyatekiMan_EndGame(EnSyatekiMan* this, GlobalContext* globalCtx) { SkelAnime_Update(&this->skelAnime); if ((this->numTextBox == Message_GetState(&globalCtx->msgCtx)) && Message_ShouldAdvance(globalCtx)) { if (this->gameResult != SYATEKI_RESULT_FAILURE) { - OnePointCutscene_EndCutscene(globalCtx, this->csCam); - this->csCam = SUBCAM_NONE; + OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + this->subCamId = CAM_ID_NONE; } Message_CloseTextbox(globalCtx); gallery = ((EnSyatekiItm*)this->actor.parent); diff --git a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h index d82cdf9c75..3cb8d4f055 100644 --- a/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h +++ b/src/overlays/actors/ovl_En_Syateki_Man/z_en_syateki_man.h @@ -27,7 +27,7 @@ typedef struct EnSyatekiMan { /* 0x021C */ u8 cameraHold; /* 0x0220 */ Actor* tempGallery; /* 0x0224 */ EnSyatekiManOtherFunc blinkFunc; // Seems to be part of a blink system with unk_20C and unk_20E, but it's unused. - /* 0x0228 */ s16 csCam; + /* 0x0228 */ s16 subCamId; } EnSyatekiMan; // size = 0x022C #endif diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.c b/src/overlays/actors/ovl_En_Ta/z_en_ta.c index 29fdf5978a..a9c9756983 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.c +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.c @@ -459,7 +459,7 @@ void func_80B14AF4(EnTa* this, GlobalContext* globalCtx) { void func_80B14B6C(EnTa* this, GlobalContext* globalCtx) { if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) { - OnePointCutscene_Init(globalCtx, 4175, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4175, -99, &this->actor, CAM_ID_MAIN); func_80B13AA0(this, func_80B14AF4, func_80B167C0); this->unk_2CC = 5; SET_EVENTCHKINF(EVENTCHKINF_14); @@ -519,28 +519,28 @@ s32 func_80B14DD8(void) { } void func_80B14E28(EnTa* this, GlobalContext* globalCtx) { - Vec3f b; - Vec3f a; + Vec3f subCamEye; + Vec3f subCamAt; - this->unk_2D0 = Gameplay_CreateSubCamera(globalCtx); - this->unk_2D2 = globalCtx->activeCamera; - Gameplay_ChangeCameraStatus(globalCtx, this->unk_2D2, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_2D0, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + this->returnToCamId = globalCtx->activeCamId; + Gameplay_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); - b.x = 1053.0f; - b.y = 11.0f; - b.z = 22.0f; + subCamEye.x = 1053.0f; + subCamEye.y = 11.0f; + subCamEye.z = 22.0f; - a.x = 1053.0f; - a.y = 45.0f; - a.z = -40.0f; + subCamAt.x = 1053.0f; + subCamAt.y = 45.0f; + subCamAt.z = -40.0f; - Gameplay_CameraSetAtEye(globalCtx, this->unk_2D0, &a, &b); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); } void func_80B14EDC(EnTa* this, GlobalContext* globalCtx) { - Gameplay_ChangeCameraStatus(globalCtx, this->unk_2D2, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, this->unk_2D0); + Gameplay_ChangeCameraStatus(globalCtx, this->returnToCamId, CAM_STAT_ACTIVE); + Gameplay_ClearCamera(globalCtx, this->subCamId); } void func_80B14F20(EnTa* this, EnTaActionFunc arg1) { diff --git a/src/overlays/actors/ovl_En_Ta/z_en_ta.h b/src/overlays/actors/ovl_En_Ta/z_en_ta.h index 8429ad7abc..18e3f849d7 100644 --- a/src/overlays/actors/ovl_En_Ta/z_en_ta.h +++ b/src/overlays/actors/ovl_En_Ta/z_en_ta.h @@ -27,8 +27,8 @@ typedef struct EnTa { /* 0x02CA */ u8 unk_2CA; /* 0x02CC */ s16 unk_2CC; /* 0x02CE */ s16 unk_2CE; - /* 0x02D0 */ s16 unk_2D0; - /* 0x02D2 */ s16 unk_2D2; + /* 0x02D0 */ s16 subCamId; + /* 0x02D2 */ s16 returnToCamId; /* 0x02D4 */ Vec3s unk_2D4; /* 0x02DA */ Vec3s unk_2DA; /* 0x02E0 */ u16 unk_2E0; diff --git a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c index 56b67679c4..2f8ca16a9b 100644 --- a/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c +++ b/src/overlays/actors/ovl_En_Torch2/z_en_torch2.c @@ -201,7 +201,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { Player* player = player2; Player* this = (Player*)thisx; Input* input = &sInput; - Camera* camera; + Camera* mainCam; s16 sp66; u8 staggerThreshold; s8 stickY; @@ -215,7 +215,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { sp5A = player->actor.shape.rot.y - this->actor.shape.rot.y; input->cur.button = 0; - camera = Gameplay_GetCamera(globalCtx, 0); + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); attackItem = EnTorch2_GetAttackItem(globalCtx, this); switch (sActionState) { case ENTORCH2_WAIT: @@ -232,7 +232,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { sStickTilt = 127.0f; input->cur.button = BTN_A; sZTargetFlag = false; - sp66 = camera->camDir.y - sStickAngle; + sp66 = mainCam->camDir.y - sStickAngle; sInput.cur.stick_x = sStickTilt * Math_SinS(sp66); stickY = sStickTilt * Math_CosS(sp66); if (stickY) {} @@ -473,7 +473,7 @@ void EnTorch2_Update(Actor* thisx, GlobalContext* globalCtx2) { // Rotates Dark Link's stick angle from Link-relative to camera-relative. - sp66 = camera->camDir.y - sStickAngle; + sp66 = mainCam->camDir.y - sStickAngle; sInput.cur.stick_x = sStickTilt * Math_SinS(sp66); stickY = sStickTilt * Math_CosS(sp66); if (sAlpha) {} diff --git a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c index f2e18e7ee1..be4ffce2d6 100644 --- a/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c +++ b/src/overlays/actors/ovl_En_Wall_Tubo/z_en_wall_tubo.c @@ -71,7 +71,7 @@ void EnWallTubo_DetectChu(EnWallTubo* this, GlobalContext* globalCtx) { s16 quakeIndex; if (this->chuGirl->minigamePlayStatus != 0) { - if (globalCtx->cameraPtrs[MAIN_CAM]->setting == CAM_SET_CHU_BOWLING) { + if (globalCtx->cameraPtrs[CAM_ID_MAIN]->setting == CAM_SET_CHU_BOWLING) { chu = (EnBomChu*)globalCtx->actorCtx.actorLists[ACTORCAT_EXPLOSIVE].head; while (chu != NULL) { diff --git a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c index 2312d36aa3..004e59ba6a 100644 --- a/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c +++ b/src/overlays/actors/ovl_En_Wallmas/z_en_wallmas.c @@ -260,7 +260,7 @@ void EnWallmas_SetupTakePlayer(EnWallmas* this, GlobalContext* globalCtx) { this->yTarget = this->actor.yDistToPlayer; func_8002DF38(globalCtx, &this->actor, 0x25); - OnePointCutscene_Init(globalCtx, 9500, 9999, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 9500, 9999, &this->actor, CAM_ID_MAIN); } void EnWallmas_ProximityOrSwitchInit(EnWallmas* this) { diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c index 9905f9a38e..c1f2c94343 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.c @@ -161,25 +161,25 @@ void func_80B4B010(EnZl1* this, GlobalContext* globalCtx) { s32 pad2; s32 pad3; s32 pad; - Vec3f vec1 = { -460.0f, 118.0f, 0.0f }; - Vec3f vec2 = { -406.0f, 110.0f, 0.0f }; + Vec3f subCamAt = { -460.0f, 118.0f, 0.0f }; + Vec3f subCamEye = { -406.0f, 110.0f, 0.0f }; Vec3f playerPos = { -398.0f, 84.0f, 0.0f }; s16 rotDiff; if (Actor_ProcessTalkRequest(&this->actor, globalCtx)) { Animation_Change(&this->skelAnime, &gChildZelda1Anim_10B38, 1.0f, 0.0f, Animation_GetLastFrame(&gChildZelda1Anim_10B38), ANIMMODE_ONCE_INTERP, -10.0f); - this->unk_1E8 = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->unk_1E8, CAM_STAT_ACTIVE); - func_800C0808(globalCtx, this->unk_1E8, player, CAM_SET_FREE0); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); + func_800C0808(globalCtx, this->subCamId, player, CAM_SET_FREE0); globalCtx->envCtx.screenFillColor[0] = 255; globalCtx->envCtx.screenFillColor[1] = 255; globalCtx->envCtx.screenFillColor[2] = 255; globalCtx->envCtx.screenFillColor[3] = 24; globalCtx->envCtx.fillScreen = true; - Gameplay_CameraSetAtEye(globalCtx, this->unk_1E8, &vec1, &vec2); - Gameplay_CameraSetFov(globalCtx, this->unk_1E8, 30.0f); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + Gameplay_CameraSetFov(globalCtx, this->subCamId, 30.0f); ShrinkWindow_SetVal(0x20); Interface_ChangeAlpha(2); player->actor.world.pos = playerPos; @@ -197,8 +197,8 @@ void func_80B4B010(EnZl1* this, GlobalContext* globalCtx) { } void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { - Vec3f sp74 = { -427.0f, 108.0, 26.0 }; - Vec3f sp68 = { -340.0f, 108.0f, 98.0f }; + Vec3f subCamAt = { -427.0f, 108.0, 26.0 }; + Vec3f subCamEye = { -340.0f, 108.0f, 98.0f }; s32 pad; Vec3f sp58 = { -434.0f, 84.0f, 0.0f }; u8 sp54[] = { 0x00, 0x00, 0x02 }; @@ -232,8 +232,8 @@ void func_80B4B240(EnZl1* this, GlobalContext* globalCtx) { case 1: if ((Message_GetState(msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { globalCtx->envCtx.fillScreen = false; - Gameplay_CameraSetAtEye(globalCtx, this->unk_1E8, &sp74, &sp68); - Gameplay_CameraSetFov(globalCtx, this->unk_1E8, 25.0f); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + Gameplay_CameraSetFov(globalCtx, this->subCamId, 25.0f); player->actor.world.pos = sp58; this->actor.textId = 0x702F; Message_ContinueTextbox(globalCtx, this->actor.textId); @@ -365,8 +365,8 @@ void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx) { u8 spA4[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x02, }; - Vec3f sp98 = { -421.0f, 143.0f, -5.0f }; - Vec3f sp8C = { -512.0f, 105.0f, -4.0f }; + Vec3f subCamAt = { -421.0f, 143.0f, -5.0f }; + Vec3f subCamEye = { -512.0f, 105.0f, -4.0f }; s32 pad2; f32 actionLength; CsCmdActorAction* npcAction; @@ -411,8 +411,8 @@ void func_80B4B8B4(EnZl1* this, GlobalContext* globalCtx) { this->actor.velocity.z = (sp68.z - sp74.z) / actionLength; } func_80038290(globalCtx, &this->actor, &this->unk_200, &this->unk_206, this->actor.focus.pos); - Gameplay_CameraSetAtEye(globalCtx, this->unk_1E8, &sp98, &sp8C); - Gameplay_CameraSetFov(globalCtx, this->unk_1E8, 70.0f); + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); + Gameplay_CameraSetFov(globalCtx, this->subCamId, 70.0f); } } @@ -520,9 +520,9 @@ void func_80B4BF2C(EnZl1* this, GlobalContext* globalCtx) { } case 2: if (Actor_HasParent(&this->actor, globalCtx)) { - Gameplay_CopyCamera(globalCtx, MAIN_CAM, this->unk_1E8); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE); - Gameplay_ClearCamera(globalCtx, this->unk_1E8); + Gameplay_CopyCamera(globalCtx, CAM_ID_MAIN, this->subCamId); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); + Gameplay_ClearCamera(globalCtx, this->subCamId); this->actor.parent = NULL; this->unk_1E2++; } else { diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h index 59ca2fd9e4..a543883a12 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1.h @@ -17,7 +17,7 @@ typedef struct EnZl1 { /* 0x01E2 */ s16 unk_1E2; /* 0x01E4 */ s16 unk_1E4; /* 0x01E6 */ s16 unk_1E6; - /* 0x01E8 */ s16 unk_1E8; + /* 0x01E8 */ s16 subCamId; /* 0x01EA */ char unk_1EA[0x2]; /* 0x01EC */ void* unk_1EC; /* 0x01F0 */ char unk_1F0[0x2]; diff --git a/src/overlays/actors/ovl_En_Zl1/z_en_zl1_camera_data.c b/src/overlays/actors/ovl_En_Zl1/z_en_zl1_camera_data.c index ffdd584965..fb4776673e 100644 --- a/src/overlays/actors/ovl_En_Zl1/z_en_zl1_camera_data.c +++ b/src/overlays/actors/ovl_En_Zl1/z_en_zl1_camera_data.c @@ -1,7 +1,7 @@ #include "z_en_zl1.h" #include "z64cutscene_commands.h" -static CutsceneCameraAngle D_80B4D5C0[] = { +static CutsceneCameraDirection D_80B4D5C0[] = { { { -440.0f, 117.0f, 0.0f }, { -490.0f, 120.0f, 0.0f }, 0, 45 }, { { -484.0f, 122.0f, -29.0f }, { -480.0f, 116.0f, 18.0f }, 0, 80 }, { { -413.0f, 136.0f, -72.0f }, { -403.0f, 141.0f, -89.0f }, 0, 25 }, diff --git a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c index 5f489f27bc..cef02d2fcf 100644 --- a/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c +++ b/src/overlays/actors/ovl_En_Zl3/z_en_zl3.c @@ -1052,7 +1052,7 @@ void func_80B559C4(EnZl3* this) { } void func_80B55A58(EnZl3* this, GlobalContext* globalCtx) { - if (globalCtx->activeCamera == MAIN_CAM) { + if (globalCtx->activeCamId == CAM_ID_MAIN) { func_80B537E8(this); } } @@ -1787,7 +1787,7 @@ void func_80B5764C(EnZl3* this, GlobalContext* globalCtx) { s32 unk_314 = this->unk_314 + 1; if ((unk_314 == 1) && !Gameplay_InCsMode(globalCtx)) { - OnePointCutscene_Init(globalCtx, 1000, 40, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 1000, 40, &this->actor, CAM_ID_MAIN); } } } @@ -2039,14 +2039,14 @@ void func_80B58014(EnZl3* this, GlobalContext* globalCtx) { this->action = 29; func_80B538B0(this); } else if (func_80B57C8C(this) && func_80B57F84(this, globalCtx)) { - OnePointCutscene_Init(globalCtx, 4000, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4000, -99, &this->actor, CAM_ID_MAIN); this->unk_3D0 = 0; } else if (func_80B576C8(this, globalCtx) && func_80B575B0(this, globalCtx) && !Gameplay_InCsMode(globalCtx)) { this->action = 0x1F; this->unk_3CC = 0.0f; func_80B537E8(this); this->unk_3D8 = 1; - OnePointCutscene_Init(globalCtx, 4010, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4010, -99, &this->actor, CAM_ID_MAIN); } else if (!func_80B57C8C(this) && !func_80B576C8(this, globalCtx) && func_80B57564(this, globalCtx)) { func_80B54E14(this, &gZelda2Anime2Anim_009BE4, 0, -8.0f, 0); func_80B5764C(this, globalCtx); @@ -2118,7 +2118,7 @@ void func_80B584B4(EnZl3* this, GlobalContext* globalCtx) { if (D_80B5A4BC == 0) { if ((nearbyEnTest == NULL) && (!Gameplay_InCsMode(globalCtx))) { this->action = 33; - OnePointCutscene_Init(globalCtx, 4011, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4011, -99, &this->actor, CAM_ID_MAIN); } else if (invincibilityTimer > 0) { func_80B54E14(this, &gZelda2Anime2Anim_003FF8, 0, -12.0f, 0); D_80B5A4BC = 1; @@ -2129,7 +2129,7 @@ void func_80B584B4(EnZl3* this, GlobalContext* globalCtx) { func_80B54E14(this, &gZelda2Anime2Anim_007664, 0, -12.0f, 0); D_80B5A4BC = 0; this->action = 33; - OnePointCutscene_Init(globalCtx, 4011, -99, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 4011, -99, &this->actor, CAM_ID_MAIN); } else if (invincibilityTimer <= 0) { func_80B54E14(this, &gZelda2Anime2Anim_007664, 0, -12.0f, 0); D_80B5A4BC = 0; diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c index f49588551e..88028b5e32 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4.c @@ -178,24 +178,24 @@ static AnimationInfo sAnimationInfo[] = { #include "z_en_zl4_cutscene_data.c" -void EnZl4_SetCsCameraAngle(GlobalContext* globalCtx, s16 index) { +void EnZl4_SetActiveCamDir(GlobalContext* globalCtx, s16 index) { Camera* activeCam = GET_ACTIVE_CAM(globalCtx); Camera_ChangeSetting(activeCam, CAM_SET_FREE0); - activeCam->at = sCsCameraAngle[index].at; - activeCam->eye = activeCam->eyeNext = sCsCameraAngle[index].eye; - activeCam->roll = sCsCameraAngle[index].roll; - activeCam->fov = sCsCameraAngle[index].fov; + activeCam->at = sCamDirections[index].at; + activeCam->eye = activeCam->eyeNext = sCamDirections[index].eye; + activeCam->roll = sCamDirections[index].roll; + activeCam->fov = sCamDirections[index].fov; } -void EnZl4_SetCsCameraMove(GlobalContext* globalCtx, s16 index) { +void EnZl4_SetActiveCamMove(GlobalContext* globalCtx, s16 index) { Camera* activeCam = GET_ACTIVE_CAM(globalCtx); Player* player = GET_PLAYER(globalCtx); Camera_ChangeSetting(activeCam, CAM_SET_CS_0); Camera_ResetAnim(activeCam); - Camera_SetCSParams(activeCam, sCsCameraMove[index].atPoints, sCsCameraMove[index].eyePoints, player, - sCsCameraMove[index].relativeToPlayer); + Camera_SetCSParams(activeCam, sCamMove[index].atPoints, sCamMove[index].eyePoints, player, + sCamMove[index].relativeToPlayer); } u16 EnZl4_GetText(GlobalContext* globalCtx, Actor* thisx) { @@ -328,7 +328,7 @@ s32 EnZl4_SetupFromLegendCs(EnZl4* this, GlobalContext* globalCtx) { player->linearVelocity = playerx->speedXZ = 0.0f; - EnZl4_SetCsCameraMove(globalCtx, 5); + EnZl4_SetActiveCamMove(globalCtx, 5); ShrinkWindow_SetVal(0x20); Interface_ChangeAlpha(2); this->talkTimer2 = 0; @@ -457,7 +457,7 @@ s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { break; case 1: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 1); + EnZl4_SetActiveCamDir(globalCtx, 1); Message_StartTextbox(globalCtx, 0x702F, NULL); this->talkTimer2 = 0; this->talkState++; @@ -467,7 +467,7 @@ s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardMeetCs); gSaveContext.cutsceneTrigger = 1; - EnZl4_SetCsCameraMove(globalCtx, 0); + EnZl4_SetActiveCamMove(globalCtx, 0); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState++; @@ -482,7 +482,7 @@ s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { break; case 4: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraMove(globalCtx, 1); + EnZl4_SetActiveCamMove(globalCtx, 1); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState++; @@ -497,7 +497,7 @@ s32 EnZl4_CsMeetPlayer(EnZl4* this, GlobalContext* globalCtx) { break; case 6: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 2); + EnZl4_SetActiveCamDir(globalCtx, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_22); this->mouthExpression = ZL4_MOUTH_NEUTRAL; this->talkTimer2 = 0; @@ -517,7 +517,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { } case 1: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 3); + EnZl4_SetActiveCamDir(globalCtx, 3); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer1 = 40; this->talkState = 2; @@ -533,7 +533,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { break; } else if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetCsCameraAngle(globalCtx, 4); + EnZl4_SetActiveCamDir(globalCtx, 4); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_28); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_SQUINT; @@ -541,7 +541,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x7032, NULL); this->talkState = 7; } else { - EnZl4_SetCsCameraAngle(globalCtx, 2); + EnZl4_SetActiveCamDir(globalCtx, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_9); this->mouthExpression = ZL4_MOUTH_WORRIED; Message_StartTextbox(globalCtx, 0x7031, NULL); @@ -566,7 +566,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { break; case 6: this->mouthExpression = ZL4_MOUTH_NEUTRAL; - EnZl4_SetCsCameraAngle(globalCtx, 3); + EnZl4_SetActiveCamDir(globalCtx, 3); Message_StartTextbox(globalCtx, 0x7030, NULL); this->talkState = 12; break; @@ -578,7 +578,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { break; } else if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetCsCameraAngle(globalCtx, 4); + EnZl4_SetActiveCamDir(globalCtx, 4); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_28); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_SQUINT; @@ -586,7 +586,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { Message_StartTextbox(globalCtx, 0x7032, NULL); this->talkState = 7; } else { - EnZl4_SetCsCameraAngle(globalCtx, 2); + EnZl4_SetActiveCamDir(globalCtx, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_9); this->mouthExpression = ZL4_MOUTH_WORRIED; Message_StartTextbox(globalCtx, 0x7031, NULL); @@ -602,7 +602,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { } case 8: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraMove(globalCtx, 2); + EnZl4_SetActiveCamMove(globalCtx, 2); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; @@ -613,7 +613,7 @@ s32 EnZl4_CsAskStone(EnZl4* this, GlobalContext* globalCtx) { break; case 9: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 5); + EnZl4_SetActiveCamDir(globalCtx, 5); Message_StartTextbox(globalCtx, 0x70FD, NULL); this->talkState++; } @@ -640,7 +640,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { break; case 1: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 6); + EnZl4_SetActiveCamDir(globalCtx, 6); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_1); this->blinkTimer = 11; this->eyeExpression = ZL4_EYES_SQUINT; @@ -671,7 +671,7 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { break; case 5: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraMove(globalCtx, 3); + EnZl4_SetActiveCamMove(globalCtx, 3); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_0); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; @@ -706,14 +706,14 @@ s32 EnZl4_CsAskName(EnZl4* this, GlobalContext* globalCtx) { case 10: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx)) { if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetCsCameraMove(globalCtx, 4); + EnZl4_SetActiveCamMove(globalCtx, 4); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_33); this->mouthExpression = ZL4_MOUTH_NEUTRAL; globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState = 15; } else { - EnZl4_SetCsCameraAngle(globalCtx, 6); + EnZl4_SetActiveCamDir(globalCtx, 6); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer1 = 20; this->talkState++; @@ -796,14 +796,14 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { break; case 1: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 7); + EnZl4_SetActiveCamDir(globalCtx, 7); Message_StartTextbox(globalCtx, 0x2076, NULL); this->talkState++; } break; case 2: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraMove(globalCtx, 6); + EnZl4_SetActiveCamMove(globalCtx, 6); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->talkState++; } @@ -818,7 +818,7 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) && Message_ShouldAdvance(globalCtx))) { break; } else if (globalCtx->msgCtx.choiceIndex == 0) { - EnZl4_SetCsCameraAngle(globalCtx, 8); + EnZl4_SetActiveCamDir(globalCtx, 8); Message_StartTextbox(globalCtx, 0x7005, NULL); this->talkState = 9; } else { @@ -888,7 +888,7 @@ s32 EnZl4_CsTellLegend(EnZl4* this, GlobalContext* globalCtx) { s32 EnZl4_CsLookWindow(EnZl4* this, GlobalContext* globalCtx) { switch (this->talkState) { case 0: - EnZl4_SetCsCameraMove(globalCtx, 7); + EnZl4_SetActiveCamMove(globalCtx, 7); globalCtx->csCtx.segment = SEGMENTED_TO_VIRTUAL(gZeldasCourtyardWindowCs); gSaveContext.cutsceneTrigger = 1; this->talkState++; @@ -914,7 +914,7 @@ s32 EnZl4_CsLookWindow(EnZl4* this, GlobalContext* globalCtx) { func_800AA000(0.0f, 0xA0, 0xA, 0x28); func_8002DF54(globalCtx, &this->actor, 1); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_30); - EnZl4_SetCsCameraAngle(globalCtx, 11); + EnZl4_SetActiveCamDir(globalCtx, 11); Message_StartTextbox(globalCtx, 0x7039, NULL); this->talkState++; } @@ -939,7 +939,7 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { rotY = this->actor.shape.rot.y - 0x3FFC; player->actor.world.pos.x += 34.0f * Math_SinS(rotY); player->actor.world.pos.z += 34.0f * Math_CosS(rotY); - EnZl4_SetCsCameraMove(globalCtx, 8); + EnZl4_SetActiveCamMove(globalCtx, 8); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_WIDE; this->mouthExpression = ZL4_MOUTH_WORRIED; @@ -954,7 +954,7 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { break; case 2: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraMove(globalCtx, 9); + EnZl4_SetActiveCamMove(globalCtx, 9); globalCtx->msgCtx.msgMode = MSGMODE_PAUSED; this->talkTimer2 = 0; this->talkState++; @@ -969,7 +969,7 @@ s32 EnZl4_CsWarnAboutGanon(EnZl4* this, GlobalContext* globalCtx) { break; case 4: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 12); + EnZl4_SetActiveCamDir(globalCtx, 12); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_23); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; @@ -1052,7 +1052,7 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_WORRIED; - EnZl4_SetCsCameraMove(globalCtx, 10); + EnZl4_SetActiveCamMove(globalCtx, 10); this->talkTimer2 = 0; this->talkState++; case 1: @@ -1064,7 +1064,7 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { break; case 2: if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx)) { - EnZl4_SetCsCameraAngle(globalCtx, 13); + EnZl4_SetActiveCamDir(globalCtx, 13); Animation_ChangeByInfo(&this->skelAnime, sAnimationInfo, ZL4_ANIM_19); this->blinkTimer = 0; this->eyeExpression = ZL4_EYES_NEUTRAL; @@ -1096,7 +1096,7 @@ s32 EnZl4_CsMakePlan(EnZl4* this, GlobalContext* globalCtx) { if (!((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_EVENT) && Message_ShouldAdvance(globalCtx))) { break; } else { - Camera_ChangeSetting(GET_ACTIVE_CAM(globalCtx), 1); + Camera_ChangeSetting(GET_ACTIVE_CAM(globalCtx), CAM_SET_NORMAL0); this->talkState = 7; globalCtx->talkWithPlayer(globalCtx, &this->actor); func_8002F434(&this->actor, globalCtx, GI_LETTER_ZELDA, fabsf(this->actor.xzDistToPlayer) + 1.0f, @@ -1134,7 +1134,7 @@ void EnZl4_Cutscene(EnZl4* this, GlobalContext* globalCtx) { this->eyeExpression = ZL4_EYES_NEUTRAL; this->mouthExpression = ZL4_MOUTH_SURPRISED; Audio_PlayFanfare(NA_BGM_APPEAR); - EnZl4_SetCsCameraAngle(globalCtx, 0); + EnZl4_SetActiveCamDir(globalCtx, 0); Interface_ChangeAlpha(2); ShrinkWindow_SetVal(0x20); this->talkState = 0; diff --git a/src/overlays/actors/ovl_En_Zl4/z_en_zl4_cutscene_data.c b/src/overlays/actors/ovl_En_Zl4/z_en_zl4_cutscene_data.c index 63b8092d3c..3ad3b996be 100644 --- a/src/overlays/actors/ovl_En_Zl4/z_en_zl4_cutscene_data.c +++ b/src/overlays/actors/ovl_En_Zl4/z_en_zl4_cutscene_data.c @@ -1,6 +1,6 @@ #include "z_en_zl4.h" -static CutsceneCameraAngle sCsCameraAngle[] = { +static CutsceneCameraDirection sCamDirections[] = { { { -490.0f, 120.0f, 0.0f }, { -440.0f, 117.0f, 0.0f }, 0, 45 }, { { -484.0f, 122.0f, -29.0f }, { -480.0f, 116.0f, 18.0f }, 0, 80 }, { { -413.0f, 136.0f, -72.0f }, { -403.0f, 141.0f, -89.0f }, 0, 25 }, @@ -178,7 +178,7 @@ static CutsceneCameraPoint D_80B5FA10[] = { { -1, 0, 0, 20.799965f, { -549, 124, 29 } }, { -1, 0, 0, 20.799965f, { -549, 124, 29 } }, }; -static CutsceneCameraMove sCsCameraMove[] = { +static CutsceneCameraMove sCamMove[] = { { D_80B5EC70, D_80B5ECF0, 0 }, { D_80B5ED70, D_80B5EE10, 0 }, { D_80B5EEB0, D_80B5EF90, 0 }, { D_80B5F070, D_80B5F100, 0 }, { D_80B5F190, D_80B5F280, 0 }, { D_80B5F370, D_80B5F450, 0 }, { D_80B5F530, D_80B5F5D0, 0 }, { D_80B5F670, D_80B5F700, 0 }, { D_80B5F790, D_80B5F810, 0 }, diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c index e66ba56a66..baea6e6b5c 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.c +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.c @@ -152,9 +152,9 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { } func_80064520(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 8); - this->cutsceneCamera = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, this->cutsceneCamera, CAM_STAT_ACTIVE); + this->subCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, this->subCamId, CAM_STAT_ACTIVE); this->cutsceneState = INTRO_FENCE; this->timers[0] = 60; this->actor.world.pos.y = GND_BOSSROOM_CENTER_Y - 7.0f; @@ -167,12 +167,12 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { player->actor.world.pos.z = GND_BOSSROOM_CENTER_Z + 155.0f; player->actor.world.rot.y = player->actor.shape.rot.y = 0; player->actor.speedXZ = 0.0f; - this->cameraEye.x = GND_BOSSROOM_CENTER_X + 0.0f; - this->cameraEye.y = GND_BOSSROOM_CENTER_Y + 37.0f; - this->cameraEye.z = GND_BOSSROOM_CENTER_Z + 170.0f; - this->cameraAt.x = GND_BOSSROOM_CENTER_X + 0.0f; - this->cameraAt.y = GND_BOSSROOM_CENTER_Y + 47.0f; - this->cameraAt.z = GND_BOSSROOM_CENTER_Z + 315.0f; + this->subCamEye.x = GND_BOSSROOM_CENTER_X + 0.0f; + this->subCamEye.y = GND_BOSSROOM_CENTER_Y + 37.0f; + this->subCamEye.z = GND_BOSSROOM_CENTER_Z + 170.0f; + this->subCamAt.x = GND_BOSSROOM_CENTER_X + 0.0f; + this->subCamAt.y = GND_BOSSROOM_CENTER_Y + 47.0f; + this->subCamAt.z = GND_BOSSROOM_CENTER_Z + 315.0f; if (this->timers[0] == 25) { Actor_SpawnAsChild(&globalCtx->actorCtx, &this->actor, globalCtx, ACTOR_DOOR_SHUTTER, GND_BOSSROOM_CENTER_X + 0.0f, GND_BOSSROOM_CENTER_Y - 97.0f, @@ -196,65 +196,65 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { if (this->timers[0] == 1) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_OPENING_GANON); } - Math_ApproachF(&this->cameraEye.x, GND_BOSSROOM_CENTER_X + 40.0f, 0.05f, this->cameraSpeedMod * 20.0f); - Math_ApproachF(&this->cameraEye.y, GND_BOSSROOM_CENTER_Y + 37.0f, 0.05f, this->cameraSpeedMod * 20.0f); - Math_ApproachF(&this->cameraEye.z, GND_BOSSROOM_CENTER_Z + 80.0f, 0.05f, this->cameraSpeedMod * 20.0f); - Math_ApproachF(&this->cameraAt.x, GND_BOSSROOM_CENTER_X - 100.0f, 0.05f, this->cameraSpeedMod * 20.0f); - Math_ApproachF(&this->cameraAt.y, GND_BOSSROOM_CENTER_Y + 47.0f, 0.05f, this->cameraSpeedMod * 20.0f); - Math_ApproachF(&this->cameraAt.z, GND_BOSSROOM_CENTER_Z + 335.0f, 0.05f, this->cameraSpeedMod * 20.0f); - Math_ApproachF(&this->cameraSpeedMod, 1.0f, 1.0f, 0.01f); + Math_ApproachF(&this->subCamEye.x, GND_BOSSROOM_CENTER_X + 40.0f, 0.05f, this->subCamVelFactor * 20.0f); + Math_ApproachF(&this->subCamEye.y, GND_BOSSROOM_CENTER_Y + 37.0f, 0.05f, this->subCamVelFactor * 20.0f); + Math_ApproachF(&this->subCamEye.z, GND_BOSSROOM_CENTER_Z + 80.0f, 0.05f, this->subCamVelFactor * 20.0f); + Math_ApproachF(&this->subCamAt.x, GND_BOSSROOM_CENTER_X - 100.0f, 0.05f, this->subCamVelFactor * 20.0f); + Math_ApproachF(&this->subCamAt.y, GND_BOSSROOM_CENTER_Y + 47.0f, 0.05f, this->subCamVelFactor * 20.0f); + Math_ApproachF(&this->subCamAt.z, GND_BOSSROOM_CENTER_Z + 335.0f, 0.05f, this->subCamVelFactor * 20.0f); + Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, 0.01f); if (this->timers[0] == 0) { this->cutsceneState = INTRO_REVEAL; this->timers[0] = 50; - this->cameraSpeedMod = 0.0f; + this->subCamVelFactor = 0.0f; } break; case INTRO_REVEAL: - Math_ApproachF(&this->cameraEye.x, GND_BOSSROOM_CENTER_X + 70.0f, 0.1f, this->cameraSpeedMod * 20.0f); - Math_ApproachF(&this->cameraEye.y, GND_BOSSROOM_CENTER_Y + 7.0f, 0.1f, this->cameraSpeedMod * 20.0f); - Math_ApproachF(&this->cameraEye.z, GND_BOSSROOM_CENTER_Z + 200.0f, 0.1f, this->cameraSpeedMod * 20.0f); - Math_ApproachF(&this->cameraAt.x, GND_BOSSROOM_CENTER_X - 150.0f, 0.1f, this->cameraSpeedMod * 20.0f); - Math_ApproachF(&this->cameraAt.y, GND_BOSSROOM_CENTER_Y + 107.0f, 0.1f, this->cameraSpeedMod * 20.0f); - Math_ApproachF(&this->cameraAt.z, GND_BOSSROOM_CENTER_Z - 65.0f, 0.1f, this->cameraSpeedMod * 40.0f); - Math_ApproachF(&this->cameraSpeedMod, 1.0f, 1.0f, 0.05f); + Math_ApproachF(&this->subCamEye.x, GND_BOSSROOM_CENTER_X + 70.0f, 0.1f, this->subCamVelFactor * 20.0f); + Math_ApproachF(&this->subCamEye.y, GND_BOSSROOM_CENTER_Y + 7.0f, 0.1f, this->subCamVelFactor * 20.0f); + Math_ApproachF(&this->subCamEye.z, GND_BOSSROOM_CENTER_Z + 200.0f, 0.1f, this->subCamVelFactor * 20.0f); + Math_ApproachF(&this->subCamAt.x, GND_BOSSROOM_CENTER_X - 150.0f, 0.1f, this->subCamVelFactor * 20.0f); + Math_ApproachF(&this->subCamAt.y, GND_BOSSROOM_CENTER_Y + 107.0f, 0.1f, this->subCamVelFactor * 20.0f); + Math_ApproachF(&this->subCamAt.z, GND_BOSSROOM_CENTER_Z - 65.0f, 0.1f, this->subCamVelFactor * 40.0f); + Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, 0.05f); if (this->timers[0] == 5) { Audio_PlayActorSound2(&this->actor, NA_SE_EV_HORSE_SANDDUST); } if (this->timers[0] == 0) { this->cutsceneState = INTRO_CUT; this->timers[0] = 50; - this->cameraSpeedMod = 0.0f; + this->subCamVelFactor = 0.0f; } break; case INTRO_CUT: this->cutsceneState = INTRO_LAUGH; - this->cameraEye.x = GND_BOSSROOM_CENTER_X + 50.0f; - this->cameraEye.y = GND_BOSSROOM_CENTER_Y + 17.0f; - this->cameraEye.z = GND_BOSSROOM_CENTER_Z + 110.0f; - this->cameraAt.x = GND_BOSSROOM_CENTER_X - 150.0f; - this->cameraAt.y = GND_BOSSROOM_CENTER_Y + 207.0f; - this->cameraAt.z = GND_BOSSROOM_CENTER_Z - 155.0f; - this->cameraEyeVel.x = fabsf(this->cameraEye.x - (GND_BOSSROOM_CENTER_X + 20.0f)); - this->cameraEyeVel.y = fabsf(this->cameraEye.y - (GND_BOSSROOM_CENTER_Y + 102.0f)); - this->cameraEyeVel.z = fabsf(this->cameraEye.z - (GND_BOSSROOM_CENTER_Z + 25.0f)); - this->cameraAtVel.x = fabsf(this->cameraAt.x - (GND_BOSSROOM_CENTER_X - 150.0f)); - this->cameraAtVel.y = fabsf(this->cameraAt.y - (GND_BOSSROOM_CENTER_Y + 197.0f)); - this->cameraAtVel.z = fabsf(this->cameraAt.z - (GND_BOSSROOM_CENTER_Z - 65.0f)); + this->subCamEye.x = GND_BOSSROOM_CENTER_X + 50.0f; + this->subCamEye.y = GND_BOSSROOM_CENTER_Y + 17.0f; + this->subCamEye.z = GND_BOSSROOM_CENTER_Z + 110.0f; + this->subCamAt.x = GND_BOSSROOM_CENTER_X - 150.0f; + this->subCamAt.y = GND_BOSSROOM_CENTER_Y + 207.0f; + this->subCamAt.z = GND_BOSSROOM_CENTER_Z - 155.0f; + this->subCamEyeVel.x = fabsf(this->subCamEye.x - (GND_BOSSROOM_CENTER_X + 20.0f)); + this->subCamEyeVel.y = fabsf(this->subCamEye.y - (GND_BOSSROOM_CENTER_Y + 102.0f)); + this->subCamEyeVel.z = fabsf(this->subCamEye.z - (GND_BOSSROOM_CENTER_Z + 25.0f)); + this->subCamAtVel.x = fabsf(this->subCamAt.x - (GND_BOSSROOM_CENTER_X - 150.0f)); + this->subCamAtVel.y = fabsf(this->subCamAt.y - (GND_BOSSROOM_CENTER_Y + 197.0f)); + this->subCamAtVel.z = fabsf(this->subCamAt.z - (GND_BOSSROOM_CENTER_Z - 65.0f)); this->timers[0] = 250; case INTRO_LAUGH: - Math_ApproachF(&this->cameraEye.x, GND_BOSSROOM_CENTER_X + 20.0f, 0.05f, - this->cameraSpeedMod * this->cameraEyeVel.x); - Math_ApproachF(&this->cameraEye.y, GND_BOSSROOM_CENTER_Y + 102.0f, 0.05f, - this->cameraSpeedMod * this->cameraEyeVel.y); - Math_ApproachF(&this->cameraEye.z, GND_BOSSROOM_CENTER_Z + 25.0f, 0.05f, - this->cameraSpeedMod * this->cameraEyeVel.z); - Math_ApproachF(&this->cameraAt.x, GND_BOSSROOM_CENTER_X - 150.0f, 0.05f, - this->cameraSpeedMod * this->cameraAtVel.x); - Math_ApproachF(&this->cameraAt.y, GND_BOSSROOM_CENTER_Y + 197.0f, 0.05f, - this->cameraSpeedMod * this->cameraAtVel.y); - Math_ApproachF(&this->cameraAt.z, GND_BOSSROOM_CENTER_Z - 65.0f, 0.05f, - this->cameraSpeedMod * this->cameraAtVel.z); - Math_ApproachF(&this->cameraSpeedMod, 0.01f, 1.0f, 0.001f); + Math_ApproachF(&this->subCamEye.x, GND_BOSSROOM_CENTER_X + 20.0f, 0.05f, + this->subCamVelFactor * this->subCamEyeVel.x); + Math_ApproachF(&this->subCamEye.y, GND_BOSSROOM_CENTER_Y + 102.0f, 0.05f, + this->subCamVelFactor * this->subCamEyeVel.y); + Math_ApproachF(&this->subCamEye.z, GND_BOSSROOM_CENTER_Z + 25.0f, 0.05f, + this->subCamVelFactor * this->subCamEyeVel.z); + Math_ApproachF(&this->subCamAt.x, GND_BOSSROOM_CENTER_X - 150.0f, 0.05f, + this->subCamVelFactor * this->subCamAtVel.x); + Math_ApproachF(&this->subCamAt.y, GND_BOSSROOM_CENTER_Y + 197.0f, 0.05f, + this->subCamVelFactor * this->subCamAtVel.y); + Math_ApproachF(&this->subCamAt.z, GND_BOSSROOM_CENTER_Z - 65.0f, 0.05f, + this->subCamVelFactor * this->subCamAtVel.z); + Math_ApproachF(&this->subCamVelFactor, 0.01f, 1.0f, 0.001f); if ((this->timers[0] == 245) || (this->timers[0] == 3)) { Animation_MorphToPlayOnce(&this->skin.skelAnime, &gPhantomHorseRearingAnim, -8.0f); this->bossGndSignal = FHG_REAR; @@ -298,16 +298,16 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { Audio_QueueSeqCmd(SEQ_PLAYER_BGM_MAIN << 24 | NA_BGM_BOSS); } if (this->timers[0] == 2) { - this->cameraSpeedMod = 0.0f; + this->subCamVelFactor = 0.0f; this->cutsceneState = INTRO_TITLE; - this->cameraEyeVel.x = fabsf(this->cameraEye.x - (GND_BOSSROOM_CENTER_X + 180.0f)); - this->cameraEyeVel.y = fabsf(this->cameraEye.y - (GND_BOSSROOM_CENTER_Y + 7.0f)); - this->cameraEyeVel.z = fabsf(this->cameraEye.z - (GND_BOSSROOM_CENTER_Z + 140.0f)); + this->subCamEyeVel.x = fabsf(this->subCamEye.x - (GND_BOSSROOM_CENTER_X + 180.0f)); + this->subCamEyeVel.y = fabsf(this->subCamEye.y - (GND_BOSSROOM_CENTER_Y + 7.0f)); + this->subCamEyeVel.z = fabsf(this->subCamEye.z - (GND_BOSSROOM_CENTER_Z + 140.0f)); this->timers[0] = 100; this->timers[1] = 34; - this->cameraAtVel.x = fabsf(this->cameraAt.x - this->actor.world.pos.x); - this->cameraAtVel.y = fabsf(this->cameraAt.y - ((this->actor.world.pos.y + 70.0f) - 20.0f)); - this->cameraAtVel.z = fabsf(this->cameraAt.z - this->actor.world.pos.z); + this->subCamAtVel.x = fabsf(this->subCamAt.x - this->actor.world.pos.x); + this->subCamAtVel.y = fabsf(this->subCamAt.y - ((this->actor.world.pos.y + 70.0f) - 20.0f)); + this->subCamAtVel.z = fabsf(this->subCamAt.z - this->actor.world.pos.z); } break; case INTRO_TITLE: @@ -315,20 +315,20 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { Animation_Change(&this->skin.skelAnime, &gPhantomHorseIdleAnim, 0.5f, 0.0f, Animation_GetLastFrame(&gPhantomHorseIdleAnim), ANIMMODE_LOOP_INTERP, -3.0f); } - Math_ApproachF(&this->cameraEye.x, GND_BOSSROOM_CENTER_X + 180.0f, 0.1f, - this->cameraSpeedMod * this->cameraEyeVel.x); - Math_ApproachF(&this->cameraEye.y, GND_BOSSROOM_CENTER_Y + 7.0f, 0.1f, - this->cameraSpeedMod * this->cameraEyeVel.y); - Math_ApproachF(&this->cameraEye.z, this->cameraPanZ + (GND_BOSSROOM_CENTER_Z + 140.0f), 0.1f, - this->cameraSpeedMod * this->cameraEyeVel.z); - Math_ApproachF(&this->cameraPanZ, -100.0f, 0.1f, 1.0f); - Math_ApproachF(&this->cameraAt.x, this->actor.world.pos.x, 0.1f, this->cameraSpeedMod * 10.0f); - Math_ApproachF(&this->cameraAt.y, (this->actor.world.pos.y + 70.0f) - 20.0f, 0.1f, - this->cameraSpeedMod * 10.0f); - Math_ApproachF(&this->cameraAt.z, this->actor.world.pos.z, 0.1f, this->cameraSpeedMod * 10.0f); + Math_ApproachF(&this->subCamEye.x, GND_BOSSROOM_CENTER_X + 180.0f, 0.1f, + this->subCamVelFactor * this->subCamEyeVel.x); + Math_ApproachF(&this->subCamEye.y, GND_BOSSROOM_CENTER_Y + 7.0f, 0.1f, + this->subCamVelFactor * this->subCamEyeVel.y); + Math_ApproachF(&this->subCamEye.z, this->subCamPanZ + (GND_BOSSROOM_CENTER_Z + 140.0f), 0.1f, + this->subCamVelFactor * this->subCamEyeVel.z); + Math_ApproachF(&this->subCamPanZ, -100.0f, 0.1f, 1.0f); + Math_ApproachF(&this->subCamAt.x, this->actor.world.pos.x, 0.1f, this->subCamVelFactor * 10.0f); + Math_ApproachF(&this->subCamAt.y, (this->actor.world.pos.y + 70.0f) - 20.0f, 0.1f, + this->subCamVelFactor * 10.0f); + Math_ApproachF(&this->subCamAt.z, this->actor.world.pos.z, 0.1f, this->subCamVelFactor * 10.0f); Math_ApproachF(&this->actor.world.pos.y, 60.0f, 0.1f, 2.0f); this->actor.world.pos.y += 2.0f * Math_SinS(this->gallopTimer * 0x5DC); - Math_ApproachF(&this->cameraSpeedMod, 1.0f, 1.0f, 0.05f); + Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, 0.05f); if (this->timers[0] == 75) { TitleCard_InitBossName(globalCtx, &globalCtx->actorCtx.titleCtx, SEGMENTED_TO_VIRTUAL(gPhantomGanonTitleCardTex), 160, 180, 128, 40); @@ -337,7 +337,7 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { this->cutsceneState = INTRO_RETREAT; this->timers[0] = 200; this->timers[1] = 23; - this->cameraSpeedMod = 0.0f; + this->subCamVelFactor = 0.0f; Animation_Change(&this->skin.skelAnime, &gPhantomHorseLeapAnim, 1.0f, 0.0f, Animation_GetLastFrame(&gPhantomHorseLeapAnim), ANIMMODE_ONCE_INTERP, -4.0f); this->bossGndSignal = FHG_SPUR; @@ -355,12 +355,12 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { func_8002DF54(globalCtx, &this->actor, 8); Audio_PlayActorSound2(&this->actor, NA_SE_EN_FANTOM_MASIC2); } - Math_ApproachF(&this->cameraEye.z, this->cameraPanZ + (GND_BOSSROOM_CENTER_Z + 100.0f), 0.1f, - this->cameraSpeedMod * 1.5f); - Math_ApproachF(&this->cameraPanZ, -100.0f, 0.1f, 1.0f); + Math_ApproachF(&this->subCamEye.z, this->subCamPanZ + (GND_BOSSROOM_CENTER_Z + 100.0f), 0.1f, + this->subCamVelFactor * 1.5f); + Math_ApproachF(&this->subCamPanZ, -100.0f, 0.1f, 1.0f); Math_ApproachF(&this->actor.world.pos.z, GND_BOSSROOM_CENTER_Z + 400.0f - 0.5f, 1.0f, - this->cameraSpeedMod * 10.0f); - Math_ApproachF(&this->cameraSpeedMod, 1.0f, 1.0f, 0.05f); + this->subCamVelFactor * 10.0f); + Math_ApproachF(&this->subCamVelFactor, 1.0f, 1.0f, 0.05f); if ((fabsf(this->actor.world.pos.z - (GND_BOSSROOM_CENTER_Z + 400.0f - 0.5f)) < 300.0f) && !this->spawnedWarp) { this->spawnedWarp = true; @@ -370,8 +370,8 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { FHGFIRE_WARP_RETREAT); this->fhgFireKillWarp = true; } - Math_ApproachF(&this->cameraAt.x, this->actor.world.pos.x, 0.2f, 50.0f); - Math_ApproachF(&this->cameraAt.z, this->actor.world.pos.z, 0.2f, 50.0f); + Math_ApproachF(&this->subCamAt.x, this->actor.world.pos.x, 0.2f, 50.0f); + Math_ApproachF(&this->subCamAt.z, this->actor.world.pos.z, 0.2f, 50.0f); osSyncPrintf("TIME %d-------------------------------------------------\n", this->timers[0]); if (fabsf(this->actor.world.pos.z - (GND_BOSSROOM_CENTER_Z + 400.0f - 0.5f)) < 1.0f) { globalCtx->envCtx.unk_BF = 0; @@ -385,27 +385,27 @@ void EnfHG_Intro(EnfHG* this, GlobalContext* globalCtx) { break; case INTRO_FINISH: EnfHG_Retreat(this, globalCtx); - Math_ApproachF(&this->cameraEye.z, this->cameraPanZ + (GND_BOSSROOM_CENTER_Z + 100.0f), 0.1f, - this->cameraSpeedMod * 1.5f); - Math_ApproachF(&this->cameraPanZ, -100.0f, 0.1f, 1.0f); - Math_ApproachF(&this->cameraAt.y, (this->actor.world.pos.y + 70.0f) - 20.0f, 0.1f, - this->cameraSpeedMod * 10.0f); + Math_ApproachF(&this->subCamEye.z, this->subCamPanZ + (GND_BOSSROOM_CENTER_Z + 100.0f), 0.1f, + this->subCamVelFactor * 1.5f); + Math_ApproachF(&this->subCamPanZ, -100.0f, 0.1f, 1.0f); + Math_ApproachF(&this->subCamAt.y, (this->actor.world.pos.y + 70.0f) - 20.0f, 0.1f, + this->subCamVelFactor * 10.0f); if (this->timers[1] == 0) { - Camera* camera = Gameplay_GetCamera(globalCtx, 0); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); - camera->eye = this->cameraEye; - camera->eyeNext = this->cameraEye; - camera->at = this->cameraAt; - func_800C08AC(globalCtx, this->cutsceneCamera, 0); - this->cutsceneCamera = 0; + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_800C08AC(globalCtx, this->subCamId, 0); + this->subCamId = SUB_CAM_ID_DONE; func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); this->actionFunc = EnfHG_Retreat; } break; } - if (this->cutsceneCamera != 0) { - Gameplay_CameraSetAtEye(globalCtx, this->cutsceneCamera, &this->cameraAt, &this->cameraEye); + if (this->subCamId != SUB_CAM_ID_DONE) { + Gameplay_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } } diff --git a/src/overlays/actors/ovl_En_fHG/z_en_fhg.h b/src/overlays/actors/ovl_En_fHG/z_en_fhg.h index befbbc49d5..40585eccf7 100644 --- a/src/overlays/actors/ovl_En_fHG/z_en_fhg.h +++ b/src/overlays/actors/ovl_En_fHG/z_en_fhg.h @@ -26,18 +26,18 @@ typedef struct EnfHG { /* 0x014D */ u8 bossGndInPainting; /* 0x014E */ u8 killActor; /* 0x014F */ u8 fhgFireKillWarp; - /* 0x0150 */ Vec3f cameraEye; - /* 0x015C */ Vec3f cameraAt; - /* 0x0168 */ Vec3f cameraEyeVel; - /* 0x0174 */ Vec3f cameraAtVel; + /* 0x0150 */ Vec3f subCamEye; + /* 0x015C */ Vec3f subCamAt; + /* 0x0168 */ Vec3f subCamEyeVel; + /* 0x0174 */ Vec3f subCamAtVel; /* 0x0180 */ Vec3f hoofSfxPos; /* 0x018C */ Vec3f inPaintingPos; /* 0x0198 */ f32 inPaintingVelX; /* 0x019C */ f32 inPaintingVelZ; /* 0x0198 */ f32 damageSpeedMod; /* 0x01A4 */ f32 approachRate; - /* 0x01A8 */ f32 cameraSpeedMod; - /* 0x01AC */ f32 cameraPanZ; + /* 0x01A8 */ f32 subCamVelFactor; + /* 0x01AC */ f32 subCamPanZ; /* 0x01B0 */ char unk_1B0[0x10]; /* 0x01C0 */ s16 gallopTimer; /* 0x01C2 */ s16 curPainting; @@ -45,7 +45,7 @@ typedef struct EnfHG { /* 0x01C6 */ s16 turnTarget; /* 0x01C8 */ s16 spawnedWarp; /* 0x01CA */ s16 cutsceneState; - /* 0x01CC */ s16 cutsceneCamera; + /* 0x01CC */ s16 subCamId; /* 0x01CE */ char unk_1CE[6]; /* 0x01D4 */ s16 timers[5]; /* 0x01DE */ s16 hitTimer; diff --git a/src/overlays/actors/ovl_Fishing/z_fishing.c b/src/overlays/actors/ovl_Fishing/z_fishing.c index 641ac91a46..337c554224 100644 --- a/src/overlays/actors/ovl_Fishing/z_fishing.c +++ b/src/overlays/actors/ovl_Fishing/z_fishing.c @@ -393,11 +393,11 @@ static u8 D_80B7FDA8; static Vec3f sSinkingLurePos[SINKING_LURE_SEG_COUNT]; static s16 D_80B7FEA0; static f32 sProjectedW; -static Vec3f sCameraEye; -static Vec3f sCameraAt; -static s16 sCameraId; +static Vec3f sSubCamEye; +static Vec3f sSubCamAt; +static s16 sSubCamId; static f32 D_80B7FEC8; -static f32 D_80B7FECC; +static f32 sSubCamVelFactor; static f32 D_80B7FED0; static Vec3f sSinkingLureBasePos; static f32 D_80B7FEE4; @@ -2914,7 +2914,8 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { sp118 = (player->actor.speedXZ * 0.3f) + 0.25f; } - if ((D_80B7E0B0 != 0) || (sCameraId != 0) || ((player->actor.world.pos.z > 1150.0f) && (this->unk_158 != 100))) { + if ((D_80B7E0B0 != 0) || (sSubCamId != SUB_CAM_ID_DONE) || + ((player->actor.world.pos.z > 1150.0f) && (this->unk_158 != 100))) { this->actor.flags &= ~ACTOR_FLAG_0; } else { this->actor.flags |= ACTOR_FLAG_0; @@ -3845,17 +3846,17 @@ void Fishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { sp10C.z = 50.0f; } Matrix_RotateY(BINANG_TO_RAD_ALT(player->actor.shape.rot.y), MTXMODE_NEW); - Matrix_MultVec3f(&sp10C, &sCameraEye); + Matrix_MultVec3f(&sp10C, &sSubCamEye); - sCameraEye.x += player->actor.world.pos.x; - sCameraEye.y += player->actor.world.pos.y; - sCameraEye.z += player->actor.world.pos.z; + sSubCamEye.x += player->actor.world.pos.x; + sSubCamEye.y += player->actor.world.pos.y; + sSubCamEye.z += player->actor.world.pos.z; - sCameraAt = player->actor.world.pos; + sSubCamAt = player->actor.world.pos; if (sLinkAge != LINK_AGE_CHILD) { - sCameraAt.y += 40.0f; + sSubCamAt.y += 40.0f; } else { - sCameraAt.y += 25.0f; + sSubCamAt.y += 25.0f; } if (this->unk_17A[0] == 90) { @@ -4380,7 +4381,7 @@ void Fishing_UpdatePondProps(GlobalContext* globalCtx) { prop++; } - if (sCameraId == 0) { + if (sSubCamId == SUB_CAM_ID_DONE) { CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &sFishingMain->collider.base); } } @@ -5088,7 +5089,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { s16 headRotTarget; s16 playerShadowAlpha; f32 target; - f32 camAtFraction; + f32 subCamAtMaxVelFrac; f32 lureDistXZ; s32 pad; Player* player = GET_PLAYER(globalCtx); @@ -5232,21 +5233,21 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { break; case 1: { - Camera* camera; + Camera* mainCam; - sCameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCameraId, CAM_STAT_ACTIVE); - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); - sCameraEye.x = camera->eye.x; - sCameraEye.y = camera->eye.y; - sCameraEye.z = camera->eye.z; - sCameraAt.x = camera->at.x; - sCameraAt.y = camera->at.y; - sCameraAt.z = camera->at.z; + sSubCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + sSubCamEye.x = mainCam->eye.x; + sSubCamEye.y = mainCam->eye.y; + sSubCamEye.z = mainCam->eye.z; + sSubCamAt.x = mainCam->at.x; + sSubCamAt.y = mainCam->at.y; + sSubCamAt.z = mainCam->at.z; D_80B7A6CC = 2; Interface_ChangeAlpha(12); - D_80B7FECC = 0.0f; + sSubCamVelFactor = 0.0f; // fallthrough } @@ -5255,7 +5256,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { spFC.x = sLurePos.x - player->actor.world.pos.x; spFC.z = sLurePos.z - player->actor.world.pos.z; - lureDistXZ = sqrtf(SQ(spFC.x) + SQ(spFC.z)); + lureDistXZ = sqrtf(SQXZ(spFC)); Matrix_RotateY(Math_Atan2F(spFC.z, spFC.x), MTXMODE_NEW); sp114.x = 0.0f; @@ -5264,14 +5265,14 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { Matrix_MultVec3f(&sp114, &spFC); if (D_80B7A694 == 1) { - camAtFraction = 0.2f; + subCamAtMaxVelFrac = 0.2f; } else { - camAtFraction = 0.1f; + subCamAtMaxVelFrac = 0.1f; } - Math_ApproachF(&sCameraAt.x, sLurePos.x, camAtFraction, fabsf(spFC.x) * D_80B7FECC); - Math_ApproachF(&sCameraAt.y, sLurePos.y, camAtFraction, 50.0f * D_80B7FECC); - Math_ApproachF(&sCameraAt.z, sLurePos.z, camAtFraction, fabsf(spFC.z) * D_80B7FECC); + Math_ApproachF(&sSubCamAt.x, sLurePos.x, subCamAtMaxVelFrac, fabsf(spFC.x) * sSubCamVelFactor); + Math_ApproachF(&sSubCamAt.y, sLurePos.y, subCamAtMaxVelFrac, 50.0f * sSubCamVelFactor); + Math_ApproachF(&sSubCamAt.z, sLurePos.z, subCamAtMaxVelFrac, fabsf(spFC.z) * sSubCamVelFactor); sp114.x = 0.0f - D_80B7FED0; if (sLinkAge != LINK_AGE_CHILD) { @@ -5339,21 +5340,21 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { sp114.z = 100.0f; Matrix_MultVec3f(&sp114, &spFC); - Math_ApproachF(&sCameraEye.x, sp108.x, 0.3f, fabsf(spFC.x) * D_80B7FECC); - Math_ApproachF(&sCameraEye.y, sp108.y, 0.3f, 20.0f * D_80B7FECC); - Math_ApproachF(&sCameraEye.z, sp108.z, 0.3f, fabsf(spFC.z) * D_80B7FECC); + Math_ApproachF(&sSubCamEye.x, sp108.x, 0.3f, fabsf(spFC.x) * sSubCamVelFactor); + Math_ApproachF(&sSubCamEye.y, sp108.y, 0.3f, 20.0f * sSubCamVelFactor); + Math_ApproachF(&sSubCamEye.z, sp108.z, 0.3f, fabsf(spFC.z) * sSubCamVelFactor); break; case 3: { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); - camera->eye = sCameraEye; - camera->eyeNext = sCameraEye; - camera->at = sCameraAt; - func_800C08AC(globalCtx, sCameraId, 0); + mainCam->eye = sSubCamEye; + mainCam->eyeNext = sSubCamEye; + mainCam->at = sSubCamAt; + func_800C08AC(globalCtx, sSubCamId, 0); func_80064534(globalCtx, &globalCtx->csCtx); D_80B7A6CC = 0; - sCameraId = 0; + sSubCamId = SUB_CAM_ID_DONE; Environment_EnableUnderwaterLights(globalCtx, 0); globalCtx->envCtx.adjFogNear = 0; player->unk_860 = -5; @@ -5362,20 +5363,20 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { } case 10: { - Camera* camera; + Camera* mainCam; func_80064520(globalCtx, &globalCtx->csCtx); - sCameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCameraId, CAM_STAT_ACTIVE); + sSubCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); func_8002DF54(globalCtx, &this->actor, 5); - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); - sCameraEye.x = camera->eye.x; - sCameraEye.y = camera->eye.y; - sCameraEye.z = camera->eye.z; - sCameraAt.x = camera->at.x; - sCameraAt.y = camera->at.y; - sCameraAt.z = camera->at.z; + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + sSubCamEye.x = mainCam->eye.x; + sSubCamEye.y = mainCam->eye.y; + sSubCamEye.z = mainCam->eye.z; + sSubCamAt.x = mainCam->at.x; + sSubCamAt.y = mainCam->at.y; + sSubCamAt.z = mainCam->at.z; Message_StartTextbox(globalCtx, 0x409E, NULL); D_80B7A6CC = 11; func_800A9F6C(0.0f, 150, 10, 10); @@ -5387,16 +5388,16 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { player->actor.speedXZ = 0.0f; if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE) { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); - camera->eye = sCameraEye; - camera->eyeNext = sCameraEye; - camera->at = sCameraAt; - func_800C08AC(globalCtx, sCameraId, 0); + mainCam->eye = sSubCamEye; + mainCam->eyeNext = sSubCamEye; + mainCam->at = sSubCamAt; + func_800C08AC(globalCtx, sSubCamId, 0); func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); D_80B7A6CC = 0; - sCameraId = 0; + sSubCamId = SUB_CAM_ID_DONE; D_80B7A6D0 = 30; Environment_EnableUnderwaterLights(globalCtx, 0); globalCtx->envCtx.adjFogNear = 0; @@ -5404,20 +5405,20 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { break; case 20: { - Camera* camera; + Camera* mainCam; func_80064520(globalCtx, &globalCtx->csCtx); - sCameraId = Gameplay_CreateSubCamera(globalCtx); - Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT); - Gameplay_ChangeCameraStatus(globalCtx, sCameraId, CAM_STAT_ACTIVE); + sSubCamId = Gameplay_CreateSubCamera(globalCtx); + Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT); + Gameplay_ChangeCameraStatus(globalCtx, sSubCamId, CAM_STAT_ACTIVE); func_8002DF54(globalCtx, &this->actor, 5); - camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); - sCameraEye.x = camera->eye.x; - sCameraEye.y = camera->eye.y; - sCameraEye.z = camera->eye.z; - sCameraAt.x = camera->at.x; - sCameraAt.y = camera->at.y; - sCameraAt.z = camera->at.z; + mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); + sSubCamEye.x = mainCam->eye.x; + sSubCamEye.y = mainCam->eye.y; + sSubCamEye.z = mainCam->eye.z; + sSubCamAt.x = mainCam->at.x; + sSubCamAt.y = mainCam->at.y; + sSubCamAt.z = mainCam->at.z; Message_StartTextbox(globalCtx, 0x409A, NULL); D_80B7A6CC = 21; D_80B7FEC8 = 45.0f; @@ -5469,23 +5470,23 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { sp114.z = -35.0f; } - Matrix_MultVec3f(&sp114, &sCameraEye); - sCameraEye.x += player->actor.world.pos.x; - sCameraEye.y += player->actor.world.pos.y; - sCameraEye.z += player->actor.world.pos.z; + Matrix_MultVec3f(&sp114, &sSubCamEye); + sSubCamEye.x += player->actor.world.pos.x; + sSubCamEye.y += player->actor.world.pos.y; + sSubCamEye.z += player->actor.world.pos.z; - sCameraAt = player->actor.world.pos; + sSubCamAt = player->actor.world.pos; if (sLinkAge != LINK_AGE_CHILD) { - sCameraAt.y += 62.0f; + sSubCamAt.y += 62.0f; } else { - sCameraAt.y += 40.0f; + sSubCamAt.y += 40.0f; } if (D_80B7A6D0 == 0) { if ((Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CHOICE) || (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_NONE)) { if (Message_ShouldAdvance(globalCtx)) { - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); Message_CloseTextbox(globalCtx); if (globalCtx->msgCtx.choiceIndex == 0) { @@ -5493,14 +5494,14 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { D_80B7E082 = 0; } - camera->eye = sCameraEye; - camera->eyeNext = sCameraEye; - camera->at = sCameraAt; - func_800C08AC(globalCtx, sCameraId, 0); + mainCam->eye = sSubCamEye; + mainCam->eyeNext = sSubCamEye; + mainCam->at = sSubCamAt; + func_800C08AC(globalCtx, sSubCamId, 0); func_80064534(globalCtx, &globalCtx->csCtx); func_8002DF54(globalCtx, &this->actor, 7); D_80B7A6CC = 0; - sCameraId = 0; + sSubCamId = SUB_CAM_ID_DONE; player->unk_860 = -5; D_80B7E0B0 = 5; D_80B7A6D4 = 0; @@ -5516,11 +5517,11 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { break; } - if (sCameraId != 0) { - Gameplay_CameraSetAtEye(globalCtx, sCameraId, &sCameraAt, &sCameraEye); - Math_ApproachF(&D_80B7FECC, 1.0f, 1.0f, 0.02f); + if (sSubCamId != SUB_CAM_ID_DONE) { + Gameplay_CameraSetAtEye(globalCtx, sSubCamId, &sSubCamAt, &sSubCamEye); + Math_ApproachF(&sSubCamVelFactor, 1.0f, 1.0f, 0.02f); - if (sCameraEye.y <= (WATER_SURFACE_Y(globalCtx) + 1.0f)) { + if (sSubCamEye.y <= (WATER_SURFACE_Y(globalCtx) + 1.0f)) { Environment_EnableUnderwaterLights(globalCtx, 1); if (D_80B7E076 != 0) { globalCtx->envCtx.adjFogNear = -0xB2; @@ -5645,7 +5646,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { if ((u8)D_80B7A650 > 0) { s32 pad; - Camera* camera = Gameplay_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Gameplay_GetCamera(globalCtx, CAM_ID_MAIN); s16 i; s32 pad1; Vec3f pos; @@ -5655,7 +5656,7 @@ void Fishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { rot.x = M_PI / 2.0f + 0.1f; rot.y = 1.0f; - rot.z = (Camera_GetInputDirYaw(camera) * -(M_PI / 0x8000)) + rot.y; + rot.z = (Camera_GetInputDirYaw(mainCam) * -(M_PI / 0x8000)) + rot.y; for (i = 0; i < (u8)D_80B7A650; i++) { pos.x = Rand_CenteredFloat(700.0f) + globalCtx->view.eye.x; diff --git a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c index da1243eee2..fb1d0489ac 100644 --- a/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c +++ b/src/overlays/actors/ovl_Obj_Bean/z_obj_bean.c @@ -636,7 +636,7 @@ void ObjBean_WaitForWater(ObjBean* this, GlobalContext* globalCtx) { (this->dyna.actor.xzDistToPlayer < 50.0f)) { ObjBean_SetupGrowWaterPhase1(this); D_80B90E30 = this; - OnePointCutscene_Init(globalCtx, 2210, -99, &this->dyna.actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 2210, -99, &this->dyna.actor, CAM_ID_MAIN); this->dyna.actor.flags |= ACTOR_FLAG_4; return; } @@ -753,9 +753,9 @@ void ObjBean_WaitForPlayer(ObjBean* this, GlobalContext* globalCtx) { if (func_8004356C(&this->dyna)) { // Player is standing on ObjBean_SetupFly(this); if (globalCtx->sceneNum == SCENE_SPOT10) { // Lost woods - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_LOST_WOODS); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_LOST_WOODS); } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_GENERIC); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_GENERIC); } } ObjBean_UpdatePosition(this); @@ -769,7 +769,7 @@ void ObjBean_SetupFly(ObjBean* this) { } void ObjBean_Fly(ObjBean* this, GlobalContext* globalCtx) { - Camera* camera; + Camera* mainCam; ObjBean_FollowPath(this, globalCtx); if (this->currentPointIndex == this->pathCount) { @@ -778,10 +778,10 @@ void ObjBean_Fly(ObjBean* this, GlobalContext* globalCtx) { ObjBean_SetupWaitForStepOff(this); this->dyna.actor.flags &= ~ACTOR_FLAG_4; // Never stop updating (disable) - camera = globalCtx->cameraPtrs[MAIN_CAM]; + mainCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; - if ((camera->setting == CAM_SET_BEAN_LOST_WOODS) || (camera->setting == CAM_SET_BEAN_GENERIC)) { - Camera_ChangeSetting(camera, CAM_SET_NORMAL0); + if ((mainCam->setting == CAM_SET_BEAN_LOST_WOODS) || (mainCam->setting == CAM_SET_BEAN_GENERIC)) { + Camera_ChangeSetting(mainCam, CAM_SET_NORMAL0); } } else if (func_8004356C(&this->dyna) != 0) { // Player is on top @@ -789,15 +789,15 @@ void ObjBean_Fly(ObjBean* this, GlobalContext* globalCtx) { func_8002F974(&this->dyna.actor, NA_SE_PL_PLANT_MOVE - SFX_FLAG); if (globalCtx->sceneNum == SCENE_SPOT10) { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_LOST_WOODS); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_LOST_WOODS); } else { - Camera_ChangeSetting(globalCtx->cameraPtrs[MAIN_CAM], CAM_SET_BEAN_GENERIC); + Camera_ChangeSetting(globalCtx->cameraPtrs[CAM_ID_MAIN], CAM_SET_BEAN_GENERIC); } } else if (this->stateFlags & BEAN_STATE_PLAYER_ON_TOP) { - camera = globalCtx->cameraPtrs[MAIN_CAM]; + mainCam = globalCtx->cameraPtrs[CAM_ID_MAIN]; - if ((camera->setting == CAM_SET_BEAN_LOST_WOODS) || (camera->setting == CAM_SET_BEAN_GENERIC)) { - Camera_ChangeSetting(camera, CAM_SET_NORMAL0); + if ((mainCam->setting == CAM_SET_BEAN_LOST_WOODS) || (mainCam->setting == CAM_SET_BEAN_GENERIC)) { + Camera_ChangeSetting(mainCam, CAM_SET_NORMAL0); } } diff --git a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c index 210200d534..bca9ca500a 100644 --- a/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c +++ b/src/overlays/actors/ovl_Obj_Ice_Poly/z_obj_ice_poly.c @@ -119,7 +119,7 @@ void ObjIcePoly_Idle(ObjIcePoly* this, GlobalContext* globalCtx) { if (this->colliderIce.base.acFlags & AC_HIT) { this->meltTimer = -this->colliderIce.info.acHitInfo->toucher.damage; this->actor.focus.rot.y = this->actor.yawTowardsPlayer; - OnePointCutscene_Init(globalCtx, 5120, 40, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 5120, 40, &this->actor, CAM_ID_MAIN); this->actionFunc = ObjIcePoly_Melt; } else if (this->actor.parent != NULL) { this->actor.parent->freezeTimer = 40; diff --git a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c index 9cdc4fa95a..bbfe33d5f6 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -489,7 +489,7 @@ void ObjectKankyo_DrawFairies(ObjectKankyo* this2, GlobalContext* globalCtx2) { Vec3f vec2 = { 0.0f, 0.0f, 0.0f }; s16 i; - if (!(globalCtx->cameraPtrs[0]->unk_14C & 0x100)) { + if (!(globalCtx->cameraPtrs[CAM_ID_MAIN]->unk_14C & 0x100)) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 807); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 0x14); gSPSegment(POLY_XLU_DISP++, 0x08, SEGMENTED_TO_VIRTUAL(gSun1Tex)); @@ -584,7 +584,7 @@ void ObjectKankyo_DrawSnow(ObjectKankyo* this2, GlobalContext* globalCtx2) { s32 pad; s32 pad2; - if (!(globalCtx->cameraPtrs[0]->unk_14C & 0x100)) { + if (!(globalCtx->cameraPtrs[CAM_ID_MAIN]->unk_14C & 0x100)) { OPEN_DISPS(globalCtx->state.gfxCtx, "../z_object_kankyo.c", 958); if (globalCtx->envCtx.unk_EE[2] < globalCtx->envCtx.unk_EE[3]) { if (globalCtx->state.frames % 16 == 0) { diff --git a/src/overlays/actors/ovl_player_actor/z_player.c b/src/overlays/actors/ovl_player_actor/z_player.c index f6b492c4da..995bce05cd 100644 --- a/src/overlays/actors/ovl_player_actor/z_player.c +++ b/src/overlays/actors/ovl_player_actor/z_player.c @@ -1344,13 +1344,13 @@ void func_80832318(Player* this) { } void func_80832340(GlobalContext* globalCtx, Player* this) { - Camera* camera; + Camera* subCam; - if (this->unk_46C != SUBCAM_NONE) { - camera = globalCtx->cameraPtrs[this->unk_46C]; - if ((camera != NULL) && (camera->csId == 1100)) { - OnePointCutscene_EndCutscene(globalCtx, this->unk_46C); - this->unk_46C = SUBCAM_NONE; + if (this->subCamId != CAM_ID_NONE) { + subCam = globalCtx->cameraPtrs[this->subCamId]; + if ((subCam != NULL) && (subCam->csId == 1100)) { + OnePointCutscene_EndCutscene(globalCtx, this->subCamId); + this->subCamId = CAM_ID_NONE; } } @@ -1390,7 +1390,7 @@ void func_80832440(GlobalContext* globalCtx, Player* this) { this->unk_6AD = 0; func_80832340(globalCtx, this); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); this->stateFlags1 &= ~(PLAYER_STATE1_13 | PLAYER_STATE1_14 | PLAYER_STATE1_20 | PLAYER_STATE1_21); this->stateFlags2 &= ~(PLAYER_STATE2_4 | PLAYER_STATE2_7 | PLAYER_STATE2_18); @@ -2137,7 +2137,7 @@ void func_80834298(Player* this, GlobalContext* globalCtx) { if ((this->actor.category == ACTORCAT_PLAYER) && !(this->stateFlags1 & PLAYER_STATE1_8) && ((this->heldItemActionParam == this->itemActionParam) || (this->stateFlags1 & PLAYER_STATE1_22)) && (gSaveContext.health != 0) && (globalCtx->csCtx.state == CS_STATE_IDLE) && (this->csMode == 0) && - (globalCtx->shootingGalleryStatus == 0) && (globalCtx->activeCamera == MAIN_CAM) && + (globalCtx->shootingGalleryStatus == 0) && (globalCtx->activeCamId == CAM_ID_MAIN) && (globalCtx->transitionTrigger != TRANS_TRIGGER_START) && (gSaveContext.timer1State != 10)) { func_80833DF8(this, globalCtx); } @@ -2427,7 +2427,8 @@ s32 func_80834E7C(GlobalContext* globalCtx) { s32 func_80834EB8(Player* this, GlobalContext* globalCtx) { if ((this->unk_6AD == 0) || (this->unk_6AD == 2)) { - if (func_80833BCC(this) || (Camera_CheckValidMode(Gameplay_GetCamera(globalCtx, 0), 7) == 0)) { + if (func_80833BCC(this) || + (Camera_CheckValidMode(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), CAM_MODE_BOWARROW) == 0)) { return 1; } this->unk_6AD = 2; @@ -2837,13 +2838,13 @@ void func_80835E44(GlobalContext* globalCtx, s16 camSetting) { Interface_ChangeAlpha(2); } } else { - Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, 0), camSetting); + Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), camSetting); } } void func_80835EA4(GlobalContext* globalCtx, s32 arg1) { func_80835E44(globalCtx, CAM_SET_TURN_AROUND); - Camera_SetCameraData(Gameplay_GetCamera(globalCtx, 0), 4, 0, 0, arg1, 0, 0); + Camera_SetCameraData(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), 4, 0, 0, arg1, 0, 0); } void func_80835EFC(Player* this) { @@ -2979,7 +2980,7 @@ void func_80836448(GlobalContext* globalCtx, Player* this, LinkAnimationHeader* gSaveContext.natureAmbienceId = NATURE_ID_DISABLED; } - OnePointCutscene_Init(globalCtx, 9806, cond ? 120 : 60, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 9806, cond ? 120 : 60, &this->actor, CAM_ID_MAIN); ShrinkWindow_SetVal(0x20); } } @@ -4065,7 +4066,7 @@ void func_80838F5C(GlobalContext* globalCtx, Player* this) { this->stateFlags1 |= PLAYER_STATE1_29 | PLAYER_STATE1_31; - Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, 0), CAM_SET_FREE0); + Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), CAM_SET_FREE0); } s32 func_80838FB8(GlobalContext* globalCtx, Player* this) { @@ -4186,7 +4187,7 @@ s32 func_80839034(GlobalContext* globalCtx, Player* this, CollisionPoly* poly, u this->stateFlags1 |= PLAYER_STATE1_0 | PLAYER_STATE1_29; - func_80835E44(globalCtx, 0x2F); + func_80835E44(globalCtx, CAM_SET_SCENE_TRANSITION); return 1; } else { @@ -4406,7 +4407,7 @@ s32 func_80839800(Player* this, GlobalContext* globalCtx) { gSaveContext.entranceSound = NA_SE_OC_DOOR_OPEN; } } else { - Camera_ChangeDoorCam(Gameplay_GetCamera(globalCtx, 0), doorActor, + Camera_ChangeDoorCam(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), doorActor, globalCtx->transiActorCtx.list[(u16)doorActor->params >> 10] .sides[(doorDirection > 0) ? 0 : 1] .effects, @@ -4796,7 +4797,7 @@ s32 func_8083AD4C(GlobalContext* globalCtx, Player* this) { cameraMode = CAM_MODE_FIRSTPERSON; } - return Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), cameraMode); + return Camera_ChangeMode(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), cameraMode); } s32 func_8083ADD4(GlobalContext* globalCtx, Player* this) { @@ -4839,7 +4840,7 @@ void func_8083AF44(GlobalContext* globalCtx, Player* this, s32 magicSpell) { LinkAnimation_PlayOnceSetSpeed(globalCtx, &this->skelAnime, &gPlayerAnim_002D28, 0.83f); if (magicSpell == 5) { - this->unk_46C = OnePointCutscene_Init(globalCtx, 1100, -101, NULL, MAIN_CAM); + this->subCamId = OnePointCutscene_Init(globalCtx, 1100, -101, NULL, CAM_ID_MAIN); } else { func_80835EA4(globalCtx, 10); } @@ -4981,7 +4982,7 @@ s32 func_8083B040(Player* this, GlobalContext* globalCtx) { func_80835EA4(globalCtx, (this->unk_6A8 != NULL) ? 0x5B : 0x5A); if (this->unk_6A8 != NULL) { this->stateFlags2 |= PLAYER_STATE2_25; - Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, this->unk_6A8); + Camera_SetParam(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), 8, this->unk_6A8); } } } else if (func_8083AD4C(globalCtx, this)) { @@ -5088,7 +5089,7 @@ s32 func_8083B644(Player* this, GlobalContext* globalCtx) { s32 func_8083B8F4(Player* this, GlobalContext* globalCtx) { if (!(this->stateFlags1 & (PLAYER_STATE1_11 | PLAYER_STATE1_23)) && - Camera_CheckValidMode(Gameplay_GetCamera(globalCtx, 0), 6)) { + Camera_CheckValidMode(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), CAM_MODE_FIRSTPERSON)) { if ((this->actor.bgCheckFlags & BGCHECKFLAG_GROUND) || (func_808332B8(this) && (this->actor.yDistToWater < this->ageProperties->unk_2C))) { this->unk_6AD = 1; @@ -6130,7 +6131,7 @@ s32 func_8083E5A8(Player* this, GlobalContext* globalCtx) { func_808322D0(globalCtx, this, this->ageProperties->unk_98); func_80832F54(globalCtx, this, 0x28F); chest->unk_1F4 = 1; - Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, 0), CAM_SET_SLOW_CHEST_CS); + Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), CAM_SET_SLOW_CHEST_CS); } else { func_80832264(globalCtx, this, &gPlayerAnim_002DF8); chest->unk_1F4 = -1; @@ -6449,13 +6450,13 @@ s32 func_8083F570(Player* this, GlobalContext* globalCtx) { this->actor.shape.rot.y = this->actor.wallYaw + 0x8000; func_80832264(globalCtx, this, &gPlayerAnim_002700); func_80832F54(globalCtx, this, 0x9D); - OnePointCutscene_Init(globalCtx, 9601, 999, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 9601, 999, NULL, CAM_ID_MAIN); } else { this->actor.shape.rot.y = this->actor.wallYaw; LinkAnimation_Change(globalCtx, &this->skelAnime, &gPlayerAnim_002708, -1.0f, Animation_GetLastFrame(&gPlayerAnim_002708), 0.0f, ANIMMODE_ONCE, 0.0f); func_80832F54(globalCtx, this, 0x9D); - OnePointCutscene_Init(globalCtx, 9602, 999, NULL, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 9602, 999, NULL, CAM_ID_MAIN); } this->currentYaw = this->actor.shape.rot.y; @@ -7583,7 +7584,7 @@ void func_8084279C(Player* this, GlobalContext* globalCtx) { } this->actor.flags &= ~ACTOR_FLAG_8; - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); } } @@ -7614,7 +7615,7 @@ s32 func_80842964(Player* this, GlobalContext* globalCtx) { } void func_808429B4(GlobalContext* globalCtx, s32 speed, s32 y, s32 countdown) { - s32 quakeIdx = Quake_Add(Gameplay_GetCamera(globalCtx, 0), 3); + s32 quakeIdx = Quake_Add(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), 3); Quake_SetSpeed(quakeIdx, speed); Quake_SetQuakeValues(quakeIdx, y, 0, 0, 0); @@ -8046,7 +8047,7 @@ void func_80843AE8(GlobalContext* globalCtx, Player* this) { this->unk_850 = 60; Player_SpawnFairy(globalCtx, this, &this->actor.world.pos, &D_808545E4, FAIRY_REVIVE_DEATH); func_8002F7DC(&this->actor, NA_SE_EV_FIATY_HEAL - SFX_FLAG); - OnePointCutscene_Init(globalCtx, 9908, 125, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 9908, 125, &this->actor, CAM_ID_MAIN); } else if (globalCtx->gameOverCtx.state == GAMEOVER_DEATH_WAIT_GROUND) { globalCtx->gameOverCtx.state = GAMEOVER_DEATH_DELAY_MENU; } @@ -8837,10 +8838,10 @@ void func_80845CA4(Player* this, GlobalContext* globalCtx) { temp = func_80845BA0(globalCtx, this, &sp34, sp30); - if ((this->unk_850 == 0) || - ((temp == 0) && (this->linearVelocity == 0.0f) && (Gameplay_GetCamera(globalCtx, 0)->unk_14C & 0x10))) { + if ((this->unk_850 == 0) || ((temp == 0) && (this->linearVelocity == 0.0f) && + (Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)->unk_14C & 0x10))) { - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); func_80845C68(globalCtx, gSaveContext.respawn[RESPAWN_MODE_DOWN].data); if (!func_8083B644(this, globalCtx)) { @@ -8874,7 +8875,7 @@ void func_80845EF8(Player* this, GlobalContext* globalCtx) { if (globalCtx->roomCtx.prevRoom.num >= 0) { func_80097534(globalCtx, &globalCtx->roomCtx); } - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); Gameplay_SetupRespawnPoint(globalCtx, 0, 0xDFF); } return; @@ -9178,7 +9179,7 @@ void func_808468E8(GlobalContext* globalCtx, Player* this) { func_80835C58(globalCtx, this, func_8084F9C0, 0); this->stateFlags1 |= PLAYER_STATE1_29; this->fallStartHeight = this->actor.world.pos.y; - OnePointCutscene_Init(globalCtx, 5110, 40, &this->actor, MAIN_CAM); + OnePointCutscene_Init(globalCtx, 5110, 40, &this->actor, CAM_ID_MAIN); } void func_80846978(GlobalContext* globalCtx, Player* this) { @@ -9232,7 +9233,8 @@ void Player_InitCommon(Player* this, GlobalContext* globalCtx, FlexSkeletonHeade Effect_Add(globalCtx, &this->meleeWeaponEffectIndex, EFFECT_BLURE2, 0, 0, &D_8085470C); ActorShape_Init(&this->actor.shape, 0.0f, ActorShadow_DrawFeet, this->ageProperties->unk_04); - this->unk_46C = SUBCAM_NONE; + this->subCamId = CAM_ID_NONE; + Collider_InitCylinder(globalCtx, &this->cylinder); Collider_SetCylinder(globalCtx, &this->cylinder, &this->actor, &D_80854624); Collider_InitQuad(globalCtx, &this->meleeWeaponQuads[0]); @@ -9858,11 +9860,11 @@ void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) { seqMode = SEQ_MODE_DEFAULT; if (this->csMode != 0) { - Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), CAM_MODE_NORMAL); + Camera_ChangeMode(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), CAM_MODE_NORMAL); } else if (!(this->stateFlags1 & PLAYER_STATE1_20)) { if ((this->actor.parent != NULL) && (this->stateFlags3 & PLAYER_STATE3_7)) { camMode = CAM_MODE_HOOKSHOT; - Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, this->actor.parent); + Camera_SetParam(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), 8, this->actor.parent); } else if (func_8084377C == this->func_674) { camMode = CAM_MODE_STILL; } else if (this->stateFlags2 & PLAYER_STATE2_8) { @@ -9879,12 +9881,12 @@ void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) { } else { camMode = CAM_MODE_BATTLE; } - Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, unk_664); + Camera_SetParam(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), 8, unk_664); } else if (this->stateFlags1 & PLAYER_STATE1_12) { camMode = CAM_MODE_CHARGE; } else if (this->stateFlags1 & PLAYER_STATE1_25) { camMode = CAM_MODE_FOLLOWBOOMERANG; - Camera_SetParam(Gameplay_GetCamera(globalCtx, 0), 8, this->boomerangActor); + Camera_SetParam(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), 8, this->boomerangActor); } else if (this->stateFlags1 & (PLAYER_STATE1_13 | PLAYER_STATE1_14)) { if (func_80833B2C(this)) { camMode = CAM_MODE_HANGZ; @@ -9919,7 +9921,7 @@ void Player_UpdateCamAndSeqModes(GlobalContext* globalCtx, Player* this) { } } - Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), camMode); + Camera_ChangeMode(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), camMode); } else { // First person mode seqMode = SEQ_MODE_STILL; @@ -10938,7 +10940,7 @@ void func_8084B530(Player* this, GlobalContext* globalCtx) { this->stateFlags2 &= ~PLAYER_STATE2_13; } - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); if (!func_8084B4D4(globalCtx, this) && !func_8084B3CC(globalCtx, this) && !func_8083ADD4(globalCtx, this)) { if ((this->targetActor != this->interactRangeActor) || !func_8083E5A8(this, globalCtx)) { @@ -11759,7 +11761,7 @@ void func_8084D3E4(Player* this, GlobalContext* globalCtx) { gSaveContext.horseData.angle = rideActor->actor.shape.rot.y; } } else { - Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, 0), CAM_SET_NORMAL0); + Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), CAM_SET_NORMAL0); if (this->mountSide < 0) { D_808549C4[0].field = 0x2828; @@ -12008,7 +12010,7 @@ void func_8084DF6C(GlobalContext* globalCtx, Player* this) { this->unk_862 = 0; this->stateFlags1 &= ~(PLAYER_STATE1_10 | PLAYER_STATE1_11); this->getItemId = GI_NONE; - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); } void func_8084DFAC(GlobalContext* globalCtx, Player* this) { @@ -12131,7 +12133,7 @@ void func_8084E3C4(Player* this, GlobalContext* globalCtx) { } if (globalCtx->msgCtx.ocarinaMode == OCARINA_MODE_04) { - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); if ((this->targetActor != NULL) && (this->targetActor == this->unk_6A8)) { func_80853148(globalCtx, this->targetActor); @@ -12341,7 +12343,7 @@ void func_8084EAC0(Player* this, GlobalContext* globalCtx) { } func_8083C0E8(this, globalCtx); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); } else if (this->unk_850 == 1) { if ((gSaveContext.healthAccumulator == 0) && (gSaveContext.unk_13F0 != 9)) { func_80832B78(globalCtx, this, &gPlayerAnim_002660); @@ -12378,7 +12380,7 @@ void func_8084ECA4(Player* this, GlobalContext* globalCtx) { this->unk_850 = 1; } else if (Message_GetState(&globalCtx->msgCtx) == TEXT_STATE_CLOSING) { this->unk_84F = 0; - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); } } else { func_8083C0E8(this, globalCtx); @@ -12428,7 +12430,7 @@ static Vec3f D_80854A1C = { 0.0f, 0.0f, 5.0f }; void func_8084EED8(Player* this, GlobalContext* globalCtx) { if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { func_8083C0E8(this, globalCtx); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); return; } @@ -12458,7 +12460,7 @@ void func_8084EFC0(Player* this, GlobalContext* globalCtx) { if (LinkAnimation_Update(globalCtx, &this->skelAnime)) { func_8083C0E8(this, globalCtx); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); return; } @@ -12526,7 +12528,7 @@ void func_8084F104(Player* this, GlobalContext* globalCtx) { func_8083C0E8(this, globalCtx); } - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); } } } else if (this->unk_850 >= 0) { @@ -12774,7 +12776,7 @@ s32 func_8084FCAC(Player* this, GlobalContext* globalCtx) { D_808535D0 ^= 1; if (D_808535D0) { - Camera_ChangeMode(Gameplay_GetCamera(globalCtx, 0), CAM_MODE_BOWARROWZ); + Camera_ChangeMode(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN), CAM_MODE_BOWARROWZ); } } @@ -13020,7 +13022,7 @@ void func_8085063C(Player* this, GlobalContext* globalCtx) { } func_80853080(this, globalCtx); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); } } @@ -13086,7 +13088,7 @@ void func_808507F4(Player* this, GlobalContext* globalCtx) { if (this->unk_84F < 0) { if ((this->itemActionParam == PLAYER_AP_NAYRUS_LOVE) || (gSaveContext.unk_13F0 == 0)) { func_80839FFC(this, globalCtx); - func_8005B1A4(Gameplay_GetCamera(globalCtx, 0)); + func_8005B1A4(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); } } else { if (this->unk_850 == 0) { diff --git a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c index b8bd67b9c4..1cd208be4a 100644 --- a/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c +++ b/src/overlays/effects/ovl_Effect_Ss_Sibuki/z_eff_ss_sibuki.c @@ -92,7 +92,7 @@ void EffectSsSibuki_Update(GlobalContext* globalCtx, u32 index, EffectSs* this) this->rMoveDelay--; if (this->rMoveDelay == 0) { - yaw = Camera_GetInputDirYaw(Gameplay_GetCamera(globalCtx, 0)); + yaw = Camera_GetInputDirYaw(Gameplay_GetCamera(globalCtx, CAM_ID_MAIN)); xzVelScale = ((200.0f + KREG(20)) * 0.01f) + ((0.1f * Rand_ZeroOne()) * (KREG(23) + 20.0f)); if (this->rDirection != 0) {