diff --git a/ISLE/isle.cpp b/ISLE/isle.cpp index 3517cb78..5e9e1ec4 100644 --- a/ISLE/isle.cpp +++ b/ISLE/isle.cpp @@ -84,6 +84,7 @@ Isle::~Isle() void Isle::Close() { MxDSAction ds; + ds.SetUnknown24(0xFFFE); if (Lego()) { GameState()->Save(0); @@ -93,8 +94,7 @@ void Isle::Close() VideoManager()->Get3DManager()->GetLego3DView()->GetViewManager()->RemoveAll(NULL); - long local_88 = 0; - Lego()->RemoveWorld(ds.m_atomId, local_88); + Lego()->RemoveWorld(ds.GetAtomId(), ds.GetUnknown1c()); Lego()->vtable24(ds); TransitionManager()->SetWaitIndicator(NULL); Lego()->vtable3c(); @@ -608,18 +608,18 @@ void Isle::Tick(BOOL sleepIfNotNextFrame) return; } - ds.setAtomId(stream->atom); - ds.m_unk24 = 0xFFFF; - ds.m_unk1c = 0; + ds.SetAtomId(stream->atom); + ds.SetUnknown24(0xFFFF); + ds.SetUnknown1c(0); VideoManager()->EnableFullScreenMovie(TRUE, TRUE); if (Start(&ds) != SUCCESS) { return; } } else { - ds.setAtomId(stream->atom); - ds.m_unk24 = 0xFFFF; - ds.m_unk1c = 0; + ds.SetAtomId(stream->atom); + ds.SetUnknown24(0xFFFF); + ds.SetUnknown1c(0); if (Start(&ds) != SUCCESS) { return; } diff --git a/ISLE/mx.cpp b/ISLE/mx.cpp new file mode 100644 index 00000000..c0417e5a --- /dev/null +++ b/ISLE/mx.cpp @@ -0,0 +1,7 @@ +#include "mxdsobject.h" + +// OFFSET: ISLE 0x00401c40 +void MxDSObject::SetAtomId(MxAtomId p_atomId) +{ + this->m_atomId = p_atomId; +} \ No newline at end of file diff --git a/LEGO1/lego3dmanager.h b/LEGO1/lego3dmanager.h old mode 100755 new mode 100644 diff --git a/LEGO1/lego3dview.h b/LEGO1/lego3dview.h old mode 100755 new mode 100644 diff --git a/LEGO1/mxatomid.cpp b/LEGO1/mxatomid.cpp new file mode 100644 index 00000000..f2171360 --- /dev/null +++ b/LEGO1/mxatomid.cpp @@ -0,0 +1,14 @@ +#include "mxatomid.h" + +// OFFSET: LEGO1 0x100acfd0 +MxAtomId::~MxAtomId() +{ + // TODO +} + +// OFFSET: LEGO1 0x100ad1c0 +MxAtomId &MxAtomId::operator=(const MxAtomId &id) +{ + // TODO + return *this; +} \ No newline at end of file diff --git a/LEGO1/mxatomid.h b/LEGO1/mxatomid.h index 537b097e..b28704c0 100644 --- a/LEGO1/mxatomid.h +++ b/LEGO1/mxatomid.h @@ -12,8 +12,13 @@ class MxAtomId __declspec(dllexport) MxAtomId &operator=(const MxAtomId &id); __declspec(dllexport) ~MxAtomId(); - char *m_internal; + MxAtomId() + { + this->m_internal = 0; + }; +private: + char *m_internal; }; #endif // MXATOMID_H diff --git a/LEGO1/mxdsaction.h b/LEGO1/mxdsaction.h index aa5a7e4b..558cd035 100644 --- a/LEGO1/mxdsaction.h +++ b/LEGO1/mxdsaction.h @@ -1,25 +1,14 @@ #ifndef MXDSACTION_H #define MXDSACTION_H -#include "mxatomid.h" +#include "mxdsobject.h" -class MxDSAction +class MxDSAction : public MxDSObject { public: __declspec(dllexport) MxDSAction(); __declspec(dllexport) virtual ~MxDSAction(); - int m_unk04; - int m_unk08; - int m_unk0c; - int m_unk10; - int m_unk14; - int m_unk18; - int m_unk1c; - MxAtomId m_atomId; - unsigned short m_unk24; - unsigned short m_unk26; - int m_unk28; int m_unk2c; int m_unk30; int m_unk34; @@ -46,12 +35,6 @@ class MxDSAction int m_unk88; int m_unk8c; int m_unk90; - - void setAtomId(MxAtomId &atomId) - { - this->m_atomId = atomId; - } - }; #endif // MXDSACTION_H diff --git a/LEGO1/mxdsobject.cpp b/LEGO1/mxdsobject.cpp new file mode 100644 index 00000000..5e7d7103 --- /dev/null +++ b/LEGO1/mxdsobject.cpp @@ -0,0 +1,45 @@ +#include "mxdsobject.h" + +#include +#include + +// 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_unk1c = -1; + this->m_unk28 = 0; +} + +// OFFSET: LEGO1 0x100bf8e0 +void MxDSObject::SetObjectName(const char *p_name) +{ + if (p_name != this->m_name) + { + free(this->m_name); + + if (p_name) { + this->m_name = (char *)malloc(strlen(p_name) + 1); + + if (this->m_name) { + strcpy(this->m_name, p_name); + } + } + else { + this->m_name = NULL; + } + } +} + +// OFFSET: LEGO1 0x10005530 +void MxDSObject::SetAtomId(MxAtomId p_atomId) +{ + this->m_atomId = p_atomId; +} diff --git a/LEGO1/mxdsobject.h b/LEGO1/mxdsobject.h index 05ee1fd0..99c62dd2 100644 --- a/LEGO1/mxdsobject.h +++ b/LEGO1/mxdsobject.h @@ -1,10 +1,41 @@ #ifndef MXDSOBJECT_H #define MXDSOBJECT_H -class MxDSObject +#include "mxcore.h" +#include "mxatomid.h" + +class MxDSObject : public MxCore { public: __declspec(dllexport) void SetObjectName(const char *); + + MxDSObject(); + + inline const MxAtomId& GetAtomId() { return this->m_atomId; } + 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; } + + void SetAtomId(MxAtomId p_atomId); + +private: + int m_unk08; + short m_unk0c; + char* m_unk10; + int m_unk14; + 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; + }; + unsigned short m_unk26; + int m_unk28; }; #endif // MXDSOBJECT_H diff --git a/isle.mak b/isle.mak index fea5a64e..f0f905ff 100644 --- a/isle.mak +++ b/isle.mak @@ -57,9 +57,11 @@ CLEAN : -@erase "$(INTDIR)\dllmain.obj" -@erase "$(INTDIR)\legonavcontroller.obj" -@erase "$(INTDIR)\legoomni.obj" + -@erase "$(INTDIR)\mxatomid.obj" -@erase "$(INTDIR)\mxautolocker.obj" -@erase "$(INTDIR)\mxcore.obj" -@erase "$(INTDIR)\mxcriticalsection.obj" + -@erase "$(INTDIR)\mxdsobject.obj" -@erase "$(INTDIR)\mxomni.obj" -@erase "$(INTDIR)\mxomnicreateflags.obj" -@erase "$(INTDIR)\mxomnicreateparam.obj" @@ -129,9 +131,11 @@ LINK32_OBJS= \ "$(INTDIR)\dllmain.obj" \ "$(INTDIR)\legonavcontroller.obj" \ "$(INTDIR)\legoomni.obj" \ + "$(INTDIR)\mxatomid.obj" \ "$(INTDIR)\mxautolocker.obj" \ "$(INTDIR)\mxcore.obj" \ "$(INTDIR)\mxcriticalsection.obj" \ + "$(INTDIR)\mxdsobject.obj" \ "$(INTDIR)\mxomni.obj" \ "$(INTDIR)\mxomnicreateflags.obj" \ "$(INTDIR)\mxomnicreateparam.obj" \ @@ -167,9 +171,11 @@ CLEAN : -@erase "$(INTDIR)\dllmain.obj" -@erase "$(INTDIR)\legonavcontroller.obj" -@erase "$(INTDIR)\legoomni.obj" + -@erase "$(INTDIR)\mxatomid.obj" -@erase "$(INTDIR)\mxautolocker.obj" -@erase "$(INTDIR)\mxcore.obj" -@erase "$(INTDIR)\mxcriticalsection.obj" + -@erase "$(INTDIR)\mxdsobject.obj" -@erase "$(INTDIR)\mxomni.obj" -@erase "$(INTDIR)\mxomnicreateflags.obj" -@erase "$(INTDIR)\mxomnicreateparam.obj" @@ -241,9 +247,11 @@ LINK32_OBJS= \ "$(INTDIR)\dllmain.obj" \ "$(INTDIR)\legonavcontroller.obj" \ "$(INTDIR)\legoomni.obj" \ + "$(INTDIR)\mxatomid.obj" \ "$(INTDIR)\mxautolocker.obj" \ "$(INTDIR)\mxcore.obj" \ "$(INTDIR)\mxcriticalsection.obj" \ + "$(INTDIR)\mxdsobject.obj" \ "$(INTDIR)\mxomni.obj" \ "$(INTDIR)\mxomnicreateflags.obj" \ "$(INTDIR)\mxomnicreateparam.obj" \ @@ -280,6 +288,7 @@ CLEAN : -@erase "$(INTDIR)\isle.obj" -@erase "$(INTDIR)\isle.res" -@erase "$(INTDIR)\main.obj" + -@erase "$(INTDIR)\mx.obj" -@erase "$(INTDIR)\vc40.pdb" -@erase ".\Release\ISLE.EXE" -@erase ".\Release\ISLE.PDB" @@ -341,6 +350,7 @@ LINK32_OBJS= \ "$(INTDIR)\isle.obj" \ "$(INTDIR)\isle.res" \ "$(INTDIR)\main.obj" \ + "$(INTDIR)\mx.obj" \ ".\Release\LEGO1.LIB" ".\Release\ISLE.EXE" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) @@ -370,6 +380,7 @@ CLEAN : -@erase "$(INTDIR)\isle.obj" -@erase "$(INTDIR)\isle.res" -@erase "$(INTDIR)\main.obj" + -@erase "$(INTDIR)\mx.obj" -@erase "$(INTDIR)\vc40.idb" -@erase "$(INTDIR)\vc40.pdb" -@erase ".\Debug\ISLE.EXE" @@ -433,6 +444,7 @@ LINK32_OBJS= \ "$(INTDIR)\isle.obj" \ "$(INTDIR)\isle.res" \ "$(INTDIR)\main.obj" \ + "$(INTDIR)\mx.obj" \ ".\LEGO1\Debug\LEGO1.lib" ".\Debug\ISLE.EXE" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) @@ -620,7 +632,7 @@ DEP_CPP_MXOMN=\ SOURCE=.\LEGO1\mxvideoparam.cpp DEP_CPP_MXVID=\ - ".\LEGO1\mxbool.h"\ + ".\LEGO1\legoinc.h"\ ".\LEGO1\mxpalette.h"\ ".\LEGO1\mxrect32.h"\ ".\LEGO1\mxvariabletable.h"\ @@ -638,6 +650,7 @@ DEP_CPP_MXVID=\ SOURCE=.\LEGO1\mxvideoparamflags.cpp DEP_CPP_MXVIDE=\ + ".\LEGO1\legoinc.h"\ ".\LEGO1\mxvideoparamflags.h"\ @@ -651,6 +664,7 @@ DEP_CPP_MXVIDE=\ SOURCE=.\LEGO1\mxomnicreateparam.cpp DEP_CPP_MXOMNI=\ + ".\LEGO1\legoinc.h"\ ".\LEGO1\mxbool.h"\ ".\LEGO1\mxcore.h"\ ".\LEGO1\mxomnicreateflags.h"\ @@ -674,6 +688,7 @@ DEP_CPP_MXOMNI=\ SOURCE=.\LEGO1\mxomnicreateparambase.cpp DEP_CPP_MXOMNIC=\ + ".\LEGO1\legoinc.h"\ ".\LEGO1\mxbool.h"\ ".\LEGO1\mxcore.h"\ ".\LEGO1\mxomnicreateflags.h"\ @@ -775,6 +790,35 @@ DEP_CPP_LEGON=\ $(CPP) $(CPP_PROJ) $(SOURCE) +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LEGO1\mxdsobject.cpp +DEP_CPP_MXDSO=\ + ".\LEGO1\mxatomid.h"\ + ".\LEGO1\mxbool.h"\ + ".\LEGO1\mxcore.h"\ + ".\LEGO1\mxdsobject.h"\ + + +"$(INTDIR)\mxdsobject.obj" : $(SOURCE) $(DEP_CPP_MXDSO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\LEGO1\mxatomid.cpp +DEP_CPP_MXATO=\ + ".\LEGO1\mxatomid.h"\ + + +"$(INTDIR)\mxatomid.obj" : $(SOURCE) $(DEP_CPP_MXATO) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + # End Source File # End Target ################################################################################ @@ -806,6 +850,9 @@ DEP_CPP_DEFIN=\ # Begin Source File SOURCE=.\ISLE\isle.cpp + +!IF "$(CFG)" == "ISLE - Win32 Release" + DEP_CPP_ISLE_=\ ".\ISLE\define.h"\ ".\ISLE\isle.h"\ @@ -816,6 +863,7 @@ DEP_CPP_ISLE_=\ ".\LEGO1\legobuildingmanager.h"\ ".\LEGO1\legoentity.h"\ ".\LEGO1\legogamestate.h"\ + ".\LEGO1\legoinc.h"\ ".\LEGO1\legoinputmanager.h"\ ".\LEGO1\legomodelpresenter.h"\ ".\LEGO1\legonavcontroller.h"\ @@ -862,11 +910,72 @@ DEP_CPP_ISLE_=\ $(CPP) $(CPP_PROJ) $(SOURCE) +!ELSEIF "$(CFG)" == "ISLE - Win32 Debug" + +DEP_CPP_ISLE_=\ + ".\ISLE\define.h"\ + ".\ISLE\isle.h"\ + ".\ISLE\res\resource.h"\ + ".\LEGO1\lego3dmanager.h"\ + ".\LEGO1\lego3dview.h"\ + ".\LEGO1\legoanimationmanager.h"\ + ".\LEGO1\legobuildingmanager.h"\ + ".\LEGO1\legoentity.h"\ + ".\LEGO1\legogamestate.h"\ + ".\LEGO1\legoinc.h"\ + ".\LEGO1\legoinputmanager.h"\ + ".\LEGO1\legomodelpresenter.h"\ + ".\LEGO1\legonavcontroller.h"\ + ".\LEGO1\legoomni.h"\ + ".\LEGO1\legopartpresenter.h"\ + ".\LEGO1\legoroi.h"\ + ".\LEGO1\legovideomanager.h"\ + ".\LEGO1\legoworldpresenter.h"\ + ".\LEGO1\mxatomid.h"\ + ".\LEGO1\mxbackgroundaudiomanager.h"\ + ".\LEGO1\mxbool.h"\ + ".\LEGO1\mxcore.h"\ + ".\LEGO1\mxcriticalsection.h"\ + ".\LEGO1\mxdirectdraw.h"\ + ".\LEGO1\mxdsaction.h"\ + ".\LEGO1\mxdsfile.h"\ + ".\LEGO1\mxdsobject.h"\ + ".\LEGO1\mxeventmanager.h"\ + ".\LEGO1\mxmusicmanager.h"\ + ".\LEGO1\mxnotificationmanager.h"\ + ".\LEGO1\mxobjectfactory.h"\ + ".\LEGO1\mxomni.h"\ + ".\LEGO1\mxomnicreateflags.h"\ + ".\LEGO1\mxomnicreateparam.h"\ + ".\LEGO1\mxomnicreateparambase.h"\ + ".\LEGO1\mxresult.h"\ + ".\LEGO1\mxsoundmanager.h"\ + ".\LEGO1\mxstreamcontroller.h"\ + ".\LEGO1\mxstreamer.h"\ + ".\LEGO1\mxstring.h"\ + ".\LEGO1\mxticklemanager.h"\ + ".\LEGO1\mxtimer.h"\ + ".\LEGO1\mxtransitionmanager.h"\ + ".\LEGO1\mxvariabletable.h"\ + ".\LEGO1\mxvideomanager.h"\ + ".\LEGO1\mxvideoparam.h"\ + ".\LEGO1\viewmanager.h"\ + + +"$(INTDIR)\isle.obj" : $(SOURCE) $(DEP_CPP_ISLE_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + # End Source File ################################################################################ # Begin Source File SOURCE=.\ISLE\main.cpp + +!IF "$(CFG)" == "ISLE - Win32 Release" + DEP_CPP_MAIN_=\ ".\ISLE\define.h"\ ".\ISLE\isle.h"\ @@ -917,6 +1026,57 @@ DEP_CPP_MAIN_=\ $(CPP) $(CPP_PROJ) $(SOURCE) +!ELSEIF "$(CFG)" == "ISLE - Win32 Debug" + +DEP_CPP_MAIN_=\ + ".\ISLE\define.h"\ + ".\ISLE\isle.h"\ + ".\LEGO1\lego3dmanager.h"\ + ".\LEGO1\lego3dview.h"\ + ".\LEGO1\legoentity.h"\ + ".\LEGO1\legogamestate.h"\ + ".\LEGO1\legoinc.h"\ + ".\LEGO1\legoinputmanager.h"\ + ".\LEGO1\legonavcontroller.h"\ + ".\LEGO1\legoomni.h"\ + ".\LEGO1\legoroi.h"\ + ".\LEGO1\legovideomanager.h"\ + ".\LEGO1\mxatomid.h"\ + ".\LEGO1\mxbackgroundaudiomanager.h"\ + ".\LEGO1\mxbool.h"\ + ".\LEGO1\mxcore.h"\ + ".\LEGO1\mxcriticalsection.h"\ + ".\LEGO1\mxdsaction.h"\ + ".\LEGO1\mxdsfile.h"\ + ".\LEGO1\mxdsobject.h"\ + ".\LEGO1\mxeventmanager.h"\ + ".\LEGO1\mxmusicmanager.h"\ + ".\LEGO1\mxnotificationmanager.h"\ + ".\LEGO1\mxobjectfactory.h"\ + ".\LEGO1\mxomni.h"\ + ".\LEGO1\mxomnicreateflags.h"\ + ".\LEGO1\mxomnicreateparam.h"\ + ".\LEGO1\mxomnicreateparambase.h"\ + ".\LEGO1\mxresult.h"\ + ".\LEGO1\mxsoundmanager.h"\ + ".\LEGO1\mxstreamcontroller.h"\ + ".\LEGO1\mxstreamer.h"\ + ".\LEGO1\mxstring.h"\ + ".\LEGO1\mxticklemanager.h"\ + ".\LEGO1\mxtimer.h"\ + ".\LEGO1\mxtransitionmanager.h"\ + ".\LEGO1\mxvariabletable.h"\ + ".\LEGO1\mxvideomanager.h"\ + ".\LEGO1\mxvideoparam.h"\ + ".\LEGO1\viewmanager.h"\ + + +"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +!ENDIF + # End Source File ################################################################################ # Begin Source File @@ -1357,6 +1517,22 @@ SOURCE=.\LEGO1\mxvideoparamflags.h !ENDIF # End Project Dependency +################################################################################ +# Begin Source File + +SOURCE=.\ISLE\mx.cpp +DEP_CPP_MX_CP=\ + ".\LEGO1\mxatomid.h"\ + ".\LEGO1\mxbool.h"\ + ".\LEGO1\mxcore.h"\ + ".\LEGO1\mxdsobject.h"\ + + +"$(INTDIR)\mx.obj" : $(SOURCE) $(DEP_CPP_MX_CP) "$(INTDIR)" + $(CPP) $(CPP_PROJ) $(SOURCE) + + +# End Source File # End Target # End Project ################################################################################ diff --git a/isle.mdp b/isle.mdp index f31e19c5..e164ac1e 100644 Binary files a/isle.mdp and b/isle.mdp differ