From 641d9f1b8bcff517cfc3a4af9d87fbab1f507179 Mon Sep 17 00:00:00 2001 From: Christian Semmler Date: Wed, 12 Jun 2024 10:20:51 -0400 Subject: [PATCH] Fix CaveEntity class (#1024) * Fix CaveEntity class * Rename function --- LEGO1/lego/legoomni/include/buildingentity.h | 4 +- LEGO1/lego/legoomni/include/buildings.h | 39 +++++++++++++++---- LEGO1/lego/legoomni/include/caveentity.h | 10 ----- .../legoomni/src/actors/buildingentity.cpp | 2 +- LEGO1/lego/legoomni/src/actors/buildings.cpp | 26 ++++++++++--- .../legoomni/src/common/legoobjectfactory.cpp | 1 - 6 files changed, 55 insertions(+), 27 deletions(-) delete mode 100644 LEGO1/lego/legoomni/include/caveentity.h diff --git a/LEGO1/lego/legoomni/include/buildingentity.h b/LEGO1/lego/legoomni/include/buildingentity.h index dd6d4594..4639ee23 100644 --- a/LEGO1/lego/legoomni/include/buildingentity.h +++ b/LEGO1/lego/legoomni/include/buildingentity.h @@ -3,6 +3,8 @@ #include "legoentity.h" +class LegoEventNotificationParam; + // VTABLE: LEGO1 0x100d5c88 // SIZE 0x68 class BuildingEntity : public LegoEntity { @@ -25,7 +27,7 @@ class BuildingEntity : public LegoEntity { return !strcmp(p_name, BuildingEntity::ClassName()) || LegoEntity::IsA(p_name); } - virtual MxLong VTable0x50(MxParam& p_param) = 0; + virtual MxLong HandleClick(LegoEventNotificationParam& p_param) = 0; // SYNTHETIC: LEGO1 0x10015010 // BuildingEntity::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/buildings.h b/LEGO1/lego/legoomni/include/buildings.h index 39394628..da334b72 100644 --- a/LEGO1/lego/legoomni/include/buildings.h +++ b/LEGO1/lego/legoomni/include/buildings.h @@ -3,6 +3,8 @@ #include "buildingentity.h" +class LegoEventNotificationParam; + // VTABLE: LEGO1 0x100d48a8 // SIZE 0x68 class RaceStandsEntity : public BuildingEntity { @@ -19,7 +21,7 @@ class RaceStandsEntity : public BuildingEntity { return !strcmp(p_name, RaceStandsEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // SYNTHETIC: LEGO1 0x1000f9e0 // RaceStandsEntity::`scalar deleting destructor' @@ -42,7 +44,7 @@ class BeachHouseEntity : public BuildingEntity { return !strcmp(p_name, BeachHouseEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // SYNTHETIC: LEGO1 0x1000f970 // BeachHouseEntity::`scalar deleting destructor' @@ -65,7 +67,7 @@ class PoliceEntity : public BuildingEntity { return !strcmp(p_name, PoliceEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // vtable+0x50 // SYNTHETIC: LEGO1 0x1000f900 // PoliceEntity::`scalar deleting destructor' @@ -88,7 +90,7 @@ class InfoCenterEntity : public BuildingEntity { return !strcmp(p_name, InfoCenterEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // vtable+0x50 // SYNTHETIC: LEGO1 0x1000f7b0 // InfoCenterEntity::`scalar deleting destructor' @@ -111,12 +113,34 @@ class HospitalEntity : public BuildingEntity { return !strcmp(p_name, HospitalEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; // vtable+0x50 + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // vtable+0x50 // SYNTHETIC: LEGO1 0x1000f820 // HospitalEntity::`scalar deleting destructor' }; +// VTABLE: LEGO1 0x100d50c0 +// SIZE 0x68 +class CaveEntity : public BuildingEntity { + // FUNCTION: LEGO1 0x1000f1e0 + inline const char* ClassName() const override // vtable+0x0c + { + // STRING: LEGO1 0x100f0300 + return "RaceStandsEntity"; + } + + // FUNCTION: LEGO1 0x1000f1f0 + inline MxBool IsA(const char* p_name) const override // vtable+0x10 + { + return !strcmp(p_name, CaveEntity::ClassName()) || BuildingEntity::IsA(p_name); + } + + MxLong HandleClick(LegoEventNotificationParam& p_param) override; + + // SYNTHETIC: LEGO1 0x1000fa50 + // CaveEntity::`scalar deleting destructor' +}; + // VTABLE: LEGO1 0x100d5200 // SIZE 0x68 class JailEntity : public BuildingEntity { @@ -133,8 +157,7 @@ class JailEntity : public BuildingEntity { return !strcmp(p_name, JailEntity::ClassName()) || BuildingEntity::IsA(p_name); } - // STUB: LEGO1 0x100154f0 - MxLong VTable0x50(MxParam& p_param) override { return 0; } + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // SYNTHETIC: LEGO1 0x1000fac0 // JailEntity::`scalar deleting destructor' @@ -157,7 +180,7 @@ class GasStationEntity : public BuildingEntity { return !strcmp(p_name, GasStationEntity::ClassName()) || BuildingEntity::IsA(p_name); } - MxLong VTable0x50(MxParam& p_param) override; + MxLong HandleClick(LegoEventNotificationParam& p_param) override; // SYNTHETIC: LEGO1 0x1000f890 // GasStationEntity::`scalar deleting destructor' diff --git a/LEGO1/lego/legoomni/include/caveentity.h b/LEGO1/lego/legoomni/include/caveentity.h deleted file mode 100644 index 308f35bc..00000000 --- a/LEGO1/lego/legoomni/include/caveentity.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef CAVEENTITY_H -#define CAVEENTITY_H - -#include "buildings.h" - -// No overrides, uses vtable from RaceStandsEntity -// SIZE 0x68 -class CaveEntity : public RaceStandsEntity {}; - -#endif // CAVEENTITY_H diff --git a/LEGO1/lego/legoomni/src/actors/buildingentity.cpp b/LEGO1/lego/legoomni/src/actors/buildingentity.cpp index 9491c229..84dd87ec 100644 --- a/LEGO1/lego/legoomni/src/actors/buildingentity.cpp +++ b/LEGO1/lego/legoomni/src/actors/buildingentity.cpp @@ -22,7 +22,7 @@ BuildingEntity::~BuildingEntity() MxLong BuildingEntity::Notify(MxParam& p_param) { if (((MxNotificationParam&) p_param).GetType() == c_notificationClick) { - return VTable0x50(p_param); + return HandleClick((LegoEventNotificationParam&) p_param); } return 0; diff --git a/LEGO1/lego/legoomni/src/actors/buildings.cpp b/LEGO1/lego/legoomni/src/actors/buildings.cpp index 45cc73e1..98c295ec 100644 --- a/LEGO1/lego/legoomni/src/actors/buildings.cpp +++ b/LEGO1/lego/legoomni/src/actors/buildings.cpp @@ -24,7 +24,7 @@ DECOMP_SIZE_ASSERT(PoliceEntity, 0x68) DECOMP_SIZE_ASSERT(RaceStandsEntity, 0x68) // FUNCTION: LEGO1 0x100150c0 -MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) +MxLong InfoCenterEntity::HandleClick(LegoEventNotificationParam& p_param) { switch (GameState()->GetCurrentAct()) { case LegoGameState::Act::e_act1: { @@ -62,7 +62,7 @@ MxLong InfoCenterEntity::VTable0x50(MxParam& p_param) } // FUNCTION: LEGO1 0x100151d0 -MxLong GasStationEntity::VTable0x50(MxParam& p_param) +MxLong GasStationEntity::HandleClick(LegoEventNotificationParam& p_param) { if (FUN_1003ef60()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); @@ -86,7 +86,7 @@ MxLong GasStationEntity::VTable0x50(MxParam& p_param) } // FUNCTION: LEGO1 0x10015270 -MxLong HospitalEntity::VTable0x50(MxParam& p_param) +MxLong HospitalEntity::HandleClick(LegoEventNotificationParam& p_param) { if (FUN_1003ef60()) { Act1State* act1State = (Act1State*) GameState()->GetState("Act1State"); @@ -110,7 +110,7 @@ MxLong HospitalEntity::VTable0x50(MxParam& p_param) } // FUNCTION: LEGO1 0x10015310 -MxLong PoliceEntity::VTable0x50(MxParam& p_param) +MxLong PoliceEntity::HandleClick(LegoEventNotificationParam& p_param) { if (FUN_1003ef60()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); @@ -134,7 +134,7 @@ MxLong PoliceEntity::VTable0x50(MxParam& p_param) } // FUNCTION: LEGO1 0x100153b0 -MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) +MxLong BeachHouseEntity::HandleClick(LegoEventNotificationParam& p_param) { if (FUN_1003ef60()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); @@ -155,7 +155,7 @@ MxLong BeachHouseEntity::VTable0x50(MxParam& p_param) } // FUNCTION: LEGO1 0x10015450 -MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) +MxLong RaceStandsEntity::HandleClick(LegoEventNotificationParam& p_param) { if (FUN_1003ef60()) { Act1State* state = (Act1State*) GameState()->GetState("Act1State"); @@ -174,3 +174,17 @@ MxLong RaceStandsEntity::VTable0x50(MxParam& p_param) return 1; } + +// STUB: LEGO1 0x100154f0 +MxLong JailEntity::HandleClick(LegoEventNotificationParam& p_param) +{ + // TODO + return 0; +} + +// STUB: LEGO1 0x10015520 +MxLong CaveEntity::HandleClick(LegoEventNotificationParam& p_param) +{ + // TODO + return 0; +} diff --git a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp index e7cdf94d..66411554 100644 --- a/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp +++ b/LEGO1/lego/legoomni/src/common/legoobjectfactory.cpp @@ -67,7 +67,6 @@ #include "act3shark.h" #include "buildings.h" #include "bumpbouy.h" -#include "caveentity.h" #include "jukebox.h" #include "jukeboxentity.h" #include "legometerpresenter.h"