[Scummvm-cvs-logs] scummvm master -> 4ea65d0a1e6c300007efc314d32936594818a003

sev- sev at scummvm.org
Thu Mar 17 16:32:52 CET 2011


This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
c813391455 HUGO: Renamed menu.* to dialogs.*
901b5e2097 HUGO: Initial work on user input dialog
4ea65d0a1e HUGO: renamed guard #defines


Commit: c8133914550a7ac8bab3761406882bcdfc8347a5
    https://github.com/scummvm/scummvm/commit/c8133914550a7ac8bab3761406882bcdfc8347a5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-03-17T08:31:02-07:00

Commit Message:
HUGO: Renamed menu.* to dialogs.*

Changed paths:
  A engines/hugo/dialogs.cpp
  A engines/hugo/dialogs.h
  R engines/hugo/menu.cpp
  R engines/hugo/menu.h
    engines/hugo/hugo.h
    engines/hugo/module.mk



diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp
new file mode 100644
index 0000000..7bcdea5
--- /dev/null
+++ b/engines/hugo/dialogs.cpp
@@ -0,0 +1,233 @@
+/* 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$
+ *
+ */
+
+#include "common/substream.h"
+#include "graphics/imagedec.h"
+#include "gui/gui-manager.h"
+
+#include "hugo/hugo.h"
+#include "hugo/display.h"
+#include "hugo/parser.h"
+#include "hugo/schedule.h"
+#include "hugo/sound.h"
+#include "hugo/util.h"
+
+namespace Hugo {
+
+TopMenu::TopMenu(HugoEngine *vm) : Dialog(0, 0, kMenuWidth, kMenuHeight), arrayBmp(0), arraySize(0),
+	_vm(vm) {
+	init();
+}
+
+TopMenu::~TopMenu() {
+	for (int i = 0; i < arraySize; i++) {
+		arrayBmp[i * 2]->free();
+		delete arrayBmp[i * 2];
+		arrayBmp[i * 2 + 1]->free();
+		delete arrayBmp[i * 2 + 1];
+	}
+	delete[] arrayBmp;
+}
+
+void TopMenu::init() {
+	int x = kMenuX;
+	int y = kMenuY;
+
+	_whatButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "What is it?", kCmdWhat);
+	_musicButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Music", kCmdMusic);
+	_soundFXButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Sound FX", kCmdSoundFX);
+	_saveButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Save game", kCmdSave);
+	_loadButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Load game", kCmdLoad);
+	_recallButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Recall last command", kCmdRecall);
+	_turboButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Turbo", kCmdTurbo);
+	_lookButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Description of the scene", kCmdLook);
+	_inventButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Inventory", kCmdInvent);
+}
+
+void TopMenu::reflowLayout() {
+	_w = g_system->getOverlayWidth();
+
+	int scale = (_w > 320 ? 2 : 1);
+
+	_h = kMenuHeight * scale;
+
+	int x = kMenuX * scale;
+	int y = kMenuY * scale;
+
+	_whatButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
+	x += kButtonWidth + kButtonPad;
+
+	_musicButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
+	x += kButtonWidth + kButtonPad;
+
+	_soundFXButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
+	x += kButtonWidth + kButtonPad;
+
+	x += kButtonSpace;
+
+	_saveButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
+	x += kButtonWidth + kButtonPad;
+
+	_loadButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
+	x += kButtonWidth + kButtonPad;
+
+	x += kButtonSpace;
+
+	_recallButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
+	x += kButtonWidth + kButtonPad;
+	
+	_turboButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
+	x += kButtonWidth + kButtonPad;
+
+	x += kButtonSpace;
+	
+	_lookButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
+	x += kButtonWidth + kButtonPad;
+	
+	_inventButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
+	x += kButtonWidth + kButtonPad;
+
+	// Set the graphics to the 'on' buttons, except for the variable ones
+	_whatButton->setGfx(arrayBmp[4 * kMenuWhat + scale - 1]);
+	_musicButton->setGfx(arrayBmp[4 * kMenuMusic + scale - 1 + ((_vm->_config.musicFl) ? 0 : 2)]);
+	_soundFXButton->setGfx(arrayBmp[4 * kMenuSoundFX + scale - 1 + ((_vm->_config.soundFl) ? 0 : 2)]);
+	_saveButton->setGfx(arrayBmp[4 * kMenuSave + scale - 1]);
+	_loadButton->setGfx(arrayBmp[4 * kMenuLoad + scale - 1]);
+	_recallButton->setGfx(arrayBmp[4 * kMenuRecall + scale - 1]);
+	_turboButton->setGfx(arrayBmp[4 * kMenuTurbo + scale - 1 + ((_vm->_config.turboFl) ? 0 : 2)]);
+	_lookButton->setGfx(arrayBmp[4 * kMenuLook + scale - 1]);
+	_inventButton->setGfx(arrayBmp[4 * kMenuInventory + scale - 1]);
+}
+
+void TopMenu::loadBmpArr(Common::SeekableReadStream &in) {
+	arraySize = in.readUint16BE();
+
+	delete arrayBmp;
+	arrayBmp = new Graphics::Surface *[arraySize * 2];
+	for (int i = 0; i < arraySize; i++) {
+		uint16 bmpSize = in.readUint16BE();
+		uint32 filPos = in.pos();
+		Common::SeekableSubReadStream stream(&in, filPos, filPos + bmpSize);
+		arrayBmp[i * 2] = Graphics::ImageDecoder::loadFile(stream, g_system->getOverlayFormat());
+		arrayBmp[i * 2 + 1] = new Graphics::Surface();
+		arrayBmp[i * 2 + 1]->create(arrayBmp[i * 2]->w * 2, arrayBmp[i * 2]->h * 2, arrayBmp[i * 2]->bytesPerPixel);
+		byte *src = (byte *)arrayBmp[i * 2]->pixels;
+		byte *dst = (byte *)arrayBmp[i * 2 + 1]->pixels;
+		
+		for (int j = 0; j < arrayBmp[i * 2]->h; j++) {
+			src = (byte *)arrayBmp[i * 2]->getBasePtr(0, j);
+			dst = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2);
+			for (int k = arrayBmp[i * 2]->w; k > 0; k--) {
+				for (int m = arrayBmp[i * 2]->bytesPerPixel; m > 0; m--) {
+					*dst++ = *src++;
+				}
+				src -= arrayBmp[i * 2]->bytesPerPixel;
+
+				for (int m = arrayBmp[i * 2]->bytesPerPixel; m > 0; m--) {
+					*dst++ = *src++;
+				}
+			}
+			src = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2);
+			dst = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2 + 1);
+			for (int k = arrayBmp[i * 2 + 1]->pitch; k > 0; k--) {
+				*dst++ = *src++;
+			}
+		}
+		
+		in.skip(bmpSize);
+	}
+}
+
+void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data) {
+	switch (command) {
+	case kCmdWhat:
+		close();
+		_vm->_file->instructions();
+		break;
+	case kCmdMusic:
+		_vm->_sound->toggleMusic();
+		_musicButton->setGfx(arrayBmp[4 * kMenuMusic + (g_system->getOverlayWidth() > 320 ? 2 : 1) - 1 + ((_vm->_config.musicFl) ? 0 : 2)]);
+		_musicButton->draw();
+		g_gui.theme()->updateScreen();
+		g_system->updateScreen();
+		g_system->delayMillis(500);
+		close();
+		break;
+	case kCmdSoundFX:
+		_vm->_sound->toggleSound();
+		reflowLayout();
+		_soundFXButton->draw();
+		g_gui.theme()->updateScreen();
+		g_system->updateScreen();
+		g_system->delayMillis(500);
+		close();
+		break;
+	case kCmdSave:
+		close();
+		if (_vm->getGameStatus().viewState == kViewPlay) {
+			if (_vm->getGameStatus().gameOverFl)
+				_vm->gameOverMsg();
+			else
+				_vm->_file->saveGame(-1, Common::String());
+		}
+		break;
+	case kCmdLoad:
+		close();
+		_vm->_file->restoreGame(-1);
+		break;
+	case kCmdRecall:
+		close();
+		_vm->getGameStatus().recallFl = true;
+		break;
+	case kCmdTurbo:
+		_vm->_parser->switchTurbo();
+		reflowLayout();
+		_turboButton->draw();
+		g_gui.theme()->updateScreen();
+		g_system->updateScreen();
+		g_system->delayMillis(500);
+		close();
+		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();
+	else
+		Dialog::handleMouseUp(x, y, button, clickCount);
+}
+
+} // End of namespace Hugo
diff --git a/engines/hugo/dialogs.h b/engines/hugo/dialogs.h
new file mode 100644
index 0000000..6e2a906
--- /dev/null
+++ b/engines/hugo/dialogs.h
@@ -0,0 +1,100 @@
+/* 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$
+ *
+ */
+
+#ifndef HUGO_TOPMENU_H
+#define HUGO_TOPMENU_H
+
+#include "gui/dialog.h"
+
+namespace Hugo {
+
+enum MenuOption {
+	kMenuWhat = 0,
+	kMenuMusic,
+	kMenuSoundFX,
+	kMenuSave,
+	kMenuLoad,
+	kMenuRecall,
+	kMenuTurbo,
+	kMenuLook,
+	kMenuInventory
+};
+
+enum {
+	kMenuWidth = 320,
+	kMenuHeight = 24,
+	kMenuX = 5,
+	kMenuY = 1,
+	kButtonWidth = 20,
+	kButtonHeight = 20,
+	kButtonPad = 1,
+	kButtonSpace = 5
+};
+
+enum {
+	kCmdWhat = 'WHAT',
+	kCmdMusic = 'MUZK',
+	kCmdSoundFX = 'SOUN',
+	kCmdSave = 'SAVE',
+	kCmdLoad = 'LOAD',
+	kCmdRecall = 'RECL',
+	kCmdTurbo = 'TURB',
+	kCmdLook = 'LOOK',
+	kCmdInvent = 'INVT'
+};
+
+class TopMenu : public GUI::Dialog {
+public:
+	TopMenu(HugoEngine *vm);
+	~TopMenu();
+
+	void reflowLayout();
+	void handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data);
+	void handleMouseUp(int x, int y, int button, int clickCount);
+
+	void loadBmpArr(Common::SeekableReadStream &in);
+
+protected:
+	void init();
+
+	HugoEngine *_vm;
+
+	GUI::PicButtonWidget *_whatButton;
+	GUI::PicButtonWidget *_musicButton;
+	GUI::PicButtonWidget *_soundFXButton;
+	GUI::PicButtonWidget *_loadButton;
+	GUI::PicButtonWidget *_saveButton;
+	GUI::PicButtonWidget *_recallButton;
+	GUI::PicButtonWidget *_turboButton;
+	GUI::PicButtonWidget *_lookButton;
+	GUI::PicButtonWidget *_inventButton;
+
+	Graphics::Surface **arrayBmp;
+	uint16 arraySize;
+};
+
+}
+
+#endif // HUGO_TOPMENU_H
diff --git a/engines/hugo/hugo.h b/engines/hugo/hugo.h
index 566cb75..a137df7 100644
--- a/engines/hugo/hugo.h
+++ b/engines/hugo/hugo.h
@@ -29,7 +29,7 @@
 #include "engines/engine.h"
 #include "common/file.h"
 #include "hugo/console.h"
-#include "hugo/menu.h"
+#include "hugo/dialogs.h"
 
 // This include is here temporarily while the engine is being refactored.
 #include "hugo/game.h"
diff --git a/engines/hugo/menu.cpp b/engines/hugo/menu.cpp
deleted file mode 100644
index 7bcdea5..0000000
--- a/engines/hugo/menu.cpp
+++ /dev/null
@@ -1,233 +0,0 @@
-/* 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$
- *
- */
-
-#include "common/substream.h"
-#include "graphics/imagedec.h"
-#include "gui/gui-manager.h"
-
-#include "hugo/hugo.h"
-#include "hugo/display.h"
-#include "hugo/parser.h"
-#include "hugo/schedule.h"
-#include "hugo/sound.h"
-#include "hugo/util.h"
-
-namespace Hugo {
-
-TopMenu::TopMenu(HugoEngine *vm) : Dialog(0, 0, kMenuWidth, kMenuHeight), arrayBmp(0), arraySize(0),
-	_vm(vm) {
-	init();
-}
-
-TopMenu::~TopMenu() {
-	for (int i = 0; i < arraySize; i++) {
-		arrayBmp[i * 2]->free();
-		delete arrayBmp[i * 2];
-		arrayBmp[i * 2 + 1]->free();
-		delete arrayBmp[i * 2 + 1];
-	}
-	delete[] arrayBmp;
-}
-
-void TopMenu::init() {
-	int x = kMenuX;
-	int y = kMenuY;
-
-	_whatButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "What is it?", kCmdWhat);
-	_musicButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Music", kCmdMusic);
-	_soundFXButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Sound FX", kCmdSoundFX);
-	_saveButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Save game", kCmdSave);
-	_loadButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Load game", kCmdLoad);
-	_recallButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Recall last command", kCmdRecall);
-	_turboButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Turbo", kCmdTurbo);
-	_lookButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Description of the scene", kCmdLook);
-	_inventButton = new GUI::PicButtonWidget(this, x, y, kButtonWidth, kButtonHeight, "Inventory", kCmdInvent);
-}
-
-void TopMenu::reflowLayout() {
-	_w = g_system->getOverlayWidth();
-
-	int scale = (_w > 320 ? 2 : 1);
-
-	_h = kMenuHeight * scale;
-
-	int x = kMenuX * scale;
-	int y = kMenuY * scale;
-
-	_whatButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
-	x += kButtonWidth + kButtonPad;
-
-	_musicButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
-	x += kButtonWidth + kButtonPad;
-
-	_soundFXButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
-	x += kButtonWidth + kButtonPad;
-
-	x += kButtonSpace;
-
-	_saveButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
-	x += kButtonWidth + kButtonPad;
-
-	_loadButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
-	x += kButtonWidth + kButtonPad;
-
-	x += kButtonSpace;
-
-	_recallButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
-	x += kButtonWidth + kButtonPad;
-	
-	_turboButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
-	x += kButtonWidth + kButtonPad;
-
-	x += kButtonSpace;
-	
-	_lookButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
-	x += kButtonWidth + kButtonPad;
-	
-	_inventButton->resize(x * scale, y * scale, kButtonWidth * scale, kButtonHeight * scale);
-	x += kButtonWidth + kButtonPad;
-
-	// Set the graphics to the 'on' buttons, except for the variable ones
-	_whatButton->setGfx(arrayBmp[4 * kMenuWhat + scale - 1]);
-	_musicButton->setGfx(arrayBmp[4 * kMenuMusic + scale - 1 + ((_vm->_config.musicFl) ? 0 : 2)]);
-	_soundFXButton->setGfx(arrayBmp[4 * kMenuSoundFX + scale - 1 + ((_vm->_config.soundFl) ? 0 : 2)]);
-	_saveButton->setGfx(arrayBmp[4 * kMenuSave + scale - 1]);
-	_loadButton->setGfx(arrayBmp[4 * kMenuLoad + scale - 1]);
-	_recallButton->setGfx(arrayBmp[4 * kMenuRecall + scale - 1]);
-	_turboButton->setGfx(arrayBmp[4 * kMenuTurbo + scale - 1 + ((_vm->_config.turboFl) ? 0 : 2)]);
-	_lookButton->setGfx(arrayBmp[4 * kMenuLook + scale - 1]);
-	_inventButton->setGfx(arrayBmp[4 * kMenuInventory + scale - 1]);
-}
-
-void TopMenu::loadBmpArr(Common::SeekableReadStream &in) {
-	arraySize = in.readUint16BE();
-
-	delete arrayBmp;
-	arrayBmp = new Graphics::Surface *[arraySize * 2];
-	for (int i = 0; i < arraySize; i++) {
-		uint16 bmpSize = in.readUint16BE();
-		uint32 filPos = in.pos();
-		Common::SeekableSubReadStream stream(&in, filPos, filPos + bmpSize);
-		arrayBmp[i * 2] = Graphics::ImageDecoder::loadFile(stream, g_system->getOverlayFormat());
-		arrayBmp[i * 2 + 1] = new Graphics::Surface();
-		arrayBmp[i * 2 + 1]->create(arrayBmp[i * 2]->w * 2, arrayBmp[i * 2]->h * 2, arrayBmp[i * 2]->bytesPerPixel);
-		byte *src = (byte *)arrayBmp[i * 2]->pixels;
-		byte *dst = (byte *)arrayBmp[i * 2 + 1]->pixels;
-		
-		for (int j = 0; j < arrayBmp[i * 2]->h; j++) {
-			src = (byte *)arrayBmp[i * 2]->getBasePtr(0, j);
-			dst = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2);
-			for (int k = arrayBmp[i * 2]->w; k > 0; k--) {
-				for (int m = arrayBmp[i * 2]->bytesPerPixel; m > 0; m--) {
-					*dst++ = *src++;
-				}
-				src -= arrayBmp[i * 2]->bytesPerPixel;
-
-				for (int m = arrayBmp[i * 2]->bytesPerPixel; m > 0; m--) {
-					*dst++ = *src++;
-				}
-			}
-			src = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2);
-			dst = (byte *)arrayBmp[i * 2 + 1]->getBasePtr(0, j * 2 + 1);
-			for (int k = arrayBmp[i * 2 + 1]->pitch; k > 0; k--) {
-				*dst++ = *src++;
-			}
-		}
-		
-		in.skip(bmpSize);
-	}
-}
-
-void TopMenu::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data) {
-	switch (command) {
-	case kCmdWhat:
-		close();
-		_vm->_file->instructions();
-		break;
-	case kCmdMusic:
-		_vm->_sound->toggleMusic();
-		_musicButton->setGfx(arrayBmp[4 * kMenuMusic + (g_system->getOverlayWidth() > 320 ? 2 : 1) - 1 + ((_vm->_config.musicFl) ? 0 : 2)]);
-		_musicButton->draw();
-		g_gui.theme()->updateScreen();
-		g_system->updateScreen();
-		g_system->delayMillis(500);
-		close();
-		break;
-	case kCmdSoundFX:
-		_vm->_sound->toggleSound();
-		reflowLayout();
-		_soundFXButton->draw();
-		g_gui.theme()->updateScreen();
-		g_system->updateScreen();
-		g_system->delayMillis(500);
-		close();
-		break;
-	case kCmdSave:
-		close();
-		if (_vm->getGameStatus().viewState == kViewPlay) {
-			if (_vm->getGameStatus().gameOverFl)
-				_vm->gameOverMsg();
-			else
-				_vm->_file->saveGame(-1, Common::String());
-		}
-		break;
-	case kCmdLoad:
-		close();
-		_vm->_file->restoreGame(-1);
-		break;
-	case kCmdRecall:
-		close();
-		_vm->getGameStatus().recallFl = true;
-		break;
-	case kCmdTurbo:
-		_vm->_parser->switchTurbo();
-		reflowLayout();
-		_turboButton->draw();
-		g_gui.theme()->updateScreen();
-		g_system->updateScreen();
-		g_system->delayMillis(500);
-		close();
-		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();
-	else
-		Dialog::handleMouseUp(x, y, button, clickCount);
-}
-
-} // End of namespace Hugo
diff --git a/engines/hugo/menu.h b/engines/hugo/menu.h
deleted file mode 100644
index 6e2a906..0000000
--- a/engines/hugo/menu.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* 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$
- *
- */
-
-#ifndef HUGO_TOPMENU_H
-#define HUGO_TOPMENU_H
-
-#include "gui/dialog.h"
-
-namespace Hugo {
-
-enum MenuOption {
-	kMenuWhat = 0,
-	kMenuMusic,
-	kMenuSoundFX,
-	kMenuSave,
-	kMenuLoad,
-	kMenuRecall,
-	kMenuTurbo,
-	kMenuLook,
-	kMenuInventory
-};
-
-enum {
-	kMenuWidth = 320,
-	kMenuHeight = 24,
-	kMenuX = 5,
-	kMenuY = 1,
-	kButtonWidth = 20,
-	kButtonHeight = 20,
-	kButtonPad = 1,
-	kButtonSpace = 5
-};
-
-enum {
-	kCmdWhat = 'WHAT',
-	kCmdMusic = 'MUZK',
-	kCmdSoundFX = 'SOUN',
-	kCmdSave = 'SAVE',
-	kCmdLoad = 'LOAD',
-	kCmdRecall = 'RECL',
-	kCmdTurbo = 'TURB',
-	kCmdLook = 'LOOK',
-	kCmdInvent = 'INVT'
-};
-
-class TopMenu : public GUI::Dialog {
-public:
-	TopMenu(HugoEngine *vm);
-	~TopMenu();
-
-	void reflowLayout();
-	void handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data);
-	void handleMouseUp(int x, int y, int button, int clickCount);
-
-	void loadBmpArr(Common::SeekableReadStream &in);
-
-protected:
-	void init();
-
-	HugoEngine *_vm;
-
-	GUI::PicButtonWidget *_whatButton;
-	GUI::PicButtonWidget *_musicButton;
-	GUI::PicButtonWidget *_soundFXButton;
-	GUI::PicButtonWidget *_loadButton;
-	GUI::PicButtonWidget *_saveButton;
-	GUI::PicButtonWidget *_recallButton;
-	GUI::PicButtonWidget *_turboButton;
-	GUI::PicButtonWidget *_lookButton;
-	GUI::PicButtonWidget *_inventButton;
-
-	Graphics::Surface **arrayBmp;
-	uint16 arraySize;
-};
-
-}
-
-#endif // HUGO_TOPMENU_H
diff --git a/engines/hugo/module.mk b/engines/hugo/module.mk
index 3a1cede..2ded997 100644
--- a/engines/hugo/module.mk
+++ b/engines/hugo/module.mk
@@ -3,6 +3,7 @@ MODULE := engines/hugo
 MODULE_OBJS := \
 	console.o \
 	detection.o \
+	dialogs.o \
 	display.o \
 	file.o \
 	file_v1d.o \
@@ -13,7 +14,6 @@ MODULE_OBJS := \
 	hugo.o \
 	intro.o \
 	inventory.o \
-	menu.o \
 	mouse.o \
 	object.o \
 	object_v1d.o \


Commit: 901b5e209743dc5fdee136758956809e7eaf7eda
    https://github.com/scummvm/scummvm/commit/901b5e209743dc5fdee136758956809e7eaf7eda
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-03-17T08:31:05-07:00

Commit Message:
HUGO: Initial work on user input dialog

Changed paths:
    engines/hugo/dialogs.cpp
    engines/hugo/dialogs.h



diff --git a/engines/hugo/dialogs.cpp b/engines/hugo/dialogs.cpp
index 7bcdea5..5907012 100644
--- a/engines/hugo/dialogs.cpp
+++ b/engines/hugo/dialogs.cpp
@@ -230,4 +230,24 @@ void TopMenu::handleMouseUp(int x, int y, int button, int clickCount) {
 		Dialog::handleMouseUp(x, y, button, clickCount);
 }
 
+EntryDialog::EntryDialog(const Common::String &title, const Common::String &buttonLabel, const Common::String &defaultValue) : GUI::Dialog(20, 20, 100, 50) {
+	new GUI::StaticTextWidget(this, 0, 0, 10, 10, title, Graphics::kTextAlignCenter);
+	
+	_text = new GUI::EditTextWidget(this, 0, 0, 50, 10, "");
+	_text->setEditString(defaultValue);
+
+	new GUI::ButtonWidget(this, 20, 20, 30, 10, buttonLabel, 0, kCmdButton);
+}
+
+void EntryDialog::handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data) {
+	switch (command) {
+	case kCmdButton:
+		close();
+		break;
+	default:
+		Dialog::handleCommand(sender, command, data);
+	}
+}
+
+
 } // End of namespace Hugo
diff --git a/engines/hugo/dialogs.h b/engines/hugo/dialogs.h
index 6e2a906..0b7560a 100644
--- a/engines/hugo/dialogs.h
+++ b/engines/hugo/dialogs.h
@@ -27,6 +27,7 @@
 #define HUGO_TOPMENU_H
 
 #include "gui/dialog.h"
+#include "gui/widgets/edittext.h"
 
 namespace Hugo {
 
@@ -54,6 +55,7 @@ enum {
 };
 
 enum {
+	// TopMenu commands
 	kCmdWhat = 'WHAT',
 	kCmdMusic = 'MUZK',
 	kCmdSoundFX = 'SOUN',
@@ -62,7 +64,10 @@ enum {
 	kCmdRecall = 'RECL',
 	kCmdTurbo = 'TURB',
 	kCmdLook = 'LOOK',
-	kCmdInvent = 'INVT'
+	kCmdInvent = 'INVT',
+
+	// EntryDialog commands
+	kCmdButton = 'BTNP'
 };
 
 class TopMenu : public GUI::Dialog {
@@ -95,6 +100,21 @@ protected:
 	uint16 arraySize;
 };
 
+class EntryDialog : public GUI::Dialog {
+	EntryDialog(const Common::String &title, const Common::String &buttonLabel, const Common::String &defaultValue);
+	~EntryDialog();
+
+	void reflowLayout();
+	void handleCommand(GUI::CommandSender *sender, uint32 command, uint32 data);
+
+	const Common::String &getEditString() const	{ return _text->getEditString(); }
+
+protected:
+	void init();
+
+	GUI::EditTextWidget *_text;
+};
+
 }
 
 #endif // HUGO_TOPMENU_H


Commit: 4ea65d0a1e6c300007efc314d32936594818a003
    https://github.com/scummvm/scummvm/commit/4ea65d0a1e6c300007efc314d32936594818a003
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2011-03-17T08:31:09-07:00

Commit Message:
HUGO: renamed guard #defines

Changed paths:
    engines/hugo/dialogs.h



diff --git a/engines/hugo/dialogs.h b/engines/hugo/dialogs.h
index 0b7560a..ce53dab 100644
--- a/engines/hugo/dialogs.h
+++ b/engines/hugo/dialogs.h
@@ -23,8 +23,8 @@
  *
  */
 
-#ifndef HUGO_TOPMENU_H
-#define HUGO_TOPMENU_H
+#ifndef HUGO_DIALOGS_H
+#define HUGO_DIALOGS_H
 
 #include "gui/dialog.h"
 #include "gui/widgets/edittext.h"
@@ -117,4 +117,4 @@ protected:
 
 }
 
-#endif // HUGO_TOPMENU_H
+#endif // HUGO_DIALOGS_H






More information about the Scummvm-git-logs mailing list