[Scummvm-git-logs] scummvm master -> 85e3a22510fe40d245f5a5e9c9661462c555510c

fracturehill noreply at scummvm.org
Wed Mar 1 16:40:59 UTC 2023


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

Summary:
3b27bce87b GRAPHICS: Fix transparency in ManagedSurface::blitFrom()
7c99dbc8cc NANCY: Fix broken filtering of dirty rects
ffaaf500b1 NANCY: Allow drawing to screen with arbitrary scale
26adf70cbd NANCY: Make _screenPosition a protected member
f34762aef9 NANCY: Simplify PrimaryVideo drawing code
7c534ca1c3 NANCY: Add function atEnd() to AVFVideoDecoder
85e3a22510 NANCY: Secondary video improvements


Commit: 3b27bce87b0272f1f58d7ce327acf6f547f16bb5
    https://github.com/scummvm/scummvm/commit/3b27bce87b0272f1f58d7ce327acf6f547f16bb5
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-01T18:35:58+02:00

Commit Message:
GRAPHICS: Fix transparency in ManagedSurface::blitFrom()

Added an explicit -1 argument for transColor in a call to transBlitFrom()
inside one of the overloads of blitFrom(). This fixes an issue where
calling blitFrom() with a Rect destination would result in the transparent
color being ignored.

Changed paths:
    graphics/managed_surface.cpp


diff --git a/graphics/managed_surface.cpp b/graphics/managed_surface.cpp
index e797505ad9e..b3e569edaf6 100644
--- a/graphics/managed_surface.cpp
+++ b/graphics/managed_surface.cpp
@@ -265,7 +265,7 @@ void ManagedSurface::blitFrom(const ManagedSurface &src, const Common::Rect &src
 void ManagedSurface::blitFrom(const ManagedSurface &src, const Common::Rect &srcRect,
 		const Common::Rect &destRect) {
 	if (src._transparentColorSet)
-		transBlitFrom(src, srcRect, destRect);
+		transBlitFrom(src, srcRect, destRect, -1);
 	else
 		blitFromInner(src._innerSurface, srcRect, destRect, src._paletteSet ? src._palette : nullptr);
 }


Commit: 7c99dbc8ccce436d0338e3a25fa46668d46cffe6
    https://github.com/scummvm/scummvm/commit/7c99dbc8ccce436d0338e3a25fa46668d46cffe6
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-01T18:35:58+02:00

Commit Message:
NANCY: Fix broken filtering of dirty rects

Fixed the algorithm for filtering out redundant dirty rects in
GraphicsManager::draw().

Changed paths:
    engines/nancy/graphics.cpp


diff --git a/engines/nancy/graphics.cpp b/engines/nancy/graphics.cpp
index c2ed5892aa8..389200e001f 100644
--- a/engines/nancy/graphics.cpp
+++ b/engines/nancy/graphics.cpp
@@ -80,10 +80,11 @@ void GraphicsManager::draw() {
 	}
 
 	// Filter out dirty rects that are completely inside others to reduce overdraw
-	for (Common::Rect &outer : dirtyRects) {
-		for (Common::Rect &inner : dirtyRects) {
-			if (inner != outer && outer.contains(inner)) {
-				dirtyRects.remove(inner);
+	for (auto outer = dirtyRects.begin(); outer != dirtyRects.end(); ++outer) {
+		for (auto inner = dirtyRects.begin(); inner != dirtyRects.end(); ++inner) {
+			if (inner != outer && (*outer).contains(*inner)) {
+				dirtyRects.erase(inner);
+				break;
 			}
 		}
 	}


Commit: ffaaf500b1fa9bed0c27f56313062c09c2fc4b3a
    https://github.com/scummvm/scummvm/commit/ffaaf500b1fa9bed0c27f56313062c09c2fc4b3a
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-01T18:35:58+02:00

Commit Message:
NANCY: Allow drawing to screen with arbitrary scale

Changed the drawing system so it will apply arbitrary scaling between
the source surface and screen destination.

Changed paths:
    engines/nancy/graphics.cpp
    engines/nancy/renderobject.cpp
    engines/nancy/renderobject.h


diff --git a/engines/nancy/graphics.cpp b/engines/nancy/graphics.cpp
index 389200e001f..dd79e7649ce 100644
--- a/engines/nancy/graphics.cpp
+++ b/engines/nancy/graphics.cpp
@@ -290,8 +290,7 @@ void GraphicsManager::loadFonts() {
 
 // Draw a given screen-space rectangle to the screen
 void GraphicsManager::blitToScreen(const RenderObject &src, Common::Rect screenRect) {
-	Common::Point pointDest(screenRect.left, screenRect.top);
-	_screen.blitFrom(src._drawSurface, src.convertToLocal(screenRect), pointDest);
+	_screen.blitFrom(src._drawSurface, src._drawSurface.getBounds().findIntersectingRect(src.convertToLocal(screenRect)), screenRect);
 }
 
 int GraphicsManager::objectComparator(const void *a, const void *b) {
diff --git a/engines/nancy/renderobject.cpp b/engines/nancy/renderobject.cpp
index 9b5829eb29a..d0f9eb10e5c 100644
--- a/engines/nancy/renderobject.cpp
+++ b/engines/nancy/renderobject.cpp
@@ -53,12 +53,18 @@ RenderObject::~RenderObject() {
 	}
 }
 
-void RenderObject::moveTo(Common::Point position) {
+void RenderObject::moveTo(const Common::Point &position) {
 	_previousScreenPosition = _screenPosition;
 	_screenPosition.moveTo(position);
 	_needsRedraw = true;
 }
 
+void RenderObject::moveTo(const Common::Rect &bounds) {
+	_previousScreenPosition = _screenPosition;
+	_screenPosition = bounds;
+	_needsRedraw = true;
+}
+
 void RenderObject::setVisible(bool visible) {
 	_isVisible = visible;
 	_needsRedraw = true;
@@ -88,7 +94,8 @@ Common::Rect RenderObject::getPreviousScreenPosition() const {
 	}
 }
 
-// Convert from screen to local space. Does NOT take _drawSurface's offset into account
+// Convert a rectangle from screen space to local (to _drawSurface) space.
+// Does NOT take _drawSurface's offset into account
 Common::Rect RenderObject::convertToLocal(const Common::Rect &screen) const {
 	Common::Rect ret = screen;
 	Common::Point offset;
@@ -105,15 +112,40 @@ Common::Rect RenderObject::convertToLocal(const Common::Rect &screen) const {
 	offset.y -= _screenPosition.top;
 
 	ret.translate(offset.x, offset.y);
+
+	if (_drawSurface.w != _screenPosition.width() || _drawSurface.h != _screenPosition.height()) {
+		Common::Rect srcBounds = _drawSurface.getBounds();
+
+		float scaleX = (float)_screenPosition.width() / srcBounds.width();
+		float scaleY = (float)_screenPosition.height() / srcBounds.height();
+
+		ret.left = (ret.left - srcBounds.left) * scaleX;
+		ret.right = (ret.right - srcBounds.left) * scaleX;
+		ret.top = (ret.top - srcBounds.top) * scaleY;
+		ret.bottom = (ret.bottom - srcBounds.top) * scaleY;
+	}
+
 	return ret;
 }
 
-// Convert from local to screen space. Does NOT take _drawSurface's offset into account
+// Convert rectangle from local (to _drawSurface) space to screen space.
+// Does NOT take _drawSurface's offset into account
 Common::Rect RenderObject::convertToScreen(const Common::Rect &rect) const {
-
 	Common::Rect ret = rect;
 	Common::Point offset;
 
+	if (_drawSurface.w != _screenPosition.width() || _drawSurface.h != _screenPosition.height()) {
+		Common::Rect srcBounds = _drawSurface.getBounds();
+
+		float scaleX = (float)srcBounds.width() / _screenPosition.width();
+		float scaleY = (float)srcBounds.height() / _screenPosition.height();
+
+		ret.left = (ret.left - srcBounds.left) * scaleX;
+		ret.right = (ret.right - srcBounds.left) * scaleX;
+		ret.top = (ret.top - srcBounds.top) * scaleY;
+		ret.bottom = (ret.bottom - srcBounds.top) * scaleY;
+	}
+
 	if (isViewportRelative()) {
 		Common::Rect viewportScreenPos = NancySceneState.getViewport().getScreenPosition();
 		offset.x += viewportScreenPos.left;
@@ -126,6 +158,7 @@ Common::Rect RenderObject::convertToScreen(const Common::Rect &rect) const {
 	offset.y += _screenPosition.top;
 
 	ret.translate(offset.x, offset.y);
+
 	return ret;
 }
 
diff --git a/engines/nancy/renderobject.h b/engines/nancy/renderobject.h
index a15eeab50dc..a2d4745394f 100644
--- a/engines/nancy/renderobject.h
+++ b/engines/nancy/renderobject.h
@@ -44,7 +44,8 @@ public:
 	virtual void registerGraphics(); // Does not get called automatically
 	virtual void updateGraphics() {}
 
-	void moveTo(Common::Point position);
+	void moveTo(const Common::Point &position);
+	void moveTo(const Common::Rect &bounds);
 	void setVisible(bool visible);
 	void setTransparent(bool isTransparent);
 
@@ -52,12 +53,12 @@ public:
 	Common::Rect getScreenPosition() const;
 	Common::Rect getPreviousScreenPosition() const;
 
-	// Given a screen-space rect, convert it to the source surface's local space
+	// Given a screen-space rect, convert it to the _drawSurface's local space
 	Common::Rect convertToLocal(const Common::Rect &screen) const;
-	// Given a local space rect, convert it to screen space
+	// Given a local (to the _drawSurface) space rect, convert it to screen space
 	Common::Rect convertToScreen(const Common::Rect &rect) const;
 
-	Common::Rect getBounds() const { return Common::Rect(_drawSurface.w, _drawSurface.h); }
+	Common::Rect getBounds() const { return Common::Rect(_screenPosition.width(), _screenPosition.height()); }
 
 	Graphics::ManagedSurface _drawSurface;
 	Common::Rect _screenPosition;


Commit: 26adf70cbddf292d68b0500002b40af8df1cf8b7
    https://github.com/scummvm/scummvm/commit/26adf70cbddf292d68b0500002b40af8df1cf8b7
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-01T18:35:59+02:00

Commit Message:
NANCY: Make _screenPosition a protected member

Made _screenPosition a protected member of RenderObject to force
usage of moveTo() and avoid any potential issues with the rendering
system.

Changed paths:
    engines/nancy/action/secondaryvideo.cpp
    engines/nancy/renderobject.h
    engines/nancy/state/mainmenu.cpp
    engines/nancy/state/map.cpp


diff --git a/engines/nancy/action/secondaryvideo.cpp b/engines/nancy/action/secondaryvideo.cpp
index c15faedea9c..135fcf9484b 100644
--- a/engines/nancy/action/secondaryvideo.cpp
+++ b/engines/nancy/action/secondaryvideo.cpp
@@ -123,7 +123,7 @@ void PlaySecondaryVideo::updateGraphics() {
 			}
 
 			_drawSurface.create(_fullFrame, _videoDescs[vpFrame].srcRect);
-			_screenPosition = _videoDescs[vpFrame].destRect;
+			moveTo(_videoDescs[vpFrame].destRect);
 			_hotspot = _screenPosition;
 			_hotspot.clip(NancySceneState.getViewport().getBounds());
 			_hasHotspot = true;
diff --git a/engines/nancy/renderobject.h b/engines/nancy/renderobject.h
index a2d4745394f..5bfc9c87d51 100644
--- a/engines/nancy/renderobject.h
+++ b/engines/nancy/renderobject.h
@@ -61,7 +61,6 @@ public:
 	Common::Rect getBounds() const { return Common::Rect(_screenPosition.width(), _screenPosition.height()); }
 
 	Graphics::ManagedSurface _drawSurface;
-	Common::Rect _screenPosition;
 
 protected:
 	// Z order and blit type are extracted directly from the corresponding
@@ -75,6 +74,7 @@ protected:
 	bool _isVisible;
 	uint16 _z;
 	Common::Rect _previousScreenPosition;
+	Common::Rect _screenPosition;
 };
 
 } // End of namespace Nancy
diff --git a/engines/nancy/state/mainmenu.cpp b/engines/nancy/state/mainmenu.cpp
index a6763265b50..7b7e41e972c 100644
--- a/engines/nancy/state/mainmenu.cpp
+++ b/engines/nancy/state/mainmenu.cpp
@@ -116,7 +116,7 @@ void MainMenu::run() {
 				_state = kStop;
 
 				_buttonDown._drawSurface.create(_background._drawSurface, _srcRects[i]);
-				_buttonDown._screenPosition = _destRects[i];
+				_buttonDown.moveTo(_destRects[i]);
 				_buttonDown.setVisible(true);
 
 				return;
diff --git a/engines/nancy/state/map.cpp b/engines/nancy/state/map.cpp
index b4501deb4cf..8a2fedad238 100644
--- a/engines/nancy/state/map.cpp
+++ b/engines/nancy/state/map.cpp
@@ -79,11 +79,15 @@ void Map::init() {
 	readRect(*chunk, closedLabelSrc);
 
 	_closedLabel._drawSurface.create(g_nancy->_graphicsManager->_object0, closedLabelSrc);
+	
+	Common::Rect newScreenRect;
 
-	_closedLabel._screenPosition.left = textboxScreenPosition.left + ((textboxScreenPosition.width() - closedLabelSrc.width()) / 2);
-	_closedLabel._screenPosition.right = _closedLabel._screenPosition.left + closedLabelSrc.width() - 1;
-	_closedLabel._screenPosition.bottom = textboxScreenPosition.bottom - 11;
-	_closedLabel._screenPosition.top = _closedLabel._screenPosition.bottom - closedLabelSrc.height() + 1;
+	newScreenRect.left = textboxScreenPosition.left + ((textboxScreenPosition.width() - closedLabelSrc.width()) / 2);
+	newScreenRect.right = newScreenRect.left + closedLabelSrc.width() - 1;
+	newScreenRect.bottom = textboxScreenPosition.bottom - 11;
+	newScreenRect.top = newScreenRect.bottom - closedLabelSrc.height() + 1;
+
+	_closedLabel.moveTo(newScreenRect);
 
 	setLabel(-1);
 
@@ -147,9 +151,11 @@ void Map::init() {
 		chunk->seek(0x9A + i * 16, SEEK_SET);
 		readRect(*chunk, loc.labelSrc);
 
+		Common::Rect closedScreenRect = _closedLabel.getScreenPosition();
+
 		loc.labelDest.left = textboxScreenPosition.left + ((textboxScreenPosition.width() - loc.labelSrc.width()) / 2);
 		loc.labelDest.right = loc.labelDest.left + loc.labelSrc.width() - 1;
-		loc.labelDest.bottom = _closedLabel._screenPosition.bottom - ((_closedLabel._screenPosition.bottom - loc.labelSrc.height() - textboxScreenPosition.top) / 2) - 11;
+		loc.labelDest.bottom = closedScreenRect.bottom - ((closedScreenRect.bottom - loc.labelSrc.height() - textboxScreenPosition.top) / 2) - 11;
 		loc.labelDest.top = loc.labelDest.bottom - loc.labelSrc.height() + 1;
 	}
 
@@ -226,7 +232,7 @@ void Map::setLabel(int labelID) {
 		_label.setVisible(false);
 		_closedLabel.setVisible(false);
 	} else {
-		_label._screenPosition = _locations[labelID].labelDest;
+		_label.moveTo(_locations[labelID].labelDest);
 		_label._drawSurface.create(g_nancy->_graphicsManager->_object0, _locations[labelID].labelSrc);
 		_label.setVisible(true);
 


Commit: f34762aef9a91c19d6065d407553b67bf1169395
    https://github.com/scummvm/scummvm/commit/f34762aef9a91c19d6065d407553b67bf1169395
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-01T18:35:59+02:00

Commit Message:
NANCY: Simplify PrimaryVideo drawing code

Removed the manual scaling code inside PrimaryVideo in order to
let the GraphicsManager handle it instead.

Changed paths:
    engines/nancy/action/primaryvideo.cpp
    engines/nancy/action/primaryvideo.h


diff --git a/engines/nancy/action/primaryvideo.cpp b/engines/nancy/action/primaryvideo.cpp
index 1339db447a2..89dbfbe28d1 100644
--- a/engines/nancy/action/primaryvideo.cpp
+++ b/engines/nancy/action/primaryvideo.cpp
@@ -122,8 +122,6 @@ void PlayPrimaryVideoChan0::init() {
 		error("Couldn't load video file %s", _videoName.c_str());
 	}
 
-	_drawSurface.create(_src.width(), _src.height(), _decoder.getPixelFormat());
-
 	if (!_paletteName.empty()) {
 		GraphicsManager::loadSurfacePalette(_drawSurface, _paletteName);
 		setTransparent(true);
@@ -144,16 +142,7 @@ void PlayPrimaryVideoChan0::updateGraphics() {
 	}
 
 	if (_decoder.needsUpdate()) {
-		if (_videoFormat == 2) {
-			_drawSurface.blitFrom(*_decoder.decodeNextFrame(), _src, Common::Point());
-		} else if (_videoFormat == 1) {
-			// This seems to be the only place in the engine where format 1 videos
-			// are scaled with arbitrary sizes; everything else uses double size
-			Graphics::Surface *scaledFrame = _decoder.decodeNextFrame()->getSubArea(_src).scale(_screenPosition.width(), _screenPosition.height());
-			GraphicsManager::copyToManaged(*scaledFrame, _drawSurface, true);
-			scaledFrame->free();
-			delete scaledFrame;
-		}
+		GraphicsManager::copyToManaged(*_decoder.decodeNextFrame(), _drawSurface, _videoFormat == 1);
 
 		_needsRedraw = true;
 	}
@@ -184,7 +173,7 @@ void PlayPrimaryVideoChan0::readData(Common::SeekableReadStream &stream) {
 	ser.skip(0x13, kGameTypeVampire, kGameTypeVampire);
 	ser.skip(0xF, kGameTypeNancy1);
 
-	readRect(stream, _src);
+	ser.skip(0x10); // Bounds
 	readRect(stream, _screenPosition);
 
 	char *rawText = new char[1500];
diff --git a/engines/nancy/action/primaryvideo.h b/engines/nancy/action/primaryvideo.h
index c8c0e65b495..03aca322a0f 100644
--- a/engines/nancy/action/primaryvideo.h
+++ b/engines/nancy/action/primaryvideo.h
@@ -87,7 +87,6 @@ public:
 	Common::String _videoName;
 	Common::String _paletteName;
 	uint _videoFormat = 2;
-	Common::Rect _src;
 	Common::String _text;
 
 	SoundDescription _sound;


Commit: 7c534ca1c343444d997cdba2ab38bf5031ee0a6c
    https://github.com/scummvm/scummvm/commit/7c534ca1c343444d997cdba2ab38bf5031ee0a6c
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-01T18:35:59+02:00

Commit Message:
NANCY: Add function atEnd() to AVFVideoDecoder

Added a function to check if a video has reached its end that
respects the timing of the last frame. This is useful for videos that
loop after the last frame ends (e.g. secondary videos in The
Vampire Diaries)

Changed paths:
    engines/nancy/video.cpp
    engines/nancy/video.h


diff --git a/engines/nancy/video.cpp b/engines/nancy/video.cpp
index f5d88e1c068..f2045c79ecf 100644
--- a/engines/nancy/video.cpp
+++ b/engines/nancy/video.cpp
@@ -76,6 +76,12 @@ void AVFDecoder::addFrameTime(const uint16 timeToAdd) {
 	((AVFDecoder::AVFVideoTrack *)getTrack(0))->_frameTime += timeToAdd;
 }
 
+// Custom function to allow the last frame of the video to play correctly
+bool AVFDecoder::atEnd() const {
+	const AVFDecoder::AVFVideoTrack *track = ((const AVFDecoder::AVFVideoTrack *)getTrack(0));
+	return !track->isReversed() && track->endOfTrack() && track->getFrameTime(track->getFrameCount()) <= getTime();
+}
+
 AVFDecoder::AVFVideoTrack::AVFVideoTrack(Common::SeekableReadStream *stream, uint32 chunkFileFormat) {
 	assert(stream);
 	_fileStream = stream;
diff --git a/engines/nancy/video.h b/engines/nancy/video.h
index 17bc128dda1..ea93ffe62fb 100644
--- a/engines/nancy/video.h
+++ b/engines/nancy/video.h
@@ -44,6 +44,7 @@ public:
 	bool loadStream(Common::SeekableReadStream *stream) override;
 	const Graphics::Surface *decodeFrame(uint frameNr);
 	void addFrameTime(const uint16 timeToAdd);
+	bool atEnd() const;
 
 private:
 	class AVFVideoTrack : public FixedRateVideoTrack {


Commit: 85e3a22510fe40d245f5a5e9c9661462c555510c
    https://github.com/scummvm/scummvm/commit/85e3a22510fe40d245f5a5e9c9661462c555510c
Author: Kaloyan Chehlarski (strahy at outlook.com)
Date: 2023-03-01T18:35:59+02:00

Commit Message:
NANCY: Secondary video improvements

Added support for The Vampire Diaries' looping secondary videos.
Added support for disabling the hotspot. Fixed the incorrect start
frame when the mouse stops hovering. Fixed a bug where the
hover animation could stop working after panning the viewport.

Changed paths:
    engines/nancy/action/secondaryvideo.cpp
    engines/nancy/action/secondaryvideo.h


diff --git a/engines/nancy/action/secondaryvideo.cpp b/engines/nancy/action/secondaryvideo.cpp
index 135fcf9484b..4a1d26bab83 100644
--- a/engines/nancy/action/secondaryvideo.cpp
+++ b/engines/nancy/action/secondaryvideo.cpp
@@ -61,7 +61,7 @@ void PlaySecondaryVideo::updateGraphics() {
 		return;
 	}
 
-	if (_isInFrame) {
+	if (_isInFrame && _decoder.isPlaying() ? _decoder.needsUpdate() || _decoder.atEnd() : true) {
 		int lastAnimationFrame = -1;
 		switch (_hoverState) {
 		case kNoHover:
@@ -82,7 +82,6 @@ void PlaySecondaryVideo::updateGraphics() {
 					_decoder.start();
 				}
 
-				_decoder.seekToFrame(_onHoverEndLastFrame);
 				_decoder.setRate(-_decoder.getRate());
 			} else {
 				lastAnimationFrame = _onHoverLastFrame;
@@ -100,11 +99,15 @@ void PlaySecondaryVideo::updateGraphics() {
 			}
 		}
 
-		if (_decoder.isPlaying() && _decoder.needsUpdate()) {
-			GraphicsManager::copyToManaged(*_decoder.decodeNextFrame(), _fullFrame, _paletteFilename.size() > 0);
-			_needsRedraw = true;
+		if (_decoder.isPlaying()) {
+			if (_decoder.needsUpdate()) {
+				GraphicsManager::copyToManaged(*_decoder.decodeNextFrame(), _fullFrame, _paletteFilename.size() > 0);
+				_needsRedraw = true;
+			}
 
-			if (lastAnimationFrame > -1 && _decoder.getCurFrame() == lastAnimationFrame + (_decoder.getRate().getNumerator() > 0 ? 1 : -1)) {
+			if (lastAnimationFrame > -1 &&
+					(_decoder.atEnd() ||
+					 _decoder.getCurFrame() == lastAnimationFrame + (_decoder.getRate().getNumerator() > 0 ? 1 : -1))) {
 				if (_hoverState == kNoHover) {
 					_decoder.seekToFrame(_loopFirstFrame);
 				} else {
@@ -112,18 +115,21 @@ void PlaySecondaryVideo::updateGraphics() {
 				}
 			}
 		}
+	}
 
-		if (_needsRedraw && _isVisible) {
-			int vpFrame = -1;
-			for (uint i = 0; i < _videoDescs.size(); ++i) {
-				if (_videoDescs[i].frameID == _currentViewportFrame) {
-					vpFrame = i;
-					break;
-				}
+	if (_needsRedraw && _isVisible) {
+		int vpFrame = -1;
+		for (uint i = 0; i < _videoDescs.size(); ++i) {
+			if (_videoDescs[i].frameID == _currentViewportFrame) {
+				vpFrame = i;
+				break;
 			}
+		}
 
-			_drawSurface.create(_fullFrame, _videoDescs[vpFrame].srcRect);
-			moveTo(_videoDescs[vpFrame].destRect);
+		_drawSurface.create(_fullFrame, _videoDescs[vpFrame].srcRect);
+		moveTo(_videoDescs[vpFrame].destRect);
+
+		if (_enableHotspot == kTrue) {
 			_hotspot = _screenPosition;
 			_hotspot.clip(NancySceneState.getViewport().getBounds());
 			_hasHotspot = true;
@@ -152,10 +158,17 @@ void PlaySecondaryVideo::handleInput(NancyInput &input) {
 void PlaySecondaryVideo::readData(Common::SeekableReadStream &stream) {
 	readFilename(stream, _filename);
 	readFilename(stream, _paletteFilename);
-	stream.skip(10);
+	stream.skip(10); // video overlay bitmap filename
 
 	if (_paletteFilename.size()) {
-		stream.skip(14); // unknown data
+		stream.skip(12);
+		// videoSource (HD, CD, cache)
+		// ??
+		// _paletteStart
+		// _paletteSize
+		// hasOverlayBitmap
+		// ignoreHoverAnimation??
+		_enableHotspot = (NancyFlag)stream.readUint16LE();
 	}
 
 	_loopFirstFrame = stream.readUint16LE();
@@ -212,13 +225,13 @@ void PlaySecondaryVideo::execute() {
 				}
 
 				_isInFrame = true;
-				_hoverState = kNoHover;
 				setVisible(true);
 			} else {
 				if (_isVisible) {
 					setVisible(false);
 					_hasHotspot = false;
 					_isInFrame = false;
+					_hoverState = kNoHover;
 					_decoder.stop();
 				}
 			}
diff --git a/engines/nancy/action/secondaryvideo.h b/engines/nancy/action/secondaryvideo.h
index 8cc50d491b5..56b02c01a1b 100644
--- a/engines/nancy/action/secondaryvideo.h
+++ b/engines/nancy/action/secondaryvideo.h
@@ -50,6 +50,11 @@ public:
 
 	Common::String _filename;
 	Common::String _paletteFilename;
+	// Common::String _bitmapOverlayFilename
+
+	// TVD only
+	NancyFlag _enableHotspot = kTrue;
+
 	uint16 _loopFirstFrame = 0; // 0x1E
 	uint16 _loopLastFrame = 0; // 0x20
 	uint16 _onHoverFirstFrame = 0; // 0x22




More information about the Scummvm-git-logs mailing list