2024-03-09 15:07:52 -05:00
|
|
|
#include "legocharactermanager.h"
|
2023-10-24 19:38:27 -04:00
|
|
|
|
2023-10-12 12:18:24 -04:00
|
|
|
#include "legogamestate.h"
|
2024-03-09 15:07:52 -05:00
|
|
|
#include "mxmisc.h"
|
2024-01-22 10:18:46 -05:00
|
|
|
#include "roi/legoroi.h"
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2024-03-09 15:07:52 -05:00
|
|
|
DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08)
|
2024-02-10 20:52:16 -05:00
|
|
|
DECOMP_SIZE_ASSERT(LegoSaveDataEntry3, 0x108)
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2024-02-21 15:30:02 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f80c0
|
|
|
|
LegoSaveDataEntry3 g_saveDataInit[66]; // TODO: add data
|
|
|
|
|
|
|
|
// GLOBAL: LEGO1 0x100fc4e4
|
2024-03-09 15:07:52 -05:00
|
|
|
char* LegoCharacterManager::g_customizeAnimFile = NULL;
|
2024-02-21 15:30:02 -05:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x10104f20
|
2023-10-12 12:18:24 -04:00
|
|
|
LegoSaveDataEntry3 g_saveData3[66];
|
|
|
|
|
2024-02-21 15:30:02 -05:00
|
|
|
// FUNCTION: LEGO1 0x10082a20
|
2024-03-09 15:07:52 -05:00
|
|
|
LegoCharacterManager::LegoCharacterManager()
|
2024-02-10 20:52:16 -05:00
|
|
|
{
|
2024-02-21 15:30:02 -05:00
|
|
|
m_map = new LegoUnkSaveDataMap();
|
|
|
|
InitSaveData();
|
|
|
|
|
|
|
|
m_customizeAnimFile = new CustomizeAnimFileVariable("CUSTOMIZE_ANIM_FILE");
|
|
|
|
VariableTable()->SetVariable(m_customizeAnimFile);
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10083270
|
2024-03-09 15:07:52 -05:00
|
|
|
void LegoCharacterManager::InitSaveData()
|
2024-02-21 15:30:02 -05:00
|
|
|
{
|
|
|
|
for (MxS32 i = 0; i < 66; i++) {
|
|
|
|
g_saveData3[i] = g_saveDataInit[i];
|
|
|
|
}
|
2024-02-10 20:52:16 -05:00
|
|
|
}
|
|
|
|
|
2024-02-05 12:35:26 -05:00
|
|
|
// STUB: LEGO1 0x100832a0
|
2024-03-09 15:07:52 -05:00
|
|
|
void LegoCharacterManager::FUN_100832a0()
|
2024-02-05 12:35:26 -05:00
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10083310
|
2024-03-09 15:07:52 -05:00
|
|
|
MxResult LegoCharacterManager::WriteSaveData3(LegoStorage* p_storage)
|
2023-10-12 12:18:24 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
MxResult result = FAILURE;
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
// This should probably be a for loop but I can't figure out how to
|
|
|
|
// make it match as a for loop.
|
|
|
|
LegoSaveDataEntry3* entry = g_saveData3;
|
|
|
|
const LegoSaveDataEntry3* end = &g_saveData3[66];
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
while (TRUE) {
|
2024-02-26 11:19:16 -05:00
|
|
|
if (p_storage->Write(&entry->m_savePart1, 4) != SUCCESS) {
|
2023-10-24 19:38:27 -04:00
|
|
|
break;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-02-26 11:19:16 -05:00
|
|
|
if (p_storage->Write(&entry->m_savePart2, 4) != SUCCESS) {
|
2023-10-24 19:38:27 -04:00
|
|
|
break;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-02-26 11:19:16 -05:00
|
|
|
if (p_storage->Write(&entry->m_savePart3, 1) != SUCCESS) {
|
2023-10-24 19:38:27 -04:00
|
|
|
break;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-02-26 11:19:16 -05:00
|
|
|
if (p_storage->Write(&entry->m_currentFrame, 1) != SUCCESS) {
|
2023-10-24 19:38:27 -04:00
|
|
|
break;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-02-26 11:19:16 -05:00
|
|
|
if (p_storage->Write(&entry->m_savePart5, 1) != SUCCESS) {
|
2023-10-24 19:38:27 -04:00
|
|
|
break;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-02-26 11:19:16 -05:00
|
|
|
if (p_storage->Write(&entry->m_savePart6, 1) != SUCCESS) {
|
2023-10-24 19:38:27 -04:00
|
|
|
break;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-02-26 11:19:16 -05:00
|
|
|
if (p_storage->Write(&entry->m_savePart7, 1) != SUCCESS) {
|
2023-10-24 19:38:27 -04:00
|
|
|
break;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-02-26 11:19:16 -05:00
|
|
|
if (p_storage->Write(&entry->m_savePart8, 1) != SUCCESS) {
|
2023-10-24 19:38:27 -04:00
|
|
|
break;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-02-26 11:19:16 -05:00
|
|
|
if (p_storage->Write(&entry->m_savePart9, 1) != SUCCESS) {
|
2023-10-24 19:38:27 -04:00
|
|
|
break;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2024-02-26 11:19:16 -05:00
|
|
|
if (p_storage->Write(&entry->m_savePart10, 1) != SUCCESS) {
|
2023-10-24 19:38:27 -04:00
|
|
|
break;
|
2024-02-01 15:42:10 -05:00
|
|
|
}
|
2023-10-24 19:38:27 -04:00
|
|
|
if (++entry >= end) {
|
|
|
|
result = SUCCESS;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2024-02-26 11:19:16 -05:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
return result;
|
2023-10-12 12:18:24 -04:00
|
|
|
}
|
2024-01-16 14:33:03 -05:00
|
|
|
|
2024-02-27 15:04:17 -05:00
|
|
|
// STUB: LEGO1 0x100833f0
|
2024-03-09 15:07:52 -05:00
|
|
|
MxResult LegoCharacterManager::ReadSaveData3(LegoStorage* p_storage)
|
2024-02-27 15:04:17 -05:00
|
|
|
{
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
|
2024-01-22 10:18:46 -05:00
|
|
|
// STUB: LEGO1 0x10083500
|
2024-03-09 15:07:52 -05:00
|
|
|
LegoROI* LegoCharacterManager::FUN_10083500(const char* p_key, MxBool p_option)
|
2024-01-22 10:18:46 -05:00
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
// involves an STL map with a _Nil node at 0x100fc508
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2024-01-16 14:33:03 -05:00
|
|
|
// STUB: LEGO1 0x10083db0
|
2024-03-09 15:07:52 -05:00
|
|
|
void LegoCharacterManager::FUN_10083db0(LegoROI* p_roi)
|
2024-01-16 14:33:03 -05:00
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
2024-02-13 18:34:14 -05:00
|
|
|
|
|
|
|
// STUB: LEGO1 0x10083f10
|
2024-03-09 15:07:52 -05:00
|
|
|
void LegoCharacterManager::FUN_10083f10(LegoROI* p_roi)
|
2024-02-13 18:34:14 -05:00
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
2024-02-21 15:30:02 -05:00
|
|
|
|
2024-02-27 10:13:00 -05:00
|
|
|
// STUB: LEGO1 0x10084c00
|
2024-03-09 15:07:52 -05:00
|
|
|
MxBool LegoCharacterManager::FUN_10084c00(const LegoChar*)
|
2024-02-27 10:13:00 -05:00
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2024-03-06 14:12:20 -05:00
|
|
|
// STUB: LEGO1 0x10085140
|
2024-03-09 15:07:52 -05:00
|
|
|
MxU32 LegoCharacterManager::FUN_10085140(LegoROI*, MxBool)
|
2024-03-06 14:12:20 -05:00
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2024-02-21 15:30:02 -05:00
|
|
|
// FUNCTION: LEGO1 0x100851a0
|
2024-03-09 15:07:52 -05:00
|
|
|
void LegoCharacterManager::SetCustomizeAnimFile(const char* p_value)
|
2024-02-21 15:30:02 -05:00
|
|
|
{
|
|
|
|
if (g_customizeAnimFile != NULL) {
|
|
|
|
delete[] g_customizeAnimFile;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_value != NULL) {
|
|
|
|
g_customizeAnimFile = new char[strlen(p_value) + 1];
|
|
|
|
|
|
|
|
if (g_customizeAnimFile != NULL) {
|
|
|
|
strcpy(g_customizeAnimFile, p_value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
g_customizeAnimFile = NULL;
|
|
|
|
}
|
|
|
|
}
|
2024-02-25 12:04:30 -05:00
|
|
|
|
|
|
|
// STUB: LEGO1 0x10085210
|
2024-03-09 15:07:52 -05:00
|
|
|
LegoROI* LegoCharacterManager::FUN_10085210(const LegoChar*, LegoChar*, undefined)
|
2024-02-25 12:04:30 -05:00
|
|
|
{
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// FUNCTION: LEGO1 0x10085a80
|
2024-03-09 15:07:52 -05:00
|
|
|
LegoROI* LegoCharacterManager::FUN_10085a80(LegoChar* p_und1, LegoChar* p_und2, undefined p_und3)
|
2024-02-25 12:04:30 -05:00
|
|
|
{
|
|
|
|
return FUN_10085210(p_und1, p_und2, p_und3);
|
|
|
|
}
|