merge from isle/master
Some checks failed
Build / Current msys2 mingw32 (push) Has been cancelled
Build / Current msys2 mingw64 (push) Has been cancelled
Build / Current MSVC (32-bit) (push) Has been cancelled
Build / Current MSVC (64-bit) (push) Has been cancelled
Format / C++ (push) Has been cancelled
Naming / C++ (push) Has been cancelled

This commit is contained in:
Christian Semmler 2024-12-07 10:17:25 -07:00
commit d22c4cd1f2
No known key found for this signature in database
GPG key ID: 086DAA1360BEEE5C
72 changed files with 1820 additions and 303 deletions

View file

@ -5,9 +5,18 @@
// VTABLE: LEGO1 0x100d6078 LegoPathActor
// VTABLE: LEGO1 0x100d6148 LegoAnimActor
// VTABLE: BETA10 0x101b80c0 LegoPathActor
// VTABLE: BETA10 0x101b81b0 LegoAnimActor
// SIZE 0x1a8
class Act2Actor : public LegoAnimActor {
public:
struct UnknownListStructure {
MxFloat m_position[3]; // 0x00
MxFloat m_direction[3]; // 0x0c
const char* m_boundary; // 0x18
undefined m_unk0x1c; // 0x1c
};
Act2Actor();
void SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) override; // vtable+0x24
@ -18,28 +27,38 @@ class Act2Actor : public LegoAnimActor {
MxResult VTable0x9c() override; // vtable+0x9c
MxS32 VTable0xa0() override; // vtable+0xa0
void FUN_10018980();
void FUN_10019520();
void FUN_10019560();
void FUN_100192a0(undefined4 p_param);
// SYNTHETIC: LEGO1 0x1001a0a0
// Act2Actor::`scalar deleting destructor'
// GLOBAL: LEGO1 0x100d6070
// GLOBAL: BETA10 0x101b80b0
// `vbtable'
private:
undefined m_unk0x1c; // 0x1c
undefined m_unk0x1d; // 0x1d
undefined m_unk0x1e; // 0x1e
MxBool m_unk0x1f; // 0x1f
undefined4 m_unk0x20; // 0x20
undefined4 m_unk0x24; // 0x24
undefined4 m_unk0x28; // 0x28
undefined4 m_unk0x2c; // 0x2c
undefined4 m_unk0x30; // 0x30
undefined4 m_unk0x34; // 0x34
undefined4 m_unk0x38; // 0x38
undefined4 m_unk0x3c; // 0x3c
undefined m_unk0x40; // 0x40
undefined4 m_unk0x44; // 0x44
undefined m_unk0x48; // 0x48
undefined4 m_unk0x4c; // 0x4c
undefined m_unk0x1c; // 0x1c
MxS8 m_unk0x1d; // 0x1d
undefined m_unk0x1e; // 0x1e
MxBool m_unk0x1f; // 0x1f
undefined4 m_unk0x20; // 0x20
undefined4 m_unk0x24; // 0x24
MxS8 m_unk0x28; // 0x28
undefined4 m_unk0x2c; // 0x2c
undefined4 m_unk0x30; // 0x30
LegoAnimActorStruct* m_shootAnim; // 0x34
LegoCacheSound* m_unk0x38; // 0x38
undefined4 m_unk0x3c; // 0x3c
undefined m_unk0x40; // 0x40
undefined4 m_unk0x44; // 0x44
MxS8 m_unk0x48; // 0x48
undefined4 m_unk0x4c; // 0x4c
};
// TEMPLATE: LEGO1 0x100194f0
// list<LegoBoundaryEdge,allocator<LegoBoundaryEdge> >::list<LegoBoundaryEdge,allocator<LegoBoundaryEdge> >
#endif // ACT2ACTOR_H

View file

@ -31,10 +31,15 @@ class Act2Brick : public LegoPathActor {
// SYNTHETIC: LEGO1 0x1007a450
// Act2Brick::`scalar deleting destructor'
MxResult Create(MxS32 p_index);
void Remove();
void FUN_1007a670(MxMatrix& p_param1, MxMatrix& p_param2, LegoPathBoundary* p_boundary);
void PlayWhistleSound();
void StopWhistleSound();
void Mute(MxBool p_muted);
private:
static LegoChar* g_lodNames[];
static MxLong g_lastHitActorTime;
LegoCacheSound* m_whistleSound; // 0x154

View file

@ -20,8 +20,8 @@ class Act3Actor : public LegoAnimActor {
return "Act3Actor";
}
MxU32 VTable0x90(float, Matrix4&) override; // vtable+0x90
MxResult VTable0x94(LegoPathActor*, MxBool) override; // vtable+0x94
MxU32 VTable0x90(float p_float, Matrix4& p_transform) override; // vtable+0x90
MxResult VTable0x94(LegoPathActor* p_actor, MxBool p_bool) override; // vtable+0x94
// SYNTHETIC: LEGO1 0x10043330
// Act3Actor::`scalar deleting destructor'
@ -30,7 +30,12 @@ class Act3Actor : public LegoAnimActor {
// Act3Actor::~Act3Actor
private:
undefined4 m_unk0x1c; // 0x1c
MxFloat m_unk0x1c; // 0x1c
static Mx3DPointFloat g_unk0x10104ef0;
};
// GLOBAL: LEGO1 0x100d7660
// Act3Actor::`vbtable'
#endif // ACT3ACTORS_H

View file

@ -68,15 +68,6 @@ class LegoAct2 : public LegoWorld {
void SetUnknown0x1138(Act2Actor* p_unk0x1138) { m_unk0x1138 = p_unk0x1138; }
void SetDestLocation(LegoGameState::Area p_destLocation) { m_destLocation = p_destLocation; }
undefined4 FUN_10052560(
MxS32 p_param1,
MxBool p_param2,
MxBool p_param3,
Mx3DPointFloat* p_location,
Mx3DPointFloat* p_direction,
Mx3DPointFloat* p_param6
);
// SYNTHETIC: LEGO1 0x1004fe20
// LegoAct2::`scalar deleting destructor'
@ -86,20 +77,33 @@ class LegoAct2 : public LegoWorld {
MxLong HandlePathStruct(LegoPathStructNotificationParam& p_param);
void PlayMusic(JukeboxScript::Script p_objectId);
void FUN_10051900();
void FUN_10051960();
void InitBricks();
void UninitBricks();
void SpawnBricks();
void FUN_10051fa0(MxS32 p_param1);
void FUN_100521f0(MxS32 p_param1);
MxResult FUN_10052560(
Act2mainScript::Script p_objectId,
MxBool p_param2,
MxBool p_param3,
Mx3DPointFloat* p_location,
Mx3DPointFloat* p_direction,
Mx3DPointFloat* p_param6
);
MxResult FUN_10052800();
Act2Brick m_bricks[10]; // 0x00f8
undefined m_unk0x10c0; // 0x10c0
MxU8 m_nextBrick; // 0x10c0
undefined m_unk0x10c1; // 0x10c1
undefined m_unk0x10c2; // 0x10c2
MxBool m_ready; // 0x10c2
undefined4 m_unk0x10c4; // 0x10c4
JukeboxScript::Script m_music; // 0x10c8
LegoAct2State* m_gameState; // 0x10cc
MxS32 m_unk0x10d0; // 0x10d0
// variable name verified by BETA10 0x10014633
char* m_siFile; // 0x10d4
const char* m_siFile; // 0x10d4
LegoROI* m_pepper; // 0x10d8
MxMatrix m_unk0x10dc; // 0x10dc
@ -110,9 +114,13 @@ class LegoAct2 : public LegoWorld {
undefined4 m_unk0x1134; // 0x1134
Act2Actor* m_unk0x1138; // 0x1138
undefined m_unk0x113c; // 0x113c
undefined4 m_unk0x1140; // 0x1140
Act2mainScript::Script m_unk0x1140; // 0x1140
Act2mainScript::Script m_unk0x1144; // 0x1144
undefined m_unk0x1148[0x08]; // 0x1148
undefined4 m_unk0x1148; // 0x1148
undefined m_firstBrick; // 0x114c
undefined m_secondBrick; // 0x114d
undefined m_thirdBrick; // 0x114e
undefined m_fourthBrick; // 0x114e
LegoGameState::Area m_destLocation; // 0x1150
};

View file

@ -82,6 +82,7 @@ class LegoAnimActor : public virtual LegoPathActor {
// Vector<LegoAnimActorStruct *>::~Vector<LegoAnimActorStruct *>
// SYNTHETIC: LEGO1 0x10012b90
// SYNTHETIC: BETA10 0x1000fad0
// LegoAnimActor::`vbase destructor'
// TEMPLATE: LEGO1 0x1001c010

View file

@ -157,7 +157,7 @@ class LegoAnimationManager : public MxCore {
MxResult ReadModelInfo(LegoFile* p_file, ModelInfo* p_info);
void FUN_10060480(LegoChar* p_characterNames[], MxU32 p_numCharacterNames);
void FUN_100604d0(MxBool p_unk0x08);
void FUN_100604f0(MxS32 p_objectIds[], undefined4 p_numObjectIds);
void FUN_100604f0(MxS32 p_objectIds[], MxU32 p_numObjectIds);
void FUN_10060540(MxBool p_unk0x29);
void FUN_10060570(MxBool p_unk0x1a);
MxResult StartEntityAction(MxDSAction& p_dsAction, LegoEntity* p_entity);

View file

@ -45,7 +45,8 @@ class LegoCacheSound : public MxCore {
void Stop();
void FUN_10006be0();
void SetDistance(MxS32 p_min, MxS32 p_max);
void Mute(MxBool p_mute);
void MuteSilence(MxBool p_muted);
void MuteStop(MxBool p_mute);
// SYNTHETIC: LEGO1 0x10006610
// LegoCacheSound::`scalar deleting destructor'

View file

@ -54,9 +54,17 @@ class LegoEventNotificationParam : public MxNotificationParam {
MxS32 GetY() const { return m_y; }
void SetROI(LegoROI* p_roi) { m_roi = p_roi; }
// FUNCTION: BETA10 0x1007d620
void SetModifier(MxU8 p_modifier) { m_modifier = p_modifier; }
// FUNCTION: BETA10 0x1007d6b0
void SetKey(MxU8 p_key) { m_key = p_key; }
// FUNCTION: BETA10 0x1007d650
void SetX(MxS32 p_x) { m_x = p_x; }
// FUNCTION: BETA10 0x1007d680
void SetY(MxS32 p_y) { m_y = p_y; }
protected:

View file

@ -18,10 +18,12 @@ extern MxLong g_unk0x100f3308;
extern const char* g_strHIT_WALL_SOUND;
// VTABLE: LEGO1 0x100d6e28
// VTABLE: BETA10 0x101bdc08
// SIZE 0x154
class LegoPathActor : public LegoActor {
public:
enum {
c_bit2 = 0x02,
c_bit3 = 0x04,
c_bit9 = 0x100
};

View file

@ -22,7 +22,9 @@ class Vector3;
// VTABLE: LEGO1 0x100d7da8
// SIZE 0x40
struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {};
struct LegoPathCtrlEdge : public LegoUnknown100db7f4 {
inline MxU32 FUN_10048c40(const Vector3& p_position);
};
struct LegoPathCtrlEdgeCompare {
MxU32 operator()(const LegoPathCtrlEdge* p_lhs, const LegoPathCtrlEdge* p_rhs) const
@ -117,6 +119,17 @@ class LegoPathController : public MxCore {
LegoUnknown100db7f4*& p_edge,
LegoPathBoundary*& p_boundary
);
MxResult FUN_10048310(
LegoPathEdgeContainer* p_grec,
const Vector3& p_oldPosition,
const Vector3& p_oldDirection,
LegoPathBoundary* p_oldBoundary,
const Vector3& p_newPosition,
const Vector3& p_newDirection,
LegoPathBoundary* p_newBoundary,
LegoU8 p_mask,
MxFloat* p_param9
);
static MxResult Init();
static MxResult Reset();
@ -171,6 +184,15 @@ class LegoPathController : public MxCore {
// TEMPLATE: LEGO1 0x100451a0
// _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::~_Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathControl
// TEMPLATE: LEGO1 0x10045270
// _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::iterator::_Inc
// TEMPLATE: LEGO1 0x100452b0
// _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::erase
// TEMPLATE: LEGO1 0x10045700
// _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Erase
// TEMPLATE: LEGO1 0x100457e0
// Set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare>::~Set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare>
@ -210,14 +232,92 @@ class LegoPathController : public MxCore {
// SYNTHETIC: LEGO1 0x10047ae0
// LegoUnknown100db7f4::~LegoUnknown100db7f4
// TEMPLATE: LEGO1 0x10048f00
// list<LegoBoundaryEdge,allocator<LegoBoundaryEdge> >::begin
// TEMPLATE: LEGO1 0x10048f10
// list<LegoBoundaryEdge,allocator<LegoBoundaryEdge> >::insert
// TEMPLATE: LEGO1 0x10048f70
// list<LegoBoundaryEdge,allocator<LegoBoundaryEdge> >::erase
// TEMPLATE: LEGO1 0x10048fc0
// _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,Le
// TEMPLATE: LEGO1 0x10049160
// ?erase@?$_Tree@PAULegoPathCtrlEdge@@PAU1@U_Kfn@?$set@PAULegoPathCtrlEdge@@ULegoPathCtrlEdgeCompare@@V?$allocator@PAULegoPathCtrlEdge@@@@@@ULegoPathCtrlEdgeCompare@@V?$allocator@PAULegoPathCtrlEdge@@@@@@QAEIABQAULegoPathCtrlEdge@@@Z
// TEMPLATE: LEGO1 0x10049290
// _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::find
// TEMPLATE: LEGO1 0x100492f0
// _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Copy
// TEMPLATE: LEGO1 0x10049370
// _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Ubound
// TEMPLATE: LEGO1 0x100493a0
// list<LegoBEWithFloat,allocator<LegoBEWithFloat> >::~list<LegoBEWithFloat,allocator<LegoBEWithFloat> >
// TEMPLATE: LEGO1 0x10049410
// list<LegoBEWithFloat,allocator<LegoBEWithFloat> >::insert
// TEMPLATE: LEGO1 0x10049470
// list<LegoBEWithFloat,allocator<LegoBEWithFloat> >::_Buynode
// TEMPLATE: LEGO1 0x100494a0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::iterator::_Inc
// TEMPLATE: LEGO1 0x100494e0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::~_Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFlo
// TEMPLATE: LEGO1 0x100495b0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::insert
// TEMPLATE: LEGO1 0x10049840
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::iterator::_Dec
// TEMPLATE: LEGO1 0x10049890
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::erase
// TEMPLATE: LEGO1 0x10049cf0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Buynode
// TEMPLATE: LEGO1 0x10049d50
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Init
// TEMPLATE: LEGO1 0x10049e00
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Insert
// TEMPLATE: LEGO1 0x10049d10
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Erase
// TEMPLATE: LEGO1 0x1004a090
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Lrotate
// TEMPLATE: LEGO1 0x1004a0f0
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Rrotate
// TEMPLATE: LEGO1 0x1004a150
// List<LegoBEWithFloat>::~List<LegoBEWithFloat>
// TEMPLATE: LEGO1 0x1004a1a0
// Multiset<LegoBEWithFloat *,LegoBEWithFloatComparator>::~Multiset<LegoBEWithFloat *,LegoBEWithFloatComparator>
// TEMPLATE: LEGO1 0x1004a1f0
// multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::~multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >
// TEMPLATE: LEGO1 0x1004a760
// _Construct
// TEMPLATE: LEGO1 0x1004a780
// _Construct
// GLOBAL: LEGO1 0x100f4360
// _Tree<LegoPathCtrlEdge *,LegoPathCtrlEdge *,set<LegoPathCtrlEdge *,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Kfn,LegoPathCtrlEdgeCompare,allocator<LegoPathCtrlEdge *> >::_Nil
// GLOBAL: LEGO1 0x100f4364
// _Tree<LegoBEWithFloat *,LegoBEWithFloat *,multiset<LegoBEWithFloat *,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Kfn,LegoBEWithFloatComparator,allocator<LegoBEWithFloat *> >::_Nil
// clang-format on
#endif // LEGOPATHCONTROLLER_H

View file

@ -6,17 +6,73 @@
#include "mxtypes.h"
class LegoPathBoundary;
struct LegoUnknown100db7f4;
struct LegoPathCtrlEdge;
// SIZE 0x08
struct LegoBoundaryEdge {
LegoUnknown100db7f4* m_edge; // 0x00
LegoBoundaryEdge() {}
// FUNCTION: BETA10 0x100bd620
LegoBoundaryEdge(LegoPathCtrlEdge* p_edge, LegoPathBoundary* p_boundary)
{
m_edge = p_edge;
m_boundary = p_boundary;
}
LegoPathCtrlEdge* m_edge; // 0x00
LegoPathBoundary* m_boundary; // 0x04
int operator==(LegoBoundaryEdge) const { return 0; }
int operator<(LegoBoundaryEdge) const { return 0; }
};
// SIZE 0x10
struct LegoBEWithFloat {
LegoBEWithFloat()
{
m_edge = NULL;
m_boundary = NULL;
m_next = NULL;
m_unk0x0c = 0.0f;
}
// FUNCTION: BETA10 0x100bd9a0
LegoBEWithFloat(LegoPathCtrlEdge* p_edge, LegoPathBoundary* p_boundary, MxFloat p_unk0x0c)
{
m_edge = p_edge;
m_boundary = p_boundary;
m_next = NULL;
m_unk0x0c = p_unk0x0c;
}
// FUNCTION: BETA10 0x100bd9f0
LegoBEWithFloat(LegoPathCtrlEdge* p_edge, LegoPathBoundary* p_boundary, LegoBEWithFloat* p_next, MxFloat p_unk0x0c)
{
m_edge = p_edge;
m_boundary = p_boundary;
m_next = p_next;
m_unk0x0c = p_unk0x0c;
}
LegoPathCtrlEdge* m_edge; // 0x00
LegoPathBoundary* m_boundary; // 0x04
LegoBEWithFloat* m_next; // 0x08
MxFloat m_unk0x0c; // 0x0c
int operator==(LegoBEWithFloat) const { return 0; }
int operator<(LegoBEWithFloat) const { return 0; }
};
struct LegoBEWithFloatComparator {
// FUNCTION: BETA10 0x100bef80
bool operator()(LegoBEWithFloat* const& p_a, LegoBEWithFloat* const& p_b) const
{
return p_a->m_unk0x0c < p_b->m_unk0x0c;
}
};
typedef multiset<LegoBEWithFloat*, LegoBEWithFloatComparator> LegoBEWithFloatSet;
// SIZE 0x3c
struct LegoPathEdgeContainer : public list<LegoBoundaryEdge> {
enum {
@ -30,9 +86,10 @@ struct LegoPathEdgeContainer : public list<LegoBoundaryEdge> {
m_flags = 0;
}
void SetBit1(MxU32 p_flag)
// FUNCTION: BETA10 0x100bd660
void SetBit1(MxU32 p_set)
{
if (p_flag) {
if (p_set) {
m_flags |= c_bit1;
}
else {
@ -40,10 +97,11 @@ struct LegoPathEdgeContainer : public list<LegoBoundaryEdge> {
}
}
// FUNCTION: BETA10 0x1001cb50
MxU32 GetBit1() { return m_flags & c_bit1; }
Mx3DPointFloat m_unk0x0c; // 0x0c
Mx3DPointFloat m_unk0x20; // 0x20
Mx3DPointFloat m_position; // 0x0c
Mx3DPointFloat m_direction; // 0x20
LegoPathBoundary* m_boundary; // 0x34
MxU8 m_flags; // 0x38
};

View file

@ -1,13 +1,33 @@
#include "act2actor.h"
#include "legocachesoundmanager.h"
#include "legopathcontroller.h"
#include "legopathedgecontainer.h"
#include "legosoundmanager.h"
#include "misc.h"
#include "roi/legoroi.h"
DECOMP_SIZE_ASSERT(Act2Actor, 0x1a8)
DECOMP_SIZE_ASSERT(Act2Actor::UnknownListStructure, 0x20)
// STUB: LEGO1 0x100187e0
// GLOBAL: LEGO1 0x100f0db8
// GLOBAL: BETA10 0x101dbd00
Act2Actor::UnknownListStructure g_unk0x100f0db8[] = {
{{-47.92, 7.0699968, -31.58}, {-0.999664, 0.0, -0.025916}, "edg01_27", FALSE},
{{-70.393349, 8.07, 3.151935}, {-0.90653503, 0.0, 0.422131}, "int06", FALSE},
{{-47.74, 4.079995, -52.3}, {-0.98293, 0.0, -0.18398}, "edg01_08", FALSE},
{{-26.273487, 0.069, 12.170015}, {0.987199, 0.0, -0.159491}, "INT14", FALSE},
{{26.16499, 0.069, 5.61}, {0.027719, 0.0, 0.999616}, "INT22", FALSE},
{{66.383446, 4.07, 32.387417}, {0.979487, 0.0, -0.201506}, "edg02_27", FALSE},
{{71.843285, 0.069, -49.524852}, {0.99031502, 0.0, 0.13884}, "edg02_39", FALSE},
{{26.470566, 0.069, -44.670845}, {0.004602, 0.0, -0.99998897}, "int26", FALSE},
{{-6.323625, 0.069, -47.96045}, {-0.982068, 0.0, 0.188529}, "edg02_53", FALSE},
{{-36.689, -0.978409, 31.449}, {0.083792, -0.94303, -0.66398698}, "edg00_157", FALSE},
{{-44.6, 0.1, 45.3}, {0.95, 0.0, -0.3}, "edg00_154", FALSE},
};
// FUNCTION: LEGO1 0x100187e0
// FUNCTION: BETA10 0x1000c7fb
Act2Actor::Act2Actor()
{
m_unk0x1c = 0;
@ -19,23 +39,47 @@ Act2Actor::Act2Actor()
m_unk0x28 = 4;
m_unk0x2c = 0;
m_unk0x30 = 0;
m_unk0x34 = 0;
m_shootAnim = NULL;
m_unk0x44 = 0;
m_unk0x40 = 1;
m_unk0x48 = 0;
m_unk0x4c = 0;
m_unk0x38 = 0;
m_unk0x38 = NULL;
m_unk0x3c = 0;
// Odd: The code says < 10, but there are 11 entries in the array
for (MxS32 i = 0; i < 10; i++) {
g_unk0x100f0db8[i].m_unk0x1c = 0;
}
}
// FUNCTION: LEGO1 0x10018940
// FUNCTION: BETA10 0x1003d65f
void Act2Actor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
{
LegoAnimActor::SetROI(p_roi, p_bool1, p_bool2);
m_roi->SetVisibility(FALSE);
}
// FUNCTION: LEGO1 0x10018980
// FUNCTION: BETA10 0x1000c963
void Act2Actor::FUN_10018980()
{
for (MxS32 i = 0; i < m_animMaps.size(); i++) {
if (m_animMaps[i]->GetUnknown0x00() == -1.0f) {
m_shootAnim = m_animMaps[i];
}
}
assert(m_shootAnim);
m_unk0x38 = SoundManager()->GetCacheSoundManager()->FindSoundByKey("xarrow");
m_unk0x38->SetDistance(45, 55);
m_roi->SetVisibility(TRUE);
}
// FUNCTION: LEGO1 0x100189f0
// FUNCTION: BETA10 0x1000ca64
MxResult Act2Actor::VTable0x94(LegoPathActor*, MxBool)
{
if (m_unk0x1f == FALSE) {
@ -47,38 +91,211 @@ MxResult Act2Actor::VTable0x94(LegoPathActor*, MxBool)
return SUCCESS;
}
// STUB: LEGO1 0x10018a20
// FUNCTION: LEGO1 0x10018a20
MxResult Act2Actor::VTable0x9c()
{
// TODO
return SUCCESS;
if (m_grec && !(m_grec->m_flags & LegoPathEdgeContainer::c_bit1)) {
delete m_grec;
m_grec = NULL;
return SUCCESS;
}
else {
if (m_unk0x1f) {
MxMatrix matrix = m_roi->GetLocal2World();
matrix[3][1] -= 3.0f;
m_roi->UpdateTransformationRelativeToParent(matrix);
LegoROI* brickstrROI = FindROI("brickstr");
MxMatrix brickstrMatrix = brickstrROI->GetLocal2World();
brickstrMatrix[3][1] -= 3.0f;
brickstrROI->UpdateTransformationRelativeToParent(brickstrMatrix);
}
return LegoPathActor::VTable0x9c();
}
}
// STUB: LEGO1 0x10018c30
// STUB: BETA10 0x1000cb52
void Act2Actor::VTable0x70(float p_und)
{
// TODO
}
// FUNCTION: LEGO1 0x10019280
// FUNCTION: BETA10 0x1000d4a6
void Act2Actor::SetWorldSpeed(MxFloat p_worldSpeed)
{
LegoAnimActor::SetWorldSpeed(p_worldSpeed);
m_unk0x44 = 0;
}
// STUB: LEGO1 0x10019520
// STUB: BETA10 0x1000d4d6
void Act2Actor::FUN_10019520()
// FUNCTION: LEGO1 0x100192a0
// FUNCTION: BETA10 0x1000d4d6
void Act2Actor::FUN_100192a0(undefined4 p_param)
{
// TODO
Mx3DPointFloat newPosition(0.0, 0.0, 0.0);
Mx3DPointFloat newDirection(0.0, 0.0, 0.0);
if (m_grec) {
delete m_grec;
}
m_grec = new LegoPathEdgeContainer();
assert(m_grec);
newPosition = g_unk0x100f0db8[p_param].m_position;
newDirection = g_unk0x100f0db8[p_param].m_direction;
LegoPathBoundary* newBoundary = m_controller->GetPathBoundary(g_unk0x100f0db8[p_param].m_boundary);
MxResult sts = m_controller->FUN_10048310(
m_grec,
m_roi->GetWorldPosition(),
m_roi->GetWorldDirection(),
m_boundary,
newPosition,
newDirection,
newBoundary,
LegoUnknown100db7f4::c_bit1,
NULL
);
assert(!sts); // == SUCCESS
if (sts != SUCCESS) {
delete m_grec;
m_grec = NULL;
}
}
// STUB: LEGO1 0x100195a0
// FUNCTION: LEGO1 0x10019520
void Act2Actor::FUN_10019520()
{
m_unk0x1e = 4;
SetWorldSpeed(m_unk0x28 + 3);
FUN_100192a0(10);
}
// FUNCTION: LEGO1 0x10019560
void Act2Actor::FUN_10019560()
{
m_unk0x1e = 5;
SetWorldSpeed(m_unk0x28 + 5);
FUN_100192a0(9);
}
// FUNCTION: LEGO1 0x100195a0
// FUNCTION: BETA10 0x1000d7d3
MxS32 Act2Actor::VTable0xa0()
{
// TODO
return 0;
undefined4 newLocation;
CurrentWorld();
MxU16 randomVal = rand() / (RAND_MAX / 2) + 1;
if (m_unk0x48 == 8 && m_unk0x1d != 8) {
newLocation = 8;
}
else {
switch (m_unk0x1d) {
case 0:
if (randomVal == 1) {
newLocation = 3;
}
else {
newLocation = 7;
}
break;
case 1:
if (randomVal == 1) {
newLocation = 2;
}
else {
newLocation = 4;
}
break;
case 2:
if (randomVal == 1) {
newLocation = 3;
}
else {
newLocation = 6;
}
break;
case 3:
if (randomVal == 1) {
newLocation = 5;
}
else {
newLocation = 1;
}
break;
case 4:
if (randomVal == 1) {
newLocation = 7;
}
else {
newLocation = 0;
}
break;
case 5:
if (randomVal == 1) {
newLocation = 6;
}
else {
newLocation = 1;
}
break;
case 6:
if (randomVal == 1) {
newLocation = 0;
}
else {
newLocation = 4;
}
break;
case 7:
if (randomVal == 1) {
newLocation = 2;
}
else {
newLocation = 5;
}
break;
case 8:
if (randomVal == 1) {
newLocation = 0;
}
else {
newLocation = 4;
}
}
}
undefined4 firstChoice = newLocation;
if (m_unk0x48 < 7 || g_unk0x100f0db8[m_unk0x1d].m_unk0x1c) {
while (g_unk0x100f0db8[newLocation].m_unk0x1c || m_unk0x1d == newLocation) {
if (newLocation == 7) {
newLocation = 0;
}
else {
newLocation++;
}
assert(newLocation != firstChoice);
}
}
m_unk0x1d = newLocation;
FUN_100192a0(newLocation);
if (m_grec) {
return SUCCESS;
}
else {
return FAILURE;
}
}
// FUNCTION: LEGO1 0x1001a180

View file

@ -1,23 +1,87 @@
#include "act3actors.h"
#include "roi/legoroi.h"
DECOMP_SIZE_ASSERT(Act3Actor, 0x178)
// STUB: LEGO1 0x1003fa50
// Initialized at LEGO1 0x1003fa20
// GLOBAL: LEGO1 0x10104ef0
Mx3DPointFloat Act3Actor::g_unk0x10104ef0 = Mx3DPointFloat(0.0, 5.0, 0.0);
// FUNCTION: LEGO1 0x1003fa50
Act3Actor::Act3Actor()
{
m_unk0x1c = 0;
}
// STUB: LEGO1 0x1003fb70
MxU32 Act3Actor::VTable0x90(float, Matrix4&)
// FUNCTION: LEGO1 0x1003fb70
MxU32 Act3Actor::VTable0x90(float p_float, Matrix4& p_transform)
{
// TODO
// Note: Code duplication with LegoExtraActor::VTable0x90
switch (m_state & 0xff) {
case 0:
case 1:
return TRUE;
case 2:
m_unk0x1c = p_float + 2000.0f;
m_state = 3;
m_actorTime += (p_float - m_lastTime) * m_worldSpeed;
m_lastTime = p_float;
return FALSE;
case 3:
assert(!m_userNavFlag);
Vector3 positionRef(p_transform[3]);
p_transform = m_roi->GetLocal2World();
if (m_unk0x1c > p_float) {
Mx3DPointFloat position;
position = positionRef;
positionRef.Clear();
p_transform.RotateX(0.6);
positionRef = position;
m_actorTime += (p_float - m_lastTime) * m_worldSpeed;
m_lastTime = p_float;
VTable0x74(p_transform);
return FALSE;
}
else {
m_state = 0;
m_unk0x1c = 0;
positionRef -= g_unk0x10104ef0;
m_roi->FUN_100a58f0(p_transform);
m_roi->VTable0x14();
return TRUE;
}
}
return FALSE;
}
// STUB: LEGO1 0x1003fd90
MxResult Act3Actor::VTable0x94(LegoPathActor*, MxBool)
// FUNCTION: LEGO1 0x1003fd90
MxResult Act3Actor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
{
// TODO
return 0;
if (!p_actor->GetUserNavFlag() && p_bool) {
if (p_actor->GetState()) {
return FAILURE;
}
LegoROI* roi = p_actor->GetROI();
MxMatrix local2world;
local2world = roi->GetLocal2World();
Vector3(local2world[3]) += g_unk0x10104ef0;
roi->FUN_100a58f0(local2world);
roi->VTable0x14();
p_actor->SetState(c_bit2 | c_bit9);
}
return SUCCESS;
}

View file

@ -130,8 +130,9 @@ void Ambulance::CreateState()
MxLong Ambulance::Notify(MxParam& p_param)
{
MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationType0:
result = HandleNotification0();
break;

View file

@ -19,9 +19,12 @@ BuildingEntity::~BuildingEntity()
}
// FUNCTION: LEGO1 0x100150a0
// FUNCTION: BETA10 0x10024e37
MxLong BuildingEntity::Notify(MxParam& p_param)
{
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) {
MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationClick) {
return HandleClick((LegoEventNotificationParam&) p_param);
}

View file

@ -33,10 +33,12 @@ BumpBouy::~BumpBouy()
MxLong BumpBouy::Notify(MxParam& p_param)
{
MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
IslePathActor* user = (IslePathActor*) UserActor();
assert(user);
if (user->IsA("Jetski") && ((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) {
if (user->IsA("Jetski") && param.GetNotification() == c_notificationClick) {
VideoManager()->SetRender3D(FALSE);
user->SetWorldSpeed(0);
user->Exit();

View file

@ -226,8 +226,8 @@ MxLong Helicopter::HandleControl(LegoControlManagerNotificationParam& p_param)
dir = m_world->GetCamera()->GetWorldDirection();
lookat = dir;
float scale = 3;
lookat.Mul(scale);
lookat.Add(loc);
lookat *= scale;
lookat += loc;
Mx3DPointFloat v68, v7c, v90(0, 1, 0), va4;
v68 = m_world->GetCamera()->GetWorldUp();
va4.EqualsCross(&v68, &dir);
@ -379,9 +379,9 @@ void Helicopter::VTable0x70(float p_float)
mat.SetIdentity();
m_unk0x1f4.Unknown6(mat, f2);
v2.SetVector(loc);
v2.Sub(v);
v2.Mul(f2);
v2.Add(v);
v2 -= v;
v2 *= f2;
v2 += v;
m_world->GetCamera()->FUN_100123e0(mat, 0);
}
else {

View file

@ -25,11 +25,13 @@ MxResult IsleActor::Create(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x1002c7b0
// FUNCTION: BETA10 0x1003622e
MxLong IsleActor::Notify(MxParam& p_param)
{
MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationType0:
result = VTable0x6c();
break;

View file

@ -46,11 +46,13 @@ void IslePathActor::Destroy(MxBool p_fromDestructor)
}
// FUNCTION: LEGO1 0x1001a2c0
// FUNCTION: BETA10 0x100364ca
MxLong IslePathActor::Notify(MxParam& p_param)
{
MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationType0:
result = HandleNotification0();
break;
@ -124,8 +126,8 @@ void IslePathActor::Exit()
Mx3DPointFloat local20;
e->FUN_1002ddc0(*m_boundary, local20);
((Vector3&) local20).Mul(m_roi->GetWorldBoundingSphere().Radius());
((Vector3&) local20).Add(GetWorldPosition());
local20 *= m_roi->GetWorldBoundingSphere().Radius();
local20 += GetWorldPosition();
MxS32 j;
for (j = 0; j < m_boundary->GetNumEdges(); j++) {
@ -641,7 +643,7 @@ void IslePathActor::FUN_1001b660()
Vector3 direction(transform[1]);
Vector3 up(transform[2]);
((Vector3&) up).Mul(-1.0f);
up *= -1.0f;
position.EqualsCross(&direction, &up);
m_roi->FUN_100a58f0(transform);
m_roi->VTable0x14();

View file

@ -30,9 +30,12 @@ JukeBoxEntity::~JukeBoxEntity()
}
// FUNCTION: LEGO1 0x10085e40
// FUNCTION: BETA10 0x10038c37
MxLong JukeBoxEntity::Notify(MxParam& p_param)
{
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) {
MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationClick) {
if (!FUN_1003ef60()) {
return 1;
}

View file

@ -81,12 +81,14 @@ Radio::~Radio()
}
// FUNCTION: LEGO1 0x1002ca30
// FUNCTION: BETA10 0x100f19e8
MxLong Radio::Notify(MxParam& p_param)
{
MxLong result = 0;
if (m_unk0x0c) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (param.GetNotification()) {
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;

View file

@ -113,11 +113,13 @@ void TowTrack::CreateState()
}
// FUNCTION: LEGO1 0x1004cc80
// FUNCTION: BETA10 0x100f6de2
MxLong TowTrack::Notify(MxParam& p_param)
{
MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationType0:
result = HandleNotification0();
break;

View file

@ -224,9 +224,26 @@ void LegoCacheSound::FUN_10006cd0(undefined4, undefined4)
{
}
// FUNCTION: LEGO1 0x10006ce0
void LegoCacheSound::MuteSilence(MxBool p_muted)
{
if (m_muted != p_muted) {
m_muted = p_muted;
if (m_muted) {
m_dsBuffer->SetVolume(-3000);
}
else {
MxS32 volume = m_volume * SoundManager()->GetVolume() / 100;
MxS32 attenuation = SoundManager()->GetAttenuation(volume);
m_dsBuffer->SetVolume(attenuation);
}
}
}
// FUNCTION: LEGO1 0x10006d40
// FUNCTION: BETA10 0x10066ec8
void LegoCacheSound::Mute(MxBool p_muted)
void LegoCacheSound::MuteStop(MxBool p_muted)
{
if (m_muted != p_muted) {
m_muted = p_muted;

View file

@ -196,9 +196,12 @@ void MxBackgroundAudioManager::FadeInOrFadeOut()
}
// FUNCTION: LEGO1 0x1007f170
// FUNCTION: BETA10 0x100e8eb6
MxLong MxBackgroundAudioManager::Notify(MxParam& p_param)
{
switch (((MxNotificationParam&) p_param).GetNotification()) {
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (param.GetNotification()) {
case c_notificationStartAction:
StartAction(p_param);
return 1;

View file

@ -656,9 +656,10 @@ MxResult LegoCarBuild::Tickle()
MxLong LegoCarBuild::Notify(MxParam& p_param)
{
MxLong result = LegoWorld::Notify(p_param);
MxNotificationParam& param = (MxNotificationParam&) p_param;
if (m_worldStarted) {
switch (((MxNotificationParam*) &p_param)->GetNotification()) {
switch (param.GetNotification()) {
case c_notificationType0:
FUN_10024c20((LegoEventNotificationParam*) &p_param);
result = 1;

View file

@ -903,7 +903,7 @@ void LegoAnimationManager::FUN_100604d0(MxBool p_unk0x08)
// FUNCTION: LEGO1 0x100604f0
// FUNCTION: BETA10 0x1004137b
void LegoAnimationManager::FUN_100604f0(MxS32 p_objectIds[], undefined4 p_numObjectIds)
void LegoAnimationManager::FUN_100604f0(MxS32 p_objectIds[], MxU32 p_numObjectIds)
{
for (MxS32 i = 0; i < p_numObjectIds; i++) {
for (MxS32 j = 0; j < m_animCount; j++) {
@ -1599,8 +1599,7 @@ MxU16 LegoAnimationManager::FUN_10062110(
if (direction.Dot(&direction, &p_direction) > 0.707) {
Mx3DPointFloat position(p_roi->GetWorldPosition());
// TODO: Fix call
((Vector3&) position).Sub(p_position);
position -= p_position;
float len = position.LenSquared();
float min, max;
@ -1764,9 +1763,7 @@ MxBool LegoAnimationManager::FUN_10062650(Vector3& p_position, float p_und, Lego
{
if (p_roi != NULL) {
Mx3DPointFloat position(p_position);
// TODO: Fix call
((Vector3&) position).Sub(p_roi->GetWorldPosition());
position -= p_roi->GetWorldPosition();
float len = position.LenSquared();
if (len <= 0.0f) {
@ -2174,7 +2171,7 @@ MxBool LegoAnimationManager::FUN_10062e20(LegoROI* p_roi, LegoAnimPresenter* p_p
position = p_roi->GetWorldPosition();
direction = p_roi->GetWorldDirection();
((Vector3&) direction).Mul(-1.0f);
direction *= -1.0f;
m_extras[i].m_speed = -1.0f;
if (inExtras) {
@ -2485,17 +2482,17 @@ MxBool LegoAnimationManager::FUN_10064010(LegoPathBoundary* p_boundary, LegoUnkn
Vector3* v2 = p_edge->CCWVertex(*p_boundary);
p1 = *v2;
((Vector3&) p1).Sub(*v1);
((Vector3&) p1).Mul(p_destScale);
((Vector3&) p1).Add(*v1);
p1 -= *v1;
p1 *= p_destScale;
p1 += *v1;
BoundingBox boundingBox;
Mx3DPointFloat vec(1.0f, 1.0f, 1.0f);
boundingBox.Min() = p1;
boundingBox.Min().Sub(vec);
boundingBox.Min() -= vec;
boundingBox.Max() = p1;
boundingBox.Max().Add(vec);
boundingBox.Max() += vec;
return GetViewManager()->IsBoundingBoxInFrustum(boundingBox) == FALSE;
}
@ -2553,7 +2550,7 @@ MxBool LegoAnimationManager::FUN_10064120(LegoLocation::Boundary* p_boundary, Mx
while (local2c--) {
if (local34 != NULL) {
if (local34->Unknown(*boundary, LegoWEGEdge::c_bit1) && FUN_10064010(boundary, local34, destScale) &&
if (local34->BETA_1004a830(*boundary, LegoWEGEdge::c_bit1) && FUN_10064010(boundary, local34, destScale) &&
(!p_bool2 || FUN_10064010(boundary, local8, destScale))) {
p_boundary->m_srcScale = p_boundary->m_destScale = destScale;
p_boundary->m_name = boundary->GetName();
@ -2704,7 +2701,7 @@ MxResult LegoAnimationManager::FUN_10064670(Vector3* p_position)
if (p_position != NULL) {
Mx3DPointFloat vec(98.875f, 0.0f, -46.1564f);
((Vector3&) vec).Sub(*p_position);
vec -= *p_position;
if (vec.LenSquared() < 800.0f) {
success = TRUE;
@ -2728,7 +2725,7 @@ MxResult LegoAnimationManager::FUN_10064740(Vector3* p_position)
if (p_position != NULL) {
Mx3DPointFloat vec(-21.375f, 0.0f, -41.75f);
((Vector3&) vec).Sub(*p_position);
vec -= *p_position;
if (vec.LenSquared() < 1000.0f) {
success = TRUE;

View file

@ -215,9 +215,9 @@ void LegoAnimMMPresenter::DoneTickle()
MxLong LegoAnimMMPresenter::Notify(MxParam& p_param)
{
AUTOLOCK(m_criticalSection);
MxNotificationParam& param = (MxNotificationParam&) p_param;
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationEndAction &&
((MxNotificationParam&) p_param).GetSender() == m_presenter) {
if (param.GetNotification() == c_notificationEndAction && param.GetSender() == m_presenter) {
m_presenter = NULL;
}

View file

@ -197,7 +197,7 @@ void LegoGameState::SetActor(MxU8 p_actorId)
delete oldActor;
}
newActor->ClearFlag(0x02);
newActor->ClearFlag(LegoEntity::c_managerOwned);
SetUserActor(newActor);
}

View file

@ -1,6 +1,7 @@
#include "act2brick.h"
#include "legocachesoundmanager.h"
#include "legocharactermanager.h"
#include "legosoundmanager.h"
#include "legoworld.h"
#include "misc.h"
@ -11,10 +12,16 @@
#include "mxtimer.h"
#include "roi/legoroi.h"
#include <assert.h>
#include <stdio.h>
#include <vec.h>
DECOMP_SIZE_ASSERT(Act2Brick, 0x194)
// GLOBAL: LEGO1 0x100f7a38
LegoChar* Act2Brick::g_lodNames[] =
{"xchbase1", "xchblad1", "xchseat1", "xchtail1", "xhback1", "xhljet1", "xhmidl1", "xhmotr1", "xhsidl1", "xhsidr1"};
// GLOBAL: LEGO1 0x100f7a60
MxLong Act2Brick::g_lastHitActorTime = 0;
@ -32,6 +39,73 @@ Act2Brick::~Act2Brick()
TickleManager()->UnregisterClient(this);
}
// FUNCTION: LEGO1 0x1007a4e0
// FUNCTION: BETA10 0x10012ad5
MxResult Act2Brick::Create(MxS32 p_index)
{
if (m_roi != NULL) {
return FAILURE;
}
char name[12];
sprintf(name, "chbrick%d", p_index);
m_roi = CharacterManager()->CreateAutoROI(name, g_lodNames[p_index], FALSE);
BoundingSphere sphere = m_roi->GetBoundingSphere();
sphere.Center()[1] -= 0.3;
if (p_index < 6) {
sphere.Radius() = m_roi->GetBoundingSphere().Radius() * 0.5f;
}
else {
sphere.Radius() = m_roi->GetBoundingSphere().Radius() * 2.0f;
}
m_roi->SetBoundingSphere(sphere);
m_roi->SetEntity(this);
CurrentWorld()->Add(this);
m_unk0x164 = 1;
return SUCCESS;
}
// FUNCTION: LEGO1 0x1007a620
// FUNCTION: BETA10 0x10012ba2
void Act2Brick::Remove()
{
StopWhistleSound();
CurrentWorld()->Remove(this);
if (m_roi != NULL) {
CharacterManager()->ReleaseActor(m_roi->GetName());
m_roi = NULL;
}
m_unk0x164 = 0;
}
// FUNCTION: LEGO1 0x1007a670
// FUNCTION: BETA10 0x10012c04
void Act2Brick::FUN_1007a670(MxMatrix& p_param1, MxMatrix& p_param2, LegoPathBoundary* p_boundary)
{
m_unk0x17c = p_param2[3];
m_unk0x168 = p_param2[3];
m_unk0x168 -= p_param1[3];
m_unk0x168 /= 8.0f;
m_unk0x190 = 0;
TickleManager()->RegisterClient(this, 20);
m_unk0x164 = 2;
CurrentWorld()->PlaceActor(this);
p_boundary->AddActor(this);
SetState(LegoPathActor::c_bit3);
m_roi->FUN_100a58f0(p_param1);
m_roi->VTable0x14();
m_roi->SetVisibility(TRUE);
}
// FUNCTION: LEGO1 0x1007a750
MxResult Act2Brick::VTable0x94(LegoPathActor* p_actor, MxBool)
{
@ -75,7 +149,9 @@ MxResult Act2Brick::Tickle()
// FUNCTION: BETA10 0x10012ec4
MxLong Act2Brick::Notify(MxParam& p_param)
{
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick && m_roi->GetVisibility()) {
MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationClick && m_roi->GetVisibility()) {
m_roi->SetVisibility(FALSE);
if (m_whistleSound != NULL) {
@ -87,6 +163,7 @@ MxLong Act2Brick::Notify(MxParam& p_param)
return 1;
}
assert(0);
return 0;
}
@ -108,3 +185,11 @@ void Act2Brick::StopWhistleSound()
m_whistleSound = NULL;
}
}
// FUNCTION: LEGO1 0x1007aa00
void Act2Brick::Mute(MxBool p_muted)
{
if (m_whistleSound != NULL) {
m_whistleSound->MuteSilence(p_muted);
}
}

View file

@ -9,9 +9,12 @@
DECOMP_SIZE_ASSERT(Act2PoliceStation, 0x68)
// FUNCTION: LEGO1 0x1004e0e0
// FUNCTION: BETA10 0x100137c0
MxLong Act2PoliceStation::Notify(MxParam& p_param)
{
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationClick) {
MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationClick) {
MxNotificationParam param(c_notificationType23, NULL);
NotificationManager()->Send(CurrentWorld(), param);
return 1;

View file

@ -144,6 +144,6 @@ void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
void LegoActor::Mute(MxBool p_muted)
{
if (m_sound != NULL) {
m_sound->Mute(p_muted);
m_sound->MuteStop(p_muted);
}
}

View file

@ -38,30 +38,11 @@ MxResult LegoCameraController::Create()
}
// FUNCTION: LEGO1 0x10012020
// FUNCTION: BETA10 0x10067852
MxLong LegoCameraController::Notify(MxParam& p_param)
{
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationDragEnd: {
if ((((LegoEventNotificationParam&) p_param).GetModifier()) & LegoEventNotificationParam::c_lButtonState) {
OnLButtonDown(MxPoint32(
((LegoEventNotificationParam&) p_param).GetX(),
((LegoEventNotificationParam&) p_param).GetY()
));
}
else if ((((LegoEventNotificationParam&) p_param).GetModifier()) & LegoEventNotificationParam::c_rButtonState) {
OnRButtonDown(MxPoint32(
((LegoEventNotificationParam&) p_param).GetX(),
((LegoEventNotificationParam&) p_param).GetY()
));
}
} break;
case c_notificationDragStart: {
OnMouseMove(
((LegoEventNotificationParam&) p_param).GetModifier(),
MxPoint32(((LegoEventNotificationParam&) p_param).GetX(), ((LegoEventNotificationParam&) p_param).GetY())
);
} break;
case c_notificationDrag: {
if (((((LegoEventNotificationParam&) p_param).GetModifier()) & LegoEventNotificationParam::c_lButtonState) ==
0) {
OnLButtonUp(MxPoint32(
@ -76,6 +57,26 @@ MxLong LegoCameraController::Notify(MxParam& p_param)
));
}
} break;
case c_notificationDragStart: {
if ((((LegoEventNotificationParam&) p_param).GetModifier()) & LegoEventNotificationParam::c_lButtonState) {
OnLButtonDown(MxPoint32(
((LegoEventNotificationParam&) p_param).GetX(),
((LegoEventNotificationParam&) p_param).GetY()
));
}
else if ((((LegoEventNotificationParam&) p_param).GetModifier()) & LegoEventNotificationParam::c_rButtonState) {
OnRButtonDown(MxPoint32(
((LegoEventNotificationParam&) p_param).GetX(),
((LegoEventNotificationParam&) p_param).GetY()
));
}
} break;
case c_notificationDrag: {
OnMouseMove(
((LegoEventNotificationParam&) p_param).GetModifier(),
MxPoint32(((LegoEventNotificationParam&) p_param).GetX(), ((LegoEventNotificationParam&) p_param).GetY())
);
} break;
}
return SUCCESS;

View file

@ -96,7 +96,7 @@ MxS32 LegoJetskiRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_
Mx3DPointFloat worldDirection(m_roi->GetWorldDirection());
if (!m_userNavFlag) {
((Vector2*) &worldDirection)->Mul(-1.0f);
worldDirection *= -1.0f;
}
if (VTable0x80(m_roi->GetWorldPosition(), worldDirection, a, c)) {

View file

@ -316,7 +316,7 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
if (p_param.GetKey() == VK_SHIFT) {
if (m_unk0x195) {
m_unk0x80 = FALSE;
p_param.SetNotification(c_notificationDrag);
p_param.SetNotification(c_notificationDragEnd);
if (m_camera) {
m_camera->Notify(p_param);
@ -426,16 +426,24 @@ MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
}
// FUNCTION: LEGO1 0x1005cdf0
// FUNCTION: BETA10 0x10089cc1
MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
{
MxBool result = FALSE;
switch (p_param.GetNotification()) {
case c_notificationButtonDown:
m_x = p_param.GetX();
m_y = p_param.GetY();
m_unk0x80 = FALSE;
m_unk0x81 = TRUE;
StartAutoDragTimer();
break;
case c_notificationButtonUp:
StopAutoDragTimer();
if (m_unk0x80) {
p_param.SetNotification(c_notificationDrag);
p_param.SetNotification(c_notificationDragEnd);
result = TRUE;
}
else if (m_unk0x81) {
@ -448,13 +456,6 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
m_unk0x80 = FALSE;
m_unk0x81 = FALSE;
break;
case c_notificationButtonDown:
m_x = p_param.GetX();
m_y = p_param.GetY();
m_unk0x80 = FALSE;
m_unk0x81 = TRUE;
StartAutoDragTimer();
break;
case c_notificationMouseMove:
if (m_unk0x195) {
p_param.SetModifier(LegoEventNotificationParam::c_lButtonState);
@ -469,18 +470,19 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
MxS32 diffX = p_param.GetX() - m_x;
MxS32 diffY = p_param.GetY() - m_y;
MxS32 t = diffX * diffX + diffY * diffY;
if (m_unk0x195 || (diffX * diffX) + (diffY * diffY) > m_unk0x74) {
if (m_unk0x195 || t > m_unk0x74) {
StopAutoDragTimer();
m_unk0x80 = TRUE;
p_param.SetNotification(c_notificationDragEnd);
p_param.SetNotification(c_notificationDragStart);
result = TRUE;
p_param.SetX(m_x);
p_param.SetY(m_y);
}
}
else {
p_param.SetNotification(c_notificationDragStart);
p_param.SetNotification(c_notificationDrag);
result = TRUE;
}
}
@ -494,7 +496,7 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
p_param.SetX(m_x);
p_param.SetY(m_y);
p_param.SetModifier(LegoEventNotificationParam::c_lButtonState);
p_param.SetNotification(c_notificationDragEnd);
p_param.SetNotification(c_notificationDragStart);
result = TRUE;
}
else {
@ -508,12 +510,14 @@ MxBool LegoInputManager::FUN_1005cdf0(LegoEventNotificationParam& p_param)
}
// FUNCTION: LEGO1 0x1005cfb0
// FUNCTION: BETA10 0x10089fc5
void LegoInputManager::StartAutoDragTimer()
{
m_autoDragTimerID = ::SetTimer(LegoOmni::GetInstance()->GetWindowHandle(), 1, m_autoDragTime, NULL);
}
// FUNCTION: LEGO1 0x1005cfd0
// FUNCTION: BETA10 0x1008a005
void LegoInputManager::StopAutoDragTimer()
{
if (m_autoDragTimerID) {

View file

@ -12,6 +12,7 @@ DECOMP_SIZE_ASSERT(LegoAnimActor, 0x174)
DECOMP_SIZE_ASSERT(LegoAnimActorStruct, 0x20)
// FUNCTION: LEGO1 0x1001bf80
// FUNCTION: BETA10 0x1003dc10
LegoAnimActorStruct::LegoAnimActorStruct(float p_unk0x00, LegoAnim* p_AnimTreePtr, LegoROI** p_roiMap, MxU32 p_numROIs)
{
m_unk0x00 = p_unk0x00;
@ -48,6 +49,7 @@ LegoAnimActor::~LegoAnimActor()
}
// FUNCTION: LEGO1 0x1001c1f0
// FUNCTION: BETA10 0x1003f240
MxResult LegoAnimActor::FUN_1001c1f0(float& p_und)
{
float duration = (float) m_animMaps[m_curAnim]->m_AnimTreePtr->GetDuration();
@ -144,9 +146,13 @@ MxResult LegoAnimActor::FUN_1001c360(float p_und, Matrix4& p_transform)
}
// FUNCTION: LEGO1 0x1001c450
MxResult LegoAnimActor::FUN_1001c450(LegoAnim* p_animTreePtr, float p_unk0x00, LegoROI** p_roiMap, MxU32 p_numROIs)
// FUNCTION: BETA10 0x1003e590
MxResult LegoAnimActor::FUN_1001c450(LegoAnim* p_AnimTreePtr, float p_unk0x00, LegoROI** p_roiMap, MxU32 p_numROIs)
{
LegoAnimActorStruct* laas = new LegoAnimActorStruct(p_unk0x00, p_animTreePtr, p_roiMap, p_numROIs);
// the capitalization of `p_AnimTreePtr` was taken from BETA10
assert(p_AnimTreePtr && p_roiMap);
LegoAnimActorStruct* laas = new LegoAnimActorStruct(p_unk0x00, p_AnimTreePtr, p_roiMap, p_numROIs);
for (vector<LegoAnimActorStruct*>::iterator it = m_animMaps.begin(); it != m_animMaps.end(); it++) {
if (p_unk0x00 < (*it)->m_unk0x00) {
@ -162,6 +168,7 @@ MxResult LegoAnimActor::FUN_1001c450(LegoAnim* p_animTreePtr, float p_unk0x00, L
}
// FUNCTION: LEGO1 0x1001c800
// FUNCTION: BETA10 0x1003e747
void LegoAnimActor::ClearMaps()
{
for (MxU32 i = 0; i < m_animMaps.size(); i++) {

View file

@ -97,7 +97,7 @@ MxU32 LegoExtraActor::VTable0x90(float p_time, Matrix4& p_transform)
else {
m_state = 0;
m_scheduledTime = 0.0f;
((Vector3&) positionRef).Sub(g_unk0x10104c18); // TODO: Fix call
positionRef -= g_unk0x10104c18;
m_roi->FUN_100a58f0(p_transform);
return TRUE;
}
@ -136,8 +136,7 @@ MxResult LegoExtraActor::FUN_1002aae0()
Vector3 dirRef(m_unk0xec[2]);
Vector3 positionRef(m_unk0xec[3]);
// TODO: Fix call
((Vector3&) dirRef).Mul(-1.0f);
dirRef *= -1.0f;
rightRef.EqualsCross(&upRef, &dirRef);
if (m_boundary == m_destEdge->m_faceA) {
@ -216,9 +215,8 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
Vector3 positionRef(matrix2[3]);
Mx3DPointFloat dir(matrix[2]);
// TODO: Fix calls
((Mx3DPointFloat&) dir).Mul(2.0f);
((Vector3&) positionRef).Add(dir);
dir *= 2.0f;
positionRef += dir;
for (MxS32 i = 0; i < m_boundary->GetNumEdges(); i++) {
Mx4DPointFloat* normal = m_boundary->GetEdgeNormal(i);
@ -251,7 +249,7 @@ MxResult LegoExtraActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
Mx3DPointFloat dir = p_actor->GetWorldDirection();
MxMatrix matrix3 = MxMatrix(roi->GetLocal2World());
Vector3 positionRef(matrix3[3]);
((Vector3&) positionRef).Add(g_unk0x10104c18);
positionRef += g_unk0x10104c18;
roi->FUN_100a58f0(matrix3);
#ifdef COMPAT_MODE
@ -463,7 +461,7 @@ MxU32 LegoExtraActor::VTable0x6c(
Vector3 local60(local2world[3]);
Mx3DPointFloat local54(p_v1);
((Vector3&) local54).Sub(local60);
local54 -= local60;
float local1c = p_v2.Dot(&p_v2, &p_v2);
float local24 = p_v2.Dot(&p_v2, &local54) * 2.0f;
float local20 = local54.Dot(&local54, &local54);

View file

@ -38,6 +38,7 @@ const char* g_strHIT_WALL_SOUND = "HIT_WALL_SOUND";
MxLong g_unk0x100f3308 = 0;
// FUNCTION: LEGO1 0x1002d700
// FUNCTION: BETA10 0x100ae6e0
LegoPathActor::LegoPathActor()
{
m_boundary = NULL;
@ -57,6 +58,7 @@ LegoPathActor::LegoPathActor()
}
// FUNCTION: LEGO1 0x1002d820
// FUNCTION: BETA10 0x100ae80e
LegoPathActor::~LegoPathActor()
{
if (m_grec) {
@ -70,7 +72,7 @@ MxResult LegoPathActor::VTable0x80(const Vector3& p_point1, Vector3& p_point2, V
Mx3DPointFloat p1, p2, p3;
p1 = p_point3;
((Vector3&) p1).Sub(p_point1);
p1 -= p_point1;
m_BADuration = p1.LenSquared();
if (m_BADuration > 0.0f) {
@ -104,14 +106,14 @@ MxResult LegoPathActor::VTable0x88(
Mx3DPointFloat p1, p2, p3, p4, p5;
p1 = *v2;
((Vector3&) p1).Sub(*v1);
((Vector3&) p1).Mul(p_srcScale);
((Vector3&) p1).Add(*v1);
p1 -= *v1;
p1 *= p_srcScale;
p1 += *v1;
p2 = *v4;
((Vector3&) p2).Sub(*v3);
((Vector3&) p2).Mul(p_destScale);
((Vector3&) p2).Add(*v3);
p2 -= *v3;
p2 *= p_destScale;
p2 += *v3;
m_boundary = p_boundary;
m_destEdge = &p_destEdge;
@ -122,7 +124,7 @@ MxResult LegoPathActor::VTable0x88(
p_destEdge.FUN_1002ddc0(*p_boundary, p3);
p4 = p2;
((Vector3&) p4).Sub(p1);
p4 -= p1;
p4.Unitize();
MxMatrix matrix;
@ -137,7 +139,7 @@ MxResult LegoPathActor::VTable0x88(
up = *m_boundary->GetUnknown0x14();
if (!m_cameraFlag || !m_userNavFlag) {
((Vector3&) dir).Mul(-1.0f);
dir *= -1.0f;
}
right.EqualsCross(&up, &dir);
@ -179,9 +181,9 @@ MxResult LegoPathActor::VTable0x84(
Mx3DPointFloat p2, p3, p5;
p2 = *v4;
((Vector3&) p2).Sub(*v3);
((Vector3&) p2).Mul(p_destScale);
((Vector3&) p2).Add(*v3);
p2 -= *v3;
p2 *= p_destScale;
p2 += *v3;
m_boundary = p_boundary;
m_destEdge = &p_destEdge;
@ -203,7 +205,7 @@ MxResult LegoPathActor::VTable0x84(
up = *m_boundary->GetUnknown0x14();
if (!m_cameraFlag || !m_userNavFlag) {
((Vector3&) dir).Mul(-1.0f);
dir *= -1.0f;
}
right.EqualsCross(&up, &dir);
@ -287,12 +289,12 @@ MxS32 LegoPathActor::VTable0x8c(float p_time, Matrix4& p_transform)
m_worldSpeed *= m_unk0x144;
nav->SetLinearVel(m_worldSpeed);
Mx3DPointFloat p7(p2);
((Vector3&) p7).Sub(p6);
p7 -= p6;
if (p7.Unitize() == 0) {
float f = sqrt(p1.LenSquared()) * m_unk0x140;
((Vector3&) p7).Mul(f);
((Vector3&) p1).Add(p7);
p7 *= f;
p1 += p7;
}
}
}
@ -477,7 +479,7 @@ MxU32 LegoPathActor::VTable0x6c(
MxS32 LegoPathActor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3)
{
Mx3DPointFloat v2(p_v2);
((Vector3&) v2).Sub(p_v1);
v2 -= p_v1;
float len = v2.LenSquared();
@ -486,7 +488,7 @@ MxS32 LegoPathActor::VTable0x68(Vector3& p_v1, Vector3& p_v2, Vector3& p_v3)
}
len = sqrt(len);
((Vector3&) v2).Div(len);
v2 /= len;
float radius = m_roi->GetWorldBoundingSphere().Radius();
list<LegoPathBoundary*> boundaries;
@ -653,16 +655,16 @@ MxResult LegoPathActor::VTable0x9c()
Mx3DPointFloat local84(m_unk0xec[2]);
Mx3DPointFloat local70(local34);
((Vector3&) local70).Sub(localc0);
local70 -= localc0;
float len = local70.LenSquared();
if (len >= 0.0f) {
len = sqrt(len);
((Vector3&) local84).Mul(len);
((Vector3&) local48).Mul(len);
local84 *= len;
local48 *= len;
}
if (!m_userNavFlag) {
((Vector3&) local84).Mul(-1.0f);
local84 *= -1.0f;
}
if (VTable0x80(localc0, local84, local34, local48) != SUCCESS) {

View file

@ -53,11 +53,11 @@ void LegoPathBoundary::FUN_100575b0(Vector3& p_point1, Vector3& p_point2, LegoPa
Mx3DPointFloat v;
v = p_point1;
((Vector3&) v).Sub(*ccwV);
v -= *ccwV;
float dot1 = v.Dot(&v, m_unk0x50);
v = p_point2;
((Vector3&) v).Sub(*ccwV);
v -= *ccwV;
float dot2 = v.Dot(&v, m_unk0x50);
if (dot2 > dot1) {
@ -92,7 +92,7 @@ void LegoPathBoundary::SwitchBoundary(
{
LegoUnknown100db7f4* e = p_edge;
if (p_edge->Unknown2(*p_boundary)) {
if (p_edge->BETA_100b53b0(*p_boundary)) {
LegoPathBoundary* newBoundary = (LegoPathBoundary*) p_edge->OtherFace(p_boundary);
if (newBoundary == NULL) {
@ -102,7 +102,7 @@ void LegoPathBoundary::SwitchBoundary(
MxS32 local10 = 0;
MxU8 userNavFlag;
if (e->Unknown(*newBoundary, 1)) {
if (e->BETA_1004a830(*newBoundary, 1)) {
userNavFlag = p_actor->GetUserNavFlag();
}
else {
@ -113,7 +113,7 @@ void LegoPathBoundary::SwitchBoundary(
p_edge = (LegoUnknown100db7f4*) p_edge->GetCounterclockwiseEdge(*newBoundary);
LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary);
if (p_edge->GetMask0x03() && (userNavFlag || p_edge->Unknown(*local20, 1))) {
if (p_edge->GetMask0x03() && (userNavFlag || p_edge->BETA_1004a830(*local20, 1))) {
local10++;
}
} while (p_edge != e);
@ -141,7 +141,7 @@ void LegoPathBoundary::SwitchBoundary(
LegoPathBoundary* local20 = (LegoPathBoundary*) p_edge->OtherFace(newBoundary);
if (p_edge->GetMask0x03() && (userNavFlag || p_edge->Unknown(*local20, 1))) {
if (p_edge->GetMask0x03() && (userNavFlag || p_edge->BETA_1004a830(*local20, 1))) {
local8--;
}
}
@ -201,7 +201,7 @@ MxU32 LegoPathBoundary::Intersect(
if (local10 == 0) {
local10 = 1;
vec = p_point2;
((Vector3&) vec).Sub(p_point1);
vec -= p_point1;
len = vec.LenSquared();
if (len <= 0.0f) {
@ -209,7 +209,7 @@ MxU32 LegoPathBoundary::Intersect(
}
len = sqrt(len);
((Vector3&) vec).Div(len);
vec /= len;
}
float dot = vec.Dot(&vec, &m_edgeNormals[i]);
@ -234,11 +234,11 @@ MxU32 LegoPathBoundary::Intersect(
Vector3* local5c = e->CWVertex(*this);
p_point3 = vec;
p_point3.Mul(localc);
p_point3.Add(p_point1);
p_point3 *= localc;
p_point3 += p_point1;
local50 = p_point2;
((Vector3&) local50).Sub(*local5c);
local50 -= *local5c;
e->FUN_1002ddc0(*this, local70);
@ -258,7 +258,7 @@ MxU32 LegoPathBoundary::Intersect(
Vector3* local90 = local88->CWVertex(*this);
Mx3DPointFloat locala4(p_point3);
((Vector3&) locala4).Sub(*local90);
locala4 -= *local90;
float local8c = locala4.Dot(&locala4, &local84);
@ -285,7 +285,7 @@ MxU32 LegoPathBoundary::Intersect(
Vector3* localc4 = locala8->CWVertex(*this);
Mx3DPointFloat locald8(p_point3);
((Vector3&) locald8).Sub(*localc4);
locald8 -= *localc4;
float localc0 = locald8.Dot(&locald8, &localbc);
@ -316,8 +316,8 @@ MxU32 LegoPathBoundary::Intersect(
}
else if (local58 > 0.0f && e->m_unk0x3c > local58) {
p_point3 = local70;
p_point3.Mul(local58);
p_point3.Add(*local5c);
p_point3 *= local58;
p_point3 += *local5c;
p_edge = e;
return 1;
}
@ -345,7 +345,7 @@ MxU32 LegoPathBoundary::FUN_10057fe0(LegoAnimPresenter* p_presenter)
Mx3DPointFloat unk0x30;
unk0x30 = m_unk0x30;
((Vector3&) unk0x30).Sub(p_presenter->m_unk0xa8);
unk0x30 -= p_presenter->m_unk0xa8;
float len = unk0x30.LenSquared();
float local20 = p_presenter->m_unk0xa4 + m_unk0x44;

View file

@ -95,8 +95,7 @@ MxResult LegoPathController::Create(MxU8* p_data, const Vector3& p_location, con
}
for (i = 0; i < m_numN; i++) {
// TODO: Fix call
((Vector3&) m_unk0x10[i]).Add(p_location);
m_unk0x10[i] += p_location;
}
for (i = 0; i < m_numL; i++) {
@ -733,6 +732,256 @@ MxResult LegoPathController::ReadVector(LegoStorage* p_storage, Mx4DPointFloat&
return SUCCESS;
}
// FUNCTION: LEGO1 0x10048310
// FUNCTION: BETA10 0x100b8911
MxResult LegoPathController::FUN_10048310(
LegoPathEdgeContainer* p_grec,
const Vector3& p_oldPosition,
const Vector3& p_oldDirection,
LegoPathBoundary* p_oldBoundary,
const Vector3& p_newPosition,
const Vector3& p_newDirection,
LegoPathBoundary* p_newBoundary,
LegoU8 p_mask,
MxFloat* p_param9
)
{
p_grec->m_position = p_newPosition;
p_grec->m_direction = p_newDirection;
p_grec->m_boundary = p_newBoundary;
if (p_newBoundary == p_oldBoundary) {
p_grec->SetBit1(TRUE);
return SUCCESS;
}
list<LegoBEWithFloat> boundaryList;
list<LegoBEWithFloat>::iterator boundaryListIt;
LegoBEWithFloatSet boundarySet;
LegoBEWithFloatSet::iterator boundarySetItA;
LegoBEWithFloatSet::iterator boundarySetItB;
LegoPathCtrlEdgeSet pathCtrlEdgeSet(m_pfsE);
MxFloat local14 = 999999.0f;
p_grec->SetBit1(FALSE);
for (MxS32 i = 0; i < p_oldBoundary->GetNumEdges(); i++) {
LegoPathCtrlEdge* edge = (LegoPathCtrlEdge*) p_oldBoundary->GetEdges()[i];
if (edge->GetMask0x03()) {
LegoPathBoundary* otherFace = (LegoPathBoundary*) edge->OtherFace(p_oldBoundary);
if (otherFace != NULL && edge->BETA_1004a830(*otherFace, p_mask)) {
if (p_newBoundary == otherFace) {
float dist;
if ((dist = edge->DistanceToMidpoint(p_oldPosition) + edge->DistanceToMidpoint(p_newPosition)) <
local14) {
local14 = dist;
p_grec->erase(p_grec->begin(), p_grec->end());
p_grec->SetBit1(TRUE);
p_grec->push_back(LegoBoundaryEdge(edge, p_oldBoundary));
}
}
else {
boundaryList.push_back(LegoBEWithFloat(edge, p_oldBoundary, edge->DistanceToMidpoint(p_oldPosition))
);
boundarySet.insert(&boundaryList.back());
}
}
}
pathCtrlEdgeSet.erase(edge);
}
if (!p_grec->GetBit1()) {
while (pathCtrlEdgeSet.size() > 0) {
LegoBEWithFloat edgeWithFloat;
MxFloat local70 = 999999.0f;
boundarySetItA = boundarySetItB = boundarySet.begin();
if (boundarySetItB != boundarySet.end()) {
boundarySetItB++;
}
while (boundarySetItA != boundarySet.end()) {
MxU32 shouldRemove = TRUE;
LegoUnknown100db7f4* e = (*boundarySetItA)->m_edge;
LegoPathBoundary* b = (*boundarySetItA)->m_boundary;
assert(e && b);
LegoPathBoundary* bOther = (LegoPathBoundary*) e->OtherFace(b);
assert(bOther);
if (!e->BETA_1004a830(*bOther, p_mask)) {
// This branch is empty, but present in the BETA - probably had comments only
}
else {
if (bOther == p_newBoundary) {
shouldRemove = FALSE;
LegoBEWithFloat* pfs = *boundarySetItA;
assert(pfs);
float dist;
if ((dist = pfs->m_edge->DistanceToMidpoint(p_newPosition) + pfs->m_unk0x0c) < local70) {
edgeWithFloat.m_edge = NULL;
local70 = dist;
// TODO: Match
if (dist < local14) {
local14 = dist;
p_grec->erase(p_grec->begin(), p_grec->end());
p_grec->SetBit1(TRUE);
do {
p_grec->push_front(LegoBoundaryEdge(pfs->m_edge, pfs->m_boundary));
pfs = pfs->m_next;
} while (pfs != NULL);
}
}
}
else {
for (MxS32 i = 0; i < bOther->GetNumEdges(); i++) {
LegoPathCtrlEdge* edge = (LegoPathCtrlEdge*) bOther->GetEdges()[i];
if (edge->GetMask0x03()) {
if (pathCtrlEdgeSet.find(edge) != pathCtrlEdgeSet.end()) {
shouldRemove = FALSE;
float dist;
if ((dist = edge->DistanceBetweenMidpoints(*e) + (*boundarySetItA)->m_unk0x0c) <
local70) {
local70 = dist;
edgeWithFloat = LegoBEWithFloat(edge, bOther, *boundarySetItA, dist);
}
}
}
}
}
}
if (shouldRemove) {
boundarySet.erase(boundarySetItA);
}
if (boundarySetItB != boundarySet.end()) {
boundarySetItA = boundarySetItB;
boundarySetItB++;
}
else {
break;
}
}
if (edgeWithFloat.m_edge != NULL) {
pathCtrlEdgeSet.erase(edgeWithFloat.m_edge);
boundaryList.push_back(edgeWithFloat);
boundarySet.insert(&boundaryList.back());
}
else {
break;
}
}
}
if (p_grec->GetBit1()) {
if (p_grec->size() > 0) {
LegoPathCtrlEdge* edge = p_grec->front().m_edge;
if (edge->FUN_10048c40(p_oldPosition)) {
p_grec->pop_front();
}
}
if (p_grec->size() > 0) {
LegoPathCtrlEdge* edge = p_grec->back().m_edge;
if (edge->FUN_10048c40(p_newPosition)) {
if (edge->OtherFace(p_grec->back().m_boundary) != NULL &&
edge->OtherFace(p_grec->back().m_boundary)->IsEqual(p_newBoundary)) {
p_grec->m_boundary = p_grec->back().m_boundary;
p_grec->pop_back();
}
}
}
if (p_param9 != NULL) {
*p_param9 = local14;
}
return SUCCESS;
}
return FAILURE;
}
// FUNCTION: LEGO1 0x10048c40
// FUNCTION: BETA10 0x1001cc90
inline MxU32 LegoPathCtrlEdge::FUN_10048c40(const Vector3& p_position)
{
MxFloat localc, local10;
MxU32 result = FALSE;
if (m_unk0x28[0] > 0.001 || m_unk0x28[0] < -0.001) {
localc = (p_position[0] - (*m_pointA)[0]) / m_unk0x28[0];
if (localc < 0 || localc > 1) {
return FALSE;
}
result = TRUE;
}
else {
if (p_position[0] > (*m_pointA)[0] + 0.001 || p_position[0] < (*m_pointA)[0] - 0.001) {
return FALSE;
}
}
if (m_unk0x28[1] > 0.001 || m_unk0x28[1] < -0.001) {
local10 = (p_position[1] - (*m_pointA)[1]) / m_unk0x28[1];
if (result) {
if (localc > local10 + 0.001 || localc < local10 - 0.001) {
return FALSE;
}
}
else {
result = TRUE;
localc = local10;
}
}
else {
if (p_position[1] > (*m_pointA)[1] + 0.001 || p_position[1] < (*m_pointA)[1] - 0.001) {
return FALSE;
}
}
if (m_unk0x28[2] > 0.001 || m_unk0x28[2] < -0.001) {
local10 = (p_position[2] - (*m_pointA)[2]) / m_unk0x28[2];
if (result) {
if (localc > local10 + 0.001 || localc < local10 - 0.001) {
return FALSE;
}
}
else {
return TRUE;
}
}
else {
if (p_position[2] > (*m_pointA)[2] + 0.001 || p_position[2] < (*m_pointA)[2] - 0.001) {
return FALSE;
}
}
return TRUE;
}
// FUNCTION: LEGO1 0x1004a240
// FUNCTION: BETA10 0x100b9160
MxS32 LegoPathController::FUN_1004a240(
@ -745,8 +994,8 @@ MxS32 LegoPathController::FUN_1004a240(
)
{
if (p_grec.size() == 0) {
p_v1 = p_grec.m_unk0x0c;
p_v2 = p_grec.m_unk0x20;
p_v1 = p_grec.m_position;
p_v2 = p_grec.m_direction;
p_boundary = p_grec.m_boundary;
p_grec.SetBit1(FALSE);
return 1;
@ -758,9 +1007,9 @@ MxS32 LegoPathController::FUN_1004a240(
Mx3DPointFloat vec;
p_v1 = *p_edge->CCWVertex(*p_boundary);
p_v1.Sub(*p_edge->CWVertex(*p_boundary));
p_v1.Mul(p_f1);
p_v1.Add(*p_edge->CWVertex(*p_boundary));
p_v1 -= *p_edge->CWVertex(*p_boundary);
p_v1 *= p_f1;
p_v1 += *p_edge->CWVertex(*p_boundary);
p_edge->FUN_1002ddc0(*p_boundary, vec);
p_v2.EqualsCross(p_boundary->GetUnknown0x14(), &vec);
return 0;

View file

@ -89,10 +89,11 @@ LegoRace::~LegoRace()
MxLong LegoRace::Notify(MxParam& p_param)
{
LegoWorld::Notify(p_param);
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxLong result = 0;
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationType0:
HandleType0Notification((MxNotificationParam&) p_param);
break;

View file

@ -84,7 +84,7 @@ MxU32 LegoRaceActor::VTable0x90(float p_float, Matrix4& p_transform)
m_state = 0;
m_unk0x08 = 0;
((Vector3&) positionRef).Sub(g_unk0x10102b08);
positionRef -= g_unk0x10102b08;
m_roi->FUN_100a58f0(p_transform);
return 1;
}
@ -108,7 +108,7 @@ MxResult LegoRaceActor::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
MxMatrix matr;
matr = roi->GetLocal2World();
Vector3(matr[3]).Add(g_unk0x10102b08);
Vector3(matr[3]) += g_unk0x10102b08;
roi->FUN_100a58f0(matr);

View file

@ -124,7 +124,9 @@ MxLong LegoRaceMap::Notify(MxParam& p_param)
return 1;
}
if (((MxNotificationParam&) p_param).GetNotification() == c_notificationControl &&
MxNotificationParam& param = (MxNotificationParam&) p_param;
if (param.GetNotification() == c_notificationControl &&
m_Map_Ctl->GetAction()->GetObjectId() ==
((LegoControlManagerNotificationParam&) p_param).GetClickedObjectId()) {

View file

@ -442,7 +442,7 @@ MxResult LegoRaceCar::VTable0x94(LegoPathActor* p_actor, MxBool p_bool)
MxMatrix matr;
matr = roi->GetLocal2World();
Vector3(matr[3]).Add(g_unk0x10102af0);
Vector3(matr[3]) += g_unk0x10102af0;
roi->FUN_100a58f0(matr);
p_actor->SetState(2);

View file

@ -172,11 +172,11 @@ MxS32 LegoCarRaceActor::VTable0x1c(LegoPathBoundary* p_boundary, LegoEdge* p_edg
Mx3DPointFloat worldDirection(Vector3(m_roi->GetWorldDirection()));
if (!m_userNavFlag) {
((Vector3*) &worldDirection)->Mul(-1.0f);
worldDirection *= -1.0f;
}
((Vector3*) &worldDirection)->Mul(5.0f);
((Vector3*) &crossProduct)->Mul(5.0f);
worldDirection *= 5.0f;
crossProduct *= 5.0f;
MxResult callResult =
VTable0x80(Vector3(m_roi->GetWorldPosition()), worldDirection, pointUnknown, crossProduct);
@ -266,8 +266,8 @@ MxResult LegoCarRaceActor::VTable0x9c()
point4.Unitize();
point5.Unitize();
((Vector3*) &point4)->Mul(5.0f);
((Vector3*) &point5)->Mul(5.0f);
point4 *= 5.0f;
point5 *= 5.0f;
MxResult res = VTable0x80(m_roi->GetWorldPosition(), point4, point1, point5);

View file

@ -649,14 +649,14 @@ void LegoAnimPresenter::PutFrame()
up = und;
((Vector3&) up).Sub(m_currentWorld->GetCamera()->GetWorldLocation());
((Vector3&) dir).Div(dirsqr);
up -= m_currentWorld->GetCamera()->GetWorldLocation();
dir /= dirsqr;
pos.EqualsCross(&dir, &up);
pos.Unitize();
up.EqualsCross(&pos, &dir);
((Vector3&) pos).Mul(possqr);
((Vector3&) dir).Mul(dirsqr);
((Vector3&) up).Mul(upsqr);
pos *= possqr;
dir *= dirsqr;
up *= upsqr;
m_unk0x8c[i]->FUN_100a58f0(mat);
m_unk0x8c[i]->VTable0x14();
@ -1114,10 +1114,10 @@ void LegoAnimPresenter::FUN_1006c7a0()
void LegoAnimPresenter::VTable0x8c()
{
if (m_unk0x78) {
m_unk0xa8.Add((*m_unk0x78)[3]);
m_unk0xa8 += (*m_unk0x78)[3];
}
else {
m_unk0xa8.Add(m_action->GetLocation());
m_unk0xa8 += m_action->GetLocation();
}
if (m_currentWorld == NULL) {
@ -1173,11 +1173,11 @@ MxU32 LegoAnimPresenter::VTable0x94(Vector3& p_v1, Vector3& p_v2, float p_f1, fl
Mx3DPointFloat a, b;
b = p_v2;
((Vector3&) b).Mul(p_f1);
((Vector3&) b).Add(p_v1);
b *= p_f1;
b += p_v1;
a = b;
((Vector3&) a).Sub(m_unk0xa8);
a -= m_unk0xa8;
float len = a.LenSquared();
if (len <= 0.0f) {

View file

@ -66,14 +66,14 @@ void LegoLoopingAnimPresenter::PutFrame()
up = und;
((Vector3&) up).Sub(m_currentWorld->GetCamera()->GetWorldLocation());
((Vector3&) dir).Div(dirsqr);
up -= m_currentWorld->GetCamera()->GetWorldLocation();
dir /= dirsqr;
pos.EqualsCross(&dir, &up);
pos.Unitize();
up.EqualsCross(&pos, &dir);
((Vector3&) pos).Mul(possqr);
((Vector3&) dir).Mul(dirsqr);
((Vector3&) up).Mul(upsqr);
pos *= possqr;
dir *= dirsqr;
up *= upsqr;
m_unk0x8c[i]->FUN_100a58f0(mat);
m_unk0x8c[i]->VTable0x14();

View file

@ -52,13 +52,15 @@ MxResult ElevatorBottom::Create(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x10018150
// FUNCTION: BETA10 0x10027d60
MxLong ElevatorBottom::Notify(MxParam& p_param)
{
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxLong ret = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationControl:
ret = HandleControl((LegoControlManagerNotificationParam&) p_param);
break;

View file

@ -100,13 +100,15 @@ MxResult GasStation::Create(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x10004a60
// FUNCTION: BETA10 0x10028883
MxLong GasStation::Notify(MxParam& p_param)
{
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxResult result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;

View file

@ -68,12 +68,14 @@ MxResult HistoryBook::Create(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x10082680
// FUNCTION: BETA10 0x1002b907
MxLong HistoryBook::Notify(MxParam& p_param)
{
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationButtonUp:
m_destLocation = LegoGameState::Area::e_infoscor;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);

View file

@ -106,13 +106,15 @@ MxResult Hospital::Create(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x10074990
// FUNCTION: BETA10 0x1002ca3b
MxLong Hospital::Notify(MxParam& p_param)
{
MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;

View file

@ -225,13 +225,15 @@ MxResult Infocenter::Create(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x1006ef10
// FUNCTION: BETA10 0x1002eaca
MxLong Infocenter::Notify(MxParam& p_param)
{
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxLong result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationType0:
result = HandleNotification0((MxNotificationParam&) p_param);
break;

View file

@ -55,13 +55,15 @@ MxResult InfocenterDoor::Create(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x100379e0
// FUNCTION: BETA10 0x10032227
MxLong InfocenterDoor::Notify(MxParam& p_param)
{
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxLong result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationEndAction:
if (((MxEndActionNotificationParam&) p_param).GetAction()->GetAtomId() == m_atomId) {
BackgroundAudioManager()->RaiseVolume();

View file

@ -129,13 +129,15 @@ MxResult Isle::Create(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x10030c10
// FUNCTION: BETA10 0x10032b63
MxLong Isle::Notify(MxParam& p_param)
{
MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;
@ -468,6 +470,7 @@ void Isle::UpdateGlobe()
}
// FUNCTION: LEGO1 0x100315f0
// FUNCTION: BETA10 0x10033e46
MxLong Isle::HandlePathStruct(LegoPathStructNotificationParam& p_param)
{
MxLong result = 0;
@ -718,13 +721,13 @@ void Isle::Enable(MxBool p_enable)
Mx3DPointFloat position(UserActor()->GetROI()->GetWorldPosition());
Mx3DPointFloat sub(-21.375f, 0.0f, -41.75f);
((Vector3&) sub).Sub(position);
sub -= position;
if (sub.LenSquared() < 1024.0f) {
AnimationManager()->FUN_10064740(NULL);
}
Mx3DPointFloat sub2(98.874992f, 0.0f, -46.156292f);
((Vector3&) sub2).Sub(position);
sub2 -= position;
if (sub2.LenSquared() < 1024.0f) {
AnimationManager()->FUN_10064670(NULL);
}

View file

@ -68,13 +68,15 @@ MxResult JukeBox::Create(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x1005d980
// FUNCTION: BETA10 0x10037daf
MxLong JukeBox::Notify(MxParam& p_param)
{
MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationControl:
result = HandleControl((LegoControlManagerNotificationParam&) p_param);
break;

View file

@ -1,5 +1,6 @@
#include "legoact2.h"
#include "3dmanager/lego3dmanager.h"
#include "act2actor.h"
#include "act2main_actions.h"
#include "infomain_actions.h"
@ -9,10 +10,12 @@
#include "legocachesoundmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legolocomotionanimpresenter.h"
#include "legomain.h"
#include "legopathstruct.h"
#include "legosoundmanager.h"
#include "legoutils.h"
#include "legovideomanager.h"
#include "misc.h"
#include "mxactionnotificationparam.h"
#include "mxbackgroundaudiomanager.h"
@ -20,6 +23,8 @@
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxticklemanager.h"
#include "mxtransitionmanager.h"
#include "mxvariabletable.h"
#include "scripts.h"
#include <vec.h>
@ -28,7 +33,7 @@ DECOMP_SIZE_ASSERT(LegoAct2, 0x1154)
DECOMP_SIZE_ASSERT(LegoAct2State, 0x10)
// GLOBAL: LEGO1 0x100f4474
undefined4 g_unk0x100f4474 = 0;
Act2mainScript::Script g_unk0x100f4474 = (Act2mainScript::Script) 0;
// GLOBAL: LEGO1 0x100f43f0
// GLOBAL: BETA10 0x101e14a8
@ -46,6 +51,25 @@ MxS32 g_unk0x100f43f0[] = {
// GLOBAL: LEGO1 0x100f4410
LegoChar* g_unk0x100f4410[] = {"bd", "pg", "rd", "sy", "ro", "cl"};
// GLOBAL: LEGO1 0x100f4428
MxS32 g_unk0x100f4428[] = {
Act2mainScript::c_snsx07pa_RunAnim,
Act2mainScript::c_snsx12ni_RunAnim,
Act2mainScript::c_snsx15la_RunAnim,
Act2mainScript::c_snsx47cl_RunAnim,
Act2mainScript::c_snsx65pg_RunAnim,
Act2mainScript::c_snsx68pg_RunAnim,
Act2mainScript::c_snsx69rd_RunAnim,
Act2mainScript::c_snsx72sy_RunAnim,
0,
0,
0,
0
};
// GLOBAL: LEGO1 0x100f4458
LegoChar* g_unk0x100f4458[] = {"papa", "nick", "laura", "cl", "pg", "rd", "sy"};
// FUNCTION: LEGO1 0x1004fce0
// FUNCTION: BETA10 0x1003a5a0
LegoAct2::LegoAct2()
@ -54,13 +78,13 @@ LegoAct2::LegoAct2()
m_gameState = NULL;
m_pepper = NULL;
m_ambulance = NULL;
m_unk0x10c2 = 0;
m_ready = FALSE;
m_unk0x1130 = 0;
m_unk0x10c0 = 0;
m_nextBrick = 0;
m_unk0x10c1 = 0;
m_unk0x1138 = NULL;
m_unk0x1140 = 0;
m_unk0x1144 = Act2mainScript::c__Act2Main;
m_unk0x1140 = (Act2mainScript::Script) 0;
m_unk0x1144 = (Act2mainScript::Script) 0;
m_destLocation = LegoGameState::e_undefined;
m_music = JukeboxScript::c_MusicTheme1;
m_siFile = "";
@ -78,7 +102,7 @@ MxBool LegoAct2::VTable0x5c()
// FUNCTION: BETA10 0x1003a6f0
LegoAct2::~LegoAct2()
{
if (m_unk0x10c2) {
if (m_ready) {
TickleManager()->UnregisterClient(this);
}
@ -175,7 +199,7 @@ MxResult LegoAct2::Tickle()
if (g_unk0x100f4474) {
if (AnimationManager()->FUN_10064ee0(g_unk0x100f4474)) {
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
g_unk0x100f4474 = 0;
g_unk0x100f4474 = (Act2mainScript::Script) 0;
}
}
@ -204,12 +228,12 @@ MxResult LegoAct2::Tickle()
distance = DISTSQRD3(pepperPosition, otherPoint);
if (m_unk0x1144 == Act2mainScript::c__Act2Main && distance > 50.0f && pepperPosition[0] > -57.0f) {
if (m_unk0x1144 == (Act2mainScript::Script) 0 && distance > 50.0f && pepperPosition[0] > -57.0f) {
FUN_10052560(Act2mainScript::c_Avo906In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_unk0x1144 = Act2mainScript::c_Avo906In_PlayWav;
}
}
else if (m_unk0x10d0 >= 90000 && m_unk0x10d0 % 90000 == 0 && m_unk0x1144 == Act2mainScript::c__Act2Main) {
else if (m_unk0x10d0 >= 90000 && m_unk0x10d0 % 90000 == 0 && m_unk0x1144 == (Act2mainScript::Script) 0) {
FUN_10052560(Act2mainScript::c_Avo908In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_unk0x1144 = Act2mainScript::c_Avo908In_PlayWav;
}
@ -222,7 +246,7 @@ MxResult LegoAct2::Tickle()
m_unk0x10d0 += 50;
if (m_unk0x10d0 >= 200) {
if (m_unk0x10c0 < 5) {
if (m_nextBrick < 5) {
m_unk0x10c4 = 7;
}
else {
@ -289,7 +313,7 @@ MxLong LegoAct2::Notify(MxParam& p_param)
Mx3DPointFloat unk0x10d8(m_pepper->GetWorldPosition());
Mx3DPointFloat locala4(unk0x10d8);
((Vector3&) entityPosition).Sub(unk0x10d8);
entityPosition -= unk0x10d8;
MxMatrix local2world(m_pepper->GetLocal2World());
Vector3 local30(local2world[0]);
@ -300,15 +324,15 @@ MxLong LegoAct2::Notify(MxParam& p_param)
local28.Unitize();
Mx3DPointFloat local90(local28);
((Vector3&) local90).Mul(1.25f);
((Vector3&) locala4).Add(local90);
local90 *= 1.25f;
locala4 += local90;
locala4[1] += 0.25;
local30.EqualsCross(&localac, &local28);
local30.Unitize();
Mx3DPointFloat direction(local2world[2]);
Mx3DPointFloat location(local2world[1]);
FUN_10052560(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &location, &direction, NULL);
FUN_10052560(Act2mainScript::c_tns051in_RunAnim, TRUE, TRUE, &local90, &direction, NULL);
m_unk0x10c4 = 14;
m_unk0x10d0 = 0;
@ -324,10 +348,123 @@ MxLong LegoAct2::Notify(MxParam& p_param)
return result;
}
// STUB: LEGO1 0x100506f0
// FUNCTION: LEGO1 0x100506f0
MxLong LegoAct2::HandleEndAction(MxEndActionNotificationParam& p_param)
{
// TODO
if (m_gameState->m_enabled && p_param.GetAction() != NULL) {
MxU32 objectId = p_param.GetAction()->GetObjectId();
if (m_unk0x10c4 == 5 && m_unk0x1144 == objectId) {
m_unk0x1144 = (Act2mainScript::Script) 0;
return 0;
}
if (m_unk0x1140 != objectId) {
return 0;
}
m_unk0x1140 = (Act2mainScript::Script) 0;
switch (m_unk0x10c4) {
case 2:
m_unk0x10c4 = 3;
break;
case 4:
FUN_10051960();
m_unk0x10c4 = 5;
m_unk0x10d0 = 0;
break;
case 6: {
LegoROI* roi;
roi = FindROI("nick");
if (roi != NULL) {
roi->SetVisibility(FALSE);
}
roi = FindROI("laura");
if (roi != NULL) {
roi->SetVisibility(FALSE);
}
roi = FindROI("motoni");
if (roi != NULL) {
roi->SetVisibility(FALSE);
}
roi = FindROI("motola");
if (roi != NULL) {
roi->SetVisibility(FALSE);
}
roi = FindROI("Block01");
RemoveActor((LegoPathActor*) roi->GetEntity());
roi->SetVisibility(FALSE);
roi = FindROI("Block02");
RemoveActor((LegoPathActor*) roi->GetEntity());
roi->SetVisibility(FALSE);
VariableTable()->SetVariable("ACTOR_01", "brickstr");
FUN_10052800();
m_unk0x10c4 = 7;
PlayMusic(JukeboxScript::c_BrickstrChase);
break;
}
case 11:
m_bricks[m_nextBrick - 1].Mute(TRUE);
m_unk0x10c4 = 12;
m_unk0x10d0 = 0;
FUN_10052560(Act2mainScript::c_tra045la_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_bit3);
AnimationManager()->EnableCamAnims(TRUE);
AnimationManager()->FUN_1005f6d0(TRUE);
AnimationManager()->FUN_100604f0(g_unk0x100f4428, sizeOfArray(g_unk0x100f4428));
AnimationManager()->FUN_10060480(g_unk0x100f4458, sizeOfArray(g_unk0x100f4458));
break;
case 12: {
LegoROI* roi;
roi = FindROI("nick");
if (roi != NULL) {
roi->SetVisibility(FALSE);
}
roi = FindROI("laura");
if (roi != NULL) {
roi->SetVisibility(FALSE);
}
roi = FindROI("motoni");
if (roi != NULL) {
roi->SetVisibility(FALSE);
}
roi = FindROI("motola");
if (roi != NULL) {
roi->SetVisibility(FALSE);
}
m_bricks[m_nextBrick - 1].Mute(FALSE);
m_unk0x10c4 = 13;
SpawnBricks();
PlayMusic(JukeboxScript::c_BrickHunt);
((LegoPathActor*) m_pepper->GetEntity())->SetState(0);
break;
}
case 14:
for (MxS32 i = 0; i < (MxS32) sizeOfArray(m_bricks); i++) {
m_bricks[i].Remove();
}
FUN_10051900();
m_destLocation = LegoGameState::e_copterbuild;
TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE);
break;
}
}
return 0;
}
@ -342,10 +479,49 @@ MxLong LegoAct2::HandleTransitionEnd()
return 1;
}
// STUB: LEGO1 0x10050a80
// FUNCTION: LEGO1 0x10050a80
void LegoAct2::ReadyWorld()
{
// TODO
LegoWorld::ReadyWorld();
AnimationManager()->Resume();
TickleManager()->RegisterClient(this, 20);
m_ready = TRUE;
m_siFile = VariableTable()->GetVariable("ACT2_ANIMS_FILE");
GameState()->SetActor(LegoActor::c_pepper);
m_pepper = FindROI("pepper");
IslePathActor* pepper = (IslePathActor*) m_pepper->GetEntity();
pepper->SpawnPlayer(
LegoGameState::e_unk50,
TRUE,
IslePathActor::c_spawnBit1 | IslePathActor::c_playMusic | IslePathActor::c_spawnBit3
);
LegoROI* roi = FindROI("Block01");
BoundingSphere sphere = roi->GetBoundingSphere();
sphere.Radius() *= 1.5;
roi->SetBoundingSphere(sphere);
LegoPathActor* actor = (LegoPathActor*) roi->GetEntity();
PlaceActor(actor, "EDG01_04", 1, 0.5f, 3, 0.5f);
MxMatrix local2world = roi->GetLocal2World();
local2world[3][0] -= 1.5;
roi->FUN_100a58f0(local2world);
roi->VTable0x14();
roi = FindROI("Block02");
sphere = roi->GetBoundingSphere();
sphere.Radius() *= 1.5;
roi->SetBoundingSphere(sphere);
actor = (LegoPathActor*) roi->GetEntity();
PlaceActor(actor, "EDG00_149", 0, 0.5f, 2, 0.5f);
PlayMusic(JukeboxScript::c_Jail_Music);
FUN_10051900();
VideoManager()->Get3DManager()->SetFrustrum(90.0f, 0.1f, 250.f);
m_gameState->m_enabled = TRUE;
}
// FUNCTION: LEGO1 0x10050cf0
@ -376,7 +552,7 @@ void LegoAct2::Enable(MxBool p_enable)
PlayMusic(m_music);
}
if (m_unk0x10c4 == 10 && m_unk0x10c0 == 6 && m_bricks[5].GetROI() != NULL) {
if (m_unk0x10c4 == 10 && m_nextBrick == 6 && m_bricks[5].GetROI() != NULL) {
m_bricks[5].PlayWhistleSound();
}
else if (m_unk0x10c4 == 13) {
@ -391,7 +567,7 @@ void LegoAct2::Enable(MxBool p_enable)
MxDSAction action;
MxEndActionNotificationParam param(c_notificationEndAction, NULL, &action, FALSE);
m_unk0x1140 = 0;
m_unk0x1140 = (Act2mainScript::Script) 0;
action.SetObjectId(0);
HandleEndAction(param);
}
@ -407,24 +583,79 @@ void LegoAct2::Enable(MxBool p_enable)
UninitBricks();
DeleteObjects(&m_atomId, Act2mainScript::c_VOhead0_PlayWav, Act2mainScript::c_VOhide_PlayWav);
if (m_unk0x1144 != Act2mainScript::c__Act2Main) {
if (m_unk0x1144 != (Act2mainScript::Script) 0) {
MxDSAction action;
action.SetAtomId(m_atomId);
action.SetUnknown24(-2);
action.SetObjectId(m_unk0x1144);
DeleteObject(action);
m_unk0x1144 = Act2mainScript::c__Act2Main;
m_unk0x1144 = (Act2mainScript::Script) 0;
}
TickleManager()->UnregisterClient(this);
}
}
// STUB: LEGO1 0x10051460
// STUB: BETA10 0x1003bb72
// FUNCTION: LEGO1 0x10051460
// FUNCTION: BETA10 0x1003bb72
MxLong LegoAct2::HandlePathStruct(LegoPathStructNotificationParam& p_param)
{
// TODO
if (m_unk0x10c4 == 5 && p_param.GetData() == 0x32) {
LegoPathActor* actor = (LegoPathActor*) m_pepper->GetEntity();
actor->SetState(LegoPathActor::c_bit3);
actor->SetWorldSpeed(0.0f);
FUN_10051900();
if (m_unk0x10d0 < 90000) {
FUN_10052560(Act2mainScript::c_tra031ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_tra032ni_RunAnim, TRUE, TRUE, NULL, NULL, NULL);
}
m_unk0x112c = 50;
m_unk0x10c4 = 6;
m_unk0x10d0 = 0;
}
else if (m_unk0x10c4 == 5 && p_param.GetData() == 0x2a) {
if (m_unk0x1144 == (Act2mainScript::Script) 0) {
FUN_10052560(Act2mainScript::c_Avo907In_PlayWav, FALSE, FALSE, NULL, NULL, NULL);
m_unk0x1144 = Act2mainScript::c_Avo907In_PlayWav;
}
}
else if (m_unk0x10c4 == 5) {
FUN_100521f0(p_param.GetData());
}
else if (m_unk0x10c4 == 7) {
FUN_10051fa0(p_param.GetData());
}
else if (m_unk0x10c4 == 10 && p_param.GetData() == 0x165) {
((LegoPathActor*) m_pepper->GetEntity())->SetState(LegoPathActor::c_bit3);
if (FUN_10052560(Act2mainScript::c_VOhide_PlayWav, FALSE, TRUE, NULL, NULL, NULL) == SUCCESS) {
m_unk0x1140 = Act2mainScript::c_VOhide_PlayWav;
}
m_unk0x1138->FUN_10019560();
m_unk0x10c4 = 11;
m_unk0x10d0 = 0;
if (m_nextBrick < 6) {
m_bricks[m_nextBrick].Create(m_nextBrick);
m_nextBrick++;
}
MxMatrix local2world = m_ambulance->GetLocal2World();
MxMatrix local2world2 = local2world;
LegoPathBoundary* boundary = m_unk0x1138->GetBoundary();
local2world[3][1] += 1.5;
local2world2[3][1] -= 0.1;
m_bricks[m_nextBrick - 1].FUN_1007a670(local2world, local2world2, boundary);
}
return 0;
}
@ -453,6 +684,30 @@ void LegoAct2::FUN_10051900()
}
}
// FUNCTION: LEGO1 0x10051960
// FUNCTION: BETA10 0x1003bf2c
void LegoAct2::FUN_10051960()
{
LegoROI* roi;
roi = FindROI("mama");
if (roi != NULL) {
roi->SetVisibility(FALSE);
}
roi = FindROI("papa");
if (roi != NULL) {
roi->SetVisibility(FALSE);
}
roi = FindROI("infoman");
if (roi != NULL) {
roi->SetVisibility(FALSE);
}
((LegoPathActor*) m_pepper->GetEntity())->SetState(0);
}
// FUNCTION: LEGO1 0x100519c0
void LegoAct2::VTable0x60()
{
@ -500,10 +755,286 @@ void LegoAct2::UninitBricks()
}
}
// FUNCTION: LEGO1 0x10051ac0
// FUNCTION: BETA10 0x100138c0
void LegoAct2::SpawnBricks()
{
MxFloat infobridge[] = {79.0625f, 0.5f, -19.75f};
MxFloat palmTreeInPark[] = {67.62728f, 0.917197f, 11.49833f};
MxFloat store[] = {-53.9328f, 2.372259f, -61.2073f};
MxFloat postOffice[] = {-30.9856f, 0.30453f, -47.4378f};
MxFloat h3[] = {-71.2397f, 7.319758f, -23.0f};
MxFloat ht[] = {-59.5102f, 14.37329f, 24.70311f};
MxFloat posta[] = {74.0625f, 1.5f, -91.125f};
MxFloat ptree[] = {-20.4375f, 0.5f, -82.5625f};
MxFloat jail[] = {80.46174f, 0.6f, -59.50533f};
MxFloat hospital[] = {84.0f, 4.5f, 26.0f};
InitBricks();
Act2Brick* brick = &m_bricks[m_nextBrick];
brick->Create(m_nextBrick);
LegoROI* roi = brick->GetROI();
MxMatrix local2world = roi->GetLocal2World();
MxFloat* location;
// Unused but present in BETA
LegoEntity* entity;
if ((MxS16) (rand() % 2) == 1) {
m_firstBrick = 0;
location = infobridge;
MxTrace("infobridge\n");
}
else {
m_firstBrick = 1;
location = palmTreeInPark;
MxTrace("palm tree in park\n");
}
SET3(local2world[3], location);
roi->FUN_100a58f0(local2world);
roi->SetVisibility(TRUE);
roi->VTable0x14();
entity = roi->GetEntity();
brick->PlayWhistleSound();
m_nextBrick++;
brick = &m_bricks[m_nextBrick];
brick->Create(m_nextBrick);
roi = brick->GetROI();
local2world = roi->GetLocal2World();
if ((MxS16) (rand() % 2) == 1) {
m_secondBrick = 2;
location = store;
MxTrace("store\n");
}
else {
m_secondBrick = 3;
location = postOffice;
MxTrace("p.o.\n");
}
SET3(local2world[3], location);
roi->FUN_100a58f0(local2world);
roi->SetVisibility(TRUE);
roi->VTable0x14();
entity = roi->GetEntity();
brick->PlayWhistleSound();
m_nextBrick++;
brick = &m_bricks[m_nextBrick];
brick->Create(m_nextBrick);
roi = brick->GetROI();
local2world = roi->GetLocal2World();
if ((MxS16) (rand() % 2) == 1) {
m_thirdBrick = 4;
location = h3;
MxTrace("h3\n");
}
else {
m_thirdBrick = 5;
location = ht;
MxTrace("ht\n");
}
SET3(local2world[3], location);
roi->FUN_100a58f0(local2world);
roi->SetVisibility(TRUE);
roi->VTable0x14();
entity = roi->GetEntity();
brick->PlayWhistleSound();
m_nextBrick++;
brick = &m_bricks[m_nextBrick];
brick->Create(m_nextBrick);
roi = brick->GetROI();
local2world = roi->GetLocal2World();
if ((MxS16) (rand() % 2) == 1) {
if ((MxS16) (rand() % 2) == 1) {
m_fourthBrick = 6;
location = posta;
MxTrace("po.sta.\n");
}
else {
m_fourthBrick = 7;
location = ptree;
MxTrace("p.tree\n");
}
}
else {
if ((MxS16) (rand() % 2) == 1) {
m_fourthBrick = 8;
location = jail;
MxTrace("jail\n");
}
else {
m_fourthBrick = 9;
location = hospital;
MxTrace("hospi\n");
}
}
SET3(local2world[3], location);
roi->FUN_100a58f0(local2world);
roi->SetVisibility(TRUE);
roi->VTable0x14();
entity = roi->GetEntity();
brick->PlayWhistleSound();
m_nextBrick++;
}
// FUNCTION: LEGO1 0x10051fa0
// FUNCTION: BETA10 0x10013fd3
void LegoAct2::FUN_10051fa0(MxS32 p_param1)
{
MxU8 randN = rand() / (RAND_MAX / 3);
randN++;
switch (p_param1) {
case 2:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx50bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx51bu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 8:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx29nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx30nu_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 9:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx33na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx34na_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 14:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx46cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx48cl_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 23:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx58va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx60va_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 24:
case 25:
FUN_10052560(Act2mainScript::c_snsx31sh_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
break;
case 26:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx52sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx53sn_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 34:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx15la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx16la_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 36:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx10ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx11ni_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
case 38:
case 42:
if (randN == 1) {
FUN_10052560(Act2mainScript::c_snsx03ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
else {
FUN_10052560(Act2mainScript::c_snsx04ma_RunAnim, TRUE, FALSE, NULL, NULL, NULL);
}
break;
}
}
// FUNCTION: LEGO1 0x100521f0
// FUNCTION: BETA10 0x100142f1
void LegoAct2::FUN_100521f0(MxS32 p_param1)
{
Act2mainScript::Script objectId = (Act2mainScript::Script) 0;
Mx3DPointFloat vec;
switch (p_param1) {
case 0x02: {
vec = Mx3DPointFloat(-9.1f, 0.0f, -16.5f);
VariableTable()->SetVariable("ACTOR_01", "bd");
objectId = Act2mainScript::c_tns030bd_RunAnim;
break;
}
case 0x2a: {
vec = Mx3DPointFloat(-9.67f, 0.0f, -44.3f);
VariableTable()->SetVariable("ACTOR_01", "rd");
objectId = Act2mainScript::c_tns030rd_RunAnim;
break;
}
case 0x133: {
vec = Mx3DPointFloat(25.75f, 0.0f, -13.0f);
VariableTable()->SetVariable("ACTOR_01", "pg");
objectId = Act2mainScript::c_tns030pg_RunAnim;
break;
}
case 0x134: {
vec = Mx3DPointFloat(43.63f, 0.0f, -46.33f);
VariableTable()->SetVariable("ACTOR_01", "sy");
objectId = Act2mainScript::c_tns030sy_RunAnim;
break;
}
case 0x135: {
vec = Mx3DPointFloat(50.0f, 0.0f, -34.6f);
VariableTable()->SetVariable("ACTOR_01", "rd");
objectId = Act2mainScript::c_tns030rd_RunAnim;
break;
}
case 0x138: {
vec = Mx3DPointFloat(-41.15f, 4.0f, 31.0f);
VariableTable()->SetVariable("ACTOR_01", "sy");
objectId = Act2mainScript::c_tns030sy_RunAnim;
break;
}
}
if (objectId != (Act2mainScript::Script) 0) {
Mx3DPointFloat local30(vec);
Mx3DPointFloat position(m_pepper->GetWorldPosition());
local30 -= position;
Mx3DPointFloat local44 = local30;
local30.Unitize();
FUN_10052560(objectId, TRUE, TRUE, &vec, &local30, NULL);
}
}
// FUNCTION: LEGO1 0x10052560
// FUNCTION: BETA10 0x100145c6
undefined4 LegoAct2::FUN_10052560(
MxS32 p_param1,
MxResult LegoAct2::FUN_10052560(
Act2mainScript::Script p_objectId,
MxBool p_param2,
MxBool p_param3,
Mx3DPointFloat* p_location,
@ -511,14 +1042,13 @@ undefined4 LegoAct2::FUN_10052560(
Mx3DPointFloat* p_param6
)
{
if (m_unk0x1140 == 0 || p_param3) {
if (m_unk0x1140 == (Act2mainScript::Script) 0 || p_param3) {
assert(strlen(m_siFile));
if (!p_param2) {
MxDSAction action;
action.SetObjectId(p_param1);
action.SetObjectId(p_objectId);
// World index: see LegoOmni::RegisterWorlds
action.SetAtomId(*Lego()->GetWorldAtom(15));
@ -575,19 +1105,50 @@ undefined4 LegoAct2::FUN_10052560(
MxResult result;
if (p_param1 == Act2mainScript::c_tja009ni_RunAnim) {
result = AnimationManager()->FUN_10060dc0(p_param1, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, TRUE);
if (p_objectId == Act2mainScript::c_tja009ni_RunAnim) {
result =
AnimationManager()->FUN_10060dc0(p_objectId, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, TRUE);
}
else {
result =
AnimationManager()->FUN_10060dc0(p_param1, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, FALSE);
AnimationManager()->FUN_10060dc0(p_objectId, pmatrix, TRUE, FALSE, NULL, TRUE, TRUE, TRUE, FALSE);
}
if (result == SUCCESS) {
m_unk0x1140 = p_param1;
m_unk0x1140 = p_objectId;
}
}
}
return 0;
return SUCCESS;
}
// FUNCTION: LEGO1 0x10052800
// FUNCTION: BETA10 0x10014aa8
MxResult LegoAct2::FUN_10052800()
{
LegoPathActor* actor = m_unk0x1138;
LegoLocomotionAnimPresenter* ap;
PlaceActor(actor, "EDG01_27", 2, 0.5f, 0, 0.5f);
ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim0");
assert(ap);
ap->FUN_1006d680(m_unk0x1138, 0.0f);
ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim2");
assert(ap);
ap->FUN_1006d680(m_unk0x1138, 6.0f);
ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "Ambul_Anim3");
assert(ap);
ap->FUN_1006d680(m_unk0x1138, 3.0f);
ap = (LegoLocomotionAnimPresenter*) Find("LegoAnimPresenter", "BrShoot");
assert(ap);
ap->FUN_1006d680(m_unk0x1138, -1.0f);
actor->SetWorldSpeed(0.0f);
m_unk0x1138->FUN_10018980();
return SUCCESS;
}

View file

@ -69,13 +69,15 @@ MxResult Police::Create(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x1005e480
// FUNCTION: BETA10 0x100f04a3
MxLong Police::Notify(MxParam& p_param)
{
MxLong result = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;

View file

@ -108,13 +108,15 @@ MxResult RegistrationBook::Create(MxDSAction& p_dsAction)
}
// FUNCTION: LEGO1 0x100770e0
// FUNCTION: BETA10 0x100f2d98
MxLong RegistrationBook::Notify(MxParam& p_param)
{
MxNotificationParam& param = (MxNotificationParam&) p_param;
MxLong result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;

View file

@ -84,13 +84,16 @@ void Score::DeleteScript()
}
// FUNCTION: LEGO1 0x10001410
// FUNCTION: BETA10 0x100f4398
MxLong Score::Notify(MxParam& p_param)
{
MxLong ret = 0;
MxNotificationParam& param = (MxNotificationParam&) p_param;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationStartAction:
Paint();
ret = 1;

View file

@ -168,7 +168,7 @@ LegoResult LegoAnimScene::FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix)
}
local54 = localcc;
((Vector3&) local54).Sub(localb8);
local54 -= localb8;
if (local54.Unitize() == 0) {
local5c.EqualsCross(&local68, &local54);
@ -177,7 +177,7 @@ LegoResult LegoAnimScene::FUN_1009f490(LegoFloat p_time, Matrix4& p_matrix)
local68.EqualsCross(&local54, &local5c);
localcc = p_matrix[3];
((Vector3&) localcc).Add(localb0[3]);
localcc += localb0[3];
p_matrix[3][0] = p_matrix[3][1] = p_matrix[3][2] = localb0[3][0] = localb0[3][1] = localb0[3][2] = 0;

View file

@ -24,15 +24,14 @@ struct LegoUnknown100db7f4 : public LegoEdge {
// FUNCTION: BETA10 0x100372a0
LegoResult FUN_1002ddc0(LegoWEEdge& p_f, Vector3& p_point)
{
if (p_f.IsEqual(*m_faceA)) {
if (p_f.IsEqual(m_faceA)) {
p_point[0] = -m_unk0x28.index_operator(0);
p_point[1] = -m_unk0x28.index_operator(1);
p_point[2] = -m_unk0x28.index_operator(2);
}
else {
// clang-format off
// FIXME: There is no * dereference in the original assertion
assert(p_f.IsEqual( *m_faceB ));
assert(p_f.IsEqual( m_faceB ));
// clang-format on
p_point = m_unk0x28;
}
@ -41,16 +40,20 @@ struct LegoUnknown100db7f4 : public LegoEdge {
}
// FUNCTION: BETA10 0x1004a830
LegoU32 Unknown(LegoWEGEdge& p_face, LegoU8 p_mask)
LegoU32 BETA_1004a830(LegoWEGEdge& p_face, LegoU8 p_mask)
{
return (p_face.IsEqual(*m_faceB) && (m_flags & c_bit1) && (p_face.GetMask0x03() & p_mask) == p_mask) ||
(p_face.IsEqual(*m_faceA) && (m_flags & c_bit2) && (p_face.GetMask0x03() & p_mask) == p_mask);
assert(p_face.IsEqual(m_faceA) || p_face.IsEqual(m_faceB));
return (p_face.IsEqual(m_faceB) && (m_flags & c_bit1) && (p_face.GetMask0x03() & p_mask) == p_mask) ||
(p_face.IsEqual(m_faceA) && (m_flags & c_bit2) && (p_face.GetMask0x03() & p_mask) == p_mask);
}
// FUNCTION: BETA10 0x100b53b0
LegoU32 Unknown2(LegoWEGEdge& p_face)
LegoU32 BETA_100b53b0(LegoWEGEdge& p_face)
{
return (p_face.IsEqual(*m_faceA) && (m_flags & c_bit1)) || (p_face.IsEqual(*m_faceB) && (m_flags & c_bit2));
// clang-format off
assert(p_face.IsEqual( m_faceA ) || p_face.IsEqual( m_faceB ));
// clang-format on
return (p_face.IsEqual(m_faceA) && (m_flags & c_bit1)) || (p_face.IsEqual(m_faceB) && (m_flags & c_bit2));
}
// FUNCTION: BETA10 0x1001cbe0
@ -64,6 +67,30 @@ struct LegoUnknown100db7f4 : public LegoEdge {
}
}
// FUNCTION: BETA10 0x100bd4a0
LegoFloat DistanceToMidpoint(const Vector3& p_vec)
{
Mx3DPointFloat point(*m_pointA);
point += *m_pointB;
point *= 0.5f;
point -= p_vec;
return sqrt((double) point.LenSquared());
}
// FUNCTION: BETA10 0x100bd540
LegoFloat DistanceBetweenMidpoints(const LegoUnknown100db7f4& p_other)
{
Mx3DPointFloat point1(*m_pointA);
Mx3DPointFloat point2(*p_other.m_pointA);
point1 += *m_pointB;
point1 *= 0.5f;
point2 += *p_other.m_pointB;
point2 *= 0.5f;
point1 -= point2;
return sqrt((double) point1.LenSquared());
}
// FUNCTION: BETA10 0x1001cc60
LegoU32 GetMask0x03() { return m_flags & (c_bit1 | c_bit2); }
// SYNTHETIC: LEGO1 0x1009a6c0

View file

@ -22,9 +22,8 @@ class LegoWEEdge {
// FUNCTION: BETA10 0x1001cc30
LegoUnknown100db7f4** GetEdges() { return m_edges; }
// TODO: The assertion at BETA10 0x10037352 suggests that this function might take a pointer instead of a reference
// FUNCTION: BETA10 0x100373f0
LegoU32 IsEqual(LegoWEEdge& p_other) { return this == &p_other; }
LegoU32 IsEqual(LegoWEEdge* p_other) { return this == p_other; }
void SetEdges(LegoUnknown100db7f4** p_edges, LegoU8 p_numEdges)
{

View file

@ -62,6 +62,7 @@ class LegoWEGEdge : public LegoWEEdge {
}
}
// FUNCTION: BETA10 0x1004a980
LegoU8 GetMask0x03() { return m_flags & (c_bit1 | c_bit2); }
// SYNTHETIC: LEGO1 0x1009a7e0

View file

@ -42,9 +42,9 @@ LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, L
}
else if (p_f1 >= 0.999) {
v1 = m_unk0x00[0];
((Vector3&) v1).Add(m_unk0x00[1]);
((Vector3&) v1).Add(m_unk0x00[2]);
((Vector3&) v1).Add(m_unk0x00[3]);
v1 += m_unk0x00[1];
v1 += m_unk0x00[2];
v1 += m_unk0x00[3];
for (LegoS32 i = 0; i < 3; i++) {
v4[i] = m_unk0x00[1][i] + m_unk0x00[2][i] * 2.0f + m_unk0x00[3][i] * 3.0f;
@ -61,7 +61,7 @@ LegoResult LegoUnknown::FUN_1009a1e0(float p_f1, Matrix4& p_mat, Vector3& p_v, L
}
if (p_und) {
((Vector3&) v4).Mul(-1.0f);
v4 *= -1.0f;
}
if (v4.Unitize() != 0) {

View file

@ -600,8 +600,8 @@ LegoU32 LegoROI::FUN_100a9410(
{
if (p_collideBox) {
Mx3DPointFloat v2(p_v2);
((Vector3&) v2).Mul(p_f1);
((Vector3&) v2).Add(p_v1);
v2 *= p_f1;
v2 += p_v1;
Mx4DPointFloat localc0;
Mx4DPointFloat local9c;
@ -621,8 +621,8 @@ LegoU32 LegoROI::FUN_100a9410(
localc0[3] = local9c[3] = local168[3] = 1.0f;
local38 = local58;
((Vector3&) local38).Add(locala8);
((Vector3&) local38).Mul(0.5f);
local38 += locala8;
local38 *= 0.5f;
local70 = localc0;
localc0.SetMatrixProduct(&local70, (float*) m_local2world.GetData());
@ -647,7 +647,7 @@ LegoU32 LegoROI::FUN_100a9410(
}
if (local150[i][3] + local38.Dot(&local38, &local150[i]) < 0.0f) {
((Vector4&) local150[i]).Mul(-1.0f);
local150[i] *= -1.0f;
}
}
@ -659,8 +659,8 @@ LegoU32 LegoROI::FUN_100a9410(
if (local50 >= 0.0f && local50 <= p_f1) {
Mx3DPointFloat local17c(p_v2);
((Vector3&) local17c).Mul(local50);
((Vector3&) local17c).Add(local4c);
local17c *= local50;
local17c += local4c;
LegoS32 j;
for (j = 0; j < 6; j++) {
@ -680,7 +680,7 @@ LegoU32 LegoROI::FUN_100a9410(
}
else {
Mx3DPointFloat v1(p_v1);
((Vector3&) v1).Sub(GetWorldBoundingSphere().Center());
v1 -= GetWorldBoundingSphere().Center();
float local10 = GetWorldBoundingSphere().Radius();
float local8 = p_v2.Dot(&p_v2, &p_v2);
@ -716,8 +716,8 @@ LegoU32 LegoROI::FUN_100a9410(
if (local1c >= 0.0f && p_f1 >= local1c) {
p_v3 = p_v2;
p_v3.Mul(local1c);
p_v3.Add(p_v1);
p_v3 *= local1c;
p_v3 += p_v1;
return 1;
}
}
@ -744,8 +744,8 @@ void TimeROI::FUN_100a9b40(Matrix4& p_matrix, LegoTime p_time)
Mx3DPointFloat targetPosition(p_matrix[3]);
Vector3 vec(m_local2world[3]);
((Vector3&) targetPosition).Sub(vec);
((Vector3&) targetPosition).Div(time * 0.001);
targetPosition -= vec;
targetPosition /= time * 0.001;
FUN_100a5a30(targetPosition);
}

View file

@ -26,6 +26,7 @@ class Mx3DPointFloat : public Vector3 {
// FUNCTION: BETA10 0x10011600
Mx3DPointFloat(const Mx3DPointFloat& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); }
// FUNCTION: LEGO1 0x10048ed0
// FUNCTION: BETA10 0x100151e0
Mx3DPointFloat(const Vector3& p_other) : Vector3(m_elements) { EqualsImpl(p_other.m_data); }
@ -162,13 +163,13 @@ inline void UnknownMx4DPointFloat::Unknown7()
Mx4DPointFloat v2;
v1 = m_unk0x00;
((Vector4&) v1).Add(m_unk0x18);
v1 += m_unk0x18;
v2 = m_unk0x00;
((Vector4&) v2).Sub(m_unk0x18);
v2 -= m_unk0x18;
if (v1.Dot(&v1, &v1) < v2.Dot(&v2, &v2)) {
((Vector4&) m_unk0x18).Mul(-1.0f);
m_unk0x18 *= -1.0f;
}
}
}

View file

@ -16,6 +16,7 @@
#include <vector>
using std::list;
using std::map;
using std::multiset;
using std::pair;
using std::set;
using std::vector;

View file

@ -40,7 +40,7 @@ class MxNotificationManager : public MxCore {
~MxNotificationManager() override; // vtable+0x00 (scalar deleting destructor)
MxResult Tickle() override; // vtable+0x08
// TODO: Where does this method come from?
virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread); // vtable+0x14
void Register(MxCore* p_listener);
void Unregister(MxCore* p_listener);

View file

@ -20,9 +20,9 @@ enum NotificationId {
c_notificationButtonDown = 9, // 100d6aa0
c_notificationMouseMove = 10, // 100d6aa0
c_notificationClick = 11, // 100d6aa0
c_notificationDragEnd = 12,
c_notificationDragStart = 13,
c_notificationDrag = 14,
c_notificationDragStart = 12,
c_notificationDrag = 13,
c_notificationDragEnd = 14,
c_notificationTimer = 15, // 100d6aa0
c_notificationControl = 17,
c_notificationEndAnim = 18, // 100d7e80
@ -55,7 +55,10 @@ class MxNotificationParam : public MxParam {
// FUNCTION: BETA10 0x1003c960
MxCore* GetSender() const { return m_sender; }
// FUNCTION: BETA10 0x1007d5c0
void SetNotification(NotificationId p_type) { m_type = p_type; }
// FUNCTION: BETA10 0x1007d5f0
void SetSender(MxCore* p_sender) { m_sender = p_sender; }
protected:

View file

@ -8,6 +8,8 @@
#include "mxnotificationmanager.h"
#include "mxobjectfactory.h"
#include <assert.h>
DECOMP_SIZE_ASSERT(MxCompositePresenter, 0x4c);
// FUNCTION: LEGO1 0x100b60b0
@ -107,16 +109,22 @@ void MxCompositePresenter::EndAction()
}
// FUNCTION: LEGO1 0x100b6760
// FUNCTION: BETA10 0x1013771e
MxLong MxCompositePresenter::Notify(MxParam& p_param)
{
AUTOLOCK(m_criticalSection);
MxNotificationParam& param = (MxNotificationParam&) p_param;
switch (((MxNotificationParam&) p_param).GetNotification()) {
switch (param.GetNotification()) {
case c_notificationEndAction:
VTable0x58((MxEndActionNotificationParam&) p_param);
break;
case c_notificationPresenter:
VTable0x5c((MxNotificationParam&) p_param);
break;
default:
assert(0);
break;
}
return 0;

View file

@ -287,6 +287,7 @@ MxResult MxDiskStreamController::VTable0x20(MxDSAction* p_action)
{
AUTOLOCK(m_criticalSection);
MxDSStreamingAction* entry = (MxDSStreamingAction*) m_list0x80.Find(p_action); // TODO: is this a seperate class?
if (entry) {
MxDSStreamingAction* action = new MxDSStreamingAction(*p_action, 0);
action->SetUnknown28(entry->GetUnknown28());

View file

@ -118,6 +118,7 @@ class Vector2 {
return -1;
} // vtable+0x44
private:
// FUNCTION: LEGO1 0x100021c0
virtual void Add(float p_value) { AddImpl(p_value); } // vtable+0x50
@ -145,6 +146,7 @@ class Vector2 {
// FUNCTION: LEGO1 0x10002240
virtual void Div(const float& p_value) { DivScalarImpl((float*) &p_value); } // vtable+0x68
public:
// FUNCTION: LEGO1 0x10002250
virtual void SetVector(float* p_other) { EqualsImpl(p_other); } // vtable+0x70
@ -170,6 +172,19 @@ class Vector2 {
// FUNCTION: BETA10 0x1001d170
const float& operator[](int idx) const { return m_data[idx]; }
void operator+=(float p_value) { Add(p_value); }
void operator+=(float* p_other) { Add(p_other); }
void operator+=(const Vector2& p_other) { Add(p_other); }
void operator-=(const float* p_other) { Sub(p_other); }
void operator-=(const Vector2& p_other) { Sub(p_other); }
void operator*=(float* p_other) { Mul(p_other); }
void operator*=(Vector2* p_other) { Mul(p_other); }
void operator*=(const float& p_value) { Mul(p_value); }
void operator/=(const float& p_value) { Div(p_value); }
protected:
float* m_data; // 0x04
};
@ -286,6 +301,7 @@ class Vector3 : public Vector2 {
void Clear() override { memset(m_data, 0, sizeof(float) * 3); } // vtable+0x2c
// FUNCTION: LEGO1 0x10003bd0
// FUNCTION: BETA10 0x10011530
float LenSquared() const override
{
return m_data[0] * m_data[0] + m_data[1] * m_data[1] + m_data[2] * m_data[2];

View file

@ -430,10 +430,10 @@ void ViewManager::UpdateViewTransformations()
Vector3 normal(frustum_planes[i]);
x = c;
((Vector3&) x).Sub(b); // TODO: Fix call
x -= b;
y = a;
((Vector3&) y).Sub(b); // TODO: Fix call
y -= b;
normal.EqualsCross(&x, &y);
normal.Unitize();