Skip to content

Commit

Permalink
d_camera work
Browse files Browse the repository at this point in the history
  • Loading branch information
randomsalience committed Oct 26, 2024
1 parent 606178d commit f7b6f4e
Show file tree
Hide file tree
Showing 29 changed files with 1,857 additions and 2,120 deletions.
18 changes: 14 additions & 4 deletions include/SSystem/SComponent/c_angle.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ struct cAngle {
/* Converts Radian value into Degree value */
static f32 r2d(f32 r) { return Radian_to_Degree(r); }

/* Converts Degree value into Radian value */
static f32 d2r(f32 d) { return Degree_to_Radian(d); }

/* Converts Degree value to s16 angle */
static s16 d2s(f32 d) { return Degree_to_SAngle(d); }

Expand Down Expand Up @@ -111,16 +114,23 @@ class cSPolar {
void Val(const cXyz&);
cXyz Xyz(void) const;
void Globe(class cSGlobe*) const;

void R(f32 i_radial) { mRadial = i_radial; }
void U(cSAngle const& i_angle) { mAngle2 = i_angle.Val(); }
void V(cSAngle const& i_angle) { mAngle1 = i_angle.Val(); }
};

class cSGlobe {
public:
float mRadius;
cSAngle mAzimuth; // original: V
cSAngle mInclination; // original: U
cSAngle mInclination; // original: V
cSAngle mAzimuth; // original: U

cSGlobe() {}

void R(f32 i_radius) { mRadius = i_radius; }
void U(cSAngle const& i_azimuth) { mAzimuth = i_azimuth.Val(); }

cSGlobe(const cSGlobe&);
cSGlobe(float, short, short);
cSGlobe(float, const cSAngle&, const cSAngle&);
Expand All @@ -132,8 +142,8 @@ class cSGlobe {
void Val(float, const cSAngle&, const cSAngle&);
void Val(const cXyz&);
float R(void) const { return mRadius; }
const cSAngle& V(void) const { return mAzimuth; }
const cSAngle& U(void) const { return mInclination; }
const cSAngle& V(void) const { return mInclination; }
const cSAngle& U(void) const { return mAzimuth; }
cXyz Xyz(void) const;
void Polar(cSPolar*) const;
cXyz Norm(void) const;
Expand Down
23 changes: 17 additions & 6 deletions include/SSystem/SComponent/c_bg_s_lin_chk.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,20 @@ class cBgS_LinChk : public cBgS_Chk, public cBgS_PolyInfo {
public:
/* 0x024 */ cM3dGLin mLin;
/* 0x040 */ cXyz field_0x40;
/* 0x04C */ u32 field_0x4c;
/* 0x04C */ u32 mStts;
/* 0x050 */ bool mPreWallChk;
/* 0x051 */ bool mPreGroundChk;
/* 0x052 */ bool mPreRoofChk;
/* 0x053 */ bool mFrontFlag;
/* 0x054 */ bool mBackFlag;

enum Status {
STTS_HIT = 0x10,
STTS_ROOF_OFF = 0x20000000,
STTS_WALL_OFF = 0x40000000,
STTS_GROUND_OFF = 0x80000000,
};

public:
cBgS_LinChk();
void ct();
Expand All @@ -25,9 +32,9 @@ class cBgS_LinChk : public cBgS_Chk, public cBgS_PolyInfo {

virtual ~cBgS_LinChk();

void ClrHit() { field_0x4c &= ~16; }
void SetHit() { field_0x4c |= 16; }
u32 ChkHit() const { return field_0x4c & 16; }
void ClrHit() { mStts &= ~STTS_HIT; }
void SetHit() { mStts |= STTS_HIT; }
u32 ChkHit() const { return mStts & STTS_HIT; }
void SetCross(const cXyz& pos) { mLin.SetEnd(pos); }
cXyz& i_GetCross() { return mLin.GetEnd(); }
cXyz* GetCrossP() { return &mLin.GetEndP(); }
Expand All @@ -40,8 +47,12 @@ class cBgS_LinChk : public cBgS_Chk, public cBgS_PolyInfo {
bool GetPreGroundChk() const { return mPreGroundChk; }
bool GetPreRoofChk() const { return mPreRoofChk; }
cXyz* GetStartP() { return &mLin.GetStartP(); }
void ClrSttsRoofOff() { field_0x4c &= ~0x20000000; }
void ClrSttsWallOff() { field_0x4c &= ~0x40000000; }
void ClrSttsRoofOff() { mStts &= ~STTS_ROOF_OFF; }
void SetSttsRoofOff() { mStts |= STTS_ROOF_OFF; }
void ClrSttsWallOff() { mStts &= ~STTS_WALL_OFF; }
void SetSttsWallOff() { mStts |= STTS_WALL_OFF; }
void ClrSttsGroundOff() { mStts &= ~STTS_GROUND_OFF; }
void SetSttsGroundOff() { mStts |= STTS_GROUND_OFF; }
};

#endif /* C_BG_S_LIN_CHK_H */
8 changes: 7 additions & 1 deletion include/d/actor/d_a_alink.h
Original file line number Diff line number Diff line change
Expand Up @@ -3082,7 +3082,7 @@ class daAlink_c : public daPy_py_c {
virtual BOOL checkHorseRideNotReady() const;
virtual bool checkArrowChargeEnd() const;
virtual f32 getSearchBallScale() const;
virtual s16 checkFastShotTime();
virtual int checkFastShotTime();
virtual bool checkNoEquipItem() const;
virtual bool checkKandelaarSwing(int) const;
virtual s16 getBoardCutTurnOffsetAngleY() const;
Expand Down Expand Up @@ -3334,6 +3334,12 @@ class daAlink_c : public daPy_py_c {
bool checkHorseGetOffMode() const { return mProcID == PROC_HORSE_GETOFF; }
bool checkHorseRideOn() const { return mProcID == PROC_HORSE_RIDE; }
bool checkGrabUp() const { return mProcID == PROC_GRAB_UP; }
bool checkSpinnerRideWait() const {
return mProcID == PROC_SPINNER_WAIT && mProcVar2.field_0x300c == 0;
}

fopAc_ac_c* getCopyRodActor() { return mCopyRodAcKeep.getActor(); }
fopAc_ac_c* getHookshotRoofWaitActor() { return mCargoCarryAcKeep.getActor(); }

BOOL checkRideOn() const { return mRideStatus != 0; }

Expand Down
12 changes: 9 additions & 3 deletions include/d/actor/d_a_midna.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class daMidna_c : public fopAc_ac_c {

enum daMidna_FLG0 {
FLG0_UNK_80000000 = 0x80000000,
FLG0_UNK_8000000 = 0x8000000,
FLG0_PORTAL_OBJ_CALL = 0x8000000,
FLG0_NPC_NEAR = 0x100000,
FLG0_NPC_FAR = 0x40000,
FLG0_UNK_20000 = 0x20000,
Expand Down Expand Up @@ -112,6 +112,7 @@ class daMidna_c : public fopAc_ac_c {
bool checkDemoTypeNone() const { return mDemoType == 0; }
void changeOriginalDemo() { mDemoType = 3; }
void changeDemoMode(u32 mode) { mDemoMode = mode; }
BOOL checkPortalObjCall() { return checkStateFlg0(FLG0_PORTAL_OBJ_CALL); }
BOOL checkNpcNear() { return checkStateFlg0(FLG0_NPC_NEAR); }
BOOL checkNpcFar() { return checkStateFlg0(FLG0_NPC_FAR); }
BOOL checkNoDraw() const { return checkStateFlg0(FLG0_NO_DRAW); }
Expand All @@ -137,7 +138,7 @@ class daMidna_c : public fopAc_ac_c {
}

void offTagWaitPos() {
offStateFlg0((daMidna_FLG0)(FLG0_UNK_80000000 | FLG0_UNK_8000000 | FLG0_UNK_400));
offStateFlg0((daMidna_FLG0)(FLG0_UNK_80000000 | FLG0_PORTAL_OBJ_CALL | FLG0_UNK_400));
}

void onTagNoHairLead() {
Expand Down Expand Up @@ -176,7 +177,7 @@ class daMidna_c : public fopAc_ac_c {


bool checkPortalObjRide() const {
return checkStateFlg0(FLG0_UNK_8000000) && checkStateFlg0(FLG0_UNK_200);
return checkStateFlg0(FLG0_PORTAL_OBJ_CALL) && checkStateFlg0(FLG0_UNK_200);
}

inline static BOOL checkMidnaRealBody();
Expand All @@ -191,6 +192,11 @@ class daMidna_c : public fopAc_ac_c {

void resetRatBody() {}

bool checkFlyWaitAnime() {
return field_0x5e4[0].getIdx() == 0x1CB || field_0x5e4[0].getIdx() == 0x1C7
|| field_0x5e4[0].getIdx() == 0x1C8 || field_0x5e4[0].getIdx() == 0x1C9;
}

static u8 const m_texDataTable[84];
static u8 const m_anmDataTable[636];

Expand Down
16 changes: 11 additions & 5 deletions include/d/actor/d_a_player.h
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ class daPy_py_c : public fopAc_ac_c {
FLG3_UNK_80000000 = 0x80000000,
FLG3_UNK_40000000 = 0x40000000,
FLG3_UNK_20000000 = 0x20000000,
FLG3_COPY_ROD_ATN_KEEP = 0x10000000,
FLG3_BOOMERANG_ATN_KEEP = 0x8000000,
FLG3_UNK_4000000 = 0x4000000,
FLG3_UNK_2000000 = 0x2000000,
FLG3_UNK_1000000 = 0x1000000,
Expand Down Expand Up @@ -445,6 +447,7 @@ class daPy_py_c : public fopAc_ac_c {
RFLG0_GRAB_UP_END = 0x20,
RFLG0_UNK_10 = 0x10,
RFLG0_UNK_8 = 0x8,
RFLG0_GRAB_THROW = 0x4,
RFLG0_UNK_2 = 0x2,
RFLG0_UNK_1 = 0x1,
};
Expand Down Expand Up @@ -595,8 +598,8 @@ class daPy_py_c : public fopAc_ac_c {
virtual MtxP getBottleMtx();
virtual BOOL checkPlayerGuard() const;
virtual u32 checkPlayerFly() const { return 0; }
virtual BOOL checkFrontRoll() const; // weak
virtual BOOL checkWolfDash() const; // weak
virtual BOOL checkFrontRoll() const { return FALSE; }
virtual BOOL checkWolfDash() const { return FALSE; }
virtual BOOL checkAutoJump() const;
virtual bool checkSideStep() const;
virtual bool checkWolfTriggerJump() const;
Expand Down Expand Up @@ -640,7 +643,7 @@ class daPy_py_c : public fopAc_ac_c {
virtual bool cancelWolfLock(fopAc_ac_c*);
virtual s32 getAtnActorID() const { return -1; }
virtual s32 getItemID() const;
virtual s32 getGrabActorID() const; // weak
virtual s32 getGrabActorID() const { return -1; }
virtual BOOL exchangeGrabActor(fopAc_ac_c*);
virtual BOOL setForceGrab(fopAc_ac_c*, int, int);
virtual void setForcePutPos(cXyz const&);
Expand All @@ -652,7 +655,7 @@ class daPy_py_c : public fopAc_ac_c {
virtual void setOutPower(f32, short, int);
virtual void setGrabCollisionOffset(f32, f32, cBgS_PolyInfo*);
virtual void onMagneGrab(f32, f32);
virtual void onFrollCrashFlg(u8, int); // weak
virtual void onFrollCrashFlg(u8, int) {}
virtual MtxP getModelJointMtx(u16);
virtual MtxP getHeadMtx();
virtual bool setHookshotCarryOffset(fpc_ProcID, cXyz const*);
Expand Down Expand Up @@ -684,7 +687,7 @@ class daPy_py_c : public fopAc_ac_c {
virtual BOOL checkHorseRideNotReady() const;
virtual bool checkArrowChargeEnd() const;
virtual f32 getSearchBallScale() const;
virtual s16 checkFastShotTime();
virtual int checkFastShotTime();
virtual bool checkNoEquipItem() const;
virtual bool checkFireMaterial() const;
virtual bool checkKandelaarSwing(int) const;
Expand Down Expand Up @@ -788,6 +791,7 @@ class daPy_py_c : public fopAc_ac_c {
BOOL checkHorseZelda() const { return checkNoResetFlg2(FLG2_HORSE_ZELDA); }
BOOL checkSpecialHorseRide() { return checkNoResetFlg2(daPy_FLG2(FLG2_HORSE_ZELDA | FLG2_UNK_1000000 | FLG2_UNK_800000)); }
BOOL checkBoardNoFootAngle() const { return checkResetFlg1(RFLG1_UNK_40); }
bool checkGrabThrow() const { return checkResetFlg0(RFLG0_GRAB_THROW); }

void onBossRoomWait() { onEndResetFlg0(ERFLG0_BOSS_ROOM_WAIT); }
void onBeeFollow() { onEndResetFlg0(ERFLG0_BEE_FOLLOW); }
Expand Down Expand Up @@ -875,6 +879,8 @@ class daPy_py_c : public fopAc_ac_c {
BOOL checkWolfGrowl() const { return checkResetFlg0(RFLG0_WOLF_GROWL); }
BOOL checkWolfThreat() const { return checkWolfGrowl(); }
BOOL checkWolfBark() const { return checkResetFlg0(RFLG0_WOLF_BARK); }
u32 checkBoomerangAtnKeep() const { return checkNoResetFlg3(FLG3_BOOMERANG_ATN_KEEP); }
u32 checkCopyRodAtnKeep() const { return checkNoResetFlg3(FLG3_COPY_ROD_ATN_KEEP); }

void onPlayerNoDraw() { onNoResetFlg0(FLG0_PLAYER_NO_DRAW); }
void offPlayerNoDraw() { offNoResetFlg0(FLG0_PLAYER_NO_DRAW); }
Expand Down
2 changes: 2 additions & 0 deletions include/d/d_attention.h
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ class dAttention_c {
void clrFlag(u32 flag) { mFlags &= ~flag; }
int GetActionCount() { return mActionCount; }
int GetLockonCount() { return mLockonCount; }
void LockSoundOn() { clrFlag(0x400000); }
void LockSoundOff() { setFlag(0x400000); }
bool Lockon() { return LockonTruth() || chkFlag(0x20000000); } // only matches with -O2?
int ZHintRequest(fopAc_ac_c* param_1, int param_2) {
return mZHintTarget.request(param_1, param_2);
Expand Down
5 changes: 3 additions & 2 deletions include/d/d_bg_s_grp_pass_chk.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@ class dBgS_GrpPassChk : public cBgS_GrpPassChk {

void OnWaterGrp() { mGrp |= WATER_GRP; }
void OnSpl() { mGrp |= WATER_GRP; }
void OffWaterGrp() { mGrp &= ~WATER_GRP; }
void OnNormalGrp() { mGrp |= NORMAL_GRP; }
void OffNormalGrp() { mGrp &= ~NORMAL_GRP; }
void OffFullGrp() { mGrp &= ~FULL_GRP; }
void OnAll() { mGrp |= FULL_GRP; }
u32 MaskNormalGrp() const {return mGrp & 1; }
u32 MaskWaterGrp() const {return mGrp & 2; }
u32 MaskNormalGrp() const {return mGrp & NORMAL_GRP; }
u32 MaskWaterGrp() const {return mGrp & WATER_GRP; }
private:
/* 0x4 */ u32 mGrp;
};
Expand Down
8 changes: 8 additions & 0 deletions include/d/d_bg_s_sph_chk.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ class dBgS_SphChk : public cM3dGSph, public cBgS_PolyInfo, public cBgS_Chk, publ
/* 80078A14 */ dBgS_SphChk();
/* 80078AC0 */ virtual ~dBgS_SphChk();

void SetCallback(SphChk_Callback i_callback) { mCallback = i_callback; }

/* 0x50 */ SphChk_Callback mCallback;
};

class dBgS_CamSphChk : public dBgS_SphChk {
public:
dBgS_CamSphChk() { SetCam(); }
/* 80165E74 */ virtual ~dBgS_CamSphChk() {}
};

#endif /* D_BG_D_BG_S_SPH_CHK_H */
15 changes: 13 additions & 2 deletions include/d/d_cam_param.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ class dCamBGChk_c {
/* 80088464 */ dCamBGChk_c();

f32 WallUpDistance() { return mWallUpDistance; }
f32 FwdDistance(s32 param_0) { return mChkInfo[param_0].mDistance; }
s16 FwdChkAngle(s32 param_0) { return cAngle::d2s(mChkInfo[param_0].mChkAngle); }
f32 FwdWeightH(s32 param_0) { return mChkInfo[param_0].mWeightH; }
f32 FwdWeightL(s32 param_0) { return mChkInfo[param_0].mWeightL; }
f32 FwdBackMargin() { return mFwdBackMargin; }
f32 FwdCushion() { return mFwdCushion; }

// name is a guess for now
struct ChkInfo {
Expand Down Expand Up @@ -79,7 +85,7 @@ class dCamParam_c {
/* 80182C74 */ void Arg0(u8);
/* 80182C7C */ void Fovy(u8);
/* 80182C58 */ void Fovy();
/* 80182CB4 */ void CheckFlag(u16);
/* 80182CB4 */ bool CheckFlag(u16 flag) { return mCurrentStyle->field_0x6 & flag; }
/* 80182CD0 */ void Val(s32, int);

/* 0x00 */ u8 mMapToolFovy;
Expand Down Expand Up @@ -108,7 +114,7 @@ class dCamSetup_c {
/* 80182BB8 */ void CheckFlag2(u16);
/* 80182BE8 */ void WaitRollSpeed();
/* 80182BF0 */ void WaitRollTimer();
/* 80182C1C */ void ThrowTimer();
/* 80182C1C */ // void ThrowTimer();
/* 80182C24 */ void ThrowCushion();
/* 80182C2C */ void ThrowVAngle();
/* 80182C34 */ void ThrowCtrAdjust();
Expand All @@ -120,6 +126,11 @@ class dCamSetup_c {
f32 ManualEndVal() { return mManualEndVal; }
f32 CinemaScopeTrimHeight() { return mTrimCineScopeHeight; }
f32 VistaTrimHeight() { return mTrimVistaHeight; }
f32 ForceLockOffTimer() { return mForceLockOffTimer; }
f32 ForceLockOffDist() { return mForceLockOffDist; }
int ThrowTimer() { return mThrowTimer; }
f32 USOValue() { return mFalseValue; }
f32 USOAngle() { return mFalseAngle; }

/* 0x000 */ f32 mDrawNear;
/* 0x004 */ f32 mDrawFar;
Expand Down
Loading

0 comments on commit f7b6f4e

Please sign in to comment.