2023-06-29 04:10:08 -04:00
|
|
|
#include "gasstation.h"
|
|
|
|
|
2024-04-06 07:48:09 -04:00
|
|
|
#include "garage_actions.h"
|
|
|
|
#include "islepathactor.h"
|
|
|
|
#include "jukebox.h"
|
|
|
|
#include "jukebox_actions.h"
|
2024-02-13 18:40:04 -05:00
|
|
|
#include "legocontrolmanager.h"
|
|
|
|
#include "legogamestate.h"
|
|
|
|
#include "legoinputmanager.h"
|
2024-04-06 07:48:09 -04:00
|
|
|
#include "legoomni.h"
|
2024-03-09 15:07:52 -05:00
|
|
|
#include "misc.h"
|
2024-04-06 07:48:09 -04:00
|
|
|
#include "mxbackgroundaudiomanager.h"
|
2024-03-09 15:07:52 -05:00
|
|
|
#include "mxmisc.h"
|
2024-01-17 12:24:42 -05:00
|
|
|
#include "mxnotificationmanager.h"
|
2024-02-13 18:40:04 -05:00
|
|
|
#include "mxticklemanager.h"
|
|
|
|
|
2024-03-22 21:30:58 -04:00
|
|
|
DECOMP_SIZE_ASSERT(GasStation, 0x128)
|
|
|
|
|
2024-02-13 18:40:04 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f0160
|
2024-03-05 03:45:09 -05:00
|
|
|
undefined4 g_unk0x100f0160 = 3;
|
2024-01-17 12:24:42 -05:00
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x100046a0
|
2023-06-29 04:10:08 -04:00
|
|
|
GasStation::GasStation()
|
|
|
|
{
|
2024-04-06 07:48:09 -04:00
|
|
|
m_currentActorId = 0;
|
2024-02-13 18:40:04 -05:00
|
|
|
m_state = NULL;
|
2024-03-13 13:17:20 -04:00
|
|
|
m_destLocation = LegoGameState::e_undefined;
|
2024-04-06 07:48:09 -04:00
|
|
|
m_trackLedBitmap = NULL;
|
2024-02-04 10:36:47 -05:00
|
|
|
m_unk0x104 = 0;
|
|
|
|
m_unk0x114 = 0;
|
|
|
|
m_unk0x106 = 0;
|
|
|
|
m_unk0x10c = 0;
|
|
|
|
m_unk0x115 = 0;
|
|
|
|
m_unk0x110 = 0;
|
2024-01-17 12:24:42 -05:00
|
|
|
|
|
|
|
NotificationManager()->Register(this);
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2024-02-07 06:13:20 -05:00
|
|
|
// FUNCTION: LEGO1 0x10004770
|
2024-01-20 18:04:46 -05:00
|
|
|
MxBool GasStation::VTable0x5c()
|
|
|
|
{
|
2024-02-07 06:13:20 -05:00
|
|
|
return TRUE;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-02-13 18:40:04 -05:00
|
|
|
// FUNCTION: LEGO1 0x100048c0
|
2023-06-29 04:10:08 -04:00
|
|
|
GasStation::~GasStation()
|
|
|
|
{
|
2024-02-13 18:40:04 -05:00
|
|
|
InputManager()->UnRegister(this);
|
|
|
|
if (InputManager()->GetWorld() == this) {
|
|
|
|
InputManager()->ClearWorld();
|
|
|
|
}
|
|
|
|
|
|
|
|
ControlManager()->Unregister(this);
|
|
|
|
TickleManager()->UnregisterClient(this);
|
|
|
|
NotificationManager()->Unregister(this);
|
|
|
|
g_unk0x100f0160 = 3;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2024-02-13 18:40:04 -05:00
|
|
|
// FUNCTION: LEGO1 0x10004990
|
2024-01-20 18:04:46 -05:00
|
|
|
MxResult GasStation::Create(MxDSAction& p_dsAction)
|
|
|
|
{
|
2024-02-13 18:40:04 -05:00
|
|
|
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");
|
2024-03-13 11:38:38 -04:00
|
|
|
m_state->m_unk0x14.m_unk0x00 = 1;
|
|
|
|
}
|
|
|
|
else if (m_state->m_unk0x14.m_unk0x00 == 4) {
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 4;
|
2024-02-13 18:40:04 -05:00
|
|
|
}
|
|
|
|
else {
|
2024-03-13 11:38:38 -04:00
|
|
|
m_state->m_unk0x14.m_unk0x00 = 3;
|
2024-02-13 18:40:04 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
GameState()->SetCurrentArea(LegoGameState::e_garage);
|
|
|
|
GameState()->StopArea(LegoGameState::e_previousArea);
|
|
|
|
|
|
|
|
InputManager()->Register(this);
|
|
|
|
SetIsWorldActive(FALSE);
|
|
|
|
return result;
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-02-17 12:23:09 -05:00
|
|
|
// FUNCTION: LEGO1 0x10004a60
|
2023-12-13 05:48:14 -05:00
|
|
|
MxLong GasStation::Notify(MxParam& p_param)
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
2024-02-17 12:23:09 -05:00
|
|
|
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:
|
2024-03-13 13:17:20 -04:00
|
|
|
GameState()->SwitchArea(m_destLocation);
|
2024-02-17 12:23:09 -05:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2023-06-29 04:10:08 -04:00
|
|
|
|
2024-02-17 12:23:09 -05:00
|
|
|
return result;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2024-04-06 07:48:09 -04:00
|
|
|
// FUNCTION: LEGO1 0x10004b30
|
2024-01-27 15:18:35 -05:00
|
|
|
void GasStation::ReadyWorld()
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-04-06 07:48:09 -04:00
|
|
|
PlayMusic(JukeboxScript::c_JBMusic2);
|
|
|
|
|
|
|
|
m_trackLedBitmap = (MxStillPresenter*) Find("MxStillPresenter", "TrackLed_Bitmap");
|
|
|
|
m_currentActorId = CurrentActor()->GetActorId();
|
|
|
|
|
|
|
|
switch (m_currentActorId) {
|
|
|
|
case 1:
|
|
|
|
switch (m_state->m_unk0x18) {
|
|
|
|
case 0:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 5;
|
|
|
|
PlayAction(GarageScript::c_wgs002nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 5;
|
|
|
|
PlayAction(GarageScript::c_wgs003nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 5;
|
|
|
|
PlayAction(GarageScript::c_wgs004nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 6;
|
|
|
|
PlayAction(GarageScript::c_wgs008nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
m_unk0x104 = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_state->m_unk0x18 < 5) {
|
|
|
|
m_state->m_unk0x18++;
|
|
|
|
}
|
|
|
|
|
|
|
|
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
break;
|
|
|
|
case 2:
|
|
|
|
switch (m_state->m_unk0x1a) {
|
|
|
|
case 0:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 5;
|
|
|
|
PlayAction(GarageScript::c_wgs006nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 5;
|
|
|
|
PlayAction(GarageScript::c_wgs007nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 6;
|
|
|
|
PlayAction(GarageScript::c_wgs008nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
m_unk0x104 = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_state->m_unk0x1a < 5) {
|
|
|
|
m_state->m_unk0x1a++;
|
|
|
|
}
|
|
|
|
|
|
|
|
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
break;
|
|
|
|
case 3:
|
|
|
|
switch (m_state->m_unk0x1c) {
|
|
|
|
case 0:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 5;
|
|
|
|
PlayAction(GarageScript::c_wgs012nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 5;
|
|
|
|
PlayAction(GarageScript::c_wgs014nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 6;
|
|
|
|
PlayAction(GarageScript::c_wgs017nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
m_unk0x104 = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_state->m_unk0x1c < 5) {
|
|
|
|
m_state->m_unk0x1c++;
|
|
|
|
}
|
|
|
|
|
|
|
|
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
switch (m_state->m_unk0x1e) {
|
|
|
|
case 0:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 5;
|
|
|
|
PlayAction(GarageScript::c_wgs009nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 5;
|
|
|
|
PlayAction(GarageScript::c_wgs010nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 6;
|
|
|
|
PlayAction(GarageScript::c_wgs008nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
m_unk0x104 = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_state->m_unk0x1e < 5) {
|
|
|
|
m_state->m_unk0x1e++;
|
|
|
|
}
|
|
|
|
|
|
|
|
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
switch (m_state->m_unk0x20) {
|
|
|
|
case 0:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 5;
|
|
|
|
PlayAction(GarageScript::c_wgs020nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
break;
|
|
|
|
case 1:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 5;
|
|
|
|
PlayAction(GarageScript::c_wgs021nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
m_state->m_unk0x14.m_unk0x00 = 6;
|
|
|
|
PlayAction(GarageScript::c_wgs022nu_RunAnim);
|
|
|
|
m_unk0x106 = 1;
|
|
|
|
m_unk0x104 = 1;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_state->m_unk0x20 < 5) {
|
|
|
|
m_state->m_unk0x20++;
|
|
|
|
}
|
|
|
|
|
|
|
|
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
FUN_10015820(FALSE, LegoOmni::c_disableInput | LegoOmni::c_disable3d | LegoOmni::c_clearScreen);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10005590
|
|
|
|
inline void GasStation::PlayAction(MxU32 p_objectId)
|
|
|
|
{
|
|
|
|
MxDSAction action;
|
|
|
|
action.SetAtomId(*g_garageScript);
|
|
|
|
action.SetObjectId(p_objectId);
|
|
|
|
|
|
|
|
BackgroundAudioManager()->LowerVolume();
|
|
|
|
Start(&action);
|
|
|
|
m_state->FUN_10006430(p_objectId);
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2024-02-17 12:23:09 -05:00
|
|
|
// 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;
|
|
|
|
}
|
|
|
|
|
2024-02-13 18:40:04 -05:00
|
|
|
// FUNCTION: LEGO1 0x10005c40
|
2024-02-02 12:18:46 -05:00
|
|
|
void GasStation::Enable(MxBool p_enable)
|
2024-01-20 18:04:46 -05:00
|
|
|
{
|
2024-02-13 18:40:04 -05:00
|
|
|
LegoWorld::Enable(p_enable);
|
|
|
|
|
|
|
|
if (p_enable) {
|
|
|
|
InputManager()->SetWorld(this);
|
|
|
|
InputManager()->SetCamera(NULL);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
if (InputManager()->GetWorld() == this) {
|
|
|
|
InputManager()->ClearWorld();
|
|
|
|
}
|
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x10005c90
|
2023-09-21 14:51:24 -04:00
|
|
|
MxResult GasStation::Tickle()
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-06-29 04:10:08 -04:00
|
|
|
|
2024-02-17 12:23:09 -05:00
|
|
|
return SUCCESS;
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
2024-01-20 18:04:46 -05:00
|
|
|
|
|
|
|
// STUB: LEGO1 0x10005e70
|
|
|
|
MxBool GasStation::VTable0x64()
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return FALSE;
|
|
|
|
}
|