Match and link CBSTaunt

Former-commit-id: 9c26f252bb
This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-28 14:34:03 +03:00
parent 7c7f523da0
commit 1a369240b2
7 changed files with 100 additions and 11 deletions

View File

@ -3,8 +3,8 @@
.section .data .section .data
.balign 8 .balign 8
.global lbl_803E2390 .global __vt__8CBSTaunt
lbl_803E2390: __vt__8CBSTaunt:
# ROM: 0x3DF390 # ROM: 0x3DF390
.4byte 0 .4byte 0
.4byte 0 .4byte 0
@ -31,8 +31,8 @@ __dt__8CBSTauntFv:
/* 801492BC 0014621C 93 E1 00 0C */ stw r31, 0xc(r1) /* 801492BC 0014621C 93 E1 00 0C */ stw r31, 0xc(r1)
/* 801492C0 00146220 7C 7F 1B 79 */ or. r31, r3, r3 /* 801492C0 00146220 7C 7F 1B 79 */ or. r31, r3, r3
/* 801492C4 00146224 41 82 00 30 */ beq lbl_801492F4 /* 801492C4 00146224 41 82 00 30 */ beq lbl_801492F4
/* 801492C8 00146228 3C 60 80 3E */ lis r3, lbl_803E2390@ha /* 801492C8 00146228 3C 60 80 3E */ lis r3, __vt__8CBSTaunt@ha
/* 801492CC 0014622C 38 03 23 90 */ addi r0, r3, lbl_803E2390@l /* 801492CC 0014622C 38 03 23 90 */ addi r0, r3, __vt__8CBSTaunt@l
/* 801492D0 00146230 90 1F 00 00 */ stw r0, 0(r31) /* 801492D0 00146230 90 1F 00 00 */ stw r0, 0(r31)
/* 801492D4 00146234 41 82 00 10 */ beq lbl_801492E4 /* 801492D4 00146234 41 82 00 10 */ beq lbl_801492E4
/* 801492D8 00146238 3C 60 80 3E */ lis r3, __vt__10CBodyState@ha /* 801492D8 00146238 3C 60 80 3E */ lis r3, __vt__10CBodyState@ha
@ -251,10 +251,10 @@ lbl_8014959C:
.global __ct__8CBSTauntFv .global __ct__8CBSTauntFv
__ct__8CBSTauntFv: __ct__8CBSTauntFv:
/* 801495B8 00146518 3C A0 80 3E */ lis r5, __vt__10CBodyState@ha /* 801495B8 00146518 3C A0 80 3E */ lis r5, __vt__10CBodyState@ha
/* 801495BC 0014651C 3C 80 80 3E */ lis r4, lbl_803E2390@ha /* 801495BC 0014651C 3C 80 80 3E */ lis r4, __vt__8CBSTaunt@ha
/* 801495C0 00146520 38 A5 13 18 */ addi r5, r5, __vt__10CBodyState@l /* 801495C0 00146520 38 A5 13 18 */ addi r5, r5, __vt__10CBodyState@l
/* 801495C4 00146524 90 A3 00 00 */ stw r5, 0(r3) /* 801495C4 00146524 90 A3 00 00 */ stw r5, 0(r3)
/* 801495C8 00146528 38 04 23 90 */ addi r0, r4, lbl_803E2390@l /* 801495C8 00146528 38 04 23 90 */ addi r0, r4, __vt__8CBSTaunt@l
/* 801495CC 0014652C 90 03 00 00 */ stw r0, 0(r3) /* 801495CC 0014652C 90 03 00 00 */ stw r0, 0(r3)
/* 801495D0 00146530 4E 80 00 20 */ blr /* 801495D0 00146530 4E 80 00 20 */ blr

View File

@ -206,7 +206,7 @@ LIBS = [
"MetroidPrime/BodyState/CBSJump", "MetroidPrime/BodyState/CBSJump",
["MetroidPrime/BodyState/CBSGenerate", True], ["MetroidPrime/BodyState/CBSGenerate", True],
"MetroidPrime/Enemies/CPuddleSpore", "MetroidPrime/Enemies/CPuddleSpore",
"MetroidPrime/BodyState/CBSTaunt", ["MetroidPrime/BodyState/CBSTaunt", True],
"MetroidPrime/CSortedLists", "MetroidPrime/CSortedLists",
["MetroidPrime/ScriptObjects/CScriptDebugCameraWaypoint", True], ["MetroidPrime/ScriptObjects/CScriptDebugCameraWaypoint", True],
["MetroidPrime/ScriptObjects/CScriptSpiderBallAttractionSurface", False], ["MetroidPrime/ScriptObjects/CScriptSpiderBallAttractionSurface", False],

View File

@ -0,0 +1,20 @@
#ifndef _CBSTAUNT
#define _CBSTAUNT
#include "MetroidPrime/BodyState/CBodyState.hpp"
class CBSTaunt : public CBodyState {
public:
CBSTaunt();
~CBSTaunt();
void Start(CBodyController& bc, CStateManager& mgr) override;
pas::EAnimationState UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) override;
void Shutdown(CBodyController&) override;
private:
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc);
};
#endif // _CBSTAUNT

View File

@ -10,6 +10,8 @@ class CActor;
class CPASDatabase; class CPASDatabase;
class CQuaternion; class CQuaternion;
class CAnimPlaybackParms; class CAnimPlaybackParms;
class CPASAnimParmData;
class CRandom16;
class CBodyController { class CBodyController {
@ -25,6 +27,7 @@ public:
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); void EnableAnimation(bool enable);
void PlayBestAnimation(const CPASAnimParmData& parms, CRandom16& r);
void SetFallState(pas::EFallState state); // { x2f0_fallState = state; } void SetFallState(pas::EFallState state); // { x2f0_fallState = state; }
pas::EFallState GetFallState() const; // { return x2f0_fallState; } pas::EFallState GetFallState() const; // { return x2f0_fallState; }

View File

@ -86,13 +86,26 @@ public:
// //
class CBCGetupCmd : public CBodyStateCmd { class CBCTauntCmd : public CBodyStateCmd {
pas::EGetupType x8_type; public:
explicit CBCTauntCmd() : CBodyStateCmd(kBSC_Taunt), x8_type(pas::kTT_Invalid) {}
explicit CBCTauntCmd(pas::ETauntType type) : CBodyStateCmd(kBSC_Taunt), x8_type(type) {}
pas::ETauntType GetTauntType() const { return x8_type; }
private:
pas::ETauntType x8_type;
};
//
class CBCGetupCmd : public CBodyStateCmd {
public: public:
explicit CBCGetupCmd() : CBodyStateCmd(kBSC_Getup), x8_type(pas::kGetup_Invalid) {} explicit CBCGetupCmd() : CBodyStateCmd(kBSC_Getup), x8_type(pas::kGetup_Invalid) {}
explicit CBCGetupCmd(pas::EGetupType type) : CBodyStateCmd(kBSC_Getup), x8_type(type) {} explicit CBCGetupCmd(pas::EGetupType type) : CBodyStateCmd(kBSC_Getup), x8_type(type) {}
pas::EGetupType GetGetupType() const { return x8_type; } pas::EGetupType GetGetupType() const { return x8_type; }
private:
pas::EGetupType x8_type;
}; };
// //

View File

@ -171,7 +171,7 @@ METROIDPRIME :=\
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSJump.o\ $(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSJump.o\
$(BUILD_DIR)/src/MetroidPrime/BodyState/CBSGenerate.o\ $(BUILD_DIR)/src/MetroidPrime/BodyState/CBSGenerate.o\
$(BUILD_DIR)/asm/MetroidPrime/Enemies/CPuddleSpore.o\ $(BUILD_DIR)/asm/MetroidPrime/Enemies/CPuddleSpore.o\
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSTaunt.o\ $(BUILD_DIR)/src/MetroidPrime/BodyState/CBSTaunt.o\
$(BUILD_DIR)/asm/MetroidPrime/CSortedLists.o\ $(BUILD_DIR)/asm/MetroidPrime/CSortedLists.o\
$(BUILD_DIR)/src/MetroidPrime/ScriptObjects/CScriptDebugCameraWaypoint.o\ $(BUILD_DIR)/src/MetroidPrime/ScriptObjects/CScriptDebugCameraWaypoint.o\
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptSpiderBallAttractionSurface.o\ $(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptSpiderBallAttractionSurface.o\

View File

@ -0,0 +1,53 @@
#include "MetroidPrime/BodyState/CBSTaunt.hpp"
#include "MetroidPrime/CStateManager.hpp"
#include "MetroidPrime/BodyState/CBodyController.hpp"
#include "Kyoto/Animation/CPASAnimParmData.hpp"
CBSTaunt::CBSTaunt() {}
void CBSTaunt::Start(CBodyController& bc, CStateManager& mgr) {
const CBCTauntCmd* cmd = static_cast<const CBCTauntCmd*>(bc.CommandMgr().GetCmd(kBSC_Taunt));
const CPASAnimParmData parms(pas::kAS_Taunt, CPASAnimParm::FromEnum(cmd->GetTauntType()));
bc.PlayBestAnimation(parms, *mgr.Random());
}
pas::EAnimationState CBSTaunt::UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) {
const pas::EAnimationState st = GetBodyStateTransition(dt, bc);
if (st == pas::kAS_Invalid) {
CBodyStateCmdMgr& cmdMgr = bc.CommandMgr();
if (cmdMgr.GetTargetVector().IsNonZero()) {
bc.FaceDirection(cmdMgr.GetTargetVector(), dt);
}
}
return st;
}
void CBSTaunt::Shutdown(CBodyController&) override {}
pas::EAnimationState CBSTaunt::GetBodyStateTransition(float dt, CBodyController& bc) {
CBodyStateCmdMgr& cmdMgr = bc.CommandMgr();
if (cmdMgr.GetCmd(kBSC_Hurled)) {
return pas::kAS_Hurled;
}
if (cmdMgr.GetCmd(kBSC_KnockDown)) {
return pas::kAS_Fall;
}
if (cmdMgr.GetCmd(kBSC_LoopHitReaction)) {
return pas::kAS_LoopReaction;
}
if (cmdMgr.GetCmd(kBSC_KnockBack)) {
return pas::kAS_KnockBack;
}
if (cmdMgr.GetCmd(kBSC_Locomotion)) {
return pas::kAS_Locomotion;
}
if (bc.IsAnimationOver()) {
return pas::kAS_Locomotion;
}
return pas::kAS_Invalid;
}
CBSTaunt::~CBSTaunt() {}