From 315fd934929b6f1dbb70a6ae3cda097cdbc7d9c0 Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 8 Dec 2009 22:19:48 +0100 Subject: [PATCH] rnd-20091208-1-src * fixed some problems with Supaplex engine when compiling for Windows * added special mode to convert elements of Sokoban XSB levels to CEs --- ChangeLog | 6 ++++++ src/conftime.h | 2 +- src/game_sp/BugsTerminals.c | 4 ++-- src/game_sp/Capture.c | 11 +++++++++++ src/game_sp/Capture.h | 4 ++++ src/game_sp/DDScrollBuffer.c | 17 ++++++++++++++++- src/game_sp/DDSpriteBuffer.c | 10 +++++++++- src/game_sp/DirectDrawGlobals.h | 4 ++++ src/game_sp/DirectXGlobals.c | 7 +++++++ src/game_sp/DirectXGlobals.h | 4 ++++ src/game_sp/MainForm.c | 10 ++++++++++ src/game_sp/MainForm.h | 2 ++ src/game_sp/Sound.c | 32 ++++++++++++++++++++++++++++++++ src/game_sp/TickCountObject.c | 18 +++++++++++++----- src/game_sp/TopMost.c | 3 +++ src/game_sp/TopMost.h | 4 ++++ src/game_sp/vb_defs.h | 4 ++++ src/game_sp/vb_lib.c | 6 +++++- src/game_sp/vb_lib.h | 4 +++- src/game_sp/vb_types.h | 14 +++++++++----- 20 files changed, 149 insertions(+), 17 deletions(-) diff --git a/ChangeLog b/ChangeLog index acaf4935..1c08760a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-12-08 + * fixed some problems with Supaplex engine when compiling for Windows + +2009-12-05 + * added special mode to convert elements of Sokoban XSB levels to CEs + 2009-12-01 * added reading native Sokoban levels and level packages (XSB files) diff --git a/src/conftime.h b/src/conftime.h index 2506dc70..0dac5e2c 100644 --- a/src/conftime.h +++ b/src/conftime.h @@ -1 +1 @@ -#define COMPILE_DATE_STRING "2009-12-05 22:18" +#define COMPILE_DATE_STRING "2009-12-08 22:09" diff --git a/src/game_sp/BugsTerminals.c b/src/game_sp/BugsTerminals.c index 952ccb62..f572e39d 100644 --- a/src/game_sp/BugsTerminals.c +++ b/src/game_sp/BugsTerminals.c @@ -8,7 +8,7 @@ // --- Option Explicit -long GetTickCount(); +long MyGetTickCount(); byte *TerminalState; int TerminalMaxCycles; @@ -148,7 +148,7 @@ int subRandomize() long Tick, Tmp; - Tick = GetTickCount(); + Tick = MyGetTickCount(); Tmp = ((Tick ^ (long)(Tick / (1 << 16))) & 0xFFFF); RandomSeed = 0x7FFF & Tmp; if ((Tmp & 0x8000) != 0) diff --git a/src/game_sp/Capture.c b/src/game_sp/Capture.c index 9a86f9cd..5a71fd0e 100644 --- a/src/game_sp/Capture.c +++ b/src/game_sp/Capture.c @@ -4,6 +4,8 @@ #include "Capture.h" +#if 0 + // static char *VB_Name = "CaptureModule"; // -------------------------------------------------------------------- @@ -95,7 +97,9 @@ long SelectPalette(long hDC, long hPalette, long bForceBackground); long RealizePalette(long hDC); long GetWindowDC(long hWnd); long GetDC(long hWnd); +#if 0 long GetWindowRect(long hWnd, RECT lpRect); +#endif long ReleaseDC(long hWnd, long hDC); long GetDesktopWindow(); @@ -143,7 +147,9 @@ int SelectPalette(int hDC, int hPalette, int bForceBackground); int RealizePalette(int hDC); int GetWindowDC(int hWnd); int GetDC(int hWnd); +#if 0 int GetWindowRect(int hWnd, RECT lpRect); +#endif int ReleaseDC(int hWnd, int hDC); int GetDesktopWindow(); @@ -427,6 +433,8 @@ Picture CaptureClient(Form frmSrc) return CaptureClient; } +#if 0 + // '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' // // CaptureActiveWindow @@ -465,6 +473,8 @@ Picture CaptureActiveWindow() return CaptureActiveWindow; } +#endif + // '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' // @@ -530,3 +540,4 @@ void PrintPictureToFitPage(Printer Prn, Picture pic) // -------------------------------------------------------------------- +#endif diff --git a/src/game_sp/Capture.h b/src/game_sp/Capture.h index f2b8e1b5..427a9b9c 100644 --- a/src/game_sp/Capture.h +++ b/src/game_sp/Capture.h @@ -12,6 +12,8 @@ #include "global.h" +#if 0 + #ifndef HAS_PALETTEENTRY typedef struct { @@ -144,4 +146,6 @@ extern Picture CaptureWindow(int hWndSrc, boolean Client, int LeftSrc, int TopSr extern Picture CreateBitmapPicture(int hBmp, int hPal); extern void PrintPictureToFitPage(Printer Prn, Picture pic); +#endif + #endif /* CAPTURE_H */ diff --git a/src/game_sp/DDScrollBuffer.c b/src/game_sp/DDScrollBuffer.c index 6df6f1e2..24594faa 100644 --- a/src/game_sp/DDScrollBuffer.c +++ b/src/game_sp/DDScrollBuffer.c @@ -315,6 +315,8 @@ int DDScrollBuffer_Get_Height() return Height; } +#if 0 + long DDScrollBuffer_CreateAtSize(long Width, long Height, long hWndViewPort) { long CreateAtSize; @@ -358,6 +360,7 @@ void DDScrollBuffer_Cls(int BackColor) Buffer.BltColorFill(EmptyRect, BackColor); } +#endif /* copy the entire screen to the window at the scroll position */ @@ -553,8 +556,12 @@ void BackToFront_SP(void) void DDScrollBuffer_Blt_Ext(Bitmap *target_bitmap) { - RECT DR, SR; + MyRECT DR, SR; +#if 1 + long tX, tY; +#else long tX, tY, L; +#endif int sX, sY; // RECT ERect; // long Restore; @@ -670,8 +677,12 @@ void DDScrollBuffer_Blt_Ext(Bitmap *target_bitmap) if (IS_NOTHING(&Buffer, sizeof(Buffer))) return; +#if 0 if (IS_NOTHING(&PrimarySurface, sizeof(PrimarySurface))) return; +#endif + +#if 0 L = PrimarySurface.Blt(DR, &Buffer, SR, DDBLT_WAIT); if (L != DD_OK) @@ -740,6 +751,7 @@ void DDScrollBuffer_Blt_Ext(Bitmap *target_bitmap) break; #endif +#if 0 case DDERR_SURFACELOST: DDraw.RestoreAllSurfaces(); if (! PrimarySurface.isLost()) @@ -751,6 +763,7 @@ void DDScrollBuffer_Blt_Ext(Bitmap *target_bitmap) // RestorePrimarySurface // ClipToWindow 0 break; +#endif #if 0 case DDERR_UNSUPPORTED: @@ -768,6 +781,8 @@ void DDScrollBuffer_Blt_Ext(Bitmap *target_bitmap) } } +#endif + #if 0 // Buffer.UpdateOverlay SR, PrimarySurface, DR, DDOVER_SHOW if (EditFlag) diff --git a/src/game_sp/DDSpriteBuffer.c b/src/game_sp/DDSpriteBuffer.c index 872ded6f..bcaaa984 100644 --- a/src/game_sp/DDSpriteBuffer.c +++ b/src/game_sp/DDSpriteBuffer.c @@ -132,6 +132,8 @@ boolean DDSpriteBuffer_CreateFromFile(char *Path, long xSprites, long ySprites) return CreateFromFile; } +#if 0 + boolean DDSpriteBuffer_CreateAtSize(long Width, long Height, long xSprites, long ySprites) { boolean CreateAtSize; @@ -163,6 +165,10 @@ boolean DDSpriteBuffer_CreateAtSize(long Width, long Height, long xSprites, long return CreateAtSize; } +#endif + +#if 0 + void DDSpriteBuffer_Cls(int BackColor) { RECT EmptyRect; @@ -170,9 +176,11 @@ void DDSpriteBuffer_Cls(int BackColor) Buffer.BltColorFill(EmptyRect, BackColor); } +#endif + static void Blt(int pX, int pY, int SpriteX, int SpriteY) { - RECT DR, SR; + MyRECT DR, SR; #if 0 long Tmp; #endif diff --git a/src/game_sp/DirectDrawGlobals.h b/src/game_sp/DirectDrawGlobals.h index 71cc763f..9acca161 100644 --- a/src/game_sp/DirectDrawGlobals.h +++ b/src/game_sp/DirectDrawGlobals.h @@ -12,6 +12,8 @@ #include "global.h" +#if 0 + extern void ClipToWindow(long hWnd); extern void InitDirectDraw(long hWndClip); extern void ReleaseDirectDraw(); @@ -20,4 +22,6 @@ extern DirectDraw7 DirectDraw; extern DirectDrawSurface7 PrimarySurface; extern DirectX7 DirectX; +#endif + #endif /* DIRECTDRAWGLOBALS_H */ diff --git a/src/game_sp/DirectXGlobals.c b/src/game_sp/DirectXGlobals.c index 9478bef4..378903d2 100644 --- a/src/game_sp/DirectXGlobals.c +++ b/src/game_sp/DirectXGlobals.c @@ -8,6 +8,8 @@ // --- Option Explicit +#if 0 + DirectX7 DirectX; DirectX7 DirectXS; DirectDraw7 DDraw; @@ -17,6 +19,10 @@ DirectSound DSound; // Public DKeyboard As DirectInputDevice DirectDrawSurface7 PrimarySurface; +#endif + +#if 0 + void InitDirectX(long hWndForm, long hWndClip) { // DirectX = New DirectX7; // (handle this later, if needed) @@ -93,3 +99,4 @@ void ClipToWindow(long hWnd) // Set Pal = PrimarySurface.GetPalette() // End Sub +#endif diff --git a/src/game_sp/DirectXGlobals.h b/src/game_sp/DirectXGlobals.h index 4615d91e..d00a5a9a 100644 --- a/src/game_sp/DirectXGlobals.h +++ b/src/game_sp/DirectXGlobals.h @@ -12,6 +12,8 @@ #include "global.h" +#if 0 + extern void ClipToWindow(long hWnd); extern void InitDirectX(long hWndForm, long hWndClip); extern void ReleaseDirectDraw(); @@ -23,4 +25,6 @@ extern DirectSound DSound; extern DirectX7 DirectX; extern DirectX7 DirectXS; +#endif + #endif /* DIRECTXGLOBALS_H */ diff --git a/src/game_sp/MainForm.c b/src/game_sp/MainForm.c index a9dc22c5..4ac25f81 100644 --- a/src/game_sp/MainForm.c +++ b/src/game_sp/MainForm.c @@ -674,16 +674,26 @@ void DrawFieldNoAnimated(int X, int Y); // --- Option Explicit // --- Option Compare Text +#if 0 + long SetParent(long hWndChild, long hWndNewParent); long SetWindowLong(long hWnd, long nIndex, long dwNewLong); long GetWindowLong(long hWnd, long nIndex); +#if 0 long GetTempPath(long nBufferLength, char *lpBuffer); +#endif long GetWindowText(long hWnd, char *lpString, long cch); +#endif + +#if 0 + #define GWL_STYLE ((-16)) #define WS_CHILD (0x40000000) #define WS_POPUP (0x80000000) +#endif + // [UNCOMMENTED] Dim StretchWidth2& char *MpxBmp; diff --git a/src/game_sp/MainForm.h b/src/game_sp/MainForm.h index 0dc8547d..90db2d17 100644 --- a/src/game_sp/MainForm.h +++ b/src/game_sp/MainForm.h @@ -19,7 +19,9 @@ extern void DrawField(int X, int Y); extern void DrawFieldAnimated(int X, int Y); extern void DrawFieldNoAnimated(int X, int Y); extern void DrawSprite(int X, int Y, int SpritePos); +#if 0 extern void InvalidateRect(long XMin, long YMin, long XMax, long YMax); +#endif extern void Let_PanelVisible(boolean NewVal); extern void ReLoadStretchSprites(); extern void SaveSnapshot(currency Number); diff --git a/src/game_sp/Sound.c b/src/game_sp/Sound.c index 4bb52084..b17c4193 100644 --- a/src/game_sp/Sound.c +++ b/src/game_sp/Sound.c @@ -11,6 +11,8 @@ int MusicOnFlag; int FXOnFlag; +#if 0 + DirectSoundBuffer ZonkFX[1 + 1]; DirectSoundBuffer InfotronFX[1 + 1]; DirectSoundBuffer BugFX[1 + 1]; @@ -19,6 +21,8 @@ DirectSoundBuffer PushFX; DirectSoundBuffer ExitFX; DirectSoundBuffer BaseFX; +#endif + void LoadSoundFX() { @@ -56,6 +60,8 @@ void LoadSoundFX() void subSoundFXZonk() { +#if 0 + int i; if (FXOnFlag == 0) @@ -72,10 +78,14 @@ void subSoundFXZonk() } } } + +#endif } void subSoundFXBug() { +#if 0 + int i; if (FXOnFlag == 0) @@ -92,10 +102,14 @@ void subSoundFXBug() } } } + +#endif } void subSoundFXInfotron() { +#if 0 + int i; if (FXOnFlag == 0) @@ -112,10 +126,14 @@ void subSoundFXInfotron() } } } + +#endif } void subSoundFXExplosion() { +#if 0 + int i; if (FXOnFlag == 0) @@ -132,10 +150,14 @@ void subSoundFXExplosion() } } } + +#endif } void subSoundFXBase() { +#if 0 + if (FXOnFlag == 0) return; @@ -146,10 +168,14 @@ void subSoundFXBase() { BaseFX.Play DSBPLAY_DEFAULT; } + +#endif } void subSoundFXPush() { +#if 0 + if (FXOnFlag == 0) return; @@ -160,10 +186,14 @@ void subSoundFXPush() { PushFX.Play DSBPLAY_DEFAULT; } + +#endif } void subSoundFXExit() { +#if 0 + if (FXOnFlag == 0) return; @@ -174,6 +204,8 @@ void subSoundFXExit() { ExitFX.Play DSBPLAY_DEFAULT; } + +#endif } void subMusicInit() diff --git a/src/game_sp/TickCountObject.c b/src/game_sp/TickCountObject.c index 9c8ba48a..c3c4443e 100644 --- a/src/game_sp/TickCountObject.c +++ b/src/game_sp/TickCountObject.c @@ -23,16 +23,22 @@ #define LongMin (-(double)2147483648UL) // the "#" sign is a bug of the VB environment AutoFormat function but causes no real problems; don't worry 'bout it! #define LongMax (2147483647UL) -long GetTickCount(); +#if 0 + +long MyGetTickCount(); long QueryPerformanceCounter(currency lpPerformanceCount); long QueryPerformanceFrequency(currency lpFrequency); +#endif + boolean DelayLoopActive; boolean MPause, bHighPerf; currency PFreq; // LARGE_INTEGER double sFactor, msFactor, usFactor; +#if 0 + boolean TickCountObject_Get_Active() { boolean Active; @@ -99,7 +105,7 @@ currency TickCountObject_Get_TickNow() } else { - TickNow = GetTickCount(); + TickNow = MyGetTickCount(); } return TickNow; @@ -119,7 +125,7 @@ long TickCountObject_TickDiffS(currency TickStart) } else { - NewTick = GetTickCount(); + NewTick = MyGetTickCount(); if (NewTick < TickStart) { // Overflow occured and needs to be handled @@ -150,7 +156,7 @@ long TickCountObject_TickDiffMS(currency TickStart) } else { - NewTick = GetTickCount(); + NewTick = MyGetTickCount(); if (NewTick < TickStart) { // Overflow occured and needs to be handled @@ -179,7 +185,7 @@ currency TickCountObject_TickDiffUS(currency TickStart) } else { - NewTick = GetTickCount(); + NewTick = MyGetTickCount(); if (NewTick < TickStart) { // Overflow occured and needs to be handled @@ -194,6 +200,8 @@ currency TickCountObject_TickDiffUS(currency TickStart) return TickDiffUS; } +#endif + #if 0 static void Class_Initialize() diff --git a/src/game_sp/TopMost.c b/src/game_sp/TopMost.c index 319f0ea0..82b7cf50 100644 --- a/src/game_sp/TopMost.c +++ b/src/game_sp/TopMost.c @@ -4,6 +4,8 @@ #include "TopMost.h" +#if 0 + // static char *VB_Name = "TopMost_Module"; // --- Option Explicit // --- const int SWP_FRAMECHANGED = 0x20; @@ -49,3 +51,4 @@ void HideWindow(long hWnd) i = SetWindowPos(hWnd, HWND_BOTTOM, 100, 100, 200, 200, SWP_HIDEWINDOW); } +#endif diff --git a/src/game_sp/TopMost.h b/src/game_sp/TopMost.h index 3543239a..4eb6f24d 100644 --- a/src/game_sp/TopMost.h +++ b/src/game_sp/TopMost.h @@ -12,6 +12,8 @@ #include "global.h" +#if 0 + #define HWND_BOTTOM (1) #define HWND_BROADCAST (0xFFFF) #define HWND_DESKTOP (0) @@ -35,4 +37,6 @@ extern void HideWindow(long hWnd); extern void TopMost(Object obj); extern void UnTopMost(Object obj); +#endif + #endif /* TOPMOST_H */ diff --git a/src/game_sp/vb_defs.h b/src/game_sp/vb_defs.h index 47ea35be..b25d1570 100644 --- a/src/game_sp/vb_defs.h +++ b/src/game_sp/vb_defs.h @@ -71,6 +71,8 @@ #define DDERR_UNSUPPORTED (VALUE_START_DD_ERR + 17) #define DDERR_WASSTILLDRAWING (VALUE_START_DD_ERR + 18) +#if 0 + #define DSSCL_PRIORITY (VALUE_START_DS + 1) #define DSBCAPS_CTRLFREQUENCY (VALUE_START_DS + 2) #define DSBCAPS_CTRLPAN (VALUE_START_DS + 3) @@ -80,4 +82,6 @@ #define DSBSTATUS_PLAYING (VALUE_START_DS + 7) #define DSBPLAY_DEFAULT (VALUE_START_DS + 8) +#endif + #endif /* VB_DEFS_H */ diff --git a/src/game_sp/vb_lib.c b/src/game_sp/vb_lib.c index c2a9fcee..9381b660 100644 --- a/src/game_sp/vb_lib.c +++ b/src/game_sp/vb_lib.c @@ -197,7 +197,7 @@ int FileLen(char *a) } } -long GetTickCount() +long MyGetTickCount() { return random_linux_libc(RANDOM_SIMPLE); } @@ -217,7 +217,11 @@ void SaveSetting(const char * a, const char *b, char *c, int d) return; } +#if 0 + long GetTempPath(long a, char *b) { return 0; } + +#endif diff --git a/src/game_sp/vb_lib.h b/src/game_sp/vb_lib.h index 97340ec8..1c2c2ba7 100644 --- a/src/game_sp/vb_lib.h +++ b/src/game_sp/vb_lib.h @@ -50,7 +50,7 @@ extern char *Hex(int); extern int FileLen(char *); -extern long GetTickCount(); +extern long MyGetTickCount(); extern int GetAttr(char *); @@ -58,6 +58,8 @@ extern void DoEvents(); extern void SaveSetting(const char *, const char *, char *, int); +#if 0 extern long GetTempPath(long, char *); +#endif #endif /* VB_LIB_H */ diff --git a/src/game_sp/vb_types.h b/src/game_sp/vb_types.h index f2fb53ce..ceabb274 100644 --- a/src/game_sp/vb_types.h +++ b/src/game_sp/vb_types.h @@ -34,7 +34,7 @@ typedef struct int top; int right; int bottom; -} RECT; +} MyRECT; #define HAS_RECT #endif @@ -105,9 +105,9 @@ typedef struct boolean (*isLost)(void); void (*GetSurfaceDesc)(DDSURFACEDESC2); void (*SetClipper)(DirectDrawClipper); - // long (*Blt)(RECT, DirectDrawSurface7, RECT, int); - long (*Blt)(RECT, void *, RECT, int); - void (*BltColorFill)(RECT, int); + // long (*Blt)(MyRECT, DirectDrawSurface7, MyRECT, int); + long (*Blt)(MyRECT, void *, MyRECT, int); + void (*BltColorFill)(MyRECT, int); } DirectDrawSurface7; typedef struct @@ -124,6 +124,8 @@ typedef struct int lFlags; } DSBUFFERDESC; +#if 0 + typedef struct { int nFormatTag; @@ -150,9 +152,11 @@ typedef struct { DirectDraw7 (*DirectDrawCreate)(char *); DirectSound (*DirectSoundCreate)(char *); - void (*GetWindowRect)(long, RECT); + void (*GetWindowRect)(long, MyRECT); } DirectX7; +#endif + typedef struct { int Left; -- 2.34.1