From 057bf6ea921bea28c3b09a4905c81af65f03c7eb Mon Sep 17 00:00:00 2001 From: Paul Gilbert Date: Sun, 27 May 2018 14:45:01 -0400 Subject: XEEN: Leave chests open after their contents are taken --- engines/xeen/map.h | 2 +- engines/xeen/scripts.cpp | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) (limited to 'engines') diff --git a/engines/xeen/map.h b/engines/xeen/map.h index 1bb3cf288c..1c00e549c3 100644 --- a/engines/xeen/map.h +++ b/engines/xeen/map.h @@ -322,7 +322,6 @@ public: }; private: XeenEngine *_vm; - Common::Array _objectSprites; Common::Array _monsterSprites; Common::Array _monsterAttackSprites; Common::Array _wallItemSprites; @@ -330,6 +329,7 @@ public: Common::Array _objects; Common::Array _monsters; Common::Array _wallItems; + Common::Array _objectSprites; public: MonsterObjectData(XeenEngine *vm); diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 66e9013cda..bc0b179d4c 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -216,20 +216,23 @@ int Scripts::checkEvents() { MazeObject &selectedObj = map._mobData._objects[intf._objNumber]; if (selectedObj._spriteId == (ccNum ? 15 : 16)) { - for (int idx = 0; idx < MIN((int)map._mobData._objects.size(), 16); ++idx) { - MazeObject &obj = map._mobData._objects[idx]; - if (obj._spriteId == (ccNum ? 62 : 57)) { + // Treasure chests that were opened will be set to be in an open, empty state + for (uint idx = 0; idx < map._mobData._objectSprites.size(); ++idx) { + MonsterObjectData::SpriteResourceEntry &e = map._mobData._objectSprites[idx]; + if (e._spriteId == (ccNum ? 57 : 62)) { selectedObj._id = idx; - selectedObj._spriteId = ccNum ? 62 : 57; + selectedObj._spriteId = ccNum ? 57 : 62; + selectedObj._sprites = &e._sprites; break; } } } else if (selectedObj._spriteId == 73) { - for (int idx = 0; idx < MIN((int)map._mobData._objects.size(), 16); ++idx) { - MazeObject &obj = map._mobData._objects[idx]; - if (obj._spriteId == 119) { + for (uint idx = 0; idx < map._mobData._objectSprites.size(); ++idx) { + MonsterObjectData::SpriteResourceEntry &e = map._mobData._objectSprites[idx]; + if (e._spriteId == 119) { selectedObj._id = idx; selectedObj._spriteId = 119; + selectedObj._sprites = &e._sprites; break; } } -- cgit v1.2.3