[Scummvm-git-logs] scummvm master -> 9b31e28c825dd277ceb82e9e5d612ebbfb3c1205

mgerhardy martin.gerhardy at gmail.com
Wed Feb 17 17:19:42 UTC 2021


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

Summary:
feb36d9543 TWINE: use blitFrom for scaling the plasma effect buffer
9907668402 TWINE: minor cleanup in computePolygons handling
4ea1869409 TWINE: added asserts to ensure that none of the buffer boundaries were exceeded
26c9bc19df TWINE: renamed method
12899f7e18 TWINE: moved holomap code into renderer.cpp
482a0e015b TWINE: hide Renderer method
ca24e2c79a TWINE: converted magic number
0753df26a0 TWINE: reduced visibility
b4796f7536 TWINE: converted to stack var
70532c881c TWINE: const
997a071301 TWINE: use polytab array
492ee9533a TWINE: replaced CARRY4
1cf9af2185 TWINE: renamed method
77998130f9 TWINE: use polytab
c67299c31f TWINE: renamed variables
3255ceba09 TWINE: renamed variables
85180081eb TWINE: renamed variables
43f9a04805 TWINE: renamed variables
f6de9f7eba TWINE: renamed variables
0f958ba871 TWINE: cleanup in renderHolomapVertices
24f401f253 TWINE: reduced code duplication
e066a60a0e TWINE: fixes in renderHolomapPolygons
9b31e28c82 TWINE: holomap polygon handling cleanup


Commit: feb36d954356e6145015fadf89edf0a326d25d75
    https://github.com/scummvm/scummvm/commit/feb36d954356e6145015fadf89edf0a326d25d75
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: use blitFrom for scaling the plasma effect buffer

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


diff --git a/engines/twine/menu/menu.cpp b/engines/twine/menu/menu.cpp
index 82b5e3b637..68c90cf738 100644
--- a/engines/twine/menu/menu.cpp
+++ b/engines/twine/menu/menu.cpp
@@ -233,7 +233,7 @@ void Menu::processPlasmaEffect(const Common::Rect &rect, int32 color) {
 		}
 	}
 	const Common::Rect prect(0, 0, PLASMA_WIDTH, PLASMA_HEIGHT);
-	_engine->frontVideoBuffer.transBlitFrom(_engine->imageBuffer, prect, rect);
+	_engine->frontVideoBuffer.blitFrom(_engine->imageBuffer, prect, rect);
 }
 
 void Menu::drawBox(const Common::Rect &rect) {


Commit: 990766840281fd3b68d1f6caa76532e8ac370830
    https://github.com/scummvm/scummvm/commit/990766840281fd3b68d1f6caa76532e8ac370830
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: minor cleanup in computePolygons handling

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index e9a3fe4951..41ae3d23ce 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -389,12 +389,7 @@ void Renderer::computeBoundingBox(Vertex *vertices, int32 numVertices, int &vlef
 	}
 }
 
-void Renderer::computePolygons(int16 polyRenderType, Vertex *vertices, int32 numVertices, int &vleft, int &vright, int &vtop, int &vbottom) {
-	if (numVertices <= 0) {
-		return;
-	}
-	computeBoundingBox(vertices, numVertices, vleft, vright, vtop, vbottom);
-
+void Renderer::computePolygons(int16 polyRenderType, const Vertex *vertices, int32 numVertices) {
 	uint8 vertexParam1 = vertices[numVertices - 1].colorIndex;
 	int16 currentVertexX = vertices[numVertices - 1].x;
 	int16 currentVertexY = vertices[numVertices - 1].y;
@@ -933,7 +928,11 @@ void Renderer::renderPolygons(const CmdRenderPolygon &polygon, Vertex *vertices)
 	int vright = 0;
 	int vtop = 0;
 	int vbottom = 0;
-	computePolygons(polygon.renderType, vertices, polygon.numVertices, vleft, vright, vtop, vbottom);
+
+	if (polygon.numVertices > 0) {
+		computeBoundingBox(vertices, polygon.numVertices, vleft, vright, vtop, vbottom);
+	}
+	computePolygons(polygon.renderType, vertices, polygon.numVertices);
 
 	uint8 *out = (uint8 *)_engine->frontVideoBuffer.getBasePtr(0, vtop);
 	const int32 vsize = vbottom - vtop + 1;
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 64a7feb9da..c6d0546063 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -375,7 +375,7 @@ private:
 	void renderPolygonsMarble(uint8 *out, int vtop, int32 vsize, int32 color) const;
 
 	void computeBoundingBox(Vertex *vertices, int32 numVertices, int &vleft, int &vright, int &vtop, int &vbottom) const;
-	void computePolygons(int16 polyRenderType, Vertex *vertices, int32 numVertices, int &vleft, int &vright, int &vtop, int &vbottom);
+	void computePolygons(int16 polyRenderType, const Vertex *vertices, int32 numVertices);
 
 	const RenderCommand *depthSortRenderCommands(int32 numOfPrimitives);
 	uint8 *preparePolygons(Common::MemoryReadStream &stream, int32 &numOfPrimitives, RenderCommand **renderCmds, uint8 *renderBufferPtr, ModelData *modelData);


Commit: 4ea18694092c5f85d954d21f0acea7088adab660
    https://github.com/scummvm/scummvm/commit/4ea18694092c5f85d954d21f0acea7088adab660
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: added asserts to ensure that none of the buffer boundaries were exceeded

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


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 68b053e513..ee60d9d81e 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -168,13 +168,13 @@ void Holomap::prepareHolomapProjectedPositions() {
 void Holomap::prepareHolomapPolygons() {
 	Common::MemoryReadStream stream(_engine->_resources->holomapSurfacePtr, _engine->_resources->holomapSurfaceSize);
 	int holomapSortArrayIdx = 0;
+	int holomapSurfaceArrayIdx = 0;
 	uint16 projectedIndex = 0;
 	_engine->_renderer->setBaseRotation(0, 0, 0);
 	for (int32 angle = -ANGLE_90; angle <= ANGLE_90; angle += ANGLE_11_25) {
 		int rotation = 0;
-		HolomapSurface* vec;
 		for (int32 stepWidth = ANGLE_11_25; stepWidth != 0; --stepWidth) {
-			vec = &_holomapSurface[holomapSortArrayIdx];
+			HolomapSurface* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
 			_engine->_renderer->getBaseRotationPosition(vec->x, vec->y, vec->z);
 			if (angle != ANGLE_90) {
 				_holomapSort[holomapSortArrayIdx].z = _engine->_renderer->destZ;
@@ -186,17 +186,19 @@ void Holomap::prepareHolomapPolygons() {
 			_projectedSurfacePositions[projectedIndex].y = _engine->_renderer->projPosY;
 			rotation += ANGLE_11_25;
 			++projectedIndex;
-			++holomapSortArrayIdx;
 		}
+		HolomapSurface* vec = &_holomapSurface[holomapSurfaceArrayIdx++];
 		_engine->_renderer->getBaseRotationPosition(vec->x, vec->y, vec->z);
 		_engine->_renderer->projectPositionOnScreen(_engine->_renderer->destX, _engine->_renderer->destY, _engine->_renderer->destZ);
 		_projectedSurfacePositions[projectedIndex].x = _engine->_renderer->projPosX;
 		_projectedSurfacePositions[projectedIndex].y = _engine->_renderer->projPosY;
 		rotation += ANGLE_11_25;
 		++projectedIndex;
-		++holomapSortArrayIdx;
 	}
-	qsort(_holomapSurface, ARRAYSIZE(_holomapSurface), sizeof(HolomapSurface), sortHolomapSurfaceCoordsByDepth);
+	assert(holomapSortArrayIdx <= ARRAYSIZE(_holomapSort));
+	assert(holomapSurfaceArrayIdx <= ARRAYSIZE(_holomapSurface));
+	assert(projectedIndex <= ARRAYSIZE(_projectedSurfacePositions));
+	qsort(_holomapSort, ARRAYSIZE(_holomapSort), sizeof(HolomapSort), sortHolomapSurfaceCoordsByDepth);
 }
 
 bool Holomap::vertices_FUN_00423ebb(const Vertex *vertices) const {
@@ -208,7 +210,7 @@ bool Holomap::vertices_FUN_00423ebb(const Vertex *vertices) const {
 	const int16 sVar2 = sVar6 - sVar5;
 	const bool bVal7 = sVar6 < sVar5;
 	const bool bVal8 = sVar2 < uVar1;
-	if ((bVal7 != bVal8) != (int16)(sVar2 - uVar1) < 0) {
+	if ((bVal7 != bVal8) != ((int16)(sVar2 - uVar1) < 0)) {
 		return true;
 	}
 	return false;
diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index 730547d503..0679ebc227 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -79,7 +79,7 @@ private:
 		int16 y = 0;
 		int16 z = 0;
 	};
-	HolomapSurface _holomapSurface[512];
+	HolomapSurface _holomapSurface[561];
 
 	struct HolomapSort {
 		int16 z = 0;


Commit: 26c9bc19dfe059b8ba80310fac4cef8d1c39202d
    https://github.com/scummvm/scummvm/commit/26c9bc19dfe059b8ba80310fac4cef8d1c39202d
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: renamed method

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


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index ee60d9d81e..4e3d92f36d 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -201,7 +201,7 @@ void Holomap::prepareHolomapPolygons() {
 	qsort(_holomapSort, ARRAYSIZE(_holomapSort), sizeof(HolomapSort), sortHolomapSurfaceCoordsByDepth);
 }
 
-bool Holomap::vertices_FUN_00423ebb(const Vertex *vertices) const {
+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);
@@ -411,7 +411,7 @@ void Holomap::renderHolomapSurfacePolygons() {
 		vertexCoordinates[1].y = pos2.y;
 		vertexCoordinates[2].x = pos3.x;
 		vertexCoordinates[2].y = pos3.y;
-		bool iVar1 = vertices_FUN_00423ebb(vertexCoordinates);
+		bool iVar1 = isTriangleVisible(vertexCoordinates);
 		if (iVar1) {
 			tex_coords_maybe_DAT_0043336a = pos1.unk1;
 			tex_coords_maybe_DAT_0043336c = pos1.unk2;
@@ -431,7 +431,7 @@ void Holomap::renderHolomapSurfacePolygons() {
 		vertexCoordinates[1].y = pos5.y;
 		vertexCoordinates[2].x = pos6.x;
 		vertexCoordinates[2].y = pos6.y;
-		iVar1 = vertices_FUN_00423ebb(vertexCoordinates);
+		iVar1 = isTriangleVisible(vertexCoordinates);
 		if (iVar1) {
 			tex_coords_maybe_DAT_0043336a = pos4.unk1;
 			tex_coords_maybe_DAT_0043336c = pos4.unk2;
diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index 0679ebc227..721178079e 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -52,7 +52,7 @@ private:
 	uint16 tex_coords_maybe_DAT_00433378 = 0;
 
 	void holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
-	bool vertices_FUN_00423ebb(const Vertex *vertices) const;
+	bool isTriangleVisible(const Vertex *vertices) const;
 	void vertices_FUN_00421010(Vertex *vertexCoordinates);
 	void vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int16 *vertexCoordinatePtr);
 


Commit: 12899f7e1887bcf7b086146c122d26cc229ecbb6
    https://github.com/scummvm/scummvm/commit/12899f7e1887bcf7b086146c122d26cc229ecbb6
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: moved holomap code into renderer.cpp

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


diff --git a/engines/twine/holomap.cpp b/engines/twine/holomap.cpp
index 4e3d92f36d..19c95006c5 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -216,188 +216,6 @@ bool Holomap::isTriangleVisible(const Vertex *vertices) const {
 	return false;
 }
 
-void Holomap::vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int16 *vertexCoordinatePtr) {
-#if 0
-	int32 minY = y2;
-	int32 minX = x1;
-	if (y1 < y2) {
-		minY = y1;
-		y1 = y2;
-		minX = x2;
-		x2 = x1;
-	}
-	uint32 deltaY = y1 - minY;
-	int16 *lVertexCoordPointer = (int16 *)(vertexCoordinatePtr + minY * 2);
-	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;
-		do {
-			*lVertexCoordPointer = (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);
-			deltaY = uVar1 + deltaX;
-			minY = minY + -1;
-			lVertexCoordPointer = lVertexCoordPointer + 1;
-		} while (minY != 0);
-	} 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;
-		do {
-			*lVertexCoordPointer = (int16)deltaY;
-			deltaX = (uint32)bVar5;
-			uint32 uVar1 = deltaY - deltaRatio;
-			bVar5 = deltaY < deltaRatio || uVar1 < deltaX;
-			deltaY = uVar1 - deltaX;
-			minY = minY + -1;
-			lVertexCoordPointer = lVertexCoordPointer + 1;
-		} while (minY != 0);
-	}
-#endif
-}
-
-void Holomap::vertices_FUN_00421010(Vertex *vertexCoordinates) {
-	clip_or_depth_DAT_00433444 = 32000;
-	y_DAT_00433448 = 0xffff8300;
-	uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
-	uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
-	if (y_uVar1 < y_uVar2) {
-		if (y_uVar1 <= 32000) {
-			clip_or_depth_DAT_00433444 = y_uVar1;
-		}
-		if (-32001 < (int32)y_uVar2) {
-			y_DAT_00433448 = y_uVar2;
-		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_004314ce*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a, nullptr /*(int16 *)&DAT_00431c4e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c, nullptr /*(int16 *)&polyTab2*/);
-	}
-	y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
-	y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
-	if (y_uVar2 < y_uVar1) {
-		if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
-			clip_or_depth_DAT_00433444 = y_uVar2;
-		}
-		if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
-			y_DAT_00433448 = y_uVar1;
-		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_0043188e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a, nullptr /*polyTab2 + 0x1e0*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c, nullptr /*(int16 *)&DAT_0043278e*/);
-	}
-	y_uVar1 = (uint32)(uint16)vertexCoordinates[1].y;
-	y_uVar2 = (uint32)(uint16)vertexCoordinates[2].y;
-	if (y_uVar1 < y_uVar2) {
-		if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
-			clip_or_depth_DAT_00433444 = y_uVar1;
-		}
-		if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
-			y_DAT_00433448 = y_uVar2;
-		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_004314ce*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370, nullptr /*(int16 *)&DAT_00431c4e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372, nullptr /*polyTab2*/);
-	}
-	y_uVar1 = (uint32)(uint16)vertexCoordinates[1].y;
-	y_uVar2 = (uint32)(uint16)vertexCoordinates[2].y;
-	if (y_uVar2 < y_uVar1) {
-		if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
-			clip_or_depth_DAT_00433444 = y_uVar2;
-		}
-		if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
-			y_DAT_00433448 = y_uVar1;
-		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_0043188e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370, nullptr /*polyTab2 + 0x1e0*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372, nullptr /*(int16 *)&DAT_0043278e*/);
-	}
-	y_uVar1 = (uint32)(uint16)vertexCoordinates[2].y;
-	y_uVar2 = (uint32)(uint16)vertexCoordinates[0].y;
-	if (y_uVar1 < y_uVar2) {
-		if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
-			clip_or_depth_DAT_00433444 = y_uVar1;
-		}
-		if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
-			y_DAT_00433448 = y_uVar2;
-		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_004314ce*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376, nullptr /*(int16 *)&DAT_00431c4e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378, nullptr /*polyTab2*/);
-	}
-	y_uVar1 = (uint32)(uint16)vertexCoordinates[2].y;
-	y_uVar2 = (uint32)(uint16)vertexCoordinates[0].y;
-	if (y_uVar2 < y_uVar1) {
-		if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
-			clip_or_depth_DAT_00433444 = y_uVar2;
-		}
-		if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
-			y_DAT_00433448 = y_uVar1;
-		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_0043188e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376, nullptr /*polyTab2 + 0x1e0*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378, nullptr /*(int16 *)&DAT_0043278e*/);
-	}
-}
-
-void Holomap::holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr) {
-	uint8* holomapsurfaceBufferOffsetPosX = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, y_1);
-	uint8* holomapSurfaceOutPtr = holomapSurfaceImgOutPtr;
-	int16 height = (int16)(param_2 - (int16)y_1) + 1;
-	byte* holomap_offset_X_DAT_00433440 = (byte*)&vertexCoordinates[64].x + y_1;
-	for (int16 y = 0; y < height; ++y) {
-		uint8* holomapSurfaceOutPos = holomapSurfaceOutPtr;
-		int32 iVar1 = (int32)*holomap_offset_X_DAT_00433440;
-		uint8 *puVar6 = (uint8 *)(holomapsurfaceBufferOffsetPosX + iVar1);
-		int32 iVar3 = holomap_offset_X_DAT_00433440[480] - iVar1;
-		if (iVar3 != 0 && iVar1 <= holomap_offset_X_DAT_00433440[480]) {
-			iVar1 = (int32)(1 - ((uint32)(uint16)holomap_offset_X_DAT_00433440[1440] -
-			                   (uint32)(uint16)holomap_offset_X_DAT_00433440[2400])) /
-			        iVar3;
-			uint32 uVar5 = (uint32)(uint16)holomap_offset_X_DAT_00433440[960];
-			int32 iVar2 = (int32)(((uint16)holomap_offset_X_DAT_00433440[1920] - uVar5) + 1) / iVar3;
-			uint16 uVar4 = holomap_offset_X_DAT_00433440[1440];
-			// int16 holomap_maybe_DAT_00433430 = iVar2;
-			// int16 holomap_maybe_DAT_00433434 = iVar1;
-			for (int32 i = 0; i < iVar3; ++i) {
-				*puVar6 = *(uint8 *)(((uVar4 & 0xffffff00) | uVar5 >> 8) + holomapSurfaceOutPos);
-				puVar6 = puVar6 + 1;
-				uVar5 = (uint32)(uint16)((int16)uVar5 + (int16)iVar2);
-				uVar4 = ((uint16)(uVar4 & 0xffffff00) | (uVar4 & 0xff)) + (int16)iVar1;
-			}
-		}
-		holomapsurfaceBufferOffsetPosX += _engine->frontVideoBuffer.w;
-		holomap_offset_X_DAT_00433440 = holomap_offset_X_DAT_00433440 + 1;
-	}
-}
-
 void Holomap::renderHolomapSurfacePolygons() {
 	prepareHolomapPolygons();
 	for (int32 i = 0; i < ARRAYSIZE(_holomapSort); ++i) {
@@ -413,14 +231,14 @@ void Holomap::renderHolomapSurfacePolygons() {
 		vertexCoordinates[2].y = pos3.y;
 		bool iVar1 = isTriangleVisible(vertexCoordinates);
 		if (iVar1) {
-			tex_coords_maybe_DAT_0043336a = pos1.unk1;
-			tex_coords_maybe_DAT_0043336c = pos1.unk2;
-			tex_coords_maybe_DAT_00433370 = pos2.unk1;
-			tex_coords_maybe_DAT_00433372 = pos2.unk2;
-			tex_coords_maybe_DAT_00433376 = pos3.unk1;
-			tex_coords_maybe_DAT_00433378 = pos3.unk2;
-			vertices_FUN_00421010(vertexCoordinates);
-			holomap_surface_load_FUN_0042194d(vertexCoordinates, clip_or_depth_DAT_00433444,(int16)y_DAT_00433448,_engine->_resources->holomapImagePtr);
+			_engine->_renderer->tex_coords_maybe_DAT_0043336a = pos1.unk1;
+			_engine->_renderer->tex_coords_maybe_DAT_0043336c = pos1.unk2;
+			_engine->_renderer->tex_coords_maybe_DAT_00433370 = pos2.unk1;
+			_engine->_renderer->tex_coords_maybe_DAT_00433372 = pos2.unk2;
+			_engine->_renderer->tex_coords_maybe_DAT_00433376 = pos3.unk1;
+			_engine->_renderer->tex_coords_maybe_DAT_00433378 = pos3.unk2;
+			_engine->_renderer->vertices_FUN_00421010(vertexCoordinates);
+			_engine->_renderer->holomap_surface_load_FUN_0042194d(vertexCoordinates, _engine->_renderer->clip_or_depth_DAT_00433444,(int16)_engine->_renderer->y_DAT_00433448,_engine->_resources->holomapImagePtr);
 		}
 		const HolomapProjectedPos &pos4 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 33];
 		const HolomapProjectedPos &pos5 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 34];
@@ -433,14 +251,14 @@ void Holomap::renderHolomapSurfacePolygons() {
 		vertexCoordinates[2].y = pos6.y;
 		iVar1 = isTriangleVisible(vertexCoordinates);
 		if (iVar1) {
-			tex_coords_maybe_DAT_0043336a = pos4.unk1;
-			tex_coords_maybe_DAT_0043336c = pos4.unk2;
-			tex_coords_maybe_DAT_00433370 = pos5.unk1;
-			tex_coords_maybe_DAT_00433372 = pos5.unk2;
-			tex_coords_maybe_DAT_00433376 = pos6.unk1;
-			tex_coords_maybe_DAT_00433378 = pos6.unk2;
-			vertices_FUN_00421010(vertexCoordinates);
-			holomap_surface_load_FUN_0042194d(vertexCoordinates, clip_or_depth_DAT_00433444,(int16)y_DAT_00433448,_engine->_resources->holomapImagePtr);
+			_engine->_renderer->tex_coords_maybe_DAT_0043336a = pos4.unk1;
+			_engine->_renderer->tex_coords_maybe_DAT_0043336c = pos4.unk2;
+			_engine->_renderer->tex_coords_maybe_DAT_00433370 = pos5.unk1;
+			_engine->_renderer->tex_coords_maybe_DAT_00433372 = pos5.unk2;
+			_engine->_renderer->tex_coords_maybe_DAT_00433376 = pos6.unk1;
+			_engine->_renderer->tex_coords_maybe_DAT_00433378 = pos6.unk2;
+			_engine->_renderer->vertices_FUN_00421010(vertexCoordinates);
+			_engine->_renderer->holomap_surface_load_FUN_0042194d(vertexCoordinates, _engine->_renderer->clip_or_depth_DAT_00433444,(int16)_engine->_renderer->y_DAT_00433448,_engine->_resources->holomapImagePtr);
 		}
 	}
 }
diff --git a/engines/twine/holomap.h b/engines/twine/holomap.h
index 721178079e..dd5cc67946 100644
--- a/engines/twine/holomap.h
+++ b/engines/twine/holomap.h
@@ -42,19 +42,7 @@ class Holomap {
 private:
 	TwinEEngine *_engine;
 
-	int16 clip_or_depth_DAT_00433444 = 0;
-	uint32 y_DAT_00433448 = 0;
-	uint16 tex_coords_maybe_DAT_0043336a = 0;
-	uint16 tex_coords_maybe_DAT_0043336c = 0;
-	uint16 tex_coords_maybe_DAT_00433370 = 0;
-	uint16 tex_coords_maybe_DAT_00433372 = 0;
-	uint16 tex_coords_maybe_DAT_00433376 = 0;
-	uint16 tex_coords_maybe_DAT_00433378 = 0;
-
-	void holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
 	bool isTriangleVisible(const Vertex *vertices) const;
-	void vertices_FUN_00421010(Vertex *vertexCoordinates);
-	void vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int16 *vertexCoordinatePtr);
 
 	struct Location {
 		uint16 x = 0;
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 41ae3d23ce..b367142ca8 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1479,4 +1479,187 @@ void Renderer::renderInventoryItem(int32 x, int32 y, const uint8 *bodyPtr, int32
 	renderIsoModel(0, 0, 0, ANGLE_0, angle, ANGLE_0, bodyPtr);
 }
 
+
+void Renderer::vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int16 *vertexCoordinatePtr) {
+#if 0
+	int32 minY = y2;
+	int32 minX = x1;
+	if (y1 < y2) {
+		minY = y1;
+		y1 = y2;
+		minX = x2;
+		x2 = x1;
+	}
+	uint32 deltaY = y1 - minY;
+	int16 *lVertexCoordPointer = (int16 *)(vertexCoordinatePtr + minY * 2);
+	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;
+		do {
+			*lVertexCoordPointer = (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);
+			deltaY = uVar1 + deltaX;
+			minY = minY + -1;
+			lVertexCoordPointer = lVertexCoordPointer + 1;
+		} while (minY != 0);
+	} 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;
+		do {
+			*lVertexCoordPointer = (int16)deltaY;
+			deltaX = (uint32)bVar5;
+			uint32 uVar1 = deltaY - deltaRatio;
+			bVar5 = deltaY < deltaRatio || uVar1 < deltaX;
+			deltaY = uVar1 - deltaX;
+			minY = minY + -1;
+			lVertexCoordPointer = lVertexCoordPointer + 1;
+		} while (minY != 0);
+	}
+#endif
+}
+
+void Renderer::vertices_FUN_00421010(Vertex *vertexCoordinates) {
+	clip_or_depth_DAT_00433444 = 32000;
+	y_DAT_00433448 = 0xffff8300;
+	uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
+	uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
+	if (y_uVar1 < y_uVar2) {
+		if (y_uVar1 <= 32000) {
+			clip_or_depth_DAT_00433444 = y_uVar1;
+		}
+		if (-32001 < (int32)y_uVar2) {
+			y_DAT_00433448 = y_uVar2;
+		}
+		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
+		                      (uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_004314ce*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370,
+		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a, nullptr /*(int16 *)&DAT_00431c4e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372,
+		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c, nullptr /*(int16 *)&polyTab2*/);
+	}
+	y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
+	y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
+	if (y_uVar2 < y_uVar1) {
+		if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
+			clip_or_depth_DAT_00433444 = y_uVar2;
+		}
+		if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
+			y_DAT_00433448 = y_uVar1;
+		}
+		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
+		                      (uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_0043188e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370,
+		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a, nullptr /*polyTab2 + 0x1e0*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372,
+		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c, nullptr /*(int16 *)&DAT_0043278e*/);
+	}
+	y_uVar1 = (uint32)(uint16)vertexCoordinates[1].y;
+	y_uVar2 = (uint32)(uint16)vertexCoordinates[2].y;
+	if (y_uVar1 < y_uVar2) {
+		if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
+			clip_or_depth_DAT_00433444 = y_uVar1;
+		}
+		if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
+			y_DAT_00433448 = y_uVar2;
+		}
+		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
+		                      (uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_004314ce*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376,
+		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370, nullptr /*(int16 *)&DAT_00431c4e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378,
+		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372, nullptr /*polyTab2*/);
+	}
+	y_uVar1 = (uint32)(uint16)vertexCoordinates[1].y;
+	y_uVar2 = (uint32)(uint16)vertexCoordinates[2].y;
+	if (y_uVar2 < y_uVar1) {
+		if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
+			clip_or_depth_DAT_00433444 = y_uVar2;
+		}
+		if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
+			y_DAT_00433448 = y_uVar1;
+		}
+		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
+		                      (uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_0043188e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376,
+		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370, nullptr /*polyTab2 + 0x1e0*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378,
+		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372, nullptr /*(int16 *)&DAT_0043278e*/);
+	}
+	y_uVar1 = (uint32)(uint16)vertexCoordinates[2].y;
+	y_uVar2 = (uint32)(uint16)vertexCoordinates[0].y;
+	if (y_uVar1 < y_uVar2) {
+		if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
+			clip_or_depth_DAT_00433444 = y_uVar1;
+		}
+		if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
+			y_DAT_00433448 = y_uVar2;
+		}
+		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
+		                      (uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_004314ce*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a,
+		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376, nullptr /*(int16 *)&DAT_00431c4e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c,
+		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378, nullptr /*polyTab2*/);
+	}
+	y_uVar1 = (uint32)(uint16)vertexCoordinates[2].y;
+	y_uVar2 = (uint32)(uint16)vertexCoordinates[0].y;
+	if (y_uVar2 < y_uVar1) {
+		if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
+			clip_or_depth_DAT_00433444 = y_uVar2;
+		}
+		if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
+			y_DAT_00433448 = y_uVar1;
+		}
+		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
+		                      (uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_0043188e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a,
+		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376, nullptr /*polyTab2 + 0x1e0*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c,
+		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378, nullptr /*(int16 *)&DAT_0043278e*/);
+	}
+}
+
+void Renderer::holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr) {
+	uint8* holomapsurfaceBufferOffsetPosX = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, y_1);
+	uint8* holomapSurfaceOutPtr = holomapSurfaceImgOutPtr;
+	int16 height = (int16)(param_2 - (int16)y_1) + 1;
+	byte* holomap_offset_X_DAT_00433440 = (byte*)&vertexCoordinates[64].x + y_1;
+	for (int16 y = 0; y < height; ++y) {
+		uint8* holomapSurfaceOutPos = holomapSurfaceOutPtr;
+		int32 iVar1 = (int32)*holomap_offset_X_DAT_00433440;
+		uint8 *puVar6 = (uint8 *)(holomapsurfaceBufferOffsetPosX + iVar1);
+		int32 iVar3 = holomap_offset_X_DAT_00433440[480] - iVar1;
+		if (iVar3 != 0 && iVar1 <= holomap_offset_X_DAT_00433440[480]) {
+			iVar1 = (int32)(1 - ((uint32)(uint16)holomap_offset_X_DAT_00433440[1440] -
+			                   (uint32)(uint16)holomap_offset_X_DAT_00433440[2400])) /
+			        iVar3;
+			uint32 uVar5 = (uint32)(uint16)holomap_offset_X_DAT_00433440[960];
+			int32 iVar2 = (int32)(((uint16)holomap_offset_X_DAT_00433440[1920] - uVar5) + 1) / iVar3;
+			uint16 uVar4 = holomap_offset_X_DAT_00433440[1440];
+			// int16 holomap_maybe_DAT_00433430 = iVar2;
+			// int16 holomap_maybe_DAT_00433434 = iVar1;
+			for (int32 i = 0; i < iVar3; ++i) {
+				*puVar6 = *(uint8 *)(((uVar4 & 0xffffff00) | uVar5 >> 8) + holomapSurfaceOutPos);
+				puVar6 = puVar6 + 1;
+				uVar5 = (uint32)(uint16)((int16)uVar5 + (int16)iVar2);
+				uVar4 = ((uint16)(uVar4 & 0xffffff00) | (uVar4 & 0xff)) + (int16)iVar1;
+			}
+		}
+		holomapsurfaceBufferOffsetPosX += _engine->frontVideoBuffer.w;
+		holomap_offset_X_DAT_00433440 = holomap_offset_X_DAT_00433440 + 1;
+	}
+}
+
 } // namespace TwinE
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index c6d0546063..fb3a43a4fb 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -430,6 +430,19 @@ public:
 	void renderBehaviourModel(const Common::Rect &rect, int32 y, int32 angle, const uint8 *bodyPtr);
 
 	void renderInventoryItem(int32 x, int32 y, const uint8 *bodyPtr, int32 angle, int32 param);
+
+	int16 clip_or_depth_DAT_00433444 = 0;
+	uint32 y_DAT_00433448 = 0;
+	uint16 tex_coords_maybe_DAT_0043336a = 0;
+	uint16 tex_coords_maybe_DAT_0043336c = 0;
+	uint16 tex_coords_maybe_DAT_00433370 = 0;
+	uint16 tex_coords_maybe_DAT_00433372 = 0;
+	uint16 tex_coords_maybe_DAT_00433376 = 0;
+	uint16 tex_coords_maybe_DAT_00433378 = 0;
+
+	void holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
+	void vertices_FUN_00421010(Vertex *vertexCoordinates);
+	void vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int16 *vertexCoordinatePtr);
 };
 
 } // namespace TwinE


Commit: 482a0e015bb99e3cf607aa2e8b4556904fa30afd
    https://github.com/scummvm/scummvm/commit/482a0e015bb99e3cf607aa2e8b4556904fa30afd
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: hide Renderer method

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 19c95006c5..2369922296 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -238,7 +238,6 @@ void Holomap::renderHolomapSurfacePolygons() {
 			_engine->_renderer->tex_coords_maybe_DAT_00433376 = pos3.unk1;
 			_engine->_renderer->tex_coords_maybe_DAT_00433378 = pos3.unk2;
 			_engine->_renderer->vertices_FUN_00421010(vertexCoordinates);
-			_engine->_renderer->holomap_surface_load_FUN_0042194d(vertexCoordinates, _engine->_renderer->clip_or_depth_DAT_00433444,(int16)_engine->_renderer->y_DAT_00433448,_engine->_resources->holomapImagePtr);
 		}
 		const HolomapProjectedPos &pos4 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 33];
 		const HolomapProjectedPos &pos5 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 34];
@@ -258,7 +257,6 @@ void Holomap::renderHolomapSurfacePolygons() {
 			_engine->_renderer->tex_coords_maybe_DAT_00433376 = pos6.unk1;
 			_engine->_renderer->tex_coords_maybe_DAT_00433378 = pos6.unk2;
 			_engine->_renderer->vertices_FUN_00421010(vertexCoordinates);
-			_engine->_renderer->holomap_surface_load_FUN_0042194d(vertexCoordinates, _engine->_renderer->clip_or_depth_DAT_00433444,(int16)_engine->_renderer->y_DAT_00433448,_engine->_resources->holomapImagePtr);
 		}
 	}
 }
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index b367142ca8..b8c1164264 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -29,6 +29,7 @@
 #include "twine/menu/menu.h"
 #include "twine/renderer/redraw.h"
 #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"
@@ -1629,6 +1630,7 @@ void Renderer::vertices_FUN_00421010(Vertex *vertexCoordinates) {
 		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c,
 		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378, nullptr /*(int16 *)&DAT_0043278e*/);
 	}
+	holomap_surface_load_FUN_0042194d(vertexCoordinates, clip_or_depth_DAT_00433444,(int16)y_DAT_00433448, _engine->_resources->holomapImagePtr);
 }
 
 void Renderer::holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr) {
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index fb3a43a4fb..5e0cbcbd7b 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -384,6 +384,8 @@ private:
 
 	void baseMatrixTranspose();
 
+	void holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
+
 public:
 	Renderer(TwinEEngine *engine);
 	~Renderer();
@@ -440,7 +442,6 @@ public:
 	uint16 tex_coords_maybe_DAT_00433376 = 0;
 	uint16 tex_coords_maybe_DAT_00433378 = 0;
 
-	void holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
 	void vertices_FUN_00421010(Vertex *vertexCoordinates);
 	void vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int16 *vertexCoordinatePtr);
 };


Commit: ca24e2c79a4ea758b17a24156bc497c997510310
    https://github.com/scummvm/scummvm/commit/ca24e2c79a4ea758b17a24156bc497c997510310
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: converted magic number

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index b8c1164264..93d6337f6e 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1533,7 +1533,7 @@ void Renderer::vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int
 
 void Renderer::vertices_FUN_00421010(Vertex *vertexCoordinates) {
 	clip_or_depth_DAT_00433444 = 32000;
-	y_DAT_00433448 = 0xffff8300;
+	y_DAT_00433448 = -32000;
 	uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
 	uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
 	if (y_uVar1 < y_uVar2) {


Commit: 0753df26a0aa3b5f9f929ab9c701a609ae490b5a
    https://github.com/scummvm/scummvm/commit/0753df26a0aa3b5f9f929ab9c701a609ae490b5a
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: reduced visibility

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 2369922296..f4cb6074aa 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -225,38 +225,52 @@ 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) {
-			_engine->_renderer->tex_coords_maybe_DAT_0043336a = pos1.unk1;
-			_engine->_renderer->tex_coords_maybe_DAT_0043336c = pos1.unk2;
-			_engine->_renderer->tex_coords_maybe_DAT_00433370 = pos2.unk1;
-			_engine->_renderer->tex_coords_maybe_DAT_00433372 = pos2.unk2;
-			_engine->_renderer->tex_coords_maybe_DAT_00433376 = pos3.unk1;
-			_engine->_renderer->tex_coords_maybe_DAT_00433378 = pos3.unk2;
-			_engine->_renderer->vertices_FUN_00421010(vertexCoordinates);
+			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->vertices_FUN_00421010(vertexCoordinates, vertexCoordinates2);
 		}
 		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) {
-			_engine->_renderer->tex_coords_maybe_DAT_0043336a = pos4.unk1;
-			_engine->_renderer->tex_coords_maybe_DAT_0043336c = pos4.unk2;
-			_engine->_renderer->tex_coords_maybe_DAT_00433370 = pos5.unk1;
-			_engine->_renderer->tex_coords_maybe_DAT_00433372 = pos5.unk2;
-			_engine->_renderer->tex_coords_maybe_DAT_00433376 = pos6.unk1;
-			_engine->_renderer->tex_coords_maybe_DAT_00433378 = pos6.unk2;
-			_engine->_renderer->vertices_FUN_00421010(vertexCoordinates);
+			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->vertices_FUN_00421010(vertexCoordinates, vertexCoordinates2);
 		}
 	}
 }
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 93d6337f6e..351cb65617 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1531,7 +1531,7 @@ void Renderer::vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int
 #endif
 }
 
-void Renderer::vertices_FUN_00421010(Vertex *vertexCoordinates) {
+void Renderer::vertices_FUN_00421010(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]) {
 	clip_or_depth_DAT_00433444 = 32000;
 	y_DAT_00433448 = -32000;
 	uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
@@ -1545,10 +1545,10 @@ void Renderer::vertices_FUN_00421010(Vertex *vertexCoordinates) {
 		}
 		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
 		                      (uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_004314ce*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a, nullptr /*(int16 *)&DAT_00431c4e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c, nullptr /*(int16 *)&polyTab2*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
+		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, nullptr /*(int16 *)&DAT_00431c4e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
+		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, nullptr /*(int16 *)&polyTab2*/);
 	}
 	y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
 	y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
@@ -1561,10 +1561,10 @@ void Renderer::vertices_FUN_00421010(Vertex *vertexCoordinates) {
 		}
 		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
 		                      (uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_0043188e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a, nullptr /*polyTab2 + 0x1e0*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c, nullptr /*(int16 *)&DAT_0043278e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
+		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, nullptr /*polyTab2 + 0x1e0*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
+		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, nullptr /*(int16 *)&DAT_0043278e*/);
 	}
 	y_uVar1 = (uint32)(uint16)vertexCoordinates[1].y;
 	y_uVar2 = (uint32)(uint16)vertexCoordinates[2].y;
@@ -1577,10 +1577,10 @@ void Renderer::vertices_FUN_00421010(Vertex *vertexCoordinates) {
 		}
 		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
 		                      (uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_004314ce*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370, nullptr /*(int16 *)&DAT_00431c4e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372, nullptr /*polyTab2*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
+		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, nullptr /*(int16 *)&DAT_00431c4e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
+		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, nullptr /*polyTab2*/);
 	}
 	y_uVar1 = (uint32)(uint16)vertexCoordinates[1].y;
 	y_uVar2 = (uint32)(uint16)vertexCoordinates[2].y;
@@ -1593,10 +1593,10 @@ void Renderer::vertices_FUN_00421010(Vertex *vertexCoordinates) {
 		}
 		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
 		                      (uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_0043188e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433370, nullptr /*polyTab2 + 0x1e0*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)tex_coords_maybe_DAT_00433372, nullptr /*(int16 *)&DAT_0043278e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
+		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, nullptr /*polyTab2 + 0x1e0*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
+		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, nullptr /*(int16 *)&DAT_0043278e*/);
 	}
 	y_uVar1 = (uint32)(uint16)vertexCoordinates[2].y;
 	y_uVar2 = (uint32)(uint16)vertexCoordinates[0].y;
@@ -1609,10 +1609,10 @@ void Renderer::vertices_FUN_00421010(Vertex *vertexCoordinates) {
 		}
 		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
 		                      (uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_004314ce*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376, nullptr /*(int16 *)&DAT_00431c4e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378, nullptr /*polyTab2*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
+		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, nullptr /*(int16 *)&DAT_00431c4e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
+		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, nullptr /*polyTab2*/);
 	}
 	y_uVar1 = (uint32)(uint16)vertexCoordinates[2].y;
 	y_uVar2 = (uint32)(uint16)vertexCoordinates[0].y;
@@ -1625,10 +1625,10 @@ void Renderer::vertices_FUN_00421010(Vertex *vertexCoordinates) {
 		}
 		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
 		                      (uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_0043188e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336a,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433376, nullptr /*polyTab2 + 0x1e0*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)tex_coords_maybe_DAT_0043336c,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)tex_coords_maybe_DAT_00433378, nullptr /*(int16 *)&DAT_0043278e*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
+		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, nullptr /*polyTab2 + 0x1e0*/);
+		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
+		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, nullptr /*(int16 *)&DAT_0043278e*/);
 	}
 	holomap_surface_load_FUN_0042194d(vertexCoordinates, clip_or_depth_DAT_00433444,(int16)y_DAT_00433448, _engine->_resources->holomapImagePtr);
 }
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 5e0cbcbd7b..ee9d0a8967 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -385,6 +385,10 @@ private:
 	void baseMatrixTranspose();
 
 	void holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
+	void vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int16 *vertexCoordinatePtr);
+
+	int16 clip_or_depth_DAT_00433444 = 0;
+	uint32 y_DAT_00433448 = 0;
 
 public:
 	Renderer(TwinEEngine *engine);
@@ -433,17 +437,7 @@ public:
 
 	void renderInventoryItem(int32 x, int32 y, const uint8 *bodyPtr, int32 angle, int32 param);
 
-	int16 clip_or_depth_DAT_00433444 = 0;
-	uint32 y_DAT_00433448 = 0;
-	uint16 tex_coords_maybe_DAT_0043336a = 0;
-	uint16 tex_coords_maybe_DAT_0043336c = 0;
-	uint16 tex_coords_maybe_DAT_00433370 = 0;
-	uint16 tex_coords_maybe_DAT_00433372 = 0;
-	uint16 tex_coords_maybe_DAT_00433376 = 0;
-	uint16 tex_coords_maybe_DAT_00433378 = 0;
-
-	void vertices_FUN_00421010(Vertex *vertexCoordinates);
-	void vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int16 *vertexCoordinatePtr);
+	void vertices_FUN_00421010(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]);
 };
 
 } // namespace TwinE


Commit: b4796f7536701857ed9337521f0f35ba17ccd253
    https://github.com/scummvm/scummvm/commit/b4796f7536701857ed9337521f0f35ba17ccd253
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: converted to stack var

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 351cb65617..de81e312e0 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1532,15 +1532,16 @@ void Renderer::vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int
 }
 
 void Renderer::vertices_FUN_00421010(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]) {
-	clip_or_depth_DAT_00433444 = 32000;
-	y_DAT_00433448 = -32000;
+	int16 clip_or_depth_DAT_00433444 = 32000;
+	uint32 y_DAT_00433448 = (uint32)-32000;
+
 	uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
 	uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
 	if (y_uVar1 < y_uVar2) {
-		if (y_uVar1 <= 32000) {
+		if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
 			clip_or_depth_DAT_00433444 = y_uVar1;
 		}
-		if (-32001 < (int32)y_uVar2) {
+		if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
 			y_DAT_00433448 = y_uVar2;
 		}
 		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index ee9d0a8967..c839b381d9 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -387,9 +387,6 @@ private:
 	void holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
 	void vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int16 *vertexCoordinatePtr);
 
-	int16 clip_or_depth_DAT_00433444 = 0;
-	uint32 y_DAT_00433448 = 0;
-
 public:
 	Renderer(TwinEEngine *engine);
 	~Renderer();


Commit: 70532c881c254daedd0381e6658f3ea67eea8e07
    https://github.com/scummvm/scummvm/commit/70532c881c254daedd0381e6658f3ea67eea8e07
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: const

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index de81e312e0..0a27d585e2 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1535,101 +1535,101 @@ void Renderer::vertices_FUN_00421010(Vertex vertexCoordinates[3], Vertex vertexC
 	int16 clip_or_depth_DAT_00433444 = 32000;
 	uint32 y_DAT_00433448 = (uint32)-32000;
 
-	uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
-	uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
-	if (y_uVar1 < y_uVar2) {
-		if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
-			clip_or_depth_DAT_00433444 = y_uVar1;
-		}
-		if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
-			y_DAT_00433448 = y_uVar2;
-		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_004314ce*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, nullptr /*(int16 *)&DAT_00431c4e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, nullptr /*(int16 *)&polyTab2*/);
-	}
-	y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
-	y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
-	if (y_uVar2 < y_uVar1) {
-		if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
-			clip_or_depth_DAT_00433444 = y_uVar2;
-		}
-		if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
-			y_DAT_00433448 = y_uVar1;
-		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_0043188e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, nullptr /*polyTab2 + 0x1e0*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
-		                      (uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, nullptr /*(int16 *)&DAT_0043278e*/);
-	}
-	y_uVar1 = (uint32)(uint16)vertexCoordinates[1].y;
-	y_uVar2 = (uint32)(uint16)vertexCoordinates[2].y;
-	if (y_uVar1 < y_uVar2) {
-		if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
-			clip_or_depth_DAT_00433444 = y_uVar1;
-		}
-		if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
-			y_DAT_00433448 = y_uVar2;
-		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_004314ce*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, nullptr /*(int16 *)&DAT_00431c4e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, nullptr /*polyTab2*/);
-	}
-	y_uVar1 = (uint32)(uint16)vertexCoordinates[1].y;
-	y_uVar2 = (uint32)(uint16)vertexCoordinates[2].y;
-	if (y_uVar2 < y_uVar1) {
-		if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
-			clip_or_depth_DAT_00433444 = y_uVar2;
+	{
+		const uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
+		const uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
+		if (y_uVar1 < y_uVar2) {
+			if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
+				clip_or_depth_DAT_00433444 = y_uVar1;
+			}
+			if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
+				y_DAT_00433448 = y_uVar2;
+			}
+			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_004314ce*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
+								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, nullptr /*(int16 *)&DAT_00431c4e*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
+								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, nullptr /*(int16 *)&polyTab2*/);
 		}
-		if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
-			y_DAT_00433448 = y_uVar1;
+		if (y_uVar2 < y_uVar1) {
+			if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
+				clip_or_depth_DAT_00433444 = y_uVar2;
+			}
+			if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
+				y_DAT_00433448 = y_uVar1;
+			}
+			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_0043188e*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
+								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, nullptr /*polyTab2 + 0x1e0*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
+								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, nullptr /*(int16 *)&DAT_0043278e*/);
 		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_0043188e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, nullptr /*polyTab2 + 0x1e0*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
-		                      (uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, nullptr /*(int16 *)&DAT_0043278e*/);
 	}
-	y_uVar1 = (uint32)(uint16)vertexCoordinates[2].y;
-	y_uVar2 = (uint32)(uint16)vertexCoordinates[0].y;
-	if (y_uVar1 < y_uVar2) {
-		if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
-			clip_or_depth_DAT_00433444 = y_uVar1;
+	{
+		const uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[1].y;
+		const uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[2].y;
+		if (y_uVar1 < y_uVar2) {
+			if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
+				clip_or_depth_DAT_00433444 = y_uVar1;
+			}
+			if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
+				y_DAT_00433448 = y_uVar2;
+			}
+			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_004314ce*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
+								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, nullptr /*(int16 *)&DAT_00431c4e*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
+								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, nullptr /*polyTab2*/);
 		}
-		if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
-			y_DAT_00433448 = y_uVar2;
+		if (y_uVar2 < y_uVar1) {
+			if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
+				clip_or_depth_DAT_00433444 = y_uVar2;
+			}
+			if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
+				y_DAT_00433448 = y_uVar1;
+			}
+			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_0043188e*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
+								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, nullptr /*polyTab2 + 0x1e0*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
+								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, nullptr /*(int16 *)&DAT_0043278e*/);
 		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_004314ce*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, nullptr /*(int16 *)&DAT_00431c4e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, nullptr /*polyTab2*/);
 	}
-	y_uVar1 = (uint32)(uint16)vertexCoordinates[2].y;
-	y_uVar2 = (uint32)(uint16)vertexCoordinates[0].y;
-	if (y_uVar2 < y_uVar1) {
-		if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
-			clip_or_depth_DAT_00433444 = y_uVar2;
+	{
+		const uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[2].y;
+		const uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[0].y;
+		if (y_uVar1 < y_uVar2) {
+			if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
+				clip_or_depth_DAT_00433444 = y_uVar1;
+			}
+			if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
+				y_DAT_00433448 = y_uVar2;
+			}
+			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_004314ce*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
+								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, nullptr /*(int16 *)&DAT_00431c4e*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
+								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, nullptr /*polyTab2*/);
 		}
-		if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
-			y_DAT_00433448 = y_uVar1;
+		if (y_uVar2 < y_uVar1) {
+			if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
+				clip_or_depth_DAT_00433444 = y_uVar2;
+			}
+			if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
+				y_DAT_00433448 = y_uVar1;
+			}
+			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_0043188e*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
+								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, nullptr /*polyTab2 + 0x1e0*/);
+			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
+								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, nullptr /*(int16 *)&DAT_0043278e*/);
 		}
-		vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
-		                      (uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_0043188e*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, nullptr /*polyTab2 + 0x1e0*/);
-		vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
-		                      (uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, nullptr /*(int16 *)&DAT_0043278e*/);
 	}
 	holomap_surface_load_FUN_0042194d(vertexCoordinates, clip_or_depth_DAT_00433444,(int16)y_DAT_00433448, _engine->_resources->holomapImagePtr);
 }


Commit: 997a07130167598862499615c19afa2433ad78ac
    https://github.com/scummvm/scummvm/commit/997a07130167598862499615c19afa2433ad78ac
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: use polytab array

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 0a27d585e2..83f32e9f3a 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1481,7 +1481,7 @@ void Renderer::renderInventoryItem(int32 x, int32 y, const uint8 *bodyPtr, int32
 }
 
 
-void Renderer::vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int16 *vertexCoordinatePtr) {
+void Renderer::computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int16 *polygonTabPtr) {
 #if 0
 	int32 minY = y2;
 	int32 minX = x1;
@@ -1492,7 +1492,7 @@ void Renderer::vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int
 		x2 = x1;
 	}
 	uint32 deltaY = y1 - minY;
-	int16 *lVertexCoordPointer = (int16 *)(vertexCoordinatePtr + minY * 2);
+	int16 *lVertexCoordPointer = (int16 *)(polygonTabPtr + minY * 2);
 	if (x2 <= minX) {
 		uint32 deltaX = (uint32)(uint16)((int16)minX - (int16)x2) << 0x10;
 		uint32 deltaRatio = deltaX / deltaY;
@@ -1531,107 +1531,114 @@ void Renderer::vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int
 #endif
 }
 
+static const int hmPolyOffset1 = 0;    /* 0x0000 */
+static const int hmPolyOffset2 = 60;   /* 0x003c */
+static const int hmPolyOffset3 = 120;  /* 0x0070 */
+static const int hmPolyOffset4 = 180;  /* 0x00b4 */
+static const int hmPolyOffset5 = 240;  /* 0x00f0 */
+static const int hmPolyOffset6 = 300;  /* 0x012c */
+
 void Renderer::vertices_FUN_00421010(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]) {
-	int16 clip_or_depth_DAT_00433444 = 32000;
-	uint32 y_DAT_00433448 = (uint32)-32000;
+	int16 top = 32000;
+	uint32 bottom = (uint32)-32000;
 
 	{
 		const uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
 		const uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
 		if (y_uVar1 < y_uVar2) {
-			if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
-				clip_or_depth_DAT_00433444 = y_uVar1;
+			if ((int32)y_uVar1 <= (int32)top) {
+				top = y_uVar1;
 			}
-			if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
-				y_DAT_00433448 = y_uVar2;
+			if ((int32)bottom <= (int32)y_uVar2) {
+				bottom = y_uVar2;
 			}
-			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_004314ce*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
-								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, nullptr /*(int16 *)&DAT_00431c4e*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
-								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, nullptr /*(int16 *)&polyTab2*/);
+			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[0].x, _polyTab + hmPolyOffset1);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
+								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, _polyTab + hmPolyOffset3);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
+								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, _polyTab + hmPolyOffset4);
 		}
 		if (y_uVar2 < y_uVar1) {
-			if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
-				clip_or_depth_DAT_00433444 = y_uVar2;
+			if ((int32)y_uVar2 <= (int32)top) {
+				top = y_uVar2;
 			}
-			if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
-				y_DAT_00433448 = y_uVar1;
+			if ((int32)bottom <= (int32)y_uVar1) {
+				bottom = y_uVar1;
 			}
-			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[0].x, nullptr /*(int16 *)&DAT_0043188e*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
-								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, nullptr /*polyTab2 + 0x1e0*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
-								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, nullptr /*(int16 *)&DAT_0043278e*/);
+			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[0].x, _polyTab + hmPolyOffset2);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
+								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, _polyTab + hmPolyOffset5);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
+								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, _polyTab + hmPolyOffset6);
 		}
 	}
 	{
 		const uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[1].y;
 		const uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[2].y;
 		if (y_uVar1 < y_uVar2) {
-			if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
-				clip_or_depth_DAT_00433444 = y_uVar1;
+			if ((int32)y_uVar1 <= (int32)top) {
+				top = y_uVar1;
 			}
-			if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
-				y_DAT_00433448 = y_uVar2;
+			if ((int32)bottom <= (int32)y_uVar2) {
+				bottom = y_uVar2;
 			}
-			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_004314ce*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
-								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, nullptr /*(int16 *)&DAT_00431c4e*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
-								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, nullptr /*polyTab2*/);
+			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[1].x, _polyTab + hmPolyOffset1);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
+								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, _polyTab + hmPolyOffset3);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
+								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, _polyTab + hmPolyOffset4);
 		}
 		if (y_uVar2 < y_uVar1) {
-			if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
-				clip_or_depth_DAT_00433444 = y_uVar2;
+			if ((int32)y_uVar2 <= (int32)top) {
+				top = y_uVar2;
 			}
-			if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
-				y_DAT_00433448 = y_uVar1;
+			if ((int32)bottom <= (int32)y_uVar1) {
+				bottom = y_uVar1;
 			}
-			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[1].x, nullptr /*(int16 *)&DAT_0043188e*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
-								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, nullptr /*polyTab2 + 0x1e0*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
-								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, nullptr /*(int16 *)&DAT_0043278e*/);
+			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[1].x, _polyTab + hmPolyOffset2);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
+								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, _polyTab + hmPolyOffset5);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
+								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, _polyTab + hmPolyOffset6);
 		}
 	}
 	{
 		const uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[2].y;
 		const uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[0].y;
 		if (y_uVar1 < y_uVar2) {
-			if ((int32)y_uVar1 <= (int32)clip_or_depth_DAT_00433444) {
-				clip_or_depth_DAT_00433444 = y_uVar1;
+			if ((int32)y_uVar1 <= (int32)top) {
+				top = y_uVar1;
 			}
-			if ((int32)y_DAT_00433448 <= (int32)y_uVar2) {
-				y_DAT_00433448 = y_uVar2;
+			if ((int32)bottom <= (int32)y_uVar2) {
+				bottom = y_uVar2;
 			}
-			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_004314ce*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
-								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, nullptr /*(int16 *)&DAT_00431c4e*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
-								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, nullptr /*polyTab2*/);
+			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[2].x, _polyTab + hmPolyOffset1);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
+								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, _polyTab + hmPolyOffset3);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
+								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, _polyTab + hmPolyOffset4);
 		}
 		if (y_uVar2 < y_uVar1) {
-			if ((int32)y_uVar2 <= (int32)clip_or_depth_DAT_00433444) {
-				clip_or_depth_DAT_00433444 = y_uVar2;
+			if ((int32)y_uVar2 <= (int32)top) {
+				top = y_uVar2;
 			}
-			if ((int32)y_DAT_00433448 <= (int32)y_uVar1) {
-				y_DAT_00433448 = y_uVar1;
+			if ((int32)bottom <= (int32)y_uVar1) {
+				bottom = y_uVar1;
 			}
-			vertices_FUN_00420fad(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[2].x, nullptr /*(int16 *)&DAT_0043188e*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
-								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, nullptr /*polyTab2 + 0x1e0*/);
-			vertices_FUN_00420fad((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
-								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, nullptr /*(int16 *)&DAT_0043278e*/);
+			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
+								(uint32)(uint16)vertexCoordinates[2].x, _polyTab + hmPolyOffset2);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
+								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, _polyTab + hmPolyOffset5);
+			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
+								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, _polyTab + hmPolyOffset6);
 		}
 	}
-	holomap_surface_load_FUN_0042194d(vertexCoordinates, clip_or_depth_DAT_00433444,(int16)y_DAT_00433448, _engine->_resources->holomapImagePtr);
+	holomap_surface_load_FUN_0042194d(vertexCoordinates, top,(int16)bottom, _engine->_resources->holomapImagePtr);
 }
 
 void Renderer::holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr) {
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index c839b381d9..8b4c09f616 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -385,7 +385,7 @@ private:
 	void baseMatrixTranspose();
 
 	void holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
-	void vertices_FUN_00420fad(int32 y1, int32 x1, int32 y2, int32 x2, int16 *vertexCoordinatePtr);
+	void computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int16 *polygonTabPtr);
 
 public:
 	Renderer(TwinEEngine *engine);


Commit: 492ee9533ab8362ccd80e0599d951a8e9017dd7e
    https://github.com/scummvm/scummvm/commit/492ee9533ab8362ccd80e0599d951a8e9017dd7e
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: replaced CARRY4

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 83f32e9f3a..19a66500e1 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1506,7 +1506,8 @@ void Renderer::computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int
 			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 = CARRY4(deltaY, deltaRatio) || CARRY4(uVar1, deltaX);
+			bVar5 = deltaY > deltaRatio || uVar1 > deltaX;
 			deltaY = uVar1 + deltaX;
 			minY = minY + -1;
 			lVertexCoordPointer = lVertexCoordPointer + 1;


Commit: 1cf9af2185bb6a4b0ccf9032455e35b6b16bdd1a
    https://github.com/scummvm/scummvm/commit/1cf9af2185bb6a4b0ccf9032455e35b6b16bdd1a
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:37+01:00

Commit Message:
TWINE: renamed method

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 f4cb6074aa..d444a3b48a 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -244,7 +244,7 @@ void Holomap::renderHolomapSurfacePolygons() {
 			vertexCoordinates2[2].x = pos3.unk1;
 			vertexCoordinates2[2].y = pos3.unk2;
 			vertexCoordinates2[2].colorIndex = 0;
-			_engine->_renderer->vertices_FUN_00421010(vertexCoordinates, vertexCoordinates2);
+			_engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexCoordinates2);
 		}
 		const HolomapProjectedPos &pos4 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 33];
 		const HolomapProjectedPos &pos5 = _projectedSurfacePositions[_holomapSort[i].projectedPosIdx + 34];
@@ -270,7 +270,7 @@ void Holomap::renderHolomapSurfacePolygons() {
 			vertexCoordinates2[2].x = pos6.unk1;
 			vertexCoordinates2[2].y = pos6.unk2;
 			vertexCoordinates2[2].colorIndex = 0;
-			_engine->_renderer->vertices_FUN_00421010(vertexCoordinates, vertexCoordinates2);
+			_engine->_renderer->renderHolomapVertices(vertexCoordinates, vertexCoordinates2);
 		}
 	}
 }
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 19a66500e1..643c8e3092 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1539,7 +1539,7 @@ static const int hmPolyOffset4 = 180;  /* 0x00b4 */
 static const int hmPolyOffset5 = 240;  /* 0x00f0 */
 static const int hmPolyOffset6 = 300;  /* 0x012c */
 
-void Renderer::vertices_FUN_00421010(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]) {
+void Renderer::renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]) {
 	int16 top = 32000;
 	uint32 bottom = (uint32)-32000;
 
@@ -1639,10 +1639,10 @@ void Renderer::vertices_FUN_00421010(Vertex vertexCoordinates[3], Vertex vertexC
 								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, _polyTab + hmPolyOffset6);
 		}
 	}
-	holomap_surface_load_FUN_0042194d(vertexCoordinates, top,(int16)bottom, _engine->_resources->holomapImagePtr);
+	renderHolomapPolygons(vertexCoordinates, top,(int16)bottom, _engine->_resources->holomapImagePtr);
 }
 
-void Renderer::holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr) {
+void Renderer::renderHolomapPolygons(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr) {
 	uint8* holomapsurfaceBufferOffsetPosX = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, y_1);
 	uint8* holomapSurfaceOutPtr = holomapSurfaceImgOutPtr;
 	int16 height = (int16)(param_2 - (int16)y_1) + 1;
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 8b4c09f616..df430ba1ef 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -384,7 +384,7 @@ private:
 
 	void baseMatrixTranspose();
 
-	void holomap_surface_load_FUN_0042194d(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
+	void renderHolomapPolygons(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
 	void computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int16 *polygonTabPtr);
 
 public:
@@ -434,7 +434,7 @@ public:
 
 	void renderInventoryItem(int32 x, int32 y, const uint8 *bodyPtr, int32 angle, int32 param);
 
-	void vertices_FUN_00421010(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]);
+	void renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]);
 };
 
 } // namespace TwinE


Commit: 77998130f990d6fa7269e154930bca5148f41b73
    https://github.com/scummvm/scummvm/commit/77998130f990d6fa7269e154930bca5148f41b73
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:38+01:00

Commit Message:
TWINE: use polytab

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 643c8e3092..736306d86d 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1639,14 +1639,14 @@ void Renderer::renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexC
 								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, _polyTab + hmPolyOffset6);
 		}
 	}
-	renderHolomapPolygons(vertexCoordinates, top,(int16)bottom, _engine->_resources->holomapImagePtr);
+	renderHolomapPolygons(top,(int16)bottom, _engine->_resources->holomapImagePtr);
 }
 
-void Renderer::renderHolomapPolygons(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr) {
+void Renderer::renderHolomapPolygons(int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr) {
 	uint8* holomapsurfaceBufferOffsetPosX = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, y_1);
 	uint8* holomapSurfaceOutPtr = holomapSurfaceImgOutPtr;
 	int16 height = (int16)(param_2 - (int16)y_1) + 1;
-	byte* holomap_offset_X_DAT_00433440 = (byte*)&vertexCoordinates[64].x + y_1;
+	byte* holomap_offset_X_DAT_00433440 = (byte*)&_polyTab[y_1 * 2];
 	for (int16 y = 0; y < height; ++y) {
 		uint8* holomapSurfaceOutPos = holomapSurfaceOutPtr;
 		int32 iVar1 = (int32)*holomap_offset_X_DAT_00433440;
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index df430ba1ef..b9e1dc4364 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -384,7 +384,7 @@ private:
 
 	void baseMatrixTranspose();
 
-	void renderHolomapPolygons(Vertex *vertexCoordinates, int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
+	void renderHolomapPolygons(int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
 	void computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int16 *polygonTabPtr);
 
 public:


Commit: c67299c31f328b86be00ae03958cfc8148186483
    https://github.com/scummvm/scummvm/commit/c67299c31f328b86be00ae03958cfc8148186483
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:38+01:00

Commit Message:
TWINE: renamed variables

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 736306d86d..f66aaa6054 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1642,23 +1642,23 @@ void Renderer::renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexC
 	renderHolomapPolygons(top,(int16)bottom, _engine->_resources->holomapImagePtr);
 }
 
-void Renderer::renderHolomapPolygons(int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr) {
-	uint8* holomapsurfaceBufferOffsetPosX = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, y_1);
+void Renderer::renderHolomapPolygons(int32 top, int16 bottom, uint8* holomapSurfaceImgOutPtr) {
+	uint8* holomapsurfaceBufferOffsetPosX = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, top);
 	uint8* holomapSurfaceOutPtr = holomapSurfaceImgOutPtr;
-	int16 height = (int16)(param_2 - (int16)y_1) + 1;
-	byte* holomap_offset_X_DAT_00433440 = (byte*)&_polyTab[y_1 * 2];
+	int16 height = (int16)(bottom - (int16)top) + 1;
+	byte* polyTabPtr = (byte*)&_polyTab[top * 2];
 	for (int16 y = 0; y < height; ++y) {
 		uint8* holomapSurfaceOutPos = holomapSurfaceOutPtr;
-		int32 iVar1 = (int32)*holomap_offset_X_DAT_00433440;
+		int32 iVar1 = (int32)*polyTabPtr;
 		uint8 *puVar6 = (uint8 *)(holomapsurfaceBufferOffsetPosX + iVar1);
-		int32 iVar3 = holomap_offset_X_DAT_00433440[480] - iVar1;
-		if (iVar3 != 0 && iVar1 <= holomap_offset_X_DAT_00433440[480]) {
-			iVar1 = (int32)(1 - ((uint32)(uint16)holomap_offset_X_DAT_00433440[1440] -
-			                   (uint32)(uint16)holomap_offset_X_DAT_00433440[2400])) /
+		int32 iVar3 = polyTabPtr[480] - iVar1;
+		if (iVar3 != 0 && iVar1 <= polyTabPtr[480]) {
+			iVar1 = (int32)(1 - ((uint32)(uint16)polyTabPtr[1440] -
+			                   (uint32)(uint16)polyTabPtr[2400])) /
 			        iVar3;
-			uint32 uVar5 = (uint32)(uint16)holomap_offset_X_DAT_00433440[960];
-			int32 iVar2 = (int32)(((uint16)holomap_offset_X_DAT_00433440[1920] - uVar5) + 1) / iVar3;
-			uint16 uVar4 = holomap_offset_X_DAT_00433440[1440];
+			uint32 uVar5 = (uint32)(uint16)polyTabPtr[960];
+			int32 iVar2 = (int32)(((uint16)polyTabPtr[1920] - uVar5) + 1) / iVar3;
+			uint16 uVar4 = polyTabPtr[1440];
 			// int16 holomap_maybe_DAT_00433430 = iVar2;
 			// int16 holomap_maybe_DAT_00433434 = iVar1;
 			for (int32 i = 0; i < iVar3; ++i) {
@@ -1669,7 +1669,7 @@ void Renderer::renderHolomapPolygons(int32 y_1, int16 param_2, uint8* holomapSur
 			}
 		}
 		holomapsurfaceBufferOffsetPosX += _engine->frontVideoBuffer.w;
-		holomap_offset_X_DAT_00433440 = holomap_offset_X_DAT_00433440 + 1;
+		polyTabPtr = polyTabPtr + 1;
 	}
 }
 


Commit: 3255ceba09bed362122ffc9a23548646f553bfa7
    https://github.com/scummvm/scummvm/commit/3255ceba09bed362122ffc9a23548646f553bfa7
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:38+01:00

Commit Message:
TWINE: renamed variables

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index f66aaa6054..bfab3c3c89 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1639,21 +1639,19 @@ void Renderer::renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexC
 								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, _polyTab + hmPolyOffset6);
 		}
 	}
-	renderHolomapPolygons(top,(int16)bottom, _engine->_resources->holomapImagePtr);
+	renderHolomapPolygons(top, (int16)bottom);
 }
 
-void Renderer::renderHolomapPolygons(int32 top, int16 bottom, uint8* holomapSurfaceImgOutPtr) {
+void Renderer::renderHolomapPolygons(int32 top, int16 bottom) {
 	uint8* holomapsurfaceBufferOffsetPosX = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, top);
-	uint8* holomapSurfaceOutPtr = holomapSurfaceImgOutPtr;
 	int16 height = (int16)(bottom - (int16)top) + 1;
 	byte* polyTabPtr = (byte*)&_polyTab[top * 2];
 	for (int16 y = 0; y < height; ++y) {
-		uint8* holomapSurfaceOutPos = holomapSurfaceOutPtr;
-		int32 iVar1 = (int32)*polyTabPtr;
-		uint8 *puVar6 = (uint8 *)(holomapsurfaceBufferOffsetPosX + iVar1);
-		int32 iVar3 = polyTabPtr[480] - iVar1;
-		if (iVar3 != 0 && iVar1 <= polyTabPtr[480]) {
-			iVar1 = (int32)(1 - ((uint32)(uint16)polyTabPtr[1440] -
+		int32 polyTabVal = (int32)*polyTabPtr;
+		uint8 *puVar6 = (uint8 *)(holomapsurfaceBufferOffsetPosX + polyTabVal);
+		int32 iVar3 = polyTabPtr[480] - polyTabVal;
+		if (iVar3 != 0 && polyTabVal <= polyTabPtr[480]) {
+			polyTabVal = (int32)(1 - ((uint32)(uint16)polyTabPtr[1440] -
 			                   (uint32)(uint16)polyTabPtr[2400])) /
 			        iVar3;
 			uint32 uVar5 = (uint32)(uint16)polyTabPtr[960];
@@ -1662,14 +1660,14 @@ void Renderer::renderHolomapPolygons(int32 top, int16 bottom, uint8* holomapSurf
 			// int16 holomap_maybe_DAT_00433430 = iVar2;
 			// int16 holomap_maybe_DAT_00433434 = iVar1;
 			for (int32 i = 0; i < iVar3; ++i) {
-				*puVar6 = *(uint8 *)(((uVar4 & 0xffffff00) | uVar5 >> 8) + holomapSurfaceOutPos);
+				*puVar6 = *(uint8 *)(((uVar4 & 0xffffff00) | uVar5 >> 8) + (uint8*)_engine->_resources->holomapImagePtr);
 				puVar6 = puVar6 + 1;
 				uVar5 = (uint32)(uint16)((int16)uVar5 + (int16)iVar2);
-				uVar4 = ((uint16)(uVar4 & 0xffffff00) | (uVar4 & 0xff)) + (int16)iVar1;
+				uVar4 = ((uint16)(uVar4 & 0xffffff00) | (uVar4 & 0xff)) + (int16)polyTabVal;
 			}
 		}
 		holomapsurfaceBufferOffsetPosX += _engine->frontVideoBuffer.w;
-		polyTabPtr = polyTabPtr + 1;
+		++polyTabPtr;
 	}
 }
 
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index b9e1dc4364..c4f57f4291 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -384,7 +384,7 @@ private:
 
 	void baseMatrixTranspose();
 
-	void renderHolomapPolygons(int32 y_1, int16 param_2, uint8* holomapSurfaceImgOutPtr);
+	void renderHolomapPolygons(int32 top, int16 bottom);
 	void computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int16 *polygonTabPtr);
 
 public:


Commit: 85180081eb3aac48302d37f679002be2715722a7
    https://github.com/scummvm/scummvm/commit/85180081eb3aac48302d37f679002be2715722a7
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:38+01:00

Commit Message:
TWINE: renamed variables

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index bfab3c3c89..f89817776b 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1643,12 +1643,12 @@ void Renderer::renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexC
 }
 
 void Renderer::renderHolomapPolygons(int32 top, int16 bottom) {
-	uint8* holomapsurfaceBufferOffsetPosX = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, top);
+	uint8* pixelBuf = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, top);
 	int16 height = (int16)(bottom - (int16)top) + 1;
 	byte* polyTabPtr = (byte*)&_polyTab[top * 2];
 	for (int16 y = 0; y < height; ++y) {
 		int32 polyTabVal = (int32)*polyTabPtr;
-		uint8 *puVar6 = (uint8 *)(holomapsurfaceBufferOffsetPosX + polyTabVal);
+		uint8 *pixel = (uint8 *)(pixelBuf + polyTabVal);
 		int32 iVar3 = polyTabPtr[480] - polyTabVal;
 		if (iVar3 != 0 && polyTabVal <= polyTabPtr[480]) {
 			polyTabVal = (int32)(1 - ((uint32)(uint16)polyTabPtr[1440] -
@@ -1660,13 +1660,13 @@ void Renderer::renderHolomapPolygons(int32 top, int16 bottom) {
 			// int16 holomap_maybe_DAT_00433430 = iVar2;
 			// int16 holomap_maybe_DAT_00433434 = iVar1;
 			for (int32 i = 0; i < iVar3; ++i) {
-				*puVar6 = *(uint8 *)(((uVar4 & 0xffffff00) | uVar5 >> 8) + (uint8*)_engine->_resources->holomapImagePtr);
-				puVar6 = puVar6 + 1;
+				*pixel = *(uint8 *)(((uVar4 & 0xffffff00) | uVar5 >> 8) + (uint8*)_engine->_resources->holomapImagePtr);
+				++pixel;
 				uVar5 = (uint32)(uint16)((int16)uVar5 + (int16)iVar2);
 				uVar4 = ((uint16)(uVar4 & 0xffffff00) | (uVar4 & 0xff)) + (int16)polyTabVal;
 			}
 		}
-		holomapsurfaceBufferOffsetPosX += _engine->frontVideoBuffer.w;
+		pixelBuf += _engine->frontVideoBuffer.w;
 		++polyTabPtr;
 	}
 }


Commit: 43f9a04805eaeca69a18a894708b24925c8e7f80
    https://github.com/scummvm/scummvm/commit/43f9a04805eaeca69a18a894708b24925c8e7f80
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:38+01:00

Commit Message:
TWINE: renamed variables

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index f89817776b..c55eeaacfb 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1534,7 +1534,7 @@ void Renderer::computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int
 
 static const int hmPolyOffset1 = 0;    /* 0x0000 */
 static const int hmPolyOffset2 = 60;   /* 0x003c */
-static const int hmPolyOffset3 = 120;  /* 0x0070 */
+static const int hmPolyOffset3 = 120;  /* 0x0078 */
 static const int hmPolyOffset4 = 180;  /* 0x00b4 */
 static const int hmPolyOffset5 = 240;  /* 0x00f0 */
 static const int hmPolyOffset6 = 300;  /* 0x012c */
@@ -1649,21 +1649,21 @@ void Renderer::renderHolomapPolygons(int32 top, int16 bottom) {
 	for (int16 y = 0; y < height; ++y) {
 		int32 polyTabVal = (int32)*polyTabPtr;
 		uint8 *pixel = (uint8 *)(pixelBuf + polyTabVal);
-		int32 iVar3 = polyTabPtr[480] - polyTabVal;
-		if (iVar3 != 0 && polyTabVal <= polyTabPtr[480]) {
-			polyTabVal = (int32)(1 - ((uint32)(uint16)polyTabPtr[1440] -
-			                   (uint32)(uint16)polyTabPtr[2400])) /
-			        iVar3;
-			uint32 uVar5 = (uint32)(uint16)polyTabPtr[960];
-			int32 iVar2 = (int32)(((uint16)polyTabPtr[1920] - uVar5) + 1) / iVar3;
-			uint16 uVar4 = polyTabPtr[1440];
+		int32 yHeight = polyTabPtr[hmPolyOffset2] - polyTabVal;
+		if (yHeight != 0 && polyTabVal <= polyTabPtr[hmPolyOffset2]) {
+			polyTabVal = (int32)(1 - ((uint32)(uint16)polyTabPtr[hmPolyOffset4] -
+			                   (uint32)(uint16)polyTabPtr[hmPolyOffset6])) /
+			        yHeight;
+			uint32 uVar5 = (uint32)(uint16)polyTabPtr[hmPolyOffset3];
+			int32 iVar2 = (int32)(((uint16)polyTabPtr[hmPolyOffset5] - uVar5) + 1) / yHeight;
+			uint16 uVar2 = polyTabPtr[hmPolyOffset4];
 			// int16 holomap_maybe_DAT_00433430 = iVar2;
 			// int16 holomap_maybe_DAT_00433434 = iVar1;
-			for (int32 i = 0; i < iVar3; ++i) {
-				*pixel = *(uint8 *)(((uVar4 & 0xffffff00) | uVar5 >> 8) + (uint8*)_engine->_resources->holomapImagePtr);
+			for (int32 i = 0; i < yHeight; ++i) {
+				*pixel = *(uint8 *)(((uVar2 & 0xffffff00) | uVar5 >> 8) + (uint8*)_engine->_resources->holomapImagePtr);
 				++pixel;
 				uVar5 = (uint32)(uint16)((int16)uVar5 + (int16)iVar2);
-				uVar4 = ((uint16)(uVar4 & 0xffffff00) | (uVar4 & 0xff)) + (int16)polyTabVal;
+				uVar2 = ((uint16)(uVar2 & 0xffffff00) | (uVar2 & 0xff)) + (int16)polyTabVal;
 			}
 		}
 		pixelBuf += _engine->frontVideoBuffer.w;


Commit: f6de9f7ebaa2717fa9635ef2fb5f2392b5f949b3
    https://github.com/scummvm/scummvm/commit/f6de9f7ebaa2717fa9635ef2fb5f2392b5f949b3
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:38+01:00

Commit Message:
TWINE: renamed variables

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index c55eeaacfb..b0e0274e82 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1482,7 +1482,6 @@ void Renderer::renderInventoryItem(int32 x, int32 y, const uint8 *bodyPtr, int32
 
 
 void Renderer::computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int16 *polygonTabPtr) {
-#if 0
 	int32 minY = y2;
 	int32 minX = x1;
 	if (y1 < y2) {
@@ -1529,7 +1528,6 @@ void Renderer::computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int
 			lVertexCoordPointer = lVertexCoordPointer + 1;
 		} while (minY != 0);
 	}
-#endif
 }
 
 static const int hmPolyOffset1 = 0;    /* 0x0000 */
@@ -1645,7 +1643,7 @@ void Renderer::renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexC
 void Renderer::renderHolomapPolygons(int32 top, int16 bottom) {
 	uint8* pixelBuf = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, top);
 	int16 height = (int16)(bottom - (int16)top) + 1;
-	byte* polyTabPtr = (byte*)&_polyTab[top * 2];
+	int16* polyTabPtr = (int16*)&_polyTab[top * 2];
 	for (int16 y = 0; y < height; ++y) {
 		int32 polyTabVal = (int32)*polyTabPtr;
 		uint8 *pixel = (uint8 *)(pixelBuf + polyTabVal);
@@ -1654,15 +1652,15 @@ void Renderer::renderHolomapPolygons(int32 top, int16 bottom) {
 			polyTabVal = (int32)(1 - ((uint32)(uint16)polyTabPtr[hmPolyOffset4] -
 			                   (uint32)(uint16)polyTabPtr[hmPolyOffset6])) /
 			        yHeight;
-			uint32 uVar5 = (uint32)(uint16)polyTabPtr[hmPolyOffset3];
-			int32 iVar2 = (int32)(((uint16)polyTabPtr[hmPolyOffset5] - uVar5) + 1) / yHeight;
+			uint32 uVar3 = (uint32)(uint16)polyTabPtr[hmPolyOffset3];
+			int32 iVar1 = (int32)(((uint16)polyTabPtr[hmPolyOffset5] - uVar3) + 1) / yHeight;
 			uint16 uVar2 = polyTabPtr[hmPolyOffset4];
 			// int16 holomap_maybe_DAT_00433430 = iVar2;
 			// int16 holomap_maybe_DAT_00433434 = iVar1;
 			for (int32 i = 0; i < yHeight; ++i) {
-				*pixel = *(uint8 *)(((uVar2 & 0xffffff00) | uVar5 >> 8) + (uint8*)_engine->_resources->holomapImagePtr);
+				*pixel = *(uint8 *)(((uVar2 & 0xffffff00) | uVar3 >> 8) + (uint8*)_engine->_resources->holomapImagePtr);
 				++pixel;
-				uVar5 = (uint32)(uint16)((int16)uVar5 + (int16)iVar2);
+				uVar3 = (uint32)(uint16)((int16)uVar3 + (int16)iVar1);
 				uVar2 = ((uint16)(uVar2 & 0xffffff00) | (uVar2 & 0xff)) + (int16)polyTabVal;
 			}
 		}


Commit: 0f958ba87160f7fe9c5f03e7f90723ac2afade08
    https://github.com/scummvm/scummvm/commit/0f958ba87160f7fe9c5f03e7f90723ac2afade08
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:38+01:00

Commit Message:
TWINE: cleanup in renderHolomapVertices

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index b0e0274e82..7f456bc0f5 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1643,23 +1643,23 @@ void Renderer::renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexC
 void Renderer::renderHolomapPolygons(int32 top, int16 bottom) {
 	uint8* pixelBuf = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, top);
 	int16 height = (int16)(bottom - (int16)top) + 1;
-	int16* polyTabPtr = (int16*)&_polyTab[top * 2];
+	const int16* polyTabPtr = &_polyTab[top];
 	for (int16 y = 0; y < height; ++y) {
 		int32 polyTabVal = (int32)*polyTabPtr;
 		uint8 *pixel = (uint8 *)(pixelBuf + polyTabVal);
-		int32 yHeight = polyTabPtr[hmPolyOffset2] - polyTabVal;
+		const int32 yHeight = polyTabPtr[hmPolyOffset2] - polyTabVal;
 		if (yHeight != 0 && polyTabVal <= polyTabPtr[hmPolyOffset2]) {
 			polyTabVal = (int32)(1 - ((uint32)(uint16)polyTabPtr[hmPolyOffset4] -
-			                   (uint32)(uint16)polyTabPtr[hmPolyOffset6])) /
-			        yHeight;
+									  (uint32)(uint16)polyTabPtr[hmPolyOffset6])) /
+						 yHeight;
 			uint32 uVar3 = (uint32)(uint16)polyTabPtr[hmPolyOffset3];
-			int32 iVar1 = (int32)(((uint16)polyTabPtr[hmPolyOffset5] - uVar3) + 1) / yHeight;
-			uint16 uVar2 = polyTabPtr[hmPolyOffset4];
+			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) {
-				*pixel = *(uint8 *)(((uVar2 & 0xffffff00) | uVar3 >> 8) + (uint8*)_engine->_resources->holomapImagePtr);
-				++pixel;
+				const uint32 idx = ((uVar2 & 0xffffff00) | uVar3 >> 8);
+				*pixel++ = _engine->_resources->holomapImagePtr[idx];
 				uVar3 = (uint32)(uint16)((int16)uVar3 + (int16)iVar1);
 				uVar2 = ((uint16)(uVar2 & 0xffffff00) | (uVar2 & 0xff)) + (int16)polyTabVal;
 			}


Commit: 24f401f25343d3244439012a14bab0c3ef70b7dd
    https://github.com/scummvm/scummvm/commit/24f401f25343d3244439012a14bab0c3ef70b7dd
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:38+01:00

Commit Message:
TWINE: reduced code duplication

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 7f456bc0f5..5e7e7f5f1e 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1537,107 +1537,46 @@ static const int hmPolyOffset4 = 180;  /* 0x00b4 */
 static const int hmPolyOffset5 = 240;  /* 0x00f0 */
 static const int hmPolyOffset6 = 300;  /* 0x012c */
 
-void Renderer::renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]) {
-	int16 top = 32000;
-	uint32 bottom = (uint32)-32000;
-
-	{
-		const uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[0].y;
-		const uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[1].y;
-		if (y_uVar1 < y_uVar2) {
-			if ((int32)y_uVar1 <= (int32)top) {
-				top = y_uVar1;
-			}
-			if ((int32)bottom <= (int32)y_uVar2) {
-				bottom = y_uVar2;
-			}
-			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[0].x, _polyTab + hmPolyOffset1);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
-								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, _polyTab + hmPolyOffset3);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
-								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, _polyTab + hmPolyOffset4);
-		}
-		if (y_uVar2 < y_uVar1) {
-			if ((int32)y_uVar2 <= (int32)top) {
-				top = y_uVar2;
-			}
-			if ((int32)bottom <= (int32)y_uVar1) {
-				bottom = y_uVar1;
-			}
-			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[1].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[0].x, _polyTab + hmPolyOffset2);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x,
-								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x, _polyTab + hmPolyOffset5);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y,
-								(uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y, _polyTab + hmPolyOffset6);
-		}
-	}
-	{
-		const uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[1].y;
-		const uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[2].y;
-		if (y_uVar1 < y_uVar2) {
-			if ((int32)y_uVar1 <= (int32)top) {
-				top = y_uVar1;
-			}
-			if ((int32)bottom <= (int32)y_uVar2) {
-				bottom = y_uVar2;
-			}
-			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[1].x, _polyTab + hmPolyOffset1);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
-								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, _polyTab + hmPolyOffset3);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
-								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, _polyTab + hmPolyOffset4);
+void Renderer::fillHolomapPolygons(const Vertex &vertex1, const Vertex &vertex2, const Vertex &vertex3, const Vertex &vertex4, uint32 &top, uint32 &bottom) {
+	const uint32 y_uVar1 = (uint32)(uint16)vertex1.y;
+	const uint32 y_uVar2 = (uint32)(uint16)vertex2.y;
+	if (y_uVar1 < y_uVar2) {
+		if ((int32)y_uVar1 <= (int32)top) {
+			top = y_uVar1;
 		}
-		if (y_uVar2 < y_uVar1) {
-			if ((int32)y_uVar2 <= (int32)top) {
-				top = y_uVar2;
-			}
-			if ((int32)bottom <= (int32)y_uVar1) {
-				bottom = y_uVar1;
-			}
-			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[2].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[1].x, _polyTab + hmPolyOffset2);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x,
-								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].x, _polyTab + hmPolyOffset5);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y,
-								(uint32)(uint16)vertexCoordinates[1].y, (uint32)vertexCoordinates2[1].y, _polyTab + hmPolyOffset6);
+		if ((int32)bottom <= (int32)y_uVar2) {
+			bottom = y_uVar2;
 		}
+		computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertex2.x, y_uVar1,
+							  (uint32)(uint16)vertex1.x, _polyTab + hmPolyOffset1);
+		computeHolomapPolygon((uint32)(uint16)vertex2.y, (uint32)vertex4.x,
+							  (uint32)(uint16)vertex1.y, (uint32)vertex3.x, _polyTab + hmPolyOffset3);
+		computeHolomapPolygon((uint32)(uint16)vertex2.y, (uint32)vertex4.y,
+							  (uint32)(uint16)vertex1.y, (uint32)vertex3.y, _polyTab + hmPolyOffset4);
 	}
-	{
-		const uint32 y_uVar1 = (uint32)(uint16)vertexCoordinates[2].y;
-		const uint32 y_uVar2 = (uint32)(uint16)vertexCoordinates[0].y;
-		if (y_uVar1 < y_uVar2) {
-			if ((int32)y_uVar1 <= (int32)top) {
-				top = y_uVar1;
-			}
-			if ((int32)bottom <= (int32)y_uVar2) {
-				bottom = y_uVar2;
-			}
-			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[2].x, _polyTab + hmPolyOffset1);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
-								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, _polyTab + hmPolyOffset3);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
-								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, _polyTab + hmPolyOffset4);
+	if (y_uVar2 < y_uVar1) {
+		if ((int32)y_uVar2 <= (int32)top) {
+			top = y_uVar2;
 		}
-		if (y_uVar2 < y_uVar1) {
-			if ((int32)y_uVar2 <= (int32)top) {
-				top = y_uVar2;
-			}
-			if ((int32)bottom <= (int32)y_uVar1) {
-				bottom = y_uVar1;
-			}
-			computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertexCoordinates[0].x, y_uVar1,
-								(uint32)(uint16)vertexCoordinates[2].x, _polyTab + hmPolyOffset2);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].x,
-								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].x, _polyTab + hmPolyOffset5);
-			computeHolomapPolygon((uint32)(uint16)vertexCoordinates[0].y, (uint32)vertexCoordinates2[0].y,
-								(uint32)(uint16)vertexCoordinates[2].y, (uint32)vertexCoordinates2[2].y, _polyTab + hmPolyOffset6);
+		if ((int32)bottom <= (int32)y_uVar1) {
+			bottom = y_uVar1;
 		}
+		computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertex2.x, y_uVar1,
+							  (uint32)(uint16)vertex1.x, _polyTab + hmPolyOffset2);
+		computeHolomapPolygon((uint32)(uint16)vertex2.y, (uint32)vertex4.x,
+							  (uint32)(uint16)vertex1.y, (uint32)vertex3.x, _polyTab + hmPolyOffset5);
+		computeHolomapPolygon((uint32)(uint16)vertex2.y, (uint32)vertex4.y,
+							  (uint32)(uint16)vertex1.y, (uint32)vertex3.y, _polyTab + hmPolyOffset6);
 	}
-	renderHolomapPolygons(top, (int16)bottom);
+}
+
+void Renderer::renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]) {
+	uint32 top = 32000;
+	uint32 bottom = (uint32)-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);
+	renderHolomapPolygons(top, bottom);
 }
 
 void Renderer::renderHolomapPolygons(int32 top, int16 bottom) {
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index c4f57f4291..73b7837bf5 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -386,6 +386,7 @@ private:
 
 	void renderHolomapPolygons(int32 top, int16 bottom);
 	void computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int16 *polygonTabPtr);
+	void fillHolomapPolygons(const Vertex &vertex1, const Vertex &vertex2, const Vertex &vertex3, const Vertex &vertex4, uint32 &top, uint32 &bottom);
 
 public:
 	Renderer(TwinEEngine *engine);


Commit: e066a60a0e08b8181fb3df91c375fed983897306
    https://github.com/scummvm/scummvm/commit/e066a60a0e08b8181fb3df91c375fed983897306
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T17:25:38+01:00

Commit Message:
TWINE: fixes in renderHolomapPolygons

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 5e7e7f5f1e..581ed7f5b3 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1480,7 +1480,6 @@ void Renderer::renderInventoryItem(int32 x, int32 y, const uint8 *bodyPtr, int32
 	renderIsoModel(0, 0, 0, ANGLE_0, angle, ANGLE_0, bodyPtr);
 }
 
-
 void Renderer::computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int16 *polygonTabPtr) {
 	int32 minY = y2;
 	int32 minX = x1;
@@ -1499,7 +1498,7 @@ void Renderer::computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int
 		deltaRatio = deltaRatio << 0x10 | deltaRatio >> 0x10;
 		bool bVar5 = false;
 		deltaY = (x2 & 0xffffU) |
-		         (uint32)(uint16)(((uint16)(deltaX % deltaY >> 1) & 0x7fff) + 0x7fff) << 0x10;
+				 (uint32)(uint16)(((uint16)(deltaX % deltaY >> 1) & 0x7fff) + 0x7fff) << 0x10;
 		do {
 			*lVertexCoordPointer = (int16)deltaY;
 			deltaX = (uint32)bVar5;
@@ -1530,38 +1529,38 @@ void Renderer::computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int
 	}
 }
 
-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 */
+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, uint32 &top, uint32 &bottom) {
-	const uint32 y_uVar1 = (uint32)(uint16)vertex1.y;
-	const uint32 y_uVar2 = (uint32)(uint16)vertex2.y;
-	if (y_uVar1 < y_uVar2) {
-		if ((int32)y_uVar1 <= (int32)top) {
-			top = y_uVar1;
+	const uint32 yBottom = (uint32)(uint16)vertex1.y;
+	const uint32 yTop = (uint32)(uint16)vertex2.y;
+	if (yBottom < yTop) {
+		if ((int32)yBottom <= (int32)top) {
+			top = yBottom;
 		}
-		if ((int32)bottom <= (int32)y_uVar2) {
-			bottom = y_uVar2;
+		if ((int32)bottom <= (int32)yTop) {
+			bottom = yTop;
 		}
-		computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertex2.x, y_uVar1,
+		computeHolomapPolygon(yTop, (uint32)(uint16)vertex2.x, yBottom,
 							  (uint32)(uint16)vertex1.x, _polyTab + hmPolyOffset1);
 		computeHolomapPolygon((uint32)(uint16)vertex2.y, (uint32)vertex4.x,
 							  (uint32)(uint16)vertex1.y, (uint32)vertex3.x, _polyTab + hmPolyOffset3);
 		computeHolomapPolygon((uint32)(uint16)vertex2.y, (uint32)vertex4.y,
 							  (uint32)(uint16)vertex1.y, (uint32)vertex3.y, _polyTab + hmPolyOffset4);
 	}
-	if (y_uVar2 < y_uVar1) {
-		if ((int32)y_uVar2 <= (int32)top) {
-			top = y_uVar2;
+	if (yTop < yBottom) {
+		if ((int32)yTop <= (int32)top) {
+			top = yTop;
 		}
-		if ((int32)bottom <= (int32)y_uVar1) {
-			bottom = y_uVar1;
+		if ((int32)bottom <= (int32)yBottom) {
+			bottom = yBottom;
 		}
-		computeHolomapPolygon(y_uVar2, (uint32)(uint16)vertex2.x, y_uVar1,
+		computeHolomapPolygon(yTop, (uint32)(uint16)vertex2.x, yBottom,
 							  (uint32)(uint16)vertex1.x, _polyTab + hmPolyOffset2);
 		computeHolomapPolygon((uint32)(uint16)vertex2.y, (uint32)vertex4.x,
 							  (uint32)(uint16)vertex1.y, (uint32)vertex3.x, _polyTab + hmPolyOffset5);
@@ -1580,32 +1579,44 @@ void Renderer::renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexC
 }
 
 void Renderer::renderHolomapPolygons(int32 top, int16 bottom) {
-	uint8* pixelBuf = (uint8*)_engine->frontVideoBuffer.getBasePtr(0, top);
-	int16 height = (int16)(bottom - (int16)top) + 1;
-	const int16* polyTabPtr = &_polyTab[top];
-	for (int16 y = 0; y < height; ++y) {
-		int32 polyTabVal = (int32)*polyTabPtr;
-		uint8 *pixel = (uint8 *)(pixelBuf + polyTabVal);
-		const int32 yHeight = polyTabPtr[hmPolyOffset2] - polyTabVal;
-		if (yHeight != 0 && polyTabVal <= polyTabPtr[hmPolyOffset2]) {
-			polyTabVal = (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);
-				*pixel++ = _engine->_resources->holomapImagePtr[idx];
-				uVar3 = (uint32)(uint16)((int16)uVar3 + (int16)iVar1);
-				uVar2 = ((uint16)(uVar2 & 0xffffff00) | (uVar2 & 0xff)) + (int16)polyTabVal;
+	uint8 *out = (uint8 *)_engine->frontVideoBuffer.getBasePtr(0, top);
+	int16 vsize = (int16)(bottom - (int16)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;
+				}
 			}
 		}
-		pixelBuf += _engine->frontVideoBuffer.w;
+		out += _engine->frontVideoBuffer.w;
 		++polyTabPtr;
-	}
+		++currentLine;
+	} while (--vsize);
 }
 
 } // namespace TwinE


Commit: 9b31e28c825dd277ceb82e9e5d612ebbfb3c1205
    https://github.com/scummvm/scummvm/commit/9b31e28c825dd277ceb82e9e5d612ebbfb3c1205
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2021-02-17T18:14:48+01:00

Commit Message:
TWINE: holomap polygon handling cleanup

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


diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index 581ed7f5b3..c3e6943936 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1490,7 +1490,7 @@ void Renderer::computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int
 		x2 = x1;
 	}
 	uint32 deltaY = y1 - minY;
-	int16 *lVertexCoordPointer = (int16 *)(polygonTabPtr + minY * 2);
+	int16 *currentPolygonTabEntry = &polygonTabPtr[minY];
 	if (x2 <= minX) {
 		uint32 deltaX = (uint32)(uint16)((int16)minX - (int16)x2) << 0x10;
 		uint32 deltaRatio = deltaX / deltaY;
@@ -1499,17 +1499,18 @@ void Renderer::computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int
 		bool bVar5 = false;
 		deltaY = (x2 & 0xffffU) |
 				 (uint32)(uint16)(((uint16)(deltaX % deltaY >> 1) & 0x7fff) + 0x7fff) << 0x10;
-		do {
-			*lVertexCoordPointer = (int16)deltaY;
+		for (int32 y = 0; y < minY; ++y) {
+			if (currentPolygonTabEntry >= _polyTab + _polyTabSize) {
+				break;
+			}
+			*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;
-			minY = minY + -1;
-			lVertexCoordPointer = lVertexCoordPointer + 1;
-		} while (minY != 0);
+		}
 	} else {
 		uint32 deltaX = (uint32)(uint16)((int16)x2 - (int16)minX) << 0x10;
 		uint32 deltaRatio = deltaX / deltaY;
@@ -1517,15 +1518,16 @@ void Renderer::computeHolomapPolygon(int32 y1, int32 x1, int32 y2, int32 x2, int
 		deltaRatio = deltaRatio << 0x10 | deltaRatio >> 0x10;
 		bool bVar5 = false;
 		deltaY = (x2 & 0xffffU) | (uint32)(uint16)(((uint16)(deltaX % deltaY >> 1) & 0x7fff) + 0x7fff) << 0x10;
-		do {
-			*lVertexCoordPointer = (int16)deltaY;
+		for (int32 y = 0; y < minY; ++y) {
+			if (currentPolygonTabEntry >= _polyTab + _polyTabSize) {
+				break;
+			}
+			*currentPolygonTabEntry++ = (int16)deltaY;
 			deltaX = (uint32)bVar5;
 			uint32 uVar1 = deltaY - deltaRatio;
 			bVar5 = deltaY < deltaRatio || uVar1 < deltaX;
 			deltaY = uVar1 - deltaX;
-			minY = minY + -1;
-			lVertexCoordPointer = lVertexCoordPointer + 1;
-		} while (minY != 0);
+		}
 	}
 }
 
@@ -1548,12 +1550,11 @@ void Renderer::fillHolomapPolygons(const Vertex &vertex1, const Vertex &vertex2,
 		}
 		computeHolomapPolygon(yTop, (uint32)(uint16)vertex2.x, yBottom,
 							  (uint32)(uint16)vertex1.x, _polyTab + hmPolyOffset1);
-		computeHolomapPolygon((uint32)(uint16)vertex2.y, (uint32)vertex4.x,
-							  (uint32)(uint16)vertex1.y, (uint32)vertex3.x, _polyTab + hmPolyOffset3);
-		computeHolomapPolygon((uint32)(uint16)vertex2.y, (uint32)vertex4.y,
-							  (uint32)(uint16)vertex1.y, (uint32)vertex3.y, _polyTab + hmPolyOffset4);
-	}
-	if (yTop < yBottom) {
+		computeHolomapPolygon(yTop, (uint32)vertex4.x,
+							  yBottom, (uint32)vertex3.x, _polyTab + hmPolyOffset3);
+		computeHolomapPolygon(yTop, (uint32)vertex4.y,
+							  yBottom, (uint32)vertex3.y, _polyTab + hmPolyOffset4);
+	} else if (yTop < yBottom) {
 		if ((int32)yTop <= (int32)top) {
 			top = yTop;
 		}
@@ -1562,14 +1563,14 @@ void Renderer::fillHolomapPolygons(const Vertex &vertex1, const Vertex &vertex2,
 		}
 		computeHolomapPolygon(yTop, (uint32)(uint16)vertex2.x, yBottom,
 							  (uint32)(uint16)vertex1.x, _polyTab + hmPolyOffset2);
-		computeHolomapPolygon((uint32)(uint16)vertex2.y, (uint32)vertex4.x,
-							  (uint32)(uint16)vertex1.y, (uint32)vertex3.x, _polyTab + hmPolyOffset5);
-		computeHolomapPolygon((uint32)(uint16)vertex2.y, (uint32)vertex4.y,
-							  (uint32)(uint16)vertex1.y, (uint32)vertex3.y, _polyTab + hmPolyOffset6);
+		computeHolomapPolygon(yTop, (uint32)vertex4.x,
+							  yBottom, (uint32)vertex3.x, _polyTab + hmPolyOffset5);
+		computeHolomapPolygon(yTop, (uint32)vertex4.y,
+							  yBottom, (uint32)vertex3.y, _polyTab + hmPolyOffset6);
 	}
 }
 
-void Renderer::renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]) {
+void Renderer::renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex vertexCoordinates2[3]) {
 	uint32 top = 32000;
 	uint32 bottom = (uint32)-32000;
 	fillHolomapPolygons(vertexCoordinates[0], vertexCoordinates[1], vertexCoordinates2[0], vertexCoordinates2[1], top, bottom);
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index 73b7837bf5..a4624f641e 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -435,7 +435,7 @@ public:
 
 	void renderInventoryItem(int32 x, int32 y, const uint8 *bodyPtr, int32 angle, int32 param);
 
-	void renderHolomapVertices(Vertex vertexCoordinates[3], Vertex vertexCoordinates2[3]);
+	void renderHolomapVertices(const Vertex vertexCoordinates[3], const Vertex vertexCoordinates2[3]);
 };
 
 } // namespace TwinE




More information about the Scummvm-git-logs mailing list