aboutsummaryrefslogtreecommitdiff
path: root/engines/tsage/events.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/tsage/events.cpp')
-rw-r--r--engines/tsage/events.cpp92
1 files changed, 67 insertions, 25 deletions
diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp
index a6471dc8ab..940709c8c7 100644
--- a/engines/tsage/events.cpp
+++ b/engines/tsage/events.cpp
@@ -39,8 +39,8 @@ EventsClass::EventsClass() {
_frameNumber = 0;
_priorFrameTime = 0;
_prevDelayFrame = 0;
- _saver->addListener(this);
- _saver->addLoadNotifier(&EventsClass::loadNotifierProc);
+ g_saver->addListener(this);
+ g_saver->addLoadNotifier(&EventsClass::loadNotifierProc);
}
bool EventsClass::pollEvent() {
@@ -79,7 +79,7 @@ bool EventsClass::pollEvent() {
void EventsClass::waitForPress(int eventMask) {
Event evt;
- while (!_vm->shouldQuit() && !getEvent(evt, eventMask))
+ while (!g_vm->shouldQuit() && !getEvent(evt, eventMask))
g_system->delayMillis(10);
}
@@ -87,7 +87,7 @@ void EventsClass::waitForPress(int eventMask) {
* Standard event retrieval, which only returns keyboard and mouse clicks
*/
bool EventsClass::getEvent(Event &evt, int eventMask) {
- while (pollEvent() && !_vm->shouldQuit()) {
+ while (pollEvent() && !g_vm->shouldQuit()) {
evt.handled = false;
evt.eventType = EVENT_NONE;
evt.mousePos = _event.mouse;
@@ -143,43 +143,69 @@ void EventsClass::setCursor(CursorType cursorType) {
return;
_lastCursor = cursorType;
- _globals->clearFlag(122);
+ g_globals->clearFlag(122);
CursorMan.showMouse(true);
const byte *cursor;
bool delFlag = true;
uint size;
+ bool questionEnabled = false;
switch (cursorType) {
case CURSOR_NONE:
// No cursor
- _globals->setFlag(122);
+ g_globals->setFlag(122);
- if ((_vm->getFeatures() & GF_DEMO) || (_vm->getGameID() == GType_BlueForce)) {
+ if ((g_vm->getFeatures() & GF_DEMO) || (g_vm->getGameID() == GType_BlueForce)) {
CursorMan.showMouse(false);
return;
}
- cursor = _resourceManager->getSubResource(4, 1, 6, &size);
+ cursor = g_resourceManager->getSubResource(4, 1, 6, &size);
break;
case CURSOR_LOOK:
// Look cursor
- cursor = _resourceManager->getSubResource(4, 1, 5, &size);
+ if (g_vm->getGameID() == GType_BlueForce)
+ cursor = g_resourceManager->getSubResource(1, 5, 3, &size);
+ else
+ cursor = g_resourceManager->getSubResource(4, 1, 5, &size);
_currentCursor = CURSOR_LOOK;
break;
case CURSOR_USE:
// Use cursor
- cursor = _resourceManager->getSubResource(4, 1, 4, &size);
+ if (g_vm->getGameID() == GType_BlueForce) {
+ cursor = g_resourceManager->getSubResource(1, 5, 2, &size);
+ } else {
+ cursor = g_resourceManager->getSubResource(4, 1, 4, &size);
+ }
_currentCursor = CURSOR_USE;
break;
case CURSOR_TALK:
// Talk cursor
- cursor = _resourceManager->getSubResource(4, 1, 3, &size);
+ if (g_vm->getGameID() == GType_BlueForce) {
+ cursor = g_resourceManager->getSubResource(1, 5, 4, &size);
+ } else {
+ cursor = g_resourceManager->getSubResource(4, 1, 3, &size);
+ }
_currentCursor = CURSOR_TALK;
break;
+ case CURSOR_EXIT:
+ // Exit cursor (Blue Force)
+ assert(g_vm->getGameID() == GType_BlueForce);
+ cursor = g_resourceManager->getSubResource(1, 5, 7, &size);
+ _currentCursor = CURSOR_EXIT;
+ break;
+
+ case CURSOR_PRINTER:
+ // Printer cursor (Blue Force)
+ assert(g_vm->getGameID() == GType_BlueForce);
+ cursor = g_resourceManager->getSubResource(1, 7, 6, &size);
+ _currentCursor = CURSOR_PRINTER;
+ break;
+
case CURSOR_ARROW:
// Arrow cursor
cursor = CURSOR_ARROW_DATA;
@@ -188,10 +214,22 @@ void EventsClass::setCursor(CursorType cursorType) {
case CURSOR_WALK:
default:
- // Walk cursor
- cursor = CURSOR_WALK_DATA;
- _currentCursor = CURSOR_WALK;
- delFlag = false;
+ if (g_vm->getGameID() == GType_BlueForce) {
+ if (cursorType == CURSOR_WALK) {
+ cursor = g_resourceManager->getSubResource(1, 5, 1, &size);
+ } else {
+ // Inventory icon
+ cursor = g_resourceManager->getSubResource(10, ((int)cursorType - 1) / 20 + 1,
+ ((int)cursorType - 1) % 20 + 1, &size);
+ questionEnabled = true;
+ }
+ _currentCursor = cursorType;
+ } else {
+ // For Ringworld, always treat as the walk cursor
+ cursor = CURSOR_WALK_DATA;
+ _currentCursor = CURSOR_WALK;
+ delFlag = false;
+ }
break;
}
@@ -205,6 +243,10 @@ void EventsClass::setCursor(CursorType cursorType) {
if (delFlag)
DEALLOCATE(cursor);
+
+ // For Blue Force, enable the question button when an inventory icon is selected
+ if (g_vm->getGameID() == GType_BlueForce)
+ BF_GLOBALS._uiElements._question.setEnabled(questionEnabled);
}
void EventsClass::pushCursor(CursorType cursorType) {
@@ -215,22 +257,22 @@ void EventsClass::pushCursor(CursorType cursorType) {
switch (cursorType) {
case CURSOR_NONE:
// No cursor
- cursor = _resourceManager->getSubResource(4, 1, 6, &size);
+ cursor = g_resourceManager->getSubResource(4, 1, 6, &size);
break;
case CURSOR_LOOK:
// Look cursor
- cursor = _resourceManager->getSubResource(4, 1, 5, &size);
+ cursor = g_resourceManager->getSubResource(4, 1, 5, &size);
break;
case CURSOR_USE:
// Use cursor
- cursor = _resourceManager->getSubResource(4, 1, 4, &size);
+ cursor = g_resourceManager->getSubResource(4, 1, 4, &size);
break;
case CURSOR_TALK:
// Talk cursor
- cursor = _resourceManager->getSubResource(4, 1, 3, &size);
+ cursor = g_resourceManager->getSubResource(4, 1, 3, &size);
break;
case CURSOR_ARROW:
@@ -275,10 +317,10 @@ void EventsClass::setCursor(GfxSurface &cursor) {
Graphics::Surface s = cursor.lockSurface();
const byte *cursorData = (const byte *)s.getBasePtr(0, 0);
- CursorMan.replaceCursor(cursorData, cursor.getBounds().width(), cursor.getBounds().height(),
+ CursorMan.replaceCursor(cursorData, cursor.getBounds().width(), cursor.getBounds().height(),
cursor._centroid.x, cursor._centroid.y, cursor._transColor);
- _currentCursor = CURSOR_NONE;
+ _lastCursor = CURSOR_NONE;
}
void EventsClass::setCursorFromFlag() {
@@ -296,7 +338,7 @@ CursorType EventsClass::hideCursor() {
}
bool EventsClass::isCursorVisible() const {
- return !_globals->getFlag(122);
+ return !g_globals->getFlag(122);
}
/**
@@ -331,10 +373,10 @@ void EventsClass::listenerSynchronize(Serializer &s) {
void EventsClass::loadNotifierProc(bool postFlag) {
if (postFlag) {
- if (_globals->_events._lastCursor == CURSOR_NONE)
- _globals->_events._lastCursor = _globals->_events._currentCursor;
+ if (g_globals->_events._lastCursor == CURSOR_NONE)
+ g_globals->_events._lastCursor = g_globals->_events._currentCursor;
else
- _globals->_events._lastCursor = CURSOR_NONE;
+ g_globals->_events._lastCursor = CURSOR_NONE;
}
}