[Scummvm-git-logs] scummvm master -> 7aee8f4e4298f2a7c440dc9ffba3eff4d3f25702

bonki bonki at users.noreply.github.com
Fri Mar 2 17:44:11 CET 2018


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
7aee8f4e42 TUCKER: Add Part enum


Commit: 7aee8f4e4298f2a7c440dc9ffba3eff4d3f25702
    https://github.com/scummvm/scummvm/commit/7aee8f4e4298f2a7c440dc9ffba3eff4d3f25702
Author: Adrian Frühwirth (bonki at users.noreply.github.com)
Date: 2018-03-02T17:38:04+01:00

Commit Message:
TUCKER: Add Part enum

Changed paths:
    engines/tucker/resource.cpp
    engines/tucker/sequences.cpp
    engines/tucker/tucker.cpp
    engines/tucker/tucker.h


diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index c2c84b9..133d6c3 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -532,32 +532,32 @@ void TuckerEngine::loadObj() {
 		return;
 	}
 	if (_locationNum < 24) {
-		_partNum = 1;
+		_part = kPartOne;
 		_speechSoundBaseNum = 2639;
 	} else if (_locationNum < 41 || (_locationNum > 69 && _locationNum < 73) || (_locationNum > 78 && _locationNum < 83)) {
-		_partNum = 2;
+		_part = kPartTwo;
 		_speechSoundBaseNum = 2679;
 	} else {
-		_partNum = 3;
+		_part = kPartThree;
 		_speechSoundBaseNum = 2719;
 	}
-	if (_partNum == _currentPartNum) {
+	if (_part == _currentPart) {
 		return;
 	}
-	debug(2, "loadObj() partNum %d locationNum %d", _partNum, _locationNum);
+	debug(2, "loadObj() part %d locationNum %d", _part, _locationNum);
 	// If a savegame is loaded from the launcher, skip the display chapter
 	if (_startSlot != -1)
 		_startSlot = -1;
 	else if ((_gameFlags & kGameFlagDemo) == 0) {
 		handleNewPartSequence();
 	}
-	_currentPartNum = _partNum;
+	_currentPart = _part;
 
 	Common::String filename;
-	filename = Common::String::format("objtxt%d.c", _partNum);
+	filename = Common::String::format("objtxt%d.c", _part);
 	free(_objTxtBuf);
 	_objTxtBuf = loadFile(filename.c_str(), 0);
-	filename = Common::String::format("pt%dtext.c", _partNum);
+	filename = Common::String::format("pt%dtext.c", _part);
 	free(_ptTextBuf);
 	_ptTextBuf = loadFile(filename.c_str(), 0);
 	_characterSpeechDataPtr = _ptTextBuf;
@@ -566,7 +566,7 @@ void TuckerEngine::loadObj() {
 }
 
 void TuckerEngine::loadData() {
-	int objNum = _partNum * 10;
+	int objNum = _part * 10;
 	loadFile("data.c", _loadTempBuf);
 	DataTokenizer t(_loadTempBuf, _fileLoadSize);
 	_dataCount = 0;
@@ -597,7 +597,7 @@ void TuckerEngine::loadData() {
 	_dataCount = maxCount;
 	int offset = 0;
 	for (int i = 0; i < count; ++i) {
-		Common::String filename = Common::String::format("scrobj%d%d.pcx", _partNum, i);
+		Common::String filename = Common::String::format("scrobj%d%d.pcx", _part, i);
 		loadImage(filename.c_str(), _loadTempBuf, 0);
 		offset = loadDataHelper(offset, i);
 	}
@@ -615,7 +615,7 @@ int TuckerEngine::loadDataHelper(int offset, int index) {
 }
 
 void TuckerEngine::loadPanObj() {
-	Common::String filename = Common::String::format("panobjs%d.pcx", _partNum);
+	Common::String filename = Common::String::format("panobjs%d.pcx", _part);
 	loadImage(filename.c_str(), _loadTempBuf, 0);
 	int offset = 0;
 	for (int y = 0; y < 5; ++y) {
@@ -712,16 +712,18 @@ void TuckerEngine::loadActionFile() {
 	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;
+		switch (_part) {
+			case kPartOne:
+				strcpy(filename, "action1.c");
+				break;
+			case kPartTwo:
+				strcpy(filename, "action2.c");
+				break;
+			case kPartThree:
+				strcpy(filename, "action3.c");
+				break;
+			default:
+				break;
 		}
 	}
 	loadFile(filename, _loadTempBuf);
diff --git a/engines/tucker/sequences.cpp b/engines/tucker/sequences.cpp
index 184b70b..cefb9e9 100644
--- a/engines/tucker/sequences.cpp
+++ b/engines/tucker/sequences.cpp
@@ -197,23 +197,25 @@ void TuckerEngine::handleNewPartSequence() {
 		_inventoryObjectsOffset = 0;
 		_inventoryObjectsCount = 0;
 		addObjectToInventory(30);
-		if (_partNum == 1 || _partNum == 3) {
+		if (_part == kPartOne || _part == kPartThree) {
 			addObjectToInventory(1);
 			addObjectToInventory(0);
 		}
 		_redrawPanelItemsCounter = 0;
 	}
 	_scrollOffset = 0;
-	switch (_partNum) {
-	case 1:
-		strcpy(filename, "pt1bak.pcx");
-		break;
-	case 2:
-		strcpy(filename, "pt2bak.pcx");
-		break;
-	default:
-		strcpy(filename, "pt3bak.pcx");
-		break;
+	switch (_part) {
+		case kPartOne:
+			strcpy(filename, "pt1bak.pcx");
+			break;
+		case kPartTwo:
+			strcpy(filename, "pt2bak.pcx");
+			break;
+		case kPartThree:
+			strcpy(filename, "pt3bak.pcx");
+			break;
+		default:
+			break;
 	}
 	loadImage(filename, _quadBackgroundGfxBuf, 1);
 	_spritesCount = 1;
@@ -222,16 +224,18 @@ void TuckerEngine::handleNewPartSequence() {
 	_locationNum = 98;
 	unloadSprA02_01();
 	unloadSprC02_01();
-	switch (_partNum) {
-	case 1:
-		strcpy(filename, "sprites/partone.spr");
-		break;
-	case 2:
-		strcpy(filename, "sprites/parttwo.spr");
-		break;
-	default:
-		strcpy(filename, "sprites/partthr.spr");
-		break;
+	switch (_part) {
+		case kPartOne:
+			strcpy(filename, "sprites/partone.spr");
+			break;
+		case kPartTwo:
+			strcpy(filename, "sprites/parttwo.spr");
+			break;
+		case kPartThree:
+			strcpy(filename, "sprites/partthr.spr");
+			break;
+		default:
+			break;
 	}
 	_sprC02Table[1] = loadFile(filename, 0);
 	startSpeechSound(9000, 60);
@@ -273,16 +277,18 @@ void TuckerEngine::handleMeanwhileSequence() {
 	char filename[40];
 	uint8 backupPalette[256 * 3];
 	memcpy(backupPalette, _currentPalette, 256 * 3);
-	switch (_partNum) {
-	case 1:
-		strcpy(filename, "meanw01.pcx");
-		break;
-	case 2:
-		strcpy(filename, "meanw02.pcx");
-		break;
-	default:
-		strcpy(filename, "meanw03.pcx");
-		break;
+	switch (_part) {
+		case kPartOne:
+			strcpy(filename, "meanw01.pcx");
+			break;
+		case kPartTwo:
+			strcpy(filename, "meanw02.pcx");
+			break;
+		case kPartThree:
+			strcpy(filename, "meanw03.pcx");
+			break;
+		default:
+			break;
 	}
 	if (_flagsTable[215] == 0 && _flagsTable[231] == 1) {
 		strcpy(filename, "loc80.pcx");
@@ -347,27 +353,27 @@ void TuckerEngine::handleMapSequence() {
 		_fullRedraw = true;
 		if (_flagsTable[7] > 0 && _mousePosX > 30 && _mousePosX < 86 && _mousePosY > 36 && _mousePosY < 86) {
 			textNum = 13;
-			_nextLocationNum = (_partNum == 1) ? 3 : 65;
+			_nextLocationNum = (_part == kPartOne) ? 3 : 65;
 			xPos = 620;
 			yPos = 130;
 		} else if (_flagsTable[7] > 1 && _mousePosX > 60 && _mousePosX < 120 && _mousePosY > 120 && _mousePosY < 170) {
 			textNum = 14;
-			_nextLocationNum = (_partNum == 1) ? 9 : 66;
+			_nextLocationNum = (_part == kPartOne) ? 9 : 66;
 			xPos = 344;
 			yPos = 120;
 		} else if (_flagsTable[7] > 2 && _mousePosX > 160 && _mousePosX < 210 && _mousePosY > 110 && _mousePosY < 160) {
 			textNum = 15;
-			_nextLocationNum = (_partNum == 1) ? 16 : 61;
+			_nextLocationNum = (_part == kPartOne) ? 16 : 61;
 			xPos = 590;
 			yPos = 130;
 		} else if ((_flagsTable[7] == 4 || _flagsTable[7] == 6) && _mousePosX > 150 && _mousePosX < 200 && _mousePosY > 20 && _mousePosY < 70) {
 			textNum = 16;
-			_nextLocationNum = (_partNum == 1) ? 20 : 68;
+			_nextLocationNum = (_part == kPartOne) ? 20 : 68;
 			xPos = 20;
 			yPos = 130;
 		} else if (_flagsTable[120] == 1 && _mousePosX > 240 && _mousePosX < 290 && _mousePosY > 35 && _mousePosY < 90) {
 			textNum = 17;
-			_nextLocationNum = (_partNum == 1) ? 19 : 62;
+			_nextLocationNum = (_part == kPartOne) ? 19 : 62;
 			xPos = 20;
 			yPos = 124;
 		} else if (_mousePosX > 135 && _mousePosX < 185 && _mousePosY > 170 && _mousePosY < 200) {
@@ -437,14 +443,14 @@ void TuckerEngine::copyMapRect(int x, int y, int w, int h) {
 
 bool TuckerEngine::handleSpecialObjectSelectionSequence() {
 	char filename[40];
-	if (_partNum == 1 && _selectedObjectNum == 6) {
+	if (_part == kPartOne && _selectedObjectNum == 6) {
 		strcpy(filename, "news1.pcx");
 		_flagsTable[7] = 4;
-	} else if (_partNum == 3 && _selectedObjectNum == 45) {
+	} else if (_part == kPartThree && _selectedObjectNum == 45) {
 		strcpy(filename, "profnote.pcx");
-	} else if (_partNum == 1 && _selectedObjectNum == 26) {
+	} else if (_part == kPartOne && _selectedObjectNum == 26) {
 		strcpy(filename, "photo.pcx");
-	} else if (_partNum == 3 && _selectedObjectNum == 39) {
+	} else if (_part == kPartThree && _selectedObjectNum == 39) {
 		strcpy(filename, "news2.pcx");
 		_flagsTable[135] = 1;
 	} else if (_currentInfoString1SourceType == 0 && _currentActionObj1Num == 259) {
@@ -474,7 +480,7 @@ bool TuckerEngine::handleSpecialObjectSelectionSequence() {
 		if (!_leftMouseButtonPressed && _mouseClick == 1) {
 			_mouseClick = 0;
 		}
-		if (_partNum == 3 && _selectedObjectNum == 45) {
+		if (_part == kPartThree && _selectedObjectNum == 45) {
 			for (int i = 0; i < 13; ++i) {
 				const int offset = _dataTable[204 + i]._yDest * 640 + _dataTable[204 + i]._xDest;
 				static const int itemsTable[] = { 15, 44, 25, 19, 21, 24, 12, 27, 20, 29, 35, 23, 3 };
diff --git a/engines/tucker/tucker.cpp b/engines/tucker/tucker.cpp
index b182b34..b277e03 100644
--- a/engines/tucker/tucker.cpp
+++ b/engines/tucker/tucker.cpp
@@ -156,7 +156,7 @@ void TuckerEngine::resetVariables() {
 	_lastFrameTime = _system->getMillis();
 	_mainLoopCounter1 = _mainLoopCounter2 = 0;
 	_timerCounter2 = 0;
-	_partNum = _currentPartNum = 0;
+	_part = _currentPart = kPartInit;
 	_locationNum = 0;
 	_nextLocationNum = (_gameFlags & kGameFlagDemo) == 0 ? kStartupLocationGame : kStartupLocationDemo;
 	_gamePaused = false;
@@ -1926,7 +1926,7 @@ void TuckerEngine::rememberSpeechSound() {
 	for (int i = 4; i > 0; --i) {
 		_speechHistoryTable[i] = _speechHistoryTable[i - 1];
 	}
-	_speechHistoryTable[0] = _partNum * 3000 + _ptTextOffset + _speechSoundNum - 3000;
+	_speechHistoryTable[0] = _part * 3000 + _ptTextOffset + _speechSoundNum - 3000;
 }
 
 void TuckerEngine::redrawPanelItems() {
@@ -3257,7 +3257,7 @@ int TuckerEngine::executeTableInstruction() {
 	case kCode_bus:
 		_speechSoundNum = readTableInstructionParam(3) - 1;
 		rememberSpeechSound();
-		startSpeechSound(_partNum * 3000 + _ptTextOffset + _speechSoundNum - 3000, _speechVolume);
+		startSpeechSound(_part * 3000 + _ptTextOffset + _speechSoundNum - 3000, _speechVolume);
 		_actionPosX = _xPosCurrent;
 		_actionPosY = _yPosCurrent - 64;
 		_actionTextColor = 1;
@@ -3302,7 +3302,7 @@ int TuckerEngine::executeTableInstruction() {
 	case kCode_c0s:
 		_speechSoundNum = readTableInstructionParam(3) - 1;
 		rememberSpeechSound();
-		startSpeechSound(_partNum * 3000 + _ptTextOffset + _speechSoundNum - 3000, kMaxSoundVolume);
+		startSpeechSound(_part * 3000 + _ptTextOffset + _speechSoundNum - 3000, kMaxSoundVolume);
 		_charSpeechSoundCounter = kDefaultCharSpeechSoundCounter;
 		_actionTextColor = 181 + index;
 		if (!_tableInstructionFlag) {
@@ -3765,7 +3765,7 @@ void TuckerEngine::setActionForInventoryObject() {
 		return;
 	}
 	if (_actionVerb == kVerbOpen || _actionVerb == kVerbClose) {
-		if (!(_partNum == 2 && _selectedObjectNum == 19) && !(_partNum == 3 && _selectedObjectNum == 42)) {
+		if (!(_part == kPartTwo && _selectedObjectNum == 19) && !(_part == kPartThree && _selectedObjectNum == 42)) {
 			playSpeechForAction(_actionVerb);
 			_actionVerbLocked = false;
 			_actionRequiresTwoObjects = false;
@@ -3802,8 +3802,8 @@ void TuckerEngine::setActionForInventoryObject() {
 	}
 	// Items with unary usage i.e. "Use X", rather than "Use X on Y"
 	if (
-		(_partNum == 2 && _actionObj1Num == 19) || // radio
-		(_partNum == 3 && (
+		(_part == kPartTwo && _actionObj1Num == 19) || // radio
+		(_part == kPartThree && (
 			 _actionObj1Num ==  3 || // pizza
 			 _actionObj1Num ==  6 || // raincoat
 			 _actionObj1Num == 17 || // ear plugs
diff --git a/engines/tucker/tucker.h b/engines/tucker/tucker.h
index a0d1b7c..0a2f0a9 100644
--- a/engines/tucker/tucker.h
+++ b/engines/tucker/tucker.h
@@ -80,6 +80,13 @@ enum Verb {
 	kVerbUse   = 8
 };
 
+enum Part {
+  kPartInit  = 0,
+  kPartOne   = 1,
+  kPartTwo   = 2,
+  kPartThree = 3
+};
+
 struct Action {
 	int _key;
 	int _testFlag1Num;
@@ -652,8 +659,8 @@ protected:
 	int _mainLoopCounter2;
 	int _timerCounter2;
 	int _flagsTable[kFlagsTableSize];
-	int _partNum;
-	int _currentPartNum;
+	Part _part;
+	Part _currentPart;
 	int _locationNum;
 	int _nextLocationNum;
 	bool _gamePaused;





More information about the Scummvm-git-logs mailing list