Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/JSystem/J3D/J3DGraphAnimator/J3DNode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class J3DNode {
J3DNode* getYounger() { return mYounger; }
void setYounger(J3DNode* pYounger) { mYounger = pYounger; }
void setCallBack(J3DNodeCallBack callback) { mCallBack = callback; }
void setCallBackUserData(void* data) { mCallBackUserData = data; }
J3DNodeCallBack getCallBack() { return mCallBack; }
J3DNode* getChild() { return mChild; }

Expand Down
26 changes: 22 additions & 4 deletions include/MarioUtil/MtxUtil.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class TMtxTimeLag : public TMtxEffectBase {
/* 0x40 */ TDeParams mParams;
};

void TMtxTimeLagCallBack(J3DNode*, int);
int TMtxTimeLagCallBack(J3DNode*, int);

class TMtxSwingRZ : public TMtxEffectBase {
public:
Expand Down Expand Up @@ -105,27 +105,45 @@ class TMtxSwingRZ : public TMtxEffectBase {
/* 0x20 */ TDeParams mParams;
};

void TMtxSwingRZCallBack(J3DNode*, int);
int TMtxSwingRZCallBack(J3DNode*, int);

class TMtxSwingRZReverseXZ : public TMtxSwingRZ {
public:
TMtxSwingRZReverseXZ(const char* prm)
: TMtxSwingRZ(prm)
{
}

void calc(MtxPtr);
};

void TMtxSwingRZReverseXZCallBack(J3DNode*, int);
int TMtxSwingRZReverseXZCallBack(J3DNode*, int);

class TMultiMtxEffect {
public:
void setup(J3DModel*, const char*);
void setUserArea();

// Unused
void add();

// Unused
void remove();

// Fabricated
void flagOn()
{
for (int i = 0; i < mNumBones; ++i) {
mMtxEffectTbl[i]->mFlags |= 1;
}
}
// Fabricated
void flagOff()
{
for (int i = 0; i < mNumBones; ++i) {
mMtxEffectTbl[i]->mFlags &= ~1;
}
}

/* 0x00 */ u16 mNumBones; // number of bones to be manipulated
/* 0x04 */ u8* mMtxEffectType; // array of TMtxEffectBase types
/* 0x08 */ u16* mBoneIDs; // array of bone IDs to be manipulated
Expand Down
48 changes: 44 additions & 4 deletions include/Player/MarioCap.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,19 @@
#define MARIOCAP_HPP

#include <Player/MarioMain.hpp>
#include <MarioUtil/MtxUtil.hpp>
#include <Strategic/MirrorActor.hpp>
#include <JSystem/J3D/J3DGraphBase/J3DShape.hpp>

class TMarioCap {
public:
enum E_CAP_MODEL {
E_CAP_MODEL_NOTHING = 0,
E_CAP_MODEL_HAT = 1,
E_CAP_MODEL_HELMET = 2,
E_CAP_MODEL_SUNGLASSES = 4,
};

TMarioCap(TMario*);

virtual void perform(unsigned long, JDrama::TGraphics*);
Expand All @@ -16,12 +26,42 @@ class TMarioCap {
// Unused
void addDirty();

// Fabricated
bool isModelActive(u16 type) { return unk4 & type ? true : false; }

// Fabricated
void setModelActive(u16 type) { unk4 |= type; }

// Fabricated
void setModelInactive(u16 type) { unk4 &= ~type; }

// Fabricated
void onFlagAllShapes(J3DModelData* modelData)
{
for (u16 i = 0; i < modelData->getShapeNum(); ++i) {
modelData->getShapeNodePointer(i)->onFlag(1);
}
}

// Fabricated
void offFlagAllShapes(J3DModelData* modelData)
{
for (u16 i = 0; i < modelData->getShapeNum(); ++i) {
modelData->getShapeNodePointer(i)->offFlag(1);
}
}

public:
/* 0x4 */ u16 unk4; // Flag for which hat is active
/* 0x4 */ u16 unk4; // E_CAP_MODEL flag
/* 0x6 */ u16 unk6;
/* 0x8 */ u32 unk8;
/* 0xC */ u32 unkC;
/* 0x10 */ u32 unk10[0x28];
/* 0x8 */ TMario* mMario;
/* 0xC */ J3DModel* unkC; // current model?
/* 0x10 */ J3DModel* unk10[4]; // ma_cap1.bmd model
/* 0x20 */ TMultiMtxEffect* unk20;
/* 0x24 */ TMultiMtxEffect* unk24;
/* 0x28 */ TMirrorActor* unk28[2];
/* 0x30 */ TTrembleModelEffect* unk30;
/* 0x34 */ f32 unk34;
};

#endif
9 changes: 8 additions & 1 deletion include/Player/MarioMain.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1205,7 +1205,14 @@ class TMario : public TTakeActor, public TDrawSyncCallback {

/* 0x122 */ u16 unk122;

/* 0x124 */ char unk124[0x2BC - 0x124];
/* 0x124 */ u32 unk124;
/* 0x128 */ u32 unk128;
/* 0x12C */ u32 unk12C;
/* 0x130 */ u32 unk130;
/* 0x134 */ f32 unk134;
/* 0x138 */ char unk138[0x29C - 0x138];
/* 0x29C */ JGeometry::TVec3<f32> unk29C;
/* 0x2A8 */ char unk2A8[0x2BC - 0x2A8];
/* 0x2BC */ f32 unk2BC;
/* 0x2C0 */ char unk2C0[0x37C - 0x2C0];
/* 0x37C */ u16 unk37C;
Expand Down
60 changes: 60 additions & 0 deletions src/MarioUtil/MtxUtil.cpp
Original file line number Diff line number Diff line change
@@ -1 +1,61 @@
#include <MarioUtil/MtxUtil.hpp>

#include <printf.h>
#include <JSystem/J3D/J3DGraphAnimator/J3DModel.hpp>
#include <JSystem/J3D/J3DGraphAnimator/J3DJoint.hpp>

void TMultiMtxEffect::setup(J3DModel* model, const char* prmLocation)
{
mModel = model;
mMtxEffectTbl = new TMtxEffectBase*[mNumBones << 2];

for (u16 i = 0; i < mNumBones; ++i) {
char* path = new char[0x40];
snprintf(path, 0x40, "/%s/MtxEffect%d.prm", prmLocation, mBoneIDs[i]);

switch (mMtxEffectType[i]) {
case TMTX_EFFECT_TIME_LAG:
TMtxTimeLag* timeLag = new TMtxTimeLag(path);
model->getModelData()
->getJointNodePointer(mBoneIDs[i])
->setCallBack(TMtxTimeLagCallBack);
model->getModelData()
->getJointNodePointer(mBoneIDs[i])
->setCallBackUserData(timeLag);
mMtxEffectTbl[i] = timeLag;
break;
case TMTX_EFFECT_SWING_RZ:
TMtxSwingRZ* swingRz = new TMtxSwingRZ(path);
model->getModelData()
->getJointNodePointer(mBoneIDs[i])
->setCallBack(TMtxSwingRZCallBack);
model->getModelData()
->getJointNodePointer(mBoneIDs[i])
->setCallBackUserData(swingRz);
mMtxEffectTbl[i] = swingRz;
break;
case TMTX_EFFECT_SWING_RZ_REVERSE_XZ:
TMtxSwingRZ* swingRzReverse = new TMtxSwingRZ(path);
model->getModelData()
->getJointNodePointer(mBoneIDs[i])
->setCallBack(TMtxSwingRZReverseXZCallBack);
model->getModelData()
->getJointNodePointer(mBoneIDs[i])
->setCallBackUserData(swingRzReverse);
mMtxEffectTbl[i] = swingRzReverse;
break;
}
}
for (u16 i = 0; i < mNumBones; ++i) {
mMtxEffectTbl[i]->mFlags |= 2;
}
}

void TMultiMtxEffect::setUserArea()
{
for (u16 i = 0; i < mNumBones; i++) {
mModel->getModelData()
->getJointNodePointer(mBoneIDs[i])
->setCallBackUserData(mMtxEffectTbl[i]);
}
}
2 changes: 1 addition & 1 deletion src/Player/MarioAutodemo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ BOOL TMario::jumpingDemoCommon(u32 playerStatus, int animationId, f32 velocity)
BOOL TMario::warpIn()
{
// Missing stack space
volatile u32 padding[10];
// volatile u32 padding[10];
mActionTimer += 1;
const JGeometry::TVec3<f32>& gatePosOffset = ((TModelGate*)mHolder)->unkAC;
JGeometry::TVec3<f32> holderPosOffset(((TModelGate*)mHolder)->unkAC);
Expand Down
Loading