aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2017-12-10 16:51:21 -0500
committerPaul Gilbert2017-12-10 16:51:21 -0500
commita1816980d640077f843ab89a8e1ed086a245d146 (patch)
tree1fd17c158175839c29518ec458e64126a64fc901
parent4f993de137116941dea84bb6e354362c1b3105ee (diff)
downloadscummvm-rg350-a1816980d640077f843ab89a8e1ed086a245d146.tar.gz
scummvm-rg350-a1816980d640077f843ab89a8e1ed086a245d146.tar.bz2
scummvm-rg350-a1816980d640077f843ab89a8e1ed086a245d146.zip
XEEN: Fix map display when at the edges of a map
-rw-r--r--engines/xeen/dialogs_map.cpp9
-rw-r--r--engines/xeen/dialogs_map.h3
-rw-r--r--engines/xeen/map.cpp6
3 files changed, 11 insertions, 7 deletions
diff --git a/engines/xeen/dialogs_map.cpp b/engines/xeen/dialogs_map.cpp
index 084ee876ad..59645806e2 100644
--- a/engines/xeen/dialogs_map.cpp
+++ b/engines/xeen/dialogs_map.cpp
@@ -44,11 +44,12 @@ void MapDialog::execute() {
if (_pt.x < 8 && map.mazeData()._surroundingMazes._west == 0) {
_arrowPt.x = _pt.x * 10 + 4;
+ _pt.x = 7;
} else if (_pt.x > 23) {
- _arrowPt.x = _pt.x * 10 + 100;
+ _arrowPt.x = (byte)(_pt.x * 10 + 100);
_pt.x = 23;
} else if (_pt.x > 8 && map.mazeData()._surroundingMazes._east == 0) {
- _arrowPt.x = _pt.x * 10 + 4;
+ _arrowPt.x = (byte)(_pt.x * 10 + 4);
_pt.x = 7;
} else {
_arrowPt.x = 74;
@@ -58,7 +59,7 @@ void MapDialog::execute() {
_arrowPt.y = ((15 - _pt.y) << 3) + 13;
_pt.y = 8;
} else if (_pt.y > 24) {
- _arrowPt.y = ((15 - (_pt.y - 24)) << 3) + 13;
+ _arrowPt.y = ((15 - (_pt.y - 16)) << 3) + 13;
_pt.y = 24;
} else if (_pt.y >= 8 && map.mazeData()._surroundingMazes._north == 0) {
_arrowPt.y = ((15 - _pt.y) << 3) + 13;
@@ -202,7 +203,7 @@ void MapDialog::drawIndoors() {
// Draw walls on left and top edges of map
for (int xp = 80, yp = 158, mazeX = _pt.x - 7, mazeY = _pt.y - 8; xp < 250;
- xp += 10, yp -= 8, ++mazeX, ++mazeY) {
+ xp += 10, yp -= 8, ++mazeX, ++mazeY) {
// Draw walls on left edge of map
v = map.mazeLookup(Common::Point(_pt.x - 8, mazeY), 12);
diff --git a/engines/xeen/dialogs_map.h b/engines/xeen/dialogs_map.h
index 8ae24eebac..3c12afab49 100644
--- a/engines/xeen/dialogs_map.h
+++ b/engines/xeen/dialogs_map.h
@@ -36,7 +36,8 @@ private:
Common::Point _pt, _arrowPt;
bool _frameEndFlag;
private:
- MapDialog(XeenEngine *vm) : ButtonContainer(vm), _animFrame(0) {}
+ MapDialog(XeenEngine *vm) : ButtonContainer(vm),
+ _animFrame(0), _frameEndFlag(false) {}
/**
* Draws the map contents when outdoors
diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp
index 1a33f1d840..f24f99f18d 100644
--- a/engines/xeen/map.cpp
+++ b/engines/xeen/map.cpp
@@ -1263,8 +1263,10 @@ int Map::mazeLookup(const Common::Point &pt, int layerShift, int wallMask) {
Common::Point pos = pt;
int mapId = _vm->_party->_mazeId;
- if (pt.x < -16 || pt.y < -16 || pt.x >= 32 || pt.y >= 32)
- error("Invalid coordinate");
+ if (pt.x < -16 || pt.y < -16 || pt.x >= 32 || pt.y >= 32) {
+ _currentWall = INVALID_CELL;
+ return INVALID_CELL;
+ }
// Find the correct maze data out of the set to use
_mazeDataIndex = 0;