Refactor files based on beta debug build (#645)

* Rename LegoUnkSaveDataWriter -> LegoCharacterManager

* Refactor mxomni into mxomni/mxmisc

* Refactor legoomni into legoomni/misc

* Resolve deps

* Refactor atom

* Refactor mxutil

* Refactor mxio

* Rename/relocate files

* Fix format
This commit is contained in:
Christian Semmler
2024-03-09 15:07:52 -05:00
committed by GitHub
parent c62469fef4
commit 8069923651
150 changed files with 734 additions and 609 deletions

View File

@@ -0,0 +1,95 @@
#include "act3.h"
DECOMP_SIZE_ASSERT(Act3, 0x4274)
// STUB: LEGO1 0x10072270
Act3::Act3()
{
// TODO
}
// FUNCTION: LEGO1 0x10072500
MxBool Act3::VTable0x5c()
{
return TRUE;
}
// STUB: LEGO1 0x100726a0
Act3::~Act3()
{
// TODO
}
// STUB: LEGO1 0x100727e0
MxBool Act3::FUN_100727e0(MxU32, Mx3DPointFloat& p_loc, Mx3DPointFloat& p_dir, Mx3DPointFloat& p_up)
{
return FALSE;
}
// STUB: LEGO1 0x10072980
MxBool Act3::FUN_10072980(MxU32, Mx3DPointFloat& p_loc, Mx3DPointFloat& p_dir, Mx3DPointFloat& p_up)
{
return FALSE;
}
// STUB: LEGO1 0x10072c30
MxResult Act3::Create(MxDSAction& p_dsAction)
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10072d50
void Act3::Destroy(MxBool p_fromDestructor)
{
// TODO
}
// STUB: LEGO1 0x10072de0
MxLong Act3::Notify(MxParam& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10073270
void Act3::ReadyWorld()
{
// TODO
}
// STUB: LEGO1 0x10073300
MxResult Act3::Tickle()
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10073400
void Act3::FUN_10073400()
{
}
// STUB: LEGO1 0x10073430
void Act3::FUN_10073430()
{
}
// STUB: LEGO1 0x10073a90
void Act3::Enable(MxBool p_enable)
{
// TODO
}
// STUB: LEGO1 0x10073e40
void Act3::VTable0x60()
{
// TODO
}
// STUB: LEGO1 0x10073e50
MxBool Act3::VTable0x64()
{
// TODO
return FALSE;
}

View File

@@ -0,0 +1,138 @@
#include "elevatorbottom.h"
#include "act1state.h"
#include "jukebox.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "legovariables.h"
#include "misc.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxtransitionmanager.h"
DECOMP_SIZE_ASSERT(ElevatorBottom, 0xfc)
// FUNCTION: LEGO1 0x10017e90
ElevatorBottom::ElevatorBottom()
{
NotificationManager()->Register(this);
this->m_unk0xf8 = LegoGameState::e_noArea;
}
// FUNCTION: LEGO1 0x10018060
ElevatorBottom::~ElevatorBottom()
{
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
ControlManager()->Unregister(this);
NotificationManager()->Unregister(this);
}
// FUNCTION: LEGO1 0x100180f0
MxResult ElevatorBottom::Create(MxDSAction& p_dsAction)
{
MxResult result = LegoWorld::Create(p_dsAction);
if (result == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
}
SetIsWorldActive(FALSE);
GameState()->SetCurrentArea(LegoGameState::e_elevbott);
GameState()->StopArea(LegoGameState::e_previousArea);
return result;
}
// FUNCTION: LEGO1 0x10018150
MxLong ElevatorBottom::Notify(MxParam& p_param)
{
MxLong ret = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetType()) {
case c_notificationClick:
ret = HandleClick((LegoControlManagerEvent&) p_param);
break;
case c_notificationTransitioned:
GameState()->SwitchArea(m_unk0xf8);
break;
}
}
return ret;
}
// FUNCTION: LEGO1 0x100181b0
void ElevatorBottom::ReadyWorld()
{
LegoWorld::ReadyWorld();
PlayMusic(JukeBox::e_informationCenter);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
// FUNCTION: LEGO1 0x100181d0
MxLong ElevatorBottom::HandleClick(LegoControlManagerEvent& p_param)
{
MxLong result = 0;
if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
case 1:
m_unk0xf8 = LegoGameState::e_infodoor;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
case 2:
m_unk0xf8 = LegoGameState::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
case 3:
LegoGameState* gs = GameState();
Act1State* state = (Act1State*) gs->GetState("Act1State");
if (state == NULL) {
state = (Act1State*) gs->CreateState("Act1State");
}
state->SetUnknown1c(1);
m_unk0xf8 = LegoGameState::e_elevride;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
VariableTable()->SetVariable(g_varCAMERALOCATION, "LCAMZI1,90");
result = 1;
break;
}
}
return result;
}
// FUNCTION: LEGO1 0x100182c0
void ElevatorBottom::Enable(MxBool p_enable)
{
LegoWorld::Enable(p_enable);
if (p_enable) {
InputManager()->SetWorld(this);
SetIsWorldActive(FALSE);
}
else {
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
}
}
// FUNCTION: LEGO1 0x10018310
MxBool ElevatorBottom::VTable0x64()
{
DeleteObjects(&m_atom, 500, 999);
m_unk0xf8 = LegoGameState::e_infomain;
return TRUE;
}

View File

@@ -0,0 +1,177 @@
#include "gasstation.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "misc.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxticklemanager.h"
// GLOBAL: LEGO1 0x100f0160
undefined4 g_unk0x100f0160 = 3;
// FUNCTION: LEGO1 0x100046a0
GasStation::GasStation()
{
m_unk0xf8 = 0;
m_state = NULL;
m_transitionDestination = LegoGameState::e_noArea;
m_unk0x108 = 0;
m_unk0x104 = 0;
m_unk0x114 = 0;
m_unk0x106 = 0;
m_unk0x10c = 0;
m_unk0x115 = 0;
m_unk0x110 = 0;
NotificationManager()->Register(this);
}
// FUNCTION: LEGO1 0x10004770
MxBool GasStation::VTable0x5c()
{
return TRUE;
}
// FUNCTION: LEGO1 0x100048c0
GasStation::~GasStation()
{
InputManager()->UnRegister(this);
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
ControlManager()->Unregister(this);
TickleManager()->UnregisterClient(this);
NotificationManager()->Unregister(this);
g_unk0x100f0160 = 3;
}
// FUNCTION: LEGO1 0x10004990
MxResult GasStation::Create(MxDSAction& p_dsAction)
{
MxResult result = LegoWorld::Create(p_dsAction);
if (result == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
}
InputManager()->SetCamera(NULL);
m_state = (GasStationState*) GameState()->GetState("GasStationState");
if (!m_state) {
m_state = (GasStationState*) GameState()->CreateState("GasStationState");
m_state->GetUnknown0x14().SetUnknown0x00(1);
}
else {
GasStationState::Unknown0x14& unk0x14 = m_state->GetUnknown0x14();
if (unk0x14.GetUnknown0x00() == 4) {
unk0x14.SetUnknown0x00(4);
}
else {
unk0x14.SetUnknown0x00(3);
}
}
GameState()->SetCurrentArea(LegoGameState::e_garage);
GameState()->StopArea(LegoGameState::e_previousArea);
InputManager()->Register(this);
SetIsWorldActive(FALSE);
return result;
}
// FUNCTION: LEGO1 0x10004a60
MxLong GasStation::Notify(MxParam& p_param)
{
MxResult result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;
case c_notificationKeyPress:
result = HandleKeyPress((((LegoEventNotificationParam&) p_param)).GetKey());
break;
case c_notificationButtonDown:
result = HandleButtonDown(((LegoControlManagerEvent&) p_param));
break;
case c_notificationClick:
result = HandleClick((LegoControlManagerEvent&) p_param);
break;
case c_notificationTransitioned:
GameState()->SwitchArea(m_transitionDestination);
break;
}
}
return result;
}
// STUB: LEGO1 0x10004b30
void GasStation::ReadyWorld()
{
// TODO
}
// STUB: LEGO1 0x10005660
MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10005920
MxLong GasStation::HandleKeyPress(MxS8 p_key)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10005960
MxLong GasStation::HandleButtonDown(LegoControlManagerEvent& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10005b20
MxLong GasStation::HandleClick(LegoControlManagerEvent& p_param)
{
// TODO
return 0;
}
// FUNCTION: LEGO1 0x10005c40
void GasStation::Enable(MxBool p_enable)
{
LegoWorld::Enable(p_enable);
if (p_enable) {
InputManager()->SetWorld(this);
InputManager()->SetCamera(NULL);
}
else {
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
}
}
// STUB: LEGO1 0x10005c90
MxResult GasStation::Tickle()
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10005e70
MxBool GasStation::VTable0x64()
{
// TODO
return FALSE;
}

View File

@@ -0,0 +1,154 @@
#include "historybook.h"
#include "jukebox.h"
#include "legocontrolmanager.h"
#include "legoinputmanager.h"
#include "misc.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxtransitionmanager.h"
DECOMP_SIZE_ASSERT(HistoryBook, 0x3e4)
// FUNCTION: LEGO1 0x100822f0
HistoryBook::HistoryBook()
{
memset(m_alphabet, NULL, sizeof(m_alphabet));
memset(m_names, NULL, sizeof(m_names));
memset(m_scores, NULL, sizeof(m_scores));
NotificationManager()->Register(this);
}
// STUB: LEGO1 0x100824d0
HistoryBook::~HistoryBook()
{
// TODO
}
// FUNCTION: LEGO1 0x10082610
MxResult HistoryBook::Create(MxDSAction& p_dsAction)
{
MxResult result = LegoWorld::Create(p_dsAction);
if (result == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
}
InputManager()->SetCamera(NULL);
InputManager()->Register(this);
GameState()->SetCurrentArea(LegoGameState::Area::e_histbook);
GameState()->StopArea(LegoGameState::Area::e_previousArea);
return result;
}
// FUNCTION: LEGO1 0x10082680
MxLong HistoryBook::Notify(MxParam& p_param)
{
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationButtonUp:
m_transitionDestination = LegoGameState::Area::e_infoscor;
TransitionManager()->StartTransition(MxTransitionManager::TransitionType::e_pixelation, 50, FALSE, FALSE);
break;
case c_notificationTransitioned:
GameState()->SwitchArea(m_transitionDestination);
break;
}
}
return 0;
}
inline void SetColor(MxStillPresenter* p_presenter, MxU8 p_color, MxU8* p_colors, MxS32 p_x, MxS32 p_y)
{
if (p_color) {
for (MxS32 lax = 0; lax < 4; lax++) {
if (p_presenter->GetAlphaMask() != NULL) {
memset(NULL, p_colors[p_color - 1], 4);
}
else {
memset(p_presenter->GetBitmap()->GetStart(p_x, p_y + lax), p_colors[p_color - 1], 4);
}
}
}
}
// FUNCTION: LEGO1 0x100826f0
void HistoryBook::ReadyWorld()
{
LegoWorld::ReadyWorld();
GameState()->GetHistory()->WriteScoreHistory();
char bitmap[] = "A_Bitmap";
for (MxS16 i = 0; i < 26; i++) {
m_alphabet[i] = (MxStillPresenter*) Find("MxStillPresenter", bitmap);
bitmap[0]++;
}
MxStillPresenter* scoreboxMaster = (MxStillPresenter*) Find("MxStillPresenter", "ScoreBox");
MxU8 scoreColors[3] =
{0x76, 0x4c, 0x38}; // yellow - #FFB900, blue - #00548C, red - #CB1220, background - #CECECE, border - #74818B
MxS32 scoreY = 0x79;
for (MxS16 scoreIndex = 0; scoreIndex < GameState()->GetHistory()->m_count; scoreIndex++) {
LegoGameState::ScoreItem* score = GameState()->GetHistory()->GetScore(scoreIndex);
MxStillPresenter** scorebox = &m_scores[scoreIndex];
*scorebox = scoreboxMaster->Clone();
MxS32 scoreX = 0x90;
if (scoreIndex >= 10) {
if (scoreIndex == 10) {
scoreY = 0x79;
}
scoreX = 0x158;
}
MxS32 scoreboxX = 1;
MxS32 scoreboxRow = 5;
MxS32 scoreState = 0;
for (; scoreboxRow > 0; scoreboxRow--) {
for (MxS32 scoreBoxColumn = 0, scoreboxY = 1; scoreBoxColumn < 5; scoreBoxColumn++, scoreboxY += 5) {
SetColor(*scorebox, score->m_state[scoreState][scoreBoxColumn], scoreColors, scoreboxX, scoreboxY);
}
scoreState++;
scoreboxX += 5;
}
(*scorebox)->Enable(TRUE);
(*scorebox)->SetTickleState(MxPresenter::e_repeating);
(*scorebox)->SetPosition(scoreX + 0xa1, scoreY);
for (MxS16 letterIndex = 0; letterIndex < (MxS16) _countof(m_names[0]);) {
MxS16 letter = score->m_name.m_letters[letterIndex];
if (letter == -1) {
break;
}
MxS16 nameIndex = letterIndex++;
m_names[scoreIndex][nameIndex] = m_alphabet[letter]->Clone();
m_names[scoreIndex][nameIndex]->Enable(TRUE);
m_names[scoreIndex][nameIndex]->SetTickleState(MxPresenter::e_repeating);
m_names[scoreIndex][nameIndex]->SetPosition(scoreX, scoreY);
scoreX += 0x17;
}
scoreY += 0x1b;
}
PlayMusic(JukeBox::e_informationCenter);
}
// FUNCTION: LEGO1 0x10082a10
MxBool HistoryBook::VTable0x64()
{
m_transitionDestination = LegoGameState::Area::e_infomain;
return TRUE;
}

View File

@@ -0,0 +1,77 @@
#include "hospital.h"
#include "mxmisc.h"
#include "mxnotificationmanager.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);
}
// FUNCTION: LEGO1 0x100746a0
MxBool Hospital::VTable0x5c()
{
return TRUE;
}
// STUB: LEGO1 0x100747f0
Hospital::~Hospital()
{
// TODO
}
// STUB: LEGO1 0x100748c0
MxResult Hospital::Create(MxDSAction& p_dsAction)
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10074990
MxLong Hospital::Notify(MxParam& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10074a60
void Hospital::ReadyWorld()
{
// TODO
}
// STUB: LEGO1 0x10076220
void Hospital::Enable(MxBool p_enable)
{
// TODO
}
// STUB: LEGO1 0x10076270
MxResult Hospital::Tickle()
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10076330
MxBool Hospital::VTable0x64()
{
// TODO
return FALSE;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,170 @@
#include "infocenterdoor.h"
#include "infocenterstate.h"
#include "jukebox.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "misc.h"
#include "mxactionnotificationparam.h"
#include "mxbackgroundaudiomanager.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxtransitionmanager.h"
DECOMP_SIZE_ASSERT(InfocenterDoor, 0xfc)
// FUNCTION: LEGO1 0x10037730
InfocenterDoor::InfocenterDoor()
{
m_unk0xf8 = LegoGameState::e_noArea;
NotificationManager()->Register(this);
}
// FUNCTION: LEGO1 0x100378f0
InfocenterDoor::~InfocenterDoor()
{
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
ControlManager()->Unregister(this);
NotificationManager()->Unregister(this);
}
// FUNCTION: LEGO1 0x10037980
MxResult InfocenterDoor::Create(MxDSAction& p_dsAction)
{
MxResult result = LegoWorld::Create(p_dsAction);
if (result == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
}
SetIsWorldActive(FALSE);
GameState()->SetCurrentArea(LegoGameState::e_infodoor);
GameState()->StopArea(LegoGameState::e_previousArea);
return result;
}
// FUNCTION: LEGO1 0x100379e0
MxLong InfocenterDoor::Notify(MxParam& p_param)
{
MxLong result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetType()) {
case c_notificationEndAction:
if (((MxEndActionNotificationParam&) p_param).GetAction()->GetAtomId() == m_atom) {
BackgroundAudioManager()->RaiseVolume();
result = 1;
}
break;
case c_notificationClick:
result = HandleClick((LegoControlManagerEvent&) p_param);
break;
case c_notificationTransitioned:
GameState()->SwitchArea(m_unk0xf8);
result = 1;
break;
}
}
return result;
}
// FUNCTION: LEGO1 0x10037a70
void InfocenterDoor::ReadyWorld()
{
LegoWorld::ReadyWorld();
PlayMusic(JukeBox::e_informationCenter);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
// FUNCTION: LEGO1 0x10037a90
MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param)
{
MxLong result = 0;
if (p_param.GetUnknown0x28() == 1) {
DeleteObjects(&m_atom, 500, 510);
switch (p_param.GetClickedObjectId()) {
case 1:
m_unk0xf8 = LegoGameState::e_infoscor;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
case 2:
m_unk0xf8 = LegoGameState::e_elevbott;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
case 3:
m_unk0xf8 = LegoGameState::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
result = 1;
break;
case 4:
if (GameState()->GetActorId()) {
InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState");
if (state->HasRegistered()) {
m_unk0xf8 = LegoGameState::e_unk4;
}
else {
MxDSAction action;
action.SetObjectId(503);
action.SetAtomId(*g_infodoorScript);
BackgroundAudioManager()->LowerVolume();
Start(&action);
goto done;
}
}
else {
MxDSAction action;
action.SetObjectId(500);
action.SetAtomId(*g_infodoorScript);
BackgroundAudioManager()->LowerVolume();
Start(&action);
goto done;
}
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
done:
result = 1;
break;
}
}
return result;
}
// FUNCTION: LEGO1 0x10037c80
void InfocenterDoor::Enable(MxBool p_enable)
{
LegoWorld::Enable(p_enable);
if (p_enable) {
InputManager()->SetWorld(this);
SetIsWorldActive(FALSE);
}
else {
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
}
}
// FUNCTION: LEGO1 0x10037cd0
MxBool InfocenterDoor::VTable0x64()
{
DeleteObjects(&m_atom, 500, 510);
m_unk0xf8 = LegoGameState::e_infomain;
return TRUE;
}

View File

@@ -0,0 +1,286 @@
#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 "legoutils.h"
#include "misc.h"
#include "mxmisc.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_motocycle = 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 (CurrentActor() != NULL) {
VTable0x6c(CurrentActor());
}
NotificationManager()->Unregister(this);
}
// FUNCTION: LEGO1 0x10030b20
MxResult Isle::Create(MxDSAction& p_dsAction)
{
GameState()->FindLoadedAct();
MxResult result = LegoWorld::Create(p_dsAction);
if (result == SUCCESS) {
ControlManager()->Register(this);
InputManager()->SetWorld(this);
GameState()->StopArea(LegoGameState::e_previousArea);
switch (GameState()->GetLoadedAct()) {
case LegoGameState::e_act2:
GameState()->StopArea(LegoGameState::e_act2main);
break;
case LegoGameState::e_act3:
GameState()->StopArea(LegoGameState::e_act2main); // Looks like a bug
break;
case LegoGameState::e_actNotFound:
m_unk0x13c = 2;
}
if (GameState()->GetCurrentArea() == LegoGameState::e_isle) {
GameState()->SetCurrentArea(LegoGameState::e_noArea);
}
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_worldStarted) {
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 c_notificationClick:
result = HandleType17Notification(p_param);
break;
case c_notificationType18:
switch (m_act1state->GetUnknown18()) {
case 4:
result = CurrentActor()->Notify(p_param);
break;
case 8:
result = m_towtrack->Notify(p_param);
break;
case 10:
result = m_ambulance->Notify(p_param);
break;
}
break;
case c_notificationType19:
result = HandleType19Notification(p_param);
break;
case c_notificationType20:
Enable(TRUE);
break;
case c_notificationTransitioned:
result = HandleTransitionEnd();
break;
}
}
return result;
}
// STUB: LEGO1 0x10030d90
MxLong Isle::StopAction(MxParam& p_param)
{
return 0;
}
// FUNCTION: LEGO1 0x10030fc0
void Isle::ReadyWorld()
{
LegoWorld::ReadyWorld();
if (m_act1state->GetUnknown21()) {
GameState()->SwitchArea(LegoGameState::e_infomain);
m_act1state->SetUnknown18(0);
m_act1state->SetUnknown21(0);
}
else if (GameState()->GetLoadedAct()) {
FUN_1003ef00(TRUE);
FUN_10032620();
m_act1state->FUN_10034d00();
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
}
// 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::Enable(MxBool p_enable)
{
if (m_set0xd0.empty() == p_enable) {
return;
}
LegoWorld::Enable(p_enable);
m_radio.Initialize(p_enable);
if (p_enable) {
// TODO
}
else {
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
}
}
// STUB: LEGO1 0x10032620
void Isle::FUN_10032620()
{
// TODO
}
// STUB: LEGO1 0x100327a0
MxLong Isle::HandleTransitionEnd()
{
return 0;
}
// FUNCTION: LEGO1 0x10032f10
void Isle::Add(MxCore* p_object)
{
LegoWorld::Add(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_motocycle = (Motocycle*) 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::Remove(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,260 @@
#include "jukebox.h"
#include "act1state.h"
#include "jukeboxstate.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "misc.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxstillpresenter.h"
#include "mxticklemanager.h"
#include "mxtransitionmanager.h"
#include "mxvideopresenter.h"
DECOMP_SIZE_ASSERT(JukeBox, 0x104)
// FUNCTION: LEGO1 0x1005d660
JukeBox::JukeBox()
{
m_unk0x100 = 0;
m_state = NULL;
NotificationManager()->Register(this);
}
// FUNCTION: LEGO1 0x1005d6e0
MxBool JukeBox::VTable0x5c()
{
return TRUE;
}
// FUNCTION: LEGO1 0x1005d830
JukeBox::~JukeBox()
{
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
ControlManager()->Unregister(this);
TickleManager()->UnregisterClient(this);
NotificationManager()->Unregister(this);
}
// FUNCTION: LEGO1 0x1005d8d0
MxResult JukeBox::Create(MxDSAction& p_dsAction)
{
MxResult ret = LegoWorld::Create(p_dsAction);
if (ret == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
}
InputManager()->SetCamera(NULL);
m_state = (JukeBoxState*) GameState()->GetState("JukeBoxState");
if (!m_state) {
m_state = (JukeBoxState*) GameState()->CreateState("JukeBoxState");
m_state->SetState(0);
}
GameState()->SetCurrentArea(LegoGameState::e_jukeboxw);
GameState()->StopArea(LegoGameState::e_previousArea);
TickleManager()->RegisterClient(this, 2000);
return ret;
}
// FUNCTION: LEGO1 0x1005d980
MxLong JukeBox::Notify(MxParam& p_param)
{
MxLong result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationClick:
result = HandleClick((LegoControlManagerEvent&) p_param);
break;
case c_notificationTransitioned:
GameState()->SwitchArea(m_transitionDestination);
result = 1;
break;
}
}
return result;
}
// FUNCTION: LEGO1 0x1005d9f0
void JukeBox::ReadyWorld()
{
MxStillPresenter* presenter = NULL;
switch (m_state->GetState()) {
case 1:
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
break;
case 2:
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
break;
case 3:
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
break;
case 4:
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
break;
case 5:
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
break;
}
if (presenter) {
presenter->Enable(TRUE);
}
m_unk0x100 = 1;
}
// FUNCTION: LEGO1 0x1005da70
MxBool JukeBox::HandleClick(LegoControlManagerEvent& p_param)
{
MxStillPresenter* presenter;
if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
case c_dBackCtl:
switch (m_state->GetState()) {
case JukeBoxScript::e_mamaPapaBrickolini:
m_state->SetState(JukeBoxScript::e_residentialArea);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
presenter->Enable(TRUE);
break;
case JukeBoxScript::e_jailUnused:
m_state->SetState(JukeBoxScript::e_mamaPapaBrickolini);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
presenter->Enable(FALSE);
break;
case JukeBoxScript::e_act2Cave:
m_state->SetState(JukeBoxScript::e_jailUnused);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
presenter->Enable(TRUE);
break;
case JukeBoxScript::e_bricksterChase:
m_state->SetState(JukeBoxScript::e_act2Cave);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
presenter->Enable(TRUE);
break;
case JukeBoxScript::e_brickHunt:
m_state->SetState(JukeBoxScript::e_bricksterChase);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
presenter->Enable(TRUE);
break;
case JukeBoxScript::e_residentialArea:
m_state->SetState(JukeBoxScript::e_brickHunt);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
presenter->Enable(TRUE);
break;
}
break;
case JukeBoxWorldScript::c_dFwdCtl:
switch (m_state->GetState()) {
case JukeBoxScript::e_mamaPapaBrickolini:
m_state->SetState(JukeBoxScript::e_jailUnused);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
presenter->Enable(TRUE);
break;
case JukeBoxScript::e_jailUnused:
m_state->SetState(JukeBoxScript::e_act2Cave);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Right_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
presenter->Enable(TRUE);
break;
case JukeBoxScript::e_act2Cave:
m_state->SetState(JukeBoxScript::e_bricksterChase);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Decal_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
presenter->Enable(TRUE);
break;
case JukeBoxScript::e_bricksterChase:
m_state->SetState(JukeBoxScript::e_brickHunt);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Wallis_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
presenter->Enable(TRUE);
break;
case JukeBoxScript::e_brickHunt:
m_state->SetState(JukeBoxScript::e_residentialArea);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Nelson_Bitmap");
presenter->Enable(FALSE);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
presenter->Enable(TRUE);
break;
case JukeBoxScript::e_residentialArea:
m_state->SetState(JukeBoxScript::e_mamaPapaBrickolini);
presenter = (MxStillPresenter*) Find("MxStillPresenter", "Torpedos_Bitmap");
presenter->Enable(FALSE);
break;
}
break;
case JukeBoxWorldScript::c_noteCtl:
LegoGameState* gameState = GameState();
Act1State* act1State = (Act1State*) gameState->GetState("Act1State");
act1State->SetUnknown18(11);
m_transitionDestination = LegoGameState::Area::e_unk54;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, 0, FALSE);
break;
}
}
return TRUE;
}
// FUNCTION: LEGO1 0x1005dde0
void JukeBox::Enable(MxBool p_enable)
{
LegoWorld::Enable(p_enable);
if (p_enable) {
InputManager()->SetWorld(this);
InputManager()->SetCamera(NULL);
}
else {
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
}
}
// FUNCTION: LEGO1 0x1005de30
MxResult JukeBox::Tickle()
{
if (m_worldStarted == FALSE) {
LegoWorld::Tickle();
return SUCCESS;
}
if (m_unk0x100 == 1) {
m_unk0x100 = 0;
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
return SUCCESS;
}
// FUNCTION: LEGO1 0x1005de70
MxBool JukeBox::VTable0x64()
{
m_transitionDestination = LegoGameState::e_infomain;
return TRUE;
}

View File

@@ -0,0 +1,53 @@
#include "legoact2.h"
// FUNCTION: LEGO1 0x1004fe10
MxBool LegoAct2::VTable0x5c()
{
return TRUE;
}
// STUB: LEGO1 0x1004ff20
MxResult LegoAct2::Create(MxDSAction& p_dsAction)
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10050040
MxResult LegoAct2::Tickle()
{
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10050380
MxLong LegoAct2::Notify(MxParam& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10050a80
void LegoAct2::ReadyWorld()
{
// TODO
}
// STUB: LEGO1 0x10050cf0
void LegoAct2::Enable(MxBool p_enable)
{
// TODO
}
// STUB: LEGO1 0x100519c0
void LegoAct2::VTable0x60()
{
// TODO
}
// STUB: LEGO1 0x100519d0
MxBool LegoAct2::VTable0x64()
{
// TODO
return FALSE;
}

View File

@@ -0,0 +1,195 @@
#include "police.h"
#include "jukebox.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "misc.h"
#include "mxbackgroundaudiomanager.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxtransitionmanager.h"
#include "policestate.h"
DECOMP_SIZE_ASSERT(Police, 0x110)
// FUNCTION: LEGO1 0x1005e130
Police::Police()
{
m_policeState = NULL;
m_transitionDestination = LegoGameState::e_noArea;
NotificationManager()->Register(this);
}
// FUNCTION: LEGO1 0x1005e1d0
MxBool Police::VTable0x5c()
{
return TRUE;
}
// FUNCTION: LEGO1 0x1005e320
Police::~Police()
{
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
ControlManager()->Unregister(this);
InputManager()->UnRegister(this);
NotificationManager()->Unregister(this);
}
// FUNCTION: LEGO1 0x1005e3e0
MxResult Police::Create(MxDSAction& p_dsAction)
{
MxResult ret = LegoWorld::Create(p_dsAction);
if (ret == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
}
SetIsWorldActive(FALSE);
InputManager()->Register(this);
LegoGameState* gameState = GameState();
PoliceState* policeState = (PoliceState*) gameState->GetState("PoliceState");
if (!policeState) {
policeState = (PoliceState*) gameState->CreateState("PoliceState");
}
m_policeState = policeState;
GameState()->SetCurrentArea(LegoGameState::e_police);
GameState()->StopArea(LegoGameState::e_previousArea);
return ret;
}
// FUNCTION: LEGO1 0x1005e480
MxLong Police::Notify(MxParam& p_param)
{
MxLong result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;
case c_notificationKeyPress:
result = HandleKeyPress(((LegoEventNotificationParam&) p_param));
break;
case c_notificationClick:
result = HandleClick((LegoControlManagerEvent&) p_param);
break;
case c_notificationTransitioned:
GameState()->SwitchArea(m_transitionDestination);
break;
}
}
return result;
}
// FUNCTION: LEGO1 0x1005e530
void Police::ReadyWorld()
{
LegoWorld::ReadyWorld();
PlayMusic(JukeBox::e_policeStation);
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
// FUNCTION: LEGO1 0x1005e550
MxLong Police::HandleClick(LegoControlManagerEvent& p_param)
{
if (p_param.GetUnknown0x28() == 1) {
switch (p_param.GetClickedObjectId()) {
case c_leftArrowCtl:
case c_rightArrowCtl:
if (m_policeState->GetUnknown0x0c() == 1) {
DeleteObjects(&m_atom, c_nickAnim, c_lauraAnim);
}
BackgroundAudioManager()->Stop();
m_transitionDestination = LegoGameState::Area::e_polidoor;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
break;
case c_infoCtl:
if (m_policeState->GetUnknown0x0c() == 1) {
DeleteObjects(&m_atom, c_nickAnim, c_lauraAnim);
}
BackgroundAudioManager()->Stop();
m_transitionDestination = LegoGameState::Area::e_infomain;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
break;
case c_doorCtl:
if (m_policeState->GetUnknown0x0c() == 1) {
DeleteObjects(&m_atom, c_nickAnim, c_lauraAnim);
}
BackgroundAudioManager()->Stop();
m_transitionDestination = LegoGameState::Area::e_copter;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
break;
case c_donutCtl:
m_policeState->FUN_1005ea40();
}
}
return 1;
}
// FUNCTION: LEGO1 0x1005e6a0
MxLong Police::HandleEndAction(MxEndActionNotificationParam& p_param)
{
MxDSAction* action = p_param.GetAction();
if (m_radio.Notify(p_param) == 0 && m_atom == action->GetAtomId()) {
if (m_policeState->GetUnknown0x0c() == 1) {
m_policeState->SetUnknown0x0c(0);
return 1;
}
return 0;
}
return 0;
}
// FUNCTION: LEGO1 0x1005e6f0
MxLong Police::HandleKeyPress(LegoEventNotificationParam& p_param)
{
MxLong result = 0;
if (p_param.GetKey() == ' ' && m_policeState->GetUnknown0x0c() == 1) {
DeleteObjects(&m_atom, c_nickAnim, c_lauraAnim);
m_policeState->SetUnknown0x0c(0);
return 1;
}
return 0;
}
// FUNCTION: LEGO1 0x1005e740
void Police::Enable(MxBool p_enable)
{
LegoWorld::Enable(p_enable);
if (p_enable) {
InputManager()->SetWorld(this);
SetIsWorldActive(FALSE);
}
else {
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
}
}
// FUNCTION: LEGO1 0x1005e790
MxBool Police::VTable0x64()
{
DeleteObjects(&m_atom, c_nickAnim, 510);
m_transitionDestination = LegoGameState::e_infomain;
return TRUE;
}

View File

@@ -0,0 +1,159 @@
#include "registrationbook.h"
#include "infocenterstate.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "misc.h"
#include "mxactionnotificationparam.h"
#include "mxmisc.h"
#include "mxnotificationmanager.h"
#include "mxtimer.h"
DECOMP_SIZE_ASSERT(RegistrationBook, 0x2d0)
// FUNCTION: LEGO1 0x10076d20
RegistrationBook::RegistrationBook() : m_unk0xf8(0x80000000), m_unk0xfc(1)
{
memset(m_unk0x100, 0, sizeof(m_unk0x100));
memset(m_unk0x168, 0, sizeof(m_unk0x168));
// Maybe not be part of the struct, but then it would need packing
m_unk0x280.m_unk0x0e = 0;
memset(m_unk0x290, 0, sizeof(m_unk0x290));
memset(&m_unk0x280, -1, sizeof(m_unk0x280) - 2);
m_unk0x2b8 = 0;
m_infocenterState = NULL;
NotificationManager()->Register(this);
m_unk0x2c1 = 0;
m_unk0x2c4 = 0;
m_unk0x2c8 = 0;
m_unk0x2cc = 0;
}
// STUB: LEGO1 0x10076f50
RegistrationBook::~RegistrationBook()
{
// TODO
}
// FUNCTION: LEGO1 0x10077060
MxResult RegistrationBook::Create(MxDSAction& p_dsAction)
{
MxResult result = LegoWorld::Create(p_dsAction);
if (result == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
SetIsWorldActive(FALSE);
InputManager()->Register(this);
GameState()->SetCurrentArea(LegoGameState::e_regbook);
GameState()->StopArea(LegoGameState::e_previousArea);
m_infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState");
}
return result;
}
// FUNCTION: LEGO1 0x100770e0
MxLong RegistrationBook::Notify(MxParam& p_param)
{
MxLong result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetType()) {
case c_notificationEndAction:
result = HandleEndAction((MxEndActionNotificationParam&) p_param);
break;
case c_notificationKeyPress:
m_unk0xf8 = Timer()->GetTime();
result = HandleKeyPress(((LegoEventNotificationParam&) p_param).GetKey());
break;
case c_notificationButtonDown:
m_unk0xf8 = Timer()->GetTime();
break;
case c_notificationClick:
result = HandleClick((LegoControlManagerEvent&) p_param);
break;
case c_notificationType19:
result = HandleNotification19(p_param);
break;
case c_notificationTransitioned:
GameState()->SwitchArea(LegoGameState::e_infomain);
break;
}
}
return result;
}
// STUB: LEGO1 0x10077210
MxLong RegistrationBook::HandleEndAction(MxEndActionNotificationParam& p_param)
{
return 0;
}
// STUB: LEGO1 0x100772d0
MxLong RegistrationBook::HandleKeyPress(MxS8 p_key)
{
return 0;
}
// STUB: LEGO1 0x100774a0
MxLong RegistrationBook::HandleClick(LegoControlManagerEvent& p_param)
{
return 0;
}
// STUB: LEGO1 0x10077cc0
void RegistrationBook::ReadyWorld()
{
// TODO
}
// STUB: LEGO1 0x10077fd0
MxResult RegistrationBook::Tickle()
{
if (!m_worldStarted) {
LegoWorld::Tickle();
}
else {
// TODO
}
return SUCCESS;
}
// FUNCTION: LEGO1 0x10078180
void RegistrationBook::Enable(MxBool p_enable)
{
LegoWorld::Enable(p_enable);
if (p_enable) {
InputManager()->SetWorld(this);
SetIsWorldActive(FALSE);
}
else {
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
}
}
// STUB: LEGO1 0x100781d0
MxLong RegistrationBook::HandleNotification19(MxParam& p_param)
{
return 0;
}
// FUNCTION: LEGO1 0x100783e0
MxBool RegistrationBook::VTable0x64()
{
DeleteObjects(&m_atom, 500, 506);
return TRUE;
}

View File

@@ -0,0 +1,337 @@
#include "score.h"
#include "ambulancemissionstate.h"
#include "jukebox.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "misc.h"
#include "misc/legocontainer.h"
#include "mxmisc.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 = LegoGameState::e_noArea;
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(MxDSAction& p_dsAction)
{
MxResult result = LegoWorld::Create(p_dsAction);
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()->SetCurrentArea(LegoGameState::e_infoscor);
GameState()->StopArea(LegoGameState::e_previousArea);
}
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_worldStarted) {
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 c_notificationClick:
ret = FUN_100016d0((LegoControlManagerEvent&) p_param);
break;
case c_notificationTransitioned:
DeleteObjects(g_infoscorScript, 7, 9);
if (m_unk0xf8) {
GameState()->SwitchArea(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 = LegoGameState::e_histbook;
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 0x32, 0, 0);
break;
case 0x1f5:
PlayMusic(JukeBox::e_informationCenter);
m_state->SetTutorialFlag(FALSE);
}
}
return 1;
}
// FUNCTION: LEGO1 0x10001580
void Score::ReadyWorld()
{
LegoWorld::ReadyWorld();
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(JukeBox::e_informationCenter);
}
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
}
// FUNCTION: LEGO1 0x100016d0
MxLong Score::FUN_100016d0(LegoControlManagerEvent& p_param)
{
MxS16 l = p_param.GetUnknown0x28();
if (l == 1 || p_param.GetClickedObjectId() == 4) {
switch (p_param.GetClickedObjectId()) {
case 1:
m_unk0xf8 = LegoGameState::e_infomain;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 0x32, 0, 0);
break;
case 2:
m_unk0xf8 = LegoGameState::e_infodoor;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::e_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::Enable(MxBool p_enable)
{
LegoWorld::Enable(p_enable);
if (p_enable) {
InputManager()->SetWorld(this);
SetIsWorldActive(FALSE);
}
else if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
}
// FUNCTION: LEGO1 0x100019d0
void Score::Paint()
{
LegoTextureInfo* gd = TextureContainer()->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] = 0x0f;
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] = 0x08;
data[3] = 0x05;
MxU32 value = data[p_color];
for (; count > 0; count--) {
memset(ptr++, value, size);
ptr += 0x100;
}
}
// FUNCTION: LEGO1 0x10001e40
MxBool Score::VTable0x64()
{
DeleteScript();
m_unk0xf8 = LegoGameState::e_infomain;
return TRUE;
}