mirror of
https://github.com/zeldaret/tww.git
synced 2026-06-01 01:39:03 -04:00
Fix J3DMtxCalcBasic vtable, unlink J3DUMotion
This commit is contained in:
+1
-1
@@ -601,7 +601,7 @@ config.libs = [
|
||||
"J3DU",
|
||||
[
|
||||
Object(Matching, "JSystem/J3DU/J3DUClipper.cpp"),
|
||||
Object(Matching, "JSystem/J3DU/J3DUMotion.cpp"),
|
||||
Object(NonMatching, "JSystem/J3DU/J3DUMotion.cpp"),
|
||||
Object(Matching, "JSystem/J3DU/J3DUDL.cpp"),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -48,12 +48,27 @@ private:
|
||||
|
||||
public:
|
||||
J3DMtxCalcBasic();
|
||||
// TODO: vtable is in wrong order, but fixing it breaks J3DUMotion
|
||||
virtual ~J3DMtxCalcBasic() {}
|
||||
virtual void init(const Vec& vec, const Mtx& mtx) {
|
||||
J3DSys::mCurrentS = vec;
|
||||
// TODO: Same issue as J3DMtxCalcMaya::init.
|
||||
// J3DSys::mParentS = (Vec){1.0f, 1.0f, 1.0f};
|
||||
J3DSys::mCurrentMtx[0][0] = mtx[0][0] * J3DSys::mCurrentS.x;
|
||||
J3DSys::mCurrentMtx[0][1] = mtx[0][1] * J3DSys::mCurrentS.y;
|
||||
J3DSys::mCurrentMtx[0][2] = mtx[0][2] * J3DSys::mCurrentS.z;
|
||||
J3DSys::mCurrentMtx[0][3] = mtx[0][3];
|
||||
J3DSys::mCurrentMtx[1][0] = mtx[1][0] * J3DSys::mCurrentS.x;
|
||||
J3DSys::mCurrentMtx[1][1] = mtx[1][1] * J3DSys::mCurrentS.y;
|
||||
J3DSys::mCurrentMtx[1][2] = mtx[1][2] * J3DSys::mCurrentS.z;
|
||||
J3DSys::mCurrentMtx[1][3] = mtx[1][3];
|
||||
J3DSys::mCurrentMtx[2][0] = mtx[2][0] * J3DSys::mCurrentS.x;
|
||||
J3DSys::mCurrentMtx[2][1] = mtx[2][1] * J3DSys::mCurrentS.y;
|
||||
J3DSys::mCurrentMtx[2][2] = mtx[2][2] * J3DSys::mCurrentS.z;
|
||||
J3DSys::mCurrentMtx[2][3] = mtx[2][3];
|
||||
}
|
||||
virtual void recursiveCalc(J3DNode*);
|
||||
virtual void calcTransform(u16, const J3DTransformInfo&);
|
||||
virtual void calc(u16);
|
||||
virtual ~J3DMtxCalcBasic() {}
|
||||
virtual void init(const Vec& vec, const Mtx& mtx);
|
||||
|
||||
Mtx& getBackupMtx() { return mBackupMtx; }
|
||||
Vec& getBackupS() { return mBackupS; }
|
||||
@@ -67,8 +82,11 @@ class J3DMtxCalcSoftimage : public J3DMtxCalcBasic {
|
||||
public:
|
||||
J3DMtxCalcSoftimage() : J3DMtxCalc() {}
|
||||
virtual void calcTransform(u16, const J3DTransformInfo&);
|
||||
virtual ~J3DMtxCalcSoftimage();
|
||||
virtual void init(const Vec& vec, const Mtx& mtx);
|
||||
virtual ~J3DMtxCalcSoftimage() {}
|
||||
virtual void init(const Vec& vec, const Mtx& mtx) {
|
||||
J3DSys::mCurrentS = vec;
|
||||
MTXCopy(mtx, J3DSys::mCurrentMtx);
|
||||
}
|
||||
};
|
||||
|
||||
class J3DMtxCalcMaya : public J3DMtxCalcBasic {
|
||||
@@ -77,6 +95,9 @@ public:
|
||||
virtual ~J3DMtxCalcMaya() {}
|
||||
virtual void init(const Vec& vec, const Mtx& mtx) {
|
||||
// TODO: This breaks some TUs by adding extra data ({0x3F800000, 0x3F800000, 0x3F800000})
|
||||
// This seems to be responsible for the @2100 Vec literal that gets added to most TUs.
|
||||
// The strange part is that @2100 needs to be in the .data section, but uncommenting this
|
||||
// will put it in the .rodata sections.
|
||||
// J3DSys::mParentS = (Vec){1.0f, 1.0f, 1.0f};
|
||||
J3DSys::mCurrentS = vec;
|
||||
J3DSys::mCurrentMtx[0][0] = mtx[0][0] * J3DSys::mCurrentS.x;
|
||||
|
||||
@@ -16,30 +16,3 @@ static void dummy(J3DMtxCalcBasic* calc1, J3DMtxCalcSoftimage* calc2) {
|
||||
calc2->init(vec, mtx);
|
||||
delete calc2;
|
||||
}
|
||||
|
||||
/* 80256DBC-80256E4C .text __dt__19J3DMtxCalcSoftimageFv */
|
||||
J3DMtxCalcSoftimage::~J3DMtxCalcSoftimage() {}
|
||||
|
||||
/* 80256E4C-80256E94 .text init__19J3DMtxCalcSoftimageFRC3VecRA3_A4_Cf */
|
||||
void J3DMtxCalcSoftimage::init(const Vec& vec, const Mtx& mtx) {
|
||||
J3DSys::mCurrentS = vec;
|
||||
MTXCopy(mtx, J3DSys::mCurrentMtx);
|
||||
}
|
||||
|
||||
/* 80256E94-80256F80 .text init__15J3DMtxCalcBasicFRC3VecRA3_A4_Cf */
|
||||
void J3DMtxCalcBasic::init(const Vec& vec, const Mtx& mtx) {
|
||||
J3DSys::mCurrentS = vec;
|
||||
J3DSys::mParentS = (Vec){1.0f, 1.0f, 1.0f};
|
||||
J3DSys::mCurrentMtx[0][0] = mtx[0][0] * J3DSys::mCurrentS.x;
|
||||
J3DSys::mCurrentMtx[0][1] = mtx[0][1] * J3DSys::mCurrentS.y;
|
||||
J3DSys::mCurrentMtx[0][2] = mtx[0][2] * J3DSys::mCurrentS.z;
|
||||
J3DSys::mCurrentMtx[0][3] = mtx[0][3];
|
||||
J3DSys::mCurrentMtx[1][0] = mtx[1][0] * J3DSys::mCurrentS.x;
|
||||
J3DSys::mCurrentMtx[1][1] = mtx[1][1] * J3DSys::mCurrentS.y;
|
||||
J3DSys::mCurrentMtx[1][2] = mtx[1][2] * J3DSys::mCurrentS.z;
|
||||
J3DSys::mCurrentMtx[1][3] = mtx[1][3];
|
||||
J3DSys::mCurrentMtx[2][0] = mtx[2][0] * J3DSys::mCurrentS.x;
|
||||
J3DSys::mCurrentMtx[2][1] = mtx[2][1] * J3DSys::mCurrentS.y;
|
||||
J3DSys::mCurrentMtx[2][2] = mtx[2][2] * J3DSys::mCurrentS.z;
|
||||
J3DSys::mCurrentMtx[2][3] = mtx[2][3];
|
||||
}
|
||||
|
||||
+12
-10
@@ -18,6 +18,8 @@
|
||||
#include "m_Do/m_Do_mtx.h"
|
||||
#include "m_Do/m_Do_printf.h"
|
||||
|
||||
// #pragma sym on
|
||||
|
||||
// Needed for the .data section to match.
|
||||
static Vec dummy_2100 = {1.0f, 1.0f, 1.0f};
|
||||
|
||||
@@ -603,6 +605,7 @@ void mDoExt_backupMatBlock_c::store(J3DMaterial* i_material) {
|
||||
|
||||
/* 800101BC-8001084C .text restore__23mDoExt_backupMatBlock_cFP11J3DMaterial */
|
||||
void mDoExt_backupMatBlock_c::restore(J3DMaterial* i_material) {
|
||||
/* Nonmatching - regalloc on indBlock */
|
||||
J3DColorBlock* colorBlock = i_material->getColorBlock();
|
||||
colorBlock->setColorChanNum(mColorChanNum);
|
||||
for (u32 i = 0; i < 2; i++) {
|
||||
@@ -1231,7 +1234,6 @@ ERROR_EXIT:
|
||||
|
||||
/* 80012A2C-80012D78 .text calc__14mDoExt_McaMorfFUs */
|
||||
void mDoExt_McaMorf::calc(u16 param_0) {
|
||||
/* Nonmatching - J3DMtxCalcBasic vtable order */
|
||||
if (!mpModel) {
|
||||
return;
|
||||
}
|
||||
@@ -1520,7 +1522,7 @@ void mDoExt_McaMorf2::ERROR_EXIT() {
|
||||
|
||||
/* 80013770-80013E50 .text calc__15mDoExt_McaMorf2FUs */
|
||||
void mDoExt_McaMorf2::calc(u16 param_0) {
|
||||
/* Nonmatching - J3DMtxCalcBasic vtable order, instruction swap on f30 = field_0x84 */
|
||||
/* Nonmatching - regalloc (fixing the regalloc causes an instruction swap on f30 = field_0x84) */
|
||||
if (!mpModel) {
|
||||
return;
|
||||
}
|
||||
@@ -1545,6 +1547,8 @@ void mDoExt_McaMorf2::calc(u16 param_0) {
|
||||
quatPtr = &mpQuat[param_0];
|
||||
}
|
||||
Mtx mtx;
|
||||
f32 f31;
|
||||
f32 f30;
|
||||
if (!mpAnm1) {
|
||||
*infoPtr = mpModel->getModelData()->getJointNodePointer(param_0)->getTransformInfo();
|
||||
if (mpCallback1) {
|
||||
@@ -1563,8 +1567,8 @@ void mDoExt_McaMorf2::calc(u16 param_0) {
|
||||
*infoPtr = spD8[0];
|
||||
} else {
|
||||
mpAnm2->getTransform(param_0, &spD8[1]);
|
||||
f32 f30 = field_0x84;
|
||||
f32 f31 = 1.0f - f30;
|
||||
f31 = 1.0f - field_0x84;
|
||||
f30 = field_0x84;
|
||||
infoPtr->mScale.x = spD8[0].mScale.x * f31 + spD8[1].mScale.x * f30;
|
||||
infoPtr->mScale.y = spD8[0].mScale.y * f31 + spD8[1].mScale.y * f30;
|
||||
infoPtr->mScale.z = spD8[0].mScale.z * f31 + spD8[1].mScale.z * f30;
|
||||
@@ -1579,8 +1583,8 @@ void mDoExt_McaMorf2::calc(u16 param_0) {
|
||||
mDoExt_setJ3DData(mtx, infoPtr, param_0);
|
||||
}
|
||||
} else if (!mpAnm2) {
|
||||
f32 f30 = (mCurMorf - mPrevMorf) / (1.0f - mPrevMorf);
|
||||
f32 f31 = 1.0f - f30;
|
||||
f30 = (mCurMorf - mPrevMorf) / (1.0f - mPrevMorf);
|
||||
f31 = 1.0f - f30;
|
||||
mpAnm1->getTransform(param_0, &sp68);
|
||||
if (mpCallback1) {
|
||||
mpCallback1->execute(param_0, &sp68);
|
||||
@@ -1598,8 +1602,8 @@ void mDoExt_McaMorf2::calc(u16 param_0) {
|
||||
} else {
|
||||
mpAnm1->getTransform(param_0, &spD8[0]);
|
||||
mpAnm2->getTransform(param_0, &spD8[1]);
|
||||
f32 f30 = field_0x84;
|
||||
f32 f31 = 1.0f - f30;
|
||||
f31 = 1.0f - field_0x84;
|
||||
f30 = field_0x84;
|
||||
sp68.mScale.x = spD8[0].mScale.x * f31 + spD8[1].mScale.x * f30;
|
||||
sp68.mScale.y = spD8[0].mScale.y * f31 + spD8[1].mScale.y * f30;
|
||||
sp68.mScale.z = spD8[0].mScale.z * f31 + spD8[1].mScale.z * f30;
|
||||
@@ -1864,7 +1868,6 @@ int mDoExt_3Dline_c::init(u16 numSegments, int hasSize, int hasTex) {
|
||||
|
||||
/* 80014584-80014664 .text init__19mDoExt_3DlineMat0_cFUsUsi */
|
||||
int mDoExt_3DlineMat0_c::init(u16 numLines, u16 numSegments, int hasSize) {
|
||||
/* Nonmatching */
|
||||
mNumLines = numLines;
|
||||
mMaxSegments = numSegments;
|
||||
mpLines = new mDoExt_3Dline_c[numLines];
|
||||
@@ -2337,7 +2340,6 @@ void mDoExt_3DlineMat1_c::update(u16 segs, f32 size, GXColor& newColor, u16 spac
|
||||
|
||||
/* 80015E54-80016518 .text update__19mDoExt_3DlineMat1_cFUsR8_GXColorP12dKy_tevstr_c */
|
||||
void mDoExt_3DlineMat1_c::update(u16 segs, GXColor& newColor, dKy_tevstr_c* pTevStr) {
|
||||
/* Nonmatching */
|
||||
cXyz eyeDelta;
|
||||
cXyz delta;
|
||||
cXyz nextP0;
|
||||
|
||||
Reference in New Issue
Block a user