diff options
author | Nipun Garg | 2019-07-14 01:04:34 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:20 +0200 |
commit | a5da708868db6ba1ac0821d3c03023d7d48525ee (patch) | |
tree | fe70afe9c27290641d6fe8fccd3b58052718d03f /engines/hdb/window.cpp | |
parent | 44ae2202aaf7f5f54ddd743d7494690afda3bcc3 (diff) | |
download | scummvm-rg350-a5da708868db6ba1ac0821d3c03023d7d48525ee.tar.gz scummvm-rg350-a5da708868db6ba1ac0821d3c03023d7d48525ee.tar.bz2 scummvm-rg350-a5da708868db6ba1ac0821d3c03023d7d48525ee.zip |
HDB: Add Weapon Drawing and Equipping Code
Diffstat (limited to 'engines/hdb/window.cpp')
-rw-r--r-- | engines/hdb/window.cpp | 62 |
1 files changed, 59 insertions, 3 deletions
diff --git a/engines/hdb/window.cpp b/engines/hdb/window.cpp index 8df868ec37..486f9809d1 100644 --- a/engines/hdb/window.cpp +++ b/engines/hdb/window.cpp @@ -379,6 +379,37 @@ void Window::checkPause(int x, int y) { } } +void Window::drawWeapon() { +} + +void Window::chooseWeapon(AIType wType) { + static AIType lastWeaponSelected = AI_NONE; + Tile *gfx; + int slot = g_hdb->_ai->queryInventoryTypeSlot(wType); + + g_hdb->_sound->playSound(SND_MENU_SLIDER); + + if (!g_hdb->getActionMode()) + return; + + gfx = g_hdb->_ai->getInvItemGfx(slot); + + switch (wType) { + case ITEM_CLUB: + case ITEM_ROBOSTUNNER: + case ITEM_SLUGSLINGER: + g_hdb->_ai->setPlayerWeapon(wType, gfx); + if (wType == lastWeaponSelected) + return; + lastWeaponSelected = wType; + g_hdb->_sound->playSound(SND_MENU_ACCEPT); + return; + default: + break; + } + g_hdb->_sound->playSound(SND_CELLHOLDER_USE_REJECT); +} + void Window::closeAll() { closeDialog(); closeDialogChoice(); @@ -450,8 +481,16 @@ void Window::drawDialog() { _gfxBR->drawMasked(_gfxBL->_width + _gfxBM->_width, _gfxTL->_height + _gfxL->_height); #endif - if (g_hdb->getActionMode()) - debug(9, "STUB: drawDialog: Draw Player Weapon"); + if (g_hdb->getActionMode()) { + Tile *gfx2 = g_hdb->_ai->getPlayerWeaponGfx(); + if (gfx2) { + int xOff = 40 * _pzInfo.active; + Tile *gfx = g_hdb->_ai->getPlayerWeaponSelGfx(); + gfx->drawMasked(kWeaponX - xOff - 1, kWeaponY); + gfx2->drawMasked(kWeaponX - xOff, kWeaponY); + drawWeapon(); + } + } if (!_dialogInfo.active) return; @@ -939,10 +978,27 @@ void Window::checkInvSelect(int x, int y) { _invWinInfo.selection = yc * kInvItemPerLine + xc; // If this is a weapon, choose it - warning("STUB: checkInvSelect: ChooseWeapon() required"); + AIType t = g_hdb->_ai->getInvItemType(_invWinInfo.selection); + switch (t) { + case ITEM_CLUB: + case ITEM_ROBOSTUNNER: + case ITEM_SLUGSLINGER: + chooseWeapon(t); + if (t == ITEM_CLUB) + g_hdb->_sound->playSound(SND_GET_CLUB); + else if (t == ITEM_ROBOSTUNNER) + g_hdb->_sound->playSound(SND_GET_STUNNER); + else if (t == ITEM_SLUGSLINGER) + g_hdb->_sound->playSound(SND_GET_SLUG); + return; + default: + break; + } g_hdb->_sound->playSound(SND_POP); } + + return; } void Window::openDeliveries(bool animate) { |