[Scummvm-cvs-logs] SF.net SVN: scummvm:[49959] scummvm/trunk/engines/sci
fingolfin at users.sourceforge.net
fingolfin at users.sourceforge.net
Fri Jun 18 01:10:37 CEST 2010
Revision: 49959
http://scummvm.svn.sourceforge.net/scummvm/?rev=49959&view=rev
Author: fingolfin
Date: 2010-06-17 23:10:37 +0000 (Thu, 17 Jun 2010)
Log Message:
-----------
SCI: Moved the event code a little bit around.
* Move sleep() from EventManager to SciEngine
* Rename EventManager methods: get -> getSciEvent, and
getFromScummVM -> getScummVMEvent
* Make scancode_rows static const
* Turn altify & numlockify from EventManager methods into static
functions (and comment out the currently unused numlockify)
Modified Paths:
--------------
scummvm/trunk/engines/sci/engine/kevent.cpp
scummvm/trunk/engines/sci/engine/kmisc.cpp
scummvm/trunk/engines/sci/engine/state.cpp
scummvm/trunk/engines/sci/event.cpp
scummvm/trunk/engines/sci/event.h
scummvm/trunk/engines/sci/graphics/cursor.cpp
scummvm/trunk/engines/sci/graphics/menu.cpp
scummvm/trunk/engines/sci/graphics/portrait.cpp
scummvm/trunk/engines/sci/sci.h
Modified: scummvm/trunk/engines/sci/engine/kevent.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kevent.cpp 2010-06-17 22:42:59 UTC (rev 49958)
+++ scummvm/trunk/engines/sci/engine/kevent.cpp 2010-06-17 23:10:37 UTC (rev 49959)
@@ -65,7 +65,7 @@
oldx = mousePos.x;
oldy = mousePos.y;
- curEvent = g_sci->getEventManager()->get(mask);
+ curEvent = g_sci->getEventManager()->getSciEvent(mask);
if (g_sci->getVocabulary())
g_sci->getVocabulary()->parser_event = NULL_REG; // Invalidate parser event
Modified: scummvm/trunk/engines/sci/engine/kmisc.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/kmisc.cpp 2010-06-17 22:42:59 UTC (rev 49958)
+++ scummvm/trunk/engines/sci/engine/kmisc.cpp 2010-06-17 23:10:37 UTC (rev 49959)
@@ -79,7 +79,7 @@
uint32 duration = curTime - s->_throttleLastTime;
if (duration < neededSleep) {
- g_sci->getEventManager()->sleep(neededSleep - duration);
+ g_sci->sleep(neededSleep - duration);
s->_throttleLastTime = g_system->getMillis();
} else {
s->_throttleLastTime = curTime;
Modified: scummvm/trunk/engines/sci/engine/state.cpp
===================================================================
--- scummvm/trunk/engines/sci/engine/state.cpp 2010-06-17 22:42:59 UTC (rev 49958)
+++ scummvm/trunk/engines/sci/engine/state.cpp 2010-06-17 23:10:37 UTC (rev 49959)
@@ -121,7 +121,7 @@
lastWaitTime = time;
ticks *= g_debug_sleeptime_factor;
- g_sci->getEventManager()->sleep(ticks * 1000 / 60);
+ g_sci->sleep(ticks * 1000 / 60);
}
void EngineState::initGlobals() {
Modified: scummvm/trunk/engines/sci/event.cpp
===================================================================
--- scummvm/trunk/engines/sci/event.cpp 2010-06-17 22:42:59 UTC (rev 49958)
+++ scummvm/trunk/engines/sci/event.cpp 2010-06-17 23:10:37 UTC (rev 49959)
@@ -44,7 +44,7 @@
EventManager::~EventManager() {
}
-struct scancode_row {
+static const struct scancode_row {
int offset;
const char *keys;
} scancode_rows[SCANCODE_ROWS_NR] = {
@@ -53,7 +53,7 @@
{0x2c, "ZXCVBNM,./"}
};
-int EventManager::altify (int ch) {
+static int altify(int ch) {
// Calculates a PC keyboard scancode from a character */
int row;
int c = toupper((char)ch);
@@ -74,7 +74,8 @@
return ch;
}
-int EventManager::numlockify (int c) {
+/*
+static int numlockify(int c) {
switch (c) {
case SCI_KEY_DELETE:
return '.';
@@ -102,6 +103,7 @@
return c; // Unchanged
}
}
+*/
static const byte codepagemap_88591toDOS[0x80] = {
'?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', '?', // 0x8x
@@ -114,7 +116,7 @@
'?', 0xa4, 0x95, 0xa2, 0x93, '?', 0x94, '?', '?', 0x97, 0xa3, 0x96, 0x81, '?', '?', 0x98 // 0xFx
};
-sciEvent EventManager::getFromScummVM() {
+sciEvent EventManager::getScummVMEvent() {
static int _modifierStates = 0; // FIXME: Avoid non-const global vars
sciEvent input = { SCI_EVENT_NONE, 0, 0, 0 };
@@ -315,7 +317,7 @@
return input;
}
-sciEvent EventManager::get(unsigned int mask) {
+sciEvent EventManager::getSciEvent(unsigned int mask) {
//sci_event_t error_event = { SCI_EVT_ERROR, 0, 0, 0 };
sciEvent event = { 0, 0, 0, 0 };
@@ -328,7 +330,7 @@
// Get all queued events from graphics driver
do {
- event = getFromScummVM();
+ event = getScummVMEvent();
if (event.type != SCI_EVENT_NONE)
_events.push_back(event);
} while (event.type != SCI_EVENT_NONE);
@@ -384,13 +386,13 @@
return event;
}
-void EventManager::sleep(uint32 msecs) {
+void SciEngine::sleep(uint32 msecs) {
uint32 time;
const uint32 wakeup_time = g_system->getMillis() + msecs;
while (true) {
// let backend process events and update the screen
- get(SCI_EVENT_PEEK);
+ _eventMan->getSciEvent(SCI_EVENT_PEEK);
time = g_system->getMillis();
if (time + 10 < wakeup_time) {
g_system->delayMillis(10);
Modified: scummvm/trunk/engines/sci/event.h
===================================================================
--- scummvm/trunk/engines/sci/event.h 2010-06-17 22:42:59 UTC (rev 49958)
+++ scummvm/trunk/engines/sci/event.h 2010-06-17 23:10:37 UTC (rev 49959)
@@ -116,15 +116,10 @@
EventManager(ResourceManager *resMgr);
~EventManager();
- sciEvent get(unsigned int mask);
+ sciEvent getSciEvent(unsigned int mask);
- void sleep(uint32 msecs);
-
private:
- int altify (int ch);
- int shiftify (int c);
- int numlockify (int c);
- sciEvent getFromScummVM();
+ sciEvent getScummVMEvent();
ResourceManager *_resMan;
Modified: scummvm/trunk/engines/sci/graphics/cursor.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/cursor.cpp 2010-06-17 22:42:59 UTC (rev 49958)
+++ scummvm/trunk/engines/sci/graphics/cursor.cpp 2010-06-17 23:10:37 UTC (rev 49959)
@@ -341,7 +341,7 @@
// Trigger event reading to make sure the mouse coordinates will
// actually have changed the next time we read them.
- _event->get(SCI_EVENT_PEEK);
+ _event->getSciEvent(SCI_EVENT_PEEK);
}
} // End of namespace Sci
Modified: scummvm/trunk/engines/sci/graphics/menu.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/menu.cpp 2010-06-17 22:42:59 UTC (rev 49958)
+++ scummvm/trunk/engines/sci/graphics/menu.cpp 2010-06-17 23:10:37 UTC (rev 49959)
@@ -705,7 +705,7 @@
_paint16->bitsShow(_menuRect);
while (true) {
- curEvent = _event->get(SCI_EVENT_ANY);
+ curEvent = _event->getSciEvent(SCI_EVENT_ANY);
switch (curEvent.type) {
case SCI_EVENT_KEYBOARD:
@@ -795,7 +795,7 @@
}
break;
case SCI_EVENT_NONE:
- _event->sleep(2500 / 1000);
+ g_sci->sleep(2500 / 1000);
break;
}
}
@@ -823,7 +823,7 @@
_paint16->bitsShow(_ports->_menuRect);
while (true) {
- curEvent = _event->get(SCI_EVENT_ANY);
+ curEvent = _event->getSciEvent(SCI_EVENT_ANY);
switch (curEvent.type) {
case SCI_EVENT_MOUSE_RELEASE:
@@ -834,7 +834,7 @@
return curItemEntry;
case SCI_EVENT_NONE:
- _event->sleep(2500 / 1000);
+ g_sci->sleep(2500 / 1000);
break;
}
Modified: scummvm/trunk/engines/sci/graphics/portrait.cpp
===================================================================
--- scummvm/trunk/engines/sci/graphics/portrait.cpp 2010-06-17 22:42:59 UTC (rev 49958)
+++ scummvm/trunk/engines/sci/graphics/portrait.cpp 2010-06-17 23:10:37 UTC (rev 49959)
@@ -182,7 +182,7 @@
// Wait till syncTime passed, then show specific animation bitmap
do {
g_sci->getEngineState()->wait(1);
- curEvent = _event->get(SCI_EVENT_ANY);
+ curEvent = _event->getSciEvent(SCI_EVENT_ANY);
if (curEvent.type == SCI_EVENT_MOUSE_PRESS ||
(curEvent.type == SCI_EVENT_KEYBOARD && curEvent.data == SCI_KEY_ESC) ||
g_engine->shouldQuit())
Modified: scummvm/trunk/engines/sci/sci.h
===================================================================
--- scummvm/trunk/engines/sci/sci.h 2010-06-17 22:42:59 UTC (rev 49958)
+++ scummvm/trunk/engines/sci/sci.h 2010-06-17 23:10:37 UTC (rev 49959)
@@ -176,6 +176,8 @@
/** Remove the 'TARGET-' prefix of the given filename, if present. */
Common::String unwrapFilename(const Common::String &name) const;
+ void sleep(uint32 msecs);
+
public:
/**
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