[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[freesci-develop] r1522 - in freesci/trunk: . src/gfx/drivers src/includ
From: |
arangas |
Subject: |
[freesci-develop] r1522 - in freesci/trunk: . src/gfx/drivers src/include src/win32 |
Date: |
Sun, 05 Feb 2006 10:52:46 +0100 |
Author: arangas
Date: 2006-02-05 10:52:31 +0100 (Sun, 05 Feb 2006)
New Revision: 1522
Added:
freesci/trunk/src/include/graphics_directx.h
Removed:
freesci/trunk/src/gfx/drivers/dx_driver.h
Modified:
freesci/trunk/ChangeLog
freesci/trunk/README
freesci/trunk/README.Win32
freesci/trunk/src/gfx/drivers/dx_driver.cpp
freesci/trunk/src/gfx/drivers/gfx_drivers.c
freesci/trunk/src/include/gfx_system.h
freesci/trunk/src/win32/freesci.def
freesci/trunk/src/win32/fsci_dll.vcproj
Log:
Replaced mouse pointer code in DirectX driver. This driver should now be at the
same level as the old DirectDraw driver.
Modified: freesci/trunk/ChangeLog
===================================================================
--- freesci/trunk/ChangeLog 2006-02-05 08:27:02 UTC (rev 1521)
+++ freesci/trunk/ChangeLog 2006-02-05 09:52:31 UTC (rev 1522)
@@ -1,3 +1,18 @@
+2006-02-05 Alex Angas <address@hidden>
+
+ * src/gfx/drivers/dx_driver.cpp: Replaced mouse pointer code.
+ * src/include/graphics_directx.h: Moved from gfx/drivers/dx_driver.h.
+
+ * src/gfx/drivers/gfx_drivers.c:
+ * src/include/gfx_system.h: Removed DirectDraw driver reference.
+
+ * src/win32/fsci_dll.vcproj: Updated to fix build errors and removed
+ DirectDraw driver.
+ * src/win32/freesci.def: Updated to fix build errors.
+
+ * README: Referred option for DirectX driver to README.Win32
+ * README.Win32: Updated bits and pieces and added more info on DirectX.
+
2006-02-05 Christoph Reichenbach <address@hidden>
* src/sound/pcmout_alsa.c: ALSA pcmout now has a 'device'
Modified: freesci/trunk/README
===================================================================
--- freesci/trunk/README 2006-02-05 08:27:02 UTC (rev 1521)
+++ freesci/trunk/README 2006-02-05 09:52:31 UTC (rev 1522)
@@ -294,7 +294,7 @@
2.1.1.4 DirectX driver:
-----------------------
-The DirectX driver does not support any options at this time.
+Please see README.Win32 for details on DirectX options.
2.1.1.5 DirectFB driver:
------------------------
Modified: freesci/trunk/README.Win32
===================================================================
--- freesci/trunk/README.Win32 2006-02-05 08:27:02 UTC (rev 1521)
+++ freesci/trunk/README.Win32 2006-02-05 09:52:31 UTC (rev 1522)
@@ -7,22 +7,16 @@
* SDL fullscreen support causes gfx corruption
* SDL scaling > 3 causes gfx corruption
-New specifically to the Win32 version for this release is:
- * a DirectX 8.0a (or higher) driver, usable with the -gdirectx command line
- option (mouse support to be added soon)
-
BUILDING
--------
You will need the following libraries and tools to build FreeSCI for Win32:
- * Visual C++ 6.0 with Service Pack 5 for Visual Studio installed.
- * The latest Win32 Platform SDK, both Core and DirectX components, from:
- http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
- (No need to download the 64-bit components.)
+ * Visual C++ or Studio 6.0 with Service Pack 6 or Visual C++ or Studio 2003.
+ * The latest Win32 Platform SDK, both Core 32-bit and DirectX components from:
+ http://msdn.microsoft.com/platformsdk
* The SDL library from http://www.libsdl.org/ . You need to download the
- development library for Win32 (e.g. SDL-devel-x.y.z-VC6.zip). At the time
- of writing, this file was called SDL-devel-1.2.5a-VC6.zip.
+ development library for Win32 (e.g. SDL-devel-x.y.z-VC6.zip).
The project files assume the following directory structure:
@@ -36,8 +30,8 @@
\lib
-1. Go to the src\win32 directory and load the freesci workspace (freesci.dsw)
- into Visual C++ 6.
+1. Go to the src\win32 directory. For Visual C++ or Studio 6, load freesci.dsw.
+ For Visual C++ or Studio 2003, load freesci.sln.
2. Set the active project to "freesci - Win32 Release". Rebuild all.
@@ -46,24 +40,26 @@
4. You should be good to go! Go buy a Sierra collector's pack at your favorite
software store for $15-20 and copy the game directory on the CD to the
- FreeSCI bin directory.
+ FreeSCI bin directory, or use the -d command line option (see README).
IMPORTANT NOTE: With this release, you may discover what appears to be a bug
in Visual C++ 6.0. If you find that the linking of sciv produces LNK2001
errors the first time you build, just build again (don't rebuild or clean
-first) and it should link OK. Any solutions discovered to this problem are
-most welcome!
+first) and it should link OK.
CONFIG
------
+The configuration options described below should be put into your config file,
+located at %USERPROFILE%\.freesci\config .
+
+
GRAPHICS:
You'll probably be thinking that it doesn't look much prettier than the
-original SCI. Try putting these options into your config file
-(%WINDIR%\.freesci\config):
+original SCI. Try putting these options into your config file:
pic0_dither_mode = dither256
pic0_dither_pattern = unscaled
@@ -88,19 +84,6 @@
where x is the number of the device you wish to use.
-KNOWN PROBLEMS
---------------
-
-SOUND:
-
-There are currently timing problems when playing sound in games. While a Win32
-version of the FreeSCI (Glutton) 0.5.x series will solve these, at the moment
-we are stuck with it.
-
-To use the polled Win32 sound server, use the -Swin32p command line switch.
-To use the threaded SDL sound server, use the -Ssdl command line switch.
-
-
GRAPHICS:
The DirectX driver will run with the -gdirectx command line switch on versions
@@ -108,38 +91,40 @@
images, significant performance gains may be achieved by using a 3D graphics
card with the driver.
-The DirectX driver does not yet support mouse input.
+To change the adapter, add this line to your FreeSCI config file:
-CVS
----
+gfx.directx.adapterid = x
-This is the best way to make sure you have the latest snapshot of FreeSCI. Info
-on CVS can be obtained from http://www.cvshome.org/ .
+where x is the number associated with the adapter you want (these are listed
+on the console screen when you first start FreeSCI).
-Once you have a copy, I suggest copying it somewhere else to actually play with
-and work on, and then use the built-in diff command to submit diffs. :-)
+KNOWN PROBLEMS
+--------------
-How to set up WinCVS:
+SOUND:
-1. Download WinCVS from http://www.wincvs.org/ and install.
-2. Run it, and under Admin / Preferences... enter this for CVSROOT:
- address@hidden:/var/cvs/freesci
-3. Go to Admin / Login... and leave the password blank.
-4. Go to Create / Checkout module... and enter freesci as module name.
-5. Once it's downloaded, go to Admin / Logout.
+There are currently timing problems when playing sound in games. While FreeSCI
+(Glutton) will solve these, at the moment we are stuck with it.
+To use the polled Win32 sound server, use the -Swin32p command line switch.
+To use the threaded SDL sound server, use the -Ssdl command line switch.
-How to set up command-line CVS:
-1. Download the command-line tool from http://www.cvshome.org/ or their FTP
- server ftp://ftp.cvshome.org/pub/win32/ .
-2. Unzip it somewhere, go to the DOS prompt (or make a shortcut) and enter
- the command:
- cvs -d :pserver:address@hidden:/home/cvs -z3 co freesci
+SUBVERSION
+----------
+This is the best way to make sure you have the latest snapshot of FreeSCI. Info
+on Subversion can be obtained from http://www.subversion.org .
+Once you have a copy, we suggest copying it somewhere else to play with and
+work on, and then use a diff command to submit diffs. :-)
+
+Instructions on how to connect to our Subversion repository are available on
+the Web site.
+
+
DEBUGGING
---------
@@ -166,5 +151,3 @@
The FreeSCI Team.
http://freesci.linuxgames.com/
-
-(Last updated 18 January 2003 by Alex Angas <address@hidden>)
Modified: freesci/trunk/src/gfx/drivers/dx_driver.cpp
===================================================================
--- freesci/trunk/src/gfx/drivers/dx_driver.cpp 2006-02-05 08:27:02 UTC (rev
1521)
+++ freesci/trunk/src/gfx/drivers/dx_driver.cpp 2006-02-05 09:52:31 UTC (rev
1522)
@@ -1,5 +1,5 @@
/***************************************************************************
- dx_driver.cpp Copyright (C) 2002,2003,2005 Alexander R Angas,
+ dx_driver.cpp Copyright (C) 2002,2003,2005-6 Alexander R Angas,
Some portions Copyright (C) 1999 Dmitry Jemerov
This program may be modified and copied freely according to the terms of
@@ -25,10 +25,15 @@
History:
20051106 (AAngas) - Rewrite
+ 20060201 (AAngas) - Fixed wrong format for texture priority maps
+ 20060205 (AAngas) - Changed pointer to use D3DXSprite
+
TODO:
- Fix alpha on mouse pointer
+ Simpler alpha calculation on pointer
+ Full screen
Lost devices
+ Moving and activating window
Allow user to specify hardware or software vertex processing
Add fancies
@@ -40,7 +45,7 @@
#error NOTE: This file MUST be compiled as C++. In Visual C++, use the /Tp
command line option.
#endif
-#include "dx_driver.h"
+#include <graphics_directx.h>
#if (DIRECT3D_VERSION < 0x0800)
#error ERROR: DirectX 8 or higher is required for this driver.
@@ -69,29 +74,12 @@
// Check we haven't lost the device
if (CheckDevice(drv))
{
- // Combine primary vis with mouse pointer (if there is one)
- LPDIRECT3DSURFACE8 sbuf, dbuf;
- DODX( (dx_state->pTexVisuals[PRIMARY_VIS]->GetSurfaceLevel(0,
&sbuf)), RenderD3D );
- DODX( (dx_state->pTexPScne->GetSurfaceLevel(0, &dbuf)),
RenderD3D );
- DODX( (dx_state->pDevice->CopyRects(sbuf, NULL, 0, dbuf,
NULL)), RenderD3D );
- SAFE_RELEASE(sbuf);
-
- if (dx_state->pTexPointer)
- {
- RECT srcRect = {0, 0, dx_state->pointerDims.x,
dx_state->pointerDims.y};
- POINT pp = {drv->pointer_x, drv->pointer_y};
- DODX( (dx_state->pTexPointer->GetSurfaceLevel(0,
&sbuf)), RenderD3D );
- DODX( (dx_state->pDevice->CopyRects(sbuf, &srcRect, 1,
dbuf, &pp)), RenderD3D );
- SAFE_RELEASE(sbuf);
- }
- SAFE_RELEASE(dbuf);
-
// Begin scene
DODX( (dx_state->pDevice->Clear(0, NULL, D3DCLEAR_TARGET,
D3DCOLOR_XRGB(0,0,0), 1.0, 0)), RenderD3D );
DODX( (dx_state->pDevice->BeginScene()), RenderD3D );
// Set texture
- DODX( (dx_state->pDevice->SetTexture( 0, dx_state->pTexPScne
)), RenderD3D ); // Scene image
+ DODX( (dx_state->pDevice->SetTexture( 0,
dx_state->pTexVisuals[PRIMARY_VIS] )), RenderD3D ); // Scene image
// Set texture states for scene
DODX( (dx_state->pDevice->SetTextureStageState( 0,
D3DTSS_COLOROP, D3DTOP_MODULATE )), RenderD3D );
@@ -103,6 +91,15 @@
DODX( (dx_state->pDevice->SetVertexShader( D3DFVF_CUSTOMVERTEX
)), RenderD3D );
DODX( (dx_state->pDevice->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0,
2)), RenderD3D );
+ // Draw the pointer sprite
+ if (dx_state->pTexPointer)
+ {
+ D3DXVECTOR2 pointerPos((float)drv->pointer_x,
(float)drv->pointer_y);
+ DODX( (dx_state->pSPointer->Begin()), RenderD3D );
+ DODX( (dx_state->pSPointer->Draw(dx_state->pTexPointer,
NULL, NULL, NULL, 0.0, &pointerPos, 0xFFFFFFFF)), RenderD3D );
+ DODX( (dx_state->pSPointer->End()), RenderD3D );
+ }
+
// Present scene
DODX( (dx_state->pDevice->EndScene()), RenderD3D );
DODX( (dx_state->pDevice->Present(NULL, NULL, NULL, NULL)),
RenderD3D );
@@ -263,15 +260,7 @@
DODX((dx_state->pDevice->SetRenderState( D3DRS_LIGHTING, FALSE )),
InitScene); // Disable lighting features
DODX((dx_state->pDevice->SetRenderState( D3DRS_CULLMODE, D3DCULL_NONE
)), InitScene); // Don't cull back side of polygons
DODX((dx_state->pDevice->SetRenderState( D3DRS_ZENABLE, D3DZB_FALSE )),
InitScene); // No depth buffering
-/*
- // Set alpha blending
- DODX((dx_state->pDevice->SetRenderState( D3DRS_ALPHABLENDENABLE,
true)), InitScene);
- DODX((dx_state->pDevice->SetRenderState( D3DRS_SRCBLEND,
D3DBLEND_SRCALPHA)), InitScene); // Source blend factor
- DODX((dx_state->pDevice->SetRenderState( D3DRS_DESTBLEND,
D3DBLEND_INVSRCALPHA)), InitScene); // Dest blend factor
- DODX((dx_state->pDevice->SetTextureStageState( 0, D3DTSS_ALPHAARG1,
D3DTA_TEXTURE)), InitScene);// Set alpha from texture
-*/
-
return GFX_OK;
}
@@ -280,7 +269,7 @@
static int
dx_set_param(struct _gfx_driver *drv, char *attribute, char *value)
{
- // Full screen
+/* // Full screen
if (!strncmp(attribute, "fullscreen", 11)) {
if (string_truep(value))
flags |= DX_FLAGS_FULLSCREEN;
@@ -289,7 +278,7 @@
return GFX_OK;
}
-
+*/
// Adapter ID
if (!strncmp(attribute, "adapterid", 11)) {
int aid = D3DADAPTER_DEFAULT;
@@ -379,16 +368,14 @@
{
DODX((dx_state->pDevice->CreateTexture(dx_state->xsize,
dx_state->ysize,
1, 0,
- D3DFMT_P8,
+ dx_state->d3dFormat,
D3DPOOL_MANAGED,
&dx_state->pTexPrioritys[i])), dx_init_specific);
}
- DODX((dx_state->pDevice->CreateTexture(dx_state->xsize, dx_state->ysize,
- 1, 0,
- dx_state->d3dFormat,
- D3DPOOL_MANAGED,
- &dx_state->pTexPScne)), dx_init_specific);
+ // Create sprite for pointer
+ DODX( (D3DXCreateSprite(dx_state->pDevice, &dx_state->pSPointer)),
dx_init_specific );
+
// Allocate priority maps
for (int i = 0; i < NUM_PRIORITY_BUFFERS; i++)
{
@@ -438,7 +425,7 @@
for (i = 0; i < NUM_VISUAL_BUFFERS; i++)
SAFE_RELEASE( dx_state->pTexVisuals[i] );
SAFE_RELEASE( dx_state->pTexPointer );
- SAFE_RELEASE( dx_state->pTexPScne );
+ SAFE_RELEASE( dx_state->pSPointer );
SAFE_RELEASE( dx_state->pVertBuff );
SAFE_RELEASE( dx_state->pDevice );
SAFE_RELEASE( dx_state->pD3d );
@@ -839,6 +826,9 @@
{
HRESULT hr;
+ if (pointer->data == NULL)
+ return GFX_OK;
+
LPDIRECT3DTEXTURE8 pntTex;
LPDIRECT3DSURFACE8 pntSrf;
@@ -847,12 +837,35 @@
dx_state->pointerDims = pDims;
RECT r = {0, 0, pointer->xl, pointer->yl};
+ // Correct alpha - there must be a simpler way to do this
+ int dxPointerDataSize = pointer->xl * pointer->yl * dx_state->bpp;
+ byte* dxPointerData = (byte*)sci_malloc(dxPointerDataSize);
+ byte* pointerDataIndex = pointer->data;
+ byte* dxPointerDataWork = dxPointerData;
+ for (int ds = 0; ds < dxPointerDataSize / dx_state->bpp; ds++)
+ {
+ byte a, r, g, b;
+ r = *pointerDataIndex++;
+ g = *pointerDataIndex++;
+ b = *pointerDataIndex++;
+ a = *pointerDataIndex++;
+ if ( (a == 0xCC) && (r == 0xCC) && (g == 0xCC) && (b == 0xCC) )
+ ;
+ else
+ a = 0xFF;
+ *dxPointerDataWork++ = r;
+ *dxPointerDataWork++ = g;
+ *dxPointerDataWork++ = b;
+ *dxPointerDataWork++ = a;
+ }
+
// Create texture and fill with pointer data
DODX( (dx_state->pDevice->CreateTexture(pointer->xl, pointer->yl, 1, 0,
dx_state->d3dFormat, D3DPOOL_MANAGED, &pntTex )), dx_set_pointer );
DODX( (pntTex->GetSurfaceLevel(0, &pntSrf)), dx_set_pointer );
- DODX( (D3DXLoadSurfaceFromMemory(pntSrf, NULL, &r, pointer->data,
dx_state->d3dFormat, 256, NULL, &r, D3DX_FILTER_NONE, 0xcccccccc)),
dx_set_pointer);
+ DODX( (D3DXLoadSurfaceFromMemory(pntSrf, NULL, &r, dxPointerData,
dx_state->d3dFormat, 256, NULL, &r, D3DX_FILTER_NONE, 0xCCCCCCCC)),
dx_set_pointer);
+ sci_free(dxPointerData);
SAFE_RELEASE(pntSrf);
// Assign as current pointer texture
@@ -868,35 +881,16 @@
static int
show_pointer(struct _gfx_driver *drv, LPARAM pos)
{
- HRESULT hr;
POINTS mousePos; // mouse coordinates
- POINT mPos; // where to copy mouse pointer to
- LPDIRECT3DSURFACE8 sbuf, dbuf;
- // Copy over where pointer was last frame
- POINT poldPnt = {drv->pointer_x, drv->pointer_y};
- RECT roldPnt = {drv->pointer_x, drv->pointer_y, drv->pointer_x +
dx_state->pointerDims.x, drv->pointer_y + dx_state->pointerDims.y};
- DODX( (dx_state->pTexVisuals[PRIMARY_VIS]->GetSurfaceLevel(0, &sbuf)),
show_pointer );
- DODX( (dx_state->pTexPScne->GetSurfaceLevel(0, &dbuf)), show_pointer );
- DODX( (dx_state->pDevice->CopyRects( sbuf, &roldPnt, 1, dbuf,
&poldPnt)), show_pointer );
- SAFE_RELEASE(sbuf);
-
// Sort out coordinates
mousePos = MAKEPOINTS(pos);
- mPos.x = mousePos.x;
- mPos.y = mousePos.y;
- //sciprintf("Mouse pos: %i,%i\n", mousePos.x, mousePos.y);
- // Copy over mouse pointer
- DODX( (dx_state->pTexPointer->GetSurfaceLevel(0, &sbuf)), show_pointer
);
- dx_state->pDevice->CopyRects( sbuf, NULL, 0, dbuf, &mPos);
-
// Update pos
drv->pointer_x = mousePos.x;
drv->pointer_y = mousePos.y;
- SAFE_RELEASE(sbuf);
- SAFE_RELEASE(dbuf);
+ RenderD3D(drv);
return GFX_OK;
}
@@ -1146,7 +1140,7 @@
extern "C"
gfx_driver_t gfx_driver_dx = {
"directx",
- "0.4",
+ "0.4.1",
SCI_GFX_DRIVER_MAGIC,
SCI_GFX_DRIVER_VERSION,
NULL, /* mode */
Deleted: freesci/trunk/src/gfx/drivers/dx_driver.h
===================================================================
--- freesci/trunk/src/gfx/drivers/dx_driver.h 2006-02-05 08:27:02 UTC (rev
1521)
+++ freesci/trunk/src/gfx/drivers/dx_driver.h 2006-02-05 09:52:31 UTC (rev
1522)
@@ -1,149 +0,0 @@
-/***************************************************************************
- dx_driver.h Copyright (C) 2002,2003,2005 Alexander R Angas,
- Some portions Copyright (C) 1999 Dmitry Jemerov
-
- This program may be modified and copied freely according to the terms of
- the GNU general public license (GPL), as long as the above copyright
- notice and the licensing information contained herein are preserved.
-
- Please refer to www.gnu.org for licensing details.
-
- This work is provided AS IS, without warranty of any kind, expressed or
- implied, including but not limited to the warranties of merchantibility,
- noninfringement, and fitness for a specific purpose. The author will not
- be held liable for any damage caused by this work or derivatives of it.
-
- By using this source code, you agree to the licensing terms as stated
- above.
-
- Please contact the maintainer for bug reports or inquiries.
-
- Current Maintainer:
-
- Alexander R Angas (Alex) <arangas AT internode dot on dot net>
-
-***************************************************************************/
-
-#include <windows.h>
-#include <d3d8.h>
-#include <d3dx8math.h>
-#include <dxerr8.h>
-
-extern "C" {
-#include <gfx_system.h>
-#include <gfx_driver.h>
-#include <gfx_tools.h>
-#include <assert.h>
-#include <uinput.h>
-#include <ctype.h>
-#include <console.h> // for sciprintf
-#include <sci_win32.h>
-#include <sci_memory.h>
-};
-
-// Error trapping, every DirectX call should use this
-#define DODX(cmd, proc)
\
- hr = cmd;
\
- if (hr != S_OK)
\
- DXTrace(__FILE__, __LINE__, hr, #cmd" from "#proc, 1);
-
-
-// Easily release only allocated objects
-#define SAFE_RELEASE(p) \
- if (p) \
- (p)->Release();
-
-
-// Make it simple to access drv->state
-#define dx_state ((struct gfx_dx_struct_t *)(drv->state))
-
-
-// Simply map a key using add_key_event()
-#define MAP_KEY(x,y) case x: add_key_event ((struct gfx_dx_struct_t
*)(drv->state), y); break
-
-
-#define DX_CLASS_NAME "FreeSCI DirectX Graphics"
-#define DX_APP_NAME "FreeSCI"
-
-// Vertex format
-#define D3DFVF_CUSTOMVERTEX ( D3DFVF_DIFFUSE | D3DFVF_XYZRHW | D3DFVF_TEX1 )
-
-// Vertex structure
-struct CUSTOMVERTEX
-{
- D3DXVECTOR4 p; // Vertex coordinates
- DWORD colour; // Colour
- D3DXVECTOR2 t; // Texture coordinates
-};
-
-#define SCI_DX_HANDLE_NORMAL 0
-#define SCI_DX_HANDLE_GRABBED 1
-
-// Number of buffers for each type of texture
-#define NUM_VISUAL_BUFFERS 3
-#define NUM_PRIORITY_BUFFERS 2
-
-// What each buffer references
-#define PRIMARY_VIS 0
-#define BACK_VIS 1
-#define STATIC_VIS 2
-
-#define BACK_PRI 0
-#define STATIC_PRI 1
-
-// Struct that holds everything
-struct gfx_dx_struct_t
-{
- D3DFORMAT d3dFormat; // Colour format
- UINT adapterId; // Adapter ID to use
- DWORD vertexProcessing; // Hardware or software vertex processing
-
- LPDIRECT3D8 pD3d; // D3D object
- D3DCAPS8 deviceCaps; // Capabilities of
device
- D3DDISPLAYMODE displayMode; // Width and height of
screen
- D3DPRESENT_PARAMETERS presParams; // Presentation parameters
- LPDIRECT3DDEVICE8 pDevice; // Rendering device
-
- LPDIRECT3DVERTEXBUFFER8 pVertBuff; // Buffer to hold pixmap
vertices
- CUSTOMVERTEX pvData[4]; // Buffer of pixmap
vertex structs
-
- LPDIRECT3DTEXTURE8 pTexVisuals[NUM_VISUAL_BUFFERS]; //
Array of visual textures
- LPDIRECT3DTEXTURE8 pTexPrioritys[NUM_PRIORITY_BUFFERS]; // Array of
priority textures
- gfx_pixmap_t *priority_maps[NUM_PRIORITY_BUFFERS]; //
Array of SCI priority maps
-
- LPDIRECT3DTEXTURE8 pTexPointer; // Mouse pointer
- POINTS pointerDims; // Pointer dimensions
- LPDIRECT3DTEXTURE8 pTexPScne; // Texture combined with primary vis
and mouse pointer
-
- WNDCLASSEX wc; // Window class
- HWND hWnd; // Window
- UINT xsize, ysize; // Size of our back buffer
- UINT xfact, yfact; // Size multiplication factor
- UINT bpp; // Bits per pixel
-
- // Event queue
- int queue_size, queue_first, queue_last;
- sci_event_t *event_queue;
-};
-
-// Flags that may be set in the driver
-#define DX_FLAGS_FULLSCREEN 1
-
-// Initialization functions
-static int
-ProcessMessages(struct _gfx_driver *drv);
-
-static gfx_return_value_t
-RenderD3D(struct _gfx_driver *drv);
-
-static int
-CheckDevice(struct _gfx_driver *drv);
-
-static gfx_return_value_t
-InitWindow(struct _gfx_driver *drv);
-
-static gfx_return_value_t
-InitD3D(struct _gfx_driver *drv);
-
-static gfx_return_value_t
-InitScene(struct _gfx_driver *drv);
Modified: freesci/trunk/src/gfx/drivers/gfx_drivers.c
===================================================================
--- freesci/trunk/src/gfx/drivers/gfx_drivers.c 2006-02-05 08:27:02 UTC (rev
1521)
+++ freesci/trunk/src/gfx/drivers/gfx_drivers.c 2006-02-05 09:52:31 UTC (rev
1522)
@@ -51,10 +51,6 @@
extern gfx_driver_t gfx_driver_dx;
# endif
-# ifdef HAVE_DDRAW
-extern gfx_driver_t gfx_driver_dd;
-# endif
-
# ifdef HAVE_SDL
extern gfx_driver_t gfx_driver_sdl;
# endif
@@ -100,9 +96,6 @@
# ifdef HAVE_DIRECTX
&gfx_driver_dx,
# endif
-# ifdef HAVE_DDRAW
- &gfx_driver_dd,
-# endif
#endif
&gfx_driver_null,
NULL
Modified: freesci/trunk/src/include/gfx_system.h
===================================================================
--- freesci/trunk/src/include/gfx_system.h 2006-02-05 08:27:02 UTC (rev
1521)
+++ freesci/trunk/src/include/gfx_system.h 2006-02-05 09:52:31 UTC (rev
1522)
@@ -192,8 +192,9 @@
}
-
+/* This is defined in Win32 and should be renamed if it still needs to be used
#define RECT(a) a.x, a.y, a.xl, a.yl
+*/
/* Merges two rects
** Parameters: (rect_t x rect_t) a,b: The two rects to merge
Added: freesci/trunk/src/include/graphics_directx.h
===================================================================
--- freesci/trunk/src/include/graphics_directx.h 2006-02-05 08:27:02 UTC
(rev 1521)
+++ freesci/trunk/src/include/graphics_directx.h 2006-02-05 09:52:31 UTC
(rev 1522)
@@ -0,0 +1,152 @@
+/***************************************************************************
+ graphics_directx.h Copyright (C) 2002,2003,2005-6 Alexander R Angas,
+ Some portions Copyright (C) 1999 Dmitry Jemerov
+
+ This program may be modified and copied freely according to the terms of
+ the GNU general public license (GPL), as long as the above copyright
+ notice and the licensing information contained herein are preserved.
+
+ Please refer to www.gnu.org for licensing details.
+
+ This work is provided AS IS, without warranty of any kind, expressed or
+ implied, including but not limited to the warranties of merchantibility,
+ noninfringement, and fitness for a specific purpose. The author will not
+ be held liable for any damage caused by this work or derivatives of it.
+
+ By using this source code, you agree to the licensing terms as stated
+ above.
+
+ Please contact the maintainer for bug reports or inquiries.
+
+ Current Maintainer:
+
+ Alexander R Angas (Alex) <arangas AT internode dot on dot net>
+
+***************************************************************************/
+
+#include <windows.h>
+#include <d3d8.h>
+#include <d3dx8core.h>
+#include <d3dx8math.h>
+#include <dxerr8.h>
+
+extern "C" {
+#include <gfx_system.h>
+#include <gfx_driver.h>
+#include <gfx_tools.h>
+#include <assert.h>
+#include <uinput.h>
+#include <ctype.h>
+#include <console.h> // for sciprintf
+#include <sci_win32.h>
+#include <sci_memory.h>
+};
+
+// Error trapping, every DirectX call should use this
+#define DODX(cmd, proc)
\
+ hr = cmd;
\
+ if (hr != S_OK) {
\
+ sciprintf("%s, %i, %i, %s from %s\n", __FILE__,
__LINE__, hr, #cmd, #proc); \
+ DXTrace(__FILE__, __LINE__, hr, #cmd" from "#proc, 1);
\
+ }
+
+
+// Easily release only allocated objects
+#define SAFE_RELEASE(p) \
+ if (p) \
+ (p)->Release();
+
+
+// Make it simple to access drv->state
+#define dx_state ((struct gfx_dx_struct_t *)(drv->state))
+
+
+// Simply map a key using add_key_event()
+#define MAP_KEY(x,y) case x: add_key_event ((struct gfx_dx_struct_t
*)(drv->state), y); break
+
+
+#define DX_CLASS_NAME "FreeSCI DirectX Graphics"
+#define DX_APP_NAME "FreeSCI"
+
+// Vertex format
+#define D3DFVF_CUSTOMVERTEX ( D3DFVF_DIFFUSE | D3DFVF_XYZRHW | D3DFVF_TEX1 )
+
+// Vertex structure
+struct CUSTOMVERTEX
+{
+ D3DXVECTOR4 p; // Vertex coordinates
+ DWORD colour; // Colour
+ D3DXVECTOR2 t; // Texture coordinates
+};
+
+#define SCI_DX_HANDLE_NORMAL 0
+#define SCI_DX_HANDLE_GRABBED 1
+
+// Number of buffers for each type of texture
+#define NUM_VISUAL_BUFFERS 3
+#define NUM_PRIORITY_BUFFERS 2
+
+// What each buffer references
+#define PRIMARY_VIS 0
+#define BACK_VIS 1
+#define STATIC_VIS 2
+
+#define BACK_PRI 0
+#define STATIC_PRI 1
+
+// Struct that holds everything
+struct gfx_dx_struct_t
+{
+ D3DFORMAT d3dFormat; // Colour format
+ UINT adapterId; // Adapter ID to use
+ DWORD vertexProcessing; // Hardware or software vertex processing
+
+ LPDIRECT3D8 pD3d; // D3D object
+ D3DCAPS8 deviceCaps; // Capabilities of
device
+ D3DDISPLAYMODE displayMode; // Width and height of
screen
+ D3DPRESENT_PARAMETERS presParams; // Presentation parameters
+ LPDIRECT3DDEVICE8 pDevice; // Rendering device
+
+ LPDIRECT3DVERTEXBUFFER8 pVertBuff; // Buffer to hold pixmap
vertices
+ CUSTOMVERTEX pvData[4]; // Buffer of pixmap
vertex structs
+
+ LPDIRECT3DTEXTURE8 pTexVisuals[NUM_VISUAL_BUFFERS]; //
Array of visual textures
+ LPDIRECT3DTEXTURE8 pTexPrioritys[NUM_PRIORITY_BUFFERS]; // Array of
priority textures
+ gfx_pixmap_t *priority_maps[NUM_PRIORITY_BUFFERS]; //
Array of SCI priority maps
+
+ LPDIRECT3DTEXTURE8 pTexPointer; // Mouse pointer texture
+ LPD3DXSPRITE pSPointer; // Mouse pointer sprite
+ POINTS pointerDims; // Pointer dimensions
+
+ WNDCLASSEX wc; // Window class
+ HWND hWnd; // Window
+ UINT xsize, ysize; // Size of our back buffer
+ UINT xfact, yfact; // Size multiplication factor
+ UINT bpp; // Bits per pixel
+
+ // Event queue
+ int queue_size, queue_first, queue_last;
+ sci_event_t *event_queue;
+};
+
+// Flags that may be set in the driver
+#define DX_FLAGS_FULLSCREEN 1
+
+// Initialization functions
+static int
+ProcessMessages(struct _gfx_driver *drv);
+
+static gfx_return_value_t
+RenderD3D(struct _gfx_driver *drv);
+
+static int
+CheckDevice(struct _gfx_driver *drv);
+
+static gfx_return_value_t
+InitWindow(struct _gfx_driver *drv);
+
+static gfx_return_value_t
+InitD3D(struct _gfx_driver *drv);
+
+static gfx_return_value_t
+InitScene(struct _gfx_driver *drv);
Modified: freesci/trunk/src/win32/freesci.def
===================================================================
(Binary files differ)
Modified: freesci/trunk/src/win32/fsci_dll.vcproj
===================================================================
--- freesci/trunk/src/win32/fsci_dll.vcproj 2006-02-05 08:27:02 UTC (rev
1521)
+++ freesci/trunk/src/win32/fsci_dll.vcproj 2006-02-05 09:52:31 UTC (rev
1522)
@@ -1055,6 +1055,9 @@
</FileConfiguration>
</File>
<File
+ RelativePath="..\gfx\gfx_res_options.c">
+ </File>
+ <File
RelativePath="..\gfx\gfx_resource.c">
<FileConfiguration
Name="Release|Win32">
@@ -1606,70 +1609,6 @@
Name="drivers"
Filter="">
<File
-
RelativePath="..\gfx\drivers\dd_driver.cpp">
- <FileConfiguration
- Name="Release|Win32">
- <Tool
-
Name="VCCLCompilerTool"
- Optimization="1"
-
AdditionalIncludeDirectories=""
-
PreprocessorDefinitions="NDEBUG;PACKAGE=\"FreeSCI\";_WINDOWS;WIN32;_USRDLL;_CONSOLE;FREESCI_EXPORTS;VERSION=__TIMESTAMP__;X_DISPLAY_MISSING;HAVE_SDL;HAVE_MEMCHR;HAVE_SYS_STAT_H;HAVE_FCNTL_H;HAVE_STRING_H;HAVE_DIRECTX"
-
BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
-
Name="VCCLCompilerTool"
- Optimization="0"
-
AdditionalIncludeDirectories=""
-
PreprocessorDefinitions="_DEBUG;PACKAGE=\"FreeSCI\";VERSION=__TIMESTAMP__;_WINDOWS;WIN32;_USRDLL;_CONSOLE;FREESCI_EXPORTS;X_DISPLAY_MISSING;HAVE_SDL;HAVE_MEMCHR;HAVE_SYS_STAT_H;HAVE_FCNTL_H;HAVE_STRING_H;HAVE_DIRECTX"
-
BasicRuntimeChecks="3"
-
BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Purify|Win32">
- <Tool
-
Name="VCCLCompilerTool"
- Optimization="0"
-
AdditionalIncludeDirectories=""
-
PreprocessorDefinitions="SATISFY_PURIFY;_DEBUG;PACKAGE=\"FreeSCI\";VERSION=__TIMESTAMP__;_WINDOWS;WIN32;_USRDLL;_CONSOLE;FREESCI_EXPORTS;X_DISPLAY_MISSING;HAVE_SDL;HAVE_MEMCHR;HAVE_SYS_STAT_H;HAVE_FCNTL_H;HAVE_STRING_H;HAVE_DIRECTX"
-
BasicRuntimeChecks="3"
-
BrowseInformation="1"/>
- </FileConfiguration>
- </File>
- <File
-
RelativePath="..\gfx\drivers\dd_driver_line.cpp">
- <FileConfiguration
- Name="Release|Win32">
- <Tool
-
Name="VCCLCompilerTool"
- Optimization="1"
-
AdditionalIncludeDirectories=""
-
PreprocessorDefinitions="NDEBUG;PACKAGE=\"FreeSCI\";_WINDOWS;WIN32;_USRDLL;_CONSOLE;FREESCI_EXPORTS;VERSION=__TIMESTAMP__;X_DISPLAY_MISSING;HAVE_SDL;HAVE_MEMCHR;HAVE_SYS_STAT_H;HAVE_FCNTL_H;HAVE_STRING_H;HAVE_DIRECTX"
-
BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Debug|Win32">
- <Tool
-
Name="VCCLCompilerTool"
- Optimization="0"
-
AdditionalIncludeDirectories=""
-
PreprocessorDefinitions="_DEBUG;PACKAGE=\"FreeSCI\";VERSION=__TIMESTAMP__;_WINDOWS;WIN32;_USRDLL;_CONSOLE;FREESCI_EXPORTS;X_DISPLAY_MISSING;HAVE_SDL;HAVE_MEMCHR;HAVE_SYS_STAT_H;HAVE_FCNTL_H;HAVE_STRING_H;HAVE_DIRECTX"
-
BasicRuntimeChecks="3"
-
BrowseInformation="1"/>
- </FileConfiguration>
- <FileConfiguration
- Name="Purify|Win32">
- <Tool
-
Name="VCCLCompilerTool"
- Optimization="0"
-
AdditionalIncludeDirectories=""
-
PreprocessorDefinitions="SATISFY_PURIFY;_DEBUG;PACKAGE=\"FreeSCI\";VERSION=__TIMESTAMP__;_WINDOWS;WIN32;_USRDLL;_CONSOLE;FREESCI_EXPORTS;X_DISPLAY_MISSING;HAVE_SDL;HAVE_MEMCHR;HAVE_SYS_STAT_H;HAVE_FCNTL_H;HAVE_STRING_H;HAVE_DIRECTX"
-
BasicRuntimeChecks="3"
-
BrowseInformation="1"/>
- </FileConfiguration>
- </File>
- <File
RelativePath="..\gfx\drivers\dx_driver.cpp">
<FileConfiguration
Name="Release|Win32">
@@ -3073,12 +3012,9 @@
Name="win32"
Filter="">
<File
-
RelativePath="..\gfx\drivers\dd_driver.h">
+
RelativePath="..\include\graphics_directx.h">
</File>
<File
-
RelativePath="..\include\graphics_ddraw.h">
- </File>
- <File
RelativePath="..\include\win32\messages.h">
</File>
<File
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [freesci-develop] r1522 - in freesci/trunk: . src/gfx/drivers src/include src/win32,
arangas <=