pikmin brain

This commit is contained in:
EpochFlame 2023-02-04 22:00:19 -05:00
parent 61ed46dc22
commit 23b13656e6
4 changed files with 30 additions and 86 deletions

View File

@ -9,8 +9,7 @@ govNAN___Q24Game5P2JST:
.float 0.0
.float 0.0
.float 0.0
.global __vt__Q26PikiAI6Action
__vt__Q26PikiAI6Action:
.obj __vt__Q26PikiAI6Action, global
.4byte 0
.4byte 0
.4byte init__Q26PikiAI6ActionFPQ26PikiAI9ActionArg
@ -26,6 +25,7 @@ __vt__Q26PikiAI6Action:
.4byte doDirectDraw__Q26PikiAI6ActionFR8Graphics
.4byte "wallCallback__Q26PikiAI6ActionFR10Vector3<f>"
.4byte getInfo__Q26PikiAI6ActionFPc
.endobj __vt__Q26PikiAI6Action
.section .sbss # 0x80514D80 - 0x80516360
.balign 8
@ -835,7 +835,7 @@ searchOrima__Q26PikiAI5BrainFv:
doDirectDraw__Q26PikiAI6ActionFR8Graphics:
/* 801972B0 001941F0 4E 80 00 20 */ blr
__sinit_aiAction_cpp: # static initializer
.fn __sinit_aiAction_cpp, local
/* 801972B4 001941F4 3C 80 80 51 */ lis r4, __float_nan@ha
/* 801972B8 001941F8 38 00 FF FF */ li r0, -1
/* 801972BC 001941FC C0 04 48 B0 */ lfs f0, __float_nan@l(r4)
@ -846,3 +846,4 @@ __sinit_aiAction_cpp: # static initializer
/* 801972D0 00194210 D0 03 00 04 */ stfs f0, 4(r3)
/* 801972D4 00194214 D0 03 00 08 */ stfs f0, 8(r3)
/* 801972D8 00194218 4E 80 00 20 */ blr
.endfn __sinit_aiAction_cpp

View File

@ -121,19 +121,19 @@ struct CreatureActionArg : public ActionArg {
};
struct Action {
Action(Game::Piki* p);
Action(Game::Piki* piki);
virtual void init(ActionArg* settings); // _08 (weak)
virtual void init(ActionArg* settings) { } // _08 (weak)
virtual int exec(); // _0C (weak)
virtual void cleanup(); // _10 (weak)
virtual void emotion_success(); // _14 (weak)
virtual void emotion_fail(); // _18 (weak)
virtual void applicable(); // _1C (weak)
virtual bool applicable() { return true; } // _1C (weak)
virtual u32 getNextAIType(); // _20 (weak)
virtual void bounceCallback(Game::Piki* p, Sys::Triangle* hit); // _24 (weak)
virtual void collisionCallback(Game::Piki* p, Game::CollEvent& event); // _28 (weak)
virtual void platCallback(Game::Piki* p, Game::PlatEvent& event); // _2C (weak)
virtual void doDirectDraw(Graphics& gfx); // _30 (weak)
virtual void doDirectDraw(Graphics& gfx) { } // _30 (weak)
virtual void wallCallback(Vector3f& pos); // _34 (weak)
virtual void getInfo(char*); // _38
@ -194,7 +194,7 @@ struct ActAttack : public Action, virtual SysShape::MotionListener {
virtual int exec(); // _0C
virtual void cleanup(); // _10
virtual void emotion_success(); // _14
virtual void applicable(); // _1C
virtual bool applicable(); // _1C
virtual u32 getNextAIType(); // _20 (weak)
virtual void bounceCallback(Game::Piki* p, Sys::Triangle* hit); // _24
virtual void collisionCallback(Game::Piki* p, Game::CollEvent& event); // _28
@ -1046,12 +1046,13 @@ struct Brain {
Brain(Game::Piki* p);
void addAction(PikiAI::Action*);
void init();
void exec();
void getCurrAction();
PikiAI::Action* getCurrAction();
Game::Navi* searchOrima();
void start(int, PikiAI::ActionArg*);
Action* mActions; // _00, might be array of ptrs instead
Action** mActions; // _00, might be array of ptrs instead
int mActionCnt; // _04
int mActionId; // _08
Game::Piki* mPiki; // _0C

View File

@ -1,4 +1,8 @@
#include "types.h"
#include "PikiAI.h"
#include "Game/Piki.h"
#include "Game/PikiState.h"
#include "nans.h"
/*
Generated from dpostproc
@ -61,10 +65,10 @@
* Address: 80196A18
* Size: 00001C
*/
PikiAI::Action::Action(Game::Piki* p)
PikiAI::Action::Action(Game::Piki* piki)
{
_04 = piki;
_08 = "Action";
mParent = piki;
mName = "Action";
/*
.loc_0x0:
lis r5, 0x804B
@ -85,7 +89,7 @@ PikiAI::Action::Action(Game::Piki* p)
void PikiAI::Action::getInfo(char* dest)
{
// dest = Action
sprintf(dest, "%s", _08);
sprintf(dest, "%s", mName);
/*
.loc_0x0:
stwu r1, -0x10(r1)
@ -108,7 +112,7 @@ void PikiAI::Action::getInfo(char* dest)
* Address: 80196A64
* Size: 000280
*/
PikiAI::Brain::Brain(Game::Piki* p)
PikiAI::Brain::Brain(Game::Piki* piki)
{
/*
stwu r1, -0x10(r1)
@ -307,39 +311,19 @@ lbl_80196CB4:
* Address: 80196CE4
* Size: 00001C
*/
void PikiAI::Brain::addAction(PikiAI::Action*)
{
/*
lwz r6, 4(r3)
lwz r7, 0(r3)
addi r5, r6, 1
slwi r0, r6, 2
stw r5, 4(r3)
stwx r4, r7, r0
blr
*/
}
void PikiAI::Brain::addAction(PikiAI::Action* action) { mActions[mActionCnt++] = action; }
/*
* --INFO--
* Address: 80196D00
* Size: 000024
*/
void PikiAI::Brain::getCurrAction()
PikiAI::Action* PikiAI::Brain::getCurrAction()
{
/*
lwz r0, 8(r3)
cmpwi r0, -1
beq lbl_80196D1C
lwz r3, 0(r3)
slwi r0, r0, 2
lwzx r3, r3, r0
blr
lbl_80196D1C:
li r3, 0
blr
*/
if (mActionId != -1) {
return mActions[mActionId];
}
return nullptr;
}
/*
@ -563,7 +547,7 @@ u32 PikiAI::Action::getNextAIType() { return 0x0; }
* Address: 80196F8C
* Size: 000008
*/
u32 PikiAI::Action::exec() { return 0x1; }
int PikiAI::Action::exec() { return 0x1; }
/*
* --INFO--
@ -658,26 +642,12 @@ lbl_80197078:
*/
}
/*
* --INFO--
* Address: 80197094
* Size: 000008
*/
u32 PikiAI::Action::applicable() { return 0x1; }
/*
* --INFO--
* Address: 8019709C
* Size: 000004
*/
void PikiAI::Action::init(PikiAI::ActionArg*) { }
/*
* --INFO--
* Address: 801970A0
* Size: 000210
*/
void PikiAI::Brain::searchOrima()
Game::Navi* PikiAI::Brain::searchOrima()
{
/*
stwu r1, -0xb0(r1)
@ -832,31 +802,3 @@ lbl_80197278:
blr
*/
}
/*
* --INFO--
* Address: 801972B0
* Size: 000004
*/
void PikiAI::Action::doDirectDraw(Graphics&) { }
/*
* --INFO--
* Address: 801972B4
* Size: 000028
*/
void __sinit_aiAction_cpp()
{
/*
lis r4, __float_nan@ha
li r0, -1
lfs f0, __float_nan@l(r4)
lis r3, lbl_804B4A60@ha
stw r0, lbl_805159D8@sda21(r13)
stfsu f0, lbl_804B4A60@l(r3)
stfs f0, lbl_805159DC@sda21(r13)
stfs f0, 4(r3)
stfs f0, 8(r3)
blr
*/
}

View File

@ -463,7 +463,7 @@ void PikiAI::ActAttack::initJumpAdjust()
* Address: 801A0948
* Size: 00008C
*/
void PikiAI::ActAttack::applicable()
bool PikiAI::ActAttack::applicable()
{
/*
stwu r1, -0x20(r1)