1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-13 04:39:36 +00:00

Document Parts of Camera Data (#1054)

* Add Data enum and fill ARRAY_COUNT

* Clean-Up

* Document camera settings

* Document scenes further

* Minor edit

* Cleanup

* More cleanup

* Oof, that was tedious

* Align function look-up tables

* Remove comments

* format

* Cleanup

* formatter gone wrong, hid comments from me

* format

* Dragorn PR Review 1

* Change approach to camera data using macros

* Clean up function and data map

* Cleanup Comments
This commit is contained in:
engineer124 2022-01-11 12:51:57 +11:00 committed by GitHub
parent 9e5a9d7dc9
commit 67f6b50de3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 2172 additions and 3045 deletions

View file

@ -64,7 +64,7 @@
#define R_AT_LERP_MIN OREG(41)
#define R_AT_LERP_SCALE OREG(42)
#define R_CAM_YOFFSET_NORM OREG(46)
#define R_CAM_FIXED3_FOV PREG(7)
#define R_CAM_DATA(type) PREG(type)
#define R_DBG_CAM_UPDATE PREG(80)
#define R_DBG_REG_UPDATE PREG(82)
#define R_RELOAD_CAM_PARAMS QREG(0)

View file

@ -48,7 +48,7 @@ typedef enum {
/* 0x17 */ CAM_SET_PIVOT_SHOP_BROWSING, // Shopping and browsing for items "CIRCLE2"
/* 0x18 */ CAM_SET_PIVOT_IN_FRONT, // The camera used on Link's balcony in Kokiri forest. Data present in scene data for Deku Tree, GTG, Inside Ganon's Castle (TODO: may or may not be used) "CIRCLE3"
/* 0x19 */ CAM_SET_PREREND_FIXED, // Camera is fixed in position and rotation "PREREND0"
/* 0x1A */ CAM_SET_PREREND_PIVET, // Camera is fixed in position with fixed pitch, but is free to rotate in the yaw direction 360 degrees "PREREND1"
/* 0x1A */ CAM_SET_PREREND_PIVOT, // Camera is fixed in position with fixed pitch, but is free to rotate in the yaw direction 360 degrees "PREREND1"
/* 0x1B */ CAM_SET_PREREND_SIDE_SCROLL, // Camera side-scrolls position to follow link. Only used in castle courtyard with the guards "PREREND3"
/* 0x1C */ CAM_SET_DOOR0, // Custom room door transitions, used in fire and royal family tomb
/* 0x1D */ CAM_SET_DOORC, // Generic room door transitions, camera moves and follows player as the door is open and closed
@ -191,6 +191,40 @@ typedef enum {
/* 0x47 */ CAM_FUNC_MAX
} CameraFuncType;
typedef enum {
/* 0x00 */ CAM_DATA_Y_OFFSET,
/* 0x01 */ CAM_DATA_EYE_DIST,
/* 0x02 */ CAM_DATA_EYE_DIST_NEXT,
/* 0x03 */ CAM_DATA_PITCH_TARGET,
/* 0x04 */ CAM_DATA_YAW_UPDATE_RATE_TARGET,
/* 0x05 */ CAM_DATA_XZ_UPDATE_RATE_TARGET,
/* 0x06 */ CAM_DATA_MAX_YAW_UPDATE,
/* 0x07 */ CAM_DATA_FOV,
/* 0x08 */ CAM_DATA_AT_LERP_STEP_SCALE,
/* 0x09 */ CAM_DATA_FLAGS,
/* 0x0A */ CAM_DATA_YAW_TARGET,
/* 0x0B */ CAM_DATA_GROUND_Y_OFFSET,
/* 0x0C */ CAM_DATA_GROUND_AT_LERP_STEP_SCALE,
/* 0x0D */ CAM_DATA_SWING_YAW_INIT,
/* 0x0E */ CAM_DATA_SWING_YAW_FINAL,
/* 0x0F */ CAM_DATA_SWING_PITCH_INIT,
/* 0x10 */ CAM_DATA_SWING_PITCH_FINAL,
/* 0x11 */ CAM_DATA_SWING_PITCH_ADJ,
/* 0x12 */ CAM_DATA_MIN_MAX_DIST_FACTOR,
/* 0x13 */ CAM_DATA_AT_OFFSET_X,
/* 0x14 */ CAM_DATA_AT_OFFSET_Y,
/* 0x15 */ CAM_DATA_AT_OFFSET_Z,
/* 0x16 */ CAM_DATA_UNK_22,
/* 0x17 */ CAM_DATA_UNK_23,
/* 0x18 */ CAM_DATA_FOV_SCALE,
/* 0x19 */ CAM_DATA_YAW_SCALE,
/* 0x1A */ CAM_DATA_UNK_26,
/* 0x1B */ CAM_DATA_MAX
} CameraDataType;
#define CAM_FUNCDATA_FLAGS(flags) \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ Vec3f collisionClosePoint;
/* 0x0C */ CollisionPoly* atEyePoly;
@ -225,6 +259,30 @@ typedef struct {
/* 0x24 */ Normal1Anim anim;
} Normal1; // size = 0x50
#define CAM_FUNCDATA_NORM1(yOffset, eyeDist, eyeDistNext, pitchTarget, yawUpdateRateTarget, xzUpdateRateTarget, maxYawUpdate, fov, atLerpStepScale, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ pitchTarget, CAM_DATA_PITCH_TARGET }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ xzUpdateRateTarget, CAM_DATA_XZ_UPDATE_RATE_TARGET }, \
{ maxYawUpdate, CAM_DATA_MAX_YAW_UPDATE }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }
#define CAM_FUNCDATA_NORM1_ALT(yOffset, eyeDist, eyeDistNext, pitchTarget, yawUpdateRateTarget, xzUpdateRateTarget, maxYawUpdate, fov, atLerpStepScale, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ pitchTarget, CAM_DATA_PITCH_TARGET }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ xzUpdateRateTarget, CAM_DATA_UNK_26 }, \
{ maxYawUpdate, CAM_DATA_MAX_YAW_UPDATE }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ Vec3f unk_00;
/* 0x0C */ Vec3f unk_0C;
@ -249,6 +307,17 @@ typedef struct {
/* 0x20 */ Normal2Anim anim;
} Normal2; // size = 0x4A
#define CAM_FUNCDATA_NORM2(yOffset, eyeDist, eyeDistNext, unk_23, yawUpdateRateTarget, maxYawUpdate, fov, atLerpStepScale, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ unk_23, CAM_DATA_UNK_23 }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ maxYawUpdate, CAM_DATA_MAX_YAW_UPDATE }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ SwingAnimation swing;
/* 0x1C */ f32 unk_1C;
@ -272,6 +341,17 @@ typedef struct {
/* 0x20 */ Normal3Anim anim;
} Normal3; // size = 0x4C
#define CAM_FUNCDATA_NORM3(yOffset, eyeDist, eyeDistNext, pitchTarget, yawUpdateRateTarget, xzUpdateRateTarget, fov, atLerpStepScale, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ pitchTarget, CAM_DATA_PITCH_TARGET }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ xzUpdateRateTarget, CAM_DATA_XZ_UPDATE_RATE_TARGET }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ Vec3f unk_00;
/* 0x0C */ f32 yTarget;
@ -283,7 +363,7 @@ typedef struct {
} Parallel1Anim; // size = 0x1A
typedef struct {
/* 0x00 */ f32 unk_00;
/* 0x00 */ f32 yOffset;
/* 0x04 */ f32 distTarget;
/* 0x08 */ f32 unk_08;
/* 0x0C */ f32 unk_0C;
@ -297,6 +377,19 @@ typedef struct {
/* 0x28 */ Parallel1Anim anim;
} Parallel1; // size = 0x42
#define CAM_FUNCDATA_PARA1(yOffset, eyeDist, pitchTarget, yawTarget, yawUpdateRateTarget, xzUpdateRateTarget, fov, atLerpStepScale, flags, groundYOffset, groundAtLerpStepScale) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ pitchTarget, CAM_DATA_PITCH_TARGET }, \
{ yawTarget, CAM_DATA_YAW_TARGET }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ xzUpdateRateTarget, CAM_DATA_XZ_UPDATE_RATE_TARGET }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }, \
{ groundYOffset, CAM_DATA_GROUND_Y_OFFSET }, \
{ groundAtLerpStepScale, CAM_DATA_GROUND_AT_LERP_STEP_SCALE }
typedef struct {
/* 0x00 */ SwingAnimation swing;
@ -316,6 +409,16 @@ typedef struct {
/* 0x20 */ Jump1Anim anim;
} Jump1; // size = 0x48
#define CAM_FUNCDATA_JUMP1(yOffset, eyeDist, eyeDistNext, yawUpdateRateTarget, maxYawUpdate, fov, atLerpStepScale, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ maxYawUpdate, CAM_DATA_MAX_YAW_UPDATE }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x0 */ f32 floorY;
/* 0x4 */ s16 yawTarget;
@ -338,6 +441,17 @@ typedef struct {
/* 0x24 */ Jump2Anim anim;
} Jump2; // size = 0x34
#define CAM_FUNCDATA_JUMP2(yOffset, eyeDist, eyeDistNext, minMaxDistFactor, yawUpdateRateTarget, xzUpdateRateTarget, fov, atLerpStepScale, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ minMaxDistFactor, CAM_DATA_MIN_MAX_DIST_FACTOR }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ xzUpdateRateTarget, CAM_DATA_XZ_UPDATE_RATE_TARGET }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ SwingAnimation swing;
/* 0x1C */ f32 unk_1C;
@ -359,6 +473,18 @@ typedef struct {
/* 0x24 */ Jump3Anim anim;
} Jump3; // size = 0x48
#define CAM_FUNCDATA_JUMP3(yOffset, eyeDist, eyeDistNext, pitchTarget, yawUpdateRateTarget, xzUpdateRateTarget, maxYawUpdate, fov, atLerpStepScale, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ pitchTarget, CAM_DATA_PITCH_TARGET }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ xzUpdateRateTarget, CAM_DATA_XZ_UPDATE_RATE_TARGET }, \
{ maxYawUpdate, CAM_DATA_MAX_YAW_UPDATE }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ f32 initialEyeToAtDist;
/* 0x04 */ f32 roll;
@ -388,8 +514,22 @@ typedef struct {
/* 0x30 */ Battle1Anim anim;
} Battle1; // size = 0x50
#define CAM_FUNCDATA_BATT1(yOffset, eyeDist, swingYawInit, swingYawFinal, swingPitchInit, swingPitchFinal, swingPitchAdj, fov, atLerpStepScale, flags, groundYOffset, groundAtLerpStepScale) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ swingYawInit, CAM_DATA_SWING_YAW_INIT }, \
{ swingYawFinal, CAM_DATA_SWING_YAW_FINAL }, \
{ swingPitchInit, CAM_DATA_SWING_PITCH_INIT }, \
{ swingPitchFinal, CAM_DATA_SWING_PITCH_FINAL }, \
{ swingPitchAdj, CAM_DATA_SWING_PITCH_ADJ }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }, \
{ groundYOffset, CAM_DATA_GROUND_Y_OFFSET }, \
{ groundAtLerpStepScale, CAM_DATA_GROUND_AT_LERP_STEP_SCALE }
typedef struct {
/* 0x0000 */ s16 animTimer;
/* 0x0 */ s16 animTimer;
} Battle4Anim; // size = 0x2
typedef struct {
@ -404,6 +544,15 @@ typedef struct {
/* 0x1C */ Battle4Anim anim;
} Battle4; // size = 0x20
#define CAM_FUNCDATA_BATT4(yOffset, eyeDist, pitchTarget, yawUpdateRateTarget, fov, atLerpStepScale, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ pitchTarget, CAM_DATA_PITCH_TARGET }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ f32 unk_00;
/* 0x04 */ f32 unk_04;
@ -432,6 +581,21 @@ typedef struct {
/* 0x34 */ Keep1Anim anim;
} KeepOn1; // size = 0x4C
#define CAM_FUNCDATA_KEEP1(yOffset, eyeDist, eyeDistNext, swingYawInit, swingYawFinal, swingPitchInit, swingPitchFinal, swingPitchAdj, fov, atLerpStepScale, flags, groundYOffset, groundAtLerpStepScale) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ swingYawInit, CAM_DATA_SWING_YAW_INIT }, \
{ swingYawFinal, CAM_DATA_SWING_YAW_FINAL }, \
{ swingPitchInit, CAM_DATA_SWING_PITCH_INIT }, \
{ swingPitchFinal, CAM_DATA_SWING_PITCH_FINAL }, \
{ swingPitchAdj, CAM_DATA_SWING_PITCH_ADJ }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }, \
{ groundYOffset, CAM_DATA_GROUND_Y_OFFSET }, \
{ groundAtLerpStepScale, CAM_DATA_GROUND_AT_LERP_STEP_SCALE }
typedef struct {
/* 0x00 */ Vec3f eyeToAtTarget; // esentially a VecSph, but all floats.
/* 0x0C */ Actor* target;
@ -455,6 +619,20 @@ typedef struct {
/* 0x2C */ Keep3Anim anim;
} KeepOn3; // size = 0x4C
#define CAM_FUNCDATA_KEEP3(yOffset, eyeDist, eyeDistNext, swingYawInit, swingYawFinal, swingPitchInit, swingPitchFinal, swingPitchAdj, fov, atLerpStepScale, yawUpdateRateTarget, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ swingYawInit, CAM_DATA_SWING_YAW_INIT }, \
{ swingYawFinal, CAM_DATA_SWING_YAW_FINAL }, \
{ swingPitchInit, CAM_DATA_SWING_PITCH_INIT }, \
{ swingPitchFinal, CAM_DATA_SWING_PITCH_FINAL }, \
{ swingPitchAdj, CAM_DATA_SWING_PITCH_ADJ }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ f32 unk_00;
/* 0x04 */ f32 unk_04;
@ -479,6 +657,17 @@ typedef struct {
/* 0x20 */ KeepOn4_Unk20 unk_20;
} KeepOn4; // size = 0x34
#define CAM_FUNCDATA_KEEP4(yOffset, eyeDist, pitchTarget, yawTarget, atOffsetZ, fov, flags, yawUpdateRateTarget, unk_22) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ pitchTarget, CAM_DATA_PITCH_TARGET }, \
{ yawTarget, CAM_DATA_YAW_TARGET }, \
{ atOffsetZ, CAM_DATA_AT_OFFSET_Z }, \
{ fov, CAM_DATA_FOV }, \
{ flags, CAM_DATA_FLAGS }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ unk_22, CAM_DATA_UNK_22 }
typedef struct {
/* 0x0 */ f32 fovTarget;
/* 0x4 */ s16 animTimer;
@ -492,6 +681,12 @@ typedef struct {
/* 0x0C */ KeepOn0Anim anim;
} KeepOn0; // size = 0x14
#define CAM_FUNCDATA_KEEP0(fovScale, yawScale, yawUpdateRateTarget, flags) \
{ fovScale, CAM_DATA_FOV_SCALE }, \
{ yawScale, CAM_DATA_YAW_SCALE }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ PosRot eyePosRotTarget;
/* 0x14 */ s16 fov;
@ -505,6 +700,12 @@ typedef struct {
/* 0x10 */ Fixed1Anim anim;
} Fixed1; // size = 0x28
#define CAM_FUNCDATA_FIXD1(yOffset, yawUpdateRateTarget, fov, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ fov, CAM_DATA_FOV }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x0 */ Vec3f eye;
/* 0xC */ s16 fov;
@ -519,6 +720,13 @@ typedef struct {
/* 0x14 */ Fixed2InitParams initParams;
} Fixed2; // size = 0x24
#define CAM_FUNCDATA_FIXD2(yOffset, yawUpdateRateTarget, xzUpdateRateTarget, fov, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ xzUpdateRateTarget, CAM_DATA_XZ_UPDATE_RATE_TARGET }, \
{ fov, CAM_DATA_FOV }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x0 */ Vec3s rot;
/* 0x6 */ s16 fov;
@ -545,6 +753,13 @@ typedef struct {
/* 0x14 */ Fixed4Anim anim;
} Fixed4; // size = 0x24
#define CAM_FUNCDATA_FIXD4(yOffset, yawUpdateRateTarget, xzUpdateRateTarget, fov, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ xzUpdateRateTarget, CAM_DATA_XZ_UPDATE_RATE_TARGET }, \
{ fov, CAM_DATA_FOV }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x0 */ f32 r;
/* 0x4 */ s16 yaw;
@ -563,6 +778,17 @@ typedef struct {
/* 0x24 */ Subj3Anim anim;
} Subj3; // size = 0x30
#define CAM_FUNCDATA_SUBJ3(yOffset, eyeDist, eyeDistNext, yawUpdateRateTarget, atOffsetX, atOffsetY, atOffsetZ, fov, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ atOffsetX, CAM_DATA_AT_OFFSET_X }, \
{ atOffsetY, CAM_DATA_AT_OFFSET_Y }, \
{ atOffsetZ, CAM_DATA_AT_OFFSET_Z }, \
{ fov, CAM_DATA_FOV }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ Linef unk_00;
/* 0x18 */ f32 unk_18;
@ -581,6 +807,14 @@ typedef struct {
/* 0x4 */ Subj4Anim anim;
} Subj4; // size = 0x38
#define CAM_FUNCDATA_SUBJ4(yOffset, eyeDist, eyeDistNext, yawUpdateRateTarget, fov, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ fov, CAM_DATA_FOV }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ PosRot eyePosRot;
/* 0x14 */ char unk_14[0x8];
@ -595,6 +829,11 @@ typedef struct {
/* 0xC */ Data4InitParams initParams;
} Data4; // size = 0x2C
#define CAM_FUNCDATA_DATA4(yOffset, fov, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ fov, CAM_DATA_FOV }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x0 */ f32 unk_00; // unused
/* 0x4 */ s16 yawTarget;
@ -614,6 +853,15 @@ typedef struct {
/* 0x1C */ Unique1Anim anim;
} Unique1; // size = 0x28
#define CAM_FUNCDATA_UNIQ1(yOffset, eyeDist, eyeDistNext, pitchTarget, fov, atLerpStepScale, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ pitchTarget, CAM_DATA_PITCH_TARGET }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x0 */ f32 unk_00;
/* 0x4 */ s16 unk_04;
@ -627,6 +875,12 @@ typedef struct {
/* 0x10 */ Unique2Unk10 unk_10; // unused, values set but not read.
} Unique2; // size = 0x18
#define CAM_FUNCDATA_UNIQ2(yOffset, eyeDist, fov, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ fov, CAM_DATA_FOV }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x0 */ f32 initialFov;
/* 0x4 */ f32 initialDist;
@ -652,6 +906,11 @@ typedef struct {
/* 0x18 */ Unique3Anim anim;
} Unique3; // size = 0x20
#define CAM_FUNCDATA_UNIQ3(yOffset, fov, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ fov, CAM_DATA_FOV }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ Vec3f initalPos;
/* 0x0C */ s16 animTimer;
@ -683,6 +942,10 @@ typedef struct {
/* 0x8 */ Unique7Unk8 unk_08; // unk_08 goes unused.
} Unique7; // size = 0x10
#define CAM_FUNCDATA_UNIQ7(fov, flags) \
{ fov, CAM_DATA_FOV }, \
{ flags, CAM_DATA_FLAGS }
/** initFlags
* & 0x00FF = atInitFlags
* & 0xFF00 = eyeInitFlags
@ -757,6 +1020,11 @@ typedef struct {
/* 0xC */ Demo3Anim anim;
} Demo3; // size = 0x20
#define CAM_FUNCDATA_DEMO3(fov, atLerpStepScale, flags) \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x0 */ s16 animTimer;
/* 0x4 */ Vec3f atTarget;
@ -798,6 +1066,10 @@ typedef struct {
/* 0x4 */ s16 interfaceFlags;
} Special0; // size = 0x8
#define CAM_FUNCDATA_SPEC0(yawUpdateRateTarget, flags) \
{ yawUpdateRateTarget, CAM_DATA_YAW_UPDATE_RATE_TARGET }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x0 */ s16 initalTimer;
} Special4; // size = 0x4
@ -819,6 +1091,27 @@ typedef struct {
/* 0x1C */ Special5Anim anim;
} Special5; // size = 0x20
#define CAM_FUNCDATA_SPEC5(yOffset, eyeDist, eyeDistNext, unk_22, pitchTarget, fov, atLerpStepScale, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ unk_22, CAM_DATA_UNK_22 }, \
{ pitchTarget, CAM_DATA_PITCH_TARGET }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ flags, CAM_DATA_FLAGS }
// Uses incorrect CAM_DATA values
#define CAM_FUNCDATA_SPEC5_ALT(yOffset, eyeDist, eyeDistNext, pitchTarget, fov, atLerpStepScale, unk_22, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ eyeDist, CAM_DATA_EYE_DIST }, \
{ eyeDistNext, CAM_DATA_EYE_DIST_NEXT }, \
{ pitchTarget, CAM_DATA_PITCH_TARGET }, \
{ fov, CAM_DATA_FOV }, \
{ atLerpStepScale, CAM_DATA_AT_LERP_STEP_SCALE }, \
{ unk_22, CAM_DATA_UNK_22 }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x0 */ s16 idx;
} Special7; // size = 0x4
@ -850,6 +1143,11 @@ typedef struct {
/* 0xC */ Special9Params params;
} Special9; // size = 0x1C
#define CAM_FUNCDATA_SPEC9(yOffset, fov, flags) \
{ yOffset, CAM_DATA_Y_OFFSET }, \
{ fov, CAM_DATA_FOV }, \
{ flags, CAM_DATA_FLAGS }
typedef struct {
/* 0x00 */ Vec3f pos;
/* 0x0C */ Vec3f norm;

View file

@ -701,7 +701,7 @@ f32 Camera_ClampLERPScale(Camera* camera, f32 maxLERPScale) {
return ret;
}
void Camera_CopyModeValuesToPREG(Camera* camera, s16 mode) {
void Camera_CopyDataToRegs(Camera* camera, s16 mode) {
CameraModeValue* values;
CameraModeValue* valueP;
s32 i;
@ -714,9 +714,9 @@ void Camera_CopyModeValuesToPREG(Camera* camera, s16 mode) {
for (i = 0; i < sCameraSettings[camera->setting].cameraModes[mode].valueCnt; i++) {
valueP = &values[i];
PREG(valueP->param) = valueP->val;
PREG(valueP->dataType) = valueP->val;
if (PREG(82)) {
osSyncPrintf("camera: res: PREG(%02d) = %d\n", valueP->param, valueP->val);
osSyncPrintf("camera: res: PREG(%02d) = %d\n", valueP->dataType, valueP->val);
}
}
camera->animState = 0;
@ -729,9 +729,9 @@ s32 Camera_CopyPREGToModeValues(Camera* camera) {
for (i = 0; i < sCameraSettings[camera->setting].cameraModes[camera->mode].valueCnt; i++) {
valueP = &values[i];
valueP->val = PREG(valueP->param);
valueP->val = R_CAM_DATA(valueP->dataType);
if (PREG(82)) {
osSyncPrintf("camera: res: %d = PREG(%02d)\n", valueP->val, valueP->param);
osSyncPrintf("camera: res: %d = PREG(%02d)\n", valueP->val, valueP->dataType);
}
}
return true;
@ -999,7 +999,7 @@ s32 func_80045B08(Camera* camera, VecSph* eyeAtDir, f32 yExtra, s16 arg3) {
/**
* Adjusts the camera's at position for Camera_Parallel1
*/
s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 arg2, f32* arg3, s16 arg4) {
s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 yOffset, f32* arg3, s16 arg4) {
Vec3f* at = &camera->at;
Vec3f posOffsetTarget;
Vec3f atTarget;
@ -1013,7 +1013,7 @@ s32 Camera_CalcAtForParallel(Camera* camera, VecSph* arg1, f32 arg2, f32* arg3,
temp_f0_4 = Player_GetHeight(camera->player);
posOffsetTarget.x = 0.0f;
posOffsetTarget.y = temp_f0_4 + arg2;
posOffsetTarget.y = temp_f0_4 + yOffset;
posOffsetTarget.z = 0.0f;
if (PREG(76) && arg4) {
@ -1974,8 +1974,7 @@ s32 Camera_Parallel1(Camera* camera) {
CameraModeValue* values = sCameraSettings[camera->setting].cameraModes[camera->mode].values;
f32 yNormal = (1.0f + PCT(OREG(46))) - (PCT(OREG(46)) * (68.0f / playerHeight));
para1->unk_00 = NEXTPCT * playerHeight * yNormal;
;
para1->yOffset = NEXTPCT * playerHeight * yNormal;
para1->distTarget = NEXTPCT * playerHeight * yNormal;
para1->pitchTarget = DEGF_TO_BINANG(NEXTSETTING);
para1->yawTarget = DEGF_TO_BINANG(NEXTSETTING);
@ -2068,7 +2067,7 @@ s32 Camera_Parallel1(Camera* camera) {
}
if (!(para1->interfaceFlags & 0x80) && !sp6A) {
Camera_CalcAtForParallel(camera, &atToEyeNextDir, para1->unk_00, &anim->yTarget, para1->interfaceFlags & 1);
Camera_CalcAtForParallel(camera, &atToEyeNextDir, para1->yOffset, &anim->yTarget, para1->interfaceFlags & 1);
} else {
func_800458D4(camera, &atToEyeNextDir, para1->unk_18, &anim->yTarget, para1->interfaceFlags & 1);
}
@ -4007,7 +4006,7 @@ s32 Camera_Fixed3(Camera* camera) {
if (camera->animState == 0) {
anim->updDirTimer = 5;
R_CAM_FIXED3_FOV = anim->fov;
R_CAM_DATA(CAM_DATA_FOV) = anim->fov;
camera->animState++;
}
@ -4030,7 +4029,7 @@ s32 Camera_Fixed3(Camera* camera) {
Camera_Vec3fVecSphGeoAdd(at, eye, &atSph);
sCameraInterfaceFlags = fixd3->interfaceFlags;
anim->fov = R_CAM_FIXED3_FOV;
anim->fov = R_CAM_DATA(CAM_DATA_FOV);
camera->roll = 0;
camera->fov = anim->fov * 0.01f;
camera->atLERPStepScale = 0.0f;
@ -6789,8 +6788,8 @@ void Camera_Init(Camera* camera, View* view, CollisionContext* colCtx, GlobalCon
OREG(i) = sOREGInit[i];
}
for (i = 0; i < sPREGInitCnt; i++) {
PREG(i) = sPREGInit[i];
for (i = 0; i < sCamDataRegsInitCount; i++) {
R_CAM_DATA(i) = sCamDataRegsInit[i];
}
DbCamera_Reset(camera, &D_8015BD80);
@ -6945,7 +6944,7 @@ void Camera_InitPlayerSettings(Camera* camera, Player* player) {
camera->paramFlags = 0;
camera->nextCamDataIdx = -1;
camera->atLERPStepScale = 1.0f;
Camera_CopyModeValuesToPREG(camera, camera->mode);
Camera_CopyDataToRegs(camera, camera->mode);
Camera_QRegInit();
osSyncPrintf(VT_FGCOL(BLUE) "camera: personalize ---" VT_RST "\n");
@ -6972,9 +6971,9 @@ s16 Camera_ChangeStatus(Camera* camera, s16 status) {
values = sCameraSettings[camera->setting].cameraModes[camera->mode].values;
for (i = 0; i < sCameraSettings[camera->setting].cameraModes[camera->mode].valueCnt; i++) {
valueP = &values[i];
PREG(valueP->param) = valueP->val;
R_CAM_DATA(valueP->dataType) = valueP->val;
if (PREG(82)) {
osSyncPrintf("camera: change camera status: PREG(%02d) = %d\n", valueP->param, valueP->val);
osSyncPrintf("camera: change camera status: PREG(%02d) = %d\n", valueP->dataType, valueP->val);
}
}
}
@ -7615,7 +7614,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) {
osSyncPrintf(VT_COL(YELLOW, BLACK) "camera: change camera mode: force NORMAL: %s %s refused\n" VT_RST,
sCameraSettingNames[camera->setting], sCameraModeNames[mode]);
camera->mode = CAM_MODE_NORMAL;
Camera_CopyModeValuesToPREG(camera, camera->mode);
Camera_CopyDataToRegs(camera, camera->mode);
func_8005A02C(camera);
return 0xC0000000 | mode;
} else {
@ -7631,7 +7630,7 @@ s32 Camera_ChangeModeFlags(Camera* camera, s16 mode, u8 flags) {
}
camera->unk_14A |= 0x20;
camera->unk_14A |= 2;
Camera_CopyModeValuesToPREG(camera, mode);
Camera_CopyDataToRegs(camera, mode);
modeChangeFlags = 0;
switch (mode) {
case CAM_MODE_FIRSTPERSON:
@ -7790,7 +7789,7 @@ s16 Camera_ChangeSettingFlags(Camera* camera, s16 setting, s16 flags) {
camera->setting = setting;
if (Camera_ChangeModeFlags(camera, camera->mode, 1) >= 0) {
Camera_CopyModeValuesToPREG(camera, camera->mode);
Camera_CopyDataToRegs(camera, camera->mode);
}
osSyncPrintf(VT_SGR("1") "%06u:" VT_RST " camera: change camera[%d] set %s\n", camera->globalCtx->state.frames,
@ -7819,7 +7818,7 @@ s32 Camera_ChangeDataIdx(Camera* camera, s32 camDataIdx) {
if (settingChangeSuccessful || sCameraSettings[camera->setting].unk_00 & 0x80000000) {
camera->camDataIdx = camDataIdx;
camera->unk_14A |= 4;
Camera_CopyModeValuesToPREG(camera, camera->mode);
Camera_CopyDataToRegs(camera, camera->mode);
} else if (settingChangeSuccessful < -1) {
//! @bug: This is likely checking the wrong value. The actual return of Camera_ChangeSettingFlags or
// camDataIdx would make more sense.
@ -7994,7 +7993,7 @@ s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 camDataIdx, f32 a
doorParams->camDataIdx = camDataIdx;
if (camDataIdx == -99) {
Camera_CopyModeValuesToPREG(camera, camera->mode);
Camera_CopyDataToRegs(camera, camera->mode);
return -99;
}
@ -8014,7 +8013,7 @@ s32 Camera_ChangeDoorCam(Camera* camera, Actor* doorActor, s16 camDataIdx, f32 a
osSyncPrintf("....change door camera ID %d (set %d)\n", camera->camDataIdx, camera->setting);
}
Camera_CopyModeValuesToPREG(camera, camera->mode);
Camera_CopyDataToRegs(camera, camera->mode);
return -1;
}

File diff suppressed because it is too large Load diff