diff --git a/include/Game/Entities/SnakeCrow.h b/include/Game/Entities/SnakeCrow.h index d9edb1fab..37530fba7 100644 --- a/include/Game/Entities/SnakeCrow.h +++ b/include/Game/Entities/SnakeCrow.h @@ -41,6 +41,20 @@ struct SnakeCrowShadowMgr; struct FSM; struct Parms; +enum StateID { + SNAKECROW_NULL = -1, + SNAKECROW_Dead = 0, + SNAKECROW_Stay = 1, + SNAKECROW_Appear1 = 2, + SNAKECROW_Appear2 = 3, + SNAKECROW_Disappear = 4, + SNAKECROW_Wait = 5, + SNAKECROW_Attack = 6, + SNAKECROW_Eat = 7, + SNAKECROW_Struggle = 8, + SNAKECROW_Count, // 9 +}; + struct Obj : public EnemyBase { Obj(); @@ -60,11 +74,11 @@ struct Obj : public EnemyBase { virtual void doAnimationUpdateAnimator(); // _1D8 virtual void doAnimationCullingOff(); // _1DC virtual void doDebugDraw(Graphics& gfx); // _1EC - virtual void getCommonEffectPos(Vector3f&); // _204 + virtual void getCommonEffectPos(Vector3f& fxPos); // _204 virtual void setParameters(); // _228 virtual void initMouthSlots(); // _22C virtual void createEfxHamon(); // _250 - virtual void getThrowupItemPosition(Vector3f*); // _268 + virtual void getThrowupItemPosition(Vector3f* itemPos); // _268 virtual bool damageCallBack(Creature* source, f32 damage, CollPart* part); // _278 virtual void doStartStoneState(); // _2A4 virtual void doFinishStoneState(); // _2A8 @@ -83,8 +97,8 @@ struct Obj : public EnemyBase { void appearNearByTarget(Creature*); void setAttackPosition(); - Piki* getAttackPiki(int); - Navi* getAttackNavi(int); + Piki* getAttackPiki(int animIdx); + Navi* getAttackNavi(int animIdx); CollPart* getSwallowSlot(); // might be MouthSlot* or something else bool isSwallowPikmin(); int getStickHeadPikmin(); @@ -110,14 +124,14 @@ struct Obj : public EnemyBase { void setBossAppearBGM(); void createEffect(); void setupEffect(); - void createAppearEffect(int); + void createAppearEffect(int appearIdx); void startRotateEffect(); void finishRotateEffect(); void startWaitEffect(); void finishWaitEffect(); void createDeadStartEffect(); void createDeadFinishEffect(); - void createDownHeadEffect(f32); + void createDownHeadEffect(f32 scale); void effectDrawOn(); void effectDrawOff(); @@ -125,20 +139,21 @@ struct Obj : public EnemyBase { // _00 = VTBL // _00-_2BC = EnemyBase - FSM* mFsm; // _2BC - bool mIsUnderground; // _2C0 - u8 _2C1; // _2C1 - u8 _2C2; // _2C2 - f32 mStateTimer; // _2C4 - int _2C8; // _2C8, unknown - MouthSlots mMouthSlots; // _2CC - int _2D4; // _2D4, animation index maybe? - Vector3f _2D8[5]; // _2D8 - u8 _314[0x8]; // _314, unknown - efx::THebiRot* mEfxRotate; // _31C - efx::THebiWait* mEfxWait; // _320 - efx::THebiDead* mEfxDead; // _324 - // _328 = PelletView + FSM* mFsm; // _2BC + bool mIsUnderground; // _2C0 + u8 _2C1; // _2C1, BGM related + u8 _2C2; // _2C2, BGM related + f32 mStateTimer; // _2C4 + StateID mNextState; // _2C8, unused + MouthSlots mMouthSlots; // _2CC + int mAttackAnimIdx; // _2D4 + Vector3f mAttackPositions[5]; // _2D8, indexed by mAttackAnimIdx + SnakeJointMgr* mSnakeJointMgr; // _314 + SnakeCrowShadowMgr* mShadowMgr; // _318 + efx::THebiRot* mEfxRotate; // _31C + efx::THebiWait* mEfxWait; // _320 + efx::THebiDead* mEfxDead; // _324 + // _328 = PelletView }; struct Mgr : public EnemyMgrBase { @@ -209,23 +224,22 @@ struct ProperAnimator : public EnemyAnimatorBase { }; struct SnakeCrowShadowMgr { + SnakeCrowShadowMgr(Obj* obj); + + void init(); + void startJointShadow(); + void finishJointShadow(); + void update(); + + Matrixf* mMatrices[8]; // _00 + Obj* mOwner; // _20 + JointShadowRootNode* mRootNode; // _24 + SnakeCrowTubeShadowNode* mTubeNodes[8]; // _28 + SnakeCrowSphereShadowNode* mSphereNodes[8]; // _48 }; ///////////////////////////////////////////////////////////////// // STATE MACHINE DEFINITIONS -enum StateID { - SNAKECROW_Dead = 0, - SNAKECROW_Stay = 1, - SNAKECROW_Appear1 = 2, - SNAKECROW_Appear2 = 3, - SNAKECROW_Disappear = 4, - SNAKECROW_Wait = 5, - SNAKECROW_Attack = 6, - SNAKECROW_Eat = 7, - SNAKECROW_Struggle = 8, - SNAKECROW_Count, -}; - struct FSM : public EnemyStateMachine { virtual void init(EnemyBase*); // _08 diff --git a/include/Game/Entities/SnakeWhole.h b/include/Game/Entities/SnakeWhole.h index bec2db059..6bbecc948 100644 --- a/include/Game/Entities/SnakeWhole.h +++ b/include/Game/Entities/SnakeWhole.h @@ -9,6 +9,7 @@ #include "Game/EnemyBase.h" #include "Game/SnakeJointMgr.h" #include "SysShape/Joint.h" +#include "efx/TCphebi.h" #include "Collinfo.h" /** @@ -16,10 +17,6 @@ * Note: Separate header for Burrowing Snagret (SnakeCrow) */ -namespace efx { -struct TChaseMtx4; -} // namespace efx - namespace Game { struct SnakeWholeSphereShadowNode : public JointShadowNode { virtual ~SnakeWholeSphereShadowNode(); // _08 (weak) @@ -82,7 +79,7 @@ struct Obj : public EnemyBase { virtual void createEfxHamon(); // _250 virtual EnemyTypeID::EEnemyTypeID getEnemyTypeID(); // _258 (weak) virtual MouthSlots* getMouthSlots(); // _25C (weak) - virtual void getThrowupItemPosition(Vector3f*); // _268 + virtual void getThrowupItemPosition(Vector3f* itemPos); // _268 virtual void throwupItemInDeathProcedure(); // _270 (weak) virtual bool damageCallBack(Creature* source, f32 damage, CollPart* part); // _278 virtual void doStartStoneState(); // _2A4 @@ -100,10 +97,10 @@ struct Obj : public EnemyBase { void setJumpMove(Vector3f&); void updateFace(); void updateConstraint(); - void appearNearByTarget(Creature*); + void appearNearByTarget(Creature* target); void setAttackPosition(); - Piki* getAttackPiki(int); - Navi* getAttackNavi(int); + Piki* getAttackPiki(int animIdx); + Navi* getAttackNavi(int animIdx); Creature* getSearchedTarget(); CollPart* getSwallowSlot(); bool isSwallowPikmin(); @@ -130,7 +127,7 @@ struct Obj : public EnemyBase { void setBossAppearBGM(); void createEffect(); void setupEffect(); - void createAppearEffect(int); + void createAppearEffect(int appearIdx); void createDeadStartEffect(); void createDeadFinishEffect(); void createWalkSmokeEffect(f32); @@ -149,11 +146,11 @@ struct Obj : public EnemyBase { StateID mNextState; // _2CC MouthSlots mMouthSlots; // _2D0 Vector3f _2D8; // _2D8 - int _2E4; // _2E4 - Vector3f _2E8[5]; // _2E8 - SnakeJointMgr* mJointMgr; // _324 + int mAttackAnimIdx; // _2E4 + Vector3f mAttackPositions[5]; // _2E8 + SnakeJointMgr* mSnakeJointMgr; // _324 SnakeWholeShadowMgr* mShadowMgr; // _328 - efx::TChaseMtx4* _32C; // _32C + efx::TCphebiDead* mEfxDead; // _32C // _330 = PelletView }; @@ -185,17 +182,17 @@ struct Parms : public EnemyParmsBase { struct ProperParms : public Parameters { inline ProperParms() : Parameters(nullptr, "EnemyParmsBase") - , mFp01(this, 'fp01', "通常出現率", 0.8f, 0.0f, 1.0f) // 'normal appearance rate' - , mFp11(this, 'fp11', "潜る迄の時間", 2.0f, 0.0f, 10.0f) // 'time to dive' - , mFp12(this, 'fp12', "地中での時間", 1.0f, 0.0f, 10.0f) // 'time in the ground' + , mFastAppearChance(this, 'fp01', "通常出現率", 0.8f, 0.0f, 1.0f) // 'normal appearance rate' + , mWaitTime(this, 'fp11', "潜る迄の時間", 2.0f, 0.0f, 10.0f) // 'time to dive' + , mUndergroundTime(this, 'fp12', "地中での時間", 1.0f, 0.0f, 10.0f) // 'time in the ground' , mPoisonDamage(this, 'fp21', "白ピクミン", 300.0f, 0.0f, 10000.0f) // 'white pikmin' { } - Parm mFp01; // _804 - Parm mFp11; // _82C - Parm mFp12; // _854 - Parm mPoisonDamage; // _87C, fp21 + Parm mFastAppearChance; // _804, fp01 + Parm mWaitTime; // _82C, fp11 + Parm mUndergroundTime; // _854, fp12 + Parm mPoisonDamage; // _87C, fp21 }; Parms() { } @@ -223,6 +220,18 @@ struct ProperAnimator : public EnemyAnimatorBase { }; struct SnakeWholeShadowMgr { + SnakeWholeShadowMgr(Obj* obj); + + void init(); + void startJointShadow(); + void finishJointShadow(); + void update(); + + Matrixf* mMatrices[9]; // _00 + Obj* mOwner; // _24 + JointShadowRootNode* mRootNode; // _28 + SnakeWholeTubeShadowNode* mTubeNodes[9]; // _2C + SnakeWholeSphereShadowNode* mSphereNodes[9]; // _50 }; ///////////////////////////////////////////////////////////////// diff --git a/include/Game/SnakeJointMgr.h b/include/Game/SnakeJointMgr.h index f913d70c2..c7105dd9a 100644 --- a/include/Game/SnakeJointMgr.h +++ b/include/Game/SnakeJointMgr.h @@ -6,6 +6,19 @@ namespace Game { struct SnakeJointMgr { + SnakeJointMgr(EnemyBase* enemy); + + void setupCallBackJoint(); + void startModify(f32, f32); + void returnModify(f32); + void finishModify(); + void doAnimation(); + void finishAnimation(); + void makeMatrix(); + + // unused/inlined + void init(); + EnemyBase* mObj; // _00, SnakeCrow obj or SnakeWhole obj u32 _04; // _04, unknown u32 _08; // _08, unknown diff --git a/src/plugProjectNishimuraU/SnakeCrow.cpp b/src/plugProjectNishimuraU/SnakeCrow.cpp index 81c69fd7b..26497f558 100644 --- a/src/plugProjectNishimuraU/SnakeCrow.cpp +++ b/src/plugProjectNishimuraU/SnakeCrow.cpp @@ -3,9 +3,12 @@ #include "Game/MapMgr.h" #include "Game/PikiMgr.h" #include "Game/Navi.h" +#include "Game/Stickers.h" #include "Game/SingleGameSection.h" #include "Game/CameraMgr.h" #include "Game/rumble.h" +#include "PSM/EnemyBoss.h" +#include "PSSystem/PSMainSide_ObjSound.h" #include "Dolphin/rand.h" #include "nans.h" @@ -63,8 +66,8 @@ void Obj::onInit(CreatureInitArg* initArg) shadowMgr->delNormalShadow(this); mIsUnderground = true; mStateTimer = 0.0f; - _2C8 = -1; - _2D4 = -1; + mNextState = SNAKECROW_NULL; + mAttackAnimIdx = -1; setupJointCallBack(); setupCollision(); setupShadowSystem(); @@ -331,12 +334,12 @@ void Obj::setAttackPosition() f32 array2[5] = { 0.0f, 0.0f, 0.0f, 80.0f, -80.0f }; for (int i = 0; i < 5; i++) { - f32 dirFactor = array1[i]; - f32 orthoDirFactor = array2[i]; - _2D8[i] = mPosition; - _2D8[i] += dir * dirFactor; - _2D8[i] += orthoDir * orthoDirFactor; - _2D8[i].y = mapMgr->getMinY(_2D8[i]); + f32 dirFactor = array1[i]; + f32 orthoDirFactor = array2[i]; + mAttackPositions[i] = mPosition; + mAttackPositions[i] += dir * dirFactor; + mAttackPositions[i] += orthoDir * orthoDirFactor; + mAttackPositions[i].y = mapMgr->getMinY(mAttackPositions[i]); } /* stwu r1, -0x90(r1) @@ -1325,42 +1328,15 @@ Navi* Obj::getAttackNavi(int) */ CollPart* Obj::getSwallowSlot() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - li r31, 0 - stw r30, 8(r1) - mr r30, r3 - b lbl_80294A38 - -lbl_80294A18: - mr r4, r31 - addi r3, r30, 0x2cc - bl getSlot__10MouthSlotsFi - lwz r0, 0x64(r3) - cmplwi r0, 0 - bne lbl_80294A34 - b lbl_80294A48 - -lbl_80294A34: - addi r31, r31, 1 - -lbl_80294A38: - lwz r0, 0x2cc(r30) - cmpw r31, r0 - blt lbl_80294A18 - li r3, 0 + for (int i = 0; i < mMouthSlots.getMax(); i++) { + MouthCollPart* slot = mMouthSlots.getSlot(i); + if (slot->mStuckCreature) { + continue; + } + return slot; + } -lbl_80294A48: - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + return nullptr; } /* @@ -1370,43 +1346,15 @@ CollPart* Obj::getSwallowSlot() */ bool Obj::isSwallowPikmin() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - li r31, 0 - stw r30, 8(r1) - mr r30, r3 - b lbl_80294AA4 - -lbl_80294A80: - mr r4, r31 - addi r3, r30, 0x2cc - bl getSlot__10MouthSlotsFi - lwz r0, 0x64(r3) - cmplwi r0, 0 - beq lbl_80294AA0 - li r3, 1 - b lbl_80294AB4 - -lbl_80294AA0: - addi r31, r31, 1 - -lbl_80294AA4: - lwz r0, 0x2cc(r30) - cmpw r31, r0 - blt lbl_80294A80 - li r3, 0 + for (int i = 0; i < mMouthSlots.getMax(); i++) { + MouthCollPart* slot = mMouthSlots.getSlot(i); + if (!slot->mStuckCreature) { + continue; + } + return true; + } -lbl_80294AB4: - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + return false; } /* @@ -1416,173 +1364,18 @@ bool Obj::isSwallowPikmin() */ int Obj::getStickHeadPikmin() { - /* - stwu r1, -0x40(r1) - mflr r0 - mr r4, r3 - stw r0, 0x44(r1) - addi r3, r1, 0x18 - stw r31, 0x3c(r1) - li r31, 0 - stw r30, 0x38(r1) - bl __ct__Q24Game8StickersFPQ24Game8Creature - li r0, 0 - lis r3, "__vt__26Iterator"@ha - addi r4, r3, "__vt__26Iterator"@l - addi r3, r1, 0x18 - cmplwi r0, 0 - stw r4, 8(r1) - stw r0, 0x14(r1) - stw r0, 0xc(r1) - stw r3, 0x10(r1) - bne lbl_80294B30 - lwz r12, 0(r3) - lwz r12, 0x18(r12) - mtctr r12 - bctrl - stw r3, 0xc(r1) - b lbl_80294CD0 - -lbl_80294B30: - lwz r12, 0(r3) - lwz r12, 0x18(r12) - mtctr r12 - bctrl - stw r3, 0xc(r1) - b lbl_80294B9C - -lbl_80294B48: - lwz r3, 0x10(r1) - lwz r4, 0xc(r1) - lwz r12, 0(r3) - lwz r12, 0x20(r12) - mtctr r12 - bctrl - mr r4, r3 - lwz r3, 0x14(r1) - lwz r12, 0(r3) - lwz r12, 8(r12) - mtctr r12 - bctrl - clrlwi. r0, r3, 0x18 - bne lbl_80294CD0 - lwz r3, 0x10(r1) - lwz r4, 0xc(r1) - lwz r12, 0(r3) - lwz r12, 0x14(r12) - mtctr r12 - bctrl - stw r3, 0xc(r1) - -lbl_80294B9C: - lwz r12, 8(r1) - addi r3, r1, 8 - lwz r12, 0x10(r12) - mtctr r12 - bctrl - clrlwi. r0, r3, 0x18 - beq lbl_80294B48 - b lbl_80294CD0 - -lbl_80294BBC: - lwz r3, 0x10(r1) - lwz r12, 0(r3) - lwz r12, 0x20(r12) - mtctr r12 - bctrl - lwz r12, 0(r3) - mr r30, r3 - lwz r12, 0xa8(r12) - mtctr r12 - bctrl - clrlwi. r0, r3, 0x18 - beq lbl_80294C14 - lwz r3, 0xf8(r30) - cmplwi r3, 0 - beq lbl_80294C14 - lis r4, 0x68656164@ha - addi r3, r3, 0x30 - addi r4, r4, 0x68656164@l - bl __eq__4ID32FUl - clrlwi. r0, r3, 0x18 - beq lbl_80294C14 - addi r31, r31, 1 - -lbl_80294C14: - lwz r0, 0x14(r1) - cmplwi r0, 0 - bne lbl_80294C40 - lwz r3, 0x10(r1) - lwz r4, 0xc(r1) - lwz r12, 0(r3) - lwz r12, 0x14(r12) - mtctr r12 - bctrl - stw r3, 0xc(r1) - b lbl_80294CD0 - -lbl_80294C40: - lwz r3, 0x10(r1) - lwz r4, 0xc(r1) - lwz r12, 0(r3) - lwz r12, 0x14(r12) - mtctr r12 - bctrl - stw r3, 0xc(r1) - b lbl_80294CB4 - -lbl_80294C60: - lwz r3, 0x10(r1) - lwz r4, 0xc(r1) - lwz r12, 0(r3) - lwz r12, 0x20(r12) - mtctr r12 - bctrl - mr r4, r3 - lwz r3, 0x14(r1) - lwz r12, 0(r3) - lwz r12, 8(r12) - mtctr r12 - bctrl - clrlwi. r0, r3, 0x18 - bne lbl_80294CD0 - lwz r3, 0x10(r1) - lwz r4, 0xc(r1) - lwz r12, 0(r3) - lwz r12, 0x14(r12) - mtctr r12 - bctrl - stw r3, 0xc(r1) - -lbl_80294CB4: - lwz r12, 8(r1) - addi r3, r1, 8 - lwz r12, 0x10(r12) - mtctr r12 - bctrl - clrlwi. r0, r3, 0x18 - beq lbl_80294C60 + int stickCount = 0; + Stickers stickers(this); + Iterator iter(&stickers); + CI_LOOP(iter) + { + Creature* piki = *iter; + if (piki->isAlive() && piki->mStuckCollPart && piki->mStuckCollPart->mCurrentID == 'head') { + stickCount++; + } + } -lbl_80294CD0: - lwz r3, 0x10(r1) - lwz r12, 0(r3) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - lwz r4, 0xc(r1) - cmplw r4, r3 - bne lbl_80294BBC - addi r3, r1, 0x18 - li r4, -1 - bl __dt__Q24Game8StickersFv - lwz r0, 0x44(r1) - mr r3, r31 - lwz r31, 0x3c(r1) - lwz r30, 0x38(r1) - mtlr r0 - addi r1, r1, 0x40 - blr - */ + return stickCount; } /* @@ -1590,91 +1383,28 @@ int Obj::getStickHeadPikmin() * Address: 80294D18 * Size: 000048 */ -void Obj::createJointCallBack() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - li r3, 0x30 - bl __nw__FUl - or. r0, r3, r3 - beq lbl_80294D48 - mr r4, r31 - bl __ct__Q24Game13SnakeJointMgrFPQ24Game9EnemyBase - mr r0, r3 - -lbl_80294D48: - stw r0, 0x314(r31) - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::createJointCallBack() { mSnakeJointMgr = new SnakeJointMgr(this); } /* * --INFO-- * Address: 80294D60 * Size: 000024 */ -void Obj::setupJointCallBack() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - lwz r3, 0x314(r3) - bl setupCallBackJoint__Q24Game13SnakeJointMgrFv - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::setupJointCallBack() { mSnakeJointMgr->setupCallBackJoint(); } /* * --INFO-- * Address: 80294D84 * Size: 000024 */ -void Obj::doAnimationJointCallBack() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - lwz r3, 0x314(r3) - bl doAnimation__Q24Game13SnakeJointMgrFv - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::doAnimationJointCallBack() { mSnakeJointMgr->doAnimation(); } /* * --INFO-- * Address: 80294DA8 * Size: 000024 */ -void Obj::finishAnimationJointCallBack() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - lwz r3, 0x314(r3) - bl finishAnimation__Q24Game13SnakeJointMgrFv - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::finishAnimationJointCallBack() { mSnakeJointMgr->finishAnimation(); } /* * --INFO-- @@ -1683,54 +1413,10 @@ void Obj::finishAnimationJointCallBack() */ void Obj::startJointCallBack() { - /* - stwu r1, -0x30(r1) - mflr r0 - stw r0, 0x34(r1) - stfd f31, 0x20(r1) - psq_st f31, 40(r1), 0, qr0 - stw r31, 0x1c(r1) - stw r30, 0x18(r1) - mr r30, r3 - lwz r0, 0x2d4(r3) - lwz r3, 0x184(r3) - mulli r0, r0, 0xc - lfs f0, 0x190(r30) - lwz r12, 0(r3) - add r4, r30, r0 - lwz r12, 0x10(r12) - lfs f1, 0x2dc(r4) - fsubs f31, f1, f0 - mtctr r12 - bctrl - lwz r3, 0xc(r3) - li r4, 3 - bl getAnimKeyByType__Q28SysShape8AnimInfoFUl - mr r31, r3 - mr r3, r30 - bl getMotionFrame__Q24Game9EnemyBaseFv - lwz r3, 0x18(r31) - lis r0, 0x4330 - fmr f3, f1 - stw r0, 8(r1) - xoris r0, r3, 0x8000 - lfd f2, lbl_8051BAD0@sda21(r2) - stw r0, 0xc(r1) - fmr f1, f31 - lfd f0, 8(r1) - lwz r3, 0x314(r30) - fsubs f0, f0, f2 - fsubs f2, f0, f3 - bl startModify__Q24Game13SnakeJointMgrFff - psq_l f31, 40(r1), 0, qr0 - lwz r0, 0x34(r1) - lfd f31, 0x20(r1) - lwz r31, 0x1c(r1) - lwz r30, 0x18(r1) - mtlr r0 - addi r1, r1, 0x30 - blr - */ + f32 y = mAttackPositions[mAttackAnimIdx].y - mPosition.y; + SysShape::KeyEvent* event = mAnimator->getAnimator().mAnimInfo->getAnimKeyByType(3); + f32 frame = getMotionFrame(); + mSnakeJointMgr->startModify(y, (f32)event->mFrame - frame); } /* @@ -1740,42 +1426,9 @@ void Obj::startJointCallBack() */ void Obj::returnJointCallBack() { - /* - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - stw r31, 0x1c(r1) - stw r30, 0x18(r1) - mr r30, r3 - lwz r3, 0x184(r3) - lwz r12, 0(r3) - lwz r12, 0x10(r12) - mtctr r12 - bctrl - lwz r3, 0xc(r3) - li r4, 4 - bl getAnimKeyByType__Q28SysShape8AnimInfoFUl - mr r31, r3 - mr r3, r30 - bl getMotionFrame__Q24Game9EnemyBaseFv - lwz r3, 0x18(r31) - lis r0, 0x4330 - stw r0, 8(r1) - xoris r0, r3, 0x8000 - lfd f2, lbl_8051BAD0@sda21(r2) - stw r0, 0xc(r1) - lwz r3, 0x314(r30) - lfd f0, 8(r1) - fsubs f0, f0, f2 - fsubs f1, f0, f1 - bl returnModify__Q24Game13SnakeJointMgrFf - lwz r0, 0x24(r1) - lwz r31, 0x1c(r1) - lwz r30, 0x18(r1) - mtlr r0 - addi r1, r1, 0x20 - blr - */ + SysShape::KeyEvent* event = mAnimator->getAnimator().mAnimInfo->getAnimKeyByType(4); + f32 frame = getMotionFrame(); + mSnakeJointMgr->returnModify((f32)event->mFrame - frame); } /* @@ -1783,20 +1436,7 @@ void Obj::returnJointCallBack() * Address: 80294F0C * Size: 000024 */ -void Obj::finishJointCallBack() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - lwz r3, 0x314(r3) - bl finishModify__Q24Game13SnakeJointMgrFv - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::finishJointCallBack() { mSnakeJointMgr->finishModify(); } /* * --INFO-- @@ -1805,24 +1445,10 @@ void Obj::finishJointCallBack() */ void Obj::setupCollision() { - /* - stwu r1, -0x10(r1) - mflr r0 - lis r4, 0x626F6431@ha - stw r0, 0x14(r1) - addi r4, r4, 0x626F6431@l - lwz r3, 0x114(r3) - bl getCollPart__8CollTreeFUl - cmplwi r3, 0 - beq lbl_80294F58 - bl makeTubeTree__8CollPartFv - -lbl_80294F58: - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + CollPart* part = mCollTree->getCollPart('bod1'); + if (part) { + part->makeTubeTree(); + } } /* @@ -1832,24 +1458,13 @@ void Obj::setupCollision() */ void Obj::lifeIncrement() { - /* - lfs f1, lbl_8051BA90@sda21(r2) - lfs f0, lbl_8051BAA8@sda21(r2) - stfs f1, 0x208(r3) - lwz r0, 0x1e0(r3) - rlwinm r0, r0, 0, 0x1f, 0x1d - stw r0, 0x1e0(r3) - lfs f1, 0x200(r3) - fadds f0, f1, f0 - stfs f0, 0x200(r3) - lwz r4, 0xc0(r3) - lfs f1, 0x200(r3) - lfs f0, 0x104(r4) - fcmpo cr0, f1, f0 - blelr - stfs f0, 0x200(r3) - blr - */ + mInstantDamage = 0.0f; + disableEvent(0, EB_TakingDamage); + mHealth += 10.0f; + + if (mHealth > *C_PARMS->mGeneral.mHealth()) { + mHealth = *C_PARMS->mGeneral.mHealth(); + } } /* @@ -1857,111 +1472,35 @@ void Obj::lifeIncrement() * Address: 80294FA8 * Size: 000048 */ -void Obj::createShadowSystem() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - li r3, 0x68 - bl __nw__FUl - or. r0, r3, r3 - beq lbl_80294FD8 - mr r4, r31 - bl __ct__Q34Game9SnakeCrow18SnakeCrowShadowMgrFPQ34Game9SnakeCrow3Obj - mr r0, r3 - -lbl_80294FD8: - stw r0, 0x318(r31) - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::createShadowSystem() { mShadowMgr = new SnakeCrowShadowMgr(this); } /* * --INFO-- * Address: 80294FF0 * Size: 000024 */ -void Obj::setupShadowSystem() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - lwz r3, 0x318(r3) - bl init__Q34Game9SnakeCrow18SnakeCrowShadowMgrFv - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::setupShadowSystem() { mShadowMgr->init(); } /* * --INFO-- * Address: 80295014 * Size: 000024 */ -void Obj::doAnimationShadowSystem() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - lwz r3, 0x318(r3) - bl update__Q34Game9SnakeCrow18SnakeCrowShadowMgrFv - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::doAnimationShadowSystem() { mShadowMgr->update(); } /* * --INFO-- * Address: 80295038 * Size: 000024 */ -void Obj::startJointShadow() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - lwz r3, 0x318(r3) - bl startJointShadow__Q34Game9SnakeCrow18SnakeCrowShadowMgrFv - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::startJointShadow() { mShadowMgr->startJointShadow(); } /* * --INFO-- * Address: 8029505C * Size: 000024 */ -void Obj::finishJointShadow() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - lwz r3, 0x318(r3) - bl finishJointShadow__Q34Game9SnakeCrow18SnakeCrowShadowMgrFv - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::finishJointShadow() { mShadowMgr->finishJointShadow(); } /* * --INFO-- @@ -1970,24 +1509,8 @@ void Obj::finishJointShadow() */ void Obj::deleteJointShadow() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - mr r4, r31 - lwz r3, shadowMgr__4Game@sda21(r13) - bl addNormalShadow__Q24Game9ShadowMgrFPQ24Game8Creature - lwz r3, shadowMgr__4Game@sda21(r13) - mr r4, r31 - bl delJointShadow__Q24Game9ShadowMgrFPQ24Game8Creature - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + shadowMgr->addNormalShadow(this); + shadowMgr->delJointShadow(this); } /* @@ -1997,74 +1520,13 @@ void Obj::deleteJointShadow() */ void Obj::startBossAttackBGM() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - stw r30, 8(r1) - lbz r0, 0x2c1(r3) - cmplwi r0, 0 - beq lbl_802950EC - li r0, 0 - stb r0, 0x2c1(r3) - b lbl_80295188 - -lbl_802950EC: - lwz r30, 0x28c(r3) - li r31, 0 - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 5 - beq lbl_80295148 - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 6 - beq lbl_80295148 - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 7 - bne lbl_8029514C - -lbl_80295148: - li r31, 1 - -lbl_8029514C: - clrlwi. r0, r31, 0x18 - bne lbl_80295170 - lis r3, lbl_80488894@ha - lis r5, lbl_804888AC@ha - addi r3, r3, lbl_80488894@l - li r4, 0x454 - addi r5, r5, lbl_804888AC@l - crclr 6 - bl panic_f__12JUTExceptionFPCciPCce - -lbl_80295170: - mr r3, r30 - li r4, 3 - lwz r12, 0x28(r30) - lwz r12, 0xd4(r12) - mtctr r12 - bctrl - -lbl_80295188: - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + if (_2C1) { + _2C1 = 0; + } else { + PSM::EnemyBoss* soundObj = static_cast(mSoundObj); + PSM::checkBoss(soundObj); + soundObj->jumpRequest(3); + } } /* @@ -2074,64 +1536,9 @@ void Obj::startBossAttackBGM() */ void Obj::startBossFlickBGM() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - li r31, 0 - stw r30, 8(r1) - lwz r30, 0x28c(r3) - lwz r12, 0x28(r30) - mr r3, r30 - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 5 - beq lbl_80295210 - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 6 - beq lbl_80295210 - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 7 - bne lbl_80295214 - -lbl_80295210: - li r31, 1 - -lbl_80295214: - clrlwi. r0, r31, 0x18 - bne lbl_80295238 - lis r3, lbl_80488894@ha - lis r5, lbl_804888AC@ha - addi r3, r3, lbl_80488894@l - li r4, 0x454 - addi r5, r5, lbl_804888AC@l - crclr 6 - bl panic_f__12JUTExceptionFPCciPCce - -lbl_80295238: - mr r3, r30 - li r4, 4 - lwz r12, 0x28(r30) - lwz r12, 0xd4(r12) - mtctr r12 - bctrl - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + PSM::EnemyBoss* soundObj = static_cast(mSoundObj); + PSM::checkBoss(soundObj); + soundObj->jumpRequest(4); } /* @@ -2141,81 +1548,13 @@ void Obj::startBossFlickBGM() */ void Obj::updateBossBGM() { - /* - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - stw r31, 0x1c(r1) - li r31, 0 - stw r30, 0x18(r1) - stw r29, 0x14(r1) - mr r29, r3 - lwz r30, 0x28c(r3) - lwz r12, 0x28(r30) - mr r3, r30 - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 5 - beq lbl_802952E0 - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 6 - beq lbl_802952E0 - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 7 - bne lbl_802952E4 - -lbl_802952E0: - li r31, 1 - -lbl_802952E4: - clrlwi. r0, r31, 0x18 - bne lbl_80295308 - lis r3, lbl_80488894@ha - lis r5, lbl_804888AC@ha - addi r3, r3, lbl_80488894@l - li r4, 0x454 - addi r5, r5, lbl_804888AC@l - crclr 6 - bl panic_f__12JUTExceptionFPCciPCce - -lbl_80295308: - lwz r0, 0x1f4(r29) - cmpwi r0, 0 - beq lbl_80295330 - mr r3, r30 - li r4, 1 - lwz r12, 0x28(r30) - lwz r12, 0xd8(r12) - mtctr r12 - bctrl - b lbl_80295348 - -lbl_80295330: - mr r3, r30 - li r4, 0 - lwz r12, 0x28(r30) - lwz r12, 0xd8(r12) - mtctr r12 - bctrl - -lbl_80295348: - lwz r0, 0x24(r1) - lwz r31, 0x1c(r1) - lwz r30, 0x18(r1) - lwz r29, 0x14(r1) - mtlr r0 - addi r1, r1, 0x20 - blr - */ + PSM::EnemyBoss* soundObj = static_cast(mSoundObj); + PSM::checkBoss(soundObj); + if (mStuckPikminCount != 0) { + soundObj->postPikiAttack(true); + } else { + soundObj->postPikiAttack(false); + } } /* @@ -2225,68 +1564,12 @@ void Obj::updateBossBGM() */ void Obj::resetBossAppearBGM() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - stw r30, 8(r1) - lbz r0, 0x2c2(r3) - cmplwi r0, 0 - bne lbl_8029541C - li r0, 1 - li r31, 0 - stb r0, 0x2c2(r3) - lwz r30, 0x28c(r3) - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 5 - beq lbl_802953E8 - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 6 - beq lbl_802953E8 - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 7 - bne lbl_802953EC - -lbl_802953E8: - li r31, 1 - -lbl_802953EC: - clrlwi. r0, r31, 0x18 - bne lbl_80295410 - lis r3, lbl_80488894@ha - lis r5, lbl_804888AC@ha - addi r3, r3, lbl_80488894@l - li r4, 0x454 - addi r5, r5, lbl_804888AC@l - crclr 6 - bl panic_f__12JUTExceptionFPCciPCce - -lbl_80295410: - mr r3, r30 - li r4, 0 - bl setAppearFlag__Q23PSM9EnemyBossFb - -lbl_8029541C: - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + if (!_2C2) { + _2C2 = 1; + PSM::EnemyBoss* soundObj = static_cast(mSoundObj); + PSM::checkBoss(soundObj); + soundObj->setAppearFlag(false); + } } /* @@ -2296,67 +1579,12 @@ void Obj::resetBossAppearBGM() */ void Obj::setBossAppearBGM() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - stw r30, 8(r1) - lbz r0, 0x2c2(r3) - cmplwi r0, 0 - beq lbl_802954E8 - li r31, 0 - stb r31, 0x2c2(r3) - lwz r30, 0x28c(r3) - lwz r12, 0x28(r30) - mr r3, r30 - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 5 - beq lbl_802954B4 - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 6 - beq lbl_802954B4 - mr r3, r30 - lwz r12, 0x28(r30) - lwz r12, 0x1c(r12) - mtctr r12 - bctrl - cmpwi r3, 7 - bne lbl_802954B8 - -lbl_802954B4: - li r31, 1 - -lbl_802954B8: - clrlwi. r0, r31, 0x18 - bne lbl_802954DC - lis r3, lbl_80488894@ha - lis r5, lbl_804888AC@ha - addi r3, r3, lbl_80488894@l - li r4, 0x454 - addi r5, r5, lbl_804888AC@l - crclr 6 - bl panic_f__12JUTExceptionFPCciPCce - -lbl_802954DC: - mr r3, r30 - li r4, 1 - bl setAppearFlag__Q23PSM9EnemyBossFb - -lbl_802954E8: - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + if (_2C2) { + _2C2 = 0; + PSM::EnemyBoss* soundObj = static_cast(mSoundObj); + PSM::checkBoss(soundObj); + soundObj->setAppearFlag(true); + } } /* diff --git a/src/plugProjectNishimuraU/SnakeCrowState.cpp b/src/plugProjectNishimuraU/SnakeCrowState.cpp index 54708e3fb..8a72b56fd 100644 --- a/src/plugProjectNishimuraU/SnakeCrowState.cpp +++ b/src/plugProjectNishimuraU/SnakeCrowState.cpp @@ -1522,7 +1522,7 @@ void StateAttack::init(EnemyBase* enemy, StateArg* stateArg) Obj* snagret = static_cast(enemy); snagret->disableEvent(0, EB_Cullable); snagret->mTargetVelocity = Vector3f(0.0f); - snagret->startMotion(snagret->_2D4 + 4, nullptr); + snagret->startMotion(snagret->mAttackAnimIdx + 4, nullptr); } /* @@ -1546,7 +1546,7 @@ void StateAttack::exec(EnemyBase* enemy) snagret->startJointCallBack(); } else if ((u32)snagret->mCurAnim->mType == KEYEVENT_3) { - int idx = snagret->_2D4; + int idx = snagret->mAttackAnimIdx; Piki* piki = snagret->getAttackPiki(idx); if (piki) { @@ -1573,7 +1573,7 @@ void StateAttack::exec(EnemyBase* enemy) if (!snagret->isFinishMotion() && snagret->getSwallowSlot()) { if (snagret->getAttackPiki(5) != nullptr || snagret->getAttackNavi(5)) { - snagret->startMotion(snagret->_2D4 + 4, nullptr); + snagret->startMotion(snagret->mAttackAnimIdx + 4, nullptr); snagret->setMotionFrame(snagret->getFirstKeyFrame()); snagret->startJointCallBack(); diff --git a/src/plugProjectNishimuraU/SnakeWhole.cpp b/src/plugProjectNishimuraU/SnakeWhole.cpp index fb30ec7e8..b22967664 100644 --- a/src/plugProjectNishimuraU/SnakeWhole.cpp +++ b/src/plugProjectNishimuraU/SnakeWhole.cpp @@ -1,535 +1,33 @@ -#include "types.h" - -/* - Generated from dpostproc - - .section .rodata # 0x804732E0 - 0x8049E220 - .global lbl_8048BB38 - lbl_8048BB38: - .4byte 0x3234362D - .4byte 0x536E616B - .4byte 0x6557686F - .4byte 0x6C650000 - .global lbl_8048BB48 - lbl_8048BB48: - .4byte 0x6B757469 - .4byte 0x6A6E7431 - .4byte 0x00000000 - .4byte 0x6B616D75 - .4byte 0x6A6E7431 - .4byte 0x00000000 - .4byte 0x6B616D75 - .4byte 0x6A6E7432 - .4byte 0x00000000 - .4byte 0x6B616D75 - .4byte 0x6A6E7433 - .4byte 0x00000000 - lbl_8048BB78: - .4byte 0x42700000 - .4byte 0x43160000 - .4byte 0x435C0000 - .4byte 0x42F00000 - .4byte 0x42F00000 - .global lbl_8048BB8C - lbl_8048BB8C: - .4byte 0x00000000 - .4byte 0x00000000 - .4byte 0x00000000 - .4byte 0x42A00000 - .4byte 0xC2A00000 - .4byte 0x42F00000 - .4byte 0x43340000 - .4byte 0x43820000 - .4byte 0x43200000 - .4byte 0x43200000 - .4byte 0x00000000 - .4byte 0x42F00000 - .4byte 0x43340000 - .4byte 0x42A00000 - .4byte 0x42A00000 - .4byte 0x41F00000 - .4byte 0x41F00000 - .4byte 0x41F00000 - .4byte 0x42DC0000 - .4byte 0xC2480000 - .4byte 0xC1F00000 - .4byte 0xC1F00000 - .4byte 0xC1F00000 - .4byte 0x42480000 - .4byte 0xC2DC0000 - .4byte 0x42200000 - .4byte 0x42200000 - .4byte 0x42200000 - .4byte 0x42200000 - .4byte 0x42200000 - .4byte 0xC2200000 - .4byte 0xC2200000 - .4byte 0xC2200000 - .4byte 0xC2200000 - .4byte 0xC2200000 - .4byte 0x42F00000 - .4byte 0x43340000 - .4byte 0x43820000 - .4byte 0x43200000 - .4byte 0x43200000 - .4byte 0x00000000 - .4byte 0x42F00000 - .4byte 0x43340000 - .4byte 0x42A00000 - .4byte 0x42A00000 - .4byte 0x41F00000 - .4byte 0x41F00000 - .4byte 0x41F00000 - .4byte 0x42DC0000 - .4byte 0xC2480000 - .4byte 0xC1F00000 - .4byte 0xC1F00000 - .4byte 0xC1F00000 - .4byte 0x42480000 - .4byte 0xC2DC0000 - .4byte 0x42200000 - .4byte 0x42200000 - .4byte 0x42200000 - .4byte 0x42200000 - .4byte 0x42200000 - .4byte 0xC2200000 - .4byte 0xC2200000 - .4byte 0xC2200000 - .4byte 0xC2200000 - .4byte 0xC2200000 - .global lbl_8048BC90 - lbl_8048BC90: - .4byte 0x50534D61 - .4byte 0x696E5369 - .4byte 0x64655F4F - .4byte 0x626A536F - .4byte 0x756E642E - .4byte 0x68000000 - .global lbl_8048BCA8 - lbl_8048BCA8: - .asciz "P2Assert" - .skip 3 - .global lbl_8048BCB4 - lbl_8048BCB4: - .asciz "foot_joint1" - - .section .data, "wa" # 0x8049E220 - 0x804EFC20 - .global __vt__Q23efx15TCphebiDeadHane - __vt__Q23efx15TCphebiDeadHane: - .4byte 0 - .4byte 0 - .4byte create__Q23efx8TSimple1FPQ23efx3Arg - .4byte forceKill__Q23efx8TSimple1Fv - .4byte fade__Q23efx8TSimple1Fv - .global __vt__Q23efx11TCphebiDead - __vt__Q23efx11TCphebiDead: - .4byte 0 - .4byte 0 - .4byte "create__Q23efx29TSyncGroup4FPQ23efx3Arg" - .4byte "forceKill__Q23efx29TSyncGroup4Fv" - .4byte "fade__Q23efx29TSyncGroup4Fv" - .4byte "startDemoDrawOff__Q23efx29TSyncGroup4Fv" - .4byte "endDemoDrawOn__Q23efx29TSyncGroup4Fv" - .global __vt__Q34Game10SnakeWhole3Obj - __vt__Q34Game10SnakeWhole3Obj: - .4byte 0 - .4byte 0 - .4byte getPosition__Q24Game9EnemyBaseFv - .4byte checkCollision__Q24Game8CreatureFPQ24Game10CellObject - .4byte getBoundingSphere__Q24Game9EnemyBaseFRQ23Sys6Sphere - .4byte collisionUpdatable__Q24Game8CreatureFv - .4byte isPiki__Q24Game8CreatureFv - .4byte isNavi__Q24Game8CreatureFv - .4byte deferPikiCollision__Q24Game10CellObjectFv - .4byte getTypeName__Q24Game8CreatureFv - .4byte getObjType__Q24Game8CreatureFv - .4byte constructor__Q24Game9EnemyBaseFv - .4byte onInit__Q34Game10SnakeWhole3ObjFPQ24Game15CreatureInitArg - .4byte onKill__Q24Game9EnemyBaseFPQ24Game15CreatureKillArg - .4byte onInitPost__Q24Game9EnemyBaseFPQ24Game15CreatureInitArg - .4byte doAnimation__Q24Game9EnemyBaseFv - .4byte doEntry__Q24Game9EnemyBaseFv - .4byte doSetView__Q24Game9EnemyBaseFi - .4byte doViewCalc__Q24Game9EnemyBaseFv - .4byte doSimulation__Q24Game9EnemyBaseFf - .4byte doDirectDraw__Q34Game10SnakeWhole3ObjFR8Graphics - .4byte getBodyRadius__Q24Game9EnemyBaseFv - .4byte getCellRadius__Q24Game9EnemyBaseFv - .4byte "initPosition__Q24Game8CreatureFR10Vector3" - .4byte "onInitPosition__Q24Game8CreatureFR10Vector3" - .4byte getFaceDir__Q24Game9EnemyBaseFv - .4byte "setVelocity__Q24Game9EnemyBaseFR10Vector3" - .4byte getVelocity__Q24Game9EnemyBaseFv - .4byte "onSetPosition__Q24Game9EnemyBaseFR10Vector3" - .4byte "onSetPositionPost__Q24Game9EnemyBaseFR10Vector3" - .4byte updateTrMatrix__Q24Game9EnemyBaseFv - .4byte isTeki__Q24Game9EnemyBaseFv - .4byte isPellet__Q24Game8CreatureFv - .4byte inWaterCallback__Q34Game10SnakeWhole3ObjFPQ24Game8WaterBox - .4byte outWaterCallback__Q34Game10SnakeWhole3ObjFv - .4byte inWater__Q24Game9EnemyBaseFv - .4byte getFlockMgr__Q24Game8CreatureFv - .4byte onStartCapture__Q24Game8CreatureFv - .4byte onUpdateCapture__Q24Game8CreatureFR7Matrixf - .4byte onEndCapture__Q24Game8CreatureFv - .4byte isAtari__Q24Game8CreatureFv - .4byte setAtari__Q24Game8CreatureFb - .4byte isAlive__Q24Game8CreatureFv - .4byte setAlive__Q24Game8CreatureFb - .4byte isCollisionFlick__Q24Game8CreatureFv - .4byte setCollisionFlick__Q24Game8CreatureFb - .4byte isMovieActor__Q24Game8CreatureFv - .4byte isMovieExtra__Q24Game8CreatureFv - .4byte isMovieMotion__Q24Game8CreatureFv - .4byte setMovieMotion__Q24Game8CreatureFb - .4byte isBuried__Q24Game8CreatureFv - .4byte isFlying__Q24Game9EnemyBaseFv - .4byte isUnderground__Q34Game10SnakeWhole3ObjFv - .4byte isLivingThing__Q24Game8CreatureFv - .4byte isDebugCollision__Q24Game8CreatureFv - .4byte setDebugCollision__Q24Game8CreatureFb - .4byte doSave__Q24Game8CreatureFR6Stream - .4byte doLoad__Q24Game8CreatureFR6Stream - .4byte bounceCallback__Q24Game8CreatureFPQ23Sys8Triangle - .4byte collisionCallback__Q24Game9EnemyBaseFRQ24Game9CollEvent - .4byte platCallback__Q24Game8CreatureFRQ24Game9PlatEvent - .4byte getJAIObject__Q24Game9EnemyBaseFv - .4byte getPSCreature__Q24Game9EnemyBaseFv - .4byte getSound_AILOD__Q24Game8CreatureFv - .4byte getSound_PosPtr__Q24Game9EnemyBaseFv - .4byte sound_culling__Q24Game9EnemyBaseFv - .4byte getSound_CurrAnimFrame__Q24Game9EnemyBaseFv - .4byte getSound_CurrAnimSpeed__Q24Game9EnemyBaseFv - .4byte on_movie_begin__Q24Game8CreatureFb - .4byte on_movie_end__Q24Game8CreatureFb - .4byte movieStartAnimation__Q24Game8CreatureFUl - .4byte movieStartDemoAnimation__Q24Game8CreatureFPQ28SysShape8AnimInfo - .4byte movieSetAnimationLastFrame__Q24Game8CreatureFv - .4byte "movieSetTranslation__Q24Game8CreatureFR10Vector3f" - .4byte movieSetFaceDir__Q24Game8CreatureFf - .4byte "movieGotoPosition__Q24Game8CreatureFR10Vector3" - .4byte movieUserCommand__Q24Game8CreatureFUlPQ24Game11MoviePlayer - .4byte getShadowParam__Q34Game10SnakeWhole3ObjFRQ24Game11ShadowParam - .4byte needShadow__Q24Game9EnemyBaseFv - .4byte getLifeGaugeParam__Q24Game9EnemyBaseFRQ24Game14LifeGaugeParam - .4byte getLODSphere__Q24Game9EnemyBaseFRQ23Sys6Sphere - .4byte getLODCylinder__Q24Game8CreatureFRQ23Sys8Cylinder - .4byte startPick__Q24Game8CreatureFv - .4byte endPick__Q24Game8CreatureFb - .4byte getMabiki__Q24Game8CreatureFv - .4byte getFootmarks__Q24Game8CreatureFv - .4byte onStickStart__Q24Game9EnemyBaseFPQ24Game8Creature - .4byte onStickEnd__Q24Game9EnemyBaseFPQ24Game8Creature - .4byte onStickStartSelf__Q24Game8CreatureFPQ24Game8Creature - .4byte onStickEndSelf__Q24Game8CreatureFPQ24Game8Creature - .4byte isSlotFree__Q24Game8CreatureFs - .4byte getFreeStickSlot__Q24Game8CreatureFv - .4byte "getNearFreeStickSlot__Q24Game8CreatureFR10Vector3" - .4byte getRandomFreeStickSlot__Q24Game8CreatureFv - .4byte onSlotStickStart__Q24Game8CreatureFPQ24Game8Creatures - .4byte onSlotStickEnd__Q24Game8CreatureFPQ24Game8Creatures - .4byte "calcStickSlotGlobal__Q24Game8CreatureFsR10Vector3" - .4byte "getVelocityAt__Q24Game9EnemyBaseFR10Vector3R10Vector3" - .4byte "getAngularEffect__Q24Game8CreatureFR10Vector3R10Vector3" - .4byte "applyImpulse__Q24Game8CreatureFR10Vector3R10Vector3" - .4byte ignoreAtari__Q24Game8CreatureFPQ24Game8Creature - .4byte getSuckPos__Q24Game8CreatureFv - .4byte getGoalPos__Q24Game8CreatureFv - .4byte isSuckReady__Q24Game8CreatureFv - .4byte isSuckArriveWait__Q24Game8CreatureFv - .4byte stimulate__Q24Game9EnemyBaseFRQ24Game11Interaction - .4byte getCreatureName__Q24Game9EnemyBaseFv - .4byte getCreatureID__Q24Game9EnemyBaseFv - .4byte 0 - .4byte 0 - .4byte "@376@onKeyEvent__Q24Game9EnemyBaseFRCQ28SysShape8KeyEvent" - .4byte __dt__Q34Game10SnakeWhole3ObjFv - .4byte "birth__Q24Game9EnemyBaseFR10Vector3f" - .4byte - setInitialSetting__Q34Game10SnakeWhole3ObjFPQ24Game21EnemyInitialParamBase - .4byte update__Q24Game9EnemyBaseFv - .4byte doUpdate__Q34Game10SnakeWhole3ObjFv - .4byte doUpdateCommon__Q34Game10SnakeWhole3ObjFv - .4byte doUpdateCarcass__Q24Game9EnemyBaseFv - .4byte doAnimationUpdateAnimator__Q34Game10SnakeWhole3ObjFv - .4byte doAnimationCullingOff__Q34Game10SnakeWhole3ObjFv - .4byte doAnimationCullingOn__Q24Game9EnemyBaseFv - .4byte doAnimationStick__Q24Game9EnemyBaseFv - .4byte doSimulationCarcass__Q24Game9EnemyBaseFf - .4byte doDebugDraw__Q34Game10SnakeWhole3ObjFR8Graphics - .4byte doSimpleDraw__Q24Game9EnemyBaseFP8Viewport - .4byte doSimulationGround__Q24Game9EnemyBaseFf - .4byte doSimulationFlying__Q24Game9EnemyBaseFf - .4byte doSimulationStick__Q24Game9EnemyBaseFf - .4byte changeMaterial__Q24Game9EnemyBaseFv - .4byte "getCommonEffectPos__Q24Game9EnemyBaseFR10Vector3" - .4byte getFitEffectPos__Q34Game10SnakeWhole3ObjFv - .4byte viewGetShape__Q24Game9EnemyBaseFv - .4byte view_start_carrymotion__Q24Game9EnemyBaseFv - .4byte view_finish_carrymotion__Q24Game9EnemyBaseFv - .4byte viewStartPreCarryMotion__Q24Game9EnemyBaseFv - .4byte viewStartCarryMotion__Q24Game9EnemyBaseFv - .4byte viewOnPelletKilled__Q24Game9EnemyBaseFv - .4byte getOffsetForMapCollision__Q24Game9EnemyBaseFv - .4byte setParameters__Q24Game9EnemyBaseFv - .4byte initMouthSlots__Q34Game10SnakeWhole3ObjFv - .4byte initWalkSmokeEffect__Q24Game9EnemyBaseFv - .4byte getWalkSmokeEffectMgr__Q24Game9EnemyBaseFv - .4byte onKeyEvent__Q24Game9EnemyBaseFRCQ28SysShape8KeyEvent - .4byte injure__Q24Game9EnemyBaseFv - .4byte setCollEvent__Q24Game9EnemyBaseFRQ24Game9CollEvent - .4byte "getEfxHamonPos__Q24Game9EnemyBaseFP10Vector3" - .4byte createInstanceEfxHamon__Q24Game9EnemyBaseFv - .4byte updateEfxHamon__Q24Game9EnemyBaseFv - .4byte createEfxHamon__Q34Game10SnakeWhole3ObjFv - .4byte fadeEfxHamon__Q24Game9EnemyBaseFv - .4byte getEnemyTypeID__Q34Game10SnakeWhole3ObjFv - .4byte getMouthSlots__Q34Game10SnakeWhole3ObjFv - .4byte doGetLifeGaugeParam__Q24Game9EnemyBaseFRQ24Game14LifeGaugeParam - .4byte throwupItem__Q24Game9EnemyBaseFv - .4byte "getThrowupItemPosition__Q34Game10SnakeWhole3ObjFP10Vector3" - .4byte "getThrowupItemVelocity__Q24Game9EnemyBaseFP10Vector3" - .4byte throwupItemInDeathProcedure__Q34Game10SnakeWhole3ObjFv - .4byte setLODSphere__Q24Game9EnemyBaseFRQ23Sys6Sphere - .4byte - damageCallBack__Q34Game10SnakeWhole3ObjFPQ24Game8CreaturefP8CollPart .4byte - pressCallBack__Q24Game9EnemyBaseFPQ24Game8CreaturefP8CollPart .4byte - flyCollisionCallBack__Q24Game9EnemyBaseFPQ24Game8CreaturefP8CollPart .4byte - hipdropCallBack__Q24Game9EnemyBaseFPQ24Game8CreaturefP8CollPart .4byte - dropCallBack__Q24Game9EnemyBaseFPQ24Game8Creature .4byte - earthquakeCallBack__Q24Game9EnemyBaseFPQ24Game8Creaturef .4byte - farmCallBack__Q24Game9EnemyBaseFPQ24Game8Creaturef .4byte - "bombCallBack__Q24Game9EnemyBaseFPQ24Game8CreatureR10Vector3f" .4byte - eatWhitePikminCallBack__Q24Game9EnemyBaseFPQ24Game8Creaturef .4byte - dopeCallBack__Q24Game9EnemyBaseFPQ24Game8Creaturei .4byte - doDopeCallBack__Q24Game9EnemyBaseFPQ24Game8Creaturei .4byte - doStartStoneState__Q34Game10SnakeWhole3ObjFv .4byte - doFinishStoneState__Q34Game10SnakeWhole3ObjFv .4byte - getDamageCoeStoneState__Q34Game10SnakeWhole3ObjFv .4byte - doStartEarthquakeState__Q24Game9EnemyBaseFf .4byte - doFinishEarthquakeState__Q24Game9EnemyBaseFv .4byte - doStartEarthquakeFitState__Q24Game9EnemyBaseFv .4byte - doFinishEarthquakeFitState__Q24Game9EnemyBaseFv .4byte - lifeRecover__Q24Game9EnemyBaseFv .4byte - startCarcassMotion__Q34Game10SnakeWhole3ObjFv .4byte - setCarcassArg__Q24Game9EnemyBaseFRQ24Game13PelletViewArg .4byte - getCarcassArgHeight__Q24Game9EnemyBaseFv .4byte - doBecomeCarcass__Q24Game9EnemyBaseFv .4byte - startWaitingBirthTypeDrop__Q24Game9EnemyBaseFv .4byte - finishWaitingBirthTypeDrop__Q24Game9EnemyBaseFv .4byte - isFinishableWaitingBirthTypeDrop__Q24Game9EnemyBaseFv .4byte - doStartWaitingBirthTypeDrop__Q24Game9EnemyBaseFv .4byte - doFinishWaitingBirthTypeDrop__Q24Game9EnemyBaseFv .4byte - wallCallback__Q24Game9EnemyBaseFRCQ24Game8MoveInfo .4byte - getDownSmokeScale__Q34Game10SnakeWhole3ObjFv .4byte - doStartMovie__Q34Game10SnakeWhole3ObjFv .4byte - doEndMovie__Q34Game10SnakeWhole3ObjFv .4byte - setFSM__Q34Game10SnakeWhole3ObjFPQ34Game10SnakeWhole3FSM .4byte 0 .4byte 0 - .4byte viewGetBaseScale__Q24Game10PelletViewFv - .4byte "@816@12@viewGetShape__Q24Game9EnemyBaseFv" - .4byte viewGetCollTreeJointIndex__Q24Game10PelletViewFv - .4byte viewGetCollTreeOffset__Q24Game10PelletViewFv - .4byte "@816@12@view_start_carrymotion__Q24Game9EnemyBaseFv" - .4byte "@816@12@view_finish_carrymotion__Q24Game9EnemyBaseFv" - .4byte "@816@12@viewStartPreCarryMotion__Q24Game9EnemyBaseFv" - .4byte "@816@12@viewStartCarryMotion__Q24Game9EnemyBaseFv" - .4byte "@816@12@viewOnPelletKilled__Q24Game9EnemyBaseFv" - .4byte "viewEntryShape__Q24Game10PelletViewFR7MatrixfR10Vector3" - .4byte 0 - - .section .sdata2, "a" # 0x80516360 - 0x80520E40 - .global lbl_8051C868 - lbl_8051C868: - .4byte 0x00000000 - .global lbl_8051C86C - lbl_8051C86C: - .4byte 0x40200000 - .global lbl_8051C870 - lbl_8051C870: - .float 1.0 - .global lbl_8051C874 - lbl_8051C874: - .4byte 0x42480000 - .global lbl_8051C878 - lbl_8051C878: - .4byte 0x41A00000 - .global lbl_8051C87C - lbl_8051C87C: - .4byte 0x41B40000 - .global lbl_8051C880 - lbl_8051C880: - .float 0.1 - .global lbl_8051C884 - lbl_8051C884: - .4byte 0x41200000 - .global lbl_8051C888 - lbl_8051C888: - .4byte 0xC47A0000 - .global lbl_8051C88C - lbl_8051C88C: - .4byte 0x41700000 - .global lbl_8051C890 - lbl_8051C890: - .4byte 0x3FC90FDB - .global lbl_8051C894 - lbl_8051C894: - .4byte 0x41B00000 - .global lbl_8051C898 - lbl_8051C898: - .4byte 0x3F060A92 - .global lbl_8051C89C - lbl_8051C89C: - .4byte 0x3F3BBBBC - .global lbl_8051C8A0 - lbl_8051C8A0: - .4byte 0x43300000 - .4byte 0x80000000 - .global lbl_8051C8A8 - lbl_8051C8A8: - .4byte 0x40C90FDB - .global lbl_8051C8AC - lbl_8051C8AC: - .float 0.5 - .global lbl_8051C8B0 - lbl_8051C8B0: - .4byte 0x47000000 - .global lbl_8051C8B4 - lbl_8051C8B4: - .4byte 0x43A2F983 - .global lbl_8051C8B8 - lbl_8051C8B8: - .4byte 0xC3A2F983 - .global lbl_8051C8BC - lbl_8051C8BC: - .4byte 0x42F00000 - .global lbl_8051C8C0 - lbl_8051C8C0: - .4byte 0x40490FDB - .global lbl_8051C8C4 - lbl_8051C8C4: - .4byte 0x47FA0000 - .global lbl_8051C8C8 - lbl_8051C8C8: - .4byte 0xC7FA0000 - .global lbl_8051C8CC - lbl_8051C8CC: - .4byte 0x43340000 - .global lbl_8051C8D0 - lbl_8051C8D0: - .float 0.25 - .global lbl_8051C8D4 - lbl_8051C8D4: - .4byte 0x3F666666 -*/ +#include "Game/Entities/SnakeWhole.h" +#include "Game/EnemyFunc.h" +#include "Game/MapMgr.h" +#include "Game/PikiMgr.h" +#include "Game/Navi.h" +#include "Game/Stickers.h" +#include "Game/SingleGameSection.h" +#include "Game/CameraMgr.h" +#include "Game/rumble.h" +#include "PSM/EnemyBoss.h" +#include "PSSystem/PSMainSide_ObjSound.h" +#include "Dolphin/rand.h" namespace Game { +namespace SnakeWhole { + +static const char unusedSnakeWholeName[] = "246-SnakeWhole"; /* * --INFO-- * Address: 802CE798 * Size: 00016C */ -SnakeWhole::Obj::Obj() +Obj::Obj() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - extsh. r0, r4 - stw r31, 0xc(r1) - mr r31, r3 - stw r30, 8(r1) - beq lbl_802CE7D8 - addi r0, r31, 0x330 - lis r3, __vt__Q24Game10PelletView@ha - stw r0, 0x17c(r31) - addi r3, r3, __vt__Q24Game10PelletView@l - li r0, 0 - stw r3, 0x330(r31) - stw r0, 0x334(r31) - stw r0, 0x338(r31) - -lbl_802CE7D8: - mr r3, r31 - li r4, 0 - bl __ct__Q24Game9EnemyBaseFv - lis r3, __vt__Q34Game10SnakeWhole3Obj@ha - addi r0, r31, 0x330 - addi r5, r3, __vt__Q34Game10SnakeWhole3Obj@l - addi r3, r31, 0x2d0 - stw r5, 0(r31) - addi r4, r5, 0x1b0 - addi r5, r5, 0x2fc - stw r4, 0x178(r31) - lwz r4, 0x17c(r31) - stw r5, 0(r4) - lwz r4, 0x17c(r31) - subf r0, r4, r0 - stw r0, 0xc(r4) - bl __ct__10MouthSlotsFv - lis r4, "__ct__10Vector3Fv"@ha - addi r3, r31, 0x2e8 - addi r4, r4, "__ct__10Vector3Fv"@l - li r5, 0 - li r6, 0xc - li r7, 5 - bl __construct_array - li r3, 0x2c - bl __nw__FUl - or. r30, r3, r3 - beq lbl_802CE888 - bl __ct__Q24Game17EnemyAnimatorBaseFv - lis r3, __vt__Q34Game10SnakeWhole14ProperAnimator@ha - lis r4, __vt__Q28SysShape12BaseAnimator@ha - addi r0, r3, __vt__Q34Game10SnakeWhole14ProperAnimator@l - lis r3, __vt__Q28SysShape8Animator@ha - stw r0, 0(r30) - addi r4, r4, __vt__Q28SysShape12BaseAnimator@l - addi r3, r3, __vt__Q28SysShape8Animator@l - li r0, 0 - stw r4, 0x10(r30) - stw r3, 0x10(r30) - stb r0, 0x28(r30) - stw r0, 0x1c(r30) - stw r0, 0x14(r30) - stb r0, 0x28(r30) - stw r0, 0x20(r30) - -lbl_802CE888: - stw r30, 0x184(r31) - li r3, 0x1c - bl __nw__FUl - or. r4, r3, r3 - beq lbl_802CE8BC - lis r5, __vt__Q24Game17EnemyStateMachine@ha - lis r3, __vt__Q34Game10SnakeWhole3FSM@ha - addi r0, r5, __vt__Q24Game17EnemyStateMachine@l - li r5, -1 - stw r0, 0(r4) - addi r0, r3, __vt__Q34Game10SnakeWhole3FSM@l - stw r5, 0x18(r4) - stw r0, 0(r4) - -lbl_802CE8BC: - lwz r12, 0(r31) - mr r3, r31 - lwz r12, 0x2f8(r12) - mtctr r12 - bctrl - mr r3, r31 - bl createJointCallBack__Q34Game10SnakeWhole3ObjFv - mr r3, r31 - bl createShadowSystem__Q34Game10SnakeWhole3ObjFv - mr r3, r31 - bl createEffect__Q34Game10SnakeWhole3ObjFv - lwz r0, 0x14(r1) - mr r3, r31 - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + mAnimator = new ProperAnimator; + setFSM(new FSM); + createJointCallBack(); + createShadowSystem(); + createEffect(); } /* @@ -537,68 +35,32 @@ SnakeWhole::Obj::Obj() * Address: 802CE904 * Size: 000004 */ -void SnakeWhole::Obj::setInitialSetting(Game::EnemyInitialParamBase*) { } +void Obj::setInitialSetting(EnemyInitialParamBase*) { } /* * --INFO-- * Address: 802CE908 * Size: 0000CC */ -void SnakeWhole::Obj::onInit(Game::CreatureInitArg*) +void Obj::onInit(CreatureInitArg* initArg) { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - bl onInit__Q24Game9EnemyBaseFPQ24Game15CreatureInitArg - lwz r3, shadowMgr__4Game@sda21(r13) - mr r4, r31 - bl delNormalShadow__Q24Game9ShadowMgrFPQ24Game8Creature - li r0, 1 - li r4, 0 - stb r0, 0x2c0(r31) - li r0, -1 - lfs f0, lbl_8051C868@sda21(r2) - mr r3, r31 - stb r4, 0x2c1(r31) - stfs f0, 0x2c4(r31) - stw r0, 0x2cc(r31) - stw r0, 0x2e4(r31) - stfs f0, 0x2c8(r31) - bl setupJointCallBack__Q34Game10SnakeWhole3ObjFv - mr r3, r31 - bl setupCollision__Q34Game10SnakeWhole3ObjFv - mr r3, r31 - bl setupShadowSystem__Q34Game10SnakeWhole3ObjFv - mr r3, r31 - bl setupEffect__Q34Game10SnakeWhole3ObjFv - li r3, 1 - li r0, 0 - stb r3, 0x2c2(r31) - mr r3, r31 - stb r0, 0x2c3(r31) - bl resetBossAppearBGM__Q34Game10SnakeWhole3ObjFv - lwz r3, 0x2bc(r31) - mr r4, r31 - li r5, 1 - li r6, 0 - lwz r12, 0(r3) - lwz r12, 0xc(r12) - mtctr r12 - bctrl - mr r3, r31 - lwz r12, 0(r31) - lwz r12, 0x1dc(r12) - mtctr r12 - bctrl - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + EnemyBase::onInit(initArg); + shadowMgr->delNormalShadow(this); + mIsUnderground = true; + _2C1 = 0; + mStateTimer = 0.0f; + mNextState = SNAKEWHOLE_NULL; + mAttackAnimIdx = -1; + _2C8 = 0.0f; + setupJointCallBack(); + setupCollision(); + setupShadowSystem(); + setupEffect(); + _2C2 = 1; + _2C3 = 0; + resetBossAppearBGM(); + mFsm->start(this, SNAKEWHOLE_Stay, nullptr); + doAnimationCullingOff(); } /* @@ -606,30 +68,11 @@ void SnakeWhole::Obj::onInit(Game::CreatureInitArg*) * Address: 802CE9D4 * Size: 000050 */ -void SnakeWhole::Obj::doUpdate() +void Obj::doUpdate() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - mr r4, r31 - lwz r3, 0x2bc(r3) - lwz r12, 0(r3) - lwz r12, 0x10(r12) - mtctr r12 - bctrl - mr r3, r31 - bl updateConstraint__Q34Game10SnakeWhole3ObjFv - addi r3, r31, 0x2d0 - bl update__10MouthSlotsFv - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + mFsm->exec(this); + updateConstraint(); + mMouthSlots.update(); } /* @@ -637,23 +80,10 @@ void SnakeWhole::Obj::doUpdate() * Address: 802CEA24 * Size: 000034 */ -void SnakeWhole::Obj::doUpdateCommon() +void Obj::doUpdateCommon() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - bl doUpdateCommon__Q24Game9EnemyBaseFv - mr r3, r31 - bl updateBossBGM__Q34Game10SnakeWhole3ObjFv - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + EnemyBase::doUpdateCommon(); + updateBossBGM(); } /* @@ -661,23 +91,10 @@ void SnakeWhole::Obj::doUpdateCommon() * Address: 802CEA58 * Size: 000034 */ -void SnakeWhole::Obj::doAnimationUpdateAnimator() +void Obj::doAnimationUpdateAnimator() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - bl doAnimationUpdateAnimator__Q24Game9EnemyBaseFv - mr r3, r31 - bl doAnimationJointCallBack__Q34Game10SnakeWhole3ObjFv - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + EnemyBase::doAnimationUpdateAnimator(); + doAnimationJointCallBack(); } /* @@ -685,25 +102,11 @@ void SnakeWhole::Obj::doAnimationUpdateAnimator() * Address: 802CEA8C * Size: 00003C */ -void SnakeWhole::Obj::doAnimationCullingOff() +void Obj::doAnimationCullingOff() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - bl doAnimationCullingOff__Q24Game9EnemyBaseFv - mr r3, r31 - bl doAnimationShadowSystem__Q34Game10SnakeWhole3ObjFv - mr r3, r31 - bl finishAnimationJointCallBack__Q34Game10SnakeWhole3ObjFv - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + EnemyBase::doAnimationCullingOff(); + doAnimationShadowSystem(); + finishAnimationJointCallBack(); } /* @@ -711,55 +114,25 @@ void SnakeWhole::Obj::doAnimationCullingOff() * Address: 802CEAC8 * Size: 000004 */ -void SnakeWhole::Obj::doDirectDraw(Graphics&) { } +void Obj::doDirectDraw(Graphics&) { } /* * --INFO-- * Address: 802CEACC * Size: 000020 */ -void SnakeWhole::Obj::doDebugDraw(Graphics&) -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - bl doDebugDraw__Q24Game9EnemyBaseFR8Graphics - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::doDebugDraw(Graphics& gfx) { EnemyBase::doDebugDraw(gfx); } /* * --INFO-- * Address: 802CEAEC * Size: 00004C */ -void SnakeWhole::Obj::setFSM(Game::SnakeWhole::FSM*) +void Obj::setFSM(FSM* fsm) { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - stw r4, 0x2bc(r3) - mr r4, r31 - lwz r3, 0x2bc(r3) - lwz r12, 0(r3) - lwz r12, 8(r12) - mtctr r12 - bctrl - li r0, 0 - stw r0, 0x2b4(r31) - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + mFsm = fsm; + mFsm->init(this); + mCurrentLifecycleState = nullptr; } /* @@ -767,58 +140,17 @@ void SnakeWhole::Obj::setFSM(Game::SnakeWhole::FSM*) * Address: 802CEB38 * Size: 0000B0 */ -void SnakeWhole::Obj::getShadowParam(Game::ShadowParam&) +void Obj::getShadowParam(ShadowParam& shadowParam) { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r4 - stw r30, 8(r1) - mr r30, r3 - lis r3, lbl_8048BB48@ha - addi r0, r3, lbl_8048BB48@l - lwz r3, 0x174(r30) - mr r4, r0 - bl getJoint__Q28SysShape5ModelFPc - bl getWorldMatrix__Q28SysShape5JointFv - lfs f4, 0x2c(r3) - lfs f2, 0x1c(r3) - lfs f0, 0xc(r3) - lfs f3, lbl_8051C86C@sda21(r2) - stfs f0, 0(r31) - lfs f1, lbl_8051C868@sda21(r2) - stfs f2, 4(r31) - lfs f0, lbl_8051C870@sda21(r2) - stfs f4, 8(r31) - lfs f2, 0x190(r30) - fadds f2, f3, f2 - stfs f2, 4(r31) - stfs f1, 0xc(r31) - stfs f0, 0x10(r31) - stfs f1, 0x14(r31) - lwz r0, 0x1e4(r30) - clrlwi. r0, r0, 0x1f - beq lbl_802CEBC0 - lfs f0, lbl_8051C874@sda21(r2) - stfs f0, 0x18(r31) - b lbl_802CEBC8 - -lbl_802CEBC0: - lfs f0, lbl_8051C878@sda21(r2) - stfs f0, 0x18(r31) - -lbl_802CEBC8: - lfs f0, lbl_8051C87C@sda21(r2) - stfs f0, 0x1c(r31) - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + shadowParam.mPosition = mModel->getJoint("kutijnt1")->getWorldMatrix()->getBasis(3); + shadowParam.mPosition.y = mPosition.y + 2.5f; + shadowParam.mBoundingSphere.mPosition = Vector3f(0.0f, 1.0f, 0.0f); + if (isEvent(1, EB2_Earthquake)) { + shadowParam.mBoundingSphere.mRadius = 50.0f; + } else { + shadowParam.mBoundingSphere.mRadius = 20.0f; + } + shadowParam.mSize = 22.5f; } /* @@ -826,54 +158,17 @@ void SnakeWhole::Obj::getShadowParam(Game::ShadowParam&) * Address: 802CEBE8 * Size: 000098 */ -void SnakeWhole::Obj::damageCallBack(Game::Creature*, float, CollPart*) +bool Obj::damageCallBack(Creature* creature, f32 damage, CollPart* part) { - /* - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - stfd f31, 0x10(r1) - psq_st f31, 24(r1), 0, qr0 - stw r31, 0xc(r1) - stw r30, 8(r1) - fmr f31, f1 - cmplwi r4, 0 - mr r30, r3 - mr r31, r5 - beq lbl_802CEC5C - mr r3, r4 - lwz r12, 0(r4) - lwz r12, 0x18(r12) - mtctr r12 - bctrl - clrlwi. r0, r3, 0x18 - beq lbl_802CEC5C - cmplwi r31, 0 - bne lbl_802CEC44 - lfs f0, lbl_8051C880@sda21(r2) - fmuls f31, f31, f0 - -lbl_802CEC44: - fmr f1, f31 - lfs f2, lbl_8051C870@sda21(r2) - mr r3, r30 - bl addDamage__Q24Game9EnemyBaseFff - li r3, 1 - b lbl_802CEC60 + if (creature && creature->isPiki()) { + if (!part) { + damage *= 0.1f; + } + addDamage(damage, 1.0f); + return true; + } -lbl_802CEC5C: - li r3, 0 - -lbl_802CEC60: - psq_l f31, 24(r1), 0, qr0 - lwz r0, 0x24(r1) - lfd f31, 0x10(r1) - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x20 - blr - */ + return false; } /* @@ -881,48 +176,17 @@ void SnakeWhole::Obj::damageCallBack(Game::Creature*, float, CollPart*) * Address: 802CEC80 * Size: 000020 */ -void SnakeWhole::Obj::doStartStoneState() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - bl doStartStoneState__Q24Game9EnemyBaseFv - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::doStartStoneState() { EnemyBase::doStartStoneState(); } /* * --INFO-- * Address: 802CECA0 * Size: 000048 */ -void SnakeWhole::Obj::doFinishStoneState() +void Obj::doFinishStoneState() { - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - stw r31, 0xc(r1) - mr r31, r3 - bl doFinishStoneState__Q24Game9EnemyBaseFv - lfs f1, lbl_8051C870@sda21(r2) - mr r3, r31 - lfs f2, lbl_8051C884@sda21(r2) - li r4, 0 - lfs f3, lbl_8051C868@sda21(r2) - lfs f4, lbl_8051C888@sda21(r2) - bl - "flickStickPikmin__Q24Game9EnemyFuncFPQ24Game8CreatureffffP23Condition" - lwz r0, 0x14(r1) - lwz r31, 0xc(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ + EnemyBase::doFinishStoneState(); + EnemyFunc::flickStickPikmin(this, 1.0f, 10.0f, 0.0f, -1000.0f, nullptr); } /* @@ -930,120 +194,37 @@ void SnakeWhole::Obj::doFinishStoneState() * Address: 802CECE8 * Size: 000028 */ -void SnakeWhole::Obj::startCarcassMotion() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - li r4, 0xd - li r5, 0 - stw r0, 0x14(r1) - bl startMotion__Q24Game9EnemyBaseFiPQ28SysShape14MotionListener - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::startCarcassMotion() { startMotion(13, nullptr); } /* * --INFO-- * Address: 802CED10 * Size: 000020 */ -void SnakeWhole::Obj::doStartMovie() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - bl effectDrawOff__Q34Game10SnakeWhole3ObjFv - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::doStartMovie() { effectDrawOff(); } /* * --INFO-- * Address: 802CED30 * Size: 000020 */ -void SnakeWhole::Obj::doEndMovie() -{ - /* - stwu r1, -0x10(r1) - mflr r0 - stw r0, 0x14(r1) - bl effectDrawOn__Q34Game10SnakeWhole3ObjFv - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::doEndMovie() { effectDrawOn(); } /* * --INFO-- * Address: 802CED50 * Size: 0000BC */ -void SnakeWhole::Obj::initMouthSlots() +void Obj::initMouthSlots() { - /* - stwu r1, -0x20(r1) - mflr r0 - stw r0, 0x24(r1) - stfd f31, 0x10(r1) - psq_st f31, 24(r1), 0, qr0 - stw r31, 0xc(r1) - stw r30, 8(r1) - mr r30, r3 - lis r3, lbl_8048BB38@ha - addi r31, r3, lbl_8048BB38@l - li r4, 3 - addi r3, r30, 0x2d0 - bl alloc__10MouthSlotsFi - lwz r5, 0x174(r30) - addi r3, r30, 0x2d0 - addi r6, r31, 0x1c - li r4, 0 - bl setup__10MouthSlotsFiPQ28SysShape5ModelPc - lwz r5, 0x174(r30) - addi r3, r30, 0x2d0 - addi r6, r31, 0x28 - li r4, 1 - bl setup__10MouthSlotsFiPQ28SysShape5ModelPc - lwz r5, 0x174(r30) - addi r3, r30, 0x2d0 - addi r6, r31, 0x34 - li r4, 2 - bl setup__10MouthSlotsFiPQ28SysShape5ModelPc - lfs f31, lbl_8051C88C@sda21(r2) - li r31, 0 - b lbl_802CEDE0 + mMouthSlots.alloc(3); + mMouthSlots.setup(0, mModel, "kamujnt1"); + mMouthSlots.setup(1, mModel, "kamujnt2"); + mMouthSlots.setup(2, mModel, "kamujnt3"); -lbl_802CEDCC: - mr r4, r31 - addi r3, r30, 0x2d0 - bl getSlot__10MouthSlotsFi - stfs f31, 0x1c(r3) - addi r31, r31, 1 - -lbl_802CEDE0: - lwz r0, 0x2d0(r30) - cmpw r31, r0 - blt lbl_802CEDCC - psq_l f31, 24(r1), 0, qr0 - lwz r0, 0x24(r1) - lfd f31, 0x10(r1) - lwz r31, 0xc(r1) - lwz r30, 8(r1) - mtlr r0 - addi r1, r1, 0x20 - blr - */ + for (int i = 0; i < mMouthSlots.getMax(); i++) { + mMouthSlots.getSlot(i)->mRadius = 15.0f; + } } /* @@ -1051,41 +232,16 @@ void SnakeWhole::Obj::initMouthSlots() * Address: 802CEE0C * Size: 000058 */ -void SnakeWhole::Obj::getThrowupItemPosition(Vector3f*) -{ - /* - stwu r1, -0x10(r1) - mflr r0 - lis r5, lbl_8048BB48@ha - stw r0, 0x14(r1) - addi r0, r5, lbl_8048BB48@l - stw r31, 0xc(r1) - mr r31, r4 - mr r4, r0 - lwz r3, 0x174(r3) - bl getJoint__Q28SysShape5ModelFPc - bl getWorldMatrix__Q28SysShape5JointFv - lfs f2, 0x2c(r3) - lfs f1, 0x1c(r3) - lfs f0, 0xc(r3) - stfs f0, 0(r31) - stfs f1, 4(r31) - stfs f2, 8(r31) - lwz r31, 0xc(r1) - lwz r0, 0x14(r1) - mtlr r0 - addi r1, r1, 0x10 - blr - */ -} +void Obj::getThrowupItemPosition(Vector3f* pos) { *pos = mModel->getJoint("kutijnt1")->getWorldMatrix()->getBasis(3); } /* * --INFO-- * Address: 802CEE64 * Size: 00003C */ -void SnakeWhole::Obj::isOutTerritory() +bool Obj::isOutTerritory() { + return (sqrDistanceXZ(mPosition, mHomePosition) > SQUARE(*C_PARMS->mGeneral.mTerritoryRadius())); /* lfs f1, 0x194(r3) lfs f0, 0x1a0(r3) @@ -1110,8 +266,10 @@ void SnakeWhole::Obj::isOutTerritory() * Address: 802CEEA0 * Size: 00003C */ -void SnakeWhole::Obj::isInHomeRange() +bool Obj::isInHomeRange() { + return (sqrDistanceXZ(mPosition, mHomePosition) < SQUARE(*C_PARMS->mGeneral.mHomeRadius())); + /* lfs f1, 0x194(r3) lfs f0, 0x1a0(r3) @@ -1136,7 +294,7 @@ void SnakeWhole::Obj::isInHomeRange() * Address: 802CEEDC * Size: 0002AC */ -void SnakeWhole::Obj::setJumpMove(Vector3f&) +void Obj::setJumpMove(Vector3f&) { /* stwu r1, -0x50(r1) @@ -1346,7 +504,7 @@ void SnakeWhole::Obj::setJumpMove(Vector3f&) * Address: 802CF188 * Size: 000078 */ -void SnakeWhole::Obj::updateFace() +void Obj::updateFace() { /* stwu r1, -0x10(r1) @@ -1391,7 +549,7 @@ void SnakeWhole::Obj::updateFace() * Address: 802CF200 * Size: 000080 */ -void SnakeWhole::Obj::updateConstraint() +void Obj::updateConstraint() { /* stwu r1, -0x10(r1) @@ -1440,7 +598,7 @@ void SnakeWhole::Obj::updateConstraint() * Address: 802CF280 * Size: 000530 */ -void SnakeWhole::Obj::appearNearByTarget(Game::Creature*) +void Obj::appearNearByTarget(Creature* target) { /* stwu r1, -0xe0(r1) @@ -1809,7 +967,7 @@ void SnakeWhole::Obj::appearNearByTarget(Game::Creature*) * Address: 802CF7B0 * Size: 00020C */ -void SnakeWhole::Obj::setAttackPosition() +void Obj::setAttackPosition() { /* stwu r1, -0x90(r1) @@ -1959,7 +1117,7 @@ void SnakeWhole::Obj::setAttackPosition() * Address: 802CF9BC * Size: 0005F4 */ -void SnakeWhole::Obj::getAttackPiki(int) +Piki* Obj::getAttackPiki(int) { /* stwu r1, -0x160(r1) @@ -2383,7 +1541,7 @@ void SnakeWhole::Obj::getAttackPiki(int) * Address: 802CFFB0 * Size: 0005C8 */ -void SnakeWhole::Obj::getAttackNavi(int) +Navi* Obj::getAttackNavi(int) { /* stwu r1, -0x160(r1) @@ -2796,7 +1954,7 @@ void SnakeWhole::Obj::getAttackNavi(int) * Address: 802D0578 * Size: 000050 */ -void SnakeWhole::Obj::getSearchedTarget() +Creature* Obj::getSearchedTarget() { /* stwu r1, -0x10(r1) @@ -2832,7 +1990,7 @@ void SnakeWhole::Obj::getSearchedTarget() * Address: 802D05C8 * Size: 000068 */ -void SnakeWhole::Obj::getSwallowSlot() +CollPart* Obj::getSwallowSlot() { /* stwu r1, -0x10(r1) @@ -2877,7 +2035,7 @@ void SnakeWhole::Obj::getSwallowSlot() * Address: 802D0630 * Size: 00006C */ -void SnakeWhole::Obj::isSwallowPikmin() +bool Obj::isSwallowPikmin() { /* stwu r1, -0x10(r1) @@ -2923,7 +2081,7 @@ void SnakeWhole::Obj::isSwallowPikmin() * Address: 802D069C * Size: 00024C */ -void SnakeWhole::Obj::getStickHeadPikmin() +int Obj::getStickHeadPikmin() { /* stwu r1, -0x40(r1) @@ -3099,7 +2257,7 @@ void SnakeWhole::Obj::getStickHeadPikmin() * Address: 802D08E8 * Size: 000048 */ -void SnakeWhole::Obj::createJointCallBack() +void Obj::createJointCallBack() { /* stwu r1, -0x10(r1) @@ -3130,7 +2288,7 @@ void SnakeWhole::Obj::createJointCallBack() * Address: 802D0930 * Size: 000024 */ -void SnakeWhole::Obj::setupJointCallBack() +void Obj::setupJointCallBack() { /* stwu r1, -0x10(r1) @@ -3150,7 +2308,7 @@ void SnakeWhole::Obj::setupJointCallBack() * Address: 802D0954 * Size: 000024 */ -void SnakeWhole::Obj::doAnimationJointCallBack() +void Obj::doAnimationJointCallBack() { /* stwu r1, -0x10(r1) @@ -3170,7 +2328,7 @@ void SnakeWhole::Obj::doAnimationJointCallBack() * Address: 802D0978 * Size: 000024 */ -void SnakeWhole::Obj::finishAnimationJointCallBack() +void Obj::finishAnimationJointCallBack() { /* stwu r1, -0x10(r1) @@ -3190,7 +2348,7 @@ void SnakeWhole::Obj::finishAnimationJointCallBack() * Address: 802D099C * Size: 0000B8 */ -void SnakeWhole::Obj::startJointCallBack() +void Obj::startJointCallBack() { /* stwu r1, -0x30(r1) @@ -3247,7 +2405,7 @@ void SnakeWhole::Obj::startJointCallBack() * Address: 802D0A54 * Size: 000088 */ -void SnakeWhole::Obj::returnJointCallBack() +void Obj::returnJointCallBack() { /* stwu r1, -0x20(r1) @@ -3292,7 +2450,7 @@ void SnakeWhole::Obj::returnJointCallBack() * Address: 802D0ADC * Size: 000024 */ -void SnakeWhole::Obj::finishJointCallBack() +void Obj::finishJointCallBack() { /* stwu r1, -0x10(r1) @@ -3312,7 +2470,7 @@ void SnakeWhole::Obj::finishJointCallBack() * Address: 802D0B00 * Size: 000038 */ -void SnakeWhole::Obj::setupCollision() +void Obj::setupCollision() { /* stwu r1, -0x10(r1) @@ -3339,7 +2497,7 @@ void SnakeWhole::Obj::setupCollision() * Address: 802D0B38 * Size: 000040 */ -void SnakeWhole::Obj::lifeIncrement() +void Obj::lifeIncrement() { /* lfs f1, lbl_8051C868@sda21(r2) @@ -3366,7 +2524,7 @@ void SnakeWhole::Obj::lifeIncrement() * Address: 802D0B78 * Size: 000048 */ -void SnakeWhole::Obj::createShadowSystem() +void Obj::createShadowSystem() { /* stwu r1, -0x10(r1) @@ -3397,7 +2555,7 @@ void SnakeWhole::Obj::createShadowSystem() * Address: 802D0BC0 * Size: 000024 */ -void SnakeWhole::Obj::setupShadowSystem() +void Obj::setupShadowSystem() { /* stwu r1, -0x10(r1) @@ -3417,7 +2575,7 @@ void SnakeWhole::Obj::setupShadowSystem() * Address: 802D0BE4 * Size: 000024 */ -void SnakeWhole::Obj::doAnimationShadowSystem() +void Obj::doAnimationShadowSystem() { /* stwu r1, -0x10(r1) @@ -3437,7 +2595,7 @@ void SnakeWhole::Obj::doAnimationShadowSystem() * Address: 802D0C08 * Size: 000024 */ -void SnakeWhole::Obj::startJointShadow() +void Obj::startJointShadow() { /* stwu r1, -0x10(r1) @@ -3457,7 +2615,7 @@ void SnakeWhole::Obj::startJointShadow() * Address: 802D0C2C * Size: 000024 */ -void SnakeWhole::Obj::finishJointShadow() +void Obj::finishJointShadow() { /* stwu r1, -0x10(r1) @@ -3477,7 +2635,7 @@ void SnakeWhole::Obj::finishJointShadow() * Address: 802D0C50 * Size: 000040 */ -void SnakeWhole::Obj::deleteJointShadow() +void Obj::deleteJointShadow() { /* stwu r1, -0x10(r1) @@ -3504,7 +2662,7 @@ void SnakeWhole::Obj::deleteJointShadow() * Address: 802D0C90 * Size: 0000E0 */ -void SnakeWhole::Obj::startBossAttackBGM() +void Obj::startBossAttackBGM() { /* stwu r1, -0x10(r1) @@ -3581,7 +2739,7 @@ void SnakeWhole::Obj::startBossAttackBGM() * Address: 802D0D70 * Size: 0000C8 */ -void SnakeWhole::Obj::startBossFlickBGM() +void Obj::startBossFlickBGM() { /* stwu r1, -0x10(r1) @@ -3648,7 +2806,7 @@ void SnakeWhole::Obj::startBossFlickBGM() * Address: 802D0E38 * Size: 0000FC */ -void SnakeWhole::Obj::updateBossBGM() +void Obj::updateBossBGM() { /* stwu r1, -0x20(r1) @@ -3732,7 +2890,7 @@ void SnakeWhole::Obj::updateBossBGM() * Address: 802D0F34 * Size: 0000D0 */ -void SnakeWhole::Obj::resetBossAppearBGM() +void Obj::resetBossAppearBGM() { /* stwu r1, -0x10(r1) @@ -3803,7 +2961,7 @@ void SnakeWhole::Obj::resetBossAppearBGM() * Address: 802D1004 * Size: 0000CC */ -void SnakeWhole::Obj::setBossAppearBGM() +void Obj::setBossAppearBGM() { /* stwu r1, -0x10(r1) @@ -3873,7 +3031,7 @@ void SnakeWhole::Obj::setBossAppearBGM() * Address: 802D10D0 * Size: 000068 */ -void SnakeWhole::Obj::createEffect() +void Obj::createEffect() { /* stwu r1, -0x10(r1) @@ -3912,7 +3070,7 @@ void SnakeWhole::Obj::createEffect() * Address: 802D1138 * Size: 000078 */ -void SnakeWhole::Obj::setupEffect() +void Obj::setupEffect() { /* stwu r1, -0x10(r1) @@ -3953,7 +3111,7 @@ void SnakeWhole::Obj::setupEffect() * Address: 802D11B0 * Size: 0001D4 */ -void SnakeWhole::Obj::createAppearEffect(int) +void Obj::createAppearEffect(int) { /* stwu r1, -0x80(r1) @@ -4091,7 +3249,7 @@ void SnakeWhole::Obj::createAppearEffect(int) * Address: 802D1384 * Size: 000034 */ -void SnakeWhole::Obj::createDeadStartEffect() +void Obj::createDeadStartEffect() { /* stwu r1, -0x10(r1) @@ -4115,7 +3273,7 @@ void SnakeWhole::Obj::createDeadStartEffect() * Address: 802D13B8 * Size: 000094 */ -void SnakeWhole::Obj::createDeadFinishEffect() +void Obj::createDeadFinishEffect() { /* stwu r1, -0x30(r1) @@ -4163,7 +3321,7 @@ void SnakeWhole::Obj::createDeadFinishEffect() * Address: 802D144C * Size: 00003C */ -void SnakeWhole::Obj::createWalkSmokeEffect(float) +void Obj::createWalkSmokeEffect(float) { /* stwu r1, -0x10(r1) @@ -4193,7 +3351,7 @@ void SnakeWhole::Obj::createWalkSmokeEffect(float) * Address: 802D1488 * Size: 000030 */ -void SnakeWhole::Obj::effectDrawOn() +void Obj::effectDrawOn() { /* stwu r1, -0x10(r1) @@ -4216,7 +3374,7 @@ void SnakeWhole::Obj::effectDrawOn() * Address: 802D14B8 * Size: 000030 */ -void SnakeWhole::Obj::effectDrawOff() +void Obj::effectDrawOff() { /* stwu r1, -0x10(r1) @@ -4239,7 +3397,7 @@ void SnakeWhole::Obj::effectDrawOff() * Address: 802D14E8 * Size: 000048 */ -void SnakeWhole::Obj::createEfxHamon() +void Obj::createEfxHamon() { /* stwu r1, -0x10(r1) @@ -4270,7 +3428,7 @@ void SnakeWhole::Obj::createEfxHamon() * Address: 802D1530 * Size: 000008 */ -void SnakeWhole::Obj::isUnderground() +bool Obj::isUnderground() { /* lbz r3, 0x2c0(r3) @@ -4283,7 +3441,7 @@ void SnakeWhole::Obj::isUnderground() * Address: 802D1538 * Size: 000058 */ -void SnakeWhole::Obj::getFitEffectPos() +Vector3f* Obj::getFitEffectPos() { /* stwu r1, -0x10(r1) @@ -4316,21 +3474,21 @@ void SnakeWhole::Obj::getFitEffectPos() * Address: 802D1590 * Size: 000004 */ -void SnakeWhole::Obj::inWaterCallback(Game::WaterBox*) { } +void Obj::inWaterCallback(WaterBox*) { } /* * --INFO-- * Address: 802D1594 * Size: 000004 */ -void SnakeWhole::Obj::outWaterCallback() { } +void Obj::outWaterCallback() { } /* * --INFO-- * Address: 802D1598 * Size: 000008 */ -void SnakeWhole::Obj::getDamageCoeStoneState() +f32 Obj::getDamageCoeStoneState() { /* lfs f1, lbl_8051C8D0@sda21(r2) @@ -4343,7 +3501,7 @@ void SnakeWhole::Obj::getDamageCoeStoneState() * Address: 802D15A0 * Size: 000008 */ -void SnakeWhole::Obj::getMouthSlots() +MouthSlots* Obj::getMouthSlots() { /* addi r3, r3, 0x2d0 @@ -4356,14 +3514,14 @@ void SnakeWhole::Obj::getMouthSlots() * Address: 802D15A8 * Size: 000004 */ -void SnakeWhole::Obj::throwupItemInDeathProcedure() { } +void Obj::throwupItemInDeathProcedure() { } /* * --INFO-- * Address: 802D15AC * Size: 000008 */ -void SnakeWhole::Obj::getDownSmokeScale() +f32 Obj::getDownSmokeScale() { /* lfs f1, lbl_8051C8D4@sda21(r2) @@ -4376,101 +3534,7 @@ void SnakeWhole::Obj::getDownSmokeScale() * Address: 802D15B4 * Size: 000008 */ -u32 SnakeWhole::Obj::getEnemyTypeID() { return 0x46; } +EnemyTypeID::EEnemyTypeID Obj::getEnemyTypeID() { return EnemyTypeID::EnemyID_SnakeWhole; } -/* - * --INFO-- - * Address: 802D15BC - * Size: 000014 - */ -void EnemyBase::@816 @12 @viewOnPelletKilled() -{ - /* - li r11, 0xc - lwzx r11, r3, r11 - add r3, r3, r11 - addi r3, r3, -816 - b viewOnPelletKilled__Q24Game9EnemyBaseFv - */ -} - -/* - * --INFO-- - * Address: 802D15D0 - * Size: 000014 - */ -void EnemyBase::@816 @12 @viewStartCarryMotion() -{ - /* - li r11, 0xc - lwzx r11, r3, r11 - add r3, r3, r11 - addi r3, r3, -816 - b viewStartCarryMotion__Q24Game9EnemyBaseFv - */ -} - -/* - * --INFO-- - * Address: 802D15E4 - * Size: 000014 - */ -void EnemyBase::@816 @12 @viewStartPreCarryMotion() -{ - /* - li r11, 0xc - lwzx r11, r3, r11 - add r3, r3, r11 - addi r3, r3, -816 - b viewStartPreCarryMotion__Q24Game9EnemyBaseFv - */ -} - -/* - * --INFO-- - * Address: 802D15F8 - * Size: 000014 - */ -void EnemyBase::@816 @12 @view_finish_carrymotion() -{ - /* - li r11, 0xc - lwzx r11, r3, r11 - add r3, r3, r11 - addi r3, r3, -816 - b view_finish_carrymotion__Q24Game9EnemyBaseFv - */ -} - -/* - * --INFO-- - * Address: 802D160C - * Size: 000014 - */ -void EnemyBase::@816 @12 @view_start_carrymotion() -{ - /* - li r11, 0xc - lwzx r11, r3, r11 - add r3, r3, r11 - addi r3, r3, -816 - b view_start_carrymotion__Q24Game9EnemyBaseFv - */ -} - -/* - * --INFO-- - * Address: 802D1620 - * Size: 000014 - */ -void EnemyBase::@816 @12 @viewGetShape() -{ - /* - li r11, 0xc - lwzx r11, r3, r11 - add r3, r3, r11 - addi r3, r3, -816 - b viewGetShape__Q24Game9EnemyBaseFv - */ -} +} // namespace SnakeWhole } // namespace Game diff --git a/src/plugProjectNishimuraU/SnakeWholeState.cpp b/src/plugProjectNishimuraU/SnakeWholeState.cpp index 8ed65e11f..32f2d87f9 100644 --- a/src/plugProjectNishimuraU/SnakeWholeState.cpp +++ b/src/plugProjectNishimuraU/SnakeWholeState.cpp @@ -140,7 +140,7 @@ void StateStay::exec(EnemyBase* enemy) Obj* snagret = static_cast(enemy); Creature* target = nullptr; Parms* parms = static_cast(snagret->mParms); - if (snagret->mStateTimer > parms->mProperParms.mFp12.mValue) { + if (snagret->mStateTimer > parms->mProperParms.mUndergroundTime.mValue) { f32 territory = parms->mGeneral.mTerritoryRadius.mValue; Vector3f homePos = Vector3f(snagret->mHomePosition); f32 tSqr = territory * territory; @@ -205,7 +205,7 @@ void StateStay::exec(EnemyBase* enemy) snagret->appearNearByTarget(target); snagret->setBossAppearBGM(); Parms* parms = static_cast(snagret->mParms); - if (randWeightFloat(1.0f) < parms->mProperParms.mFp01.mValue) { + if (randWeightFloat(1.0f) < parms->mProperParms.mFastAppearChance.mValue) { transit(snagret, SNAKEWHOLE_Appear1, nullptr); } else { transit(snagret, SNAKEWHOLE_Appear2, nullptr); @@ -975,7 +975,7 @@ void StateWait::exec(EnemyBase* enemy) snagret->mNextState = SNAKEWHOLE_Dead; snagret->finishMotion(); } else if (EnemyFunc::isStartFlick(snagret, false) - || snagret->mStateTimer > static_cast(snagret->mParms)->mProperParms.mFp11.mValue) { + || snagret->mStateTimer > static_cast(snagret->mParms)->mProperParms.mWaitTime.mValue) { snagret->mNextState = SNAKEWHOLE_Disappear; snagret->finishMotion(); } else if (snagret->isOutTerritory()) { @@ -1174,7 +1174,7 @@ void StateAttack::init(EnemyBase* enemy, StateArg* stateArg) Obj* snagret = static_cast(enemy); snagret->disableEvent(0, EB_Cullable); snagret->mTargetVelocity = Vector3f(0.0f); - snagret->startMotion(snagret->_2E4 + 4, nullptr); + snagret->startMotion(snagret->mAttackAnimIdx + 4, nullptr); } /* @@ -1198,7 +1198,7 @@ void StateAttack::exec(EnemyBase* enemy) snagret->startJointCallBack(); } else if ((u32)snagret->mCurAnim->mType == KEYEVENT_3) { - int idx = snagret->_2E4; + int idx = snagret->mAttackAnimIdx; Piki* piki = snagret->getAttackPiki(idx); if (piki) { @@ -1225,7 +1225,7 @@ void StateAttack::exec(EnemyBase* enemy) if (!snagret->isFinishMotion() && snagret->getSwallowSlot()) { if (snagret->getAttackPiki(5) != nullptr || snagret->getAttackNavi(5)) { - snagret->startMotion(snagret->_2E4 + 4, nullptr); + snagret->startMotion(snagret->mAttackAnimIdx + 4, nullptr); snagret->setMotionFrame(snagret->getFirstKeyFrame()); snagret->startJointCallBack();