[Scummvm-cvs-logs] scummvm master -> ae258cb350797f41272fdc1878d8cb0d3bacef05

dreammaster dreammaster at scummvm.org
Sun Mar 2 03:11:42 CET 2014


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
ae258cb350 VOYEUR: Change apartment cursor to use ScummVM cursor manager


Commit: ae258cb350797f41272fdc1878d8cb0d3bacef05
    https://github.com/scummvm/scummvm/commit/ae258cb350797f41272fdc1878d8cb0d3bacef05
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2014-03-01T18:11:08-08:00

Commit Message:
VOYEUR: Change apartment cursor to use ScummVM cursor manager

Changed paths:
    engines/voyeur/events.cpp
    engines/voyeur/events.h
    engines/voyeur/files.cpp
    engines/voyeur/files.h
    engines/voyeur/files_threads.cpp
    engines/voyeur/graphics.cpp



diff --git a/engines/voyeur/events.cpp b/engines/voyeur/events.cpp
index 13fadd3..36e015d 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 6f63ac0..11711d2 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 63551ce..1c3a797 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 72fad52..dc409df 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 603eb64..c3bad81 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 ce5b91f..761548f 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;
 	}
 }






More information about the Scummvm-git-logs mailing list