diff --git a/include/M3DUtil/M3UModel.hpp b/include/M3DUtil/M3UModel.hpp index bbfa67b9..740068d0 100644 --- a/include/M3DUtil/M3UModel.hpp +++ b/include/M3DUtil/M3UModel.hpp @@ -2,11 +2,10 @@ #define M3DUTIL_M3U_MODEL_HPP #include +#include struct M3UMtxCalcSetInfo; class J3DModel; -class J3DFrameCtrl; -class J3DAnmTexPattern; class J3DTexNoAnm; class M3UModelCommon { @@ -36,6 +35,9 @@ class M3UModel { void updateInTexPatternAnm(); void updateInMotion(); + // Fabricated + J3DFrameCtrl* getFrameCtrl() { return unkC; } + public: /* 0x4 */ M3UModelCommon* unk4; /* 0x8 */ J3DModel* unk8; diff --git a/include/M3DUtil/M3UModelMario.hpp b/include/M3DUtil/M3UModelMario.hpp new file mode 100644 index 00000000..68757853 --- /dev/null +++ b/include/M3DUtil/M3UModelMario.hpp @@ -0,0 +1,24 @@ +#ifndef M3DUTIL_M3U_MODEL_MARIO_HPP +#define M3DUTIL_M3U_MODEL_MARIO_HPP + +#include + +class M3UModelCommonMario : public M3UModelCommon { +public: + virtual void getMtxCalc(const M3UMtxCalcSetInfo&); + +public: +}; + +class M3UModelMario : public M3UModel { +public: + virtual void changeMtxCalcSIAnmBQAnmTransform(int, u8); + virtual void updateIn(); + virtual void updateInMotion(); + virtual void updateOut(); + +public: + // TODO: +}; + +#endif diff --git a/include/Player/MarioMain.hpp b/include/Player/MarioMain.hpp index 001bfac5..50833c08 100644 --- a/include/Player/MarioMain.hpp +++ b/include/Player/MarioMain.hpp @@ -6,6 +6,9 @@ #include #include #include +#include +#include +#include #include class TLiveActor; @@ -584,12 +587,12 @@ class TMario : public TTakeActor, public TDrawSyncCallback { virtual void damageExec(THitActor*, int, int, int, f32, int, f32, s16); virtual void getVoiceStatus(); - void actnMain(); + bool actnMain(); void pitching(); void putting(); void catchLost(); void takePose(); - void taking(); + bool taking(); void demoMain(); void disappear(); void nomotion(); @@ -656,7 +659,7 @@ class TMario : public TTakeActor, public TDrawSyncCallback { void changeHandByRate(f32); void changeHand(int); void isAnimeLoopOrStop(); - void isLast1AnimeFrame(); + BOOL isLast1AnimeFrame(); void getMotionFrameCtrl(); void getCurrentFrame(int); void getRailMtx() const; @@ -772,10 +775,10 @@ class TMario : public TTakeActor, public TDrawSyncCallback { void checkGraffitoDamage(); void makeGraffitoDamage(const TMario::TEParams&); void checkAllMotions(); - void changePlayerDropping(u32, u32); - void changePlayerJumping(u32, u32); + bool changePlayerDropping(u32, u32); + bool changePlayerJumping(u32, u32); void changePlayerTriJump(); - void changePlayerStatus(u32, u32, bool); + bool changePlayerStatus(u32, u32, bool); void throwMario(const JGeometry::TVec3&, f32); void setStatusToRunning(u32, u32); void setStatusToJumping(u32, u32); @@ -798,7 +801,7 @@ class TMario : public TTakeActor, public TDrawSyncCallback { void changePos(const Vec&); void isSpeedZero(); void canBendBody(); - void considerRotateJumpStart(); + BOOL considerRotateJumpStart(); void addVelocity(f32); s32 onYoshi() const; void getGroundJumpPower() const; @@ -1171,8 +1174,31 @@ class TMario : public TTakeActor, public TDrawSyncCallback { // TODO: Make enum (0 = red, 1 = yellow, 2 = green) /* 0x388 */ u16 mBlooperColor; - - /* 0x38A */ char unk38A[0x5A]; + /* 0x38A */ u16 unk38A; + /* 0x38C */ f32 mHolderHeightDiff; + /* 0x390 */ u32 unk390; + /* 0x394 */ J3DDrawBuffer* unk394; + /* 0x398 */ J3DDrawBuffer* unk398; + /* 0x39C */ u32 unk39C; + /* 0x3A0 */ u32 unk3A0; + /* 0x3A4 */ u32 unk3A4; + /* 0x3A8 */ M3UModelMario* unk3A8; // Full model data + /* 0x3AC */ J3DModelData* unk3AC; // Body model data + /* 0x3B0 */ J3DModel* unk3B0; // R Hand 2nd model + /* 0x3B4 */ J3DModel* unk3B4; // L Hand 2nd model + /* 0x3B8 */ J3DModel* unk3B8; // R Hand 3nd model + /* 0x3BC */ J3DModel* unk3BC; // L Hand 3nd model + /* 0x3C0 */ J3DModel* unk3C0; // R Hand 4nd model + /* 0x3C4 */ u8 unk3C4; + /* 0x3C5 */ u8 unk3C5[12]; // Array of bone ids + /* 0x3D1 */ u8 unk3D1; + /* 0x3D2 */ u8 unk3D2; + /* 0x3D3 */ u8 unk3D3; + /* 0x3D4 */ u16 unk3D4; + /* 0x3D6 */ u16 unk3D6; + /* 0x3D8 */ f32 unk3D8; + /* 0x3DC */ f32 unk3DC; + /* 0x3E0 */ void* mCap; // TMarioCap /* 0x3E4 */ TWaterGun* mWaterGun; diff --git a/src/Player/MarioAction.cpp b/src/Player/MarioAction.cpp index e69de29b..61daaafa 100644 --- a/src/Player/MarioAction.cpp +++ b/src/Player/MarioAction.cpp @@ -0,0 +1,71 @@ +#include + +bool TMario::actnMain() +{ + u32 action = mAction; + + bool result = false; + + // TODO: Action enum + switch (action) { + case 0x383: + result = taking(); + break; + case 0x384: + if ((mInput & 4) != 0) { + result = changePlayerDropping(0x88C, 0); + } else { + if (isLast1AnimeFrame()) { + setAnimation(0xC3, 1.0f); + result = changePlayerStatus(0xC400201, 0, false); + } else { + stopCommon(0x110, 0xC400201); + result = false; + } + } + break; + case 0x386: + if ((mInput & 2) != 0) { + if (considerRotateJumpStart()) { + result = true; + } else { + result = changePlayerJumping(0x2000880, false); + } + } else { + if ((mInput & 4) != 0) { + result = changePlayerStatus(0x88C, 0, false); + } else { + if ((mInput & 8) != 0) { + result = changePlayerStatus(0x50, 0, false); + } else { + stopCommon(0x5A, 0xC400201); + result = false; + } + } + } + break; + case 0x80000387: + if ((mInput & 4) != 0) { + result = changePlayerDropping(0x88c, 0); + } else { + stopCommon(0x6E, 0xC400201); + if (mHeldObject != nullptr + && unk3A8->getFrameCtrl()->checkPass(20.0f)) { + mHeldObject->receiveMessage(this, 0x6); + mHeldObject = nullptr; + } + result = false; + } + break; + case 0x80000588: + if ((mInput & 4) != 0) { + result = changePlayerDropping(0x88C, 0); + } else { + stopCommon(0x65, 0xC400201); + checkThrowObject(); + result = false; + } + break; + } + return result; +}