diff --git a/include/functions.h b/include/functions.h index 8d17ad6635..12ae08d537 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1462,9 +1462,9 @@ void ShrinkWindow_Update(s32 updateRate); // ? DbCamera_PrintU16Bytes(?); // ? DbCamera_PrintS16Bytes(?); // ? DbCamera_PrintCutBytes(?); -// ? DbCamera_Init(?); +void DbCamera_Init(DbCamera* dbCamera, Camera* cameraPtr); // ? DbgCamera_Enable(?); -// ? DbCamera_Update(?); +void DbCamera_Update(DbCamera* dbCamera, Camera* cam); // ? DbCamera_GetFirstAvailableLetter(?); // ? DbCamera_InitCut(?); // ? DbCamera_ResetCut(?); @@ -1473,7 +1473,7 @@ void ShrinkWindow_Update(s32 updateRate); // ? DbCamera_DrawSlotLetters(?); // ? DbCamera_PrintAllCuts(?); // ? func_800B91B0(?); -// ? DbCamera_Reset(?); +void DbCamera_Reset(Camera* cam, DbCamera* dbCam); // ? DbCamera_UpdateDemoControl(?); // ? func_800BB0A0(?); s32 func_800BB2B4(Vec3f* pos, f32* roll, f32* fov, CutsceneCameraPoint* point, s16* keyframe, f32* curFrame); @@ -2177,6 +2177,7 @@ void func_800F5E90(u8); void func_800F6114(f32); void func_800F6268(f32, u16); void func_800F64E0(u8 arg0); +void func_800F6584(u8 arg0); void func_800F66C0(s8 echo); void func_800F66DC(s8); void func_800F6700(s8 outputMode); diff --git a/include/z64camera.h b/include/z64camera.h index 9900ed5692..5589a67efe 100644 --- a/include/z64camera.h +++ b/include/z64camera.h @@ -925,37 +925,67 @@ typedef struct { /** * Debug Camera */ + typedef struct { - /* 0x0000 */ UNK_TYPE unk_00; + /* 0x0000 */ s16 mode; + /* 0x0002 */ s16 nFrames; + /* 0x0004 */ s16 nPoints; + /* 0x0006 */ s16 unkIdx; + /* 0x0008 */ s16 unk_08; + /* 0x000A */ s16 unk_0A; + /* 0x000C */ s32 unk_0C; // bool: indicates position vs lookAt? + /* 0x0010 */ char unk_10[0x14]; + /* 0x0024 */ CutsceneCameraPoint position[129]; + /* 0x0834 */ CutsceneCameraPoint lookAt[129]; + /* 0x1044 */ s16 demoCtrlMenu; + /* 0x1046 */ s16 demoCtrlActionIdx; // e (?), s (save), l (load), c (clear) + /* 0x1048 */ s16 demoCtrlToggleSwitch; + /* 0x104A */ Vec3s unk_104A; +} DbCameraSub; // size = 0x1050 + +typedef struct { + /* 0x0000 */ s32 unk_00; /* 0x0004 */ Vec3f at; /* 0x0010 */ Vec3f eye; - /* 0x001C */ Vec3f up; - /* 0x0028 */ Vec3f unk_28; - /* 0x0034 */ UNK_TYPE unk_34; - /* 0x0038 */ UNK_TYPE unk_38; - /* 0x003C */ UNK_TYPE unk_3C; - /* 0x0040 */ UNK_TYPE unk_40; - /* 0x0044 */ UNK_TYPE unk_44; + /* 0x001C */ Vec3f unk_1C; + /* 0x0028 */ char unk_28[0xC]; + /* 0x0034 */ s32 unk_34; + /* 0x0038 */ s32 unk_38; + /* 0x003C */ s32 unk_3C; // bool + /* 0x0040 */ s32 unk_40; + /* 0x0044 */ s32 unk_44; /* 0x0048 */ f32 fov; - /* 0x004C */ s16 unk_4C; - /* 0x0050 */ f32 unk_50; + /* 0x004C */ s16 roll; + /* 0x004E */ char unk_4E[0x2]; + /* 0x0050 */ f32 rollDegrees; /* 0x0054 */ Vec3f unk_54; - /* 0x0054 */ Vec3f unk_60; - /* 0x006C */ f32 unk_6C; - /* 0x0070 */ f32 unk_70; - /* 0x0074 */ f32 unk_74; + /* 0x0060 */ Vec3f unk_60; + /* 0x006C */ Vec3f unk_6C; /* 0x0078 */ s16 unk_78; /* 0x007A */ s16 unk_7A; - /* 0x007C */ s16 unk_7C; - /* 0x007E */ s16 unk_7E; - /* 0x0080 */ s16 unk_80; - /* 0x0082 */ s16 unk_82; - /* 0x0084 */ s16 unk_84; - /* 0x0086 */ s16 unk_86; - /* 0x0088 */ s32 unk_88; - /* 0x008A */ char unk_8C[0x1034]; - /* 0x10C0 */ Vec3s unk_10C0; - /* 0x10C6 */ Vec3s unk_10C6; -} DBCamera; // size = 0x10CC + /* 0x007C */ DbCameraSub sub; +} DbCamera; // size = 0x10CC + +typedef struct { + /* 0x00 */ char letter; + /* 0x01 */ u8 unk_01; + /* 0x02 */ s16 mode; + /* 0x04 */ CutsceneCameraPoint* position; + /* 0x08 */ CutsceneCameraPoint* lookAt; + /* 0x0C */ s16 nFrames; + /* 0x0E */ s16 nPoints; +} DbCameraCut; // size = 0x10 + +typedef struct { + /* 0x00 */ f32 curFrame; + /* 0x04 */ f32 unk_04; // frame count? + /* 0x08 */ s16 keyframe; + /* 0x0A */ s16 unk_0A; + /* 0x0C */ s16 unk_0C; + /* 0x10 */ Vec3f positionPos; // confusing name + /* 0x1C */ Vec3f lookAtPos; + /* 0x28 */ f32 roll; + /* 0x2C */ f32 fov; +} DbCameraAnim; // size = 0x30 #endif diff --git a/src/code/audio_load.c b/src/code/audio_load.c index 15a55b0bcb..acc9dfa067 100644 --- a/src/code/audio_load.c +++ b/src/code/audio_load.c @@ -297,13 +297,12 @@ s32 func_800E1D64(s32 arg0, s32 arg1, s32 arg2) { } func_800E1C78(instrument->normalNotesSound.sample, arg0); if (instrument->normalRangeHi != 0x7F) { - func_800E1C78(instrument->highNotesSound.sample, arg0); - return; + return func_800E1C78(instrument->highNotesSound.sample, arg0); } } else if (arg1 == 0x7F) { Drum* drum = Audio_GetDrum(arg0, arg2); - if (drum == 0) { + if (drum == NULL) { return -1; } func_800E1C78(drum->sound.sample, arg0); diff --git a/src/code/code_800EC960.c b/src/code/code_800EC960.c index 79fb1479b0..239830925a 100644 --- a/src/code/code_800EC960.c +++ b/src/code/code_800EC960.c @@ -2458,7 +2458,7 @@ void func_800F50CC(void); void func_800F4A70(void); void func_800F5CF8(void); -void func_800F30534(void) { +void func_800F3054(void) { if (func_800FAD34() == 0) { sAudioUpdateTaskStart = gAudioContext.totalTaskCnt; sAudioUpdateStartTime = osGetTime(); diff --git a/src/code/db_camera.c b/src/code/db_camera.c index 3010243212..07ddcbbf73 100644 --- a/src/code/db_camera.c +++ b/src/code/db_camera.c @@ -1,68 +1,6 @@ #include "ultra64.h" #include "global.h" -typedef struct { - /* 0x0000 */ s16 mode; - /* 0x0002 */ s16 nFrames; - /* 0x0004 */ s16 nPoints; - /* 0x0006 */ s16 unkIdx; - /* 0x0008 */ s16 unk_08; - /* 0x000A */ s16 unk_0A; - /* 0x000C */ s32 unk_0C; // bool: indicates position vs lookAt? - /* 0x0010 */ char unk_10[0x14]; - /* 0x0024 */ CutsceneCameraPoint position[129]; - /* 0x0834 */ CutsceneCameraPoint lookAt[129]; - /* 0x1044 */ s16 demoCtrlMenu; - /* 0x1046 */ s16 demoCtrlActionIdx; // e (?), s (save), l (load), c (clear) - /* 0x1048 */ s16 demoCtrlToggleSwitch; - /* 0x104A */ Vec3s unk_104A; -} DbCameraSub; // size = 0x1050 - -typedef struct { - /* 0x0000 */ s32 unk_00; - /* 0x0004 */ Vec3f at; - /* 0x0010 */ Vec3f eye; - /* 0x001C */ Vec3f unk_1C; - /* 0x0028 */ char unk_28[0xC]; - /* 0x0034 */ s32 unk_34; - /* 0x0038 */ s32 unk_38; - /* 0x003C */ s32 unk_3C; // bool - /* 0x0040 */ s32 unk_40; - /* 0x0044 */ s32 unk_44; - /* 0x0048 */ f32 fov; - /* 0x004C */ s16 roll; - /* 0x004E */ char unk_4E[0x2]; - /* 0x0050 */ f32 rollDegrees; - /* 0x0054 */ Vec3f unk_54; - /* 0x0060 */ Vec3f unk_60; - /* 0x006C */ Vec3f unk_6C; - /* 0x0078 */ s16 unk_78; - /* 0x007A */ s16 unk_7A; - /* 0x007C */ DbCameraSub sub; -} DbCamera; // size = 0x10CC - -typedef struct { - /* 0x00 */ char letter; - /* 0x01 */ u8 unk_01; - /* 0x02 */ s16 mode; - /* 0x04 */ CutsceneCameraPoint* position; - /* 0x08 */ CutsceneCameraPoint* lookAt; - /* 0x0C */ s16 nFrames; - /* 0x0E */ s16 nPoints; -} DbCameraCut; // size = 0x10 - -typedef struct { - /* 0x00 */ f32 curFrame; - /* 0x04 */ f32 unk_04; // frame count? - /* 0x08 */ s16 keyframe; - /* 0x0A */ s16 unk_0A; - /* 0x0C */ s16 unk_0C; - /* 0x10 */ Vec3f positionPos; // confusing name - /* 0x1C */ Vec3f lookAtPos; - /* 0x28 */ f32 roll; - /* 0x2C */ f32 fov; -} DbCameraAnim; // size = 0x30 - char* D_8012CEE0[] = { "\x8Cキ-フレ-ム\x8Dガ" }; const char* D_8012CEE4 = "\x8Dタリマセン。"; const char* D_8012CEE8 = "\x8Dサイセイデキマセン"; diff --git a/src/code/game.c b/src/code/game.c index 0fbf1a155c..61770c3042 100644 --- a/src/code/game.c +++ b/src/code/game.c @@ -436,7 +436,7 @@ void GameState_Destroy(GameState* gameState) { // game destructor start osSyncPrintf("game デストラクタ開始\n"); func_800C3C20(); - func_800F30534(); + func_800F3054(); osRecvMesg(&gameState->gfxCtx->queue, NULL, OS_MESG_BLOCK); LogUtils_CheckNullPointer("this->cleanup", gameState->destroy, "../game.c", 1139); if (gameState->destroy != NULL) { diff --git a/src/code/graph.c b/src/code/graph.c index 725cbaaa78..2ad106782c 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -362,7 +362,7 @@ void Graph_Update(GraphicsContext* gfxCtx, GameState* gameState) { gfxCtx->fbIdx++; } - func_800F30534(); + func_800F3054(); { OSTime time = osGetTime(); diff --git a/src/code/z_camera.c b/src/code/z_camera.c index 4505e0ebfa..7c8047c00d 100644 --- a/src/code/z_camera.c +++ b/src/code/z_camera.c @@ -7438,11 +7438,11 @@ Vec3s Camera_Update(Camera* camera) { if (gDbgCamEnabled) { camera->globalCtx->view.fovy = D_8015BD80.fov; DbCamera_Update(&D_8015BD80, camera); - func_800AA358(&camera->globalCtx->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.up); + func_800AA358(&camera->globalCtx->view, &D_8015BD80.eye, &D_8015BD80.at, &D_8015BD80.unk_1C); if (R_DBG_CAM_UPDATE) { osSyncPrintf("camera: debug out\n"); } - return D_8015BD80.unk_10C6; + return D_8015BD80.sub.unk_104A; } OREG(0) &= ~8; @@ -7811,7 +7811,7 @@ s32 Camera_ChangeDataIdx(Camera* camera, s32 camDataIdx) { Vec3s* Camera_GetInputDir(Vec3s* dst, Camera* camera) { if (gDbgCamEnabled) { - *dst = D_8015BD80.unk_10C6; + *dst = D_8015BD80.sub.unk_104A; return dst; } else { *dst = camera->inputDir; @@ -7835,7 +7835,7 @@ s16 Camera_GetInputDirYaw(Camera* camera) { Vec3s* Camera_GetCamDir(Vec3s* dst, Camera* camera) { if (gDbgCamEnabled) { - *dst = D_8015BD80.unk_10C6; + *dst = D_8015BD80.sub.unk_104A; return dst; } else { *dst = camera->camDir; diff --git a/src/code/z_camera_data.c b/src/code/z_camera_data.c index a88d5e9a17..ed92807e51 100644 --- a/src/code/z_camera_data.c +++ b/src/code/z_camera_data.c @@ -3569,5 +3569,5 @@ s16 D_8011DAFC[] = { }; GlobalContext* D_8015BD7C; -DBCamera D_8015BD80; +DbCamera D_8015BD80; CollisionPoly* playerFloorPoly;