Skip to content

Commit

Permalink
Link pikiInf.cpp + assorted progress
Browse files Browse the repository at this point in the history
  • Loading branch information
HeartPiece44 committed Oct 22, 2024
1 parent 2c36e6c commit 43d7e97
Show file tree
Hide file tree
Showing 38 changed files with 1,262 additions and 2,690 deletions.
2 changes: 1 addition & 1 deletion configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,7 +495,7 @@ def DolphinLib(lib_name: str, objects: List[Object]) -> Dict[str, Any]:
Object(NonMatching, "plugPikiKando/aiWeed.cpp"),
Object(Matching, "plugPikiKando/aiTable.cpp"),
Object(NonMatching, "plugPikiKando/aiAction.cpp"),
Object(NonMatching, "plugPikiKando/pikiInf.cpp"),
Object(Matching, "plugPikiKando/pikiInf.cpp"),
Object(NonMatching, "plugPikiKando/piki.cpp"),
Object(Matching, "plugPikiKando/odoMeter.cpp"),
Object(NonMatching, "plugPikiKando/pikidoKill.cpp"),
Expand Down
48 changes: 33 additions & 15 deletions include/BaseInf.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,20 +68,9 @@ struct CreatureInf : public BaseInf {
// _00-_2C = BaseInf
EObjType mObjType; // _2C
u32 _30; // _30, unknown
u32 _34; // _34, unknown
u8 _38[0x14]; // _38, unknown
};

/**
* @brief TODO
*/
struct StageInf {
void init();
void initGame();
void saveCard(RandomAccessStream&);
void loadCard(RandomAccessStream&);

// TODO: members
int _34; // _34
int _38; // _38
u8 _3C[0x10]; // _3C, unknown
};

/**
Expand Down Expand Up @@ -117,6 +106,20 @@ struct MonoInfMgr : public InfMgr {
// unused/inlined:
void saveCard(RandomAccessStream&);

inline void clearActiveList()
{
BaseInf* next;
BaseInf* inf;

inf = static_cast<BaseInf*>(mActiveList.mChild);
while (inf) {
next = static_cast<BaseInf*>(inf->mNext);
inf->del();
mFreeList.add(inf);
inf = next;
}
}

// _00 = VTBL
// _00-_04 = InfMgr
int mInfCount; // _04
Expand All @@ -127,6 +130,8 @@ struct MonoInfMgr : public InfMgr {

/**
* @brief TODO
*
* @note Size: 0x64.
*/
struct BPikiInfMgr : public MonoInfMgr {
virtual BPikiInf* newInf(); // _1C
Expand All @@ -138,7 +143,6 @@ struct BPikiInfMgr : public MonoInfMgr {

// _00 = VTBL
// _00-_64 = MonoInfMgr
// TODO: members
};

/**
Expand Down Expand Up @@ -184,6 +188,20 @@ struct PikiInfMgr {
int mPikiCounts[3][3]; // _00, indexed by color and happa maybe?
};

/**
* @brief TODO
*
* @note Size: 0x64.
*/
struct StageInf {
void init();
void initGame();
void saveCard(RandomAccessStream&);
void loadCard(RandomAccessStream&);

BPikiInfMgr mBPikiInfMgr; // _00
};

extern PikiInfMgr pikiInfMgr;

#endif
114 changes: 61 additions & 53 deletions include/Collision.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "Vector.h"
#include "GfxObject.h"
#include "Geometry.h"
#include "Plane.h"

struct CmdStream;
struct Creature;
Expand All @@ -15,6 +16,57 @@ struct Shape;
struct BaseShape;
struct RoomInfo;
struct RigidBody;
struct Graphics;

enum ObjCollType {
OCT_Sphere = 1,
OCT_Platform = 2,
};

enum ObjCollFlags {
OCF_None = 0,
OCF_GetMinY = 1,
};

/**
* @brief TODO
*/
struct ObjCollInfo : public CoreNode {
ObjCollInfo()
: CoreNode("")
{
mId.setID('none');
mCode.setID('none');
mJointIndex = -1;
mCollType = OCT_Sphere;
mRadius = 10.0f;
mCentrePosition.set(0.0f, 0.0f, 0.0f);
mParentShape = nullptr;
mPlatformName = nullptr;
_48 = 0;
mFlags = OCF_None;
}

void loadini(CmdStream*);

// unused/inlined:
void getCentreSize(Vector3f&, f32&);
void showInfo(Graphics&, struct Matrix4f&);
void saveini(char*, RandomAccessStream&);

// _00 = VTBL
// _00-_14 = CoreNode
ID32 mId; // _14
ID32 mCode; // _20
ObjCollType mCollType; // _2C
s32 mJointIndex; // _30
Vector3f mCentrePosition; // _34
f32 mRadius; // _40
BaseShape* mParentShape; // _44
u32 _48; // _48
char* mPlatformName; // _4C
ObjCollFlags mFlags; // _50
};

/**
* @brief TODO
Expand All @@ -29,8 +81,8 @@ struct CollPart {
CollPart* getChild();
CollPart* getChildAt(int);
void getTypeString();
void getID();
void getCode();
ID32 getID();
ID32 getCode();
void getMatrix();
void update(struct Graphics&, bool);
void collide(CollPart*, struct Vector3f&);
Expand All @@ -46,6 +98,8 @@ struct CollPart {
void samePlatShape(Shape*);

Sphere mBoundingSphere; // _00
u8 _10[0x58 - 0x10]; // _10, unknown
ObjCollInfo* mCollInfo; // _58
// TODO: members
};

Expand Down Expand Up @@ -82,56 +136,6 @@ struct CndBombable : public CndCollPart {
// TODO: members
};

enum ObjCollType {
OCT_Sphere = 1,
OCT_Platform = 2,
};

enum ObjCollFlags {
OCF_None = 0,
OCF_GetMinY = 1,
};

/**
* @brief TODO
*/
struct ObjCollInfo : public CoreNode {
ObjCollInfo()
: CoreNode("")
{
mId.setID('none');
mCode.setID('none');
mJointIndex = -1;
mCollType = OCT_Sphere;
mRadius = 10.0f;
mCentrePosition.set(0.0f, 0.0f, 0.0f);
mParentShape = nullptr;
mPlatformName = nullptr;
_48 = 0;
mFlags = OCF_None;
}

void loadini(CmdStream*);

// unused/inlined:
void getCentreSize(Vector3f&, f32&);
void showInfo(Graphics&, struct Matrix4f&);
void saveini(char*, RandomAccessStream&);

// _00 = VTBL
// _00-_14 = CoreNode
ID32 mId; // _14
ID32 mCode; // _20
ObjCollType mCollType; // _2C
s32 mJointIndex; // _30
Vector3f mCentrePosition; // _34
f32 mRadius; // _40
BaseShape* mParentShape; // _44
u32 _48; // _48
char* mPlatformName; // _4C
ObjCollFlags mFlags; // _50
};

struct ShpobjInfo : public GfxobjInfo {
Shape* mTarget; // _20
};
Expand Down Expand Up @@ -193,7 +197,11 @@ struct CollTriInfo {
void init(RoomInfo*, Vector3f*);
void behindEdge(Vector3f&);

// TODO: members
u32 mMapCode; // _00
u8 _04[0x14]; // _04, unknown
Vector3f _18; // _18
u8 _24[0x4]; // _24, unknown
Plane _28[3]; // _28
};

/**
Expand Down
21 changes: 17 additions & 4 deletions include/Controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,25 @@ struct Controller : public Node {
PRESS_Y = 0x800,
PRESS_START = 0x1000,

ANALOG_LEFT = 0x1000000,
ANALOG_RIGHT = 0x2000000,
ANALOG_DOWN = 0x4000000,
ANALOG_UP = 0x8000000,
UNK_BTN14 = 0x2000,
UNK_BTN15 = 0x4000,
UNK_BTN16 = 0x8000,

CSTICK_LEFT = 0x10000,
CSTICK_RIGHT = 0x20000,
CSTICK_DOWN = 0x40000,
CSTICK_UP = 0x80000,

UNK_BTN21 = 0x100000,
UNK_BTN22 = 0x200000,
UNK_BTN23 = 0x400000,
UNK_BTN24 = 0x800000,

ANALOG_LEFT = 0x1000000,
ANALOG_RIGHT = 0x2000000,
ANALOG_DOWN = 0x4000000,
ANALOG_UP = 0x8000000,

PRESS_DPAD = (PRESS_DPAD_LEFT | PRESS_DPAD_RIGHT | PRESS_DPAD_DOWN | PRESS_DPAD_UP),

PRESS_LEFT = (PRESS_DPAD_LEFT | ANALOG_LEFT),
Expand Down Expand Up @@ -66,6 +75,10 @@ struct Controller : public Node {
f32 getSubStickX();
f32 getSubStickY();

inline bool isCurrentInput(u32 button) { return mCurrentInput & button; }
inline bool isReleased(u32 button) { return mInputReleased & button; }
inline bool isPressed(u32 button) { return mInputPressed & button; }

// _00 = VTBL
// _00-_20 = Node
u32 mCurrentInput; // _20
Expand Down
9 changes: 5 additions & 4 deletions include/Creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,11 @@ struct Creature : public RefCountable, public EventTalker {
u32 _28; // _28, unknown
SeContext* mSeContext; // _2C
u8 _30; // _30
u32 _34; // _34, unknown
int _34; // _34
u8 _38[0x40 - 0x38]; // _38, TODO: work out members
FastGrid mGrid; // _40
u8 _58[0x60 - 0x58]; // _58, TODO: work out members
f32 mHealth; // _58
u8 _5C[0x4]; // _5C, unknown
u8 _60; // _60
Generator* mGenerator; // _64
u8 _68[0x4]; // _68, unknown
Expand Down Expand Up @@ -253,7 +254,7 @@ struct Creature : public RefCountable, public EventTalker {
Creature* _180; // _180, unknown
Creature* mStickTarget; // _184, creature/object this creature is stuck to
u32 _188; // _188, unknown
u32 _18C; // _18C, unknown
Creature* _18C; // _18C, unknown
u32 _190; // _190, unknown
Vector3f _194; // _194
int _1A0; // _1A0
Expand All @@ -273,7 +274,7 @@ struct Creature : public RefCountable, public EventTalker {
DynCollObject* _280; // _280
Vector3f* _284; // _284, coll plat normal maybe?
u32 _288; // _288, unknown
u32 _28C; // _28C, unknown
CollTriInfo* mFloorTri; // _28C
u32 _290; // _290, unknown
u8 _294[0x4]; // _294, unknown
u32 _298; // _298, unknown
Expand Down
10 changes: 10 additions & 0 deletions include/Demo.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@

struct Creature;

/**
* @brief TODO
*/
enum EDemoFlags {
DEMOFLAG_Unk0 = 0,
DEMOFLAG_Unk1 = 1,
// ...
DEMOFLAG_Unk27 = 27,
};

/**
* @brief TODO
*/
Expand Down
33 changes: 23 additions & 10 deletions include/Font.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,39 @@

struct Texture;

/**
* @brief TODO
*/
struct FontChar {
FontChar();

u16 _00; // _00
u16 _02; // _02
u16 _04; // _04
u16 _06; // _06
u8 _08[0x4]; // _08, unknown
u32 _0C; // _0C, unknown
u32 _10; // _10, unknown
u32 _14; // _14, unknown
u32 _18; // _18, unknown
};

/**
* @brief TODO
*
* @note Maybe size 0x10? If not, need to change PaniTestNode
* @note Size: 0x10.
*/
struct Font {
void setTexture(Texture*, int, int);
void charToIndex(char);
int charToIndex(char); // may not be int
void charToIndex(u16);
void stringWidth(char*);

// TODO: members
u8 _00[0x10]; // _00
};

/**
* @brief TODO
*/
struct FontChar {
FontChar();
Texture* mTexture; // _00
int mCharWidth; // _04
int mCharHeight; // _08
FontChar* mChars; // _0C
};

#endif
2 changes: 2 additions & 0 deletions include/Generator.h
Original file line number Diff line number Diff line change
Expand Up @@ -621,4 +621,6 @@ struct GenAreaFactory : public Factory<GenArea> {
// TODO: members
};

extern GeneratorCache* generatorCache;

#endif
Loading

0 comments on commit 43d7e97

Please sign in to comment.