VOYEUR: Change apartment cursor to use ScummVM cursor manager

This commit is contained in:
Paul Gilbert 2014-03-01 21:11:08 -05:00
parent 007d68006a
commit ae258cb350
6 changed files with 19 additions and 10 deletions

View File

@ -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) {

View File

@ -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();

View File

@ -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;

View File

@ -291,6 +291,7 @@ public:
Common::Rect _bounds;
uint32 _maskData;
uint _planeSize;
byte _keyColor;
/**
* Image data for the picture

View File

@ -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();

View File

@ -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;
}
}