- Move sci/scummvm/ contents to sci/

- Rename scumm_engine.cpp to sci.cpp
- Remove unneeded gfx drivers
- Rename scummvm_driver.c to gfx_driver.cpp

svn-id: r38225
This commit is contained in:
Eugene Sandulenko 2009-02-15 11:03:21 +00:00
parent 7ec7c4399e
commit e9f7428063
20 changed files with 5 additions and 8958 deletions

View File

@ -23,7 +23,7 @@
#include "engines/advancedDetector.h"
#include "base/plugins.h"
#include "scummvm_engine.h"
#include "sci/sci.h"
// Titles of the games
static const PlainGameDescriptor SciGameTitles[] = {

View File

@ -1 +0,0 @@
gfx_driver_ggi

View File

@ -1 +0,0 @@
gfx_driver_sdl

View File

@ -1,2 +0,0 @@
gfx_driver_xlib

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +0,0 @@
void _dd_draw_line(gfx_mode_t * mode, rect_t line, byte * dest, int linewidth,gfx_color_t color);

View File

@ -1,163 +0,0 @@
#ifndef __cplusplus
#error NOTE: This file MUST be compiled as C++. In Visual C++, use the /Tp command line option.
#endif
extern "C" {
#include <gfx_system.h>
#include <gfx_tools.h>
};
#define LINEMACRO_1(startx, starty, deltalinear, deltanonlinear, linearvar, nonlinearvar, \
linearend, nonlinearstart, linearmod, nonlinearmod) \
x = (startx); y = (starty); \
incrNE = ((deltalinear) > 0)? (deltalinear) : -(deltalinear); \
incrNE <<= 1; \
deltanonlinear <<= 1; \
incrE = ((deltanonlinear) > 0) ? -(deltanonlinear) : (deltanonlinear); \
d = nonlinearstart-1; \
while (linearvar != (linearend)) { \
buffer[linewidth * y + x] = color; \
linearvar += linearmod; \
if ((d+=incrE) < 0) { \
d += incrNE; \
nonlinearvar += nonlinearmod; \
}; \
}; \
buffer[linewidth * y + x] = color;
#define LINEMACRO_N(startx, starty, deltalinear, deltanonlinear, linearvar, nonlinearvar, \
linearend, nonlinearstart, linearmod, nonlinearmod) \
x = (startx); y = (starty); \
incrNE = ((deltalinear) > 0)? (deltalinear) : -(deltalinear); \
incrNE <<= 1; \
deltanonlinear <<= 1; \
incrE = ((deltanonlinear) > 0) ? -(deltanonlinear) : (deltanonlinear); \
d = nonlinearstart-1; \
while (linearvar != (linearend)) { \
memcpy(&buffer[linewidth * y + bpp*x],&color,bpp); \
linearvar += linearmod; \
if ((d+=incrE) < 0) { \
d += incrNE; \
nonlinearvar += nonlinearmod; \
}; \
}; \
memcpy(&buffer[linewidth * y + x],&color,bpp);
void _dd_draw_line_buffer_1(byte *buffer, int linewidth, rect_t line, int color)
{
/*void dither_line(picture_t buffers, int curx, int cury, short x1, short y1,
int col1, int col2, int priority, int special, char drawenable)*/
int dx, dy, incrE, incrNE, d, finalx, finaly;
int x = line.x;
int y = line.y;
dx = line.xl;
dy = line.yl;
finalx = x + dx;
finaly = y + dy;
dx = abs(dx);
dy = abs(dy);
if (dx > dy) {
if (finalx < x) {
if (finaly < y) { /* llu == left-left-up */
LINEMACRO_1(x, y, dx, dy, x, y, finalx, dx, -1, -1);
} else { /* lld */
LINEMACRO_1(x, y, dx, dy, x, y, finalx, dx, -1, 1);
}
} else { /* x1 >= x */
if (finaly < y) { /* rru */
LINEMACRO_1(x, y, dx, dy, x, y, finalx, dx, 1, -1);
} else { /* rrd */
LINEMACRO_1(x, y, dx, dy, x, y, finalx, dx, 1, 1);
}
}
} else { /* dx <= dy */
if (finaly < y) {
if (finalx < x) { /* luu */
LINEMACRO_1(x, y, dy, dx, y, x, finaly, dy, -1, -1);
} else { /* ruu */
LINEMACRO_1(x, y, dy, dx, y, x, finaly, dy, -1, 1);
}
} else { /* y1 >= y */
if (finalx < x) { /* ldd */
LINEMACRO_1(x, y, dy, dx, y, x, finaly, dy, 1, -1);
} else { /* rdd */
LINEMACRO_1(x, y, dy, dx, y, x, finaly, dy, 1, 1);
}
}
}
}
void _dd_draw_line_buffer_n(int bpp,byte *buffer, int linewidth, rect_t line, byte * color)
{
/*void dither_line(picture_t buffers, int curx, int cury, short x1, short y1,
int col1, int col2, int priority, int special, char drawenable)*/
int dx, dy, incrE, incrNE, d, finalx, finaly;
int x = line.x;
int y = line.y;
dx = line.xl;
dy = line.yl;
finalx = x + dx;
finaly = y + dy;
dx = abs(dx);
dy = abs(dy);
if (dx > dy) {
if (finalx < x) {
if (finaly < y) { /* llu == left-left-up */
LINEMACRO_N(x, y, dx, dy, x, y, finalx, dx, -1, -1);
} else { /* lld */
LINEMACRO_N(x, y, dx, dy, x, y, finalx, dx, -1, 1);
}
} else { /* x1 >= x */
if (finaly < y) { /* rru */
LINEMACRO_N(x, y, dx, dy, x, y, finalx, dx, 1, -1);
} else { /* rrd */
LINEMACRO_N(x, y, dx, dy, x, y, finalx, dx, 1, 1);
}
}
} else { /* dx <= dy */
if (finaly < y) {
if (finalx < x) { /* luu */
LINEMACRO_N(x, y, dy, dx, y, x, finaly, dy, -1, -1);
} else { /* ruu */
LINEMACRO_N(x, y, dy, dx, y, x, finaly, dy, -1, 1);
}
} else { /* y1 >= y */
if (finalx < x) { /* ldd */
LINEMACRO_N(x, y, dy, dx, y, x, finaly, dy, 1, -1);
} else { /* rdd */
LINEMACRO_N(x, y, dy, dx, y, x, finaly, dy, 1, 1);
}
}
}
}
void _dd_draw_line(gfx_mode_t * mode, rect_t line, byte * dest, int linewidth,gfx_color_t color)
{
byte ca[4];
unsigned short co1;
switch(mode->bytespp)
{
case 1:
_dd_draw_line_buffer_1(dest,linewidth,line,color.visual.global_index);
break;
case 2:
co1 = (color.visual.r << mode->red_shift) & mode->red_mask;
co1 |= (color.visual.g << mode->green_shift) & mode->green_mask;
co1 |= (color.visual.b << mode->blue_shift) & mode->blue_mask;
_dd_draw_line_buffer_n(2,dest,linewidth,line, (byte *) &co1);
break;
case 3:
ca[mode->red_shift/8]=color.visual.r;
ca[mode->green_shift/8]=color.visual.g;
ca[mode->blue_shift/8]=color.visual.b;
_dd_draw_line_buffer_n(3,dest,linewidth,line, ca);
break;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,151 +0,0 @@
/***************************************************************************
graphics_directx.h Copyright (C) 2008 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) { \
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
gfx_mode_t *pointerMode; // SCI graphics mode for pointer
LPDIRECT3DTEXTURE8 pTexPointer; // Mouse pointer texture
LPD3DXSPRITE pSPointer; // Mouse pointer sprite
POINTS pointerDims; // Pointer dimensions
WNDCLASSEX wc; // Window class
HWND hWnd; // Window
UINT xfact, yfact; // Scaling factors
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, UINT width, UINT height);
static gfx_return_value_t
InitD3D(struct _gfx_driver *drv);
static gfx_return_value_t
InitScene(struct _gfx_driver *drv);

View File

@ -1,192 +0,0 @@
/***************************************************************************
gfx_drivers.c Copyright (C) 2001 Christoph Reichenbach
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:
Christoph Reichenbach (CR) <jameson@linuxgames.com>
***************************************************************************/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <gfx_driver.h>
#include <modules.h>
static char *oldname = NULL;
static void *oldhandle;
#ifndef HAVE_DLOPEN
# ifdef HAVE_LIBGGI
extern gfx_driver_t gfx_driver_ggi;
# endif
# ifndef X_DISPLAY_MISSING
extern gfx_driver_t gfx_driver_xlib;
# endif
# ifdef HAVE_DIRECTX
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
# ifdef HAVE_DIRECTFB
extern gfx_driver_t gfx_driver_dfb;
# endif
# ifdef _DREAMCAST
extern gfx_driver_t gfx_driver_dc;
# endif
#endif
extern gfx_driver_t gfx_driver_null;
static gfx_driver_t *gfx_drivers[] = {
#ifndef HAVE_DLOPEN
# ifndef X_DISPLAY_MISSING
&gfx_driver_xlib,
# endif
# ifdef HAVE_SDL
&gfx_driver_sdl,
# endif
# ifdef HAVE_DIRECTX
&gfx_driver_dx,
# endif
# ifdef HAVE_DDRAW
&gfx_driver_dd,
# endif
# ifdef HAVE_DIRECTFB
&gfx_driver_dfb,
# endif
# ifdef HAVE_LIBGGI
&gfx_driver_ggi,
# endif
# ifdef _DREAMCAST
&gfx_driver_dc,
# endif
#endif
&gfx_driver_null,
NULL
};
#define DRIVER_TYPE "gfx"
#define DRIVER_PREFIX "gfx_driver_"
#define DRIVER_FILE_SUFFIX "_driver"
#ifdef HAVE_DLOPEN
struct _gfx_driver *
gfx_find_driver(char *path, char *name)
{
int retval = 0;
if (oldhandle)
sci_close_module(oldhandle, DRIVER_TYPE, oldname);
if (!name) { /* Find default driver */
#ifdef _WIN32
name = "sdl";
#else /* !_WIN32 */
# ifndef X_DISPLAY_MISSING
if (getenv("DISPLAY"))
name = "xlib";
else
# endif
name = "ggi";
#endif /* !_WIN32 */
}
oldname = name;
return (struct _gfx_driver *)
sci_find_module(path, name, DRIVER_TYPE,
DRIVER_PREFIX,
DRIVER_FILE_SUFFIX,
SCI_GFX_DRIVER_MAGIC,
SCI_GFX_DRIVER_VERSION,
&oldhandle);
}
#else /* No dlopen */
struct _gfx_driver *
gfx_find_driver(char *path, char *name)
{
int retval = 0;
if (!name) { /* Find default driver */
#ifndef X_DISPLAY_MISSING
if (getenv("DISPLAY"))
return &gfx_driver_xlib;
#endif
#if defined (MACOSX) && defined(HAVE_SDL)
return &gfx_driver_sdl;
#endif
return gfx_drivers[0];
}
while (gfx_drivers[retval] && strcasecmp(name, gfx_drivers[retval]->name))
retval++;
return gfx_drivers[retval];
}
#endif
const char *
gfx_get_driver_name(int nr)
{
return (gfx_drivers[nr])? gfx_drivers[nr]->name : NULL;
}
int
string_truep(char *value)
{
return !(strcasecmp(value, "ok") &&
strcasecmp(value, "enable") &&
strcasecmp(value, "1") &&
strcasecmp(value, "true") &&
strcasecmp(value, "yes") &&
strcasecmp(value, "on"));
}
int
string_falsep(char *value)
{
return !(strcasecmp(value, "disable") &&
strcasecmp(value, "0") &&
strcasecmp(value, "false") &&
strcasecmp(value, "no") &&
strcasecmp(value, "off"));
}

File diff suppressed because it is too large Load Diff

View File

@ -1,211 +0,0 @@
/***************************************************************************
null_driver.c Copyright (C) 2000 Christoph Reichenbach
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:
Christoph Reichenbach (CR) <jameson@linuxgames.com>
***************************************************************************/
#include <gfx_driver.h>
#include <gfx_tools.h>
static int debug_sleep = 0;
static int debug_draw = 0;
static int
null_set_parameter(struct _gfx_driver *drv, char *attribute, char *value)
{
printf("[GFX-NULL] Setting '%s' <- '%s'\n", attribute, value);
return GFX_OK;
}
static int
null_init_specific(struct _gfx_driver *drv, int xfact, int yfact, int bytespp)
{
printf("[GFX-NULL] Initializing specific: %dx%d, %d bytespp\n",
xfact, yfact, bytespp);
drv->mode = gfx_new_mode(xfact, yfact, bytespp,
0, 0, 0, 0,
0, 0, 0, 0, 0, 0);
return GFX_OK;
}
static int
null_init(struct _gfx_driver *drv)
{
printf("[GFX-NULL] Initializing default\n");
return null_init_specific(drv, 1, 1, 1);
}
static void
null_exit(struct _gfx_driver *drv)
{
printf("[GFX-NULL] Exitting\n");
}
/*** Drawing operations ***/
static int
null_draw_line(struct _gfx_driver *drv, point_t start, point_t end,
gfx_color_t color,
gfx_line_mode_t line_mode, gfx_line_style_t line_style)
{
if (debug_draw)
printf("[GFX-NULL] Line (%d,%d) -- (%d,%d)\n",
GFX_PRINT_POINT(start),
GFX_PRINT_POINT(end));
return GFX_OK;
}
static int
null_draw_filled_rect(struct _gfx_driver *drv, rect_t rect,
gfx_color_t color1, gfx_color_t color2,
gfx_rectangle_fill_t shade_mode)
{
if (debug_draw)
printf("[GFX-NULL] Box (%d,%d)d(%d,%d)\n",
GFX_PRINT_RECT(rect));
return GFX_OK;
}
/*** Pixmap operations ***/
static int
null_register_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm)
{
return GFX_OK;
}
static int
null_unregister_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm)
{
return GFX_OK;
}
static int
null_draw_pixmap(struct _gfx_driver *drv, gfx_pixmap_t *pxm, int priority,
rect_t src, rect_t dest, gfx_buffer_t buffer)
{
return GFX_OK;
}
static int
null_grab_pixmap(struct _gfx_driver *drv, rect_t src, gfx_pixmap_t *pxm,
gfx_map_mask_t map)
{
return GFX_OK;
pxm->xl = src.xl;
pxm->yl = src.yl;
}
/*** Buffer operations ***/
static int
null_update(struct _gfx_driver *drv, rect_t src, point_t dest, gfx_buffer_t buffer)
{
return GFX_OK;
}
static int
null_set_static_buffer(struct _gfx_driver *drv, gfx_pixmap_t *pic, gfx_pixmap_t *priority)
{
return GFX_OK;
}
/*** Mouse pointer operations ***/
static int
null_set_pointer(struct _gfx_driver *drv, gfx_pixmap_t *pointer)
{
return GFX_OK;
}
/*** Palette operations ***/
static int
null_set_palette(struct _gfx_driver *drv, int index, byte red, byte green, byte blue)
{
return GFX_OK;
}
/*** Event management ***/
static sci_event_t
null_get_event(struct _gfx_driver *drv)
{
sci_event_t input;
input.type = SCI_EVT_NONE;
return input;
}
static int
null_usec_sleep(struct _gfx_driver *drv, long usecs)
{
if (debug_sleep)
sciprintf("[GFX-NULL] Sleeping %ld usecs...\n", usecs);
return GFX_OK;
}
gfx_driver_t
gfx_driver_null = {
"null",
"0.1",
SCI_GFX_DRIVER_MAGIC,
SCI_GFX_DRIVER_VERSION,
NULL,
0, 0,
GFX_CAPABILITY_WINDOWED,
GFX_DEBUG_POINTER | GFX_DEBUG_UPDATES | GFX_DEBUG_PIXMAPS | GFX_DEBUG_BASIC,
null_set_parameter,
null_init_specific,
null_init,
null_exit,
null_draw_line,
null_draw_filled_rect,
null_register_pixmap,
null_unregister_pixmap,
null_draw_pixmap,
null_grab_pixmap,
null_update,
null_set_static_buffer,
null_set_pointer,
null_set_palette,
null_get_event,
null_usec_sleep,
NULL
};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,8 @@
MODULE := engines/sci
MODULE_OBJS = \
detection.o \
sci.o \
engine/game.o \
engine/gc.o \
engine/grammar.o \
@ -28,6 +30,7 @@ MODULE_OBJS = \
gfx/font.o \
gfx/font-5x8.o \
gfx/font-6x10.o \
gfx/gfx_driver.o \
gfx/gfx_res_options.o \
gfx/gfx_resource.o \
gfx/gfx_support.o \
@ -38,7 +41,6 @@ MODULE_OBJS = \
gfx/sbtree.o \
gfx/sci_widgets.o \
gfx/widgets.o \
gfx/drivers/scummvm_driver.o \
gfx/resource/sci_cursor_0.o \
gfx/resource/sci_font.o \
gfx/resource/sci_pal_1.o \
@ -66,8 +68,6 @@ MODULE_OBJS = \
scicore/versions.o \
scicore/vocab.o \
scicore/vocab_debug.o \
scummvm/detection.o \
scummvm/scummvm_engine.o \
sfx/adlib.o \
sfx/core.o \
sfx/iterator.o \

View File

@ -29,7 +29,7 @@
#include "common/config-manager.h"
#include "engines/advancedDetector.h"
#include "sci/scummvm/scummvm_engine.h"
#include "sci/sci.h"
#include "sci/include/engine.h"
//namespace Sci {