Skip to content

Commit

Permalink
Match all of itemDownFloor.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
HeartPiece44 committed Sep 28, 2023
1 parent 876d47b commit 5edcb8a
Show file tree
Hide file tree
Showing 8 changed files with 708 additions and 4,441 deletions.
22 changes: 11 additions & 11 deletions docs/recommended_todo.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/creatureLOD.cpp">creatureLOD.cpp</a> | 14136 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/flockMgr.cpp">flockMgr.cpp</a> | 14542 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/naviWhistle.cpp">naviWhistle.cpp</a> | 16714 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemRock.cpp">itemRock.cpp</a> | 17257 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBattle.cpp">aiBattle.cpp</a> | 17401 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemCave.cpp">itemCave.cpp</a> | 20150 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameResultTexMgr.cpp">gameResultTexMgr.cpp</a> | 21221 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_MainResult.cpp">singleGS_MainResult.cpp</a> | 21236 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_CaveResult.cpp">singleGS_CaveResult.cpp</a> | 22845 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/naviMgr.cpp">naviMgr.cpp</a> | 24409 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBore.cpp">aiBore.cpp</a> | 26633 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiCrop.cpp">aiCrop.cpp</a> | 26982 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiTransport.cpp">aiTransport.cpp</a> | 27275 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameSystem.cpp">gameSystem.cpp</a> | 27889 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameSeaMgr.cpp">gameSeaMgr.cpp</a> | 27984 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/pathfinder.cpp">pathfinder.cpp</a> | 28318 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiAttack.cpp">aiAttack.cpp</a> | 28457 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/vsCardMgr.cpp">vsCardMgr.cpp</a> | 31094 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiEnter.cpp">aiEnter.cpp</a> | 31721 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_DayEnd.cpp">singleGS_DayEnd.cpp</a> | 31850 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemBridge.cpp">itemBridge.cpp</a> | 32146 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameDynamics.cpp">gameDynamics.cpp</a> | 34058 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/baseGameSectionKantei.cpp">baseGameSectionKantei.cpp</a> | 35202 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gamePlayDataMemCard.cpp">gamePlayDataMemCard.cpp</a> | 36035 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/piki.cpp">piki.cpp</a> | 36373 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameGeneratorCache.cpp">gameGeneratorCache.cpp</a> | 37575 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiWeed.cpp">aiWeed.cpp</a> | 38056 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/vsGameSection.cpp">vsGameSection.cpp</a> | 39925 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameResultTexMgr.cpp">gameResultTexMgr.cpp</a> | 21221 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemDownFloor.cpp">itemDownFloor.cpp</a> | 21226 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_MainResult.cpp">singleGS_MainResult.cpp</a> | 21236 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_CaveResult.cpp">singleGS_CaveResult.cpp</a> | 22845 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/naviMgr.cpp">naviMgr.cpp</a> | 24409 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiBore.cpp">aiBore.cpp</a> | 26633 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiCrop.cpp">aiCrop.cpp</a> | 26982 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiTransport.cpp">aiTransport.cpp</a> | 27275 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameSystem.cpp">gameSystem.cpp</a> | 27889 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameSeaMgr.cpp">gameSeaMgr.cpp</a> | 27984 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/pathfinder.cpp">pathfinder.cpp</a> | 28318 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiAttack.cpp">aiAttack.cpp</a> | 28457 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/vsCardMgr.cpp">vsCardMgr.cpp</a> | 31094 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiEnter.cpp">aiEnter.cpp</a> | 31721 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/singleGS_DayEnd.cpp">singleGS_DayEnd.cpp</a> | 31850 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/itemBridge.cpp">itemBridge.cpp</a> | 32146 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameDynamics.cpp">gameDynamics.cpp</a> | 34058 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/baseGameSectionKantei.cpp">baseGameSectionKantei.cpp</a> | 35202 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gamePlayDataMemCard.cpp">gamePlayDataMemCard.cpp</a> | 36035 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/piki.cpp">piki.cpp</a> | 36373 |
| <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/gameGeneratorCache.cpp">gameGeneratorCache.cpp</a> | 37575 | <a href="https://github.com/projectPiki/pikmin2/tree/main/src/plugProjectKandoU/aiWeed.cpp">aiWeed.cpp</a> | 38056 |

### <section id="plugProjectKonoU">plugProjectKonoU</section>
| File | Size (bytes) | File | Size (bytes) |
Expand Down
2 changes: 2 additions & 0 deletions include/Game/BaseGameSection.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ enum DemoTimers {
DEMOTIMER_Unk3 = 3,
DEMOTIMER_Meet_Red_Pikmin = 4,
DEMOTIMER_Reds_Purples_Tutorial = 5,
DEMOTIMER_Unk6 = 6,
DEMOTIMER_CrushBag = 7,
};

struct BaseGameSection : public BaseHIOSection {
Expand Down
134 changes: 85 additions & 49 deletions include/Game/Entities/ItemDownFloor.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,26 @@ struct Item;
namespace ItemDownFloor {
struct Item;

enum cState {
DOWNFLOORSTATE_Wait = 0,
DOWNFLOORSTATE_Damaged,
DOWNFLOORSTATE_Down,
DOWNFLOORSTATE_Up,
DOWNFLOORSTATE_Dead,
DOWNFLOORSTATE_COUNT
#define DFTYPE_PaperBag (0)
#define DFTYPE_DownBlock (1)
#define DFTYPE_UpBlock (2)

#define DFMODEL_SmallBlock (0)
#define DFMODEL_LargeBlock (1)
#define DFMODEL_PaperBag (2)

enum StateID {
DOWNFLOOR_Wait = 0,
DOWNFLOOR_Damaged = 1,
DOWNFLOOR_Down = 2,
DOWNFLOOR_Up = 3,
DOWNFLOOR_Dead = 4,
DOWNFLOOR_StateCount, // 5
};

struct InitArg : public CreatureInitArg {
// _00 = VTBL
f32 mFaceDir; // _04
};

struct FSM : public ItemFSM<Item> {
Expand All @@ -41,10 +54,14 @@ struct State : public ItemState<Item> {

// _00 = VTBL
// _00-_0C = ItemState
char* mName; // _0C, unused but educated guess
};

struct DamagedState : public State {
// needs an inline ctor probably
inline DamagedState()
: State(DOWNFLOOR_Damaged)
{
}

virtual void init(Item*, StateArg*); // _08
virtual void exec(Item*); // _0C
Expand All @@ -53,23 +70,30 @@ struct DamagedState : public State {
virtual void onPlat(Item*); // _34

// _00 = VTBL
// _00-_0C = State
// _00-_10 = State
bool mIsReady; // _10, set when onKeyEvent is called
};

struct DeadState : public State {
// needs an inline ctor probably
inline DeadState()
: State(DOWNFLOOR_Dead)
{
}

virtual void init(Item*, StateArg*); // _08
virtual void exec(Item*); // _0C
virtual void cleanup(Item*); // _10
virtual void onPlat(Item*); // _34
virtual void init(Item*, StateArg*) { } // _08
virtual void exec(Item*) { } // _0C
virtual void cleanup(Item*) { } // _10
virtual void onPlat(Item*) { } // _34

// _00 = VTBL
// _00-_0C = State
// _00-_10 = State
};

struct DownState : public State {
// needs an inline ctor probably
inline DownState()
: State(DOWNFLOOR_Down)
{
}

virtual void init(Item*, StateArg*); // _08
virtual void exec(Item*); // _0C
Expand All @@ -78,11 +102,14 @@ struct DownState : public State {
virtual void onPlat(Item*); // _34

// _00 = VTBL
// _00-_0C = State
// _00-_10 = State
};

struct UpState : public State {
// needs an inline ctor probably
inline UpState()
: State(DOWNFLOOR_Up)
{
}

virtual void init(Item*, StateArg*); // _08
virtual void exec(Item*); // _0C
Expand All @@ -91,11 +118,14 @@ struct UpState : public State {
virtual void onPlat(Item*); // _34

// _00 = VTBL
// _00-_0C = State
// _00-_10 = State
};

struct WaitState : public State {
// needs an inline ctor probably
inline WaitState()
: State(DOWNFLOOR_Wait)
{
}

virtual void init(Item*, StateArg*); // _08
virtual void exec(Item*); // _0C
Expand All @@ -104,27 +134,27 @@ struct WaitState : public State {
virtual void onPlat(Item*); // _34

// _00 = VTBL
// _00-_0C = State
// _00-_10 = State
};

struct Item : public FSMItem<Item, FSM, State>, CarryInfoOwner {
Item(); // unused/inlined

virtual void constructor(); // _2C
virtual void onInit(CreatureInitArg*); // _30
virtual f32 getFaceDir(); // _64 (weak)
virtual void doSave(Stream& stream); // _E0
virtual void doLoad(Stream& stream); // _E4
virtual void platCallback(PlatEvent& event); // _F0
virtual char* getCreatureName(); // _1A8 (weak)
virtual void initDependency(); // _1BC
virtual void makeTrMatrix(); // _1C4 (weak)
virtual void doAI(); // _1C8
virtual void changeMaterial(); // _1D0
virtual void updateBoundSphere(); // _210
virtual void onSetPosition(); // _21C
virtual void onKeyEvent(const SysShape::KeyEvent& event); // _220 (weak)
virtual void getCarryInfoParam(CarryInfoParam&); // _230 (weak)
virtual void getCarryInfoParam(CarryInfoParam&); // _230
virtual void makeTrMatrix() { } // _1C4 (weak)
virtual f32 getFaceDir() { return mFaceDir; } // _64 (weak)
virtual char* getCreatureName() { return "Downfloor"; } // _1A8 (weak)

void startDamageMotion();
void startDownMotion();
Expand All @@ -136,45 +166,44 @@ struct Item : public FSMItem<Item, FSM, State>, CarryInfoOwner {
// _00 = VTBL
// _00-_1E0 = FSMItem
// _1E0-_1E4 = CarryInfoOwner
PlatInstance* mPlatInstance; // _1E4
int _1E8; // _1E8
int _1EC; // _1EC
int _1F0; // _1F0
BaseItem* _1F4; // _1F4
CarryInfoMgr* mCarryInfoMgr; // _1F8
bool mIsPressed; // _1FC
f32 mFaceDir; // _200
u16 _204; // _204, maybe down floor type?
TSoundEvent mSoundEvent; // _208
WayPoint* mWayPoint; // _214
Item* mOtherSeesaw; // _218
ID32 _21C; // _21C
bool mIsSeesawBlock; // _228
bool mIsPaperBag; // _229
PlatInstance* mPlatInstance; // _1E4
int mBagMaxWeight; // _1E8, weight required to crush bag
int mWeightBuffer; // _1EC, weight during state changes
int mCurrentWeight; // _1F0, current weight on block/bag
Creature* mCurrentOccupant; // _1F4, latest creature to land on bag/block
CarryInfoList* mCarryInfoList; // _1F8
bool mIsPressed; // _1FC
f32 mFaceDir; // _200
u16 mModelType; // _204, 0 = small seesaw, 1 = large seesaw, 2 = bag
TSoundEvent mSoundEvent; // _208
WayPoint* mWayPoint; // _214
Item* mOtherSeesaw; // _218
ID32 mID; // _21C
u8 mDownFloorType; // _228, 0 = bag, 1 or 2 = seesaw (1 = down initially, 2 = up initially)
bool mIsDemoBlock; // _229, only ever set to true by RoomMapMgr::placeObjects
};

struct Mgr : public TNodeItemMgr {
Mgr();

virtual void onLoadResources(); // _48
virtual u32 generatorGetID(); // _58 (weak)
virtual BaseItem* generatorBirth(Vector3f&, Vector3f&, GenItemParm*); // _5C
virtual void generatorWrite(Stream&, GenItemParm*); // _60
virtual void generatorRead(Stream&, GenItemParm*, unsigned long); // _64
virtual u32 generatorLocalVersion(); // _68 (weak)
virtual void generatorRead(Stream&, GenItemParm*, u32); // _64
virtual GenItemParm* generatorNewItemParm(); // _70
virtual BaseItem* doNew(); // _A0 (weak)
virtual ~Mgr(); // _B8 (weak)
virtual char* getCaveName(int); // _BC
virtual int getCaveID(char*); // _C0
virtual BaseItem* doNew() { return new Item; } // _A0 (weak)
virtual u32 generatorGetID() { return 'dwfl'; } // _58 (weak)
virtual u32 generatorLocalVersion() { return '0002'; } // _68 (weak)

void setupDownFloor(Item*);
void setupPlatform(Item*);
BaseItem* birth();

// _00 = VTBL
// _00-_88 = TNodeItemMgr
Platform** mPlatforms; // _88, might be array of platforms instead?
Platform** mPlatforms; // _88
};

extern Mgr* mgr;
Expand All @@ -183,11 +212,18 @@ extern Mgr* mgr;
} // namespace Game

struct GenDownFloorParm : public Game::GenItemParm {
inline GenDownFloorParm()
{
mBagWeight = 10;
mModelType = DFMODEL_SmallBlock;
mDownFloorType = DFTYPE_PaperBag;
mId.setID('none');
}

// _00 = VTBL
s16 _04; // _04
s16 mDownFloorType; // _06
u16 _08; // _08
s16 mBagWeight; // _04
u16 mModelType; // _06
s16 mDownFloorType; // _08
ID32 mId; // _0C
};

Expand Down
2 changes: 1 addition & 1 deletion include/Game/PlatInstance.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ struct PlatEvent {
f32 _04; // _04
f32 _08; // _08
f32 _0C; // _0C
BaseItem* mItem; // _10
Creature* mObj; // _10
};

extern PlatMgr* platMgr;
Expand Down
Loading

0 comments on commit 5edcb8a

Please sign in to comment.