diff --git a/LEGO1/lego/legoomni/include/legocharactermanager.h b/LEGO1/lego/legoomni/include/legocharactermanager.h index 095641c1..06fc5211 100644 --- a/LEGO1/lego/legoomni/include/legocharactermanager.h +++ b/LEGO1/lego/legoomni/include/legocharactermanager.h @@ -58,8 +58,8 @@ class LegoCharacterManager { public: LegoCharacterManager(); - MxResult FUN_10083310(LegoStorage* p_storage); - MxResult FUN_100833f0(LegoStorage* p_storage); + MxResult Write(LegoStorage* p_storage); + MxResult Read(LegoStorage* p_storage); LegoROI* GetROI(const char* p_key, MxBool p_createEntity); void FUN_10083270(); diff --git a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp index e2ee66c0..556af687 100644 --- a/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp +++ b/LEGO1/lego/legoomni/src/common/legocharactermanager.cpp @@ -52,7 +52,7 @@ void LegoCharacterManager::FUN_100832a0() } // FUNCTION: LEGO1 0x10083310 -MxResult LegoCharacterManager::FUN_10083310(LegoStorage* p_storage) +MxResult LegoCharacterManager::Write(LegoStorage* p_storage) { MxResult result = FAILURE; @@ -97,10 +97,50 @@ MxResult LegoCharacterManager::FUN_10083310(LegoStorage* p_storage) return result; } -// STUB: LEGO1 0x100833f0 -MxResult LegoCharacterManager::FUN_100833f0(LegoStorage* p_storage) +// FUNCTION: LEGO1 0x100833f0 +MxResult LegoCharacterManager::Read(LegoStorage* p_storage) { - return SUCCESS; + MxResult result = FAILURE; + + for (MxS32 i = 0; i < _countof(g_characterData); i++) { + LegoCharacterData* data = &g_characterData[i]; + + if (p_storage->Read(&data->m_unk0x0c, sizeof(data->m_unk0x0c)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&data->m_unk0x10, sizeof(data->m_unk0x10)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&data->m_unk0x14, sizeof(data->m_unk0x14)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&data->m_unk0x18[1].m_unk0x08, sizeof(data->m_unk0x18[1].m_unk0x08)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&data->m_unk0x18[1].m_unk0x14, sizeof(data->m_unk0x18[1].m_unk0x14)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&data->m_unk0x18[2].m_unk0x14, sizeof(data->m_unk0x18[2].m_unk0x14)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&data->m_unk0x18[4].m_unk0x14, sizeof(data->m_unk0x18[4].m_unk0x14)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&data->m_unk0x18[5].m_unk0x14, sizeof(data->m_unk0x18[5].m_unk0x14)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&data->m_unk0x18[8].m_unk0x14, sizeof(data->m_unk0x18[8].m_unk0x14)) != SUCCESS) { + goto done; + } + if (p_storage->Read(&data->m_unk0x18[9].m_unk0x14, sizeof(data->m_unk0x18[9].m_unk0x14)) != SUCCESS) { + goto done; + } + } + + result = SUCCESS; + +done: + return result; } // FUNCTION: LEGO1 0x10083500 diff --git a/LEGO1/lego/legoomni/src/common/legogamestate.cpp b/LEGO1/lego/legoomni/src/common/legogamestate.cpp index 6f904cfb..62dd5f8f 100644 --- a/LEGO1/lego/legoomni/src/common/legogamestate.cpp +++ b/LEGO1/lego/legoomni/src/common/legogamestate.cpp @@ -235,7 +235,7 @@ MxResult LegoGameState::Save(MxULong p_slot) } WriteEndOfVariables(&fileStorage); - CharacterManager()->FUN_10083310(&fileStorage); + CharacterManager()->Write(&fileStorage); PlantManager()->Save(&fileStorage); result = BuildingManager()->Save(&fileStorage); @@ -334,7 +334,7 @@ MxResult LegoGameState::Load(MxULong p_slot) SetLightPosition(atoi(lightPosition)); } - if (CharacterManager()->FUN_100833f0(&fileStorage) == FAILURE) { + if (CharacterManager()->Read(&fileStorage) == FAILURE) { goto done; } if (PlantManager()->Load(&fileStorage) == FAILURE) {