diff --git a/LEGO1/lego/legoomni/include/legoactor.h b/LEGO1/lego/legoomni/include/legoactor.h index 114bf4bb..bd24137f 100644 --- a/LEGO1/lego/legoomni/include/legoactor.h +++ b/LEGO1/lego/legoomni/include/legoactor.h @@ -41,16 +41,18 @@ class LegoActor : public LegoEntity { virtual MxFloat VTable0x5c() { return m_unk0x70; } // vtable+0x5c // FUNCTION: LEGO1 0x10002d00 - virtual MxU8 VTable0x60() { return m_unk0x74; } // vtable+0x60 + virtual MxU8 GetActorId() { return m_actorId; } // vtable+0x60 // FUNCTION: LEGO1 0x10002d10 - virtual void VTable0x64(MxU8 p_unk0x74) { m_unk0x74 = p_unk0x74; } // vtable+0x64 + virtual void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; } // vtable+0x64 + + static const char* GetActorName(MxU8 p_id); private: MxFloat m_unk0x68; // 0x68 LegoCacheSound* m_sound; // 0x6c MxFloat m_unk0x70; // 0x70 - MxU8 m_unk0x74; // 0x74 + MxU8 m_actorId; // 0x74 }; // SYNTHETIC: LEGO1 0x1002d300 diff --git a/LEGO1/lego/legoomni/include/legoentity.h b/LEGO1/lego/legoomni/include/legoentity.h index d0f64079..68a246b5 100644 --- a/LEGO1/lego/legoomni/include/legoentity.h +++ b/LEGO1/lego/legoomni/include/legoentity.h @@ -63,6 +63,7 @@ class LegoEntity : public MxEntity { inline MxU8 GetFlags() { return m_flags; } inline void SetFlags(MxU8 p_flags) { m_flags = p_flags; } + inline void ClearFlag(MxU8 p_flag) { m_flags &= ~p_flag; } protected: void Init(); diff --git a/LEGO1/lego/legoomni/include/legogamestate.h b/LEGO1/lego/legoomni/include/legogamestate.h index e4458213..e99ba759 100644 --- a/LEGO1/lego/legoomni/include/legogamestate.h +++ b/LEGO1/lego/legoomni/include/legogamestate.h @@ -88,8 +88,10 @@ class LegoGameState { }; // SIZE 0x0c - struct ScoreName { - ScoreName* operator=(const ScoreName* p_other); + struct Username { + Username(); + MxResult ReadWrite(LegoStorage* p_stream); + Username* operator=(const Username* p_other); MxS16 m_letters[7]; // 0x00 }; @@ -97,13 +99,14 @@ class LegoGameState { // SIZE 0x2c struct ScoreItem { undefined2 m_unk0x00; // 0x00 - MxU8 m_state[25]; // 0x02 - ScoreName m_name; // 0x1c + MxU8 m_state[5][5]; // 0x02 + Username m_name; // 0x1c undefined2 m_unk0x2a; // 0x2a }; // SIZE 0x372 - struct Scores { + struct History { + History(); void WriteScoreHistory(); void FUN_1003ccf0(LegoFile&); @@ -111,6 +114,7 @@ class LegoGameState { MxS16 m_count; // 0x00 ScoreItem m_scores[20]; // 0x02 + undefined2 m_unk0x372; // 0x372 }; LegoGameState(); @@ -129,25 +133,25 @@ class LegoGameState { void StopArea(Area p_area); void SwitchArea(Area p_area); - inline MxU8 GetUnknownC() { return m_unk0x0c; } + inline MxU8 GetActorId() { return m_actorId; } inline Act GetCurrentAct() { return m_currentAct; } inline Act GetLoadedAct() { return m_loadedAct; } inline Area GetCurrentArea() { return m_currentArea; } inline Area GetPreviousArea() { return m_previousArea; } inline MxU32 GetUnknown0x41c() { return m_unk0x41c; } inline Area GetUnknown0x42c() { return m_unk0x42c; } - inline Scores* GetScores() { return &m_unk0xa6; } + inline History* GetHistory() { return &m_history; } inline void SetDirty(MxBool p_dirty) { m_isDirty = p_dirty; } inline void SetCurrentArea(Area p_currentArea) { m_currentArea = p_currentArea; } inline void SetPreviousArea(Area p_previousArea) { m_previousArea = p_previousArea; } - inline void SetUnknown0x0c(MxU8 p_unk0x0c) { m_unk0x0c = p_unk0x0c; } + inline void SetActorId(MxU8 p_actorId) { m_actorId = p_actorId; } inline void SetUnknown0x41c(undefined4 p_unk0x41c) { m_unk0x41c = p_unk0x41c; } inline void SetUnknown0x42c(Area p_unk0x42c) { m_unk0x42c = p_unk0x42c; } void SetCurrentAct(Act p_currentAct); void FindLoadedAct(); - void FUN_10039780(MxU8); + void SetVehicle(MxU8 p_actorId); void FUN_10039940(); private: @@ -155,21 +159,23 @@ class LegoGameState { MxResult WriteVariable(LegoStorage* p_stream, MxVariableTable* p_from, const char* p_variableName); MxResult WriteEndOfVariables(LegoStorage* p_stream); MxS32 ReadVariable(LegoStorage* p_stream, MxVariableTable* p_to); + void SetColors(); void SetROIHandlerFunction(); char* m_savePath; // 0x00 MxS16 m_stateCount; // 0x04 LegoState** m_stateArray; // 0x08 - MxU8 m_unk0x0c; // 0x0c + MxU8 m_actorId; // 0x0c Act m_currentAct; // 0x10 Act m_loadedAct; // 0x14 LegoBackgroundColor* m_backgroundColor; // 0x18 LegoBackgroundColor* m_tempBackgroundColor; // 0x1c LegoFullScreenMovie* m_fullScreenMovie; // 0x20 MxU16 m_unk0x24; // 0x24 - undefined m_unk0x26[128]; // 0x26 - Scores m_unk0xa6; // 0xa6 - undefined4 m_unk0x418; // 0x418 + undefined2 m_unk0x26; // 0x26 + Username m_players[9]; // 0x28 + History m_history; // 0xa6 + undefined2 m_unk0x41a; // 0x41a undefined4 m_unk0x41c; // 0x41c MxBool m_isDirty; // 0x420 Area m_currentArea; // 0x424 diff --git a/LEGO1/lego/legoomni/include/legoomni.h b/LEGO1/lego/legoomni/include/legoomni.h index c66df6fc..91d49d34 100644 --- a/LEGO1/lego/legoomni/include/legoomni.h +++ b/LEGO1/lego/legoomni/include/legoomni.h @@ -228,6 +228,7 @@ class LegoOmni : public MxOmni { LegoWorldList* GetWorldList() { return m_worldList; } inline void SetNavController(LegoNavController* p_navController) { m_navController = p_navController; } + inline void SetCurrentVehicle(IslePathActor* p_currentVehicle) { m_currentVehicle = p_currentVehicle; } inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } inline void SetExit(MxBool p_exit) { m_exit = p_exit; } @@ -280,6 +281,7 @@ LegoTextureContainer* TextureContainer(); ViewLODListManager* GetViewLODListManager(); void FUN_10015820(MxBool p_disable, MxU16 p_flags); void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c); +void SetCurrentVehicle(IslePathActor* p_currentVehicle); LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid); LegoROI* FindROI(const char* p_name); MxDSAction& GetCurrentAction(); diff --git a/LEGO1/lego/legoomni/include/legopathactor.h b/LEGO1/lego/legoomni/include/legopathactor.h index c2a2026c..15cbce4c 100644 --- a/LEGO1/lego/legoomni/include/legopathactor.h +++ b/LEGO1/lego/legoomni/include/legopathactor.h @@ -65,13 +65,18 @@ class LegoPathActor : public LegoActor { // FUNCTION: LEGO1 0x10002de0 virtual void VTable0xc8(MxU8 p_unk0x148) { m_unk0x148 = p_unk0x148; } // vtable+0xc8 + inline MxU32 GetUnknown88() { return m_unk0x88; } + + inline void SetUnknown88(MxU32 p_unk0x88) { m_unk0x88 = p_unk0x88; } inline void SetUnknownDC(MxU32 p_unk0xdc) { m_unk0xdc = p_unk0xdc; } // SYNTHETIC: LEGO1 0x1002d800 // LegoPathActor::`scalar deleting destructor' protected: - undefined m_unk0x78[0x64]; // 0x78 + undefined m_unk0x78[0x10]; // 0x78 + MxU32 m_unk0x88; // 0x88 + undefined m_unk0x8c[0x50]; // 0x8c MxU32 m_unk0xdc; // 0xdc undefined m_unk0xe0[0xa]; // 0xe0 MxU8 m_unk0xea; // 0xea diff --git a/LEGO1/lego/legoomni/include/legounksavedatawriter.h b/LEGO1/lego/legoomni/include/legounksavedatawriter.h index 7dd38998..b47bc116 100644 --- a/LEGO1/lego/legoomni/include/legounksavedatawriter.h +++ b/LEGO1/lego/legoomni/include/legounksavedatawriter.h @@ -56,7 +56,7 @@ class LegoUnkSaveDataWriter { LegoUnkSaveDataWriter(); MxResult WriteSaveData3(LegoStorage* p_stream); - LegoROI* FUN_10083500(char*, MxBool); + LegoROI* FUN_10083500(const char*, MxBool); static void InitSaveData(); static void SetCustomizeAnimFile(const char* p_value); diff --git a/LEGO1/lego/legoomni/src/build/helicopter.cpp b/LEGO1/lego/legoomni/src/build/helicopter.cpp index d4888773..85b1c476 100644 --- a/LEGO1/lego/legoomni/src/build/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/build/helicopter.cpp @@ -103,7 +103,7 @@ MxU32 Helicopter::VTable0xcc() AnimationManager()->FUN_1005f6d0(FALSE); if (CurrentVehicle()) { - if (CurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) { + if (CurrentVehicle()->GetActorId() != GameState()->GetActorId()) { CurrentVehicle()->VTable0xe4(); } } diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 0c43d19e..d79ef091 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -8,6 +8,7 @@ #include "legonavcontroller.h" #include "legoomni.h" #include "legostate.h" +#include "legounksavedatawriter.h" #include "legoutil.h" #include "legovideomanager.h" #include "legoworld.h" @@ -19,9 +20,9 @@ #include -DECOMP_SIZE_ASSERT(LegoGameState::ScoreName, 0xe) +DECOMP_SIZE_ASSERT(LegoGameState::Username, 0xe) DECOMP_SIZE_ASSERT(LegoGameState::ScoreItem, 0x2c) -DECOMP_SIZE_ASSERT(LegoGameState::Scores, 0x372) +DECOMP_SIZE_ASSERT(LegoGameState::History, 0x374) DECOMP_SIZE_ASSERT(LegoGameState, 0x430) // GLOBAL: LEGO1 0x100f3e40 @@ -45,21 +46,28 @@ const char* g_endOfVariables = "END_OF_VARIABLES"; // 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"}, + {"c_dbbkfny0", "lego red"}, {"c_dbbkxly0", "lego white"}, // dunebuggy back fender, dunebuggy back axle + {"c_chbasey0", "lego black"}, {"c_chbacky0", "lego black"}, // copter base, copter back + {"c_chdishy0", "lego white"}, {"c_chhorny0", "lego black"}, // copter dish, copter horn + {"c_chljety1", "lego black"}, {"c_chrjety1", "lego black"}, // copter left jet, copter right jet + {"c_chmidly0", "lego black"}, {"c_chmotry0", "lego blue"}, // copter middle, copter motor + {"c_chsidly0", "lego black"}, {"c_chsidry0", "lego black"}, // copter side left, copter side right + {"c_chstuty0", "lego black"}, {"c_chtaily0", "lego black"}, // copter ???, copter tail + {"c_chwindy1", "lego black"}, {"c_dbfbrdy0", "lego red"}, // copter ???, dunebuggy ??? + {"c_dbflagy0", "lego yellow"}, {"c_dbfrfny4", "lego red"}, // dunebuggy flag, dunebuggy front fender + {"c_dbfrxly0", "lego white"}, {"c_dbhndly0", "lego white"}, // dunebuggy front axle, dunebuggy handlebar + {"c_dbltbry0", "lego white"}, {"c_jsdashy0", "lego white"}, // dunebuggy ???, jetski dash + {"c_jsexhy0", "lego black"}, {"c_jsfrnty5", "lego black"}, // jetski exhaust, jetski front + {"c_jshndly0", "lego red"}, {"c_jslsidy0", "lego black"}, // jetski handlebar, jetski left side + {"c_jsrsidy0", "lego black"}, {"c_jsskiby0", "lego red"}, // jetski right side, jetski ??? + {"c_jswnshy5", "lego white"}, {"c_rcbacky6", "lego green"}, // jetski windshield, racecar back + {"c_rcedgey0", "lego green"}, {"c_rcfrmey0", "lego red"}, // racecar edge, racecar frame + {"c_rcfrnty6", "lego green"}, {"c_rcmotry0", "lego white"}, // racecar front, racecar motor + {"c_rcsidey0", "lego green"}, {"c_rcstery0", "lego white"}, // racecar side, racecar steering wheel + {"c_rcstrpy0", "lego yellow"}, {"c_rctailya", "lego white"}, // racecar stripe, racecar tail + {"c_rcwhl1y0", "lego white"}, {"c_rcwhl2y0", "lego white"}, // racecar wheels 1, racecar wheels 2 + {"c_jsbasey0", "lego white"}, {"c_chblady0", "lego black"}, // jetski base, copter blades + {"c_chseaty0", "lego white"}, // copter seat }; // NOTE: This offset = the end of the variables table, the last entry @@ -69,17 +77,21 @@ extern const char* g_endOfVariables; // FUNCTION: LEGO1 0x10039550 LegoGameState::LegoGameState() { - // TODO + SetColors(); SetROIHandlerFunction(); - this->m_stateCount = 0; - this->m_unk0x0c = 0; - this->m_savePath = NULL; - this->m_currentArea = e_noArea; - this->m_previousArea = e_noArea; - this->m_unk0x42c = e_noArea; - this->m_isDirty = FALSE; - this->m_loadedAct = e_actNotFound; + m_stateCount = 0; + m_actorId = 0; + m_savePath = NULL; + m_stateArray = NULL; + m_unk0x41c = -1; + m_unk0x26 = 0; + m_currentArea = e_noArea; + m_previousArea = e_noArea; + m_unk0x42c = e_noArea; + m_isDirty = FALSE; + m_loadedAct = e_actNotFound; + SetCurrentAct(e_act1); m_backgroundColor = new LegoBackgroundColor("backgroundcolor", "set 56 54 68"); VariableTable()->SetVariable(m_backgroundColor); @@ -113,10 +125,29 @@ LegoGameState::~LegoGameState() delete[] m_savePath; } -// STUB: LEGO1 0x10039780 -void LegoGameState::FUN_10039780(MxU8) +// FUNCTION: LEGO1 0x10039780 +void LegoGameState::SetVehicle(MxU8 p_actorId) { - // TODO + if (p_actorId) { + m_actorId = p_actorId; + } + IslePathActor* oldVehicle = CurrentVehicle(); + SetCurrentVehicle(NULL); + IslePathActor* newVehicle = new IslePathActor(); + LegoROI* roi = UnkSaveDataWriter()->FUN_10083500(LegoActor::GetActorName(m_actorId), FALSE); + MxDSAction action; + action.SetAtomId(*g_isleScript); + action.SetObjectId(100000); + newVehicle->Create(action); + newVehicle->SetActorId(p_actorId); + newVehicle->SetROI(roi, FALSE, FALSE); + if (oldVehicle) { + newVehicle->GetROI()->FUN_100a58f0(oldVehicle->GetROI()->GetLocal2World()); + newVehicle->SetUnknown88(oldVehicle->GetUnknown88()); + delete oldVehicle; + } + newVehicle->ClearFlag(0x2); + SetCurrentVehicle(newVehicle); } // STUB: LEGO1 0x10039940 @@ -145,7 +176,7 @@ MxResult LegoGameState::Save(MxULong p_slot) fileStream.Write(&maybeVersion, 4); fileStream.Write(&m_unk0x24, 2); fileStream.Write(&m_currentAct, 2); - fileStream.Write(&m_unk0x0c, 1); + fileStream.Write(&m_actorId, 1); for (MxS32 i = 0; i < sizeof(g_colorSaveData) / sizeof(g_colorSaveData[0]); ++i) { if (WriteVariable(&fileStream, variableTable, g_colorSaveData[i].m_targetName) == FAILURE) { @@ -649,6 +680,15 @@ void LegoGameState::SwitchArea(Area p_area) } } +// FUNCTION: LEGO1 0x1003ba90 +void LegoGameState::SetColors() +{ + MxVariableTable* variables = VariableTable(); + for (int i = 0; i < _countof(g_colorSaveData); i++) { + variables->SetVariable(g_colorSaveData[i].m_targetName, g_colorSaveData[i].m_colorName); + } +} + // FUNCTION: LEGO1 0x1003bac0 void LegoGameState::SetROIHandlerFunction() { @@ -725,21 +765,50 @@ void LegoGameState::RegisterState(LegoState* p_state) m_stateArray[targetIndex] = p_state; } +// FUNCTION: LEGO1 0x1003c670 +LegoGameState::Username::Username() +{ + memset(m_letters, 0, sizeof(m_letters)); +} + +// FUNCTION: LEGO1 0x1003c690 +MxResult LegoGameState::Username::ReadWrite(LegoStorage* p_stream) +{ + if (p_stream->IsReadMode()) { + for (MxS16 i = 0; i < 7; i++) { + p_stream->Read(&m_letters[i], 2); + } + } + else if (p_stream->IsWriteMode()) { + for (MxS16 i = 0; i < 7; i++) { + p_stream->Write(&m_letters[i], 2); + } + } + return SUCCESS; +} + // FUNCTION: LEGO1 0x1003c710 -LegoGameState::ScoreName* LegoGameState::ScoreName::operator=(const ScoreName* p_other) +LegoGameState::Username* LegoGameState::Username::operator=(const Username* p_other) { memcpy(m_letters, p_other->m_letters, sizeof(m_letters)); return this; } +// FUNCTION: LEGO1 0x1003c830 +LegoGameState::History::History() +{ + m_count = 0; + m_unk0x372 = 0; +} + // STUB: LEGO1 0x1003c870 -void LegoGameState::Scores::WriteScoreHistory() +void LegoGameState::History::WriteScoreHistory() { // TODO } // STUB: LEGO1 0x1003ccf0 -void LegoGameState::Scores::FUN_1003ccf0(LegoFile&) +void LegoGameState::History::FUN_1003ccf0(LegoFile&) { // TODO } @@ -753,11 +822,11 @@ void LegoGameState::SerializeScoreHistory(MxS16 p_flags) savePath += g_historyGSI; if (p_flags == LegoFile::c_write) { - m_unk0xa6.WriteScoreHistory(); + m_history.WriteScoreHistory(); } if (stream.Open(savePath.GetData(), p_flags) == SUCCESS) { - m_unk0xa6.FUN_1003ccf0(stream); + m_history.FUN_1003ccf0(stream); } } diff --git a/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp b/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp index 2fdc658c..4a7a605a 100644 --- a/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp +++ b/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp @@ -90,7 +90,7 @@ MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_stream) } // STUB: LEGO1 0x10083500 -LegoROI* LegoUnkSaveDataWriter::FUN_10083500(char* p_key, MxBool p_option) +LegoROI* LegoUnkSaveDataWriter::FUN_10083500(const char* p_key, MxBool p_option) { // TODO // involves an STL map with a _Nil node at 0x100fc508 diff --git a/LEGO1/lego/legoomni/src/entity/legoactor.cpp b/LEGO1/lego/legoomni/src/entity/legoactor.cpp index 4fc0daa2..8932217e 100644 --- a/LEGO1/lego/legoomni/src/entity/legoactor.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoactor.cpp @@ -3,7 +3,7 @@ DECOMP_SIZE_ASSERT(LegoActor, 0x78) // GLOBAL: LEGO1 0x100f32d0 -const char* g_unk0x100f32d0[] = {"none", "pepper", "mama", "papa", "nick", "laura", "The_Brickster!"}; +const char* g_actorNames[] = {"none", "pepper", "mama", "papa", "nick", "laura", "The_Brickster!"}; // FUNCTION: LEGO1 0x1002d110 LegoActor::LegoActor() @@ -12,7 +12,7 @@ LegoActor::LegoActor() m_sound = NULL; m_unk0x70 = 0.0f; m_unk0x10 = 0; - m_unk0x74 = 0; + m_actorId = 0; } // FUNCTION: LEGO1 0x1002d320 @@ -29,16 +29,22 @@ void LegoActor::ParseAction(char*) // TODO } +// FUNCTION: LEGO1 0x1002d660 +const char* LegoActor::GetActorName(MxU8 p_id) +{ + return g_actorNames[p_id]; +} + // FUNCTION: LEGO1 0x1002d670 void LegoActor::SetROI(LegoROI* p_roi, MxBool p_bool1, MxBool p_bool2) { if (p_roi) { const char* name = p_roi->GetName(); - for (MxU32 i = 1; i <= _countof(g_unk0x100f32d0) - 1; i++) { - if (!strcmpi(name, g_unk0x100f32d0[i])) { + for (MxU32 i = 1; i <= _countof(g_actorNames) - 1; i++) { + if (!strcmpi(name, g_actorNames[i])) { m_unk0x59 = 0; - m_unk0x74 = i; + m_actorId = i; break; } } diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp index cef49c68..6801ad5e 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp @@ -201,7 +201,7 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) if (!m_unk0x1d4) { PlayMusic(JukeBox::e_informationCenter); - GameState()->FUN_10039780(m_selectedCharacter); + GameState()->SetVehicle(m_selectedCharacter); switch (m_selectedCharacter) { case e_pepper: @@ -303,7 +303,7 @@ MxLong Infocenter::HandleEndAction(MxEndActionNotificationParam& p_param) case 5: if (action->GetObjectId() == m_currentInfomainScript) { if (GameState()->GetCurrentAct() != LegoGameState::e_act3 && m_selectedCharacter != e_noCharacter) { - GameState()->FUN_10039780(m_selectedCharacter); + GameState()->SetVehicle(m_selectedCharacter); } TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE); m_infocenterState->SetUnknown0x74(14); @@ -734,7 +734,7 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) switch (m_mapAreas[m_unk0x1c8].m_unk0x04) { case 3: - GameState()->FUN_10039780(m_selectedCharacter); + GameState()->SetVehicle(m_selectedCharacter); switch (m_selectedCharacter) { case e_pepper: @@ -810,23 +810,23 @@ MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y) switch (m_selectedCharacter) { case e_pepper: dialogueToPlay = c_pepperCharacterSelect; - GameState()->SetUnknown0x0c(m_selectedCharacter); + GameState()->SetActorId(m_selectedCharacter); break; case e_mama: dialogueToPlay = c_mamaCharacterSelect; - GameState()->SetUnknown0x0c(m_selectedCharacter); + GameState()->SetActorId(m_selectedCharacter); break; case e_papa: dialogueToPlay = c_papaCharacterSelect; - GameState()->SetUnknown0x0c(m_selectedCharacter); + GameState()->SetActorId(m_selectedCharacter); break; case e_nick: dialogueToPlay = c_nickCharacterSelect; - GameState()->SetUnknown0x0c(m_selectedCharacter); + GameState()->SetActorId(m_selectedCharacter); break; case e_laura: dialogueToPlay = c_lauraCharacterSelect; - GameState()->SetUnknown0x0c(m_selectedCharacter); + GameState()->SetActorId(m_selectedCharacter); break; default: dialogueToPlay = @@ -948,7 +948,7 @@ MxU8 Infocenter::HandleClick(LegoControlManagerEvent& p_param) InputManager()->SetUnknown336(TRUE); break; case LegoGameState::e_unk4: - if (state->GetUnknownC()) { + if (state->GetActorId()) { if (m_infocenterState->HasRegistered()) { m_infocenterState->SetUnknown0x74(5); m_transitionDestination = state->GetPreviousArea(); @@ -1228,7 +1228,7 @@ void Infocenter::UpdateFrameHot(MxBool p_display) if (p_display) { MxS32 x, y; - switch (GameState()->GetUnknownC()) { + switch (GameState()->GetActorId()) { case 1: x = 302; y = 81; @@ -1292,7 +1292,7 @@ void Infocenter::Reset() InitializeBitmaps(); m_selectedCharacter = e_pepper; - GameState()->FUN_10039780(e_pepper); + GameState()->SetVehicle(e_pepper); HelicopterState* state = (HelicopterState*) GameState()->GetState("HelicopterState"); diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp index 74d1cfdc..2553956b 100644 --- a/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp +++ b/LEGO1/lego/legoomni/src/infocenter/infocenterdoor.cpp @@ -109,7 +109,7 @@ MxLong InfocenterDoor::HandleClick(LegoControlManagerEvent& p_param) result = 1; break; case 4: - if (GameState()->GetUnknownC()) { + if (GameState()->GetActorId()) { InfocenterState* state = (InfocenterState*) GameState()->GetState("InfocenterState"); if (state->HasRegistered()) { m_unk0xf8 = LegoGameState::e_unk4; diff --git a/LEGO1/lego/legoomni/src/isle/historybook.cpp b/LEGO1/lego/legoomni/src/isle/historybook.cpp index 981d3018..33659bf5 100644 --- a/LEGO1/lego/legoomni/src/isle/historybook.cpp +++ b/LEGO1/lego/legoomni/src/isle/historybook.cpp @@ -80,7 +80,7 @@ inline void SetColor(MxStillPresenter* p_presenter, MxU8 p_color, MxU8* p_colors void HistoryBook::ReadyWorld() { LegoWorld::ReadyWorld(); - GameState()->GetScores()->WriteScoreHistory(); + GameState()->GetHistory()->WriteScoreHistory(); char bitmap[] = "A_Bitmap"; for (MxS16 i = 0; i < 26; i++) { @@ -93,8 +93,8 @@ void HistoryBook::ReadyWorld() {0x76, 0x4c, 0x38}; // yellow - #FFB900, blue - #00548C, red - #CB1220, background - #CECECE, border - #74818B MxS32 scoreY = 0x79; - for (MxS16 scoreIndex = 0; scoreIndex < GameState()->GetScores()->m_count; scoreIndex++) { - LegoGameState::ScoreItem* score = GameState()->GetScores()->GetScore(scoreIndex); + 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(); @@ -110,14 +110,14 @@ void HistoryBook::ReadyWorld() MxS32 scoreboxX = 1; MxS32 scoreboxRow = 5; - MxU8* scoreState = score->m_state; + MxS32 scoreState = 0; for (; scoreboxRow > 0; scoreboxRow--) { for (MxS32 scoreBoxColumn = 0, scoreboxY = 1; scoreBoxColumn < 5; scoreBoxColumn++, scoreboxY += 5) { - SetColor(*scorebox, scoreState[scoreBoxColumn], scoreColors, scoreboxX, scoreboxY); + SetColor(*scorebox, score->m_state[scoreState][scoreBoxColumn], scoreColors, scoreboxX, scoreboxY); } - scoreState += 5; + scoreState++; scoreboxX += 5; } diff --git a/LEGO1/lego/legoomni/src/isle/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/isle/jukeboxentity.cpp index 47d81510..0a8452ac 100644 --- a/LEGO1/lego/legoomni/src/isle/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/isle/jukeboxentity.cpp @@ -29,7 +29,7 @@ MxLong JukeBoxEntity::Notify(MxParam& p_param) return 1; } - if (CurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) { + if (CurrentVehicle()->GetActorId() != GameState()->GetActorId()) { CurrentVehicle()->VTable0xe4(); } diff --git a/LEGO1/lego/legoomni/src/main/legoomni.cpp b/LEGO1/lego/legoomni/src/main/legoomni.cpp index f0081e2c..1fe109b0 100644 --- a/LEGO1/lego/legoomni/src/main/legoomni.cpp +++ b/LEGO1/lego/legoomni/src/main/legoomni.cpp @@ -248,6 +248,12 @@ void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c) } } +// FUNCTION: LEGO1 0x10015880 +void SetCurrentVehicle(IslePathActor* p_currentVehicle) +{ + LegoOmni::GetInstance()->SetCurrentVehicle(p_currentVehicle); +} + // FUNCTION: LEGO1 0x100158c0 LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid) { diff --git a/LEGO1/lego/legoomni/src/police/policestate.cpp b/LEGO1/lego/legoomni/src/police/policestate.cpp index 07ef3a55..df3702aa 100644 --- a/LEGO1/lego/legoomni/src/police/policestate.cpp +++ b/LEGO1/lego/legoomni/src/police/policestate.cpp @@ -44,7 +44,7 @@ void PoliceState::FUN_1005ea40() return; } - switch (CurrentVehicle()->VTable0x60()) { + switch (CurrentVehicle()->GetActorId()) { case 4: policeScript = Police::PoliceScript::c_lauraAnim; m_policeScript = policeScript; diff --git a/LEGO1/lego/sources/roi/legoroi.cpp b/LEGO1/lego/sources/roi/legoroi.cpp index 3463022e..9086b286 100644 --- a/LEGO1/lego/sources/roi/legoroi.cpp +++ b/LEGO1/lego/sources/roi/legoroi.cpp @@ -50,7 +50,7 @@ void LegoROI::FUN_100a46b0(Matrix4& p_transform) } // STUB: LEGO1 0x100a58f0 -void LegoROI::FUN_100a58f0(Matrix4& p_transform) +void LegoROI::FUN_100a58f0(const Matrix4& p_transform) { } diff --git a/LEGO1/lego/sources/roi/legoroi.h b/LEGO1/lego/sources/roi/legoroi.h index ab2b45d1..c84f3eba 100644 --- a/LEGO1/lego/sources/roi/legoroi.h +++ b/LEGO1/lego/sources/roi/legoroi.h @@ -46,7 +46,7 @@ class LegoROI : public ViewROI { void WrappedSetLocalTransform(Matrix4& p_transform); void FUN_100a46b0(Matrix4& p_transform); - void FUN_100a58f0(Matrix4& p_transform); + void FUN_100a58f0(const Matrix4& p_transform); inline const char* GetName() const { return m_name; } inline LegoEntity* GetUnknown0x104() { return m_unk0x104; }