aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2008-12-19 17:21:55 +0000
committerTorbjörn Andersson2008-12-19 17:21:55 +0000
commit1477116d9bc3b283674ef5d9489c153bfdd5f062 (patch)
tree477a90ec35dcbe32475af56e0b29a56db0394811
parent3f3b742cd64b459de1a7f2a4847159198826fd8f (diff)
downloadscummvm-rg350-1477116d9bc3b283674ef5d9489c153bfdd5f062.tar.gz
scummvm-rg350-1477116d9bc3b283674ef5d9489c153bfdd5f062.tar.bz2
scummvm-rg350-1477116d9bc3b283674ef5d9489c153bfdd5f062.zip
Clicking in the scrollbar always caused the save/load list to scroll down a page.
Now it can scroll up a page again. svn-id: r35441
-rw-r--r--engines/agi/saveload.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp
index 3aedbfb9f3..3788ae7a81 100644
--- a/engines/agi/saveload.cpp
+++ b/engines/agi/saveload.cpp
@@ -567,6 +567,21 @@ int AgiEngine::selectSlot() {
for (;;) {
int sbPos = 0;
+ // Use the extreme scrollbar positions only if the extreme
+ // slots are in sight. (We have to calculate this even if we
+ // don't redraw the save slots, because it's also used for
+ // clicking in the scrollbar.
+
+ if (_firstSlot == 0)
+ sbPos = 1;
+ else if (_firstSlot == NUM_SLOTS - NUM_VISIBLE_SLOTS)
+ sbPos = NUM_VISIBLE_SLOTS - 2;
+ else {
+ sbPos = 2 + (_firstSlot * (NUM_VISIBLE_SLOTS - 4)) / (NUM_SLOTS - NUM_VISIBLE_SLOTS - 1);
+ if (sbPos >= NUM_VISIBLE_SLOTS - 3)
+ sbPos = NUM_VISIBLE_SLOTS - 3;
+ }
+
if (oldFirstSlot != _firstSlot || oldActive != active) {
char dstr[64];
for (i = 0; i < NUM_VISIBLE_SLOTS; i++) {
@@ -580,19 +595,6 @@ int AgiEngine::selectSlot() {
char downArrow[] = "v";
char scrollBar[] = " ";
- // Use the extreme scrollbar positions only if the
- // extreme slots are in sight.
-
- if (_firstSlot == 0)
- sbPos = 1;
- else if (_firstSlot == NUM_SLOTS - NUM_VISIBLE_SLOTS)
- sbPos = NUM_VISIBLE_SLOTS - 2;
- else {
- sbPos = 2 + (_firstSlot * (NUM_VISIBLE_SLOTS - 4)) / (NUM_SLOTS - NUM_VISIBLE_SLOTS - 1);
- if (sbPos >= NUM_VISIBLE_SLOTS - 3)
- sbPos = NUM_VISIBLE_SLOTS - 3;
- }
-
for (i = 1; i < NUM_VISIBLE_SLOTS - 1; i++)
printText(scrollBar, 35, hm + 1, vm + 4 + i, 1, MSG_BOX_COLOUR, 7, true);