Skip to content

Commit

Permalink
piki.cpp progress
Browse files Browse the repository at this point in the history
  • Loading branch information
HeartPiece44 committed Jan 16, 2025
1 parent eb6865d commit b321f99
Show file tree
Hide file tree
Showing 33 changed files with 1,163 additions and 3,100 deletions.
19 changes: 15 additions & 4 deletions include/Geometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,20 +70,31 @@ struct Sphere {
* @brief TODO
*/
struct Tube {
// DLL inlines to do:
Tube(Vector3f& start, Vector3f& end, f32 startRad, f32 endRad)
: mStartPoint(start)
, mEndPoint(end)
, mStartRadius(startRad)
, mEndRadius(endRad)
{
}

Tube() { } // TODO: check this

f32 getYRatio(f32 heightToCheck);
bool collide(const Sphere&, Vector3f&, f32&);
f32 getPosRatio(const Vector3f&);
void getPosGradient(Vector3f&, f32, Vector3f&, Vector3f&);
void setPos(f32);
Vector3f setPos(f32);

// unused/inlined:
void getRatioRadius(f32);
f32 getRatioRadius(f32);

// TODO: members
Vector3f mStartPoint; // _00
Vector3f mEndPoint; // _0C
f32 _18; // _18
f32 _1C; // _1C
f32 mStartRadius; // _18
f32 mEndRadius; // _1C
};

#endif
16 changes: 9 additions & 7 deletions include/ItemMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ struct ItemCreature : public AICreature {
virtual void stopMotion(); // _150
virtual void finalSetup(); // _158 (weak)

inline SimpleAI* getAI() { return static_cast<SimpleAI*>(mStateMachine); }

// _00 = VTBL
// _00-_304 = AICreature
f32 mMotionSpeed; // _304
Expand All @@ -81,7 +79,7 @@ struct ItemMgr : public PolyObjectMgr {
* @note Size: 0x18.
*/
struct UseNode : public CoreNode {
inline UseNode() { initCore("usageNode"); }
UseNode() { initCore("usageNode"); }

// _00 = VTBL
// _00-_14 = CoreNode
Expand All @@ -101,20 +99,24 @@ struct ItemMgr : public PolyObjectMgr {
GoalItem* getNearestContainer(Vector3f&, f32);
UfoItem* getUfo();
void addUseList(int);
PelletShapeObject* getPelletShapeObject(int, int);
ItemShapeObject* getPelletShapeObject(int, int);
void initialise();
int getContainerExitCount();

// unused/inlined:
void getMgr(int);
void getPikiNum();
ObjectMgr* getMgr(int);
int getPikiNum();
bool useObjType(int type);
void showInfo();
void getUfoShape();
Shape* getUfoShape();

MeltingPotMgr* getMeltingPotMgr() { return mMeltingPotMgr; }
PikiHeadMgr* getPikiHeadMgr() { return mPikiHeadMgr; }

// DLL inlines to make:
Shape* getPebbleShape(int);
Shape* getGrassShape(int);

// _00 = VTBL 1
// _08 = VTBL 2
// _00-_4C = PolyObjectMgr
Expand Down
8 changes: 4 additions & 4 deletions include/PaniPikiAnimator.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,22 +145,22 @@ struct PaniPikiAnimMgr {
static PaniMotionTable* getMotionTable();

// these are fake according to the DLL
inline bool isFinished() { return mLowerAnimator.isFinished(); }
inline bool isFinished() { return mUpperAnimator.isFinished(); }
inline f32 getAnimSpeed() { return mAnimSpeed; }
inline void setAnimSpeed(f32 speed) { mAnimSpeed = speed; }

// Names taken from linker file
PaniPikiAnimator& getLowerAnimator() { return mLowerAnimator; }
PaniPikiAnimator& getUpperAnimator() { return mUpperAnimator; }
PaniPikiAnimator& getLowerAnimator() { return mLowerAnimator; }

// remaining DLL inlines:
// static void initPaniPikiAnimMgr();

static PaniMotionTable* motionTable;

f32 mAnimSpeed; // _00
PaniPikiAnimator mLowerAnimator; // _04
PaniPikiAnimator mUpperAnimator; // _58
PaniPikiAnimator mUpperAnimator; // _04
PaniPikiAnimator mLowerAnimator; // _58
};

#endif
165 changes: 73 additions & 92 deletions include/Piki.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "StateMachine.h"
#include "UtEffect.h"
#include "OdoMeter.h"
#include "Route.h"

#define PIKI_PROP() static_cast<PikiProp*>(mProps)->mPikiParms
#define C_PIKI_PROP(piki) static_cast<PikiProp*>(piki->mProps)->mPikiParms
Expand All @@ -16,6 +17,7 @@ struct TopAction;
struct Navi;
struct PikiStateMachine;
struct PikiProp;
struct PikiState;

/**
* @brief TODO
Expand Down Expand Up @@ -72,7 +74,7 @@ DEFINE_ENUM_TYPE(
PebbleMode, // 21
BomakeMode, // 22
BoMode, // 23
WarriorMode, // 23
WarriorMode, // 24
);
// clang-format on

Expand Down Expand Up @@ -121,7 +123,7 @@ struct Piki : public Creature, public PaniAnimKeyListener {
virtual void setFlower(int) { } // _130
virtual void setLeaves(int); // _134

void getSpeed(f32);
f32 getSpeed(f32);
void setSpeed(f32, Vector3f&);
void setSpeed(f32, f32);
void init(Navi*);
Expand All @@ -137,24 +139,24 @@ struct Piki : public Creature, public PaniAnimKeyListener {
void demoCheck();
void startDemo();
void finishDemo();
void appearDemo();
void getUpperMotionIndex();
void getAttackPower();
void findRoute(int, int, bool, bool);
void moveRouteTraceDynamic(f32);
void initRouteTrace(Vector3f&, bool);
void moveRouteTrace(f32);
void crGetPoint(int);
void crPointOpen(int);
void crGetRadius(int);
bool appearDemo();
int getUpperMotionIndex();
f32 getAttackPower();
int findRoute(int, int, bool, bool);
int moveRouteTraceDynamic(f32);
bool initRouteTrace(Vector3f&, bool);
int moveRouteTrace(f32);
Vector3f crGetPoint(int);
bool crPointOpen(int);
f32 crGetRadius(int);
void crMakeRefs();
bool hasBomb();
void startFire();
void endFire();
bool isTeki(Piki*);
void actOnSituaton(); // dev spelling
int getState();
void graspSituation(Creature**);
int graspSituation(Creature**);
void initColor(int);
void startKinoko();
void endKinoko();
Expand All @@ -172,88 +174,75 @@ struct Piki : public Creature, public PaniAnimKeyListener {
static bool isSafeMePos(Vector3f&);

// unused/inlined:
void getPikiState();
void initRouteTraceDynamic(Creature*);
PikiState* getPikiState();
bool initRouteTraceDynamic(Creature*);
void updateFire();
void getNaviID();
void getLastState();
int getNaviID();
int getLastState();
void birthBuried();
void isGrowable();
void isTamable();
bool isGrowable();
bool isTamable();
void growup();
void doMotionBlend();
bool doMotionBlend();
void swapMotion(PaniMotionInfo&, PaniMotionInfo&);
void setSpeed(f32);
void getCurrentMotionName();
char* getCurrentMotionName();

// defined in PikiMgr.h to avoid include looping
inline PikiProp* getPikiProp();
// NB: these are all the DLL inlines. No more.

void setEraseKill() { mEraseKill = true; }
void unsetEraseKill() { mEraseKill = false; }

AState<Piki>* getCurrState() { return mCurrentState; }
void setCurrState(AState<Piki>* state) { mCurrentState = state; }

// 100AEBD0 in plugPiki
inline void setPositionA(Vector3f* other)
void startLook(Vector3f* other)
{
_33C = other;

_340 = 0;
_330 = 0;

// _338 is a counter
if (_338) {
subCnt();
_338 = 0;
}
_338.reset();
}

inline void resetVariables()
void forceFinishLook()
{
_33C = 0;
_348 = 0.0f;
_344 = 0.0f;
_340 = 0;
_330 = 0;

if (_338) {
subCnt();
_338 = 0;
}
_338.reset();
}

inline void set584() { _584 = 1; } // rename later
bool isFired() { return mIsOnFire; }

AState<Piki>* getCurrState() { return nullptr; } // fix this later
static bool directDumpMode;
static Colour* kinokoColors;
static Colour* pikiColors;

// _00 = VTBL
// _00-_2B8 = Creature
// _2B8 = PaniAnimKeyListener
OdoMeter mOdometer; // _2BC
u32 _2CC; // _2CC
u32 mTestPathingAgentId; // _2D0
u8 _2D4; // _2D4
u32 _2D8; // _2D8
u32 _2DC; // _2DC
u32 _2E0; // _2E0
u32 _2E4; // _2E4
u32 _2E8; // _2E8
u32 _2EC; // _2EC
u32 _2F0; // _2F0
u32 _2F4; // _2F4
u32 _2F8; // _2F8
u32 _2FC; // _2FC
u32 _300; // _300
u32 _304; // _304
u32 _308; // _308
u32 _30C; // _30C
u32 _310; // _310
u32 _314; // _314
u32 _318; // _318
u32 _31C; // _31C
u32 _320; // _320
u32 _324; // _324
u32 _328; // _328
u32 _32C; // _32C
PathFinder::Buffer* mPathBuffers; // _2CC
u32 mRouteHandle; // _2D0
bool mDoRouteASync; // _2D4
s16 mRouteStartWPIdx; // _2D6
s16 mRouteGoalWPIdx; // _2D8
bool _2DA; // _2DA
s16 mCurrRoutePoint; // _2DC
Vector3f mRouteStartPos; // _2E0
Vector3f mRouteGoalPos; // _2EC
Vector3f mSplineControlPts[4]; // _2F8
s16 mNumRoutePoints; // _328
Creature* mRouteTargetCreature; // _32C
u8 _330; // _330
u32 _334; // _334
u32 _338; // _338, this is a struct, wtf? (10055D50 in plugPiki sets this to 0)
SmartPtr<Creature> _338; // _338
Vector3f* _33C; // _33C
u8 _340; // _340
f32 _344; // _344
Expand All @@ -265,24 +254,19 @@ struct Piki : public Creature, public PaniAnimKeyListener {
u8 _401[0x408 - 0x401]; // _401
u8 _408; // _408
bool mIsCallable; // _409
u8 _40A[0x424 - 0x40A]; // _40A
u8 _424; // _424
UpdateContext _40C; // _40C
UpdateContext _418; // _418
bool mIsOnFire; // _424
u16 _426; // _426
PermanentEffect* _428; // _428
BurnEffect* mBurnEffect; // _42C
RippleEffect* mRippleEffect; // _430
FreeLightEffect* mFreeLightEffect; // _434
SlimeEffect* mSlimeEffect; // _438
u32 mPlayerId; // _43C
u32 _440; // _440
u32 _444; // _444
u32 _448; // _448
u32 _44C; // _44C
u32 _450; // _450
u32 _454; // _454
u32 _458; // _458
u32 _45C; // _45C
u32 _460; // _460
Vector3f _440; // _440
Vector3f _44C; // _44C
Vector3f mCatchPos; // _458
Vector3f mEffectPos; // _464
u8 mWantToStick; // _470
u8 _471[0x48C - 0x471]; // _471
Expand All @@ -296,34 +280,31 @@ struct Piki : public Creature, public PaniAnimKeyListener {
Creature* mLeaderCreature; // _4A8, maybe puffstool/kinoko leader?
Vector3f mPluckVelocity; // _4AC
int _4B8; // _4B8
u32 _4BC; // _4BC
u32 _4C0; // _4C0
u32 _4C4; // _4C4
u32 _4C8; // _4C8
u32 _4CC; // _4CC
u32 _4D0; // _4D0
u32 _4D4; // _4D4
u32 _4D8; // _4D8
u32 _4DC; // _4DC
u32 _4E0; // _4E0
u32 _4E4; // _4E4
u32 _4E8; // _4E8
u32 _4EC; // _4EC
u32 _4F0; // _4F0
u32 _4F4; // _4F4
Vector3f _4BC; // _4BC
Vector3f _4C8; // _4C8
u8 _4D4[0x8]; // _4D4, unknown
u32 _4DC; // _4DC, unknown
u8 _4E0[0x4F8 - 0x4E0]; // _4E0, unknown
TopAction* mActiveAction; // _4F8, may be just Action*
u16 mMode; // _4FC, use PikiMode enum
u32 _500; // _500
SmartPtr<Creature> _500; // _500
Navi* mNavi; // _504
u8 _508[0x8]; // _508
u8 _508[0x4]; // _508
Colour _50C; // _50C
u16 mColor; // _510, red/yellow/blue
u8 _512[0x518 - 0x512]; // _4FC
u8 _518; // _518
u8 _519; // _519
u8 _51A[0x520 - 0x51A]; // _51A
int mHappa; // _520, leaf/bud/flower
u8 _524[0x584 - 0x524]; // _524
u8 _584; // _584, unknown
u16 _524; // _524, might be s16
u8 _526[0x52C - 0x526]; // _524, unknown
AState<Piki>* mCurrentState; // _52C
Colour _530; // _530
Colour _534; // _534
u8 _538[0x4]; // _538, unknown
SearchData mPikiSearchData[6]; // _53C
bool mEraseKill; // _584
};

/**
Expand Down
Loading

0 comments on commit b321f99

Please sign in to comment.