[Scummvm-cvs-logs] SF.net SVN: scummvm: [27578] scummvm/trunk/engines/agos

Kirben at users.sourceforge.net Kirben at users.sourceforge.net
Thu Jun 21 07:10:42 CEST 2007


Revision: 27578
          http://scummvm.svn.sourceforge.net/scummvm/?rev=27578&view=rev
Author:   Kirben
Date:     2007-06-20 22:10:42 -0700 (Wed, 20 Jun 2007)

Log Message:
-----------
Fix regressions, due to buffer changes and cleanup.

Modified Paths:
--------------
    scummvm/trunk/engines/agos/agos.h
    scummvm/trunk/engines/agos/animation.cpp
    scummvm/trunk/engines/agos/draw.cpp
    scummvm/trunk/engines/agos/gfx.cpp
    scummvm/trunk/engines/agos/vga.cpp
    scummvm/trunk/engines/agos/vga_ww.cpp

Modified: scummvm/trunk/engines/agos/agos.h
===================================================================
--- scummvm/trunk/engines/agos/agos.h	2007-06-21 03:14:20 UTC (rev 27577)
+++ scummvm/trunk/engines/agos/agos.h	2007-06-21 05:10:42 UTC (rev 27578)
@@ -1158,7 +1158,7 @@
 	void restoreBackGround();
 	void saveBackGround(VgaSprite *vsp);
 
-	void clearSurfaces(uint num_lines);
+	void clearSurfaces();
 	void displayScreen();
 
 	void dumpVideoScript(const byte *src, bool one_opcode_only);
@@ -1169,7 +1169,10 @@
 	void dumpSingleBitmap(int file, int image, const byte *offs, int w, int h, byte base);
 	void dumpBitmap(const char *filename, const byte *offs, int w, int h, int flags, const byte *palette, byte base);
 
-	void fillBackGroundFromBack(uint lines);
+	void fillBackFromBackGround(uint16 height, uint16 width);
+	void fillBackFromFront();
+	void fillBackGroundFromBack();
+	void fillBackGroundFromFront();
 
 	virtual void doOutput(const byte *src, uint len);
 	void clsCheck(WindowBlock *window);

Modified: scummvm/trunk/engines/agos/animation.cpp
===================================================================
--- scummvm/trunk/engines/agos/animation.cpp	2007-06-21 03:14:20 UTC (rev 27577)
+++ scummvm/trunk/engines/agos/animation.cpp	2007-06-21 05:10:42 UTC (rev 27578)
@@ -141,7 +141,7 @@
 
 	// Resolution is smaller in Amiga verison so always clear screen
 	if (_width == 384 && _height == 280) {
-		_vm->_system->clearScreen();
+		_vm->clearSurfaces();
 	}
 
 	_ticks = _vm->_system->getMillis();
@@ -156,16 +156,15 @@
 	_vm->o_killAnimate();
 
 	if (_vm->getBitFlag(41)) {
-		Graphics::Surface *screen = _vm->_system->lockScreen();
-		memcpy(_vm->_backBuf, (byte *)screen->pixels, _frameSize);
-		_vm->_system->unlockScreen();
+		_vm->fillBackFromFront();
 	} else {
 		uint8 palette[1024];
 		memset(palette, 0, sizeof(palette));
-		_vm->clearSurfaces(480);
+		_vm->clearSurfaces();
 		_vm->_system->setPalette(palette, 0, 256);
 	}
 
+	 _vm->fillBackGroundFromBack();
 	_vm->_fastFadeOutFlag = true;
 }
 

Modified: scummvm/trunk/engines/agos/draw.cpp
===================================================================
--- scummvm/trunk/engines/agos/draw.cpp	2007-06-21 03:14:20 UTC (rev 27577)
+++ scummvm/trunk/engines/agos/draw.cpp	2007-06-21 05:10:42 UTC (rev 27578)
@@ -656,7 +656,7 @@
 		_scrollY += _scrollFlag;
 		vcWriteVar(250, _scrollY);
 
-		memcpy(_backBuf, _backGroundBuf, _screenHeight * _scrollWidth);
+		fillBackFromBackGround(_screenHeight, _scrollWidth);
 	} else {
 		if (_scrollFlag < 0) {
 			memmove(dst + 8, dst, _screenWidth * _scrollHeight - 8);
@@ -684,7 +684,7 @@
 		if (getGameType() == GType_SIMON2) {
 			memcpy(_window4BackScn, _backGroundBuf, _scrollHeight * _screenWidth);
 		} else {
-			memcpy(_backBuf, _backGroundBuf, _scrollHeight * _screenWidth);
+			fillBackFromBackGround(_scrollHeight, _screenWidth);
 		}
 
 		setMoveRect(0, 0, 320, _scrollHeight);
@@ -709,19 +709,34 @@
 	}
 }
 
-void AGOSEngine::clearSurfaces(uint num_lines) {
-	Graphics::Surface *screen = _system->lockScreen();
+void AGOSEngine::clearSurfaces() {
+	_system->clearScreen();
 
-	memset((byte *)screen->pixels, 0, num_lines * _screenWidth);
-	memset(_backBuf, 0, num_lines * _screenWidth);
+	if (_backBuf) {
+		memset(_backBuf, 0, _screenHeight * _screenWidth);
+	}
+}
 
+void AGOSEngine::fillBackFromBackGround(uint16 height, uint16 width) {
+	memcpy(_backBuf, _backGroundBuf, height * width);
+}
+
+void AGOSEngine::fillBackFromFront() {
+	Graphics::Surface *screen = _system->lockScreen();
+	memcpy(_backBuf, (byte *)screen->pixels, _screenHeight * _screenWidth);
 	_system->unlockScreen();
 }
 
-void AGOSEngine::fillBackGroundFromBack(uint lines) {
-	memcpy(_backGroundBuf, _backBuf, lines * _screenWidth);
+void AGOSEngine::fillBackGroundFromBack() {
+	memcpy(_backGroundBuf, _backBuf, _screenHeight * _screenWidth);
 }
 
+void AGOSEngine::fillBackGroundFromFront() {
+	Graphics::Surface *screen = _system->lockScreen();
+	memcpy(_backGroundBuf, (byte *)screen->pixels, _screenHeight * _screenWidth);
+	_system->unlockScreen();
+}
+
 void AGOSEngine::setMoveRect(uint16 x, uint16 y, uint16 width, uint16 height) {
 	if (x < _moveXMin)
 		_moveXMin = x;
@@ -750,7 +765,7 @@
 		memcpy((byte *)screen->pixels, getBackBuf(), _screenWidth * _screenHeight);
 
 		if (getGameId() != GID_DIMP)
-			memcpy(getBackBuf(), getBackGround(), _screenWidth * _screenHeight);
+			fillBackFromBackGround(_screenHeight, _screenWidth);
 	} else {
 		if (_window4Flag == 2) {
 			_window4Flag = 0;

Modified: scummvm/trunk/engines/agos/gfx.cpp
===================================================================
--- scummvm/trunk/engines/agos/gfx.cpp	2007-06-21 03:14:20 UTC (rev 27577)
+++ scummvm/trunk/engines/agos/gfx.cpp	2007-06-21 05:10:42 UTC (rev 27578)
@@ -1301,7 +1301,7 @@
 	setImage(vga_res_id);
 
 	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		fillBackGroundFromBack(_screenHeight);
+		fillBackGroundFromBack();
 		_syncFlag2 = 1;
 	} else {
 		_copyScnFlag = 2;

Modified: scummvm/trunk/engines/agos/vga.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga.cpp	2007-06-21 03:14:20 UTC (rev 27577)
+++ scummvm/trunk/engines/agos/vga.cpp	2007-06-21 05:10:42 UTC (rev 27578)
@@ -1217,7 +1217,7 @@
 	uint16 windowNum = vcReadNextWord();
 
 	if (getGameType() == GType_FF || getGameType() == GType_PP) {
-		memcpy(_backGroundBuf, _backBuf, _screenHeight * _screenWidth);
+		fillBackGroundFromFront();
 	} else {
 		setWindowImage(windowNum, vga_res);
 	}

Modified: scummvm/trunk/engines/agos/vga_ww.cpp
===================================================================
--- scummvm/trunk/engines/agos/vga_ww.cpp	2007-06-21 03:14:20 UTC (rev 27577)
+++ scummvm/trunk/engines/agos/vga_ww.cpp	2007-06-21 05:10:42 UTC (rev 27578)
@@ -234,13 +234,11 @@
 			delay(5);
 		}
 
-		if (getGameType() == GType_FF || getGameType() == GType_PP) {
-			clearSurfaces(_screenHeight);
-		} else if (getGameType() == GType_WW) {
-			_system->clearScreen();
+		if (getGameType() == GType_WW || getGameType() == GType_FF || getGameType() == GType_PP) {
+			clearSurfaces();
 		} else {
 			if (_windowNum != 4) {
-				_system->clearScreen();
+				clearSurfaces();
 			}
 		}
 	}


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list