Implement/match LegoEntity::Notify (#778)

This commit is contained in:
Christian Semmler 2024-04-06 13:59:38 -04:00 committed by GitHub
parent fc91da8666
commit f30ed0212b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 86 additions and 19 deletions

View file

@ -34,6 +34,7 @@ class LegoBuildingManager : public MxCore {
MxResult Load(LegoStorage* p_storage);
MxBool FUN_1002fdb0(LegoEntity* p_entity);
MxU32 FUN_1002ff40(LegoROI*, MxBool);
void FUN_10030000(LegoEntity* p_entity);
void FUN_10030590();
// SYNTHETIC: LEGO1 0x1002f940

View file

@ -60,7 +60,7 @@ class LegoEntity : public MxEntity {
virtual void VTable0x3c(); // vtable+0x3c
virtual void VTable0x40(); // vtable+0x40
virtual void VTable0x44(); // vtable+0x44
virtual void VTable0x48(); // vtable+0x48
virtual void VTable0x48(LegoROI* p_roi); // vtable+0x48
virtual void VTable0x4c(); // vtable+0x4c
void FUN_10010c30();
@ -97,8 +97,8 @@ class LegoEntity : public MxEntity {
// For tokens from the extra string that look like this:
// "Action:openram;\lego\scripts\Race\CarRaceR;0"
Extra::ActionType m_actionType; // 0x5c
char* m_actionArgString; // 0x60
MxS32 m_actionArgNumber; // 0x64
char* m_filename; // 0x60
MxS32 m_targetEntityId; // 0x64
};
// SYNTHETIC: LEGO1 0x1000c3b0

View file

@ -40,6 +40,7 @@ class LegoEventNotificationParam : public MxNotificationParam {
{
}
inline LegoROI* GetROI() { return m_roi; }
inline MxU8 GetModifier() { return m_modifier; }
inline MxU8 GetKey() const { return m_key; }

View file

@ -31,6 +31,7 @@ class LegoPlantManager : public MxCore {
MxResult Load(LegoStorage* p_storage);
MxBool FUN_100269e0(LegoEntity* p_entity);
MxU32 FUN_10026ba0(LegoROI*, MxBool);
void FUN_10026c50(LegoEntity* p_entity);
void FUN_10027120();
static void SetCustomizeAnimFile(const char* p_value);

View file

@ -89,6 +89,12 @@ void LegoBuildingManager::SetCustomizeAnimFile(const char* p_value)
}
}
// STUB: LEGO1 0x10030000
void LegoBuildingManager::FUN_10030000(LegoEntity* p_entity)
{
// TODO
}
// STUB: LEGO1 0x10030220
MxResult LegoBuildingManager::Tickle()
{

View file

@ -82,6 +82,12 @@ void LegoPlantManager::SetCustomizeAnimFile(const char* p_value)
}
}
// STUB: LEGO1 0x10026c50
void LegoPlantManager::FUN_10026c50(LegoEntity* p_entity)
{
// TODO
}
// STUB: LEGO1 0x10026e00
MxResult LegoPlantManager::Tickle()
{

View file

@ -3,6 +3,7 @@
#include "define.h"
#include "legobuildingmanager.h"
#include "legocharactermanager.h"
#include "legogamestate.h"
#include "legoplantmanager.h"
#include "legoutils.h"
#include "legovideomanager.h"
@ -21,11 +22,11 @@ void LegoEntity::Init()
m_worldSpeed = 0;
m_roi = NULL;
m_cameraFlag = FALSE;
m_actionArgString = NULL;
m_filename = NULL;
m_unk0x10 = 0;
m_flags = 0;
m_actionType = Extra::ActionType::e_unknown;
m_actionArgNumber = -1;
m_targetEntityId = -1;
m_unk0x59 = 4;
}
@ -96,7 +97,7 @@ void LegoEntity::Destroy(MxBool p_fromDestructor)
}
}
delete[] m_actionArgString;
delete[] m_filename;
Init();
}
@ -229,11 +230,11 @@ void LegoEntity::ParseAction(char* p_extra)
if (m_actionType != Extra::ActionType::e_exit) {
char* token = strtok(NULL, g_parseExtraTokens);
m_actionArgString = new char[strlen(token) + 1];
strcpy(m_actionArgString, token);
m_filename = new char[strlen(token) + 1];
strcpy(m_filename, token);
if (m_actionType != Extra::ActionType::e_run) {
m_actionArgNumber = atoi(strtok(NULL, g_parseExtraTokens));
m_targetEntityId = atoi(strtok(NULL, g_parseExtraTokens));
}
}
}
@ -308,7 +309,7 @@ void LegoEntity::VTable0x44()
}
// STUB: LEGO1 0x10011420
void LegoEntity::VTable0x48()
void LegoEntity::VTable0x48(LegoROI* p_roi)
{
// TODO
}
@ -325,10 +326,61 @@ void LegoEntity::FUN_100114e0(MxU8 p_unk0x59)
m_unk0x59 = p_unk0x59;
}
// STUB: LEGO1 0x100114f0
// FUNCTION: LEGO1 0x100114f0
MxLong LegoEntity::Notify(MxParam& p_param)
{
// TODO
LegoEventNotificationParam& param = (LegoEventNotificationParam&) p_param;
if (param.GetNotification() != c_notificationType11) {
return 0;
}
if (m_actionType != Extra::e_unknown) {
#ifdef COMPAT_MODE
{
MxAtomId atom(m_filename, e_lowerCase2);
InvokeAction(m_actionType, atom, m_targetEntityId, this);
}
#else
InvokeAction(m_actionType, MxAtomId(m_filename, e_lowerCase2), m_targetEntityId, this);
#endif
}
else {
switch (GameState()->GetActorId()) {
case 1:
if (GameState()->GetCurrentAct() != LegoGameState::e_act2 &&
GameState()->GetCurrentAct() != LegoGameState::e_act3) {
VTable0x3c();
}
break;
case 2:
VTable0x40();
break;
case 3:
VTable0x44();
break;
case 4:
VTable0x48(param.GetROI());
break;
case 5:
VTable0x4c();
break;
case 6:
switch (m_unk0x59) {
case 0:
case 1:
break;
case 2:
PlantManager()->FUN_10026c50(this);
break;
case 3:
BuildingManager()->FUN_10030000(this);
break;
case 4:
break;
}
}
}
return 1;
}