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

@@ -3,19 +3,21 @@
// Items related to the Extra string of key-value pairs found in MxOb
enum ExtraActionType {
ExtraActionType_none = 0,
ExtraActionType_opendisk = 1,
ExtraActionType_openram = 2,
ExtraActionType_close = 3,
ExtraActionType_start = 4,
ExtraActionType_stop = 5,
ExtraActionType_run = 6,
ExtraActionType_exit = 7,
ExtraActionType_enable = 8,
ExtraActionType_disable = 9,
ExtraActionType_notify = 10,
ExtraActionType_unknown = 11,
struct Extra {
enum ActionType {
e_none = 0,
e_opendisk,
e_openram,
e_close,
e_start,
e_stop,
e_run,
e_exit,
e_enable,
e_disable,
e_notify,
e_unknown,
};
};
#endif // EXTRA_H

View File

@@ -2,11 +2,52 @@
#define INFOCENTER_H
#include "legoworld.h"
#include "radio.h"
class InfocenterState;
// SIZE 0x18
struct InfocenterUnkDataEntry {
// FUNCTION: LEGO1 0x1006ec80
InfocenterUnkDataEntry() {}
undefined m_pad[0x18];
};
// VTABLE: LEGO1 0x100d9338
// SIZE 0x1d8
class Infocenter : public LegoWorld {
public:
enum IntroScript {
e_noIntro = -1,
e_legoMovie,
e_mindscapeMovie,
e_introMovie,
e_outroMovie,
e_badEndMovie,
e_goodEndMovie
};
enum InfomainScript {
c_noInfomain = -1,
c_welcomeDialogue = 500,
c_randomDialogue1 = 502,
c_letsGetStarted = 504,
c_returnBack = 514,
c_exitConfirmation = 522,
c_goodEndingDialogue = 539,
c_badEndingDialogue = 540,
c_pepperCharacterSelect = 541,
c_mamaCharacterSelect = 542,
c_papaCharacterSelect = 543,
c_officierCharacterSelect = 544,
c_loraCharacterSelect = 545,
};
enum SndAmimScript {
c_bookWig = 400
};
Infocenter();
virtual ~Infocenter() override;
@@ -31,6 +72,46 @@ public:
virtual MxBool VTable0x5c() override; // vtable+0x5c
virtual MxBool VTable0x64() override; // vtable+0x64
virtual void VTable0x68(MxBool p_add) override; // vtable+0x68
private:
void InitializeBitmaps();
MxLong HandleKeyPress(MxS8 p_key);
MxU8 HandleMouseMove(MxS32 p_x, MxS32 p_y);
MxU8 HandleButtonUp(MxS32 p_x, MxS32 p_y);
MxU8 HandleNotification17(MxParam&);
MxLong HandleEndAction(MxParam& p_param);
MxLong HandleNotification0(MxParam&);
void FUN_10070dc0(MxBool);
void FUN_10070e90();
void PlayCutscene(IntroScript p_entityId, MxBool p_scale);
void StopCutscene();
void StartCredits();
void StopCredits();
void PlayDialogue(InfomainScript p_objectId);
void StopCurrentDialogue();
void PlayBookAnimation();
void StopBookAnimation();
InfomainScript m_currentInfomainScript; // 0xf8
MxS16 m_unk0xfc; // 0xfc
InfocenterState* m_infocenterState; // 0x100
undefined4 m_unk0x104; // 0x104
IntroScript m_currentIntroScript; // 0x108
Radio m_radio; // 0x10c
undefined4 m_unk0x11c; // 0x11c
InfocenterUnkDataEntry m_entries[7]; // 0x120
MxS16 m_unk0x1c8; // 0x1c8
undefined4 m_unk0x1cc; // 0x1cc
MxU16 m_unk0x1d0; // 0x1d0
MxU16 m_unk0x1d2; // 0x1d2
MxU16 m_unk0x1d4; // 0x1d4
MxU16 m_unk0x1d6; // 0x1d6
};
#endif // INFOCENTER_H

View File

@@ -25,6 +25,9 @@ public:
}
inline MxU32 GetInfocenterBufferElement(MxS32 p_index) { return m_buffer[p_index]; }
inline MxU32 GetUnknown0x74() { return m_unk0x74; }
inline void SetUnknown0x74(MxU32 p_unk0x74) { m_unk0x74 = p_unk0x74; }
private:
// Members should be renamed with their offsets before use
@@ -55,7 +58,8 @@ private:
undefined4 unk13;
*/
undefined m_pad[0x70];
undefined m_pad[0x6c];
MxU32 m_unk0x74; // 0x74
MxU32 m_buffer[7]; // 0x78
};

View File

@@ -9,7 +9,7 @@
// SIZE 0x68
class LegoActionControlPresenter : public MxMediaPresenter {
public:
inline LegoActionControlPresenter() { m_unk0x50 = ExtraActionType_none; }
inline LegoActionControlPresenter() { m_unk0x50 = Extra::ActionType::e_none; }
virtual ~LegoActionControlPresenter() override { Destroy(TRUE); }; // vtable+0x00
// FUNCTION: LEGO1 0x1000d0e0
@@ -32,9 +32,9 @@ public:
virtual void Destroy(MxBool p_fromDestructor); // vtable+0x5c
private:
ExtraActionType m_unk0x50; // 0x50
MxString m_unk0x54; // 0x54
undefined4 m_unk0x64; // 0x64
Extra::ActionType m_unk0x50; // 0x50
MxString m_unk0x54; // 0x54
undefined4 m_unk0x64; // 0x64
};
// SYNTHETIC: LEGO1 0x1000d1d0

View File

@@ -28,6 +28,7 @@ public:
void FUN_10028df0(MxPresenterList* p_presenterList);
void Register(MxCore* p_listener);
void Unregister(MxCore* p_listener);
void FUN_100293c0(undefined4, const MxAtomId&, undefined2);
};
#endif // LEGOCONTROLMANAGER_H

View File

@@ -13,7 +13,7 @@
class LegoEntity : public MxEntity {
public:
enum {
Flag_Bit1 = 0x01
c_bit1 = 0x01
};
// Inlined at 0x100853f7
@@ -78,9 +78,9 @@ protected:
undefined m_unk0x59; // 0x59
// For tokens from the extra string that look like this:
// "Action:openram;\lego\scripts\Race\CarRaceR;0"
ExtraActionType m_actionType; // 0x5c
char* m_actionArgString; // 0x60
MxS32 m_actionArgNumber; // 0x64
Extra::ActionType m_actionType; // 0x5c
char* m_actionArgString; // 0x60
MxS32 m_actionArgNumber; // 0x64
};
// SYNTHETIC: LEGO1 0x1000c3b0

View File

@@ -10,7 +10,7 @@
// SIZE 0x20
class LegoEventNotificationParam : public MxNotificationParam {
public:
inline LegoEventNotificationParam() : MxNotificationParam(PARAM_NONE, NULL) {}
inline LegoEventNotificationParam() : MxNotificationParam(c_notificationType0, NULL) {}
inline LegoEventNotificationParam(
NotificationId p_type,
MxCore* p_sender,
@@ -24,6 +24,8 @@ public:
}
inline MxU8 GetKey() const { return m_key; }
inline MxS32 GetX() const { return m_x; }
inline MxS32 GetY() const { return m_y; }
protected:
MxU8 m_modifier; // 0x0c

View File

@@ -43,6 +43,7 @@ public:
void SetSomeEnumState(undefined4 p_state);
void FUN_1003ceb0();
void FUN_10039780(MxU8);
struct ScoreStruct {
void WriteScoreHistory();

View File

@@ -52,6 +52,7 @@ public:
void ClearWorld();
inline void SetUnknown88(MxBool p_unk0x88) { m_unk0x88 = p_unk0x88; }
inline void SetUnknown335(MxBool p_unk0x335) { m_unk0x335 = p_unk0x335; }
inline void SetUnknown336(MxBool p_unk0x336) { m_unk0x336 = p_unk0x336; }
inline void SetUseJoystick(MxBool p_useJoystick) { m_useJoystick = p_useJoystick; }
inline void SetJoystickIndex(MxS32 p_joystickIndex) { m_joystickIndex = p_joystickIndex; }

View File

@@ -120,6 +120,8 @@ public:
inline void SetWorld(LegoWorld* p_currentWorld) { m_currentWorld = p_currentWorld; }
inline void SetExit(MxBool p_exit) { m_exit = p_exit; };
inline void CloseMainWindow() { PostMessageA(m_windowHandle, WM_CLOSE, 0, 0); }
private:
undefined4* m_unk0x68; // 0x68
ViewLODListManager* m_viewLODListManager; // 0x6c
@@ -161,6 +163,7 @@ LegoWorld* GetCurrentWorld();
LegoUnkSaveDataWriter* GetUnkSaveDataWriter();
GifManager* GetGifManager();
void FUN_10015820(MxU32, MxU32);
void FUN_10015860(const char*, MxU8);
LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid);
MxDSAction& GetCurrentAction();

View File

@@ -30,9 +30,9 @@ public:
virtual MxBool IsReadMode();
enum OpenFlags {
ReadBit = 1,
WriteBit = 2,
BinaryBit = 4,
c_readBit = 1,
c_writeBit = 2,
c_binaryBit = 4,
};
static MxResult __stdcall WriteVariable(LegoStream* p_stream, MxVariableTable* p_from, const char* p_variableName);

View File

@@ -10,8 +10,8 @@
class MxAtomId;
class LegoEntity;
ExtraActionType MatchActionString(const char*);
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender);
Extra::ActionType MatchActionString(const char*);
void InvokeAction(Extra::ActionType 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);
MxBool FUN_1003ee00(MxAtomId& p_atomId, MxS32 p_id);
void FUN_1003ef00(MxBool);

View File

@@ -58,6 +58,7 @@ public:
void FUN_10073400();
void FUN_10073430();
MxS32 GetCurrPathInfo(LegoPathBoundary** p_path, MxS32& p_value);
MxPresenter* FindPresenter(const char* p_presenter, const char* p_name);
protected:
LegoPathControllerList m_list0x68; // 0x68

View File

@@ -32,13 +32,13 @@ public:
virtual MxResult GetDDrawSurfaceFromVideoManager(); // vtable+0x14
enum TransitionType {
NOT_TRANSITIONING,
NO_ANIMATION,
DISSOLVE,
PIXELATION,
SCREEN_WIPE,
WINDOWS,
BROKEN // Unknown what this is supposed to be, it locks the game up
e_notTransitioning = 0,
e_noAnimation,
e_dissolve,
e_pixelation,
e_screenWipe,
e_windows,
e_broken // Unknown what this is supposed to be, it locks the game up
};
MxResult StartTransition(TransitionType p_animationType, MxS32 p_speed, MxBool p_doCopy, MxBool p_playMusicInAnim);