mirror of
https://github.com/zeldaret/oot.git
synced 2025-07-12 19:04:38 +00:00
decompile z_camera (#398)
* cleanup * name camera action functions * decompile a few small functions, name a few Camera struct members * decompile camera data, decompile a few camera functions * Split ASM for code_800BB0A0 * removing code_800BB0A0.s * PR Requests, Camera WIP * remove #define NON_MATCHING from db_camera * rename code_8007BF90.c to z_olib.c, rename functions in z_olib.c * camera wip * rename some struct memebers, some decomp wip * pr updates * camera wip * name some fields in Camera Struct, being making sense of Camera_Update * Camera WIP * wip * wip * add z64camera.h header, begin creating CameraSetting macros * wip * wip * wip * wip * migrate camera bss to c * match a couple functions in db_camera * match some small db_camera functions * wip * migrate db_camera rodata, match a few functions * remote db_camera.rodata.s * match some of db_camera * identify types of some unknown data pieces * some small wip * Match Camera_Init, some function changes, some struct name changes. Change unk_C0 and unk_CC to floats from Vec3fs * add naming for a few more Camera struct members * wip * match func_80043F94 * Match Camera_Jump1 * document some of Camera_Jump1 * wip * match Camera_Jump3 * Match Camera_Update, FeelsAmazing * wip * wip * match Camera_SetParam * minor cleanup * wip * wip * match Camera_KeepOn0 * some documentation, modify some matching functions to match style of others. * match Camera_Demo1 * match camera_demo9 * document Camera_Demo1 and Camera_Demo9 * wip * Match camera_battle4 * match camera_unique2 * Match Camera_Unique3 * match camera_special6 * match Camera_Special5 * wip * document camera_special6 * naming updates * match camera_Unique1 * match Camera_Unique0 * wip * Match Camera_CalcUpFromPitchYawRoll * match func_80045508 * document Camera_Battle4 * document several camera functions, move camera data to separate file * rename phi/theta to pitch/yaw * wip * uniq9 wip * Camera_Unqiue9 OK * document Camera_Unique9 * name unk_160 in camera struct * wip * wip * minor updates * fix conflicts * wip * wip * Olib updates * wip * wip * rename most Math3D functions, few matches, documentation * wip * document most of math3d * wip * wip * wip * pr updates * Match Camera_Fixed4 * match func_80058E8C * pr updates * add missing comment block finalizer * Merge math3dupdates * match Camera_ChangeSetting * Match Camera_ChangeMode * match func_80058148 * Match Camera_Special9 * decompile the rest of camera data * match Camera_Demo5 * name a few camera functions in z_play * match func_80046CB4, some work on other fucntions * wip * impove some non matchings * fix function rename * match func_800588B4 * match Camera_Subj4 * wip * Camera_Demo3 matching, Camera_Battle1 big progress * Camera_Normal2 OK * wip * match Camera_Parallel1 * normalize some things across functions * match Camera_Normal1 * Match Camera_Normal3 * some cleanup * more cleanup * more cleanup , match Camera_CalcDefaultPitch * data formatting * Match Camera_Jump2 * document Camera_Jump2 * Match Camera_KeepOn3 * document some of Camera_KeepOn3 * improve some non_matchings * match func_80045C74 and func_800460A8 * code cleanup, documentation * match Camera_KeepOn1 * Match Camera_Subj3 * Match Camera_Battle1 * remove non_matching from func_80044adc and func_80046e20 * name several members of Battle1 * more documentation on Battle1 * cleanup * renaming Camera_Vec3fScaleXYZFactor to Camera_Vec3fTranslateByUnitVector * reorganize update structs, remove final references to params, remove CameraParams union * implement camera enums into player * Renaming Camera_GetDir to Camera_GetInputDir, Camera_GetRealDir to Camera_GetCamDir, etc, implement camera enum's into player * remove non-global camera variables from variables.h * clean up some variable declarations * finish pr comment updates * fix some warnings * data formatting * finish commenting on data * delete unused asm * remove asm Co-authored-by: fig <fig02srl@gmail.com>
This commit is contained in:
parent
dadee87f94
commit
321388673b
243 changed files with 13819 additions and 28653 deletions
|
@ -14,7 +14,7 @@ s16 D_801614C8;
|
|||
u64 D_801614D0[0xA00];
|
||||
|
||||
void func_800BC450(GlobalContext* globalCtx) {
|
||||
func_8005A7A8(ACTIVE_CAM, globalCtx->unk_1242B - 1);
|
||||
Camera_ChangeDataIdx(ACTIVE_CAM, globalCtx->unk_1242B - 1);
|
||||
}
|
||||
|
||||
void func_800BC490(GlobalContext* globalCtx, s16 point) {
|
||||
|
@ -223,12 +223,12 @@ void Gameplay_Init(GameState* thisx) {
|
|||
globalCtx->cameraPtrs[i] = NULL;
|
||||
}
|
||||
|
||||
func_80057C6C(&globalCtx->mainCamera, &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
Camera_ChangeStatus(&globalCtx->mainCamera, 7);
|
||||
Camera_Init(&globalCtx->mainCamera, &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
Camera_ChangeStatus(&globalCtx->mainCamera, CAM_STAT_ACTIVE);
|
||||
|
||||
for (i = 0; i < 3; i++) {
|
||||
func_80057C6C(&globalCtx->subCameras[i], &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
Camera_ChangeStatus(&globalCtx->subCameras[i], 0x100);
|
||||
Camera_Init(&globalCtx->subCameras[i + 1], &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
Camera_ChangeStatus(&globalCtx->subCameras[i + 1], 0x100);
|
||||
}
|
||||
|
||||
globalCtx->cameraPtrs[0] = &globalCtx->mainCamera;
|
||||
|
@ -385,13 +385,13 @@ void Gameplay_Init(GameState* thisx) {
|
|||
}
|
||||
|
||||
player = PLAYER;
|
||||
func_80058148(&globalCtx->mainCamera, player);
|
||||
func_8005A444(&globalCtx->mainCamera, 0);
|
||||
Camera_InitPlayerSettings(&globalCtx->mainCamera, player);
|
||||
Camera_ChangeMode(&globalCtx->mainCamera, CAM_MODE_NORMAL);
|
||||
|
||||
playerStartCamId = player->actor.params & 0xFF;
|
||||
if (playerStartCamId != 0xFF) {
|
||||
osSyncPrintf("player has start camera ID (" VT_FGCOL(BLUE) "%d" VT_RST ")\n", playerStartCamId);
|
||||
func_8005A7A8(&globalCtx->mainCamera, playerStartCamId);
|
||||
Camera_ChangeDataIdx(&globalCtx->mainCamera, playerStartCamId);
|
||||
}
|
||||
|
||||
if (YREG(15) == 0x20) {
|
||||
|
@ -1011,7 +1011,7 @@ void Gameplay_Update(GlobalContext* globalCtx) {
|
|||
LOG_NUM("1", 1, "../z_play.c", 3801);
|
||||
}
|
||||
|
||||
if ((sp80 == 0) || (D_8011D394 != 0)) {
|
||||
if ((sp80 == 0) || (gDbgCamEnabled != 0)) {
|
||||
s32 i; // 0x54
|
||||
s32 camIdx;
|
||||
Vec3s sp48;
|
||||
|
@ -1028,12 +1028,12 @@ void Gameplay_Update(GlobalContext* globalCtx) {
|
|||
LOG_NUM("1", 1, "../z_play.c", 3809);
|
||||
}
|
||||
|
||||
func_800591EC(&sp48, globalCtx->cameraPtrs[i]);
|
||||
Camera_Update(&sp48, globalCtx->cameraPtrs[i]);
|
||||
camIdx = globalCtx->nextCamera;
|
||||
}
|
||||
}
|
||||
|
||||
func_800591EC(&sp48, globalCtx->cameraPtrs[camIdx]);
|
||||
Camera_Update(&sp48, globalCtx->cameraPtrs[camIdx]);
|
||||
|
||||
if (1 && HREG(63)) {
|
||||
LOG_NUM("1", 1, "../z_play.c", 3814);
|
||||
|
@ -1231,7 +1231,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
if (globalCtx->skyboxCtx.unk_140 != 0) {
|
||||
if (ACTIVE_CAM->setting != 0x19) {
|
||||
Vec3f sp74;
|
||||
func_8005AFB4(&sp74, ACTIVE_CAM);
|
||||
Camera_GetSkyboxOffset(&sp74, ACTIVE_CAM);
|
||||
SkyboxDraw_Draw(&globalCtx->skyboxCtx, gfxCtx, globalCtx->skyboxId, 0,
|
||||
globalCtx->view.eye.x + sp74.x, globalCtx->view.eye.y + sp74.y,
|
||||
globalCtx->view.eye.z + sp74.z);
|
||||
|
@ -1313,7 +1313,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
|
||||
if (globalCtx->view.unk_124 != 0) {
|
||||
Vec3s sp50;
|
||||
func_800591EC(&sp50, ACTIVE_CAM);
|
||||
Camera_Update(&sp50, ACTIVE_CAM);
|
||||
func_800AB944(&globalCtx->view);
|
||||
globalCtx->view.unk_124 = 0;
|
||||
if ((globalCtx->skyboxId != 0) && (globalCtx->skyboxId != 0x1D) && !globalCtx->envCtx.skyDisabled) {
|
||||
|
@ -1322,7 +1322,7 @@ void Gameplay_Draw(GlobalContext* globalCtx) {
|
|||
}
|
||||
}
|
||||
|
||||
func_80059EC8(ACTIVE_CAM);
|
||||
Camera_Finish(ACTIVE_CAM);
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "../z_play.c", 4508);
|
||||
}
|
||||
|
@ -1533,8 +1533,8 @@ s16 Gameplay_CreateSubCamera(GlobalContext* globalCtx) {
|
|||
i);
|
||||
|
||||
globalCtx->cameraPtrs[i] = &globalCtx->subCameras[i - 1];
|
||||
func_80057C6C(globalCtx->cameraPtrs[i], &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
globalCtx->cameraPtrs[i]->unk_164 = i;
|
||||
Camera_Init(globalCtx->cameraPtrs[i], &globalCtx->view, &globalCtx->colCtx, globalCtx);
|
||||
globalCtx->cameraPtrs[i]->thisIdx = i;
|
||||
|
||||
return i;
|
||||
}
|
||||
|
@ -1589,94 +1589,94 @@ Camera* Gameplay_GetCamera(GlobalContext* globalCtx, s16 camId) {
|
|||
return globalCtx->cameraPtrs[camIdx];
|
||||
}
|
||||
|
||||
s32 func_800C04D8(GlobalContext* globalCtx, s16 camId, Vec3f* arg2, Vec3f* arg3) {
|
||||
s32 Gameplay_CameraSetAtEye(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye) {
|
||||
s32 ret = 0;
|
||||
s16 camIdx = (camId == -1) ? globalCtx->activeCamera : camId;
|
||||
Camera* camera = globalCtx->cameraPtrs[camIdx];
|
||||
Player* player;
|
||||
|
||||
ret |= Camera_SetParam(camera, 1, arg2);
|
||||
ret |= Camera_SetParam(camera, 1, at);
|
||||
ret <<= 1;
|
||||
ret |= Camera_SetParam(camera, 2, arg3);
|
||||
ret |= Camera_SetParam(camera, 2, eye);
|
||||
|
||||
camera->dist = Math3D_Vec3f_DistXYZ(arg2, arg3);
|
||||
camera->dist = Math3D_Vec3f_DistXYZ(at, eye);
|
||||
|
||||
player = camera->player;
|
||||
if (player != NULL) {
|
||||
camera->unk_E4.x = arg2->x - player->actor.posRot.pos.x;
|
||||
camera->unk_E4.y = arg2->y - player->actor.posRot.pos.y;
|
||||
camera->unk_E4.z = arg2->z - player->actor.posRot.pos.z;
|
||||
camera->posOffset.x = at->x - player->actor.posRot.pos.x;
|
||||
camera->posOffset.y = at->y - player->actor.posRot.pos.y;
|
||||
camera->posOffset.z = at->z - player->actor.posRot.pos.z;
|
||||
} else {
|
||||
camera->unk_E4.x = camera->unk_E4.y = camera->unk_E4.z = 0.0f;
|
||||
camera->posOffset.x = camera->posOffset.y = camera->posOffset.z = 0.0f;
|
||||
}
|
||||
|
||||
camera->unk_100 = 0.01f;
|
||||
camera->atLERPStepScale = 0.01f;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 func_800C05E4(GlobalContext* globalCtx, s16 camId, Vec3f* arg2, Vec3f* arg3, Vec3f* arg4) {
|
||||
s32 Gameplay_CameraSetAtEyeUp(GlobalContext* globalCtx, s16 camId, Vec3f* at, Vec3f* eye, Vec3f* up) {
|
||||
s32 ret = 0;
|
||||
s16 camIdx = (camId == -1) ? globalCtx->activeCamera : camId;
|
||||
Camera* camera = globalCtx->cameraPtrs[camIdx];
|
||||
Player* player;
|
||||
|
||||
ret |= Camera_SetParam(camera, 1, arg2);
|
||||
ret |= Camera_SetParam(camera, 1, at);
|
||||
ret <<= 1;
|
||||
ret |= Camera_SetParam(camera, 2, arg3);
|
||||
ret |= Camera_SetParam(camera, 2, eye);
|
||||
ret <<= 1;
|
||||
ret |= Camera_SetParam(camera, 4, arg4);
|
||||
ret |= Camera_SetParam(camera, 4, up);
|
||||
|
||||
camera->dist = Math3D_Vec3f_DistXYZ(arg2, arg3);
|
||||
camera->dist = Math3D_Vec3f_DistXYZ(at, eye);
|
||||
|
||||
player = camera->player;
|
||||
if (player != NULL) {
|
||||
camera->unk_E4.x = arg2->x - player->actor.posRot.pos.x;
|
||||
camera->unk_E4.y = arg2->y - player->actor.posRot.pos.y;
|
||||
camera->unk_E4.z = arg2->z - player->actor.posRot.pos.z;
|
||||
camera->posOffset.x = at->x - player->actor.posRot.pos.x;
|
||||
camera->posOffset.y = at->y - player->actor.posRot.pos.y;
|
||||
camera->posOffset.z = at->z - player->actor.posRot.pos.z;
|
||||
} else {
|
||||
camera->unk_E4.x = camera->unk_E4.y = camera->unk_E4.z = 0.0f;
|
||||
camera->posOffset.x = camera->posOffset.y = camera->posOffset.z = 0.0f;
|
||||
}
|
||||
|
||||
camera->unk_100 = 0.01f;
|
||||
camera->atLERPStepScale = 0.01f;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 func_800C0704(GlobalContext* globalCtx, s16 camId, f32 arg2) {
|
||||
s32 ret = Camera_SetParam(globalCtx->cameraPtrs[camId], 32, &arg2) & 1;
|
||||
s32 Gameplay_CameraSetFov(GlobalContext* globalCtx, s16 camId, f32 fov) {
|
||||
s32 ret = Camera_SetParam(globalCtx->cameraPtrs[camId], 0x20, &fov) & 1;
|
||||
if (1) {}
|
||||
return ret;
|
||||
}
|
||||
|
||||
s32 func_800C0744(GlobalContext* globalCtx, s16 camId, s16 arg2) {
|
||||
s32 Gameplay_SetCameraRoll(GlobalContext* globalCtx, s16 camId, s16 roll) {
|
||||
s16 camIdx = (camId == -1) ? globalCtx->activeCamera : camId;
|
||||
Camera* camera;
|
||||
|
||||
camera = globalCtx->cameraPtrs[camIdx];
|
||||
camera->roll = arg2;
|
||||
camera->roll = roll;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void func_800C078C(GlobalContext* globalCtx, s16 camId1, s16 camId2) {
|
||||
void Gameplay_CopyCamera(GlobalContext* globalCtx, s16 camId1, s16 camId2) {
|
||||
s16 camIdx2 = (camId2 == -1) ? globalCtx->activeCamera : camId2;
|
||||
s16 camIdx1 = (camId1 == -1) ? globalCtx->activeCamera : camId1;
|
||||
|
||||
func_8005AE64(globalCtx->cameraPtrs[camIdx1], globalCtx->cameraPtrs[camIdx2]);
|
||||
Camera_Copy(globalCtx->cameraPtrs[camIdx1], globalCtx->cameraPtrs[camIdx2]);
|
||||
}
|
||||
|
||||
s32 func_800C0808(GlobalContext* globalCtx, s16 camId, Player* player, s16 arg3) {
|
||||
s32 func_800C0808(GlobalContext* globalCtx, s16 camId, Player* player, s16 setting) {
|
||||
Camera* camera;
|
||||
s16 camIdx = (camId == -1) ? globalCtx->activeCamera : camId;
|
||||
|
||||
camera = globalCtx->cameraPtrs[camIdx];
|
||||
func_80058148(camera, player);
|
||||
return func_8005A77C(camera, arg3);
|
||||
Camera_InitPlayerSettings(camera, player);
|
||||
return Camera_ChangeSetting(camera, setting);
|
||||
}
|
||||
|
||||
void func_800C0874(GlobalContext* globalCtx, s16 camId, s16 arg2) {
|
||||
func_8005A77C(Gameplay_GetCamera(globalCtx, camId), arg2);
|
||||
s32 Gameplay_CameraChangeSetting(GlobalContext* globalCtx, s16 camId, s16 setting) {
|
||||
return Camera_ChangeSetting(Gameplay_GetCamera(globalCtx, camId), setting);
|
||||
}
|
||||
|
||||
void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2) {
|
||||
|
@ -1695,14 +1695,14 @@ void func_800C08AC(GlobalContext* globalCtx, s16 camId, s16 arg2) {
|
|||
}
|
||||
|
||||
if (arg2 <= 0) {
|
||||
Gameplay_ChangeCameraStatus(globalCtx, 0, 7);
|
||||
globalCtx->cameraPtrs[0]->unk_14E = globalCtx->cameraPtrs[0]->unk_162 = 0;
|
||||
Gameplay_ChangeCameraStatus(globalCtx, 0, CAM_STAT_ACTIVE);
|
||||
globalCtx->cameraPtrs[0]->childCamIdx = globalCtx->cameraPtrs[0]->parentCamIdx = 0;
|
||||
} else {
|
||||
func_800800F8(globalCtx, 1020, arg2, NULL, 0);
|
||||
}
|
||||
}
|
||||
|
||||
s16 func_800C09A4(GlobalContext* globalCtx, s16 camId) {
|
||||
s16 Gameplay_CameraGetUID(GlobalContext* globalCtx, s16 camId) {
|
||||
Camera* camera = globalCtx->cameraPtrs[camId];
|
||||
|
||||
if (camera != NULL) {
|
||||
|
@ -1827,7 +1827,7 @@ s32 func_800C0D34(GlobalContext* globalCtx, Actor* actor, s16* yaw) {
|
|||
}
|
||||
|
||||
s32 func_800C0DB4(GlobalContext* globalCtx, Vec3f* arg1) {
|
||||
UNK_TYPE sp3C;
|
||||
WaterBox* sp3C;
|
||||
CollisionPoly* sp38;
|
||||
Vec3f sp2C;
|
||||
s32 sp28;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue