[Scummvm-cvs-logs] SF.net SVN: scummvm:[43048] scummvm/trunk/engines/drascula

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Tue Aug 4 19:22:18 CEST 2009


Revision: 43048
          http://scummvm.svn.sourceforge.net/scummvm/?rev=43048&view=rev
Author:   thebluegr
Date:     2009-08-04 17:22:18 +0000 (Tue, 04 Aug 2009)

Log Message:
-----------
Removed the superfluous VGA buffer, replacing it with direct writes to the video buffer

Modified Paths:
--------------
    scummvm/trunk/engines/drascula/drascula.cpp
    scummvm/trunk/engines/drascula/drascula.h
    scummvm/trunk/engines/drascula/graphics.cpp
    scummvm/trunk/engines/drascula/rooms.cpp

Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp	2009-08-04 17:12:19 UTC (rev 43047)
+++ scummvm/trunk/engines/drascula/drascula.cpp	2009-08-04 17:22:18 UTC (rev 43048)
@@ -182,10 +182,6 @@
 
 	for (;;) {
 		int i;
-
-		VGA = (byte *)malloc(320 * 200);
-		memset(VGA, 0, 64000);
-
 		takeObject = 0;
 		_menuBar = false;
 		_menuScreen = false;
@@ -296,7 +292,6 @@
 	MusicFadeout();
 	stopMusic();
 	freeMemory();
-	free(VGA);
 }
 
 bool DrasculaEngine::runCurrentChapter() {

Modified: scummvm/trunk/engines/drascula/drascula.h
===================================================================
--- scummvm/trunk/engines/drascula/drascula.h	2009-08-04 17:12:19 UTC (rev 43047)
+++ scummvm/trunk/engines/drascula/drascula.h	2009-08-04 17:22:18 UTC (rev 43048)
@@ -344,7 +344,6 @@
 	byte *mouseCursor;
 
 	// Graphics buffers/pointers
-	byte *VGA;
 	byte *bgSurface;
 	byte *backSurface;
 	byte *drawSurface3;
@@ -353,7 +352,6 @@
 	byte *extraSurface;	// not sure about this one, was "dir_hare_dch"
 	byte *screenSurface;
 	byte *frontSurface;
-	byte *textSurface;
 	byte *memPtr;
 	byte *mSession;
 

Modified: scummvm/trunk/engines/drascula/graphics.cpp
===================================================================
--- scummvm/trunk/engines/drascula/graphics.cpp	2009-08-04 17:12:19 UTC (rev 43047)
+++ scummvm/trunk/engines/drascula/graphics.cpp	2009-08-04 17:22:18 UTC (rev 43048)
@@ -24,6 +24,7 @@
  */
 
 #include "drascula/drascula.h"
+#include "graphics/surface.h"
 
 namespace Drascula {
 
@@ -126,16 +127,18 @@
 	}
 
 	byte *prevFrame = (byte *)malloc(64000);
-	memcpy(prevFrame, VGA, 64000);
+	byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
+	memcpy(prevFrame, screenBuffer, 64000);
 
-	decodeRLE(pcxData, VGA);
+	decodeRLE(pcxData, screenBuffer);
 	free(pcxData);
 
 	if (!firstFrame)
-		mixVideo(VGA, prevFrame);
+		mixVideo(screenBuffer, prevFrame);
 
-	_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+	_system->unlockScreen();
 	_system->updateScreen();
+
 	if (firstFrame)
 		setPalette(cPal);
 
@@ -192,8 +195,9 @@
 }
 
 void DrasculaEngine::updateScreen(int xorg, int yorg, int xdes, int ydes, int width, int height, byte *buffer) {
-	copyBackground(xorg, yorg, xdes, ydes, width, height, buffer, VGA);
-	_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+	byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
+	copyBackground(xorg, yorg, xdes, ydes, width, height, buffer, screenBuffer);
+	_system->unlockScreen();
 	_system->updateScreen();
 }
 
@@ -421,6 +425,7 @@
 
 		int x1_, y1_, off1, off2;
 
+		byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
 		for (int i = 0; i < 200; i++) {
 			for (int j = 0; j < 320; j++) {
 				x1_ = j + tempRow[i];
@@ -438,10 +443,11 @@
 				y1_ = checkWrapY(y1_);
 				off2 = 320 * y1_ + x1_;
 
-				VGA[320 * i + j] = ghost[bgSurface[off2] + (copia[off1] << 8)];
+				screenBuffer[320 * i + j] = ghost[bgSurface[off2] + (copia[off1] << 8)];
 			}
 		}
-		_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+
+		_system->unlockScreen();
 		_system->updateScreen();
 
 		_system->delayMillis(20);
@@ -534,11 +540,14 @@
 			decodeRLE(BufferSSN, screenSurface);
 			free(BufferSSN);
 			waitFrameSSN();
+
+			byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
 			if (FrameSSN)
-				mixVideo(VGA, screenSurface);
+				mixVideo(screenBuffer, screenSurface);
 			else
-				memcpy(VGA, screenSurface, 64000);
-			_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+				memcpy(screenBuffer, screenSurface, 64000);
+			
+			_system->unlockScreen();
 			_system->updateScreen();
 			FrameSSN++;
 		} else {
@@ -553,11 +562,13 @@
 				decodeOffset(BufferSSN, screenSurface, length);
 				free(BufferSSN);
 				waitFrameSSN();
+				byte *screenBuffer = (byte *)_system->lockScreen()->pixels;
 				if (FrameSSN)
-					mixVideo(VGA, screenSurface);
+					mixVideo(screenBuffer, screenSurface);
 				else
-					memcpy(VGA, screenSurface, 64000);
-				_system->copyRectToScreen((const byte *)VGA, 320, 0, 0, 320, 200);
+					memcpy(screenBuffer, screenSurface, 64000);
+
+				_system->unlockScreen();
 				_system->updateScreen();
 				FrameSSN++;
 			}

Modified: scummvm/trunk/engines/drascula/rooms.cpp
===================================================================
--- scummvm/trunk/engines/drascula/rooms.cpp	2009-08-04 17:12:19 UTC (rev 43047)
+++ scummvm/trunk/engines/drascula/rooms.cpp	2009-08-04 17:22:18 UTC (rev 43048)
@@ -1866,7 +1866,6 @@
 }
 
 void DrasculaEngine::clearRoom() {
-	memset(VGA, 0, 64000);
 	_system->fillScreen(0);
 	_system->updateScreen();
 }


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