Additional isle functions (#335)

* additional Isle functions

* fix

* Update isle.cpp

* add notify + fix typo

* Update legoutil.h

* Match Isle::Create

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha 2023-12-15 18:11:34 -05:00 committed by GitHub
parent 1dc5d90d45
commit a1b7a8bc66
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 222 additions and 32 deletions

View file

@ -1,27 +1,178 @@
#include "isle.h" #include "isle.h"
#include "act1state.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h" #include "legoomni.h"
#include "legoutil.h"
#include "mxnotificationmanager.h" #include "mxnotificationmanager.h"
#include "mxtransitionmanager.h"
DECOMP_SIZE_ASSERT(Isle, 0x140); DECOMP_SIZE_ASSERT(Isle, 0x140);
// FUNCTION: LEGO1 0x10030820 // FUNCTION: LEGO1 0x10030820
Isle::Isle() Isle::Isle()
{ {
m_unk0xfc = 0; m_pizza = NULL;
m_unk0x100 = 0; m_pizzeria = NULL;
m_unk0x104 = 0; m_towtrack = NULL;
m_unk0x108 = 0; m_ambulance = NULL;
m_unk0x10c = 0; m_jukebox = NULL;
m_unk0x110 = 0; m_helicopter = NULL;
m_unk0x114 = 0; m_bike = NULL;
m_unk0x118 = 0; m_dunebuggy = NULL;
m_unk0x11c = 0; m_motorcycle = NULL;
m_unk0x120 = 0; m_skateboard = NULL;
m_unk0x124 = 0; m_racecar = NULL;
m_unk0x128 = 0; m_jetski = NULL;
m_unk0xf8 = 0; m_act1state = 0;
m_unk0x13c = 0; m_unk0x13c = 0;
NotificationManager()->Register(this); NotificationManager()->Register(this);
} }
// FUNCTION: LEGO1 0x10030a50
Isle::~Isle()
{
TransitionManager()->SetWaitIndicator(NULL);
ControlManager()->Unregister(this);
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
if (GetCurrentVehicle() != NULL) {
VTable0x6c((MxCore*) GetCurrentVehicle());
}
NotificationManager()->Unregister(this);
}
// FUNCTION: LEGO1 0x10030b20
MxResult Isle::Create(MxDSObject& p_dsObject)
{
GameState()->FUN_1003ceb0();
MxResult result = LegoWorld::SetAsCurrentWorld(p_dsObject);
if (result == SUCCESS) {
ControlManager()->Register(this);
InputManager()->SetWorld(this);
GameState()->FUN_1003a720(0);
switch (GameState()->GetCurrentAct()) {
case 1:
GameState()->FUN_1003a720(0x2e);
break;
case 2:
GameState()->FUN_1003a720(0x2e);
break;
case -1:
m_unk0x13c = 2;
}
if (GameState()->GetUnknown424() == 1) {
GameState()->SetUnknown424(0);
}
LegoGameState* gameState = GameState();
Act1State* state = (Act1State*) gameState->GetState("Act1State");
if (state == NULL) {
state = (Act1State*) gameState->CreateState("Act1State");
}
m_act1state = state;
FUN_1003ef00(TRUE);
GameState()->SetDirty(TRUE);
}
return result;
}
// STUB: LEGO1 0x10030c10
MxLong Isle::Notify(MxParam& p_param)
{
// TODO
return 0;
}
// STUB: LEGO1 0x10030fc0
void Isle::Stop()
{
// TODO
}
// STUB: LEGO1 0x10031820
void Isle::VTable0x68(MxBool p_add)
{
// TODO
}
// FUNCTION: LEGO1 0x10032f10
void Isle::VTable0x58(MxCore* p_object)
{
LegoWorld::VTable0x58(p_object);
if (p_object->IsA("Pizza")) {
m_pizza = (Pizza*) p_object;
}
else if (p_object->IsA("Pizzeria")) {
m_pizzeria = (Pizzeria*) p_object;
}
else if (p_object->IsA("TowTrack")) {
m_towtrack = (TowTrack*) p_object;
}
else if (p_object->IsA("Ambulance")) {
m_ambulance = (Ambulance*) p_object;
}
else if (p_object->IsA("JukeBoxEntity")) {
m_jukebox = (JukeBoxEntity*) p_object;
}
else if (p_object->IsA("Helicopter")) {
m_helicopter = (Helicopter*) p_object;
}
else if (p_object->IsA("Bike")) {
m_bike = (Bike*) p_object;
}
else if (p_object->IsA("DuneBuggy")) {
m_dunebuggy = (DuneBuggy*) p_object;
}
else if (p_object->IsA("Motorcycle")) {
m_motorcycle = (Motorcycle*) p_object;
}
else if (p_object->IsA("SkateBoard")) {
m_skateboard = (SkateBoard*) p_object;
}
else if (p_object->IsA("Jetski")) {
m_jetski = (Jetski*) p_object;
}
else if (p_object->IsA("RaceCar")) {
m_racecar = (RaceCar*) p_object;
}
}
// FUNCTION: LEGO1 0x10033050
void Isle::VTable0x6c(MxCore* p_object)
{
LegoWorld::EndAction(p_object);
if (p_object->IsA("Helicopter")) {
m_helicopter = NULL;
}
else if (p_object->IsA("DuneBuggy")) {
m_dunebuggy = NULL;
}
else if (p_object->IsA("Jetski")) {
m_jetski = 0;
}
else if (p_object->IsA("RaceCar")) {
m_racecar = 0;
}
}
// STUB: LEGO1 0x10033180
MxBool Isle::VTable0x64()
{
// TODO
return FALSE;
}

View file

@ -4,12 +4,29 @@
#include "legoworld.h" #include "legoworld.h"
#include "radio.h" #include "radio.h"
class Pizza;
class Pizzeria;
class TowTrack;
class Ambulance;
class JukeBoxEntity;
class Helicopter;
class Bike;
class DuneBuggy;
class Motorcycle;
class SkateBoard;
class RaceCar;
class Jetski;
class Act1State;
// VTABLE: LEGO1 0x100d6fb8 // VTABLE: LEGO1 0x100d6fb8
// SIZE 0x140 // SIZE 0x140
// Radio at 0x12c // Radio at 0x12c
class Isle : public LegoWorld { class Isle : public LegoWorld {
public: public:
Isle(); Isle();
virtual ~Isle() override;
virtual MxLong Notify(MxParam& p_param) override; // vtable+0x4
// FUNCTION: LEGO1 0x10030910 // FUNCTION: LEGO1 0x10030910
inline virtual const char* ClassName() const override // vtable+0x0c inline virtual const char* ClassName() const override // vtable+0x0c
@ -23,24 +40,35 @@ class Isle : public LegoWorld {
{ {
return !strcmp(p_name, Isle::ClassName()) || LegoWorld::IsA(p_name); return !strcmp(p_name, Isle::ClassName()) || LegoWorld::IsA(p_name);
} }
virtual MxResult Create(MxDSObject& p_dsObject) override; // vtable+0x18
virtual void Stop() override; // vtable+50
virtual void VTable0x58(MxCore* p_object); // vtable+58
// FUNCTION: LEGO1 0x10030900
virtual MxBool VTable0x5c() { return TRUE; } // vtable+5c
// FUNCTION: LEGO1 0x10033170
virtual void VTable0x60() {} // vtable+60
virtual MxBool VTable0x64(); // vtable+64
virtual void VTable0x68(MxBool p_add); // vtable+68
virtual void VTable0x6c(MxCore* p_object);
inline void SetUnknown13c(MxU32 p_unk0x13c) { m_unk0x13c = p_unk0x13c; } inline void SetUnknown13c(MxU32 p_unk0x13c) { m_unk0x13c = p_unk0x13c; }
protected: protected:
undefined4 m_unk0xf8; // 0xf8 Act1State* m_act1state; // 0xf8
undefined4 m_unk0xfc; // 0xfc Pizza* m_pizza; // 0xfc
undefined4 m_unk0x100; // 0x100 Pizzeria* m_pizzeria; // 0x100
undefined4 m_unk0x104; // 0x104 TowTrack* m_towtrack; // 0x104
undefined4 m_unk0x108; // 0x108 Ambulance* m_ambulance; // 0x108
undefined4 m_unk0x10c; // 0x10c JukeBoxEntity* m_jukebox; // 0x10c
undefined4 m_unk0x110; // 0x110 Helicopter* m_helicopter; // 0x110
undefined4 m_unk0x114; // 0x114 Bike* m_bike; // 0x114
undefined4 m_unk0x118; // 0x118 DuneBuggy* m_dunebuggy; // 0x118
undefined4 m_unk0x11c; // 0x11c Motorcycle* m_motorcycle; // 0x11c
undefined4 m_unk0x120; // 0x120 SkateBoard* m_skateboard; // 0x120
undefined4 m_unk0x124; // 0x124 RaceCar* m_racecar; // 0x124
undefined4 m_unk0x128; // 0x128 Jetski* m_jetski; // 0x128
Radio m_radio; // 0x12c Radio m_radio; // 0x12c
MxU32 m_unk0x13c; // 0x13c MxU32 m_unk0x13c; // 0x13c
}; };
#endif // ISLE_H #endif // ISLE_H

View file

@ -36,6 +36,9 @@ class LegoGameState {
inline MxU8 GetUnknownC() { return m_unk0xc; } inline MxU8 GetUnknownC() { return m_unk0xc; }
inline MxU32 GetUnknown10() { return m_unk0x10; } inline MxU32 GetUnknown10() { return m_unk0x10; }
inline MxS32 GetCurrentAct() { return m_currentAct; }
inline undefined4 GetUnknown424() { return m_unk0x424; }
inline void SetDirty(MxBool p_dirty) { m_isDirty = p_dirty; }
inline void SetUnknown424(undefined4 p_unk0x424) { m_unk0x424 = p_unk0x424; } inline void SetUnknown424(undefined4 p_unk0x424) { m_unk0x424 = p_unk0x424; }
void SetSomeEnumState(undefined4 p_state); void SetSomeEnumState(undefined4 p_state);
@ -59,14 +62,15 @@ class LegoGameState {
LegoState** m_stateArray; // 0x8 LegoState** m_stateArray; // 0x8
MxU8 m_unk0xc; // 0xc MxU8 m_unk0xc; // 0xc
MxU32 m_unk0x10; // 0x10 MxU32 m_unk0x10; // 0x10
undefined4 m_currentAct; // 0x14 MxS32 m_currentAct; // 0x14
LegoBackgroundColor* m_backgroundColor; // 0x18 LegoBackgroundColor* m_backgroundColor; // 0x18
LegoBackgroundColor* m_tempBackgroundColor; // 0x1c LegoBackgroundColor* m_tempBackgroundColor; // 0x1c
LegoFullScreenMovie* m_fullScreenMovie; // 0x20 LegoFullScreenMovie* m_fullScreenMovie; // 0x20
MxU16 m_unk0x24; // 0x24 MxU16 m_unk0x24; // 0x24
undefined m_unk0x28[128]; // 0x28 undefined m_unk0x28[128]; // 0x28
ScoreStruct m_unk0xa6; // 0xa6 ScoreStruct m_unk0xa6; // 0xa6
undefined m_unk0x41a[10]; // 0x41a - might be part of the structure at 0xa6 undefined m_unk0x41a[8]; // 0x41a - might be part of the structure at 0xa6
MxBool m_isDirty; // 0x420
undefined4 m_unk0x424; // 0x424 undefined4 m_unk0x424; // 0x424
undefined4 m_unk0x428; // 0x428 undefined4 m_unk0x428; // 0x428
undefined4 m_unk0x42c; // 0x42c undefined4 m_unk0x42c; // 0x42c

View file

@ -112,6 +112,12 @@ void FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id)
{ {
} }
// STUB: LEGO1 0x1003ef00
void FUN_1003ef00(MxBool)
{
// TODO (something related to animation manager)
}
// FUNCTION: LEGO1 0x1003ef40 // FUNCTION: LEGO1 0x1003ef40
void SetAppCursor(WPARAM p_wparam) void SetAppCursor(WPARAM p_wparam)
{ {

View file

@ -59,6 +59,7 @@ ExtraActionType MatchActionString(const char*);
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender); void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender);
void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut); void ConvertHSVToRGB(float p_h, float p_s, float p_v, float* p_rOut, float* p_bOut, float* p_gOut);
void FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id); void FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id);
void FUN_1003ef00(MxBool);
void SetAppCursor(WPARAM p_wparam); void SetAppCursor(WPARAM p_wparam);
MxBool FUN_1003ef60(); MxBool FUN_1003ef60();

View file

@ -98,7 +98,7 @@ void LegoWorld::VTable0x58(MxCore* p_object)
} }
// STUB: LEGO1 0x10020f10 // STUB: LEGO1 0x10020f10
void LegoWorld::EndAction(MxPresenter* p_presenter) void LegoWorld::EndAction(MxCore* p_presenter)
{ {
} }

View file

@ -44,7 +44,7 @@ class LegoWorld : public LegoEntity {
inline LegoCameraController* GetCamera() { return m_camera; } inline LegoCameraController* GetCamera() { return m_camera; }
MxResult SetAsCurrentWorld(MxDSObject& p_dsObject); MxResult SetAsCurrentWorld(MxDSObject& p_dsObject);
void EndAction(MxPresenter* p_presenter); void EndAction(MxCore* p_presenter);
void FUN_1001fc80(IslePathActor* p_actor); void FUN_1001fc80(IslePathActor* p_actor);
MxBool FUN_100727e0(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up); MxBool FUN_100727e0(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up);
MxBool FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up); MxBool FUN_10072980(MxU32, Vector3Data& p_loc, Vector3Data& p_dir, Vector3Data& p_up);