More fixes

This commit is contained in:
Christian Semmler 2023-12-12 11:06:39 -05:00
parent aed1d26f81
commit 34b3d92696
18 changed files with 103 additions and 103 deletions

View File

@ -313,16 +313,16 @@ BOOL MxDirectDraw::IsSupportedMode(int width, int height, int bpp)
// FUNCTION: LEGO1 0x1009da20
void EnableResizing(HWND p_hwnd, BOOL p_flag)
{
static DWORD s_dwStyle;
static DWORD g_dwStyle;
if (!p_flag) {
s_dwStyle = GetWindowLong(p_hwnd, GWL_STYLE);
if (s_dwStyle & WS_THICKFRAME) {
g_dwStyle = GetWindowLong(p_hwnd, GWL_STYLE);
if (g_dwStyle & WS_THICKFRAME) {
SetWindowLong(p_hwnd, GWL_STYLE, GetWindowLong(p_hwnd, GWL_STYLE) ^ WS_THICKFRAME);
}
}
else {
SetWindowLong(p_hwnd, GWL_STYLE, s_dwStyle);
SetWindowLong(p_hwnd, GWL_STYLE, g_dwStyle);
}
}

View File

@ -185,8 +185,8 @@ inline void MxHashTable<T>::Resize()
break;
}
MxHashTableNode<T>** new_table = new MxHashTableNode<T>*[m_numSlots];
m_slots = new_table;
MxHashTableNode<T>** newTable = new MxHashTableNode<T>*[m_numSlots];
m_slots = newTable;
memset(m_slots, 0, sizeof(MxHashTableNode<T>*) * m_numSlots);
this->m_count = 0;

View File

@ -70,7 +70,7 @@ class MxList : protected MxCollection<T> {
MxListEntry<T>* m_first; // 0x10
MxListEntry<T>* m_last; // 0x14
void DeleteEntry(MxListEntry<T>* match);
void DeleteEntry(MxListEntry<T>*);
MxListEntry<T>* InsertEntry(T, MxListEntry<T>*, MxListEntry<T>*);
};

View File

@ -29,14 +29,14 @@ void MxMusicManager::Init()
// FUNCTION: LEGO1 0x100c06a0
void MxMusicManager::InitData()
{
m_MIDIStreamH = 0;
m_MIDIInitialized = FALSE;
m_midiStreamH = 0;
m_midiInitialized = FALSE;
m_unk0x38 = 0;
m_unk0x3c = 0;
m_unk0x40 = 0;
m_unk0x44 = 0;
m_unk0x48 = 0;
m_MIDIHdrP = NULL;
m_midiHdrP = NULL;
}
// FUNCTION: LEGO1 0x100c06c0
@ -66,7 +66,7 @@ void MxMusicManager::Destroy(MxBool p_fromDestructor)
void MxMusicManager::SetMIDIVolume()
{
MxS32 result = (m_volume * m_multiplier) / 0x64;
HMIDISTRM streamHandle = m_MIDIStreamH;
HMIDISTRM streamHandle = m_midiStreamH;
if (streamHandle) {
MxS32 volume = CalculateVolume(result);
@ -148,13 +148,13 @@ void MxMusicManager::DeinitializeMIDI()
{
m_criticalSection.Enter();
if (m_MIDIInitialized) {
m_MIDIInitialized = FALSE;
midiStreamStop(m_MIDIStreamH);
midiOutUnprepareHeader((HMIDIOUT) m_MIDIStreamH, m_MIDIHdrP, sizeof(MIDIHDR));
midiOutSetVolume((HMIDIOUT) m_MIDIStreamH, m_MIDIVolume);
midiStreamClose(m_MIDIStreamH);
delete m_MIDIHdrP;
if (m_midiInitialized) {
m_midiInitialized = FALSE;
midiStreamStop(m_midiStreamH);
midiOutUnprepareHeader((HMIDIOUT) m_midiStreamH, m_midiHdrP, sizeof(MIDIHDR));
midiOutSetVolume((HMIDIOUT) m_midiStreamH, m_midiVolume);
midiStreamClose(m_midiStreamH);
delete m_midiHdrP;
InitData();
}

View File

@ -15,7 +15,7 @@ class MxMusicManager : public MxAudioManager {
virtual void SetVolume(MxS32 p_volume) override; // vtable+2c
virtual MxResult Create(MxU32 p_frequencyMS, MxBool p_createThread); // vtable+30
inline MxBool GetMIDIInitialized() { return m_MIDIInitialized; }
inline MxBool GetMIDIInitialized() { return m_midiInitialized; }
void DeinitializeMIDI();
undefined4 FUN_100c09c0(MxU8* p_data, MxS32 p_loopCount);
@ -27,16 +27,16 @@ class MxMusicManager : public MxAudioManager {
MxS32 CalculateVolume(MxS32 p_volume);
void SetMIDIVolume();
HMIDISTRM m_MIDIStreamH; // 0x30
MxBool m_MIDIInitialized; // 0x34
HMIDISTRM m_midiStreamH; // 0x30
MxBool m_midiInitialized; // 0x34
undefined4 m_unk0x38; // 0x38
undefined4 m_unk0x3c; // 0x3c
undefined4 m_unk0x40; // 0x40
undefined4 m_unk0x44; // 0x44
undefined4 m_unk0x48; // 0x48
MIDIHDR* m_MIDIHdrP; // 0x4c
MIDIHDR* m_midiHdrP; // 0x4c
MxS32 m_multiplier; // 0x50
DWORD m_MIDIVolume; // 0x54
DWORD m_midiVolume; // 0x54
protected:
void Init();

View File

@ -33,8 +33,8 @@ void DeleteObjects(MxAtomId* p_id, MxS32 p_first, MxS32 p_last)
action.SetAtomId(*p_id);
action.SetUnknown24(-2);
for (MxS32 l_first = p_first, l_last = p_last; l_first <= l_last; l_first++) {
action.SetObjectId(l_first);
for (MxS32 first = p_first, last = p_last; first <= last; first++) {
action.SetObjectId(first);
DeleteObject(action);
}
}
@ -159,43 +159,43 @@ void MxOmni::Init()
}
// FUNCTION: LEGO1 0x100af0b0
void MxOmni::SetInstance(MxOmni* instance)
void MxOmni::SetInstance(MxOmni* p_instance)
{
g_instance = instance;
g_instance = p_instance;
}
// FUNCTION: LEGO1 0x100af0c0
MxResult MxOmni::Create(MxOmniCreateParam& p)
MxResult MxOmni::Create(MxOmniCreateParam& p_param)
{
MxResult result = FAILURE;
if (!(m_atomIdCounterSet = new MxAtomIdCounterSet()))
goto done;
m_mediaPath = p.GetMediaPath();
m_windowHandle = p.GetWindowHandle();
m_mediaPath = p_param.GetMediaPath();
m_windowHandle = p_param.GetWindowHandle();
if (p.CreateFlags().CreateObjectFactory()) {
if (p_param.CreateFlags().CreateObjectFactory()) {
if (!(m_objectFactory = new MxObjectFactory()))
goto done;
}
if (p.CreateFlags().CreateVariableTable()) {
if (p_param.CreateFlags().CreateVariableTable()) {
if (!(m_variableTable = new MxVariableTable()))
goto done;
}
if (p.CreateFlags().CreateTimer()) {
if (p_param.CreateFlags().CreateTimer()) {
if (!(m_timer = new MxTimer()))
goto done;
}
if (p.CreateFlags().CreateTickleManager()) {
if (p_param.CreateFlags().CreateTickleManager()) {
if (!(m_tickleManager = new MxTickleManager()))
goto done;
}
if (p.CreateFlags().CreateNotificationManager()) {
if (p_param.CreateFlags().CreateNotificationManager()) {
if (m_notificationManager = new MxNotificationManager()) {
if (m_notificationManager->Create(100, 0) != SUCCESS)
goto done;
@ -204,21 +204,21 @@ MxResult MxOmni::Create(MxOmniCreateParam& p)
goto done;
}
if (p.CreateFlags().CreateStreamer()) {
if (p_param.CreateFlags().CreateStreamer()) {
if (!(m_streamer = new MxStreamer()) || m_streamer->Create() != SUCCESS)
goto done;
}
if (p.CreateFlags().CreateVideoManager()) {
if (p_param.CreateFlags().CreateVideoManager()) {
if (m_videoManager = new MxVideoManager()) {
if (m_videoManager->Create(p.GetVideoParam(), 100, 0) != SUCCESS) {
if (m_videoManager->Create(p_param.GetVideoParam(), 100, 0) != SUCCESS) {
delete m_videoManager;
m_videoManager = NULL;
}
}
}
if (p.CreateFlags().CreateSoundManager()) {
if (p_param.CreateFlags().CreateSoundManager()) {
if (m_soundManager = new MxSoundManager()) {
if (m_soundManager->Create(10, 0) != SUCCESS) {
delete m_soundManager;
@ -227,7 +227,7 @@ MxResult MxOmni::Create(MxOmniCreateParam& p)
}
}
if (p.CreateFlags().CreateMusicManager()) {
if (p_param.CreateFlags().CreateMusicManager()) {
if (m_musicManager = new MxMusicManager()) {
if (m_musicManager->Create(50, 0) != SUCCESS) {
delete m_musicManager;
@ -236,7 +236,7 @@ MxResult MxOmni::Create(MxOmniCreateParam& p)
}
}
if (p.CreateFlags().CreateEventManager()) {
if (p_param.CreateFlags().CreateEventManager()) {
if (m_eventManager = new MxEventManager()) {
if (m_eventManager->Create(50, 0) != SUCCESS) {
delete m_eventManager;

View File

@ -41,7 +41,7 @@ class MxOmni : public MxCore {
virtual MxLong Notify(MxParam& p_param) override; // vtable+04
virtual void Init(); // vtable+14
virtual MxResult Create(MxOmniCreateParam& p); // vtable+18
virtual MxResult Create(MxOmniCreateParam& p_param); // vtable+18
virtual void Destroy(); // vtable+1c
virtual MxResult Start(MxDSAction* p_dsAction); // vtable+20
virtual MxResult DeleteObject(MxDSAction& p_dsAction); // vtable+24
@ -52,7 +52,7 @@ class MxOmni : public MxCore {
virtual void StartTimer(); // vtable+38
virtual void StopTimer(); // vtable+3c
virtual MxBool IsTimerRunning(); // vtable+40
static void SetInstance(MxOmni* instance);
static void SetInstance(MxOmni* p_instance);
HWND GetWindowHandle() const { return this->m_windowHandle; }
MxObjectFactory* GetObjectFactory() const { return this->m_objectFactory; }
MxNotificationManager* GetNotificationManager() const { return this->m_notificationManager; }

View File

@ -35,60 +35,60 @@ class MxOmniCreateFlags {
inline const MxBool CreateTimer() const { return this->m_flags2 & Flag_CreateTimer; }
inline const MxBool CreateStreamer() const { return this->m_flags2 & Flag_CreateStreamer; }
inline void CreateObjectFactory(MxBool b)
inline void CreateObjectFactory(MxBool p_enable)
{
this->m_flags1 =
(b == TRUE ? this->m_flags1 | Flag_CreateObjectFactory : this->m_flags1 & ~Flag_CreateObjectFactory);
(p_enable ? this->m_flags1 | Flag_CreateObjectFactory : this->m_flags1 & ~Flag_CreateObjectFactory);
}
inline void CreateVariableTable(MxBool b)
inline void CreateVariableTable(MxBool p_enable)
{
this->m_flags1 =
(b == TRUE ? this->m_flags1 | Flag_CreateVariableTable : this->m_flags1 & ~Flag_CreateVariableTable);
(p_enable ? this->m_flags1 | Flag_CreateVariableTable : this->m_flags1 & ~Flag_CreateVariableTable);
}
inline void CreateTickleManager(MxBool b)
inline void CreateTickleManager(MxBool p_enable)
{
this->m_flags1 =
(b == TRUE ? this->m_flags1 | Flag_CreateTickleManager : this->m_flags1 & ~Flag_CreateTickleManager);
(p_enable ? this->m_flags1 | Flag_CreateTickleManager : this->m_flags1 & ~Flag_CreateTickleManager);
}
inline void CreateNotificationManager(MxBool b)
inline void CreateNotificationManager(MxBool p_enable)
{
this->m_flags1 =
(b == TRUE ? this->m_flags1 | Flag_CreateNotificationManager
: this->m_flags1 & ~Flag_CreateNotificationManager);
(p_enable ? this->m_flags1 | Flag_CreateNotificationManager
: this->m_flags1 & ~Flag_CreateNotificationManager);
}
inline void CreateVideoManager(MxBool b)
inline void CreateVideoManager(MxBool p_enable)
{
this->m_flags1 =
(b == TRUE ? this->m_flags1 | Flag_CreateVideoManager : this->m_flags1 & ~Flag_CreateVideoManager);
(p_enable ? this->m_flags1 | Flag_CreateVideoManager : this->m_flags1 & ~Flag_CreateVideoManager);
}
inline void CreateSoundManager(MxBool b)
inline void CreateSoundManager(MxBool p_enable)
{
this->m_flags1 =
(b == TRUE ? this->m_flags1 | Flag_CreateSoundManager : this->m_flags1 & ~Flag_CreateSoundManager);
(p_enable ? this->m_flags1 | Flag_CreateSoundManager : this->m_flags1 & ~Flag_CreateSoundManager);
}
inline void CreateMusicManager(MxBool b)
inline void CreateMusicManager(MxBool p_enable)
{
this->m_flags1 =
(b == TRUE ? this->m_flags1 | Flag_CreateMusicManager : this->m_flags1 & ~Flag_CreateMusicManager);
(p_enable ? this->m_flags1 | Flag_CreateMusicManager : this->m_flags1 & ~Flag_CreateMusicManager);
}
inline void CreateEventManager(MxBool b)
inline void CreateEventManager(MxBool p_enable)
{
this->m_flags1 =
(b == TRUE ? this->m_flags1 | Flag_CreateEventManager : this->m_flags1 & ~Flag_CreateEventManager);
(p_enable ? this->m_flags1 | Flag_CreateEventManager : this->m_flags1 & ~Flag_CreateEventManager);
}
inline void CreateTimer(MxBool b)
inline void CreateTimer(MxBool p_enable)
{
this->m_flags2 = (b == TRUE ? this->m_flags2 | Flag_CreateTimer : this->m_flags2 & ~Flag_CreateTimer);
this->m_flags2 = (p_enable ? this->m_flags2 | Flag_CreateTimer : this->m_flags2 & ~Flag_CreateTimer);
}
inline void CreateStreamer(MxBool b)
inline void CreateStreamer(MxBool p_enable)
{
this->m_flags2 = (b == TRUE ? this->m_flags2 | Flag_CreateStreamer : this->m_flags2 & ~Flag_CreateStreamer);
this->m_flags2 = (p_enable ? this->m_flags2 | Flag_CreateStreamer : this->m_flags2 & ~Flag_CreateStreamer);
}
private:
unsigned char m_flags1;
unsigned char m_flags2;
MxU8 m_flags1;
MxU8 m_flags2;
};
#endif // MXOMNICREATEFLAGS_H

View File

@ -2,14 +2,14 @@
// FUNCTION: LEGO1 0x100b0b00
MxOmniCreateParam::MxOmniCreateParam(
const char* mediaPath,
struct HWND__* windowHandle,
MxVideoParam& vparam,
MxOmniCreateFlags flags
const char* p_mediaPath,
struct HWND__* p_windowHandle,
MxVideoParam& p_vparam,
MxOmniCreateFlags p_flags
)
{
this->m_mediaPath = mediaPath;
this->m_windowHandle = (HWND) windowHandle;
this->m_videoParam = vparam;
this->m_createFlags = flags;
this->m_mediaPath = p_mediaPath;
this->m_windowHandle = (HWND) p_windowHandle;
this->m_videoParam = p_vparam;
this->m_createFlags = p_flags;
}

View File

@ -11,10 +11,10 @@
class MxOmniCreateParam : public MxParam {
public:
__declspec(dllexport) MxOmniCreateParam(
const char* mediaPath,
struct HWND__* windowHandle,
MxVideoParam& vparam,
MxOmniCreateFlags flags
const char* p_mediaPath,
struct HWND__* p_windowHandle,
MxVideoParam& p_vparam,
MxOmniCreateFlags p_flags
);
MxOmniCreateFlags& CreateFlags() { return this->m_createFlags; }

View File

@ -198,13 +198,13 @@ MxResult MxPalette::SetEntries(LPPALETTEENTRY p_entries)
}
// FUNCTION: LEGO1 0x100bf2d0
MxResult MxPalette::SetSkyColor(LPPALETTEENTRY p_sky_color)
MxResult MxPalette::SetSkyColor(LPPALETTEENTRY p_skyColor)
{
MxResult status = 0;
if (this->m_palette != NULL) {
this->m_entries[141].peRed = p_sky_color->peRed;
this->m_entries[141].peGreen = p_sky_color->peGreen;
this->m_entries[141].peBlue = p_sky_color->peBlue;
this->m_entries[141].peRed = p_skyColor->peRed;
this->m_entries[141].peGreen = p_skyColor->peGreen;
this->m_entries[141].peBlue = p_skyColor->peBlue;
this->m_skyColor = this->m_entries[141];
if (this->m_palette->SetEntries(0, 141, 1, &this->m_skyColor)) {
status = -1;
@ -220,14 +220,14 @@ void MxPalette::Detach()
}
// FUNCTION: LEGO1 0x100bf340
MxBool MxPalette::operator==(MxPalette& other)
MxBool MxPalette::operator==(MxPalette& p_other)
{
for (MxS32 i = 0; i < 256; i++) {
if (this->m_entries[i].peRed != other.m_entries[i].peRed)
if (this->m_entries[i].peRed != p_other.m_entries[i].peRed)
return FALSE;
if (this->m_entries[i].peGreen != other.m_entries[i].peGreen)
if (this->m_entries[i].peGreen != p_other.m_entries[i].peGreen)
return FALSE;
if (this->m_entries[i].peBlue != other.m_entries[i].peBlue)
if (this->m_entries[i].peBlue != p_other.m_entries[i].peBlue)
return FALSE;
}
return TRUE;

View File

@ -10,7 +10,7 @@
// SIZE 0x414
class MxPalette : public MxCore {
public:
__declspec(dllexport) MxBool operator==(MxPalette&);
__declspec(dllexport) MxBool operator==(MxPalette& p_other);
__declspec(dllexport) void Detach();
MxPalette();
@ -22,7 +22,7 @@ class MxPalette : public MxCore {
void GetDefaultPalette(LPPALETTEENTRY p_entries);
MxResult GetEntries(LPPALETTEENTRY p_entries);
MxResult SetEntries(LPPALETTEENTRY p_palette);
MxResult SetSkyColor(LPPALETTEENTRY p_sky_color);
MxResult SetSkyColor(LPPALETTEENTRY p_skyColor);
void Reset(MxBool p_ignoreSkyColor);
LPDIRECTDRAWPALETTE CreateNativePalette();
inline void SetOverrideSkyColor(MxBool p_value) { this->m_overrideSkyColor = p_value; }

View File

@ -169,15 +169,15 @@ void MxPresenter::ParseExtra()
memcpy(extraCopy, extraData, len);
extraCopy[len] = '\0';
char t_worldValue[512];
if (KeyValueStringParse(t_worldValue, g_strWORLD, extraCopy)) {
char* token = strtok(t_worldValue, g_parseExtraTokens);
char t_token[256];
strcpy(t_token, token);
char worldValue[512];
if (KeyValueStringParse(worldValue, g_strWORLD, extraCopy)) {
char* token = strtok(worldValue, g_parseExtraTokens);
char buf[256];
strcpy(buf, token);
token = strtok(NULL, g_parseExtraTokens);
MxS32 val = token ? atoi(token) : 0;
MxEntity* result = MxOmni::GetInstance()->FindWorld(t_token, val, this);
MxEntity* result = MxOmni::GetInstance()->FindWorld(buf, val, this);
m_action->SetFlags(m_action->GetFlags() | MxDSAction::Flag_World);

View File

@ -13,13 +13,13 @@ class MxQueue : public MxList<T> {
MxBool Dequeue(T& p_obj)
{
MxBool has_next = (m_first != NULL);
MxBool hasNext = (m_first != NULL);
if (m_first) {
p_obj = m_first->GetValue();
DeleteEntry(m_first);
}
return has_next;
return hasNext;
}
};

View File

@ -75,8 +75,8 @@ class MxRect32 {
inline void SetBottom(MxS32 p_bottom) { m_bottom = p_bottom; }
private:
inline static MxS32 Min(MxS32 a, MxS32 b) { return a <= b ? a : b; };
inline static MxS32 Max(MxS32 a, MxS32 b) { return a <= b ? b : a; };
inline static MxS32 Min(MxS32 p_a, MxS32 p_b) { return p_a <= p_b ? p_a : p_b; };
inline static MxS32 Max(MxS32 p_a, MxS32 p_b) { return p_a <= p_b ? p_b : p_a; };
MxS32 m_left;
MxS32 m_top;

View File

@ -9,7 +9,7 @@
// SIZE 0x0c
struct MxRegionTopBottom {
MxRegionTopBottom(MxRect32& p_rect);
MxRegionTopBottom(MxS32 m_top, MxS32 m_bottom);
MxRegionTopBottom(MxS32 p_top, MxS32 p_bottom);
MxRegionTopBottom* Clone();
void FUN_100c5280(MxS32 p_left, MxS32 p_right);

View File

@ -171,11 +171,11 @@ MxPresenter* MxSoundManager::FUN_100aebd0(const MxAtomId& p_atomId, MxU32 p_obje
}
// FUNCTION: LEGO1 0x100aecf0
MxS32 MxSoundManager::FUN_100aecf0(MxU32 p_unk)
MxS32 MxSoundManager::FUN_100aecf0(MxU32 p_undefined)
{
if (!p_unk)
if (!p_undefined)
return -10000;
return g_mxcoreCount[p_unk];
return g_mxcoreCount[p_undefined];
}
// FUNCTION: LEGO1 0x100aed10

View File

@ -22,7 +22,7 @@ class MxSoundManager : public MxAudioManager {
inline LPDIRECTSOUND GetDirectSound() { return m_directSound; }
MxS32 FUN_100aecf0(MxU32 p_unk);
MxS32 FUN_100aecf0(MxU32 p_undefined);
private:
void Init();