From f75a90fca244d9cc3ab2f967e645ad618f19704c Mon Sep 17 00:00:00 2001 From: Dean Southwood Date: Thu, 28 Nov 2024 20:03:53 +1100 Subject: [PATCH] misc progress part 72 --- include/Animator.h | 4 + include/BaseInf.h | 6 +- include/Creature.h | 58 +- include/CreatureCollPart.h | 5 + include/CreatureNode.h | 2 +- include/EffectMgr.h | 11 +- include/Generator.h | 4 +- include/MapMgr.h | 34 +- include/Navi.h | 4 +- include/NaviMgr.h | 20 +- include/ObjectMgr.h | 10 +- include/Pellet.h | 3 +- include/PelletView.h | 15 +- include/PlantMgr.h | 85 +- include/Shape.h | 118 +- include/SoundMgr.h | 3 +- include/StateMachine.h | 9 + include/TekiParameters.h | 97 +- include/Vector.h | 2 + include/gameflow.h | 131 +-- include/nlib/Geometry.h | 6 +- include/nlib/Math.h | 31 +- include/teki.h | 149 ++- include/zen/particle.h | 44 +- include/zen/zenList.h | 25 +- src/plugPikiKando/aiActions.cpp | 2 +- src/plugPikiKando/creature.cpp | 18 +- src/plugPikiKando/interactPullout.cpp | 2 +- src/plugPikiKando/itemMgr.cpp | 14 +- src/plugPikiKando/kusaItem.cpp | 8 +- src/plugPikiKando/mapParts.cpp | 179 +--- src/plugPikiKando/mizuItem.cpp | 2 +- src/plugPikiKando/navi.cpp | 4 +- src/plugPikiKando/naviMgr.cpp | 314 +----- src/plugPikiKando/objectMgr.cpp | 7 - src/plugPikiKando/pelletMgr.cpp | 4 +- src/plugPikiKando/pikiInf.cpp | 8 +- src/plugPikiKando/plantMgr.cpp | 1069 ++++--------------- src/plugPikiKando/viewPiki.cpp | 6 +- src/plugPikiNakata/genteki.cpp | 6 +- src/plugPikiNakata/panitestsection.cpp | 4 +- src/plugPikiNakata/taiattackactions.cpp | 40 +- src/plugPikiNakata/taichappy.cpp | 6 +- src/plugPikiNakata/taicollec.cpp | 4 +- src/plugPikiNakata/taiiwagen.cpp | 4 +- src/plugPikiNakata/taikinoko.cpp | 2 +- src/plugPikiNakata/taimizinko.cpp | 4 +- src/plugPikiNakata/tainapkid.cpp | 2 +- src/plugPikiNakata/taiotimoti.cpp | 4 +- src/plugPikiNakata/taipalm.cpp | 2 +- src/plugPikiNakata/taishell.cpp | 6 +- src/plugPikiNakata/taiswallow.cpp | 4 +- src/plugPikiNakata/teki.cpp | 14 +- src/plugPikiNakata/tekibteki.cpp | 1033 ++++-------------- src/plugPikiNakata/tekiparameters.cpp | 14 +- src/plugPikiYamashita/TAIbeatle.cpp | 2 +- src/plugPikiYamashita/TAIdororo.cpp | 2 +- src/plugPikiYamashita/TAIhibaA.cpp | 2 +- src/plugPikiYamashita/TAIkabekuiA.cpp | 2 +- src/plugPikiYamashita/TAIkabekuiB.cpp | 2 +- src/plugPikiYamashita/TAIkabekuiC.cpp | 2 +- src/plugPikiYamashita/TAImar.cpp | 2 +- src/plugPikiYamashita/TAImiurin.cpp | 2 +- src/plugPikiYamashita/TAIotama.cpp | 2 +- src/plugPikiYamashita/TAItamago.cpp | 2 +- src/plugPikiYamashita/TAItank.cpp | 2 +- src/plugPikiYamashita/TAIusuba.cpp | 3 +- src/plugPikiYamashita/effectMgr.cpp | 9 +- src/plugPikiYamashita/gameCourseClear.cpp | 24 - src/plugPikiYamashita/particleGenerator.cpp | 35 - src/sysCommon/shapeBase.cpp | 4 +- 71 files changed, 1197 insertions(+), 2562 deletions(-) diff --git a/include/Animator.h b/include/Animator.h index fd2f9e77..e2fd0ad9 100644 --- a/include/Animator.h +++ b/include/Animator.h @@ -334,12 +334,16 @@ struct AnimMgr : public CoreNode { /** * @brief TODO + * + * @note Size: 0x18. */ struct AnimFrameCacher { AnimFrameCacher(int); void updateInfo(AnimCacheInfo*); void removeOldest(); void cacheFrameSpace(int, AnimCacheInfo*); + + u8 _00[0x18]; // _00, unknown }; #endif diff --git a/include/BaseInf.h b/include/BaseInf.h index 1ad4bf9a..dbc2d30e 100644 --- a/include/BaseInf.h +++ b/include/BaseInf.h @@ -31,7 +31,7 @@ struct BaseInf : public CoreNode { // _00 = VTBL // _00-_14 = CoreNode Vector3f mPosition; // _14 - Vector3f _20; // _20 + Vector3f mRotation; // _20 }; /** @@ -70,8 +70,8 @@ struct CreatureInf : public BaseInf { u32 _30; // _30, unknown int _34; // _34 int _38; // _38 - int _3C; // _40 - int _40; // _44 + int mTekiType; // _3C + int _40; // _40 f32 _44; // _44 f32 _48; // _48 }; diff --git a/include/Creature.h b/include/Creature.h index b67d4362..505bb847 100644 --- a/include/Creature.h +++ b/include/Creature.h @@ -33,29 +33,29 @@ struct SeContext; * @brief TODO */ enum CreatureFlags { - CF_Unk1 = 1 << 0, // 0x1 - CF_Unk2 = 1 << 1, // 0x2 - CF_Unk3 = 1 << 2, // 0x4 - CF_Unk4 = 1 << 3, // 0x8 - CF_Unk5 = 1 << 4, // 0x10 - CF_Unk6 = 1 << 5, // 0x20 - CF_Unk7 = 1 << 6, // 0x40 - CF_Unk8 = 1 << 7, // 0x80 - CF_Unk9 = 1 << 8, // 0x100 - CF_Unk10 = 1 << 9, // 0x200 - CF_Unk11 = 1 << 10, // 0x400 - CF_Unk12 = 1 << 11, // 0x800 - 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 - CF_Unk16 = 1 << 16, // 0x10000 - CF_Unk17 = 1 << 17, // 0x20000 - CF_Unk18 = 1 << 18, // 0x40000 - CF_Unk19 = 1 << 19, // 0x80000, use result flags maybe? - CF_Unk20 = 1 << 20, // 0x100000 - CF_FixPosition = 1 << 21, // 0x200000 - CF_Unk22 = 1 << 22, // 0x400000 + CF_Unk1 = 1 << 0, // 0x1 + CF_Unk2 = 1 << 1, // 0x2 + CF_Unk3 = 1 << 2, // 0x4 + CF_Unk4 = 1 << 3, // 0x8 + CF_Unk5 = 1 << 4, // 0x10 + CF_Unk6 = 1 << 5, // 0x20 + CF_Unk7 = 1 << 6, // 0x40 + CF_Unk8 = 1 << 7, // 0x80 + CF_Unk9 = 1 << 8, // 0x100 + CF_Unk10 = 1 << 9, // 0x200 + CF_Unk11 = 1 << 10, // 0x400 + CF_Unk12 = 1 << 11, // 0x800 + 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 + CF_Unk16 = 1 << 16, // 0x10000 + CF_Unk17 = 1 << 17, // 0x20000 + CF_Unk18 = 1 << 18, // 0x40000 + CF_Unk19 = 1 << 19, // 0x80000, use result flags maybe? + CF_AIAlwaysActive = 1 << 20, // 0x100000, do not cull AI when off-camera + CF_FixPosition = 1 << 21, // 0x200000 + CF_Unk22 = 1 << 22, // 0x400000 }; /** @@ -218,6 +218,12 @@ struct Creature : public RefCountable, public EventTalker { || mObjType == OBJTYPE_SluiceBombHard; } + inline void reset70andA4() + { // TODO: rename when we know what _70 and _A4 are + _70.reset(); + _A4.reset(); + } + // _00 = VTBL // _00-_08 = RefCountable // _08-_1C = EventTalker @@ -235,8 +241,8 @@ struct Creature : public RefCountable, public EventTalker { u32 _68; // _68, might be int EObjType mObjType; // _6C, object type Vector3f _70; // _70 - Vector3f _7C; // _7C, maybe scale? - Vector3f _88; // _88, maybe rotation? + Vector3f mScale; // _7C + Vector3f mRotation; // _88 Vector3f mPosition; // _94 f32 mDirection; // _A0 Vector3f _A4; // _A4 @@ -276,7 +282,7 @@ struct Creature : public RefCountable, public EventTalker { Matrix4f _228; // _228 u8 _268[0x26C - 0x268]; // _268, TODO: work out members f32 _26C; // _26C - f32 _270; // _270 + f32 mCollisionRadius; // _270 Vector3f _274; // _274 DynCollObject* _280; // _280 Vector3f* _284; // _284, coll plat normal maybe? diff --git a/include/CreatureCollPart.h b/include/CreatureCollPart.h index bbd25bcb..5802bec9 100644 --- a/include/CreatureCollPart.h +++ b/include/CreatureCollPart.h @@ -31,6 +31,11 @@ struct CreatureCollPart : public DynCollShape { * @brief TODO */ struct CreaturePlatMgr { + CreaturePlatMgr() + : mPartCount(0) + { + } + void init(Creature*, MapMgr*, Shape*); void release(); void update(Graphics&); diff --git a/include/CreatureNode.h b/include/CreatureNode.h index 89ac338f..d5533997 100644 --- a/include/CreatureNode.h +++ b/include/CreatureNode.h @@ -29,7 +29,7 @@ struct CreatureNodeMgr : public ObjectMgr { virtual int getFirst(); // _0C virtual int getNext(int); // _10 virtual bool isDone(int); // _14 - virtual ~CreatureNodeMgr(); // _48 + virtual ~CreatureNodeMgr() { } // _48 virtual int getSize(); // _60 virtual int getMax(); // _64 diff --git a/include/EffectMgr.h b/include/EffectMgr.h index 95bf6306..2a4e4b28 100644 --- a/include/EffectMgr.h +++ b/include/EffectMgr.h @@ -113,6 +113,8 @@ struct EffectMgr : public CoreNode { EFF_Unk47 = 47, EFF_Unk48 = 48, // ... + EFF_Unk52 = 52, + // ... EFF_Unk69 = 69, }; @@ -137,14 +139,15 @@ struct EffectMgr : public CoreNode { void draw(Graphics&); void drawshapes(Graphics&); void exit(); - void create(EffectMgr::effTypeTable, Vector3f&, zen::CallBack1*, - zen::CallBack2*); - void create(EffectMgr::modelTypeTable, Vector3f&, Vector3f&, Vector3f&); + zen::particleGenerator* create(EffectMgr::effTypeTable, Vector3f&, zen::CallBack1*, + zen::CallBack2*); + zen::particleGenerator* create(EffectMgr::modelTypeTable, Vector3f&, Vector3f&, Vector3f&); void getShapeInst(); void killAllShapes(); // unused/inlined: - void create(EffectMgr::simpleTypeTable, Vector3f&, s16, Vector3f&, Vector3f&, f32, f32, zen::CallBack1*); + zen::particleGenerator* create(EffectMgr::simpleTypeTable, Vector3f&, s16, Vector3f&, Vector3f&, f32, f32, + zen::CallBack1*); void putShapeInst(EffShpInst*); // _00 = VTBL diff --git a/include/Generator.h b/include/Generator.h index 0d63b40d..4e973d8b 100644 --- a/include/Generator.h +++ b/include/Generator.h @@ -386,7 +386,7 @@ struct GenObjectPlant : public GenObject { // _04 = VTBL // _00-_18 = GenObject - // TODO: members + int mPlantType; // _18 }; /** @@ -439,7 +439,7 @@ struct GenObjectInfo { u32 mID; // _00 GenFunc mGenFunction; // _04 char* mName; // _08 - int _0C; // _0C + u32 mVersion; // _0C }; /** diff --git a/include/MapMgr.h b/include/MapMgr.h index 89a27259..a0149b83 100644 --- a/include/MapMgr.h +++ b/include/MapMgr.h @@ -114,9 +114,10 @@ struct MapObjectPart : public DynCollShape { * @brief TODO */ struct MapParts : public DynCollShape { - MapParts(Shape* shape) // TODO: fix this, it's implicit but required/this is just a guess + MapParts(Shape* shape) : DynCollShape(shape) { + _140 = nullptr; } virtual void read(RandomAccessStream&); // _0C @@ -124,11 +125,14 @@ struct MapParts : public DynCollShape { virtual void applyVelocity(Plane&, Vector3f&, Vector3f&); // _34 virtual void init(); // _48 - void getShapeFile(int); + static char* getShapeFile(int); - // _00 = VTBL - // _00-_?? = DynCollShape - // TODO: members + static char* shapeFiles[4]; + + // _00 = VTBL + // _00-_140 = DynCollShape + Vector3f* _140; // _140, may also be a ptr to a struct with a Vector3f at _00. + Vector3f _144; // _144 }; /** @@ -139,8 +143,8 @@ struct MapEntity : public MapParts { virtual void update(); // _10 - // _00 = VTBL - // _00-_?? = MapParts + // _00 = VTBL + // _00-_150 = MapParts // TODO: members }; @@ -154,9 +158,19 @@ struct MapSlider : public MapParts { virtual void refresh(Graphics&); // _44 virtual void init(); // _48 - // _00 = VTBL - // _00-_?? = MapParts - // TODO: members + // _00 = VTBL + // _00-_150 = MapParts + Vector3f _150; // _150 + f32 _15C; // _15C + int _160; // _160 + int _164; // _164 + f32 _168; // _168 + f32 _16C; // _16C + f32 _170; // _170 + int _174; // _174 + int _178; // _178 + int _17C; // _17C + f32 _180; // _180 }; /** diff --git a/include/Navi.h b/include/Navi.h index 842382e0..7ea925e3 100644 --- a/include/Navi.h +++ b/include/Navi.h @@ -47,8 +47,8 @@ struct Navi : public Creature, public PaniAnimKeyListener, public PelletView { virtual void doKill(); // _10C virtual void viewKill(); // _154 (weak) virtual void viewDraw(Graphics&, Matrix4f&); // _158 (weak) - virtual void viewGetBottomRadius(); // _15C (weak) - virtual void viewGetHeight(); // _160 (weak) + virtual f32 viewGetBottomRadius(); // _15C (weak) + virtual f32 viewGetHeight(); // _160 (weak) virtual void viewStartTrembleMotion(f32); // _164 (weak) virtual void animationKeyUpdated(PaniAnimKeyEvent&); // _168 (weak) diff --git a/include/NaviMgr.h b/include/NaviMgr.h index 6060dd4e..f9870242 100644 --- a/include/NaviMgr.h +++ b/include/NaviMgr.h @@ -4,19 +4,22 @@ #include "types.h" #include "ObjectMgr.h" #include "CreatureProp.h" +#include "Piki.h" #include "Navi.h" /** * @brief TODO + * + * @note Size: 0x43C. */ struct NaviProp : public CreatureProp { NaviProp(); virtual void read(RandomAccessStream&); // _08 (weak) - // _F8 = VTBL - // _00-_FC = CreatureProp - // TODO: work out members + // _54 = VTBL + // _00-_58 = CreatureProp + u8 _58[0x43C - 0x58]; // _58, unknown }; /** @@ -25,7 +28,7 @@ struct NaviProp : public CreatureProp { struct NaviMgr : public MonoObjectMgr { NaviMgr(); - virtual ~NaviMgr(); // _48 + virtual ~NaviMgr() { } // _48 virtual void update(); // _4C virtual Navi* createObject(); // _80 virtual void read(RandomAccessStream&); // _84 @@ -42,7 +45,14 @@ struct NaviMgr : public MonoObjectMgr { // _00 = VTBL 1 // _08 = VTBL 2 // _00-_3C = MonoObjectMgr - // TODO: members + u8 _3C[0x4]; // _3C, unknown + Shape* mNaviShape; // _40 + u8 _44[0x4]; // _44, unknown + PikiShapeObject* mNaviShapeObject; // _48 + u8 _4C[0x4]; // _4C, unknown + PaniMotionTable* mMotionTable; // _50 + int mNaviID; // _54 + NaviProp* mNaviParms; // _58 }; extern NaviMgr* naviMgr; diff --git a/include/ObjectMgr.h b/include/ObjectMgr.h index 050d98b8..2ef7f481 100644 --- a/include/ObjectMgr.h +++ b/include/ObjectMgr.h @@ -80,11 +80,11 @@ struct MonoObjectMgr : public ObjectMgr { // _00 = VTBL 1 // _08 = VTBL 2 // _00-_28 = ObjectMgr - u32 _28; // _28, array of something, maybe Creature* - int _2C; // _2C - u32 _30; // _30, unknown - int* _34; // _34 - u32 _38; // _38, unknown + Creature** _28; // _28, array of objects + int _2C; // _2C + int _30; // _30 + int* _34; // _34 + u32 _38; // _38, unknown }; /** diff --git a/include/Pellet.h b/include/Pellet.h index 972945e8..741c3987 100644 --- a/include/Pellet.h +++ b/include/Pellet.h @@ -70,7 +70,6 @@ struct Pellet : public DualCreature { virtual void doCreateColls(Graphics&); // _11C virtual void animationKeyUpdated(PaniAnimKeyEvent&); // _12C (weak) - void isUfoPartsID(u32); void getState(); void setTrySound(bool); void startPick(); @@ -101,6 +100,8 @@ struct Pellet : public DualCreature { void stopMotion(); void startAppear(); + static bool isUfoPartsID(u32); + // _00 = VTBL // _00-_43C = DualCreature? // TODO: members diff --git a/include/PelletView.h b/include/PelletView.h index f3d41944..0019751e 100644 --- a/include/PelletView.h +++ b/include/PelletView.h @@ -2,13 +2,16 @@ #define _PELLETVIEW_H #include "types.h" +#include "Vector.h" + +struct Pellet; /** * @brief TODO */ struct PelletView { inline PelletView() - : _04(0) + : mPellet(nullptr) { } @@ -20,14 +23,14 @@ struct PelletView { virtual void viewSetMotionSpeed(f32); // _1C (weak) virtual void viewFinishMotion(); // _20 (weak) virtual void viewDoAnimation(); // _24 (weak) - virtual void viewGetBottomRadius() = 0; // _28 - virtual void viewGetHeight() = 0; // _2C - virtual void viewGetScale(); // _30 (weak) + virtual f32 viewGetBottomRadius() = 0; // _28 + virtual f32 viewGetHeight() = 0; // _2C + virtual Vector3f viewGetScale(); // _30 (weak) - void becomePellet(u32, struct Vector3f&, f32); + void becomePellet(u32, Vector3f&, f32); // _00 = VTBL - u32 _04; // _04, unknown - probably Pellet* mPellet? + Pellet* mPellet; // _04 }; #endif diff --git a/include/PlantMgr.h b/include/PlantMgr.h index 36c3f1af..50459375 100644 --- a/include/PlantMgr.h +++ b/include/PlantMgr.h @@ -7,43 +7,69 @@ struct MapMgr; +/** + * @brief Descriptions taken from translations or from Minty Meeo's documentation. + */ +enum PlantTypes { + PLANT_NULL = -1, + PLANT_START = 0, + PLANT_Clover = 0, // clover + PLANT_Chidome = 1, // red lawn marshpennywort (Hydrocotyle sibthorpioides) + PLANT_Hutaba = 2, // (really) short shoot + PLANT_Ine = 3, // tall grass + PLANT_Tanpopo = 4, // dandelion + PLANT_Ooinu_l = 5, // birdseye speedwell (Veronica persica), large + PLANT_Ooinu_s = 6, // birdseye speedwell (Veronica persica), small + PLANT_Mizukusa = 7, // pygmy chain sword (Echinodorus Tenellus) + PLANT_Wakame_l = 8, // shoot, large + PLANT_Wakame_s = 9, // shoot, small + PLANT_KinokoLt = 10, // glowcap (kinoko light) + PLANT_Hae = 11, // flies (yes flies are a plant in Pikmin) + PLANT_COUNT, // 12 +}; + /** * @brief TODO */ struct PlantShapeObject { - PlantShapeObject(Shape*, char*, char*); + PlantShapeObject(Shape* shape, char* plantName, char* fileName); - // TODO: members + Shape* mShape; // _00 + AnimMgr* mAnimMgr; // _04 + AnimContext mAnimContext; // _08 }; /** * @brief TODO + * + * @note Size: 0x398. */ struct Plant : public AICreature { Plant(); - virtual void startAI(int); // _34 - virtual f32 getiMass(); // _38 - virtual bool isAlive(); // _88 - virtual void update(); // _E0 - virtual void refresh(Graphics&); // _EC - virtual void doAnimation(); // _108 - virtual void doKill(); // _10C - virtual void startMotion(int); // _130 - virtual void setMotionSpeed(f32); // _14C - virtual void stopMotion(); // _150 + virtual void startAI(int); // _34 + virtual f32 getiMass() { return 0.0f; } // _38 + virtual bool isAlive() { return !_30C; } // _88 + virtual void update(); // _E0 + virtual void refresh(Graphics&); // _EC + virtual void doAnimation(); // _108 + virtual void doKill(); // _10C + virtual void startMotion(int); // _130 + virtual void setMotionSpeed(f32 speed) { mMotionSpeed = speed; } // _14C + virtual void stopMotion() { mMotionSpeed = 0.0f; } // _150 // unused/inlined: void reset(int); // _00 = VTBL // _00-_304 = AICreature - u16 _304; // _304 - f32 _308; // _308 + u16 mPlantType; // _304, see PlantTypes enum + f32 mMotionSpeed; // _308 u8 _30C; // _30C PaniPlantAnimator mPlantAnimator; // _310 SearchData mPlantSearchData[3]; // _364 Vector3f _388; // _388 + u8 _394; // _394 // TODO: work out members }; @@ -55,6 +81,15 @@ struct PlantAI : public SimpleAI { /** * @brief TODO */ + enum StateID { + STATE_Wait = 0, + STATE_Touch = 1, + STATE_COUNT, // 2 + }; + + /** + * @brief Condition to move from WaitInit to TouchInit. + */ struct OpponentMove : public SAICondition { virtual bool satisfy(AICreature*); // _10 @@ -91,7 +126,7 @@ struct PlantAI : public SimpleAI { PlantAI(); // _00 = VTBL - // _00-_?? = SimpleAI + // _00-_1C = SimpleAI // TODO: members }; @@ -104,28 +139,36 @@ struct PlantMgr : public CreatureNodeMgr { * @brief TODO */ struct UseNode : public CoreNode { + UseNode() { initCore("usageNode"); } + // _00 = VTBL // _00-_14 = CoreNode - // TODO: members + int mPlantType; // _14 }; PlantMgr(MapMgr*); - virtual ~PlantMgr(); // _48 + virtual ~PlantMgr() { } // _48 virtual Plant* createObject(); // _78 void initialise(); - void usePlantType(int); + bool usePlantType(int); // unused/inlined: - void getPlantName(int); + char* getPlantName(int); void addUseList(int); - void birth(); + Plant* birth(); // _00 = VTBL 1 // _08 = VTBL 2 // _00-_40 = CreatureNodeMgr - // TODO: members + PlantShapeObject** mPlantShapes; // _40 + PaniMotionTable* mMotionTable; // _44 + MapMgr* mMapMgr; // _48 + UseNode mRootUseNode; // _4C + PlantAI* mAI; // _64 + CreatureProp* mPlantProps; // _68 + AnimFrameCacher* mAnimFrameCacher; // _6C }; extern PlantMgr* plantMgr; diff --git a/include/Shape.h b/include/Shape.h index d6fd797b..2398b22c 100644 --- a/include/Shape.h +++ b/include/Shape.h @@ -157,65 +157,65 @@ struct BaseShape : public CoreNode { // _00 = VTBL // _00-_14 = CoreNode - u32 _14; // _14, unknown - u32 _18; // _14, unknown - u8 _1C[0x24 - 0x1C]; // _18, unknown - u32 _24; // _24, unknown - u32 _28; // _28, unknown - u32 _2C; // _2C, unknown - u32 _30; // _30, unknown - u32 _34; // _34, unknown - u32 _38; // _38, unknown - u32 _3C; // _3C, unknown - u32 _40; // _40, unknown - u32 _44; // _44, unknown - u32 _48; // _48, unknown - u32 _4C; // _4C, unknown - u32 _50; // _50, unknown - u32 _54; // _54, unknown - u32 _58; // _58, unknown - u32 _5C; // _5C, unknown - u32 _60; // _60, unknown - u32 _64; // _64, unknown - u32 _68; // _68, unknown - u8 _6C[0x74 - 0x6C]; // _6C, unknown - u32 _74; // _74, unknown - u8 _78[0x4]; // _78, unknown - LightGroup mLightGroup; // _7C - ObjCollInfo mCollisionInfo; // _E8 - u32 _13C; // _13C, unknown - BoundBox _140; // _140 - u8 _158[0x164 - 0x158]; // _158, unknown - u32 _164; // _164, unknown - u32 _168; // _168, unknown - u32 _16C; // _16C, unknown - u32 _170; // _170, unknown - u32 _174; // _174, unknown - RouteGroup mRouteGroup; // _178 - u8 _18C[0x238 - 0x18C]; // _18C, unknown - u32 _238; // _238, unknown - u32 _23C; // _23C, unknown - u8 _240[0x4]; // _240, unknown - u32 _244; // _244, unknown - u32 _248; // _248, unknown - u8 _24C[0x26C - 0x24C]; // _18C, unknown - u32 _26C; // _26C, unknown - u32 _270; // _270, unknown - u32 _274; // _274, unknown - u32 _278; // _278, unknown - u32 _27C; // _27C, unknown - u32 _280; // _280, unknown - u32 _284; // _284, unknown - u32 _288; // _288, unknown - u8 _28C[0x4]; // _28C, unknown - u32 _290; // _290, unknown - u8 _294[0x4]; // _294, unknown - u32 _298; // _298, unknown - u32 _29C; // _29C, unknown - u32 _2A0; // _2A0, unknown - u32 _2A4; // _2A4, unknown - u32 _2A8; // _2A8, unknown - u8 _2AC; // _2AC + u32 _14; // _14, unknown + u32 _18; // _14, unknown + u8 _1C[0x24 - 0x1C]; // _18, unknown + AnimFrameCacher* mFrameCacher; // _24, unknown + u32 _28; // _28, unknown + u32 _2C; // _2C, unknown + u32 _30; // _30, unknown + u32 _34; // _34, unknown + u32 _38; // _38, unknown + u32 _3C; // _3C, unknown + u32 _40; // _40, unknown + u32 _44; // _44, unknown + u32 _48; // _48, unknown + u32 _4C; // _4C, unknown + u32 _50; // _50, unknown + u32 _54; // _54, unknown + u32 _58; // _58, unknown + u32 _5C; // _5C, unknown + u32 _60; // _60, unknown + u32 _64; // _64, unknown + u32 _68; // _68, unknown + u8 _6C[0x74 - 0x6C]; // _6C, unknown + u32 _74; // _74, unknown + u8 _78[0x4]; // _78, unknown + LightGroup mLightGroup; // _7C + ObjCollInfo mCollisionInfo; // _E8 + u32 _13C; // _13C, unknown + BoundBox _140; // _140 + u8 _158[0x164 - 0x158]; // _158, unknown + u32 _164; // _164, unknown + u32 _168; // _168, unknown + u32 _16C; // _16C, unknown + u32 _170; // _170, unknown + u32 _174; // _174, unknown + RouteGroup mRouteGroup; // _178 + u8 _18C[0x238 - 0x18C]; // _18C, unknown + u32 _238; // _238, unknown + u32 _23C; // _23C, unknown + u8 _240[0x4]; // _240, unknown + u32 _244; // _244, unknown + u32 _248; // _248, unknown + u8 _24C[0x26C - 0x24C]; // _18C, unknown + u32 _26C; // _26C, unknown + u32 _270; // _270, unknown + u32 _274; // _274, unknown + u32 _278; // _278, unknown + u32 _27C; // _27C, unknown + u32 _280; // _280, unknown + u32 _284; // _284, unknown + u32 _288; // _288, unknown + u8 _28C[0x4]; // _28C, unknown + u32 _290; // _290, unknown + u8 _294[0x4]; // _294, unknown + u32 _298; // _298, unknown + u32 _29C; // _29C, unknown + u32 _2A0; // _2A0, unknown + u32 _2A4; // _2A4, unknown + u32 _2A8; // _2A8, unknown + u8 _2AC; // _2AC // OLD - idk what this is from but it's not correct. // s32 mSystemUsed; // _14 diff --git a/include/SoundMgr.h b/include/SoundMgr.h index c0b3b315..a024ebe2 100644 --- a/include/SoundMgr.h +++ b/include/SoundMgr.h @@ -157,7 +157,6 @@ struct SeSystem { void exitCourse(); void playSysSe(int); void stopSysSe(int); - void playPlayerSe(int); void stopPlayerSe(int); // unused/inlined: @@ -166,6 +165,8 @@ struct SeSystem { void getEventType(int); void isLoopType(int); + static void playPlayerSe(int); + // TODO: members u8 _00[0x78]; // _00, unknown }; diff --git a/include/StateMachine.h b/include/StateMachine.h index 7ccfb820..0b04cd86 100644 --- a/include/StateMachine.h +++ b/include/StateMachine.h @@ -73,6 +73,15 @@ struct StateMachine { mStateCount++; } + inline void setup(int limit) + { + mStateLimit = limit; + mStateCount = 0; + mStates = new AState*[mStateLimit]; + mStateIDs = new int[mStateLimit]; + mStateIndexes = new int[mStateLimit]; + } + inline bool isFull() { return mStateCount >= mStateLimit; } // _00 = VTBL diff --git a/include/TekiParameters.h b/include/TekiParameters.h index d0acb1fb..b8de8741 100644 --- a/include/TekiParameters.h +++ b/include/TekiParameters.h @@ -6,6 +6,100 @@ #include "ID32.h" #include "ParaParameters.h" +// Descriptions from code use and from Minty Meeo's notes. + +/** + * @brief TODO + */ +enum TekiFloatParams { + TPF_Life = 0, // Max health + TPF_Scale = 1, // Size of teki + TPF_Weight = 2, + TPF_WalkVelocity = 3, + TPF_RunVelocity = 4, // speed of teki in pursuit of attention node + TPF_TurnVelocity = 5, // speed of teki pivoting + TPF_VisibleRange = 6, // depth of view to pursue a target + TPF_VisibleAngle = 7, // field of view to pursue a target + TPF_AttackableRange = 8, // depth of view to perform an attack + TPF_AttackableAngle = 9, // field of view to perform an attack + TPF_AttackRange = 10, // radius of attack hitbox + TPF_AttackHitRange = 11, + TPF_AttackPower = 12, // damage dealt by attack + TPF_AttackWaitPeriod = 13, // time between attack actions + TPF_UnguardedPeriod = 14, + TPF_DangerTerritoryRange = 15, + TPF_SafetyTerritoryRange = 16, + TPF_LifeGaugeOffset = 17, // vertical offset of life gauge + TPF_ShadowSize = 18, // scale of teki shadow + TPF_RippleScale = 19, // scale of water ripples generated by teki + TPF_CorpseSize = 20, // radius pikis grab corpse pellet at + TPF_CorpseHeight = 21, + TPF_SpawnDistance = 22, // horizontal distance to add to tekis birthed by teki + TPF_SpawnHeight = 23, // vertical distance to add to tekis birthed by teki + TPF_SpawnVelocity = 24, // speed of birthed tekis + TPF_LifePeriod = 25, // timer until death + TPF_MessageRange = 26, // radius in which, when other specific tekis enter it, teki will call for help + TPF_WarnPeriod = 27, + TPF_VisibleHeight = 28, + TPF_FlightHeight = 29, // if teki flies, height above ground teki will fly at + TPF_DamageMotionPeriod = 30, // time spent doing a single jiggle from damage + TPF_DamageMotionAmplitude = 31, // intensity of jiggle from damage + TPF_FlickProbability = 32, // if teki flicks, probability a piki will be flicked off + TPF_UpperFlickPower = 33, // + TPF_LowerFlickPower = 34, + TPF_UpperAttackPower = 35, + TPF_LowerAttackPower = 36, + TPF_LifeRecoverRate = 37, // health regeneration rate + TPF_TraceAngle = 38, // field of view in which teki will pursue you without pivoting in place + TPF_SpawnPelletVelocityHoriz = 39, // dropped pellet horizontal spawn speed + TPF_SpawnPelletVelocityVert = 40, // dropped pellet vertical spawn speed + TPF_CorpseVelocityHoriz = 41, // corpse horizontal spawn speed + TPF_CorpseVelocityVert = 42, // corpse vertical spawn speed + TPF_BombDamageRate = 43, // bomb rock damage multiplier + TPF_CollisionRadius = 44, + TPF_LowerRange = 45, + TPF_RESERVED4 = 46, + TPF_RESERVED3 = 47, + TPF_RESERVED2 = 48, + TPF_RESERVED1 = 49, + TPF_COUNT, // 50 +}; + +/** + * @brief TODO + */ +enum TekiIntParams { + TPI_CorpseType = 0, // 0 = no corpse, 1 = corpse + TPI_ShadowType = 1, + TPI_CullingType = 2, // 0 = cull AI when off camera, 1 = do not cull AI + TPI_SpawnType = 3, // type of additional object spawned by enemy, see TekiTypes enum + TPI_SpawnCount = 4, + TPI_AnimationType = 5, + TPI_CarcassSize = 6, + TPI_ModelType = 7, + TPI_LightType = 8, + TPI_SwallowCount = 9, // max number of pikis eaten by swallow action + TPI_FlickPikiCount1 = 10, + TPI_FlickPikiCount2 = 11, + TPI_FlickPikiCount3 = 12, + TPI_FlickDamageCount1 = 13, + TPI_FlickDamageCount2 = 14, + TPI_FlickDamageCount3 = 15, + TPI_FlickDamageCount4 = 16, + TPI_SpawnPelletScaleOff = 17, + TPI_SpawnPelletForward = 18, + TPI_RESERVED1 = 19, + TPI_COUNT, // 20 +}; + +/** + * @brief TODO + */ +enum TekiCullingType { + CULLAI_CullAIOffCamera = 0, // cull AI when off camera + CULLAI_NeverCullAI = 1, // do not cull AI +}; + /** * @brief TODO * @@ -16,7 +110,8 @@ struct TekiParameters : public Node { virtual void read(RandomAccessStream&); // _0C - void getF(int); + f32 getF(int idx) { return mParameters->getF(idx); } // weak, see TekiFloatParams enum + int getI(int idx) { return mParameters->getI(idx); } // fabricated, see TekiIntParams enum // _00 = VTBL // _00-_20 = Node diff --git a/include/Vector.h b/include/Vector.h index cafb838d..bf6e2545 100644 --- a/include/Vector.h +++ b/include/Vector.h @@ -141,6 +141,8 @@ struct Vector3f { z = 1.0f; } + void reset() { set(Vector3f(0.0f, 0.0f, 0.0f)); } + // unused/inlined: void rotateTranspose(Matrix4f&); void rotate(Quat&); diff --git a/include/gameflow.h b/include/gameflow.h index b3a121b4..f1e5ed28 100644 --- a/include/gameflow.h +++ b/include/gameflow.h @@ -9,6 +9,7 @@ #include "string.h" #include "Ayu.h" +struct AnimFrameCacher; struct BaseApp; struct GameQuickInfo; struct GameChalQuickInfo; @@ -316,71 +317,71 @@ struct GameFlow : public Node { // _00 = VTBL // _00-_20 = Node - GamePrms* mParameters; // _20 - MemoryCard mMemoryCard; // _24 - u8 _6C[0x94 - 0x6C]; // _6C, unknown - GamePrefs mGamePrefs; // _94 - u8 _1A0[0x4]; // _1A0, unknown - might be part of GamePrefs - PlayState mPlayState; // _1A4 - u8 _1CC[0x1D0 - 0x1CC]; // _1CC, unknown - u32 _1D0; // _1D0, most recently opened stage? - u32 _1D4; // _1D4, unknown - u8 _1D8[0x4]; // _1D8, unknown - MoviePlayer* mMoviePlayer; // _1DC - u8 _1E0[0x1E8 - 0x1E0]; // _1E0, unknown - GameInterface* _1E8; // _1E8 - int _1EC; // _1EC - int mGameSectionID; // _1F0, see GameSectionID enum - int _1F4; // _1F4 - u8 _1F8[0x200 - 0x1F8]; // _1F8, unknown - u32 _200; // _200, unknown - Section* mGameSection; // _204 - char* _208; // _208 - char* _20C; // _20C - char* _210; // _210 - char* _214; // _214 - char* _218; // _218 - char* _21C; // _21C - char* _220; // _220 - char* _224; // _224 - char* _228; // _228 - char* _22C; // _22C - u8 _230[0x2A8 - 0x230]; // _230, unknown - u32 _2A8; // _2A8, unknown - u32 _2AC; // _2AC, unknown - u32 _2B0; // _2B0, could be int - u8 _2B4[0x2BC - 0x2B4]; // _2B4, unknown - u32 _2BC; // _2BC, unknown - u8 _2C0[0x2D8 - 0x2C0]; // _2C0, unknown - f32 _2D8; // _2D8 - f32 _2DC; // _2DC - f32 _2E0; // _2E0 - u8 _2E4[0x4]; // _2E4, unknown - f32 _2E8; // _2E8 - f32 _2EC; // _2EC - u8 _2F0[0x8]; // _2F0, unknown - u32 _2F8; // _2F8, unknown - u32 _2FC; // _2FC, unknown, but same as 0x30 in CreatureInf - u32 _300; // _300, unknown - f32 _304; // _304 - u32 _308; // _308, unknown - GameGenFlow* mGenFlow; // _30C - Texture* _310; // _310 - f32 _314; // _314 - u8 _318[0x31C - 0x318]; // _318, unknown - GameLoadIdler mGameLoadIdler; // _31C - u8 _330[0x338 - 0x330]; // _330, unknown - int _338; // _338 - u8 _33C[0x350 - 0x33C]; // _33C, unknown - u32 _350; // _350, unknown - u8 _354[0x8]; // _354, unknown - u8 _35C; // _35C, maybe Colour? - u8 _35D; // _35D - u8 _35E; // _35E - u8 _35F; // _35F - u8 _360; // _360 - u8 _361; // _361 - u8 _362; // _362 + GamePrms* mParameters; // _20 + MemoryCard mMemoryCard; // _24 + u8 _6C[0x94 - 0x6C]; // _6C, unknown + GamePrefs mGamePrefs; // _94 + u8 _1A0[0x4]; // _1A0, unknown - might be part of GamePrefs + PlayState mPlayState; // _1A4 + u8 _1CC[0x1D0 - 0x1CC]; // _1CC, unknown + u32 _1D0; // _1D0, most recently opened stage? + u32 _1D4; // _1D4, unknown + u8 _1D8[0x4]; // _1D8, unknown + MoviePlayer* mMoviePlayer; // _1DC + u8 _1E0[0x1E8 - 0x1E0]; // _1E0, unknown + GameInterface* _1E8; // _1E8 + int _1EC; // _1EC + int mGameSectionID; // _1F0, see GameSectionID enum + int _1F4; // _1F4 + u8 _1F8[0x200 - 0x1F8]; // _1F8, unknown + u32 _200; // _200, unknown + Section* mGameSection; // _204 + char* _208; // _208 + char* _20C; // _20C + char* _210; // _210 + char* _214; // _214 + char* _218; // _218 + char* _21C; // _21C + char* _220; // _220 + char* _224; // _224 + char* _228; // _228 + char* _22C; // _22C + u8 _230[0x2A8 - 0x230]; // _230, unknown + u32 _2A8; // _2A8, unknown + u32 _2AC; // _2AC, unknown + u32 _2B0; // _2B0, could be int + u8 _2B4[0x2BC - 0x2B4]; // _2B4, unknown + u32 _2BC; // _2BC, unknown + u8 _2C0[0x2D8 - 0x2C0]; // _2C0, unknown + f32 _2D8; // _2D8 + f32 _2DC; // _2DC + f32 _2E0; // _2E0 + u8 _2E4[0x4]; // _2E4, unknown + f32 _2E8; // _2E8 + f32 _2EC; // _2EC + u8 _2F0[0x8]; // _2F0, unknown + u32 _2F8; // _2F8, unknown + u32 _2FC; // _2FC, unknown, but same as 0x30 in CreatureInf + u32 _300; // _300, unknown + f32 _304; // _304 + AnimFrameCacher* mFrameCacher; // _308 + GameGenFlow* mGenFlow; // _30C + Texture* _310; // _310 + f32 _314; // _314 + u8 _318[0x31C - 0x318]; // _318, unknown + GameLoadIdler mGameLoadIdler; // _31C + u8 _330[0x338 - 0x330]; // _330, unknown + int _338; // _338 + u8 _33C[0x350 - 0x33C]; // _33C, unknown + u32 _350; // _350, unknown + u8 _354[0x8]; // _354, unknown + u8 _35C; // _35C, maybe Colour? + u8 _35D; // _35D + u8 _35E; // _35E + u8 _35F; // _35F + u8 _360; // _360 + u8 _361; // _361 + u8 _362; // _362 }; extern GameFlow gameflow; diff --git a/include/nlib/Geometry.h b/include/nlib/Geometry.h index 44fc58c3..2c1c4cc4 100644 --- a/include/nlib/Geometry.h +++ b/include/nlib/Geometry.h @@ -77,7 +77,7 @@ struct NVector3fIO { virtual void input(NVector3f&) = 0; // _08 virtual void output(NVector3f&) = 0; // _0C - // TODO: members + // _00 = VTBL }; /** @@ -87,7 +87,9 @@ struct NVector3fIOClass : public NVector3fIO { virtual void input(NVector3f&); // _08 virtual void output(NVector3f&); // _0C - // TODO: members + // _00 = VTBL + // _00-_04 = NVector3fIO + NVector3f _04; // _04, maybe in NVector3fIO, no idea. }; /** diff --git a/include/nlib/Math.h b/include/nlib/Math.h index f6401ce1..bab15e46 100644 --- a/include/nlib/Math.h +++ b/include/nlib/Math.h @@ -7,34 +7,9 @@ #include "Vector.h" namespace NMathF { -static inline f32 cos(f32) -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - bl 0xD5180 - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} -static inline f32 sin(f32) -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - bl 0xD52F4 - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} +inline f32 cos(f32 x) { return cosf(x); } +inline f32 sin(f32 x) { return sinf(x); } + f32 atan2(f32, f32); f32 remainder(f32, f32); diff --git a/include/teki.h b/include/teki.h index dca7949f..7ff08c49 100644 --- a/include/teki.h +++ b/include/teki.h @@ -7,6 +7,13 @@ #include "PaniAnimator.h" #include "PelletView.h" #include "Interactions.h" +#include "nlib/Geometry.h" +#include "nlib/Function.h" +#include "ComplexCreature.h" +#include "CreatureCollPart.h" +#include "TekiParameters.h" +#include "TekiPersonality.h" +#include "Shape.h" #include "system.h" struct NTeki; @@ -22,6 +29,11 @@ struct PeveAccelerationEvent; struct PeveCircleMoveEvent; struct PeveHorizontalSinWaveEvent; struct TekiPersonality; +struct CreaturePlatMgr; + +namespace zen { +struct PtclGenPack; +} // namespace zen namespace TekiNakata { // Teki-making utility functions @@ -46,7 +58,7 @@ enum TekiOptions { TEKIOPT_Invincible = 1 << 9, // 0x200 TEKIOPT_Pressed = 1 << 10, // 0x400 TEKIOPT_Unk11 = 1 << 11, // 0x800 - TEKIOPT_Unk12 = 1 << 12, // 0x1000 + TEKIOPT_StoppingMove = 1 << 12, // 0x1000 TEKIOPT_Drawed = 1 << 13, // 0x2000 TEKIOPT_ShapeVisible = 1 << 14, // 0x4000 TEKIOPT_DamageCountable = 1 << 15, // 0x8000 @@ -177,9 +189,9 @@ struct BTeki : public Creature, virtual public PaniAnimKeyListener, public Pelle virtual void viewFinishMotion(); // _154 virtual void viewDraw(Graphics&, Matrix4f&); // _158 virtual void viewKill(); // _15C - virtual void viewGetScale(); // _160 - virtual void viewGetBottomRadius(); // _164 - virtual void viewGetHeight(); // _168 + virtual Vector3f viewGetScale(); // _160 + virtual f32 viewGetBottomRadius(); // _164 + virtual f32 viewGetHeight(); // _168 virtual void init(int); // _16C virtual void reset(); // _170 virtual void startMotion(int); // _174 @@ -218,15 +230,11 @@ struct BTeki : public Creature, virtual public PaniAnimKeyListener, public Pelle virtual void dieSoon(); // _1EC virtual void becomeCorpse(); // _1F0 - bool isPellet(int); - void calcCircleDistanceStatic(Vector3f&, f32, Vector3f&, f32); - void calcSphereDistanceStatic(Vector3f&, f32, Vector3f&, f32); - void moveTowardStatic(Vector3f&, Vector3f&, f32, Vector3f&); - void arrivedAt(f32, f32); + bool arrivedAt(f32, f32); void prepareEffects(); void startStoppingMove(); void finishStoppingMove(); - void getVelocityAnimationSpeed(f32); + f32 getVelocityAnimationSpeed(f32); void releasePlatCollisions(); void createDeadEffect(); void createSoulEffect(); @@ -235,9 +243,6 @@ struct BTeki : public Creature, virtual public PaniAnimKeyListener, public Pelle void spawnWaters(int); void spawnCorpseParts(); void outputSpawnPosition(Vector3f&); - void getPersonalityF(int); - void getParameterF(int); - f32 getDirection() { return mDirection; } // weak function void nearestAngleTarget(Creature*); void cullableCenter(Creature&, f32); void cullableSphere(Creature&, f32); @@ -266,7 +271,7 @@ struct BTeki : public Creature, virtual public PaniAnimKeyListener, public Pelle void countPikis(Condition&); void getFlickDamageCount(int); void getGravity(); - void getStrategy(); + TekiStrategy* getStrategy(); void getSeaLevel(); void getYFromSeaLevel(); void makePositionRoute(Vector3f&, Vector3f&, bool); @@ -301,26 +306,17 @@ struct BTeki : public Creature, virtual public PaniAnimKeyListener, public Pelle void outputWorldAnimationMatrix(Matrix4f&, int, Matrix4f&); // unused void getCollisionCenter(); // unused - // whatever this code is, it comes up in a few spots to do with replacing creature targets - // it needs more inlining/to add more to the stack though - inline void removeTarget() - { - if (_418) { - _418->subCnt(); - _418 = nullptr; - } - } + f32 getDirection() { return mDirection; } // weak function + f32 getPersonalityF(int idx) { return mPersonality->mParams->getF(idx); } // weak + int getPersonalityI(int idx) { return mPersonality->mParams->getI(idx); } // weak - inline void addTarget(Creature* target) - { - if (_418) { - removeTarget(); - } - _418 = target; - if (_418) { - _418->addCnt(); - } - } + f32 getParameterF(int idx) { return mTekiParams->getF(idx); } // see TekiFloatParams enum + int getParameterI(int idx) { return mTekiParams->getI(idx); } // see TekiIntParams enum + + static bool isPellet(int); + static f32 calcCircleDistanceStatic(Vector3f&, f32, Vector3f&, f32); + static f32 calcSphereDistanceStatic(Vector3f&, f32, Vector3f&, f32); + static void moveTowardStatic(Vector3f&, Vector3f&, f32, Vector3f&); inline void setMotionSpeed(f32 speed) { @@ -335,6 +331,10 @@ struct BTeki : public Creature, virtual public PaniAnimKeyListener, public Pelle inline int getStateID() { return _324; } + inline f32 getParticleFactor() { return getParameterF(19); } // rename later when we know what this is + + inline f32 doGetVelocityAnimSpeed() { return getVelocityAnimationSpeed(_A4.length()); } + // this is basically two static enums smh static int TEKI_OPTION_VISIBLE; static int TEKI_OPTION_SHADOW_VISIBLE; @@ -360,31 +360,64 @@ struct BTeki : public Creature, virtual public PaniAnimKeyListener, public Pelle // _00 = VTBL // _000-_2B8 = Creature // _2B8-_2C0 = PelletView - u8 _2C0[0x2C8 - 0x2C4]; // _2C0, TODO: work out members - TekiPersonality* mPersonality; // _2C8 - PaniAnimator* mTekiAnimator; // _2CC - u8 _2D0[0x31C - 0x2D0]; // _2D0, TODO: work out members - u32 _31C; // _31C - TekiTypes mTekiType; // _320 - int _324; // _324, related to states - bool _328; // _328, related to states - u8 _329[0x330 - 0x329]; // _329, TODO: work out members - int _330; // _330 - int _334; // _334, related to actions - int _338; // _338, unknown, state id of some description? - u8 _33C[0x388 - 0x33C]; // _33C, TODO: work out members - Vector3f _388; // _388, possibly position - f32 _394; // _394 - u8 _398[0x3A8 - 0x398]; // _398, TODO: work out members - int _3A8; // _3A8 - u8 _3AC[0x3B4 - 0x3AC]; // _3AC, TODO: work out members - f32 mMotionSpeed; // _3B4 - u8 _3B8[0x410 - 0x3B8]; // _3B8, TODO: work out members - int mTekiOptions; // _410 - int mAnimKeyOptions; // _414 - Creature* _418; // _418, maybe attack target? - u8 _41C[0x454 - 0x41C]; // _41C, TODO: work out members - // _454 = PaniAnimKeyListener + // _2C0-_2C4 = ptr to PaniAnimKeyListener + TekiParameters* mTekiParams; // _2C4 + TekiPersonality* mPersonality; // _2C8 + PaniTekiAnimator* mTekiAnimator; // _2CC + TekiShapeObject* mTekiShape; // _2D0 + CreaturePlatMgr mPlatMgr; // _2D4 + int _31C; // _31C + TekiTypes mTekiType; // _320 + int _324; // _324, related to states + bool _328; // _328, related to states + u8 _329[0x330 - 0x329]; // _329, TODO: work out members + int _330; // _330 + int _334; // _334, related to actions + int _338; // _338, unknown, state id of some description? + f32 mStoredDamage; // _33C, damage waiting to be applied on next makeDamaged call + f32 _340; // _340 + int _344; // _344 + int _348; // _348, size of array at _450 + u32 _34C; // _34C, unknown + u32 _350; // _350 + int _354; // _354 + NVector3fIOClass _358; // _358 + NVector3fIOClass _368; // _368 + NVector3fIOClass _378; // _378 + NVector3f _388; // _388, possibly position + f32 _394; // _394 + NVector3f _398; // _398 + f32 _3A4; // _3A4 + int _3A8; // _3A8 + f32 _3AC; // _3AC + u32 _3B0; // _3B0, unknown + f32 mMotionSpeed; // _3B4 + f32 _3B8; // _3B8 + u32 _3BC; // _3BC, unknown + f32 _3C0; // _3C0 + f32 _3C4; // _3C4 + f32 _3C8; // _3C8 + f32 _3CC; // _3CC + f32 _3D0; // _3D0 + f32 _3D4; // _3D4 + u32* _3D8; // _3D8, array of something, total size 0x10 + zen::PtclGenPack* _3DC; // _3DC + ShapeDynMaterials _3E0; // _3E0, unknown + int _3F0; // _3F0 + int _3F4; // _3F4 + int _3F8; // _3F8 + int _3FC; // _3FC + int _400; // _400 + int _404; // _404 + int _408; // _408 + int _40C; // _40C + int mTekiOptions; // _410 + int mAnimKeyOptions; // _414 + SmartPtr _418[4]; // _418 + NVibrationFunction* _428; // _428 + SearchData mTekiSearchData[3]; // _42C + u32* _450; // _450, array of something, unsure what + // _454 = PaniAnimKeyListener }; /** diff --git a/include/zen/particle.h b/include/zen/particle.h index a517b03c..da73dc11 100644 --- a/include/zen/particle.h +++ b/include/zen/particle.h @@ -4,6 +4,7 @@ #include "types.h" #include "zen/zenList.h" #include "Dolphin/mtx.h" +#include "sysNew.h" struct Colour; struct Graphics; @@ -132,13 +133,39 @@ struct particleGenerator : public zenList { inline void resetFlag(u32 flag) { mGeneratorFlags &= ~flag; } inline bool isFlag(u32 flag) { return mGeneratorFlags & flag; } + inline void setF0(f32 val) { _F0 = val; } // unsure what this does, rename later + // _00 = VTBL // _00-_0C = zenList // TODO: members - u8 _0C[0x18 - 0xC]; // _0C, unknown - Vector3f* mEmitPosPtr; // _18 - u8 _1C[0x80 - 0x1C]; // _1C, unknown - u32 mGeneratorFlags; // _80 + Vector3f _0C; // _0C + Vector3f* mEmitPosPtr; // _18 + Vector3f _1C; // _1C + u8 _28[0x80 - 0x28]; // _28, unknown + u32 mGeneratorFlags; // _80 + u32 _84; // _84, unknown + u8 _88[0x94 - 0x88]; // _88, unknown + Vector3f _94; // _94 + Vector3f _A0; // _A0 + Vector3f _AC; // _AC + u8 _B8[0xF0 - 0xB8]; // _B8, unknown + f32 _F0; // _F0 + u8 _F4[0x12C - 0xF4]; // _F4, unknown + Vector3f _12C; // _12C + Vector3f _138; // _138 + Vector3f _144; // _144 + u8 _150[0x160 - 0x150]; // _150, unknown + Vector3f _160; // _160 + u8 _16C[0x4]; // _16C, unknown + Vector3f _170; // _170 + u8 _17C[0x4]; // _17C, unknown + Vector3f _180; // _180 + u8 _18C[0x8]; // _18C, unknown + Vector3f _194; // _194 + u8 _1A0[0x1D4 - 0x1A0]; // _1A0, unknown + u32 _1D4; // _1D4, unknown + u32 _1D8; // _1D8, unknown + Vector3f _1DC; // _1DC }; /* @@ -208,6 +235,15 @@ struct simplePtclManager { * @brief TODO */ struct PtclGenPack { + inline PtclGenPack(int limit) + { + mLimit = limit; + mGeneratorList = new particleGenerator*[mLimit]; + for (int i = 0; i < mLimit; i++) { + mGeneratorList[i] = nullptr; + } + } + void setPtclGenPtr(u32, particleGenerator*); void setEmitPosPtr(Vector3f*); void startGen(); diff --git a/include/zen/zenList.h b/include/zen/zenList.h index e4d2dda2..5be73d33 100644 --- a/include/zen/zenList.h +++ b/include/zen/zenList.h @@ -9,6 +9,8 @@ namespace zen { * @brief TODO */ struct zenList { + inline zenList() { mPrev = mNext = this; } + virtual void insertAfter(zenList*); // _08 virtual void remove(); // _0C @@ -21,14 +23,29 @@ struct zenList { * @brief TODO */ struct zenListManager { - zenListManager(); - - void get(); + zenListManager() + { + _00 = &_04; + zenList* list = _00; + _00->mNext = list; + _00->mPrev = list; + } + + zenList* get() + { + zenList* out = nullptr; + if (_00 != _00->mNext) { + out = _00->mNext; + out->remove(); + } + return out; + } // unused/inlined: ~zenListManager(); - // TODO: members + zenList* _00; // _00 + zenList _04; // _04 }; } // namespace zen diff --git a/src/plugPikiKando/aiActions.cpp b/src/plugPikiKando/aiActions.cpp index 61e49d89..90f45693 100644 --- a/src/plugPikiKando/aiActions.cpp +++ b/src/plugPikiKando/aiActions.cpp @@ -485,7 +485,7 @@ int ActAdjust::exec() mActor->_A4 = _30; mActor->mDirection += _2C * gsys->getFrameTime(); mActor->mDirection = roundAng(mActor->mDirection); - mActor->_88.set(0.0f, mActor->mDirection, 0.0f); + mActor->mRotation.set(0.0f, mActor->mDirection, 0.0f); _28 += gsys->getFrameTime(); if (_28 > f32(_18) * (1 / 30.0f)) { diff --git a/src/plugPikiKando/creature.cpp b/src/plugPikiKando/creature.cpp index b6c02412..bc17a8a6 100644 --- a/src/plugPikiKando/creature.cpp +++ b/src/plugPikiKando/creature.cpp @@ -577,7 +577,7 @@ void Creature::init() resetCreatureFlag(CF_Unk19); _21C = 0; setCreatureFlag(CF_Free); - resetCreatureFlag(CF_Unk9 | CF_Unk12 | CF_Unk14 | CF_Unk20); + resetCreatureFlag(CF_Unk9 | CF_Unk12 | CF_Unk14 | CF_AIAlwaysActive); _D0 = 0.0f; _2A8 = nullptr; _2AC = nullptr; @@ -916,14 +916,14 @@ Creature::Creature(CreatureProp* props) _A4.set(0.0f, 0.0f, 0.0f); _B0.set(0.0f, 0.0f, 0.0f); _70.set(0.0f, 0.0f, 0.0f); - _88.set(0.0f, 0.0f, 0.0f); + mRotation.set(0.0f, 0.0f, 0.0f); mPosition.set(0.0f, 0.0f, 0.0f); - _7C.set(1.0f, 1.0f, 1.0f); - mDirection = 0.0f; - _26C = 10.0f; - _270 = 16.0f; - mProps = props; - _28 = 0; + mScale.set(1.0f, 1.0f, 1.0f); + mDirection = 0.0f; + _26C = 10.0f; + mCollisionRadius = 16.0f; + mProps = props; + _28 = 0; resetCreatureFlag(CF_Unk10); _E0.fromEuler(Vector3f(0.0f, 0.0f, 0.0f)); _D4.set(0.0f, 0.0f, 0.0f); @@ -2326,7 +2326,7 @@ bool Creature::needShadow() { return true; } * Address: 8008C3CC * Size: 000040 */ -f32 Creature::getShadowSize() { return _7C.x * getSize(); } +f32 Creature::getShadowSize() { return mScale.x * getSize(); } /* * --INFO-- diff --git a/src/plugPikiKando/interactPullout.cpp b/src/plugPikiKando/interactPullout.cpp index eddb8a8e..9725e1ea 100644 --- a/src/plugPikiKando/interactPullout.cpp +++ b/src/plugPikiKando/interactPullout.cpp @@ -42,7 +42,7 @@ bool InteractPullout::actPiki(Piki* piki) } piki->mDirection = roundAng(mOwner->mDirection); - piki->_88.set(0.0f, piki->mDirection, 0.0f); + piki->mRotation.set(0.0f, piki->mDirection, 0.0f); piki->mFSM->transit(piki, PIKISTATE_Nukare); if (piki->mNavi->_7E5) { diff --git a/src/plugPikiKando/itemMgr.cpp b/src/plugPikiKando/itemMgr.cpp index a21cd170..eeba70c6 100644 --- a/src/plugPikiKando/itemMgr.cpp +++ b/src/plugPikiKando/itemMgr.cpp @@ -432,8 +432,8 @@ UfoItem* ItemMgr::getUfo() */ ItemShapeObject::ItemShapeObject(Shape* shape, char* objName, char* file) { - mShape = shape; - mShape->_24 = 0; + mShape = shape; + mShape->mFrameCacher = nullptr; char buf[128]; sprintf(buf, "objects/%s/%s", objName, file); mAnimMgr = new AnimMgr(shape, buf, 0x8000, nullptr); @@ -3827,10 +3827,10 @@ void BuildingItem::doLoad(RandomAccessStream& input) */ void BuildingItem::doStore(CreatureInf* info) { - info->_44 = mHealth; - info->_48 = _5C; - info->_3C = _444; - info->_40 = _440; + info->_44 = mHealth; + info->_48 = _5C; + info->mTekiType = _444; + info->_40 = _440; } /* @@ -3843,7 +3843,7 @@ void BuildingItem::doRestore(CreatureInf* info) startAI(0); mHealth = info->_44; _5C = info->_48; - _444 = info->_3C; + _444 = info->mTekiType; _440 = info->_40; if (_444 < _440) { startMotion(_444); diff --git a/src/plugPikiKando/kusaItem.cpp b/src/plugPikiKando/kusaItem.cpp index 62c888f7..6446d21c 100644 --- a/src/plugPikiKando/kusaItem.cpp +++ b/src/plugPikiKando/kusaItem.cpp @@ -51,7 +51,7 @@ void KusaItem::startAI(int) mCollInfo = &mKusaCollision; mCollInfo->initInfo(mItemShape, mKusaParts, mPartIDs); mCollInfo->makeTubesChild('rope', 1); - _7C.set(0.0f, 0.0f, 0.0f); + mScale.set(0.0f, 0.0f, 0.0f); _814 = mPosition; _814.y = mapMgr->getMinY(mPosition.x, mPosition.z, true); mHealth = 50.0f; @@ -134,7 +134,7 @@ void KusaItem::refresh(Graphics& gfx) Matrix4f camMat; Matrix4f mat; mat.makeSRT(Vector3f(1.0f, 1.0f, 1.0f), Vector3f(0.0f, 0.0f, 0.0f), Vector3f(0.0f, mHealth - _5C, 0.0f)); - _228.makeSRT(_7C, _88, mPosition); + _228.makeSRT(mScale, mRotation, mPosition); _228.multiply(mat); gfx._2E4->_1E0.multiplyTo(_228, camMat); @@ -172,7 +172,7 @@ void BoBaseItem::startAI(int) setCreatureFlag(CF_Unk10); mCollInfo = &mBaseCollision; mCollInfo->initInfo(mItemShape, mBaseParts, mPartIDs); - _7C.set(1.0f, 1.0f, 1.0f); + mScale.set(1.0f, 1.0f, 1.0f); _814 = mPosition; _814.y = mapMgr->getMinY(mPosition.x, mPosition.z, true); _824 = true; @@ -247,7 +247,7 @@ void BoBaseItem::refresh(Graphics& gfx) { if (_824 || (!_824 && _825 > 0)) { Matrix4f camMat; - _228.makeSRT(_7C, _88, mPosition); + _228.makeSRT(mScale, mRotation, mPosition); gfx._2E4->_1E0.multiplyTo(_228, camMat); gfx.setLighting(true, nullptr); diff --git a/src/plugPikiKando/mapParts.cpp b/src/plugPikiKando/mapParts.cpp index f9a3d68c..89bc8fd1 100644 --- a/src/plugPikiKando/mapParts.cpp +++ b/src/plugPikiKando/mapParts.cpp @@ -1,14 +1,12 @@ #include "MapMgr.h" +#include "Dolphin/os.h" /* * --INFO-- * Address: ........ * Size: 00009C */ -static void _Error(char*, ...) -{ - // UNUSED FUNCTION -} +static void _Error(char* fmt, ...) { OSPanic(__FILE__, __LINE__, fmt, "mapParts"); } /* * --INFO-- @@ -20,58 +18,26 @@ static void _Print(char*, ...) // UNUSED FUNCTION } +char* MapParts::shapeFiles[4] = { + "mapparts/cone.mod", + "mapparts/cylinder.mod", + "mapparts/cube.mod", + "mapparts/board.mod", +}; + /* * --INFO-- * Address: 801184A8 * Size: 000018 */ -void MapParts::getShapeFile(int) -{ - /* - .loc_0x0: - lis r4, 0x802C - rlwinm r3,r3,2,0,29 - addi r0, r4, 0x3248 - add r3, r0, r3 - lwz r3, 0x0(r3) - blr - */ -} +char* MapParts::getShapeFile(int idx) { return shapeFiles[idx]; } /* * --INFO-- * Address: 801184C0 * Size: 00005C */ -void MapParts::applyVelocity(Plane&, Vector3f&, Vector3f&) -{ - /* - .loc_0x0: - stwu r1, -0x40(r1) - lfs f1, 0x144(r3) - lfs f0, 0x0(r6) - fadds f0, f1, f0 - stfs f0, 0x24(r1) - lfs f0, 0x24(r1) - stfs f0, 0x30(r1) - lfs f1, 0x148(r3) - lfs f0, 0x4(r6) - fadds f0, f1, f0 - stfs f0, 0x34(r1) - lfs f1, 0x14C(r3) - lfs f0, 0x8(r6) - fadds f0, f1, f0 - stfs f0, 0x38(r1) - lwz r4, 0x30(r1) - lwz r0, 0x34(r1) - stw r4, 0x144(r3) - stw r0, 0x148(r3) - lwz r0, 0x38(r1) - stw r0, 0x14C(r3) - addi r1, r1, 0x40 - blr - */ -} +void MapParts::applyVelocity(Plane&, Vector3f&, Vector3f& p3) { _144 = _144 + p3; } /* * --INFO-- @@ -81,39 +47,7 @@ void MapParts::applyVelocity(Plane&, Vector3f&, Vector3f&) MapEntity::MapEntity(Shape* shape) : MapParts(shape) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - mr r31, r3 - bl -0xB6548 - lis r3, 0x802C - addi r0, r3, 0x349C - stw r0, 0x0(r31) - lis r3, 0x802C - li r4, 0 - lfs f0, -0x6048(r2) - addi r0, r3, 0x33F4 - addi r3, r31, 0 - stfs f0, 0x14C(r31) - stfs f0, 0x148(r31) - stfs f0, 0x144(r31) - stw r4, 0x140(r31) - stw r0, 0x0(r31) - lfs f0, -0x2220(r13) - stfs f0, 0x144(r31) - lfs f0, -0x221C(r13) - stfs f0, 0x148(r31) - lfs f0, -0x2218(r13) - stfs f0, 0x14C(r31) - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + _144.set(0.0f, 0.0f, 0.0f); } /* @@ -197,64 +131,16 @@ void MapEntity::update() * Address: 80118694 * Size: 0000D0 */ -MapSlider::MapSlider(Shape* shape, int, int, f32, f32, f32, int) +MapSlider::MapSlider(Shape* shape, int p2, int p3, f32 p4, f32 p5, f32 p6, int p7) : MapParts(shape) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x50(r1) - stfd f31, 0x48(r1) - fmr f31, f3 - stfd f30, 0x40(r1) - fmr f30, f2 - stfd f29, 0x38(r1) - fmr f29, f1 - stw r31, 0x34(r1) - addi r31, r7, 0 - stw r30, 0x30(r1) - addi r30, r6, 0 - stw r29, 0x2C(r1) - addi r29, r5, 0 - stw r28, 0x28(r1) - mr r28, r3 - bl -0xB66F0 - lis r3, 0x802C - addi r0, r3, 0x349C - stw r0, 0x0(r28) - lis r3, 0x802C - li r4, 0 - lfs f0, -0x6048(r2) - addi r0, r3, 0x3368 - addi r3, r28, 0 - stfs f0, 0x14C(r28) - stfs f0, 0x148(r28) - stfs f0, 0x144(r28) - stw r4, 0x140(r28) - stw r0, 0x0(r28) - stfs f0, 0x158(r28) - stfs f0, 0x154(r28) - stfs f0, 0x150(r28) - stw r29, 0x160(r28) - stw r30, 0x164(r28) - stfs f29, 0x168(r28) - stfs f30, 0x16C(r28) - stfs f31, 0x170(r28) - stw r31, 0x174(r28) - stfs f0, 0x15C(r28) - lwz r0, 0x54(r1) - lfd f31, 0x48(r1) - lfd f30, 0x40(r1) - lfd f29, 0x38(r1) - lwz r31, 0x34(r1) - lwz r30, 0x30(r1) - lwz r29, 0x2C(r1) - lwz r28, 0x28(r1) - addi r1, r1, 0x50 - mtlr r0 - blr - */ + _160 = p2; + _164 = p3; + _168 = p4; + _16C = p5; + _170 = p6; + _174 = p7; + _15C = 0.0f; } /* @@ -264,25 +150,12 @@ MapSlider::MapSlider(Shape* shape, int, int, f32, f32, f32, int) */ void MapSlider::init() { - /* - .loc_0x0: - lwz r7, 0x140(r3) - cmplwi r7, 0 - beqlr- - lwz r6, 0x0(r7) - li r4, 0x2 - lwz r5, 0x4(r7) - li r0, 0x1 - stw r6, 0x134(r3) - stw r5, 0x138(r3) - lwz r5, 0x8(r7) - stw r5, 0x13C(r3) - lfs f0, 0x168(r3) - stfs f0, 0x180(r3) - stw r4, 0x178(r3) - stw r0, 0x17C(r3) - blr - */ + if (_140) { + _134 = *_140; + _180 = _168; + _178 = 2; + _17C = 1; + } } /* diff --git a/src/plugPikiKando/mizuItem.cpp b/src/plugPikiKando/mizuItem.cpp index 7e3620eb..22c52c61 100644 --- a/src/plugPikiKando/mizuItem.cpp +++ b/src/plugPikiKando/mizuItem.cpp @@ -62,7 +62,7 @@ bool MizuItem::needFlick(Creature*) { return false; } void MizuItem::startAI(int) { u32 badCompiler; - _7C.makeIdentity(); + mScale.makeIdentity(); mItemAnimator.startMotion(PaniMotionInfo(0)); switch (mObjType) { diff --git a/src/plugPikiKando/navi.cpp b/src/plugPikiKando/navi.cpp index cdc9a71d..a6858193 100644 --- a/src/plugPikiKando/navi.cpp +++ b/src/plugPikiKando/navi.cpp @@ -136,7 +136,7 @@ void Navi::viewKill() * Address: 800F8408 * Size: 000008 */ -void Navi::viewGetBottomRadius() +f32 Navi::viewGetBottomRadius() { /* .loc_0x0: @@ -150,7 +150,7 @@ void Navi::viewGetBottomRadius() * Address: 800F8410 * Size: 000008 */ -void Navi::viewGetHeight() +f32 Navi::viewGetHeight() { /* .loc_0x0: diff --git a/src/plugPikiKando/naviMgr.cpp b/src/plugPikiKando/naviMgr.cpp index c111d8ef..bbba56d5 100644 --- a/src/plugPikiKando/naviMgr.cpp +++ b/src/plugPikiKando/naviMgr.cpp @@ -1,12 +1,18 @@ #include "NaviMgr.h" +#include "MemStat.h" +#include "gameflow.h" +#include "Dolphin/os.h" +#include "PikiMacros.h" +#include "sysNew.h" /* * --INFO-- * Address: ........ * Size: 00009C */ -static void _Error(char*, ...) +static void _Error(char* fmt, ...) { + OSPanic(__FILE__, __LINE__, fmt, "naviiMgr"); // UNUSED FUNCTION } @@ -20,6 +26,8 @@ static void _Print(char*, ...) // UNUSED FUNCTION } +NaviMgr* naviMgr; + /* * --INFO-- * Address: 801171C4 @@ -27,109 +35,31 @@ static void _Print(char*, ...) */ NaviMgr::NaviMgr() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x20(r1) - stw r31, 0x1C(r1) - stw r30, 0x18(r1) - stw r29, 0x14(r1) - stw r3, 0x8(r1) - lis r3, 0x802C - addi r30, r3, 0x2E70 - lwz r3, 0x8(r1) - bl -0x361A0 - lis r4, 0x802C - lwz r3, 0x8(r1) - addi r4, r4, 0x2FD8 - stw r4, 0x0(r3) - addi r0, r4, 0x18 - addi r4, r30, 0x18 - stw r0, 0x8(r3) - lwz r3, 0x2FE8(r13) - bl -0x90AD8 - li r3, 0x43C - bl -0xD0214 - addi r29, r3, 0 - mr. r3, r29 - beq- .loc_0x68 - bl -0x1E680 - - .loc_0x68: - lwz r31, 0x8(r1) - addi r5, r30, 0x24 - subi r4, r13, 0x2350 - stw r29, 0x58(r31) - addi r3, r31, 0x8 - li r6, 0x1 - bl -0xD6BA4 - lwz r3, 0x2FE8(r13) - addi r4, r30, 0x18 - bl -0x90A08 - lwz r3, 0x2FE8(r13) - addi r4, r30, 0x30 - bl -0x90B24 - lwz r3, 0x2FE8(r13) - addi r4, r30, 0x40 - bl -0x90B30 - bl 0x1A98 - stw r3, 0x50(r31) - addi r4, r30, 0x40 - lwz r3, 0x2FE8(r13) - bl -0x90A34 - lwz r3, 0x2FE8(r13) - addi r4, r30, 0x4C - bl -0x90B50 - lis r3, 0x803A - subi r3, r3, 0x2848 - addi r4, r30, 0x58 - li r5, 0x1 - bl -0xC458C - stw r3, 0x40(r31) - addi r4, r30, 0x4C - lwz r3, 0x2FE8(r13) - bl -0x90A64 - lwz r3, 0x2FE8(r13) - addi r4, r30, 0x6C - bl -0x90B80 - li r3, 0x28 - bl -0xD02BC - addi r29, r3, 0 - mr. r3, r29 - beq- .loc_0x114 - lwz r4, 0x40(r31) - bl -0x3E800 - - .loc_0x114: - lwz r31, 0x8(r1) - addi r4, r30, 0x6C - stw r29, 0x48(r31) - lwz r3, 0x2FE8(r13) - bl -0x90AA0 - lwz r3, 0x2FE8(r13) - addi r4, r30, 0x80 - bl -0x90BBC - bl -0x3EA14 - lwz r5, 0x48(r31) - addi r4, r30, 0x80 - stw r3, 0x24(r5) - lwz r3, 0x2FE8(r13) - bl -0x90AC4 - li r0, 0 - stw r0, 0x54(r31) - addi r4, r30, 0x30 - lwz r3, 0x2FE8(r13) - bl -0x90AD8 - mr r3, r31 - lwz r0, 0x24(r1) - lwz r31, 0x1C(r1) - lwz r30, 0x18(r1) - lwz r29, 0x14(r1) - addi r1, r1, 0x20 - mtlr r0 - blr - */ + memStat->start("naviparms"); + mNaviParms = new NaviProp(); + load("parms/", "naviMgr.bin", 1); + memStat->end("naviparms"); + + memStat->start("navi shape anim"); + + memStat->start("navi mtable"); + mMotionTable = PaniPikiAnimator::createMotionTable(); + memStat->end("navi mtable"); + + memStat->start("navi shape"); + mNaviShape = gameflow.loadShape("pikis/nv3Model.mod", true); + memStat->end("navi shape"); + + memStat->start("navi shapeobject"); + mNaviShapeObject = new PikiShapeObject(mNaviShape); + memStat->end("navi shapeobject"); + + memStat->start("navi animmgr"); + mNaviShapeObject->mAnimMgr = PikiShapeObject::getAnimMgr(); + memStat->end("navi animmgr"); + + mNaviID = 0; + memStat->end("navi shape anim"); } /* @@ -149,35 +79,9 @@ void NaviMgr::init() */ Navi* NaviMgr::createObject() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - addi r30, r3, 0 - li r3, 0xAE0 - bl -0xD035C - addi r31, r3, 0 - mr. r3, r31 - beq- .loc_0x38 - lwz r4, 0x58(r30) - lwz r5, 0x54(r30) - bl -0x1D7EC - - .loc_0x38: - lwz r4, 0x54(r30) - addi r3, r31, 0 - addi r0, r4, 0x1 - stw r0, 0x54(r30) - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + Navi* navi = new Navi(mNaviParms, mNaviID); + mNaviID++; + return navi; } /* @@ -185,20 +89,7 @@ Navi* NaviMgr::createObject() * Address: 801173A4 * Size: 000020 */ -void NaviMgr::update() -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - bl -0x36028 - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} +void NaviMgr::update() { MonoObjectMgr::update(); } /* * --INFO-- @@ -207,42 +98,9 @@ void NaviMgr::update() */ Navi* NaviMgr::getNavi() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x28(r1) - stw r31, 0x24(r1) - mr r31, r3 - lwz r12, 0x0(r31) - lwz r12, 0xC(r12) - mtlr r12 - blrl - addi r4, r3, 0 - cmpwi r4, -0x1 - bne- .loc_0x4C - mr r3, r31 - lwz r12, 0x0(r31) - li r4, 0 - lwz r12, 0x8(r12) - mtlr r12 - blrl - b .loc_0x60 - - .loc_0x4C: - lwz r12, 0x0(r31) - mr r3, r31 - lwz r12, 0x8(r12) - mtlr r12 - blrl + u32 badCompiler[4]; - .loc_0x60: - lwz r0, 0x2C(r1) - lwz r31, 0x24(r1) - addi r1, r1, 0x28 - mtlr r0 - blr - */ + return static_cast(getCreatureCheck(getFirst())); } /* @@ -250,17 +108,12 @@ Navi* NaviMgr::getNavi() * Address: 80117438 * Size: 000018 */ -Navi* NaviMgr::getNavi(int) +Navi* NaviMgr::getNavi(int idx) { - /* - .loc_0x0: - lwz r0, 0x30(r3) - cmpw r4, r0 - lwz r3, 0x28(r3) - rlwinm r0,r4,2,0,29 - lwzx r3, r3, r0 - blr - */ + if (idx >= _30) { + DEBUGPRINT(idx >= 0); + } + return static_cast(_28[idx]); } /* @@ -268,8 +121,9 @@ Navi* NaviMgr::getNavi(int) * Address: 80117450 * Size: 00011C */ -void NaviMgr::refresh2d(Graphics&) +void NaviMgr::refresh2d(Graphics& gfx) { + TRAVERSELOOP(this, idx) { getCreatureCheck(idx)->refresh2d(gfx); } /* .loc_0x0: mflr r0 @@ -365,8 +219,9 @@ void NaviMgr::refresh2d(Graphics&) * Address: 8011756C * Size: 000110 */ -void NaviMgr::renderCircle(Graphics&) +void NaviMgr::renderCircle(Graphics& gfx) { + TRAVERSELOOP(this, idx) { static_cast(getCreatureCheck(idx))->renderCircle(gfx); } /* .loc_0x0: mflr r0 @@ -459,8 +314,9 @@ void NaviMgr::renderCircle(Graphics&) * Address: 8011767C * Size: 00011C */ -void NaviMgr::drawShadow(Graphics&) +void NaviMgr::drawShadow(Graphics& gfx) { + TRAVERSELOOP(this, idx) { getCreatureCheck(idx)->drawShadow(gfx); } /* .loc_0x0: mflr r0 @@ -556,70 +412,4 @@ void NaviMgr::drawShadow(Graphics&) * Address: 80117798 * Size: 000030 */ -void NaviMgr::read(RandomAccessStream&) -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - lwz r3, 0x58(r3) - lwz r12, 0x54(r3) - lwz r12, 0x8(r12) - mtlr r12 - blrl - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} - -/* - * --INFO-- - * Address: 801177C8 - * Size: 000084 - */ -NaviMgr::~NaviMgr() -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - mr. r31, r3 - beq- .loc_0x6C - lis r3, 0x802C - addi r3, r3, 0x2FD8 - stw r3, 0x0(r31) - addi r0, r3, 0x18 - stw r0, 0x8(r31) - beq- .loc_0x5C - lis r3, 0x802C - subi r3, r3, 0x5038 - stw r3, 0x0(r31) - addi r0, r3, 0x18 - stw r0, 0x8(r31) - beq- .loc_0x5C - lis r3, 0x802C - subi r3, r3, 0x4F80 - stw r3, 0x0(r31) - addi r0, r3, 0x18 - stw r0, 0x8(r31) - - .loc_0x5C: - extsh. r0, r4 - ble- .loc_0x6C - mr r3, r31 - bl -0xD0684 - - .loc_0x6C: - mr r3, r31 - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ -} +void NaviMgr::read(RandomAccessStream& input) { mNaviParms->read(input); } diff --git a/src/plugPikiKando/objectMgr.cpp b/src/plugPikiKando/objectMgr.cpp index 118d6903..617fd976 100644 --- a/src/plugPikiKando/objectMgr.cpp +++ b/src/plugPikiKando/objectMgr.cpp @@ -3937,13 +3937,6 @@ bool CreatureNodeMgr::isDone(int idx) */ int CreatureNodeMgr::getSize() { return mRootNode.getChildCount(); } -/* - * --INFO-- - * Address: 800E2EBC - * Size: 00006C - */ -CreatureNodeMgr::~CreatureNodeMgr() { } - /* * --INFO-- * Address: 800E2F28 diff --git a/src/plugPikiKando/pelletMgr.cpp b/src/plugPikiKando/pelletMgr.cpp index 06593d0f..d7afdfe6 100644 --- a/src/plugPikiKando/pelletMgr.cpp +++ b/src/plugPikiKando/pelletMgr.cpp @@ -671,7 +671,7 @@ Pellet::Pellet() * Address: 800953AC * Size: 00003C */ -void Pellet::isUfoPartsID(u32) +bool Pellet::isUfoPartsID(u32) { /* .loc_0x0: @@ -1797,7 +1797,7 @@ f32 Pellet::getSize() * Address: 80095F8C * Size: 00001C */ -void PelletView::viewGetScale() +Vector3f PelletView::viewGetScale() { /* .loc_0x0: diff --git a/src/plugPikiKando/pikiInf.cpp b/src/plugPikiKando/pikiInf.cpp index 3ca46503..c0495d5d 100644 --- a/src/plugPikiKando/pikiInf.cpp +++ b/src/plugPikiKando/pikiInf.cpp @@ -161,7 +161,7 @@ BaseInf::BaseInf() { initCore("baseInf"); mPosition.set(0.0f, 0.0f, 0.0f); - _20.set(0.0f, 0.0f, 0.0f); + mRotation.set(0.0f, 0.0f, 0.0f); // UNUSED FUNCTION } @@ -173,7 +173,7 @@ BaseInf::BaseInf() void BaseInf::store(Creature* owner) { mPosition = owner->mPosition; - _20 = owner->_88; + mRotation = owner->mRotation; doStore(owner); } @@ -185,7 +185,7 @@ void BaseInf::store(Creature* owner) void BaseInf::restore(Creature* owner) { owner->mPosition = mPosition; - owner->_88 = _20; + owner->mRotation = mRotation; doRestore(owner); } @@ -211,7 +211,7 @@ void BaseInf::loadCard(RandomAccessStream& card) mPosition.x = card.readShort(); mPosition.y = card.readShort(); mPosition.z = card.readShort(); - _20.set(0.0f, 0.0f, 0.0f); + mRotation.set(0.0f, 0.0f, 0.0f); } /* diff --git a/src/plugPikiKando/plantMgr.cpp b/src/plugPikiKando/plantMgr.cpp index a96f4e4e..1c642bc6 100644 --- a/src/plugPikiKando/plantMgr.cpp +++ b/src/plugPikiKando/plantMgr.cpp @@ -1,6 +1,11 @@ #include "PlantMgr.h" #include "Generator.h" +#include "Graphics.h" +#include "gameflow.h" +#include "CreatureProp.h" #include "Dolphin/os.h" +#include "SoundMgr.h" +#include "MapMgr.h" #include "sysNew.h" /* @@ -34,9 +39,9 @@ PlantMgr* plantMgr; Plant::Plant() : AICreature(nullptr) { - mObjType = OBJTYPE_Plant; - _304 = 0xFFFF; - mCollInfo = new CollInfo(8); + mObjType = OBJTYPE_Plant; + mPlantType = PLANT_NULL; + mCollInfo = new CollInfo(8); mSearchBuffer.init(mPlantSearchData, 3); } @@ -52,9 +57,16 @@ void Plant::startMotion(int motionID) { mPlantAnimator.startMotion(PaniMotionInf * Address: ........ * Size: 000090 */ -void Plant::reset(int) +void Plant::reset(int plantType) { - // UNUSED FUNCTION + _394 = 1; + mObjType = OBJTYPE_Plant; + mPlantType = plantType; + PlantShapeObject* shape = plantMgr->mPlantShapes[plantType]; + mPlantAnimator.init(&shape->mAnimContext, shape->mAnimMgr, plantMgr->mMotionTable); + mMotionSpeed = 0.0f; + mCollInfo->initInfo(shape->mShape, nullptr, nullptr); + mStateMachine = plantMgr->mAI; } /* @@ -64,59 +76,17 @@ void Plant::reset(int) */ void Plant::startAI(int) { - _30C = 0; - // plantMgr-> - /* - .loc_0x0: - mflr r0 - li r4, 0 - stw r0, 0x4(r1) - li r0, 0 - stwu r1, -0x20(r1) - stw r31, 0x1C(r1) - addi r31, r3, 0 - stb r0, 0x30C(r3) - lwz r5, 0x3140(r13) - lwz r0, 0x48(r5) - stw r0, 0x2F00(r13) - lwz r0, 0x68(r5) - stw r0, 0x224(r31) - lwz r12, 0x0(r31) - lwz r12, 0x130(r12) - mtlr r12 - blrl - lfs f0, -0x6038(r2) - addi r3, r1, 0x10 - li r4, 0 - stfs f0, 0x308(r31) - bl 0x50B8 - addi r4, r3, 0 - addi r3, r31, 0x310 - bl 0x5314 - lwz r3, 0x2F00(r13) - li r4, 0x1 - lfs f1, 0x94(r31) - lfs f2, 0x9C(r31) - bl -0xB1FBC - stfs f1, 0x98(r31) - addi r4, r31, 0 - li r5, 0 - lwz r3, 0x3140(r13) - lwz r3, 0x64(r3) - bl -0x9C780 - lhz r0, 0x304(r31) - cmplwi r0, 0x7 - bne- .loc_0xA4 - lfs f0, -0x6034(r2) - stfs f0, 0x308(r31) - - .loc_0xA4: - lwz r0, 0x24(r1) - lwz r31, 0x1C(r1) - addi r1, r1, 0x20 - mtlr r0 - blr - */ + _30C = 0; + mapMgr = plantMgr->mMapMgr; + mProps = plantMgr->mPlantProps; + startMotion(0); + mMotionSpeed = 0.0f; + mPlantAnimator.startMotion(PaniMotionInfo(0)); + mPosition.y = mapMgr->getMinY(mPosition.x, mPosition.z, true); + plantMgr->mAI->start(this, PlantAI::STATE_Wait); + if (mPlantType == PLANT_Mizukusa) { + mMotionSpeed = 30.0f; + } } /* @@ -124,26 +94,7 @@ void Plant::startAI(int) * Address: 80119F04 * Size: 000038 */ -void Plant::doAnimation() -{ - /* - .loc_0x0: - mflr r0 - addi r4, r3, 0 - stw r0, 0x4(r1) - addi r3, r4, 0x310 - stwu r1, -0x8(r1) - lwz r12, 0x340(r4) - lfs f1, 0x308(r4) - lwz r12, 0xC(r12) - mtlr r12 - blrl - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} +void Plant::doAnimation() { mPlantAnimator.animate(mMotionSpeed); } /* * --INFO-- @@ -152,54 +103,16 @@ void Plant::doAnimation() */ void Plant::update() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - mr r31, r3 - lbz r0, 0x30C(r3) - cmplwi r0, 0 - bne- .loc_0x90 - addi r3, r31, 0x40 - addi r4, r31, 0x94 - bl -0x85A44 - addi r3, r31, 0x40 - addi r4, r31, 0x94 - li r5, 0 - bl -0x859B8 - lhz r0, 0x304(r31) - cmplwi r0, 0xB - beq- .loc_0x60 - cmplwi r0, 0x7 - beq- .loc_0x60 - addi r3, r31, 0x40 - bl -0x85E00 - rlwinm. r0,r3,0,24,31 - bne- .loc_0x90 - - .loc_0x60: - mr r3, r31 - lwz r12, 0x0(r31) - lwz r12, 0x108(r12) - mtlr r12 - blrl - lwz r3, 0x3140(r13) - mr r4, r31 - lwz r3, 0x64(r3) - lwz r12, 0x0(r3) - lwz r12, 0xC(r12) - mtlr r12 - blrl - - .loc_0x90: - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + if (_30C) { + return; + } + + mGrid.updateGrid(mPosition); + mGrid.updateAIGrid(mPosition, false); + if (mPlantType == PLANT_Hae || mPlantType == PLANT_Mizukusa || !mGrid.aiCulling()) { + doAnimation(); + plantMgr->mAI->exec(this); + } } /* @@ -207,8 +120,34 @@ void Plant::update() * Address: 80119FE0 * Size: 0003C0 */ -void Plant::refresh(Graphics&) +void Plant::refresh(Graphics& gfx) { + PlantShapeObject* shape = plantMgr->mPlantShapes[mPlantType]; + if (!mPlantAnimator.mAnimInfo) { + return; + } + + if (mCollInfo->hasInfo() && 2.0f * getBoundingSphereRadius() > 0.0f) { + // what the hell is going on in here + + if (!_394) { + static_cast(mStateMachine)->start(this, PlantAI::STATE_Wait); + _30C = 1; + } + } else { + _30C = 0; + _394 = 0; + _228.makeSRT(mScale, mRotation, mPosition); + Matrix4f mtx; + gfx._2E4->_1E0.multiplyTo(_228, mtx); + + mPlantAnimator.updateContext(); + shape->mShape->updateAnim(gfx, mtx, nullptr); + + gfx.useMatrix(Matrix4f::ident, 0); + shape->mShape->drawshape(gfx, *gfx._2E4, nullptr); + mCollInfo->updateInfo(gfx, false); + } /* .loc_0x0: mflr r0 @@ -484,7 +423,12 @@ void Plant::doKill() { } */ PlantAI::PlantAI() { - // UNUSED FUNCTION + OpponentMove* oppMove = new OpponentMove(); + setup(STATE_COUNT); + addState(STATE_Wait, -1, new WaitInit(), nullptr, nullptr); + addState(STATE_Touch, -1, new TouchInit(), nullptr, nullptr); + addArrow(STATE_Wait, saiCollideEvent, STATE_Touch)->mCondition.add(oppMove); + addArrow(STATE_Touch, saiMotionDoneEvent, STATE_Wait); } /* @@ -492,8 +436,16 @@ PlantAI::PlantAI() * Address: 8011A3A4 * Size: 0000AC */ -bool PlantAI::OpponentMove::satisfy(AICreature*) +bool PlantAI::OpponentMove::satisfy(AICreature* plant) { + // this stops inlining if you do it directly for some reason, but goes weird otherwise. + Vector3f* vec = &plant->_2BC->_70; + f32 dist = vec->length(); + if (dist > 40.0f) { + return true; + } + + return false; /* .loc_0x0: stwu r1, -0x20(r1) @@ -553,52 +505,17 @@ bool PlantAI::OpponentMove::satisfy(AICreature*) * Address: 8011A450 * Size: 000094 */ -void PlantAI::WaitInit::act(AICreature*) +void PlantAI::WaitInit::act(AICreature* plant) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x20(r1) - stw r31, 0x1C(r1) - mr r31, r4 - lhz r0, 0x304(r4) - cmplwi r0, 0x7 - bne- .loc_0x54 - mr r3, r31 - lwz r12, 0x0(r31) - li r4, 0 - lwz r12, 0x130(r12) - mtlr r12 - blrl - mr r3, r31 - lfs f1, -0x6034(r2) - lwz r12, 0x0(r31) - lwz r12, 0x14C(r12) - mtlr r12 - blrl - b .loc_0x80 - - .loc_0x54: - mr r3, r31 - lwz r12, 0x0(r31) - li r4, 0 - lwz r12, 0x130(r12) - mtlr r12 - blrl - mr r3, r31 - lwz r12, 0x0(r31) - lwz r12, 0x150(r12) - mtlr r12 - blrl - - .loc_0x80: - lwz r0, 0x24(r1) - lwz r31, 0x1C(r1) - addi r1, r1, 0x20 - mtlr r0 - blr - */ + u32 badCompiler; + + if (static_cast(plant)->mPlantType == PLANT_Mizukusa) { + plant->startMotion(0); + plant->setMotionSpeed(30.0f); + } else { + plant->startMotion(0); + plant->stopMotion(); + } } /* @@ -606,40 +523,16 @@ void PlantAI::WaitInit::act(AICreature*) * Address: 8011A4E4 * Size: 000064 */ -void PlantAI::TouchInit::act(AICreature*) +void PlantAI::TouchInit::act(AICreature* plant) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x20(r1) - stw r31, 0x1C(r1) - mr r31, r4 - lhz r0, 0x304(r4) - cmplwi r0, 0x7 - beq- .loc_0x50 - lwz r3, 0x2BC(r31) - lwz r0, 0x6C(r3) - cmpwi r0, 0x36 - bne- .loc_0x38 - li r3, 0x135 - bl -0x7513C - - .loc_0x38: - mr r3, r31 - lfs f1, -0x6034(r2) - lwz r12, 0x0(r31) - lwz r12, 0x14C(r12) - mtlr r12 - blrl - - .loc_0x50: - lwz r0, 0x24(r1) - lwz r31, 0x1C(r1) - addi r1, r1, 0x20 - mtlr r0 - blr - */ + u32 badCompiler; + if (static_cast(plant)->mPlantType != PLANT_Mizukusa) { + if (plant->_2BC->mObjType == OBJTYPE_Navi) { + SeSystem::playPlayerSe(0x135); + } + + plant->setMotionSpeed(30.0f); + } } /* @@ -647,8 +540,20 @@ void PlantAI::TouchInit::act(AICreature*) * Address: 8011A548 * Size: 000478 */ -PlantMgr::PlantMgr(MapMgr*) +PlantMgr::PlantMgr(MapMgr* mgr) { + mMapMgr = mgr; + gameflow.addGenNode("plantMgr", this); + mMotionTable = PaniPlantAnimator::createMotionTable(); + mPlantShapes = new PlantShapeObject*[PLANT_COUNT]; + for (int i = PLANT_START; i < PLANT_COUNT; i++) { + mPlantShapes[i] = nullptr; + } + + mAI = new PlantAI(); + mPlantProps = new CreatureProp(); + + mAnimFrameCacher = new AnimFrameCacher(1000); /* .loc_0x0: mflr r0 @@ -964,15 +869,28 @@ PlantMgr::PlantMgr(MapMgr*) */ } +// see PlantTypes enum for more info on what these are +static char* plantNames[PLANT_COUNT] = { + "clover", // 0 + "chidome", // 1 + "hutaba", // 2 + "ine", // 3 + "tanpopo", // 4 + "ooinu_l", // 5 + "ooinu_s", // 6 + "mizukusa", // 7 + "wakame_l", // 8 + "wakame_s", // 9 + "kinokolt", // 10 + "hae", // 11 +}; + /* * --INFO-- * Address: ........ * Size: 000018 */ -void PlantMgr::getPlantName(int) -{ - // UNUSED FUNCTION -} +char* PlantMgr::getPlantName(int plantType) { return plantNames[plantType]; } /* * --INFO-- @@ -981,74 +899,23 @@ void PlantMgr::getPlantName(int) */ void PlantMgr::initialise() { - /* - .loc_0x0: - mflr r0 - lis r4, 0x802C - stw r0, 0x4(r1) - lis r5, 0x802C - stwu r1, -0x330(r1) - stmw r25, 0x314(r1) - addi r28, r4, 0x390C - lis r4, 0x803A - addi r25, r3, 0 - subi r31, r4, 0x2848 - addi r30, r5, 0x393C - li r26, 0 - li r27, 0 - - .loc_0x34: - addi r3, r25, 0 - addi r4, r26, 0 - bl 0x188 - rlwinm. r0,r3,0,24,31 - beq- .loc_0xC4 - lwz r29, 0x0(r28) - addi r4, r30, 0 - addi r3, r1, 0x20C - crclr 6, 0x6 - addi r5, r29, 0 - bl 0xFBB7C - addi r5, r29, 0 - crclr 6, 0x6 - addi r3, r1, 0x10C - subi r4, r13, 0x1ECC - bl 0xFBB68 - addi r5, r29, 0 - crclr 6, 0x6 - addi r3, r1, 0xC - subi r4, r13, 0x1EC8 - bl 0xFBB54 - li r3, 0x18 - bl -0xD3A48 - mr. r29, r3 - beq- .loc_0xBC - addi r3, r31, 0 - addi r4, r1, 0x20C - li r5, 0x1 - bl -0xC7D54 - lwz r5, 0x0(r28) - mr r4, r3 - addi r3, r29, 0 - addi r6, r1, 0xC - bl 0x13C - - .loc_0xBC: - lwz r3, 0x40(r25) - stwx r29, r3, r27 - - .loc_0xC4: - addi r26, r26, 0x1 - cmpwi r26, 0xC - addi r28, r28, 0x4 - addi r27, r27, 0x4 - blt+ .loc_0x34 - lmw r25, 0x314(r1) - lwz r0, 0x334(r1) - addi r1, r1, 0x330 - mtlr r0 - blr - */ + for (int i = PLANT_START; i < PLANT_COUNT; i++) { + if (!usePlantType(i)) { + continue; + } + + char* name = plantNames[i]; + char shapeFile[256]; + sprintf(shapeFile, "objects/plants/%s.mod", name); + + char unused[256]; + sprintf(unused, "%s", name); + + char plantFileName[256]; + sprintf(plantFileName, "%s.bin", name); + + mPlantShapes[i] = new PlantShapeObject(gameflow.loadShape(shapeFile, true), plantNames[i], plantFileName); + } } /* @@ -1056,99 +923,23 @@ void PlantMgr::initialise() * Address: 8011AAAC * Size: 0000D8 */ -Plant* PlantMgr::createObject() -{ - /* - .loc_0x0: - mflr r0 - li r3, 0x398 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - bl -0xD3AC0 - mr. r31, r3 - beq- .loc_0xBC - addi r3, r31, 0 - li r4, 0 - bl -0x9D86C - lis r3, 0x802C - addi r3, r3, 0x3E74 - stw r3, 0x0(r31) - addi r0, r3, 0x114 - addi r3, r31, 0x310 - stw r0, 0x2B8(r31) - bl 0x79C - lis r3, 0x8009 - subi r4, r3, 0x5808 - addi r3, r31, 0x364 - li r5, 0 - li r6, 0xC - li r7, 0x3 - bl 0xF9F60 - lfs f0, -0x6038(r2) - lis r3, 0x1 - li r4, 0x33 - stfs f0, 0x390(r31) - subi r0, r3, 0x1 - li r3, 0x14 - stfs f0, 0x38C(r31) - stfs f0, 0x388(r31) - stw r4, 0x6C(r31) - sth r0, 0x304(r31) - bl -0xD3B38 - addi r30, r3, 0 - mr. r3, r30 - beq- .loc_0xA8 - li r4, 0x8 - bl -0x91F20 - - .loc_0xA8: - stw r30, 0x220(r31) - addi r3, r31, 0x1B8 - addi r4, r31, 0x364 - li r5, 0x3 - bl -0x36EE4 - - .loc_0xBC: - mr r3, r31 - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ -} +Plant* PlantMgr::createObject() { return new Plant(); } /* * --INFO-- * Address: 8011AB84 * Size: 000030 */ -void PlantMgr::usePlantType(int) +bool PlantMgr::usePlantType(int type) { - /* - .loc_0x0: - lwz r3, 0x5C(r3) - b .loc_0x20 - - .loc_0x8: - lwz r0, 0x14(r3) - cmpw r0, r4 - bne- .loc_0x1C - li r3, 0x1 - blr - - .loc_0x1C: - lwz r3, 0xC(r3) - - .loc_0x20: - cmplwi r3, 0 - bne+ .loc_0x8 - li r3, 0 - blr - */ + FOREACH_NODE(UseNode, mRootUseNode.mChild, node) + { + if (node->mPlantType == type) { + return true; + } + } + + return false; } /* @@ -1156,8 +947,13 @@ void PlantMgr::usePlantType(int) * Address: ........ * Size: 0000F4 */ -void PlantMgr::addUseList(int) +void PlantMgr::addUseList(int plantType) { + if (!usePlantType(plantType)) { + UseNode* node = new UseNode(); + node->mPlantType = plantType; + mRootUseNode.add(node); + } // UNUSED FUNCTION } @@ -1166,8 +962,12 @@ void PlantMgr::addUseList(int) * Address: ........ * Size: 000150 */ -void PlantMgr::birth() +Plant* PlantMgr::birth() { + CreatureNode* cnode = new CreatureNode(); + cnode->mCreature = new Plant(); + mRootNode.add(cnode); + return static_cast(cnode->mCreature); // UNUSED FUNCTION } @@ -1176,89 +976,20 @@ void PlantMgr::birth() * Address: 8011ABB4 * Size: 000118 */ -PlantShapeObject::PlantShapeObject(Shape*, char*, char*) +PlantShapeObject::PlantShapeObject(Shape* shape, char* plantName, char* fileName) { - /* - .loc_0x0: - mflr r0 - lis r7, 0x8023 - stw r0, 0x4(r1) - subi r0, r7, 0x7730 - stwu r1, -0xA8(r1) - stw r31, 0xA4(r1) - addi r31, r3, 0 - stw r30, 0xA0(r1) - stw r29, 0x9C(r1) - mr. r29, r5 - stw r28, 0x98(r1) - mr r28, r4 - stw r0, 0x14(r3) - li r0, 0 - stw r0, 0x8(r3) - lfs f0, -0x6038(r2) - stfs f0, 0xC(r3) - lfs f0, -0x6034(r2) - stfs f0, 0x10(r3) - stw r28, 0x0(r3) - lwz r4, 0x3140(r13) - lwz r3, 0x0(r3) - lwz r0, 0x6C(r4) - stw r0, 0x24(r3) - beq- .loc_0xB8 - lis r3, 0x802C - crclr 6, 0x6 - addi r4, r3, 0x3954 - addi r5, r6, 0 - addi r3, r1, 0x18 - bl 0xFB96C - li r3, 0xB8 - bl -0xD3C30 - addi r30, r3, 0 - mr. r3, r30 - beq- .loc_0xA8 - lis r6, 0x1 - addi r4, r28, 0 - addi r5, r1, 0x18 - subi r6, r6, 0x8000 - li r7, 0 - bl -0xCA3B4 - - .loc_0xA8: - stw r30, 0x4(r31) - lwz r3, 0x4(r31) - stw r29, 0x4(r3) - b .loc_0xE4 - - .loc_0xB8: - li r3, 0xB8 - bl -0xD3C6C - addi r30, r3, 0 - mr. r3, r30 - beq- .loc_0xE0 - addi r4, r28, 0 - li r5, 0 - li r6, 0 - li r7, 0 - bl -0xCA3EC - - .loc_0xE0: - stw r30, 0x4(r31) - - .loc_0xE4: - lwz r3, 0x0(r31) - addi r5, r31, 0x8 - li r4, 0 - bl -0xE5C40 - mr r3, r31 - lwz r0, 0xAC(r1) - lwz r31, 0xA4(r1) - lwz r30, 0xA0(r1) - lwz r29, 0x9C(r1) - lwz r28, 0x98(r1) - addi r1, r1, 0xA8 - mtlr r0 - blr - */ + mShape = shape; + mShape->mFrameCacher = plantMgr->mAnimFrameCacher; + if (plantName) { + char buf[128]; + sprintf(buf, "objects/plants/%s", fileName); + mAnimMgr = new AnimMgr(shape, buf, 0x8000, nullptr); + mAnimMgr->mName = plantName; + } else { + mAnimMgr = new AnimMgr(shape, nullptr, 0, nullptr); + } + + mShape->overrideAnim(0, &mAnimContext); } /* @@ -1267,9 +998,9 @@ PlantShapeObject::PlantShapeObject(Shape*, char*, char*) * Size: 000068 */ GenObjectPlant::GenObjectPlant() - : GenObject('plnt', "") + : GenObject('plnt', "create Plant") { - // UNUSED FUNCTION + mPlantType = PLANT_Clover; } /* @@ -1277,44 +1008,7 @@ GenObjectPlant::GenObjectPlant() * Address: 8011ACCC * Size: 000078 */ -static GenObjectPlant* makeObjectPlant() -{ - /* - .loc_0x0: - mflr r0 - li r3, 0x1C - stw r0, 0x4(r1) - stwu r1, -0x10(r1) - stw r31, 0xC(r1) - bl -0xD3CDC - addi r31, r3, 0 - mr. r3, r31 - beq- .loc_0x60 - lis r4, 0x802C - lis r5, 0x802C - addi r6, r4, 0x3974 - lis r4, 0x706C - addi r5, r5, 0x3968 - addi r4, r4, 0x6E74 - bl -0x40054 - lis r3, 0x802C - subi r0, r3, 0x5490 - lis r3, 0x802C - stw r0, 0x4(r31) - addi r0, r3, 0x39F8 - stw r0, 0x4(r31) - li r0, 0 - stw r0, 0x18(r31) - - .loc_0x60: - mr r3, r31 - lwz r0, 0x14(r1) - lwz r31, 0xC(r1) - addi r1, r1, 0x10 - mtlr r0 - blr - */ -} +static GenObject* makeObjectPlant() { return new GenObjectPlant(); } /* * --INFO-- @@ -1323,44 +1017,17 @@ static GenObjectPlant* makeObjectPlant() */ void GenObjectPlant::initialise() { - /* - .loc_0x0: - lwz r7, 0x3074(r13) - lwz r5, 0x0(r7) - lwz r0, 0x4(r7) - cmpw r5, r0 - bgelr- - lis r4, 0x706C - lwz r3, 0x8(r7) - addi r4, r4, 0x6E74 - rlwinm r0,r5,4,0,27 - stwx r4, r3, r0 - lis r6, 0x8012 - lis r4, 0x802C - lwz r0, 0x0(r7) - lis r3, 0x7630 - lwz r5, 0x8(r7) - subi r6, r6, 0x5334 - rlwinm r0,r0,4,0,27 - add r5, r5, r0 - stw r6, 0x4(r5) - addi r5, r4, 0x3984 - addi r4, r3, 0x2E30 - lwz r0, 0x0(r7) - lwz r3, 0x8(r7) - rlwinm r0,r0,4,0,27 - add r3, r3, r0 - stw r5, 0x8(r3) - lwz r0, 0x0(r7) - lwz r3, 0x8(r7) - rlwinm r0,r0,4,0,27 - add r3, r3, r0 - stw r4, 0xC(r3) - lwz r3, 0x0(r7) - addi r0, r3, 0x1 - stw r0, 0x0(r7) - blr - */ + GenObjectFactory* fact = GenObjectFactory::factory; + if (fact->mSpawnerCount >= fact->mMaxSpawners) { + return; + } + + fact->mSpawnerInfo[fact->mSpawnerCount].mID = 'plnt'; + fact->mSpawnerInfo[fact->mSpawnerCount].mGenFunction = &makeObjectPlant; + fact->mSpawnerInfo[fact->mSpawnerCount].mName = "Generate PLANT"; + fact->mSpawnerInfo[fact->mSpawnerCount].mVersion = 'v0.0'; + + fact->mSpawnerCount++; } /* @@ -1368,220 +1035,35 @@ void GenObjectPlant::initialise() * Address: 8011ADD0 * Size: 000040 */ -void GenObjectPlant::doRead(RandomAccessStream&) -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - addi r31, r3, 0 - addi r3, r4, 0 - lwz r12, 0x4(r4) - lwz r12, 0x8(r12) - mtlr r12 - blrl - stw r3, 0x18(r31) - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ -} +void GenObjectPlant::doRead(RandomAccessStream& input) { mPlantType = input.readInt(); } /* * --INFO-- * Address: 8011AE10 * Size: 0000CC */ -void GenObjectPlant::updateUseList(Generator*, int) -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x28(r1) - stw r31, 0x24(r1) - stw r30, 0x20(r1) - stw r29, 0x1C(r1) - lwz r29, 0x3140(r13) - lwz r31, 0x18(r3) - lwz r3, 0x5C(r29) - b .loc_0x40 - - .loc_0x28: - lwz r0, 0x14(r3) - cmpw r0, r31 - bne- .loc_0x3C - li r0, 0x1 - b .loc_0x4C - - .loc_0x3C: - lwz r3, 0xC(r3) - - .loc_0x40: - cmplwi r3, 0 - bne+ .loc_0x28 - li r0, 0 - - .loc_0x4C: - rlwinm. r0,r0,0,24,31 - bne- .loc_0xB0 - li r3, 0x18 - bl -0xD3E64 - addi r30, r3, 0 - mr. r0, r30 - beq- .loc_0xA0 - lis r3, 0x802C - addi r4, r3, 0x38C4 - addi r3, r30, 0 - bl -0xE5ECC - lis r3, 0x802C - addi r0, r3, 0x3C00 - stw r0, 0x0(r30) - li r4, 0 - lis r3, 0x802C - stw r4, 0x10(r30) - addi r0, r3, 0x38D0 - stw r4, 0xC(r30) - stw r4, 0x8(r30) - stw r0, 0x4(r30) - - .loc_0xA0: - stw r31, 0x14(r30) - addi r4, r30, 0 - addi r3, r29, 0x4C - bl -0xDA8E4 - - .loc_0xB0: - lwz r0, 0x2C(r1) - lwz r31, 0x24(r1) - lwz r30, 0x20(r1) - lwz r29, 0x1C(r1) - addi r1, r1, 0x28 - mtlr r0 - blr - */ -} +void GenObjectPlant::updateUseList(Generator* gen, int) { plantMgr->addUseList(mPlantType); } /* * --INFO-- * Address: 8011AEDC * Size: 000190 */ -void* GenObjectPlant::birth(BirthInfo&) +void* GenObjectPlant::birth(BirthInfo& info) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x28(r1) - stmw r27, 0x14(r1) - addi r30, r3, 0 - addi r31, r4, 0 - li r3, 0x18 - lwz r28, 0x3140(r13) - bl -0xD3EF8 - addi r27, r3, 0 - mr. r0, r27 - beq- .loc_0x74 - lis r3, 0x8022 - addi r0, r3, 0x738C - lis r3, 0x8022 - stw r0, 0x0(r27) - addi r0, r3, 0x737C - stw r0, 0x0(r27) - li r29, 0 - addi r3, r27, 0 - stw r29, 0x10(r27) - subi r4, r13, 0x1F20 - stw r29, 0xC(r27) - stw r29, 0x8(r27) - bl -0xF6068 - lis r3, 0x802C - subi r0, r3, 0x102C - stw r0, 0x0(r27) - stw r29, 0x14(r27) - - .loc_0x74: - li r3, 0x398 - bl -0xD3F50 - addi r29, r3, 0 - mr. r3, r29 - beq- .loc_0x8C - bl -0x1228 - - .loc_0x8C: - stw r29, 0x14(r27) - addi r4, r27, 0 - addi r3, r28, 0x28 - bl -0xDA99C - lwz r29, 0x14(r27) - cmplwi r29, 0 - addi r27, r29, 0 - beq- .loc_0x178 - mr r3, r27 - lwz r12, 0x0(r27) - mr r4, r31 - lwz r12, 0x28(r12) - mtlr r12 - blrl - lwz r6, 0xC(r31) - li r0, 0x1 - lwz r5, 0x10(r31) - li r4, 0x33 - addi r3, r29, 0x310 - stw r6, 0x88(r29) - stw r5, 0x8C(r29) - lwz r5, 0x14(r31) - stw r5, 0x90(r29) - lfs f0, 0x8C(r29) - stfs f0, 0xA0(r29) - lwz r5, 0x18(r30) - stb r0, 0x394(r29) - rlwinm r0,r5,2,0,29 - stw r4, 0x6C(r29) - sth r5, 0x304(r29) - lwz r5, 0x3140(r13) - lwz r4, 0x40(r5) - lwz r6, 0x44(r5) - lwzx r28, r4, r0 - lwz r5, 0x4(r28) - addi r4, r28, 0x8 - bl 0x412C - lfs f0, -0x6038(r2) - li r5, 0 - li r6, 0 - stfs f0, 0x308(r29) - lwz r3, 0x220(r29) - lwz r4, 0x0(r28) - bl -0x914B0 - lwz r5, 0x3140(r13) - addi r3, r27, 0 - li r4, 0 - lwz r0, 0x64(r5) - stw r0, 0x2E8(r29) - lwz r0, 0x24(r31) - stw r0, 0x64(r29) - lfs f0, -0x6004(r2) - stfs f0, 0x58(r29) - lfs f0, 0x58(r29) - stfs f0, 0x5C(r29) - lwz r12, 0x0(r27) - lwz r12, 0x34(r12) - mtlr r12 - blrl - - .loc_0x178: - mr r3, r29 - lmw r27, 0x14(r1) - lwz r0, 0x2C(r1) - addi r1, r1, 0x28 - mtlr r0 - blr - */ + Plant* plant = plantMgr->birth(); + if (plant) { + plant->init(info._00); + plant->mRotation = info._0C; + plant->mDirection = plant->mRotation.y; + plant->reset(mPlantType); + plant->mGenerator = info.mGenerator; + plant->mHealth = 1.0f; + plant->_5C = plant->mHealth; + plant->startAI(PlantAI::STATE_Wait); + } + + return plant; } /* @@ -1591,130 +1073,7 @@ void* GenObjectPlant::birth(BirthInfo&) */ void GenObjectPlant::render(Graphics&, Generator*) { - /* - .loc_0x0: - lwz r4, 0x3140(r13) - lwz r5, 0x18(r3) - lwz r3, 0x5C(r4) - b .loc_0x20 - - .loc_0x10: - lwz r0, 0x14(r3) - cmpw r0, r5 - beqlr- - lwz r3, 0xC(r3) - - .loc_0x20: - cmplwi r3, 0 - bne+ .loc_0x10 - blr - */ -} - -/* - * --INFO-- - * Address: 8011B098 - * Size: 000084 - */ -PlantMgr::~PlantMgr() -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - mr. r31, r3 - beq- .loc_0x6C - lis r3, 0x802C - addi r3, r3, 0x3B08 - stw r3, 0x0(r31) - addi r0, r3, 0x18 - stw r0, 0x8(r31) - beq- .loc_0x5C - lis r3, 0x802C - subi r3, r3, 0x51A8 - stw r3, 0x0(r31) - addi r0, r3, 0x18 - stw r0, 0x8(r31) - beq- .loc_0x5C - lis r3, 0x802C - subi r3, r3, 0x4F80 - stw r3, 0x0(r31) - addi r0, r3, 0x18 - stw r0, 0x8(r31) - - .loc_0x5C: - extsh. r0, r4 - ble- .loc_0x6C - mr r3, r31 - bl -0xD3F54 - - .loc_0x6C: - mr r3, r31 - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ -} - -/* - * --INFO-- - * Address: 8011B11C - * Size: 000008 - */ -f32 Plant::getiMass() -{ - /* - .loc_0x0: - lfs f1, -0x6038(r2) - blr - */ -} - -/* - * --INFO-- - * Address: 8011B124 - * Size: 000010 - */ -bool Plant::isAlive() -{ - /* - .loc_0x0: - lbz r0, 0x30C(r3) - cntlzw r0, r0 - rlwinm r3,r0,27,5,31 - blr - */ -} - -/* - * --INFO-- - * Address: 8011B134 - * Size: 000008 - */ -void Plant::setMotionSpeed(f32) -{ - /* - .loc_0x0: - stfs f1, 0x308(r3) - blr - */ -} - -/* - * --INFO-- - * Address: 8011B13C - * Size: 00000C - */ -void Plant::stopMotion() -{ - /* - .loc_0x0: - lfs f0, -0x6038(r2) - stfs f0, 0x308(r3) - blr - */ + // remnants of some debug thing + if (plantMgr->usePlantType(mPlantType)) + ; } diff --git a/src/plugPikiKando/viewPiki.cpp b/src/plugPikiKando/viewPiki.cpp index 6d3c2da7..45fd0e4a 100644 --- a/src/plugPikiKando/viewPiki.cpp +++ b/src/plugPikiKando/viewPiki.cpp @@ -101,9 +101,9 @@ void PikiShapeObject::initOnce() */ PikiShapeObject::PikiShapeObject(Shape* shape) { - mShape = shape; - mShape->_24 = gameflow._308; - mAnimMgr = nullptr; + mShape = shape; + mShape->mFrameCacher = gameflow.mFrameCacher; + mAnimMgr = nullptr; mShape->overrideAnim(0, &_04); mShape->overrideAnim(1, &_14); } diff --git a/src/plugPikiNakata/genteki.cpp b/src/plugPikiNakata/genteki.cpp index a9bac9ac..201668bd 100644 --- a/src/plugPikiNakata/genteki.cpp +++ b/src/plugPikiNakata/genteki.cpp @@ -48,7 +48,7 @@ void GenObjectTeki::initialise() fact->mSpawnerInfo[fact->mSpawnerCount].mID = 'teki'; fact->mSpawnerInfo[fact->mSpawnerCount].mGenFunction = &makeObjectTeki; fact->mSpawnerInfo[fact->mSpawnerCount].mName = "敵を発生"; // 'spawn enemies' - fact->mSpawnerInfo[fact->mSpawnerCount]._0C = 10; + fact->mSpawnerInfo[fact->mSpawnerCount].mVersion = 10; fact->mSpawnerCount++; } @@ -109,7 +109,7 @@ void GenObjectTeki::updateUseList(Generator*, int) return; } - int tekiType = tekiMgr->mTekiParams[mTekiType]->mParameters->mIntParams[0].mParameters[3]; + int tekiType = tekiMgr->mTekiParams[mTekiType]->getI(TPI_SpawnType); if (tekiType >= TEKI_START && tekiType < TEKI_TypeCount) { tekiMgr->mUsingType[tekiType] = true; } @@ -138,7 +138,7 @@ void* GenObjectTeki::birth(BirthInfo& info) teki->mPersonality->input(*mPersonality); teki->reset(); teki->startAI(0); - teki->_88 = info._0C; + teki->mRotation = info._0C; if (info.mGenerator->_28->_28()) { teki->setCreatureFlag(CF_Unk16); } diff --git a/src/plugPikiNakata/panitestsection.cpp b/src/plugPikiNakata/panitestsection.cpp index 2956879d..98ba39df 100644 --- a/src/plugPikiNakata/panitestsection.cpp +++ b/src/plugPikiNakata/panitestsection.cpp @@ -80,8 +80,8 @@ PaniTestNode::PaniTestNode() for (int i = 0; i < _66C; i++) { _664[i] = static_cast(pikiMgr->birth()); _664[i]->init(nullptr); - _664[i]->_7C.set(1.0f, 1.0f, 1.0f); - _664[i]->_88.set(0.0f, 0.0f, 0.0f); + _664[i]->mScale.set(1.0f, 1.0f, 1.0f); + _664[i]->mRotation.set(0.0f, 0.0f, 0.0f); _664[i]->mPosition.set(0.0f, 0.0f, 0.0f); _664[i]->initColor(Blue); } diff --git a/src/plugPikiNakata/taiattackactions.cpp b/src/plugPikiNakata/taiattackactions.cpp index ad991c99..71f31265 100644 --- a/src/plugPikiNakata/taiattackactions.cpp +++ b/src/plugPikiNakata/taiattackactions.cpp @@ -44,7 +44,11 @@ bool TaiAttackableNaviPikiAction::act(Teki& teki) // this needs? more inlines? somehow? u32 badCompiler; u32 badCompiler2; - teki.addTarget(naviPiki); + if (teki._418[0].mPtr) { + resetCreature(teki._418[0].mPtr); + } + teki._418[0].mPtr = naviPiki; + postSetCreature(teki._418[0].mPtr); return true; } @@ -58,11 +62,11 @@ bool TaiAttackableNaviAction::act(Teki& teki) { Navi* navi = naviMgr->getNavi(); if (teki.attackableCreature(*navi)) { - if (teki._418) { - resetCreature(teki._418); + if (teki._418[0].mPtr) { + resetCreature(teki._418[0].mPtr); } - teki._418 = navi; - postSetCreature(teki._418); + teki._418[0].mPtr = navi; + postSetCreature(teki._418[0].mPtr); return true; } return false; @@ -81,11 +85,11 @@ bool TaiAttackablePikiAction::act(Teki& teki) return false; } - if (teki._418) { - resetCreature(teki._418); + if (teki._418[0].mPtr) { + resetCreature(teki._418[0].mPtr); } - teki._418 = nearest; - postSetCreature(teki._418); + teki._418[0].mPtr = nearest; + postSetCreature(teki._418[0].mPtr); // sigh u32 badCompiler; u32 badCompiler2; @@ -595,24 +599,6 @@ bool TaiAnimationSwallowingAction::act(Teki& teki) */ void BTeki::clearTekiOption(int opt) { mTekiOptions &= ~opt; } -/* - * --INFO-- - * Address: 80127ECC - * Size: 000018 - */ -void TekiParameters::getF(int) -{ - /* - .loc_0x0: - lwz r3, 0x84(r3) - rlwinm r0,r4,2,0,29 - lwz r3, 0x4(r3) - lwz r3, 0x0(r3) - lfsx f1, r3, r0 - blr - */ -} - /* * --INFO-- * Address: 80127EE4 diff --git a/src/plugPikiNakata/taichappy.cpp b/src/plugPikiNakata/taichappy.cpp index b20966be..01415776 100644 --- a/src/plugPikiNakata/taichappy.cpp +++ b/src/plugPikiNakata/taichappy.cpp @@ -79,7 +79,7 @@ TaiChappySoundTable::TaiChappySoundTable() * Size: 0003A4 */ TaiChappyParameters::TaiChappyParameters() - : TekiParameters(0, 0) // TODO: fix later + : TekiParameters(21, 53) { /* .loc_0x0: @@ -325,7 +325,7 @@ TaiChappyParameters::TaiChappyParameters() * Size: 0003A0 */ TaiBlackChappyParameters::TaiBlackChappyParameters() - : TekiParameters(0, 0) // TODO: fix later + : TekiParameters(21, 53) { /* .loc_0x0: @@ -622,7 +622,7 @@ TaiCatfishSoundTable::TaiCatfishSoundTable() * Size: 00039C */ TaiCatfishParameters::TaiCatfishParameters() - : TekiParameters(0, 0) // TODO: fix later + : TekiParameters(21, 53) { /* .loc_0x0: diff --git a/src/plugPikiNakata/taicollec.cpp b/src/plugPikiNakata/taicollec.cpp index 9b835c67..a0196a81 100644 --- a/src/plugPikiNakata/taicollec.cpp +++ b/src/plugPikiNakata/taicollec.cpp @@ -79,7 +79,7 @@ TaiCollecSoundTable::TaiCollecSoundTable() * Size: 000484 */ TaiCollecParameters::TaiCollecParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(21, 60) { /* .loc_0x0: @@ -4386,7 +4386,7 @@ void TaiCollecLegEffectAction::setType(Vector3f&, int, int) * Size: 000088 */ TaiHollecParameters::TaiHollecParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 50) { /* .loc_0x0: diff --git a/src/plugPikiNakata/taiiwagen.cpp b/src/plugPikiNakata/taiiwagen.cpp index 309ff793..37da8b80 100644 --- a/src/plugPikiNakata/taiiwagen.cpp +++ b/src/plugPikiNakata/taiiwagen.cpp @@ -26,7 +26,7 @@ static void _Print(char*, ...) * Size: 000108 */ TaiIwagonParameters::TaiIwagonParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 50) { /* .loc_0x0: @@ -678,7 +678,7 @@ bool TaiIwagonRollingAction::act(Teki&) * Size: 000118 */ TaiIwagenParameters::TaiIwagenParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 51) { /* .loc_0x0: diff --git a/src/plugPikiNakata/taikinoko.cpp b/src/plugPikiNakata/taikinoko.cpp index d0fd62ab..771331b4 100644 --- a/src/plugPikiNakata/taikinoko.cpp +++ b/src/plugPikiNakata/taikinoko.cpp @@ -78,7 +78,7 @@ TaiKinokoSoundTable::TaiKinokoSoundTable() * Size: 000518 */ TaiKinokoParameters::TaiKinokoParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(22, 60) { /* .loc_0x0: diff --git a/src/plugPikiNakata/taimizinko.cpp b/src/plugPikiNakata/taimizinko.cpp index bf68e6b9..199a8197 100644 --- a/src/plugPikiNakata/taimizinko.cpp +++ b/src/plugPikiNakata/taimizinko.cpp @@ -26,7 +26,7 @@ static void _Print(char*, ...) * Size: 0000B0 */ TaiMizigenParameters::TaiMizigenParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 50) { /* .loc_0x0: @@ -424,7 +424,7 @@ bool TaiMizigenNaviApprouchAction::act(Teki&) * Size: 000380 */ TaiMizinkoParameters::TaiMizinkoParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 64) { /* .loc_0x0: diff --git a/src/plugPikiNakata/tainapkid.cpp b/src/plugPikiNakata/tainapkid.cpp index 53b4205b..a5f923de 100644 --- a/src/plugPikiNakata/tainapkid.cpp +++ b/src/plugPikiNakata/tainapkid.cpp @@ -79,7 +79,7 @@ TaiNapkidSoundTable::TaiNapkidSoundTable() * Size: 000564 */ TaiNapkidParameters::TaiNapkidParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(21, 63) { /* .loc_0x0: diff --git a/src/plugPikiNakata/taiotimoti.cpp b/src/plugPikiNakata/taiotimoti.cpp index 0fd37f76..dd1021cd 100644 --- a/src/plugPikiNakata/taiotimoti.cpp +++ b/src/plugPikiNakata/taiotimoti.cpp @@ -78,7 +78,7 @@ TaiOtimotiSoundTable::TaiOtimotiSoundTable() * Size: 000540 */ TaiOtimotiParameters::TaiOtimotiParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(21, 62) { /* .loc_0x0: @@ -479,7 +479,7 @@ TaiBlackFrogSoundTable::TaiBlackFrogSoundTable() * Size: 00053C */ TaiBlackFrogParameters::TaiBlackFrogParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(21, 62) { /* .loc_0x0: diff --git a/src/plugPikiNakata/taipalm.cpp b/src/plugPikiNakata/taipalm.cpp index c7784c9f..082bb45d 100644 --- a/src/plugPikiNakata/taipalm.cpp +++ b/src/plugPikiNakata/taipalm.cpp @@ -78,7 +78,7 @@ TaiPalmSoundTable::TaiPalmSoundTable() * Size: 0001F4 */ TaiPalmParameters::TaiPalmParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 53) { /* .loc_0x0: diff --git a/src/plugPikiNakata/taishell.cpp b/src/plugPikiNakata/taishell.cpp index 53c8681c..b4fe44c3 100644 --- a/src/plugPikiNakata/taishell.cpp +++ b/src/plugPikiNakata/taishell.cpp @@ -78,7 +78,7 @@ TaiShellSoundTable::TaiShellSoundTable() * Size: 00018C */ TaiShellParameters::TaiShellParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(21, 51) { /* .loc_0x0: @@ -1321,7 +1321,7 @@ TaiPearlSoundTable::TaiPearlSoundTable() * Size: 000148 */ TaiPearlParameters::TaiPearlParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 50) { /* .loc_0x0: @@ -1416,7 +1416,7 @@ TaiPearlParameters::TaiPearlParameters() * Size: 00014C */ TaiRocpearlParameters::TaiRocpearlParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 50) { /* .loc_0x0: diff --git a/src/plugPikiNakata/taiswallow.cpp b/src/plugPikiNakata/taiswallow.cpp index e97886d5..83a418f6 100644 --- a/src/plugPikiNakata/taiswallow.cpp +++ b/src/plugPikiNakata/taiswallow.cpp @@ -78,7 +78,7 @@ TaiSwallowSoundTable::TaiSwallowSoundTable() * Size: 000448 */ TaiSwallowParameters::TaiSwallowParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 56) { /* .loc_0x0: @@ -365,7 +365,7 @@ TaiSwallowParameters::TaiSwallowParameters() * Size: 00043C */ TaiBlackSwallowParameters::TaiBlackSwallowParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 56) { /* .loc_0x0: diff --git a/src/plugPikiNakata/teki.cpp b/src/plugPikiNakata/teki.cpp index eeef07db..149a2f0f 100644 --- a/src/plugPikiNakata/teki.cpp +++ b/src/plugPikiNakata/teki.cpp @@ -1,4 +1,5 @@ #include "teki.h" +#include "TekiParameters.h" #include "Dolphin/os.h" /* @@ -145,18 +146,7 @@ void BTeki::clearAnimationKeyOptions() { mAnimKeyOptions = 0; } * Address: 80143D48 * Size: 000018 */ -f32 BTeki::getShadowSize() -{ - /* - .loc_0x0: - lwz r3, 0x2C4(r3) - lwz r3, 0x84(r3) - lwz r3, 0x4(r3) - lwz r3, 0x0(r3) - lfs f1, 0x48(r3) - blr - */ -} +f32 BTeki::getShadowSize() { return mTekiParams->getF(TPF_ShadowSize); } /* * --INFO-- diff --git a/src/plugPikiNakata/tekibteki.cpp b/src/plugPikiNakata/tekibteki.cpp index 8867e2a2..57b21da5 100644 --- a/src/plugPikiNakata/tekibteki.cpp +++ b/src/plugPikiNakata/tekibteki.cpp @@ -1,7 +1,19 @@ #include "types.h" #include "teki.h" +#include "CreatureProp.h" #include "Shape.h" +#include "zen/particle.h" +#include "Graphics.h" +#include "BaseInf.h" +#include "SoundMgr.h" +#include "nlib/System.h" +#include "MapMgr.h" #include "sysNew.h" +#include "Pellet.h" +#include "RadarInfo.h" +#include "TekiStrategy.h" +#include "PikiMacros.h" +#include "EffectMgr.h" int BTeki::TEKI_OPTION_VISIBLE = 1 << 0; int BTeki::TEKI_OPTION_SHADOW_VISIBLE = 1 << 1; @@ -17,12 +29,12 @@ int BTeki::TEKI_OPTION_DRAWED = 1 << 13; int BTeki::TEKI_OPTION_SHAPE_VISIBLE = 1 << 14; int BTeki::TEKI_OPTION_DAMAGE_COUNTABLE = 1 << 15; -int BTeki::ANIMATION_KEY_OPTION_FINISHED = 1 << 0; -int BTeki::ANIMATION_KEY_OPTION_ACTION_0 = 1 << 1; -int BTeki::ANIMATION_KEY_OPTION_ACTION_1 = 1 << 2; -int BTeki::ANIMATION_KEY_OPTION_ACTION_2 = 1 << 3; -int BTeki::ANIMATION_KEY_OPTION_LOOPSTART = 1 << 5; -int BTeki::ANIMATION_KEY_OPTION_LOOPEND = 1 << 6; +int BTeki::ANIMATION_KEY_OPTION_FINISHED = 1 << KEY_Done; +int BTeki::ANIMATION_KEY_OPTION_ACTION_0 = 1 << KEY_Action0; +int BTeki::ANIMATION_KEY_OPTION_ACTION_1 = 1 << KEY_Action1; +int BTeki::ANIMATION_KEY_OPTION_ACTION_2 = 1 << KEY_Action2; +int BTeki::ANIMATION_KEY_OPTION_LOOPSTART = 1 << KEY_LoopStart; +int BTeki::ANIMATION_KEY_OPTION_LOOPEND = 1 << KEY_LoopEnd; /* * --INFO-- @@ -75,141 +87,40 @@ void BTeki::viewDoAnimation() { doAnimation(); } * Address: 80143FF4 * Size: 00004C */ -void BTeki::viewFinishMotion() -{ - mTekiAnimator->finishMotion(PaniMotionInfo(-1, this)); - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x20(r1) - stw r31, 0x1C(r1) - mr. r31, r3 - addi r5, r31, 0 - beq- .loc_0x20 - lwz r5, 0x2C0(r31) - - .loc_0x20: - addi r3, r1, 0xC - li r4, -0x1 - bl -0x25090 - mr r4, r3 - lwz r3, 0x2CC(r31) - bl -0x24DF8 - lwz r0, 0x24(r1) - lwz r31, 0x1C(r1) - addi r1, r1, 0x20 - mtlr r0 - blr - */ -} +void BTeki::viewFinishMotion() { mTekiAnimator->finishMotion(PaniMotionInfo(-1, this)); } /* * --INFO-- * Address: 80144040 * Size: 00001C */ -void BTeki::viewGetScale() -{ - /* - .loc_0x0: - lfs f0, 0x7C(r4) - stfs f0, 0x0(r3) - lfs f0, 0x80(r4) - stfs f0, 0x4(r3) - lfs f0, 0x84(r4) - stfs f0, 0x8(r3) - blr - */ -} +Vector3f BTeki::viewGetScale() { return mScale; } /* * --INFO-- * Address: 8014405C * Size: 000018 */ -void BTeki::viewGetBottomRadius() -{ - /* - .loc_0x0: - lwz r3, 0x2C4(r3) - lwz r3, 0x84(r3) - lwz r3, 0x4(r3) - lwz r3, 0x0(r3) - lfs f1, 0x50(r3) - blr - */ -} +f32 BTeki::viewGetBottomRadius() { return mTekiParams->getF(TPF_CorpseSize); } /* * --INFO-- * Address: 80144074 * Size: 000018 */ -void BTeki::viewGetHeight() -{ - /* - .loc_0x0: - lwz r3, 0x2C4(r3) - lwz r3, 0x84(r3) - lwz r3, 0x4(r3) - lwz r3, 0x0(r3) - lfs f1, 0x54(r3) - blr - */ -} +f32 BTeki::viewGetHeight() { return mTekiParams->getF(TPF_CorpseHeight); } /* * --INFO-- * Address: 8014408C * Size: 0000A4 */ -void BTeki::viewDraw(Graphics&, Matrix4f&) +void BTeki::viewDraw(Graphics& gfx, Matrix4f& mat) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x28(r1) - stw r31, 0x24(r1) - addi r31, r5, 0 - li r5, 0 - stw r30, 0x20(r1) - addi r30, r4, 0 - lis r4, 0x803A - stw r29, 0x1C(r1) - addi r29, r3, 0 - addi r3, r30, 0 - lwz r12, 0x3B4(r30) - subi r4, r4, 0x77C0 - lwz r12, 0x74(r12) - mtlr r12 - blrl - lwz r3, 0x2CC(r29) - lwz r12, 0x30(r3) - lwz r12, 0x18(r12) - mtlr r12 - blrl - lwz r3, 0x2D0(r29) - addi r4, r30, 0 - addi r5, r31, 0 - lwz r3, 0x0(r3) - li r6, 0 - bl -0x10EDE4 - lwz r3, 0x2D0(r29) - mr r4, r30 - lwz r5, 0x2E4(r30) - li r6, 0 - lwz r3, 0x0(r3) - bl -0x113CA4 - lwz r0, 0x2C(r1) - lwz r31, 0x24(r1) - lwz r30, 0x20(r1) - lwz r29, 0x1C(r1) - addi r1, r1, 0x28 - mtlr r0 - blr - */ + gfx.useMatrix(Matrix4f::ident, 0); + mTekiAnimator->updateContext(); + mTekiShape->mShape->updateAnim(gfx, mat, nullptr); + mTekiShape->mShape->drawshape(gfx, *gfx._2E4, nullptr); } /* @@ -217,51 +128,21 @@ void BTeki::viewDraw(Graphics&, Matrix4f&) * Address: 80144130 * Size: 000024 */ -void BTeki::viewKill() -{ - /* - .loc_0x0: - mflr r0 - li r4, 0 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - bl -0xB9460 - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} +void BTeki::viewKill() { kill(false); } /* * --INFO-- * Address: 80144154 * Size: 00000C */ -void BTeki::doStore(CreatureInf*) -{ - /* - .loc_0x0: - lwz r0, 0x320(r3) - stw r0, 0x3C(r4) - blr - */ -} +void BTeki::doStore(CreatureInf* info) { info->mTekiType = mTekiType; } /* * --INFO-- * Address: 80144160 * Size: 00000C */ -void BTeki::doRestore(CreatureInf*) -{ - /* - .loc_0x0: - lwz r0, 0x3C(r4) - stw r0, 0x320(r3) - blr - */ -} +void BTeki::doRestore(CreatureInf* info) { mTekiType = (TekiTypes)info->mTekiType; } /* * --INFO-- @@ -270,9 +151,9 @@ void BTeki::doRestore(CreatureInf*) */ TekiShapeObject::TekiShapeObject(Shape* shape) { - mShape = shape; - mShape->_24 = 0; - mAnimMgr = new AnimMgr(shape, nullptr, 0x8000, nullptr); + mShape = shape; + mShape->mFrameCacher = nullptr; + mAnimMgr = new AnimMgr(shape, nullptr, 0x8000, nullptr); mShape->overrideAnim(0, &mAnimContext); } @@ -281,47 +162,16 @@ TekiShapeObject::TekiShapeObject(Shape* shape) * Address: 8014421C * Size: 000010 */ -bool BTeki::isPellet(int) -{ - /* - .loc_0x0: - subfic r0, r3, 0x34 - cntlzw r0, r0 - rlwinm r3,r0,27,5,31 - blr - */ -} +bool BTeki::isPellet(int objType) { return objType == OBJTYPE_Pellet; } /* * --INFO-- * Address: 8014422C * Size: 000050 */ -void BTeki::calcCircleDistanceStatic(Vector3f&, f32, Vector3f&, f32) +f32 BTeki::calcCircleDistanceStatic(Vector3f& pos1, f32 rad1, Vector3f& pos2, f32 rad2) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x28(r1) - stfd f31, 0x20(r1) - fmr f31, f2 - stfd f30, 0x18(r1) - fmr f30, f1 - lfs f1, 0x0(r3) - lfs f2, 0x8(r3) - lfs f3, 0x0(r4) - lfs f4, 0x8(r4) - bl -0x10BC30 - fsubs f0, f1, f30 - lwz r0, 0x2C(r1) - lfd f30, 0x18(r1) - fsubs f1, f0, f31 - lfd f31, 0x20(r1) - addi r1, r1, 0x28 - mtlr r0 - blr - */ + return qdist2(pos1.x, pos1.z, pos2.x, pos2.z) - rad1 - rad2; } /* @@ -329,25 +179,17 @@ void BTeki::calcCircleDistanceStatic(Vector3f&, f32, Vector3f&, f32) * Address: 8014427C * Size: 000014 */ -bool BTeki::alwaysUpdatePlatform() -{ - /* - .loc_0x0: - lwz r0, 0x320(r3) - subfic r0, r0, 0xA - cntlzw r0, r0 - rlwinm r3,r0,27,5,31 - blr - */ -} +bool BTeki::alwaysUpdatePlatform() { return mTekiType == TEKI_Shell; } /* * --INFO-- * Address: 80144290 * Size: 0000A8 */ -void BTeki::calcSphereDistanceStatic(Vector3f&, f32, Vector3f&, f32) +f32 BTeki::calcSphereDistanceStatic(Vector3f& pos1, f32 rad1, Vector3f& pos2, f32 rad2) { + return pos1.distance(pos2) - rad1 - rad2; // not quite right + /* .loc_0x0: mflr r0 @@ -568,22 +410,7 @@ void BTeki::moveTowardStatic(Vector3f&, Vector3f&, f32, Vector3f&) * Address: 80144570 * Size: 000028 */ -void BTeki::arrivedAt(f32, f32) -{ - /* - .loc_0x0: - lfs f0, -0x5898(r2) - lwz r3, 0x3150(r13) - fmuls f2, f0, f2 - lfs f0, 0x28C(r3) - fmuls f0, f2, f0 - fcmpo cr0, f1, f0 - cror 2, 0, 0x2 - mfcr r0 - rlwinm r3,r0,3,31,31 - blr - */ -} +bool BTeki::arrivedAt(f32 p1, f32 p2) { return p1 <= 2.0f * p2 * NSystem::system->getFrameTime(); } /* * --INFO-- @@ -593,259 +420,19 @@ void BTeki::arrivedAt(f32, f32) BTeki::BTeki() : Creature(nullptr) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - extsh. r0, r4 - stwu r1, -0x78(r1) - stw r31, 0x74(r1) - addi r31, r3, 0 - stw r30, 0x70(r1) - stw r29, 0x6C(r1) - stw r28, 0x68(r1) - beq- .loc_0x3C - addi r0, r31, 0x454 - lis r3, 0x802B - stw r0, 0x2C0(r31) - subi r0, r3, 0x246C - stw r0, 0x454(r31) - - .loc_0x3C: - addi r3, r31, 0 - li r4, 0 - bl -0xB9704 - lis r3, 0x802C - addi r0, r3, 0x3B0 - stw r0, 0x2B8(r31) - li r30, 0 - lis r3, 0x802D - stw r30, 0x2BC(r31) - subi r5, r3, 0x2E90 - lis r4, 0x802C - stw r5, 0x0(r31) - lis r3, 0x802C - addi r7, r5, 0x1F4 - lwz r6, 0x2C0(r31) - addi r5, r5, 0x114 - addi r0, r31, 0x454 - stw r7, 0x0(r6) - addi r28, r4, 0x5CEC - addi r29, r3, 0x5BF0 - stw r5, 0x2B8(r31) - addi r3, r31, 0x35C - lwz r4, 0x2C0(r31) - sub r0, r0, r4 - stw r0, 0x4(r4) - stw r30, 0x318(r31) - stw r28, 0x358(r31) - stw r29, 0x358(r31) - bl -0x277F0 - stw r28, 0x368(r31) - addi r3, r31, 0x36C - stw r29, 0x368(r31) - bl -0x27800 - stw r28, 0x378(r31) - addi r3, r31, 0x37C - stw r29, 0x378(r31) - bl -0x27810 - addi r3, r31, 0x388 - bl -0x27818 - addi r3, r31, 0x398 - bl -0x27820 - stw r30, 0x3E0(r31) - lis r3, 0x8009 - subi r4, r3, 0x5FD4 - stw r30, 0x3E4(r31) - addi r3, r31, 0x418 - li r5, 0 - stw r30, 0x3E8(r31) - li r6, 0x4 - li r7, 0x4 - stw r30, 0x3EC(r31) - bl 0xD03D0 - lis r3, 0x8009 - subi r4, r3, 0x5808 - addi r3, r31, 0x42C - li r5, 0 - li r6, 0xC - li r7, 0x3 - bl 0xD03B4 - li r0, 0x37 - stw r0, 0x6C(r31) - li r0, 0x1 - li r3, 0x58 - stw r0, 0x1FC(r31) - bl -0xFD6D0 - mr. r28, r3 - beq- .loc_0x250 - lis r3, 0x802B - subi r0, r3, 0x6C8 - stw r0, 0x54(r28) - addi r3, r1, 0x44 - subi r4, r13, 0x988 - stw r30, 0x0(r28) - bl -0xF3C20 - lwz r0, 0x44(r1) - addi r5, r1, 0x3C - addi r4, r28, 0 - stw r0, 0x3C(r1) - addi r3, r28, 0x4 - bl -0xE5C90 - lis r3, 0x802A - addi r30, r3, 0x6098 - stw r30, 0xC(r28) - addi r3, r1, 0x4C - subi r4, r13, 0x984 - lfs f0, -0x5894(r2) - stfs f0, 0x10(r28) - bl -0xF3C58 - lwz r0, 0x4C(r1) - addi r5, r1, 0x38 - addi r4, r28, 0 - stw r0, 0x38(r1) - addi r3, r28, 0x14 - bl -0xE5CC8 - stw r30, 0x1C(r28) - addi r3, r1, 0x54 - subi r4, r13, 0x980 - lfs f0, -0x5894(r2) - stfs f0, 0x20(r28) - bl -0xF3C88 - lwz r0, 0x54(r1) - addi r5, r1, 0x34 - addi r4, r28, 0 - stw r0, 0x34(r1) - addi r3, r28, 0x24 - bl -0xE5CF8 - stw r30, 0x2C(r28) - addi r3, r1, 0x5C - subi r4, r13, 0x97C - lfs f0, -0x5890(r2) - stfs f0, 0x30(r28) - bl -0xF3CB8 - lwz r0, 0x5C(r1) - addi r5, r1, 0x30 - addi r4, r28, 0 - stw r0, 0x30(r1) - addi r3, r28, 0x34 - bl -0xE5D28 - stw r30, 0x3C(r28) - addi r3, r1, 0x64 - subi r4, r13, 0x978 - lfs f0, -0x588C(r2) - stfs f0, 0x40(r28) - bl -0xF3CE8 - lwz r0, 0x64(r1) - addi r5, r1, 0x2C - addi r4, r28, 0 - stw r0, 0x2C(r1) - addi r3, r28, 0x44 - bl -0xE5D58 - stw r30, 0x4C(r28) - lfs f0, -0x5888(r2) - stfs f0, 0x50(r28) - - .loc_0x250: - stw r28, 0x224(r31) - li r3, 0x38 - bl -0xFD7EC - addi r28, r3, 0 - mr. r3, r28 - beq- .loc_0x26C - bl 0x8260 - - .loc_0x26C: - stw r28, 0x2C8(r31) - li r3, 0x54 - bl -0xFD808 - addi r28, r3, 0 - mr. r3, r28 - beq- .loc_0x288 - bl -0x24960 - - .loc_0x288: - stw r28, 0x2CC(r31) - li r3, 0x10 - bl -0xFD824 - addi r28, r3, 0 - mr. r3, r28 - beq- .loc_0x2A4 - bl -0x28D00 - - .loc_0x2A4: - stw r28, 0x428(r31) - li r0, 0x14 - stw r0, 0x348(r31) - lwz r0, 0x348(r31) - rlwinm r3,r0,2,0,29 - bl -0xFD84C - stw r3, 0x450(r31) - li r0, 0 - li r3, 0x10 - stw r0, 0x34C(r31) - bl -0xFD860 - stw r3, 0x3D8(r31) - li r3, 0x14 - bl -0xFD86C - addi r28, r3, 0 - mr. r3, r28 - beq- .loc_0x2F0 - li r4, 0x16 - bl -0xBBC54 - - .loc_0x2F0: - stw r28, 0x220(r31) - li r3, 0x28 - bl -0xFD88C - addi r28, r3, 0 - mr. r3, r28 - beq- .loc_0x314 - addi r4, r31, 0 - li r5, 0x1 - bl -0xA0BDC - - .loc_0x314: - stw r28, 0x2C(r31) - li r3, 0x8 - bl -0xFD8B0 - addi r28, r3, 0 - mr. r0, r28 - beq- .loc_0x370 - li r0, 0x3 - stw r0, 0x0(r28) - lwz r0, 0x0(r28) - rlwinm r3,r0,2,0,29 - bl -0xFD8D0 - li r5, 0 - stw r3, 0x4(r28) - addi r6, r5, 0 - addi r4, r5, 0 - b .loc_0x364 - - .loc_0x354: - lwz r3, 0x4(r28) - addi r5, r5, 0x1 - stwx r4, r3, r6 - addi r6, r6, 0x4 - - .loc_0x364: - lwz r0, 0x0(r28) - cmplw r5, r0 - blt+ .loc_0x354 - - .loc_0x370: - stw r28, 0x3DC(r31) - mr r3, r31 - lwz r0, 0x7C(r1) - lwz r31, 0x74(r1) - lwz r30, 0x70(r1) - lwz r29, 0x6C(r1) - lwz r28, 0x68(r1) - addi r1, r1, 0x78 - mtlr r0 - blr - */ + mObjType = OBJTYPE_Teki; + mLifeGauge._1C = 1; + mProps = new CreatureProp(); + mPersonality = new TekiPersonality(); + mTekiAnimator = new PaniTekiAnimator(); + _428 = new NVibrationFunction(); + _348 = 20; + _450 = new u32[_348]; + _34C = 0; + _3D8 = new u32[4]; + mCollInfo = new CollInfo(22); + mSeContext = new SeContext(this, 1); + _3DC = new zen::PtclGenPack(3); } /* @@ -853,36 +440,13 @@ BTeki::BTeki() * Address: 80144930 * Size: 000064 */ -void BTeki::init(int) +void BTeki::init(int tekiType) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - mr r31, r3 - stw r4, 0x320(r3) - lwz r3, 0x3160(r13) - lwz r4, 0x320(r31) - bl 0x63DC - stw r3, 0x2C4(r31) - addi r3, r31, 0x1B8 - addi r4, r31, 0x42C - li r5, 0x3 - bl -0x60CE4 - lwz r4, 0xC8(r31) - li r0, -0x202 - addi r3, r31, 0 - and r0, r4, r0 - stw r0, 0xC8(r31) - bl -0xB9EF8 - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + mTekiType = (TekiTypes)tekiType; + mTekiParams = tekiMgr->getTekiParameters(mTekiType); + mSearchBuffer.init(mTekiSearchData, 3); + resetCreatureFlag(CF_Unk1 | CF_Unk10); + Creature::init(); } /* @@ -892,6 +456,98 @@ void BTeki::init(int) */ void BTeki::reset() { + if (tekiOptUpdateMgr) { + _174.init(tekiOptUpdateMgr); + } + + clearTekiOptions(); + setTekiOption(TEKIOPT_Visible | TEKIOPT_ShadowVisible | TEKIOPT_LifeGaugeVisible | TEKIOPT_Atari | TEKIOPT_Alive | TEKIOPT_Organic + | TEKIOPT_Unk11 | TEKIOPT_ShapeVisible | TEKIOPT_DamageCountable); + + resetPosition(mPersonality->_04); + mDirection = mPersonality->_1C; + _26C = getSize(); + _31C = 0; + _324 = 0; + _330 = 0; + _338 = 0; + _334 = 0; + mHealth = getParameterF(TPF_Life); + mStoredDamage = 0.0f; + _340 = 0.0f; + _344 = -1; + _3C0 = 0.0f; + _3BC = 0; + _3A8 = -1; + + clearAnimationKeyOptions(); + _3B0 = 0; + mMotionSpeed = 0.0f; + _3AC = 0.0f; + + for (int i = 0; i < 4; i++) { + _418[i].mPtr = nullptr; + } + + _350 = 'test'; + _354 = -1; + _388.set(0.0f, 0.0f, 0.0f); + _394 = 0.0f; + _398.set(0.0f, 0.0f, 0.0f); + _3A4 = 0.0f; + + mPellet = nullptr; + + mTekiShape = tekiMgr->getTekiShapeObject(mTekiType); + + if (!mTekiShape) { + clearTekiOption(TEKIOPT_Visible | TEKIOPT_ShadowVisible | TEKIOPT_LifeGaugeVisible | TEKIOPT_Atari | TEKIOPT_Alive + | TEKIOPT_Organic); + } else { + mTekiShape->mShape->makeInstance(_3E0, 0); + mCollInfo->initInfo(mTekiShape->mShape, nullptr, nullptr); + mTekiAnimator->init(&mTekiShape->mAnimContext, mTekiShape->mAnimMgr, tekiMgr->mMotionTable); + } + + if (mTekiShape && mTekiShape->mShape) { + mPlatMgr.init(this, mapMgr, mTekiShape->mShape); + } + + for (int i = 0; i < _348; i++) { + _450[i] = 0; + } + + for (int i = 0; i < 4; i++) { + _3D8[i] = 0; + } + + _3C4 = 0.0f; + _3C8 = 0.0f; + _3CC = 0.0f; + _3D0 = 0.0f; + _3D4 = 0.0f; + + _3F0 = -1; + _3F4 = -1; + _3F8 = -1; + _3FC = -1; + _400 = -1; + _404 = -1; + _408 = -1; + _40C = -1; + + if (getParameterI(TPI_CullingType) == CULLAI_CullAIOffCamera) { + resetCreatureFlag(CF_AIAlwaysActive); + } else { + setCreatureFlag(CF_AIAlwaysActive); + } + + mCollisionRadius = getParameterF(TPF_CollisionRadius); + + prepareEffects(); + reset70andA4(); + + getCentreSize(); /* .loc_0x0: mflr r0 @@ -1144,6 +800,26 @@ void BTeki::reset() */ void BTeki::prepareEffects() { + if (!effectMgr) { + return; + } + + for (int i = 0; i < 3; i++) { + zen::particleGenerator* ptcl + = effectMgr->create((EffectMgr::effTypeTable)(i + EffectMgr::EFF_Unk52), Vector3f(0.0f, 0.0f, 0.0f), nullptr, nullptr); + if (!ptcl) { + DEBUGPRINT(ptcl->_F0); + break; + } + + ptcl->_1DC = Vector3f(0.0f, 0.0f, 0.0f); + f32 val = ptcl->_F0; + ptcl->setF0(val * getParameterF(TPF_RippleScale)); + ptcl->setFlag(zen::PTCLGEN_GenStopped); + _3DC->setPtclGenPtr(i, ptcl); + } + + _3DC->setEmitPosPtr(&getPosition()); /* .loc_0x0: mflr r0 @@ -1245,43 +921,15 @@ void BTeki::setCorpsePartJoint(int, int) */ void BTeki::startAI(int) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - stw r30, 0x10(r1) - mr r30, r3 - bl 0x3AF4 - cmplwi r3, 0 - beq- .loc_0x68 - lwz r12, 0x0(r3) - mr r4, r30 - lwz r12, 0x8(r12) - mtlr r12 - blrl - lwz r3, 0x2C8(r30) - addi r31, r3, 0x28 - lwz r3, 0x28(r3) - bl -0xAFAC0 - rlwinm. r0,r3,0,24,31 - beq- .loc_0x68 - lwz r3, 0x2F28(r13) - mr r4, r30 - bl -0xC9854 - lwz r3, 0x301C(r13) - lwz r4, 0x0(r31) - bl -0xAC388 - - .loc_0x68: - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - lwz r30, 0x10(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ + TekiStrategy* strat = getStrategy(); + if (strat) { + strat->start(*static_cast(this)); + ID32& id = mPersonality->mID; + if (Pellet::isUfoPartsID(id.mId)) { + radarInfo->attachParts(this); + pelletMgr->addUseList(id.mId); + } + } } /* @@ -1291,51 +939,22 @@ void BTeki::startAI(int) */ void BTeki::update() { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x78(r1) - stw r31, 0x74(r1) - mr r31, r3 - bl -0xB9CB4 - lwz r0, 0x31C(r31) - cmpwi r0, 0 - bne- .loc_0x8C - mr r3, r31 - lwz r12, 0x0(r31) - lwz r12, 0x17C(r12) - mtlr r12 - blrl - lfs f2, 0x58(r31) - lfs f0, -0x58B0(r2) - fcmpo cr0, f2, f0 - ble- .loc_0x8C - lwz r4, 0x2C4(r31) - lwz r3, 0x3150(r13) - lwz r4, 0x84(r4) - lfs f0, 0x28C(r3) - lwz r3, 0x4(r4) - lwz r3, 0x0(r3) - lfs f3, 0x0(r3) - lfs f1, 0x94(r3) - fmuls f1, f3, f1 - fmuls f0, f1, f0 - fadds f0, f2, f0 - stfs f0, 0x58(r31) - lfs f0, 0x58(r31) - fcmpo cr0, f0, f3 - cror 2, 0x1, 0x2 - bne- .loc_0x8C - stfs f3, 0x58(r31) + // sigh + u32 badCompiler[6]; - .loc_0x8C: - lwz r0, 0x7C(r1) - lwz r31, 0x74(r1) - addi r1, r1, 0x78 - mtlr r0 - blr - */ + Creature::update(); + if (_31C == 0) { + updateTimers(); + if (mHealth > 0.0f) { + f32 max = getParameterF(TPF_Life); + f32 inc = getParameterF(TPF_LifeRecoverRate); + mHealth += NSystem::system->getFrameTime() * (max * inc); + + if (mHealth >= max) { + mHealth = max; + } + } + } } /* @@ -1345,6 +964,20 @@ void BTeki::update() */ void BTeki::doAnimation() { + if (!mTekiShape) { + return; + } + if (isTekiOption(TEKIOPT_ManualAnimation)) { + _3AC = mMotionSpeed; + } else if (!(mTekiAnimator->mAnimInfo->mParams.mFlags() & AnimInfo::FLAG_Unk2)) { + _3AC = mTekiAnimator->mAnimInfo->mParams.mSpeed(); + } else if (isTekiOption(TEKIOPT_StoppingMove)) { + _3AC = _3B8; + } else { + _3AC = doGetVelocityAnimSpeed(); + } + + mTekiAnimator->animate(_3AC); /* .loc_0x0: mflr r0 @@ -1415,38 +1048,11 @@ void BTeki::doAnimation() * Address: 80145010 * Size: 000064 */ -void BTeki::startMotion(int) +void BTeki::startMotion(int motionID) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x20(r1) - stw r31, 0x1C(r1) - mr. r31, r3 - addi r5, r31, 0 - beq- .loc_0x20 - lwz r5, 0x2C0(r31) - - .loc_0x20: - addi r3, r1, 0x10 - bl -0x260A8 - mr r4, r3 - lwz r3, 0x2CC(r31) - bl -0x25E80 - li r0, -0x1 - stw r0, 0x3A8(r31) - mr r3, r31 - lwz r12, 0x0(r31) - lwz r12, 0x1E8(r12) - mtlr r12 - blrl - lwz r0, 0x24(r1) - lwz r31, 0x1C(r1) - addi r1, r1, 0x20 - mtlr r0 - blr - */ + mTekiAnimator->startMotion(PaniMotionInfo(motionID, this)); + _3A8 = -1; + clearAnimationKeyOptions(); } /* @@ -1456,47 +1062,9 @@ void BTeki::startMotion(int) */ void BTeki::startStoppingMove() { - /* - .loc_0x0: - mflr r0 - subi r4, r13, 0x9E4 - stw r0, 0x4(r1) - subi r5, r13, 0x9E0 - subi r6, r13, 0x9DC - stwu r1, -0x30(r1) - stw r31, 0x2C(r1) - addi r31, r3, 0 - addi r3, r1, 0x18 - bl -0x10DF7C - addi r3, r31, 0x70 - addi r4, r1, 0x18 - addi r5, r1, 0x1C - addi r6, r1, 0x20 - bl -0xE7A20 - addi r3, r1, 0xC - subi r4, r13, 0x9F0 - subi r5, r13, 0x9EC - subi r6, r13, 0x9E8 - bl -0x10DFA4 - addi r3, r31, 0xA4 - addi r4, r1, 0xC - addi r5, r1, 0x10 - addi r6, r1, 0x14 - bl -0xE7A48 - mr r3, r31 - lwz r12, 0x0(r31) - li r4, 0x1000 - lwz r12, 0x1CC(r12) - mtlr r12 - blrl - lfs f0, 0x3AC(r31) - stfs f0, 0x3B8(r31) - lwz r0, 0x34(r1) - lwz r31, 0x2C(r1) - addi r1, r1, 0x30 - mtlr r0 - blr - */ + reset70andA4(); + setTekiOption(TEKIOPT_StoppingMove); + _3B8 = _3AC; } /* @@ -1504,31 +1072,14 @@ void BTeki::startStoppingMove() * Address: 8014510C * Size: 000030 */ -void BTeki::finishStoppingMove() -{ - /* - .loc_0x0: - mflr r0 - li r4, 0x1000 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - lwz r12, 0x0(r3) - lwz r12, 0x1D0(r12) - mtlr r12 - blrl - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} +void BTeki::finishStoppingMove() { clearTekiOption(TEKIOPT_StoppingMove); } /* * --INFO-- * Address: 8014513C * Size: 0000A4 */ -void BTeki::getVelocityAnimationSpeed(f32) +f32 BTeki::getVelocityAnimationSpeed(f32) { /* .loc_0x0: @@ -1583,49 +1134,20 @@ void BTeki::getVelocityAnimationSpeed(f32) * Address: 801451E0 * Size: 000080 */ -void BTeki::animationKeyUpdated(PaniAnimKeyEvent&) +void BTeki::animationKeyUpdated(PaniAnimKeyEvent& event) { - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - lwz r0, 0x0(r4) - cmpwi r0, 0x7 - bne- .loc_0x30 - lwz r12, 0x0(r3) - lwz r4, 0x4(r4) - lwz r12, 0x1BC(r12) - mtlr r12 - blrl - b .loc_0x70 + if (event.mEventType == KEY_PlaySound) { + playTableSound(event.mValue); + return; + } - .loc_0x30: - cmpwi r0, 0x8 - bne- .loc_0x50 - lwz r12, 0x0(r3) - lwz r4, 0x4(r4) - lwz r12, 0x1C8(r12) - mtlr r12 - blrl - b .loc_0x70 + if (event.mEventType == KEY_PlayEffect) { + createTekiEffect(event.mValue); + return; + } - .loc_0x50: - stw r0, 0x3A8(r3) - li r5, 0x1 - lwz r12, 0x0(r3) - lwz r0, 0x0(r4) - lwz r12, 0x1DC(r12) - slw r4, r5, r0 - mtlr r12 - blrl - - .loc_0x70: - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ + _3A8 = event.mEventType; + setAnimationKeyOption(1 << event.mEventType); } /* @@ -2436,23 +1958,12 @@ void BTeki::getTekiCollisionSize() */ void BTeki::makeDamaged() { - /* - .loc_0x0: - lfs f1, 0x58(r3) - lfs f0, 0x33C(r3) - fsubs f0, f1, f0 - stfs f0, 0x58(r3) - lfs f1, 0x58(r3) - lfs f0, -0x58B0(r2) - fcmpo cr0, f1, f0 - bge- .loc_0x24 - stfs f0, 0x58(r3) + mHealth -= mStoredDamage; + if (mHealth < 0.0f) { + mHealth = 0.0f; + } - .loc_0x24: - lfs f0, -0x58B0(r2) - stfs f0, 0x33C(r3) - blr - */ + mStoredDamage = 0.0f; } /* @@ -2493,21 +2004,7 @@ void BTeki::startDamageMotion(f32, f32) * Address: 80145C40 * Size: 000024 */ -void BTeki::releasePlatCollisions() -{ - /* - .loc_0x0: - mflr r0 - addi r3, r3, 0x2D4 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - bl -0xB7AF0 - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} +void BTeki::releasePlatCollisions() { mPlatMgr.release(); } /* * --INFO-- @@ -3532,46 +3029,6 @@ void BTeki::spawnTeki(int) */ } -/* - * --INFO-- - * Address: 80146990 - * Size: 00001C - * Should be weak. - */ -void BTeki::getPersonalityF(int) -{ - /* - .loc_0x0: - lwz r3, 0x2C8(r3) - rlwinm r0,r4,2,0,29 - lwz r3, 0x34(r3) - lwz r3, 0x4(r3) - lwz r3, 0x0(r3) - lfsx f1, r3, r0 - blr - */ -} - -/* - * --INFO-- - * Address: 801469AC - * Size: 00001C - * Should be weak. - */ -void BTeki::getParameterF(int) -{ - /* - .loc_0x0: - lwz r3, 0x2C4(r3) - rlwinm r0,r4,2,0,29 - lwz r3, 0x84(r3) - lwz r3, 0x4(r3) - lwz r3, 0x0(r3) - lfsx f1, r3, r0 - blr - */ -} - /* * --INFO-- * Address: 80146A10 @@ -6320,23 +5777,7 @@ void BTeki::getGravity() * Address: 80148934 * Size: 00002C */ -void BTeki::getStrategy() -{ - /* - .loc_0x0: - mflr r0 - mr r4, r3 - stw r0, 0x4(r1) - stwu r1, -0x8(r1) - lwz r3, 0x3160(r13) - lwz r4, 0x320(r4) - bl 0x23CC - lwz r0, 0xC(r1) - addi r1, r1, 0x8 - mtlr r0 - blr - */ -} +TekiStrategy* BTeki::getStrategy() { return tekiMgr->getStrategy(mTekiType); } /* * --INFO-- diff --git a/src/plugPikiNakata/tekiparameters.cpp b/src/plugPikiNakata/tekiparameters.cpp index fcf55dbe..d4cd1558 100644 --- a/src/plugPikiNakata/tekiparameters.cpp +++ b/src/plugPikiNakata/tekiparameters.cpp @@ -38,13 +38,13 @@ TekiParameters::TekiParameters(int iParamNum, int fParamNum) ParaParameterInfoF* f32Params = new ParaParameterInfoF[fParamNum]; // set all these params somehow - mParameters = new ParaMultiParameters(iParamNum, intParams, fParamNum, f32Params); - ParaMultiParameters* multiP = mParameters; - multiP->mIntParams->mParameters[3] = -1; - multiP->mFloatParams->mParameters[20] = 10.0f; - multiP->mFloatParams->mParameters[21] = 10.0f; - multiP->mFloatParams->mParameters[28] = 1000.0f; - multiP->mFloatParams->mParameters[44] = 16.0f; + mParameters = new ParaMultiParameters(iParamNum, intParams, fParamNum, f32Params); + ParaMultiParameters* multiP = mParameters; + multiP->mIntParams->mParameters[TPI_SpawnType] = -1; + multiP->mFloatParams->mParameters[TPF_CorpseSize] = 10.0f; + multiP->mFloatParams->mParameters[TPF_CorpseHeight] = 10.0f; + multiP->mFloatParams->mParameters[TPF_VisibleHeight] = 1000.0f; + multiP->mFloatParams->mParameters[TPF_CollisionRadius] = 16.0f; /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAIbeatle.cpp b/src/plugPikiYamashita/TAIbeatle.cpp index 3b403e6e..7bad77f1 100644 --- a/src/plugPikiYamashita/TAIbeatle.cpp +++ b/src/plugPikiYamashita/TAIbeatle.cpp @@ -78,7 +78,7 @@ TAIbeatleSoundTable::TAIbeatleSoundTable() * Size: 000418 */ TAIbeatleParameters::TAIbeatleParameters() - : TekiParameters(0, 0) // TODO: members + : TekiParameters(20, 55) { /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAIdororo.cpp b/src/plugPikiYamashita/TAIdororo.cpp index 81af2020..624b4e15 100644 --- a/src/plugPikiYamashita/TAIdororo.cpp +++ b/src/plugPikiYamashita/TAIdororo.cpp @@ -253,7 +253,7 @@ TAIdororoSoundTable::TAIdororoSoundTable() * Size: 0003C0 */ TAIdororoParameters::TAIdororoParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(21, 55) { /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAIhibaA.cpp b/src/plugPikiYamashita/TAIhibaA.cpp index 5e607853..7de7b555 100644 --- a/src/plugPikiYamashita/TAIhibaA.cpp +++ b/src/plugPikiYamashita/TAIhibaA.cpp @@ -78,7 +78,7 @@ TAIhibaASoundTable::TAIhibaASoundTable() * Size: 0002F8 */ TAIhibaAParameters::TAIhibaAParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 52) { /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAIkabekuiA.cpp b/src/plugPikiYamashita/TAIkabekuiA.cpp index fa123726..b6bb95d0 100644 --- a/src/plugPikiYamashita/TAIkabekuiA.cpp +++ b/src/plugPikiYamashita/TAIkabekuiA.cpp @@ -40,7 +40,7 @@ TAIkabekuiASoundTable::TAIkabekuiASoundTable() * Size: 00036C */ TAIkabekuiAParameters::TAIkabekuiAParameters() - : TekiParameters(20, 54) // TODO: fix + : TekiParameters(20, 54) { /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAIkabekuiB.cpp b/src/plugPikiYamashita/TAIkabekuiB.cpp index cf15b0e5..210fd54f 100644 --- a/src/plugPikiYamashita/TAIkabekuiB.cpp +++ b/src/plugPikiYamashita/TAIkabekuiB.cpp @@ -78,7 +78,7 @@ TAIkabekuiBSoundTable::TAIkabekuiBSoundTable() * Size: 0003C0 */ TAIkabekuiBParameters::TAIkabekuiBParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 56) { /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAIkabekuiC.cpp b/src/plugPikiYamashita/TAIkabekuiC.cpp index 5fa6350b..c7bd4bd4 100644 --- a/src/plugPikiYamashita/TAIkabekuiC.cpp +++ b/src/plugPikiYamashita/TAIkabekuiC.cpp @@ -78,7 +78,7 @@ TAIkabekuiCSoundTable::TAIkabekuiCSoundTable() * Size: 000478 */ TAIkabekuiCParameters::TAIkabekuiCParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 60) { /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAImar.cpp b/src/plugPikiYamashita/TAImar.cpp index ce0cafaa..57b54ea8 100644 --- a/src/plugPikiYamashita/TAImar.cpp +++ b/src/plugPikiYamashita/TAImar.cpp @@ -78,7 +78,7 @@ TAImarSoundTable::TAImarSoundTable() * Size: 000440 */ TAImarParameters::TAImarParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(23, 57) { /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAImiurin.cpp b/src/plugPikiYamashita/TAImiurin.cpp index 277f8dc3..a53c0371 100644 --- a/src/plugPikiYamashita/TAImiurin.cpp +++ b/src/plugPikiYamashita/TAImiurin.cpp @@ -79,7 +79,7 @@ TAImiurinSoundTable::TAImiurinSoundTable() * Size: 000404 */ TAImiurinParameters::TAImiurinParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(23, 54) { /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAIotama.cpp b/src/plugPikiYamashita/TAIotama.cpp index f1ba84e1..7a35adbd 100644 --- a/src/plugPikiYamashita/TAIotama.cpp +++ b/src/plugPikiYamashita/TAIotama.cpp @@ -78,7 +78,7 @@ TAIotamaSoundTable::TAIotamaSoundTable() * Size: 00033C */ TAIotamaParameters::TAIotamaParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 52) { /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAItamago.cpp b/src/plugPikiYamashita/TAItamago.cpp index 8652cb6a..524919cc 100644 --- a/src/plugPikiYamashita/TAItamago.cpp +++ b/src/plugPikiYamashita/TAItamago.cpp @@ -79,7 +79,7 @@ TAItamagoSoundTable::TAItamagoSoundTable() * Size: 0002F4 */ TAItamagoParameters::TAItamagoParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 52) { /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAItank.cpp b/src/plugPikiYamashita/TAItank.cpp index 78f96db7..de142b69 100644 --- a/src/plugPikiYamashita/TAItank.cpp +++ b/src/plugPikiYamashita/TAItank.cpp @@ -79,7 +79,7 @@ TAItankSoundTable::TAItankSoundTable() * Size: 000364 */ TAItankParameters::TAItankParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 54) { /* .loc_0x0: diff --git a/src/plugPikiYamashita/TAIusuba.cpp b/src/plugPikiYamashita/TAIusuba.cpp index 36f1a2ea..60474c3f 100644 --- a/src/plugPikiYamashita/TAIusuba.cpp +++ b/src/plugPikiYamashita/TAIusuba.cpp @@ -37,8 +37,9 @@ TAIusubaSoundTable::TAIusubaSoundTable() * Size: 000294 */ TAIusubaParameters::TAIusubaParameters() - : TekiParameters(0, 0) // TODO: fix + : TekiParameters(20, 50) { + /* .loc_0x0: mflr r0 diff --git a/src/plugPikiYamashita/effectMgr.cpp b/src/plugPikiYamashita/effectMgr.cpp index 4fc64c03..7bdf9834 100644 --- a/src/plugPikiYamashita/effectMgr.cpp +++ b/src/plugPikiYamashita/effectMgr.cpp @@ -1272,8 +1272,8 @@ void EffectMgr::exit() * Address: 8019CB38 * Size: 000044 */ -void EffectMgr::create(EffectMgr::effTypeTable, Vector3f&, zen::CallBack1*, - zen::CallBack2*) +zen::particleGenerator* EffectMgr::create(EffectMgr::effTypeTable, Vector3f&, zen::CallBack1*, + zen::CallBack2*) { /* .loc_0x0: @@ -1331,7 +1331,7 @@ void EffectParticleRegistration::create(Vector3f&, zen::CallBack1*) +zen::particleGenerator* EffectMgr::create(EffectMgr::simpleTypeTable, Vector3f&, s16, Vector3f&, Vector3f&, f32, f32, + zen::CallBack1*) { // UNUSED FUNCTION } diff --git a/src/plugPikiYamashita/gameCourseClear.cpp b/src/plugPikiYamashita/gameCourseClear.cpp index fb1771d3..493e5e9a 100644 --- a/src/plugPikiYamashita/gameCourseClear.cpp +++ b/src/plugPikiYamashita/gameCourseClear.cpp @@ -1274,30 +1274,6 @@ zen::particleMdlManager::~particleMdlManager() // UNUSED FUNCTION } -/* - * --INFO-- - * Address: 8019A458 - * Size: 000030 - */ -zen::zenListManager::zenListManager() -{ - /* - .loc_0x0: - lis r4, 0x802D - addi r0, r4, 0x68DC - stw r0, 0x4(r3) - addi r0, r3, 0x4 - stw r0, 0xC(r3) - stw r0, 0x8(r3) - stw r0, 0x0(r3) - lwz r5, 0x0(r3) - stw r5, 0x8(r5) - lwz r4, 0x0(r3) - stw r5, 0x4(r4) - blr - */ -} - /* * --INFO-- * Address: ........ diff --git a/src/plugPikiYamashita/particleGenerator.cpp b/src/plugPikiYamashita/particleGenerator.cpp index 00b9f5f5..bedc55c6 100644 --- a/src/plugPikiYamashita/particleGenerator.cpp +++ b/src/plugPikiYamashita/particleGenerator.cpp @@ -4898,41 +4898,6 @@ void zen::particleGenerator::pmGetParticle() */ } -/* - * --INFO-- - * Address: 801A0E5C - * Size: 000054 - */ -void zen::zenListManager::get() -{ - /* - .loc_0x0: - mflr r0 - stw r0, 0x4(r1) - stwu r1, -0x18(r1) - stw r31, 0x14(r1) - li r31, 0 - lwz r3, 0x0(r3) - lwz r0, 0x8(r3) - cmplw r3, r0 - beq- .loc_0x3C - mr r31, r0 - addi r3, r31, 0 - lwz r12, 0x0(r31) - lwz r12, 0xC(r12) - mtlr r12 - blrl - - .loc_0x3C: - mr r3, r31 - lwz r0, 0x1C(r1) - lwz r31, 0x14(r1) - addi r1, r1, 0x18 - mtlr r0 - blr - */ -} - /* * --INFO-- * Address: 801A0EB0 diff --git a/src/sysCommon/shapeBase.cpp b/src/sysCommon/shapeBase.cpp index 07b8f056..f742e5e2 100644 --- a/src/sysCommon/shapeBase.cpp +++ b/src/sysCommon/shapeBase.cpp @@ -6442,8 +6442,8 @@ BaseShape::BaseShape() _68 = 0; _74 = 0; - _18 = 0; - _24 = 0; + _18 = 0; + mFrameCacher = nullptr; mCollisionInfo.initCore(""); mLightGroup.initCore("");