[Scummvm-cvs-logs] SF.net SVN: scummvm:[35256] scummvm/trunk/engines/groovie

scott_t at users.sourceforge.net scott_t at users.sourceforge.net
Sat Dec 6 12:01:45 CET 2008


Revision: 35256
          http://scummvm.svn.sourceforge.net/scummvm/?rev=35256&view=rev
Author:   scott_t
Date:     2008-12-06 11:01:44 +0000 (Sat, 06 Dec 2008)

Log Message:
-----------
T7G: Fix for performance issue in save/load screen when hovering savegames

Modified Paths:
--------------
    scummvm/trunk/engines/groovie/script.cpp
    scummvm/trunk/engines/groovie/script.h

Modified: scummvm/trunk/engines/groovie/script.cpp
===================================================================
--- scummvm/trunk/engines/groovie/script.cpp	2008-12-06 06:17:10 UTC (rev 35255)
+++ scummvm/trunk/engines/groovie/script.cpp	2008-12-06 11:01:44 UTC (rev 35256)
@@ -331,11 +331,23 @@
 }
 
 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 @@
 	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 @@
 		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);

Modified: scummvm/trunk/engines/groovie/script.h
===================================================================
--- scummvm/trunk/engines/groovie/script.h	2008-12-06 06:17:10 UTC (rev 35255)
+++ scummvm/trunk/engines/groovie/script.h	2008-12-06 11:01:44 UTC (rev 35256)
@@ -66,6 +66,9 @@
 	Common::String _scriptFile;
 	Common::String _savedScriptFile;
 
+	// Save names
+	Common::String _saveNames[10];
+
 	// Code
 	byte *_code;
 	uint16 _currentInstruction;


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