aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-10-20 19:12:54 +0000
committerMax Horn2009-10-20 19:12:54 +0000
commit91ba886e012da48ec1e676ed4aa859fab87068a8 (patch)
tree33c285d8f4720b5a532bf4a0736f5d244487a7d2
parentc5c12130f5b88e69f5ee7e6f0f1d58d65fbbbd27 (diff)
downloadscummvm-rg350-91ba886e012da48ec1e676ed4aa859fab87068a8.tar.gz
scummvm-rg350-91ba886e012da48ec1e676ed4aa859fab87068a8.tar.bz2
scummvm-rg350-91ba886e012da48ec1e676ed4aa859fab87068a8.zip
TINSEL: Move Common::List instances mouseButtons & keypresses into TinselEngine.
Global C++ objects are not portable, as their constructors / destructors may never be called. svn-id: r45283
-rw-r--r--engines/tinsel/tinsel.cpp22
-rw-r--r--engines/tinsel/tinsel.h7
2 files changed, 15 insertions, 14 deletions
diff --git a/engines/tinsel/tinsel.cpp b/engines/tinsel/tinsel.cpp
index 6a557f5d3d..320eb495d5 100644
--- a/engines/tinsel/tinsel.cpp
+++ b/engines/tinsel/tinsel.cpp
@@ -123,12 +123,6 @@ static PROCESS *pKeyboardProcess = 0;
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 @@ void KeyboardProcess(CORO_PARAM, const void *) {
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 @@ static void MouseProcess(CORO_PARAM, const void *) {
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 @@ bool TinselEngine::pollEvent() {
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 @@ void TinselEngine::ProcessKeyEvent(const Common::Event &event) {
}
// 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) {
diff --git a/engines/tinsel/tinsel.h b/engines/tinsel/tinsel.h
index e55f7b8f18..8fff4985b8 100644
--- a/engines/tinsel/tinsel.h
+++ b/engines/tinsel/tinsel.h
@@ -183,6 +183,13 @@ public:
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;