diff options
author | Arnaud Boutonné | 2010-08-18 16:14:38 +0000 |
---|---|---|
committer | Arnaud Boutonné | 2010-08-18 16:14:38 +0000 |
commit | fa41f9ffd05a97c90a59fb629a7b6e61abf231fa (patch) | |
tree | 023165eae292ff3bc78ae87bcdde45d54a17e494 /engines | |
parent | fc94562c771a528ba6be57504c9bc097cac9d426 (diff) | |
download | scummvm-rg350-fa41f9ffd05a97c90a59fb629a7b6e61abf231fa.tar.gz scummvm-rg350-fa41f9ffd05a97c90a59fb629a7b6e61abf231fa.tar.bz2 scummvm-rg350-fa41f9ffd05a97c90a59fb629a7b6e61abf231fa.zip |
Hugo - Check double F1, display properly the content of help.dat if present
svn-id: r52189
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hugo/file.cpp | 12 | ||||
-rw-r--r-- | engines/hugo/file.h | 4 | ||||
-rw-r--r-- | engines/hugo/parser.cpp | 12 | ||||
-rw-r--r-- | engines/hugo/parser.h | 1 |
4 files changed, 18 insertions, 11 deletions
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp index 487f331039..f4838e7320 100644 --- a/engines/hugo/file.cpp +++ b/engines/hugo/file.cpp @@ -908,25 +908,27 @@ void FileManager::readUIFItem(int16 id, byte *buf) { 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(); } diff --git a/engines/hugo/file.h b/engines/hugo/file.h index 50f4b505c3..e775285727 100644 --- a/engines/hugo/file.h +++ b/engines/hugo/file.h @@ -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 { diff --git a/engines/hugo/parser.cpp b/engines/hugo/parser.cpp index c9c3b8dc4e..60a33425de 100644 --- a/engines/hugo/parser.cpp +++ b/engines/hugo/parser.cpp @@ -54,6 +54,7 @@ namespace Hugo { Parser::Parser(HugoEngine &vm) : _vm(vm), _putIndex(0), _getIndex(0) { + _checkDoubleF1Fl = false; } void Parser::keyHandler(uint16 nChar, uint16 nFlags) { @@ -81,11 +82,12 @@ void Parser::keyHandler(uint16 nChar, uint16 nFlags) { } 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 @@ void Parser::keyHandler(uint16 nChar, uint16 nFlags) { } break; } + if ((_checkDoubleF1Fl) && (nChar != Common::KEYCODE_F1)) + _checkDoubleF1Fl = false; } // Add any new chars to line buffer and display them. @@ -125,10 +129,6 @@ void Parser::charHandler() { // 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 diff --git a/engines/hugo/parser.h b/engines/hugo/parser.h index 0bfbe32715..692f293e36 100644 --- a/engines/hugo/parser.h +++ b/engines/hugo/parser.h @@ -71,6 +71,7 @@ private: 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; |