diff options
author | Torbjörn Andersson | 2007-07-06 17:50:27 +0000 |
---|---|---|
committer | Torbjörn Andersson | 2007-07-06 17:50:27 +0000 |
commit | 8e7269a10042720997e8a0a56489d800a472168f (patch) | |
tree | 9c75fc16230c22a415ef383fe28a42c900e77ab3 /engines | |
parent | 118181e848014684272f095f4c323826cd7c9fa3 (diff) | |
download | scummvm-rg350-8e7269a10042720997e8a0a56489d800a472168f.tar.gz scummvm-rg350-8e7269a10042720997e8a0a56489d800a472168f.tar.bz2 scummvm-rg350-8e7269a10042720997e8a0a56489d800a472168f.zip |
Only redraw the save/load dialog when something in it has changed.
svn-id: r27942
Diffstat (limited to 'engines')
-rw-r--r-- | engines/agi/saveload.cpp | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/engines/agi/saveload.cpp b/engines/agi/saveload.cpp index ab5f818d17..9144dae96c 100644 --- a/engines/agi/saveload.cpp +++ b/engines/agi/saveload.cpp @@ -519,41 +519,48 @@ int AgiEngine::selectSlot() { _gfx->drawButton(buttonX[i], buttonY, buttonText[i], 0, 0, MSG_BOX_TEXT, MSG_BOX_COLOUR); AllowSyntheticEvents on(this); + int oldFirstSlot = _firstSlot + 1; + int oldActive = active + 1; for (;;) { - char dstr[64]; - for (i = 0; i < NUM_VISIBLE_SLOTS; i++) { - sprintf(dstr, "[%2d. %-28.28s]", i + _firstSlot, desc[i]); - printText(dstr, 0, hm + 1, vm + 4 + i, - (40 - 2 * hm) - 1, i == active ? MSG_BOX_COLOUR : MSG_BOX_TEXT, - i == active ? MSG_BOX_TEXT : MSG_BOX_COLOUR); - } + int sbPos; - char upArrow[] = "^"; - char downArrow[] = "v"; - char scrollBar[] = " "; + if (oldFirstSlot != _firstSlot || oldActive != active) { + char dstr[64]; + for (i = 0; i < NUM_VISIBLE_SLOTS; i++) { + sprintf(dstr, "[%2d. %-28.28s]", i + _firstSlot, desc[i]); + printText(dstr, 0, hm + 1, vm + 4 + i, + (40 - 2 * hm) - 1, i == active ? MSG_BOX_COLOUR : MSG_BOX_TEXT, + i == active ? MSG_BOX_TEXT : MSG_BOX_COLOUR); + } - int sbPos; + char upArrow[] = "^"; + 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; + } - // 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); - for (i = 1; i < NUM_VISIBLE_SLOTS - 1; i++) - printText(scrollBar, 35, hm + 1, vm + 4 + i, 1, MSG_BOX_COLOUR, 7, true); + printText(upArrow, 35, hm + 1, vm + 4, 1, 8, 7); + printText(downArrow, 35, hm + 1, vm + 4 + NUM_VISIBLE_SLOTS - 1, 1, 8, 7); + printText(scrollBar, 35, hm + 1, vm + 4 + sbPos, 1, MSG_BOX_COLOUR, MSG_BOX_TEXT); - printText(upArrow, 35, hm + 1, vm + 4, 1, 8, 7); - printText(downArrow, 35, hm + 1, vm + 4 + NUM_VISIBLE_SLOTS - 1, 1, 8, 7); - printText(scrollBar, 35, hm + 1, vm + 4 + sbPos, 1, MSG_BOX_COLOUR, MSG_BOX_TEXT); + oldActive = active; + oldFirstSlot = _firstSlot; + } _gfx->pollTimer(); /* msdos driver -> does nothing */ key = doPollKeyboard(); |