[Scummvm-cvs-logs] SF.net SVN: scummvm:[45283] scummvm/trunk/engines/tinsel

fingolfin at users.sourceforge.net fingolfin at users.sourceforge.net
Tue Oct 20 21:12:54 CEST 2009


Revision: 45283
          http://scummvm.svn.sourceforge.net/scummvm/?rev=45283&view=rev
Author:   fingolfin
Date:     2009-10-20 19:12:54 +0000 (Tue, 20 Oct 2009)

Log Message:
-----------
TINSEL: Move Common::List instances mouseButtons & keypresses into TinselEngine.

Global C++ objects are not portable, as their constructors / destructors may
never be called.

Modified Paths:
--------------
    scummvm/trunk/engines/tinsel/tinsel.cpp
    scummvm/trunk/engines/tinsel/tinsel.h

Modified: scummvm/trunk/engines/tinsel/tinsel.cpp
===================================================================
--- scummvm/trunk/engines/tinsel/tinsel.cpp	2009-10-20 19:12:31 UTC (rev 45282)
+++ scummvm/trunk/engines/tinsel/tinsel.cpp	2009-10-20 19:12:54 UTC (rev 45283)
@@ -123,12 +123,6 @@
 
 static SCNHANDLE hCdChangeScene;
 
-// Stack of pending mouse button events
-Common::List<Common::EventType> mouseButtons;
-
-// Stack of pending keypresses
-Common::List<Common::Event> keypresses;
-
 //----------------- LOCAL PROCEDURES --------------------
 
 /**
@@ -141,15 +135,15 @@
 
 	CORO_BEGIN_CODE(_ctx);
 	while (true) {
-		if (keypresses.empty()) {
+		if (_vm->_keypresses.empty()) {
 			// allow scheduling
 			CORO_SLEEP(1);
 			continue;
 		}
 
 		// Get the next keyboard event off the stack
-		Common::Event evt = *keypresses.begin();
-		keypresses.erase(keypresses.begin());
+		Common::Event evt = _vm->_keypresses.front();
+		_vm->_keypresses.pop_front();
 		const Common::Point mousePos = _vm->getMousePosition();
 
 		// Switch for special keys
@@ -312,15 +306,15 @@
 
 	while (true) {
 
-		if (mouseButtons.empty()) {
+		if (_vm->_mouseButtons.empty()) {
 			// allow scheduling
 			CORO_SLEEP(1);
 			continue;
 		}
 
 		// get next mouse button event
-		Common::EventType type = *mouseButtons.begin();
-		mouseButtons.erase(mouseButtons.begin());
+		Common::EventType type = _vm->_mouseButtons.front();
+		_vm->_mouseButtons.pop_front();
 
 		int xp, yp;
 		GetCursorXYNoWait(&xp, &yp, true);
@@ -1077,7 +1071,7 @@
 	case Common::EVENT_RBUTTONDOWN:
 	case Common::EVENT_RBUTTONUP:
 		// Add button to queue for the mouse process
-		mouseButtons.push_back(event.type);
+		_mouseButtons.push_back(event.type);
 		break;
 
 	case Common::EVENT_MOUSEMOVE:
@@ -1243,7 +1237,7 @@
 	}
 
 	// All other keypresses add to the queue for processing in KeyboardProcess
-	keypresses.push_back(event);
+	_keypresses.push_back(event);
 }
 
 const char *TinselEngine::getSampleIndex(LANGUAGE lang) {

Modified: scummvm/trunk/engines/tinsel/tinsel.h
===================================================================
--- scummvm/trunk/engines/tinsel/tinsel.h	2009-10-20 19:12:31 UTC (rev 45282)
+++ scummvm/trunk/engines/tinsel/tinsel.h	2009-10-20 19:12:54 UTC (rev 45283)
@@ -183,6 +183,13 @@
 	BMVPlayer *_bmv;
 
 	KEYFPTR _keyHandler;
+
+	// Stack of pending mouse button events
+	Common::List<Common::EventType> _mouseButtons;
+
+	// Stack of pending keypresses
+	Common::List<Common::Event> _keypresses;
+
 private:
 	//MidiMusicPlayer *_midiMusic;
 	int _musicVolume;


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