[Scummvm-cvs-logs] SF.net SVN: scummvm: [27942] scummvm/trunk/engines/agi/saveload.cpp
eriktorbjorn at users.sourceforge.net
eriktorbjorn at users.sourceforge.net
Fri Jul 6 19:50:28 CEST 2007
Revision: 27942
http://scummvm.svn.sourceforge.net/scummvm/?rev=27942&view=rev
Author: eriktorbjorn
Date: 2007-07-06 10:50:27 -0700 (Fri, 06 Jul 2007)
Log Message:
-----------
Only redraw the save/load dialog when something in it has changed.
Modified Paths:
--------------
scummvm/trunk/engines/agi/saveload.cpp
Modified: scummvm/trunk/engines/agi/saveload.cpp
===================================================================
--- scummvm/trunk/engines/agi/saveload.cpp 2007-07-06 16:50:44 UTC (rev 27941)
+++ scummvm/trunk/engines/agi/saveload.cpp 2007-07-06 17:50:27 UTC (rev 27942)
@@ -519,41 +519,48 @@
_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.
+ // 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;
- }
+ 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();
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list