[Scummvm-git-logs] scummvm master -> 6421170f9224cf56eda4a6502014d315bb3eec70

dreammaster dreammaster at scummvm.org
Fri Nov 17 02:59:10 CET 2017


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:
6421170f92 XEEN: Map and game flag fixes


Commit: 6421170f9224cf56eda4a6502014d315bb3eec70
    https://github.com/scummvm/scummvm/commit/6421170f9224cf56eda4a6502014d315bb3eec70
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2017-11-16T20:59:07-05:00

Commit Message:
XEEN: Map and game flag fixes

Changed paths:
    engines/xeen/map.cpp
    engines/xeen/scripts.cpp


diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp
index a459b56..b9b674c 100644
--- a/engines/xeen/map.cpp
+++ b/engines/xeen/map.cpp
@@ -987,7 +987,7 @@ void Map::load(int mapId) {
 
 			if (isDarkCc && mapId == 50)
 				mazeDataP->setAllTilesStepped();
-			if (!isDarkCc && _vm->_party->_gameFlags[25] &&
+			if (!isDarkCc && _vm->_party->_gameFlags[0][25] &&
 					(mapId == 42 || mapId == 43 || mapId == 4)) {
 				mazeDataP->clearCellSurfaces();
 			}
@@ -1061,7 +1061,7 @@ void Map::load(int mapId) {
 			_mobData._objects[29]._spriteId = 0;
 			_mobData._objects[29]._id = 8;
 			_mobData._objectSprites[i]._sprites.clear();
-		} else if (mapId == 12 && _vm->_party->_gameFlags[43] &&
+		} else if (mapId == 12 && _vm->_party->_gameFlags[0][43] &&
 			_mobData._objectSprites[i]._spriteId == 118 && !isDarkCc) {
 			filename = "085.obj";
 			_mobData._objectSprites[0]._spriteId = 85;
@@ -1451,11 +1451,11 @@ int Map::getCell(int idx) {
 				_currentWall = INVALID_CELL;
 				return INVALID_CELL;
 			}
-
-			_mazeDataIndex = 0;
-			while (_mazeData[_mazeDataIndex]._mazeId != mapId)
-				++_mazeDataIndex;
 		}
+
+		_mazeDataIndex = 0;
+		while (_mazeData[_mazeDataIndex]._mazeId != mapId)
+			++_mazeDataIndex;
 	}
 
 	if (pt.x & 16) {
@@ -1494,10 +1494,10 @@ int Map::getCell(int idx) {
 			++_mazeDataIndex;
 	}
 
+	assert(ABS(pt.x) < 16 && ABS(pt.y) < 16);
 	int wallData = _mazeData[_mazeDataIndex]._wallData[pt.y][pt.x]._data;
 	if (_isOutdoors) {
 		if (mapId) {
-			// TODO: tile is set to word of (wallLayers >> 8) && 0xff? Makes no sense
 			_currentTile = (wallData >> 8) & 0xFF;
 			_currentWall = (wallData >> 4) & 0xF;
 			_currentSurfaceId = wallData & 0xF;
@@ -1510,11 +1510,7 @@ int Map::getCell(int idx) {
 		if (!mapId)
 			return 0;
 
-		if (pt.x > 31 || pt.y > 31)
-			_currentSurfaceId = 7;
-		else
-			_currentSurfaceId = _mazeData[_mazeDataIndex]._cells[pt.y][pt.x]._surfaceId;
-
+		_currentSurfaceId = _mazeData[_mazeDataIndex]._cells[pt.y][pt.x]._surfaceId;
 		_currentWall = wallData;
 		return (_currentWall >> Res.WALL_SHIFTS[dir][idx]) & 0xF;
 	}
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp
index d1bd1f2..ea4fc1c 100644
--- a/engines/xeen/scripts.cpp
+++ b/engines/xeen/scripts.cpp
@@ -1446,9 +1446,9 @@ bool Scripts::ifProc(int action, uint32 mask, int mode, int charIndex) {
 	}
 	case 20:
 		if (_vm->_files->_isDarkCc)
-			mask += 0x100;
-		assert(mask < 0x200);
-		v = party._gameFlags[mask] ? mask : 0xffffffff;
+			mask += 256;
+		assert(mask < 512);
+		v = party._gameFlags[mask / 256][mask % 256] ? mask : 0xffffffff;
 		break;
 	case 21:
 		// Scans inventories for given item number
@@ -1480,7 +1480,7 @@ bool Scripts::ifProc(int action, uint32 mask, int mode, int charIndex) {
 		} else {
 			int baseFlag = 8 * (6 + mask);
 			for (int idx = 0; idx < 8; ++idx) {
-				if (party._gameFlags[baseFlag + idx]) {
+				if (party._gameFlags[0][baseFlag + idx]) {
 					v = mask;
 					break;
 				}





More information about the Scummvm-git-logs mailing list