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

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Tue Jan 4 09:36:04 CET 2011


Revision: 55114
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55114&view=rev
Author:   strangerke
Date:     2011-01-04 08:36:03 +0000 (Tue, 04 Jan 2011)

Log Message:
-----------
HUGO: Implement menu commands

Also did some cleanup, and had to comment out 
handleMouseUp() as it's currently not working really well

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/file.cpp
    scummvm/trunk/engines/hugo/file.h
    scummvm/trunk/engines/hugo/file_v1d.cpp
    scummvm/trunk/engines/hugo/file_v1w.cpp
    scummvm/trunk/engines/hugo/file_v2d.cpp
    scummvm/trunk/engines/hugo/hugo.cpp
    scummvm/trunk/engines/hugo/menu.cpp
    scummvm/trunk/engines/hugo/menu.h
    scummvm/trunk/engines/hugo/module.mk
    scummvm/trunk/engines/hugo/parser.cpp
    scummvm/trunk/engines/hugo/parser.h
    scummvm/trunk/engines/hugo/parser_v1d.cpp
    scummvm/trunk/engines/hugo/parser_v1w.cpp

Added Paths:
-----------
    scummvm/trunk/engines/hugo/file_v2w.cpp

Modified: scummvm/trunk/engines/hugo/file.cpp
===================================================================
--- scummvm/trunk/engines/hugo/file.cpp	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/file.cpp	2011-01-04 08:36:03 UTC (rev 55114)
@@ -653,34 +653,6 @@
 }
 
 /**
-* Simple instructions given when F1 pressed twice in a row
-* Only in DOS versions
-*/
-void FileManager::instructions() {
-	Common::File f;
-	if (!f.open(HELPFILE)) {
-		warning("help.dat not found");
-		return;
-	}
-
-	char readBuf[2];
-	while (f.read(readBuf, 1)) {
-		char line[1024], *wrkLine;
-		wrkLine = line;
-		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, "%s", line);
-		wrkLine = line;
-		f.read(readBuf, 2);                         // Remove CRLF after EOP
-	}
-	f.close();
-}
-
-/**
 * Read the uif image file (inventory icons)
 */
 void FileManager::readUIFImages() {

Modified: scummvm/trunk/engines/hugo/file.h
===================================================================
--- scummvm/trunk/engines/hugo/file.h	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/file.h	2011-01-04 08:36:03 UTC (rev 55114)
@@ -58,7 +58,6 @@
 	bool     fileExists(char *filename);
 	sound_pt getSound(int16 sound, uint16 *size);
 
-	void     instructions();
 	void     readBootFile();
 	void     readImage(int objNum, object_t *objPtr);
 	void     readUIFImages();
@@ -68,6 +67,7 @@
 
 	virtual void openDatabaseFiles() = 0;
 	virtual void closeDatabaseFiles() = 0;
+	virtual void instructions() = 0;
 
 	virtual void readBackground(int screenIndex) = 0;
 	virtual void readOverlay(int screenNum, image_pt image, ovl_t overlayType) = 0;
@@ -96,22 +96,23 @@
 	FileManager_v1d(HugoEngine *vm);
 	~FileManager_v1d();
 
-	void openDatabaseFiles();
-	void closeDatabaseFiles();
-	void readBackground(int screenIndex);
-	void readOverlay(int screenNum, image_pt image, ovl_t overlayType);
-	char *fetchString(int index);
+	virtual void closeDatabaseFiles();
+	virtual void instructions();
+	virtual void openDatabaseFiles();
+	virtual void readBackground(int screenIndex);
+	virtual void readOverlay(int screenNum, image_pt image, ovl_t overlayType);
+	virtual char *fetchString(int index);
 };
 
-class FileManager_v2d : public FileManager {
+class FileManager_v2d : public FileManager_v1d {
 public:
 	FileManager_v2d(HugoEngine *vm);
 	~FileManager_v2d();
 
-	void openDatabaseFiles();
-	void closeDatabaseFiles();
-	void readBackground(int screenIndex);
-	void readOverlay(int screenNum, image_pt image, ovl_t overlayType);
+	virtual void closeDatabaseFiles();
+	virtual void openDatabaseFiles();
+	virtual void readBackground(int screenIndex);
+	virtual void readOverlay(int screenNum, image_pt image, ovl_t overlayType);
 	char *fetchString(int index);
 };
 
@@ -120,16 +121,24 @@
 	FileManager_v3d(HugoEngine *vm);
 	~FileManager_v3d();
 
+	void closeDatabaseFiles();
 	void openDatabaseFiles();
-	void closeDatabaseFiles();
 	void readBackground(int screenIndex);
 	void readOverlay(int screenNum, image_pt image, ovl_t overlayType);
 private:
 	Common::File _sceneryArchive2;                  // Handle for scenery file
 };
 
-class FileManager_v1w : public FileManager_v2d {
+class FileManager_v2w : public FileManager_v2d {
 public:
+	FileManager_v2w(HugoEngine *vm);
+	~FileManager_v2w();
+
+	void instructions();
+};
+
+class FileManager_v1w : public FileManager_v2w {
+public:
 	FileManager_v1w(HugoEngine *vm);
 	~FileManager_v1w();
 

Modified: scummvm/trunk/engines/hugo/file_v1d.cpp
===================================================================
--- scummvm/trunk/engines/hugo/file_v1d.cpp	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/file_v1d.cpp	2011-01-04 08:36:03 UTC (rev 55114)
@@ -104,5 +104,33 @@
 	return _vm->_stringtData[index];
 }
 
+/**
+* Simple instructions given when F1 pressed twice in a row
+* Only in DOS versions
+*/
+void FileManager_v1d::instructions() {
+	Common::File f;
+	if (!f.open(HELPFILE)) {
+		warning("help.dat not found");
+		return;
+	}
+
+	char readBuf[2];
+	while (f.read(readBuf, 1)) {
+		char line[1024], *wrkLine;
+		wrkLine = line;
+		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, "%s", line);
+		wrkLine = line;
+		f.read(readBuf, 2);                         // Remove CRLF after EOP
+	}
+	f.close();
+}
+
 } // End of namespace Hugo
 

Modified: scummvm/trunk/engines/hugo/file_v1w.cpp
===================================================================
--- scummvm/trunk/engines/hugo/file_v1w.cpp	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/file_v1w.cpp	2011-01-04 08:36:03 UTC (rev 55114)
@@ -37,7 +37,7 @@
 #include "hugo/util.h"
 
 namespace Hugo {
-FileManager_v1w::FileManager_v1w(HugoEngine *vm) : FileManager_v2d(vm) {
+FileManager_v1w::FileManager_v1w(HugoEngine *vm) : FileManager_v2w(vm) {
 }
 
 FileManager_v1w::~FileManager_v1w() {

Modified: scummvm/trunk/engines/hugo/file_v2d.cpp
===================================================================
--- scummvm/trunk/engines/hugo/file_v2d.cpp	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/file_v2d.cpp	2011-01-04 08:36:03 UTC (rev 55114)
@@ -40,7 +40,7 @@
 #include "hugo/util.h"
 
 namespace Hugo {
-FileManager_v2d::FileManager_v2d(HugoEngine *vm) : FileManager(vm) {
+FileManager_v2d::FileManager_v2d(HugoEngine *vm) : FileManager_v1d(vm) {
 }
 
 FileManager_v2d::~FileManager_v2d() {

Added: scummvm/trunk/engines/hugo/file_v2w.cpp
===================================================================
--- scummvm/trunk/engines/hugo/file_v2w.cpp	                        (rev 0)
+++ scummvm/trunk/engines/hugo/file_v2w.cpp	2011-01-04 08:36:03 UTC (rev 55114)
@@ -0,0 +1,55 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ *
+ */
+
+/*
+ * This code is based on original Hugo Trilogy source code
+ *
+ * Copyright (c) 1989-1995 David P. Gray
+ *
+ */
+
+#include "common/system.h"
+
+#include "hugo/hugo.h"
+#include "hugo/file.h"
+#include "hugo/util.h"
+
+namespace Hugo {
+FileManager_v2w::FileManager_v2w(HugoEngine *vm) : FileManager_v2d(vm) {
+}
+
+FileManager_v2w::~FileManager_v2w() {
+}
+
+/**
+* Display a Windows help file
+* Dame comment than in SCI: maybe in the future we can implement this, but for now this message should suffice
+*/
+void FileManager_v2w::instructions() {
+	Utils::Box(BOX_ANY, "Please use an external viewer to open the game''s help file: HUGOWIN%d.HLP", _vm->_gameVariant + 1);
+}
+
+} // End of namespace Hugo
+


Property changes on: scummvm/trunk/engines/hugo/file_v2w.cpp
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + Date Rev Author URL Id
Added: svn:eol-style
   + native

Modified: scummvm/trunk/engines/hugo/hugo.cpp
===================================================================
--- scummvm/trunk/engines/hugo/hugo.cpp	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/hugo.cpp	2011-01-04 08:36:03 UTC (rev 55114)
@@ -211,7 +211,7 @@
 		_normalTPS = 9;
 		break;
 	case 1:
-		_file = new FileManager_v2d(this);
+		_file = new FileManager_v2w(this);
 		_scheduler = new Scheduler_v1w(this);
 		_intro = new intro_v2w(this);
 		_screen = new Screen_v1w(this);
@@ -220,7 +220,7 @@
 		_normalTPS = 9;
 		break;
 	case 2:
-		_file = new FileManager_v2d(this);
+		_file = new FileManager_v2w(this);
 		_scheduler = new Scheduler_v1w(this);
 		_intro = new intro_v3w(this);
 		_screen = new Screen_v1w(this);

Modified: scummvm/trunk/engines/hugo/menu.cpp
===================================================================
--- scummvm/trunk/engines/hugo/menu.cpp	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/menu.cpp	2011-01-04 08:36:03 UTC (rev 55114)
@@ -24,6 +24,11 @@
  */
 
 #include "hugo/hugo.h"
+#include "hugo/display.h"
+#include "hugo/parser.h"
+#include "hugo/schedule.h"
+#include "hugo/sound.h"
+#include "hugo/util.h"
 #include "graphics/imagedec.h"
 #include "common/substream.h"
 
@@ -170,39 +175,56 @@
 	switch (command) {
 	case kCmdWhat:
 		close();
+		_vm->_file->instructions();
 		break;
 	case kCmdMusic:
 		close();
+		_vm->_sound->toggleMusic();
 		break;
 	case kCmdSoundFX:
 		close();
+		_vm->_sound->toggleSound();
 		break;
 	case kCmdLoad:
 		close();
+		_vm->_file->restoreGame(-1);
+		_vm->_scheduler->restoreScreen(*_vm->_screen_p);
+		_vm->getGameStatus().viewState = V_PLAY;
 		break;
 	case kCmdSave:
 		close();
+		if (_vm->getGameStatus().viewState == V_PLAY) {
+			if (_vm->getGameStatus().gameOverFl)
+				Utils::gameOverMsg();
+			else
+				_vm->_file->saveGame(-1, Common::String());
+		}
 		break;
 	case kCmdRecall:
+
 		close();
+		_vm->getGameStatus().recallFl = true;
 		break;
 	case kCmdTurbo:
 		close();
+		_vm->_parser->switchTurbo();
 		break;
 	case kCmdLook:
 		close();
+		_vm->_parser->command("look around");
 		break;
 	case kCmdInvent:
 		close();
+		_vm->_parser->showInventory();
 		break;
 	default:
 		Dialog::handleCommand(sender, command, data);
 	}
 }
 
-void TopMenu::handleMouseUp(int x, int y, int button, int clickCount) {
-	if (y > _h)
-		close();
-}
+//void TopMenu::handleMouseUp(int x, int y, int button, int clickCount) {
+//	if (y > _h)
+//		close();
+//}
 
 } // End of namespace Hugo

Modified: scummvm/trunk/engines/hugo/menu.h
===================================================================
--- scummvm/trunk/engines/hugo/menu.h	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/menu.h	2011-01-04 08:36:03 UTC (rev 55114)
@@ -48,7 +48,7 @@
 
 	void reflowLayout();
 	void handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data);
-	void handleMouseUp(int x, int y, int button, int clickCount);
+//	void handleMouseUp(int x, int y, int button, int clickCount);
 
 	void loadBmpArr(Common::File &in);
 

Modified: scummvm/trunk/engines/hugo/module.mk
===================================================================
--- scummvm/trunk/engines/hugo/module.mk	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/module.mk	2011-01-04 08:36:03 UTC (rev 55114)
@@ -11,6 +11,7 @@
 	file_v2d.o \
 	file_v3d.o \
 	file_v1w.o \
+	file_v2w.o \
 	hugo.o \
 	intro.o \
 	intro_v1d.o \

Modified: scummvm/trunk/engines/hugo/parser.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser.cpp	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/parser.cpp	2011-01-04 08:36:03 UTC (rev 55114)
@@ -31,12 +31,15 @@
  */
 
 #include "common/system.h"
+#include "common/events.h"
 
 #include "hugo/hugo.h"
+#include "hugo/display.h"
 #include "hugo/parser.h"
 #include "hugo/file.h"
 #include "hugo/schedule.h"
 #include "hugo/util.h"
+#include "hugo/route.h"
 #include "hugo/sound.h"
 #include "hugo/object.h"
 
@@ -53,6 +56,10 @@
 Parser::~Parser() {
 }
 
+void Parser::switchTurbo() {
+	_config.turboFl = !_config.turboFl;
+}
+
 /**
 * Add any new chars to line buffer and display them.
 * If CR pressed, pass line to LineHandler()
@@ -121,6 +128,146 @@
 	}
 }
 
+void Parser::keyHandler(Common::Event event) {
+	debugC(1, kDebugParser, "keyHandler(%d)", event.kbd.keycode);
+
+	status_t &gameStatus = _vm->getGameStatus();
+	uint16 nChar = event.kbd.keycode;
+
+	// Process key down event - called from OnKeyDown()
+	switch (nChar) {                                // Set various toggle states
+	case Common::KEYCODE_ESCAPE:                    // Escape key, may want to QUIT
+		if (gameStatus.inventoryState == I_ACTIVE)  // Remove inventory, if displayed
+			gameStatus.inventoryState = I_UP;
+		gameStatus.inventoryObjId = -1;             // Deselect any dragged icon
+		break;
+	case Common::KEYCODE_END:
+	case Common::KEYCODE_HOME:
+	case Common::KEYCODE_PAGEUP:
+	case Common::KEYCODE_PAGEDOWN:
+	case Common::KEYCODE_KP1:
+	case Common::KEYCODE_KP7:
+	case Common::KEYCODE_KP9:
+	case Common::KEYCODE_KP3:
+	case Common::KEYCODE_LEFT:
+	case Common::KEYCODE_RIGHT:
+	case Common::KEYCODE_UP:
+	case Common::KEYCODE_DOWN:
+	case Common::KEYCODE_KP4:
+	case Common::KEYCODE_KP6:
+	case Common::KEYCODE_KP8:
+	case Common::KEYCODE_KP2:
+		gameStatus.routeIndex = -1;                 // Stop any automatic route
+		_vm->_route->setWalk(nChar);                // Direction of hero travel
+		break;
+	case Common::KEYCODE_F1:                        // User Help (DOS)
+		if (_checkDoubleF1Fl)
+			_vm->_file->instructions();
+		else
+			_vm->_screen->userHelp();
+		_checkDoubleF1Fl = !_checkDoubleF1Fl;
+		break;
+	case Common::KEYCODE_F2:                        // Toggle sound
+		_vm->_sound->toggleSound();
+		_vm->_sound->toggleMusic();
+		break;
+	case Common::KEYCODE_F3:                        // Repeat last line
+		gameStatus.recallFl = true;
+		break;
+	case Common::KEYCODE_F4:                        // Save game
+		if (gameStatus.viewState == V_PLAY) {
+			if (gameStatus.gameOverFl)
+				Utils::gameOverMsg();
+			else
+				_vm->_file->saveGame(-1, Common::String());
+		}
+		break;
+	case Common::KEYCODE_F5:                        // Restore game
+		_vm->_file->restoreGame(-1);
+		_vm->_scheduler->restoreScreen(*_vm->_screen_p);
+		gameStatus.viewState = V_PLAY;
+		break;
+	case Common::KEYCODE_F6:                        // Inventory
+		showInventory();
+		break;
+	case Common::KEYCODE_F8:                        // Turbo mode
+		switchTurbo();
+		break;
+	case Common::KEYCODE_F9:                        // Boss button
+		warning("STUB: F9 (DOS) - BossKey");
+		break;
+	case Common::KEYCODE_l:
+		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
+			_vm->_file->restoreGame(-1);
+			_vm->_scheduler->restoreScreen(*_vm->_screen_p);
+			gameStatus.viewState = V_PLAY;
+		} else {
+			if (!gameStatus.storyModeFl) {          // Keyboard disabled
+				// Add printable keys to ring buffer
+				uint16 bnext = _putIndex + 1;
+				if (bnext >= sizeof(_ringBuffer))
+					bnext = 0;
+				if (bnext != _getIndex) {
+					_ringBuffer[_putIndex] = event.kbd.ascii;
+					_putIndex = bnext;
+				}
+			}
+		}
+		break;
+	case Common::KEYCODE_n:
+		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
+			warning("STUB: CTRL-N (WIN) - New Game");
+		} else {
+			if (!gameStatus.storyModeFl) {          // Keyboard disabled
+				// Add printable keys to ring buffer
+				uint16 bnext = _putIndex + 1;
+				if (bnext >= sizeof(_ringBuffer))
+					bnext = 0;
+				if (bnext != _getIndex) {
+					_ringBuffer[_putIndex] = event.kbd.ascii;
+					_putIndex = bnext;
+				}
+			}
+		}
+		break;
+	case Common::KEYCODE_s:
+		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
+			if (gameStatus.viewState == V_PLAY) {
+				if (gameStatus.gameOverFl)
+					Utils::gameOverMsg();
+				else
+					_vm->_file->saveGame(-1, Common::String());
+			}
+		} else {
+			if (!gameStatus.storyModeFl) {          // Keyboard disabled
+				// Add printable keys to ring buffer
+				uint16 bnext = _putIndex + 1;
+				if (bnext >= sizeof(_ringBuffer))
+					bnext = 0;
+				if (bnext != _getIndex) {
+					_ringBuffer[_putIndex] = event.kbd.ascii;
+					_putIndex = bnext;
+				}
+			}
+		}
+		break;
+	default:                                        // Any other key
+		if (!gameStatus.storyModeFl) {              // Keyboard disabled
+			// Add printable keys to ring buffer
+			uint16 bnext = _putIndex + 1;
+			if (bnext >= sizeof(_ringBuffer))
+				bnext = 0;
+			if (bnext != _getIndex) {
+				_ringBuffer[_putIndex] = event.kbd.ascii;
+				_putIndex = bnext;
+			}
+		}
+		break;
+	}
+	if (_checkDoubleF1Fl && (nChar != Common::KEYCODE_F1))
+		_checkDoubleF1Fl = false;
+}
+
 /**
 * Perform an immediate command.  Takes parameters a la sprintf
 * Assumes final string will not overrun line[] length

Modified: scummvm/trunk/engines/hugo/parser.h
===================================================================
--- scummvm/trunk/engines/hugo/parser.h	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/parser.h	2011-01-04 08:36:03 UTC (rev 55114)
@@ -51,9 +51,11 @@
 
 	void charHandler();
 	void command(const char *format, ...);
+	void keyHandler(Common::Event event);
+	void switchTurbo();
 
-	virtual void keyHandler(Common::Event event) = 0;
 	virtual void lineHandler() = 0;
+	virtual void showInventory() = 0;
 
 protected:
 	HugoEngine *_vm;
@@ -74,8 +76,8 @@
 	Parser_v1d(HugoEngine *vm);
 	~Parser_v1d();
 
-	virtual void keyHandler(Common::Event event);
 	virtual void lineHandler();
+	virtual void showInventory();
 
 protected:
 	virtual void  dropObject(object_t *obj);
@@ -118,7 +120,8 @@
 	Parser_v1w(HugoEngine *vm);
 	~Parser_v1w();
 
-	void  keyHandler(Common::Event event);
+	virtual void showInventory();
+
 	void  lineHandler();
 };
 

Modified: scummvm/trunk/engines/hugo/parser_v1d.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser_v1d.cpp	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/parser_v1d.cpp	2011-01-04 08:36:03 UTC (rev 55114)
@@ -33,15 +33,12 @@
 // parser.c - handles all keyboard/command input
 
 #include "common/system.h"
-#include "common/events.h"
 
 #include "hugo/hugo.h"
 #include "hugo/parser.h"
 #include "hugo/file.h"
 #include "hugo/schedule.h"
-#include "hugo/display.h"
 #include "hugo/util.h"
-#include "hugo/route.h"
 #include "hugo/sound.h"
 #include "hugo/object.h"
 
@@ -300,151 +297,6 @@
 	return false;
 }
 
-void Parser_v1d::keyHandler(Common::Event event) {
-	debugC(1, kDebugParser, "keyHandler(%d)", event.kbd.keycode);
-
-	status_t &gameStatus = _vm->getGameStatus();
-	uint16 nChar = event.kbd.keycode;
-
-	// Process key down event - called from OnKeyDown()
-	switch (nChar) {                                // Set various toggle states
-	case Common::KEYCODE_ESCAPE:                    // Escape key, may want to QUIT
-		if (gameStatus.inventoryState == I_ACTIVE)  // Remove inventory, if displayed
-			gameStatus.inventoryState = I_UP;
-		gameStatus.inventoryObjId = -1;             // Deselect any dragged icon
-		break;
-	case Common::KEYCODE_END:
-	case Common::KEYCODE_HOME:
-	case Common::KEYCODE_PAGEUP:
-	case Common::KEYCODE_PAGEDOWN:
-	case Common::KEYCODE_KP1:
-	case Common::KEYCODE_KP7:
-	case Common::KEYCODE_KP9:
-	case Common::KEYCODE_KP3:
-	case Common::KEYCODE_LEFT:
-	case Common::KEYCODE_RIGHT:
-	case Common::KEYCODE_UP:
-	case Common::KEYCODE_DOWN:
-	case Common::KEYCODE_KP4:
-	case Common::KEYCODE_KP6:
-	case Common::KEYCODE_KP8:
-	case Common::KEYCODE_KP2:
-		gameStatus.routeIndex = -1;                 // Stop any automatic route
-		_vm->_route->setWalk(nChar);                // Direction of hero travel
-		break;
-	case Common::KEYCODE_F1:                        // User Help (DOS)
-		if (_checkDoubleF1Fl)
-			_vm->_file->instructions();
-		else
-			_vm->_screen->userHelp();
-		_checkDoubleF1Fl = !_checkDoubleF1Fl;
-		break;
-	case Common::KEYCODE_F2:                        // Toggle sound
-		_vm->_sound->toggleSound();
-		_vm->_sound->toggleMusic();
-		break;
-	case Common::KEYCODE_F3:                        // Repeat last line
-		gameStatus.recallFl = true;
-		break;
-	case Common::KEYCODE_F4:                        // Save game
-		if (gameStatus.viewState == V_PLAY) {
-			if (gameStatus.gameOverFl)
-				Utils::gameOverMsg();
-			else
-				_vm->_file->saveGame(-1, Common::String());
-		}
-		break;
-	case Common::KEYCODE_F5:                        // Restore game
-		_vm->_file->restoreGame(-1);
-		_vm->_scheduler->restoreScreen(*_vm->_screen_p);
-		gameStatus.viewState = V_PLAY;
-		break;
-	case Common::KEYCODE_F6:                        // Inventory
-		if (gameStatus.viewState == V_PLAY) {
-			if (gameStatus.gameOverFl)
-				Utils::gameOverMsg();
-			else
-				showDosInventory();
-		}
-		break;
-	case Common::KEYCODE_F8:                        // Turbo mode
-		_config.turboFl = !_config.turboFl;
-		break;
-	case Common::KEYCODE_F9:                        // Boss button
-		warning("STUB: F9 (DOS) - BossKey");
-		break;
-	case Common::KEYCODE_l:
-		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
-			_vm->_file->restoreGame(-1);
-			_vm->_scheduler->restoreScreen(*_vm->_screen_p);
-			gameStatus.viewState = V_PLAY;
-		} else {
-			if (!gameStatus.storyModeFl) {          // Keyboard disabled
-				// Add printable keys to ring buffer
-				uint16 bnext = _putIndex + 1;
-				if (bnext >= sizeof(_ringBuffer))
-					bnext = 0;
-				if (bnext != _getIndex) {
-					_ringBuffer[_putIndex] = event.kbd.ascii;
-					_putIndex = bnext;
-				}
-			}
-		}
-		break;
-	case Common::KEYCODE_n:
-		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
-			warning("STUB: CTRL-N (WIN) - New Game");
-		} else {
-			if (!gameStatus.storyModeFl) {          // Keyboard disabled
-				// Add printable keys to ring buffer
-				uint16 bnext = _putIndex + 1;
-				if (bnext >= sizeof(_ringBuffer))
-					bnext = 0;
-				if (bnext != _getIndex) {
-					_ringBuffer[_putIndex] = event.kbd.ascii;
-					_putIndex = bnext;
-				}
-			}
-		}
-		break;
-	case Common::KEYCODE_s:
-		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
-			if (gameStatus.viewState == V_PLAY) {
-				if (gameStatus.gameOverFl)
-					Utils::gameOverMsg();
-				else
-					_vm->_file->saveGame(-1, Common::String());
-			}
-		} else {
-			if (!gameStatus.storyModeFl) {              // Keyboard disabled
-				// Add printable keys to ring buffer
-				uint16 bnext = _putIndex + 1;
-				if (bnext >= sizeof(_ringBuffer))
-					bnext = 0;
-				if (bnext != _getIndex) {
-					_ringBuffer[_putIndex] = event.kbd.ascii;
-					_putIndex = bnext;
-				}
-			}
-		}
-		break;
-	default:                                        // Any other key
-		if (!gameStatus.storyModeFl) {              // Keyboard disabled
-			// Add printable keys to ring buffer
-			uint16 bnext = _putIndex + 1;
-			if (bnext >= sizeof(_ringBuffer))
-				bnext = 0;
-			if (bnext != _getIndex) {
-				_ringBuffer[_putIndex] = event.kbd.ascii;
-				_putIndex = bnext;
-			}
-		}
-		break;
-	}
-	if (_checkDoubleF1Fl && (nChar != Common::KEYCODE_F1))
-		_checkDoubleF1Fl = false;
-}
-
 /**
 * Parse the user's line of text input.  Generate events as necessary
 */
@@ -570,4 +422,13 @@
 		Utils::Box(BOX_ANY, "%s", _vm->_textParser[kTBEh_1d]);
 }
 
+void Parser_v1d::showInventory() {
+	status_t &gameStatus = _vm->getGameStatus();
+	if (gameStatus.viewState == V_PLAY) {
+		if (gameStatus.gameOverFl)
+			Utils::gameOverMsg();
+		else
+			showDosInventory();
+	}
+}
 } // End of namespace Hugo

Modified: scummvm/trunk/engines/hugo/parser_v1w.cpp
===================================================================
--- scummvm/trunk/engines/hugo/parser_v1w.cpp	2011-01-03 22:53:34 UTC (rev 55113)
+++ scummvm/trunk/engines/hugo/parser_v1w.cpp	2011-01-04 08:36:03 UTC (rev 55114)
@@ -52,154 +52,6 @@
 Parser_v1w::~Parser_v1w() {
 }
 
-void Parser_v1w::keyHandler(Common::Event event) {
-	debugC(1, kDebugParser, "keyHandler(%d)", event.kbd.keycode);
-
-	status_t &gameStatus = _vm->getGameStatus();
-	uint16 nChar = event.kbd.keycode;
-
-	// Process key down event - called from OnKeyDown()
-	switch (nChar) {                                // Set various toggle states
-	case Common::KEYCODE_ESCAPE:                    // Escape key, may want to QUIT
-		if (gameStatus.inventoryState == I_ACTIVE)  // Remove inventory, if displayed
-			gameStatus.inventoryState = I_UP;
-		gameStatus.inventoryObjId = -1;             // Deselect any dragged icon
-		break;
-	case Common::KEYCODE_END:
-	case Common::KEYCODE_HOME:
-	case Common::KEYCODE_PAGEUP:
-	case Common::KEYCODE_PAGEDOWN:
-	case Common::KEYCODE_KP1:
-	case Common::KEYCODE_KP7:
-	case Common::KEYCODE_KP9:
-	case Common::KEYCODE_KP3:
-	case Common::KEYCODE_LEFT:
-	case Common::KEYCODE_RIGHT:
-	case Common::KEYCODE_UP:
-	case Common::KEYCODE_DOWN:
-	case Common::KEYCODE_KP4:
-	case Common::KEYCODE_KP6:
-	case Common::KEYCODE_KP8:
-	case Common::KEYCODE_KP2:
-		gameStatus.routeIndex = -1;                 // Stop any automatic route
-		_vm->_route->setWalk(nChar);                // Direction of hero travel
-		break;
-	case Common::KEYCODE_F1:                        // User Help (DOS)
-		if (_checkDoubleF1Fl)
-			_vm->_file->instructions();
-		else
-			_vm->_screen->userHelp();
-		_checkDoubleF1Fl = !_checkDoubleF1Fl;
-		break;
-	case Common::KEYCODE_F2:                        // Toggle sound
-		_vm->_sound->toggleSound();
-		_vm->_sound->toggleMusic();
-		break;
-	case Common::KEYCODE_F3:                        // Repeat last line
-		gameStatus.recallFl = true;
-		break;
-	case Common::KEYCODE_F4:                        // Save game
-		if (gameStatus.viewState == V_PLAY) {
-			if (gameStatus.gameOverFl)
-				Utils::gameOverMsg();
-			else
-				_vm->_file->saveGame(-1, Common::String());
-		}
-		break;
-	case Common::KEYCODE_F5:                        // Restore game
-		_vm->_file->restoreGame(-1);
-		_vm->_scheduler->restoreScreen(*_vm->_screen_p);
-		gameStatus.viewState = V_PLAY;
-		break;
-	case Common::KEYCODE_F6:                        // Inventory
-		if (gameStatus.gameOverFl) {
-			Utils::gameOverMsg();
-	    } else if ((gameStatus.inventoryState == I_OFF) && (gameStatus.viewState == V_PLAY)) {
-			gameStatus.inventoryState = I_DOWN;
-			gameStatus.viewState = V_INVENT;
-		} else if (gameStatus.inventoryState == I_ACTIVE) {
-			gameStatus.inventoryState = I_UP;
-			gameStatus.viewState = V_INVENT;
-		}
-		break;
-	case Common::KEYCODE_F8:                        // Turbo mode
-		_config.turboFl = !_config.turboFl;
-		break;
-	case Common::KEYCODE_F9:                        // Boss button
-		warning("STUB: F9 (DOS) - BossKey");
-		break;
-	case Common::KEYCODE_l:
-		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
-			_vm->_file->restoreGame(-1);
-			_vm->_scheduler->restoreScreen(*_vm->_screen_p);
-			gameStatus.viewState = V_PLAY;
-		} else {
-			if (!gameStatus.storyModeFl) {          // Keyboard disabled
-				// Add printable keys to ring buffer
-				uint16 bnext = _putIndex + 1;
-				if (bnext >= sizeof(_ringBuffer))
-					bnext = 0;
-				if (bnext != _getIndex) {
-					_ringBuffer[_putIndex] = event.kbd.ascii;
-					_putIndex = bnext;
-				}
-			}
-		}
-		break;
-	case Common::KEYCODE_n:
-		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
-			warning("STUB: CTRL-N (WIN) - New Game");
-		} else {
-			if (!gameStatus.storyModeFl) {          // Keyboard disabled
-				// Add printable keys to ring buffer
-				uint16 bnext = _putIndex + 1;
-				if (bnext >= sizeof(_ringBuffer))
-					bnext = 0;
-				if (bnext != _getIndex) {
-					_ringBuffer[_putIndex] = event.kbd.ascii;
-					_putIndex = bnext;
-				}
-			}
-		}
-		break;
-	case Common::KEYCODE_s:
-		if (event.kbd.hasFlags(Common::KBD_CTRL)) {
-			if (gameStatus.viewState == V_PLAY) {
-				if (gameStatus.gameOverFl)
-					Utils::gameOverMsg();
-				else
-					_vm->_file->saveGame(-1, Common::String());
-			}
-		} else {
-			if (!gameStatus.storyModeFl) {          // Keyboard disabled
-				// Add printable keys to ring buffer
-				uint16 bnext = _putIndex + 1;
-				if (bnext >= sizeof(_ringBuffer))
-					bnext = 0;
-				if (bnext != _getIndex) {
-					_ringBuffer[_putIndex] = event.kbd.ascii;
-					_putIndex = bnext;
-				}
-			}
-		}
-		break;
-	default:                                        // Any other key
-		if (!gameStatus.storyModeFl) {              // Keyboard disabled
-			// Add printable keys to ring buffer
-			uint16 bnext = _putIndex + 1;
-			if (bnext >= sizeof(_ringBuffer))
-				bnext = 0;
-			if (bnext != _getIndex) {
-				_ringBuffer[_putIndex] = event.kbd.ascii;
-				_putIndex = bnext;
-			}
-		}
-		break;
-	}
-	if (_checkDoubleF1Fl && (nChar != Common::KEYCODE_F1))
-		_checkDoubleF1Fl = false;
-}
-
 /**
 * Parse the user's line of text input.  Generate events as necessary
 */
@@ -349,4 +201,17 @@
 	}
 }
 
+void Parser_v1w::showInventory() {
+	status_t &gameStatus = _vm->getGameStatus();
+	if (gameStatus.gameOverFl) {
+		Utils::gameOverMsg();
+	} else if ((gameStatus.inventoryState == I_OFF) && (gameStatus.viewState == V_PLAY)) {
+		gameStatus.inventoryState = I_DOWN;
+		gameStatus.viewState = V_INVENT;
+	} else if (gameStatus.inventoryState == I_ACTIVE) {
+		gameStatus.inventoryState = I_UP;
+		gameStatus.viewState = V_INVENT;
+	}
+}
+
 } // End of namespace Hugo


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