Reorganize sources and files (#414)

* Reorganize sources

* Refactor

* Remove relative paths

* Renames

* Fix gitignore

* Remove stuff

* Try fixing format script

* Fix format

* Fix format

* Fix naming script

* Test format

* Fix format
This commit is contained in:
Christian Semmler
2024-01-08 04:58:49 -05:00
committed by GitHub
parent 6a85e62406
commit c47206617d
447 changed files with 347 additions and 346 deletions

View File

@@ -0,0 +1,7 @@
#include "act1state.h"
// STUB: LEGO1 0x100334b0
Act1State::Act1State()
{
// TODO
}

View File

@@ -0,0 +1,29 @@
#include "act2brick.h"
// STUB: LEGO1 0x1007a2b0
Act2Brick::Act2Brick()
{
// TODO
}
// STUB: LEGO1 0x1007a470
Act2Brick::~Act2Brick()
{
// TODO
}
// STUB: LEGO1 0x1007a7f0
MxResult Act2Brick::Tickle()
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x1007a8c0
MxLong Act2Brick::Notify(MxParam& p_param)
{
// TODO
return 0;
}

View File

@@ -0,0 +1,9 @@
#include "act2policestation.h"
// STUB: LEGO1 0x1004e0e0
MxLong Act2PoliceStation::Notify(MxParam& p_param)
{
// TODO
return 0;
}

View File

@@ -0,0 +1 @@
#include "legoact2state.h"

View File

@@ -0,0 +1,15 @@
#include "act3.h"
DECOMP_SIZE_ASSERT(Act3, 0x4274)
// STUB: LEGO1 0x10072270
Act3::Act3()
{
// TODO
}
// STUB: LEGO1 0x100726a0
Act3::~Act3()
{
// TODO
}

View File

@@ -0,0 +1 @@
#include "act3shark.h"

View File

@@ -0,0 +1,7 @@
#include "act3state.h"
// FUNCTION: LEGO1 0x1000e2f0
MxBool Act3State::VTable0x14()
{
return FALSE;
}

View File

@@ -0,0 +1,19 @@
#include "legocachesound.h"
// FUNCTION: LEGO1 0x100064d0
LegoCacheSound::LegoCacheSound()
{
Init();
}
// STUB: LEGO1 0x10006630
LegoCacheSound::~LegoCacheSound()
{
// TODO
}
// STUB: LEGO1 0x100066d0
void LegoCacheSound::Init()
{
// TODO
}

View File

@@ -0,0 +1,30 @@
#include "legoloadcachesoundpresenter.h"
DECOMP_SIZE_ASSERT(LegoLoadCacheSoundPresenter, 0x90)
// FUNCTION: LEGO1 0x10018340
LegoLoadCacheSoundPresenter::LegoLoadCacheSoundPresenter()
{
Init();
}
// FUNCTION: LEGO1 0x10018480
LegoLoadCacheSoundPresenter::~LegoLoadCacheSoundPresenter()
{
Destroy(TRUE);
}
// FUNCTION: LEGO1 0x100184e0
void LegoLoadCacheSoundPresenter::Init()
{
this->m_unk0x70 = NULL;
this->m_unk0x78 = 0;
this->m_unk0x7c = 0;
}
// FUNCTION: LEGO1 0x100184f0
void LegoLoadCacheSoundPresenter::Destroy(MxBool p_fromDestructor)
{
delete this->m_unk0x70;
MxWavePresenter::Destroy(p_fromDestructor);
}

View File

@@ -0,0 +1,48 @@
#include "legosoundmanager.h"
#include "mxautolocker.h"
// FUNCTION: LEGO1 0x100298a0
LegoSoundManager::LegoSoundManager()
{
Init();
}
// FUNCTION: LEGO1 0x10029940
LegoSoundManager::~LegoSoundManager()
{
Destroy(TRUE);
}
// FUNCTION: LEGO1 0x100299a0
void LegoSoundManager::Init()
{
m_unk0x40 = 0;
m_unk0x3c = 0;
}
// STUB: LEGO1 0x100299b0
void LegoSoundManager::Destroy(MxBool p_fromDestructor)
{
}
// STUB: LEGO1 0x100299f0
MxResult LegoSoundManager::Create(MxU32 p_frequencyMS, MxBool p_createThread)
{
return MxSoundManager::Create(p_frequencyMS, p_createThread);
}
// FUNCTION: LEGO1 0x1002a390
void LegoSoundManager::Destroy()
{
Destroy(FALSE);
}
// STUB: LEGO1 0x1002a3a0
MxResult LegoSoundManager::Tickle()
{
MxMediaManager::Tickle();
MxAutoLocker lock(&this->m_criticalSection);
return 0; // TODO: call something in unk0x40
}

View File

@@ -0,0 +1,13 @@
#include "buildingentity.h"
// STUB: LEGO1 0x10014e20
BuildingEntity::BuildingEntity()
{
// TODO
}
// STUB: LEGO1 0x10015030
BuildingEntity::~BuildingEntity()
{
// TODO
}

View File

@@ -0,0 +1,12 @@
#include "dunebuggy.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(DuneBuggy, 0x16c);
// FUNCTION: LEGO1 0x10067bb0
DuneBuggy::DuneBuggy()
{
this->m_unk0x13c = 25.0;
this->m_unk0x164 = 1.0;
}

View File

@@ -0,0 +1,370 @@
#include "helicopter.h"
#include "act1state.h"
#include "act3.h"
#include "isle.h"
#include "legoanimationmanager.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoomni.h"
#include "legoutil.h"
#include "legoworld.h"
#include "mxtransitionmanager.h"
DECOMP_SIZE_ASSERT(Helicopter, 0x230)
// FUNCTION: LEGO1 0x10001e60
Helicopter::Helicopter()
{
m_unk0x13c = 60;
}
// FUNCTION: LEGO1 0x10003230
Helicopter::~Helicopter()
{
ControlManager()->Unregister(this);
IslePathActor::Destroy(TRUE);
}
// FUNCTION: LEGO1 0x100032c0
MxResult Helicopter::Create(MxDSObject& p_dsObject)
{
MxResult result = IslePathActor::Create(p_dsObject);
LegoWorld* world = GetCurrentWorld();
SetWorld(world);
if (world->IsA("Act3")) {
((Act3*) GetWorld())->SetUnkown420c(this);
}
world = GetWorld();
if (world)
world->VTable0x58(this);
GetState();
return result;
}
// FUNCTION: LEGO1 0x10003320
void Helicopter::GetState()
{
m_state = (HelicopterState*) GameState()->GetState("HelicopterState");
if (!m_state)
m_state = (HelicopterState*) GameState()->CreateState("HelicopterState");
}
// FUNCTION: LEGO1 0x10003360
void Helicopter::VTable0xe4()
{
if (!GameState()->GetUnknown10()) {
VTable0xe8(0x28, TRUE, 7);
}
IslePathActor::VTable0xe4();
if (!GameState()->GetUnknown10()) {
GameState()->SetUnknown424(0x3c);
if (GetCurrentVehicle()) {
if (GetCurrentVehicle()->IsA("IslePathActor")) {
((IslePathActor*) GetCurrentVehicle())->VTable0xe8(0x37, TRUE, 7);
}
}
}
m_state->SetUnknown8(0);
FUN_1003ee00(m_script, 0x16);
FUN_1003ee00(m_script, 0x17);
FUN_1003ee00(m_script, 0x18);
FUN_1003ee00(m_script, 0x19);
FUN_1003ee00(m_script, 0x1a);
FUN_1003ee00(m_script, 0x1b);
FUN_1003ee00(m_script, 0x1c);
FUN_1003ee00(m_script, 0x1d);
FUN_1003ee00(m_script, 0x1e);
FUN_1003ee00(m_script, 0x1f);
AnimationManager()->FUN_1005f6d0(TRUE);
ControlManager()->Unregister(this);
}
// FUNCTION: LEGO1 0x10003480
MxU32 Helicopter::VTable0xcc()
{
if (!FUN_1003ef60())
return 1;
if (!m_world)
m_world = GetCurrentWorld();
AnimationManager()->FUN_1005f6d0(FALSE);
if (GetCurrentVehicle()) {
if (GetCurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) {
GetCurrentVehicle()->VTable0xe4();
}
}
switch (GameState()->GetUnknown10()) {
case 0:
m_script = *g_isleScript;
AnimationManager()->FUN_10064670(FALSE);
VTable0xe8(0x29, TRUE, 7);
((Isle*) GetCurrentWorld())->SetUnknown13c(0x3c);
FUN_10015820(1, 0);
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, TRUE);
SetUnknownDC(4);
PlayMusic(9);
break;
case 1:
m_script = *g_act2mainScript;
break;
case 2:
m_script = *g_act3Script;
break;
}
VTable0xe0();
InvokeAction(ExtraActionType_start, m_script, 0x15, NULL);
GetCurrentAction().SetObjectId(-1);
ControlManager()->Register(this);
return 1;
}
// FUNCTION: LEGO1 0x100035e0
MxU32 Helicopter::VTable0xd4(MxType17NotificationParam& p_param)
{
MxU32 ret = 0;
MxAtomId script;
switch (GameState()->GetUnknown10()) {
case 0:
script = *g_isleScript;
break;
case 1:
script = *g_act2mainScript;
break;
case 2:
script = *g_act3Script;
break;
}
if (p_param.GetUnknown28() == 1) {
switch (p_param.GetUnknown20()) {
case 0x17:
if (*g_act3Script == script) {
((Act3*) GetCurrentWorld())->SetUnkown4270(2);
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, FALSE);
}
else if (m_state->GetUnkown8() != 0)
break;
VTable0xe4();
GameState()->SetUnknown424(0x42);
ret = 1;
break;
case 0x18: {
if (*g_act3Script == script)
break;
Act1State* state = (Act1State*) GameState()->GetState("Act1State");
if (m_state->GetUnkown8() == 0) {
state->SetUnknown18(4);
m_state->SetUnknown8(1);
m_world->FUN_1001fc80(this);
InvokeAction(ExtraActionType_start, script, 0x20, NULL);
SetUnknownDC(0);
}
ret = 1;
break;
}
case 0x19:
if (*g_act3Script == script)
break;
if (m_state->GetUnkown8() == 2) {
m_state->SetUnknown8(3);
m_world->FUN_1001fc80(this);
InvokeAction(ExtraActionType_start, script, 0x21, NULL);
SetUnknownDC(4);
}
ret = 1;
break;
case 0x1a:
if (*g_act3Script != script)
break;
ret = 1;
/* fall through */
case 0x1b:
if (*g_act3Script != script)
break;
if (m_world && m_world->GetCamera()) {
Vector3Data loc, dir, lookat;
loc.CopyFrom(m_world->GetCamera()->FUN_100127f0());
dir.CopyFrom(m_world->GetCamera()->FUN_100128a0());
lookat = dir;
float scale = 3;
lookat.Mul(scale);
lookat.Add(&loc);
Vector3Data v68, v7c, v90(0, 1, 0), va4;
v68.CopyFrom(m_world->GetCamera()->FUN_10012740());
va4.EqualsCross(v68, dir);
v7c.EqualsCross(va4, v90);
if (ret)
if (m_world->FUN_100727e0(m_unk0x138, loc, dir, v7c))
break;
else if (m_world->FUN_10072980(m_unk0x138, loc, dir, v7c))
break;
}
ret = 1;
break;
case 0x1c:
if (GameState()->GetUnknown10() == 0) {
((Isle*) GetCurrentWorld())->SetUnknown13c(2);
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, FALSE);
VTable0xe4();
}
ret = 1;
break;
case 0x1d:
ret = 1;
break;
}
}
return ret;
}
// FUNCTION: LEGO1 0x10003c20
MxU32 Helicopter::VTable0xd8(MxType18NotificationParam& p_param)
{
switch (m_state->GetUnkown8()) {
case 1: {
if (GameState()->GetUnknown10() == 0) {
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(4);
VTable0xe8(0x2a, TRUE, 7);
}
else
VTable0xe8(0x31, TRUE, 7);
m_state->SetUnknown8(2);
Matrix4Data mat;
mat.SetIdentity();
Matrix4 mat2 = mat.GetMatrix();
float s = sin(0.5235987901687622); // PI / 6, 30 deg
float c = cos(0.5235987901687622); // PI / 6, 30 deg
for (MxS32 i = 0; i < 4; i++) {
mat.GetMatrix()[i][1] = mat2[i][1] * c - mat2[i][2] * s;
mat.GetMatrix()[i][2] = mat2[i][2] * c + mat2[i][1] * s;
}
Vector3Impl at(mat.GetMatrix()[3]), dir(mat.GetMatrix()[2]), up(mat.GetMatrix()[1]);
m_world->GetCamera()->LookAt(at, dir, up);
FUN_10010c30();
break;
}
case 3: {
Matrix4Data mat;
mat.SetIdentity();
Vector3Impl at(mat.GetMatrix()[3]), dir(mat.GetMatrix()[2]), up(mat.GetMatrix()[1]);
at[1] = 1.25;
m_world->GetCamera()->LookAt(at, dir, up);
if (GameState()->GetUnknown10() == 0) {
((Act1State*) GameState()->GetState("Act1State"))->SetUnknown18(0);
VTable0xe8(0x29, TRUE, 7);
}
else
VTable0xe8(0x30, TRUE, 7);
m_state->SetUnknown8(0);
break;
}
default:
return 0;
}
return 1;
}
// FUNCTION: LEGO1 0x10003e90
void Helicopter::VTable0x74(Matrix4Impl& p_transform)
{
if (m_unk0xea != 0) {
m_roi->FUN_100a46b0(p_transform);
FUN_10010c30();
}
else {
m_roi->FUN_100a58f0(p_transform);
m_roi->VTable0x14();
if (m_cameraFlag)
FUN_10010c30();
}
}
// FUNCTION: LEGO1 0x10003ee0
void Helicopter::VTable0x70(float p_float)
{
MxU32 state = m_state->GetUnkown8();
switch (state) {
default:
LegoPathActor::VTable0x70(p_float);
return;
case 4:
case 5:
float f = m_unk0x1f0 - p_float + 3000;
if (f >= 0) {
float f2 = f / 3000 + 1;
if (f2 < 0)
f2 = 0;
if (1.0f < f2)
f2 = 1.0f;
Vector3Impl v(m_unk0x160.GetMatrix()[3]);
Matrix4Data mat;
Vector3Impl v2(m_unk0x1a8.GetMatrix()[3]);
float* loc = m_unk0x1a8.GetMatrix()[3];
mat.SetIdentity();
float fa[4];
Vector4Impl v3(fa);
if (m_unk0x1f4.FUN_100040a0(v3, f2) == SUCCESS) {
mat.FromQuaternion(v3);
}
v2.SetVector(loc);
v2.Sub(&v);
v2.Mul(f2);
v2.Add(&v);
m_world->GetCamera()->FUN_100123e0(mat, 0);
}
else {
if (state == 4)
m_world->FUN_10073400();
else
m_world->FUN_10073430();
m_unk0xdc = 4;
}
}
}
// FUNCTION: LEGO1 0x100040a0
MxResult HelicopterSubclass::FUN_100040a0(Vector4Impl& p_v, float p_f)
{
MxU32 state = m_unk0x30;
if (state == 1) {
p_v.EqualsImpl(m_unk0x0.GetVector().elements);
p_v[3] = acos(p_v[3]) * (1 - p_f) * 2.0;
return p_v.NormalizeQuaternion();
}
else if (state == 2) {
p_v.EqualsImpl(m_unk0x18.GetVector().elements);
p_v[3] = acos(p_v[3]) * p_f * 2.0;
p_v.NormalizeQuaternion();
return p_v.NormalizeQuaternion();
}
else if (state == 3) {
double d1 = p_v.Dot(&m_unk0x0, &m_unk0x18), d2;
if (d1 + 1 > 0.00001) {
if (1 - d1 > 0.00001) {
double d = acos(d1);
sin(d);
d1 = sin((1 - p_f) * d) / sin(d);
d2 = sin(p_f * d) / sin(d);
}
else {
d1 = 1 - p_f;
d2 = p_f;
}
for (MxS32 i = 0; i < 4; i++) {
p_v[i] = m_unk0x18[i] * d2 + m_unk0x0[i] * d1;
}
return SUCCESS;
}
p_v[0] = -m_unk0x0[1];
p_v[1] = m_unk0x0[1];
p_v[2] = -m_unk0x0[3];
p_v[3] = m_unk0x0[2];
d1 = sin((1 - p_f) * 1.570796326794895);
d2 = sin(p_f * 1.570796326794895);
for (MxS32 i = 0; i < 3; i++) {
p_v[i] = m_unk0x0[i] * d1 + p_v[i] * d2;
}
return SUCCESS;
}
else
return FAILURE;
}

View File

@@ -0,0 +1 @@
#include "helicopterstate.h"

View File

@@ -0,0 +1,11 @@
#include "jetski.h"
DECOMP_SIZE_ASSERT(Jetski, 0x164);
// FUNCTION: LEGO1 0x1007e3b0
Jetski::Jetski()
{
this->m_unk0x13c = 25.0;
this->m_unk0x150 = 2.0;
this->m_unk0x148 = 1;
}

View File

@@ -0,0 +1,28 @@
#include "legobuildingmanager.h"
// GLOBAL: LEGO1 0x100f37cc
int g_buildingManagerConfig = 1;
// FUNCTION: LEGO1 0x1002f8b0
void LegoBuildingManager::configureLegoBuildingManager(MxS32 p_buildingManagerConfig)
{
g_buildingManagerConfig = p_buildingManagerConfig;
}
// FUNCTION: LEGO1 0x1002f8c0
LegoBuildingManager::LegoBuildingManager()
{
Init();
}
// STUB: LEGO1 0x1002f960
LegoBuildingManager::~LegoBuildingManager()
{
// TODO
}
// STUB: LEGO1 0x1002f9d0
void LegoBuildingManager::Init()
{
// TODO
}

View File

@@ -0,0 +1,29 @@
#include "legocarbuild.h"
// STUB: LEGO1 0x100226d0
LegoCarBuild::LegoCarBuild()
{
// TODO
}
// STUB: LEGO1 0x10022a80
LegoCarBuild::~LegoCarBuild()
{
// TODO
}
// STUB: LEGO1 0x100238b0
MxResult LegoCarBuild::Tickle()
{
// TODO
return 0;
}
// STUB: LEGO1 0x10024050
MxLong LegoCarBuild::Notify(MxParam& p_param)
{
// TODO
return 0;
}

View File

@@ -0,0 +1,25 @@
#include "legovehiclebuildstate.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(LegoVehicleBuildState, 0x50); // 1000acd7
DECOMP_SIZE_ASSERT(LegoVehicleBuildState::UnkStruct, 0xc);
// FUNCTION: LEGO1 0x10017c00
LegoVehicleBuildState::UnkStruct::UnkStruct()
{
m_unk0x04 = 0;
m_unk0x00 = 0;
m_unk0x06 = 0;
m_unk0x08 = 0;
}
// FUNCTION: LEGO1 0x10025f30
LegoVehicleBuildState::LegoVehicleBuildState(char* p_classType)
{
this->m_className = p_classType;
this->m_unk0x4c = 0;
this->m_unk0x4d = 0;
this->m_unk0x4e = 0;
this->m_placedPartCount = 0;
}

View File

@@ -0,0 +1,15 @@
#include "racecar.h"
DECOMP_SIZE_ASSERT(RaceCar, 0x164);
// FUNCTION: LEGO1 0x10028200
RaceCar::RaceCar()
{
this->m_unk0x13c = 40.0;
}
// STUB: LEGO1 0x10028420
RaceCar::~RaceCar()
{
// TODO
}

View File

@@ -0,0 +1,32 @@
#include "animstate.h"
DECOMP_SIZE_ASSERT(AnimState, 0x1c);
// FUNCTION: LEGO1 0x10064ff0
AnimState::AnimState()
{
m_unk0xc = 0;
m_unk0x10 = NULL;
m_unk0x14 = 0;
m_unk0x18 = NULL;
}
// STUB: LEGO1 0x10065150
AnimState::~AnimState()
{
// TODO
}
// STUB: LEGO1 0x100652d0
MxResult AnimState::VTable0x1c(LegoFileStream* p_legoFileStream)
{
// TODO
return FAILURE;
}
// STUB: LEGO1 0x100654f0
MxBool AnimState::SetFlag()
{
// TODO
return FALSE;
}

View File

@@ -0,0 +1,25 @@
#include "gifmanager.h"
DECOMP_SIZE_ASSERT(GifData, 0x14);
DECOMP_SIZE_ASSERT(GifMapEntry, 0x14);
DECOMP_SIZE_ASSERT(GifMap, 0x08);
DECOMP_SIZE_ASSERT(GifManagerBase, 0x14);
DECOMP_SIZE_ASSERT(GifManager, 0x30);
GifMapEntry* g_unk0x100f0100;
// FUNCTION: LEGO1 0x10001cc0
GifMapEntry* GifMap::FindNode(const char*& p_string)
{
GifMapEntry* ret = m_unk0x4;
GifMapEntry* current = ret->m_parent;
while (current != g_unk0x100f0100) {
if (strcmp(current->m_key, p_string) <= 0) {
ret = current;
current = current->m_right;
}
else
current = current->m_left;
}
return ret;
}

View File

@@ -0,0 +1,99 @@
#include "legoactioncontrolpresenter.h"
#include "define.h"
#include "extra.h"
#include "legoomni.h"
#include "legoutil.h"
#include "mxcompositepresenter.h"
#include "mxmediapresenter.h"
#include "mxomni.h"
#include "mxstreamchunk.h"
#include "mxticklemanager.h"
DECOMP_SIZE_ASSERT(LegoActionControlPresenter, 0x68)
// FUNCTION: LEGO1 0x10043ce0
void LegoActionControlPresenter::ReadyTickle()
{
MxStreamChunk* chunk = NextChunk();
if (chunk) {
ParseExtra();
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
m_subscriber->FUN_100b8390(chunk);
if (m_compositePresenter) {
if (m_action->GetDuration() == -1 || m_action->GetFlags() & 1) {
m_compositePresenter->VTable0x60(this);
}
}
}
}
// FUNCTION: LEGO1 0x10043d40
void LegoActionControlPresenter::RepeatingTickle()
{
if (IsEnabled()) {
if (m_unk0x50 == 0) {
ParseExtra();
}
InvokeAction(m_unk0x50, MxAtomId(m_unk0x54.GetData(), LookupMode_LowerCase2), m_unk0x64, NULL);
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Done;
}
}
// FUNCTION: LEGO1 0x10043df0
MxResult LegoActionControlPresenter::AddToManager()
{
MxResult result = FAILURE;
if (TickleManager()) {
result = SUCCESS;
TickleManager()->RegisterClient(this, 100);
}
return result;
}
// FUNCTION: LEGO1 0x10043e20
void LegoActionControlPresenter::Destroy(MxBool p_fromDestructor)
{
if (TickleManager()) {
TickleManager()->UnregisterClient(this);
}
if (!p_fromDestructor) {
MxMediaPresenter::Destroy(FALSE);
}
}
// FUNCTION: LEGO1 0x10043e50
void LegoActionControlPresenter::ParseExtra()
{
MxU32 len = m_action->GetExtraLength();
if (len == 0)
return;
len &= MAXWORD;
char buf[1024];
memcpy(buf, m_action->GetExtraData(), len);
buf[len] = '\0';
char output[1024];
if (KeyValueStringParse(output, g_strACTION, buf)) {
m_unk0x50 = MatchActionString(strtok(output, g_parseExtraTokens));
if (m_unk0x50 != ExtraActionType_exit) {
MakeSourceName(buf, strtok(NULL, g_parseExtraTokens));
m_unk0x54 = buf;
m_unk0x54.ToLowerCase();
if (m_unk0x50 != ExtraActionType_run) {
m_unk0x64 = atoi(strtok(NULL, g_parseExtraTokens));
}
}
}
}

View File

@@ -0,0 +1,56 @@
#include "legobackgroundcolor.h"
#include "decomp.h"
#include "legoomni.h"
#include "legoutil.h"
#include "legovideomanager.h"
DECOMP_SIZE_ASSERT(LegoBackgroundColor, 0x30)
const char* g_delimiter = "\t";
const char* g_set = "set";
const char* g_reset = "reset";
// FUNCTION: LEGO1 0x1003bfb0
LegoBackgroundColor::LegoBackgroundColor(const char* p_key, const char* p_value)
{
m_key = p_key;
m_key.ToUpperCase();
SetValue(p_value);
}
// FUNCTION: LEGO1 0x1003c070
void LegoBackgroundColor::SetValue(const char* p_colorString)
{
m_value = p_colorString;
m_value.ToLowerCase();
LegoVideoManager* videomanager = VideoManager();
if (!videomanager || !p_colorString)
return;
float convertedR, convertedG, convertedB;
char* colorStringCopy = strcpy(new char[strlen(p_colorString) + 1], p_colorString);
char* colorStringSplit = strtok(colorStringCopy, g_delimiter);
if (!strcmp(colorStringSplit, g_set)) {
colorStringSplit = strtok(0, g_delimiter);
if (colorStringSplit)
m_h = (float) (atoi(colorStringSplit) * 0.01);
colorStringSplit = strtok(0, g_delimiter);
if (colorStringSplit)
m_s = (float) (atoi(colorStringSplit) * 0.01);
colorStringSplit = strtok(0, g_delimiter);
if (colorStringSplit)
m_v = (float) (atoi(colorStringSplit) * 0.01);
ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
videomanager->SetSkyColor(convertedR, convertedG, convertedB);
}
else if (!strcmp(colorStringSplit, g_reset)) {
ConvertHSVToRGB(m_h, m_s, m_v, &convertedR, &convertedG, &convertedB);
videomanager->SetSkyColor(convertedR, convertedG, convertedB);
}
delete[] colorStringCopy;
}

View File

@@ -0,0 +1,47 @@
#include "legocameracontroller.h"
// STUB: LEGO1 0x10011d50
LegoCameraController::LegoCameraController()
{
// TODO
}
// STUB: LEGO1 0x10011f70
LegoCameraController::~LegoCameraController()
{
// TODO
}
// STUB: LEGO1 0x10012260
void LegoCameraController::LookAt(Vector3Impl& p_at, Vector3Impl& p_dir, Vector3Impl& p_up)
{
}
// STUB: LEGO1 0x100123e0
void LegoCameraController::FUN_100123e0(Matrix4Data& p_transform, MxU32)
{
}
// STUB: LEGO1 0x10012740
Vector3Data& LegoCameraController::FUN_10012740()
{
// Actually returns reference to a member
static Vector3Data g_v;
return g_v;
}
// STUB: LEGO1 0x100127f0
Vector3Data& LegoCameraController::FUN_100127f0()
{
// Actually returns reference to a member
static Vector3Data g_v;
return g_v;
}
// STUB: LEGO1 0x100128a0
Vector3Data& LegoCameraController::FUN_100128a0()
{
// Actually returns reference to a member
static Vector3Data g_v;
return g_v;
}

View File

@@ -0,0 +1,43 @@
#include "legofullscreenmovie.h"
#include "decomp.h"
#include "legoomni.h"
#include "legovideomanager.h"
#include "mxtypes.h"
DECOMP_SIZE_ASSERT(LegoFullScreenMovie, 0x24)
// GLOBAL: LEGO1 0x100f3be8
const char* g_strEnable = "enable";
// GLOBAL: LEGO1 0x100f3bf4
const char* g_strDisable = "disable";
// FUNCTION: LEGO1 0x1003c500
LegoFullScreenMovie::LegoFullScreenMovie(const char* p_key, const char* p_value)
{
m_key = p_key;
m_key.ToUpperCase();
SetValue(p_value);
}
// FUNCTION: LEGO1 0x1003c5c0
void LegoFullScreenMovie::SetValue(const char* p_option)
{
m_value = p_option;
m_value.ToLowerCase();
LegoVideoManager* videomanager = VideoManager();
if (videomanager) {
if (!strcmp(m_value.GetData(), g_strEnable)) {
videomanager->EnableFullScreenMovie(TRUE);
return;
}
if (!strcmp(m_value.GetData(), g_strDisable)) {
videomanager->EnableFullScreenMovie(FALSE);
return;
}
}
}

View File

@@ -0,0 +1,315 @@
#include "legogamestate.h"
#include "infocenterstate.h"
#include "legoomni.h"
#include "legostate.h"
#include "legostream.h"
#include "mxobjectfactory.h"
#include "mxstring.h"
#include "mxvariabletable.h"
#include "roi/legoroi.h"
#include <stdio.h>
// Based on the highest dword offset (0x42c) referenced in the constructor.
// There may be other members that come after.
DECOMP_SIZE_ASSERT(LegoGameState, 0x430)
// GLOBAL: LEGO1 0x100f3e24
const char* g_historyGSI = "History.gsi";
// GLOBAL: LEGO1 0x100f3e30
const char* g_playersGSI = "Players.gsi";
// GLOBAL: LEGO1 0x100f3e40
const char* g_fileExtensionGS = ".GS";
// GLOBAL: LEGO1 0x100f3e58
ColorStringStruct g_colorSaveData[43] = {
{"c_dbbkfny0", "lego red"}, {"c_dbbkxly0", "lego white"}, {"c_chbasey0", "lego black"},
{"c_chbacky0", "lego black"}, {"c_chdishy0", "lego white"}, {"c_chhorny0", "lego black"},
{"c_chljety1", "lego black"}, {"c_chrjety1", "lego black"}, {"c_chmidly0", "lego black"},
{"c_chmotry0", "lego blue"}, {"c_chsidly0", "lego black"}, {"c_chsidry0", "lego black"},
{"c_chstuty0", "lego black"}, {"c_chtaily0", "lego black"}, {"c_chwindy1", "lego black"},
{"c_dbfbrdy0", "lego red"}, {"c_dbflagy0", "lego yellow"}, {"c_dbfrfny4", "lego red"},
{"c_dbfrxly0", "lego white"}, {"c_dbhndly0", "lego white"}, {"c_dbltbry0", "lego white"},
{"c_jsdashy0", "lego white"}, {"c_jsexhy0", "lego black"}, {"c_jsfrnty5", "lego black"},
{"c_jshndly0", "lego red"}, {"c_jslsidy0", "lego black"}, {"c_jsrsidy0", "lego black"},
{"c_jsskiby0", "lego red"}, {"c_jswnshy5", "lego white"}, {"c_rcbacky6", "lego green"},
{"c_rcedgey0", "lego green"}, {"c_rcfrmey0", "lego red"}, {"c_rcfrnty6", "lego green"},
{"c_rcmotry0", "lego white"}, {"c_rcsidey0", "lego green"}, {"c_rcstery0", "lego white"},
{"c_rcstrpy0", "lego yellow"}, {"c_rctailya", "lego white"}, {"c_rcwhl1y0", "lego white"},
{"c_rcwhl2y0", "lego white"}, {"c_jsbasey0", "lego white"}, {"c_chblady0", "lego black"},
{"c_chseaty0", "lego white"},
};
// NOTE: This offset = the end of the variables table, the last entry
// in that table is a special entry, the string "END_OF_VARIABLES"
extern const char* g_endOfVariables;
// FUNCTION: LEGO1 0x10039550
LegoGameState::LegoGameState()
{
// TODO
SetROIHandlerFunction();
m_stateCount = 0;
m_backgroundColor = new LegoBackgroundColor("backgroundcolor", "set 56 54 68");
VariableTable()->SetVariable(m_backgroundColor);
m_tempBackgroundColor = new LegoBackgroundColor("tempBackgroundcolor", "set 56 54 68");
VariableTable()->SetVariable(m_tempBackgroundColor);
m_fullScreenMovie = new LegoFullScreenMovie("fsmovie", "disable");
VariableTable()->SetVariable(m_fullScreenMovie);
VariableTable()->SetVariable("lightposition", "2");
SerializeScoreHistory(1);
}
// FUNCTION: LEGO1 0x10039720
LegoGameState::~LegoGameState()
{
LegoROI::SetSomeHandlerFunction(NULL);
if (m_stateCount) {
for (MxS16 i = 0; i < m_stateCount; i++) {
LegoState* state = m_stateArray[i];
if (state)
delete state;
}
delete[] m_stateArray;
}
delete[] m_savePath;
}
// FUNCTION: LEGO1 0x10039980
MxResult LegoGameState::Save(MxULong p_slot)
{
MxResult result;
InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState");
if (!infocenterState || infocenterState->GetInfocenterBufferElement(0) == 0)
result = SUCCESS;
else {
result = FAILURE;
MxVariableTable* variableTable = VariableTable();
MxString savePath;
GetFileSavePath(&savePath, p_slot);
LegoFileStream fileStream;
if (fileStream.Open(savePath.GetData(), LegoStream::WriteBit) != FAILURE) {
MxU32 maybeVersion = 0x1000C;
fileStream.Write(&maybeVersion, 4);
fileStream.Write(&m_unk0x24, 2);
fileStream.Write(&m_unk0x10, 2);
fileStream.Write(&m_unk0xc, 1);
for (MxS32 i = 0; i < sizeof(g_colorSaveData) / sizeof(g_colorSaveData[0]); ++i) {
if (LegoStream::WriteVariable(&fileStream, variableTable, g_colorSaveData[i].m_targetName) == FAILURE)
return result;
}
if (LegoStream::WriteVariable(&fileStream, variableTable, "backgroundcolor") != FAILURE) {
if (LegoStream::WriteVariable(&fileStream, variableTable, "lightposition") != FAILURE) {
WriteEndOfVariables(&fileStream);
// TODO: Calls down to more aggregate writing functions
return SUCCESS;
}
}
}
}
return result;
}
// STUB: LEGO1 0x10039c60
MxResult LegoGameState::Load(MxULong)
{
// TODO
return 0;
}
// FUNCTION: LEGO1 0x10039f00
void LegoGameState::SetSavePath(char* p_savePath)
{
if (m_savePath != NULL)
delete[] m_savePath;
if (p_savePath) {
m_savePath = new char[strlen(p_savePath) + 1];
strcpy(m_savePath, p_savePath);
}
else
m_savePath = NULL;
}
// FUNCTION: LEGO1 0x1003a020
MxResult LegoGameState::WriteEndOfVariables(LegoStream* p_stream)
{
MxU8 len = strlen(g_endOfVariables);
if (p_stream->Write(&len, 1) == SUCCESS)
return p_stream->Write(g_endOfVariables, len);
return FAILURE;
}
// FUNCTION: LEGO1 0x1003a170
void LegoGameState::GetFileSavePath(MxString* p_outPath, MxULong p_slotn)
{
char baseForSlot[2] = "0";
char path[1024] = "";
// Save path base
if (m_savePath != NULL)
strcpy(path, m_savePath);
// Slot: "G0", "G1", ...
strcat(path, "G");
baseForSlot[0] += p_slotn;
strcat(path, baseForSlot);
// Extension: ".GS"
strcat(path, g_fileExtensionGS);
*p_outPath = MxString(path);
}
// STUB: LEGO1 0x1003a2e0
void LegoGameState::SerializePlayersInfo(MxS16)
{
// TODO
}
// STUB: LEGO1 0x1003a720
void LegoGameState::FUN_1003a720(MxU32)
{
// TODO
}
// STUB: LEGO1 0x1003b060
void LegoGameState::HandleAction(MxU32)
{
// TODO
}
// FUNCTION: LEGO1 0x1003bac0
void LegoGameState::SetROIHandlerFunction()
{
LegoROI::SetSomeHandlerFunction(&ROIHandlerFunction);
}
// FUNCTION: LEGO1 0x1003bad0
MxBool ROIHandlerFunction(char* p_input, char* p_output, MxU32 p_copyLen)
{
if (p_output != NULL && p_copyLen != 0 &&
(strnicmp(p_input, "INDIR-F-", strlen("INDIR-F-")) == 0 ||
strnicmp(p_input, "INDIR-G-", strlen("INDIR-F-")) == 0)) {
char buf[256];
sprintf(buf, "c_%s", &p_input[strlen("INDIR-F-")]);
const char* value = VariableTable()->GetVariable(buf);
if (value != NULL) {
strncpy(p_output, value, p_copyLen);
p_output[p_copyLen - 1] = '\0';
return TRUE;
}
}
return FALSE;
}
// FUNCTION: LEGO1 0x1003bbb0
LegoState* LegoGameState::GetState(const char* p_stateName)
{
for (MxS32 i = 0; i < m_stateCount; ++i)
if (m_stateArray[i]->IsA(p_stateName))
return m_stateArray[i];
return NULL;
}
// FUNCTION: LEGO1 0x1003bc00
LegoState* LegoGameState::CreateState(const char* p_stateName)
{
LegoState* newState = (LegoState*) ObjectFactory()->Create(p_stateName);
RegisterState(newState);
return newState;
}
// FUNCTION: LEGO1 0x1003bc30
void LegoGameState::RegisterState(LegoState* p_state)
{
MxS32 targetIndex;
for (targetIndex = 0; targetIndex < m_stateCount; ++targetIndex)
if (m_stateArray[targetIndex]->IsA(p_state->ClassName()))
break;
if (targetIndex == m_stateCount) {
LegoState** newBuffer = new LegoState*[m_stateCount + 1];
if (m_stateCount != 0) {
memcpy(newBuffer, m_stateArray, m_stateCount * sizeof(LegoState*));
delete[] m_stateArray;
}
newBuffer[m_stateCount++] = p_state;
m_stateArray = newBuffer;
return;
}
if (m_stateArray[targetIndex])
delete m_stateArray[targetIndex];
m_stateArray[targetIndex] = p_state;
}
// STUB: LEGO1 0x1003c870
void LegoGameState::ScoreStruct::WriteScoreHistory()
{
// TODO
}
// STUB: LEGO1 0x1003ccf0
void LegoGameState::ScoreStruct::FUN_1003ccf0(LegoFileStream&)
{
// TODO
}
// FUNCTION: LEGO1 0x1003cdd0
void LegoGameState::SerializeScoreHistory(MxS16 p_flags)
{
LegoFileStream stream;
MxString savePath(m_savePath);
savePath += "\\";
savePath += g_historyGSI;
if (p_flags == LegoStream::WriteBit) {
m_unk0xa6.WriteScoreHistory();
}
if (stream.Open(savePath.GetData(), (LegoStream::OpenFlags) p_flags) == SUCCESS) {
m_unk0xa6.FUN_1003ccf0(stream);
}
}
// FUNCTION: LEGO1 0x1003cea0
void LegoGameState::SetSomeEnumState(undefined4 p_state)
{
m_unk0x10 = p_state;
}
// FUNCTION: LEGO1 0x1003ceb0
void LegoGameState::FUN_1003ceb0()
{
if (FindEntityByAtomIdOrEntityId(*g_isleScript, 0)) {
m_currentAct = 0;
}
else if (FindEntityByAtomIdOrEntityId(*g_act2mainScript, 0)) {
m_currentAct = 1;
}
else if (FindEntityByAtomIdOrEntityId(*g_act3Script, 0)) {
m_currentAct = 2;
}
else {
m_currentAct = -1;
}
}

View File

@@ -0,0 +1,224 @@
#include "legonavcontroller.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "legoutil.h"
#include "legovideomanager.h"
// GLOBAL: LEGO1 0x100f4c28
int g_mouseDeadzone = 40;
// GLOBAL: LEGO1 0x100f4c2c
float g_zeroThreshold = 0.001f;
// GLOBAL: LEGO1 0x100f4c30
float g_movementMaxSpeed = 40.0f;
// GLOBAL: LEGO1 0x100f4c34
float g_turnMaxSpeed = 20.0f;
// GLOBAL: LEGO1 0x100f4c38
float g_movementMaxAccel = 15.0f;
// GLOBAL: LEGO1 0x100f4c3c
float g_turnMaxAccel = 30.0f;
// GLOBAL: LEGO1 0x100f4c40
float g_movementMinAccel = 4.0f;
// GLOBAL: LEGO1 0x100f4c44
float g_turnMinAccel = 15.0f;
// GLOBAL: LEGO1 0x100f4c48
float g_movementDecel = 50.0f;
// GLOBAL: LEGO1 0x100f4c4c
float g_turnDecel = 50.0f;
// GLOBAL: LEGO1 0x100f4c50
float g_turnSensitivity = 0.4f;
// GLOBAL: LEGO1 0x100f4c54
MxBool g_turnUseVelocity = FALSE;
// FUNCTION: LEGO1 0x10054ac0
LegoNavController::LegoNavController()
{
ResetToDefault();
this->m_unk0x18 = 0.0f;
this->m_unk0x1c = 0.0f;
this->m_targetMovementSpeed = 0.0f;
this->m_targetTurnSpeed = 0.0f;
this->m_movementAccel = 0.0f;
this->m_turnAccel = 0.0f;
this->m_trackDefault = FALSE;
this->m_unk0x5d = FALSE;
this->m_unk0x6c = FALSE;
this->m_unk0x64 = 0;
this->m_unk0x68 = 0;
this->m_unk0x60 = 0;
MxTimer* timer = Timer();
this->m_time = timer->GetTime();
InputManager()->Register(this);
}
// FUNCTION: LEGO1 0x10054c30
LegoNavController::~LegoNavController()
{
InputManager()->UnRegister(this);
}
// FUNCTION: LEGO1 0x10054ca0
void LegoNavController::SetControlMax(int p_hMax, int p_vMax)
{
this->m_hMax = p_hMax;
this->m_vMax = p_vMax;
if (VideoManager()->GetVideoParam().Flags().GetFullScreen()) {
this->m_hMax = 640;
this->m_vMax = 480;
}
}
// FUNCTION: LEGO1 0x10054cd0
void LegoNavController::ResetToDefault()
{
this->m_mouseDeadzone = g_mouseDeadzone;
this->m_zeroThreshold = g_zeroThreshold;
this->m_turnMaxAccel = g_turnMaxAccel;
this->m_movementMaxAccel = g_movementMaxAccel;
this->m_turnMinAccel = g_turnMinAccel;
this->m_movementMinAccel = g_movementMinAccel;
this->m_turnDecel = g_turnDecel;
this->m_movementDecel = g_movementDecel;
this->m_turnMaxSpeed = g_turnMaxSpeed;
this->m_movementMaxSpeed = g_movementMaxSpeed;
this->m_turnUseVelocity = g_turnUseVelocity;
this->m_turnSensitivity = g_turnSensitivity;
}
// FUNCTION: LEGO1 0x10054d40
void LegoNavController::GetDefaults(
int* p_mouseDeadzone,
float* p_movementMaxSpeed,
float* p_turnMaxSpeed,
float* p_movementMaxAccel,
float* p_turnMaxAccel,
float* p_movementDecel,
float* p_turnDecel,
float* p_movementMinAccel,
float* p_turnMinAccel,
float* p_turnSensitivity,
MxBool* p_turnUseVelocity
)
{
*p_mouseDeadzone = g_mouseDeadzone;
*p_movementMaxSpeed = g_movementMaxSpeed;
*p_turnMaxSpeed = g_turnMaxSpeed;
*p_movementMaxAccel = g_movementMaxAccel;
*p_turnMaxAccel = g_turnMaxAccel;
*p_movementDecel = g_movementDecel;
*p_turnDecel = g_turnDecel;
*p_movementMinAccel = g_movementMinAccel;
*p_turnMinAccel = g_turnMinAccel;
*p_turnSensitivity = g_turnSensitivity;
*p_turnUseVelocity = g_turnUseVelocity;
}
// FUNCTION: LEGO1 0x10054dd0
void LegoNavController::SetDefaults(
int p_mouseDeadzone,
float p_movementMaxSpeed,
float p_turnMaxSpeed,
float p_movementMaxAccel,
float p_turnMaxAccel,
float p_movementDecel,
float p_turnDecel,
float p_movementMinAccel,
float p_turnMinAccel,
float p_turnSensitivity,
MxBool p_turnUseVelocity
)
{
g_mouseDeadzone = p_mouseDeadzone;
g_movementMaxSpeed = p_movementMaxSpeed;
g_turnMaxSpeed = p_turnMaxSpeed;
g_movementMaxAccel = p_movementMaxAccel;
g_turnMaxAccel = p_turnMaxAccel;
g_movementDecel = p_movementDecel;
g_turnDecel = p_turnDecel;
g_movementMinAccel = p_movementMinAccel;
g_turnMinAccel = p_turnMinAccel;
g_turnSensitivity = p_turnSensitivity;
g_turnUseVelocity = p_turnUseVelocity;
}
// FUNCTION: LEGO1 0x10054e40
void LegoNavController::SetTargets(int p_hPos, int p_vPos, MxBool p_accel)
{
if (this->m_trackDefault != FALSE)
ResetToDefault();
if (p_accel != FALSE) {
this->m_targetTurnSpeed = CalculateNewTargetSpeed(p_hPos, this->m_hMax / 2, this->m_turnMaxSpeed);
this->m_targetMovementSpeed =
CalculateNewTargetSpeed(this->m_vMax - p_vPos, this->m_vMax / 2, this->m_movementMaxSpeed);
this->m_turnAccel =
CalculateNewAccel(p_hPos, this->m_hMax / 2, this->m_turnMaxAccel, (int) this->m_turnMinAccel);
this->m_movementAccel = CalculateNewAccel(
this->m_vMax - p_vPos,
this->m_vMax / 2,
this->m_movementMaxAccel,
(int) this->m_movementMinAccel
);
}
else {
this->m_targetTurnSpeed = 0.0f;
this->m_targetMovementSpeed = 0.0f;
this->m_movementAccel = this->m_movementDecel;
this->m_turnAccel = this->m_turnDecel;
}
}
// FUNCTION: LEGO1 0x10054f10
float LegoNavController::CalculateNewTargetSpeed(int p_pos, int p_center, float p_maxSpeed)
{
float result;
int diff = p_pos - p_center;
if (diff > this->m_mouseDeadzone)
result = (diff - m_mouseDeadzone) * p_maxSpeed / (p_center - m_mouseDeadzone);
else if (diff < -m_mouseDeadzone)
result = (diff + m_mouseDeadzone) * p_maxSpeed / (p_center - m_mouseDeadzone);
else
result = 0.0f;
return result;
}
// FUNCTION: LEGO1 0x10054f90
float LegoNavController::CalculateNewAccel(int p_pos, int p_center, float p_maxAccel, int p_minAccel)
{
float result;
int diff = p_pos - p_center;
result = Abs(diff) * p_maxAccel / p_center;
if (result < p_minAccel)
result = (float) p_minAccel;
return result;
}
// FUNCTION: LEGO1 0x10054fe0
float LegoNavController::CalculateNewVel(float p_targetVel, float p_currentVel, float p_accel, float p_time)
{
float newVel = p_currentVel;
float velDiff = p_targetVel - p_currentVel;
int vSign = velDiff > 0 ? 1 : -1;
if (Abs(velDiff) > this->m_zeroThreshold) {
float deltaVel = p_accel * p_time;
newVel = p_currentVel + (deltaVel * vSign);
if (vSign > 0)
newVel = Min(newVel, p_targetVel);
else
newVel = Max(newVel, p_targetVel);
}
return newVel;
}

View File

@@ -0,0 +1,135 @@
#include "legoobjectfactory.h"
#include "carrace.h"
#include "decomp.h"
#include "dunebuggy.h"
#include "elevatorbottom.h"
#include "gasstation.h"
#include "gasstationstate.h"
#include "helicopter.h"
#include "helicopterstate.h"
#include "historybook.h"
#include "hospital.h"
#include "hospitalstate.h"
#include "infocenter.h"
#include "infocenterdoor.h"
#include "infocenterstate.h"
#include "isle.h"
#include "jetskirace.h"
#include "lego3dwavepresenter.h"
#include "legoact2.h"
#include "legoact2state.h"
#include "legoactioncontrolpresenter.h"
#include "legoactor.h"
#include "legoactorpresenter.h"
#include "legoanimactor.h"
#include "legoanimpresenter.h"
#include "legocarbuild.h"
#include "legocarbuildanimpresenter.h"
#include "legocarraceactor.h"
#include "legoentity.h"
#include "legoentitypresenter.h"
#include "legoflctexturepresenter.h"
#include "legohideanimpresenter.h"
#include "legojetski.h"
#include "legojetskiraceactor.h"
#include "legoloadcachesoundpresenter.h"
#include "legolocomotionanimpresenter.h"
#include "legoloopinganimpresenter.h"
#include "legomodelpresenter.h"
#include "legopalettepresenter.h"
#include "legopartpresenter.h"
#include "legopathactor.h"
#include "legopathpresenter.h"
#include "legophonemepresenter.h"
#include "legoracecar.h"
#include "legotexturepresenter.h"
#include "legoworld.h"
#include "legoworldpresenter.h"
#include "mxcontrolpresenter.h"
#include "mxvideopresenter.h"
#include "pizza.h"
#include "pizzamissionstate.h"
#include "police.h"
#include "policestate.h"
#include "registrationbook.h"
#include "score.h"
#include "scorestate.h"
#include "skateboard.h"
// #include "act2actor.h"
#include "act2brick.h"
// #include "act2genactor.h"
#include "act2policestation.h"
#include "act3.h"
#include "act3state.h"
#include "ambulance.h"
#include "ambulancemissionstate.h"
#include "bike.h"
#include "doors.h"
#include "jetski.h"
#include "legoanimmmpresenter.h"
#include "motorcycle.h"
#include "racecar.h"
#include "towtrack.h"
#include "towtrackmissionstate.h"
// #include "act3cop.h"
// #include "act3brickster.h"
#include "act1state.h"
#include "act3actor.h"
#include "act3shark.h"
#include "beachhouseentity.h"
#include "bumpbouy.h"
#include "carracestate.h"
#include "gasstationentity.h"
#include "hospitalentity.h"
#include "infocenterentity.h"
#include "jetskiracestate.h"
#include "jukeboxentity.h"
#include "pizzeria.h"
#include "pizzeriastate.h"
#include "policeentity.h"
#include "racestandsentity.h"
#include "radiostate.h"
// #include "caveentity.h"
// #include "jailentity.h"
#include "jukebox.h"
#include "jukeboxstate.h"
#include "mxcompositemediapresenter.h"
// #include "raceskel.h"
#include "animstate.h"
// TODO: Before HospitalState, add all of the different LegoVehicleBuildState's
// TODO: Uncomment once we have all the relevant types ready
// DECOMP_SIZE_ASSERT(LegoObjectFactory, 0x1c8);
// FUNCTION: LEGO1 0x10006e40
LegoObjectFactory::LegoObjectFactory()
{
#define X(V) this->m_id##V = MxAtomId(#V, LookupMode_Exact);
FOR_LEGOOBJECTFACTORY_OBJECTS(X)
#undef X
}
// FUNCTION: LEGO1 0x10009a90
MxCore* LegoObjectFactory::Create(const char* p_name)
{
MxAtomId atom(p_name, LookupMode_Exact);
#define X(V) \
if (this->m_id##V == atom) { \
return new V; \
} \
else
FOR_LEGOOBJECTFACTORY_OBJECTS(X)
#undef X
{
return MxObjectFactory::Create(p_name);
}
}
// FUNCTION: LEGO1 0x1000fb30
void LegoObjectFactory::Destroy(MxCore* p_object)
{
delete p_object;
}

View File

@@ -0,0 +1,27 @@
#include "legoplantmanager.h"
// FUNCTION: LEGO1 0x10026220
LegoPlantManager::LegoPlantManager()
{
Init();
}
// STUB: LEGO1 0x100262c0
LegoPlantManager::~LegoPlantManager()
{
// TODO
}
// STUB: LEGO1 0x10026330
void LegoPlantManager::Init()
{
// TODO
}
// STUB: LEGO1 0x10026e00
MxResult LegoPlantManager::Tickle()
{
// TODO
return 0;
}

View File

@@ -0,0 +1,42 @@
#include "legostate.h"
DECOMP_SIZE_ASSERT(LegoState, 0x08);
// FUNCTION: LEGO1 0x10005f40
LegoState::~LegoState()
{
}
// FUNCTION: LEGO1 0x10005f90
MxBool LegoState::VTable0x14()
{
return TRUE;
}
// FUNCTION: LEGO1 0x10005fa0
MxBool LegoState::SetFlag()
{
return FALSE;
}
// FUNCTION: LEGO1 0x10005fb0
MxResult LegoState::VTable0x1c(LegoFileStream* p_legoFileStream)
{
if (p_legoFileStream->IsWriteMode()) {
p_legoFileStream->FUN_10006030(this->ClassName());
}
return SUCCESS;
}
// FUNCTION: LEGO1 0x10006030
LegoFileStream* LegoFileStream::FUN_10006030(MxString p_str)
{
const char* data = p_str.GetData();
MxU32 fullLength = strlen(data);
MxU16 limitedLength = fullLength;
Write(&limitedLength, sizeof(limitedLength));
Write(data, (MxS16) fullLength);
return this;
}

View File

@@ -0,0 +1,200 @@
#include "legostream.h"
#include "mxvariabletable.h"
#include <cstdio>
#include <string>
// This is a pointer to the end of the global variable name table, which has
// the text "END_OF_VARIABLES" in it.
// TODO: make g_endOfVariables reference the actual end of the variable array.
// GLOBAL: LEGO1 0x100f3e50
const char* g_endOfVariables = "END_OF_VARIABLES";
// Very likely but not certain sizes.
// The classes are only used on the stack in functions we have not 100% matched
// yet, we can confirm the size once we have.
DECOMP_SIZE_ASSERT(LegoStream, 0x8);
DECOMP_SIZE_ASSERT(LegoFileStream, 0xC);
DECOMP_SIZE_ASSERT(LegoMemoryStream, 0x10);
// FUNCTION: LEGO1 0x10039f70
MxResult LegoStream::WriteVariable(LegoStream* p_stream, MxVariableTable* p_from, const char* p_variableName)
{
MxResult result = FAILURE;
const char* variableValue = p_from->GetVariable(p_variableName);
if (variableValue) {
MxU8 length = strlen(p_variableName);
if (p_stream->Write((char*) &length, 1) == SUCCESS) {
if (p_stream->Write(p_variableName, length) == SUCCESS) {
length = strlen(variableValue);
if (p_stream->Write((char*) &length, 1) == SUCCESS)
result = p_stream->Write((char*) variableValue, length);
}
}
}
return result;
}
// 95% match, just some instruction ordering differences on the call to
// MxVariableTable::SetVariable at the end.
// FUNCTION: LEGO1 0x1003a080
MxS32 LegoStream::ReadVariable(LegoStream* p_stream, MxVariableTable* p_to)
{
MxS32 result = 1;
MxU8 length;
if (p_stream->Read((char*) &length, 1) == SUCCESS) {
char nameBuffer[256];
if (p_stream->Read(nameBuffer, length) == SUCCESS) {
nameBuffer[length] = '\0';
if (strcmp(nameBuffer, g_endOfVariables) == 0)
// 2 -> "This was the last entry, done reading."
result = 2;
else {
if (p_stream->Read((char*) &length, 1) == SUCCESS) {
char valueBuffer[256];
if (p_stream->Read(valueBuffer, length) == SUCCESS) {
result = 0;
valueBuffer[length] = '\0';
p_to->SetVariable(nameBuffer, valueBuffer);
}
}
}
}
}
return result;
}
// FUNCTION: LEGO1 0x10045ae0
MxBool LegoStream::IsWriteMode()
{
return m_mode == LEGOSTREAM_MODE_WRITE;
}
// FUNCTION: LEGO1 0x10045af0
MxBool LegoStream::IsReadMode()
{
return m_mode == LEGOSTREAM_MODE_READ;
}
// FUNCTION: LEGO1 0x10099080
LegoMemoryStream::LegoMemoryStream(char* p_buffer) : LegoStream()
{
m_buffer = p_buffer;
m_offset = 0;
}
// FUNCTION: LEGO1 0x10099160
MxResult LegoMemoryStream::Read(void* p_buffer, MxU32 p_size)
{
memcpy(p_buffer, m_buffer + m_offset, p_size);
m_offset += p_size;
return SUCCESS;
}
// FUNCTION: LEGO1 0x10099190
MxResult LegoMemoryStream::Write(const void* p_buffer, MxU32 p_size)
{
memcpy(m_buffer + m_offset, p_buffer, p_size);
m_offset += p_size;
return SUCCESS;
}
// FUNCTION: LEGO1 0x100991c0
LegoFileStream::LegoFileStream() : LegoStream()
{
m_hFile = NULL;
}
// FUNCTION: LEGO1 0x10099250
LegoFileStream::~LegoFileStream()
{
if (m_hFile != NULL)
fclose(m_hFile);
}
// FUNCTION: LEGO1 0x100992c0
MxResult LegoFileStream::Read(void* p_buffer, MxU32 p_size)
{
if (m_hFile == NULL)
return FAILURE;
return (fread(p_buffer, 1, p_size, m_hFile) == p_size) ? SUCCESS : FAILURE;
}
// FUNCTION: LEGO1 0x10099300
MxResult LegoFileStream::Write(const void* p_buffer, MxU32 p_size)
{
if (m_hFile == NULL)
return FAILURE;
return (fwrite(p_buffer, 1, p_size, m_hFile) == p_size) ? SUCCESS : FAILURE;
}
// FUNCTION: LEGO1 0x10099340
MxResult LegoFileStream::Tell(MxU32* p_offset)
{
if (m_hFile == NULL)
return FAILURE;
int got = ftell(m_hFile);
if (got == -1)
return FAILURE;
*p_offset = got;
return SUCCESS;
}
// FUNCTION: LEGO1 0x10099370
MxResult LegoFileStream::Seek(MxU32 p_offset)
{
if (m_hFile == NULL)
return FAILURE;
return (fseek(m_hFile, p_offset, 0) == 0) ? SUCCESS : FAILURE;
}
// FUNCTION: LEGO1 0x100993a0
MxResult LegoFileStream::Open(const char* p_filename, OpenFlags p_mode)
{
char modeString[4];
if (m_hFile != NULL)
fclose(m_hFile);
modeString[0] = '\0';
if (p_mode & ReadBit) {
m_mode = LEGOSTREAM_MODE_READ;
strcat(modeString, "r");
}
if (p_mode & WriteBit) {
if (m_mode != LEGOSTREAM_MODE_READ)
m_mode = LEGOSTREAM_MODE_WRITE;
strcat(modeString, "w");
}
if ((p_mode & 4) != 0)
strcat(modeString, "b");
else
strcat(modeString, "t");
return (m_hFile = fopen(p_filename, modeString)) ? SUCCESS : FAILURE;
}
// FUNCTION: LEGO1 0x100994a0
MxResult LegoMemoryStream::Tell(MxU32* p_offset)
{
*p_offset = m_offset;
return SUCCESS;
}
// FUNCTION: LEGO1 0x100994b0
MxResult LegoMemoryStream::Seek(MxU32 p_offset)
{
m_offset = p_offset;
return SUCCESS;
}

View File

@@ -0,0 +1,49 @@
#include "legounksavedatawriter.h"
#include "legogamestate.h"
#include "legostream.h"
DECOMP_SIZE_ASSERT(LegoSaveDataEntry3, 0x108);
// GLOBAL: LEGO1 0x10104f20
LegoSaveDataEntry3 g_saveData3[66];
// FUNCTION: LEGO1 0x10083310
MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStream* p_stream)
{
MxResult result = FAILURE;
// This should probably be a for loop but I can't figure out how to
// make it match as a for loop.
LegoSaveDataEntry3* entry = g_saveData3;
const LegoSaveDataEntry3* end = &g_saveData3[66];
while (TRUE) {
if (p_stream->Write(&entry->m_savePart1, 4) != SUCCESS)
break;
if (p_stream->Write(&entry->m_savePart2, 4) != SUCCESS)
break;
if (p_stream->Write(&entry->m_savePart3, 1) != SUCCESS)
break;
if (p_stream->Write(&entry->m_currentFrame, 1) != SUCCESS)
break;
if (p_stream->Write(&entry->m_savePart5, 1) != SUCCESS)
break;
if (p_stream->Write(&entry->m_savePart6, 1) != SUCCESS)
break;
if (p_stream->Write(&entry->m_savePart7, 1) != SUCCESS)
break;
if (p_stream->Write(&entry->m_savePart8, 1) != SUCCESS)
break;
if (p_stream->Write(&entry->m_savePart9, 1) != SUCCESS)
break;
if (p_stream->Write(&entry->m_savePart10, 1) != SUCCESS)
break;
if (++entry >= end) {
result = SUCCESS;
break;
}
}
return result;
}

View File

@@ -0,0 +1,208 @@
#include "legoutil.h"
#include "legoomni.h"
#include "legoworld.h"
#include "mxdsaction.h"
#include "mxomni.h"
#include "mxstreamer.h"
#include "mxtypes.h"
#include <process.h>
#include <string.h>
// FUNCTION: LEGO1 0x1003e300
ExtraActionType MatchActionString(const char* p_str)
{
ExtraActionType result = ExtraActionType_unknown;
if (!strcmpi("openram", p_str))
result = ExtraActionType_openram;
else if (!strcmpi("opendisk", p_str))
result = ExtraActionType_opendisk;
else if (!strcmpi("close", p_str))
result = ExtraActionType_close;
else if (!strcmpi("start", p_str))
result = ExtraActionType_start;
else if (!strcmpi("stop", p_str))
result = ExtraActionType_stop;
else if (!strcmpi("run", p_str))
result = ExtraActionType_run;
else if (!strcmpi("exit", p_str))
result = ExtraActionType_exit;
else if (!strcmpi("enable", p_str))
result = ExtraActionType_enable;
else if (!strcmpi("disable", p_str))
result = ExtraActionType_disable;
else if (!strcmpi("notify", p_str))
result = ExtraActionType_notify;
return result;
}
MxBool CheckIfEntityExists(MxBool p_enable, const char* p_filename, MxS32 p_entityId);
void NotifyEntity(const char* p_filename, MxS32 p_entityId, LegoEntity* p_sender);
// FUNCTION: LEGO1 0x1003e430
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender)
{
MxDSAction action;
action.SetAtomId(p_pAtom);
action.SetObjectId(p_targetEntityId);
switch (p_actionId) {
case ExtraActionType_opendisk:
if (!CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId)) {
Streamer()->Open(p_pAtom.GetInternal(), MxStreamer::e_DiskStream);
Start(&action);
}
break;
case ExtraActionType_openram:
if (!CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId)) {
Streamer()->Open(p_pAtom.GetInternal(), MxStreamer::e_RAMStream);
Start(&action);
}
break;
case ExtraActionType_close:
action.SetUnknown24(-2);
DeleteObject(action);
Streamer()->Close(p_pAtom.GetInternal());
break;
case ExtraActionType_start:
if (!CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId)) {
Start(&action);
}
break;
case ExtraActionType_stop:
action.SetUnknown24(-2);
if (!FUN_1003ee00(p_pAtom, p_targetEntityId)) {
DeleteObject(action);
}
break;
case ExtraActionType_run:
_spawnl(0, "\\lego\\sources\\main\\main.exe", "\\lego\\sources\\main\\main.exe", "/script", &p_pAtom, 0);
break;
case ExtraActionType_exit:
Lego()->SetExit(TRUE);
break;
case ExtraActionType_enable:
CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId);
break;
case ExtraActionType_disable:
CheckIfEntityExists(FALSE, p_pAtom.GetInternal(), p_targetEntityId);
break;
case ExtraActionType_notify:
NotifyEntity(p_pAtom.GetInternal(), p_targetEntityId, p_sender);
break;
}
}
// FUNCTION: LEGO1 0x1003e670
MxBool CheckIfEntityExists(MxBool p_enable, const char* p_filename, MxS32 p_entityId)
{
LegoWorld* world =
(LegoWorld*) FindEntityByAtomIdOrEntityId(MxAtomId(p_filename, LookupMode_LowerCase2), p_entityId);
if (world) {
world->VTable0x68(p_enable);
return TRUE;
}
else {
return FALSE;
}
}
// STUB: LEGO1 0x1003e700
void NotifyEntity(const char* p_filename, MxS32 p_entityId, LegoEntity* p_sender)
{
}
// FUNCTION: LEGO1 0x1003eae0
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut)
{
double calc;
double p;
MxLong hueIndex;
double v9;
double v12;
double v13;
double sDbl = p_s;
if (p_s > 0.5f)
calc = (1.0f - p_v) * p_s + p_v;
else
calc = (p_v + 1.0) * sDbl;
if (calc <= 0.0) {
*p_gOut = 0.0f;
*p_bOut = 0.0f;
*p_rOut = 0.0f;
return;
}
p = p_s * 2.0f - calc;
hueIndex = p_h * 6.0;
v9 = (p_h * 6.0 - (float) hueIndex) * ((calc - p) / calc) * calc;
v12 = p + v9;
v13 = calc - v9;
switch (hueIndex) {
case 0:
*p_rOut = calc;
*p_bOut = v12;
*p_gOut = p;
break;
case 1:
*p_rOut = v13;
*p_bOut = calc;
*p_gOut = p;
break;
case 2:
*p_rOut = p;
*p_bOut = calc;
*p_gOut = v12;
break;
case 3:
*p_rOut = p;
*p_bOut = v13;
*p_gOut = calc;
break;
case 4:
*p_rOut = v12;
*p_bOut = p;
*p_gOut = calc;
break;
case 5:
*p_rOut = calc;
*p_bOut = p;
*p_gOut = v13;
break;
case 6:
*p_rOut = calc;
*p_bOut = p;
*p_gOut = v13;
break;
default:
return;
}
}
// STUB: LEGO1 0x1003ee00
MxBool FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id)
{
return TRUE;
}
// STUB: LEGO1 0x1003ef00
void FUN_1003ef00(MxBool)
{
// TODO (something related to animation manager)
}
// FUNCTION: LEGO1 0x1003ef40
void SetAppCursor(WPARAM p_wparam)
{
PostMessageA(MxOmni::GetInstance()->GetWindowHandle(), 0x5400, p_wparam, 0);
}
// STUB: LEGO1 0x1003ef60
MxBool FUN_1003ef60()
{
return TRUE;
}

View File

@@ -0,0 +1,33 @@
#include "legocontrolmanager.h"
// STUB: LEGO1 0x10028520
LegoControlManager::LegoControlManager()
{
// TODO
}
// STUB: LEGO1 0x10028d60
LegoControlManager::~LegoControlManager()
{
// TODO
}
// STUB: LEGO1 0x10028e10
void LegoControlManager::Register(MxCore* p_listener)
{
// TODO
}
// STUB: LEGO1 0x10028ea0
void LegoControlManager::Unregister(MxCore* p_listener)
{
// TODO
}
// STUB: LEGO1 0x10029600
MxResult LegoControlManager::Tickle()
{
// TODO
return 0;
}

View File

@@ -0,0 +1,13 @@
#include "legoactor.h"
DECOMP_SIZE_ASSERT(LegoActor, 0x78)
// FUNCTION: LEGO1 0x1002d110
LegoActor::LegoActor()
{
m_unk0x68 = 0.0f;
m_unk0x6c = 0;
m_unk0x70 = 0.0f;
m_unk0x10 = 0;
m_unk0x74 = 0;
}

View File

@@ -0,0 +1 @@
#include "legoanimactor.h"

View File

@@ -0,0 +1,161 @@
#include "legoentity.h"
#include "define.h"
#include "legoomni.h"
#include "legoutil.h"
#include "legoworld.h"
DECOMP_SIZE_ASSERT(LegoEntity, 0x68)
// FUNCTION: LEGO1 0x1000c290
LegoEntity::~LegoEntity()
{
Destroy(TRUE);
}
// FUNCTION: LEGO1 0x100105f0
void LegoEntity::Init()
{
m_worldLocation.Fill(0);
m_worldDirection.Fill(0);
m_worldSpeed = 0;
m_roi = NULL;
m_cameraFlag = 0;
m_actionArgString = NULL;
m_unk0x10 = 0;
m_unk0x11 = 0;
m_actionType = ExtraActionType_unknown;
m_actionArgNumber = -1;
m_unk0x59 = 4;
}
// STUB: LEGO1 0x10010650
void LegoEntity::ResetWorldTransform(MxBool p_inVehicle)
{
// TODO
}
// STUB: LEGO1 0x10010790
void LegoEntity::SetWorldTransform(Vector3Impl& p_loc, Vector3Impl& p_dir, Vector3Impl& p_up)
{
// TODO
}
// FUNCTION: LEGO1 0x100107e0
MxResult LegoEntity::Create(MxDSObject& p_dsObject)
{
m_mxEntityId = p_dsObject.GetObjectId();
m_atom = p_dsObject.GetAtomId();
Init();
return SUCCESS;
}
// STUB: LEGO1 0x10010810
void LegoEntity::Destroy(MxBool p_fromDestructor)
{
if (m_roi) {
// TODO
}
delete[] m_actionArgString;
Init();
}
// FUNCTION: LEGO1 0x10010880
void LegoEntity::SetWorld()
{
LegoWorld* world = GetCurrentWorld();
if (world != NULL && world != (LegoWorld*) this) {
world->VTable0x58(this);
}
}
// STUB: LEGO1 0x100108a0
void LegoEntity::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2)
{
// TODO
}
// STUB: LEGO1 0x100109b0
void LegoEntity::SetLocation(Vector3Data& p_location, Vector3Data& p_direction, Vector3Data& p_up, MxBool)
{
// TODO
}
// STUB: LEGO1 0x10010c30
void LegoEntity::FUN_10010c30()
{
}
// FUNCTION: LEGO1 0x10010e10
void LegoEntity::ParseAction(char* p_extra)
{
char copy[1024];
char actionValue[1024];
strcpy(copy, p_extra);
if (KeyValueStringParse(actionValue, g_strACTION, copy)) {
m_actionType = MatchActionString(strtok(actionValue, g_parseExtraTokens));
if (m_actionType != ExtraActionType_exit) {
char* token = strtok(NULL, g_parseExtraTokens);
m_actionArgString = new char[strlen(token) + 1];
strcpy(m_actionArgString, token);
if (m_actionType != ExtraActionType_run) {
m_actionArgNumber = atoi(strtok(NULL, g_parseExtraTokens));
}
}
}
}
// STUB: LEGO1 0x10010f10
void LegoEntity::VTable0x34()
{
// TODO
}
// STUB: LEGO1 0x10011070
void LegoEntity::VTable0x38()
{
// TODO
}
// STUB: LEGO1 0x10011300
void LegoEntity::VTable0x3c()
{
// TODO
}
// STUB: LEGO1 0x10011360
void LegoEntity::VTable0x40()
{
// TODO
}
// STUB: LEGO1 0x100113c0
void LegoEntity::VTable0x44()
{
// TODO
}
// STUB: LEGO1 0x10011420
void LegoEntity::VTable0x48()
{
// TODO
}
// STUB: LEGO1 0x10011470
void LegoEntity::VTable0x4c()
{
// TODO
}
// STUB: LEGO1 0x100114f0
MxLong LegoEntity::Notify(MxParam& p_param)
{
// TODO
return 0;
}

View File

@@ -0,0 +1,105 @@
#include "legoentitypresenter.h"
#include "islepathactor.h"
#include "legoomni.h"
#include "legovideomanager.h"
DECOMP_SIZE_ASSERT(LegoEntityPresenter, 0x50);
// FUNCTION: LEGO1 0x10053440
LegoEntityPresenter::LegoEntityPresenter()
{
Init();
}
// FUNCTION: LEGO1 0x100535c0
void LegoEntityPresenter::Init()
{
m_objectBackend = 0;
}
// FUNCTION: LEGO1 0x100535d0
LegoEntityPresenter::~LegoEntityPresenter()
{
Destroy(TRUE);
}
// FUNCTION: LEGO1 0x10053630
undefined4 LegoEntityPresenter::SetBackend(LegoEntity* p_backend)
{
m_objectBackend = p_backend;
return 0;
}
// FUNCTION: LEGO1 0x10053640
void LegoEntityPresenter::Destroy(MxBool p_fromDestructor)
{
if (VideoManager()) {
VideoManager()->RemovePresenter(*this);
}
Init();
}
// FUNCTION: LEGO1 0x10053670
void LegoEntityPresenter::Destroy()
{
Destroy(FALSE);
}
// FUNCTION: LEGO1 0x10053680
MxResult LegoEntityPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
{
MxResult result = MxCompositePresenter::StartAction(p_controller, p_action);
if (VideoManager()) {
VideoManager()->AddPresenter(*this);
}
return result;
}
// FUNCTION: LEGO1 0x100536c0
void LegoEntityPresenter::ReadyTickle()
{
if (GetCurrentWorld()) {
m_objectBackend = (LegoEntity*) MxPresenter::CreateEntityBackend("LegoEntity");
if (m_objectBackend) {
m_objectBackend->Create(*m_action);
m_objectBackend->SetLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), TRUE);
ParseExtra();
}
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
}
}
// FUNCTION: LEGO1 0x10053720
void LegoEntityPresenter::RepeatingTickle()
{
if (m_list.empty()) {
EndAction();
}
}
// FUNCTION: LEGO1 0x10053730
void LegoEntityPresenter::SetBackendLocation(Vector3Data& p_location, Vector3Data& p_direction, Vector3Data& p_up)
{
if (m_objectBackend) {
m_objectBackend->SetLocation(p_location, p_direction, p_up, TRUE);
}
}
// FUNCTION: LEGO1 0x10053750
void LegoEntityPresenter::ParseExtra()
{
char data[512];
MxU16 len = m_action->GetExtraLength();
if (len) {
memcpy(data, m_action->GetExtraData(), len);
data[len] = 0;
len &= MAXWORD;
m_objectBackend->ParseAction(data);
}
}

View File

@@ -0,0 +1 @@
#include "legojetski.h"

View File

@@ -0,0 +1,87 @@
#include "legopathactor.h"
DECOMP_SIZE_ASSERT(LegoPathActor, 0x154)
// STUB: LEGO1 0x1002d700
LegoPathActor::LegoPathActor()
{
// TODO
}
// STUB: LEGO1 0x1002d820
LegoPathActor::~LegoPathActor()
{
// TODO
}
// STUB: LEGO1 0x1002d8d0
void LegoPathActor::VTable0x80()
{
// TODO
}
// STUB: LEGO1 0x1002d9c0
void LegoPathActor::VTable0x88()
{
// TODO
}
// STUB: LEGO1 0x1002de10
void LegoPathActor::VTable0x84()
{
// TODO
}
// STUB: LEGO1 0x1002e100
void LegoPathActor::VTable0x8c()
{
// TODO
}
// STUB: LEGO1 0x1002e740
void LegoPathActor::VTable0x74(Matrix4Impl& p_transform)
{
// TODO
}
// STUB: LEGO1 0x1002e790
void LegoPathActor::VTable0x70(float)
{
// TODO
}
// STUB: LEGO1 0x1002e8b0
void LegoPathActor::VTable0x98()
{
// TODO
}
// STUB: LEGO1 0x1002e8d0
void LegoPathActor::VTable0x6c()
{
// TODO
}
// STUB: LEGO1 0x1002ebe0
void LegoPathActor::VTable0x68()
{
// TODO
}
// STUB: LEGO1 0x1002f1b0
void LegoPathActor::VTable0x9c()
{
// TODO
}
// STUB: LEGO1 0x1002f650
void LegoPathActor::VTable0xa4()
{
// TODO
}
// STUB: LEGO1 0x1002f700
void LegoPathActor::VTable0xa8()
{
// TODO
}

View File

@@ -0,0 +1,88 @@
#include "legorace.h"
#include "mxnotificationmanager.h"
DECOMP_SIZE_ASSERT(LegoRace, 0x144)
// FUNCTION: LEGO1 0x1000dab0
undefined4 LegoRace::VTable0x78(undefined4)
{
return 0;
}
// STUB: LEGO1 0x1000dac0
void LegoRace::VTable0x7c(undefined4, undefined4)
{
// TODO
}
// FUNCTION: LEGO1 0x1000dae0
MxBool LegoRace::VTable0x5c()
{
return TRUE;
}
// FUNCTION: LEGO1 0x10015aa0
LegoRace::LegoRace()
{
this->m_unk0xf8 = 0;
this->m_unk0xfc = 0;
this->m_unk0x100 = 0;
this->m_unk0x104 = 0;
this->m_unk0x108 = 0;
this->m_unk0x10c = 0;
this->m_unk0x140 = 0;
this->m_unk0x110 = 0;
this->m_unk0x114 = 0;
this->m_unk0x118 = 0;
this->m_unk0x128 = 0;
this->m_unk0x12c = 0;
this->m_unk0x120 = 0;
this->m_unk0x124 = 0;
this->m_unk0x11c = 0;
NotificationManager()->Register(this);
}
// FUNCTION: LEGO1 0x10015b70
undefined4 LegoRace::VTable0x70(undefined4)
{
return 0;
}
// FUNCTION: LEGO1 0x10015b80
undefined4 LegoRace::VTable0x74(undefined4)
{
return 0;
}
// FUNCTION: LEGO1 0x10015b90
MxBool LegoRace::VTable0x64()
{
return FALSE;
}
// STUB: LEGO1 0x10015ce0
MxResult LegoRace::Create(MxDSObject& p_dsObject)
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10015d40
LegoRace::~LegoRace()
{
// TODO
}
// STUB: LEGO1 0x10015e00
MxLong LegoRace::Notify(MxParam& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10015ed0
void LegoRace::VTable0x68(MxBool p_add)
{
// TODO
}

View File

@@ -0,0 +1,153 @@
#include "legoworld.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "legoutil.h"
#include "mxactionnotificationparam.h"
#include "mxnotificationmanager.h"
#include "mxnotificationparam.h"
#include "mxomni.h"
#include "mxticklemanager.h"
DECOMP_SIZE_ASSERT(LegoWorld, 0xf8);
// STUB: LEGO1 0x1001ca40
LegoWorld::LegoWorld() : m_list0x68(TRUE)
{
// TODO
m_unk0xf6 = FALSE;
m_unk0xf4 = 4;
NotificationManager()->Register(this);
}
// FUNCTION: LEGO1 0x1001d670
MxBool LegoWorld::VTable0x5c()
{
return FALSE;
}
// FUNCTION: LEGO1 0x1001d680
MxBool LegoWorld::VTable0x64()
{
return FALSE;
}
// STUB: LEGO1 0x1001dfa0
LegoWorld::~LegoWorld()
{
// TODO
}
// STUB: LEGO1 0x1001e0b0
MxResult LegoWorld::SetAsCurrentWorld(MxDSObject& p_dsObject)
{
// TODO
return SUCCESS;
}
// FUNCTION: LEGO1 0x1001f5e0
MxLong LegoWorld::Notify(MxParam& p_param)
{
MxLong ret = 0;
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationEndAction: {
MxPresenter* presenter = (MxPresenter*) ((MxEndActionNotificationParam&) p_param).GetSender();
EndAction(presenter);
ret = 1;
break;
}
case c_notificationNewPresenter:
TickleManager()->RegisterClient(this, 100);
break;
}
return ret;
}
// STUB: LEGO1 0x1001f630
void LegoWorld::VTable0x54()
{
// TODO
}
// STUB: LEGO1 0x1001fc80
void LegoWorld::FUN_1001fc80(IslePathActor* p_actor)
{
}
// STUB: LEGO1 0x10020120
MxS32 LegoWorld::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10020220
void LegoWorld::VTable0x58(MxCore* p_object)
{
// TODO
}
// STUB: LEGO1 0x10020f10
void LegoWorld::EndAction(MxCore* p_object)
{
}
// STUB: LEGO1 0x10021a70
void LegoWorld::VTable0x68(MxBool p_add)
{
// TODO
}
// FUNCTION: LEGO1 0x10022080
MxResult LegoWorld::Tickle()
{
if (!m_unk0xf6) {
switch (m_unk0xf4) {
case 0:
m_unk0xf6 = TRUE;
SetAppCursor(0);
Stop();
return TRUE;
case 2:
if (FUN_100220e0() == 1)
break;
default:
m_unk0xf4--;
}
}
return TRUE;
}
// STUB: LEGO1 0x100220e0
undefined LegoWorld::FUN_100220e0()
{
return TRUE;
}
// FUNCTION: LEGO1 0x10022340
void LegoWorld::Stop()
{
TickleManager()->UnregisterClient(this);
}
// STUB: LEGO1 0x100727e0
MxBool LegoWorld::FUN_100727e0(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up)
{
return FALSE;
}
// STUB: LEGO1 0x10072980
MxBool LegoWorld::FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up)
{
return FALSE;
}
// STUB: LEGO1 0x10073400
void LegoWorld::FUN_10073400()
{
}
// STUB: LEGO1 0x10073430
void LegoWorld::FUN_10073430()
{
}

View File

@@ -0,0 +1,131 @@
#include "legoworldpresenter.h"
#include "legoentity.h"
#include "legoomni.h"
#include "legovideomanager.h"
#include "mxactionnotificationparam.h"
#include "mxautolocker.h"
#include "mxdsactionlist.h"
#include "mxdsmultiaction.h"
#include "mxobjectfactory.h"
#include "mxpresenter.h"
#include "mxstl/stlcompat.h"
// GLOBAL: LEGO1 0x100f75d4
undefined4 g_legoWorldPresenterQuality = 1;
// FUNCTION: LEGO1 0x100665b0
void LegoWorldPresenter::configureLegoWorldPresenter(MxS32 p_legoWorldPresenterQuality)
{
g_legoWorldPresenterQuality = p_legoWorldPresenterQuality;
}
// FUNCTION: LEGO1 0x100665c0
LegoWorldPresenter::LegoWorldPresenter()
{
m_unk0x50 = 50000;
}
// STUB: LEGO1 0x10066770
LegoWorldPresenter::~LegoWorldPresenter()
{
// TODO
}
// FUNCTION: LEGO1 0x10066870
MxResult LegoWorldPresenter::StartAction(MxStreamController* p_controller, MxDSAction* p_action)
{
MxAutoLocker lock(&m_criticalSection);
MxResult result = FAILURE;
MxDSActionList* actions = ((MxDSMultiAction*) p_action)->GetActionList();
MxObjectFactory* factory = ObjectFactory();
MxDSActionListCursor cursor(actions);
MxDSAction* action;
if (MxPresenter::StartAction(p_controller, p_action) == SUCCESS) {
// The usual cursor.Next() loop doesn't match here, even though
// the logic is the same. It does match when "deconstructed" into
// the following Head(), Current() and NextFragment() calls,
// but this seems unlikely to be the original code.
// The alpha debug build also uses Next().
cursor.Head();
while (cursor.Current(action)) {
cursor.NextFragment();
MxBool success = FALSE;
action->CopyFlags(m_action->GetFlags());
const char* presenterName = PresenterNameDispatch(*action);
MxPresenter* presenter = (MxPresenter*) factory->Create(presenterName);
if (presenter && presenter->AddToManager() == SUCCESS) {
presenter->SetCompositePresenter(this);
if (presenter->StartAction(p_controller, action) == SUCCESS) {
presenter->SetTickleState(TickleState_Idle);
success = TRUE;
}
}
if (success) {
action->SetOrigin(this);
m_list.push_back(presenter);
}
else if (presenter)
delete presenter;
}
VideoManager()->AddPresenter(*this);
result = SUCCESS;
}
return result;
}
// FUNCTION: LEGO1 0x10066a50
void LegoWorldPresenter::ReadyTickle()
{
m_objectBackend = (LegoEntity*) MxPresenter::CreateEntityBackend("LegoWorld");
if (m_objectBackend) {
m_objectBackend->Create(*m_action);
Lego()->AddWorld((LegoWorld*) m_objectBackend);
SetBackendLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp());
}
ParseExtra();
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Starting;
}
// FUNCTION: LEGO1 0x10066ac0
void LegoWorldPresenter::StartingTickle()
{
if (m_action->IsA("MxDSSerialAction")) {
MxPresenter* presenter = *m_list.begin();
if (presenter->GetCurrentTickleState() == TickleState_Idle) {
presenter->SetTickleState(TickleState_Ready);
}
}
else {
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
if ((*it)->GetCurrentTickleState() == TickleState_Idle) {
(*it)->SetTickleState(TickleState_Ready);
}
}
}
m_previousTickleStates |= 1 << (unsigned char) m_currentTickleState;
m_currentTickleState = TickleState_Streaming;
}
// STUB: LEGO1 0x10067a70
void LegoWorldPresenter::VTable0x60(MxPresenter* p_presenter)
{
}
// STUB: LEGO1 0x10067b00
void LegoWorldPresenter::ParseExtra()
{
}

View File

@@ -0,0 +1,29 @@
#include "gasstation.h"
// STUB: LEGO1 0x100046a0
GasStation::GasStation()
{
// TODO
}
// STUB: LEGO1 0x100048c0
GasStation::~GasStation()
{
// TODO
}
// STUB: LEGO1 0x10004a60
MxLong GasStation::Notify(MxParam& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10005c90
MxResult GasStation::Tickle()
{
// TODO
return 0;
}

View File

@@ -0,0 +1 @@
#include "gasstationentity.h"

View File

@@ -0,0 +1,18 @@
#include "gasstationstate.h"
DECOMP_SIZE_ASSERT(GasStationState, 0x24);
// FUNCTION: LEGO1 0x10005eb0
GasStationState::GasStationState()
{
m_unk0x18 = 0;
m_unk0x1a = 0;
m_unk0x1c = 0;
m_unk0x1e = 0;
m_unk0x20 = 0;
undefined4* unk0x08 = m_unk0x08;
unk0x08[0] = -1;
unk0x08[1] = -1;
unk0x08[2] = -1;
}

View File

@@ -0,0 +1,21 @@
#include "ambulance.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(Ambulance, 0x184);
// FUNCTION: LEGO1 0x10035ee0
Ambulance::Ambulance()
{
this->m_unk0x168 = 0;
this->m_unk0x16a = -1;
this->m_unk0x164 = 0;
this->m_unk0x16c = 0;
this->m_unk0x174 = -1;
this->m_unk0x16e = 0;
this->m_unk0x178 = -1;
this->m_unk0x170 = 0;
this->m_unk0x172 = 0;
this->m_unk0x13c = 40.0;
this->m_unk0x17c = 1.0;
}

View File

@@ -0,0 +1,20 @@
#include "ambulancemissionstate.h"
DECOMP_SIZE_ASSERT(AmbulanceMissionState, 0x24);
// FUNCTION: LEGO1 0x100373a0
AmbulanceMissionState::AmbulanceMissionState()
{
m_unk0x10 = 0;
m_unk0x12 = 0;
m_unk0x14 = 0;
m_unk0x8 = 0;
m_unk0x16 = 0;
m_unk0xc = 0;
m_unk0x18 = 0;
m_color1 = 0;
m_color2 = 0;
m_color3 = 0;
m_color4 = 0;
m_color5 = 0;
}

View File

@@ -0,0 +1,38 @@
#include "hospital.h"
#include "mxnotificationmanager.h"
#include "mxomni.h"
DECOMP_SIZE_ASSERT(Hospital, 0x12c)
// FUNCTION: LEGO1 0x100745e0
Hospital::Hospital()
{
this->m_unk0xf8 = 0;
this->m_unk0x100 = 0;
this->m_unk0x104 = 0;
this->m_unk0x108 = 0;
this->m_unk0xfc = 0;
this->m_unk0x10c = 0;
this->m_unk0x110 = 0;
this->m_unk0x114 = 0;
this->m_unk0x118 = 0;
this->m_unk0x11c = 0;
this->m_unk0x120 = 0;
this->m_unk0x128 = 0;
NotificationManager()->Register(this);
}
// STUB: LEGO1 0x100747f0
Hospital::~Hospital()
{
// TODO
}
// STUB: LEGO1 0x10074990
MxLong Hospital::Notify(MxParam& p_param)
{
// TODO
return 0;
}

View File

@@ -0,0 +1 @@
#include "hospitalentity.h"

View File

@@ -0,0 +1,14 @@
#include "hospitalstate.h"
DECOMP_SIZE_ASSERT(HospitalState, 0x18)
// FUNCTION: LEGO1 0x10076370
HospitalState::HospitalState()
{
this->m_unk0xc = 0;
this->m_unk0xe = 0;
this->m_unk0x10 = 0;
this->m_unk0x12 = 0;
this->m_unk0x14 = 0;
this->m_unk0x16 = 0;
}

View File

@@ -0,0 +1,21 @@
#include "elevatorbottom.h"
// STUB: LEGO1 0x10017e90
ElevatorBottom::ElevatorBottom()
{
// TODO
}
// STUB: LEGO1 0x10018060
ElevatorBottom::~ElevatorBottom()
{
// TODO
}
// STUB: LEGO1 0x10018150
MxLong ElevatorBottom::Notify(MxParam& p_param)
{
// TODO
return 0;
}

View File

@@ -0,0 +1,57 @@
#include "infocenter.h"
// STUB: LEGO1 0x1006ea20
Infocenter::Infocenter()
{
// TODO
}
// STUB: LEGO1 0x1006ec90
Infocenter::~Infocenter()
{
// TODO
}
// STUB: LEGO1 0x1006ed90
MxResult Infocenter::Create(MxDSObject& p_dsObject)
{
return FAILURE;
}
// STUB: LEGO1 0x1006ef10
MxLong Infocenter::Notify(MxParam& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x1006f4e0
void Infocenter::Stop()
{
// TODO
}
// STUB: LEGO1 0x10070aa0
void Infocenter::VTable0x68(MxBool p_add)
{
// TODO
}
// STUB: LEGO1 0x10070af0
MxResult Infocenter::Tickle()
{
// TODO
return 0;
}
// FUNCTION: LEGO1 0x10070d00
MxBool Infocenter::VTable0x5c()
{
return TRUE;
}
// STUB: LEGO1 0x10070f60
MxBool Infocenter::VTable0x64()
{
return FALSE;
}

View File

@@ -0,0 +1,21 @@
#include "infocenterdoor.h"
// STUB: LEGO1 0x10037730
InfocenterDoor::InfocenterDoor()
{
// TODO
}
// STUB: LEGO1 0x100378f0
InfocenterDoor::~InfocenterDoor()
{
// TODO
}
// STUB: LEGO1 0x100379e0
MxLong InfocenterDoor::Notify(MxParam& p_param)
{
// TODO
return 0;
}

View File

@@ -0,0 +1 @@
#include "infocenterentity.h"

View File

@@ -0,0 +1,15 @@
#include "infocenterstate.h"
DECOMP_SIZE_ASSERT(InfocenterState, 0x94);
// STUB: LEGO1 0x10071600
InfocenterState::InfocenterState()
{
// TODO
}
// STUB: LEGO1 0x10071920
InfocenterState::~InfocenterState()
{
// TODO
}

View File

@@ -0,0 +1,21 @@
#include "registrationbook.h"
// STUB: LEGO1 0x10076d20
RegistrationBook::RegistrationBook()
{
// TODO
}
// STUB: LEGO1 0x10076f50
RegistrationBook::~RegistrationBook()
{
// TODO
}
// STUB: LEGO1 0x100770e0
MxLong RegistrationBook::Notify(MxParam& p_param)
{
// TODO
return 0;
}

View File

@@ -0,0 +1,325 @@
#include "score.h"
#include "ambulancemissionstate.h"
#include "gifmanager.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "mxnotificationmanager.h"
#include "mxnotificationparam.h"
#include "mxtransitionmanager.h"
#include "pizzamissionstate.h"
#include "racestate.h"
#include "towtrackmissionstate.h"
DECOMP_SIZE_ASSERT(Score, 0x104)
// FUNCTION: LEGO1 0x10001000
Score::Score()
{
m_unk0xf8 = 0;
NotificationManager()->Register(this);
}
// FUNCTION: LEGO1 0x100010b0
MxBool Score::VTable0x5c()
{
return TRUE;
}
// FUNCTION: LEGO1 0x10001200
Score::~Score()
{
if (InputManager()->GetWorld() == this)
InputManager()->ClearWorld();
InputManager()->UnRegister(this);
ControlManager()->Unregister(this);
NotificationManager()->Unregister(this);
}
// FUNCTION: LEGO1 0x100012a0
MxResult Score::Create(MxDSObject& p_dsObject)
{
MxResult result = SetAsCurrentWorld(p_dsObject);
if (result == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
InputManager()->Register(this);
SetIsWorldActive(FALSE);
LegoGameState* gs = GameState();
ScoreState* state = (ScoreState*) gs->GetState("ScoreState");
m_state = state ? state : (ScoreState*) gs->CreateState("ScoreState");
GameState()->SetUnknown424(0xd);
GameState()->FUN_1003a720(0);
}
return result;
}
// FUNCTION: LEGO1 0x10001340
void Score::DeleteScript()
{
if (m_state->GetTutorialFlag()) {
MxDSAction action;
action.SetObjectId(0x1f5);
action.SetAtomId(*g_infoscorScript);
action.SetUnknown24(-2);
DeleteObject(action);
m_state->SetTutorialFlag(FALSE);
}
}
// FUNCTION: LEGO1 0x10001410
MxLong Score::Notify(MxParam& p_param)
{
MxLong ret = 0;
LegoWorld::Notify(p_param);
if (m_unk0xf6) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationStartAction:
ret = 1;
Paint();
break;
case c_notificationEndAction:
ret = FUN_10001510((MxEndActionNotificationParam&) p_param);
break;
case c_notificationKeyPress:
if (((LegoEventNotificationParam&) p_param).GetKey() == 0x20)
DeleteScript(); // Shutting down
ret = 1;
break;
case TYPE17:
ret = FUN_100016d0((MxType17NotificationParam&) p_param);
break;
case MXTRANSITIONMANAGER_TRANSITIONENDED:
DeleteObjects(g_infoscorScript, 7, 9);
if (m_unk0xf8)
GameState()->HandleAction(m_unk0xf8);
ret = 1;
break;
default:
break;
}
}
return ret;
}
// FUNCTION: LEGO1 0x10001510
MxLong Score::FUN_10001510(MxEndActionNotificationParam& p_param)
{
MxDSAction* action = p_param.GetAction();
if (m_atom == action->GetAtomId()) {
MxU32 id = action->GetObjectId();
switch (action->GetObjectId()) {
case 10:
m_unk0xf8 = 0x38;
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
break;
case 0x1f5:
PlayMusic(11);
m_state->SetTutorialFlag(FALSE);
}
}
return 1;
}
// FUNCTION: LEGO1 0x10001580
void Score::Stop()
{
LegoWorld::Stop();
MxDSAction action;
action.SetObjectId(0x1f4);
action.SetAtomId(m_atom);
action.SetUnknown84(this);
Start(&action);
if (m_state->GetTutorialFlag()) {
MxDSAction action2;
action.SetObjectId(0x1f5);
action.SetAtomId(*g_infoscorScript);
Start(&action);
}
else
PlayMusic(11);
FUN_10015820(0, 7);
}
// FUNCTION: LEGO1 0x100016d0
MxLong Score::FUN_100016d0(MxType17NotificationParam& p_param)
{
MxS16 l = p_param.GetUnknown28();
if (l == 1 || p_param.GetUnknown20() == 4) {
switch (p_param.GetUnknown20()) {
case 1:
m_unk0xf8 = 2;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
break;
case 2:
m_unk0xf8 = 3;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
break;
case 3: {
LegoInputManager* im = InputManager();
im->SetUnknown88(TRUE);
im->SetUnknown336(FALSE);
DeleteScript();
MxDSAction action;
action.SetObjectId(10);
action.SetAtomId(*g_infoscorScript);
Start(&action);
break;
}
case 4: {
switch (l) {
case 1: {
MxDSAction action;
action.SetObjectId(7);
action.SetAtomId(*g_infoscorScript);
Start(&action);
break;
}
case 2: {
MxDSAction action;
action.SetObjectId(8);
action.SetAtomId(*g_infoscorScript);
Start(&action);
break;
}
case 3: {
MxDSAction action;
action.SetObjectId(9);
action.SetAtomId(*g_infoscorScript);
Start(&action);
break;
}
}
break;
}
}
}
return 1;
}
// FUNCTION: LEGO1 0x10001980
void Score::VTable0x68(MxBool p_add)
{
LegoWorld::VTable0x68(p_add);
if (p_add) {
InputManager()->SetWorld(this);
SetIsWorldActive(FALSE);
}
else if (InputManager()->GetWorld() == this)
InputManager()->ClearWorld();
}
// FUNCTION: LEGO1 0x100019d0
void Score::Paint()
{
GifManager* gm = GetGifManager();
GifData* gd = gm->Get("bigcube.gif");
if (gd) {
RaceState* l78 = (RaceState*) GameState()->GetState("JetskiRaceState");
RaceState* l70 = (RaceState*) GameState()->GetState("CarRaceState");
TowTrackMissionState* lesi = (TowTrackMissionState*) GameState()->GetState("TowTrackMissionState");
PizzaMissionState* l74 = (PizzaMissionState*) GameState()->GetState("PizzaMissionState");
AmbulanceMissionState* lebp = (AmbulanceMissionState*) GameState()->GetState("AmbulanceMissionState");
DDSURFACEDESC desc;
memset(&desc, 0, sizeof(desc));
desc.dwSize = sizeof(desc);
if (gd->m_surface->Lock(NULL, &desc, 0, NULL) == DD_OK) {
if (desc.lPitch != desc.dwWidth) {
gd->m_surface->Unlock(desc.lpSurface);
return;
}
for (MxU8 id = 1; id <= 5; id++) {
m_surface = (MxU8*) desc.lpSurface;
MxU16 color = 0;
if (l70)
color = l70->GetColor(id);
MxU32 row = id - 1;
FillArea(0, row, color);
color = 0;
if (l78)
color = l78->GetColor(id);
FillArea(1, row, color);
color = 0;
if (l74)
color = l74->GetColor(id);
FillArea(2, row, color);
color = 0;
if (lesi)
color = lesi->GetColor(id);
FillArea(3, row, color);
color = 0;
if (lebp)
color = lebp->GetColor(id);
FillArea(4, row, color);
}
gd->m_surface->Unlock(desc.lpSurface);
gd->m_texture->Changed(TRUE, FALSE);
m_surface = NULL;
}
}
}
// FUNCTION: LEGO1 0x10001d20
void Score::FillArea(MxU32 p_x, MxU32 p_y, MxS16 p_color)
{
MxU32 data[24];
data[9] = 0x2b00;
data[10] = 0x5700;
data[11] = 0x8000;
data[19] = 0x2a;
data[12] = 0xab00;
data[13] = 0xd600;
data[20] = 0x27;
data[21] = 0x29;
data[22] = 0x29;
data[23] = 0x2a;
data[4] = 0x2f;
data[5] = 0x56;
data[6] = 0x81;
data[15] = 0x29;
data[16] = 0x27;
data[7] = 0xaa;
data[8] = 0xd4;
data[14] = 0x25;
data[0] = 0x11;
data[17] = 0x28;
data[18] = 0x28;
data[1] = 0xf;
MxU32 size = data[p_x + 14];
MxU8* ptr = data[p_x + 4] + data[p_y + 9] + m_surface;
MxS32 count = data[p_y + 19];
data[2] = 0x8;
data[3] = 0x5;
MxU32 value = data[p_color];
for (; count > 0; count--) {
memset(ptr++, value, size);
ptr += 0x100;
}
}
// FUNCTION: LEGO1 0x10001e40
MxBool Score::VTable0x64()
{
DeleteScript();
m_unk0xf8 = 2;
return TRUE;
}

View File

@@ -0,0 +1,16 @@
#include "scorestate.h"
DECOMP_SIZE_ASSERT(ScoreState, 0x0C);
// FUNCTION: LEGO1 0x1000de20
MxBool ScoreState::VTable0x14()
{
return FALSE;
}
// FUNCTION: LEGO1 0x1000de30
MxBool ScoreState::SetFlag()
{
m_playCubeTutorial = TRUE;
return TRUE;
}

View File

@@ -0,0 +1,273 @@
#include "legoinputmanager.h"
#include "legocontrolmanager.h"
#include "legoomni.h"
#include "mxautolocker.h"
DECOMP_SIZE_ASSERT(LegoInputManager, 0x338);
DECOMP_SIZE_ASSERT(LegoEventQueue, 0x18);
// FUNCTION: LEGO1 0x1005b790
LegoInputManager::LegoInputManager()
{
m_unk0x5c = NULL;
m_world = NULL;
m_camera = NULL;
m_eventQueue = NULL;
m_unk0x80 = 0;
m_timer = 0;
m_unk0x6c = 0;
m_unk0x70 = 0;
m_controlManager = NULL;
m_unk0x81 = 0;
m_unk0x88 = FALSE;
m_directInput = NULL;
m_directInputDevice = NULL;
m_unk0x94 = 0;
m_unk0x195 = 0;
m_joyid = -1;
m_joystickIndex = -1;
m_useJoystick = FALSE;
m_unk0x335 = FALSE;
m_unk0x336 = FALSE;
m_unk0x74 = 0x19;
m_timeout = 1000;
}
// STUB: LEGO1 0x1005b8b0
MxResult LegoInputManager::Tickle()
{
ProcessEvents();
return SUCCESS;
}
// FUNCTION: LEGO1 0x1005b8f0
LegoInputManager::~LegoInputManager()
{
Destroy();
}
// FUNCTION: LEGO1 0x1005b960
MxResult LegoInputManager::Create(HWND p_hwnd)
{
// TODO
if (m_eventQueue == NULL)
m_eventQueue = new LegoEventQueue();
return SUCCESS;
}
// FUNCTION: LEGO1 0x1005bfe0
void LegoInputManager::Destroy()
{
ReleaseDX();
if (m_unk0x5c)
delete m_unk0x5c;
m_unk0x5c = NULL;
if (m_eventQueue)
delete m_eventQueue;
m_eventQueue = NULL;
if (m_controlManager)
delete m_controlManager;
}
// FUNCTION: LEGO1 0x1005c030
void LegoInputManager::CreateAndAcquireKeyboard(HWND p_hwnd)
{
HINSTANCE hinstance = (HINSTANCE) GetWindowLong(p_hwnd, GWL_HINSTANCE);
HRESULT hresult = DirectInputCreate(hinstance, 0x500, &m_directInput, NULL); // 0x500 for DX5
if (hresult == DI_OK) {
HRESULT createdeviceresult = m_directInput->CreateDevice(GUID_SysKeyboard, &m_directInputDevice, NULL);
if (createdeviceresult == DI_OK) {
m_directInputDevice->SetCooperativeLevel(p_hwnd, DISCL_NONEXCLUSIVE | DISCL_FOREGROUND);
m_directInputDevice->SetDataFormat(&c_dfDIKeyboard);
m_directInputDevice->Acquire();
}
}
}
// FUNCTION: LEGO1 0x1005c0a0
void LegoInputManager::ReleaseDX()
{
if (m_directInputDevice != NULL) {
m_directInputDevice->Unacquire();
m_directInputDevice->Release();
m_directInputDevice = NULL;
}
if (m_directInput != NULL) {
m_directInput->Release();
m_directInput = NULL;
}
}
// FUNCTION: LEGO1 0x1005c240
MxResult LegoInputManager::GetJoystickId()
{
JOYINFOEX joyinfoex;
if (m_useJoystick != FALSE) {
MxS32 joyid = m_joystickIndex;
if (joyid >= 0) {
joyinfoex.dwSize = 0x34;
joyinfoex.dwFlags = 0xFF;
if (joyGetPosEx(joyid, &joyinfoex) == JOYERR_NOERROR &&
joyGetDevCaps(joyid, &m_joyCaps, 0x194) == JOYERR_NOERROR) {
m_joyid = joyid;
return SUCCESS;
}
}
for (joyid = JOYSTICKID1; joyid < 16; joyid++) {
joyinfoex.dwSize = 0x34;
joyinfoex.dwFlags = 0xFF;
if (joyGetPosEx(joyid, &joyinfoex) == JOYERR_NOERROR &&
joyGetDevCaps(joyid, &m_joyCaps, 0x194) == JOYERR_NOERROR) {
m_joyid = joyid;
return SUCCESS;
}
}
}
return FAILURE;
}
// FUNCTION: LEGO1 0x1005c320
MxResult LegoInputManager::GetJoystickState(
MxU32* p_joystickX,
MxU32* p_joystickY,
DWORD* p_buttonsState,
MxU32* p_povPosition
)
{
if (m_useJoystick != FALSE) {
if (m_joyid < 0 && GetJoystickId() == -1) {
m_useJoystick = FALSE;
return FAILURE;
}
JOYINFOEX joyinfoex;
joyinfoex.dwSize = 0x34;
joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNBUTTONS;
MxU32 capabilities = m_joyCaps.wCaps;
if ((capabilities & JOYCAPS_HASPOV) != 0) {
joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNPOV | JOY_RETURNBUTTONS;
if ((capabilities & JOYCAPS_POVCTS) != 0)
joyinfoex.dwFlags = JOY_RETURNX | JOY_RETURNY | JOY_RETURNPOV | JOY_RETURNBUTTONS | JOY_RETURNPOVCTS;
}
MMRESULT mmresult = joyGetPosEx(m_joyid, &joyinfoex);
if (mmresult == MMSYSERR_NOERROR) {
*p_buttonsState = joyinfoex.dwButtons;
MxU32 xmin = m_joyCaps.wXmin;
MxU32 ymax = m_joyCaps.wYmax;
MxU32 ymin = m_joyCaps.wYmin;
MxS32 ydiff = ymax - ymin;
*p_joystickX = ((joyinfoex.dwXpos - xmin) * 100) / (m_joyCaps.wXmax - xmin);
*p_joystickY = ((joyinfoex.dwYpos - m_joyCaps.wYmin) * 100) / ydiff;
if ((m_joyCaps.wCaps & (JOYCAPS_POV4DIR | JOYCAPS_POVCTS)) != 0) {
if (joyinfoex.dwPOV == JOY_POVCENTERED) {
*p_povPosition = (MxU32) -1;
return SUCCESS;
}
*p_povPosition = joyinfoex.dwPOV / 100;
return SUCCESS;
}
else {
*p_povPosition = (MxU32) -1;
return SUCCESS;
}
}
}
return FAILURE;
}
// STUB: LEGO1 0x1005c470
void LegoInputManager::Register(MxCore*)
{
// TODO
}
// STUB: LEGO1 0x1005c5c0
void LegoInputManager::UnRegister(MxCore*)
{
// TODO
}
// FUNCTION: LEGO1 0x1005c700
void LegoInputManager::SetCamera(LegoCameraController* p_camera)
{
m_camera = p_camera;
}
// FUNCTION: LEGO1 0x1005c710
void LegoInputManager::ClearCamera()
{
m_camera = NULL;
}
// FUNCTION: LEGO1 0x1005c720
void LegoInputManager::SetWorld(LegoWorld* p_world)
{
m_world = p_world;
}
// FUNCTION: LEGO1 0x1005c730
void LegoInputManager::ClearWorld()
{
m_world = NULL;
}
// FUNCTION: LEGO1 0x1005c740
void LegoInputManager::QueueEvent(NotificationId p_id, MxU8 p_modifier, MxLong p_x, MxLong p_y, MxU8 p_key)
{
LegoEventNotificationParam param = LegoEventNotificationParam(p_id, NULL, p_modifier, p_x, p_y, p_key);
if (((!m_unk0x88) || ((m_unk0x335 && (param.GetType() == c_notificationButtonDown)))) ||
((m_unk0x336 && (p_key == ' ')))) {
ProcessOneEvent(param);
}
}
// FUNCTION: LEGO1 0x1005c820
void LegoInputManager::ProcessEvents()
{
MxAutoLocker lock(&m_criticalSection);
LegoEventNotificationParam event;
while (m_eventQueue->Dequeue(event)) {
if (ProcessOneEvent(event))
break;
}
}
// STUB: LEGO1 0x1005c9c0
MxBool LegoInputManager::ProcessOneEvent(LegoEventNotificationParam& p_param)
{
// TODO
return FALSE;
}
// FUNCTION: LEGO1 0x1005cfb0
void LegoInputManager::SetTimer()
{
LegoOmni* omni = LegoOmni::GetInstance();
UINT timer = ::SetTimer(omni->GetWindowHandle(), 1, m_timeout, NULL);
m_timer = timer;
}
// FUNCTION: LEGO1 0x1005cfd0
void LegoInputManager::KillTimer()
{
if (m_timer != 0) {
LegoOmni* omni = LegoOmni::GetInstance();
::KillTimer(omni->GetWindowHandle(), m_timer);
}
}

View File

@@ -0,0 +1,9 @@
#include "beachhouseentity.h"
// STUB: LEGO1 0x100150a0
MxLong BeachHouseEntity::Notify(MxParam& p_param)
{
// TODO
return 0;
}

View File

@@ -0,0 +1,11 @@
#include "bike.h"
DECOMP_SIZE_ASSERT(Bike, 0x164);
// FUNCTION: LEGO1 0x10076670
Bike::Bike()
{
this->m_unk0x13c = 20.0;
this->m_unk0x150 = 3.0;
this->m_unk0x148 = 1;
}

View File

@@ -0,0 +1 @@
#include "bumpbouy.h"

View File

@@ -0,0 +1,21 @@
#include "historybook.h"
// STUB: LEGO1 0x100822f0
HistoryBook::HistoryBook()
{
// TODO
}
// STUB: LEGO1 0x100824d0
HistoryBook::~HistoryBook()
{
// TODO
}
// STUB: LEGO1 0x10082680
MxLong HistoryBook::Notify(MxParam& p_param)
{
// TODO
return 0;
}

View File

@@ -0,0 +1,252 @@
#include "isle.h"
#include "act1state.h"
#include "ambulance.h"
#include "islepathactor.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "legoutil.h"
#include "mxnotificationmanager.h"
#include "mxtransitionmanager.h"
#include "pizza.h"
#include "towtrack.h"
DECOMP_SIZE_ASSERT(Isle, 0x140);
// FUNCTION: LEGO1 0x10030820
Isle::Isle()
{
m_pizza = NULL;
m_pizzeria = NULL;
m_towtrack = NULL;
m_ambulance = NULL;
m_jukebox = NULL;
m_helicopter = NULL;
m_bike = NULL;
m_dunebuggy = NULL;
m_motorcycle = NULL;
m_skateboard = NULL;
m_racecar = NULL;
m_jetski = NULL;
m_act1state = 0;
m_unk0x13c = 0;
NotificationManager()->Register(this);
}
// FUNCTION: LEGO1 0x10030a50
Isle::~Isle()
{
TransitionManager()->SetWaitIndicator(NULL);
ControlManager()->Unregister(this);
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
if (GetCurrentVehicle() != NULL) {
VTable0x6c(GetCurrentVehicle());
}
NotificationManager()->Unregister(this);
}
// FUNCTION: LEGO1 0x10030b20
MxResult Isle::Create(MxDSObject& p_dsObject)
{
GameState()->FUN_1003ceb0();
MxResult result = LegoWorld::SetAsCurrentWorld(p_dsObject);
if (result == SUCCESS) {
ControlManager()->Register(this);
InputManager()->SetWorld(this);
GameState()->FUN_1003a720(0);
switch (GameState()->GetCurrentAct()) {
case 1:
GameState()->FUN_1003a720(0x2e);
break;
case 2:
GameState()->FUN_1003a720(0x2e);
break;
case -1:
m_unk0x13c = 2;
}
if (GameState()->GetUnknown424() == 1) {
GameState()->SetUnknown424(0);
}
LegoGameState* gameState = GameState();
Act1State* state = (Act1State*) gameState->GetState("Act1State");
if (state == NULL) {
state = (Act1State*) gameState->CreateState("Act1State");
}
m_act1state = state;
FUN_1003ef00(TRUE);
GameState()->SetDirty(TRUE);
}
return result;
}
// FUNCTION: LEGO1 0x10030c10
MxLong Isle::Notify(MxParam& p_param)
{
MxLong result = 0;
LegoWorld::Notify(p_param);
if (m_unk0xf6) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationEndAction:
result = StopAction(p_param);
break;
case c_notificationButtonUp:
case c_notificationButtonDown:
switch (m_act1state->GetUnknown18()) {
case 3:
result = m_pizza->Notify(p_param);
break;
case 10:
result = m_ambulance->Notify(p_param);
break;
}
break;
case TYPE17:
result = HandleType17Notification(p_param);
break;
case TYPE18:
switch (m_act1state->GetUnknown18()) {
case 4:
result = GetCurrentVehicle()->Notify(p_param);
break;
case 8:
result = m_towtrack->Notify(p_param);
break;
case 10:
result = m_ambulance->Notify(p_param);
break;
}
break;
case TYPE19:
result = HandleType19Notification(p_param);
break;
case TYPE20:
VTable0x68(TRUE);
break;
case MXTRANSITIONMANAGER_TRANSITIONENDED:
result = HandleTransitionEnd();
break;
}
}
return result;
}
// STUB: LEGO1 0x10030d90
MxLong Isle::StopAction(MxParam& p_param)
{
return 0;
}
// STUB: LEGO1 0x10030fc0
void Isle::Stop()
{
// TODO
}
// STUB: LGEO1 0x10031030
MxLong Isle::HandleType17Notification(MxParam& p_param)
{
return 0;
}
// STUB: LEGO1 0x100315f0
MxLong Isle::HandleType19Notification(MxParam& p_param)
{
return 0;
}
// STUB: LEGO1 0x10031820
void Isle::VTable0x68(MxBool p_add)
{
// TODO
}
// STUB: LEGO1 0x100327a0
MxLong Isle::HandleTransitionEnd()
{
return 0;
}
// FUNCTION: LEGO1 0x10032f10
void Isle::VTable0x58(MxCore* p_object)
{
LegoWorld::VTable0x58(p_object);
if (p_object->IsA("Pizza")) {
m_pizza = (Pizza*) p_object;
}
else if (p_object->IsA("Pizzeria")) {
m_pizzeria = (Pizzeria*) p_object;
}
else if (p_object->IsA("TowTrack")) {
m_towtrack = (TowTrack*) p_object;
}
else if (p_object->IsA("Ambulance")) {
m_ambulance = (Ambulance*) p_object;
}
else if (p_object->IsA("JukeBoxEntity")) {
m_jukebox = (JukeBoxEntity*) p_object;
}
else if (p_object->IsA("Helicopter")) {
m_helicopter = (Helicopter*) p_object;
}
else if (p_object->IsA("Bike")) {
m_bike = (Bike*) p_object;
}
else if (p_object->IsA("DuneBuggy")) {
m_dunebuggy = (DuneBuggy*) p_object;
}
else if (p_object->IsA("Motorcycle")) {
m_motorcycle = (Motorcycle*) p_object;
}
else if (p_object->IsA("SkateBoard")) {
m_skateboard = (SkateBoard*) p_object;
}
else if (p_object->IsA("Jetski")) {
m_jetski = (Jetski*) p_object;
}
else if (p_object->IsA("RaceCar")) {
m_racecar = (RaceCar*) p_object;
}
}
// FUNCTION: LEGO1 0x10033050
void Isle::VTable0x6c(IslePathActor* p_actor)
{
LegoWorld::EndAction(p_actor);
if (p_actor->IsA("Helicopter")) {
m_helicopter = NULL;
}
else if (p_actor->IsA("DuneBuggy")) {
m_dunebuggy = NULL;
}
else if (p_actor->IsA("Jetski")) {
m_jetski = NULL;
}
else if (p_actor->IsA("RaceCar")) {
m_racecar = NULL;
}
}
// STUB: LEGO1 0x10033180
MxBool Isle::VTable0x64()
{
// TODO
return FALSE;
}

View File

@@ -0,0 +1,4 @@
#include "isleactor.h"
// NOTE: This is copied from base class LegoActor. IsleActor may in fact be larger but we don't know yet.
DECOMP_SIZE_ASSERT(IsleActor, 0x78)

View File

@@ -0,0 +1,42 @@
#include "islepathactor.h"
DECOMP_SIZE_ASSERT(IslePathActor, 0x160)
// FUNCTION: LEGO1 0x1001a200
IslePathActor::IslePathActor()
{
this->m_world = NULL;
this->m_unk0x13c = 6.0;
this->m_unk0x15c = 1.0;
this->m_unk0x158 = 0;
}
// FUNCTION: LEGO1 0x1001a280
MxResult IslePathActor::Create(MxDSObject& p_dsObject)
{
return MxEntity::Create(p_dsObject);
}
// STUB: LEGO1 0x1001a350
void IslePathActor::VTable0xe0()
{
// TODO
}
// STUB: LEGO1 0x1001a3f0
void IslePathActor::VTable0xe4()
{
// TODO
}
// STUB: LEGO1 0x1001b2a0
void IslePathActor::VTable0xe8(MxU32, MxBool, MxU8)
{
// TODO
}
// STUB: LEGO1 0x1001b5b0
void IslePathActor::VTable0xec()
{
// TODO
}

View File

@@ -0,0 +1,14 @@
#include "jukebox.h"
#include "mxnotificationmanager.h"
#include "mxomni.h"
DECOMP_SIZE_ASSERT(JukeBox, 0x104)
// FUNCTION: LEGO1 0x1005d660
JukeBox::JukeBox()
{
m_unk0x100 = 0;
m_unk0xfc = 0;
NotificationManager()->Register(this);
}

View File

@@ -0,0 +1,13 @@
#include "jukeboxentity.h"
// STUB: LEGO1 0x10085bc0
JukeBoxEntity::JukeBoxEntity()
{
// TODO
}
// STUB: LEGO1 0x10085dd0
JukeBoxEntity::~JukeBoxEntity()
{
// TODO
}

View File

@@ -0,0 +1,7 @@
#include "jukeboxstate.h"
// FUNCTION: LEGO1 0x1000f300
MxBool JukeBoxState::VTable0x14()
{
return FALSE;
}

View File

@@ -0,0 +1,12 @@
#include "motorcycle.h"
DECOMP_SIZE_ASSERT(Motorcycle, 0x16c);
// FUNCTION: LEGO1 0x100357b0
Motorcycle::Motorcycle()
{
this->m_unk0x13c = 40.0;
this->m_unk0x150 = 1.75;
this->m_unk0x148 = 1;
this->m_unk0x164 = 1.0;
}

View File

@@ -0,0 +1,36 @@
#include "radio.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoomni.h"
#include "mxnotificationmanager.h"
DECOMP_SIZE_ASSERT(Radio, 0x10);
// FUNCTION: LEGO1 0x1002c850
Radio::Radio()
{
NotificationManager()->Register(this);
ControlManager()->Register(this);
m_unk0xc = TRUE;
CreateRadioState();
}
// STUB: LEGO1 0x1002c990
Radio::~Radio()
{
// TODO
}
// FUNCTION: LEGO1 0x1002cde0
void Radio::CreateRadioState()
{
LegoGameState* gameState = GameState();
RadioState* state = (RadioState*) gameState->GetState("RadioState");
if (state == NULL) {
state = (RadioState*) gameState->CreateState("RadioState");
}
m_state = state;
}

View File

@@ -0,0 +1,7 @@
#include "radiostate.h"
// STUB: LEGO1 0x1002ce10
RadioState::RadioState()
{
// TODO
}

View File

@@ -0,0 +1,18 @@
#include "skateboard.h"
#include "decomp.h"
#include "mxnotificationmanager.h"
#include "mxomni.h"
DECOMP_SIZE_ASSERT(SkateBoard, 0x168);
// FUNCTION: LEGO1 0x1000fd40
SkateBoard::SkateBoard()
{
this->m_unk0x160 = 0;
this->m_unk0x13c = 15.0;
this->m_unk0x150 = 3.5;
this->m_unk0x148 = 1;
NotificationManager()->Register(this);
}

View File

@@ -0,0 +1,837 @@
#include "legoomni.h"
#include "gifmanager.h"
#include "legoanimationmanager.h"
#include "legobuildingmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoobjectfactory.h"
#include "legoplantmanager.h"
#include "legosoundmanager.h"
#include "legounksavedatawriter.h"
#include "legoutil.h"
#include "legovideomanager.h"
#include "legoworld.h"
#include "legoworldlist.h"
#include "mxactionnotificationparam.h"
#include "mxautolocker.h"
#include "mxbackgroundaudiomanager.h"
#include "mxdsfile.h"
#include "mxomnicreateflags.h"
#include "mxomnicreateparam.h"
#include "mxticklemanager.h"
#include "mxtransitionmanager.h"
DECOMP_SIZE_ASSERT(LegoWorldList, 0x18);
// GLOBAL: LEGO1 0x100f451c
MxAtomId* g_copterScript = NULL;
// GLOBAL: LEGO1 0x100f4520
MxAtomId* g_dunecarScript = NULL;
// GLOBAL: LEGO1 0x100f4524
MxAtomId* g_jetskiScript = NULL;
// GLOBAL: LEGO1 0x100f4528
MxAtomId* g_racecarScript = NULL;
// GLOBAL: LEGO1 0x100f452c
MxAtomId* g_carraceScript = NULL;
// GLOBAL: LEGO1 0x100f4530
MxAtomId* g_carracerScript = NULL;
// GLOBAL: LEGO1 0x100f4534
MxAtomId* g_jetraceScript = NULL;
// GLOBAL: LEGO1 0x100f4538
MxAtomId* g_jetracerScript = NULL;
// GLOBAL: LEGO1 0x100f453c
MxAtomId* g_isleScript = NULL;
// GLOBAL: LEGO1 0x100f4540
MxAtomId* g_elevbottScript = NULL;
// GLOBAL: LEGO1 0x100f4544
MxAtomId* g_infodoorScript = NULL;
// GLOBAL: LEGO1 0x100f4548
MxAtomId* g_infomainScript = NULL;
// GLOBAL: LEGO1 0x100f454c
MxAtomId* g_infoscorScript = NULL;
// GLOBAL: LEGO1 0x100f4550
MxAtomId* g_regbookScript = NULL;
// GLOBAL: LEGO1 0x100f4554
MxAtomId* g_histbookScript = NULL;
// GLOBAL: LEGO1 0x100f4558
MxAtomId* g_hospitalScript = NULL;
// GLOBAL: LEGO1 0x100f455c
MxAtomId* g_policeScript = NULL;
// GLOBAL: LEGO1 0x100f4560
MxAtomId* g_garageScript = NULL;
// GLOBAL: LEGO1 0x100f4564
MxAtomId* g_act2mainScript = NULL;
// GLOBAL: LEGO1 0x100f4568
MxAtomId* g_act3Script = NULL;
// GLOBAL: LEGO1 0x100f456c
MxAtomId* g_jukeboxScript = NULL;
// GLOBAL: LEGO1 0x100f4570
MxAtomId* g_pz5Script = NULL;
// GLOBAL: LEGO1 0x100f4574
MxAtomId* g_introScript = NULL;
// GLOBAL: LEGO1 0x100f4578
MxAtomId* g_testScript = NULL;
// GLOBAL: LEGO1 0x100f457c
MxAtomId* g_jukeboxwScript = NULL;
// GLOBAL: LEGO1 0x100f4580c
MxAtomId* g_sndAnimScript = NULL;
// GLOBAL: LEGO1 0x100f4584
MxAtomId* g_creditsScript = NULL;
// GLOBAL: LEGO1 0x100f4588
MxAtomId* g_nocdSourceName = NULL;
// GLOBAL: LEGO1 0x100f6718
const char* g_current = "current";
// GLOBAL: LEGO1 0x101020e8
void (*g_omniUserMessage)(const char*, int);
// GLOBAL: LEGO1 0x100f4c58
MxBool g_isWorldActive = TRUE;
// FUNCTION: LEGO1 0x10015700
LegoOmni* Lego()
{
return (LegoOmni*) MxOmni::GetInstance();
}
// FUNCTION: LEGO1 0x10015710
LegoSoundManager* SoundManager()
{
return LegoOmni::GetInstance()->GetSoundManager();
}
// FUNCTION: LEGO1 0x10015720
LegoVideoManager* VideoManager()
{
return LegoOmni::GetInstance()->GetVideoManager();
}
// FUNCTION: LEGO1 0x10015730
MxBackgroundAudioManager* BackgroundAudioManager()
{
return LegoOmni::GetInstance()->GetBackgroundAudioManager();
}
// FUNCTION: LEGO1 0x10015740
LegoInputManager* InputManager()
{
return LegoOmni::GetInstance()->GetInputManager();
}
// FUNCTION: LEGO1 0x10015750
LegoControlManager* ControlManager()
{
return LegoOmni::GetInstance()->GetInputManager()->GetControlManager();
}
// FUNCTION: LEGO1 0x10015760
LegoGameState* GameState()
{
return LegoOmni::GetInstance()->GetGameState();
}
// FUNCTION: LEGO1 0x10015770
LegoAnimationManager* AnimationManager()
{
return LegoOmni::GetInstance()->GetAnimationManager();
}
// FUNCTION: LEGO1 0x10015780
LegoNavController* NavController()
{
return LegoOmni::GetInstance()->GetNavController();
}
// FUNCTION: LEGO1 0x10015790
IslePathActor* GetCurrentVehicle()
{
return LegoOmni::GetInstance()->GetCurrentVehicle();
}
// FUNCTION: LEGO1 0x100157a0
LegoWorld* GetCurrentWorld()
{
return LegoOmni::GetInstance()->GetCurrentOmniWorld();
}
// FUNCTION: LEGO1 0x100157e0
LegoPlantManager* PlantManager()
{
return LegoOmni::GetInstance()->GetLegoPlantManager();
}
// FUNCTION: LEGO1 0x100157f0
LegoBuildingManager* BuildingManager()
{
return LegoOmni::GetInstance()->GetLegoBuildingManager();
}
// FUNCTION: LEGO1 0x10015800
GifManager* GetGifManager()
{
return LegoOmni::GetInstance()->GetGifManager();
}
// STUB: LEGO1 0x10015820
void FUN_10015820(MxU32, MxU32)
{
// TODO
}
// FUNCTION: LEGO1 0x100158c0
LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid)
{
return LegoOmni::GetInstance()->FindByEntityIdOrAtomId(p_atom, p_entityid);
}
// FUNCTION: LEGO1 0x100158e0
MxDSAction& GetCurrentAction()
{
return LegoOmni::GetInstance()->GetCurrentAction();
}
// FUNCTION: LEGO1 0x10015900
MxTransitionManager* TransitionManager()
{
return LegoOmni::GetInstance()->GetTransitionManager();
}
// FUNCTION: LEGO1 0x10015910
void PlayMusic(MxU32 p_index)
{
// index is the entityid of the music in jukebox.si
MxDSAction action;
action.SetAtomId(*g_jukeboxScript);
action.SetObjectId(p_index);
LegoOmni::GetInstance()->GetBackgroundAudioManager()->PlayMusic(action, 5, 4);
}
// FUNCTION: LEGO1 0x100159c0
void SetIsWorldActive(MxBool p_isWorldActive)
{
if (!p_isWorldActive)
LegoOmni::GetInstance()->GetInputManager()->SetCamera(NULL);
g_isWorldActive = p_isWorldActive;
}
// STUB: LEGO1 0x1001a700
void FUN_1001a700()
{
// TODO
// This function seems to populate an unknown structure, and then calls 0x1001b230
}
// FUNCTION: LEGO1 0x1003dd70
LegoROI* PickROI(MxLong p_a, MxLong p_b)
{
return (LegoROI*) VideoManager()->Get3DManager()->GetLego3DView()->Pick(p_a, p_b);
}
// STUB: LEGO1 0x1003ddc0
LegoEntity* PickEntity(MxLong, MxLong)
{
// TODO
return NULL;
}
// FUNCTION: LEGO1 0x100528e0
void RegisterScripts()
{
g_copterScript = new MxAtomId("\\lego\\scripts\\build\\copter", LookupMode_LowerCase2);
g_dunecarScript = new MxAtomId("\\lego\\scripts\\build\\dunecar", LookupMode_LowerCase2);
g_jetskiScript = new MxAtomId("\\lego\\scripts\\build\\jetski", LookupMode_LowerCase2);
g_racecarScript = new MxAtomId("\\lego\\scripts\\build\\racecar", LookupMode_LowerCase2);
g_carraceScript = new MxAtomId("\\lego\\scripts\\race\\carrace", LookupMode_LowerCase2);
g_carracerScript = new MxAtomId("\\lego\\scripts\\race\\carracer", LookupMode_LowerCase2);
g_jetraceScript = new MxAtomId("\\lego\\scripts\\race\\jetrace", LookupMode_LowerCase2);
g_jetracerScript = new MxAtomId("\\lego\\scripts\\race\\jetracer", LookupMode_LowerCase2);
g_isleScript = new MxAtomId("\\lego\\scripts\\isle\\isle", LookupMode_LowerCase2);
g_elevbottScript = new MxAtomId("\\lego\\scripts\\infocntr\\elevbott", LookupMode_LowerCase2);
g_infodoorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infodoor", LookupMode_LowerCase2);
g_infomainScript = new MxAtomId("\\lego\\scripts\\infocntr\\infomain", LookupMode_LowerCase2);
g_infoscorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infoscor", LookupMode_LowerCase2);
g_regbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\regbook", LookupMode_LowerCase2);
g_histbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\histbook", LookupMode_LowerCase2);
g_hospitalScript = new MxAtomId("\\lego\\scripts\\hospital\\hospital", LookupMode_LowerCase2);
g_policeScript = new MxAtomId("\\lego\\scripts\\police\\police", LookupMode_LowerCase2);
g_garageScript = new MxAtomId("\\lego\\scripts\\garage\\garage", LookupMode_LowerCase2);
g_act2mainScript = new MxAtomId("\\lego\\scripts\\act2\\act2main", LookupMode_LowerCase2);
g_act3Script = new MxAtomId("\\lego\\scripts\\act3\\act3", LookupMode_LowerCase2);
g_jukeboxScript = new MxAtomId("\\lego\\scripts\\isle\\jukebox", LookupMode_LowerCase2);
g_pz5Script = new MxAtomId("\\lego\\scripts\\isle\\pz5", LookupMode_LowerCase2);
g_introScript = new MxAtomId("\\lego\\scripts\\intro", LookupMode_LowerCase2);
g_testScript = new MxAtomId("\\lego\\scripts\\test\\test", LookupMode_LowerCase2);
g_jukeboxwScript = new MxAtomId("\\lego\\scripts\\isle\\jukeboxw", LookupMode_LowerCase2);
g_sndAnimScript = new MxAtomId("\\lego\\scripts\\sndanim", LookupMode_LowerCase2);
g_creditsScript = new MxAtomId("\\lego\\scripts\\credits", LookupMode_LowerCase2);
g_nocdSourceName = new MxAtomId("\\lego\\scripts\\nocd", LookupMode_LowerCase2);
}
// FUNCTION: LEGO1 0x100530c0
void UnregisterScripts()
{
delete g_copterScript;
delete g_dunecarScript;
delete g_jetskiScript;
delete g_racecarScript;
delete g_carraceScript;
delete g_carracerScript;
delete g_jetraceScript;
delete g_jetracerScript;
delete g_isleScript;
delete g_elevbottScript;
delete g_infodoorScript;
delete g_infomainScript;
delete g_infoscorScript;
delete g_regbookScript;
delete g_histbookScript;
delete g_hospitalScript;
delete g_policeScript;
delete g_garageScript;
delete g_act2mainScript;
delete g_act3Script;
delete g_jukeboxScript;
delete g_pz5Script;
delete g_introScript;
delete g_testScript;
delete g_jukeboxwScript;
delete g_sndAnimScript;
delete g_creditsScript;
delete g_nocdSourceName;
g_copterScript = NULL;
g_dunecarScript = NULL;
g_jetskiScript = NULL;
g_racecarScript = NULL;
g_carraceScript = NULL;
g_carracerScript = NULL;
g_jetraceScript = NULL;
g_jetracerScript = NULL;
g_isleScript = NULL;
g_elevbottScript = NULL;
g_infodoorScript = NULL;
g_infomainScript = NULL;
g_infoscorScript = NULL;
g_regbookScript = NULL;
g_histbookScript = NULL;
g_hospitalScript = NULL;
g_policeScript = NULL;
g_garageScript = NULL;
g_act2mainScript = NULL;
g_act3Script = NULL;
g_jukeboxScript = NULL;
g_pz5Script = NULL;
g_introScript = NULL;
g_testScript = NULL;
g_testScript = NULL;
g_jukeboxwScript = NULL;
g_sndAnimScript = NULL;
g_creditsScript = NULL;
g_nocdSourceName = NULL;
}
// FUNCTION: LEGO1 0x10053430
const char* GetNoCD_SourceName()
{
return g_nocdSourceName->GetInternal();
}
// FUNCTION: LEGO1 0x10058a00
LegoOmni::LegoOmni()
{
Init();
}
// FUNCTION: LEGO1 0x10058b50
LegoOmni::~LegoOmni()
{
Destroy();
}
// FUNCTION: LEGO1 0x10058bd0
void LegoOmni::Init()
{
MxOmni::Init();
m_unk0x68 = 0;
m_inputMgr = NULL;
m_viewLODListManager = NULL;
m_gifManager = NULL;
m_worldList = NULL;
m_currentWorld = NULL;
m_exit = FALSE;
m_currentVehicle = NULL;
m_saveDataWriter = NULL;
m_plantManager = NULL;
m_gameState = NULL;
m_animationManager = NULL;
m_buildingManager = NULL;
m_bkgAudioManager = NULL;
m_unk0x13c = TRUE;
m_transitionManager = NULL;
}
// FUNCTION: LEGO1 0x10058c30
void LegoOmni::Destroy()
{
MxAutoLocker lock(&this->m_criticalsection);
m_notificationManager->Unregister(this);
if (m_worldList) {
delete m_worldList;
m_worldList = NULL;
}
if (m_gameState) {
delete m_gameState;
m_gameState = NULL;
}
if (m_animationManager) {
delete m_animationManager;
m_animationManager = NULL;
}
if (m_saveDataWriter) {
delete m_saveDataWriter;
m_saveDataWriter = NULL;
}
if (m_plantManager) {
delete m_plantManager;
m_plantManager = NULL;
}
if (m_buildingManager) {
delete m_buildingManager;
m_buildingManager = NULL;
}
if (m_gifManager) {
delete m_gifManager;
m_gifManager = NULL;
}
if (m_viewLODListManager) {
delete m_viewLODListManager;
m_viewLODListManager = NULL;
}
if (m_inputMgr) {
delete m_inputMgr;
m_inputMgr = NULL;
}
if (m_inputMgr) {
delete m_inputMgr;
m_inputMgr = NULL;
}
// todo FUN_10046de0
if (m_bkgAudioManager) {
m_bkgAudioManager->Stop();
delete m_bkgAudioManager;
m_bkgAudioManager = NULL;
}
if (m_transitionManager) {
delete m_transitionManager;
m_transitionManager = NULL;
}
m_action.ClearAtom();
UnregisterScripts();
delete[] m_unk0x68;
MxOmni::Destroy();
}
// FUNCTION: LEGO1 0x10058e70
MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
{
MxResult result = FAILURE;
MxAutoLocker lock(&this->m_criticalsection);
p_param.CreateFlags().CreateObjectFactory(FALSE);
p_param.CreateFlags().CreateVideoManager(FALSE);
p_param.CreateFlags().CreateSoundManager(FALSE);
p_param.CreateFlags().CreateTickleManager(FALSE);
if (!(m_tickleManager = new MxTickleManager()))
return FAILURE;
if (MxOmni::Create(p_param) != SUCCESS)
return FAILURE;
m_objectFactory = new LegoObjectFactory();
if (m_objectFactory == NULL)
return FAILURE;
if (m_soundManager = new LegoSoundManager()) {
if (m_soundManager->Create(10, 0) != SUCCESS) {
delete m_soundManager;
m_soundManager = NULL;
return FAILURE;
}
}
if (m_videoManager = new LegoVideoManager()) {
if (m_videoManager->Create(p_param.GetVideoParam(), 100, 0) != SUCCESS) {
delete m_videoManager;
m_videoManager = NULL;
}
}
if (m_inputMgr = new LegoInputManager()) {
if (m_inputMgr->Create(p_param.GetWindowHandle()) != SUCCESS) {
delete m_inputMgr;
m_inputMgr = NULL;
}
}
m_viewLODListManager = new ViewLODListManager();
m_gifManager = new GifManager();
// TODO: there is another class here
m_plantManager = new LegoPlantManager();
m_animationManager = new LegoAnimationManager();
m_buildingManager = new LegoBuildingManager();
m_gameState = new LegoGameState();
m_worldList = new LegoWorldList(TRUE);
if (m_viewLODListManager && m_gifManager && m_worldList && m_plantManager && m_animationManager &&
m_buildingManager) {
// TODO: initialize a bunch of MxVariables
RegisterScripts();
FUN_1001a700();
// todo: another function call. in legoomni maybe?
m_bkgAudioManager = new MxBackgroundAudioManager();
if (m_bkgAudioManager != NULL) {
m_transitionManager = new MxTransitionManager();
if (m_transitionManager != NULL) {
if (m_transitionManager->GetDDrawSurfaceFromVideoManager() == SUCCESS) {
m_notificationManager->Register(this);
SetAppCursor(1);
m_gameState->SetSomeEnumState(0);
return SUCCESS;
}
}
}
}
return FAILURE;
}
// FUNCTION: LEGO1 0x1005ac90
void LegoOmni::CreateInstance()
{
MxOmni::DestroyInstance();
MxOmni::SetInstance(new LegoOmni());
}
// FUNCTION: LEGO1 0x1005ad10
LegoOmni* LegoOmni::GetInstance()
{
return (LegoOmni*) MxOmni::GetInstance();
}
// FUNCTION: LEGO1 0x1005ad20
void LegoOmni::AddWorld(LegoWorld* p_world)
{
m_worldList->Append(p_world);
}
// STUB: LEGO1 0x1005af10
void LegoOmni::RemoveWorld(const MxAtomId&, MxLong)
{
// TODO
}
// STUB: LEGO1 0x1005b0c0
LegoEntity* LegoOmni::FindByEntityIdOrAtomId(const MxAtomId& p_atom, MxS32 p_entityid)
{
// TODO
return NULL;
}
// STUB: LEGO1 0x1005b1d0
void LegoOmni::DeleteObject(MxDSAction& p_dsAction)
{
// TODO
}
// FUNCTION: LEGO1 0x1005b2f0
MxEntity* LegoOmni::FindWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter)
{
LegoWorld* foundEntity = NULL;
if (strcmpi(p_id, g_current)) {
foundEntity = (LegoWorld*) FindByEntityIdOrAtomId(MxAtomId(p_id, LookupMode_LowerCase2), p_entityId);
}
else {
foundEntity = this->m_currentWorld;
}
if (foundEntity != NULL) {
foundEntity->VTable0x58(p_presenter);
}
return foundEntity;
}
// FUNCTION: LEGO1 0x1005b3a0
void LegoOmni::NotifyCurrentEntity(MxNotificationParam* p_param)
{
if (m_currentWorld)
NotificationManager()->Send(m_currentWorld, p_param);
}
// FUNCTION: LEGO1 0x1005b3c0
MxBool LegoOmni::DoesEntityExist(MxDSAction& p_dsAction)
{
if (MxOmni::DoesEntityExist(p_dsAction)) {
if (FindByEntityIdOrAtomId(p_dsAction.GetAtomId(), p_dsAction.GetObjectId()) == NULL) {
return TRUE;
}
}
return FALSE;
}
// FUNCTION: LEGO1 0x1005b400
MxS32 LegoOmni::GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value)
{
if (GetCurrentWorld() == NULL) {
return -1;
}
return GetCurrentWorld()->GetCurrPathInfo(p_path, p_value);
}
// FUNCTION: LEGO1 0x1005b560
void LegoOmni::CreateBackgroundAudio()
{
if (m_bkgAudioManager)
m_bkgAudioManager->Create(*g_jukeboxScript, 100);
}
// FUNCTION: LEGO1 0x1005b580
MxResult LegoOmni::Start(MxDSAction* p_dsAction)
{
MxResult result = MxOmni::Start(p_dsAction);
this->m_action.SetAtomId(p_dsAction->GetAtomId());
this->m_action.SetObjectId(p_dsAction->GetObjectId());
this->m_action.SetUnknown24(p_dsAction->GetUnknown24());
return result;
}
// FUNCTION: LEGO1 0x1005b5f0
MxLong LegoOmni::Notify(MxParam& p_param)
{
MxBool isCD = FALSE;
if (((MxNotificationParam&) p_param).GetType() == c_notificationEndAction &&
((MxActionNotificationParam&) p_param).GetAction()->GetAtomId() == *g_nocdSourceName) {
isCD = TRUE;
}
MxLong result = MxOmni::Notify(p_param);
if (isCD) {
// Exit the game if nocd.si ended
PostMessageA(m_windowHandle, WM_CLOSE, 0, 0);
}
return result;
}
// FUNCTION: LEGO1 0x1005b640
void LegoOmni::StartTimer()
{
MxOmni::StartTimer();
SetAppCursor(2);
}
// FUNCTION: LEGO1 0x1005b650
void LegoOmni::StopTimer()
{
MxOmni::StopTimer();
SetAppCursor(0);
}
// FUNCTION: LEGO1 0x100acf50
MxResult Start(MxDSAction* p_dsAction)
{
return MxOmni::GetInstance()->Start(p_dsAction);
}
// Probably should be somewhere else
// FUNCTION: LEGO1 0x100b6e10
MxBool FUN_100b6e10(
MxS32 p_bitmapWidth,
MxS32 p_bitmapHeight,
MxS32 p_videoParamWidth,
MxS32 p_videoParamHeight,
MxS32* p_left,
MxS32* p_top,
MxS32* p_right,
MxS32* p_bottom,
MxS32* p_width,
MxS32* p_height
)
{
MxPoint32 topLeft(*p_left, *p_top);
MxRect32 bitmapRect(MxPoint32(0, 0), MxSize32(p_bitmapWidth, p_bitmapHeight));
MxPoint32 bottomRight(*p_right, *p_bottom);
MxRect32 videoParamRect(MxPoint32(0, 0), MxSize32(p_videoParamWidth, p_videoParamHeight));
MxRect32 rect(0, 0, *p_width, *p_height);
rect.AddPoint(topLeft);
if (!rect.IntersectsWith(bitmapRect))
return FALSE;
rect.Intersect(bitmapRect);
rect.SubtractPoint(topLeft);
rect.AddPoint(bottomRight);
if (!rect.IntersectsWith(videoParamRect))
return FALSE;
rect.Intersect(videoParamRect);
rect.SubtractPoint(bottomRight);
*p_left += rect.GetLeft();
*p_top += rect.GetTop();
*p_right += rect.GetLeft();
*p_bottom += rect.GetTop();
*p_width = rect.GetWidth();
*p_height = rect.GetHeight();
return TRUE;
}
// FUNCTION: LEGO1 0x100b6ff0
void MakeSourceName(char* p_output, const char* p_input)
{
const char* cln = strchr(p_input, ':');
if (cln) {
p_input = cln + 1;
}
strcpy(p_output, p_input);
strlwr(p_output);
char* extLoc = strstr(p_output, ".si");
if (extLoc) {
*extLoc = 0;
}
}
// FUNCTION: LEGO1 0x100b7050
MxBool KeyValueStringParse(char* p_outputValue, const char* p_key, const char* p_source)
{
MxBool didMatch = FALSE;
MxS16 len = strlen(p_source);
char* temp = new char[len + 1];
strcpy(temp, p_source);
char* token = strtok(temp, ", \t\r\n:");
while (token) {
len -= (strlen(token) + 1);
if (strcmpi(token, p_key) == 0) {
if (p_outputValue && len > 0) {
char* cur = &token[strlen(p_key)];
cur++;
while (*cur != ',') {
if (*cur == ' ' || *cur == '\0' || *cur == '\t' || *cur == '\n' || *cur == '\r')
break;
*p_outputValue++ = *cur++;
}
*p_outputValue = '\0';
}
didMatch = TRUE;
break;
}
token = strtok(NULL, ", \t\r\n:");
}
delete[] temp;
return didMatch;
}
// FUNCTION: LEGO1 0x100b7210
void SetOmniUserMessage(void (*p_userMsg)(const char*, int))
{
g_omniUserMessage = p_userMsg;
}
// FUNCTION: LEGO1 0x100c0280
MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs)
{
MxU8* buf;
_MMCKINFO tmpChunk;
if (p_file->Seek(((MxLong*) p_file->GetBuffer())[p_ofs], 0)) {
return NULL;
}
if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'S', 't')) {
if (p_file->Read((MxU8*) &tmpChunk.ckid, 8) == 0 && tmpChunk.ckid == FOURCC('M', 'x', 'O', 'b')) {
buf = new MxU8[tmpChunk.cksize];
if (!buf) {
return NULL;
}
if (p_file->Read(buf, tmpChunk.cksize) != 0) {
return NULL;
}
// Save a copy so we can clean up properly, because
// this function will alter the pointer value.
MxU8* copy = buf;
MxDSObject* obj = DeserializeDSObjectDispatch(&buf, -1);
delete[] copy;
return obj;
}
return NULL;
}
return NULL;
}

View File

@@ -0,0 +1,5 @@
#include "legoeventnotificationparam.h"
#include "decomp.h"
DECOMP_SIZE_ASSERT(LegoEventNotificationParam, 0x20);

View File

@@ -0,0 +1,20 @@
#include "legopathcontroller.h"
// STUB: LEGO1 0x10044f40
LegoPathController::LegoPathController()
{
// TODO
}
// STUB: LEGO1 0x10045740
LegoPathController::~LegoPathController()
{
// TODO
}
// STUB: LEGO1 0x10045c10
MxResult LegoPathController::Tickle()
{
// TODO
return SUCCESS;
}

View File

@@ -0,0 +1,67 @@
#include "legopathpresenter.h"
#include "legoomni.h"
#include "legovideomanager.h"
#include "mxautolocker.h"
DECOMP_SIZE_ASSERT(LegoPathPresenter, 0x54);
// FUNCTION: LEGO1 0x100448d0
LegoPathPresenter::LegoPathPresenter()
{
Init();
}
// FUNCTION: LEGO1 0x10044ab0
void LegoPathPresenter::Init()
{
}
// FUNCTION: LEGO1 0x10044b40
MxResult LegoPathPresenter::AddToManager()
{
MxResult status = FAILURE;
if (VideoManager()) {
VideoManager()->AddPresenter(*this);
status = SUCCESS;
}
return status;
}
// FUNCTION: LEGO1 0x10044b70
void LegoPathPresenter::Destroy(MxBool p_fromDestructor)
{
if (VideoManager())
VideoManager()->RemovePresenter(*this);
{
MxAutoLocker lock(&this->m_criticalSection);
Init();
}
if (!p_fromDestructor)
MxMediaPresenter::Destroy(FALSE);
}
// FUNCTION: LEGO1 0x10044c10
void LegoPathPresenter::Destroy()
{
Destroy(FALSE);
}
// FUNCTION: LEGO1 0x10044d40
void LegoPathPresenter::RepeatingTickle()
{
if (this->m_action->GetDuration() == -1)
return;
EndAction();
}
// STUB: LEGO1 0x10044d60
void LegoPathPresenter::ParseExtra()
{
// TODO
}

View File

@@ -0,0 +1,28 @@
#include "pizza.h"
DECOMP_SIZE_ASSERT(Pizza, 0x9c);
// FUNCTION: LEGO1 0x10037ef0
Pizza::Pizza()
{
this->m_unk0x7c = 0;
this->m_unk0x80 = 0;
this->m_unk0x84 = 0;
this->m_unk0x88 = 0;
this->m_unk0x8c = -1;
this->m_unk0x98 = 0;
this->m_unk0x90 = 0x80000000;
}
// FUNCTION: LEGO1 0x10038100
Pizza::~Pizza()
{
TickleManager()->UnregisterClient(this);
}
// STUB: LEGO1 0x100388a0
MxResult Pizza::Tickle()
{
// TODO
return SUCCESS;
}

View File

@@ -0,0 +1,13 @@
#include "pizzamissionstate.h"
DECOMP_SIZE_ASSERT(PizzaMissionStateEntry, 0x20)
DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb0)
// FUNCTION: LEGO1 0x10039510
PizzaMissionStateEntry* PizzaMissionState::GetState(MxU8 p_id)
{
for (MxS16 i = 0; i < 5; i++)
if (m_state[i].m_id == p_id)
return m_state + i;
return NULL;
}

View File

@@ -0,0 +1 @@
#include "pizzeria.h"

View File

@@ -0,0 +1,7 @@
#include "pizzeriastate.h"
// STUB: LEGO1 0x10017af0
PizzeriaState::PizzeriaState()
{
// TODO
}

View File

@@ -0,0 +1,21 @@
#include "police.h"
// STUB: LEGO1 0x1005e130
Police::Police()
{
// TODO
}
// STUB: LEGO1 0x1005e320
Police::~Police()
{
// TODO
}
// STUB: LEGO1 0x1005e480
MxLong Police::Notify(MxParam& p_param)
{
// TODO
return 0;
}

View File

@@ -0,0 +1 @@
#include "policeentity.h"

View File

@@ -0,0 +1,7 @@
#include "policestate.h"
// STUB: LEGO1 0x1005e7c0
PoliceState::PoliceState()
{
// TODO
}

View File

@@ -0,0 +1,10 @@
#include "carrace.h"
DECOMP_SIZE_ASSERT(CarRace, 0x154);
// FUNCTION: LEGO1 0x10016a90
CarRace::CarRace()
{
this->m_unk0x150 = 0;
this->m_unk0x130 = MxRect32(0x16c, 0x154, 0x1ec, 0x15e);
}

View File

@@ -0,0 +1 @@
#include "jetskirace.h"

View File

@@ -0,0 +1 @@
#include "racestandsentity.h"

View File

@@ -0,0 +1,23 @@
#include "racestate.h"
DECOMP_SIZE_ASSERT(RaceStateEntry, 0x06)
// TODO: Must be 0x2c but current structure is incorrect
// DECOMP_SIZE_ASSERT(RaceState, 0x2c)
// STUB: LEGO1 0x10015f30
RaceState::RaceState()
{
// TODO
}
// FUNCTION: LEGO1 0x10016280
RaceStateEntry* RaceState::GetState(MxU8 p_id)
{
for (MxS16 i = 0;; i++) {
if (i >= 5)
return NULL;
if (m_state[i].m_id == p_id)
return m_state + i;
}
}

View File

@@ -0,0 +1,17 @@
#include "towtrack.h"
DECOMP_SIZE_ASSERT(TowTrack, 0x180);
// FUNCTION: LEGO1 0x1004c720
TowTrack::TowTrack()
{
this->m_unk0x168 = 0;
this->m_unk0x16a = -1;
this->m_unk0x164 = 0;
this->m_unk0x16c = 0;
this->m_unk0x170 = -1;
this->m_unk0x16e = 0;
this->m_unk0x174 = -1;
this->m_unk0x13c = 40.0;
this->m_unk0x178 = 1.0;
}

View File

@@ -0,0 +1,56 @@
#include "towtrackmissionstate.h"
DECOMP_SIZE_ASSERT(TowTrackMissionState, 0x28)
// FUNCTION: LEGO1 0x1004dd30
TowTrackMissionState::TowTrackMissionState()
{
m_unk0x12 = 0;
m_unk0x14 = 0;
m_unk0x16 = 0;
m_unk0x08 = 0;
m_unk0x18 = 0;
m_unk0x0c = 0;
m_unk0x1a = 0;
m_unk0x10 = 0;
m_unk0x1c = 0;
m_color1 = 0;
m_color2 = 0;
m_color3 = 0;
m_color4 = 0;
}
// FUNCTION: LEGO1 0x1004dde0
MxResult TowTrackMissionState::VTable0x1c(LegoFileStream* p_legoFileStream)
{
if (p_legoFileStream->IsWriteMode()) {
p_legoFileStream->FUN_10006030(this->ClassName());
}
if (p_legoFileStream->IsReadMode()) {
p_legoFileStream->Write(&m_unk0x12, sizeof(MxU16));
p_legoFileStream->Write(&m_unk0x14, sizeof(MxU16));
p_legoFileStream->Write(&m_unk0x16, sizeof(MxU16));
p_legoFileStream->Write(&m_unk0x18, sizeof(MxU16));
p_legoFileStream->Write(&m_unk0x1a, sizeof(MxU16));
p_legoFileStream->Write(&m_unk0x1c, sizeof(MxU16));
p_legoFileStream->Write(&m_color1, sizeof(MxU16));
p_legoFileStream->Write(&m_color2, sizeof(MxU16));
p_legoFileStream->Write(&m_color3, sizeof(MxU16));
p_legoFileStream->Write(&m_color4, sizeof(MxU16));
}
else if (p_legoFileStream->IsWriteMode()) {
p_legoFileStream->Read(&m_unk0x12, sizeof(MxU16));
p_legoFileStream->Read(&m_unk0x14, sizeof(MxU16));
p_legoFileStream->Read(&m_unk0x16, sizeof(MxU16));
p_legoFileStream->Read(&m_unk0x18, sizeof(MxU16));
p_legoFileStream->Read(&m_unk0x1a, sizeof(MxU16));
p_legoFileStream->Read(&m_unk0x1c, sizeof(MxU16));
p_legoFileStream->Read(&m_color1, sizeof(MxU16));
p_legoFileStream->Read(&m_color2, sizeof(MxU16));
p_legoFileStream->Read(&m_color3, sizeof(MxU16));
p_legoFileStream->Read(&m_color4, sizeof(MxU16));
}
return SUCCESS;
}

View File

@@ -0,0 +1,12 @@
#include "legounknown100d7c88.h"
// FUNCTION: LEGO1 0x10044e50
LegoUnknown100d7c88::~LegoUnknown100d7c88()
{
}
// FUNCTION: LEGO1 0x10044eb0
MxU32 LegoUnknown100d7c88::VTable0x00()
{
return m_unk0x14;
}

View File

@@ -0,0 +1,55 @@
#include "legoanimationmanager.h"
// GLOBAL: LEGO1 0x100f74f8
int g_legoAnimationManagerConfig = 1;
// FUNCTION: LEGO1 0x1005eb50
void LegoAnimationManager::configureLegoAnimationManager(MxS32 p_legoAnimationManagerConfig)
{
g_legoAnimationManagerConfig = p_legoAnimationManagerConfig;
}
// STUB: LEGO1 0x1005eb60
LegoAnimationManager::LegoAnimationManager()
{
// TODO
}
// STUB: LEGO1 0x1005ed30
LegoAnimationManager::~LegoAnimationManager()
{
// TODO
}
// STUB: LEGO1 0x1005f130
void LegoAnimationManager::Init()
{
// TODO
}
// STUB: LEGO1 0x1005f6d0
void LegoAnimationManager::FUN_1005f6d0(MxBool)
{
// TODO
}
// STUB: LEGO1 0x100619f0
MxLong LegoAnimationManager::Notify(MxParam& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10061cc0
MxResult LegoAnimationManager::Tickle()
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10064670
void LegoAnimationManager::FUN_10064670(MxBool)
{
}

View File

@@ -0,0 +1,7 @@
#include "legoanimmmpresenter.h"
// STUB: LEGO1 0x1004a8d0
LegoAnimMMPresenter::LegoAnimMMPresenter()
{
// TODO
}

View File

@@ -0,0 +1,13 @@
#include "legoanimpresenter.h"
// STUB: LEGO1 0x10068420
LegoAnimPresenter::LegoAnimPresenter()
{
// TODO
}
// STUB: LEGO1 0x100686f0
void LegoAnimPresenter::Init()
{
// TODO
}

View File

@@ -0,0 +1,13 @@
#include "legocarbuildanimpresenter.h"
// STUB: LEGO1 0x10078400
LegoCarBuildAnimPresenter::LegoCarBuildAnimPresenter()
{
// TODO
}
// STUB: LEGO1 0x10078680
LegoCarBuildAnimPresenter::~LegoCarBuildAnimPresenter()
{
// TODO
}

View File

@@ -0,0 +1,16 @@
#include "legoflctexturepresenter.h"
DECOMP_SIZE_ASSERT(LegoFlcTexturePresenter, 0x70)
// FUNCTION: LEGO1 0x1005de80
LegoFlcTexturePresenter::LegoFlcTexturePresenter()
{
Init();
}
// FUNCTION: LEGO1 0x1005df70
void LegoFlcTexturePresenter::Init()
{
this->m_unk0x68 = 0;
this->m_unk0x6c = 0;
}

View File

@@ -0,0 +1,12 @@
#include "legohideanimpresenter.h"
// FUNCTION: LEGO1 0x1006d7e0
LegoHideAnimPresenter::LegoHideAnimPresenter()
{
Init();
}
// STUB: LEGO1 0x1006da50
void LegoHideAnimPresenter::Init()
{
}

View File

@@ -0,0 +1,13 @@
#include "legolocomotionanimpresenter.h"
// FUNCTION: LEGO1 0x1006cdd0
LegoLocomotionAnimPresenter::LegoLocomotionAnimPresenter()
{
Init();
}
// STUB: LEGO1 0x1006d0b0
void LegoLocomotionAnimPresenter::Init()
{
// TODO
}

View File

@@ -0,0 +1,6 @@
#include "legometerpresenter.h"
#include "decomp.h"
// Uncomment when member class variables are fleshed out.
// DECOMP_SIZE_ASSERT(LegoMeterPresenter, 0x94); // 0x1000a163

Some files were not shown because too many files have changed in this diff Show More