diff --git a/app/isle.cpp b/app/isle.cpp index bfaadc8c..053dd78b 100644 --- a/app/isle.cpp +++ b/app/isle.cpp @@ -5,6 +5,7 @@ #include "../lib/mxdirectdraw.h" #include "../lib/mxdsaction.h" #include "../lib/mxomni.h" +#include "res/resource.h" RECT windowRect = {0, 0, 640, 480}; @@ -42,10 +43,10 @@ Isle::Isle() m_videoParam.flags().Enable16Bit(MxDirectDraw::GetPrimaryBitDepth() == 16); m_windowHandle = NULL; - m_cursor1 = NULL; - m_cursor2 = NULL; - m_cursor3 = NULL; - m_cursor4 = NULL; + m_cursorArrow = NULL; + m_cursorBusy = NULL; + m_cursorNo = NULL; + m_cursorCurrent = NULL; LegoOmni::CreateInstance(); } @@ -242,10 +243,10 @@ void Isle::setupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers, } } -BOOL Isle::setupMediaPath() +BOOL Isle::setupLegoOmni() { char mediaPath[256]; - GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, 0x100); + GetProfileStringA("LEGO Island", "MediaPath", "", mediaPath, 256); MxOmniCreateParam createParam(mediaPath, (struct HWND__ *) m_windowHandle, m_videoParam, MxOmniCreateFlags()); @@ -258,6 +259,26 @@ BOOL Isle::setupMediaPath() return FALSE; } +void Isle::setupCursor(WPARAM wParam) +{ + switch (wParam) { + case 0: + m_cursorCurrent = m_cursorArrow; + break; + case 1: + m_cursorCurrent = m_cursorBusy; + break; + case 2: + m_cursorCurrent = m_cursorNo; + break; + case 0xB: + m_cursorCurrent = NULL; + break; + } + + SetCursor(m_cursorCurrent); +} + LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (!g_isle) { @@ -364,6 +385,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_TIMER: case WM_LBUTTONDOWN: case WM_LBUTTONUP: + case 0x5400: { NotificationId type = NONE; @@ -386,8 +408,8 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) break; case WM_SETCURSOR: if (g_isle) { - HCURSOR hCursor = g_isle->m_cursor4; - if (g_isle->m_cursor2 == hCursor || g_isle->m_cursor3 == hCursor || hCursor == NULL) { + HCURSOR hCursor = g_isle->m_cursorCurrent; + if (hCursor == g_isle->m_cursorBusy || hCursor == g_isle->m_cursorNo || !hCursor) { SetCursor(hCursor); return 0; } @@ -403,8 +425,7 @@ LRESULT WINAPI WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) break; case 0x5400: if (g_isle) { - // FIXME: Untangle - //FUN_00402e80(g_isle,wParam); + g_isle->setupCursor(wParam); return 0; } } @@ -453,12 +474,12 @@ MxResult Isle::setupWindow(HINSTANCE hInstance) wndclass.style = CS_HREDRAW | CS_VREDRAW; wndclass.lpfnWndProc = WndProc; wndclass.cbWndExtra = 0; - wndclass.hIcon = LoadIconA(hInstance, MAKEINTRESOURCE(105)); - wndclass.hCursor = LoadCursorA(hInstance, MAKEINTRESOURCE(102)); - m_cursor4 = wndclass.hCursor; - m_cursor1 = wndclass.hCursor; - m_cursor2 = LoadCursorA(hInstance, MAKEINTRESOURCE(104)); - m_cursor3 = LoadCursorA(hInstance, MAKEINTRESOURCE(103)); + wndclass.hIcon = LoadIconA(hInstance, MAKEINTRESOURCE(APP_ICON)); + wndclass.hCursor = LoadCursorA(hInstance, MAKEINTRESOURCE(ISLE_ARROW)); + m_cursorCurrent = wndclass.hCursor; + m_cursorArrow = wndclass.hCursor; + m_cursorBusy = LoadCursorA(hInstance, MAKEINTRESOURCE(ISLE_BUSY)); + m_cursorNo = LoadCursorA(hInstance, MAKEINTRESOURCE(ISLE_NO)); wndclass.hInstance = hInstance; wndclass.hbrBackground = GetStockObject(BLACK_BRUSH); wndclass.lpszClassName = WNDCLASS_NAME; @@ -500,7 +521,7 @@ MxResult Isle::setupWindow(HINSTANCE hInstance) ShowWindow(m_windowHandle, SW_SHOWNORMAL); UpdateWindow(m_windowHandle); - if (!setupMediaPath()) { + if (!setupLegoOmni()) { return FAILURE; } diff --git a/app/isle.h b/app/isle.h index 9b7ffc05..ff70a183 100644 --- a/app/isle.h +++ b/app/isle.h @@ -18,12 +18,14 @@ class Isle void tick(BOOL sleepIfNotNextFrame); - BOOL setupMediaPath(); + BOOL setupLegoOmni(); void loadConfig(); void setupVideoFlags(BOOL fullScreen, BOOL flipSurfaces, BOOL backBuffers, BOOL using8bit, BOOL m_using16bit, BOOL param_6, BOOL param_7, BOOL wideViewAngle, char *deviceId); + void setupCursor(WPARAM wParam); + //private: // 0 @@ -62,12 +64,12 @@ class Isle BOOL m_windowActive; HWND m_windowHandle; BOOL m_drawCursor; - HCURSOR m_cursor1; + HCURSOR m_cursorArrow; // 80 - HCURSOR m_cursor2; - HCURSOR m_cursor3; - HCURSOR m_cursor4; + HCURSOR m_cursorBusy; + HCURSOR m_cursorNo; + HCURSOR m_cursorCurrent; }; diff --git a/app/main.cpp b/app/main.cpp index e762cd69..b5975de1 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -7,6 +7,9 @@ BOOL findExistingInstance(void) { + // FIXME: temp + return 1; + HWND hWnd = FindWindowA(WNDCLASS_NAME, WINDOW_TITLE); if (hWnd) { if (SetForegroundWindow(hWnd)) { diff --git a/app/res/arrow.cur b/app/res/arrow.cur new file mode 100644 index 00000000..548b8dac Binary files /dev/null and b/app/res/arrow.cur differ diff --git a/app/res/busy.cur b/app/res/busy.cur new file mode 100644 index 00000000..320d6b9a Binary files /dev/null and b/app/res/busy.cur differ diff --git a/app/res/isle.ico b/app/res/isle.ico new file mode 100644 index 00000000..0d41ffde Binary files /dev/null and b/app/res/isle.ico differ diff --git a/app/res/isle.rc b/app/res/isle.rc new file mode 100644 index 00000000..bcf91d2c Binary files /dev/null and b/app/res/isle.rc differ diff --git a/app/res/no.cur b/app/res/no.cur new file mode 100644 index 00000000..b3966420 Binary files /dev/null and b/app/res/no.cur differ diff --git a/app/res/resource.h b/app/res/resource.h new file mode 100644 index 00000000..6148e89f --- /dev/null +++ b/app/res/resource.h @@ -0,0 +1,5 @@ +#define ISLE_ARROW 102 +#define ISLE_NO 103 +#define ISLE_BUSY 104 + +#define APP_ICON 105 diff --git a/isle.mak b/isle.mak index 37b25818..b066ca73 100644 --- a/isle.mak +++ b/isle.mak @@ -32,8 +32,8 @@ NULL=nul # Begin Project # PROP Target_Last_Scanned "isle - Win32 Debug" CPP=cl.exe -MTL=mktyplib.exe RSC=rc.exe +MTL=mktyplib.exe !IF "$(CFG)" == "isle - Win32 Release" @@ -55,6 +55,7 @@ ALL : "$(OUTDIR)\isle.exe" CLEAN : -@erase "$(INTDIR)\define.obj" -@erase "$(INTDIR)\isle.obj" + -@erase "$(INTDIR)\isle.res" -@erase "$(INTDIR)\main.obj" -@erase "$(OUTDIR)\isle.exe" @@ -72,6 +73,7 @@ CPP_SBRS=.\. MTL_PROJ=/nologo /D "NDEBUG" /win32 # ADD BASE RSC /l 0x409 /d "NDEBUG" # ADD RSC /l 0x409 /d "NDEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/isle.res" /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -89,6 +91,7 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ LINK32_OBJS= \ "$(INTDIR)\define.obj" \ "$(INTDIR)\isle.obj" \ + "$(INTDIR)\isle.res" \ "$(INTDIR)\main.obj" "$(OUTDIR)\isle.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) @@ -116,6 +119,7 @@ ALL : "$(OUTDIR)\isle.exe" CLEAN : -@erase "$(INTDIR)\define.obj" -@erase "$(INTDIR)\isle.obj" + -@erase "$(INTDIR)\isle.res" -@erase "$(INTDIR)\main.obj" -@erase "$(INTDIR)\vc40.idb" -@erase "$(INTDIR)\vc40.pdb" @@ -137,6 +141,7 @@ CPP_SBRS=.\. MTL_PROJ=/nologo /D "_DEBUG" /win32 # ADD BASE RSC /l 0x409 /d "_DEBUG" # ADD RSC /l 0x409 /d "_DEBUG" +RSC_PROJ=/l 0x409 /fo"$(INTDIR)/isle.res" /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo @@ -154,6 +159,7 @@ LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\ LINK32_OBJS= \ "$(INTDIR)\define.obj" \ "$(INTDIR)\isle.obj" \ + "$(INTDIR)\isle.res" \ "$(INTDIR)\main.obj" "$(OUTDIR)\isle.exe" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS) @@ -213,6 +219,7 @@ SOURCE=.\app\isle.cpp DEP_CPP_ISLE_=\ ".\app\define.h"\ ".\app\isle.h"\ + ".\app\res\resource.h"\ ".\lib\define.h"\ ".\lib\legoanimationmanager.h"\ ".\lib\legobuildingmanager.h"\ @@ -253,42 +260,33 @@ DEP_CPP_ISLE_=\ # Begin Source File SOURCE=.\app\main.cpp -DEP_CPP_MAIN_=\ - ".\app\define.h"\ - ".\app\isle.h"\ - ".\lib\define.h"\ - ".\lib\legoanimationmanager.h"\ - ".\lib\legobuildingmanager.h"\ - ".\lib\legogamestate.h"\ - ".\lib\legoinputmanager.h"\ - ".\lib\legomodelpresenter.h"\ - ".\lib\legoomni.h"\ - ".\lib\legopartpresenter.h"\ - ".\lib\legoroi.h"\ - ".\lib\legovideomanager.h"\ - ".\lib\legoworldpresenter.h"\ - ".\lib\mxatomid.h"\ - ".\lib\mxbackgroundaudiomanager.h"\ - ".\lib\mxdsaction.h"\ - ".\lib\mxomnicreateflags.h"\ - ".\lib\mxomnicreateparam.h"\ - ".\lib\mxpalette.h"\ - ".\lib\mxrect32.h"\ - ".\lib\mxstreamcontroller.h"\ - ".\lib\mxstreamer.h"\ - ".\lib\mxstring.h"\ - ".\lib\mxticklemanager.h"\ - ".\lib\mxtimer.h"\ - ".\lib\mxtransitionmanager.h"\ - ".\lib\mxvariabletable.h"\ - ".\lib\mxvideoparam.h"\ - ".\lib\mxvideoparamflags.h"\ - -"$(INTDIR)\main.obj" : $(SOURCE) $(DEP_CPP_MAIN_) "$(INTDIR)" +"$(INTDIR)\main.obj" : $(SOURCE) "$(INTDIR)" $(CPP) $(CPP_PROJ) $(SOURCE) +# End Source File +################################################################################ +# Begin Source File + +SOURCE=.\app\res\isle.rc + +!IF "$(CFG)" == "isle - Win32 Release" + + +"$(INTDIR)\isle.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)/isle.res" /i "app\res" /d "NDEBUG" $(SOURCE) + + +!ELSEIF "$(CFG)" == "isle - Win32 Debug" + + +"$(INTDIR)\isle.res" : $(SOURCE) "$(INTDIR)" + $(RSC) /l 0x409 /fo"$(INTDIR)/isle.res" /i "app\res" /d "_DEBUG" $(SOURCE) + + +!ENDIF + # End Source File # End Target # End Project diff --git a/isle.mdp b/isle.mdp index 311a68ed..23728fd5 100644 Binary files a/isle.mdp and b/isle.mdp differ