diff --git a/include/Boss.h b/include/Boss.h index e6b108e6..6349d7e4 100644 --- a/include/Boss.h +++ b/include/Boss.h @@ -111,7 +111,7 @@ struct Boss : public Creature { Boss(CreatureProp*); virtual void getCentre(); // _58 - virtual void getShadowSize(); // _70 + virtual f32 getShadowSize(); // _70 virtual bool isVisible(); // _74 virtual bool isOrganic(); // _78 virtual bool isAtari(); // _84 diff --git a/include/Creature.h b/include/Creature.h index 5c8f2616..905554f1 100644 --- a/include/Creature.h +++ b/include/Creature.h @@ -6,6 +6,7 @@ #include "FastGrid.h" #include "ObjType.h" #include "RefCountable.h" +#include "Vector.h" struct CollInfo; struct CollTriInfo; @@ -61,9 +62,9 @@ struct Creature : public RefCountable, public EventTalker { virtual void initParam(int); // _30 (weak) virtual void startAI(int); // _34 (weak) virtual f32 getiMass(); // _38 (weak) - virtual void getSize(); // _3C (weak) - virtual void getHeight(); // _40 (weak) - virtual void getCylinderHeight(); // _44 (weak) + virtual f32 getSize(); // _3C (weak) + virtual f32 getHeight(); // _40 (weak) + virtual f32 getCylinderHeight(); // _44 (weak) virtual void doStore(CreatureInf*); // _48 (weak) virtual void doRestore(CreatureInf*); // _4C (weak) virtual void doSave(struct RandomAccessStream&); // _50 (weak) @@ -72,9 +73,9 @@ struct Creature : public RefCountable, public EventTalker { virtual f32 getCentreSize(); // _5C virtual void getBoundingSphereCentre(); // _60 virtual void getBoundingSphereRadius(); // _64 - virtual void getShadowPos(); // _68 (weak) + virtual Vector3f getShadowPos(); // _68 (weak) virtual void setCentre(Vector3f&); // _6C (weak) - virtual void getShadowSize(); // _70 + virtual f32 getShadowSize(); // _70 virtual bool isVisible() { return true; } // _74 virtual bool isOrganic(); // _78 (weak) virtual bool isTerrible(); // _7C @@ -186,7 +187,8 @@ struct Creature : public RefCountable, public EventTalker { FastGrid mGrid; // _40 u8 _58[0x6C - 0x58]; // _58, TODO: work out members EObjType mObjType; // _6C, object type - u8 _70[0xA0 - 0x70]; // _70, TODO: work out members + u8 _70[0x94 - 0x70]; // _70, TODO: work out members + Vector3f mPosition; // _94 f32 mDirection; // _A0 u8 _A4[0xC8 - 0xA4]; // _A4, TODO: work out members u32 mCreatureFlags; // _C8, bitflag diff --git a/include/Demo.h b/include/Demo.h new file mode 100644 index 00000000..3749eb0c --- /dev/null +++ b/include/Demo.h @@ -0,0 +1,78 @@ +#ifndef _DEMO_H +#define _DEMO_H + +#include "types.h" +#include "Node.h" + +struct Creature; + +/** + * @brief TODO + */ +struct DemoParms : public Node { + + /** + * @brief TODO + */ + struct Parms { + Parms(); + + // TODO: members + }; + + DemoParms(); + + virtual void read(RandomAccessStream&); // _0C + + // _00 = VTBL + // _00-_20 = Node + // TODO: members +}; + +/** + * @brief TODO + */ +struct DemoFlags { + DemoFlags(); + + void initGame(); + void initCourse(); + void update(); + void saveCard(RandomAccessStream&); + void loadCard(RandomAccessStream&); + void registerDemoFlag(int, char*, u16, u16, bool); + bool isFlag(int); + void resetFlag(int); + void setFlag(int, Creature*); + void setFlagOnly(int); + void setTimer(f32, int, Creature*); + void resetTimer(); + void getDemoFlag(int); + + // TODO: members + u16 _00; // _00 + u16 _02; // _02 + u16 _04; // _04 + u8* _08; // _08 + u32* _0C; // _0C + u8 _10[0x4]; // _10, unknown + f32 _14; // _14 + u16 _18; // _18 +}; + +/** + * @brief TODO + */ +struct DemoEventMgr { + DemoEventMgr(); + + void act(int, int); + + // unused/inlined: + void getEventName(int, int); + void getSenderName(int); + + // TODO: members +}; + +#endif diff --git a/include/DynParticle.h b/include/DynParticle.h index c6717116..497613aa 100644 --- a/include/DynParticle.h +++ b/include/DynParticle.h @@ -4,38 +4,35 @@ #include "types.h" #include "CoreNode.h" -/** - * .obj __vt__11DynParticle, global - * .4byte __RTTI__11DynParticle - * .4byte 0 - * .4byte getAgeNodeType__5ANodeFv - * .4byte read__8CoreNodeFR18RandomAccessStream - * .4byte isFree__11DynParticleFv - * .4byte getSize__11DynParticleFv - * .4byte refresh__11DynParticleFR8Graphics - * .4byte doKill__11DynParticleFv - */ - /** * @brief TODO */ struct DynParticle : public CoreNode { + DynParticle(); + virtual bool isFree() { return !-mIsFree; }; // _10 virtual f32 getSize(); // _14 virtual void refresh(struct Graphics&); // _18 virtual void doKill(); // _1C - DynParticle(); - u8 _14[0x48 - 0x14]; - int mIsFree; // _48 - u8 _4C[0x90 - 0x4C]; - f32 _90; // _90 + // _00 = VTBL + // _00-_14 = CoreNode + u8 _14[0x48 - 0x14]; // _14, unknown + int mIsFree; // _48 + u8 _4C[0x90 - 0x4C]; // _4C, unknown + f32 _90; // _90 }; +/** + * @brief TODO + */ struct DynParticleHeap { + DynParticleHeap(int); + void getFreeOne(); void releaseOne(DynParticle*); - DynParticleHeap(int); + + // TODO: members }; #endif diff --git a/include/ItemMgr.h b/include/ItemMgr.h index 2a6106e2..f914d46e 100644 --- a/include/ItemMgr.h +++ b/include/ItemMgr.h @@ -14,7 +14,7 @@ struct ItemCreature : public AICreature { ItemCreature(int, CreatureProp*, Shape*); virtual void init(Vector3f&); // _28 - virtual void getHeight(); // _40 + virtual f32 getHeight(); // _40 virtual void stimulate(Interaction&); // _A0 virtual void update(); // _E0 virtual void refresh(Graphics&); // _EC diff --git a/include/Navi.h b/include/Navi.h index 1f9a50f5..e2281df7 100644 --- a/include/Navi.h +++ b/include/Navi.h @@ -22,8 +22,8 @@ struct Navi : public Creature, public PaniAnimKeyListener, public PelletView { Navi(CreatureProp*, int); virtual f32 getiMass(); // _38 - virtual void getSize(); // _3C - virtual void getShadowSize(); // _70 (weak) + virtual f32 getSize(); // _3C + virtual f32 getShadowSize(); // _70 (weak) virtual bool isVisible(); // _74 virtual bool isBuried(); // _80 virtual bool isAtari(); // _84 diff --git a/include/Piki.h b/include/Piki.h index 4aaa370f..f93dddfc 100644 --- a/include/Piki.h +++ b/include/Piki.h @@ -20,8 +20,8 @@ struct Piki : public Creature, public PaniAnimKeyListener { virtual bool doDoAI(); // _1C virtual void resetPosition(Vector3f&); // _2C virtual f32 getiMass(); // _38 - virtual void getSize(); // _3C - virtual void getShadowPos(); // _68 + virtual f32 getSize(); // _3C + virtual Vector3f getShadowPos(); // _68 virtual bool isVisible(); // _74 virtual bool isBuried(); // _80 virtual bool isAtari(); // _84 diff --git a/include/PlayerState.h b/include/PlayerState.h new file mode 100644 index 00000000..c7a1b33a --- /dev/null +++ b/include/PlayerState.h @@ -0,0 +1,147 @@ +#ifndef _PLAYERSTATE_H +#define _PLAYERSTATE_H + +#include "types.h" +#include "Demo.h" +#include "ResultFlags.h" +#include "PaniAnimator.h" + +struct Graphics; +struct PelletShapeObject; +struct Shape; + +/** + * @brief TODO + */ +struct TimeGraph { + + /** + * @brief TODO + */ + struct PikiNum { + + void set(int, int); + + // TODO: members + }; + + TimeGraph(); // unused/inlined + + // unused/inlined: + void create(u16, u16); + void init(); + void set(u16, int, int); + void get(u16, int); + + // TODO: members +}; + +/** + * @brief TODO + */ +struct PlayerState { + + /** + * @brief TODO + * + * @note Size: 0xE0. + */ + struct UfoParts : public PaniAnimKeyListener { + UfoParts(); + + virtual void animationKeyUpdated(PaniAnimKeyEvent&); // _08 + + void initAnim(PelletShapeObject*); + + // unused/inlined: + void startMotion(int); + void startMotion(int, int); + void stopMotion(); + + // _00 = VTBL? + u8 _04[0xE0 - 0x4]; // _04, unknown + }; + + PlayerState(); + + bool isEnding(); + bool existUfoParts(u32); + void initGame(); + void courseOpen(int); + void happyEndable(); + void setChallengeMode(); + void getPartsGetCount(int); + void getCardUfoPartsCount(); + void getTotalPikiCount(int); + void saveCard(RandomAccessStream&); + void loadCard(RandomAccessStream&); + bool isTutorial(); + bool isGameCourse(); + void checkLimitGenFlag(int); + void setLimitGenFlag(int); + void displayPikiCount(int); + void setDisplayPikiCount(int); + bool hasUfoParts(u32); + void update(); + void initCourse(); + void exitCourse(); + void setNavi(bool); + void getFinalDeadPikis(); + void updateFinalResult(); + int getCurrDay(); + int getTotalDays(); + int getStartHour(); + int getEndHour(); + int getPikiHourCount(int, int); + int getTotalParts(); + int getCurrParts(); + bool isUfoBroken(); + void registerUfoParts(int, u32, u32); + void ufoAssignStart(); + void startSpecialMotions(); + void startAfterMotions(); + void startUfoPartsMotion(u32, int, bool); + void getUfoParts(u32, bool); + void getNextPowerupNumber(); + void preloadHenkaMovie(); + void findUfoParts(u32); + void renderParts(Graphics&, Shape*); + + // unused/inlined: + void setDebugMode(); + void getCardPikiCount(int); + void getUfoPercentage(); + void init(); + void getFinalBornPikis(); + void getRestParts(); + void lostUfoParts(u32); + + static int totalUfoParts; + + // TODO: members + u8 _00[0x54]; // _00, unknown + DemoFlags mDemoFlags; // _54 + ResultFlags mResultFlags; // _70 + u8 _BC[0xC4 - 0xBC]; // _BC, unknown + PaniPikiAnimMgr mPikiAnimMgr; // _C4 + u8 _C8[0x174 - 0xC8]; // _C8, adjust when size of PaniPikiAnimMgr is known + int mTotalParts; // _174 + UfoParts* mUfoParts; // _178 + int mCurrParts; // _17C + u32 _180; // _180, unknown + u8 _184; // _184 + u8 _185; // _185 + u8 _186; // _186 + u8 _187; // _187 + u8 _188; // _188 + u8 _189; // _189 + u8 _18A; // _18A + u8 _18B; // _18B + u8 _18C[0x1C0 - 0x18C]; // _18C, unknown + Vector3f _1C0; // _1C0 +}; + +extern bool preloadUFO; +extern PlayerState* playerState; + +#endif diff --git a/include/RadarInfo.h b/include/RadarInfo.h new file mode 100644 index 00000000..eb2c73dd --- /dev/null +++ b/include/RadarInfo.h @@ -0,0 +1,44 @@ +#ifndef _RADARINFO_H +#define _RADARINFO_H + +#include "types.h" +#include "CoreNode.h" + +struct Creature; +struct Vector3f; + +/** + * @brief TODO + */ +struct RadarInfo { + + /** + * @brief TODO + * + * @note Size: 0x18. + */ + struct PartsInfo : public CoreNode { + PartsInfo() + : mPart(nullptr) + { + } + + Vector3f getPos(); + + // _00 = VTBL + // _00-_14 = CoreNode + Creature* mPart; // _14 + }; + + RadarInfo(); + + void attachParts(Creature*); + void detachParts(Creature*); + + PartsInfo mAlivePartsList; // _00 + PartsInfo mDeadPartsList; // _18 +}; + +extern RadarInfo* radarInfo; + +#endif diff --git a/unsorted_include_todo/ResultFlags.h b/include/ResultFlags.h similarity index 50% rename from unsorted_include_todo/ResultFlags.h rename to include/ResultFlags.h index 7c429a71..9a3d7b04 100644 --- a/unsorted_include_todo/ResultFlags.h +++ b/include/ResultFlags.h @@ -1,11 +1,29 @@ #ifndef _RESULTFLAGS_H #define _RESULTFLAGS_H -/* +#include "types.h" + +struct RandomAccessStream; +struct Creature; + +/** * @brief TODO */ struct ResultFlags { + + /** + * @brief TODO + */ + struct FlagInfo { + + // unused/inlined: + void type(); + + // TODO: members + }; + ResultFlags(); + void initGame(); void saveCard(RandomAccessStream&); void loadCard(RandomAccessStream&); @@ -15,7 +33,14 @@ struct ResultFlags { void getDocument(int&); void dump(); void getFlag(int); - void setFlag(int, unsigned char); + void setFlag(int, u8); + + u16 _00; // _00 + u16 _02; // _02 + u16 _04; // _04 + u8* _08; // _08 + s16 _0C[30]; // _0C + u32* _48; // _48 }; #endif diff --git a/include/Slime.h b/include/Slime.h index bf3c7e0e..0a8fc061 100644 --- a/include/Slime.h +++ b/include/Slime.h @@ -92,7 +92,7 @@ struct SlimeCreature : public Creature { SlimeCreature(CreatureProp*); virtual f32 getiMass(); // _38 - virtual void getSize(); // _3C + virtual f32 getSize(); // _3C virtual void getCentre(); // _58 virtual void setCentre(Vector3f&); // _6C virtual bool isAtari(); // _84 diff --git a/include/UtilityKando.h b/include/UtilityKando.h new file mode 100644 index 00000000..def8a0dc --- /dev/null +++ b/include/UtilityKando.h @@ -0,0 +1,59 @@ +#ifndef _UTILITYKANDO_H +#define _UTILITYKANDO_H + +#include "types.h" + +struct Graphics; +struct RandomAccessStream; +struct Vector3f; + +/** + * @brief TODO + */ +struct Choice { + // TODO: members +}; + +/** + * @brief TODO + */ +struct BitFlags { + BitFlags(); + + void dump(); + void loadCard(RandomAccessStream&); + void saveCard(RandomAccessStream&); + void create(u16, u8*); + void reset(); + void setFlag(u16); + bool isFlag(u16); + + // unused/inlined: + void resetFlag(u16); + + u8* _00; // _00 + u16 _04; // _04 + u16 _06; // _06 +}; + +/** + * @brief TODO + */ +struct LoopChecker { + LoopChecker(char*, f32); + + void update(); + + f32 _00; // _00 + char* _04; // _04 +}; + +// utility functions +void selectRandomly(Choice*, int); +void drawBatten(Graphics&, Vector3f&, f32); +void drawBattenPole(Graphics&, Vector3f&, f32, char*); +void drawArrow(Graphics&, Vector3f&, Vector3f&, f32); +void CRSplineDraw(Graphics&, int, Vector3f*); +void drawCube(Graphics&, Vector3f&, f32); + +#endif diff --git a/include/teki.h b/include/teki.h index 1e6ab6ae..f831b0b5 100644 --- a/include/teki.h +++ b/include/teki.h @@ -52,7 +52,7 @@ struct BTeki : public Creature, public PelletView, virtual public PaniAnimKeyLis virtual f32 getiMass(); // _38 virtual void doStore(CreatureInf*); // _48 virtual void doRestore(CreatureInf*); // _4C - virtual void getShadowSize(); // _70 + virtual f32 getShadowSize(); // _70 virtual bool isVisible(); // _74 virtual bool isOrganic(); // _78 virtual bool isAtari(); // _84 diff --git a/src/plugPikiKando/creature.cpp b/src/plugPikiKando/creature.cpp index 3c4805da..76011e61 100644 --- a/src/plugPikiKando/creature.cpp +++ b/src/plugPikiKando/creature.cpp @@ -3018,7 +3018,7 @@ bool Creature::needShadow() { return true; } * Address: 8008C3CC * Size: 000040 */ -void Creature::getShadowSize() +f32 Creature::getShadowSize() { /* .loc_0x0: diff --git a/src/plugPikiKando/demoEvent.cpp b/src/plugPikiKando/demoEvent.cpp index 30a347bf..72b850a0 100644 --- a/src/plugPikiKando/demoEvent.cpp +++ b/src/plugPikiKando/demoEvent.cpp @@ -1,4 +1,4 @@ -#include "types.h" +#include "Demo.h" /* * --INFO-- diff --git a/src/plugPikiKando/demoInvoker.cpp b/src/plugPikiKando/demoInvoker.cpp index 9c1a3c2a..1488daf9 100644 --- a/src/plugPikiKando/demoInvoker.cpp +++ b/src/plugPikiKando/demoInvoker.cpp @@ -1,4 +1,5 @@ -#include "types.h" +#include "Navi.h" +#include "Piki.h" /* * --INFO-- diff --git a/src/plugPikiKando/gameDemo.cpp b/src/plugPikiKando/gameDemo.cpp index 977a0168..fd150379 100644 --- a/src/plugPikiKando/gameDemo.cpp +++ b/src/plugPikiKando/gameDemo.cpp @@ -1,4 +1,4 @@ -#include "types.h" +#include "Demo.h" /* * --INFO-- @@ -716,7 +716,7 @@ void DemoFlags::registerDemoFlag(int, char*, u16, u16, bool) * Address: 800824C4 * Size: 000030 */ -void DemoFlags::isFlag(int) +bool DemoFlags::isFlag(int) { /* .loc_0x0: diff --git a/src/plugPikiKando/interactPullout.cpp b/src/plugPikiKando/interactPullout.cpp index 0ecd47ef..43d6fd7b 100644 --- a/src/plugPikiKando/interactPullout.cpp +++ b/src/plugPikiKando/interactPullout.cpp @@ -1,4 +1,4 @@ -#include "types.h" +#include "Interactions.h" /* * --INFO-- @@ -25,14 +25,14 @@ static void _Print(char*, ...) * Address: 8007CB38 * Size: 000008 */ -u32 InteractPullout::actCommon(Creature*) { return 0x1; } +bool InteractPullout::actCommon(Creature*) { return true; } /* * --INFO-- * Address: 8007CB40 * Size: 0002BC */ -void InteractPullout::actPiki(Piki*) +bool InteractPullout::actPiki(Piki*) { /* .loc_0x0: diff --git a/src/plugPikiKando/playerState.cpp b/src/plugPikiKando/playerState.cpp index 68907be3..9cf0dbee 100644 --- a/src/plugPikiKando/playerState.cpp +++ b/src/plugPikiKando/playerState.cpp @@ -1,10 +1,10 @@ -#include "types.h" +#include "PlayerState.h" +#include "sysNew.h" -class PlayerState { - int getCurrDay(); - int getCurrParts(); - bool isEnding(); -}; +int PlayerState::totalUfoParts = 30; + +bool preloadUFO = false; +PlayerState* playerState; /* * --INFO-- @@ -84,24 +84,16 @@ void TimeGraph::get(u16, int) bool PlayerState::isEnding() { - // fully matches - { - int game_stat; - bool is_ending; - - game_stat = PlayerState::getCurrDay(); - if (game_stat >= 29) { - is_ending = true; - } else { - game_stat = PlayerState::getCurrParts(); - if (game_stat >= 30) { - is_ending = true; - } else { - is_ending = false; - } - } - return is_ending; + if (getCurrDay() >= 29) { + // we've hit our 30-day limit + return true; + + } else if (getCurrParts() >= 30) { + // we've collected every part + return true; } + + return false; } /* @@ -109,8 +101,9 @@ bool PlayerState::isEnding() * Address: 8007F410 * Size: 00019C */ -void PlayerState::existUfoParts(u32) +bool PlayerState::existUfoParts(u32) { + return false; /* .loc_0x0: mflr r0 @@ -391,6 +384,8 @@ void PlayerState::initGame() */ PlayerState::PlayerState() { + mTotalParts = totalUfoParts; + mUfoParts = new UfoParts[mTotalParts]; /* .loc_0x0: mflr r0 @@ -1448,8 +1443,9 @@ void PlayerState::loadCard(RandomAccessStream&) * Address: 80080474 * Size: 000044 */ -void PlayerState::isTutorial() +bool PlayerState::isTutorial() { + return false; /* .loc_0x0: lis r4, 0x803A @@ -1481,8 +1477,9 @@ void PlayerState::isTutorial() * Address: 800804B8 * Size: 00002C */ -void PlayerState::isGameCourse() +bool PlayerState::isGameCourse() { + return false; /* .loc_0x0: lis r3, 0x803A @@ -1644,8 +1641,9 @@ void PlayerState::init() * Address: 80080604 * Size: 00005C */ -void PlayerState::hasUfoParts(u32) +bool PlayerState::hasUfoParts(u32) { + return false; /* .loc_0x0: lwz r0, 0x174(r3) @@ -2145,8 +2143,9 @@ void PlayerState::updateFinalResult() * Address: 80080BB0 * Size: 000014 */ -s32 PlayerState::getCurrDay() +int PlayerState::getCurrDay() { + return 0; /* .loc_0x0: lis r3, 0x803A @@ -2162,15 +2161,16 @@ s32 PlayerState::getCurrDay() * Address: 80080BC4 * Size: 000008 */ -s32 PlayerState::getTotalDays() { return 30; } +int PlayerState::getTotalDays() { return 30; } /* * --INFO-- * Address: 80080BCC * Size: 000028 */ -void PlayerState::getStartHour() +int PlayerState::getStartHour() { + return 0; /* .loc_0x0: lis r3, 0x803A @@ -2191,8 +2191,9 @@ void PlayerState::getStartHour() * Address: 80080BF4 * Size: 000028 */ -void PlayerState::getEndHour() +int PlayerState::getEndHour() { + return 0; /* .loc_0x0: lis r3, 0x803A @@ -2213,8 +2214,9 @@ void PlayerState::getEndHour() * Address: 80080C1C * Size: 00004C */ -void PlayerState::getPikiHourCount(int, int) +int PlayerState::getPikiHourCount(int, int) { + return 0; /* .loc_0x0: lhz r6, 0x18C(r3) @@ -2246,8 +2248,9 @@ void PlayerState::getPikiHourCount(int, int) * Address: 80080C68 * Size: 000008 */ -void PlayerState::getTotalParts() +int PlayerState::getTotalParts() { + return 0; /* .loc_0x0: lwz r3, 0x174(r3) @@ -2260,8 +2263,9 @@ void PlayerState::getTotalParts() * Address: 80080C70 * Size: 000008 */ -void PlayerState::getCurrParts() +int PlayerState::getCurrParts() { + return 0; /* .loc_0x0: lwz r3, 0x17C(r3) @@ -2284,8 +2288,9 @@ void PlayerState::getRestParts() * Address: 80080C78 * Size: 000050 */ -void PlayerState::isUfoBroken() +bool PlayerState::isUfoBroken() { + return false; /* .loc_0x0: lbz r0, 0x1B6(r3) diff --git a/src/plugPikiKando/radarInfo.cpp b/src/plugPikiKando/radarInfo.cpp index 2f372db2..ccfa4ead 100644 --- a/src/plugPikiKando/radarInfo.cpp +++ b/src/plugPikiKando/radarInfo.cpp @@ -1,12 +1,19 @@ -#include "types.h" +#include "RadarInfo.h" +#include "Dolphin/os.h" +#include "sysNew.h" +#include "Creature.h" +#include "Vector.h" + +RadarInfo* radarInfo; /* * --INFO-- * Address: ........ * Size: 00009C */ -static void _Error(char*, ...) +static void _Error(char* fmt, ...) { + OSPanic(__FILE__, __LINE__, fmt, "radarInfo"); // UNUSED FUNCTION } @@ -27,59 +34,8 @@ static void _Print(char*, ...) */ RadarInfo::RadarInfo() { - /* - .loc_0x0: - mflr r0 - lis r4, 0x8022 - stw r0, 0x4(r1) - stwu r1, -0x28(r1) - stmw r26, 0x10(r1) - addi r26, r3, 0 - addi r27, r4, 0x738C - lis r3, 0x8022 - addi r28, r3, 0x737C - lis r3, 0x802B - subi r30, r3, 0x33DC - li r29, 0 - addi r3, r26, 0 - stw r27, 0x0(r26) - mr r4, r30 - stw r28, 0x0(r26) - stw r29, 0x10(r26) - stw r29, 0xC(r26) - stw r29, 0x8(r26) - bl -0x566DC - lis r3, 0x802B - subi r31, r3, 0x3398 - stw r31, 0x0(r26) - mr r4, r30 - addi r3, r26, 0x18 - stw r29, 0x14(r26) - stw r27, 0x18(r26) - stw r28, 0x18(r26) - stw r29, 0x28(r26) - stw r29, 0x24(r26) - stw r29, 0x20(r26) - bl -0x5670C - stw r31, 0x18(r26) - subi r4, r13, 0x6430 - subi r0, r13, 0x6428 - stw r29, 0x2C(r26) - mr r3, r26 - stw r29, 0x10(r26) - stw r29, 0xC(r26) - stw r29, 0x8(r26) - stw r4, 0x4(r26) - stw r29, 0x28(r26) - stw r29, 0x24(r26) - stw r29, 0x20(r26) - stw r0, 0x1C(r26) - lwz r0, 0x2C(r1) - lmw r26, 0x10(r1) - addi r1, r1, 0x28 - mtlr r0 - blr - */ + mAlivePartsList.initCore("alive"); + mDeadPartsList.initCore("dead "); } /* @@ -87,8 +43,28 @@ RadarInfo::RadarInfo() * Address: 8007B62C * Size: 0000E8 */ -void RadarInfo::attachParts(Creature*) +void RadarInfo::attachParts(Creature* part) { + // check if part is already alive/attached + FOREACH_NODE(PartsInfo, mAlivePartsList.mChild, aliveInfo) + { + if (aliveInfo->mPart == part) { + // part is already attached, do nothing + return; + } + } + + // take next part from detached list if there is one, otherwise make a new one + PartsInfo* newInfo; + if (mDeadPartsList.mChild) { + newInfo = static_cast(mDeadPartsList.mChild); + newInfo->del(); + } else { + PartsInfo* newInfo = new PartsInfo(); + } + + mAlivePartsList.add(newInfo); + newInfo->mPart = part; /* .loc_0x0: mflr r0 @@ -167,47 +143,18 @@ void RadarInfo::attachParts(Creature*) * Address: 8007B714 * Size: 000070 */ -void RadarInfo::detachParts(Creature*) +void RadarInfo::detachParts(Creature* part) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - mr r30, r3 - lwz r31, 0x10(r3) - b .loc_0x50 - - .loc_0x20: - lwz r0, 0x14(r31) - cmplw r0, r4 - bne- .loc_0x4C - mr r3, r31 - bl -0x3B134 - addi r3, r30, 0x18 - addi r4, r31, 0 - bl -0x3B178 - li r0, 0 - stw r0, 0x14(r31) - b .loc_0x58 - - .loc_0x4C: - lwz r31, 0xC(r31) - - .loc_0x50: - cmplwi r31, 0 - bne+ .loc_0x20 - - .loc_0x58: - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + // find part and detach it + FOREACH_NODE(PartsInfo, mAlivePartsList.mChild, aliveInfo) + { + if (aliveInfo->mPart == part) { + aliveInfo->del(); + mDeadPartsList.add(aliveInfo); + aliveInfo->mPart = nullptr; + return; + } + } } /* @@ -215,28 +162,12 @@ void RadarInfo::detachParts(Creature*) * Address: 8007B784 * Size: 000044 */ -void RadarInfo::PartsInfo::getPos() +Vector3f RadarInfo::PartsInfo::getPos() { - /* - .loc_0x0: - lwz r4, 0x14(r4) - cmplwi r4, 0 - beq- .loc_0x28 - lfsu f0, 0x94(r4) - stfs f0, 0x0(r3) - lfs f0, 0x4(r4) - stfs f0, 0x4(r3) - lfs f0, 0x8(r4) - stfs f0, 0x8(r3) - blr + if (mPart) { + return mPart->mPosition; + } - .loc_0x28: - lfs f1, -0x641C(r13) - lfs f2, -0x6418(r13) - lfs f0, -0x6420(r13) - stfs f0, 0x0(r3) - stfs f1, 0x4(r3) - stfs f2, 0x8(r3) - blr - */ + Vector3f vec(0.0f, 0.0f, 0.0f); // this is necessary unfortunately + return vec; } diff --git a/src/plugPikiKando/resultFlag.cpp b/src/plugPikiKando/resultFlag.cpp index ebe7e7e2..25fc9fd7 100644 --- a/src/plugPikiKando/resultFlag.cpp +++ b/src/plugPikiKando/resultFlag.cpp @@ -1,4 +1,4 @@ -#include "types.h" +#include "ResultFlags.h" /* * --INFO-- diff --git a/src/plugPikiKando/simpleAI.cpp b/src/plugPikiKando/simpleAI.cpp index c04017eb..66ca5b68 100644 --- a/src/plugPikiKando/simpleAI.cpp +++ b/src/plugPikiKando/simpleAI.cpp @@ -1081,6 +1081,7 @@ void Creature::startAI(int) { } */ f32 Creature::getiMass() { + return 0.0f; /* .loc_0x0: lfs f1, -0x7688(r2) @@ -1093,7 +1094,7 @@ f32 Creature::getiMass() * Address: 8007DD40 * Size: 000008 */ -void Creature::getSize() +f32 Creature::getSize() { /* .loc_0x0: @@ -1107,7 +1108,7 @@ void Creature::getSize() * Address: 8007DD48 * Size: 000008 */ -void Creature::getHeight() +f32 Creature::getHeight() { /* .loc_0x0: @@ -1121,7 +1122,7 @@ void Creature::getHeight() * Address: 8007DD50 * Size: 000008 */ -void Creature::getCylinderHeight() +f32 Creature::getCylinderHeight() { /* .loc_0x0: @@ -1163,7 +1164,7 @@ void Creature::doLoad(RandomAccessStream&) { } * Address: 8007DD68 * Size: 00001C */ -void Creature::getShadowPos() +Vector3f Creature::getShadowPos() { /* .loc_0x0: @@ -1210,13 +1211,6 @@ bool Creature::isOrganic() { return true; } */ bool Creature::isBuried() { return false; } -/* - * --INFO-- - * Address: 8007DDB0 - * Size: 000008 - */ -bool Creature::isAtari() { return true; } - /* * --INFO-- * Address: 8007DDB8 diff --git a/src/plugPikiKando/utkando.cpp b/src/plugPikiKando/utkando.cpp index 5d89b37d..7d95ae65 100644 --- a/src/plugPikiKando/utkando.cpp +++ b/src/plugPikiKando/utkando.cpp @@ -1,4 +1,4 @@ -#include "types.h" +#include "UtilityKando.h" /* * --INFO-- @@ -330,7 +330,7 @@ void BitFlags::resetFlag(u16) * Address: 801163B4 * Size: 000038 */ -void BitFlags::isFlag(u16) +bool BitFlags::isFlag(u16) { /* .loc_0x0: diff --git a/unsorted_include_todo/DemoEventMgr.h b/unsorted_include_todo/DemoEventMgr.h deleted file mode 100644 index 4d1012e3..00000000 --- a/unsorted_include_todo/DemoEventMgr.h +++ /dev/null @@ -1,12 +0,0 @@ -#ifndef _DEMOEVENTMGR_H -#define _DEMOEVENTMGR_H - -/* - * @brief TODO - */ -struct DemoEventMgr { - DemoEventMgr(); - void act(int, int); -}; - -#endif diff --git a/unsorted_include_todo/DemoFlags.h b/unsorted_include_todo/DemoFlags.h deleted file mode 100644 index 7cd3e7fb..00000000 --- a/unsorted_include_todo/DemoFlags.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _DEMOFLAGS_H -#define _DEMOFLAGS_H - -/* - * @brief TODO - */ -struct DemoFlags { - DemoFlags(); -}; - -#endif diff --git a/unsorted_include_todo/DemoParms.h b/unsorted_include_todo/DemoParms.h deleted file mode 100644 index 82b6abe1..00000000 --- a/unsorted_include_todo/DemoParms.h +++ /dev/null @@ -1,44 +0,0 @@ -#ifndef _DEMOPARMS_H -#define _DEMOPARMS_H - -/** - * .obj __vt__9DemoParms, weak - * .4byte __RTTI__9DemoParms - * .4byte 0 - * .4byte getAgeNodeType__5ANodeFv - * .4byte read__9DemoParmsFR18RandomAccessStream - * .4byte update__4NodeFv - * .4byte draw__4NodeFR8Graphics - * .4byte render__4NodeFR8Graphics - * .4byte concat__4NodeFv - * .4byte concat__4NodeFR3VQS - * .4byte concat__4NodeFR3SRT - * .4byte concat__4NodeFR8Matrix4f - * .4byte getModelMatrix__4NodeFv - */ - -struct ANode { - virtual void getAgeNodeType(); // _08 (weak) -}; - -struct Node { - virtual void _08() = 0; // _08 - virtual void read(RandomAccessStream&); // _0C - virtual void update(); // _10 - virtual void draw(Graphics&); // _14 - virtual void render(Graphics&); // _18 - virtual void concat(); // _1C (weak) - virtual void concat(VQS&); // _20 (weak) - virtual void concat(SRT&); // _24 (weak) - virtual void concat(Matrix4f&); // _28 (weak) - virtual void getModelMatrix(); // _2C (weak) -}; - -/** - * @brief TODO - */ -struct DemoParms : public ANode, public Node { - virtual void read(RandomAccessStream&); // _0C -}; - -#endif diff --git a/unsorted_include_todo/PlayerState.h b/unsorted_include_todo/PlayerState.h deleted file mode 100644 index bdcdee85..00000000 --- a/unsorted_include_todo/PlayerState.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef _PLAYERSTATE_H -#define _PLAYERSTATE_H - -/* - * @brief TODO - */ -struct PlayerState { - void isEnding(); -}; - -#endif diff --git a/unsorted_include_todo/PlayerState/UfoParts.h b/unsorted_include_todo/PlayerState/UfoParts.h deleted file mode 100644 index b3cb583b..00000000 --- a/unsorted_include_todo/PlayerState/UfoParts.h +++ /dev/null @@ -1,20 +0,0 @@ -#ifndef _PLAYERSTATE_UFOPARTS_H -#define _PLAYERSTATE_UFOPARTS_H - -/** - * .obj __vt__Q211PlayerState8UfoParts, global - * .4byte __RTTI__Q211PlayerState8UfoParts - * .4byte 0 - * .4byte animationKeyUpdated__Q211PlayerState8UfoPartsFR16PaniAnimKeyEvent - */ - -namespace PlayerState { -/** - * @brief TODO - */ -struct UfoParts { - virtual void animationKeyUpdated(PaniAnimKeyEvent&); // _08 -}; -} // namespace PlayerState - -#endif diff --git a/unsorted_include_todo/RadarInfo.h b/unsorted_include_todo/RadarInfo.h deleted file mode 100644 index c9b89073..00000000 --- a/unsorted_include_todo/RadarInfo.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef _RADARINFO_H -#define _RADARINFO_H - -/* - * @brief TODO - */ -struct RadarInfo { - RadarInfo(); - void attachParts(Creature*); - void detachParts(Creature*); -}; - -#endif diff --git a/unsorted_include_todo/RadarInfo/PartsInfo.h b/unsorted_include_todo/RadarInfo/PartsInfo.h deleted file mode 100644 index 1a846078..00000000 --- a/unsorted_include_todo/RadarInfo/PartsInfo.h +++ /dev/null @@ -1,31 +0,0 @@ -#ifndef _RADARINFO_PARTSINFO_H -#define _RADARINFO_PARTSINFO_H - -/** - * .obj __vt__Q29RadarInfo9PartsInfo, weak - * .4byte __RTTI__Q29RadarInfo9PartsInfo - * .4byte 0 - * .4byte getAgeNodeType__5ANodeFv - * .4byte read__8CoreNodeFR18RandomAccessStream - */ - -struct ANode { - virtual void getAgeNodeType(); // _08 (weak) -}; - -struct CoreNode { - virtual void _08() = 0; // _08 - virtual void read(RandomAccessStream&); // _0C (weak) -}; - -namespace RadarInfo { -/** - * @brief TODO - */ -struct PartsInfo : public ANode, public CoreNode { - - void getPos(); -}; -} // namespace RadarInfo - -#endif