[Scummvm-cvs-logs] SF.net SVN: scummvm:[36064] scummvm/branches/branch-0-13-0/engines/tucker

cyx at users.sourceforge.net cyx at users.sourceforge.net
Sun Jan 25 19:12:18 CET 2009


Revision: 36064
          http://scummvm.svn.sourceforge.net/scummvm/?rev=36064&view=rev
Author:   cyx
Date:     2009-01-25 18:12:18 +0000 (Sun, 25 Jan 2009)

Log Message:
-----------
backport 36044,36063: TUCKER: add playable demo version support

Modified Paths:
--------------
    scummvm/branches/branch-0-13-0/engines/tucker/detection.cpp
    scummvm/branches/branch-0-13-0/engines/tucker/resource.cpp
    scummvm/branches/branch-0-13-0/engines/tucker/staticres.cpp
    scummvm/branches/branch-0-13-0/engines/tucker/tucker.cpp
    scummvm/branches/branch-0-13-0/engines/tucker/tucker.h

Modified: scummvm/branches/branch-0-13-0/engines/tucker/detection.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/engines/tucker/detection.cpp	2009-01-25 18:08:26 UTC (rev 36063)
+++ scummvm/branches/branch-0-13-0/engines/tucker/detection.cpp	2009-01-25 18:12:18 UTC (rev 36064)
@@ -87,6 +87,14 @@
 		Common::kPlatformPC,
 		Tucker::kGameFlagEncodedData
 	},
+	{
+		"tucker",
+		"Demo",
+		AD_ENTRY1s("infobar.txt", "010b055de42097b140d5bcb6e95a5c7c", 203),
+		Common::EN_ANY,
+		Common::kPlatformPC,
+		Common::ADGF_DEMO | Tucker::kGameFlagDemo,
+	},
 	AD_TABLE_END_MARKER
 };
 
@@ -103,11 +111,11 @@
 
 static const Common::ADGameDescription tuckerDemoGameDescription = {
 	"tucker",
-	"Demo",
+	"Non-Interactive Demo",
 	AD_ENTRY1(0, 0),
 	Common::EN_ANY,
 	Common::kPlatformPC,
-	Common::ADGF_DEMO | Tucker::kGameFlagDemo
+	Common::ADGF_DEMO | Tucker::kGameFlagDemo | Tucker::kGameFlagIntroOnly
 };
 
 class TuckerMetaEngine : public Common::AdvancedMetaEngine {

Modified: scummvm/branches/branch-0-13-0/engines/tucker/resource.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/engines/tucker/resource.cpp	2009-01-25 18:08:26 UTC (rev 36063)
+++ scummvm/branches/branch-0-13-0/engines/tucker/resource.cpp	2009-01-25 18:12:18 UTC (rev 36064)
@@ -342,7 +342,11 @@
 			char filename[40];
 			switch (_flagsTable[137]) {
 			case 0:
-				sprintf(filename, "bud_%d.pcx", frame + 1);
+				if ((_gameFlags & kGameFlagDemo) != 0) {
+					sprintf(filename, "budl00_%d.pcx", frame + 1);
+				} else {
+					sprintf(filename, "bud_%d.pcx", frame + 1);
+				}
 				break;
 			case 1:
 				sprintf(filename, "peg_%d.pcx", frame + 1);
@@ -413,6 +417,9 @@
 		_spriteAnimationsTable[entry].firstFrameIndex = i;
 		while (start != 999) {
 			start = t.getNextInteger();
+			if (start == 9999) { // end marker in the demo version
+				start = 999;
+			}
 			_spriteAnimationFramesTable[i] = start;
 			++i;
 		}
@@ -477,7 +484,9 @@
 		return;
 	}
 	debug(2, "loadObj() partNum %d locationNum %d", _partNum, _locationNum);
-	handleNewPartSequence();
+	if ((_gameFlags & kGameFlagDemo) == 0) {
+		handleNewPartSequence();
+	}
 	_currentPartNum = _partNum;
 
 	char filename[40];
@@ -651,16 +660,20 @@
 
 void TuckerEngine::loadActionFile() {
 	char filename[40];
-	switch (_partNum) {
-	case 1:
-		strcpy(filename, "action1.c");
-		break;
-	case 2:
-		strcpy(filename, "action2.c");
-		break;
-	default:
-		strcpy(filename, "action3.c");
-		break;
+	if ((_gameFlags & kGameFlagDemo) != 0) {
+		strcpy(filename, "action.c");
+	} else {
+		switch (_partNum) {
+		case 1:
+			strcpy(filename, "action1.c");
+			break;
+		case 2:
+			strcpy(filename, "action2.c");
+			break;
+		default:
+			strcpy(filename, "action3.c");
+			break;
+		}
 	}
 	loadFile(filename, _loadTempBuf);
 

Modified: scummvm/branches/branch-0-13-0/engines/tucker/staticres.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/engines/tucker/staticres.cpp	2009-01-25 18:08:26 UTC (rev 36063)
+++ scummvm/branches/branch-0-13-0/engines/tucker/staticres.cpp	2009-01-25 18:12:18 UTC (rev 36064)
@@ -28,7 +28,7 @@
 
 namespace Tucker {
 
-const int TuckerEngine::_locationWidthTable[85] = {
+const uint8 TuckerEngine::_locationWidthTableGame[85] = {
 	1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 4, 2, 1,
 	1, 2, 1, 2, 4, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1,
 	1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 4, 1,
@@ -36,6 +36,13 @@
 	1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0
 };
 
+const uint8 TuckerEngine::_locationWidthTableDemo[70] = {
+	1, 1, 1, 2, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1, 2, 1,
+	1, 2, 1, 2, 4, 1, 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1,
+	1, 1, 1, 1, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 1,
+	1, 1, 1, 1, 2, 1, 2, 2, 2, 4, 4, 2, 2, 1, 1, 0
+};
+
 const uint8 TuckerEngine::_sprA02LookupTable[88] = {
 	0, 6, 2, 8, 1, 0, 6, 0, 2, 2, 2, 1, 2, 0, 1, 1, 6, 0,
 	1, 2, 1, 2, 3, 0, 6, 12, 7, 7, 1, 8, 1, 0, 3, 0, 4,
@@ -165,7 +172,7 @@
 	0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000
 };
 
-int TuckerEngine::_locationHeightTable[80] = {
+uint8 TuckerEngine::_locationHeightTableGame[80] = {
 	0x00, 0x1C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x3C, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -173,6 +180,14 @@
 	0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 };
 
+uint8 TuckerEngine::_locationHeightTableDemo[70] = {
+	0x00, 0x1C, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x3C, 0x00, 0x3C, 0x3C, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+	0x00, 0x00, 0x00, 0x00, 0x00, 0x00
+};
+
 int TuckerEngine::_objectKeysPosXTable[80] = {
 	0x000, 0x0A0, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000, 0x12B, 0x000, 0x000, 0x000, 0x000, 0x000, 0x000,
 	0x000, 0x000, 0x000, 0x140, 0x000, 0x000, 0x000, 0x000, 0x09E, 0x060, 0x0C0, 0x040, 0x0A0, 0x12C, 0x068, 0x098,

Modified: scummvm/branches/branch-0-13-0/engines/tucker/tucker.cpp
===================================================================
--- scummvm/branches/branch-0-13-0/engines/tucker/tucker.cpp	2009-01-25 18:08:26 UTC (rev 36063)
+++ scummvm/branches/branch-0-13-0/engines/tucker/tucker.cpp	2009-01-25 18:12:18 UTC (rev 36064)
@@ -60,7 +60,7 @@
 
 Common::Error TuckerEngine::go() {
 	handleIntroSequence();
-	if ((_gameFlags & kGameFlagDemo) == 0 && !shouldQuit()) {
+	if ((_gameFlags & kGameFlagIntroOnly) == 0 && !shouldQuit()) {
 		mainLoop();
 	}
 	return Common::kNoError;
@@ -130,7 +130,7 @@
 	_locationNum = 0;
 	_nextLocationNum = ConfMan.getInt("boot_param");
 	if (_nextLocationNum == 0) {
-		_nextLocationNum = kStartupLocation;
+		_nextLocationNum = (_gameFlags & kGameFlagDemo) == 0 ? kStartupLocationGame : kStartupLocationDemo;
 	}
 	_gamePaused = _gamePaused2 = false;
 	_gameDebug = false;
@@ -143,6 +143,14 @@
 	_gameHintsDisplayText = 0;
 	_gameHintsStringNum = 0;
 
+	if ((_gameFlags & kGameFlagDemo) == 0) {
+		_locationWidthTable = _locationWidthTableGame;
+		_locationHeightTable = _locationHeightTableGame;
+	} else {
+		_locationWidthTable = _locationWidthTableDemo;
+		_locationHeightTable = _locationHeightTableDemo;
+	}
+
 	memset(_sprA02Table, 0, sizeof(_sprA02Table));
 	memset(_sprC02Table, 0, sizeof(_sprC02Table));
 	memset(_actionsTable, 0, sizeof(_actionsTable));
@@ -329,6 +337,10 @@
 
 	openCompressedSoundFile();
 	loadCharSizeDta();
+	if ((_gameFlags & kGameFlagDemo) != 0) {
+		addObjectToInventory(30);
+		addObjectToInventory(12);
+	}
 	loadCharset();
 	loadPanel();
 	loadFile("infobar.txt", _infoBarBuf);
@@ -2813,7 +2825,7 @@
 		offset += _charWidthTable[chr];
 		++pos;
 	}
-	addDirtyRect(startOffset % 640, startOffset / 640, (offset - startOffset) % 640, Graphics::_charset.charH);
+	addDirtyRect(startOffset % 640, startOffset / 640, Graphics::_charset.charW * pos, Graphics::_charset.charH);
 }
 
 void TuckerEngine::drawItemString(int offset, int num, const uint8 *str) {
@@ -3770,13 +3782,13 @@
 
 void TuckerEngine::drawSpeechTextLine(const uint8 *dataPtr, int pos, int count, int dstOffset, uint8 color) {
 	int startOffset = dstOffset;
-	while (count > 0 && dataPtr[pos] != '\n') {
+	int i = 0;
+	for (; i < count && dataPtr[pos] != '\n'; ++i) {
 		Graphics::drawStringChar(_locationBackgroundGfxBuf + dstOffset, dataPtr[pos], 640, color, _charsetGfxBuf);
 		dstOffset += _charWidthTable[dataPtr[pos]];
 		++pos;
-		--count;
 	}
-	addDirtyRect(startOffset % 640, startOffset / 640, (dstOffset - startOffset) % 640, Graphics::_charset.charH);
+	addDirtyRect(startOffset % 640, startOffset / 640, Graphics::_charset.charW * i, Graphics::_charset.charH);
 }
 
 void TuckerEngine::redrawScreen(int offset) {

Modified: scummvm/branches/branch-0-13-0/engines/tucker/tucker.h
===================================================================
--- scummvm/branches/branch-0-13-0/engines/tucker/tucker.h	2009-01-25 18:08:26 UTC (rev 36063)
+++ scummvm/branches/branch-0-13-0/engines/tucker/tucker.h	2009-01-25 18:12:18 UTC (rev 36064)
@@ -175,7 +175,8 @@
 	kScreenHeight = 200,
 	kScreenPitch = 640,
 	kFadePaletteStep = 5,
-	kStartupLocation = 1,
+	kStartupLocationDemo = 9,
+	kStartupLocationGame = 1,
 	kDefaultCharSpeechSoundCounter = 1,
 	kMaxSoundVolume = 127,
 	kLastSaveSlot = 99
@@ -205,7 +206,8 @@
 enum GameFlag {
 	kGameFlagDemo = 1 << 0,
 	kGameFlagEncodedData = 1 << 1,
-	kGameFlagNoSubtitles = 1 << 2
+	kGameFlagNoSubtitles = 1 << 2,
+	kGameFlagIntroOnly = 1 << 3
 };
 
 inline int scaleMixerVolume(int volume, int max = 100) {
@@ -622,6 +624,8 @@
 	uint8 *_csDataBuf;
 	int _csDataSize;
 	uint8 _charWidthTable[256];
+	const uint8 *_locationWidthTable;
+	uint8 *_locationHeightTable;
 
 	int _mousePosX, _mousePosY;
 	int _prevMousePosX, _prevMousePosY;
@@ -815,12 +819,14 @@
 	int _updateLocation70StringLen;
 	uint8 _updateLocation70String[20];
 
-	static const int _locationWidthTable[85];
+	static const uint8 _locationWidthTableGame[85];
+	static const uint8 _locationWidthTableDemo[70];
 	static const uint8 _sprA02LookupTable[88];
 	static const uint8 _sprC02LookupTable[100];
 	static const uint8 _sprC02LookupTable2[100];
 	static const int _staticData3Table[1600];
-	static int _locationHeightTable[80];
+	static uint8 _locationHeightTableGame[80];
+	static uint8 _locationHeightTableDemo[70];
 	static int _objectKeysPosXTable[80];
 	static int _objectKeysPosYTable[80];
 	static int _objectKeysLocationTable[80];


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