[Scummvm-cvs-logs] SF.net SVN: scummvm:[52189] scummvm/trunk/engines/hugo

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Wed Aug 18 18:14:38 CEST 2010


Revision: 52189
          http://scummvm.svn.sourceforge.net/scummvm/?rev=52189&view=rev
Author:   strangerke
Date:     2010-08-18 16:14:38 +0000 (Wed, 18 Aug 2010)

Log Message:
-----------
Hugo - Check double F1, display properly the content of help.dat if present

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/file.cpp
    scummvm/trunk/engines/hugo/file.h
    scummvm/trunk/engines/hugo/parser.cpp
    scummvm/trunk/engines/hugo/parser.h

Modified: scummvm/trunk/engines/hugo/file.cpp
===================================================================
--- scummvm/trunk/engines/hugo/file.cpp	2010-08-18 15:39:40 UTC (rev 52188)
+++ scummvm/trunk/engines/hugo/file.cpp	2010-08-18 16:14:38 UTC (rev 52189)
@@ -908,25 +908,27 @@
 void FileManager::instructions() {
 // Simple instructions given when F1 pressed twice in a row
 // Only in DOS versions
-#define HELPFILE "help.dat"
-#define EOP '#' /* Marks end of a page in help file */
 
 	Common::File f;
 	char line[1024], *wrkLine;
 	char readBuf[2];
 
 	wrkLine = line;
-	if (!f.open(UIF_FILE))
-		Utils::Error(FILE_ERR, HELPFILE);
+	if (!f.open(HELPFILE)) {
+		warning("help.dat not found");
+		return;
+	}
 
 	while (f.read(readBuf, 1)) {
 		wrkLine[0] = readBuf[0];
+		wrkLine++;
 		do {
 			f.read(wrkLine, 1);
 		} while (*wrkLine++ != EOP);
 		wrkLine[-2] = '\0';      /* Remove EOP and previous CR */
 		Utils::Box(BOX_ANY, line);
-		f.read(wrkLine, 1);    /* Remove CR after EOP */
+		wrkLine = line;
+		f.read(readBuf, 2);    /* Remove CRLF after EOP */
 	}
 	f.close();
 }

Modified: scummvm/trunk/engines/hugo/file.h
===================================================================
--- scummvm/trunk/engines/hugo/file.h	2010-08-18 15:39:40 UTC (rev 52188)
+++ scummvm/trunk/engines/hugo/file.h	2010-08-18 16:14:38 UTC (rev 52189)
@@ -33,6 +33,10 @@
 #ifndef HUGO_FILE_H
 #define HUGO_FILE_H
 
+// TODO get rid of those defines
+#define HELPFILE "help.dat"
+#define EOP '#' /* Marks end of a page in help file */
+
 namespace Hugo {
 
 class FileManager {

Modified: scummvm/trunk/engines/hugo/parser.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser.cpp	2010-08-18 15:39:40 UTC (rev 52188)
+++ scummvm/trunk/engines/hugo/parser.cpp	2010-08-18 16:14:38 UTC (rev 52189)
@@ -54,6 +54,7 @@
 
 Parser::Parser(HugoEngine &vm) :
 	_vm(vm), _putIndex(0), _getIndex(0) {
+		_checkDoubleF1Fl = false;
 }
 
 void Parser::keyHandler(uint16 nChar, uint16 nFlags) {
@@ -81,11 +82,12 @@
 		}
 		break;
 	case Common::KEYCODE_F1:                        // User Help (DOS)
-		if (repeatedFl) {
+		if (_checkDoubleF1Fl) {
 			_vm.file().instructions();
-			nChar = '\0';
+			_checkDoubleF1Fl = false;
 		} else
 			_vm.screen().userHelp();
+			_checkDoubleF1Fl = true;
 		break;
 	case Common::KEYCODE_F2:                        // Toggle sound
 	case Common::KEYCODE_F3:                        // Repeat last line
@@ -110,6 +112,8 @@
 		}
 		break;
 	}
+	if 	((_checkDoubleF1Fl) && (nChar != Common::KEYCODE_F1))
+		_checkDoubleF1Fl = false;
 }
 
 // Add any new chars to line buffer and display them.
@@ -125,10 +129,6 @@
 //	bool          updateFl = (_getIndex != _putIndex);  // TRUE if any chars processed
 //	command_t    status_line;                     // Includes prompt, cursor
 
-//Strangerke : Useless ?
-//	bool          updateFl = (_getIndex != _putIndex);	// TRUE if any chars processed
-	//command_t    status_line;						// Includes prompt, cursor
-
 	debugC(4, kDebugParser, "charHandler");
 
 	// Check for one or more characters in ring buffer

Modified: scummvm/trunk/engines/hugo/parser.h
===================================================================
--- scummvm/trunk/engines/hugo/parser.h	2010-08-18 15:39:40 UTC (rev 52188)
+++ scummvm/trunk/engines/hugo/parser.h	2010-08-18 16:14:38 UTC (rev 52189)
@@ -71,6 +71,7 @@
 	char   _ringBuffer[32];                         // Ring buffer
 	uint16 _putIndex;
 	uint16 _getIndex;                               // Index into ring buffer
+	bool   _checkDoubleF1Fl;                        // Flag used to display user help or instructions
 
 	command_t _statusLine;
 	command_t _scoreLine;


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