summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/SSystem/SComponent/c_angle.h17
-rw-r--r--include/SSystem/SComponent/c_bg_s_chk.h2
-rw-r--r--include/d/d_bg_s_gnd_chk.h9
-rw-r--r--include/d/d_bg_s_lin_chk.h7
-rw-r--r--include/d/d_bg_s_poly_pass_chk.h36
-rw-r--r--include/d/d_bg_s_roof_chk.h4
-rw-r--r--include/d/d_bg_s_sph_chk.h15
-rw-r--r--include/d/d_cam_param.h135
-rw-r--r--include/d/d_camera.h459
-rw-r--r--include/d/d_cc_s.h7
-rw-r--r--include/d/d_com_inf_game.h164
-rw-r--r--include/d/d_demo.h10
-rw-r--r--include/d/d_drawlist.h8
-rw-r--r--include/d/d_event_manager.h3
-rw-r--r--include/d/d_spline_path.h5
-rw-r--r--include/d/d_stage.h64
-rw-r--r--include/f_ap/f_ap_game.h3
-rw-r--r--include/f_op/f_op_camera.h3
-rw-r--r--include/f_op/f_op_camera_mng.h84
-rw-r--r--include/m_Do/m_Do_audio.h12
-rw-r--r--include/m_Do/m_Do_graphic.h1
-rw-r--r--include/m_Do/m_Do_mtx.h4
-rw-r--r--src/d/d_camera.cpp2821
-rw-r--r--src/d/d_com_inf_game.cpp8
-rw-r--r--src/d/d_kankyo_rain.cpp2
-rw-r--r--src/d/d_ovlp_fade2.cpp2
-rw-r--r--src/d/d_s_name.cpp4
-rw-r--r--src/d/d_stage.cpp10
-rw-r--r--src/f_ap/f_ap_game.cpp2
-rw-r--r--src/f_op/f_op_camera_mng.cpp1
30 files changed, 3334 insertions, 568 deletions
diff --git a/include/SSystem/SComponent/c_angle.h b/include/SSystem/SComponent/c_angle.h
index d18cc735..b6910aaa 100644
--- a/include/SSystem/SComponent/c_angle.h
+++ b/include/SSystem/SComponent/c_angle.h
@@ -19,7 +19,7 @@ public:
cSAngle(s16);
cSAngle(float);
s16 Val() const { return mAngle; }
- // void Set(s16 angle) { this->mAngle = angle; }
+ //void Set(s16 angle) { this->mAngle = angle; }
void Val(const cSAngle&);
void Val(s16);
void Val(float);
@@ -65,9 +65,15 @@ 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); }
+ /* Converts s16 angle to Degree value */
+ static f32 s2d(s16 a) { return SAngle_to_Degree(a); }
+
template <typename T>
static T Adjust(T f1, T f2, T f3);
};
@@ -112,6 +118,10 @@ public:
void Val(const cXyz&);
cXyz Xyz() 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 {
@@ -135,6 +145,11 @@ public:
float R() const { return mRadius; }
const cSAngle& V() const { return mAzimuth; }
const cSAngle& U() const { return mInclination; }
+
+ void R(f32 i_radius) { mRadius = i_radius; }
+ void U(cSAngle const& i_azimuth) { mAzimuth = i_azimuth.Val(); }
+ void V(cSAngle const& i_inclination) { mInclination = i_inclination.Val(); }
+
cXyz Xyz() const;
void Polar(cSPolar*) const;
cXyz Norm() const;
diff --git a/include/SSystem/SComponent/c_bg_s_chk.h b/include/SSystem/SComponent/c_bg_s_chk.h
index 3a336589..f1008d35 100644
--- a/include/SSystem/SComponent/c_bg_s_chk.h
+++ b/include/SSystem/SComponent/c_bg_s_chk.h
@@ -23,7 +23,7 @@ public:
cBgS_Chk() {
mPolyPassChk = NULL;
mGrpPassChk = NULL;
- mSameActorChk = 1;
+ mSameActorChk = true;
}
void SetExtChk(cBgS_Chk& other) {
mPolyPassChk = other.mPolyPassChk;
diff --git a/include/d/d_bg_s_gnd_chk.h b/include/d/d_bg_s_gnd_chk.h
index c311a722..4e9f073c 100644
--- a/include/d/d_bg_s_gnd_chk.h
+++ b/include/d/d_bg_s_gnd_chk.h
@@ -67,16 +67,19 @@ public:
class dBgS_CamGndChk : public dBgS_GndChk {
public:
- dBgS_CamGndChk() { /* SetCam(); */ }
+ dBgS_CamGndChk() { SetCam(); }
virtual ~dBgS_CamGndChk() {}
};
class dBgS_CamGndChk_Wtr : public dBgS_CamGndChk {
public:
- dBgS_CamGndChk_Wtr();
+ dBgS_CamGndChk_Wtr() {
+ OffNormalGrp();
+ OnWaterGrp();
+ };
- virtual ~dBgS_CamGndChk_Wtr();
+ virtual ~dBgS_CamGndChk_Wtr() {}
};
#endif /* D_BG_D_BG_S_GND_CHK_H */
diff --git a/include/d/d_bg_s_lin_chk.h b/include/d/d_bg_s_lin_chk.h
index 498f0d4b..96ef100f 100644
--- a/include/d/d_bg_s_lin_chk.h
+++ b/include/d/d_bg_s_lin_chk.h
@@ -77,9 +77,12 @@ public:
class dBgS_CamLinChk_NorWtr : public dBgS_CamLinChk {
public:
- dBgS_CamLinChk_NorWtr();
+ dBgS_CamLinChk_NorWtr() {
+ OnWaterGrp();
+ OnNormalGrp();
+ }
- virtual ~dBgS_CamLinChk_NorWtr();
+ virtual ~dBgS_CamLinChk_NorWtr() {}
};
class dBgS_MirLightLinChk : public dBgS_LinChk {
diff --git a/include/d/d_bg_s_poly_pass_chk.h b/include/d/d_bg_s_poly_pass_chk.h
index 56e9533a..0e2d626c 100644
--- a/include/d/d_bg_s_poly_pass_chk.h
+++ b/include/d/d_bg_s_poly_pass_chk.h
@@ -7,25 +7,25 @@ class cBgS_PolyPassChk {
public:
virtual ~cBgS_PolyPassChk() {}
- /* 0x4 */ u8 mbObjThrough;
- /* 0x5 */ u8 mbCamThrough;
- /* 0x6 */ u8 mbLinkThrough;
- /* 0x7 */ u8 mbArrowThrough; // Also light
- /* 0x8 */ u8 mbBombThrough;
- /* 0x9 */ u8 mbBoomerangThrough;
- /* 0xA */ u8 mbRopeThrough; // Actually Hookshot?
+ /* 0x4 */ bool mbObjThrough;
+ /* 0x5 */ bool mbCamThrough;
+ /* 0x6 */ bool mbLinkThrough;
+ /* 0x7 */ bool mbArrowThrough; // Also light
+ /* 0x8 */ bool mbBombThrough;
+ /* 0x9 */ bool mbBoomerangThrough;
+ /* 0xA */ bool mbRopeThrough; // Actually Hookshot?
};
class dBgS_PolyPassChk : public cBgS_PolyPassChk {
public:
dBgS_PolyPassChk() {
- mbObjThrough = 0;
- mbCamThrough = 0;
- mbLinkThrough = 0;
- mbArrowThrough = 0;
- mbBombThrough = 0;
- mbBoomerangThrough = 0;
- mbRopeThrough = 0;
+ mbObjThrough = false;
+ mbCamThrough = false;
+ mbLinkThrough = false;
+ mbArrowThrough = false;
+ mbBombThrough = false;
+ mbBoomerangThrough = false;
+ mbRopeThrough = false;
}
virtual ~dBgS_PolyPassChk() {}
@@ -36,6 +36,14 @@ public:
void SetBomb() { mbBombThrough = true; }
void SetBoomerang() { mbBoomerangThrough = true; }
void SetRope() { mbRopeThrough = true; }
+
+ void ClrObj() { mbObjThrough = false; }
+ void ClrCam() { mbCamThrough = false; }
+ void ClrLink() { mbLinkThrough = false; }
+ void ClrArrow() { mbArrowThrough = false; }
+ void ClrBomb() { mbBombThrough = false; }
+ void ClrBoomerang() { mbBoomerangThrough = false; }
+ void ClrRope() { mbRopeThrough = false; }
void SetPassChkInfo(dBgS_PolyPassChk& other) {
*this = other;
diff --git a/include/d/d_bg_s_roof_chk.h b/include/d/d_bg_s_roof_chk.h
index 483800d4..fe44ce6d 100644
--- a/include/d/d_bg_s_roof_chk.h
+++ b/include/d/d_bg_s_roof_chk.h
@@ -21,7 +21,7 @@ public:
virtual ~dBgS_RoofChk() {}
- void SetPos(cXyz& pos) { m_pos = pos; }
+ void SetPos(cXyz &pos) { m_pos = pos; }
cXyz* GetPosP() { return &m_pos; }
f32 GetNowY() { return m_now_y; }
void SetNowY(f32 y) { m_now_y = y; }
@@ -40,4 +40,4 @@ public:
virtual ~dBgS_LinkRoofChk() {}
}; // Size: 0x4C
-#endif /* D_BG_D_BG_S_ROOF_CHK_H */ \ No newline at end of file
+#endif /* D_BG_D_BG_S_ROOF_CHK_H */
diff --git a/include/d/d_bg_s_sph_chk.h b/include/d/d_bg_s_sph_chk.h
index 3b6e25a2..376c14e4 100644
--- a/include/d/d_bg_s_sph_chk.h
+++ b/include/d/d_bg_s_sph_chk.h
@@ -8,7 +8,14 @@
class dBgS_SphChk : public cM3dGSph, public cBgS_PolyInfo, public cBgS_Chk, public dBgS_Chk {
public:
- dBgS_SphChk();
+ dBgS_SphChk() {
+ SetPolyPassChk(GetPolyPassChkInfo());
+ SetGrpPassChk(GetGrpPassChkInfo());
+ SetActorPid(fpcM_ERROR_PROCESS_ID_e);
+ Init();
+ SetCallback(NULL);
+ };
+
void Init() {
ClearPi();
}
@@ -22,4 +29,10 @@ public:
/* 0x4c */ SphChk_Callback mpCallback;
}; // Size: 0x50
+class dBgS_CamSphChk : public dBgS_SphChk {
+public:
+ dBgS_CamSphChk() { SetCam(); }
+ virtual ~dBgS_CamSphChk() {}
+};
+
#endif /* D_BG_D_BG_S_SPH_CHK_H */
diff --git a/include/d/d_cam_param.h b/include/d/d_cam_param.h
index ff8d5b8e..1d7e5959 100644
--- a/include/d/d_cam_param.h
+++ b/include/d/d_cam_param.h
@@ -6,7 +6,7 @@
struct dCamera__Style {
/* 0x00 */ u32 m00;
- /* 0x04 */ u32 m04;
+ /* 0x04 */ int engineIdx;
/* 0x08 */ u32 m08;
/* 0x0C */ u32 m0C;
/* 0x10 */ u32 m10;
@@ -57,25 +57,41 @@ class dCamBGChk_c {
public:
dCamBGChk_c();
+ // copied these from TP's implementation, may not be correct
+ 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; }
+ f32 GazeBackMargin() { return mGazeBackMargin; }
+ f32 WallCushion() { return mWallCushion; }
+ f32 WallBackCushion() { return mWallBackCushion; }
+ f32 CornerCushion() { return mCornerCushion; }
+ f32 CornerAngleMax() { return mCornerAngleMax; }
+ f32 FloorMargin() { return mFloorMargin; }
+
+ // name is a guess for now
+ struct ChkInfo {
+ /* 0x0 */ f32 mDistance;
+ /* 0x4 */ f32 mChkAngle;
+ /* 0x8 */ f32 mWeightH;
+ /* 0xC */ f32 mWeightL;
+ }; // Size: 0x10
+
public:
- /* 0x00 */ f32 m00;
- /* 0x04 */ f32 m04;
- /* 0x08 */ f32 m08;
- /* 0x0C */ f32 m0C;
- /* 0x10 */ f32 m10;
- /* 0x14 */ f32 m14;
- /* 0x18 */ f32 m18;
- /* 0x1C */ f32 m1C;
- /* 0x20 */ f32 m20;
- /* 0x24 */ f32 m24;
- /* 0x28 */ f32 m28;
+ /* 0x00 */ f32 mFloorMargin;
+ /* 0x04 */ ChkInfo mChkInfo[2];
+ /* 0x24 */ f32 mFwdBackMargin;
+ /* 0x28 */ f32 mFwdCushion;
/* 0x2C */ f32 m2C;
- /* 0x30 */ f32 m30;
- /* 0x34 */ f32 m34;
- /* 0x38 */ f32 m38;
- /* 0x3C */ f32 m3C;
- /* 0x40 */ f32 m40;
- /* 0x44 */ f32 m44;
+ /* 0x30 */ f32 mGazeBackMargin;
+ /* 0x34 */ f32 mCornerCushion;
+ /* 0x38 */ f32 mWallCushion;
+ /* 0x3C */ f32 mWallUpDistance;
+ /* 0x40 */ f32 mWallBackCushion;
+ /* 0x44 */ f32 mCornerAngleMax;
/* 0x48 */ f32 m48;
/* 0x4C */ f32 m4C;
/* 0x50 */ f32 m50;
@@ -86,57 +102,58 @@ public:
class dCamSetup_c {
public:
- /* 0x000 */ f32 m000;
- /* 0x004 */ f32 m004;
- /* 0x008 */ u16 m008;
- /* 0x00A */ u8 m00A[0x00C - 0x00A];
- /* 0x00C */ u32 m00C;
- /* 0x010 */ int m010;
- /* 0x014 */ u8 m014[0x01C - 0x014];
- /* 0x01C */ int m01C;
- /* 0x020 */ f32 m020;
+ /* 0x000 */ f32 mDrawNear;
+ /* 0x004 */ f32 mDrawFar;
+ /* 0x008 */ u16 mDebugFlags;
+ /* 0x00A */ u16 mFlags2;
+ /* 0x00C */ int m00C;
+ /* 0x010 */ int mModeSwitchType;
+ /* 0x014 */ void* mTypeTable;
+ /* 0x018 */ int mTypeNum;
+ /* 0x01C */ int mForceType;
+ /* 0x020 */ f32 mCusCus;
/* 0x024 */ f32 m024;
/* 0x028 */ f32 m028;
/* 0x02C */ f32 m02C;
/* 0x030 */ f32 m030;
/* 0x034 */ f32 m034;
- /* 0x038 */ f32 m038;
- /* 0x03C */ f32 m03C;
- /* 0x040 */ f32 m040;
+ /* 0x038 */ f32 mBaseCushion;
+ /* 0x03C */ f32 mJumpCushion;
+ /* 0x040 */ f32 mParallelDist;
/* 0x044 */ f32 m044;
/* 0x048 */ f32 m048;
- /* 0x04C */ f32 m04C;
+ /* 0x04C */ f32 mCurveWeight;
/* 0x050 */ f32 m050;
/* 0x054 */ f32 m054;
/* 0x058 */ f32 m058;
/* 0x05C */ f32 m05C;
/* 0x060 */ f32 m060;
- /* 0x064 */ f32 m064;
- /* 0x068 */ f32 m068;
+ /* 0x064 */ f32 mTrimVistaHeight;
+ /* 0x068 */ f32 mTrimCineScopeHeight;
/* 0x06C */ f32 m06C;
- /* 0x070 */ f32 m070;
- /* 0x074 */ u32 m074;
+ /* 0x070 */ f32 mForceLockOffDist;
+ /* 0x074 */ int mForceLockOffTimer;
/* 0x078 */ f32 m078;
/* 0x07C */ f32 m07C;
/* 0x080 */ f32 m080;
/* 0x084 */ f32 m084;
- /* 0x088 */ f32 m088;
- /* 0x08C */ f32 m08C;
- /* 0x090 */ u8 m090[0x094 - 0x090];
- /* 0x094 */ u32 m094;
+ /* 0x088 */ f32 mDMCValue;
+ /* 0x08C */ f32 mDMCAngle;
+ /* 0x090 */ f32 m090;
+ /* 0x094 */ int m094;
/* 0x098 */ f32 m098;
/* 0x09C */ f32 m09C;
/* 0x0A0 */ f32 m0A0;
/* 0x0A4 */ f32 m0A4;
- /* 0x0A8 */ u32 m0A8;
- /* 0x0AC */ f32 m0AC;
- /* 0x0B0 */ u32 m0B0;
- /* 0x0B4 */ f32 m0B4;
- /* 0x0B8 */ f32 m0B8;
- /* 0x0BC */ f32 m0BC;
+ /* 0x0A8 */ int m0A8;
+ /* 0x0AC */ f32 mChargeLatitude;
+ /* 0x0B0 */ int mChargeTimer;
+ /* 0x0B4 */ f32 mChargeBRatio;
+ /* 0x0B8 */ f32 mManualStartCThreshold;
+ /* 0x0BC */ f32 mManualEndVal;
/* 0x0C0 */ f32 m0C0;
- /* 0x0C4 */ f32 m0C4;
- /* 0x0C8 */ u32 m0C8;
+ /* 0x0C4 */ f32 mLockonChangeCushion;
+ /* 0x0C8 */ int mLockonChangeTimer;
public:
dCamSetup_c();
@@ -144,6 +161,27 @@ public:
bool CheckLatitudeRange(s16*);
f32 FanBank();
+ f32 PlayerHideDist();
+
+ bool CheckFlag2(u16 i_flag) { return (i_flag & mFlags2) != 0; }
+ f32 ChargeBRatio() { return mChargeBRatio; }
+ int ChargeTimer() { return mChargeTimer; }
+ f32 ChargeLatitude() { return mChargeLatitude; }
+
+ f32 ManualEndVal() { return mManualEndVal; }
+ f32 CinemaScopeTrimHeight() { return mTrimCineScopeHeight; }
+ f32 VistaTrimHeight() { return mTrimVistaHeight; }
+ f32 ForceLockOffTimer() { return mForceLockOffTimer; }
+ f32 ForceLockOffDist() { return mForceLockOffDist; }
+ f32 LockonChangeCushion() { return mLockonChangeCushion; }
+ int LockonChangeTimer() { return mLockonChangeTimer; }
+ f32 Cushion4Base() { return mBaseCushion; }
+ f32 Cushion4Jump() { return mJumpCushion; }
+ f32 CusCus() { return mCusCus; }
+ f32 ParallelDist() { return mParallelDist; }
+ f32 CurveWeight() { return mCurveWeight; }
+ f32 DMCAngle() { return mDMCAngle; }
+ f32 DMCValue() { return mDMCValue; }
public:
/* 0x0D0 */ dCstick_c mCstick;
@@ -175,6 +213,9 @@ public:
s16 LockonLatitude(f32);
f32 LockonFovy(f32);
f32 LockonCenterHeight(f32);
+ int Algorythmn(s32 i_style) { return mpStyle[i_style].engineIdx; }
+ int Algorythmn() { return mpStyle->engineIdx; }
+ bool CheckFlag(u16 flag) { return mpStyle->flag & flag; }
};
class dCamMath {
diff --git a/include/d/d_camera.h b/include/d/d_camera.h
index 6d9c208c..6660b2ba 100644
--- a/include/d/d_camera.h
+++ b/include/d/d_camera.h
@@ -2,15 +2,20 @@
#define D_CAMERA_H
#include "SSystem/SComponent/c_angle.h"
-#include "SSystem/SComponent/c_rnd.h"
#include "SSystem/SComponent/c_sxyz.h"
#include "SSystem/SComponent/c_xyz.h"
#include "f_pc/f_pc_base.h"
#include "d/d_cam_param.h"
+#include "d/d_bg_s_gnd_chk.h"
+#include "d/d_com_inf_game.h"
+#include "d/d_spline_path.h"
#include "global.h"
class camera_class;
+class camera_process_class;
class dBgS_LinChk;
+class dBgS_CamGndChk;
+class d2DBSplinePath;
class dStage_Event_dt_c;
class fopAc_ac_c;
@@ -33,50 +38,110 @@ struct dCamera__EventParam {
/* 0x10 */ int mValue;
};
-class d2DBSplinePath {
-public:
- ~d2DBSplinePath() {}
- /* 0x00 */ int mKeyframeCur;
- /* 0x04 */ int mTimer;
- /* 0x08 */ int mKeyframeNum;
- /* 0x0C */ int mState;
- /* 0x10 */ int m10;
- /* 0x14 */ int mKeyframeLast;
- /* 0x18 */ u8 m18[0x1C - 0x18];
- /* 0x1C */ f32 mTime;
- /* 0x20 */ u8 m20[0x24 - 0x20];
- /* 0x24 */ f32 mFrameWeight[3];
- /* 0x30 */ int mFrameIdx[3];
- /* 0x3C */ u8 m3C[0x40 - 0x3C];
- /* 0x40 */ void* vtbl;
+struct dCamera__Type {
+ /* 0x00 */ char name[24];
+ /* 0x18 */ s16 mStyles[2][10];
+}; // Size: 0x40
+
+struct dCamera_event_data {
+ /* 0x000 */ u8 field_0x00;
+ /* 0x001 */ u8 field_0x01[0x04 - 0x01];
+ /* 0x004 */ int field_0x04;
+ /* 0x008 */ int field_0x08;
+ /* 0x00C */ int field_0x0c;
+ /* 0x010 */ u8 field_0x10;
+ /* 0x011 */ u8 field_0x11[0x14 - 0x11];
+ /* 0x014 */ int field_0x14;
+ /* 0x018 */ int field_0x18;
+ /* 0x01C */ int field_0x1c;
+ /* 0x020 */ int field_0x20;
+ /* 0x024 */ int field_0x24;
+ /* 0x028 */ u8 field_0x28[0x2C - 0x28];
+ /* 0x02C */ dCamera__EventParam mEventParams[8];
+ /* 0x0EC */ dStage_Event_dt_c* field_0xec;
+ /* 0x0F0 */ d2DBSplinePath mSpline2DPath;
+}; // Size: 0x124
+
+struct camSphChkdata {
+ camSphChkdata(cXyz* i_center, f32 i_radius) {
+ field_0x0 = i_center;
+ field_0x8 = *i_center;
+ field_0x4 = i_radius;
+ }
+
+ ~camSphChkdata(){}
+ /* 0x00 */ cXyz* field_0x0;
+ /* 0x04 */ f32 field_0x4;
+ /* 0x08 */ cXyz field_0x8;
+ /* 0x14 */ cXyz field_0x14;
+};
+
+class dCamera_monitoring_things {
+ public:
+ dCamera_monitoring_things(){}
+ ~dCamera_monitoring_things(){}
+
+ /* 0x00 */ cXyz mPos;
+ /* 0x0C */ cXyz field_0x0C;
+ /* 0x10 */ int field_0x10;
+ /* 0x14 */ f32 field_0x14;
+};
+
+class dCamera_DMC_system {
+ public:
+ dCamera_DMC_system(){}
+ ~dCamera_DMC_system(){}
+
+ /* 0x0 */ u8 field_0x0;
+ /* 0x1 */ u8 field_0x1;
+ /* 0x2 */ cSAngle field_0x2;
+ /* 0x4 */ cSAngle field_0x4;
};
class dCamForcusLine {
public:
+ dCamForcusLine() { mEffectLine.initRnd(100, 100, 100); }
void Init();
void Draw();
- void Off();
+ bool Off();
- /* 0x00 */ void* vtbl;
- /* 0x04 */ cM_rnd_c mRnd;
- /* 0x10 */ u8 field_10[0x70 - 0x10];
+ /* 0x00 */ dDlst_effectLine_c mEffectLine;
+ /* 0x38 */ cXyz m38;
+ /* 0x44 */ GXColor m44;
+ /* 0x48 */ u8 m48;
+ /* 0x49 */ u8 m49;
+ /* 0x4C */ int m4C;
+ /* 0x50 */ int m50;
+ /* 0x54 */ int m54;
+ /* 0x58 */ u16 m58;
+ /* 0x5A */ u16 m5A;
+ /* 0x5C */ u16 m5C;
+ /* 0x5E */ u16 m5E;
+ /* 0x60 */ f32 m60;
+ /* 0x64 */ f32 m64;
+ /* 0x68 */ f32 m68;
+ /* 0x6C */ f32 m6C;
};
+class dCamera_c;
+typedef bool (dCamera_c::*engine_fn)(s32);
+
class dCamera_c {
public:
struct BG {
BG() {}
~BG() {}
- u8 temp[0xB0];
+ /* 0x00 */ u8 m00[0x04 - 0x00];
+ /* 0x04 */ dBgS_CamGndChk m04; // dBgS_CamGndChk might be too large by 4 bytes
+ /* 0x58 */ f32 m58;
+ /* 0x5C */ dBgS_CamGndChk m5C; // This offset is wrong, needs to be at 0x60
};
/* 0x000 */ camera_class* mpCamera;
/* 0x004 */ u8 m004;
/* 0x005 */ u8 m005;
- /* 0x006 */ u8 m006[0x008 - 0x006];
- /* 0x008 */ f32 m008;
- /* 0x00C */ s16 m00C;
- /* 0x00E */ cSAngle m00E;
+ /* 0x006 */ cSAngle m006;
+ /* 0x008 */ cSGlobe mDirection;
/* 0x010 */ cXyz mCenter;
/* 0x01C */ cXyz mEye;
/* 0x028 */ cXyz mUp;
@@ -86,25 +151,42 @@ public:
/* 0x03C */ cSGlobe m03C;
/* 0x044 */ cXyz m044;
/* 0x050 */ cXyz m050;
- /* 0x05C */ s16 m05C;
+ /* 0x05C */ cSAngle m05C;
/* 0x05E */ u8 m05E[0x060 - 0x05E];
/* 0x060 */ f32 m060;
- /* 0x064 */ u8 m064[0x068 - 0x064];
+ /* 0x064 */ f32 m064;
/* 0x068 */ int m068;
/* 0x06C */ cSAngle mAngleY;
- /* 0x06E */ u8 m06E[0x080 - 0x06E];
+ /* 0x06E */ u8 m06E[0x070 - 0x06E];
+ /* 0x070 */ cXyz m070;
+ /* 0x07C */ u32 m07C;
/* 0x080 */ u32 m080;
/* 0x084 */ cXyz m084;
/* 0x090 */ cXyz m090;
/* 0x09C */ f32 m09C;
- /* 0x0A0 */ f32 m0A0;
- // /* 0x0A4 */ @class$4017d_camera_cpp m0A4[2];
- /* 0x0A4 */ u8 m0A4[0x40];
+ /* 0x0A0 */ cSAngle m0A0;
+ /* 0x0A2 */ u8 m0A2[0x0A4 - 0x0A2];
+ struct {
+ struct {
+ /* 0x00 */ cXyz m00;
+ /* 0x0C */ int m0C;
+ /* 0x10 */ int m10;
+ /* 0x14 */ int m14;
+ /* 0x18 */ int m18;
+ /* 0x1C */ int m1C;
+ } field_0x00;
+ }
+ /* 0x0A4 */ m0A4[2];
/* 0x0E4 */ int mStageMapToolCameraIdx;
/* 0x0E8 */ int m0E8;
- /* 0x0EC */ u8 m0EC[0x108 - 0x0EC];
+ /* 0x0EC */ cXyz mExtendedPos;
+ /* 0x0F8 */ u8 m0F8[0x100 - 0x0F8];
+ /* 0x100 */ u8 m100;
+ /* 0x101 */ u8 m101;
+ /* 0x102 */ u8 m102;
+ /* 0x103 */ u8 m103[0x108 - 0x103];
/* 0x108 */ int m108;
- /* 0x10C */ u8 m10C[0x110 - 0x10C];
+ /* 0x10C */ int m10C;
/* 0x110 */ u8 m110;
/* 0x111 */ u8 m111[0x114 - 0x111];
/* 0x114 */ int m114;
@@ -114,9 +196,9 @@ public:
/* 0x124 */ int mPadId;
/* 0x128 */ fopAc_ac_c* mpPlayerActor;
/* 0x12C */ fopAc_ac_c* mpLockonTarget;
- /* 0x130 */ int m130;
- /* 0x134 */ u8 m134[0x138 - 0x134];
- /* 0x138 */ int m138;
+ /* 0x130 */ fpc_ProcID mLockOnActorId;
+ /* 0x134 */ fopAc_ac_c* mpLockonActor;
+ /* 0x138 */ int mForceLockTimer;
/* 0x13C */ int mCurMode;
/* 0x140 */ int mNextMode;
/* 0x144 */ int m144;
@@ -136,47 +218,59 @@ public:
/* 0x178 */ f32 mStickCPosXDelta;
/* 0x17C */ f32 mStickCPosYDelta;
/* 0x180 */ f32 mStickCValueDelta;
- /* 0x184 */ u8 m184[0x190 - 0x184];
+ /* 0x184 */ int m184;
+ /* 0x188 */ u32 m188;
+ /* 0x18C */ u32 m18C;
/* 0x190 */ f32 mTriggerLeftLast;
/* 0x194 */ f32 mTriggerLeftDelta;
- /* 0x198 */ u8 m198;
- /* 0x199 */ u8 m199;
+ /* 0x198 */ u8 mHoldLockL;
+ /* 0x199 */ u8 mTrigLockL;
/* 0x19A */ u8 m19A;
/* 0x19B */ u8 m19B;
/* 0x19C */ f32 mTriggerRightLast;
/* 0x1A0 */ f32 mTriggerRightDelta;
- /* 0x1A4 */ u8 m1A4;
- /* 0x1A5 */ u8 m1A5;
+ /* 0x1A4 */ u8 mHoldLockR;
+ /* 0x1A5 */ u8 mTrigLockR;
/* 0x1A6 */ u8 m1A6;
/* 0x1A7 */ u8 m1A7;
- /* 0x1A8 */ u8 m1A8;
- /* 0x1A9 */ u8 m1A9;
- /* 0x1AA */ u8 m1AA;
- /* 0x1AB */ u8 m1AB;
- /* 0x1AC */ u8 m1AC;
- /* 0x1AD */ u8 m1AD;
+ /* 0x1A8 */ u8 mHoldX;
+ /* 0x1A9 */ u8 mTrigX;
+ /* 0x1AA */ u8 mHoldY;
+ /* 0x1AB */ u8 mTrigY;
+ /* 0x1AC */ u8 mHoldZ;
+ /* 0x1AD */ u8 mTrigZ;
/* 0x1AE */ u8 m1AE;
- /* 0x1AF */ u8 m1AF[0x1B0 - 0x1AF];
+ /* 0x1AF */ u8 m1AF;
/* 0x1B0 */ dCamForcusLine mForcusLine;
- /* 0x220 */ u8 m220[0x228 - 0x220];
- /* 0x228 */ cXyz mMonitorPos;
- /* 0x234 */ f32 m234;
- /* 0x238 */ f32 m238;
- /* 0x23C */ f32 m23C;
- /* 0x240 */ int m240;
- /* 0x244 */ f32 m244;
- /* 0x248 */ u8 m248[0x254 - 0x248];
+ /* 0x220 */ dCamera_DMC_system mDMCSystem;
+ /* 0x226 */ u8 m226[0x228 - 0x226];
+ /* 0x228 */ dCamera_monitoring_things mMonitoringThings;
+ /* 0x248 */ int m248[3];
/* 0x254 */ int m254;
- /* 0x258 */ u8 m258[0x25C - 0x258];
+ /* 0x258 */ int m258;
/* 0x25C */ BG mBG;
- /* 0x30C */ u8 m30C[0x31D - 0x30C];
+ /* 0x30C */ int m30C;
+ /* 0x310 */ f32 m310;
+ /* 0x314 */ int m314;
+ /* 0x318 */ f32 m318;
+ /* 0x31C */ u8 m31C;
/* 0x31D */ u8 m31D;
- /* 0x31E */ u8 m31E[0x350 - 0x31E];
+ /* 0x31E */ u8 m31E[0x320 - 0x31E];
+ /* 0x320 */ cXyz m320;
+ /* 0x32C */ cXyz m32C;
+ /* 0x338 */ cSAngle m338;
+ /* 0x33A */ cSAngle m33A;
+ /* 0x33C */ fopAc_ac_c* m33C;
+ /* 0x340 */ u8 m340[0x350 - 0x340];
/* 0x350 */ int m350;
- /* 0x354 */ u8 m354[0x358 - 0x354];
+ /* 0x354 */ f32 m354;
/* 0x358 */ int mRoomNo;
/* 0x35C */ int mRoomMapToolCameraIdx;
- /* 0x360 */ u8 m360[0x394 - 0x360];
+ /* 0x360 */ u8 m360;
+ /* 0x361 */ u8 m361[0x364 - 0x361];
+ /* 0x364 */ u32 m364;
+ /* 0x368 */ f32 m368;
+ /* 0x36C */ u8 m36C[0x394 - 0x36C];
/* 0x394 */ f32 mEvFovy;
/* 0x398 */ f32 mEvBank;
/* 0x39C */ fopAc_ac_c* mpEvRelActor;
@@ -185,18 +279,8 @@ public:
/* 0x3A8 */ u8 m3A8;
/* 0x3A9 */ u8 m3A9[0x3AC - 0x3A9];
/* 0x3AC */ cXyz mEvBasePos;
- /* 0x3B8 */ u8 m3B8[0x3FC - 0x3B8];
- /* 0x3FC */ int mStaffIdx;
- /* 0x400 */ int m400;
- /* 0x404 */ int m404;
- /* 0x408 */ u8 m408;
- /* 0x409 */ u8 m409[0x40C - 0x409];
- /* 0x40C */ int m40C;
- /* 0x410 */ int m410;
- /* 0x414 */ u8 m414[0x424 - 0x414];
- /* 0x424 */ dCamera__EventParam mEventParams[8];
- /* 0x4C4 */ dStage_Event_dt_c* m4C4;
- /* 0x4C8 */ d2DBSplinePath mSpline2DPath;
+ /* 0x3B8 */ u8 m3B8[0x3F8 - 0x3B8];
+ /* 0x3F8 */ dCamera_event_data mEventData;
/* 0x50C */ u32 mEventFlags;
/* 0x510 */ int mCurStyle;
/* 0x514 */ int m514;
@@ -204,21 +288,27 @@ public:
/* 0x51C */ int mNextType;
/* 0x520 */ int mMapToolType;
/* 0x524 */ int m524;
- /* 0x528 */ int m528;
+ /* 0x528 */ fopAc_ac_c* m528;
/* 0x52C */ u8 m52C[0x530 - 0x52C];
/* 0x530 */ int m530;
/* 0x534 */ s16 m534;
/* 0x536 */ s16 m536;
- /* 0x538 */ u8 m538[0x550 - 0x538];
+ /* 0x538 */ f32 m538;
+ /* 0x53C */ f32 m53C;
+ /* 0x540 */ f32 m540;
+ /* 0x544 */ u8 m544[0x550 - 0x544];
/* 0x550 */ int m550;
/* 0x554 */ int m554;
/* 0x558 */ u8 m558[0x568 - 0x558];
/* 0x568 */ cXyz mCenterShake;
/* 0x574 */ cXyz mEyeShake;
/* 0x580 */ f32 mFovYShake;
- /* 0x584 */ u8 m584[0x590 - 0x584];
+ /* 0x584 */ u8 m584[0x588 - 0x584];
+ /* 0x588 */ int m588;
+ /* 0x58C */ int m58C;
/* 0x590 */ int mBlureTimer;
- /* 0x594 */ u8 m594[0x59C - 0x594];
+ /* 0x594 */ csXyz m594;
+ /* 0x59A */ s16 m59A;
/* 0x59C */ int mBlurePositionType;
/* 0x5A0 */ cXyz mBlurePosition;
/* 0x5AC */ cXyz mBlureScale;
@@ -227,26 +317,38 @@ public:
/* 0x5C0 */ stage_camera__entry mCurRoomCamEntry;
/* 0x5D4 */ stage_arrow__entry mCurRoomArrowEntry;
/* 0x5E8 */ int mCurArrowIdx;
- /* 0x5EC */ f32 m5EC;
- /* 0x5F0 */ f32 m5F0;
- /* 0x5F4 */ u8 m5F4[0x5F8 - 0x5F4];
- /* 0x5F8 */ f32 m5F8;
- /* 0x5FC */ int m5FC;
- /* 0x600 */ u8 m600[0x604 - 0x600];
- /* 0x604 */ f32 m604;
- /* 0x608 */ u8 m608[0x60C - 0x608];
+ /* 0x5EC */ f32 mWindowWidth;
+ /* 0x5F0 */ f32 mWindowHeight;
+ /* 0x5F4 */ f32 m5F4;
+ /* 0x5F8 */ f32 mTrimHeight;
+ /* 0x5FC */ int mTrimSize;
+ /* 0x600 */ int mTrimTypeForce;
+ /* 0x604 */ f32 mWindowAspectRatio;
+ /* 0x608 */ f32 m608;
/* 0x60C */ dCamSetup_c mCamSetup;
/* 0x750 */ dCamParam_c mCamParam;
/* 0x75C */ int mCamTypeField;
/* 0x760 */ int mCamTypeEvent;
/* 0x764 */ int mCamTypeWater;
- /* 0x768 */ int mCamTypeSubject;
+ /* 0x768 */ int m768;
/* 0x76C */ int mCamTypeBoat;
/* 0x770 */ int mCamTypeBoatBattle;
- /* 0x774 */ int m774;
+ /* 0x774 */ int mCamTypeSubject;
/* 0x778 */ int mCamTypeKeep;
/* 0x77C */ int mCamTypeRestrict;
- /* 0x780 */ u8 field_780[0x800 - 0x780];
+ /* 0x780 */ u8 m780;
+ /* 0x781 */ u8 m781;
+ /* 0x782 */ u8 m782;
+ /* 0x783 */ u8 m783;
+ /* 0x784 */ u8 m784;
+ /* 0x785 */ u8 m785;
+ /* 0x786 */ u8 m786;
+ /* 0x787 */ u8 m787;
+ /* 0x788 */ u8 m788;
+ /* 0x789 */ u8 m789;
+ /* 0x78A */ u8 m78A;
+ /* 0x78B */ u8 m78B;
+ /* 0x78C */ u8 m78C[0x800 - 0x78C];;
public:
dCamera_c(camera_class*);
@@ -255,93 +357,99 @@ public:
void Start();
void Stop();
void Stay();
- void ChangeModeOK(s32);
+ bool ChangeModeOK(s32);
void initPad();
void updatePad();
void initMonitor();
void updateMonitor();
- void calcPeepAngle();
+ cSAngle calcPeepAngle();
void Att();
- void checkForceLockTarget();
- void Run();
- void NotRun();
- void SetTrimSize(s32);
- void SetTrimTypeForce(s32);
+ void SetWindow(f32 window_width, f32 window_height) {
+ mWindowWidth = window_width;
+ mWindowHeight = window_height;
+ mWindowAspectRatio = window_width / window_height;
+ }
+ bool checkForceLockTarget();
+ bool Run();
+ bool NotRun();
+ bool SetTrimSize(s32);
+ bool SetTrimTypeForce(s32);
void CalcTrimSize();
- void Draw();
- void nextMode(s32);
- void onModeChange(s32, s32);
- void nextType(s32);
- void onTypeChange(s32, s32);
+ bool Draw();
+ int nextMode(s32);
+ bool onModeChange(s32, s32);
+ int nextType(s32);
+ bool onTypeChange(s32, s32);
void SetTypeForce(char*, fopAc_ac_c*);
- void SetTypeForce(s32, fopAc_ac_c*);
- void onStyleChange(s32, s32);
- void GetCameraTypeFromMapToolID(s32, s32);
- void GetCameraTypeFromCameraName(const char*);
+ bool SetTypeForce(s32, fopAc_ac_c*);
+ bool onStyleChange(s32, s32);
+ int GetCameraTypeFromMapToolID(s32, s32);
+ int GetCameraTypeFromCameraName(const char*);
void pushPos();
- void directionOf(fopAc_ac_c*);
- void positionOf(fopAc_ac_c*);
- void attentionPos(fopAc_ac_c*);
- void relationalPos(fopAc_ac_c*, cXyz*);
- void relationalPos(fopAc_ac_c*, cXyz*, cSAngle);
- void relationalPos(fopAc_ac_c*, fopAc_ac_c*, cXyz*, f32);
+ cSAngle directionOf(fopAc_ac_c*);
+ cXyz positionOf(fopAc_ac_c*);
+ cXyz attentionPos(fopAc_ac_c*);
+ cXyz relationalPos(fopAc_ac_c*, cXyz*);
+ cXyz relationalPos(fopAc_ac_c*, cXyz*, cSAngle);
+ cXyz relationalPos(fopAc_ac_c*, fopAc_ac_c*, cXyz*, f32);
void setDMCAngle();
- void getDMCAngle(cSAngle);
- void pointInSight(cXyz*);
- void radiusActorInSight(fopAc_ac_c*, fopAc_ac_c*);
- void radiusActorInSight(fopAc_ac_c*, fopAc_ac_c*, cXyz*, cXyz*, f32, s16);
- void groundHeight(cXyz*);
- void lineBGCheck(cXyz*, cXyz*, dBgS_LinChk*, u32);
- void lineBGCheck(cXyz*, cXyz*, cXyz*, u32);
- void lineBGCheck(cXyz*, cXyz*, u32);
- void lineBGCheckBack(cXyz*, cXyz*, u32);
- void lineBGCheckBoth(cXyz*, cXyz*, dBgS_LinChk*, u32);
- void lineCollisionCheckBush(cXyz*, cXyz*);
- void compWallMargin(cXyz*, f32);
- void defaultTriming();
+ cSAngle getDMCAngle(cSAngle);
+ bool pointInSight(cXyz*);
+ f32 radiusActorInSight(fopAc_ac_c*, fopAc_ac_c*);
+ f32 radiusActorInSight(fopAc_ac_c*, fopAc_ac_c*, cXyz*, cXyz*, f32, s16);
+ f32 groundHeight(cXyz*);
+ bool lineBGCheck(cXyz*, cXyz*, dBgS_LinChk*, u32);
+ bool lineBGCheck(cXyz*, cXyz*, cXyz*, u32);
+ bool lineBGCheck(cXyz*, cXyz*, u32);
+ bool lineBGCheckBack(cXyz*, cXyz*, u32);
+ bool lineBGCheckBoth(cXyz*, cXyz*, dBgS_LinChk*, u32);
+ BOOL lineCollisionCheckBush(cXyz*, cXyz*);
+ cXyz compWallMargin(cXyz*, f32);
+ int defaultTriming();
void setView(f32, f32, f32, f32);
- void forwardCheckAngle();
+ cSAngle forwardCheckAngle();
void bumpCheck(u32);
- void getWaterSurfaceHeight(cXyz*);
+ f32 getWaterSurfaceHeight(cXyz*);
void checkSpecialArea();
void checkGroundInfo();
- void followCamera2(s32);
- void followCamera(s32);
- void eyePos(fopAc_ac_c*);
- void heightOf(fopAc_ac_c*);
- void lockonCamera(s32);
- void getMsgCmdSpeaker();
- void getMsgCmdCut();
- void talktoCamera(s32);
+ bool followCamera2(s32);
+ bool followCamera(s32);
+ cXyz eyePos(fopAc_ac_c*);
+ f32 heightOf(fopAc_ac_c*);
+ bool lockonCamera(s32);
+ fopAc_ac_c* getMsgCmdSpeaker();
+ int getMsgCmdCut();
+ bool talktoCamera(s32);
void CalcSubjectAngle(s16*, s16*);
- void subjectCamera(s32);
- void towerCamera(s32);
- void crawlCamera(s32);
- void hookshotCamera(s32);
- void tornadoCamera(s32);
- void rideCamera(s32);
- void hungCamera(s32);
- void vomitCamera(s32);
- void shieldCamera(s32);
- void manualCamera(s32);
- void nonOwnerCamera(s32);
- void fixedFrameCamera(s32);
- void fixedPositionCamera(s32);
- void eventCamera(s32);
- void demoCamera(s32);
- void letCamera(s32);
- void Set(cXyz, cXyz);
- void Set(cXyz, cXyz, f32, s16);
- void Set(cXyz, cXyz, s16, f32);
- void Reset(cXyz, cXyz, f32, s16);
- void Reset(cXyz, cXyz);
- void Reset();
+ bool subjectCamera(s32);
+ bool towerCamera(s32);
+ bool crawlCamera(s32);
+ bool hookshotCamera(s32);
+ bool tornadoCamera(s32);
+ bool rideCamera(s32);
+ bool hungCamera(s32);
+ bool vomitCamera(s32);
+ bool shieldCamera(s32);
+ bool manualCamera(s32);
+ bool nonOwnerCamera(s32);
+ bool fixedFrameCamera(s32);
+ bool fixedPositionCamera(s32);
+ bool eventCamera(s32);
+ bool demoCamera(s32);
+ bool letCamera(s32);
+ bool Set(cXyz, cXyz);
+ bool Set(cXyz, cXyz, f32, s16);
+ bool Set(cXyz, cXyz, s16, f32);
+ bool Reset(cXyz, cXyz, f32, s16);
+ bool Reset(cXyz, cXyz);
+ bool Reset();
void ResetView();
- void Chtyp(s32);
- void U2();
+ bool Chtyp(s32);
+ s16 U2();
+ //void U2(s16 i_val) { mAngleY = cSAngle(i_val); }
void shakeCamera();
void StartShake(s32, u8*, s32, cXyz);
- void StopShake();
+ bool StopShake();
void ResetBlure(int);
void SetBlureAlpha(f32);
void SetBlureScale(f32, f32, f32);
@@ -349,16 +457,17 @@ public:
void SetBlurePosition(f32, f32, f32);
void SetBlurePositionType(int);
void SetBlureTimer(s32);
- void SubjectLockOn(fopAc_ac_c*);
- void SubjectLockOff();
- void GetForceLockOnActor();
- void ForceLockOn(fpc_ProcID);
- void ForceLockOff(fpc_ProcID);
- void SetExtendedPosition(cXyz*);
- void ScopeViewMsgModeOff();
+ bool SubjectLockOn(fopAc_ac_c*);
+ bool SubjectLockOff();
+ fopAc_ac_c* GetForceLockOnActor();
+ bool ForceLockOn(fpc_ProcID);
+ bool ForceLockOff(fpc_ProcID);
+ bool SetExtendedPosition(cXyz*);
+ bool ScopeViewMsgModeOff();
- void Bank() {}
- void Up() {}
+ f32 Fovy() { return mFovY + mFovYShake; }
+ cSAngle Bank() {}
+ cXyz Up() {}
cXyz Center() { return mCenter + mCenterShake; }
void StartEventCamera(int, int, ...);
@@ -401,22 +510,26 @@ public:
void bSplineEvCamera();
void twoActor0EvCamera();
+ void Pause() { if (g_dComIfG_gameInfo.play.mDemo->getObject()->getActiveCamera()) ResetView(); }
+ void Active() { if (m004 && !m005) Run(); else NotRun(); }
void CStickUse() { clrFlag(0x800000); }
void CStickUseless() { setFlag(0x800000); }
cXyz Eye() { return mEye + mEyeShake; }
void StickUse() { clrFlag(0x1000000); }
void StickUseless() { setFlag(0x1000000); }
void setFlag(u32 flag) { mEventFlags |= flag; }
- bool chkFlag(u32 flag) { return mEventFlags & flag; }
+ bool chkFlag(u32 flag) { return (mEventFlags & flag) ? true : false; }
void clrFlag(u32 flag) { mEventFlags &= ~flag; }
+
+ static engine_fn engine_tbl[];
+ static const int type_num;
+ static dCamera__Type types[63];
+ static const int mvBGType_num;
+ static char* mvBGTypes[34];
};
STATIC_ASSERT(sizeof(dCamera_c) == 0x800);
-class dBgS_CamSphChk {
- ~dBgS_CamSphChk();
-};
-
s16 dCam_getAngleY(camera_class*);
s16 dCam_getAngleX(camera_class*);
s16 dCam_getControledAngleY(camera_class*);
diff --git a/include/d/d_cc_s.h b/include/d/d_cc_s.h
index 18cadda8..b977b2f0 100644
--- a/include/d/d_cc_s.h
+++ b/include/d/d_cc_s.h
@@ -44,18 +44,19 @@ public:
return mMass_Mng.Chk(p_xyz, p_actor, p_hitInf);
}
void SetMass(cCcD_Obj* i_obj, u8 i_priority) { mMass_Mng.Set(i_obj, i_priority); }
+
void PrepareMass() { mMass_Mng.Prepare(); }
void SetMassAttr(f32 radius, f32 height, u8 param_2, u8 param_3) {
mMass_Mng.SetAttr(radius, height, param_2, param_3);
}
void ChkActor(fopAc_ac_c*) {}
- void GetMassCamTopPos(Vec*) {}
- void GetMassResultCam() {}
+ void GetMassCamTopPos(Vec* o_pos) { mMass_Mng.GetCamTopPos(o_pos); }
+ u32 GetMassResultCam() { return mMass_Mng.GetResultCam(); }
void OffMassAllTimer() {}
void OnMassAllTimer() {}
void SetMassAreaChk(cCcD_Obj*, u8, void (*)(fopAc_ac_c*, cXyz*, u32)) {}
- void SetMassCam(cM3dGCps&) {}
+ void SetMassCam(cM3dGCps& i_cps) { mMass_Mng.SetCam(i_cps); }
// /* 0x0000 */ cCcS mCCcS;
/* 0x2854 */ dCcMassS_Mng mMass_Mng;
diff --git a/include/d/d_com_inf_game.h b/include/d/d_com_inf_game.h
index 8b94f168..e15cc6e8 100644
--- a/include/d/d_com_inf_game.h
+++ b/include/d/d_com_inf_game.h
@@ -180,14 +180,17 @@ public:
~dComIfG_camera_info_class() {}
/* 0x00 */ camera_class* mpCamera;
- /* 0x04 */ u8 mDlstWindowIdx;
- /* 0x05 */ u8 mCamIdx;
- /* 0x06 */ s8 field_0x06;
+ /* 0x04 */ s8 mDlstWindowIdx;
+ /* 0x05 */ s8 mCamP1Id;
+ /* 0x06 */ s8 mCamP2Id;
/* 0x07 */ u8 field_0x07;
/* 0x08 */ u32 mCameraAttentionStatus;
/* 0x0C */ f32 mCameraZoomScale;
/* 0x10 */ f32 mCameraZoomForcus;
- /* 0x14 */ u8 field_0x14[0x34 - 0x14];
+ /* 0x14 */ cXyz mCameraPos;
+ /* 0x20 */ cXyz mCameraTarget;
+ /* 0x2C */ f32 mCameraFovy;
+ /* 0x30 */ s16 mCameraBank;
};
STATIC_ASSERT(sizeof(dComIfG_camera_info_class) == 0x34);
@@ -200,6 +203,13 @@ struct ItemTableList {
u8 mItemTables[0x1E][0x10];
};
+class dComIfG_MesgCamInfo_c {
+public:
+ /* 0x00 */ int mID;
+ /* 0x04 */ int mBasicID;
+ /* 0x08 */ fopAc_ac_c* mActor[10];
+};
+
class dComIfG_play_c {
public:
#if VERSION == VERSION_JPN
@@ -240,6 +250,44 @@ public:
BOOL checkCameraAttentionStatus(int idx, u32 flag) {
return mCameraInfo[idx].mCameraAttentionStatus & flag;
}
+ u32 getCameraAttentionStatus(int i) { return mCameraInfo[i].mCameraAttentionStatus; }
+ void setCameraAttentionStatus(int i, u32 flag) { mCameraInfo[i].mCameraAttentionStatus = flag; }
+ void onCameraAttentionStatus(int i, u32 flag) { mCameraInfo[i].mCameraAttentionStatus |= flag; }
+ void offCameraAttentionStatus(int i, u32 flag) {
+ mCameraInfo[i].mCameraAttentionStatus &= ~flag;
+ }
+
+ void setCamera(int i, camera_class* cam) { mCameraInfo[i].mpCamera = cam; }
+ void setCameraInfo(int idx, camera_class* camera_p, int dlst_window_idx, int player1_camera_id, int player2_camera_id) {
+ mCameraInfo[idx].mpCamera = camera_p;
+ mCameraInfo[idx].mDlstWindowIdx = dlst_window_idx;
+ mCameraInfo[idx].mCamP1Id = player1_camera_id;
+ mCameraInfo[idx].mCamP2Id = player2_camera_id;
+ setCameraAttentionStatus(0, 0);
+ }
+
+ f32 getCameraZoomForcus(int i_no) { return mCameraInfo[i_no].mCameraZoomForcus; }
+ void setCameraZoomForcus(int i_no, f32 i_focus) { mCameraInfo[i_no].mCameraZoomForcus = i_focus; }
+
+ f32 getCameraZoomScale(int i_no) { return mCameraInfo[i_no].mCameraZoomScale; }
+ void setCameraZoomScale(int i_no, f32 i_scale) { mCameraInfo[i_no].mCameraZoomScale = i_scale; }
+
+ void saveCameraPosition(int i, cXyz* i_pos, cXyz* i_target, f32 i_fovy, s16 i_bank) {
+ mCameraInfo[i].mCameraPos = *i_pos;
+ mCameraInfo[i].mCameraTarget = *i_target;
+ mCameraInfo[i].mCameraFovy = i_fovy;
+ mCameraInfo[i].mCameraBank = i_bank;
+ }
+
+ void loadCameraPosition(int i, cXyz* o_pos, cXyz* o_target, f32* o_fovy, s16* o_bank) {
+ *o_pos = mCameraInfo[i].mCameraPos;
+ *o_target = mCameraInfo[i].mCameraTarget;
+ *o_fovy = mCameraInfo[i].mCameraFovy;
+ *o_bank = mCameraInfo[i].mCameraBank;
+ }
+ void setMesgCamInfoBasicID(int id) { mMesgCamInfo.mBasicID = id; }
+ dComIfG_MesgCamInfo_c* getMesgCamInfo() { return &mMesgCamInfo; }
+ void setMesgCamInfoID(int param_0) { mMesgCamInfo.mID = param_0; }
~dComIfG_play_c() {}
@@ -293,10 +341,13 @@ public:
void setGameoverStatus(u8 stts) { mGameoverStatus = stts; }
fopAc_ac_c* getPlayerPtr(int idx) { return (fopAc_ac_c*)mpPlayerPtr[idx]; }
- fopAc_ac_c* getPlayer(int idx) { return (fopAc_ac_c*)mpPlayer[idx]; }
+ fopAc_ac_c* getPlayer(int idx) { return (fopAc_ac_c*)mpPlayer[idx * 2]; }
void setPlayer(int idx, fopAc_ac_c* player) { mpPlayer[idx] = (daPy_py_c*)player; }
void setPlayerPtr(int idx, fopAc_ac_c* playerPtr) { mpPlayerPtr[idx] = playerPtr; }
s8 getPlayerCameraID(int idx) { return mCurCamera[idx]; }
+ int getCameraPlayer1ID(int i) { return mCameraInfo[i].mCamP1Id; }
+ int getCameraPlayer2ID(int i) { return mCameraInfo[i].mCamP2Id; }
+ int getCameraWinID(int i) { return mCameraInfo[i].mDlstWindowIdx; }
void setPlayerInfo(int idx, fopAc_ac_c* player, int cam) {
mpPlayer[idx] = (daPy_py_c*)player;
mCurCamera[idx] = cam;
@@ -456,16 +507,6 @@ public:
u8 getScopeMesgStatus() { return mbCamOverrideFarPlane; }
void setScopeMesgStatus(u8 status) { mbCamOverrideFarPlane = status; }
- void setCameraInfo(int idx, camera_class* camera_p, int dlst_window_idx, int cam_idx, int p5) {
- mCameraInfo[idx].mpCamera = camera_p;
- mCameraInfo[idx].mDlstWindowIdx = dlst_window_idx;
- mCameraInfo[idx].mCamIdx = cam_idx;
- mCameraInfo[idx].field_0x06 = p5;
- setCameraAttentionStatus(0, 0);
- }
- void setCameraAttentionStatus(int idx, u32 stts) {
- mCameraInfo[idx].mCameraAttentionStatus = stts;
- }
void setCurrentGrafPort(J2DOrthoGraph* i_graf) { mCurrentGrafPort = i_graf; }
void setCurrentWindow(dDlst_window_c* i_window) { mCurrentWindow = i_window; }
void setCurrentView(view_class* i_view) { mCurrentView = i_view; }
@@ -751,9 +792,7 @@ public:
/* 0x497A */ u8 field_0x497a;
/* 0x497B */ u8 field_0x497B[0x497C - 0x497B];
/* 0x497C */ JKRExpHeap* mpExpHeap2D;
- /* 0x4980 */ int mMesgCameraTagInfo;
- /* 0x4984 */ int field_0x4984;
- /* 0x4988 */ int field_0x4988[10];
+ /* 0x4980 */ dComIfG_MesgCamInfo_c mMesgCamInfo;
/* 0x49B0 */ u8 mPlayerInfoBuffer[sizeof(dSv_player_status_c_c)];
/* 0x4A20 */ u8 mPlayerInfoBufferStageNo;
/* 0x4A24 */ daAgb_c* mpAgb;
@@ -2207,6 +2246,22 @@ inline daPy_lk_c* daPy_getPlayerLinkActorClass() {
return (daPy_lk_c*)dComIfGp_getLinkPlayer();
}
+inline void dComIfGp_setWindowNum(int num) {
+ g_dComIfG_gameInfo.play.setWindowNum(num);
+}
+
+inline int dComIfGp_getCameraPlayer1ID(int idx) {
+ return g_dComIfG_gameInfo.play.getCameraPlayer1ID(idx);
+}
+
+inline int dComIfGp_getCameraPlayer2ID(int idx) {
+ return g_dComIfG_gameInfo.play.getCameraPlayer2ID(idx);
+}
+
+inline int dComIfGp_getCameraWinID(int idx) {
+ return g_dComIfG_gameInfo.play.getCameraWinID(idx);
+}
+
inline int dComIfGp_getPlayerCameraID(int idx) {
return g_dComIfG_gameInfo.play.getPlayerCameraID(idx);
}
@@ -2215,6 +2270,50 @@ inline u32 dComIfGp_checkCameraAttentionStatus(int idx, u32 flag) {
return g_dComIfG_gameInfo.play.checkCameraAttentionStatus(idx, flag);
}
+inline void dComIfGp_onCameraAttentionStatus(int i, u32 flag) {
+ g_dComIfG_gameInfo.play.onCameraAttentionStatus(i, flag);
+}
+
+inline void dComIfGp_offCameraAttentionStatus(int i, u32 flag) {
+ g_dComIfG_gameInfo.play.offCameraAttentionStatus(i, flag);
+}
+
+inline void dComIfGp_setCamera(int i, camera_class* cam) {
+ g_dComIfG_gameInfo.play.setCamera(i, cam);
+}
+
+inline void dComIfGp_setCameraInfo(int idx, camera_class* camera, int dlst, int cam, int p5) {
+ g_dComIfG_gameInfo.play.setCameraInfo(idx, camera, dlst, cam, p5);
+}
+
+inline void dComIfGp_setCameraZoomScale(int i_no, f32 i_scale) {
+ g_dComIfG_gameInfo.play.setCameraZoomScale(i_no, i_scale);
+}
+
+inline f32 dComIfGp_getCameraZoomScale(int i_no) {
+ return g_dComIfG_gameInfo.play.getCameraZoomScale(i_no);
+}
+
+inline void dComIfGp_setCameraZoomForcus(int i_no, f32 i_focus) {
+ g_dComIfG_gameInfo.play.setCameraZoomForcus(i_no, i_focus);
+}
+
+inline f32 dComIfGp_getCameraZoomForcus(int i_no) {
+ return g_dComIfG_gameInfo.play.getCameraZoomForcus(i_no);
+}
+
+inline u32 dComIfGp_getCameraAttentionStatus(int i_no) {
+ return g_dComIfG_gameInfo.play.getCameraAttentionStatus(i_no);
+}
+
+inline void dComIfGp_saveCameraPosition(int i, cXyz* i_pos, cXyz* i_target, f32 i_fovy, s16 i_bank) {
+ g_dComIfG_gameInfo.play.saveCameraPosition(i, i_pos, i_target, i_fovy, i_bank);
+}
+
+inline void dComIfGp_loadCameraPosition(int i, cXyz* o_pos, cXyz* o_target, f32* o_fovy, s16* o_bank) {
+ g_dComIfG_gameInfo.play.loadCameraPosition(i, o_pos, o_target, o_fovy, o_bank);
+}
+
inline int dComIfGp_getItemRupeeCount() {
return g_dComIfG_gameInfo.play.getItemRupeeCount();
}
@@ -2525,9 +2624,6 @@ inline void dComIfGp_plusMiniGameRupee(s16 count) {
g_dComIfG_gameInfo.play.plusMiniGameRupee(count);
}
-inline void dComIfGp_setCameraInfo(int idx, camera_class* camera, int dlst, int cam, int p5) {
- g_dComIfG_gameInfo.play.setCameraInfo(idx, camera, dlst, cam, p5);
-}
inline s32 dComIfGp_getWindowNum() { return g_dComIfG_gameInfo.play.getWindowNum(); }
inline void dComIfGp_setWindowNum(u8 num) { g_dComIfG_gameInfo.play.setWindowNum(num); }
inline dDlst_window_c * dComIfGp_getWindow(int idx) { return g_dComIfG_gameInfo.play.getWindow(idx); }
@@ -2626,6 +2722,19 @@ inline u8 dComIfGp_getMesgStatus() {
return g_dComIfG_gameInfo.play.getMesgStatus();
}
+
+inline void dComIfGp_setMesgCameraTagInfo(int id) {
+ g_dComIfG_gameInfo.play.setMesgCamInfoID(id);
+}
+
+inline void dComIfGp_setMesgCameraAttrInfo(int param_1) {
+ g_dComIfG_gameInfo.play.setMesgCamInfoBasicID(param_1);
+}
+
+inline dComIfG_MesgCamInfo_c* dComIfGp_getMesgCameraInfo() {
+ return g_dComIfG_gameInfo.play.getMesgCamInfo();
+}
+
inline u8 dComIfGp_checkMesgBgm() {
return g_dComIfG_gameInfo.play.checkMesgBgm();
}
@@ -3027,6 +3136,10 @@ inline u8 dComIfGp_evmng_getEventEndSound(s16 eventIdx) {
return g_dComIfG_gameInfo.play.getEvtManager().getEventEndSound(eventIdx);
}
+inline int dComIfGp_evmng_cameraPlay() {
+ return dComIfGp_getPEvtManager()->cameraPlay();
+}
+
/**
* === DEMO ===
*/
@@ -3063,6 +3176,9 @@ inline dDemo_actor_c* dComIfGp_demo_getActor(u8 id) {
return g_dComIfG_gameInfo.play.getDemo()->getObject()->getActor(id);
}
+stage_camera_class* dComIfGp_getRoomCamera(int i_roomNo);
+stage_arrow_class* dComIfGp_getRoomArrow(int i_roomNo);
+
/**
* === DRAWLIST ===
*/
@@ -3626,6 +3742,10 @@ inline void dComIfGp_att_chkEnemySound() {
* === MAP ===
*/
+ inline void dComIfGp_map_draw(f32 x, f32 z, int roomNo, f32 y) {
+ dMap_c::draw(x, z, roomNo, y);
+}
+
inline void dComIfGp_map_mapBufferSendAGB(int param_0) {
dMap_c::mapBufferSendAGB(param_0);
}
@@ -3710,4 +3830,6 @@ BOOL dComIfG_resetToOpening(scene_class* i_scene);
int dComIfG_changeOpeningScene(scene_class* i_scene, s16 i_procName);
+
+
#endif /* D_COM_D_COM_INF_GAME_H */
diff --git a/include/d/d_demo.h b/include/d/d_demo.h
index 70fa356f..51b3939b 100644
--- a/include/d/d_demo.h
+++ b/include/d/d_demo.h
@@ -181,11 +181,11 @@ public:
bool checkEnable(u8 mask) { return mFlags & mask; }
void onEnable(u8 flag) { mFlags |= flag; }
- void getFovy() {}
- void getRoll() {}
- void getTarget() {}
- void getTrans() {}
- void getUp() {}
+ f32 getFovy() { return mFovy; }
+ f32 getRoll() { return mRoll; }
+ cXyz& getTarget() { return mTargetPosition; }
+ cXyz& getTrans() { return mViewPosition; }
+ cXyz& getUp() { return mUpVector; }
private:
/* 0x04 */ u8 mFlags;
diff --git a/include/d/d_drawlist.h b/include/d/d_drawlist.h
index 2ac32e5b..d90d57d8 100644
--- a/include/d/d_drawlist.h
+++ b/include/d/d_drawlist.h
@@ -210,6 +210,13 @@ public:
void update(cXyz&, GXColor&, u16, u16, u16, u16, f32, f32, f32, f32);
virtual void draw();
+ f32 getRndFX(f32 param_0) { return mRnd.getFX(param_0); }
+ f32 getRndValue(f32 param_0, f32 param_1) { return mRnd.getValue(param_0, param_1); }
+
+ void initRnd(int r0, int r1, int r2) {
+ mRnd.init(r0, r1, r2);
+ }
+
public:
/* 0x04 */ cM_rnd_c mRnd;
/* 0x10 */ cXyz mPos;
@@ -238,6 +245,7 @@ public:
void setScissor(f32, f32, f32, f32);
view_port_class* getViewPort() { return &mViewport; }
+ scissor_class* getScissor() { return &mViewport.mScissor; }
int getCameraID() { return mCameraID; }
void setCameraID(int id) { mCameraID = id; }
void setMode(int mode) { mMode = mode; }
diff --git a/include/d/d_event_manager.h b/include/d/d_event_manager.h
index f066495e..679f3bfd 100644
--- a/include/d/d_event_manager.h
+++ b/include/d/d_event_manager.h
@@ -67,7 +67,8 @@ public:
int setStartDemo(int eventInfoIdx) { return mException.setStartDemo(eventInfoIdx); }
void cancelStartDemo() { /* TODO */ }
- void setCameraPlay(u32 v) { mCameraPlay = v; }
+ void setCameraPlay(int v) { mCameraPlay = v; }
+ int cameraPlay() { return mCameraPlay; }
/* 0x000 */ dEvDtBase_c mList;
/* 0x020 */ u32 mCameraPlay;
diff --git a/include/d/d_spline_path.h b/include/d/d_spline_path.h
index 51253d3a..57a1dace 100644
--- a/include/d/d_spline_path.h
+++ b/include/d/d_spline_path.h
@@ -27,7 +27,10 @@ public:
/* 0x24 */ f32 mCurveWeight[3];
/* 0x30 */ s32 mCurveKey[3];
/* 0x3C */ void* mUser;
- /* 0x40 */ void* vtbl; // XXX
+ /* 0x40 */ //void* vtbl; // XXX
+
+ d2DBSplinePath() { Init(0, 0); }
+ virtual ~d2DBSplinePath(){};
};
#endif /* D_SPLINE_PATH_H */
diff --git a/include/d/d_stage.h b/include/d/d_stage.h
index c73fe6c6..9a4ed6e3 100644
--- a/include/d/d_stage.h
+++ b/include/d/d_stage.h
@@ -59,13 +59,13 @@ public:
};
struct stage_stag_info_class {
- /* 0x00 */ f32 field_0x0;
- /* 0x04 */ f32 field_0x4;
- /* 0x08 */ u8 mDefaultCameraType;
- /* 0x09 */ u8 field_0x09;
- /* 0x0A */ u16 field_0x0a;
- /* 0x0C */ u32 field_0x0c;
- /* 0x10 */ u32 field_0x10;
+ /* 0x00 */ f32 mNearPlane;
+ /* 0x04 */ f32 mFarPlane;
+ /* 0x08 */ u8 mCameraMapToolID;
+ /* 0x09 */ u8 mProp;
+ /* 0x0A */ u16 mParticleSceneNo;
+ /* 0x0C */ u32 mStageTypeAndSchbit;
+ /* 0x10 */ u32 mSchbitEnableAndFarPlane; // High 16 bits are the schbit enable, low 16 bits are the far plane
/* 0x14 */ u32 field_0x14;
/* 0x18 */ u32 field_0x18;
/* 0x1C */ u32 field_0x1c;
@@ -156,31 +156,33 @@ public:
};
struct stage_camera2_data_class {
- /* 0x00 */ int field_0x0;
- /* 0x04 */ f32 field_0x4;
- /* 0x08 */ f32 field_0x8;
- /* 0x0C */ f32 field_0xc;
- /* 0x10 */ u8 field_0x10;
- /* 0x11 */ u8 field_0x11;
- /* 0x12 */ u8 field_0x12;
- /* 0x13 */ u8 field_0x13;
- /* 0x14 */ u16 field_0x14;
- /* 0x16 */ u16 field_0x16;
+ /* 0x00 */ int m00;
+ /* 0x04 */ f32 m04;
+ /* 0x08 */ f32 m08;
+ /* 0x0C */ f32 m0C;
+ /* 0x10 */ u8 mArrowIdx;
+ /* 0x11 */ u8 m11;
+ /* 0x12 */ u8 m12;
+ /* 0x13 */ u8 m13;
}; // Size: 0x18
struct stage_camera_class {
/* 0x0 */ int num;
- /* 0x4 */ stage_camera2_data_class* m_entries;
+ /* 0x4 */ stage_camera2_data_class* mEntries;
};
struct stage_arrow_data_class {
- /* 0x00 */ cXyz mPosition;
- /* 0x0C */ csXyz mAngle;
+ struct {
+ /* 0x00 */ cXyz mPosition;
+ /* 0x0C */ csXyz mAngle;
+ /* 0x12 */ s16 m12;
+ }
+ /* 0x00 */ m00;
}; // Size: 0x14
struct stage_arrow_class {
/* 0x00 */ int num;
- /* 0x04 */ stage_arrow_data_class* m_entries;
+ /* 0x04 */ stage_arrow_data_class* mEntries;
};
class stage_actor_data_class {
@@ -1009,43 +1011,43 @@ const char* dStage_getName2(s16 i_procName, s8 i_subtype);
inline u8 dStage_stagInfo_DefaultCameraType(stage_stag_info_class* p_info) {
- return p_info->mDefaultCameraType;
+ return p_info->mCameraMapToolID;
}
inline s32 dStage_stagInfo_ChkKeyDisp(stage_stag_info_class* i_stagInfo) {
- return i_stagInfo->field_0x09 & 1;
+ return i_stagInfo->mProp & 1;
}
inline s32 dStage_stagInfo_GetSaveTbl(stage_stag_info_class* i_stagInfo) {
- return (i_stagInfo->field_0x09 >> 1) & 0x7F;
+ return (i_stagInfo->mProp >> 1) & 0x7F;
}
inline u32 dStage_stagInfo_GetSTType(stage_stag_info_class* i_stagInfo) {
- return (i_stagInfo->field_0x0c >> 16) & 7;
+ return (i_stagInfo->mStageTypeAndSchbit >> 16) & 7;
}
inline u8 dStage_stagInfo_GetUpButton(stage_stag_info_class* i_stagInfo) {
- return i_stagInfo->field_0x0a & 3;
+ return i_stagInfo->mParticleSceneNo & 3;
}
inline u8 dStage_stagInfo_GetParticleNo(stage_stag_info_class* i_stagInfo) {
- return (i_stagInfo->field_0x0a >> 0x3) & 0xFF;
+ return (i_stagInfo->mParticleSceneNo >> 0x3) & 0xFF;
}
inline s8 dStage_stagInfo_GetTimeH(stage_stag_info_class* p_info) {
- return (p_info->field_0x0c >> 8) & 0xFF;
+ return (p_info->mStageTypeAndSchbit >> 8) & 0xFF;
}
inline u16 dStage_stagInfo_GetCullPoint(stage_stag_info_class* p_info) {
- return p_info->field_0x10 & 0xFFFF;
+ return p_info->mSchbitEnableAndFarPlane & 0xFFFF;
}
inline u8 dStage_stagInfo_getStartSch(stage_stag_info_class* p_info) {
- return (p_info->field_0x10 >> 0x10) & 0xFF;
+ return (p_info->mSchbitEnableAndFarPlane >> 0x10) & 0xFF;
}
inline u8 dStage_stagInfo_GetSchSec(stage_stag_info_class* p_info) {
- return p_info->field_0x0c & 0xFF;
+ return p_info->mStageTypeAndSchbit & 0xFF;
}
// TODO:
diff --git a/include/f_ap/f_ap_game.h b/include/f_ap/f_ap_game.h
index daf4ccae..c50bcdc5 100644
--- a/include/f_ap/f_ap_game.h
+++ b/include/f_ap/f_ap_game.h
@@ -24,7 +24,7 @@ public:
/* 0x09 */ u8 field_0x09;
/* 0x0A */ u8 field_0x0a;
/* 0x0B */ u8 field_0x0b;
- /* 0x0C */ f32 field_0x0c;
+ /* 0x0C */ f32 mAspectRatio;
/* 0x10 */ u8 field_0x10;
/* 0x11 */ u8 field_0x11;
/* 0x12 */ u8 field_0x12;
@@ -77,5 +77,6 @@ inline bool fapGmHIO_isMenu() { return !!(g_HIO.mDisplayFlag & 0x02); }
inline bool fapGmHIO_getMeter() { return g_HIO.mDisplayMeter; }
inline s16 fapGmHIO_getFbWidth() { return g_HIO.mFbWidth; }
inline s16 fapGmHIO_getEfbHeight() { return g_HIO.mEfbHeight; }
+inline f32 fapGmHIO_getAspectRatio() { return g_HIO.mAspectRatio; }
#endif /* F_AP_GAME_H */
diff --git a/include/f_op/f_op_camera.h b/include/f_op/f_op_camera.h
index 39111e37..250a10a7 100644
--- a/include/f_op/f_op_camera.h
+++ b/include/f_op/f_op_camera.h
@@ -21,8 +21,7 @@ public:
class camera_class : public camera_process_class {
public:
- /* 0x23C */ int field_0x23c;
- /* 0x240 */ int field_0x244;
+ /* 0x23C */ request_of_phase_process_class phase_request;
/* 0x244 */ dCamera_c mCamera;
};
diff --git a/include/f_op/f_op_camera_mng.h b/include/f_op/f_op_camera_mng.h
index 2ad98168..6638255d 100644
--- a/include/f_op/f_op_camera_mng.h
+++ b/include/f_op/f_op_camera_mng.h
@@ -5,42 +5,96 @@
#include "SSystem/SComponent/c_sxyz.h"
#include "f_op/f_op_camera.h"
-/* void fopCamM_SetNear(camera_class* cam, f32 near) {
- cam->mNear = near;
+
+inline void fopCamM_SetAngleX(camera_class* i_camera, s16 angleX) {
+ i_camera->mAngle.x = angleX;
+}
+
+inline void fopCamM_SetAngleY(camera_class* i_camera, s16 angleY) {
+ i_camera->mAngle.y = angleY;
+}
+
+inline void fopCamM_SetAngleZ(camera_class* i_camera, s16 angleZ) {
+ i_camera->mAngle.z = angleZ;
+}
+
+inline void fopCamM_SetNear(camera_class* i_this, f32 near) {
+ i_this->mNear = near;
}
-void fopCamM_SetFar(camera_class* cam, f32 far) {
- cam->mFar = far;
+inline void fopCamM_SetFar(camera_class* i_this, f32 far) {
+ i_this->mFar = far;
}
-void fopCamM_SetFovy(camera_class* cam, f32 fovy) {
- cam->mFovy = fovy;
+inline void fopCamM_SetFovy(camera_class* i_this, f32 fovy) {
+ i_this->mFovy = fovy;
}
-void fopCamM_SetAspect(camera_class* cam, f32 aspect) {
- cam->mAspect = aspect;
+inline void fopCamM_SetAspect(camera_class* i_this, f32 aspect) {
+ i_this->mAspect = aspect;
}
-void fopCamM_SetEye(camera_class* cam, f32 x, f32 y, f32 z) {
- cam->field_0xd8.mEye.set(x, y, z);
+inline void fopCamM_SetEye(camera_class* i_this, f32 x, f32 y, f32 z) {
+ i_this->mLookat.mEye.set(x, y, z);
}
-void fopCamM_SetCenter(camera_class* cam, f32 x, f32 y, f32 z) {
- cam->field_0xd8.mCenter.set(x, y, z);
+inline void fopCamM_SetCenter(camera_class* i_this, f32 x, f32 y, f32 z) {
+ i_this->mLookat.mCenter.set(x, y, z);
}
-void fopCamM_SetBank(camera_class* cam, s16 bank) {
- cam->mBank = bank;
-} */
+inline void fopCamM_SetUp(camera_class* i_this, f32 x, f32 y, f32 z) {
+ i_this->mLookat.mUp.set(x, y, z);
+}
+
+inline void fopCamM_SetBank(camera_class* i_this, s16 bank) {
+ i_this->mBank = bank;
+}
+
+inline void fopCamM_SetPrm1(camera_class* i_this, int prm1) {
+ i_this->mPrm1 = prm1;
+}
+
+inline void fopCamM_SetPrm2(camera_class* i_this, int prm2) {
+ i_this->mPrm2 = prm2;
+}
+
+inline void fopCamM_SetPrm3(camera_class* i_this, int prm3) {
+ i_this->mPrm3 = prm3;
+}
+
+inline s16 fopCamM_GetAngleX(camera_class* i_camera) {
+ return i_camera->mAngle.x;
+}
inline s16 fopCamM_GetAngleY(camera_class* i_camera) {
return i_camera->mAngle.y;
}
+inline s16 fopCamM_GetAngleZ(camera_class* i_camera) {
+ return i_camera->mAngle.z;
+}
+
inline f32 fopCamM_GetFovy(camera_class* i_camera) {
return i_camera->mFovy;
}
+inline cXyz* fopCamM_GetEye_p(camera_class* i_camera) {
+ return &i_camera->mLookat.mEye;
+}
+
+inline cXyz* fopCamM_GetCenter_p(camera_class* i_camera) {
+ return &i_camera->mLookat.mCenter;
+}
+
+inline cXyz* fopCamM_GetUp_p(camera_class* i_camera) {
+ return &i_camera->mLookat.mUp;
+}
+
+
+inline s16 fopCamM_GetBank(camera_class* i_camera) {
+ return i_camera->mBank;
+}
+
fpc_ProcID fopCamM_Create(int i_cameraIdx, s16 pProcName, void* i_append);
void fopCamM_Management(void);
u32 fopCamM_GetParam(camera_class* pCamera);
diff --git a/include/m_Do/m_Do_audio.h b/include/m_Do/m_Do_audio.h
index 3bf52896..44139212 100644
--- a/include/m_Do/m_Do_audio.h
+++ b/include/m_Do/m_Do_audio.h
@@ -167,6 +167,18 @@ inline void mDoAud_linkVoiceStart(u32 param_0, Vec* i_sePos, u8 param_3, s8 para
mDoAud_zelAudio_c::getInterface()->linkVoiceStart(param_0, i_sePos, param_3, param_4);
}
+inline void mDoAud_getCameraMapInfo(u32 param_0) {
+ mDoAud_zelAudio_c::getInterface()->getCameraMapInfo(param_0);
+}
+
+inline void mDoAud_setCameraGroupInfo(u8 param_0) {
+ mDoAud_zelAudio_c::getInterface()->setCameraGroupInfo(param_0);
+}
+
+inline void mDoAud_getCameraInfo(Vec* param_0, MtxP param_1, u32 param_2) {
+ mDoAud_zelAudio_c::getInterface()->getCameraInfo(param_0, param_1, param_2);
+}
+
inline void mDoAud_setLinkGroupInfo(u8 param_0) {
mDoAud_zelAudio_c::getInterface()->setLinkGroupInfo(param_0);
}
diff --git a/include/m_Do/m_Do_graphic.h b/include/m_Do/m_Do_graphic.h
index f595f4ea..762a9791 100644
--- a/include/m_Do/m_Do_graphic.h
+++ b/include/m_Do/m_Do_graphic.h
@@ -40,6 +40,7 @@ public:
static u8 getBlureRate() { return mBlureRate; }
static MtxP getBlureMtx() { return mBlureMtx; }
static void offAutoForcus() { mAutoForcus = false; }
+ static void onAutoForcus() { mAutoForcus = true; }
static BOOL isAutoForcus() { return mAutoForcus; }
static void setTickRate(u32 rate) { JFWDisplay::getManager()->setTickRate(rate); }
static void waitBlanking(int wait) { JFWDisplay::getManager()->waitBlanking(wait); }
diff --git a/include/m_Do/m_Do_mtx.h b/include/m_Do/m_Do_mtx.h
index 69f3ff75..f0320557 100644
--- a/include/m_Do/m_Do_mtx.h
+++ b/include/m_Do/m_Do_mtx.h
@@ -143,6 +143,10 @@ inline void cMtx_inverseTranspose(const Mtx a, Mtx b) {
mDoMtx_inverseTranspose(a, b);
}
+inline void cMtx_concatProjView(const Mtx a, const Mtx b, Mtx c) {
+ mDoMtx_concatProjView(a, b, c);
+}
+
class mDoMtx_stack_c {
public:
mDoMtx_stack_c() {
diff --git a/src/d/d_camera.cpp b/src/d/d_camera.cpp
index dc65769d..8492da3d 100644
--- a/src/d/d_camera.cpp
+++ b/src/d/d_camera.cpp
@@ -9,292 +9,2006 @@
#include "d/d_bg_s_sph_chk.h"
#include "SSystem/SComponent/c_bg_s.h"
#include "dolphin/types.h"
-
-class camera_process_class;
+#include "SSystem/SComponent/c_math.h"
+#include "d/actor/d_a_obj_pirateship.h"
+#include "m_Do/m_Do_controller_pad.h"
+#include "f_op/f_op_camera.h"
+#include "f_op/f_op_camera_mng.h"
+#include "d/d_com_lib_game.h"
+#include "m_Do/m_Do_graphic.h"
+#include "f_ap/f_ap_game.h"
+#include "d/actor/d_a_npc_md.h"
+#include "d/actor/d_a_npc_kamome.h"
+#include "d/d_procname.h"
+#include "d/d_demo.h"
+#include "d/actor/d_a_sea.h"
+#include "m_Do/m_Do_lib.h"
+#include "m_Do/m_Do_machine.h"
+#include "f_op/f_op_overlap_mng.h"
+
+#include "weak_bss_936_to_1036.h" // IWYU pragma: keep
+#include "weak_data_1811.h" // IWYU pragma: keep
+
+namespace {
+ static f32 limitf(f32 value, f32 min, f32 max) {
+ if (value > max) {
+ return max;
+ } else if (value < min) {
+ return min;
+ }
+ return value;
+ }
+
+ inline static bool is_player(fopAc_ac_c* actor) {
+ return fopAcM_GetName(actor) == PROC_PLAYER;
+ }
+
+ inline static bool isPlayerGuarding(u32 param_0) {
+ return dComIfGp_checkPlayerStatus1(param_0, 0x80000) || daNpc_Md_c::m_mirror;
+ }
+
+ inline static fopAc_ac_c* get_boomerang_actor(fopAc_ac_c* actor) {
+ if (is_player(actor)) {
+ daPy_py_c* link = (daPy_py_c*)actor;
+ return fopAcM_SearchByID(link->getThrowBoomerangID());
+ } else {
+ return NULL;
+ }
+ }
+
+ inline static bool push_any_key(u32 padId) {
+ if (g_mDoCPd_cpadInfo[padId].mMainStickValue > 0.001f) {
+ return true;
+ }
+
+ if (g_mDoCPd_cpadInfo[padId].mCStickValue > 0.001f) {
+ return true;
+ }
+
+ if (*(u16*)&g_mDoCPd_cpadInfo[padId].mButtonHold) {
+ return true;
+ }
+
+ return false;
+ }
+
+ inline static void hideActor(fopAc_ac_c* actor) {
+ fopAcM_OnStatus(actor, 0x1000000);
+ }
+
+ inline static int get_camera_id(camera_class* i_camera) {
+ return fopCamM_GetParam(i_camera);
+ }
+
+ inline static int get_controller_id(camera_class* i_camera) {
+ return dComIfGp_getCameraPlayer1ID(get_camera_id(i_camera));
+ }
+
+ inline static dDlst_window_c* get_window(int param_0) {
+ return dComIfGp_getWindow(dComIfGp_getCameraWinID(param_0));
+ }
+
+ inline static dDlst_window_c* get_window(camera_class* i_camera) {
+ return dComIfGp_getWindow(dComIfGp_getCameraWinID(get_camera_id(i_camera)));
+ }
+
+ inline static fopAc_ac_c* get_player_actor(camera_class* i_camera) {
+ return dComIfGp_getPlayer(dComIfGp_getCameraPlayer1ID(get_camera_id(i_camera)));
+ }
+
+ inline static u32 check_owner_action(u32 param_0, u32 param_1) {
+ return dComIfGp_checkPlayerStatus0(param_0, param_1);
+ }
+
+ inline static u32 check_owner_action1(u32 param_0, u32 param_1) {
+ return dComIfGp_checkPlayerStatus1(param_0, param_1);
+ }
+
+ inline static void setComStat(u32 param_0) {
+ dComIfGp_onCameraAttentionStatus(0, param_0);
+ }
+
+ inline static void clrComStat(u32 param_0) {
+ dComIfGp_offCameraAttentionStatus(0, param_0);
+ }
+
+ inline static bool getComStat(u32 param_0) {
+ return dComIfGp_getCameraAttentionStatus(0) & param_0;
+ }
+
+ inline static void setComZoomScale(f32 param_0) {
+ dComIfGp_setCameraZoomScale(0, param_0);
+ }
+
+ inline static void setComZoomForcus(f32 param_0) {
+ dComIfGp_setCameraZoomForcus(0, param_0);
+ }
+} // namespace
+
+
+engine_fn dCamera_c::engine_tbl[] = {
+ &dCamera_c::letCamera,
+ &dCamera_c::lockonCamera,
+ &dCamera_c::talktoCamera,
+ &dCamera_c::subjectCamera,
+ &dCamera_c::fixedPositionCamera,
+ &dCamera_c::fixedFrameCamera,
+ &dCamera_c::towerCamera,
+ &dCamera_c::rideCamera,
+ &dCamera_c::manualCamera,
+ &dCamera_c::eventCamera,
+ &dCamera_c::hookshotCamera,
+ &dCamera_c::followCamera2,
+ &dCamera_c::followCamera,
+ &dCamera_c::crawlCamera,
+ &dCamera_c::tornadoCamera,
+ &dCamera_c::hungCamera,
+ &dCamera_c::vomitCamera,
+ &dCamera_c::shieldCamera,
+ &dCamera_c::nonOwnerCamera,
+ &dCamera_c::demoCamera,
+};
+
+//char* dCamera_c::mvBGTypes[34] = {
+// "Field",
+// "Dungeon",
+// "Plain",
+// "DungeonDown",
+// "DungeonUp",
+// "DungeonCorner",
+// "Jump",
+// "DungeonWide",
+// "Room",
+// "FieldCushion",
+// "OverLook",
+// "Corridor",
+// "Subject",
+// "DungeonPassage",
+// "Cliff",
+// "Cliff2",
+// "MajTower",
+// "Boss01",
+// "Boss02",
+// "Gamoss",
+// "MiniIsland",
+// "Amoss",
+// "Cafe",
+// "P_Ganon1",
+// "P_Ganon2",
+// "WindBoss",
+// "P_Ganon3",
+// "G_BedRoom",
+// "G_Roof",
+// "G_BedRoom2",
+// "Boss04",
+// "WindHall",
+// "BigBird",
+// "DStairs"
+//};
/* 80161790-801618B8 .text __ct__9dCamera_cFP12camera_class */
-dCamera_c::dCamera_c(camera_class*) : mCamParam(0) {
- /* Nonmatching */
+dCamera_c::dCamera_c(camera_class* i_camera) : mCamParam(0) {
+ /* Nonmatching - Code 100%, need to figure out class member at 0x0A4 */
+ initialize(i_camera, get_player_actor(i_camera), get_camera_id(i_camera), get_controller_id(i_camera));
}
-
/* 801618B8-80161994 .text __dt__9dCamera_cFv */
dCamera_c::~dCamera_c() {
- /* Nonmatching */
+ /* Nonmatching - Code 100%, issue with class member definitions */
+ fopAc_ac_c::setStopStatus(0);
}
/* 80161994-80162128 .text initialize__9dCamera_cFP12camera_classP10fopAc_ac_cUlUl */
-void dCamera_c::initialize(camera_class*, fopAc_ac_c*, u32, u32) {
- /* Nonmatching */
+void dCamera_c::initialize(camera_class* camera, fopAc_ac_c* playerActor, u32 cameraInfoIdx, u32 padId) {
+ int mapToolType;
+
+ mpCamera = camera;
+ m004 = 1;
+ m005 = 0;
+
+ mpPlayerActor = playerActor;
+ mCameraInfoIdx = cameraInfoIdx;
+ mPadId = padId;
+
+ initMonitor();
+ initPad();
+ mForcusLine.Init();
+
+ mCamTypeField = GetCameraTypeFromCameraName("Field");
+ mCamTypeEvent = GetCameraTypeFromCameraName("Event");
+ mCamTypeWater = GetCameraTypeFromCameraName("Water");
+ mCamTypeSubject = GetCameraTypeFromCameraName("Subject");
+ mCamTypeBoat = GetCameraTypeFromCameraName("Boat");
+ mCamTypeBoatBattle = GetCameraTypeFromCameraName("BoatBattle");
+ mCamTypeRestrict = GetCameraTypeFromCameraName("Restrict");
+ mCamTypeKeep = GetCameraTypeFromCameraName("Keep");
+ mCurType = mMapToolType = mCamTypeField;
+
+ m524 = 0xFF;
+ m528 = NULL;
+ m258 = 0;
+ m254 = 0;
+ m248[0] = JA_SE_MAN_CAMERA_NG;
+ m248[1] = JA_SE_CAMERA_TO_MANUAL;
+ m248[2] = JA_SE_ATM_PRT_SHIP_CREAK;
+ mCurMode = 0;
+ m144 = 1;
+ m514 = 0;
+ m14C = 0.0f;
+ mEventFlags = 0;
+ m148 = cSAngle::_0;
+ m07C = 0;
+ m080 = cM_rndFX(32767.0f);
+ m064 = 1.0f;
+ m5F4 = 0.0f;
+ mTrimHeight = 0.0f;
+ mTrimSize = 0;
+ mTrimTypeForce = -1;
+
+ dStage_stageDt_c* stage_dt = &dComIfGp_getStage();
+ if (stage_dt != NULL) {
+ stage_stag_info_class* stag_info = stage_dt->getStagInfo();
+ if (stag_info && stag_info->mCameraMapToolID != -1) { // Bug, comparing unsigned value with -1
+ mapToolType = GetCameraTypeFromMapToolID(stag_info->mCameraMapToolID, -1);
+ if (mapToolType != 0xFF && Chtyp(mapToolType)) {
+ mMapToolType = mapToolType;
+ }
+ }
+ }
+
+ mCurStyle = types[mCurType].mStyles[0][mCurMode];
+ mLockOnActorId = fpcM_ERROR_PROCESS_ID_e;
+ mStageMapToolCameraIdx = 0xFF;
+ m0E8 = -1;
+ mEventData.field_0x14 = -1;
+ mEventData.field_0x18 = -1;
+ mEventData.field_0x04 = -1;
+ mEventData.field_0x0c = -1;
+ mRoomNo = -1;
+ m318 = -1e+09f;
+ m310 = -1e+09f;
+ mBG.m58 = -1e+09f;
+ mBG.m04.OffNormalGrp();
+ mBG.m04.OnWaterGrp();
+ m31D = 0;
+ m31C = 0;
+ m32C = cXyz::Zero;
+ m320 = m32C;
+ m33C = 0;
+ m33A = cSAngle::_0;
+ m338 = m33A;
+ m350 = 0;
+ m364 = 0;
+ m368 = 0.0f;
+ m354 = -1e+09f;
+ mRoomMapToolCameraIdx = 0xFF;
+ m608 = mCamSetup.mBGChk.WallUpDistance();
+
+ if (!strcmp(dComIfGp_getStartStageName(), "sea")) {
+ m780 = 1;
+ }
+ else {
+ m780 = 0;
+ }
+
+ if (!strcmp(dComIfGp_getStartStageName(), "kaze")) {
+ m788 = 1;
+ }
+ else {
+ m788 = 0;
+ }
+
+ if (!strcmp(dComIfGp_getStartStageName(), "M_Dai")) {
+ m789 = 1;
+ }
+ else {
+ m789 = 0;
+ }
+
+ if (!strcmp(dComIfGp_getStartStageName(), "kazeB")) {
+ m78B = 1;
+ }
+ else {
+ m78B = 0;
+ }
+
+ if (!strcmp(dComIfGp_getStartStageName(), "GanonK")) {
+ m784 = 1;
+ }
+ else {
+ m784 = 0;
+ }
+
+ if (!strcmp(dComIfGp_getStartStageName(), "GTower")) {
+ m785 = 1;
+ }
+ else {
+ m785 = 0;
+ }
+
+ if (!(strcmp(dComIfGp_getStartStageName(), "Asoko") &&
+ strcmp(dComIfGp_getStartStageName(), "Abship") &&
+ strcmp(dComIfGp_getStartStageName(), "PShip"))) {
+ m781 = 1;
+ }
+ else {
+ m781 = 0;
+ }
+
+ if (!strcmp(dComIfGp_getStartStageName(), "Obshop")) {
+ m782 = 1;
+ }
+ else {
+ m782 = 0;
+ }
+
+ if (!strcmp(dComIfGp_getStartStageName(), "A_umikz")) {
+ m783 = 1;
+ }
+ else {
+ m783 = 0;
+ }
+
+ m534 = 0;
+ m536 = 0x180;
+
+ if (m781) {
+ m530 = 1;
+ m540 = 1.0f;
+ m538 = daObjPirateship::getShipOffsetY(&m534, &m536, 130.0f);
+ m538 *= m540;
+ }
+ else if (m782) {
+ m530 = 2;
+ m540 = 0.12f;
+ m538 = daObjPirateship::getShipOffsetY(&m534, &m536, 130.0f);
+ m538 *= m540;
+ }
+ else if (m783) {
+ m530 = 3;
+ m540 = 1.0f;
+ m538 = daObjPirateship::getShipOffsetY(&m534, &m536, 130.0f);;
+ m538 *= m540;
+ }
+ else {
+ m530 = 0;
+ m538 = 0.0f;
+ m540 = 0.0f;
+ }
+
+ mCamParam.Change(mCurStyle);
+
+ cXyz attnPos = attentionPos(mpPlayerActor);
+ attnPos.y += mCamParam.CenterHeight(0.0f);
+
+ m044 = attnPos + cSGlobe(0.0f, cSAngle((s16)0), directionOf(mpPlayerActor)).Xyz();
+
+ mCenter = m044;
+
+ m03C.Val(200.0f, 0, directionOf(mpPlayerActor).Inv());
+
+ mDirection = m03C;
+
+ m050 = m044 + m03C.Xyz();
+
+ mEye = m050;
+
+ mAngleY = cSAngle(mDirection.U().Inv());
+
+ mUp.x = 0.0f;
+ mUp.y = 1.0f;
+ mUp.z = 0.0f;
+
+ mBank = cSAngle::_0;
+
+ m05C = mBank;
+
+ m060 = mFovY = mCamParam.Fovy(0.0f);
+
+ mDMCSystem.field_0x0 = 0;
}
/* 80162128-80162134 .text Start__9dCamera_cFv */
void dCamera_c::Start() {
- /* Nonmatching */
+ m004 = 1;
}
/* 80162134-80162140 .text Stop__9dCamera_cFv */
void dCamera_c::Stop() {
- /* Nonmatching */
+ m004 = 0;
}
/* 80162140-8016214C .text Stay__9dCamera_cFv */
void dCamera_c::Stay() {
- /* Nonmatching */
+ m005 = 1;
}
/* 8016214C-801621A0 .text ChangeModeOK__9dCamera_cFl */
-void dCamera_c::ChangeModeOK(s32) {
- /* Nonmatching */
+bool dCamera_c::ChangeModeOK(s32 param_1) {
+ if (dComIfGp_evmng_cameraPlay() || chkFlag(0x20000000)) {
+ return 0;
+ }
+ return !(types[mCurType].mStyles[0][param_1] < 0);
}
/* 801621A0-801623A0 .text initPad__9dCamera_cFv */
void dCamera_c::initPad() {
- /* Nonmatching */
+ mStickMainPosXLast = g_mDoCPd_cpadInfo[mPadId].mMainStickPosX;
+ mStickMainPosYLast = g_mDoCPd_cpadInfo[mPadId].mMainStickPosY;
+ mStickMainValueLast = g_mDoCPd_cpadInfo[mPadId].mMainStickValue;
+
+ mStickMainPosXDelta = 0.0f;
+ mStickMainPosYDelta = 0.0f;
+ mStickMainValueDelta = 0.0f;
+
+ mStickCPosXLast = g_mDoCPd_cpadInfo[mPadId].mCStickPosX;
+ mStickCPosYLast = g_mDoCPd_cpadInfo[mPadId].mCStickPosY;
+ mStickCValueLast = g_mDoCPd_cpadInfo[mPadId].mCStickValue;
+
+ mStickCPosXDelta = 0.0f;
+ mStickCPosYDelta = 0.0f;
+ mStickCValueDelta = 0.0f;
+
+ m18C = 0;
+ m188 = 0;
+ m184 = 0;
+
+ mTriggerLeftLast = g_mDoCPd_cpadInfo[mPadId].mTriggerLeft;
+ mTriggerLeftDelta = 0.0f;
+
+ mHoldLockL = FALSE;
+ mTrigLockL = FALSE;
+ m19A = 0;
+ m19B = 0;
+
+ mTriggerRightLast = g_mDoCPd_cpadInfo[mPadId].mTriggerRight;
+ mTriggerRightDelta = 0.0f;
+
+ mHoldLockR = 0;
+ mTrigLockR = 0;
+ m1A6 = 0;
+ m1A7 = 0;
+
+ mHoldX = (bool)CPad_CHECK_HOLD_X(mPadId);
+ mTrigX = (bool)CPad_CHECK_TRIG_X(mPadId);
+
+ mHoldY = (bool)CPad_CHECK_HOLD_Y(mPadId);
+ mTrigY = (bool)CPad_CHECK_TRIG_Y(mPadId);
+
+ mHoldY = (bool)CPad_CHECK_HOLD_Y(mPadId);
+ mTrigY = (bool)CPad_CHECK_TRIG_Y(mPadId);
+
+ mHoldZ = (bool)CPad_CHECK_HOLD_Z(mPadId);
+ mTrigZ = (bool)CPad_CHECK_TRIG_Z(mPadId);
+
+ m1AE = 0;
}
/* 801623A0-80162710 .text updatePad__9dCamera_cFv */
void dCamera_c::updatePad() {
- /* Nonmatching */
+ float fVar1;
+ float fVar2;
+ float fVar3;
+ cSAngle local_48;
+
+ if (chkFlag(0x1000000)) {
+ fVar1 = 0.0f;
+ fVar2 = 0.0f;
+ fVar3 = 0.0f;
+ }
+ else {
+ fVar1 = g_mDoCPd_cpadInfo[mPadId].mMainStickPosX;
+ fVar2 = g_mDoCPd_cpadInfo[mPadId].mMainStickPosY;
+ fVar3 = g_mDoCPd_cpadInfo[mPadId].mMainStickValue;
+ }
+
+ cSAngle(g_mDoCPd_cpadInfo[mPadId].mMainStickAngle); // Unused object? Code matches so perhaps a developer oversight
+
+ mStickMainPosXDelta = fVar1 - mStickMainPosXLast;
+ mStickMainPosYDelta = fVar2 - mStickMainPosYLast;
+ mStickMainValueDelta = fVar3 - mStickMainValueLast;
+
+ mStickMainPosXLast = fVar1;
+ mStickMainPosYLast = fVar2;
+ mStickMainValueLast = fVar3;
+
+ if (chkFlag(0x800000)) {
+ fVar1 = 0.0f;
+ fVar2 = 0.0f;
+ fVar3 = 0.0f;
+ }
+ else {
+ fVar1 = g_mDoCPd_cpadInfo[mPadId].mCStickPosX;
+ fVar2 = g_mDoCPd_cpadInfo[mPadId].mCStickPosY;
+ fVar3 = g_mDoCPd_cpadInfo[mPadId].mCStickValue;
+ }
+
+ mStickCPosXDelta = fVar1 - mStickCPosXLast;
+ mStickCPosYDelta = fVar2 - mStickCPosYLast;
+ mStickCValueDelta = fVar3 - mStickCValueLast;
+
+ mStickCPosXLast = fVar1;
+ mStickCPosYLast = fVar2;
+ mStickCValueLast = fVar3;
+
+ fVar1 = g_mDoCPd_cpadInfo[mPadId].mTriggerLeft;
+ mTriggerLeftDelta = mTriggerLeftLast - fVar1;
+ mTriggerLeftLast = fVar1;
+
+ mHoldLockL = (bool)g_mDoCPd_cpadInfo[mPadId].mHoldLockL;
+ mTrigLockL = (bool)g_mDoCPd_cpadInfo[mPadId].mTrigLockL;
+
+ if (mTriggerLeftLast > mCamSetup.m0A0) {
+ if (m19A == 0) {
+ m19B = 1;
+ }
+ else {
+ m19B = 0;
+ }
+
+ m19A = 1;
+ }
+ else {
+ m19B = 0;
+ m19A = 0;
+ }
+
+ fVar1 = g_mDoCPd_cpadInfo[mPadId].mTriggerRight;
+ mTriggerRightDelta = mTriggerRightLast - fVar1;
+ mTriggerRightLast = fVar1;
+
+ mHoldLockR = (bool)g_mDoCPd_cpadInfo[mPadId].mHoldLockR;
+ mTrigLockR = (bool)g_mDoCPd_cpadInfo[mPadId].mTrigLockR;
+
+ if (mTriggerRightLast > mCamSetup.m0A0) {
+ if (m1A6 == 0) {
+ m1A7 = 1;
+ }
+ else {
+ m1A7 = 0;
+ }
+
+ m1A6 = 1;
+ }
+ else {
+ m1A7 = 0;
+ m1A6 = 0;
+ }
+
+
+ mHoldX = (bool)CPad_CHECK_HOLD_X(mPadId);
+ mTrigX = (bool)CPad_CHECK_TRIG_X(mPadId);
+
+ mHoldY = (bool)CPad_CHECK_HOLD_Y(mPadId);
+ mTrigY = (bool)CPad_CHECK_TRIG_Y(mPadId);
+
+ mHoldZ = (bool)CPad_CHECK_HOLD_B(mPadId); // mHoldZ might not be the appropriate name for this?
+ mTrigZ = (bool)CPad_CHECK_TRIG_B(mPadId); // likewise for mTrigZ
+
+ m1AE = 0;
}
/* 80162710-801627A4 .text initMonitor__9dCamera_cFv */
void dCamera_c::initMonitor() {
- /* Nonmatching */
+ if (mpPlayerActor) {
+ mMonitoringThings.mPos = positionOf(mpPlayerActor);
+ }
+ else {
+ mMonitoringThings.mPos = cXyz::Zero;
+ }
+
+ mMonitoringThings.field_0x0C.z = 0.0f;
+ mMonitoringThings.field_0x0C.y = 0.0f;
+ mMonitoringThings.field_0x0C.x = 0.0f;
+ mMonitoringThings.field_0x10 = 0;
+ mMonitoringThings.field_0x14 = 0.0f;
}
/* 801627A4-801628DC .text updateMonitor__9dCamera_cFv */
void dCamera_c::updateMonitor() {
- /* Nonmatching */
+ /* Nonmatching - Code 100%, mBG offset issue */
+ float playerMonitorHorizontalDist;
+ cXyz playerPos;
+
+ if (mpPlayerActor != NULL) {
+ playerPos = positionOf(mpPlayerActor);
+
+ if (m31D != 0) {
+ dComIfG_Bgsp()->MoveBgMatrixCrrPos(mBG.m5C, TRUE, &mMonitoringThings.mPos, NULL, NULL);
+ }
+
+ playerMonitorHorizontalDist = dCamMath::xyzHorizontalDistance(playerPos, mMonitoringThings.mPos);
+
+ mMonitoringThings.field_0x0C.z = playerMonitorHorizontalDist - mMonitoringThings.field_0x0C.x;
+
+ mMonitoringThings.field_0x0C.y += (playerMonitorHorizontalDist - mMonitoringThings.field_0x0C.y) * 0.075f;
+
+ mMonitoringThings.field_0x0C.x = playerMonitorHorizontalDist;
+
+ mMonitoringThings.mPos = playerPos;
+
+ if (!m144 && *(u16*)&g_mDoCPd_cpadInfo[0].mButtonHold == 0 && mStickMainValueLast < 0.05f && mStickCValueLast < 0.05f) { // Possible union between u16 and bitfield rather than *(u16*) cast
+ mMonitoringThings.field_0x10++;
+ }
+ else {
+ mMonitoringThings.field_0x10 = 0;
+ }
+
+ mMonitoringThings.field_0x14 = mDirection.R() - mMonitoringThings.field_0x14;
+ }
}
/* 801628DC-80163020 .text calcPeepAngle__9dCamera_cFv */
-void dCamera_c::calcPeepAngle() {
- /* Nonmatching */
-}
+cSAngle dCamera_c::calcPeepAngle() {
+ cSAngle res(cSAngle::_0);
+
+ if (check_owner_action(mPadId, 0x20)) {
+ f32 temp_30 = 30.0f;
+ cXyz local_b8(0.0f, 0.0f, -temp_30);
-/* 80163020-8016319C .text __dt__21dBgS_CamLinChk_NorWtrFv */
-dBgS_CamLinChk_NorWtr::~dBgS_CamLinChk_NorWtr() {
- /* Nonmatching */
+ f32 temp_50 = 50.0f;
+ cXyz local_ac(-temp_50, 0.0f, -temp_30);
+
+ cXyz local_a0(relationalPos(mpPlayerActor, &local_b8));
+ cXyz local_94(relationalPos(mpPlayerActor, &local_ac));
+
+ dBgS_CamLinChk_NorWtr lin_chk;
+
+ if (lineBGCheck(&local_94, &local_a0, &lin_chk, 0x7f)) {
+ cM3dGPla* plane = dComIfG_Bgsp()->GetTriPla(lin_chk);
+ res = cSAngle::_90 + (cSGlobe(plane->mNormal).U() - directionOf(mpPlayerActor)); // GetNP() doesn't work?
+ }
+ }
+ else if (check_owner_action(mPadId, 0x40)) {
+ f32 temp_30 = 30.0f;
+ cXyz local_88(0.0f, 0.0f, -temp_30);
+
+ cXyz local_7c(50.0f, 0.0f, -temp_30);
+
+ cXyz local_70(relationalPos(mpPlayerActor, &local_88));
+ cXyz local_64(relationalPos(mpPlayerActor, &local_7c));
+
+ dBgS_CamLinChk_NorWtr lin_chk;
+
+ if (lineBGCheck(&local_64, &local_70, &lin_chk, 0x7f)) {
+ cM3dGPla* plane = dComIfG_Bgsp()->GetTriPla(lin_chk);
+ res = cSAngle::_270 + (cSGlobe(plane->mNormal).U() - directionOf(mpPlayerActor));
+ }
+ }
+ return cSAngle(res);
}
/* 801632F0-8016336C .text Att__9dCamera_cFv */
void dCamera_c::Att() {
- /* Nonmatching */
+ fopAc_ac_c* target;
+
+ if (mpPlayerActor && !chkFlag(0x2000000)) {
+ if (dComIfGp_getAttention().LockonTruth()) {
+ target = dComIfGp_getAttention().LockonTarget(0);
+ }
+ else {
+ target = NULL;
+ }
+
+ mpLockonTarget = target;
+ }
}
/* 8016336C-80163514 .text checkForceLockTarget__9dCamera_cFv */
-void dCamera_c::checkForceLockTarget() {
- /* Nonmatching */
+bool dCamera_c::checkForceLockTarget() {
+ bool res = TRUE;
+
+ if (mLockOnActorId != fpcM_ERROR_PROCESS_ID_e) {
+ mpLockonActor = GetForceLockOnActor();
+
+ if (mpLockonActor) {
+ if (dComIfGp_getAttention().Lockon() || mForceLockTimer > mCamSetup.ForceLockOffTimer() ||
+ cXyz(positionOf(mpLockonActor) - positionOf(mpPlayerActor)).abs() > mCamSetup.ForceLockOffDist()) {
+ res = FALSE;
+ }
+ }
+ else {
+ res = FALSE;
+ }
+ }
+ else {
+ res = FALSE;
+ }
+
+ return res;
}
/* 80163514-80163EF4 .text Run__9dCamera_cFv */
-void dCamera_c::Run() {
- /* Nonmatching */
+bool dCamera_c::Run() {
+ /* Nonmatching */
+ float fVar1;
+ float fVar3;
+ bool bVar4;
+ uint uVar5;
+ long next;
+ dCamera_c* camera;
+ cSAngle local_40 ;
+
+ bool res = FALSE;
+
+ camera = (dCamera_c *)0x0;
+
+ mForcusLine.Off();
+
+ clrFlag(0x10149C01);
+
+ checkSpecialArea();
+
+ checkGroundInfo();
+
+ if (m530 && !chkFlag(0x200000)) {
+ if (!(dComIfGp_evmng_cameraPlay() || chkFlag(0x20000000))) {
+ fVar1 = daObjPirateship::getShipOffsetY(&m534, &m536, 130.0f) * m540; //regswap
+ fVar3 = fVar1 - m538;
+ if (((m530 == 1) && (m53C < 0.0f)) && (fVar3 > 0.0f)) {
+ m254 |= 4;
+ }
+ m53C = fVar3;
+ m538 = fVar1;
+ m044.y -= m53C * mCamSetup.mManualStartCThreshold;
+ }
+ }
+
+ updateMonitor();
+
+ Att();
+
+ dComIfGp_offCameraAttentionStatus(mCameraInfoIdx, 0x3400);
+
+ if (!(dComIfGp_evmng_cameraPlay() || chkFlag(0x20000000))) {
+ updatePad();
+ mCamSetup.mCstick.Shift(mPadId);
+ }
+
+ if (dComIfGp_getMiniGameType() == 8) {
+ updatePad();
+ mCamSetup.mCstick.Shift(mPadId);
+ }
+
+ if (dComIfGp_getAttention().Lockon()) {
+ setFlag(0x1000);
+ }
+
+ if (!checkForceLockTarget()) {
+ mLockOnActorId = fpcM_ERROR_PROCESS_ID_e;
+ }
+ else {
+ mForceLockTimer++;
+ }
+
+ mNextType = nextType(mCurType);
+
+ if (mNextType != mCurType && onTypeChange(mCurType, mNextType)) {
+ mCurType = mNextType;
+ }
+
+ mNextMode = nextMode(mCurMode);
+ next = mNextMode;
+
+ if (next != mCurMode) {
+ if (types[mCurType].mStyles[0][next] >= 0 && onModeChange(mCurMode, next)) {
+ mCurMode = mNextMode;
+ }
+ }
+
+ if (types[mCurType].mStyles[0][mCurMode] < 0) {
+ mCurMode = 0;
+ }
+
+ short curStyle = types[mCurType].mStyles[0][mCurMode];
+ if (curStyle >= 0) {
+ if (mCurStyle != curStyle && onStyleChange(mCurStyle, curStyle)) {
+ mCurStyle = (int)types[mCurType].mStyles[0][mCurMode];
+ mCamParam.Change(mCurStyle);
+ }
+ }
+
+ clrFlag(0x20);
+
+ if (mCurMode == 0xc) {
+ setFlag(0x20);
+ }
+
+ clrFlag(0x80000000);
+
+ dComIfGp_offCameraAttentionStatus(mCameraInfoIdx, 0x80);
+
+ if (mCamParam.CheckFlag(4) && !check_owner_action(mPadId, 0x4000000) && !check_owner_action1(mPadId, 0x40000)) {
+ m148 += (forwardCheckAngle() - m148) * mCamSetup.mBGChk.FwdCushion();
+ }
+ else {
+ m148 = cSAngle::_0;
+ }
+
+ defaultTriming();
+
+ mTrimTypeForce = -1;
+ m068 = 9;
+
+ if (chkFlag(0x200000) && dCamParam_c::styles[mCurStyle].engineIdx != 11) {
+ if (push_any_key(mPadId) || mMonitoringThings.field_0x0C.x > 10.0f || !m360 || m31C) {
+ clrFlag(0x200000);
+ }
+ }
+ else if (g_dComIfG_gameInfo.play.mDemo->getObject()->getActiveCamera() && mCamParam.Algorythmn() != 11) {
+ camera = (dCamera_c *)demoCamera(0);
+ }
+ else {
+ // Issues here
+ camera = this;
+ res = (this->*engine_tbl[dCamParam_c::styles[mCurStyle].engineIdx])(mCurStyle);
+ m07C++;
+ m080++;
+ m118++;
+ m108++;
+ m11C++;
+ }
+
+ if (!res) {
+ m514 = 0;
+ }
+
+ if (!chkFlag(0x400)) {
+ m05C -= m05C * 0.05f;
+ }
+
+ shakeCamera();
+
+ clrFlag(0x90080);
+
+ if (mCamParam.CheckFlag(1)) {
+ m068 = 0x3F;
+ }
+ else if (mCamParam.CheckFlag(2)) {
+ m068 = 0xF;
+ }
+
+ if (mCamParam.CheckFlag(0x400)) {
+ m068 |= 0x40;
+ }
+
+ fVar1 = m354 + mCamSetup.mBGChk.FloorMargin();
+
+ if (m044.y < fVar1) {
+ mCenter.x = m044.x;
+ mCenter.z = m044.z;
+
+ if ((dCamParam_c::styles[mCurStyle].engineIdx == 4) && chkFlag(0x10000800)) {
+ m068 &= ~8;
+ mCenter.y = m044.y;
+ }
+ else {
+ mCenter.y = fVar1;
+ }
+ }
+ else {
+ mCenter = m044;
+ }
+
+ mFovY = m060;
+
+ mBank = m05C;
+
+ bumpCheck(m068);
+
+ cSAngle angle(cSAngle(g_mDoCPd_cpadInfo[mPadId].mMainStickAngle) - mDMCSystem.field_0x4);
+
+ if (mStickMainValueLast < mCamSetup.DMCValue() || angle > cSAngle(mCamSetup.DMCAngle()) || angle < cSAngle(-mCamSetup.DMCAngle())) {
+ mDMCSystem.field_0x0 = 0;
+ }
+
+ if (mDMCSystem.field_0x0) {
+ mAngleY = getDMCAngle(cSAngle(g_mDoCPd_cpadInfo[mPadId].mMainStickAngle));
+ }
+ else {
+ mAngleY = cSAngle(mDirection.U().Inv());
+ }
+
+ if (mCenter.x == mEye.x && mCenter.z == mEye.z) {
+ mUp.x = 0.01f;
+ mUp.y = 1.0f;
+ mUp.z = 0.0f;
+ }
+ else if (m006 >= cSAngle(-90.0f) && mDirection.V() <= cSAngle(90.0f)) {
+ mUp.x = 0.0f;
+ mUp.y = 1.0f;
+ mUp.z = 0.0f;
+ }
+ else {
+ mUp.x = 0.0f;
+ mUp.y = -1.0f;
+ mUp.z = 0.0f;
+ }
+
+ for (u32 i = 0; i < 3; i++) {
+ bool playSound = FALSE;
+ if (m254 & uVar5 && (m258 & uVar5) == 0) { // Inline?
+ playSound = TRUE;
+ }
+ if (playSound) {
+ mDoAud_seStart(m248[i]);
+ }
+ }
+
+ m258 = m254;
+ m254 = 0;
+
+ bVar4 = FALSE;
+ if (m100 && m101 && m102) { // Also Inline?
+ bVar4 = TRUE;
+ }
+
+ if (bVar4) {
+ dComIfGp_onCameraAttentionStatus(mCameraInfoIdx, 0x10);
+ }
+ else {
+ dComIfGp_offCameraAttentionStatus(mCameraInfoIdx, 0x10);
+ }
+
+ if (chkFlag(0x40000)) {
+ dComIfGp_onCameraAttentionStatus(mCameraInfoIdx, 2);
+ }
+ else {
+ if (mDirection.R() < mCamSetup.m048) {
+ if (chkFlag(0x800)) {
+ dComIfGp_onCameraAttentionStatus(mCameraInfoIdx, 2);
+ }
+ if (chkFlag(0x10000000)) {
+ dComIfGp_onCameraAttentionStatus(mCameraInfoIdx, 0x20);
+ }
+ }
+ }
+
+ return res;
}
/* 80163EF4-801640A8 .text NotRun__9dCamera_cFv */
-void dCamera_c::NotRun() {
- /* Nonmatching */
+bool dCamera_c::NotRun() {
+ clrFlag(0x90149C21);
+
+ checkGroundInfo();
+
+ dComIfGp_offCameraAttentionStatus(mCameraInfoIdx, 0x80);
+
+ if (dComIfGp_evmng_cameraPlay() || chkFlag(0x20000000)) {
+ if (mCurType != mCamTypeEvent) {
+ pushPos();
+
+ mEventData.field_0x0c = mCurType;
+ }
+
+ mCurType = mCamTypeEvent;
+
+ eventCamera(types[mCurType].mStyles[0][3]);
+
+ m07C++;
+ m118++;
+ m108++;
+ m11C++;
+ }
+
+ if (dComIfGp_event_runCheck()) {
+ dComIfGp_offCameraAttentionStatus(mCameraInfoIdx, 0x48);
+ }
+
+ dComIfGp_onCameraAttentionStatus(mCameraInfoIdx, 0x14);
+
+ clrFlag(0x90080);
+
+ mForcusLine.Off();
+
+ shakeCamera();
+
+ m005 = 0;
+
+ if (dComIfGp_checkCameraAttentionStatus(mCameraInfoIdx, 8)) {
+ if (chkFlag(0x400000)) {
+ setView(160.0f, 35.0f, 320.0f, 320.0f);
+ }
+ else {
+ setView(0.0f, 0.0f, 640.0f, 480.0f);
+ }
+ }
+ return TRUE;
}
/* 801640A8-801640B4 .text SetTrimSize__9dCamera_cFl */
-void dCamera_c::SetTrimSize(s32) {
- /* Nonmatching */
+bool dCamera_c::SetTrimSize(s32 size) {
+ mTrimSize = size;
+ return TRUE;
}
/* 801640B4-801640C0 .text SetTrimTypeForce__9dCamera_cFl */
-void dCamera_c::SetTrimTypeForce(s32) {
- /* Nonmatching */
+bool dCamera_c::SetTrimTypeForce(s32 force) {
+ mTrimTypeForce = force;
+ return TRUE;
}
/* 801640C0-80164164 .text CalcTrimSize__9dCamera_cFv */
void dCamera_c::CalcTrimSize() {
- /* Nonmatching */
+ switch (mTrimSize) {
+ case 0:
+ mTrimHeight += -mTrimHeight * 0.25f;
+ break;
+ case 2:
+ mTrimHeight += (mCamSetup.CinemaScopeTrimHeight() - mTrimHeight) * 0.25f;
+ break;
+ case 1:
+ mTrimHeight += (mCamSetup.VistaTrimHeight() - mTrimHeight) * 0.25f;
+ break;
+ case 3:
+ mTrimHeight = mCamSetup.CinemaScopeTrimHeight();
+ break;
+ case 4:
+ mTrimHeight = 0.0f;
+ break;
+ }
}
/* 80164164-8016418C .text Draw__9dCamera_cFv */
-void dCamera_c::Draw() {
- /* Nonmatching */
+bool dCamera_c::Draw() {
+ mForcusLine.Draw();
+ return TRUE;
}
/* 8016418C-80164898 .text nextMode__9dCamera_cFl */
-void dCamera_c::nextMode(s32) {
- /* Nonmatching */
+int dCamera_c::nextMode(s32 i_curMode) {
+ /* Nonmatching - regswap */
+ dAttention_c& attn = dComIfGp_getAttention();
+ s32 next_mode = i_curMode;
+ cXyz player_pos = positionOf(mpPlayerActor);
+
+ if (!dComIfGp_evmng_cameraPlay()) {
+ if (mBG.m58 > player_pos.y) {
+ m1AE = 0;
+ }
+ switch(i_curMode) {
+ case 4:
+ case 10:
+ case 11:
+ case 13:
+ case 14:
+ m144 = 1;
+ m184 = 0;
+ break;
+ case 5:
+ case 6:
+ m144 = 1;
+ m184 = 0;
+ case 1:
+ mpLockonTarget = NULL;
+ default:
+ if (m19B) {
+ m144 = 1;
+ m184 = 0;
+ }
+ else {
+ if (mStickCPosYLast <= 0.0f && mStickCValueLast > mCamSetup.m09C) {
+ m144 = 0;
+ }
+ else {
+ if (i_curMode == 0 || i_curMode == 0x13) {
+ positionOf(mpPlayerActor);
+ if (
+ !(
+ mStickMainValueLast >= 0.5f ||
+ attn.LockonTruth() ||
+ check_owner_action(mPadId, 0x100000))
+ ) {
+ if (m184 == 1) {
+ if (mStickCPosYLast < mCamSetup.mCstick.m00) {
+ m184 = 0;
+ }
+ }
+ else if (mStickCPosYLast > mCamSetup.mCstick.m04) {
+ dComIfGp_onCameraAttentionStatus(mCameraInfoIdx, 0x1000);
+ m184 = 1;
+ dComIfGp_onCameraAttentionStatus(mCameraInfoIdx, 0x400);
+ }
+ else {
+ dComIfGp_onCameraAttentionStatus(mCameraInfoIdx, 0x400);
+ }
+ }
+ }
+ }
+ }
+ break;
+ case 12:
+ if (mStickCValueLast < 0.01f && mDirection.R() < mCamSetup.m098 || chkFlag(0x80000000)) {
+ m144 = 1;
+ m184 = 0;
+ }
+ else if (m19B != 0) {
+ m144 = 1;
+ m184 = 0;
+ }
+ break;
+ }
+ if (chkFlag(0x4000000)) {
+ if (m144 == 0) {
+ m254 |= 1;
+ }
+
+ if (check_owner_action(mPadId, 0x80000000)) {
+ setFlag(0x8000);
+ }
+
+ m144 = 1;
+
+ clrFlag(0x4000000);
+ }
+
+ if (mLockOnActorId != fpcM_ERROR_PROCESS_ID_e && mpLockonActor && fopAcM_GetName(mpLockonActor) == PROC_NPC_MD) {
+ m144 = 1;
+ i_curMode = 0;
+ }
+
+ if (i_curMode == 12 && m144 != 0) {
+ next_mode = 0;
+ }
+ else if (check_owner_action(mPadId, 0x200000) || check_owner_action1(mPadId, 8)) {
+ next_mode = 14;
+ }
+ else if (check_owner_action(mPadId, 0x80000080)) {
+ next_mode = 0x11;
+ }
+ else if (check_owner_action(mPadId, 0x800000)) {
+ if (m144 == 0) {
+ next_mode = 0xc;
+ }
+ else {
+ next_mode = 0x12;
+ }
+ }
+ else if (check_owner_action1(mPadId, 0x10)) {
+ next_mode = 0xf;
+ }
+ else if (check_owner_action(mPadId, 0x2000)) {
+ next_mode = 4;
+ }
+ else {
+ if (check_owner_action(mPadId, 0x25000) && !attn.Lockon()) {
+ next_mode = 10;
+ } else if (check_owner_action(mPadId, 0x80000) && !attn.Lockon()) {
+ next_mode = 11;
+ } else if (m144 == 0) {
+ next_mode = 12;
+ }
+ else if (check_owner_action1(mPadId, 2)) {
+ next_mode = 5;
+ }
+ else if (check_owner_action1(mPadId, 4)) {
+ next_mode = 6;
+ }
+ else if (check_owner_action(mPadId, 0x60)) {
+ next_mode = 6;
+ }
+ else if (check_owner_action(mPadId, 0x61)) {
+ next_mode = 5;
+ }
+ else if (check_owner_action(mPadId, 0x406) && i_curMode != 12) {
+ if (mpLockonTarget) {
+ next_mode = 8;
+ }
+ }
+ else if (attn.LockonTruth() && !check_owner_action(mPadId, 0xC000000)) {
+ next_mode = 2;
+ }
+ else if (attn.Lockon()) {
+ next_mode = 1;
+ }
+ else if (check_owner_action(mPadId, 0x400000) && !check_owner_action(mPadId, 0x36a02371) && !check_owner_action1(mPadId, 0x11)) {
+ mpLockonTarget = get_boomerang_actor(mpPlayerActor);
+ next_mode = 2;
+ mLockOnActorId = fpcM_ERROR_PROCESS_ID_e;
+ }
+ else if (isPlayerGuarding(mPadId)) {
+ next_mode = 19;
+ }
+ else if (mLockOnActorId != fpcM_ERROR_PROCESS_ID_e) {
+ if (mpLockonActor) {
+ next_mode = 2;
+ mpLockonTarget = mpLockonActor;
+ }
+ else {
+ next_mode = 0;
+ mLockOnActorId = fpcM_ERROR_PROCESS_ID_e;
+ }
+ }
+ else {
+ switch (i_curMode) {
+ case 12:
+ if (m144 != 0) {
+ next_mode = 0;
+ }
+ break;
+ default:
+ next_mode = 0;
+ }
+ }
+ }
+ }
+
+ if (next_mode != 2) {
+ mLockOnActorId = fpcM_ERROR_PROCESS_ID_e;
+ }
+
+ if (next_mode == 12 && types[mCurType].mStyles[0][next_mode] < 0) {
+ next_mode = i_curMode;
+ if (mCurType != mCamTypeEvent && mCurType != mCamTypeBoat && mCurType != mCamTypeBoatBattle && mCurType != mCamTypeRestrict) {
+ m254 |= 1;
+ }
+ m144 = 1;
+ }
+
+ if (types[mCurType].mStyles[0][next_mode] >= 0) {
+ if (next_mode == 1) {
+ setFlag(0x100000);
+ }
+ return next_mode;
+ }
+
+ return i_curMode;
}
/* 80164898-80164A48 .text onModeChange__9dCamera_cFll */
-void dCamera_c::onModeChange(s32, s32) {
- /* Nonmatching */
+bool dCamera_c::onModeChange(s32 i_curMode, s32 i_nextMode) {
+ if (i_curMode == 0xe && mCamParam.CheckFlag(0x10)) {
+ setView(0.0f, 0.0f, 640.0f, 480.0f);
+ }
+
+ m108 = 0;
+ m100 = 0;
+ m101 = 0;
+ m102 = 0;
+ m10C = 0;
+ m110 = 1;
+ m14C = 0.0f;
+
+ clrFlag(0x11E);
+ clrFlag(0x2000);
+
+ switch (i_curMode) {
+ case 3:
+ dComIfGp_offCameraAttentionStatus(mCameraInfoIdx, 4);
+ break;
+ case 4:
+ case 10:
+ case 11:
+ case 13:
+ case 14:
+ break;
+ }
+
+ switch(i_nextMode) {
+ case 7:
+ setFlag(0x10);
+ break;
+ case 0:
+ if (i_curMode == 1 && types[mCurType].mStyles[0][0] == types[mCurType].mStyles[0][1]) {
+ m110 = 0;
+ }
+ break;
+ case 1:
+ if (i_curMode == 0 && types[mCurType].mStyles[0][0] == types[mCurType].mStyles[0][1]) {
+ m110 = 0;
+ }
+ break;
+ case 12:
+ if (i_curMode != i_nextMode) {
+ m254 |= 2;
+ }
+ break;
+ case 4:
+ break;
+ }
+ return TRUE;
}
/* 80164A48-80164CEC .text nextType__9dCamera_cFl */
-void dCamera_c::nextType(s32) {
- /* Nonmatching */
+int dCamera_c::nextType(s32 curType) {
+ int idx;
+ int roomNo;
+
+ s32 nextType = curType;
+
+ if (dComIfGp_evmng_cameraPlay() || chkFlag(0x20000000)) {
+ nextType = mCamTypeEvent;
+ if (curType != nextType) {
+ clrFlag(0x200000);
+ if (curType != mCamTypeEvent) {
+ pushPos();
+ mEventData.field_0x0c = curType;
+ }
+ }
+ }
+ else {
+ if (mpPlayerActor && m514 != 1) {
+ if (curType == mCamTypeEvent) {
+ nextType = mEventData.field_0x0c;
+ mEventData.field_0x0c = -1;
+ }
+
+ if (daNpc_kam_c::m_hyoi_kamome) {
+ nextType = GetCameraTypeFromCameraName("Seagal");
+ }
+ else if ((check_owner_action(mPadId, 0x1010000) || check_owner_action1(mPadId, 0x80)) && m524 == 0xFF) {
+ nextType = mCamTypeBoat;
+ }
+ else {
+ roomNo = -1;
+
+ if (mStageMapToolCameraIdx != 0xff) {
+ idx = mStageMapToolCameraIdx;
+ }
+ else {
+ if (mRoomNo != -1) {
+ roomNo = mRoomNo;
+ }
+ idx = mRoomMapToolCameraIdx;
+ }
+
+ if (m524 != 0xff) {
+ nextType = m524;
+ if (m528) {
+ mpLockonTarget = m528;
+ }
+ }
+ else if (idx == 0xff) {
+ idx = m350;
+ if (idx > 0) {
+ if (idx < mvBGType_num) {
+ int cameraTypeFromCameraName = GetCameraTypeFromCameraName(mvBGTypes[idx]);
+
+ if (cameraTypeFromCameraName != mCamTypeKeep) {
+ nextType = cameraTypeFromCameraName;
+ }
+
+ if (m350 == 0x11) {
+ roomNo = fopAcM_GetRoomNo(mpPlayerActor);
+ GetCameraTypeFromMapToolID(0, roomNo);
+ }
+ }
+ }
+ else {
+ if (check_owner_action(mPadId, 0x100000)) {
+ nextType = mCamTypeWater;
+ }
+ else {
+ nextType = mMapToolType;
+ }
+ }
+ }
+ else if (idx == 0x1ff) {
+ if (check_owner_action1(mPadId, 0x20)) {
+ nextType = mMapToolType;
+ }
+ else if (check_owner_action(mPadId, 0x100000)) {
+ nextType = mCamTypeWater;
+ }
+
+ if (curType == mCamTypeBoat || curType == GetCameraTypeFromCameraName("BoatBattle")) {
+ nextType = mCamTypeWater;
+ }
+ }
+ else {
+ int cameraTypeFromMapToolId = GetCameraTypeFromMapToolID(idx, roomNo);
+
+ if (cameraTypeFromMapToolId == mCamTypeKeep) {
+ nextType = curType;
+ }
+ else if (cameraTypeFromMapToolId != 0xff) {
+ nextType = cameraTypeFromMapToolId;
+ }
+ else {
+ nextType = mMapToolType;
+ }
+ }
+ }
+ }
+ }
+
+ m524 = 0xFF;
+ m528 = NULL;
+ return nextType;
}
/* 80164CEC-80164DB4 .text onTypeChange__9dCamera_cFll */
-void dCamera_c::onTypeChange(s32, s32) {
- /* Nonmatching */
+bool dCamera_c::onTypeChange(s32 i_curType, s32 i_nextType) {
+ s32 mode;
+
+ m118 = 0;
+ m114 = 0;
+ mode = mCurMode;
+ if (m144 == 0) {
+ s32 style = types[i_nextType].mStyles[0][0];
+ if (style >= 0) {
+ switch (dCamParam_c::styles[style].engineIdx) {
+ case 5:
+ case 6:
+ case 11:
+ case 12:
+ case 13:
+ mode = 0;
+ m144 = 1;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ if (onModeChange(mCurMode, mode)) {
+ m11C = 0;
+ }
+
+ return TRUE;
}
/* 80164DB4-80164DFC .text SetTypeForce__9dCamera_cFPcP10fopAc_ac_c */
-void dCamera_c::SetTypeForce(char*, fopAc_ac_c*) {
- /* Nonmatching */
+void dCamera_c::SetTypeForce(char* param_0, fopAc_ac_c* param_1) {
+ SetTypeForce(GetCameraTypeFromCameraName(param_0), param_1);
}
/* 80164DFC-80164E2C .text SetTypeForce__9dCamera_cFlP10fopAc_ac_c */
-void dCamera_c::SetTypeForce(s32, fopAc_ac_c*) {
- /* Nonmatching */
+bool dCamera_c::SetTypeForce(s32 param_0, fopAc_ac_c* param_1) {
+ if (m524 != 0xFF) {
+ return false;
+ }
+ m524 = param_0;
+ m528 = param_1;
+ return m524 != 0xFF;
}
/* 80164E2C-80164F5C .text onStyleChange__9dCamera_cFll */
-void dCamera_c::onStyleChange(s32, s32) {
- /* Nonmatching */
+bool dCamera_c::onStyleChange(s32 param_0, s32 param_1) {
+ m11C = 0;
+
+ bool bVar1 = false;
+
+ switch (dCamParam_c::styles[param_0].engineIdx) {
+ case 5:
+ case 6:
+ if (mDMCSystem.field_0x0 == 0) {
+ setDMCAngle();
+ }
+ bVar1 = true;
+ break;
+ case 4:
+ dComIfGp_setCameraZoomScale(mCameraInfoIdx, 1.0f);
+ dComIfGp_offCameraAttentionStatus(mCameraInfoIdx, 0x48);
+ break;
+ }
+
+ switch(dCamParam_c::styles[param_1].engineIdx) {
+ case 1:
+ case 8:
+ if (dCamParam_c::styles[param_0].engineIdx == dCamParam_c::styles[param_1].engineIdx) {
+ setFlag(0x8000);
+ }
+ break;
+ case 5:
+ case 6:
+ if (mDMCSystem.field_0x0 == 0 || bVar1) {
+ setDMCAngle();
+ }
+ case 4:
+ case 12:
+ case 13:
+ if (m144 == 0) {
+ m144 = 1;
+ }
+ }
+
+ return TRUE;
}
/* 80164F5C-8016513C .text GetCameraTypeFromMapToolID__9dCamera_cFll */
-void dCamera_c::GetCameraTypeFromMapToolID(s32, s32) {
- /* Nonmatching */
+int dCamera_c::GetCameraTypeFromMapToolID(s32 param_0, s32 i_roomNo) {
+ /* Nonmatching - regswap */
+ dStage_stageDt_c& stage_dt = dComIfGp_getStage();
+
+ stage_camera_class* camera;
+ stage_arrow_class* arrow;
+
+ if (i_roomNo == -1) {
+ camera = stage_dt.getCamera();
+ arrow = stage_dt.getArrow();
+ } else {
+ camera = dComIfGp_getRoomCamera(i_roomNo);
+ arrow = dComIfGp_getRoomArrow(i_roomNo);
+
+ if (camera == NULL ) {
+ return 0xFF;
+ }
+ }
+
+ if (param_0 < 0 || camera == NULL || (camera != NULL && param_0 >= camera->num)) {
+ return 0xFF;
+ }
+
+ int cam_type_num = 0;
+
+ while (cam_type_num < type_num) {
+ if (strcmp((char*)&camera->mEntries[param_0].m00, types[cam_type_num].name) == 0) {
+ break;
+ }
+ cam_type_num++;
+ }
+
+ if (cam_type_num == type_num) {
+ return 0xFF;
+ }
+
+ mCurRoomCamEntry = *(stage_camera__entry*)&camera->mEntries[param_0];
+ int arrowIdx = mCurRoomCamEntry.mArrowIdx;
+ if (arrowIdx != -1 && arrowIdx < arrow->num) {
+ mCurArrowIdx = arrowIdx;
+ mCurRoomArrowEntry = *(stage_arrow__entry*)&arrow->mEntries[arrowIdx];
+ }
+ else {
+ mCurArrowIdx = 0xFF;
+ }
+ return cam_type_num;
}
/* 8016513C-801651F0 .text GetCameraTypeFromCameraName__9dCamera_cFPCc */
-void dCamera_c::GetCameraTypeFromCameraName(const char*) {
- /* Nonmatching */
+int dCamera_c::GetCameraTypeFromCameraName(const char* i_name) {
+ if (strcmp(i_name, types[mCurType].name) == 0) {
+ return mCurType;
+ }
+
+ int cam_type_num = 0;
+ while (cam_type_num < type_num) {
+ if (strcmp(i_name, types[cam_type_num].name) == 0) {
+ break;
+ }
+
+ cam_type_num++;
+ }
+
+ if (cam_type_num == type_num) {
+ return 0xFF;
+ }
+
+ return cam_type_num;
}
/* 801651F0-80165234 .text pushPos__9dCamera_cFv */
void dCamera_c::pushPos() {
- /* Nonmatching */
+ m084 = m044;
+ m090 = m050;
+ m09C = m060;
+ m0A0 = m05C;
+ return;
}
/* 80165234-8016528C .text limited_range_addition__FPffff */
-void limited_range_addition(f32*, f32, f32, f32) {
- /* Nonmatching */
+bool limited_range_addition(f32* param_1, f32 param_2, f32 param_3, f32 param_4) {
+ float fVar1 = param_3;
+ float fVar2 = param_4;
+
+ if (param_3 > param_4) {
+ param_2 = -param_2;
+ fVar1 = param_4;
+ fVar2 = param_3;
+ }
+
+ *param_1 += param_2;
+
+ if (*param_1 < fVar1) {
+ *param_1 = fVar1;
+ return false;
+ }
+
+ if (*param_1 > fVar2) {
+ *param_1 = fVar2;
+ return false;
+ }
+ return true;
}
/* 8016528C-801652B0 .text directionOf__9dCamera_cFP10fopAc_ac_c */
-void dCamera_c::directionOf(fopAc_ac_c*) {
- /* Nonmatching */
+cSAngle dCamera_c::directionOf(fopAc_ac_c* i_this) {
+ return cSAngle(i_this->shape_angle.y);
}
/* 801652B0-801652CC .text positionOf__9dCamera_cFP10fopAc_ac_c */
-void dCamera_c::positionOf(fopAc_ac_c*) {
- /* Nonmatching */
+cXyz dCamera_c::positionOf(fopAc_ac_c* i_this) {
+ return i_this->current.pos;
}
/* 801652CC-801652E8 .text attentionPos__9dCamera_cFP10fopAc_ac_c */
-void dCamera_c::attentionPos(fopAc_ac_c*) {
- /* Nonmatching */
+cXyz dCamera_c::attentionPos(fopAc_ac_c* i_this) {
+ return i_this->attention_info.position;
}
/* 801652E8-801653B0 .text relationalPos__9dCamera_cFP10fopAc_ac_cP4cXyz */
-void dCamera_c::relationalPos(fopAc_ac_c*, cXyz*) {
- /* Nonmatching */
+cXyz dCamera_c::relationalPos(fopAc_ac_c* i_actor, cXyz* i_offset) {
+ if (i_actor == NULL) {
+ return cXyz::Zero;
+ }
+
+ cSGlobe offset_globe(*i_offset);
+
+ offset_globe.V(directionOf(i_actor) + offset_globe.U());
+
+ return attentionPos(i_actor) + offset_globe.Xyz();
}
/* 801653B0-8016548C .text relationalPos__9dCamera_cFP10fopAc_ac_cP4cXyz7cSAngle */
-void dCamera_c::relationalPos(fopAc_ac_c*, cXyz*, cSAngle) {
- /* Nonmatching */
+cXyz dCamera_c::relationalPos(fopAc_ac_c* i_actor, cXyz* i_offset, cSAngle param_2) {
+ if (i_actor == NULL) {
+ return cXyz::Zero;
+ }
+
+ cSGlobe offset_globe(*i_offset);
+
+ offset_globe.V(directionOf(i_actor) + offset_globe.U() + param_2);
+
+ return attentionPos(i_actor) + offset_globe.Xyz();
}
/* 8016548C-801656AC .text relationalPos__9dCamera_cFP10fopAc_ac_cP10fopAc_ac_cP4cXyzf */
-void dCamera_c::relationalPos(fopAc_ac_c*, fopAc_ac_c*, cXyz*, f32) {
+cXyz dCamera_c::relationalPos(fopAc_ac_c* i_actor1, fopAc_ac_c* i_actor2, cXyz* i_offset, f32 param_3) {
/* Nonmatching */
+ if (i_actor1 == NULL) {
+ return cXyz::Zero;
+ }
+
+ if (i_actor2 == NULL) {
+ return relationalPos(i_actor1, i_offset);
+ }
+
+ cXyz pos1 = attentionPos(i_actor1);
+ cXyz pos2 = attentionPos(i_actor2);
+
+ cXyz mid = pos1 + (pos2 - pos1) * 0.5f;
+
+ cSGlobe delta_globe(pos2 - pos1);
+ cSGlobe offset_globe(*i_offset);
+
+ cSAngle angle = directionOf(i_actor1) + offset_globe.U();
+
+ offset_globe.U(delta_globe.U() - offset_globe.U());
+ delta_globe.R(0.5f * delta_globe.R() * angle.Cos() * param_3);
+
+ cXyz ret = mid + delta_globe.Xyz() + offset_globe.Xyz();
+ return ret;
}
/* 801656AC-80165720 .text setDMCAngle__9dCamera_cFv */
void dCamera_c::setDMCAngle() {
- /* Nonmatching */
+ mDMCSystem.field_0x0 = 1;
+ mDMCSystem.field_0x2 = mDirection.U().Inv();
+ mDMCSystem.field_0x4 = cSAngle(g_mDoCPd_cpadInfo[mPadId].mMainStickAngle);
}
/* 80165720-80165744 .text getDMCAngle__9dCamera_cF7cSAngle */
-void dCamera_c::getDMCAngle(cSAngle) {
- /* Nonmatching */
+cSAngle dCamera_c::getDMCAngle(cSAngle param_0) {
+ return mDMCSystem.field_0x2;
}
/* 80165744-80165800 .text pointInSight__9dCamera_cFP4cXyz */
-void dCamera_c::pointInSight(cXyz*) {
- /* Nonmatching */
+bool dCamera_c::pointInSight(cXyz* i_point) {
+ cXyz proj;
+ dDlst_window_c* window = get_window(mpCamera);
+ scissor_class* scissor = window->getScissor();
+ f32 scissor_width = scissor->mWidth;
+ f32 scissor_height = scissor->mHeight;
+ mDoLib_project(i_point, &proj);
+ return (proj.x > 0.0f && proj.x < scissor_width) && (proj.y > 0.0f && proj.y < scissor_height);
}
/* 80165800-80165830 .text radiusActorInSight__9dCamera_cFP10fopAc_ac_cP10fopAc_ac_c */
-void dCamera_c::radiusActorInSight(fopAc_ac_c*, fopAc_ac_c*) {
- /* Nonmatching */
+f32 dCamera_c::radiusActorInSight(fopAc_ac_c* i_actor1, fopAc_ac_c* i_actor2) {
+ return radiusActorInSight(i_actor1, i_actor2, &m044, &m050 , mFovY, mBank.Val());
}
/* 80165830-80165CC4 .text radiusActorInSight__9dCamera_cFP10fopAc_ac_cP10fopAc_ac_cP4cXyzP4cXyzfs */
-void dCamera_c::radiusActorInSight(fopAc_ac_c*, fopAc_ac_c*, cXyz*, cXyz*, f32, s16) {
+f32 dCamera_c::radiusActorInSight(fopAc_ac_c* i_actor1, fopAc_ac_c* i_actor2, cXyz* i_center, cXyz* i_eye, f32 i_fovY, s16 i_bank) {
/* Nonmatching */
}
/* 80165CC4-801660C8 .text groundHeight__9dCamera_cFP4cXyz */
-void dCamera_c::groundHeight(cXyz*) {
- /* Nonmatching */
-}
-
-/* 801660C8-80166230 .text __dt__18dBgS_CamGndChk_WtrFv */
-dBgS_CamGndChk_Wtr::~dBgS_CamGndChk_Wtr() {
- /* Nonmatching */
+f32 dCamera_c::groundHeight(cXyz* param_0) {
+ dBgS_GndChk gndchk;
+ gndchk.SetPos(param_0);
+ f32 gnd_y = dComIfG_Bgsp()->GroundCross(&gndchk);
+
+ dBgS_CamGndChk_Wtr gndchk_wtr;
+ gndchk_wtr.SetPos(param_0);
+ f32 wtr_y = dComIfG_Bgsp()->GroundCross(&gndchk_wtr);
+
+ f32 height = wtr_y;
+ if (gnd_y >= wtr_y) {
+ wtr_y = gnd_y;
+ }
+
+ if (wtr_y == -1000000000.0f) {
+ gnd_y = param_0->y;
+ }
+ else {
+ gnd_y = wtr_y;
+ }
+
+ return gnd_y;
}
/* 80166230-80166354 .text lineBGCheck__9dCamera_cFP4cXyzP4cXyzP11dBgS_LinChkUl */
-void dCamera_c::lineBGCheck(cXyz*, cXyz*, dBgS_LinChk*, u32) {
- /* Nonmatching */
+bool dCamera_c::lineBGCheck(cXyz* i_start, cXyz* i_end, dBgS_LinChk* i_linChk, u32 i_flags) {
+ if (i_flags & 0x80) {
+ i_linChk->ClrCam();
+ i_linChk->SetObj();
+ } else {
+ i_linChk->ClrObj();
+ i_linChk->SetCam();
+ }
+
+ i_linChk->Set(i_start, i_end, NULL);
+
+ if (i_flags & 4) {
+ i_linChk->ClrSttsRoofOff();
+ } else {
+ i_linChk->SetSttsRoofOff();
+ }
+
+ if (i_flags & 2) {
+ i_linChk->ClrSttsWallOff();
+ } else {
+ i_linChk->SetSttsWallOff();
+ }
+
+ if (i_flags & 1) {
+ i_linChk->ClrSttsGroundOff();
+ } else {
+ i_linChk->SetSttsGroundOff();
+ }
+
+ if (i_flags & 8) {
+ i_linChk->OnWaterGrp();
+ } else {
+ i_linChk->OffWaterGrp();
+ }
+
+ if (dComIfG_Bgsp()->LineCross(i_linChk)) {
+ return true;
+ } else {
+ return false;
+ }
}
/* 80166354-80166740 .text lineBGCheck__9dCamera_cFP4cXyzP4cXyzP4cXyzUl */
-void dCamera_c::lineBGCheck(cXyz*, cXyz*, cXyz*, u32) {
- /* Nonmatching */
+bool dCamera_c::lineBGCheck(cXyz* i_start, cXyz* i_end, cXyz* o_cross, u32 i_flags) {
+ dBgS_CamLinChk_NorWtr lin_chk;
+ if (lineBGCheck(i_start, i_end, &lin_chk, i_flags)) {
+ *o_cross = lin_chk.GetCross();
+ return true;
+ } else {
+ *o_cross = *i_end;
+ return false;
+ }
}
/* 80166740-80166A04 .text lineBGCheck__9dCamera_cFP4cXyzP4cXyzUl */
-void dCamera_c::lineBGCheck(cXyz*, cXyz*, u32) {
- /* Nonmatching */
+bool dCamera_c::lineBGCheck(cXyz* i_start, cXyz* i_end, u32 i_flags) {
+ dBgS_CamLinChk_NorWtr lin_chk;
+ return lineBGCheck(i_start, i_end, &lin_chk, i_flags);
}
/* 80166A04-80166CD4 .text lineBGCheckBack__9dCamera_cFP4cXyzP4cXyzUl */
-void dCamera_c::lineBGCheckBack(cXyz*, cXyz*, u32) {
- /* Nonmatching */
+bool dCamera_c::lineBGCheckBack(cXyz* i_start, cXyz* i_end, u32 i_flags) {
+ dBgS_CamLinChk_NorWtr lin_chk;
+ lin_chk.OnBackFlag();
+ lin_chk.OffFrontFlag();
+ return lineBGCheck(i_start, i_end, &lin_chk, i_flags);
}
/* 80166CD4-80166D00 .text lineBGCheckBoth__9dCamera_cFP4cXyzP4cXyzP11dBgS_LinChkUl */
-void dCamera_c::lineBGCheckBoth(cXyz*, cXyz*, dBgS_LinChk*, u32) {
- /* Nonmatching */
+bool dCamera_c::lineBGCheckBoth(cXyz* i_start, cXyz* i_end, dBgS_LinChk* i_linChk, u32 i_flags) {
+ i_linChk->OnBackFlag();
+ i_linChk->OnFrontFlag();
+ return lineBGCheck(i_start, i_end, i_linChk, i_flags);
}
/* 80166D00-80166DE8 .text lineCollisionCheckBush__9dCamera_cFP4cXyzP4cXyz */
-void dCamera_c::lineCollisionCheckBush(cXyz*, cXyz*) {
+BOOL dCamera_c::lineCollisionCheckBush(cXyz* i_start, cXyz* i_end) {
/* Nonmatching */
+ BOOL ret = 0;
+
+ dCcS* Ccsp = dComIfG_Ccsp();
+
+ u32 result = Ccsp->GetMassResultCam();
+
+ if (result & 2) {
+ ret |= 1;
+ }
+ if (result & 4) {
+ ret |= 2;
+ }
+ if (result & 8) {
+ ret |= 4;
+ }
+
+ cM3dGCps cps;
+ cps.Set(*i_start, *i_end, 30.0f);
+
+ Ccsp->SetMassCam(cps);
+
+ return ret;
}
/* 80166DE8-80166EA4 .text sph_chk_callback__FP11dBgS_SphChkP10cBgD_Vtx_tiiiP8cM3dGPlaPv */
-void sph_chk_callback(dBgS_SphChk*, cBgD_Vtx_t*, int, int, int, cM3dGPla*, void*) {
- /* Nonmatching */
+void sph_chk_callback(dBgS_SphChk* i_sphChk, cBgD_Vtx_t* i_vtxTbl, int i_vtxIdx0, int i_vtxIdx1, int i_vtxIdx2, cM3dGPla* i_plane, void* i_data) {
+ /* Nonmatching - Code 100% */
+ camSphChkdata* sph_chk_data = (camSphChkdata*)i_data;
+ f32 len = cM3d_SignedLenPlaAndPos(i_plane, &sph_chk_data->field_0x8);
+ if (i_plane->getPlaneFunc(&sph_chk_data->field_0x14) >= -0.0001f && len < sph_chk_data->field_0x4) {
+ cXyz normal = *i_plane->GetNP();
+ sph_chk_data->field_0x8 += normal * (sph_chk_data->field_0x4 - len);
+ }
}
/* 80166EA4-80167294 .text compWallMargin__9dCamera_cFP4cXyzf */
-void dCamera_c::compWallMargin(cXyz*, f32) {
+cXyz dCamera_c::compWallMargin(cXyz* i_center, f32 i_radius) {
/* Nonmatching */
-}
+ dBgS_CamSphChk sph_chk;
+ camSphChkdata sph_chk_data(i_center, i_radius);
+ //sph_chk_data.field_0x14 = missing some assignment here (or in ctor)
+ sph_chk.SetCallback(&sph_chk_callback);
+ sph_chk.Set(*i_center, i_radius);
-/* 80167294-801673DC .text __dt__14dBgS_CamSphChkFv */
-dBgS_CamSphChk::~dBgS_CamSphChk() {
- /* Nonmatching */
+ if (dComIfG_Bgsp()->SphChk(&sph_chk, &sph_chk_data)) {
+ return sph_chk_data.field_0x8;
+ }
+ else {
+ return *i_center;
+ }
}
/* 801674F4-801675E8 .text defaultTriming__9dCamera_cFv */
-void dCamera_c::defaultTriming() {
- /* Nonmatching */
+int dCamera_c::defaultTriming() {
+ if (mTrimTypeForce >= 0) {
+ mTrimSize = mTrimTypeForce;
+ }
+ else if (!is_player(mpPlayerActor)) {
+ mTrimSize = 1;
+ }
+ else {
+ switch (mCurMode) {
+ case 12:
+ if (chkFlag(0x1000)) {
+ mTrimSize = 1;
+ }
+ else {
+ mTrimSize = 0;
+ }
+ break;
+ case 1:
+ case 2:
+ case 8:
+ mTrimSize = 2;
+ break;
+ case 3:
+ mTrimSize = 1;
+ break;
+ case 4:
+ mTrimSize = 0;
+ break;
+ case 10:
+ case 11:
+ if (check_owner_action(mPadId, 0x40000)) {
+ mTrimSize = 2;
+
+ }
+ else if (check_owner_action(mPadId, 0xa5000)) {
+ mTrimSize = 1;
+ }
+ break;
+ default:
+ mTrimSize = 0;
+ break;
+
+ }
+ }
+ return mTrimSize;
}
/* 801675E8-801676C0 .text setView__9dCamera_cFffff */
-void dCamera_c::setView(f32, f32, f32, f32) {
- /* Nonmatching */
+void dCamera_c::setView(f32 i_xOrig, f32 i_yOrig, f32 i_width, f32 i_height) {
+ dDlst_window_c* window = get_window(mpCamera);
+ view_port_class* view_port = window->getViewPort();
+ window->setViewPort(i_xOrig, i_yOrig, i_width, i_height, view_port->mNearZ, view_port->mFarZ);
+ window->setScissor(i_xOrig, i_yOrig, i_width, i_height);
}
/* 801676C0-80167F08 .text forwardCheckAngle__9dCamera_cFv */
-void dCamera_c::forwardCheckAngle() {
- /* Nonmatching */
+cSAngle dCamera_c::forwardCheckAngle() {
+ /* Nonmatching - regswap */
+ dBgS_CamLinChk_NorWtr lin_chk;
+ cSAngle ret = cSAngle::_0;
+ cSAngle local_1b8;
+ cSAngle local_1bc;
+ cXyz player_pos = positionOf(mpPlayerActor);
+
+ f32 player_height; // suprisingly the `heightOf` function wasn't used here
+ if (is_player(mpPlayerActor)) {
+ player_height = ((daPy_py_c*)mpPlayerActor)->getHeight();
+ } else {
+ player_height = (mpPlayerActor->eyePos.y - mpPlayerActor->current.pos.y) * 1.1f;
+ }
+
+ player_pos.y += player_height;
+ cXyz cross;
+
+
+ cSAngle local_1c0(mCamSetup.mBGChk.FwdChkAngle(0));
+ cSGlobe local_198(player_height * mCamSetup.mBGChk.FwdDistance(0), local_1c0.Val(), mDirection.U().Inv());
+
+ cXyz local_f4 = player_pos + local_198.Xyz();
+
+ if (lineBGCheck(&player_pos, &local_f4, &cross, 0x7f)) {
+ cXyz local_100 = local_f4 - player_pos;
+
+ if (local_100.abs() < 1.0f) {
+ local_f4 = cross;
+ } else {
+ local_f4 = cross - local_100.norm() * mCamSetup.mBGChk.FwdBackMargin();
+ }
+ }
+
+ cross = local_f4;
+ cross.y = player_height + groundHeight(&local_f4);
+
+ cSGlobe local_1a0(cross - player_pos);
+
+ if (local_1a0.V() >= cSAngle::_0) {
+ local_1b8 = local_1a0.V() * mCamSetup.mBGChk.FwdWeightH(0);
+ } else {
+ local_1b8 = local_1a0.V() * mCamSetup.mBGChk.FwdWeightL(0);
+ }
+
+ cSAngle local_1c4(mCamSetup.mBGChk.FwdChkAngle(1));
+ cSGlobe local_1a8(player_height * mCamSetup.mBGChk.FwdDistance(1), local_1c4.Val(), mDirection.U().Inv());
+
+ cXyz local_10c = player_pos + local_1a8.Xyz();
+
+ if (lineBGCheck(&player_pos, &local_10c, &cross, 0x7f)) {
+ cXyz local_100 = local_10c - player_pos;
+ if (local_100.abs() < 1.0f) {
+ local_10c = cross;
+ } else {
+ local_10c = cross - local_100.norm() * mCamSetup.mBGChk.FwdBackMargin();
+ }
+ }
+
+ cross = local_10c;
+ cross.y = player_height + groundHeight(&local_10c);
+
+ cSGlobe local_1b0(cross - player_pos);
+
+ if (local_1b0.V() >= cSAngle::_0) {
+ local_1bc = local_1b0.V() * mCamSetup.mBGChk.FwdWeightH(1);
+ } else {
+ local_1bc = local_1b0.V() * mCamSetup.mBGChk.FwdWeightL(1);
+ }
+
+ if (local_1b8 >= cSAngle::_0 && local_1bc >= cSAngle::_0) { // regswap here
+ ret = local_1b8 >= local_1bc ? -local_1b8 : -local_1bc;
+ } else if (local_1b8 <= cSAngle::_0 && local_1bc <= cSAngle::_0) { // and here
+ ret = local_1b8 <= local_1bc ? -local_1b8 : -local_1bc;
+ } else {
+ ret = -local_1b8;
+ }
+
+ if (ret <= cSAngle::_0) {
+ ret *= 0.75f;
+ }
+ return ret;
}
/* 80167F08-80168D44 .text bumpCheck__9dCamera_cFUl */
@@ -302,63 +2016,335 @@ void dCamera_c::bumpCheck(u32) {
/* Nonmatching */
}
-/* 80168D44-80168EF0 .text __ct__21dBgS_CamLinChk_NorWtrFv */
-dBgS_CamLinChk_NorWtr::dBgS_CamLinChk_NorWtr() {
- /* Nonmatching */
-}
-
/* 80168EF0-801693AC .text getWaterSurfaceHeight__9dCamera_cFP4cXyz */
-void dCamera_c::getWaterSurfaceHeight(cXyz*) {
- /* Nonmatching */
+f32 dCamera_c::getWaterSurfaceHeight(cXyz* param_0) {
+ /* Nonmatching - Code 100% */
+ f32 var_f31 = -1000000000.0f;
+
+ cXyz spF8(*param_0);
+ dBgS_RoofChk roofchk;
+
+ roofchk.SetPos(spF8);
+
+ f32 roof_y = dComIfG_Bgsp()->RoofChk(&roofchk);
+ if (spF8.y < roof_y) {
+ spF8.y = roof_y;
+ }
+
+ dBgS_CamGndChk_Wtr gndchk;
+ gndchk.SetPos(&spF8);
+
+ f32 gnd_y = dComIfG_Bgsp()->GroundCross(&gndchk) ;
+
+ if (gnd_y + 5.0f > param_0->y) {
+ var_f31 = gnd_y + 5.0f;
+ }
+
+
+ if (daSea_ChkArea(param_0->x, param_0->z)) {
+ float waveHeight = daSea_calcWave(param_0->x, param_0->z) + 20.0f;
+ if (waveHeight > param_0->y && waveHeight > var_f31) {
+ var_f31 = waveHeight;
+ }
+ }
+
+ if (var_f31 == -1000000000.0f) {
+ var_f31 = param_0->y;
+ }
+
+ return var_f31;
}
/* 801693AC-80169528 .text checkSpecialArea__9dCamera_cFv */
void dCamera_c::checkSpecialArea() {
- /* Nonmatching */
+ /* Nonmatching - Code 100% */
+ static cXyz ofan(0.0f, -3650.0f, 0.0f);
+ static f32 dfan = 1500.0f;
+
+ static cXyz opixy(-180000.0f, 750.0f, -200000.0);
+ static f32 dpixy = 2500.0f;
+
+ cXyz player_pos = positionOf(mpPlayerActor);
+
+ m787 = 0;
+
+ if (m788 != 0 && dCamMath::xyzHorizontalDistance(ofan, player_pos) < dfan) {
+ m787 = 1;
+ }
+
+ m786 = 0;
+
+ if (m780 != 0 && dCamMath::xyzHorizontalDistance(opixy, player_pos) < dpixy) {
+ m786 = 1;
+ }
}
/* 80169528-8016A0F0 .text checkGroundInfo__9dCamera_cFv */
void dCamera_c::checkGroundInfo() {
/* Nonmatching */
+ cXyz player_pos = positionOf(mpPlayerActor);
+ cXyz gnd_chk_pos(player_pos);
+
+ f32 player_height; // suprisingly the `heightOf` function wasn't used here
+ if (is_player(mpPlayerActor)) {
+ player_height = ((daPy_py_c*)mpPlayerActor)->getHeight();
+ } else {
+ player_height = (mpPlayerActor->eyePos.y - mpPlayerActor->current.pos.y) * 1.1f;
+ }
+
+ player_pos.y += player_height;
+
+ dBgS_RoofChk roof_chk;
+ roof_chk.SetPos(gnd_chk_pos);
+
+ f32 roof_y = dComIfG_Bgsp()->RoofChk(&roof_chk);
+
+ if (player_pos.y < roof_y) {
+ player_pos.y = roof_y;
+ }
+
+ dBgS_CamGndChk gnd_chk;
+ gnd_chk.ClrCam();
+ gnd_chk.SetObj();
+
+ gnd_chk.SetPos(&gnd_chk_pos);
+
+ f32 ground_y = dComIfG_Bgsp()->GroundCross(&gnd_chk);
+
+ mBG.m5C.SetCam();
+ mBG.m5C.ClrObj();
+
+ mBG.m5C.SetPos(&gnd_chk_pos);
+
+ m310 = dComIfG_Bgsp()->GroundCross(&mBG.m5C);
+
+ if (m310 < ground_y) {
+ m310 = ground_y;
+ mBG.m5C = gnd_chk;
+ }
+
+ //mBG.m5C = m310 != -1000000000.0f; // wshould be a bool at 0x5C and mBG.m5C should be at 0x6
+
+ mBG.m04.SetPos(&player_pos);
+
+ mBG.m58 = dComIfG_Bgsp()->GroundCross(&mBG.m04);
+
+ //mBG.m5C mBG.m58 != -1000000000.0f); // should be a bool at 0x00
+
+ m354 = mBG.m58;
+ if (mpPlayerActor->current.pos.y - m310 > mCamSetup.mBGChk.FloorMargin()) {
+ m360 = 0;
+ }
+ else {
+ m360 = 1;
+ }
+
+ m31D = 0;
+ m33C = 0;
+ if (dComIfG_Bgsp()->ChkMoveBG(mBG.m5C)) {
+ m31C = 0;
+ }
+ else {
+ m33C = dComIfG_Bgsp()->GetActorPointer(mBG.m5C.GetBgIndex());
+ if (m33C) {
+ cXyz pos = positionOf(m33C);
+ cSAngle angle = directionOf(m33C);
+
+ if (m31C) {
+ m320 = m32C - pos;
+ m338 = m33A - angle;
+
+ if (m33C->shape_angle.y == 0x3b) {
+ m044.y += m320.y * mCamSetup.DMCAngle();
+ }
+ }
+
+ m31C = 1;
+
+ if (dComIfGp_evmng_cameraPlay() && chkFlag(0x20000000) && m360) {
+ m31D = 1;
+ }
+
+ if (m31D) {
+ dComIfG_Bgsp()->MoveBgMatrixCrrPos(mBG.m5C, true, &m044, NULL, NULL);
+ dComIfG_Bgsp()->MoveBgMatrixCrrPos(mBG.m5C, true, &m050, NULL, NULL);
+ m03C.Val(m050 - m044);
+ }
+ m32C = pos;
+ m33A = angle;
+ }
+ }
+
+ if (mBG.m58) { // wrong, there is a bool at 0x5C
+ m350 = dComIfG_Bgsp()->GetCamMoveBG(mBG.m5C);
+ }
+ else {
+ m350 = 0;
+ }
+
+ mRoomNo = -1;
+
+ //if ((*(char *)&this->mBG == '\0') ||
+ // ((d_com_inf_game::g_dComIfG_gameInfo.play.mPlayerStatus[this->mPadId * 2][0] & 0x100000) == 0))
+ //{
+ // if (this->field_0x360 == '\0') {
+ // this->mRoomMapToolCameraIdx = 0x1ff;
+ // }
+ // else if ((this->mBG).field_0x5c == '\0') {
+ // this->mRoomMapToolCameraIdx = 0xff;
+ // }
+ // else {
+ // iVar3 = dBgS::GetRoomCamId(&d_com_inf_game::g_dComIfG_gameInfo.play.mBgS,
+ // &(this->mBG).field113_0x74);
+ // this->mRoomMapToolCameraIdx = iVar3;
+ // if (this->mRoomMapToolCameraIdx == 0xff) {
+ // iVar3 = dBgS::GetPolyCamId(&d_com_inf_game::g_dComIfG_gameInfo.play.mBgS,
+ // (uint)(ushort)(this->mBG).field113_0x74.mBgIndex,
+ // (uint)(ushort)(this->mBG).field113_0x74.mTriIdx);
+ // this->mRoomMapToolCameraIdx = iVar3;
+ // }
+ // else {
+ // iVar3 = dBgS::GetRoomId(&d_com_inf_game::g_dComIfG_gameInfo.play.mBgS,
+ // &(this->mBG).field113_0x74);
+ // this->mRoomNo = iVar3;
+ // }
+ // }
+ //}
+ //else {
+ // iVar3 = dBgS::GetPolyCamId(&d_com_inf_game::g_dComIfG_gameInfo.play.mBgS,
+ // (uint)*(ushort *)&(this->mBG).field_0x1a,
+ // (uint)*(ushort *)&(this->mBG).field_0x18);
+ // this->mRoomMapToolCameraIdx = iVar3;
+ //}
+
+ //if (daSea_ChkArea(local_164, local_15c)) {
+ // m318 = daSea_calcWave(local_164, local_15c);
+ // m314 = 1;
+ //}
+ //else {
+ // m318 = -1e+09;
+ // m314 = 0;
+ //}
+ //
+ //if (m354 < m318) {
+ // m354 = m318;
+ //}
+
+ dBgS_GndChk gnd_chk_2;
+
+ gnd_chk.SetPos(&mEye);
+
+ //fVar11 = cBgS::GroundCross((cBgS *)&d_com_inf_game::g_dComIfG_gameInfo.play,&local_158);
+ //if (*(float *)&this->field_0x310 + 40.0 <= fVar11) {
+ // local_194.x = (this->mEye).x;
+ // local_194.y = (this->mEye).y;
+ // local_194.z = (this->mEye).z;
+ // attentionPos(&local_1f4,this,this->mpPlayerActor);
+ // local_188.x = local_1f4.x;
+ // local_188.y = local_1f4.y;
+ // local_188.z = local_1f4.z;
+ // ::cXyz::operator_-(&cStack_200,&local_194,&local_188);
+ // ::cXyz::operator*(&cStack_20c,&cStack_200,0.5);
+ // mtx::PSVECAdd(&local_188,&cStack_20c,&local_188);
+ //}
+ //else {
+ // local_188.x = (this->mEye).x;
+ // local_188.y = (this->mEye).y;
+ // local_188.z = (this->mEye).z;
+ // attentionPos(&local_1d0,this,this->mpPlayerActor);
+ // local_194.x = local_1d0.x;
+ // local_194.y = local_1d0.y;
+ // local_194.z = local_1d0.z;
+ // ::cXyz::operator_-(&cStack_1dc,&local_188,&local_194);
+ // ::cXyz::operator*(&cStack_1e8,&cStack_1dc,0.5);
+ // mtx::PSVECAdd(&local_194,&cStack_1e8,&local_194);
+ //}
+ //if (this->field_0x360 == '\0') {
+ // *(undefined4 *)&this->field_0x364 = 0;
+ // *(float *)&this->field_0x368 = 0.0;
+ //}
+ //else {
+ // uVar4 = lineCollisionCheckBush(this,&local_188,&local_194);
+ // *(uint *)&this->field_0x364 = uVar4 & 5;
+ // if ((*(uint *)&this->field_0x364 & 4) != 0) {
+ // *(float *)&this->field_0x368 = (this->mCamSetup).field59_0xc0;
+ // }
+ // if ((*(uint *)&this->field_0x364 & 1) != 0) {
+ // *(float *)&this->field_0x368 = (this->mCamSetup).field60_0xc4;
+ // }
+ // if (*(int *)&this->field_0x364 != 0) {
+ // dCcMassS_Mng::GetCamTopPos
+ // (&d_com_inf_game::g_dComIfG_gameInfo.play.mCcS.mMassMng,(cXyz *)&this->field_0x36c);
+ // }
+ //}
}
/* 8016A0F0-8016A110 .text followCamera2__9dCamera_cFl */
-void dCamera_c::followCamera2(s32) {
- /* Nonmatching */
+bool dCamera_c::followCamera2(s32 param_0) {
+ followCamera(param_0);
}
/* 8016A110-8016C4F8 .text followCamera__9dCamera_cFl */
-void dCamera_c::followCamera(s32) {
+bool dCamera_c::followCamera(s32) {
/* Nonmatching */
}
/* 8016C55C-8016C578 .text eyePos__9dCamera_cFP10fopAc_ac_c */
-void dCamera_c::eyePos(fopAc_ac_c*) {
- /* Nonmatching */
+cXyz dCamera_c::eyePos(fopAc_ac_c* i_actor) {
+ return i_actor->eyePos;
}
/* 8016C5A4-8016C5D0 .text heightOf__9dCamera_cFP10fopAc_ac_c */
-void dCamera_c::heightOf(fopAc_ac_c*) {
- /* Nonmatching */
+f32 dCamera_c::heightOf(fopAc_ac_c* i_actor) {
+ /* Nonmatching - Code 100% */
+ if (is_player(i_actor)) {
+ return ((daPy_py_c*)i_actor)->getHeight();
+ } else {
+ return (i_actor->eyePos.y - i_actor->current.pos.y) * 1.1f;
+ }
}
/* 8016C618-8016D824 .text lockonCamera__9dCamera_cFl */
-void dCamera_c::lockonCamera(s32) {
+bool dCamera_c::lockonCamera(s32) {
/* Nonmatching */
}
/* 8016D824-8016D880 .text getMsgCmdSpeaker__9dCamera_cFv */
-void dCamera_c::getMsgCmdSpeaker() {
- /* Nonmatching */
+fopAc_ac_c* dCamera_c::getMsgCmdSpeaker() {
+ dComIfG_MesgCamInfo_c* info = dComIfGp_getMesgCameraInfo();
+ fopAc_ac_c* actor = NULL;
+ int idx;
+
+ if (info->mBasicID >= 1 && info->mBasicID <= 10) {
+ idx = info->mBasicID - 1;
+ actor = info->mActor[idx];
+ }
+
+ if (info->mID >= 1 && info->mID <= 10) {
+ idx = info->mID - 1;
+ actor = info->mActor[idx];
+ }
+
+ return actor;
}
/* 8016D880-8016D8D0 .text getMsgCmdCut__9dCamera_cFv */
-void dCamera_c::getMsgCmdCut() {
- /* Nonmatching */
+int dCamera_c::getMsgCmdCut() {
+ dComIfG_MesgCamInfo_c* info = dComIfGp_getMesgCameraInfo();
+ int res = 0;
+ if (!(info->mBasicID >= 1 && info->mBasicID <= 10) && info->mBasicID > 0) {
+ res = info->mBasicID;
+ }
+
+ if (!(info->mID >= 1 && info->mID <= 10) && info->mID > 0) {
+ res = info->mID;
+ }
+
+ return res;
}
/* 8016D8D0-80170434 .text talktoCamera__9dCamera_cFl */
-void dCamera_c::talktoCamera(s32) {
+bool dCamera_c::talktoCamera(s32) {
/* Nonmatching */
}
@@ -368,128 +2354,189 @@ void dCamera_c::CalcSubjectAngle(s16*, s16*) {
}
/* 801708E0-801719C4 .text subjectCamera__9dCamera_cFl */
-void dCamera_c::subjectCamera(s32) {
+bool dCamera_c::subjectCamera(s32) {
/* Nonmatching */
}
/* 801719C4-80172C20 .text towerCamera__9dCamera_cFl */
-void dCamera_c::towerCamera(s32) {
+bool dCamera_c::towerCamera(s32) {
/* Nonmatching */
}
/* 80172C20-8017346C .text crawlCamera__9dCamera_cFl */
-void dCamera_c::crawlCamera(s32) {
+bool dCamera_c::crawlCamera(s32) {
/* Nonmatching */
}
/* 8017346C-80173E40 .text hookshotCamera__9dCamera_cFl */
-void dCamera_c::hookshotCamera(s32) {
+bool dCamera_c::hookshotCamera(s32) {
/* Nonmatching */
}
/* 80173E40-80174E98 .text tornadoCamera__9dCamera_cFl */
-void dCamera_c::tornadoCamera(s32) {
+bool dCamera_c::tornadoCamera(s32) {
/* Nonmatching */
}
/* 80174E98-8017623C .text rideCamera__9dCamera_cFl */
-void dCamera_c::rideCamera(s32) {
+bool dCamera_c::rideCamera(s32) {
/* Nonmatching */
}
/* 8017623C-80176F54 .text hungCamera__9dCamera_cFl */
-void dCamera_c::hungCamera(s32) {
+bool dCamera_c::hungCamera(s32) {
/* Nonmatching */
}
/* 80176F54-8017793C .text vomitCamera__9dCamera_cFl */
-void dCamera_c::vomitCamera(s32) {
+bool dCamera_c::vomitCamera(s32) {
/* Nonmatching */
}
/* 8017793C-801787B8 .text shieldCamera__9dCamera_cFl */
-void dCamera_c::shieldCamera(s32) {
+bool dCamera_c::shieldCamera(s32) {
/* Nonmatching */
}
/* 801787B8-801795C8 .text manualCamera__9dCamera_cFl */
-void dCamera_c::manualCamera(s32) {
+bool dCamera_c::manualCamera(s32) {
/* Nonmatching */
}
/* 801795C8-801799C0 .text nonOwnerCamera__9dCamera_cFl */
-void dCamera_c::nonOwnerCamera(s32) {
+bool dCamera_c::nonOwnerCamera(s32) {
/* Nonmatching */
}
/* 801799C0-80179F8C .text fixedFrameCamera__9dCamera_cFl */
-void dCamera_c::fixedFrameCamera(s32) {
+bool dCamera_c::fixedFrameCamera(s32) {
/* Nonmatching */
}
/* 80179F8C-8017A80C .text fixedPositionCamera__9dCamera_cFl */
-void dCamera_c::fixedPositionCamera(s32) {
+bool dCamera_c::fixedPositionCamera(s32) {
/* Nonmatching */
}
/* 8017A80C-8017B144 .text eventCamera__9dCamera_cFl */
-void dCamera_c::eventCamera(s32) {
+bool dCamera_c::eventCamera(s32) {
/* Nonmatching */
}
/* 8017B144-8017B14C .text demoCamera__9dCamera_cFl */
-void dCamera_c::demoCamera(s32) {
- /* Nonmatching */
+bool dCamera_c::demoCamera(s32) {
+ return TRUE;
}
/* 8017B14C-8017B154 .text letCamera__9dCamera_cFl */
-void dCamera_c::letCamera(s32) {
- /* Nonmatching */
+bool dCamera_c::letCamera(s32) {
+ return TRUE;
}
/* 8017B154-8017B18C .text Set__9dCamera_cF4cXyz4cXyz */
-void dCamera_c::Set(cXyz, cXyz) {
- /* Nonmatching */
+bool dCamera_c::Set(cXyz center, cXyz eye) {
+ mCenter = center;
+
+ mEye = eye;
+
+ return TRUE;
}
/* 8017B18C-8017B1EC .text Set__9dCamera_cF4cXyz4cXyzfs */
-void dCamera_c::Set(cXyz, cXyz, f32, s16) {
- /* Nonmatching */
+bool dCamera_c::Set(cXyz center, cXyz eye, f32 fovY, s16 bank) {
+ mCenter = center;
+
+ mEye = eye;
+
+ mFovY = fovY;
+
+ mBank.Val(bank);
+
+ return TRUE;
}
/* 8017B1EC-8017B24C .text Set__9dCamera_cF4cXyz4cXyzsf */
-void dCamera_c::Set(cXyz, cXyz, s16, f32) {
- /* Nonmatching */
+bool dCamera_c::Set(cXyz center, cXyz eye, s16 bank, f32 fovY) {
+ mCenter = center;
+
+ mEye = eye;
+
+ mFovY = fovY;
+
+ mBank.Val(bank);
+
+ return TRUE;
}
/* 8017B24C-8017B31C .text Reset__9dCamera_cF4cXyz4cXyzfs */
-void dCamera_c::Reset(cXyz, cXyz, f32, s16) {
- /* Nonmatching */
+bool dCamera_c::Reset(cXyz center, cXyz eye, f32 fovY, s16 bank) {
+ m044 = mCenter = center;
+
+ m050 = mEye = eye;
+
+ m060 = mFovY = fovY;
+
+ mBank = cSAngle(bank);
+ m05C = mBank;
+
+ m03C.Val(m050 - m044);
+
+ return Reset();
}
/* 8017B31C-8017B3D8 .text Reset__9dCamera_cF4cXyz4cXyz */
-void dCamera_c::Reset(cXyz, cXyz) {
- /* Nonmatching */
+bool dCamera_c::Reset(cXyz center, cXyz eye) {
+ m044 = mCenter = center;
+
+ m050 = mEye = eye;
+
+ m060 = mFovY;
+
+ m05C = mBank;
+
+ m03C.Val(m050 - m044);
+
+ return Reset();
}
/* 8017B3D8-8017B494 .text Reset__9dCamera_cFv */
-void dCamera_c::Reset() {
- /* Nonmatching */
+bool dCamera_c::Reset() {
+ m044 = mCenter;
+
+ m050 = mEye;
+
+ m060 = mFovY;
+
+ mDirection.Val(mEye - mCenter);
+
+ m03C = mDirection;
+
+ m05C = mBank;
+
+ m03C.Val(m050 - m044);
+
+ return TRUE;
}
/* 8017B494-8017B4C4 .text ResetView__9dCamera_cFv */
void dCamera_c::ResetView() {
- /* Nonmatching */
+ setView(0.0f, 0.0f, 640.0f, 480.0f);
}
/* 8017B4C4-8017B51C .text Chtyp__9dCamera_cFl */
-void dCamera_c::Chtyp(s32) {
- /* Nonmatching */
+bool dCamera_c::Chtyp(s32 nextType) {
+ if (onTypeChange(mCurType, nextType)) {
+ mCurType = nextType;
+ return TRUE;
+ }
+ else {
+ return FALSE;
+ }
}
/* 8017B51C-8017B524 .text U2__9dCamera_cFv */
-void dCamera_c::U2() {
- /* Nonmatching */
+s16 dCamera_c::U2() {
+ return mAngleY.Val();
}
/* 8017B524-8017BA50 .text shakeCamera__9dCamera_cFv */
@@ -503,171 +2550,487 @@ void dCamera_c::StartShake(s32, u8*, s32, cXyz) {
}
/* 8017BB8C-8017BBA4 .text StopShake__9dCamera_cFv */
-void dCamera_c::StopShake() {
- /* Nonmatching */
+bool dCamera_c::StopShake() {
+ m550 = 0;
+ m554 = 0;
+ m588 = 0;
+ return TRUE;
}
/* 8017BBA4-8017BBF0 .text ResetBlure__9dCamera_cFi */
-void dCamera_c::ResetBlure(int) {
- /* Nonmatching */
+void dCamera_c::ResetBlure(int param_0) {
+ /* Nonmatching - Code 100% */
+ m58C = param_0;
+ mBlureAlpha = 0.75f;
+ mBlurePositionType = 0;
+ mBlurePosition.x = 0.5f;
+ mBlurePosition.y = 0.5f;
+ mBlurePosition.z = 0.0f;
+ mBlureScale.x = 0.99f;
+ mBlureScale.y = 0.99f;
+ mBlureScale.z = 0.0f;
+ m594.x = 0;
+ m594.y = 0;
+ m594.z = 0;
+ mBlureTimer = 0;
}
/* 8017BBF0-8017BBF8 .text SetBlureAlpha__9dCamera_cFf */
-void dCamera_c::SetBlureAlpha(f32) {
- /* Nonmatching */
+void dCamera_c::SetBlureAlpha(f32 alpha) {
+ mBlureAlpha = alpha;
}
/* 8017BBF8-8017BC08 .text SetBlureScale__9dCamera_cFfff */
-void dCamera_c::SetBlureScale(f32, f32, f32) {
- /* Nonmatching */
+void dCamera_c::SetBlureScale(f32 scale_x, f32 scale_y, f32 scale_z) {
+ mBlureScale.x = scale_x;
+ mBlureScale.y = scale_y;
+ mBlureScale.z = scale_z;
+ return;
}
/* 8017BC08-8017BC1C .text SetBlureScale__9dCamera_cFf */
-void dCamera_c::SetBlureScale(f32) {
- /* Nonmatching */
+void dCamera_c::SetBlureScale(f32 scale) {
+ mBlureScale.x = scale;
+ mBlureScale.y = scale;
+ mBlureScale.z = 0.0f;
}
/* 8017BC1C-8017BC74 .text SetBlurePosition__9dCamera_cFfff */
-void dCamera_c::SetBlurePosition(f32, f32, f32) {
- /* Nonmatching */
+void dCamera_c::SetBlurePosition(f32 pos_x, f32 pos_y, f32 pos_z) {
+ SetBlurePositionType(1);
+ mBlurePosition.x = pos_x;
+ mBlurePosition.y = pos_y;
+ mBlurePosition.z = pos_z;
}
/* 8017BC74-8017BC7C .text SetBlurePositionType__9dCamera_cFi */
-void dCamera_c::SetBlurePositionType(int) {
- /* Nonmatching */
+void dCamera_c::SetBlurePositionType(int positionType) {
+ mBlurePositionType = positionType;
}
/* 8017BC7C-8017BC84 .text SetBlureTimer__9dCamera_cFl */
-void dCamera_c::SetBlureTimer(s32) {
- /* Nonmatching */
+void dCamera_c::SetBlureTimer(s32 timerVal) {
+ mBlureTimer = timerVal;
}
/* 8017BC84-8017BC9C .text SubjectLockOn__9dCamera_cFP10fopAc_ac_c */
-void dCamera_c::SubjectLockOn(fopAc_ac_c*) {
- /* Nonmatching */
+bool dCamera_c::SubjectLockOn(fopAc_ac_c* target) {
+ setFlag(0x3000000);
+ mpLockonTarget = target;
+ return TRUE;
}
/* 8017BC9C-8017BCB8 .text SubjectLockOff__9dCamera_cFv */
-void dCamera_c::SubjectLockOff() {
- /* Nonmatching */
+bool dCamera_c::SubjectLockOff() {
+ clrFlag(0x3000000);
+ mpLockonTarget = NULL;
+ return TRUE;
}
/* 8017BCB8-8017BCEC .text GetForceLockOnActor__9dCamera_cFv */
-void dCamera_c::GetForceLockOnActor() {
- /* Nonmatching */
+fopAc_ac_c* dCamera_c::GetForceLockOnActor() {
+ return fopAcM_SearchByID(mLockOnActorId);
}
/* 8017BCEC-8017BD2C .text ForceLockOn__9dCamera_cFUi */
-void dCamera_c::ForceLockOn(fpc_ProcID) {
- /* Nonmatching */
+bool dCamera_c::ForceLockOn(fpc_ProcID procId) {
+ mLockOnActorId = procId;
+ mForceLockTimer = 0;
+ mpLockonActor = GetForceLockOnActor();
+ return TRUE;
}
/* 8017BD2C-8017BD5C .text ForceLockOff__9dCamera_cFUi */
-void dCamera_c::ForceLockOff(fpc_ProcID) {
- /* Nonmatching */
+bool dCamera_c::ForceLockOff(fpc_ProcID procId) {
+ if (procId == mLockOnActorId || procId == fpcM_ERROR_PROCESS_ID_e) {
+ mLockOnActorId = fpcM_ERROR_PROCESS_ID_e;
+ return TRUE;
+ }
+ return FALSE;
+
+
}
/* 8017BD5C-8017BD7C .text SetExtendedPosition__9dCamera_cFP4cXyz */
-void dCamera_c::SetExtendedPosition(cXyz*) {
- /* Nonmatching */
+bool dCamera_c::SetExtendedPosition(cXyz* pos) {
+ mExtendedPos.x = pos->x;
+ mExtendedPos.y = pos->y;
+ mExtendedPos.z = pos->z;
+ return TRUE;
}
/* 8017BD7C-8017BD90 .text ScopeViewMsgModeOff__9dCamera_cFv */
-void dCamera_c::ScopeViewMsgModeOff() {
- /* Nonmatching */
+bool dCamera_c::ScopeViewMsgModeOff() {
+ clrFlag(0x400000);
+ return TRUE;
}
/* 8017BD90-8017BD9C .text dCam_isManual__FP12camera_class */
-void dCam_isManual(camera_class*) {
- /* Nonmatching */
+bool dCam_isManual(camera_class* i_this) {
+ return i_this->mCamera.chkFlag(0x20);
}
/* 8017BD9C-8017BDC0 .text dCam_getAngleY__FP12camera_class */
-s16 dCam_getAngleY(camera_class*) {
- /* Nonmatching */
+s16 dCam_getAngleY(camera_class* i_this) {
+ return i_this->mCamera.mDirection.U().Inv();
}
/* 8017BDC0-8017BDC8 .text dCam_getAngleX__FP12camera_class */
-s16 dCam_getAngleX(camera_class*) {
- /* Nonmatching */
+s16 dCam_getAngleX(camera_class* i_this) {
+ return i_this->mCamera.mDirection.V();
}
/* 8017BDC8-8017BDEC .text dCam_getControledAngleY__FP12camera_class */
-s16 dCam_getControledAngleY(camera_class*) {
- /* Nonmatching */
+s16 dCam_getControledAngleY(camera_class* i_this) {
+ return i_this->mCamera.U2();
}
/* 8017BDEC-8017BDFC .text dCam_getCamera__Fv */
camera_class* dCam_getCamera() {
- /* Nonmatching */
+ return dComIfGp_getCamera(0);
}
/* 8017BDFC-8017BE20 .text dCam_getBody__Fv */
-dCamera_c* dCam_getBody() {
- /* Nonmatching */
+dCamera_c* dCam_getBody() {
+ return &dCam_getCamera()->mCamera;
}
/* 8017BE20-8017BEB0 .text preparation__FP20camera_process_class */
-void preparation(camera_process_class*) {
- /* Nonmatching */
+void preparation(camera_process_class* i_this) {
+ /* Nonmatching - Code 100% */
+ camera_class* a_this = (camera_class*)i_this;
+ dCamera_c* camera = &a_this->mCamera;
+
+ int camera_id = get_camera_id(a_this);
+
+ dDlst_window_c* window = get_window(camera_id);
+ view_port_class* viewport = window->getViewPort();
+ f32 aspect = 1.3333334f * fapGmHIO_getAspectRatio();
+
+ camera->SetWindow(viewport->mWidth, viewport->mHeight);
+ fopCamM_SetAspect(a_this, aspect);
+ dComIfGp_offCameraAttentionStatus(camera_id, 0x23);
}
/* 8017BEB0-8017BFAC .text view_setup__FP20camera_process_class */
-void view_setup(camera_process_class*) {
- /* Nonmatching */
+void view_setup(camera_process_class* i_this) {
+ /* Nonmatching - Code 100% */
+ camera_class* a_this = (camera_class*)i_this;
+ dDlst_window_c* window = get_window(a_this);
+
+ view_port_class* viewport = window->getViewPort();
+ view_class* view = (view_class*)i_this;
+ mDoMtx_lookAt(view->mViewMtx, &view->mLookat.mEye, &view->mLookat.mCenter, &view->mLookat.mUp, view->mBank);
+ MTXCopy(view->mViewMtx, view->mViewMtxNoTrans);
+
+ view->mViewMtxNoTrans[0][3] = 0.0f;
+ view->mViewMtxNoTrans[1][3] = 0.0f;
+ view->mViewMtxNoTrans[2][3] = 0.0f;
+
+ dComIfGd_setWindow(window);
+ dComIfGd_setViewport(viewport);
+ dComIfGd_setView(view);
+
+ f32 far;
+ if (dComIfGp_getScopeMesgStatus() != 0) {
+ far = view->mFar;
+ } else {
+ far = dStage_stagInfo_GetCullPoint(dComIfGp_getStageStagInfo());
+ }
+
+ mDoLib_clipper::setup(view->mFovy, view->mAspect, view->mNear, far);
}
/* 8017BFAC-8017C29C .text store__FP20camera_process_class */
-void store(camera_process_class*) {
- /* Nonmatching */
+void store(camera_process_class* i_this) {
+ /* Nonmatching */
+ camera_class* a_this = (camera_class*)i_this;
+ dCamera_c* body = &((camera_class*)i_this)->mCamera;
+
+ int camera_id = get_camera_id(a_this);
+ // Based on the asm I'm not sure if `dComIfGp_checkCameraAttentionStatus(camera_id, 8)` is meant to be used here (or the functions that are used in the inline)
+
+ cXyz oldCenter = *fopCamM_GetCenter_p(a_this);
+ cXyz oldEye = *fopCamM_GetEye_p(a_this);
+ cXyz oldUp = *fopCamM_GetUp_p(a_this);
+ cSAngle bank = fopCamM_GetBank(a_this);
+ f32 fovy = fopCamM_GetFovy(a_this);
+
+ dDemo_camera_c* mDemoCamera = g_dComIfG_gameInfo.play.mDemo->getObject()->getActiveCamera();
+
+ if (mDemoCamera) {
+ if (mDemoCamera->checkEnable(0x40)) {
+ oldCenter = mDemoCamera->getTarget();
+ }
+
+ if (mDemoCamera->checkEnable(0x10)) {
+ oldEye = mDemoCamera->getTrans();
+ }
+
+ if (mDemoCamera->checkEnable(0x20)) {
+ oldUp = mDemoCamera->getUp();
+ }
+
+ if (mDemoCamera->checkEnable(0x80)) {
+ bank = cAngle::d2s(-mDemoCamera->getRoll());
+ }
+
+ if (mDemoCamera->checkEnable(4)) {
+ fovy = mDemoCamera->getFovy();
+ }
+ }
+ else {
+ if (body->chkFlag(1) == 0) {
+ oldCenter = body->Center();
+ oldEye = body->Eye();
+ oldUp = body->Up();
+ bank = body->Bank();
+ fovy = body->Fovy();
+ }
+ }
+
+ fopCamM_SetCenter(a_this, oldCenter.x, oldCenter.y, oldCenter.z);
+ fopCamM_SetEye(a_this, oldEye.x, oldEye.y, oldEye.z);
+ fopCamM_SetUp(a_this, oldUp.x, oldUp.y, oldUp.z);
+ fopCamM_SetBank(a_this, bank);
+ fopCamM_SetFovy(a_this, fovy);
+
+ // The code logic seems right but it's just the usage of this `stage_info` variable that seems to be the key to this matching
+ stage_stag_info_class* stage_info = dComIfGp_getStageStagInfo();
+ if (dComIfGp_checkCameraAttentionStatus(camera_id, 8)) {
+ fopCamM_SetNear(a_this, 30.0f);
+ }
+ else {
+ if (stage_info) {
+ fopCamM_SetNear(a_this, dComIfGp_getStageStagInfo()->mNearPlane);
+ }
+ }
+
+ if (stage_info) {
+ fopCamM_SetFar(a_this, dComIfGp_getStageStagInfo()->mFarPlane);
+ }
+
+ fopCamM_SetAngleY(a_this, body->mDirection.U().Inv());
+ fopCamM_SetAngleX(a_this, body->mDirection.V());
+ return;
+
}
/* 8017C29C-8017C350 .text camera_execute__FP20camera_process_class */
-void camera_execute(camera_process_class*) {
- /* Nonmatching */
+int camera_execute(camera_process_class* i_this) {
+ camera_class* a_this = (camera_class*)i_this;
+
+ preparation(i_this);
+
+ a_this->mCamera.Pause();
+
+ if (!dComIfGp_evmng_cameraPlay()) {
+ mDoGph_gInf_c::onAutoForcus();
+ }
+
+ a_this->mCamera.Active();
+
+ a_this->mCamera.CalcTrimSize();
+
+ store(i_this);
+
+ view_setup(i_this);
+
+ return TRUE;
}
/* 8017C350-8017C72C .text camera_draw__FP20camera_process_class */
-void camera_draw(camera_process_class*) {
- /* Nonmatching */
+bool camera_draw(camera_process_class* i_this) {
+ camera_class* a_this = (camera_class*)i_this;
+ dCamera_c* body = &((camera_class*)i_this)->mCamera;
+
+ dDlst_window_c* window = get_window(a_this);
+ view_port_class* viewport = window->getViewPort();
+ int camera_id = get_camera_id(a_this);
+
+ int trim_height = body->mTrimHeight;
+ window->setScissor(0.0f, trim_height, mDoMch_render_c::getFbWidth(), mDoMch_render_c::getEfbHeight() - trim_height * 2.0f);
+ C_MTXPerspective(i_this->mProjMtx, i_this->mFovy, i_this->mAspect, i_this->mNear, i_this->mFar);
+ mDoMtx_lookAt(i_this->mViewMtx, &i_this->mLookat.mEye, &i_this->mLookat.mCenter, &i_this->mLookat.mUp, i_this->mBank);
+
+ j3dSys.setViewMtx(i_this->mViewMtx);
+ cMtx_inverse(i_this->mViewMtx, i_this->mInvViewMtx);
+ mDoAud_getCameraInfo(&i_this->mLookat.mEye, j3dSys.mViewMtx, camera_id);
+
+ dBgS_GndChk gndchk;
+ gndchk.SetPos(&i_this->mLookat.mEye);
+
+ f32 ground_y = dComIfG_Bgsp()->GroundCross(&gndchk);
+ if (ground_y != C_BG_MIN_HEIGHT) {
+ mDoAud_getCameraMapInfo(dComIfG_Bgsp()->GetMtrlSndId(gndchk));
+ mDoAud_setCameraGroupInfo(dComIfG_Bgsp()->GetGrpSoundId(gndchk));
+
+ Vec spDC;
+ spDC.x = i_this->mLookat.mEye.x;
+ spDC.y = ground_y;
+ spDC.z = i_this->mLookat.mEye.z;
+
+ mDoAud_zelAudio_c::getInterface()->setCameraPolygonPos(&spDC);
+
+ } else {
+ mDoAud_zelAudio_c::getInterface()->setCameraPolygonPos(NULL);
+ }
+
+ MTXCopy(i_this->mViewMtx, i_this->mViewMtxNoTrans);
+ i_this->mViewMtxNoTrans[0][3] = 0.0f;
+ i_this->mViewMtxNoTrans[1][3] = 0.0f;
+ i_this->mViewMtxNoTrans[2][3] = 0.0f;
+ cMtx_concatProjView(i_this->mProjMtx, i_this->mViewMtx, i_this->mProjViewMtx);
+
+ body->Draw();
+
+ if (fpcLf_GetPriority(a_this) != 1) {
+ fopCamM_GetParam(a_this);
+ for (int i = 0; i < 1; i++) {
+ if (!fopOvlpM_IsDoingReq()) {
+ fopAc_ac_c* currPlayerActor = dComIfGp_getPlayer(i);
+ f32 depth = currPlayerActor->current.pos.y;
+ if (currPlayerActor->current.pos.y > 0.0f) {
+ f32 temp = 0;
+ }
+ dComIfGp_map_draw(
+ currPlayerActor->current.pos.x,
+ currPlayerActor->current.pos.z,
+ dComIfGp_roomControl_getStayNo(),
+ depth
+ );
+ }
+ }
+ }
+ return true;
}
/* 8017C72C-8017C7E4 .text init_phase1__FP12camera_class */
-void init_phase1(camera_class*) {
- /* Nonmatching */
+cPhs_State init_phase1(camera_class* i_this) {
+ /* Nonmatching - Code 100% */
+ int camera_id = get_camera_id(i_this);
+
+ dComIfGp_setCamera(camera_id, i_this);
+ fopCamM_SetPrm1(i_this, dComIfGp_getCameraWinID(camera_id));
+ fopCamM_SetPrm2(i_this, dComIfGp_getCameraPlayer1ID(camera_id));
+ fopCamM_SetPrm3(i_this, dComIfGp_getCameraPlayer2ID(camera_id));
+
+ Vec local_18 = {1000000.0f, 1000000.0f, 1000000.0f};
+
+ mDoAud_getCameraInfo(&local_18, j3dSys.getViewMtx(), camera_id);
+
+ dComIfGp_setWindowNum(0);
+ mDoGph_gInf_c::onAutoForcus();
+ return cPhs_NEXT_e;
}
/* 8017C7E4-8017C980 .text init_phase2__FP12camera_class */
-void init_phase2(camera_class*) {
- /* Nonmatching */
+cPhs_State init_phase2(camera_class* i_this) {
+ /* Nonmatching - Code 100% */
+ camera_process_class* a_this = (camera_process_class*)i_this;
+ dCamera_c* body = &i_this->mCamera;
+ int camId = fopCamM_GetParam(i_this);
+
+ fopAc_ac_c* player = (fopAc_ac_c*)get_player_actor(i_this);
+
+ if (player == NULL) {
+ return cPhs_INIT_e;
+ }
+
+ fopAcM_setStageLayer(player);
+
+ dComIfGp_setWindowNum(1);
+
+ new (body) dCamera_c(i_this);
+
+ float farPlane = 160000.0f;
+
+ if (dComIfGp_getStage().getStagInfo() != NULL) {
+ dStage_stageDt_c* stage_dt = &dComIfGp_getStage();
+ stage_dt->getStagInfo();
+
+ farPlane = stage_dt->getStagInfo()->mFarPlane;
+ }
+
+ view_port_class* viewPort = (view_port_class*)get_window(camId);
+
+ fopCamM_SetNear(i_this, 1.0f);
+ fopCamM_SetFar(i_this, farPlane);
+ fopCamM_SetFovy(i_this, 30.0f);
+ fopCamM_SetAspect(i_this, viewPort->mWidth / viewPort->mHeight * fapGmHIO_getAspectRatio());
+ fopCamM_SetCenter(i_this, player->current.pos.x, player->current.pos.y, player->current.pos.z);
+ fopCamM_SetBank(i_this, 0);
+
+ store(i_this);
+
+ view_setup(i_this);
+
+ return cPhs_NEXT_e;
}
/* 8017C980-8017C9B0 .text camera_create__FP12camera_class */
-void camera_create(camera_class*) {
- /* Nonmatching */
+cPhs_State camera_create(camera_class* i_this) {
+ /* Nonmatching - Code 100% */
+ static request_of_phase_process_fn l_method[3] = {
+ (request_of_phase_process_fn)init_phase1,
+ (request_of_phase_process_fn)init_phase2,
+ (request_of_phase_process_fn)NULL,
+ };
+
+ return dComLbG_PhaseHandler(&i_this->phase_request, l_method, i_this);
}
/* 8017C9B0-8017C9DC .text camera_delete__FP20camera_process_class */
-void camera_delete(camera_process_class*) {
- /* Nonmatching */
+bool camera_delete(camera_process_class* i_this) {
+ /* Nonmatching - fakematch, instruction swap */
+ dCamera_c* camera = &((camera_class*)i_this)->mCamera;
+ camera->~dCamera_c();
+ return TRUE;
}
/* 8017C9DC-8017C9E4 .text is_camera_delete__FPv */
-void is_camera_delete(void*) {
- /* Nonmatching */
+bool is_camera_delete(void*) {
+ return TRUE;
}
/* 8017C9E4-8017CA7C .text Init__14dCamForcusLineFv */
void dCamForcusLine::Init() {
- /* Nonmatching */
+ /* Nonmatching - Code 100% */
+ m49 = 0;
+ m48 = 1;
+ m38 = cXyz(320.0f, 240.0f, 0.0f);
+
+ m44.r = 0xFF;
+ m44.g = 0xFF;
+ m44.b = 0xFF;
+ m44.a = 0x60;
+
+ m4C = 100;
+ m50 = 100;
+ m54 = 100;
+ m58 = 0x50;
+ m5A = 0;
+ m5C = 4;
+ m5E = 4;
+ m68 = 180.0f;
+ m6C = 0.0f;
+ m60 = 180.0f;
+ m64 = 60.0f;
}
/* 8017CA7C-8017CB00 .text Draw__14dCamForcusLineFv */
void dCamForcusLine::Draw() {
- /* Nonmatching */
+ if (m49) {
+ if (m48 == 0) {
+ mEffectLine.initRnd(m4C, m50, m54);
+ }
+
+ mEffectLine.update(m38, m44, m58, m5A, m5C, m5E, m60, m64, m68, m6C);
+ }
}
/* 8017CB00-8017CB18 .text Off__14dCamForcusLineFv */
-void dCamForcusLine::Off() {
- /* Nonmatching */
+bool dCamForcusLine::Off() {
+ m49 = 0;
+ return m49 == 0;
}
diff --git a/src/d/d_com_inf_game.cpp b/src/d/d_com_inf_game.cpp
index 89bc30bd..5d7c4413 100644
--- a/src/d/d_com_inf_game.cpp
+++ b/src/d/d_com_inf_game.cpp
@@ -171,11 +171,11 @@ void dComIfG_play_c::itemInit() {
field_0x497a = 0;
mNowVibration = dComIfGs_getOptVibration();
daArrow_c::setKeepType(daArrow_c::TYPE_NORMAL);
- mMesgCameraTagInfo = 0;
- field_0x4984 = 0;
+ mMesgCamInfo.mID = 0;
+ mMesgCamInfo.mBasicID = 0;
- for (int i = 0; i < ARRAY_SIZE(field_0x4988); i++) {
- field_0x4988[i] = 0;
+ for (int i = 0; i < ARRAY_SIZE(mMesgCamInfo.mActor); i++) {
+ mMesgCamInfo.mActor[i] = 0;
}
}
diff --git a/src/d/d_kankyo_rain.cpp b/src/d/d_kankyo_rain.cpp
index 92f325cd..ca4414e6 100644
--- a/src/d/d_kankyo_rain.cpp
+++ b/src/d/d_kankyo_rain.cpp
@@ -566,7 +566,7 @@ void dKyr_sun_move() {
cLib_addCalc(&pSunPkt->mSunAlpha, 1.0f, 0.5f, 0.1f, 0.01f);
if (pCamera != NULL) {
- borderY = pCamera->mCamera.m5F8;
+ borderY = pCamera->mCamera.mTrimHeight;
}
cXyz projected;
diff --git a/src/d/d_ovlp_fade2.cpp b/src/d/d_ovlp_fade2.cpp
index 68b5dc0a..dafe27ff 100644
--- a/src/d/d_ovlp_fade2.cpp
+++ b/src/d/d_ovlp_fade2.cpp
@@ -51,7 +51,7 @@ void dOvlpFd2_dlst_c::draw() {
GXEnd();
Mtx44 proj;
- C_MTXPerspective(proj, 60.0f, g_HIO.field_0x0c * 1.33333333f, 100.0f, 100000.0f);
+ C_MTXPerspective(proj, 60.0f, fapGmHIO_getAspectRatio() * 1.33333333f, 100.0f, 100000.0f);
GXSetProjection(proj, GX_PERSPECTIVE);
GXInitTexObj(mDoGph_gInf_c::getFrameBufferTexObj(), mDoGph_gInf_c::getFrameBufferTex(), 320, 240, GX_TF_RGBA8, GX_CLAMP, GX_CLAMP, GX_FALSE);
diff --git a/src/d/d_s_name.cpp b/src/d/d_s_name.cpp
index eb6c480f..c5785024 100644
--- a/src/d/d_s_name.cpp
+++ b/src/d/d_s_name.cpp
@@ -152,7 +152,7 @@ cPhs_State dScnName_c::create() {
field_0x2a0 = 160000.0f;
field_0x2a4 = 60.0f;
f32 aspect = dComIfGp_getWindow(0)->getViewPort()->mWidth / dComIfGp_getWindow(0)->getViewPort()->mHeight;
- field_0x2a8 = aspect * g_HIO.field_0x0c;
+ field_0x2a8 = aspect * fapGmHIO_getAspectRatio();
field_0x2ac.x = 9377.0f;
field_0x2ac.y = 0.0;
field_0x2ac.z = 7644.0;
@@ -960,7 +960,7 @@ void dDlst_FLSEL_CLOTH_c::draw() {
Mtx44 mtx;
view_port_class* viewport = dComIfGp_getCurrentViewport();
f32 aspect = viewport->mWidth / viewport->mHeight;
- C_MTXPerspective(mtx, 30.0f, aspect * g_HIO.field_0x0c, 1.0f, 100000.0f);
+ C_MTXPerspective(mtx, 30.0f, aspect * fapGmHIO_getAspectRatio(), 1.0f, 100000.0f);
GXSetProjection(mtx, GX_PERSPECTIVE);
cloth_c->draw(0.0f, (GXColor){0xe3, 0xff, 0xb3, 0xff}, (GXColor){0x00, 0x00, 0x00, 0x00}, 0);
dComIfGp_getCurrentGrafPort()->setPort();
diff --git a/src/d/d_stage.cpp b/src/d/d_stage.cpp
index 9b09ef30..eb30261e 100644
--- a/src/d/d_stage.cpp
+++ b/src/d/d_stage.cpp
@@ -1315,10 +1315,10 @@ int dStage_cameraCreate(stage_camera2_data_class* i_cameraData, int i_cameraIdx,
i_cameraData = static_cast<stage_camera2_data_class*>(cMl::memalignB(-4, 0x18));
if (i_cameraData != NULL) {
- i_cameraData->field_0x4 = 0.0f;
- i_cameraData->field_0x8 = 0.0f;
- i_cameraData->field_0x4 = 0.0f;
- i_cameraData->field_0x0 = param_2;
+ i_cameraData->m04 = 0.0f;
+ i_cameraData->m08 = 0.0f;
+ i_cameraData->m04 = 0.0f;
+ i_cameraData->m00 = param_2;
fopCamM_Create(i_cameraIdx, PROC_CAMERA, i_cameraData);
}
@@ -1499,7 +1499,7 @@ int dStage_playerInit(dStage_dt_c* i_stage, void* i_data, int num, void* i_file)
int dStage_cameraInit(dStage_dt_c* i_stage, void* i_data, int i_num, void*) {
stage_camera_class* camera = (stage_camera_class*)((char*)i_data + 4);
i_stage->setCamera(camera);
- dStage_cameraCreate(camera->m_entries, 0, 0);
+ dStage_cameraCreate(camera->mEntries, 0, 0);
return 1;
}
diff --git a/src/f_ap/f_ap_game.cpp b/src/f_ap/f_ap_game.cpp
index f14074ff..5d881be1 100644
--- a/src/f_ap/f_ap_game.cpp
+++ b/src/f_ap/f_ap_game.cpp
@@ -29,7 +29,7 @@ fapGm_HIO_c::fapGm_HIO_c() {
field_0x09 = 1;
field_0x0a = 1;
- field_0x0c = 0.96f;
+ mAspectRatio = 0.96f;
field_0x10 = 0;
field_0x11 = 0;
field_0x12 = 8;
diff --git a/src/f_op/f_op_camera_mng.cpp b/src/f_op/f_op_camera_mng.cpp
index 4695e994..1079ac15 100644
--- a/src/f_op/f_op_camera_mng.cpp
+++ b/src/f_op/f_op_camera_mng.cpp
@@ -6,7 +6,6 @@
#include "f_op/f_op_camera_mng.h"
#include "f_pc/f_pc_layer.h"
#include "f_pc/f_pc_stdcreate_req.h"
-#include "f_pc/f_pc_manager.h"
static fpc_ProcID l_fopCamM_id[4];