Match and link CScriptGrapplePoint

This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-17 21:28:33 +03:00
parent 061bf00af6
commit 49f6652114
No known key found for this signature in database
GPG Key ID: E224F951761145F8
6 changed files with 118 additions and 8 deletions

View File

@ -3,8 +3,8 @@
.section .data
.balign 8
.global lbl_803E0D00
lbl_803E0D00:
.global __vt__19CScriptGrapplePoint
__vt__19CScriptGrapplePoint:
# ROM: 0x3DDD00
.4byte 0
.4byte 0
@ -169,9 +169,9 @@ __dt__19CScriptGrapplePointFv:
/* 8012F8D4 0012C834 93 C1 00 08 */ stw r30, 8(r1)
/* 8012F8D8 0012C838 7C 7E 1B 79 */ or. r30, r3, r3
/* 8012F8DC 0012C83C 41 82 00 28 */ beq lbl_8012F904
/* 8012F8E0 0012C840 3C A0 80 3E */ lis r5, lbl_803E0D00@ha
/* 8012F8E0 0012C840 3C A0 80 3E */ lis r5, __vt__19CScriptGrapplePoint@ha
/* 8012F8E4 0012C844 38 80 00 00 */ li r4, 0
/* 8012F8E8 0012C848 38 05 0D 00 */ addi r0, r5, lbl_803E0D00@l
/* 8012F8E8 0012C848 38 05 0D 00 */ addi r0, r5, __vt__19CScriptGrapplePoint@l
/* 8012F8EC 0012C84C 90 1E 00 00 */ stw r0, 0(r30)
/* 8012F8F0 0012C850 4B F2 5E 01 */ bl __dt__6CActorFv
/* 8012F8F4 0012C854 7F E0 07 35 */ extsh. r0, r31
@ -240,9 +240,9 @@ lbl_8012F904:
/* 8012F9E0 0012C940 38 61 00 B8 */ addi r3, r1, 0xb8
/* 8012F9E4 0012C944 38 80 FF FF */ li r4, -1
/* 8012F9E8 0012C948 4B FE 70 65 */ bl __dt__10CModelDataFv
/* 8012F9EC 0012C94C 3C 60 80 3E */ lis r3, lbl_803E0D00@ha
/* 8012F9EC 0012C94C 3C 60 80 3E */ lis r3, __vt__19CScriptGrapplePoint@ha
/* 8012F9F0 0012C950 C0 02 99 30 */ lfs f0, lbl_805AB650@sda21(r2)
/* 8012F9F4 0012C954 38 03 0D 00 */ addi r0, r3, lbl_803E0D00@l
/* 8012F9F4 0012C954 38 03 0D 00 */ addi r0, r3, __vt__19CScriptGrapplePoint@l
/* 8012F9F8 0012C958 38 7F 00 E8 */ addi r3, r31, 0xe8
/* 8012F9FC 0012C95C 90 1F 00 00 */ stw r0, 0(r31)
/* 8012FA00 0012C960 38 81 00 44 */ addi r4, r1, 0x44

View File

@ -177,7 +177,7 @@ LIBS = [
"MetroidPrime/Cameras/CPathCamera",
"MetroidPrime/CFluidPlane",
"MetroidPrime/CFluidPlaneManager",
"MetroidPrime/ScriptObjects/CScriptGrapplePoint",
["MetroidPrime/ScriptObjects/CScriptGrapplePoint", True],
"MetroidPrime/ScriptObjects/CHUDBillboardEffect",
"MetroidPrime/Enemies/CFlickerBat",
"MetroidPrime/BodyState/CBodyStateCmdMgr",

View File

@ -0,0 +1,37 @@
#ifndef _CGRAPPLEPARAMETERS
#define _CGRAPPLEPARAMETERS
class CGrappleParameters {
float x0_a;
float x4_b;
float x8_c;
float xc_d;
float x10_e;
float x14_f;
float x18_g;
float x1c_h;
float x20_i;
float x24_j;
float x28_k;
bool x2c_lockSwingTurn;
public:
CGrappleParameters(float a, float b, float c, float d, float e, float f, float g, float h,
float i, float j, float k, bool lockSwingTurn)
: x0_a(a)
, x4_b(b)
, x8_c(c)
, xc_d(d)
, x10_e(e)
, x14_f(f)
, x18_g(g)
, x1c_h(h)
, x20_i(i)
, x24_j(j)
, x28_k(k)
, x2c_lockSwingTurn(lockSwingTurn) {}
bool GetLockSwingTurn() const { return x2c_lockSwingTurn; }
};
#endif // _CGRAPPLEPARAMETERS

View File

@ -0,0 +1,25 @@
#ifndef _CSCRIPTGRAPPLEPOINT
#define _CSCRIPTGRAPPLEPOINT
#include "MetroidPrime/CActor.hpp"
#include "MetroidPrime/CGrappleParameters.hpp"
class CScriptGrapplePoint : public CActor {
CAABox xe8_touchBounds;
CGrappleParameters x100_parameters;
public:
CScriptGrapplePoint(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& transform, bool active, const CGrappleParameters& params);
~CScriptGrapplePoint();
void AddToRenderer(const CFrustumPlanes&, const CStateManager&) const;
rstl::optional_object< CAABox > GetTouchBounds() const;
void Render(const CStateManager&) const;
void Think(float, CStateManager&);
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
void Accept(IVisitor&);
};
#endif // _CSCRIPTGRAPPLEPOINT

View File

@ -144,7 +144,7 @@ METROIDPRIME :=\
$(BUILD_DIR)/asm/MetroidPrime/Cameras/CPathCamera.o\
$(BUILD_DIR)/asm/MetroidPrime/CFluidPlane.o\
$(BUILD_DIR)/asm/MetroidPrime/CFluidPlaneManager.o\
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptGrapplePoint.o\
$(BUILD_DIR)/src/MetroidPrime/ScriptObjects/CScriptGrapplePoint.o\
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CHUDBillboardEffect.o\
$(BUILD_DIR)/asm/MetroidPrime/Enemies/CFlickerBat.o\
$(BUILD_DIR)/asm/MetroidPrime/BodyState/CBodyStateCmdMgr.o\

View File

@ -0,0 +1,48 @@
#include "MetroidPrime/ScriptObjects/CScriptGrapplePoint.hpp"
#include "MetroidPrime/CActorParameters.hpp"
CScriptGrapplePoint::CScriptGrapplePoint(TUniqueId uid, const rstl::string& name,
const CEntityInfo& info, const CTransform4f& xf,
bool active, const CGrappleParameters& params)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(kMT_Orbit),
CActorParameters::None(), kInvalidUniqueId)
, xe8_touchBounds(x34_transform.GetTranslation() - CVector3f(0.5f, 0.5f, 0.5f),
x34_transform.GetTranslation() + CVector3f(0.5f, 0.5f, 0.5f))
, x100_parameters(params) {}
CScriptGrapplePoint::~CScriptGrapplePoint() {}
void CScriptGrapplePoint::AddToRenderer(const CFrustumPlanes&, const CStateManager& mgr) const {
CActor::EnsureRendered(mgr);
}
rstl::optional_object< CAABox > CScriptGrapplePoint::GetTouchBounds() const {
return xe8_touchBounds;
}
void CScriptGrapplePoint::Render(const CStateManager&) const {}
void CScriptGrapplePoint::Think(float, CStateManager&) {}
void CScriptGrapplePoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid,
CStateManager& mgr) {
switch (msg) {
case kSM_Activate:
if (!GetActive()) {
AddMaterial(kMT_Orbit, mgr);
SetActive(true);
}
break;
case kSM_Deactivate:
if (GetActive()) {
RemoveMaterial(kMT_Orbit, mgr);
SetActive(false);
}
break;
default:
break;
}
}
void CScriptGrapplePoint::Accept(IVisitor& visitor) { visitor.Visit(*this); }