begin implementation of InfoCenter class (#444)

* Push changes

* fixes

* Implement Infocenter::HandleEndAction

* match Infocenter::StopCutScene

* implement Infocenter::HandleKeyPress

* fixes

* Update infocenter.cpp

* Update legoworld.cpp

* use enums

* WIP Fixes

* Fix

* Fix

* Fix

* Rename function

* Change enum

* Update enums

* Refactor another enum

* Refactor MxDSType

* Refactor HashTableOpt

* Fixes

* Refactor tickle enum

* Update other enums

* Add EnumConstantName to ncc

* Move enum to global namespace

* Rename enum

---------

Co-authored-by: Christian Semmler <mail@csemmler.com>
This commit is contained in:
Misha
2024-01-17 11:53:53 -05:00
committed by GitHub
parent aaa18bc9e2
commit f50b771fff
100 changed files with 1160 additions and 555 deletions

View File

@@ -104,7 +104,7 @@ public:
class MxType4NotificationParam : public MxActionNotificationParam {
public:
inline MxType4NotificationParam(MxCore* p_sender, MxDSAction* p_action, MxPresenter* p_unk0x14)
: MxActionNotificationParam(TYPE4, p_sender, p_action, FALSE)
: MxActionNotificationParam(c_notificationType4, p_sender, p_action, FALSE)
{
m_unk0x14 = p_unk0x14;
}

View File

@@ -5,10 +5,10 @@
#include "mxtypes.h"
enum LookupMode {
LookupMode_Exact = 0,
LookupMode_LowerCase = 1,
LookupMode_UpperCase = 2,
LookupMode_LowerCase2 = 3
e_exact = 0,
e_lowerCase,
e_upperCase,
e_lowerCase2,
};
// SIZE 0x04

View File

@@ -85,7 +85,7 @@ public:
virtual void ReleaseDC(HDC p_hdc); // vtable+0x40
virtual LPDIRECTDRAWSURFACE VTable0x44(MxBitmap*, undefined4*, undefined4, undefined4); // vtable+0x44
void FUN_100ba640();
void ClearScreen();
static LPDIRECTDRAWSURFACE FUN_100bc070();
inline LPDIRECTDRAWSURFACE GetDirectDrawSurface1() { return this->m_ddSurface1; }

View File

@@ -12,16 +12,16 @@ class MxOmni;
class MxDSAction : public MxDSObject {
public:
enum {
Flag_Looping = 0x01,
Flag_Bit3 = 0x04,
Flag_Bit4 = 0x08,
Flag_Bit5 = 0x10,
Flag_Enabled = 0x20,
Flag_Bit7 = 0x40,
Flag_World = 0x80,
Flag_Bit9 = 0x100,
Flag_Bit10 = 0x200,
Flag_Bit11 = 0x400,
c_looping = 0x01,
c_bit3 = 0x04,
c_bit4 = 0x08,
c_bit5 = 0x10,
c_enabled = 0x20,
c_bit7 = 0x40,
c_world = 0x80,
c_bit9 = 0x100,
c_bit10 = 0x200,
c_bit11 = 0x400,
};
__declspec(dllexport) MxDSAction();
@@ -72,15 +72,15 @@ public:
inline MxCore* GetOrigin() { return m_origin; }
inline void SetOrigin(MxCore* p_origin) { m_origin = p_origin; }
inline MxBool IsLooping() const { return m_flags & Flag_Looping; }
inline MxBool IsBit3() const { return m_flags & Flag_Bit3; }
inline MxBool IsLooping() const { return m_flags & c_looping; }
inline MxBool IsBit3() const { return m_flags & c_bit3; }
inline void CopyFlags(MxU32 p_flags)
{
if (p_flags & MxDSAction::Flag_Looping)
SetFlags(GetFlags() | MxDSAction::Flag_Looping);
else if (p_flags & MxDSAction::Flag_Bit3)
SetFlags(GetFlags() | MxDSAction::Flag_Bit3);
if (p_flags & MxDSAction::c_looping)
SetFlags(GetFlags() | MxDSAction::c_looping);
else if (p_flags & MxDSAction::c_bit3)
SetFlags(GetFlags() | MxDSAction::c_bit3);
}
protected:

View File

@@ -10,17 +10,17 @@ class MxDSStreamingAction;
class MxStreamChunk;
class MxDSChunk;
enum MxDSBufferType {
MxDSBufferType_Chunk = 0,
MxDSBufferType_Allocate = 1,
MxDSBufferType_Preallocated = 2,
MxDSBufferType_Unknown = 3,
};
// VTABLE: LEGO1 0x100dcca0
// SIZE 0x34
class MxDSBuffer : public MxCore {
public:
enum Type {
e_chunk = 0,
e_allocate = 1,
e_preallocated = 2,
e_unknown = 3,
};
MxDSBuffer();
virtual ~MxDSBuffer() override;
@@ -31,7 +31,7 @@ public:
return "MxDSBuffer";
}
MxResult AllocateBuffer(MxU32 p_bufferSize, MxDSBufferType p_mode);
MxResult AllocateBuffer(MxU32 p_bufferSize, Type p_mode);
MxResult SetBufferPointer(MxU8* p_buffer, MxU32 p_size);
MxResult FUN_100c67b0(
MxStreamController* p_controller,
@@ -67,12 +67,12 @@ public:
inline MxU8** GetBufferRef() { return &m_pBuffer; }
inline undefined4 GetUnknown14() { return m_unk0x14; }
inline MxU16 GetRefCount() { return m_refcount; }
inline MxDSBufferType GetMode() { return m_mode; }
inline Type GetMode() { return m_mode; }
inline MxU32 GetWriteOffset() { return m_writeOffset; }
inline MxU32 GetBytesRemaining() { return m_bytesRemaining; }
inline void SetUnknown14(undefined4 p_unk0x14) { m_unk0x14 = p_unk0x14; }
inline void SetUnknown1c(undefined4 p_unk0x1c) { m_unk0x1c = p_unk0x1c; }
inline void SetMode(MxDSBufferType p_mode) { m_mode = p_mode; }
inline void SetMode(Type p_mode) { m_mode = p_mode; }
inline void SetUnk30(MxDSStreamingAction* p_unk0x30) { m_unk0x30 = p_unk0x30; }
private:
@@ -83,7 +83,7 @@ private:
undefined4 m_unk0x18; // 0x18
undefined4 m_unk0x1c; // 0x1c
MxU16 m_refcount; // 0x20
MxDSBufferType m_mode; // 0x24
Type m_mode; // 0x24
MxU32 m_writeOffset; // 0x28
MxU32 m_bytesRemaining; // 0x2c
MxDSStreamingAction* m_unk0x30; // 0x30

View File

@@ -10,11 +10,11 @@
class MxDSChunk : public MxCore {
public:
enum {
Flag_Bit1 = 0x01,
Flag_End = 0x02,
Flag_Bit3 = 0x04,
Flag_Split = 0x10,
Flag_Bit16 = 0x8000
c_bit1 = 0x01,
c_end = 0x02,
c_bit3 = 0x04,
c_split = 0x10,
c_bit16 = 0x8000
};
MxDSChunk();

View File

@@ -4,7 +4,6 @@
#include "decomp.h"
#include "mxatomid.h"
#include "mxcore.h"
#include "mxdstypes.h"
class MxPresenter;
@@ -12,6 +11,21 @@ class MxPresenter;
// SIZE 0x2c
class MxDSObject : public MxCore {
public:
enum Type {
e_object = 0,
e_action,
e_mediaAction,
e_anim,
e_sound,
e_multiAction,
e_serialAction,
e_parallelAction,
e_event,
e_selectAction,
e_still,
e_objectAction,
};
MxDSObject();
virtual ~MxDSObject() override;
@@ -35,14 +49,14 @@ public:
virtual void Deserialize(MxU8** p_source, MxS16 p_unk0x24); // vtable+1c;
inline virtual void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; } // vtable+20;
inline MxDSType GetType() const { return (MxDSType) this->m_type; }
inline Type GetType() const { return (Type) this->m_type; }
inline const char* GetSourceName() const { return this->m_sourceName; }
inline MxU32 GetObjectId() { return this->m_objectId; }
inline const MxAtomId& GetAtomId() { return this->m_atomId; }
inline MxS16 GetUnknown24() { return this->m_unk0x24; }
inline MxPresenter* GetUnknown28() { return this->m_unk0x28; }
inline void SetType(MxDSType p_type) { this->m_type = p_type; }
inline void SetType(Type p_type) { this->m_type = p_type; }
inline void SetObjectId(MxU32 p_objectId) { this->m_objectId = p_objectId; }
inline void SetUnknown24(MxS16 p_unk0x24) { this->m_unk0x24 = p_unk0x24; }
inline void SetUnknown28(MxPresenter* p_unk0x28) { this->m_unk0x28 = p_unk0x28; }

View File

@@ -1,19 +0,0 @@
#ifndef MXDSTYPES_H
#define MXDSTYPES_H
enum MxDSType {
MxDSType_Object = 0,
MxDSType_Action = 1,
MxDSType_MediaAction = 2,
MxDSType_Anim = 3,
MxDSType_Sound = 4,
MxDSType_MultiAction = 5,
MxDSType_SerialAction = 6,
MxDSType_ParallelAction = 7,
MxDSType_Event = 8,
MxDSType_SelectAction = 9,
MxDSType_Still = 10,
MxDSType_ObjectAction = 11,
};
#endif // MXDSTYPES_H

View File

@@ -32,10 +32,10 @@ public:
template <class T>
class MxHashTable : protected MxCollection<T> {
public:
enum HashTableOpt {
HashTableOpt_NoExpand = 0,
HashTableOpt_ExpandAdd = 1,
HashTableOpt_ExpandMultiply = 2,
enum Option {
e_noExpand = 0,
e_expandAll,
e_expandMultiply,
};
MxHashTable()
@@ -43,7 +43,7 @@ public:
m_numSlots = HASH_TABLE_INIT_SIZE;
m_slots = new MxHashTableNode<T>*[HASH_TABLE_INIT_SIZE];
memset(m_slots, 0, sizeof(MxHashTableNode<T>*) * m_numSlots);
m_resizeOption = HashTableOpt_NoExpand;
m_resizeOption = e_noExpand;
}
virtual ~MxHashTable() override;
@@ -62,7 +62,7 @@ protected:
MxHashTableNode<T>** m_slots; // 0x10
MxU32 m_numSlots; // 0x14
MxU32 m_autoResizeRatio; // 0x18
HashTableOpt m_resizeOption; // 0x1c
Option m_resizeOption; // 0x1c
// FIXME: or FIXME? This qword is used as an integer or double depending
// on the value of m_resizeOption. Hard to say whether this is how the devs
// did it, but a simple cast in either direction doesn't match.
@@ -177,10 +177,10 @@ inline void MxHashTable<T>::Resize()
MxHashTableNode<T>** oldTable = m_slots;
switch (m_resizeOption) {
case HashTableOpt_ExpandAdd:
case e_expandAll:
m_numSlots += m_increaseAmount;
break;
case HashTableOpt_ExpandMultiply:
case e_expandMultiply:
m_numSlots *= m_increaseFactor;
break;
}

View File

@@ -8,29 +8,29 @@
class MxCore;
enum NotificationId {
PARAM_NONE = 0,
c_notificationType0 = 0,
c_notificationStartAction = 1, // 100dc210:100d8350
c_notificationEndAction = 2, // 100d8358:100d8350
TYPE4 = 4, // 100dc208:100d8350
MXPRESENTER_NOTIFICATION = 5,
MXSTREAMER_DELETE_NOTIFY = 6, // 100dc760
c_notificationType4 = 4, // 100dc208:100d8350
c_notificationPresenter = 5,
c_notificationStreamer = 6, // 100dc760
c_notificationKeyPress = 7, // 100d6aa0
c_notificationButtonUp = 8, // 100d6aa0
c_notificationButtonDown = 9, // 100d6aa0
c_notificationMouseMove = 10, // 100d6aa0
TYPE11 = 11, // 100d6aa0
c_notificationType11 = 11, // 100d6aa0
c_notificationDragEnd = 12,
c_notificationDragStart = 13,
c_notificationDrag = 14,
c_notificationTimer = 15, // 100d6aa0
TYPE17 = 17,
TYPE18 = 18, // 100d7e80
TYPE19 = 19, // 100d6230
TYPE20 = 20,
c_notificationType17 = 17,
c_notificationType18 = 18, // 100d7e80
c_notificationType19 = 19, // 100d6230
c_notificationType20 = 20,
c_notificationNewPresenter = 21,
TYPE22 = 22,
TYPE23 = 23,
MXTRANSITIONMANAGER_TRANSITIONENDED = 24
c_notificationType22 = 22,
c_notificationType23 = 23,
c_notificationTransitioned = 24
};
// VTABLE: LEGO1 0x100d56e0

View File

@@ -6,84 +6,76 @@
class MxOmniCreateFlags {
public:
enum LowFlags {
Flag_CreateObjectFactory = 0x01,
Flag_CreateVariableTable = 0x02,
Flag_CreateTickleManager = 0x04,
Flag_CreateNotificationManager = 0x08,
Flag_CreateVideoManager = 0x10,
Flag_CreateSoundManager = 0x20,
Flag_CreateMusicManager = 0x40,
Flag_CreateEventManager = 0x80
c_createObjectFactory = 0x01,
c_createVariableTable = 0x02,
c_createTickleManager = 0x04,
c_createNotificationManager = 0x08,
c_createVideoManager = 0x10,
c_createSoundManager = 0x20,
c_createMusicManager = 0x40,
c_createEventManager = 0x80
};
enum HighFlags {
Flag_CreateTimer = 0x02,
Flag_CreateStreamer = 0x04
c_createTimer = 0x02,
c_createStreamer = 0x04
};
__declspec(dllexport) MxOmniCreateFlags();
inline const MxBool CreateObjectFactory() const { return this->m_flags1 & Flag_CreateObjectFactory; }
inline const MxBool CreateVariableTable() const { return this->m_flags1 & Flag_CreateVariableTable; }
inline const MxBool CreateTickleManager() const { return this->m_flags1 & Flag_CreateTickleManager; }
inline const MxBool CreateNotificationManager() const { return this->m_flags1 & Flag_CreateNotificationManager; }
inline const MxBool CreateVideoManager() const { return this->m_flags1 & Flag_CreateVideoManager; }
inline const MxBool CreateSoundManager() const { return this->m_flags1 & Flag_CreateSoundManager; }
inline const MxBool CreateMusicManager() const { return this->m_flags1 & Flag_CreateMusicManager; }
inline const MxBool CreateEventManager() const { return this->m_flags1 & Flag_CreateEventManager; }
inline const MxBool CreateObjectFactory() const { return this->m_flags1 & c_createObjectFactory; }
inline const MxBool CreateVariableTable() const { return this->m_flags1 & c_createVariableTable; }
inline const MxBool CreateTickleManager() const { return this->m_flags1 & c_createTickleManager; }
inline const MxBool CreateNotificationManager() const { return this->m_flags1 & c_createNotificationManager; }
inline const MxBool CreateVideoManager() const { return this->m_flags1 & c_createVideoManager; }
inline const MxBool CreateSoundManager() const { return this->m_flags1 & c_createSoundManager; }
inline const MxBool CreateMusicManager() const { return this->m_flags1 & c_createMusicManager; }
inline const MxBool CreateEventManager() const { return this->m_flags1 & c_createEventManager; }
inline const MxBool CreateTimer() const { return this->m_flags2 & Flag_CreateTimer; }
inline const MxBool CreateStreamer() const { return this->m_flags2 & Flag_CreateStreamer; }
inline const MxBool CreateTimer() const { return this->m_flags2 & c_createTimer; }
inline const MxBool CreateStreamer() const { return this->m_flags2 & c_createStreamer; }
inline void CreateObjectFactory(MxBool p_enable)
{
this->m_flags1 =
(p_enable ? this->m_flags1 | Flag_CreateObjectFactory : this->m_flags1 & ~Flag_CreateObjectFactory);
this->m_flags1 = (p_enable ? this->m_flags1 | c_createObjectFactory : this->m_flags1 & ~c_createObjectFactory);
}
inline void CreateVariableTable(MxBool p_enable)
{
this->m_flags1 =
(p_enable ? this->m_flags1 | Flag_CreateVariableTable : this->m_flags1 & ~Flag_CreateVariableTable);
this->m_flags1 = (p_enable ? this->m_flags1 | c_createVariableTable : this->m_flags1 & ~c_createVariableTable);
}
inline void CreateTickleManager(MxBool p_enable)
{
this->m_flags1 =
(p_enable ? this->m_flags1 | Flag_CreateTickleManager : this->m_flags1 & ~Flag_CreateTickleManager);
this->m_flags1 = (p_enable ? this->m_flags1 | c_createTickleManager : this->m_flags1 & ~c_createTickleManager);
}
inline void CreateNotificationManager(MxBool p_enable)
{
this->m_flags1 =
(p_enable ? this->m_flags1 | Flag_CreateNotificationManager
: this->m_flags1 & ~Flag_CreateNotificationManager);
(p_enable ? this->m_flags1 | c_createNotificationManager : this->m_flags1 & ~c_createNotificationManager);
}
inline void CreateVideoManager(MxBool p_enable)
{
this->m_flags1 =
(p_enable ? this->m_flags1 | Flag_CreateVideoManager : this->m_flags1 & ~Flag_CreateVideoManager);
this->m_flags1 = (p_enable ? this->m_flags1 | c_createVideoManager : this->m_flags1 & ~c_createVideoManager);
}
inline void CreateSoundManager(MxBool p_enable)
{
this->m_flags1 =
(p_enable ? this->m_flags1 | Flag_CreateSoundManager : this->m_flags1 & ~Flag_CreateSoundManager);
this->m_flags1 = (p_enable ? this->m_flags1 | c_createSoundManager : this->m_flags1 & ~c_createSoundManager);
}
inline void CreateMusicManager(MxBool p_enable)
{
this->m_flags1 =
(p_enable ? this->m_flags1 | Flag_CreateMusicManager : this->m_flags1 & ~Flag_CreateMusicManager);
this->m_flags1 = (p_enable ? this->m_flags1 | c_createMusicManager : this->m_flags1 & ~c_createMusicManager);
}
inline void CreateEventManager(MxBool p_enable)
{
this->m_flags1 =
(p_enable ? this->m_flags1 | Flag_CreateEventManager : this->m_flags1 & ~Flag_CreateEventManager);
this->m_flags1 = (p_enable ? this->m_flags1 | c_createEventManager : this->m_flags1 & ~c_createEventManager);
}
inline void CreateTimer(MxBool p_enable)
{
this->m_flags2 = (p_enable ? this->m_flags2 | Flag_CreateTimer : this->m_flags2 & ~Flag_CreateTimer);
this->m_flags2 = (p_enable ? this->m_flags2 | c_createTimer : this->m_flags2 & ~c_createTimer);
}
inline void CreateStreamer(MxBool p_enable)
{
this->m_flags2 = (p_enable ? this->m_flags2 | Flag_CreateStreamer : this->m_flags2 & ~Flag_CreateStreamer);
this->m_flags2 = (p_enable ? this->m_flags2 | c_createStreamer : this->m_flags2 & ~c_createStreamer);
}
private:

View File

@@ -17,13 +17,13 @@ class MxEntity;
class MxPresenter : public MxCore {
public:
enum TickleState {
TickleState_Idle = 0,
TickleState_Ready,
TickleState_Starting,
TickleState_Streaming,
TickleState_Repeating,
TickleState_unk5,
TickleState_Done,
e_idle = 0,
e_ready,
e_starting,
e_streaming,
e_repeating,
e_unk5,
e_done,
};
MxPresenter() { Init(); }
@@ -57,27 +57,27 @@ public:
virtual void ReadyTickle()
{
ParseExtra();
ProgressTickleState(TickleState_Starting);
ProgressTickleState(e_starting);
} // vtable+0x18
// FUNCTION: LEGO1 0x1000be60
virtual void StartingTickle() { ProgressTickleState(TickleState_Streaming); } // vtable+0x1c
virtual void StartingTickle() { ProgressTickleState(e_streaming); } // vtable+0x1c
// FUNCTION: LEGO1 0x1000be80
virtual void StreamingTickle() { ProgressTickleState(TickleState_Repeating); }; // vtable+0x20
virtual void StreamingTickle() { ProgressTickleState(e_repeating); }; // vtable+0x20
// FUNCTION: LEGO1 0x1000bea0
virtual void RepeatingTickle() { ProgressTickleState(TickleState_unk5); }; // vtable+0x24
virtual void RepeatingTickle() { ProgressTickleState(e_unk5); }; // vtable+0x24
// FUNCTION: LEGO1 0x1000bec0
virtual void Unk5Tickle() { ProgressTickleState(TickleState_Done); }; // vtable+0x28
virtual void Unk5Tickle() { ProgressTickleState(e_done); }; // vtable+0x28
protected:
#ifdef ISLE_APP
__declspec(dllexport) virtual void DoneTickle(); // vtable+0x2c
#else
// FUNCTION: LEGO1 0x1000bee0
__declspec(dllexport) virtual void DoneTickle() { ProgressTickleState(TickleState_Idle); }; // vtable+0x2c
__declspec(dllexport) virtual void DoneTickle() { ProgressTickleState(e_idle); }; // vtable+0x2c
#endif
__declspec(dllexport) virtual void ParseExtra(); // vtable+0x30

View File

@@ -71,7 +71,7 @@ private:
class MxStreamer : public MxCore {
public:
enum OpenMode {
e_DiskStream,
e_diskStream = 0,
e_RAMStream
};

View File

@@ -11,11 +11,11 @@
class MxVideoPresenter : public MxMediaPresenter {
public:
enum {
Flag_Bit1 = 0x01,
Flag_Bit2 = 0x02,
Flag_Bit3 = 0x04,
Flag_Bit4 = 0x08,
Flag_Bit5 = 0x10,
c_bit1 = 0x01,
c_bit2 = 0x02,
c_bit3 = 0x04,
c_bit4 = 0x08,
c_bit5 = 0x10,
};
MxVideoPresenter() { Init(); }