diff options
| author | engineer124 <47598039+engineer124@users.noreply.github.com> | 2022-12-17 16:07:31 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-12-17 16:07:31 -0500 |
| commit | 934d488420e925daeb7f0d233d896c48d432f7f7 (patch) | |
| tree | 3f1a4cb8d3a3463e42e00bb908592b95576bf2bd /src/code | |
| parent | aa48c66e10fc067e4d41c3a1d097bd83dea53acf (diff) | |
`z_play`: Camera Docs and Cleanup (#1460)
* begin docs
* More suggestions
* more docs
* timer to duration
* partial PR review
* init data with player
* consistent comments
* withPlayer to usingPlayer
Diffstat (limited to 'src/code')
| -rw-r--r-- | src/code/z_camera.c | 2 | ||||
| -rw-r--r-- | src/code/z_demo.c | 16 | ||||
| -rw-r--r-- | src/code/z_horse.c | 2 | ||||
| -rw-r--r-- | src/code/z_onepointdemo.c | 317 | ||||
| -rw-r--r-- | src/code/z_play.c | 95 |
5 files changed, 267 insertions, 165 deletions
diff --git a/src/code/z_camera.c b/src/code/z_camera.c index dcd9c2c39..af63cc077 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -7133,7 +7133,7 @@ void func_80057FC4(Camera* camera) { void Camera_Stub80058140(Camera* camera) { } -void Camera_InitPlayerSettings(Camera* camera, Player* player) { +void Camera_InitDataUsingPlayer(Camera* camera, Player* player) { PosRot playerPosShape; VecGeo eyeNextAtOffset; s32 bgId; diff --git a/src/code/z_demo.c b/src/code/z_demo.c index 7193a034c..4b3a23994 100644 --- a/src/code/z_demo.c +++ b/src/code/z_demo.c @@ -1347,7 +1347,7 @@ s32 Cutscene_Command_CameraEyePoints(PlayState* play, CutsceneContext* csCtx, u8 if (csCtx->unk_1A != 0) { csCtx->unk_18 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_CS_0); + Play_ChangeCameraSetting(play, csCtx->subCamId, CAM_SET_CS_0); Play_ChangeCameraStatus(play, sReturnToCamId, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE); Camera_ResetAnim(Play_GetCamera(play, csCtx->subCamId)); @@ -1384,7 +1384,7 @@ s32 Cutscene_Command_CameraLookAtPoints(PlayState* play, CutsceneContext* csCtx, if (csCtx->unk_1B != 0) { D_8015FCC0 = cmdBase->startFrame; if (D_8015FCC8 != 0) { - Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_CS_0); + Play_ChangeCameraSetting(play, csCtx->subCamId, CAM_SET_CS_0); Play_ChangeCameraStatus(play, sReturnToCamId, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE); Camera_ResetAnim(Play_GetCamera(play, csCtx->subCamId)); @@ -1428,7 +1428,7 @@ s32 Cutscene_Command_07(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 unu subCam->player = NULL; Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE); - Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_FREE0); + Play_ChangeCameraSetting(play, csCtx->subCamId, CAM_SET_FREE0); sp28 = csCtx->subCamLookAtPoints->cameraRoll * 1.40625f; Camera_SetViewParam(subCam, CAM_VIEW_ROLL, &sp28); sp3C.x = csCtx->subCamLookAtPoints->pos.x; @@ -1437,8 +1437,8 @@ s32 Cutscene_Command_07(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 unu sp30.x = csCtx->subCamEyePoints->pos.x; sp30.y = csCtx->subCamEyePoints->pos.y; sp30.z = csCtx->subCamEyePoints->pos.z; - Play_CameraSetAtEye(play, csCtx->subCamId, &sp3C, &sp30); - Play_CameraSetFov(play, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle); + Play_SetCameraAtEye(play, csCtx->subCamId, &sp3C, &sp30); + Play_SetCameraFov(play, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle); } } } @@ -1471,15 +1471,15 @@ s32 Cutscene_Command_08(PlayState* play, CutsceneContext* csCtx, u8* cmd, u8 unu subCam->player = NULL; Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_WAIT); Play_ChangeCameraStatus(play, csCtx->subCamId, CAM_STAT_ACTIVE); - Play_CameraChangeSetting(play, csCtx->subCamId, CAM_SET_FREE0); + Play_ChangeCameraSetting(play, 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; - Play_CameraSetAtEye(play, csCtx->subCamId, &sp3C, &sp30); - Play_CameraSetFov(play, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle); + Play_SetCameraAtEye(play, csCtx->subCamId, &sp3C, &sp30); + Play_SetCameraFov(play, csCtx->subCamId, csCtx->subCamEyePoints->viewAngle); } } } diff --git a/src/code/z_horse.c b/src/code/z_horse.c index ec5ab7fa3..4e45059fe 100644 --- a/src/code/z_horse.c +++ b/src/code/z_horse.c @@ -227,7 +227,7 @@ void func_8006D684(PlayState* play, Player* player) { sp54.y = player->actor.world.pos.y + 100.0f; sp54.z = player->actor.world.pos.z; - Play_CameraSetAtEye(play, play->activeCamId, &player->actor.world.pos, &sp54); + Play_SetCameraAtEye(play, play->activeCamId, &player->actor.world.pos, &sp54); } else { Actor_Spawn(&play->actorCtx, play, ACTOR_EN_HORSE, D_8011F9B8[i].pos.x, D_8011F9B8[i].pos.y, D_8011F9B8[i].pos.z, 0, D_8011F9B8[i].angle, 0, D_8011F9B8[i].type); diff --git a/src/code/z_onepointdemo.c b/src/code/z_onepointdemo.c index 957c2897c..6f2bd9c38 100644 --- a/src/code/z_onepointdemo.c +++ b/src/code/z_onepointdemo.c @@ -74,7 +74,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act OnePointCsInfo* csInfo = &subCam->paramData.uniq9.csInfo; switch (csId) { - case 1020: + case 1020: // smoothly return to main camera from current view if (timer < 20) { timer = 20; } @@ -91,8 +91,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801208EC; csInfo->keyFrameCnt = 3; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 1030: D_80120964[0].atTargetInit = play->view.at; D_80120964[0].eyeTargetInit = play->view.eye; @@ -104,8 +105,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80120964; csInfo->keyFrameCnt = 2; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 5000: D_801209B4[0].atTargetInit = D_801209B4[1].atTargetInit = play->view.at; D_801209B4[0].eyeTargetInit = play->view.eye; @@ -118,18 +120,21 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801209B4; csInfo->keyFrameCnt = 4; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 5010: - func_800C0808(play, subCamId, player, CAM_SET_CS_ATTENTION); - Play_CameraSetAtEye(play, subCamId, &mainCam->at, &mainCam->eye); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_ATTENTION); + Play_SetCameraAtEye(play, subCamId, &mainCam->at, &mainCam->eye); subCam->roll = 0; break; + case 9500: csInfo->keyFrames = D_80120A54; csInfo->keyFrameCnt = 3; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 2260: D_80120ACC[0].atTargetInit.x = D_80120ACC[2].atTargetInit.x = ((mainCam->play->state.frames & 1) ? -10.0f : 10.0f) + (Rand_ZeroOne() * 8.0f); @@ -140,8 +145,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80120ACC; csInfo->keyFrameCnt = 5; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 2270: csInfo->keyFrames = D_80120B94; csInfo->keyFrameCnt = 11; @@ -157,13 +163,14 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act D_80120B94[subCamId - 1].eyeTargetInit.y = ((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_5); Quake_SetSpeed(i, 400); Quake_SetPerturbations(i, 4, 5, 40, 0x3C); Quake_SetDuration(i, 1600); break; + case 2280: csInfo->keyFrames = D_80120D4C; csInfo->keyFrameCnt = 7; @@ -178,24 +185,26 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act } D_80120D4C[subCamId - 1].eyeTargetInit.y = ((mainCam->play->state.frames & 1) ? 3.0f : -3.0f) + Rand_ZeroOne(); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_5); Quake_SetSpeed(i, 400); Quake_SetPerturbations(i, 2, 3, 200, 0x32); Quake_SetDuration(i, 9999); break; + case 2220: csInfo->keyFrames = D_80120E64; csInfo->keyFrameCnt = 8; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_5); Quake_SetSpeed(i, 400); Quake_SetPerturbations(i, 2, 2, 50, 0); Quake_SetDuration(i, 280); break; + case 2230: if (player->actor.world.pos.z < 1000.0f) { D_80120FA4[0].eyeTargetInit.x = -D_80120FA4[0].eyeTargetInit.x; @@ -205,25 +214,28 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80120FA4; csInfo->keyFrameCnt = 6; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 2340: csInfo->keyFrames = D_80121094; csInfo->keyFrameCnt = 3; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_5); Quake_SetSpeed(i, 400); Quake_SetPerturbations(i, 2, 2, 50, 0); Quake_SetDuration(i, 60); break; + case 2350: csInfo->keyFrames = D_8012110C; csInfo->keyFrameCnt = 3; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 2200: { s16 sp82; s16 sp80; @@ -259,8 +271,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrameCnt = 2; } Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_UNK3); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); } break; + case 2290: { Actor* rideActor = player->rideActor; @@ -272,16 +285,18 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80121224; csInfo->keyFrameCnt = 6; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); } break; + case 5120: func_8002DF54(play, NULL, PLAYER_CSMODE_8); csInfo->keyFrames = D_80121314; csInfo->keyFrameCnt = 1; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4510: D_8012133C[0].eyeTargetInit = actor->world.pos; D_8012133C[0].eyeTargetInit.y = player->actor.world.pos.y + 40.0f; @@ -290,8 +305,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_8012133C; csInfo->keyFrameCnt = 3; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4500: Actor_GetFocus(&spA0, actor); spC0 = spA0.pos; @@ -301,8 +317,8 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act spD0.pitch = 0x3E8; OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0); - Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FREE2); + Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); func_8002DF54(play, NULL, PLAYER_CSMODE_8); subCam->roll = 0; subCam->fov = 50.0f; @@ -310,6 +326,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act OnePointCutscene_EndCutscene(play, subCam->childCamId); } break; + case 2210: OLib_Vec3fDiffToVecGeo(&spD0, &player->actor.world.pos, &actor->world.pos); D_801213B4[0].eyeTargetInit.y = D_801213B4[1].eyeTargetInit.y = D_801213B4[2].eyeTargetInit.y = @@ -322,34 +339,37 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801213B4; csInfo->keyFrameCnt = 5; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 1010: - Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(play, subCamId, &childCam->at, &childCam->eye); - Play_CameraSetFov(play, subCamId, childCam->fov); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FREE2); + Play_SetCameraAtEye(play, subCamId, &childCam->at, &childCam->eye); + Play_SetCameraFov(play, subCamId, childCam->fov); Play_SetCameraRoll(play, subCamId, childCam->roll); break; - case 9601: - // Leaving a crawlspace forwards - Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3); - Play_CameraChangeSetting(play, CAM_ID_MAIN, mainCam->prevSetting); + + case 9601: // Leaving a crawlspace forwards + Play_ChangeCameraSetting(play, subCamId, CAM_SET_CS_3); + Play_ChangeCameraSetting(play, CAM_ID_MAIN, mainCam->prevSetting); OnePointCutscene_SetCsCamPoints(subCam, sCrawlspaceActionParam | 0x1000, sCrawlspaceTimer, sCrawlspaceAtPoints, sCrawlspaceForwardsEyePoints); break; - case 9602: - // Leaving a crawlspace backwards - Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3); - Play_CameraChangeSetting(play, CAM_ID_MAIN, mainCam->prevSetting); + + case 9602: // Leaving a crawlspace backwards + Play_ChangeCameraSetting(play, subCamId, CAM_SET_CS_3); + Play_ChangeCameraSetting(play, CAM_ID_MAIN, mainCam->prevSetting); OnePointCutscene_SetCsCamPoints(subCam, sCrawlspaceActionParam | 0x1000, sCrawlspaceTimer, sCrawlspaceAtPoints, sCrawlspaceBackwardsEyePoints); break; + case 4175: csInfo->keyFrames = D_8012147C; csInfo->keyFrameCnt = 4; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4180: spC0.x = -1881.0f; spC0.y = 766.0f; @@ -357,12 +377,13 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act spB4.x = -1979.0f; spB4.y = 703.0f; spB4.z = -269.0f; - Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FREE2); + Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 6; subCam->fov = 75.0f; func_8002DF54(play, NULL, PLAYER_CSMODE_8); break; + case 3040: func_8002DF54(play, NULL, PLAYER_CSMODE_8); D_8012151C[0].timerInit = timer - 1; @@ -370,8 +391,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_8012151C; csInfo->keyFrameCnt = 2; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3020: D_8012156C[1].timerInit = timer - 1; if (mainCam->play->state.frames & 1) { @@ -387,75 +409,83 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_8012156C; csInfo->keyFrameCnt = 2; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); func_8002DF54(play, NULL, PLAYER_CSMODE_8); break; + case 3010: D_801215BC[0].timerInit = timer; csInfo->keyFrames = D_801215BC; csInfo->keyFrameCnt = 1; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3070: csInfo->keyFrames = D_801215E4; csInfo->keyFrameCnt = 10; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_3); Quake_SetSpeed(i, 22000); Quake_SetPerturbations(i, 2, 0, 200, 0); Quake_SetDuration(i, 10); break; + case 3080: csInfo->keyFrames = D_80121774; csInfo->keyFrameCnt = 4; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3090: func_8002DF54(play, NULL, PLAYER_CSMODE_8); csInfo->keyFrames = D_80121814; csInfo->keyFrameCnt = 4; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3100: VEC_SET(spB4, 0.0f, -280.0f, -1400.0f); Actor_GetFocus(&spA0, actor); spC0 = spA0.pos; - func_800C0808(play, subCamId, player, CAM_SET_PIVOT_VERTICAL); - Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_PIVOT_VERTICAL); + Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 70.0f; func_8002DF54(play, NULL, PLAYER_CSMODE_8); break; + case 3380: case 3065: csInfo->keyFrames = D_801218B4; csInfo->keyFrameCnt = 2; func_8002DF54(play, NULL, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_1); Quake_SetSpeed(i, 24000); Quake_SetPerturbations(i, 2, 0, 0, 0); Quake_SetDuration(i, 160); break; + case 3060: csInfo->keyFrames = D_80121904; csInfo->keyFrameCnt = 2; func_8002DF54(play, NULL, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3050: - Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_CS_3); func_8002DF54(play, &player->actor, PLAYER_CSMODE_5); OnePointCutscene_SetCsCamPoints(subCam, D_80120304 | 0x2000, D_80120300, D_8012013C, D_8012021C); func_80078884(NA_SE_SY_CORRECT_CHIME); @@ -479,6 +509,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 2, 1, 1, 0); Quake_SetDuration(i, 200); break; + case 3120: csInfo->keyFrames = D_80121954[-(timer + 101)]; subCam->timer = 100; @@ -486,16 +517,18 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrameCnt = 2; func_8002DF54(play, NULL, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3130: csInfo->keyFrames = D_80121A44; csInfo->keyFrameCnt = 12; func_8002DF54(play, NULL, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); subCam->stateFlags |= CAM_STATE_1; break; + case 3140: D_80121C24[0].atTargetInit = play->view.at; D_80121C24[0].eyeTargetInit = play->view.eye; @@ -504,8 +537,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80121C24; csInfo->keyFrameCnt = 7; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3150: spC0.x = 1890.0f; spC0.y = 886.0f; @@ -513,12 +547,13 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act spB4.x = 1729.0f; spB4.y = 995.0f; spB4.z = -1405.0f; - Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FREE2); + Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0x50; subCam->fov = 55.0f; func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); break; + case 3170: Actor_GetWorld(&spA0, actor); spC0 = spA0.pos; @@ -528,13 +563,14 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Actor_GetWorld(&spA0, &player->actor); spD0.yaw = OnePointCutscene_Vec3fYaw(&spC0, &spA0.pos) - 0x7D0; OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0); - Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FREE2); + Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); Play_CopyCamera(play, CAM_ID_MAIN, subCamId); subCam->roll = -1; subCam->fov = 55.0f; func_8002DF38(play, actor, PLAYER_CSMODE_1); break; + case 3160: Actor_GetWorld(&spA0, actor); spC0 = spA0.pos; @@ -542,12 +578,13 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act spD0.yaw = spA0.rot.y; spD0.r = 150.0f; OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0); - Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FREE2); + Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 55.0f; func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); break; + case 3180: Actor_GetWorldPosShapeRot(&spA0, actor); spC0 = spA0.pos; @@ -556,17 +593,19 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act spD0.yaw = spA0.rot.y; spD0.pitch = -0xAF0; OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0); - Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FREE2); + Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 60.0f; func_8002DF38(play, actor, PLAYER_CSMODE_1); break; + case 3190: - Play_CameraChangeSetting(play, subCamId, CAM_SET_FOREST_DEFEAT_POE); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FOREST_DEFEAT_POE); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); func_8002DF38(play, actor, PLAYER_CSMODE_12); break; + case 3230: spC0.x = 120.0f; spC0.y = 265.0f; @@ -574,8 +613,8 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act spB4.x = 80.0f; spB4.y = 445.0f; spB4.z = -1425.0f; - Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FREE2); + Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0x1E; subCam->fov = 75.0f; func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); @@ -588,13 +627,14 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act spD0.pitch = 0x5DC; spD0.r = 120.0f; OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0); - Play_CameraSetAtEye(play, CAM_ID_MAIN, &spC0, &spB4); + Play_SetCameraAtEye(play, CAM_ID_MAIN, &spC0, &spB4); i = Quake_Request(subCam, QUAKE_TYPE_3); Quake_SetSpeed(i, 22000); Quake_SetPerturbations(i, 1, 0, 0, 0); Quake_SetDuration(i, 90); break; + case 6010: Actor_GetWorld(&spA0, actor); spC0 = spA0.pos; @@ -603,28 +643,30 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act spD0.yaw = spA0.rot.y + 0x7FFF; spD0.r = 300.0f; OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0); - Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); - Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FREE2); + Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 45.0f; func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); break; + case 3220: Actor_GetFocus(&spA0, actor); spC0 = spA0.pos; - func_800C0808(play, subCamId, player, CAM_SET_PIVOT_VERTICAL); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_PIVOT_VERTICAL); Actor_GetWorld(&spA0, &player->actor); OLib_Vec3fDiffToVecGeo(&spD0, &spC0, &spA0.pos); spD0.yaw += 0x3E8; spD0.r = 400.0f; OnePointCutscene_AddVecGeoToVec3f(&spB4, &spC0, &spD0); spB4.y = spA0.pos.y + 60.0f; - Play_CameraSetAtEye(play, subCamId, &spC0, &spB4); + Play_SetCameraAtEye(play, subCamId, &spC0, &spB4); subCam->roll = 0; subCam->fov = 75.0f; player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = spD0.yaw + 0x7FFF; func_8002DF54(play, NULL, PLAYER_CSMODE_8); break; + case 3240: D_80121D3C[2].timerInit = timer - 5; @@ -632,10 +674,11 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrameCnt = 3; func_8002DF54(play, NULL, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 6001: - Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_CS_3); func_8002DF54(play, NULL, PLAYER_CSMODE_8); Actor_GetWorld(&spA0, actor); if (spA0.pos.z > -750.0f) { @@ -649,8 +692,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 0, 0, 20, 0); Quake_SetDuration(i, D_801208E4 - 10); break; + case 3400: - Play_CameraChangeSetting(play, subCamId, CAM_SET_CS_3); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_CS_3); func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); OnePointCutscene_SetCsCamPoints(subCam, D_8012069C | 0x2000, D_80120698, D_801204D4, D_801205B4); OnePointCutscene_Vec3sToVec3f(&mainCam->eye, &D_801205B4[D_80120694 - 2].pos); @@ -661,6 +705,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 1, 0, 50, 0); Quake_SetDuration(i, D_80120698 - 20); break; + case 3390: player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = -0x3FD9; @@ -668,10 +713,11 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrameCnt = 9; func_8002DF54(play, NULL, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3310: - Play_CameraChangeSetting(play, subCamId, CAM_SET_FIRE_STAIRCASE); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FIRE_STAIRCASE); func_8002DF54(play, NULL, PLAYER_CSMODE_8); Play_CopyCamera(play, subCamId, CAM_ID_MAIN); @@ -680,6 +726,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 2, 0, 0, 0); Quake_SetDuration(i, timer); break; + case 3290: D_80121F1C[0].atTargetInit = play->view.at; D_80121F1C[0].eyeTargetInit = play->view.eye; @@ -690,13 +737,14 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80121F1C; csInfo->keyFrameCnt = 4; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_3); Quake_SetSpeed(i, 12000); Quake_SetPerturbations(i, 0, 0, 1000, 0); Quake_SetDuration(i, 5); break; + case 3340: D_80121FBC[0].atTargetInit = play->view.at; D_80121FBC[0].eyeTargetInit = play->view.eye; @@ -706,20 +754,22 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrameCnt = 4; func_8002DF54(play, NULL, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_3); Quake_SetSpeed(i, 12000); Quake_SetPerturbations(i, 0, 0, 1000, 0); Quake_SetDuration(i, 5); break; + case 3360: csInfo->keyFrames = D_8012205C; csInfo->keyFrameCnt = 3; func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3350: D_801220D4[0].atTargetInit = play->view.at; D_801220D4[0].eyeTargetInit = play->view.eye; @@ -737,45 +787,49 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801220D4; csInfo->keyFrameCnt = 5; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3330: csInfo->keyFrames = D_8012219C; csInfo->keyFrameCnt = 7; func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3410: csInfo->keyFrames = D_801222B4; csInfo->keyFrameCnt = 5; func_8002DF54(play, NULL, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_1); Quake_SetSpeed(i, 32000); Quake_SetPerturbations(i, 4, 0, 0, 0); Quake_SetDuration(i, 20); break; + case 3450: csInfo->keyFrames = D_8012237C; csInfo->keyFrameCnt = 2; func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_1); Quake_SetSpeed(i, 32000); Quake_SetPerturbations(i, 2, 0, 0, 0); Quake_SetDuration(i, 10); break; + case 3440: csInfo->keyFrames = D_801223CC; csInfo->keyFrameCnt = 6; func_8002DF54(play, NULL, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); player->stateFlags1 |= PLAYER_STATE1_29; player->actor.freezeTimer = 90; @@ -784,106 +838,118 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 2, 0, 0, 0); Quake_SetDuration(i, 10); break; + case 3430: csInfo->keyFrames = D_801224BC; csInfo->keyFrameCnt = 7; func_8002DF54(play, NULL, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_1); Quake_SetSpeed(i, 32000); Quake_SetPerturbations(i, 1, 0, 10, 0); Quake_SetDuration(i, 20); break; + case 4100: csInfo->keyFrames = D_801225D4; csInfo->keyFrameCnt = 5; player->actor.shape.rot.y = player->actor.world.rot.y = player->currentYaw = 0x3FFC; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); func_8002DF54(play, NULL, PLAYER_CSMODE_8); break; + case 4110: csInfo->keyFrames = D_8012269C; csInfo->keyFrameCnt = 3; func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4120: func_8002DF54(play, NULL, PLAYER_CSMODE_8); D_80122714[1].timerInit = 80; csInfo->keyFrames = D_80122714; csInfo->keyFrameCnt = 4; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4140: csInfo->keyFrames = D_801227B4; csInfo->keyFrameCnt = 6; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); break; + case 4150: csInfo->keyFrames = D_801228A4; csInfo->keyFrameCnt = 5; func_8002DF54(play, NULL, PLAYER_CSMODE_8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4160: csInfo->keyFrames = D_8012296C; csInfo->keyFrameCnt = 4; func_8002DF54(play, NULL, PLAYER_CSMODE_8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4170: csInfo->keyFrames = D_80122A0C; csInfo->keyFrameCnt = 2; func_8002DF54(play, NULL, PLAYER_CSMODE_8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4190: csInfo->keyFrames = D_80122A5C; csInfo->keyFrameCnt = 8; func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4200: csInfo->keyFrames = D_80122B9C; csInfo->keyFrameCnt = 3; func_8002DF38(play, &player->actor, PLAYER_CSMODE_8); Camera_ChangeMode(mainCam, CAM_MODE_NORMAL); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4210: player->actor.freezeTimer = timer; csInfo->keyFrames = D_80122C14; csInfo->keyFrameCnt = 1; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); i = Quake_Request(subCam, QUAKE_TYPE_3); Quake_SetSpeed(i, 12000); Quake_SetPerturbations(i, 0, 1, 100, 0); Quake_SetDuration(i, timer - 80); break; + case 4220: csInfo->keyFrames = (player->actor.world.pos.z < -15.0f) ? D_80122C3C : D_80122C64; csInfo->keyFrameCnt = 1; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); func_8002DF38(play, &player->actor, PLAYER_CSMODE_1); i = Quake_Request(subCam, QUAKE_TYPE_3); @@ -891,13 +957,15 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act Quake_SetPerturbations(i, 0, 1, 10, 0); Quake_SetDuration(i, timer - 10); break; + case 4221: csInfo->keyFrames = D_80122C8C; csInfo->keyFrameCnt = 1; func_8002DF54(play, NULL, PLAYER_CSMODE_8); - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3260: func_8002DF54(play, NULL, PLAYER_CSMODE_8); D_80122CB4[1].timerInit = timer - 5; @@ -905,8 +973,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80122CB4; csInfo->keyFrameCnt = 2; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 3261: func_8002DF54(play, NULL, PLAYER_CSMODE_8); D_80122D04[1].timerInit = timer - 10; @@ -914,20 +983,23 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80122D04; csInfo->keyFrameCnt = 2; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 8010: csInfo->keyFrames = D_80122D54; csInfo->keyFrameCnt = 3; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 8002: csInfo->keyFrames = D_80122DCC; csInfo->keyFrameCnt = 3; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 8700: Actor_GetFocus(&spA0, actor); Actor_GetFocus(&sp8C, &player->actor); @@ -937,8 +1009,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80122E44[timer & 1]; csInfo->keyFrameCnt = 7; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 1100: { s32 tempDiff = play->state.frames - sPrevFrameCs1100; @@ -955,20 +1028,22 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_8012313C; csInfo->keyFrameCnt = 3; } - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); sPrevFrameCs1100 = play->state.frames; } break; + case 9806: subCam->timer = -99; if (Play_CamIsNotFixed(play)) { - func_800C0808(play, subCamId, player, CAM_SET_TURN_AROUND); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_TURN_AROUND); subCam->data2 = 0xC; } else { Play_CopyCamera(play, subCamId, CAM_ID_MAIN); - Play_CameraChangeSetting(play, subCamId, CAM_SET_FREE2); + Play_ChangeCameraSetting(play, subCamId, CAM_SET_FREE2); } break; + case 9908: if (Play_CamIsNotFixed(play)) { D_801231B4[0].eyeTargetInit.z = D_801231B4[1].eyeTargetInit.z = !LINK_IS_ADULT ? 100.0f : 120.0f; @@ -989,7 +1064,7 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801231B4; csInfo->keyFrameCnt = 4; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); } else { D_80123254[1].timerInit = timer - 1; D_80123254[0].fovTargetInit = mainCam->fov; @@ -999,9 +1074,10 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80123254; csInfo->keyFrameCnt = 2; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); } break; + case 1000: D_801232A4[0].atTargetInit = play->view.at; D_801232A4[0].eyeTargetInit = play->view.eye; @@ -1010,50 +1086,58 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801232A4; csInfo->keyFrameCnt = 1; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 8603: csInfo->keyFrames = D_801232CC; csInfo->keyFrameCnt = 5; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 8604: csInfo->keyFrames = D_80123394; csInfo->keyFrameCnt = 5; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4000: csInfo->keyFrames = D_8012345C; csInfo->keyFrameCnt = 4; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4010: csInfo->keyFrames = D_801234FC; csInfo->keyFrameCnt = 5; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4011: csInfo->keyFrames = D_801235C4; csInfo->keyFrameCnt = 5; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4020: csInfo->keyFrames = D_8012368C; csInfo->keyFrameCnt = 4; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4021: csInfo->keyFrames = D_8012372C; csInfo->keyFrameCnt = 4; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 4022: subCam->timer = D_801237CC[0].timerInit + D_801237CC[3].timerInit + D_801237CC[1].timerInit + D_801237CC[2].timerInit + D_801237CC[4].timerInit; @@ -1061,8 +1145,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_801237CC; csInfo->keyFrameCnt = 5; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 9703: D_80123894[0].atTargetInit = play->view.at; D_80123894[0].eyeTargetInit = play->view.eye; @@ -1075,8 +1160,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_80123894; csInfo->keyFrameCnt = 3; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 9704: D_8012390C[0].atTargetInit = play->view.at; D_8012390C[0].eyeTargetInit = play->view.eye; @@ -1085,8 +1171,9 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_8012390C; csInfo->keyFrameCnt = 2; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 9705: D_8012395C[0].atTargetInit = play->view.at; D_8012395C[0].eyeTargetInit = play->view.eye; @@ -1095,16 +1182,18 @@ s32 OnePointCutscene_SetInfo(PlayState* play, s16 subCamId, s16 csId, Actor* act csInfo->keyFrames = D_8012395C; csInfo->keyFrameCnt = 3; - func_800C0808(play, subCamId, player, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, player, CAM_SET_CS_C); break; + case 5110: D_801239D4[1].timerInit = 10; csInfo->keyFrames = D_801239D4; csInfo->keyFrameCnt = 3; - func_800C0808(play, subCamId, (Player*)actor, CAM_SET_CS_C); + Play_InitCameraDataUsingPlayer(play, subCamId, (Player*)actor, CAM_SET_CS_C); break; + default: osSyncPrintf(VT_COL(RED, WHITE) "onepointdemo camera: demo number not found !! (%d)\n" VT_RST, csId); break; diff --git a/src/code/z_play.c b/src/code/z_play.c index 08f2ee3a7..4f8284cfd 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -411,7 +411,7 @@ void Play_Init(GameState* thisx) { } player = GET_PLAYER(this); - Camera_InitPlayerSettings(&this->mainCamera, player); + Camera_InitDataUsingPlayer(&this->mainCamera, player); Camera_ChangeMode(&this->mainCamera, CAM_MODE_NORMAL); playerStartBgCamIndex = player->actor.params & 0xFF; @@ -1460,28 +1460,28 @@ void Play_GetScreenPos(PlayState* this, Vec3f* src, Vec3f* dest) { } s16 Play_CreateSubCamera(PlayState* this) { - s16 i; + s16 camId; - for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) { - if (this->cameraPtrs[i] == NULL) { + for (camId = CAM_ID_SUB_FIRST; camId < NUM_CAMS; camId++) { + if (this->cameraPtrs[camId] == NULL) { break; } } - if (i == NUM_CAMS) { + if (camId == NUM_CAMS) { osSyncPrintf(VT_COL(RED, WHITE) "camera control: error: fulled sub camera system area\n" VT_RST); return CAM_ID_NONE; } osSyncPrintf("camera control: " VT_BGCOL(CYAN) " " VT_COL(WHITE, BLUE) " create new sub camera [%d] " VT_BGCOL( CYAN) " " VT_RST "\n", - i); + camId); - this->cameraPtrs[i] = &this->subCameras[i - CAM_ID_SUB_FIRST]; - Camera_Init(this->cameraPtrs[i], &this->view, &this->colCtx, this); - this->cameraPtrs[i]->camId = i; + this->cameraPtrs[camId] = &this->subCameras[camId - CAM_ID_SUB_FIRST]; + Camera_Init(this->cameraPtrs[camId], &this->view, &this->colCtx, this); + this->cameraPtrs[camId]->camId = camId; - return i; + return camId; } s16 Play_GetActiveCamId(PlayState* this) { @@ -1534,15 +1534,15 @@ Camera* Play_GetCamera(PlayState* this, s16 camId) { return this->cameraPtrs[camIdx]; } -s32 Play_CameraSetAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) { - s32 ret = 0; +s32 Play_SetCameraAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) { + s32 successBits = 0; s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; Camera* camera = this->cameraPtrs[camIdx]; Player* player; - ret |= Camera_SetViewParam(camera, CAM_VIEW_AT, at); - ret <<= 1; - ret |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye); + successBits |= Camera_SetViewParam(camera, CAM_VIEW_AT, at); + successBits <<= 1; + successBits |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye); camera->dist = Math3D_Vec3f_DistXYZ(at, eye); @@ -1557,20 +1557,20 @@ s32 Play_CameraSetAtEye(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye) { camera->atLERPStepScale = 0.01f; - return ret; + return successBits; } -s32 Play_CameraSetAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) { - s32 ret = 0; +s32 Play_SetCameraAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) { + s32 successBits = 0; s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; Camera* camera = this->cameraPtrs[camIdx]; Player* player; - ret |= Camera_SetViewParam(camera, CAM_VIEW_AT, at); - ret <<= 1; - ret |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye); - ret <<= 1; - ret |= Camera_SetViewParam(camera, CAM_VIEW_UP, up); + successBits |= Camera_SetViewParam(camera, CAM_VIEW_AT, at); + successBits <<= 1; + successBits |= Camera_SetViewParam(camera, CAM_VIEW_EYE, eye); + successBits <<= 1; + successBits |= Camera_SetViewParam(camera, CAM_VIEW_UP, up); camera->dist = Math3D_Vec3f_DistXYZ(at, eye); @@ -1585,14 +1585,14 @@ s32 Play_CameraSetAtEyeUp(PlayState* this, s16 camId, Vec3f* at, Vec3f* eye, Vec camera->atLERPStepScale = 0.01f; - return ret; + return successBits; } -s32 Play_CameraSetFov(PlayState* this, s16 camId, f32 fov) { - s32 ret = Camera_SetViewParam(this->cameraPtrs[camId], CAM_VIEW_FOV, &fov) & 1; +s32 Play_SetCameraFov(PlayState* this, s16 camId, f32 fov) { + s32 successBits = Camera_SetViewParam(this->cameraPtrs[camId], CAM_VIEW_FOV, &fov) & 1; if (1) {} - return ret; + return successBits; } s32 Play_SetCameraRoll(PlayState* this, s16 camId, s16 roll) { @@ -1611,43 +1611,52 @@ void Play_CopyCamera(PlayState* this, s16 destCamId, s16 srcCamId) { Camera_Copy(this->cameraPtrs[destCamId1], this->cameraPtrs[srcCamId2]); } -s32 func_800C0808(PlayState* this, s16 camId, Player* player, s16 setting) { +/** + * Initializes camera data centered around Player, and applies the requested setting. + */ +s32 Play_InitCameraDataUsingPlayer(PlayState* this, s16 camId, Player* player, s16 setting) { Camera* camera; s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; camera = this->cameraPtrs[camIdx]; - Camera_InitPlayerSettings(camera, player); + Camera_InitDataUsingPlayer(camera, player); return Camera_ChangeSetting(camera, setting); } -s32 Play_CameraChangeSetting(PlayState* this, s16 camId, s16 setting) { +s32 Play_ChangeCameraSetting(PlayState* this, s16 camId, s16 setting) { return Camera_ChangeSetting(Play_GetCamera(this, camId), setting); } -void func_800C08AC(PlayState* this, s16 camId, s16 arg2) { +/** + * Smoothly return control from a sub camera to the main camera by moving the subCamera's eye, at, fov through + * interpolation from the initial subCam viewParams to the target mainCam viewParams over `duration`. + * Setting the `duration` to 0 or less will instantly return control to the main camera. + * This will also clear every sub camera. + */ +void Play_ReturnToMainCam(PlayState* this, s16 camId, s16 duration) { s16 camIdx = (camId == CAM_ID_NONE) ? this->activeCamId : camId; - s16 i; + s16 subCamId; Play_ClearCamera(this, camIdx); - for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) { - if (this->cameraPtrs[i] != NULL) { + for (subCamId = CAM_ID_SUB_FIRST; subCamId < NUM_CAMS; subCamId++) { + if (this->cameraPtrs[subCamId] != NULL) { osSyncPrintf( VT_COL(RED, WHITE) "camera control: error: return to main, other camera left. %d cleared!!\n" VT_RST, - i); - Play_ClearCamera(this, i); + subCamId); + Play_ClearCamera(this, subCamId); } } - if (arg2 <= 0) { + if (duration <= 0) { Play_ChangeCameraStatus(this, CAM_ID_MAIN, CAM_STAT_ACTIVE); this->cameraPtrs[CAM_ID_MAIN]->childCamId = this->cameraPtrs[CAM_ID_MAIN]->parentCamId = CAM_ID_MAIN; } else { - OnePointCutscene_Init(this, 1020, arg2, NULL, CAM_ID_MAIN); + OnePointCutscene_Init(this, 1020, duration, NULL, CAM_ID_MAIN); } } -s16 Play_CameraGetUID(PlayState* this, s16 camId) { +s16 Play_GetCameraUID(PlayState* this, s16 camId) { Camera* camera = this->cameraPtrs[camId]; if (camera != NULL) { @@ -1657,12 +1666,16 @@ s16 Play_CameraGetUID(PlayState* this, s16 camId) { } } -s16 func_800C09D8(PlayState* this, s16 camId, s16 arg2) { +// Unused, purpose is unclear (also unused and unclear in MM) +s16 func_800C09D8(PlayState* this, s16 camId, s16 uid) { Camera* camera = this->cameraPtrs[camId]; if (camera != NULL) { return 0; - } else if (camera->uid != arg2) { + } + + //! @bug this code is only reached if `camera` is NULL. + if (camera->uid != uid) { return 0; } else if (camera->status != CAM_STAT_ACTIVE) { return 2; |
