[Scummvm-git-logs] scummvm master -> ae1016e5c2940bf9008b8a786823d8907ed8b7ce

fracturehill 76959842+fracturehill at users.noreply.github.com
Mon Apr 26 16:43:07 UTC 2021


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

Summary:
e8a8150f8d NANCY: Fix The Vampire Diaries viewport edges and movement
954954a85a NANCY: Flip all backgrounds in The Vampire Diaries
2a8512925a NANCY: Fix items and inventory box in The Vampire Diaries
ae1016e5c2 NANCY: Set correct maximum scroll in The Vampire Diaries


Commit: e8a8150f8d32a1e05973e303700a031fcc73534e
    https://github.com/scummvm/scummvm/commit/e8a8150f8d32a1e05973e303700a031fcc73534e
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2021-04-26T19:42:17+03:00

Commit Message:
NANCY: Fix The Vampire Diaries viewport edges and movement

The viewport edges in TVD now have the same behavior as the
original engine, and movement is now at the correct speed.

Changed paths:
    engines/nancy/graphics.h
    engines/nancy/nancy.cpp
    engines/nancy/ui/viewport.cpp
    engines/nancy/ui/viewport.h


diff --git a/engines/nancy/graphics.h b/engines/nancy/graphics.h
index 1ae03ae01d..94a052f7f2 100644
--- a/engines/nancy/graphics.h
+++ b/engines/nancy/graphics.h
@@ -47,6 +47,7 @@ public:
 	void redrawAll();
 
 	const Font *getFont(uint id) const { return id < _fonts.size() ? &_fonts[id] : nullptr; }
+	const Graphics::Screen *getScreen() { return &_screen; }
 
 	const Graphics::PixelFormat &getInputPixelFormat();
 	const Graphics::PixelFormat &getScreenPixelFormat();
diff --git a/engines/nancy/nancy.cpp b/engines/nancy/nancy.cpp
index eb62ef795f..01ad267506 100644
--- a/engines/nancy/nancy.cpp
+++ b/engines/nancy/nancy.cpp
@@ -467,20 +467,21 @@ void NancyEngine::readBootSummary(const IFF &boot) {
 		readChunkList(boot, ser, "OB");
 	}
 
+	ser.skip(0x96, kGameTypeVampire, kGameTypeVampire);
 	ser.skip(0x79, kGameTypeNancy1, kGameTypeNancy1);
-	ser.syncAsUint16LE(_horizontalEdgesSize, kGameTypeNancy1, kGameTypeNancy1);
-	ser.syncAsUint16LE(_verticalEdgesSize, kGameTypeNancy1, kGameTypeNancy1);
-	ser.skip(0x1C, kGameTypeNancy1, kGameTypeNancy1);
+	ser.syncAsUint16LE(_horizontalEdgesSize, kGameTypeVampire, kGameTypeNancy1);
+	ser.syncAsUint16LE(_verticalEdgesSize, kGameTypeVampire, kGameTypeNancy1);
+	ser.skip(0x1C, kGameTypeVampire, kGameTypeNancy1);
 	int16 time = 0;
-	ser.syncAsSint16LE(time, kGameTypeNancy1, kGameTypeNancy1);
+	ser.syncAsSint16LE(time, kGameTypeVampire, kGameTypeNancy1);
 	_playerTimeMinuteLength = time;
 	ser.skip(2, kGameTypeNancy1, kGameTypeNancy1);
-	ser.syncAsByte(_overrideMovementTimeDeltas, kGameTypeNancy1, kGameTypeNancy1);
+	ser.syncAsByte(_overrideMovementTimeDeltas, kGameTypeVampire, kGameTypeNancy1);
 
 	if (_overrideMovementTimeDeltas) {
-		ser.syncAsSint16LE(time, kGameTypeNancy1, kGameTypeNancy1);
+		ser.syncAsSint16LE(time, kGameTypeVampire, kGameTypeNancy1);
 		_slowMovementTimeDelta = time;
-		ser.syncAsSint16LE(time, kGameTypeNancy1, kGameTypeNancy1);
+		ser.syncAsSint16LE(time, kGameTypeVampire, kGameTypeNancy1);
 		_fastMovementTimeDelta = time;
 	}
 }
diff --git a/engines/nancy/ui/viewport.cpp b/engines/nancy/ui/viewport.cpp
index 6619888cd7..8c82ced9b2 100644
--- a/engines/nancy/ui/viewport.cpp
+++ b/engines/nancy/ui/viewport.cpp
@@ -48,11 +48,7 @@ void Viewport::init() {
 
 	_screenPosition = dest;
 
-	_upHotspot = _downHotspot = _leftHotspot = _rightHotspot = _screenPosition;
-	_downHotspot.translate(0, _screenPosition.height());
-	_rightHotspot.translate(_screenPosition.width(), 0);
-	
-	setEdgesSize(g_nancy->_verticalEdgesSize, g_nancy->_horizontalEdgesSize + 5, g_nancy->_horizontalEdgesSize, g_nancy->_horizontalEdgesSize);
+	setEdgesSize(g_nancy->_verticalEdgesSize, g_nancy->_verticalEdgesSize, g_nancy->_horizontalEdgesSize, g_nancy->_horizontalEdgesSize);
 
 	RenderObject::init();
 }
@@ -67,61 +63,50 @@ void Viewport::handleInput(NancyInput &input) {
 		input.mousePos = _stickyCursorPos;
 	}
 
-	if (_screenPosition.contains(input.mousePos)) {
-		g_nancy->_cursorManager->setCursorType(CursorManager::kNormal);
+	Common::Rect viewportActiveZone;
+
+	if (g_nancy->getGameType() == kGameTypeVampire) {
+		viewportActiveZone = g_nancy->_graphicsManager->getScreen()->getBounds();
+		viewportActiveZone.bottom = _screenPosition.bottom;
+	} else {
+		viewportActiveZone = _screenPosition;
 	}
+	
+	if (viewportActiveZone.contains(input.mousePos)) {
+		g_nancy->_cursorManager->setCursorType(CursorManager::kNormal);
 
-	// Do not handle hotspots marked as inactive and ignore diagonals if intersecting hotspots are not active
-	if (_upHotspot.contains(input.mousePos) && (_edgesMask & kUp) == 0) {
-		if (_upHotspot.findIntersectingRect(_leftHotspot).contains(input.mousePos)) {
-			if ((_edgesMask & kLeft) == 0) {
-				direction |= kUp;
-			}
-		} else if (_upHotspot.findIntersectingRect(_rightHotspot).contains(input.mousePos)) {
-			if ((_edgesMask & kRight) == 0) {
-				direction |= kUp;
-			}
-		} else {
+		if (input.mousePos.x < _nonScrollZone.left) {
+			direction |= kLeft;
+		}
+
+		if (input.mousePos.x > _nonScrollZone.right) {
+			direction |= kRight;
+		}
+
+		if (input.mousePos.y < _nonScrollZone.top) {
 			direction |= kUp;
 		}
-	} else if (_downHotspot.contains(input.mousePos) && (_edgesMask & kDown) == 0) {
-		if (_downHotspot.findIntersectingRect(_leftHotspot).contains(input.mousePos)) {
-			if ((_edgesMask & kLeft) == 0) {
-				direction |= kDown;
-			}
-		} else if (_downHotspot.findIntersectingRect(_rightHotspot).contains(input.mousePos)) {
-			if ((_edgesMask & kRight) == 0) {
+
+		if (input.mousePos.y > _nonScrollZone.bottom) {
+			// Handle TVD's weird behavior
+			if (_screenPosition.contains(input.mousePos)) {
 				direction |= kDown;
+			} else {
+				direction &= ~(kLeft | kRight);
 			}
-		} else {
-			direction |= kDown;
 		}
-	}
 
-	if (_leftHotspot.contains(input.mousePos) && (_edgesMask & kLeft) == 0) {
-		if (_leftHotspot.findIntersectingRect(_upHotspot).contains(input.mousePos)) {
-			if ((_edgesMask & kUp) == 0) {
-				direction |= kLeft;
-			}
-		} else if (_leftHotspot.findIntersectingRect(_downHotspot).contains(input.mousePos)) {
-			if ((_edgesMask & kDown) == 0) {
-				direction |= kLeft;
-			}
-		} else {
-			direction |= kLeft;
-		}
-	} else if (_rightHotspot.contains(input.mousePos) && (_edgesMask & kRight) == 0) {
-		if (_rightHotspot.findIntersectingRect(_upHotspot).contains(input.mousePos)) {
-			if ((_edgesMask & kUp) == 0) {
-				direction |= kRight;
-			}
-		} else if (_rightHotspot.findIntersectingRect(_downHotspot).contains(input.mousePos)) {
-			if ((_edgesMask & kDown) == 0) {
-				direction |= kRight;
-			}
-		} else {
-			direction |= kRight;
+		// Handle diagonals
+		if (direction & (kLeft | kUp) ||
+			direction & (kLeft | kDown) ||
+			direction & (kRight | kUp) ||
+			direction & (kRight | kDown)) {
+				if (direction & _edgesMask) {
+					direction = 0;
+				}
 		}
+
+		direction &= ~_edgesMask;
 	}
 
 	// Set sticky cursor
@@ -308,16 +293,12 @@ Common::Rect Viewport::convertScreenToViewport(const Common::Rect &viewportRect)
 }
 
 void Viewport::setEdgesSize(uint16 upSize, uint16 downSize, uint16 leftSize, uint16 rightSize) {
-	_upHotspot.setHeight(upSize);
-	_leftHotspot.setWidth(leftSize);
-
-	_downHotspot.top = _screenPosition.bottom;
-	_downHotspot.setHeight(downSize);
-	_downHotspot.translate(0, -downSize);
-
-	_rightHotspot.left = _screenPosition.right;
-	_rightHotspot.setWidth(rightSize);
-	_rightHotspot.translate(-rightSize, 0);
+	_nonScrollZone = _screenPosition;
+	uint offset = g_nancy->getGameType() == kGameTypeVampire ? 0 : 1;
+	_nonScrollZone.top += upSize;
+	_nonScrollZone.left += leftSize;
+	_nonScrollZone.bottom -= downSize + offset;
+	_nonScrollZone.right -= rightSize + offset;
 }
 
 void Viewport::disableEdges(byte edges) {
diff --git a/engines/nancy/ui/viewport.h b/engines/nancy/ui/viewport.h
index e4cc3b68a5..f8d5149a59 100644
--- a/engines/nancy/ui/viewport.h
+++ b/engines/nancy/ui/viewport.h
@@ -80,11 +80,7 @@ public:
 protected:
 	void setEdgesSize(uint16 upSize, uint16 downSize, uint16 leftSize, uint16 rightSize);
 
-	Common::Rect _upHotspot;
-	Common::Rect _downHotspot;
-	Common::Rect _leftHotspot;
-	Common::Rect _rightHotspot;
-
+	Common::Rect _nonScrollZone;
 	byte _edgesMask;
 
 	byte _movementLastFrame;


Commit: 954954a85a1a2b07324aadee5e1ddb240b02fa1a
    https://github.com/scummvm/scummvm/commit/954954a85a1a2b07324aadee5e1ddb240b02fa1a
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2021-04-26T19:42:17+03:00

Commit Message:
NANCY: Flip all backgrounds in The Vampire Diaries

Both format 1 and 2 backgrounds in The Vampire Diaries are
upside-down, and the Viewport code now correctly flips all
backgrounds for that game.

Changed paths:
    engines/nancy/ui/viewport.cpp


diff --git a/engines/nancy/ui/viewport.cpp b/engines/nancy/ui/viewport.cpp
index 8c82ced9b2..58c6213f30 100644
--- a/engines/nancy/ui/viewport.cpp
+++ b/engines/nancy/ui/viewport.cpp
@@ -209,16 +209,11 @@ void Viewport::setFrame(uint frameNr) {
 
 	const Graphics::Surface *newFrame = _decoder.decodeFrame(frameNr);
 
-	if (_videoFormat == 2) {
-		// Format 2 uses full-size images
-		GraphicsManager::copyToManaged(*newFrame, _fullFrame);
-	} else if (_videoFormat == 1) {
-		// Format 1 uses quarter-size, upside-down images
-		GraphicsManager::copyToManaged(*newFrame, _fullFrame, true, true);
-	}
+	// Format 1 uses quarter-size images, while format 2 uses full-size ones
+	// Videos in TVD are always upside-down
+	GraphicsManager::copyToManaged(*newFrame, _fullFrame, g_nancy->getGameType() == kGameTypeVampire, _videoFormat == 1);
 
 	_needsRedraw = true;
-
 	_currentFrame = frameNr;
 }
 


Commit: 2a8512925a3d8ebea84a517caaffaaae81da88be
    https://github.com/scummvm/scummvm/commit/2a8512925a3d8ebea84a517caaffaaae81da88be
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2021-04-26T19:42:18+03:00

Commit Message:
NANCY: Fix items and inventory box in The Vampire Diaries

Items now show up in TVD's inventory box, and displaying their
cursor in the viewport no longer crashes the game.

Changed paths:
    engines/nancy/cursor.cpp
    engines/nancy/cursor.h
    engines/nancy/ui/inventorybox.cpp
    engines/nancy/ui/inventorybox.h


diff --git a/engines/nancy/cursor.cpp b/engines/nancy/cursor.cpp
index b8605a37cf..a751690a07 100644
--- a/engines/nancy/cursor.cpp
+++ b/engines/nancy/cursor.cpp
@@ -83,17 +83,19 @@ void CursorManager::setCursor(CursorType type, int16 itemID) {
 	case kHotspotArrow:
 		_curCursorID = 6;
 		break;
-	default:
+	default: {
+		uint itemsOffset = 0;
 		if (itemID == -1) {
 			// No item held, set to eyeglass
 			itemID = 0;
 		} else {
 			// Item held
-			itemID += 3;
+			itemsOffset = g_nancy->getConstants().numNonItemCursors;
 			hasItem = true;
 		}
 
-		_curCursorID = itemID * 4 + type;
+		_curCursorID = itemID * 4 + itemsOffset + type;
+	}
 	}
 
 	Graphics::ManagedSurface *surf;
diff --git a/engines/nancy/cursor.h b/engines/nancy/cursor.h
index c8a7b42fe2..29fab7d365 100644
--- a/engines/nancy/cursor.h
+++ b/engines/nancy/cursor.h
@@ -65,7 +65,6 @@ private:
 	Common::Point _primaryVideoInitialPos;
 
 	Graphics::ManagedSurface _invCursorsSurface;
-	Graphics::ManagedSurface _object0Copy;
 
 	CursorType _curCursorType;
 	int16 _curItemID;
diff --git a/engines/nancy/ui/inventorybox.cpp b/engines/nancy/ui/inventorybox.cpp
index 38f545615f..7ad045da7a 100644
--- a/engines/nancy/ui/inventorybox.cpp
+++ b/engines/nancy/ui/inventorybox.cpp
@@ -81,12 +81,13 @@ void InventoryBox::init() {
 	stream.skip(8);
 	readRect(stream, _emptySpace);
 
-	char itemName[0x14];
+	char itemName[20];
+	uint itemNameLength = g_nancy->getGameType() == kGameTypeVampire ? 15 : 20;
 
 	_itemDescriptions.reserve(g_nancy->getConstants().numItems);
 	for (uint i = 0; i < g_nancy->getConstants().numItems; ++i) {
-		stream.read(itemName, 0x14);
-		itemName[0x13] = '\0';
+		stream.read(itemName, itemNameLength);
+		itemName[itemNameLength - 1] = '\0';
 		_itemDescriptions.push_back(ItemDescription());
 		ItemDescription &desc = _itemDescriptions.back();
 		desc.name = Common::String(itemName);
diff --git a/engines/nancy/ui/inventorybox.h b/engines/nancy/ui/inventorybox.h
index 35cb087926..a5a6aae412 100644
--- a/engines/nancy/ui/inventorybox.h
+++ b/engines/nancy/ui/inventorybox.h
@@ -102,7 +102,7 @@ private:
 		Common::Rect hotspot; // in screen coordinates
 	};
 
-	Graphics::Surface _iconsSurface;
+	Graphics::ManagedSurface _iconsSurface;
 	Graphics::ManagedSurface _fullInventorySurface;
 
 	Scrollbar *_scrollbar;


Commit: ae1016e5c2940bf9008b8a786823d8907ed8b7ce
    https://github.com/scummvm/scummvm/commit/ae1016e5c2940bf9008b8a786823d8907ed8b7ce
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2021-04-26T19:42:18+03:00

Commit Message:
NANCY: Set correct maximum scroll in The Vampire Diaries

The maximum scroll in TVD is now corrected by one pixel, which
fixes some issues in single-frame scenes.

Changed paths:
    engines/nancy/ui/viewport.cpp
    engines/nancy/ui/viewport.h


diff --git a/engines/nancy/ui/viewport.cpp b/engines/nancy/ui/viewport.cpp
index 58c6213f30..7a85f3f6dc 100644
--- a/engines/nancy/ui/viewport.cpp
+++ b/engines/nancy/ui/viewport.cpp
@@ -262,6 +262,10 @@ void Viewport::scrollDown(uint delta) {
 	}
 }
 
+uint16 Viewport::getMaxScroll() const {
+	return _fullFrame.h - _drawSurface.h - (g_nancy->getGameType() == kGameTypeVampire ? 1 : 0); 
+}
+
 Common::Rect Viewport::getBoundsByFormat(uint format) const {
 	if (format == 1) {
 		return _format1Bounds;
diff --git a/engines/nancy/ui/viewport.h b/engines/nancy/ui/viewport.h
index f8d5149a59..b31ed3f9b3 100644
--- a/engines/nancy/ui/viewport.h
+++ b/engines/nancy/ui/viewport.h
@@ -67,7 +67,7 @@ public:
 	uint16 getFrameCount() const { return _decoder.isVideoLoaded() ? _decoder.getFrameCount() : 0; }
 	uint16 getCurFrame() const { return _currentFrame; }
 	uint16 getCurVerticalScroll() const { return _drawSurface.getOffsetFromOwner().y; }
-	uint16 getMaxScroll() const { return _fullFrame.h - _drawSurface.h; }
+	uint16 getMaxScroll() const;
 
 	Common::Rect getBoundsByFormat(uint format) const; // used by video
 




More information about the Scummvm-git-logs mailing list