match Isle::Tick and FindExistingInstance

This commit is contained in:
Christian Semmler 2023-06-21 14:42:30 +02:00
parent 2644be3ca6
commit 2d577b556c
No known key found for this signature in database
GPG Key ID: 086DAA1360BEEE5C
6 changed files with 19 additions and 28 deletions

View File

@ -38,6 +38,3 @@ int g_startupDelay = 200;
// 0x4101c0
long g_lastFrameTime = 0;
// 0x4101dc
const char *WINDOW_TITLE = "LEGO\xAE";

View File

@ -8,7 +8,7 @@ class Isle;
extern Isle *g_isle;
extern int g_closed;
#define WNDCLASS_NAME "Lego Island MainNoM App"
extern const char *WINDOW_TITLE;
#define WINDOW_TITLE "LEGO\xAE"
extern unsigned char g_mousedown;
extern unsigned char g_mousemoved;
extern RECT g_windowRect;

View File

@ -78,7 +78,7 @@ Isle::~Isle()
void Isle::Close()
{
MxDSAction ds;
ds.SetUnknown24(0xFFFE);
ds.SetUnknown24(-2);
if (Lego()) {
GameState()->Save(0);
@ -615,7 +615,7 @@ void Isle::Tick(BOOL sleepIfNotNextFrame)
}
ds.SetAtomId(stream->atom);
ds.SetUnknown24(0xFFFF);
ds.SetUnknown24(-1);
ds.SetUnknown1c(0);
VideoManager()->EnableFullScreenMovie(TRUE, TRUE);
@ -624,7 +624,7 @@ void Isle::Tick(BOOL sleepIfNotNextFrame)
}
} else {
ds.SetAtomId(stream->atom);
ds.SetUnknown24(0xFFFF);
ds.SetUnknown24(-1);
ds.SetUnknown1c(0);
if (Start(&ds) != SUCCESS) {
return;

View File

@ -1,7 +1,8 @@
#include "mxdsobject.h"
// This function exists both inlined and @ ISLE 0x00401c40
// OFFSET: ISLE 0x00401c40
void MxDSObject::SetAtomId(MxAtomId p_atomId)
{
this->m_atomId = p_atomId;
}
// void MxDSObject::SetAtomId(MxAtomId p_atomId)
// {
// this->m_atomId = p_atomId;
// }

View File

@ -6,14 +6,11 @@
// OFFSET: LEGO1 0x100bf6a0
MxDSObject::MxDSObject()
{
// The following code yields 100% matching assembly if m_unk24 is declared as (signed) short.
// However, in other areas m_unk24 (notably, ISLE.EXE) is treated as unsigned short.
// Since we don't have a proper solution yet, we are using a union to work around this discrepancy.
this->m_unk0c = 0;
this->m_unk10 = 0;
this->m_unk14 = 0;
this->m_name = NULL;
this->m_unk24signed = -1;
this->m_unk24 = -1;
this->m_unk1c = -1;
this->m_unk28 = 0;
}
@ -38,8 +35,9 @@ void MxDSObject::SetObjectName(const char *p_name)
}
}
// This function exists both inlined and @ LEGO1 0x10005530
// OFFSET: LEGO1 0x10005530
void MxDSObject::SetAtomId(MxAtomId p_atomId)
{
this->m_atomId = p_atomId;
}
// void MxDSObject::SetAtomId(MxAtomId p_atomId)
// {
// this->m_atomId = p_atomId;
// }

View File

@ -15,9 +15,10 @@ class MxDSObject : public MxCore
inline int GetUnknown1c() { return this->m_unk1c; }
inline void SetUnknown1c(int p_unk1c) { this->m_unk1c = p_unk1c; }
inline void SetUnknown24(unsigned short p_unk24) { this->m_unk24 = p_unk24; }
inline void SetUnknown24(short p_unk24) { this->m_unk24 = p_unk24; }
void SetAtomId(MxAtomId p_atomId);
// void SetAtomId(MxAtomId p_atomId);
inline void SetAtomId(MxAtomId p_atomId) { this->m_atomId = p_atomId; }
private:
int m_unk08;
@ -27,13 +28,7 @@ class MxDSObject : public MxCore
char *m_name;
int m_unk1c;
MxAtomId m_atomId;
// So far, implementing MxDSObject::MxDSObject correctly required that m_unk24 is declared a (signed) short.
// Most of the other game's code appears to treat it as unsigned short, however.
// This union is a workaround until we have figured this out.
union {
unsigned short m_unk24;
short m_unk24signed;
};
short m_unk24;
unsigned short m_unk26;
int m_unk28;
};