[Scummvm-cvs-logs] SF.net SVN: scummvm:[35873] scummvm/trunk/engines/tucker

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Fri Jan 16 21:53:43 CET 2009


Revision: 35873
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35873&view=rev
Author:   fingolfin
Date:     2009-01-16 20:53:43 +0000 (Fri, 16 Jan 2009)

Log Message:
-----------
TUCKER: Simplify TuckerEngine::copyLocBitmap

Modified Paths:
--------------
    scummvm/trunk/engines/tucker/locations.cpp
    scummvm/trunk/engines/tucker/resource.cpp
    scummvm/trunk/engines/tucker/tucker.cpp
    scummvm/trunk/engines/tucker/tucker.h

Modified: scummvm/trunk/engines/tucker/locations.cpp
===================================================================
--- scummvm/trunk/engines/tucker/locations.cpp	2009-01-16 19:32:19 UTC (rev 35872)
+++ scummvm/trunk/engines/tucker/locations.cpp	2009-01-16 20:53:43 UTC (rev 35873)
@@ -189,7 +189,7 @@
 		}
 		if (_flagsTable[10] == 0) {
 			strcpy(_fileToLoad, "path02b.pcx");
-			copyLocBitmap(0, 1);
+			copyLocBitmap(0, true);
 		}
 		for (int i = 0; i < 3; ++i) {
 			if (_updateLocationYPosTable2[i] > 0) {

Modified: scummvm/trunk/engines/tucker/resource.cpp
===================================================================
--- scummvm/trunk/engines/tucker/resource.cpp	2009-01-16 19:32:19 UTC (rev 35872)
+++ scummvm/trunk/engines/tucker/resource.cpp	2009-01-16 20:53:43 UTC (rev 35873)
@@ -431,26 +431,26 @@
 void TuckerEngine::loadLoc() {
 	int i = _locationWidthTable[_locationNum];
 	_locationHeight = (_locationNum < 73) ? 140 : 200;
-	strcpy(_fileToLoad, (i == 1) ? "loc00.pcx" : "loc00a.pcx");
-	copyLocBitmap(0, 0);
+	sprintf(_fileToLoad, (i == 1) ? "loc%02d.pcx" : "loc%02da.pcx", _locationNum);
+	copyLocBitmap(0, false);
 	Graphics::copyFrom640(_locationBackgroundGfxBuf, _quadBackgroundGfxBuf, 320, _locationHeight);
 	if (_locationHeight == 200) {
 		return;
 	}
-	strcpy(_fileToLoad, (i != 2) ? "path00.pcx" : "path00a.pcx");
-	copyLocBitmap(0, 1);
+	sprintf(_fileToLoad, (i != 2) ? "path%02d.pcx" : "path%02da.pcx", _locationNum);
+	copyLocBitmap(0, true);
 	if (i > 1) {
-		strcpy(_fileToLoad, "loc00b.pcx");
-		copyLocBitmap(320, 0);
+		sprintf(_fileToLoad, "loc%02db.pcx", _locationNum);
+		copyLocBitmap(320, false);
 		Graphics::copyFrom640(_locationBackgroundGfxBuf + 320, _quadBackgroundGfxBuf + 44800, 320, 140);
 		if (i == 2) {
-			strcpy(_fileToLoad, "path00b.pcx");
-			copyLocBitmap(320, 1);
+			sprintf(_fileToLoad, "path%02db.pcx", _locationNum);
+			copyLocBitmap(320, true);
 		}
 	}
 	if (i > 2) {
-		strcpy(_fileToLoad, "loc00c.pcx");
-		copyLocBitmap(0, 0);
+		sprintf(_fileToLoad, "loc%02dc.pcx", _locationNum);
+		copyLocBitmap(0, false);
 		Graphics::copyFrom640(_locationBackgroundGfxBuf, _quadBackgroundGfxBuf + 89600, 320, 140);
 	}
 	if (_locationNum == 1) {
@@ -459,8 +459,8 @@
 		loadImage(_loadLocBufPtr, 0);
 	}
 	if (i > 3) {
-		strcpy(_fileToLoad, "loc00d.pcx");
-		copyLocBitmap(0, 0);
+		sprintf(_fileToLoad, "loc%02dd.pcx", _locationNum);
+		copyLocBitmap(0, false);
 		Graphics::copyFrom640(_locationBackgroundGfxBuf + 320, _quadBackgroundGfxBuf + 134400, 320, 140);
 	}
 	_fullRedrawCounter = 2;

Modified: scummvm/trunk/engines/tucker/tucker.cpp
===================================================================
--- scummvm/trunk/engines/tucker/tucker.cpp	2009-01-16 19:32:19 UTC (rev 35872)
+++ scummvm/trunk/engines/tucker/tucker.cpp	2009-01-16 20:53:43 UTC (rev 35873)
@@ -720,19 +720,13 @@
 	}
 }
 
-void TuckerEngine::copyLocBitmap(int offset, int isMask) {
-	int type = (isMask == 0) ? 1 : 0;
+void TuckerEngine::copyLocBitmap(int offset, bool isMask) {
+	int type = !isMask ? 1 : 0;
 	if (offset > 0 && _locationNum == 16) {
 		type = 0;
 	}
-	if (isMask < 2) {
-		char strNum[3];
-		sprintf(strNum, "%02d", _locationNum);
-		const int digitOffset = (isMask == 0) ? 3 : 4;
-		memcpy(_fileToLoad + digitOffset, strNum, 2);
-	}
 	loadImage(_loadTempBuf, type);
-	uint8 *dst = (isMask == 1) ? _locationBackgroundMaskBuf : _locationBackgroundGfxBuf;
+	uint8 *dst = isMask ? _locationBackgroundMaskBuf : _locationBackgroundGfxBuf;
 	dst += offset;
 	const uint8 *src = _loadTempBuf;
 	for (int y = 0; y < _locationHeight; ++y) {

Modified: scummvm/trunk/engines/tucker/tucker.h
===================================================================
--- scummvm/trunk/engines/tucker/tucker.h	2009-01-16 19:32:19 UTC (rev 35872)
+++ scummvm/trunk/engines/tucker/tucker.h	2009-01-16 20:53:43 UTC (rev 35873)
@@ -256,7 +256,7 @@
 	void setCursorNum(int num);
 	void setCursorType(int type);
 	void setupNewLocation();
-	void copyLocBitmap(int offset, int isMask);
+	void copyLocBitmap(int offset, bool isMask);
 	void updateMouseState();
 	void updateCharPositionHelper();
 	void updateCharPosition();


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