[Scummvm-cvs-logs] CVS: scummvm/sword2/driver _mouse.cpp,1.40,1.41 animation.cpp,1.53,1.54 animation.h,1.33,1.34 d_draw.cpp,1.65,1.66 d_sound.cpp,1.141,1.142 driver96.h,1.75,1.76 menu.cpp,1.32,1.33 palette.cpp,1.37,1.38 rdwin.cpp,1.51,1.52 render.cpp,1.70,1.71 sprite.cpp,1.46,1.47 d_draw.h,1.36,NONE

Torbjörn Andersson eriktorbjorn at users.sourceforge.net
Sat Feb 19 06:03:14 CET 2005


Update of /cvsroot/scummvm/scummvm/sword2/driver
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20780/driver

Modified Files:
	_mouse.cpp animation.cpp animation.h d_draw.cpp d_sound.cpp 
	driver96.h menu.cpp palette.cpp rdwin.cpp render.cpp 
	sprite.cpp 
Removed Files:
	d_draw.h 
Log Message:
This is the second part of the BS2 restructuring. There are two new
classes: Screen and Mouse. Screen handles most of the drawing, except the
mouse cursor and in-game menus.

The old Graphics class is no more.

I've also fixed some "reverse stereo" regressions from the first part of
the restructuring.

I'm not sure what the next step will be, but hopefully it will be smaller
than this one was.


Index: _mouse.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/_mouse.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -d -r1.40 -r1.41
--- _mouse.cpp	17 Jan 2005 10:57:13 -0000	1.40
+++ _mouse.cpp	19 Feb 2005 14:02:14 -0000	1.41
@@ -20,14 +20,19 @@
 
 #include "common/stdafx.h"
 #include "common/system.h"
+
 #include "sword2/sword2.h"
-#include "sword2/driver/d_draw.h"
+#include "sword2/mouse.h"
 
 namespace Sword2 {
 
+// This is the maximum mouse cursor size in the SDL backend
+#define MAX_MOUSE_W     80
+#define MAX_MOUSE_H     80
+
 #define MOUSEFLASHFRAME 6
 
-void Graphics::decompressMouse(byte *decomp, byte *comp, int width, int height, int pitch, int xOff, int yOff) {
+void Mouse::decompressMouse(byte *decomp, byte *comp, int width, int height, int pitch, int xOff, int yOff) {
 	int32 size = width * height;
 	int32 i = 0;
 	int x = 0;
@@ -52,7 +57,7 @@
 	}
 }
 
-void Graphics::drawMouse(void) {
+void Mouse::drawMouse() {
 	byte mouseData[MAX_MOUSE_W * MAX_MOUSE_H];
 
 	if (!_mouseAnim && !_luggageAnim)
@@ -129,7 +134,7 @@
  * Animates the current mouse pointer
  */
 
-int32 Graphics::animateMouse(void) {
+int32 Mouse::animateMouse() {
 	uint8 prevMouseFrame = _mouseFrame;
 
 	if (!_mouseAnim)
@@ -154,7 +159,7 @@
  * or not there is a lead-in animation
  */
 
-int32 Graphics::setMouseAnim(byte *ma, int32 size, int32 mouseFlash) {
+int32 Mouse::setMouseAnim(byte *ma, int32 size, int32 mouseFlash) {
 	if (_mouseAnim) {
 		free(_mouseAnim);
 		_mouseAnim = NULL;
@@ -194,7 +199,7 @@
  * @param size the size of the animation data
  */
 
-int32 Graphics::setLuggageAnim(byte *ma, int32 size) {
+int32 Mouse::setLuggageAnim(byte *ma, int32 size) {
 	if (_luggageAnim) {
 		free(_luggageAnim);
 		_luggageAnim = NULL;

Index: animation.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/animation.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- animation.cpp	28 Jan 2005 22:10:56 -0000	1.53
+++ animation.cpp	19 Feb 2005 14:02:14 -0000	1.54
@@ -31,7 +31,6 @@
 #include "sword2/resman.h"
 #include "sword2/sound.h"
 #include "sword2/driver/animation.h"
-#include "sword2/driver/d_draw.h"
 #include "sword2/driver/menu.h"
 #include "sword2/driver/render.h"
 
@@ -47,7 +46,7 @@
 #ifdef BACKEND_8BIT
 
 void AnimationState::setPalette(byte *pal) {
-	_vm->_graphics->setPalette(0, 256, pal, RDPAL_INSTANT);
+	_vm->_screen->setPalette(0, 256, pal, RDPAL_INSTANT);
 }
 
 #else
@@ -82,7 +81,7 @@
 
 void AnimationState::clearScreen(void) {
 #ifdef BACKEND_8BIT
-	memset(_vm->_graphics->getScreen(), 0, MOVIE_WIDTH * MOVIE_HEIGHT);
+	memset(_vm->_screen->getScreen(), 0, MOVIE_WIDTH * MOVIE_HEIGHT);
 #else
 	OverlayColor black = _sys->RGBToColor(0, 0, 0);
 
@@ -93,7 +92,7 @@
 
 void AnimationState::updateScreen(void) {
 #ifdef BACKEND_8BIT
-	byte *buf = _vm->_graphics->getScreen() + ((480 - MOVIE_HEIGHT) / 2) * RENDERWIDE + (640 - MOVIE_WIDTH) / 2;
+	byte *buf = _vm->_screen->getScreen() + ((480 - MOVIE_HEIGHT) / 2) * RENDERWIDE + (640 - MOVIE_WIDTH) / 2;
 
 	_vm->_system->copyRectToScreen(buf, MOVIE_WIDTH, (640 - MOVIE_WIDTH) / 2, (480 - MOVIE_HEIGHT) / 2, MOVIE_WIDTH, MOVIE_HEIGHT);
 #else
@@ -104,7 +103,7 @@
 
 void AnimationState::drawYUV(int width, int height, byte *const *dat) {
 #ifdef BACKEND_8BIT
-	_vm->_graphics->plotYUV(lut, width, height, dat);
+	_vm->_screen->plotYUV(lut, width, height, dat);
 #else
 	plotYUV(lookup, width, height, dat);
 #endif
@@ -138,12 +137,12 @@
 
 void MoviePlayer::openTextObject(MovieTextObject *obj) {
 	if (obj->textSprite)
-		_vm->_graphics->createSurface(obj->textSprite, &_textSurface);
+		_vm->_screen->createSurface(obj->textSprite, &_textSurface);
 }
 
 void MoviePlayer::closeTextObject(MovieTextObject *obj) {
 	if (_textSurface) {
-		_vm->_graphics->deleteSurface(_textSurface);
+		_vm->_screen->deleteSurface(_textSurface);
 		_textSurface = NULL;
 	}
 }
@@ -151,12 +150,12 @@
 void MoviePlayer::drawTextObject(AnimationState *anim, MovieTextObject *obj) {
 	if (obj->textSprite && _textSurface) {
 #ifdef BACKEND_8BIT
-		_vm->_graphics->drawSurface(obj->textSprite, _textSurface);
+		_vm->_screen->drawSurface(obj->textSprite, _textSurface);
 #else
 		if (anim)
 			anim->drawTextObject(obj->textSprite, _textSurface);
 		else
-			_vm->_graphics->drawSurface(obj->textSprite, _textSurface);
+			_vm->_screen->drawSurface(obj->textSprite, _textSurface);
 #endif
 	}
 }
@@ -211,7 +210,7 @@
 
 	// Wait for the lead-out to stop, if there is any.
 	while (_leadOutHandle.isActive()) {
-		_vm->_graphics->updateDisplay();
+		_vm->_screen->updateDisplay();
 		_vm->_system->delayMillis(30);
 	}
 
@@ -232,7 +231,7 @@
 	bool startNextText = false;
 
 	byte oldPal[256 * 4];
-	memcpy(oldPal, _vm->_graphics->_palette, sizeof(oldPal));
+	memcpy(oldPal, _vm->_screen->getPalette(), sizeof(oldPal));
 
 	AnimationState *anim = new AnimationState(_vm);
 
@@ -246,8 +245,8 @@
 #ifndef BACKEND_8BIT
 	// Clear the screen, because whatever is on it will be visible when the
 	// overlay is removed.
-	_vm->_graphics->clearScene();
-	_vm->_graphics->updateDisplay();
+	_vm->_screen->clearScene();
+	_vm->_screen->updateDisplay();
 #endif
 
 #ifndef SCUMM_BIG_ENDIAN
@@ -357,7 +356,7 @@
 		_snd->stopHandle(handle);
 
 	while (handle.isActive()) {
-		_vm->_graphics->updateDisplay(false);
+		_vm->_screen->updateDisplay(false);
 		_sys->delayMillis(100);
 	}
 
@@ -365,7 +364,7 @@
 	anim->clearScreen();
 	anim->updateScreen();
 
-	_vm->_graphics->setPalette(0, 256, oldPal, RDPAL_INSTANT);
+	_vm->_screen->setPalette(0, 256, oldPal, RDPAL_INSTANT);
 
 	delete anim;
 }
@@ -384,14 +383,14 @@
 	byte oldPal[256 * 4];
 	byte tmpPal[256 * 4];
 
-	_vm->_graphics->clearScene();
+	_vm->_screen->clearScene();
 
 	// HACK: Draw instructions
 	//
 	// I'm using the the menu area, because that's unlikely to be touched
 	// by anything else during the cutscene.
 
-	memset(_vm->_graphics->_buffer, 0, _vm->_graphics->_screenWide * MENUDEEP);
+	memset(_vm->_screen->getScreen(), 0, _vm->_screen->getScreenWide() * MENUDEEP);
 
 	byte *data;
 
@@ -415,16 +414,16 @@
 	SpriteInfo msgSprite;
 	byte *msgSurface;
 
-	msgSprite.x = _vm->_graphics->_screenWide / 2 - frame->width / 2;
+	msgSprite.x = _vm->_screen->getScreenWide() / 2 - frame->width / 2;
 	msgSprite.y = RDMENU_MENUDEEP / 2 - frame->height / 2;
 	msgSprite.w = frame->width;
 	msgSprite.h = frame->height;
 	msgSprite.type = RDSPR_NOCOMPRESSION;
 	msgSprite.data = data + sizeof(FrameHeader);
 
-	_vm->_graphics->createSurface(&msgSprite, &msgSurface);
-	_vm->_graphics->drawSurface(&msgSprite, msgSurface);
-	_vm->_graphics->deleteSurface(msgSurface);
+	_vm->_screen->createSurface(&msgSprite, &msgSurface);
+	_vm->_screen->drawSurface(&msgSprite, msgSurface);
+	_vm->_screen->deleteSurface(msgSurface);
 
 	free(data);
 
@@ -436,12 +435,12 @@
 	// Fake a palette that will hopefully make the text visible. In the
 	// opening cutscene it seems to use colours 1 (black) and 255 (white).
 
-	memcpy(oldPal, _vm->_graphics->_palette, sizeof(oldPal));
+	memcpy(oldPal, _vm->_screen->getPalette(), sizeof(oldPal));
 	memset(tmpPal, 0, sizeof(tmpPal));
 	tmpPal[255 * 4 + 0] = 255;
 	tmpPal[255 * 4 + 1] = 255;
 	tmpPal[255 * 4 + 2] = 255;
-	_vm->_graphics->setPalette(0, 256, tmpPal, RDPAL_INSTANT);
+	_vm->_screen->setPalette(0, 256, tmpPal, RDPAL_INSTANT);
 
 	PlayingSoundHandle handle;
 
@@ -458,7 +457,7 @@
 			break;
 
 		if (frameCounter == text[textCounter]->startFrame) {
-			_vm->_graphics->clearScene();
+			_vm->_screen->clearScene();
 			openTextObject(text[textCounter]);
 			drawTextObject(NULL, text[textCounter]);
 			if (text[textCounter]->speech) {
@@ -468,13 +467,13 @@
 
 		if (frameCounter == text[textCounter]->endFrame) {
 			closeTextObject(text[textCounter]);
-			_vm->_graphics->clearScene();
-			_vm->_graphics->setNeedFullRedraw();
+			_vm->_screen->clearScene();
+			_vm->_screen->setNeedFullRedraw();
 			textCounter++;
 		}
 
 		frameCounter++;
-		_vm->_graphics->updateDisplay();
+		_vm->_screen->updateDisplay();
 
 		KeyboardEvent *ke = _vm->keyboardEvent();
 
@@ -496,23 +495,23 @@
 	// importantly - that we don't free the sound buffer while it's in use.
 
 	while (handle.isActive()) {
-		_vm->_graphics->updateDisplay(false);
+		_vm->_screen->updateDisplay(false);
 		_sys->delayMillis(100);
 	}
 
 	closeTextObject(text[textCounter]);
 
-	_vm->_graphics->clearScene();
-	_vm->_graphics->setNeedFullRedraw();
+	_vm->_screen->clearScene();
+	_vm->_screen->setNeedFullRedraw();
 
 	// HACK: Remove the instructions created above
 	Common::Rect r;
 
-	memset(_vm->_graphics->_buffer, 0, _vm->_graphics->_screenWide * MENUDEEP);
+	memset(_vm->_screen->getScreen(), 0, _vm->_screen->getScreenWide() * MENUDEEP);
 	r.left = r.top = 0;
-	r.right = _vm->_graphics->_screenWide;
+	r.right = _vm->_screen->getScreenWide();
 	r.bottom = MENUDEEP;
-	_vm->_graphics->updateRect(&r);
+	_vm->_screen->updateRect(&r);
 
 	// FIXME: For now, only play the lead-out music for cutscenes that have
 	// subtitles.
@@ -520,7 +519,7 @@
 	if (!skipCutscene && leadOut)
 		_vm->_sound->playFx(&_leadOutHandle, leadOut, leadOutLen, SoundMixer::kMaxChannelVolume, 0, false, SoundMixer::kMusicAudioDataType);
 
-	_vm->_graphics->setPalette(0, 256, oldPal, RDPAL_INSTANT);
+	_vm->_screen->setPalette(0, 256, oldPal, RDPAL_INSTANT);
 }
 
 } // End of namespace Sword2

Index: animation.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/animation.h,v
retrieving revision 1.33
retrieving revision 1.34
diff -u -d -r1.33 -r1.34
--- animation.h	28 Jan 2005 16:33:13 -0000	1.33
+++ animation.h	19 Feb 2005 14:02:14 -0000	1.34
@@ -23,12 +23,24 @@
 #define ANIMATION_H
 
 #include "graphics/animation.h"
-
 #include "sound/mixer.h"
 
-
 namespace Sword2 {
 
+struct SpriteInfo;
+
+// This is the structure which is passed to the sequence player. It includes
+// the smack to play, and any text lines which are to be displayed over the top
+// of the sequence.
+
+struct MovieTextObject {
+	uint16 startFrame;
+	uint16 endFrame;
+	SpriteInfo *textSprite;
+	uint32 speechBufferSize;
+	uint16 *speech;
+};
+
 class AnimationState : public ::Graphics::BaseAnimationState {
 private:
 	Sword2Engine *_vm;

Index: d_draw.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/d_draw.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- d_draw.cpp	17 Jan 2005 10:57:14 -0000	1.65
+++ d_draw.cpp	19 Feb 2005 14:02:15 -0000	1.66
@@ -21,72 +21,20 @@
 #include "common/stdafx.h"
 #include "common/system.h"
 #include "sword2/sword2.h"
-#include "sword2/driver/d_draw.h"
 #include "sword2/driver/menu.h"
 #include "sword2/driver/render.h"
 
 namespace Sword2 {
 
-Graphics::Graphics(Sword2Engine *vm, int16 width, int16 height) 
-	: _vm(vm), _iconCount(0), _needFullRedraw(false),
-	  _fadeStatus(RDFADE_NONE), _mouseSprite(NULL), _mouseAnim(NULL),
-	  _luggageAnim(NULL), _layer(0), _renderAverageTime(60),
-	  _lightMask(NULL), _screenWide(width), _screenDeep(height) {
-
-	int i, j;
-
-	_buffer = _dirtyGrid = NULL;
-
-	_buffer = (byte *) malloc(width * height);
-	if (!_buffer)
-		error("Could not initialise display");
-
-	_vm->_system->initSize(width, height);
-
-	_gridWide = width / CELLWIDE;
-	_gridDeep = height / CELLDEEP;
-
-	if ((width % CELLWIDE) || (height % CELLDEEP))
-		error("Bad cell size");
-
-	_dirtyGrid = (byte *) calloc(_gridWide, _gridDeep);
-	if (!_buffer)
-		error("Could not initialise dirty grid");
-
-	for (i = 0; i < ARRAYSIZE(_blockSurfaces); i++)
-		_blockSurfaces[i] = NULL;
-
-	for (i = 0; i < 2; i++) {
-		for (j = 0; j < RDMENU_MAXPOCKETS; j++) {
-			_icons[i][j] = NULL;
-			_pocketStatus[i][j] = 0;
-		}
-
-		_menuStatus[i] = RDMENU_HIDDEN;
-	}
-}
-
-Graphics::~Graphics() {
-	free(_buffer);
-	free(_dirtyGrid);
-	closeBackgroundLayer();
-	free(_lightMask);
-	free(_mouseAnim);
-	free(_luggageAnim);
-	for (int i = 0; i < 2; i++)
-		for (int j = 0; j < RDMENU_MAXPOCKETS; j++)
-			free(_icons[i][j]);
-}
-
 /**
  * @return the graphics detail setting
  */
 
-int8 Graphics::getRenderLevel(void) {
+int8 Screen::getRenderLevel() {
 	return _renderLevel;
 }
 
-void Graphics::setRenderLevel(int8 level) {
+void Screen::setRenderLevel(int8 level) {
 	_renderLevel = level;
 
 	switch (_renderLevel) {
@@ -115,7 +63,7 @@
  * touch the menu areas of the screen.
  */
 
-void Graphics::clearScene(void) {
+void Screen::clearScene() {
 	memset(_buffer + MENUDEEP * _screenWide, 0, _screenWide * RENDERDEEP);
 	_needFullRedraw = true;
 }

Index: d_sound.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/d_sound.cpp,v
retrieving revision 1.141
retrieving revision 1.142
diff -u -d -r1.141 -r1.142
--- d_sound.cpp	18 Feb 2005 16:50:51 -0000	1.141
+++ d_sound.cpp	19 Feb 2005 14:02:15 -0000	1.142
@@ -35,7 +35,6 @@
 #include "sword2/sword2.h"
 #include "sword2/resman.h"
 #include "sword2/sound.h"
-#include "sword2/driver/d_draw.h"
 
 namespace Sword2 {
 
@@ -790,8 +789,11 @@
 
 	_fxQueue[i].volume = (vol * SoundMixer::kMaxChannelVolume) / 16;
 
-	if (pan != -1)
+	if (pan != 255) {
+		if (isReverseStereo())
+			pan = -pan;
 		_fxQueue[i].pan = (pan * 127) / 16;
+	}
 
 	if (!_fxMuted && _fxQueue[i].handle.isActive()) {
 		_vm->_mixer->setChannelVolume(_fxQueue[i].handle, _fxQueue[i].volume);

Index: driver96.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/driver96.h,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -d -r1.75 -r1.76
--- driver96.h	17 Jan 2005 10:57:15 -0000	1.75
+++ driver96.h	19 Feb 2005 14:02:15 -0000	1.76
@@ -177,36 +177,6 @@
 	#pragma END_PACK_STRUCTS
 #endif
 
-// The SpriteInfo structure is used to tell the driver96 code what attributes
-// are linked to a sprite for drawing.  These include position, scaling and
-// compression.
-
-struct SpriteInfo {
-	int16 x;		// coords for top-left of sprite
-	int16 y;
-	uint16 w;		// dimensions of sprite (before scaling)
-	uint16 h;
-	uint16 scale;		// scale at which to draw, given in 256ths ['0' or '256' MEANS DON'T SCALE]
-	uint16 scaledWidth;	// new dimensions (we calc these for the mouse area, so may as well pass to you to save time)
-	uint16 scaledHeight;	//
-	uint16 type;		// mask containing 'RDSPR_' bits specifying compression type, flip, transparency, etc
-	uint16 blend;		// holds the blending values.
-	byte *data;		// pointer to the sprite data
-	byte *colourTable;	// pointer to 16-byte colour table, only applicable to 16-col compression type
-};
-
-// This is the structure which is passed to the sequence player. It includes
-// the smack to play, and any text lines which are to be displayed over the top
-// of the sequence.
-
-struct MovieTextObject {
-	uint16 startFrame;
-	uint16 endFrame;
-	SpriteInfo *textSprite;
-	uint32 speechBufferSize;
-	uint16 *speech;
-};
-
 } // End of namespace Sword2
 
 #endif

Index: menu.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/menu.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -d -r1.32 -r1.33
--- menu.cpp	17 Jan 2005 10:57:15 -0000	1.32
+++ menu.cpp	19 Feb 2005 14:02:16 -0000	1.33
@@ -20,7 +20,7 @@
 
 #include "common/stdafx.h"
 #include "sword2/sword2.h"
-#include "sword2/driver/d_draw.h"
+#include "sword2/mouse.h"
 #include "sword2/driver/render.h"
 
 namespace Sword2 {
@@ -28,17 +28,20 @@
 #define MENUDEEP 40
 #define MAXMENUANIMS 8
 
-void Graphics::clearIconArea(int menu, int pocket, Common::Rect *r) {
+void Mouse::clearIconArea(int menu, int pocket, Common::Rect *r) {
+	byte *buf = _vm->_screen->getScreen();
+	int16 screenWide = _vm->_screen->getScreenWide();
+
 	r->top = menu * (RENDERDEEP + MENUDEEP) + (MENUDEEP - RDMENU_ICONDEEP) / 2;
 	r->bottom = r->top + RDMENU_ICONDEEP;
 	r->left = RDMENU_ICONSTART + pocket * (RDMENU_ICONWIDE + RDMENU_ICONSPACING);
 	r->right = r->left + RDMENU_ICONWIDE;
 
-	byte *dst = _buffer + r->top * _screenWide + r->left;
+	byte *dst = buf + r->top * screenWide + r->left;
 
 	for (int i = 0; i < RDMENU_ICONDEEP; i++) {
 		memset(dst, 0, RDMENU_ICONWIDE);
-		dst += _screenWide;
+		dst += screenWide;
 	}
 }
 
@@ -48,13 +51,16 @@
  * system is.
  */
 
-void Graphics::processMenu(void) {
+void Mouse::processMenu() {
 	uint8 menu;
 	uint8 i, j;
 	uint8 frameCount;
 	Common::Rect r1, r2;
 	static int32 lastTime = 0;
 
+	byte *buf = _vm->_screen->getScreen();
+	int16 screenWide = _vm->_screen->getScreenWide();
+
 	if (lastTime == 0) {
 		lastTime = _vm->getMillis();
 		frameCount = 1;
@@ -153,22 +159,22 @@
 				}
 
 				if (xoff != 0 && yoff != 0) {
-					byte *dst = _buffer + r2.top * _screenWide + r2.left;
+					byte *dst = buf + r2.top * screenWide + r2.left;
 					byte *src = _icons[menu][i];
 
 					if (_pocketStatus[menu][i] != MAXMENUANIMS) {
-						scaleImageFast(
-							dst, _screenWide, r2.right - r2.left, r2.bottom - r2.top,
+						_vm->_screen->scaleImageFast(
+							dst, screenWide, r2.right - r2.left, r2.bottom - r2.top,
 							src, RDMENU_ICONWIDE, RDMENU_ICONWIDE, RDMENU_ICONDEEP);
 					} else {
 						for (j = 0; j < RDMENU_ICONDEEP; j++) {
 							memcpy(dst, src, RDMENU_ICONWIDE);
 							src += RDMENU_ICONWIDE;
-							dst += _screenWide;
+							dst += screenWide;
 						}
 					}
 				}
-				updateRect(&r1);
+				_vm->_screen->updateRect(&r1);
 			}
 			curx += (RDMENU_ICONSPACING + RDMENU_ICONWIDE);
 		}
@@ -181,7 +187,7 @@
  * @return RD_OK, or an error code
  */
 
-int32 Graphics::showMenu(uint8 menu) {
+int32 Mouse::showMenu(uint8 menu) {
 	// Check for invalid menu parameter
 	if (menu > RDMENU_BOTTOM)
 		return RDERR_INVALIDMENU;
@@ -201,7 +207,7 @@
  * @return RD_OK, or an error code
  */
 
-int32 Graphics::hideMenu(uint8 menu) {
+int32 Mouse::hideMenu(uint8 menu) {
 	// Check for invalid menu parameter
 	if (menu > RDMENU_BOTTOM)
 		return RDERR_INVALIDMENU;
@@ -219,7 +225,7 @@
  * This function hides both menus immediately.
  */
 
-void Graphics::closeMenuImmediately(void) {
+void Mouse::closeMenuImmediately() {
 	Common::Rect r;
 	int i;
 
@@ -229,11 +235,11 @@
 	for (i = 0; i < RDMENU_MAXPOCKETS; i++) {
 		if (_icons[RDMENU_TOP][i]) {
 			clearIconArea(RDMENU_TOP, i, &r);
-			updateRect(&r);
+			_vm->_screen->updateRect(&r);
 		}
 		if (_icons[RDMENU_BOTTOM][i]) {
 			clearIconArea(RDMENU_BOTTOM, i, &r);
-			updateRect(&r);
+			_vm->_screen->updateRect(&r);
 		}
 	}
 
@@ -248,7 +254,7 @@
  * @return RD_OK, or an error code
  */
 
-int32 Graphics::setMenuIcon(uint8 menu, uint8 pocket, byte *icon) {
+int32 Mouse::setMenuIcon(uint8 menu, uint8 pocket, byte *icon) {
 	Common::Rect r;
 
 	// Check for invalid menu parameter.
@@ -265,7 +271,7 @@
 		free(_icons[menu][pocket]);
 		_icons[menu][pocket] = NULL;
 		clearIconArea(menu, pocket, &r);
-		updateRect(&r);
+		_vm->_screen->updateRect(&r);
 	}
 
 	// Only put the icon in the pocket if it is not NULL

Index: palette.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/palette.cpp,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -d -r1.37 -r1.38
--- palette.cpp	17 Jan 2005 10:57:15 -0000	1.37
+++ palette.cpp	19 Feb 2005 14:02:16 -0000	1.38
@@ -21,19 +21,101 @@
 #include "common/stdafx.h"
 #include "common/system.h"
 #include "sword2/sword2.h"
-#include "sword2/driver/d_draw.h"
+#include "sword2/defs.h"
+#include "sword2/logic.h"
+#include "sword2/resman.h"
 
 namespace Sword2 {
 
 /**
- * Sets a table of palette indices which will be searched later for a quick
- * palette match.
- * @param data the palette match table
+ * Start layer palette fading up
  */
 
-void Graphics::updatePaletteMatchTable(byte *data) {
-	assert(data);
-	memcpy(_paletteMatch, data, PALTABLESIZE);
+void Screen::startNewPalette() {
+	// If the screen is still fading down then wait for black - could
+	// happen when everythings cached into a large memory model
+	waitForFade();
+
+	byte *screenFile = _vm->_resman->openResource(_thisScreen.background_layer_id);
+
+	memcpy(_paletteMatch, _vm->fetchPaletteMatchTable(screenFile), PALTABLESIZE);
+	setPalette(0, 256, _vm->fetchPalette(screenFile), RDPAL_FADE);
+
+	// Indicating that it's a screen palette
+	_lastPaletteRes = 0;
+
+	_vm->_resman->closeResource(_thisScreen.background_layer_id);
+	fadeUp();
+ 	_thisScreen.new_palette = 0;
+}
+
+void Screen::setFullPalette(int32 palRes) {
+	// fudge for hut interior
+	// - unpausing should restore last palette as normal (could be screen
+	// palette or 'dark_palette_13')
+	// - but restoring the screen palette after 'dark_palette_13' should
+	// now work properly too!
+
+	// "Hut interior" refers to the watchman's hut in Marseille, and this
+	// is apparently needed for the palette to be restored properly when
+	// you turn the light off. (I didn't even notice the light switch!)
+
+	if (Logic::_scriptVars[LOCATION] == 13) {
+		// unpausing
+		if (palRes == -1) {
+			// restore whatever palette was last set (screen
+			// palette or 'dark_palette_13')
+			palRes = _lastPaletteRes;
+		}
+	} else {
+		// check if we're just restoring the current screen palette
+		// because we might actually need to use a separate palette
+		// file anyway eg. for pausing & unpausing during the eclipse
+
+		// unpausing (fudged for location 13)
+ 		if (palRes == -1) {
+			// we really meant '0'
+			palRes = 0;
+		}
+
+		if (palRes == 0 && _lastPaletteRes)
+			palRes = _lastPaletteRes;
+	}
+
+	// If non-zero, set palette to this separate palette file. Otherwise,
+	// set palette to current screen palette.
+
+	if (palRes) {
+		byte *pal = _vm->_resman->openResource(palRes);
+
+		StandardHeader *head = (StandardHeader *) pal;
+		assert(head->fileType == PALETTE_FILE);
+
+		pal += sizeof(StandardHeader);
+
+		// always set colour 0 to black because most background screen
+		// palettes have a bright colour 0 although it should come out
+		// as black in the game!
+
+		pal[0] = 0;
+		pal[1] = 0;
+		pal[2] = 0;
+		pal[3] = 0;
+
+		setPalette(0, 256, pal, RDPAL_INSTANT);
+		_vm->_resman->closeResource(palRes);
+	} else {
+		if (_thisScreen.background_layer_id) {
+			byte *data = _vm->_resman->openResource(_thisScreen.background_layer_id);
+			memcpy(_paletteMatch, _vm->fetchPaletteMatchTable(data), PALTABLESIZE);
+			setPalette(0, 256, _vm->fetchPalette(data), RDPAL_INSTANT);
+			_vm->_resman->closeResource(_thisScreen.background_layer_id);
+		} else
+			error("setFullPalette(0) called, but no current screen available!");
+	}
+
+	if (palRes != CONTROL_PANEL_PALETTE)
+		_lastPaletteRes = palRes;
 }
 
 /**
@@ -47,7 +129,7 @@
 // FIXME: This used to be inlined - probably a good idea - but the
 // linker complained when I tried to use it in sprite.cpp.
 
-uint8 Graphics::quickMatch(uint8 r, uint8 g, uint8 b) {
+uint8 Screen::quickMatch(uint8 r, uint8 g, uint8 b) {
 	return _paletteMatch[((int32) (r >> 2) << 12) + ((int32) (g >> 2) << 6) + (b >> 2)];
 }
 
@@ -59,7 +141,7 @@
  * @param fadeNow whether to perform the change immediately or delayed
  */
 
-void Graphics::setPalette(int16 startEntry, int16 noEntries, byte *colourTable, uint8 fadeNow) {
+void Screen::setPalette(int16 startEntry, int16 noEntries, byte *colourTable, uint8 fadeNow) {
 	assert(noEntries > 0);
 
 	memcpy(&_palette[4 * startEntry], colourTable, noEntries * 4);
@@ -70,7 +152,7 @@
 	}
 }
 
-void Graphics::dimPalette(void) {
+void Screen::dimPalette() {
 	byte *p = _palette;
 
 	for (int i = 0; i < 256; i++) {
@@ -88,7 +170,7 @@
  * @param time the time it will take the palette to fade up
  */
 
-int32 Graphics::fadeUp(float time) {
+int32 Screen::fadeUp(float time) {
 	if (getFadeStatus() != RDFADE_BLACK && getFadeStatus() != RDFADE_NONE)
 		return RDERR_FADEINCOMPLETE;
 
@@ -104,7 +186,7 @@
  * @param time the time it will take the palette to fade down
  */
 
-int32 Graphics::fadeDown(float time) {
+int32 Screen::fadeDown(float time) {
 	if (getFadeStatus() != RDFADE_BLACK && getFadeStatus() != RDFADE_NONE)
 		return RDERR_FADEINCOMPLETE;
 
@@ -121,18 +203,18 @@
  * (not faded), or RDFADE_BLACK (completely faded down)
  */
 
-uint8 Graphics::getFadeStatus(void) {
+uint8 Screen::getFadeStatus() {
 	return _fadeStatus;
 }
 
-void Graphics::waitForFade(void) {
+void Screen::waitForFade() {
 	while (getFadeStatus() != RDFADE_NONE && getFadeStatus() != RDFADE_BLACK) {
 		updateDisplay();
 		_vm->_system->delayMillis(20);
 	}
 }
 
-void Graphics::fadeServer(void) {
+void Screen::fadeServer() {
 	static int32 previousTime = 0;
 	byte fadePalette[256 * 4];
 	byte *newPalette = fadePalette;

Index: rdwin.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/rdwin.cpp,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- rdwin.cpp	17 Jan 2005 10:57:15 -0000	1.51
+++ rdwin.cpp	19 Feb 2005 14:02:16 -0000	1.52
@@ -21,7 +21,6 @@
 #include "common/stdafx.h"
 #include "common/system.h"
 #include "sword2/sword2.h"
-#include "sword2/driver/d_draw.h"
 #include "sword2/driver/menu.h"
 
 namespace Sword2 {
@@ -30,7 +29,7 @@
  * Tell updateDisplay() that the scene needs to be completely updated.
  */
 
-void Graphics::setNeedFullRedraw(void) {
+void Screen::setNeedFullRedraw() {
 	_needFullRedraw = true;
 }
 
@@ -38,7 +37,7 @@
  * Mark an area of the screen as dirty, first generation.
  */
 
-void Graphics::markAsDirty(int16 x0, int16 y0, int16 x1, int16 y1) {
+void Screen::markAsDirty(int16 x0, int16 y0, int16 x1, int16 y1) {
 	int16 gridX0 = x0 / CELLWIDE;
 	int16 gridY0 = y0 / CELLDEEP;
 	int16 gridX1 = x1 / CELLWIDE;
@@ -58,7 +57,7 @@
  * @param redrawScene If true, redraw the scene.
  */
 
-void Graphics::updateDisplay(bool redrawScene) {
+void Screen::updateDisplay(bool redrawScene) {
 	_vm->parseEvents();
 	fadeServer();
 

Index: render.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/render.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- render.cpp	17 Jan 2005 10:57:15 -0000	1.70
+++ render.cpp	19 Feb 2005 14:02:16 -0000	1.71
@@ -21,22 +21,23 @@
 #include "common/stdafx.h"
 #include "common/system.h"
 #include "sword2/sword2.h"
+#include "sword2/build_display.h"
 #include "sword2/driver/animation.h"
-#include "sword2/driver/d_draw.h"
 #include "sword2/driver/menu.h"
 #include "sword2/driver/render.h"
 
 namespace Sword2 {
 
-#define MILLISECSPERCYCLE	83
+#define MILLISECSPERCYCLE  83
+#define RENDERAVERAGETOTAL 4
 
-void Graphics::updateRect(Common::Rect *r) {
+void Screen::updateRect(Common::Rect *r) {
 	_vm->_system->copyRectToScreen(_buffer + r->top * _screenWide + r->left,
 		_screenWide, r->left, r->top, r->right - r->left,
 		r->bottom - r->top);
 }
 
-void Graphics::blitBlockSurface(BlockSurface *s, Common::Rect *r, Common::Rect *clipRect) {
+void Screen::blitBlockSurface(BlockSurface *s, Common::Rect *r, Common::Rect *clipRect) {
 	if (!r->intersects(*clipRect))
 		return;
 
@@ -85,7 +86,7 @@
 // This code isn't quite like the original DrawSprite(), but should be close
 // enough.
 
-void Graphics::scaleImageFast(byte *dst, uint16 dstPitch, uint16 dstWidth, uint16 dstHeight, byte *src, uint16 srcPitch, uint16 srcWidth, uint16 srcHeight) {
+void Screen::scaleImageFast(byte *dst, uint16 dstPitch, uint16 dstWidth, uint16 dstHeight, byte *src, uint16 srcPitch, uint16 srcWidth, uint16 srcHeight) {
 	int x, y;
 
 	for (x = 0; x < dstWidth; x++)
@@ -102,7 +103,7 @@
 	}
 }
 
-void Graphics::scaleImageGood(byte *dst, uint16 dstPitch, uint16 dstWidth, uint16 dstHeight, byte *src, uint16 srcPitch, uint16 srcWidth, uint16 srcHeight, byte *backbuf) {
+void Screen::scaleImageGood(byte *dst, uint16 dstPitch, uint16 dstWidth, uint16 dstHeight, byte *src, uint16 srcPitch, uint16 srcWidth, uint16 srcHeight, byte *backbuf) {
 	for (int y = 0; y < dstHeight; y++) {
 		for (int x = 0; x < dstWidth; x++) {
 			uint8 c1, c2, c3, c4;
@@ -194,7 +195,7 @@
  * @param colour colour of the point
  */
 
-void Graphics::plotPoint(int16 x, int16 y, uint8 colour) {
+void Screen::plotPoint(int16 x, int16 y, uint8 colour) {
 	byte *buf = _buffer + MENUDEEP * RENDERWIDE;
 
 	x -= _scrollX;
@@ -217,7 +218,7 @@
 
 // Uses Bresenham's incremental algorithm!
 
-void Graphics::drawLine(int16 x0, int16 y0, int16 x1, int16 y1, uint8 colour) {
+void Screen::drawLine(int16 x0, int16 y0, int16 x1, int16 y1, uint8 colour) {
 	int dxmod, dymod;
 	int ince, incne;
 	int d;
@@ -363,7 +364,7 @@
  * @param h height of the current location
  */
 
-void Graphics::setLocationMetrics(uint16 w, uint16 h) {
+void Screen::setLocationMetrics(uint16 w, uint16 h) {
 	_locationWide = w;
 	_locationDeep = h;
 	setNeedFullRedraw();
@@ -374,7 +375,7 @@
  * parallax can be either foreground, background or the main screen.
  */
 
-void Graphics::renderParallax(Parallax *p, int16 l) {
+void Screen::renderParallax(Parallax *p, int16 l) {
 	int16 x, y;
 	Common::Rect r;
 
@@ -420,7 +421,7 @@
  * Initialises the timers before the render loop is entered.
  */
 
-void Graphics::initialiseRenderCycle(void) {
+void Screen::initialiseRenderCycle(void) {
 	_initialTime = _vm->_system->getMillis();
 	_totalTime = _initialTime + MILLISECSPERCYCLE;
 }
@@ -430,7 +431,7 @@
  * render cycle.
  */
 
-void Graphics::startRenderCycle(void) {
+void Screen::startRenderCycle(void) {
 	_scrollXOld = _scrollX;
 	_scrollYOld = _scrollY;
 
@@ -458,7 +459,7 @@
  *         or false if it should continue
  */
 
-bool Graphics::endRenderCycle(void) {
+bool Screen::endRenderCycle(void) {
 	static int32 renderTimeLog[4] = { 60, 60, 60, 60 };
 	static int32 renderCountIndex = 0;
 	int32 time;
@@ -524,7 +525,7 @@
  * Reset scrolling stuff. This function is called from initBackground()
  */
 
-void Graphics::resetRenderEngine(void) {
+void Screen::resetRenderEngine(void) {
 	_parallaxScrollX = 0;
 	_parallaxScrollY = 0;
 	_scrollX = 0;
@@ -532,22 +533,11 @@
 }
 
 /**
- * Sets the scroll target position for the end of the game cycle. The driver
- * will then automatically scroll as many times as it can to reach this
- * position in the allotted time.
- */
-
-void Graphics::setScrollTarget(int16 sx, int16 sy) {
-	_scrollXTarget = sx;
-	_scrollYTarget = sy;
-}
-
-/**
  * This function should be called five times with either the parallax layer
  * or a NULL pointer in order of background parallax to foreground parallax.
  */
 
-int32 Graphics::initialiseBackgroundLayer(Parallax *p) {
+int32 Screen::initialiseBackgroundLayer(Parallax *p) {
 	uint16 i, j, k;
 	byte *data;
 	byte *dst;
@@ -666,7 +656,7 @@
  * Should be called once after leaving the room to free up memory.
  */
 
-void Graphics::closeBackgroundLayer(void) {
+void Screen::closeBackgroundLayer(void) {
 	debug(2, "CloseBackgroundLayer");
 
 	for (int i = 0; i < MAXLAYERS; i++) {
@@ -683,7 +673,7 @@
 }
 
 #ifdef BACKEND_8BIT
-void Graphics::plotYUV(byte *lut, int width, int height, byte *const *dat) {
+void Screen::plotYUV(byte *lut, int width, int height, byte *const *dat) {
 	byte *buf = _buffer + ((480 - height) / 2) * RENDERWIDE + (640 - width) / 2;
 
 	int x, y;

Index: sprite.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/sword2/driver/sprite.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -d -r1.46 -r1.47
--- sprite.cpp	17 Jan 2005 10:57:15 -0000	1.46
+++ sprite.cpp	19 Feb 2005 14:02:16 -0000	1.47
@@ -20,7 +20,7 @@
 
 #include "common/stdafx.h"
 #include "sword2/sword2.h"
-#include "sword2/driver/d_draw.h"
+#include "sword2/build_display.h"
 
 namespace Sword2 {
 
@@ -32,7 +32,7 @@
  * @param h height of the sprite
  */
 
-void Graphics::mirrorSprite(byte *dst, byte *src, int16 w, int16 h) {
+void Screen::mirrorSprite(byte *dst, byte *src, int16 w, int16 h) {
 	for (int y = 0; y < h; y++) {
 		for (int x = 0; x < w; x++) {
 			*dst++ = *(src + w - x - 1);
@@ -44,12 +44,12 @@
 /**
  * This function takes a compressed frame of a sprite with up to 256 colours
  * and decompresses it.
- * @param dest destination buffer
- * @param source source buffer
+ * @param dst destination buffer
+ * @param src source buffer
  * @param decompSize the expected size of the decompressed sprite
  */
 
-int32 Graphics::decompressRLE256(byte *dest, byte *source, int32 decompSize) {
+int32 Screen::decompressRLE256(byte *dst, byte *src, int32 decompSize) {
 	// PARAMETERS:
 	// source	points to the start of the sprite data for input
 	// decompSize	gives size of decompressed data in bytes
@@ -57,35 +57,35 @@
 	// 		data
 
 	byte headerByte;			// block header byte
-	byte *endDest = dest + decompSize;	// pointer to byte after end of decomp buffer
+	byte *endDest = dst + decompSize;	// pointer to byte after end of decomp buffer
 	int32 rv;
 
-	while(1) {
+	while (1) {
 		// FLAT block
 		// read FLAT block header & increment 'scan' to first pixel
 		// of block
-		headerByte = *source++;
+		headerByte = *src++;
 
 		// if this isn't a zero-length block
 		if (headerByte) {
-			if (dest + headerByte > endDest) {
+			if (dst + headerByte > endDest) {
 				rv = 1;
 				break;
 			}
 
 			// set the next 'headerByte' pixels to the next colour
 			// at 'source'
-			memset(dest, *source, headerByte);
+			memset(dst, *src, headerByte);
 
 			// increment destination pointer to just after this
 			// block
-			dest += headerByte;
+			dst += headerByte;
 
 			// increment source pointer to just after this colour
-			source++;
+			src++;
 
 			// if we've decompressed all of the data
-			if (dest == endDest) {
+			if (dst == endDest) {
 				rv = 0;		// return "OK"
 				break;
 			}
@@ -94,28 +94,28 @@
 		// RAW block
 		// read RAW block header & increment 'scan' to first pixel of
 		// block
-		headerByte = *source++;
+		headerByte = *src++;
 
 		// if this isn't a zero-length block
 		if (headerByte) {
-			if (dest + headerByte > endDest) {
+			if (dst + headerByte > endDest) {
 				rv = 1;
 				break;
 			}
 
 			// copy the next 'headerByte' pixels from source to
 			// destination
-			memcpy(dest,source,headerByte);
+			memcpy(dst, src, headerByte);
 
 			// increment destination pointer to just after this
 			// block
-			dest += headerByte;
+			dst += headerByte;
 
 			// increment source pointer to just after this block
-			source += headerByte;
+			src += headerByte;
 
 			// if we've decompressed all of the data
-			if (dest == endDest) {
+			if (dst == endDest) {
 				rv = 0;		// return "OK"
 				break;
 			}
@@ -129,19 +129,19 @@
  * Unwinds a run of 16-colour data into 256-colour palette data.
  */
 
-void Graphics::unwindRaw16(byte *dest, byte *source, uint8 blockSize, byte *colTable) {
+void Screen::unwindRaw16(byte *dst, byte *src, uint8 blockSize, byte *colTable) {
 	// for each pair of pixels
 	while (blockSize > 1) {
 		// 1st colour = number in table at position given by upper
 		// nibble of source byte
-		*dest++ = colTable[(*source) >> 4];
+		*dst++ = colTable[(*src) >> 4];
 
 		// 2nd colour = number in table at position given by lower
 		// nibble of source byte
-		*dest++ = colTable[(*source) & 0x0f];
+		*dst++ = colTable[(*src) & 0x0f];
 
 		// point to next source byte
-		source++;
+		src++;
 
 		// decrement count of how many pixels left to read
 		blockSize -= 2;
@@ -151,50 +151,50 @@
 	if (blockSize) {
 		// colour = number in table at position given by upper nibble
 		// of source byte
-		*dest++ = colTable[(*source) >> 4];
+		*dst++ = colTable[(*src) >> 4];
 	}
 }
 
 /**
  * This function takes a compressed frame of a sprite (with up to 16 colours)
  * and decompresses it.
- * @param dest destination buffer
- * @param source source buffer
+ * @param dst destination buffer
+ * @param src source buffer
  * @param decompSize the expected size of the uncompressed sprite
  * @param colTable mapping from the 16 encoded colours to the current palette
  */
 
-int32 Graphics::decompressRLE16(byte *dest, byte *source, int32 decompSize, byte *colTable) {
+int32 Screen::decompressRLE16(byte *dst, byte *src, int32 decompSize, byte *colTable) {
 	byte headerByte;			// block header byte
-	byte *endDest = dest + decompSize;	// pointer to byte after end of decomp buffer
+	byte *endDest = dst + decompSize;	// pointer to byte after end of decomp buffer
 	int32 rv;
 
-	while(1) {
+	while (1) {
 		// FLAT block
 		// read FLAT block header & increment 'scan' to first pixel
 		// of block
-		headerByte = *source++;
+		headerByte = *src++;
 
 		// if this isn't a zero-length block
 		if (headerByte) {
-			if (dest + headerByte > endDest) {
+			if (dst + headerByte > endDest) {
 				rv = 1;
 				break;
 			}
 
 			// set the next 'headerByte' pixels to the next
 			// colour at 'source'
-			memset(dest, *source, headerByte);
+			memset(dst, *src, headerByte);
 
 			// increment destination pointer to just after this
 			// block
-			dest += headerByte;
+			dst += headerByte;
 
 			// increment source pointer to just after this colour
-			source++;
+			src++;
 
 			// if we've decompressed all of the data
-			if (dest == endDest) {	
+			if (dst == endDest) {	
 				rv = 0;		// return "OK"
 				break;
 			}
@@ -203,29 +203,29 @@
 		// RAW block
 		// read RAW block header & increment 'scan' to first pixel of
 		// block
-		headerByte = *source++;
+		headerByte = *src++;
 
 		// if this isn't a zero-length block
 		if (headerByte) {
-			if (dest + headerByte > endDest) {
+			if (dst + headerByte > endDest) {
 				rv = 1;
 				break;
 			}
 
 			// copy the next 'headerByte' pixels from source to
 			// destination (NB. 2 pixels per byte)
-			unwindRaw16(dest, source, headerByte, colTable);
+			unwindRaw16(dst, src, headerByte, colTable);
 
 			// increment destination pointer to just after this
 			// block
-			dest += headerByte;
+			dst += headerByte;
 
 			// increment source pointer to just after this block
 			// (NB. headerByte gives pixels, so /2 for bytes)
-			source += (headerByte + 1) / 2;
+			src += (headerByte + 1) / 2;
 
 			// if we've decompressed all of the data
-			if (dest >= endDest) {
+			if (dst >= endDest) {
 				rv = 0;		// return "OK"
 				break;
 			}
@@ -244,7 +244,7 @@
  * @return RD_OK, or an error code
  */
 
-int32 Graphics::createSurface(SpriteInfo *s, byte **sprite) {
+int32 Screen::createSurface(SpriteInfo *s, byte **sprite) {
 	*sprite = (byte *) malloc(s->w * s->h);
 	if (!*sprite)
 		return RDERR_OUTOFMEMORY;
@@ -269,7 +269,7 @@
  * @param clipRect the clipping rectangle
  */
 
-void Graphics::drawSurface(SpriteInfo *s, byte *surface, Common::Rect *clipRect) {
+void Screen::drawSurface(SpriteInfo *s, byte *surface, Common::Rect *clipRect) {
 	Common::Rect rd, rs;
 	uint16 x, y;
 	byte *src, *dst;
@@ -328,7 +328,7 @@
  * Destroys a surface.
  */
 
-void Graphics::deleteSurface(byte *surface) {
+void Screen::deleteSurface(byte *surface) {
 	free(surface);
 }
 
@@ -353,7 +353,7 @@
 // FIXME: I'm sure this could be optimized. There's plenty of data copying and
 // mallocing here.
 
-int32 Graphics::drawSprite(SpriteInfo *s) {
+int32 Screen::drawSprite(SpriteInfo *s) {
 	byte *src, *dst;
 	byte *sprite, *newSprite;
 	uint16 scale;
@@ -610,7 +610,7 @@
  * Opens the light masking sprite for a room.
  */
 
-int32 Graphics::openLightMask(SpriteInfo *s) {
+int32 Screen::openLightMask(SpriteInfo *s) {
 	// FIXME: The light mask is only needed on higher graphics detail
 	// settings, so to save memory we could simply ignore it on lower
 	// settings. But then we need to figure out how to ensure that it
@@ -633,7 +633,7 @@
  * Closes the light masking sprite for a room.
  */
 
-int32 Graphics::closeLightMask(void) {
+int32 Screen::closeLightMask(void) {
 	if (!_lightMask)
 		return RDERR_NOTOPEN;
 

--- d_draw.h DELETED ---





More information about the Scummvm-git-logs mailing list