aboutsummaryrefslogtreecommitdiff
path: root/engines/groovie/script.cpp
diff options
context:
space:
mode:
authorScott Thomas2008-12-06 11:01:44 +0000
committerScott Thomas2008-12-06 11:01:44 +0000
commitf2497e5ef7c8d5de6f9712c21a66f664bfe43163 (patch)
tree4d54c7b45ae139c55d13b406c6951cf7ebf4664f /engines/groovie/script.cpp
parent4c377e03390d3d1f4ae2bd33ff4be39962ff2194 (diff)
downloadscummvm-rg350-f2497e5ef7c8d5de6f9712c21a66f664bfe43163.tar.gz
scummvm-rg350-f2497e5ef7c8d5de6f9712c21a66f664bfe43163.tar.bz2
scummvm-rg350-f2497e5ef7c8d5de6f9712c21a66f664bfe43163.zip
T7G: Fix for performance issue in save/load screen when hovering savegames
svn-id: r35256
Diffstat (limited to 'engines/groovie/script.cpp')
-rw-r--r--engines/groovie/script.cpp60
1 files changed, 40 insertions, 20 deletions
diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index bf922a2658..676edb021c 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -331,11 +331,23 @@ void Script::loadgame(uint slot) {
}
void Script::savegame(uint slot) {
+ char save[15];
+ char newchar;
Common::String filename = ConfMan.getActiveDomainName() + ".00" + ('0' + slot);
Common::OutSaveFile *file = _vm->_system->getSavefileManager()->openForSaving(filename.c_str());
// Saving the variables. It is endian safe because they're byte variables
file->write(_variables, 0x400);
+ for (int i = 0; i < 15; i++) {
+ newchar = _variables[i] + 0x30;
+ if ((newchar < 0x30 || newchar > 0x39) && (newchar < 0x41 || newchar > 0x7A)) {
+ save[i] = '\0';
+ break;
+ } else {
+ save[i] = newchar;
+ }
+ }
+ _saveNames[slot] = save;
delete file;
}
@@ -1166,37 +1178,20 @@ void Script::o_hotspot_slot() {
if (hotspot(rect, address, cursor)) {
char savename[15];
- Common::String filename = ConfMan.getActiveDomainName() + ".00" + ('0' + slot);
- Common::StringList files = _vm->_system->getSavefileManager()->listSavefiles(filename.c_str());
- if (!files.empty()) {
- Common::InSaveFile *file = _vm->_system->getSavefileManager()->openForLoading(filename.c_str());
- if (file) {
- uint8 i;
- char temp;
-
- for (i = 0; i < 15; i++) {
- file->read(&temp, 1);
- savename[i] = temp + 0x30;
- }
-
- delete file;
- } else {
- strcpy(savename, "ERROR");
- }
- } else {
- strcpy(savename, "E M P T Y");
+ if (_hotspotSlot == slot) {
+ return;
}
// Load the font if required
if (!_font) {
_font = new Font(_vm->_system);
}
+ strcpy(savename, _saveNames[slot].c_str());
_font->printstring(savename);
// Save the currently highlighted slot
_hotspotSlot = slot;
} else {
- Common::Point mousepos = _vm->_system->getEventManager()->getMousePos();
if (_hotspotSlot == slot) {
Common::Rect topbar(640, 80);
@@ -1239,6 +1234,31 @@ void Script::o_checkvalidsaves() {
it++;
}
+ for (int slots = 0; slots < 10; slots++) {
+ char savename[15];
+ Common::String filename = ConfMan.getActiveDomainName() + ".00" + ('0' + slots);
+ Common::StringList files = _vm->_system->getSavefileManager()->listSavefiles(filename.c_str());
+ if (!files.empty()) {
+ Common::InSaveFile *file = _vm->_system->getSavefileManager()->openForLoading(filename.c_str());
+ if (file) {
+ uint8 i;
+ char temp;
+
+ for (i = 0; i < 15; i++) {
+ file->read(&temp, 1);
+ savename[i] = temp + 0x30;
+ }
+
+ delete file;
+ } else {
+ strcpy(savename, "ERROR");
+ }
+ } else {
+ strcpy(savename, "E M P T Y");
+ }
+ _saveNames[slots] = savename;
+ }
+
// Save the number of valid saves
setVariable(0x104, count);
debugScript(1, true, " Found %d valid savegames", count);