d_menu_calibration done / J3DDrawBuffer done / more d_drawlist wip (#312)

* d_drawlist work / finish J3DDrawBuffer

* d_menu_calibration done

* remove asm
This commit is contained in:
TakaRikka
2023-03-28 04:11:41 -07:00
committed by GitHub
parent 721880831e
commit 92b88e83e8
52 changed files with 1057 additions and 2682 deletions
@@ -5,6 +5,30 @@
#include "dolphin/mtx/mtx.h"
#include "dolphin/types.h"
// matches debug
inline f32 J3DCalcZValue(register MtxP m, register Vec v) {
register f32 temp_f4;
register f32 out;
register f32 temp_f0;
register f32 temp_f2;
register f32 temp_f1 = 1.0f;
// clang-format off
asm {
psq_l temp_f0, 0(v), 0, 0 /* qr0 */
lfs temp_f2, 8(v)
psq_l temp_f4, 32(m), 0, 0 /* qr0 */
psq_l out, 40(m), 0, 0 /* qr0 */
ps_merge00 temp_f2, temp_f2, temp_f1
ps_mul temp_f4, temp_f0, temp_f4
ps_madd out, temp_f2, out, temp_f4
ps_sum0 out, out, out, out
}
// clang-format on
return out;
}
class J3DDrawBuffer;
class J3DPacket;
class J3DDrawPacket;
@@ -46,6 +70,8 @@ public:
void drawHead() const;
void drawTail() const;
u32 getEntryTableSize() { return mBufSize; }
inline void calcZRatio();
void setNonSort() { mSortType = 5; }
void setZSort() { mSortType = 2; }
+3
View File
@@ -2,6 +2,9 @@
#define C_BG_S_CHK_H
#include "dolphin/types.h"
#include "dolphin/mtx/vec.h"
struct cBgD_Vtx_t : public Vec {};
class cBgS_GrpPassChk {
public:
+15
View File
@@ -71,6 +71,21 @@ inline T cLib_minMaxLimit(T val, T min, T max) {
return (T)ret;
}
template <typename T>
inline T cLib_maxLimit(T val, T max) {
T ret;
T var_r30;
if (val > max) {
var_r30 = max;
} else {
var_r30 = val;
}
ret = var_r30;
return (T)ret;
}
template <typename T>
T cLib_calcTimer(T* val);
+1
View File
@@ -26,6 +26,7 @@ public:
f32 getPlaneFunc(const Vec* pPoint) const { return mD + PSVECDotProduct(&mNormal, pPoint); }
const cXyz& GetNP() const { return mNormal; }
const cXyz& i_GetNP() const { return mNormal; }
f32 GetD() const { return mD; }
void SetupFrom3Vtx(const Vec* v1, const Vec* v2, const Vec* v3) {
cM3d_CalcPla(v1, v2, v3, &mNormal, &mD);
+8
View File
@@ -1665,6 +1665,14 @@ inline u8 dComIfGs_getWalletSize() {
return g_dComIfG_gameInfo.info.getPlayer().getPlayerStatusA().getWalletSize();
}
inline void dComIfGs_setOptCalValue(s8 i_calValue) {
g_dComIfG_gameInfo.info.getPlayer().getConfig().setCalValue(i_calValue);
}
inline void dComIfGs_setOptCalibrateDist(u16 i_calibrateDist) {
g_dComIfG_gameInfo.info.getPlayer().getConfig().setCalibrateDist(i_calibrateDist);
}
void dComIfGp_setSelectItem(int index);
s32 dComIfGp_offHeapLockFlag(int flag);
void dComIfGp_createSubExpHeap2D();
+48 -34
View File
@@ -131,31 +131,37 @@ public:
/* 0x38 */ Mtx mMtx;
}; // Size: 0x68
struct cBgD_Vtx_t {};
struct cBgD_Vtx_t;
class dDlst_shadowTri_c {
public:
/* 80056270 */ ~dDlst_shadowTri_c() {}
/* 80056344 */ dDlst_shadowTri_c() {}
/* 0x0 */ cXyz mPos[3];
};
class dDlst_shadowPoly_c {
public:
/* 80054288 */ void set(cBgD_Vtx_t*, u16, u16, u16, cM3dGPla*);
dDlst_shadowPoly_c() {
reset();
}
void reset() { mCount = 0; }
/* 80054288 */ int set(cBgD_Vtx_t*, u16, u16, u16, cM3dGPla*);
/* 800543B4 */ void draw();
virtual void getTri() = 0;
virtual dDlst_shadowTri_c* getTri() = 0;
virtual s32 getTriMax() = 0;
/* 0x4 */ u16 mCount;
/* 0x6 */ u8 field_0x6[2];
};
class dDlst_shadowTri_c {
public:
/* 80056270 */ ~dDlst_shadowTri_c();
/* 80056344 */ dDlst_shadowTri_c();
/* 0x0 */ cXyz mPos[3];
};
class dDlst_shadowRealPoly_c : public dDlst_shadowPoly_c {
public:
/* 800569A0 */ virtual void getTri();
/* 800569A0 */ virtual dDlst_shadowTri_c* getTri();
/* 800569A8 */ virtual s32 getTriMax();
/* 0x8 */ dDlst_shadowTri_c mShadowTri[256];
@@ -166,11 +172,16 @@ public:
/* 800544F0 */ void reset();
/* 80054500 */ void imageDraw(f32 (*)[4]);
/* 800545D4 */ void draw();
/* 80054BD0 */ void setShadowRealMtx(cXyz*, cXyz*, f32, f32, f32, dKy_tevstr_c*);
/* 80055028 */ void set(u32, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*, f32, f32);
/* 80054BD0 */ u8 setShadowRealMtx(cXyz*, cXyz*, f32, f32, f32, dKy_tevstr_c*);
/* 80055028 */ u32 set(u32, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*, f32, f32);
/* 800551D4 */ bool add(J3DModel*);
/* 800561F8 */ ~dDlst_shadowReal_c() {}
/* 800562D0 */ dDlst_shadowReal_c();
/* 800562D0 */ dDlst_shadowReal_c() { mState = 0; }
dDlst_shadowReal_c* getZsortNext() { return mZsortNext; }
bool isNoUse() { return mState == 0; }
bool isUse() { return mState == 1; }
bool checkKey(u32 i_key) { return mKey == i_key; }
private:
/* 0x0000 */ u8 mState;
@@ -196,7 +207,7 @@ public:
/* 800557C8 */ void imageDraw(f32 (*)[4]);
/* 80055A14 */ void draw(f32 (*)[4]);
/* 80055C74 */ int setReal(u32, s8, J3DModel*, cXyz*, f32, f32, dKy_tevstr_c*);
/* 80055F1C */ void addReal(u32, J3DModel*);
/* 80055F1C */ bool addReal(u32, J3DModel*);
/* 80055F84 */ int setSimple(cXyz*, f32, f32, cXyz*, s16, f32, _GXTexObj*);
/* 80055FE8 */ static void setSimpleTex(ResTIMG const*);
@@ -214,8 +225,7 @@ private:
/* 0x0340C */ int mNextID;
/* 0x03410 */ dDlst_shadowReal_c mReal[8];
/* 0x15EB0 */ _GXTexObj field_0x15eb0[2];
/* 0x15EF0 */ void* field_0x15ef0;
/* 0x15EF4 */ void* field_0x15ef4;
/* 0x15EF0 */ void* field_0x15ef0[2];
};
class dDlst_window_c {
@@ -284,10 +294,10 @@ public:
/* 0x14 */ DB_LIST_3D_LAST,
};
void set2DOpa(dDlst_base_c* dlst) { set(mp2DOpaSet[0], mp2DOpaSet[1], dlst); }
void set2DOpaTop(dDlst_base_c* dlst) { set(mp2DOpaTopSet[0], mp2DOpaTopSet[1], dlst); }
void set2DXlu(dDlst_base_c* dlst) { set(mp2DXluSet[0], mp2DXluSet[1], dlst); }
void setCopy2D(dDlst_base_c* dlst) { set(mpCopy2DSet[0], mpCopy2DSet[1], dlst); }
void set2DOpa(dDlst_base_c* dlst) { set(mp2DOpaStart, mp2DOpaEnd, dlst); }
void set2DOpaTop(dDlst_base_c* dlst) { set(mp2DOpaTopStart, mp2DOpaTopEnd, dlst); }
void set2DXlu(dDlst_base_c* dlst) { set(mp2DXluStart, mp2DXluEnd, dlst); }
void setCopy2D(dDlst_base_c* dlst) { set(mpCopy2DStart, mpCopy2DEnd, dlst); }
view_class* getView() { return mView; }
void setView(view_class* view) { mView = view; }
void setWindow(dDlst_window_c* window) { mWindow = window; }
@@ -334,7 +344,7 @@ public:
view_port_class* getViewport() { return mViewport; }
void drawCopy2D() { draw(mpCopy2DDraw[0], mpCopy2DSet[0]); }
void drawCopy2D() { draw(mpCopy2DDrawLists, mpCopy2DStart); }
void drawOpaListSky() { drawOpaDrawList(mDrawBuffers[DB_OPA_LIST_SKY]); }
void drawXluListSky() { drawXluDrawList(mDrawBuffers[DB_XLU_LIST_SKY]); }
void drawOpaListBG() { drawOpaDrawList(mDrawBuffers[DB_OPA_LIST_BG]); }
@@ -354,9 +364,9 @@ public:
void drawOpaList3Dlast() { drawOpaDrawList(mDrawBuffers[DB_LIST_3D_LAST]); }
void drawOpaListFilter() { drawOpaDrawList(mDrawBuffers[DB_LIST_FILTER]); }
void drawOpaListP0() { drawOpaDrawList(mDrawBuffers[DB_LIST_P0]); }
void draw2DOpa() { draw(mp2DOpaDraw[0], mp2DOpaSet[0]); }
void draw2DOpaTop() { draw(mp2DOpaTopDraw[0], mp2DOpaTopSet[0]); }
void draw2DXlu() { draw(mp2DXluDraw[0], mp2DXluSet[0]); }
void draw2DOpa() { draw(mp2DOpaDrawLists, mp2DOpaStart); }
void draw2DOpaTop() { draw(mp2DOpaTopDrawLists, mp2DOpaTopStart); }
void draw2DXlu() { draw(mp2DXluDrawLists, mp2DXluStart); }
void imageDrawShadow(Mtx param_0) { mShadowControl.imageDraw(param_0); }
void drawShadow(Mtx param_0) { mShadowControl.draw(param_0); }
@@ -372,14 +382,18 @@ public:
private:
/* 0x00000 */ J3DDrawBuffer* mDrawBuffers[21];
/* 0x00054 */ dDlst_base_c** mpCopy2DDraw[4];
/* 0x00064 */ dDlst_base_c** mpCopy2DSet[2];
/* 0x0006C */ dDlst_base_c** mp2DOpaTopDraw[16];
/* 0x000AC */ dDlst_base_c** mp2DOpaTopSet[2];
/* 0x000B4 */ dDlst_base_c** mp2DOpaDraw[64];
/* 0x001B4 */ dDlst_base_c** mp2DOpaSet[2];
/* 0x001BC */ dDlst_base_c** mp2DXluDraw[32];
/* 0x0023C */ dDlst_base_c** mp2DXluSet[2];
/* 0x00054 */ dDlst_base_c* mpCopy2DDrawLists[4];
/* 0x00064 */ dDlst_base_c** mpCopy2DStart;
/* 0x00068 */ dDlst_base_c** mpCopy2DEnd;
/* 0x0006C */ dDlst_base_c* mp2DOpaTopDrawLists[16];
/* 0x000AC */ dDlst_base_c** mp2DOpaTopStart;
/* 0x000B0 */ dDlst_base_c** mp2DOpaTopEnd;
/* 0x000B4 */ dDlst_base_c* mp2DOpaDrawLists[64];
/* 0x001B4 */ dDlst_base_c** mp2DOpaStart;
/* 0x001B8 */ dDlst_base_c** mp2DOpaEnd;
/* 0x001BC */ dDlst_base_c* mp2DXluDrawLists[32];
/* 0x0023C */ dDlst_base_c** mp2DXluStart;
/* 0x00240 */ dDlst_base_c** mp2DXluEnd;
/* 0x00244 */ dDlst_window_c* mWindow;
/* 0x00248 */ view_port_class* mViewport;
/* 0x0024C */ view_class* mView;
+8 -12
View File
@@ -1,11 +1,10 @@
#ifndef D_D_SELECT_CURSOR_H
#define D_D_SELECT_CURSOR_H
#include "JSystem/J2DGraph/J2DPane.h"
#include "JSystem/J2DGraph/J2DScreen.h"
#include "d/d_drawlist.h"
#include "d/d_select_icon.h"
#include "dolphin/types.h"
#include "JSystem/J2DGraph/J2DScreen.h"
#include "JSystem/J2DGraph/J2DPane.h"
class dSelect_cursorHIO_c {
public:
@@ -49,17 +48,14 @@ public:
mPositionY = y;
}
void onUpdateFlag() {
mUpdateFlag = true;
}
void onUpdateFlag() { mUpdateFlag = true; }
void resetUpdateFlag() {
mUpdateFlag = false;
}
void resetUpdateFlag() { mUpdateFlag = false; }
bool getUpdateFlag() {
return mUpdateFlag;
}
bool getUpdateFlag() { return mUpdateFlag; }
void onPlayAnime(int i_flag) { field_0xb4 |= (1 << i_flag); }
void offPlayAnime(int i_flag) { field_0xb4 &= ~(1 << i_flag); }
private:
/* 0x04 */ J2DScreen* mpScreen;
+1
View File
@@ -42,6 +42,7 @@ void dKy_change_colpat(u8 colpat);
void dKy_BossLight_set(cXyz* param_0, _GXColor* param_1, f32 param_2, u8 param_3);
void dKy_custom_colset(u8 prevGather, u8 curGather, f32 blend);
void dKy_setLight();
cXyz dKy_plight_near_pos();
struct LIGHT_INFLUENCE {
/* 800CFC7C */ ~LIGHT_INFLUENCE() {}
+86 -1
View File
@@ -1,6 +1,91 @@
#ifndef D_MENU_D_MENU_CALIBRATION_H
#define D_MENU_D_MENU_CALIBRATION_H
#include "dolphin/types.h"
#include "d/com/d_com_inf_game.h"
#include "d/msg/d_msg_string.h"
class dMenu_Calibration_c {
public:
enum {
/* 0 */ PROC_STEP1_WAIT,
/* 1 */ PROC_STEP1_MOVE,
/* 2 */ PROC_STEP2_WAIT,
/* 3 */ PROC_STEP2_MOVE,
/* 4 */ PROC_STEP3_WAIT,
/* 5 */ PROC_STEP3_MOVE,
};
/* 801AEDAC */ void _move();
/* 801AEE2C */ void _draw();
/* 801AEE30 */ void step1_wait_init();
/* 801AEF60 */ void step1_wait_move();
/* 801AF084 */ void step1_move_init();
/* 801AF0C0 */ void step1_move_move();
/* 801AF188 */ void step2_wait_init();
/* 801AF1F4 */ void step2_wait_move();
/* 801AF380 */ void step2_move_init();
/* 801AF3BC */ void step2_move_move();
/* 801AF488 */ void step3_wait_init();
/* 801AF4F8 */ void step3_wait_move();
/* 801AF5F4 */ void step3_move_init();
/* 801AF630 */ void step3_move_move();
/* 801AF710 */ void setCalibrationValue();
/* 801AF738 */ void setAButtonString(u16);
/* 801AF7E8 */ void setBButtonString(u16);
/* 801AF898 */ void setStepString(u16);
/* 801AF948 */ void setExplainString(u16);
/* 801AFA00 */ void setHIO(bool);
/* 801AFBF4 */ virtual void draw();
/* 801AED64 */ virtual ~dMenu_Calibration_c();
// this is just a hack to get .data section to match
// not sure how to fix it without this atm
virtual void unk0() = 0;
virtual void unk1() = 0;
/* 0x004 */ JKRExpHeap* mpHeap;
/* 0x008 */ JKRArchive* mpArchive;
/* 0x00C */ J2DScreen* mpCalibrationMainScrn;
/* 0x010 */ J2DScreen* mpDoIconPartsScrn;
/* 0x014 */ J2DTextBox* mpAButtonString[5];
/* 0x028 */ J2DTextBox* mpBButtonString[5];
/* 0x03C */ J2DTextBox* mpExplainString[3];
/* 0x048 */ J2DTextBox* mpStepString[3];
/* 0x054 */ CPaneMgr* field_0x54;
/* 0x058 */ CPaneMgr* field_0x58[3];
/* 0x064 */ CPaneMgr* field_0x64;
/* 0x068 */ CPaneMgr* field_0x68[5];
/* 0x07C */ CPaneMgr* field_0x7c;
/* 0x080 */ CPaneMgr* field_0x80;
/* 0x084 */ CPaneMgr* field_0x84;
/* 0x088 */ CPaneMgr* field_0x88;
/* 0x08C */ CPaneMgr* field_0x8c;
/* 0x090 */ CPaneMgr* field_0x90;
/* 0x094 */ CPaneMgr* field_0x94;
/* 0x098 */ CPaneMgr* field_0x98;
/* 0x09C */ CPaneMgr* field_0x9c;
/* 0x0A0 */ CPaneMgr* field_0xa0;
/* 0x0A4 */ dMsgString_c* mpMsgString;
/* 0x0A8 */ dSelect_cursor_c* mpSelectCursor;
/* 0x0AC */ J2DTextBox::TFontSize field_0xac[5];
/* 0x0D4 */ f32 field_0xd4;
/* 0x0D8 */ f32 field_0xd8;
/* 0x0DC */ f32 field_0xdc;
/* 0x0E0 */ f32 field_0xe0;
/* 0x0E4 */ f32 field_0xe4;
/* 0x0E8 */ int mCalibrationValue;
/* 0x0EC */ int field_0xec;
/* 0x0F0 */ int field_0xf0;
/* 0x0F4 */ u16 mCalibrateDist;
/* 0x0F6 */ s16 field_0xf6;
/* 0x0F8 */ s16 field_0xf8;
/* 0x0FA */ s16 field_0xfa;
/* 0x0FC */ s16 field_0xfc;
/* 0x0FE */ u8 mStatus;
/* 0x0FF */ u8 field_0xff;
/* 0x100 */ u8 mProcess;
/* 0x101 */ u8 field_0x101;
};
#endif /* D_MENU_D_MENU_CALIBRATION_H */
+4
View File
@@ -266,6 +266,10 @@ inline void dMeter2Info_getString(u32 param_0, char* param_1, JMSMesgEntry_c* pa
g_meter2_info.getString(param_0, param_1, param_2);
}
inline void dMeter2Info_getStringKanji(u32 param_0, char* param_1, JMSMesgEntry_c* param_2) {
g_meter2_info.getStringKanji(param_0, param_1, param_2);
}
inline void dMeter2Info_setHotSpringTimer(u8 time) {
g_meter2_info.setHotSpringTimer(time);
}
+5 -2
View File
@@ -435,7 +435,9 @@ public:
class mDoExt_3DlineMatSortPacket : public J3DPacket {
public:
mDoExt_3DlineMatSortPacket();
mDoExt_3DlineMatSortPacket() { mp3DlineMat = NULL; }
void reset() { mp3DlineMat = NULL; }
/* 80014738 */ void setMat(mDoExt_3DlineMat_c*);
virtual void draw();
@@ -505,7 +507,8 @@ public:
class mDoExt_cylinderPacket : public J3DPacket {
public:
mDoExt_cylinderPacket(cXyz& i_position, f32 i_radius, f32 i_height, const GXColor& i_color, u8 param_4) {
mDoExt_cylinderPacket(cXyz& i_position, f32 i_radius, f32 i_height, const GXColor& i_color,
u8 param_4) {
mPosition = i_position;
mRadius = i_radius;
mHeight = i_height;