Implement/match JailEntity::HandleClick and CaveEntity::HandleClick (#1025)

* Implement/match JailEntity::HandleClick and CaveEntity::HandleClick

* Fix
This commit is contained in:
Christian Semmler 2024-06-12 11:13:06 -04:00 committed by GitHub
parent 641d9f1b8b
commit abb4483e18
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 79 additions and 6 deletions

View file

@ -1,6 +1,7 @@
#ifndef LEGOUTILS_H #ifndef LEGOUTILS_H
#define LEGOUTILS_H #define LEGOUTILS_H
#include "actionsfwd.h"
#include "decomp.h" #include "decomp.h"
#include "extra.h" #include "extra.h"
#include "mxtypes.h" #include "mxtypes.h"
@ -33,6 +34,8 @@ class LegoPathActor;
class LegoROI; class LegoROI;
class LegoTreeNode; class LegoTreeNode;
extern MxAtomId* g_isleScript;
LegoEntity* PickEntity(MxLong, MxLong); LegoEntity* PickEntity(MxLong, MxLong);
LegoROI* PickROI(MxLong, MxLong); LegoROI* PickROI(MxLong, MxLong);
MxS16 CountTotalTreeNodes(LegoTreeNode* p_node); 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 FUN_1003f540(LegoFile* p_file, const char* p_filename);
void WriteNamedTexture(LegoFile* p_file, LegoNamedTexture* p_texture); 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 // SYNTHETIC: LEGO1 0x10034b40
// LegoTexture::`scalar deleting destructor' // LegoTexture::`scalar deleting destructor'

View file

@ -8,10 +8,12 @@
#include "islepathactor.h" #include "islepathactor.h"
#include "legoact2.h" #include "legoact2.h"
#include "legoanimationmanager.h" #include "legoanimationmanager.h"
#include "legoeventnotificationparam.h"
#include "legogamestate.h" #include "legogamestate.h"
#include "legoutils.h" #include "legoutils.h"
#include "legoworld.h" #include "legoworld.h"
#include "misc.h" #include "misc.h"
#include "mxbackgroundaudiomanager.h"
#include "mxtransitionmanager.h" #include "mxtransitionmanager.h"
#include "scripts.h" #include "scripts.h"
@ -23,6 +25,20 @@ DECOMP_SIZE_ASSERT(JailEntity, 0x68)
DECOMP_SIZE_ASSERT(PoliceEntity, 0x68) DECOMP_SIZE_ASSERT(PoliceEntity, 0x68)
DECOMP_SIZE_ASSERT(RaceStandsEntity, 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 // FUNCTION: LEGO1 0x100150c0
MxLong InfoCenterEntity::HandleClick(LegoEventNotificationParam& p_param) MxLong InfoCenterEntity::HandleClick(LegoEventNotificationParam& p_param)
{ {
@ -175,16 +191,62 @@ MxLong RaceStandsEntity::HandleClick(LegoEventNotificationParam& p_param)
return 1; return 1;
} }
// STUB: LEGO1 0x100154f0 // FUNCTION: LEGO1 0x100154f0
// FUNCTION: BETA10 0x100256e8
MxLong JailEntity::HandleClick(LegoEventNotificationParam& p_param) MxLong JailEntity::HandleClick(LegoEventNotificationParam& p_param)
{ {
// TODO if (FUN_1003ef60()) {
return 0; PlayCamAnim(UserActor(), FALSE, 18, TRUE);
} }
// STUB: LEGO1 0x10015520 return 1;
}
// FUNCTION: LEGO1 0x10015520
// FUNCTION: BETA10 0x10025719
MxLong CaveEntity::HandleClick(LegoEventNotificationParam& p_param) MxLong CaveEntity::HandleClick(LegoEventNotificationParam& p_param)
{ {
// TODO LegoROI* roi = p_param.GetROI();
return 0;
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;
} }