[Scummvm-cvs-logs] SF.net SVN: scummvm:[33272] scummvm/trunk/engines/parallaction

peres001 at users.sourceforge.net peres001 at users.sourceforge.net
Fri Jul 25 08:35:03 CEST 2008


Revision: 33272
          http://scummvm.svn.sourceforge.net/scummvm/?rev=33272&view=rev
Author:   peres001
Date:     2008-07-25 06:35:02 +0000 (Fri, 25 Jul 2008)

Log Message:
-----------
Converted BRA to work with the new menu approach. It is not yet well plugged-in as in NS, but it suffices for the moment.

Modified Paths:
--------------
    scummvm/trunk/engines/parallaction/gui_br.cpp
    scummvm/trunk/engines/parallaction/gui_ns.cpp
    scummvm/trunk/engines/parallaction/module.mk
    scummvm/trunk/engines/parallaction/parallaction.h
    scummvm/trunk/engines/parallaction/parallaction_br.cpp

Added Paths:
-----------
    scummvm/trunk/engines/parallaction/gui.cpp
    scummvm/trunk/engines/parallaction/gui.h

Added: scummvm/trunk/engines/parallaction/gui.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui.cpp	                        (rev 0)
+++ scummvm/trunk/engines/parallaction/gui.cpp	2008-07-25 06:35:02 UTC (rev 33272)
@@ -0,0 +1,92 @@
+/* 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 "parallaction/gui.h"
+
+namespace Parallaction {
+
+bool MenuInputHelper::run() {
+	if (_newState == 0) {
+		debugC(3, kDebugExec, "MenuInputHelper has set NULL state");
+		return false;
+	}
+
+	if (_newState != _state) {
+		debugC(3, kDebugExec, "MenuInputHelper changing state to '%s'", _newState->_name.c_str());
+
+		_newState->enter();
+		_state = _newState;
+	}
+
+	_newState = _state->run();
+
+	return true;
+}
+
+MenuInputHelper::~MenuInputHelper() {
+	StateMap::iterator b = _map.begin();
+	for ( ; b != _map.end(); b++) {
+		delete b->_value;
+	}
+	_map.clear();
+}
+
+
+void Parallaction::runGuiFrame() {
+	if (_input->_inputMode != Input::kInputModeMenu) {
+		return;
+	}
+
+	if (!_menuHelper) {
+		error("No menu helper defined!");
+	}
+
+	bool res = _menuHelper->run();
+
+	if (!res) {
+		cleanupGui();
+		_input->_inputMode = Input::kInputModeGame;
+	}
+
+}
+
+void Parallaction::cleanupGui() {
+	delete _menuHelper;
+	_menuHelper = 0;
+}
+
+void Parallaction::setInternLanguage(uint id) {
+	//TODO: assert id!
+
+	_language = id;
+	_disk->setLanguage(id);
+}
+
+uint Parallaction::getInternLanguage() {
+	return _language;
+}
+
+
+} // namespace  Parallaction


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

Added: scummvm/trunk/engines/parallaction/gui.h
===================================================================
--- scummvm/trunk/engines/parallaction/gui.h	                        (rev 0)
+++ scummvm/trunk/engines/parallaction/gui.h	2008-07-25 06:35:02 UTC (rev 33272)
@@ -0,0 +1,93 @@
+/* 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 PARALLACTION_GUI_H
+#define PARALLACTION_GUI_H
+
+#include "common/system.h"
+#include "common/hashmap.h"
+
+#include "parallaction/input.h"
+#include "parallaction/parallaction.h"
+#include "parallaction/sound.h"
+
+
+namespace Parallaction {
+
+class MenuInputState;
+
+class MenuInputHelper {
+	typedef	Common::HashMap<Common::String, MenuInputState*> StateMap;
+
+	StateMap	_map;
+	MenuInputState	*_state;
+	MenuInputState *_newState;
+
+public:
+	MenuInputHelper() : _state(0) {
+	}
+
+	~MenuInputHelper();
+
+	void setState(const Common::String &name) {
+		// bootstrap routine
+		_newState = getState(name);
+		assert(_newState);
+	}
+
+	void addState(const Common::String &name, MenuInputState *state) {
+		_map.setVal(name, state);
+	}
+
+	MenuInputState *getState(const Common::String &name) {
+		return _map[name];
+	}
+
+	bool run();
+};
+
+class MenuInputState {
+
+protected:
+	MenuInputHelper *_helper;
+
+public:
+	MenuInputState(const Common::String &name, MenuInputHelper *helper) : _helper(helper), _name(name) {
+		debugC(3, kDebugExec, "MenuInputState(%s)", name.c_str());
+		_helper->addState(name, this);
+	}
+
+	Common::String	_name;
+
+	virtual ~MenuInputState() { }
+
+	virtual MenuInputState* run() = 0;
+	virtual void enter() = 0;
+};
+
+
+} // namespace Parallaction
+
+#endif


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

Modified: scummvm/trunk/engines/parallaction/gui_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_br.cpp	2008-07-25 06:32:38 UTC (rev 33271)
+++ scummvm/trunk/engines/parallaction/gui_br.cpp	2008-07-25 06:35:02 UTC (rev 33272)
@@ -25,184 +25,267 @@
 
 #include "common/system.h"
 
-
+#include "parallaction/gui.h"
 #include "parallaction/input.h"
 #include "parallaction/parallaction.h"
 
 namespace Parallaction {
 
-enum MenuOptions {
-	kMenuPart0 = 0,
-	kMenuPart1 = 1,
-	kMenuPart2 = 2,
-	kMenuPart3 = 3,
-	kMenuPart4 = 4,
-	kMenuLoadGame = 5,
-	kMenuQuit = 6
-};
+class SplashInputState_BR : public MenuInputState {
+protected:
+	Common::String _slideName;
+	uint32 _timeOut;
+	Common::String _nextState;
+	uint32	_startTime;
+	Palette blackPal;
+	Palette pal;
 
+	Parallaction_br *_vm;
+	int _fadeSteps;
 
-void Parallaction_br::guiStart() {
+public:
+	SplashInputState_BR(Parallaction_br *vm, const Common::String &name, MenuInputHelper *helper) : MenuInputState(name, helper), _vm(vm)  {
+	}
 
-	// TODO: load progress value from special save game
-	_progress = 3;
+	virtual MenuInputState* run() {
+		if (_fadeSteps > 0) {
+			pal.fadeTo(blackPal, 1);
+			_vm->_gfx->setPalette(pal);
+			_fadeSteps--;
+			// TODO: properly implement timers to avoid delay calls
+			_vm->_system->delayMillis(20);
+			return this;
+		}
 
-	int option = guiShowMenu();
-	switch (option) {
-	case kMenuQuit:
-		_engineFlags |= kEngineQuit;
-		break;
+		if (_fadeSteps == 0) {
+			_vm->freeBackground();
+			return _helper->getState(_nextState);
+		}
 
-	case kMenuLoadGame:
-		warning("loadgame not yet implemented");
-		break;
+		uint32 curTime = _vm->_system->getMillis();
+		if (curTime - _startTime > _timeOut) {
+			_fadeSteps = 64;
+			pal.clone(_vm->_gfx->_backgroundInfo.palette);
+		}
+		return this;
+	}
 
-	default:
-		_part = option;
-		_disk->selectArchive(_partNames[_part]);
-		startPart();
+	virtual void enter() {
+		_vm->_gfx->clearScreen();
+		_vm->_gfx->setBackground(kBackgroundSlide, _slideName.c_str(), 0, 0);
+		_vm->_gfx->_backgroundInfo.x = (_vm->_screenWidth - _vm->_gfx->_backgroundInfo.width) >> 1;
+		_vm->_gfx->_backgroundInfo.y = (_vm->_screenHeight - _vm->_gfx->_backgroundInfo.height) >> 1;
+		_vm->_input->setMouseState(MOUSE_DISABLED);
+
+		_startTime = g_system->getMillis();
+		_fadeSteps = -1;
 	}
-}
+};
 
-void Parallaction_br::guiSplash(const char *name) {
+class SplashInputState0_BR : public SplashInputState_BR {
 
-	_gfx->clearScreen();
-	_gfx->setBackground(kBackgroundSlide, name, 0, 0);
-	_gfx->_backgroundInfo.x = (_screenWidth - _gfx->_backgroundInfo.width) >> 1;
-	_gfx->_backgroundInfo.y = (_screenHeight - _gfx->_backgroundInfo.height) >> 1;
-	_gfx->updateScreen();
-	_system->delayMillis(600);
+public:
+	SplashInputState0_BR(Parallaction_br *vm, MenuInputHelper *helper) : SplashInputState_BR(vm, "intro0", helper)  {
+		_slideName = "dyna";
+		_timeOut = 600;
+		_nextState = "intro1";
+	}
+};
 
-	Palette blackPal;
-	Palette pal(_gfx->_backgroundInfo.palette);
-	for (uint i = 0; i < 64; i++) {
-		pal.fadeTo(blackPal, 1);
-		_gfx->setPalette(pal);
-		_gfx->updateScreen();
-		_system->delayMillis(20);
+class SplashInputState1_BR : public SplashInputState_BR {
+
+public:
+	SplashInputState1_BR(Parallaction_br *vm, MenuInputHelper *helper) : SplashInputState_BR(vm, "intro1", helper) {
+		_slideName = "core";
+		_timeOut = 600;
+		_nextState = "mainmenu";
 	}
+};
 
-}
+class MainMenuInputState_BR : public MenuInputState {
+	Parallaction_br *_vm;
 
-#define MENUITEMS_X			250
-#define MENUITEMS_Y			200
+	#define MENUITEMS_X			250
+	#define MENUITEMS_Y			200
 
-#define MENUITEM_WIDTH		190
-#define MENUITEM_HEIGHT		18
+	#define MENUITEM_WIDTH		190
+	#define MENUITEM_HEIGHT		18
 
-Frames* Parallaction_br::guiRenderMenuItem(const char *text) {
-	// this builds a surface containing two copies of the text.
-	// one is in normal color, the other is inverted.
-	// the two 'frames' are used to display selected/unselected menu items
+	Frames* renderMenuItem(const char *text) {
+		// this builds a surface containing two copies of the text.
+		// one is in normal color, the other is inverted.
+		// the two 'frames' are used to display selected/unselected menu items
 
-	Graphics::Surface *surf = new Graphics::Surface;
-	surf->create(MENUITEM_WIDTH, MENUITEM_HEIGHT*2, 1);
+		Graphics::Surface *surf = new Graphics::Surface;
+		surf->create(MENUITEM_WIDTH, MENUITEM_HEIGHT*2, 1);
 
-	// build first frame to be displayed when item is not selected
-	if (getPlatform() == Common::kPlatformPC) {
-		_menuFont->setColor(0);
-	} else {
-		_menuFont->setColor(7);
-	}
-	_menuFont->drawString((byte*)surf->getBasePtr(5, 2), MENUITEM_WIDTH, text);
+		// build first frame to be displayed when item is not selected
+		if (_vm->getPlatform() == Common::kPlatformPC) {
+			_vm->_menuFont->setColor(0);
+		} else {
+			_vm->_menuFont->setColor(7);
+		}
+		_vm->_menuFont->drawString((byte*)surf->getBasePtr(5, 2), MENUITEM_WIDTH, text);
 
-	// build second frame to be displayed when item is selected
-	_menuFont->drawString((byte*)surf->getBasePtr(5, 2 + MENUITEM_HEIGHT), MENUITEM_WIDTH, text);
-	byte *s = (byte*)surf->getBasePtr(0, MENUITEM_HEIGHT);
-	for (int i = 0; i < surf->w * MENUITEM_HEIGHT; i++) {
-		*s++ ^= 0xD;
+		// build second frame to be displayed when item is selected
+		_vm->_menuFont->drawString((byte*)surf->getBasePtr(5, 2 + MENUITEM_HEIGHT), MENUITEM_WIDTH, text);
+		byte *s = (byte*)surf->getBasePtr(0, MENUITEM_HEIGHT);
+		for (int i = 0; i < surf->w * MENUITEM_HEIGHT; i++) {
+			*s++ ^= 0xD;
+		}
+
+		// wrap the surface into the suitable Frames adapter
+		return new SurfaceToMultiFrames(2, MENUITEM_WIDTH, MENUITEM_HEIGHT, surf);
 	}
 
-	// wrap the surface into the suitable Frames adapter
-	return new SurfaceToMultiFrames(2, MENUITEM_WIDTH, MENUITEM_HEIGHT, surf);
-}
+	enum MenuOptions {
+		kMenuPart0 = 0,
+		kMenuPart1 = 1,
+		kMenuPart2 = 2,
+		kMenuPart3 = 3,
+		kMenuPart4 = 4,
+		kMenuLoadGame = 5,
+		kMenuQuit = 6
+	};
 
-
-int Parallaction_br::guiShowMenu() {
-	// TODO: filter menu entries according to progress in game
-
 	#define NUM_MENULINES	7
 	GfxObj *_lines[NUM_MENULINES];
 
-	const char *menuStrings[NUM_MENULINES] = {
-		"SEE INTRO",
-		"NEW GAME",
-		"SAVED GAME",
-		"EXIT TO DOS",
-		"PART 2",
-		"PART 3",
-		"PART 4"
-	};
+	static const char *_menuStrings[NUM_MENULINES];
+	static const MenuOptions _options[NUM_MENULINES];
 
-	MenuOptions options[NUM_MENULINES] = {
-		kMenuPart0,
-		kMenuPart1,
-		kMenuLoadGame,
-		kMenuQuit,
-		kMenuPart2,
-		kMenuPart3,
-		kMenuPart4
-	};
+	int _availItems;
+	int _selection;
 
-	_gfx->clearScreen();
-	_gfx->setBackground(kBackgroundSlide, "tbra", 0, 0);
-	if (getPlatform() == Common::kPlatformPC) {
-		_gfx->_backgroundInfo.x = 20;
-		_gfx->_backgroundInfo.y = 50;
+	void cleanup() {
+		_vm->_system->showMouse(false);
+		_vm->hideDialogueStuff();
+
+		for (int i = 0; i < _availItems; i++) {
+			delete _lines[i];
+		}
 	}
 
-	int availItems = 4 + _progress;
+	void performChoice(int selectedItem) {
+		switch (selectedItem) {
+		case kMenuQuit:
+			_engineFlags |= kEngineQuit;
+			break;
 
-	// TODO: keep track of and destroy menu item frames/surfaces
+		case kMenuLoadGame:
+			warning("loadgame not yet implemented");
+			break;
 
-	int i;
-	for (i = 0; i < availItems; i++) {
-		_lines[i] = new GfxObj(0, guiRenderMenuItem(menuStrings[i]), "MenuItem");
-		uint id = _gfx->setItem(_lines[i], MENUITEMS_X, MENUITEMS_Y + MENUITEM_HEIGHT * i, 0xFF);
-		_gfx->setItemFrame(id, 0);
+		default:
+			_vm->startPart(selectedItem);
+		}
 	}
 
-	int selectedItem = -1;
+public:
+	MainMenuInputState_BR(Parallaction_br *vm, MenuInputHelper *helper) : MenuInputState("mainmenu", helper), _vm(vm)  {
+	}
 
-	setMousePointer(0);
+	virtual MenuInputState* run() {
 
-	uint32 event;
-	Common::Point p;
-	while (true) {
+		int event = _vm->_input->getLastButtonEvent();
+		if ((event == kMouseLeftUp) && _selection >= 0) {
+			cleanup();
+			performChoice(_options[_selection]);
+			return 0;
+		}
 
-		_input->readInput();
+		Common::Point p;
+		_vm->_input->getCursorPos(p);
 
-		event = _input->getLastButtonEvent();
-		if ((event == kMouseLeftUp) && selectedItem >= 0)
-			break;
-
-		_input->getCursorPos(p);
-
 		if ((p.x > MENUITEMS_X) && (p.x < (MENUITEMS_X+MENUITEM_WIDTH)) && (p.y > MENUITEMS_Y)) {
-			selectedItem = (p.y - MENUITEMS_Y) / MENUITEM_HEIGHT;
+			_selection = (p.y - MENUITEMS_Y) / MENUITEM_HEIGHT;
 
-			if (!(selectedItem < availItems))
-				selectedItem = -1;
+			if (!(_selection < _availItems))
+				_selection = -1;
 		} else
-			selectedItem = -1;
+			_selection = -1;
 
-		for (i = 0; i < availItems; i++) {
-			_gfx->setItemFrame(i, selectedItem == i ? 1 : 0);
+		for (int i = 0; i < _availItems; i++) {
+			_vm->_gfx->setItemFrame(i, _selection == i ? 1 : 0);
 		}
 
-		_gfx->updateScreen();
-		_system->delayMillis(20);
+
+		return this;
 	}
 
-	_system->showMouse(false);
-	hideDialogueStuff();
+	virtual void enter() {
+		_vm->_gfx->clearScreen();
+		_vm->_gfx->setBackground(kBackgroundSlide, "tbra", 0, 0);
+		if (_vm->getPlatform() == Common::kPlatformPC) {
+			_vm->_gfx->_backgroundInfo.x = 20;
+			_vm->_gfx->_backgroundInfo.y = 50;
+		}
 
-	for (i = 0; i < availItems; i++) {
-		delete _lines[i];
+		// TODO: load progress from savefile
+		int progress = 3;
+		_availItems = 4 + progress;
+
+		// TODO: keep track of and destroy menu item frames/surfaces
+		int i;
+		for (i = 0; i < _availItems; i++) {
+			_lines[i] = new GfxObj(0, renderMenuItem(_menuStrings[i]), "MenuItem");
+			uint id = _vm->_gfx->setItem(_lines[i], MENUITEMS_X, MENUITEMS_Y + MENUITEM_HEIGHT * i, 0xFF);
+			_vm->_gfx->setItemFrame(id, 0);
+		}
+		_selection = -1;
+		_vm->setArrowCursor();
+		_vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
 	}
 
-	return options[selectedItem];
+};
+
+const char *MainMenuInputState_BR::_menuStrings[NUM_MENULINES] = {
+	"SEE INTRO",
+	"NEW GAME",
+	"SAVED GAME",
+	"EXIT TO DOS",
+	"PART 2",
+	"PART 3",
+	"PART 4"
+};
+
+const MainMenuInputState_BR::MenuOptions MainMenuInputState_BR::_options[NUM_MENULINES] = {
+	kMenuPart0,
+	kMenuPart1,
+	kMenuLoadGame,
+	kMenuQuit,
+	kMenuPart2,
+	kMenuPart3,
+	kMenuPart4
+};
+
+
+
+
+
+
+
+void Parallaction_br::startGui() {
+	_menuHelper = new MenuInputHelper;
+	new SplashInputState0_BR(this, _menuHelper);
+	new SplashInputState1_BR(this, _menuHelper);
+	new MainMenuInputState_BR(this, _menuHelper);
+
+	_menuHelper->setState("intro0");
+	_input->_inputMode = Input::kInputModeMenu;
+
+	do {
+		_input->readInput();
+		if (!_menuHelper->run()) break;
+		_gfx->beginFrame();
+		_gfx->updateScreen();
+	} while (true);
+
+	delete _menuHelper;
+	_menuHelper = 0;
 }
 
+
+
 } // namespace Parallaction
 

Modified: scummvm/trunk/engines/parallaction/gui_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_ns.cpp	2008-07-25 06:32:38 UTC (rev 33271)
+++ scummvm/trunk/engines/parallaction/gui_ns.cpp	2008-07-25 06:35:02 UTC (rev 33272)
@@ -26,6 +26,7 @@
 #include "common/system.h"
 #include "common/hashmap.h"
 
+#include "parallaction/gui.h"
 #include "parallaction/input.h"
 #include "parallaction/parallaction.h"
 #include "parallaction/sound.h"
@@ -33,87 +34,8 @@
 
 namespace Parallaction {
 
-
-class MenuInputState;
-
-class MenuInputHelper {
-	typedef	Common::HashMap<Common::String, MenuInputState*> StateMap;
-
-	StateMap	_map;
-	MenuInputState	*_state;
-	MenuInputState *_newState;
-
-public:
-	MenuInputHelper() : _state(0) {
-	}
-
-	~MenuInputHelper();
-
-	void setState(const Common::String &name) {
-		// bootstrap routine
-		_newState = getState(name);
-		assert(_newState);
-	}
-
-	void addState(const Common::String &name, MenuInputState *state) {
-		_map.setVal(name, state);
-	}
-
-	MenuInputState *getState(const Common::String &name) {
-		return _map[name];
-	}
-
-	bool run();
-};
-
-class MenuInputState {
-
+class SplashInputState_NS : public MenuInputState {
 protected:
-	MenuInputHelper *_helper;
-
-public:
-	MenuInputState(const Common::String &name, MenuInputHelper *helper) : _helper(helper), _name(name) {
-		debugC(3, kDebugExec, "MenuInputState(%s)", name.c_str());
-		_helper->addState(name, this);
-	}
-
-	Common::String	_name;
-
-	virtual ~MenuInputState() { }
-
-	virtual MenuInputState* run() = 0;
-	virtual void enter() = 0;
-};
-
-bool MenuInputHelper::run() {
-	if (_newState == 0) {
-		debugC(3, kDebugExec, "MenuInputHelper has set NULL state");
-		return false;
-	}
-
-	if (_newState != _state) {
-		debugC(3, kDebugExec, "MenuInputHelper changing state to '%s'", _newState->_name.c_str());
-
-		_newState->enter();
-		_state = _newState;
-	}
-
-	_newState = _state->run();
-
-	return true;
-}
-
-MenuInputHelper::~MenuInputHelper() {
-	StateMap::iterator b = _map.begin();
-	for ( ; b != _map.end(); b++) {
-		delete b->_value;
-	}
-	_map.clear();
-}
-
-
-class SplashInputState : public MenuInputState {
-protected:
 	Common::String _slideName;
 	uint32 _timeOut;
 	Common::String _nextState;
@@ -122,7 +44,7 @@
 	Parallaction_ns *_vm;
 
 public:
-	SplashInputState(Parallaction_ns *vm, const Common::String &name, MenuInputHelper *helper) : MenuInputState(name, helper), _vm(vm)  {
+	SplashInputState_NS(Parallaction_ns *vm, const Common::String &name, MenuInputHelper *helper) : MenuInputState(name, helper), _vm(vm)  {
 	}
 
 	virtual MenuInputState* run() {
@@ -141,20 +63,20 @@
 	}
 };
 
-class SplashInputState0 : public SplashInputState {
+class SplashInputState0_NS : public SplashInputState_NS {
 
 public:
-	SplashInputState0(Parallaction_ns *vm, MenuInputHelper *helper) : SplashInputState(vm, "intro0", helper)  {
+	SplashInputState0_NS(Parallaction_ns *vm, MenuInputHelper *helper) : SplashInputState_NS(vm, "intro0", helper)  {
 		_slideName = "intro";
 		_timeOut = 2000;
 		_nextState = "intro1";
 	}
 };
 
-class SplashInputState1 : public SplashInputState {
+class SplashInputState1_NS : public SplashInputState_NS {
 
 public:
-	SplashInputState1(Parallaction_ns *vm, MenuInputHelper *helper) : SplashInputState(vm, "intro1", helper) {
+	SplashInputState1_NS(Parallaction_ns *vm, MenuInputHelper *helper) : SplashInputState_NS(vm, "intro1", helper) {
 		_slideName = "minintro";
 		_timeOut = 2000;
 		_nextState = "chooselanguage";
@@ -162,7 +84,7 @@
 };
 
 
-class ChooseLanguageInputState : public MenuInputState {
+class ChooseLanguageInputState_NS : public MenuInputState {
 	#define BLOCK_WIDTH		16
 	#define BLOCK_HEIGHT	24
 
@@ -192,7 +114,7 @@
 	Parallaction_ns *_vm;
 
 public:
-	ChooseLanguageInputState(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("chooselanguage", helper), _vm(vm) {
+	ChooseLanguageInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("chooselanguage", helper), _vm(vm) {
 		_allowChoice = false;
 		_nextState = "selectgame";
 
@@ -260,21 +182,21 @@
 	}
 };
 
-const Common::Rect ChooseLanguageInputState::_dosLanguageSelectBlocks[4] = {
+const Common::Rect ChooseLanguageInputState_NS::_dosLanguageSelectBlocks[4] = {
 	Common::Rect(  80, 110, 128, 180 ),	// Italian
 	Common::Rect( 129,  85, 177, 155 ),	// French
 	Common::Rect( 178,  60, 226, 130 ),	// English
 	Common::Rect( 227,  35, 275, 105 )	// German
 };
 
-const Common::Rect ChooseLanguageInputState::_amigaLanguageSelectBlocks[4] = {
+const Common::Rect ChooseLanguageInputState_NS::_amigaLanguageSelectBlocks[4] = {
 	Common::Rect(  -1,  -1,  -1,  -1 ),	// Italian: not supported by Amiga multi-lingual version
 	Common::Rect( 129,  85, 177, 155 ),	// French
 	Common::Rect( 178,  60, 226, 130 ),	// English
 	Common::Rect( 227,  35, 275, 105 )	// German
 };
 
-class SelectGameInputState : public MenuInputState {
+class SelectGameInputState_NS : public MenuInputState {
 
 	int _choice, _oldChoice;
 	Common::String _nextState[2];
@@ -287,7 +209,7 @@
 	static const char *loadGameMsg[4];
 
 public:
-	SelectGameInputState(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("selectgame", helper), _vm(vm) {
+	SelectGameInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("selectgame", helper), _vm(vm) {
 		_choice = 0;
 		_oldChoice = -1;
 
@@ -331,14 +253,14 @@
 
 };
 
-const char *SelectGameInputState::newGameMsg[4] = {
+const char *SelectGameInputState_NS::newGameMsg[4] = {
 	"NUOVO GIOCO",
 	"NEUF JEU",
 	"NEW GAME",
 	"NEUES SPIEL"
 };
 
-const char *SelectGameInputState::loadGameMsg[4] = {
+const char *SelectGameInputState_NS::loadGameMsg[4] = {
 	"GIOCO SALVATO",
 	"JEU SAUVE'",
 	"SAVED GAME",
@@ -347,12 +269,12 @@
 
 
 
-class LoadGameInputState : public MenuInputState {
+class LoadGameInputState_NS : public MenuInputState {
 	bool _result;
 	Parallaction_ns *_vm;
 
 public:
-	LoadGameInputState(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("loadgame", helper), _vm(vm) { }
+	LoadGameInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("loadgame", helper), _vm(vm) { }
 
 	virtual MenuInputState* run() {
 		if (!_result) {
@@ -368,13 +290,13 @@
 
 
 
-class NewGameInputState : public MenuInputState {
+class NewGameInputState_NS : public MenuInputState {
 	Parallaction_ns *_vm;
 
 	static const char *introMsg3[4];
 
 public:
-	NewGameInputState(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("newgame", helper), _vm(vm) {
+	NewGameInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("newgame", helper), _vm(vm) {
 	}
 
 	virtual MenuInputState* run() {
@@ -412,7 +334,7 @@
 	}
 };
 
-const char *NewGameInputState::introMsg3[4] = {
+const char *NewGameInputState_NS::introMsg3[4] = {
 	"PRESS LEFT MOUSE BUTTON",
 	"TO SEE INTRO",
 	"PRESS RIGHT MOUSE BUTTON",
@@ -421,11 +343,11 @@
 
 
 
-class StartDemoInputState : public MenuInputState {
+class StartDemoInputState_NS : public MenuInputState {
 	Parallaction_ns *_vm;
 
 public:
-	StartDemoInputState(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("startdemo", helper), _vm(vm) {
+	StartDemoInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("startdemo", helper), _vm(vm) {
 	}
 
 	virtual MenuInputState* run() {
@@ -438,7 +360,7 @@
 	}
 };
 
-class SelectCharacterInputState : public MenuInputState {
+class SelectCharacterInputState_NS : public MenuInputState {
 
 	#define PASSWORD_LEN	6
 
@@ -502,12 +424,12 @@
 
 
 public:
-	SelectCharacterInputState(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("selectcharacter", helper), _vm(vm) {
+	SelectCharacterInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("selectcharacter", helper), _vm(vm) {
 		_keys = (_vm->getPlatform() == Common::kPlatformAmiga && (_vm->getFeatures() & GF_LANG_MULT)) ? _amigaKeys : _pcKeys;
 		_block.create(BLOCK_WIDTH, BLOCK_HEIGHT, 1);
 	}
 
-	~SelectCharacterInputState() {
+	~SelectCharacterInputState_NS() {
 		_block.free();
 		_emptySlots.free();
 	}
@@ -639,40 +561,40 @@
 	}
 };
 
-const char *SelectCharacterInputState::introMsg1[4] = {
+const char *SelectCharacterInputState_NS::introMsg1[4] = {
 	"INSERISCI IL CODICE",
 	"ENTREZ CODE",
 	"ENTER CODE",
 	"GIB DEN KODE EIN"
 };
 
-const char *SelectCharacterInputState::introMsg2[4] = {
+const char *SelectCharacterInputState_NS::introMsg2[4] = {
 	"CODICE ERRATO",
 	"CODE ERRONE",
 	"WRONG CODE",
 	"GIB DEN KODE EIN"
 };
 
-const uint16 SelectCharacterInputState::_amigaKeys[][PASSWORD_LEN] = {
+const uint16 SelectCharacterInputState_NS::_amigaKeys[][PASSWORD_LEN] = {
 	{ 5, 3, 6, 2, 2, 7 },		// dino
 	{ 0, 3, 6, 2, 2, 6 },		// donna
 	{ 1, 3 ,7, 2, 4, 6 }		// dough
 };
 
-const uint16 SelectCharacterInputState::_pcKeys[][PASSWORD_LEN] = {
+const uint16 SelectCharacterInputState_NS::_pcKeys[][PASSWORD_LEN] = {
 	{ 5, 3, 6, 1, 4, 7 },		// dino
 	{ 0, 2, 8, 5, 5, 1 },		// donna
 	{ 1, 7 ,7, 2, 2, 6 }		// dough
 };
 
-const char *SelectCharacterInputState::_charStartLocation[] = {
+const char *SelectCharacterInputState_NS::_charStartLocation[] = {
 	"test.dino",
 	"test.donna",
 	"test.dough"
 };
 
 
-const Common::Rect SelectCharacterInputState::codeSelectBlocks[9] = {
+const Common::Rect SelectCharacterInputState_NS::codeSelectBlocks[9] = {
 	Common::Rect( 111, 129, 127, 153 ),		// na
 	Common::Rect( 128, 120, 144, 144 ),		// wa
 	Common::Rect( 145, 111, 161, 135 ),		// ra
@@ -684,7 +606,7 @@
 	Common::Rect( 247, 57, 263, 81 )		// ka
 };
 
-const Common::Rect SelectCharacterInputState::codeTrueBlocks[9] = {
+const Common::Rect SelectCharacterInputState_NS::codeTrueBlocks[9] = {
 	Common::Rect( 112, 130, 128, 154 ),
 	Common::Rect( 129, 121, 145, 145 ),
 	Common::Rect( 146, 112, 162, 136 ),
@@ -697,7 +619,7 @@
 };
 
 
-class ShowCreditsInputState : public MenuInputState {
+class ShowCreditsInputState_NS : public MenuInputState {
 	Parallaction_ns *_vm;
 	int	_current;
 	uint32 _startTime;
@@ -710,7 +632,7 @@
 	static const Credit _credits[6];
 
 public:
-	ShowCreditsInputState(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("showcredits", helper), _vm(vm) {
+	ShowCreditsInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("showcredits", helper), _vm(vm) {
 	}
 
 	void drawCurrentLabel() {
@@ -753,7 +675,7 @@
 	}
 };
 
-const ShowCreditsInputState::Credit ShowCreditsInputState::_credits[6] = {
+const ShowCreditsInputState_NS::Credit ShowCreditsInputState_NS::_credits[6] = {
 	{"Music and Sound Effects", "MARCO CAPRELLI"},
 	{"PC Version", "RICCARDO BALLARINO"},
 	{"Project Manager", "LOVRANO CANEPA"},
@@ -762,12 +684,12 @@
 	{"Copyright 1992 Euclidea s.r.l ITALY", "All rights reserved"}
 };
 
-class EndIntroInputState : public MenuInputState {
+class EndIntroInputState_NS : public MenuInputState {
 	Parallaction_ns *_vm;
 	bool _isDemo;
 
 public:
-	EndIntroInputState(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("endintro", helper), _vm(vm) {
+	EndIntroInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("endintro", helper), _vm(vm) {
 		_isDemo = (_vm->getFeatures() & GF_DEMO) != 0;
 	}
 
@@ -799,7 +721,7 @@
 };
 
 
-class EndPartInputState : public MenuInputState {
+class EndPartInputState_NS : public MenuInputState {
 	Parallaction_ns *_vm;
 	bool _allPartsComplete;
 
@@ -816,7 +738,7 @@
 
 
 public:
-	EndPartInputState(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("endpart", helper), _vm(vm) {
+	EndPartInputState_NS(Parallaction_ns *vm, MenuInputHelper *helper) : MenuInputState("endpart", helper), _vm(vm) {
 	}
 
 	virtual MenuInputState* run() {
@@ -860,15 +782,15 @@
 };
 
 // part completion messages
-const char *EndPartInputState::endMsg0[] = {"COMPLIMENTI!", "BRAVO!", "CONGRATULATIONS!", "PRIMA!"};
-const char *EndPartInputState::endMsg1[] = {"HAI FINITO QUESTA PARTE", "TU AS COMPLETE' CETTE AVENTURE", "YOU HAVE COMPLETED THIS PART", "DU HAST EIN ABENTEUER ERFOLGREICH"};
-const char *EndPartInputState::endMsg2[] = {"ORA COMPLETA IL RESTO ", "AVEC SUCCES.",  "NOW GO ON WITH THE REST OF", "ZU ENDE GEFUHRT"};
-const char *EndPartInputState::endMsg3[] = {"DELL' AVVENTURA",  "CONTINUE AVEC LES AUTRES", "THIS ADVENTURE", "MACH' MIT DEN ANDEREN WEITER"};
+const char *EndPartInputState_NS::endMsg0[] = {"COMPLIMENTI!", "BRAVO!", "CONGRATULATIONS!", "PRIMA!"};
+const char *EndPartInputState_NS::endMsg1[] = {"HAI FINITO QUESTA PARTE", "TU AS COMPLETE' CETTE AVENTURE", "YOU HAVE COMPLETED THIS PART", "DU HAST EIN ABENTEUER ERFOLGREICH"};
+const char *EndPartInputState_NS::endMsg2[] = {"ORA COMPLETA IL RESTO ", "AVEC SUCCES.",  "NOW GO ON WITH THE REST OF", "ZU ENDE GEFUHRT"};
+const char *EndPartInputState_NS::endMsg3[] = {"DELL' AVVENTURA",  "CONTINUE AVEC LES AUTRES", "THIS ADVENTURE", "MACH' MIT DEN ANDEREN WEITER"};
 // game completion messages
-const char *EndPartInputState::endMsg4[] = {"COMPLIMENTI!", "BRAVO!", "CONGRATULATIONS!", "PRIMA!"};
-const char *EndPartInputState::endMsg5[] = {"HAI FINITO LE TRE PARTI", "TU AS COMPLETE' LES TROIS PARTIES", "YOU HAVE COMPLETED THE THREE PARTS", "DU HAST DREI ABENTEURE ERFOLGREICH"};
-const char *EndPartInputState::endMsg6[] = {"DELL' AVVENTURA", "DE L'AVENTURE", "OF THIS ADVENTURE", "ZU ENDE GEFUHRT"};
-const char *EndPartInputState::endMsg7[] = {"ED ORA IL GRAN FINALE ", "ET MAINTENANT LE GRAND FINAL", "NOW THE GREAT FINAL", "UND YETZT DER GROSSE SCHLUSS!"};
+const char *EndPartInputState_NS::endMsg4[] = {"COMPLIMENTI!", "BRAVO!", "CONGRATULATIONS!", "PRIMA!"};
+const char *EndPartInputState_NS::endMsg5[] = {"HAI FINITO LE TRE PARTI", "TU AS COMPLETE' LES TROIS PARTIES", "YOU HAVE COMPLETED THE THREE PARTS", "DU HAST DREI ABENTEURE ERFOLGREICH"};
+const char *EndPartInputState_NS::endMsg6[] = {"DELL' AVVENTURA", "DE L'AVENTURE", "OF THIS ADVENTURE", "ZU ENDE GEFUHRT"};
+const char *EndPartInputState_NS::endMsg7[] = {"ED ORA IL GRAN FINALE ", "ET MAINTENANT LE GRAND FINAL", "NOW THE GREAT FINAL", "UND YETZT DER GROSSE SCHLUSS!"};
 
 void Parallaction_ns::startGui() {
 	_disk->selectArchive((getFeatures() & GF_DEMO) ? "disk0" : "disk1");
@@ -876,14 +798,14 @@
 	_menuHelper = new MenuInputHelper;
 	assert(_menuHelper);
 
-	new SelectGameInputState(this, _menuHelper);
-	new LoadGameInputState(this, _menuHelper);
-	new NewGameInputState(this, _menuHelper);
-	new StartDemoInputState(this, _menuHelper);
-	new SelectCharacterInputState(this, _menuHelper);
-	new ChooseLanguageInputState(this, _menuHelper);
-	new SplashInputState1(this, _menuHelper);
-	new SplashInputState0(this, _menuHelper);
+	new SelectGameInputState_NS(this, _menuHelper);
+	new LoadGameInputState_NS(this, _menuHelper);
+	new NewGameInputState_NS(this, _menuHelper);
+	new StartDemoInputState_NS(this, _menuHelper);
+	new SelectCharacterInputState_NS(this, _menuHelper);
+	new ChooseLanguageInputState_NS(this, _menuHelper);
+	new SplashInputState1_NS(this, _menuHelper);
+	new SplashInputState0_NS(this, _menuHelper);
 	_menuHelper->setState("intro0");
 
 	_input->_inputMode = Input::kInputModeMenu;
@@ -893,9 +815,9 @@
 	_menuHelper = new MenuInputHelper;
 	assert(_menuHelper);
 
-	new ShowCreditsInputState(this, _menuHelper);
-	new EndIntroInputState(this, _menuHelper);
-	new SelectCharacterInputState(this, _menuHelper);
+	new ShowCreditsInputState_NS(this, _menuHelper);
+	new EndIntroInputState_NS(this, _menuHelper);
+	new SelectCharacterInputState_NS(this, _menuHelper);
 	_menuHelper->setState("showcredits");
 
 	_input->_inputMode = Input::kInputModeMenu;
@@ -905,46 +827,12 @@
 	_menuHelper = new MenuInputHelper;
 	assert(_menuHelper);
 
-	new EndPartInputState(this, _menuHelper);
-	new SelectCharacterInputState(this, _menuHelper);
+	new EndPartInputState_NS(this, _menuHelper);
+	new SelectCharacterInputState_NS(this, _menuHelper);
 	_menuHelper->setState("endpart");
 
 	_input->_inputMode = Input::kInputModeMenu;
 }
 
 
-void Parallaction::runGuiFrame() {
-	if (_input->_inputMode != Input::kInputModeMenu) {
-		return;
-	}
-
-	if (!_menuHelper) {
-		error("No menu helper defined!");
-	}
-
-	bool res = _menuHelper->run();
-
-	if (!res) {
-		cleanupGui();
-		_input->_inputMode = Input::kInputModeGame;
-	}
-
-}
-
-void Parallaction::cleanupGui() {
-	delete _menuHelper;
-	_menuHelper = 0;
-}
-
-void Parallaction::setInternLanguage(uint id) {
-	//TODO: assert id!
-
-	_language = id;
-	_disk->setLanguage(id);
-}
-
-uint Parallaction::getInternLanguage() {
-	return _language;
-}
-
 } // namespace Parallaction

Modified: scummvm/trunk/engines/parallaction/module.mk
===================================================================
--- scummvm/trunk/engines/parallaction/module.mk	2008-07-25 06:32:38 UTC (rev 33271)
+++ scummvm/trunk/engines/parallaction/module.mk	2008-07-25 06:35:02 UTC (rev 33272)
@@ -14,6 +14,7 @@
 	font.o \
 	gfxbase.o \
 	graphics.o \
+	gui.o \
 	gui_br.o \
 	gui_ns.o \
 	input.o \

Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h	2008-07-25 06:32:38 UTC (rev 33271)
+++ scummvm/trunk/engines/parallaction/parallaction.h	2008-07-25 06:35:02 UTC (rev 33272)
@@ -638,7 +638,8 @@
 	int32		_counters[32];
 
 	uint32		_zoneFlags[NUM_LOCATIONS][NUM_ZONES];
-
+	void		startPart(uint part);
+	void 		setArrowCursor();
 private:
 	LocationParser_br		*_locationParser;
 	ProgramParser_br		*_programParser;
@@ -647,7 +648,6 @@
 	void		initFonts();
 	void		freeFonts();
 
-	void setArrowCursor();
 	void setInventoryCursor(int pos);
 
 	void		changeLocation(char *location);
@@ -655,7 +655,6 @@
 
 	void		initPart();
 	void		freePart();
-	void		startPart();
 
 	void setMousePointer(int16 index);
 	void initCursors();
@@ -668,10 +667,7 @@
 
 	static const char *_partNames[];
 
-	void guiStart();
-	int guiShowMenu();
-	void guiSplash(const char *name);
-	Frames* guiRenderMenuItem(const char *text);
+	void startGui();
 
 	static const Callable _dosCallables[6];
 

Modified: scummvm/trunk/engines/parallaction/parallaction_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-07-25 06:32:38 UTC (rev 33271)
+++ scummvm/trunk/engines/parallaction/parallaction_br.cpp	2008-07-25 06:35:02 UTC (rev 33272)
@@ -109,16 +109,10 @@
 
 int Parallaction_br::go() {
 
-	guiSplash("dyna");
-	guiSplash("core");
+	startGui();
 
 	while ((_engineFlags & kEngineQuit) == 0) {
 
-		guiStart();
-
-		if (_engineFlags & kEngineQuit)
-			return 0;
-
 //		initCharacter();
 
 		_input->_inputMode = Input::kInputModeGame;
@@ -195,7 +189,9 @@
 	_countersNames = 0;
 }
 
-void Parallaction_br::startPart() {
+void Parallaction_br::startPart(uint part) {
+	_part = part;
+	_disk->selectArchive(_partNames[_part]);
 
 	initPart();
 
@@ -320,9 +316,9 @@
 
 
 void Parallaction_br::setArrowCursor() {
-
-
-
+	// TODO: choose the pointer depending on the active character
+	// For now, defaults to 0, that corresponds to the default in the original
+	setMousePointer(0);
 }
 
 void Parallaction_br::setInventoryCursor(int pos) {


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