aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
Diffstat (limited to 'engines')
-rw-r--r--engines/tsage/core.cpp3
-rw-r--r--engines/tsage/dialogs.cpp10
-rw-r--r--engines/tsage/events.cpp61
-rw-r--r--engines/tsage/events.h3
-rw-r--r--engines/tsage/globals.cpp19
-rw-r--r--engines/tsage/staticres.cpp3
-rw-r--r--engines/tsage/staticres.h4
-rw-r--r--engines/tsage/tsage.cpp2
8 files changed, 88 insertions, 17 deletions
diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index e56cadb68a..887994f9e2 100644
--- a/engines/tsage/core.cpp
+++ b/engines/tsage/core.cpp
@@ -3449,8 +3449,7 @@ void SceneHandler::process(Event &event) {
switch (event.kbd.keycode) {
case Common::KEYCODE_F1:
// F1 - Help
- _globals->_events.setCursor(CURSOR_ARROW);
- MessageDialog::show(HELP_MSG, OK_BTN_STRING);
+ MessageDialog::show((_vm->getFeatures() & GF_DEMO) ? DEMO_HELP_MSG : HELP_MSG, OK_BTN_STRING);
break;
case Common::KEYCODE_F2: {
diff --git a/engines/tsage/dialogs.cpp b/engines/tsage/dialogs.cpp
index ba3a11f619..be9200c0c7 100644
--- a/engines/tsage/dialogs.cpp
+++ b/engines/tsage/dialogs.cpp
@@ -71,17 +71,12 @@ MessageDialog::MessageDialog(const Common::String &message, const Common::String
int MessageDialog::show(const Common::String &message, const Common::String &btn1Message, const Common::String &btn2Message) {
// Ensure that the cursor is the arrow
- CursorType currentCursor = _globals->_events.getCursor();
- if (currentCursor != CURSOR_ARROW)
- _globals->_events.setCursor(CURSOR_ARROW);
+ _globals->_events.pushCursor(CURSOR_ARROW);
_globals->_events.showCursor();
int result = show2(message, btn1Message, btn2Message);
- // If the cursor was changed, change it back
- if (currentCursor != CURSOR_ARROW)
- _globals->_events.setCursor(currentCursor);
-
+ _globals->_events.popCursor();
return result;
}
@@ -96,7 +91,6 @@ int MessageDialog::show2(const Common::String &message, const Common::String &bt
return result;
}
-
/*--------------------------------------------------------------------------*/
ConfigDialog::ConfigDialog() : GUI::OptionsDialog("", "GlobalConfig") {
diff --git a/engines/tsage/events.cpp b/engines/tsage/events.cpp
index a92cbb9df9..bcfff9fc1d 100644
--- a/engines/tsage/events.cpp
+++ b/engines/tsage/events.cpp
@@ -38,6 +38,7 @@ namespace tSage {
EventsClass::EventsClass() {
_currentCursor = CURSOR_NONE;
+ hideCursor();
_frameNumber = 0;
_priorFrameTime = 0;
_prevDelayFrame = 0;
@@ -208,6 +209,62 @@ void EventsClass::setCursor(CursorType cursorType) {
DEALLOCATE(cursor);
}
+void EventsClass::pushCursor(CursorType cursorType) {
+ const byte *cursor;
+ bool delFlag = true;
+ uint size;
+
+ switch (cursorType) {
+ case CURSOR_CROSSHAIRS:
+ // Crosshairs cursor
+ cursor = _resourceManager->getSubResource(4, 1, 6, &size);
+ break;
+
+ case CURSOR_LOOK:
+ // Look cursor
+ cursor = _resourceManager->getSubResource(4, 1, 5, &size);
+ break;
+
+ case CURSOR_USE:
+ // Use cursor
+ cursor = _resourceManager->getSubResource(4, 1, 4, &size);
+ break;
+
+ case CURSOR_TALK:
+ // Talk cursor
+ cursor = _resourceManager->getSubResource(4, 1, 3, &size);
+ break;
+
+ case CURSOR_ARROW:
+ // Arrow cursor
+ cursor = CURSOR_ARROW_DATA;
+ delFlag = false;
+ break;
+
+ case CURSOR_WALK:
+ default:
+ // Walk cursor
+ cursor = CURSOR_WALK_DATA;
+ delFlag = false;
+ break;
+ }
+
+ // Decode the cursor
+ GfxSurface s = surfaceFromRes(cursor);
+
+ Graphics::Surface surface = s.lockSurface();
+ const byte *cursorData = (const byte *)surface.getBasePtr(0, 0);
+ CursorMan.pushCursor(cursorData, surface.w, surface.h, s._centroid.x, s._centroid.y, s._transColor);
+ s.unlockSurface();
+
+ if (delFlag)
+ DEALLOCATE(cursor);
+}
+
+void EventsClass::popCursor() {
+ CursorMan.popCursor();
+}
+
void EventsClass::setCursor(Graphics::Surface &cursor, int transColor, const Common::Point &hotspot, CursorType cursorId) {
const byte *cursorData = (const byte *)cursor.getBasePtr(0, 0);
CursorMan.replaceCursor(cursorData, cursor.w, cursor.h, hotspot.x, hotspot.y, transColor);
@@ -227,6 +284,10 @@ void EventsClass::hideCursor() {
CursorMan.showMouse(false);
}
+bool EventsClass::isCursorVisible() const {
+ return CursorMan.isVisible();
+}
+
/**
* Delays the game for the specified number of frames, if necessary, from the
* previous time the delay method was called
diff --git a/engines/tsage/events.h b/engines/tsage/events.h
index ef0256e81f..90516b2353 100644
--- a/engines/tsage/events.h
+++ b/engines/tsage/events.h
@@ -82,11 +82,14 @@ public:
CursorType _currentCursor;
void setCursor(CursorType cursorType);
+ void pushCursor(CursorType cursorType);
+ void popCursor();
void setCursor(Graphics::Surface &cursor, int transColor, const Common::Point &hotspot, CursorType cursorId);
void setCursorFromFlag();
CursorType getCursor() const { return _currentCursor; }
void showCursor();
void hideCursor();
+ bool isCursorVisible() const;
bool pollEvent();
void waitForPress(int eventMask = EVENT_BUTTON_DOWN | EVENT_KEYPRESS);
diff --git a/engines/tsage/globals.cpp b/engines/tsage/globals.cpp
index 81a507102c..2dc41074e6 100644
--- a/engines/tsage/globals.cpp
+++ b/engines/tsage/globals.cpp
@@ -60,12 +60,21 @@ Globals::Globals() :
_gfxManagerInstance(_screenSurface) {
reset();
_stripNum = 0;
- _gfxFontNumber = (_vm->getFeatures() & GF_DEMO) ? 0 : 50;
- _gfxColors.background = 53;
- _gfxColors.foreground = 18;
- _fontColors.background = 51;
- _fontColors.foreground = 54;
+ if (_vm->getFeatures() & GF_DEMO) {
+ _gfxFontNumber = 0;
+ _gfxColors.background = 6;
+ _gfxColors.foreground = 0;
+ _fontColors.background = 0;
+ _fontColors.foreground = 0;
+ _dialogCenter.y = 80;
+ } else {
+ _gfxFontNumber = 50;
+ _gfxColors.background = 53;
+ _gfxColors.foreground = 18;
+ _fontColors.background = 51;
+ _fontColors.foreground = 54;
+ }
_screenSurface.setScreenSurface();
_gfxManagers.push_back(&_gfxManagerInstance);
diff --git a/engines/tsage/staticres.cpp b/engines/tsage/staticres.cpp
index 46b75e30ea..bc85718035 100644
--- a/engines/tsage/staticres.cpp
+++ b/engines/tsage/staticres.cpp
@@ -114,4 +114,7 @@ const char *SCENE6100_SWEAT = "Humans sweat, Kzin twitch their tail. What's the
const char *SCENE6100_VERY_WELL = "Very well. I will retrieve the stasis box and return the probe. \
Wait for it's return in the lander bay.";
+const char *DEMO_HELP_MSG = " Help...\rF2 - Sound Options\rF3 - Exit demo\r\rPress ENTER\rto continue";
+const char *DEMO_PAUSED_MSG = " demo is paused";
+
} // End of namespace tSage
diff --git a/engines/tsage/staticres.h b/engines/tsage/staticres.h
index cb62272735..0db349f8a7 100644
--- a/engines/tsage/staticres.h
+++ b/engines/tsage/staticres.h
@@ -79,6 +79,10 @@ extern const char *SCENE6100_SURPRISE;
extern const char *SCENE6100_SWEAT;
extern const char *SCENE6100_VERY_WELL;
+// Demo messages
+extern const char *DEMO_HELP_MSG;
+extern const char *DEMO_PAUSED_MSG;
+
} // End of namespace tSage
#endif
diff --git a/engines/tsage/tsage.cpp b/engines/tsage/tsage.cpp
index 16756f59fa..2d3f303d34 100644
--- a/engines/tsage/tsage.cpp
+++ b/engines/tsage/tsage.cpp
@@ -94,8 +94,6 @@ Common::Error TSageEngine::run() {
// Basic initialisation
initialise();
- _globals->_events.showCursor();
-
_globals->_sceneHandler.registerHandler();
_globals->_game->execute();