[Scummvm-cvs-logs] SF.net SVN: scummvm:[33575] scummvm/branches/branch-0-12-0/engines/drascula /interface.cpp

sev at users.sourceforge.net sev at users.sourceforge.net
Sun Aug 3 13:43:50 CEST 2008


Revision: 33575
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33575&view=rev
Author:   sev
Date:     2008-08-03 11:43:50 +0000 (Sun, 03 Aug 2008)

Log Message:
-----------
Backport fix for bug #2017432: "DRASCULA: Typing is slow when you save a game"

Modified Paths:
--------------
    scummvm/branches/branch-0-12-0/engines/drascula/interface.cpp

Modified: scummvm/branches/branch-0-12-0/engines/drascula/interface.cpp
===================================================================
--- scummvm/branches/branch-0-12-0/engines/drascula/interface.cpp	2008-08-03 11:42:05 UTC (rev 33574)
+++ scummvm/branches/branch-0-12-0/engines/drascula/interface.cpp	2008-08-03 11:43:50 UTC (rev 33575)
@@ -114,7 +114,8 @@
 }
 
 void DrasculaEngine::enterName() {
-	Common::KeyCode key;
+	Common::KeyCode key, prevkey = Common::KEYCODE_INVALID;
+	int counter = 0;
 	int v = 0, h = 0;
 	char select2[23];
 	strcpy(select2, "                      ");
@@ -123,9 +124,21 @@
 		copyBackground(115, 14, 115, 14, 176, 9, bgSurface, screenSurface);
 		print_abc(select2, 117, 15);
 		updateScreen();
+		_system->delayMillis(100);
+
 		key = getScan();
-		delay(70);
-		if (key != 0) {
+
+		// Artifically decrease repeat rate.
+		// Part of bug fix #2017432: "DRASCULA: Typing is slow when you save a game"
+		// Alternative is to roll our own event loop
+		if (key == prevkey)
+			if (++counter == 3) {
+				counter = 0;
+				prevkey = Common::KEYCODE_INVALID;
+			}
+
+		if (key != 0 && key != prevkey) {
+			prevkey = key;
 			if (key >= 0 && key <= 0xFF && isalpha(key))
 				select2[v] = tolower(key);
 			else if ((key >= Common::KEYCODE_0 && key <= Common::KEYCODE_9) || key == Common::KEYCODE_SPACE)


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