mirror of
https://github.com/isledecomp/isle-portable.git
synced 2024-11-22 23:48:12 -05:00
Implement/match LegoOmni::RegisterScripts (#567)
* Implement/match LegoOmni::RegisterScripts * Fix const
This commit is contained in:
parent
5d80733cb1
commit
9bc5890da6
2 changed files with 77 additions and 16 deletions
|
@ -69,6 +69,41 @@ class LegoOmni : public MxOmni {
|
|||
c_clearScreen = 0x04
|
||||
};
|
||||
|
||||
// SIZE 0x1c
|
||||
struct ScriptContainer {
|
||||
// FUNCTION: LEGO1 0x1005ac40
|
||||
ScriptContainer()
|
||||
{
|
||||
m_index = -1;
|
||||
m_script = NULL;
|
||||
}
|
||||
|
||||
ScriptContainer(MxS32 p_index, const char* p_key, MxAtomId* p_script)
|
||||
{
|
||||
m_index = p_index;
|
||||
|
||||
if (p_key) {
|
||||
strcpy(m_key, p_key);
|
||||
}
|
||||
|
||||
m_script = p_script;
|
||||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x1005ac50
|
||||
ScriptContainer& operator=(const ScriptContainer& p_container)
|
||||
{
|
||||
m_index = p_container.m_index;
|
||||
strcpy(m_key, p_container.m_key);
|
||||
m_script = p_container.m_script;
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
MxS32 m_index; // 0x00
|
||||
char m_key[20]; // 0x04
|
||||
MxAtomId* m_script; // 0x18
|
||||
};
|
||||
|
||||
LegoOmni();
|
||||
~LegoOmni() override; // vtable+00
|
||||
|
||||
|
@ -104,7 +139,7 @@ class LegoOmni : public MxOmni {
|
|||
void FUN_1005b4f0(MxBool p_disable, MxU16 p_flags);
|
||||
void CreateBackgroundAudio();
|
||||
void RemoveWorld(const MxAtomId&, MxLong);
|
||||
MxResult FUN_1005a5f0();
|
||||
MxResult RegisterScripts();
|
||||
undefined4 FUN_1005b490(char* p_worldName);
|
||||
|
||||
static MxS32 GetCurrPathInfo(LegoPathBoundary**, MxS32&);
|
||||
|
@ -138,7 +173,7 @@ class LegoOmni : public MxOmni {
|
|||
// LegoOmni::`scalar deleting destructor'
|
||||
|
||||
private:
|
||||
undefined4* m_unk0x68; // 0x68
|
||||
ScriptContainer* m_scripts; // 0x68
|
||||
ViewLODListManager* m_viewLODListManager; // 0x6c
|
||||
LegoInputManager* m_inputMgr; // 0x70
|
||||
GifManager* m_gifManager; // 0x74
|
||||
|
@ -186,8 +221,8 @@ MxDSAction& GetCurrentAction();
|
|||
void PlayMusic(MxU32 p_index);
|
||||
void SetIsWorldActive(MxBool p_isWorldActive);
|
||||
void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last);
|
||||
void RegisterScripts();
|
||||
void UnregisterScripts();
|
||||
void CreateScripts();
|
||||
void DestroyScripts();
|
||||
void SetCurrentWorld(LegoWorld* p_world);
|
||||
|
||||
#endif // LEGOOMNI_H
|
||||
|
|
|
@ -25,8 +25,9 @@
|
|||
#include "mxtransitionmanager.h"
|
||||
#include "viewmanager/viewmanager.h"
|
||||
|
||||
DECOMP_SIZE_ASSERT(LegoWorldList, 0x18);
|
||||
DECOMP_SIZE_ASSERT(LegoWorldListCursor, 0x10);
|
||||
DECOMP_SIZE_ASSERT(LegoOmni::ScriptContainer, 0x1c)
|
||||
DECOMP_SIZE_ASSERT(LegoWorldList, 0x18)
|
||||
DECOMP_SIZE_ASSERT(LegoWorldListCursor, 0x10)
|
||||
|
||||
// GLOBAL: LEGO1 0x100f451c
|
||||
MxAtomId* g_copterScript = NULL;
|
||||
|
@ -307,7 +308,7 @@ LegoEntity* PickEntity(MxLong, MxLong)
|
|||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100528e0
|
||||
void RegisterScripts()
|
||||
void CreateScripts()
|
||||
{
|
||||
g_copterScript = new MxAtomId("\\lego\\scripts\\build\\copter", e_lowerCase2);
|
||||
g_dunecarScript = new MxAtomId("\\lego\\scripts\\build\\dunecar", e_lowerCase2);
|
||||
|
@ -340,7 +341,7 @@ void RegisterScripts()
|
|||
}
|
||||
|
||||
// FUNCTION: LEGO1 0x100530c0
|
||||
void UnregisterScripts()
|
||||
void DestroyScripts()
|
||||
{
|
||||
delete g_copterScript;
|
||||
delete g_dunecarScript;
|
||||
|
@ -424,7 +425,7 @@ LegoOmni::~LegoOmni()
|
|||
void LegoOmni::Init()
|
||||
{
|
||||
MxOmni::Init();
|
||||
m_unk0x68 = 0;
|
||||
m_scripts = NULL;
|
||||
m_inputMgr = NULL;
|
||||
m_viewLODListManager = NULL;
|
||||
m_gifManager = NULL;
|
||||
|
@ -514,9 +515,9 @@ void LegoOmni::Destroy()
|
|||
}
|
||||
|
||||
m_action.ClearAtom();
|
||||
UnregisterScripts();
|
||||
DestroyScripts();
|
||||
|
||||
delete[] m_unk0x68;
|
||||
delete[] m_scripts;
|
||||
|
||||
MxOmni::Destroy();
|
||||
}
|
||||
|
@ -602,9 +603,9 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
|||
}
|
||||
m_variableTable->SetVariable(variable);
|
||||
|
||||
RegisterScripts();
|
||||
CreateScripts();
|
||||
FUN_1001a700();
|
||||
result = FUN_1005a5f0();
|
||||
result = RegisterScripts();
|
||||
|
||||
if (result != SUCCESS) {
|
||||
goto done;
|
||||
|
@ -632,10 +633,35 @@ MxResult LegoOmni::Create(MxOmniCreateParam& p_param)
|
|||
return result;
|
||||
}
|
||||
|
||||
// STUB: LEGO1 0x1005a5f0
|
||||
MxResult LegoOmni::FUN_1005a5f0()
|
||||
// FUNCTION: LEGO1 0x1005a5f0
|
||||
MxResult LegoOmni::RegisterScripts()
|
||||
{
|
||||
// TODO
|
||||
m_scripts = new ScriptContainer[19];
|
||||
|
||||
if (!m_scripts) {
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
m_scripts[0] = ScriptContainer();
|
||||
m_scripts[1] = ScriptContainer(0, "ACT1", g_isleScript);
|
||||
m_scripts[2] = ScriptContainer(1, "IMAIN", g_infomainScript);
|
||||
m_scripts[3] = ScriptContainer(2, "ICUBE", g_infoscorScript);
|
||||
m_scripts[4] = ScriptContainer(3, "IREG", g_regbookScript);
|
||||
m_scripts[5] = ScriptContainer(4, "IELEV", g_elevbottScript);
|
||||
m_scripts[6] = ScriptContainer(5, "IISLE", g_infodoorScript);
|
||||
m_scripts[7] = ScriptContainer(6, "HOSP", g_hospitalScript);
|
||||
m_scripts[8] = ScriptContainer(7, "POLICE", g_policeScript);
|
||||
m_scripts[9] = ScriptContainer(8, "GMAIN", g_garageScript);
|
||||
m_scripts[10] = ScriptContainer(9, "BLDH", g_copterScript);
|
||||
m_scripts[11] = ScriptContainer(10, "BLDD", g_dunecarScript);
|
||||
m_scripts[12] = ScriptContainer(11, "BLDJ", g_jetskiScript);
|
||||
m_scripts[13] = ScriptContainer(12, "BLDR", g_racecarScript);
|
||||
m_scripts[14] = ScriptContainer(13, "RACC", g_carraceScript);
|
||||
m_scripts[15] = ScriptContainer(14, "RACJ", g_jetraceScript);
|
||||
m_scripts[16] = ScriptContainer(15, "ACT2", g_act2mainScript);
|
||||
m_scripts[17] = ScriptContainer(16, "ACT3", g_act3Script);
|
||||
m_scripts[18] = ScriptContainer(17, "TEST", g_testScript);
|
||||
|
||||
return SUCCESS;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue