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

lordhoto at users.sourceforge.net lordhoto at users.sourceforge.net
Mon Sep 24 22:26:28 CEST 2007


Revision: 29093
          http://scummvm.svn.sourceforge.net/scummvm/?rev=29093&view=rev
Author:   lordhoto
Date:     2007-09-24 13:26:27 -0700 (Mon, 24 Sep 2007)

Log Message:
-----------
- reworked input handling
- implement changing movement destination while moving

Modified Paths:
--------------
    scummvm/trunk/engines/kyra/kyra_v2.cpp
    scummvm/trunk/engines/kyra/kyra_v2.h
    scummvm/trunk/engines/kyra/scene_v2.cpp

Modified: scummvm/trunk/engines/kyra/kyra_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.cpp	2007-09-24 20:02:08 UTC (rev 29092)
+++ scummvm/trunk/engines/kyra/kyra_v2.cpp	2007-09-24 20:26:27 UTC (rev 29093)
@@ -278,13 +278,18 @@
 	_quitFlag = false;
 	while (!_quitFlag) {
 		//XXX
+
 		int inputFlag = checkInput(0/*dword_324C5*/);
+		removeInputTop();
+
 		update();
+
 		if (inputFlag == 198 || inputFlag == 199) {
 			_unk3 = _handItemSet;
 			Common::Point mouse = getMousePos();
 			handleInput(mouse.x, mouse.y);
 		}
+
 		//XXX
 	}
 }
@@ -353,6 +358,8 @@
 }
 
 int KyraEngine_v2::update() {
+	updateInput();
+
 	refreshAnimObjectsIfNeed();
 	updateMouse();
 	updateSpecialSceneScripts();
@@ -362,6 +369,7 @@
 	//sub_1574C();
 	//XXX
 	_screen->updateScreen();
+
 	return 0;
 }
 
@@ -474,10 +482,22 @@
 	}
 }
 
+void KyraEngine_v2::updateInput() {
+	Common::Event event;
+
+	while (_eventMan->pollEvent(event))
+		_eventList.push_back(event);
+}
+
 int KyraEngine_v2::checkInput(void *p) {
-	Common::Event event;
+	updateInput();
+
 	int keys = 0;
-	while (_eventMan->pollEvent(event)) {
+
+	while (_eventList.size()) {
+		Common::Event event = *_eventList.begin();
+		bool breakLoop = false;
+
 		switch (event.type) {
 		case Common::EVENT_KEYDOWN:
 			if (event.kbd.keycode == Common::KEYCODE_RETURN)
@@ -487,10 +507,12 @@
 				if (event.kbd.keycode == 'd')
 					_debugger->attach();
 			}
+			breakLoop = true;
 			break;
 
 		case Common::EVENT_LBUTTONUP:
 			keys = 198;
+			breakLoop = true;
 			break;
 
 		case Common::EVENT_QUIT:
@@ -503,12 +525,22 @@
 	
 		if (_debugger->isAttached())
 			_debugger->onFrame();
+
+		if (breakLoop)
+			break;
+
+		_eventList.erase(_eventList.begin());
 	}
 	
 	_system->delayMillis(10);
 	return keys;
 }
 
+void KyraEngine_v2::removeInputTop() {
+	if (_eventList.begin() != _eventList.end())
+		_eventList.erase(_eventList.begin());
+}
+
 void KyraEngine_v2::cleanup() {
 	delete [] _gamePlayBuffer;
 	delete [] _unkBuf500Bytes;

Modified: scummvm/trunk/engines/kyra/kyra_v2.h
===================================================================
--- scummvm/trunk/engines/kyra/kyra_v2.h	2007-09-24 20:02:08 UTC (rev 29092)
+++ scummvm/trunk/engines/kyra/kyra_v2.h	2007-09-24 20:26:27 UTC (rev 29093)
@@ -30,6 +30,8 @@
 #include "kyra/script.h"
 #include "kyra/screen_v2.h"
 
+#include "common/list.h"
+
 namespace Kyra {
 
 enum kSequences {
@@ -165,9 +167,15 @@
 	void updateMouse();
 	
 	int checkInput(void *p);
+	void removeInputTop();
 	void handleInput(int x, int y);
-	
+
 	int inputSceneChange(int x, int y, int unk1, int unk2);
+
+	// - Input
+	void updateInput();
+
+	Common::List<Common::Event> _eventList;
 	
 	// gfx/animation specific
 	uint8 *_gamePlayBuffer;

Modified: scummvm/trunk/engines/kyra/scene_v2.cpp
===================================================================
--- scummvm/trunk/engines/kyra/scene_v2.cpp	2007-09-24 20:02:08 UTC (rev 29092)
+++ scummvm/trunk/engines/kyra/scene_v2.cpp	2007-09-24 20:26:27 UTC (rev 29093)
@@ -271,6 +271,11 @@
 		if (ret)
 			++moveTable;
 
+		// TODO: check this again
+		int inputFlag = checkInput(0/*dword_324C5*/);
+		if (inputFlag == 198 || inputFlag == 199)
+			break;
+
 		++updateType;
 		if (!updateType) {
 			update();


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