aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorbjörn Andersson2005-10-09 19:10:59 +0000
committerTorbjörn Andersson2005-10-09 19:10:59 +0000
commite330793547f6b912c13aec19f234b2cd5f9b8185 (patch)
tree39ef038ac858272335418c2e32849bd3ca233c95
parent1e286ca84f512139b502b1fe9a471f2ac04c8fb2 (diff)
downloadscummvm-rg350-e330793547f6b912c13aec19f234b2cd5f9b8185.tar.gz
scummvm-rg350-e330793547f6b912c13aec19f234b2cd5f9b8185.tar.bz2
scummvm-rg350-e330793547f6b912c13aec19f234b2cd5f9b8185.zip
Added optional parameter to setCursor() to specify which type of cursor you
want. ITE has only one cursor, so in that case the parameter is ignored, and IHNM currently always gets the hourglass cursor. So it could be improved. Lots. :-) svn-id: r18992
-rw-r--r--saga/gfx.cpp67
-rw-r--r--saga/gfx.h7
2 files changed, 57 insertions, 17 deletions
diff --git a/saga/gfx.cpp b/saga/gfx.cpp
index cdad674972..c1e76daba9 100644
--- a/saga/gfx.cpp
+++ b/saga/gfx.cpp
@@ -396,22 +396,57 @@ void Gfx::showCursor(bool state) {
g_system->showMouse(state);
}
-void Gfx::setCursor() {
- // Set up the mouse cursor
- const byte A = kITEColorLightGrey;
- const byte B = kITEColorWhite;
-
- const byte cursor_img[CURSOR_W * CURSOR_H] = {
- 0, 0, 0, A, 0, 0, 0,
- 0, 0, 0, A, 0, 0, 0,
- 0, 0, 0, A, 0, 0, 0,
- A, A, A, B, A, A, A,
- 0, 0, 0, A, 0, 0, 0,
- 0, 0, 0, A, 0, 0, 0,
- 0, 0, 0, A, 0, 0, 0,
- };
-
- _system->setMouseCursor(cursor_img, CURSOR_W, CURSOR_H, 3, 3, 0);
+void Gfx::setCursor(CursorType cursorType) {
+ if (_vm->getGameType() == GType_ITE) {
+ // Set up the mouse cursor
+ const byte A = kITEColorLightGrey;
+ const byte B = kITEColorWhite;
+
+ const byte cursor_img[CURSOR_W * CURSOR_H] = {
+ 0, 0, 0, A, 0, 0, 0,
+ 0, 0, 0, A, 0, 0, 0,
+ 0, 0, 0, A, 0, 0, 0,
+ A, A, A, B, A, A, A,
+ 0, 0, 0, A, 0, 0, 0,
+ 0, 0, 0, A, 0, 0, 0,
+ 0, 0, 0, A, 0, 0, 0,
+ };
+
+ _system->setMouseCursor(cursor_img, CURSOR_W, CURSOR_H, 3, 3, 0);
+ } else {
+ uint32 resourceId;
+
+ switch (cursorType) {
+ case kCursorBusy:
+ resourceId = RID_IHNM_HOURGLASS_CURSOR;
+ break;
+ default:
+ // Assume normal cursor
+ // TODO: Find the correct resource for it
+ resourceId = RID_IHNM_HOURGLASS_CURSOR;
+ break;
+ }
+
+ ResourceContext *context = _vm->_resource->getContext(GAME_RESOURCEFILE);
+
+ byte *resource;
+ size_t resourceLength;
+
+ _vm->_resource->loadResource(context, resourceId, resource, resourceLength);
+
+ byte *image;
+ size_t imageLength;
+ int width, height;
+
+ _vm->decodeBGImage(resource, resourceLength, &image, &imageLength, &width, &height);
+
+ // TODO: Hotspot?
+
+ _system->setMouseCursor(image, width, height, 0, 0, 0);
+
+ free(image);
+ free(resource);
+ }
}
bool hitTestPoly(const Point *points, unsigned int npoints, const Point& test_point) {
diff --git a/saga/gfx.h b/saga/gfx.h
index 0a836da1a1..147def0eb3 100644
--- a/saga/gfx.h
+++ b/saga/gfx.h
@@ -33,6 +33,11 @@ namespace Saga {
using Common::Point;
using Common::Rect;
+enum CursorType {
+ kCursorNormal,
+ kCursorBusy
+};
+
struct ClipData {
// input members
Rect sourceRect;
@@ -144,7 +149,7 @@ public:
void showCursor(bool state);
private:
- void setCursor();
+ void setCursor(CursorType cursorType = kCursorNormal);
int _init;
Surface _backBuffer;
byte _currentPal[PAL_ENTRIES * 4];