aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnaud Boutonné2010-12-01 20:11:24 +0000
committerArnaud Boutonné2010-12-01 20:11:24 +0000
commit85d42c405d97b24609f1c6e6b4a73b10b6c0d40a (patch)
tree53885161a350cb009d85b31f2cc3ead739165fd8
parentd5a4f554af1bcbccfb31ef5a8e51307bb745f035 (diff)
downloadscummvm-rg350-85d42c405d97b24609f1c6e6b4a73b10b6c0d40a.tar.gz
scummvm-rg350-85d42c405d97b24609f1c6e6b4a73b10b6c0d40a.tar.bz2
scummvm-rg350-85d42c405d97b24609f1c6e6b4a73b10b6c0d40a.zip
HUGO: Use cursorman, add a windows-looking cursor
Cursor copied from Mohawk engine, thanks clone2727 svn-id: r54717
-rw-r--r--engines/hugo/display.h42
-rw-r--r--engines/hugo/hugo.cpp15
2 files changed, 49 insertions, 8 deletions
diff --git a/engines/hugo/display.h b/engines/hugo/display.h
index 3daffd3b33..61f812a0f2 100644
--- a/engines/hugo/display.h
+++ b/engines/hugo/display.h
@@ -44,6 +44,48 @@ struct rect_t { // Rectangle used in Display
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);
diff --git a/engines/hugo/hugo.cpp b/engines/hugo/hugo.cpp
index a270ec773e..d1911301ec 100644
--- a/engines/hugo/hugo.cpp
+++ b/engines/hugo/hugo.cpp
@@ -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 @@ Common::Error HugoEngine::run() {
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 @@ void HugoEngine::runMachine() {
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 @@ void HugoEngine::runMachine() {
}
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 @@ void HugoEngine::initialize() {
_rnd = new Common::RandomSource();
g_eventRec.registerRandomSource(*_rnd, "hugo");
-
_rnd->setSeed(42); // Kick random number generator
switch (_gameVariant) {