diff options
author | Nipun Garg | 2019-06-25 11:02:00 +0530 |
---|---|---|
committer | Eugene Sandulenko | 2019-09-03 17:17:00 +0200 |
commit | 8f7e0479fc1d7152cb8f6847913701b9be1bed75 (patch) | |
tree | 8b6f0fea63b01b3863c3e56c55c6baf83d8e1b02 /engines/hdb | |
parent | 9ba96ae83ef3ee972155af89915946012f386abc (diff) | |
download | scummvm-rg350-8f7e0479fc1d7152cb8f6847913701b9be1bed75.tar.gz scummvm-rg350-8f7e0479fc1d7152cb8f6847913701b9be1bed75.tar.bz2 scummvm-rg350-8f7e0479fc1d7152cb8f6847913701b9be1bed75.zip |
HDB: Add drawInventory() and related functions
Diffstat (limited to 'engines/hdb')
-rw-r--r-- | engines/hdb/window.cpp | 78 | ||||
-rw-r--r-- | engines/hdb/window.h | 9 |
2 files changed, 87 insertions, 0 deletions
diff --git a/engines/hdb/window.cpp b/engines/hdb/window.cpp index eb3647358a..12810f8a87 100644 --- a/engines/hdb/window.cpp +++ b/engines/hdb/window.cpp @@ -303,4 +303,82 @@ void Window::setDialogDelay(int delay) { _dialogDelay = g_system->getMillis() + 1000 * delay; } +void Window::drawInventory() { + int baseX, drawX, drawY; + static uint32 timer = g_hdb->getTimeSlice() + 300; + AIEntity *e, *sel; + char string[8]; + int gems, mstones; + + // INFOBAR blit - only once per frame + // note: if 2, don't draw ANY info at all + if (_infobarDimmed > 1) + return; + + _gfxInfobar->draw(kScreenWidth - _gfxInfobar->_width, 0); + + baseX = drawX = _invWinInfo.x; + drawY = _invWinInfo.y; + + // Draw Inv Items + sel = NULL; + if (_invWinInfo.selection >= g_hdb->_ai->getInvAmount()) + _invWinInfo.selection = g_hdb->_ai->getInvAmount(); + + for (int inv = 0; inv < g_hdb->_ai->getInvAmount(); inv++) { + e = g_hdb->_ai->getInvItem(inv); + if (inv == _invWinInfo.selection) + sel = e; + + e->standdownGfx[0]->drawMasked(drawX, drawY); + + drawX += kInvItemSpaceX; + if (drawX >= baseX + (kInvItemSpaceX * kInvItemPerLine)) { + drawX = baseX; + drawY += kInvItemSpaceY; + } + } + + // Draw the Gem + drawY = _invWinInfo.y + kInvItemSpaceY * 4 - 8; + drawX = baseX - 8; + _gemGfx->drawMasked(drawX, drawY); + + // Draw the Gem Amount + gems = g_hdb->_ai->getGemAmount(); + sprintf(string, "%d", gems); + g_hdb->_drawMan->setCursor(drawX + 32, drawY + 8); + g_hdb->_drawMan->drawText(string); + + // Draw the mini monkeystone + mstones = g_hdb->_ai->getMonkeystoneAmount(); + if (mstones) { + drawX = baseX + kInvItemSpaceX * 2 - 8; + _mstoneGfx->drawMasked(drawX, drawY + 8); + + // Draw the monkeystone amount + sprintf(string, "%d", mstones); + g_hdb->_drawMan->setCursor(drawX + 28, drawY + 8); + g_hdb->_drawMan->drawText(string); + } + + // If you have an inventory, draw the selection cursor + if (g_hdb->_ai->getInvAmount()) { + if (_invWinInfo.selection < 0) + _invWinInfo.selection = 0; + + // Draw the Inventory Select Cursor + drawX = baseX + (_invWinInfo.selection % kInvItemPerLine) * kInvItemSpaceX; + drawY = _invWinInfo.y + (_invWinInfo.selection / kInvItemPerLine) * kInvItemSpaceY; + _gfxInvSelect->drawMasked(drawX, drawY); + + if (sel) { + int centerX = baseX - 4 + (kScreenWidth - baseX) / 2; + drawY = _invWinInfo.y + (kInvItemSpaceY * 4) + 16; + g_hdb->_drawMan->setCursor(centerX - g_hdb->_drawMan->stringLength(sel->printedName) / 2, drawY); + g_hdb->_drawMan->drawText(sel->printedName); + } + } +} + } // End of Namespace diff --git a/engines/hdb/window.h b/engines/hdb/window.h index 8bfc38c067..32a41ae7fc 100644 --- a/engines/hdb/window.h +++ b/engines/hdb/window.h @@ -81,6 +81,15 @@ public: return _dialogInfo.active; } + // Inventory Functions + void drawInventory(); + void setInvSelect(int status) { + _invWinInfo.selection = status; + } + int getInvSelect() { + return _invWinInfo.selection; + } + private: DialogInfo _dialogInfo; |