Skip to content

Commit

Permalink
Merge pull request #11 from TakaRikka/dcom2
Browse files Browse the repository at this point in the history
most of d_com_inf_game done / more structs setup
  • Loading branch information
encounter authored Sep 11, 2023
2 parents dc270ad + c65210d commit 7afd21a
Show file tree
Hide file tree
Showing 19 changed files with 1,310 additions and 158 deletions.
1 change: 1 addition & 0 deletions include/JSystem/J3DGraphBase/J3DPacket.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ class J3DPacket {

void setUserArea(u32 area) { mpUserData = (void*)area; }

virtual bool isSame(J3DMatPacket*) const;
virtual int entry(J3DDrawBuffer*);
virtual void draw();
virtual ~J3DPacket() {}
Expand Down
78 changes: 78 additions & 0 deletions include/JSystem/JParticle/JPAParticle.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#ifndef JPAPARTICLE_H
#define JPAPARTICLE_H

#include "JSystem/JSupport/JSUList.h"
#include "SSystem/SComponent/c_xyz.h"
#include "dolphin/gx/GXStruct.h"

class JKRHeap;
class JPABaseEmitter;
class JPABaseParticle;
class JPAEmitterCallBack;
class JPAEmitterManager;
class JPAParticleCallBack;
class JPAResourceManager;
struct JPAEmitterWorkData;
struct JPACallBackBase2;

class JPABaseParticle {
public:
void initParticle();
void initChild(JPABaseParticle*);
void incFrame();
void calcVelocity();
void calcPosition();
void checkCreateChild();

~JPABaseParticle();
JPABaseParticle();

public:
/* 0x00 */ JSUPtrLink mLink;
/* 0x10 */ cXyz mGlobalPosition;
/* 0x1C */ cXyz mLocalPosition;
/* 0x28 */ cXyz mPosition;
/* 0x34 */ cXyz mVelocity;
/* 0x40 */ cXyz mBaseVel;
/* 0x4C */ cXyz mAccel;
/* 0x58 */ cXyz mFieldVel;
/* 0x64 */ cXyz mFieldAccel;
/* 0x70 */ f32 mAirResist;
/* 0x74 */ f32 mMoment;
/* 0x78 */ f32 mCurFrame;
/* 0x7C */ f32 mLifeTime;
/* 0x80 */ f32 mCurNormTime;
/* 0x84 */ f32 mFieldDrag;
/* 0x88 */ f32 mDrag;
/* 0x8C */ cXyz mAxis;
/* 0x98 */ f32 mScaleOut;
/* 0x9C */ f32 mScaleX;
/* 0xA0 */ f32 mScaleY;
/* 0xA4 */ u8 field_0xA4[0xAC - 0xA4];
/* 0xAC */ f32 mAlphaOut;
/* 0xB0 */ f32 mAlphaWaveRandom;
/* 0xB4 */ int mLoopOffset;
/* 0xB8 */ GXColor mPrmColor;
/* 0xBC */ GXColor mEnvColor;
/* 0xC0 */ s16 mRotateAngle;
/* 0xC2 */ s16 mRotateSpeed;
/* 0xC4 */ u8 field_0xC4[0xC6 - 0xC4];
/* 0xC6 */ u16 mTexIdx;
/* 0xC8 */ JPACallBackBase2* mpCallBack2;
/* 0xCC */ u32 mFlags;
};

class JPAParticleCallBack {
public:
JPAParticleCallBack() {}
virtual ~JPAParticleCallBack();
virtual void execute(JPABaseEmitter*, JPABaseParticle*);
virtual void draw(JPABaseEmitter*, JPABaseParticle*);
};

// not sure where this belongs
static inline u32 COLOR_MULTI(u32 a, u32 b) {
return ((a * (b + 1)) * 0x10000) >> 24;
}

#endif /* JPAPARTICLE_H */
8 changes: 7 additions & 1 deletion include/SSystem/SComponent/c_bg_s_poly_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ class cBgS_PolyInfo {

public:
cBgS_PolyInfo();
bool ChkSetInfo() const;
void ClearPi();
void SetPolyInfo(const cBgS_PolyInfo&);
void SetActorInfo(int, void*, unsigned int);
Expand All @@ -24,6 +23,13 @@ class cBgS_PolyInfo {

u16 GetPolyIndex() const { return mPolyIndex; }
u16 GetBgIndex() const { return mBgIndex; }
bool ChkSetInfo() const {
if (mPolyIndex == 0xFFFF || mBgIndex == 0x100) {
return false;
}

return true;
}
}; // Size: 0x10

#endif /* C_BG_S_POLY_INFO_H */
21 changes: 13 additions & 8 deletions include/d/d_bg_s.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,31 @@ class cBgS_ChkElm {

STATIC_ASSERT(sizeof(cBgS_ChkElm) == 0x14);

class cBgW;
class cBgS {
public:
/* 0x0000 */ cBgS_ChkElm m_chk_element[256];
/* 0x1400 vtable */

public:
cBgS() {}
bool Regist(dBgW_Base*, unsigned int, void*);
int Release(dBgW_Base*);

bool GetTriPla(cBgS_PolyInfo&) const;
bool Regist(cBgW*, u32, void*);
int Release(cBgW*);
bool LineCross(cBgS_LinChk*);
f32 GroundCross(cBgS_GndChk*);
static void* ConvDzb(void*);
fopAc_ac_c* GetActorPointer(int) const;
dBgW_Base* GetBgWBasePointer(cBgS_PolyInfo const&) const;
bool ChkPolySafe(cBgS_PolyInfo const&);
s32 GetGrpRoomId(cBgS_PolyInfo const&) const;
bool GetTriPla(cBgS_PolyInfo const&, cM3dGPla*) const;
bool GetTriPnt(cBgS_PolyInfo const&, cXyz*, cXyz*, cXyz*) const;
dBgW_Base* GetBgWPointer(cBgS_PolyInfo&) const;
bool ChkPolySafe(cBgS_PolyInfo&);
void GetTriGrp(int, int) const;
void GetGrpToRoomId(int, int) const;
cM3dGPla* GetTriPla(int, int) const;
bool GetTriPnt(cBgS_PolyInfo&, cXyz*, cXyz*, cXyz*) const;
void Move(void);
void ShdwDraw(cBgS_ShdwDraw*);
u32 GetGrpInf(cBgS_PolyInfo const&) const;
u32 GetGrpInf(cBgS_PolyInfo&, int) const;

virtual ~cBgS() {}
virtual void Ct();
Expand Down
103 changes: 96 additions & 7 deletions include/d/d_com_inf_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "d/d_save.h"
#include "d/d_stage.h"
#include "d/d_vibration.h"
#include "d/d_wood.h"

class JKRArchive;
class JKRExpHeap;
Expand Down Expand Up @@ -90,29 +91,33 @@ class dComIfG_play_c {
void createDemo();
void removeDemo();
void executeEvtManager();
void createMagma();
dMagma_packet_c* createMagma();
void removeMagma();
void executeMagma();
void drawMagma();
void createGrass();
dGrass_packet_c* createGrass();
void removeGrass();
void executeGrass();
void drawGrass();
void createFlower();
dFlower_packet_c* createFlower();
void removeFlower();
void executeFlower();
void drawFlower();
void createTree();
dTree_packet_c* createTree();
void removeTree();
void executeTree();
void drawTree();
void createWood();
dWood::Packet_c* createWood();
void removeWood();
void executeWood();
void drawWood();

~dComIfG_play_c();

dStage_roomControl_c* getRoomControl() { return &mRoomCtrl; }
dStage_stageDt_c& getStage() { return mStageData; }
dEvt_control_c& getEvent() { return mEvtCtrl; }

const char* getStartStageName() { return mCurStage.getName(); }
s8 getStartStageRoomNo() { return mCurStage.getRoomNo(); }
s8 getStartStageLayer() { return mCurStage.getLayer(); }
Expand Down Expand Up @@ -180,7 +185,7 @@ class dComIfG_play_c {
/* 0x482C */ dMagma_packet_c* mpMagmaPacket;
/* 0x4830 */ dGrass_packet_c* mpGrassPacket;
/* 0x4834 */ dTree_packet_c* mpTreePacket;
/* 0x4838 */ Packet_c* mpWoodPacket;
/* 0x4838 */ dWood::Packet_c* mpWoodPacket;
/* 0x483C */ dFlower_packet_c* mpFlowerPacket;
/* 0x4840 */ s8 mLkDArcIdx;
/* 0x4841 */ u8 field_0x4841;
Expand All @@ -192,7 +197,7 @@ class dComIfG_play_c {
/* 0x48A9 */ u8 field_0x48A9[0x48AC - 0x48A9];
/* 0x48AC */ fopAc_ac_c* mpPlayerPtr[3]; // 0: Link, 1: Partner, 2: Ship
/* 0x48B8 */ f32 field_0x48b8;
/* 0x48BC */ int mItemLifeCount;
/* 0x48BC */ f32 mItemLifeCount;
/* 0x48C0 */ int mItemRupeeCount;
/* 0x48C4 */ int mAirMeter;
/* 0x48C8 */ int field_0x48c8;
Expand Down Expand Up @@ -322,6 +327,8 @@ extern dComIfG_inf_c g_dComIfG_gameInfo;
* === SAVE ===
*/

u8 dComIfGs_checkGetItem(u8);

inline u8 dComIfGs_getSelectEquip(int param_0) {
return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().getSelectEquip(param_0);
}
Expand Down Expand Up @@ -350,6 +357,58 @@ inline int dComIfGs_getTriforceNum() {
return g_dComIfG_gameInfo.info.getPlayer().getCollect().getTriforceNum();
}

inline u8 dComIfGs_getOptVibration() {
return g_dComIfG_gameInfo.info.getPlayer().getConfig().getVibration();
}

inline BOOL dComIfGs_isTbox(int i_no) {
return g_dComIfG_gameInfo.info.getMemory().getBit().isTbox(i_no);
}

inline BOOL dComIfGs_isSaveTbox(int i_stageNo, int i_no) {
return g_dComIfG_gameInfo.info.getSavedata().getSave(i_stageNo).getBit().isTbox(i_no);
}

inline void dComIfGs_onTbox(int i_no) {
g_dComIfG_gameInfo.info.getMemory().getBit().onTbox(i_no);
}

inline void dComIfGs_onSaveTbox(int i_stageNo, int i_no) {
g_dComIfG_gameInfo.info.getSavedata().getSave(i_stageNo).getBit().onTbox(i_no);
}

inline BOOL dComIfGs_isStageBossEnemy() {
return g_dComIfG_gameInfo.info.getMemory().getBit().isStageBossEnemy();
}

inline void dComIfGs_onStageLife() {
g_dComIfG_gameInfo.info.getMemory().getBit().onStageLife();
}

inline BOOL dComIfGs_isStageLife() {
return g_dComIfG_gameInfo.info.getMemory().getBit().isStageLife();
}

inline BOOL dComIfGs_isCollect(int i_idx, u8 i_item) {
return g_dComIfG_gameInfo.info.getPlayer().getCollect().isCollect(i_idx, i_item);
}

inline void dComIfGs_onCollect(int i_idx, u8 i_item) {
g_dComIfG_gameInfo.info.getPlayer().getCollect().onCollect(i_idx, i_item);
}

inline BOOL dComIfGs_isTact(u8 i_no) {
return g_dComIfG_gameInfo.info.getPlayer().getCollect().isTact(i_no);
}

inline BOOL dComIfGs_isTriforce(u8 i_no) {
return g_dComIfG_gameInfo.info.getPlayer().getCollect().isTriforce(i_no);
}

inline BOOL dComIfGs_isSymbol(u8 i_no) {
return g_dComIfG_gameInfo.info.getPlayer().getCollect().isSymbol(i_no);
}

/**
* === PLAY ===
*/
Expand Down Expand Up @@ -409,10 +468,40 @@ inline fopAc_ac_c* dComIfGp_getPlayer(int idx) {
return g_dComIfG_gameInfo.play.getPlayer(idx);
}

inline roomRead_class* dComIfGp_getStageRoom() {
return g_dComIfG_gameInfo.play.getStage().getRoom();
}

inline dStage_Multi_c* dComIfGp_getMulti() {
return g_dComIfG_gameInfo.play.getStage().getMulti();
}

inline stage_stag_info_class* dComIfGp_getStageStagInfo() {
return g_dComIfG_gameInfo.play.getStage().getStagInfo();
}

inline dStage_roomStatus_c* dComIfGp_roomControl_getStatusRoomDt(int room_no) {
return g_dComIfG_gameInfo.play.getRoomControl()->getStatusRoomDt(room_no);
}

inline dBgS* dComIfG_Bgsp() {
return &g_dComIfG_gameInfo.play.mBgS;
}

inline daPy_lk_c* daPy_getPlayerLinkActorClass() {
return (daPy_lk_c*)g_dComIfG_gameInfo.play.getPlayerPtr(0);
}

/**
* === DRAWLIST ===
*/

inline int dComIfGd_setSimpleShadow(cXyz* pos, f32 param_1, f32 param_2, cXyz* param_3, s16 angle,
f32 param_5, _GXTexObj* tex) {
return g_dComIfG_gameInfo.drawlist.setSimpleShadow(pos, param_1, param_2, param_3, angle,
param_5, tex);
}

/**
* === RESOURCE ===
*/
Expand Down
12 changes: 8 additions & 4 deletions include/d/d_drawlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,7 @@ class dDlst_shadowTri_c {

class dDlst_shadowPoly_c {
public:
dDlst_shadowPoly_c() {
reset();
}
dDlst_shadowPoly_c() { reset(); }

void reset() { mCount = 0; }

Expand Down Expand Up @@ -173,7 +171,7 @@ class dDlst_list_c {
dDlst_list_c();
~dDlst_list_c();

void init();
void init();
void reset();
void entryZSortXluDrawList(J3DDrawBuffer*, J3DPacket*, cXyz&);
void set(dDlst_base_c**&, dDlst_base_c**&, dDlst_base_c*);
Expand All @@ -183,6 +181,12 @@ class dDlst_list_c {
void calcWipe();
void set2DOpa(dDlst_base_c*);

int setSimpleShadow(cXyz* param_0, f32 param_1, f32 param_2, cXyz* param_3, s16 param_4,
f32 param_5, _GXTexObj* param_6) {
return mShadowControl.setSimple(param_0, param_1, param_2, param_3, param_4, param_5,
param_6);
}

private:
/* 0x00000 */ J3DDrawBuffer* mpBufSkyOpa;
/* 0x00004 */ J3DDrawBuffer* mpBufSkyXlu;
Expand Down
Loading

0 comments on commit 7afd21a

Please sign in to comment.