Skip to content

Commit

Permalink
more SnakeBody work
Browse files Browse the repository at this point in the history
  • Loading branch information
HeartPiece44 committed Jan 2, 2025
1 parent 85ce67e commit f90792b
Show file tree
Hide file tree
Showing 7 changed files with 376 additions and 1,140 deletions.
11 changes: 11 additions & 0 deletions include/EffectMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ struct EffectMgr : public CoreNode {
// ...
EFF_Unk69 = 69,
// ...
EFF_Unk85 = 85,
// ...
EFF_Unk87 = 87,
EFF_Unk88 = 88,
EFF_Unk89 = 89,
Expand All @@ -158,6 +160,15 @@ struct EffectMgr : public CoreNode {
EFF_Unk124 = 124,
EFF_Unk125 = 125,
// ...
EFF_Unk128 = 128,
EFF_Unk129 = 129,
EFF_Unk130 = 130,
EFF_Unk131 = 131,
EFF_Unk132 = 132,
EFF_Unk133 = 133,
EFF_Unk134 = 134,
EFF_Unk135 = 135,
// ...
EFF_Unk193 = 193,
EFF_Unk194 = 194,
EFF_Unk195 = 195,
Expand Down
7 changes: 6 additions & 1 deletion include/Matrix4f.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,12 @@ struct Matrix4f {

void getRow(int rowNum, Vector3f& row) { row.set(mMtx[rowNum][0], mMtx[rowNum][1], mMtx[rowNum][2]); }

void getColumn(int colNum, Vector3f& col) { col.set(mMtx[0][colNum], mMtx[1][colNum], mMtx[2][colNum]); }
void getColumn(int colNum, Vector3f& col)
{
col.x = mMtx[0][colNum];
col.y = mMtx[1][colNum];
col.z = mMtx[2][colNum];
}

void setRow(int rowNum, const Vector3f& row)
{
Expand Down
8 changes: 7 additions & 1 deletion include/NsMath.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,15 @@ void calcMat3toMat4(const Matrix3f&, Matrix4f&);
// other existing (inline) functions according to the DLL:
f32 calcInnerRatio(const Vector3f&, const Vector3f&);
void calcMtxTrans(const Matrix4f&, int, Vector3f&);
void calcOuterPro(const Vector3f&, const Vector3f&, Vector3f&);
void calcVectorTrans(const Vector3f&, int, Matrix4f&);

static void calcOuterPro(const Vector3f& vec1, const Vector3f& vec2, Vector3f& outVec)
{
outVec.x = vec1.y * vec2.z - vec1.z * vec2.y;
outVec.y = vec1.z * vec2.x - vec1.x * vec2.z;
outVec.z = vec1.x * vec2.y - vec1.y * vec2.x;
}

static inline void calcMtxBotIdent(Matrix4f& mtx)
{
mtx.mMtx[3][0] = 0.0f;
Expand Down
51 changes: 39 additions & 12 deletions include/Snake.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,17 +192,23 @@ struct SnakeBody {
void setDeadScale(Matrix4f*);

Snake* mSnake; // _00
u8 _04[0x50 - 0x4]; // _04, unknown
bool _04; // _04
u8 _05; // _05
int _08; // _08
f32 mBlendingRatio; // _0C
f32 mBlendingRate; // _10
f32 _14[7]; // _14
f32 _30[8]; // _30
Vector3f _50; // _50
Vector3f _5C[8]; // _5C
Vector3f _BC[6]; // _BC
Vector3f _104[32]; // _104
Vector3f _104[8][4]; // _104
Matrix4f _284[8]; // _284
Matrix4f _484[8]; // _484
Matrix4f _684[8]; // _684
SnakeGenBodyOnGroundCallBack* mOnGroundCallBack; // _884
SnakeGenBodyRotateCallBack* mRotateCallBack; // _888
u32* _88C; // _88C, array or ptr to something with no ctor, size 0x1C?
zen::particleGenerator** mHeadPtclGens; // _88C
};

/**
Expand Down Expand Up @@ -343,33 +349,54 @@ struct SnakeAi : public PaniAnimKeyListener {

// _00 = VTBL
// _00-_04 = PaniAnimKeyListener
u8 _04[0x50 - 0x4]; // _04, unknown
u8 _04; // _04
u8 _05[0x50 - 0x5]; // _05, unknown
};

/**
* @brief TODO
*/
struct SnakeGenBodyOnGroundCallBack : public zen::CallBack1<zen::particleGenerator*> {
SnakeGenBodyOnGroundCallBack() { }
virtual bool invoke(zen::particleGenerator* ptclGen) // _08
{
if (!mSnake->getAlive() || mSnake->getNextState() == 8) {
ptclGen->finish();
}

virtual bool invoke(zen::particleGenerator*); // _08
return true;
}

void set(Snake* snake) { mSnake = snake; }

// _00 = VTBL
// _00-_04 = zen::CallBack1?
u8 _04[4]; // _04, unknown
// _00-_04 = zen::CallBack1
Snake* mSnake; // _04
};

/**
* @brief TODO
*/
struct SnakeGenBodyRotateCallBack : public zen::CallBack1<zen::particleGenerator*> {
SnakeGenBodyRotateCallBack() { }
virtual bool invoke(zen::particleGenerator* ptclGen) // _08
{
if (mSnake->mSnakeAi->_04) {
ptclGen->startGen();
} else {
ptclGen->stopGen();
}

if (!mSnake->getAlive() || mSnake->getNextState() == 8) {
ptclGen->finish();
}

return true;
}

virtual bool invoke(zen::particleGenerator*); // _08
void set(Snake* snake) { mSnake = snake; }

// _00 = VTBL
// _00-_04 = zen::CallBack1?
u8 _04[4]; // _04, unknown
// _00-_04 = zen::CallBack1
Snake* mSnake; // _04
};

#endif
2 changes: 1 addition & 1 deletion include/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,6 @@ inline Vector3f operator*(const f32& b, const Vector3f& a) { return a * b; }
inline Vector3f operator+(const Vector3f& a, const Vector3f& b) { return Vector3f(a.x + b.x, a.y + b.y, a.z + b.z); }
inline Vector3f operator-(const Vector3f& a, const Vector3f& b) { return Vector3f(a.x - b.x, a.y - b.y, a.z - b.z); }
inline Vector3f operator-(const Vector3f& a) { return Vector3f(-a.x, -a.y, -a.z); }
inline Vector3f operator/(const Vector3f& a, const f32& b) { return Vector3f(a.x / b, a.y / b, a.z / b); }
inline Vector3f operator/(const Vector3f& a, const f32& b) { return a * (1.0f / b); }

#endif
Loading

0 comments on commit f90792b

Please sign in to comment.