summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJasper St. Pierre <jstpierre@mecheye.net>2023-12-03 20:03:10 -0800
committerJasper St. Pierre <jstpierre@mecheye.net>2023-12-03 20:04:25 -0800
commitda63253d99e27c42b315d1c31f920cb88618be77 (patch)
tree2e2aec6e0b806c332e03932e3745754b19741a5e /src
parent7748957998ba508a63ac3c261aa61cc634cadbc3 (diff)
d_chain match
Diffstat (limited to 'src')
-rw-r--r--src/d/d_chain.cpp117
-rw-r--r--src/d/d_cloth_packet.cpp53
2 files changed, 125 insertions, 45 deletions
diff --git a/src/d/d_chain.cpp b/src/d/d_chain.cpp
index a6a0028f..200acec4 100644
--- a/src/d/d_chain.cpp
+++ b/src/d/d_chain.cpp
@@ -3,26 +3,125 @@
// Translation Unit: d_chain.cpp
//
-#include "d_chain.h"
-#include "dolphin/types.h"
+#include "d/d_kankyo.h"
+#include "d/d_a_obj.h"
+#include "d/d_s_play.h"
+#include "m_Do/m_Do_mtx.h"
+#include "JSystem/J3DGraphBase/J3DPacket.h"
+
+class dChain_packet_c : public J3DPacket {
+public:
+ dChain_packet_c(int, dKy_tevstr_c*, f32);
+ ~dChain_packet_c();
+ void draw();
+
+public:
+ /* 0x10 */ dKy_tevstr_c* mpTevStr;
+ /* 0x14 */ cXyz mScale;
+ /* 0x20 */ s32 mNum;
+ /* 0x24 */ cXyz* mPt;
+};
+
+static Vec dummy0 = { 1.0f, 1.0f, 1.0f };
+static Vec dummy1 = { 1.0f, 1.0f, 1.0f };
+
+static u8 l_chainS3TCTex[] __attribute__((aligned(32))) = { 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xDE, 0xDB, 0xB5, 0xB6, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xB6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0xB5, 0xB6, 0x94, 0x92, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0x8C, 0x31, 0x6B, 0x2D, 0x00, 0x55, 0x55, 0x55, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0x94, 0x92, 0x6B, 0x2D, 0x55, 0x55, 0xAA, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00, 0xB5, 0xB6, 0x94, 0x92, 0x55, 0x55, 0x00, 0x00 };
+static Vec l_pos[12] = {
+ { -2.0f, 1.522254f, -0.0f },
+ { -2.0f, 1.522254f, 7.0f },
+ { 2.0f, 1.522254f, -0.0f },
+ { -3.5f, 0.0f, -1.5f },
+ { -3.5f, 0.0f, 8.5f },
+ { 3.5f, 0.0f, -1.5f },
+ { -2.0f, -1.522254f, -0.0f },
+ { -2.0f, -1.522254f, 7.0f },
+ { 2.0f, -1.522254f, -0.0f },
+ { 2.0f, 1.522254f, 7.0f },
+ { 3.5f, 0.0f, 8.5f },
+ { 2.0f, -1.522254f, 7.0f },
+
+};
+static f32 l_texCoord[24] = {
+ 0.02736, 0.041406,
+ 0.97264, 0.041406,
+ 0.830848, 0.40324,
+ 0.169152, 0.40324,
+ 0.03125, 0.0,
+ 0.96875, 0.0,
+ 0.767857, 0.494086,
+ 0.232143, 0.494086,
+ 0.038462, 0.48226,
+ 0.038462, 0.983522,
+ 0.961538, 0.48226,
+ 0.961538, 0.983522,
+};
+static u8 l_chainDL[0x7a] __attribute__((aligned(32))) = { 0x98, 0x00, 0x06, 0x01, 0x0A, 0x07, 0x0B, 0x09, 0x08, 0x0B, 0x09, 0x02, 0x08, 0x08, 0x09, 0x98, 0x00, 0x06, 0x0B, 0x07, 0x07, 0x06, 0x0A, 0x04, 0x04, 0x05, 0x09, 0x07, 0x01, 0x06, 0x98, 0x00, 0x06, 0x08, 0x03, 0x0B, 0x02, 0x05, 0x00, 0x0A, 0x01, 0x02, 0x03, 0x09, 0x02, 0x98, 0x00, 0x06, 0x02, 0x0A, 0x08, 0x0B, 0x00, 0x08, 0x06, 0x09, 0x01, 0x08, 0x07, 0x09, 0x98, 0x00, 0x06, 0x06, 0x07, 0x08, 0x06, 0x03, 0x04, 0x05, 0x05, 0x00, 0x07, 0x02, 0x06, 0x98, 0x00, 0x06, 0x07, 0x03, 0x06, 0x02, 0x04, 0x00, 0x03, 0x01, 0x01, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
+static u8 l_matDL[0xa8] __attribute__((aligned(32))) = {
+ 0x61, 0x80, 0x00, 0x01, 0x3A, 0x61, 0x84, 0x00, 0x00, 0x00, 0x61, 0x88, 0xE0, 0x7C, 0x1F, 0x61, 0x94,
+ // probably some macro for this
+ ((u32)(&l_chainS3TCTex) >> 21) & 0xFF,
+ ((u32)(&l_chainS3TCTex) >> 13) & 0xFF,
+ ((u32)(&l_chainS3TCTex) >> 5) & 0xFF,
+ 0x61, 0x30, 0x00, 0x00, 0x20, 0x61, 0x31, 0x00, 0x00, 0x20, 0x10, 0x00, 0x00, 0x10, 0x40, 0xFF, 0xFF, 0x42, 0x80, 0x08, 0x30, 0x3C, 0xF3, 0xCF, 0x00, 0x10, 0x00, 0x00, 0x10, 0x18, 0x3C, 0xF3, 0xCF, 0x00, 0x10, 0x00, 0x00, 0x10, 0x0E, 0x00, 0x00, 0x05, 0x43, 0x61, 0x28, 0x3C, 0x00, 0x00, 0x61, 0xC0, 0x08, 0x24, 0xAF, 0x61, 0xC1, 0x08, 0xFF, 0xF0, 0x61, 0x28, 0x3C, 0x00, 0x00, 0x61, 0xC2, 0x08, 0xF0, 0x8F, 0x61, 0xC3, 0x08, 0xFF, 0xC0, 0x61, 0x43, 0x00, 0x00, 0x01, 0x61, 0x40, 0x00, 0x00, 0x17, 0x61, 0x41, 0x00, 0x01, 0x0C, 0x61, 0xF3, 0x64, 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x3F, 0x00, 0x00, 0x00, 0x01, 0x10, 0x00, 0x00, 0x10, 0x09, 0x00, 0x00, 0x00, 0x01, 0x61, 0x00, 0x00, 0x04, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, };
/* 800628B4-80062954 .text __ct__15dChain_packet_cFiP12dKy_tevstr_cf */
-dChain_packet_c::dChain_packet_c(int, dKy_tevstr_c*, float) {
- /* Nonmatching */
+dChain_packet_c::dChain_packet_c(int num, dKy_tevstr_c* tevstr, f32 scale) {
+ mNum = num;
+ mScale.setall(scale);
+ mpTevStr = tevstr;
+ mPt = new cXyz[mNum];
}
/* 80062954-800629B0 .text __dt__15dChain_packet_cFv */
dChain_packet_c::~dChain_packet_c() {
- /* Nonmatching */
}
/* 800629B0-80062CB0 .text draw__15dChain_packet_cFv */
void dChain_packet_c::draw() {
- /* Nonmatching */
+ GXClearVtxDesc();
+ GXSetVtxDesc(GX_VA_POS, GX_INDEX8);
+ GXSetVtxDesc(GX_VA_TEX0, GX_INDEX8);
+ GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_POS, GX_POS_XYZ, GX_F32, 0);
+ GXSetVtxAttrFmt(GX_VTXFMT0, GX_VA_TEX0, GX_TEX_ST, GX_F32, 0);
+ GXSetArray(GX_VA_POS, l_pos, sizeof(*l_pos));
+ GXSetArray(GX_VA_TEX0, l_texCoord, 8);
+ dKy_GxFog_tevstr_set(mpTevStr);
+ GXCallDisplayList(l_matDL, 0xa0);
+ GXSetTevColorS10(GX_TEVREG0, mpTevStr->mColorC0);
+ GXSetTevColor(GX_TEVREG1, mpTevStr->mColorK0);
+ GXSetCurrentMtx(GX_PNMTX0);
+
+ cXyz* points = mPt;
+ f32 segmentLen = (g_regHIO.mChild[10].mFloatRegs[11] + 6.75f) * mScale.z;
+ s16 angle = 0;
+ cXyz pos = *points;
+ for (s32 i = 0; i < mNum - 1; i++) {
+ cXyz dir = points[i+1] - pos;
+ f32 len = dir.abs();
+ if (!dir.normalizeRS())
+ continue;
+
+ Quaternion quat;
+ daObj::quat_rotBaseZ(&quat, dir);
+ while (len > 0.0f) {
+ mDoMtx_stack_c::transS(pos);
+ mDoMtx_stack_c::quatM(&quat);
+ mDoMtx_stack_c::ZrotM(angle);
+ mDoMtx_stack_c::scaleM(mScale);
+ mDoMtx_stack_c::revConcat(j3dSys.getViewMtx());
+ GXLoadPosMtxImm(mDoMtx_stack_c::get(), GX_PNMTX0);
+ GXCallDisplayList(l_chainDL, 0x60);
+ len -= segmentLen;
+ pos += dir * segmentLen;
+ angle += 0x4000;
+ }
+ }
}
/* 80062CB0-80062D30 .text dChain_packet_create__FiP12dKy_tevstr_cf */
-void dChain_packet_create(int, dKy_tevstr_c*, float) {
- /* Nonmatching */
+dChain_packet_c* dChain_packet_create(int p0, dKy_tevstr_c* tevstr, f32 f0) {
+ dChain_packet_c* chain = new dChain_packet_c(p0, tevstr, f0);
+ if (chain != NULL && chain->mPt == NULL)
+ chain = NULL;
+ return chain;
}
-
diff --git a/src/d/d_cloth_packet.cpp b/src/d/d_cloth_packet.cpp
index 904c1bfc..4dd3c255 100644
--- a/src/d/d_cloth_packet.cpp
+++ b/src/d/d_cloth_packet.cpp
@@ -3,17 +3,14 @@
// Translation Unit: d_cloth_packet.cpp
//
-#include "d_cloth_packet.h"
-#include "dolphin/types.h"
+#include "d/d_cloth_packet.h"
/* 80062D5C-800630B0 .text __ct__15dCloth_packet_cFP7ResTIMGiiffP12dKy_tevstr_cPP4cXyz */
dCloth_packet_c::dCloth_packet_c(ResTIMG*, int, int, float, float, dKy_tevstr_c*, cXyz**) {
/* Nonmatching */
}
-/* 800630B0-8006310C .text __dt__15dCloth_packet_cFv */
dCloth_packet_c::~dCloth_packet_c() {
- /* Nonmatching */
}
/* 8006310C-8006313C .text default_factor_checkCB__FP15dCloth_packet_cii */
@@ -57,7 +54,7 @@ void dCloth_packet_c::setNrm() {
}
/* 800642D0-800642FC .text setMtx__15dCloth_packet_cFPA4_f */
-void dCloth_packet_c::setMtx(float(*)[4]) {
+void dCloth_packet_c::setMtx(Mtx) {
/* Nonmatching */
}
@@ -102,10 +99,20 @@ void dCloth_packetXlu_c::cloth_draw() {
}
/* 80064CF8-80064E48 .text dCloth_packetXlu_create__FP7ResTIMGP7ResTIMGiiffP12dKy_tevstr_cPP4cXyz */
-void dCloth_packetXlu_create(ResTIMG*, ResTIMG*, int, int, float, float, dKy_tevstr_c*, cXyz**) {
+dCloth_packetXlu_c* dCloth_packetXlu_create(ResTIMG*, ResTIMG*, int, int, float, float, dKy_tevstr_c*, cXyz**) {
/* Nonmatching */
}
+void* dClothVobj03_c::top_pointer;
+void* dClothVobj04_c::top_pointer;
+void* dClothVobj05_c::top_pointer;
+void* dClothVobj07_0_c::top_pointer;
+
+const s32 dClothVobj03_c::cloth_counter = -1;
+const s32 dClothVobj04_c::cloth_counter = -1;
+const s32 dClothVobj05_c::cloth_counter = -1;
+const s32 dClothVobj07_0_c::cloth_counter = -1;
+
/* 80064E48-80064F0C .text cloth_copy__14dClothVobj03_cFv */
void dClothVobj03_c::cloth_copy() {
/* Nonmatching */
@@ -132,7 +139,7 @@ void dClothVobj03_c::TexObjLoad() {
}
/* 800652A8-800653F4 .text dClothVobj03_create__FP7ResTIMGP7ResTIMGP12dKy_tevstr_cPP4cXyz */
-void dClothVobj03_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**) {
+dClothVobj03_c* dClothVobj03_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**) {
/* Nonmatching */
}
@@ -162,7 +169,7 @@ void dClothVobj04_c::TexObjLoad() {
}
/* 8006584C-80065998 .text dClothVobj04_create__FP7ResTIMGP7ResTIMGP12dKy_tevstr_cPP4cXyz */
-void dClothVobj04_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**) {
+dClothVobj04_c* dClothVobj04_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**) {
/* Nonmatching */
}
@@ -197,7 +204,7 @@ void dClothVobj05_VtxFactorCB(dCloth_packet_c*, int, int) {
}
/* 80065DF8-80065F50 .text dClothVobj05_create__FP7ResTIMGP7ResTIMGP12dKy_tevstr_cPP4cXyz */
-void dClothVobj05_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**) {
+dClothVobj05_c* dClothVobj05_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**) {
/* Nonmatching */
}
@@ -232,32 +239,6 @@ void dClothVobj07_0_VtxFactorCB(dCloth_packet_c*, int, int) {
}
/* 800663B4-8006650C .text dClothVobj07_0_create__FP7ResTIMGP7ResTIMGP12dKy_tevstr_cPP4cXyz */
-void dClothVobj07_0_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**) {
- /* Nonmatching */
-}
-
-/* 8006650C-8006656C .text __dt__16dClothVobj07_0_cFv */
-dClothVobj07_0_c::~dClothVobj07_0_c() {
+dClothVobj07_0_c* dClothVobj07_0_create(ResTIMG*, ResTIMG*, dKy_tevstr_c*, cXyz**) {
/* Nonmatching */
}
-
-/* 8006656C-800665CC .text __dt__14dClothVobj05_cFv */
-dClothVobj05_c::~dClothVobj05_c() {
- /* Nonmatching */
-}
-
-/* 800665CC-8006662C .text __dt__14dClothVobj04_cFv */
-dClothVobj04_c::~dClothVobj04_c() {
- /* Nonmatching */
-}
-
-/* 8006662C-8006668C .text __dt__14dClothVobj03_cFv */
-dClothVobj03_c::~dClothVobj03_c() {
- /* Nonmatching */
-}
-
-/* 8006668C-800666EC .text __dt__18dCloth_packetXlu_cFv */
-dCloth_packetXlu_c::~dCloth_packetXlu_c() {
- /* Nonmatching */
-}
-