aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2015-02-28 13:00:35 -0500
committerPaul Gilbert2015-02-28 13:00:35 -0500
commitb378709478fc689de8a1a0b455deb12e6aee5fb2 (patch)
tree1d79941387303f5d54f064bab836ab1fe366f330 /engines
parent973c5a0df5bf9f86cc589a7a138899b96684bf23 (diff)
downloadscummvm-rg350-b378709478fc689de8a1a0b455deb12e6aee5fb2.tar.gz
scummvm-rg350-b378709478fc689de8a1a0b455deb12e6aee5fb2.tar.bz2
scummvm-rg350-b378709478fc689de8a1a0b455deb12e6aee5fb2.zip
XEEN: Implement shoot action
Diffstat (limited to 'engines')
-rw-r--r--engines/xeen/combat.cpp9
-rw-r--r--engines/xeen/combat.h2
-rw-r--r--engines/xeen/interface.cpp25
-rw-r--r--engines/xeen/party.cpp9
-rw-r--r--engines/xeen/party.h2
5 files changed, 47 insertions, 0 deletions
diff --git a/engines/xeen/combat.cpp b/engines/xeen/combat.cpp
index 763daa7d03..74e098cdd4 100644
--- a/engines/xeen/combat.cpp
+++ b/engines/xeen/combat.cpp
@@ -2083,4 +2083,13 @@ done:
party.giveTreasure();
}
+/**
+ * Fires off a ranged attack at all oncoming monsters
+ */
+void Combat::shootRangedWeapon() {
+ _rangeType = RT_ALL;
+ _damageType = DT_PHYSICAL;
+ multiAttack(11);
+}
+
} // End of namespace Xeen
diff --git a/engines/xeen/combat.h b/engines/xeen/combat.h
index 9831f90f25..cff9261b05 100644
--- a/engines/xeen/combat.h
+++ b/engines/xeen/combat.h
@@ -172,6 +172,8 @@ public:
int stopAttack(const Common::Point &diffPt);
void multiAttack(int powNum);
+
+ void shootRangedWeapon();
};
} // End of namespace Xeen
diff --git a/engines/xeen/interface.cpp b/engines/xeen/interface.cpp
index 7339e1014f..cc027b8676 100644
--- a/engines/xeen/interface.cpp
+++ b/engines/xeen/interface.cpp
@@ -268,6 +268,7 @@ void Interface::perform() {
Map &map = *_vm->_map;
Party &party = *_vm->_party;
Scripts &scripts = *_vm->_scripts;
+ SoundManager &sound = *_vm->_sound;
Spells &spells = *_vm->_spells;
const Common::Rect WAIT_BOUNDS(8, 8, 224, 140);
@@ -571,6 +572,30 @@ void Interface::perform() {
rest();
break;
+ case Common::KEYCODE_s:
+ // Shoot
+ if (!party.canShoot()) {
+ sound.playFX(21);
+ } else {
+ if (_tillMove) {
+ combat.moveMonsters();
+ draw3d(true);
+ }
+
+ if (combat._attackMonsters[0] != -1 || combat._attackMonsters[1] != -1
+ || combat._attackMonsters[2] != -1) {
+ if ((_vm->_mode == MODE_1 || _vm->_mode == MODE_SLEEPING)
+ && !combat._monstersAttacking && !_charsShooting) {
+ doCombat();
+ }
+ }
+
+ combat.shootRangedWeapon();
+ chargeStep();
+ doStepCode();
+ }
+ break;
+
case Common::KEYCODE_v:
// Show the quests dialog
Quests::show(_vm);
diff --git a/engines/xeen/party.cpp b/engines/xeen/party.cpp
index 268dfcce15..5e111e61b4 100644
--- a/engines/xeen/party.cpp
+++ b/engines/xeen/party.cpp
@@ -735,4 +735,13 @@ void Party::giveTreasureToCharacter(Character &c, ItemCategory category, int ite
events.ipause(5);
}
+bool Party::canShoot() const {
+ for (uint idx = 0; idx < _activeParty.size(); ++idx) {
+ if (_activeParty[idx].hasMissileWeapon())
+ return true;
+ }
+
+ return false;
+}
+
} // End of namespace Xeen
diff --git a/engines/xeen/party.h b/engines/xeen/party.h
index b5e31f9405..483c3f43ec 100644
--- a/engines/xeen/party.h
+++ b/engines/xeen/party.h
@@ -173,6 +173,8 @@ public:
void giveTreasure();
bool arePacksFull() const;
+
+ bool canShoot() const;
};
} // End of namespace Xeen