GasStation::ReadyWorld (#765)

* Start GasStation::ReadyWorld

* fixes (up to 69.43%)

* what is this file and how did it get here

* don't hardcode (likely) action id

* Match FUN_10005590 (non-inlined version of PlayAction?)

* fixes (75.07%)

* Fixes (77.87%)

* style

* fix

* style

* style

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Joshua Peisach 2024-04-06 07:48:09 -04:00 committed by GitHub
parent 14cb3e621a
commit 4e74747451
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 190 additions and 20 deletions

View file

@ -5,6 +5,7 @@
#include "gasstationstate.h"
#include "legogamestate.h"
#include "legoworld.h"
#include "mxstillpresenter.h"
#include "radio.h"
// VTABLE: LEGO1 0x100d4650
@ -37,6 +38,8 @@ class GasStation : public LegoWorld {
void Enable(MxBool p_enable) override; // vtable+0x68
virtual MxLong HandleClick(LegoControlManagerEvent& p_param); // vtable+0x6c
inline void PlayAction(MxU32 p_objectId);
// SYNTHETIC: LEGO1 0x100048a0
// GasStation::`scalar deleting destructor'
@ -45,13 +48,13 @@ class GasStation : public LegoWorld {
MxLong HandleKeyPress(MxS8 p_key);
MxLong HandleButtonDown(LegoControlManagerEvent& p_param);
undefined2 m_unk0xf8; // 0xf8
MxS16 m_currentActorId; // 0xf8
undefined2 m_unk0xfa; // 0xfa
LegoGameState::Area m_destLocation; // 0xfc
GasStationState* m_state; // 0x100
undefined2 m_unk0x104; // 0x104
undefined2 m_unk0x106; // 0x106
undefined4 m_unk0x108; // 0x108
MxStillPresenter* m_trackLedBitmap; // 0x108
undefined4 m_unk0x10c; // 0x10c
undefined4 m_unk0x110; // 0x110
undefined m_unk0x114; // 0x114

View file

@ -32,16 +32,18 @@ class GasStationState : public LegoState {
// SYNTHETIC: LEGO1 0x10006290
// GasStationState::`scalar deleting destructor'
void FUN_10006430(undefined4);
friend class GasStation;
private:
undefined4 m_unk0x08[3]; // 0x08
Unknown0x14 m_unk0x14; // 0x14
undefined2 m_unk0x18; // 0x18
undefined2 m_unk0x1a; // 0x1a
undefined2 m_unk0x1c; // 0x1c
undefined2 m_unk0x1e; // 0x1e
undefined2 m_unk0x20; // 0x20
MxS16 m_unk0x18; // 0x18
MxS16 m_unk0x1a; // 0x1a
MxS16 m_unk0x1c; // 0x1c
MxS16 m_unk0x1e; // 0x1e
MxS16 m_unk0x20; // 0x20
};
#endif // GASSTATIONSTATE_H

View file

@ -23,3 +23,9 @@ MxResult GasStationState::VTable0x1c(LegoFile* p_legoFile)
// TODO
return SUCCESS;
}
// STUB: LEGO1 0x10006430
void GasStationState::FUN_10006430(undefined4)
{
// TODO
}

View file

@ -1,9 +1,15 @@
#include "gasstation.h"
#include "garage_actions.h"
#include "islepathactor.h"
#include "jukebox.h"
#include "jukebox_actions.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 "mxticklemanager.h"
@ -16,10 +22,10 @@ undefined4 g_unk0x100f0160 = 3;
// FUNCTION: LEGO1 0x100046a0
GasStation::GasStation()
{
m_unk0xf8 = 0;
m_currentActorId = 0;
m_state = NULL;
m_destLocation = LegoGameState::e_undefined;
m_unk0x108 = 0;
m_trackLedBitmap = NULL;
m_unk0x104 = 0;
m_unk0x114 = 0;
m_unk0x106 = 0;
@ -110,10 +116,166 @@ MxLong GasStation::Notify(MxParam& p_param)
return result;
}
// STUB: LEGO1 0x10004b30
// FUNCTION: LEGO1 0x10004b30
void GasStation::ReadyWorld()
{
// TODO
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);
}
// STUB: LEGO1 0x10005660

View file

@ -47,6 +47,9 @@ class MxDSObject : public MxCore {
virtual undefined4 VTable0x14(); // vtable+14;
virtual MxU32 GetSizeOnDisk(); // vtable+18;
virtual void Deserialize(MxU8*& p_source, MxS16 p_unk0x24); // vtable+1c;
// FUNCTION: ISLE 0x401c40
// FUNCTION: LEGO1 0x10005530
inline virtual void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } // vtable+20;
inline Type GetType() const { return (Type) this->m_type; }
@ -81,10 +84,4 @@ class MxDSObject : public MxCore {
MxDSObject* DeserializeDSObjectDispatch(MxU8*&, MxS16);
// FUNCTION: ISLE 0x401c40
// MxDSObject::SetAtomId
// FUNCTION: LEGO1 0x10005530
// MxDSObject::SetAtomId
#endif // MXDSOBJECT_H