From 124b73046bc43a0cf835793575220be685cf8360 Mon Sep 17 00:00:00 2001 From: Nathan M Gilbert Date: Mon, 26 Feb 2024 11:19:16 -0500 Subject: [PATCH] Continued work on LegoGameState (#596) * Continued work on LegoGameState * Fixes/matches/refactor --------- Co-authored-by: Christian Semmler --- LEGO1/lego/legoomni/include/legoactor.h | 8 +- LEGO1/lego/legoomni/include/legoentity.h | 1 + LEGO1/lego/legoomni/include/legogamestate.h | 41 ++-- LEGO1/lego/legoomni/include/legoomni.h | 8 +- LEGO1/lego/legoomni/include/legopathactor.h | 7 +- .../legoomni/include/legounksavedatawriter.h | 4 +- LEGO1/lego/legoomni/src/build/helicopter.cpp | 12 +- .../legoomni/src/common/legogamestate.cpp | 190 +++++++++++++----- .../src/common/legounksavedatawriter.cpp | 25 +-- LEGO1/lego/legoomni/src/entity/legoactor.cpp | 16 +- LEGO1/lego/legoomni/src/entity/legoworld.cpp | 6 +- .../legoomni/src/infocenter/infocenter.cpp | 22 +- .../src/infocenter/infocenterdoor.cpp | 2 +- LEGO1/lego/legoomni/src/isle/historybook.cpp | 12 +- LEGO1/lego/legoomni/src/isle/isle.cpp | 6 +- .../lego/legoomni/src/isle/jukeboxentity.cpp | 4 +- LEGO1/lego/legoomni/src/main/legoomni.cpp | 12 +- .../lego/legoomni/src/police/policestate.cpp | 2 +- .../src/towtrack/towtrackmissionstate.cpp | 40 ++-- LEGO1/lego/sources/roi/legoroi.cpp | 2 +- LEGO1/lego/sources/roi/legoroi.h | 2 +- 21 files changed, 268 insertions(+), 154 deletions(-) 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..59dc8784 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_storage); + 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,47 +133,49 @@ 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 SetActor(MxU8 p_actorId); void FUN_10039940(); private: void RegisterState(LegoState* p_state); - 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); + MxResult WriteVariable(LegoStorage* p_storage, MxVariableTable* p_from, const char* p_variableName); + MxResult WriteEndOfVariables(LegoStorage* p_storage); + MxS32 ReadVariable(LegoStorage* p_storage, 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 @@ -179,4 +185,7 @@ class LegoGameState { MxBool ROIHandlerFunction(char* p_input, char* p_output, MxU32 p_copyLen); +// SYNTHETIC: LEGO1 0x1003c860 +// LegoGameState::ScoreItem::ScoreItem + #endif // LEGOGAMESTATE_H diff --git a/LEGO1/lego/legoomni/include/legoomni.h b/LEGO1/lego/legoomni/include/legoomni.h index c66df6fc..19324e42 100644 --- a/LEGO1/lego/legoomni/include/legoomni.h +++ b/LEGO1/lego/legoomni/include/legoomni.h @@ -216,7 +216,7 @@ class LegoOmni : public MxOmni { ViewLODListManager* GetViewLODListManager() { return m_viewLODListManager; } LegoWorld* GetCurrentWorld() { return m_currentWorld; } LegoNavController* GetNavController() { return m_navController; } - IslePathActor* GetCurrentVehicle() { return m_currentVehicle; } + IslePathActor* GetCurrentActor() { return m_currentActor; } LegoPlantManager* GetLegoPlantManager() { return m_plantManager; } LegoAnimationManager* GetAnimationManager() { return m_animationManager; } LegoBuildingManager* GetLegoBuildingManager() { return m_buildingManager; } @@ -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 SetCurrentActor(IslePathActor* p_currentActor) { m_currentActor = p_currentActor; } inline void SetCurrentWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; } inline void SetExit(MxBool p_exit) { m_exit = p_exit; } @@ -245,7 +246,7 @@ class LegoOmni : public MxOmni { LegoWorld* m_currentWorld; // 0x7c MxBool m_exit; // 0x80 LegoNavController* m_navController; // 0x84 - IslePathActor* m_currentVehicle; // 0x88 + IslePathActor* m_currentActor; // 0x88 LegoUnkSaveDataWriter* m_saveDataWriter; // 0x8c LegoPlantManager* m_plantManager; // 0x90 LegoAnimationManager* m_animationManager; // 0x94 @@ -271,7 +272,7 @@ LegoAnimationManager* AnimationManager(); LegoNavController* NavController(); LegoBuildingManager* BuildingManager(); LegoControlManager* ControlManager(); -IslePathActor* CurrentVehicle(); +IslePathActor* CurrentActor(); ViewManager* GetViewManager(); LegoPlantManager* PlantManager(); LegoWorld* CurrentWorld(); @@ -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 SetCurrentActor(IslePathActor* p_currentActor); 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..deea67b0 100644 --- a/LEGO1/lego/legoomni/include/legounksavedatawriter.h +++ b/LEGO1/lego/legoomni/include/legounksavedatawriter.h @@ -55,8 +55,8 @@ class LegoUnkSaveDataWriter { public: LegoUnkSaveDataWriter(); - MxResult WriteSaveData3(LegoStorage* p_stream); - LegoROI* FUN_10083500(char*, MxBool); + MxResult WriteSaveData3(LegoStorage* p_storage); + 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..c4d610a6 100644 --- a/LEGO1/lego/legoomni/src/build/helicopter.cpp +++ b/LEGO1/lego/legoomni/src/build/helicopter.cpp @@ -67,9 +67,9 @@ void Helicopter::VTable0xe4() if (GameState()->GetCurrentAct() == LegoGameState::e_act1) { GameState()->SetCurrentArea(LegoGameState::e_unk60); - if (CurrentVehicle()) { - if (CurrentVehicle()->IsA("IslePathActor")) { - ((IslePathActor*) CurrentVehicle())->VTable0xe8(0x37, TRUE, 7); + if (CurrentActor()) { + if (CurrentActor()->IsA("IslePathActor")) { + ((IslePathActor*) CurrentActor())->VTable0xe8(0x37, TRUE, 7); } } } @@ -102,9 +102,9 @@ MxU32 Helicopter::VTable0xcc() AnimationManager()->FUN_1005f6d0(FALSE); - if (CurrentVehicle()) { - if (CurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) { - CurrentVehicle()->VTable0xe4(); + if (CurrentActor()) { + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + CurrentActor()->VTable0xe4(); } } diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 0c43d19e..9f1c6482 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,22 +77,26 @@ 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_currentArea = e_noArea; + m_previousArea = e_noArea; + m_unk0x42c = e_noArea; + m_unk0x26 = 0; + m_isDirty = FALSE; + m_loadedAct = e_actNotFound; + SetCurrentAct(e_act1); m_backgroundColor = new LegoBackgroundColor("backgroundcolor", "set 56 54 68"); VariableTable()->SetVariable(m_backgroundColor); - m_tempBackgroundColor = new LegoBackgroundColor("tempBackgroundcolor", "set 56 54 68"); + m_tempBackgroundColor = new LegoBackgroundColor("tempBackgroundColor", "set 56 54 68"); VariableTable()->SetVariable(m_tempBackgroundColor); m_fullScreenMovie = new LegoFullScreenMovie("fsmovie", "disable"); @@ -113,10 +125,35 @@ LegoGameState::~LegoGameState() delete[] m_savePath; } -// STUB: LEGO1 0x10039780 -void LegoGameState::FUN_10039780(MxU8) +// FUNCTION: LEGO1 0x10039780 +void LegoGameState::SetActor(MxU8 p_actorId) { - // TODO + if (p_actorId) { + m_actorId = p_actorId; + } + + IslePathActor* oldActor = CurrentActor(); + SetCurrentActor(NULL); + + IslePathActor* newActor = new IslePathActor(); + const char* actorName = LegoActor::GetActorName(m_actorId); + LegoROI* roi = UnkSaveDataWriter()->FUN_10083500(actorName, FALSE); + MxDSAction action; + + action.SetAtomId(*g_isleScript); + action.SetObjectId(100000); + newActor->Create(action); + newActor->SetActorId(p_actorId); + newActor->SetROI(roi, FALSE, FALSE); + + if (oldActor) { + newActor->GetROI()->FUN_100a58f0(oldActor->GetROI()->GetLocal2World()); + newActor->SetUnknown88(oldActor->GetUnknown88()); + delete oldActor; + } + + newActor->ClearFlag(0x02); + SetCurrentActor(newActor); } // STUB: LEGO1 0x10039940 @@ -145,7 +182,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) { @@ -190,55 +227,58 @@ void LegoGameState::SetSavePath(char* p_savePath) } // FUNCTION: LEGO1 0x10039f70 -MxResult LegoGameState::WriteVariable(LegoStorage* p_stream, MxVariableTable* p_from, const char* p_variableName) +MxResult LegoGameState::WriteVariable(LegoStorage* p_storage, MxVariableTable* p_from, const char* p_variableName) { MxResult result = FAILURE; const char* variableValue = p_from->GetVariable(p_variableName); if (variableValue) { MxU8 length = strlen(p_variableName); - if (p_stream->Write((char*) &length, 1) == SUCCESS) { - if (p_stream->Write(p_variableName, length) == SUCCESS) { + if (p_storage->Write((char*) &length, 1) == SUCCESS) { + if (p_storage->Write(p_variableName, length) == SUCCESS) { length = strlen(variableValue); - if (p_stream->Write((char*) &length, 1) == SUCCESS) { - result = p_stream->Write((char*) variableValue, length); + if (p_storage->Write((char*) &length, 1) == SUCCESS) { + result = p_storage->Write((char*) variableValue, length); } } } } + return result; } // FUNCTION: LEGO1 0x1003a020 -MxResult LegoGameState::WriteEndOfVariables(LegoStorage* p_stream) +MxResult LegoGameState::WriteEndOfVariables(LegoStorage* p_storage) { MxU8 len = strlen(g_endOfVariables); - if (p_stream->Write(&len, 1) == SUCCESS) { - return p_stream->Write(g_endOfVariables, len); + + if (p_storage->Write(&len, 1) == SUCCESS) { + return p_storage->Write(g_endOfVariables, len); } + return FAILURE; } // 95% match, just some instruction ordering differences on the call to // MxVariableTable::SetVariable at the end. // FUNCTION: LEGO1 0x1003a080 -MxS32 LegoGameState::ReadVariable(LegoStorage* p_stream, MxVariableTable* p_to) +MxS32 LegoGameState::ReadVariable(LegoStorage* p_storage, MxVariableTable* p_to) { MxS32 result = 1; MxU8 length; - if (p_stream->Read((char*) &length, 1) == SUCCESS) { + if (p_storage->Read((char*) &length, 1) == SUCCESS) { char nameBuffer[256]; - if (p_stream->Read(nameBuffer, length) == SUCCESS) { + if (p_storage->Read(nameBuffer, length) == SUCCESS) { nameBuffer[length] = '\0'; if (strcmp(nameBuffer, g_endOfVariables) == 0) { // 2 -> "This was the last entry, done reading." result = 2; } else { - if (p_stream->Read((char*) &length, 1) == SUCCESS) { + if (p_storage->Read((char*) &length, 1) == SUCCESS) { char valueBuffer[256]; - if (p_stream->Read(valueBuffer, length) == SUCCESS) { + if (p_storage->Read(valueBuffer, length) == SUCCESS) { result = 0; valueBuffer[length] = '\0'; p_to->SetVariable(nameBuffer, valueBuffer); @@ -247,6 +287,7 @@ MxS32 LegoGameState::ReadVariable(LegoStorage* p_stream, MxVariableTable* p_to) } } } + return result; } @@ -559,7 +600,7 @@ void LegoGameState::SwitchArea(Area p_area) case e_garadoor: LoadIsle(); VariableTable()->SetVariable("VISIBILITY", "Hide Gas"); - CurrentVehicle()->ResetWorldTransform(FALSE); + CurrentActor()->ResetWorldTransform(FALSE); NavController()->SetLocation(0x3b); VideoManager()->Get3DManager()->SetFrustrum(90, 0.1f, 250.0f); InvokeAction(Extra::ActionType::e_start, *g_isleScript, 1160, NULL); @@ -572,10 +613,10 @@ void LegoGameState::SwitchArea(Area p_area) } else { SetCameraControllerFromIsle(); - CurrentVehicle()->ResetWorldTransform(TRUE); + CurrentActor()->ResetWorldTransform(TRUE); AnimationManager()->FUN_1005f0b0(); } - CurrentVehicle()->VTable0xe8(p_area, TRUE, 7); + CurrentActor()->VTable0xe8(p_area, TRUE, 7); break; } case e_hospital: @@ -585,9 +626,9 @@ void LegoGameState::SwitchArea(Area p_area) case e_unk33: LoadIsle(); SetCameraControllerFromIsle(); - CurrentVehicle()->ResetWorldTransform(TRUE); + CurrentActor()->ResetWorldTransform(TRUE); AnimationManager()->FUN_1005f0b0(); - CurrentVehicle()->VTable0xe8(p_area, TRUE, 7); + CurrentActor()->VTable0xe8(p_area, TRUE, 7); break; case e_police: VideoManager()->SetUnk0x554(TRUE); @@ -649,6 +690,16 @@ void LegoGameState::SwitchArea(Area p_area) } } +// FUNCTION: LEGO1 0x1003ba90 +void LegoGameState::SetColors() +{ + MxVariableTable* variableTable = VariableTable(); + + for (MxS32 i = 0; i < _countof(g_colorSaveData); i++) { + variableTable->SetVariable(g_colorSaveData[i].m_targetName, g_colorSaveData[i].m_colorName); + } +} + // FUNCTION: LEGO1 0x1003bac0 void LegoGameState::SetROIHandlerFunction() { @@ -725,21 +776,52 @@ void LegoGameState::RegisterState(LegoState* p_state) m_stateArray[targetIndex] = p_state; } +// FUNCTION: LEGO1 0x1003c670 +LegoGameState::Username::Username() +{ + memset(m_letters, -1, sizeof(m_letters)); +} + +// FUNCTION: LEGO1 0x1003c690 +MxResult LegoGameState::Username::ReadWrite(LegoStorage* p_storage) +{ + if (p_storage->IsReadMode()) { + for (MxS16 i = 0; i < 7; i++) { + p_storage->Read(&m_letters[i], sizeof(m_letters[i])); + } + } + else if (p_storage->IsWriteMode()) { + for (MxS16 i = 0; i < 7; i++) { + MxS16 letter = m_letters[i]; + p_storage->Write(&letter, sizeof(letter)); + } + } + + 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 +835,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..52c57f71 100644 --- a/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp +++ b/LEGO1/lego/legoomni/src/common/legounksavedatawriter.cpp @@ -41,7 +41,7 @@ void LegoUnkSaveDataWriter::FUN_100832a0() } // FUNCTION: LEGO1 0x10083310 -MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_stream) +MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_storage) { MxResult result = FAILURE; @@ -51,34 +51,34 @@ MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_stream) const LegoSaveDataEntry3* end = &g_saveData3[66]; while (TRUE) { - if (p_stream->Write(&entry->m_savePart1, 4) != SUCCESS) { + if (p_storage->Write(&entry->m_savePart1, 4) != SUCCESS) { break; } - if (p_stream->Write(&entry->m_savePart2, 4) != SUCCESS) { + if (p_storage->Write(&entry->m_savePart2, 4) != SUCCESS) { break; } - if (p_stream->Write(&entry->m_savePart3, 1) != SUCCESS) { + if (p_storage->Write(&entry->m_savePart3, 1) != SUCCESS) { break; } - if (p_stream->Write(&entry->m_currentFrame, 1) != SUCCESS) { + if (p_storage->Write(&entry->m_currentFrame, 1) != SUCCESS) { break; } - if (p_stream->Write(&entry->m_savePart5, 1) != SUCCESS) { + if (p_storage->Write(&entry->m_savePart5, 1) != SUCCESS) { break; } - if (p_stream->Write(&entry->m_savePart6, 1) != SUCCESS) { + if (p_storage->Write(&entry->m_savePart6, 1) != SUCCESS) { break; } - if (p_stream->Write(&entry->m_savePart7, 1) != SUCCESS) { + if (p_storage->Write(&entry->m_savePart7, 1) != SUCCESS) { break; } - if (p_stream->Write(&entry->m_savePart8, 1) != SUCCESS) { + if (p_storage->Write(&entry->m_savePart8, 1) != SUCCESS) { break; } - if (p_stream->Write(&entry->m_savePart9, 1) != SUCCESS) { + if (p_storage->Write(&entry->m_savePart9, 1) != SUCCESS) { break; } - if (p_stream->Write(&entry->m_savePart10, 1) != SUCCESS) { + if (p_storage->Write(&entry->m_savePart10, 1) != SUCCESS) { break; } if (++entry >= end) { @@ -86,11 +86,12 @@ MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_stream) break; } } + return result; } // 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/entity/legoworld.cpp b/LEGO1/lego/legoomni/src/entity/legoworld.cpp index c1fe9e39..ad66e1cf 100644 --- a/LEGO1/lego/legoomni/src/entity/legoworld.cpp +++ b/LEGO1/lego/legoomni/src/entity/legoworld.cpp @@ -588,10 +588,10 @@ void LegoWorld::Enable(MxBool p_enable) else if (!p_enable && m_set0xd0.empty()) { MxPresenter* presenter; LegoPathController* controller; - IslePathActor* vehicle = CurrentVehicle(); + IslePathActor* actor = CurrentActor(); - if (vehicle) { - FUN_1001fc80(vehicle); + if (actor) { + FUN_1001fc80(actor); } AnimationManager()->FUN_1005ee80(FALSE); diff --git a/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp b/LEGO1/lego/legoomni/src/infocenter/infocenter.cpp index cef49c68..f69fa761 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()->SetActor(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()->SetActor(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()->SetActor(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()->SetActor(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/isle.cpp b/LEGO1/lego/legoomni/src/isle/isle.cpp index 1f2085c2..bf3f912d 100644 --- a/LEGO1/lego/legoomni/src/isle/isle.cpp +++ b/LEGO1/lego/legoomni/src/isle/isle.cpp @@ -46,8 +46,8 @@ Isle::~Isle() InputManager()->ClearWorld(); } - if (CurrentVehicle() != NULL) { - VTable0x6c(CurrentVehicle()); + if (CurrentActor() != NULL) { + VTable0x6c(CurrentActor()); } NotificationManager()->Unregister(this); @@ -121,7 +121,7 @@ MxLong Isle::Notify(MxParam& p_param) case c_notificationType18: switch (m_act1state->GetUnknown18()) { case 4: - result = CurrentVehicle()->Notify(p_param); + result = CurrentActor()->Notify(p_param); break; case 8: result = m_towtrack->Notify(p_param); diff --git a/LEGO1/lego/legoomni/src/isle/jukeboxentity.cpp b/LEGO1/lego/legoomni/src/isle/jukeboxentity.cpp index 47d81510..1fed8533 100644 --- a/LEGO1/lego/legoomni/src/isle/jukeboxentity.cpp +++ b/LEGO1/lego/legoomni/src/isle/jukeboxentity.cpp @@ -29,8 +29,8 @@ MxLong JukeBoxEntity::Notify(MxParam& p_param) return 1; } - if (CurrentVehicle()->VTable0x60() != GameState()->GetUnknownC()) { - CurrentVehicle()->VTable0xe4(); + if (CurrentActor()->GetActorId() != GameState()->GetActorId()) { + CurrentActor()->VTable0xe4(); } ((Isle*) FindWorld(*g_isleScript, 0))->SetUnknown13c(0x35); diff --git a/LEGO1/lego/legoomni/src/main/legoomni.cpp b/LEGO1/lego/legoomni/src/main/legoomni.cpp index f0081e2c..1da15cee 100644 --- a/LEGO1/lego/legoomni/src/main/legoomni.cpp +++ b/LEGO1/lego/legoomni/src/main/legoomni.cpp @@ -179,9 +179,9 @@ LegoNavController* NavController() } // FUNCTION: LEGO1 0x10015790 -IslePathActor* CurrentVehicle() +IslePathActor* CurrentActor() { - return LegoOmni::GetInstance()->GetCurrentVehicle(); + return LegoOmni::GetInstance()->GetCurrentActor(); } // FUNCTION: LEGO1 0x100157a0 @@ -248,6 +248,12 @@ void SetROIUnknown0x0c(const char* p_name, undefined p_unk0x0c) } } +// FUNCTION: LEGO1 0x10015880 +void SetCurrentActor(IslePathActor* p_currentActor) +{ + LegoOmni::GetInstance()->SetCurrentActor(p_currentActor); +} + // FUNCTION: LEGO1 0x100158c0 LegoWorld* FindWorld(const MxAtomId& p_atom, MxS32 p_entityid) { @@ -478,7 +484,7 @@ void LegoOmni::Init() m_worldList = NULL; m_currentWorld = NULL; m_exit = FALSE; - m_currentVehicle = NULL; + m_currentActor = NULL; m_saveDataWriter = NULL; m_plantManager = NULL; m_gameState = NULL; diff --git a/LEGO1/lego/legoomni/src/police/policestate.cpp b/LEGO1/lego/legoomni/src/police/policestate.cpp index 07ef3a55..c1d978e1 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 (CurrentActor()->GetActorId()) { case 4: policeScript = Police::PoliceScript::c_lauraAnim; m_policeScript = policeScript; diff --git a/LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp b/LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp index 9a85e0b6..7378bcb3 100644 --- a/LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp +++ b/LEGO1/lego/legoomni/src/towtrack/towtrackmissionstate.cpp @@ -28,47 +28,47 @@ MxResult TowTrackMissionState::VTable0x1c(LegoFile* p_legoFile) } if (p_legoFile->IsReadMode()) { - p_legoFile->Read(&m_unk0x12, sizeof(MxU16)); - p_legoFile->Read(&m_unk0x14, sizeof(MxU16)); - p_legoFile->Read(&m_unk0x16, sizeof(MxU16)); - p_legoFile->Read(&m_unk0x18, sizeof(MxU16)); - p_legoFile->Read(&m_unk0x1a, sizeof(MxU16)); - p_legoFile->Read(&m_unk0x1c, sizeof(MxU16)); - p_legoFile->Read(&m_color1, sizeof(MxU16)); - p_legoFile->Read(&m_color2, sizeof(MxU16)); - p_legoFile->Read(&m_color3, sizeof(MxU16)); - p_legoFile->Read(&m_color4, sizeof(MxU16)); + p_legoFile->Read(&m_unk0x12, sizeof(m_unk0x12)); + p_legoFile->Read(&m_unk0x14, sizeof(m_unk0x14)); + p_legoFile->Read(&m_unk0x16, sizeof(m_unk0x16)); + p_legoFile->Read(&m_unk0x18, sizeof(m_unk0x18)); + p_legoFile->Read(&m_unk0x1a, sizeof(m_unk0x1a)); + p_legoFile->Read(&m_unk0x1c, sizeof(m_unk0x1c)); + p_legoFile->Read(&m_color1, sizeof(m_color1)); + p_legoFile->Read(&m_color2, sizeof(m_color2)); + p_legoFile->Read(&m_color3, sizeof(m_color3)); + p_legoFile->Read(&m_color4, sizeof(m_color4)); } else if (p_legoFile->IsWriteMode()) { MxU16 write = m_unk0x12; - p_legoFile->Write(&write, sizeof(MxU16)); + p_legoFile->Write(&write, sizeof(m_unk0x12)); write = m_unk0x14; - p_legoFile->Write(&write, sizeof(MxU16)); + p_legoFile->Write(&write, sizeof(m_unk0x12)); write = m_unk0x16; - p_legoFile->Write(&write, sizeof(MxU16)); + p_legoFile->Write(&write, sizeof(m_unk0x12)); write = m_unk0x18; - p_legoFile->Write(&write, sizeof(MxU16)); + p_legoFile->Write(&write, sizeof(m_unk0x12)); write = m_unk0x1a; - p_legoFile->Write(&write, sizeof(MxU16)); + p_legoFile->Write(&write, sizeof(m_unk0x12)); write = m_unk0x1c; - p_legoFile->Write(&write, sizeof(MxU16)); + p_legoFile->Write(&write, sizeof(m_unk0x12)); write = m_color1; - p_legoFile->Write(&write, sizeof(MxU16)); + p_legoFile->Write(&write, sizeof(m_unk0x12)); write = m_color2; - p_legoFile->Write(&write, sizeof(MxU16)); + p_legoFile->Write(&write, sizeof(m_unk0x12)); write = m_color3; - p_legoFile->Write(&write, sizeof(MxU16)); + p_legoFile->Write(&write, sizeof(m_unk0x12)); write = m_color4; - p_legoFile->Write(&write, sizeof(MxU16)); + p_legoFile->Write(&write, sizeof(m_unk0x12)); } return SUCCESS; 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; }