Skip to content

Commit

Permalink
more pelletMgr.cpp progress
Browse files Browse the repository at this point in the history
  • Loading branch information
HeartPiece44 committed Jan 15, 2025
1 parent 04dd284 commit 02a240c
Show file tree
Hide file tree
Showing 14 changed files with 1,454 additions and 2,923 deletions.
2 changes: 1 addition & 1 deletion include/DualCreature.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ struct DualCreature : public DynCreature {
void invalidateCollisions();

// _00 = VTBL
// _00-_43C = DynCreature?
// _00-_43C = DynCreature
bool mIsRealDynamics; // _43C
u8 mIsCollisionInitialised; // _43D
u8 _43E; // _43E
Expand Down
14 changes: 7 additions & 7 deletions include/KEffect.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ struct EffectParm {
struct KEffect : public zen::CallBack1<zen::particleGenerator*>,
public zen::CallBack2<zen::particleGenerator*, zen::particleMdl*>,
public zen::CallBack1<zen::particleMdl*> {
virtual bool invoke(zen::particleGenerator*); // _08 (weak)
virtual bool invoke(zen::particleGenerator*, zen::particleMdl*); // _24 (weak)
virtual bool invoke(zen::particleMdl*); // _28 (weak)
virtual void emit(EffectParm&) = 0; // _2C
virtual void kill(); // _30 (weak)
virtual void stop(); // _34 (weak)
virtual void restart(); // _38 (weak)
virtual bool invoke(zen::particleGenerator*) { return false; } // _08 (weak)
virtual bool invoke(zen::particleGenerator*, zen::particleMdl*) { return false; } // _24 (weak)
virtual bool invoke(zen::particleMdl*) { return false; } // _28 (weak)
virtual void emit(EffectParm&) = 0; // _2C
virtual void kill() { } // _30 (weak)
virtual void stop() { } // _34 (weak)
virtual void restart() { } // _38 (weak)

// _00 = VTBL1
// _04 = VTBL2
Expand Down
4 changes: 2 additions & 2 deletions include/ObjectMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ struct MonoObjectMgr : public ObjectMgr {
virtual void postUpdate(int, float); // _50
virtual void refresh(Graphics&); // _58
virtual void drawShadow(Graphics&, Texture*); // _5C
virtual int getSize(); // _60 (weak)
virtual int getMax(); // _64 (weak)
virtual int getSize() { return mSize; } // _60 (weak)
virtual int getMax() { return mMaxElements; } // _64 (weak)
virtual void search(ObjectMgr*); // _70
virtual Creature* birth(); // _78
virtual void kill(Creature*); // _7C
Expand Down
103 changes: 76 additions & 27 deletions include/Pellet.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,38 @@ enum PelletColor {
PELCOLOUR_COUNT,
};

/**
* @brief Offset for pellet sound IDs associated with animations.
*
* @note Used with PaniAnimKeyEvent passing of sound IDs.
* @note Add 0xBE to this to get SoundID offset.
*/
enum PelletAnimSoundID {
PELSOUND_NONE = -1,
PELSOUND_Other = 0,
PELSOUND_Engine = 1,
PELSOUND_Gear = 2,
PELSOUND_Rader = 3,
PELSOUND_Spring = 4,
PELSOUND_Battery = 5,
PELSOUND_Zenmai = 6,
PELSOUND_MoneyBox = 7,
};

/**
* @brief Index for bounce sounds used by Pellet.
*
* @note See bounceSounds table in pelletMgr.cpp
*/
enum PelletBounceSoundID {
PELBOUNCE_NONE = -1,
PELBOUNCE_NormalPellet = 0,
PELBOUNCE_NormalUfoPart = 1,
PELBOUNCE_SpringUfoPart = 2,
PELBOUNCE_MoneyBoxUfoPart = 3,
// everything else is unused, though bounceSounds has more entries
};

/**
* @brief TODO
*/
Expand All @@ -81,6 +113,22 @@ struct PelletProp : public CreatureProp {
// TODO: members
};

/**
* @brief TODO
*/
struct PelletShapeObject {
PelletShapeObject(char*, Shape*, char*, char*, int);

bool isMotionFlag(u8 flag) { return mMotionFlag & flag; }
void setMotionFlag(u8 flag) { mMotionFlag |= flag; }

Shape* mShape; // _00
AnimMgr* mAnimMgr; // _04
AnimContext mAnimatorA; // _08
AnimContext mAnimatorB; // _18
u8 mMotionFlag; // _28
};

/**
* @brief TODO
*
Expand Down Expand Up @@ -108,7 +156,7 @@ struct PelletConfig : public Parameters, public CoreNode {
Parm<int> mNonMatchingOnyonSeeds; // _E0, p07 - null produces fireworks
Parm<f32> mPelletScale; // _F0, p10
Parm<f32> mCarryInfoHeight; // _100, p11
Parm<int> _110; // _110, p12 - soundID of some description
Parm<int> mAnimSoundID; // _110, p12 - see PelletAnimSoundID enum
Parm<int> mBounceSoundID; // _120, p13
u32 _130; // _130, maybe int?

Expand Down Expand Up @@ -171,7 +219,7 @@ struct Pellet : public DualCreature, public PaniAnimKeyListener {
Vector3f getSlotGlobalPos(int, f32);
void setSlotFlag(int);
void resetSlotFlag(int);
void isSlotFlag(int);
bool isSlotFlag(int);
void initPellet(PelletShapeObject*, PelletConfig*);
void startCarryMotion(f32);
void finishMotion();
Expand All @@ -190,9 +238,16 @@ struct Pellet : public DualCreature, public PaniAnimKeyListener {
void setMotionFlag(u8 flag) { mMotionFlag |= flag; }
bool isMotionFlag(u8 flag) { return mMotionFlag & flag; }

// DLL inlines to do:
bool isUfoParts();
// this is just bool in the DLL, but seems to need to be BOOL/int to match initPellet
BOOL isUfoParts()
{
if (mConfig) {
return (mConfig->mPelletType() == PELTYPE_UfoPart);
}
return false;
}

// DLL inlines to do:
bool isSlotFree(int);
int getNearestFreeSlotIndex();

Expand All @@ -201,11 +256,13 @@ struct Pellet : public DualCreature, public PaniAnimKeyListener {
// _00-_440 = DualCreature
// _440-_444 = PaniAnimKeyListener
Vector3f _444; // _444
u8 _450; // _450
bool _450; // _450
bool mIsPlayTrySound; // _451
u8 mMotionFlag; // _452
RippleEffect* mRippleEffect; // _454
u8 _458[0x464 - 0x458]; // _458, unknown
u32 _458; // _458, unknown
u32 _45C; // _45C, unknown
f32 _460; // _460
Vector3f _464; // _464
PelletStateMachine* mStateMachine; // _470
AState<Pellet>* mCurrentState; // _474
Expand All @@ -215,19 +272,21 @@ struct Pellet : public DualCreature, public PaniAnimKeyListener {
f32 _48C; // _48C
u16 _490; // _490
Vector3f _494; // _494
u8 _4A0[0x4A8 - 0x4A0]; // _4A0, unknown
u16 _4A0; // _4A0
f32 _4A4; // _4A4
void* mPelletView; // _4A8, both PelletView* and Creature* - see Pellet::getBottomRadius
PelletAnimator mAnimator; // _4AC
u32 _554; // _554, unknown
PelletShapeObject* mShapeObject; // _554
u8 _558[0x4]; // _558, unknown
PelletConfig* mConfig; // _55C
f32 _560; // _560
u8 _564[0x570 - 0x564]; // _564, unknown
f32 mMotionSpeed; // _560
int mSlotFlags[3]; // _564
u16 _570; // _570
CollInfo* mPelletCollInfo; // _574
SearchData mSearchData[4]; // _578
ShapeDynMaterials mShapeDynMaterials; // _5A8
bool mIsAlive; // _5B8
bool mIsAIActive; // _5B9, name is a guess
};

/**
Expand All @@ -248,7 +307,7 @@ struct PelletMgr : public MonoObjectMgr {

PelletMgr(MapMgr*);

virtual ~PelletMgr(); // _48 (weak)
virtual ~PelletMgr() { } // _48 (weak)
virtual void refresh(Graphics&); // _58
virtual Creature* createObject(); // _80
virtual void read(RandomAccessStream&); // _84 (weak)
Expand All @@ -273,13 +332,15 @@ struct PelletMgr : public MonoObjectMgr {
bool useShape(u32);
ID32 getConfigIdAt(int);

bool isMovieFlag(u16 flag) { return mMovieFlags & flag; }
void setMovieFlags(u16 flag) { mMovieFlags |= flag; }

static int getUfoIndexFromID(u32 ufoID);
static u32 getUfoIDFromIndex(int);

// DLL inlines to make:
bool isMovieFlag(u16);
int getNumConfigs();
void setMovieFlags(u16);

void writeAnimInfos(RandomAccessStream&);
void writeConfigs(RandomAccessStream&);

Expand All @@ -289,20 +350,8 @@ struct PelletMgr : public MonoObjectMgr {
// TODO: members
u8 _3C[0x1F8 - 0x3C]; // _3C, unknown
PaniMotionTable* mUfoMotionTable; // _1F8
u8 _1FC[0x204 - 0x1FC]; // _1FC, unknown
};

/**
* @brief TODO
*/
struct PelletShapeObject {
PelletShapeObject(char*, Shape*, char*, char*, int);

Shape* mShape; // _00
AnimMgr* mAnimMgr; // _04
AnimContext mAnimatorA; // _08
AnimContext mAnimatorB; // _18
// TODO: members
u8 _1FC[0x200 - 0x1FC]; // _1FC, unknown
u16 mMovieFlags; // _200
};

extern PelletMgr* pelletMgr;
Expand Down
10 changes: 5 additions & 5 deletions include/PelletView.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ struct PelletView {
{
}

virtual void viewInit(); // _08 (weak)
virtual void viewInit() { } // _08 (weak)
virtual void viewKill() = 0; // _0C
virtual void viewDraw(struct Graphics&, struct Matrix4f&) = 0; // _10
virtual void viewStartTrembleMotion(f32); // _14 (weak)
virtual void viewStartTrembleMotion(f32) { } // _14 (weak)
virtual void viewStartExplodeMotion(f32); // _18 (weak)
virtual void viewSetMotionSpeed(f32); // _1C (weak)
virtual void viewFinishMotion(); // _20 (weak)
virtual void viewDoAnimation(); // _24 (weak)
virtual void viewSetMotionSpeed(f32) { } // _1C (weak)
virtual void viewFinishMotion() { } // _20 (weak)
virtual void viewDoAnimation() { } // _24 (weak)
virtual f32 viewGetBottomRadius() = 0; // _28
virtual f32 viewGetHeight() = 0; // _2C
virtual Vector3f viewGetScale() { return Vector3f(1.0f, 1.0f, 1.0f); } // _30 (weak)
Expand Down
Loading

0 comments on commit 02a240c

Please sign in to comment.