work on d_a_npc_the and d_a_npc (#2120)

This commit is contained in:
Caroline Madsen
2024-04-04 19:05:50 -04:00
committed by GitHub
parent 0c7b46b79f
commit 3eb62c4489
37 changed files with 2169 additions and 1855 deletions
@@ -9,7 +9,7 @@ typedef struct _GXColorS10 GXColorS10;
class J3DMatColorAnm {
public:
/* 8003B2B8 */ ~J3DMatColorAnm() {};
/* 8003B2F4 */ J3DMatColorAnm() {};
/* 8003B2F4 */ J3DMatColorAnm() : field_0x0(0), mAnmFlag(1), mAnmColor(NULL) {};
J3DMatColorAnm(u16 param_1, J3DAnmColor* param_2) {
field_0x0 = param_1;
mAnmFlag = 1;
@@ -35,7 +35,7 @@ private:
class J3DTexNoAnm {
public:
/* 8003B1F8 */ ~J3DTexNoAnm() {};
/* 8003B240 */ J3DTexNoAnm() {};
/* 8003B240 */ J3DTexNoAnm() : field_0x4(0), mAnmFlag(1), mAnmTexPattern(NULL) {};
J3DTexNoAnm(u16 param_1, J3DAnmTexPattern* param_2) {
field_0x4 = param_1;
mAnmFlag = 1;
@@ -62,7 +62,7 @@ private:
class J3DTexMtxAnm {
public:
/* 8003B264 */ ~J3DTexMtxAnm() {};
/* 8003B2A0 */ J3DTexMtxAnm() {};
/* 8003B2A0 */ J3DTexMtxAnm() : field_0x0(0), mAnmFlag(1), mAnmTransform(NULL) {};
J3DTexMtxAnm(u16 param_1, J3DAnmTextureSRTKey* param_2) {
field_0x0 = param_1;
mAnmFlag = 1;
@@ -90,7 +90,7 @@ private:
class J3DTevKColorAnm {
public:
/* 8003B150 */ ~J3DTevKColorAnm() {}
/* 8003B18C */ J3DTevKColorAnm() {}
/* 8003B18C */ J3DTevKColorAnm() : field_0x0(0), mAnmFlag(1), mAnmTevReg(NULL) {}
J3DTevKColorAnm(u16 param_1, J3DAnmTevRegKey* param_2) {
field_0x0 = param_1;
mAnmFlag = 1;
@@ -116,7 +116,7 @@ private:
class J3DTevColorAnm {
public:
/* 8003B1A4 */ ~J3DTevColorAnm() {}
/* 8003B1E0 */ J3DTevColorAnm() {}
/* 8003B1E0 */ J3DTevColorAnm() : field_0x0(0), mAnmFlag(1), mAnmTevReg(NULL) {}
J3DTevColorAnm(u16 param_1, J3DAnmTevRegKey* param_2) {
field_0x0 = param_1;
mAnmFlag = 1;
+20 -19
View File
@@ -12,38 +12,39 @@ struct TAngleConstant_<f32> {
static inline f32 RADIAN_DEG360() { return 6.2831855f; }
};
template<int N, typename T>
struct TSinCosTable {
std::pair<f32, f32> table[0x2000];
std::pair<T, T> table[1 << N];
f32 sinShort(s16 v) const { return table[(u16)v >> 3U].first; }
f32 cosShort(s16 v) const { return table[(u16)v >> 3U].second; }
T sinShort(s16 v) const { return table[(u16)v >> (16U - N)].first; }
T cosShort(s16 v) const { return table[(u16)v >> (16U - N)].second; }
inline f32 sinLap(f32 v) {
if (v < 0.0f) {
return -table[(u16)(-8192.0f * v) & 0x1fff].first;
inline T sinLap(T v) {
if (v < (T)0.0) {
return -table[(u16)(-(T)(1 << N) * v) & ((1 << N) - 1)].first;
}
return table[(u16)(8192.0f * v) & 0x1fff].first;
return table[(u16)((T)(1 << N) * v) & ((1 << N) - 1)].first;
}
inline f32 sinDegree(f32 degree) {
if (degree < 0.0f) {
return -table[(u16)(-22.755556106567383f * degree) & 0x1fffU].first;
inline T sinDegree(T degree) {
if (degree < (T)0.0) {
return -table[(u16)(((T)(1 << N) / 360.0) * degree) & ((1 << N) - 1)].first;
}
return table[(u16)(22.755556106567383f * degree) & 0x1fffU].first;
return table[(u16)(((T)(1 << N) / 360.0) * degree) & ((1 << N) - 1)].first;
}
inline f32 cosDegree(f32 degree) {
if (degree < 0.0f) {
inline T cosDegree(T degree) {
if (degree < (T)0.0) {
degree = -degree;
}
return table[(u16)(22.755556106567383f * degree) & 0x1fffU].second;
return table[(u16)(((T)(1 << N) / 360.0) * degree) & ((1 << N) - 1)].second;
}
inline f32 sinRadian(f32 radian) {
if (radian < 0.0f) {
return -table[(u16)(-8192.0f / TAngleConstant_<f32>::RADIAN_DEG360() * radian) & 0x1fffU].first;
inline T sinRadian(T radian) {
if (radian < (T)0.0) {
return -table[(u16)(-(T)(1 << N) / TAngleConstant_<T>::RADIAN_DEG360() * radian) & ((1 << N) - 1)].first;
}
return table[(u16)(8192.0f / TAngleConstant_<f32>::RADIAN_DEG360() * radian) & 0x1fffU].first;
return table[(u16)((T)(1 << N) / TAngleConstant_<T>::RADIAN_DEG360() * radian) & ((1 << N) - 1)].first;
}
};
@@ -58,7 +59,7 @@ struct TAsinAcosTable {
};
namespace JMath {
extern TSinCosTable sincosTable_;
extern TSinCosTable<13, f32> sincosTable_;
extern TAtanTable atanTable_;
extern TAsinAcosTable asinAcosTable_;
}; // namespace JMath