mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-25 09:08:24 -05:00
Implement/match LegoPathController::FUN_10046050 (#916)
This commit is contained in:
parent
5f34d2e877
commit
ccf33575db
5 changed files with 89 additions and 4 deletions
|
@ -15,7 +15,10 @@ struct LegoPathActorSetCompare {
|
|||
};
|
||||
|
||||
struct LegoAnimPresenterSetCompare {
|
||||
MxBool operator()(const LegoAnimPresenter* p_lhs, const LegoAnimPresenter* p_rhs) const { return 0; }
|
||||
MxBool operator()(const LegoAnimPresenter* p_lhs, const LegoAnimPresenter* p_rhs) const
|
||||
{
|
||||
return (MxS32) p_lhs < (MxS32) p_rhs;
|
||||
}
|
||||
};
|
||||
|
||||
typedef set<LegoPathActor*, LegoPathActorSetCompare> LegoPathActorSet;
|
||||
|
@ -83,6 +86,18 @@ class LegoPathBoundary : public LegoWEGEdge {
|
|||
// TEMPLATE: LEGO1 0x10045dd0
|
||||
// _Tree<LegoPathActor *,LegoPathActor *,set<LegoPathActor *,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Kfn,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Insert
|
||||
|
||||
// TEMPLATE: LEGO1 0x10046310
|
||||
// _Tree<LegoPathActor *,LegoPathActor *,set<LegoPathActor *,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Kfn,LegoPathActorSetCompare,allocator<LegoPathActor *> >::insert
|
||||
|
||||
// TEMPLATE: LEGO1 0x10046580
|
||||
// _Tree<LegoPathActor *,LegoPathActor *,set<LegoPathActor *,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Kfn,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Lrotate
|
||||
|
||||
// TEMPLATE: LEGO1 0x100465e0
|
||||
// _Tree<LegoPathActor *,LegoPathActor *,set<LegoPathActor *,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Kfn,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Rrotate
|
||||
|
||||
// TEMPLATE: LEGO1 0x1004a7a0
|
||||
// _Construct
|
||||
|
||||
// GLOBAL: LEGO1 0x100f11a4
|
||||
// _Tree<LegoPathActor *,LegoPathActor *,set<LegoPathActor *,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Kfn,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Nil
|
||||
|
||||
|
|
|
@ -142,6 +142,9 @@ class LegoPathController : public MxCore {
|
|||
// TEMPLATE: LEGO1 0x10045830
|
||||
// set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::~set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >
|
||||
|
||||
// TEMPLATE: LEGO1 0x10046640
|
||||
// _Tree<LegoAnimPresenter *,LegoAnimPresenter *,set<LegoAnimPresenter *,LegoAnimPresenterSetCompare,allocator<LegoAnimPresenter *> >::_Kfn,LegoAnimPresenterSetCompare,allocator<LegoAnimPresenter *> >::find
|
||||
|
||||
// TEMPLATE: LEGO1 0x100468c0
|
||||
// _Tree<LegoPathActor *,LegoPathActor *,set<LegoPathActor *,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Kfn,LegoPathActorSetCompare,allocator<LegoPathActor *> >::_Ubound
|
||||
|
||||
|
|
|
@ -226,7 +226,7 @@ MxResult LegoPathController::FUN_10045c20(
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10046050
|
||||
// FUNCTION: LEGO1 0x10046050
|
||||
// FUNCTION: BETA10 0x100b6f35
|
||||
MxResult LegoPathController::FUN_10046050(
|
||||
LegoPathActor* p_actor,
|
||||
|
@ -235,8 +235,69 @@ MxResult LegoPathController::FUN_10046050(
|
|||
Vector3& p_direction
|
||||
)
|
||||
{
|
||||
// TODO
|
||||
LegoPathBoundary* boundary = NULL;
|
||||
float time = Timer()->GetTime();
|
||||
|
||||
if (p_actor->GetController() != NULL) {
|
||||
p_actor->GetController()->RemoveActor(p_actor);
|
||||
p_actor->SetController(NULL);
|
||||
}
|
||||
|
||||
for (MxS32 i = 0; i < m_numL; i++) {
|
||||
LegoPathBoundary& b = m_boundaries[i];
|
||||
LegoAnimPresenterSet& presenters = b.GetPresenters();
|
||||
LegoAnimPresenter* presenter = p_presenter;
|
||||
|
||||
if (presenters.find(presenter) != presenters.end()) {
|
||||
MxS32 j;
|
||||
|
||||
for (j = 0; j < b.GetNumEdges(); j++) {
|
||||
Mx4DPointFloat normal(*b.GetEdgeNormal(j));
|
||||
|
||||
if (p_position.Dot(&p_position, &normal) + normal[3] < 0.0f) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (b.GetNumEdges() == j) {
|
||||
if (boundary != NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
boundary = &b;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (boundary == NULL) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
for (MxS32 j = 0; j < boundary->GetNumEdges(); j++) {
|
||||
LegoUnknown100db7f4* edge = (LegoUnknown100db7f4*) boundary->GetEdges()[j];
|
||||
|
||||
if (edge->GetMask0x03()) {
|
||||
Mx3DPointFloat vec;
|
||||
|
||||
if (((LegoUnknown100db7f4*) edge->GetClockwiseEdge(boundary))->FUN_1002ddc0(*boundary, vec) == SUCCESS &&
|
||||
vec.Dot(&vec, &p_direction) < 0.0f) {
|
||||
edge =
|
||||
(LegoUnknown100db7f4*) edge->GetCounterclockwiseEdge(boundary)->GetCounterclockwiseEdge(boundary);
|
||||
}
|
||||
|
||||
if (!edge->GetMask0x03()) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
if (p_actor->VTable0x84(boundary, time, p_position, p_direction, *edge, 0.5f) == SUCCESS) {
|
||||
p_actor->SetController(this);
|
||||
m_actors.insert(p_actor);
|
||||
return SUCCESS;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100466a0
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
struct LegoUnknown100db7f4 : public LegoEdge {
|
||||
public:
|
||||
enum {
|
||||
c_bit1 = 0x01,
|
||||
c_bit2 = 0x02,
|
||||
c_bit3 = 0x04,
|
||||
c_bit4 = 0x08
|
||||
};
|
||||
|
@ -32,6 +34,8 @@ struct LegoUnknown100db7f4 : public LegoEdge {
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
LegoU32 GetMask0x03() { return m_flags & (c_bit1 | c_bit2); }
|
||||
|
||||
// SYNTHETIC: LEGO1 0x1009a6c0
|
||||
// LegoUnknown100db7f4::`scalar deleting destructor'
|
||||
|
||||
|
|
|
@ -57,6 +57,8 @@ class Mx4DPointFloat : public Vector4 {
|
|||
m_elements[3] = p_a;
|
||||
}
|
||||
|
||||
inline Mx4DPointFloat(const Mx4DPointFloat& p_other) : Vector4(m_elements) { EqualsImpl(p_other.m_data); }
|
||||
|
||||
// FUNCTION: LEGO1 0x10003200
|
||||
virtual void operator=(const Vector4& p_impl) { EqualsImpl(p_impl.m_data); } // vtable+0x98
|
||||
|
||||
|
|
Loading…
Reference in a new issue