Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dx camera upstreams #1207

Merged
merged 10 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
14 changes: 7 additions & 7 deletions include/camera.h
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#ifndef _CAMERA_H_
#define _CAMERA_H_

extern f32 D_8009A5EC;
extern f32 CamLengthScale;

void update_camera_mode_0(Camera*);
void update_camera_mode_1(Camera*);
void update_camera_mode_2(Camera*);
void update_camera_mode_4(Camera*);
void update_camera_mode_5(Camera*);
void update_camera_mode_6(Camera*);
void update_camera_minimal(Camera*);
void update_camera_unused_radial(Camera*);
void update_camera_interp_pos(Camera*);
void update_camera_unused_confined(Camera*);
void update_camera_unused_leading(Camera*);
void update_camera_no_interp(Camera*);
void create_camera_leadplayer_matrix(Camera*);

void update_camera_zone_interp(Camera* camera);
Expand Down
122 changes: 78 additions & 44 deletions include/common_structs.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,13 @@ typedef struct Matrix4s {
/* 0x20 */ s16 frac[4][4];
} Matrix4s; // size = 0x40

typedef struct CamConfiguration {
typedef struct CameraRig {
/* 0x00 */ f32 boomYaw;
/* 0x04 */ f32 boomLength;
/* 0x08 */ f32 boomPitch;
/* 0x0C */ f32 viewPitch;
/* 0x10 */ Vec3f targetPos;
} CamConfiguration; // size = 0x1C
} CameraRig; // size = 0x1C

typedef struct DmaTable {
/* 0x00 */ u8* start;
Expand Down Expand Up @@ -752,15 +752,15 @@ typedef struct CameraControlSettings {
} three;
} points;
/* 0x24 */ f32 viewPitch;
/* 0x28 */ s32 flag;
/* 0x28 */ b32 flag;
} CameraControlSettings; // size = 0x2C

typedef struct Camera {
/* 0x000 */ u16 flags;
/* 0x002 */ s16 moveFlags;
/* 0x004 */ s16 updateMode;
/* 0x006 */ s16 needsInit;
/* 0x008 */ b16 isChangingMap;
/* 0x006 */ b16 needsInit;
/* 0x008 */ b16 needsReinit; // used when loading from a save point or calling SetCamPerspective
/* 0x00A */ s16 viewportW;
/* 0x00C */ s16 viewportH;
/* 0x00E */ s16 viewportStartX;
Expand All @@ -769,58 +769,92 @@ typedef struct Camera {
/* 0x014 */ s16 farClip;
/* 0x016 */ char unk_16[2];
/* 0x018 */ f32 vfov;
/* 0x01C */ s16 auxPitch;
/* 0x01E */ s16 auxBoomLength;
/* 0x020 */ s16 lookAt_dist;
/* 0x022 */ s16 auxBoomPitch;
/* 0x024 */ s16 auxBoomYaw;
/* 0x026 */ s16 auxBoomZOffset;
/* 0x028 */ s16 unk_28;
/* 0x02A */ s16 zoomPercent;
union {
struct {
/* 0x01C */ s16 camParam1;
/* 0x01E */ s16 camParam2;
/* 0x020 */ s16 camParam3;
/* 0x022 */ s16 camParam4;
/* 0x024 */ s16 camParam5;
/* 0x026 */ s16 camParam6;
/* 0x028 */ s16 camParam7;
/* 0x02A */ s16 zoomPercent;
} world;
struct {
/* 0x01C */ b16 skipRecalc;
/* 0x01E */ s16 dist;
/* 0x020 */ s16 fovScale; // 100 --> vfov = 25, scales as 1/x so larger values mean smaller vfov
/* 0x022 */ s16 pitch;
/* 0x024 */ s16 yaw;
/* 0x026 */ s16 offsetY;
/* 0x028 */ s16 camParam7;
/* 0x02A */ s16 zoomPercent;
} basic;
struct {
/* 0x01C */ s16 pitch;
/* 0x01E */ s16 yaw;
/* 0x020 */ s16 dist;
/* 0x022 */ s16 offsetY;
} interp;
struct {
/* 0x01C */ s16 pitch;
/* 0x01E */ s16 minRadius;
/* 0x020 */ s16 dist;
/* 0x022 */ s16 offsetY;
} radial;
struct {
/* 0x01C */ s16 xLimit;
/* 0x01E */ s16 zLimit;
/* 0x020 */ s16 dist;
/* 0x022 */ s16 offsetY;
} confined;
} params;
/* 0x02C */ s16 bgColor[3];
/* 0x032 */ Vec3s targetScreenCoords;
/* 0x032 */ Vec3s targetScreenCoords; // screen coords corresponding to targetPos
/* 0x038 */ u16 perspNorm;
/* 0x03A */ char unk_3A[2];
/* 0x03C */ Vec3f lookAt_eye;
/* 0x048 */ Vec3f lookAt_obj;
/* 0x03C */ Vec3f lookAt_eye; // used to construct the view matrix
/* 0x048 */ Vec3f lookAt_obj; // used to construct the view matrix
/* 0x054 */ Vec3f lookAt_obj_target;
/* 0x060 */ Vec3f targetPos;
/* 0x060 */ Vec3f targetPos; // target for camera rig, often but not necessarily the player position
/* 0x06C */ f32 curYaw;
/* 0x070 */ f32 unk_70;
/* 0x074 */ f32 curBoomYaw;
/* 0x070 */ f32 interpYaw; // no camera mode actually uses this for interpolation
/* 0x074 */ f32 curBoomPitch;
/* 0x078 */ f32 curBoomLength;
/* 0x07C */ f32 curYOffset;
/* 0x07C */ f32 targetOffsetY;
/* 0x080 */ char unk_80[4];
/* 0x084 */ Vec3f trueRot;
/* 0x090 */ f32 curBlendedYawNegated;
/* 0x094 */ f32 curPitch;
/* 0x084 */ f32 curBoomYaw;
/* 0x088 */ f32 targetBoomYaw; // only used by CAM_UPDATE_UNUSED_RADIAL
/* 0x08C */ f32 unk_8C;
/* 0x090 */ f32 lookAt_yaw;
/* 0x094 */ f32 lookAt_pitch;
/* 0x098 */ f32 unk_98;
/* 0x09C */ f32 unk_9C;
/* 0x0A0 */ Vp vp;
/* 0x0B0 */ Vp vpAlt;
/* 0x0C0 */ s32 unk_C0;
/* 0x0C4 */ f32 unk_C4;
/* 0x0C8 */ char unk_C8[0xC];
/* 0x0D4 */ Matrix4f perspectiveMatrix;
/* 0x114 */ Matrix4f viewMtxPlayer; /* centers on player */
/* 0x154 */ Matrix4f viewMtxLeading; /* leads player slightly */
/* 0x194 */ Matrix4f viewMtxShaking; /* used while ShakeCam is active */
/* 0x0D4 */ Matrix4f mtxPerspective;
/* 0x114 */ Matrix4f mtxViewPlayer; // centers on player
/* 0x154 */ Matrix4f mtxViewLeading; // leads player slightly
/* 0x194 */ Matrix4f mtxViewShaking; // used while ShakeCam is active
/* 0x1D4 */ char unk_1D4[0x28];
/* 0x1FC */ void (*fpDoPreRender)(struct Camera*);
/* 0x200 */ void (*fpDoPostRender)(struct Camera*);
/* 0x204 */ Mtx* unkMatrix;
/* 0x204 */ Mtx* mtxBillboard; // rotation matrix created from -curBoomYaw
/* 0x208 */ s32 unk_208;
/* 0x20C */ Matrix4s* unkEffectMatrix;
/* 0x210 */ char unk_210[0x2];
/* 0x212 */ s16 unk_212;
/* 0x214 */ CameraUnk unk_214[4];
/* 0x444 */ CameraControlSettings* prevController;
/* 0x448 */ CameraControlSettings* curController;
/* 0x44C */ CamConfiguration prevConfiguration;
/* 0x468 */ CamConfiguration goalConfiguration;
/* 0x444 */ CameraControlSettings* prevSettings;
/* 0x448 */ CameraControlSettings* curSettings;
/* 0x44C */ CameraRig prevRig;
/* 0x468 */ CameraRig nextRig;
/* 0x484 */ f32 interpAlpha;
/* 0x488 */ f32 linearInterp;
/* 0x48C */ f32 linearInterpScale; /* 3.0? */
/* 0x48C */ f32 linearInterpRate;
/* 0x490 */ f32 moveSpeed;
/* 0x494 */ f32 yinterpGoal;
/* 0x498 */ f32 yinterpAlpha;
Expand All @@ -835,22 +869,22 @@ typedef struct Camera {
/* 0x4D8 */ CameraControlSettings controlSettings;
/* 0x504 */ u16 followPlayer;
/* 0x506 */ u16 panActive;
/* 0x508 */ f32 panPhase;
/* 0x508 */ f32 interpEasingParameter; // controls whether easing for camera rig interpolation is more cosine-like (values near 0) or quadratic (values near 1)
/* 0x50C */ f32 leadAmount;
/* 0x510 */ f32 targetLeadAmount;
/* 0x514 */ f32 leadInterpAlpha;
/* 0x518 */ f32 accumulatedStickLead;
/* 0x51C */ s32 increasingLeadInterp;
/* 0x520 */ f32 unk_520;
/* 0x524 */ f32 leadUnkX;
/* 0x528 */ f32 leadUnkZ;
/* 0x52C */ s32 unk_52C;
/* 0x530 */ s32 unk_530;
/* 0x534 */ CameraControlSettings* leadControlSettings;
/* 0x520 */ f32 leadAmtScale;
/* 0x524 */ f32 prevLeadPosX;
/* 0x528 */ f32 prevLeadPosZ;
/* 0x52C */ s32 leadConstrainDir;
/* 0x530 */ b32 needsInitialConstrainDir;
/* 0x534 */ CameraControlSettings* prevLeadSettings;
/* 0x538 */ char unk_538[0x18];
/* 0x550 */ f32 unk_550;
/* 0x554 */ s16 unk_554;
/* 0x556 */ s16 unk_556;
/* 0x550 */ f32 unusedLeadAmt;
/* 0x554 */ s16 unusedLeadCounter;
/* 0x556 */ s16 unusedLeadDir;
} Camera; // size = 0x558

typedef struct BattleStatus {
Expand Down Expand Up @@ -2007,7 +2041,7 @@ typedef struct PlayerStatus {
/* 0x06C */ f32 maxJumpSpeed;
/* 0x070 */ f32 gravityIntegrator[4]; // derivatives of y; 0 = velocity, 1 = accel, etc
/* 0x080 */ f32 targetYaw;
/* 0x084 */ f32 curYaw;
/* 0x084 */ f32 curYaw; // the direction of player input in world-space (not camera-relative)
/* 0x088 */ f32 overlapPushYaw;
/* 0x08C */ f32 pitch;
/* 0x090 */ f32 flipYaw[4];
Expand Down
31 changes: 17 additions & 14 deletions include/effects.h
Original file line number Diff line number Diff line change
Expand Up @@ -1269,24 +1269,27 @@ typedef struct SmallGoldSparkleFXData {
/* 0x20 */ s32 unk_20;
} SmallGoldSparkleFXData; // size = 0x24

typedef struct FlashingBoxShockwaveFXData {
/* 0x00 */ s32 unk_00;
enum ShockOverlayFXTypes {
FX_SHOCK_OVERLAY_SHOCK_HIT = 0,
FX_SHOCK_OVERLAY_LIGHTNING_WORLD = 1,
FX_SHOCK_OVERLAY_MEGA_SHOCK = 2,
FX_SHOCK_OVERLAY_LIGHTNING_BATTLE = 3,
};

typedef struct ShockOverlayFXData {
/* 0x00 */ s32 type;
/* 0x04 */ Vec3f pos;
/* 0x10 */ s32 unk_10;
/* 0x14 */ s32 unk_14;
/* 0x18 */ s32 unk_18;
/* 0x1C */ s32 unk_1C;
/* 0x20 */ s32 unk_20;
/* 0x1C */ s32 timeLeft;
/* 0x20 */ s32 lifetime;
/* 0x24 */ f32 unk_24;
/* 0x28 */ f32 unk_28;
/* 0x2C */ f32 unk_2C;
/* 0x30 */ s32 unk_30;
/* 0x34 */ s32 unk_34;
/* 0x38 */ s32 unk_38;
/* 0x3C */ s32 unk_3C;
/* 0x40 */ s32 unk_40;
/* 0x44 */ s32 unk_44;
} FlashingBoxShockwaveFXData; // size = 0x48
/* 0x28 */ f32 scaleX;
/* 0x2C */ f32 scaleY;
/* 0x30 */ Color3i primCol;
/* 0x3C */ Color3i envCol;
} ShockOverlayFXData; // size = 0x48

typedef struct BalloonFXData {
/* 0x00 */ s32 unk_00;
Expand Down Expand Up @@ -2542,7 +2545,7 @@ typedef union {
struct GatherMagicFXData* gatherMagic;
struct AttackResultTextFXData* attackResultText;
struct SmallGoldSparkleFXData* smallGoldSparkle;
struct FlashingBoxShockwaveFXData* flashingBoxShockwave;
struct ShockOverlayFXData* flashingBoxShockwave;
struct BalloonFXData* balloon;
struct FloatingRockFXData* floatingRock;
struct ChompDropFXData* chompDrop;
Expand Down
Loading
Loading