aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorTorbjörn Andersson2013-01-04 10:50:18 +0100
committerTorbjörn Andersson2013-01-04 10:50:18 +0100
commitc9a175a8775faf2c6d3593c5b4984b7dbd02ca99 (patch)
treef3a4131c61e90bf6413f6ef14faba8c20bb753e2 /engines
parent8afe7a2361284fec8e9971a7f9bb915e108d8e6b (diff)
downloadscummvm-rg350-c9a175a8775faf2c6d3593c5b4984b7dbd02ca99.tar.gz
scummvm-rg350-c9a175a8775faf2c6d3593c5b4984b7dbd02ca99.tar.bz2
scummvm-rg350-c9a175a8775faf2c6d3593c5b4984b7dbd02ca99.zip
TOLTECS: Scroll original save/load dialog to bottom on opening
This doesn't behave quite like the original - it seems the original does not take the fake last entry into account when saving? - but I think it's actually a bit more consistent this way.
Diffstat (limited to 'engines')
-rw-r--r--engines/toltecs/menu.cpp19
-rw-r--r--engines/toltecs/menu.h2
2 files changed, 13 insertions, 8 deletions
diff --git a/engines/toltecs/menu.cpp b/engines/toltecs/menu.cpp
index 24444018f9..85cd15b8fa 100644
--- a/engines/toltecs/menu.cpp
+++ b/engines/toltecs/menu.cpp
@@ -254,7 +254,7 @@ void MenuSystem::initMenu(MenuID menuID) {
addClickTextItem((ItemID)(kItemIdSavegame1 + i - 1), 0, 116 + 20 * (i - 1), 300, 0, saveDesc.c_str(), 231, 234);
}
loadSavegamesList();
- setSavegameCaptions();
+ setSavegameCaptions(true);
} else {
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Restore game:"), _("Restore"), false);
int slot = dialog->runModalWithCurrentTarget();
@@ -279,7 +279,7 @@ void MenuSystem::initMenu(MenuID menuID) {
}
newSlotNum = loadSavegamesList() + 1;
_savegames.push_back(SavegameItem(newSlotNum, Common::String::format("GAME %04d", _savegames.size())));
- setSavegameCaptions();
+ setSavegameCaptions(true);
} else {
GUI::SaveLoadChooser *dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"), true);
int slot = dialog->runModalWithCurrentTarget();
@@ -531,16 +531,21 @@ MenuSystem::SavegameItem *MenuSystem::getSavegameItemByID(ItemID id) {
return NULL;
}
-void MenuSystem::setSavegameCaptions() {
- uint index = _savegameListTopIndex;
+void MenuSystem::setSavegameCaptions(bool scrollToBottom) {
+ int size = _savegames.size();
+ if (scrollToBottom && size > 0) {
+ while (_savegameListTopIndex + 7 <= size)
+ _savegameListTopIndex += 6;
+ }
+ int index = _savegameListTopIndex;
for (int i = 1; i <= 7; i++)
- setItemCaption(getItem((ItemID)(kItemIdSavegame1 + i - 1)), index < _savegames.size() ? _savegames[index++]._description.c_str() : "");
+ setItemCaption(getItem((ItemID)(kItemIdSavegame1 + i - 1)), index < size ? _savegames[index++]._description.c_str() : "");
if (_savegameListTopIndex == 0) {
disableItem(kItemIdSavegameUp);
} else {
enableItem(kItemIdSavegameUp);
}
- if ((uint)_savegameListTopIndex + 7 > _savegames.size()) {
+ if (_savegameListTopIndex + 7 > size) {
disableItem(kItemIdSavegameDown);
} else {
enableItem(kItemIdSavegameDown);
@@ -551,7 +556,7 @@ void MenuSystem::scrollSavegames(int delta) {
int newPos = CLIP<int>(_savegameListTopIndex + delta, 0, _savegames.size() - 1);
_savegameListTopIndex = newPos;
restoreRect(80, 92, 440, 140);
- setSavegameCaptions();
+ setSavegameCaptions(false);
for (int i = 1; i <= 7; i++)
drawItem((ItemID)(kItemIdSavegame1 + i - 1), false);
}
diff --git a/engines/toltecs/menu.h b/engines/toltecs/menu.h
index 71422b0bbb..a5eca7c8ff 100644
--- a/engines/toltecs/menu.h
+++ b/engines/toltecs/menu.h
@@ -145,7 +145,7 @@ protected:
SavegameItem *getSavegameItemByID(ItemID id);
int loadSavegamesList();
- void setSavegameCaptions();
+ void setSavegameCaptions(bool scrollToBottom);
void scrollSavegames(int delta);
void clickSavegameItem(ItemID id);
void setCfgText(bool value, bool active);