diff options
-rw-r--r-- | engines/xeen/scripts.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 6230d1cc8d..cd95a5938f 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -1207,14 +1207,25 @@ bool Scripts::cmdDisplayBottom(ParamsIterator ¶ms) { bool Scripts::cmdIfMapFlag(ParamsIterator ¶ms) { Map &map = *_vm->_map; - MazeMonster &monster = map._mobData._monsters[params.readByte()]; + int monsterNum = params.readByte(); + int lineNum = params.readByte(); - if (monster._position.x >= 32 || monster._position.y >= 32) { - _lineNum = params.readByte(); - return false; + if (monsterNum == 0xff) { + for (monsterNum = 0; monsterNum < (int)map._mobData._monsters.size(); ++monsterNum) { + MazeMonster &monster = map._mobData._monsters[monsterNum]; + + if ((uint)monster._position.x < 32 && (uint)monster._position.y < 32) + return true; + } + } else { + MazeMonster &monster = map._mobData._monsters[monsterNum]; + + if ((uint)monster._position.x < 32 && (uint)monster._position.y > 32) + return true; } - return true; + _lineNum = lineNum; + return false; } bool Scripts::cmdSelectRandomChar(ParamsIterator ¶ms) { |