Apply changes (see comment)

This commit is contained in:
Christian Semmler 2023-10-23 07:10:12 -04:00
parent e399d9898d
commit bcff16efe7
35 changed files with 349 additions and 154 deletions

View File

@ -99,6 +99,7 @@ add_library(lego1 SHARED
LEGO1/legoworldpresenter.cpp
LEGO1/motorcycle.cpp
LEGO1/mxactionnotificationparam.cpp
LEGO1/mxappnotificationparam.cpp
LEGO1/mxatomid.cpp
LEGO1/mxatomidcounter.cpp
LEGO1/mxaudiomanager.cpp
@ -177,6 +178,7 @@ add_library(lego1 SHARED
LEGO1/mxticklemanager.cpp
LEGO1/mxtimer.cpp
LEGO1/mxtransitionmanager.cpp
LEGO1/mxtype17notificationparam.cpp
LEGO1/mxvariable.cpp
LEGO1/mxvariabletable.cpp
LEGO1/mxvector.cpp

View File

@ -1,5 +1,7 @@
#include "ambulancemissionstate.h"
DECOMP_SIZE_ASSERT(AmbulanceMissionState, 0x24);
// OFFSET: LEGO1 0x100373a0 STUB
AmbulanceMissionState::AmbulanceMissionState()
{

View File

@ -22,6 +22,7 @@ class AmbulanceMissionState : public LegoState
{
return !strcmp(name, AmbulanceMissionState::ClassName()) || LegoState::IsA(name);
}
inline MxU16 GetColor(MxU8 id)
{
switch (id)

View File

@ -1,18 +1,25 @@
#include "gifmanager.h"
DECOMP_SIZE_ASSERT(GifData, 0x14);
DECOMP_SIZE_ASSERT(GifMapEntry, 0x14);
DECOMP_SIZE_ASSERT(GifMap, 0x08);
DECOMP_SIZE_ASSERT(GifManagerBase, 0x14);
DECOMP_SIZE_ASSERT(GifManager, 0x30);
GifMapEntry *DAT_100f0100;
// OFFSET: LEGO1 0x10001cc0
GifMapEntry *GifMap::FindNode(const char *&string)
{
GifMapEntry *ret = m_unk4;
GifMapEntry *current = ret->parent;
GifMapEntry *current = ret->m_parent;
while (current != DAT_100f0100) {
if (strcmp(current->key, string) <= 0) {
if (strcmp(current->m_key, string) <= 0) {
ret = current;
current = current->right;
current = current->m_right;
}
else current = current->left;
else
current = current->m_left;
}
return ret;
}
GifMapEntry *DAT_100f0100;
}

View File

@ -3,61 +3,69 @@
#include "decomp.h"
#include "mxtypes.h"
#include "ddraw.h"
#include "d3drmobj.h"
struct GifData {
public:
const char *m_name;
LPDIRECTDRAWSURFACE m_surface;
LPDIRECTDRAWPALETTE m_palette;
LPDIRECT3DRMTEXTURE2 m_texture;
MxU8 *data;
#include <ddraw.h>
#include <d3drmobj.h>
struct GifData
{
public:
const char *m_name;
LPDIRECTDRAWSURFACE m_surface;
LPDIRECTDRAWPALETTE m_palette;
LPDIRECT3DRMTEXTURE2 m_texture;
MxU8 *m_data;
};
struct GifMapEntry {
public:
GifMapEntry *right;
GifMapEntry *parent;
GifMapEntry *left;
const char *key;
GifData *value;
struct GifMapEntry
{
public:
GifMapEntry *m_right;
GifMapEntry *m_parent;
GifMapEntry *m_left;
const char *m_key;
GifData *m_value;
};
extern GifMapEntry *DAT_100f0100;
class GifMap
{
public:
GifMapEntry *GifMap::FindNode(const char *&string);
GifMapEntry *FindNode(const char *&string);
inline GifData *Get(const char *string) {
GifData *ret = NULL;
GifMapEntry *entry = FindNode(string);
if (((m_unk4 == entry || strcmp(string, entry->key) > 0) ? m_unk4 : entry) != entry) {
ret = entry->value;
}
if (((m_unk4 == entry || strcmp(string, entry->m_key) > 0) ? m_unk4 : entry) != entry)
ret = entry->m_value;
return ret;
}
undefined4 m_unk0;
GifMapEntry *m_unk4;
};
//VTABLE 100d86d4
class GifManagerBase {
// VTABLE 0x100d86d4
class GifManagerBase
{
public:
//OFFSET: LEGO1 0x1005a310 STUB
// OFFSET: LEGO1 0x1005a310 STUB
virtual ~GifManagerBase() {} // vtable+00
inline GifData *Get(const char *name) { return m_unk8.Get(name); }
protected:
undefined4 m_unk0;
undefined4 m_unk4;
GifMap m_unk8;
};
//VTABLE 100d86fc
class GifManager : public GifManagerBase {
//OFFSET: LEGO1 0x1005a580 STUB
// VTABLE 0x100d86fc
class GifManager : public GifManagerBase
{
public:
// OFFSET: LEGO1 0x1005a580 STUB
virtual ~GifManager() {} // vtable+00
protected:
undefined m_unk[0x1c];
};

View File

@ -23,8 +23,11 @@ MxResult LegoControlManager::Tickle()
// OFFSET: LEGO1 0x10028e10 STUB
void LegoControlManager::Register(MxCore *p_listener)
{
// TODO
}
// OFFSET: LEGO1 0x10028ea0 STUB
void LegoControlManager::Unregister(MxCore *p_listener)
{
// TODO
}

View File

@ -24,6 +24,7 @@ class LegoControlManager : public MxCore
{
return !strcmp(name, LegoControlManager::ClassName()) || MxCore::IsA(name);
}
void Register(MxCore *p_listener);
void Unregister(MxCore *p_listener);
};

View File

@ -37,10 +37,10 @@ void LegoEntity::Reset()
}
// OFFSET: LEGO1 0x100107e0
MxResult LegoEntity::InitFromMxDSObject(MxDSObject& p_object)
MxResult LegoEntity::InitFromMxDSObject(MxDSObject &p_dsObject)
{
m_mxEntityId = p_object.GetObjectId();
m_atom = p_object.GetAtomId();
m_mxEntityId = p_dsObject.GetObjectId();
m_atom = p_dsObject.GetAtomId();
AddToCurrentWorld();
return SUCCESS;
}
@ -88,3 +88,63 @@ void LegoEntity::ParseAction(char *p_extra)
}
}
}
// OFFSET: LEGO1 0x100108a0 STUB
void LegoEntity::VTable0x24()
{
// TODO
}
// OFFSET: LEGO1 0x10010790 STUB
void LegoEntity::VTable0x28()
{
// TODO
}
// OFFSET: LEGO1 0x10010650 STUB
void LegoEntity::VTable0x2c()
{
// TODO
}
// OFFSET: LEGO1 0x10010f10 STUB
void LegoEntity::VTable0x34()
{
// TODO
}
// OFFSET: LEGO1 0x10011070 STUB
void LegoEntity::VTable0x38()
{
// TODO
}
// OFFSET: LEGO1 0x10011300 STUB
void LegoEntity::VTable0x3c()
{
// TODO
}
// OFFSET: LEGO1 0x10011360 STUB
void LegoEntity::VTable0x40()
{
// TODO
}
// OFFSET: LEGO1 0x100113c0 STUB
void LegoEntity::VTable0x44()
{
// TODO
}
// OFFSET: LEGO1 0x10011420 STUB
void LegoEntity::VTable0x48()
{
// TODO
}
// OFFSET: LEGO1 0x10011470 STUB
void LegoEntity::VTable0x4c()
{
// TODO
}

View File

@ -35,11 +35,21 @@ class LegoEntity : public MxEntity
return !strcmp(name, LegoEntity::ClassName()) || MxEntity::IsA(name);
}
virtual MxResult InitFromMxDSObject(MxDSObject& p_object); // vtable+0x18
virtual MxResult InitFromMxDSObject(MxDSObject &p_dsObject); // vtable+0x18
virtual void Destroy(MxBool p_fromDestructor); // vtable+0x1c
virtual void ParseAction(char *); // vtable+0x20
virtual void VTable0x24(); // vtable+0x24
virtual void VTable0x28(); // vtable+0x28
virtual void VTable0x2c(); // vtable+0x2c
// OFFSET: LEGO1 0x10001090
virtual void VTable0x30(undefined4 p_1) { m_unk50 = p_1; }
virtual void VTable0x30(undefined4 p_unk50) { m_unk50 = p_unk50; } // vtable+0x30
virtual void VTable0x34(); // vtable+0x34
virtual void VTable0x38(); // vtable+0x38
virtual void VTable0x3c(); // vtable+0x3c
virtual void VTable0x40(); // vtable+0x40
virtual void VTable0x44(); // vtable+0x44
virtual void VTable0x48(); // vtable+0x48
virtual void VTable0x4c(); // vtable+0x4c
protected:
void Reset();
@ -59,7 +69,6 @@ class LegoEntity : public MxEntity
ExtraActionType m_actionType; // 0x5c
char *m_actionArgString; // 0x60
MxS32 m_actionArgNumber; // 0x64
};
#endif // LEGOENTITY_H

View File

@ -236,13 +236,13 @@ void LegoGameState::RegisterState(LegoState *p_state)
}
// OFFSET: LEGO1 0x1003a720 STUB
void LegoGameState::FUN_1003a720(MxU32 p_1)
void LegoGameState::FUN_1003a720(MxU32 p_unk)
{
// TODO
}
// OFFSET: LEGO1 0x1003b060 STUB
void LegoGameState::HandleAction(MxU32 p_1)
void LegoGameState::HandleAction(MxU32 p_unk)
{
// TODO
}

View File

@ -33,9 +33,10 @@ class LegoGameState
LegoState *CreateState(char *p_stateName);
void GetFileSavePath(MxString *p_outPath, MxULong p_slotn);
inline void Set424(MxU32 p_1) { m_unk424 = p_1; }
void FUN_1003a720(MxU32 p_1);
void HandleAction(MxU32 p_1);
void FUN_1003a720(MxU32 p_unk);
void HandleAction(MxU32 p_unk);
inline void SetUnknown424(undefined4 p_unk424) { m_unk424 = p_unk424; }
private:
void RegisterState(LegoState *p_state);
@ -53,8 +54,8 @@ class LegoGameState
LegoFullScreenMovie *m_fullScreenMovie; // 0x20
MxU16 m_unk24; // 0x24
undefined m_unk28[1020];
MxU32 m_unk424;
MxU32 m_unk428;
undefined4 m_unk424;
undefined4 m_unk428;
undefined4 m_unk42c;
};

View File

@ -41,15 +41,16 @@ class LegoInputManager : public MxPresenter
MxResult GetJoystickState(MxU32 *joystick_x, MxU32 *joystick_y, DWORD *buttons_state, MxU32 *pov_position);
void SetTimer();
void KillTimer();
inline LegoControlManager *GetControlManager() { return m_controlManager; }
inline LegoWorld *GetWorld() { return m_world; }
void SetCamera(LegoCameraController *p_camera);
void ClearCamera();
void SetWorld(LegoWorld *p_world);
void ClearWorld();
void inline SetM88(MxBool p_1) { m_unk0x88 = p_1; }
void inline SetM336(MxBool p_1) { m_unk0x336 = p_1; }
inline void SetUnknown88(MxBool p_unk0x88) { m_unk0x88 = p_unk0x88; }
inline void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; }
inline LegoControlManager *GetControlManager() { return m_controlManager; }
inline LegoWorld *GetWorld() { return m_world; }
//private:
MxCriticalSection m_criticalSection;
@ -81,6 +82,4 @@ class LegoInputManager : public MxPresenter
MxBool m_unk0x336;
};
LegoControlManager* ControlManager();
#endif // LEGOINPUTMANAGER_H

View File

@ -363,6 +363,7 @@ LegoWorld *GetCurrentWorld()
}
// OFFSET: LEGO1 0x10015800
GifManager *GetGifManager() {
GifManager *GetGifManager()
{
return LegoOmni::GetInstance()->GetGifManager();
}

View File

@ -9,6 +9,7 @@ class GifManager;
class Isle;
class LegoAnimationManager;
class LegoBuildingManager;
class LegoControlManager;
class LegoEntity;
class LegoGameState;
class LegoInputManager;
@ -116,9 +117,11 @@ __declspec(dllexport) MxTransitionManager * TransitionManager();
__declspec(dllexport) LegoVideoManager * VideoManager();
LegoBuildingManager* BuildingManager();
LegoControlManager* ControlManager();
Isle* GetIsle();
LegoPlantManager* PlantManager();
MxBool KeyValueStringParse(char *, const char *, const char *);
LegoWorld *GetCurrentWorld();
GifManager *GetGifManager();
#endif // LEGOOMNI_H

View File

@ -3,6 +3,8 @@
#include "legoinputmanager.h"
#include "mxticklemanager.h"
DECOMP_SIZE_ASSERT(LegoWorld, 0xf8);
MxBool g_isWorldActive;
// OFFSET: LEGO1 0x1001ca40 STUB
@ -18,44 +20,69 @@ LegoWorld::~LegoWorld()
}
// OFFSET: LEGO1 0x10022340
void LegoWorld::Stop() {
void LegoWorld::Stop()
{
TickleManager()->UnregisterClient(this);
}
// OFFSET: LEGO1 0x1001f630 STUB
void LegoWorld::VTable0x54()
{
// TODO
}
// OFFSET: LEGO1 0x10020220 STUB
void LegoWorld::VTable0x58()
{
// TODO
}
// OFFSET: LEGO1 0x1001d670
MxBool LegoWorld::VTable0x5c() {
MxBool LegoWorld::VTable0x5c()
{
return FALSE;
}
// OFFSET: LEGO1 0x100010a0
void LegoWorld::VTable0x60() {
void LegoWorld::VTable0x60()
{
}
// OFFSET: LEGO1 0x1001d680
MxBool LegoWorld::VTable0x64()
{
return FALSE;
}
// OFFSET: LEGO1 0x10021a70 STUB
void LegoWorld::VTable0x68(MxBool p_add) {
void LegoWorld::VTable0x68(MxBool p_add)
{
// TODO
}
// OFFSET: LEGO1 0x1001e0b0 STUB
MxResult LegoWorld::SetAsCurrentWorld(MxDSObject& p_object)
MxResult LegoWorld::SetAsCurrentWorld(MxDSObject &p_dsObject)
{
// TODO
return SUCCESS;
}
// OFFSET: LEGO1 0x10015820 STUB
void FUN_10015820(MxU32 p_1, MxU32 p_2)
void FUN_10015820(MxU32 p_unk1, MxU32 p_unk2)
{
// TODO
}
// OFFSET: LEGO1 0x10015910 STUB
void FUN_10015910(MxU32 p_1)
void FUN_10015910(MxU32 p_unk1)
{
// TODO
}
// OFFSET: LEGO1 0x100159c0
void SetIsWorldActive(MxBool p_active)
void SetIsWorldActive(MxBool p_isWorldActive)
{
if (!p_active) LegoOmni::GetInstance()->GetInputManager()->SetCamera(NULL);
g_isWorldActive = p_active;
if (!p_isWorldActive)
LegoOmni::GetInstance()->GetInputManager()->SetCamera(NULL);
g_isWorldActive = p_isWorldActive;
}

View File

@ -24,22 +24,27 @@ class LegoWorld : public LegoEntity
{
return !strcmp(name, LegoWorld::ClassName()) || LegoEntity::IsA(name);
}
virtual void Stop(); //vtable+50
virtual void Stop(); // vtable+50
virtual void VTable0x54(); // vtable+54
virtual void VTable0x58(); // vtable+58
virtual MxBool VTable0x5c(); // vtable+5c
virtual void VTable0x60(); // vtable+60
virtual MxBool VTable0x64(); // vtable+64
virtual void VTable0x68(MxBool p_add); // vtable+68
MxResult SetAsCurrentWorld(MxDSObject& p_object);
MxResult SetAsCurrentWorld(MxDSObject &p_dsObject);
protected:
undefined unk68[0x30];
LegoCameraController *camera;
undefined unk9c[0x5a];
undefined unkf6;
undefined unkf7;
undefined m_unk68[0x30];
LegoCameraController *m_camera;
undefined m_unk9c[0x5a];
undefined m_unkf6;
undefined m_unkf7;
};
void FUN_10015820(MxU32 p_1, MxU32 p_2);
void FUN_10015910(MxU32 p_1);
void SetIsWorldActive(MxBool p_active);
void FUN_10015820(MxU32 p_unk1, MxU32 p_unk2);
void FUN_10015910(MxU32 p_unk1);
void SetIsWorldActive(MxBool p_isWorldActive);
#endif // LEGOWORLD_H

View File

@ -0,0 +1,3 @@
#include "mxappnotificationparam.h"
DECOMP_SIZE_ASSERT(MxAppNotificationParam, 0x1c)

View File

@ -1,14 +1,18 @@
#ifndef MXAPPNOTIFICATIONPARAM_H
#define MXAPPNOTIFICATIONPARAM_H
#include "mxnotificationparam.h"
#include "decomp.h"
// VTABLE 0x100d6aa0
class MxAppNotificationParam : public MxNotificationParam
{
public:
inline MxAppNotificationParam() : MxNotificationParam((MxParamType)0, NULL) {}
inline MxAppNotificationParam() : MxNotificationParam((MxParamType) 0, NULL) {}
virtual ~MxAppNotificationParam() override {} // vtable+0x0 (scalar deleting destructor)
inline MxU8 getM18() { return m_unk18; }
inline MxU8 GetUnknown18() { return m_unk18; }
protected:
undefined m_unkc[0xc];

View File

@ -26,7 +26,7 @@ MxDSAction::MxDSAction()
this->m_location.Fill(FLT_MAX);
this->m_direction.Fill(FLT_MAX);
this->m_up.Fill(FLT_MAX);
this->m_unk84 = 0;
this->m_unk84 = NULL;
this->m_unk88 = 0;
this->m_omni = NULL;
this->m_unkTimingField = INT_MIN;

View File

@ -62,7 +62,7 @@ class MxDSAction : public MxDSObject
inline MxS32 GetLoopCount() { return m_loopCount; }
inline void SetLoopCount(MxS32 p_loopCount) { m_loopCount = p_loopCount; }
inline const MxVector3Data &GetLocation() const { return m_location; }
inline void SetM84(MxCore *p_1) { m_unk84 = p_1; }
inline void SetUnknown84(MxCore *p_unk84) { m_unk84 = p_unk84; }
inline void SetOmni(MxOmni *p_omni) { m_omni = p_omni; }
inline MxBool IsLooping() const { return m_flags & Flag_Looping; }

View File

@ -28,6 +28,7 @@ class MxEntity : public MxCore
}
virtual MxResult SetEntityId(MxS32 p_id, const MxAtomId &p_atom); // vtable+0x14
protected:
MxS32 m_mxEntityId; // 0x8
MxAtomId m_atom; // 0xc

View File

@ -10,20 +10,20 @@ class MxCore;
enum MxParamType
{
PARAM_NONE = 0,
PAINT = 1, //100dc210:100d8350
MXSTREAMER_UNKNOWN = 2, //100d8358:100d8350
TYPE4 = 4, //100dc208:100d8350
PAINT = 1, // 100dc210:100d8350
MXSTREAMER_UNKNOWN = 2, // 100d8358:100d8350
TYPE4 = 4, // 100dc208:100d8350
MXPRESENTER_NOTIFICATION = 5,
MXSTREAMER_DELETE_NOTIFY = 6, //100dc760
APP_MESSAGE = 7, //100d6aa0
MOUSE_RELEASE = 8, //100d6aa0
MOUSE_PRESS = 9, //100d6aa0
MOUSE_MOVE = 10, //100d6aa0
TYPE11 = 11, //100d6aa0
PARAM_TIMER = 15, //100d6aa0
MXSTREAMER_DELETE_NOTIFY = 6, // 100dc760
APP_MESSAGE = 7, // 100d6aa0
MOUSE_RELEASE = 8, // 100d6aa0
MOUSE_PRESS = 9, // 100d6aa0
MOUSE_MOVE = 10, // 100d6aa0
TYPE11 = 11, // 100d6aa0
PARAM_TIMER = 15, // 100d6aa0
TYPE17 = 17,
TYPE18 = 18, //100d7e80
TYPE19 = 19, //100d6230
TYPE18 = 18, // 100d7e80
TYPE19 = 19, // 100d6230
TYPE20 = 20,
TYPE21 = 21,
TYPE22 = 22,

View File

@ -414,12 +414,12 @@ MxResult DeleteObject(MxDSAction &p_dsAction)
void DeleteObjects(MxAtomId *p_id, MxS32 p_first, MxS32 p_last)
{
MxDSAction action;
action.SetAtomId(*p_id);
action.SetUnknown24(-2);
MxS32 l_first = p_first;
MxS32 l_last = p_last;
while(l_first <= l_last) {
action.SetObjectId(l_first++);
for (MxS32 l_first = p_first, l_last = p_last; l_first <= l_last; l_first++) {
action.SetObjectId(l_first);
DeleteObject(action);
}
}

View File

@ -100,6 +100,7 @@ MxResult DeleteObject(MxDSAction &p_dsAction);
MxVideoManager *MVideoManager();
MxAtomIdCounterSet *AtomIdCounterSet();
MxObjectFactory *ObjectFactory();
void DeleteObject(MxDSAction &ds);
MxResult DeleteObject(MxDSAction &p_dsAction);
void DeleteObjects(MxAtomId *p_id, MxS32 p_first, MxS32 p_last);
#endif // MXOMNI_H

View File

@ -0,0 +1,3 @@
#include "mxtype17notificationparam.h"
DECOMP_SIZE_ASSERT(MxType17NotificationParam, 0x2c)

View File

@ -1,12 +1,17 @@
#ifndef MXTYPE17NOTIFICATIONPARAM_H
#define MXTYPE17NOTIFICATIONPARAM_H
#include "mxnotificationparam.h"
#include "decomp.h"
// ??? This type is handled, but seemingly never created and no VTABLE fits
class MxType17NotificationParam : public MxNotificationParam
{
public:
inline MxU32 GetM20() { return m_unk20; }
inline MxU16 GetM28() { return m_unk28; }
inline MxU32 GetUnknown20() { return m_unk20; }
inline MxU16 GetUnknown28() { return m_unk28; }
protected:
undefined m_unkc[0x14];
MxU32 m_unk20;

View File

@ -1,10 +1,13 @@
#include "pizzamissionstate.h"
DECOMP_SIZE_ASSERT(PizzaMissionStateEntry, 0x20)
DECOMP_SIZE_ASSERT(PizzaMissionState, 0xb0)
// OFFSET: LEGO1 0x10039510
PizzaMissionStateEntry *PizzaMissionState::GetState(MxU8 id)
{
for (MxU16 i = 0; i < 5; i++) {
if (m_state[i].m_id == id) return m_state + i;
}
for (MxS16 i = 0; i < 5; i++)
if (m_state[i].m_id == id)
return m_state + i;
return NULL;
}

View File

@ -29,9 +29,12 @@ class PizzaMissionState : public LegoState
{
return !strcmp(name, PizzaMissionState::ClassName()) || LegoState::IsA(name);
}
inline MxU16 GetColor(MxU8 id) { return GetState(id)->m_color; }
private:
PizzaMissionStateEntry *GetState(MxU8 id);
protected:
undefined4 m_unk8;
undefined4 m_unkc;

View File

@ -1,5 +1,10 @@
#include "racestate.h"
DECOMP_SIZE_ASSERT(RaceStateEntry, 0x06)
// TODO: Must be 0x2c but current structure is incorrect
// DECOMP_SIZE_ASSERT(RaceState, 0x2c)
// OFFSET: LEGO1 0x10015f30 STUB
RaceState::RaceState()
{
@ -9,8 +14,10 @@ RaceState::RaceState()
// OFFSET: LEGO1 0x10016280
RaceStateEntry *RaceState::GetState(MxU8 id)
{
for (MxU16 i = 0; i < 5; i++) {
if (m_state[i].m_id == id) return m_state + i;
for (MxS16 i = 0;; i++) {
if (i >= 5)
return NULL;
if (m_state[i].m_id == id)
return m_state + i;
}
return NULL;
}

View File

@ -31,9 +31,12 @@ class RaceState : public LegoState
{
return !strcmp(name, RaceState::ClassName()) || LegoState::IsA(name);
}
inline MxU16 GetColor(MxU8 id) { return GetState(id)->m_color; }
private:
RaceStateEntry *GetState(MxU8 id);
protected:
RaceStateEntry m_state[5];
undefined2 m_unk26[2];

View File

@ -12,17 +12,22 @@
#include "racestate.h"
#include "towtrackmissionstate.h"
DECOMP_SIZE_ASSERT(Score, 0x104)
MxAtomId *g_infoscorScript;
// OFFSET: LEGO1 0x10001000
Score::Score()
{
m_unkF8 = 0;
m_unkf8 = 0;
NotificationManager()->Register(this);
}
// OFFSET: LEGO1 0x10001200
Score::~Score()
{
if (InputManager()->GetWorld() == this) InputManager()->ClearWorld();
if (InputManager()->GetWorld() == this)
InputManager()->ClearWorld();
InputManager()->UnRegister(this);
ControlManager()->Unregister(this);
NotificationManager()->Unregister(this);
@ -33,7 +38,7 @@ MxLong Score::Notify(MxParam &p)
{
MxLong ret = 0;
LegoWorld::Notify(p);
if (unkf6) {
if (m_unkf6) {
switch (((MxNotificationParam &)p).GetType())
{
case PAINT:
@ -44,7 +49,8 @@ MxLong Score::Notify(MxParam &p)
ret = FUN_10001510((MxEndActionNotificationParam &)p);
break;
case APP_MESSAGE:
if (((MxAppNotificationParam &)p).getM18() == 0x20) DeleteScript(); // Shutting down
if (((MxAppNotificationParam &)p).GetUnknown18() == 0x20)
DeleteScript(); // Shutting down
ret = 1;
break;
case TYPE17:
@ -52,7 +58,8 @@ MxLong Score::Notify(MxParam &p)
break;
case MXTRANSITIONMANAGER_TRANSITIONENDED:
DeleteObjects(g_infoscorScript, 7, 9);
if (m_unkF8) GameState()->HandleAction(m_unkF8);
if (m_unkf8)
GameState()->HandleAction(m_unkf8);
ret = 1;
break;
default:
@ -63,14 +70,16 @@ MxLong Score::Notify(MxParam &p)
}
// OFFSET: LEGO1 0x100010b0
MxBool Score::VTable0x5c() {
MxBool Score::VTable0x5c()
{
return TRUE;
}
// OFFSET: LEGO1 0x100012a0
MxResult Score::InitFromMxDSObject(MxDSObject& p_object) override
MxResult Score::InitFromMxDSObject(MxDSObject &p_dsObject)
{
MxResult result = SetAsCurrentWorld(p_object);
MxResult result = SetAsCurrentWorld(p_dsObject);
if (result == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
@ -79,9 +88,10 @@ MxResult Score::InitFromMxDSObject(MxDSObject& p_object) override
LegoGameState *gs = GameState();
ScoreState *state = (ScoreState *)gs->GetState("ScoreState");
m_state = state ? state : (ScoreState *)gs->CreateState("ScoreState");
GameState()->Set424(0xd);
GameState()->SetUnknown424(0xd);
GameState()->FUN_1003a720(0);
}
return result;
}
@ -102,11 +112,12 @@ void Score::DeleteScript()
MxLong Score::FUN_10001510(MxEndActionNotificationParam &p)
{
MxDSAction *action = p.GetAction();
if (m_atom == action->GetAtomId()) {
MxU32 id = action->GetObjectId();
switch(action->GetObjectId()) {
switch (action->GetObjectId()) {
case 10:
m_unkF8 = 0x38;
m_unkf8 = 0x38;
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
break;
case 0x1f5:
@ -114,6 +125,7 @@ MxLong Score::FUN_10001510(MxEndActionNotificationParam &p)
m_state->SetTutorialFlag(FALSE);
}
}
return 1;
}
@ -121,53 +133,59 @@ MxLong Score::FUN_10001510(MxEndActionNotificationParam &p)
void Score::Stop()
{
LegoWorld::Stop();
MxDSAction action;
action.SetObjectId(0x1f4);
action.SetAtomId(m_atom);
action.SetM84(this);
action.SetUnknown84(this);
Start(&action);
if (m_state->GetTutorialFlag()) {
MxDSAction action2;
action.SetObjectId(0x1f5);
action.SetAtomId(*g_infoscorScript);
Start(&action);
}
else FUN_10015910(0xb);
else
FUN_10015910(0xb);
FUN_10015820(0, 7);
}
// OFFSET: LEGO1 0x100016d0
MxLong Score::FUN_100016d0(MxType17NotificationParam &p)
{
MxS16 l = p.GetM28();
if (l == 1 || p.GetM20() == 4) {
switch (p.GetM20())
MxS16 l = p.GetUnknown28();
if (l == 1 || p.GetUnknown20() == 4) {
switch (p.GetUnknown20())
{
case 1:
m_unkF8 = 2;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
m_unkf8 = 2;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
break;
case 2:
m_unkF8 = 3;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
m_unkf8 = 3;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
break;
case 3:
{
LegoInputManager *im = InputManager();
im->SetM88(TRUE);
im->SetM336(FALSE);
im->SetUnknown88(TRUE);
im->SetUnknown336(FALSE);
DeleteScript();
MxDSAction action;
action.SetObjectId(10);
action.SetAtomId(*g_infoscorScript);
Start(&action);
break;;
break;
}
case 4:
{
switch(l) {
switch (l) {
case 1:
{
MxDSAction action;
@ -197,6 +215,7 @@ MxLong Score::FUN_100016d0(MxType17NotificationParam &p)
}
}
}
return 1;
}
@ -204,11 +223,13 @@ MxLong Score::FUN_100016d0(MxType17NotificationParam &p)
void Score::VTable0x68(MxBool p_add)
{
LegoWorld::VTable0x68(p_add);
if (p_add) {
InputManager()->SetWorld(this);
SetIsWorldActive(FALSE);
}
else if (InputManager()->GetWorld() == this) InputManager()->ClearWorld();
else if (InputManager()->GetWorld() == this)
InputManager()->ClearWorld();
}
// OFFSET: LEGO1 0x100019d0
@ -216,12 +237,14 @@ void Score::Paint()
{
GifManager *gm = GetGifManager();
GifData *gd = gm->Get("bigcube.gif");
if (gd) {
RaceState *l78 = (RaceState *)GameState()->GetState("JetskiRaceState");
RaceState *l70 = (RaceState *)GameState()->GetState("CarRaceState");
TowTrackMissionState *lesi = (TowTrackMissionState *)GameState()->GetState("TowTrackMissionState");
PizzaMissionState *l74 = (PizzaMissionState *)GameState()->GetState("PizzaMissionState");
AmbulanceMissionState *lebp = (AmbulanceMissionState *)GameState()->GetState("AmbulanceMissionState");
DDSURFACEDESC desc;
memset(&desc, 0, 0x6c);
desc.dwSize = 0x6c;
@ -230,25 +253,32 @@ void Score::Paint()
gd->m_surface->Unlock(desc.lpSurface);
return;
}
for (MxU8 id = 1; id <= 5; id++) {
m_surface = (MxU8 *)desc.lpSurface;
MxU16 color = 0;
if (l70) color = l70->GetColor(id);
if (l70)
color = l70->GetColor(id);
MxU32 row = id - 1;
FillArea(0, row, color);
color = 0;
if (l78) color = l78->GetColor(id);
if (l78)
color = l78->GetColor(id);
FillArea(1, row, color);
color = 0;
if (l74) color = l74->GetColor(id);
if (l74)
color = l74->GetColor(id);
FillArea(2, row, color);
color = 0;
if (lesi) color = lesi->GetColor(id);
if (lesi)
color = lesi->GetColor(id);
FillArea(3, row, color);
color = 0;
if (lebp) color = lebp->GetColor(id);
if (lebp)
color = lebp->GetColor(id);
FillArea(4, row, color);
}
gd->m_surface->Unlock(desc.lpSurface);
gd->m_texture->Changed(TRUE, FALSE);
m_surface = NULL;
@ -298,8 +328,6 @@ void Score::FillArea(MxU32 p_x, MxU32 p_y, MxS16 p_color)
MxBool Score::VTable0x64()
{
DeleteScript();
m_unkF8 = 2;
m_unkf8 = 2;
return TRUE;
}
MxAtomId *g_infoscorScript;
}

View File

@ -7,8 +7,6 @@
#include "mxappnotificationparam.h"
#include "mxtype17notificationparam.h"
extern MxAtomId *g_infoscorScript;
// VTABLE 0x100d4018
// SIZE 0x104
class Score : public LegoWorld
@ -31,21 +29,22 @@ class Score : public LegoWorld
return !strcmp(name, Score::ClassName()) || LegoWorld::IsA(name);
}
MxResult InitFromMxDSObject(MxDSObject& p_object); // vtable+0x18
virtual void Stop() override; // vtable+0x50
virtual MxBool VTable0x5c() override; // vtable+0x5c
virtual MxResult InitFromMxDSObject(MxDSObject &p_dsObject) override; // vtable+18
virtual void Stop() override; // vtable+50
virtual MxBool VTable0x5c() override; // vtable+5c
virtual MxBool VTable0x64() override; // vtable+64
virtual void VTable0x68(MxBool p_add) override; // vtable+68
void Paint();
MxLong FUN_10001510(MxEndActionNotificationParam &p);
MxLong FUN_100016d0(MxType17NotificationParam &p);
void FillArea(MxU32 p_1, MxU32 p_2, MxS16 p_3);
void FillArea(MxU32 p_x, MxU32 p_y, MxS16 p_color);
protected:
undefined4 m_unkF8;
undefined4 m_unkf8;
ScoreState *m_state;
MxU8 *m_surface;
private:
void DeleteScript();
};

View File

@ -23,10 +23,12 @@ class ScoreState : public LegoState
virtual MxBool VTable0x14() override; // vtable+0x14
virtual MxBool SetFlag() override; // vtable+0x18
inline GetTutorialFlag() { return m_playCubeTutorial; }
inline void SetTutorialFlag(MxBool p_1) { m_playCubeTutorial = p_1; }
inline MxBool GetTutorialFlag() { return m_playCubeTutorial; }
inline void SetTutorialFlag(MxBool p_playCubeTutorial) { m_playCubeTutorial = p_playCubeTutorial; }
private:
MxBool m_playCubeTutorial;
MxBool m_playCubeTutorial;
};
#endif // SCORESTATE_H

View File

@ -1,5 +1,7 @@
#include "towtrackmissionstate.h"
DECOMP_SIZE_ASSERT(TowTrackMissionState, 0x28)
// OFFSET: LEGO1 0x1004dd30 STUB
TowTrackMissionState::TowTrackMissionState()
{

View File

@ -22,6 +22,7 @@ class TowTrackMissionState : public LegoState
{
return !strcmp(name, TowTrackMissionState::ClassName()) || LegoState::IsA(name);
}
inline MxU16 GetColor(MxU8 id)
{
switch (id)
@ -34,6 +35,7 @@ class TowTrackMissionState : public LegoState
default: return 0;
}
}
protected:
undefined m_unk8[0x14];
MxU16 m_color1;