From fa069535d0fe06966dec592c592b8a292aef0628 Mon Sep 17 00:00:00 2001 From: engineer124 <47598039+engineer124@users.noreply.github.com> Date: Sun, 20 Feb 2022 11:33:47 +1100 Subject: [PATCH] Camera Preparation (#644) * Copy progress from z_camera * cleanup functions.h * Oops * Revert `SUB16` and `ADD16` back to original names * PR Suggestions * PR Suggestions * Fix merge with master --- include/functions.h | 39 +++--- include/macros.h | 3 +- include/z64.h | 16 +-- include/z64bgcheck.h | 8 +- include/z64scene.h | 12 +- src/code/sys_math3d.c | 2 +- src/code/z_actor.c | 6 +- src/code/z_bgcheck.c | 12 +- src/code/z_camera.c | 14 +-- src/code/z_effect_soft_sprite.c | 9 +- src/code/z_fireobj.c | 2 +- src/code/z_kaleido_scope_call.c | 1 + src/code/z_lib.c | 2 +- src/code/z_olib.c | 2 +- src/code/z_play.c | 26 ++-- src/code/z_quake.c | 6 +- src/code/z_scene.c | 6 +- src/code/z_shrink_window.c | 1 + src/code/z_snap.c | 8 +- .../actors/ovl_Arms_Hook/z_arms_hook.c | 6 +- .../ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c | 2 +- src/overlays/actors/ovl_Boss_02/z_boss_02.c | 22 ++-- src/overlays/actors/ovl_Boss_04/z_boss_04.c | 10 +- src/overlays/actors/ovl_Boss_06/z_boss_06.c | 6 +- .../actors/ovl_Demo_Kankyo/z_demo_kankyo.c | 2 +- src/overlays/actors/ovl_Door_Ana/z_door_ana.c | 2 +- .../actors/ovl_Door_Shutter/z_door_shutter.c | 2 +- src/overlays/actors/ovl_En_Al/z_en_al.c | 5 +- src/overlays/actors/ovl_En_Ani/z_en_ani.c | 4 +- src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c | 28 ++--- .../actors/ovl_En_Bigslime/z_en_bigslime.c | 16 +-- .../ovl_En_Bom_Bowl_Man/z_en_bom_bowl_man.c | 8 +- .../actors/ovl_En_Bomjima/z_en_bomjima.c | 4 +- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.c | 38 +++--- .../actors/ovl_En_Clear_Tag/z_en_clear_tag.h | 6 +- .../actors/ovl_En_Dinofos/z_en_dinofos.c | 62 +++++----- .../actors/ovl_En_Dinofos/z_en_dinofos.h | 2 +- .../actors/ovl_En_Fishing/z_en_fishing.c | 46 +++---- src/overlays/actors/ovl_En_Fu/z_en_fu.c | 11 +- src/overlays/actors/ovl_En_Gm/z_en_gm.c | 9 +- src/overlays/actors/ovl_En_Go/z_en_go.c | 2 +- src/overlays/actors/ovl_En_Ig/z_en_ig.c | 6 +- src/overlays/actors/ovl_En_Jg/z_en_jg.c | 4 +- .../actors/ovl_En_Kakasi/z_en_kakasi.c | 16 +-- .../actors/ovl_En_Kendo_Js/z_en_kendo_js.c | 3 +- .../actors/ovl_En_Minifrog/z_en_minifrog.c | 8 +- src/overlays/actors/ovl_En_Niw/z_en_niw.c | 18 +-- src/overlays/actors/ovl_En_Ot/z_en_ot.c | 10 +- .../actors/ovl_En_Pamera/z_en_pamera.c | 6 +- .../actors/ovl_En_Pametfrog/z_en_pametfrog.c | 114 +++++++++--------- .../actors/ovl_En_Pametfrog/z_en_pametfrog.h | 2 +- src/overlays/actors/ovl_En_Pm/z_en_pm.c | 10 +- .../ovl_En_Po_Sisters/z_en_po_sisters.c | 2 +- src/overlays/actors/ovl_En_Poh/z_en_poh.c | 5 +- src/overlays/actors/ovl_En_Tru/z_en_tru.c | 2 +- .../ovl_En_Water_Effect/z_en_water_effect.c | 4 +- src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c | 2 +- .../actors/ovl_Obj_Funen/z_obj_funen.c | 2 +- .../actors/ovl_Obj_Kinoko/z_obj_kinoko.c | 2 +- .../actors/ovl_Obj_Syokudai/z_obj_syokudai.c | 3 +- .../ovl_Object_Kankyo/z_object_kankyo.c | 10 +- tools/actorfixer.py | 25 ++++ tools/disasm/functions.txt | 44 +++---- tools/sizes/code_functions.csv | 42 +++---- 64 files changed, 424 insertions(+), 384 deletions(-) diff --git a/include/functions.h b/include/functions.h index ba72e093fe..f652786718 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1140,13 +1140,13 @@ s32 Camera_ChangeMode(Camera* camera, s16 mode); // void func_800DF86C(void); // void func_800DF8EC(void); s32 func_800DFAC8(Camera* camera, s16 param_2); -u32 func_800DFB14(Camera* camera, u32 param_2); +u32 Camera_ChangeDataIdx(Camera* camera, u32 camDataIdx); // void func_800DFC1C(void); // void func_800DFC40(void); -s32 func_800DFC68(Camera* camera); +s32 Camera_GetInputDirYaw(Camera* camera); // void func_800DFC90(void); -s16 func_800DFCB4(Camera* camera); -s16 func_800DFCDC(Camera* camera); +s16 Camera_GetCamDirPitch(Camera* camera); +s16 Camera_GetCamDirYaw(Camera* camera); void func_800DFD04(Camera* camera, s32 arg1, s32 arg2, s32 arg3); // void func_800DFD78(void); // UNK_TYPE4 func_800DFEF0(s32 param_1, u16 param_2); @@ -1162,9 +1162,9 @@ s32 func_800DFFAC(Camera* camera, Actor* doorActor, s16 bgCamDataId, f32 arg3, s // void func_800E01DC(s32 param_1, u32 param_2, UNK_TYPE4 param_3, UNK_TYPE4 param_4, UNK_TYPE2 param_5, UNK_TYPE2 param_6); // UNK_TYPE4 func_800E0228(void); // void func_800E0238(void); -void func_800E02AC(Camera* camera, Actor* actor); -void func_800E0308(Camera* camera, Actor* actor); -f32 func_800E031C(Camera* camera); +void Camera_SetToTrackActor(Camera* camera, Actor* actor); +void Camera_SetTargetActor(Camera* camera, Actor* actor); +f32 Camera_GetWaterYPos(Camera* camera); void func_800E0348(Camera* camera); DamageTable* DamageTable_Get(s32 index); void DamageTable_Clear(DamageTable* damageTable); @@ -2838,22 +2838,21 @@ void func_8016927C(GlobalContext* globalCtx, s16 sParm2); // void func_801692C4(GlobalContext* globalCtx, UNK_TYPE1 uParm2); // void Play_SceneInit(GlobalContext* globalCtx, s32 sceneIndex, UNK_TYPE1 param_3); UNK_RET func_80169474(GlobalContext* globalCtx, Vec3f* v1, Vec3f* v2); -s32 func_801694DC(GlobalContext* globalCtx); -s32 Play_GetActiveCameraIndex(GlobalContext* globalCtx); -void func_80169590(GlobalContext* globalCtx, s16 param_2, s16 param_3); -void func_80169600(GlobalContext* globalCtx, s16 param_2); -// void func_80169668(void); +s32 Play_CreateSubCamera(GlobalContext* globalCtx); +s32 Play_GetActiveCamId(GlobalContext* globalCtx); +void Play_CameraChangeStatus(GlobalContext* globalCtx, s16 camId, s16 status); +void Play_ClearCamera(GlobalContext* globalCtx, s16 camId); Camera* Play_GetCamera(GlobalContext* globalCtx, s16 index); s32 Play_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye); -void func_8016981C(GlobalContext* globalCtx, s16 arg1, Vec3f* arg2, Vec3f* arg3, Vec3f* arg4); -void func_80169940(GlobalContext* globalCtx, s16 camId, f32 arg2); -// void func_80169988(void); -void func_801699D4(GlobalContext* globalCtx, s16 arg1, s16 arg2); +void Play_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up); +void Play_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov); +void Play_CameraSetRoll(GlobalContext* globalCtx, s16 camId, s16 roll); +void Play_CopyCamera(GlobalContext* globalCtx, s16 dstCamId, s16 srcCamId); // void func_80169A50(void); -// void func_80169AC0(void); +void Play_CameraChangeSetting(GlobalContext* globalCtx, s16 camId, s16 setting); void func_80169AFC(GlobalContext* globalCtx, s16 camId, s16 arg2); -// void func_80169C64(void); -// void func_80169C84(void); +s16 Play_GetCsCamDataSetting(GlobalContext* globalCtx, s32 camId); +Vec3s* Play_GetCsCamDataVec3s(GlobalContext* globalCtx, s32 camId); s16 convert_scene_number_among_shared_scenes(s16 arg0); void func_80169D40(GlobalContext* globalCtx); void func_80169DCC(GlobalContext* globalCtx, s32 arg1, u16 arg2, s32 arg3, s32 arg4, Vec3f* arg5, s16 arg6); @@ -3149,7 +3148,7 @@ s32 Math3D_TriChkPointParaZIntersect(Vec3f* a, Vec3f* b, Vec3f* c, f32 nx, f32 n s32 Math3D_TriChkLineSegParaZIntersect(Vec3f* v0, Vec3f* v1, Vec3f* v2, f32 nx, f32 ny, f32 nz, f32 originDist, f32 x, f32 y, f32* zIntersect, f32 z0, f32 z1); // void func_8017D1AC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7); // void func_8017D220(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5); -// void func_8017D2FC(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8); +s32 Math3D_LineSegVsPlane(f32 nx, f32 ny, f32 nz, f32 originDist, Vec3f* linePointA, Vec3f* linePointB, Vec3f* intersect, s32 fromFront); // void func_8017D404(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE4 param_5, UNK_TYPE4 param_6, UNK_TYPE4 param_7, UNK_TYPE4 param_8, UNK_TYPE4 param_9, UNK_TYPE4 param_10, UNK_TYPE4 param_11); void Math3D_TriSetCoords(TriNorm* tri, Vec3f* pointA, Vec3f* pointB, Vec3f* pointC); u32 Math3D_IsPointInSphere(Sphere16* sphere, Vec3f* point); diff --git a/include/macros.h b/include/macros.h index 081f6a487c..c5a3a061db 100644 --- a/include/macros.h +++ b/include/macros.h @@ -21,8 +21,7 @@ #define SEGMENTED_TO_VIRTUAL(addr) (void*)(PHYSICAL_TO_VIRTUAL(gSegments[SEGMENT_NUMBER(addr)]) + SEGMENT_OFFSET(addr)) #define GET_ACTIVE_CAM(globalCtx) ((globalCtx)->cameraPtrs[(globalCtx)->activeCamera]) -#define MAIN_CAM 0 -#define SUBCAM_FREE 0 +#define CAM_ID_MAIN 0 #define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \ (curState)->nextGameStateInit = (GameStateFunc)newInit; \ diff --git a/include/z64.h b/include/z64.h index 610b03d139..44d4f6ab4c 100644 --- a/include/z64.h +++ b/include/z64.h @@ -67,7 +67,7 @@ typedef struct { /* 0x0 */ s16 priority; // Lower means higher priority. -1 means it ignores priority /* 0x2 */ s16 length; - /* 0x4 */ s16 unk4; + /* 0x4 */ s16 csCamSceneDataId; // Index of CsCameraEntry to use. Negative indices use sGlobalCamDataSettings. Indices 0 and above use CsCameraEntry from scene /* 0x6 */ s16 unk6; /* 0x8 */ s16 additionalCutscene; /* 0xA */ u8 sound; @@ -119,8 +119,8 @@ typedef struct { /* 0x18 */ u16 unk_18; /* 0x1A */ u8 unk_1A; /* 0x1B */ u8 unk_1B; - /* 0x1C */ CutsceneCameraPoint* cameraFocus; - /* 0x20 */ CutsceneCameraPoint* cameraPosition; + /* 0x1C */ CutsceneCameraPoint* atPoints; + /* 0x20 */ CutsceneCameraPoint* eyePoints; /* 0x24 */ CsCmdActorAction* linkAction; /* 0x28 */ CsCmdActorAction* npcActions[10]; // "npcdemopnt" /* 0x50 */ CutsceneEntry* sceneCsList; @@ -718,8 +718,8 @@ typedef struct { /* 0x12 */ u8 unk_12; /* 0x13 */ u8 unk_13; /* 0x14 */ u8 unk_14; - /* 0x15 */ u8 unk_15; - /* 0x16 */ u8 unk_16; + /* 0x15 */ u8 skyboxDisabled; + /* 0x16 */ u8 sunMoonDisabled; /* 0x17 */ u8 unk_17; /* 0x18 */ u8 unk_18; /* 0x19 */ u8 unk_19; @@ -1071,7 +1071,7 @@ typedef struct Camera { /* 0x15E */ s16 animState; /* 0x160 */ s16 unk160; /* 0x162 */ s16 timer; - /* 0x164 */ s16 thisIdx; + /* 0x164 */ s16 camId; /* 0x166 */ s16 prevCamDataIdx; /* 0x168 */ s16 unk168; /* 0x16A */ s16 unk16A; @@ -1100,7 +1100,7 @@ typedef struct { /* 0x1A */ s16 speed; /* 0x1C */ s16 isShakePerpendicular; /* 0x1E */ s16 countdown; - /* 0x20 */ s16 cameraPtrsIdx; + /* 0x20 */ s16 camId; } QuakeRequest; // size = 0x24 typedef struct { @@ -1324,7 +1324,7 @@ struct GlobalContext { /* 0x1884C */ RomFile* roomList; /* 0x18850 */ ActorEntry* linkActorEntry; /* 0x18854 */ ActorEntry* setupActorList; - /* 0x18858 */ void* unk_18858; + /* 0x18858 */ CsCamData* csCamData; /* 0x1885C */ EntranceEntry* setupEntranceList; /* 0x18860 */ u16* setupExitList; /* 0x18864 */ Path* setupPathList; diff --git a/include/z64bgcheck.h b/include/z64bgcheck.h index 55429a4338..0a5afb3d9a 100644 --- a/include/z64bgcheck.h +++ b/include/z64bgcheck.h @@ -89,10 +89,10 @@ typedef struct CollisionPoly { } CollisionPoly; // size = 0x10 typedef struct { - /* 0x00 */ u16 cameraSType; - /* 0x02 */ s16 unk_02; - /* 0x04 */ Vec3s* camPosData; -} CamData; + /* 0x0 */ u16 setting; + /* 0x2 */ s16 numData; + /* 0x4 */ Vec3s* data; +} CamData; // size = 0x8 (BgCamData) typedef struct { /* 0x0 */ Vec3s minPos; diff --git a/include/z64scene.h b/include/z64scene.h index 8d301d1d17..c2836c5485 100644 --- a/include/z64scene.h +++ b/include/z64scene.h @@ -290,7 +290,7 @@ typedef struct { typedef struct { struct { s8 room; // Room to switch to - s8 effects; // How the camera reacts during the transition + s8 bgCamDataId; // How the camera reacts during the transition. -2 for spiral staircase. -1 for generic door. 0+ will index scene CamData } /* 0x00 */ sides[2]; // 0 = front, 1 = back /* 0x04 */ s16 id; /* 0x06 */ Vec3s pos; @@ -496,10 +496,12 @@ typedef struct { } MinimapChest; // size = 0xA typedef struct { - /* 0x00 */ s16 type; - /* 0x00 */ s16 numPoints; - /* 0x00 */ Vec3s* points; -} CsCameraEntry; + /* 0x0 */ s16 setting; + /* 0x2 */ s16 numData; + /* 0x4 */ Vec3s* data; +} CsCamData; // size = 0x8 + +typedef CsCamData CsCameraEntry; // TODO: Remove once ZAPD updates its structs typedef union { /* Command: N/A */ SCmdBase base; diff --git a/src/code/sys_math3d.c b/src/code/sys_math3d.c index d676a437cf..45b94d5690 100644 --- a/src/code/sys_math3d.c +++ b/src/code/sys_math3d.c @@ -130,7 +130,7 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/sys_math3d/func_8017D220.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/sys_math3d/func_8017D2FC.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/sys_math3d/Math3D_LineSegVsPlane.s") #pragma GLOBAL_ASM("asm/non_matchings/code/sys_math3d/func_8017D404.s") diff --git a/src/code/z_actor.c b/src/code/z_actor.c index 308fc9c1b2..064ee0a88c 100644 --- a/src/code/z_actor.c +++ b/src/code/z_actor.c @@ -1279,7 +1279,7 @@ f32 Actor_HeightDiff(Actor* actor1, Actor* actor2) { * Sets the current and new inputs. */ void func_800B6F20(GlobalContext* globalCtx, Input* input, f32 magnitude, s16 baseYaw) { - s16 relativeYaw = baseYaw - func_800DFC68(GET_ACTIVE_CAM(globalCtx)); + s16 relativeYaw = baseYaw - Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); input->cur.stick_x = -Math_SinS(relativeYaw) * magnitude; input->rel.stick_x = input->cur.stick_x; @@ -1341,7 +1341,7 @@ void Actor_SetCameraHorseSetting(GlobalContext* globalCtx, Player* player) { EnHorse* rideActor = (EnHorse*)player->rideActor; if ((rideActor != NULL) && !(rideActor->unk_1EC & 0x10)) { - func_800DFAC8(Play_GetCamera(globalCtx, MAIN_CAM), 4); + func_800DFAC8(Play_GetCamera(globalCtx, CAM_ID_MAIN), 4); } } } @@ -3329,7 +3329,7 @@ Actor* Actor_Delete(ActorContext* actorCtx, Actor* actor, GlobalContext* globalC if ((player != NULL) && (actor == player->unk_730)) { func_80123DA4(player); - Camera_ChangeMode(Play_GetCamera(globalCtx, Play_GetActiveCameraIndex(globalCtx)), 0); + Camera_ChangeMode(Play_GetCamera(globalCtx, Play_GetActiveCamId(globalCtx)), 0); } if (actor == actorCtx->targetContext.arrowPointedActor) { diff --git a/src/code/z_bgcheck.c b/src/code/z_bgcheck.c index 7fa1b755bc..3f5583f798 100644 --- a/src/code/z_bgcheck.c +++ b/src/code/z_bgcheck.c @@ -4047,7 +4047,7 @@ u16 func_800C9728(CollisionContext* colCtx, u32 camId, s32 bgId) { return 0; } camData = colHeader->cameraDataList; - result = camData[camId].cameraSType; + result = camData[camId].setting; return result; } @@ -4088,7 +4088,7 @@ u16 func_800C97F8(CollisionContext* colCtx, u32 camId, s32 bgId) { if (camData == NULL) { return 0; } - return camData[camId].unk_02; + return camData[camId].numData; } /** @@ -4114,7 +4114,7 @@ u16 func_800C9844(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { } /** - * CamData get camPosData + * CamData get data */ Vec3s* func_800C98CC(CollisionContext* colCtx, s32 camId, s32 bgId) { CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId); @@ -4127,11 +4127,11 @@ Vec3s* func_800C98CC(CollisionContext* colCtx, s32 camId, s32 bgId) { if (cameraDataList == NULL) { return NULL; } - return Lib_SegmentedToVirtual(cameraDataList[camId].camPosData); + return Lib_SegmentedToVirtual(cameraDataList[camId].data); } /** - * SurfaceType Get camPosData + * SurfaceType Get data */ Vec3s* SurfaceType_GetCamPosData(CollisionContext* colCtx, CollisionPoly* poly, s32 bgId) { CollisionHeader* colHeader = BgCheck_GetCollisionHeader(colCtx, bgId); @@ -4573,7 +4573,7 @@ u16 WaterBox_GetCameraSetting(CollisionContext* colCtx, WaterBox* waterBox, s32 return result; } - result = camData[camId].cameraSType; + result = camData[camId].setting; return result; } diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 1e983c9541..9aef846e0c 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -320,19 +320,19 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFAC8.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFB14.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_ChangeDataIdx.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFC1C.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFC40.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFC68.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_GetInputDirYaw.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFC90.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFCB4.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_GetCamDirPitch.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFCDC.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_GetCamDirYaw.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800DFD04.s") @@ -364,10 +364,10 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E0238.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E02AC.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_SetToTrackActor.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E0308.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_SetTargetActor.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E031C.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/Camera_GetWaterYPos.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_camera/func_800E0348.s") diff --git a/src/code/z_effect_soft_sprite.c b/src/code/z_effect_soft_sprite.c index 11545da016..43307bbc8a 100644 --- a/src/code/z_effect_soft_sprite.c +++ b/src/code/z_effect_soft_sprite.c @@ -255,9 +255,12 @@ void EffectSS_DrawAllParticles(GlobalContext* globalCtx) { for (i = 0; i < sEffectSsInfo.size; i++) { if (sEffectSsInfo.data_table[i].life > -1) { - if ((sEffectSsInfo.data_table[i].pos.x > 32000.0f) || (sEffectSsInfo.data_table[i].pos.x < -32000.0f) || - (sEffectSsInfo.data_table[i].pos.y > 32000.0f) || (sEffectSsInfo.data_table[i].pos.y < -32000.0f) || - (sEffectSsInfo.data_table[i].pos.z > 32000.0f) || (sEffectSsInfo.data_table[i].pos.z < -32000.0f)) { + if ((sEffectSsInfo.data_table[i].pos.x > BGCHECK_Y_MAX) || + (sEffectSsInfo.data_table[i].pos.x < BGCHECK_Y_MIN) || + (sEffectSsInfo.data_table[i].pos.y > BGCHECK_Y_MAX) || + (sEffectSsInfo.data_table[i].pos.y < BGCHECK_Y_MIN) || + (sEffectSsInfo.data_table[i].pos.z > BGCHECK_Y_MAX) || + (sEffectSsInfo.data_table[i].pos.z < BGCHECK_Y_MIN)) { EffectSS_Delete(&sEffectSsInfo.data_table[i]); } else { EffectSS_DrawParticle(globalCtx, i); diff --git a/src/code/z_fireobj.c b/src/code/z_fireobj.c index 02644818f9..c6b6a3f9c1 100644 --- a/src/code/z_fireobj.c +++ b/src/code/z_fireobj.c @@ -157,7 +157,7 @@ void FireObj_Draw(GlobalContext* globalCtx, FireObj* fire) { gDPSetEnvColor(POLY_XLU_DISP++, lightParams->envColor.r, lightParams->envColor.g, lightParams->envColor.b, 0); vec.x = 0; - vec.y = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) + 0x8000; + vec.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000; vec.z = 0; Matrix_SetStateRotationAndTranslation(fire->position.x, fire->position.y, fire->position.z, &vec); Matrix_Scale(fire->xScale, fire->yScale, 1.0f, MTXMODE_APPLY); diff --git a/src/code/z_kaleido_scope_call.c b/src/code/z_kaleido_scope_call.c index b6d46eba16..c3c616669e 100644 --- a/src/code/z_kaleido_scope_call.c +++ b/src/code/z_kaleido_scope_call.c @@ -1,3 +1,4 @@ +#include "prevent_bss_reordering.h" #include "global.h" void (*sKaleidoScopeUpdateFunc)(GlobalContext* globalCtx); diff --git a/src/code/z_lib.c b/src/code/z_lib.c index 84eb8c051c..d9300deda3 100644 --- a/src/code/z_lib.c +++ b/src/code/z_lib.c @@ -371,7 +371,7 @@ void Math_Vec3f_DistXYZAndStoreNormDiff(Vec3f* a, Vec3f* b, f32 scale, Vec3f* de f32 Math_Vec3f_DistXYZ(Vec3f* a, Vec3f* b) { Vec3f diff; Math_Vec3f_Diff(b, a, &diff); - return sqrtf(SQ(diff.x) + SQ(diff.y) + SQ(diff.z)); + return sqrtf(SQXYZ(diff)); } f32 Math_Vec3f_DistXYZAndStoreDiff(Vec3f* a, Vec3f* b, Vec3f* dest) { diff --git a/src/code/z_olib.c b/src/code/z_olib.c index c44fac2767..6f1cdbc552 100644 --- a/src/code/z_olib.c +++ b/src/code/z_olib.c @@ -66,7 +66,7 @@ Vec3f* OLib_Vec3fDistNormalize(Vec3f* dest, Vec3f* a, Vec3f* b) { v1.y = b->y - a->y; v1.z = b->z - a->z; - dist = OLib_ClampMinDist(sqrtf(SQ(v1.x) + SQ(v1.y) + SQ(v1.z)), 0.01f); + dist = OLib_ClampMinDist(sqrtf(SQXYZ(v1)), 0.01f); v2.x = v1.x / dist; v2.y = v1.y / dist; diff --git a/src/code/z_play.c b/src/code/z_play.c index 7e0e018c74..a14359be70 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -74,41 +74,41 @@ #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169474.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801694DC.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CreateSubCamera.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetActiveCameraIndex.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetActiveCamId.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169590.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraChangeStatus.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169600.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_ClearCamera.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169668.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_ClearAllSubCameras.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCamera.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetAtEye.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_8016981C.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetAtEyeUp.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169940.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetFov.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169988.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraSetRoll.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_801699D4.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CopyCamera.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169A50.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169AC0.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraChangeSetting.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169AFC.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169BC4.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_CameraGetUID.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169BF8.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169C64.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCsCamDataSetting.s") -#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/func_80169C84.s") +#pragma GLOBAL_ASM("asm/non_matchings/code/z_play/Play_GetCsCamDataVec3s.s") #pragma GLOBAL_ASM("asm/non_matchings/code/z_play/convert_scene_number_among_shared_scenes.s") diff --git a/src/code/z_quake.c b/src/code/z_quake.c index d38746bf46..ee4fa3a6d6 100644 --- a/src/code/z_quake.c +++ b/src/code/z_quake.c @@ -137,7 +137,7 @@ QuakeRequest* Quake_AddImpl(Camera* camera, u32 callbackIdx) { __osMemset(req, 0, sizeof(QuakeRequest)); req->camera = camera; - req->cameraPtrsIdx = camera->thisIdx; + req->camId = camera->camId; req->callbackIdx = callbackIdx; req->isShakePerpendicular = true; req->randIdx = ((s16)(Rand_ZeroOne() * (f32)0x10000) & ~3) + idx; @@ -326,10 +326,10 @@ s16 Quake_Calc(Camera* camera, QuakeCamCalc* camData) { for (idx = 0; idx < ARRAY_COUNT(sQuakeRequest); idx++) { req = &sQuakeRequest[idx]; if (req->callbackIdx != 0) { - if (globalCtx->cameraPtrs[req->cameraPtrsIdx] == NULL) { + if (globalCtx->cameraPtrs[req->camId] == NULL) { Quake_Remove(req); } else { - eq = (camera->thisIdx != req->camera->thisIdx); + eq = (camera->camId != req->camera->camId); absSpeedDiv = ABS(req->speed) / (f32)0x8000; if (sQuakeCallbacks[req->callbackIdx](req, &shake) == 0) { Quake_Remove(req); diff --git a/src/code/z_scene.c b/src/code/z_scene.c index ce75624d3d..6e47936612 100644 --- a/src/code/z_scene.c +++ b/src/code/z_scene.c @@ -179,7 +179,7 @@ void Scene_HeaderCmdActorList(GlobalContext* globalCtx, SceneCmd* cmd) { // SceneTableEntry Header Command 0x02: List of cameras for actor cutscenes void Scene_HeaderCmdActorCutsceneCamList(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->unk_18858 = (UNK_PTR)Lib_SegmentedToVirtual(cmd->csCameraList.segment); + globalCtx->csCamData = Lib_SegmentedToVirtual(cmd->csCameraList.segment); } // SceneTableEntry Header Command 0x03: Collision Header @@ -374,8 +374,8 @@ void Scene_HeaderCmdSkyboxSettings(GlobalContext* globalCtx, SceneCmd* cmd) { // SceneTableEntry Header Command 0x12: Skybox Disables void Scene_HeaderCmdSkyboxDisables(GlobalContext* globalCtx, SceneCmd* cmd) { - globalCtx->envCtx.unk_15 = cmd->skyboxDisables.unk4; - globalCtx->envCtx.unk_16 = cmd->skyboxDisables.unk5; + globalCtx->envCtx.skyboxDisabled = cmd->skyboxDisables.unk4; + globalCtx->envCtx.sunMoonDisabled = cmd->skyboxDisables.unk5; } // SceneTableEntry Header Command 0x10: Time Settings diff --git a/src/code/z_shrink_window.c b/src/code/z_shrink_window.c index 194ee50839..5bfca86d92 100644 --- a/src/code/z_shrink_window.c +++ b/src/code/z_shrink_window.c @@ -2,6 +2,7 @@ * File: z_shrink_window.c * Description: Draws black top/bottom/side borders on the viewing window (e.g. Z-targeting, talking to NPC) */ +#include "prevent_bss_reordering.h" #include "global.h" ShrinkWindowContext gShrinkWindowContext; diff --git a/src/code/z_snap.c b/src/code/z_snap.c index 639505aece..bce1f67d7b 100644 --- a/src/code/z_snap.c +++ b/src/code/z_snap.c @@ -114,21 +114,19 @@ s32 func_8013A530(GlobalContext* globalCtx, Actor* actor, s32 flag, Vec3f* pos, s16 y; f32 distance; CollisionPoly* poly; - Camera* camera; + Camera* camera = GET_ACTIVE_CAM(globalCtx); Actor* actors[2]; s32 ret = 0; s32 bgId; - camera = GET_ACTIVE_CAM(globalCtx); - distance = OLib_Vec3fDist(pos, &camera->eye); if ((distance < distanceMin) || (distanceMax < distance)) { func_8013A41C(0x3F); ret = 0x3F; } - x = func_8013A504(func_800DFCB4(camera) + rot->x); - y = func_8013A504(func_800DFCDC(camera) - (s16)(rot->y - 0x7FFF)); + x = func_8013A504(Camera_GetCamDirPitch(camera) + rot->x); + y = func_8013A504(Camera_GetCamDirYaw(camera) - BINANG_SUB(rot->y, 0x7FFF)); if ((0 < angleError) && ((angleError < x) || (angleError < y))) { func_8013A41C(0x3E); ret |= 0x3E; diff --git a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c index 9c6bae33b8..0094052388 100644 --- a/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c +++ b/src/overlays/actors/ovl_Arms_Hook/z_arms_hook.c @@ -170,7 +170,8 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { } else { if (this->actor.child != NULL) { f32 sp94 = Actor_DistanceBetweenActors(&this->actor, grabbed); - f32 sp90 = sqrtf(SQ(this->unk1FC.x) + SQ(this->unk1FC.y) + SQ(this->unk1FC.z)); + f32 sp90 = sqrtf(SQXYZ(this->unk1FC)); + Math_Vec3f_Diff(&grabbed->world.pos, &this->unk1FC, &this->actor.world.pos); if (50.0f < (sp94 - sp90)) { ArmsHook_DetachHookFromActor(this); @@ -217,8 +218,7 @@ void ArmsHook_Shoot(ArmsHook* this, GlobalContext* globalCtx) { } } else { Math_Vec3f_Diff(&bodyDistDiffVec, &newPos, &player->actor.velocity); - player->actor.world.rot.x = - Math_FAtan2F(sqrtf(SQ(bodyDistDiffVec.x) + SQ(bodyDistDiffVec.z)), -bodyDistDiffVec.y); + player->actor.world.rot.x = Math_FAtan2F(sqrtf(SQXZ(bodyDistDiffVec)), -bodyDistDiffVec.y); } if (phi_f16 < 50.0f) { ArmsHook_DetachHookFromActor(this); diff --git a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c index f63442b1e7..53ddd7b81d 100644 --- a/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c +++ b/src/overlays/actors/ovl_Bg_Ctower_Rot/z_bg_ctower_rot.c @@ -91,7 +91,7 @@ void BgCtowerRot_CorridorRotate(BgCtowerRot* this, GlobalContext* globalCtx) { rotZtmp = CLAMP_MAX(1100.0f - offset.z, 1000.0f); rotZ = rotZtmp; } - func_800DFAC8(globalCtx->cameraPtrs[MAIN_CAM], 17); + func_800DFAC8(globalCtx->cameraPtrs[CAM_ID_MAIN], 17); this->dyna.actor.shape.rot.z = rotZ * 16.384f; if (globalCtx->csCtx.frames == 132) { play_sound(NA_SE_SY_SPIRAL_DASH); diff --git a/src/overlays/actors/ovl_Boss_02/z_boss_02.c b/src/overlays/actors/ovl_Boss_02/z_boss_02.c index d861e1cb19..9a519eb6e2 100644 --- a/src/overlays/actors/ovl_Boss_02/z_boss_02.c +++ b/src/overlays/actors/ovl_Boss_02/z_boss_02.c @@ -1651,9 +1651,9 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { case 0: if (player->stateFlags1 & 0x100) { func_800EA0D4(globalCtx, &globalCtx->csCtx); - this->unk_1D22 = func_801694DC(globalCtx); - func_80169590(globalCtx, 0, 1); - func_80169590(globalCtx, this->unk_1D22, 7); + this->unk_1D22 = Play_CreateSubCamera(globalCtx); + Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(globalCtx, this->unk_1D22, 7); func_8016566C(150); this->unk_1D14 = 0; this->unk_1D5C = 0.0f; @@ -2048,7 +2048,7 @@ void func_809DD934(Boss02* this, GlobalContext* globalCtx) { this->unk_1D54 = Math_SinS(this->unk_1D14 * 1512) * this->unk_1D58; Matrix_InsertZRotation_f(this->unk_1D54, MTXMODE_APPLY); Matrix_GetStateTranslationAndScaledY(1.0f, &this->unk_1D3C); - func_8016981C(globalCtx, this->unk_1D22, &this->unk_1D30, &this->unk_1D24, &this->unk_1D3C); + Play_CameraSetAtEyeUp(globalCtx, this->unk_1D22, &this->unk_1D30, &this->unk_1D24, &this->unk_1D3C); ShrinkWindow_SetLetterboxTarget(0x1B); } } @@ -2078,9 +2078,9 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { break; } func_800EA0D4(globalCtx, &globalCtx->csCtx); - this->unk_1D22 = func_801694DC(globalCtx); - func_80169590(globalCtx, 0, 1); - func_80169590(globalCtx, this->unk_1D22, 7); + this->unk_1D22 = Play_CreateSubCamera(globalCtx); + Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(globalCtx, this->unk_1D22, 7); this->unk_1D20 = 2; this->unk_1D1C = 0; @@ -2176,9 +2176,9 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { case 100: if (ActorCutscene_GetCurrentIndex() == -1) { func_800EA0D4(globalCtx, &globalCtx->csCtx); - this->unk_1D22 = func_801694DC(globalCtx); - func_80169590(globalCtx, 0, 1); - func_80169590(globalCtx, this->unk_1D22, 7); + this->unk_1D22 = Play_CreateSubCamera(globalCtx); + Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(globalCtx, this->unk_1D22, 7); this->unk_1D20 = 101; this->unk_1D1C = 0; this->unk_1D5C = 1.0f; @@ -2260,7 +2260,7 @@ void func_809DEAC4(Boss02* this, GlobalContext* globalCtx) { if ((this->unk_1D20 != 0) && (this->unk_1D22 != 0)) { sp5C = this->unk_1D24; sp5C.y += sp58 * D_809DF5B0; - func_8016981C(globalCtx, this->unk_1D22, &this->unk_1D30, &sp5C, &this->unk_1D3C); + Play_CameraSetAtEyeUp(globalCtx, this->unk_1D22, &this->unk_1D30, &sp5C, &this->unk_1D3C); this->unk_1D3C.z = this->unk_1D3C.x = 0.0f; this->unk_1D3C.y = 1.0f; ShrinkWindow_SetLetterboxTarget(0x1B); diff --git a/src/overlays/actors/ovl_Boss_04/z_boss_04.c b/src/overlays/actors/ovl_Boss_04/z_boss_04.c index eb7b02ada1..72a397d068 100644 --- a/src/overlays/actors/ovl_Boss_04/z_boss_04.c +++ b/src/overlays/actors/ovl_Boss_04/z_boss_04.c @@ -260,9 +260,9 @@ void func_809EC568(Boss04* this, GlobalContext* globalCtx) { this->unk_708 = 10; this->unk_704 = 0; func_800EA0D4(globalCtx, &globalCtx->csCtx); - this->unk_70A = func_801694DC(globalCtx); - func_80169590(globalCtx, 0, 1); - func_80169590(globalCtx, this->unk_70A, 7); + this->unk_70A = Play_CreateSubCamera(globalCtx); + Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(globalCtx, this->unk_70A, 7); func_800B7298(globalCtx, &this->actor, 7); player->actor.world.pos.x = this->unk_6E8; player->actor.world.pos.z = this->unk_6F0 + 410.0f; @@ -380,7 +380,7 @@ void func_809EC568(Boss04* this, GlobalContext* globalCtx) { } if (this->unk_704 > 140) { - Camera* sp5C = Play_GetCamera(globalCtx, MAIN_CAM); + Camera* sp5C = Play_GetCamera(globalCtx, CAM_ID_MAIN); this->unk_708 = 0; func_809ECD00(this, globalCtx); @@ -407,7 +407,7 @@ void func_809EC568(Boss04* this, GlobalContext* globalCtx) { Math_Vec3f_Copy(&sp50, &this->unk_718); sp50.y += Math_SinS(this->unk_748 * 0x4000) * this->unk_748 * 1.5f; Play_CameraSetAtEye(globalCtx, this->unk_70A, &sp50, &this->unk_70C); - func_80169940(globalCtx, this->unk_70A, this->unk_744); + Play_CameraSetFov(globalCtx, this->unk_70A, this->unk_744); Math_ApproachF(&this->unk_744, 60.0f, 0.1f, 1.0f); } this->actor.shape.rot.y = this->actor.yawTowardsPlayer; diff --git a/src/overlays/actors/ovl_Boss_06/z_boss_06.c b/src/overlays/actors/ovl_Boss_06/z_boss_06.c index 9461dbeb0c..0040f26fa5 100644 --- a/src/overlays/actors/ovl_Boss_06/z_boss_06.c +++ b/src/overlays/actors/ovl_Boss_06/z_boss_06.c @@ -199,9 +199,9 @@ void func_809F24C8(Boss06* this, GlobalContext* globalCtx) { func_800EA0D4(globalCtx, &globalCtx->csCtx); func_800B7298(globalCtx, &this->actor, 7); - this->unk_A00 = func_801694DC(globalCtx); - func_80169590(globalCtx, 0, 1); - func_80169590(globalCtx, this->unk_A00, 7); + this->unk_A00 = Play_CreateSubCamera(globalCtx); + Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(globalCtx, this->unk_A00, 7); D_809F4970->unk_151 = 1; this->unk_1C9 = 1; this->unk_1C8 = 1; diff --git a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c index 028daa2ec2..629ec5668e 100644 --- a/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c +++ b/src/overlays/actors/ovl_Demo_Kankyo/z_demo_kankyo.c @@ -518,7 +518,7 @@ void DemoKakyo_DrawLostWoodsSparkle(Actor* thisx, GlobalContext* globalCtx2) { Vec3f screenPos; // if not underwater - if (!(globalCtx->cameraPtrs[MAIN_CAM]->flags2 & 0x100)) { + if (!(globalCtx->cameraPtrs[CAM_ID_MAIN]->flags2 & 0x100)) { OPEN_DISPS(globalCtx->state.gfxCtx); POLY_XLU_DISP = Gfx_CallSetupDL(POLY_XLU_DISP, 20); diff --git a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c index 70bd7e1c0d..85a7a9bc86 100644 --- a/src/overlays/actors/ovl_Door_Ana/z_door_ana.c +++ b/src/overlays/actors/ovl_Door_Ana/z_door_ana.c @@ -205,7 +205,7 @@ void DoorAna_Update(Actor* thisx, GlobalContext* globalCtx) { DoorAna* this = THIS; this->actionFunc(this, globalCtx); - this->actor.shape.rot.y = BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))); + this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); } void DoorAna_Draw(Actor* thisx, GlobalContext* globalCtx) { 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 630b90bdfa..e28e05a16b 100644 --- a/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c +++ b/src/overlays/actors/ovl_Door_Shutter/z_door_shutter.c @@ -405,7 +405,7 @@ void func_808A1288(DoorShutter* this, GlobalContext* globalCtx) { this->unk_164 = sp38; this->unk_168 = 0.0f; - func_800DFFAC(globalCtx->cameraPtrs[MAIN_CAM], &this->actor, player->unk_3BA, this->unk_168, 12, sp34, 10); + func_800DFFAC(globalCtx->cameraPtrs[CAM_ID_MAIN], &this->actor, player->unk_3BA, this->unk_168, 12, sp34, 10); } } diff --git a/src/overlays/actors/ovl_En_Al/z_en_al.c b/src/overlays/actors/ovl_En_Al/z_en_al.c index 6d1d65db26..98ba1c91fc 100644 --- a/src/overlays/actors/ovl_En_Al/z_en_al.c +++ b/src/overlays/actors/ovl_En_Al/z_en_al.c @@ -319,7 +319,8 @@ s32 func_80BDE7FC(EnAl* this, GlobalContext* globalCtx) { case 6: case 8: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), + this->actor.child); } this->unk_4E6++; sp20 = true; @@ -329,7 +330,7 @@ s32 func_80BDE7FC(EnAl* this, GlobalContext* globalCtx) { case 3: case 5: case 7: - func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); this->unk_4E6++; sp20 = true; break; diff --git a/src/overlays/actors/ovl_En_Ani/z_en_ani.c b/src/overlays/actors/ovl_En_Ani/z_en_ani.c index d2320bfd60..00bf054619 100644 --- a/src/overlays/actors/ovl_En_Ani/z_en_ani.c +++ b/src/overlays/actors/ovl_En_Ani/z_en_ani.c @@ -308,8 +308,8 @@ void EnAni_Update(Actor* thisx, GlobalContext* globalCtx) { } else if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); this->actor.cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); - func_800E02AC(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->actor.cutscene)), - &this->actor); + Camera_SetToTrackActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->actor.cutscene)), + &this->actor); } else { ActorCutscene_SetIntentToPlay(this->actor.cutscene); } diff --git a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c index 2ce46e1ed2..4eeeb3894f 100644 --- a/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c +++ b/src/overlays/actors/ovl_En_Bigpo/z_en_bigpo.c @@ -271,7 +271,7 @@ void EnBigpo_UpdateSpin(EnBigpo* this) { void EnBigpo_LowerCutsceneSubCamera(EnBigpo* this, GlobalContext* globalContext) { Camera* subCam; - if (this->cutsceneSubCamId != SUBCAM_FREE) { + if (this->cutsceneSubCamId != CAM_ID_MAIN) { subCam = Play_GetCamera(globalContext, this->cutsceneSubCamId); subCam->eye.y -= this->actor.velocity.y; if (this->actor.velocity.y > 0.0f) { @@ -332,7 +332,7 @@ void EnBigpo_SpawnCutsceneStage1(EnBigpo* this, GlobalContext* globalCtx) { this->actor.scale.y = 0.015f; this->actor.scale.z = 0.0f; - if (this->cutsceneSubCamId != SUBCAM_FREE) { + if (this->cutsceneSubCamId != CAM_ID_MAIN) { Vec3f subCamEye; subCamEye.x = ((this->actor.world.pos.x - this->fires[0].pos.x) * 1.8f) + this->actor.world.pos.x; @@ -460,8 +460,8 @@ void EnBigpo_SpawnCutsceneStage8(EnBigpo* this, GlobalContext* globalCtx) { this->idleTimer--; if (this->idleTimer == 0) { subCam = Play_GetCamera(globalCtx, this->cutsceneSubCamId); - Play_CameraSetAtEye(globalCtx, MAIN_CAM, &subCam->at, &subCam->eye); - this->cutsceneSubCamId = SUBCAM_FREE; + Play_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &subCam->at, &subCam->eye); + this->cutsceneSubCamId = CAM_ID_MAIN; if (this->actor.params == ENBIGPO_SUMMONED) { dampe = SubS_FindActor(globalCtx, NULL, ACTORCAT_NPC, ACTOR_EN_TK); if (dampe != NULL) { @@ -683,25 +683,25 @@ void EnBigpo_SetupDeath(EnBigpo* this) { void EnBigpo_BurnAwayDeath(EnBigpo* this, GlobalContext* globalCtx) { Vec3f tempVec; f32 unkTemp2; // dont really know what these unktemps are doing - s16 cam; + s16 camYaw; s16 unkTemp; s16 modifiedTimer; this->idleTimer++; if (this->idleTimer < 8) { - cam = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) + 0x4800; + camYaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800; if (this->idleTimer < 5) { unkTemp = (this->idleTimer << 0xC) - 0x4000; // 1.4.0...1 is NOT 1.4, the rodata demands it tempVec.y = (((Math_SinS(unkTemp) * 23.0f) + 40.0f) * 1.4000001f) + this->actor.world.pos.y; unkTemp2 = Math_CosS(unkTemp) * 32.2f; - tempVec.x = (Math_SinS(cam) * unkTemp2) + this->actor.world.pos.x; - tempVec.z = (Math_CosS(cam) * unkTemp2) + this->actor.world.pos.z; + tempVec.x = (Math_SinS(camYaw) * unkTemp2) + this->actor.world.pos.x; + tempVec.z = (Math_CosS(camYaw) * unkTemp2) + this->actor.world.pos.z; } else { tempVec.y = this->actor.world.pos.y + ((40.0f + (15.0f * (this->idleTimer - 5))) * 1.4000001f); - tempVec.x = (Math_SinS(cam) * 32.2f) + this->actor.world.pos.x; - tempVec.z = (Math_CosS(cam) * 32.2f) + this->actor.world.pos.z; + tempVec.x = (Math_SinS(camYaw) * 32.2f) + this->actor.world.pos.x; + tempVec.z = (Math_CosS(camYaw) * 32.2f) + this->actor.world.pos.z; } // not sure what we're turning this into, but its based on the timer @@ -955,7 +955,7 @@ void EnBigpo_SetupFlameCirclePositions(EnBigpo* this, GlobalContext* globalCtx) } // Setup sub camera - if (this->cutsceneSubCamId != SUBCAM_FREE) { + if (this->cutsceneSubCamId != CAM_ID_MAIN) { subCamEye.x = (Math_SinS(this->actor.yawTowardsPlayer) * 360.0f) + this->actor.world.pos.x; subCamEye.y = this->actor.world.pos.y + 150.0f; subCamEye.z = (Math_CosS(this->actor.yawTowardsPlayer) * 360.0f) + this->actor.world.pos.z; @@ -1219,7 +1219,7 @@ void EnBigpo_Update(Actor* thisx, GlobalContext* globalCtx) { void EnBigpo_UpdateFire(Actor* thisx, GlobalContext* globalCtx) { EnBigpo* this = THIS; - this->actor.shape.rot.y = BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))); + this->actor.shape.rot.y = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); this->actionFunc(this, globalCtx); } @@ -1350,7 +1350,7 @@ void EnBigpo_DrawScoopSoul(Actor* thisx, GlobalContext* globalCtx) { this->actor.world.pos.z, this->mainColor.r, this->mainColor.g, this->mainColor.b, this->mainColor.a * 2); - Matrix_RotateY(BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))), MTXMODE_APPLY); + Matrix_RotateY(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); @@ -1430,7 +1430,7 @@ void EnBigpo_DrawCircleFlames(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx); func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_RotateY(BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))), MTXMODE_NEW); + Matrix_RotateY(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), MTXMODE_NEW); if (this->actionFunc == EnBigpo_SpawnCutsceneStage6) { Matrix_Scale(0.01f, 0.01f, 0.01f, MTXMODE_APPLY); fireRadius = 500; diff --git a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c index 97f687dad5..8c72d369c9 100644 --- a/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c +++ b/src/overlays/actors/ovl_En_Bigslime/z_en_bigslime.c @@ -843,10 +843,10 @@ void EnBigslime_UpdateCameraFormingBigslime(EnBigslime* this, GlobalContext* glo void EnBigslime_EndCutscene(EnBigslime* this, GlobalContext* globalCtx) { Camera* subCam; - if (this->subCamId != MAIN_CAM) { + if (this->subCamId != CAM_ID_MAIN) { subCam = Play_GetCamera(globalCtx, this->subCamId); - Play_CameraSetAtEye(globalCtx, MAIN_CAM, &subCam->at, &subCam->eye); - this->subCamId = MAIN_CAM; + Play_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &subCam->at, &subCam->eye); + this->subCamId = CAM_ID_MAIN; ActorCutscene_Stop(this->cutscene); this->cutscene = ActorCutscene_GetAdditionalCutscene(this->actor.cutscene); func_800B724C(globalCtx, &this->actor, 6); @@ -1019,7 +1019,7 @@ void EnBigslime_SetupMoveOnCeiling(EnBigslime* this) { this->actor.gravity = 0.0f; this->actor.velocity.y = 20.0f; - if (this->subCamId != MAIN_CAM) { + if (this->subCamId != CAM_ID_MAIN) { this->actor.speedXZ = 0.0f; this->ceilingMoveTimer = 20; } else { @@ -1043,7 +1043,7 @@ void EnBigslime_MoveOnCeiling(EnBigslime* this, GlobalContext* globalCtx) { EnBigslime_Scale(this, pitch, 0.04f, 0.04f); EnBigslime_UpdateWavySurface(this); - if (this->subCamId != MAIN_CAM) { + if (this->subCamId != CAM_ID_MAIN) { if (this->ceilingMoveTimer == 0) { EnBigslime_EndCutscene(this, globalCtx); this->ceilingMoveTimer = 320; @@ -1493,7 +1493,7 @@ void EnBigslime_Rise(EnBigslime* this, GlobalContext* globalCtx) { } void EnBigslime_SetupCutsceneGrabPlayer(EnBigslime* this, GlobalContext* globalCtx) { - Camera* mainCam = Play_GetCamera(globalCtx, MAIN_CAM); + Camera* mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); s16 yaw; Play_CameraSetAtEye(globalCtx, this->subCamId, &mainCam->at, &mainCam->eye); @@ -1501,7 +1501,7 @@ void EnBigslime_SetupCutsceneGrabPlayer(EnBigslime* this, GlobalContext* globalC this->wavySurfaceTimer = 0; this->bigslimeCollider[0].base.atFlags &= ~AT_ON; this->actor.world.rot.y = Actor_YawToPoint(&this->actor, &this->actor.home.pos); - yaw = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) - this->actor.world.rot.y; + yaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - this->actor.world.rot.y; if (yaw > 0x4000) { this->subCamYawGrabPlayer = -0x2000; @@ -2423,7 +2423,7 @@ void EnBigslime_SetupFrogSpawn(EnBigslime* this, GlobalContext* globalCtx) { Vec3f* worldPos; Vec3f dustPos; Vec3f hahenVel; - s16 yaw = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)); + s16 yaw = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); s16 yawReverse = yaw + 0x8000; s32 i; 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 c0379f33cd..7bd4fa89f2 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 @@ -249,8 +249,8 @@ void func_809C4DA4(EnBomBowlMan* this, GlobalContext* globalCtx) { case 0: this->unk_2C0 = 1; D_809C6104 = 1; - func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->unk_2D0)), - &this->unk_2D8[0]->actor); + Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->unk_2D0)), + &this->unk_2D8[0]->actor); this->unk_2D4 = 0; this->unk_2BC = 10; func_809C493C(this, 17, 1.0f); @@ -580,7 +580,7 @@ void func_809C5BF4(EnBomBowlMan* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); func_801477B4(globalCtx); - func_800E0308(sp28, &this->unk_2D8[0]->actor); + Camera_SetTargetActor(sp28, &this->unk_2D8[0]->actor); func_809C493C(this, 13, 1.0f); D_809C6100 = 0; if (player->transformation == PLAYER_FORM_HUMAN) { @@ -595,7 +595,7 @@ void func_809C5BF4(EnBomBowlMan* this, GlobalContext* globalCtx) { } else { s32 idx = D_809C6100 - 1; - func_800E0308(sp28, &this->unk_2D8[1 + idx]->actor); + Camera_SetTargetActor(sp28, &this->unk_2D8[1 + idx]->actor); } } } diff --git a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c index ab9f8534fd..6bb4827ae2 100644 --- a/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c +++ b/src/overlays/actors/ovl_En_Bomjima/z_en_bomjima.c @@ -469,8 +469,8 @@ void func_80BFF03C(EnBomjima* this, GlobalContext* globalCtx) { } else { player->stateFlags1 &= ~0x20; gSaveContext.weekEventReg[83] &= (u8)~4; - this->actor.world.rot.y = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)); - this->unk_2DC = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)); + this->actor.world.rot.y = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); + this->unk_2DC = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)); ActorCutscene_StartAndSetUnkLinkFields(this->unk_2D4[0], &this->actor); func_80BFF120(this); } 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 6124209953..2992f356e1 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 @@ -521,7 +521,7 @@ void EnClearTag_Init(Actor* thisx, GlobalContext* globalCtx) { void EnClearTag_UpdateCamera(EnClearTag* this, GlobalContext* globalCtx) { Player* player = GET_PLAYER(globalCtx); - Camera* camera; + Camera* mainCam; s32 pad; switch (this->cameraState) { @@ -545,17 +545,17 @@ void EnClearTag_UpdateCamera(EnClearTag* this, GlobalContext* globalCtx) { break; case 1: func_800EA0D4(globalCtx, &globalCtx->csCtx); - this->camId = func_801694DC(globalCtx); - func_80169590(globalCtx, 0, 1); - func_80169590(globalCtx, this->camId, 7); + this->subCamId = Play_CreateSubCamera(globalCtx); + Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(globalCtx, this->subCamId, 7); func_800B7298(globalCtx, &this->actor, 4); - camera = Play_GetCamera(globalCtx, MAIN_CAM); - this->eye.x = camera->eye.x; - this->eye.y = camera->eye.y; - this->eye.z = camera->eye.z; - this->at.x = camera->at.x; - this->at.y = camera->at.y; - this->at.z = camera->at.z; + mainCam = Play_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; func_801518B0(globalCtx, 0xF, NULL); this->cameraState = 2; func_8019FDC8(&D_801DB4A4, NA_SE_VO_NA_LISTEN, 0x20); @@ -568,22 +568,22 @@ void EnClearTag_UpdateCamera(EnClearTag* this, GlobalContext* globalCtx) { player->actor.speedXZ = 0.0f; if (Message_GetState(&globalCtx->msgCtx) == 0) { - camera = Play_GetCamera(globalCtx, MAIN_CAM); - camera->eye = this->eye; - camera->eyeNext = this->eye; - camera->at = this->at; - func_80169AFC(globalCtx, this->camId, 0); + mainCam = Play_GetCamera(globalCtx, CAM_ID_MAIN); + mainCam->eye = this->subCamEye; + mainCam->eyeNext = this->subCamEye; + mainCam->at = this->subCamAt; + func_80169AFC(globalCtx, this->subCamId, 0); func_800EA0EC(globalCtx, &globalCtx->csCtx); func_800B7298(globalCtx, &this->actor, 6); this->cameraState = 0; - this->camId = 0; + this->subCamId = CAM_ID_MAIN; this->activeTimer = 20; } break; } - if (this->camId != 0) { - Play_CameraSetAtEye(globalCtx, this->camId, &this->at, &this->eye); + if (this->subCamId != CAM_ID_MAIN) { + Play_CameraSetAtEye(globalCtx, this->subCamId, &this->subCamAt, &this->subCamEye); } } 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 453e6c0ac2..61c4a638bd 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 @@ -45,10 +45,10 @@ typedef struct EnClearTag { /* 0x2E54 */ u8 cameraState; /* 0x2E56 */ s16 activeTimer; // Actor Marked for Death when timer runs out /* 0x2E58 */ UNK_TYPE1 unk2E58[0xC]; - /* 0x2E64 */ s16 camId; + /* 0x2E64 */ s16 subCamId; /* 0x2E66 */ Color_RGBA8 flashEnvColor; - /* 0x2E6C */ Vec3f eye; // Camera eye - /* 0x2E78 */ Vec3f at; // Camera lookAt + /* 0x2E6C */ Vec3f subCamEye; + /* 0x2E78 */ Vec3f subCamAt; } EnClearTag; // size = 0x2E84 extern const ActorInit En_Clear_Tag_InitVars; diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c index 16474e92a8..dcb3b98531 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.c @@ -363,11 +363,11 @@ void func_8089A9B0(EnDinofos* this, GlobalContext* globalCtx) { } void func_8089ABF4(EnDinofos* this, GlobalContext* globalCtx) { - if (this->camId != 0) { - Camera* camera = Play_GetCamera(globalCtx, this->camId); + if (this->subCamId != CAM_ID_MAIN) { + Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); - Play_CameraSetAtEye(globalCtx, 0, &camera->at, &camera->eye); - this->camId = 0; + Play_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &subCam->at, &subCam->eye); + this->subCamId = CAM_ID_MAIN; ActorCutscene_Stop(this->actor.cutscene); if (this->actor.colChkInfo.health == 0) { func_800B724C(globalCtx, &this->actor, 6); @@ -462,14 +462,14 @@ s32 func_8089AE00(EnDinofos* this, GlobalContext* globalCtx) { } void func_8089B100(EnDinofos* this, GlobalContext* globalCtx) { - Camera* camera = Play_GetCamera(globalCtx, this->camId); + Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); Player* player = GET_PLAYER(globalCtx); Vec3f sp3C; Animation_Change(&this->skelAnime, &object_dinofos_Anim_001CCC, 1.0f, Animation_GetLastFrame(&object_dinofos_Anim_001CCC), Animation_GetLastFrame(&object_dinofos_Anim_001CCC), 2, 0.0f); - func_800BE33C(&camera->eye, &camera->at, &this->unk_29A, true); + func_800BE33C(&subCam->eye, &subCam->at, &this->unk_29A, true); Math_Vec3f_Diff(&this->actor.world.pos, &player->actor.world.pos, &sp3C); this->unk_2BC.x = player->actor.world.pos.x + (0.4f * sp3C.x); this->unk_2BC.y = player->actor.world.pos.y + 5.0f; @@ -477,19 +477,19 @@ void func_8089B100(EnDinofos* this, GlobalContext* globalCtx) { this->unk_2C8.x = this->actor.world.pos.x; this->unk_2C8.y = this->actor.focus.pos.y - 400.0f; this->unk_2C8.z = this->actor.world.pos.z; - this->unk_2AC = Math_Vec3f_DistXYZ(&camera->eye, &this->unk_2BC) * 0.05f; - this->unk_2A8 = Math_Vec3f_DistXYZ(&camera->at, &this->unk_2C8) * 0.05f; + this->unk_2AC = Math_Vec3f_DistXYZ(&subCam->eye, &this->unk_2BC) * 0.05f; + this->unk_2A8 = Math_Vec3f_DistXYZ(&subCam->at, &this->unk_2C8) * 0.05f; this->unk_290 = 20; this->actionFunc = func_8089B288; } void func_8089B288(EnDinofos* this, GlobalContext* globalCtx) { - Camera* camera = Play_GetCamera(globalCtx, this->camId); + Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); this->unk_290--; - Math_Vec3f_StepTo(&camera->eye, &this->unk_2BC, this->unk_2AC); - Math_Vec3f_StepTo(&camera->at, &this->unk_2C8, this->unk_2A8); - Play_CameraSetAtEye(globalCtx, this->camId, &camera->at, &camera->eye); + Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, this->unk_2AC); + Math_Vec3f_StepTo(&subCam->at, &this->unk_2C8, this->unk_2A8); + Play_CameraSetAtEye(globalCtx, this->subCamId, &subCam->at, &subCam->eye); if (this->unk_290 == 0) { func_8089B320(this); } @@ -506,24 +506,24 @@ void func_8089B320(EnDinofos* this) { } void func_8089B3D4(EnDinofos* this, GlobalContext* globalCtx) { - Camera* camera = Play_GetCamera(globalCtx, this->camId); - Vec3f sp28; + Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); + Vec3f subCamAt; - Math_Vec3f_StepTo(&camera->eye, &this->unk_2BC, 10.0f); + Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, 10.0f); this->unk_290++; if (this->unk_290 == 10) { func_801A2E54(NA_BGM_MINI_BOSS); } - sp28.x = this->actor.world.pos.x; - sp28.z = this->actor.world.pos.z; - if (this->actor.focus.pos.y <= camera->at.y) { - sp28.y = this->actor.focus.pos.y; + subCamAt.x = this->actor.world.pos.x; + subCamAt.z = this->actor.world.pos.z; + if (this->actor.focus.pos.y <= subCam->at.y) { + subCamAt.y = this->actor.focus.pos.y; } else { - sp28.y = camera->at.y; + subCamAt.y = subCam->at.y; } - Play_CameraSetAtEye(globalCtx, this->camId, &sp28, &camera->eye); + Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCam->eye); if (this->actor.bgCheckFlags & 1) { func_8089B4A4(this); } @@ -544,11 +544,11 @@ void func_8089B4A4(EnDinofos* this) { } void func_8089B580(EnDinofos* this, GlobalContext* globalCtx) { - Camera* camera = Play_GetCamera(globalCtx, this->camId); + Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); this->unk_290++; if (this->unk_290 < 8) { - Play_CameraSetAtEye(globalCtx, this->camId, &this->actor.focus.pos, &camera->eye); + Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.focus.pos, &subCam->eye); } if (this->skelAnime.curFrame > 35.0f) { @@ -556,8 +556,8 @@ void func_8089B580(EnDinofos* this, GlobalContext* globalCtx) { globalCtx->envCtx.unk_C3 = 11; } - Math_Vec3f_StepTo(&camera->eye, &this->unk_2BC, 10.0f); - Play_CameraSetAtEye(globalCtx, this->camId, &this->actor.focus.pos, &camera->eye); + Math_Vec3f_StepTo(&subCam->eye, &this->unk_2BC, 10.0f); + Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.focus.pos, &subCam->eye); if (this->skelAnime.curFrame <= 55.0f) { func_800B9010(&this->actor, NA_SE_EN_DODO_J_FIRE - SFX_FLAG); } @@ -1201,7 +1201,7 @@ void func_8089D2E0(EnDinofos* this) { } void func_8089D318(EnDinofos* this, GlobalContext* globalCtx) { - Vec3f sp24; + Vec3f subCamEye; if (ActorCutscene_GetCanPlayNext(this->actor.cutscene)) { if (this->actor.colChkInfo.health == 0) { @@ -1210,12 +1210,12 @@ void func_8089D318(EnDinofos* this, GlobalContext* globalCtx) { } else { ActorCutscene_StartAndSetUnkLinkFields(this->actor.cutscene, &this->actor); } - this->camId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); + this->subCamId = ActorCutscene_GetCurrentCamera(this->actor.cutscene); if (this->actor.colChkInfo.health == 0) { - sp24.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.x; - sp24.y = this->actor.focus.pos.y; - sp24.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.z; - Play_CameraSetAtEye(globalCtx, this->camId, &this->actor.focus.pos, &sp24); + subCamEye.x = (Math_SinS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.x; + subCamEye.y = this->actor.focus.pos.y; + subCamEye.z = (Math_CosS(this->actor.shape.rot.y) * 150.0f) + this->actor.focus.pos.z; + Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.focus.pos, &subCamEye); func_8089CFAC(this); } else { func_8089B100(this, globalCtx); diff --git a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h index e6a00853e1..961780b942 100644 --- a/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h +++ b/src/overlays/actors/ovl_En_Dinofos/z_en_dinofos.h @@ -22,7 +22,7 @@ typedef struct EnDinofos { /* 0x290 */ s16 unk_290; /* 0x292 */ s16 unk_292; /* 0x294 */ UNK_TYPE1 unk_294[4]; - /* 0x298 */ s16 camId; + /* 0x298 */ s16 subCamId; /* 0x29A */ Vec3s unk_29A; /* 0x2A0 */ s32 unk_2A0; /* 0x2A4 */ f32 unk_2A4; diff --git a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c index 699c862a84..1eb5838ca5 100644 --- a/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c +++ b/src/overlays/actors/ovl_En_Fishing/z_en_fishing.c @@ -2898,7 +2898,7 @@ void EnFishing_UpdateFish(Actor* thisx, GlobalContext* globalCtx2) { sp118 = (player->actor.speedXZ * 0.3f) + 0.25f; } - if ((D_80917200 != 0) || (sCameraId != MAIN_CAM) || + if ((D_80917200 != 0) || (sCameraId != CAM_ID_MAIN) || ((player->actor.world.pos.z > 1150.0f) && (this->unk_150 != 100))) { this->actor.flags &= ~ACTOR_FLAG_1; } else { @@ -4359,7 +4359,7 @@ void EnFishing_UpdatePondProps(GlobalContext* globalCtx) { prop++; } - if (sCameraId == MAIN_CAM) { + if (sCameraId == CAM_ID_MAIN) { CollisionCheck_SetOC(globalCtx, &globalCtx->colChkCtx, &sFishingMain->collider.base); } } @@ -5185,10 +5185,10 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { break; case 1: - sCameraId = func_801694DC(globalCtx); - func_80169590(globalCtx, MAIN_CAM, 1); - func_80169590(globalCtx, sCameraId, 7); - camera = Play_GetCamera(globalCtx, MAIN_CAM); + sCameraId = Play_CreateSubCamera(globalCtx); + Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(globalCtx, sCameraId, 7); + camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); sCameraEye.x = camera->eye.x; sCameraEye.y = camera->eye.y; sCameraEye.z = camera->eye.z; @@ -5295,7 +5295,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { break; case 3: { - Camera* camera = Play_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); camera->eye = sCameraEye; camera->eyeNext = sCameraEye; @@ -5304,7 +5304,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { func_80169AFC(globalCtx, sCameraId, 0); func_800EA0EC(globalCtx, &globalCtx->csCtx); D_8090CD4C = 0; - sCameraId = MAIN_CAM; + sCameraId = CAM_ID_MAIN; func_800F6834(globalCtx, 0); globalCtx->envCtx.unk_8C.fogNear = 0; player->unk_B28 = -5; @@ -5313,11 +5313,11 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { case 10: func_800EA0D4(globalCtx, &globalCtx->csCtx); - sCameraId = func_801694DC(globalCtx); - func_80169590(globalCtx, MAIN_CAM, 1); - func_80169590(globalCtx, sCameraId, 7); + sCameraId = Play_CreateSubCamera(globalCtx); + Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(globalCtx, sCameraId, 7); func_800B7298(globalCtx, &this->actor, 4); - camera = Play_GetCamera(globalCtx, MAIN_CAM); + camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); sCameraEye.x = camera->eye.x; sCameraEye.y = camera->eye.y; sCameraEye.z = camera->eye.z; @@ -5334,7 +5334,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { player->actor.speedXZ = 0.0f; if (!Message_GetState(&globalCtx->msgCtx)) { - camera = Play_GetCamera(globalCtx, MAIN_CAM); + camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); camera->eye = sCameraEye; camera->eyeNext = sCameraEye; @@ -5343,7 +5343,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { func_800EA0EC(globalCtx, &globalCtx->csCtx); func_800B7298(globalCtx, &this->actor, 6); D_8090CD4C = 0; - sCameraId = MAIN_CAM; + sCameraId = CAM_ID_MAIN; D_8090CD50 = 30; func_800F6834(globalCtx, 0); globalCtx->envCtx.unk_8C.fogNear = 0; @@ -5352,11 +5352,11 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { case 20: func_800EA0D4(globalCtx, &globalCtx->csCtx); - sCameraId = func_801694DC(globalCtx); - func_80169590(globalCtx, MAIN_CAM, 1); - func_80169590(globalCtx, sCameraId, 7); + sCameraId = Play_CreateSubCamera(globalCtx); + Play_CameraChangeStatus(globalCtx, CAM_ID_MAIN, 1); + Play_CameraChangeStatus(globalCtx, sCameraId, 7); func_800B7298(globalCtx, &this->actor, 4); - camera = Play_GetCamera(globalCtx, MAIN_CAM); + camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); sCameraEye.x = camera->eye.x; sCameraEye.y = camera->eye.y; sCameraEye.z = camera->eye.z; @@ -5428,7 +5428,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { if (D_8090CD50 == 0) { if ((Message_GetState(&globalCtx->msgCtx) == 4) || !Message_GetState(&globalCtx->msgCtx)) { if (func_80147624(globalCtx)) { - Camera* camera = Play_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); func_801477B4(globalCtx); if (globalCtx->msgCtx.choiceIndex == 0) { @@ -5443,7 +5443,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { func_800EA0EC(globalCtx, &globalCtx->csCtx); func_800B7298(globalCtx, &this->actor, 6); // arg2 changed from 7 to 6 in MM D_8090CD4C = 0; - sCameraId = MAIN_CAM; + sCameraId = CAM_ID_MAIN; player->unk_B28 = -5; D_80917200 = 5; D_8090CD54 = 0; @@ -5459,7 +5459,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { break; } - if (sCameraId != MAIN_CAM) { + if (sCameraId != CAM_ID_MAIN) { Play_CameraSetAtEye(globalCtx, sCameraId, &sCameraAt, &sCameraEye); Math_ApproachF(&D_80911F4C, 1.0f, 1.0f, 0.02f); @@ -5561,7 +5561,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { if ((u8)D_8090CCD0 > 0) { s32 pad; - Camera* camera = Play_GetCamera(globalCtx, MAIN_CAM); + Camera* camera = Play_GetCamera(globalCtx, CAM_ID_MAIN); s16 i; s32 pad1; Vec3f pos; @@ -5571,7 +5571,7 @@ void EnFishing_UpdateOwner(Actor* thisx, GlobalContext* globalCtx2) { rot.x = 1.6707964f; rot.y = 1.0f; - rot.z = (func_800DFC68(camera) * -(M_PI / 32768)) + rot.y; + rot.z = (Camera_GetInputDirYaw(camera) * -(M_PI / 32768)) + rot.y; for (i = 0; i < (u8)D_8090CCD0; i++) { pos.x = randPlusMinusPoint5Scaled(700.0f) + globalCtx->view.eye.x; diff --git a/src/overlays/actors/ovl_En_Fu/z_en_fu.c b/src/overlays/actors/ovl_En_Fu/z_en_fu.c index 039fdfa9a6..063d01608b 100644 --- a/src/overlays/actors/ovl_En_Fu/z_en_fu.c +++ b/src/overlays/actors/ovl_En_Fu/z_en_fu.c @@ -730,7 +730,8 @@ void func_80962D60(EnFu* this, GlobalContext* globalCtx) { void func_80962EBC(EnFu* this, GlobalContext* globalCtx) { if (this->unk_542 != 0) { if (this->actor.cutscene != -1) { - func_800DFB14(globalCtx->cameraPtrs[MAIN_CAM], ActorCutscene_GetCutscene(this->actor.cutscene)->unk4); + Camera_ChangeDataIdx(globalCtx->cameraPtrs[CAM_ID_MAIN], + ActorCutscene_GetCutscene(this->actor.cutscene)->csCamSceneDataId); } } } @@ -1163,11 +1164,11 @@ void func_80963F44(EnFu* this, GlobalContext* globalCtx) { void func_80963F88(EnFu* this, GlobalContext* globalCtx) { if (this->unk_542 == 1) { - func_800DFAC8(globalCtx->cameraPtrs[MAIN_CAM], 75); + func_800DFAC8(globalCtx->cameraPtrs[CAM_ID_MAIN], 75); globalCtx->unk_1887E = 0; } else if (this->unk_542 == 2) { globalCtx->unk_1887D = 0; - func_800DFAC8(globalCtx->cameraPtrs[MAIN_CAM], 75); + func_800DFAC8(globalCtx->cameraPtrs[CAM_ID_MAIN], 75); } } @@ -1421,7 +1422,7 @@ void func_80964694(EnFu* this, EnFuUnkStruct* ptr, Vec3f* arg2, s32 len) { void func_809647EC(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len) { Vec3f sp44 = { 0.0f, 0.0f, 0.0f }; - s16 activeCam = func_800DFC68(GET_ACTIVE_CAM(globalCtx)); + s16 yaw = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); s32 i; for (i = 0; i < len; i++, ptr++) { @@ -1434,7 +1435,7 @@ void func_809647EC(GlobalContext* globalCtx, EnFuUnkStruct* ptr, s32 len) { ptr->unk_08.z += 2.0f * Math_CosS(ptr->unk_2C); Matrix_StatePush(); Matrix_InsertTranslation(ptr->unk_08.x, ptr->unk_08.y, ptr->unk_08.z, MTXMODE_NEW); - Matrix_RotateY(activeCam, MTXMODE_APPLY); + Matrix_RotateY(yaw, MTXMODE_APPLY); Matrix_MultiplyVector3fByState(&sp44, &ptr->unk_08); Matrix_StatePop(); ptr->unk_2C += 6000; diff --git a/src/overlays/actors/ovl_En_Gm/z_en_gm.c b/src/overlays/actors/ovl_En_Gm/z_en_gm.c index 6d5c2db3f8..9be7b1a003 100644 --- a/src/overlays/actors/ovl_En_Gm/z_en_gm.c +++ b/src/overlays/actors/ovl_En_Gm/z_en_gm.c @@ -385,7 +385,7 @@ s32 func_8094E52C(EnGm* this, GlobalContext* globalCtx) { if (!(gSaveContext.weekEventReg[86] & 0x40) && (this->unk_3E0 == 2)) { ActorCutscene_Stop(sp2A); } else { - func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); } this->unk_3E0++; ret = true; @@ -393,7 +393,8 @@ s32 func_8094E52C(EnGm* this, GlobalContext* globalCtx) { case 1: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), + this->actor.child); } this->unk_3E0++; ret = true; @@ -453,7 +454,7 @@ s32 func_8094E69C(EnGm* this, GlobalContext* globalCtx) { case 4: case 6: camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp4A)); - func_800E0308(camera, &this->actor); + Camera_SetTargetActor(camera, &this->actor); this->unk_3E0++; ret = true; } @@ -464,7 +465,7 @@ s32 func_8094E69C(EnGm* this, GlobalContext* globalCtx) { case 7: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { camera = Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp4A)); - func_800E0308(camera, this->actor.child); + Camera_SetTargetActor(camera, this->actor.child); } this->unk_3E0++; ret = true; 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 000f5649c6..6d7f976301 100644 --- a/src/overlays/actors/ovl_En_Go/z_en_go.c +++ b/src/overlays/actors/ovl_En_Go/z_en_go.c @@ -1045,7 +1045,7 @@ s32 func_80A13564(EnGo* this, f32 arg1, f32 arg2, s32 arg3) { } void func_80A136B8(GlobalContext* globalCtx, s16 arg1, s16 arg2, s16 arg3) { - s16 sp26 = Quake_Add(Play_GetCamera(globalCtx, MAIN_CAM), 3); + s16 sp26 = Quake_Add(Play_GetCamera(globalCtx, CAM_ID_MAIN), 3); Quake_SetCountdown(sp26, arg3); Quake_SetSpeed(sp26, arg1); diff --git a/src/overlays/actors/ovl_En_Ig/z_en_ig.c b/src/overlays/actors/ovl_En_Ig/z_en_ig.c index ecb47f3834..15ef372bdb 100644 --- a/src/overlays/actors/ovl_En_Ig/z_en_ig.c +++ b/src/overlays/actors/ovl_En_Ig/z_en_ig.c @@ -331,8 +331,8 @@ s32 func_80BF17BC(EnIg* this, GlobalContext* globalCtx) { case 2: case 4: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), - this->actor.child); + Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), + this->actor.child); } this->unk_3F6++; ret = true; @@ -345,7 +345,7 @@ s32 func_80BF17BC(EnIg* this, GlobalContext* globalCtx) { ActorCutscene_Stop(sp2A); this->unk_3F6 = 5; } else { - func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); } this->unk_3F6++; ret = true; diff --git a/src/overlays/actors/ovl_En_Jg/z_en_jg.c b/src/overlays/actors/ovl_En_Jg/z_en_jg.c index 4613842957..8f9b3fb449 100644 --- a/src/overlays/actors/ovl_En_Jg/z_en_jg.c +++ b/src/overlays/actors/ovl_En_Jg/z_en_jg.c @@ -383,13 +383,13 @@ void EnJg_GoronShrineCheer(EnJg* this, GlobalContext* globalCtx) { // Focus on a specifc Goron for these lines this->shrineGoron = EnJg_GetShrineGoronToFocusOn(globalCtx, this->focusedShrineGoronParam); ActorCutscene_Start(this->cutscene, this->shrineGoron); - func_800E0308(globalCtx->cameraPtrs[0], this->shrineGoron); + Camera_SetTargetActor(globalCtx->cameraPtrs[CAM_ID_MAIN], this->shrineGoron); break; default: // Focus on the whole group for these lines ActorCutscene_Start(this->cutscene, &this->actor); - func_800E0308(globalCtx->cameraPtrs[0], this->shrineGoron); + Camera_SetTargetActor(globalCtx->cameraPtrs[CAM_ID_MAIN], this->shrineGoron); break; } this->actionFunc = EnJg_GoronShrineTalk; 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 a11af566a8..3fca0129df 100644 --- a/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c +++ b/src/overlays/actors/ovl_En_Kakasi/z_en_kakasi.c @@ -259,7 +259,7 @@ void EnKakasi_CheckPlayerPosition(EnKakasi* this, GlobalContext* globalCtx) { * something to do with cutscene camera? */ void func_8096FAAC(EnKakasi* this, GlobalContext* globalCtx) { - if (this->cutsceneCamId != MAIN_CAM) { + if (this->cutsceneCamId != CAM_ID_MAIN) { Math_ApproachF(&this->unk214.x, this->unk238.x, 0.4f, 4.0f); Math_ApproachF(&this->unk214.y, this->unk238.y, 0.4f, 4.0f); Math_ApproachF(&this->unk214.z, this->unk238.z, 0.4f, 4.0f); @@ -271,7 +271,7 @@ void func_8096FAAC(EnKakasi* this, GlobalContext* globalCtx) { Math_ApproachF(&this->unk20C, this->unk210, 0.3f, 10.0f); Play_CameraSetAtEye(globalCtx, this->cutsceneCamId, &this->unk220, &this->unk214); - func_80169940(globalCtx, this->cutsceneCamId, this->unk20C); + Play_CameraSetFov(globalCtx, this->cutsceneCamId, this->unk20C); } } @@ -550,7 +550,7 @@ void EnKakasi_RegularDialogue(EnKakasi* this, GlobalContext* globalCtx) { void EnKakasi_SetupSongTeach(EnKakasi* this, GlobalContext* globalCtx) { this->actor.textId = 0x1646; func_801518B0(globalCtx, this->actor.textId, &this->actor); - this->cutsceneCamId = MAIN_CAM; + this->cutsceneCamId = CAM_ID_MAIN; this->unk20C = 0.0f; this->unk210 = 60.0f; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_TWIRL); @@ -628,7 +628,7 @@ void EnKakasi_TeachingSong(EnKakasi* this, GlobalContext* globalCtx) { Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_YASE_DEAD); if (this) {} this->unkState196 = 2; - this->cutsceneCamId = MAIN_CAM; + this->cutsceneCamId = CAM_ID_MAIN; this->actor.textId = 0x1647; this->unkState1A8 = 2; this->unkMsgState1AC = 5; @@ -662,7 +662,7 @@ void EnKakasi_SetupPostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCt this->unk190 = 0; this->unkCounter1A4 = 0; EnKakasi_SetAnimation(this, ENKAKASI_ANIM_HOPPING_REGULAR); - this->cutsceneCamId = MAIN_CAM; + this->cutsceneCamId = CAM_ID_MAIN; this->unkMsgState1AC = 5; this->unkState1A8 = 1; this->actionFunc = EnKakasi_PostSongLearnDialogue; @@ -720,7 +720,7 @@ void EnKakasi_PostSongLearnDialogue(EnKakasi* this, GlobalContext* globalCtx) { this->unkState1A8 = 1; } - if (this->cutsceneCamId != MAIN_CAM) { + if (this->cutsceneCamId != CAM_ID_MAIN) { this->unk22C.y = this->actor.home.pos.y + 50.0f; EnKakasi_CheckPlayerPosition(this, globalCtx); this->unk238.x = D_80971FA0[this->unk190].x; @@ -974,7 +974,7 @@ void EnKakasi_DiggingAway(EnKakasi* this, GlobalContext* globalCtx) { Vec3f tempunk238; Vec3f tempWorldPos; - if (this->cutsceneCamId != MAIN_CAM) { + if (this->cutsceneCamId != CAM_ID_MAIN) { this->unk22C.y = this->actor.home.pos.y + 50.0f; this->unk238.x = D_80972030.x; this->unk238.y = D_80972030.y; @@ -1127,7 +1127,7 @@ void EnKakasi_Update(Actor* thisx, GlobalContext* globalCtx) { if (this->unk1BC.x != 0.0f || this->unk1BC.z != 0.0f) { Math_Vec3f_Copy(&this->actor.focus.pos, &this->unk1BC); this->actor.focus.pos.y += 10.0f; - if (this->cutsceneCamId == MAIN_CAM) { + if (this->cutsceneCamId == CAM_ID_MAIN) { Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.world.rot); } else { Math_Vec3s_Copy(&this->actor.focus.rot, &this->actor.home.rot); diff --git a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c index 4eb4ffdc9c..d42d75bb1e 100644 --- a/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c +++ b/src/overlays/actors/ovl_En_Kendo_Js/z_en_kendo_js.c @@ -667,7 +667,8 @@ void func_80B27774(EnKendoJs* this, GlobalContext* globalCtx) { void func_80B2783C(EnKendoJs* this, GlobalContext* globalCtx) { if (this->actor.cutscene != -1) { - func_800DFB14(globalCtx->cameraPtrs[MAIN_CAM], ActorCutscene_GetCutscene(this->actor.cutscene)->unk4); + Camera_ChangeDataIdx(globalCtx->cameraPtrs[CAM_ID_MAIN], + ActorCutscene_GetCutscene(this->actor.cutscene)->csCamSceneDataId); } } diff --git a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c index 69145c95fa..227c4316d4 100644 --- a/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c +++ b/src/overlays/actors/ovl_En_Minifrog/z_en_minifrog.c @@ -224,22 +224,22 @@ void EnMinifrog_TurnToMissingFrog(EnMinifrog* this) { static Color_RGBA8 sPrimColor = { 255, 255, 255, 255 }; static Color_RGBA8 sEnvColor = { 80, 80, 80, 255 }; -void EnMinifrog_SetCamera(EnMinifrog* this, GlobalContext* globalCtx) { +void EnMinifrog_SpawnDust(EnMinifrog* this, GlobalContext* globalCtx) { Vec3f pos; Vec3f vec5; Vec3f vel; Vec3f accel; s16 yaw; s16 pitch; - Vec3f eye; + Vec3f eye = GET_ACTIVE_CAM(globalCtx)->eye; s32 i; - eye = GET_ACTIVE_CAM(globalCtx)->eye; yaw = Math_Vec3f_Yaw(&eye, &this->actor.world.pos); pitch = -Math_Vec3f_Pitch(&eye, &this->actor.world.pos); vec5.x = this->actor.world.pos.x - (5.0f * Math_SinS(yaw) * Math_CosS(pitch)); vec5.y = this->actor.world.pos.y - (5.0f * Math_SinS(pitch)); vec5.z = this->actor.world.pos.z - (5.0f * Math_CosS(yaw) * Math_CosS(pitch)); + for (i = 0; i < 5; i++) { vel.x = randPlusMinusPoint5Scaled(4.0f); vel.y = randPlusMinusPoint5Scaled(4.0f); @@ -284,7 +284,7 @@ void EnMinifrog_ReturnFrogCutscene(EnMinifrog* this, GlobalContext* globalCtx) { case 0xD85: // "I understand. I shall head for the mountains immediately." default: func_801477B4(globalCtx); - EnMinifrog_SetCamera(this, globalCtx); + EnMinifrog_SpawnDust(this, globalCtx); SoundSource_PlaySfxAtFixedWorldPos(globalCtx, &this->actor.world.pos, 30, NA_SE_EN_NPC_FADEAWAY); if (this->actor.cutscene != -1) { if (ActorCutscene_GetCurrentIndex() == this->actor.cutscene) { 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 4927031e40..f6e398a33d 100644 --- a/src/overlays/actors/ovl_En_Niw/z_en_niw.c +++ b/src/overlays/actors/ovl_En_Niw/z_en_niw.c @@ -742,7 +742,7 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { s32 pad2[9]; s16 temp29C; f32 featherScale; - f32 camResult; + f32 viewAtToEyeNormY; f32 floorHeight; f32 dist = 20.0f; s32 pad3; @@ -808,17 +808,19 @@ void EnNiw_Update(Actor* thisx, GlobalContext* globalCtx) { Actor_UpdateBgCheckInfo(globalCtx, &this->actor, 20.0f, 20.0f, 60.0f, 0x1F); + // if cucco is off the map? if (this->actor.floorHeight <= BGCHECK_Y_MIN || this->actor.floorHeight >= BGCHECK_Y_MAX) { - // if cucco is off the map? - Vec3f camera; - camera.x = globalCtx->view.at.x - globalCtx->view.eye.x; - camera.y = globalCtx->view.at.y - globalCtx->view.eye.y; - camera.z = globalCtx->view.at.z - globalCtx->view.eye.z; - camResult = camera.y / sqrtf(SQXYZ(camera)); + Vec3f viewAtToEye; + + // Direction vector for the direction the camera is facing + viewAtToEye.x = globalCtx->view.at.x - globalCtx->view.eye.x; + viewAtToEye.y = globalCtx->view.at.y - globalCtx->view.eye.y; + viewAtToEye.z = globalCtx->view.at.z - globalCtx->view.eye.z; + viewAtToEyeNormY = viewAtToEye.y / sqrtf(SQXYZ(viewAtToEye)); this->actor.world.pos.x = this->actor.home.pos.x; this->actor.world.pos.z = this->actor.home.pos.z; - this->actor.world.pos.y = (this->actor.home.pos.y + globalCtx->view.eye.y) + (camResult * 160.0f); + this->actor.world.pos.y = (this->actor.home.pos.y + globalCtx->view.eye.y) + (viewAtToEyeNormY * 160.0f); if (this->actor.world.pos.y < this->actor.home.pos.y) { this->actor.world.pos.y = this->actor.home.pos.y + 300.0f; diff --git a/src/overlays/actors/ovl_En_Ot/z_en_ot.c b/src/overlays/actors/ovl_En_Ot/z_en_ot.c index 4781f8828c..b210e76cdc 100644 --- a/src/overlays/actors/ovl_En_Ot/z_en_ot.c +++ b/src/overlays/actors/ovl_En_Ot/z_en_ot.c @@ -461,7 +461,7 @@ void func_80B5C3D8(EnOt* this, GlobalContext* globalCtx) { } if (Animation_OnFrame(&this->skelAnime, 12.0f)) { - Matrix_RotateY(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)), MTXMODE_NEW); + Matrix_RotateY(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)), MTXMODE_NEW); sp38.x = 1.0f; sp38.y = 8.1f; sp38.z = 0.0f; @@ -645,8 +645,8 @@ void func_80B5CD40(EnOt* this, GlobalContext* globalCtx) { switch (Message_GetState(&globalCtx->msgCtx)) { case 0: - temp = Math_SmoothStepToS(&this->actor.shape.rot.y, BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))), - 3, 0xE38, 0x38E); + temp = Math_SmoothStepToS(&this->actor.shape.rot.y, + BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), 3, 0xE38, 0x38E); this->actor.world.rot.y = this->actor.shape.rot.y; if (1) {} if (!temp) { @@ -1112,7 +1112,7 @@ EnOtUnkStruct* func_80B5DF58(EnOtUnkStruct* arg0, u8 arg1, Vec3f* arg2, Vec3s* a void func_80B5E078(GlobalContext* globalCtx, EnOtUnkStruct* arg1, s32 arg2) { Vec3f sp54; s32 i; - s16 temp = func_800DFC68(GET_ACTIVE_CAM(globalCtx)); + s16 temp = Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)); for (i = 0; i < arg2; i++, arg1++) { if ((arg1->unk_00 == 1) || (arg1->unk_00 == 2)) { @@ -1152,7 +1152,7 @@ void func_80B5E1D8(GlobalContext* globalCtx, EnOtUnkStruct* arg1, s32 arg2) { } Matrix_InsertTranslation(arg1->unk_0C.x, arg1->unk_0C.y, arg1->unk_0C.z, MTXMODE_NEW); - Matrix_RotateY(BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))), MTXMODE_APPLY); + Matrix_RotateY(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), MTXMODE_APPLY); Matrix_Scale(arg1->unk_04, arg1->unk_04, arg1->unk_04, MTXMODE_APPLY); gSPSegment(POLY_OPA_DISP++, 0x08, Lib_SegmentedToVirtual(gameplay_keep_Tex_05E6F0)); diff --git a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c index 4bbe6fa603..4b15bde77e 100644 --- a/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c +++ b/src/overlays/actors/ovl_En_Pamera/z_en_pamera.c @@ -241,7 +241,8 @@ void func_80BD8758(EnPamera* this, GlobalContext* globalCtx) { if (this->hideInisdeTimer++ > 1800) { if (ActorCutscene_GetCanPlayNext(this->cutscenes[0]) && (this->cutscenes[0] != -1)) { ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[0], &this->actor); - func_800E02AC(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->cutscenes[0])), &this->actor); + Camera_SetToTrackActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->cutscenes[0])), + &this->actor); this->actor.speedXZ = 1.5f; Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimations, 1); this->actor.shape.rot.y = this->actor.home.rot.y; @@ -427,7 +428,8 @@ void func_80BD90AC(EnPamera* this, GlobalContext* globalCtx) { (Math_Vec3f_DistXZ(&this->actor.home.pos, &player->actor.world.pos) < 200.0f)))) { if ((ActorCutscene_GetCanPlayNext(this->cutscenes[1])) && ((this->cutscenes[1] != -1))) { ActorCutscene_StartAndSetUnkLinkFields(this->cutscenes[1], &this->actor); - func_800E02AC(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->cutscenes[1])), &this->actor); + Camera_SetToTrackActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(this->cutscenes[1])), + &this->actor); EnPamera_LookDownWell(this); } else if (this->cutscenes[1] != -1) { ActorCutscene_SetIntentToPlay(this->cutscenes[1]); diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c index 963eabe4b6..bab9aee20e 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.c @@ -325,24 +325,24 @@ s32 func_8086A2CC(EnPametfrog* this, CollisionPoly* floorPoly) { } void EnPametfrog_ShakeCamera(EnPametfrog* this, GlobalContext* globalCtx, f32 magShakeXZ, f32 magShakeY) { - Camera* camera = Play_GetCamera(globalCtx, this->camId); - s16 y; - Vec3f eye; + Camera* subCam = Play_GetCamera(globalCtx, this->subCamId); + s16 subCamYaw; + Vec3f subCamEye; - y = BINANG_ROT180(func_800DFCDC(camera)); - eye.x = (Math_SinS(y) * magShakeXZ) + camera->at.x; - eye.y = camera->at.y + magShakeY; - eye.z = (Math_CosS(y) * magShakeXZ) + camera->at.z; - Play_CameraSetAtEye(globalCtx, this->camId, &camera->at, &eye); + subCamYaw = BINANG_ROT180(Camera_GetCamDirYaw(subCam)); + subCamEye.x = (Math_SinS(subCamYaw) * magShakeXZ) + subCam->at.x; + subCamEye.y = subCam->at.y + magShakeY; + subCamEye.z = (Math_CosS(subCamYaw) * magShakeXZ) + subCam->at.z; + Play_CameraSetAtEye(globalCtx, this->subCamId, &subCam->at, &subCamEye); } void EnPametfrog_StopCutscene(EnPametfrog* this, GlobalContext* globalCtx) { - Camera* camera; + Camera* subCam; - if (this->camId != 0) { - camera = Play_GetCamera(globalCtx, this->camId); - Play_CameraSetAtEye(globalCtx, 0, &camera->at, &camera->eye); - this->camId = 0; + if (this->subCamId != CAM_ID_MAIN) { + subCam = Play_GetCamera(globalCtx, this->subCamId); + Play_CameraSetAtEye(globalCtx, CAM_ID_MAIN, &subCam->at, &subCam->eye); + this->subCamId = CAM_ID_MAIN; ActorCutscene_Stop(this->cutscene); func_800B724C(globalCtx, &this->actor, 6); } @@ -494,7 +494,7 @@ void EnPametfrog_RearOnSnapperRise(EnPametfrog* this, GlobalContext* globalCtx) } void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx) { - Vec3f eye; + Vec3f subCamEye; s16 yaw; Animation_PlayOnce(&this->skelAnime, &gGekkoFallInAirAnim); @@ -507,10 +507,10 @@ void EnPametfrog_SetupFallOffSnapper(EnPametfrog* this, GlobalContext* globalCtx this->timer = 30; this->collider.base.ocFlags1 |= OC1_ON; yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); - eye.x = (Math_SinS(yaw) * 300.0f) + this->actor.focus.pos.x; - eye.y = this->actor.focus.pos.y + 100.0f; - eye.z = (Math_CosS(yaw) * 300.0f) + this->actor.focus.pos.z; - Play_CameraSetAtEye(globalCtx, this->camId, &this->actor.focus.pos, &eye); + subCamEye.x = (Math_SinS(yaw) * 300.0f) + this->actor.focus.pos.x; + subCamEye.y = this->actor.focus.pos.y + 100.0f; + subCamEye.z = (Math_CosS(yaw) * 300.0f) + this->actor.focus.pos.z; + Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.focus.pos, &subCamEye); Actor_PlaySfxAtPos(&this->actor, NA_SE_EN_FROG_DAMAGE); this->actionFunc = EnPametfrog_FallOffSnapper; } @@ -806,7 +806,7 @@ void EnPametfrog_LandOnSnapper(EnPametfrog* this, GlobalContext* globalCtx) { void EnPametfrog_SetupFallInAir(EnPametfrog* this, GlobalContext* globalCtx) { s16 yaw; - Vec3f eye; + Vec3f subCamEye; f32 xzDist; Animation_PlayOnce(&this->skelAnime, &gGekkoFallInAirAnim); @@ -828,7 +828,7 @@ void EnPametfrog_SetupFallInAir(EnPametfrog* this, GlobalContext* globalCtx) { yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); this->actor.world.pos.x += 30.0f * Math_SinS(yaw); this->actor.world.pos.z += 30.0f * Math_CosS(yaw); - if (this->camId != 0) { + if (this->subCamId != CAM_ID_MAIN) { xzDist = sqrtf(SQXZ(this->unk_2DC)); if (xzDist > 0.001f) { xzDist = 200.0f / xzDist; @@ -838,10 +838,10 @@ void EnPametfrog_SetupFallInAir(EnPametfrog* this, GlobalContext* globalCtx) { this->unk_2DC.z = 0.0f; } - eye.x = this->actor.world.pos.x + (xzDist * this->unk_2DC.x); - eye.y = (this->actor.world.pos.y + this->actor.home.pos.y) * 0.5f; - eye.z = this->actor.world.pos.z + (xzDist * this->unk_2DC.z); - Play_CameraSetAtEye(globalCtx, this->camId, &this->actor.world.pos, &eye); + subCamEye.x = this->actor.world.pos.x + (xzDist * this->unk_2DC.x); + subCamEye.y = (this->actor.world.pos.y + this->actor.home.pos.y) * 0.5f; + subCamEye.z = this->actor.world.pos.z + (xzDist * this->unk_2DC.z); + Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.world.pos, &subCamEye); } this->actionFunc = EnPametfrog_FallInAir; @@ -858,9 +858,9 @@ void EnPametfrog_FallInAir(EnPametfrog* this, GlobalContext* globalCtx) { } } else { this->spinYaw += 0xF00; - if (this->camId != 0) { - Play_CameraSetAtEye(globalCtx, this->camId, &this->actor.world.pos, - &Play_GetCamera(globalCtx, this->camId)->eye); + if (this->subCamId != CAM_ID_MAIN) { + Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.world.pos, + &Play_GetCamera(globalCtx, this->subCamId)->eye); } if (this->actor.bgCheckFlags & 1) { @@ -900,15 +900,15 @@ void EnPametfrog_FallOnGround(EnPametfrog* this, GlobalContext* globalCtx) { } void EnPametfrog_SetupDefeatGekko(EnPametfrog* this, GlobalContext* globalCtx) { - Vec3f eye; + Vec3f subCamEye; s16 yaw = Actor_YawToPoint(this->actor.child, &this->actor.home.pos); s16 yawDiff = this->actor.yawTowardsPlayer - yaw; yaw = yawDiff > 0 ? yaw - 0x2000 : yaw + 0x2000; - eye.x = this->actor.child->focus.pos.x + 150.0f * Math_SinS(yaw); - eye.y = this->actor.child->focus.pos.y + 20.0f; - eye.z = this->actor.child->focus.pos.z + 150.0f * Math_CosS(yaw); - Play_CameraSetAtEye(globalCtx, this->camId, &this->actor.child->focus.pos, &eye); + subCamEye.x = this->actor.child->focus.pos.x + 150.0f * Math_SinS(yaw); + subCamEye.y = this->actor.child->focus.pos.y + 20.0f; + subCamEye.z = this->actor.child->focus.pos.z + 150.0f * Math_CosS(yaw); + Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.child->focus.pos, &subCamEye); this->actor.params = GEKKO_DEFEAT; this->timer = 38; this->actionFunc = EnPametfrog_DefeatGekko; @@ -925,15 +925,15 @@ void EnPametfrog_DefeatGekko(EnPametfrog* this, GlobalContext* globalCtx) { } void EnPametfrog_SetupDefeatSnapper(EnPametfrog* this, GlobalContext* globalCtx) { - Vec3f eye; + Vec3f subCamEye; s16 yaw = Actor_YawToPoint(&this->actor, &this->actor.home.pos); s16 yawDiff = this->actor.yawTowardsPlayer - yaw; yaw = yawDiff > 0 ? yaw - 0x2000 : yaw + 0x2000; - eye.x = this->actor.world.pos.x + Math_SinS(yaw) * 150.0f; - eye.y = this->actor.world.pos.y + 20.0f; - eye.z = this->actor.world.pos.z + Math_CosS(yaw) * 150.0f; - Play_CameraSetAtEye(globalCtx, this->camId, &this->actor.world.pos, &eye); + subCamEye.x = this->actor.world.pos.x + Math_SinS(yaw) * 150.0f; + subCamEye.y = this->actor.world.pos.y + 20.0f; + subCamEye.z = this->actor.world.pos.z + Math_CosS(yaw) * 150.0f; + Play_CameraSetAtEye(globalCtx, this->subCamId, &this->actor.world.pos, &subCamEye); this->timer = 20; this->actionFunc = EnPametfrog_DefeatSnapper; } @@ -952,7 +952,7 @@ void EnPametfrog_SetupSpawnFrog(EnPametfrog* this, GlobalContext* globalCtx) { static Vec3f sAccel = { 0.0f, -0.5f, 0.0f }; static Color_RGBA8 primColor = { 250, 250, 250, 255 }; static Color_RGBA8 envColor = { 180, 180, 180, 255 }; - s16 yaw = BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))); + s16 yaw = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); Vec3f vec1; Vec3f vel; s32 i; @@ -1007,7 +1007,7 @@ void EnPametfrog_SetupCutscene(EnPametfrog* this) { void EnPametfrog_PlayCutscene(EnPametfrog* this, GlobalContext* globalCtx) { if (ActorCutscene_GetCanPlayNext(this->cutscene)) { ActorCutscene_Start(this->cutscene, &this->actor); - this->camId = ActorCutscene_GetCurrentCamera(this->cutscene); + this->subCamId = ActorCutscene_GetCurrentCamera(this->cutscene); func_800B724C(globalCtx, &this->actor, 7); if (this->actor.colChkInfo.health == 0) { if (this->actor.params == GEKKO_PRE_SNAPPER) { @@ -1166,8 +1166,8 @@ void EnPametfrog_Stun(EnPametfrog* this, GlobalContext* globalCtx) { } void EnPametfrog_SetupCallSnapper(EnPametfrog* this, GlobalContext* globalCtx) { - Vec3f eye; - Vec3f at; + Vec3f subCamEye; + Vec3f subCamAt; s16 yawDiff; Animation_MorphToPlayOnce(&this->skelAnime, &gGekkoCallAnim, 3.0f); @@ -1183,15 +1183,15 @@ void EnPametfrog_SetupCallSnapper(EnPametfrog* this, GlobalContext* globalCtx) { } this->actor.shape.rot.y = this->actor.world.rot.y; - at.x = this->actor.world.pos.x; - at.z = this->actor.world.pos.z; - at.y = this->actor.world.pos.y + 45.0f; - eye.x = (Math_SinS(this->actor.shape.rot.y) * 90.0f) + at.x; - eye.z = (Math_CosS(this->actor.shape.rot.y) * 90.0f) + at.z; - eye.y = at.y + 4.0f; + subCamAt.x = this->actor.world.pos.x; + subCamAt.z = this->actor.world.pos.z; + subCamAt.y = this->actor.world.pos.y + 45.0f; + subCamEye.x = (Math_SinS(this->actor.shape.rot.y) * 90.0f) + subCamAt.x; + subCamEye.z = (Math_CosS(this->actor.shape.rot.y) * 90.0f) + subCamAt.z; + subCamEye.y = subCamAt.y + 4.0f; // Zooms in on Gekko - Play_CameraSetAtEye(globalCtx, this->camId, &at, &eye); + Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); this->timer = 0; this->actor.hintId = 0x5F; this->actionFunc = EnPametfrog_CallSnapper; @@ -1204,26 +1204,26 @@ void EnPametfrog_CallSnapper(EnPametfrog* this, GlobalContext* globalCtx) { } void EnPametfrog_SetupSnapperSpawn(EnPametfrog* this, GlobalContext* globalCtx) { - Vec3f at; - Vec3f eye; + Vec3f subCamAt; + Vec3f subCamEye; s16 yaw; EnPametfrog_PlaceSnapper(this, globalCtx); - at.x = this->actor.child->world.pos.x; - at.z = this->actor.child->world.pos.z; - at.y = this->actor.child->floorHeight + 50.0f; + subCamAt.x = this->actor.child->world.pos.x; + subCamAt.z = this->actor.child->world.pos.z; + subCamAt.y = this->actor.child->floorHeight + 50.0f; if ((s16)(Actor_YawToPoint(&this->actor, &this->actor.home.pos) - this->actor.shape.rot.y) > 0) { yaw = this->actor.child->shape.rot.y - 0x1000; } else { yaw = this->actor.child->shape.rot.y + 0x1000; } - eye.x = (Math_SinS(yaw) * 500.0f) + at.x; - eye.y = at.y + 55.0f; - eye.z = (Math_CosS(yaw) * 500.0f) + at.z; + subCamEye.x = (Math_SinS(yaw) * 500.0f) + subCamAt.x; + subCamEye.y = subCamAt.y + 55.0f; + subCamEye.z = (Math_CosS(yaw) * 500.0f) + subCamAt.z; // Zooms in on Snapper spawn point - Play_CameraSetAtEye(globalCtx, this->camId, &at, &eye); + Play_CameraSetAtEye(globalCtx, this->subCamId, &subCamAt, &subCamEye); this->quake = Quake_Add(GET_ACTIVE_CAM(globalCtx), 6); Quake_SetSpeed(this->quake, 18000); Quake_SetQuakeValues(this->quake, 2, 0, 0, 0); diff --git a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h index 957a46cfc4..97a682825b 100644 --- a/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h +++ b/src/overlays/actors/ovl_En_Pametfrog/z_en_pametfrog.h @@ -69,7 +69,7 @@ typedef struct EnPametfrog { /* 0x2B4 */ s16 quake; /* 0x2B6 */ s16 timer; /* 0x2B8 */ s16 spinYaw; - /* 0x2BA */ s16 camId; + /* 0x2BA */ s16 subCamId; /* 0x2BC */ s16 freezeTimer; /* 0x2C0 */ f32 wallRotation; /* 0x2C4 */ f32 unk_2C4; diff --git a/src/overlays/actors/ovl_En_Pm/z_en_pm.c b/src/overlays/actors/ovl_En_Pm/z_en_pm.c index eeec684050..fe043938a8 100644 --- a/src/overlays/actors/ovl_En_Pm/z_en_pm.c +++ b/src/overlays/actors/ovl_En_Pm/z_en_pm.c @@ -537,7 +537,8 @@ s32 func_80AF81E8(EnPm* this, GlobalContext* globalCtx) { case 4: case 6: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), + this->actor.child); } this->unk_378++; ret = true; @@ -549,7 +550,7 @@ s32 func_80AF81E8(EnPm* this, GlobalContext* globalCtx) { if ((gSaveContext.weekEventReg[86] & 8) && (this->unk_378 == 3)) { ActorCutscene_Stop(sp2A); } else { - func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); } this->unk_378++; ret = true; @@ -579,7 +580,7 @@ s32 func_80AF8348(EnPm* this, GlobalContext* globalCtx) { case 4: case 6: case 8: - func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); + Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), &this->actor); this->unk_378++; ret = true; break; @@ -589,7 +590,8 @@ s32 func_80AF8348(EnPm* this, GlobalContext* globalCtx) { case 5: case 7: if ((this->actor.child != NULL) && (this->actor.child->update != NULL)) { - func_800E0308(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), this->actor.child); + Camera_SetTargetActor(Play_GetCamera(globalCtx, ActorCutscene_GetCurrentCamera(sp2A)), + this->actor.child); } this->unk_378++; ret = true; 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 fde3009e67..b5a3655ac5 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 @@ -1164,7 +1164,7 @@ void EnPoSisters_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, temp_s7->r, temp_s7->g, temp_s7->b, phi_s5); Matrix_InsertTranslation(this->unk_22C[i].x, this->unk_22C[i].y, this->unk_22C[i].z, MTXMODE_NEW); - Matrix_InsertRotation(0, BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))), 0, MTXMODE_APPLY); + Matrix_InsertRotation(0, BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))), 0, MTXMODE_APPLY); if (this->actionFunc == func_80B1BA90) { f32 phi_f0; diff --git a/src/overlays/actors/ovl_En_Poh/z_en_poh.c b/src/overlays/actors/ovl_En_Poh/z_en_poh.c index 1c524d78f2..e3a5d30be7 100644 --- a/src/overlays/actors/ovl_En_Poh/z_en_poh.c +++ b/src/overlays/actors/ovl_En_Poh/z_en_poh.c @@ -404,7 +404,7 @@ void func_80B2D300(EnPoh* this, GlobalContext* globalCtx) { this->unk_18E++; if (this->unk_18E < 8) { - sp38 = func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) + 0x4800; + sp38 = Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x4800; if (this->unk_18E < 5) { sp3A = (this->unk_18E * 0x1000) - 0x4000; sp44.y = (Math_SinS(sp3A) * 23.0f) + (this->actor.world.pos.y + 40.0f); @@ -1006,7 +1006,8 @@ void func_80B2F37C(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 170, 255, this->unk_197); gDPSetEnvColor(POLY_XLU_DISP++, this->unk_194, this->unk_195, this->unk_196, 255); - Matrix_InsertYRotation_f((func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 32768), MTXMODE_APPLY); + Matrix_InsertYRotation_f((Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) + 0x8000) * (M_PI / 32768), + MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, object_po_DL_003850); diff --git a/src/overlays/actors/ovl_En_Tru/z_en_tru.c b/src/overlays/actors/ovl_En_Tru/z_en_tru.c index a7658263fe..db7b7a1fc0 100644 --- a/src/overlays/actors/ovl_En_Tru/z_en_tru.c +++ b/src/overlays/actors/ovl_En_Tru/z_en_tru.c @@ -939,7 +939,7 @@ s32 func_80A87B48(Actor* thisx, GlobalContext* globalCtx) { case 1: if (Animation_OnFrame(&this->skelAnime, this->skelAnime.endFrame)) { - sp3E = BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx))); + sp3E = BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx))); Math_Vec3f_Copy(&sp4C, &gZeroVec3f); sp4C.z = 40.0f; Lib_Vec3f_TranslateAndRotateY(&this->actor.world.pos, sp3E, &sp4C, &sp40); diff --git a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c index 41af7bce8c..314d168cc5 100644 --- a/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c +++ b/src/overlays/actors/ovl_En_Water_Effect/z_en_water_effect.c @@ -296,7 +296,7 @@ void EnWaterEffect_Draw(Actor* thisx, GlobalContext* globalCtx2) { Matrix_InsertTranslation(ptr->unk_04.x, ptr->unk_04.y, ptr->unk_04.z, MTXMODE_NEW); if (ptr->unk_00 == 1) { - Matrix_RotateY(func_800DFC68(GET_ACTIVE_CAM(globalCtx)), MTXMODE_APPLY); + Matrix_RotateY(Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)), MTXMODE_APPLY); } else { Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); } @@ -535,7 +535,7 @@ void func_80A5A184(Actor* thisx, GlobalContext* globalCtx2) { if (ptr->unk_2A >= 2) { Matrix_NormalizeXYZ(&globalCtx->billboardMtxF); } else { - Matrix_RotateY(func_800DFC68(GET_ACTIVE_CAM(globalCtx)), MTXMODE_APPLY); + Matrix_RotateY(Camera_GetInputDirYaw(GET_ACTIVE_CAM(globalCtx)), MTXMODE_APPLY); } Matrix_Scale(ptr->unk_2C.x, ptr->unk_2C.y, 1.0f, MTXMODE_APPLY); diff --git a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c index 2b6b332f4c..5237d9021b 100644 --- a/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c +++ b/src/overlays/actors/ovl_Obj_Aqua/z_obj_aqua.c @@ -268,7 +268,7 @@ void ObjAqua_Draw(Actor* thisx, GlobalContext* globalCtx) { ObjAqua* this = THIS; s32 framesTemp; s32 pad; - s16 yaw = func_800DFCDC(globalCtx->cameraPtrs[globalCtx->activeCamera]) + 0x8000; + s16 yaw = Camera_GetCamDirYaw(globalCtx->cameraPtrs[globalCtx->activeCamera]) + 0x8000; s32 actionFuncTemp = this->actionFunc == func_80ACBDFC; OPEN_DISPS(globalCtx->state.gfxCtx); diff --git a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c index dfd4ec65a0..2ec24e73e6 100644 --- a/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c +++ b/src/overlays/actors/ovl_Obj_Funen/z_obj_funen.c @@ -35,7 +35,7 @@ void ObjFunen_Draw(Actor* thisx, GlobalContext* globalCtx) { OPEN_DISPS(globalCtx->state.gfxCtx); func_8012C2DC(globalCtx->state.gfxCtx); - Matrix_RotateY((s16)(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) - 0x8000), MTXMODE_APPLY); + Matrix_RotateY((s16)(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - 0x8000), MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_MODELVIEW | G_MTX_LOAD | G_MTX_NOPUSH); diff --git a/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c b/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c index d580c5e8a4..740439eadb 100644 --- a/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c +++ b/src/overlays/actors/ovl_Obj_Kinoko/z_obj_kinoko.c @@ -64,7 +64,7 @@ void ObjKinoko_Update(Actor* thisx, GlobalContext* globalCtx) { } thisx->scale.y = thisx->scale.x; thisx->scale.z = thisx->scale.x; - thisx->shape.rot.y = func_800DFCDC(globalCtx->cameraPtrs[globalCtx->activeCamera]) + 0x8000; + thisx->shape.rot.y = Camera_GetCamDirYaw(globalCtx->cameraPtrs[globalCtx->activeCamera]) + 0x8000; } } diff --git a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c index a6e3782bc8..2996ce5ae3 100644 --- a/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c +++ b/src/overlays/actors/ovl_Obj_Syokudai/z_obj_syokudai.c @@ -313,7 +313,8 @@ void ObjSyokudai_Draw(Actor* thisx, GlobalContext* globalCtx) { gDPSetPrimColor(POLY_XLU_DISP++, 0x80, 0x80, 255, 255, 0, 255); gDPSetEnvColor(POLY_XLU_DISP++, 255, 0, 0, 0); Matrix_InsertTranslation(0.0f, OBJ_SYOKUDAI_FLAME_HEIGHT, 0.0f, MTXMODE_APPLY); - Matrix_RotateY(BINANG_ROT180(func_800DFCDC(GET_ACTIVE_CAM(globalCtx)) - thisx->shape.rot.y), MTXMODE_APPLY); + Matrix_RotateY(BINANG_ROT180(Camera_GetCamDirYaw(GET_ACTIVE_CAM(globalCtx)) - thisx->shape.rot.y), + MTXMODE_APPLY); Matrix_Scale(flameScale, flameScale, flameScale, MTXMODE_APPLY); gSPMatrix(POLY_XLU_DISP++, Matrix_NewMtx(globalCtx->state.gfxCtx), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); gSPDisplayList(POLY_XLU_DISP++, gGameplayKeepDrawFlameDL); 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 2444b50101..5b0a5d4335 100644 --- a/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c +++ b/src/overlays/actors/ovl_Object_Kankyo/z_object_kankyo.c @@ -222,7 +222,7 @@ void func_808DC454(ObjectKankyo* this, GlobalContext* globalCtx) { this->unk_14C[i].unk_08 = globalCtx->view.eye.z + (spC8 * 120.0f); this->unk_14C[i].unk_0C = (Rand_ZeroOne() - 0.5f) * (2.0f * temp_120); - temp_f22 = (func_800DFCB4(GET_ACTIVE_CAM(globalCtx)) * 0.004f) + 60.0f; + temp_f22 = (Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)) * 0.004f) + 60.0f; if (temp_f22 < 20.0f) { temp_f22 = 20.0f; } @@ -273,7 +273,7 @@ void func_808DC454(ObjectKankyo* this, GlobalContext* globalCtx) { this->unk_14C[i].unk_10 -= this->unk_14C[i].unk_18 - (spC0 * 3.0f * (globalCtx->envCtx.windSpeed / 100.0f)); - temp_f22 = (-func_800DFCB4(GET_ACTIVE_CAM(globalCtx)) * 0.012f) + 40.0f; + temp_f22 = (-Camera_GetCamDirPitch(GET_ACTIVE_CAM(globalCtx)) * 0.012f) + 40.0f; if (temp_f22 < -40.0f) { temp_f22 = -40.0f; } @@ -514,7 +514,7 @@ void func_808DD3C8(Actor* thisx, GlobalContext* globalCtx2) { f32 temp_f2; f32 tempf; - if ((globalCtx->cameraPtrs[MAIN_CAM]->flags2 & 0x100) || ((u8)globalCtx->envCtx.unk_E2 == 0)) { + if ((globalCtx->cameraPtrs[CAM_ID_MAIN]->flags2 & 0x100) || ((u8)globalCtx->envCtx.unk_E2 == 0)) { return; } @@ -592,7 +592,7 @@ void func_808DD970(Actor* thisx, GlobalContext* globalCtx2) { if (globalCtx->sceneNum == SCENE_KYOJINNOMA) { phi_f26 = 1.0f; } else { - tempA = func_800E031C(GET_ACTIVE_CAM(globalCtx)); + tempA = Camera_GetWaterYPos(GET_ACTIVE_CAM(globalCtx)); if (tempA != BGCHECK_Y_MIN) { tempA -= globalCtx->view.eye.y; phi_f26 = tempA / 4000.0f; @@ -602,7 +602,7 @@ void func_808DD970(Actor* thisx, GlobalContext* globalCtx2) { phi_f26 = CLAMP_MAX(phi_f26, 1.0f); - if (!(globalCtx->cameraPtrs[MAIN_CAM]->flags2 & 0x100) || (phi_f26 == 0.0f)) { + if (!(globalCtx->cameraPtrs[CAM_ID_MAIN]->flags2 & 0x100) || (phi_f26 == 0.0f)) { return; } } diff --git a/tools/actorfixer.py b/tools/actorfixer.py index a94f2b9410..c54a72422b 100755 --- a/tools/actorfixer.py +++ b/tools/actorfixer.py @@ -379,6 +379,31 @@ animdict = { "func_8017F9C0": "Math3D_XZInSphere", "func_8017FA34": "Math3D_XYInSphere", "func_8017FAA8": "Math3D_YZInSphere", + + "func_800DFB14": "Camera_ChangeDataIdx", + "func_800DFC68": "Camera_GetInputDirYaw", + "func_800DFCB4": "Camera_GetCamDirPitch", + "func_800DFCDC": "Camera_GetCamDirYaw", + "func_800E0308": "Camera_SetTargetActor", + "func_800E031C": "Camera_GetWaterYPos", + "func_800E02AC": "Camera_SetToTrackActor", + + "func_801694DC": "Play_CreateSubCamera", + "Play_GetActiveCameraIndex": "Play_GetActiveCamId", + "func_80169590": "Play_CameraChangeStatus", + "func_80169600": "Play_ClearCamera", + "func_80169668": "Play_ClearAllSubCameras", + "func_8016981C": "Play_CameraSetAtEyeUp", + "func_80169940": "Play_CameraSetFov", + "func_80169988": "Play_CameraSetRoll", + "func_801699D4": "Play_CopyCamera", + "func_80169AC0": "Play_CameraChangeSetting", + "func_80169BC4": "Play_CameraGetUID", + "func_80169C64": "Play_GetCsCamDataSetting", + "func_80169C84": "Play_GetCsCamDataVec3s", + + "func_8017D2FC": "Math3D_LineSegVsPlane", + "func_8013A7C0": "SubS_FindDoor", "func_8013E640": "SubS_FindActorCustom", "func_ActorCategoryIterateById": "SubS_FindActor", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 73e654dfec..1f4d019f0d 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1272,13 +1272,13 @@ 0x800DF86C:("func_800DF86C",), 0x800DF8EC:("func_800DF8EC",), 0x800DFAC8:("func_800DFAC8",), - 0x800DFB14:("func_800DFB14",), + 0x800DFB14:("Camera_ChangeDataIdx",), 0x800DFC1C:("func_800DFC1C",), 0x800DFC40:("func_800DFC40",), - 0x800DFC68:("func_800DFC68",), + 0x800DFC68:("Camera_GetInputDirYaw",), 0x800DFC90:("func_800DFC90",), - 0x800DFCB4:("func_800DFCB4",), - 0x800DFCDC:("func_800DFCDC",), + 0x800DFCB4:("Camera_GetCamDirPitch",), + 0x800DFCDC:("Camera_GetCamDirYaw",), 0x800DFD04:("func_800DFD04",), 0x800DFD78:("func_800DFD78",), 0x800DFEF0:("func_800DFEF0",), @@ -1294,9 +1294,9 @@ 0x800E01DC:("func_800E01DC",), 0x800E0228:("func_800E0228",), 0x800E0238:("func_800E0238",), - 0x800E02AC:("func_800E02AC",), - 0x800E0308:("func_800E0308",), - 0x800E031C:("func_800E031C",), + 0x800E02AC:("Camera_SetToTrackActor",), + 0x800E0308:("Camera_SetTargetActor",), + 0x800E031C:("Camera_GetWaterYPos",), 0x800E0348:("func_800E0348",), 0x800E03A0:("DamageTable_Get",), 0x800E03CC:("DamageTable_Clear",), @@ -3006,24 +3006,24 @@ 0x801692C4:("func_801692C4",), 0x801693D4:("Play_SceneInit",), 0x80169474:("func_80169474",), - 0x801694DC:("func_801694DC",), - 0x80169584:("Play_GetActiveCameraIndex",), - 0x80169590:("func_80169590",), - 0x80169600:("func_80169600",), - 0x80169668:("func_80169668",), + 0x801694DC:("Play_CreateSubCamera",), + 0x80169584:("Play_GetActiveCamId",), + 0x80169590:("Play_CameraChangeStatus",), + 0x80169600:("Play_ClearCamera",), + 0x80169668:("Play_ClearAllSubCameras",), 0x801696D4:("Play_GetCamera",), 0x8016970C:("Play_CameraSetAtEye",), - 0x8016981C:("func_8016981C",), - 0x80169940:("func_80169940",), - 0x80169988:("func_80169988",), - 0x801699D4:("func_801699D4",), + 0x8016981C:("Play_CameraSetAtEyeUp",), + 0x80169940:("Play_CameraSetFov",), + 0x80169988:("Play_CameraSetRoll",), + 0x801699D4:("Play_CopyCamera",), 0x80169A50:("func_80169A50",), - 0x80169AC0:("func_80169AC0",), + 0x80169AC0:("Play_CameraChangeSetting",), 0x80169AFC:("func_80169AFC",), - 0x80169BC4:("func_80169BC4",), + 0x80169BC4:("Play_CameraGetUID",), 0x80169BF8:("func_80169BF8",), - 0x80169C64:("func_80169C64",), - 0x80169C84:("func_80169C84",), + 0x80169C64:("Play_GetCsCamDataSetting",), + 0x80169C84:("Play_GetCsCamDataVec3s",), 0x80169CBC:("convert_scene_number_among_shared_scenes",), 0x80169D40:("func_80169D40",), 0x80169DCC:("func_80169DCC",), @@ -3320,7 +3320,7 @@ 0x8017D020:("Math3D_TriChkLineSegParaZIntersect",), 0x8017D1AC:("func_8017D1AC",), 0x8017D220:("func_8017D220",), - 0x8017D2FC:("func_8017D2FC",), + 0x8017D2FC:("Math3D_LineSegVsPlane",), 0x8017D404:("func_8017D404",), 0x8017D568:("Math3D_TriSetCoords",), 0x8017D618:("Math3D_IsPointInSphere",), @@ -5688,7 +5688,7 @@ 0x808A3A44:("EnMinifrog_Jump",), 0x808A3B04:("EnMinifrog_TurnToPlayer",), 0x808A3B3C:("EnMinifrog_TurnToMissingFrog",), - 0x808A3B74:("EnMinifrog_SetCamera",), + 0x808A3B74:("EnMinifrog_SpawnDust",), 0x808A3DA8:("EnMinifrog_ReturnFrogCutscene",), 0x808A3F88:("EnMinifrog_SpawnGrowAndShrink",), 0x808A4040:("EnMinifrog_Idle",), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index df41d48299..f14ca73074 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -786,13 +786,13 @@ asm/non_matchings/code/z_camera/Camera_ChangeMode.s,Camera_ChangeMode,0x800DF840 asm/non_matchings/code/z_camera/func_800DF86C.s,func_800DF86C,0x800DF86C,0x20 asm/non_matchings/code/z_camera/func_800DF8EC.s,func_800DF8EC,0x800DF8EC,0x77 asm/non_matchings/code/z_camera/func_800DFAC8.s,func_800DFAC8,0x800DFAC8,0x13 -asm/non_matchings/code/z_camera/func_800DFB14.s,func_800DFB14,0x800DFB14,0x42 +asm/non_matchings/code/z_camera/Camera_ChangeDataIdx.s,Camera_ChangeDataIdx,0x800DFB14,0x42 asm/non_matchings/code/z_camera/func_800DFC1C.s,func_800DFC1C,0x800DFC1C,0x9 asm/non_matchings/code/z_camera/func_800DFC40.s,func_800DFC40,0x800DFC40,0xA -asm/non_matchings/code/z_camera/func_800DFC68.s,func_800DFC68,0x800DFC68,0xA +asm/non_matchings/code/z_camera/Camera_GetInputDirYaw.s,Camera_GetInputDirYaw,0x800DFC68,0xA asm/non_matchings/code/z_camera/func_800DFC90.s,func_800DFC90,0x800DFC90,0x9 -asm/non_matchings/code/z_camera/func_800DFCB4.s,func_800DFCB4,0x800DFCB4,0xA -asm/non_matchings/code/z_camera/func_800DFCDC.s,func_800DFCDC,0x800DFCDC,0xA +asm/non_matchings/code/z_camera/Camera_GetCamDirPitch.s,Camera_GetCamDirPitch,0x800DFCB4,0xA +asm/non_matchings/code/z_camera/Camera_GetCamDirYaw.s,Camera_GetCamDirYaw,0x800DFCDC,0xA asm/non_matchings/code/z_camera/func_800DFD04.s,func_800DFD04,0x800DFD04,0x1D asm/non_matchings/code/z_camera/func_800DFD78.s,func_800DFD78,0x800DFD78,0x5E asm/non_matchings/code/z_camera/func_800DFEF0.s,func_800DFEF0,0x800DFEF0,0xA @@ -808,9 +808,9 @@ asm/non_matchings/code/z_camera/func_800E01B8.s,func_800E01B8,0x800E01B8,0x9 asm/non_matchings/code/z_camera/func_800E01DC.s,func_800E01DC,0x800E01DC,0x13 asm/non_matchings/code/z_camera/func_800E0228.s,func_800E0228,0x800E0228,0x4 asm/non_matchings/code/z_camera/func_800E0238.s,func_800E0238,0x800E0238,0x1D -asm/non_matchings/code/z_camera/func_800E02AC.s,func_800E02AC,0x800E02AC,0x17 -asm/non_matchings/code/z_camera/func_800E0308.s,func_800E0308,0x800E0308,0x5 -asm/non_matchings/code/z_camera/func_800E031C.s,func_800E031C,0x800E031C,0xB +asm/non_matchings/code/z_camera/Camera_SetToTrackActor.s,Camera_SetToTrackActor,0x800E02AC,0x17 +asm/non_matchings/code/z_camera/Camera_SetTargetActor.s,Camera_SetTargetActor,0x800E0308,0x5 +asm/non_matchings/code/z_camera/Camera_GetWaterYPos.s,Camera_GetWaterYPos,0x800E031C,0xB asm/non_matchings/code/z_camera/func_800E0348.s,func_800E0348,0x800E0348,0x16 asm/non_matchings/code/z_collision_btltbls/DamageTable_Get.s,DamageTable_Get,0x800E03A0,0xB asm/non_matchings/code/z_collision_btltbls/DamageTable_Clear.s,DamageTable_Clear,0x800E03CC,0xD @@ -2520,24 +2520,24 @@ asm/non_matchings/code/z_play/func_8016927C.s,func_8016927C,0x8016927C,0x12 asm/non_matchings/code/z_play/func_801692C4.s,func_801692C4,0x801692C4,0x44 asm/non_matchings/code/z_play/Play_SceneInit.s,Play_SceneInit,0x801693D4,0x28 asm/non_matchings/code/z_play/func_80169474.s,func_80169474,0x80169474,0x1A -asm/non_matchings/code/z_play/func_801694DC.s,func_801694DC,0x801694DC,0x2A -asm/non_matchings/code/z_play/Play_GetActiveCameraIndex.s,Play_GetActiveCameraIndex,0x80169584,0x3 -asm/non_matchings/code/z_play/func_80169590.s,func_80169590,0x80169590,0x1C -asm/non_matchings/code/z_play/func_80169600.s,func_80169600,0x80169600,0x1A -asm/non_matchings/code/z_play/func_80169668.s,func_80169668,0x80169668,0x1B +asm/non_matchings/code/z_play/Play_CreateSubCamera.s,Play_CreateSubCamera,0x801694DC,0x2A +asm/non_matchings/code/z_play/Play_GetActiveCamId.s,Play_GetActiveCamId,0x80169584,0x3 +asm/non_matchings/code/z_play/Play_CameraChangeStatus.s,Play_CameraChangeStatus,0x80169590,0x1C +asm/non_matchings/code/z_play/Play_ClearCamera.s,Play_ClearCamera,0x80169600,0x1A +asm/non_matchings/code/z_play/Play_ClearAllSubCameras.s,Play_ClearAllSubCameras,0x80169668,0x1B asm/non_matchings/code/z_play/Play_GetCamera.s,Play_GetCamera,0x801696D4,0xE asm/non_matchings/code/z_play/Play_CameraSetAtEye.s,Play_CameraSetAtEye,0x8016970C,0x44 -asm/non_matchings/code/z_play/func_8016981C.s,func_8016981C,0x8016981C,0x49 -asm/non_matchings/code/z_play/func_80169940.s,func_80169940,0x80169940,0x12 -asm/non_matchings/code/z_play/func_80169988.s,func_80169988,0x80169988,0x13 -asm/non_matchings/code/z_play/func_801699D4.s,func_801699D4,0x801699D4,0x1F +asm/non_matchings/code/z_play/Play_CameraSetAtEyeUp.s,Play_CameraSetAtEyeUp,0x8016981C,0x49 +asm/non_matchings/code/z_play/Play_CameraSetFov.s,Play_CameraSetFov,0x80169940,0x12 +asm/non_matchings/code/z_play/Play_CameraSetRoll.s,Play_CameraSetRoll,0x80169988,0x13 +asm/non_matchings/code/z_play/Play_CopyCamera.s,Play_CopyCamera,0x801699D4,0x1F asm/non_matchings/code/z_play/func_80169A50.s,func_80169A50,0x80169A50,0x1C -asm/non_matchings/code/z_play/func_80169AC0.s,func_80169AC0,0x80169AC0,0xF +asm/non_matchings/code/z_play/Play_CameraChangeSetting.s,Play_CameraChangeSetting,0x80169AC0,0xF asm/non_matchings/code/z_play/func_80169AFC.s,func_80169AFC,0x80169AFC,0x32 -asm/non_matchings/code/z_play/func_80169BC4.s,func_80169BC4,0x80169BC4,0xD +asm/non_matchings/code/z_play/Play_CameraGetUID.s,Play_CameraGetUID,0x80169BC4,0xD asm/non_matchings/code/z_play/func_80169BF8.s,func_80169BF8,0x80169BF8,0x1B -asm/non_matchings/code/z_play/func_80169C64.s,func_80169C64,0x80169C64,0x8 -asm/non_matchings/code/z_play/func_80169C84.s,func_80169C84,0x80169C84,0xE +asm/non_matchings/code/z_play/Play_GetCsCamDataSetting.s,Play_GetCsCamDataSetting,0x80169C64,0x8 +asm/non_matchings/code/z_play/Play_GetCsCamDataVec3s.s,Play_GetCsCamDataVec3s,0x80169C84,0xE asm/non_matchings/code/z_play/convert_scene_number_among_shared_scenes.s,convert_scene_number_among_shared_scenes,0x80169CBC,0x21 asm/non_matchings/code/z_play/func_80169D40.s,func_80169D40,0x80169D40,0x23 asm/non_matchings/code/z_play/func_80169DCC.s,func_80169DCC,0x80169DCC,0x28 @@ -2834,7 +2834,7 @@ asm/non_matchings/code/sys_math3d/func_8017CFA4.s,func_8017CFA4,0x8017CFA4,0x1F asm/non_matchings/code/sys_math3d/Math3D_TriChkLineSegParaZIntersect.s,Math3D_TriChkLineSegParaZIntersect,0x8017D020,0x63 asm/non_matchings/code/sys_math3d/func_8017D1AC.s,func_8017D1AC,0x8017D1AC,0x1D asm/non_matchings/code/sys_math3d/func_8017D220.s,func_8017D220,0x8017D220,0x37 -asm/non_matchings/code/sys_math3d/func_8017D2FC.s,func_8017D2FC,0x8017D2FC,0x42 +asm/non_matchings/code/sys_math3d/Math3D_LineSegVsPlane.s,Math3D_LineSegVsPlane,0x8017D2FC,0x42 asm/non_matchings/code/sys_math3d/func_8017D404.s,func_8017D404,0x8017D404,0x59 asm/non_matchings/code/sys_math3d/Math3D_TriSetCoords.s,Math3D_TriSetCoords,0x8017D568,0x2C asm/non_matchings/code/sys_math3d/Math3D_IsPointInSphere.s,Math3D_IsPointInSphere,0x8017D618,0x14