[Scummvm-cvs-logs] scummvm master -> 310bd54e64fef98438439c6966c7785764ca53b7
clone2727
clone2727 at gmail.com
Tue Aug 16 07:30:58 CEST 2011
This automated email contains information about 5 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
1793d92c8b GRAPHICS: Create base Cursor class for Mac/Win cursors
91ae23ebf2 GRAPHICS: Add cursor palette start/count functions
c75bf3290d GRAPHICS: Add a default Windows cursor
a18312677d MOHAWK: Use the default Windows cursor in /graphics now
310bd54e64 SCUMM: Set the default moonbase cursor to be the default Windows cursor
Commit: 1793d92c8ba7b08cc3891dcc567923eb9f5a721e
https://github.com/scummvm/scummvm/commit/1793d92c8ba7b08cc3891dcc567923eb9f5a721e
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-08-15T21:05:31-07:00
Commit Message:
GRAPHICS: Create base Cursor class for Mac/Win cursors
Changed paths:
A graphics/cursor.h
graphics/maccursor.h
graphics/wincursor.h
diff --git a/graphics/cursor.h b/graphics/cursor.h
new file mode 100644
index 0000000..9d839c1
--- /dev/null
+++ b/graphics/cursor.h
@@ -0,0 +1,58 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef GRAPHICS_CURSOR_H
+#define GRAPHICS_CURSOR_H
+
+#include "common/scummsys.h"
+
+namespace Graphics {
+
+/**
+ * A simple cursor representation
+ * TODO: Switch to using Graphics::Surface instead of a byte*
+ */
+class Cursor {
+public:
+ Cursor() {}
+ virtual ~Cursor() {}
+
+ /** Return the cursor's width. */
+ virtual uint16 getWidth() const = 0;
+ /** Return the cursor's height. */
+ virtual uint16 getHeight() const = 0;
+ /** Return the cursor's hotspot's x coordinate. */
+ virtual uint16 getHotspotX() const = 0;
+ /** Return the cursor's hotspot's y coordinate. */
+ virtual uint16 getHotspotY() const = 0;
+ /** Return the cursor's transparent key. */
+ virtual byte getKeyColor() const = 0;
+
+ /** Return the cursor's surface. */
+ virtual const byte *getSurface() const = 0;
+ /** Return the cursor's palette in RGB format. */
+ virtual const byte *getPalette() const = 0;
+};
+
+} // End of namespace Graphics
+
+#endif
diff --git a/graphics/maccursor.h b/graphics/maccursor.h
index cca7f34..a6c8fc9 100644
--- a/graphics/maccursor.h
+++ b/graphics/maccursor.h
@@ -28,18 +28,19 @@
* - scumm
*/
-#include "common/stream.h"
-
#ifndef GRAPHICS_MACCURSOR_H
#define GRAPHICS_MACCURSOR_H
+#include "common/stream.h"
+
+#include "graphics/cursor.h"
+
namespace Graphics {
/**
* A Mac crsr or CURS cursor
- * TODO: Think about making a base class with WinCursor
*/
-class MacCursor {
+class MacCursor : public Cursor {
public:
MacCursor();
~MacCursor();
diff --git a/graphics/wincursor.h b/graphics/wincursor.h
index 86693db..6e25676 100644
--- a/graphics/wincursor.h
+++ b/graphics/wincursor.h
@@ -26,6 +26,8 @@
#include "common/array.h"
#include "common/winexe.h"
+#include "graphics/cursor.h"
+
namespace Common {
class NEResources;
class PEResources;
@@ -35,7 +37,7 @@ class SeekableReadStream;
namespace Graphics {
/** A Windows cursor. */
-class WinCursor {
+class WinCursor : public Cursor {
public:
WinCursor();
~WinCursor();
Commit: 91ae23ebf2967433d17457fbfc41cfb6200a924e
https://github.com/scummvm/scummvm/commit/91ae23ebf2967433d17457fbfc41cfb6200a924e
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-08-15T21:19:29-07:00
Commit Message:
GRAPHICS: Add cursor palette start/count functions
Changed paths:
graphics/cursor.h
graphics/maccursor.h
graphics/wincursor.h
diff --git a/graphics/cursor.h b/graphics/cursor.h
index 9d839c1..b04d9c0 100644
--- a/graphics/cursor.h
+++ b/graphics/cursor.h
@@ -49,8 +49,13 @@ public:
/** Return the cursor's surface. */
virtual const byte *getSurface() const = 0;
+
/** Return the cursor's palette in RGB format. */
virtual const byte *getPalette() const = 0;
+ /** Return the starting index of the palette. */
+ virtual byte getPaletteStartIndex() const = 0;
+ /** Return the number of colors in the palette. */
+ virtual uint16 getPaletteCount() const = 0;
};
} // End of namespace Graphics
diff --git a/graphics/maccursor.h b/graphics/maccursor.h
index a6c8fc9..f5efc20 100644
--- a/graphics/maccursor.h
+++ b/graphics/maccursor.h
@@ -57,7 +57,10 @@ public:
byte getKeyColor() const { return 0xFF; }
const byte *getSurface() const { return _surface; }
+
const byte *getPalette() const { return _palette; }
+ byte getPaletteStartIndex() const { return 0; }
+ uint16 getPaletteCount() const { return 256; }
/** Read the cursor's data out of a stream. */
bool readFromStream(Common::SeekableReadStream &stream, bool forceMonochrome = false);
diff --git a/graphics/wincursor.h b/graphics/wincursor.h
index 6e25676..974341f 100644
--- a/graphics/wincursor.h
+++ b/graphics/wincursor.h
@@ -54,7 +54,10 @@ public:
byte getKeyColor() const;
const byte *getSurface() const { return _surface; }
+
const byte *getPalette() const { return _palette; }
+ byte getPaletteStartIndex() const { return 0; }
+ uint16 getPaletteCount() const { return 256; }
/** Read the cursor's data out of a stream. */
bool readFromStream(Common::SeekableReadStream &stream);
Commit: c75bf3290d841f61e9b321f2419537cdaa972f52
https://github.com/scummvm/scummvm/commit/c75bf3290d841f61e9b321f2419537cdaa972f52
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-08-15T21:30:12-07:00
Commit Message:
GRAPHICS: Add a default Windows cursor
Based on the Mohawk one
Changed paths:
graphics/wincursor.cpp
graphics/wincursor.h
diff --git a/graphics/wincursor.cpp b/graphics/wincursor.cpp
index 6208f5f..2db72a2 100644
--- a/graphics/wincursor.cpp
+++ b/graphics/wincursor.cpp
@@ -308,4 +308,61 @@ WinCursorGroup *WinCursorGroup::createCursorGroup(Common::PEResources &exe, cons
return group;
}
+/**
+ * The default Windows cursor
+ */
+class DefaultWinCursor : public Cursor {
+public:
+ DefaultWinCursor() {}
+ ~DefaultWinCursor() {}
+
+ uint16 getWidth() const { return 12; }
+ uint16 getHeight() const { return 20; }
+ uint16 getHotspotX() const { return 0; }
+ uint16 getHotspotY() const { return 0; }
+ byte getKeyColor() const { return 0; }
+
+ const byte *getSurface() const {
+ static const byte defaultCursor[] = {
+ 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
+ };
+
+ return defaultCursor;
+ }
+
+ const byte *getPalette() const {
+ static const byte bwPalette[] = {
+ 0x00, 0x00, 0x00, // Black
+ 0xFF, 0xFF, 0xFF // White
+ };
+
+ return bwPalette;
+ }
+ byte getPaletteStartIndex() const { return 1; }
+ uint16 getPaletteCount() const { return 2; }
+};
+
+Cursor *makeDefaultWinCursor() {
+ return new DefaultWinCursor();
+}
+
} // End of namespace Graphics
diff --git a/graphics/wincursor.h b/graphics/wincursor.h
index 974341f..e6b35dc 100644
--- a/graphics/wincursor.h
+++ b/graphics/wincursor.h
@@ -102,6 +102,13 @@ struct WinCursorGroup {
static WinCursorGroup *createCursorGroup(Common::PEResources &exe, const Common::WinResourceID &id);
};
+/**
+ * Create a Cursor for the default Windows cursor.
+ *
+ * @note The calling code is responsible for deleting the returned pointer.
+ */
+Cursor *makeDefaultWinCursor();
+
} // End of namespace Graphics
#endif
Commit: a18312677d3fa29b55168743c0d8b58f94847f53
https://github.com/scummvm/scummvm/commit/a18312677d3fa29b55168743c0d8b58f94847f53
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-08-15T21:30:42-07:00
Commit Message:
MOHAWK: Use the default Windows cursor in /graphics now
Changed paths:
engines/mohawk/cursors.cpp
diff --git a/engines/mohawk/cursors.cpp b/engines/mohawk/cursors.cpp
index 78e099c..cbd17e0 100644
--- a/engines/mohawk/cursors.cpp
+++ b/engines/mohawk/cursors.cpp
@@ -49,36 +49,13 @@ void CursorManager::hideCursor() {
}
void CursorManager::setDefaultCursor() {
- static const byte defaultCursor[] = {
- 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 bwPalette[] = {
- 0x00, 0x00, 0x00, // Black
- 0xFF, 0xFF, 0xFF // White
- };
-
- CursorMan.replaceCursor(defaultCursor, 12, 20, 0, 0, 0);
- CursorMan.replaceCursorPalette(bwPalette, 1, 2);
+ Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
+
+ CursorMan.replaceCursor(cursor->getSurface(), cursor->getWidth(), cursor->getHeight(), cursor->getHotspotX(),
+ cursor->getHotspotY(), cursor->getKeyColor());
+ CursorMan.replaceCursorPalette(cursor->getPalette(), cursor->getPaletteStartIndex(), cursor->getPaletteCount());
+
+ delete cursor;
}
void CursorManager::setCursor(uint16 id) {
Commit: 310bd54e64fef98438439c6966c7785764ca53b7
https://github.com/scummvm/scummvm/commit/310bd54e64fef98438439c6966c7785764ca53b7
Author: Matthew Hoops (clone2727 at gmail.com)
Date: 2011-08-15T22:23:02-07:00
Commit Message:
SCUMM: Set the default moonbase cursor to be the default Windows cursor
Changed paths:
engines/scumm/cursor.cpp
engines/scumm/he/intern_he.h
diff --git a/engines/scumm/cursor.cpp b/engines/scumm/cursor.cpp
index a8adb4d..6708d39 100644
--- a/engines/scumm/cursor.cpp
+++ b/engines/scumm/cursor.cpp
@@ -22,6 +22,9 @@
#include "common/system.h"
#include "common/util.h"
#include "graphics/cursorman.h"
+#ifdef ENABLE_HE
+#include "graphics/wincursor.h"
+#endif
#include "scumm/bomp.h"
#include "scumm/charset.h"
#include "scumm/he/intern_he.h"
@@ -226,6 +229,45 @@ void ScummEngine_v70he::setDefaultCursor() {
updateCursor();
}
+#ifdef ENABLE_HE
+void ScummEngine_v100he::setDefaultCursor() {
+ if (_game.id == GID_MOONBASE) {
+ // Moonbase uses the default Windows cursor instead of the usual
+ // default HE cursor.
+ Graphics::Cursor *cursor = Graphics::makeDefaultWinCursor();
+
+ // Clear the cursor
+ for (int i = 0; i < 1024; i++)
+ WRITE_UINT16(_grabbedCursor + i * 2, 5);
+
+ _cursor.width = cursor->getWidth();
+ _cursor.height = cursor->getHeight();
+ _cursor.hotspotX = cursor->getHotspotX();
+ _cursor.hotspotY = cursor->getHotspotY();
+
+ const byte *surface = cursor->getSurface();
+ const byte *palette = cursor->getPalette();
+
+ for (uint16 y = 0; y < _cursor.height; y++) {
+ for (uint16 x = 0; x < _cursor.width; x++) {
+ byte pixel = *surface++;
+ if (pixel != cursor->getKeyColor()) {
+ pixel -= cursor->getPaletteStartIndex();
+ WRITE_UINT16(_grabbedCursor + (y * _cursor.width + x) * 2, get16BitColor(palette[pixel * 3], palette[pixel * 3 + 1], palette[pixel * 3 + 2]));
+ }
+
+ }
+ }
+
+ delete cursor;
+
+ updateCursor();
+ } else {
+ ScummEngine_v70he::setDefaultCursor();
+ }
+}
+#endif
+
void ScummEngine_v6::setCursorFromImg(uint img, uint room, uint imgindex) {
int w, h;
const byte *dataptr, *bomp;
diff --git a/engines/scumm/he/intern_he.h b/engines/scumm/he/intern_he.h
index c49217b..145172b9 100644
--- a/engines/scumm/he/intern_he.h
+++ b/engines/scumm/he/intern_he.h
@@ -570,6 +570,8 @@ protected:
virtual void decodeParseString(int a, int b);
+ virtual void setDefaultCursor();
+
/* HE version 100 script opcodes */
void o100_actorOps();
void o100_arrayOps();
More information about the Scummvm-git-logs
mailing list