[Scummvm-cvs-logs] scummvm master -> 80c90a569eb06f6a12ca0f0f256d0cbb028f19be

dreammaster dreammaster at scummvm.org
Thu Apr 28 11:16:11 CEST 2011


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
80c90a569e TSAGE: Added code to handle visual differences in Demo help dialog


Commit: 80c90a569eb06f6a12ca0f0f256d0cbb028f19be
    https://github.com/scummvm/scummvm/commit/80c90a569eb06f6a12ca0f0f256d0cbb028f19be
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2011-04-28T02:14:37-07:00

Commit Message:
TSAGE: Added code to handle visual differences in Demo help dialog

Changed paths:
    engines/tsage/core.cpp
    engines/tsage/dialogs.cpp
    engines/tsage/events.cpp
    engines/tsage/events.h
    engines/tsage/globals.cpp
    engines/tsage/staticres.cpp
    engines/tsage/staticres.h
    engines/tsage/tsage.cpp



diff --git a/engines/tsage/core.cpp b/engines/tsage/core.cpp
index e56cadb..887994f 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 ba3a11f..be9200c 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 a92cbb9..bcfff9f 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 ef0256e..90516b2 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 81a5071..2dc4107 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 46b75e3..bc85718 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 cb62272..0db349f 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 16756f5..2d3f303 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();
 






More information about the Scummvm-git-logs mailing list