aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/party.h1
-rw-r--r--engines/xeen/scripts.cpp49
-rw-r--r--engines/xeen/town.cpp4
-rw-r--r--engines/xeen/town.h2
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 {