[Scummvm-cvs-logs] SF.net SVN: scummvm: [32971] scummvm/branches/gsoc2008-rtl

cpage88 at users.sourceforge.net cpage88 at users.sourceforge.net
Wed Jul 9 04:27:06 CEST 2008


Revision: 32971
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32971&view=rev
Author:   cpage88
Date:     2008-07-08 19:27:05 -0700 (Tue, 08 Jul 2008)

Log Message:
-----------
Reimplemented pushEvent() and artificialEventQueue to work with Events instead of EventTypes. Reimplemented Queue as a List instead of Array. Updated AGOS, AGI, CINE, GOB, and KYRA to work with the current implementation of the GMM

Modified Paths:
--------------
    scummvm/branches/gsoc2008-rtl/backends/events/default/default-events.cpp
    scummvm/branches/gsoc2008-rtl/backends/events/default/default-events.h
    scummvm/branches/gsoc2008-rtl/common/events.h
    scummvm/branches/gsoc2008-rtl/common/list.h
    scummvm/branches/gsoc2008-rtl/common/queue.h
    scummvm/branches/gsoc2008-rtl/engines/agi/cycle.cpp
    scummvm/branches/gsoc2008-rtl/engines/agi/loader_v3.cpp
    scummvm/branches/gsoc2008-rtl/engines/agi/op_cmd.cpp
    scummvm/branches/gsoc2008-rtl/engines/agi/op_test.cpp
    scummvm/branches/gsoc2008-rtl/engines/agi/preagi_common.cpp
    scummvm/branches/gsoc2008-rtl/engines/agi/preagi_mickey.cpp
    scummvm/branches/gsoc2008-rtl/engines/agi/preagi_troll.cpp
    scummvm/branches/gsoc2008-rtl/engines/agi/preagi_winnie.cpp
    scummvm/branches/gsoc2008-rtl/engines/agi/saveload.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/agos.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/event.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/gfx.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/input.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/script.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/script_e1.cpp
    scummvm/branches/gsoc2008-rtl/engines/agos/script_s1.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/anim.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/main_loop.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/prc.cpp
    scummvm/branches/gsoc2008-rtl/engines/cine/various.cpp
    scummvm/branches/gsoc2008-rtl/engines/dialogs.cpp
    scummvm/branches/gsoc2008-rtl/engines/engine.cpp
    scummvm/branches/gsoc2008-rtl/engines/engine.h
    scummvm/branches/gsoc2008-rtl/engines/gob/game_v1.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/game_v2.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/gob.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/gob.h
    scummvm/branches/gsoc2008-rtl/engines/gob/inter.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/inter_bargon.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/inter_v1.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/inter_v2.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/mult.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/palanim.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/util.cpp
    scummvm/branches/gsoc2008-rtl/engines/gob/videoplayer.cpp
    scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_v1.cpp

Modified: scummvm/branches/gsoc2008-rtl/backends/events/default/default-events.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/events/default/default-events.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/backends/events/default/default-events.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -354,7 +354,7 @@
 	bool result;
 
 	if (!artificialEventQueue.empty()) {
-		event.type = artificialEventQueue.pop();
+		event = artificialEventQueue.pop();
 		result = true;
 	} else 	
 		result = _boss->pollEvent(event);
@@ -393,8 +393,11 @@
 #endif
 			// Global Main Menu
 			if (event.kbd.keycode == Common::KEYCODE_F11)
-				if (g_engine && !g_engine->isPaused())
-					pushEvent(Common::EVENT_MAINMENU);
+				if (g_engine && !g_engine->isPaused()) {
+					Common::Event menuEvent;
+					menuEvent.type = Common::EVENT_MAINMENU;
+					pushEvent(menuEvent);
+				}
 			break;
 
 		case Common::EVENT_KEYUP:
@@ -472,8 +475,8 @@
 	return result;
 }
 
-void DefaultEventManager::pushEvent(Common::EventType eventType) {
-	artificialEventQueue.push(eventType);
+void DefaultEventManager::pushEvent(Common::Event event) {
+	artificialEventQueue.push(event);
 }
 
 #endif // !defined(DISABLE_DEFAULT_EVENTMANAGER)

Modified: scummvm/branches/gsoc2008-rtl/backends/events/default/default-events.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/backends/events/default/default-events.h	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/backends/events/default/default-events.h	2008-07-09 02:27:05 UTC (rev 32971)
@@ -108,7 +108,7 @@
 	~DefaultEventManager();
 
 	virtual bool pollEvent(Common::Event &event);
-	virtual void pushEvent(Common::EventType eventType);
+	virtual void pushEvent(Common::Event event);
 	virtual void registerRandomSource(Common::RandomSource &rnd, const char *name);
 	virtual void processMillis(uint32 &millis);
 

Modified: scummvm/branches/gsoc2008-rtl/common/events.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/common/events.h	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/common/events.h	2008-07-09 02:27:05 UTC (rev 32971)
@@ -149,7 +149,7 @@
 	/**
 	 * Pushes a "fake" event of the specified type into the event queue
 	 */
-	virtual void pushEvent(Common::EventType eventType) = 0;
+	virtual void pushEvent(Common::Event event) = 0;
 
 	/** Register random source so it can be serialized in game test purposes **/
 	virtual void registerRandomSource(Common::RandomSource &rnd, const char *name) = 0;
@@ -200,7 +200,7 @@
 	// replacing it by a generic getScreenChangeID method here
 protected:
 
-	Common::Queue<Common::EventType> artificialEventQueue;
+	Common::Queue<Common::Event> artificialEventQueue;
 };
 
 } // End of namespace Common

Modified: scummvm/branches/gsoc2008-rtl/common/list.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/common/list.h	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/common/list.h	2008-07-09 02:27:05 UTC (rev 32971)
@@ -209,7 +209,12 @@
 				++i;
 	}
 
+	void pop_front() {
+		iterator i = begin();
+		i = erase(i);
+	}
 
+
 	List<t_T> &operator=(const List<t_T> &list) {
 		if (this != &list) {
 			iterator i;

Modified: scummvm/branches/gsoc2008-rtl/common/queue.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/common/queue.h	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/common/queue.h	2008-07-09 02:27:05 UTC (rev 32971)
@@ -26,7 +26,7 @@
 #define COMMON_QUEUE_H
 
 #include "common/scummsys.h"
-#include "common/array.h"
+#include "common/list.h"
 
 namespace Common {
 
@@ -36,10 +36,10 @@
 template<class T>
 class Queue {
 protected:
-	Array<T>	_queue;
+	List<T>		_queue;
 public:
 	Queue<T>() {}
-	Queue<T>(const Array<T> &queueContent) : _queue(queueContent) {}
+	Queue<T>(const List<T> &queueContent) : _queue(queueContent) {}
 
 	bool empty() const {
 		return _queue.empty();
@@ -51,23 +51,19 @@
 		_queue.push_back(x);
 	}
 	T back() const {
-		const int s = size();
-		return _queue[s - 1];
+		return _queue.reverse_begin().operator*();
 	}
 	T front() const {
-		return _queue[0];
+		return _queue.begin().operator*();
 	}
 	T pop() {
 		T tmp = front();
-		_queue.remove_at(0);
+		_queue.pop_front();
 		return tmp;
 	}
 	int size() const {
 		return _queue.size();
 	}
-	T operator[](int i) {
-		return _queue[i];
-	}
 };
 
 } // End of namespace Common

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/cycle.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/cycle.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/cycle.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -117,7 +117,7 @@
 	oldSound = getflag(fSoundOn);
 
 	_game.exitAllLogics = false;
-	while (runLogic(0) == 0 && !_eventMan->shouldQuit()) {
+	while (runLogic(0) == 0 && !quit()) {
 		_game.vars[vWordNotFound] = 0;
 		_game.vars[vBorderTouchObj] = 0;
 		_game.vars[vBorderCode] = 0;
@@ -354,10 +354,10 @@
 			_game.vars[vKey] = 0;
 		}
 
-		if (_eventMan->shouldQuit() == 0xff)
+		if (quit() == 0xff)
 			ec = errRestartGame;
 
-	} while (_eventMan->shouldQuit() == 0);
+	} while (quit() == 0);
 
 	_sound->stopSound();
 

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/loader_v3.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/loader_v3.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/loader_v3.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -231,8 +231,8 @@
 			debugC(3, kDebugLevelResources, "offset = %d", agid->offset);
 			debugC(3, kDebugLevelResources, "x = %x %x", x[0], x[1]);
 			error("ACK! BAD RESOURCE");
-
-			g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
+			
+			_vm->quitGame();
 		}
 
 		agid->len = READ_LE_UINT16((uint8 *) x + 3);	/* uncompressed size */

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/op_cmd.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/op_cmd.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/op_cmd.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -1215,11 +1215,11 @@
 
 	g_sound->stopSound();
 	if (p0) {
-		g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
+		g_agi->quitGame();
 	} else {
 		if (g_agi->selectionBox
 				(" Quit the game, or continue? \n\n\n", buttons) == 0) {
-			g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
+			g_agi->quitGame();
 		}
 	}
 }
@@ -1233,7 +1233,7 @@
 		g_agi->selectionBox(" Restart game, or continue? \n\n\n", buttons);
 
 	if (sel == 0) {
-		g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
+		g_agi->quitGame();
 		g_agi->setflag(fRestartGame, true);
 		g_agi->_menu->enableAll();
 	}
@@ -1741,7 +1741,7 @@
 	curLogic->cIP = curLogic->sIP;
 
 	timerHack = 0;
-	while (ip < _game.logics[n].size && !_eventMan->shouldQuit()) {
+	while (ip < _game.logics[n].size && !quit()) {
 		if (_debug.enabled) {
 			if (_debug.steps > 0) {
 				if (_debug.logic0 || n) {

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/op_test.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/op_test.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/op_test.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -233,7 +233,7 @@
 	uint8 p[16] = { 0 };
 	bool end_test = false;
 
-	while (retval && !_eventMan->shouldQuit() && !end_test) {
+	while (retval && !quit() && !end_test) {
 		if (_debug.enabled && (_debug.logic0 || lognum))
 			debugConsole(lognum, lTEST_MODE, NULL);
 

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/preagi_common.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/preagi_common.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/preagi_common.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -122,7 +122,7 @@
 int PreAgiEngine::getSelection(SelectionTypes type) {
 	Common::Event event;
 
-	while (!_eventMan->shouldQuit()) {
+	while (!quit()) {
 		while (_eventMan->pollEvent(event)) {
 			switch(event.type) {
 			case Common::EVENT_QUIT:

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/preagi_mickey.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/preagi_mickey.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/preagi_mickey.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -343,7 +343,7 @@
 
 	drawMenu(menu, *sel0, *sel1);
 
-	while (!_vm->_system->getEventManager()->shouldQuit()) {
+	while (!_vm->quit()) {
 		while (_vm->_system->getEventManager()->pollEvent(event)) {
 			switch(event.type) {
 			case Common::EVENT_QUIT:
@@ -2151,7 +2151,7 @@
 	intro();
 
 	// Game loop
-	while (!_vm->_system->getEventManager()->shouldQuit()) {
+	while (!_vm->quit()) {
 		drawRoom();
 
 		if (_game.fIntro) {

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/preagi_troll.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/preagi_troll.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/preagi_troll.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -58,7 +58,7 @@
 
 	drawMenu(szMenu, *iSel);
 
-	while (!_vm->_system->getEventManager()->shouldQuit()) {
+	while (!_vm->quit()) {
 		while (_vm->_system->getEventManager()->pollEvent(event)) {
 			switch(event.type) {
 			case Common::EVENT_QUIT:
@@ -268,7 +268,7 @@
 	int iSel = 0;
 	//char szTreasure[16] = {0};
 
-	while (!_vm->_system->getEventManager()->shouldQuit()) {
+	while (!_vm->quit()) {
 		_vm->clearScreen(0xFF);
 
 		_vm->printStr(IDS_TRO_TUTORIAL_0);

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/preagi_winnie.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/preagi_winnie.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/preagi_winnie.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -241,7 +241,7 @@
 	// extract header from buffer
 	parseRoomHeader(&hdr, buffer, sizeof(WTP_ROOM_HDR));
 
-	while (!_vm->_system->getEventManager()->shouldQuit()) {
+	while (!_vm->quit()) {
 		pc = startpc;
 
 		// check if block is to be run
@@ -797,7 +797,7 @@
 	// Show the mouse cursor for the menu
 	CursorMan.showMouse(true);
 
-	while (!_vm->_system->getEventManager()->shouldQuit()) {
+	while (!_vm->quit()) {
 		while (_vm->_system->getEventManager()->pollEvent(event)) {
 			switch(event.type) {
 			case Common::EVENT_QUIT:
@@ -1013,7 +1013,7 @@
 		if (parser(hdr.ofsDesc[iBlock] - _roomOffset, iBlock, roomdata) == IDI_WTP_PAR_BACK)
 			goto phase1;
 	}
-	while (!_vm->_system->getEventManager()->shouldQuit()) {
+	while (!_vm->quit()) {
 		for (iBlock = 0; iBlock < IDI_WTP_MAX_BLOCK; iBlock++) {
 			switch(parser(hdr.ofsBlock[iBlock] - _roomOffset, iBlock, roomdata)) {
 			case IDI_WTP_PAR_GOTO:

Modified: scummvm/branches/gsoc2008-rtl/engines/agi/saveload.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agi/saveload.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agi/saveload.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -92,7 +92,7 @@
 	out->writeSint16BE((int16)_game.lognum);
 
 	out->writeSint16BE((int16)_game.playerControl);
-	out->writeSint16BE((int16)_eventMan->shouldQuit());
+	out->writeSint16BE((int16)quit());
 	out->writeSint16BE((int16)_game.statusLine);
 	out->writeSint16BE((int16)_game.clockEnabled);
 	out->writeSint16BE((int16)_game.exitAllLogics);
@@ -283,7 +283,7 @@
 
 	_game.playerControl = in->readSint16BE();
 	if (in->readSint16BE())
-		_eventMan->pushEvent(Common::EVENT_QUIT);
+		quitGame();
 	_game.statusLine = in->readSint16BE();
 	_game.clockEnabled = in->readSint16BE();
 	_game.exitAllLogics = in->readSint16BE();

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/agos.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/agos.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/agos.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -947,7 +947,7 @@
 void AGOSEngine::pause() {
 	pauseEngine(true);
 
-	while (_pause && !_eventMan->shouldQuit()) {
+	while (_pause && !quit()) {
 		delay(1);
 		if (_keyPressed.keycode == Common::KEYCODE_p)
 			pauseEngine(false);
@@ -984,7 +984,7 @@
 		(getFeatures() & GF_DEMO)) {
 		int i;
 
-		while (!_eventMan->shouldQuit()) {
+		while (!quit()) {
 			for (i = 0; i < 4; i++) {
 				setWindowImage(3, 9902 + i);
 				debug(0, "Displaying image %d", 9902 + i);
@@ -1013,7 +1013,7 @@
 	runSubroutine101();
 	permitInput();
 
-	while (!_eventMan->shouldQuit()) {
+	while (!quit()) {
 		waitForInput();
 		handleVerbClicked(_verbHitArea);
 		delay(100);

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/event.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/event.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/event.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -142,7 +142,7 @@
 
 	cur_time = getTime() - _gameStoppedClock;
 
-	while ((te = _firstTimeStruct) != NULL && te->time <= cur_time && !_eventMan->shouldQuit()) {
+	while ((te = _firstTimeStruct) != NULL && te->time <= cur_time && !quit()) {
 		result = true;
 		_pendingDeleteTimeEvent = te;
 		invokeTimeEvent(te);
@@ -543,7 +543,7 @@
 		_system->delayMillis(this_delay);
 
 		cur = _system->getMillis();
-	} while (cur < start + amount && !_eventMan->shouldQuit());
+	} while (cur < start + amount && !quit());
 }
 
 void AGOSEngine::timer_callback() {

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/gfx.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/gfx.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/gfx.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -1264,7 +1264,7 @@
 		if (getGameType() == GType_WW && (mode == 6 || mode == 8 || mode == 9)) {
 			setWindowImage(mode, vga_res);
 		} else {
-			while (_copyScnFlag && !_eventMan->shouldQuit())
+			while (_copyScnFlag && !quit())
 				delay(1);
 
 			setWindowImage(mode, vga_res);

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/input.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/input.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/input.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -190,12 +190,12 @@
 		resetVerbs();
 	}
 
-	while (!_eventMan->shouldQuit()) {
+	while (!quit()) {
 		_lastHitArea = NULL;
 		_lastHitArea3 = NULL;
 		_dragAccept = 1;
 
-		while (!_eventMan->shouldQuit()) {
+		while (!quit()) {
 			if ((getGameType() == GType_SIMON1 || getGameType() == GType_SIMON2) &&
 					_keyPressed.keycode == Common::KEYCODE_F10)
 				displayBoxStars();

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/script.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/script.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/script.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -411,7 +411,7 @@
 
 void AGOSEngine::o_end() {
 	// 68: exit interpreter
-	_eventMan->pushEvent(Common::EVENT_QUIT);
+	quitGame();
 }
 
 void AGOSEngine::o_done() {
@@ -966,7 +966,7 @@
 int AGOSEngine::runScript() {
 	bool flag;
 
-	if (_eventMan->shouldQuit())
+	if (quit())
 		return 1;
 
 	do {
@@ -1011,7 +1011,7 @@
 			error("Invalid opcode '%d' encountered", _opcode);
 
 		executeOpcode(_opcode);
-	} while  (getScriptCondition() != flag && !getScriptReturn() && !_eventMan->shouldQuit());
+	} while  (getScriptCondition() != flag && !getScriptReturn() && !quit());
 
 	return getScriptReturn();
 }
@@ -1067,7 +1067,7 @@
 	_exitCutscene = false;
 	_rightButtonDown = false;
 
-	while (_vgaWaitFor != 0 && !_eventMan->shouldQuit()) {
+	while (_vgaWaitFor != 0 && !quit()) {
 		if (_rightButtonDown) {
 			if (_vgaWaitFor == 200 && (getGameType() == GType_FF || !getBitFlag(14))) {
 				skipSpeech();

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/script_e1.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/script_e1.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/script_e1.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -565,7 +565,7 @@
 		lobjFunc(l, "You can see ");	/* Show objects */
 	}
 	if (r && (r->flags & 4) && levelOf(i) < 10000) {
-		_eventMan->pushEvent(Common::EVENT_QUIT);
+		quitGame();
 	}
 }
 
@@ -944,7 +944,7 @@
 			windowPutChar(window, *message2);
 
 		if (confirmYesOrNo(120, 62) == 0x7FFF) {
-			_eventMan->pushEvent(Common::EVENT_QUIT);
+			quitGame();
 		} else {
 			goto restart;
 		}

Modified: scummvm/branches/gsoc2008-rtl/engines/agos/script_s1.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/agos/script_s1.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/agos/script_s1.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -345,14 +345,14 @@
 		if (isSmartphone()) {
 			if (_keyPressed.keycode) {
 				if (_keyPressed.keycode == Common::KEYCODE_RETURN)
-					_eventMan->pushEvent(Common::EVENT_QUIT);
+					quitGame();
 				else
 					break;
 			}
 		}
 #endif
 		if (_keyPressed.keycode == keyYes)
-			_eventMan->pushEvent(Common::EVENT_QUIT);
+			quitGame();
 		else if (_keyPressed.keycode == keyNo)
 			break;
 	}

Modified: scummvm/branches/gsoc2008-rtl/engines/cine/anim.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/anim.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/anim.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -732,7 +732,7 @@
 		loadSeq(resourceName, -1);
 		return;
 	} else if (strstr(resourceName, "ECHEC")) { // Echec (French) means failure
-		g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
+		g_cine->quitGame();
 		return;
 	}
 

Modified: scummvm/branches/gsoc2008-rtl/engines/cine/main_loop.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/main_loop.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/main_loop.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -61,9 +61,6 @@
 		break;
 	case Common::EVENT_MOUSEMOVE:
 		break;
-	case Common::EVENT_QUIT:
-		g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
-		break;
 	case Common::EVENT_KEYDOWN:
 		switch (event.kbd.keycode) {
 		case Common::KEYCODE_RETURN:
@@ -292,7 +289,7 @@
 			if ("quit"[menuCommandLen] == (char)di) {
 				++menuCommandLen;
 				if (menuCommandLen == 4) {
-				g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
+					quitGame();
 				}
 			} else {
 				menuCommandLen = 0;
@@ -301,7 +298,7 @@
 
 		manageEvents();
 
-	} while (!_eventMan->shouldQuit() && _danKeysPressed != 7);
+	} while (!quit() && _danKeysPressed != 7);
 
 	hideMouse();
 	g_sound->stopMusic();

Modified: scummvm/branches/gsoc2008-rtl/engines/cine/prc.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/prc.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/prc.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -54,7 +54,7 @@
 
 	// This is copy protection. Used to hang the machine
 	if (!scumm_stricmp(pPrcName, "L201.ANI")) {
-		g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
+		g_cine->quitGame();
 		return;
 	}
 

Modified: scummvm/branches/gsoc2008-rtl/engines/cine/various.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/cine/various.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/cine/various.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -756,7 +756,7 @@
 			{
 				getMouseData(mouseUpdateStatus, (uint16 *)&mouseButton, (uint16 *)&mouseX, (uint16 *)&mouseY);
 				if (!makeMenuChoice(confirmMenu, 2, mouseX, mouseY + 8, 100)) {
-					g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
+					quitGame();
 				}
 				break;
 			}

Modified: scummvm/branches/gsoc2008-rtl/engines/dialogs.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/dialogs.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/dialogs.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -107,13 +107,19 @@
 	case kAboutCmd:
 		_aboutDialog->runModal();
 		break;
-	case kRTLCmd:
-		g_system->getEventManager()->pushEvent(Common::EVENT_RTL);
+	case kRTLCmd: {
+		Common::Event eventRTL;
+		eventRTL.type = Common::EVENT_RTL;
+		g_system->getEventManager()->pushEvent(eventRTL);
 		close();
+		}	
 		break;
-	case kQuitCmd:
-		g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
+	case kQuitCmd: {
+		Common::Event eventQ;
+		eventQ.type = Common::EVENT_QUIT;
+		g_system->getEventManager()->pushEvent(eventQ);
 		close();
+		}
 		break;
 	default:
 		GlobalDialog::handleCommand(sender, cmd, data);

Modified: scummvm/branches/gsoc2008-rtl/engines/engine.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/engine.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/engine.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -246,3 +246,10 @@
 	_mixer->setVolumeForSoundType(Audio::Mixer::kSFXSoundType, soundVolumeSFX);
 	_mixer->setVolumeForSoundType(Audio::Mixer::kSpeechSoundType, soundVolumeSpeech);
 }
+
+void Engine::quitGame() {
+	Common::Event event;
+
+	event.type = Common::EVENT_QUIT;
+	_eventMan->pushEvent(event);
+}

Modified: scummvm/branches/gsoc2008-rtl/engines/engine.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/engine.h	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/engine.h	2008-07-09 02:27:05 UTC (rev 32971)
@@ -120,7 +120,7 @@
 	/**
 	 * Quit the engine, sends a Quit event to the Event Manager
 	 */
-	void quitGame() { _eventMan->pushEvent(Common::EVENT_QUIT); };
+	void quitGame();
 
 	/**
 	 * Return whether the engine is currently paused or not.

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/game_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/game_v1.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/game_v1.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -64,7 +64,7 @@
 	strcpy(savedTotName, _curTotFile);
 
 	if (skipPlay <= 0) {
-		while (!g_system->getEventManager()->shouldQuit()) {
+		while (!_vm->quit()) {
 			for (int i = 0; i < 4; i++) {
 				_vm->_draw->_fontToSprite[i].sprite = -1;
 				_vm->_draw->_fontToSprite[i].base = -1;
@@ -998,7 +998,7 @@
 		WRITE_VAR(16, 0);
 		_activeCollResId = 0;
 	}
-	while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !g_system->getEventManager()->shouldQuit());
+	while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->quit());
 
 	if (((uint16) _activeCollResId & ~0x8000) == collResId) {
 		collStackPos = 0;

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/game_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/game_v2.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/game_v2.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -71,7 +71,7 @@
 	strcpy(savedTotName, _curTotFile);
 
 	if (skipPlay <= 0) {
-		while (!g_system->getEventManager()->shouldQuit()) {
+		while (!_vm->quit()) {
 			if (_vm->_inter->_variables)
 				_vm->_draw->animateCursor(4);
 
@@ -439,7 +439,7 @@
 
 	timeKey = _vm->_util->getTimeKey();
 	while (1) {
-		if (_vm->_inter->_terminate || g_system->getEventManager()->shouldQuit()) {
+		if (_vm->_inter->_terminate || _vm->quit()) {
 			if (handleMouse)
 				_vm->_draw->blitCursor();
 			return 0;
@@ -1044,7 +1044,7 @@
 		WRITE_VAR(16, 0);
 		_activeCollResId = 0;
 	}
-	while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !g_system->getEventManager()->shouldQuit());
+	while ((_activeCollResId == 0) && !_vm->_inter->_terminate && !_vm->quit());
 
 	if ((_activeCollResId & 0xFFF) == collResId) {
 		collStackPos = 0;
@@ -1466,7 +1466,7 @@
 			key = checkCollisions(handleMouse, -300, collResId, collIndex);
 
 			if ((key != 0) || (*collResId != 0) ||
-					_vm->_inter->_terminate || g_system->getEventManager()->shouldQuit())
+					_vm->_inter->_terminate || _vm->quit())
 				break;
 
 			if (*pTotTime > 0) {
@@ -1480,7 +1480,7 @@
 		}
 
 		if ((key == 0) || (*collResId != 0) ||
-				_vm->_inter->_terminate || g_system->getEventManager()->shouldQuit())
+				_vm->_inter->_terminate || _vm->quit())
 			return 0;
 
 		switch (key) {

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/gob.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/gob.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/gob.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -114,10 +114,6 @@
 	return _eventMan->shouldRTL();
 }
 
-void GobEngine::shutdown() {
-	g_system->getEventManager()->pushEvent(Common::EVENT_QUIT);
-}
-
 const char *GobEngine::getLangDesc(int16 language) const {
 	if ((language < 0) || (language > 8))
 		language = 2;

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/gob.h
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/gob.h	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/gob.h	2008-07-09 02:27:05 UTC (rev 32971)
@@ -223,8 +223,6 @@
 	SaveLoad *_saveLoad;
 	VideoPlayer *_vidPlayer;
 
-	void shutdown();
-
 	const char *getLangDesc(int16 language) const;
 	void validateLanguage();
 	void validateVideoMode(int16 videoMode);

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/inter.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/inter.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/inter.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -250,7 +250,7 @@
 		if (executeFuncOpcode(cmd2, cmd, params))
 			return;
 
-		if (g_system->getEventManager()->shouldQuit())
+		if (_vm->quit())
 			break;
 
 		if (_break) {
@@ -270,7 +270,7 @@
 void Inter::callSub(int16 retFlag) {
 	byte block;
 
-	while (!g_system->getEventManager()->shouldQuit() && _vm->_global->_inter_execPtr &&
+	while (!_vm->quit() && _vm->_global->_inter_execPtr &&
 			(_vm->_global->_inter_execPtr != _vm->_game->_totFileData)) {
 
 		block = *_vm->_global->_inter_execPtr;

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/inter_bargon.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/inter_bargon.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/inter_bargon.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -751,7 +751,7 @@
 	for (i = 320; i >= 0; i--) {
 		_vm->_util->setScrollOffset(i, 0);
 		if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) ||
-				g_system->getEventManager()->shouldQuit()) {
+				_vm->quit()) {
 			_vm->_palAnim->fade(0, -2, 0);
 			_vm->_video->clearSurf(_vm->_draw->_frontSurface);
 			memset((char *) _vm->_draw->_vgaPalette, 0, 768);
@@ -761,7 +761,7 @@
 			break;
 		}
 	}
-	if (!g_system->getEventManager()->shouldQuit())
+	if (!_vm->quit())
 		_vm->_util->setScrollOffset(0, 0);
 	surface = 0;
 	if (VAR(57) == ((uint32) -1))
@@ -800,7 +800,7 @@
 			_vm->_util->longDelay(_vm->_util->getRandom(200));
 		}
 		if ((_vm->_game->checkKeys(&mouseX, &mouseY, &buttons, 0) == 0x11B) ||
-				g_system->getEventManager()->shouldQuit()) {
+				_vm->quit()) {
 			_vm->_sound->blasterStop(10);
 			_vm->_palAnim->fade(0, -2, 0);
 			_vm->_video->clearSurf(_vm->_draw->_frontSurface);

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/inter_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/inter_v1.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/inter_v1.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -1226,7 +1226,7 @@
 		funcBlock(1);
 		_vm->_global->_inter_execPtr = blockPtr + size + 1;
 		flag = evalBoolResult();
-	} while (!flag && !_break && !_terminate && !g_system->getEventManager()->shouldQuit());
+	} while (!flag && !_break && !_terminate && !_vm->quit());
 
 	_nestLevel[0]--;
 
@@ -1261,7 +1261,7 @@
 		} else
 			_vm->_global->_inter_execPtr += size;
 
-		if (_break || _terminate || g_system->getEventManager()->shouldQuit()) {
+		if (_break || _terminate || _vm->quit()) {
 			_vm->_global->_inter_execPtr = blockPtr;
 			_vm->_global->_inter_execPtr += size;
 			break;

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/inter_v2.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/inter_v2.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/inter_v2.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -1485,7 +1485,7 @@
 
 	curX = startX;
 	curY = startY;
-	while (!g_system->getEventManager()->shouldQuit() && ((curX != endX) || (curY != endY))) {
+	while (!_vm->quit() && ((curX != endX) || (curY != endY))) {
 		curX = stepX > 0 ? MIN(curX + stepX, (int) endX) :
 			MAX(curX + stepX, (int) endX);
 		curY = stepY > 0 ? MIN(curY + stepY, (int) endY) :

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/mult.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/mult.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/mult.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -198,7 +198,7 @@
 
 		_frame++;
 		_vm->_util->waitEndFrame();
-	} while (!stop && !stopNoClear && !g_system->getEventManager()->shouldQuit());
+	} while (!stop && !stopNoClear && !_vm->quit());
 
 	if (!stopNoClear) {
 		if (_animDataAllocated) {

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/palanim.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/palanim.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/palanim.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -133,7 +133,7 @@
 	bool stop;
 	int16 i;
 
-	if (g_system->getEventManager()->shouldQuit())
+	if (_vm->quit())
 		return;
 
 	_fadeValue = (fadeV < 0) ? -fadeV : 2;

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/util.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/util.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/util.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -72,7 +72,7 @@
 		_vm->_video->waitRetrace();
 		processInput();
 		delay(15);
-	} while (!g_system->getEventManager()->shouldQuit() &&
+	} while (!_vm->quit() &&
 	         ((g_system->getMillis() * _vm->_global->_speedFactor) < time));
 }
 

Modified: scummvm/branches/gsoc2008-rtl/engines/gob/videoplayer.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/gob/videoplayer.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/gob/videoplayer.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -570,7 +570,7 @@
 
 	_vm->_util->processInput();
 
-	if (g_system->getEventManager()->shouldQuit()) {
+	if (_vm->quit()) {
 		_primaryVideo->getVideo()->disableSound();
 		return true;
 	}

Modified: scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_v1.cpp
===================================================================
--- scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_v1.cpp	2008-07-09 02:19:57 UTC (rev 32970)
+++ scummvm/branches/gsoc2008-rtl/engines/kyra/kyra_v1.cpp	2008-07-09 02:27:05 UTC (rev 32971)
@@ -24,6 +24,7 @@
  */
 
 #include "common/config-manager.h"
+#include "common/events.h"
 
 #include "sound/mididrv.h"
 #include "sound/mixer.h"
@@ -218,7 +219,10 @@
 
 void KyraEngine_v1::quitGame() {
 	debugC(9, kDebugLevelMain, "KyraEngine_v1::quitGame()");
-	_eventMan->pushEvent(Common::EVENT_QUIT);
+	Common::Event event;
+
+	event.type = Common::EVENT_QUIT;
+	_eventMan->pushEvent(event);
 	// Nothing to do here
 }
 


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