diff --git a/LEGO1/lego/legoomni/include/legoutils.h b/LEGO1/lego/legoomni/include/legoutils.h index 74545513..f501d1a1 100644 --- a/LEGO1/lego/legoomni/include/legoutils.h +++ b/LEGO1/lego/legoomni/include/legoutils.h @@ -1,6 +1,7 @@ #ifndef LEGOUTILS_H #define LEGOUTILS_H +#include "actionsfwd.h" #include "decomp.h" #include "extra.h" #include "mxtypes.h" @@ -33,6 +34,8 @@ class LegoPathActor; class LegoROI; class LegoTreeNode; +extern MxAtomId* g_isleScript; + LegoEntity* PickEntity(MxLong, MxLong); LegoROI* PickROI(MxLong, MxLong); MxS16 CountTotalTreeNodes(LegoTreeNode* p_node); @@ -54,6 +57,14 @@ LegoNamedTexture* ReadNamedTexture(LegoFile* p_file); void FUN_1003f540(LegoFile* p_file, const char* p_filename); void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_texture); +// FUNCTION: BETA10 0x100260a0 +inline void StartIsleAction(IsleScript::Script p_objectId) +{ + if (p_objectId != (IsleScript::Script) -1) { + InvokeAction(Extra::e_start, *g_isleScript, p_objectId, NULL); + } +} + // SYNTHETIC: LEGO1 0x10034b40 // LegoTexture::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/src/actors/buildings.cpp b/LEGO1/lego/legoomni/src/actors/buildings.cpp index 98c295ec..79e7ef23 100644 --- a/LEGO1/lego/legoomni/src/actors/buildings.cpp +++ b/LEGO1/lego/legoomni/src/actors/buildings.cpp @@ -8,10 +8,12 @@ #include "islepathactor.h" #include "legoact2.h" #include "legoanimationmanager.h" +#include "legoeventnotificationparam.h" #include "legogamestate.h" #include "legoutils.h" #include "legoworld.h" #include "misc.h" +#include "mxbackgroundaudiomanager.h" #include "mxtransitionmanager.h" #include "scripts.h" @@ -23,6 +25,20 @@ DECOMP_SIZE_ASSERT(JailEntity, 0x68) DECOMP_SIZE_ASSERT(PoliceEntity, 0x68) DECOMP_SIZE_ASSERT(RaceStandsEntity, 0x68) +// GLOBAL: LEGO1 0x100f0c2c +// STRING: LEGO1 0x100f0c24 +const char* g_chest = "chest"; + +// GLOBAL: LEGO1 0x100f0c30 +// STRING: LEGO1 0x100f0c18 +const char* g_cavedoor = "cavedoor"; + +// GLOBAL: LEGO1 0x100f0c34 +IsleScript::Script g_nextChestAction = IsleScript::c_nca001ca_RunAnim; + +// GLOBAL: LEGO1 0x100f0c38 +IsleScript::Script g_nextCavedoorAction = IsleScript::c_Avo900Ps_PlayWav; + // FUNCTION: LEGO1 0x100150c0 MxLong InfoCenterEntity::HandleClick(LegoEventNotificationParam& p_param) { @@ -175,16 +191,62 @@ MxLong RaceStandsEntity::HandleClick(LegoEventNotificationParam& p_param) return 1; } -// STUB: LEGO1 0x100154f0 +// FUNCTION: LEGO1 0x100154f0 +// FUNCTION: BETA10 0x100256e8 MxLong JailEntity::HandleClick(LegoEventNotificationParam& p_param) { - // TODO - return 0; + if (FUN_1003ef60()) { + PlayCamAnim(UserActor(), FALSE, 18, TRUE); + } + + return 1; } -// STUB: LEGO1 0x10015520 +// FUNCTION: LEGO1 0x10015520 +// FUNCTION: BETA10 0x10025719 MxLong CaveEntity::HandleClick(LegoEventNotificationParam& p_param) { - // TODO - return 0; + LegoROI* roi = p_param.GetROI(); + + if (!strncmp(roi->GetName(), g_chest, strlen(g_chest))) { + DeleteObjects(g_isleScript, IsleScript::c_nca001ca_RunAnim, IsleScript::c_nca003gh_RunAnim); + StartIsleAction(g_nextChestAction); + + switch (g_nextChestAction) { + case IsleScript::c_nca001ca_RunAnim: + g_nextChestAction = IsleScript::c_nca002sk_RunAnim; + break; + case IsleScript::c_nca002sk_RunAnim: + g_nextChestAction = IsleScript::c_nca003gh_RunAnim; + break; + case IsleScript::c_nca003gh_RunAnim: + g_nextChestAction = IsleScript::c_nca001ca_RunAnim; + break; + } + } + else if (!strcmp(roi->GetName(), g_cavedoor)) { + DeleteObjects(g_isleScript, IsleScript::c_Avo900Ps_PlayWav, IsleScript::c_Avo904Ps_PlayWav); + StartIsleAction(g_nextCavedoorAction); + BackgroundAudioManager()->LowerVolume(); + + switch (g_nextCavedoorAction) { + case IsleScript::c_Avo900Ps_PlayWav: + g_nextCavedoorAction = IsleScript::c_Avo901Ps_PlayWav; + break; + case IsleScript::c_Avo901Ps_PlayWav: + g_nextCavedoorAction = IsleScript::c_Avo902Ps_PlayWav; + break; + case IsleScript::c_Avo902Ps_PlayWav: + g_nextCavedoorAction = IsleScript::c_Avo903Ps_PlayWav; + break; + case IsleScript::c_Avo903Ps_PlayWav: + g_nextCavedoorAction = IsleScript::c_Avo904Ps_PlayWav; + break; + case IsleScript::c_Avo904Ps_PlayWav: + g_nextCavedoorAction = IsleScript::c_Avo900Ps_PlayWav; + break; + } + } + + return 1; }