diff options
author | Paul Gilbert | 2015-03-04 07:45:13 -0500 |
---|---|---|
committer | Paul Gilbert | 2015-03-04 07:45:13 -0500 |
commit | 15d375bc4471788b3323875a54a81a9a754ed034 (patch) | |
tree | e2bae2ef8905a3350ffdff224ef5e084518d9753 /engines | |
parent | 8101f8d03ba755dc9a71d351b10b279276a67999 (diff) | |
download | scummvm-rg350-15d375bc4471788b3323875a54a81a9a754ed034.tar.gz scummvm-rg350-15d375bc4471788b3323875a54a81a9a754ed034.tar.bz2 scummvm-rg350-15d375bc4471788b3323875a54a81a9a754ed034.zip |
XEEN: Implement remaining missing code in checkEvents
Diffstat (limited to 'engines')
-rw-r--r-- | engines/xeen/party.h | 1 | ||||
-rw-r--r-- | engines/xeen/scripts.cpp | 49 | ||||
-rw-r--r-- | engines/xeen/town.cpp | 4 | ||||
-rw-r--r-- | engines/xeen/town.h | 2 |
4 files changed, 53 insertions, 3 deletions
diff --git a/engines/xeen/party.h b/engines/xeen/party.h index 445380b893..df6864da33 100644 --- a/engines/xeen/party.h +++ b/engines/xeen/party.h @@ -141,6 +141,7 @@ public: DamageType _damageType; bool _dead; Treasure _treasure; + Treasure _savedTreasure; public: Party(XeenEngine *vm); diff --git a/engines/xeen/scripts.cpp b/engines/xeen/scripts.cpp index 1474b3ee58..1656acd2ee 100644 --- a/engines/xeen/scripts.cpp +++ b/engines/xeen/scripts.cpp @@ -114,6 +114,8 @@ int Scripts::checkEvents() { Party &party = *_vm->_party; Screen &screen = *_vm->_screen; SoundManager &sound = *_vm->_sound; + Town &town = *_vm->_town; + bool isDarkCc = _vm->_files->_isDarkCc; _refreshIcons = false; _itemType = 0; @@ -125,9 +127,15 @@ int Scripts::checkEvents() { //int items = _treasureItems; if (party._treasure._gold & party._treasure._gems) { - // TODO + // Backup any current treasure data + party._savedTreasure = party._treasure; + party._treasure._hasItems = false; + party._treasure._gold = 0; + party._treasure._gems = 0; } else { - // TODO + party._savedTreasure._hasItems = false; + party._savedTreasure._gold = 0; + party._savedTreasure._gems = 0; } do { @@ -176,7 +184,33 @@ int Scripts::checkEvents() { intf.drawParty(true); } - // TODO + party.checkPartyDead(); + if (party._treasure._hasItems || party._treasure._gold || party._treasure._gems) + party.giveTreasure(); + + if (_animCounter > 0 && intf._objNumber) { + MazeObject &selectedObj = map._mobData._objects[intf._objNumber - 1]; + + if (selectedObj._spriteId == (isDarkCc ? 15 : 16)) { + for (uint idx = 0; idx < 16; ++idx) { + MazeObject &obj = map._mobData._objects[idx]; + if (obj._spriteId == (isDarkCc ? 62 : 57)) { + selectedObj._id = idx; + selectedObj._spriteId = isDarkCc ? 62 : 57; + break; + } + } + } else if (selectedObj._spriteId == 73) { + for (uint idx = 0; idx < 16; ++idx) { + MazeObject &obj = map._mobData._objects[idx]; + if (obj._spriteId == 119) { + selectedObj._id = idx; + selectedObj._spriteId = 119; + break; + } + } + } + } _animCounter = 0; _vm->_mode = oldMode; @@ -202,6 +236,15 @@ int Scripts::checkEvents() { w.close(); } + // Restore saved treasure + if (party._savedTreasure._hasItems || party._savedTreasure._gold || + party._savedTreasure._gems) { + party._treasure = party._savedTreasure; + } + + // Clear any town loaded sprites + town.clearSprites(); + _v2 = 1; Common::fill(&intf._charFX[0], &intf._charFX[6], 0); diff --git a/engines/xeen/town.cpp b/engines/xeen/town.cpp index a3033b2140..9b4bfa3ab1 100644 --- a/engines/xeen/town.cpp +++ b/engines/xeen/town.cpp @@ -1192,6 +1192,10 @@ bool Town::isActive() const { return _townSprites.size() > 0 && !_townSprites[0].empty(); } +void Town::clearSprites() { + _townSprites.clear(); +} + /*------------------------------------------------------------------------*/ bool TownMessage::show(XeenEngine *vm, int portrait, const Common::String &name, diff --git a/engines/xeen/town.h b/engines/xeen/town.h index 5aa31e571c..c64ef891f1 100644 --- a/engines/xeen/town.h +++ b/engines/xeen/town.h @@ -105,6 +105,8 @@ public: void drawTownAnim(bool flag); bool isActive() const; + + void clearSprites(); }; class TownMessage : public ButtonContainer { |