2023-06-11 01:11:05 -04:00
|
|
|
#include "legoomni.h"
|
|
|
|
|
2023-11-06 04:00:24 -05:00
|
|
|
#include "gifmanager.h"
|
|
|
|
#include "legoanimationmanager.h"
|
|
|
|
#include "legobuildingmanager.h"
|
2023-10-07 11:30:04 -04:00
|
|
|
#include "legogamestate.h"
|
2023-10-18 16:12:28 -04:00
|
|
|
#include "legoinputmanager.h"
|
2023-10-24 19:38:27 -04:00
|
|
|
#include "legoobjectfactory.h"
|
2023-11-06 04:00:24 -05:00
|
|
|
#include "legoplantmanager.h"
|
|
|
|
#include "legosoundmanager.h"
|
2023-10-24 19:38:27 -04:00
|
|
|
#include "legoutil.h"
|
2023-11-06 04:00:24 -05:00
|
|
|
#include "legovideomanager.h"
|
2023-10-21 17:02:55 -04:00
|
|
|
#include "legoworld.h"
|
2023-11-06 04:00:24 -05:00
|
|
|
#include "mxautolocker.h"
|
2023-10-24 19:38:27 -04:00
|
|
|
#include "mxbackgroundaudiomanager.h"
|
|
|
|
#include "mxdsfile.h"
|
2023-11-06 04:00:24 -05:00
|
|
|
#include "mxomnicreateflags.h"
|
|
|
|
#include "mxomnicreateparam.h"
|
|
|
|
#include "mxticklemanager.h"
|
|
|
|
#include "mxtransitionmanager.h"
|
2023-09-20 16:22:57 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f451c
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_copterScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4520
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_dunecarScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4524
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_jetskiScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4528
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_racecarScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f452c
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_carraceScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4530
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_carracerScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4534
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_jetraceScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4538
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_jetracerScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f453c
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_isleScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4540
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_elevbottScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4544
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_infodoorScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4548
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_infomainScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f454c
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_infoscorScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4550
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_regbookScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4554
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_histbookScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4558
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_hospitalScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f455c
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_policeScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4560
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_garageScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4564
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_act2mainScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4568
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_act3Script = NULL;
|
2023-06-30 14:34:39 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f456c
|
2023-10-24 19:38:27 -04:00
|
|
|
MxAtomId* g_jukeboxScript = NULL;
|
2023-10-22 10:11:46 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4570
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_pz5Script = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4574
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_introScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4578
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_testScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f457c
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_jukeboxwScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4580c
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_sndAnimScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4584
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_creditsScript = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f4588
|
2023-11-05 10:20:00 -05:00
|
|
|
MxAtomId* g_nocdSourceName = NULL;
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x100f6718
|
2023-11-06 04:00:24 -05:00
|
|
|
const char* g_current = "current";
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// GLOBAL: LEGO1 0x101020e8
|
2023-10-24 19:38:27 -04:00
|
|
|
void (*g_omniUserMessage)(const char*, int);
|
2023-06-30 14:34:39 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015700
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoOmni* Lego()
|
2023-06-11 01:11:05 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return (LegoOmni*) MxOmni::GetInstance();
|
2023-06-11 01:11:05 -04:00
|
|
|
}
|
2023-06-18 07:45:39 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015710
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoSoundManager* SoundManager()
|
2023-06-22 12:23:54 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetSoundManager();
|
2023-06-22 12:23:54 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015720
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoVideoManager* VideoManager()
|
2023-06-18 07:45:39 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetVideoManager();
|
2023-06-18 23:56:55 -04:00
|
|
|
}
|
2023-06-19 02:19:40 -04:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015730
|
2023-10-24 19:38:27 -04:00
|
|
|
MxBackgroundAudioManager* BackgroundAudioManager()
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetBackgroundAudioManager();
|
2023-10-24 08:37:02 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015740
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoInputManager* InputManager()
|
2023-10-24 08:37:02 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetInputManager();
|
2023-10-24 08:37:02 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015750
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoControlManager* ControlManager()
|
2023-10-24 08:37:02 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetInputManager()->GetControlManager();
|
2023-10-24 08:37:02 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015760
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoGameState* GameState()
|
2023-10-24 08:37:02 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetGameState();
|
2023-10-24 08:37:02 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015770
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoAnimationManager* AnimationManager()
|
2023-10-24 08:37:02 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetAnimationManager();
|
2023-10-24 08:37:02 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015780
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoNavController* NavController()
|
2023-10-24 08:37:02 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetNavController();
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015790
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoWorld* GetCurrentVehicle()
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetCurrentVehicle();
|
2023-10-24 08:37:02 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100157a0
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoWorld* GetCurrentWorld()
|
2023-10-24 08:37:02 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetCurrentWorld();
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100157e0
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoPlantManager* PlantManager()
|
2023-06-29 04:10:08 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetLegoPlantManager();
|
2023-06-29 04:10:08 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100157f0
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoBuildingManager* BuildingManager()
|
2023-06-22 12:23:54 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetLegoBuildingManager();
|
2023-10-24 08:37:02 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015800
|
2023-10-24 19:38:27 -04:00
|
|
|
GifManager* GetGifManager()
|
2023-10-24 08:37:02 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetGifManager();
|
2023-10-24 08:37:02 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100158e0
|
2023-11-05 10:07:28 -05:00
|
|
|
MxDSAction& GetCurrentAction()
|
|
|
|
{
|
|
|
|
return LegoOmni::GetInstance()->GetCurrentAction();
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015900
|
2023-10-24 19:38:27 -04:00
|
|
|
MxTransitionManager* TransitionManager()
|
2023-10-24 08:37:02 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
return LegoOmni::GetInstance()->GetTransitionManager();
|
2023-06-22 12:23:54 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10015910
|
2023-11-05 10:07:28 -05:00
|
|
|
void PlayMusic(MxU32 p_index)
|
|
|
|
{
|
|
|
|
// index is the entityid of the music in jukebox.si
|
|
|
|
MxDSAction action;
|
|
|
|
action.SetAtomId(*g_jukeboxScript);
|
|
|
|
action.SetObjectId(p_index);
|
|
|
|
|
|
|
|
LegoOmni::GetInstance()->GetBackgroundAudioManager()->PlayMusic(action, 5, 4);
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x1001a700
|
2023-11-21 03:44:45 -05:00
|
|
|
void FUN_1001a700()
|
2023-06-19 02:19:40 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-06-19 02:19:40 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x1003dd70
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoROI* PickROI(MxLong, MxLong)
|
2023-06-30 14:34:39 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
|
|
|
return NULL;
|
2023-06-30 14:34:39 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x1003ddc0
|
2023-10-24 19:38:27 -04:00
|
|
|
LegoEntity* PickEntity(MxLong, MxLong)
|
2023-06-30 14:34:39 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
|
|
|
return NULL;
|
2023-06-30 14:34:39 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100528e0
|
2023-11-21 03:44:45 -05:00
|
|
|
void RegisterScripts()
|
2023-11-06 04:00:24 -05:00
|
|
|
{
|
2023-11-21 03:44:45 -05:00
|
|
|
g_copterScript = new MxAtomId("\\lego\\scripts\\build\\copter", LookupMode_LowerCase2);
|
|
|
|
g_dunecarScript = new MxAtomId("\\lego\\scripts\\build\\dunecar", LookupMode_LowerCase2);
|
|
|
|
g_jetskiScript = new MxAtomId("\\lego\\scripts\\build\\jetski", LookupMode_LowerCase2);
|
|
|
|
g_racecarScript = new MxAtomId("\\lego\\scripts\\build\\racecar", LookupMode_LowerCase2);
|
|
|
|
g_carraceScript = new MxAtomId("\\lego\\scripts\\race\\carrace", LookupMode_LowerCase2);
|
|
|
|
g_carracerScript = new MxAtomId("\\lego\\scripts\\race\\carracer", LookupMode_LowerCase2);
|
|
|
|
g_jetraceScript = new MxAtomId("\\lego\\scripts\\race\\jetrace", LookupMode_LowerCase2);
|
|
|
|
g_jetracerScript = new MxAtomId("\\lego\\scripts\\race\\jetracer", LookupMode_LowerCase2);
|
|
|
|
g_isleScript = new MxAtomId("\\lego\\scripts\\isle\\isle", LookupMode_LowerCase2);
|
|
|
|
g_elevbottScript = new MxAtomId("\\lego\\scripts\\infocntr\\elevbott", LookupMode_LowerCase2);
|
|
|
|
g_infodoorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infodoor", LookupMode_LowerCase2);
|
|
|
|
g_infomainScript = new MxAtomId("\\lego\\scripts\\infocntr\\infomain", LookupMode_LowerCase2);
|
|
|
|
g_infoscorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infoscor", LookupMode_LowerCase2);
|
|
|
|
g_regbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\regbook", LookupMode_LowerCase2);
|
|
|
|
g_histbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\histbook", LookupMode_LowerCase2);
|
|
|
|
g_hospitalScript = new MxAtomId("\\lego\\scripts\\hospital\\hospital", LookupMode_LowerCase2);
|
|
|
|
g_policeScript = new MxAtomId("\\lego\\scripts\\police\\police", LookupMode_LowerCase2);
|
|
|
|
g_garageScript = new MxAtomId("\\lego\\scripts\\garage\\garage", LookupMode_LowerCase2);
|
|
|
|
g_act2mainScript = new MxAtomId("\\lego\\scripts\\act2\\act2main", LookupMode_LowerCase2);
|
|
|
|
g_act3Script = new MxAtomId("\\lego\\scripts\\act3\\act3", LookupMode_LowerCase2);
|
|
|
|
g_jukeboxScript = new MxAtomId("\\lego\\scripts\\isle\\jukebox", LookupMode_LowerCase2);
|
|
|
|
g_pz5Script = new MxAtomId("\\lego\\scripts\\isle\\pz5", LookupMode_LowerCase2);
|
|
|
|
g_introScript = new MxAtomId("\\lego\\scripts\\intro", LookupMode_LowerCase2);
|
|
|
|
g_testScript = new MxAtomId("\\lego\\scripts\\test\\test", LookupMode_LowerCase2);
|
|
|
|
g_jukeboxwScript = new MxAtomId("\\lego\\scripts\\isle\\jukeboxw", LookupMode_LowerCase2);
|
|
|
|
g_sndAnimScript = new MxAtomId("\\lego\\scripts\\sndanim", LookupMode_LowerCase2);
|
|
|
|
g_creditsScript = new MxAtomId("\\lego\\scripts\\credits", LookupMode_LowerCase2);
|
|
|
|
g_nocdSourceName = new MxAtomId("\\lego\\scripts\\nocd", LookupMode_LowerCase2);
|
2023-11-06 04:00:24 -05:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100530c0
|
2023-11-21 03:44:45 -05:00
|
|
|
void UnregisterScripts()
|
2023-06-19 02:19:40 -04:00
|
|
|
{
|
2023-11-21 03:44:45 -05:00
|
|
|
delete g_copterScript;
|
|
|
|
delete g_dunecarScript;
|
|
|
|
delete g_jetskiScript;
|
|
|
|
delete g_racecarScript;
|
|
|
|
delete g_carraceScript;
|
|
|
|
delete g_carracerScript;
|
|
|
|
delete g_jetraceScript;
|
|
|
|
delete g_jetracerScript;
|
|
|
|
delete g_isleScript;
|
|
|
|
delete g_elevbottScript;
|
|
|
|
delete g_infodoorScript;
|
|
|
|
delete g_infomainScript;
|
|
|
|
delete g_infoscorScript;
|
|
|
|
delete g_regbookScript;
|
|
|
|
delete g_histbookScript;
|
|
|
|
delete g_hospitalScript;
|
|
|
|
delete g_policeScript;
|
|
|
|
delete g_garageScript;
|
|
|
|
delete g_act2mainScript;
|
|
|
|
delete g_act3Script;
|
|
|
|
delete g_jukeboxScript;
|
|
|
|
delete g_pz5Script;
|
|
|
|
delete g_introScript;
|
|
|
|
delete g_testScript;
|
|
|
|
delete g_jukeboxwScript;
|
|
|
|
delete g_sndAnimScript;
|
|
|
|
delete g_creditsScript;
|
|
|
|
delete g_nocdSourceName;
|
2023-11-06 04:00:24 -05:00
|
|
|
|
2023-11-21 03:44:45 -05:00
|
|
|
g_copterScript = NULL;
|
|
|
|
g_dunecarScript = NULL;
|
|
|
|
g_jetskiScript = NULL;
|
|
|
|
g_racecarScript = NULL;
|
|
|
|
g_carraceScript = NULL;
|
|
|
|
g_carracerScript = NULL;
|
|
|
|
g_jetraceScript = NULL;
|
|
|
|
g_jetracerScript = NULL;
|
|
|
|
g_isleScript = NULL;
|
|
|
|
g_elevbottScript = NULL;
|
|
|
|
g_infodoorScript = NULL;
|
|
|
|
g_infomainScript = NULL;
|
|
|
|
g_infoscorScript = NULL;
|
|
|
|
g_regbookScript = NULL;
|
|
|
|
g_histbookScript = NULL;
|
|
|
|
g_hospitalScript = NULL;
|
|
|
|
g_policeScript = NULL;
|
|
|
|
g_garageScript = NULL;
|
|
|
|
g_act2mainScript = NULL;
|
|
|
|
g_act3Script = NULL;
|
|
|
|
g_jukeboxScript = NULL;
|
|
|
|
g_pz5Script = NULL;
|
|
|
|
g_introScript = NULL;
|
|
|
|
g_testScript = NULL;
|
|
|
|
g_testScript = NULL;
|
|
|
|
g_jukeboxwScript = NULL;
|
|
|
|
g_sndAnimScript = NULL;
|
|
|
|
g_creditsScript = NULL;
|
|
|
|
g_nocdSourceName = NULL;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10053430
|
2023-11-21 03:44:45 -05:00
|
|
|
const char* GetNoCD_SourceName()
|
|
|
|
{
|
|
|
|
return g_nocdSourceName->GetInternal();
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10058a00
|
2023-11-21 03:44:45 -05:00
|
|
|
LegoOmni::LegoOmni()
|
|
|
|
{
|
|
|
|
Init();
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10058b50
|
2023-11-21 03:44:45 -05:00
|
|
|
LegoOmni::~LegoOmni()
|
|
|
|
{
|
|
|
|
Destroy();
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10058bd0
|
2023-11-21 03:44:45 -05:00
|
|
|
void LegoOmni::Init()
|
|
|
|
{
|
|
|
|
MxOmni::Init();
|
|
|
|
m_unk68 = 0;
|
|
|
|
m_inputMgr = NULL;
|
|
|
|
m_unk6c = 0;
|
|
|
|
m_gifManager = NULL;
|
|
|
|
m_unk78 = 0;
|
|
|
|
m_currentWorld = NULL;
|
|
|
|
m_unk80 = FALSE;
|
|
|
|
m_currentVehicle = NULL;
|
|
|
|
m_unkLegoSaveDataWriter = NULL;
|
|
|
|
m_plantManager = NULL;
|
|
|
|
m_gameState = NULL;
|
|
|
|
m_animationManager = NULL;
|
|
|
|
m_buildingManager = NULL;
|
|
|
|
m_bkgAudioManager = NULL;
|
|
|
|
m_unk13c = TRUE;
|
|
|
|
m_transitionManager = NULL;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x10058c30
|
2023-11-21 03:44:45 -05:00
|
|
|
void LegoOmni::Destroy()
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x10058e70
|
2023-11-21 03:44:45 -05:00
|
|
|
MxResult LegoOmni::Create(MxOmniCreateParam& p)
|
|
|
|
{
|
|
|
|
MxResult result = FAILURE;
|
|
|
|
MxAutoLocker lock(&this->m_criticalsection);
|
|
|
|
|
|
|
|
p.CreateFlags().CreateObjectFactory(FALSE);
|
|
|
|
p.CreateFlags().CreateVideoManager(FALSE);
|
|
|
|
p.CreateFlags().CreateSoundManager(FALSE);
|
2023-11-06 04:00:24 -05:00
|
|
|
p.CreateFlags().CreateTickleManager(FALSE);
|
|
|
|
|
|
|
|
if (!(m_tickleManager = new MxTickleManager()))
|
|
|
|
return FAILURE;
|
|
|
|
|
|
|
|
if (MxOmni::Create(p) != SUCCESS)
|
|
|
|
return FAILURE;
|
2023-10-12 12:18:24 -04:00
|
|
|
|
2023-10-24 19:38:27 -04:00
|
|
|
m_objectFactory = new LegoObjectFactory();
|
2023-11-06 04:00:24 -05:00
|
|
|
if (m_objectFactory == NULL)
|
|
|
|
return FAILURE;
|
|
|
|
|
|
|
|
if (m_soundManager = new LegoSoundManager()) {
|
|
|
|
if (m_soundManager->Create(10, 0) != SUCCESS) {
|
|
|
|
delete m_soundManager;
|
|
|
|
m_soundManager = NULL;
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_videoManager = new LegoVideoManager()) {
|
|
|
|
if (m_videoManager->Create(p.GetVideoParam(), 100, 0) != SUCCESS) {
|
|
|
|
delete m_videoManager;
|
|
|
|
m_videoManager = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (m_inputMgr = new LegoInputManager()) {
|
|
|
|
if (m_inputMgr->Create(p.GetWindowHandle()) != SUCCESS) {
|
|
|
|
delete m_inputMgr;
|
|
|
|
m_inputMgr = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// TODO: there are a few more classes here
|
|
|
|
m_gifManager = new GifManager();
|
|
|
|
m_plantManager = new LegoPlantManager();
|
|
|
|
m_animationManager = new LegoAnimationManager();
|
|
|
|
m_buildingManager = new LegoBuildingManager();
|
2023-10-24 19:38:27 -04:00
|
|
|
m_gameState = new LegoGameState();
|
2023-11-06 04:00:24 -05:00
|
|
|
// TODO: initialize list at m_unk78
|
|
|
|
|
|
|
|
if (m_unk6c && m_gifManager && m_unk78 && m_plantManager && m_animationManager && m_buildingManager) {
|
|
|
|
// TODO: initialize a bunch of MxVariables
|
|
|
|
RegisterScripts();
|
|
|
|
FUN_1001a700();
|
|
|
|
// todo: another function call. in legoomni maybe?
|
|
|
|
m_bkgAudioManager = new MxBackgroundAudioManager();
|
|
|
|
if (m_bkgAudioManager != NULL) {
|
|
|
|
m_transitionManager = new MxTransitionManager();
|
|
|
|
if (m_transitionManager != NULL) {
|
|
|
|
if (m_transitionManager->GetDDrawSurfaceFromVideoManager() == SUCCESS) {
|
|
|
|
m_notificationManager->Register(this);
|
|
|
|
SetAppCursor(1);
|
|
|
|
m_gameState->SetSomeEnumState(0);
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return FAILURE;
|
2023-06-19 02:19:40 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005ac90
|
2023-11-21 03:44:45 -05:00
|
|
|
void LegoOmni::CreateInstance()
|
|
|
|
{
|
|
|
|
MxOmni::DestroyInstance();
|
|
|
|
MxOmni::SetInstance(new LegoOmni());
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005ad10
|
2023-11-21 03:44:45 -05:00
|
|
|
LegoOmni* LegoOmni::GetInstance()
|
|
|
|
{
|
|
|
|
return (LegoOmni*) MxOmni::GetInstance();
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x1005af10
|
2023-11-21 03:44:45 -05:00
|
|
|
void LegoOmni::RemoveWorld(const MxAtomId& p1, MxLong p2)
|
2023-06-19 02:19:40 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
2023-06-19 02:19:40 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x1005b0c0
|
2023-11-21 03:44:45 -05:00
|
|
|
LegoEntity* LegoOmni::FindByEntityIdOrAtomId(const MxAtomId& p_atom, MxS32 p_entityid)
|
2023-06-19 02:19:40 -04:00
|
|
|
{
|
2023-11-21 03:44:45 -05:00
|
|
|
// TODO
|
|
|
|
return NULL;
|
2023-06-19 02:19:40 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x1005b1d0
|
2023-10-24 19:38:27 -04:00
|
|
|
MxResult LegoOmni::DeleteObject(MxDSAction& ds)
|
2023-06-19 02:19:40 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
// TODO
|
|
|
|
return FAILURE;
|
2023-06-19 02:19:40 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005b2f0
|
2023-11-13 05:22:58 -05:00
|
|
|
MxEntity* LegoOmni::FindWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p_presenter)
|
2023-06-19 02:19:40 -04:00
|
|
|
{
|
2023-11-06 04:00:24 -05:00
|
|
|
LegoWorld* foundEntity = NULL;
|
|
|
|
if (strcmpi(p_id, g_current)) {
|
|
|
|
foundEntity = (LegoWorld*) FindByEntityIdOrAtomId(MxAtomId(p_id, LookupMode_LowerCase2), p_entityId);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
foundEntity = this->m_currentWorld;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (foundEntity != NULL) {
|
|
|
|
foundEntity->VTable0x58(p_presenter);
|
|
|
|
}
|
|
|
|
|
|
|
|
return foundEntity;
|
2023-06-19 02:19:40 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005b3a0
|
2023-10-24 19:38:27 -04:00
|
|
|
void LegoOmni::NotifyCurrentEntity(MxNotificationParam* p_param)
|
2023-06-19 02:19:40 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
if (m_currentWorld)
|
|
|
|
NotificationManager()->Send(m_currentWorld, p_param);
|
2023-06-19 02:19:40 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005b3c0
|
2023-11-21 03:44:45 -05:00
|
|
|
MxBool LegoOmni::DoesEntityExist(MxDSAction& ds)
|
|
|
|
{
|
|
|
|
if (MxOmni::DoesEntityExist(ds)) {
|
|
|
|
if (FindByEntityIdOrAtomId(ds.GetAtomId(), ds.GetObjectId()) == NULL) {
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x1005b400
|
2023-11-21 03:44:45 -05:00
|
|
|
int LegoOmni::GetCurrPathInfo(LegoPathBoundary**, int&)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005b560
|
2023-11-21 03:44:45 -05:00
|
|
|
void LegoOmni::CreateBackgroundAudio()
|
|
|
|
{
|
|
|
|
if (m_bkgAudioManager)
|
|
|
|
m_bkgAudioManager->Create(*g_jukeboxScript, 100);
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005b580
|
2023-11-21 03:44:45 -05:00
|
|
|
MxResult LegoOmni::Start(MxDSAction* action)
|
|
|
|
{
|
|
|
|
MxResult result = MxOmni::Start(action);
|
|
|
|
this->m_action.SetAtomId(action->GetAtomId());
|
|
|
|
this->m_action.SetObjectId(action->GetObjectId());
|
|
|
|
this->m_action.SetUnknown24(action->GetUnknown24());
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// STUB: LEGO1 0x1005b5f0
|
2023-11-21 03:44:45 -05:00
|
|
|
MxLong LegoOmni::Notify(MxParam& p)
|
|
|
|
{
|
|
|
|
// TODO
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005b640
|
2023-09-25 16:28:25 -04:00
|
|
|
void LegoOmni::StartTimer()
|
2023-06-19 02:19:40 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
MxOmni::StartTimer();
|
|
|
|
SetAppCursor(2);
|
2023-06-19 02:19:40 -04:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x1005b650
|
2023-10-07 13:12:59 -04:00
|
|
|
void LegoOmni::StopTimer()
|
2023-06-19 02:19:40 -04:00
|
|
|
{
|
2023-10-24 19:38:27 -04:00
|
|
|
MxOmni::StopTimer();
|
|
|
|
SetAppCursor(0);
|
2023-06-19 02:19:40 -04:00
|
|
|
}
|
2023-11-05 10:20:00 -05:00
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100acf50
|
2023-11-21 03:44:45 -05:00
|
|
|
MxResult Start(MxDSAction* p_dsAction)
|
2023-11-05 10:20:00 -05:00
|
|
|
{
|
2023-11-21 03:44:45 -05:00
|
|
|
return MxOmni::GetInstance()->Start(p_dsAction);
|
2023-11-05 10:20:00 -05:00
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b6ff0
|
2023-11-21 03:44:45 -05:00
|
|
|
void MakeSourceName(char* p_output, const char* p_input)
|
2023-11-05 10:20:00 -05:00
|
|
|
{
|
2023-11-21 03:44:45 -05:00
|
|
|
const char* cln = strchr(p_input, ':');
|
|
|
|
if (cln) {
|
|
|
|
p_input = cln + 1;
|
|
|
|
}
|
2023-11-05 10:20:00 -05:00
|
|
|
|
2023-11-21 03:44:45 -05:00
|
|
|
strcpy(p_output, p_input);
|
|
|
|
|
|
|
|
strlwr(p_output);
|
|
|
|
|
|
|
|
char* extLoc = strstr(p_output, ".si");
|
|
|
|
if (extLoc) {
|
|
|
|
*extLoc = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b7050
|
2023-11-21 03:44:45 -05:00
|
|
|
MxBool KeyValueStringParse(char* p_outputValue, const char* p_key, const char* p_source)
|
|
|
|
{
|
|
|
|
MxBool didMatch = FALSE;
|
|
|
|
|
|
|
|
MxS16 len = strlen(p_source);
|
|
|
|
char* temp = new char[len + 1];
|
|
|
|
strcpy(temp, p_source);
|
|
|
|
|
|
|
|
char* token = strtok(temp, ", \t\r\n:");
|
|
|
|
while (token) {
|
|
|
|
len -= (strlen(token) + 1);
|
|
|
|
|
|
|
|
if (strcmpi(token, p_key) == 0) {
|
|
|
|
if (p_outputValue && len > 0) {
|
|
|
|
char* cur = &token[strlen(p_key)];
|
|
|
|
cur++;
|
|
|
|
while (*cur != ',') {
|
|
|
|
if (*cur == ' ' || *cur == '\0' || *cur == '\t' || *cur == '\n' || *cur == '\r')
|
|
|
|
break;
|
|
|
|
*p_outputValue++ = *cur++;
|
|
|
|
}
|
|
|
|
*p_outputValue = '\0';
|
|
|
|
}
|
|
|
|
|
|
|
|
didMatch = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
token = strtok(NULL, ", \t\r\n:");
|
|
|
|
}
|
|
|
|
|
|
|
|
delete[] temp;
|
|
|
|
return didMatch;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100b7210
|
2023-11-21 03:44:45 -05:00
|
|
|
void SetOmniUserMessage(void (*p_userMsg)(const char*, int))
|
|
|
|
{
|
|
|
|
g_omniUserMessage = p_userMsg;
|
|
|
|
}
|
|
|
|
|
2023-12-06 07:10:45 -05:00
|
|
|
// FUNCTION: LEGO1 0x100c0280
|
2023-11-21 03:44:45 -05:00
|
|
|
MxDSObject* CreateStreamObject(MxDSFile* p_file, MxS16 p_ofs)
|
|
|
|
{
|
|
|
|
char* buf;
|
|
|
|
_MMCKINFO tmp_chunk;
|
|
|
|
|
|
|
|
if (p_file->Seek(((MxLong*) p_file->GetBuffer())[p_ofs], 0)) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_file->Read((MxU8*) &tmp_chunk.ckid, 8) == 0 && tmp_chunk.ckid == FOURCC('M', 'x', 'S', 't')) {
|
|
|
|
if (p_file->Read((MxU8*) &tmp_chunk.ckid, 8) == 0 && tmp_chunk.ckid == FOURCC('M', 'x', 'O', 'b')) {
|
|
|
|
|
|
|
|
buf = new char[tmp_chunk.cksize];
|
|
|
|
if (!buf) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (p_file->Read((MxU8*) buf, tmp_chunk.cksize) != 0) {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Save a copy so we can clean up properly, because
|
|
|
|
// this function will alter the pointer value.
|
|
|
|
char* copy = buf;
|
|
|
|
MxDSObject* obj = DeserializeDSObjectDispatch(&buf, -1);
|
|
|
|
delete[] copy;
|
|
|
|
return obj;
|
|
|
|
}
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
2023-11-05 10:20:00 -05:00
|
|
|
}
|