diff options
Diffstat (limited to 'engines/xeen')
-rw-r--r-- | engines/xeen/interface_map.cpp | 1 | ||||
-rw-r--r-- | engines/xeen/map.cpp | 2 | ||||
-rw-r--r-- | engines/xeen/party.cpp | 9 | ||||
-rw-r--r-- | engines/xeen/scripts.cpp | 12 | ||||
-rw-r--r-- | engines/xeen/spells.cpp | 7 |
5 files changed, 17 insertions, 14 deletions
diff --git a/engines/xeen/interface_map.cpp b/engines/xeen/interface_map.cpp index 5d871514ca..249a877690 100644 --- a/engines/xeen/interface_map.cpp +++ b/engines/xeen/interface_map.cpp @@ -4402,6 +4402,7 @@ void InterfaceMap::drawOutdoors() { const int TERRAIN_INDEXES4[5] = { 5, 9, 7, 0, 4 }; // Loops to set draw entries for the terrain + assert(map._currentWall != INVALID_CELL); for (int idx = 0; idx < 9; ++idx) { map.getCell(TERRAIN_INDEXES1[idx]); SpriteResource &spr = map._wallSprites._surfaces[map._currentWall]; diff --git a/engines/xeen/map.cpp b/engines/xeen/map.cpp index b9b674cbdd..028ca4b6c4 100644 --- a/engines/xeen/map.cpp +++ b/engines/xeen/map.cpp @@ -1494,7 +1494,7 @@ int Map::getCell(int idx) { ++_mazeDataIndex; } - assert(ABS(pt.x) < 16 && ABS(pt.y) < 16); + assert(pt.x >= 0 && pt.x < 16 && pt.y >= 0 && pt.y < 16); int wallData = _mazeData[_mazeDataIndex]._wallData[pt.y][pt.x]._data; if (_isOutdoors) { if (mapId) { diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp index 71b1cb38c1..25a7c51e94 100644 --- a/engines/xeen/party.cpp +++ b/engines/xeen/party.cpp @@ -288,8 +288,10 @@ void Party::changeTime(int numMinutes) { !player._conditions[ERADICATED]) { for (int statNum = 0; statNum < TOTAL_STATS; ++statNum) { int statVal = player.getStat((Attribute)statNum); - if (statVal < 1) + if (statVal < 1) { player._conditions[DEAD] = 1; + killed = true; + } } } @@ -1036,6 +1038,7 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int ps._tempAge += giveVal; break; case 13: + assert(giveVal < 18); ps._skills[giveVal]++; break; case 15: @@ -1056,6 +1059,7 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int } else if (giveVal == 6) { ps._conditions[giveVal] = 1; } else { + assert(giveVal < 16); ps._conditions[giveVal]++; } @@ -1368,12 +1372,15 @@ bool Party::giveTake(int takeMode, uint takeVal, int giveMode, uint giveVal, int _gold += _vm->getRandomNumber(1, giveVal); break; case 103: + assert(takeVal < 128); _worldFlags[takeVal] = true; break; case 104: + assert(giveVal < 32); _quests[files._isDarkCc][giveVal] = true; break; case 107: + assert(takeVal < 24); _characterFlags[ps._rosterId][takeVal] = true; break; default: diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index ea4fc1cc06..a5984e3373 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -1478,13 +1478,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[0][baseFlag + idx]) { - v = mask; - break; - } - } + error("Invalid id"); } break; case 25: @@ -1694,8 +1688,8 @@ bool Scripts::ifProc(int action, uint32 mask, int mode, int charIndex) { break; case 104: // Get value of quest flag - v = party._quests[mask + (_vm->_files->_isDarkCc ? 30 : 0)] ? - mask : 0xffffffff; + v = (_vm->_files->_isDarkCc ? party._quests[1][mask - 2] : + party._quests[0][mask]) ? mask : 0xffffffff; break; case 105: // Test number of Megacredits in party. Only used by King's Engineer in Castle Burlock diff --git a/engines/xeen/spells.cpp b/engines/xeen/spells.cpp index 5c5a62ef45..2f9fe46329 100644 --- a/engines/xeen/spells.cpp +++ b/engines/xeen/spells.cpp @@ -449,10 +449,11 @@ void Spells::detectMonster() { MazeMonster &monster = map._mobData._monsters[monIndex]; Common::Point pt = party._mazePosition + Common::Point(xDiff, yDiff); if (monster._position == pt) { - if (++grid[yDiff][xDiff] > 3) - grid[yDiff][xDiff] = 3; + int &gridEntry = grid[yDiff + 3][xDiff + 3]; + if (++gridEntry > 3) + gridEntry = 3; - sprites.draw(w, grid[yDiff][xDiff], Common::Point(xDiff * 9 + 244, + sprites.draw(w, gridEntry, Common::Point(xDiff * 9 + 244, yDiff * 7 + 81)); } } |