mirror of
https://github.com/isledecomp/isle.git
synced 2024-11-22 15:48:09 -05:00
CustomizeAnimFile MxVariable (#584)
* CustomizeAnimFile MxVariable * Fixes * Remove returns * Add size asserts --------- Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
parent
48cd648357
commit
761b120aee
9 changed files with 180 additions and 6 deletions
|
@ -21,6 +21,7 @@ class LegoBuildingManager : public MxCore {
|
|||
}
|
||||
|
||||
static void configureLegoBuildingManager(MxS32);
|
||||
static void SetCustomizeAnimFile(const char* p_value);
|
||||
|
||||
void FUN_1002fa00();
|
||||
void FUN_1002fb30();
|
||||
|
@ -30,6 +31,8 @@ class LegoBuildingManager : public MxCore {
|
|||
// LegoBuildingManager::`scalar deleting destructor'
|
||||
|
||||
private:
|
||||
static char* g_customizeAnimFile;
|
||||
|
||||
void Init();
|
||||
|
||||
undefined m_unk0x08[0x28]; // 0x08
|
||||
|
|
|
@ -24,10 +24,14 @@ class LegoPlantManager : public MxCore {
|
|||
void FUN_100263a0(undefined4 p_und);
|
||||
void FUN_10027120();
|
||||
|
||||
static void SetCustomizeAnimFile(const char* p_value);
|
||||
|
||||
// SYNTHETIC: LEGO1 0x100262a0
|
||||
// LegoPlantManager::`scalar deleting destructor'
|
||||
|
||||
private:
|
||||
static char* g_customizeAnimFile;
|
||||
|
||||
void Init();
|
||||
|
||||
undefined m_unk0x08[0x24]; // 0x08
|
||||
|
|
|
@ -3,10 +3,28 @@
|
|||
|
||||
#include "decomp.h"
|
||||
#include "lego/sources/misc/legostorage.h"
|
||||
#include "legovariables.h"
|
||||
#include "mxstl/stlcompat.h"
|
||||
#include "mxtypes.h"
|
||||
|
||||
class LegoROI;
|
||||
|
||||
#pragma warning(disable : 4237)
|
||||
|
||||
// TODO: generic string comparator?
|
||||
struct LegoUnkSaveDataMapComparator {
|
||||
bool operator()(const char* const& p_a, const char* const& p_b) const { return strcmpi(p_a, p_b) > 0; }
|
||||
};
|
||||
|
||||
// TODO: pair instead?
|
||||
// SIZE 0x08
|
||||
struct LegoUnkSaveDataMapValue {
|
||||
LegoROI* m_roi; // 0x00
|
||||
MxU32 m_counter; // 0x04
|
||||
};
|
||||
|
||||
typedef map<char*, LegoUnkSaveDataMapValue*, LegoUnkSaveDataMapComparator> LegoUnkSaveDataMap;
|
||||
|
||||
struct LegoSaveDataEntry3 {
|
||||
char* m_name;
|
||||
void* m_unk0x04;
|
||||
|
@ -38,13 +56,42 @@ class LegoUnkSaveDataWriter {
|
|||
LegoUnkSaveDataWriter();
|
||||
|
||||
MxResult WriteSaveData3(LegoStorage* p_stream);
|
||||
LegoROI* FUN_10083500(char*, undefined4);
|
||||
LegoROI* FUN_10083500(char*, MxBool);
|
||||
|
||||
static void InitSaveData();
|
||||
static void SetCustomizeAnimFile(const char* p_value);
|
||||
|
||||
void FUN_100832a0();
|
||||
void FUN_10083db0(LegoROI* p_roi);
|
||||
void FUN_10083f10(LegoROI* p_roi);
|
||||
|
||||
private:
|
||||
undefined m_unk0x00[0x08]; // 0x00
|
||||
static char* g_customizeAnimFile;
|
||||
|
||||
LegoUnkSaveDataMap* m_map; // 0x00
|
||||
CustomizeAnimFileVariable* m_customizeAnimFile; // 0x04
|
||||
};
|
||||
|
||||
// clang-format off
|
||||
|
||||
// FUNCTION: LEGO1 0x10082b90
|
||||
// _Tree<char *,pair<char * const,LegoUnkSaveDataMapValue *>,map<char *,LegoUnkSaveDataMapValue *,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::_Kfn,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::~_Tree<char *,pair<char * const,LegoUnkSaveDataMapValue *>,map<char *,LegoUnkSaveDataMapValue *,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::_Kfn,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >
|
||||
|
||||
// FUNCTION: LEGO1 0x10082c60
|
||||
// _Tree<char *,pair<char * const,LegoUnkSaveDataMapValue *>,map<char *,LegoUnkSaveDataMapValue *,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::_Kfn,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::iterator::_Inc
|
||||
|
||||
// FUNCTION: LEGO1 0x10082ca0
|
||||
// _Tree<char *,pair<char * const,LegoUnkSaveDataMapValue *>,map<char *,LegoUnkSaveDataMapValue *,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::_Kfn,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::erase
|
||||
|
||||
// FUNCTION: LEGO1 0x100830f0
|
||||
// _Tree<char *,pair<char * const,LegoUnkSaveDataMapValue *>,map<char *,LegoUnkSaveDataMapValue *,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::_Kfn,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::_Erase
|
||||
|
||||
// FUNCTION: LEGO1 0x10083130
|
||||
// map<char *,LegoUnkSaveDataMapValue *,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::~map<char *,LegoUnkSaveDataMapValue *,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >
|
||||
|
||||
// GLOBAL: LEGO1 0x100fc508
|
||||
// _Tree<char *,pair<char * const,LegoUnkSaveDataMapValue *>,map<char *,LegoUnkSaveDataMapValue *,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::_Kfn,LegoUnkSaveDataMapComparator,allocator<LegoUnkSaveDataMapValue *> >::_Nil
|
||||
|
||||
// clang-format on
|
||||
|
||||
#endif // LEGOUNKSAVEDATAWRITER_H
|
||||
|
|
|
@ -44,4 +44,13 @@ class WhoAmIVariable : public MxVariable {
|
|||
void SetValue(const char* p_value) override; // vtable+0x04
|
||||
};
|
||||
|
||||
// VTABLE: LEGO1 0x100da878
|
||||
// SIZE 0x24
|
||||
class CustomizeAnimFileVariable : public MxVariable {
|
||||
public:
|
||||
CustomizeAnimFileVariable(const char* p_key);
|
||||
|
||||
void SetValue(const char* p_value) override; // vtable+0x04
|
||||
};
|
||||
|
||||
#endif // LEGOVARIABLES_H
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
DECOMP_SIZE_ASSERT(LegoBuildingManager, 0x30)
|
||||
|
||||
// GLOBAL: LEGO1 0x100f37c8
|
||||
char* LegoBuildingManager::g_customizeAnimFile = NULL;
|
||||
|
||||
// GLOBAL: LEGO1 0x100f37cc
|
||||
int g_buildingManagerConfig = 1;
|
||||
|
||||
|
@ -41,6 +44,25 @@ void LegoBuildingManager::FUN_1002fb30()
|
|||
// TODO
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1002ff90
|
||||
void LegoBuildingManager::SetCustomizeAnimFile(const char* p_value)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10030220
|
||||
MxResult LegoBuildingManager::Tickle()
|
||||
{
|
||||
|
|
|
@ -2,6 +2,9 @@
|
|||
|
||||
DECOMP_SIZE_ASSERT(LegoPlantManager, 0x2c)
|
||||
|
||||
// GLOBAL: LEGO1 0x100f3188
|
||||
char* LegoPlantManager::g_customizeAnimFile = NULL;
|
||||
|
||||
// FUNCTION: LEGO1 0x10026220
|
||||
LegoPlantManager::LegoPlantManager()
|
||||
{
|
||||
|
@ -32,6 +35,25 @@ void LegoPlantManager::FUN_100263a0(undefined4 p_und)
|
|||
// TODO
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10026be0
|
||||
void LegoPlantManager::SetCustomizeAnimFile(const char* p_value)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x10026e00
|
||||
MxResult LegoPlantManager::Tickle()
|
||||
{
|
||||
|
|
|
@ -1,18 +1,37 @@
|
|||
#include "legounksavedatawriter.h"
|
||||
|
||||
#include "legogamestate.h"
|
||||
#include "legoomni.h"
|
||||
#include "roi/legoroi.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoUnkSaveDataWriter, 0x08)
|
||||
DECOMP_SIZE_ASSERT(LegoSaveDataEntry3, 0x108)
|
||||
|
||||
// GLOBAL: LEGO1 0x100f80c0
|
||||
LegoSaveDataEntry3 g_saveDataInit[66]; // TODO: add data
|
||||
|
||||
// GLOBAL: LEGO1 0x100fc4e4
|
||||
char* LegoUnkSaveDataWriter::g_customizeAnimFile = NULL;
|
||||
|
||||
// GLOBAL: LEGO1 0x10104f20
|
||||
LegoSaveDataEntry3 g_saveData3[66];
|
||||
|
||||
// STUB: LEGO1 0x10082a20
|
||||
// FUNCTION: LEGO1 0x10082a20
|
||||
LegoUnkSaveDataWriter::LegoUnkSaveDataWriter()
|
||||
{
|
||||
// TODO
|
||||
m_map = new LegoUnkSaveDataMap();
|
||||
InitSaveData();
|
||||
|
||||
m_customizeAnimFile = new CustomizeAnimFileVariable("CUSTOMIZE_ANIM_FILE");
|
||||
VariableTable()->SetVariable(m_customizeAnimFile);
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10083270
|
||||
void LegoUnkSaveDataWriter::InitSaveData()
|
||||
{
|
||||
for (MxS32 i = 0; i < 66; i++) {
|
||||
g_saveData3[i] = g_saveDataInit[i];
|
||||
}
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x100832a0
|
||||
|
@ -71,7 +90,7 @@ MxResult LegoUnkSaveDataWriter::WriteSaveData3(LegoStorage* p_stream)
|
|||
}
|
||||
|
||||
// STUB: LEGO1 0x10083500
|
||||
LegoROI* LegoUnkSaveDataWriter::FUN_10083500(char*, undefined4)
|
||||
LegoROI* LegoUnkSaveDataWriter::FUN_10083500(char* p_key, MxBool p_option)
|
||||
{
|
||||
// TODO
|
||||
// involves an STL map with a _Nil node at 0x100fc508
|
||||
|
@ -89,3 +108,22 @@ void LegoUnkSaveDataWriter::FUN_10083f10(LegoROI* p_roi)
|
|||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100851a0
|
||||
void LegoUnkSaveDataWriter::SetCustomizeAnimFile(const char* p_value)
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
#include "legovariables.h"
|
||||
|
||||
#include "legobuildingmanager.h"
|
||||
#include "legoomni.h"
|
||||
#include "legoplantmanager.h"
|
||||
#include "legounksavedatawriter.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(VisibilityVariable, 0x24)
|
||||
DECOMP_SIZE_ASSERT(CameraLocationVariable, 0x24)
|
||||
DECOMP_SIZE_ASSERT(CursorVariable, 0x24)
|
||||
DECOMP_SIZE_ASSERT(WhoAmIVariable, 0x24)
|
||||
DECOMP_SIZE_ASSERT(CustomizeAnimFileVariable, 0x24)
|
||||
|
||||
// GLOBAL: LEGO1 0x100f3a40
|
||||
// STRING: LEGO1 0x100f3808
|
||||
const char* g_varVISIBILITY = "VISIBILITY";
|
||||
|
@ -38,3 +49,21 @@ void WhoAmIVariable::SetValue(const char* p_value)
|
|||
{
|
||||
// TODO
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10085aa0
|
||||
CustomizeAnimFileVariable::CustomizeAnimFileVariable(const char* p_key)
|
||||
{
|
||||
m_key = p_key;
|
||||
m_key.ToUpperCase();
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x10085b50
|
||||
void CustomizeAnimFileVariable::SetValue(const char* p_value)
|
||||
{
|
||||
// STRING: LEGO1 0x100fc4f4
|
||||
if (strcmp(m_key.GetData(), "CUSTOMIZE_ANIM_FILE") == 0) {
|
||||
UnkSaveDataWriter()->SetCustomizeAnimFile(p_value);
|
||||
PlantManager()->SetCustomizeAnimFile(p_value);
|
||||
BuildingManager()->SetCustomizeAnimFile(p_value);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -126,7 +126,7 @@ void LegoModelPresenter::ParseExtra()
|
|||
if (KeyValueStringParse(output, g_autoCreate, buffer) != 0) {
|
||||
char* token = strtok(output, g_parseExtraTokens);
|
||||
if (m_roi == NULL) {
|
||||
m_roi = UnkSaveDataWriter()->FUN_10083500(token, 0);
|
||||
m_roi = UnkSaveDataWriter()->FUN_10083500(token, FALSE);
|
||||
m_addedToView = FALSE;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue