Skip to content

Commit

Permalink
d_s_open 99%
Browse files Browse the repository at this point in the history
  • Loading branch information
magcius committed Oct 3, 2023
1 parent 44249fb commit a1868a8
Show file tree
Hide file tree
Showing 8 changed files with 145 additions and 41 deletions.
6 changes: 3 additions & 3 deletions include/SSystem/SComponent/c_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@


typedef struct node_class {
struct node_class* mpPrevNode;
void* mpData;
struct node_class* mpNextNode;
/* 0x00 */ struct node_class* mpPrevNode;
/* 0x04 */ void* mpData;
/* 0x08 */ struct node_class* mpNextNode;
} node_class;

void cNd_Join(node_class* pA, node_class* pB);
Expand Down
6 changes: 3 additions & 3 deletions include/SSystem/SComponent/c_tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ typedef struct node_list_class node_list_class;
typedef struct node_lists_tree_class node_lists_tree_class;

typedef struct create_tag_class {
node_class mpNode;
void* mpTagData;
s8 mbIsUse;
/* 0x00 */ node_class mpNode;
/* 0x0C */ void* mpTagData;
/* 0x10 */ s8 mbIsUse;
} create_tag_class;

int cTg_IsUse(create_tag_class* pTag);
Expand Down
11 changes: 11 additions & 0 deletions include/d/d_com_inf_game.h
Original file line number Diff line number Diff line change
Expand Up @@ -1184,6 +1184,8 @@ inline u8 dComIfGp_getMiniGameType() {
return g_dComIfG_gameInfo.play.mMiniGameType;
}

inline dDlst_window_c * dComIfGp_getWindow(int idx) { return &g_dComIfG_gameInfo.play.mDlstWindow[idx]; }

/**
* === EVENT ===*/

Expand Down Expand Up @@ -1440,6 +1442,13 @@ inline MtxP dComIfGd_getViewRotMtx() {
return dComIfGd_getView()->mViewMtxNoTrans;
}

inline void dComIfGd_set2DOpa(dDlst_base_c* pBase) { g_dComIfG_gameInfo.drawlist.set2DOpa(pBase); }
inline void dComIfGd_set2DXlu(dDlst_base_c* pBase) { g_dComIfG_gameInfo.drawlist.set2DXlu(pBase); }

inline void dComIfGd_setWindow(dDlst_window_c* pWindow) { g_dComIfG_gameInfo.drawlist.setWindow(pWindow); }
inline void dComIfGd_setViewPort(view_port_class* pViewPort) { g_dComIfG_gameInfo.drawlist.setViewPort(pViewPort); }
inline void dComIfGd_setView(view_class* pView) { g_dComIfG_gameInfo.drawlist.setView(pView); }

/**
* === RESOURCE ===
*/
Expand Down Expand Up @@ -1583,4 +1592,6 @@ inline void dComIfG_TimerDeleteRequest() {
dComIfG_getTimerPtr()->deleteRequest();
}

int dComIfG_changeOpeningScene(scene_class* i_scene, s16 i_procName);

#endif /* D_COM_D_COM_INF_GAME_H */
21 changes: 14 additions & 7 deletions include/d/d_drawlist.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class ResTIMG;
class dDlst_base_c {
public:
dDlst_base_c() {}
virtual ~dDlst_base_c();
virtual void draw();
};

Expand Down Expand Up @@ -208,7 +209,6 @@ class dDlst_list_c {
void wipeIn(f32, GXColor&);
void wipeIn(f32);
void calcWipe();
void set2DOpa(dDlst_base_c*);

J3DDrawBuffer* getOpaListFilter() { return mpWetherFxBuffer; }

Expand Down Expand Up @@ -237,6 +237,9 @@ class dDlst_list_c {
entryZSortXluDrawList(mpBufInvisibleModelXlu, i_packet, param_1);
}

void set2DOpa(dDlst_base_c* pList) { set(mp2DOpa, mp2DOpaEnd, pList); }
void set2DXlu(dDlst_base_c* pList) { set(mp2DXlu, mp2DXluEnd, pList); }

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,
Expand All @@ -253,6 +256,10 @@ class dDlst_list_c {
s32 getSpotModelNum() { return mpSpotModel->getNum(); }
s32 getLightModelNum() { return mpLightModel->getNum(); }

void setWindow(dDlst_window_c* pWindow) { mpWindow = pWindow; }
void setViewPort(view_port_class* pViewPort) { mpViewPort = pViewPort; }
void setView(view_class* pView) { mpCamera = (camera_class*)pView; }

static void offWipe() { mWipe = false; }

static bool mWipe;
Expand All @@ -279,13 +286,13 @@ class dDlst_list_c {
/* 0x00098 */ void* field_0x00098;
/* 0x0009C */ dDlst_base_c* mp2DArr[64];
/* 0x0019C */ dDlst_base_c** mp2DOpa;
/* 0x001A0 */ dDlst_base_c*** mp2DOpaEnd;
/* 0x001A0 */ dDlst_base_c** mp2DOpaEnd;
/* 0x001A4 */ u8 field_0x001A4[0x00224 - 0x001A4];
/* 0x00224 */ dDlst_base_c** field_0x00224;
/* 0x00228 */ dDlst_base_c*** field_0x00228;
/* 0x0022C */ dDlst_window_c* field_0x0022c;
/* 0x00230 */ dDlst_window_c* field_0x00230;
/* 0x00234 */ camera_class* mpCamera;
/* 0x00224 */ dDlst_base_c** mp2DXlu;
/* 0x00228 */ dDlst_base_c** mp2DXluEnd;
/* 0x0022C */ dDlst_window_c* mpWindow;
/* 0x00230 */ view_port_class* mpViewPort;
/* 0x00234 */ camera_class* mpCamera; // should be view_class*
/* 0x00238 */ u8 field_0x00238[0x00244 - 0x00238];
/* 0x00244 */ dDlst_alphaModel_c* mpAlphaModel;
/* 0x00248 */ dDlst_alphaModel_c* mpSpotModel;
Expand Down
6 changes: 2 additions & 4 deletions include/f_op/f_op_scene_tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,10 @@
#define F_F_OP_SCENE_TAG_H_

#include "SSystem/SComponent/c_phase.h"
#include "f_pc/f_pc_create_tag.h"
#include "f_pc/f_pc_node.h"


class scene_tag_class {
public:
u8 field_0x00[0x14];
class scene_tag_class : public create_tag_class {
};

void fopScnTg_QueueTo(scene_tag_class* pSceneTag);
Expand Down
129 changes: 109 additions & 20 deletions src/d/d_s_open.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,145 @@
// Translation Unit: d_s_open.cpp
//

#include "d_s_open.h"
#include "dolphin/types.h"
#include "f_op/f_op_scene.h"
#include "f_op/f_op_draw_iter.h"
#include "f_op/f_op_scene_mng.h"
#include "f_op/f_op_overlap_mng.h"
#include "JSystem/JKernel/JKRSolidHeap.h"
#include "d/d_com_inf_game.h"
#include "d/d_procname.h"
#include "m_Do/m_Do_audio.h"
#include "m_Do/m_Do_controller_pad.h"

class dScnOpen_message_c;
class J2DScreen;

class dScnOpen_proc_c : public dDlst_base_c {
public:
dScnOpen_proc_c();
virtual ~dScnOpen_proc_c();
void proc_execute();

/* 0x004 */ JKRExpHeap* exp_heap;
/* 0x008 */ dScnOpen_message_c* m_message;
/* 0x00C */ J2DScreen* m_Screen;
/* 0x010 */ u8 pad[0x2a0];
/* 0x2B0 */ s32 field_0x2b0;
/* 0x010 */ u8 pad2[0x014];
};

class dScnOpen_c : public scene_class {
public:
~dScnOpen_c();
void changeGameScene();
s32 create();
BOOL draw();
BOOL execute();

/* 0x1C4 */ request_of_phase_process_class mPhs;
/* 0x1CC */ JKRSolidHeap* solid_heap;
/* 0x1D0 */ dScnOpen_proc_c* mpProc;
/* 0x1D4 */ u8 field_0x1d4;
};

/* 80232A68-80232BC4 .text create__10dScnOpen_cFv */
void dScnOpen_c::create() {
/* Nonmatching */
s32 dScnOpen_c::create() {
dComIfGp_offEnableNextStage();
mpProc = NULL;

s32 rt = dComIfG_resLoad(&mPhs, "Opening");
if (rt == cPhs_COMPLEATE_e) {
solid_heap = mDoExt_createSolidHeapFromGameToCurrent(0x20000, 0);
JUT_ASSERT(0x3b, solid_heap != 0);
mpProc = new dScnOpen_proc_c();
field_0x1d4 = NULL;
mDoExt_restoreCurrentHeap();
mDoExt_adjustSolidHeap(solid_heap);
// mDoGph_gInf_c::setTickRate();
} else if (rt == cPhs_ERROR_e) {
JUT_ASSERT(0x48, rt == cPhs_COMPLEATE_e);
}
return rt;
}

/* 80232BC4-80232CAC .text execute__10dScnOpen_cFv */
void dScnOpen_c::execute() {
/* Nonmatching */
BOOL dScnOpen_c::execute() {
if (mpProc->field_0x2b0 >= 5 && !fopOvlpM_IsPeek() && !dComIfG_resetToOpening(this)) {
if (fpcM_GetName(this) == PROC_OPEN2_SCENE && (CPad_CHECK_TRIG_A(0) || CPad_CHECK_TRIG_B(0) || CPad_CHECK_TRIG_START(0))) {
field_0x1d4 = 1;
mDoAud_bgmStop(20);
}

if (field_0x1d4 == 1 && !mDoAud_isUsedHeapForStreamBuffer())
dComIfG_changeOpeningScene(this, PROC_OPENING2_SCENE);
}

mpProc->proc_execute();
if (mpProc->field_0x2b0 == 44)
changeGameScene();

return TRUE;
}

/* 80232CAC-80232D38 .text draw__10dScnOpen_cFv */
void dScnOpen_c::draw() {
/* Nonmatching */
BOOL dScnOpen_c::draw() {
dComIfGd_setWindow(dComIfGp_getWindow(0));
dComIfGd_setViewPort(dComIfGp_getWindow(0)->getViewPort());
for (create_tag_class* pTag = fopDwIt_Begin(); pTag != NULL; pTag = fopDwIt_Next(pTag))
fpcM_Draw(pTag->mpTagData);
dComIfGd_set2DOpa(mpProc);
return TRUE;
}

/* 80232D38-80232DD8 .text __dt__10dScnOpen_cFv */
dScnOpen_c::~dScnOpen_c() {
/* Nonmatching */
if (mpProc != NULL)
delete mpProc;
if (solid_heap != NULL)
mDoExt_destroySolidHeap(solid_heap);
dComIfG_resDelete(&mPhs, "Opening");
g_dComIfG_gameInfo.play.field_0x4841 = 0;
}

/* 80232DD8-80232E6C .text changeGameScene__10dScnOpen_cFv */
void dScnOpen_c::changeGameScene() {
/* Nonmatching */
if (fopOvlpM_IsPeek())
return;

if (fpcM_GetName(this) == PROC_OPEN2_SCENE) {
dComIfG_changeOpeningScene(this, PROC_OPENING2_SCENE);
} else {
if (fopScnM_ChangeReq(this, PROC_PLAY_SCENE, 0, 5)) {
dComIfGs_setRestartRoomParam(0);
mDoAud_setSceneName(dComIfGp_getNextStageName(), dComIfGp_getNextStageRoomNo(), dComIfGp_getNextStageLayer());
}
}
}

/* 80232E6C-80232E8C .text dScnOpen_Draw__FP10dScnOpen_c */
void dScnOpen_Draw(dScnOpen_c*) {
/* Nonmatching */
BOOL dScnOpen_Draw(dScnOpen_c* i_this) {
return i_this->draw();
}

/* 80232E8C-80232EAC .text dScnOpen_Execute__FP10dScnOpen_c */
void dScnOpen_Execute(dScnOpen_c*) {
/* Nonmatching */
BOOL dScnOpen_Execute(dScnOpen_c* i_this) {
return i_this->execute();
}

/* 80232EAC-80232EB4 .text dScnOpen_IsDelete__FP10dScnOpen_c */
void dScnOpen_IsDelete(dScnOpen_c*) {
/* Nonmatching */
BOOL dScnOpen_IsDelete(dScnOpen_c* i_this) {
return TRUE;
}

/* 80232EB4-80232EDC .text dScnOpen_Delete__FP10dScnOpen_c */
void dScnOpen_Delete(dScnOpen_c*) {
/* Nonmatching */
BOOL dScnOpen_Delete(dScnOpen_c* i_this) {
i_this->~dScnOpen_c();
return TRUE;
}

/* 80232EDC-80232EFC .text dScnOpen_Create__FP11scene_class */
void dScnOpen_Create(scene_class*) {
/* Nonmatching */
s32 dScnOpen_Create(scene_class* i_scn) {
dScnOpen_c* i_this = (dScnOpen_c*)i_scn;
return i_this->create();
}

4 changes: 2 additions & 2 deletions src/f_op/f_op_scene_mng.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ scene_class* fopScnM_SearchByID(unsigned int id) {

static u32 l_scnRqID = 0xFFFFFFFF;

int fopScnM_ChangeReq(scene_class* i_scene, s16 param_2, s16 param_3, u16 param_4) {
u32 sceneRequestID = fopScnRq_Request(2, i_scene, param_2, 0, param_3, param_4);
int fopScnM_ChangeReq(scene_class* i_scene, s16 procName, s16 fadeTime, u16 param_4) {
u32 sceneRequestID = fopScnRq_Request(2, i_scene, procName, 0, fadeTime, param_4);

if (sceneRequestID == 0xFFFFFFFF) {
return 0;
Expand Down
3 changes: 1 addition & 2 deletions src/f_op/f_op_scene_req.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ static scene_request_class* fopScnRq_FadeRequest(s16 param_1, u16 param_2) {
return (scene_request_class*)req;
}

s32 fopScnRq_Request(int param_1, scene_class* i_scene, s16 param_3, void* param_4, s16 param_5,
u16 param_6) {
s32 fopScnRq_Request(int param_1, scene_class* i_scene, s16 param_3, void* param_4, s16 param_5, u16 param_6) {
static node_create_request_method_class submethod = {
(process_method_func)fopScnRq_Execute,
(process_method_func)fopScnRq_Cancel,
Expand Down

0 comments on commit a1868a8

Please sign in to comment.