mirror of https://github.com/PrimeDecomp/prime.git
Match and link CBSStep
This commit is contained in:
parent
9c26f252bb
commit
1f6f501f86
|
@ -3,8 +3,8 @@
|
|||
.section .data
|
||||
.balign 8
|
||||
|
||||
.global lbl_803E1718
|
||||
lbl_803E1718:
|
||||
.global __vt__7CBSStep
|
||||
__vt__7CBSStep:
|
||||
# ROM: 0x3DE718
|
||||
.4byte 0
|
||||
.4byte 0
|
||||
|
@ -31,8 +31,8 @@ __dt__7CBSStepFv:
|
|||
/* 80138DB0 00135D10 93 E1 00 0C */ stw r31, 0xc(r1)
|
||||
/* 80138DB4 00135D14 7C 7F 1B 79 */ or. r31, r3, r3
|
||||
/* 80138DB8 00135D18 41 82 00 30 */ beq lbl_80138DE8
|
||||
/* 80138DBC 00135D1C 3C 60 80 3E */ lis r3, lbl_803E1718@ha
|
||||
/* 80138DC0 00135D20 38 03 17 18 */ addi r0, r3, lbl_803E1718@l
|
||||
/* 80138DBC 00135D1C 3C 60 80 3E */ lis r3, __vt__7CBSStep@ha
|
||||
/* 80138DC0 00135D20 38 03 17 18 */ addi r0, r3, __vt__7CBSStep@l
|
||||
/* 80138DC4 00135D24 90 1F 00 00 */ stw r0, 0(r31)
|
||||
/* 80138DC8 00135D28 41 82 00 10 */ beq lbl_80138DD8
|
||||
/* 80138DCC 00135D2C 3C 60 80 3E */ lis r3, __vt__10CBodyState@ha
|
||||
|
@ -329,10 +329,10 @@ lbl_80139188:
|
|||
.global __ct__7CBSStepFv
|
||||
__ct__7CBSStepFv:
|
||||
/* 801391A8 00136108 3C A0 80 3E */ lis r5, __vt__10CBodyState@ha
|
||||
/* 801391AC 0013610C 3C 80 80 3E */ lis r4, lbl_803E1718@ha
|
||||
/* 801391AC 0013610C 3C 80 80 3E */ lis r4, __vt__7CBSStep@ha
|
||||
/* 801391B0 00136110 38 A5 13 18 */ addi r5, r5, __vt__10CBodyState@l
|
||||
/* 801391B4 00136114 90 A3 00 00 */ stw r5, 0(r3)
|
||||
/* 801391B8 00136118 38 04 17 18 */ addi r0, r4, lbl_803E1718@l
|
||||
/* 801391B8 00136118 38 04 17 18 */ addi r0, r4, __vt__7CBSStep@l
|
||||
/* 801391BC 0013611C 90 03 00 00 */ stw r0, 0(r3)
|
||||
/* 801391C0 00136120 4E 80 00 20 */ blr
|
||||
|
||||
|
|
|
@ -191,7 +191,7 @@ LIBS = [
|
|||
"MetroidPrime/BodyState/CBSKnockBack",
|
||||
["MetroidPrime/BodyState/CBSLieOnGround", True],
|
||||
"MetroidPrime/BodyState/CBSLocomotion",
|
||||
"MetroidPrime/BodyState/CBSStep",
|
||||
["MetroidPrime/BodyState/CBSStep", True],
|
||||
"MetroidPrime/BodyState/CBSTurn",
|
||||
"MetroidPrime/BodyState/CBodyController",
|
||||
"MetroidPrime/BodyState/CBSLoopAttack",
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef _CBSSTEP
|
||||
#define _CBSSTEP
|
||||
|
||||
#include "MetroidPrime/BodyState/CBodyState.hpp"
|
||||
|
||||
class CBSStep : public CBodyState {
|
||||
public:
|
||||
CBSStep();
|
||||
~CBSStep();
|
||||
|
||||
void Start(CBodyController& bc, CStateManager& mgr) override;
|
||||
pas::EAnimationState UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) override;
|
||||
void Shutdown(CBodyController&) override;
|
||||
bool IsMoving() const override;
|
||||
bool CanShoot() const override;
|
||||
|
||||
private:
|
||||
pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc);
|
||||
};
|
||||
|
||||
#endif // _CBSSTEP
|
|
@ -86,6 +86,24 @@ public:
|
|||
|
||||
//
|
||||
|
||||
class CBCStepCmd : public CBodyStateCmd {
|
||||
public:
|
||||
explicit CBCStepCmd()
|
||||
: CBodyStateCmd(kBSC_Step), x8_dir(pas::kSD_Invalid), xc_type(pas::kStep_Normal) {}
|
||||
|
||||
explicit CBCStepCmd(pas::EStepDirection dir, pas::EStepType type)
|
||||
: CBodyStateCmd(kBSC_Step), x8_dir(dir), xc_type(type) {}
|
||||
|
||||
pas::EStepDirection GetStepDirection() const { return x8_dir; }
|
||||
pas::EStepType GetStepType() const { return xc_type; }
|
||||
|
||||
private:
|
||||
pas::EStepDirection x8_dir;
|
||||
pas::EStepType xc_type;
|
||||
};
|
||||
|
||||
//
|
||||
|
||||
class CBCTauntCmd : public CBodyStateCmd {
|
||||
public:
|
||||
explicit CBCTauntCmd() : CBodyStateCmd(kBSC_Taunt), x8_type(pas::kTT_Invalid) {}
|
||||
|
|
|
@ -156,7 +156,7 @@ METROIDPRIME :=\
|
|||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSKnockBack.o\
|
||||
$(BUILD_DIR)/src/MetroidPrime/BodyState/CBSLieOnGround.o\
|
||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSLocomotion.o\
|
||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSStep.o\
|
||||
$(BUILD_DIR)/src/MetroidPrime/BodyState/CBSStep.o\
|
||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSTurn.o\
|
||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBodyController.o\
|
||||
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBSLoopAttack.o\
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
#include "MetroidPrime/BodyState/CBSStep.hpp"
|
||||
|
||||
#include "MetroidPrime/BodyState/CBodyController.hpp"
|
||||
#include "MetroidPrime/CStateManager.hpp"
|
||||
|
||||
|
||||
#include "Kyoto/Animation/CPASAnimParmData.hpp"
|
||||
|
||||
CBSStep::CBSStep() {}
|
||||
|
||||
void CBSStep::Start(CBodyController& bc, CStateManager& mgr) {
|
||||
const CBCStepCmd* cmd = static_cast< const CBCStepCmd* >(bc.CommandMgr().GetCmd(kBSC_Step));
|
||||
const CPASAnimParmData parms(pas::kAS_Step, CPASAnimParm::FromEnum(cmd->GetStepDirection()),
|
||||
CPASAnimParm::FromEnum(cmd->GetStepType()));
|
||||
bc.PlayBestAnimation(parms, *mgr.Random());
|
||||
}
|
||||
|
||||
pas::EAnimationState CBSStep::UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) {
|
||||
const pas::EAnimationState st = GetBodyStateTransition(dt, bc);
|
||||
if (st == pas::kAS_Invalid) {
|
||||
CBodyStateCmdMgr& commandMgr = bc.CommandMgr();
|
||||
if (commandMgr.GetTargetVector().IsNonZero()) {
|
||||
bc.FaceDirection(commandMgr.GetTargetVector(), dt);
|
||||
}
|
||||
}
|
||||
return st;
|
||||
}
|
||||
|
||||
void CBSStep::Shutdown(CBodyController&) override {}
|
||||
|
||||
pas::EAnimationState CBSStep::GetBodyStateTransition(float dt, CBodyController& bc) {
|
||||
CBodyStateCmdMgr& commandMgr = bc.CommandMgr();
|
||||
|
||||
if (commandMgr.GetCmd(kBSC_Hurled)) {
|
||||
return pas::kAS_Hurled;
|
||||
}
|
||||
if (commandMgr.GetCmd(kBSC_KnockDown)) {
|
||||
return pas::kAS_Fall;
|
||||
}
|
||||
if (commandMgr.GetCmd(kBSC_LoopHitReaction)) {
|
||||
return pas::kAS_LoopReaction;
|
||||
}
|
||||
if (commandMgr.GetCmd(kBSC_KnockBack)) {
|
||||
return pas::kAS_KnockBack;
|
||||
}
|
||||
if (commandMgr.GetCmd(kBSC_Locomotion)) {
|
||||
return pas::kAS_Locomotion;
|
||||
}
|
||||
if (commandMgr.GetCmd(kBSC_Generate)) {
|
||||
return pas::kAS_Generate;
|
||||
}
|
||||
if (commandMgr.GetCmd(kBSC_MeleeAttack)) {
|
||||
return pas::kAS_MeleeAttack;
|
||||
}
|
||||
if (commandMgr.GetCmd(kBSC_ProjectileAttack)) {
|
||||
return pas::kAS_ProjectileAttack;
|
||||
}
|
||||
if (commandMgr.GetCmd(kBSC_LoopAttack)) {
|
||||
return pas::kAS_LoopAttack;
|
||||
}
|
||||
if (commandMgr.GetCmd(kBSC_Jump)) {
|
||||
return pas::kAS_Jump;
|
||||
}
|
||||
if (commandMgr.GetCmd(kBSC_LoopReaction)) {
|
||||
return pas::kAS_LoopReaction;
|
||||
}
|
||||
if (commandMgr.GetCmd(kBSC_Scripted)) {
|
||||
return pas::kAS_Scripted;
|
||||
}
|
||||
if (bc.IsAnimationOver() || commandMgr.GetCmd(kBSC_NextState)) {
|
||||
return pas::kAS_Locomotion;
|
||||
}
|
||||
return pas::kAS_Invalid;
|
||||
}
|
||||
bool CBSStep::CanShoot() const override { return true; }
|
||||
|
||||
|
||||
bool CBSStep::IsMoving() const override { return true; }
|
||||
|
||||
CBSStep::~CBSStep() {}
|
Loading…
Reference in New Issue