From 4653a4cf21193c756569c8762ccb4d83bee1191c Mon Sep 17 00:00:00 2001 From: Dean Southwood Date: Sat, 2 Nov 2024 01:25:09 +1100 Subject: [PATCH] some initial PikiAI work --- include/Creature.h | 1 + include/Piki.h | 3 +- include/PikiAI.h | 275 ++++-- include/WeedsItem.h | 2 +- src/plugPikiKando/aiAction.cpp | 1484 ++++--------------------------- src/plugPikiKando/aiAttack.cpp | 39 - src/plugPikiKando/aiStone.cpp | 312 +------ src/plugPikiKando/weedsItem.cpp | 2 +- 8 files changed, 445 insertions(+), 1673 deletions(-) diff --git a/include/Creature.h b/include/Creature.h index 4f6afacf..3bb7cb2d 100644 --- a/include/Creature.h +++ b/include/Creature.h @@ -55,6 +55,7 @@ enum CreatureFlags { CF_Unk19 = 1 << 19, // 0x80000, use result flags maybe? CF_Unk20 = 1 << 20, // 0x100000 CF_FixPosition = 1 << 21, // 0x200000 + CF_Unk22 = 1 << 22, // 0x400000 }; /** diff --git a/include/Piki.h b/include/Piki.h index 061607b7..eb525626 100644 --- a/include/Piki.h +++ b/include/Piki.h @@ -154,7 +154,8 @@ struct Piki : public Creature, public PaniAnimKeyListener { // _2B8 = PaniAnimKeyListener u8 _2BC[0x354 - 0x2BC]; // _2BC, TODO: work out members PaniPikiAnimMgr mPikiAnimMgr; // _354 - u8 _400[0x408 - 0x400]; // _400, unknown + u8 _400; // _400 + u8 _401[0x408 - 0x401]; // _401, unknown u8 _408; // _408 u8 _409; // _409 u8 _40A[0x424 - 0x40A]; // _40A, unknown diff --git a/include/PikiAI.h b/include/PikiAI.h index ce969e0d..02e0616c 100644 --- a/include/PikiAI.h +++ b/include/PikiAI.h @@ -6,11 +6,28 @@ #include "Piki.h" #include "Receiver.h" #include "SlotChangeListner.h" +#include "stl/stdio.h" + +struct Pebble; +struct RockGen; namespace zen { struct particleGenerator; } // namespace zen +/** + * @brief TODO + */ +enum ActionResults { + ACTOUT_Unk0 = 0, + ACTOUT_Unk1 = 1, + ACTOUT_Success = 2, +}; + +namespace Reaction { +extern char* info[9]; +} // namespace Reaction + /** * @brief TODO * @@ -21,41 +38,54 @@ struct Action : public Receiver { /** * @brief TODO */ - struct Child { - Child(); - - ~Child(); - - void initialise(Creature*); + struct Initialiser { + virtual void initialise(Action*); // _08 (weak) + // _00 = VTBL // TODO: members - u32 _00; // _00, unknown - u32 _04; // _04, unknown }; /** * @brief TODO */ - struct Initialiser { - virtual void initialise(Action*); // _08 (weak) + struct Child { + Child() + { + mAction = nullptr; + mInitialiser = nullptr; + } + + ~Child() + { + if (mAction) { + delete mAction; + } + + if (mInitialiser) { + delete mInitialiser; + } + } + + void initialise(Creature*); - // _00 = VTBL // TODO: members + Action* mAction; // _00 + Initialiser* mInitialiser; // _04 }; Action(Piki*, bool); - virtual void defaultInitialiser(); // _38 (weak) - virtual void dump(); // _3C (weak) - virtual void draw(struct Graphics&); // _40 (weak) - virtual ~Action(); // _44 - virtual void init(Creature*); // _48 - virtual int exec(); // _4C - virtual void cleanup(); // _50 - virtual void resume(); // _54 (weak) - virtual void restart(); // _58 (weak) - virtual bool resumable(); // _5C (weak) - virtual void getInfo(char*); // _60 (weak) + virtual void defaultInitialiser() { } // _38 (weak) + virtual void dump() { } // _3C (weak) + virtual void draw(struct Graphics&) { } // _40 (weak) + virtual ~Action(); // _44 + virtual void init(Creature*); // _48 + virtual int exec(); // _4C + virtual void cleanup(); // _50 + virtual void resume() { } // _54 (weak) + virtual void restart() { } // _58 (weak) + virtual bool resumable() { return false; } // _5C (weak) + virtual void getInfo(char* out) { sprintf(out, "-"); } // _60 (weak) void procMsg(Msg*); // this isn't overridden in the vtable but it exists, idk. void setChildren(int, ...); @@ -65,9 +95,11 @@ struct Action : public Receiver { inline void initialiseChildAction(Creature* creature) { getChild(mChildActionIdx)->initialise(creature); } // _00 = VTBL - Child* mChildActions; // _04 + Child* mChildActions; // _04, array of mChildCount Children s16 mChildActionIdx; // _08 - u8 _0A[0x14 - 0xA]; // _0A, TODO: work out members + s16 mChildCount; // _0A + Piki* mActor; // _0C + char* mName; // _10 }; /** @@ -79,13 +111,13 @@ struct AndAction : public Action { { } - virtual ~AndAction(); // _44 (weak) + virtual ~AndAction() { } // _44 (weak) virtual void init(Creature*); // _48 virtual int exec(); // _4C // _00 = VTBL // _00-_14 = Action - u32 _14; // _14, unknown + Creature* _14; // _14 }; /** @@ -94,13 +126,13 @@ struct AndAction : public Action { struct OrAction : public Action { inline OrAction(); // TODO: probably - virtual ~OrAction(); // _44 (weak) + virtual ~OrAction() { } // _44 (weak) virtual void init(Creature*); // _48 virtual int exec(); // _4C // _00 = VTBL // _00-_14 = Action - // TODO: members + Creature* _14; // _14 }; /** @@ -110,12 +142,19 @@ struct TopAction : public Action { /** * @brief TODO + * + * @note Size: 0x8. */ struct MotionListener : public PaniAnimKeyListener { + MotionListener(TopAction* action) + : mAction(action) + { + } + virtual void animationKeyUpdated(PaniAnimKeyEvent&); // _08 // _00 = VTBL - // TODO: members + TopAction* mAction; // _04 }; /** @@ -129,8 +168,8 @@ struct TopAction : public Action { void addBoredom(int, f32); void update(); - u32 _00; // _00, unknown (pointer?) - u32 _04; // _04, unknown (pointer?) + u32* _00; // _00, unknown (pointer?) + u32* _04; // _04, unknown (pointer?) u8* _08; // _08, array of size _10, might be bools u32 _0C; // _0C, unknown int mCnt; // _10, count of objects in _00, _04, _08 arrays @@ -150,7 +189,7 @@ struct TopAction : public Action { void draw2d(Graphics&, int); ObjBore* mObjects; // _00, array of mObjectCnt objects - u32 _04; // _04, unknown (pointer?) + u32* _04; // _04, unknown (pointer?) u32 _08; // _08, unknown int mObjectCnt; // _0C, number of mObjects u32 _10; // _10, unknown @@ -158,14 +197,22 @@ struct TopAction : public Action { TopAction(Piki*); - virtual void draw(Graphics&); // _40 + virtual void getInfo(char* out) // _60 + { + mChildActions[mChildActionIdx].mAction->getInfo(out); + } + virtual void draw(Graphics& gfx) // _40 + { + if (_18) { + mChildActions[mChildActionIdx].mAction->draw(gfx); + } + } virtual ~TopAction(); // _44 virtual void init(Creature*); // _48 virtual int exec(); // _4C virtual void resume(); // _54 virtual void restart(); // _58 virtual bool resumable(); // _5C - virtual void getInfo(char*); // _60 void abandon(zen::particleGenerator*); @@ -174,7 +221,16 @@ struct TopAction : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + MotionListener* mListener; // _14 + u8 _18; // _18 + u8 _19; // _19 + u8 _1A; // _1A + int _1C; // _1C + Creature* _20; // _20 + int _24; // _24 + u32 _28; // _28, unknown + f32 _2C; // _2C + Boredom _30; // _30 }; /** @@ -207,6 +263,8 @@ struct ActAdjust : public Action { /** * @brief TODO + * + * @note Size: 0x2C. */ struct ActAttack : public AndAction, public PaniAnimKeyListener { ActAttack(Piki*); @@ -228,11 +286,13 @@ struct ActAttack : public AndAction, public PaniAnimKeyListener { // _00 = VTBL // _00-_18 = AndAction // _18 = PaniAnimKeyListener - // TODO: members + u8 _1C[0x2C - 0x1C]; // _14, unknown }; /** * @brief TODO + * + * @note Size: 0x24. */ struct ActBoMake : public Action { ActBoMake(Piki*); @@ -248,8 +308,9 @@ struct ActBoMake : public Action { void initWork(); int exeWork(); - // _00 = VTBL - // TODO: members + // _00 = VTBL + // _00-_14 = Action + u8 _14[0x24 - 0x14]; // _14, unknown }; /** @@ -354,6 +415,8 @@ struct ActBoreTalk : public Action, public PaniAnimKeyListener { /** * @brief TODO + * + * @note Size: 0x34. */ struct ActBou : public Action { ActBou(Piki*); @@ -369,11 +432,13 @@ struct ActBou : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x34 - 0x14]; // _14, unknown }; /** * @brief TODO + * + * @note Size: 0x34. */ struct ActBreakWall : public Action, public PaniAnimKeyListener { ActBreakWall(Piki*); @@ -393,11 +458,13 @@ struct ActBreakWall : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0x34 - 0x18]; // _18, unknown }; /** * @brief TODO + * + * @note Size: 0x58. */ struct ActBridge : public Action, public PaniAnimKeyListener { ActBridge(Piki*); @@ -435,11 +502,13 @@ struct ActBridge : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0x58 - 0x18]; // _18, unknown }; /** * @brief TODO + * + * @note Size: 0x1C. */ struct ActChase : public Action { @@ -462,11 +531,13 @@ struct ActChase : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x1C - 0x14]; // _14, unknown }; /** * @brief TODO + * + * @note Size: 0x88. */ struct ActCrowd : public Action, public SlotChangeListner { ActCrowd(Piki*); @@ -494,12 +565,14 @@ struct ActCrowd : public Action, public SlotChangeListner { // _00 = VTBL // _00-_14 = Action - // _18 = SlotChangeListner - // TODO: members + // _14 = SlotChangeListner + u8 _18[0x88 - 0x18]; // _18, unknown }; /** * @brief TODO + * + * @note Size: 0x20. */ struct ActDecoy : public Action, public PaniAnimKeyListener { ActDecoy(Piki*); @@ -518,7 +591,7 @@ struct ActDecoy : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0x20 - 0x18]; // _18, unknown }; /** @@ -550,6 +623,8 @@ struct ActDeliver : public AndAction { /** * @brief TODO + * + * @note Size: 0x30. */ struct ActEnter : public Action { ActEnter(Piki*); @@ -569,11 +644,13 @@ struct ActEnter : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x30 - 0x14]; // _14, unknown }; /** * @brief TODO + * + * @note Size: 0x30. */ struct ActEscape : public Action { @@ -597,11 +674,13 @@ struct ActEscape : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x30 - 0x14]; // _14, unknown }; /** * @brief TODO + * + * @note Size: 0x24. */ struct ActExit : public Action { ActExit(Piki*); @@ -614,7 +693,7 @@ struct ActExit : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x24 - 0x14]; // _14, unknown }; /** @@ -637,6 +716,8 @@ struct ActFlower : public Action, public PaniAnimKeyListener { /** * @brief TODO + * + * @note Size: 0x34. */ struct ActFormation : public Action, public PaniAnimKeyListener { ActFormation(Piki*); @@ -652,11 +733,13 @@ struct ActFormation : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0x34 - 0x18]; // _18, unknown }; /** * @brief TODO + * + * @note Size: 0x50. */ struct ActFree : public Action, public PaniAnimKeyListener { ActFree(Piki*); @@ -675,7 +758,7 @@ struct ActFree : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0x50 - 0x18]; // _18 }; /** @@ -700,6 +783,8 @@ struct ActFreeSelect : public Action { /** * @brief TODO + * + * @note Size: 0x24. */ struct ActGoto : public Action { @@ -723,11 +808,13 @@ struct ActGoto : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x24 - 0x14]; // _14, unknown }; /** * @brief TODO + * + * @note Size: 0x4C. */ struct ActGuard : public Action { ActGuard(Piki*); @@ -749,7 +836,7 @@ struct ActGuard : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x4C - 0x14]; // _14, unknown }; /** @@ -782,6 +869,8 @@ struct ActJumpAttack : public Action, public PaniAnimKeyListener { /** * @brief TODO + * + * @note Size: 0x38. */ struct ActKinoko : public Action, public PaniAnimKeyListener { ActKinoko(Piki*); @@ -806,11 +895,13 @@ struct ActKinoko : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0x38 - 0x18]; // _18, unknown }; /** * @brief TODO + * + * @note Size: 0x30. */ struct ActMine : public Action, public PaniAnimKeyListener { ActMine(Piki*); @@ -833,7 +924,7 @@ struct ActMine : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0x30 - 0x18]; // _18, unknown }; /** @@ -867,6 +958,8 @@ struct ActPick : public Action, public PaniAnimKeyListener { /** * @brief TODO + * + * @note Size: 0x1C. */ struct ActPickCreature : public AndAction { @@ -885,11 +978,13 @@ struct ActPickCreature : public AndAction { // _00 = VTBL // _00-_18 = AndAction - // TODO: members + u8 _18[0x1C - 0x18]; // _18, unknown }; /** * @brief TODO + * + * @note Size: 0x1C. */ struct ActPickItem : public AndAction { ActPickItem(Piki*); @@ -903,11 +998,13 @@ struct ActPickItem : public AndAction { // _00 = VTBL // _00-_18 = AndAction - // TODO: members + u8 _18[0x1C - 0x18]; // _18, unknown }; /** * @brief TODO + * + * @note Size: 0x1C. */ struct ActPullout : public Action { ActPullout(Piki*); @@ -919,7 +1016,7 @@ struct ActPullout : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x1C - 0x14]; // _14, unknown }; /** @@ -942,6 +1039,8 @@ struct ActPulloutCreature : public Action, public PaniAnimKeyListener { /** * @brief TODO + * + * @note Size: 0x50. */ struct ActPush : public Action, public PaniAnimKeyListener { ActPush(Piki*); @@ -963,7 +1062,7 @@ struct ActPush : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0x50 - 0x18]; // _18, unknown }; /** @@ -995,6 +1094,8 @@ struct ActPut : public Action { /** * @brief TODO + * + * @note Size: 0x30. */ struct ActPutBomb : public Action, public PaniAnimKeyListener { ActPutBomb(Piki*); @@ -1024,11 +1125,13 @@ struct ActPutBomb : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0x30 - 0x18]; // _18, unknown }; /** * @brief TODO + * + * @note Size: 0x24. */ struct ActPutItem : public Action { ActPutItem(Piki*); @@ -1043,11 +1146,13 @@ struct ActPutItem : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x24 - 0x14]; // _14, unknown }; /** * @brief TODO + * + * @note Size: 0x28. */ struct ActRandomBoid : public Action { @@ -1081,11 +1186,13 @@ struct ActRandomBoid : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x28 - 0x14]; // _14, unknown }; /** * @brief TODO + * + * @note Size: 0x3C. */ struct ActRescue : public Action, public PaniAnimKeyListener { ActRescue(Piki*); @@ -1108,11 +1215,13 @@ struct ActRescue : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0x3C - 0x18]; // _18, unknown }; /** * @brief TODO + * + * @note Size: 0x24. */ struct ActRope : public Action { ActRope(Piki*); @@ -1124,11 +1233,13 @@ struct ActRope : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x24 - 0x14]; // _14, unknown }; /** * @brief TODO + * + * @note Size: 0x28. */ struct ActShoot : public AndAction { ActShoot(Piki*); @@ -1145,7 +1256,7 @@ struct ActShoot : public AndAction { // _00 = VTBL // _00-_18 = AndAction - // TODO: members + u8 _18[0x28 - 0x18]; // _18, unknown }; /** @@ -1168,8 +1279,20 @@ struct ActShootCreature : public Action, public PaniAnimKeyListener { /** * @brief TODO + * + * @note Size: 0x2C. */ struct ActStone : public Action, public PaniAnimKeyListener { + + /** + * @brief TODO + */ + enum State { + STATE_Approach = 0, + STATE_Adjust = 1, + STATE_Attack = 2, + }; + ActStone(Piki*); virtual ~ActStone(); // _44 @@ -1179,20 +1302,26 @@ struct ActStone : public Action, public PaniAnimKeyListener { virtual void animationKeyUpdated(PaniAnimKeyEvent&); // _70 void initApproach(); - void exeApproach(); + int exeApproach(); void initAdjust(); - void exeAdjust(); + int exeAdjust(); void initAttack(); - void exeAttack(); + int exeAttack(); // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u16 mState; // _18 + u8 _1A[0x20 - 0x1A]; // _18, unknown + Pebble* mCurrPebble; // _20, unknown + RockGen* mRockGen; // _24 + u8 _28; // _28 }; /** * @brief TODO + * + * @note Size: 0xC0. */ struct ActTransport : public Action, public PaniAnimKeyListener { ActTransport(Piki*); @@ -1234,11 +1363,13 @@ struct ActTransport : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0xC0 - 0x18]; // _18, unknown }; /** * @brief TODO + * + * @note Size: 0x2C. */ struct ActWatch : public Action { @@ -1272,11 +1403,13 @@ struct ActWatch : public Action { // _00 = VTBL // _00-_14 = Action - // TODO: members + u8 _14[0x2C - 0x14]; // _14, unknown }; /** * @brief TODO + * + * @note Size: 0x2C. */ struct ActWeed : public Action, public PaniAnimKeyListener { ActWeed(Piki*); @@ -1297,7 +1430,7 @@ struct ActWeed : public Action, public PaniAnimKeyListener { // _00 = VTBL // _00-_14 = Action // _14 = PaniAnimKeyListener - // TODO: members + u8 _18[0x2C - 0x18]; // _18, unknown }; /** diff --git a/include/WeedsItem.h b/include/WeedsItem.h index d03e8bee..56bbb229 100644 --- a/include/WeedsItem.h +++ b/include/WeedsItem.h @@ -72,7 +72,7 @@ struct RockGen : public ItemCreature { void create(int, f32, int); void setSizeAndNum(f32, int); void killPebble(); - void getRandomPebble(); + Pebble* getRandomPebble(); // _00 = VTBL // _00-_304 = ItemCreature? diff --git a/src/plugPikiKando/aiAction.cpp b/src/plugPikiKando/aiAction.cpp index 26c536ad..d1bdc13c 100644 --- a/src/plugPikiKando/aiAction.cpp +++ b/src/plugPikiKando/aiAction.cpp @@ -1,12 +1,17 @@ #include "PikiAI.h" +#include "sysNew.h" +#include "Dolphin/os.h" +#include "MemStat.h" +#include "PikiMacros.h" /* * --INFO-- * Address: ........ * Size: 00009C */ -static void _Error(char*, ...) +static void _Error(char* fmt, ...) { + OSPanic(__FILE__, __LINE__, fmt, "aiAction"); // UNUSED FUNCTION } @@ -20,164 +25,31 @@ static void _Print(char*, ...) // UNUSED FUNCTION } +namespace Reaction { +char* info[9] = { + "-", "WATCH", "ESCAPE", "CHASE", "GOTO", "PICK", "PUT", "KICK", "FORMATION", +}; +} + /* * --INFO-- * Address: 800C3AE4 * Size: 000240 */ -void Action::procMsg(Msg*) +void Action::procMsg(Msg* msg) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x28(r1) - stw r31, 0x24(r1) - mr r31, r4 - stw r30, 0x20(r1) - mr r30, r3 - lwz r5, 0xC(r3) - lwz r0, 0xC8(r5) - rlwinm. r0,r0,0,20,20 - bne- .loc_0x228 - lwz r0, 0x0(r31) - cmplwi r0, 0xA - bgt- .loc_0x1AC - lis r3, 0x802B - addi r3, r3, 0x7EFC - rlwinm r0,r0,2,0,29 - lwzx r0, r3, r0 - mtctr r0 - bctr - mr r3, r30 - lwz r12, 0x0(r30) - addi r4, r5, 0 - addi r5, r31, 0 - lwz r12, 0xC(r12) - mtlr r12 - blrl - b .loc_0x1AC - mr r3, r30 - lwz r12, 0x0(r30) - addi r4, r5, 0 - addi r5, r31, 0 - lwz r12, 0x10(r12) - mtlr r12 - blrl - b .loc_0x1AC - mr r3, r30 - lwz r12, 0x0(r30) - addi r4, r5, 0 - addi r5, r31, 0 - lwz r12, 0x14(r12) - mtlr r12 - blrl - b .loc_0x1AC - mr r3, r30 - lwz r12, 0x0(r30) - addi r4, r5, 0 - addi r5, r31, 0 - lwz r12, 0x18(r12) - mtlr r12 - blrl - b .loc_0x1AC - mr r3, r30 - lwz r12, 0x0(r30) - addi r4, r5, 0 - addi r5, r31, 0 - lwz r12, 0x1C(r12) - mtlr r12 - blrl - b .loc_0x1AC - mr r3, r30 - lwz r12, 0x0(r30) - addi r4, r5, 0 - addi r5, r31, 0 - lwz r12, 0x20(r12) - mtlr r12 - blrl - b .loc_0x1AC - mr r3, r30 - lwz r12, 0x0(r30) - addi r4, r5, 0 - addi r5, r31, 0 - lwz r12, 0x24(r12) - mtlr r12 - blrl - b .loc_0x1AC - mr r3, r30 - lwz r12, 0x0(r30) - addi r4, r5, 0 - addi r5, r31, 0 - lwz r12, 0x28(r12) - mtlr r12 - blrl - b .loc_0x1AC - mr r3, r30 - lwz r12, 0x0(r30) - addi r4, r5, 0 - addi r5, r31, 0 - lwz r12, 0x2C(r12) - mtlr r12 - blrl - b .loc_0x1AC - mr r3, r30 - lwz r12, 0x0(r30) - addi r4, r5, 0 - addi r5, r31, 0 - lwz r12, 0x30(r12) - mtlr r12 - blrl - b .loc_0x1AC - mr r3, r30 - lwz r12, 0x0(r30) - addi r4, r5, 0 - addi r5, r31, 0 - lwz r12, 0x34(r12) - mtlr r12 - blrl - - .loc_0x1AC: - lha r4, 0x8(r30) - cmpwi r4, -0x1 - beq- .loc_0x228 - lha r0, 0xA(r30) - cmpw r4, r0 - bge- .loc_0x228 - lwz r3, 0x4(r30) - rlwinm r0,r4,3,0,28 - lwzx r30, r3, r0 - cmplwi r30, 0 - beq- .loc_0x228 - lwz r4, 0xC(r30) - lwz r0, 0xC8(r4) - rlwinm. r0,r0,0,20,20 - bne- .loc_0x228 - addi r3, r30, 0 - addi r5, r31, 0 - bl -0x1C3FC - lha r4, 0x8(r30) - cmpwi r4, -0x1 - beq- .loc_0x228 - lha r0, 0xA(r30) - cmpw r4, r0 - bge- .loc_0x228 - lwz r3, 0x4(r30) - rlwinm r0,r4,3,0,28 - lwzx r3, r3, r0 - cmplwi r3, 0 - beq- .loc_0x228 - mr r4, r31 - bl .loc_0x0 - - .loc_0x228: - lwz r0, 0x2C(r1) - lwz r31, 0x24(r1) - lwz r30, 0x20(r1) - addi r1, r1, 0x28 - mtlr r0 - blr - */ + u32 badCompiler; + if (mActor->isCreatureFlag(CF_Unk12)) { + return; + } + + Receiver::procMsg(mActor, msg); + + if (mChildActionIdx != -1 && mChildActionIdx < mChildCount) { + if (mChildActions[mChildActionIdx].mAction) { + mChildActions[mChildActionIdx].mAction->procMsg(msg); + } + } } /* @@ -185,62 +57,23 @@ void Action::procMsg(Msg*) * Address: 800C3D24 * Size: 0000AC */ -void Action::Child::initialise(Creature*) +void Action::Child::initialise(Creature* creature) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - mr r31, r3 - lwz r3, 0x0(r3) - cmplwi r3, 0 - beq- .loc_0x3C - lwz r3, 0xC(r3) - li r5, 0xA - li r0, 0x2 - stb r5, 0x400(r3) - lwz r3, 0x0(r31) - lwz r3, 0xC(r3) - stb r0, 0x408(r3) + if (mAction) { + mAction->mActor->_400 = 10; + mAction->mActor->_408 = 2; + } - .loc_0x3C: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x58 - lwz r12, 0x0(r3) - lwz r12, 0x48(r12) - mtlr r12 - blrl + if (mAction) { + mAction->init(creature); + } - .loc_0x58: - lwz r3, 0x4(r31) - cmplwi r3, 0 - beq- .loc_0x7C - lwz r12, 0x0(r3) - lwz r4, 0x0(r31) - lwz r12, 0x8(r12) - mtlr r12 - blrl - b .loc_0x98 - - .loc_0x7C: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x98 - lwz r12, 0x0(r3) - lwz r12, 0x38(r12) - mtlr r12 - blrl + if (mInitialiser) { + mInitialiser->initialise(mAction); - .loc_0x98: - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + } else if (mAction) { + mAction->defaultInitialiser(); + } } /* @@ -248,25 +81,12 @@ void Action::Child::initialise(Creature*) * Address: 800C3DD0 * Size: 000038 */ -Action::Action(Piki*, bool) +Action::Action(Piki* actor, bool p2) { - /* - .loc_0x0: - lis r5, 0x802C - subi r0, r5, 0x7E08 - lis r5, 0x802C - stw r0, 0x0(r3) - subi r0, r5, 0x7E6C - stw r0, 0x0(r3) - li r5, 0 - subi r0, r13, 0x4380 - stw r4, 0xC(r3) - stw r5, 0x4(r3) - sth r5, 0xA(r3) - sth r5, 0x8(r3) - stw r0, 0x10(r3) - blr - */ + mActor = actor; + mChildActions = nullptr; + mChildActionIdx = mChildCount = 0; + mName = "no name"; } /* @@ -276,93 +96,10 @@ Action::Action(Piki*, bool) */ Action::~Action() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - addi r31, r4, 0 - stw r30, 0x10(r1) - mr. r30, r3 - beq- .loc_0x5C - lis r3, 0x802C - subi r0, r3, 0x7E6C - stw r0, 0x0(r30) - lwz r3, 0x4(r30) - cmplwi r3, 0 - beq- .loc_0x44 - lis r4, 0x800C - addi r4, r4, 0x3E80 - bl 0x150BAC - - .loc_0x44: - li r3, 0 - extsh. r0, r31 - stw r3, 0x4(r30) - ble- .loc_0x5C - mr r3, r30 - bl -0x7CCB4 - - .loc_0x5C: - mr r3, r30 - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ -} - -/* - * --INFO-- - * Address: 800C3E80 - * Size: 000080 - */ -Action::Child::~Child() -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - addi r31, r4, 0 - stw r30, 0x10(r1) - mr. r30, r3 - beq- .loc_0x64 - lwz r3, 0x0(r30) - cmplwi r3, 0 - beq- .loc_0x44 - beq- .loc_0x44 - lwz r12, 0x0(r3) - li r4, 0x1 - lwz r12, 0x44(r12) - mtlr r12 - blrl - - .loc_0x44: - lwz r3, 0x4(r30) - cmplwi r3, 0 - beq- .loc_0x54 - bl -0x7CD24 - - .loc_0x54: - extsh. r0, r31 - ble- .loc_0x64 - mr r3, r30 - bl -0x7CD34 - - .loc_0x64: - mr r3, r30 - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + if (mChildActions) { + delete[] mChildActions; + } + mChildActions = nullptr; } /* @@ -370,93 +107,25 @@ Action::Child::~Child() * Address: 800C3F00 * Size: 00000C */ -void Action::init(Creature*) -{ - // Generated from sth r0, 0x8(r3) - // _08 = 0; -} +void Action::init(Creature*) { mChildActionIdx = 0; } /* * --INFO-- * Address: 800C3F0C * Size: 000008 */ -int Action::exec() { return 2; } +int Action::exec() { return ACTOUT_Success; } /* * --INFO-- * Address: 800C3F14 * Size: 0000E0 */ -void AndAction::init(Creature*) +void AndAction::init(Creature* creature) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - li r0, 0 - stwu r1, -0x20(r1) - stw r31, 0x1C(r1) - stw r30, 0x18(r1) - mr r30, r4 - stw r29, 0x14(r1) - addi r29, r3, 0 - sth r0, 0x8(r3) - lha r0, 0x8(r3) - lwz r3, 0x4(r3) - rlwinm r0,r0,3,0,28 - add r31, r3, r0 - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x60 - lwz r3, 0xC(r3) - li r4, 0xA - li r0, 0x2 - stb r4, 0x400(r3) - lwz r3, 0x0(r31) - lwz r3, 0xC(r3) - stb r0, 0x408(r3) - - .loc_0x60: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x80 - lwz r12, 0x0(r3) - mr r4, r30 - lwz r12, 0x48(r12) - mtlr r12 - blrl - - .loc_0x80: - lwz r3, 0x4(r31) - cmplwi r3, 0 - beq- .loc_0xA4 - lwz r12, 0x0(r3) - lwz r4, 0x0(r31) - lwz r12, 0x8(r12) - mtlr r12 - blrl - b .loc_0xC0 - - .loc_0xA4: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0xC0 - lwz r12, 0x0(r3) - lwz r12, 0x38(r12) - mtlr r12 - blrl - - .loc_0xC0: - stw r30, 0x14(r29) - lwz r0, 0x24(r1) - lwz r31, 0x1C(r1) - lwz r30, 0x18(r1) - lwz r29, 0x14(r1) - addi r1, r1, 0x20 - mtlr r0 - blr - */ + mChildActionIdx = 0; + mChildActions[mChildActionIdx].initialise(creature); + _14 = creature; } /* @@ -466,108 +135,23 @@ void AndAction::init(Creature*) */ int AndAction::exec() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - mr r31, r3 - lha r0, 0x8(r3) - lwz r3, 0x4(r3) - rlwinm r0,r0,3,0,28 - add r3, r3, r0 - lwz r3, 0x0(r3) - lwz r12, 0x0(r3) - lwz r12, 0x4C(r12) - mtlr r12 - blrl - cmpwi r3, 0x2 - beq- .loc_0x50 - bge- .loc_0x134 - cmpwi r3, 0x1 - bge- .loc_0x12C - b .loc_0x134 - - .loc_0x50: - lha r0, 0x8(r31) - lwz r3, 0x4(r31) - rlwinm r0,r0,3,0,28 - lwzx r3, r3, r0 - lwz r12, 0x0(r3) - lwz r12, 0x50(r12) - mtlr r12 - blrl - lha r3, 0x8(r31) - addi r0, r3, 0x1 - sth r0, 0x8(r31) - lha r4, 0x8(r31) - lha r0, 0xA(r31) - cmpw r4, r0 - blt- .loc_0x94 - li r3, 0x2 - b .loc_0x138 - - .loc_0x94: - lwz r3, 0x4(r31) - rlwinm r0,r4,3,0,28 - lwz r4, 0x14(r31) - add r31, r3, r0 - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0xCC - lwz r3, 0xC(r3) - li r5, 0xA - li r0, 0x2 - stb r5, 0x400(r3) - lwz r3, 0x0(r31) - lwz r3, 0xC(r3) - stb r0, 0x408(r3) - - .loc_0xCC: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0xE8 - lwz r12, 0x0(r3) - lwz r12, 0x48(r12) - mtlr r12 - blrl - - .loc_0xE8: - lwz r3, 0x4(r31) - cmplwi r3, 0 - beq- .loc_0x10C - lwz r12, 0x0(r3) - lwz r4, 0x0(r31) - lwz r12, 0x8(r12) - mtlr r12 - blrl - b .loc_0x134 - - .loc_0x10C: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x134 - lwz r12, 0x0(r3) - lwz r12, 0x38(r12) - mtlr r12 - blrl - b .loc_0x134 - - .loc_0x12C: - li r3, 0x1 - b .loc_0x138 - - .loc_0x134: - li r3, 0 - - .loc_0x138: - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + Child* child = &mChildActions[mChildActionIdx]; + switch (child->mAction->exec()) { + case ACTOUT_Success: + mChildActions[mChildActionIdx].mAction->cleanup(); + mChildActionIdx++; + if (mChildActionIdx >= mChildCount) { + return ACTOUT_Success; + } + Child* child = &mChildActions[mChildActionIdx]; + child->initialise(_14); + break; + + case ACTOUT_Unk1: + return ACTOUT_Unk1; + } + + return ACTOUT_Unk0; } /* @@ -575,75 +159,11 @@ int AndAction::exec() * Address: 800C4140 * Size: 0000E0 */ -void OrAction::init(Creature*) +void OrAction::init(Creature* creature) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - li r0, 0 - stwu r1, -0x20(r1) - stw r31, 0x1C(r1) - stw r30, 0x18(r1) - mr r30, r4 - stw r29, 0x14(r1) - addi r29, r3, 0 - sth r0, 0x8(r3) - lha r0, 0x8(r3) - lwz r3, 0x4(r3) - rlwinm r0,r0,3,0,28 - add r31, r3, r0 - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x60 - lwz r3, 0xC(r3) - li r4, 0xA - li r0, 0x2 - stb r4, 0x400(r3) - lwz r3, 0x0(r31) - lwz r3, 0xC(r3) - stb r0, 0x408(r3) - - .loc_0x60: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x80 - lwz r12, 0x0(r3) - mr r4, r30 - lwz r12, 0x48(r12) - mtlr r12 - blrl - - .loc_0x80: - lwz r3, 0x4(r31) - cmplwi r3, 0 - beq- .loc_0xA4 - lwz r12, 0x0(r3) - lwz r4, 0x0(r31) - lwz r12, 0x8(r12) - mtlr r12 - blrl - b .loc_0xC0 - - .loc_0xA4: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0xC0 - lwz r12, 0x0(r3) - lwz r12, 0x38(r12) - mtlr r12 - blrl - - .loc_0xC0: - stw r30, 0x14(r29) - lwz r0, 0x24(r1) - lwz r31, 0x1C(r1) - lwz r30, 0x18(r1) - lwz r29, 0x14(r1) - addi r1, r1, 0x20 - mtlr r0 - blr - */ + mChildActionIdx = 0; + mChildActions[mChildActionIdx].initialise(creature); + _14 = creature; } /* @@ -653,111 +173,23 @@ void OrAction::init(Creature*) */ int OrAction::exec() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - mr r31, r3 - lha r0, 0x8(r3) - lwz r3, 0x4(r3) - rlwinm r0,r0,3,0,28 - add r3, r3, r0 - lwz r3, 0x0(r3) - lwz r12, 0x0(r3) - lwz r12, 0x4C(r12) - mtlr r12 - blrl - cmpwi r3, 0x2 - beq- .loc_0x50 - bge- .loc_0x138 - cmpwi r3, 0x1 - bge- .loc_0x58 - b .loc_0x138 - - .loc_0x50: - li r3, 0x2 - b .loc_0x13C - - .loc_0x58: - lha r0, 0x8(r31) - lwz r3, 0x4(r31) - rlwinm r0,r0,3,0,28 - lwzx r3, r3, r0 - lwz r12, 0x0(r3) - lwz r12, 0x50(r12) - mtlr r12 - blrl - lha r3, 0x8(r31) - addi r0, r3, 0x1 - sth r0, 0x8(r31) - lha r4, 0x8(r31) - lha r0, 0xA(r31) - cmpw r4, r0 - blt- .loc_0x9C - li r3, 0x1 - b .loc_0x13C - - .loc_0x9C: - lwz r3, 0x4(r31) - rlwinm r0,r4,3,0,28 - lwz r4, 0x14(r31) - add r31, r3, r0 - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0xD4 - lwz r3, 0xC(r3) - li r5, 0xA - li r0, 0x2 - stb r5, 0x400(r3) - lwz r3, 0x0(r31) - lwz r3, 0xC(r3) - stb r0, 0x408(r3) - - .loc_0xD4: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0xF0 - lwz r12, 0x0(r3) - lwz r12, 0x48(r12) - mtlr r12 - blrl - - .loc_0xF0: - lwz r3, 0x4(r31) - cmplwi r3, 0 - beq- .loc_0x114 - lwz r12, 0x0(r3) - lwz r4, 0x0(r31) - lwz r12, 0x8(r12) - mtlr r12 - blrl - b .loc_0x130 - - .loc_0x114: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x130 - lwz r12, 0x0(r3) - lwz r12, 0x38(r12) - mtlr r12 - blrl - - .loc_0x130: - li r3, 0x1 - b .loc_0x13C - - .loc_0x138: - li r3, 0 - - .loc_0x13C: - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + Child* child = &mChildActions[mChildActionIdx]; + switch (child->mAction->exec()) { + case ACTOUT_Success: + return ACTOUT_Success; + + case ACTOUT_Unk1: + mChildActions[mChildActionIdx].mAction->cleanup(); + mChildActionIdx++; + if (mChildActionIdx >= mChildCount) { + return ACTOUT_Unk1; + } + Child* child = &mChildActions[mChildActionIdx]; + child->initialise(_14); + return ACTOUT_Unk1; + } + + return ACTOUT_Unk0; } /* @@ -765,150 +197,33 @@ int OrAction::exec() * Address: 800C4370 * Size: 000124 */ -void Action::setChildren(int, ...) +void Action::setChildren(int count, ...) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x98(r1) - stw r31, 0x94(r1) - stw r30, 0x90(r1) - stw r29, 0x8C(r1) - stw r28, 0x88(r1) - bne- cr1, .loc_0x40 - stfd f1, 0x28(r1) - stfd f2, 0x30(r1) - stfd f3, 0x38(r1) - stfd f4, 0x40(r1) - stfd f5, 0x48(r1) - stfd f6, 0x50(r1) - stfd f7, 0x58(r1) - stfd f8, 0x60(r1) - - .loc_0x40: - stw r3, 0x8(r1) - addi r31, r4, 0 - addi r30, r3, 0 - stw r4, 0xC(r1) - rlwinm r4,r4,3,0,28 - addi r3, r4, 0x8 - stw r5, 0x10(r1) - stw r6, 0x14(r1) - stw r7, 0x18(r1) - stw r8, 0x1C(r1) - stw r9, 0x20(r1) - stw r10, 0x24(r1) - bl -0x7D3DC - lis r4, 0x800C - lis r5, 0x800C - addi r4, r4, 0x4494 - addi r5, r5, 0x3E80 - addi r7, r31, 0 - li r6, 0x8 - bl 0x15082C - stw r3, 0x4(r30) - extsh r0, r31 - lis r4, 0x200 - sth r0, 0xA(r30) - addi r3, r1, 0xA0 - addi r0, r1, 0x8 - stw r4, 0x78(r1) - li r28, 0 - li r29, 0 - stw r3, 0x7C(r1) - stw r0, 0x80(r1) - b .loc_0xFC - - .loc_0xC0: - addi r3, r1, 0x78 - li r4, 0x1 - bl 0x150438 - lwz r0, 0x0(r3) - addi r3, r1, 0x78 - lwz r5, 0x4(r30) - li r4, 0x1 - stwx r0, r5, r29 - bl 0x150420 - lwz r4, 0x0(r3) - addi r0, r29, 0x4 - lwz r3, 0x4(r30) - addi r29, r29, 0x8 - addi r28, r28, 0x1 - stwx r4, r3, r0 - - .loc_0xFC: - cmpw r28, r31 - blt+ .loc_0xC0 - lwz r0, 0x9C(r1) - lwz r31, 0x94(r1) - lwz r30, 0x90(r1) - lwz r29, 0x8C(r1) - lwz r28, 0x88(r1) - addi r1, r1, 0x98 - mtlr r0 - blr - */ + mChildActions = new Child[count]; + mChildCount = count; + + va_list list; + va_start(list, count); + for (int i = 0; i < count; i++) { + Action* action = va_arg(list, Action*); + mChildActions[i].mAction = action; + + Initialiser* init = va_arg(list, Initialiser*); + mChildActions[i].mInitialiser = init; + } + va_end(list); } /* - * --INFO-- - * Address: 800C4494 - * Size: 000010 - */ -Action::Child::Child() -{ - /* - .loc_0x0: - li r0, 0 - stw r0, 0x0(r3) - stw r0, 0x4(r3) - blr - */ -} - -/* - * --INFO-- - * Address: 800C44A4 - * Size: 000070 - */ -void Action::cleanup() -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x20(r1) - stw r31, 0x1C(r1) - stw r30, 0x18(r1) - li r30, 0 - rlwinm r31,r30,3,0,28 - stw r29, 0x14(r1) - addi r29, r3, 0 - b .loc_0x48 - - .loc_0x28: - lwz r3, 0x4(r29) - lwzx r3, r3, r31 - lwz r12, 0x0(r3) - lwz r12, 0x50(r12) - mtlr r12 - blrl - addi r31, r31, 0x8 - addi r30, r30, 0x1 - - .loc_0x48: - lha r0, 0xA(r29) - cmpw r30, r0 - blt+ .loc_0x28 - lwz r0, 0x24(r1) - lwz r31, 0x1C(r1) - lwz r30, 0x18(r1) - lwz r29, 0x14(r1) - addi r1, r1, 0x20 - mtlr r0 - blr - */ + * --INFO-- + * Address: 800C44A4 + * Size: 000070 + */ +void Action::cleanup() +{ + for (int i = 0; i < mChildCount; i++) { + mChildActions[i].mAction->cleanup(); + } } /* @@ -916,76 +231,14 @@ void Action::cleanup() * Address: 800C4514 * Size: 0000DC */ -void TopAction::MotionListener::animationKeyUpdated(PaniAnimKeyEvent&) +void TopAction::MotionListener::animationKeyUpdated(PaniAnimKeyEvent& event) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - lwz r0, 0x0(r4) - cmpwi r0, 0 - beq- .loc_0x20 - b .loc_0xC8 - - .loc_0x20: - lwz r4, 0x4(r3) - li r0, 0 - stb r0, 0x1A(r4) - lwz r4, 0x4(r3) - lha r0, 0x8(r4) - lwz r3, 0x4(r4) - rlwinm r0,r0,3,0,28 - lwz r4, 0x20(r4) - add r31, r3, r0 - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x6C - lwz r3, 0xC(r3) - li r5, 0xA - li r0, 0x2 - stb r5, 0x400(r3) - lwz r3, 0x0(r31) - lwz r3, 0xC(r3) - stb r0, 0x408(r3) - - .loc_0x6C: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x88 - lwz r12, 0x0(r3) - lwz r12, 0x48(r12) - mtlr r12 - blrl - - .loc_0x88: - lwz r3, 0x4(r31) - cmplwi r3, 0 - beq- .loc_0xAC - lwz r12, 0x0(r3) - lwz r4, 0x0(r31) - lwz r12, 0x8(r12) - mtlr r12 - blrl - b .loc_0xC8 - - .loc_0xAC: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0xC8 - lwz r12, 0x0(r3) - lwz r12, 0x38(r12) - mtlr r12 - blrl - - .loc_0xC8: - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + switch (event.mKeyFrame) { + case 0: + mAction->_1A = 0; + mAction->mChildActions[mAction->mChildActionIdx].initialise(mAction->_20); + break; + } } /* @@ -996,6 +249,32 @@ void TopAction::MotionListener::animationKeyUpdated(PaniAnimKeyEvent&) TopAction::TopAction(Piki* piki) : Action(piki, false) { + _18 = 0; + + memStat->start("topaction"); + + mListener = new MotionListener(this); + _20 = 0; + _24 = -1; + _2C = 1.0f; + _28 = 0; + _19 = 0; + _1A = 0; + mName = "top action"; + + setChildren(31, new ActRandomBoid(piki), nullptr, new ActWatch(piki), nullptr, new ActEscape(piki), nullptr, new ActChase(piki), + nullptr, new ActGoto(piki), nullptr, new ActPickCreature(piki), nullptr, new ActPutItem(piki), nullptr, + new ActFormation(piki), nullptr, new ActAttack(piki), nullptr, new ActShoot(piki), nullptr, new ActGuard(piki), nullptr, + new ActPullout(piki), nullptr, new ActPickItem(piki), nullptr, new ActDecoy(piki), nullptr, new ActCrowd(piki), nullptr, + new ActFree(piki), nullptr, new ActRope(piki), nullptr, new ActEnter(piki), nullptr, new ActExit(piki), nullptr, + new ActBreakWall(piki), nullptr, new ActMine(piki), nullptr, new ActTransport(piki), nullptr, new ActKinoko(piki), nullptr, + new ActBridge(piki), nullptr, new ActPush(piki), nullptr, new ActPutBomb(piki), nullptr, new ActRescue(piki), nullptr, + new ActWeed(piki), nullptr, new ActStone(piki), nullptr, new ActBoMake(piki), nullptr, new ActBou(piki), nullptr); + + _1C = -1; + + memStat->end("topAction"); + /* .loc_0x0: mflr r0 @@ -1473,129 +752,22 @@ TopAction::TopAction(Piki* piki) * Address: 800C4C3C * Size: 000088 */ -TopAction::~TopAction() -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - addi r31, r4, 0 - stw r30, 0x10(r1) - mr. r30, r3 - beq- .loc_0x6C - lis r3, 0x802B - addi r0, r3, 0x7FD4 - stw r0, 0x0(r30) - beq- .loc_0x5C - lis r3, 0x802C - subi r0, r3, 0x7E6C - stw r0, 0x0(r30) - lwz r3, 0x4(r30) - cmplwi r3, 0 - beq- .loc_0x54 - lis r4, 0x800C - addi r4, r4, 0x3E80 - bl 0x14FD68 - - .loc_0x54: - li r0, 0 - stw r0, 0x4(r30) - - .loc_0x5C: - extsh. r0, r31 - ble- .loc_0x6C - mr r3, r30 - bl -0x7DAF8 - - .loc_0x6C: - mr r3, r30 - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ -} +TopAction::~TopAction() { } /* * --INFO-- * Address: 800C4CC4 * Size: 0000E8 */ -void TopAction::init(Creature*) +void TopAction::init(Creature* creature) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - li r0, 0 - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - addi r30, r3, 0 - sth r0, 0x8(r3) - lha r0, 0x8(r3) - lwz r3, 0x4(r3) - rlwinm r0,r0,3,0,28 - add r31, r3, r0 - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x58 - lwz r3, 0xC(r3) - li r5, 0xA - li r0, 0x2 - stb r5, 0x400(r3) - lwz r3, 0x0(r31) - lwz r3, 0xC(r3) - stb r0, 0x408(r3) - - .loc_0x58: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0x74 - lwz r12, 0x0(r3) - lwz r12, 0x48(r12) - mtlr r12 - blrl - - .loc_0x74: - lwz r3, 0x4(r31) - cmplwi r3, 0 - beq- .loc_0x98 - lwz r12, 0x0(r3) - lwz r4, 0x0(r31) - lwz r12, 0x8(r12) - mtlr r12 - blrl - b .loc_0xB4 - - .loc_0x98: - lwz r3, 0x0(r31) - cmplwi r3, 0 - beq- .loc_0xB4 - lwz r12, 0x0(r3) - lwz r12, 0x38(r12) - mtlr r12 - blrl - - .loc_0xB4: - li r0, 0 - stw r0, 0x20(r30) - lfs f0, -0x6A60(r2) - stfs f0, 0x2C(r30) - stw r0, 0x28(r30) - stb r0, 0x1A(r30) - stb r0, 0x19(r30) - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + mChildActionIdx = 0; + mChildActions[mChildActionIdx].initialise(creature); + _20 = nullptr; + _2C = 1.0f; + _28 = 0; + _1A = 0; + _19 = 0; } /* @@ -2041,46 +1213,20 @@ int TopAction::exec() * Address: 800C5344 * Size: 000084 */ -void TopAction::abandon(zen::particleGenerator*) +void TopAction::abandon(zen::particleGenerator* particle) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - mr r31, r3 - lha r0, 0x8(r3) - cmpwi r0, -0x1 - beq- .loc_0x54 - lwz r3, 0x4(r31) - rlwinm r0,r0,3,0,28 - lwzx r3, r3, r0 - lwz r12, 0x0(r3) - lwz r12, 0x50(r12) - mtlr r12 - blrl - lwz r3, 0xC(r31) - lwz r12, 0x0(r3) - lwz r12, 0x120(r12) - mtlr r12 - blrl - rlwinm. r0,r3,0,24,31 - - .loc_0x54: - li r0, -0x1 - sth r0, 0x8(r31) - li r0, 0 - stw r0, 0x28(r31) - stw r0, 0x24(r31) - stw r0, 0x20(r31) - stb r0, 0x19(r31) - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + if (mChildActionIdx != -1) { + mChildActions[mChildActionIdx].mAction->cleanup(); + if (mActor->isKinoko()) { + DEBUGPRINT(mChildActionIdx < -1); + } + } + + mChildActionIdx = -1; + _28 = 0; + _24 = 0; + _20 = nullptr; + _19 = 0; } /* @@ -2090,32 +1236,10 @@ void TopAction::abandon(zen::particleGenerator*) */ bool TopAction::resumable() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - lha r0, 0x8(r3) - cmpwi r0, -0x1 - beq- .loc_0x38 - lwz r3, 0x4(r3) - rlwinm r0,r0,3,0,28 - lwzx r3, r3, r0 - lwz r12, 0x0(r3) - lwz r12, 0x5C(r12) - mtlr r12 - blrl - b .loc_0x3C - - .loc_0x38: - li r3, 0 - - .loc_0x3C: - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ + if (mChildActionIdx != -1) { + return mChildActions[mChildActionIdx].mAction->resumable(); + } + return false; } /* @@ -2125,30 +1249,10 @@ bool TopAction::resumable() */ void TopAction::resume() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - li r0, 0x1 - stwu r1, -0x8(r1) - stb r0, 0x19(r3) - lha r0, 0x8(r3) - cmpwi r0, -0x1 - beq- .loc_0x3C - lwz r3, 0x4(r3) - rlwinm r0,r0,3,0,28 - lwzx r3, r3, r0 - lwz r12, 0x0(r3) - lwz r12, 0x54(r12) - mtlr r12 - blrl - - .loc_0x3C: - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ + _19 = 1; + if (mChildActionIdx != -1) { + mChildActions[mChildActionIdx].mAction->resume(); + } } /* @@ -2158,30 +1262,10 @@ void TopAction::resume() */ void TopAction::restart() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - li r0, 0 - stwu r1, -0x8(r1) - stb r0, 0x19(r3) - lha r0, 0x8(r3) - cmpwi r0, -0x1 - beq- .loc_0x3C - lwz r3, 0x4(r3) - rlwinm r0,r0,3,0,28 - lwzx r3, r3, r0 - lwz r12, 0x0(r3) - lwz r12, 0x58(r12) - mtlr r12 - blrl - - .loc_0x3C: - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ + _19 = 0; + if (mChildActionIdx != -1) { + mChildActions[mChildActionIdx].mAction->restart(); + } } /* @@ -2201,49 +1285,15 @@ void TopAction::knowledgeCheck() */ TopAction::ObjBore::ObjBore() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - li r0, 0x5 - stwu r1, -0x20(r1) - stw r31, 0x1C(r1) - li r31, 0 - stw r30, 0x18(r1) - addi r30, r3, 0 - stw r31, 0xC(r3) - stw r0, 0x10(r3) - lwz r0, 0x10(r3) - rlwinm r3,r0,2,0,29 - bl -0x7E4D8 - stw r3, 0x0(r30) - lwz r0, 0x10(r30) - rlwinm r3,r0,2,0,29 - bl -0x7E4E8 - stw r3, 0x4(r30) - lwz r3, 0x10(r30) - bl -0x7E4F4 - stw r3, 0x8(r30) - li r4, 0 - b .loc_0x68 - - .loc_0x5C: - lwz r3, 0x8(r30) - stbx r31, r3, r4 - addi r4, r4, 0x1 - - .loc_0x68: - lwz r0, 0x10(r30) - cmpw r4, r0 - blt+ .loc_0x5C - mr r3, r30 - lwz r0, 0x24(r1) - lwz r31, 0x1C(r1) - lwz r30, 0x18(r1) - addi r1, r1, 0x20 - mtlr r0 - blr - */ + _0C = 0; + mCnt = 5; + _00 = new u32[mCnt]; + _04 = new u32[mCnt]; + _08 = new u8[mCnt]; + + for (int i = 0; i < mCnt; i++) { + _08[i] = 0; + } } /* @@ -2283,44 +1333,11 @@ void TopAction::ObjBore::update() */ TopAction::Boredom::Boredom() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - li r0, 0x1E - stwu r1, -0x28(r1) - stw r31, 0x24(r1) - li r31, 0 - stw r30, 0x20(r1) - stw r29, 0x1C(r1) - addi r29, r3, 0 - stw r31, 0x8(r3) - stw r0, 0xC(r3) - lwz r30, 0xC(r3) - mulli r3, r30, 0x14 - addi r3, r3, 0x8 - bl -0x7E570 - lis r4, 0x800C - addi r4, r4, 0x54AC - addi r7, r30, 0 - li r5, 0 - li r6, 0x14 - bl 0x14F69C - stw r3, 0x0(r29) - lwz r0, 0xC(r29) - rlwinm r3,r0,2,0,29 - bl -0x7E598 - stw r3, 0x4(r29) - mr r3, r29 - stw r31, 0x10(r29) - lwz r0, 0x2C(r1) - lwz r31, 0x24(r1) - lwz r30, 0x20(r1) - lwz r29, 0x1C(r1) - addi r1, r1, 0x28 - mtlr r0 - blr - */ + _08 = 0; + mObjectCnt = 30; + mObjects = new ObjBore[mObjectCnt]; + _04 = new u32[mObjectCnt]; + _10 = 0; } /* @@ -2372,114 +1389,3 @@ void TopAction::Boredom::draw2d(Graphics&, int) { // UNUSED FUNCTION } - -/* - * --INFO-- - * Address: 800C55C8 - * Size: 00003C - */ -void TopAction::getInfo(char*) -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - lha r0, 0x8(r3) - lwz r3, 0x4(r3) - rlwinm r0,r0,3,0,28 - lwzx r3, r3, r0 - lwz r12, 0x0(r3) - lwz r12, 0x60(r12) - mtlr r12 - blrl - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} - -/* - * --INFO-- - * Address: 800C5604 - * Size: 000048 - */ -void TopAction::draw(Graphics&) -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - lbz r0, 0x18(r3) - cmplwi r0, 0 - beq- .loc_0x38 - lha r0, 0x8(r3) - lwz r3, 0x4(r3) - rlwinm r0,r0,3,0,28 - lwzx r3, r3, r0 - lwz r12, 0x0(r3) - lwz r12, 0x40(r12) - mtlr r12 - blrl - - .loc_0x38: - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} - -/* - * --INFO-- - * Address: 800C564C - * Size: 000088 - */ -OrAction::~OrAction() -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - addi r31, r4, 0 - stw r30, 0x10(r1) - mr. r30, r3 - beq- .loc_0x6C - lis r3, 0x802C - subi r0, r3, 0x7F54 - stw r0, 0x0(r30) - beq- .loc_0x5C - lis r3, 0x802C - subi r0, r3, 0x7E6C - stw r0, 0x0(r30) - lwz r3, 0x4(r30) - cmplwi r3, 0 - beq- .loc_0x54 - lis r4, 0x800C - addi r4, r4, 0x3E80 - bl 0x14F358 - - .loc_0x54: - li r0, 0 - stw r0, 0x4(r30) - - .loc_0x5C: - extsh. r0, r31 - ble- .loc_0x6C - mr r3, r30 - bl -0x7E508 - - .loc_0x6C: - mr r3, r30 - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ -} diff --git a/src/plugPikiKando/aiAttack.cpp b/src/plugPikiKando/aiAttack.cpp index 65a56780..2ffdf19e 100644 --- a/src/plugPikiKando/aiAttack.cpp +++ b/src/plugPikiKando/aiAttack.cpp @@ -85,45 +85,6 @@ ActAttack::ActAttack(Piki* piki) */ } -/* - * --INFO-- - * Address: 800A83B0 - * Size: 000064 - */ -AndAction::~AndAction() -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - addi r31, r4, 0 - stw r30, 0x10(r1) - mr. r30, r3 - beq- .loc_0x48 - lis r3, 0x802C - subi r0, r3, 0x7ED0 - stw r0, 0x0(r30) - addi r3, r30, 0 - li r4, 0 - bl 0x1BA24 - extsh. r0, r31 - ble- .loc_0x48 - mr r3, r30 - bl -0x61248 - - .loc_0x48: - mr r3, r30 - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ -} - /* * --INFO-- * Address: 800A8414 diff --git a/src/plugPikiKando/aiStone.cpp b/src/plugPikiKando/aiStone.cpp index c50bc807..b66c5ed8 100644 --- a/src/plugPikiKando/aiStone.cpp +++ b/src/plugPikiKando/aiStone.cpp @@ -1,4 +1,5 @@ #include "PikiAI.h" +#include "WeedsItem.h" /* * --INFO-- @@ -26,32 +27,8 @@ static void _Print(char*, ...) * Size: 000054 */ ActStone::ActStone(Piki* piki) - : Action(piki, false) + : Action(piki, true) { - /* - .loc_0x0: - mflr r0 - li r5, 0x1 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - addi r31, r3, 0 - bl 0x1D024 - lis r3, 0x802B - subi r0, r3, 0x246C - lis r3, 0x802B - stw r0, 0x14(r31) - addi r3, r3, 0x4FB0 - stw r3, 0x0(r31) - addi r0, r3, 0x64 - addi r3, r31, 0 - stw r0, 0x14(r31) - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ } /* @@ -59,35 +36,15 @@ ActStone::ActStone(Piki* piki) * Address: 800A6DE8 * Size: 000058 */ -void ActStone::init(Creature*) +void ActStone::init(Creature* creature) { - /* - .loc_0x0: - mflr r0 - cmplwi r4, 0 - stw r0, 0x4(r1) - li r0, 0 - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - addi r31, r3, 0 - stw r0, 0x20(r3) - beq- .loc_0x3C - lwz r0, 0x6C(r4) - cmpwi r0, 0x21 - bne- .loc_0x3C - stw r4, 0x24(r31) - lwz r3, 0x24(r31) - bl 0x3D87C + mCurrPebble = nullptr; + if (creature && creature->mObjType == OBJTYPE_RockGen) { + mRockGen = static_cast(creature); + mRockGen->startWork(); + } - .loc_0x3C: - mr r3, r31 - bl 0xD8 - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + initApproach(); } /* @@ -97,52 +54,22 @@ void ActStone::init(Creature*) */ int ActStone::exec() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - lwz r0, 0x20(r3) - cmplwi r0, 0 - bne- .loc_0x20 - li r3, 0x2 - b .loc_0x64 - - .loc_0x20: - lhz r0, 0x18(r3) - cmpwi r0, 0x1 - beq- .loc_0x50 - bge- .loc_0x3C - cmpwi r0, 0 - bge- .loc_0x48 - b .loc_0x60 + if (mCurrPebble == nullptr) { + return ACTOUT_Success; + } - .loc_0x3C: - cmpwi r0, 0x3 - bge- .loc_0x60 - b .loc_0x58 + switch (mState) { + case STATE_Approach: + return exeApproach(); - .loc_0x48: - bl 0xFC - b .loc_0x64 + case STATE_Adjust: + return exeAdjust(); - .loc_0x50: - bl 0x290 - b .loc_0x64 + case STATE_Attack: + return exeAttack(); + } - .loc_0x58: - bl 0x4E0 - b .loc_0x64 - - .loc_0x60: - li r3, 0 - - .loc_0x64: - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ + return ACTOUT_Unk0; } /* @@ -152,30 +79,11 @@ int ActStone::exec() */ void ActStone::cleanup() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - lwz r4, 0xC(r3) - lwz r0, 0xC8(r4) - rlwinm r0,r0,0,10,8 - stw r0, 0xC8(r4) - lwz r4, 0xC(r3) - lwz r0, 0xC8(r4) - rlwinm r0,r0,0,11,9 - stw r0, 0xC8(r4) - lwz r3, 0x24(r3) - cmplwi r3, 0 - beq- .loc_0x3C - bl 0x3D7C8 - - .loc_0x3C: - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ + mActor->resetCreatureFlag(CF_Unk22); + mActor->resetCreatureFlag(CF_FixPosition); + if (mRockGen) { + mRockGen->finishWork(); + } } /* @@ -185,46 +93,15 @@ void ActStone::cleanup() */ void ActStone::initApproach() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x28(r1) - stw r31, 0x24(r1) - stw r30, 0x20(r1) - mr r30, r3 - lwz r3, 0x24(r3) - cmplwi r3, 0 - beq- .loc_0x30 - bl 0x3E2E4 - stw r3, 0x20(r30) - b .loc_0x38 + if (mRockGen) { + mCurrPebble = mRockGen->getRandomPebble(); + } else { + mCurrPebble = nullptr; + } - .loc_0x30: - li r0, 0 - stw r0, 0x20(r30) + mState = STATE_Approach; - .loc_0x38: - li r0, 0 - sth r0, 0x18(r30) - addi r3, r1, 0xC - li r4, 0x2 - bl 0x78010 - addi r31, r3, 0 - addi r3, r1, 0x14 - li r4, 0x2 - bl 0x78000 - mr r4, r3 - lwz r3, 0xC(r30) - mr r5, r31 - bl 0x23A70 - lwz r0, 0x2C(r1) - lwz r31, 0x24(r1) - lwz r30, 0x20(r1) - addi r1, r1, 0x28 - mtlr r0 - blr - */ + mActor->startMotion(PaniMotionInfo(2), PaniMotionInfo(2)); } /* @@ -232,7 +109,7 @@ void ActStone::initApproach() * Address: 800A6F84 * Size: 000190 */ -void ActStone::exeApproach() +int ActStone::exeApproach() { /* .loc_0x0: @@ -358,18 +235,14 @@ void ActStone::exeApproach() * Address: 800A7114 * Size: 00000C */ -void ActStone::initAdjust() -{ - // Generated from sth r0, 0x18(r3) - // _18 = 1; -} +void ActStone::initAdjust() { mState = STATE_Adjust; } /* * --INFO-- * Address: 800A7120 * Size: 0001C4 */ -void ActStone::exeAdjust() +int ActStone::exeAdjust() { /* .loc_0x0: @@ -510,48 +383,10 @@ void ActStone::exeAdjust() */ void ActStone::initAttack() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - li r0, 0x2 - stwu r1, -0x30(r1) - stw r31, 0x2C(r1) - stw r30, 0x28(r1) - stw r29, 0x24(r1) - mr. r29, r3 - sth r0, 0x18(r3) - mr r30, r29 - beq- .loc_0x30 - addi r30, r30, 0x14 - - .loc_0x30: - addi r3, r1, 0x10 - li r4, 0x13 - bl 0x77C3C - addi r31, r3, 0 - addi r5, r30, 0 - addi r3, r1, 0x18 - li r4, 0x13 - bl 0x77C5C - mr r4, r3 - lwz r3, 0xC(r29) - mr r5, r31 - bl 0x23698 - li r0, 0 - stb r0, 0x28(r29) - lwz r3, 0xC(r29) - lwz r0, 0xC8(r3) - oris r0, r0, 0x40 - stw r0, 0xC8(r3) - lwz r0, 0x34(r1) - lwz r31, 0x2C(r1) - lwz r30, 0x28(r1) - lwz r29, 0x24(r1) - addi r1, r1, 0x30 - mtlr r0 - blr - */ + mState = STATE_Attack; + mActor->startMotion(PaniMotionInfo(19, this), PaniMotionInfo(19)); + _28 = 0; + mActor->setCreatureFlag(CF_Unk22); } /* @@ -559,7 +394,7 @@ void ActStone::initAttack() * Address: 800A7378 * Size: 000174 */ -void ActStone::exeAttack() +int ActStone::exeAttack() { /* .loc_0x0: @@ -934,68 +769,3 @@ ActStone::~ActStone() blr */ } - -/* - * --INFO-- - * Address: 800A7864 - * Size: 000004 - */ -void Action::defaultInitialiser() { } - -/* - * --INFO-- - * Address: 800A7868 - * Size: 000004 - */ -void Action::dump() { } - -/* - * --INFO-- - * Address: 800A786C - * Size: 000004 - */ -void Action::draw(Graphics&) { } - -/* - * --INFO-- - * Address: 800A7870 - * Size: 000004 - */ -void Action::resume() { } - -/* - * --INFO-- - * Address: 800A7874 - * Size: 000004 - */ -void Action::restart() { } - -/* - * --INFO-- - * Address: 800A7878 - * Size: 000008 - */ -bool Action::resumable() { return false; } - -/* - * --INFO-- - * Address: 800A7880 - * Size: 00002C - */ -void Action::getInfo(char*) -{ - /* - .loc_0x0: - mflr r0 - addi r3, r4, 0 - stw r0, 0x4(r1) - crclr 6, 0x6 - subi r4, r13, 0x5098 - stwu r1, -0x8(r1) - bl 0x16ED00 - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} diff --git a/src/plugPikiKando/weedsItem.cpp b/src/plugPikiKando/weedsItem.cpp index 4d49d258..f28406ae 100644 --- a/src/plugPikiKando/weedsItem.cpp +++ b/src/plugPikiKando/weedsItem.cpp @@ -1045,7 +1045,7 @@ f32 RockGen::getSize() * Address: 800E5208 * Size: 0000E0 */ -void RockGen::getRandomPebble() +Pebble* RockGen::getRandomPebble() { /* .loc_0x0: