[Scummvm-git-logs] scummvm master -> 89804fb45c4873d677415a09b5e05e4afb70a1de

mgerhardy martin.gerhardy at gmail.com
Mon Mar 1 17:03:18 UTC 2021


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

Summary:
f8b16991c9 TWINE: fixed dumpfile command
e84a7b85aa TWINE: fixed boundary calculation
1bbd257140 TWINE: holomap updates
16aca8531b TWINE: activate the palette switch for the holomap
89804fb45c TWINE: try to reduce flipping


Commit: f8b16991c9ed8eafc0bb42aa913630451eca99b7
    https://github.com/scummvm/scummvm/commit/f8b16991c9ed8eafc0bb42aa913630451eca99b7
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T17:58:54+01:00

Commit Message:
TWINE: fixed dumpfile command

Changed paths:
    engines/twine/debugger/console.cpp
    engines/twine/resources/hqr.cpp


diff --git a/engines/twine/debugger/console.cpp b/engines/twine/debugger/console.cpp
index b14eefd386..0608da5f69 100644
--- a/engines/twine/debugger/console.cpp
+++ b/engines/twine/debugger/console.cpp
@@ -328,8 +328,8 @@ bool TwinEConsole::doDumpFile(int argc, const char **argv) {
 		debugPrintf("Expected to get a a hqr file and an index\n");
 		return true;
 	}
-	const char *hqr = argv[0];
-	const int index = atoi(argv[1]);
+	const char *hqr = argv[1];
+	const int index = atoi(argv[2]);
 	const Common::String &targetFileName = Common::String::format("dumps/%03i-%s.dump", index, hqr);
 	HQR::dumpEntry(hqr, index, targetFileName.c_str());
 	return true;
diff --git a/engines/twine/resources/hqr.cpp b/engines/twine/resources/hqr.cpp
index 03b6e87ffa..cd1d645cf2 100644
--- a/engines/twine/resources/hqr.cpp
+++ b/engines/twine/resources/hqr.cpp
@@ -266,7 +266,7 @@ int32 getAllocEntry(uint8 **ptr, const char *filename, int32 index) {
 
 bool dumpEntry(const char *filename, int32 index, const char *targetFileName) {
 	Common::DumpFile out;
-	if (!out.open(targetFileName)) {
+	if (!out.open(targetFileName, true)) {
 		warning("Failed to save to %s", targetFileName);
 		return false;
 	}


Commit: e84a7b85aab2a88f6c5227dff9175bc370fd0167
    https://github.com/scummvm/scummvm/commit/e84a7b85aab2a88f6c5227dff9175bc370fd0167
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T17:58:54+01:00

Commit Message:
TWINE: fixed boundary calculation

Changed paths:
    engines/twine/renderer/renderer.cpp


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 240c5aa488..c819d6c43f 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1574,15 +1574,15 @@ static const int hmPolyOffset5 = 240; /* 0x00f0 */
 static const int hmPolyOffset6 = 300; /* 0x012c */
 
 void Renderer::fillHolomapPolygons(const Vertex &vertex1, const Vertex &vertex2, const Vertex &vertex3, const Vertex &vertex4, int32 &top, int32 &bottom) {
-	const int32 yBottom = (int32)(uint16)vertex1.y;
-	const int32 yTop = (int32)(uint16)vertex2.y;
+	const int32 yBottom = vertex1.y;
+	const int32 yTop = vertex2.y;
 	if (yBottom < yTop) {
 		top = MIN<int32>(yBottom, top);
 		bottom = MAX<int32>(yTop, bottom);
 		computeHolomapPolygon(yTop, (uint16)vertex2.x, yBottom, (uint16)vertex1.x, &_polyTab[hmPolyOffset1]);
 		computeHolomapPolygon(yTop, (uint16)vertex4.x, yBottom, (uint16)vertex3.x, &_polyTab[hmPolyOffset3]);
 		computeHolomapPolygon(yTop, (uint16)vertex4.y, yBottom, (uint16)vertex3.y, &_polyTab[hmPolyOffset4]);
-	} else if (yTop < yBottom) {
+	} else if (yBottom > yTop) {
 		top = MIN<int32>(yTop, top);
 		bottom = MAX<int32>(yBottom, bottom);
 		computeHolomapPolygon(yTop, (uint16)vertex2.x, yBottom, (uint16)vertex1.x, &_polyTab[hmPolyOffset2]);


Commit: 1bbd257140d172f5f8b9acbceea7f7ba4bc3b5fe
    https://github.com/scummvm/scummvm/commit/1bbd257140d172f5f8b9acbceea7f7ba4bc3b5fe
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T18:01:10+01:00

Commit Message:
TWINE: holomap updates

Changed paths:
    engines/twine/holomap.cpp
    engines/twine/renderer/renderer.cpp
    engines/twine/renderer/renderer.h


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 0c03794048..e558422605 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -202,18 +202,11 @@ void Holomap::prepareHolomapPolygons() {
 }
 
 bool Holomap::isTriangleVisible(const Vertex *vertices) const {
-	const int32 iVar3 = (int32)(vertices[0].y - vertices[2].y) * (int32)(vertices[1].x - vertices->x);
-	const int16 sVar5 = (int16)((uint32)iVar3 >> 0x10);
-	const int32 iVar4 = (int32)(vertices[0].x - vertices[2].x) * (int32)(vertices[1].y - vertices->y);
-	const int16 sVar6 = (int16)((uint32)iVar4 >> 0x10);
-	const uint16 uVar1 = (uint16)((uint16)iVar4 < (uint16)iVar3);
-	const int16 sVar2 = sVar6 - sVar5;
-	const bool bVal7 = sVar6 < sVar5;
-	const bool bVal8 = sVar2 < uVar1;
-	if ((bVal7 != bVal8) != ((int16)(sVar2 - uVar1) < 0)) {
-		return true;
-	}
-	return false;
+	const int32 iVar2 = ((int32)vertices[1].x - (int32)vertices[0].x) *
+						((int32)vertices[0].y - (int32)vertices[2].y);
+	const int32 iVar1 = ((int32)vertices[1].y - (int32)vertices[0].y) *
+						((int32)vertices[0].x - (int32)vertices[2].x);
+	return iVar2 - iVar1 != 0 && iVar1 <= iVar2;
 }
 
 void Holomap::renderHolomapSurfacePolygons() {
@@ -226,52 +219,38 @@ void Holomap::renderHolomapSurfacePolygons() {
 		Vertex vertexCoordinates[3];
 		vertexCoordinates[0].x = pos1.x;
 		vertexCoordinates[0].y = pos1.y;
-		vertexCoordinates[0].colorIndex = 0;
 		vertexCoordinates[1].x = pos2.x;
 		vertexCoordinates[1].y = pos2.y;
-		vertexCoordinates[1].colorIndex = 0;
 		vertexCoordinates[2].x = pos3.x;
 		vertexCoordinates[2].y = pos3.y;
-		vertexCoordinates[2].colorIndex = 0;
-		bool iVar1 = isTriangleVisible(vertexCoordinates);
-		if (iVar1) {
-			Vertex vertexCoordinates2[3];
-			vertexCoordinates2[0].x = pos1.unk1;
-			vertexCoordinates2[0].y = pos1.unk2;
-			vertexCoordinates2[0].colorIndex = 0;
-			vertexCoordinates2[1].x = pos2.unk1;
-			vertexCoordinates2[1].y = pos2.unk2;
-			vertexCoordinates2[1].colorIndex = 0;
-			vertexCoordinates2[2].x = pos3.unk1;
-			vertexCoordinates2[2].y = pos3.unk2;
-			vertexCoordinates2[2].colorIndex = 0;
-			_engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexCoordinates2);
+		if (isTriangleVisible(vertexCoordinates)) {
+			Vertex vertexAngles[3];
+			vertexAngles[0].x = pos1.unk1;
+			vertexAngles[0].y = pos1.unk2;
+			vertexAngles[1].x = pos2.unk1;
+			vertexAngles[1].y = pos2.unk2;
+			vertexAngles[2].x = pos3.unk1;
+			vertexAngles[2].y = pos3.unk2;
+			_engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexAngles);
 		}
 		const HolomapProjectedPos &pos4 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 33];
 		const HolomapProjectedPos &pos5 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 34];
 		const HolomapProjectedPos &pos6 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 1];
 		vertexCoordinates[0].x = pos4.x;
 		vertexCoordinates[0].y = pos4.y;
-		vertexCoordinates[0].colorIndex = 0;
 		vertexCoordinates[1].x = pos5.x;
 		vertexCoordinates[1].y = pos5.y;
-		vertexCoordinates[1].colorIndex = 0;
 		vertexCoordinates[2].x = pos6.x;
 		vertexCoordinates[2].y = pos6.y;
-		vertexCoordinates[2].colorIndex = 0;
-		iVar1 = isTriangleVisible(vertexCoordinates);
-		if (iVar1) {
-			Vertex vertexCoordinates2[3];
-			vertexCoordinates2[0].x = pos4.unk1;
-			vertexCoordinates2[0].y = pos4.unk2;
-			vertexCoordinates2[0].colorIndex = 0;
-			vertexCoordinates2[1].x = pos5.unk1;
-			vertexCoordinates2[1].y = pos5.unk2;
-			vertexCoordinates2[1].colorIndex = 0;
-			vertexCoordinates2[2].x = pos6.unk1;
-			vertexCoordinates2[2].y = pos6.unk2;
-			vertexCoordinates2[2].colorIndex = 0;
-			_engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexCoordinates2);
+		if (isTriangleVisible(vertexCoordinates)) {
+			Vertex vertexAngles[3];
+			vertexAngles[0].x = pos4.unk1;
+			vertexAngles[0].y = pos4.unk2;
+			vertexAngles[1].x = pos5.unk1;
+			vertexAngles[1].y = pos5.unk2;
+			vertexAngles[2].x = pos6.unk1;
+			vertexAngles[2].y = pos6.unk2;
+			_engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexAngles);
 		}
 	}
 }
@@ -626,7 +605,6 @@ void Holomap::processHolomap() {
 			redraw = false;
 			const Common::Rect rect(170, 0, 470, 330);
 			_engine->_interface->drawFilledRect(rect, COLOR_BLACK);
-			drawHolomapText(_engine->width() / 2, 25, "HoloMap");
 			_engine->_renderer->setBaseRotation(xRot, yRot, 0, true);
 			_engine->_renderer->setLightVector(xRot, yRot, 0);
 			renderLocations(xRot, yRot, 0, false);
@@ -636,6 +614,7 @@ void Holomap::processHolomap() {
 			_engine->_renderer->baseRotPos.z = 9500;
 			renderHolomapSurfacePolygons();
 			renderLocations(xRot, yRot, 0, true);
+			drawHolomapText(_engine->width() / 2, 25, "HoloMap");
 			if (rotate) {
 				_engine->_menu->drawBox(300, 170, 340, 210);
 			}
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index c819d6c43f..4c06336d60 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -31,8 +31,8 @@
 #include "twine/renderer/shadeangletab.h"
 #include "twine/resources/resources.h"
 #include "twine/scene/actor.h"
-#include "twine/scene/movements.h"
 #include "twine/scene/grid.h"
+#include "twine/scene/movements.h"
 #include "twine/shared.h"
 #include "twine/twine.h"
 
@@ -51,9 +51,17 @@ Renderer::~Renderer() {
 }
 
 void Renderer::init(int32 w, int32 h) {
-	_polyTabSize = _engine->height() * 2;
-	_polyTab = (int16*)malloc(_polyTabSize * sizeof(int16));
-	_polyTab2 = (int16*)malloc(_polyTabSize * sizeof(int16));
+	_polyTabSize = _engine->height() * 6;
+	_polyTab = (int16 *)malloc(_polyTabSize * sizeof(int16));
+	_polyTab2 = (int16 *)malloc(_polyTabSize * sizeof(int16));
+	_holomap_polytab_1_1 = &_polyTab[_engine->height() * 0];
+	_holomap_polytab_1_2 = &_polyTab[_engine->height() * 2];
+	_holomap_polytab_1_3 = &_polyTab[_engine->height() * 3];
+	_holomap_polytab_2_3 = &_polyTab[_engine->height() * 5];
+	_holomap_polytab_2_2 = &_polyTab[_engine->height() * 4];
+	_holomap_polytab_2_1 = &_polyTab[_engine->height() * 1];
+	_holomap_polytab_1_2_ptr = _holomap_polytab_1_2;
+	_holomap_polytab_1_3_ptr = _holomap_polytab_1_3;
 }
 
 int32 Renderer::projectPositionOnScreen(int32 cX, int32 cY, int32 cZ) {
@@ -745,7 +753,7 @@ void Renderer::renderPolygonsGouraud(uint8 *out, int vtop, int32 vsize, int32 co
 		int16 colorSize = stopColor - startColor;
 
 		int16 stop = ptr1[screenHeight]; // stop
-		int16 start = ptr1[0];            // start
+		int16 start = ptr1[0];           // start
 
 		ptr1++;
 		uint8 *out2 = start + out;
@@ -839,8 +847,8 @@ void Renderer::renderPolygonsDither(uint8 *out, int vtop, int32 vsize, int32 col
 		renderLoop = screenHeight;
 	}
 	for (int32 currentLine = 0; currentLine < renderLoop; ++currentLine) {
-		int16 stop = ptr1[screenHeight];  // stop
-		int16 start = ptr1[0];            // start
+		int16 stop = ptr1[screenHeight]; // stop
+		int16 start = ptr1[0];           // start
 		ptr1++;
 		int32 hsize = stop - start;
 		if (hsize < 0) {
@@ -1162,7 +1170,7 @@ uint8 *Renderer::preparePolygons(Common::MemoryReadStream &stream, int32 &numOfP
 }
 
 const Renderer::RenderCommand *Renderer::depthSortRenderCommands(int32 numOfPrimitives) {
-	Common::sort(&_renderCmds[0], &_renderCmds[numOfPrimitives], [] (const RenderCommand &lhs, const RenderCommand &rhs) {return lhs.depth > rhs.depth;});
+	Common::sort(&_renderCmds[0], &_renderCmds[numOfPrimitives], [](const RenderCommand &lhs, const RenderCommand &rhs) { return lhs.depth > rhs.depth; });
 	return _renderCmds;
 }
 
@@ -1524,121 +1532,125 @@ void Renderer::computeHolomapPolygon(int32 top, int32 x1, int32 bottom, int32 x2
 		minX = x2;
 		x2 = x1;
 	}
-	uint32 deltaY = top - minY;
+	const uint32 deltaY = top - minY;
 	int16 *currentPolygonTabEntry = &polygonTabPtr[minY];
-	if (x2 <= minX) {
-		uint32 deltaX = (uint32)(uint16)((int16)minX - (int16)x2) << 0x10;
-		uint32 deltaRatio = deltaX / deltaY;
-		minY = deltaY + 1;
-		deltaRatio = deltaRatio << 0x10 | deltaRatio >> 0x10;
-		bool bVar5 = false;
-		deltaY = (x2 & 0xffffU) |
-				 (uint32)(uint16)(((uint16)(deltaX % deltaY >> 1) & 0x7fff) + 0x7fff) << 0x10;
-		for (int32 y = 0; y < minY; ++y) {
-			if (currentPolygonTabEntry >= _polyTab + _polyTabSize) {
-				break;
+	if (minX < x2) {
+		const uint32 deltaX = (x2 - minX) * 0x10000;
+		const uint32 deltaRatio = deltaX / deltaY;
+		int32 iVar01 = (deltaRatio % deltaY >> 1) + 0x7fff;
+		for (uint32 y = 0; y <= deltaY; ++y) {
+			if (currentPolygonTabEntry < _polyTab || currentPolygonTabEntry >= _polyTab + _polyTabSize) {
+				currentPolygonTabEntry++;
+				continue;
+			}
+			*currentPolygonTabEntry++ = (int16)x2;
+			x2 -= (deltaRatio >> 0x10);
+			if ((iVar01 & 0xffff0000) != 0) {
+				x2 += (iVar01 >> 0x10);
+				iVar01 = iVar01 & 0xffff;
 			}
-			*currentPolygonTabEntry++ = (int16)deltaY;
-			deltaX = (uint32)bVar5;
-			uint32 uVar1 = deltaY + deltaRatio;
-			// CARRY4: Return true if there is an arithmetic overflow when adding 'x' and 'y' as unsigned integers.
-			// bVar5 = CARRY4(deltaY, deltaRatio) || CARRY4(uVar1, deltaX);
-			bVar5 = deltaY > deltaRatio || uVar1 > deltaX;
-			deltaY = uVar1 + deltaX;
+			iVar01 -= (deltaRatio & 0xffff);
 		}
 	} else {
-		uint32 deltaX = (uint32)(uint16)((int16)x2 - (int16)minX) << 0x10;
-		uint32 deltaRatio = deltaX / deltaY;
-		minY = deltaY + 1;
-		deltaRatio = deltaRatio << 0x10 | deltaRatio >> 0x10;
-		bool bVar5 = false;
-		deltaY = (x2 & 0xffffU) | (uint32)(uint16)(((uint16)(deltaX % deltaY >> 1) & 0x7fff) + 0x7fff) << 0x10;
-		for (int32 y = 0; y < minY; ++y) {
-			if (currentPolygonTabEntry >= _polyTab + _polyTabSize) {
-				break;
+		const uint32 deltaX = (minX - x2) * 0x10000;
+		const uint32 deltaRatio = deltaX / deltaY;
+		int32 iVar01 = (deltaX % deltaY >> 1) + 0x7fff;
+		for (uint32 y = 0; y <= deltaY; ++y) {
+			if (currentPolygonTabEntry < _polyTab || currentPolygonTabEntry >= _polyTab + _polyTabSize) {
+				currentPolygonTabEntry++;
+				continue;
+			}
+			*currentPolygonTabEntry++ = (int16)x2;
+			x2 += (deltaRatio >> 0x10);
+			if ((iVar01 & 0xffff0000) != 0) {
+				x2 += (iVar01 >> 0x10);
+				iVar01 = iVar01 & 0xffff;
 			}
-			*currentPolygonTabEntry++ = (int16)deltaY;
-			deltaX = (uint32)bVar5;
-			uint32 uVar1 = deltaY - deltaRatio;
-			bVar5 = deltaY < deltaRatio || uVar1 < deltaX;
-			deltaY = uVar1 - deltaX;
+			iVar01 += (deltaRatio & 0xffff);
 		}
 	}
 }
 
-static const int hmPolyOffset1 = 0;   /* 0x0000 */
-static const int hmPolyOffset2 = 60;  /* 0x003c */
-static const int hmPolyOffset3 = 120; /* 0x0078 */
-static const int hmPolyOffset4 = 180; /* 0x00b4 */
-static const int hmPolyOffset5 = 240; /* 0x00f0 */
-static const int hmPolyOffset6 = 300; /* 0x012c */
-
-void Renderer::fillHolomapPolygons(const Vertex &vertex1, const Vertex &vertex2, const Vertex &vertex3, const Vertex &vertex4, int32 &top, int32 &bottom) {
+void Renderer::fillHolomapPolygons(const Vertex &vertex1, const Vertex &vertex2, const Vertex &angles1, const Vertex &angles2, int32 &top, int32 &bottom) {
 	const int32 yBottom = vertex1.y;
 	const int32 yTop = vertex2.y;
 	if (yBottom < yTop) {
-		top = MIN<int32>(yBottom, top);
-		bottom = MAX<int32>(yTop, bottom);
-		computeHolomapPolygon(yTop, (uint16)vertex2.x, yBottom, (uint16)vertex1.x, &_polyTab[hmPolyOffset1]);
-		computeHolomapPolygon(yTop, (uint16)vertex4.x, yBottom, (uint16)vertex3.x, &_polyTab[hmPolyOffset3]);
-		computeHolomapPolygon(yTop, (uint16)vertex4.y, yBottom, (uint16)vertex3.y, &_polyTab[hmPolyOffset4]);
+		if (yBottom < top) {
+			top = yBottom;
+		}
+		if (bottom < yTop) {
+			bottom = yTop;
+		}
+		computeHolomapPolygon(yTop, (uint16)vertex2.x, yBottom, (uint16)vertex1.x, _holomap_polytab_1_1);
+		computeHolomapPolygon(yTop, (uint16)angles2.x, yBottom, (uint16)angles1.x, _holomap_polytab_1_2);
+		computeHolomapPolygon(yTop, (uint16)angles2.y, yBottom, (uint16)angles1.y, _holomap_polytab_1_3);
 	} else if (yBottom > yTop) {
-		top = MIN<int32>(yTop, top);
-		bottom = MAX<int32>(yBottom, bottom);
-		computeHolomapPolygon(yTop, (uint16)vertex2.x, yBottom, (uint16)vertex1.x, &_polyTab[hmPolyOffset2]);
-		computeHolomapPolygon(yTop, (uint16)vertex4.x, yBottom, (uint16)vertex3.x, &_polyTab[hmPolyOffset5]);
-		computeHolomapPolygon(yTop, (uint16)vertex4.y, yBottom, (uint16)vertex3.y, &_polyTab[hmPolyOffset6]);
+		if (bottom < yBottom) {
+			bottom = yBottom;
+		}
+		if (yTop < top) {
+			top = yTop;
+		}
+		computeHolomapPolygon(yTop, (uint16)vertex2.x, yBottom, (uint16)vertex1.x, _holomap_polytab_2_1);
+		computeHolomapPolygon(yTop, (uint16)angles2.x, yBottom, (uint16)angles1.x, _holomap_polytab_2_2);
+		computeHolomapPolygon(yTop, (uint16)angles2.y, yBottom, (uint16)angles1.y, _holomap_polytab_2_3);
 	}
 }
 
-void Renderer::renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex vertexCoordinates2[3]) {
+void Renderer::renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex vertexAngles[3]) {
 	int32 top = 32000;
 	int32 bottom = -32000;
-	fillHolomapPolygons(vertexCoordinates[0], vertexCoordinates[1], vertexCoordinates2[0], vertexCoordinates2[1], top, bottom);
-	fillHolomapPolygons(vertexCoordinates[1], vertexCoordinates[2], vertexCoordinates2[1], vertexCoordinates2[2], top, bottom);
-	fillHolomapPolygons(vertexCoordinates[2], vertexCoordinates[0], vertexCoordinates2[2], vertexCoordinates2[0], top, bottom);
+	fillHolomapPolygons(vertexCoordinates[0], vertexCoordinates[1], vertexAngles[0], vertexAngles[1], top, bottom);
+	fillHolomapPolygons(vertexCoordinates[1], vertexCoordinates[2], vertexAngles[1], vertexAngles[2], top, bottom);
+	fillHolomapPolygons(vertexCoordinates[2], vertexCoordinates[0], vertexAngles[2], vertexAngles[0], top, bottom);
 	renderHolomapPolygons(top, bottom);
 }
 
 void Renderer::renderHolomapPolygons(int32 top, int32 bottom) {
-	uint8 *out = (uint8 *)_engine->frontVideoBuffer.getBasePtr(0, top);
-	int32 vsize = bottom - top + 1;
-	const int16 *polyTabPtr = &_polyTab[top];
-	int32 currentLine = top;
-	const void* pixelBegin = _engine->frontVideoBuffer.getBasePtr(0, 0);
-	const void* pixelEnd = _engine->frontVideoBuffer.getBasePtr(_engine->frontVideoBuffer.w - 1, _engine->frontVideoBuffer.h - 1);
-	do {
-		if (currentLine >= 0 && currentLine < _engine->height()) {
-			const int32 polyTabVal = (int32)*polyTabPtr;
-			uint8 *pixel = (uint8 *)(out + polyTabVal);
-			const int32 yHeight = polyTabPtr[hmPolyOffset2] - polyTabVal;
-			if (yHeight != 0 && polyTabVal <= polyTabPtr[hmPolyOffset2]) {
-				const int32 polyTabVal2 = (int32)(1 - ((uint32)(uint16)polyTabPtr[hmPolyOffset4] -
-													(uint32)(uint16)polyTabPtr[hmPolyOffset6])) /
-										yHeight;
-				uint32 uVar3 = (uint32)(uint16)polyTabPtr[hmPolyOffset3];
-				const int32 iVar1 = (int32)(((uint16)polyTabPtr[hmPolyOffset5] - uVar3) + 1) / yHeight;
-				uint16 uVar2 = *(const uint16 *)&polyTabPtr[hmPolyOffset4];
-				// int16 holomap_maybe_DAT_00433430 = iVar2;
-				// int16 holomap_maybe_DAT_00433434 = iVar1;
-				for (int32 i = 0; i < yHeight; ++i) {
-					const uint32 idx = ((uVar2 & 0xffffff00) | uVar3 >> 8);
-					if (pixel < pixelBegin || pixel >= pixelEnd) {
-						break;
-					}
-					if (idx >= _engine->_resources->holomapImageSize) {
-						continue;
-					}
-					*pixel++ = _engine->_resources->holomapImagePtr[idx];
-					uVar3 = (uint32)(uint16)((int16)uVar3 + (int16)iVar1);
-					uVar2 = ((uint16)(uVar2 & 0xffffff00) | (uVar2 & 0xff)) + (int16)polyTabVal2;
+	const void *pixelBegin = _engine->frontVideoBuffer.getBasePtr(0, 0);
+	const void *pixelEnd = _engine->frontVideoBuffer.getBasePtr(_engine->frontVideoBuffer.w - 1, _engine->frontVideoBuffer.h - 1);
+	if (top < 0 || top >= _engine->frontVideoBuffer.h) {
+		return;
+	}
+	uint8 *screenBufPtr = (uint8 *)_engine->frontVideoBuffer.getBasePtr(0, top);
+
+	const int16 *lholomap_polytab_1_1 = _holomap_polytab_1_1 + top;
+	const int16 *lholomap_polytab_2_1 = _holomap_polytab_2_1 + top;
+	const uint16 *lholomap_polytab_1_2 = (const uint16 *)(_holomap_polytab_1_2 + top);
+	const uint16 *lholomap_polytab_1_3 = (const uint16 *)(_holomap_polytab_1_3 + top);
+	const uint16 *lholomap_polytab_2_2 = (const uint16 *)(_holomap_polytab_2_2 + top);
+	const uint16 *lholomap_polytab_2_3 = (const uint16 *)(_holomap_polytab_2_3 + top);
+
+	int32 yHeight = bottom - top;
+	while (yHeight > -1) {
+		const int16 left = *lholomap_polytab_1_1++;
+		const int16 right = *lholomap_polytab_2_1++;
+		const uint16 x_1_2 = *lholomap_polytab_1_2++;
+		const uint16 x_1_3 = *lholomap_polytab_1_3++;
+		const uint16 x_2_2 = *lholomap_polytab_2_2++;
+		const uint16 x_2_3 = *lholomap_polytab_2_3++;
+		int16 width = right - left;
+		if (width > 0) {
+			uint8 *pixelBufPtr = screenBufPtr + left;
+			const int32 iWidth = (int32)width;
+			uint32 uVar1 = (uint32)x_1_3;
+			uint32 uVar3 = (uint32)x_1_2;
+			for (int16 i = 0; i < width; ++i) {
+				const uint32 holomapImageOffset = (uint32)((int32)uVar3 >> 8 & 0xffU) | (uVar1 & 0xff00);
+				assert(holomapImageOffset < _engine->_resources->holomapImageSize);
+				if (pixelBufPtr < pixelBegin || pixelBufPtr > pixelEnd) {
+					++pixelBufPtr;
+				} else {
+					//debug("holomapImageOffset: %i", holomapImageOffset);
+					*pixelBufPtr++ = _engine->_resources->holomapImagePtr[holomapImageOffset];
 				}
+				uVar1 += (int32)(((uint32)x_2_3 - (uint32)x_1_3) + 1) / iWidth;
+				uVar3 += (int32)(((uint32)x_2_2 - (uint32)x_1_2) + 1) / iWidth;
 			}
 		}
-		out += _engine->frontVideoBuffer.w;
-		++polyTabPtr;
-		++currentLine;
-	} while (--vsize);
+		screenBufPtr += _engine->frontVideoBuffer.pitch;
+		--yHeight;
+	}
 }
 
 } // namespace TwinE
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 7689f3070e..4cbccea70e 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -357,6 +357,14 @@ private:
 	int32 _polyTabSize = 0;
 	int16 *_polyTab = nullptr;
 	int16 *_polyTab2 = nullptr;
+	int16* _holomap_polytab_1_1 = nullptr;
+	int16* _holomap_polytab_1_2 = nullptr;
+	int16* _holomap_polytab_1_3 = nullptr;
+	int16* _holomap_polytab_2_3 = nullptr;
+	int16* _holomap_polytab_2_2 = nullptr;
+	int16* _holomap_polytab_2_1 = nullptr;
+	int16* _holomap_polytab_1_2_ptr = nullptr;
+	int16* _holomap_polytab_1_3_ptr = nullptr;
 
 	bool isUsingOrthoProjection = false;
 
@@ -428,7 +436,7 @@ public:
 
 	void renderInventoryItem(int32 x, int32 y, const uint8 *bodyPtr, int32 angle, int32 param);
 
-	void renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex vertexCoordinates2[3]);
+	void renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex vertexAngles[3]);
 };
 
 } // namespace TwinE


Commit: 16aca8531b71072fdef076a5933b21b663c273a5
    https://github.com/scummvm/scummvm/commit/16aca8531b71072fdef076a5933b21b663c273a5
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T18:01:10+01:00

Commit Message:
TWINE: activate the palette switch for the holomap

Changed paths:
    engines/twine/flamovies.cpp
    engines/twine/holomap.cpp
    engines/twine/menu/menuoptions.cpp
    engines/twine/renderer/redraw.cpp
    engines/twine/renderer/screens.cpp
    engines/twine/resources/resources.cpp
    engines/twine/scene/gamestate.cpp
    engines/twine/script/script_life_v1.cpp
    engines/twine/twine.cpp
    engines/twine/twine.h


diff --git a/engines/twine/flamovies.cpp b/engines/twine/flamovies.cpp
index 721cae7081..a8e3c75b36 100644
--- a/engines/twine/flamovies.cpp
+++ b/engines/twine/flamovies.cpp
@@ -411,6 +411,7 @@ void FlaMovies::playFlaMovie(const char *flaName) {
 				} else {
 					_engine->setPalette(_engine->_screens->paletteRGBACustom);
 				}
+				_engine->flip();
 			}
 
 			// TRICKY: fade in tricky
diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index e558422605..6a2adb0873 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -317,7 +317,6 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 	_engine->_renderer->setCameraAngle(0, 0, 0, data.x, data.y, data.z, 5300);
 
 	renderHolomapSurfacePolygons();
-	_engine->flip();
 
 	const Location &loc = _locations[data.locationIdx];
 	renderHolomapModel(_engine->_resources->holomapPointModelPtr, loc.x, loc.y, 0);
@@ -336,8 +335,8 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 	int32 frameTime = _engine->lbaTime;
 	int16 trajAnimFrameIdx = 0;
 
-	//int32 local18 = 0;
-	//bool fadeInPalette = true;
+	int32 local18 = 0;
+	bool fadeInPalette = true;
 	_engine->_input->enableKeyMap(holomapKeyMapId);
 	for (;;) {
 		ScopedFPS scopedFps;
@@ -346,19 +345,17 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 			break;
 		}
 
-#if 0
 		if (!fadeInPalette && local18 < _engine->lbaTime) {
-			const Common::Rect rect(170, 50, 470, 330);
-			_engine->_interface->setClip(rect);
+			//const Common::Rect rect(170, 50, 470, 330);
+			//_engine->_interface->setClip(rect);
 			_engine->setPalette(192, 32, &paletteHolomap[3 * holomapPaletteIndex++]);
-			_engine->copyBlockPhys(rect);
-			_engine->_interface->resetClip();
+			//_engine->copyBlockPhys(rect);
+			//_engine->_interface->resetClip();
 			if (holomapPaletteIndex == 32) {
 				holomapPaletteIndex = 0;
 			}
 			local18 = _engine->lbaTime + 3;
 		}
-#endif
 
 		const int16 newAngle = move.getRealAngle(_engine->lbaTime);
 		if (move.numOfStep == 0) {
@@ -398,12 +395,11 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 			renderHolomapModel(_engine->_resources->holomapPointModelPtr, modelX, modelY, 0);
 			trajAnimFrameIdx = trajAnimFrameIdx + 1;
 		}
-#if 0
+
 		if (fadeInPalette) {
 			fadeInPalette = false;
 			_engine->_screens->fadeToPal(_engine->_screens->paletteRGBA);
 		}
-#endif
 	}
 	_engine->_screens->fadeToBlack(_engine->_screens->paletteRGBA);
 	_engine->_screens->fadeIn(_engine->_screens->paletteRGBA);
@@ -531,8 +527,8 @@ void Holomap::processHolomap() {
 	int32 yRot = ClampAngle(_locations[currentLocation].y);
 	bool rotate = false;
 	bool redraw = true;
-	// int local18 = 0;
-	// bool fadeInPalette = true;
+	int local18 = 0;
+	bool fadeInPalette = true;
 	_engine->_input->enableKeyMap(holomapKeyMapId);
 	for (;;) {
 		FrameMarker frame;
@@ -587,19 +583,18 @@ void Holomap::processHolomap() {
 			redraw = true;
 		}
 
-#if 0
 		if (!fadeInPalette && local18 < _engine->lbaTime) {
-			const Common::Rect rect(170, 50, 470, 330);
-			_engine->_interface->setClip(rect);
+			//const Common::Rect rect(170, 50, 470, 330);
+			//_engine->_interface->setClip(rect);
 			_engine->setPalette(192, 32, &paletteHolomap[3 * holomapPaletteIndex++]);
-			_engine->copyBlockPhys(rect);
-			_engine->_interface->resetClip();
+			//_engine->copyBlockPhys(rect);
+			//_engine->_interface->resetClip();
 			if (holomapPaletteIndex == 32) {
 				holomapPaletteIndex = 0;
 			}
 			local18 = _engine->lbaTime + 3;
+			redraw = true;
 		}
-#endif
 
 		if (redraw) {
 			redraw = false;
@@ -632,12 +627,10 @@ void Holomap::processHolomap() {
 
 		//_engine->_screens->copyScreen(_engine->workVideoBuffer, _engine->frontVideoBuffer);
 		//_engine->flip();
-#if 0
 		if (fadeInPalette) {
 			fadeInPalette = false;
 			_engine->_screens->fadeToPal(_engine->_screens->paletteRGBA);
 		}
-#endif
 	}
 
 	_engine->_text->drawTextBoxBackground = true;
diff --git a/engines/twine/menu/menuoptions.cpp b/engines/twine/menu/menuoptions.cpp
index 7a4d2be8a8..061c663b15 100644
--- a/engines/twine/menu/menuoptions.cpp
+++ b/engines/twine/menu/menuoptions.cpp
@@ -86,13 +86,13 @@ void MenuOptions::newGame() {
 
 	_engine->_text->textClipSmall();
 	_engine->_screens->clearScreen();
-	_engine->flip();
 
 	_engine->_text->drawTextBoxBackground = true;
 	_engine->_text->renderTextTriangle = false;
 
 	// set main palette back
 	_engine->setPalette(_engine->_screens->paletteRGBA);
+	_engine->flip();
 }
 
 void MenuOptions::showCredits() {
@@ -120,8 +120,8 @@ void MenuOptions::showEndSequence() {
 	_engine->_flaMovies->playFlaMovie(FLA_THEEND);
 
 	_engine->_screens->clearScreen();
-	_engine->flip();
 	_engine->setPalette(_engine->_screens->paletteRGBA);
+	_engine->flip();
 }
 
 void MenuOptions::drawSelectableCharacter(int32 x, int32 y, Common::Rect &dirtyRect) {
diff --git a/engines/twine/renderer/redraw.cpp b/engines/twine/renderer/redraw.cpp
index af711df875..42e6a43838 100644
--- a/engines/twine/renderer/redraw.cpp
+++ b/engines/twine/renderer/redraw.cpp
@@ -693,6 +693,7 @@ void Redraw::redrawEngineActions(bool bgRedraw) {
 		if (_engine->_scene->needChangeScene != -1 && _engine->_scene->needChangeScene != -2) {
 			_engine->_screens->fadeIn(_engine->_screens->paletteRGBA);
 			_engine->setPalette(_engine->_screens->paletteRGBA);
+			_engine->flip();
 		}
 	} else {
 		blitBackgroundAreas();
diff --git a/engines/twine/renderer/screens.cpp b/engines/twine/renderer/screens.cpp
index 989d27b1e6..f3220609c4 100644
--- a/engines/twine/renderer/screens.cpp
+++ b/engines/twine/renderer/screens.cpp
@@ -81,6 +81,7 @@ void Screens::loadImage(int32 index, int32 paletteIndex, bool fadeIn) {
 	} else {
 		_engine->setPalette(pal);
 	}
+	_engine->flip();
 }
 
 bool Screens::loadImageDelay(int32 index, int32 paletteIndex, int32 seconds) {
@@ -101,6 +102,7 @@ void Screens::fadeIn(uint32 *pal) {
 	}
 
 	_engine->setPalette(pal);
+	_engine->flip();
 }
 
 void Screens::fadeOut(uint32 *pal) {
@@ -147,6 +149,7 @@ void Screens::adjustPalette(uint8 r, uint8 g, uint8 b, const uint32 *rgbaPal, in
 	}
 
 	_engine->setPalette(pal);
+	_engine->flip();
 }
 
 void Screens::adjustCrossPalette(const uint32 *pal1, const uint32 *pal2) {
@@ -183,6 +186,7 @@ void Screens::adjustCrossPalette(const uint32 *pal1, const uint32 *pal2) {
 		}
 
 		_engine->setPalette(pal);
+		_engine->flip();
 		intensity++;
 	} while (intensity <= 100);
 }
@@ -208,6 +212,7 @@ void Screens::fadeToPal(const uint32 *pal) {
 	}
 
 	_engine->setPalette(pal);
+	_engine->flip();
 
 	palResetted = false;
 }
@@ -219,6 +224,7 @@ void Screens::blackToWhite() {
 		memset(pal, i, sizeof(pal));
 
 		_engine->setPalette(pal);
+		_engine->flip();
 	}
 }
 
@@ -227,6 +233,7 @@ void Screens::setBackPal() {
 	memset(paletteRGBA, 0, sizeof(paletteRGBA));
 
 	_engine->setPalette(paletteRGBA);
+	_engine->flip();
 
 	palResetted = true;
 }
diff --git a/engines/twine/resources/resources.cpp b/engines/twine/resources/resources.cpp
index da3e742648..093a3eae48 100644
--- a/engines/twine/resources/resources.cpp
+++ b/engines/twine/resources/resources.cpp
@@ -67,6 +67,7 @@ void Resources::initPalettes() {
 
 	_engine->_screens->convertPalToRGBA(_engine->_screens->palette, _engine->_screens->paletteRGBA);
 	_engine->setPalette(_engine->_screens->paletteRGBA);
+	_engine->flip();
 }
 
 void Resources::preloadSprites() {
diff --git a/engines/twine/scene/gamestate.cpp b/engines/twine/scene/gamestate.cpp
index e79b52032e..9f91d2d047 100644
--- a/engines/twine/scene/gamestate.cpp
+++ b/engines/twine/scene/gamestate.cpp
@@ -494,6 +494,7 @@ void GameState::processGameoverAnimation() {
 
 	// TODO: inSceneryView
 	_engine->setPalette(_engine->_screens->paletteRGBA);
+	_engine->flip();
 	_engine->_screens->copyScreen(_engine->frontVideoBuffer, _engine->workVideoBuffer);
 	uint8 *gameOverPtr = nullptr;
 	if (HQR::getAllocEntry(&gameOverPtr, Resources::HQR_RESS_FILE, RESSHQR_GAMEOVERMDL) == 0) {
diff --git a/engines/twine/script/script_life_v1.cpp b/engines/twine/script/script_life_v1.cpp
index f1d3464f86..5b2f1321ee 100644
--- a/engines/twine/script/script_life_v1.cpp
+++ b/engines/twine/script/script_life_v1.cpp
@@ -1561,6 +1561,7 @@ static int32 lSET_DARK_PAL(TwinEEngine *engine, LifeScriptContext &ctx) {
 	if (!engine->_screens->lockPalette) {
 		engine->_screens->convertPalToRGBA(engine->_screens->palette, engine->_screens->paletteRGBA);
 		engine->setPalette(engine->_screens->paletteRGBA);
+		engine->flip();
 	}
 	engine->_screens->useAlternatePalette = true;
 	return 0;
@@ -1574,6 +1575,7 @@ static int32 lSET_NORMAL_PAL(TwinEEngine *engine, LifeScriptContext &ctx) {
 	engine->_screens->useAlternatePalette = false;
 	if (!engine->_screens->lockPalette) {
 		engine->setPalette(engine->_screens->mainPaletteRGBA);
+		engine->flip();
 	}
 	return 0;
 }
@@ -1598,6 +1600,7 @@ static int32 lMESSAGE_SENDELL(TwinEEngine *engine, LifeScriptContext &ctx) {
 	engine->_screens->fadeToBlack(engine->_screens->paletteRGBACustom);
 	engine->_screens->clearScreen();
 	engine->setPalette(engine->_screens->paletteRGBA);
+	engine->flip();
 	return 0;
 }
 
diff --git a/engines/twine/twine.cpp b/engines/twine/twine.cpp
index 761a90d432..8cf7d2135c 100644
--- a/engines/twine/twine.cpp
+++ b/engines/twine/twine.cpp
@@ -572,8 +572,8 @@ void TwinEEngine::processBookOfBu() {
 	_text->initSceneTextBank();
 	_screens->fadeToBlack(_screens->paletteRGBACustom);
 	_screens->clearScreen();
-	flip();
 	setPalette(_screens->paletteRGBA);
+	flip();
 	_screens->lockPalette = true;
 }
 
@@ -1048,13 +1048,11 @@ void TwinEEngine::setPalette(const uint32 *palette) {
 		out += 3;
 		in += 4;
 	}
-	g_system->getPaletteManager()->setPalette(pal, 0, NUMOFCOLORS);
-	flip();
+	setPalette(0, NUMOFCOLORS, pal);
 }
 
-void TwinEEngine::setPalette(uint8 startColor, uint8 numColors, const byte *palette) {
+void TwinEEngine::setPalette(uint startColor, uint numColors, const byte *palette) {
 	g_system->getPaletteManager()->setPalette(palette, startColor, numColors);
-	flip();
 }
 
 void TwinEEngine::flip() {
diff --git a/engines/twine/twine.h b/engines/twine/twine.h
index ff745c5131..0386245688 100644
--- a/engines/twine/twine.h
+++ b/engines/twine/twine.h
@@ -326,7 +326,7 @@ public:
 	 * @param numColors the number of palette entries to be updated
 	 * @param palette palette to set in RGB
 	 */
-	void setPalette(uint8 startColor, uint8 numColors, const byte *palette);
+	void setPalette(uint startColor, uint numColors, const byte *palette);
 
 	/** Blit surface in the screen */
 	void flip();


Commit: 89804fb45c4873d677415a09b5e05e4afb70a1de
    https://github.com/scummvm/scummvm/commit/89804fb45c4873d677415a09b5e05e4afb70a1de
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-03-01T18:02:31+01:00

Commit Message:
TWINE: try to reduce flipping

Changed paths:
    engines/twine/holomap.cpp
    engines/twine/renderer/screens.cpp


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 6a2adb0873..519ee8851a 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -393,16 +393,18 @@ void Holomap::drawHolomapTrajectory(int32 trajectoryIndex) {
 				modelY = _locations[data.trajLocationIdx].y;
 			}
 			renderHolomapModel(_engine->_resources->holomapPointModelPtr, modelX, modelY, 0);
-			trajAnimFrameIdx = trajAnimFrameIdx + 1;
+			++trajAnimFrameIdx;
 		}
 
 		if (fadeInPalette) {
 			fadeInPalette = false;
-			_engine->_screens->fadeToPal(_engine->_screens->paletteRGBA);
+			// TODO: this does a flip - which puts stuff onto the screen that shouldn't be there
+			//_engine->_screens->fadeToPal(_engine->_screens->paletteRGBA);
 		}
 	}
-	_engine->_screens->fadeToBlack(_engine->_screens->paletteRGBA);
-	_engine->_screens->fadeIn(_engine->_screens->paletteRGBA);
+
+	_engine->_screens->clearScreen();
+	_engine->setPalette(_engine->_screens->paletteRGBA);
 	_engine->_gameState->initEngineProjections();
 	_engine->_interface->loadClip();
 
@@ -629,13 +631,14 @@ void Holomap::processHolomap() {
 		//_engine->flip();
 		if (fadeInPalette) {
 			fadeInPalette = false;
-			_engine->_screens->fadeToPal(_engine->_screens->paletteRGBA);
+			// TODO: this does a flip - which puts stuff onto the screen that shouldn't be there
+			//_engine->_screens->fadeToPal(_engine->_screens->paletteRGBA);
 		}
 	}
 
+	_engine->_screens->clearScreen();
 	_engine->_text->drawTextBoxBackground = true;
-	_engine->_screens->fadeToBlack(_engine->_screens->paletteRGBA);
-	_engine->_screens->fadeIn(_engine->_screens->paletteRGBA);
+	_engine->setPalette(_engine->_screens->paletteRGBA);
 	_engine->_scene->alphaLight = alphaLightTmp;
 	_engine->_scene->betaLight = betaLightTmp;
 
diff --git a/engines/twine/renderer/screens.cpp b/engines/twine/renderer/screens.cpp
index f3220609c4..d66a7e72af 100644
--- a/engines/twine/renderer/screens.cpp
+++ b/engines/twine/renderer/screens.cpp
@@ -88,6 +88,7 @@ bool Screens::loadImageDelay(int32 index, int32 paletteIndex, int32 seconds) {
 	loadImage(index, paletteIndex);
 	if (_engine->delaySkip(1000 * seconds)) {
 		adjustPalette(0, 0, 0, paletteRGBACustom, 100);
+		_engine->flip();
 		return true;
 	}
 	fadeOut(paletteRGBACustom);
@@ -149,7 +150,6 @@ void Screens::adjustPalette(uint8 r, uint8 g, uint8 b, const uint32 *rgbaPal, in
 	}
 
 	_engine->setPalette(pal);
-	_engine->flip();
 }
 
 void Screens::adjustCrossPalette(const uint32 *pal1, const uint32 *pal2) {
@@ -199,6 +199,7 @@ void Screens::fadeToBlack(const uint32 *pal) {
 	for (int32 i = 100; i >= 0; i -= 3) {
 		ScopedFPS scopedFps(50);
 		adjustPalette(0, 0, 0, pal, i);
+		_engine->flip();
 	}
 
 	palResetted = true;
@@ -209,6 +210,7 @@ void Screens::fadeToPal(const uint32 *pal) {
 		FrameMarker frame;
 		ScopedFPS scopedFps(50);
 		adjustPalette(0, 0, 0, pal, i);
+		_engine->flip();
 	}
 
 	_engine->setPalette(pal);
@@ -243,6 +245,7 @@ void Screens::fadePalRed(const uint32 *pal) {
 		FrameMarker frame;
 		ScopedFPS scopedFps(50);
 		adjustPalette(0xFF, 0, 0, pal, i);
+		_engine->flip();
 	}
 }
 
@@ -251,6 +254,7 @@ void Screens::fadeRedPal(const uint32 *pal) {
 		FrameMarker frame;
 		ScopedFPS scopedFps(50);
 		adjustPalette(0xFF, 0, 0, pal, i);
+		_engine->flip();
 	}
 }
 




More information about the Scummvm-git-logs mailing list