aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorPaul Gilbert2013-06-21 00:18:19 -0400
committerPaul Gilbert2013-06-21 00:18:19 -0400
commit8c2b956120c9f11e6aa89753aa5dcdee8d2f1d7a (patch)
tree27ee84436a282ce9143bd8ede4c8da0a60678c7e /engines
parent975cc8075d89f91309c35adf778bb286ccc7d84e (diff)
downloadscummvm-rg350-8c2b956120c9f11e6aa89753aa5dcdee8d2f1d7a.tar.gz
scummvm-rg350-8c2b956120c9f11e6aa89753aa5dcdee8d2f1d7a.tar.bz2
scummvm-rg350-8c2b956120c9f11e6aa89753aa5dcdee8d2f1d7a.zip
VOYEUR: Converted cursor drawing to use CursorMan
Diffstat (limited to 'engines')
-rw-r--r--engines/voyeur/events.cpp23
-rw-r--r--engines/voyeur/events.h8
-rw-r--r--engines/voyeur/files.cpp1
-rw-r--r--engines/voyeur/files.h4
-rw-r--r--engines/voyeur/graphics.cpp63
-rw-r--r--engines/voyeur/voyeur.cpp17
6 files changed, 102 insertions, 14 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index e96ff12bd1..6bd0012fe7 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -22,6 +22,7 @@
#include "voyeur/events.h"
#include "voyeur/voyeur.h"
+#include "graphics/cursorman.h"
#include "graphics/palette.h"
namespace Voyeur {
@@ -336,7 +337,19 @@ void EventsManager::vInitColor() {
addIntNode(&_cycleIntNode);
}
-void EventsManager::setCursorTo(int idx, int mode) {
+void EventsManager::setCursor(PictureResource *pic) {
+ PictureResource cursor;
+ cursor._bounds = pic->_bounds;
+ cursor._flags = DISPFLAG_CURSOR;
+
+ _vm->_graphicsManager.sDrawPic(pic, &cursor, Common::Point());
+}
+
+void EventsManager::setCursor(byte *cursorData, int width, int height) {
+ CursorMan.replaceCursor(cursorData, width, height, 0, 0, 0);
+}
+
+void EventsManager::setCursorColor(int idx, int mode) {
switch (mode) {
case 0:
_vm->_graphicsManager.setColor(idx, 90, 90, 232);
@@ -355,4 +368,12 @@ void EventsManager::setCursorTo(int idx, int mode) {
}
}
+void EventsManager::mouseOn() {
+ CursorMan.showMouse(true);
+}
+
+void EventsManager::mouseOff() {
+ CursorMan.showMouse(false);
+}
+
} // End of namespace Voyeur
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 8689127b0d..0b78bc2dd8 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -25,6 +25,8 @@
#include "common/scummsys.h"
#include "common/list.h"
+#include "graphics/surface.h"
+#include "voyeur/files.h"
#include "voyeur/game.h"
namespace Voyeur {
@@ -95,7 +97,11 @@ public:
void addIntNode(IntNode *node);
void addFadeInt();
- void setCursorTo(int idx, int mode);
+ void setCursor(PictureResource *pic);
+ void setCursor(byte *cursorData, int width, int height);
+ void setCursorColor(int idx, int mode);
+ void mouseOn();
+ void mouseOff();
Common::Point getMousePos() { return _mousePos; }
};
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index f0a7468be8..16566d8ef3 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -666,6 +666,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src) {
}
PictureResource::PictureResource() {
+ _flags = 0;
_select = 0;
_pick = 0;
_onOff = 0;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index a00686397c..5d825ffce9 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -205,11 +205,11 @@ enum DisplayFlag { DISPFLAG_1 = 1, DISPFLAG_2 = 2, DISPFLAG_4 = 4, DISPFLAG_8 =
DISPFLAG_10 = 0x10, DISPFLAG_20 = 0x20, DISPFLAG_40 = 0x40, DISPFLAG_80 = 0x80,
DISPFLAG_100 = 0x100, DISPFLAG_200 = 0x200, DISPFLAG_400 = 0x400,
DISPFLAG_800 = 0x800, DISPFLAG_1000 = 0x1000, DISPFLAG_2000 = 0x2000,
- DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000 };
+ DISPFLAG_4000 = 0x4000, DISPFLAG_VIEWPORT = 0x8000, DISPFLAG_CURSOR = 0x10000 };
class DisplayResource {
public:
- uint16 _flags;
+ uint32 _flags;
};
class PictureResource: public DisplayResource {
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index dd64aae28a..9cf255306f 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -139,6 +139,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
int var52;
int var20, var22;
int var26, var2C;
+ byte pixel;
byte *srcImgData, *destImgData;
byte *srcP, *destP;
@@ -164,6 +165,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
srcOffset = 0;
srcFlags = srcPic->_flags;
destFlags = destPic->_flags;
+ byte *cursorData = NULL;
if (srcFlags & 1) {
if (_clipPtr) {
@@ -280,6 +282,12 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
if (srcPic->_select != 0xff)
return;
+ if (destFlags & DISPFLAG_CURSOR) {
+ cursorData = new byte[width2 * height1];
+ Common::fill(cursorData, cursorData + width2 * height1, 0);
+ destImgData = cursorData;
+ }
+
if (srcPic->_pick == 0xff) {
if (srcFlags & DISPFLAG_8) {
error("TODO: sDrawPic");
@@ -292,7 +300,55 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
destP = destImgData + screenOffset;
if (srcFlags & DISPFLAG_2) {
- // loc_258F5f
+ // loc_25652
+ srcP = srcImgData + srcOffset;
+
+ if (destFlags & DISPFLAG_8) {
+ // loc_2566F
+ if (srcFlags & DISPFLAG_2) {
+ // loc_256FA
+ srcP = (byte *)_screenSurface.pixels + srcOffset;
+
+ for (int yp = 0; yp < height1; ++yp) {
+ for (int xp = 0; xp < width2; ++width2, ++srcP, ++destP) {
+ pixel = *srcP;
+ if (pixel)
+ *destP = pixel;
+ }
+
+ srcP += widthDiff;
+ destP += widthDiff2;
+ }
+ } else {
+ // loc_25706
+ for (int yp = 0; yp < height1; ++yp) {
+ Common::copy(srcP, srcP + width2, destP);
+ srcP += width2 + widthDiff;
+ destP += width2 + widthDiff2;
+ }
+ }
+ } else {
+ // loc_25773
+ destP = destImgData + screenOffset;
+
+ if (srcFlags & DISPFLAG_2) {
+ // loc_25793
+ for (int yp = 0; yp < height1; ++yp) {
+ Common::copy(srcP, srcP + width2, destP);
+ srcP += width2 + widthDiff;
+ destP += width2 + widthDiff2;
+ }
+ } else {
+ // loc_25829
+ destP = (byte *)_screenSurface.pixels + screenOffset;
+
+ for (int yp = 0; yp < height1; ++yp) {
+ Common::copy(srcP, srcP + width2, destP);
+ srcP += width2 + widthDiff;
+ destP += width2 + widthDiff2;
+ }
+ }
+ }
} else {
// loc_25D40
if (srcFlags & DISPFLAG_100) {
@@ -455,6 +511,11 @@ error("TODO: var22/var24/var2C not initialised before use?");
// TODO
}
}
+
+ if (cursorData) {
+ _vm->_eventsManager.setCursor(cursorData, width2, height1);
+ delete[] cursorData;
+ }
}
void GraphicsManager::fillPic(DisplayResource *display, byte onOff) {
diff --git a/engines/voyeur/voyeur.cpp b/engines/voyeur/voyeur.cpp
index c969acd7c2..8be57e496f 100644
--- a/engines/voyeur/voyeur.cpp
+++ b/engines/voyeur/voyeur.cpp
@@ -237,12 +237,16 @@ bool VoyeurEngine::doLock() {
while (!shouldQuit() && (_eventsManager._fadeStatus & 1))
_eventsManager.delay(1);
- _eventsManager.setCursorTo(127, 0);
+ _eventsManager.setCursorColor(127, 0);
_graphicsManager.setColor(1, 64, 64, 64);
_graphicsManager.setColor(2, 96, 96, 96);
_graphicsManager.setColor(3, 160, 160, 160);
_graphicsManager.setColor(4, 224, 224, 224);
+ // Set up the cursor
+ _eventsManager.setCursor(cursorPic);
+ _eventsManager.mouseOn();
+
_eventsManager._intPtr. field38 = 1;
_eventsManager._intPtr._hasPalette = true;
@@ -282,7 +286,8 @@ bool VoyeurEngine::doLock() {
do {
// Scan through the list of key rects to check if a keypad key is highlighted
key = -1;
- Common::Point mousePos = _eventsManager.getMousePos();
+ Common::Point mousePos = _eventsManager.getMousePos() +
+ Common::Point(30, 20);
for (int keyIndex = 0; keyIndex < keyCount; ++keyIndex) {
int x1 = READ_LE_UINT16(keyData + (((keyIndex << 2) + 1) << 1));
@@ -295,16 +300,10 @@ bool VoyeurEngine::doLock() {
}
}
- _eventsManager.setCursorTo(127, (key == -1) ? 0 : 1);
+ _eventsManager.setCursorColor(127, (key == -1) ? 0 : 1);
_eventsManager._intPtr.field38 = 1;
_eventsManager._intPtr._hasPalette = true;
- // TODO:Refactor the mouse cursor to use ScummVM cursor code
- _graphicsManager.sDrawPic(cursorPic, *_graphicsManager._vPort, mousePos);
- (*_graphicsManager._vPort)->_parent->_flags |= DISPFLAG_8;
- _graphicsManager.flipPage();
- _eventsManager.sWaitFlip();
-
_eventsManager.delay(1);
} while (!shouldQuit() && !_voy._incriminate);
_voy._incriminate = false;