macth and link ItemFlyTurtle.cpp

This commit is contained in:
SwareJonge 2024-06-26 23:43:29 +02:00
parent 68c98ebd59
commit a39bf06c53
21 changed files with 927 additions and 173 deletions

View File

@ -1264,7 +1264,7 @@ config.libs = [
Object(NonMatching, "Sato/LumbarCtrl.cpp"), Object(NonMatching, "Sato/LumbarCtrl.cpp"),
Object(NonMatching, "Sato/ArmCtrl.cpp"), Object(NonMatching, "Sato/ArmCtrl.cpp"),
Object(NonMatching, "Sato/ItemThunder.cpp"), Object(NonMatching, "Sato/ItemThunder.cpp"),
Object(NonMatching, "Sato/ItemFlyTurtle.cpp"), Object(Matching, "Sato/ItemFlyTurtle.cpp"),
Object(NonMatching, "Sato/stEfctWater.cpp"), Object(NonMatching, "Sato/stEfctWater.cpp"),
Object(NonMatching, "Sato/J3DEfctSplashDown.cpp"), Object(NonMatching, "Sato/J3DEfctSplashDown.cpp"),
Object(NonMatching, "Sato/ItemYoshiEgg.cpp"), Object(NonMatching, "Sato/ItemYoshiEgg.cpp"),

View File

@ -20,6 +20,33 @@ namespace GameAudio
virtual void setSe(u32 id); virtual void setSe(u32 id);
virtual void loop(u32); virtual void loop(u32);
}; };
template <typename T>
class SoundWithEchoMgr : public SoundMgr<T>
{
public:
SoundWithEchoMgr(Vec *, JKRHeap *, u8); // 0x8012aaac
virtual ~SoundWithEchoMgr(); // 0x8012ab18
void checkEcho(); // 0x8012ab78
void setInitialEcho(JAISoundHandle *); // 0x8012ad68
};
class ObjectSoundMgr : public SoundWithEchoMgr<ObjectSoundMgr>
{
public:
ObjectSoundMgr(Vec *, JKRHeap *); // 0x8012a588
void frameWork(); // 0x8012a6e4
void setSeWithVelocityVP(u32, f32, f32); // 0x8012a75c
void setSeWithVelocityV(u32, f32, f32); // 0x8012a8c4
void setSeWithVelocityP(u32, f32); // 0x8012a9c4
// Vtable
virtual ~ObjectSoundMgr() {} // 0x8012a5fc
virtual void loop(); // 0x8012a65c
virtual void setSe(u32); // 0x8012a6fc
}; // class ObjectSoundMgr
} }
#endif #endif

View File

@ -23,6 +23,8 @@ struct J3DFrameCtrl
f32 getFrame() const { return mFrame; } f32 getFrame() const { return mFrame; }
void setAttribute(u8 attr) { mAttr = attr; }
// _00 VTBL // _00 VTBL
u8 mAttr; // _04 u8 mAttr; // _04
u8 mState; // _05 u8 mState; // _05

View File

@ -2,7 +2,6 @@
#define _JSYSTEM_J3D_J3DMTXCALC_H #define _JSYSTEM_J3D_J3DMTXCALC_H
#include <dolphin/mtx.h> #include <dolphin/mtx.h>
#include <dolphin/vec.h>
#include "types.h" #include "types.h"
#include "JSystem/J3D/J3DJoint.h" #include "JSystem/J3D/J3DJoint.h"
@ -10,150 +9,149 @@
#include "JSystem/J3D/J3DTypes.h" #include "JSystem/J3D/J3DTypes.h"
#include "JSystem/J3D/J3DAnmTransform.h" #include "JSystem/J3D/J3DAnmTransform.h"
struct J3DMtxBuffer; struct J3DMtxBuffer;
struct J3DMtxCalc { struct J3DMtxCalc {
virtual ~J3DMtxCalc() {}; // _08 virtual ~J3DMtxCalc() {}; // _08
virtual void setAnmTransform(J3DAnmTransform*); // _0C virtual void setAnmTransform(J3DAnmTransform*); // _0C
virtual J3DAnmTransform* getAnmTransform(); // _10 virtual J3DAnmTransform* getAnmTransform(); // _10
virtual void setAnmTransform(unsigned char, J3DAnmTransform*); // _14 virtual void setAnmTransform(u8, J3DAnmTransform*); // _14
virtual J3DAnmTransform* getAnmTransform(unsigned char); // _18 virtual J3DAnmTransform* getAnmTransform(u8); // _18
virtual void setWeight(unsigned char, f32); // _1C virtual void setWeight(u8, f32); // _1C
virtual void getWeight(unsigned char) const; // _20 virtual void getWeight(u8) const; // _20
virtual void init(const Vec&, const f32 (&)[3][4]) = 0; // _24 virtual void init(const Vec&, const f32 (&)[3][4]) = 0; // _24
virtual void calc() = 0; // _28 virtual void calc() = 0; // _28
static void setMtxBuffer(J3DMtxBuffer* buffer) { mMtxBuffer = buffer; } static void setMtxBuffer(J3DMtxBuffer* buffer) { mMtxBuffer = buffer; }
static J3DMtxBuffer* getMtxBuffer() { return mMtxBuffer; } static J3DMtxBuffer* getMtxBuffer() { return mMtxBuffer; }
static J3DJoint* getJoint() { return mJoint; } static J3DJoint* getJoint() { return mJoint; }
static J3DMtxBuffer* mMtxBuffer; static J3DMtxBuffer* mMtxBuffer;
static struct J3DJoint* mJoint; static struct J3DJoint* mJoint;
// _00 = VTBL // _00 = VTBL
}; };
struct J3DMtxCalcNoAnmBase : public J3DMtxCalc { struct J3DMtxCalcNoAnmBase : public J3DMtxCalc {
virtual ~J3DMtxCalcNoAnmBase() { } // _08 (weak) virtual ~J3DMtxCalcNoAnmBase() { } // _08 (weak)
// _00 = VTBL // _00 = VTBL
}; };
template <typename Calc, typename Init> template <typename Calc, typename Init>
struct J3DMtxCalcNoAnm : public J3DMtxCalcNoAnmBase { struct J3DMtxCalcNoAnm : public J3DMtxCalcNoAnmBase {
virtual ~J3DMtxCalcNoAnm() { } // _08 virtual ~J3DMtxCalcNoAnm() { } // _08
virtual void init(const Vec& p1, const f32 (&p2)[3][4]) { Init::init(p1, p2); } // _24 virtual void init(const Vec& p1, const f32 (&p2)[3][4]) { Init::init(p1, p2); } // _24
virtual void calc() { Calc::calcTransform(mJoint->mTransformInfo); } // _28 virtual void calc() { Calc::calcTransform(mJoint->mTransformInfo); } // _28
// _00 = VTBL // _00 = VTBL
}; };
struct J3DMtxCalcAnmBase : public J3DMtxCalc { struct J3DMtxCalcAnmBase : public J3DMtxCalc {
/** @fabricated */ /** @fabricated */
inline J3DMtxCalcAnmBase(J3DAnmTransform* animation) inline J3DMtxCalcAnmBase(J3DAnmTransform* animation)
: _04(animation) : _04(animation)
{ {
} }
virtual ~J3DMtxCalcAnmBase(); // _08 virtual ~J3DMtxCalcAnmBase(); // _08
virtual void setAnmTransform(J3DAnmTransform*); // _0C virtual void setAnmTransform(J3DAnmTransform*); // _0C
virtual J3DAnmTransform* getAnmTransform(); // _10 virtual J3DAnmTransform* getAnmTransform(); // _10
// _00 = VTBL // _00 = VTBL
J3DAnmTransform* _04; // _04 J3DAnmTransform* _04; // _04
}; };
template <typename Adaptor, typename Init> template <typename Adaptor, typename Init>
struct J3DMtxCalcAnimation : public J3DMtxCalcAnmBase { struct J3DMtxCalcAnimation : public J3DMtxCalcAnmBase {
/** @fabricated */ /** @fabricated */
inline J3DMtxCalcAnimation(J3DAnmTransform* animation) inline J3DMtxCalcAnimation(J3DAnmTransform* animation)
: J3DMtxCalcAnmBase(animation) : J3DMtxCalcAnmBase(animation)
{ {
} }
virtual ~J3DMtxCalcAnimation() {}; // _08 virtual ~J3DMtxCalcAnimation() {}; // _08
virtual void setAnmTransform(J3DAnmTransform* p1) { _04 = p1; } // _0C virtual void setAnmTransform(J3DAnmTransform* p1) { _04 = p1; } // _0C
virtual void init(const Vec& p1, const f32 (&p2)[3][4]) { Init::init(p1, p2); } // _24 virtual void init(const Vec& p1, const f32 (&p2)[3][4]) { Init::init(p1, p2); } // _24
virtual void calc() // _28 virtual void calc() // _28
{ {
Adaptor::calc(this); Adaptor::calc(this);
// J3DTransformInfo* pInfo; // J3DTransformInfo* pInfo;
// if (getAnmTransform() == nullptr) { // if (getAnmTransform() == nullptr) {
// pInfo = &mJoint->mTransformInfo; // pInfo = &mJoint->mTransformInfo;
// } else { // } else {
// J3DTransformInfo v1; // J3DTransformInfo v1;
// getAnmTransform()->getTransform(mJoint->getJntNo(), &v1); // getAnmTransform()->getTransform(mJoint->getJntNo(), &v1);
// pInfo = &v1; // pInfo = &v1;
// } // }
// Calc::calcTransform(pInfo); // Calc::calcTransform(pInfo);
} }
// _00 = VTBL // _00 = VTBL
// _04 = J3DAnmTransform* // _04 = J3DAnmTransform*
u8 _08[4]; // _08 u8 _08[4]; // _08
}; };
struct J3DMtxCalcBlendAnmBase : public J3DMtxCalcAnmBase { struct J3DMtxCalcBlendAnmBase : public J3DMtxCalcAnmBase {
virtual ~J3DMtxCalcBlendAnmBase(); // _08 (weak) virtual ~J3DMtxCalcBlendAnmBase(); // _08 (weak)
virtual void setAnmTransform(J3DAnmTransform*); // _0C (weak) virtual void setAnmTransform(J3DAnmTransform*); // _0C (weak)
virtual J3DAnmTransform* getAnmTransform(); // _10 (weak) virtual J3DAnmTransform* getAnmTransform(); // _10 (weak)
virtual void setAnmTransform(unsigned char, J3DAnmTransform*); // _14 (weak) virtual void setAnmTransform(u8, J3DAnmTransform*); // _14 (weak)
virtual J3DAnmTransform* getAnmTransform(unsigned char); // _18 (weak) virtual J3DAnmTransform* getAnmTransform(u8); // _18 (weak)
virtual void setWeight(unsigned char, f32); // _1C (weak) virtual void setWeight(u8, f32); // _1C (weak)
virtual void getWeight(unsigned char) const; // _20 (weak) virtual void getWeight(u8) const; // _20 (weak)
// _00 = VTBL // _00 = VTBL
// _04 = J3DAnmTransform* // _04 = J3DAnmTransform*
J3DAnmTransform* _08; // _08 J3DAnmTransform* _08; // _08
J3DAnmTransform* _0C; // _0C J3DAnmTransform* _0C; // _0C
J3DAnmTransform* _10; // _10 J3DAnmTransform* _10; // _10
f32 _14; // _14 f32 _14; // _14
f32 _18; // _18 f32 _18; // _18
f32 _1C; // _1C f32 _1C; // _1C
f32 _20; // _20 f32 _20; // _20
}; };
template <typename Calc> template <typename Calc>
struct J3DMtxCalcAnimationAdaptorDefault { struct J3DMtxCalcAnimationAdaptorDefault {
/** @fabricated */ /** @fabricated */
static void calc(J3DMtxCalcAnmBase* p1) static void calc(J3DMtxCalcAnmBase* p1)
{ {
J3DTransformInfo* pInfo; J3DTransformInfo* pInfo;
if (p1->getAnmTransform() != nullptr) { if (p1->getAnmTransform() != nullptr) {
J3DTransformInfo v1; J3DTransformInfo v1;
p1->getAnmTransform()->getTransform(J3DMtxCalc::mJoint->getJntNo(), &v1); p1->getAnmTransform()->getTransform(J3DMtxCalc::mJoint->getJntNo(), &v1);
pInfo = &v1; pInfo = &v1;
} else { } else {
pInfo = &J3DMtxCalc::mJoint->mTransformInfo; pInfo = &J3DMtxCalc::mJoint->mTransformInfo;
} }
Calc::calcTransform(*pInfo); Calc::calcTransform(*pInfo);
} }
}; };
struct J3DMtxCalcCalcTransformBasic { struct J3DMtxCalcCalcTransformBasic {
static void calcTransform(const J3DTransformInfo&); static void calcTransform(const J3DTransformInfo&);
}; };
struct J3DMtxCalcCalcTransformSoftimage { struct J3DMtxCalcCalcTransformSoftimage {
static void calcTransform(const J3DTransformInfo&); static void calcTransform(const J3DTransformInfo&);
}; };
struct J3DMtxCalcCalcTransformMaya { struct J3DMtxCalcCalcTransformMaya {
static void calcTransform(const J3DTransformInfo&); static void calcTransform(const J3DTransformInfo&);
}; };
struct J3DMtxCalcJ3DSysInitBasic { struct J3DMtxCalcJ3DSysInitBasic {
static void init(const Vec& p1, const f32 (&p2)[3][4]); static void init(const Vec& p1, const f32 (&p2)[3][4]);
}; };
struct J3DMtxCalcJ3DSysInitSoftimage { struct J3DMtxCalcJ3DSysInitSoftimage {
static void init(const Vec& p1, const f32 (&p2)[3][4]) static void init(const Vec& p1, const f32 (&p2)[3][4])
{ {
J3DSys::mCurrentS.x = p1.x; J3DSys::mCurrentS.x = p1.x;
J3DSys::mCurrentS.y = p1.y; J3DSys::mCurrentS.y = p1.y;
J3DSys::mCurrentS.z = p1.z; J3DSys::mCurrentS.z = p1.z;
} }
}; };
struct J3DMtxCalcJ3DSysInitMaya { struct J3DMtxCalcJ3DSysInitMaya {
static void init(const Vec& p1, const f32 (&p2)[3][4]); static void init(const Vec& p1, const f32 (&p2)[3][4]);
}; };
#endif #endif

View File

@ -125,7 +125,7 @@ namespace JGeometry {
return (const Mtx *)mMtx; return (const Mtx *)mMtx;
} }
operator MtxPtr() const { return (MtxPtr)mMtx; } operator MtxPtr() const { return (MtxPtr)mMtx; }
T mMtx[3][4]; T mMtx[3][4];
}; };
@ -141,7 +141,7 @@ namespace JGeometry {
const T zero = (T)0; const T zero = (T)0;
ref(2, 3) = zero; ref(2, 3) = zero;
ref(1, 3) = zero; ref(1, 3) = zero;
ref(0, 3) = zerof; ref(0, 3) = zero;
ref(1, 2) = zero; ref(1, 2) = zero;
ref(0, 2) = zero; ref(0, 2) = zero;

View File

@ -198,12 +198,12 @@ namespace JGeometry {
return *this; return *this;
}*/ }*/
/*TVec3 &operator*(float scalar) const TVec3 operator*(f32 scalar) const
{ {
TVec3 scaled(*this); TVec3 scaled(*this);
scaled *= scalar; scaled *= scalar;
TVec3(scaled); return scaled;
}*/ }
TVec3 &operator+=(const TVec3 &operand) TVec3 &operator+=(const TVec3 &operand)
{ {
@ -217,13 +217,13 @@ namespace JGeometry {
return *this; return *this;
} }
TVec3 &operator*=(float scalar) TVec3 &operator*=(f32 scalar)
{ {
scale(scalar); scale(scalar);
return *this; return *this;
} }
TVec3 &operator/=(float divisor) TVec3 &operator/=(f32 divisor)
{ {
div(divisor); div(divisor);
return *this; return *this;

View File

@ -227,7 +227,7 @@ namespace JMath
}; };
} }
inline f32 JMAAbs(f32 input) { return __fabs(input); } inline f32 JMAAbs(f32 input) { return __fabsf(input); }
inline f32 JMAAtan2Radian(f32 y, f32 x) { return JMath::atanTable_.atan2Radian(y, x); }; inline f32 JMAAtan2Radian(f32 y, f32 x) { return JMath::atanTable_.atan2Radian(y, x); };

View File

@ -17,6 +17,8 @@ public:
int getBrosPointNumber(); int getBrosPointNumber();
CLPoint *getBrosPoint(int); CLPoint *getBrosPoint(int);
u8 getGroupID() const { return mPointData->uniqueGroupID; }
void getPosition(JGeometry::TVec3f *pos) void getPosition(JGeometry::TVec3f *pos)
{ {
if (mPointData) if (mPointData)
@ -69,7 +71,7 @@ public:
void init_ByCLPointPtr(CLPoint *); void init_ByCLPointPtr(CLPoint *);
void chkArriveAtFwPoint(const JGeometry::TVec3f &, f32); void chkArriveAtFwPoint(const JGeometry::TVec3f &, f32);
void chkIsOverFwPoint(const JGeometry::TVec3f &); void chkIsOverFwPoint(const JGeometry::TVec3f &);
void doNextChkIsOverFwPoint(const JGeometry::TVec3f &); bool doNextChkIsOverFwPoint(const JGeometry::TVec3f &);
void getLengthFromCLDir(const JGeometry::TVec3f &); void getLengthFromCLDir(const JGeometry::TVec3f &);
void changeNextPoint(); void changeNextPoint();
void calcCLDir(); void calcCLDir();
@ -85,6 +87,11 @@ public:
// Vtable // Vtable
virtual int findNextPointNo(CLPoint *); virtual int findNextPointNo(CLPoint *);
CLPoint *getNext() const { return mNext; }
CLPoint *getPrev() const { return mPrev; }
bool tstReverse() const { return mIsReverse; }
CLPoint *mNext; // 4 CLPoint *mNext; // 4
CLPoint *mPrev; // 8 CLPoint *mPrev; // 8
JGeometry::TVec3f _c; JGeometry::TVec3f _c;

View File

@ -95,6 +95,7 @@ public:
int getBombPoint() const { return mBombPoint; }; int getBombPoint() const { return mBombPoint; };
const RaceTime &getMarkTime() { return mMarkTime; }; const RaceTime &getMarkTime() { return mMarkTime; };
f32 getTotalUnitDist() const { return mRaceProgression; }; f32 getTotalUnitDist() const { return mRaceProgression; };
f32 getLapUnitDist() const { return mLapProgression; }
// cmpw was signed right? // cmpw was signed right?
int getGoalFrame() const { return mGoalFrame; }; int getGoalFrame() const { return mGoalFrame; };
@ -130,6 +131,7 @@ public:
bool isMaxTotalTime() const { return !mTotalTime.isAvailable(); } bool isMaxTotalTime() const { return !mTotalTime.isAvailable(); }
bool isDead() const { return tstDead(); } bool isDead() const { return tstDead(); }
bool isBombPointFull() const { return mBombPoint >= sBombPointFull; } bool isBombPointFull() const { return mBombPoint >= sBombPointFull; }
Course::Sector *getCheckSector() const { return mSector2; }
static bool isInsideSector(f32 unitDist) { return (unitDist >= 0.0f && unitDist < 1.0f); } static bool isInsideSector(f32 unitDist) { return (unitDist >= 0.0f && unitDist < 1.0f); }
static int getWinBombPointForMenu(int p1) static int getWinBombPointForMenu(int p1)
@ -196,17 +198,17 @@ public:
} }
static int sPlayerKartColorTable[]; static int sPlayerKartColorTable[];
static short sBalForbiddenTime; static s16 sBalForbiddenTime;
static short sBombPointDirect; // 1 static s16 sBombPointDirect; // 1
static short sBombPointSpin; // 1 static s16 sBombPointSpin; // 1
static short sBombPointIndirect; // 1 static s16 sBombPointIndirect; // 1
static short sBombPointAttacked; // -1 static s16 sBombPointAttacked; // -1
static short sBombPointFull; // 4 static s16 sBombPointFull; // 4
static short sBombPointFullS; // 3 static s16 sBombPointFullS; // 3
static short sBombPointFullL; // 4 static s16 sBombPointFullL; // 4
static short sBombPointCrushOneself; static s16 sBombPointCrushOneself;
// private: // i'm not really sure how else KartChkUsrPage got access to this // private: // i'm not really sure how else KartChkUsrPage got access to this
u16 mRaceFlags; u16 mRaceFlags;
@ -234,8 +236,8 @@ public:
f32 mLapProgression2; // might be max Lap Progression f32 mLapProgression2; // might be max Lap Progression
f32 mRaceProgression; f32 mRaceProgression;
u32 *mPassedSectors; // array of bitfields that keep track of what checkpoints have been passed u32 *mPassedSectors; // array of bitfields that keep track of what checkpoints have been passed
JGeometry::TVec3<f32> mPos; JGeometry::TVec3f mPos;
JGeometry::TVec3<f32> mPrevPos; JGeometry::TVec3f mPrevPos;
JugemPoint *mJugemPoint; JugemPoint *mJugemPoint;
bool mIsInRace; bool mIsInRace;
int mCurFrame; int mCurFrame;
@ -252,7 +254,7 @@ public:
s16 mRabbitWinFrame; s16 mRabbitWinFrame;
int mDemoPoint; int mDemoPoint;
// these only get set in the constructor? // these only get set in the constructor?
JGeometry::TVec3<f32> _0xb0; JGeometry::TVec3f _0xb0;
int _0xbc; int _0xbc;
}; };
@ -262,13 +264,15 @@ public:
LapChecker(); LapChecker();
void reset(); void reset();
void start(Course::Sector *sector); void start(Course::Sector *sector);
void calc(const JGeometry::TVec3<f32> &); void calc(const JGeometry::TVec3f &);
bool isUDValid(); bool isUDValid();
f32 getUD() const { return mLapUnitDist; }
private: private:
Course::Sector *mSector; Course::Sector *mSector;
float mSectorDist; f32 mSectorDist;
float mLapUnitDist; f32 mLapUnitDist;
}; };
#endif // !KARTCHECKER_H #endif // !KARTCHECKER_H

View File

@ -26,6 +26,7 @@ public:
virtual void frameProc() = 0; virtual void frameProc() = 0;
bool tstFlgAnmStop() const { return mFlags & 1; } bool tstFlgAnmStop() const { return mFlags & 1; }
void resetFlag() { mFlags &= ~1; }
u8 mFlags; // 4 u8 mFlags; // 4
u8 mMaxAnmNo; // 5 u8 mMaxAnmNo; // 5
@ -64,7 +65,7 @@ public:
changeAnm(0, true); changeAnm(0, true);
mFlags = 0; mFlags = 0;
} }
virtual void setAnmProc() { mObj[mNowAnmNo].resetAnm(); } // 14 virtual void setAnmProc() { mObj[mNowAnmNo].anmFrameProc(); } // 14
virtual void frameProc() { doframe(mNowAnmNo); } // 18 virtual void frameProc() { doframe(mNowAnmNo); } // 18
virtual ~TAnmControlBase() {} // 1C virtual ~TAnmControlBase() {} // 1C
@ -76,6 +77,13 @@ public:
mObj[anmNo].frameProc(); mObj[anmNo].frameProc();
} }
T *getObj(u8 anm_no) // fabricated
{
#line 122
JUT_MINMAX_ASSERT(0, anm_no, mMaxAnmNo);
return &mObj[anm_no];
}
J3DFrameCtrl *getFrameCtrl(u8 anm_no) J3DFrameCtrl *getFrameCtrl(u8 anm_no)
{ {
#line 127 #line 127
@ -91,11 +99,17 @@ class AnmControlTrans : public TAnmControlBase<J3DAnmObjTrans>
{ {
public: public:
AnmControlTrans() {} AnmControlTrans() {}
//virtual ~AnmControlTrans() {}
void registration(u8, J3DAnmTransform *, J3DMtxCalc *); void registration(u8, J3DAnmTransform *, J3DMtxCalc *);
void registrationBlend(u8, J3DAnmTransform *, J3DMtxCalc *); void registrationBlend(u8, J3DAnmTransform *, J3DMtxCalc *);
void changeBlendAnm(u8, u8, u8); void changeBlendAnm(u8, u8, u8);
void frameProc(); void frameProc();
u8 _1c;
u8 _1d;
u8 _1e;
u8 _1f;
}; };
class AnmController class AnmController
@ -117,6 +131,25 @@ public:
virtual ~AnmController() {} virtual ~AnmController() {}
void InitRegistration(u8 anm_no, ExModel *model)
{
mTrans = new AnmControlTrans();
mTrans->initAnm(anm_no, model);
}
void SetAllWeight(u8 AnmNo) // fabricated?
{
#line 338
JUT_MINMAX_ASSERT(0, AnmNo, mTrans->mMaxAnmNo);
J3DAnmObjTrans *transObj = mTrans->getObj(AnmNo);
if (transObj->_28 & 1) {
transObj->mCalc->setWeight(0, 1.0f);
for(u8 i = AnmNo; i < 4; i++) {
transObj->mCalc->setWeight(i, 0.0f);
}
}
}
void ChangeBlendTransAnm(u8 AnmNo, u8 p2, u8 p3) void ChangeBlendTransAnm(u8 AnmNo, u8 p2, u8 p3)
{ {
if (mTrans == nullptr) if (mTrans == nullptr)
@ -126,9 +159,13 @@ public:
mTrans->changeBlendAnm(AnmNo, p2, p3); mTrans->changeBlendAnm(AnmNo, p2, p3);
} }
J3DFrameCtrl *getFrameCtrl(u8 AnmNo) { return mTrans->getFrameCtrl(AnmNo); }
void ChangeTransAnm(u8 AnmNo, bool p2) { mTrans->changeAnm(AnmNo, p2); } // fabricated
void RegisterTrans(u8 AnmNo, J3DAnmTransform *transform, J3DMtxCalc *calc) { mTrans->registration(AnmNo, transform, calc); } // fabricated
bool IsAvailableTrans() const { return mTrans != nullptr; } bool IsAvailableTrans() const { return mTrans != nullptr; }
void StopTrans() { mTrans->resetFlag(); } // fabricated
AnmControlTrans *mTrans; // 4 AnmControlTrans *mTrans; // 4
void *_08; // AnmControlMatColor void *_08; // AnmControlMatColor
void *_0C; // some JSUPtrList void *_0C; // some JSUPtrList
void *_10; // AnmControlMatColor, copy of _08? or other way around void *_10; // AnmControlMatColor, copy of _08? or other way around

View File

@ -57,7 +57,7 @@ public:
void setCurrentViewNo(u32); // 0x8025d690 void setCurrentViewNo(u32); // 0x8025d690
void createEffect(); // 0x8025d6f0 void createEffect(); // 0x8025d6f0
void findAnyKart(); // 0x8025d760 void findAnyKart(); // 0x8025d760
void getMaxBombReactFrame(); // 0x8025d7b8 static u8 getMaxBombReactFrame(); // 0x8025d7b8
static J3DAnmObjTrans *mAnmTrans[3]; // 0x803a0dfc static J3DAnmObjTrans *mAnmTrans[3]; // 0x803a0dfc
static J3DAnmTransform *mAnmCalc[3]; // 0x803a0e08 static J3DAnmTransform *mAnmCalc[3]; // 0x803a0e08
@ -78,6 +78,8 @@ public:
virtual ~ItemBomb() {} // 0x8025d960 virtual ~ItemBomb() {} // 0x8025d960
void createColModel(J3DModelData *) {} // 0x8025daac void createColModel(J3DModelData *) {} // 0x8025daac
static bool isReact(u32 frame) { return frame >= getMaxBombReactFrame(); } // come up with better name
private: private:
u8 _[0x318 - 0x2b0]; u8 _[0x318 - 0x2b0];

View File

@ -1,6 +1,8 @@
#ifndef ITEMFLYTURTLE_H #ifndef ITEMFLYTURTLE_H
#define ITEMFLYTURTLE_H #define ITEMFLYTURTLE_H
#include <JSystem/JParticle/JPAEmitter.h>
#include "Kaneshige/CenterLine.h" #include "Kaneshige/CenterLine.h"
#include "Kaneshige/KartChecker.h" #include "Kaneshige/KartChecker.h"
#include "Sato/AnmController.h" #include "Sato/AnmController.h"
@ -23,7 +25,7 @@ public:
void moveCommon(); // 0x8027a330 void moveCommon(); // 0x8027a330
void find1StKartNo(); // 0x8027a4d0 void find1StKartNo(); // 0x8027a4d0
void chkSearchTargetKartRadius(); // 0x8027a808 void chkSearchTargetKartRadius(); // 0x8027a808
void chkIsBackTargetKartOffsetPos(); // 0x8027a8ec bool chkIsBackTargetKartOffsetPos(); // 0x8027a8ec
void calcNowHeight(); // 0x8027affc void calcNowHeight(); // 0x8027affc
// Inline/Unused // Inline/Unused
@ -54,7 +56,7 @@ public:
virtual void moveCannon(CrsGround &); // A4 virtual void moveCannon(CrsGround &); // A4
virtual void deleteEffect(); // A8 virtual void deleteEffect(); // A8
static Vec sHandOffsetPos; // 0x8041383c static JGeometry::TVec3f sHandOffsetPos; // 0x8041383c
static J3DAnmTransform *mAnmTrans[2]; // 0x80414f64 static J3DAnmTransform *mAnmTrans[2]; // 0x80414f64
static J3DMtxCalc *mAnmCalc[2]; // 0x80414f6c static J3DMtxCalc *mAnmCalc[2]; // 0x80414f6c
@ -63,10 +65,27 @@ public:
int mMoveState; // 2c8 int mMoveState; // 2c8
int mTargetKartNo; // 2cc int mTargetKartNo; // 2cc
int mLockOnKartNo; // 2d0 int mLockOnKartNo; // 2d0
u8 _2d4[0x32c - 0x2d4]; // u8 _2d4[0x2e0 - 0x2d4]; //
u8 mSearchFrame; // 2e0
f32 mHeight; // 2e4
JGeometry::TVec3f mAttackVel; //
JGeometry::TVec3f _2f4; //
JGeometry::TVec3f _300; //
JGeometry::TVec3f _30c; //
JGeometry::TVec3f _318; //
f32 _324; //
bool _328; //
bool _329; //
BombEffectObj *mBombEffect; // 32c BombEffectObj *mBombEffect; // 32c
ObjColBase *mNewBounds; // 330 ObjColBase *mNewBounds; // 330
u8 _334[0x350 - 0x334]; // u16 mAttackFrame; // 334
JPABaseEmitter *mEmitter; // 338
bool _33c; //
u8 _33d; //
f32 _340; //
f32 mNowHeight; // 344
int m1stKartNo; // 348
u8 _34c; //
LapChecker *mLapChecker; // 350 LapChecker *mLapChecker; // 350
}; // class ItemFlyTurtle }; // class ItemFlyTurtle

View File

@ -2,6 +2,7 @@
#define ITEMOBJ_H #define ITEMOBJ_H
#include <JSystem/JGeometry.h> #include <JSystem/JGeometry.h>
#include "Inagaki/SoundMgr.h"
#include "Kaneshige/Course/CrsGround.h" #include "Kaneshige/Course/CrsGround.h"
#include "Osako/shadowModel.h" #include "Osako/shadowModel.h"
#include "Sato/ObjCollision.h" #include "Sato/ObjCollision.h"
@ -261,14 +262,14 @@ public:
JGeometry::TVec3f _1c; // JGeometry::TVec3f _1c; //
f32 _28; // f32 _28; //
f32 _2c; // f32 _2c; //
f32 _30; // f32 mMaxVel; // 30
Quaternion _34; // Quaternion _34; //
Quaternion _44; // Quaternion _44; //
f32 _54; // f32 mLerpRatio; // 54
JGeometry::TVec3f mDisScaleAnm; // 58 JGeometry::TVec3f mDisScaleAnm; // 58
f32 mEquipScale; // 64 f32 mEquipScale; // 64
f32 mHeightOffset; // 68 f32 mHeightOffset; // 68
u8 _6c[0x70 - 0x6c]; // f32 _6c; //
JGeometry::TVec3f mVel; // 70 JGeometry::TVec3f mVel; // 70
u32 mItemKind; // 7c u32 mItemKind; // 7c
ExModel mModel; // 80 ExModel mModel; // 80
@ -276,7 +277,7 @@ public:
ObjColBase *mBounds; // 110 ObjColBase *mBounds; // 110
u8 _114[0x118 - 0x114]; // u8 _114[0x118 - 0x114]; //
int mState; // 118 int mState; // 118
u8 _11c[0x120 - 0x11c]; // u32 mWaitFrame; // 11c
int mOwnerNum; // 120 int mOwnerNum; // 120
u8 mDriverNum; // 124 u8 mDriverNum; // 124
MtxPtr mpHandAnmMtx; // 128 MtxPtr mpHandAnmMtx; // 128
@ -305,9 +306,12 @@ public:
u8 _1fc; // u8 _1fc; //
u8 _1fd[0x210 - 0x1fd]; // u8 _1fd[0x210 - 0x1fd]; //
Mtx _210; // Mtx _210; //
u8 _240[0x24c - 0x240]; // JGeometry::TVec3f _240; //
u8 _24c; // u8 _24c; //
u8 _24d[0x28c - 0x24d]; // JGeometry::TVec3f mNormal; // 250
u8 _25c[0x280 - 0x25c]; //
GameAudio::ObjectSoundMgr *mSoundMgr; // 280
u8 _284[0x28c - 0x284]; //
int mDirectHitKartNo; // 28c int mDirectHitKartNo; // 28c
u8 _290[0x298 - 0x290]; // u8 _290[0x298 - 0x290]; //
u8 mColorID; // 298 u8 mColorID; // 298

View File

@ -3,6 +3,7 @@
#include "JSystem/J3D/J3DAnmBase.h" #include "JSystem/J3D/J3DAnmBase.h"
#include "JSystem/J3D/J3DFrameCtrl.h" #include "JSystem/J3D/J3DFrameCtrl.h"
#include "JSystem/J3D/J3DMtxCalc.h"
#include "Kaneshige/ExModel.h" #include "Kaneshige/ExModel.h"
class J3DAnmObjBase class J3DAnmObjBase
@ -53,7 +54,16 @@ class J3DAnmObjTrans : public J3DAnmObjBase
{ {
public: public:
// TODO // TODO
J3DAnmObjTrans() {}
virtual ~J3DAnmObjTrans() {}
virtual void anmFrameProc();
static void setupTransAnmData(J3DAnmTransform **, J3DMtxCalc **, J3DModelData *, void *); static void setupTransAnmData(J3DAnmTransform **, J3DMtxCalc **, J3DModelData *, void *);
//private:
J3DMtxCalc *mCalc;
u32 _24;
u8 _28;
}; };
#endif #endif

View File

@ -31,9 +31,12 @@ public:
ObjColBase(J3DModelData *, f32, CKind); ObjColBase(J3DModelData *, f32, CKind);
void IsHitBoundPos(JGeometry::TVec3f, JGeometry::TVec3f); void IsHitBoundPos(JGeometry::TVec3f, JGeometry::TVec3f);
void setRadius(f32 rad) { mRadius = rad; }
void setScale(f32 scale) { mScale = scale; }
f32 mRadius; f32 mRadius;
CKind mKind; CKind mKind;
f32 _c; f32 mScale;
f32 _10; f32 _10;
f32 _14; f32 _14;
f32 _18; f32 _18;

View File

@ -2,6 +2,8 @@
#define OBJUTILITY_H #define OBJUTILITY_H
#include <JSystem/JGeometry.h> #include <JSystem/JGeometry.h>
#include "Sato/ObjCollision.h"
#include "Inagaki/SoundMgr.h"
#include "types.h" #include "types.h"
@ -10,7 +12,7 @@ namespace ObjUtility
void *getPtrMainArc(char *); // 0x8025dc08 void *getPtrMainArc(char *); // 0x8025dc08
void *getPtrCourseArc(char *); // 0x8025dc30 void *getPtrCourseArc(char *); // 0x8025dc30
void getPtrMainLocaleArc(char *); // 0x8025dc58 void getPtrMainLocaleArc(char *); // 0x8025dc58
void setRMtx(Mtx, const JGeometry::TVec3f &, const JGeometry::TVec3f &); // 0x8025dc80 void setRMtx(MtxPtr, const JGeometry::TVec3f &, const JGeometry::TVec3f &); // 0x8025dc80
void executeShakeCamera(const JGeometry::TVec3f &, f32, f32, f32); // 0x8025dcf4 void executeShakeCamera(const JGeometry::TVec3f &, f32, f32, f32); // 0x8025dcf4
Mtx &getKartBodyMtx(int); // 0x8025de7c Mtx &getKartBodyMtx(int); // 0x8025de7c
void getKartPos(int, JGeometry::TVec3f *); // 0x8025df6c void getKartPos(int, JGeometry::TVec3f *); // 0x8025df6c
@ -62,11 +64,17 @@ public:
void setInitialize(JGeometry::TPos3f &, const JGeometry::TPos3f &, u8, f32); void setInitialize(JGeometry::TPos3f &, const JGeometry::TPos3f &, u8, f32);
void setJPAEfct(const JGeometry::TVec3f &, const JGeometry::TVec3f &, u8); void setJPAEfct(const JGeometry::TVec3f &, const JGeometry::TVec3f &, u8);
void startEfct(const JGeometry::TPos3f &, u8); void startEfct(const JGeometry::TPos3f &, u8);
void calc(f32, f32, u8, u8); bool calc(f32, f32, u8, u8);
virtual ~BombEffectObj(); virtual ~BombEffectObj();
virtual void init(const JGeometry::TMtx34f &, u8, f32); virtual void init(const JGeometry::TMtx34f &, u8, f32);
virtual void execute(); virtual bool execute();
u32 _4; // 4
ObjColSphere *mSphere1; // 8
ObjColSphere *mSphere2; // C
JGeometry::TVec3f _10; // 10
GameAudio::ObjectSoundMgr *mObjSndMgr; // 1c
}; };
class FlareEffectObj class FlareEffectObj

View File

@ -24,7 +24,7 @@ void stClampVecMax(JGeometry::TVec3f &, f32);
void stClampVecMin(JGeometry::TVec3f &, f32); void stClampVecMin(JGeometry::TVec3f &, f32);
f32 stspeedy_sqrtf(register f32 x); f32 stspeedy_sqrtf(register f32 x);
f32 stLength2(f32, f32); f32 stLength2(f32, f32);
void stMakeDirectionMtx(JGeometry::TMtx34f *, const JGeometry::TVec3f &, char); void stMakeDirectionMtx(JGeometry::TPos3f *, const JGeometry::TVec3f &, char);
void stMakeRMtx(Mtx, const JGeometry::TVec3f &, const JGeometry::TVec3f &, const JGeometry::TVec3f &); void stMakeRMtx(Mtx, const JGeometry::TVec3f &, const JGeometry::TVec3f &, const JGeometry::TVec3f &);
void stQt2Mtx(Mtx, const Quaternion *); void stQt2Mtx(Mtx, const Quaternion *);
void stVec2QtUpdate(Quaternion &, Quaternion &, const JGeometry::TVec3f &, const JGeometry::TVec3f &); void stVec2QtUpdate(Quaternion &, Quaternion &, const JGeometry::TVec3f &, const JGeometry::TVec3f &);

View File

@ -3,6 +3,7 @@
#include "types.h" #include "types.h"
#include "Inagaki/KartSoundMgr.h" #include "Inagaki/KartSoundMgr.h"
#include "Kaneshige/CenterLine.h"
#include "Sato/RivalKart.h" #include "Sato/RivalKart.h"
#include "Yamamoto/kartPad.h" #include "Yamamoto/kartPad.h"
@ -103,7 +104,7 @@ public:
void CheckReverse(int); void CheckReverse(int);
f32 GetKartScale(int); f32 GetKartScale(int);
RivalKart *getKartEnemy(int); RivalKart *getKartEnemy(int);
void GetKartCenterPtr(int); CLPoint *GetKartCenterPtr(int);
void EnemyInit(int); void EnemyInit(int);
void EnemyResetInit(int); void EnemyResetInit(int);
void CheckZoomWinConsole(); void CheckZoomWinConsole();

View File

@ -11,6 +11,7 @@ extern "C" {
#ifndef __MWERKS__ #ifndef __MWERKS__
// Get clangd to shut up about __fabs being undefined. // Get clangd to shut up about __fabs being undefined.
#define __fabs(x) (x) #define __fabs(x) (x)
#define __fabsf(x) (x)
#define __frsqrte(x) (x) #define __frsqrte(x) (x)
#endif #endif

View File

@ -1,10 +1,17 @@
#include "Kaneshige/LightMgr.h" #include "Kaneshige/LightMgr.h"
#include "Kaneshige/RaceMgr.h"
#include "Sato/ItemBomb.h"
#include "Sato/ItemFlyTurtle.h" #include "Sato/ItemFlyTurtle.h"
#include "Sato/JPEffectMgr.h"
#include "Yamamoto/kartCtrl.h"
// WIP // WIP
#include "mathHelper.h"
namespace namespace
{ {
u8 sMaxWaitFrame = 0;
f32 sEquipScale = 1.0f; f32 sEquipScale = 1.0f;
f32 sReleaseScale = 2.2f; f32 sReleaseScale = 2.2f;
f32 sScaleUpRatio = 1.05f; f32 sScaleUpRatio = 1.05f;
@ -21,7 +28,7 @@ namespace
f32 sHeightYVelAddDown = 0.07; f32 sHeightYVelAddDown = 0.07;
f32 sAttackHeightYVelAddDown = 0.05f; f32 sAttackHeightYVelAddDown = 0.05f;
f32 sSearchHeightYVelAddDown = 0.05f; f32 sSearchHeightYVelAddDown = 0.05f;
f32 sPoseAngle = 20.0f; f32 sPoseAngle = 2.0f;
f32 sBoundRadius = 40.0f; f32 sBoundRadius = 40.0f;
u8 sMaxSearchFrame = 30; u8 sMaxSearchFrame = 30;
f32 sAttackAddVel = 20.0f; f32 sAttackAddVel = 20.0f;
@ -41,7 +48,7 @@ namespace
J3DAnmTransform *ItemFlyTurtle::mAnmTrans[2] = {nullptr, nullptr}; // 0x80414f64 J3DAnmTransform *ItemFlyTurtle::mAnmTrans[2] = {nullptr, nullptr}; // 0x80414f64
J3DMtxCalc *ItemFlyTurtle::mAnmCalc[2] = {nullptr, nullptr}; // 0x80414f6c J3DMtxCalc *ItemFlyTurtle::mAnmCalc[2] = {nullptr, nullptr}; // 0x80414f6c
Vec ItemFlyTurtle::sHandOffsetPos = {20.0f, 5.0f, -30.0f}; JGeometry::TVec3f ItemFlyTurtle::sHandOffsetPos(20.0f, 5.0f, -30.0f);
ItemFlyTurtle::ItemFlyTurtle(u32 kind) : ItemObj(kind) ItemFlyTurtle::ItemFlyTurtle(u32 kind) : ItemObj(kind)
{ {
@ -54,6 +61,49 @@ ItemFlyTurtle::ItemFlyTurtle(u32 kind) : ItemObj(kind)
void ItemFlyTurtle::reset() void ItemFlyTurtle::reset()
{ {
resetObject();
mKartReaction = 8;
_28 = 0.5f;
mHeightOffset = sGndOffsetY;
_6c = 0.0f;
_2c = 0.5f;
mLerpRatio = sLerpRatio;
mController.Reset();
if(mController.IsAvailableTrans())
mController.StopTrans();
if(mNewBounds)
mBounds = mNewBounds;
if(mBounds) {
mBounds->setRadius(sBoundRadius);
mBounds->setScale(1.0f);
}
mMoveState = 0;
mTargetKartNo = 0;
mLockOnKartNo = -1;
mSearchFrame = 0;
mHeight = 0.0f;
mAttackVel.zero();
_2f4.zero();
_300.zero();
_30c.zero();
_318.zero();
_324 = 0.0f;
_328 = 0;
_329 = 0;
mCLPointController->reset();
mBombEffect->reset();
mAttackFrame = 0;
mEmitter = nullptr;
_340 = 0.0f;
_33c = false;
_33d = 0;
mNowHeight = 0.0f;
m1stKartNo = 0;
_34c = 0;
_12c |= 0x2000; _12c |= 0x2000;
mLapChecker->reset(); mLapChecker->reset();
} }
@ -66,15 +116,18 @@ const char *ItemFlyTurtle::getBmdFileName()
const char *ItemFlyTurtle::getBckName(int bckID) const char *ItemFlyTurtle::getBckName(int bckID)
{ {
const char *ret = nullptr;
switch (bckID) switch (bckID)
{ {
case 0: case 0:
return "/Item/item_k_yellow_wait.bck"; ret = "/Item/item_k_yellow_wait.bck";
break;
case 1: case 1:
return "/Item/item_k_yellow_fly.bck"; ret = "/Item/item_k_yellow_fly.bck";
break;
} }
return ret;
return nullptr;
} }
void ItemFlyTurtle::loadAnmData(J3DModelData *modelData) void ItemFlyTurtle::loadAnmData(J3DModelData *modelData)
@ -84,12 +137,21 @@ void ItemFlyTurtle::loadAnmData(J3DModelData *modelData)
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
const char *bckName = getBckName(i); const char *bckName = getBckName(i);
J3DAnmObjTrans::setupTransAnmData(mAnmTrans +i, mAnmCalc + i, modelData, ResMgr::getPtr(ResMgr::mcArcMRAM,bckName)); void *bck = ResMgr::getPtr(ResMgr::mcArcMRAM,bckName);
J3DAnmObjTrans::setupTransAnmData(mAnmTrans + i, mAnmCalc + i, modelData, bck);
} }
} }
} }
void ItemFlyTurtle::createModel(JKRSolidHeap *, u32, u32) {} void ItemFlyTurtle::createModel(JKRSolidHeap *heap, u32 p2, u32 id) {
mModel.createDifferedModel(heap, p2, id | 0x1000200, true);
mController.InitRegistration(2, &mModel);
for(u8 i = 0; i < 2; i++) {
mController.RegisterTrans(i, mAnmTrans[i], mAnmCalc[i]);
J3DFrameCtrl *ctrl = mController.getFrameCtrl(i);
ctrl->setAttribute(2);
}
}
void ItemFlyTurtle::createColModel(J3DModelData *) { createBoundSphere(sBoundRadius, 1.0f); } void ItemFlyTurtle::createColModel(J3DModelData *) { createBoundSphere(sBoundRadius, 1.0f); }
@ -101,9 +163,10 @@ void ItemFlyTurtle::update()
void ItemFlyTurtle::setCurrentViewNo(u32 viewNo) void ItemFlyTurtle::setCurrentViewNo(u32 viewNo)
{ {
setCurrentViewNo(viewNo); ItemObj::setCurrentViewNo(viewNo);
LightObj *lightobj = LightMgr::getManager()->searchLight('SCN0' + viewNo); LightObj *lightobj = LightMgr::getManager()->searchLight('SCN0' + viewNo);
mModel.setEffectMtx(lightobj->getEffectMtx(), 1); MtxPtr m = lightobj->getEffectMtx();
mModel.setEffectMtx(m, 1);
} }
void ItemFlyTurtle::doUniv() void ItemFlyTurtle::doUniv()
@ -129,52 +192,620 @@ void ItemFlyTurtle::initEquip()
void ItemFlyTurtle::doEquip() { doHandOneEquip(false, 0.0f); } void ItemFlyTurtle::doEquip() { doHandOneEquip(false, 0.0f); }
void ItemFlyTurtle::initRelease() {} void ItemFlyTurtle::initRelease() {
find1StKartNo();
mCLPointController->init_ByKartIndex(mOwnerNum);
mMoveState = 0;
void ItemFlyTurtle::setInitReleaseParam() {} if(mController.IsAvailableTrans()) {
mController.SetAllWeight(1);
mController.ChangeTransAnm(1, true);
}
void ItemFlyTurtle::doRelease() {} mMaxVel = sMaxVel;
setInitReleaseParam();
ObjUtility::getKartZdir(mOwnerNum, &mVel);
mVel.scale(sFirstVelMag);
void ItemFlyTurtle::initForceDisappear() {} JGeometry::TVec3f kartVel;
ObjUtility::getKartVel(mOwnerNum, &kartVel);
kartVel.y = 0.0f;
mVel.add(kartVel);
void ItemFlyTurtle::deleteEffect() {} JGeometry::TVec3f kartYDir;
ObjUtility::getKartYdir(mOwnerNum, &kartYDir);
kartYDir.scale(30.0f);
mVel.y += kartYDir.y;
void ItemFlyTurtle::moveWait() {} Mtx &m = ObjUtility::getKartBodyMtx(mOwnerNum);
stMtx2Qt(&_44, m);
void ItemFlyTurtle::moveFlying() {} ObjUtility::getKartZdir(mOwnerNum, &_240);
stVecNormalize(_240);
void ItemFlyTurtle::moveSearchBack() {} _2f4 = mVel;
stVecNormalize(_2f4);
void ItemFlyTurtle::moveSearch() {} _340 = mPos.y;
mLapChecker->start(RCMGetKartChecker(mOwnerNum)->getCheckSector());
}
void ItemFlyTurtle::moveAttack() {} void ItemFlyTurtle::setInitReleaseParam() {
mEquipFlags = 0;
_12c &= ~2;
_12c &= ~1;
initMoveColGround();
mEmitter = GetJPAMgr()->createEmt("mk_kouraBlur_b", mPos);
}
void ItemFlyTurtle::moveCommon() {} void ItemFlyTurtle::doRelease() {
mLapChecker->calc(mPos);
calcNowHeight();
switch (mMoveState) {
case 0:
moveWait();
break;
case 1:
moveFlying();
break;
case 2:
moveSearchBack();
break;
case 3:
moveSearch();
break;
case 4:
moveAttack();
break;
}
void ItemFlyTurtle::moveRescue(CrsGround &) {} if (mEmitter) {
mEmitter->setGlobalTranslation(mPos);
}
mSoundMgr->setSe(0x4008b);
}
void ItemFlyTurtle::find1StKartNo() {} void ItemFlyTurtle::initForceDisappear() {
deleteEffect();
ItemObj::initForceDisappear();
}
void ItemFlyTurtle::chkSearchTargetKartRadius() {} void ItemFlyTurtle::deleteEffect() {
if(mEmitter == nullptr)
return;
GetJPAMgr()->deleteEmt(mEmitter);
mEmitter = nullptr;
}
void ItemFlyTurtle::chkIsBackTargetKartOffsetPos() {} void ItemFlyTurtle::moveWait() {
JGeometry::TVec3f kartVel;
ObjUtility::getKartVel(mOwnerNum, &kartVel);
mPos.add(kartVel);
void ItemFlyTurtle::moveNormal(CrsGround &) {} JGeometry::TVec3f kartZDir;
ObjUtility::getKartZdir(mOwnerNum, &kartZDir);
mVel.x = mVel.z = 0.0f;
mVel.y *= sMoveVelDownRatio;
_2f4 = kartZDir;
_2f4.y = 0.03f * mVel.y;
stVecNormalize(_2f4);
void ItemFlyTurtle::moveColWall(CrsGround &) {} moveCommon();
if(mWaitFrame > sMaxWaitFrame) {
mMoveState = 1;
mVel.x = kartVel.x;
mVel.z = kartVel.z;
}
_340 = mPos.y;
}
void ItemFlyTurtle::moveFlying() {
JGeometry::TVec3f moveVel;
JGeometry::TVec3f nextPos;
mCLPointController->getNext()->getPosition(&nextPos);
moveVel.sub(nextPos, mPos);
moveVel.y = 0.0f;
stVecNormalize(moveVel);
moveVel.scale(sMoveAddVel);
mVel.add(moveVel);
mVel.scale(sMoveVelDownRatio);
_33c = mCLPointController->doNextChkIsOverFwPoint(mPos);
_2f4 = mVel;
stVecNormalize(_2f4);
moveCommon();
find1StKartNo();
chkSearchTargetKartRadius();
}
void ItemFlyTurtle::moveSearchBack() {
JGeometry::TVec3f kartPos;
JGeometry::TVec3f kartZDir;
JGeometry::TVec3f offset;
JGeometry::TVec3f searchVel;
JGeometry::TVec3f search;
ObjUtility::getKartPos(mTargetKartNo,&kartPos);
ObjUtility::getKartZdir(mTargetKartNo,&kartZDir);
kartZDir.y = 0.0f;
stVecNormalize(kartZDir);
kartZDir.negate();
offset = kartZDir;
offset.scale(sSearchOffsetLength);
offset.add(kartPos);;
searchVel.sub(offset, mPos);
searchVel.y = 0.0f;
stVecNormalize(searchVel);
searchVel.scale(sSearchAddVel);
mVel.add(searchVel);
mVel.scale(sMoveVelDownRatio);
_2f4 = mVel;
stVecNormalize(_2f4);
mCLPointController->doNextChkIsOverFwPoint(mPos);
moveCommon();
if(!_329)
searchVel.negate();
search.sub(offset, mPos);
search.y = 0.0f;
f32 searchLen = search.length();
if(searchLen < sSearchMinLength || kartZDir.dot(searchVel) > 0.0f) {
mMoveState = 3;
mSearchFrame = 0;
}
}
void ItemFlyTurtle::moveSearch() {
JGeometry::TVec3f kartPos;
JGeometry::TVec3f kartVel;
JGeometry::TVec3f attackVel;
ObjUtility::getKartPos(mTargetKartNo,&kartPos);
ObjUtility::getKartVel(mTargetKartNo,&kartVel);
attackVel.sub(kartPos, mPos);
attackVel.y = 0.0f;
f32 attackLen = attackVel.length();
stVecNormalize(attackVel);
mAttackVel = attackVel;
attackVel.scale(sSearchAddVel);
mVel.add(attackVel);
kartVel.y = 0.0f;
f32 kartVelLen = kartVel.length();
f32 yVel = mVel.y;
mVel.y = 0.0f;
if (attackLen > sSearchNearLength && mVel.length() > kartVelLen) {
mVel.scale(sSearchNearVelDownRatio);
}
else {
stVecNormalize(mVel);
mVel.scale(kartVelLen);
}
mVel.y = yVel;
mVel.y *= sMoveVelDownRatio;
_2f4 = mAttackVel;
stVecNormalize(_2f4);
moveCommon();
if(++mSearchFrame > sMaxSearchFrame) {
mEquipFlags |= 1 << mTargetKartNo;
mMoveState = 4;
mAttackVel = attackVel;
stVecNormalize(mAttackVel);
JGeometry::TVec3f yNorm(0.0f, 1.0f, 0.0f);
_300 = _240;
_30c.cross(yNorm, _300);
_324 = 0.0f;
_328 = false;
mVel.zero();
}
}
void ItemFlyTurtle::moveAttack() {
JGeometry::TVec3f kartPos;
JGeometry::TVec3f vel;
f32 downVel = sMoveVelDownRatio;
ObjUtility::getKartPos(mTargetKartNo, &kartPos);
vel.sub(kartPos, mPos);
f32 len = vel.length();
stVecNormalize(vel);
if(!_328) {
if(len <= sStraightLength) {
_328 = true;
}
mAttackVel = vel;
}
JGeometry::TVec3f scaledVel = mAttackVel;
scaledVel.scale(sAttackAddVel);
mVel.add(scaledVel);
mVel.scale(downVel);
_2f4 = mVel;
stVecNormalize(_2f4);
moveCommon();
if(mVel.length() > mMaxVel) {
setVelMax();
}
mAttackFrame++;
if(mAttackFrame > sMaxAttackFrame)
setStateDisappear(true);
}
void ItemFlyTurtle::moveCommon() {
mPos.add(mVel);
doMoveColGround(nullptr, false);
f32 ang = (57.29578f) *(_2f4.angle(_240));
if(_2f4.x == 0.0f &&_2f4.z == 0.0f ) {
_2f4 = _240;
_2f4.y = 0.0f;
}
if(ang < sPoseAngle) {
JGeometry::TPos3f dirMtx;
stMakeDirectionMtx(&dirMtx, _2f4, 'Z');
stMtx2Qt(&_44, dirMtx);
}
else {
stVec2QtUpdate(_44, (const Vec &)_240, (const Vec &)_2f4);
}
_240 = _2f4;
}
void ItemFlyTurtle::moveRescue(CrsGround &rGround) {
if(rGround.getAttribute() == 0xff && mPos.y <= (mHeightOffset * mDisScaleAnm.y + rGround.getHeight())) {
setStateDisappear(true);
return;
}
moveNormal(rGround);
}
void ItemFlyTurtle::find1StKartNo() {
if(_34c != 0)
return;
int goalKartNo = RCMGetManager()->getGoalKartNumber();
int origTargetNo = mTargetKartNo;
for(int i = 0; i < RCMGetManager()->getKartNumber(); i++) {
if (goalKartNo + 1 == RCMGetKartChecker(i)->getRank()) {
mTargetKartNo = i;
break;
}
}
if(goalKartNo > m1stKartNo) {
f32 lapUD = mLapChecker->getUD();
f32 tgtUD = RCMGetKartChecker(mTargetKartNo)->getLapUnitDist();
if (lapUD > tgtUD) {
mTargetKartNo = origTargetNo;
_34c = 1;
#line 807
JUT_MINMAX_ASSERT(0, mTargetKartNo, RCMGetManager()->getKartNumber());
}
}
if(_34c == 0 && goalKartNo > 0)
{
if (goalKartNo + 1 == RCMGetKartChecker(mOwnerNum)->getRank()) {
for(int i = 0; i < RCMGetManager()->getKartNumber(); i++) {
if (goalKartNo == RCMGetKartChecker(i)->getRank()) {
mTargetKartNo = i;
break;
}
}
}
}
m1stKartNo = goalKartNo;
}
void ItemFlyTurtle::chkSearchTargetKartRadius() {
JGeometry::TVec3f kartPos;
ObjUtility::getKartPos(mTargetKartNo, &kartPos);
JGeometry::TVec3f posDiff;
posDiff.sub(mPos, kartPos);
f32 height = JMAAbs(posDiff.y);
f32 chkRadius = sTargetChkRadius;
posDiff.y = 0.0f;
CLPoint *center = GetKartCtrl()->GetKartCenterPtr(mTargetKartNo);
if(center == mCLPointController->getNext()) {
chkRadius = chkRadius * sSamePointRadiusMag;
}
if(posDiff.length() < chkRadius && height < sTargetChkHeight) {
mMoveState = 2;
_329 = chkIsBackTargetKartOffsetPos();
mLockOnKartNo = mTargetKartNo;
}
}
bool ItemFlyTurtle::chkIsBackTargetKartOffsetPos() {
bool ret = false;
JGeometry::TVec3f kartPos;
JGeometry::TVec3f zDir;
JGeometry::TVec3f offset;
JGeometry::TVec3f posDiff;
ObjUtility::getKartPos(mTargetKartNo,&kartPos);
ObjUtility::getKartZdir(mTargetKartNo,&zDir);
zDir.y = 0.0f;
stVecNormalize(zDir);
zDir.negate();
offset = zDir;
offset.scale(sSearchOffsetLength);
offset.add(kartPos);
posDiff.sub(offset, mPos);
posDiff.y = 0.0f;
stVecNormalize(posDiff);
posDiff.negate();
if(zDir.dot(posDiff) > 0.0f)
ret = true;
return ret;
}
void ItemFlyTurtle::moveNormal(CrsGround &rGround) {
mHeight = sStdHeight;
switch(mMoveState) {
case 0:
mHeight = sWaitHeight;
break;
case 3:
mHeight = sSearchHeight;
break;
case 4:
mHeight = sAttackHeight;
break;
}
f32 moveY = mDisScaleAnm.y * mHeightOffset + mNowHeight;
JGeometry::TVec3f kartPos;
ObjUtility::getKartPos(mTargetKartNo, &kartPos);
if(mHeight == 0.0f) {
ObjUtility::getKartPos(mOwnerNum,&kartPos);
moveY = kartPos.y;
}
else if(mMoveState == 3 || mMoveState == 4) {
moveY = kartPos.y;
}
f32 moveVelY = mPos.y - moveY;
f32 add = 0.0f;
f32 dstAbs = JMAAbs(mHeight - moveVelY);
f32 absDst = dstAbs > add + mHeight ? add + mHeight : dstAbs;
f32 len = mVel.length();
if(moveVelY < mHeight) {
if(moveVelY < 0.0f)
mPos.y = moveY;
mVel.y += (absDst * sHeightYVelAddUp);
}
else {
f32 yVelAddDown = sHeightYVelAddDown;
if(mMoveState == 4)
yVelAddDown = sAttackHeightYVelAddDown;
else if (mMoveState == 3)
yVelAddDown = sSearchHeightYVelAddDown;
mVel.y -= (absDst * yVelAddDown);
}
f32 velY = mVel.y;
if(len > JMAAbs(velY)) {
mVel.y = 0.0f;
stVecNormalize(mVel);
f32 len2 = len*len;
f32 velY2 = velY*velY;
f32 len = JMAFastSqrt(len2-velY2);
mVel.scale(len);
mVel.y = velY;
}
if(rGround.getAttribute() != 2) {
_340 = mPos.y;
_33d = 0;
}
}
void ItemFlyTurtle::moveColWall(CrsGround &rGround) {
if(_33d == 0 && mMoveState == 1 && _33c) {
_33d = 1;
}
if(_33d == 0) {
mVel.y = 0.0f;
JGeometry::TVec3f nextPos;
JGeometry::TVec3f prevPos;
mCLPointController->getNext()->getPosition(&nextPos);
mCLPointController->getPrev()->getPosition(&prevPos);
JGeometry::TVec3f dist;
dist.sub(nextPos, prevPos);
f32 yVel = dist.y;
dist.y = 0.0f;
f32 len = dist.length();
stVecNormalize(dist);
JGeometry::TVec3f posDiff;
posDiff.sub(mPos, prevPos);
posDiff.y = 0.0f;
mPos.y = (dist.dot(posDiff) / len) * (yVel) + _340;
}
else {
moveNormal(rGround);
}
}
void ItemFlyTurtle::moveCannon(CrsGround &rGround) { moveNormal(rGround); } void ItemFlyTurtle::moveCannon(CrsGround &rGround) { moveNormal(rGround); }
void ItemFlyTurtle::initDisappear() {} void ItemFlyTurtle::initDisappear() {
_12c &= ~1;
mEquipFlags = 0xffffffff;
_12c |= 0x80;
void ItemFlyTurtle::doDisappear() {} JGeometry::TVec3f norm, frDir;
getModelFrDir(&frDir);
if(mTransferFlags & 2) {
norm = (mNormal);
}
else {
norm.set(0.0f, 1.0f, 0.0f);
}
JGeometry::TMtx34f r_m;
ObjUtility::setRMtx(r_m, norm, frDir);
r_m[0][3] = _1c.x;
r_m[1][3] = _1c.y;
r_m[2][3] = _1c.z;
mNewBounds = mBounds;
mBounds = mBombEffect->mSphere1;
mBombEffect->init(r_m,1, 1.0f);
}
void ItemFlyTurtle::doDisappear() {
mDisScaleAnm.setAll(mEquipScale);
if(ItemBomb::isReact(mWaitFrame))
mKartReaction = 2;
if(mEmitter)
mEmitter->setGlobalAlpha(0xff - mWaitFrame * 0x33);
if (mWaitFrame >= 5)
deleteEffect();
if(mBombEffect->execute()) {
if (mEmitter)
deleteEffect();
mState = 10;
}
}
void ItemFlyTurtle::initFall() { setStateForceDisappear(); } void ItemFlyTurtle::initFall() { setStateForceDisappear(); }
void ItemFlyTurtle::calcNowHeight() {} void ItemFlyTurtle::calcNowHeight() {
JGeometry::TVec3f nextPos;
JGeometry::TVec3f prevPos;
mCLPointController->getNext()->getPosition(&nextPos);
mCLPointController->getPrev()->getPosition(&prevPos);
if(mCLPointController->tstReverse()) {
JGeometry::TVec3f swap(nextPos);
nextPos = prevPos;
prevPos = swap;
}
JGeometry::TVec3f dist;
dist.sub(nextPos, prevPos);
dist.y = 0.0f;
f32 len = dist.length();
stVecNormalize(dist);
JGeometry::TVec3f posDiff;
posDiff.sub(mPos, prevPos);
posDiff.y = 0.0f;
mNowHeight = (dist.dot(posDiff) / len) * (nextPos.y - prevPos.y) + prevPos.y;
}
CLPointControllerFlyTurtle::CLPointControllerFlyTurtle() {} CLPointControllerFlyTurtle::CLPointControllerFlyTurtle() {}
int CLPointControllerFlyTurtle::findNextPointNo(CLPoint *) {} int CLPointControllerFlyTurtle::findNextPointNo(CLPoint *point) {
int nextPointNo = 0;
int groupID = 0;
for(u8 i = 0; i < RCMGetManager()->getKartNumber(); i++) {
if(RCMGetKartChecker(i)->getRank() == 1)
groupID = GetKartCtrl()->GetKartCenterPtr(i)->getGroupID();
}
void CLPointControllerFlyTurtle::recursiveTargetCalcBack(CLPoint *, int, int *, unsigned char *, bool *) {} int pointNo = -1;
u8 cnt = 0;
bool found = false;
if (point->getPrevPointNumber() > 1) {
bool wasReverse = mIsReverse;
if(!wasReverse)
mIsReverse = true;
recursiveTargetCalcBack(point, groupID, &pointNo, &cnt, &found);
if(!found && !wasReverse)
mIsReverse = false;
}
if (!found) {
pointNo = -1;
cnt = 0;
found = false;
if(point->getNextPointNumber() < 2)
return 0;
bool wasReverse = mIsReverse;
if(wasReverse)
mIsReverse = false;
recursiveTargetCalc(point, groupID, &pointNo, &cnt, &found);
if(!found && wasReverse)
mIsReverse = true;
}
if(found && pointNo != -1)
nextPointNo = pointNo;
return nextPointNo;
}
void CLPointControllerFlyTurtle::recursiveTargetCalcBack(CLPoint *point, int groupID, int *pPointNo, u8 *pCount, bool *pFoundTarget) {
(*pCount)++;
if(*pCount <= 2) {
int prevPointNo = point->getPrevPointNumber();
if(prevPointNo == 1) {
if(point->getPrevPoint(0)->getNextPointNumber() < 2)
return;
}
for(int i = 0; i < prevPointNo; i++) {
if(*pCount == 1) {
*pPointNo = i;
}
CLPoint *prevPoint = point->getPrevPoint(i);
u8 prevGroupID = prevPoint->getGroupID();
if(prevGroupID == groupID)
*pFoundTarget = true;
else {
CLPoint *div = prevPoint->getDivPoint();
if (div) {
recursiveTargetCalcBack(div, groupID, pPointNo, pCount, pFoundTarget);
(*pCount)--;
}
}
if(*pFoundTarget)
return;
}
}
}
#include "JSystem/JAudio/JASFakeMatch2.h"

View File

@ -37,7 +37,7 @@ void ItemKinoko::reset()
_28 = 0.5f; _28 = 0.5f;
mHeightOffset = sHeightOffset; mHeightOffset = sHeightOffset;
_2c = 0.5f; _2c = 0.5f;
_54 = 0.3f; mLerpRatio = 0.3f;
_2b0 = 0.0f; _2b0 = 0.0f;
_12c |= 8; _12c |= 8;
} }