diff --git a/LEGO1/lego/legoomni/include/gasstation.h b/LEGO1/lego/legoomni/include/gasstation.h index b05935fc..c6df1d3a 100644 --- a/LEGO1/lego/legoomni/include/gasstation.h +++ b/LEGO1/lego/legoomni/include/gasstation.h @@ -56,7 +56,7 @@ class GasStation : public LegoWorld { undefined2 m_unk0x106; // 0x106 MxStillPresenter* m_trackLedBitmap; // 0x108 undefined4 m_unk0x10c; // 0x10c - undefined4 m_unk0x110; // 0x110 + undefined4 m_trackLedTimer; // 0x110 undefined m_unk0x114; // 0x114 undefined m_unk0x115; // 0x115 Radio m_radio; // 0x118 diff --git a/LEGO1/lego/legoomni/include/gasstationstate.h b/LEGO1/lego/legoomni/include/gasstationstate.h index 35f02bef..d37423b2 100644 --- a/LEGO1/lego/legoomni/include/gasstationstate.h +++ b/LEGO1/lego/legoomni/include/gasstationstate.h @@ -33,6 +33,7 @@ class GasStationState : public LegoState { // GasStationState::`scalar deleting destructor' void FUN_10006430(undefined4); + void FUN_10006490(); friend class GasStation; diff --git a/LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp b/LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp index cd40db3d..4eb3e490 100644 --- a/LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp +++ b/LEGO1/lego/legoomni/src/gasstation/gasstationstate.cpp @@ -29,3 +29,9 @@ void GasStationState::FUN_10006430(undefined4) { // TODO } + +// STUB: LEGO1 0x10006490 +void GasStationState::FUN_10006490() +{ + // TODO +} diff --git a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp index d5be59ce..d0a3349d 100644 --- a/LEGO1/lego/legoomni/src/worlds/gasstation.cpp +++ b/LEGO1/lego/legoomni/src/worlds/gasstation.cpp @@ -13,12 +13,18 @@ #include "mxmisc.h" #include "mxnotificationmanager.h" #include "mxticklemanager.h" +#include "mxtimer.h" +#include "mxtransitionmanager.h" +#include "radio.h" DECOMP_SIZE_ASSERT(GasStation, 0x128) // GLOBAL: LEGO1 0x100f0160 undefined4 g_unk0x100f0160 = 3; +// GLOBAL: LEGO1 0x100f0164 +MxBool g_trackLedEnabled = FALSE; + // FUNCTION: LEGO1 0x100046a0 GasStation::GasStation() { @@ -31,7 +37,7 @@ GasStation::GasStation() m_unk0x106 = 0; m_unk0x10c = 0; m_unk0x115 = 0; - m_unk0x110 = 0; + m_trackLedTimer = 0; NotificationManager()->Register(this); } @@ -285,10 +291,14 @@ MxLong GasStation::HandleEndAction(MxEndActionNotificationParam& p_param) return 0; } -// STUB: LEGO1 0x10005920 +// FUNCTION: LEGO1 0x10005920 MxLong GasStation::HandleKeyPress(MxS8 p_key) { - // TODO + if (p_key == ' ' && g_unk0x100f0160 == 0 && this->m_unk0x106 != 0) { + m_state->FUN_10006490(); + return 1; + } + return 0; } @@ -299,11 +309,40 @@ MxLong GasStation::HandleButtonDown(LegoControlManagerEvent& p_param) return 0; } -// STUB: LEGO1 0x10005b20 +// FUNCTION: LEGO1 0x10005b20 MxLong GasStation::HandleClick(LegoControlManagerEvent& p_param) { - // TODO - return 0; + switch (p_param.GetClickedObjectId()) { + case GarageScript::c_LeftArrow_Ctl: + case GarageScript::c_RightArrow_Ctl: + m_state->m_unk0x14.m_unk0x00 = 0; + m_destLocation = LegoGameState::Area::e_garadoor; + + m_state->FUN_10006490(); + m_radio.Stop(); + BackgroundAudioManager()->Stop(); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + break; + case GarageScript::c_Info_Ctl: + m_state->m_unk0x14.m_unk0x00 = 0; + m_destLocation = LegoGameState::Area::e_infomain; + + m_state->FUN_10006490(); + m_radio.Stop(); + BackgroundAudioManager()->Stop(); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + break; + case GarageScript::c_Buggy_Ctl: + m_state->m_unk0x14.m_unk0x00 = 0; + m_destLocation = LegoGameState::Area::e_dunecarbuild; + + m_state->FUN_10006490(); + m_radio.Stop(); + BackgroundAudioManager()->Stop(); + TransitionManager()->StartTransition(MxTransitionManager::e_mosaic, 50, FALSE, FALSE); + break; + } + return 1; } // FUNCTION: LEGO1 0x10005c40 @@ -322,17 +361,50 @@ void GasStation::Enable(MxBool p_enable) } } -// STUB: LEGO1 0x10005c90 +// FUNCTION: LEGO1 0x10005c90 MxResult GasStation::Tickle() { - // TODO + if (!m_worldStarted) { + LegoWorld::Tickle(); + return SUCCESS; + } + + if (g_unk0x100f0160 != 0) { + g_unk0x100f0160--; + } + + MxLong time = Timer()->GetTime(); + if (m_unk0x114 != 0) { + if (time - m_unk0x10c > 15000) { + m_unk0x10c = time; + if (m_unk0x104 == 1) { + m_unk0x104 = 2; + } + else if (m_unk0x104 != 0) { + m_unk0x104 = 0; + m_state->m_unk0x14.m_unk0x00 = 9; + PlayAction(GarageScript::c_wgs031nu_RunAnim); + m_unk0x106 = 1; + } + } + } + if (m_unk0x115 != 0) { + if (time - m_trackLedTimer > 300) { + m_trackLedTimer = time; + g_trackLedEnabled = !g_trackLedEnabled; + m_trackLedBitmap->Enable(g_trackLedEnabled); + } + } return SUCCESS; } -// STUB: LEGO1 0x10005e70 +// FUNCTION: LEGO1 0x10005e70 MxBool GasStation::VTable0x64() { - // TODO - return FALSE; + m_radio.Stop(); + m_state->FUN_10006490(); + m_state->m_unk0x14.m_unk0x00 = 0; + m_destLocation = LegoGameState::Area::e_infomain; + return TRUE; }