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

Die4Ever noreply at scummvm.org
Tue Jan 4 07:20:20 UTC 2022


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:
e60ac866b3 GROOVIE: Clan fix o2_copyfgtobg for "13 Easy Pieces" puzzle


Commit: e60ac866b3405f4bbadedfbb679e556df5bd117e
    https://github.com/scummvm/scummvm/commit/e60ac866b3405f4bbadedfbb679e556df5bd117e
Author: Die4Ever (die4ever2005 at gmail.com)
Date: 2022-01-04T01:20:02-06:00

Commit Message:
GROOVIE: Clan fix o2_copyfgtobg for "13 Easy Pieces" puzzle

Changed paths:
    engines/groovie/script.cpp
    engines/groovie/video/player.h
    engines/groovie/video/roq.cpp
    engines/groovie/video/roq.h


diff --git a/engines/groovie/script.cpp b/engines/groovie/script.cpp
index a659a6722f2..812a085470b 100644
--- a/engines/groovie/script.cpp
+++ b/engines/groovie/script.cpp
@@ -2230,10 +2230,8 @@ void Script::o2_copyfgtobg() {
 	uint8 arg = readScript8bits();
 	debugC(1, kDebugScript, "Groovie::Script: o2_copyfgtobg (0x%02X)", arg);
 	debugC(2, kDebugVideo, "Groovie::Script: @0x%04X: o2_copyfgtobg (0x%02X)", _currentInstruction-2, arg);
-	// return;
-
-	_vm->_graphicsMan->_background.copyFrom(_vm->_graphicsMan->_foreground);
-	_vm->_graphicsMan->updateScreen(&_vm->_graphicsMan->_background);
+	
+	_vm->_videoPlayer->copyfgtobg(arg);
 }
 
 void Script::o2_setscriptend() {
diff --git a/engines/groovie/video/player.h b/engines/groovie/video/player.h
index d8f9fe15f74..b22e1571318 100644
--- a/engines/groovie/video/player.h
+++ b/engines/groovie/video/player.h
@@ -45,6 +45,7 @@ public:
 	void fastForward();
 	bool isFastForwarding();
 	virtual void drawString(const Common::String text, int posx, int posy, uint32 color) {}
+	virtual void copyfgtobg(uint8 arg) {}
 
 protected:
 	// To be implemented by subclasses
diff --git a/engines/groovie/video/roq.cpp b/engines/groovie/video/roq.cpp
index 8f6c94968a5..e60a82ab0a5 100644
--- a/engines/groovie/video/roq.cpp
+++ b/engines/groovie/video/roq.cpp
@@ -227,12 +227,16 @@ void ROQPlayer::calcStartStop(int &start, int &stop, int origin, int length) {
 	}
 }
 
-void ROQPlayer::redrawRestoreArea(int screenOffset) {
+void ROQPlayer::redrawRestoreArea(int screenOffset, bool force) {
 	// Restore the background by data from the foreground. Only restore the area which was overwritten during the last frame
 	// Therefore we have the _restoreArea which reduces the area for restoring. We also use the _prevBuf to only overwrite the
 	// Pixels which have been written during the last frame. This means _restoreArea is just an optimization.
-	if (!_alpha)
-		return;
+	if (force) {
+		_restoreArea->top = 0;
+		_restoreArea->left = 0;
+		_restoreArea->bottom = _screen->h;
+		_restoreArea->right = _screen->w;
+	}
 	if (_restoreArea->isEmpty())
 		return;
 
@@ -247,7 +251,7 @@ void ROQPlayer::redrawRestoreArea(int screenOffset) {
 		byte *ovr = (byte *)_overBuf->getBasePtr(_restoreArea->left, line);
 
 		for (int i = 0; i < width; i++) {
-			if (prv[kAIndex] != 0) {
+			if (prv[kAIndex] != 0 || force) {
 				copyPixel(dst, src);
 				copyPixelWithA(dst, ovr);
 			}
@@ -314,7 +318,7 @@ void ROQPlayer::buildShowBuf() {
 	}
 
 	if (_alpha) {
-		redrawRestoreArea(screenOffset);
+		redrawRestoreArea(screenOffset, false);
 	}
 
 
@@ -971,6 +975,15 @@ void ROQPlayer::drawString(const Common::String text, int posx, int posy, uint32
 	_vm->_graphicsMan->change(); // Force Update screen after step
 }
 
+void ROQPlayer::copyfgtobg(uint8 arg) {
+	// TODO: the arg isn't handled yet
+	// but since we're doing a full redraw of all layers we might not need to care about the arg
+	debugC(2, kDebugVideo, "Groovie::ROQ: copyfgtobg (0x%02X)", arg);
+	
+	redrawRestoreArea(_screen->h == 480 ? 0 : 80, true);
+	_vm->_system->updateScreen();
+}
+
 ROQSoundPlayer::ROQSoundPlayer(GroovieEngine *vm) : ROQPlayer(vm) {
 	// HACK: we set the pixel format here to prevent a crash because this never plays any videos
 	// maybe we should just pre-create these buffers no matter what
diff --git a/engines/groovie/video/roq.h b/engines/groovie/video/roq.h
index 566928029b3..8ef6eae0bd4 100644
--- a/engines/groovie/video/roq.h
+++ b/engines/groovie/video/roq.h
@@ -46,6 +46,7 @@ public:
 	}
 
 	void drawString(const Common::String text, int posx, int posy, uint32 color) override;
+	void copyfgtobg(uint8 arg) override;
 
 protected:
 	uint16 loadInternal() override;
@@ -102,7 +103,7 @@ private:
 	bool _flagMasked; //!< Clear the video instead of play it, used in pente
 
 	// Buffers
-	void redrawRestoreArea(int screenOffset);
+	void redrawRestoreArea(int screenOffset, bool force);
 	void buildShowBuf();
 	byte _scaleX, _scaleY;
 	byte _offScale;




More information about the Scummvm-git-logs mailing list