aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNipun Garg2019-07-14 01:14:21 +0530
committerEugene Sandulenko2019-09-03 17:17:20 +0200
commit0c5f2f024382cdaa6bd372b8240446d2c7e34d89 (patch)
treef86d80f1b2162e2195ffcea565a4692040b1a6e9 /engines
parenta5da708868db6ba1ac0821d3c03023d7d48525ee (diff)
downloadscummvm-rg350-0c5f2f024382cdaa6bd372b8240446d2c7e34d89.tar.gz
scummvm-rg350-0c5f2f024382cdaa6bd372b8240446d2c7e34d89.tar.bz2
scummvm-rg350-0c5f2f024382cdaa6bd372b8240446d2c7e34d89.zip
HDB: Add Player Attacking code
Diffstat (limited to 'engines')
-rw-r--r--engines/hdb/ai-funcs.cpp53
1 files changed, 52 insertions, 1 deletions
diff --git a/engines/hdb/ai-funcs.cpp b/engines/hdb/ai-funcs.cpp
index 3a3c50e11d..dea37fe45a 100644
--- a/engines/hdb/ai-funcs.cpp
+++ b/engines/hdb/ai-funcs.cpp
@@ -2324,7 +2324,58 @@ void AI::movePlayer(uint16 buttons) {
if (g_hdb->getActionMode() && ((hit && attackable) || !hit)) {
// Attack
- warning("STUB: movePlayer: Attack!");
+ if (_weaponSelected != AI_NONE && onEvenTile(_player->x, _player->y)) {
+ switch (_weaponSelected) {
+ case ITEM_CLUB: {
+ AIState club[5] = {STATE_NONE, STATE_ATK_CLUB_UP, STATE_ATK_CLUB_DOWN, STATE_ATK_CLUB_LEFT, STATE_ATK_CLUB_RIGHT};
+ _player->state = club[_player->dir];
+ _player->animFrame = 0;
+ _player->animDelay = _player->animCycle;
+ g_hdb->_sound->playSound(SND_CLUB_MISS);
+ }
+ break;
+
+ case ITEM_ROBOSTUNNER: {
+ // it costs 1 gem to attack!
+ if (!amt) {
+ g_hdb->_sound->playSound(SND_CELLHOLDER_USE_REJECT);
+ g_hdb->_window->openMessageBar("Recharging...", 1);
+ setGemAmount(1);
+ return;
+ }
+ setGemAmount(amt - 1);
+
+ AIState stun[5] = {STATE_NONE, STATE_ATK_STUN_UP, STATE_ATK_STUN_DOWN, STATE_ATK_STUN_LEFT, STATE_ATK_STUN_RIGHT};
+ _player->state = stun[_player->dir];
+ _player->animFrame = 0;
+ _player->animDelay = _player->animCycle;
+ _player->sequence = 1;
+ }
+ break;
+
+ case ITEM_SLUGSLINGER: {
+ // it costs 1 gem to attack!
+ if (!amt) {
+ g_hdb->_sound->playSound(SND_CELLHOLDER_USE_REJECT);
+ g_hdb->_window->openMessageBar("Recharging...", 1);
+ setGemAmount(1);
+ return;
+ }
+ setGemAmount(amt - 1);
+
+ AIState slug[5] = {STATE_NONE, STATE_ATK_SLUG_UP, STATE_ATK_SLUG_DOWN, STATE_ATK_SLUG_LEFT, STATE_ATK_SLUG_RIGHT};
+ _player->state = slug[_player->dir];
+ _player->animFrame = 0;
+ _player->animDelay = _player->animCycle;
+ spawn(AI_SLUG_ATTACK, _player->dir, _player->tileX, _player->tileY,
+ NULL, NULL, NULL, DIR_NONE, _player->level, 0, 0, 1);
+ }
+ break;
+
+ default:
+ break;
+ } // switch
+ }
return;
}