Almost match CScriptSpiderBallAttractionSurface

Former-commit-id: 18ebd4146e
This commit is contained in:
Henrique Gemignani Passos Lima 2022-10-21 18:13:34 +03:00
parent 8af356062b
commit cf20221c70
5 changed files with 68 additions and 7 deletions

View File

@ -3,8 +3,8 @@
.section .data
.balign 8
.global lbl_803E2438
lbl_803E2438:
.global __vt__34CScriptSpiderBallAttractionSurface
__vt__34CScriptSpiderBallAttractionSurface:
# ROM: 0x3DF438
.4byte 0
.4byte 0
@ -158,9 +158,9 @@ __dt__34CScriptSpiderBallAttractionSurfaceFv:
/* 8014AED0 00147E30 93 C1 00 08 */ stw r30, 8(r1)
/* 8014AED4 00147E34 7C 7E 1B 79 */ or. r30, r3, r3
/* 8014AED8 00147E38 41 82 00 28 */ beq lbl_8014AF00
/* 8014AEDC 00147E3C 3C A0 80 3E */ lis r5, lbl_803E2438@ha
/* 8014AEDC 00147E3C 3C A0 80 3E */ lis r5, __vt__34CScriptSpiderBallAttractionSurface@ha
/* 8014AEE0 00147E40 38 80 00 00 */ li r4, 0
/* 8014AEE4 00147E44 38 05 24 38 */ addi r0, r5, lbl_803E2438@l
/* 8014AEE4 00147E44 38 05 24 38 */ addi r0, r5, __vt__34CScriptSpiderBallAttractionSurface@l
/* 8014AEE8 00147E48 90 1E 00 00 */ stw r0, 0(r30)
/* 8014AEEC 00147E4C 4B F0 A8 05 */ bl __dt__6CActorFv
/* 8014AEF0 00147E50 7F E0 07 35 */ extsh. r0, r31
@ -229,9 +229,9 @@ lbl_8014AF00:
/* 8014AFDC 00147F3C 38 61 01 00 */ addi r3, r1, 0x100
/* 8014AFE0 00147F40 38 80 FF FF */ li r4, -1
/* 8014AFE4 00147F44 4B FC BA 69 */ bl __dt__10CModelDataFv
/* 8014AFE8 00147F48 3C 60 80 3E */ lis r3, lbl_803E2438@ha
/* 8014AFE8 00147F48 3C 60 80 3E */ lis r3, __vt__34CScriptSpiderBallAttractionSurface@ha
/* 8014AFEC 00147F4C C0 42 9C E0 */ lfs f2, lbl_805ABA00@sda21(r2)
/* 8014AFF0 00147F50 38 03 24 38 */ addi r0, r3, lbl_803E2438@l
/* 8014AFF0 00147F50 38 03 24 38 */ addi r0, r3, __vt__34CScriptSpiderBallAttractionSurface@l
/* 8014AFF4 00147F54 7F 84 E3 78 */ mr r4, r28
/* 8014AFF8 00147F58 90 1F 00 00 */ stw r0, 0(r31)
/* 8014AFFC 00147F5C 38 61 00 68 */ addi r3, r1, 0x68

View File

@ -209,7 +209,7 @@ LIBS = [
"MetroidPrime/BodyState/CBSTaunt",
"MetroidPrime/CSortedLists",
["MetroidPrime/ScriptObjects/CScriptDebugCameraWaypoint", True],
"MetroidPrime/ScriptObjects/CScriptSpiderBallAttractionSurface",
["MetroidPrime/ScriptObjects/CScriptSpiderBallAttractionSurface", False],
"MetroidPrime/BodyState/CBSScripted",
"MetroidPrime/Enemies/CPuddleToadGamma",
["MetroidPrime/ScriptObjects/CScriptDistanceFog", False],

View File

@ -0,0 +1,24 @@
#ifndef _CSCRIPTSPIDERBALLATTRACTIONSURFACE
#define _CSCRIPTSPIDERBALLATTRACTIONSURFACE
#include "MetroidPrime/CActor.hpp"
class CScriptSpiderBallAttractionSurface : public CActor {
CVector3f xe8_scale;
CAABox xf4_aabb;
public:
CScriptSpiderBallAttractionSurface(TUniqueId uid, const rstl::string& name,
const CEntityInfo& info, const CTransform4f& xf,
const CVector3f& scale, bool active);
~CScriptSpiderBallAttractionSurface();
void Accept(IVisitor& visitor) override;
void Think(float dt, CStateManager& mgr) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override;
rstl::optional_object< CAABox > GetTouchBounds() const override;
void Touch(CActor& actor, CStateManager& mgr) override;
const CVector3f& GetScale() const { return xe8_scale; }
};
#endif // _CSCRIPTSPIDERBALLATTRACTIONSURFACE

View File

@ -0,0 +1,36 @@
#include "MetroidPrime/ScriptObjects/CScriptSpiderBallAttractionSurface.hpp"
#include "MetroidPrime/CActorParameters.hpp"
CScriptSpiderBallAttractionSurface::CScriptSpiderBallAttractionSurface(
TUniqueId uid, const rstl::string& name, const CEntityInfo& info, const CTransform4f& xf,
const CVector3f& scale, bool active)
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(kMT_NoStepLogic),
CActorParameters::None(), kInvalidUniqueId)
, xe8_scale(scale)
, xf4_aabb(CAABox(-(scale * 0.5f), scale * 0.5f).GetTransformedAABox(xf.GetRotation())) {}
CScriptSpiderBallAttractionSurface::~CScriptSpiderBallAttractionSurface() {}
void CScriptSpiderBallAttractionSurface::Touch(CActor& actor, CStateManager& mgr) {
// Empty
}
rstl::optional_object< CAABox > CScriptSpiderBallAttractionSurface::GetTouchBounds() const {
if (GetActive()) {
return CAABox(xf4_aabb.GetMinPoint() + GetTranslation(),
xf4_aabb.GetMaxPoint() + GetTranslation());
}
return rstl::optional_object_null();
}
void CScriptSpiderBallAttractionSurface::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender,
CStateManager& mgr) {
CActor::AcceptScriptMsg(msg, sender, mgr);
}
void CScriptSpiderBallAttractionSurface::Think(float dt, CStateManager& mgr) {
// Empty
}
void CScriptSpiderBallAttractionSurface::Accept(IVisitor& visitor) { visitor.Visit(*this); }

View File

@ -5,6 +5,7 @@ path=$1
sed -i "s/std::string_view/const rstl::string\&/g" "$path"
sed -i "s/std::optional/rstl::optional_object/g" "$path"
sed -i "s/std::nullopt/rstl::optional_object_null()/g" "$path"
sed -i "s/zeus::CTransform/CTransform4f/g" "$path"
sed -i "s/zeus::skZero2f/CVector2f(0.f, 0.f)/g" "$path"
sed -i "s/zeus::skZero3f/CVector3f::Zero()/g" "$path"