1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-18 05:44:53 +00:00

Document Sub-Cameras (#989)

* Copying SubCam Changes from PR 908, made it to the end of bosses

* Finish copying over PR

* format

* More cleanup

* clean-up

* PR Suggestions, Clean-Up, Improvement in CS

* Remove substructs from fd/fd2

* format

* Improve fishing

* minor fix

* Make CutsceneCameraDir more general

* `sActiveCamMove` -> `sCamMove`

* Fix conflict with object kankyo

* Add CAM_ID_MAIN to object_kankyo

* Improve cam cutscenes further

* Revert cutscene cmd names (better for a separate PR)

* At -> LookAt in the context of Cutscenes

* Missed naming in diving game

* Format

* Fill in Ganon2 Names (now that it's matching)

* format

* `sActiveCamId` -> `sReturnToCamId`

* activeCamId -> returnToCamId

* Discord Discussions

* FIRST

* Move macro to bottom, comments

* More suggestions

* PR suggestion, cleanup comment

* Oops

* add comments

* Adjust comment

* Change edge-case

* whoops

Co-authored-by: fig02 <fig02srl@gmail.com>
This commit is contained in:
engineer124 2022-05-13 04:35:31 +10:00 committed by GitHub
parent 92aef346f2
commit bf56c94f0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
143 changed files with 2778 additions and 2768 deletions

View file

@ -96,7 +96,7 @@ void* D_8011E304[] = {
u16 D_8015FCC0;
u16 D_8015FCC2;
u16 D_8015FCC4;
s16 D_8015FCC6;
s16 sReturnToCamId;
u8 D_8015FCC8;
s16 sQuakeIndex;
u16 D_8015FCCC; // only written to, never read
@ -1330,8 +1330,8 @@ void Cutscene_Command_TransitionFX(GlobalContext* globalCtx, CutsceneContext* cs
}
}
// Command 0x1 & 0x5: Camera Positions
s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) {
// Command 0x1 & 0x5: Camera Eye Points
s32 Cutscene_Command_CameraEyePoints(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) {
s32 shouldContinue = 1;
CsCmdBase* cmdBase = (CsCmdBase*)cmd;
s32 size;
@ -1342,16 +1342,16 @@ s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext*
if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) &&
((csCtx->unk_18 < cmdBase->startFrame) || (csCtx->unk_18 >= 0xF000))) {
csCtx->unk_1B = 1;
csCtx->cameraPosition = (CutsceneCameraPoint*)cmd;
csCtx->subCamEyePoints = (CutsceneCameraPoint*)cmd;
if (csCtx->unk_1A != 0) {
csCtx->unk_18 = cmdBase->startFrame;
if (D_8015FCC8 != 0) {
Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_CS_0);
Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, CAM_STAT_WAIT);
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE);
Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->unk_14));
Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->unk_14), csCtx->cameraFocus,
csCtx->cameraPosition, GET_PLAYER(globalCtx), relativeToLink);
Gameplay_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_CS_0);
Gameplay_ChangeCameraStatus(globalCtx, sReturnToCamId, CAM_STAT_WAIT);
Gameplay_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE);
Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->subCamId));
Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->subCamId), csCtx->subCamLookAtPoints,
csCtx->subCamEyePoints, GET_PLAYER(globalCtx), relativeToLink);
}
}
}
@ -1367,8 +1367,8 @@ s32 Cutscene_Command_CameraPositions(GlobalContext* globalCtx, CutsceneContext*
return size;
}
// Command 0x2 & 0x6: Camera Focus Points
s32 Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) {
// Command 0x2 & 0x6: Camera At Points
s32 Cutscene_Command_CameraLookAtPoints(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cmd, u8 relativeToLink) {
s32 shouldContinue = 1;
CsCmdBase* cmdBase = (CsCmdBase*)cmd;
s32 size;
@ -1379,16 +1379,16 @@ s32 Cutscene_Command_CameraFocus(GlobalContext* globalCtx, CutsceneContext* csCt
if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) &&
((D_8015FCC0 < cmdBase->startFrame) || (D_8015FCC0 >= 0xF000))) {
csCtx->unk_1A = 1;
csCtx->cameraFocus = (CutsceneCameraPoint*)cmd;
csCtx->subCamLookAtPoints = (CutsceneCameraPoint*)cmd;
if (csCtx->unk_1B != 0) {
D_8015FCC0 = cmdBase->startFrame;
if (D_8015FCC8 != 0) {
Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_CS_0);
Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, CAM_STAT_WAIT);
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE);
Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->unk_14));
Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->unk_14), csCtx->cameraFocus,
csCtx->cameraPosition, GET_PLAYER(globalCtx), relativeToLink);
Gameplay_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_CS_0);
Gameplay_ChangeCameraStatus(globalCtx, sReturnToCamId, CAM_STAT_WAIT);
Gameplay_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE);
Camera_ResetAnim(Gameplay_GetCamera(globalCtx, csCtx->subCamId));
Camera_SetCSParams(Gameplay_GetCamera(globalCtx, csCtx->subCamId), csCtx->subCamLookAtPoints,
csCtx->subCamEyePoints, GET_PLAYER(globalCtx), relativeToLink);
}
}
}
@ -1410,7 +1410,7 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm
s32 size;
Vec3f sp3C;
Vec3f sp30;
Camera* sp2C;
Camera* subCam;
f32 sp28;
cmd += 8;
@ -1419,25 +1419,25 @@ s32 Cutscene_Command_07(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm
if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) &&
((D_8015FCC2 < cmdBase->startFrame) || (D_8015FCC2 >= 0xF000))) {
csCtx->unk_1B = 1;
csCtx->cameraPosition = (CutsceneCameraPoint*)cmd;
csCtx->subCamEyePoints = (CutsceneCameraPoint*)cmd;
if (csCtx->unk_1A != 0) {
D_8015FCC2 = cmdBase->startFrame;
if (D_8015FCC8 != 0) {
sp2C = Gameplay_GetCamera(globalCtx, csCtx->unk_14);
sp2C->player = NULL;
Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT);
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE);
Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_FREE0);
sp28 = csCtx->cameraFocus->cameraRoll * 1.40625f;
Camera_SetParam(sp2C, 64, &sp28);
sp3C.x = csCtx->cameraFocus->pos.x;
sp3C.y = csCtx->cameraFocus->pos.y;
sp3C.z = csCtx->cameraFocus->pos.z;
sp30.x = csCtx->cameraPosition->pos.x;
sp30.y = csCtx->cameraPosition->pos.y;
sp30.z = csCtx->cameraPosition->pos.z;
Gameplay_CameraSetAtEye(globalCtx, csCtx->unk_14, &sp3C, &sp30);
Gameplay_CameraSetFov(globalCtx, csCtx->unk_14, csCtx->cameraPosition->viewAngle);
subCam = Gameplay_GetCamera(globalCtx, csCtx->subCamId);
subCam->player = NULL;
Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT);
Gameplay_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE);
Gameplay_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_FREE0);
sp28 = csCtx->subCamLookAtPoints->cameraRoll * 1.40625f;
Camera_SetParam(subCam, 64, &sp28);
sp3C.x = csCtx->subCamLookAtPoints->pos.x;
sp3C.y = csCtx->subCamLookAtPoints->pos.y;
sp3C.z = csCtx->subCamLookAtPoints->pos.z;
sp30.x = csCtx->subCamEyePoints->pos.x;
sp30.y = csCtx->subCamEyePoints->pos.y;
sp30.z = csCtx->subCamEyePoints->pos.z;
Gameplay_CameraSetAtEye(globalCtx, csCtx->subCamId, &sp3C, &sp30);
Gameplay_CameraSetFov(globalCtx, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle);
}
}
}
@ -1453,7 +1453,7 @@ s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm
s32 size;
Vec3f sp3C;
Vec3f sp30;
Camera* sp2C;
Camera* subCam;
f32 sp28;
cmd += 8;
@ -1462,23 +1462,23 @@ s32 Cutscene_Command_08(GlobalContext* globalCtx, CutsceneContext* csCtx, u8* cm
if ((cmdBase->startFrame < csCtx->frames) && (csCtx->frames < cmdBase->endFrame) &&
((D_8015FCC4 < cmdBase->startFrame) || (D_8015FCC4 >= 0xF000))) {
csCtx->unk_1A = 1;
csCtx->cameraFocus = (CutsceneCameraPoint*)cmd;
csCtx->subCamLookAtPoints = (CutsceneCameraPoint*)cmd;
if (csCtx->unk_1B != 0) {
D_8015FCC4 = cmdBase->startFrame;
if (D_8015FCC8 != 0) {
sp2C = Gameplay_GetCamera(globalCtx, csCtx->unk_14);
sp2C->player = NULL;
Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_WAIT);
Gameplay_ChangeCameraStatus(globalCtx, csCtx->unk_14, CAM_STAT_ACTIVE);
Gameplay_CameraChangeSetting(globalCtx, csCtx->unk_14, CAM_SET_FREE0);
sp3C.x = csCtx->cameraFocus->pos.x;
sp3C.y = csCtx->cameraFocus->pos.y;
sp3C.z = csCtx->cameraFocus->pos.z;
sp30.x = csCtx->cameraPosition->pos.x;
sp30.y = csCtx->cameraPosition->pos.y;
sp30.z = csCtx->cameraPosition->pos.z;
Gameplay_CameraSetAtEye(globalCtx, csCtx->unk_14, &sp3C, &sp30);
Gameplay_CameraSetFov(globalCtx, csCtx->unk_14, csCtx->cameraPosition->viewAngle);
subCam = Gameplay_GetCamera(globalCtx, csCtx->subCamId);
subCam->player = NULL;
Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_WAIT);
Gameplay_ChangeCameraStatus(globalCtx, csCtx->subCamId, CAM_STAT_ACTIVE);
Gameplay_CameraChangeSetting(globalCtx, csCtx->subCamId, CAM_SET_FREE0);
sp3C.x = csCtx->subCamLookAtPoints->pos.x;
sp3C.y = csCtx->subCamLookAtPoints->pos.y;
sp3C.z = csCtx->subCamLookAtPoints->pos.z;
sp30.x = csCtx->subCamEyePoints->pos.x;
sp30.y = csCtx->subCamEyePoints->pos.y;
sp30.z = csCtx->subCamEyePoints->pos.z;
Gameplay_CameraSetAtEye(globalCtx, csCtx->subCamId, &sp3C, &sp30);
Gameplay_CameraSetFov(globalCtx, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle);
}
}
}
@ -1859,16 +1859,16 @@ void Cutscene_ProcessCommands(GlobalContext* globalCtx, CutsceneContext* csCtx,
}
break;
case CS_CMD_CAM_EYE:
cutscenePtr += Cutscene_Command_CameraPositions(globalCtx, csCtx, (void*)cutscenePtr, 0);
cutscenePtr += Cutscene_Command_CameraEyePoints(globalCtx, csCtx, (void*)cutscenePtr, 0);
break;
case CS_CMD_CAM_EYE_REL_TO_PLAYER:
cutscenePtr += Cutscene_Command_CameraPositions(globalCtx, csCtx, (void*)cutscenePtr, 1);
cutscenePtr += Cutscene_Command_CameraEyePoints(globalCtx, csCtx, (void*)cutscenePtr, 1);
break;
case CS_CMD_CAM_AT:
cutscenePtr += Cutscene_Command_CameraFocus(globalCtx, csCtx, (void*)cutscenePtr, 0);
cutscenePtr += Cutscene_Command_CameraLookAtPoints(globalCtx, csCtx, (void*)cutscenePtr, 0);
break;
case CS_CMD_CAM_AT_REL_TO_PLAYER:
cutscenePtr += Cutscene_Command_CameraFocus(globalCtx, csCtx, (void*)cutscenePtr, 1);
cutscenePtr += Cutscene_Command_CameraLookAtPoints(globalCtx, csCtx, (void*)cutscenePtr, 1);
break;
case CS_CMD_07:
cutscenePtr += Cutscene_Command_07(globalCtx, csCtx, (void*)cutscenePtr, 0);
@ -1967,12 +1967,12 @@ void func_80068DC0(GlobalContext* globalCtx, CutsceneContext* csCtx) {
case 0x028E:
case 0x0292:
case 0x0476:
Gameplay_CopyCamera(globalCtx, D_8015FCC6, csCtx->unk_14);
Gameplay_CopyCamera(globalCtx, sReturnToCamId, csCtx->subCamId);
}
Gameplay_ChangeCameraStatus(globalCtx, D_8015FCC6, CAM_STAT_ACTIVE);
Gameplay_ClearCamera(globalCtx, csCtx->unk_14);
func_8005B1A4(globalCtx->cameraPtrs[D_8015FCC6]);
Gameplay_ChangeCameraStatus(globalCtx, sReturnToCamId, CAM_STAT_ACTIVE);
Gameplay_ClearCamera(globalCtx, csCtx->subCamId);
func_8005B1A4(globalCtx->cameraPtrs[sReturnToCamId]);
}
Audio_SetCutsceneFlag(0);
@ -2011,10 +2011,10 @@ void func_80068ECC(GlobalContext* globalCtx, CutsceneContext* csCtx) {
D_8015FCC4 = 0xFFFF;
csCtx->unk_1A = 0;
csCtx->unk_1B = 0;
D_8015FCC6 = globalCtx->activeCamera;
sReturnToCamId = globalCtx->activeCamId;
if (D_8015FCC8 != 0) {
csCtx->unk_14 = Gameplay_CreateSubCamera(globalCtx);
csCtx->subCamId = Gameplay_CreateSubCamera(globalCtx);
}
if (gSaveContext.cutsceneTrigger == 0) {