mirror of
https://github.com/isledecomp/isle.git
synced 2026-01-28 18:51:16 +00:00
WIP
This commit is contained in:
parent
9256554406
commit
3e7d9834a9
@ -33,29 +33,24 @@ struct LegoCharacter {
|
||||
|
||||
typedef map<const char*, LegoCharacter*, LegoCharacterComparator> LegoCharacterMap;
|
||||
|
||||
struct LegoSaveDataEntry3 {
|
||||
char* m_name;
|
||||
void* m_unk0x04;
|
||||
LegoActor* m_actor;
|
||||
MxS32 m_savePart1;
|
||||
MxS32 m_savePart2;
|
||||
MxU8 m_savePart3;
|
||||
undefined4 m_unk0x18[6];
|
||||
MxU8 m_frameOffsetInDwords; // 0x30
|
||||
MxS32* m_pFrameData;
|
||||
MxU8 m_currentFrame;
|
||||
undefined4 m_unk0x3c[2];
|
||||
MxU8 m_savePart5; // 0x44
|
||||
undefined4 m_unk0x48[5];
|
||||
MxU8 m_savePart6; // 0x5c
|
||||
undefined4 m_unk0x60[11];
|
||||
MxU8 m_savePart7; // 0x8c
|
||||
undefined4 m_unk0x90[5];
|
||||
MxU8 m_savePart8; // 0xa4
|
||||
undefined4 m_unk0xa8[17];
|
||||
MxU8 m_savePart9; // 0xec
|
||||
undefined4 m_unk0xf0[5];
|
||||
MxU8 m_savePart10; // 0x104
|
||||
// SIZE 0x108
|
||||
struct LegoCharacterData {
|
||||
// SIZE 0x18
|
||||
struct Unknown {
|
||||
undefined m_unk0x00; // 0x00 - offset used with unk0x04
|
||||
undefined4 m_unk0x04; // 0x04 - presumably pointer into global 100da40c
|
||||
undefined m_unk0x08; // 0x08 - offset used with unk0x04
|
||||
undefined4 m_unk0x0c[2]; // 0x0c
|
||||
undefined m_unk0x14; // 0x14
|
||||
};
|
||||
|
||||
char* m_name; // 0x00
|
||||
void* m_unk0x04; // 0x04
|
||||
LegoActor* m_actor; // 0x08
|
||||
MxS32 m_unk0x0c; // 0x0c
|
||||
MxS32 m_unk0x10; // 0x10
|
||||
MxU8 m_unk0x14; // 0x14
|
||||
Unknown m_unk0x18[10]; // 0x18
|
||||
};
|
||||
|
||||
// SIZE 0x08
|
||||
@ -63,18 +58,18 @@ class LegoCharacterManager {
|
||||
public:
|
||||
LegoCharacterManager();
|
||||
|
||||
MxResult WriteSaveData3(LegoStorage* p_storage);
|
||||
MxResult ReadSaveData3(LegoStorage* p_storage);
|
||||
MxResult FUN_10083310(LegoStorage* p_storage);
|
||||
MxResult FUN_100833f0(LegoStorage* p_storage);
|
||||
LegoROI* GetROI(const char* p_key, MxBool p_createEntity);
|
||||
|
||||
void InitSaveData();
|
||||
void FUN_10083270();
|
||||
static void SetCustomizeAnimFile(const char* p_value);
|
||||
static MxBool FUN_10084c00(const LegoChar*);
|
||||
|
||||
void FUN_100832a0();
|
||||
void FUN_10083db0(LegoROI* p_roi);
|
||||
void FUN_10083f10(LegoROI* p_roi);
|
||||
LegoSaveDataEntry3* FUN_10084c60(const char* p_key);
|
||||
LegoCharacterData* FUN_10084c60(const char* p_key);
|
||||
MxBool FUN_10084ec0(LegoROI* p_roi);
|
||||
MxU32 FUN_10085140(LegoROI*, MxBool);
|
||||
LegoROI* FUN_10085210(const LegoChar*, LegoChar*, undefined);
|
||||
|
||||
@ -9,32 +9,33 @@
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoCharacter, 0x08)
|
||||
DECOMP_SIZE_ASSERT(LegoCharacterManager, 0x08)
|
||||
DECOMP_SIZE_ASSERT(LegoSaveDataEntry3, 0x108)
|
||||
DECOMP_SIZE_ASSERT(LegoCharacterData::Unknown, 0x18)
|
||||
DECOMP_SIZE_ASSERT(LegoCharacterData, 0x108)
|
||||
|
||||
// GLOBAL: LEGO1 0x100f80c0
|
||||
LegoSaveDataEntry3 g_saveDataInit[66]; // TODO: add data
|
||||
LegoCharacterData g_characterDataInit[66]; // TODO: add data
|
||||
|
||||
// GLOBAL: LEGO1 0x100fc4e4
|
||||
char* LegoCharacterManager::g_customizeAnimFile = NULL;
|
||||
|
||||
// GLOBAL: LEGO1 0x10104f20
|
||||
LegoSaveDataEntry3 g_saveData3[66];
|
||||
LegoCharacterData g_characterData[66];
|
||||
|
||||
// FUNCTION: LEGO1 0x10082a20
|
||||
LegoCharacterManager::LegoCharacterManager()
|
||||
{
|
||||
m_characters = new LegoCharacterMap();
|
||||
InitSaveData();
|
||||
FUN_10083270();
|
||||
|
||||
m_customizeAnimFile = new CustomizeAnimFileVariable("CUSTOMIZE_ANIM_FILE");
|
||||
VariableTable()->SetVariable(m_customizeAnimFile);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10083270
|
||||
void LegoCharacterManager::InitSaveData()
|
||||
void LegoCharacterManager::FUN_10083270()
|
||||
{
|
||||
for (MxS32 i = 0; i < 66; i++) {
|
||||
g_saveData3[i] = g_saveDataInit[i];
|
||||
for (MxS32 i = 0; i < _countof(g_characterData); i++) {
|
||||
g_characterData[i] = g_characterDataInit[i];
|
||||
}
|
||||
}
|
||||
|
||||
@ -45,57 +46,53 @@ void LegoCharacterManager::FUN_100832a0()
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10083310
|
||||
MxResult LegoCharacterManager::WriteSaveData3(LegoStorage* p_storage)
|
||||
MxResult LegoCharacterManager::FUN_10083310(LegoStorage* p_storage)
|
||||
{
|
||||
MxResult result = FAILURE;
|
||||
|
||||
// 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];
|
||||
for (MxS32 i = 0; i < _countof(g_characterData); i++) {
|
||||
LegoCharacterData* data = &g_characterData[i];
|
||||
|
||||
while (TRUE) {
|
||||
if (p_storage->Write(&entry->m_savePart1, 4) != SUCCESS) {
|
||||
break;
|
||||
if (p_storage->Write(&data->m_unk0x0c, sizeof(data->m_unk0x0c)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&entry->m_savePart2, 4) != SUCCESS) {
|
||||
break;
|
||||
if (p_storage->Write(&data->m_unk0x10, sizeof(data->m_unk0x10)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&entry->m_savePart3, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_storage->Write(&data->m_unk0x14, sizeof(data->m_unk0x14)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&entry->m_currentFrame, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_storage->Write(&data->m_unk0x18[1].m_unk0x08, sizeof(data->m_unk0x18[1].m_unk0x08)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&entry->m_savePart5, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_storage->Write(&data->m_unk0x18[1].m_unk0x14, sizeof(data->m_unk0x18[1].m_unk0x14)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&entry->m_savePart6, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_storage->Write(&data->m_unk0x18[2].m_unk0x14, sizeof(data->m_unk0x18[2].m_unk0x14)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&entry->m_savePart7, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_storage->Write(&data->m_unk0x18[4].m_unk0x14, sizeof(data->m_unk0x18[4].m_unk0x14)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&entry->m_savePart8, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_storage->Write(&data->m_unk0x18[5].m_unk0x14, sizeof(data->m_unk0x18[5].m_unk0x14)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&entry->m_savePart9, 1) != SUCCESS) {
|
||||
break;
|
||||
if (p_storage->Write(&data->m_unk0x18[8].m_unk0x14, sizeof(data->m_unk0x18[8].m_unk0x14)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
if (p_storage->Write(&entry->m_savePart10, 1) != SUCCESS) {
|
||||
break;
|
||||
}
|
||||
if (++entry >= end) {
|
||||
result = SUCCESS;
|
||||
break;
|
||||
if (p_storage->Write(&data->m_unk0x18[9].m_unk0x14, sizeof(data->m_unk0x18[9].m_unk0x14)) != SUCCESS) {
|
||||
goto done;
|
||||
}
|
||||
}
|
||||
|
||||
result = SUCCESS;
|
||||
|
||||
done:
|
||||
return result;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100833f0
|
||||
MxResult LegoCharacterManager::ReadSaveData3(LegoStorage* p_storage)
|
||||
MxResult LegoCharacterManager::FUN_100833f0(LegoStorage* p_storage)
|
||||
{
|
||||
return SUCCESS;
|
||||
}
|
||||
@ -160,10 +157,66 @@ void LegoCharacterManager::FUN_10083f10(LegoROI* p_roi)
|
||||
// TODO
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10084030
|
||||
// FUNCTION: LEGO1 0x10084030
|
||||
LegoROI* LegoCharacterManager::CreateROI(const char* p_key)
|
||||
{
|
||||
return NULL;
|
||||
MxBool success = FALSE;
|
||||
LegoROI* roi = NULL;
|
||||
BoundingSphere boundingSphere;
|
||||
BoundingBox boundingBox;
|
||||
MxMatrix mat;
|
||||
CompoundObject* comp;
|
||||
|
||||
Tgl::Renderer* renderer = VideoManager()->GetRenderer();
|
||||
ViewLODListManager* lodManager = GetViewLODListManager();
|
||||
LegoTextureContainer* textureContainer = TextureContainer();
|
||||
LegoCharacterData* entry = FUN_10084c60(p_key);
|
||||
|
||||
if (entry == NULL) {
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (!strcmpi(p_key, "pep")) {
|
||||
LegoCharacterData* pepper = FUN_10084c60("pepper");
|
||||
|
||||
entry->m_unk0x0c = pepper->m_unk0x0c;
|
||||
entry->m_unk0x10 = pepper->m_unk0x10;
|
||||
entry->m_unk0x14 = pepper->m_unk0x14;
|
||||
|
||||
for (MxS32 i = 0; i < _countof(entry->m_unk0x18); i++) {
|
||||
entry->m_unk0x18[i] = pepper->m_unk0x18[i];
|
||||
}
|
||||
}
|
||||
|
||||
roi = new LegoROI(renderer);
|
||||
roi->SetName(p_key);
|
||||
|
||||
boundingSphere.Center()[0] = 0.000267f;
|
||||
boundingSphere.Center()[1] = 0.78080797f;
|
||||
boundingSphere.Center()[2] = -0.01906f;
|
||||
boundingSphere.Radius() = 0.951612f;
|
||||
|
||||
roi->SetBoundingSphere(boundingSphere);
|
||||
|
||||
boundingBox.Min()[0] = -0.46116599f;
|
||||
boundingBox.Min()[1] = -0.002794f;
|
||||
boundingBox.Min()[2] = -0.29944199f;
|
||||
boundingBox.Max()[0] = 0.46169999f;
|
||||
boundingBox.Max()[1] = 1.56441f;
|
||||
boundingBox.Max()[2] = 0.261321f;
|
||||
|
||||
roi->SetUnknown0x80(boundingBox);
|
||||
|
||||
comp = new CompoundObject();
|
||||
roi->SetComp(comp);
|
||||
|
||||
done:
|
||||
if (!success && roi != NULL) {
|
||||
delete roi;
|
||||
roi = NULL;
|
||||
}
|
||||
|
||||
return roi;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10084c00
|
||||
@ -174,7 +227,7 @@ MxBool LegoCharacterManager::FUN_10084c00(const LegoChar*)
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10084c60
|
||||
LegoSaveDataEntry3* LegoCharacterManager::FUN_10084c60(const char* p_key)
|
||||
LegoCharacterData* LegoCharacterManager::FUN_10084c60(const char* p_key)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -235,7 +235,7 @@ MxResult LegoGameState::Save(MxULong p_slot)
|
||||
}
|
||||
|
||||
WriteEndOfVariables(&fileStorage);
|
||||
CharacterManager()->WriteSaveData3(&fileStorage);
|
||||
CharacterManager()->FUN_10083310(&fileStorage);
|
||||
PlantManager()->Save(&fileStorage);
|
||||
result = BuildingManager()->Save(&fileStorage);
|
||||
|
||||
@ -334,7 +334,7 @@ MxResult LegoGameState::Load(MxULong p_slot)
|
||||
SetLightPosition(atoi(lightPosition));
|
||||
}
|
||||
|
||||
if (CharacterManager()->ReadSaveData3(&fileStorage) == FAILURE) {
|
||||
if (CharacterManager()->FUN_100833f0(&fileStorage) == FAILURE) {
|
||||
goto done;
|
||||
}
|
||||
if (PlantManager()->Load(&fileStorage) == FAILURE) {
|
||||
@ -1057,7 +1057,7 @@ void LegoGameState::Init()
|
||||
SetLightPosition(2);
|
||||
PlantManager()->Init();
|
||||
BuildingManager()->Init();
|
||||
CharacterManager()->InitSaveData();
|
||||
CharacterManager()->FUN_10083270();
|
||||
AnimationManager()->FUN_1005ee80(TRUE);
|
||||
SetColors();
|
||||
RemoveActor();
|
||||
|
||||
@ -553,6 +553,23 @@ void LegoROI::FUN_100a9d30(ROIHandler p_func)
|
||||
g_unk0x101013ac = p_func;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a9d40
|
||||
void LegoROI::SetName(const LegoChar* p_name)
|
||||
{
|
||||
if (m_name != NULL) {
|
||||
delete[] m_name;
|
||||
}
|
||||
|
||||
if (p_name != NULL) {
|
||||
m_name = new LegoChar[strlen(p_name) + 1];
|
||||
strcpy(m_name, p_name);
|
||||
strlwr(m_name);
|
||||
}
|
||||
else {
|
||||
m_name = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100a9e10
|
||||
void LegoROI::SetDisplayBB(int p_displayBB)
|
||||
{
|
||||
|
||||
@ -34,6 +34,7 @@ class LegoROI : public ViewROI {
|
||||
LegoResult SetFrame(LegoAnim* p_anim, LegoTime p_time);
|
||||
LegoResult FUN_100a9170(LegoFloat p_red, LegoFloat p_green, LegoFloat p_blue, LegoFloat p_alpha);
|
||||
LegoResult FUN_100a9210(LegoTextureInfo* p_textureInfo);
|
||||
void SetName(const LegoChar* p_name);
|
||||
|
||||
float IntrinsicImportance() const override; // vtable+0x04
|
||||
void UpdateWorldBoundingVolumes() override; // vtable+0x18
|
||||
@ -58,6 +59,9 @@ class LegoROI : public ViewROI {
|
||||
inline LegoEntity* GetEntity() { return m_entity; }
|
||||
|
||||
inline void SetEntity(LegoEntity* p_entity) { m_entity = p_entity; }
|
||||
inline void SetComp(CompoundObject* p_comp) { comp = p_comp; }
|
||||
inline void SetBoundingSphere(const BoundingSphere& p_sphere) { m_sphere = m_world_bounding_sphere = p_sphere; }
|
||||
inline void SetUnknown0x80(const BoundingBox& p_unk0x80) { m_unk0x80 = p_unk0x80; }
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100a82b0
|
||||
// LegoROI::`scalar deleting destructor'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user