[Scummvm-cvs-logs] scummvm master -> 006690789af69432fd9bec6cee8b76dbf62cb3f7

Strangerke Strangerke at scummvm.org
Sat May 24 13:54:51 CEST 2014


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:
006690789a TUCKER: Add a check to error out when the index isn't found for a given location number


Commit: 006690789af69432fd9bec6cee8b76dbf62cb3f7
    https://github.com/scummvm/scummvm/commit/006690789af69432fd9bec6cee8b76dbf62cb3f7
Author: Strangerke (strangerke at scummvm.org)
Date: 2014-05-24T13:53:42+02:00

Commit Message:
TUCKER: Add a check to error out when the index isn't found for a given location number

Changed paths:
    engines/tucker/resource.cpp



diff --git a/engines/tucker/resource.cpp b/engines/tucker/resource.cpp
index 5f06334..dd9d426 100644
--- a/engines/tucker/resource.cpp
+++ b/engines/tucker/resource.cpp
@@ -662,15 +662,13 @@ void TuckerEngine::loadData4() {
 	t.findNextToken(kDataTokenDw);
 	_gameDebug = t.getNextInteger() != 0;
 	_displayGameHints = t.getNextInteger() != 0;
-	// forces game hints feature
-//	_displayGameHints = true;
 	_locationObjectsCount = 0;
 	if (t.findIndex(_locationNum)) {
 		while (t.findNextToken(kDataTokenDw)) {
 			int i = t.getNextInteger();
-			if (i < 0) {
+			if (i < 0)
 				break;
-			}
+
 			assert(_locationObjectsCount < kLocationObjectsTableSize);
 			LocationObject *d = &_locationObjectsTable[_locationObjectsCount++];
 			d->_xPos = i;
@@ -851,60 +849,63 @@ void TuckerEngine::unloadSprC02_01() {
 void TuckerEngine::loadFx() {
 	loadFile("fx.c", _loadTempBuf);
 	DataTokenizer t(_loadTempBuf, _fileLoadSize);
-	t.findIndex(_locationNum);
-	t.findNextToken(kDataTokenDw);
-	_locationSoundsCount = t.getNextInteger();
-	_currentFxSet = 0;
-	for (int i = 0; i < _locationSoundsCount; ++i) {
-		LocationSound *s = &_locationSoundsTable[i];
-		s->_offset = 0;
-		s->_num = t.getNextInteger();
-		s->_volume = t.getNextInteger();
-		s->_type = t.getNextInteger();
-		switch (s->_type) {
-		case 5:
-			_currentFxSet = 1;
-			_currentFxIndex = i;
-			_currentFxVolume = s->_volume;
-			_currentFxDist = t.getNextInteger();
-			_currentFxScale = t.getNextInteger();
-			break;
-		case 6:
-		case 7:
-		case 8:
-			s->_startFxSpriteState = t.getNextInteger();
-			s->_startFxSpriteNum = t.getNextInteger();
-			s->_updateType = t.getNextInteger();
-			if (s->_type == 7) {
-				s->_flagNum = t.getNextInteger();
-				s->_flagValueStartFx = t.getNextInteger();
-				s->_stopFxSpriteState = t.getNextInteger();
-				s->_stopFxSpriteNum = t.getNextInteger();
-				s->_flagValueStopFx = t.getNextInteger();
+	if (t.findIndex(_locationNum)) {
+		t.findNextToken(kDataTokenDw);
+		_locationSoundsCount = t.getNextInteger();
+		_currentFxSet = 0;
+		for (int i = 0; i < _locationSoundsCount; ++i) {
+			LocationSound *s = &_locationSoundsTable[i];
+			s->_offset = 0;
+			s->_num = t.getNextInteger();
+			s->_volume = t.getNextInteger();
+			s->_type = t.getNextInteger();
+			switch (s->_type) {
+			case 5:
+				_currentFxSet = 1;
+				_currentFxIndex = i;
+				_currentFxVolume = s->_volume;
+				_currentFxDist = t.getNextInteger();
+				_currentFxScale = t.getNextInteger();
+				break;
+			case 6:
+			case 7:
+			case 8:
+				s->_startFxSpriteState = t.getNextInteger();
+				s->_startFxSpriteNum = t.getNextInteger();
+				s->_updateType = t.getNextInteger();
+				if (s->_type == 7) {
+					s->_flagNum = t.getNextInteger();
+					s->_flagValueStartFx = t.getNextInteger();
+					s->_stopFxSpriteState = t.getNextInteger();
+					s->_stopFxSpriteNum = t.getNextInteger();
+					s->_flagValueStopFx = t.getNextInteger();
+				}
+				break;
+			}
+			if (s->_type == 8) {
+				s->_type = 6;
 			}
-			break;
-		}
-		if (s->_type == 8) {
-			s->_type = 6;
 		}
-	}
-	t.findNextToken(kDataTokenDw);
-	int count = t.getNextInteger();
-	_locationMusicsCount = 0;
-	for (int i = 0; i < count; ++i) {
-		int flagNum = t.getNextInteger();
-		int flagValue = t.getNextInteger();
-		if (flagValue == _flagsTable[flagNum]) {
-			LocationMusic *m = &_locationMusicsTable[_locationMusicsCount++];
-			m->_offset = 0;
-			m->_num = t.getNextInteger();
-			m->_volume = t.getNextInteger();
-			m->_flag = t.getNextInteger();
-		} else {
-			for (int j = 0; j < 3; ++j) {
-				t.getNextInteger();
+		t.findNextToken(kDataTokenDw);
+		int count = t.getNextInteger();
+		_locationMusicsCount = 0;
+		for (int i = 0; i < count; ++i) {
+			int flagNum = t.getNextInteger();
+			int flagValue = t.getNextInteger();
+			if (flagValue == _flagsTable[flagNum]) {
+				LocationMusic *m = &_locationMusicsTable[_locationMusicsCount++];
+				m->_offset = 0;
+				m->_num = t.getNextInteger();
+				m->_volume = t.getNextInteger();
+				m->_flag = t.getNextInteger();
+			} else {
+				for (int j = 0; j < 3; ++j) {
+					t.getNextInteger();
+				}
 			}
 		}
+	} else {
+		error("loadFx() - Index not found for location %d", _locationNum);
 	}
 }
 






More information about the Scummvm-git-logs mailing list