[Scummvm-cvs-logs] SF.net SVN: scummvm: [31987] scummvm/trunk/engines/kyra

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Sat May 10 21:41:27 CEST 2008


Revision: 31987
          http://scummvm.svn.sourceforge.net/scummvm/?rev=31987&view=rev
Author:   lordhoto
Date:     2008-05-10 12:41:26 -0700 (Sat, 10 May 2008)

Log Message:
-----------
- Cleaned up main menu quit handling
- Moved KyraEngine_HoF delay implementation to KyraEngine_v2

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/gui.cpp
    scummvm/trunk/engines/kyra/gui.h
    scummvm/trunk/engines/kyra/kyra_hof.cpp
    scummvm/trunk/engines/kyra/kyra_hof.h
    scummvm/trunk/engines/kyra/kyra_mr.cpp
    scummvm/trunk/engines/kyra/kyra_mr.h
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.h

Modified: scummvm/trunk/engines/kyra/gui.cpp
===================================================================
--- scummvm/trunk/engines/kyra/gui.cpp	2008-05-10 19:29:13 UTC (rev 31986)
+++ scummvm/trunk/engines/kyra/gui.cpp	2008-05-10 19:41:26 UTC (rev 31987)
@@ -382,7 +382,7 @@
 	while (_system->getEventManager()->pollEvent(event)) {
 		switch (event.type) {
 		case Common::EVENT_QUIT:
-			_quitFlag = true;
+			_vm->quitGame();
 			break;
 		case Common::EVENT_LBUTTONUP:
 			return true;
@@ -396,7 +396,6 @@
 int MainMenu::handle(int dim) {
 	debugC(9, kDebugLevelMain, "MainMenu::handle(%d)", dim);
 	int command = -1;
-	_quitFlag = false;
 
 	uint8 colorMap[16];
 	memset(colorMap, 0, sizeof(colorMap));
@@ -436,7 +435,7 @@
 
 	Common::Rect menuRect(x + 16, y + 4, x + width - 16, y + 4 + fh * 4);
 
-	while (!_quitFlag) {
+	while (!_vm->quit()) {
 		updateAnimation();
 		bool mousePressed = getInput();
 
@@ -467,10 +466,8 @@
 		_system->delayMillis(10);
 	}
 
-	if (_quitFlag) {
-		_vm->quitGame();
+	if (_vm->quit())
 		command = -1;
-	}
 
 	_screen->copyRegion(backUpX, backUpY, backUpX, backUpY, backUpWidth, backUpHeight, 3, 0);
 	_screen->_charWidth = charWidthBackUp;

Modified: scummvm/trunk/engines/kyra/gui.h
===================================================================
--- scummvm/trunk/engines/kyra/gui.h	2008-05-10 19:29:13 UTC (rev 31986)
+++ scummvm/trunk/engines/kyra/gui.h	2008-05-10 19:41:26 UTC (rev 31987)
@@ -222,8 +222,6 @@
 	Screen *_screen;
 	OSystem *_system;
 
-	bool _quitFlag;
-
 	StaticData _static;
 	struct AnimIntern {
 		int curFrame;

Modified: scummvm/trunk/engines/kyra/kyra_hof.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.cpp	2008-05-10 19:29:13 UTC (rev 31986)
+++ scummvm/trunk/engines/kyra/kyra_hof.cpp	2008-05-10 19:41:26 UTC (rev 31987)
@@ -743,23 +743,6 @@
 	}
 }
 
-void KyraEngine_HoF::delay(uint32 amount, bool updateGame, bool isMainLoop) {
-	uint32 start = _system->getMillis();
-	do {
-		if (updateGame) {
-			if (_chatText)
-				updateWithText();
-			else
-				update();
-		} else {
-			updateInput();
-		}
-
-		if (amount > 0)
-			_system->delayMillis(amount > 10 ? 10 : amount);
-	} while (!skipFlag() && _system->getMillis() < start + amount && !_quitFlag);
-}
-
 void KyraEngine_HoF::cleanup() {
 	delete[] _inventoryButtons; _inventoryButtons = 0;
 

Modified: scummvm/trunk/engines/kyra/kyra_hof.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_hof.h	2008-05-10 19:29:13 UTC (rev 31986)
+++ scummvm/trunk/engines/kyra/kyra_hof.h	2008-05-10 19:41:26 UTC (rev 31987)
@@ -655,9 +655,6 @@
 
 	void setWalkspeed(uint8 speed);
 
-	// delay
-	void delay(uint32 millis, bool updateGame = false, bool isMainLoop = false);
-
 	// ingame static sequence handling
 	void seq_makeBookOrCauldronAppear(int type);
 	void seq_makeBookAppear();

Modified: scummvm/trunk/engines/kyra/kyra_mr.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_mr.cpp	2008-05-10 19:29:13 UTC (rev 31986)
+++ scummvm/trunk/engines/kyra/kyra_mr.cpp	2008-05-10 19:41:26 UTC (rev 31987)
@@ -276,6 +276,8 @@
 			delayUntil(nextRun);
 		}
 
+		_eventList.clear();
+
 		switch (_menu->handle(3)) {
 		case 2:
 			_menuDirectlyToLoad = true;
@@ -1276,19 +1278,6 @@
 	}
 }
 
-void KyraEngine_MR::delay(uint32 millis, bool doUpdate, bool isMainLoop) {
-	debugC(9, kDebugLevelMain, "KyraEngine_MR::delay(%d, %d, %d)", millis, doUpdate, isMainLoop);
-	uint32 endTime = _system->getMillis() + millis;
-	while (endTime > _system->getMillis()) {
-		if (doUpdate) {
-			//XXX
-			update();
-		}
-
-		_system->delayMillis(10);
-	}
-}
-
 #pragma mark -
 
 void KyraEngine_MR::makeCharFacingMouse() {

Modified: scummvm/trunk/engines/kyra/kyra_mr.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_mr.h	2008-05-10 19:29:13 UTC (rev 31986)
+++ scummvm/trunk/engines/kyra/kyra_mr.h	2008-05-10 19:41:26 UTC (rev 31987)
@@ -98,8 +98,6 @@
 	void updateWithText();
 	void updateMouse();
 
-	void delay(uint32 millis, bool update = false, bool isMainLoop = false);
-
 	// sound specific
 private:
 	void playMenuAudioFile();

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-05-10 19:29:13 UTC (rev 31986)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2008-05-10 19:41:26 UTC (rev 31987)
@@ -91,6 +91,25 @@
 	delete[] _screenBuffer;
 }
 
+void KyraEngine_v2::delay(uint32 amount, bool updateGame, bool isMainLoop) {
+	debugC(9, kDebugLevelMain, "KyraEngine_v2::delay(%u, %d, %d)", amount, updateGame, isMainLoop);
+
+	uint32 start = _system->getMillis();
+	do {
+		if (updateGame) {
+			if (_chatText)
+				updateWithText();
+			else
+				update();
+		} else {
+			updateInput();
+		}
+
+		if (amount > 0)
+			_system->delayMillis(amount > 10 ? 10 : amount);
+	} while (!skipFlag() && _system->getMillis() < start + amount && !_quitFlag);
+}
+
 int KyraEngine_v2::checkInput(Button *buttonList, bool mainLoop) {
 	debugC(9, kDebugLevelMain, "KyraEngine_v2::checkInput(%p, %d)", (const void*)buttonList, mainLoop);
 	updateInput();

Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h	2008-05-10 19:29:13 UTC (rev 31986)
+++ scummvm/trunk/engines/kyra/kyra_v2.h	2008-05-10 19:41:26 UTC (rev 31987)
@@ -78,6 +78,8 @@
 	virtual Screen_v2 *screen_v2() const = 0;
 	virtual GUI *gui_v2() const = 0;
 
+	void delay(uint32 time, bool update = false, bool isMainLoop = false);
+
 	const EngineDesc &engineDesc() const { return _desc; }
 protected:
 	EngineDesc _desc;


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