From efbb4c54eedb1d408a3cd9657556c14ec1042752 Mon Sep 17 00:00:00 2001 From: Viktor Szakats Date: Sat, 21 Jun 2008 15:27:07 +0000 Subject: [PATCH] 2008-06-21 17:23 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/hbw32ddr/Makefile ! Fixed to compile with GNU make. ! Found a way to compile with MingW. [TOMERGE 1.0.0RC1] * contrib/hbtpathy/Makefile ! Fixed to work at all. [TOMERGE 1.0.0RC1] * contrib/Makefile * contrib/gtwvg/Makefile * contrib/hbbmcdx/Makefile * contrib/hbodbc/Makefile * contrib/hbtip/Makefile * contrib/hbw32/Makefile * contrib/hbw32ddr/Makefile * contrib/hbwhat32/Makefile * contrib/rddads/Makefile + Platform/compiler checks moved to the contrib level Makefiles instead of being in /contrib/Makefile. This way it's modular, anyone can easily find out any platform/compiler dependencies and the central Makefile is easier to manage since it's global for all platforms/compilers. As a side effect HB_WITHOUT_ODBC, HB_WITHOUT_ADS now behaves similarly on all platforms. ; Work in progress. The goal is to be safe to include all contribs in /contrib/Makefile. - contrib/hbw32ddr/w32_ddrw.h * contrib/hbw32ddr/w32_ddrw.cpp * Cleanups, removing unneeded fluffs. [TOMERGE 1.0.0RC1] * contrib/hbziparch/make_b32_dll.mak - Removed many unneeded command line switches. ; This make file should better be standardized. * contrib/hbziparch/Makefile - Removed many unneeded command line switches. --- harbour/ChangeLog | 42 ++ harbour/contrib/Makefile | 27 +- harbour/contrib/gtwvg/Makefile | 4 + harbour/contrib/hbbmcdx/Makefile | 4 + harbour/contrib/hbodbc/Makefile | 4 + harbour/contrib/hbtip/Makefile | 4 + harbour/contrib/hbtpathy/Makefile | 13 +- harbour/contrib/hbw32/Makefile | 4 + harbour/contrib/hbw32ddr/Makefile | 11 +- harbour/contrib/hbw32ddr/w32_ddrw.cpp | 714 +++++++++++---------- harbour/contrib/hbw32ddr/w32_ddrw.h | 67 -- harbour/contrib/hbwhat32/Makefile | 4 + harbour/contrib/hbziparch/Makefile | 5 +- harbour/contrib/hbziparch/make_b32_dll.mak | 4 +- harbour/contrib/rddads/Makefile | 4 + 15 files changed, 458 insertions(+), 453 deletions(-) delete mode 100644 harbour/contrib/hbw32ddr/w32_ddrw.h diff --git a/harbour/ChangeLog b/harbour/ChangeLog index 92a46996c3..62ab42b2d1 100644 --- a/harbour/ChangeLog +++ b/harbour/ChangeLog @@ -8,6 +8,48 @@ 2008-12-31 13:59 UTC+0100 Foo Bar */ +2008-06-21 17:23 UTC+0200 Viktor Szakats (harbour.01 syenar hu) + * contrib/hbw32ddr/Makefile + ! Fixed to compile with GNU make. + ! Found a way to compile with MingW. + [TOMERGE 1.0.0RC1] + + * contrib/hbtpathy/Makefile + ! Fixed to work at all. + [TOMERGE 1.0.0RC1] + + * contrib/Makefile + * contrib/gtwvg/Makefile + * contrib/hbbmcdx/Makefile + * contrib/hbodbc/Makefile + * contrib/hbtip/Makefile + * contrib/hbw32/Makefile + * contrib/hbw32ddr/Makefile + * contrib/hbwhat32/Makefile + * contrib/rddads/Makefile + + Platform/compiler checks moved to the contrib level + Makefiles instead of being in /contrib/Makefile. + This way it's modular, anyone can easily find out + any platform/compiler dependencies and the central + Makefile is easier to manage since it's global for all + platforms/compilers. + As a side effect HB_WITHOUT_ODBC, HB_WITHOUT_ADS now + behaves similarly on all platforms. + ; Work in progress. The goal is to be safe to include + all contribs in /contrib/Makefile. + + - contrib/hbw32ddr/w32_ddrw.h + * contrib/hbw32ddr/w32_ddrw.cpp + * Cleanups, removing unneeded fluffs. + [TOMERGE 1.0.0RC1] + + * contrib/hbziparch/make_b32_dll.mak + - Removed many unneeded command line switches. + ; This make file should better be standardized. + + * contrib/hbziparch/Makefile + - Removed many unneeded command line switches. + 2008-06-21 16:22 UTC+0200 Viktor Szakats (harbour.01 syenar hu) * contrib/hbfbird/firebird.c ! Fixed two bugs signaled by GCC 4.30. diff --git a/harbour/contrib/Makefile b/harbour/contrib/Makefile index a2fb518217..507d4483e8 100644 --- a/harbour/contrib/Makefile +++ b/harbour/contrib/Makefile @@ -5,6 +5,8 @@ ROOT = ../ DIRS=\ + gtwvg \ + hbbmcdx \ hbbtree \ hbct \ hbgt \ @@ -12,41 +14,24 @@ DIRS=\ hbnf \ hbclipsm \ hbvpdf \ - xhb \ hbmzip \ + hbtip \ + xhb \ # examples \ - -ifneq ($(HB_ARCHITECTURE),dos) -DIRS += hbbmcdx -endif - ifeq ($(HB_ARCHITECTURE),w32) -DIRS += rddads gtwvg +DIRS += rddads ifneq ($(HB_COMPILER),rsxnt) DIRS += hbw32 hbodbc rddado endif endif -ifeq ($(HB_COMPILER),icc) -DIRS += hbgf/os2pm -else ifeq ($(HB_ARCHITECTURE),os2) DIRS += hbgf/os2pm endif -endif ifeq ($(HB_ARCHITECTURE),linux) -ifneq ($(HB_WITHOUT_ODBC),yes) -DIRS += hbodbc -endif -ifneq ($(HB_WITHOUT_ADS),yes) -DIRS += rddads -endif -endif - -ifneq ($(HB_ARCHITECTURE),dos) -DIRS += hbtip +DIRS += rddads hbodbc endif ifneq ($(HB_CONTRIBLIBS),) diff --git a/harbour/contrib/gtwvg/Makefile b/harbour/contrib/gtwvg/Makefile index a7bad6d96e..86d7d7b84d 100644 --- a/harbour/contrib/gtwvg/Makefile +++ b/harbour/contrib/gtwvg/Makefile @@ -2,6 +2,8 @@ # $Id$ # +ifeq ($(HB_ARCHITECTURE),w32) + ROOT = ../../ C_SOURCES=\ @@ -22,3 +24,5 @@ PRG_HEADERS=\ LIBNAME=gtwvg include $(TOP)$(ROOT)config/lib.cf + +endif diff --git a/harbour/contrib/hbbmcdx/Makefile b/harbour/contrib/hbbmcdx/Makefile index 3fea8982b1..a2f5d56807 100644 --- a/harbour/contrib/hbbmcdx/Makefile +++ b/harbour/contrib/hbbmcdx/Makefile @@ -2,6 +2,8 @@ # $Id$ # +ifneq ($(HB_ARCHITECTURE),dos) + ROOT = ../../ C_SOURCES=\ @@ -11,3 +13,5 @@ C_SOURCES=\ LIBNAME=hbbmcdx include $(TOP)$(ROOT)config/lib.cf + +endif diff --git a/harbour/contrib/hbodbc/Makefile b/harbour/contrib/hbodbc/Makefile index 15a0efc895..123405ea00 100644 --- a/harbour/contrib/hbodbc/Makefile +++ b/harbour/contrib/hbodbc/Makefile @@ -2,6 +2,8 @@ # $Id$ # +ifneq ($(HB_WITHOUT_ODBC),yes) + ROOT = ../../ C_SOURCES= \ @@ -17,3 +19,5 @@ PRG_HEADERS=\ LIBNAME=hbodbc include $(TOP)$(ROOT)config/lib.cf + +endif diff --git a/harbour/contrib/hbtip/Makefile b/harbour/contrib/hbtip/Makefile index 5e8b91f013..21c09236c9 100644 --- a/harbour/contrib/hbtip/Makefile +++ b/harbour/contrib/hbtip/Makefile @@ -2,6 +2,8 @@ # $Id$ # +ifneq ($(HB_ARCHITECTURE),dos) + ROOT = ../../ C_SOURCES = \ @@ -34,3 +36,5 @@ PRG_HEADERS= \ LIBNAME=hbtip include $(TOP)$(ROOT)config/lib.cf + +endif diff --git a/harbour/contrib/hbtpathy/Makefile b/harbour/contrib/hbtpathy/Makefile index 7db0d7044e..0a1e7a419f 100644 --- a/harbour/contrib/hbtpathy/Makefile +++ b/harbour/contrib/hbtpathy/Makefile @@ -9,15 +9,22 @@ ifneq ($(HB_ARCHITECTURE),dos) ifeq ($(HB_ARCHITECTURE),linux) C_SOURCES=\ tplinux.c \ -else ($(HB_ARCHITECTURE),win32) + tpcommon.c \ + +endif +ifeq ($(HB_ARCHITECTURE),win32) C_SOURCES=\ tpwin32.c \ -else + tpcommon.c \ + +endif +ifeq ($(HB_ARCHITECTURE),os2) C_SOURCES=\ tpos2.c \ -endif tpcommon.c \ +endif + PRG_SOURCES=\ telepath.prg \ diff --git a/harbour/contrib/hbw32/Makefile b/harbour/contrib/hbw32/Makefile index bbe266e51a..798557c5a7 100644 --- a/harbour/contrib/hbw32/Makefile +++ b/harbour/contrib/hbw32/Makefile @@ -2,6 +2,8 @@ # $Id$ # +ifeq ($(HB_ARCHITECTURE),w32) + ROOT = ../../ C_SOURCES=\ @@ -22,3 +24,5 @@ PRG_HEADERS = \ LIBNAME=hbw32 include $(TOP)$(ROOT)config/lib.cf + +endif diff --git a/harbour/contrib/hbw32ddr/Makefile b/harbour/contrib/hbw32ddr/Makefile index 5802702a00..90ef254627 100644 --- a/harbour/contrib/hbw32ddr/Makefile +++ b/harbour/contrib/hbw32ddr/Makefile @@ -2,9 +2,14 @@ # $Id$ # +# Needs Windows official ddraw.h to be copied to this directory, +# in order to compile under MingW. [vszakats] + +ifeq ($(HB_ARCHITECTURE),w32) + ROOT = ../../ -C_SOURCES=\ +CPP_SOURCES=\ w32_ddrw.cpp \ PRG_SOURCES=\ @@ -12,3 +17,7 @@ PRG_SOURCES=\ LIBNAME=hbw32ddr include $(TOP)$(ROOT)config/lib.cf + +CFLAGS := $(CFLAGS) -I. + +endif diff --git a/harbour/contrib/hbw32ddr/w32_ddrw.cpp b/harbour/contrib/hbw32ddr/w32_ddrw.cpp index 2c4932f94e..48b9ea1de1 100644 --- a/harbour/contrib/hbw32ddr/w32_ddrw.cpp +++ b/harbour/contrib/hbw32ddr/w32_ddrw.cpp @@ -27,11 +27,14 @@ #define INITGUID -#include "w32_ddrw.h" +#define HB_OS_WIN_32_USED -HB_EXTERN_BEGIN +#include "hbapi.h" +#include "hbvm.h" -BOOL hb_dd_g_handling_events = FALSE; // painting? +/* DDraw initialize */ + +#include "ddraw.h" #define HB_DD_TIMER_ID 1 #define HB_DD_TIMER_RATE 100 @@ -39,11 +42,11 @@ BOOL hb_dd_g_handling_events = FALSE; // painting? // DDRAW MANAGEMENT // Global Data -LPDIRECTDRAW4 hb_dd_g_pDD = NULL; // DirectDraw object -HWND hb_dd_g_DDHwnd; // Our hWnd - -long hb_dd_g_xWindow = 0; -long hb_dd_g_yWindow = 0; +BOOL hb_dd_g_handling_events = FALSE; // painting? +LPDIRECTDRAW4 hb_dd_g_pDD = NULL; // DirectDraw object +HWND hb_dd_g_DDHwnd; // Our hWnd +long hb_dd_g_xWindow = 0; +long hb_dd_g_yWindow = 0; //------------------------------------------------------------------------------// // Management Structs for surfaces... @@ -52,7 +55,7 @@ long hb_dd_g_yWindow = 0; LPDIRECTDRAWSURFACE4 hb_dd_g_DDSFaces[ MAX_DDSURFACES + 1 ]; -long hb_dd_g_DDSFaceCount=0; +long hb_dd_g_DDSFaceCount = 0; //------------------------------------------------------------------------------// // Sprites Management @@ -100,203 +103,36 @@ long hb_dd_g_SpritesCount = 0; short int hb_dd_g_KeyDown[ 256 ]; -HB_FUNC( DD_ISKEYPRESSED ) -{ - if( hb_dd_g_KeyDown[ hb_parnl( 1 ) ] ) - hb_retl( 1 ); - else - hb_retl( 0 ); -} - //------------------------------------------------------------------// -HB_FUNC( DD_SPGETXY ) +long hb_dd_checkError( HRESULT hr ) { - // This function is Broken ( hb_stornl fail ); + long p = 0; - long n = hb_parnl( 1 ); - - hb_reta( 2 ); - - hb_stornl( hb_dd_Sprites[ n ].x, -1, 0 ); - hb_stornl( hb_dd_Sprites[ n ].y, -1, 1 ); -} - -HB_FUNC( DD_SPGETX ) -{ - hb_retnl( hb_dd_Sprites[ hb_parnl( 1 ) ].x ); -} - -HB_FUNC( DD_SPGETY ) -{ - hb_retnl( hb_dd_Sprites[ hb_parnl( 1 ) ].y ); -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPGETVISIBLE ) -{ - hb_retl( hb_dd_Sprites[ hb_parnl( 1 ) ].Visible ); -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPSETVISIBLE ) -{ - hb_dd_Sprites[ hb_parnl( 1 ) ].Visible = ( int ) hb_parl( 2 ); -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPONRENDER ) -{ - hb_dd_Sprites[ hb_parnl( 1 ) ].OnRender = hb_strdup( hb_parc(1) ); -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPCLEARDIRECTION ) -{ - long n = hb_parnl( 1 ); - hb_dd_Sprites[ n ].xIncrement = 0; - hb_dd_Sprites[ n ].yIncrement = 0; - hb_dd_Sprites[ n ].Direction = -1; -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPSETSOLID ) -{ - hb_dd_Sprites[hb_parnl( 1 ) ].Solid = hb_parl( 2 ); -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPSETMASKED ) -{ - hb_dd_Sprites[hb_parnl( 1 ) ].Masked = hb_parl( 2 ); -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPSETDIRECTION ) -{ - long n = hb_parnl( 1 ); - - hb_dd_Sprites[ n ].Direction = hb_parnl( 2 ); - hb_dd_Sprites[ n ].xIncrement += hb_parnl( 3 ); - hb_dd_Sprites[ n ].yIncrement += hb_parnl( 4 ); -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPONFIRSTFRAME ) -{ - long n = hb_parnl( 1 ); - hb_dd_Sprites[ n ].OnFirstFrame = hb_strdup( hb_parc(2) ); -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPONOUTSCREEN ) -{ - long n = hb_parnl( 1 ); - hb_dd_Sprites[ n ].OnOutScreen = hb_strdup( hb_parc(2) ); -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPONCOLLISION ) -{ - long n = hb_parnl( 1 ); - hb_dd_Sprites[ n ].OnCollision = hb_strdup( hb_parc(2) ); - hb_dd_Sprites[ n ].lCollision = 1; -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_CREATESPRITE ) -{ - long n = hb_dd_g_SpritesCount; - - ZeroMemory( &hb_dd_Sprites[ n ], sizeof( struct st_Sprites ) ); - - hb_dd_Sprites[ n ].Surface = hb_parnl( 1 ); - hb_dd_Sprites[ n ].cName = hb_strdup( hb_parc( 2 ) ); - hb_dd_Sprites[ n ].Width = hb_parnl( 3 ); - hb_dd_Sprites[ n ].Height = hb_parnl( 4 ); - hb_dd_Sprites[ n ].Images = hb_parnl( 5 ); - hb_dd_Sprites[ n ].zOrder = hb_parnl( 6 ); - hb_dd_Sprites[ n ].Visible = hb_parl( 7 ); - hb_dd_Sprites[ n ].FrameSpeed = hb_parnl( 8 ); - - hb_dd_g_SpritesCount++; - - hb_retnl( n ); -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPSETXY ) -{ - long n = hb_parnl( 1 ); - long x = hb_parnl( 2 ); - long y = hb_parnl( 3 ); - hb_dd_Sprites[ n ].x = x; - hb_dd_Sprites[ n ].y = y; -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_SPSETINVERTED ) -{ - LPDIRECTDRAWSURFACE4 pdds; - long n = hb_parnl( 1 ); - RECT rt; - DDBLTFX todo; - - long dir = hb_parnl( 2 ); - if( dir != hb_dd_Sprites[ n ].DrawInverted ) + switch( hr ) { - rt.top = 0; - rt.left = 0; - rt.bottom= hb_dd_Sprites[ n ].Height; - rt.right = hb_dd_Sprites[ n ].Width * hb_dd_Sprites[ n ].Images; - ZeroMemory( &todo, sizeof( DDBLTFX ) ); - - hb_dd_Sprites[ n ].DrawInverted = dir; - todo.dwSize = sizeof( DDBLTFX ); - todo.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT; - pdds = hb_dd_g_DDSFaces[ hb_dd_Sprites[ n ].Surface ]; - pdds->Blt(&rt, pdds, &rt, DDBLT_DDFX ,&todo ); + case DDERR_EXCEPTION : p++;break; + case DDERR_GENERIC : p++;break; + case DDERR_INVALIDOBJECT : p++;break; + case DDERR_INVALIDPARAMS : p++;break; + case DDERR_INVALIDRECT : p++;break; + case DDERR_NOBLTHW : p++;break; + case DDERR_SURFACEBUSY : p++;break; + case DDERR_SURFACELOST : p++;break; + case DDERR_UNSUPPORTED : p++;break; + case DDERR_WASSTILLDRAWING : p++;break; + case DDERR_NOOVERLAYHW : p++;break; + case DDERR_NOTAOVERLAYSURFACE : p++;break; + case DDERR_INVALIDSURFACETYPE : p++;break; } + + return p; } - -//------------------------------------------------------------------// - -HB_FUNC( DD_MSGBOX ) +void hb_dd_g_Error( char *, long , char *) { - char *m1; - char *m2; - char deftitle [100] = ""; - char defmsg [2] = ""; - - if( hb_pcount() > 0 ) - m1 = hb_parc( 1 ); - else - m1 = defmsg; - - if( hb_pcount() > 1 ) - m2 = hb_parc( 2 ); - else - m2 = deftitle; - - MessageBox( hb_dd_g_DDHwnd, m1, m2, NULL); } -//------------------------------------------------------------------// - void hb_dd_WinError( void ) { LPVOID lpMsgBuf;FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | @@ -312,6 +148,32 @@ void hb_dd_WinError( void ) //------------------------------------------------------------------// +void hb_dd_ReleaseAllObjects(void) +{ + long t; + if( hb_dd_g_pDD != NULL ) + { + if( hb_dd_g_DDSFaces[ 0 ] != NULL ) + { + hb_dd_g_DDSFaces[ 0 ]->Release(); + hb_dd_g_DDSFaces[ 0 ] = NULL; + } + + for( t = 2; t < MAX_DDSURFACES; t++ ) + { + if( hb_dd_g_DDSFaces[ t ] != NULL ) + { + hb_dd_g_DDSFaces[ t ]->Release(); + hb_dd_g_DDSFaces[ t ] = NULL; + } + } + hb_dd_g_pDD->Release(); + hb_dd_g_pDD = NULL; + } +} + +//------------------------------------------------------------------// + DWORD hb_dd_DDColorMatch(IDirectDrawSurface4 * pdds, COLORREF rgb) { COLORREF rgbT; @@ -574,43 +436,6 @@ long _stdcall hb_dd_DDWndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lPara //------------------------------------------------------------------// -HB_FUNC( DD_CREATEWINDOW ) -{ - HWND m_hWnd; - HINSTANCE m_hInstance = GetModuleHandle(NULL); - long x,y; - - x= hb_pcount() > 10 ?hb_parnl( 1 ) : GetSystemMetrics(SM_CXSCREEN); - y= hb_pcount() > 11 ?hb_parnl( 2 ) : GetSystemMetrics(SM_CYSCREEN); - - hb_dd_g_xWindow = x; - hb_dd_g_yWindow = y; - - - WNDCLASS wndClass = { CS_HREDRAW | CS_VREDRAW, hb_dd_DDWndProc, 0, 0, m_hInstance, - NULL, - LoadCursor(NULL, IDC_ARROW), - (HBRUSH)GetStockObject(BLACK_BRUSH), - NULL, - TEXT("4dNow") }; - - RegisterClass( &wndClass ); - - m_hWnd = CreateWindow( TEXT("4dNow"), TEXT("4dNow"), - WS_POPUP, 0, - 0, x,y, NULL, NULL, m_hInstance, 0L ); - - if( !m_hWnd ) - hb_dd_WinError(); - - ShowWindow( m_hWnd,SW_SHOWMAXIMIZED ); - - hb_dd_DDrawStartup( m_hWnd ); - hb_retnl( ( long ) m_hWnd ); -} - -//------------------------------------------------------------------// - int hb_dd_InitFail( HWND hWnd, HRESULT hRet, LPCTSTR szError, ... ) { char szBuff[ 128 ]; @@ -626,63 +451,6 @@ int hb_dd_InitFail( HWND hWnd, HRESULT hRet, LPCTSTR szError, ... ) //------------------------------------------------------------------// -HB_FUNC( DD_LOADBMPINTOSURFACE ) -{ - long nSurface = hb_parnl( 1 ); - char * cBitmap = hb_parc ( 2 ); - long x = hb_parnl( 3 ); - long y = hb_parnl( 4 ); - long dx = hb_parnl( 5 ); - long dy = hb_parnl( 6 ); - - HBITMAP hbm; - - // Load our bitmap resource. - - hbm = (HBITMAP) LoadImage(GetModuleHandle(NULL), cBitmap, IMAGE_BITMAP, 0, - 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE); - - if( hbm == NULL ) - hb_dd_g_Error( "Can't load Bitmap.",100,cBitmap ); - - if( hb_dd_g_DDSFaces[ nSurface ] == NULL ) - hb_dd_g_Error( "Invalid Surface",nSurface,"LoadBmpIntoSurface"); - - if( DD_OK != hb_dd_DDCopyBitmap( hb_dd_g_DDSFaces[ nSurface ], hbm, x,y, dx, dy ) ) - hb_dd_g_Error( "DDCopyBitmap",nSurface,"LoadBmpIntoSurface"); - - DeleteObject( hbm ); -} - -//------------------------------------------------------------------// - -HB_FUNC( DD_CREATEOFFSCREENBITMAP ) -{ - DDSURFACEDESC2 ddsd; - HRESULT hRet; - - if( ! hb_dd_g_pDD ) - hb_dd_g_Error("No DDraw Initialized",1000,""); - - if( hb_dd_g_DDSFaceCount >= MAX_DDSURFACES ) - hb_dd_g_Error( "No more DDSurfaces -> Limit reached -> CreateDDSurface()",1000,"DDraw extend sys"); - else - { - ZeroMemory(&ddsd, sizeof(ddsd)); - ddsd.dwSize = sizeof(ddsd); - ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH ; - ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; - ddsd.dwHeight = hb_dd_g_yWindow; - ddsd.dwWidth = hb_dd_g_xWindow; - hRet = hb_dd_g_pDD->CreateSurface(&ddsd, &hb_dd_g_DDSFaces[ hb_dd_g_DDSFaceCount ], NULL); - if( hRet != DD_OK ) - hb_dd_InitFail( hb_dd_g_DDHwnd, hRet, "CreateSurface FAILED" ); - } - - hb_retnl( hb_dd_g_DDSFaceCount ); - hb_dd_g_DDSFaceCount++; -} - //------------------------------------------------------------------// void hb_RestoreAll(void) @@ -701,32 +469,6 @@ void hb_RestoreAll(void) } } -//------------------------------------------------------------------// - -void hb_dd_ReleaseAllObjects(void) -{ - long t; - if( hb_dd_g_pDD != NULL ) - { - if( hb_dd_g_DDSFaces[ 0 ] != NULL ) - { - hb_dd_g_DDSFaces[ 0 ]->Release(); - hb_dd_g_DDSFaces[ 0 ] = NULL; - } - - for( t = 2; t < MAX_DDSURFACES; t++ ) - { - if( hb_dd_g_DDSFaces[ t ] != NULL ) - { - hb_dd_g_DDSFaces[ t ]->Release(); - hb_dd_g_DDSFaces[ t ] = NULL; - } - } - hb_dd_g_pDD->Release(); - hb_dd_g_pDD = NULL; - } -} - //------------------------------------------------------------------// @@ -789,25 +531,6 @@ void hb_dd_DDrawStartup( HWND hWnd ) hb_dd_g_DDSFaceCount = 2; } -//------------------------------------------------------------------// - -HB_FUNC( DD_STARTWINDOW ) -{ - MSG msg; - BOOL loop = TRUE; - - while( loop ) - { - if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) - { - TranslateMessage( &msg ); - DispatchMessage( &msg ); - } - if( WM_CLOSE == msg.message ) - loop = FALSE; - } -} - //------------------------------------------------------------------// HRESULT hb_dd_DDCopyBitmap(IDirectDrawSurface4 * pdds, HBITMAP hbm, int x, int y, int dx, int dy) @@ -847,32 +570,313 @@ HRESULT hb_dd_DDCopyBitmap(IDirectDrawSurface4 * pdds, HBITMAP hbm, int x, int y return hr; } -long hb_dd_checkError( HRESULT hr ) -{ - long p = 0; +//------------------------------------------------------------------// - switch( hr ) +HB_FUNC( DD_ISKEYPRESSED ) +{ + if( hb_dd_g_KeyDown[ hb_parnl( 1 ) ] ) + hb_retl( 1 ); + else + hb_retl( 0 ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPGETXY ) +{ + // This function is Broken ( hb_stornl fail ); + + long n = hb_parnl( 1 ); + + hb_reta( 2 ); + + hb_stornl( hb_dd_Sprites[ n ].x, -1, 0 ); + hb_stornl( hb_dd_Sprites[ n ].y, -1, 1 ); +} + +HB_FUNC( DD_SPGETX ) +{ + hb_retnl( hb_dd_Sprites[ hb_parnl( 1 ) ].x ); +} + +HB_FUNC( DD_SPGETY ) +{ + hb_retnl( hb_dd_Sprites[ hb_parnl( 1 ) ].y ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPGETVISIBLE ) +{ + hb_retl( hb_dd_Sprites[ hb_parnl( 1 ) ].Visible ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPSETVISIBLE ) +{ + hb_dd_Sprites[ hb_parnl( 1 ) ].Visible = ( int ) hb_parl( 2 ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPONRENDER ) +{ + hb_dd_Sprites[ hb_parnl( 1 ) ].OnRender = hb_strdup( hb_parc(1) ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPCLEARDIRECTION ) +{ + long n = hb_parnl( 1 ); + hb_dd_Sprites[ n ].xIncrement = 0; + hb_dd_Sprites[ n ].yIncrement = 0; + hb_dd_Sprites[ n ].Direction = -1; +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPSETSOLID ) +{ + hb_dd_Sprites[hb_parnl( 1 ) ].Solid = hb_parl( 2 ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPSETMASKED ) +{ + hb_dd_Sprites[hb_parnl( 1 ) ].Masked = hb_parl( 2 ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPSETDIRECTION ) +{ + long n = hb_parnl( 1 ); + + hb_dd_Sprites[ n ].Direction = hb_parnl( 2 ); + hb_dd_Sprites[ n ].xIncrement += hb_parnl( 3 ); + hb_dd_Sprites[ n ].yIncrement += hb_parnl( 4 ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPONFIRSTFRAME ) +{ + long n = hb_parnl( 1 ); + hb_dd_Sprites[ n ].OnFirstFrame = hb_strdup( hb_parc(2) ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPONOUTSCREEN ) +{ + long n = hb_parnl( 1 ); + hb_dd_Sprites[ n ].OnOutScreen = hb_strdup( hb_parc(2) ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPONCOLLISION ) +{ + long n = hb_parnl( 1 ); + hb_dd_Sprites[ n ].OnCollision = hb_strdup( hb_parc(2) ); + hb_dd_Sprites[ n ].lCollision = 1; +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_CREATESPRITE ) +{ + long n = hb_dd_g_SpritesCount; + + ZeroMemory( &hb_dd_Sprites[ n ], sizeof( struct st_Sprites ) ); + + hb_dd_Sprites[ n ].Surface = hb_parnl( 1 ); + hb_dd_Sprites[ n ].cName = hb_strdup( hb_parc( 2 ) ); + hb_dd_Sprites[ n ].Width = hb_parnl( 3 ); + hb_dd_Sprites[ n ].Height = hb_parnl( 4 ); + hb_dd_Sprites[ n ].Images = hb_parnl( 5 ); + hb_dd_Sprites[ n ].zOrder = hb_parnl( 6 ); + hb_dd_Sprites[ n ].Visible = hb_parl( 7 ); + hb_dd_Sprites[ n ].FrameSpeed = hb_parnl( 8 ); + + hb_dd_g_SpritesCount++; + + hb_retnl( n ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPSETXY ) +{ + long n = hb_parnl( 1 ); + long x = hb_parnl( 2 ); + long y = hb_parnl( 3 ); + hb_dd_Sprites[ n ].x = x; + hb_dd_Sprites[ n ].y = y; +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_SPSETINVERTED ) +{ + LPDIRECTDRAWSURFACE4 pdds; + long n = hb_parnl( 1 ); + RECT rt; + DDBLTFX todo; + + long dir = hb_parnl( 2 ); + if( dir != hb_dd_Sprites[ n ].DrawInverted ) { - case DDERR_EXCEPTION : p++;break; - case DDERR_GENERIC : p++;break; - case DDERR_INVALIDOBJECT : p++;break; - case DDERR_INVALIDPARAMS : p++;break; - case DDERR_INVALIDRECT : p++;break; - case DDERR_NOBLTHW : p++;break; - case DDERR_SURFACEBUSY : p++;break; - case DDERR_SURFACELOST : p++;break; - case DDERR_UNSUPPORTED : p++;break; - case DDERR_WASSTILLDRAWING : p++;break; - case DDERR_NOOVERLAYHW : p++;break; - case DDERR_NOTAOVERLAYSURFACE : p++;break; - case DDERR_INVALIDSURFACETYPE : p++;break; + rt.top = 0; + rt.left = 0; + rt.bottom= hb_dd_Sprites[ n ].Height; + rt.right = hb_dd_Sprites[ n ].Width * hb_dd_Sprites[ n ].Images; + ZeroMemory( &todo, sizeof( DDBLTFX ) ); + + hb_dd_Sprites[ n ].DrawInverted = dir; + todo.dwSize = sizeof( DDBLTFX ); + todo.dwDDFX = DDBLTFX_MIRRORLEFTRIGHT; + pdds = hb_dd_g_DDSFaces[ hb_dd_Sprites[ n ].Surface ]; + pdds->Blt(&rt, pdds, &rt, DDBLT_DDFX ,&todo ); + } +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_MSGBOX ) +{ + char *m1; + char *m2; + char deftitle [100] = ""; + char defmsg [2] = ""; + + if( hb_pcount() > 0 ) + m1 = hb_parc( 1 ); + else + m1 = defmsg; + + if( hb_pcount() > 1 ) + m2 = hb_parc( 2 ); + else + m2 = deftitle; + + MessageBox( hb_dd_g_DDHwnd, m1, m2, NULL); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_CREATEWINDOW ) +{ + HWND m_hWnd; + HINSTANCE m_hInstance = GetModuleHandle(NULL); + long x,y; + + x= hb_pcount() > 10 ?hb_parnl( 1 ) : GetSystemMetrics(SM_CXSCREEN); + y= hb_pcount() > 11 ?hb_parnl( 2 ) : GetSystemMetrics(SM_CYSCREEN); + + hb_dd_g_xWindow = x; + hb_dd_g_yWindow = y; + + + WNDCLASS wndClass = { CS_HREDRAW | CS_VREDRAW, hb_dd_DDWndProc, 0, 0, m_hInstance, + NULL, + LoadCursor(NULL, IDC_ARROW), + (HBRUSH)GetStockObject(BLACK_BRUSH), + NULL, + TEXT("4dNow") }; + + RegisterClass( &wndClass ); + + m_hWnd = CreateWindow( TEXT("4dNow"), TEXT("4dNow"), + WS_POPUP, 0, + 0, x,y, NULL, NULL, m_hInstance, 0L ); + + if( !m_hWnd ) + hb_dd_WinError(); + + ShowWindow( m_hWnd,SW_SHOWMAXIMIZED ); + + hb_dd_DDrawStartup( m_hWnd ); + hb_retnl( ( long ) m_hWnd ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_LOADBMPINTOSURFACE ) +{ + long nSurface = hb_parnl( 1 ); + char * cBitmap = hb_parc ( 2 ); + long x = hb_parnl( 3 ); + long y = hb_parnl( 4 ); + long dx = hb_parnl( 5 ); + long dy = hb_parnl( 6 ); + + HBITMAP hbm; + + // Load our bitmap resource. + + hbm = (HBITMAP) LoadImage(GetModuleHandle(NULL), cBitmap, IMAGE_BITMAP, 0, + 0, LR_CREATEDIBSECTION | LR_LOADFROMFILE); + + if( hbm == NULL ) + hb_dd_g_Error( "Can't load Bitmap.",100,cBitmap ); + + if( hb_dd_g_DDSFaces[ nSurface ] == NULL ) + hb_dd_g_Error( "Invalid Surface",nSurface,"LoadBmpIntoSurface"); + + if( DD_OK != hb_dd_DDCopyBitmap( hb_dd_g_DDSFaces[ nSurface ], hbm, x,y, dx, dy ) ) + hb_dd_g_Error( "DDCopyBitmap",nSurface,"LoadBmpIntoSurface"); + + DeleteObject( hbm ); +} + +//------------------------------------------------------------------// + +HB_FUNC( DD_CREATEOFFSCREENBITMAP ) +{ + DDSURFACEDESC2 ddsd; + HRESULT hRet; + + if( ! hb_dd_g_pDD ) + hb_dd_g_Error("No DDraw Initialized",1000,""); + + if( hb_dd_g_DDSFaceCount >= MAX_DDSURFACES ) + hb_dd_g_Error( "No more DDSurfaces -> Limit reached -> CreateDDSurface()",1000,"DDraw extend sys"); + else + { + ZeroMemory(&ddsd, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH ; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN; + ddsd.dwHeight = hb_dd_g_yWindow; + ddsd.dwWidth = hb_dd_g_xWindow; + hRet = hb_dd_g_pDD->CreateSurface(&ddsd, &hb_dd_g_DDSFaces[ hb_dd_g_DDSFaceCount ], NULL); + if( hRet != DD_OK ) + hb_dd_InitFail( hb_dd_g_DDHwnd, hRet, "CreateSurface FAILED" ); } - return p; + hb_retnl( hb_dd_g_DDSFaceCount ); + hb_dd_g_DDSFaceCount++; } -void hb_dd_g_Error( char *, long , char *) +//------------------------------------------------------------------// + +HB_FUNC( DD_STARTWINDOW ) { -} + MSG msg; + BOOL loop = TRUE; -HB_EXTERN_END + while( loop ) + { + if( PeekMessage( &msg, NULL, 0U, 0U, PM_REMOVE ) ) + { + TranslateMessage( &msg ); + DispatchMessage( &msg ); + } + if( WM_CLOSE == msg.message ) + loop = FALSE; + } +} diff --git a/harbour/contrib/hbw32ddr/w32_ddrw.h b/harbour/contrib/hbw32ddr/w32_ddrw.h deleted file mode 100644 index 1ba2da7430..0000000000 --- a/harbour/contrib/hbw32ddr/w32_ddrw.h +++ /dev/null @@ -1,67 +0,0 @@ -/* - * $Id$ - */ - -/* - * Copyright(C) 1999 by Jesus Salas - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR - * PURPOSE. See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to: - * - * The Free Software Foundation, Inc., - * 675 Mass Ave, Cambridge, MA 02139, USA. - * - * You can contact me at: jsalas@gruposp.com jsalas@sp-editores.es - * - */ - -#define INITGUID - -#include "windows.h" -#include "winuser.h" - -#include "hbapi.h" -#include "hbvm.h" - -#include "errno.h" -#include "objbase.h" -#include "tchar.h" -#include "stdio.h" -#include "math.h" -#include "string.h" -#include "stdlib.h" - -#include "ddraw.h" - -HB_EXTERN_BEGIN - -/* Main Message Loop */ - -long _stdcall hb_dd_DDWndProc( HWND , UINT , WPARAM , LPARAM ); - -/* DDraw initialize */ - -void hb_dd_DDrawStartup( HWND ); -void hb_dd_StartWindow( void ); -void hb_dd_CreateWindow( void ); -void hb_dd_CreateOffScreenBitmap( void ); -void hb_dd_ReleaseAllObjects( void ); -void hb_dd_RestoreAll( void ); -long hb_dd_checkError( HRESULT ); -HRESULT hb_dd_DDCopyBitmap( IDirectDrawSurface4 * pdds, HBITMAP hbm, int x, int y, int dx, int dy); -void hb_dd_RenderSprites( long ); -DWORD hb_dd_DDColorMatch( IDirectDrawSurface4 * pdds, COLORREF rgb ); -void hb_dd_WinError( void ); -void hb_dd_g_Error( char *, long , char *); - -HB_EXTERN_END diff --git a/harbour/contrib/hbwhat32/Makefile b/harbour/contrib/hbwhat32/Makefile index f90d178c64..535ca8c200 100644 --- a/harbour/contrib/hbwhat32/Makefile +++ b/harbour/contrib/hbwhat32/Makefile @@ -2,6 +2,8 @@ # $Id$ # +ifeq ($(HB_ARCHITECTURE),w32) + ROOT = ../../ C_SOURCES = \ @@ -82,3 +84,5 @@ PRG_HEADERS= \ LIBNAME=hbwhat32 include $(TOP)$(ROOT)config/lib.cf + +endif diff --git a/harbour/contrib/hbziparch/Makefile b/harbour/contrib/hbziparch/Makefile index 27cd607bfc..ca508b2150 100644 --- a/harbour/contrib/hbziparch/Makefile +++ b/harbour/contrib/hbziparch/Makefile @@ -47,10 +47,7 @@ include $(TOP)$(ROOT)config/header.cf INSTALL_RULE_HEADERS := $(INSTALL_RULE) include $(TOP)$(ROOT)config/lib.cf -CFLAGS := $(CFLAGS) -I../../include -DZLIB_DLL -ifeq ($(HB_ARCHITECTURE),w32) -CFLAGS += -DWIN32 -DASSERT -endif +CFLAGS := $(CFLAGS) -I../../include install:: $(INSTALL_RULE_HEADERS) diff --git a/harbour/contrib/hbziparch/make_b32_dll.mak b/harbour/contrib/hbziparch/make_b32_dll.mak index a0be651faa..7b4395533c 100644 --- a/harbour/contrib/hbziparch/make_b32_dll.mak +++ b/harbour/contrib/hbziparch/make_b32_dll.mak @@ -38,8 +38,8 @@ INCLUDE_DIR = include;..\..\include; # ßßßßßßßßßßßßßßßßßß -C_USR = -tW -DHB_FM_STATISTICS_OFF -D__WIN32__ -D__EXPORT__ -CLIBFLAGS = $(C_USR) -a8 -OS -O2 -6 -c -I$(INCLUDE_DIR) -d -w- -DZLIB_DLL +C_USR = -tW -D__WIN32__ -D__EXPORT__ +CLIBFLAGS = $(C_USR) -a8 -OS -O2 -6 -c -I$(INCLUDE_DIR) -d -w- # ÚÄÄÄÄÄÄÄÄ¿ # ³ output ³Û diff --git a/harbour/contrib/rddads/Makefile b/harbour/contrib/rddads/Makefile index 1fe5fe488e..7abc63f0cd 100644 --- a/harbour/contrib/rddads/Makefile +++ b/harbour/contrib/rddads/Makefile @@ -2,6 +2,8 @@ # $Id$ # +ifneq ($(HB_WITHOUT_ADS),yes) + ROOT = ../../ C_SOURCES=\ @@ -29,3 +31,5 @@ include $(TOP)$(ROOT)config/lib.cf install:: $(INSTALL_RULE_HEADERS) + +endif