aboutsummaryrefslogtreecommitdiff
path: root/engines/voyeur
diff options
context:
space:
mode:
authorPaul Gilbert2014-03-01 21:11:08 -0500
committerPaul Gilbert2014-03-01 21:11:08 -0500
commitae258cb350797f41272fdc1878d8cb0d3bacef05 (patch)
treef57209389c1c8106532971ea76a66f9d9834d5fe /engines/voyeur
parent007d68006aaaf1025e246b6a9f7c25fd789958b2 (diff)
downloadscummvm-rg350-ae258cb350797f41272fdc1878d8cb0d3bacef05.tar.gz
scummvm-rg350-ae258cb350797f41272fdc1878d8cb0d3bacef05.tar.bz2
scummvm-rg350-ae258cb350797f41272fdc1878d8cb0d3bacef05.zip
VOYEUR: Change apartment cursor to use ScummVM cursor manager
Diffstat (limited to 'engines/voyeur')
-rw-r--r--engines/voyeur/events.cpp4
-rw-r--r--engines/voyeur/events.h2
-rw-r--r--engines/voyeur/files.cpp1
-rw-r--r--engines/voyeur/files.h1
-rw-r--r--engines/voyeur/files_threads.cpp19
-rw-r--r--engines/voyeur/graphics.cpp2
6 files changed, 19 insertions, 10 deletions
diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 13fadd3ced..36e015df43 100644
--- a/engines/voyeur/events.cpp
+++ b/engines/voyeur/events.cpp
@@ -526,8 +526,8 @@ void EventsManager::setCursor(PictureResource *pic) {
_vm->_graphicsManager->sDrawPic(pic, &cursor, Common::Point());
}
-void EventsManager::setCursor(byte *cursorData, int width, int height) {
- CursorMan.replaceCursor(cursorData, width, height, width / 2, height / 2, 0);
+void EventsManager::setCursor(byte *cursorData, int width, int height, int keyColor) {
+ CursorMan.replaceCursor(cursorData, width, height, width / 2, height / 2, keyColor);
}
void EventsManager::setCursorColor(int idx, int mode) {
diff --git a/engines/voyeur/events.h b/engines/voyeur/events.h
index 6f63ac09ee..11711d22fc 100644
--- a/engines/voyeur/events.h
+++ b/engines/voyeur/events.h
@@ -126,7 +126,7 @@ public:
void addFadeInt();
void setCursor(PictureResource *pic);
- void setCursor(byte *cursorData, int width, int height);
+ void setCursor(byte *cursorData, int width, int height, int keyColor);
void setCursorColor(int idx, int mode);
void showCursor();
void hideCursor();
diff --git a/engines/voyeur/files.cpp b/engines/voyeur/files.cpp
index 63551ce6b9..1c3a797aca 100644
--- a/engines/voyeur/files.cpp
+++ b/engines/voyeur/files.cpp
@@ -1036,6 +1036,7 @@ PictureResource::PictureResource(BoltFilesState &state, const byte *src):
_maskData = READ_LE_UINT32(&src[14]);
_planeSize = READ_LE_UINT16(&src[22]);
+ _keyColor = 0;
_imgData = NULL;
_freeImgData = DisposeAfterUse::YES;
diff --git a/engines/voyeur/files.h b/engines/voyeur/files.h
index 72fad52d32..dc409df320 100644
--- a/engines/voyeur/files.h
+++ b/engines/voyeur/files.h
@@ -291,6 +291,7 @@ public:
Common::Rect _bounds;
uint32 _maskData;
uint _planeSize;
+ byte _keyColor;
/**
* Image data for the picture
diff --git a/engines/voyeur/files_threads.cpp b/engines/voyeur/files_threads.cpp
index 603eb64a35..c3bad81a29 100644
--- a/engines/voyeur/files_threads.cpp
+++ b/engines/voyeur/files_threads.cpp
@@ -984,6 +984,14 @@ int ThreadResource::doApt() {
_vm->_eventsManager->_intPtr._hasPalette = true;
+ // Set up the cursors
+ PictureResource *unselectedCursor = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 2)._picResource;
+ PictureResource *selectedCursor = _vm->_bVoy->boltEntry(_vm->_playStampGroupId + 3)._picResource;
+ unselectedCursor->_keyColor = 0xff;
+ selectedCursor->_keyColor = 0xff;
+ _vm->_eventsManager->setCursor(unselectedCursor);
+ _vm->_eventsManager->showCursor();
+
// Main loop to allow users to move the cursor and select hotspots
int hotspotId;
int prevHotspotId = -1;
@@ -1009,7 +1017,7 @@ int ThreadResource::doApt() {
// Loop through the hotspot list
hotspotId = -1;
- pt = _vm->_eventsManager->getMousePos();
+ pt = _vm->_eventsManager->getMousePos() + Common::Point(16, 16);
for (int idx = 0; idx < (int)hotspots.size(); ++idx) {
if (hotspots[idx].contains(pt)) {
// Cursor is within hotspot area
@@ -1042,11 +1050,8 @@ int ThreadResource::doApt() {
if (gmmHotspot.contains(pt))
hotspotId = 42;
- // Draw either standard or highlighted eye cursor
- pic = _vm->_bVoy->boltEntry((hotspotId == -1) ? _vm->_playStampGroupId + 2 :
- _vm->_playStampGroupId + 3)._picResource;
- _vm->_graphicsManager->sDrawPic(pic, *_vm->_graphicsManager->_vPort, pt);
-
+ // Update the cursor to either standard or highlighted eye cursor
+ _vm->_eventsManager->setCursor((hotspotId == -1) ? unselectedCursor : selectedCursor);
_vm->flipPageAndWait();
if (hotspotId == 42 && _vm->_eventsManager->_leftClick) {
@@ -1057,6 +1062,7 @@ int ThreadResource::doApt() {
} while (!_vm->shouldQuit() && (!_vm->_eventsManager->_leftClick || hotspotId == -1));
+ _vm->_eventsManager->hideCursor();
pt = _vm->_eventsManager->getMousePos();
_aptPos.x = pt.x;
_aptPos.y = pt.y;
@@ -1079,6 +1085,7 @@ int ThreadResource::doApt() {
}
freeTheApt();
+
if (_vm->_voy->_transitionId == 1 && hotspotId == 0)
_vm->checkTransition();
diff --git a/engines/voyeur/graphics.cpp b/engines/voyeur/graphics.cpp
index ce5b91fb8a..761548fa87 100644
--- a/engines/voyeur/graphics.cpp
+++ b/engines/voyeur/graphics.cpp
@@ -845,7 +845,7 @@ void GraphicsManager::sDrawPic(DisplayResource *srcDisplay, DisplayResource *des
}
if (cursorData) {
- _vm->_eventsManager->setCursor(cursorData, width2, height1);
+ _vm->_eventsManager->setCursor(cursorData, width2, height1, srcPic->_keyColor);
delete[] cursorData;
}
}