misc progress + link 3 files
Some checks are pending
Build / build (GPIE01_01) (push) Waiting to run

This commit is contained in:
Dean Southwood 2024-11-01 16:39:50 +11:00
parent 43d7e97381
commit cdb9d7e497
38 changed files with 983 additions and 2588 deletions

View File

@ -419,8 +419,8 @@ config.libs = [
Object(NonMatching, "plugPikiKando/omake.cpp"),
Object(Matching, "plugPikiKando/radarInfo.cpp"),
Object(NonMatching, "plugPikiKando/interactBattle.cpp"),
Object(NonMatching, "plugPikiKando/interactGrab.cpp"),
Object(NonMatching, "plugPikiKando/interactEtc.cpp"),
Object(Matching, "plugPikiKando/interactGrab.cpp"),
Object(Matching, "plugPikiKando/interactEtc.cpp"),
Object(NonMatching, "plugPikiKando/interactPullout.cpp"),
Object(Matching, "plugPikiKando/saiEvents.cpp"),
Object(NonMatching, "plugPikiKando/simpleAI.cpp"),
@ -541,7 +541,7 @@ config.libs = [
Object(NonMatching, "plugPikiKando/naviMgr.cpp"),
Object(NonMatching, "plugPikiKando/genMapParts.cpp"),
Object(NonMatching, "plugPikiKando/mapParts.cpp"),
Object(NonMatching, "plugPikiKando/panipikianimator.cpp"),
Object(Matching, "plugPikiKando/panipikianimator.cpp"),
Object(NonMatching, "plugPikiKando/actor.cpp"),
Object(Matching, "plugPikiKando/actorMgr.cpp"),
Object(NonMatching, "plugPikiKando/genActor.cpp"),

View File

@ -18,24 +18,24 @@ struct StateMachine;
struct AICreature : public Creature, public PaniAnimKeyListener {
AICreature(CreatureProp*);
virtual void collisionCallback(CollEvent&); // _A8
virtual void bounceCallback(); // _AC
virtual void refresh(Graphics&) = 0; // _EC
virtual void doKill() = 0; // _10C
virtual AState<AICreature>* getCurrState(); // _120 (weak)
virtual void setCurrState(AState<AICreature>*); // _124 (weak)
virtual void playSound(int); // _128 (weak)
virtual void playEffect(int); // _12C (weak)
virtual void startMotion(int); // _130 (weak)
virtual void finishMotion(); // _134 (weak)
virtual void finishMotion(f32); // _138 (weak)
virtual void startMotion(int, f32); // _13C (weak)
virtual void getCurrentMotionName(); // _140 (weak)
virtual void getCurrentMotionCounter(); // _144 (weak)
virtual void getMotionSpeed(); // _148 (weak)
virtual void setMotionSpeed(f32); // _14C (weak)
virtual void stopMotion(); // _150 (weak)
virtual void animationKeyUpdated(PaniAnimKeyEvent&); // _154 (weak)
virtual void collisionCallback(CollEvent&); // _A8
virtual void bounceCallback(); // _AC
virtual void refresh(Graphics&) = 0; // _EC
virtual void doKill() = 0; // _10C
virtual AState<AICreature>* getCurrState() { return mCurrentState; } // _120 (weak)
virtual void setCurrState(AState<AICreature>*); // _124 (weak)
virtual void playSound(int) { } // _128 (weak)
virtual void playEffect(int) { } // _12C (weak)
virtual void startMotion(int); // _130 (weak)
virtual void finishMotion(); // _134 (weak)
virtual void finishMotion(f32); // _138 (weak)
virtual void startMotion(int, f32); // _13C (weak)
virtual char* getCurrentMotionName(); // _140 (weak)
virtual f32 getCurrentMotionCounter(); // _144 (weak)
virtual f32 getMotionSpeed(); // _148 (weak)
virtual void setMotionSpeed(f32); // _14C (weak)
virtual void stopMotion(); // _150 (weak)
virtual void animationKeyUpdated(PaniAnimKeyEvent&); // _154 (weak)
void clearEventFlags();
void setEventFlag(int, bool);

View File

@ -197,6 +197,11 @@ struct AnimKey {
*/
struct AnimInfo : public CoreNode {
enum AnimInfoFlags {
FLAG_Unk1 = 0x1,
FLAG_Unk2 = 0x2,
};
/**
* @brief Fabricated. Offsets relative to AnimInfo for convenience.
*/
@ -230,6 +235,8 @@ struct AnimInfo : public CoreNode {
// unused/inlined:
void initAnimData(AnimData*);
inline f32 getAnimSpeed() { return mParams.mSpeed(); }
// _00 = VTBL
// _00-_14 = CoreNode
AnimInfoParams mParams; // _14

View File

@ -49,8 +49,8 @@ struct BPikiInf : public BaseInf {
// _00 = VTBL
// _00-_2C = BaseInf
u8 mPikiColor; // _2C
u8 mPikiHappa; // _2D
u8 _2C; // _2C
u8 _2D; // _2D
};
/**

View File

@ -116,6 +116,15 @@ struct CollPartUpdater {
// TODO: members
};
/**
* @brief TODO
*/
struct CollEvent {
u32 _00; // _00, unknown
u32 _04; // _04, unknown
u32 _08; // _08, unknown
};
/**
* @brief TODO
*/

View File

@ -45,7 +45,7 @@ enum CreatureFlags {
CF_Unk10 = 1 << 9, // 0x200
CF_Unk11 = 1 << 10, // 0x400
CF_Unk12 = 1 << 11, // 0x800
CF_Unk13 = 1 << 12, // 0x1000
CF_Free = 1 << 12, // 0x1000
CF_Unk14 = 1 << 13, // 0x2000
CF_StuckToObject = 1 << 14, // 0x4000, stuck to an object
CF_StuckToMouth = 1 << 15, // 0x8000, stuck to mouth of some enemy

View File

@ -3,6 +3,8 @@
#include "types.h"
struct StageInfo;
/**
* @brief TODO
*
@ -15,7 +17,9 @@ struct FlowController {
void setStage(char*);
// TODO: members
u8 _00[0xB0]; // _00, unknown
u8 _00[0xA8]; // _00, unknown
StageInfo* _A8; // _A8
u8 _AC[0x4]; // _AC, unknown
char _B0[0x10]; // _B0, i have no idea how big this array is, this is a guess for now
u8 _C0[0x244 - 0xC0]; // _B4, unknown
int _244; // _244

View File

@ -23,24 +23,24 @@ struct ItemShapeObject {
struct ItemCreature : public AICreature {
ItemCreature(int objType, CreatureProp*, Shape*);
virtual void init(Vector3f&); // _28
virtual f32 getHeight(); // _40
virtual bool stimulate(Interaction&); // _A0
virtual void update(); // _E0
virtual void refresh(Graphics&); // _EC
virtual void doAI(); // _104
virtual void doAnimation(); // _108
virtual void doKill(); // _10C
virtual void startMotion(int); // _130
virtual void finishMotion(); // _134
virtual void finishMotion(f32); // _138
virtual void startMotion(int, f32); // _13C
virtual void getCurrentMotionName(); // _140
virtual void getCurrentMotionCounter(); // _144
virtual void getMotionSpeed(); // _148
virtual void setMotionSpeed(f32); // _14C
virtual void stopMotion(); // _150
virtual void finalSetup(); // _158 (weak)
virtual void init(Vector3f&); // _28
virtual f32 getHeight(); // _40
virtual bool stimulate(Interaction&); // _A0
virtual void update(); // _E0
virtual void refresh(Graphics&); // _EC
virtual void doAI(); // _104
virtual void doAnimation(); // _108
virtual void doKill(); // _10C
virtual void startMotion(int); // _130
virtual void finishMotion(); // _134
virtual void finishMotion(f32); // _138
virtual void startMotion(int, f32); // _13C
virtual char* getCurrentMotionName(); // _140
virtual f32 getCurrentMotionCounter(); // _144
virtual f32 getMotionSpeed(); // _148
virtual void setMotionSpeed(f32); // _14C
virtual void stopMotion(); // _150
virtual void finalSetup(); // _158 (weak)
// _00 = VTBL
// _00-_304 = AICreature?

View File

@ -2,6 +2,11 @@
#define _MSG_H
#include "types.h"
#include "Collision.h"
#include "Vector.h"
struct Creature;
struct PaniAnimKeyEvent;
/**
* @brief TODO
@ -24,7 +29,12 @@ enum MsgType {
* @brief TODO
*/
struct Msg {
u32 _00; // _00, maybe msg type?
inline Msg(int type)
: mMsgType(type)
{
}
int mMsgType; // _00
};
/**
@ -33,62 +43,133 @@ struct Msg {
* @note will need to fix saiEvents.cpp when this gets worked out
*/
struct MsgAnim : public Msg {
inline MsgAnim(PaniAnimKeyEvent* event) // adjust when type of _04 is known
: Msg(MSG_Anim)
, mKeyEvent(event)
{
}
// _00-_04 = Msg
u32* _04; // _04, probably a pointer to a struct with a u32 or int at _00
PaniAnimKeyEvent* mKeyEvent; // _04, probably a pointer to a struct with a u32 or int at _00
};
/**
* @brief TODO
*/
struct MsgBounce : public Msg {
inline MsgBounce(Vector3f& normal)
: Msg(MSG_Bounce)
, mNormal(normal)
{
}
// _00-_04 = Msg
Vector3f mNormal; // _04
};
/**
* @brief TODO
*/
struct MsgCollide : public Msg {
inline MsgCollide(CollEvent& event)
: Msg(MSG_Collide)
, mEvent(event)
{
}
// _00-_04 = Msg
CollEvent mEvent; // _04
};
/**
* @brief TODO
*/
struct MsgDamage : public Msg {
inline MsgDamage()
: Msg(MSG_Damage)
{
}
// _00-_04 = Msg
// TODO: members
};
/**
* @brief TODO
*/
struct MsgGround : public Msg {
inline MsgGround()
: Msg(MSG_Ground)
{
}
// _00-_04 = Msg
// TODO: members
};
/**
* @brief TODO
*/
struct MsgHang : public Msg {
inline MsgHang()
: Msg(MSG_Hang)
{
}
// _00-_04 = Msg
// TODO: members
};
/**
* @brief TODO
*/
struct MsgOffWall : public Msg {
inline MsgOffWall()
: Msg(MSG_OffWall)
{
}
// _00-_04 = Msg
// TODO: members
};
/**
* @brief TODO
*/
struct MsgStick : public Msg {
inline MsgStick()
: Msg(MSG_Stick)
{
}
// _00-_04 = Msg
// TODO: members
};
/**
* @brief TODO
*/
struct MsgTarget : public Msg {
MsgTarget(Creature* target)
: Msg(MSG_Target)
{
mTarget = target;
}
// _00-_04 = Msg
Creature* mTarget; // _04
};
/**
* @brief TODO
*/
struct MsgUser : public Msg {
inline MsgUser(u32 val)
: Msg(MSG_User)
{
_04 = val;
}
// _00-_04 = Msg
u32 _04; // _04, could be int
};
@ -97,6 +178,13 @@ struct MsgUser : public Msg {
* @brief TODO
*/
struct MsgWall : public Msg {
inline MsgWall()
: Msg(MSG_Wall)
{
}
// _00-_04 = Msg
// TODO: members
};
#endif

View File

@ -102,7 +102,10 @@ struct Navi : public Creature, public PaniAnimKeyListener, public PelletView {
// _000-_2B8 = Creature
// _2B8-_2BC = PaniAnimKeyListener
// _2BC-_2C4 = PelletView
u8 _2C4[0xADC - 0x2C4]; // _2C4, TODO: work out members
u8 _2C4[0x7E4 - 0x2C4]; // _2C4, TODO: work out members
u8 _7E4; // _7E4
u8 _7E5; // _7E5
u8 _7E6[0xADC - 0x7E6]; // _7E6, TODO: work out members
NaviState* mCurrState; // _ADC
};

View File

@ -52,6 +52,8 @@ struct PaniAnimator : public Animator {
// unused/inlined:
void checkCounter_4DEBUG();
inline bool isFinished() const { return mIsFinished; }
inline int getInfoKeyValue(int idx) { return mAnimInfo->getInfoKey(idx)->_00; }
inline int getEventKeyValue(int idx) { return mAnimInfo->getEventKey(idx)->_00; }
inline f32 getKeyValue(int idx) { return mAnimInfo->getKeyValue(idx); }
@ -64,7 +66,7 @@ struct PaniAnimator : public Animator {
int _38; // _38
u8 _3C[0x4]; // _3C, unknown
u32 _40; // _40, unknown
int _44; // _44
int mMotionIdx; // _44
bool mIsFinished; // _48
u32 _4C; // _4C, unknown
PaniMotionTable* mMotionTable; // _50
@ -79,7 +81,7 @@ struct PaniItemAnimator : public PaniAnimator {
PaniMotionTable* createMotionTable();
// _30 = VTBL
// _00-_34 = PaniAnimator
// _00-_54 = PaniAnimator
// TODO: members
};
@ -89,25 +91,10 @@ struct PaniItemAnimator : public PaniAnimator {
struct PaniPelletAnimator : public PaniAnimator {
PaniPelletAnimator();
PaniMotionTable* createMotionTable();
static PaniMotionTable* createMotionTable();
// _30 = VTBL
// _00-_34 = PaniAnimator
u8 _34[0x54 - 0x34]; // _34, unknown
// TODO: members
};
/**
* @brief TODO
*/
struct PaniPikiAnimator : public PaniAnimator {
PaniPikiAnimator();
PaniMotionTable* createMotionTable();
// _30 = VTBL
// _00-_34 = PaniAnimator
// TODO: members
// _00-_54 = PaniAnimator
};
/**
@ -116,10 +103,10 @@ struct PaniPikiAnimator : public PaniAnimator {
struct PaniPlantAnimator : public PaniAnimator {
PaniPlantAnimator();
PaniMotionTable* createMotionTable();
static PaniMotionTable* createMotionTable();
// _30 = VTBL
// _00-_34 = PaniAnimator
// _00-_54 = PaniAnimator
// TODO: members
};
@ -132,7 +119,7 @@ struct PaniTekiAnimator : public PaniAnimator {
static PaniMotionTable* createMotionTable();
// _30 = VTBL
// _00-_34 = PaniAnimator
// _00-_54 = PaniAnimator
// TODO: members
};
@ -142,33 +129,10 @@ struct PaniTekiAnimator : public PaniAnimator {
struct PaniUfoAnimator : public PaniAnimator {
PaniUfoAnimator();
PaniMotionTable* createMotionTable();
static PaniMotionTable* createMotionTable();
// _30 = VTBL
// _00-_34 = PaniAnimator
// TODO: members
};
/**
* @brief TODO
*/
struct PaniPikiAnimMgr {
PaniPikiAnimMgr();
void init(AnimMgr*, AnimContext*, AnimContext*, PaniMotionTable*);
void changeContext(AnimContext*, AnimContext*);
void startMotion(PaniMotionInfo*, PaniMotionInfo*);
void finishMotion(PaniMotionInfo*, PaniMotionInfo*);
void startMotion(PaniMotionInfo&, PaniMotionInfo&);
void finishMotion(PaniAnimKeyListener*);
void updateAnimation(f32);
void updateContext();
// unused/inlined:
PaniMotionTable* getMotionTable();
static PaniMotionTable* motionTable;
// _00-_54 = PaniAnimator
// TODO: members
};
@ -181,7 +145,7 @@ struct PaniMotionInfo {
void init(int, PaniAnimKeyListener*);
int _00; // _00
int mMotionIdx; // _00
PaniAnimKeyListener* mListener; // _04
};
@ -208,8 +172,8 @@ struct PaniMotion {
struct PaniMotionTable {
PaniMotionTable(int);
int mMotionCount; // _00
PaniMotion** _04; // _04
int mMotionCount; // _00
PaniMotion** mMotions; // _04
};
/**
@ -219,7 +183,7 @@ struct PaniSoundTable {
PaniSoundTable(int);
int mSoundCount; // _00
u32** _04; // _04, array of some type of pointer
u32** mSounds; // _04, array of some type of pointer
};
#endif

150
include/PaniPikiAnimator.h Normal file
View File

@ -0,0 +1,150 @@
#ifndef _PANIPIKIANIMATOR_H
#define _PANIPIKIANIMATOR_H
#include "types.h"
#include "PaniAnimator.h"
/**
* @brief Animation indices for Piki and Navi
*/
enum PikiNaviAnim {
PIKIANIM_Run = 0, // Run
PIKIANIM_Nigeru = 1, // 'Run away'
PIKIANIM_Walk = 2, // Walk
PIKIANIM_Wait = 3, // Wait
PIKIANIM_Pick = 4, // Pick (up)
PIKIANIM_Nuku = 5, // 'Pluck'
PIKIANIM_Nukareru = 6, // 'Be plucked'
PIKIANIM_Dead = 7, // Dead
PIKIANIM_Dead2 = 8, // Dead (2)
PIKIANIM_Dead3 = 9, // Dead (3)
PIKIANIM_Damage = 10, // Damage
PIKIANIM_Asibumi = 11, // 'Step'
PIKIANIM_OCarry = 12, // 'O(limar) carry'
PIKIANIM_LSuberu = 13, // 'L slip'
PIKIANIM_RSuberu = 14, // 'R slip'
PIKIANIM_Tanemaki = 15, // 'seed sowing'
PIKIANIM_Job1 = 16, // Job (1)
PIKIANIM_GrowUp1 = 17, // Grow up (1)
PIKIANIM_GrowUp2 = 18, // Grow up (2)
PIKIANIM_Job2 = 19, // Job (2)
PIKIANIM_Korobu = 20, // 'Fall'
PIKIANIM_Jump = 21, // Jump
PIKIANIM_StillJump = 22, // Still jump
PIKIANIM_Attack = 23, // Attack
PIKIANIM_Butukaru = 24, // 'Collide'
PIKIANIM_Punch = 25, // Punch
PIKIANIM_Kenka = 26, // 'Fight'
PIKIANIM_Throw = 27, // Throw
PIKIANIM_Hang = 28, // Hang
PIKIANIM_Fall = 29, // Fall
PIKIANIM_JKoke = 30, // 'J Moss(?)'
PIKIANIM_JHit = 31, // J Hit
PIKIANIM_GetUp = 32, // Get up
PIKIANIM_NewJmp = 33, // New jump
PIKIANIM_RollJmp = 34, // Roll jump
PIKIANIM_WaveJmp = 35, // Wave jump
PIKIANIM_ThrowWait = 36, // Throw wait
PIKIANIM_Push = 37, // Push
PIKIANIM_Umaru = 38, // 'Bury'
PIKIANIM_Akubi = 39, // 'Yawn'
PIKIANIM_Rinbow = 40, // 'Rainbow'
PIKIANIM_Iraira = 41, // 'Annoyed'
PIKIANIM_Furimuku = 42, // 'Turn around'
PIKIANIM_JumpKick = 43, // Jump Kick
PIKIANIM_Kaifuku = 44, // 'Recovery'
PIKIANIM_Kizuku = 45, // 'Scratches'
PIKIANIM_PickLoop = 46, // Pick (up) loop
PIKIANIM_Mizunomi = 47, // 'Water only'
PIKIANIM_Kuttuku = 48, // 'Stick'
PIKIANIM_Fue = 49, // 'Flute (whistle)'
PIKIANIM_Suwaru = 50, // 'Sit'
PIKIANIM_Aogu = 51, // 'Fan'
PIKIANIM_Neru = 52, // 'Sleep'
PIKIANIM_Press1 = 53, // Press (1)
PIKIANIM_Press2 = 54, // Press (2)
PIKIANIM_SPress = 55, // S Press
PIKIANIM_TYakusui = 56, // 'T Easy(?)'
PIKIANIM_Oboreru = 57, // 'Drowning'
PIKIANIM_Sizumu = 58, // 'Sink' or 'Trembling'?
PIKIANIM_Hikakaru = 59, // 'Get hit'
PIKIANIM_Otikake = 60, // 'Fall'
PIKIANIM_Otiru = 61, // 'Fall'
PIKIANIM_HNoboru = 62, // 'H Climb' (horizontal?)
PIKIANIM_Noboru = 63, // 'Climb'
PIKIANIM_Chatting = 64, // Chatting
PIKIANIM_Sagasu2 = 65, // 'Search (2)'
PIKIANIM_Otikake2 = 66, // 'Fall (2)'
PIKIANIM_Kaifuku3 = 67, // 'Recovery (2)'
PIKIANIM_Punch2 = 68, // 'Punch!'
PIKIANIM_Moeru = 69, // 'Burn'
PIKIANIM_Esa = 70, // 'Food'
PIKIANIM_GameOver = 71, // Game over
PIKIANIM_Gattu = 72, // 'Gluttony'
PIKIANIM_Gakkari = 73, // 'Disappointed'
PIKIANIM_Okoru = 74, // 'Occur'?
PIKIANIM_RotJump = 75, // Rotate jump
PIKIANIM_GWait1 = 76, // G wait (1)
PIKIANIM_GWait2 = 77, // G wait (2)
PIKIANIM_GFuri1 = 78, // 'G pretend (1)'
PIKIANIM_GFuri2 = 79, // 'G pretend (2)'
PIKIANIM_GNuke = 80, // 'G escape'
PIKIANIM_Jump_B1 = 81, // Jump B(1)
PIKIANIM_Nuku_Fast = 82, // 'Pluck' fast
PIKIANIM_Nukare_Fast = 83, // 'Be plucked' fast
PIKIANIM_Mizuage = 84, // 'Water' something
PIKIANIM_Sagasu = 85, // 'Search'
PIKIANIM_Osu = 86, // 'Push'
PIKIANIM_Osu_Walk = 87, // 'Push walk'
PIKIANIM_Noru = 88, // 'Ride'
PIKIANIM_ODead = 89, // O(limar) dead
PIKIANIM_COUNT, // 90
};
/**
* @brief TODO
*/
struct PaniPikiAnimator : public PaniAnimator {
PaniPikiAnimator();
static PaniMotionTable* createMotionTable();
static char* motionLabels[90];
// _30 = VTBL
// _00-_54 = PaniAnimator
// TODO: members
};
/**
* @brief TODO
*
* @note Size: 0xAC.
*/
struct PaniPikiAnimMgr {
PaniPikiAnimMgr();
void init(AnimMgr*, AnimContext*, AnimContext*, PaniMotionTable*);
void changeContext(AnimContext*, AnimContext*);
void startMotion(PaniMotionInfo*, PaniMotionInfo*);
void finishMotion(PaniMotionInfo*, PaniMotionInfo*);
void startMotion(PaniMotionInfo&, PaniMotionInfo&);
void finishMotion(PaniAnimKeyListener*);
void updateAnimation(f32);
void updateContext();
// unused/inlined:
static PaniMotionTable* getMotionTable();
inline bool isFinished() const { return _04.isFinished(); }
inline f32 getAnimSpeed() { return mAnimSpeed; }
inline void setAnimSpeed(f32 speed) { mAnimSpeed = speed; }
static PaniMotionTable* motionTable;
f32 mAnimSpeed; // _00
PaniPikiAnimator _04; // _04
PaniPikiAnimator _58; // _58
};
#endif

View File

@ -5,8 +5,10 @@
#include "DualCreature.h"
#include "CreatureProp.h"
#include "ObjectMgr.h"
#include "Animator.h"
struct PaniAnimKeyEvent;
struct PaniMotionTable;
struct PelletShapeObject;
struct PelletView;
struct Shape;
@ -133,7 +135,7 @@ struct PelletMgr : public MonoObjectMgr {
void registerUfoParts();
void newNumberPellet(int, int);
void newPellet(u32, PelletView*);
void getShapeObject(u32);
PelletShapeObject* getShapeObject(u32);
void addUseList(u32);
void initShapeInfos();
void getConfigIndex(u32);
@ -153,7 +155,9 @@ struct PelletMgr : public MonoObjectMgr {
// _08 = VTBL 2
// _00-_3C = MonoObjectMgr
// TODO: members
u8 _3C[0x204 - 0x3C]; // _3C, unknown
u8 _3C[0x1F8 - 0x3C]; // _3C, unknown
PaniMotionTable* _1F8; // _1F8
u8 _1FC[0x204 - 0x1FC]; // _1FC, unknown
};
/**
@ -161,6 +165,12 @@ struct PelletMgr : public MonoObjectMgr {
*/
struct PelletShapeObject {
PelletShapeObject(char*, Shape*, char*, char*, int);
Shape* mShape; // _00
AnimMgr* mAnimMgr; // _04
AnimContext _08; // _08
AnimContext _18; // _18
// TODO: members
};
extern PelletMgr* pelletMgr;

View File

@ -3,7 +3,7 @@
#include "types.h"
#include "Creature.h"
#include "PaniAnimator.h"
#include "PaniPikiAnimator.h"
struct TopAction;
struct Navi;
@ -152,33 +152,35 @@ struct Piki : public Creature, public PaniAnimKeyListener {
// _00 = VTBL
// _00-_2B8 = Creature
// _2B8 = PaniAnimKeyListener
u8 _2BC[0x3CC - 0x2BC]; // _2BC, TODO: work out members
int _3CC; // _3CC, piki color?
int _3D0; // _3D0, piki happa?
u8 _3D4[0x424 - 0x3D4]; // _3D4, unknown
u8 _424; // _424
u16 _426; // _426
u8 _428[0x8]; // _428, unknown
u32 _430; // _430, unknown
u8 _434[0x48C - 0x434]; // _434, unknown
f32 _48C; // _48C
PikiStateMachine* mFSM; // _490
u8 _494[0x4]; // _494, unknown
f32 _498; // _498
f32 _49C; // _49C, some form of angle?
u8 _4A0[4]; // _4A0, unknown
CollPart* mSwallowMouthPart; // _4A4
Creature* _4A8; // _4A8, maybe puffstool/kinoko leader?
u8 _4AC[0x4F8 - 0x4AC]; // _4AC, unknown
TopAction* _4F8; // _4F8, may be just Action*
u16 _4FC; // _4FC
u32 _500; // _500, unknown
Navi* mNavi; // _504
u8 _508[0x8]; // _508, unknown
u16 mColor; // _510, red/yellow/blue
u8 _512[0x520 - 0x512]; // _4FC, TODO: work out members
int mHappa; // _520, leaf/bud/flower
u8 _524[0x585 - 0x524]; // _4FC, TODO: work out members
u8 _2BC[0x354 - 0x2BC]; // _2BC, TODO: work out members
PaniPikiAnimMgr mPikiAnimMgr; // _354
u8 _400[0x408 - 0x400]; // _400, unknown
u8 _408; // _408
u8 _409; // _409
u8 _40A[0x424 - 0x40A]; // _40A, unknown
u8 _424; // _424
u16 _426; // _426
u8 _428[0x8]; // _428, unknown
u32 _430; // _430, unknown
u8 _434[0x48C - 0x434]; // _434, unknown
f32 _48C; // _48C
PikiStateMachine* mFSM; // _490
u8 _494[0x4]; // _494, unknown
f32 _498; // _498
f32 _49C; // _49C, some form of angle?
u8 _4A0; // _4A0
CollPart* mSwallowMouthPart; // _4A4
Creature* _4A8; // _4A8, maybe puffstool/kinoko leader?
u8 _4AC[0x4F8 - 0x4AC]; // _4AC, unknown
TopAction* _4F8; // _4F8, may be just Action*
u16 _4FC; // _4FC
u32 _500; // _500, unknown
Navi* mNavi; // _504
u8 _508[0x8]; // _508, unknown
u16 mColor; // _510, red/yellow/blue
u8 _512[0x520 - 0x512]; // _4FC, TODO: work out members
int mHappa; // _520, leaf/bud/flower
u8 _524[0x585 - 0x524]; // _4FC, TODO: work out members
};
/**

View File

@ -4,10 +4,13 @@
#include "types.h"
#include "Demo.h"
#include "ResultFlags.h"
#include "PaniAnimator.h"
#include "PaniPikiAnimator.h"
#include "PelletAnimator.h"
#include "Shape.h"
struct Graphics;
struct PelletShapeObject;
struct PermanentEffect;
struct Shape;
/**
@ -22,7 +25,7 @@ struct TimeGraph {
void set(int, int);
// TODO: members
int mNum[3]; // _00
};
TimeGraph(); // unused/inlined
@ -58,8 +61,16 @@ struct PlayerState {
void startMotion(int, int);
void stopMotion();
// _00 = VTBL?
u8 _04[0xE0 - 0x4]; // _04, unknown
// _00 = VTBL
int _04; // _04
u32 _08; // _08
u32 _0C; // _0C
PelletAnimator mAnimator; // _10
Vector3f _B8; // _B8
ShapeDynMaterials _C4; // _C4
PelletShapeObject* mPelletShape; // _D4
f32 _D8; // _D8
u8 _DC; // _DC
};
PlayerState();
@ -67,11 +78,11 @@ struct PlayerState {
bool isEnding();
bool existUfoParts(u32);
void initGame();
void courseOpen(int);
void happyEndable();
bool courseOpen(int);
bool happyEndable();
void setChallengeMode();
void getPartsGetCount(int);
void getCardUfoPartsCount();
int getCardUfoPartsCount();
void getTotalPikiCount(int);
void saveCard(RandomAccessStream&);
void loadCard(RandomAccessStream&);
@ -86,7 +97,7 @@ struct PlayerState {
void initCourse();
void exitCourse();
void setNavi(bool);
void getFinalDeadPikis();
int getFinalDeadPikis();
void updateFinalResult();
int getCurrDay();
int getTotalDays();
@ -119,25 +130,36 @@ struct PlayerState {
static int totalUfoParts;
// TODO: members
u8 _00[0x54]; // _00, unknown
u8 _00[0x11]; // _00, unknown
u8 _11; // _11
u8 _12[0x54 - 0x12]; // _12, 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 _170; // _170
int mTotalParts; // _174
UfoParts* mUfoParts; // _178
int mCurrParts; // _17C
u32 _180; // _180, unknown
int _180; // _180
u8 _184; // _184
u8 _185; // _185
bool _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
u8 _18C[0x1A0 - 0x18C]; // _18C, unknown
int _1A0; // _1A0, final dead pikis count?
u8 _1A4[0x1AC - 0x1A4]; // _1A4, unknown
u8 _1AC; // _1AC
u8 _1AD[0x1B4 - 0x1AD]; // _1AD, unknown
u8 _1B4; // _1B4
u8 _1B5; // _1B5
u8 _1B6; // _1B6
PermanentEffect* _1B8; // _1B8
PermanentEffect* _1BC; // _1BC
Vector3f _1C0; // _1C0
};

View File

@ -12,38 +12,38 @@ struct Receiver {
virtual void procMsg(T* target, Msg* msg) // _08 (weak)
{
switch (msg->_00) {
case 0:
switch (msg->mMsgType) {
case MSG_Bounce:
procBounceMsg(target, static_cast<MsgBounce*>(msg));
break;
case 8:
case MSG_Stick:
procStickMsg(target, static_cast<MsgStick*>(msg));
break;
case 1:
case MSG_Hang:
procHangMsg(target, static_cast<MsgHang*>(msg));
break;
case 2:
case MSG_Target:
procTargetMsg(target, static_cast<MsgTarget*>(msg));
break;
case 3:
case MSG_Collide:
procCollideMsg(target, static_cast<MsgCollide*>(msg));
break;
case 4:
case MSG_Anim:
procAnimMsg(target, static_cast<MsgAnim*>(msg));
break;
case 5:
case MSG_Damage:
procDamageMsg(target, static_cast<MsgDamage*>(msg));
break;
case 6:
case MSG_Wall:
procWallMsg(target, static_cast<MsgWall*>(msg));
break;
case 7:
case MSG_OffWall:
procOffWallMsg(target, static_cast<MsgOffWall*>(msg));
break;
case 10:
case MSG_User:
procUserMsg(target, static_cast<MsgUser*>(msg));
break;
case 9:
case MSG_Ground:
procGroundMsg(target, static_cast<MsgGround*>(msg));
break;
}

View File

@ -61,8 +61,21 @@ struct MtxGroup {
* @brief TODO
*/
struct ShapeDynMaterials {
ShapeDynMaterials()
: _00(0)
, _04(0)
, _08(0)
, _0C(0)
{
}
void animate(f32*);
void updateContext();
u32 _00; // _00, unknown
u32 _04; // _04, unknown
u32 _08; // _08, unknown
u32 _0C; // _0C, unknown
};
/**

View File

@ -5,6 +5,8 @@
#include "AICreature.h"
#include "StateMachine.h"
struct SAIEvent;
/**
* @brief TODO
*/
@ -15,20 +17,6 @@ struct SAIAction {
// TODO: members
};
/**
* @brief TODO
*/
struct SAIArrow : public CoreNode {
inline SAIArrow()
: CoreNode("SAIArrowRoot")
{
}
// _00 = VTBL
// _00-_14 = CoreNode
// TODO: members
};
/**
* @brief TODO
*/
@ -45,6 +33,32 @@ struct SAICondition : public CoreNode {
// TODO: members
};
/**
* @brief TODO
*/
struct SAIArrow : public CoreNode {
inline SAIArrow(char* name, SAIEvent* event, int p3)
: CoreNode(name)
{
_18 = event;
_14 = p3;
}
inline SAIArrow(char* name)
: CoreNode(name)
{
_14 = -1;
_18 = nullptr;
}
// _00 = VTBL
// _00-_14 = CoreNode
int _14; // _14
SAIEvent* _18; // _18
int mArrowIdx; // _1C
SAICondition mCondition; // _20
};
/**
* @brief TODO
*
@ -155,6 +169,8 @@ struct SAIUserEvent : public SAIEvent {
/**
* @brief TODO
*
* @note Size: 0x58.
*/
struct SAIState : public AState<AICreature> {
SAIState(int);
@ -166,12 +182,13 @@ struct SAIState : public AState<AICreature> {
// _00 = VTBL
// _00-_0C = AState
char* mName; // _0C, probably
SAIArrow mArrow; // _0C
int _24; // _24
u32 _28; // _28, unknown
u32 _2C; // _2C, unknown
SAICondition mCondition; // _30
char* mName; // _0C, probably
SAIArrow mRootArrow; // _10
int mArrowCount; // _44
int _48; // _48
SAIAction* _4C; // _4C
SAIAction* _50; // _50
SAIAction* _54; // _54
};
/**
@ -184,10 +201,12 @@ struct SimpleAI : public StateMachine<AICreature> {
virtual void procMsg(AICreature*, Msg*); // _10
void addState(int, int, SAIAction*, SAIAction*, SAIAction*);
void addArrow(int, SAIEvent*, int);
SAIArrow* addArrow(int, SAIEvent*, int);
void start(AICreature*, int);
void checkEvent(AICreature*);
inline SAIState* getState(int idx) { return static_cast<SAIState*>(mStates[idx]); }
// _00 = VTBL
// _00-_1C = StateMachine
// TODO: members

View File

@ -4,6 +4,9 @@
#include "types.h"
#include "Receiver.h"
template <typename T>
struct StateMachine;
struct Msg;
/**
@ -13,7 +16,7 @@ template <typename T>
struct AState : public Receiver<T> {
inline AState(int stateID)
: mStateID(stateID)
, _08(0)
, mStateMachine(nullptr)
{
}
@ -27,8 +30,8 @@ struct AState : public Receiver<T> {
inline int getStateID() const { return mStateID; }
// _00 = VTBL
int mStateID; // _04
u32 _08; // _08, unknown
int mStateID; // _04
StateMachine<T>* mStateMachine; // _08
};
/**
@ -46,9 +49,37 @@ struct StateMachine {
virtual void procMsg(T*, Msg*); // _10
virtual void transit(T*, int); // _14
inline bool isValidState(AState<T>* state)
{
if (state->mStateID < 0 || state->mStateID >= mStateLimit) {
return false;
}
return true;
}
inline AState<T>* getState(int idx) { return mStates[idx]; }
inline void setState(int idx, AState<T>* state) { mStates[idx] = state; }
inline void appendState(AState<T>* state) { setState(mStateCount, state); }
inline void initState(AState<T>* state)
{
state->mStateMachine = this;
mStateIDs[mStateCount] = state->mStateID;
mStateIndexes[state->mStateID] = mStateCount;
mStateCount++;
}
inline bool isFull() { return mStateCount >= mStateLimit; }
// _00 = VTBL
u8 _04[0x18 - 0x4]; // _04, unknown
int _18; // _18, state ID?
AState<T>** mStates; // _04
int mStateCount; // _08
int mStateLimit; // _0C
int* mStateIDs; // _10, indexed by state index (load order)
int* mStateIndexes; // _14, indexed by state IDs
int _18; // _18, state ID?
};
#endif

View File

@ -43,7 +43,9 @@ struct GameFlow : public Node {
// _00 = VTBL
// _00-_20 = Node
u8 _20[0x1F0 - 0x20]; // _20, unknown
u8 _20[0x1C8 - 0x20]; // _20, unknown
u32 _1C8; // _1C8, maybe course open flags?
u8 _1CC[0x1F0 - 0x1CC]; // _1CC, unknown
u32 _1F0; // _1F0, could be int
int _1F4; // _1F4
u8 _1F8[0x2B0 - 0x1F8]; // _1F8, unknown

View File

@ -66,4 +66,24 @@ static inline f32 sqrtf(f32 x)
return x;
}
#ifdef __cplusplus
// Pikmin-specific global math functions
struct Vector3f;
struct BoundBox;
struct KTri;
struct KRect;
struct KSegment;
f32 roundAng(f32 angle);
f32 angDist(f32 x, f32 z);
f32 qdist2(f32 x0, f32 z0, f32 x1, f32 z1);
f32 triRectDistance(Vector3f*, Vector3f*, Vector3f*, BoundBox&, bool);
f32 distanceTriRect(KTri&, KRect&, f32*, f32*, f32*, f32*);
f32 sqrDistance(KSegment&, KTri&, f32*, f32*, f32*);
f32 sqrDistance(KSegment&, KSegment&, f32*, f32*);
f32 sqrDistance(KSegment&, KRect&, f32*, f32*, f32*);
f32 sqrDistance(KTri&, KRect&, f32*, f32*, f32*, f32*);
f32 sqrDistance(Vector3f&, KTri&, f32*, f32*);
#endif
#endif // _MATH_H

View File

@ -454,13 +454,13 @@ void PelletAnimator::updateContext()
PaniMotionTable* PaniPelletAnimator::createMotionTable()
{
PaniMotionTable* table = new PaniMotionTable(7);
table->_04[0] = new PaniMotion(0);
table->_04[1] = new PaniMotion(1);
table->_04[2] = new PaniMotion(2);
table->_04[3] = new PaniMotion(3);
table->_04[4] = new PaniMotion(4);
table->_04[5] = new PaniMotion(5);
table->_04[6] = new PaniMotion(6);
table->mMotions[0] = new PaniMotion(0);
table->mMotions[1] = new PaniMotion(1);
table->mMotions[2] = new PaniMotion(2);
table->mMotions[3] = new PaniMotion(3);
table->mMotions[4] = new PaniMotion(4);
table->mMotions[5] = new PaniMotion(5);
table->mMotions[6] = new PaniMotion(6);
return table;
}

View File

@ -576,7 +576,7 @@ void Creature::init()
_1A0 = -1;
resetCreatureFlag(CF_Unk19);
_21C = 0;
setCreatureFlag(CF_Unk13);
setCreatureFlag(CF_Free);
resetCreatureFlag(CF_Unk9 | CF_Unk12 | CF_Unk14 | CF_Unk20);
_D0 = 0.0f;
_2A8 = nullptr;
@ -673,9 +673,7 @@ void Creature::kill(bool p1)
AState<AICreature>* state = static_cast<BombItem*>(bomb)->getCurrState();
int currState = state->getStateID();
if (currState != 1) {
MsgUser msg;
msg._00 = MSG_User;
msg._04 = 1;
MsgUser msg(1);
static_cast<BombItem*>(bomb)->_2D0 = 1;
static_cast<BombItem*>(bomb)->mStateMachine->procMsg(static_cast<BombItem*>(bomb), &msg);
}

View File

@ -428,7 +428,7 @@ bool InteractAttack::actPiki(Piki* piki)
piki->finishDamage();
piki->mFSM->transit(piki, PIKISTATE_Dying);
} else {
piki->startMotion(PaniMotionInfo(10, piki), PaniMotionInfo(10));
piki->startMotion(PaniMotionInfo(PIKIANIM_Damage, piki), PaniMotionInfo(PIKIANIM_Damage));
}
return true;
}
@ -463,9 +463,9 @@ bool InteractSwallow::actPiki(Piki* piki)
piki->getState();
if (_08 == 0) {
piki->startMotion(PaniMotionInfo(70), PaniMotionInfo(70));
piki->startMotion(PaniMotionInfo(PIKIANIM_Esa), PaniMotionInfo(PIKIANIM_Esa));
} else {
piki->startMotion(PaniMotionInfo(29), PaniMotionInfo(29));
piki->startMotion(PaniMotionInfo(PIKIANIM_Fall), PaniMotionInfo(PIKIANIM_Fall));
}
piki->mFSM->transit(piki, PIKISTATE_Swallowed);
@ -795,9 +795,7 @@ bool InteractPress::actPiki(Piki* piki)
Creature* bomb = piki->_2AC;
bomb->resetStateGrabbed();
if (bomb->mObjType == OBJTYPE_Bomb) {
MsgUser msg;
msg._00 = MSG_User;
msg._04 = 1;
MsgUser msg(1);
static_cast<BombItem*>(bomb)->_2D0 = 0;
static_cast<BombItem*>(bomb)->mStateMachine->procMsg(static_cast<BombItem*>(bomb), &msg);
}

View File

@ -2,6 +2,7 @@
#include "Msg.h"
#include "Piki.h"
#include "PikiAI.h"
#include "PikiState.h"
static char file[] = __FILE__;
static char name[] = "interactEtc";
@ -33,25 +34,9 @@ static void _Print(char*, ...)
*/
bool InteractTalk::actPiki(Piki* piki)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
li r0, 0x2
stwu r1, -0x18(r1)
lwz r3, 0x4(r3)
stw r0, 0x10(r1)
stw r3, 0x14(r1)
lwz r3, 0x4F8(r4)
addi r4, r1, 0x10
bl 0x470C8
li r3, 0x1
lwz r0, 0x1C(r1)
addi r1, r1, 0x18
mtlr r0
blr
*/
MsgTarget msg(mOwner);
piki->_4F8->procMsg(&msg);
return true;
}
/*
@ -61,88 +46,25 @@ bool InteractTalk::actPiki(Piki* piki)
*/
bool InteractWarn::actPiki(Piki* piki)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
stwu r1, -0x18(r1)
stw r31, 0x14(r1)
stw r30, 0x10(r1)
addi r30, r4, 0
addi r3, r30, 0
bl 0x4BB04
addi r31, r3, 0
addi r3, r30, 0
lwz r12, 0x0(r30)
lwz r12, 0x88(r12)
mtlr r12
blrl
rlwinm. r0,r3,0,24,31
bne- .loc_0x48
li r3, 0
b .loc_0xEC
int state = piki->getState();
if (!piki->isAlive()) {
return false;
}
.loc_0x48:
mr r3, r30
lwz r12, 0x0(r30)
lwz r12, 0x120(r12)
mtlr r12
blrl
rlwinm. r0,r3,0,24,31
bne- .loc_0x7C
lbz r0, 0x409(r30)
cmplwi r0, 0
beq- .loc_0x7C
lhz r0, 0x4FC(r30)
cmplwi r0, 0x1
bne- .loc_0x84
if (piki->isKinoko() || !piki->_409 || piki->_4FC == 1) {
return false;
}
.loc_0x7C:
li r3, 0
b .loc_0xEC
if (state == PIKISTATE_Swallowed || state == PIKISTATE_Drown || state == PIKISTATE_LookAt || state == PIKISTATE_Pressed) {
return false;
}
.loc_0x84:
cmpwi r31, 0x8
beq- .loc_0xA4
cmpwi r31, 0x18
beq- .loc_0xA4
cmpwi r31, 0x1A
beq- .loc_0xA4
cmpwi r31, 0x21
bne- .loc_0xAC
if (piki->_2B4 == 0 && state != PIKISTATE_Flick) {
piki->mFSM->transit(piki, PIKISTATE_LookAt);
.loc_0xA4:
li r3, 0
b .loc_0xEC
} else {
piki->_4A0 = 1;
}
.loc_0xAC:
lbz r0, 0x2B4(r30)
cmplwi r0, 0
bne- .loc_0xE0
cmpwi r31, 0x16
beq- .loc_0xE0
lwz r3, 0x490(r30)
addi r4, r30, 0
li r5, 0x1A
lwz r12, 0x0(r3)
lwz r12, 0x14(r12)
mtlr r12
blrl
b .loc_0xE8
.loc_0xE0:
li r0, 0x1
stb r0, 0x4A0(r30)
.loc_0xE8:
li r3, 0x1
.loc_0xEC:
lwz r0, 0x1C(r1)
lwz r31, 0x14(r1)
lwz r30, 0x10(r1)
addi r1, r1, 0x18
mtlr r0
blr
*/
return true;
}

View File

@ -45,81 +45,10 @@ bool InteractGrab::actCommon(Creature* creature)
* Address: 8007C8D8
* Size: 000120
*/
bool InteractRelease::actCommon(Creature*)
bool InteractRelease::actCommon(Creature* creature)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
stwu r1, -0xB8(r1)
stfd f31, 0xB0(r1)
stfd f30, 0xA8(r1)
stfd f29, 0xA0(r1)
stw r31, 0x9C(r1)
addi r31, r4, 0
stw r30, 0x98(r1)
addi r30, r3, 0
addi r3, r31, 0
bl 0xE0D0
lwz r4, 0x4(r30)
mr r5, r31
lfs f0, -0x6358(r13)
addi r3, r1, 0x60
lfsu f1, 0x70(r4)
lfs f2, -0x76A8(r2)
fadds f1, f1, f0
lfs f0, -0x6354(r13)
stfs f1, 0x48(r1)
lfs f1, 0x48(r1)
stfs f1, 0x88(r1)
lfs f1, 0x8(r30)
lfs f3, 0x4(r4)
fmuls f1, f2, f1
fadds f1, f3, f1
stfs f1, 0x8C(r1)
lfs f1, 0x8(r4)
fadds f0, f1, f0
stfs f0, 0x90(r1)
lwz r4, 0x88(r1)
lwz r0, 0x8C(r1)
stw r4, 0x70(r31)
stw r0, 0x74(r31)
lwz r0, 0x90(r1)
stw r0, 0x78(r31)
lwz r4, 0x4(r30)
lfs f31, -0x6350(r13)
lwz r12, 0x0(r4)
lfs f30, -0x634C(r13)
lwz r12, 0x100(r12)
lfs f29, -0x6348(r13)
mtlr r12
blrl
lfs f0, 0x60(r1)
li r3, 0x1
lfs f1, 0x64(r1)
fadds f2, f0, f31
lfs f0, 0x68(r1)
fadds f1, f1, f30
fadds f0, f0, f29
stfs f2, 0x3C(r1)
lfs f2, 0x3C(r1)
stfs f2, 0x6C(r1)
stfs f1, 0x70(r1)
stfs f0, 0x74(r1)
lwz r4, 0x6C(r1)
lwz r0, 0x70(r1)
stw r4, 0x94(r31)
stw r0, 0x98(r31)
lwz r0, 0x74(r1)
stw r0, 0x9C(r31)
lwz r0, 0xBC(r1)
lfd f31, 0xB0(r1)
lfd f30, 0xA8(r1)
lfd f29, 0xA0(r1)
lwz r31, 0x9C(r1)
lwz r30, 0x98(r1)
addi r1, r1, 0xB8
mtlr r0
blr
*/
creature->resetStateGrabbed();
creature->_70 = mOwner->_70 + Vector3f(0.0f, 100.0f * _08, 0.0f);
creature->mPosition = mOwner->getCatchPos(creature) + Vector3f(0.0f, 8.0f, 0.0f);
return true;
}

View File

@ -1,4 +1,7 @@
#include "Interactions.h"
#include "Piki.h"
#include "Navi.h"
#include "PikiState.h"
/*
* --INFO--
@ -32,8 +35,22 @@ bool InteractPullout::actCommon(Creature*) { return true; }
* Address: 8007CB40
* Size: 0002BC
*/
bool InteractPullout::actPiki(Piki*)
bool InteractPullout::actPiki(Piki* piki)
{
if (piki->getState() == PIKISTATE_Nukare) {
return false;
}
piki->mDirection = roundAng(mOwner->mDirection);
piki->_88.set(0.0f, piki->mDirection, 0.0f);
piki->mFSM->transit(piki, PIKISTATE_Nukare);
if (piki->mNavi->_7E5) {
piki->mPikiAnimMgr.startMotion(PaniMotionInfo(PIKIANIM_Nukare_Fast, piki), PaniMotionInfo(PIKIANIM_Nukare_Fast));
} else {
piki->mPikiAnimMgr.startMotion(PaniMotionInfo(PIKIANIM_Nukareru, piki), PaniMotionInfo(PIKIANIM_Nukareru));
}
/*
.loc_0x0:
mflr r0

View File

@ -3824,7 +3824,7 @@ void ItemCreature::setMotionSpeed(f32)
* Address: 800F59EC
* Size: 000008
*/
void ItemCreature::getMotionSpeed()
f32 ItemCreature::getMotionSpeed()
{
/*
.loc_0x0:
@ -3853,7 +3853,7 @@ void ItemCreature::stopMotion()
* Address: 800F5A00
* Size: 000008
*/
void ItemCreature::getCurrentMotionCounter()
f32 ItemCreature::getCurrentMotionCounter()
{
/*
.loc_0x0:
@ -3867,7 +3867,7 @@ void ItemCreature::getCurrentMotionCounter()
* Address: 800F5A08
* Size: 00002C
*/
void ItemCreature::getCurrentMotionName()
char* ItemCreature::getCurrentMotionName()
{
/*
.loc_0x0:

File diff suppressed because it is too large Load Diff

View File

@ -5253,7 +5253,7 @@ void PelletMgr::newPellet(u32, PelletView*)
* Address: 80098704
* Size: 000094
*/
void PelletMgr::getShapeObject(u32)
PelletShapeObject* PelletMgr::getShapeObject(u32)
{
/*
.loc_0x0:

View File

@ -221,8 +221,7 @@ void BaseInf::loadCard(RandomAccessStream& card)
*/
BPikiInf::BPikiInf()
{
mPikiHappa = Leaf;
mPikiColor = Blue;
_2C = _2D = 0;
// UNUSED FUNCTION
}
@ -234,7 +233,7 @@ BPikiInf::BPikiInf()
void BPikiInf::saveCard(RandomAccessStream& card)
{
BaseInf::saveCard(card);
u8 byte = (mPikiHappa << 2) | mPikiColor;
u8 byte = (_2D << 2) | _2C;
card.writeByte(byte);
}
@ -246,9 +245,9 @@ void BPikiInf::saveCard(RandomAccessStream& card)
void BPikiInf::loadCard(RandomAccessStream& card)
{
BaseInf::loadCard(card);
u8 byte = card.readByte();
mPikiColor = byte & 0x3;
mPikiHappa = (byte >> 2) & 0x3F;
u8 byte = card.readByte();
_2C = byte & 0x3;
_2D = (byte >> 2) & 0x3F;
}
/*
@ -258,8 +257,8 @@ void BPikiInf::loadCard(RandomAccessStream& card)
*/
void BPikiInf::doStore(Creature* piki)
{
mPikiColor = static_cast<Piki*>(piki)->_3CC;
mPikiHappa = static_cast<Piki*>(piki)->_3D0;
_2C = static_cast<Piki*>(piki)->mPikiAnimMgr._58._20;
_2D = static_cast<Piki*>(piki)->mPikiAnimMgr._58._24;
}
/*
@ -269,8 +268,8 @@ void BPikiInf::doStore(Creature* piki)
*/
void BPikiInf::doRestore(Creature* piki)
{
static_cast<Piki*>(piki)->_3CC = mPikiColor;
static_cast<Piki*>(piki)->_3D0 = mPikiHappa;
static_cast<Piki*>(piki)->mPikiAnimMgr._58._20 = _2C;
static_cast<Piki*>(piki)->mPikiAnimMgr._58._24 = _2D;
}
/*
@ -400,7 +399,7 @@ int BPikiInfMgr::getPikiCount(int color)
int count = 0;
FOREACH_NODE(BPikiInf, mActiveList.mChild, currInf)
{
if (currInf->mPikiColor == color) {
if (currInf->_2C == color) {
count++;
}
}

View File

@ -1,7 +1,13 @@
#include "PlayerState.h"
#include "Generator.h"
#include "FlowController.h"
#include "gameflow.h"
#include "UtEffect.h"
#include "OnePlayerSection.h"
#include "Pellet.h"
#include "sysNew.h"
#include "Shape.h"
#include "Piki.h"
int PlayerState::totalUfoParts = 30;
@ -636,24 +642,14 @@ PlayerState::PlayerState()
* Address: 8007FAA8
* Size: 00002C
*/
void TimeGraph::PikiNum::set(int, int)
void TimeGraph::PikiNum::set(int color, int num)
{
/*
.loc_0x0:
cmpwi r4, 0
blt- .loc_0x1C
cmpwi r4, 0x2
bgt- .loc_0x1C
rlwinm r0,r4,2,0,29
stwx r5, r3, r0
blr
if (color >= PikiMinColor && color <= PikiMaxColor) {
mNum[color] = num;
return;
}
.loc_0x1C:
stw r5, 0x8(r3)
stw r5, 0x4(r3)
stw r5, 0x0(r3)
blr
*/
mNum[Blue] = mNum[Red] = mNum[Yellow] = num;
}
/*
@ -661,69 +657,19 @@ void TimeGraph::PikiNum::set(int, int)
* Address: 8007FAD4
* Size: 000070
*/
PlayerState::UfoParts::UfoParts()
{
/*
.loc_0x0:
mflr r0
lis r4, 0x802B
stw r0, 0x4(r1)
subi r0, r4, 0x246C
stwu r1, -0x18(r1)
stw r31, 0x14(r1)
addi r31, r3, 0
lis r3, 0x802B
stw r0, 0x0(r31)
subi r0, r3, 0x21F8
addi r3, r31, 0x10
stw r0, 0x0(r31)
bl 0x19E68
lfs f0, -0x7620(r2)
li r0, 0
addi r3, r31, 0
stfs f0, 0xC0(r31)
stfs f0, 0xBC(r31)
stfs f0, 0xB8(r31)
stw r0, 0xC4(r31)
stw r0, 0xC8(r31)
stw r0, 0xCC(r31)
stw r0, 0xD0(r31)
lwz r0, 0x1C(r1)
lwz r31, 0x14(r1)
addi r1, r1, 0x18
mtlr r0
blr
*/
}
PlayerState::UfoParts::UfoParts() { }
/*
* --INFO--
* Address: 8007FB44
* Size: 000040
*/
void PlayerState::courseOpen(int)
bool PlayerState::courseOpen(int courseID)
{
/*
.loc_0x0:
cmpwi r4, 0
blt- .loc_0x38
cmpwi r4, 0x5
bgt- .loc_0x38
lis r3, 0x803A
subi r3, r3, 0x2848
li r0, 0x1
lwz r3, 0x1C8(r3)
slw r0, r0, r4
and r0, r3, r0
neg r3, r0
subic r0, r3, 0x1
subfe r3, r0, r3
blr
.loc_0x38:
li r3, 0
blr
*/
if (courseID >= 0 && courseID <= 5) {
return (gameflow._1C8 & (1 << courseID)) != 0;
}
return false;
}
/*
@ -731,19 +677,7 @@ void PlayerState::courseOpen(int)
* Address: 8007FB84
* Size: 00001C
*/
void PlayerState::happyEndable()
{
/*
.loc_0x0:
lwz r5, 0x180(r3)
li r0, 0x19
rlwinm r4,r0,1,31,31
srawi r3, r5, 0x1F
subc r0, r5, r0
adde r3, r3, r4
blr
*/
}
bool PlayerState::happyEndable() { return _180 >= 25; }
/*
* --INFO--
@ -752,40 +686,16 @@ void PlayerState::happyEndable()
*/
void PlayerState::setChallengeMode()
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
li r0, 0x1
stwu r1, -0x18(r1)
stw r31, 0x14(r1)
li r31, 0
stw r30, 0x10(r1)
addi r30, r3, 0
stb r0, 0x1B6(r3)
_1B6 = 1;
for (int i = 0; i < 63; i++) {
mDemoFlags.setFlagOnly(i);
}
.loc_0x24:
addi r3, r30, 0x54
addi r4, r31, 0
bl 0x2B84
addi r31, r31, 0x1
cmpwi r31, 0x3F
blt+ .loc_0x24
li r4, 0
stb r4, 0x185(r30)
li r3, 0xFF
li r0, 0x1
stb r3, 0x184(r30)
stb r4, 0x186(r30)
stb r3, 0x1AC(r30)
stb r0, 0x11(r30)
lwz r0, 0x1C(r1)
lwz r31, 0x14(r1)
lwz r30, 0x10(r1)
addi r1, r1, 0x18
mtlr r0
blr
*/
_185 = 0;
_184 = 255;
_186 = 0;
_1AC = 255;
_11 = 1;
}
/*
@ -828,14 +738,7 @@ void PlayerState::getCardPikiCount(int)
* Address: 8007FC20
* Size: 000008
*/
void PlayerState::getCardUfoPartsCount()
{
/*
.loc_0x0:
lwz r3, 0x17C(r3)
blr
*/
}
int PlayerState::getCardUfoPartsCount() { return mCurrParts; }
/*
* --INFO--
@ -1455,31 +1358,15 @@ void PlayerState::loadCard(RandomAccessStream&)
*/
bool PlayerState::isTutorial()
{
return false;
/*
.loc_0x0:
lis r4, 0x803A
subi r4, r4, 0x24E0
lwz r4, 0xA8(r4)
cmplwi r4, 0
beq- .loc_0x28
lhz r0, 0x26(r4)
cmplwi r0, 0
beq- .loc_0x28
li r3, 0
blr
if (flowCont._A8 && flowCont._A8->_26) {
return false;
}
.loc_0x28:
lbz r0, 0x1B6(r3)
cmplwi r0, 0
beq- .loc_0x3C
li r3, 0
blr
if (_1B6) {
return false;
}
.loc_0x3C:
lbz r3, 0x185(r3)
blr
*/
return _185;
}
/*
@ -1489,21 +1376,8 @@ bool PlayerState::isTutorial()
*/
bool PlayerState::isGameCourse()
{
return false;
/*
.loc_0x0:
lis r3, 0x803A
subi r3, r3, 0x24E0
lwz r4, 0xA8(r3)
li r3, 0
lhz r0, 0x24(r4)
cmpwi r0, 0
bltlr-
cmpwi r0, 0x5
bgelr-
li r3, 0x1
blr
*/
int val = flowCont._A8->_24;
return (val >= 0 && val < 5);
}
/*
@ -1651,41 +1525,15 @@ void PlayerState::init()
* Address: 80080604
* Size: 00005C
*/
bool PlayerState::hasUfoParts(u32)
bool PlayerState::hasUfoParts(u32 idx)
{
for (int i = 0; i < mTotalParts; i++) {
if (idx == mUfoParts[i]._08) {
return mUfoParts[i]._DC != 0;
}
}
return false;
/*
.loc_0x0:
lwz r0, 0x174(r3)
li r7, 0
li r5, 0
cmpwi r0, 0
mtctr r0
ble- .loc_0x54
.loc_0x18:
lwz r6, 0x178(r3)
addi r0, r5, 0x8
lwzx r0, r6, r0
cmplw r4, r0
bne- .loc_0x48
mulli r0, r7, 0xE0
add r3, r6, r0
lbz r0, 0xDC(r3)
neg r3, r0
subic r0, r3, 0x1
subfe r3, r0, r3
blr
.loc_0x48:
addi r5, r5, 0xE0
addi r7, r7, 0x1
bdnz+ .loc_0x18
.loc_0x54:
li r3, 0
blr
*/
}
/*
@ -1976,52 +1824,19 @@ void PlayerState::exitCourse()
* Address: 800809C4
* Size: 000094
*/
void PlayerState::setNavi(bool)
void PlayerState::setNavi(bool p1)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
rlwinm. r0,r4,0,24,31
stwu r1, -0x28(r1)
stw r31, 0x24(r1)
stw r30, 0x20(r1)
addi r30, r3, 0
bne- .loc_0x2C
li r0, 0
stb r0, 0x1B4(r30)
b .loc_0x7C
if (!p1) {
_1B4 = 0;
return;
}
.loc_0x2C:
lbz r0, 0x1B4(r30)
cmplwi r0, 0
bne- .loc_0x7C
lwz r3, 0x1B8(r30)
bl 0x93AF8
lwz r3, 0x1BC(r30)
bl 0x93AF0
li r0, 0x1
stb r0, 0x1B4(r30)
addi r3, r1, 0x10
li r4, 0x58
bl 0x9E53C
addi r31, r3, 0
addi r3, r1, 0x18
li r4, 0x58
bl 0x9E52C
addi r4, r3, 0
addi r5, r31, 0
addi r3, r30, 0xC4
bl 0x9F02C
.loc_0x7C:
lwz r0, 0x2C(r1)
lwz r31, 0x24(r1)
lwz r30, 0x20(r1)
addi r1, r1, 0x28
mtlr r0
blr
*/
if (_1B4 == 0) {
_1B8->restart();
_1BC->restart();
_1B4 = 1;
mPikiAnimMgr.startMotion(PaniMotionInfo(88), PaniMotionInfo(88));
}
}
/*
@ -2029,14 +1844,7 @@ void PlayerState::setNavi(bool)
* Address: 80080A58
* Size: 000008
*/
void PlayerState::getFinalDeadPikis()
{
/*
.loc_0x0:
lwz r3, 0x1A0(r3)
blr
*/
}
int PlayerState::getFinalDeadPikis() { return _1A0; }
/*
* --INFO--
@ -2153,18 +1961,7 @@ void PlayerState::updateFinalResult()
* Address: 80080BB0
* Size: 000014
*/
int PlayerState::getCurrDay()
{
return 0;
/*
.loc_0x0:
lis r3, 0x803A
subi r3, r3, 0x2848
lwz r3, 0x2FC(r3)
subi r3, r3, 0x1
blr
*/
}
int PlayerState::getCurrDay() { return gameflow._2FC - 1; }
/*
* --INFO--
@ -2258,30 +2055,14 @@ int PlayerState::getPikiHourCount(int, int)
* Address: 80080C68
* Size: 000008
*/
int PlayerState::getTotalParts()
{
return 0;
/*
.loc_0x0:
lwz r3, 0x174(r3)
blr
*/
}
int PlayerState::getTotalParts() { return mTotalParts; }
/*
* --INFO--
* Address: 80080C70
* Size: 000008
*/
int PlayerState::getCurrParts()
{
return 0;
/*
.loc_0x0:
lwz r3, 0x17C(r3)
blr
*/
}
int PlayerState::getCurrParts() { return mCurrParts; }
/*
* --INFO--
@ -2300,36 +2081,19 @@ void PlayerState::getRestParts()
*/
bool PlayerState::isUfoBroken()
{
if (_1B6) {
return false;
}
if (mCurrParts > 0) {
return false;
}
if (flowCont._A8->_26 == 0) {
return true;
}
return false;
/*
.loc_0x0:
lbz r0, 0x1B6(r3)
cmplwi r0, 0
beq- .loc_0x14
li r3, 0
blr
.loc_0x14:
lwz r0, 0x17C(r3)
cmpwi r0, 0
ble- .loc_0x28
li r3, 0
blr
.loc_0x28:
lis r3, 0x803A
subi r3, r3, 0x24E0
lwz r3, 0xA8(r3)
lhz r0, 0x26(r3)
cmplwi r0, 0
bne- .loc_0x48
li r3, 0x1
blr
.loc_0x48:
li r3, 0
blr
*/
}
/*
@ -2337,66 +2101,26 @@ bool PlayerState::isUfoBroken()
* Address: 80080CC8
* Size: 0000C4
*/
void PlayerState::registerUfoParts(int, u32, u32)
void PlayerState::registerUfoParts(int p1, u32 p2, u32 p3)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
stwu r1, -0x48(r1)
stmw r27, 0x34(r1)
addi r27, r3, 0
addi r28, r4, 0
addi r29, r5, 0
addi r30, r6, 0
bl 0x18EA8
lwz r4, 0x301C(r13)
stw r3, 0x1F8(r4)
lwz r3, 0x170(r27)
lwz r0, 0x174(r27)
cmpw r3, r0
blt- .loc_0x54
addi r3, r1, 0x24
addi r4, r29, 0
bl -0x3CE78
addi r3, r1, 0x18
addi r4, r30, 0
bl -0x3CE84
pelletMgr->_1F8 = PaniPelletAnimator::createMotionTable();
if (_170 >= mTotalParts) {
ID32 id1(p2);
ID32 id2(p3);
}
.loc_0x54:
lwz r0, 0x170(r27)
mr r4, r29
lwz r3, 0x178(r27)
mulli r0, r0, 0xE0
add r31, r3, r0
stw r28, 0x4(r31)
stw r30, 0xC(r31)
stw r29, 0x8(r31)
lwz r3, 0x301C(r13)
bl 0x179C4
addi r30, r3, 0
addi r3, r31, 0
addi r4, r30, 0
bl .loc_0xC4
cmplwi r30, 0
beq- .loc_0xA4
lwz r3, 0x0(r30)
addi r4, r31, 0xC4
li r5, 0
bl -0x5143C
UfoParts* part = &mUfoParts[_170];
part->_04 = p1;
part->_0C = p3;
part->_08 = p2;
PelletShapeObject* shape = pelletMgr->getShapeObject(p2);
part->initAnim(shape);
.loc_0xA4:
lwz r3, 0x170(r27)
addi r0, r3, 0x1
stw r0, 0x170(r27)
lwz r0, 0x4C(r1)
lmw r27, 0x34(r1)
addi r1, r1, 0x48
mtlr r0
blr
if (shape) {
shape->mShape->makeInstance(part->_C4, 0);
}
.loc_0xC4:
*/
_170++;
}
/*
@ -2404,42 +2128,16 @@ void PlayerState::registerUfoParts(int, u32, u32)
* Address: 80080D8C
* Size: 000074
*/
void PlayerState::UfoParts::initAnim(PelletShapeObject*)
void PlayerState::UfoParts::initAnim(PelletShapeObject* shape)
{
/*
.loc_0x0:
mflr r0
cmplwi r4, 0
stw r0, 0x4(r1)
stwu r1, -0x20(r1)
stw r31, 0x1C(r1)
addi r31, r3, 0
stw r4, 0xD4(r3)
beq- .loc_0x60
lwz r8, 0xD4(r31)
addi r3, r31, 0x10
lwz r5, 0x301C(r13)
lwz r6, 0x4(r8)
addi r4, r8, 0x8
lwz r7, 0x1F8(r5)
addi r5, r8, 0x18
bl 0x18BDC
lfs f0, -0x7620(r2)
addi r3, r1, 0x10
li r4, 0
stfs f0, 0xD8(r31)
bl 0x9E17C
addi r4, r3, 0
addi r3, r31, 0x10
bl 0x18CD8
mPelletShape = shape;
if (!shape) {
return;
}
.loc_0x60:
lwz r0, 0x24(r1)
lwz r31, 0x1C(r1)
addi r1, r1, 0x20
mtlr r0
blr
*/
mAnimator.init(&mPelletShape->_08, &mPelletShape->_18, mPelletShape->mAnimMgr, pelletMgr->_1F8);
_D8 = 0.0f;
mAnimator.startMotion(PaniMotionInfo(0));
}
/*

View File

@ -46,28 +46,40 @@ void SAIEventInit()
* Address: 8007CF58
* Size: 000040
*/
void SAIMotionDoneEvent::procAnimMsg(AICreature* creature, MsgAnim* msg) { creature->setEventFlag(mEventID, *msg->_04 == 0); }
void SAIMotionDoneEvent::procAnimMsg(AICreature* creature, MsgAnim* msg)
{
creature->setEventFlag(mEventID, msg->mKeyEvent->mKeyFrame == 0);
}
/*
* --INFO--
* Address: 8007CF98
* Size: 000040
*/
void SAIMotionAction0Event::procAnimMsg(AICreature* creature, MsgAnim* msg) { creature->setEventFlag(mEventID, *msg->_04 == 1); }
void SAIMotionAction0Event::procAnimMsg(AICreature* creature, MsgAnim* msg)
{
creature->setEventFlag(mEventID, msg->mKeyEvent->mKeyFrame == 1);
}
/*
* --INFO--
* Address: 8007CFD8
* Size: 000040
*/
void SAIMotionLoopStartEvent::procAnimMsg(AICreature* creature, MsgAnim* msg) { creature->setEventFlag(mEventID, *msg->_04 == 5); }
void SAIMotionLoopStartEvent::procAnimMsg(AICreature* creature, MsgAnim* msg)
{
creature->setEventFlag(mEventID, msg->mKeyEvent->mKeyFrame == 5);
}
/*
* --INFO--
* Address: 8007D018
* Size: 000040
*/
void SAIMotionLoopEndEvent::procAnimMsg(AICreature* creature, MsgAnim* msg) { creature->setEventFlag(mEventID, *msg->_04 == 6); }
void SAIMotionLoopEndEvent::procAnimMsg(AICreature* creature, MsgAnim* msg)
{
creature->setEventFlag(mEventID, msg->mKeyEvent->mKeyFrame == 6);
}
/*
* --INFO--

View File

@ -1,4 +1,6 @@
#include "SimpleAI.h"
#include "PikiMacros.h"
#include "sysNew.h"
static char file[] = __FILE__;
static char name[] = "simpleAI";
@ -46,8 +48,14 @@ AICreature::AICreature(CreatureProp* props)
* Address: 8007D310
* Size: 00006C
*/
void AICreature::collisionCallback(CollEvent&)
void AICreature::collisionCallback(CollEvent& event)
{
u32 thing = event._00;
MsgCollide msg(event);
_2BC = thing;
if (mStateMachine) {
mStateMachine->procMsg(this, &msg);
}
/*
.loc_0x0:
mflr r0
@ -89,35 +97,10 @@ void AICreature::collisionCallback(CollEvent&)
*/
void AICreature::bounceCallback()
{
/*
.loc_0x0:
mflr r0
mr r4, r3
stw r0, 0x4(r1)
li r0, 0
stwu r1, -0x38(r1)
lfs f0, -0x6294(r13)
stw r0, 0x24(r1)
lfs f1, -0x6290(r13)
stfs f0, 0x28(r1)
lfs f0, -0x628C(r13)
stfs f1, 0x2C(r1)
stfs f0, 0x30(r1)
lwz r3, 0x2E8(r3)
cmplwi r3, 0
beq- .loc_0x50
lwz r12, 0x0(r3)
addi r5, r1, 0x24
lwz r12, 0x10(r12)
mtlr r12
blrl
.loc_0x50:
lwz r0, 0x3C(r1)
addi r1, r1, 0x38
mtlr r0
blr
*/
MsgBounce msg(Vector3f(0.0f, 1.0f, 0.0f));
if (mStateMachine) {
mStateMachine->procMsg(this, &msg);
}
}
/*
@ -125,78 +108,25 @@ void AICreature::bounceCallback()
* Address: 8007D3DC
* Size: 0000B4
*/
void AICreature::animationKeyUpdated(PaniAnimKeyEvent&)
void AICreature::animationKeyUpdated(PaniAnimKeyEvent& event)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
li r0, 0x4
stwu r1, -0x20(r1)
stw r31, 0x1C(r1)
addi r31, r4, 0
stw r30, 0x18(r1)
mr r30, r3
lwz r3, 0x6C(r3)
stw r0, 0x10(r1)
subfic r0, r3, 0x10
stw r31, 0x14(r1)
lwz r3, 0x2E8(r30)
cmplwi r3, 0
beq- .loc_0x54
lwz r12, 0x0(r3)
addi r4, r30, 0
addi r5, r1, 0x10
lwz r12, 0x10(r12)
mtlr r12
blrl
DEBUGPRINT(mObjType == OBJTYPE_Goal);
.loc_0x54:
lwz r0, 0x0(r31)
cmpwi r0, 0x7
bne- .loc_0x78
mr r3, r30
lwz r4, 0x4(r31)
lwz r12, 0x0(r30)
lwz r12, 0x128(r12)
mtlr r12
blrl
MsgAnim msg(&event);
.loc_0x78:
lwz r0, 0x0(r31)
cmpwi r0, 0x8
bne- .loc_0x9C
mr r3, r30
lwz r4, 0x4(r31)
lwz r12, 0x0(r30)
lwz r12, 0x12C(r12)
mtlr r12
blrl
if (mStateMachine) {
mStateMachine->procMsg(this, &msg);
}
.loc_0x9C:
lwz r0, 0x24(r1)
lwz r31, 0x1C(r1)
lwz r30, 0x18(r1)
addi r1, r1, 0x20
mtlr r0
blr
*/
if (event.mKeyFrame == 7) {
playSound(event.mValue);
}
if (event.mKeyFrame == 8) {
playEffect(event.mValue);
}
}
/*
* --INFO--
* Address: 8007D490
* Size: 000004
*/
void AICreature::playEffect(int) { }
/*
* --INFO--
* Address: 8007D494
* Size: 000004
*/
void AICreature::playSound(int) { }
/*
* --INFO--
* Address: 8007D498
@ -255,126 +185,39 @@ SimpleAI::SimpleAI() { }
* Address: 8007D508
* Size: 000068
*/
void SimpleAI::procMsg(AICreature*, Msg*)
void SimpleAI::procMsg(AICreature* creature, Msg* msg)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
stwu r1, -0x20(r1)
stw r31, 0x1C(r1)
mr r31, r5
stw r30, 0x18(r1)
addi r30, r4, 0
addi r3, r30, 0
lwz r12, 0x0(r30)
lwz r12, 0x120(r12)
mtlr r12
blrl
cmplwi r3, 0
beq- .loc_0x50
lwz r12, 0x0(r3)
addi r4, r30, 0
addi r5, r31, 0
lwz r12, 0x8(r12)
mtlr r12
blrl
AState<AICreature>* state = creature->getCurrState();
.loc_0x50:
lwz r0, 0x24(r1)
lwz r31, 0x1C(r1)
lwz r30, 0x18(r1)
addi r1, r1, 0x20
mtlr r0
blr
*/
if (state) {
state->procMsg(creature, msg);
}
}
/*
* --INFO--
* Address: 8007D570
* Size: 000008
*/
AState<AICreature>* AICreature::getCurrState() { return mCurrentState; }
/*
* --INFO--
* Address: 8007D578
* Size: 0000E8
*/
void SimpleAI::addState(int, int, SAIAction*, SAIAction*, SAIAction*)
void SimpleAI::addState(int p1, int p2, SAIAction* p3, SAIAction* p4, SAIAction* p5)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
stwu r1, -0x50(r1)
stmw r25, 0x34(r1)
addi r31, r3, 0
addi r25, r4, 0
addi r26, r5, 0
addi r27, r6, 0
addi r28, r7, 0
addi r29, r8, 0
li r3, 0x58
bl -0x365A0
addi r30, r3, 0
mr. r3, r30
beq- .loc_0x44
mr r4, r25
bl 0x430
u32 badCompiler; // god i tried really hard to get this working.
.loc_0x44:
stw r26, 0x48(r30)
stw r27, 0x4C(r30)
stw r28, 0x50(r30)
stw r29, 0x54(r30)
lwz r4, 0x8(r31)
lwz r0, 0xC(r31)
cmpw r4, r0
bge- .loc_0xD4
lwz r3, 0x4(r31)
rlwinm r0,r4,2,0,29
stwx r30, r3, r0
lwz r3, 0x4(r30)
cmpwi r3, 0
blt- .loc_0x88
lwz r0, 0xC(r31)
cmpw r3, r0
blt- .loc_0x90
SAIState* state = new SAIState(p1);
state->_48 = p2;
state->_4C = p3;
state->_50 = p4;
state->_54 = p5;
.loc_0x88:
li r0, 0
b .loc_0x94
if (isFull()) {
return;
}
.loc_0x90:
li r0, 0x1
appendState(state);
.loc_0x94:
rlwinm. r0,r0,0,24,31
beq- .loc_0xD4
stw r31, 0x8(r30)
lwz r0, 0x8(r31)
lwz r4, 0x4(r30)
lwz r3, 0x10(r31)
rlwinm r0,r0,2,0,29
stwx r4, r3, r0
lwz r0, 0x4(r30)
lwz r4, 0x8(r31)
lwz r3, 0x14(r31)
rlwinm r0,r0,2,0,29
stwx r4, r3, r0
lwz r3, 0x8(r31)
addi r0, r3, 0x1
stw r0, 0x8(r31)
.loc_0xD4:
lmw r25, 0x34(r1)
lwz r0, 0x54(r1)
addi r1, r1, 0x50
mtlr r0
blr
*/
if (isValidState(state)) {
initState(state);
}
}
/*
@ -382,79 +225,21 @@ void SimpleAI::addState(int, int, SAIAction*, SAIAction*, SAIAction*)
* Address: 8007D660
* Size: 0000F8
*/
void SimpleAI::addArrow(int, SAIEvent*, int)
SAIArrow* SimpleAI::addArrow(int p1, SAIEvent* event, int p3)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
stwu r1, -0x38(r1)
stmw r27, 0x24(r1)
addi r27, r3, 0
addi r28, r4, 0
addi r29, r5, 0
addi r30, r6, 0
li r3, 0x34
bl -0x36680
addi r31, r3, 0
mr. r7, r31
beq- .loc_0x98
lis r3, 0x8022
addi r0, r3, 0x738C
lis r3, 0x8022
stw r0, 0x0(r31)
addi r0, r3, 0x737C
stw r0, 0x0(r31)
li r0, 0
lis r3, 0x802B
stw r0, 0x10(r31)
lis r6, 0x802B
subi r4, r3, 0x28C0
stw r0, 0xC(r31)
subi r3, r6, 0x28CC
lis r5, 0x802B
stw r0, 0x8(r31)
subi r0, r5, 0x26D4
stw r3, 0x4(r31)
addi r3, r7, 0x20
stw r0, 0x0(r31)
bl -0x48728
lis r3, 0x802B
subi r0, r3, 0x26FC
stw r0, 0x20(r31)
stw r29, 0x18(r31)
stw r30, 0x14(r31)
u32 badCompiler;
.loc_0x98:
lwz r3, 0x14(r27)
rlwinm r0,r28,2,0,29
addi r4, r31, 0
lwzx r0, r3, r0
cmpwi r0, -0x1
bne- .loc_0xB8
li r3, 0
b .loc_0xE4
SAIArrow* arrow = new SAIArrow("SAIArrow", event, p3);
int stateIdx = mStateIndexes[p1];
if (stateIdx == -1) {
return nullptr;
}
.loc_0xB8:
lwz r3, 0x4(r27)
rlwinm r0,r0,2,0,29
lwzx r27, r3, r0
lwz r0, 0x44(r27)
addi r3, r27, 0x10
stw r0, 0x1C(r31)
bl -0x3D158
lwz r4, 0x44(r27)
addi r3, r31, 0
addi r0, r4, 0x1
stw r0, 0x44(r27)
.loc_0xE4:
lmw r27, 0x24(r1)
lwz r0, 0x3C(r1)
addi r1, r1, 0x38
mtlr r0
blr
*/
SAIState* state = getState(stateIdx);
arrow->mArrowIdx = state->mArrowCount;
state->mRootArrow.add(arrow);
state->mArrowCount++;
return arrow;
}
/*
@ -679,77 +464,15 @@ bool SAICondition::satisfy(AICreature*) { return true; }
*/
SAIState::SAIState(int stateID)
: AState<AICreature>(stateID)
, mRootArrow("SAIArrowRoot")
{
/*
.loc_0x0:
mflr r0
lis r5, 0x802B
stw r0, 0x4(r1)
subi r0, r5, 0x2950
lis r6, 0x802B
stwu r1, -0x20(r1)
lis r5, 0x8022
stw r31, 0x1C(r1)
addi r31, r3, 0
lis r3, 0x802B
stw r30, 0x18(r1)
li r30, 0
stw r29, 0x14(r1)
stw r0, 0x0(r31)
subi r0, r3, 0x27B4
lis r3, 0x8022
stw r0, 0x0(r31)
subi r0, r6, 0x2804
stw r4, 0x4(r31)
lis r4, 0x802B
subi r29, r4, 0x28E8
stw r30, 0x8(r31)
addi r4, r29, 0x28
stw r0, 0x0(r31)
addi r0, r5, 0x738C
addi r5, r29, 0x34
stw r0, 0x10(r31)
addi r0, r3, 0x737C
lis r3, 0x802B
stw r0, 0x10(r31)
subi r0, r3, 0x26D4
addi r3, r31, 0x30
stw r30, 0x20(r31)
stw r30, 0x1C(r31)
stw r30, 0x18(r31)
stw r5, 0x14(r31)
stw r0, 0x10(r31)
bl -0x48AC4
lis r3, 0x802B
subi r0, r3, 0x26FC
stw r0, 0x30(r31)
li r5, -0x1
addi r4, r29, 0x44
stw r5, 0x24(r31)
addi r0, r29, 0x54
addi r3, r31, 0
stw r30, 0x28(r31)
stw r30, 0x40(r31)
stw r30, 0x3C(r31)
stw r30, 0x38(r31)
stw r4, 0x34(r31)
stw r5, 0x48(r31)
stw r30, 0x54(r31)
stw r30, 0x50(r31)
stw r30, 0x4C(r31)
stw r30, 0x20(r31)
stw r30, 0x1C(r31)
stw r30, 0x18(r31)
stw r0, 0x14(r31)
stw r30, 0x44(r31)
lwz r0, 0x24(r1)
lwz r31, 0x1C(r1)
lwz r30, 0x18(r1)
lwz r29, 0x14(r1)
addi r1, r1, 0x20
mtlr r0
blr
*/
mRootArrow.mCondition.initCore("saiCondition");
_48 = -1;
_54 = 0;
_50 = 0;
_4C = 0;
mRootArrow.initCore("rootArrow");
mArrowCount = 0;
}
/*
@ -981,27 +704,16 @@ void AICreature::finishMotion() { }
* Address: 8007DCF4
* Size: 000008
*/
void AICreature::getCurrentMotionName()
{
/*
.loc_0x0:
subi r3, r13, 0x6210
blr
*/
}
char* AICreature::getCurrentMotionName() { return "noname"; }
/*
* --INFO--
* Address: 8007DCFC
* Size: 000008
*/
void AICreature::getCurrentMotionCounter()
f32 AICreature::getCurrentMotionCounter()
{
/*
.loc_0x0:
lfs f1, -0x768C(r2)
blr
*/
return -123.4f; // lol
}
/*
@ -1009,13 +721,9 @@ void AICreature::getCurrentMotionCounter()
* Address: 8007DD04
* Size: 000008
*/
void AICreature::getMotionSpeed()
f32 AICreature::getMotionSpeed()
{
/*
.loc_0x0:
lfs f1, -0x768C(r2)
blr
*/
return -123.4f; // lol
}
/*
@ -1079,57 +787,28 @@ void Creature::startAI(int) { }
* Address: 8007DD38
* Size: 000008
*/
f32 Creature::getiMass()
{
return 0.0f;
/*
.loc_0x0:
lfs f1, -0x7688(r2)
blr
*/
}
f32 Creature::getiMass() { return 100.0f; }
/*
* --INFO--
* Address: 8007DD40
* Size: 000008
*/
f32 Creature::getSize()
{
/*
.loc_0x0:
lfs f1, -0x7684(r2)
blr
*/
}
f32 Creature::getSize() { return 15.0f; }
/*
* --INFO--
* Address: 8007DD48
* Size: 000008
*/
f32 Creature::getHeight()
{
/*
.loc_0x0:
lfs f1, -0x7690(r2)
blr
*/
}
f32 Creature::getHeight() { return 0.0f; }
/*
* --INFO--
* Address: 8007DD50
* Size: 000008
*/
f32 Creature::getCylinderHeight()
{
/*
.loc_0x0:
lfs f1, -0x7680(r2)
blr
*/
}
f32 Creature::getCylinderHeight() { return 10.0f; }
/*
* --INFO--
@ -1164,38 +843,14 @@ void Creature::doLoad(RandomAccessStream&) { }
* Address: 8007DD68
* Size: 00001C
*/
Vector3f Creature::getShadowPos()
{
/*
.loc_0x0:
lfs f0, 0x94(r4)
stfs f0, 0x0(r3)
lfs f0, 0x98(r4)
stfs f0, 0x4(r3)
lfs f0, 0x9C(r4)
stfs f0, 0x8(r3)
blr
*/
}
Vector3f Creature::getShadowPos() { return mPosition; }
/*
* --INFO--
* Address: 8007DD84
* Size: 00001C
*/
void Creature::setCentre(Vector3f&)
{
/*
.loc_0x0:
lwz r5, 0x0(r4)
lwz r0, 0x4(r4)
stw r5, 0x94(r3)
stw r0, 0x98(r3)
lwz r0, 0x8(r4)
stw r0, 0x9C(r3)
blr
*/
}
void Creature::setCentre(Vector3f& centre) { mPosition = centre; }
/*
* --INFO--
@ -1216,18 +871,7 @@ bool Creature::isBuried() { return false; }
* Address: 8007DDB8
* Size: 000018
*/
bool Creature::isAlive()
{
/*
.loc_0x0:
lfs f1, 0x58(r3)
lfs f0, -0x7690(r2)
fcmpo cr0, f1, f0
mfcr r0
rlwinm r3,r0,2,31,31
blr
*/
}
bool Creature::isAlive() { return mHealth > 0.0f; }
/*
* --INFO--
@ -1255,18 +899,7 @@ bool Creature::ignoreAtari(Creature*) { return false; }
* Address: 8007DDE8
* Size: 000018
*/
bool Creature::isFree()
{
/*
.loc_0x0:
lwz r0, 0xC8(r3)
rlwinm r0,r0,0,19,19
neg r3, r0
subic r0, r3, 0x1
subfe r3, r0, r3
blr
*/
}
bool Creature::isFree() { return isCreatureFlag(CF_Free) != 0; }
/*
* --INFO--

View File

@ -1,6 +1,6 @@
#include "CodeInitializer.h"
#include "nlib/System.h"
#include "PaniAnimator.h"
#include "PaniPikiAnimator.h"
#include "system.h"
#include "Teki.h"

View File

@ -33,24 +33,24 @@ char* PaniAnimator::keyNames[6] = {
* Address: 8011EF58
* Size: 000034
*/
PaniMotionInfo::PaniMotionInfo(int p1) { init(p1, nullptr); }
PaniMotionInfo::PaniMotionInfo(int motionIdx) { init(motionIdx, nullptr); }
/*
* --INFO--
* Address: 8011EF8C
* Size: 000030
*/
PaniMotionInfo::PaniMotionInfo(int p1, PaniAnimKeyListener* listener) { init(p1, listener); }
PaniMotionInfo::PaniMotionInfo(int motionIdx, PaniAnimKeyListener* listener) { init(motionIdx, listener); }
/*
* --INFO--
* Address: 8011EFBC
* Size: 00000C
*/
void PaniMotionInfo::init(int p1, PaniAnimKeyListener* listener)
void PaniMotionInfo::init(int motionIdx, PaniAnimKeyListener* listener)
{
_00 = p1;
mListener = listener;
mMotionIdx = motionIdx;
mListener = listener;
}
/*
@ -90,10 +90,10 @@ void PaniMotion::init(int p1, int p2)
PaniMotionTable::PaniMotionTable(int count)
{
mMotionCount = count;
_04 = new PaniMotion*[mMotionCount];
mMotions = new PaniMotion*[mMotionCount];
for (int i = 0; i < mMotionCount; i++) {
_04[i] = nullptr;
mMotions[i] = nullptr;
}
}
@ -105,10 +105,10 @@ PaniMotionTable::PaniMotionTable(int count)
PaniSoundTable::PaniSoundTable(int count)
{
mSoundCount = count;
_04 = new u32*[mSoundCount];
mSounds = new u32*[mSoundCount];
for (int i = 0; i < mSoundCount; i++) {
_04[i] = 0;
mSounds[i] = 0;
}
}
@ -124,7 +124,7 @@ PaniAnimator::PaniAnimator()
mListener = nullptr;
mAnimInfo = nullptr;
mMotionTable = nullptr;
_44 = -1;
mMotionIdx = -1;
mCurrentFrame = 0.0f;
}
@ -173,12 +173,12 @@ void PaniAnimator::updateContext()
void PaniAnimator::startMotion(PaniMotionInfo& info)
{
if (mAnimInfo) {
_44 = info._00;
mMotionIdx = info.mMotionIdx;
mListener = info.mListener;
_38 = 0;
_40 = 0;
mIsFinished = false;
startAnim(2, mMotionTable->_04[_44]->_00, 0, 8);
startAnim(2, mMotionTable->mMotions[mMotionIdx]->_00, 0, 8);
}
}
@ -210,13 +210,13 @@ void PaniAnimator::finishMotion(PaniMotionInfo& info)
* Address: 8011F2E0
* Size: 00010C
*/
void PaniAnimator::animate(f32 p1)
void PaniAnimator::animate(f32 speed)
{
if (!mAnimInfo) {
return;
}
if (p1 < 0.0f) {
if (speed < 0.0f) {
DEBUGPRINT(_38 < 0);
}
@ -231,11 +231,11 @@ void PaniAnimator::animate(f32 p1)
return;
}
p1 *= NSystem::system->getFrameTime();
mCurrentFrame += p1;
speed *= NSystem::system->getFrameTime();
mCurrentFrame += speed;
checkConstantKeys();
checkEventKeys(mCurrentFrame - p1, mCurrentFrame);
checkEventKeys(mCurrentFrame - speed, mCurrentFrame);
if (mCurrentFrame >= keyVal2) {
mCurrentFrame = keyVal2;
finishAnimation();

View File

@ -1,4 +1,6 @@
#include "PaniAnimator.h"
#include "PaniPikiAnimator.h"
PaniMotionTable* PaniPikiAnimMgr::motionTable;
/*
* --INFO--
@ -25,81 +27,31 @@ static void _Print(char*, ...)
* Address: ........
* Size: 000034
*/
PaniMotionTable* PaniPikiAnimMgr::getMotionTable()
{
// UNUSED FUNCTION
}
PaniMotionTable* PaniPikiAnimMgr::getMotionTable() { return motionTable; }
/*
* --INFO--
* Address: 8011F8A0
* Size: 00003C
*/
PaniPikiAnimMgr::PaniPikiAnimMgr()
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
stwu r1, -0x18(r1)
stw r31, 0x14(r1)
addi r31, r3, 0
addi r3, r31, 0x4
bl -0x5EE4
addi r3, r31, 0x58
bl -0x5EEC
mr r3, r31
lwz r0, 0x1C(r1)
lwz r31, 0x14(r1)
addi r1, r1, 0x18
mtlr r0
blr
*/
}
PaniPikiAnimMgr::PaniPikiAnimMgr() { }
/*
* --INFO--
* Address: 8011F8DC
* Size: 00007C
*/
void PaniPikiAnimMgr::init(AnimMgr*, AnimContext*, AnimContext*, PaniMotionTable*)
void PaniPikiAnimMgr::init(AnimMgr* mgr, AnimContext* context1, AnimContext* context2, PaniMotionTable* table)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
stwu r1, -0x38(r1)
stmw r27, 0x24(r1)
addi r27, r3, 0
addi r28, r4, 0
addi r29, r5, 0
addi r30, r6, 0
lwz r0, 0x3158(r13)
cmplwi r0, 0
bne- .loc_0x34
bl -0x6C04
stw r3, 0x3158(r13)
if (!motionTable) {
motionTable = PaniPikiAnimator::createMotionTable();
}
.loc_0x34:
lwz r31, 0x3158(r13)
addi r4, r29, 0
addi r5, r28, 0
addi r6, r31, 0
addi r3, r27, 0x4
bl -0x800
addi r4, r30, 0
addi r5, r28, 0
addi r6, r31, 0
addi r3, r27, 0x58
bl -0x814
lfs f0, -0x5F80(r2)
stfs f0, 0x0(r27)
lmw r27, 0x24(r1)
lwz r0, 0x3C(r1)
addi r1, r1, 0x38
mtlr r0
blr
*/
PaniMotionTable* sTable = getMotionTable();
_04.init(context1, mgr, sTable);
_58.init(context2, mgr, sTable);
mAnimSpeed = 30.0f;
}
/*
@ -107,35 +59,10 @@ void PaniPikiAnimMgr::init(AnimMgr*, AnimContext*, AnimContext*, PaniMotionTable
* Address: 8011F958
* Size: 000060
*/
void PaniPikiAnimMgr::changeContext(AnimContext*, AnimContext*)
void PaniPikiAnimMgr::changeContext(AnimContext* context1, AnimContext* context2)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
stwu r1, -0x20(r1)
stw r31, 0x1C(r1)
mr r31, r5
stw r30, 0x18(r1)
addi r30, r3, 0
addi r3, r30, 0x4
lwz r12, 0x34(r30)
lwz r12, 0x8(r12)
mtlr r12
blrl
addi r3, r30, 0x58
lwz r12, 0x88(r30)
mr r4, r31
lwz r12, 0x8(r12)
mtlr r12
blrl
lwz r0, 0x24(r1)
lwz r31, 0x1C(r1)
lwz r30, 0x18(r1)
addi r1, r1, 0x20
mtlr r0
blr
*/
_04.changeContext(context1);
_58.changeContext(context2);
}
/*
@ -143,37 +70,14 @@ void PaniPikiAnimMgr::changeContext(AnimContext*, AnimContext*)
* Address: 8011F9B8
* Size: 000058
*/
void PaniPikiAnimMgr::startMotion(PaniMotionInfo*, PaniMotionInfo*)
void PaniPikiAnimMgr::startMotion(PaniMotionInfo* motion1, PaniMotionInfo* motion2)
{
/*
.loc_0x0:
mflr r0
cmplwi r4, 0
stw r0, 0x4(r1)
stwu r1, -0x20(r1)
stw r31, 0x1C(r1)
addi r31, r5, 0
stw r30, 0x18(r1)
addi r30, r3, 0
beq- .loc_0x2C
addi r3, r30, 0x4
bl -0x820
.loc_0x2C:
cmplwi r31, 0
beq- .loc_0x40
addi r3, r30, 0x58
addi r4, r31, 0
bl -0x834
.loc_0x40:
lwz r0, 0x24(r1)
lwz r31, 0x1C(r1)
lwz r30, 0x18(r1)
addi r1, r1, 0x20
mtlr r0
blr
*/
if (motion1) {
_04.startMotion(*motion1);
}
if (motion2) {
_58.startMotion(*motion2);
}
}
/*
@ -181,37 +85,14 @@ void PaniPikiAnimMgr::startMotion(PaniMotionInfo*, PaniMotionInfo*)
* Address: 8011FA10
* Size: 000058
*/
void PaniPikiAnimMgr::finishMotion(PaniMotionInfo*, PaniMotionInfo*)
void PaniPikiAnimMgr::finishMotion(PaniMotionInfo* motion1, PaniMotionInfo* motion2)
{
/*
.loc_0x0:
mflr r0
cmplwi r4, 0
stw r0, 0x4(r1)
stwu r1, -0x20(r1)
stw r31, 0x1C(r1)
addi r31, r5, 0
stw r30, 0x18(r1)
addi r30, r3, 0
beq- .loc_0x2C
addi r3, r30, 0x4
bl -0x808
.loc_0x2C:
cmplwi r31, 0
beq- .loc_0x40
addi r3, r30, 0x58
addi r4, r31, 0
bl -0x81C
.loc_0x40:
lwz r0, 0x24(r1)
lwz r31, 0x1C(r1)
lwz r30, 0x18(r1)
addi r1, r1, 0x20
mtlr r0
blr
*/
if (motion1) {
_04.finishMotion(*motion1);
}
if (motion2) {
_58.finishMotion(*motion2);
}
}
/*
@ -219,86 +100,16 @@ void PaniPikiAnimMgr::finishMotion(PaniMotionInfo*, PaniMotionInfo*)
* Address: 8011FA68
* Size: 000058
*/
void PaniPikiAnimMgr::startMotion(PaniMotionInfo&, PaniMotionInfo&)
{
/*
.loc_0x0:
mflr r0
cmplwi r4, 0
stw r0, 0x4(r1)
stwu r1, -0x20(r1)
stw r31, 0x1C(r1)
addi r31, r5, 0
stw r30, 0x18(r1)
addi r30, r3, 0
beq- .loc_0x2C
addi r3, r30, 0x4
bl -0x8D0
.loc_0x2C:
cmplwi r31, 0
beq- .loc_0x40
addi r3, r30, 0x58
addi r4, r31, 0
bl -0x8E4
.loc_0x40:
lwz r0, 0x24(r1)
lwz r31, 0x1C(r1)
lwz r30, 0x18(r1)
addi r1, r1, 0x20
mtlr r0
blr
*/
}
void PaniPikiAnimMgr::startMotion(PaniMotionInfo& motion1, PaniMotionInfo& motion2) { startMotion(&motion1, &motion2); }
/*
* --INFO--
* Address: 8011FAC0
* Size: 000084
*/
void PaniPikiAnimMgr::finishMotion(PaniAnimKeyListener*)
void PaniPikiAnimMgr::finishMotion(PaniAnimKeyListener* listener)
{
/*
.loc_0x0:
mflr r0
li r5, 0
stw r0, 0x4(r1)
stwu r1, -0x30(r1)
stw r31, 0x2C(r1)
stw r30, 0x28(r1)
addi r30, r4, 0
li r4, -0x1
stw r29, 0x24(r1)
addi r29, r3, 0
addi r3, r1, 0x10
bl -0xB60
addi r31, r3, 0
addi r5, r30, 0
addi r3, r1, 0x18
li r4, -0x1
bl -0xB74
mr. r4, r3
beq- .loc_0x54
addi r3, r29, 0x4
bl -0x8E0
.loc_0x54:
cmplwi r31, 0
beq- .loc_0x68
addi r3, r29, 0x58
addi r4, r31, 0
bl -0x8F4
.loc_0x68:
lwz r0, 0x34(r1)
lwz r31, 0x2C(r1)
lwz r30, 0x28(r1)
lwz r29, 0x24(r1)
addi r1, r1, 0x30
mtlr r0
blr
*/
finishMotion(&PaniMotionInfo(-1, listener), &PaniMotionInfo(-1, nullptr));
}
/*
@ -306,67 +117,30 @@ void PaniPikiAnimMgr::finishMotion(PaniAnimKeyListener*)
* Address: 8011FB44
* Size: 0000C0
*/
void PaniPikiAnimMgr::updateAnimation(f32)
void PaniPikiAnimMgr::updateAnimation(f32 speed)
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
stwu r1, -0x70(r1)
stfd f31, 0x68(r1)
stw r31, 0x64(r1)
mr r31, r3
lbz r0, 0x4C(r3)
cmplwi r0, 0
beq- .loc_0x40
lwz r3, 0x2C(r31)
lfs f1, 0x0(r31)
lfs f0, 0x34(r3)
fcmpo cr0, f1, f0
bge- .loc_0x44
stfs f0, 0x0(r31)
b .loc_0x44
u32 badCompiler; // i tried really hard to get the inlines to work, i promise
.loc_0x40:
stfs f1, 0x0(r31)
if (isFinished()) {
if (mAnimSpeed < _04.mAnimInfo->mParams.mSpeed()) {
setAnimSpeed(_04.mAnimInfo->mParams.mSpeed());
}
} else {
setAnimSpeed(speed);
}
.loc_0x44:
lwz r4, 0x2C(r31)
lfs f31, 0x0(r31)
lwz r0, 0x24(r4)
rlwinm. r0,r0,0,30,30
bne- .loc_0x60
lfs f0, 0x34(r4)
stfs f0, 0x0(r31)
f32 currSpeed = mAnimSpeed;
if (!(_04.mAnimInfo->mParams.mFlags() & AnimInfo::FLAG_Unk2)) {
setAnimSpeed(_04.mAnimInfo->mParams.mSpeed());
}
.loc_0x60:
addi r3, r31, 0x4
lfs f1, 0x0(r31)
lwz r12, 0x34(r31)
lwz r12, 0xC(r12)
mtlr r12
blrl
lwz r4, 0x80(r31)
lwz r0, 0x24(r4)
rlwinm. r0,r0,0,30,30
bne- .loc_0x90
lfs f0, 0x34(r4)
stfs f0, 0x0(r31)
_04.animate(mAnimSpeed);
.loc_0x90:
addi r3, r31, 0x58
fmr f1, f31
lwz r12, 0x88(r31)
lwz r12, 0xC(r12)
mtlr r12
blrl
lwz r0, 0x74(r1)
lfd f31, 0x68(r1)
lwz r31, 0x64(r1)
addi r1, r1, 0x70
mtlr r0
blr
*/
if (!(_58.mAnimInfo->mParams.mFlags() & AnimInfo::FLAG_Unk2)) {
setAnimSpeed(_58.mAnimInfo->mParams.mSpeed());
}
_58.animate(currSpeed);
}
/*
@ -376,27 +150,6 @@ void PaniPikiAnimMgr::updateAnimation(f32)
*/
void PaniPikiAnimMgr::updateContext()
{
/*
.loc_0x0:
mflr r0
stw r0, 0x4(r1)
stwu r1, -0x18(r1)
stw r31, 0x14(r1)
addi r31, r3, 0
addi r3, r31, 0x4
lwz r12, 0x34(r31)
lwz r12, 0x18(r12)
mtlr r12
blrl
addi r3, r31, 0x58
lwz r12, 0x88(r31)
lwz r12, 0x18(r12)
mtlr r12
blrl
lwz r0, 0x1C(r1)
lwz r31, 0x14(r1)
addi r1, r1, 0x18
mtlr r0
blr
*/
_04.updateContext();
_58.updateContext();
}

View File

@ -1438,7 +1438,7 @@ f32 roundAng(f32 x)
* Address: 800385B4
* Size: 000074
*/
void angDist(f32, f32)
f32 angDist(f32, f32)
{
/*
.loc_0x0:
@ -1487,7 +1487,7 @@ void angDist(f32, f32)
* Address: 80038628
* Size: 000050
*/
void qdist2(f32, f32, f32, f32)
f32 qdist2(f32, f32, f32, f32)
{
// f32 differenceX = point2X - point1X;
// f32 absoluteDifferenceX = (differenceX < 0.0f) ? -differenceX : differenceX;
@ -2245,7 +2245,7 @@ void pointInsideTri(KTri&, Vector3f&)
* Address: 80039024
* Size: 000260
*/
void triRectDistance(Vector3f*, Vector3f*, Vector3f*, BoundBox&, bool)
f32 triRectDistance(Vector3f*, Vector3f*, Vector3f*, BoundBox&, bool)
{
/*
.loc_0x0:
@ -2427,7 +2427,7 @@ void triRectDistance(Vector3f*, Vector3f*, Vector3f*, BoundBox&, bool)
* Address: 80039284
* Size: 0001A8
*/
void distanceTriRect(KTri&, KRect&, f32*, f32*, f32*, f32*)
f32 distanceTriRect(KTri&, KRect&, f32*, f32*, f32*, f32*)
{
/*
.loc_0x0:
@ -2689,7 +2689,7 @@ KSegment::KSegment()
* Address: 8003958C
* Size: 0018C4
*/
void sqrDistance(KSegment&, KTri&, f32*, f32*, f32*)
f32 sqrDistance(KSegment&, KTri&, f32*, f32*, f32*)
{
/*
.loc_0x0:
@ -4356,7 +4356,7 @@ void sqrDistance(KSegment&, KTri&, f32*, f32*, f32*)
* Address: 8003AE50
* Size: 000828
*/
void sqrDistance(KSegment&, KSegment&, f32*, f32*)
f32 sqrDistance(KSegment&, KSegment&, f32*, f32*)
{
/*
.loc_0x0:
@ -4976,7 +4976,7 @@ void sqrDistance(KSegment&, KSegment&, f32*, f32*)
* Address: 8003B678
* Size: 001D9C
*/
void sqrDistance(KSegment&, KRect&, f32*, f32*, f32*)
f32 sqrDistance(KSegment&, KRect&, f32*, f32*, f32*)
{
/*
.loc_0x0:
@ -6969,7 +6969,7 @@ void sqrDistance(KSegment&, KRect&, f32*, f32*, f32*)
* Address: 8003D414
* Size: 000468
*/
void sqrDistance(KTri&, KRect&, f32*, f32*, f32*, f32*)
f32 sqrDistance(KTri&, KRect&, f32*, f32*, f32*, f32*)
{
/*
.loc_0x0:
@ -7283,7 +7283,7 @@ void sqrDistance(KTri&, KRect&, f32*, f32*, f32*, f32*)
* Address: 8003D87C
* Size: 000540
*/
void sqrDistance(Vector3f&, KTri&, f32*, f32*)
f32 sqrDistance(Vector3f&, KTri&, f32*, f32*)
{
/*
.loc_0x0: