d_a_nh done (no match) (#55)

* Fix sin and cos

* Fix dCcD_GObjInf JP inlining difference

* Improvements to dDlst_alphaModel_c

* d_a_nh done (no match)
This commit is contained in:
LagoLunatic
2023-09-18 15:29:40 -04:00
committed by GitHub
parent 1040e0498c
commit 01f2fc433f
9 changed files with 303 additions and 214 deletions
+5 -64
View File
@@ -4,74 +4,15 @@
#include "dolphin/types.h"
#include "MSL_C/utility.h"
struct TSinCosTable {
std::pair<f32, f32> table[0x2000];
f32 sinShort(s16 v) const { return table[static_cast<u16>(v) >> 3].first; }
f32 cosShort(s16 v) const { return table[static_cast<u16>(v) >> 3].second; }
inline f32 sinLap(f32 v) {
if (v < 0.0f) {
return -table[(u16)(-8192.0f * v) & 0x1fff].first;
}
return table[(u16)(8192.0f * v) & 0x1fff].first;
}
inline f32 sinDegree(f32 degree) {
if (degree < 0.0f) {
return -table[(u16)(-22.755556106567383f * degree) & 0x1fffU].first;
}
return table[(u16)(22.755556106567383f * degree) & 0x1fffU].first;
}
inline f32 cosDegree(f32 degree) {
if (degree < 0.0f) {
degree = -degree;
}
return table[(u16)(22.755556106567383f * degree) & 0x1fffU].second;
}
};
struct TAtanTable {
f32 table[1025];
u8 pad[0x1C];
};
struct TAsinAcosTable {
f32 table[1025];
u8 pad[0x1C];
};
namespace JMath {
extern TSinCosTable sincosTable_;
extern TAtanTable atanTable_;
extern TAsinAcosTable asinAcosTable_;
}; // namespace JMath
inline f32 JMASCosShort(s16 v) {
return JMath::sincosTable_.cosShort(v);
}
inline f32 JMASinShort(s16 v) {
return JMath::sincosTable_.sinShort(v);
}
extern u32 jmaSinShift;
extern f32 *jmaSinTable;
extern f32 *jmaCosTable;
inline f32 JMASCos(s16 v) {
return JMASCosShort(v);
return jmaCosTable[static_cast<u16>(v) >> jmaSinShift];
}
inline f32 JMASSin(s16 v) {
return JMASinShort(v);
}
inline f32 JMASinLap(f32 v) {
return JMath::sincosTable_.sinLap(v);
}
inline f32 JMASinDegree(f32 degree) {
return JMath::sincosTable_.sinDegree(degree);
}
inline f32 JMACosDegree(f32 degree) {
return JMath::sincosTable_.cosDegree(degree);
return jmaSinTable[static_cast<u16>(v) >> jmaSinShift];
}
#endif /* JMATRIGONOMETRIC_H */
+1 -1
View File
@@ -846,7 +846,7 @@ public:
void checkBottleSwing() const;
void checkCutCharge() const;
void checkTactWait() const;
void getBaseAnimeFrameRate();
f32 getBaseAnimeFrameRate();
void getBaseAnimeFrame();
void getItemID() const;
void getThrowBoomerangID() const;
+5
View File
@@ -149,6 +149,11 @@ public:
}
fopAc_ac_c* Owner() { return (fopAc_ac_c*)mpPlayer; }
void CatchRequest(fopAc_ac_c* param_0, u8 param_1, f32 param_2, f32 param_3,
f32 param_4, s16 param_5, s32 param_6) {
mCatch.request(param_0, param_1, param_2, param_3, param_4, param_5, param_6);
}
public:
/* 0x000 */ daPy_lk_c* mpPlayer;
+6
View File
@@ -228,19 +228,25 @@ public:
virtual ~dCcD_GObjInf();
virtual cCcD_GObjInf* GetGObjInf();
virtual void ClrAtHit();
#if VERSION != VERSION_JPN
u32 ChkAtHit();
#endif
void ResetAtHit();
cCcD_Obj* GetAtHitObj();
cCcD_GObjInf* GetAtHitGObj();
u8 ChkAtNoGuard();
virtual void ClrTgHit();
#if VERSION != VERSION_JPN
u32 ChkTgHit();
#endif
void ResetTgHit();
cCcD_Obj* GetTgHitObj();
dCcD_GObjInf* GetTgHitGObj();
u8 GetTgHitObjSe();
virtual void ClrCoHit();
#if VERSION != VERSION_JPN
u32 ChkCoHit();
#endif
void ResetCoHit();
cCcD_Obj* GetCoHitObj();
void Set(dCcD_SrcGObjInf const&);
+24 -6
View File
@@ -1011,16 +1011,24 @@ inline int dComIfGd_setRealShadow2(u32 id, s8 param_2, J3DModel* pModel, cXyz* p
int dComIfGd_setSimpleShadow2(cXyz* i_pos, f32 param_1, f32 param_2, cBgS_PolyInfo& i_floorPoly, s16 i_angle, f32 param_5, GXTexObj* i_tex);
inline void dComIfGd_setAlphaModel(unsigned char param_0, float(*param_1)[4], unsigned char param_2) {
g_dComIfG_gameInfo.drawlist.setAlphaModel(param_0, param_1, param_2);
inline void dComIfGd_setAlphaModel(u8 type, Mtx mtx, u8 alpha) {
g_dComIfG_gameInfo.drawlist.setAlphaModel(type, mtx, alpha);
}
inline void dComIfGd_setAlphaModel2(unsigned char param_0, float(*param_1)[4], unsigned char param_2) {
g_dComIfG_gameInfo.drawlist.setAlphaModel2(param_0, param_1, param_2);
inline void dComIfGd_setSpotModel(u8 type, Mtx mtx, u8 alpha) {
g_dComIfG_gameInfo.drawlist.setSpotModel(type, mtx, alpha);
}
inline const dDlst_alphaModel_c* dComIfGd_getAlphaModel2(unsigned char param_0, float(*param_1)[4], unsigned char param_2) {
return g_dComIfG_gameInfo.drawlist.getAlphaModel2();
inline void dComIfGd_setLightModel(u8 type, Mtx mtx, u8 alpha) {
g_dComIfG_gameInfo.drawlist.setLightModel(type, mtx, alpha);
}
inline s32 dComIfGd_getSpotModelNum() {
return g_dComIfG_gameInfo.drawlist.getSpotModelNum();
}
inline s32 dComIfGd_getLightModelNum() {
return g_dComIfG_gameInfo.drawlist.getLightModelNum();
}
/**
@@ -1127,6 +1135,16 @@ inline void dComIfGp_particle_readScene(u8 particle_no, mDoDvdThd_toMainRam_c**
g_dComIfG_gameInfo.play.getParticle()->readScene(particle_no, param_1);
}
/**
* === ATTENTION ===
*/
inline void dComIfGp_att_CatchRequest(fopAc_ac_c* param_0, u8 param_1, f32 param_2, f32 param_3,
f32 param_4, s16 param_5, s32 param_6) {
dAttention_c& attention = g_dComIfG_gameInfo.play.getAttention();
attention.CatchRequest(param_0, param_1, param_2, param_3, param_4,param_5, param_6);
}
/**
* === MISC ===
*/
+38 -16
View File
@@ -165,18 +165,33 @@ public:
struct view_port_class;
struct view_class;
struct camera_class;
struct dDlst_alphaModelData_c;
struct dDlst_alphaModel_c {
public:
enum Type {
TYPE_SPHERE = 0,
TYPE_TWO_SPHERES = 1,
TYPE_SEARCHLIGHT = 2,
TYPE_CUBE = 3,
TYPE_SMALL_SPHERE = 4,
TYPE_THREE_SPHERES = 5,
};
dDlst_alphaModel_c();
void create(int);
void set(unsigned char, float(*)[4], unsigned char);
void draw(float(*)[4]);
void set(u8 type, Mtx mtx, u8 alpha);
void draw(MtxP);
s32 getNum() {
return mNum;
}
public:
short pad;
short pad2;
short pad3;
short mCount;
};
/* 0x00 */ _GXColor mColor;
/* 0x04 */ s16 mCapacity;
/* 0x06 */ s16 mNum;
/* 0x08 */ dDlst_alphaModelData_c* mpData;
}; // Size: 0xC
class dDlst_list_c {
public:
@@ -202,14 +217,21 @@ public:
dKy_tevstr_c* pTevStr) {
return mShadowControl.setReal2(id, param_2, pModel, pPos, param_5, param_6, pTevStr);
}
void setAlphaModel(unsigned char param_0, float(*param_1)[4], unsigned char param_2) {
mpAlphaModel0->set(param_0, param_1, param_2);
void setAlphaModel(u8 type, Mtx mtx, u8 alpha) {
mpAlphaModel->set(type, mtx, alpha);
}
void setAlphaModel2(unsigned char param_0, float(*param_1)[4], unsigned char param_2) {
mpAlphaModel2->set(param_0, param_1, param_2);
void setSpotModel(u8 type, Mtx mtx, u8 alpha) {
mpSpotModel->set(type, mtx, alpha);
}
const dDlst_alphaModel_c* getAlphaModel2() {
return mpAlphaModel2;
void setLightModel(u8 type, Mtx mtx, u8 alpha) {
mpLightModel->set(type, mtx, alpha);
}
s32 getSpotModelNum() {
return mpSpotModel->getNum();
}
s32 getLightModelNum() {
return mpLightModel->getNum();
}
static void offWipe() { mWipe = false; }
@@ -247,9 +269,9 @@ private:
/* 0x00230 */ dDlst_window_c* field_0x00230;
/* 0x00234 */ camera_class* mpCamera;
/* 0x00238 */ u8 field_0x00238[0x00244 - 0x00238];
/* 0x00244 */ dDlst_alphaModel_c* mpAlphaModel0;
/* 0x00248 */ dDlst_alphaModel_c* mpAlphaModel2;
/* 0x0024C */ dDlst_alphaModel_c* mpAlphaModel1;
/* 0x00244 */ dDlst_alphaModel_c* mpAlphaModel;
/* 0x00248 */ dDlst_alphaModel_c* mpSpotModel;
/* 0x0024C */ dDlst_alphaModel_c* mpLightModel;
/* 0x00250 */ dDlst_shadowControl_c mShadowControl;
/* 0x16078 */ mDoExt_3DlineMatSortPacket m3DLineMatSortPacket[2];
/* 0x160A0 */ dDlst_peekZ_c mPeekZ;