diff --git a/3rdparty/flic/flic.h b/3rdparty/flic/flic.h index 6d8495f4..42969e5c 100644 --- a/3rdparty/flic/flic.h +++ b/3rdparty/flic/flic.h @@ -33,4 +33,4 @@ typedef struct { BYTE reserved3[40]; /* Set to zero */ } FLIC_HEADER; -#endif FLIC_H // FLIC_H \ No newline at end of file +#endif // FLIC_H diff --git a/3rdparty/smack/RAD.H b/3rdparty/smack/rad.h similarity index 99% rename from 3rdparty/smack/RAD.H rename to 3rdparty/smack/rad.h index f041dc1c..610bd794 100644 --- a/3rdparty/smack/RAD.H +++ b/3rdparty/smack/rad.h @@ -82,7 +82,7 @@ #endif #if !defined(__RADDOS__) && !defined(__RADWIN__) && !defined(__RADMAC__) - #error RAD.H didn'y detect your platform. Define __DOS__, __WINDOWS__, WIN32, macintosh, or powerc. + #error "RAD.H didn'y detect your platform. Define __DOS__, __WINDOWS__, WIN32, macintosh, or powerc." #endif #ifdef __RADMAC__ diff --git a/3rdparty/smack/SMACK.H b/3rdparty/smack/smack.h similarity index 100% rename from 3rdparty/smack/SMACK.H rename to 3rdparty/smack/smack.h diff --git a/3rdparty/smack/SMACK.LIB b/3rdparty/smack/smack.lib similarity index 100% rename from 3rdparty/smack/SMACK.LIB rename to 3rdparty/smack/smack.lib diff --git a/CMakeLists.txt b/CMakeLists.txt index 61a70e1c..4e509e01 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -207,6 +207,7 @@ add_library(lego1 SHARED LEGO1/realtime/realtimeview.cpp LEGO1/realtime/vector.cpp LEGO1/registrationbook.cpp + LEGO1/res/lego1.rc LEGO1/score.cpp LEGO1/scorestate.cpp LEGO1/skateboard.cpp @@ -254,10 +255,11 @@ endif() target_link_directories(lego1 PRIVATE "${CMAKE_SOURCE_DIR}/3rdparty/smack") # Link libraries -target_link_libraries(lego1 PRIVATE ddraw dsound dxguid dinput winmm d3drm smack) +target_link_libraries(lego1 PRIVATE ddraw dsound dinput dxguid winmm d3drm smack) # Make sure filenames are ALL CAPS set_property(TARGET lego1 PROPERTY OUTPUT_NAME LEGO1) +set_property(TARGET lego1 PROPERTY PREFIX "") set_property(TARGET lego1 PROPERTY SUFFIX ".DLL") if (ISLE_BUILD_APP) diff --git a/LEGO1/act3actor.h b/LEGO1/act3actor.h index cd1e1fcd..00d06495 100644 --- a/LEGO1/act3actor.h +++ b/LEGO1/act3actor.h @@ -1,12 +1,14 @@ #ifndef ACT3ACTOR_H #define ACT3ACTOR_H +#include "mxcore.h" + // FIXME: Uncertain location. There are three vtables which eventually call this // class' ClassName() function, but none of them call it directly. class Act3Actor : public MxCore { public: // FUNCTION: LEGO1 0x100431b0 - inline virtual const char* ClassName() override + inline virtual const char* ClassName() const override { // STRING: LEGO1 0x100f03ac return "Act3Actor"; diff --git a/LEGO1/define.cpp b/LEGO1/define.cpp index acd811a8..3f3f70ac 100644 --- a/LEGO1/define.cpp +++ b/LEGO1/define.cpp @@ -1,7 +1,7 @@ #include "define.h" // GLOBAL: LEGO1 0x1010141c -MxU32 g_mxcoreCount[101] = {0, -6643, -5643, -5058, -4643, -4321, -4058, -3836, -3643, -3473, -3321, -3184, -3058, +MxS32 g_mxcoreCount[101] = {0, -6643, -5643, -5058, -4643, -4321, -4058, -3836, -3643, -3473, -3321, -3184, -3058, -2943, -2836, -2736, -2643, -2556, -2473, -2395, -2321, -2251, -2184, -2120, -2058, -2000, -1943, -1888, -1836, -1785, -1736, -1689, -1643, -1599, -1556, -1514, -1473, -1434, -1395, -1358, -1321, -1286, -1251, -1217, -1184, -1152, -1120, -1089, -1058, -1029, -1000, -971, diff --git a/LEGO1/define.h b/LEGO1/define.h index 45a536a9..d45d02c3 100644 --- a/LEGO1/define.h +++ b/LEGO1/define.h @@ -3,7 +3,7 @@ #include "mxtypes.h" -extern MxU32 g_mxcoreCount[101]; +extern MxS32 g_mxcoreCount[101]; extern const char* g_parseExtraTokens; extern const char* g_strWORLD; extern const char* g_strSOUND; diff --git a/LEGO1/legocameracontroller.cpp b/LEGO1/legocameracontroller.cpp index a182d025..ad1dbb67 100644 --- a/LEGO1/legocameracontroller.cpp +++ b/LEGO1/legocameracontroller.cpp @@ -25,17 +25,23 @@ void LegoCameraController::FUN_100123e0(Matrix4Data& p_transform, MxU32) // STUB: LEGO1 0x10012740 Vector3Data& LegoCameraController::FUN_10012740() { - return Vector3Data(); + // Actually returns reference to a member + static Vector3Data g_v; + return g_v; } // STUB: LEGO1 0x100127f0 Vector3Data& LegoCameraController::FUN_100127f0() { - return Vector3Data(); + // Actually returns reference to a member + static Vector3Data g_v; + return g_v; } // STUB: LEGO1 0x100128a0 Vector3Data& LegoCameraController::FUN_100128a0() { - return Vector3Data(); + // Actually returns reference to a member + static Vector3Data g_v; + return g_v; } diff --git a/LEGO1/legoeventnotificationparam.h b/LEGO1/legoeventnotificationparam.h index 5f0195ec..c9087909 100644 --- a/LEGO1/legoeventnotificationparam.h +++ b/LEGO1/legoeventnotificationparam.h @@ -4,6 +4,8 @@ #include "mxnotificationparam.h" #include "mxtypes.h" +#include <stdlib.h> + // VTABLE: LEGO1 0x100d6aa0 class LegoEventNotificationParam : public MxNotificationParam { public: diff --git a/LEGO1/legogamestate.cpp b/LEGO1/legogamestate.cpp index 62a30db4..23e04601 100644 --- a/LEGO1/legogamestate.cpp +++ b/LEGO1/legogamestate.cpp @@ -9,6 +9,8 @@ #include "mxstring.h" #include "mxvariabletable.h" +#include <stdio.h> + // Based on the highest dword offset (0x42c) referenced in the constructor. // There may be other members that come after. DECOMP_SIZE_ASSERT(LegoGameState, 0x430) @@ -217,7 +219,7 @@ MxBool ROIHandlerFunction(char* p_input, char* p_output, MxU32 p_copyLen) } // FUNCTION: LEGO1 0x1003bbb0 -LegoState* LegoGameState::GetState(COMPAT_CONST char* p_stateName) +LegoState* LegoGameState::GetState(const char* p_stateName) { for (MxS32 i = 0; i < m_stateCount; ++i) if (m_stateArray[i]->IsA(p_stateName)) @@ -226,7 +228,7 @@ LegoState* LegoGameState::GetState(COMPAT_CONST char* p_stateName) } // FUNCTION: LEGO1 0x1003bc00 -LegoState* LegoGameState::CreateState(COMPAT_CONST char* p_stateName) +LegoState* LegoGameState::CreateState(const char* p_stateName) { LegoState* newState = (LegoState*) ObjectFactory()->Create(p_stateName); RegisterState(newState); diff --git a/LEGO1/legogamestate.h b/LEGO1/legogamestate.h index 656b990c..5f62b107 100644 --- a/LEGO1/legogamestate.h +++ b/LEGO1/legogamestate.h @@ -27,8 +27,8 @@ public: __declspec(dllexport) void SerializeScoreHistory(MxS16 p_flags); __declspec(dllexport) void SetSavePath(char*); - LegoState* GetState(COMPAT_CONST char* p_stateName); - LegoState* CreateState(COMPAT_CONST char* p_stateName); + LegoState* GetState(const char* p_stateName); + LegoState* CreateState(const char* p_stateName); void GetFileSavePath(MxString* p_outPath, MxULong p_slotn); void FUN_1003a720(MxU32); diff --git a/LEGO1/mxatomid.h b/LEGO1/mxatomid.h index 5d4cd10f..3abe6479 100644 --- a/LEGO1/mxatomid.h +++ b/LEGO1/mxatomid.h @@ -20,6 +20,7 @@ public: MxAtomId() { this->m_internal = 0; } inline MxBool operator==(const MxAtomId& p_atomId) const { return this->m_internal == p_atomId.m_internal; } + inline MxBool operator!=(const MxAtomId& p_atomId) const { return this->m_internal != p_atomId.m_internal; } void Clear(); diff --git a/LEGO1/mxcore.cpp b/LEGO1/mxcore.cpp index 18c37597..237ed1da 100644 --- a/LEGO1/mxcore.cpp +++ b/LEGO1/mxcore.cpp @@ -11,7 +11,7 @@ MxResult MxCore::Tickle() // FUNCTION: LEGO1 0x100ae1a0 MxCore::MxCore() { - m_id = g_mxcoreCount[0]; + m_id = (MxU32) g_mxcoreCount[0]; g_mxcoreCount[0]++; } diff --git a/LEGO1/mxlist.h b/LEGO1/mxlist.h index 33fbbcd0..911d5a36 100644 --- a/LEGO1/mxlist.h +++ b/LEGO1/mxlist.h @@ -76,7 +76,10 @@ public: static void Destroy(T* p_obj) { delete p_obj; }; - void SetOwnership(MxBool p_ownership) { SetDestroy(p_ownership ? Destroy : MxCollection<T*>::Destroy); } + void SetOwnership(MxBool p_ownership) + { + MxCollection<T*>::SetDestroy(p_ownership ? MxPtrList<T>::Destroy : MxCollection<T*>::Destroy); + } }; template <class T> diff --git a/LEGO1/mxqueue.h b/LEGO1/mxqueue.h index b6eaad55..4e45c035 100644 --- a/LEGO1/mxqueue.h +++ b/LEGO1/mxqueue.h @@ -13,10 +13,10 @@ public: MxBool Dequeue(T& p_obj) { - MxBool hasNext = (m_first != NULL); - if (m_first) { - p_obj = m_first->GetValue(); - DeleteEntry(m_first); + MxBool hasNext = (this->m_first != NULL); + if (this->m_first) { + p_obj = this->m_first->GetValue(); + this->DeleteEntry(this->m_first); } return hasNext; diff --git a/LEGO1/mxstl/stlcompat.h b/LEGO1/mxstl/stlcompat.h index bc0076bf..29c31549 100644 --- a/LEGO1/mxstl/stlcompat.h +++ b/LEGO1/mxstl/stlcompat.h @@ -10,9 +10,13 @@ #else #include <algorithm> #include <list> +#include <map> #include <set> +#include <vector> using std::list; +using std::map; using std::set; +using std::vector; #endif #endif // STLCOMPAT_H diff --git a/LEGO1/mxstreamlist.cpp b/LEGO1/mxstreamlist.cpp index 729b0d7b..46e9841b 100644 --- a/LEGO1/mxstreamlist.cpp +++ b/LEGO1/mxstreamlist.cpp @@ -26,7 +26,12 @@ MxDSAction* MxStreamListMxDSAction::Find(MxDSAction* p_action, MxBool p_delete) MxDSAction* found = NULL; +#ifdef COMPAT_MODE + iterator it; + for (it = begin(); it != end(); it++) { +#else for (iterator it = begin(); it != end(); it++) { +#endif if (p_action->GetObjectId() == -1 || p_action->GetObjectId() == (*it)->GetObjectId()) { if (p_action->GetUnknown24() == -2 || p_action->GetUnknown24() == -3 || p_action->GetUnknown24() == (*it)->GetUnknown24()) { diff --git a/LEGO1/mxstreamlist.h b/LEGO1/mxstreamlist.h index f9164bfb..cbe53eae 100644 --- a/LEGO1/mxstreamlist.h +++ b/LEGO1/mxstreamlist.h @@ -11,11 +11,11 @@ class MxStreamList : public list<T> { public: MxBool PopFront(T& p_obj) { - if (empty()) + if (this->empty()) return FALSE; - p_obj = front(); - pop_front(); + p_obj = this->front(); + this->pop_front(); return TRUE; } }; diff --git a/LEGO1/mxtransitionmanager.cpp b/LEGO1/mxtransitionmanager.cpp index b10ac7c1..db658249 100644 --- a/LEGO1/mxtransitionmanager.cpp +++ b/LEGO1/mxtransitionmanager.cpp @@ -229,7 +229,7 @@ void MxTransitionManager::TransitionDissolve() if (VideoManager()->GetVideoParam().Flags().GetFlipSurfaces()) { LPDIRECTDRAWSURFACE surf = VideoManager()->GetDisplaySurface()->GetDirectDrawSurface1(); - surf->BltFast(NULL, NULL, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT); + surf->BltFast(0, 0, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT); } m_animationTimer++; @@ -346,7 +346,7 @@ void MxTransitionManager::TransitionPixelation() if (VideoManager()->GetVideoParam().Flags().GetFlipSurfaces()) { LPDIRECTDRAWSURFACE surf = VideoManager()->GetDisplaySurface()->GetDirectDrawSurface1(); - surf->BltFast(NULL, NULL, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT); + surf->BltFast(0, 0, m_ddSurface, &g_fullScreenRect, DDBLTFAST_WAIT); } m_animationTimer++; diff --git a/LEGO1/res/arrow.cur b/LEGO1/res/arrow.cur new file mode 100644 index 00000000..15f687a1 Binary files /dev/null and b/LEGO1/res/arrow.cur differ diff --git a/LEGO1/res/busy.cur b/LEGO1/res/busy.cur new file mode 100644 index 00000000..2a63b536 Binary files /dev/null and b/LEGO1/res/busy.cur differ diff --git a/LEGO1/res/leaf_0.cur b/LEGO1/res/leaf_0.cur new file mode 100644 index 00000000..e8735671 Binary files /dev/null and b/LEGO1/res/leaf_0.cur differ diff --git a/LEGO1/res/leaf_1.cur b/LEGO1/res/leaf_1.cur new file mode 100644 index 00000000..e7e0cde9 Binary files /dev/null and b/LEGO1/res/leaf_1.cur differ diff --git a/LEGO1/res/leaf_2.cur b/LEGO1/res/leaf_2.cur new file mode 100644 index 00000000..1abce39b Binary files /dev/null and b/LEGO1/res/leaf_2.cur differ diff --git a/LEGO1/res/leaf_3.cur b/LEGO1/res/leaf_3.cur new file mode 100644 index 00000000..25e6935f Binary files /dev/null and b/LEGO1/res/leaf_3.cur differ diff --git a/LEGO1/res/leaf_4.cur b/LEGO1/res/leaf_4.cur new file mode 100644 index 00000000..73ec0799 Binary files /dev/null and b/LEGO1/res/leaf_4.cur differ diff --git a/LEGO1/res/leaf_5.cur b/LEGO1/res/leaf_5.cur new file mode 100644 index 00000000..8d8df94e Binary files /dev/null and b/LEGO1/res/leaf_5.cur differ diff --git a/LEGO1/res/leaf_6.cur b/LEGO1/res/leaf_6.cur new file mode 100644 index 00000000..04615d16 Binary files /dev/null and b/LEGO1/res/leaf_6.cur differ diff --git a/LEGO1/res/leaf_7.cur b/LEGO1/res/leaf_7.cur new file mode 100644 index 00000000..9795b1df Binary files /dev/null and b/LEGO1/res/leaf_7.cur differ diff --git a/LEGO1/res/lego1.rc b/LEGO1/res/lego1.rc new file mode 100644 index 00000000..44e07d7c --- /dev/null +++ b/LEGO1/res/lego1.rc @@ -0,0 +1,39 @@ +#include "resource.h" + +LEGO1_LEAF4 CURSOR "leaf_4.cur" +LEGO1_LEAF7 CURSOR "leaf_7.cur" +LEGO1_LEAF1 CURSOR "leaf_1.cur" +LEGO1_LEAF2 CURSOR "leaf_2.cur" +LEGO1_LEAF6 CURSOR "leaf_6.cur" +LEGO1_LEAF0 CURSOR "leaf_0.cur" +LEGO1_LEAF5 CURSOR "leaf_5.cur" +LEGO1_LEAF3 CURSOR "leaf_3.cur" +LEGO1_ARROW CURSOR "arrow.cur" +LEGO1_BUSY CURSOR "busy.cur" + +1 VERSIONINFO +FILEVERSION 1,1,0,0 +PRODUCTVERSION 1,1,0,0 +FILEOS 0x40004 +FILETYPE 0x2 +{ +BLOCK "StringFileInfo" +{ + BLOCK "040904b0" + { + VALUE "CompanyName", "Mindscape, Inc." + VALUE "FileDescription", "LegoOmni Library" + VALUE "FileVersion", "1, 1, 0, 0" + VALUE "InternalName", "LegoOmni Library" + VALUE "LegalCopyright", "Copyright \xA9 1997" + VALUE "OriginalFilename", "LegoOmni Library" + VALUE "ProductName", "LegoOmni Library" + VALUE "ProductVersion", "1, 1, 0, 0" + } +} + +BLOCK "VarFileInfo" +{ + VALUE "Translation", 0x0409, 0x04B0 +} +} diff --git a/LEGO1/res/resource.h b/LEGO1/res/resource.h new file mode 100644 index 00000000..d11b6281 --- /dev/null +++ b/LEGO1/res/resource.h @@ -0,0 +1,12 @@ +#define LEGO1_ARROW 101 +#define LEGO1_LEAF4 102 +#define LEGO1_LEAF7 103 +#define LEGO1_LEAF1 104 +#define LEGO1_LEAF2 105 +#define LEGO1_LEAF6 106 +#define LEGO1_LEAF0 107 +#define LEGO1_LEAF5 108 +#define LEGO1_LEAF3 109 +#define LEGO1_BUSY 111 + +#define APP_ICON 105 diff --git a/LEGO1/viewmanager/viewlodlist.cpp b/LEGO1/viewmanager/viewlodlist.cpp index 9a8456fc..1cd0783e 100644 --- a/LEGO1/viewmanager/viewlodlist.cpp +++ b/LEGO1/viewmanager/viewlodlist.cpp @@ -42,6 +42,12 @@ ViewLODList* ViewLODListManager::Create(const ROIName& rROIName, int lodCount) return pLODList; } +// STUB: LEGO1 0x100a75b0 +ViewLODList* ViewLODListManager::Lookup(const ROIName&) const +{ + return NULL; +} + // STUB: LEGO1 0x100a7680 void ViewLODListManager::Destroy(ViewLODList* lodList) { diff --git a/LEGO1/viewmanager/viewlodlist.h b/LEGO1/viewmanager/viewlodlist.h index c0d5ed82..4d848533 100644 --- a/LEGO1/viewmanager/viewlodlist.h +++ b/LEGO1/viewmanager/viewlodlist.h @@ -6,6 +6,8 @@ #include "assert.h" #include "compat.h" +#include <string.h> + #pragma warning(disable : 4237) #pragma warning(disable : 4786) diff --git a/util/compat.h b/util/compat.h index e83b115e..3c83def6 100644 --- a/util/compat.h +++ b/util/compat.h @@ -3,6 +3,10 @@ // Various macros to enable compiling with other/newer compilers. +#ifdef __MINGW32__ +#define COMPAT_MODE +#endif + // Use `COMPAT_CONST` where something ought to be 'const', and a newer compiler would complain if it // wasn't, but we know it isn't 'const' in the original code. #ifdef __MINGW32__