[Scummvm-cvs-logs] SF.net SVN: scummvm:[54717] scummvm/trunk/engines/hugo

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Wed Dec 1 21:11:25 CET 2010


Revision: 54717
          http://scummvm.svn.sourceforge.net/scummvm/?rev=54717&view=rev
Author:   strangerke
Date:     2010-12-01 20:11:24 +0000 (Wed, 01 Dec 2010)

Log Message:
-----------
HUGO: Use cursorman, add a windows-looking cursor

Cursor copied from Mohawk engine, thanks clone2727

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/display.h
    scummvm/trunk/engines/hugo/hugo.cpp

Modified: scummvm/trunk/engines/hugo/display.h
===================================================================
--- scummvm/trunk/engines/hugo/display.h	2010-12-01 20:03:05 UTC (rev 54716)
+++ scummvm/trunk/engines/hugo/display.h	2010-12-01 20:11:24 UTC (rev 54717)
@@ -44,6 +44,48 @@
 	int16 dy;                                       // height
 };
 
+/**
+ * A black and white Windows-style arrow cursor (12x20).
+ * 0 = Transparent.
+ * 1 = Black (#000000 in 24-bit RGB).
+ * 2 = White (#FFFFFF in 24-bit RGB).
+ * This cursor comes from Mohawk engine.
+ */
+static const byte stdMouseCursor[] = {
+	1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+	1, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0,
+	1, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0, 0,
+	1, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0, 0,
+	1, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0, 0,
+	1, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0, 0,
+	1, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0, 0,
+	1, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0, 0,
+	1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 1, 0,
+	1, 2, 2, 2, 2, 2, 2, 1, 1, 1, 1, 1,
+	1, 2, 2, 2, 1, 2, 2, 1, 0, 0, 0, 0,
+	1, 2, 2, 1, 1, 2, 2, 1, 0, 0, 0, 0,
+	1, 2, 1, 0, 1, 1, 2, 2, 1, 0, 0, 0,
+	1, 1, 0, 0, 0, 1, 2, 2, 1, 0, 0, 0,
+	1, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0,
+	0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0, 0,
+	0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0,
+	0, 0, 0, 0, 0, 0, 0, 1, 2, 2, 1, 0,
+	0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0
+};
+
+static const byte stdMousrCursorHeight = 20;
+static const byte stdMousrCursorWidth = 12;
+
+/**
+ * RGBA-palette for the black and white arrow cursor.
+ * This palette comes from AGI engine.
+ */
+static const byte stdMouseCursorPalette[] = {
+	0x00, 0x00, 0x00,	0x00, // Black
+	0xFF, 0xFF, 0xFF,	0x00  // White
+};
+
 class Screen {
 public:
 	Screen(HugoEngine *vm);

Modified: scummvm/trunk/engines/hugo/hugo.cpp
===================================================================
--- scummvm/trunk/engines/hugo/hugo.cpp	2010-12-01 20:03:05 UTC (rev 54716)
+++ scummvm/trunk/engines/hugo/hugo.cpp	2010-12-01 20:11:24 UTC (rev 54717)
@@ -28,6 +28,7 @@
 #include "common/events.h"
 #include "common/EventRecorder.h"
 #include "common/debug-channels.h"
+#include "graphics/cursorman.h"
 
 #include "hugo/hugo.h"
 #include "hugo/global.h"
@@ -246,11 +247,10 @@
 	if (!loadHugoDat())
 		return Common::kUnknownError;
 
-	// Interesting situation: We have no cursor to show, since
-	// the DOS version had none, and the Windows version just used
-	// the windows default one. Meaning this call will just use whatever
-	// was used last, i.e. the launcher GUI cursor. What to do?
-	g_system->showMouse(true);
+	/* Use Windows-looking mouse cursor */
+	CursorMan.replaceCursorPalette(stdMouseCursorPalette, 1, ARRAYSIZE(stdMouseCursorPalette) / 4);
+	CursorMan.replaceCursor(stdMouseCursor, stdMousrCursorWidth, stdMousrCursorHeight, 1, 1, 0);
+	CursorMan.showMouse(true);
 
 	initStatus();                                   // Initialize game status
 	initConfig(INSTALL);                            // Initialize user's config
@@ -343,7 +343,7 @@
 		break;
 	case V_INTROINIT:                               // Initialization before intro begins
 		_intro->introInit();
-		g_system->showMouse(false);
+		CursorMan.showMouse(false);
 		gameStatus.viewState = V_INTRO;
 		break;
 	case V_INTRO:                                   // Do any game-dependant preamble
@@ -353,7 +353,7 @@
 		}
 		break;
 	case V_PLAY:                                    // Playing game
-		g_system->showMouse(true);
+		CursorMan.showMouse(true);
 		_parser->charHandler();                     // Process user cmd input
 		_object->moveObjects();                     // Process object movement
 		_scheduler->runScheduler();                 // Process any actions
@@ -987,7 +987,6 @@
 
 	_rnd = new Common::RandomSource();
 	g_eventRec.registerRandomSource(*_rnd, "hugo");
-
 	_rnd->setSeed(42);                              // Kick random number generator
 
 	switch (_gameVariant) {


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