diff options
Diffstat (limited to 'sword2')
-rw-r--r-- | sword2/build_display.cpp | 2 | ||||
-rw-r--r-- | sword2/build_display.h | 73 | ||||
-rw-r--r-- | sword2/defs.h | 72 | ||||
-rw-r--r-- | sword2/driver/_mouse.cpp | 1 | ||||
-rw-r--r-- | sword2/driver/animation.cpp | 5 | ||||
-rw-r--r-- | sword2/driver/d_draw.cpp | 3 | ||||
-rw-r--r-- | sword2/driver/d_sound.cpp | 2 | ||||
-rw-r--r-- | sword2/driver/driver96.h | 182 | ||||
-rw-r--r-- | sword2/driver/menu.cpp | 3 | ||||
-rw-r--r-- | sword2/driver/menu.h | 31 | ||||
-rw-r--r-- | sword2/driver/rdwin.cpp | 1 | ||||
-rw-r--r-- | sword2/driver/render.cpp | 4 | ||||
-rw-r--r-- | sword2/driver/render.h | 33 | ||||
-rw-r--r-- | sword2/driver/sprite.cpp | 2 | ||||
-rw-r--r-- | sword2/function.cpp | 1 | ||||
-rw-r--r-- | sword2/layers.cpp | 5 | ||||
-rw-r--r-- | sword2/mouse.h | 32 | ||||
-rw-r--r-- | sword2/sound.h | 15 | ||||
-rw-r--r-- | sword2/sword2.cpp | 2 | ||||
-rw-r--r-- | sword2/sword2.h | 1 |
20 files changed, 188 insertions, 282 deletions
diff --git a/sword2/build_display.cpp b/sword2/build_display.cpp index 26f997a2ff..cb07a5e510 100644 --- a/sword2/build_display.cpp +++ b/sword2/build_display.cpp @@ -204,7 +204,7 @@ void Screen::displayMsg(byte *text, int time) { spriteInfo.x = _screenWide / 2 - frame->width / 2; if (!time) - spriteInfo.y = _screenDeep / 2 - frame->height / 2 - RDMENU_MENUDEEP; + spriteInfo.y = _screenDeep / 2 - frame->height / 2 - MENUDEEP; else spriteInfo.y = 400 - frame->height; spriteInfo.w = frame->width; diff --git a/sword2/build_display.h b/sword2/build_display.h index 2b3bc0c6d6..4259b4360e 100644 --- a/sword2/build_display.h +++ b/sword2/build_display.h @@ -37,6 +37,10 @@ #define BLOCKHEIGHT 64 #define MAXLAYERS 5 +#define MENUDEEP 40 +#define RENDERWIDE 640 +#define RENDERDEEP (480 - (MENUDEEP * 2)) + // Maximum scaled size of a sprite #define SCALE_MAXWIDTH 512 #define SCALE_MAXHEIGHT 512 @@ -47,10 +51,57 @@ namespace Sword2 { +class Sword2Engine; + struct ObjectMouse; struct ObjectGraphic; struct ObjectMega; +// Sprite defines + +enum { + // This is the low byte part of the sprite type. + + RDSPR_TRANS = 0x0001, + RDSPR_BLEND = 0x0004, + RDSPR_FLIP = 0x0008, + RDSPR_SHADOW = 0x0010, + RDSPR_DISPLAYALIGN = 0x0020, + RDSPR_NOCOMPRESSION = 0x0040, + RDSPR_EDGEBLEND = 0x0080, // Unused + + // This is the high byte part of the sprite type, which defines what + // type of compression is used. Unless RDSPR_NOCOMPRESSION is set. + + RDSPR_RLE16 = 0x0000, + RDSPR_RLE256 = 0x0100, + RDSPR_RLE256FAST = 0x0200 +}; + +// Fading defines + +enum { + RDFADE_NONE, + RDFADE_UP, + RDFADE_DOWN, + RDFADE_BLACK +}; + +// Palette defines + +enum { + RDPAL_FADE, + RDPAL_INSTANT +}; + +// Blitting FX defines + +enum { + RDBLTFX_SPRITEBLEND = 0x01, + RDBLTFX_SHADOWBLEND = 0x02, + RDBLTFX_EDGEBLEND = 0x04 +}; + // Structure filled out by each object to register its graphic printing // requrements @@ -78,14 +129,6 @@ struct BuildUnit { bool shadingFlag; }; -enum { - MOUSE_normal = 0, // normal in game - MOUSE_menu = 1, // menu chooser - MOUSE_drag = 2, // dragging luggage - MOUSE_system_menu = 3, // system menu chooser - MOUSE_holding = 4 // special -}; - struct ScreenInfo { uint16 scroll_offset_x; // Position x uint16 scroll_offset_y; // Position y @@ -133,6 +176,20 @@ struct BlockSurface { bool transparent; }; +#if !defined(__GNUC__) + #pragma START_PACK_STRUCTS +#endif + +struct Parallax { + uint16 w; + uint16 h; + uint32 offset[2]; // 2 is arbitrary +} GCC_PACK; + +#if !defined(__GNUC__) + #pragma END_PACK_STRUCTS +#endif + class Screen { private: Sword2Engine *_vm; diff --git a/sword2/defs.h b/sword2/defs.h index e6f8639516..0dc84fbb64 100644 --- a/sword2/defs.h +++ b/sword2/defs.h @@ -24,20 +24,64 @@ #define SIZE 0x10000 // 65536 items per section #define NuSIZE 0xffff // & with this -#define TEXT_OK 0x08EB0000 -#define TEXT_CANCEL 0x08EB0001 -#define TEXT_RESTORE 0x08EB0002 -#define TEXT_SAVE 0x08EB0003 -#define TEXT_QUIT 0x08EB0004 -#define TEXT_RESTART 0x08EB0005 -#define TEXT_OPTIONS 0x08EB000A -#define TEXT_SUBTITLES 0x08EB000B -#define TEXT_OBJECT_LABELS 0x08EB000C -#define TEXT_MUSIC_VOLUME 0x08EB000E -#define TEXT_SPEECH_VOLUME 0x08EB000F -#define TEXT_FX_VOLUME 0x08EB0010 -#define TEXT_GFX_QUALITY 0x08EB0011 -#define TEXT_REVERSE_STEREO 0x08EB0015 +// Error codes + +enum { + // Generic error codes + + RD_OK, + RDERR_UNKNOWN, + RDERR_OUTOFMEMORY, + RDERR_INVALIDFILENAME, + + // Drawing error codes + + RDERR_DECOMPRESSION, + + // Sprite drawing error codes + + RDERR_NOTIMPLEMENTED, + RDERR_NOTCLOSED, + RDERR_NOTOPEN, + + // Menubar error codes + + RDERR_INVALIDMENU, + RDERR_INVALIDPOCKET, + RDERR_INVALIDCOMMAND, + + // Palette fading error codes + + RDERR_FADEINCOMPLETE, + + // Sound engine error codes + + RDERR_SPEECHPLAYING, + RDERR_SPEECHNOTPLAYING, + RDERR_INVALIDWAV, + RDERR_FXALREADYOPEN, + RDERR_FXNOTOPEN, + RDERR_INVALIDID +}; + +// Text ids for the control panel etc. + +enum { + TEXT_OK = 0x08EB0000, + TEXT_CANCEL = 0x08EB0001, + TEXT_RESTORE = 0x08EB0002, + TEXT_SAVE = 0x08EB0003, + TEXT_QUIT = 0x08EB0004, + TEXT_RESTART = 0x08EB0005, + TEXT_OPTIONS = 0x08EB000A, + TEXT_SUBTITLES = 0x08EB000B, + TEXT_OBJECT_LABELS = 0x08EB000C, + TEXT_MUSIC_VOLUME = 0x08EB000E, + TEXT_SPEECH_VOLUME = 0x08EB000F, + TEXT_FX_VOLUME = 0x08EB0010, + TEXT_GFX_QUALITY = 0x08EB0011, + TEXT_REVERSE_STEREO = 0x08EB0015 +}; // always 8 (George object used for Nico player character as well) #define CUR_PLAYER_ID 8 diff --git a/sword2/driver/_mouse.cpp b/sword2/driver/_mouse.cpp index 606d362767..3842434942 100644 --- a/sword2/driver/_mouse.cpp +++ b/sword2/driver/_mouse.cpp @@ -22,6 +22,7 @@ #include "common/system.h" #include "sword2/sword2.h" +#include "sword2/defs.h" #include "sword2/mouse.h" namespace Sword2 { diff --git a/sword2/driver/animation.cpp b/sword2/driver/animation.cpp index 260d42f454..6efa697c4d 100644 --- a/sword2/driver/animation.cpp +++ b/sword2/driver/animation.cpp @@ -27,12 +27,11 @@ #include "sound/mp3.h" #include "sword2/sword2.h" +#include "sword2/defs.h" #include "sword2/maketext.h" #include "sword2/resman.h" #include "sword2/sound.h" #include "sword2/driver/animation.h" -#include "sword2/driver/menu.h" -#include "sword2/driver/render.h" namespace Sword2 { @@ -415,7 +414,7 @@ void MoviePlayer::playDummy(const char *filename, MovieTextObject *text[], byte byte *msgSurface; msgSprite.x = _vm->_screen->getScreenWide() / 2 - frame->width / 2; - msgSprite.y = RDMENU_MENUDEEP / 2 - frame->height / 2; + msgSprite.y = MENUDEEP / 2 - frame->height / 2; msgSprite.w = frame->width; msgSprite.h = frame->height; msgSprite.type = RDSPR_NOCOMPRESSION; diff --git a/sword2/driver/d_draw.cpp b/sword2/driver/d_draw.cpp index b20123e4b5..d511afad5c 100644 --- a/sword2/driver/d_draw.cpp +++ b/sword2/driver/d_draw.cpp @@ -21,8 +21,7 @@ #include "common/stdafx.h" #include "common/system.h" #include "sword2/sword2.h" -#include "sword2/driver/menu.h" -#include "sword2/driver/render.h" +#include "sword2/mouse.h" namespace Sword2 { diff --git a/sword2/driver/d_sound.cpp b/sword2/driver/d_sound.cpp index 81890e6fbb..070cb15754 100644 --- a/sword2/driver/d_sound.cpp +++ b/sword2/driver/d_sound.cpp @@ -32,7 +32,9 @@ #include "sound/flac.h" #include "sound/rate.h" #include "sound/wave.h" + #include "sword2/sword2.h" +#include "sword2/defs.h" #include "sword2/resman.h" #include "sword2/sound.h" diff --git a/sword2/driver/driver96.h b/sword2/driver/driver96.h deleted file mode 100644 index 43acd6e7b2..0000000000 --- a/sword2/driver/driver96.h +++ /dev/null @@ -1,182 +0,0 @@ -/* Copyright (C) 1994-1998 Revolution Software Ltd. - * Copyright (C) 2003-2005 The ScummVM project - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Header$ - */ - -#ifndef DRIVER96_H -#define DRIVER96_H - -namespace Sword2 { - -class Sword2Engine; - -// Error codes - -enum { - // Generic error codes - - RD_OK, - RDERR_UNKNOWN, - RDERR_INVALIDPOINTER, - RDERR_OUTOFMEMORY, - RDERR_INVALIDFILENAME, - - // Drawing error codes - - RDERR_DECOMPRESSION, - - // Language and version error codes - - RDERR_OPENVERSIONFILE, - - // Sprite drawing error codes - - RDERR_NOTIMPLEMENTED, - RDERR_UNKNOWNTYPE, - RDERR_INVALIDSCALING, - RDERR_NOTCLOSED, - RDERR_NOTOPEN, - - // Menubar error codes - - RDERR_INVALIDMENU, - RDERR_INVALIDPOCKET, - RDERR_INVALIDCOMMAND, - - // Palette fading error codes - - RDERR_FADEINCOMPLETE, - - // Sound engine error codes - - RDERR_SPEECHPLAYING, - RDERR_SPEECHNOTPLAYING, - RDERR_INVALIDWAV, - RDERR_FXALREADYOPEN, - RDERR_NOFREEBUFFERS, - RDERR_FXNOTOPEN, - RDERR_FXFUCKED, - RDERR_INVALIDID -}; - -// Sprite defines - -enum { - // This is the low byte part of the sprite type. - - RDSPR_TRANS = 0x0001, - RDSPR_BLEND = 0x0004, - RDSPR_FLIP = 0x0008, - RDSPR_SHADOW = 0x0010, - RDSPR_DISPLAYALIGN = 0x0020, - RDSPR_NOCOMPRESSION = 0x0040, - RDSPR_EDGEBLEND = 0x0080, // Unused - - // This is the high byte part of the sprite type, which defines what - // type of compression is used. Unless RDSPR_NOCOMPRESSION is set. - - RDSPR_RLE16 = 0x0000, - RDSPR_RLE256 = 0x0100, - RDSPR_RLE256FAST = 0x0200 -}; - -// Fading defines - -enum { - RDFADE_NONE, - RDFADE_UP, - RDFADE_DOWN, - RDFADE_BLACK -}; - -// Mouse defines - -enum { - RDMOUSE_NOFLASH, - RDMOUSE_FLASH -}; - -// Menubar defines. - -#define RDMENU_TOP 0 -#define RDMENU_BOTTOM 1 - -enum { - RDMENU_HIDDEN, - RDMENU_SHOWN, - RDMENU_OPENING, - RDMENU_CLOSING, - RDMENU_ALMOST_HIDDEN -}; - -#define RDMENU_ICONWIDE 35 -#define RDMENU_ICONDEEP 30 -#define RDMENU_ICONSTART 24 -#define RDMENU_ICONSPACING 5 -#define RDMENU_MAXPOCKETS 15 -#define RDMENU_MENUDEEP 40 - -// Sound defines - -enum { - RDSE_SAMPLEFINISHED = 0, - RDSE_SAMPLEPLAYING = 1, - RDSE_FXTOCLEAR = 0, // Unused - RDSE_FXCACHED = 1, // Unused - RDSE_FXSPOT = 0, - RDSE_FXLOOP = 1, - RDSE_FXLEADIN = 2, - RDSE_FXLEADOUT = 3, - RDSE_QUIET = 1, - RDSE_SPEAKING = 0 -}; - -// Palette defines - -enum { - RDPAL_FADE, - RDPAL_INSTANT -}; - -// Blitting FX defines - -enum { - RDBLTFX_SPRITEBLEND = 0x01, - RDBLTFX_SHADOWBLEND = 0x02, - RDBLTFX_EDGEBLEND = 0x04 -}; - -// Structure definitions - -#if !defined(__GNUC__) - #pragma START_PACK_STRUCTS -#endif - -struct Parallax { - uint16 w; - uint16 h; - uint32 offset[2]; // 2 is arbitrary -} GCC_PACK; - -#if !defined(__GNUC__) - #pragma END_PACK_STRUCTS -#endif - -} // End of namespace Sword2 - -#endif diff --git a/sword2/driver/menu.cpp b/sword2/driver/menu.cpp index 267a254a4d..698090c517 100644 --- a/sword2/driver/menu.cpp +++ b/sword2/driver/menu.cpp @@ -19,9 +19,10 @@ */ #include "common/stdafx.h" + #include "sword2/sword2.h" +#include "sword2/defs.h" #include "sword2/mouse.h" -#include "sword2/driver/render.h" namespace Sword2 { diff --git a/sword2/driver/menu.h b/sword2/driver/menu.h deleted file mode 100644 index d6741d0bee..0000000000 --- a/sword2/driver/menu.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright (C) 1994-1998 Revolution Software Ltd. - * Copyright (C) 2003-2005 The ScummVM project - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Header$ - */ - -#ifndef MENU_H -#define MENU_H - -namespace Sword2 { - -#define MENUDEEP 40 - -} // End of namespace Sword2 - -#endif - diff --git a/sword2/driver/rdwin.cpp b/sword2/driver/rdwin.cpp index d74cc89bc8..d5c2a1b54f 100644 --- a/sword2/driver/rdwin.cpp +++ b/sword2/driver/rdwin.cpp @@ -21,7 +21,6 @@ #include "common/stdafx.h" #include "common/system.h" #include "sword2/sword2.h" -#include "sword2/driver/menu.h" namespace Sword2 { diff --git a/sword2/driver/render.cpp b/sword2/driver/render.cpp index ff0dcab5a9..eb50fcb1c8 100644 --- a/sword2/driver/render.cpp +++ b/sword2/driver/render.cpp @@ -20,11 +20,11 @@ #include "common/stdafx.h" #include "common/system.h" + #include "sword2/sword2.h" +#include "sword2/defs.h" #include "sword2/build_display.h" #include "sword2/driver/animation.h" -#include "sword2/driver/menu.h" -#include "sword2/driver/render.h" namespace Sword2 { diff --git a/sword2/driver/render.h b/sword2/driver/render.h deleted file mode 100644 index 536b37faa2..0000000000 --- a/sword2/driver/render.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright (C) 1994-1998 Revolution Software Ltd. - * Copyright (C) 2003-2005 The ScummVM project - * - * 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - * - * $Header$ - */ - -#ifndef RENDER_H -#define RENDER_H - -#include "sword2/driver/menu.h" - -namespace Sword2 { - -#define RENDERWIDE 640 -#define RENDERDEEP (480 - (MENUDEEP * 2)) - -} // End of namespace Sword2 - -#endif diff --git a/sword2/driver/sprite.cpp b/sword2/driver/sprite.cpp index 7c96df75c2..1cae26bdc6 100644 --- a/sword2/driver/sprite.cpp +++ b/sword2/driver/sprite.cpp @@ -19,7 +19,9 @@ */ #include "common/stdafx.h" + #include "sword2/sword2.h" +#include "sword2/defs.h" #include "sword2/build_display.h" namespace Sword2 { diff --git a/sword2/function.cpp b/sword2/function.cpp index b20335b57a..7e241ba094 100644 --- a/sword2/function.cpp +++ b/sword2/function.cpp @@ -35,7 +35,6 @@ #include "sword2/router.h" #include "sword2/sound.h" #include "sword2/driver/animation.h" -#include "sword2/driver/render.h" namespace Sword2 { diff --git a/sword2/layers.cpp b/sword2/layers.cpp index d3006ff19c..0fc9734c93 100644 --- a/sword2/layers.cpp +++ b/sword2/layers.cpp @@ -27,8 +27,11 @@ // up to 2 foreground parallax layers #include "common/stdafx.h" + #include "sword2/sword2.h" +#include "sword2/defs.h" #include "sword2/logic.h" +#include "sword2/mouse.h" #include "sword2/resman.h" #include "sword2/sound.h" @@ -110,7 +113,7 @@ void Screen::initBackground(int32 res, int32 new_palette) { // off the edge. The minimum offsets are both 0. _thisScreen.max_scroll_offset_x = screen_head->width - _screenWide; - _thisScreen.max_scroll_offset_y = screen_head->height - (_screenDeep - (RDMENU_MENUDEEP * 2)); + _thisScreen.max_scroll_offset_y = screen_head->height - (_screenDeep - (MENUDEEP * 2)); } else { // The later fits on the phyiscal screen. Switch off scrolling. _thisScreen.scroll_flag = 0; diff --git a/sword2/mouse.h b/sword2/mouse.h index 1f277c9a9f..a3d55d278b 100644 --- a/sword2/mouse.h +++ b/sword2/mouse.h @@ -28,6 +28,38 @@ namespace Sword2 { struct ObjectMouse; struct BuildUnit; +// Menubar defines. + +#define RDMENU_TOP 0 +#define RDMENU_BOTTOM 1 + +enum { + MOUSE_normal = 0, // normal in game + MOUSE_menu = 1, // menu chooser + MOUSE_drag = 2, // dragging luggage + MOUSE_system_menu = 3, // system menu chooser + MOUSE_holding = 4 // special +}; + +enum { + RDMOUSE_NOFLASH, + RDMOUSE_FLASH +}; + +enum { + RDMENU_HIDDEN, + RDMENU_SHOWN, + RDMENU_OPENING, + RDMENU_CLOSING, + RDMENU_ALMOST_HIDDEN +}; + +#define RDMENU_ICONWIDE 35 +#define RDMENU_ICONDEEP 30 +#define RDMENU_ICONSTART 24 +#define RDMENU_ICONSPACING 5 +#define RDMENU_MAXPOCKETS 15 + #if !defined(__GNUC__) #pragma START_PACK_STRUCTS #endif diff --git a/sword2/sound.h b/sword2/sound.h index cb3d69e851..07a8b40c35 100644 --- a/sword2/sound.h +++ b/sword2/sound.h @@ -63,6 +63,21 @@ enum { FX_LOOPING = 4 }; +// Sound defines + +enum { + RDSE_SAMPLEFINISHED = 0, + RDSE_SAMPLEPLAYING = 1, + RDSE_FXTOCLEAR = 0, // Unused + RDSE_FXCACHED = 1, // Unused + RDSE_FXSPOT = 0, + RDSE_FXLOOP = 1, + RDSE_FXLEADIN = 2, + RDSE_FXLEADOUT = 3, + RDSE_QUIET = 1, + RDSE_SPEAKING = 0 +}; + class CLUInputStream : public AudioStream { private: File *_file; diff --git a/sword2/sword2.cpp b/sword2/sword2.cpp index 347b11beaa..953d03b4cf 100644 --- a/sword2/sword2.cpp +++ b/sword2/sword2.cpp @@ -488,7 +488,7 @@ void Sword2Engine::parseEvents() { break; case OSystem::EVENT_MOUSEMOVE: if (!(_eventFilter & RD_KEYDOWN)) { - _mouse->setPos(event.mouse.x, event.mouse.y - RDMENU_MENUDEEP); + _mouse->setPos(event.mouse.x, event.mouse.y - MENUDEEP); } break; case OSystem::EVENT_LBUTTONDOWN: diff --git a/sword2/sword2.h b/sword2/sword2.h index 23a0d25342..db2ce23074 100644 --- a/sword2/sword2.h +++ b/sword2/sword2.h @@ -32,7 +32,6 @@ #include "common/util.h" -#include "sword2/driver/driver96.h" #include "sword2/build_display.h" #include "sword2/header.h" #include "sword2/icons.h" |