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

mgerhardy noreply at scummvm.org
Fri Jan 20 11:04:32 UTC 2023


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

Summary:
ad23fb4dc7 TWINE: renamed stuff to match original sources


Commit: ad23fb4dc7b05cb57e527e7789ca6be409120f76
    https://github.com/scummvm/scummvm/commit/ad23fb4dc7b05cb57e527e7789ca6be409120f76
Author: Martin Gerhardy (martin.gerhardy at gmail.com)
Date: 2023-01-20T12:02:54+01:00

Commit Message:
TWINE: renamed stuff to match original sources

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 1d0c7d8fdcd..f6274ef6a1a 100644
--- a/engines/twine/holomap.cpp
+++ b/engines/twine/holomap.cpp
@@ -448,7 +448,7 @@ int32 Holomap::searchNextArrow(int32 currentLocation, int32 dir) const {
 	return -1;
 }
 
-void Holomap::drawListPos(int xRot, int yRot, int zRot, bool lower) {
+void Holomap::drawListPos(int xRot, int yRot, int zRot, bool pos) {
 	int n = 0;
 	DrawListStruct drawListArray[NUM_LOCATIONS];
 	for (int locationIdx = 0; locationIdx < NUM_LOCATIONS; ++locationIdx) {
@@ -466,14 +466,14 @@ void Holomap::drawListPos(int xRot, int yRot, int zRot, bool lower) {
 		const IVec3 &destPos3 = _engine->_renderer->worldRotatePoint(m);
 		const IVec3 &destPos4 = _engine->_renderer->worldRotatePoint(m1);
 
-		bool visible;
-		if (lower) {
-			visible = destPos3.z <= destPos4.z;
+		if (!pos) {
+			if (destPos4.z > destPos3.z) {
+				continue;
+			}
 		} else {
-			visible = destPos4.z <= destPos3.z;
-		}
-		if (!visible) {
-			continue;
+			if (destPos4.z < destPos3.z) {
+				continue;
+			}
 		}
 		uint8 flags = _engine->_gameState->_holomapFlags[locationIdx] & HOLOMAP_ARROW;
 		if (locationIdx == _engine->_scene->_currentSceneIdx) {
diff --git a/engines/twine/renderer/renderer.cpp b/engines/twine/renderer/renderer.cpp
index dd9a1b933e5..50a7a01c1bc 100644
--- a/engines/twine/renderer/renderer.cpp
+++ b/engines/twine/renderer/renderer.cpp
@@ -1575,7 +1575,7 @@ const Renderer::RenderCommand *Renderer::depthSortRenderCommands(int32 numOfPrim
 	return _renderCmds;
 }
 
-bool Renderer::renderModelElements(int32 numOfPrimitives, const BodyData &bodyData, RenderCommand **renderCmds, ModelData *modelData, Common::Rect &modelRect) {
+bool Renderer::renderObjectIso(int32 numOfPrimitives, const BodyData &bodyData, RenderCommand **renderCmds, ModelData *modelData, Common::Rect &modelRect) {
 	uint8 *renderBufferPtr = _renderCoordinatesBuffer;
 	renderBufferPtr = preparePolygons(bodyData.getPolygons(), numOfPrimitives, renderCmds, renderBufferPtr, modelData);
 	renderBufferPtr = prepareLines(bodyData.getLines(), numOfPrimitives, renderCmds, renderBufferPtr, modelData);
@@ -1660,7 +1660,7 @@ bool Renderer::renderModelElements(int32 numOfPrimitives, const BodyData &bodyDa
 	return true;
 }
 
-bool Renderer::renderAnimatedModel(ModelData *modelData, const BodyData &bodyData, RenderCommand *renderCmds, const IVec3 &angleVec, const IVec3 &renderPos, Common::Rect &modelRect) {
+int32 Renderer::animModel(ModelData *modelData, const BodyData &bodyData, RenderCommand *renderCmds, const IVec3 &angleVec, const IVec3 &renderPos, Common::Rect &modelRect) {
 	const int32 numVertices = bodyData.getNumVertices();
 	const int32 numBones = bodyData.getNumBones();
 
@@ -1834,8 +1834,7 @@ bool Renderer::renderAnimatedModel(ModelData *modelData, const BodyData &bodyDat
 			++lightMatrix;
 		} while (--numOfPrimitives);
 	}
-
-	return renderModelElements(numOfPrimitives, bodyData, &renderCmds, modelData, modelRect);
+	return numOfPrimitives;
 }
 
 bool Renderer::affObjetIso(int32 x, int32 y, int32 z, int32 angleX, int32 angleY, int32 angleZ, const BodyData &bodyData, Common::Rect &modelRect) {
@@ -1851,12 +1850,12 @@ bool Renderer::affObjetIso(int32 x, int32 y, int32 z, int32 angleX, int32 angleY
 	modelRect.bottom = SCENE_SIZE_MIN;
 
 	IVec3 renderPos;
-	if (_isUsingIsoProjection) {
+	if (!_isUsingIsoProjection) {
+		renderPos = longWorldRot(x, y, z) - _cameraRot;
+	} else {
 		renderPos.x = x;
 		renderPos.y = y;
 		renderPos.z = z;
-	} else {
-		renderPos = longWorldRot(x, y, z) - _cameraRot;
 	}
 
 	if (!bodyData.isAnimated()) {
@@ -1870,7 +1869,9 @@ bool Renderer::affObjetIso(int32 x, int32 y, int32 z, int32 angleX, int32 angleY
 #endif
 	}
 	// restart at the beginning of the renderTable
-	if (!renderAnimatedModel(&_modelData, bodyData, _renderCmds, renderAngle, renderPos, modelRect)) {
+	RenderCommand *renderCmds = _renderCmds;
+	const int32 numOfPrimitives = animModel(&_modelData, bodyData, renderCmds, renderAngle, renderPos, modelRect);
+	if (renderObjectIso(numOfPrimitives, bodyData, &renderCmds, &_modelData, modelRect)) {
 		modelRect.right = -1;
 		modelRect.bottom = -1;
 		modelRect.left = -1;
diff --git a/engines/twine/renderer/renderer.h b/engines/twine/renderer/renderer.h
index e8304c464f6..89f8ea32e7e 100644
--- a/engines/twine/renderer/renderer.h
+++ b/engines/twine/renderer/renderer.h
@@ -151,9 +151,9 @@ private:
 
 	ModelData _modelData;
 
-	bool renderAnimatedModel(ModelData *modelData, const BodyData &bodyData, RenderCommand *renderCmds, const IVec3 &angleVec, const IVec3 &renderPos, Common::Rect &modelRect);
+	int32 animModel(ModelData *modelData, const BodyData &bodyData, RenderCommand *renderCmds, const IVec3 &angleVec, const IVec3 &renderPos, Common::Rect &modelRect);
 	bool computeSphere(int32 x, int32 y, int32 radius, int &vtop, int &vbottom);
-	bool renderModelElements(int32 numOfPrimitives, const BodyData &bodyData, RenderCommand **renderCmds, ModelData *modelData, Common::Rect &modelRect);
+	bool renderObjectIso(int32 numOfPrimitives, const BodyData &bodyData, RenderCommand **renderCmds, ModelData *modelData, Common::Rect &modelRect); // RenderObjetIso
 	IVec3 longInverseRot(int32 x, int32 y, int32 z);
 	inline IVec3 getCameraAnglePositions(const IVec3 &vec) {
 		return longInverseRot(vec.x, vec.y, vec.z);




More information about the Scummvm-git-logs mailing list