mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-13 03:14:38 +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:
parent
92aef346f2
commit
bf56c94f0f
143 changed files with 2778 additions and 2768 deletions
|
@ -230,9 +230,9 @@ void Gameplay_Init(GameState* thisx) {
|
|||
Camera_ChangeStatus(&globalCtx->subCameras[i], CAM_STAT_UNK100);
|
||||
}
|
||||
|
||||
globalCtx->cameraPtrs[MAIN_CAM] = &globalCtx->mainCamera;
|
||||
globalCtx->cameraPtrs[MAIN_CAM]->uid = 0;
|
||||
globalCtx->activeCamera = MAIN_CAM;
|
||||
globalCtx->cameraPtrs[CAM_ID_MAIN] = &globalCtx->mainCamera;
|
||||
globalCtx->cameraPtrs[CAM_ID_MAIN]->uid = 0;
|
||||
globalCtx->activeCamId = CAM_ID_MAIN;
|
||||
func_8005AC48(&globalCtx->mainCamera, 0xFF);
|
||||
Sram_Init(globalCtx, &globalCtx->sramCtx);
|
||||
func_80112098(globalCtx);
|
||||
|
@ -1047,14 +1047,14 @@ skip:
|
|||
s32 pad3[5];
|
||||
s32 i;
|
||||
|
||||
globalCtx->nextCamera = globalCtx->activeCamera;
|
||||
globalCtx->nextCamId = globalCtx->activeCamId;
|
||||
|
||||
if (1 && HREG(63)) {
|
||||
LOG_NUM("1", 1, "../z_play.c", 3806);
|
||||
}
|
||||
|
||||
for (i = 0; i < NUM_CAMS; i++) {
|
||||
if ((i != globalCtx->nextCamera) && (globalCtx->cameraPtrs[i] != NULL)) {
|
||||
if ((i != globalCtx->nextCamId) && (globalCtx->cameraPtrs[i] != NULL)) {
|
||||
if (1 && HREG(63)) {
|
||||
LOG_NUM("1", 1, "../z_play.c", 3809);
|
||||
}
|
||||
|
@ -1063,7 +1063,7 @@ skip:
|
|||
}
|
||||
}
|
||||
|
||||
Camera_Update(globalCtx->cameraPtrs[globalCtx->nextCamera]);
|
||||
Camera_Update(globalCtx->cameraPtrs[globalCtx->nextCamId]);
|
||||
|
||||
if (1 && HREG(63)) {
|
||||
LOG_NUM("1", 1, "../z_play.c", 3814);
|
||||
|
@ -1547,7 +1547,7 @@ void func_800C016C(GlobalContext* globalCtx, Vec3f* src, Vec3f* dest) {
|
|||
s16 Gameplay_CreateSubCamera(GlobalContext* globalCtx) {
|
||||
s16 i;
|
||||
|
||||
for (i = SUBCAM_FIRST; i < NUM_CAMS; i++) {
|
||||
for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) {
|
||||
if (globalCtx->cameraPtrs[i] == NULL) {
|
||||
break;
|
||||
}
|
||||
|
@ -1555,38 +1555,38 @@ s16 Gameplay_CreateSubCamera(GlobalContext* globalCtx) {
|
|||
|
||||
if (i == NUM_CAMS) {
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "camera control: error: fulled sub camera system area\n" VT_RST);
|
||||
return SUBCAM_NONE;
|
||||
return CAM_ID_NONE;
|
||||
}
|
||||
|
||||
osSyncPrintf("camera control: " VT_BGCOL(CYAN) " " VT_COL(WHITE, BLUE) " create new sub camera [%d] " VT_BGCOL(
|
||||
CYAN) " " VT_RST "\n",
|
||||
i);
|
||||
|
||||
globalCtx->cameraPtrs[i] = &globalCtx->subCameras[i - SUBCAM_FIRST];
|
||||
globalCtx->cameraPtrs[i] = &globalCtx->subCameras[i - CAM_ID_SUB_FIRST];
|
||||
Camera_Init(globalCtx->cameraPtrs[i], &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
globalCtx->cameraPtrs[i]->thisIdx = i;
|
||||
globalCtx->cameraPtrs[i]->camId = i;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
||||
s16 Gameplay_GetActiveCamId(GlobalContext* globalCtx) {
|
||||
return globalCtx->activeCamera;
|
||||
return globalCtx->activeCamId;
|
||||
}
|
||||
|
||||
s16 Gameplay_ChangeCameraStatus(GlobalContext* globalCtx, s16 camId, s16 status) {
|
||||
s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId;
|
||||
s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId;
|
||||
|
||||
if (status == CAM_STAT_ACTIVE) {
|
||||
globalCtx->activeCamera = camIdx;
|
||||
globalCtx->activeCamId = camIdx;
|
||||
}
|
||||
|
||||
return Camera_ChangeStatus(globalCtx->cameraPtrs[camIdx], status);
|
||||
}
|
||||
|
||||
void Gameplay_ClearCamera(GlobalContext* globalCtx, s16 camId) {
|
||||
s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId;
|
||||
s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId;
|
||||
|
||||
if (camIdx == MAIN_CAM) {
|
||||
if (camIdx == CAM_ID_MAIN) {
|
||||
osSyncPrintf(VT_COL(RED, WHITE) "camera control: error: never clear camera !!\n" VT_RST);
|
||||
}
|
||||
|
||||
|
@ -1602,26 +1602,26 @@ void Gameplay_ClearCamera(GlobalContext* globalCtx, s16 camId) {
|
|||
}
|
||||
|
||||
void Gameplay_ClearAllSubCameras(GlobalContext* globalCtx) {
|
||||
s16 i;
|
||||
s16 subCamId;
|
||||
|
||||
for (i = SUBCAM_FIRST; i < NUM_CAMS; i++) {
|
||||
if (globalCtx->cameraPtrs[i] != NULL) {
|
||||
Gameplay_ClearCamera(globalCtx, i);
|
||||
for (subCamId = CAM_ID_SUB_FIRST; subCamId < NUM_CAMS; subCamId++) {
|
||||
if (globalCtx->cameraPtrs[subCamId] != NULL) {
|
||||
Gameplay_ClearCamera(globalCtx, subCamId);
|
||||
}
|
||||
}
|
||||
|
||||
globalCtx->activeCamera = MAIN_CAM;
|
||||
globalCtx->activeCamId = CAM_ID_MAIN;
|
||||
}
|
||||
|
||||
Camera* Gameplay_GetCamera(GlobalContext* globalCtx, s16 camId) {
|
||||
s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId;
|
||||
s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId;
|
||||
|
||||
return globalCtx->cameraPtrs[camIdx];
|
||||
}
|
||||
|
||||
s32 Gameplay_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye) {
|
||||
s32 ret = 0;
|
||||
s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId;
|
||||
s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId;
|
||||
Camera* camera = globalCtx->cameraPtrs[camIdx];
|
||||
Player* player;
|
||||
|
||||
|
@ -1647,7 +1647,7 @@ s32 Gameplay_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3
|
|||
|
||||
s32 Gameplay_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) {
|
||||
s32 ret = 0;
|
||||
s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId;
|
||||
s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId;
|
||||
Camera* camera = globalCtx->cameraPtrs[camIdx];
|
||||
Player* player;
|
||||
|
||||
|
@ -1681,7 +1681,7 @@ s32 Gameplay_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov) {
|
|||
}
|
||||
|
||||
s32 Gameplay_SetCameraRoll(GlobalContext* globalCtx, s16 camId, s16 roll) {
|
||||
s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId;
|
||||
s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId;
|
||||
Camera* camera = globalCtx->cameraPtrs[camIdx];
|
||||
|
||||
camera->roll = roll;
|
||||
|
@ -1689,16 +1689,16 @@ s32 Gameplay_SetCameraRoll(GlobalContext* globalCtx, s16 camId, s16 roll) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
void Gameplay_CopyCamera(GlobalContext* globalCtx, s16 camId1, s16 camId2) {
|
||||
s16 camIdx2 = (camId2 == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId2;
|
||||
s16 camIdx1 = (camId1 == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId1;
|
||||
void Gameplay_CopyCamera(GlobalContext* globalCtx, s16 destCamId, s16 srcCamId) {
|
||||
s16 srcCamId2 = (srcCamId == CAM_ID_NONE) ? globalCtx->activeCamId : srcCamId;
|
||||
s16 destCamId1 = (destCamId == CAM_ID_NONE) ? globalCtx->activeCamId : destCamId;
|
||||
|
||||
Camera_Copy(globalCtx->cameraPtrs[camIdx1], globalCtx->cameraPtrs[camIdx2]);
|
||||
Camera_Copy(globalCtx->cameraPtrs[destCamId1], globalCtx->cameraPtrs[srcCamId2]);
|
||||
}
|
||||
|
||||
s32 func_800C0808(GlobalContext* globalCtx, s16 camId, Player* player, s16 setting) {
|
||||
Camera* camera;
|
||||
s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId;
|
||||
s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId;
|
||||
|
||||
camera = globalCtx->cameraPtrs[camIdx];
|
||||
Camera_InitPlayerSettings(camera, player);
|
||||
|
@ -1710,12 +1710,12 @@ s32 Gameplay_CameraChangeSetting(GlobalContext* globalCtx, s16 camId, s16 settin
|
|||
}
|
||||
|
||||
void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2) {
|
||||
s16 camIdx = (camId == SUBCAM_ACTIVE) ? globalCtx->activeCamera : camId;
|
||||
s16 camIdx = (camId == CAM_ID_NONE) ? globalCtx->activeCamId : camId;
|
||||
s16 i;
|
||||
|
||||
Gameplay_ClearCamera(globalCtx, camIdx);
|
||||
|
||||
for (i = SUBCAM_FIRST; i < NUM_CAMS; i++) {
|
||||
for (i = CAM_ID_SUB_FIRST; i < NUM_CAMS; i++) {
|
||||
if (globalCtx->cameraPtrs[i] != NULL) {
|
||||
osSyncPrintf(
|
||||
VT_COL(RED, WHITE) "camera control: error: return to main, other camera left. %d cleared!!\n" VT_RST,
|
||||
|
@ -1725,10 +1725,10 @@ void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2) {
|
|||
}
|
||||
|
||||
if (arg2 <= 0) {
|
||||
Gameplay_ChangeCameraStatus(globalCtx, MAIN_CAM, CAM_STAT_ACTIVE);
|
||||
globalCtx->cameraPtrs[MAIN_CAM]->childCamIdx = globalCtx->cameraPtrs[MAIN_CAM]->parentCamIdx = SUBCAM_FREE;
|
||||
Gameplay_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE);
|
||||
globalCtx->cameraPtrs[CAM_ID_MAIN]->childCamId = globalCtx->cameraPtrs[CAM_ID_MAIN]->parentCamId = CAM_ID_MAIN;
|
||||
} else {
|
||||
OnePointCutscene_Init(globalCtx, 1020, arg2, NULL, MAIN_CAM);
|
||||
OnePointCutscene_Init(globalCtx, 1020, arg2, NULL, CAM_ID_MAIN);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue