mirror of https://github.com/PrimeDecomp/prime.git
parent
0307bd0bd5
commit
8b1b9eb313
|
@ -3,8 +3,8 @@
|
||||||
.section .data
|
.section .data
|
||||||
.balign 8
|
.balign 8
|
||||||
|
|
||||||
.global lbl_803DA558
|
.global __vt__15CScriptWaypoint
|
||||||
lbl_803DA558:
|
__vt__15CScriptWaypoint:
|
||||||
# ROM: 0x3D7558
|
# ROM: 0x3D7558
|
||||||
.4byte 0
|
.4byte 0
|
||||||
.4byte 0
|
.4byte 0
|
||||||
|
@ -318,9 +318,9 @@ __dt__15CScriptWaypointFv:
|
||||||
/* 800773C8 00074328 93 C1 00 08 */ stw r30, 8(r1)
|
/* 800773C8 00074328 93 C1 00 08 */ stw r30, 8(r1)
|
||||||
/* 800773CC 0007432C 7C 7E 1B 79 */ or. r30, r3, r3
|
/* 800773CC 0007432C 7C 7E 1B 79 */ or. r30, r3, r3
|
||||||
/* 800773D0 00074330 41 82 00 28 */ beq lbl_800773F8
|
/* 800773D0 00074330 41 82 00 28 */ beq lbl_800773F8
|
||||||
/* 800773D4 00074334 3C A0 80 3E */ lis r5, lbl_803DA558@ha
|
/* 800773D4 00074334 3C A0 80 3E */ lis r5, __vt__15CScriptWaypoint@ha
|
||||||
/* 800773D8 00074338 38 80 00 00 */ li r4, 0
|
/* 800773D8 00074338 38 80 00 00 */ li r4, 0
|
||||||
/* 800773DC 0007433C 38 05 A5 58 */ addi r0, r5, lbl_803DA558@l
|
/* 800773DC 0007433C 38 05 A5 58 */ addi r0, r5, __vt__15CScriptWaypoint@l
|
||||||
/* 800773E0 00074340 90 1E 00 00 */ stw r0, 0(r30)
|
/* 800773E0 00074340 90 1E 00 00 */ stw r0, 0(r30)
|
||||||
/* 800773E4 00074344 4B FD E3 0D */ bl __dt__6CActorFv
|
/* 800773E4 00074344 4B FD E3 0D */ bl __dt__6CActorFv
|
||||||
/* 800773E8 00074348 7F E0 07 35 */ extsh. r0, r31
|
/* 800773E8 00074348 7F E0 07 35 */ extsh. r0, r31
|
||||||
|
@ -399,9 +399,9 @@ lbl_800773F8:
|
||||||
/* 800774FC 0007445C 38 61 00 88 */ addi r3, r1, 0x88
|
/* 800774FC 0007445C 38 61 00 88 */ addi r3, r1, 0x88
|
||||||
/* 80077500 00074460 38 80 FF FF */ li r4, -1
|
/* 80077500 00074460 38 80 FF FF */ li r4, -1
|
||||||
/* 80077504 00074464 48 09 F5 49 */ bl __dt__10CModelDataFv
|
/* 80077504 00074464 48 09 F5 49 */ bl __dt__10CModelDataFv
|
||||||
/* 80077508 00074468 3C 80 80 3E */ lis r4, lbl_803DA558@ha
|
/* 80077508 00074468 3C 80 80 3E */ lis r4, __vt__15CScriptWaypoint@ha
|
||||||
/* 8007750C 0007446C 7E 63 9B 78 */ mr r3, r19
|
/* 8007750C 0007446C 7E 63 9B 78 */ mr r3, r19
|
||||||
/* 80077510 00074470 38 04 A5 58 */ addi r0, r4, lbl_803DA558@l
|
/* 80077510 00074470 38 04 A5 58 */ addi r0, r4, __vt__15CScriptWaypoint@l
|
||||||
/* 80077514 00074474 90 13 00 00 */ stw r0, 0(r19)
|
/* 80077514 00074474 90 13 00 00 */ stw r0, 0(r19)
|
||||||
/* 80077518 00074478 38 80 00 00 */ li r4, 0
|
/* 80077518 00074478 38 80 00 00 */ li r4, 0
|
||||||
/* 8007751C 0007447C D3 D3 00 E8 */ stfs f30, 0xe8(r19)
|
/* 8007751C 0007447C D3 D3 00 E8 */ stfs f30, 0xe8(r19)
|
||||||
|
|
|
@ -89,7 +89,7 @@ LIBS = [
|
||||||
"MetroidPrime/Tweaks/CTweakGui",
|
"MetroidPrime/Tweaks/CTweakGui",
|
||||||
"MetroidPrime/ScriptObjects/CScriptActor",
|
"MetroidPrime/ScriptObjects/CScriptActor",
|
||||||
["MetroidPrime/ScriptObjects/CScriptTrigger", False],
|
["MetroidPrime/ScriptObjects/CScriptTrigger", False],
|
||||||
"MetroidPrime/ScriptObjects/CScriptWaypoint",
|
["MetroidPrime/ScriptObjects/CScriptWaypoint", True],
|
||||||
"MetroidPrime/Enemies/CPatterned",
|
"MetroidPrime/Enemies/CPatterned",
|
||||||
"MetroidPrime/ScriptObjects/CScriptDoor",
|
"MetroidPrime/ScriptObjects/CScriptDoor",
|
||||||
["MetroidPrime/Enemies/CStateMachine", False],
|
["MetroidPrime/Enemies/CStateMachine", False],
|
||||||
|
|
|
@ -346,7 +346,7 @@ public:
|
||||||
void SetRenderBounds(const CAABox& bounds) { x9c_renderBounds = bounds; }
|
void SetRenderBounds(const CAABox& bounds) { x9c_renderBounds = bounds; }
|
||||||
|
|
||||||
// 000c0ec8 00001c 801711a8 4 GetUseInSortedLists__6CActorCFv CActor.o
|
// 000c0ec8 00001c 801711a8 4 GetUseInSortedLists__6CActorCFv CActor.o
|
||||||
// 000c0ee4 000014 801711c4 4 SetUseInSortedLists__6CActorFb CActor.o
|
void SetUseInSortedLists(bool use);
|
||||||
// 000c0ef8 00001c 801711d8 4 GetCallTouch__6CActorCFv CActor.o
|
// 000c0ef8 00001c 801711d8 4 GetCallTouch__6CActorCFv CActor.o
|
||||||
void SetCallTouch(bool);
|
void SetCallTouch(bool);
|
||||||
// GetOrbitDistanceCheck__6CActorCFv
|
// GetOrbitDistanceCheck__6CActorCFv
|
||||||
|
|
|
@ -9,8 +9,8 @@ class CScriptWaypoint : public CActor {
|
||||||
public:
|
public:
|
||||||
CScriptWaypoint(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
|
CScriptWaypoint(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
|
||||||
const CTransform4f& xf, bool active, float speed, float pause,
|
const CTransform4f& xf, bool active, float speed, float pause,
|
||||||
uint patternTranslate, uint patternOrient, uint patternFit, uint behaviour,
|
int patternTranslate, int patternOrient, int patternFit, int behaviour,
|
||||||
uint behaviourOrient, uint behaviourModifiers, uint animation);
|
int behaviourOrient, int behaviourModifiers, uint animation);
|
||||||
|
|
||||||
// CEntity
|
// CEntity
|
||||||
~CScriptWaypoint() override;
|
~CScriptWaypoint() override;
|
||||||
|
@ -23,7 +23,7 @@ public:
|
||||||
|
|
||||||
// CScriptWaypoint
|
// CScriptWaypoint
|
||||||
TUniqueId NextWaypoint(const CStateManager& mgr) const;
|
TUniqueId NextWaypoint(const CStateManager& mgr) const;
|
||||||
void FollowWaypoint(const CStateManager& mgr) const;
|
TUniqueId FollowWaypoint(CStateManager& mgr) const;
|
||||||
|
|
||||||
float GetSpeed() const { return xe8_speed; }
|
float GetSpeed() const { return xe8_speed; }
|
||||||
uint GetAnimation() const { return xec_animation; }
|
uint GetAnimation() const { return xec_animation; }
|
||||||
|
|
|
@ -54,7 +54,7 @@ METROIDPRIME :=\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/Tweaks/CTweakGui.o\
|
$(BUILD_DIR)/asm/MetroidPrime/Tweaks/CTweakGui.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptActor.o\
|
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptActor.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptTrigger.o\
|
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptTrigger.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptWaypoint.o\
|
$(BUILD_DIR)/src/MetroidPrime/ScriptObjects/CScriptWaypoint.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/Enemies/CPatterned.o\
|
$(BUILD_DIR)/asm/MetroidPrime/Enemies/CPatterned.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptDoor.o\
|
$(BUILD_DIR)/asm/MetroidPrime/ScriptObjects/CScriptDoor.o\
|
||||||
$(BUILD_DIR)/asm/MetroidPrime/Enemies/CStateMachine.o\
|
$(BUILD_DIR)/asm/MetroidPrime/Enemies/CStateMachine.o\
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
#include "MetroidPrime/ScriptObjects/CScriptWaypoint.hpp"
|
||||||
|
|
||||||
|
#include "MetroidPrime/CActorParameters.hpp"
|
||||||
|
#include "MetroidPrime/CStateManager.hpp"
|
||||||
|
|
||||||
|
CScriptWaypoint::CScriptWaypoint(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
|
||||||
|
const CTransform4f& xf, bool active, float speed, float pause,
|
||||||
|
int patternTranslate, int patternOrient, int patternFit,
|
||||||
|
int behaviour, int behaviourOrient, int behaviourModifiers,
|
||||||
|
uint animation)
|
||||||
|
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(kMT_NoStepLogic), CActorParameters::None(),
|
||||||
|
kInvalidUniqueId)
|
||||||
|
, xe8_speed(speed)
|
||||||
|
, xec_animation(animation)
|
||||||
|
, xf0_pause(pause)
|
||||||
|
, xf4_patternTranslate(patternTranslate)
|
||||||
|
, xf5_patternOrient(patternOrient)
|
||||||
|
, xf6_patternFit(patternFit)
|
||||||
|
, xf7_behaviour(behaviour)
|
||||||
|
, xf8_behaviourOrient(behaviourOrient)
|
||||||
|
, xfa_behaviourModifiers(behaviourModifiers) {
|
||||||
|
SetUseInSortedLists(false);
|
||||||
|
SetCallTouch(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
CScriptWaypoint::~CScriptWaypoint() {}
|
||||||
|
|
||||||
|
void CScriptWaypoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender,
|
||||||
|
CStateManager& mgr) {
|
||||||
|
CActor::AcceptScriptMsg(msg, sender, mgr);
|
||||||
|
if (GetActive()) {
|
||||||
|
switch (msg) {
|
||||||
|
case kSM_Arrived:
|
||||||
|
SendScriptMsgs(kSS_Arrived, mgr, kSM_None);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TUniqueId CScriptWaypoint::NextWaypoint(const CStateManager& mgr) const {
|
||||||
|
rstl::reserved_vector< TUniqueId, 10 > ids;
|
||||||
|
rstl::vector< SConnection >::const_iterator conn = GetConnectionList().begin();
|
||||||
|
for (; conn != GetConnectionList().end(); ++conn) {
|
||||||
|
if (conn->x0_state == kSS_Arrived && conn->x4_msg == kSM_Next) {
|
||||||
|
const TUniqueId id = mgr.GetIdForScript(conn->x8_objId);
|
||||||
|
if (id != kInvalidUniqueId) {
|
||||||
|
if (const CScriptWaypoint* wp = TCastToConstPtr< CScriptWaypoint >(mgr.GetObjectById(id))) {
|
||||||
|
if (wp->GetActive()) {
|
||||||
|
ids.push_back(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ids.empty()) {
|
||||||
|
return kInvalidUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ids[int(mgr.Random()->Float() * ids.size() * 0.99f)];
|
||||||
|
}
|
||||||
|
|
||||||
|
TUniqueId CScriptWaypoint::FollowWaypoint(CStateManager& mgr) const {
|
||||||
|
rstl::vector< SConnection >::const_iterator conn = GetConnectionList().begin();
|
||||||
|
for (; conn != GetConnectionList().end(); ++conn) {
|
||||||
|
if (conn->x0_state == kSS_Arrived && conn->x4_msg == kSM_Follow) {
|
||||||
|
return mgr.GetIdForScript(conn->x8_objId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return kInvalidUniqueId;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptWaypoint::AddToRenderer(const CFrustumPlanes&, const CStateManager&) const {
|
||||||
|
// Empty
|
||||||
|
}
|
||||||
|
|
||||||
|
void CScriptWaypoint::Render(const CStateManager&) const override {}
|
||||||
|
|
||||||
|
void CScriptWaypoint::Accept(IVisitor& visitor) { visitor.Visit(*this); }
|
Loading…
Reference in New Issue