diff options
| author | James Brown | 2003-05-22 05:44:18 +0000 |
|---|---|---|
| committer | James Brown | 2003-05-22 05:44:18 +0000 |
| commit | 573678abc02ff9684a364e50134d23cd231105d2 (patch) | |
| tree | 0f929d464ec0dd08d5908f45a9744bc2545a86ae /scumm/verbs.cpp | |
| parent | 19bbee78433f41bf01db2e894d8a04b117ffb4c5 (diff) | |
| download | scummvm-rg350-573678abc02ff9684a364e50134d23cd231105d2.tar.gz scummvm-rg350-573678abc02ff9684a364e50134d23cd231105d2.tar.bz2 scummvm-rg350-573678abc02ff9684a364e50134d23cd231105d2.zip | |
V2 Inventory scrolling, etc
svn-id: r7817
Diffstat (limited to 'scumm/verbs.cpp')
| -rw-r--r-- | scumm/verbs.cpp | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/scumm/verbs.cpp b/scumm/verbs.cpp index cb9885f252..2138ac458f 100644 --- a/scumm/verbs.cpp +++ b/scumm/verbs.cpp @@ -33,32 +33,52 @@ void Scumm::checkV2Inventory(int x, int y) { if ((y < virtscr[2].topline + 34) || !(_mouseButStat & MBS_LEFT_CLICK)) return; + if (x > 145 && x < 160) { // Inventory Arrows + if (y < virtscr[2].topline + 38) // Up arrow + _inventoryOffset-=2; + else if (y > virtscr[2].topline + 47) // Down arrow + _inventoryOffset+=2; + + if (_inventoryOffset < 0) + _inventoryOffset = 0; + + if (_inventoryOffset > (getInventoryCount(_scummVars[VAR_EGO])-2)) + _inventoryOffset = (getInventoryCount(_scummVars[VAR_EGO])-2); + + redrawV2Inventory(); + } + object = ((y - virtscr[2].topline - 34) / 8) * 2; if (x > 150) object++; - object = findInventory(_scummVars[VAR_EGO], object+1); + object = findInventory(_scummVars[VAR_EGO], object+1+_inventoryOffset); if (object > 0) { runInputScript(3, object, 0); } } void Scumm::redrawV2Inventory() { - int i, items = 0, curInventoryCount = 0; + int i, items = 0; bool alternate = false; int max_inv = getInventoryCount(_scummVars[VAR_EGO]); + ScummVM::Rect inventoryBox; - if (!(_userState & 64)) - return; + // Clear on all invocations, so hiding works properly + inventoryBox.top = virtscr[2].topline + 32; + inventoryBox.bottom = virtscr[2].topline + virtscr[2].height; + inventoryBox.left = 0; + inventoryBox.right = 319; + restoreBG(inventoryBox); - if (curInventoryCount > max_inv) - curInventoryCount = max_inv; + if (!(_userState & 64)) // Don't draw inventory unless active + return; _string[1].charset = 1; _string[1].color = 5; items = 0; - for (i = curInventoryCount + 1; i <= max_inv; i++) { + for (i = _inventoryOffset + 1; i <= max_inv; i++) { int obj = findInventory(_scummVars[VAR_EGO], i); if ((obj == 0) || (items == 4)) break; @@ -76,7 +96,7 @@ void Scumm::redrawV2Inventory() { alternate = !alternate; } - if (curInventoryCount > 0) { // Draw Up Arrow + if (_inventoryOffset > 0) { // Draw Up Arrow _string[1].xpos = 145; _string[1].ypos = virtscr[2].topline + 32; _messagePtr = (const byte *)"\1\2"; |
