Skip to content

Commit

Permalink
Merge pull request #514 from LagoLunatic/dbgs
Browse files Browse the repository at this point in the history
d_bg_s progress
  • Loading branch information
magcius authored Oct 9, 2023
2 parents 387a9bf + 3f51198 commit a1db9f3
Show file tree
Hide file tree
Showing 19 changed files with 313 additions and 131 deletions.
6 changes: 3 additions & 3 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,10 @@ def DolphinLib(lib_name, objects):
Object(NonMatching, "d/d_bg_s.cpp"),
Object(NonMatching, "d/d_bg_s_acch.cpp"),
Object(NonMatching, "d/d_bg_s_func.cpp"),
Object(NonMatching, "d/d_bg_s_lin_chk.cpp"),
Object(Matching, "d/d_bg_s_lin_chk.cpp"),
Object(Matching, "d/d_bg_s_movebg_actor.cpp"),
Object(NonMatching, "d/d_bg_s_spl_grp_chk.cpp"),
Object(NonMatching, "d/d_bg_s_wtr_chk.cpp"),
Object(Matching, "d/d_bg_s_spl_grp_chk.cpp"),
Object(Matching, "d/d_bg_s_wtr_chk.cpp"),
Object(NonMatching, "d/d_bg_w.cpp"),
Object(NonMatching, "d/d_bg_w_deform.cpp"),
Object(NonMatching, "d/d_bg_w_hf.cpp"),
Expand Down
7 changes: 6 additions & 1 deletion include/SSystem/SComponent/c_bg_s_chk.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,12 @@ class cBgS_Chk {
mGrpPassChk = NULL;
unk_0x0C = 1;
}
void SetExtChk(cBgS_Chk&);
void SetExtChk(cBgS_Chk& other) {
mPolyPassChk = other.mPolyPassChk;
mGrpPassChk = other.mGrpPassChk;
mActorPid = other.mActorPid;
unk_0x0C = other.unk_0x0C;
}
bool ChkSameActorPid(unsigned int) const;

void SetActorPid(u32 pid) { mActorPid = pid; }
Expand Down
2 changes: 1 addition & 1 deletion include/SSystem/SComponent/c_m3d_g_cir.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class cM3dGCir : public cM2dGCir {
f32 mPosZ;

public:
cM3dGCir(void);
cM3dGCir(void) {}
virtual ~cM3dGCir(void) {}
void Set(f32, f32, f32, f32);
};
Expand Down
2 changes: 1 addition & 1 deletion include/SSystem/SComponent/c_m3d_g_pla.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class cM3dGPla {
}

const cXyz * GetNP() const { return &mNormal; }
f32 getCrossY(const cXyz& i_axis, float* i_value) const {
void getCrossY(const cXyz& i_axis, float* i_value) const {
if (!cM3d_IsZero(mNormal.y)) {
*i_value = (-mNormal.x * i_axis.x -
mNormal.z * i_axis.z -
Expand Down
2 changes: 0 additions & 2 deletions include/d/actor/d_a_player_link.h
Original file line number Diff line number Diff line change
Expand Up @@ -1061,8 +1061,6 @@ class daPy_lk_c : public daPy_py_c {
/* 0x0708 */ dBgS_BoomerangLinChk mBoomerangLinChk;
/* 0x0774 */ dBgS_LinkGndChk mGndChk;
/* 0x07C8 */ dBgS_LinkRoofChk mRoofChk;
/* 0x080C */ void* field_0x080c;
/* 0x0810 */ void* field_0x0810;
/* 0x0814 */ dBgS_ArrowLinChk mArrowLinChk;
/* 0x0880 */ dBgS_MirLightLinChk mMirLightLinChk;
/* 0x08EC */ u8 field_0x08EC[0x0910 - 0x08EC];
Expand Down
42 changes: 24 additions & 18 deletions include/d/d_bg_s_acch.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ class dBgS_Acch : public cBgS_Chk, public dBgS_Chk {
/* 0x004000 */ LINE_CHECK_NONE = (1 << 14),
/* 0x008000 */ CLR_SPEED_Y = (1 << 15),
/* 0x010000 */ LINE_CHECK_HIT = (1 << 16),
/* 0x020000 */ SEA_CHECK = (1 << 17),
/* 0x040000 */ SEA_WATER_HEIGHT = (1 << 18),
/* 0x080000 */ SEA_IN = (1 << 19),
/* 0x100000 */ MOVE_BG_ONLY = (1 << 20),
/* 0x200000 */ GND_THIN_CELLING_OFF = (1 << 21),
/* 0x400000 */ WALL_SORT = (1 << 22),
Expand Down Expand Up @@ -103,16 +106,17 @@ class dBgS_Acch : public cBgS_Chk, public dBgS_Chk {
void OnWallSort();
bool ChkWallSort();
bool ChkLineDown();
bool ChkRoofHit() const;
void ClrGroundHit();
bool ChkGroundHit() const;
f32 GetOnePolyInfo(cBgS_PolyInfo*);
f32 GetWallAddY(Vec&, int);

virtual ~dBgS_Acch();

cXyz* GetPos() { return pm_pos; }
cXyz* GetOldPos() { return pm_old_pos; }
f32 GetGroundH() const { return m_ground_h; }
f32 GetRoofHeight() const { return m_roof_height; }
f32 GetGroundH() { return m_ground_h; }
f32 GetRoofHeight() { return m_roof_height; }
f32 GetSeaHeight() { return m_sea_height; }
void SetLin() { m_lin.SetStartEnd(*pm_old_pos, *pm_pos); }
bool ChkGroundFind() { return m_flags & GROUND_FIND; }
bool ChkGroundHit() { return m_flags & GROUND_HIT; }
Expand Down Expand Up @@ -155,6 +159,9 @@ class dBgS_Acch : public cBgS_Chk, public dBgS_Chk {
bool ChkMoveBGOnly() const { return m_flags & MOVE_BG_ONLY; }
void SetWallHit() { m_flags |= WALL_HIT; }
void ClrWallNone() { m_flags &= ~WALL_NONE; }
bool ChkSeaCheckOn() { return m_flags & SEA_CHECK;}
bool ChkSeaWaterHeight() { return m_flags & SEA_WATER_HEIGHT;}
bool ChkSeaIn() { return m_flags & SEA_IN;}
cM3dGCyl* GetWallBmdCylP() { return &m_wall_cyl; }

public:
Expand All @@ -167,28 +174,27 @@ class dBgS_Acch : public cBgS_Chk, public dBgS_Chk {
/* 0x040 */ cM3dGLin m_lin;
/* 0x05C */ cM3dGCyl m_wall_cyl;
/* 0x074 */ int m_bg_index;
/* 0x078 */ void* field_0x7c;
/* 0x07C */ u32 field_0x80;
/* 0x078 */ void* field_0x78;
/* 0x07C */ u32 field_0x7c;
/* 0x080 */ fopAc_ac_c* m_my_ac;
/* 0x084 */ int m_tbl_size;
/* 0x088 */ dBgS_AcchCir* field_0x8c;
/* 0x08C */ f32 field_0x90;
/* 0x090 */ f32 field_0x94;
/* 0x088 */ dBgS_AcchCir* mp_acch_cir;
/* 0x08C */ f32 m_ground_up_h;
/* 0x090 */ f32 m_ground_up_h_diff;
/* 0x094 */ f32 m_ground_h;
/* 0x098 */ f32 field_0x9c;
/* 0x09C */ cM3dGPla field_0xa0;
/* 0x0B0 */ u8 field_0xb4;
/* 0x0B4 */ f32 field_0xb8;
/* 0x0B8 */ f32 field_0xbc;
/* 0x0BC */ u8 field_0xc0;
/* 0x098 */ f32 field_0x98;
/* 0x09C */ cM3dGPla m_pla;
/* 0x0B0 */ u8 field_0xb0;
/* 0x0B4 */ f32 field_0xb4;
/* 0x0B8 */ f32 field_0xb8;
/* 0x0BC */ f32 m_roof_y;
/* 0x0C0 */ f32 m_roof_height;
/* 0x0C4 */ f32 m_roof_crr_height;
/* 0x0C8 */ f32 field_0xc8;
/* 0x0CC */ int field_0xd4;
/* 0x0D0 */ f32 field_0xd8;
/* 0x0CC */ cBgS_PolyInfo* pm_out_poly_info;
/* 0x0D0 */ f32 m_sea_height;
/* 0x0D4 */ dBgS_GndChk m_gnd;
/* 0x128 */ dBgS_RoofChk m_roof;
/* 0x16C */ u8 field_0x16c[0x174 - 0x16C];
/* 0x174 */ dBgS_WtrChk m_wtr;
}; // Size: 0x1C4

Expand Down
2 changes: 1 addition & 1 deletion include/d/d_bg_s_lin_chk.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class dBgS_LinChk : public cBgS_LinChk, public dBgS_Chk {
SetPolyPassChk(GetPolyPassChkInfo());
SetGrpPassChk(GetGrpPassChkInfo());
}
void Set(cXyz* pi_start, cXyz* pi_end, fopAc_ac_c*);
void Set(cXyz* pi_start, cXyz* pi_end, fopAc_ac_c* pi_actor);

virtual ~dBgS_LinChk() {}

Expand Down
4 changes: 4 additions & 0 deletions include/d/d_bg_s_poly_pass_chk.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class dBgS_PolyPassChk : public cBgS_PolyPassChk {
void SetBomb() { mbBombThrough = true; }
void SetBoomerang() { mbBoomerangThrough = true; }
void SetRope() { mbRopeThrough = true; }

void SetPassChkInfo(dBgS_PolyPassChk& other) {
*this = other;
}
};

STATIC_ASSERT(sizeof(dBgS_PolyPassChk) == 0xC);
Expand Down
23 changes: 16 additions & 7 deletions include/d/d_bg_s_roof_chk.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,34 @@

class dBgS_RoofChk : public cBgS_PolyInfo, public cBgS_Chk, public dBgS_Chk {
public:
dBgS_RoofChk();
dBgS_RoofChk() {
SetPolyPassChk(GetPolyPassChkInfo());
SetGrpPassChk(GetGrpPassChkInfo());
m_pos.x = 0.0f;
m_pos.y = 0.0f;
m_pos.z = 0.0f;
SetActorPid(-1);
field_0x44 = 0;
}
void Init();
void SetPos(cXyz const&);

virtual ~dBgS_RoofChk();
virtual ~dBgS_RoofChk() {}

void i_SetPos(cXyz const& pos) { m_pos = pos; }
void SetPos(cXyz const& pos) { m_pos = pos; }
cXyz* GetPosP() { return &m_pos; }

private:
/* 0x38 */ cXyz m_pos;
}; // Size: 0x44
/* 0x44 */ void* field_0x44;
/* 0x48 */ void* field_0x48;
}; // Size: 0x4C

STATIC_ASSERT(sizeof(dBgS_RoofChk) == 0x44);
STATIC_ASSERT(sizeof(dBgS_RoofChk) == 0x4C);

class dBgS_LinkRoofChk : public dBgS_RoofChk {
public:
dBgS_LinkRoofChk() { /* SetLink(); */ }
virtual ~dBgS_LinkRoofChk();
};
}; // Size: 0x4C

#endif /* D_BG_D_BG_S_ROOF_CHK_H */
7 changes: 5 additions & 2 deletions include/d/d_bg_s_spl_grp_chk.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,10 @@ class dBgS_SplGrpChk : public cBgS_PolyInfo, public cBgS_Chk, public dBgS_Chk {
/* 0x4 */ MOVE_BG_ONLY = 4
};

void Set(cXyz&, f32);
dBgS_SplGrpChk();
void Init();

virtual ~dBgS_SplGrpChk();
virtual ~dBgS_SplGrpChk() {}

void OffFind() { m_flags &= ~FIND; }
void OffIn() { m_flags &= ~IN; }
Expand All @@ -29,6 +28,10 @@ class dBgS_SplGrpChk : public cBgS_PolyInfo, public cBgS_Chk, public dBgS_Chk {
f32 GetHeight() { return m_height; }
cXyz& GetPosP() { return m_ground; }
f32 GetRoof() const { return m_roof; }
void Set(cXyz& ground, f32 roof) {
m_ground = ground;
m_roof = roof;
}

private:
/* 0x38 */ cXyz m_ground;
Expand Down
2 changes: 1 addition & 1 deletion include/d/d_bg_s_wtr_chk.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class dBgS_WtrChk : public dBgS_SplGrpChk {
public:
dBgS_WtrChk();

virtual ~dBgS_WtrChk();
virtual ~dBgS_WtrChk() {}
}; // Size: 0x50

STATIC_ASSERT(sizeof(dBgS_WtrChk) == 0x50);
Expand Down
4 changes: 4 additions & 0 deletions include/d/d_com_inf_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -1139,6 +1139,10 @@ inline s32 dComIfGp_roomControl_getStayNo() {
return dStage_roomControl_c::getStayNo();
}

inline dBgW* dComIfGp_roomControl_getBgW(int i_roomNo) {
return dStage_roomControl_c::getBgW(i_roomNo);
}

inline void dComIfGp_roomControl_init() {
g_dComIfG_gameInfo.play.getRoomControl()->init();
}
Expand Down
8 changes: 4 additions & 4 deletions include/d/d_stage.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ class dStage_darkStatus_c {
/* 0x18 */ int field_0x18[2];
};

class dBgW_base;
class dBgW;
class dStage_roomStatus_c : public dStage_roomDt_c {
public:
/* 0x054 */ dKy_tevstr_c mTevStr;
Expand All @@ -780,7 +780,7 @@ class dStage_roomStatus_c : public dStage_roomDt_c {
/* 0x107 */ s8 mZoneNo;
/* 0x108 */ s8 mMemBlockID;
/* 0x10C */ int mProcID;
/* 0x110 */ dBgW_base* mpBgW;
/* 0x110 */ dBgW* mpBgW;

int getZoneNo() const { return mZoneNo; }
~dStage_roomStatus_c() {}
Expand All @@ -801,7 +801,7 @@ class dStage_roomControl_c {
void checkDrawArea() const;
dStage_darkStatus_c* getDarkStatus();
u32 getDarkMode();
void getBgW(int);
static dBgW* getBgW(int i_roomNo);

static JKRExpHeap* createMemoryBlock(int, u32);
static void destroyMemoryBlock();
Expand Down Expand Up @@ -830,7 +830,7 @@ class dStage_roomControl_c {
mStatus[i_roomNo].mMemBlockID = i_blockID;
}

static void setBgW(int param_0, dBgW_base* i_bgw) { mStatus[param_0].mpBgW = i_bgw; }
static void setBgW(int i_roomNo, dBgW* i_bgw) { mStatus[i_roomNo].mpBgW = i_bgw; }

BOOL checkStatusFlag(int i_roomNo, u8 flag) const {
return cLib_checkBit(mStatus[i_roomNo].mFlags, flag);
Expand Down
14 changes: 6 additions & 8 deletions include/f_op/f_op_actor.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,12 @@ struct actor_process_profile_definition2 {
class JKRSolidHeap;

enum dEvt_Command_e {
dEvtCmd_NONE_e,
dEvtCmd_INTALK_e,
dEvtCmd_INDEMO_e,
dEvtCmd_INDOOR_e,
dEvtCmd_INGETITEM_e,
dEvtCmd_INCATCH_e = 6,
dEvtCmd_DUMMY = 0xFFFF,
dEvtCmd_NONE_e = 0x0000,
dEvtCmd_INTALK_e = 0x0001,
dEvtCmd_INDEMO_e = 0x0002,
dEvtCmd_INDOOR_e = 0x0003,
dEvtCmd_INGETITEM_e = 0x0004,
dEvtCmd_INCATCH_e = 0x0006,
};

enum dEvt_Condition_e {
Expand All @@ -104,7 +103,6 @@ enum dEvt_Condition_e {
dEvtCnd_CANDOOR_e = 0x0004,
dEvtCnd_CANGETITEM_e = 0x0008,
dEvtCnd_CANTALKITEM_e = 0x0020,
dEvtCnd_DUMMY = 0x8000,
};

class dEvt_info_c {
Expand Down
13 changes: 4 additions & 9 deletions src/d/actor/d_a_player_npc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -177,19 +177,14 @@ void daPy_npc_c::drawDamageFog() {
return;
}

cXyz temp;
f32 temp_f1;
f32 temp_f2;
mDoLib_pos2camera(&current.pos, &temp);
temp_f2 = fabs(cM_ssin(g_Counter.mTimer * 0x800));
cXyz camPos;
mDoLib_pos2camera(&current.pos, &camPos);
f32 adjust = fabsf(cM_ssin(g_Counter.mTimer * 0x800));
mTevStr.mFogColor.r = 255;
mTevStr.mFogColor.g = 60;
mTevStr.mFogColor.b = 60;

temp_f1 = -temp.z;
temp_f1 -= 200.0f;
temp_f2 = 200.0f * temp_f2;
mTevStr.mFogStartZ = temp_f1 + temp_f2;
mTevStr.mFogStartZ = (-camPos.z - 200.0f) + 200.0f * adjust;
mTevStr.mFogEndZ = mTevStr.mFogStartZ + 300.0f;
}

Expand Down
Loading

0 comments on commit a1db9f3

Please sign in to comment.