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);

View File

@@ -77,13 +77,13 @@ void MxBackgroundAudioManager::DestroyMusic()
MxResult MxBackgroundAudioManager::Tickle()
{
switch (m_unk0x13c) {
case MxPresenter::TickleState_Starting:
case MxPresenter::e_starting:
FadeInOrFadeOut();
return SUCCESS;
case MxPresenter::TickleState_Streaming:
case MxPresenter::e_streaming:
FUN_1007ee70();
return SUCCESS;
case MxPresenter::TickleState_Repeating:
case MxPresenter::e_repeating:
FUN_1007ef40();
return SUCCESS;
default:

View File

@@ -100,7 +100,7 @@ MxU32 Helicopter::VTable0xcc()
VTable0xe8(0x29, TRUE, 7);
((Isle*) GetCurrentWorld())->SetUnknown13c(0x3c);
FUN_10015820(1, 0);
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, TRUE);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, TRUE);
SetUnknownDC(4);
PlayMusic(9);
break;
@@ -112,7 +112,7 @@ MxU32 Helicopter::VTable0xcc()
break;
}
VTable0xe0();
InvokeAction(ExtraActionType_start, m_script, 0x15, NULL);
InvokeAction(Extra::ActionType::e_start, m_script, 0x15, NULL);
GetCurrentAction().SetObjectId(-1);
ControlManager()->Register(this);
return 1;
@@ -139,7 +139,7 @@ MxU32 Helicopter::VTable0xd4(MxType17NotificationParam& p_param)
case 0x17:
if (*g_act3Script == script) {
((Act3*) GetCurrentWorld())->SetUnkown4270(2);
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, FALSE);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
}
else if (m_state->GetUnkown8() != 0)
break;
@@ -155,7 +155,7 @@ MxU32 Helicopter::VTable0xd4(MxType17NotificationParam& p_param)
state->SetUnknown18(4);
m_state->SetUnknown8(1);
m_world->FUN_1001fc80(this);
InvokeAction(ExtraActionType_start, script, 0x20, NULL);
InvokeAction(Extra::ActionType::e_start, script, 0x20, NULL);
SetUnknownDC(0);
}
ret = 1;
@@ -167,7 +167,7 @@ MxU32 Helicopter::VTable0xd4(MxType17NotificationParam& p_param)
if (m_state->GetUnkown8() == 2) {
m_state->SetUnknown8(3);
m_world->FUN_1001fc80(this);
InvokeAction(ExtraActionType_start, script, 0x21, NULL);
InvokeAction(Extra::ActionType::e_start, script, 0x21, NULL);
SetUnknownDC(4);
}
ret = 1;
@@ -203,7 +203,7 @@ MxU32 Helicopter::VTable0xd4(MxType17NotificationParam& p_param)
case 0x1c:
if (GameState()->GetUnknown10() == 0) {
((Isle*) GetCurrentWorld())->SetUnknown13c(2);
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 50, FALSE, FALSE);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
VTable0xe4();
}
ret = 1;

View File

@@ -19,7 +19,7 @@ void LegoActionControlPresenter::ReadyTickle()
if (chunk) {
ParseExtra();
ProgressTickleState(TickleState_Starting);
ProgressTickleState(e_starting);
m_subscriber->DestroyChunk(chunk);
if (m_compositePresenter) {
@@ -40,13 +40,13 @@ void LegoActionControlPresenter::RepeatingTickle()
#ifdef COMPAT_MODE
{
MxAtomId atom(m_unk0x54.GetData(), LookupMode_LowerCase2);
MxAtomId atom(m_unk0x54.GetData(), e_lowerCase2);
InvokeAction(m_unk0x50, atom, m_unk0x64, NULL);
}
#else
InvokeAction(m_unk0x50, MxAtomId(m_unk0x54.GetData(), LookupMode_LowerCase2), m_unk0x64, NULL);
InvokeAction(m_unk0x50, MxAtomId(m_unk0x54.GetData(), e_lowerCase2), m_unk0x64, NULL);
#endif
ProgressTickleState(TickleState_Done);
ProgressTickleState(e_done);
}
}
@@ -92,11 +92,11 @@ void LegoActionControlPresenter::ParseExtra()
char output[1024];
if (KeyValueStringParse(output, g_strACTION, buf)) {
m_unk0x50 = MatchActionString(strtok(output, g_parseExtraTokens));
if (m_unk0x50 != ExtraActionType_exit) {
if (m_unk0x50 != Extra::ActionType::e_exit) {
MakeSourceName(buf, strtok(NULL, g_parseExtraTokens));
m_unk0x54 = buf;
m_unk0x54.ToLowerCase();
if (m_unk0x50 != ExtraActionType_run) {
if (m_unk0x50 != Extra::ActionType::e_run) {
m_unk0x64 = atoi(strtok(NULL, g_parseExtraTokens));
}
}

View File

@@ -92,11 +92,18 @@ LegoGameState::~LegoGameState()
delete[] m_savePath;
}
// STUB: LEGO1 0x10039780
void LegoGameState::FUN_10039780(MxU8)
{
// TODO
}
// FUNCTION: LEGO1 0x10039980
MxResult LegoGameState::Save(MxULong p_slot)
{
MxResult result;
InfocenterState* infocenterState = (InfocenterState*) GameState()->GetState("InfocenterState");
if (!infocenterState || infocenterState->GetInfocenterBufferElement(0) == 0)
result = SUCCESS;
else {
@@ -105,7 +112,7 @@ MxResult LegoGameState::Save(MxULong p_slot)
MxString savePath;
GetFileSavePath(&savePath, p_slot);
LegoFileStream fileStream;
if (fileStream.Open(savePath.GetData(), LegoStream::WriteBit) != FAILURE) {
if (fileStream.Open(savePath.GetData(), LegoStream::c_writeBit) != FAILURE) {
MxU32 maybeVersion = 0x1000C;
fileStream.Write(&maybeVersion, 4);
fileStream.Write(&m_unk0x24, 2);
@@ -216,7 +223,7 @@ void LegoGameState::HandleAction(MxU32 p_area)
// TODO: implement other cases
}
InvokeAction(ExtraActionType_opendisk, *script, 0, NULL);
InvokeAction(Extra::ActionType::e_opendisk, *script, 0, NULL);
}
// FUNCTION: LEGO1 0x1003bac0
@@ -310,7 +317,7 @@ void LegoGameState::SerializeScoreHistory(MxS16 p_flags)
savePath += "\\";
savePath += g_historyGSI;
if (p_flags == LegoStream::WriteBit) {
if (p_flags == LegoStream::c_writeBit) {
m_unk0xa6.WriteScoreHistory();
}

View File

@@ -106,7 +106,7 @@
// FUNCTION: LEGO1 0x10006e40
LegoObjectFactory::LegoObjectFactory()
{
#define X(V) this->m_id##V = MxAtomId(#V, LookupMode_Exact);
#define X(V) this->m_id##V = MxAtomId(#V, e_exact);
FOR_LEGOOBJECTFACTORY_OBJECTS(X)
#undef X
}
@@ -114,7 +114,7 @@ LegoObjectFactory::LegoObjectFactory()
// FUNCTION: LEGO1 0x10009a90
MxCore* LegoObjectFactory::Create(const char* p_name)
{
MxAtomId atom(p_name, LookupMode_Exact);
MxAtomId atom(p_name, e_exact);
#define X(V) \
if (this->m_id##V == atom) { \

View File

@@ -167,18 +167,18 @@ MxResult LegoFileStream::Open(const char* p_filename, OpenFlags p_mode)
fclose(m_hFile);
modeString[0] = '\0';
if (p_mode & ReadBit) {
if (p_mode & c_readBit) {
m_mode = LEGOSTREAM_MODE_READ;
strcat(modeString, "r");
}
if (p_mode & WriteBit) {
if (p_mode & c_writeBit) {
if (m_mode != LEGOSTREAM_MODE_READ)
m_mode = LEGOSTREAM_MODE_WRITE;
strcat(modeString, "w");
}
if ((p_mode & 4) != 0)
if ((p_mode & c_binaryBit) != 0)
strcat(modeString, "b");
else
strcat(modeString, "t");

View File

@@ -11,30 +11,30 @@
#include <string.h>
// FUNCTION: LEGO1 0x1003e300
ExtraActionType MatchActionString(const char* p_str)
Extra::ActionType MatchActionString(const char* p_str)
{
ExtraActionType result = ExtraActionType_unknown;
Extra::ActionType result = Extra::ActionType::e_unknown;
if (!strcmpi("openram", p_str))
result = ExtraActionType_openram;
result = Extra::ActionType::e_openram;
else if (!strcmpi("opendisk", p_str))
result = ExtraActionType_opendisk;
result = Extra::ActionType::e_opendisk;
else if (!strcmpi("close", p_str))
result = ExtraActionType_close;
result = Extra::ActionType::e_close;
else if (!strcmpi("start", p_str))
result = ExtraActionType_start;
result = Extra::ActionType::e_start;
else if (!strcmpi("stop", p_str))
result = ExtraActionType_stop;
result = Extra::ActionType::e_stop;
else if (!strcmpi("run", p_str))
result = ExtraActionType_run;
result = Extra::ActionType::e_run;
else if (!strcmpi("exit", p_str))
result = ExtraActionType_exit;
result = Extra::ActionType::e_exit;
else if (!strcmpi("enable", p_str))
result = ExtraActionType_enable;
result = Extra::ActionType::e_enable;
else if (!strcmpi("disable", p_str))
result = ExtraActionType_disable;
result = Extra::ActionType::e_disable;
else if (!strcmpi("notify", p_str))
result = ExtraActionType_notify;
result = Extra::ActionType::e_notify;
return result;
}
@@ -43,54 +43,54 @@ MxBool CheckIfEntityExists(MxBool p_enable, const char* p_filename, MxS32 p_enti
void NotifyEntity(const char* p_filename, MxS32 p_entityId, LegoEntity* p_sender);
// FUNCTION: LEGO1 0x1003e430
void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender)
void InvokeAction(Extra::ActionType p_actionId, MxAtomId& p_pAtom, int p_targetEntityId, LegoEntity* p_sender)
{
MxDSAction action;
action.SetAtomId(p_pAtom);
action.SetObjectId(p_targetEntityId);
switch (p_actionId) {
case ExtraActionType_opendisk:
case Extra::ActionType::e_opendisk:
if (!CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId)) {
Streamer()->Open(p_pAtom.GetInternal(), MxStreamer::e_DiskStream);
Streamer()->Open(p_pAtom.GetInternal(), MxStreamer::e_diskStream);
Start(&action);
}
break;
case ExtraActionType_openram:
case Extra::ActionType::e_openram:
if (!CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId)) {
Streamer()->Open(p_pAtom.GetInternal(), MxStreamer::e_RAMStream);
Start(&action);
}
break;
case ExtraActionType_close:
case Extra::ActionType::e_close:
action.SetUnknown24(-2);
DeleteObject(action);
Streamer()->Close(p_pAtom.GetInternal());
break;
case ExtraActionType_start:
case Extra::ActionType::e_start:
if (!CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId)) {
Start(&action);
}
break;
case ExtraActionType_stop:
case Extra::ActionType::e_stop:
action.SetUnknown24(-2);
if (!FUN_1003ee00(p_pAtom, p_targetEntityId)) {
DeleteObject(action);
}
break;
case ExtraActionType_run:
case Extra::ActionType::e_run:
_spawnl(0, "\\lego\\sources\\main\\main.exe", "\\lego\\sources\\main\\main.exe", "/script", &p_pAtom, 0);
break;
case ExtraActionType_exit:
case Extra::ActionType::e_exit:
Lego()->SetExit(TRUE);
break;
case ExtraActionType_enable:
case Extra::ActionType::e_enable:
CheckIfEntityExists(TRUE, p_pAtom.GetInternal(), p_targetEntityId);
break;
case ExtraActionType_disable:
case Extra::ActionType::e_disable:
CheckIfEntityExists(FALSE, p_pAtom.GetInternal(), p_targetEntityId);
break;
case ExtraActionType_notify:
case Extra::ActionType::e_notify:
NotifyEntity(p_pAtom.GetInternal(), p_targetEntityId, p_sender);
break;
}
@@ -99,8 +99,7 @@ void InvokeAction(ExtraActionType p_actionId, MxAtomId& p_pAtom, int p_targetEnt
// FUNCTION: LEGO1 0x1003e670
MxBool CheckIfEntityExists(MxBool p_enable, const char* p_filename, MxS32 p_entityId)
{
LegoWorld* world =
(LegoWorld*) FindEntityByAtomIdOrEntityId(MxAtomId(p_filename, LookupMode_LowerCase2), p_entityId);
LegoWorld* world = (LegoWorld*) FindEntityByAtomIdOrEntityId(MxAtomId(p_filename, e_lowerCase2), p_entityId);
if (world) {
world->VTable0x68(p_enable);
return TRUE;

View File

@@ -55,7 +55,7 @@ MxResult MxCompositeMediaPresenter::StartAction(MxStreamController* p_controller
if (presenter && presenter->AddToManager() == SUCCESS) {
presenter->SetCompositePresenter(this);
if (presenter->StartAction(p_controller, action) == SUCCESS) {
presenter->SetTickleState(TickleState_Idle);
presenter->SetTickleState(e_idle);
if (presenter->IsA("MxVideoPresenter"))
VideoManager()->UnregisterPresenter(*presenter);
@@ -75,7 +75,7 @@ MxResult MxCompositeMediaPresenter::StartAction(MxStreamController* p_controller
}
if (!m_compositePresenter) {
SetTickleState(TickleState_Ready);
SetTickleState(e_ready);
MxLong time = Timer()->GetTime();
m_action->SetUnknown90(time);
}
@@ -93,10 +93,10 @@ void MxCompositeMediaPresenter::StartingTickle()
if (!m_unk0x4e) {
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
if ((*it)->GetCurrentTickleState() < TickleState_Streaming) {
if ((*it)->GetCurrentTickleState() < e_streaming) {
(*it)->Tickle();
if ((*it)->GetCurrentTickleState() == TickleState_Streaming ||
if ((*it)->GetCurrentTickleState() == e_streaming ||
((*it)->GetAction() && (*it)->GetAction()->GetStartTime()))
m_unk0x4c++;
}
@@ -115,15 +115,15 @@ void MxCompositeMediaPresenter::StartingTickle()
else {
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
if (!(*it)->GetAction()->GetStartTime() && ((MxMediaPresenter*) *it)->CurrentChunk() &&
!((*it)->GetAction()->GetFlags() & MxDSAction::Flag_Bit9)) {
!((*it)->GetAction()->GetFlags() & MxDSAction::c_bit9)) {
(*it)->Tickle();
(*it)->GetAction()->SetFlags((*it)->GetAction()->GetFlags() | MxDSAction::Flag_Bit9);
(*it)->GetAction()->SetFlags((*it)->GetAction()->GetFlags() | MxDSAction::c_bit9);
m_unk0x4c--;
}
}
if (!m_unk0x4c) {
ProgressTickleState(TickleState_Streaming);
ProgressTickleState(e_streaming);
MxLong time = Timer()->GetTime();
m_action->SetUnknown90(time);
}
@@ -136,15 +136,15 @@ MxResult MxCompositeMediaPresenter::Tickle()
MxAutoLocker lock(&m_criticalSection);
switch (m_currentTickleState) {
case TickleState_Ready:
ProgressTickleState(TickleState_Starting);
case TickleState_Starting:
case e_ready:
ProgressTickleState(e_starting);
case e_starting:
StartingTickle();
break;
case TickleState_Streaming:
case TickleState_Repeating:
case TickleState_unk5:
case TickleState_Done: {
case e_streaming:
case e_repeating:
case e_unk5:
case e_done: {
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++)
(*it)->Tickle();
break;
@@ -161,7 +161,7 @@ MxResult MxCompositeMediaPresenter::PutData()
{
MxAutoLocker lock(&m_criticalSection);
if (m_currentTickleState >= TickleState_Streaming && m_currentTickleState <= TickleState_Done) {
if (m_currentTickleState >= e_streaming && m_currentTickleState <= e_done) {
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++)
(*it)->PutData();
}

View File

@@ -30,6 +30,11 @@ void LegoControlManager::Unregister(MxCore* p_listener)
// TODO
}
// STUB: LEGO1 0x100293c0
void LegoControlManager::FUN_100293c0(undefined4, const MxAtomId&, undefined2)
{
}
// STUB: LEGO1 0x10029600
MxResult LegoControlManager::Tickle()
{

View File

@@ -53,7 +53,7 @@ MxResult MxControlPresenter::StartAction(MxStreamController* p_controller, MxDSA
{
MxResult result = MxCompositePresenter::StartAction(p_controller, p_action);
FUN_100b7220(m_action, MxDSAction::Flag_World | MxDSAction::Flag_Looping, TRUE);
FUN_100b7220(m_action, MxDSAction::c_world | MxDSAction::c_looping, TRUE);
ParseExtra();
MxS16 i = 0;
@@ -64,7 +64,7 @@ MxResult MxControlPresenter::StartAction(MxStreamController* p_controller, MxDSA
if (m_unk0x4c == 3) {
MxDSAction* action = (*m_list.begin())->GetAction();
action->SetFlags(action->GetFlags() | MxDSAction::Flag_Bit11);
action->SetFlags(action->GetFlags() | MxDSAction::c_bit11);
}
TickleManager()->RegisterClient(this, 200);
@@ -106,7 +106,7 @@ void MxControlPresenter::ReadyTickle()
{
MxPresenter::ParseExtra();
TickleManager()->UnregisterClient(this);
ProgressTickleState(TickleState_Repeating);
ProgressTickleState(e_repeating);
}
// STUB: LEGO1 0x10044640

View File

@@ -12,7 +12,7 @@ void LegoActorPresenter::ReadyTickle()
SetEntityLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp());
m_entity->Create(*m_action);
}
ProgressTickleState(TickleState_Starting);
ProgressTickleState(e_starting);
}
}
@@ -20,7 +20,7 @@ void LegoActorPresenter::ReadyTickle()
void LegoActorPresenter::StartingTickle()
{
if (m_entity->GetROI()) {
ProgressTickleState(TickleState_Streaming);
ProgressTickleState(e_streaming);
ParseExtra();
}
}

View File

@@ -20,7 +20,7 @@ void LegoEntity::Init()
m_actionArgString = NULL;
m_unk0x10 = 0;
m_flags = 0;
m_actionType = ExtraActionType_unknown;
m_actionType = Extra::ActionType::e_unknown;
m_actionArgNumber = -1;
m_unk0x59 = 4;
}
@@ -50,7 +50,7 @@ MxResult LegoEntity::Create(MxDSAction& p_dsAction)
void LegoEntity::Destroy(MxBool p_fromDestructor)
{
if (m_roi) {
if (m_flags & Flag_Bit1) {
if (m_flags & c_bit1) {
if (m_roi->GetUnknown0x104() == this)
m_roi->SetUnknown0x104(NULL);
@@ -108,13 +108,13 @@ void LegoEntity::ParseAction(char* p_extra)
if (KeyValueStringParse(actionValue, g_strACTION, copy)) {
m_actionType = MatchActionString(strtok(actionValue, g_parseExtraTokens));
if (m_actionType != ExtraActionType_exit) {
if (m_actionType != Extra::ActionType::e_exit) {
char* token = strtok(NULL, g_parseExtraTokens);
m_actionArgString = new char[strlen(token) + 1];
strcpy(m_actionArgString, token);
if (m_actionType != ExtraActionType_run) {
if (m_actionType != Extra::ActionType::e_run) {
m_actionArgNumber = atoi(strtok(NULL, g_parseExtraTokens));
}
}

View File

@@ -69,7 +69,7 @@ void LegoEntityPresenter::ReadyTickle()
m_entity->SetLocation(m_action->GetLocation(), m_action->GetDirection(), m_action->GetUp(), TRUE);
ParseExtra();
}
ProgressTickleState(TickleState_Starting);
ProgressTickleState(e_starting);
}
}

View File

@@ -62,7 +62,7 @@ MxResult LegoWorld::Create(MxDSAction& p_dsAction)
if (!VTable0x54())
return FAILURE;
if (p_dsAction.GetFlags() & MxDSAction::Flag_Enabled) {
if (p_dsAction.GetFlags() & MxDSAction::c_enabled) {
if (GetCurrentWorld()) {
GetCurrentWorld()->VTable0x68(0);
}
@@ -151,6 +151,12 @@ void LegoWorld::EndAction(MxCore* p_object)
{
}
// STUB: LEGO1 0x100213a0
MxPresenter* LegoWorld::FindPresenter(const char* p_presenter, const char* p_name)
{
return NULL;
}
// STUB: LEGO1 0x10021a70
void LegoWorld::VTable0x68(MxBool p_add)
{

View File

@@ -91,7 +91,7 @@ MxResult LegoWorldPresenter::StartAction(MxStreamController* p_controller, MxDSA
if (presenter && presenter->AddToManager() == SUCCESS) {
presenter->SetCompositePresenter(this);
if (presenter->StartAction(p_controller, action) == SUCCESS) {
presenter->SetTickleState(TickleState_Idle);
presenter->SetTickleState(e_idle);
success = TRUE;
}
}
@@ -123,7 +123,7 @@ void LegoWorldPresenter::ReadyTickle()
}
ParseExtra();
ProgressTickleState(TickleState_Starting);
ProgressTickleState(e_starting);
}
// FUNCTION: LEGO1 0x10066ac0
@@ -131,19 +131,19 @@ void LegoWorldPresenter::StartingTickle()
{
if (m_action->IsA("MxDSSerialAction")) {
MxPresenter* presenter = *m_list.begin();
if (presenter->GetCurrentTickleState() == TickleState_Idle) {
presenter->SetTickleState(TickleState_Ready);
if (presenter->GetCurrentTickleState() == e_idle) {
presenter->SetTickleState(e_ready);
}
}
else {
for (MxCompositePresenterList::iterator it = m_list.begin(); it != m_list.end(); it++) {
if ((*it)->GetCurrentTickleState() == TickleState_Idle) {
(*it)->SetTickleState(TickleState_Ready);
if ((*it)->GetCurrentTickleState() == e_idle) {
(*it)->SetTickleState(e_ready);
}
}
}
ProgressTickleState(TickleState_Streaming);
ProgressTickleState(e_streaming);
}
// FUNCTION: LEGO1 0x10067a70
@@ -152,7 +152,7 @@ void LegoWorldPresenter::VTable0x60(MxPresenter* p_presenter)
MxCompositePresenter::VTable0x60(p_presenter);
MxDSAction* action = p_presenter->GetAction();
if (action->GetDuration() != -1 && (action->GetFlags() & MxDSAction::Flag_Looping) == 0) {
if (action->GetDuration() != -1 && (action->GetFlags() & MxDSAction::c_looping) == 0) {
if (!action->IsA("MxDSMediaAction")) {
return;
}

View File

@@ -1,9 +1,49 @@
#include "infocenter.h"
// STUB: LEGO1 0x1006ea20
#include "infocenterstate.h"
#include "legocontrolmanager.h"
#include "legogamestate.h"
#include "legoinputmanager.h"
#include "legoomni.h"
#include "legoutil.h"
#include "legovideomanager.h"
#include "mxactionnotificationparam.h"
#include "mxbackgroundaudiomanager.h"
#include "mxnotificationmanager.h"
#include "mxstillpresenter.h"
#include "mxtransitionmanager.h"
DECOMP_SIZE_ASSERT(Infocenter, 0x1d8)
DECOMP_SIZE_ASSERT(InfocenterUnkDataEntry, 0x18)
// GLOBAL: LEGO1 0x100f76a0
const char* g_object2x4red = "2x4red";
// GLOBAL: LEGO1 0x100f76a4
const char* g_object2x4grn = "2x4grn";
// FUNCTION: LEGO1 0x1006ea20
Infocenter::Infocenter()
{
// TODO
m_unk0xfc = 0;
m_unk0x11c = 0;
m_infocenterState = NULL;
m_unk0x1cc = 0;
m_unk0x11c = 0;
m_unk0x104 = 0;
m_currentInfomainScript = c_noInfomain;
m_currentIntroScript = e_noIntro;
memset(&m_entries, 0, sizeof(InfocenterUnkDataEntry) * 7);
m_unk0x1c8 = -1;
SetAppCursor(1);
NotificationManager()->Register(this);
m_unk0x1d0 = 0;
m_unk0x1d2 = 0;
m_unk0x1d4 = 0;
m_unk0x1d6 = 0;
}
// STUB: LEGO1 0x1006ec90
@@ -15,33 +55,421 @@ Infocenter::~Infocenter()
// STUB: LEGO1 0x1006ed90
MxResult Infocenter::Create(MxDSAction& p_dsAction)
{
return FAILURE;
if (LegoWorld::Create(p_dsAction) == SUCCESS) {
InputManager()->SetWorld(this);
ControlManager()->Register(this);
}
LegoGameState* gs = GameState();
m_infocenterState = (InfocenterState*) gs->GetState("InfocenterState");
if (!m_infocenterState) {
m_infocenterState = (InfocenterState*) gs->CreateState("InfocenterState");
m_infocenterState->SetUnknown0x74(3);
}
else {
// TODO
}
// TODO
InputManager()->Register(this);
SetIsWorldActive(FALSE);
return SUCCESS;
}
// STUB: LEGO1 0x1006ef10
// FUNCTION: LEGO1 0x1006ef10
MxLong Infocenter::Notify(MxParam& p_param)
{
// TODO
return 0;
MxLong result = 0;
LegoWorld::Notify(p_param);
if (m_worldStarted) {
switch (((MxNotificationParam&) p_param).GetNotification()) {
case c_notificationType0:
result = HandleNotification0(p_param);
break;
case c_notificationEndAction:
result = HandleEndAction(p_param);
break;
case c_notificationKeyPress:
result = HandleKeyPress(((LegoEventNotificationParam&) p_param).GetKey());
break;
case c_notificationButtonUp:
result = HandleButtonUp(
((LegoEventNotificationParam&) p_param).GetX(),
((LegoEventNotificationParam&) p_param).GetY()
);
break;
case c_notificationMouseMove:
result = HandleMouseMove(
((LegoEventNotificationParam&) p_param).GetX(),
((LegoEventNotificationParam&) p_param).GetY()
);
break;
case c_notificationType17:
result = HandleNotification17(p_param);
break;
case c_notificationTransitioned:
StopBookAnimation();
m_unk0x1d2 = 0;
if (m_infocenterState->GetUnknown0x74() == 0xc) {
StartCredits();
m_infocenterState->SetUnknown0x74(0xd);
}
else if (m_unk0x104 != 0) {
BackgroundAudioManager()->RaiseVolume();
GameState()->HandleAction(m_unk0x104);
m_unk0x104 = 0;
}
break;
}
}
return result;
}
// FUNCTION: LEGO1 0x1006f080
MxLong Infocenter::HandleEndAction(MxParam& p_param)
{
MxDSAction* action = ((MxEndActionNotificationParam&) p_param).GetAction();
if (action->GetAtomId() == *g_creditsScript && action->GetObjectId() == 499) {
Lego()->CloseMainWindow();
return 1;
}
if (action->GetAtomId() == m_atom &&
(action->GetObjectId() == 40 || action->GetObjectId() == 41 || action->GetObjectId() == 42 ||
action->GetObjectId() == 43 || action->GetObjectId() == 44)) {
if (m_unk0x1d4) {
m_unk0x1d4--;
}
if (!m_unk0x1d4) {
PlayMusic(11);
GameState()->FUN_10039780(m_unk0xfc);
switch (m_unk0xfc) {
case 1:
PlayDialogue(c_pepperCharacterSelect);
break;
case 2:
PlayDialogue(c_mamaCharacterSelect);
break;
case 3:
PlayDialogue(c_papaCharacterSelect);
break;
case 4:
PlayDialogue(c_officierCharacterSelect);
break;
case 5:
PlayDialogue(c_loraCharacterSelect);
break;
default:
break;
}
FUN_10070dc0(TRUE);
}
}
MxLong result = m_radio.Notify(p_param);
if (result || (action->GetAtomId() != m_atom && action->GetAtomId() != *g_introScript))
return result;
if (action->GetObjectId() == c_returnBack) {
ControlManager()->FUN_100293c0(0x10, action->GetAtomId(), 0);
m_unk0x1d6 = 0;
}
switch (m_infocenterState->GetUnknown0x74()) {
case 0:
switch (m_currentIntroScript) {
case e_legoMovie:
PlayCutscene(e_mindscapeMovie, FALSE);
return 1;
case e_mindscapeMovie:
PlayCutscene(e_introMovie, TRUE);
return 1;
case e_badEndMovie:
StopCutscene();
m_infocenterState->SetUnknown0x74(11);
PlayDialogue(c_badEndingDialogue);
m_currentIntroScript = e_noIntro;
return 1;
case e_goodEndMovie:
StopCutscene();
m_infocenterState->SetUnknown0x74(11);
PlayDialogue(c_goodEndingDialogue);
m_currentIntroScript = e_noIntro;
return 1;
}
// default / 2nd case probably?
StopCutscene();
m_infocenterState->SetUnknown0x74(11);
PlayDialogue(c_welcomeDialogue);
m_currentIntroScript = e_noIntro;
if (m_infocenterState->GetInfocenterBufferElement(0) == 0) {
m_unk0x1d2 = 1;
return 1;
}
break;
case 1:
m_infocenterState->SetUnknown0x74(11);
switch (m_currentIntroScript) {
case e_badEndMovie:
PlayDialogue(c_badEndingDialogue);
break;
case e_goodEndMovie:
PlayDialogue(c_goodEndingDialogue);
break;
default:
PlayDialogue(c_welcomeDialogue);
}
m_currentIntroScript = e_noIntro;
return 1;
case 2:
FUN_10015860(g_object2x4red, 0);
FUN_10015860(g_object2x4grn, 0);
BackgroundAudioManager()->RaiseVolume();
return 1;
case 4:
if (action->GetObjectId() == 70 || action->GetObjectId() == 71) {
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
m_infocenterState->SetUnknown0x74(14);
return 1;
}
break;
case 5:
if (action->GetObjectId() == m_currentInfomainScript) {
if (GameState()->GetUnknown10() != 2 && m_unk0xfc != 0) {
GameState()->FUN_10039780(m_unk0xfc);
}
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
m_infocenterState->SetUnknown0x74(14);
return 1;
}
break;
case 11:
if (m_infocenterState->GetInfocenterBufferElement(0) == 0 && m_currentInfomainScript != 40 &&
m_currentInfomainScript != 41 && m_currentInfomainScript != 42 && m_currentInfomainScript != 43 &&
m_currentInfomainScript != 44) {
m_unk0x1d0 = 1;
PlayMusic(11);
}
m_infocenterState->SetUnknown0x74(2);
FUN_10015860("infoman", 1);
return 1;
case 12:
if (action->GetObjectId() == m_currentInfomainScript) {
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 50, FALSE, FALSE);
}
}
result = 1;
return result;
}
// STUB: LEGO1 0x1006f4e0
void Infocenter::VTable0x50()
{
// TODO
m_unk0x1d0 = 0;
m_unk0x1d2 = 0;
m_unk0x1d4 = 0;
m_unk0x1d6 = 0;
MxStillPresenter* bg = (MxStillPresenter*) FindPresenter("MxStillPresenter", "Background_Bitmap");
MxStillPresenter* bgRed = (MxStillPresenter*) FindPresenter("MxStillPresenter", "BackgroundRed_Bitmap");
switch (GameState()->GetUnknown10()) {
case 0:
// bg->Enable(1); // TODO: Uncomment once LegoWorld::FindPresenter and LegoWorld::VTable0x58 are implemented.
InitializeBitmaps();
switch (m_infocenterState->GetUnknown0x74()) {
case 3:
PlayCutscene(e_legoMovie, TRUE);
m_infocenterState->SetUnknown0x74(0);
return;
case 4:
m_infocenterState->SetUnknown0x74(2);
if (m_infocenterState->GetInfocenterBufferElement(0) == 0) {
m_unk0x1d2 = 1;
}
PlayDialogue(c_letsGetStarted);
PlayMusic(11);
FUN_10015820(0, 7);
return;
default:
PlayMusic(11);
// TODO
break;
case 8:
PlayMusic(11);
PlayDialogue(c_exitConfirmation);
FUN_10015820(0, 7);
return;
case 0xf:
if (m_infocenterState->GetInfocenterBufferElement(0) == 0) {
m_unk0x1d2 = 1;
}
PlayDialogue(c_randomDialogue1);
PlayMusic(11);
FUN_10015820(0, 7);
return;
}
break;
case 1:
// TODO
break;
case 2:
// TODO
break;
default:
m_infocenterState->SetUnknown0x74(11);
FUN_10015820(0, 7);
return;
}
}
// STUB: LEGO1 0x10070aa0
// STUB: LEGO1 0x1006f9a0
void Infocenter::InitializeBitmaps()
{
// TODO: Infocenter class size is wrong
}
// STUB: LEGO1 0x1006fd00
MxU8 Infocenter::HandleMouseMove(MxS32 p_x, MxS32 p_y)
{
return 1;
}
// FUNCTION: LEGO1 0x1006fda0
MxLong Infocenter::HandleKeyPress(MxS8 p_key)
{
MxLong result = 0;
if (p_key == ' ' && m_worldStarted) {
switch (m_infocenterState->GetUnknown0x74()) {
case 0:
StopCutscene();
m_infocenterState->SetUnknown0x74(1);
if (m_infocenterState->GetInfocenterBufferElement(0) == 0) {
m_unk0x1d2 = 1;
return 1;
}
break;
case 1:
case 4:
break;
default: {
InfomainScript script = m_currentInfomainScript;
StopCurrentDialogue();
switch (m_infocenterState->GetUnknown0x74()) {
case 5:
case 12:
m_currentInfomainScript = script;
return 1;
default:
m_infocenterState->SetUnknown0x74(2);
return 1;
case 8:
case 11:
break;
}
}
case 13:
StopCredits();
break;
}
result = 1;
}
return result;
}
// STUB: LEGO1 0x1006feb0
MxU8 Infocenter::HandleButtonUp(MxS32 p_x, MxS32 p_y)
{
return 1;
}
// STUB: LEGO1 0x10070370
MxU8 Infocenter::HandleNotification17(MxParam&)
{
return 1;
}
// STUB: LEGO1 0x10070870
MxLong Infocenter::HandleNotification0(MxParam&)
{
return 1;
}
// FUNCTION: LEGO1 0x10070aa0
void Infocenter::VTable0x68(MxBool p_add)
{
// TODO
LegoWorld::VTable0x68(p_add);
if (p_add) {
InputManager()->SetWorld(this);
SetIsWorldActive(FALSE);
}
else {
if (InputManager()->GetWorld() == this) {
InputManager()->ClearWorld();
}
}
}
// STUB: LEGO1 0x10070af0
MxResult Infocenter::Tickle()
{
// TODO
return 0;
return LegoWorld::Tickle();
}
// FUNCTION: LEGO1 0x10070c20
void Infocenter::PlayCutscene(IntroScript p_entityId, MxBool p_scale)
{
m_currentIntroScript = p_entityId;
VideoManager()->EnableFullScreenMovie(TRUE, p_scale);
InputManager()->SetUnknown336(TRUE);
InputManager()->SetUnknown335(TRUE);
SetAppCursor(0xb); // Hide cursor
VideoManager()->GetDisplaySurface()->ClearScreen();
if (m_currentIntroScript != e_noIntro) {
// check if the cutscene is not an ending
if (m_currentIntroScript >= e_badEndMovie && m_currentIntroScript <= e_goodEndMovie) {
FUN_10070e90();
}
InvokeAction(Extra::ActionType::e_opendisk, *g_introScript, m_currentIntroScript, NULL);
}
}
// FUNCTION: LEGO1 0x10070cb0
void Infocenter::StopCutscene()
{
if (m_currentIntroScript != e_noIntro) {
InvokeAction(Extra::ActionType::e_close, *g_introScript, m_currentIntroScript, NULL);
}
VideoManager()->EnableFullScreenMovie(FALSE);
InputManager()->SetUnknown335(FALSE);
SetAppCursor(0); // Restore cursor to arrow
FUN_10015820(0, 7);
}
// FUNCTION: LEGO1 0x10070d00
@@ -50,8 +478,79 @@ MxBool Infocenter::VTable0x5c()
return TRUE;
}
// STUB: LEGO1 0x10070dc0
void Infocenter::FUN_10070dc0(MxBool)
{
}
// STUB: LEGO1 0x10070e90
void Infocenter::FUN_10070e90()
{
}
// STUB: LEGO1 0x10070f60
MxBool Infocenter::VTable0x64()
{
return FALSE;
}
// STUB: LEGO1 0x10071030
void Infocenter::StartCredits()
{
// TODO
}
// FUNCTION: LEGO1 0x10071250
void Infocenter::StopCredits()
{
MxDSAction action;
action.SetObjectId(499);
action.SetAtomId(*g_creditsScript);
action.SetUnknown24(-2);
DeleteObject(action);
}
// FUNCTION: LEGO1 0x10071300
void Infocenter::PlayDialogue(InfomainScript p_objectId)
{
MxDSAction action;
action.SetObjectId(p_objectId);
action.SetAtomId(*g_infomainScript);
StopCurrentDialogue();
m_currentInfomainScript = p_objectId;
BackgroundAudioManager()->LowerVolume();
Start(&action);
}
// FUNCTION: LEGO1 0x100713d0
void Infocenter::StopCurrentDialogue()
{
if (m_currentInfomainScript != c_noInfomain) {
MxDSAction action;
action.SetObjectId(m_currentInfomainScript);
action.SetAtomId(*g_infomainScript);
action.SetUnknown24(-2);
DeleteObject(action);
m_currentInfomainScript = c_noInfomain;
}
}
// FUNCTION: LEGO1 0x100714a0
void Infocenter::PlayBookAnimation()
{
MxDSAction action;
action.SetObjectId(c_bookWig);
action.SetAtomId(*g_sndAnimScript);
Start(&action);
}
// FUNCTION: LEGO1 0x10071550
void Infocenter::StopBookAnimation()
{
MxDSAction action;
action.SetObjectId(c_bookWig);
action.SetAtomId(*g_sndAnimScript);
action.SetUnknown24(-2);
DeleteObject(action);
}

View File

@@ -6,6 +6,7 @@ DECOMP_SIZE_ASSERT(InfocenterState, 0x94);
InfocenterState::InfocenterState()
{
// TODO
memset(m_buffer, 0, sizeof(m_buffer));
}
// STUB: LEGO1 0x10071920

View File

@@ -90,10 +90,10 @@ MxLong Score::Notify(MxParam& p_param)
DeleteScript(); // Shutting down
ret = 1;
break;
case TYPE17:
case c_notificationType17:
ret = FUN_100016d0((MxType17NotificationParam&) p_param);
break;
case MXTRANSITIONMANAGER_TRANSITIONENDED:
case c_notificationTransitioned:
DeleteObjects(g_infoscorScript, 7, 9);
if (m_unk0xf8)
GameState()->HandleAction(m_unk0xf8);
@@ -116,7 +116,7 @@ MxLong Score::FUN_10001510(MxEndActionNotificationParam& p_param)
switch (action->GetObjectId()) {
case 10:
m_unk0xf8 = 0x38;
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 0x32, 0, 0);
break;
case 0x1f5:
PlayMusic(11);
@@ -160,12 +160,12 @@ MxLong Score::FUN_100016d0(MxType17NotificationParam& p_param)
case 1:
m_unk0xf8 = 2;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 0x32, 0, 0);
break;
case 2:
m_unk0xf8 = 3;
DeleteScript();
TransitionManager()->StartTransition(MxTransitionManager::PIXELATION, 0x32, 0, 0);
TransitionManager()->StartTransition(MxTransitionManager::e_pixelation, 0x32, 0, 0);
break;
case 3: {
LegoInputManager* im = InputManager();

View File

@@ -115,10 +115,10 @@ MxLong Isle::Notify(MxParam& p_param)
break;
}
break;
case TYPE17:
case c_notificationType17:
result = HandleType17Notification(p_param);
break;
case TYPE18:
case c_notificationType18:
switch (m_act1state->GetUnknown18()) {
case 4:
result = GetCurrentVehicle()->Notify(p_param);
@@ -131,13 +131,13 @@ MxLong Isle::Notify(MxParam& p_param)
break;
}
break;
case TYPE19:
case c_notificationType19:
result = HandleType19Notification(p_param);
break;
case TYPE20:
case c_notificationType20:
VTable0x68(TRUE);
break;
case MXTRANSITIONMANAGER_TRANSITIONENDED:
case c_notificationTransitioned:
result = HandleTransitionEnd();
break;
}

View File

@@ -212,6 +212,12 @@ void FUN_10015820(MxU32, MxU32)
// TODO
}
// STUB: LEGO1 0x10015860
void FUN_10015860(const char*, MxU8)
{
// TODO
}
// FUNCTION: LEGO1 0x100158c0
LegoEntity* FindEntityByAtomIdOrEntityId(const MxAtomId& p_atom, MxS32 p_entityid)
{
@@ -293,34 +299,34 @@ LegoEntity* PickEntity(MxLong, MxLong)
// FUNCTION: LEGO1 0x100528e0
void RegisterScripts()
{
g_copterScript = new MxAtomId("\\lego\\scripts\\build\\copter", LookupMode_LowerCase2);
g_dunecarScript = new MxAtomId("\\lego\\scripts\\build\\dunecar", LookupMode_LowerCase2);
g_jetskiScript = new MxAtomId("\\lego\\scripts\\build\\jetski", LookupMode_LowerCase2);
g_racecarScript = new MxAtomId("\\lego\\scripts\\build\\racecar", LookupMode_LowerCase2);
g_carraceScript = new MxAtomId("\\lego\\scripts\\race\\carrace", LookupMode_LowerCase2);
g_carracerScript = new MxAtomId("\\lego\\scripts\\race\\carracer", LookupMode_LowerCase2);
g_jetraceScript = new MxAtomId("\\lego\\scripts\\race\\jetrace", LookupMode_LowerCase2);
g_jetracerScript = new MxAtomId("\\lego\\scripts\\race\\jetracer", LookupMode_LowerCase2);
g_isleScript = new MxAtomId("\\lego\\scripts\\isle\\isle", LookupMode_LowerCase2);
g_elevbottScript = new MxAtomId("\\lego\\scripts\\infocntr\\elevbott", LookupMode_LowerCase2);
g_infodoorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infodoor", LookupMode_LowerCase2);
g_infomainScript = new MxAtomId("\\lego\\scripts\\infocntr\\infomain", LookupMode_LowerCase2);
g_infoscorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infoscor", LookupMode_LowerCase2);
g_regbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\regbook", LookupMode_LowerCase2);
g_histbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\histbook", LookupMode_LowerCase2);
g_hospitalScript = new MxAtomId("\\lego\\scripts\\hospital\\hospital", LookupMode_LowerCase2);
g_policeScript = new MxAtomId("\\lego\\scripts\\police\\police", LookupMode_LowerCase2);
g_garageScript = new MxAtomId("\\lego\\scripts\\garage\\garage", LookupMode_LowerCase2);
g_act2mainScript = new MxAtomId("\\lego\\scripts\\act2\\act2main", LookupMode_LowerCase2);
g_act3Script = new MxAtomId("\\lego\\scripts\\act3\\act3", LookupMode_LowerCase2);
g_jukeboxScript = new MxAtomId("\\lego\\scripts\\isle\\jukebox", LookupMode_LowerCase2);
g_pz5Script = new MxAtomId("\\lego\\scripts\\isle\\pz5", LookupMode_LowerCase2);
g_introScript = new MxAtomId("\\lego\\scripts\\intro", LookupMode_LowerCase2);
g_testScript = new MxAtomId("\\lego\\scripts\\test\\test", LookupMode_LowerCase2);
g_jukeboxwScript = new MxAtomId("\\lego\\scripts\\isle\\jukeboxw", LookupMode_LowerCase2);
g_sndAnimScript = new MxAtomId("\\lego\\scripts\\sndanim", LookupMode_LowerCase2);
g_creditsScript = new MxAtomId("\\lego\\scripts\\credits", LookupMode_LowerCase2);
g_nocdSourceName = new MxAtomId("\\lego\\scripts\\nocd", LookupMode_LowerCase2);
g_copterScript = new MxAtomId("\\lego\\scripts\\build\\copter", e_lowerCase2);
g_dunecarScript = new MxAtomId("\\lego\\scripts\\build\\dunecar", e_lowerCase2);
g_jetskiScript = new MxAtomId("\\lego\\scripts\\build\\jetski", e_lowerCase2);
g_racecarScript = new MxAtomId("\\lego\\scripts\\build\\racecar", e_lowerCase2);
g_carraceScript = new MxAtomId("\\lego\\scripts\\race\\carrace", e_lowerCase2);
g_carracerScript = new MxAtomId("\\lego\\scripts\\race\\carracer", e_lowerCase2);
g_jetraceScript = new MxAtomId("\\lego\\scripts\\race\\jetrace", e_lowerCase2);
g_jetracerScript = new MxAtomId("\\lego\\scripts\\race\\jetracer", e_lowerCase2);
g_isleScript = new MxAtomId("\\lego\\scripts\\isle\\isle", e_lowerCase2);
g_elevbottScript = new MxAtomId("\\lego\\scripts\\infocntr\\elevbott", e_lowerCase2);
g_infodoorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infodoor", e_lowerCase2);
g_infomainScript = new MxAtomId("\\lego\\scripts\\infocntr\\infomain", e_lowerCase2);
g_infoscorScript = new MxAtomId("\\lego\\scripts\\infocntr\\infoscor", e_lowerCase2);
g_regbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\regbook", e_lowerCase2);
g_histbookScript = new MxAtomId("\\lego\\scripts\\infocntr\\histbook", e_lowerCase2);
g_hospitalScript = new MxAtomId("\\lego\\scripts\\hospital\\hospital", e_lowerCase2);
g_policeScript = new MxAtomId("\\lego\\scripts\\police\\police", e_lowerCase2);
g_garageScript = new MxAtomId("\\lego\\scripts\\garage\\garage", e_lowerCase2);
g_act2mainScript = new MxAtomId("\\lego\\scripts\\act2\\act2main", e_lowerCase2);
g_act3Script = new MxAtomId("\\lego\\scripts\\act3\\act3", e_lowerCase2);
g_jukeboxScript = new MxAtomId("\\lego\\scripts\\isle\\jukebox", e_lowerCase2);
g_pz5Script = new MxAtomId("\\lego\\scripts\\isle\\pz5", e_lowerCase2);
g_introScript = new MxAtomId("\\lego\\scripts\\intro", e_lowerCase2);
g_testScript = new MxAtomId("\\lego\\scripts\\test\\test", e_lowerCase2);
g_jukeboxwScript = new MxAtomId("\\lego\\scripts\\isle\\jukeboxw", e_lowerCase2);
g_sndAnimScript = new MxAtomId("\\lego\\scripts\\sndanim", e_lowerCase2);
g_creditsScript = new MxAtomId("\\lego\\scripts\\credits", e_lowerCase2);
g_nocdSourceName = new MxAtomId("\\lego\\scripts\\nocd", e_lowerCase2);
}
// FUNCTION: LEGO1 0x100530c0
@@ -633,7 +639,7 @@ MxEntity* LegoOmni::FindWorld(const char* p_id, MxS32 p_entityId, MxPresenter* p
{
LegoWorld* foundEntity = NULL;
if (strcmpi(p_id, g_current)) {
foundEntity = (LegoWorld*) FindByEntityIdOrAtomId(MxAtomId(p_id, LookupMode_LowerCase2), p_entityId);
foundEntity = (LegoWorld*) FindByEntityIdOrAtomId(MxAtomId(p_id, e_lowerCase2), p_entityId);
}
else {
foundEntity = this->m_currentWorld;
@@ -704,7 +710,7 @@ MxLong LegoOmni::Notify(MxParam& p_param)
MxLong result = MxOmni::Notify(p_param);
if (isCD) {
// Exit the game if nocd.si ended
PostMessageA(m_windowHandle, WM_CLOSE, 0, 0);
CloseMainWindow();
}
return result;

View File

@@ -61,7 +61,7 @@ void LegoPathPresenter::Destroy()
void LegoPathPresenter::ReadyTickle()
{
// TODO
ProgressTickleState(TickleState_Starting); // Allow initialization process to continue
ProgressTickleState(e_starting); // Allow initialization process to continue
}
// FUNCTION: LEGO1 0x10044d00
@@ -70,8 +70,8 @@ void LegoPathPresenter::StreamingTickle()
MxStreamChunk* chunk = m_subscriber->NextChunk();
if (chunk) {
if (chunk->GetFlags() & MxStreamChunk::Flag_End) {
ProgressTickleState(TickleState_Repeating);
if (chunk->GetFlags() & MxStreamChunk::c_end) {
ProgressTickleState(e_repeating);
}
m_subscriber->DestroyChunk(chunk);

View File

@@ -114,7 +114,7 @@ void LegoAnimPresenter::ReadyTickle()
m_subscriber->DestroyChunk(chunk);
if (result == SUCCESS) {
ProgressTickleState(TickleState_Starting);
ProgressTickleState(e_starting);
ParseExtra();
}
else {
@@ -128,7 +128,7 @@ void LegoAnimPresenter::ReadyTickle()
void LegoAnimPresenter::StartingTickle()
{
// TODO
ProgressTickleState(TickleState_Streaming);
ProgressTickleState(e_streaming);
EndAction(); // Allow game to start
}
@@ -146,7 +146,7 @@ void LegoAnimPresenter::StreamingTickle()
}
}
else {
ProgressTickleState(TickleState_Done);
ProgressTickleState(e_done);
if (m_compositePresenter) {
if (m_compositePresenter->IsA("LegoAnimMMPresenter")) {
m_compositePresenter->VTable0x60(this);

View File

@@ -41,7 +41,7 @@ LegoMeterPresenter::LegoMeterPresenter()
m_unk0x6c = 0;
m_unk0x84 = 0;
m_type = 1;
m_flags &= ~Flag_Bit2;
m_flags &= ~c_bit2;
}
// FUNCTION: LEGO1 0x10043780

View File

@@ -31,7 +31,7 @@ void LegoModelPresenter::Destroy(MxBool p_fromDestructor)
void LegoModelPresenter::ReadyTickle()
{
// TODO
SetTickleState(TickleState_Starting);
SetTickleState(e_starting);
}
// STUB: LEGO1 0x100801b0

View File

@@ -77,7 +77,7 @@ void LegoPalettePresenter::ReadyTickle()
if (chunk) {
if (chunk->GetTime() <= m_action->GetElapsedTime()) {
ParseExtra();
ProgressTickleState(TickleState_Starting);
ProgressTickleState(e_starting);
chunk = m_subscriber->NextChunk();
MxResult result = ParsePalette(chunk);

View File

@@ -28,7 +28,7 @@ MxResult LegoTexturePresenter::PutData()
void LegoTexturePresenter::DoneTickle()
{
if (this->m_compositePresenter && !this->m_compositePresenter->VTable0x64(2)) {
SetTickleState(TickleState_Idle);
SetTickleState(e_idle);
return;
}

View File

@@ -230,7 +230,7 @@ void LegoVideoManager::MoveCursor(MxS32 p_cursorX, MxS32 p_cursorY)
MxResult LegoVideoManager::Tickle()
{
if (m_unk0x554 && !m_videoParam.Flags().GetFlipSurfaces() &&
TransitionManager()->GetTransitionType() == MxTransitionManager::NOT_TRANSITIONING)
TransitionManager()->GetTransitionType() == MxTransitionManager::e_notTransitioning)
Sleep(30);
m_stopWatch->Stop();
@@ -369,7 +369,7 @@ void LegoVideoManager::EnableFullScreenMovie(MxBool p_enable, MxBool p_scale)
m_fullScreenMovie = TRUE;
}
else {
m_displaySurface->FUN_100ba640();
m_displaySurface->ClearScreen();
m_displaySurface->GetVideoParam().Flags().SetF1bit3(FALSE);
// restore previous pallete
@@ -462,7 +462,7 @@ MxResult LegoVideoManager::ConfigureD3DRM()
MxAssignedDevice* assignedDevice = m_direct3d->GetAssignedDevice();
if (assignedDevice && assignedDevice->GetFlags() & MxAssignedDevice::Flag_HardwareMode) {
if (assignedDevice && assignedDevice->GetFlags() & MxAssignedDevice::c_hardwareMode) {
if (assignedDevice->GetDesc().dpcTriCaps.dwTextureFilterCaps & D3DPTFILTERCAPS_LINEAR)
d3drm->SetTextureQuality(D3DRMTEXTURE_LINEAR);

View File

@@ -17,7 +17,7 @@ RECT g_fullScreenRect = {0, 0, 640, 480};
MxTransitionManager::MxTransitionManager()
{
m_animationTimer = 0;
m_transitionType = NOT_TRANSITIONING;
m_transitionType = e_notTransitioning;
m_ddSurface = NULL;
m_waitIndicator = NULL;
m_copyBuffer = NULL;
@@ -57,22 +57,22 @@ MxResult MxTransitionManager::Tickle()
this->m_systemTime = timeGetTime();
switch (this->m_transitionType) {
case NO_ANIMATION:
case e_noAnimation:
TransitionNone();
break;
case DISSOLVE:
case e_dissolve:
TransitionDissolve();
break;
case PIXELATION:
case e_pixelation:
TransitionPixelation();
break;
case SCREEN_WIPE:
case e_screenWipe:
TransitionWipe();
break;
case WINDOWS:
case e_windows:
TransitionWindows();
break;
case BROKEN:
case e_broken:
TransitionBroken();
break;
}
@@ -87,7 +87,7 @@ MxResult MxTransitionManager::StartTransition(
MxBool p_playMusicInAnim
)
{
if (this->m_transitionType == NOT_TRANSITIONING) {
if (this->m_transitionType == e_notTransitioning) {
if (!p_playMusicInAnim) {
MxBackgroundAudioManager* backgroundAudioManager = BackgroundAudioManager();
backgroundAudioManager->Stop();
@@ -102,7 +102,7 @@ MxResult MxTransitionManager::StartTransition(
MxDSAction* action = m_waitIndicator->GetAction();
action->SetLoopCount(10000);
action->SetFlags(action->GetFlags() | MxDSAction::Flag_Bit10);
action->SetFlags(action->GetFlags() | MxDSAction::c_bit10);
}
MxU32 time = timeGetTime();
@@ -129,8 +129,8 @@ MxResult MxTransitionManager::StartTransition(
// FUNCTION: LEGO1 0x1004bc30
void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
{
if (m_transitionType != NOT_TRANSITIONING) {
m_transitionType = NOT_TRANSITIONING;
if (m_transitionType != e_notTransitioning) {
m_transitionType = e_notTransitioning;
m_copyFlags.m_bit0 = FALSE;
@@ -142,11 +142,11 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
if (world) {
#ifdef COMPAT_MODE
{
MxNotificationParam param(MXTRANSITIONMANAGER_TRANSITIONENDED, this);
MxNotificationParam param(c_notificationTransitioned, this);
world->Notify(param);
}
#else
world->Notify(MxNotificationParam(MXTRANSITIONMANAGER_TRANSITIONENDED, this));
world->Notify(MxNotificationParam(c_notificationTransitioned, this));
#endif
}
}
@@ -157,7 +157,7 @@ void MxTransitionManager::EndTransition(MxBool p_notifyWorld)
void MxTransitionManager::TransitionNone()
{
LegoVideoManager* videoManager = VideoManager();
videoManager->GetDisplaySurface()->FUN_100ba640();
videoManager->GetDisplaySurface()->ClearScreen();
EndTransition(TRUE);
}
@@ -475,7 +475,7 @@ void MxTransitionManager::SetWaitIndicator(MxVideoPresenter* p_waitIndicator)
{
// End current wait indicator
if (m_waitIndicator != NULL) {
m_waitIndicator->GetAction()->SetFlags(m_waitIndicator->GetAction()->GetFlags() & ~MxDSAction::Flag_World);
m_waitIndicator->GetAction()->SetFlags(m_waitIndicator->GetAction()->GetFlags() & ~MxDSAction::c_world);
m_waitIndicator->EndAction();
m_waitIndicator = NULL;
}
@@ -488,7 +488,7 @@ void MxTransitionManager::SetWaitIndicator(MxVideoPresenter* p_waitIndicator)
LegoVideoManager* videoManager = VideoManager();
videoManager->UnregisterPresenter(*m_waitIndicator);
if (m_waitIndicator->GetCurrentTickleState() < MxPresenter::TickleState_Streaming) {
if (m_waitIndicator->GetCurrentTickleState() < MxPresenter::e_streaming) {
m_waitIndicator->Tickle();
}
}
@@ -542,7 +542,7 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC p_ddsc)
m_waitIndicator->Tickle();
// Check if wait indicator has started
if (m_waitIndicator->GetCurrentTickleState() >= MxPresenter::TickleState_Streaming) {
if (m_waitIndicator->GetCurrentTickleState() >= MxPresenter::e_streaming) {
// Setup the copy rect
MxU32 copyPitch = (p_ddsc->ddpfPixelFormat.dwRGBBitCount / 8) *
(m_copyRect.right - m_copyRect.left + 1); // This uses m_copyRect, seemingly erroneously
@@ -576,7 +576,7 @@ void MxTransitionManager::SetupCopyRect(LPDDSURFACEDESC p_ddsc)
}
// Setup display surface
if ((m_waitIndicator->GetAction()->GetFlags() & MxDSAction::Flag_Bit5) != 0) {
if ((m_waitIndicator->GetAction()->GetFlags() & MxDSAction::c_bit5) != 0) {
MxDisplaySurface* displaySurface = VideoManager()->GetDisplaySurface();
MxBool und = FALSE;
displaySurface->VTable0x2c(