mirror of https://github.com/PrimeDecomp/prime.git
Match and link CBSDie
This commit is contained in:
parent
3c1358dab1
commit
8996496d00
|
@ -3,8 +3,8 @@
|
||||||
.section .data
|
.section .data
|
||||||
.balign 8
|
.balign 8
|
||||||
|
|
||||||
.global lbl_803E13A8
|
.global __vt__6CBSDie
|
||||||
lbl_803E13A8:
|
__vt__6CBSDie:
|
||||||
# ROM: 0x3DE3A8
|
# ROM: 0x3DE3A8
|
||||||
.4byte 0
|
.4byte 0
|
||||||
.4byte 0
|
.4byte 0
|
||||||
|
@ -31,8 +31,8 @@ __dt__6CBSDieFv:
|
||||||
/* 80135658 001325B8 93 E1 00 0C */ stw r31, 0xc(r1)
|
/* 80135658 001325B8 93 E1 00 0C */ stw r31, 0xc(r1)
|
||||||
/* 8013565C 001325BC 7C 7F 1B 79 */ or. r31, r3, r3
|
/* 8013565C 001325BC 7C 7F 1B 79 */ or. r31, r3, r3
|
||||||
/* 80135660 001325C0 41 82 00 30 */ beq lbl_80135690
|
/* 80135660 001325C0 41 82 00 30 */ beq lbl_80135690
|
||||||
/* 80135664 001325C4 3C 60 80 3E */ lis r3, lbl_803E13A8@ha
|
/* 80135664 001325C4 3C 60 80 3E */ lis r3, __vt__6CBSDie@ha
|
||||||
/* 80135668 001325C8 38 03 13 A8 */ addi r0, r3, lbl_803E13A8@l
|
/* 80135668 001325C8 38 03 13 A8 */ addi r0, r3, __vt__6CBSDie@l
|
||||||
/* 8013566C 001325CC 90 1F 00 00 */ stw r0, 0(r31)
|
/* 8013566C 001325CC 90 1F 00 00 */ stw r0, 0(r31)
|
||||||
/* 80135670 001325D0 41 82 00 10 */ beq lbl_80135680
|
/* 80135670 001325D0 41 82 00 10 */ beq lbl_80135680
|
||||||
/* 80135674 001325D4 3C 60 80 3E */ lis r3, __vt__10CBodyState@ha
|
/* 80135674 001325D4 3C 60 80 3E */ lis r3, __vt__10CBodyState@ha
|
||||||
|
@ -232,11 +232,11 @@ lbl_801358F0:
|
||||||
.global __ct__6CBSDieFv
|
.global __ct__6CBSDieFv
|
||||||
__ct__6CBSDieFv:
|
__ct__6CBSDieFv:
|
||||||
/* 8013590C 0013286C 3C A0 80 3E */ lis r5, __vt__10CBodyState@ha
|
/* 8013590C 0013286C 3C A0 80 3E */ lis r5, __vt__10CBodyState@ha
|
||||||
/* 80135910 00132870 3C 80 80 3E */ lis r4, lbl_803E13A8@ha
|
/* 80135910 00132870 3C 80 80 3E */ lis r4, __vt__6CBSDie@ha
|
||||||
/* 80135914 00132874 38 05 13 18 */ addi r0, r5, __vt__10CBodyState@l
|
/* 80135914 00132874 38 05 13 18 */ addi r0, r5, __vt__10CBodyState@l
|
||||||
/* 80135918 00132878 C0 02 99 B0 */ lfs f0, lbl_805AB6D0@sda21(r2)
|
/* 80135918 00132878 C0 02 99 B0 */ lfs f0, lbl_805AB6D0@sda21(r2)
|
||||||
/* 8013591C 0013287C 90 03 00 00 */ stw r0, 0(r3)
|
/* 8013591C 0013287C 90 03 00 00 */ stw r0, 0(r3)
|
||||||
/* 80135920 00132880 38 84 13 A8 */ addi r4, r4, lbl_803E13A8@l
|
/* 80135920 00132880 38 84 13 A8 */ addi r4, r4, __vt__6CBSDie@l
|
||||||
/* 80135924 00132884 38 00 00 00 */ li r0, 0
|
/* 80135924 00132884 38 00 00 00 */ li r0, 0
|
||||||
/* 80135928 00132888 90 83 00 00 */ stw r4, 0(r3)
|
/* 80135928 00132888 90 83 00 00 */ stw r4, 0(r3)
|
||||||
/* 8013592C 0013288C D0 03 00 04 */ stfs f0, 4(r3)
|
/* 8013592C 0013288C D0 03 00 04 */ stfs f0, 4(r3)
|
||||||
|
|
|
@ -185,7 +185,7 @@ LIBS = [
|
||||||
"MetroidPrime/BodyState/CBodyStateCmdMgr",
|
"MetroidPrime/BodyState/CBodyStateCmdMgr",
|
||||||
["MetroidPrime/BodyState/CBodyStateInfo", False],
|
["MetroidPrime/BodyState/CBodyStateInfo", False],
|
||||||
"MetroidPrime/BodyState/CBSAttack",
|
"MetroidPrime/BodyState/CBSAttack",
|
||||||
"MetroidPrime/BodyState/CBSDie",
|
["MetroidPrime/BodyState/CBSDie", True],
|
||||||
"MetroidPrime/BodyState/CBSFall",
|
"MetroidPrime/BodyState/CBSFall",
|
||||||
"MetroidPrime/BodyState/CBSGetup",
|
"MetroidPrime/BodyState/CBSGetup",
|
||||||
"MetroidPrime/BodyState/CBSKnockBack",
|
"MetroidPrime/BodyState/CBSKnockBack",
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
#ifndef _CBSDIE
|
||||||
|
#define _CBSDIE
|
||||||
|
|
||||||
|
#include "MetroidPrime/BodyState/CBodyState.hpp"
|
||||||
|
|
||||||
|
class CBSDie : public CBodyState {
|
||||||
|
public:
|
||||||
|
CBSDie();
|
||||||
|
~CBSDie();
|
||||||
|
|
||||||
|
bool IsDead() const override;
|
||||||
|
bool IsDying() const override;
|
||||||
|
void Start(CBodyController& bc, CStateManager& mgr) override;
|
||||||
|
pas::EAnimationState UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) override;
|
||||||
|
void Shutdown(CBodyController&) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
float x4_remTime;
|
||||||
|
bool x8_isDead;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // _CBSDIE
|
|
@ -24,9 +24,12 @@ public:
|
||||||
void SetDeltaRotation(const CQuaternion& q);
|
void SetDeltaRotation(const CQuaternion& q);
|
||||||
void SetCurrentAnimation(const CAnimPlaybackParms& parms, bool loop, bool noTrans);
|
void SetCurrentAnimation(const CAnimPlaybackParms& parms, bool loop, bool noTrans);
|
||||||
void FaceDirection(const CVector3f& v0, float dt);
|
void FaceDirection(const CVector3f& v0, float dt);
|
||||||
|
void EnableAnimation(bool enable);
|
||||||
|
|
||||||
bool IsAnimationOver() const { return x300_24_animationOver; }
|
pas::EFallState GetFallState() const; // { return x2f0_fallState; }
|
||||||
pas::ELocomotionType GetLocomotionType() const { return x2ec_locomotionType; }
|
pas::ELocomotionType GetLocomotionType() const { return x2ec_locomotionType; }
|
||||||
|
bool IsAnimationOver() const { return x300_24_animationOver; }
|
||||||
|
bool ShouldPlayDeathAnims() const { return x300_28_playDeathAnims; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CActor& x0_actor;
|
CActor& x0_actor;
|
||||||
|
@ -39,6 +42,10 @@ private:
|
||||||
int x2f8_curAnim ;
|
int x2f8_curAnim ;
|
||||||
float x2fc_turnSpeed;
|
float x2fc_turnSpeed;
|
||||||
bool x300_24_animationOver : 1;
|
bool x300_24_animationOver : 1;
|
||||||
|
bool x300_25_active : 1;
|
||||||
|
bool x300_26_frozen : 1;
|
||||||
|
bool x300_27_hasBeenFrozen : 1;
|
||||||
|
bool x300_28_playDeathAnims : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // _CBODYCONTROLLER
|
#endif // _CBODYCONTROLLER
|
||||||
|
|
|
@ -150,7 +150,7 @@ METROIDPRIME :=\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBodyStateCmdMgr.o\
|
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBodyStateCmdMgr.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBodyStateInfo.o\
|
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBodyStateInfo.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSAttack.o\
|
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSAttack.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSDie.o\
|
$(BUILD_DIR)/src/MetroidPrime/BodyState/CBSDie.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSFall.o\
|
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSFall.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSGetup.o\
|
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSGetup.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSKnockBack.o\
|
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSKnockBack.o\
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#include "MetroidPrime/BodyState/CBSDie.hpp"
|
||||||
|
|
||||||
|
#include "MetroidPrime/CStateManager.hpp"
|
||||||
|
#include "MetroidPrime/CAnimPlaybackParms.hpp"
|
||||||
|
#include "MetroidPrime/BodyState/CBodyController.hpp"
|
||||||
|
|
||||||
|
#include "Kyoto/Animation/CPASAnimParmData.hpp"
|
||||||
|
#include "Kyoto/Animation/CPASDatabase.hpp"
|
||||||
|
|
||||||
|
CBSDie::CBSDie() : x4_remTime(0.0f), x8_isDead(false) {}
|
||||||
|
|
||||||
|
void CBSDie::Start(CBodyController& bc, CStateManager& mgr) override {
|
||||||
|
const CPASDatabase& db = bc.GetPASDatabase();
|
||||||
|
int fallState = bc.GetFallState();
|
||||||
|
|
||||||
|
bool shouldReset = true;
|
||||||
|
|
||||||
|
if (bc.ShouldPlayDeathAnims()) {
|
||||||
|
const CPASAnimParmData parms(pas::kAS_Death, CPASAnimParm::FromEnum(fallState));
|
||||||
|
const rstl::pair<float, int> best = db.FindBestAnimation(parms, *mgr.Random(), -1);
|
||||||
|
if (best.first > 0.f) {
|
||||||
|
const CAnimPlaybackParms playParms(best.second, -1, 1.f, true);
|
||||||
|
bc.SetCurrentAnimation(playParms, false, false);
|
||||||
|
x4_remTime = bc.GetAnimTimeRemaining();
|
||||||
|
shouldReset = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (shouldReset) {
|
||||||
|
bc.EnableAnimation(false);
|
||||||
|
x4_remTime = bc.ShouldPlayDeathAnims() ? 3.f : 4.f;
|
||||||
|
}
|
||||||
|
|
||||||
|
x8_isDead = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pas::EAnimationState CBSDie::UpdateBody(float dt, CBodyController& bc,
|
||||||
|
CStateManager& mgr) override {
|
||||||
|
x4_remTime -= dt;
|
||||||
|
if (x4_remTime <= 0.f) {
|
||||||
|
bc.EnableAnimation(false);
|
||||||
|
x8_isDead = true;
|
||||||
|
}
|
||||||
|
return pas::kAS_Invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CBSDie::Shutdown(CBodyController&) override {}
|
||||||
|
|
||||||
|
bool CBSDie::IsDying() const override { return true; }
|
||||||
|
|
||||||
|
bool CBSDie::IsDead() const override { return x8_isDead; }
|
||||||
|
|
||||||
|
CBSDie::~CBSDie() {}
|
Loading…
Reference in New Issue