summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLagoLunatic <LagoLunatic@users.noreply.github.com>2023-10-19 15:36:21 -0400
committerLagoLunatic <LagoLunatic@users.noreply.github.com>2023-10-19 15:36:21 -0400
commit57d4fc32b428df1a1cff8da07859b017ac33203a (patch)
tree848225d6bc849628d2c31203ff00c37a2c85909f
parent9c667f222345038b1d9b0c9e879ce3853b93ff78 (diff)
Some m_Do_ext progress
-rw-r--r--include/JAZelAudio/JAIZelBasic.h39
-rw-r--r--include/JSystem/J3DGraphAnimator/J3DAnimation.h2
-rw-r--r--include/JSystem/J3DGraphAnimator/J3DJoint.h2
-rw-r--r--include/JSystem/JAudio/JAIAnimation.h48
-rw-r--r--include/m_Do/m_Do_ext.h4
-rw-r--r--src/JSystem/J3DGraphAnimator/J3DModel.cpp32
-rw-r--r--src/m_Do/m_Do_ext.cpp87
7 files changed, 126 insertions, 88 deletions
diff --git a/include/JAZelAudio/JAIZelBasic.h b/include/JAZelAudio/JAIZelBasic.h
index 7a2e7459..da04346f 100644
--- a/include/JAZelAudio/JAIZelBasic.h
+++ b/include/JAZelAudio/JAIZelBasic.h
@@ -4,15 +4,10 @@
#include "dolphin/types.h"
#include "JAZelAudio/JAZelAudio_SE.h"
#include "JAZelAudio/JAZelAudio_BGM.h"
+#include "JSystem/JAudio/JAIAnimation.h"
#include "dolphin/mtx/mtx.h"
-class Vec;
-class JAISound;
class JKRSolidHeap;
-namespace JAInter {
- class Actor;
-};
-class JAIAnimeFrameSoundData;
class JAIZelBasic {
public:
@@ -254,38 +249,6 @@ public:
/* 0x1F44 */ u8 field_0x1F44[0x20F4 - 0x1F44];
};
-struct JAIAnimeSound__Slot {
- /* 0x0 */ u8 mbIsPlaying;
- /* 0x4 */ JAISound* mpSound;
- /* 0x8 */ void* mpData;
-};
-
-class JAIAnimeSound {
-public:
- JAIAnimeSound();
-
-public:
- /* 0x00 */ JAIAnimeSound__Slot mSlots[8];
- /* 0x60 */ u32 m60;
- /* 0x64 */ u32 m64;
- /* 0x68 */ u32 m68;
- /* 0x6C */ u32 m6C;
- /* 0x70 */ void* m70[2];
- /* 0x78 */ int mDataCounterInc;
- /* 0x7C */ int mDataCounterLimit;
- /* 0x80 */ u32 mDataCounter;
- /* 0x84 */ int mLoopCount;
- /* 0x88 */ f32 mCurrentTime;
- /* 0x8C */ u8 m8C[0x90 - 0x8C];
- /* 0x90 */ u16* mpData;
- /* 0x94 */ /* vtable */
-
- virtual void startAnimSound(void*, u32, JAISound**, JAInter::Actor*, u8);
- virtual void setSpeedModifySound(JAISound*, JAIAnimeFrameSoundData*, f32);
-
- void stop();
-}; // Size: 0x98
-
class JAIZelAnime : public JAIAnimeSound {
public:
JAIZelAnime() { }
diff --git a/include/JSystem/J3DGraphAnimator/J3DAnimation.h b/include/JSystem/J3DGraphAnimator/J3DAnimation.h
index 9f69683d..20247455 100644
--- a/include/JSystem/J3DGraphAnimator/J3DAnimation.h
+++ b/include/JSystem/J3DGraphAnimator/J3DAnimation.h
@@ -614,7 +614,7 @@ public:
};
J3DFrameCtrl() { this->init(0); }
- void init(s16);
+ void init(s16 end);
BOOL checkPass(f32);
void update();
virtual ~J3DFrameCtrl() {}
diff --git a/include/JSystem/J3DGraphAnimator/J3DJoint.h b/include/JSystem/J3DGraphAnimator/J3DJoint.h
index f3c93e6c..e0963865 100644
--- a/include/JSystem/J3DGraphAnimator/J3DJoint.h
+++ b/include/JSystem/J3DGraphAnimator/J3DJoint.h
@@ -125,7 +125,7 @@ public:
J3DMaterial* getMesh() { return mMesh; }
u16 getJntNo() const { return mJntNo; }
u8 getKind() const { return mKind & 0x0F; }
- u8 getMtxType() const { return mKind >> 4; }
+ u8 getMtxType() const { return (mKind >> 4) & 0x0F; }
u8 getScaleCompensate() const { return mScaleCompensate; }
void setCurrentMtxCalc(J3DMtxCalc* pMtxCalc) { mCurrentMtxCalc = pMtxCalc; }
J3DTransformInfo& getTransformInfo() { return mTransformInfo; }
diff --git a/include/JSystem/JAudio/JAIAnimation.h b/include/JSystem/JAudio/JAIAnimation.h
new file mode 100644
index 00000000..e5fe36ad
--- /dev/null
+++ b/include/JSystem/JAudio/JAIAnimation.h
@@ -0,0 +1,48 @@
+#ifndef JAIANIMATION_H
+#define JAIANIMATION_H
+
+#include "global.h"
+
+class Vec;
+class JAISound;
+class JAIBasic;
+namespace JAInter {
+ class Actor;
+};
+class JAIAnimeFrameSoundData;
+
+struct JAIAnimeSound__Slot {
+ /* 0x0 */ u8 mbIsPlaying;
+ /* 0x4 */ JAISound* mpSound;
+ /* 0x8 */ void* mpData;
+};
+
+class JAIAnimeSound {
+public:
+ JAIAnimeSound();
+ void initActorAnimSound(void*, u32, f32);
+ void setAnimSoundVec(JAIBasic*, Vec*, f32, f32, u32, u8);
+ void setAnimSoundActor(JAIBasic*, JAInter::Actor*, f32, f32, u8);
+ void playActorAnimSound(JAIBasic*, JAInter::Actor*, f32, u8);
+ void startAnimSound(void*, u32, JAISound**, JAInter::Actor*, u8);
+ void setSpeedModifySound(JAISound*, JAIAnimeFrameSoundData*, f32);
+ void stop();
+
+public:
+ /* 0x00 */ JAIAnimeSound__Slot mSlots[8];
+ /* 0x60 */ u32 m60;
+ /* 0x64 */ u32 m64;
+ /* 0x68 */ u32 m68;
+ /* 0x6C */ u32 m6C;
+ /* 0x70 */ void* m70[2];
+ /* 0x78 */ int mDataCounterInc;
+ /* 0x7C */ int mDataCounterLimit;
+ /* 0x80 */ u32 mDataCounter;
+ /* 0x84 */ int mLoopCount;
+ /* 0x88 */ f32 mCurrentTime;
+ /* 0x8C */ u8 m8C[0x90 - 0x8C];
+ /* 0x90 */ u16* mpData;
+ /* 0x94 */ /* vtable */
+}; // Size: 0x98
+
+#endif /* JAIANIMATION_H */
diff --git a/include/m_Do/m_Do_ext.h b/include/m_Do/m_Do_ext.h
index 85e37002..b77aea2f 100644
--- a/include/m_Do/m_Do_ext.h
+++ b/include/m_Do/m_Do_ext.h
@@ -324,7 +324,7 @@ public:
mDoExt_zelAnime() { }
public:
- /* 0x98 */ u8 m8C[0x9C - 0x98];
+ /* 0x98 */ void* mpBasAnm;
}; // Size: 0x9C
class mDoExt_McaMorf : public J3DMtxCalcMaya {
@@ -334,7 +334,7 @@ public:
void calc();
void calc(u16);
- void setAnm(J3DAnmTransform* bckAnm, int loopMode, f32 morf, f32 speed, f32, f32, void* soundAnm);
+ void setAnm(J3DAnmTransform* bckAnm, int loopMode, f32 morf, f32 playSpeed, f32 startFrame, f32 endFrame, void* basAnm);
void setMorf(f32);
void update();
void updateDL();
diff --git a/src/JSystem/J3DGraphAnimator/J3DModel.cpp b/src/JSystem/J3DGraphAnimator/J3DModel.cpp
index c248de41..2efb3af1 100644
--- a/src/JSystem/J3DGraphAnimator/J3DModel.cpp
+++ b/src/JSystem/J3DGraphAnimator/J3DModel.cpp
@@ -354,6 +354,8 @@ void J3DModel::unlock() {
/* 802EE2C4-802EE42C .text calcMaterial__8J3DModelFv */
void J3DModel::calcMaterial() {
+ /* Nonmatching - regswap */
+ j3dSys.setModel(this);
j3dSys.setTexture(mModelData->getTexture());
if (checkFlag(4)) {
@@ -368,8 +370,6 @@ void J3DModel::calcMaterial() {
j3dSys.offFlag(8);
}
- j3dSys.setModel(this);
-
for (u16 i = 0; i < mModelData->getMaterialNum(); i++) {
j3dSys.setMatPacket(&mpMatPacket[i]);
@@ -619,14 +619,16 @@ void J3DModel::calcNrmMtx() {
if (getModelData()->checkFlag(J3DMdlDataFlag_ConcatView) == 0) {
for (u16 i = 0; i < getModelData()->getDrawMtxNum(); i++) {
if (getModelData()->getDrawMtxFlag(i) == 0) {
- if (getScaleFlag(getModelData()->getDrawMtxIndex(i)) == 1)
- J3DPSMtx33CopyFrom34(getDrawMtx(i), getNrmMtx(i));
- else
+ if (getScaleFlag(getModelData()->getDrawMtxIndex(i)) == 1) {
+ Mtx& drawMtx = getDrawMtx(i);
+ J3DPSMtx33CopyFrom34(drawMtx, getNrmMtx(i));
+ } else
J3DPSCalcInverseTranspose(getDrawMtx(i), getNrmMtx(i));
} else {
- if (getEnvScaleFlag(getModelData()->getDrawMtxIndex(i)) == 1)
- J3DPSMtx33CopyFrom34(getDrawMtx(i), getNrmMtx(i));
- else
+ if (getEnvScaleFlag(getModelData()->getDrawMtxIndex(i)) == 1) {
+ Mtx& drawMtx = getDrawMtx(i);
+ J3DPSMtx33CopyFrom34(drawMtx, getNrmMtx(i));
+ } else
J3DPSCalcInverseTranspose(getDrawMtx(i), getNrmMtx(i));
}
}
@@ -684,13 +686,14 @@ void J3DModel::calcBBoard() {
/* 802EF414-802EF5D8 .text prepareShapePackets__8J3DModelFv */
void J3DModel::prepareShapePackets() {
+ /* Nonmatching */
u16 shapeNum = getModelData()->getShapeNum();
for (u16 i = 0; i < shapeNum; i++) {
J3DShapePacket* pkt = getShapePacket(i);
- pkt->mpScaleFlagArray = getScaleFlagArray();
- pkt->mpDrawMtx = getDrawMtxPtrPtr();
- pkt->mpNrmMtx = getNrmMtxPtrPtr();
- pkt->mpCurrentViewNo = getCurrentViewNoPtr();
+ pkt->setScaleFlagArray(mpScaleFlagArr);
+ pkt->setDrawMtx(mpDrawMtxBuf[1]);
+ pkt->setNrmMtx(mpNrmMtxBuf[1]);
+ pkt->setCurrentViewNoPtr(&mCurrentViewNo);
}
for (u16 i = 0; i < shapeNum; i++) {
@@ -717,8 +720,9 @@ void J3DModel::prepareShapePackets() {
for (s32 i = 0; i < getModelData()->getMaterialNum(); i++) {
J3DMaterial* pMaterial = getModelData()->getMaterialNodePointer(i);
if (pMaterial->getTexGenBlock()->getNBTScale()->mbHasScale == 1) {
- J3DShape *pShape = pMaterial->getShape();
- getShapePacket(pShape->getIndex())->setNrmMtx(getBumpMtxPtrPtr(pShape->getBumpMtxOffset()));
+ u16 shapeIdx = pMaterial->getShape()->getIndex();
+ u32 bumpMtxOffs = pMaterial->getShape()->getBumpMtxOffset();
+ mpShapePacket[shapeIdx].setNrmMtx(mpBumpMtxArr[1][bumpMtxOffs]);
}
}
}
diff --git a/src/m_Do/m_Do_ext.cpp b/src/m_Do/m_Do_ext.cpp
index c694a9fd..16819f6b 100644
--- a/src/m_Do/m_Do_ext.cpp
+++ b/src/m_Do/m_Do_ext.cpp
@@ -1151,7 +1151,7 @@ void mDoExt_MtxCalcOldFrame::decOldFrameMorfCounter() {
}
/* 80012650-800129E4 .text __ct__14mDoExt_McaMorfFP12J3DModelDataP25mDoExt_McaMorfCallBack1_cP25mDoExt_McaMorfCallBack2_cP15J3DAnmTransformifiiiPvUlUl */
-mDoExt_McaMorf::mDoExt_McaMorf(J3DModelData* modelData, mDoExt_McaMorfCallBack1_c* callback1, mDoExt_McaMorfCallBack2_c* callback2, J3DAnmTransform* anmTransform, int param_4, f32 param_5, int param_6, int param_7, int param_8, void* param_9, u32 param_10, u32 param_11) {
+mDoExt_McaMorf::mDoExt_McaMorf(J3DModelData* modelData, mDoExt_McaMorfCallBack1_c* callback1, mDoExt_McaMorfCallBack2_c* callback2, J3DAnmTransform* anmTransform, int loopMode, f32 param_5, int param_6, int param_7, int param_8, void* basAnm, u32 modelFlag, u32 differedDlistFlag) {
mpModel = NULL;
mpSound = NULL;
mpTransformInfo = NULL;
@@ -1159,23 +1159,23 @@ mDoExt_McaMorf::mDoExt_McaMorf(J3DModelData* modelData, mDoExt_McaMorfCallBack1_
if (!modelData) {
return;
}
- if (modelData->getModelDataType() == 1 && param_10 == 0) {
- if (param_10 = modelData->isLocked()) {
- param_10 = 0x20000;
+ if (modelData->getModelDataType() == 1 && modelFlag == 0) {
+ if (modelFlag = modelData->isLocked()) {
+ modelFlag = 0x20000;
} else {
- param_10 = 0x80000;
+ modelFlag = 0x80000;
}
}
- mpModel = mDoExt_J3DModel__create(modelData, param_10, param_11);
+ mpModel = mDoExt_J3DModel__create(modelData, modelFlag, differedDlistFlag);
if (!mpModel) {
return;
}
- if (param_10 != 0x80000) {
+ if (modelFlag != 0x80000) {
mDoExt_changeMaterial(mpModel);
}
- if (param_9 == NULL && anmTransform) {
- param_9 = ((mDoExt_transAnmBas*)anmTransform)->getBas();
- if (param_9) {
+ if (basAnm == NULL && anmTransform) {
+ basAnm = ((mDoExt_transAnmBas*)anmTransform)->getBas();
+ if (basAnm) {
param_8 = 1;
}
}
@@ -1185,7 +1185,7 @@ mDoExt_McaMorf::mDoExt_McaMorf(J3DModelData* modelData, mDoExt_McaMorfCallBack1_
goto cleanup;
}
}
- setAnm(anmTransform, param_4, 0.0f, param_5, param_6, param_7, param_9);
+ setAnm(anmTransform, loopMode, 0.0f, param_5, param_6, param_7, basAnm);
mPrevMorf = -1.0f;
mpTransformInfo = new J3DTransformInfo[modelData->getJointNum()];
if (!mpTransformInfo) {
@@ -1286,43 +1286,40 @@ void mDoExt_McaMorf::calc(u16 param_0) {
}
/* 80012D78-80012FC8 .text setAnm__14mDoExt_McaMorfFP15J3DAnmTransformiffffPv */
-void mDoExt_McaMorf::setAnm(J3DAnmTransform* param_0, int param_1, f32 param_2, f32 param_3, f32 param_4, f32 param_5, void* param_6) {
- /* Nonmatching */
- mpAnm = param_0;
- setStartFrame(param_4);
- if (param_5 < 0.0f) {
+void mDoExt_McaMorf::setAnm(J3DAnmTransform* bckAnm, int loopMode, f32 morf, f32 playSpeed, f32 startFrame, f32 endFrame, void* basAnm) {
+ mpAnm = bckAnm;
+ setStartFrame(startFrame);
+ if (endFrame < 0.0f) {
if (!mpAnm) {
mFrameCtrl.init(0);
} else {
mFrameCtrl.init(mpAnm->getFrameMax());
}
} else {
- mFrameCtrl.init(param_5);
+ mFrameCtrl.init(endFrame);
}
- if (param_0 && param_1 < 0) {
- param_1 = param_0->getAttribute();
+ if (bckAnm && loopMode < 0) {
+ loopMode = bckAnm->getAttribute();
}
- setPlayMode(param_1);
- setPlaySpeed(param_3);
- if (param_3 >= 0.0f) {
- setFrame(param_4);
+ setPlayMode(loopMode);
+ setPlaySpeed(playSpeed);
+ if (playSpeed >= 0.0f) {
+ setFrame(startFrame);
} else {
setFrame(getEndFrame());
}
setLoopFrame(getFrame());
- setMorf(param_2);
+ setMorf(morf);
if (mpSound) {
- if (param_6 == NULL && param_0) {
- param_6 = ((mDoExt_transAnmBas*)param_0)->getBas();
+ if (basAnm == NULL && bckAnm) {
+ basAnm = ((mDoExt_transAnmBas*)bckAnm)->getBas();
}
- /*
- mpSound->field_0x98 = param_6;
- if (mpSound->field_0x98) {
- mpSound->initActorAnimSound(param_6, getPlaySpeed() >= 0.0f, getLoopFrame(), 0.0f);
+ mpSound->mpBasAnm = basAnm;
+ if (mpSound->mpBasAnm) {
+ mpSound->initActorAnimSound(basAnm, getPlaySpeed() >= 0.0f ? 1 : -1, getLoopFrame());
} else {
mpSound->stop();
}
- */
}
}
@@ -1635,7 +1632,33 @@ void mDoExt_removeRubyFont() {
/* 80016BB8-80016C98 .text mDoExt_J3DModel__create__FP12J3DModelDataUlUl */
J3DModel* mDoExt_J3DModel__create(J3DModelData* i_modelData, u32 i_modelFlag, u32 i_differedDlistFlag) {
- /* Nonmatching */
+ J3DModel* model = new J3DModel();
+ if (model) {
+ if (i_modelData->getModelDataType() == 1 && i_modelFlag == 0) {
+ if (i_modelFlag = i_modelData->isLocked()) {
+ i_modelFlag = 0x20000;
+ } else {
+ i_modelFlag = 0x80000;
+ }
+ }
+
+ int ret = model->entryModelData(i_modelData, i_modelFlag, 1);
+ if (ret == kJ3DError_Success) {
+ if (i_modelFlag == 0x80000) {
+ if (i_differedDlistFlag & 0x2) {
+ i_differedDlistFlag |= 0x20;
+ }
+
+ ret = model->newDifferedDisplayList(i_differedDlistFlag);
+ if (ret != kJ3DError_Success) {
+ return NULL;
+ }
+ }
+
+ return model;
+ }
+ }
+ return NULL;
}
/* 80016C98-80016CC4 .text setGX__7JUTFontFQ28JUtility6TColorQ28JUtility6TColor */